designmockdown 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +126 -2
- package/dist/app/assets/index-CmugGtLS.js +15 -0
- package/dist/app/assets/index-CwhgxL4e.css +1 -0
- package/dist/app/index.html +13 -0
- package/dist/lib/cli.d.ts +11 -0
- package/dist/lib/cli.d.ts.map +1 -0
- package/dist/lib/cli.js +968 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/collab/client.d.ts +20 -0
- package/dist/lib/collab/client.d.ts.map +1 -0
- package/dist/lib/collab/client.js +126 -0
- package/dist/lib/collab/client.js.map +1 -0
- package/dist/lib/collab/index.d.ts +40 -0
- package/dist/lib/collab/index.d.ts.map +1 -0
- package/dist/lib/collab/index.js +154 -0
- package/dist/lib/collab/index.js.map +1 -0
- package/dist/lib/collab/room.d.ts +111 -0
- package/dist/lib/collab/room.d.ts.map +1 -0
- package/dist/lib/collab/room.js +120 -0
- package/dist/lib/collab/room.js.map +1 -0
- package/dist/lib/collab/ws.d.ts +33 -0
- package/dist/lib/collab/ws.d.ts.map +1 -0
- package/dist/lib/collab/ws.js +191 -0
- package/dist/lib/collab/ws.js.map +1 -0
- package/dist/lib/components/basic.d.ts +8 -0
- package/dist/lib/components/basic.d.ts.map +1 -0
- package/dist/lib/components/basic.js +181 -0
- package/dist/lib/components/basic.js.map +1 -0
- package/dist/lib/components/config.d.ts +26 -0
- package/dist/lib/components/config.d.ts.map +1 -0
- package/dist/lib/components/config.js +94 -0
- package/dist/lib/components/config.js.map +1 -0
- package/dist/lib/components/containers.d.ts +9 -0
- package/dist/lib/components/containers.d.ts.map +1 -0
- package/dist/lib/components/containers.js +102 -0
- package/dist/lib/components/containers.js.map +1 -0
- package/dist/lib/components/controls.d.ts +8 -0
- package/dist/lib/components/controls.d.ts.map +1 -0
- package/dist/lib/components/controls.js +376 -0
- package/dist/lib/components/controls.js.map +1 -0
- package/dist/lib/components/data.d.ts +8 -0
- package/dist/lib/components/data.d.ts.map +1 -0
- package/dist/lib/components/data.js +494 -0
- package/dist/lib/components/data.js.map +1 -0
- package/dist/lib/components/feedback.d.ts +8 -0
- package/dist/lib/components/feedback.d.ts.map +1 -0
- package/dist/lib/components/feedback.js +151 -0
- package/dist/lib/components/feedback.js.map +1 -0
- package/dist/lib/components/icons.d.ts +28 -0
- package/dist/lib/components/icons.d.ts.map +1 -0
- package/dist/lib/components/icons.js +85 -0
- package/dist/lib/components/icons.js.map +1 -0
- package/dist/lib/components/layout.d.ts +10 -0
- package/dist/lib/components/layout.d.ts.map +1 -0
- package/dist/lib/components/layout.js +82 -0
- package/dist/lib/components/layout.js.map +1 -0
- package/dist/lib/components/nav.d.ts +8 -0
- package/dist/lib/components/nav.d.ts.map +1 -0
- package/dist/lib/components/nav.js +216 -0
- package/dist/lib/components/nav.js.map +1 -0
- package/dist/lib/components/plugin.d.ts +27 -0
- package/dist/lib/components/plugin.d.ts.map +1 -0
- package/dist/lib/components/plugin.js +152 -0
- package/dist/lib/components/plugin.js.map +1 -0
- package/dist/lib/components/registry.d.ts +111 -0
- package/dist/lib/components/registry.d.ts.map +1 -0
- package/dist/lib/components/registry.js +375 -0
- package/dist/lib/components/registry.js.map +1 -0
- package/dist/lib/components/types.d.ts +111 -0
- package/dist/lib/components/types.d.ts.map +1 -0
- package/dist/lib/components/types.js +6 -0
- package/dist/lib/components/types.js.map +1 -0
- package/dist/lib/core/anim.d.ts +31 -0
- package/dist/lib/core/anim.d.ts.map +1 -0
- package/dist/lib/core/anim.js +95 -0
- package/dist/lib/core/anim.js.map +1 -0
- package/dist/lib/core/ast.d.ts +174 -0
- package/dist/lib/core/ast.d.ts.map +1 -0
- package/dist/lib/core/ast.js +42 -0
- package/dist/lib/core/ast.js.map +1 -0
- package/dist/lib/core/chart-source.d.ts +37 -0
- package/dist/lib/core/chart-source.d.ts.map +1 -0
- package/dist/lib/core/chart-source.js +125 -0
- package/dist/lib/core/chart-source.js.map +1 -0
- package/dist/lib/core/data.d.ts +32 -0
- package/dist/lib/core/data.d.ts.map +1 -0
- package/dist/lib/core/data.js +150 -0
- package/dist/lib/core/data.js.map +1 -0
- package/dist/lib/core/define.d.ts +16 -0
- package/dist/lib/core/define.d.ts.map +1 -0
- package/dist/lib/core/define.js +232 -0
- package/dist/lib/core/define.js.map +1 -0
- package/dist/lib/core/diagnostics.d.ts +64 -0
- package/dist/lib/core/diagnostics.d.ts.map +1 -0
- package/dist/lib/core/diagnostics.js +62 -0
- package/dist/lib/core/diagnostics.js.map +1 -0
- package/dist/lib/core/errors.d.ts +27 -0
- package/dist/lib/core/errors.d.ts.map +1 -0
- package/dist/lib/core/errors.js +70 -0
- package/dist/lib/core/errors.js.map +1 -0
- package/dist/lib/core/expand.d.ts +21 -0
- package/dist/lib/core/expand.d.ts.map +1 -0
- package/dist/lib/core/expand.js +226 -0
- package/dist/lib/core/expand.js.map +1 -0
- package/dist/lib/core/expr.d.ts +29 -0
- package/dist/lib/core/expr.d.ts.map +1 -0
- package/dist/lib/core/expr.js +313 -0
- package/dist/lib/core/expr.js.map +1 -0
- package/dist/lib/core/format.d.ts +30 -0
- package/dist/lib/core/format.d.ts.map +1 -0
- package/dist/lib/core/format.js +106 -0
- package/dist/lib/core/format.js.map +1 -0
- package/dist/lib/core/lexer.d.ts +54 -0
- package/dist/lib/core/lexer.d.ts.map +1 -0
- package/dist/lib/core/lexer.js +311 -0
- package/dist/lib/core/lexer.js.map +1 -0
- package/dist/lib/core/parser.d.ts +29 -0
- package/dist/lib/core/parser.d.ts.map +1 -0
- package/dist/lib/core/parser.js +674 -0
- package/dist/lib/core/parser.js.map +1 -0
- package/dist/lib/core/resolver.d.ts +37 -0
- package/dist/lib/core/resolver.d.ts.map +1 -0
- package/dist/lib/core/resolver.js +240 -0
- package/dist/lib/core/resolver.js.map +1 -0
- package/dist/lib/core/spec.d.ts +87 -0
- package/dist/lib/core/spec.d.ts.map +1 -0
- package/dist/lib/core/spec.js +207 -0
- package/dist/lib/core/spec.js.map +1 -0
- package/dist/lib/core/state.d.ts +19 -0
- package/dist/lib/core/state.d.ts.map +1 -0
- package/dist/lib/core/state.js +64 -0
- package/dist/lib/core/state.js.map +1 -0
- package/dist/lib/core/tokens.d.ts +36 -0
- package/dist/lib/core/tokens.d.ts.map +1 -0
- package/dist/lib/core/tokens.js +198 -0
- package/dist/lib/core/tokens.js.map +1 -0
- package/dist/lib/export/pages.d.ts +39 -0
- package/dist/lib/export/pages.d.ts.map +1 -0
- package/dist/lib/export/pages.js +95 -0
- package/dist/lib/export/pages.js.map +1 -0
- package/dist/lib/export/raster.d.ts +39 -0
- package/dist/lib/export/raster.d.ts.map +1 -0
- package/dist/lib/export/raster.js +152 -0
- package/dist/lib/export/raster.js.map +1 -0
- package/dist/lib/index.d.ts +33 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +30 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/layout/engine.d.ts +32 -0
- package/dist/lib/layout/engine.d.ts.map +1 -0
- package/dist/lib/layout/engine.js +1063 -0
- package/dist/lib/layout/engine.js.map +1 -0
- package/dist/lib/layout/measure.d.ts +30 -0
- package/dist/lib/layout/measure.d.ts.map +1 -0
- package/dist/lib/layout/measure.js +148 -0
- package/dist/lib/layout/measure.js.map +1 -0
- package/dist/lib/layout/types.d.ts +94 -0
- package/dist/lib/layout/types.d.ts.map +1 -0
- package/dist/lib/layout/types.js +16 -0
- package/dist/lib/layout/types.js.map +1 -0
- package/dist/lib/lsp/server.d.ts +76 -0
- package/dist/lib/lsp/server.d.ts.map +1 -0
- package/dist/lib/lsp/server.js +264 -0
- package/dist/lib/lsp/server.js.map +1 -0
- package/dist/lib/output/docs.d.ts +26 -0
- package/dist/lib/output/docs.d.ts.map +1 -0
- package/dist/lib/output/docs.js +231 -0
- package/dist/lib/output/docs.js.map +1 -0
- package/dist/lib/output/ir.d.ts +105 -0
- package/dist/lib/output/ir.d.ts.map +1 -0
- package/dist/lib/output/ir.js +89 -0
- package/dist/lib/output/ir.js.map +1 -0
- package/dist/lib/output/schema.d.ts +69 -0
- package/dist/lib/output/schema.d.ts.map +1 -0
- package/dist/lib/output/schema.js +84 -0
- package/dist/lib/output/schema.js.map +1 -0
- package/dist/lib/paths.d.ts +12 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/paths.js +27 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/playground/examples.d.ts +16 -0
- package/dist/lib/playground/examples.d.ts.map +1 -0
- package/dist/lib/playground/examples.js +515 -0
- package/dist/lib/playground/examples.js.map +1 -0
- package/dist/lib/playground/index.d.ts +51 -0
- package/dist/lib/playground/index.d.ts.map +1 -0
- package/dist/lib/playground/index.js +598 -0
- package/dist/lib/playground/index.js.map +1 -0
- package/dist/lib/render/assets.d.ts +35 -0
- package/dist/lib/render/assets.d.ts.map +1 -0
- package/dist/lib/render/assets.js +114 -0
- package/dist/lib/render/assets.js.map +1 -0
- package/dist/lib/render/backends.d.ts +31 -0
- package/dist/lib/render/backends.d.ts.map +1 -0
- package/dist/lib/render/backends.js +57 -0
- package/dist/lib/render/backends.js.map +1 -0
- package/dist/lib/render/css.d.ts +24 -0
- package/dist/lib/render/css.d.ts.map +1 -0
- package/dist/lib/render/css.js +148 -0
- package/dist/lib/render/css.js.map +1 -0
- package/dist/lib/render/document-html.d.ts +28 -0
- package/dist/lib/render/document-html.d.ts.map +1 -0
- package/dist/lib/render/document-html.js +214 -0
- package/dist/lib/render/document-html.js.map +1 -0
- package/dist/lib/render/dom.d.ts +32 -0
- package/dist/lib/render/dom.d.ts.map +1 -0
- package/dist/lib/render/dom.js +531 -0
- package/dist/lib/render/dom.js.map +1 -0
- package/dist/lib/render/primitives.d.ts +81 -0
- package/dist/lib/render/primitives.d.ts.map +1 -0
- package/dist/lib/render/primitives.js +172 -0
- package/dist/lib/render/primitives.js.map +1 -0
- package/dist/lib/render/react.d.ts +23 -0
- package/dist/lib/render/react.d.ts.map +1 -0
- package/dist/lib/render/react.js +447 -0
- package/dist/lib/render/react.js.map +1 -0
- package/dist/lib/render/svg.d.ts +45 -0
- package/dist/lib/render/svg.d.ts.map +1 -0
- package/dist/lib/render/svg.js +179 -0
- package/dist/lib/render/svg.js.map +1 -0
- package/dist/lib/runtime/proto.d.ts +19 -0
- package/dist/lib/runtime/proto.d.ts.map +1 -0
- package/dist/lib/runtime/proto.js +81 -0
- package/dist/lib/runtime/proto.js.map +1 -0
- package/dist/lib/skill/install.d.ts +28 -0
- package/dist/lib/skill/install.d.ts.map +1 -0
- package/dist/lib/skill/install.js +89 -0
- package/dist/lib/skill/install.js.map +1 -0
- package/dist/lib/workbench/app.d.ts +24 -0
- package/dist/lib/workbench/app.d.ts.map +1 -0
- package/dist/lib/workbench/app.js +45 -0
- package/dist/lib/workbench/app.js.map +1 -0
- package/dist/lib/workbench/assets.d.ts +21 -0
- package/dist/lib/workbench/assets.d.ts.map +1 -0
- package/dist/lib/workbench/assets.js +44 -0
- package/dist/lib/workbench/assets.js.map +1 -0
- package/dist/lib/workbench/client.d.ts +18 -0
- package/dist/lib/workbench/client.d.ts.map +1 -0
- package/dist/lib/workbench/client.js +736 -0
- package/dist/lib/workbench/client.js.map +1 -0
- package/dist/lib/workbench/drag.d.ts +90 -0
- package/dist/lib/workbench/drag.d.ts.map +1 -0
- package/dist/lib/workbench/drag.js +109 -0
- package/dist/lib/workbench/drag.js.map +1 -0
- package/dist/lib/workbench/geometry.d.ts +28 -0
- package/dist/lib/workbench/geometry.d.ts.map +1 -0
- package/dist/lib/workbench/geometry.js +28 -0
- package/dist/lib/workbench/geometry.js.map +1 -0
- package/dist/lib/workbench/select.d.ts +56 -0
- package/dist/lib/workbench/select.d.ts.map +1 -0
- package/dist/lib/workbench/select.js +111 -0
- package/dist/lib/workbench/select.js.map +1 -0
- package/dist/lib/workbench/server.d.ts +223 -0
- package/dist/lib/workbench/server.d.ts.map +1 -0
- package/dist/lib/workbench/server.js +576 -0
- package/dist/lib/workbench/server.js.map +1 -0
- package/dist/lib/workbench/source.d.ts +124 -0
- package/dist/lib/workbench/source.d.ts.map +1 -0
- package/dist/lib/workbench/source.js +405 -0
- package/dist/lib/workbench/source.js.map +1 -0
- package/docs/README.md +49 -0
- package/docs/cheatsheet.md +243 -0
- package/docs/cli.md +95 -0
- package/docs/data.md +112 -0
- package/docs/export.md +106 -0
- package/docs/getting-started.md +105 -0
- package/docs/language.md +136 -0
- package/docs/layout.md +159 -0
- package/docs/plugins.md +82 -0
- package/docs/reference.md +1156 -0
- package/docs/roadmap.md +54 -0
- package/docs/syntax.md +312 -0
- package/docs/workbench.md +125 -0
- package/examples/app.dm +76 -0
- package/examples/assets/avatar.png +0 -0
- package/examples/assets/cover.png +0 -0
- package/examples/assets/logo.svg +4 -0
- package/examples/assets.dm +49 -0
- package/examples/dashboard.dm +64 -0
- package/examples/data.dm +107 -0
- package/examples/layout.dm +93 -0
- package/examples/login.dm +43 -0
- package/examples/login.html +61 -0
- package/examples/plugins/rating/README.md +67 -0
- package/examples/plugins/rating/example.dm +29 -0
- package/examples/plugins/rating/index.ts +122 -0
- package/examples/plugins/rating/package.json +22 -0
- package/examples/recipe/assets/broccoli.jpg +0 -0
- package/examples/recipe/assets/cheesecake.jpg +0 -0
- package/examples/recipe/assets/chicken-pot.jpg +0 -0
- package/examples/recipe/assets/noodles.jpg +0 -0
- package/examples/recipe/assets/shrimp.jpg +0 -0
- package/examples/recipe/assets/tomato-beef.jpg +0 -0
- package/examples/recipe/detail.dm +105 -0
- package/examples/recipe/discover.dm +116 -0
- package/examples/recipe/favorites.dm +115 -0
- package/examples/recipe/index.dm +124 -0
- package/examples/recipe/profile.dm +134 -0
- package/examples/recipe/steps.dm +89 -0
- package/examples/settings.dm +108 -0
- package/package.json +84 -4
- package/skills/designmockdown/REFERENCE.md +373 -0
- package/skills/designmockdown/SKILL.md +179 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG drawing primitives. The component library depends only on this layer, never on the registry,
|
|
3
|
+
* which avoids a circular dependency.
|
|
4
|
+
*/
|
|
5
|
+
import type { LayoutBox } from '../layout/types.ts';
|
|
6
|
+
export declare function esc(s: string): string;
|
|
7
|
+
export interface PaintOpts {
|
|
8
|
+
fill?: string;
|
|
9
|
+
stroke?: string;
|
|
10
|
+
sw?: number;
|
|
11
|
+
rx?: number;
|
|
12
|
+
opacity?: number;
|
|
13
|
+
dash?: string;
|
|
14
|
+
extra?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function rect(x: number, y: number, w: number, h: number, o?: PaintOpts): string;
|
|
17
|
+
export declare function circle(cx: number, cy: number, rad: number, o?: PaintOpts): string;
|
|
18
|
+
export declare function ellipse(cx: number, cy: number, rx: number, ry: number, o?: PaintOpts): string;
|
|
19
|
+
export declare function line(x1: number, y1: number, x2: number, y2: number, o?: PaintOpts): string;
|
|
20
|
+
export declare function path(d: string, o?: PaintOpts): string;
|
|
21
|
+
export declare function polyline(points: [number, number][], o?: PaintOpts): string;
|
|
22
|
+
export interface TextOpts {
|
|
23
|
+
size?: number;
|
|
24
|
+
weight?: number;
|
|
25
|
+
color?: string;
|
|
26
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
27
|
+
ls?: number;
|
|
28
|
+
opacity?: number;
|
|
29
|
+
family?: string;
|
|
30
|
+
italic?: boolean;
|
|
31
|
+
decoration?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function textEl(x: number, y: number, str: string, o?: TextOpts): string;
|
|
34
|
+
/** Number formatting, to avoid noise like 1.0000000002 */
|
|
35
|
+
export declare function r(n: number): number;
|
|
36
|
+
/** Draw a box's text lines, supporting horizontal and vertical alignment */
|
|
37
|
+
export declare function drawLines(box: LayoutBox, o?: {
|
|
38
|
+
color?: string;
|
|
39
|
+
size?: number;
|
|
40
|
+
weight?: number;
|
|
41
|
+
align?: 'left' | 'center' | 'right';
|
|
42
|
+
valign?: 'top' | 'middle';
|
|
43
|
+
ls?: number;
|
|
44
|
+
}): string;
|
|
45
|
+
/** Single-line text (no wrapping), typically used for labels */
|
|
46
|
+
export declare function drawSingle(box: LayoutBox, o?: {
|
|
47
|
+
color?: string;
|
|
48
|
+
size?: number;
|
|
49
|
+
weight?: number;
|
|
50
|
+
align?: 'left' | 'center' | 'right';
|
|
51
|
+
valign?: 'top' | 'middle';
|
|
52
|
+
}): string;
|
|
53
|
+
/** Draw a box's background, border and shadow; returns an SVG fragment */
|
|
54
|
+
export declare function drawChrome(box: LayoutBox, o?: {
|
|
55
|
+
bg?: string;
|
|
56
|
+
radius?: number;
|
|
57
|
+
stroke?: string;
|
|
58
|
+
sw?: number;
|
|
59
|
+
shadow?: string;
|
|
60
|
+
}): string;
|
|
61
|
+
/** Draw an image into a box: cover-cropped plus rounded corners, in local coordinates */
|
|
62
|
+
export declare function drawImage(box: LayoutBox, href: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* clip-path for overflow=hidden boxes.
|
|
65
|
+
*
|
|
66
|
+
* The clip has to live on the box's own <g transform> group, not inside drawChrome: children are
|
|
67
|
+
* painted by the renderer after the component returns, so a clip inside the component output would
|
|
68
|
+
* only clip the component's own chrome and never the overflowing content.
|
|
69
|
+
*/
|
|
70
|
+
export declare function overflowClip(box: LayoutBox): {
|
|
71
|
+
def: string;
|
|
72
|
+
attr: string;
|
|
73
|
+
} | undefined;
|
|
74
|
+
/** The content origin (padding removed) */
|
|
75
|
+
export declare function contentOrigin(box: LayoutBox): {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
w: number;
|
|
79
|
+
h: number;
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/render/primitives.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,oBAAoB,CAAA;AAG1D,wBAAgB,GAA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;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAoB1I;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAS9D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAOtF;AAED,2CAA2C;AAC3C,wBAAgB,aAAa,CAAC,GAAG,EAAE,SAAS,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAQ5F"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG drawing primitives. The component library depends only on this layer, never on the registry,
|
|
3
|
+
* which avoids a circular dependency.
|
|
4
|
+
*/
|
|
5
|
+
export function esc(s) {
|
|
6
|
+
return s
|
|
7
|
+
.replace(/&/g, '&')
|
|
8
|
+
.replace(/</g, '<')
|
|
9
|
+
.replace(/>/g, '>')
|
|
10
|
+
.replace(/"/g, '"');
|
|
11
|
+
}
|
|
12
|
+
function paint(o) {
|
|
13
|
+
const parts = [];
|
|
14
|
+
if (o.fill !== undefined)
|
|
15
|
+
parts.push(`fill="${o.fill}"`);
|
|
16
|
+
if (o.stroke !== undefined)
|
|
17
|
+
parts.push(`stroke="${o.stroke}"`);
|
|
18
|
+
if (o.sw !== undefined && o.sw > 0)
|
|
19
|
+
parts.push(`stroke-width="${o.sw}"`);
|
|
20
|
+
if (o.opacity !== undefined)
|
|
21
|
+
parts.push(`opacity="${o.opacity}"`);
|
|
22
|
+
if (o.dash !== undefined)
|
|
23
|
+
parts.push(`stroke-dasharray="${o.dash}"`);
|
|
24
|
+
if (o.extra)
|
|
25
|
+
parts.push(o.extra);
|
|
26
|
+
return parts.length > 0 ? ' ' + parts.join(' ') : '';
|
|
27
|
+
}
|
|
28
|
+
export function rect(x, y, w, h, o = {}) {
|
|
29
|
+
const rx = o.rx !== undefined && o.rx > 0 ? ` rx="${o.rx}"` : '';
|
|
30
|
+
return `<rect x="${r(x)}" y="${r(y)}" width="${r(Math.max(0, w))}" height="${r(Math.max(0, h))}"${rx}${paint(o)}/>`;
|
|
31
|
+
}
|
|
32
|
+
export function circle(cx, cy, rad, o = {}) {
|
|
33
|
+
return `<circle cx="${r(cx)}" cy="${r(cy)}" r="${r(rad)}"${paint(o)}/>`;
|
|
34
|
+
}
|
|
35
|
+
export function ellipse(cx, cy, rx, ry, o = {}) {
|
|
36
|
+
return `<ellipse cx="${r(cx)}" cy="${r(cy)}" rx="${r(rx)}" ry="${r(ry)}"${paint(o)}/>`;
|
|
37
|
+
}
|
|
38
|
+
export function line(x1, y1, x2, y2, o = {}) {
|
|
39
|
+
return `<line x1="${r(x1)}" y1="${r(y1)}" x2="${r(x2)}" y2="${r(y2)}"${paint(o)}/>`;
|
|
40
|
+
}
|
|
41
|
+
export function path(d, o = {}) {
|
|
42
|
+
return `<path d="${d}"${paint({ fill: 'none', ...o })}/>`;
|
|
43
|
+
}
|
|
44
|
+
export function polyline(points, o = {}) {
|
|
45
|
+
const pts = points.map(([x, y]) => `${r(x)},${r(y)}`).join(' ');
|
|
46
|
+
return `<polyline points="${pts}"${paint({ fill: 'none', ...o })}/>`;
|
|
47
|
+
}
|
|
48
|
+
export function textEl(x, y, str, o = {}) {
|
|
49
|
+
const attrs = [
|
|
50
|
+
`x="${r(x)}"`,
|
|
51
|
+
`y="${r(y)}"`,
|
|
52
|
+
`font-size="${o.size ?? 14}"`,
|
|
53
|
+
`font-weight="${o.weight ?? 400}"`,
|
|
54
|
+
`fill="${o.color ?? '#000'}"`,
|
|
55
|
+
`text-anchor="${o.anchor ?? 'start'}"`,
|
|
56
|
+
];
|
|
57
|
+
if (o.ls)
|
|
58
|
+
attrs.push(`letter-spacing="${o.ls}"`);
|
|
59
|
+
if (o.opacity !== undefined)
|
|
60
|
+
attrs.push(`opacity="${o.opacity}"`);
|
|
61
|
+
if (o.italic)
|
|
62
|
+
attrs.push(`font-style="italic"`);
|
|
63
|
+
if (o.decoration)
|
|
64
|
+
attrs.push(`text-decoration="${o.decoration}"`);
|
|
65
|
+
return `<text ${attrs.join(' ')}>${esc(str)}</text>`;
|
|
66
|
+
}
|
|
67
|
+
/** Number formatting, to avoid noise like 1.0000000002 */
|
|
68
|
+
export function r(n) {
|
|
69
|
+
return Math.round(n * 100) / 100;
|
|
70
|
+
}
|
|
71
|
+
/** Draw a box's text lines, supporting horizontal and vertical alignment */
|
|
72
|
+
export function drawLines(box, o = {}) {
|
|
73
|
+
if (!box.lines || box.lines.length === 0)
|
|
74
|
+
return '';
|
|
75
|
+
const s = box.style;
|
|
76
|
+
const size = o.size ?? s.fontSize;
|
|
77
|
+
const weight = o.weight ?? s.fontWeight;
|
|
78
|
+
const color = o.color ?? s.color ?? '#000';
|
|
79
|
+
const align = o.align ?? s.textAlign;
|
|
80
|
+
const lh = s.lineHeight;
|
|
81
|
+
const totalH = box.lines.length * lh;
|
|
82
|
+
const startY = o.valign === 'middle' ? (box.height - totalH) / 2 : 0;
|
|
83
|
+
const out = [];
|
|
84
|
+
box.lines.forEach((tokens, i) => {
|
|
85
|
+
const lineText = tokens.map((t) => t.text).join('');
|
|
86
|
+
const lineWidth = tokens.reduce((a, t) => a + t.width, 0);
|
|
87
|
+
let x;
|
|
88
|
+
if (align === 'center')
|
|
89
|
+
x = (box.width - lineWidth) / 2;
|
|
90
|
+
else if (align === 'right')
|
|
91
|
+
x = box.width - lineWidth;
|
|
92
|
+
else
|
|
93
|
+
x = 0;
|
|
94
|
+
const y = startY + i * lh + lh * 0.76;
|
|
95
|
+
out.push(textEl(x, y, lineText, { size, weight, color, ls: o.ls ?? s.letterSpacing }));
|
|
96
|
+
});
|
|
97
|
+
return out.join('');
|
|
98
|
+
}
|
|
99
|
+
/** Single-line text (no wrapping), typically used for labels */
|
|
100
|
+
export function drawSingle(box, o = {}) {
|
|
101
|
+
const s = box.style;
|
|
102
|
+
const size = o.size ?? s.fontSize;
|
|
103
|
+
const weight = o.weight ?? s.fontWeight;
|
|
104
|
+
const color = o.color ?? s.color ?? '#000';
|
|
105
|
+
const align = o.align ?? s.textAlign;
|
|
106
|
+
const str = box.text ?? '';
|
|
107
|
+
const w = box.lines?.[0]?.reduce((a, t) => a + t.width, 0) ?? 0;
|
|
108
|
+
let x;
|
|
109
|
+
if (align === 'center')
|
|
110
|
+
x = (box.width - w) / 2;
|
|
111
|
+
else if (align === 'right')
|
|
112
|
+
x = box.width - w;
|
|
113
|
+
else
|
|
114
|
+
x = 0;
|
|
115
|
+
const y = o.valign === 'middle' ? box.height / 2 + size * 0.36 : size * 0.9;
|
|
116
|
+
return textEl(x, y, str, { size, weight, color });
|
|
117
|
+
}
|
|
118
|
+
/** Draw a box's background, border and shadow; returns an SVG fragment */
|
|
119
|
+
export function drawChrome(box, o = {}) {
|
|
120
|
+
const s = box.style;
|
|
121
|
+
const out = [];
|
|
122
|
+
const bg = o.bg ?? s.bg;
|
|
123
|
+
const radius = o.radius ?? s.radius;
|
|
124
|
+
const stroke = o.stroke ?? s.borderColor;
|
|
125
|
+
const sw = o.sw ?? s.borderWidth;
|
|
126
|
+
const shadow = o.shadow ?? s.shadow;
|
|
127
|
+
if (shadow) {
|
|
128
|
+
out.push(`<filter id="sh-${box.id}" x="-30%" y="-30%" width="160%" height="160%"><feDropShadow dx="0" dy="2" stdDeviation="4" flood-color="#0F172A" flood-opacity="0.10"/></filter>`);
|
|
129
|
+
out.push(rect(box.x, box.y, box.width, box.height, { rx: radius, fill: bg ?? 'none', stroke, sw, extra: `filter="url(#sh-${box.id})"` }));
|
|
130
|
+
return out.join('');
|
|
131
|
+
}
|
|
132
|
+
if (bg !== undefined || (stroke !== undefined && sw > 0)) {
|
|
133
|
+
out.push(rect(box.x, box.y, box.width, box.height, { rx: radius, fill: bg ?? 'none', stroke: sw > 0 ? stroke : undefined, sw }));
|
|
134
|
+
}
|
|
135
|
+
return out.join('');
|
|
136
|
+
}
|
|
137
|
+
/** Draw an image into a box: cover-cropped plus rounded corners, in local coordinates */
|
|
138
|
+
export function drawImage(box, href) {
|
|
139
|
+
const rx = box.style.radius ?? 0;
|
|
140
|
+
const clipId = `ic-${box.id}`;
|
|
141
|
+
const w = r(box.width);
|
|
142
|
+
const h = r(box.height);
|
|
143
|
+
return (`<defs><clipPath id="${clipId}"><rect x="0" y="0" width="${w}" height="${h}" rx="${r(rx)}"/></clipPath></defs>` +
|
|
144
|
+
`<g clip-path="url(#${clipId})"><image href="${esc(href)}" x="0" y="0" width="${w}" height="${h}" preserveAspectRatio="xMidYMid slice"/></g>`);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* clip-path for overflow=hidden boxes.
|
|
148
|
+
*
|
|
149
|
+
* The clip has to live on the box's own <g transform> group, not inside drawChrome: children are
|
|
150
|
+
* painted by the renderer after the component returns, so a clip inside the component output would
|
|
151
|
+
* only clip the component's own chrome and never the overflowing content.
|
|
152
|
+
*/
|
|
153
|
+
export function overflowClip(box) {
|
|
154
|
+
if (box.style.overflow !== 'hidden')
|
|
155
|
+
return undefined;
|
|
156
|
+
const id = `cl-${box.id}`;
|
|
157
|
+
return {
|
|
158
|
+
def: `<clipPath id="${id}"><rect x="0" y="0" width="${r(box.width)}" height="${r(box.height)}" rx="${r(box.style.radius ?? 0)}"/></clipPath>`,
|
|
159
|
+
attr: ` clip-path="url(#${id})"`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** The content origin (padding removed) */
|
|
163
|
+
export function contentOrigin(box) {
|
|
164
|
+
const s = box.style;
|
|
165
|
+
return {
|
|
166
|
+
x: box.x + s.padding.left,
|
|
167
|
+
y: box.y + s.padding.top,
|
|
168
|
+
w: Math.max(0, box.width - s.padding.left - s.padding.right),
|
|
169
|
+
h: Math.max(0, box.height - s.padding.top - s.padding.bottom),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=primitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../../src/render/primitives.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,UAAU,GAAG,CAAC,CAAS;IAC3B,OAAO,CAAC;SACL,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC5B,CAAC;AAYD,SAAS,KAAK,CAAC,CAAY;IACzB,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,CAAA;IACxD,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;IAC9D,IAAI,CAAC,CAAC,EAAE,KAAK,SAAS,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACxE,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,GAAG,CAAC,CAAA;IACjE,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS;QAAE,KAAK,CAAC,IA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AAC,SAAS,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,gBAAgB;QAC7I,IAAI,EAAE,oBAAoB,EAAE,IAAI;KACjC,CAAA;AACH,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,aAAa,CAAC,GAAc;IAC1C,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAA;IACnB,OAAO;QACL,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI;QACzB,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG;QACxB,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QAC5D,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;KAC9D,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React emitter: LayoutBox -> a .tsx component.
|
|
3
|
+
*
|
|
4
|
+
* Shares the style mapping with the DOM backend (`render/css.ts`) so the two outputs cannot drift.
|
|
5
|
+
* The emitted code uses inline style objects rather than a stylesheet: the output is meant to be
|
|
6
|
+
* dropped into an existing codebase, and inline styles keep it self-contained with no build step.
|
|
7
|
+
*
|
|
8
|
+
* Like the DOM backend, this is a semantic translation, not a pixel reproduction of the SVG.
|
|
9
|
+
*/
|
|
10
|
+
import type { PageNode } from '../core/ast.ts';
|
|
11
|
+
import type { Theme } from '../core/tokens.ts';
|
|
12
|
+
export interface ReactOptions {
|
|
13
|
+
/** Exported component name (default: derived from the page title) */
|
|
14
|
+
componentName?: string;
|
|
15
|
+
/** The .dm file's directory, used to resolve image paths */
|
|
16
|
+
baseDir?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Emit a standalone .tsx module for the page */
|
|
19
|
+
export declare function emitReact(page: PageNode, theme: Theme, canvas: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}, opts?: ReactOptions): string;
|
|
23
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/render/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAO9C,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,iDAAiD;AACjD,wBAAgB,SAAS,CACvB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACzC,IAAI,GAAE,YAAiB,GACtB,MAAM,CAwCR"}
|