@native-sdk/cli 0.6.3 → 0.7.0
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/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/skill-data/native-ui/SKILL.md +17 -2
- package/src/primitives/canvas/code.zig +590 -0
- package/src/primitives/canvas/code_tests.zig +1062 -0
- package/src/primitives/canvas/layout_audit.zig +3 -1
- package/src/primitives/canvas/markdown.zig +13 -11
- package/src/primitives/canvas/markdown_tests.zig +167 -4
- package/src/primitives/canvas/root.zig +4 -2
- package/src/primitives/canvas/tests.zig +1 -0
- package/src/primitives/canvas/text_measure_cache.zig +4 -4
- package/src/primitives/canvas/text_span_tests.zig +254 -0
- package/src/primitives/canvas/text_spans.zig +556 -32
- package/src/primitives/canvas/themes/geist.zig +29 -0
- package/src/primitives/canvas/tokens.zig +72 -2
- package/src/primitives/canvas/ui.zig +304 -5
- package/src/primitives/canvas/ui_markup.zig +59 -2
- package/src/primitives/canvas/ui_markup_compiled.zig +76 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +33 -0
- package/src/primitives/canvas/ui_markup_contract.zig +34 -0
- package/src/primitives/canvas/ui_markup_view.zig +73 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +85 -0
- package/src/primitives/canvas/ui_schema.zig +17 -6
- package/src/primitives/canvas/ui_schema_tests.zig +7 -6
- package/src/primitives/canvas/widget_invalidation.zig +3 -0
- package/src/primitives/canvas/widget_layout.zig +57 -8
- package/src/primitives/canvas/widget_layout_tests.zig +35 -0
- package/src/primitives/canvas/widget_metrics.zig +30 -1
- package/src/primitives/canvas/widget_render.zig +454 -9
- package/src/primitives/canvas/widget_text_select.zig +2 -2
- package/src/primitives/canvas/widgets.zig +13 -0
- package/src/root.zig +1 -0
- package/src/runtime/canvas_widget_clipboard_tests.zig +130 -0
- package/src/runtime/canvas_widget_context_menu.zig +12 -2
- package/src/runtime/canvas_widget_events.zig +7 -1
- package/src/runtime/canvas_widget_runtime.zig +7 -2
- package/src/runtime/canvas_widget_text_tests.zig +57 -0
- package/src/runtime/view.zig +7 -3
- package/src/runtime/view_widget_text.zig +194 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "The Native SDK: the complete toolkit for building native desktop applications — declarative markup, native rendering, WebView surfaces, and OS capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@typescript/typescript6": "6.0.2"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@native-sdk/cli-darwin-arm64": "0.
|
|
36
|
-
"@native-sdk/cli-darwin-x64": "0.
|
|
37
|
-
"@native-sdk/cli-linux-arm64-gnu": "0.
|
|
38
|
-
"@native-sdk/cli-linux-arm64-musl": "0.
|
|
39
|
-
"@native-sdk/cli-linux-x64-gnu": "0.
|
|
40
|
-
"@native-sdk/cli-linux-x64-musl": "0.
|
|
41
|
-
"@native-sdk/cli-win32-arm64": "0.
|
|
42
|
-
"@native-sdk/cli-win32-x64": "0.
|
|
35
|
+
"@native-sdk/cli-darwin-arm64": "0.7.0",
|
|
36
|
+
"@native-sdk/cli-darwin-x64": "0.7.0",
|
|
37
|
+
"@native-sdk/cli-linux-arm64-gnu": "0.7.0",
|
|
38
|
+
"@native-sdk/cli-linux-arm64-musl": "0.7.0",
|
|
39
|
+
"@native-sdk/cli-linux-x64-gnu": "0.7.0",
|
|
40
|
+
"@native-sdk/cli-linux-x64-musl": "0.7.0",
|
|
41
|
+
"@native-sdk/cli-win32-arm64": "0.7.0",
|
|
42
|
+
"@native-sdk/cli-win32-x64": "0.7.0"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@native-sdk/core",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.7.0",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@typescript/old": "npm:typescript@6.0.3",
|
|
12
12
|
"@typescript/typescript6": "6.0.2"
|
|
@@ -182,6 +182,7 @@ Automation drives the native path honestly: snapshots list every widget's declar
|
|
|
182
182
|
| `icon` | vector icon leaf | `name` picks the icon: a bare literal is a curated built-in stroke icon (compile-checked; 49 names: search, plus, x, x-circle, check, check-circle, chevron-up/down/left/right, arrow-up/down/right, menu, panel-left, panel-right, settings, terminal, wrench, trash, edit, copy, external-link, play, pause, skip-back/forward, shuffle, repeat, music, volume, info, alert, download, save, folder, folder-open, file-text, sun, moon, eye, clock, git-pull-request, git-merge, git-branch, circle-dot, archive, refresh-cw, send); `app:<name>` reaches an icon the app registered at boot with `canvas.icons.registerAppIcons` (declare the table as `pub const app_icons` on the app root so `native check` verifies the name against the model contract), and one `{binding}` defers the choice to model data - an unknown resolved name draws the missing-icon fallback (a slashed circle) with a Debug warning naming the value, never a silent gap; tint with `foreground`, size with `width`/`height` |
|
|
183
183
|
| `media-surface` | media surface leaf | composites a texture produced OUTSIDE the widget tree (video decoder, camera, an external renderer like mpv) into the layout like any widget — clipped, z-ordered, rounded. `surface="{binding}"` (required) binds the model-owned u64 surface id a Zig-tier producer targets (`runtime.acquireMediaSurfaceProducer` pushes RGBA8 frames, latest-wins, paced by the presented-frame clock; 0 = unbound, draws nothing; usable ids are nonzero values below the reserved bit 63). No intrinsic size — give it `width`/`height` or `grow`; display-only (presses fall through); `label` it (pictorial content). Texture contents are presentation chrome: goldens, reference screenshots, and session replay show the deterministic id-derived placeholder, never producer frames |
|
|
184
184
|
| `image` | runtime image leaf | draws a RUNTIME-REGISTERED image by its model-owned u64 ImageId — the id `Cmd.imageLoad` (TS) or `fx.loadImage`/`fx.registerImageBytes` (Zig) registered pixels under. `image="{binding}"` (required) binds a model field/fn; ids are model data, never markup literals, and 0 draws nothing (store the id only when the load reports loaded — see the Images section). No intrinsic size — give it `width`/`height` or `grow`; display-only (presses fall through); `label` it (pictorial content) |
|
|
185
|
+
| `code` | highlighted source surface | `source="{binding}"` (required) provides source text and `language="tsx"` selects a literal lexer name; wraps by default, `line-numbers` opts into logical line numbers, and `wrap="false"` preserves lines inside one horizontal scroll region. HTML-family highlighting distinguishes HTML/XML/SVG and JSX/TSX tags, attributes, strings, comments, and embedded expressions. Zig builder: `ui.code(CodeOptions, source)` |
|
|
185
186
|
| `markdown` | rendered markdown subtree | leaf; `source` is one `{binding}` — see "Markdown in markup" |
|
|
186
187
|
| `stepper` > `step` | composite stage track | `active="{index}"` (required) derives each step's completed/active/pending state; steps are text leaves (no attributes) joined by connectors; stepper also takes `key`, `global-key`, `label` |
|
|
187
188
|
| `timeline` > `timeline-item` | composite ledger list | items only inside a timeline (for/if fine); items are leaves — `title` (required), `description`, `meta`, `indicator`, `variant`, `connector="false"` on the last item, `selected`; `on-press` makes the whole item pressable with a trailing chevron |
|
|
@@ -353,7 +354,7 @@ The `examples/feed` app is the reference: a 100,000-post deterministic MIXED-HEI
|
|
|
353
354
|
|
|
354
355
|
Color and radius come from the design tokens, referenced by token NAME — literals only, no bindings, no raw colors (dynamic styling stays in Zig via `ElementOptions.style`):
|
|
355
356
|
|
|
356
|
-
- Color attributes: `background`, `foreground`, `accent`, `accent-foreground`, `border-color`, `focus-ring`. Values are `canvas.ColorTokens` field names — the complete list: `background`, `surface`, `surface_subtle`, `surface_pressed`, `text`, `text_muted`, `border`, `accent`, `accent_text`, `destructive`, `destructive_text`, `success`, `success_text`, `warning`, `warning_text`, `info`, `info_text`, `focus_ring`, `shadow`, `disabled`. `info` is the violet identity hue beside the status trio (merged PR badges, "new" chips). (`border-color`, not bare `border` — that name is reserved for a future width shorthand.)
|
|
357
|
+
- Color attributes: `background`, `foreground`, `accent`, `accent-foreground`, `border-color`, `focus-ring`. Values are `canvas.ColorTokens` field names — the complete list: `background`, `surface`, `surface_subtle`, `surface_pressed`, `text`, `text_muted`, `syntax_plain`, `syntax_comment`, `syntax_keyword`, `syntax_literal`, `syntax_function`, `syntax_property`, `syntax_constant`, `border`, `accent`, `accent_text`, `destructive`, `destructive_text`, `success`, `success_text`, `warning`, `warning_text`, `info`, `info_text`, `focus_ring`, `shadow`, `scrim`, `disabled`. The `syntax_*` roles are the Geist Code Block palette used automatically by `ui.code` and Markdown fences in both built-in packs. `info` is the violet identity hue beside the status trio (merged PR badges, "new" chips). (`border-color`, not bare `border` — that name is reserved for a future width shorthand.)
|
|
357
358
|
- `radius` — `canvas.RadiusTokens` field names: `sm`, `md`, `lg`, `xl`.
|
|
358
359
|
|
|
359
360
|
```html
|
|
@@ -967,6 +968,20 @@ Rules and semantics:
|
|
|
967
968
|
|
|
968
969
|
Both engines implement templates, defaults, slots, and imports: the interpreter expands at build time (hot reload re-resolves imports from disk, so edits to imported files reload), and the compiled engine inlines at comptime with the identical result. A document with imports compiles through `canvas.CompiledMarkupImports(Model, Msg, "root.native", &sources)` where `sources` is a `canvas.ui_markup.SourceFile` set (`.{ .path = "components/cards.native", .source = @embedFile("components/cards.native") }`, paths relative to the root file's directory); pass the same set on `MarkupOptions.sources` for the runtime engine. See `examples/kanban/src/board.native` + `examples/kanban/src/components/board-column.native`.
|
|
969
970
|
|
|
971
|
+
## Code in markup: `<code>`
|
|
972
|
+
|
|
973
|
+
A source-bound highlighted surface shared with Markdown fences:
|
|
974
|
+
|
|
975
|
+
```html
|
|
976
|
+
<code source="{snippet}" language="tsx" line-numbers wrap="false" width="480" label="Component source" />
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
- `source` is one required `{binding}` producing `[]const u8`; the element has no children.
|
|
980
|
+
- `language` is a literal lexer name: Zig, JS/TS, JSX/TSX, JSON, shell, Python, Rust, C-family, Go, HTML/XML/SVG, CSS-family, or SQL. Omit it for plain monospace.
|
|
981
|
+
- Wrapping is on by default. `wrap="false"` keeps logical lines intact inside one horizontal scroll region. A definite `height` makes overflow scroll vertically; with wrapping off, that constrained region scrolls on both axes.
|
|
982
|
+
- `line-numbers` is off by default. Wrapped logical lines stay paired with their number. Numbered mode is limited to 128 logical lines and a reserved share of the per-view node and text-span budgets; sources that exceed any bound preserve all code and omit the gutter.
|
|
983
|
+
- Zig builder: `ui.code(.{ .language = .html, .line_numbers = true, .wrap = false }, model.snippet)`. The public lexer helpers are under `native_sdk.canvas.code`.
|
|
984
|
+
|
|
970
985
|
## Markdown in markup: `<markdown>`
|
|
971
986
|
|
|
972
987
|
A leaf element that renders a markdown string (the GFM subset below) as ordinary widgets, wiring `native_sdk.markdown` for you — both engines implement it identically:
|
|
@@ -1080,7 +1095,7 @@ Md.view(ui, model.body_markdown, .{
|
|
|
1080
1095
|
})
|
|
1081
1096
|
```
|
|
1082
1097
|
|
|
1083
|
-
- Supported: `#`–`###` headings, paragraphs with `**bold**`/`*italic*`/`` `code` ``/`~~strike~~`/`[links](url)`, bare `http(s)://` URLs (autolink, trailing punctuation trimmed), `#123` issue refs (opt-in: set `Options.issue_link_base` and the ref links to base ++ number), bullet + ordered + task lists (task checkboxes are display-only, disabled), fenced code blocks, `> blockquotes`, `---` rules, GFM pipe tables (header bold, `:---`/`:--:`/`---:` column alignment, inline spans + clickable links inside cells, `\|` escapes a pipe in a cell; columns share width equally, and a missing/mismatched delimiter row degrades the block to paragraphs), `<details><summary>`.
|
|
1098
|
+
- Supported: `#`–`###` headings, paragraphs with `**bold**`/`*italic*`/`` `code` ``/`~~strike~~`/`[links](url)`, bare `http(s)://` URLs (autolink, trailing punctuation trimmed), `#123` issue refs (opt-in: set `Options.issue_link_base` and the ref links to base ++ number), bullet + ordered + task lists (task checkboxes are display-only, disabled), fenced code blocks (source indentation preserved; they lower through `ui.code` with wrapping on and line numbers off; recognized Zig, JS/TS, JSX/TSX, JSON, shell, Python, Rust, C-family, Go, HTML/XML/SVG, CSS-family, and SQL info strings get theme-token syntax highlighting; unknown tags stay plain mono), `> blockquotes`, `---` rules, GFM pipe tables (header bold, `:---`/`:--:`/`---:` column alignment, inline spans + clickable links inside cells, `\|` escapes a pipe in a cell; columns share width equally, and a missing/mismatched delimiter row degrades the block to paragraphs), `<details><summary>`.
|
|
1084
1099
|
- Not in v1 (degrades to plain text, never fails): reference links, raw HTML, footnotes, backslash escapes (except `\|` in table rows).
|
|
1085
1100
|
- `<details>` state is elm-style: the CALLER owns the expanded flags. Keep a bounded `details_expanded: [8]bool` in the model, toggle it in `update` on the details message, and pass the slice back in.
|
|
1086
1101
|
|