@ktjs/ts-plugin
v0.3.7
Published
TypeScript language service plugin for kt.js k-for scope names in TSX.
Maintainers
Readme
KT.js
kt.js is still under development, there might be some breaking api changes.
Community
- QQ Group:
1070434849 - Telegram: https://t.me/kt_js
Recent Updates
- Plugins:
k-fornow supportsCtrl + Clickto navigate to the source of the iterable variable and rename byF2.kt-tscis now available for type checking. (Mainly check whether thek-forstatement is valid)
- Framework: <= 0.38.x - reactive helper additions
reactive.is(target): create a boolean computed based onObject.iscomparison.reactive.match(pattern): create a boolean computed using deep object/array pattern matching.get(...keys): create aKTSubComputedobject. It is a light version of computed, used to bind valuessubref(...keys): create aKTSubRefobject. It is a light version of ref, used to bind values and also support two-way binding withk-model.ref.valueremains the standard read API, and it can also replace the whole outer value withref.value = nextValue.- 0.33.x -
ref.draftis the deep-mutation entry for literally any objects. Just usesomeRef.draft.a = someValue, and kt.js will add it to microqueue and redraw it on the next tick. Works forMap,Set,Array,Dateand your custom objects.ref.draftitself is not assignable. addOnChange((newValue, oldValue) => ...)keepsoldValueas the previous reference, not a deep snapshot.
Introduction
kt.js is a web framework with a tiny runtime that renders real DOM directly (no virtual DOM), uses explicit reactivity variables and gives you manual control over refs, bindings, and redraw timing.
KT.js focuses on one principle: keep direct control of the DOM and avoid unnecessary repainting.
Quick Start
pnpm create kt.js my-app
cd my-app
pnpm install
pnpm devSecurity model
kt.js intentionally trusts application code and keeps DOM operations explicit.
- Text children are inserted as text nodes by default.
k-htmlis a raw HTML escape hatch that writes toinnerHTMLwithout sanitization.- Prefer
on:*event bindings. Do not pass rawonclick/onerrorstyle strings. - Attributes such as
href,src,srcdoc,action, and SVG URL attributes are forwarded as-is. - If you bind untrusted input, sanitization and validation must be handled by your application.
License
MIT License.
