aktion-runtime 0.5.10 → 0.5.11
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 +20 -10
- package/dist/aktion.iife.js +113 -136
- package/dist/aktion.iife.js.map +1 -1
- package/dist/aktion.js +4087 -3959
- package/dist/aktion.js.map +1 -1
- package/dist/aktion.umd.cjs +113 -136
- package/dist/aktion.umd.cjs.map +1 -1
- package/dist/language.js +1938 -1662
- package/dist/language.js.map +1 -1
- package/dist/system_prompt.txt +28 -26
- package/dist/system_prompt_chat.txt +11 -11
- package/dist/testing.js +358 -197
- package/dist/testing.js.map +1 -1
- package/dist/types/library/types.d.ts +50 -0
- package/dist/types/library/utils.d.ts +28 -0
- package/dist/types/library/validate.d.ts +2 -2
- package/dist/types/runtime/evaluator.d.ts +8 -0
- package/dist/types/theme/index.d.ts +3 -0
- package/dist/types/theme/styles.d.ts +1 -1
- package/dist/types/tooling/signature-help.d.ts +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -508,18 +508,23 @@ $app(pages)
|
|
|
508
508
|
operators (`= += -= *= /= ??= ++ --`) are all allowed.
|
|
509
509
|
`let/const/var` are optional and do not affect reactivity — only the
|
|
510
510
|
`$` prefix makes a value reactive.
|
|
511
|
-
- **Component-call
|
|
512
|
-
rule:
|
|
511
|
+
- **Component-call shapes** — pick ONE per call:
|
|
513
512
|
|
|
514
513
|
```js
|
|
515
|
-
Component(positionalArg, { prop: value, … })
|
|
514
|
+
Component(positionalArg, { prop: value, … }) // canonical
|
|
515
|
+
Component(arg1, arg2, arg3) // all-positional, signature order
|
|
516
|
+
Component({ prop: value, … }) // all-named single object
|
|
516
517
|
```
|
|
517
518
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
`
|
|
519
|
+
The canonical form passes the prop tagged `(positional)` bare and every
|
|
520
|
+
other prop in a trailing `{ }` object. All-positional calls bind
|
|
521
|
+
arguments to the signature's props in listed order — mind that order:
|
|
522
|
+
`Button("Save", "primary")` puts `"primary"` in the second slot
|
|
523
|
+
(`onClick`), not `variant`, so prefer the trailing object for
|
|
524
|
+
non-adjacent props. A single `{ }` argument whose keys are prop names
|
|
525
|
+
is an all-named call; when the component's positional prop is itself
|
|
526
|
+
object-typed, a lone object is that prop's payload instead. One object
|
|
527
|
+
is never split between the two roles.
|
|
523
528
|
- `function Name(p = default) { return Expression }` — PascalCase name
|
|
524
529
|
means it's a component. Parameters use standard JS defaults (`=`).
|
|
525
530
|
Inside the body, `$x = expr` is a **declaration**: the initializer
|
|
@@ -527,6 +532,11 @@ $app(pages)
|
|
|
527
532
|
whatever value the user (or an action / effect) has written.
|
|
528
533
|
**Always** end with an explicit `return`. Components do not have a
|
|
529
534
|
`props` object — every parameter is a real JS parameter.
|
|
535
|
+
A custom component may NOT reuse a built-in component's name (the
|
|
536
|
+
validator flags it) — unless its body calls that same name, the
|
|
537
|
+
supported **wrapper pattern**: inside its own body the name resolves to
|
|
538
|
+
the BUILT-IN, so `function Badge(l) { return Badge(l, { tone:
|
|
539
|
+
"success" }) }` extends the library Badge instead of recursing.
|
|
530
540
|
- `function name(args) { body }` — camelCase name means it's an action.
|
|
531
541
|
Callable effects with optional `return`. Used as event handlers
|
|
532
542
|
(`onClick: save`) or as expressions (`$result = greet("Ada")`). Wrap
|
|
@@ -713,7 +723,7 @@ Highlights:
|
|
|
713
723
|
- Array shortcuts: `$rows.length`, `$rows.first`, `$rows.last`,
|
|
714
724
|
plus pluck (`$rows.title` → `[title1, title2, …]`).
|
|
715
725
|
- Responsive prop maps on layout components:
|
|
716
|
-
`Grid(items, { columns: { sm: 1, md: 2, lg: 4 }, gap: "
|
|
726
|
+
`Grid(items, { columns: { sm: 1, md: 2, lg: 4 }, gap: "lg" })`.
|
|
717
727
|
- Forward references are allowed — call `$app(Column([...]))` first
|
|
718
728
|
and let the children stream in beneath it.
|
|
719
729
|
|
|
@@ -1343,7 +1353,7 @@ nav = Row([
|
|
|
1343
1353
|
NavLink("Home", { to: "/", exact: true }),
|
|
1344
1354
|
NavLink("Dashboard", { to: "/dashboard" }),
|
|
1345
1355
|
NavLink("Users", { to: "/users" })
|
|
1346
|
-
], { gap: "
|
|
1356
|
+
], { gap: "sm" })
|
|
1347
1357
|
|
|
1348
1358
|
$app(Stack([nav, pages]))
|
|
1349
1359
|
|