From 7caf22fe0c1963f95701b1dc05807f94329d341a Mon Sep 17 00:00:00 2001 From: Ahmed Yasin Koculu Date: Thu, 26 Feb 2026 03:23:07 +0100 Subject: [PATCH] Performance + Runtime Simplification --- README.md | 59 +- benchmarks/index.html | 53 ++ benchmarks/initial-load.html | 34 + benchmarks/src/index.ts | 752 +++++++++++++----- benchmarks/src/initial-load.ts | 290 ++++--- benchmarks/src/shared.ts | 110 +++ docs-site/src/content/docs/api/drainUnbind.md | 48 ++ docs-site/src/content/docs/api/index.md | 1 + docs-site/src/content/docs/api/removeNode.md | 1 + docs-site/src/content/docs/api/unbind.md | 1 + docs-site/src/content/docs/getting-started.md | 3 + .../src/content/docs/guide/components.md | 10 +- .../docs/guide/lifecycle-and-cleanup.md | 13 +- docs-site/src/content/docs/guide/mounting.md | 6 +- .../src/content/docs/guide/performance.md | 181 +++-- .../src/content/docs/guide/persisted-state.md | 6 +- .../src/content/docs/guide/reactivity.md | 30 +- docs-site/src/content/docs/guide/templates.md | 8 +- .../src/content/docs/guide/typescript.md | 6 +- docs-site/src/content/docs/index.mdx | 16 +- docs-site/src/content/docs/overview.md | 23 + package.json | 2 +- src/api/types.ts | 50 +- src/app/ComponentHead.ts | 5 +- src/app/createComponent.ts | 4 +- src/bind/Binder.ts | 234 +++--- src/bind/ComponentBinder.ts | 12 +- src/bind/DirectiveCollector.ts | 5 +- src/bind/DynamicBinder.ts | 15 +- src/bind/ForBinder.ts | 61 +- src/bind/ForBinderFastPath.ts | 132 +++ src/bind/ForBinderKeyedDiff.ts | 207 +++++ src/bind/IfBinder.ts | 30 +- src/cleanup/unbind.ts | 4 +- src/common/common.ts | 16 +- src/directives/attr.ts | 91 ++- src/directives/class.ts | 46 +- src/directives/context.ts | 45 +- src/directives/html.ts | 30 +- src/directives/model.ts | 24 +- src/directives/on.ts | 123 +-- src/directives/prop.ts | 74 +- src/directives/ref.ts | 5 +- src/directives/show.ts | 26 +- src/directives/single-prop.ts | 85 +- src/directives/style.ts | 46 +- src/directives/teleport.ts | 4 +- src/directives/text.ts | 30 +- src/directives/value.ts | 8 +- src/parser/Parser.ts | 66 +- tests/bind/binder-edge.spec.ts | 16 +- tests/bind/for-binder.spec.ts | 82 ++ tests/coverage/utility-edge.spec.ts | 9 +- tests/directive-test-utils.ts | 96 +++ tests/directives/attr.spec.ts | 23 +- tests/directives/class.spec.ts | 8 +- tests/directives/html.spec.ts | 7 +- tests/directives/model-edge.spec.ts | 72 +- tests/directives/model.spec.ts | 23 +- tests/directives/on-advanced.spec.ts | 15 +- tests/directives/prop.spec.ts | 7 +- tests/directives/r-bind-mapping.spec.ts | 5 +- tests/directives/ref.spec.ts | 34 +- tests/directives/single-prop.spec.ts | 68 +- tests/directives/style.spec.ts | 32 +- tests/directives/text.spec.ts | 11 +- tests/directives/value.spec.ts | 5 +- tests/minidom/minidom.ts | 90 ++- vitest.config.ts | 5 +- 69 files changed, 2658 insertions(+), 1081 deletions(-) create mode 100644 benchmarks/src/shared.ts create mode 100644 docs-site/src/content/docs/api/drainUnbind.md create mode 100644 src/bind/ForBinderFastPath.ts create mode 100644 src/bind/ForBinderKeyedDiff.ts create mode 100644 tests/directive-test-utils.ts diff --git a/README.md b/README.md index e924b50..c8fb200 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ # Regor -Regor is a powerful UI framework designed to streamline the development of HTML5-based applications for both web and desktop environments. With a template syntax that closely follows Vue.js, transitioning from VueJS to Regor is seamless for developers familiar with Vue. +Regor is a runtime-first UI framework for teams that want direct DOM control, strong TypeScript ergonomics, and precise reactivity behavior without being forced into a Virtual DOM architecture. + +Its template syntax is familiar to Vue users (`r-if`, `r-model`, `r-for`, `r-bind`), but its runtime model is intentionally different: Regor is built for progressive enhancement, mixed-rendering environments, and incremental adoption. ### [![Published on npm](https://img.shields.io/npm/v/regor.svg)](https://www.npmjs.com/package/regor) @@ -10,9 +12,9 @@ Regor is a powerful UI framework designed to streamline the development of HTML5 ## Key Features -- **Simplicity:** Develop UIs without a Virtual DOM for a more straightforward implementation and easier debugging. -- **TypeScript:** Enjoy native TypeScript support without workarounds. -- **No Build Step Required:** Define components in TypeScript using tagged string templates, no build step needed. +- **No VDOM Layer:** Bind directly to real DOM for transparent runtime behavior and straightforward debugging. +- **TypeScript-Native:** Use standard TypeScript interfaces, classes, and generics without framework-specific file formats. +- **No Build Step Required:** Define components in TypeScript using tagged string templates with npm, CDN ESM, or global build workflows. - **Secure Evaluation:** Regor's secure JavaScript VM ensures safe runtime compilation. You can enable security policy in your page without removing runtime compilation support. ```html @@ -22,9 +24,9 @@ Regor is a powerful UI framework designed to streamline the development of HTML5 /> ``` -- **Flexible Reactivity:** Empowering developers with a highly flexible reactivity system. -- **Non-JS SSR:** Bind to the existing DOM without removing already mounted HTML elements, suitable for non-JavaScript server-side rendering. -- **Reentrance:** Regor supports multiple mountings in the previously mounted area using the same or different app contexts. This enables creating and mounting new directives dynamically. +- **Flexible Reactivity:** Combine `ref`, `sref`, `batch`, `pause`, `resume`, and `entangle` for explicit state orchestration. +- **Static-First + Islands:** Bind to existing DOM without removing server-rendered HTML, ideal for progressive enhancement. +- **Reentrance:** Mount multiple times in already-mounted regions with same or different app contexts. - **Compatibility:** Rendered pages are designed for seamless integration with other libraries manipulating the DOM. ## Documentation @@ -72,16 +74,13 @@ const template = html`