@wireweave/agent-prompts 0.2.0-beta.4 → 0.2.0-beta.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.
package/dist/index.cjs CHANGED
@@ -88,6 +88,21 @@ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on
88
88
  - 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.
89
89
  - page "Title" uses=NAME { \u2026 } \u2014 draw this page inside layout NAME. The page body holds only what is unique to that screen.
90
90
  - repeat N { \u2026 } \u2014 draw the body N times. N is a bare non-negative integer, NOT quoted and NOT an attribute. Use it instead of pasting the same child N times.
91
+ - page "Title" variants=[loading, empty, ready] { \u2026 } \u2014 draw this page once per named state, as that many separate screens. The names are bare identifiers in brackets. Use this for a screen's loading / empty / populated / error conditions INSTEAD of states= + visibleWhen + a toggle button: a variant needs no switching control, so the wireframe shows no UI the product does not have, and every condition is visible at once instead of one at a time. Each screen is addressed as "id#variant" (quoted, e.g. navigate="orders#empty"); plain navigate=orders reaches the first variant.
92
+
93
+ - when=loading / when=[loading, empty] on ANY element inside a variant page \u2014 draw that element only on the named boards. A list is OR: write a block shared by two states once, with both names, instead of copying it into each. Omitting when= draws the element on every board, so the common chrome of a screen is written once with no when= at all. Every name must appear in that page's variants= list. This is build-time and is NOT visibleWhen: when= decides whether the element exists in a board's markup, visibleWhen decides whether the runtime shows an element that is already there \u2014 one element may carry both.
94
+
95
+ \`\`\`
96
+ page "Orders" id=orders variants=[loading, empty, ready] {
97
+ main {
98
+ section "Header" { title "Orders" level=2 }
99
+ section when=loading { repeat 3 { card "" h=80 bg=muted } }
100
+ section when=empty { placeholder "No orders yet" }
101
+ section when=[empty, ready] { button "New order" primary }
102
+ section when=ready { table [["Order", "Status"], ["1001", "Shipped"]] }
103
+ }
104
+ }
105
+ \`\`\`
91
106
 
92
107
  \`\`\`
93
108
  layout app {
@@ -332,6 +347,7 @@ function buildCompactGrammarPrompt() {
332
347
  - Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
333
348
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
334
349
 
350
+ # VARIANTS: page "T" variants=[loading, empty, ready] { \u2026 } draws that page once per named state as that many separate screens (names are bare identifiers in brackets). Prefer it over states=+visibleWhen+a toggle for a screen's loading/empty/populated/error conditions \u2014 no switching control has to exist in the wireframe, and all conditions are visible at once. Address one as navigate="id#variant"; plain navigate=id reaches the first. Scope elements inside such a page with when=loading or when=[loading, empty] (OR) so a block shared by two states is authored once; no when= means every board. Names must be declared in that page's variants=. when= is build-time (the element is absent from other boards) and is orthogonal to visibleWhen (runtime toggle) \u2014 an element may carry both.
335
351
  # 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.
336
352
  repeat N { \u2026 } draws its body N times \u2014 write repeat 6 { use skeletonCard() } instead of pasting six copies. N is a bare integer. There is NO index variable (repeat 6 as i fails to parse) and every copy is identical, so write items out individually when they differ.
337
353
  # PARAMETERS: component NAME(label: string, to: string) { \u2026 } declares typed parameters (string/number/boolean); inside the body "$label" stands for the passed value. ALWAYS quote the reference \u2014 navigate="$to" and target="$to" work anywhere, including nested effect targets. NEVER write it bare (navigate=$to): an identifier cannot start with $, so the file fails to parse. A reference must be the whole value ("go to $to" is literal text), and every "$name" must match a declared parameter or validation fails.
package/dist/index.js CHANGED
@@ -61,6 +61,21 @@ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on
61
61
  - 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.
62
62
  - page "Title" uses=NAME { \u2026 } \u2014 draw this page inside layout NAME. The page body holds only what is unique to that screen.
63
63
  - repeat N { \u2026 } \u2014 draw the body N times. N is a bare non-negative integer, NOT quoted and NOT an attribute. Use it instead of pasting the same child N times.
64
+ - page "Title" variants=[loading, empty, ready] { \u2026 } \u2014 draw this page once per named state, as that many separate screens. The names are bare identifiers in brackets. Use this for a screen's loading / empty / populated / error conditions INSTEAD of states= + visibleWhen + a toggle button: a variant needs no switching control, so the wireframe shows no UI the product does not have, and every condition is visible at once instead of one at a time. Each screen is addressed as "id#variant" (quoted, e.g. navigate="orders#empty"); plain navigate=orders reaches the first variant.
65
+
66
+ - when=loading / when=[loading, empty] on ANY element inside a variant page \u2014 draw that element only on the named boards. A list is OR: write a block shared by two states once, with both names, instead of copying it into each. Omitting when= draws the element on every board, so the common chrome of a screen is written once with no when= at all. Every name must appear in that page's variants= list. This is build-time and is NOT visibleWhen: when= decides whether the element exists in a board's markup, visibleWhen decides whether the runtime shows an element that is already there \u2014 one element may carry both.
67
+
68
+ \`\`\`
69
+ page "Orders" id=orders variants=[loading, empty, ready] {
70
+ main {
71
+ section "Header" { title "Orders" level=2 }
72
+ section when=loading { repeat 3 { card "" h=80 bg=muted } }
73
+ section when=empty { placeholder "No orders yet" }
74
+ section when=[empty, ready] { button "New order" primary }
75
+ section when=ready { table [["Order", "Status"], ["1001", "Shipped"]] }
76
+ }
77
+ }
78
+ \`\`\`
64
79
 
65
80
  \`\`\`
66
81
  layout app {
@@ -305,6 +320,7 @@ function buildCompactGrammarPrompt() {
305
320
  - Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
306
321
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
307
322
 
323
+ # VARIANTS: page "T" variants=[loading, empty, ready] { \u2026 } draws that page once per named state as that many separate screens (names are bare identifiers in brackets). Prefer it over states=+visibleWhen+a toggle for a screen's loading/empty/populated/error conditions \u2014 no switching control has to exist in the wireframe, and all conditions are visible at once. Address one as navigate="id#variant"; plain navigate=id reaches the first. Scope elements inside such a page with when=loading or when=[loading, empty] (OR) so a block shared by two states is authored once; no when= means every board. Names must be declared in that page's variants=. when= is build-time (the element is absent from other boards) and is orthogonal to visibleWhen (runtime toggle) \u2014 an element may carry both.
308
324
  # 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.
309
325
  repeat N { \u2026 } draws its body N times \u2014 write repeat 6 { use skeletonCard() } instead of pasting six copies. N is a bare integer. There is NO index variable (repeat 6 as i fails to parse) and every copy is identical, so write items out individually when they differ.
310
326
  # PARAMETERS: component NAME(label: string, to: string) { \u2026 } declares typed parameters (string/number/boolean); inside the body "$label" stands for the passed value. ALWAYS quote the reference \u2014 navigate="$to" and target="$to" work anywhere, including nested effect targets. NEVER write it bare (navigate=$to): an identifier cannot start with $, so the file fails to parse. A reference must be the whole value ("go to $to" is literal text), and every "$name" must match a declared parameter or validation fails.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireweave/agent-prompts",
3
- "version": "0.2.0-beta.4",
3
+ "version": "0.2.0-beta.6",
4
4
  "description": "Canonical grammar prompts for LLM agents generating Wireweave DSL (multi-page aware)",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -52,7 +52,7 @@
52
52
  "typescript": "^5.7.2",
53
53
  "typescript-eslint": "^8.60.0",
54
54
  "vitest": "^3.1.1",
55
- "@wireweave/core": "3.1.0-beta.7"
55
+ "@wireweave/core": "3.1.0-beta.9"
56
56
  },
57
57
  "keywords": [
58
58
  "wireframe",