@ktjs/shared

v0.40.1

Published

Shared utilities and cached native methods for kt.js framework

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

0.40.x Breaking Changes ✨

  1. ref.addOnChange is renamed to ref.listen.
  2. Value listeners are now stored in a Set instead of Map.
  3. KTFor, KTIf,KTAsync,Fragment are completely refactored by using KTAnchor. More reliable, efficient and safe. (Lifecycle mechanism is under design)
  4. sub-getters are now using KTComputed, subref is unchanged.
  5. Add KType.Custom for custom reactive classes.

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 dev

Security model

kt.js intentionally trusts application code and keeps DOM operations explicit.

  • Text children are inserted as text nodes by default.
  • k-html is a raw HTML escape hatch that writes to innerHTML without sanitization.
  • Prefer on:* event bindings. Do not pass raw onclick / onerror style 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.