@wireweave/core 3.1.0-beta.9 → 4.0.0-beta.12

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.
Files changed (50) hide show
  1. package/README.md +17 -126
  2. package/dist/app.cjs +31 -0
  3. package/dist/app.d.cts +488 -0
  4. package/dist/app.d.ts +488 -0
  5. package/dist/app.js +31 -0
  6. package/dist/chunk-3RWGG5EC.js +18088 -0
  7. package/dist/chunk-4TMDPWPR.cjs +196 -0
  8. package/dist/chunk-5DGRIQDU.cjs +842 -0
  9. package/dist/chunk-7VTK6LHL.cjs +4374 -0
  10. package/dist/chunk-ETV4XYOV.cjs +7 -0
  11. package/dist/chunk-IMUVIIJR.cjs +18088 -0
  12. package/dist/chunk-JJWAFHSV.js +842 -0
  13. package/dist/chunk-MD6MNOEQ.cjs +2905 -0
  14. package/dist/chunk-PKBMQBKP.js +7 -0
  15. package/dist/chunk-QOS4IC75.js +4374 -0
  16. package/dist/chunk-R5WBZWBC.js +196 -0
  17. package/dist/chunk-V3HVWC7C.js +2905 -0
  18. package/dist/chunk-WV724EAW.js +0 -0
  19. package/dist/chunk-XENFKHRC.cjs +1 -0
  20. package/dist/chunk-XYACLXXF.js +51612 -0
  21. package/dist/chunk-ZPHNXJRY.cjs +51612 -0
  22. package/dist/index-Br7pNaf3.d.cts +240 -0
  23. package/dist/index-CghCKUPx.d.ts +337 -0
  24. package/dist/index-Da_B3eoM.d.ts +240 -0
  25. package/dist/index-G906GEtg.d.cts +337 -0
  26. package/dist/index.cjs +963 -64577
  27. package/dist/index.d.cts +13 -522
  28. package/dist/index.d.ts +13 -522
  29. package/dist/index.js +711 -64118
  30. package/dist/interaction.cjs +17 -0
  31. package/dist/interaction.d.cts +3 -0
  32. package/dist/interaction.d.ts +3 -0
  33. package/dist/interaction.js +17 -0
  34. package/dist/parser.cjs +18 -7832
  35. package/dist/parser.d.cts +10 -1
  36. package/dist/parser.d.ts +10 -1
  37. package/dist/parser.js +16 -7800
  38. package/dist/renderer.cjs +7 -53162
  39. package/dist/renderer.d.cts +19 -239
  40. package/dist/renderer.d.ts +19 -239
  41. package/dist/renderer.js +37 -53137
  42. package/dist/spec.cjs +42 -2883
  43. package/dist/spec.d.cts +4 -75
  44. package/dist/spec.d.ts +4 -75
  45. package/dist/spec.js +25 -2818
  46. package/dist/types-Dkgr0Wyc.d.cts +75 -0
  47. package/dist/types-Dkgr0Wyc.d.ts +75 -0
  48. package/dist/v4-types-Baz9yqAS.d.cts +137 -0
  49. package/dist/v4-types-Baz9yqAS.d.ts +137 -0
  50. package/package.json +22 -1
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Types for Wireweave DSL Specification
3
+ */
4
+ /**
5
+ * Attribute value type
6
+ */
7
+ type AttributeValueType = 'boolean' | 'number' | 'string' | 'string[]' | 'object' | 'object[]' | 'enum';
8
+ /**
9
+ * Attribute definition
10
+ */
11
+ interface AttributeSpec {
12
+ /** Attribute name */
13
+ name: string;
14
+ /** Value type */
15
+ type: AttributeValueType;
16
+ /**
17
+ * Value keywords this attribute accepts, machine-readable.
18
+ *
19
+ * For `type: 'enum'` these are the whole domain. For the attributes whose
20
+ * value is *either* a keyword or something open-ended — `w="full"` or
21
+ * `w=240`, bare `wrap` or `wrap=nowrap` — they are the keyword half, and
22
+ * {@link AttributeSpec.type} names the other half. Listing them here rather
23
+ * than inside the description sentence is what lets an editor complete them.
24
+ */
25
+ values?: readonly string[];
26
+ /** Description for documentation */
27
+ description?: string;
28
+ }
29
+ /**
30
+ * A narrowing of one registry attribute, scoped to one element.
31
+ *
32
+ * {@link AttributeSpec} is a flat namespace keyed by attribute name alone, so it
33
+ * can only state what an attribute means everywhere at once. Some facts are not
34
+ * of that shape: `name` on `icon` is a glyph out of a closed 1.6k-name set,
35
+ * while `name` on `radio` is whatever string groups the radios. An override
36
+ * carries the narrower fact for the one element it holds on, and the wider one
37
+ * stays in the registry for everybody else.
38
+ *
39
+ * Narrowing only, in both directions:
40
+ * - `name` is absent from this type, so an override cannot rename an attribute
41
+ * and therefore cannot bring a name into existence that the registry has not
42
+ * already declared.
43
+ * - `values` may only shrink an existing domain, and `type` may only move to
44
+ * `enum` from an open one. `spec-override-containment.test.ts` in
45
+ * `packages/language-data` holds both, because an override that widened would
46
+ * be a second registry hiding behind a lookup function.
47
+ */
48
+ type AttributeOverride = Omit<Partial<AttributeSpec>, 'name'>;
49
+ /**
50
+ * Component category
51
+ *
52
+ * `structure` is the odd one out: its elements (`layout`, `component`, `slot`)
53
+ * declare reusable structure rather than draw anything, so editors and docs
54
+ * must not offer them as ordinary content the way they offer a `card`.
55
+ */
56
+ type ComponentCategory = 'structure' | 'layout' | 'grid' | 'container' | 'text' | 'input' | 'display' | 'data' | 'feedback' | 'overlay' | 'navigation' | 'annotation';
57
+ /**
58
+ * Component definition
59
+ */
60
+ interface ComponentSpec {
61
+ /** Component name (lowercase, as used in DSL) */
62
+ name: string;
63
+ /** AST node type (PascalCase) */
64
+ nodeType: string;
65
+ /** Component category */
66
+ category: ComponentCategory;
67
+ /** Valid attributes for this component (names only, definitions in ATTRIBUTES) */
68
+ attributes: readonly string[];
69
+ /** Whether this component can have children */
70
+ hasChildren: boolean;
71
+ /** Description for documentation */
72
+ description: string;
73
+ }
74
+
75
+ export type { AttributeOverride as A, ComponentCategory as C, AttributeSpec as a, AttributeValueType as b, ComponentSpec as c };
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Types for Wireweave DSL Specification
3
+ */
4
+ /**
5
+ * Attribute value type
6
+ */
7
+ type AttributeValueType = 'boolean' | 'number' | 'string' | 'string[]' | 'object' | 'object[]' | 'enum';
8
+ /**
9
+ * Attribute definition
10
+ */
11
+ interface AttributeSpec {
12
+ /** Attribute name */
13
+ name: string;
14
+ /** Value type */
15
+ type: AttributeValueType;
16
+ /**
17
+ * Value keywords this attribute accepts, machine-readable.
18
+ *
19
+ * For `type: 'enum'` these are the whole domain. For the attributes whose
20
+ * value is *either* a keyword or something open-ended — `w="full"` or
21
+ * `w=240`, bare `wrap` or `wrap=nowrap` — they are the keyword half, and
22
+ * {@link AttributeSpec.type} names the other half. Listing them here rather
23
+ * than inside the description sentence is what lets an editor complete them.
24
+ */
25
+ values?: readonly string[];
26
+ /** Description for documentation */
27
+ description?: string;
28
+ }
29
+ /**
30
+ * A narrowing of one registry attribute, scoped to one element.
31
+ *
32
+ * {@link AttributeSpec} is a flat namespace keyed by attribute name alone, so it
33
+ * can only state what an attribute means everywhere at once. Some facts are not
34
+ * of that shape: `name` on `icon` is a glyph out of a closed 1.6k-name set,
35
+ * while `name` on `radio` is whatever string groups the radios. An override
36
+ * carries the narrower fact for the one element it holds on, and the wider one
37
+ * stays in the registry for everybody else.
38
+ *
39
+ * Narrowing only, in both directions:
40
+ * - `name` is absent from this type, so an override cannot rename an attribute
41
+ * and therefore cannot bring a name into existence that the registry has not
42
+ * already declared.
43
+ * - `values` may only shrink an existing domain, and `type` may only move to
44
+ * `enum` from an open one. `spec-override-containment.test.ts` in
45
+ * `packages/language-data` holds both, because an override that widened would
46
+ * be a second registry hiding behind a lookup function.
47
+ */
48
+ type AttributeOverride = Omit<Partial<AttributeSpec>, 'name'>;
49
+ /**
50
+ * Component category
51
+ *
52
+ * `structure` is the odd one out: its elements (`layout`, `component`, `slot`)
53
+ * declare reusable structure rather than draw anything, so editors and docs
54
+ * must not offer them as ordinary content the way they offer a `card`.
55
+ */
56
+ type ComponentCategory = 'structure' | 'layout' | 'grid' | 'container' | 'text' | 'input' | 'display' | 'data' | 'feedback' | 'overlay' | 'navigation' | 'annotation';
57
+ /**
58
+ * Component definition
59
+ */
60
+ interface ComponentSpec {
61
+ /** Component name (lowercase, as used in DSL) */
62
+ name: string;
63
+ /** AST node type (PascalCase) */
64
+ nodeType: string;
65
+ /** Component category */
66
+ category: ComponentCategory;
67
+ /** Valid attributes for this component (names only, definitions in ATTRIBUTES) */
68
+ attributes: readonly string[];
69
+ /** Whether this component can have children */
70
+ hasChildren: boolean;
71
+ /** Description for documentation */
72
+ description: string;
73
+ }
74
+
75
+ export type { AttributeOverride as A, ComponentCategory as C, AttributeSpec as a, AttributeValueType as b, ComponentSpec as c };
@@ -0,0 +1,137 @@
1
+ /** Canonical parser values for the Wireweave 4.0.0 language contract. */
2
+ type JsonValue = null | boolean | number | string | JsonValue[] | JsonObject;
3
+ interface JsonObject {
4
+ [key: string]: JsonValue;
5
+ }
6
+ interface V4ParseOptions {
7
+ languageVersion: string;
8
+ sourceId?: string;
9
+ }
10
+ interface V4SourceSpan {
11
+ sourceId: string;
12
+ /** Original UTF-16 code-unit offsets; end is exclusive. */
13
+ start: number;
14
+ end: number;
15
+ startLine: number;
16
+ startColumn: number;
17
+ endLine: number;
18
+ endColumn: number;
19
+ /** False identifies a fragment inspection ID, not an authored durable ID. */
20
+ authoredId?: boolean;
21
+ }
22
+ interface V4Diagnostic {
23
+ severity: 'error';
24
+ code: string;
25
+ phase: 'parse' | 'schema';
26
+ sourceId: string;
27
+ start: number;
28
+ end: number;
29
+ path: string;
30
+ messageKey: string;
31
+ details: JsonObject;
32
+ related: {
33
+ sourceId: string;
34
+ start: number;
35
+ end: number;
36
+ }[];
37
+ }
38
+ declare class V4ParseError extends Error {
39
+ readonly diagnostics: readonly V4Diagnostic[];
40
+ name: string;
41
+ constructor(diagnostics: readonly V4Diagnostic[]);
42
+ }
43
+ type V4ParseResult = {
44
+ ok: true;
45
+ value: ParsedDocument;
46
+ diagnostics: [];
47
+ } | {
48
+ ok: false;
49
+ value: null;
50
+ diagnostics: readonly V4Diagnostic[];
51
+ };
52
+ interface CanonicalParameter {
53
+ id: string;
54
+ type: 'string' | 'number' | 'boolean' | 'record' | 'list';
55
+ default?: JsonValue;
56
+ }
57
+ type PrimitiveKind = 'page' | 'header' | 'main' | 'footer' | 'sidebar' | 'section' | 'row' | 'col' | 'stack' | 'relative' | 'card' | 'modal' | 'drawer' | 'accordion' | 'text' | 'title' | 'link' | 'input' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'slider' | 'button' | 'image' | 'placeholder' | 'avatar' | 'badge' | 'icon' | 'table' | 'list' | 'alert' | 'toast' | 'progress' | 'spinner' | 'tooltip' | 'popover' | 'dropdown' | 'nav' | 'tabs' | 'breadcrumb' | 'divider' | 'marker' | 'annotations' | 'form' | 'nav-item' | 'nav-group' | 'dropdown-item' | 'list-item' | 'tab' | 'option' | 'annotation-item';
58
+ interface CanonicalPrimitive {
59
+ kind: PrimitiveKind;
60
+ id?: string;
61
+ label?: string;
62
+ number?: number;
63
+ items?: JsonValue[];
64
+ attributes: JsonObject;
65
+ children: CanonicalNode[];
66
+ }
67
+ interface CanonicalDefinition {
68
+ kind: 'layout' | 'component';
69
+ id: string;
70
+ parameters: CanonicalParameter[];
71
+ attributes: JsonObject;
72
+ children: CanonicalNode[];
73
+ }
74
+ interface CanonicalUse {
75
+ kind: 'use';
76
+ id: string;
77
+ name: string;
78
+ namespace?: string;
79
+ inputs: Record<string, {
80
+ literal: JsonValue;
81
+ } | {
82
+ param: string;
83
+ }>;
84
+ fills: {
85
+ name: string;
86
+ children: CanonicalNode[];
87
+ }[];
88
+ }
89
+ type CanonicalNode = CanonicalPrimitive | CanonicalDefinition | CanonicalUse | {
90
+ kind: 'slot';
91
+ name?: string;
92
+ } | {
93
+ kind: 'repeat';
94
+ count: number;
95
+ id?: string;
96
+ children: CanonicalNode[];
97
+ };
98
+ interface CanonicalSymbol {
99
+ kind: 'page' | 'layout' | 'component';
100
+ id: string;
101
+ }
102
+ interface CanonicalModule {
103
+ id: string;
104
+ namespace: string;
105
+ sourceDigest: string;
106
+ imports: {
107
+ namespace: string;
108
+ moduleId: string;
109
+ digest: string;
110
+ symbols: CanonicalSymbol[];
111
+ }[];
112
+ exports: CanonicalSymbol[];
113
+ definitions: (CanonicalPrimitive | CanonicalDefinition)[];
114
+ }
115
+ interface ParsedDocument {
116
+ schemaVersion: '1.0.0';
117
+ languageVersion: '4.0.0';
118
+ modules: CanonicalModule[];
119
+ states: JsonObject[];
120
+ registry: {
121
+ schemaVersion: '1.0.0';
122
+ entries: JsonObject[];
123
+ digest: string;
124
+ };
125
+ fixtures: JsonObject[];
126
+ app: {
127
+ id: string;
128
+ entry?: {
129
+ namespace: string;
130
+ id: string;
131
+ variant?: string;
132
+ };
133
+ profile: JsonObject;
134
+ };
135
+ }
136
+
137
+ export { type CanonicalDefinition as C, type JsonObject as J, type ParsedDocument as P, type V4Diagnostic as V, type CanonicalModule as a, type CanonicalNode as b, type CanonicalParameter as c, type CanonicalPrimitive as d, type CanonicalSymbol as e, type CanonicalUse as f, type JsonValue as g, V4ParseError as h, type V4ParseOptions as i, type V4ParseResult as j, type V4SourceSpan as k };
@@ -0,0 +1,137 @@
1
+ /** Canonical parser values for the Wireweave 4.0.0 language contract. */
2
+ type JsonValue = null | boolean | number | string | JsonValue[] | JsonObject;
3
+ interface JsonObject {
4
+ [key: string]: JsonValue;
5
+ }
6
+ interface V4ParseOptions {
7
+ languageVersion: string;
8
+ sourceId?: string;
9
+ }
10
+ interface V4SourceSpan {
11
+ sourceId: string;
12
+ /** Original UTF-16 code-unit offsets; end is exclusive. */
13
+ start: number;
14
+ end: number;
15
+ startLine: number;
16
+ startColumn: number;
17
+ endLine: number;
18
+ endColumn: number;
19
+ /** False identifies a fragment inspection ID, not an authored durable ID. */
20
+ authoredId?: boolean;
21
+ }
22
+ interface V4Diagnostic {
23
+ severity: 'error';
24
+ code: string;
25
+ phase: 'parse' | 'schema';
26
+ sourceId: string;
27
+ start: number;
28
+ end: number;
29
+ path: string;
30
+ messageKey: string;
31
+ details: JsonObject;
32
+ related: {
33
+ sourceId: string;
34
+ start: number;
35
+ end: number;
36
+ }[];
37
+ }
38
+ declare class V4ParseError extends Error {
39
+ readonly diagnostics: readonly V4Diagnostic[];
40
+ name: string;
41
+ constructor(diagnostics: readonly V4Diagnostic[]);
42
+ }
43
+ type V4ParseResult = {
44
+ ok: true;
45
+ value: ParsedDocument;
46
+ diagnostics: [];
47
+ } | {
48
+ ok: false;
49
+ value: null;
50
+ diagnostics: readonly V4Diagnostic[];
51
+ };
52
+ interface CanonicalParameter {
53
+ id: string;
54
+ type: 'string' | 'number' | 'boolean' | 'record' | 'list';
55
+ default?: JsonValue;
56
+ }
57
+ type PrimitiveKind = 'page' | 'header' | 'main' | 'footer' | 'sidebar' | 'section' | 'row' | 'col' | 'stack' | 'relative' | 'card' | 'modal' | 'drawer' | 'accordion' | 'text' | 'title' | 'link' | 'input' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'slider' | 'button' | 'image' | 'placeholder' | 'avatar' | 'badge' | 'icon' | 'table' | 'list' | 'alert' | 'toast' | 'progress' | 'spinner' | 'tooltip' | 'popover' | 'dropdown' | 'nav' | 'tabs' | 'breadcrumb' | 'divider' | 'marker' | 'annotations' | 'form' | 'nav-item' | 'nav-group' | 'dropdown-item' | 'list-item' | 'tab' | 'option' | 'annotation-item';
58
+ interface CanonicalPrimitive {
59
+ kind: PrimitiveKind;
60
+ id?: string;
61
+ label?: string;
62
+ number?: number;
63
+ items?: JsonValue[];
64
+ attributes: JsonObject;
65
+ children: CanonicalNode[];
66
+ }
67
+ interface CanonicalDefinition {
68
+ kind: 'layout' | 'component';
69
+ id: string;
70
+ parameters: CanonicalParameter[];
71
+ attributes: JsonObject;
72
+ children: CanonicalNode[];
73
+ }
74
+ interface CanonicalUse {
75
+ kind: 'use';
76
+ id: string;
77
+ name: string;
78
+ namespace?: string;
79
+ inputs: Record<string, {
80
+ literal: JsonValue;
81
+ } | {
82
+ param: string;
83
+ }>;
84
+ fills: {
85
+ name: string;
86
+ children: CanonicalNode[];
87
+ }[];
88
+ }
89
+ type CanonicalNode = CanonicalPrimitive | CanonicalDefinition | CanonicalUse | {
90
+ kind: 'slot';
91
+ name?: string;
92
+ } | {
93
+ kind: 'repeat';
94
+ count: number;
95
+ id?: string;
96
+ children: CanonicalNode[];
97
+ };
98
+ interface CanonicalSymbol {
99
+ kind: 'page' | 'layout' | 'component';
100
+ id: string;
101
+ }
102
+ interface CanonicalModule {
103
+ id: string;
104
+ namespace: string;
105
+ sourceDigest: string;
106
+ imports: {
107
+ namespace: string;
108
+ moduleId: string;
109
+ digest: string;
110
+ symbols: CanonicalSymbol[];
111
+ }[];
112
+ exports: CanonicalSymbol[];
113
+ definitions: (CanonicalPrimitive | CanonicalDefinition)[];
114
+ }
115
+ interface ParsedDocument {
116
+ schemaVersion: '1.0.0';
117
+ languageVersion: '4.0.0';
118
+ modules: CanonicalModule[];
119
+ states: JsonObject[];
120
+ registry: {
121
+ schemaVersion: '1.0.0';
122
+ entries: JsonObject[];
123
+ digest: string;
124
+ };
125
+ fixtures: JsonObject[];
126
+ app: {
127
+ id: string;
128
+ entry?: {
129
+ namespace: string;
130
+ id: string;
131
+ variant?: string;
132
+ };
133
+ profile: JsonObject;
134
+ };
135
+ }
136
+
137
+ export { type CanonicalDefinition as C, type JsonObject as J, type ParsedDocument as P, type V4Diagnostic as V, type CanonicalModule as a, type CanonicalNode as b, type CanonicalParameter as c, type CanonicalPrimitive as d, type CanonicalSymbol as e, type CanonicalUse as f, type JsonValue as g, V4ParseError as h, type V4ParseOptions as i, type V4ParseResult as j, type V4SourceSpan as k };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireweave/core",
3
- "version": "3.1.0-beta.9",
3
+ "version": "4.0.0-beta.12",
4
4
  "description": "Core parser and renderer for wireweave",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -47,6 +47,26 @@
