@wireweave/agent-prompts 0.2.0-beta.0 → 0.2.0-beta.2

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/dist/index.cjs CHANGED
@@ -78,8 +78,35 @@ Renderer modes (the host picks one; you only need to emit valid pages):
78
78
  - renderCanvas(doc) \u2014 composes all pages into one bounded canvas.
79
79
  - renderPage(page) \u2014 single-page export primitive (1 page = 1 file).
80
80
 
81
+ # REUSE \u2014 DEFINE THE SHELL ONCE
82
+ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on every page is the single biggest source of bloat, so declare it once and reference it.
83
+
84
+ - layout NAME { \u2026 slot \u2026 } \u2014 a named page shell. The name is a bare identifier, NOT a quoted string.
85
+ - slot \u2014 a bare positional marker inside a layout, marking where a referencing page's own content goes. It takes no name and no braces.
86
+ - component NAME { \u2026 } \u2014 a named fragment defined once and referenced by name instead of restated.
87
+ - use NAME(arg="value") { \u2026 } \u2014 draw a component defined above. Arguments are parenthesized name=value pairs; the optional braces fill the component's slots.
88
+ - page "Title" uses=NAME { \u2026 } \u2014 draw this page inside layout NAME. The page body holds only what is unique to that screen.
89
+
90
+ \`\`\`
91
+ layout app {
92
+ header { title "Acme" }
93
+ slot
94
+ footer { text "\xA9 2026 Acme" }
95
+ }
96
+
97
+ page "Home" uses=app { text "Welcome back" }
98
+ page "Docs" uses=app { text "Getting started" }
99
+ page "About" uses=app { text "Who we are" }
100
+ \`\`\`
101
+
102
+ Rules:
103
+ - layout and component are TOP-LEVEL only \u2014 siblings of page, never nested inside one.
104
+ - Define a layout as soon as two or more pages share a shell. Three pages that each repeat a header is a defect, not a style.
105
+ - A page with uses= must NOT restate the shell; put only its own content in the body.
106
+ - A layout has exactly the structure a page would have, with slot standing in for the varying part.
107
+
81
108
  # LAYOUT COMPONENTS
82
- page: Root container. Attrs: title (string arg), at(x, y), viewport, width, height (pixels), device (mobile/tablet/desktop preset), centered (boolean).
109
+ page: Root container. Attrs: title (string arg), uses (layout name), at(x, y), viewport, width, height (pixels), device (mobile/tablet/desktop preset), centered (boolean).
83
110
  header: Top section. Attrs: h (height), p (padding), border (boolean, default true).
84
111
  main: Primary content. Attrs: p, scroll (boolean).
85
112
  footer: Bottom section. Attrs: h, p, border.
@@ -266,14 +293,17 @@ function buildCompactGrammarPrompt() {
266
293
  - Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
267
294
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
268
295
 
269
- # LAYOUT: page(at, viewport, width, height, device, centered), header(h, border), main(p, scroll), footer(h, border), sidebar(w, border, position), section, row(gap, justify, align, wrap), col(gap, flex, span), stack, relative
296
+ # REUSE: layout NAME { \u2026 } defines a shared shell (name is a bare identifier, not a quoted string); slot marks where a referencing page's own content goes inside that shell (bare keyword, no name, no braces); component NAME { \u2026 } defines a reusable fragment; use NAME(arg="value") { \u2026 } draws that fragment, passing parenthesized arguments and optionally filling its slots; page "Title" uses=NAME draws that page inside the layout and states only its own content. layout/component are top-level siblings of page. Two or more pages sharing a shell \u2192 define a layout instead of repeating it.
297
+ # LAYOUT: page(at, viewport, width, height, device, centered, uses), header(h, border), main(p, scroll), footer(h, border), sidebar(w, border, position), section, row(gap, justify, align, wrap), col(gap, flex, span), stack, relative
270
298
  # CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
271
299
  # TEXT: text(size, weight, muted), title(level), link(href)
272
300
  # VISUAL: icon(Lucide name), avatar(size), badge(variant), image, placeholder(h, w)
273
301
  # FORM: button(primary/danger/outline/ghost, icon, size), input(inputType, placeholder), select, checkbox, radio, switch, slider, textarea
274
- # NAV: nav(vertical, active) with array ["Item1","Item2"], tabs(active), breadcrumb, dropdown
302
+ # NAV: nav(vertical, active) with array ["Item1","Item2"], item(icon, active, disabled, href) inside a nav/dropdown block, tabs(active) with tab children, breadcrumb, dropdown
275
303
  # DATA: table with 2D array, list with array
276
304
  # FEEDBACK: alert(variant), toast, progress(value), spinner
305
+ # OVERLAY: tooltip(position), popover(title)
306
+ # ANNOTATION: marker(number arg, anchor, color), annotations(title) { item N "Title" { text "\u2026" } }
277
307
  # UTILITY: divider
278
308
 
279
309
  # INTERACTIONS
package/dist/index.js CHANGED
@@ -51,8 +51,35 @@ Renderer modes (the host picks one; you only need to emit valid pages):
51
51
  - renderCanvas(doc) \u2014 composes all pages into one bounded canvas.
52
52
  - renderPage(page) \u2014 single-page export primitive (1 page = 1 file).
53
53
 
54
+ # REUSE \u2014 DEFINE THE SHELL ONCE
55
+ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on every page is the single biggest source of bloat, so declare it once and reference it.
56
+
57
+ - layout NAME { \u2026 slot \u2026 } \u2014 a named page shell. The name is a bare identifier, NOT a quoted string.
58
+ - slot \u2014 a bare positional marker inside a layout, marking where a referencing page's own content goes. It takes no name and no braces.
59
+ - component NAME { \u2026 } \u2014 a named fragment defined once and referenced by name instead of restated.
60
+ - use NAME(arg="value") { \u2026 } \u2014 draw a component defined above. Arguments are parenthesized name=value pairs; the optional braces fill the component's slots.
61
+ - page "Title" uses=NAME { \u2026 } \u2014 draw this page inside layout NAME. The page body holds only what is unique to that screen.
62
+
63
+ \`\`\`
64
+ layout app {
65
+ header { title "Acme" }
66
+ slot
67
+ footer { text "\xA9 2026 Acme" }
68
+ }
69
+
70
+ page "Home" uses=app { text "Welcome back" }
71
+ page "Docs" uses=app { text "Getting started" }
72
+ page "About" uses=app { text "Who we are" }
73
+ \`\`\`
74
+
75
+ Rules:
76
+ - layout and component are TOP-LEVEL only \u2014 siblings of page, never nested inside one.
77
+ - Define a layout as soon as two or more pages share a shell. Three pages that each repeat a header is a defect, not a style.
78
+ - A page with uses= must NOT restate the shell; put only its own content in the body.
79
+ - A layout has exactly the structure a page would have, with slot standing in for the varying part.
80
+
54
81
  # LAYOUT COMPONENTS
55
- page: Root container. Attrs: title (string arg), at(x, y), viewport, width, height (pixels), device (mobile/tablet/desktop preset), centered (boolean).
82
+ page: Root container. Attrs: title (string arg), uses (layout name), at(x, y), viewport, width, height (pixels), device (mobile/tablet/desktop preset), centered (boolean).
56
83
  header: Top section. Attrs: h (height), p (padding), border (boolean, default true).
57
84
  main: Primary content. Attrs: p, scroll (boolean).
58
85
  footer: Bottom section. Attrs: h, p, border.
@@ -239,14 +266,17 @@ function buildCompactGrammarPrompt() {
239
266
  - Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
240
267
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
241
268
 
242
- # LAYOUT: page(at, viewport, width, height, device, centered), header(h, border), main(p, scroll), footer(h, border), sidebar(w, border, position), section, row(gap, justify, align, wrap), col(gap, flex, span), stack, relative
269
+ # REUSE: layout NAME { \u2026 } defines a shared shell (name is a bare identifier, not a quoted string); slot marks where a referencing page's own content goes inside that shell (bare keyword, no name, no braces); component NAME { \u2026 } defines a reusable fragment; use NAME(arg="value") { \u2026 } draws that fragment, passing parenthesized arguments and optionally filling its slots; page "Title" uses=NAME draws that page inside the layout and states only its own content. layout/component are top-level siblings of page. Two or more pages sharing a shell \u2192 define a layout instead of repeating it.
270
+ # LAYOUT: page(at, viewport, width, height, device, centered, uses), header(h, border), main(p, scroll), footer(h, border), sidebar(w, border, position), section, row(gap, justify, align, wrap), col(gap, flex, span), stack, relative
243
271
  # CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
244
272
  # TEXT: text(size, weight, muted), title(level), link(href)
245
273
  # VISUAL: icon(Lucide name), avatar(size), badge(variant), image, placeholder(h, w)
246
274
  # FORM: button(primary/danger/outline/ghost, icon, size), input(inputType, placeholder), select, checkbox, radio, switch, slider, textarea
247
- # NAV: nav(vertical, active) with array ["Item1","Item2"], tabs(active), breadcrumb, dropdown
275
+ # NAV: nav(vertical, active) with array ["Item1","Item2"], item(icon, active, disabled, href) inside a nav/dropdown block, tabs(active) with tab children, breadcrumb, dropdown
248
276
  # DATA: table with 2D array, list with array
249
277
  # FEEDBACK: alert(variant), toast, progress(value), spinner
278
+ # OVERLAY: tooltip(position), popover(title)
279
+ # ANNOTATION: marker(number arg, anchor, color), annotations(title) { item N "Title" { text "\u2026" } }
250
280
  # UTILITY: divider
251
281
 
252
282
  # INTERACTIONS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireweave/agent-prompts",
3
- "version": "0.2.0-beta.0",
3
+ "version": "0.2.0-beta.2",
4
4
  "description": "Canonical grammar prompts for LLM agents generating Wireweave DSL (multi-page aware)",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -22,6 +22,9 @@
22
22
  "files": [
23
23
  "dist"
24
24
  ],
25
+ "engines": {
26
+ "node": ">=22.13.0"
27
+ },
25
28
  "lint-staged": {
26
29
  "*.{ts,js,mjs,cjs}": [
27
30
  "eslint --fix",
@@ -48,7 +51,8 @@
48
51
  "tsup": "^8.3.5",
49
52
  "typescript": "^5.7.2",
50
53
  "typescript-eslint": "^8.60.0",
51
- "vitest": "^3.1.1"
54
+ "vitest": "^3.1.1",
55
+ "@wireweave/core": "3.1.0-beta.5"
52
56
  },
53
57
  "keywords": [
54
58
  "wireframe",
@@ -71,6 +75,7 @@
71
75
  "homepage": "https://docs.wireweave.org",
72
76
  "scripts": {
73
77
  "build": "tsup",
78
+ "postbuild": "node ../../scripts/dist-freshness-gate.mjs --write .",
74
79
  "test": "vitest run",
75
80
  "test:watch": "vitest",
76
81
  "typecheck": "tsc --noEmit",
@@ -79,7 +84,7 @@
79
84
  "format": "prettier --write .",
80
85
  "format:check": "prettier --check .",
81
86
  "knip": "knip",
82
- "publint": "publint",
87
+ "publint": "publint --strict",
83
88
  "packlint": "packlint check",
84
89
  "clean": "rm -rf dist",
85
90
  "release": "release-it",