@constela/compiler 0.14.4 → 0.14.6

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.
Files changed (2) hide show
  1. package/README.md +31 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -54,6 +54,37 @@ The compiler transforms JSON programs through three passes:
54
54
  - **Object payloads** - Supports object-shaped event handler payloads with expression fields
55
55
  - **call/lambda expressions** - Compiles method calls and anonymous functions for array/string/Math/Date operations
56
56
  - **array expression** - Compiles dynamic array construction from expressions
57
+ - **localState/localActions** - Component-scoped state with instance isolation
58
+
59
+ ## Component Local State
60
+
61
+ Components can define `localState` and `localActions` for instance-scoped state:
62
+
63
+ ```json
64
+ {
65
+ "components": {
66
+ "Accordion": {
67
+ "params": { "title": { "type": "string" } },
68
+ "localState": {
69
+ "isExpanded": { "type": "boolean", "initial": false }
70
+ },
71
+ "localActions": [
72
+ {
73
+ "name": "toggle",
74
+ "steps": [{ "do": "update", "target": "isExpanded", "operation": "toggle" }]
75
+ }
76
+ ],
77
+ "view": { ... }
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ The compiler:
84
+ 1. Validates local state types and initial values
85
+ 2. Wraps component views with `localState` nodes
86
+ 3. Transforms local actions with instance-scoped store references
87
+ 4. Handles param substitution within component views
57
88
 
58
89
  ## CompiledProgram Structure
59
90
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/compiler",
3
- "version": "0.14.4",
3
+ "version": "0.14.6",
4
4
  "description": "Compiler for Constela UI framework - AST to Program transformation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@constela/core": "0.15.2"
18
+ "@constela/core": "0.16.1"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^20.10.0",