@sentropic/diagram-canvas 0.2.3 → 0.2.5
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.
|
@@ -168,21 +168,21 @@
|
|
|
168
168
|
"body": [
|
|
169
169
|
{
|
|
170
170
|
"text": "Body",
|
|
171
|
-
"x":
|
|
171
|
+
"x": 232,
|
|
172
172
|
"baseline": 108.1875,
|
|
173
173
|
"size": 24,
|
|
174
174
|
"weight": 400,
|
|
175
175
|
"secondary": false,
|
|
176
|
-
"anchor": "
|
|
176
|
+
"anchor": "middle"
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
"text": "Detail",
|
|
180
|
-
"x":
|
|
180
|
+
"x": 232,
|
|
181
181
|
"baseline": 139.375,
|
|
182
182
|
"size": 24,
|
|
183
183
|
"weight": 400,
|
|
184
184
|
"secondary": true,
|
|
185
|
-
"anchor": "
|
|
185
|
+
"anchor": "middle"
|
|
186
186
|
}
|
|
187
187
|
],
|
|
188
188
|
"bodyBottom": 148.5625,
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
"anchor": "middle"
|
|
288
288
|
}
|
|
289
289
|
],
|
|
290
|
-
"bodyBottom":
|
|
290
|
+
"bodyBottom": 132.96875,
|
|
291
291
|
"ruleY": 152.5625,
|
|
292
292
|
"ruleX1": 16,
|
|
293
293
|
"ruleX2": 450,
|
|
@@ -589,11 +589,11 @@
|
|
|
589
589
|
}
|
|
590
590
|
},
|
|
591
591
|
"hostStyles": {
|
|
592
|
-
"packages/components-svelte/src/lib/DiagramCard.svelte": "
|
|
592
|
+
"packages/components-svelte/src/lib/DiagramCard.svelte": "9a5ba42f489d62df63f68050559e1bcf5297af92e30afd9df9e1cacd02abe0d1",
|
|
593
593
|
"packages/components-svelte/src/lib/DiagramZone.svelte": "73d2d2b2d04d00744447f760adec3209a083a44ca3ec37d0afdeca6b01d9a14d",
|
|
594
594
|
"packages/components-svelte/src/lib/DiagramCardHeader.svelte": "0495fec195f2ad5c44b154fb5de41b307eeccbfd594d21c17c8d257f5c2cf36e",
|
|
595
595
|
"packages/components-svelte/src/lib/DiagramZoneHeader.svelte": "a7b16b82699981e16191af4736d86d3f6a6ef341fad5e2f13306d2cebd687bd8",
|
|
596
|
-
"packages/components-vue/src/DiagramCard.vue": "
|
|
596
|
+
"packages/components-vue/src/DiagramCard.vue": "3f98c68f5931a2b43d19943f3230875c390048557dd00631186258c4f163fe31",
|
|
597
597
|
"packages/components-vue/src/DiagramZone.vue": "abedd7be2f9a1d84b5451119fb536dd88215eb5a7541346301a0a7b0d7aea08b",
|
|
598
598
|
"packages/components-vue/src/DiagramCardHeader.vue": "6c78015c3d3f5dd458513ae0acff9cb8b079171f8e36ab32eacf4e9cf56ed9f4",
|
|
599
599
|
"packages/components-vue/src/DiagramZoneHeader.vue": "81c5fe3eab9ec65707303ecc7fa7892ce0adddbbc317947e1e3a11cdd0d117f7",
|
|
@@ -618,6 +618,25 @@
|
|
|
618
618
|
".st-iconButton:focus-visible {\n border-color: var(--st-component-iconButton-focusRing, var(--st-semantic-border-interactive));\n box-shadow: 0 0 0 2px var(--st-component-iconButton-focusRing, var(--st-semantic-border-interactive));\n outline: none;\n }",
|
|
619
619
|
".st-iconButton:disabled {\n color: var(--st-component-control-disabledText, var(--st-semantic-text-muted));\n cursor: not-allowed;\n }"
|
|
620
620
|
],
|
|
621
|
+
"diagramCardCss": [
|
|
622
|
+
".st-diagramCard {\n width: var(--st-component-diagramCard-width, 460px);\n height: var(--st-component-diagramCard-height, 200px);\n box-sizing: border-box;\n border: var(--st-component-diagramCard-borderWidth, 2px) solid\n var(--st-component-diagramCard-border, var(--st-semantic-border-strong));\n border-left: var(--st-component-diagramCard-accentWidth, 8px) solid\n var(--st-component-diagramCard-accent, var(--st-semantic-data-category1));\n border-radius: var(--st-component-diagramCard-radius, 0);\n background: var(--st-component-diagramCard-surface, var(--st-semantic-surface-raised));\n color: var(--st-component-diagramCard-text, var(--st-semantic-text-primary));\n padding: var(--st-component-diagramCard-padding, 8px);\n display: flex;\n flex-direction: column;\n text-align: left;\n font-family: var(--st-component-diagramCard-fontFamily, var(--st-font-sans));\n }",
|
|
623
|
+
".st-diagramCard--center {\n \n text-align: center;\n }",
|
|
624
|
+
".st-diagramCard--proposed {\n border-style: dashed;\n }",
|
|
625
|
+
".st-diagramCard-gap {\n display: block;\n height: var(--st-component-diagramCard-gap, 6px);\n flex: 0 0 var(--st-component-diagramCard-gap, 6px);\n }",
|
|
626
|
+
".st-diagramCard-body {\n \n min-width: 0;\n flex: 1 1 auto;\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n font-size: var(--st-component-diagramCard-bodyFontSize, 24px);\n font-weight: var(--st-component-diagramCard-bodyFontWeight, 400);\n line-height: var(--st-component-diagramCard-bodyLineHeight, 1.3);\n }",
|
|
627
|
+
".st-diagramCard-line,\n .st-diagramCard-detail {\n display: block;\n min-width: 0;\n \n overflow-wrap: normal;\n word-break: normal;\n }",
|
|
628
|
+
".st-diagramCard-detail {\n color: var(--st-component-diagramCard-secondaryText, var(--st-semantic-text-secondary));\n }",
|
|
629
|
+
".st-diagramCard-foot {\n margin-top: auto;\n flex: 0 0 auto;\n }",
|
|
630
|
+
".st-diagramCard-rule {\n display: block;\n flex: 0 0 auto;\n \n height: var(--st-component-diagramCard-ruleHeight, 1px);\n margin: var(--st-component-diagramCard-ruleMargin, 4px) 0;\n background: var(--st-component-diagramCard-rule, var(--st-semantic-border-subtle));\n transform: scaleY(calc(1 / var(--st-diagram-zoom, 1)));\n transform-origin: center;\n }",
|
|
631
|
+
".st-diagramCard-footer {\n \n margin-bottom: calc(\n var(--st-component-diagramCard-footerBottomInset, 9.25px) -\n var(--st-component-diagramCard-padding, 8px)\n );\n font-size: var(--st-component-diagramCard-footerFontSize, 24px);\n font-weight: var(--st-component-diagramCard-footerFontWeight, 700);\n line-height: var(--st-component-diagramCard-footerLineHeight, 1.3);\n }",
|
|
632
|
+
".st-diagramCard-footerLine {\n display: block;\n min-width: 0;\n overflow-wrap: normal;\n word-break: normal;\n }",
|
|
633
|
+
".st-diagramCardHeader {\n display: flex;\n align-items: center;\n gap: var(--st-component-diagramCard-iconTextGap, 6px);\n min-width: 0;\n flex: 0 0 auto;\n }",
|
|
634
|
+
".st-diagramCardHeader-icon {\n flex: 0 0 var(--st-component-diagramCard-iconSize, 70px);\n width: var(--st-component-diagramCard-iconSize, 70px);\n height: var(--st-component-diagramCard-iconSize, 70px);\n }",
|
|
635
|
+
".st-diagramCardHeader-text {\n display: flex;\n flex-direction: column;\n justify-content: center;\n min-width: 0;\n flex: 0 1 auto;\n }",
|
|
636
|
+
".st-diagramCard-kicker {\n display: block;\n min-width: 0;\n font-size: var(--st-component-diagramCard-kickerFontSize, 22px);\n font-weight: var(--st-component-diagramCard-kickerFontWeight, 400);\n line-height: var(--st-component-diagramCard-kickerLineHeight, 1.3);\n letter-spacing: var(--st-component-diagramCard-kickerLetterSpacing, 0.04em);\n text-transform: var(--st-component-diagramCard-kickerTextTransform, uppercase);\n color: var(--st-component-diagramCard-secondaryText, var(--st-semantic-text-secondary));\n \n overflow-wrap: normal;\n word-break: normal;\n }",
|
|
637
|
+
".st-diagramCard-title {\n display: block;\n min-width: 0;\n font-size: var(--st-component-diagramCard-titleFontSize, 32px);\n font-weight: var(--st-component-diagramCard-titleFontWeight, 700);\n line-height: var(--st-component-diagramCard-titleLineHeight, 1.3);\n color: var(--st-component-diagramCard-text, var(--st-semantic-text-primary));\n overflow-wrap: normal;\n word-break: normal;\n }",
|
|
638
|
+
".st-diagramCard-toggle {\n flex: 0 0 auto;\n margin-left: auto;\n \n align-self: flex-start;\n }"
|
|
639
|
+
],
|
|
621
640
|
"renderedAnatomy": {
|
|
622
641
|
"svelte/card": {
|
|
623
642
|
"tag": "div",
|
|
@@ -183,15 +183,18 @@ export interface DiagramCardProps {
|
|
|
183
183
|
readonly proposed?: boolean;
|
|
184
184
|
readonly toggle?: DiagramCardToggle;
|
|
185
185
|
/**
|
|
186
|
-
* Owner variant: `"center"` centres
|
|
187
|
-
* frozen
|
|
186
|
+
* Owner variant: `"center"` centres the kicker/title/footer text slots
|
|
187
|
+
* horizontally inside their frozen allocations (same 460 × 200 box). The
|
|
188
|
+
* body block is always centred — horizontally and vertically — inside
|
|
189
|
+
* the remaining body box. Default `"left"`.
|
|
188
190
|
*/
|
|
189
191
|
readonly align?: "left" | "center";
|
|
190
192
|
/**
|
|
191
|
-
* Body rendering mode. `"leaf"` (default):
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
193
|
+
* Body rendering mode. `"leaf"` (default): function/detail lines at the
|
|
194
|
+
* body inset, centred horizontally and vertically inside the remaining
|
|
195
|
+
* body box. `"subtitle"`: the collapsed-zone subtitle — wrapped at the
|
|
196
|
+
* frozen 396 px measure and centred the same way inside the card body
|
|
197
|
+
* area (§6.2.1).
|
|
195
198
|
*/
|
|
196
199
|
readonly bodyMode?: "leaf" | "subtitle";
|
|
197
200
|
}
|
|
@@ -390,12 +393,13 @@ export interface CardLayout {
|
|
|
390
393
|
readonly headerBlockHeight: number;
|
|
391
394
|
readonly bodyX: number;
|
|
392
395
|
readonly bodyWidth: number;
|
|
393
|
-
/** Body allocation: vertical centring reference
|
|
396
|
+
/** Body allocation: vertical centring reference for every card body (leaf and `subtitle` alike). */
|
|
394
397
|
readonly bodyArea: {
|
|
395
398
|
readonly top: number;
|
|
396
399
|
readonly bottom: number;
|
|
397
400
|
};
|
|
398
401
|
readonly body: readonly LaidOutLine[];
|
|
402
|
+
/** Bottom of the centred body block (`bodyBlockTop + lines * lineBoxHeight`). */
|
|
399
403
|
readonly bodyBottom: number;
|
|
400
404
|
/** Present only when `footer` is set: exactly one rule (§5.4, DH-04). */
|
|
401
405
|
readonly ruleY?: number;
|
|
@@ -661,8 +661,10 @@ export function layoutCard(props, measure) {
|
|
|
661
661
|
const subtitleMeasure = g.width - 2 * (ZONE_GEOMETRY.collapsedInset + ZONE_GEOMETRY.collapsedSubtitleMarginInline);
|
|
662
662
|
const bodyTextX = subtitleMode ? (g.width - subtitleMeasure) / 2 : g.bodyInsetFromBar;
|
|
663
663
|
const bodyWidth = subtitleMode ? subtitleMeasure : contentRight - bodyTextX;
|
|
664
|
-
|
|
665
|
-
|
|
664
|
+
// The body block is centred horizontally inside its box on every card
|
|
665
|
+
// (owner card-body-centring): each line anchors middle at the box centre.
|
|
666
|
+
const bodyAnchor = "middle";
|
|
667
|
+
const bodyLineX = bodyTextX + bodyWidth / 2;
|
|
666
668
|
const wrappedBody = [];
|
|
667
669
|
let detailLines = 0;
|
|
668
670
|
for (const [bodyIndex, line] of props.body.entries()) {
|
|
@@ -700,11 +702,11 @@ export function layoutCard(props, measure) {
|
|
|
700
702
|
const bodyAreaBottom = ruleY === undefined ? g.height - g.borderWidth - g.padding : ruleY - g.ruleMargin;
|
|
701
703
|
const bodyBudget = Math.max(0, Math.floor((bodyAreaBottom - bodyY) / bodyHeight));
|
|
702
704
|
const bodyTexts = fitSlot(bodySourceText, "body", bodyWidth, bodyBudget, bodySlot);
|
|
703
|
-
//
|
|
704
|
-
// (
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
705
|
+
// The line block is centred vertically inside the remaining body area on
|
|
706
|
+
// every card (owner card-body-centring) — leaf lines exactly like the
|
|
707
|
+
// collapsed-zone subtitle (§6.2.1). A block that fills the area keeps the
|
|
708
|
+
// top-aligned baselines; a shorter block drops by half the spare space.
|
|
709
|
+
const bodyBlockTop = bodyY + Math.max(0, (bodyAreaBottom - bodyY - bodyTexts.length * bodyHeight) / 2);
|
|
708
710
|
const detailStart = wrappedBody.length - detailLines;
|
|
709
711
|
const body = bodyTexts.map((text, index) => ({
|
|
710
712
|
text,
|
|
@@ -715,7 +717,7 @@ export function layoutCard(props, measure) {
|
|
|
715
717
|
secondary: !subtitleMode && index >= detailStart && (props.detailCount ?? 0) > 0,
|
|
716
718
|
anchor: bodyAnchor,
|
|
717
719
|
}));
|
|
718
|
-
const bodyBottom =
|
|
720
|
+
const bodyBottom = bodyBlockTop + bodyTexts.length * bodyHeight;
|
|
719
721
|
const kicker = kickerTexts.map((text, index) => ({
|
|
720
722
|
text,
|
|
721
723
|
x: headerLineX,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/diagram-canvas",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Headless diagram scenes, layout, hit testing and pure presentation models/SVG helpers. No DOM or framework.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"main": "./dist/index.js",
|
|
58
58
|
"sideEffects": false,
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@sentropic/diagram-core": "0.
|
|
60
|
+
"@sentropic/diagram-core": "0.3.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "node ../../scripts/sync-diagram-spacing.mjs && tsc -p tsconfig.json",
|