@wire-dsl/engine 0.0.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/LICENSE ADDED
@@ -0,0 +1,36 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WireDSL Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ## Third-Party Components & Assets
26
+
27
+ ### Feather Icons
28
+
29
+ This project includes icons from Feather Icons (https://feathericons.com), created by Cole Bemis and contributors.
30
+
31
+ - **License**: MIT License
32
+ - **Repository**: https://github.com/feathericons/feather
33
+ - **Location in project**: `packages/core/src/renderer/icons/`
34
+ - **Full details**: See `packages/core/src/renderer/icons/ICONS-LICENSE.md`
35
+
36
+ Feather Icons are used under the terms of the MIT License, which is fully compatible with this project's MIT License.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # @wire-dsl/engine
2
+
3
+ Pure JavaScript/TypeScript engine for Wire-DSL. Provides the parser, IR generator, layout engine, and SVG renderer for transforming `.wire` files into interactive wireframes. **Browser-safe - no Node.js dependencies.**
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @wire-dsl/engine
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { parseWire, generateIR, computeLayout, renderSVG } from '@wire-dsl/engine';
15
+
16
+ // Parse .wire DSL file
17
+ const ast = parseWire(`
18
+ screen "Home" {
19
+ heading "Welcome"
20
+ button "Click me"
21
+ }
22
+ `);
23
+
24
+ // Generate Intermediate Representation
25
+ const ir = generateIR(ast);
26
+
27
+ // Compute layout
28
+ const layout = computeLayout(ir);
29
+
30
+ console.log(layout);
31
+ ```
32
+
33
+ ## Core Modules
34
+
35
+ ### Parser
36
+ Transforms `.wire` DSL syntax into an Abstract Syntax Tree (AST) using Chevrotain.
37
+
38
+ ```typescript
39
+ import { parseWire } from '@wire-dsl/engine';
40
+ const ast = parseWire(wireCode);
41
+ ```
42
+
43
+ ### IR (Intermediate Representation)
44
+ Converts AST into a structured IR contract that describes components, properties, and relationships.
45
+
46
+ ```typescript
47
+ import { generateIR } from '@wire-dsl/engine';
48
+ const ir = generateIR(ast);
49
+ ```
50
+
51
+ ### Layout Engine
52
+ Computes positions and dimensions for all components based on container types and constraints.
53
+
54
+ ```typescript
55
+ import { computeLayout } from '@wire-dsl/engine';
56
+ const layout = computeLayout(ir);
57
+ ```
58
+
59
+ ### Validators
60
+ Schema-based validation using Zod to ensure IR correctness.
61
+
62
+ ```typescript
63
+ import { validateIR } from '@wire-dsl/engine';
64
+ validateIR(ir); // Throws if invalid
65
+ ```
66
+
67
+ ### Components
68
+ 23 built-in UI components including:
69
+
70
+ **Basic:**
71
+ - Text, Heading, Button, Link
72
+
73
+ **Forms:**
74
+ - Input, TextArea, Select, Checkbox, Radio
75
+
76
+ **Containers:**
77
+ - Stack, Grid, Split, Panel, Card
78
+
79
+ **Interactive:**
80
+ - Modal, Dialog, Tabs, Accordion
81
+
82
+ **Advanced:**
83
+ - Form, Embed, Icon, Badge, Tooltip
84
+
85
+ ## Features
86
+
87
+ - 🎯 **Type-safe** - Full TypeScript support
88
+ - ✅ **Validated** - Zod-based schema validation
89
+ - 📐 **Layout Engine** - Automatic responsive positioning
90
+ - 🔧 **Extensible** - Add custom components
91
+ - ⚡ **Performance** - Optimized parsing and computation
92
+ - 📦 **ESM + CJS** - Works in Node.js and browsers
93
+
94
+ ## Documentation
95
+
96
+ - [IR Contract Specification](https://github.com/Wire-DSL/wire-dsl/blob/main/specs/IR-CONTRACT-EN.md)
97
+ - [Layout Engine Algorithm](https://github.com/Wire-DSL/wire-dsl/blob/main/specs/LAYOUT-ENGINE-EN.md)
98
+ - [Validation Rules](https://github.com/Wire-DSL/wire-dsl/blob/main/specs/VALIDATION-RULES-EN.md)
99
+
100
+ ## License
101
+
102
+ MIT