47
47
  "types": "./dist/spec.d.cts",
48
48
  "default": "./dist/spec.cjs"
49
49
  }
50
+ },
51
+ "./app": {
52
+ "import": {
53
+ "types": "./dist/app.d.ts",
54
+ "default": "./dist/app.js"
55
+ },
56
+ "require": {
57
+ "types": "./dist/app.d.cts",
58
+ "default": "./dist/app.cjs"
59
+ }
60
+ },
61
+ "./interaction": {
62
+ "import": {
63
+ "types": "./dist/interaction.d.ts",
64
+ "default": "./dist/interaction.js"
65
+ },
66
+ "require": {
67
+ "types": "./dist/interaction.d.cts",
68
+ "default": "./dist/interaction.cjs"
69
+ }
50
70
  }
51
71
  },
52
72
  "files": [
@@ -98,6 +118,7 @@
98
118
  },
99
119
  "scripts": {
100
120
  "build:grammar": "peggy --format es -o src/parser/generated-parser.js src/grammar/wireframe.peggy",
121
+ "postbuild:grammar": "node scripts/format-generated.mjs src/parser/generated-parser.js",
101
122
  "build:spec": "node scripts/extract-grammar-elements.mjs",
102
123
  "build:icons": "node scripts/generate-icons.mjs",
103
124
  "build:icon-names": "node scripts/extract-icon-names.mjs",