@wire-dsl/engine 0.2.4 → 0.3.0
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 +1235 -372
- package/dist/index.d.cts +34 -6
- package/dist/index.d.ts +34 -6
- package/dist/index.js +1238 -372
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -34,7 +34,7 @@ interface PropertySourceMap {
|
|
|
34
34
|
/**
|
|
35
35
|
* Types of nodes in Wire DSL
|
|
36
36
|
*/
|
|
37
|
-
type SourceMapNodeType = 'project' | 'screen' | 'layout' | 'component' | 'component-definition' | 'cell' | 'style' | 'mocks' | 'colors';
|
|
37
|
+
type SourceMapNodeType = 'project' | 'screen' | 'layout' | 'component' | 'component-definition' | 'layout-definition' | 'cell' | 'style' | 'mocks' | 'colors';
|
|
38
38
|
/**
|
|
39
39
|
* Main SourceMap entry - represents one node in the AST
|
|
40
40
|
*/
|
|
@@ -121,6 +121,7 @@ interface AST {
|
|
|
121
121
|
mocks: Record<string, string>;
|
|
122
122
|
colors: Record<string, string>;
|
|
123
123
|
definedComponents: ASTDefinedComponent[];
|
|
124
|
+
definedLayouts: ASTDefinedLayout[];
|
|
124
125
|
screens: ASTScreen[];
|
|
125
126
|
_meta?: {
|
|
126
127
|
nodeId: string;
|
|
@@ -172,6 +173,14 @@ interface ParseWireDSLWithSourceMapOptions {
|
|
|
172
173
|
throwOnError?: boolean;
|
|
173
174
|
includeSemanticWarnings?: boolean;
|
|
174
175
|
}
|
|
176
|
+
interface ASTDefinedLayout {
|
|
177
|
+
type: 'definedLayout';
|
|
178
|
+
name: string;
|
|
179
|
+
body: ASTLayout;
|
|
180
|
+
_meta?: {
|
|
181
|
+
nodeId: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
175
184
|
declare function parseWireDSL(input: string): AST;
|
|
176
185
|
/**
|
|
177
186
|
* Parse Wire DSL with SourceMap generation
|
|
@@ -293,9 +302,11 @@ declare class IRGenerator {
|
|
|
293
302
|
private idGen;
|
|
294
303
|
private nodes;
|
|
295
304
|
private definedComponents;
|
|
305
|
+
private definedLayouts;
|
|
296
306
|
private definedComponentIndices;
|
|
297
307
|
private undefinedComponentsUsed;
|
|
298
308
|
private warnings;
|
|
309
|
+
private errors;
|
|
299
310
|
private style;
|
|
300
311
|
generate(ast: AST): IRContract;
|
|
301
312
|
private applyStyle;
|
|
@@ -320,6 +331,15 @@ declare class IRGenerator {
|
|
|
320
331
|
private convertCell;
|
|
321
332
|
private convertComponent;
|
|
322
333
|
private expandDefinedComponent;
|
|
334
|
+
private expandDefinedLayout;
|
|
335
|
+
private resolveChildrenSlot;
|
|
336
|
+
private convertASTNode;
|
|
337
|
+
private resolveLayoutParams;
|
|
338
|
+
private normalizeSplitParams;
|
|
339
|
+
private resolveComponentProps;
|
|
340
|
+
private resolveBindingValue;
|
|
341
|
+
private isBindingTargetRequired;
|
|
342
|
+
private reportUnusedArguments;
|
|
323
343
|
private cleanParams;
|
|
324
344
|
private sanitizeId;
|
|
325
345
|
}
|
|
@@ -578,7 +598,7 @@ declare const THEMES: {
|
|
|
578
598
|
};
|
|
579
599
|
};
|
|
580
600
|
declare class SVGRenderer {
|
|
581
|
-
|
|
601
|
+
protected ir: IRContract;
|
|
582
602
|
private layout;
|
|
583
603
|
protected options: Required<Omit<SVGRenderOptions, 'screenName'>> & {
|
|
584
604
|
screenName?: string;
|
|
@@ -621,6 +641,7 @@ declare class SVGRenderer {
|
|
|
621
641
|
protected renderTopbar(node: IRComponentNode, pos: any): string;
|
|
622
642
|
protected renderPanelBorder(node: IRNode, pos: any, output: string[]): void;
|
|
623
643
|
protected renderCardBorder(node: IRNode, pos: any, output: string[]): void;
|
|
644
|
+
protected renderSplitDecoration(node: IRNode, pos: any, output: string[]): void;
|
|
624
645
|
protected renderTable(node: IRComponentNode, pos: any): string;
|
|
625
646
|
protected renderChartPlaceholder(node: IRComponentNode, pos: any): string;
|
|
626
647
|
protected renderText(node: IRComponentNode, pos: any): string;
|
|
@@ -655,6 +676,8 @@ declare class SVGRenderer {
|
|
|
655
676
|
protected resolveAccentColor(): string;
|
|
656
677
|
protected resolveControlColor(): string;
|
|
657
678
|
protected resolveChartColor(): string;
|
|
679
|
+
protected resolveTextColor(): string;
|
|
680
|
+
protected resolveMutedColor(): string;
|
|
658
681
|
protected getSemanticVariantColor(variant: string): string | undefined;
|
|
659
682
|
protected hexToRgba(hex: string, alpha: number): string;
|
|
660
683
|
protected getIconSize(size?: string): number;
|
|
@@ -757,6 +780,10 @@ declare class SkeletonSVGRenderer extends SVGRenderer {
|
|
|
757
780
|
* Render link as placeholder block + underline (no text)
|
|
758
781
|
*/
|
|
759
782
|
protected renderLink(node: IRComponentNode, pos: any): string;
|
|
783
|
+
/**
|
|
784
|
+
* Render breadcrumbs as skeleton blocks: <rect> / <rect> / <rect accent>
|
|
785
|
+
*/
|
|
786
|
+
protected renderBreadcrumbs(node: IRComponentNode, pos: any): string;
|
|
760
787
|
/**
|
|
761
788
|
* Render heading as gray block
|
|
762
789
|
*/
|
|
@@ -1108,8 +1135,9 @@ declare class SourceMapBuilder {
|
|
|
1108
1135
|
* - screen → "screen-0", "screen-1"
|
|
1109
1136
|
* - component Button → "component-button-0", "component-button-1"
|
|
1110
1137
|
* - layout stack → "layout-stack-0", "layout-stack-1"
|
|
1111
|
-
|
|
1112
|
-
|
|
1138
|
+
* - cell → "cell-0", "cell-1"
|
|
1139
|
+
* - component-definition → "define-MyButton"
|
|
1140
|
+
* - layout-definition → "define-layout-MyShell"
|
|
1113
1141
|
*/
|
|
1114
1142
|
private generateNodeId;
|
|
1115
1143
|
/**
|
|
@@ -1146,7 +1174,7 @@ declare class SourceMapBuilder {
|
|
|
1146
1174
|
build(): SourceMapEntry[];
|
|
1147
1175
|
/**
|
|
1148
1176
|
* Calculate insertionPoints for all container nodes
|
|
1149
|
-
* Container nodes: project, screen, layout, cell, component-definition
|
|
1177
|
+
* Container nodes: project, screen, layout, cell, component-definition, layout-definition
|
|
1150
1178
|
*/
|
|
1151
1179
|
private calculateAllInsertionPoints;
|
|
1152
1180
|
/**
|
|
@@ -1314,4 +1342,4 @@ declare class SourceMapResolver {
|
|
|
1314
1342
|
|
|
1315
1343
|
declare const version = "0.0.1";
|
|
1316
1344
|
|
|
1317
|
-
export { type AST, type ASTCell, type ASTComponent, type ASTDefinedComponent, type ASTLayout, type ASTScreen, type CapturedTokens, type CodeRange, DENSITY_TOKENS, DEVICE_PRESETS, type DesignTokens, type DevicePreset, type IRComponent, type IRComponentNode, type IRContainerNode, type IRContract, IRGenerator, type IRLayout, type IRMeta, type IRMetadata, type IRNode, type IRNodeStyle, type IRProject, type IRScreen, type IRStyle, type IRWireframe, type InsertionPoint, LayoutEngine, type LayoutPosition, type LayoutResult, type ParseDiagnosticsResult, type ParseError, type ParseResult, type ParseWireDSLWithSourceMapOptions, type ParsedComponent, type ParsedWireframe, type Position, type PositionQueryResult, type PropertySourceMap, type SVGComponent, type SVGRenderOptions, SVGRenderer, SkeletonSVGRenderer, SketchSVGRenderer, SourceMapBuilder, type SourceMapEntry, type SourceMapNodeType, SourceMapResolver, buildSVG, calculateLayout, createSVGElement, generateIR, generateStableNodeId, getTypeFromNodeId, isValidDevice, isValidNodeId, parseWireDSL, parseWireDSLWithSourceMap, renderToSVG, resolveDevicePreset, resolveGridPosition, resolveTokens, version };
|
|
1345
|
+
export { type AST, type ASTCell, type ASTComponent, type ASTDefinedComponent, type ASTDefinedLayout, type ASTLayout, type ASTScreen, type CapturedTokens, type CodeRange, DENSITY_TOKENS, DEVICE_PRESETS, type DesignTokens, type DevicePreset, type IRComponent, type IRComponentNode, type IRContainerNode, type IRContract, IRGenerator, type IRLayout, type IRMeta, type IRMetadata, type IRNode, type IRNodeStyle, type IRProject, type IRScreen, type IRStyle, type IRWireframe, type InsertionPoint, LayoutEngine, type LayoutPosition, type LayoutResult, type ParseDiagnosticsResult, type ParseError, type ParseResult, type ParseWireDSLWithSourceMapOptions, type ParsedComponent, type ParsedWireframe, type Position, type PositionQueryResult, type PropertySourceMap, type SVGComponent, type SVGRenderOptions, SVGRenderer, SkeletonSVGRenderer, SketchSVGRenderer, SourceMapBuilder, type SourceMapEntry, type SourceMapNodeType, SourceMapResolver, buildSVG, calculateLayout, createSVGElement, generateIR, generateStableNodeId, getTypeFromNodeId, isValidDevice, isValidNodeId, parseWireDSL, parseWireDSLWithSourceMap, renderToSVG, resolveDevicePreset, resolveGridPosition, resolveTokens, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ interface PropertySourceMap {
|
|
|
34
34
|
/**
|
|
35
35
|
* Types of nodes in Wire DSL
|
|
36
36
|
*/
|
|
37
|
-
type SourceMapNodeType = 'project' | 'screen' | 'layout' | 'component' | 'component-definition' | 'cell' | 'style' | 'mocks' | 'colors';
|
|
37
|
+
type SourceMapNodeType = 'project' | 'screen' | 'layout' | 'component' | 'component-definition' | 'layout-definition' | 'cell' | 'style' | 'mocks' | 'colors';
|
|
38
38
|
/**
|
|
39
39
|
* Main SourceMap entry - represents one node in the AST
|
|
40
40
|
*/
|
|
@@ -121,6 +121,7 @@ interface AST {
|
|
|
121
121
|
mocks: Record<string, string>;
|
|
122
122
|
colors: Record<string, string>;
|
|
123
123
|
definedComponents: ASTDefinedComponent[];
|
|
124
|
+
definedLayouts: ASTDefinedLayout[];
|
|
124
125
|
screens: ASTScreen[];
|
|
125
126
|
_meta?: {
|
|
126
127
|
nodeId: string;
|
|
@@ -172,6 +173,14 @@ interface ParseWireDSLWithSourceMapOptions {
|
|
|
172
173
|
throwOnError?: boolean;
|
|
173
174
|
includeSemanticWarnings?: boolean;
|
|
174
175
|
}
|
|
176
|
+
interface ASTDefinedLayout {
|
|
177
|
+
type: 'definedLayout';
|
|
178
|
+
name: string;
|
|
179
|
+
body: ASTLayout;
|
|
180
|
+
_meta?: {
|
|
181
|
+
nodeId: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
175
184
|
declare function parseWireDSL(input: string): AST;
|
|
176
185
|
/**
|
|
177
186
|
* Parse Wire DSL with SourceMap generation
|
|
@@ -293,9 +302,11 @@ declare class IRGenerator {
|
|
|
293
302
|
private idGen;
|
|
294
303
|
private nodes;
|
|
295
304
|
private definedComponents;
|
|
305
|
+
private definedLayouts;
|
|
296
306
|
private definedComponentIndices;
|
|
297
307
|
private undefinedComponentsUsed;
|
|
298
308
|
private warnings;
|
|
309
|
+
private errors;
|
|
299
310
|
private style;
|
|
300
311
|
generate(ast: AST): IRContract;
|
|
301
312
|
private applyStyle;
|
|
@@ -320,6 +331,15 @@ declare class IRGenerator {
|
|
|
320
331
|
private convertCell;
|
|
321
332
|
private convertComponent;
|
|
322
333
|
private expandDefinedComponent;
|
|
334
|
+
private expandDefinedLayout;
|
|
335
|
+
private resolveChildrenSlot;
|
|
336
|
+
private convertASTNode;
|
|
337
|
+
private resolveLayoutParams;
|
|
338
|
+
private normalizeSplitParams;
|
|
339
|
+
private resolveComponentProps;
|
|
340
|
+
private resolveBindingValue;
|
|
341
|
+
private isBindingTargetRequired;
|
|
342
|
+
private reportUnusedArguments;
|
|
323
343
|
private cleanParams;
|
|
324
344
|
private sanitizeId;
|
|
325
345
|
}
|
|
@@ -578,7 +598,7 @@ declare const THEMES: {
|
|
|
578
598
|
};
|
|
579
599
|
};
|
|
580
600
|
declare class SVGRenderer {
|
|
581
|
-
|
|
601
|
+
protected ir: IRContract;
|
|
582
602
|
private layout;
|
|
583
603
|
protected options: Required<Omit<SVGRenderOptions, 'screenName'>> & {
|
|
584
604
|
screenName?: string;
|
|
@@ -621,6 +641,7 @@ declare class SVGRenderer {
|
|
|
621
641
|
protected renderTopbar(node: IRComponentNode, pos: any): string;
|
|
622
642
|
protected renderPanelBorder(node: IRNode, pos: any, output: string[]): void;
|
|
623
643
|
protected renderCardBorder(node: IRNode, pos: any, output: string[]): void;
|
|
644
|
+
protected renderSplitDecoration(node: IRNode, pos: any, output: string[]): void;
|
|
624
645
|
protected renderTable(node: IRComponentNode, pos: any): string;
|
|
625
646
|
protected renderChartPlaceholder(node: IRComponentNode, pos: any): string;
|
|
626
647
|
protected renderText(node: IRComponentNode, pos: any): string;
|
|
@@ -655,6 +676,8 @@ declare class SVGRenderer {
|
|
|
655
676
|
protected resolveAccentColor(): string;
|
|
656
677
|
protected resolveControlColor(): string;
|
|
657
678
|
protected resolveChartColor(): string;
|
|
679
|
+
protected resolveTextColor(): string;
|
|
680
|
+
protected resolveMutedColor(): string;
|
|
658
681
|
protected getSemanticVariantColor(variant: string): string | undefined;
|
|
659
682
|
protected hexToRgba(hex: string, alpha: number): string;
|
|
660
683
|
protected getIconSize(size?: string): number;
|
|
@@ -757,6 +780,10 @@ declare class SkeletonSVGRenderer extends SVGRenderer {
|
|
|
757
780
|
* Render link as placeholder block + underline (no text)
|
|
758
781
|
*/
|
|
759
782
|
protected renderLink(node: IRComponentNode, pos: any): string;
|
|
783
|
+
/**
|
|
784
|
+
* Render breadcrumbs as skeleton blocks: <rect> / <rect> / <rect accent>
|
|
785
|
+
*/
|
|
786
|
+
protected renderBreadcrumbs(node: IRComponentNode, pos: any): string;
|
|
760
787
|
/**
|
|
761
788
|
* Render heading as gray block
|
|
762
789
|
*/
|
|
@@ -1108,8 +1135,9 @@ declare class SourceMapBuilder {
|
|
|
1108
1135
|
* - screen → "screen-0", "screen-1"
|
|
1109
1136
|
* - component Button → "component-button-0", "component-button-1"
|
|
1110
1137
|
* - layout stack → "layout-stack-0", "layout-stack-1"
|
|
1111
|
-
|
|
1112
|
-
|
|
1138
|
+
* - cell → "cell-0", "cell-1"
|
|
1139
|
+
* - component-definition → "define-MyButton"
|
|
1140
|
+
* - layout-definition → "define-layout-MyShell"
|
|
1113
1141
|
*/
|
|
1114
1142
|
private generateNodeId;
|
|
1115
1143
|
/**
|
|
@@ -1146,7 +1174,7 @@ declare class SourceMapBuilder {
|
|
|
1146
1174
|
build(): SourceMapEntry[];
|
|
1147
1175
|
/**
|
|
1148
1176
|
* Calculate insertionPoints for all container nodes
|
|
1149
|
-
* Container nodes: project, screen, layout, cell, component-definition
|
|
1177
|
+
* Container nodes: project, screen, layout, cell, component-definition, layout-definition
|
|
1150
1178
|
*/
|
|
1151
1179
|
private calculateAllInsertionPoints;
|
|
1152
1180
|
/**
|
|
@@ -1314,4 +1342,4 @@ declare class SourceMapResolver {
|
|
|
1314
1342
|
|
|
1315
1343
|
declare const version = "0.0.1";
|
|
1316
1344
|
|
|
1317
|
-
export { type AST, type ASTCell, type ASTComponent, type ASTDefinedComponent, type ASTLayout, type ASTScreen, type CapturedTokens, type CodeRange, DENSITY_TOKENS, DEVICE_PRESETS, type DesignTokens, type DevicePreset, type IRComponent, type IRComponentNode, type IRContainerNode, type IRContract, IRGenerator, type IRLayout, type IRMeta, type IRMetadata, type IRNode, type IRNodeStyle, type IRProject, type IRScreen, type IRStyle, type IRWireframe, type InsertionPoint, LayoutEngine, type LayoutPosition, type LayoutResult, type ParseDiagnosticsResult, type ParseError, type ParseResult, type ParseWireDSLWithSourceMapOptions, type ParsedComponent, type ParsedWireframe, type Position, type PositionQueryResult, type PropertySourceMap, type SVGComponent, type SVGRenderOptions, SVGRenderer, SkeletonSVGRenderer, SketchSVGRenderer, SourceMapBuilder, type SourceMapEntry, type SourceMapNodeType, SourceMapResolver, buildSVG, calculateLayout, createSVGElement, generateIR, generateStableNodeId, getTypeFromNodeId, isValidDevice, isValidNodeId, parseWireDSL, parseWireDSLWithSourceMap, renderToSVG, resolveDevicePreset, resolveGridPosition, resolveTokens, version };
|
|
1345
|
+
export { type AST, type ASTCell, type ASTComponent, type ASTDefinedComponent, type ASTDefinedLayout, type ASTLayout, type ASTScreen, type CapturedTokens, type CodeRange, DENSITY_TOKENS, DEVICE_PRESETS, type DesignTokens, type DevicePreset, type IRComponent, type IRComponentNode, type IRContainerNode, type IRContract, IRGenerator, type IRLayout, type IRMeta, type IRMetadata, type IRNode, type IRNodeStyle, type IRProject, type IRScreen, type IRStyle, type IRWireframe, type InsertionPoint, LayoutEngine, type LayoutPosition, type LayoutResult, type ParseDiagnosticsResult, type ParseError, type ParseResult, type ParseWireDSLWithSourceMapOptions, type ParsedComponent, type ParsedWireframe, type Position, type PositionQueryResult, type PropertySourceMap, type SVGComponent, type SVGRenderOptions, SVGRenderer, SkeletonSVGRenderer, SketchSVGRenderer, SourceMapBuilder, type SourceMapEntry, type SourceMapNodeType, SourceMapResolver, buildSVG, calculateLayout, createSVGElement, generateIR, generateStableNodeId, getTypeFromNodeId, isValidDevice, isValidNodeId, parseWireDSL, parseWireDSLWithSourceMap, renderToSVG, resolveDevicePreset, resolveGridPosition, resolveTokens, version };
|