@wireweave/agent-prompts 0.2.0-beta.1 → 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 +18 -12
- package/dist/index.js +18 -12
- package/package.json +8 -3
package/dist/index.cjs
CHANGED
|
@@ -78,17 +78,14 @@ 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
|
-
#
|
|
82
|
-
|
|
83
|
-
the varying page content at its slot. Layout definitions and pages are siblings;
|
|
84
|
-
a layout is not a screen by itself.
|
|
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.
|
|
85
83
|
|
|
86
|
-
- layout NAME {
|
|
87
|
-
- slot \u2014 a bare positional marker inside a layout. It takes no name and no braces.
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Example:
|
|
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.
|
|
92
89
|
|
|
93
90
|
\`\`\`
|
|
94
91
|
layout app {
|
|
@@ -99,8 +96,15 @@ layout app {
|
|
|
99
96
|
|
|
100
97
|
page "Home" uses=app { text "Welcome back" }
|
|
101
98
|
page "Docs" uses=app { text "Getting started" }
|
|
99
|
+
page "About" uses=app { text "Who we are" }
|
|
102
100
|
\`\`\`
|
|
103
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
|
+
|
|
104
108
|
# LAYOUT COMPONENTS
|
|
105
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).
|
|
106
110
|
header: Top section. Attrs: h (height), p (padding), border (boolean, default true).
|
|
@@ -289,15 +293,17 @@ function buildCompactGrammarPrompt() {
|
|
|
289
293
|
- Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
|
|
290
294
|
- Multi-view apps default to separate top-level pages (not sidebar collapse).
|
|
291
295
|
|
|
292
|
-
#
|
|
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.
|
|
293
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
|
|
294
298
|
# CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
|
|
295
299
|
# TEXT: text(size, weight, muted), title(level), link(href)
|
|
296
300
|
# VISUAL: icon(Lucide name), avatar(size), badge(variant), image, placeholder(h, w)
|
|
297
301
|
# FORM: button(primary/danger/outline/ghost, icon, size), input(inputType, placeholder), select, checkbox, radio, switch, slider, textarea
|
|
298
|
-
# 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
|
|
299
303
|
# DATA: table with 2D array, list with array
|
|
300
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" } }
|
|
301
307
|
# UTILITY: divider
|
|
302
308
|
|
|
303
309
|
# INTERACTIONS
|
package/dist/index.js
CHANGED
|
@@ -51,17 +51,14 @@ 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
|
-
#
|
|
55
|
-
|
|
56
|
-
the varying page content at its slot. Layout definitions and pages are siblings;
|
|
57
|
-
a layout is not a screen by itself.
|
|
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.
|
|
58
56
|
|
|
59
|
-
- layout NAME {
|
|
60
|
-
- slot \u2014 a bare positional marker inside a layout. It takes no name and no braces.
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Example:
|
|
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.
|
|
65
62
|
|
|
66
63
|
\`\`\`
|
|
67
64
|
layout app {
|
|
@@ -72,8 +69,15 @@ layout app {
|
|
|
72
69
|
|
|
73
70
|
page "Home" uses=app { text "Welcome back" }
|
|
74
71
|
page "Docs" uses=app { text "Getting started" }
|
|
72
|
+
page "About" uses=app { text "Who we are" }
|
|
75
73
|
\`\`\`
|
|
76
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
|
+
|
|
77
81
|
# LAYOUT COMPONENTS
|
|
78
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).
|
|
79
83
|
header: Top section. Attrs: h (height), p (padding), border (boolean, default true).
|
|
@@ -262,15 +266,17 @@ function buildCompactGrammarPrompt() {
|
|
|
262
266
|
- Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
|
|
263
267
|
- Multi-view apps default to separate top-level pages (not sidebar collapse).
|
|
264
268
|
|
|
265
|
-
#
|
|
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.
|
|
266
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
|
|
267
271
|
# CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
|
|
268
272
|
# TEXT: text(size, weight, muted), title(level), link(href)
|
|
269
273
|
# VISUAL: icon(Lucide name), avatar(size), badge(variant), image, placeholder(h, w)
|
|
270
274
|
# FORM: button(primary/danger/outline/ghost, icon, size), input(inputType, placeholder), select, checkbox, radio, switch, slider, textarea
|
|
271
|
-
# 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
|
|
272
276
|
# DATA: table with 2D array, list with array
|
|
273
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" } }
|
|
274
280
|
# UTILITY: divider
|
|
275
281
|
|
|
276
282
|
# INTERACTIONS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wireweave/agent-prompts",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
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",
|