sketchmark 1.1.5 → 1.1.6
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/README.md +80 -55
- package/dist/ast/types.d.ts +11 -1
- package/dist/ast/types.d.ts.map +1 -1
- package/dist/index.cjs +51 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -1
- package/dist/layout/entity-rect.d.ts +2 -0
- package/dist/layout/entity-rect.d.ts.map +1 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/scene/index.d.ts +11 -1
- package/dist/scene/index.d.ts.map +1 -1
- package/dist/sketchmark.iife.js +51 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -263,17 +263,28 @@ Every diagram follows this structure:
|
|
|
263
263
|
```
|
|
264
264
|
diagram
|
|
265
265
|
[title label="My Title"]
|
|
266
|
-
[layout row|column|grid]
|
|
266
|
+
[layout row|column|grid|absolute]
|
|
267
267
|
[config key=value ...]
|
|
268
268
|
[theme name fill="..." stroke="..." color="..."]
|
|
269
269
|
|
|
270
270
|
[nodes, edges, groups, tables, charts, markdown blocks]
|
|
271
271
|
|
|
272
|
-
[step action target ...]
|
|
273
|
-
end
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
[step action target ...]
|
|
273
|
+
end
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
When `layout=absolute`, authored elements use `x`/`y` coordinates instead of flow layout:
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
diagram
|
|
280
|
+
layout absolute
|
|
281
|
+
box start x=40 y=60 label="Start"
|
|
282
|
+
box finish x=240 y=140 label="Finish"
|
|
283
|
+
start --> finish
|
|
284
|
+
end
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
- Lines starting with `#` or `//` are comments.
|
|
277
288
|
- All key-value attributes use the `key=value` or `key="quoted value"` syntax.
|
|
278
289
|
- The DSL is **whitespace-sensitive** — do not indent lines.
|
|
279
290
|
|
|
@@ -327,10 +338,12 @@ note myNote label="Remember this!"
|
|
|
327
338
|
|
|
328
339
|
| Property | Type | Description | Example |
|
|
329
340
|
|----------|------|-------------|---------|
|
|
330
|
-
| `label` | string | Display text (required) | `label="Hello World"` |
|
|
331
|
-
| `width` | number | Override auto-width (px) | `width=140` |
|
|
332
|
-
| `height` | number | Override auto-height (px) | `height=55` |
|
|
333
|
-
| `
|
|
341
|
+
| `label` | string | Display text (required) | `label="Hello World"` |
|
|
342
|
+
| `width` | number | Override auto-width (px) | `width=140` |
|
|
343
|
+
| `height` | number | Override auto-height (px) | `height=55` |
|
|
344
|
+
| `x` | number | Authored X position when parent/root uses `layout=absolute` | `x=80` |
|
|
345
|
+
| `y` | number | Authored Y position when parent/root uses `layout=absolute` | `y=40` |
|
|
346
|
+
| `theme` | string | Named theme preset | `theme=primary` |
|
|
334
347
|
| `fill` | CSS color | Background fill color | `fill="#e8f4ff"` |
|
|
335
348
|
| `stroke` | CSS color | Border/outline color | `stroke="#0044cc"` |
|
|
336
349
|
| `stroke-width` | number | Border thickness | `stroke-width=2` |
|
|
@@ -349,8 +362,8 @@ note myNote label="Remember this!"
|
|
|
349
362
|
| `name` | string | Iconify icon name (for `icon`) | `name="mdi:cog"` |
|
|
350
363
|
| `value` | string | SVG path data (for `path`) | `value="M 0 0 L 50 0"` |
|
|
351
364
|
| `deg` | number | Static rotation (degrees) | `deg=45` |
|
|
352
|
-
| `dx` | number | Static X translation (px) | `dx=20` |
|
|
353
|
-
| `dy` | number | Static Y translation (px) | `dy=-10` |
|
|
365
|
+
| `dx` | number | Static visual X translation after layout (px) | `dx=20` |
|
|
366
|
+
| `dy` | number | Static visual Y translation after layout (px) | `dy=-10` |
|
|
354
367
|
| `factor` | number | Static scale factor | `factor=1.2` |
|
|
355
368
|
|
|
356
369
|
---
|
|
@@ -420,12 +433,12 @@ group outer label="Outer Group" layout=column items=[a,b,inner]
|
|
|
420
433
|
General form:
|
|
421
434
|
|
|
422
435
|
```
|
|
423
|
-
group <id> [label="..."] [layout=row|column|grid] [gap=N] [padding=N]
|
|
424
|
-
[columns=N] [align=start|center|end]
|
|
425
|
-
[justify=start|center|end|space-between|space-around]
|
|
426
|
-
[theme=...] [fill="..."] [stroke="..."] [width=N] [height=N]
|
|
427
|
-
[items=[id1,id2,...]]
|
|
428
|
-
```
|
|
436
|
+
group <id> [label="..."] [layout=row|column|grid|absolute] [gap=N] [padding=N]
|
|
437
|
+
[columns=N] [align=start|center|end]
|
|
438
|
+
[justify=start|center|end|space-between|space-around]
|
|
439
|
+
[theme=...] [fill="..."] [stroke="..."] [x=N] [y=N] [width=N] [height=N]
|
|
440
|
+
[items=[id1,id2,...]]
|
|
441
|
+
```
|
|
429
442
|
|
|
430
443
|
- Groups are always declared at the top level.
|
|
431
444
|
- `items` order is the visual child order.
|
|
@@ -437,18 +450,22 @@ group <id> [label="..."] [layout=row|column|grid] [gap=N] [padding=N]
|
|
|
437
450
|
| Property | Type | Description |
|
|
438
451
|
|----------|------|-------------|
|
|
439
452
|
| `label` | string | Group title (shown at top) |
|
|
440
|
-
| `layout` | row / column / grid | Child arrangement direction |
|
|
441
|
-
| `gap` | number | Space between children (px) |
|
|
442
|
-
| `padding` | number | Inner padding (px) |
|
|
443
|
-
| `columns` | number | Column count (for `layout=grid`) |
|
|
444
|
-
| `align` | start/center/end | Cross-axis alignment (align-items) |
|
|
445
|
-
| `justify` | start/center/end/space-between/space-around | Main-axis alignment |
|
|
446
|
-
| `
|
|
447
|
-
| `
|
|
448
|
-
| `
|
|
449
|
-
| `
|
|
450
|
-
| `
|
|
451
|
-
| `
|
|
453
|
+
| `layout` | row / column / grid / absolute | Child arrangement direction |
|
|
454
|
+
| `gap` | number | Space between children (px) |
|
|
455
|
+
| `padding` | number | Inner padding (px) |
|
|
456
|
+
| `columns` | number | Column count (for `layout=grid`) |
|
|
457
|
+
| `align` | start/center/end | Cross-axis alignment (align-items) |
|
|
458
|
+
| `justify` | start/center/end/space-between/space-around | Main-axis alignment |
|
|
459
|
+
| `x` | number | Authored X position when parent/root uses `layout=absolute` |
|
|
460
|
+
| `y` | number | Authored Y position when parent/root uses `layout=absolute` |
|
|
461
|
+
| `width` | number | Minimum width override |
|
|
462
|
+
| `height` | number | Minimum height override |
|
|
463
|
+
| `theme` | string | Named theme preset |
|
|
464
|
+
| `fill` | CSS color | Background color |
|
|
465
|
+
| `stroke` | CSS color | Border color |
|
|
466
|
+
| `stroke-width` | number | Border thickness |
|
|
467
|
+
|
|
468
|
+
For absolute groups, child `x`/`y` coordinates are relative to the group's inner content box.
|
|
452
469
|
|
|
453
470
|
#### `bare` keyword
|
|
454
471
|
|
|
@@ -465,7 +482,7 @@ bare myContainer layout=row items=[a,b]
|
|
|
465
482
|
## Tables
|
|
466
483
|
|
|
467
484
|
```
|
|
468
|
-
table <id> [label="..."] [theme=...] [fill="..."] [stroke="..."]
|
|
485
|
+
table <id> [label="..."] [x=N] [y=N] [theme=...] [fill="..."] [stroke="..."]
|
|
469
486
|
{
|
|
470
487
|
header Col1 Col2 Col3
|
|
471
488
|
row "Value A" "Value B" "Value C"
|
|
@@ -473,18 +490,19 @@ table <id> [label="..."] [theme=...] [fill="..."] [stroke="..."]
|
|
|
473
490
|
}
|
|
474
491
|
```
|
|
475
492
|
|
|
476
|
-
- `header` rows get a shaded background and bold text.
|
|
477
|
-
- `row` rows use regular styling.
|
|
478
|
-
- `"value"` must use a double-quoted string literal.
|
|
479
|
-
- Column widths auto-size to content.
|
|
480
|
-
- Tables support `fill`, `stroke`, `color`, `font-size`, `font`, `text-align`, `letter-spacing`, `theme`, `opacity` style props (same as nodes).
|
|
493
|
+
- `header` rows get a shaded background and bold text.
|
|
494
|
+
- `row` rows use regular styling.
|
|
495
|
+
- `"value"` must use a double-quoted string literal.
|
|
496
|
+
- Column widths auto-size to content.
|
|
497
|
+
- Tables support `fill`, `stroke`, `color`, `font-size`, `font`, `text-align`, `letter-spacing`, `theme`, `opacity` style props (same as nodes).
|
|
498
|
+
- Tables also accept `x` and `y` when the parent/root uses `layout=absolute`.
|
|
481
499
|
|
|
482
500
|
---
|
|
483
501
|
|
|
484
502
|
## Charts
|
|
485
503
|
|
|
486
504
|
```
|
|
487
|
-
<chart-type> <id> [label="Title"] [width=N] [height=N] [theme=...] [style props]
|
|
505
|
+
<chart-type> <id> [label="Title"] [x=N] [y=N] [width=N] [height=N] [theme=...] [style props]
|
|
488
506
|
data
|
|
489
507
|
[["Category", "Series1", "Series2"],
|
|
490
508
|
["Jan", 120, 80],
|
|
@@ -512,13 +530,15 @@ data
|
|
|
512
530
|
["Mar", 1100, 750]]
|
|
513
531
|
|
|
514
532
|
# Pie chart example
|
|
515
|
-
pie-chart share label="Market Share" width=300 height=240
|
|
516
|
-
data
|
|
517
|
-
[["Company", "Share"],
|
|
518
|
-
["Alpha", 42],
|
|
519
|
-
["Beta", 31],
|
|
520
|
-
["Gamma", 27]]
|
|
521
|
-
```
|
|
533
|
+
pie-chart share label="Market Share" width=300 height=240
|
|
534
|
+
data
|
|
535
|
+
[["Company", "Share"],
|
|
536
|
+
["Alpha", 42],
|
|
537
|
+
["Beta", 31],
|
|
538
|
+
["Gamma", 27]]
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
Charts also accept `x` and `y` when the parent/root uses `layout=absolute`.
|
|
522
542
|
|
|
523
543
|
---
|
|
524
544
|
|
|
@@ -527,7 +547,7 @@ data
|
|
|
527
547
|
Renders inline rich text with headings and bold/italic:
|
|
528
548
|
|
|
529
549
|
```
|
|
530
|
-
markdown <id> [width=N] [height=N] [theme=...] [style props]
|
|
550
|
+
markdown <id> [x=N] [y=N] [width=N] [height=N] [theme=...] [style props]
|
|
531
551
|
"""
|
|
532
552
|
# Heading 1
|
|
533
553
|
## Heading 2
|
|
@@ -539,9 +559,10 @@ Another paragraph here.
|
|
|
539
559
|
"""
|
|
540
560
|
```
|
|
541
561
|
|
|
542
|
-
- Triple-quote `"""` delimiters for the content block.
|
|
543
|
-
- Supported formatting: `# H1`, `## H2`, `### H3`, `**bold**`, `*italic*`, blank lines.
|
|
544
|
-
- Style props: `color`, `font`, `font-size`, `text-align`, `padding`, `fill`, `stroke`, `opacity`, `letter-spacing`.
|
|
562
|
+
- Triple-quote `"""` delimiters for the content block.
|
|
563
|
+
- Supported formatting: `# H1`, `## H2`, `### H3`, `**bold**`, `*italic*`, blank lines.
|
|
564
|
+
- Style props: `color`, `font`, `font-size`, `text-align`, `padding`, `fill`, `stroke`, `opacity`, `letter-spacing`.
|
|
565
|
+
- Markdown blocks also accept `x` and `y` when the parent/root uses `layout=absolute`.
|
|
545
566
|
|
|
546
567
|
---
|
|
547
568
|
|
|
@@ -974,9 +995,11 @@ exportHTML(instance.svg, dslSource, { filename: 'diagram.html' });
|
|
|
974
995
|
|
|
975
996
|
## Supported vs Unsupported Features
|
|
976
997
|
|
|
977
|
-
### Nodes
|
|
978
|
-
|
|
979
|
-
|
|
998
|
+
### Nodes
|
|
999
|
+
|
|
1000
|
+
Nodes can also opt into authored absolute `x`/`y` positioning when their parent or the root diagram uses `layout=absolute`.
|
|
1001
|
+
|
|
1002
|
+
| Feature | Supported | Notes |
|
|
980
1003
|
|---------|-----------|-------|
|
|
981
1004
|
| box | ✅ | Default shape |
|
|
982
1005
|
| circle | ✅ | |
|
|
@@ -1016,9 +1039,11 @@ exportHTML(instance.svg, dslSource, { filename: 'diagram.html' });
|
|
|
1016
1039
|
| Multiple edges between same nodes | ✅ | Stack visually |
|
|
1017
1040
|
| Edge from/to groups | ✅ | Uses group center |
|
|
1018
1041
|
|
|
1019
|
-
### Groups
|
|
1020
|
-
|
|
1021
|
-
|
|
1042
|
+
### Groups
|
|
1043
|
+
|
|
1044
|
+
Groups support `layout=absolute` in addition to flow layouts. In absolute groups, child `x`/`y` coordinates are measured from the group's inner content box.
|
|
1045
|
+
|
|
1046
|
+
| Feature | Supported | Notes |
|
|
1022
1047
|
|---------|-----------|-------|
|
|
1023
1048
|
| Nested groups | ✅ | Unlimited depth |
|
|
1024
1049
|
| Row / column / grid layout | ✅ | |
|
|
@@ -1101,7 +1126,7 @@ exportHTML(instance.svg, dslSource, { filename: 'diagram.html' });
|
|
|
1101
1126
|
| `end` | Structure | `end` |
|
|
1102
1127
|
| `title` | Meta | `title label="My Diagram"` |
|
|
1103
1128
|
| `description` | Meta | `description "Some text"` |
|
|
1104
|
-
| `layout` | Meta | `layout row` / `layout column` / `layout grid` |
|
|
1129
|
+
| `layout` | Meta | `layout row` / `layout column` / `layout grid` / `layout absolute` |
|
|
1105
1130
|
| `config` | Meta | `config gap=60` |
|
|
1106
1131
|
| `theme` | Styling | `theme primary fill="#e8f4ff" stroke="#0044cc" color="#003399"` |
|
|
1107
1132
|
| `style` | Styling | `style nodeId fill="#ff0" stroke="#000"` |
|
package/dist/ast/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type NodeShape = 'box' | 'circle' | 'diamond' | 'hexagon' | 'triangle' | 'cylinder' | 'parallelogram' | 'text' | 'image' | 'icon' | 'note' | 'line' | 'path';
|
|
2
2
|
export type EdgeConnector = '->' | '<-' | '<->' | '-->' | '<-->' | '---' | '--';
|
|
3
|
-
export type LayoutType = 'row' | 'column' | 'grid';
|
|
3
|
+
export type LayoutType = 'row' | 'column' | 'grid' | 'absolute';
|
|
4
4
|
export type AlignItems = 'start' | 'center' | 'end';
|
|
5
5
|
export type JustifyContent = 'start' | 'center' | 'end' | 'space-between' | 'space-around';
|
|
6
6
|
export type AnimationAction = 'highlight' | 'fade' | 'unfade' | 'draw' | 'erase' | 'show' | 'hide' | 'pulse' | 'move' | 'color' | 'scale' | 'rotate' | 'narrate' | 'circle' | 'underline' | 'crossout' | 'bracket' | 'tick' | 'strikeoff';
|
|
@@ -65,6 +65,8 @@ export interface ASTNode {
|
|
|
65
65
|
pathData?: string;
|
|
66
66
|
width?: number;
|
|
67
67
|
height?: number;
|
|
68
|
+
x?: number;
|
|
69
|
+
y?: number;
|
|
68
70
|
deg?: number;
|
|
69
71
|
dx?: number;
|
|
70
72
|
dy?: number;
|
|
@@ -98,6 +100,8 @@ export interface ASTGroup {
|
|
|
98
100
|
justify?: JustifyContent;
|
|
99
101
|
theme?: string;
|
|
100
102
|
style?: StyleProps;
|
|
103
|
+
x?: number;
|
|
104
|
+
y?: number;
|
|
101
105
|
width?: number;
|
|
102
106
|
height?: number;
|
|
103
107
|
}
|
|
@@ -133,6 +137,8 @@ export interface ASTChart {
|
|
|
133
137
|
data: ASTChartData;
|
|
134
138
|
width?: number;
|
|
135
139
|
height?: number;
|
|
140
|
+
x?: number;
|
|
141
|
+
y?: number;
|
|
136
142
|
theme?: string;
|
|
137
143
|
style?: StyleProps;
|
|
138
144
|
}
|
|
@@ -145,6 +151,8 @@ export interface ASTTable {
|
|
|
145
151
|
id: string;
|
|
146
152
|
label: string;
|
|
147
153
|
rows: ASTTableRow[];
|
|
154
|
+
x?: number;
|
|
155
|
+
y?: number;
|
|
148
156
|
theme?: string;
|
|
149
157
|
style?: StyleProps;
|
|
150
158
|
}
|
|
@@ -154,6 +162,8 @@ export interface ASTMarkdown {
|
|
|
154
162
|
content: string;
|
|
155
163
|
width?: number;
|
|
156
164
|
height?: number;
|
|
165
|
+
x?: number;
|
|
166
|
+
y?: number;
|
|
157
167
|
theme?: string;
|
|
158
168
|
style?: StyleProps;
|
|
159
169
|
}
|
package/dist/ast/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ast/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GACjB,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GACrD,UAAU,GAAG,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GACjE,MAAM,GAAG,MAAM,CAAC;AAEpB,MAAM,MAAM,aAAa,GACrB,IAAI,GAAG,IAAI,GAAG,KAAK,GAA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CAAC;CACrB;AAGD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IACtD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAG,OAAO,EAAE,CAAC;IAClB,KAAK,EAAG,OAAO,EAAE,CAAC;IAClB,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,KAAK,EAAG,WAAW,EAAE,CAAC;IACtB,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,MAAM,EAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtC,MAAM,EAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtC,MAAM,EAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACrD,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B"}
|
package/dist/index.cjs
CHANGED
|
@@ -504,6 +504,8 @@ function parse(src) {
|
|
|
504
504
|
label: props.label || "",
|
|
505
505
|
...(props.width ? { width: parseFloat(props.width) } : {}),
|
|
506
506
|
...(props.height ? { height: parseFloat(props.height) } : {}),
|
|
507
|
+
...(props.x ? { x: parseFloat(props.x) } : {}),
|
|
508
|
+
...(props.y ? { y: parseFloat(props.y) } : {}),
|
|
507
509
|
...(props.deg ? { deg: parseFloat(props.deg) } : {}),
|
|
508
510
|
...(props.dx ? { dx: parseFloat(props.dx) } : {}),
|
|
509
511
|
...(props.dy ? { dy: parseFloat(props.dy) } : {}),
|
|
@@ -542,6 +544,12 @@ function parse(src) {
|
|
|
542
544
|
style: propsToStyle(props),
|
|
543
545
|
...(props.width ? { width: parseFloat(props.width) } : {}),
|
|
544
546
|
...(props.height ? { height: parseFloat(props.height) } : {}),
|
|
547
|
+
...(props.x ? { x: parseFloat(props.x) } : {}),
|
|
548
|
+
...(props.y ? { y: parseFloat(props.y) } : {}),
|
|
549
|
+
...(props.deg ? { deg: parseFloat(props.deg) } : {}),
|
|
550
|
+
...(props.dx ? { dx: parseFloat(props.dx) } : {}),
|
|
551
|
+
...(props.dy ? { dy: parseFloat(props.dy) } : {}),
|
|
552
|
+
...(props.factor ? { factor: parseFloat(props.factor) } : {}),
|
|
545
553
|
};
|
|
546
554
|
}
|
|
547
555
|
function parseGroup() {
|
|
@@ -581,6 +589,8 @@ function parse(src) {
|
|
|
581
589
|
justify: props.justify,
|
|
582
590
|
theme: props.theme,
|
|
583
591
|
style: propsToStyle(props),
|
|
592
|
+
x: props.x !== undefined ? parseFloat(props.x) : undefined,
|
|
593
|
+
y: props.y !== undefined ? parseFloat(props.y) : undefined,
|
|
584
594
|
width: props.width !== undefined ? parseFloat(props.width) : undefined,
|
|
585
595
|
height: props.height !== undefined ? parseFloat(props.height) : undefined,
|
|
586
596
|
};
|
|
@@ -752,6 +762,8 @@ function parse(src) {
|
|
|
752
762
|
chartType: chartType.replace("-chart", ""),
|
|
753
763
|
label: props.label ?? props.title,
|
|
754
764
|
data: { headers, rows },
|
|
765
|
+
x: props.x ? parseFloat(props.x) : undefined,
|
|
766
|
+
y: props.y ? parseFloat(props.y) : undefined,
|
|
755
767
|
width: props.width ? parseFloat(props.width) : undefined,
|
|
756
768
|
height: props.height ? parseFloat(props.height) : undefined,
|
|
757
769
|
theme: props.theme,
|
|
@@ -777,6 +789,8 @@ function parse(src) {
|
|
|
777
789
|
id,
|
|
778
790
|
label: props.label ?? "",
|
|
779
791
|
rows: [],
|
|
792
|
+
x: props.x ? parseFloat(props.x) : undefined,
|
|
793
|
+
y: props.y ? parseFloat(props.y) : undefined,
|
|
780
794
|
theme: props.theme,
|
|
781
795
|
style: propsToStyle(props),
|
|
782
796
|
};
|
|
@@ -832,6 +846,8 @@ function parse(src) {
|
|
|
832
846
|
kind: "markdown",
|
|
833
847
|
id,
|
|
834
848
|
content: content.trim(),
|
|
849
|
+
x: props.x ? parseFloat(props.x) : undefined,
|
|
850
|
+
y: props.y ? parseFloat(props.y) : undefined,
|
|
835
851
|
width: props.width ? parseFloat(props.width) : undefined,
|
|
836
852
|
height: props.height ? parseFloat(props.height) : undefined,
|
|
837
853
|
theme: props.theme,
|
|
@@ -3440,6 +3456,8 @@ function buildSceneGraph(ast) {
|
|
|
3440
3456
|
groupId: nodeParentById.get(n.id),
|
|
3441
3457
|
width: n.width,
|
|
3442
3458
|
height: n.height,
|
|
3459
|
+
authoredX: n.x,
|
|
3460
|
+
authoredY: n.y,
|
|
3443
3461
|
deg: n.deg,
|
|
3444
3462
|
dx: n.dx,
|
|
3445
3463
|
dy: n.dy,
|
|
@@ -3468,6 +3486,8 @@ function buildSceneGraph(ast) {
|
|
|
3468
3486
|
align: (g.align ?? "start"),
|
|
3469
3487
|
justify: (g.justify ?? "start"),
|
|
3470
3488
|
style: { ...ast.styles[g.id], ...themeStyle, ...g.style },
|
|
3489
|
+
authoredX: g.x,
|
|
3490
|
+
authoredY: g.y,
|
|
3471
3491
|
width: g.width,
|
|
3472
3492
|
height: g.height,
|
|
3473
3493
|
x: 0,
|
|
@@ -3487,6 +3507,8 @@ function buildSceneGraph(ast) {
|
|
|
3487
3507
|
headerH: TABLE.headerH,
|
|
3488
3508
|
labelH: TABLE.labelH,
|
|
3489
3509
|
style: { ...ast.styles[t.id], ...themeStyle, ...t.style },
|
|
3510
|
+
authoredX: t.x,
|
|
3511
|
+
authoredY: t.y,
|
|
3490
3512
|
x: 0,
|
|
3491
3513
|
y: 0,
|
|
3492
3514
|
w: 0,
|
|
@@ -3501,6 +3523,8 @@ function buildSceneGraph(ast) {
|
|
|
3501
3523
|
label: c.label,
|
|
3502
3524
|
data: c.data,
|
|
3503
3525
|
style: { ...ast.styles[c.id], ...themeStyle, ...c.style },
|
|
3526
|
+
authoredX: c.x,
|
|
3527
|
+
authoredY: c.y,
|
|
3504
3528
|
x: 0,
|
|
3505
3529
|
y: 0,
|
|
3506
3530
|
w: c.width ?? CHART.defaultW,
|
|
@@ -3516,6 +3540,8 @@ function buildSceneGraph(ast) {
|
|
|
3516
3540
|
style: { ...ast.styles[m.id], ...themeStyle, ...m.style },
|
|
3517
3541
|
width: m.width,
|
|
3518
3542
|
height: m.height,
|
|
3543
|
+
authoredX: m.x,
|
|
3544
|
+
authoredY: m.y,
|
|
3519
3545
|
x: 0,
|
|
3520
3546
|
y: 0,
|
|
3521
3547
|
w: 0,
|
|
@@ -4363,6 +4389,12 @@ function iW(r, em) {
|
|
|
4363
4389
|
function iH(r, em) {
|
|
4364
4390
|
return em.get(r.id).h;
|
|
4365
4391
|
}
|
|
4392
|
+
function iAuthX(r, em) {
|
|
4393
|
+
return em.get(r.id).authoredX ?? 0;
|
|
4394
|
+
}
|
|
4395
|
+
function iAuthY(r, em) {
|
|
4396
|
+
return em.get(r.id).authoredY ?? 0;
|
|
4397
|
+
}
|
|
4366
4398
|
function setPos(r, x, y, em) {
|
|
4367
4399
|
const e = em.get(r.id);
|
|
4368
4400
|
e.x = Math.round(x);
|
|
@@ -4409,6 +4441,12 @@ function measure(g, gm, tm, cm, mdm, em) {
|
|
|
4409
4441
|
g.w = cols * cellW + (cols - 1) * gap + pad * 2;
|
|
4410
4442
|
g.h = rows * cellH + (rows - 1) * gap + pad * 2 + labelH;
|
|
4411
4443
|
}
|
|
4444
|
+
else if (layout === "absolute") {
|
|
4445
|
+
const maxRight = Math.max(0, ...kids.map((r) => iAuthX(r, em) + iW(r, em)));
|
|
4446
|
+
const maxBottom = Math.max(0, ...kids.map((r) => iAuthY(r, em) + iH(r, em)));
|
|
4447
|
+
g.w = maxRight + pad * 2;
|
|
4448
|
+
g.h = maxBottom + pad * 2 + labelH;
|
|
4449
|
+
}
|
|
4412
4450
|
else {
|
|
4413
4451
|
// column (default)
|
|
4414
4452
|
g.w = Math.max(...ws) + pad * 2;
|
|
@@ -4499,6 +4537,11 @@ function place(g, gm, em) {
|
|
|
4499
4537
|
setPos(ref, contentX + (i % cols) * (cellW + gap), contentY + Math.floor(i / cols) * (cellH + gap), em);
|
|
4500
4538
|
});
|
|
4501
4539
|
}
|
|
4540
|
+
else if (layout === "absolute") {
|
|
4541
|
+
kids.forEach((ref) => {
|
|
4542
|
+
setPos(ref, contentX + iAuthX(ref, em), contentY + iAuthY(ref, em), em);
|
|
4543
|
+
});
|
|
4544
|
+
}
|
|
4502
4545
|
else {
|
|
4503
4546
|
// column (default)
|
|
4504
4547
|
const ws = kids.map((r) => iW(r, em));
|
|
@@ -4681,6 +4724,7 @@ function layout(sg) {
|
|
|
4681
4724
|
const rootCols = Number(sg.config["columns"] ?? 1);
|
|
4682
4725
|
const useGrid = rootLayout === "grid" && rootCols > 0;
|
|
4683
4726
|
const useColumn = rootLayout === "column";
|
|
4727
|
+
const useAbsolute = rootLayout === "absolute";
|
|
4684
4728
|
if (useGrid) {
|
|
4685
4729
|
// ── Grid: per-row heights, per-column widths (no wasted space) ──
|
|
4686
4730
|
const cols = rootCols;
|
|
@@ -4712,6 +4756,13 @@ function layout(sg) {
|
|
|
4712
4756
|
e.y = rowY[Math.floor(idx / cols)];
|
|
4713
4757
|
});
|
|
4714
4758
|
}
|
|
4759
|
+
else if (useAbsolute) {
|
|
4760
|
+
for (const ref of rootOrder) {
|
|
4761
|
+
const e = em.get(ref.id);
|
|
4762
|
+
e.x = MARGIN + (e.authoredX ?? 0);
|
|
4763
|
+
e.y = MARGIN + (e.authoredY ?? 0);
|
|
4764
|
+
}
|
|
4765
|
+
}
|
|
4715
4766
|
else {
|
|
4716
4767
|
// ── Row or Column linear flow ──────────────────────────
|
|
4717
4768
|
let pos = MARGIN;
|