round-core 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -41
- package/dist/index.d.ts +341 -341
- package/dist/index.js +211 -192
- package/dist/vite-plugin.js +52 -3
- package/package.json +7 -4
- package/.github/workflows/benchmarks.yml +0 -44
- package/Round.png +0 -0
- package/benchmarks/apps/react/index.html +0 -9
- package/benchmarks/apps/react/main.jsx +0 -25
- package/benchmarks/apps/react/vite.config.js +0 -12
- package/benchmarks/apps/round/index.html +0 -11
- package/benchmarks/apps/round/main.jsx +0 -22
- package/benchmarks/apps/round/vite.config.js +0 -15
- package/benchmarks/bun.lock +0 -497
- package/benchmarks/dist-bench/react/assets/index-9KGqIPOU.js +0 -8
- package/benchmarks/dist-bench/react/index.html +0 -10
- package/benchmarks/dist-bench/round/assets/index-CBBIRhox.js +0 -52
- package/benchmarks/dist-bench/round/index.html +0 -8
- package/benchmarks/package.json +0 -22
- package/benchmarks/scripts/measure-build.js +0 -64
- package/benchmarks/tests/runtime.bench.js +0 -51
- package/benchmarks/vitest.config.js +0 -8
- package/bun.lock +0 -425
- package/cli.js +0 -2
- package/extension/.vscodeignore +0 -5
- package/extension/LICENSE +0 -21
- package/extension/cgmanifest.json +0 -45
- package/extension/extension.js +0 -163
- package/extension/images/round-config-dark.svg +0 -10
- package/extension/images/round-config-light.svg +0 -10
- package/extension/images/round-dark.svg +0 -10
- package/extension/images/round-light.svg +0 -10
- package/extension/javascript-language-configuration.json +0 -241
- package/extension/package-lock.json +0 -97
- package/extension/package.json +0 -119
- package/extension/package.nls.json +0 -4
- package/extension/round-0.1.0.vsix +0 -0
- package/extension/round-lsp/package-lock.json +0 -185
- package/extension/round-lsp/package.json +0 -21
- package/extension/round-lsp/src/round-transformer-lsp.js +0 -248
- package/extension/round-lsp/src/server.js +0 -396
- package/extension/snippets/javascript.code-snippets +0 -266
- package/extension/snippets/round.code-snippets +0 -109
- package/extension/syntaxes/JavaScript.tmLanguage.json +0 -6001
- package/extension/syntaxes/JavaScriptReact.tmLanguage.json +0 -6066
- package/extension/syntaxes/Readme.md +0 -12
- package/extension/syntaxes/Regular Expressions (JavaScript).tmLanguage +0 -237
- package/extension/syntaxes/Round.tmLanguage.json +0 -290
- package/extension/syntaxes/RoundInject.tmLanguage.json +0 -20
- package/extension/tags-language-configuration.json +0 -152
- package/extension/temp_astro/package-lock.json +0 -912
- package/extension/temp_astro/package.json +0 -16
- package/extension/types/round-core.d.ts +0 -326
- package/index.js +0 -2
- package/logo.svg +0 -10
- package/src/cli.js +0 -608
- package/src/compiler/index.js +0 -2
- package/src/compiler/transformer.js +0 -443
- package/src/compiler/vite-plugin.js +0 -472
- package/src/index.d.ts +0 -341
- package/src/index.js +0 -45
- package/src/runtime/context.js +0 -101
- package/src/runtime/dom.js +0 -403
- package/src/runtime/error-boundary.js +0 -48
- package/src/runtime/error-reporter.js +0 -13
- package/src/runtime/error-store.js +0 -85
- package/src/runtime/errors.js +0 -152
- package/src/runtime/lifecycle.js +0 -142
- package/src/runtime/markdown.js +0 -72
- package/src/runtime/router.js +0 -468
- package/src/runtime/signals.js +0 -548
- package/src/runtime/store.js +0 -215
- package/src/runtime/suspense.js +0 -128
- package/vite.config.build.js +0 -48
- package/vite.config.js +0 -10
- package/vitest.config.js +0 -8
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<h1 align="center">Round
|
|
1
|
+
<h1 align="center">Round JS</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<img src="https://raw.githubusercontent.com/ZtaMDev/RoundJS/main/Round.png" alt="Round Framework Logo" width="200" />
|
|
@@ -12,27 +12,46 @@
|
|
|
12
12
|
<em>Round is a lightweight frontend framework focused on building <b>single-page applications (SPAs)</b> with <b>fine‑grained reactivity.</b></em>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
+
<div align="center">
|
|
16
|
+
|
|
17
|
+
Extension for [VSCode](https://marketplace.visualstudio.com/items?itemName=ZtaMDev.round) and [OpenVSX](https://open-vsx.org/extension/ztamdev/round)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
Instead of a Virtual DOM diff, Round updates the UI by subscribing DOM updates directly to reactive primitives (**signals**) and **bindables**. This keeps rendering predictable, small, and fast for interactive apps.
|
|
24
|
+
|
|
25
|
+
The `round-core` package is the **foundation of RoundJS**.
|
|
26
|
+
|
|
27
|
+
You can think of `round-core` as:
|
|
28
|
+
- A **framework-level runtime**, not just a state library
|
|
29
|
+
- Comparable in scope to React + Router + Signals, but significantly smaller
|
|
30
|
+
- Suitable for fast SPAs and simple SSR setups without heavy infrastructure
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
To use Round JS today, install the core package:
|
|
35
|
+
|
|
15
36
|
```bash
|
|
16
37
|
npm install round-core
|
|
17
38
|
```
|
|
18
39
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## What Round is focused on
|
|
40
|
+
Or with Bun:
|
|
22
41
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **A JSX superset**: `.round` files support extra control-flow syntax that compiles to JavaScript.
|
|
27
|
-
- **Minimal runtime**: DOM-first runtime (no VDOM diffing).
|
|
42
|
+
```bash
|
|
43
|
+
bun add round-core
|
|
44
|
+
```
|
|
28
45
|
|
|
29
|
-
##
|
|
46
|
+
## What Round is focused on
|
|
30
47
|
|
|
31
48
|
Round is a **No-VDOM** framework.
|
|
32
49
|
|
|
33
50
|
1. **Direct DOM Manipulation**: Components run once. They return real DOM nodes (via `document.createElement`).
|
|
34
51
|
2. **Fine-Grained Reactivity**: Use of `signal`, `effect`, and `bindable` creates a dependency graph.
|
|
35
|
-
3. **
|
|
52
|
+
3. **Ergonomic bindings**: built-in two-way bindings with `bind:*` directives.
|
|
53
|
+
4. **Surgical Updates**: When a signal changes, only the specific text node, attribute, or property subscribed to that signal is updated. The component function does not re-run.
|
|
54
|
+
5. **A JSX superset**: `.round` files support extra control-flow syntax that compiles to JavaScript.
|
|
36
55
|
|
|
37
56
|
This avoids the overhead of Virtual DOM diffing and reconciliation entirely.
|
|
38
57
|
|
|
@@ -49,35 +68,6 @@ A **signal** is a small reactive container.
|
|
|
49
68
|
- Reading a signal inside an `effect()` tracks a dependency.
|
|
50
69
|
- Writing to a signal triggers only the subscribed computations.
|
|
51
70
|
|
|
52
|
-
|
|
53
|
-
## Normal Installation
|
|
54
|
-
|
|
55
|
-
Simply install the `round-core` package
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
bun add round-core
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Or:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
npm install round-core
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Repo Installation
|
|
68
|
-
|
|
69
|
-
> Round is currently in active development. If you are using the repository directly, install dependencies and run the CLI locally.
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
bun install
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Or:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
npm install
|
|
79
|
-
```
|
|
80
|
-
|
|
81
71
|
## Quick start (create a new app)
|
|
82
72
|
|
|
83
73
|
Round includes a CLI with a project initializer.
|
|
@@ -93,7 +83,9 @@ This scaffolds a minimal Round app with `src/app.round` and an example `src/coun
|
|
|
93
83
|
|
|
94
84
|
## `.round` files
|
|
95
85
|
|
|
96
|
-
A `.round` file is a JSX-based component module (ESM) compiled by the Round toolchain.
|
|
86
|
+
A `.round` file is a JSX-based component module (ESM) compiled by the Round toolchain.
|
|
87
|
+
You can also use `.jsx` files, but you will not get the Round JSX superset features
|
|
88
|
+
such as extended control flow.
|
|
97
89
|
|
|
98
90
|
Example `src/app.round`:
|
|
99
91
|
|
|
@@ -320,6 +312,20 @@ Notes:
|
|
|
320
312
|
|
|
321
313
|
This compiles roughly to a `.map(...)` under the hood.
|
|
322
314
|
|
|
315
|
+
### `switch`
|
|
316
|
+
|
|
317
|
+
```jsx
|
|
318
|
+
{switch(status()){
|
|
319
|
+
case 'loading': return <Spinner />;
|
|
320
|
+
case 'error': return <ErrorMessage />;
|
|
321
|
+
default: return <DataView />;
|
|
322
|
+
}}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Notes:
|
|
326
|
+
- The `switch` expression is automatically wrapped in a reactive tracker, ensuring that the view updates surgically when the condition (e.g., a signal) changes.
|
|
327
|
+
- Each case handles its own rendering without re-running the parent component.
|
|
328
|
+
|
|
323
329
|
## Routing
|
|
324
330
|
|
|
325
331
|
Round includes router primitives intended for SPA navigation. All route paths must start with a forward slash `/`.
|
|
@@ -403,6 +409,21 @@ The CLI is intended for day-to-day development:
|
|
|
403
409
|
|
|
404
410
|
Run `round -h` to see available commands.
|
|
405
411
|
|
|
412
|
+
## Signals Internals
|
|
413
|
+
|
|
414
|
+
RoundJS utilizes a high-performance reactivity engine designed for efficiency and minimal memory overhead:
|
|
415
|
+
|
|
416
|
+
- **Doubly-Linked List Dependency Tracking**: Instead of using heavy `Set` objects, RoundJS uses a linked-list of subscription nodes. This eliminates array spreads and object allocations during signal updates, providing constant-time performance for adding/removing dependencies.
|
|
417
|
+
- **Global Versioning (Clock)**: Every signal write increments a global version counter. Computed signals (`derive`) track the version of their dependencies and only recompute if they are "dirty" (out of date). This ensures true lazyness and avoids redundant calculations.
|
|
418
|
+
- **Automatic Batching**: Multiple signal updates within the same execution cycle are batched. Effects and DOM updates only trigger once at the end of the batch, preventing "glitches" and unnecessary re-renders.
|
|
419
|
+
|
|
420
|
+
## Performance
|
|
421
|
+
|
|
422
|
+
RoundJS sits in a powerful "middle ground" of performance:
|
|
423
|
+
|
|
424
|
+
- **vs React**: Round's fine-grained reactivity is **massively faster** (>30x in micro-benchmarks) than React's component-level reconciliation. DOM updates are surgical and don't require diffing a virtual tree.
|
|
425
|
+
- **vs Preact Signals**: While highly optimized, RoundJS signals are currently slightly slower than Preact Signals (~10x difference in raw signal-to-signal updates), as Preact utilizes more aggressive internal optimizations. However, for most real-world applications, RoundJS provides more than enough performance.
|
|
426
|
+
|
|
406
427
|
## Status
|
|
407
428
|
|
|
408
429
|
Round is under active development and the API is still stabilizing. The README is currently the primary documentation; a dedicated documentation site will be built later using Round itself.
|