@diagrammo/dgmo 0.45.0 → 0.47.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/advanced.cjs +31 -25
- package/dist/advanced.d.cts +3 -855
- package/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70101
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.cjs +500 -341
- package/dist/auto.css +342 -159
- package/dist/auto.d.cts +10 -8
- package/dist/auto.d.ts +10 -8
- package/dist/auto.js +373 -265
- package/dist/auto.mjs +500 -341
- package/dist/block.cjs +31 -25
- package/dist/block.js +83 -69411
- package/dist/calculator-LDYQCDDY.js +11 -0
- package/dist/charts-d3-QOZHKTCT.js +25 -0
- package/dist/chunk-2DXMZRWJ.js +800 -0
- package/dist/chunk-2LACINWN.js +786 -0
- package/dist/chunk-33LCUH4H.js +893 -0
- package/dist/chunk-3CIOJ5YJ.js +35 -0
- package/dist/chunk-3HDBAXF5.js +86 -0
- package/dist/chunk-3JLKYGBQ.js +290 -0
- package/dist/chunk-3MQQNXPD.js +415 -0
- package/dist/chunk-3R5POCTZ.js +967 -0
- package/dist/chunk-3SMGIJDD.js +112 -0
- package/dist/chunk-44CM72SQ.js +409 -0
- package/dist/chunk-4GRI7MEB.js +1604 -0
- package/dist/chunk-4OHACBGX.js +606 -0
- package/dist/chunk-5DH3KYFH.js +21 -0
- package/dist/chunk-5MLYVTYM.js +76 -0
- package/dist/chunk-5QXL4NYS.js +553 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EK55ART.js +117 -0
- package/dist/chunk-6FZYCKXB.js +2065 -0
- package/dist/chunk-6HO5ZTXK.js +277 -0
- package/dist/chunk-6KFWC4CO.js +7 -0
- package/dist/chunk-6MTWIQVO.js +121 -0
- package/dist/chunk-6NYWYNBI.js +329 -0
- package/dist/chunk-6SM5NJQH.js +620 -0
- package/dist/chunk-725LDASD.js +422 -0
- package/dist/chunk-76OWZ3BA.js +130 -0
- package/dist/chunk-7JEGTRLD.js +338 -0
- package/dist/chunk-A44USUV7.js +923 -0
- package/dist/chunk-A4GOY3PE.js +25 -0
- package/dist/chunk-A4VFQH5G.js +251 -0
- package/dist/chunk-AELOBFW5.js +375 -0
- package/dist/chunk-AN2MOO5T.js +522 -0
- package/dist/chunk-BMR4CIEO.js +41 -0
- package/dist/chunk-BS7SV7C3.js +51 -0
- package/dist/chunk-BUPDIHML.js +613 -0
- package/dist/chunk-BUVJFRPY.js +887 -0
- package/dist/chunk-C3Z4DX3V.js +112 -0
- package/dist/chunk-CI2G3OEB.js +1818 -0
- package/dist/chunk-CKNVO24D.js +54 -0
- package/dist/chunk-CUVHQHZ7.js +391 -0
- package/dist/chunk-CXK4DZH3.js +114 -0
- package/dist/chunk-DKEPS5LH.js +315 -0
- package/dist/chunk-DU7W62N5.js +487 -0
- package/dist/chunk-DZAQBW35.js +751 -0
- package/dist/chunk-EB6FPQUP.js +316 -0
- package/dist/chunk-EMS2SK26.js +376 -0
- package/dist/chunk-ERLBPDGU.js +510 -0
- package/dist/chunk-EVCVDTXE.js +732 -0
- package/dist/chunk-FCIIHT24.js +384 -0
- package/dist/chunk-FFUN5D66.js +97 -0
- package/dist/chunk-FITOLXSX.js +714 -0
- package/dist/chunk-FMDSF3OV.js +68 -0
- package/dist/chunk-FNB3PNGF.js +410 -0
- package/dist/chunk-G2H74XJZ.js +2104 -0
- package/dist/chunk-GMR5MFHJ.js +339 -0
- package/dist/chunk-H6PI3KJT.js +305 -0
- package/dist/chunk-I46X5VUA.js +59 -0
- package/dist/chunk-I5IGB56C.js +255 -0
- package/dist/chunk-IH6ZMVQ5.js +3950 -0
- package/dist/chunk-IJZFN3HM.js +463 -0
- package/dist/chunk-IPWPWM6R.js +3079 -0
- package/dist/chunk-IYULMRBE.js +23 -0
- package/dist/chunk-IZMRON6C.js +167 -0
- package/dist/chunk-J5FIXQRT.js +813 -0
- package/dist/chunk-JED6ZDEE.js +73 -0
- package/dist/chunk-JEUJOX5X.js +136 -0
- package/dist/chunk-JM4LEPY3.js +436 -0
- package/dist/chunk-L3UHP6TD.js +101 -0
- package/dist/chunk-L66GEFB6.js +524 -0
- package/dist/chunk-LIOHW36Z.js +469 -0
- package/dist/chunk-LP7EC4MI.js +16 -0
- package/dist/chunk-MITI6NOL.js +548 -0
- package/dist/chunk-MO5YHHMQ.js +168 -0
- package/dist/chunk-MZSBFAPJ.js +885 -0
- package/dist/chunk-NNAAJVBU.js +9 -0
- package/dist/chunk-NOTA6TEI.js +47 -0
- package/dist/chunk-NURGB5Z4.js +335 -0
- package/dist/chunk-NX4EQS3U.js +1062 -0
- package/dist/chunk-NXMESY4J.js +1 -0
- package/dist/chunk-OJR3MQYV.js +1458 -0
- package/dist/chunk-OURHMODR.js +454 -0
- package/dist/chunk-P235SVAH.js +1057 -0
- package/dist/chunk-P4RH4OSP.js +1038 -0
- package/dist/chunk-P6T66CCZ.js +226 -0
- package/dist/chunk-PBAHEPLQ.js +223 -0
- package/dist/chunk-PBHE5UG6.js +1530 -0
- package/dist/chunk-PDKUANDZ.js +35 -0
- package/dist/chunk-PWIHZ6NJ.js +296 -0
- package/dist/chunk-QEBUY5NY.js +1685 -0
- package/dist/chunk-QLCCJEJI.js +253 -0
- package/dist/chunk-QOOUC2J5.js +52 -0
- package/dist/chunk-QYTPPDAO.js +402 -0
- package/dist/chunk-R3XI2VC7.js +801 -0
- package/dist/chunk-RCERWOJR.js +154 -0
- package/dist/chunk-RJE5JTVK.js +362 -0
- package/dist/chunk-RTLBSQ3G.js +1155 -0
- package/dist/chunk-RUNNI6VE.js +448 -0
- package/dist/chunk-RVMRZAPB.js +354 -0
- package/dist/chunk-RYEGFMUO.js +955 -0
- package/dist/chunk-RZCF2VVM.js +528 -0
- package/dist/chunk-SML67VPV.js +1025 -0
- package/dist/chunk-SQ7IY53Q.js +44 -0
- package/dist/chunk-SQAG3UXH.js +161 -0
- package/dist/chunk-SRTU6HMQ.js +1851 -0
- package/dist/chunk-T2OE3YQB.js +550 -0
- package/dist/chunk-T3UBLACL.js +299 -0
- package/dist/chunk-TLVIHFRO.js +296 -0
- package/dist/chunk-TYS6CSS5.js +52 -0
- package/dist/chunk-U6EQI3U6.js +130 -0
- package/dist/chunk-UJ4FJLBF.js +86 -0
- package/dist/chunk-ULOEATBZ.js +347 -0
- package/dist/chunk-UNCCZ3NU.js +127 -0
- package/dist/chunk-USZW2HHU.js +197 -0
- package/dist/chunk-UWN33VNX.js +1610 -0
- package/dist/chunk-UZ7EZW3B.js +40 -0
- package/dist/chunk-VOKGH627.js +37 -0
- package/dist/chunk-WBRZJOEC.js +204 -0
- package/dist/chunk-WCSOJFU3.js +380 -0
- package/dist/chunk-WCT3NYCV.js +160 -0
- package/dist/chunk-WVAJFAIA.js +529 -0
- package/dist/chunk-X5LCYCL5.js +394 -0
- package/dist/chunk-XAKEUMEJ.js +1256 -0
- package/dist/chunk-Y2ZE3MSG.js +590 -0
- package/dist/chunk-Y3J7VR52.js +646 -0
- package/dist/chunk-Y5QGVTVC.js +33 -0
- package/dist/chunk-YAA6IID3.js +548 -0
- package/dist/chunk-YGJTDXVR.js +692 -0
- package/dist/chunk-YRYKTYMQ.js +186 -0
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/dist/chunk-Z72XRXD4.js +787 -0
- package/dist/chunk-ZGR7ULFJ.js +978 -0
- package/dist/chunk-ZJEL4H2R.js +851 -0
- package/dist/chunk-ZO27FGJS.js +554 -0
- package/dist/cli.cjs +112 -112
- package/dist/collapse-CLPJD2RL.js +11 -0
- package/dist/collapse-SLINJQW6.js +9 -0
- package/dist/collapse-ZWUFFCK2.js +9 -0
- package/dist/compute-G55RG53N.js +8 -0
- package/dist/dgmo-router-DZCIDUO5.js +73 -0
- package/dist/dimensions-J3FHIMJ6.js +22 -0
- package/dist/element.cjs +492 -325
- package/dist/element.js +367 -259
- package/dist/element.mjs +492 -325
- package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
- package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
- package/dist/index.cjs +34 -28
- package/dist/index.d.cts +3 -469
- package/dist/index.d.ts +3 -469
- package/dist/index.js +137 -69679
- package/dist/layout-46N4JJYK.js +17 -0
- package/dist/layout-5RA6QWR6.js +26 -0
- package/dist/layout-5T6RH5M6.js +14 -0
- package/dist/layout-7QXCNOVS.js +13 -0
- package/dist/layout-EE6GE46Y.js +17 -0
- package/dist/layout-G23F7LDH.js +9 -0
- package/dist/layout-HRBZPFCN.js +23 -0
- package/dist/layout-HWDSRX5E.js +20 -0
- package/dist/layout-HYZPWAK5.js +18 -0
- package/dist/layout-N76NR4ZO.js +19 -0
- package/dist/layout-OB3RI63S.js +14 -0
- package/dist/layout-S2QBYSK2.js +15 -0
- package/dist/layout-UM5F4DJB.js +15 -0
- package/dist/layout-search-OYV77HHS.js +1655 -0
- package/dist/load-data-EHDDZ5ZS.js +8 -0
- package/dist/palettes-PRJ2RI6D.js +56 -0
- package/dist/parser-2MFP2H2E.js +11 -0
- package/dist/parser-3STE62GB.js +21 -0
- package/dist/parser-4FL2CMDG.js +18 -0
- package/dist/parser-4OGOBJJ4.js +13 -0
- package/dist/parser-6BTRLKRZ.js +15 -0
- package/dist/parser-AQETEVRW.js +21 -0
- package/dist/parser-CFZD5IBL.js +12 -0
- package/dist/parser-FUSKFGZN.js +16 -0
- package/dist/parser-I6KXEYFK.js +13 -0
- package/dist/parser-IXSZZQHY.js +18 -0
- package/dist/parser-JAL2HD4I.js +13 -0
- package/dist/parser-KNSQSKQO.js +20 -0
- package/dist/parser-N5O4IHUN.js +13 -0
- package/dist/parser-NGU3ETO6.js +16 -0
- package/dist/parser-NRAI6O25.js +19 -0
- package/dist/parser-O5J4VBII.js +11 -0
- package/dist/parser-OV7NOBW6.js +21 -0
- package/dist/parser-PQ3POX45.js +23 -0
- package/dist/parser-TFZFBVWN.js +11 -0
- package/dist/parser-TRTHDFPP.js +18 -0
- package/dist/parser-VQP2UJ6W.js +11 -0
- package/dist/parser-XDVELHRK.js +13 -0
- package/dist/parser-XKRP7QKP.js +11 -0
- package/dist/parser-Y6WTBU76.js +14 -0
- package/dist/parser-ZSDPZYQP.js +12 -0
- package/dist/renderer-2XQQQ6QR.js +28 -0
- package/dist/renderer-5NDVNDAZ.js +26 -0
- package/dist/renderer-6EEZHMH4.js +26 -0
- package/dist/renderer-6W5462RB.js +43 -0
- package/dist/renderer-7MVLWWQD.js +22 -0
- package/dist/renderer-AWWAF6XD.js +33 -0
- package/dist/renderer-BYCNMBF7.js +34 -0
- package/dist/renderer-CLJHQPBJ.js +29 -0
- package/dist/renderer-GHPZMFU2.js +15 -0
- package/dist/renderer-JGBKUCZD.js +16 -0
- package/dist/renderer-KQB7UGDS.js +19 -0
- package/dist/renderer-PGX2TKVS.js +24 -0
- package/dist/renderer-QIWVHWZO.js +15 -0
- package/dist/renderer-RPOA5YPZ.js +35 -0
- package/dist/renderer-SMIBCRVB.js +24 -0
- package/dist/renderer-T7YKC5VP.js +28 -0
- package/dist/renderer-TOCOVLHS.js +37 -0
- package/dist/renderer-UWA5XS74.js +39 -0
- package/dist/renderer-VACVQYML.js +25 -0
- package/dist/renderer-W4M6QLIJ.js +37 -0
- package/dist/renderer-WZRREQ2P.js +23 -0
- package/dist/renderer-YY2OSF6E.js +27 -0
- package/dist/renderer-Z7I3W2PP.js +24 -0
- package/dist/renderer-ZGNTUWC4.js +22 -0
- package/dist/renderer-ZTR3DER3.js +19 -0
- package/dist/renderer-radial-C32GPJQ7.js +21 -0
- package/dist/resolver-NOAA7ID7.js +13 -0
- package/dist/state-collapse-HCGD6IVJ.js +8 -0
- package/dist/state-parser-Z2V23ATR.js +18 -0
- package/dist/state-renderer-RFYHSP4K.js +34 -0
- package/dist/themes-1-CuKpeH.d.cts +908 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +1 -1
- package/src/auto/index.ts +55 -57
- package/src/auto/shared.ts +142 -142
- package/src/auto/styles.ts +44 -199
- package/src/c4/renderer.ts +2 -2
- package/src/element/index.ts +29 -21
- package/src/infra/renderer.ts +1 -1
- package/src/render.ts +34 -14
- package/src/sitemap/renderer.ts +1 -1
- package/src/timeline/renderer.ts +1 -1
- package/src/utils/hover-styles.ts +6 -1
- package/src/utils/legend-d3.ts +1 -4
- package/src/utils/legend-svg.ts +1 -1
package/src/auto/styles.ts
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Static CSS for `@diagrammo/dgmo/auto
|
|
2
|
+
* Static CSS for `@diagrammo/dgmo/auto` (and `./element`, which shares the
|
|
3
|
+
* same injector).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* As of BL-114 the diagram + source chrome is the canonical standard block
|
|
6
|
+
* from `src/embed` — its styles ship in `BLOCK_CSS` and are appended below.
|
|
7
|
+
* This file only keeps the auto-surface-specific rules: anti-flash hiding,
|
|
8
|
+
* the `.dgmo-rendered` container reset, and the loading hint.
|
|
9
|
+
*
|
|
10
|
+
* `BLOCK_CSS` keys its dark-mode overrides off `[data-theme="dark"]`; the
|
|
11
|
+
* browser surfaces resolve the theme themselves and stamp a
|
|
12
|
+
* `.dgmo-theme-dark` class on the wrapper, so a re-scoped copy of the dark
|
|
13
|
+
* rules is appended too (same adapter pattern as fumadocs/nextra's
|
|
14
|
+
* build-css.mjs, done here at module init).
|
|
8
15
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
16
|
+
* The string is a literal — no template interpolation of user-supplied
|
|
17
|
+
* values. All selectors are prefixed `.dgmo-` to avoid collisions with
|
|
18
|
+
* embedder styles. Class names are part of the SemVer-stable surface — see
|
|
11
19
|
* "SemVer policy" in the README HTML section.
|
|
20
|
+
*
|
|
21
|
+
* IMPORTANT: keep AUTO_BASE_CSS a single pure template literal — tsup's
|
|
22
|
+
* emitAutoCss extracts it (plus BLOCK_CSS) with a regex to build
|
|
23
|
+
* `dist/auto.css`, mirroring the concatenation done at the bottom of this
|
|
24
|
+
* file. Update tsup.config.ts if the assembly here changes.
|
|
12
25
|
*/
|
|
13
|
-
|
|
26
|
+
|
|
27
|
+
import { BLOCK_CSS } from '../embed/css';
|
|
28
|
+
|
|
29
|
+
const AUTO_BASE_CSS: string = `
|
|
14
30
|
/* anti-flash: hide source elements until either render swaps them out
|
|
15
|
-
or the error path
|
|
31
|
+
or the error path replaces them with the standard error card */
|
|
16
32
|
pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
|
|
17
|
-
.dgmo:not(svg *):not(.dgmo-rendered):not(.dgmo-rendered *) {
|
|
33
|
+
.dgmo:not(svg *):not(.dgmo-rendered):not(.dgmo-rendered *):not(.dgmo--error):not(.dgmo--error *) {
|
|
18
34
|
visibility: hidden;
|
|
19
35
|
}
|
|
20
36
|
.dgmo-rendered, .dgmo-rendered *,
|
|
21
|
-
.dgmo
|
|
37
|
+
.dgmo--error, .dgmo--error * {
|
|
22
38
|
visibility: visible !important;
|
|
23
39
|
}
|
|
24
40
|
|
|
@@ -32,197 +48,26 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
|
|
|
32
48
|
line-height: 1.4;
|
|
33
49
|
color-scheme: light dark;
|
|
34
50
|
}
|
|
35
|
-
.dgmo-rendered svg {
|
|
36
|
-
display: block;
|
|
37
|
-
max-width: 100%;
|
|
38
|
-
height: auto;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.dgmo-source-panel {
|
|
42
|
-
margin-top: 4px;
|
|
43
|
-
position: relative;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.dgmo-source-toggle {
|
|
47
|
-
display: inline-flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
gap: 4px;
|
|
50
|
-
/* Visual size is small; the 28px hit area + padding still meets
|
|
51
|
-
the 44 × 44 minimum touch target across most stylesheets, and
|
|
52
|
-
we widen padding on coarse pointers below. */
|
|
53
|
-
min-height: 28px;
|
|
54
|
-
padding: 4px 6px;
|
|
55
|
-
background: transparent;
|
|
56
|
-
border: 0;
|
|
57
|
-
font: inherit;
|
|
58
|
-
font-size: 11px;
|
|
59
|
-
font-weight: 500;
|
|
60
|
-
letter-spacing: 0.02em;
|
|
61
|
-
text-align: left;
|
|
62
|
-
cursor: pointer;
|
|
63
|
-
color: inherit;
|
|
64
|
-
opacity: 0.45;
|
|
65
|
-
border-radius: 3px;
|
|
66
|
-
transition: opacity 120ms ease, background 120ms ease;
|
|
67
|
-
}
|
|
68
|
-
.dgmo-source-toggle:hover {
|
|
69
|
-
opacity: 0.85;
|
|
70
|
-
background: rgba(127, 127, 127, 0.08);
|
|
71
|
-
}
|
|
72
|
-
.dgmo-source-toggle:focus-visible {
|
|
73
|
-
opacity: 1;
|
|
74
|
-
outline: 2px solid currentColor;
|
|
75
|
-
outline-offset: 1px;
|
|
76
|
-
}
|
|
77
|
-
.dgmo-source-toggle[aria-expanded="true"] {
|
|
78
|
-
opacity: 0.7;
|
|
79
|
-
}
|
|
80
|
-
.dgmo-source-toggle .dgmo-chevron {
|
|
81
|
-
display: inline-block;
|
|
82
|
-
width: 8px;
|
|
83
|
-
height: 8px;
|
|
84
|
-
font-size: 8px;
|
|
85
|
-
line-height: 1;
|
|
86
|
-
transition: transform 150ms ease-out;
|
|
87
|
-
}
|
|
88
|
-
.dgmo-source-toggle[aria-expanded="true"] .dgmo-chevron {
|
|
89
|
-
transform: rotate(90deg);
|
|
90
|
-
}
|
|
91
|
-
@media (pointer: coarse) {
|
|
92
|
-
/* Larger hit area on touch devices without making the visible
|
|
93
|
-
toggle bigger on the desktop. */
|
|
94
|
-
.dgmo-source-toggle {
|
|
95
|
-
min-height: 44px;
|
|
96
|
-
padding: 12px 10px;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.dgmo-source-body {
|
|
101
|
-
overflow: hidden;
|
|
102
|
-
max-height: 0;
|
|
103
|
-
transition: max-height 150ms ease-out;
|
|
104
|
-
position: relative;
|
|
105
|
-
}
|
|
106
|
-
.dgmo-source-body.dgmo-open {
|
|
107
|
-
max-height: 60vh;
|
|
108
|
-
overflow: auto;
|
|
109
|
-
margin-top: 2px;
|
|
110
|
-
border-radius: 4px;
|
|
111
|
-
background: rgba(127, 127, 127, 0.04);
|
|
112
|
-
}
|
|
113
|
-
.dgmo-rendered.dgmo-theme-dark .dgmo-source-body.dgmo-open {
|
|
114
|
-
background: rgba(255, 255, 255, 0.03);
|
|
115
|
-
}
|
|
116
|
-
.dgmo-source-pre {
|
|
117
|
-
margin: 0;
|
|
118
|
-
/* Right padding leaves room for the floating action icons. */
|
|
119
|
-
padding: 10px 56px 10px 14px;
|
|
120
|
-
font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
|
121
|
-
font-size: 12px;
|
|
122
|
-
line-height: 1.45;
|
|
123
|
-
white-space: pre;
|
|
124
|
-
overflow: auto;
|
|
125
|
-
background: transparent;
|
|
126
|
-
color: inherit;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.dgmo-source-actions {
|
|
130
|
-
position: absolute;
|
|
131
|
-
top: 6px;
|
|
132
|
-
right: 6px;
|
|
133
|
-
display: flex;
|
|
134
|
-
gap: 2px;
|
|
135
|
-
/* Inherit visibility:hidden when collapsed; pointer-events:none keeps
|
|
136
|
-
them off the tab order until the panel opens. */
|
|
137
|
-
pointer-events: none;
|
|
138
|
-
}
|
|
139
|
-
.dgmo-source-body.dgmo-open .dgmo-source-actions {
|
|
140
|
-
pointer-events: auto;
|
|
141
|
-
}
|
|
142
|
-
.dgmo-btn {
|
|
143
|
-
display: inline-flex;
|
|
144
|
-
align-items: center;
|
|
145
|
-
justify-content: center;
|
|
146
|
-
width: 26px;
|
|
147
|
-
height: 26px;
|
|
148
|
-
padding: 0;
|
|
149
|
-
background: transparent;
|
|
150
|
-
color: inherit;
|
|
151
|
-
border: 0;
|
|
152
|
-
border-radius: 3px;
|
|
153
|
-
cursor: pointer;
|
|
154
|
-
text-decoration: none;
|
|
155
|
-
opacity: 0.4;
|
|
156
|
-
transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
|
|
157
|
-
}
|
|
158
|
-
.dgmo-btn:hover {
|
|
159
|
-
opacity: 1;
|
|
160
|
-
background: rgba(127, 127, 127, 0.15);
|
|
161
|
-
}
|
|
162
|
-
.dgmo-btn:focus-visible {
|
|
163
|
-
opacity: 1;
|
|
164
|
-
outline: 2px solid currentColor;
|
|
165
|
-
outline-offset: 1px;
|
|
166
|
-
}
|
|
167
|
-
.dgmo-btn[aria-disabled="true"] {
|
|
168
|
-
opacity: 0.25;
|
|
169
|
-
cursor: not-allowed;
|
|
170
|
-
}
|
|
171
|
-
.dgmo-btn[aria-disabled="true"]:hover {
|
|
172
|
-
background: transparent;
|
|
173
|
-
}
|
|
174
|
-
.dgmo-btn-copied {
|
|
175
|
-
opacity: 1 !important;
|
|
176
|
-
color: rgb(120, 200, 120);
|
|
177
|
-
}
|
|
178
|
-
.dgmo-btn svg {
|
|
179
|
-
width: 14px;
|
|
180
|
-
height: 14px;
|
|
181
|
-
display: block;
|
|
182
|
-
}
|
|
183
51
|
|
|
184
|
-
.dgmo
|
|
185
|
-
|
|
186
|
-
margin: 0.5em 0;
|
|
187
|
-
padding: 10px 14px;
|
|
188
|
-
border-left: 4px solid #c44;
|
|
189
|
-
background: rgba(204, 68, 68, 0.08);
|
|
190
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
191
|
-
font-size: 13px;
|
|
192
|
-
line-height: 1.4;
|
|
193
|
-
color: inherit;
|
|
194
|
-
border-radius: 0 4px 4px 0;
|
|
195
|
-
}
|
|
196
|
-
.dgmo-error-banner-title {
|
|
197
|
-
font-weight: 600;
|
|
198
|
-
margin-bottom: 2px;
|
|
199
|
-
}
|
|
200
|
-
.dgmo-error-banner-loc {
|
|
201
|
-
opacity: 0.7;
|
|
52
|
+
.dgmo--loading {
|
|
53
|
+
opacity: 0.6;
|
|
202
54
|
font-size: 12px;
|
|
203
55
|
font-family: ui-monospace, monospace;
|
|
204
56
|
}
|
|
57
|
+
`;
|
|
205
58
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.
|
|
211
|
-
.
|
|
212
|
-
|
|
213
|
-
.dgmo-source-pre .dgmo-tok-number { color: #b48ead; }
|
|
214
|
-
.dgmo-source-pre .dgmo-tok-comment { color: #6c7a96; font-style: italic; }
|
|
215
|
-
.dgmo-source-pre .dgmo-tok-heading { color: #d08770; font-weight: 600; }
|
|
216
|
-
.dgmo-source-pre .dgmo-tok-bracket { color: #5e81ac; }
|
|
217
|
-
.dgmo-source-pre .dgmo-tok-separator { color: #88c0d0; }
|
|
218
|
-
.dgmo-source-pre .dgmo-tok-url { color: #88c0d0; text-decoration: underline; }
|
|
219
|
-
.dgmo-source-pre .dgmo-tok-colorAnnotation { color: #d08770; font-style: italic; }
|
|
220
|
-
.dgmo-source-pre .dgmo-tok-punctuation { color: #6c7a96; }
|
|
221
|
-
.dgmo-source-pre .dgmo-tok-noteContent { color: #6c7a96; font-style: italic; }
|
|
59
|
+
/** Re-scope BLOCK_CSS's \`[data-theme="dark"]\` rules to `.dgmo-theme-dark`. */
|
|
60
|
+
function darkScopedBlockCss(css: string): string {
|
|
61
|
+
const rules = css.match(/\[data-theme="dark"\][^{]*\{[^}]*\}/g) ?? [];
|
|
62
|
+
return rules
|
|
63
|
+
.map((rule) => rule.replace(/\[data-theme="dark"\]/g, '.dgmo-theme-dark'))
|
|
64
|
+
.join('\n');
|
|
65
|
+
}
|
|
222
66
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
67
|
+
export const CSS: string =
|
|
68
|
+
AUTO_BASE_CSS +
|
|
69
|
+
'\n' +
|
|
70
|
+
BLOCK_CSS +
|
|
71
|
+
'\n' +
|
|
72
|
+
darkScopedBlockCss(BLOCK_CSS) +
|
|
73
|
+
'\n';
|
package/src/c4/renderer.ts
CHANGED
|
@@ -622,7 +622,7 @@ export function renderC4Context(
|
|
|
622
622
|
.attr('transform', `translate(0, ${DIAGRAM_PADDING + titleHeight})`)
|
|
623
623
|
: contentG.append('g').attr('class', 'c4-legend');
|
|
624
624
|
if (activeTagGroup) {
|
|
625
|
-
legendParent.attr('data-legend-active', activeTagGroup
|
|
625
|
+
legendParent.attr('data-legend-active', tagAttrKey(activeTagGroup));
|
|
626
626
|
}
|
|
627
627
|
renderLegend(
|
|
628
628
|
legendParent as GSelection,
|
|
@@ -1804,7 +1804,7 @@ export function renderC4Containers(
|
|
|
1804
1804
|
.attr('transform', `translate(0, ${DIAGRAM_PADDING + titleHeight})`)
|
|
1805
1805
|
: contentG.append('g').attr('class', 'c4-legend');
|
|
1806
1806
|
if (activeTagGroup) {
|
|
1807
|
-
legendParent.attr('data-legend-active', activeTagGroup
|
|
1807
|
+
legendParent.attr('data-legend-active', tagAttrKey(activeTagGroup));
|
|
1808
1808
|
}
|
|
1809
1809
|
renderLegend(
|
|
1810
1810
|
legendParent as GSelection,
|
package/src/element/index.ts
CHANGED
|
@@ -45,8 +45,8 @@ import {
|
|
|
45
45
|
resolveTheme,
|
|
46
46
|
sanitizeSvgInPlace,
|
|
47
47
|
deriveAriaLabel,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
buildRenderedBlock,
|
|
49
|
+
buildErrorBlock,
|
|
50
50
|
buildShareUrl,
|
|
51
51
|
sharedWarn,
|
|
52
52
|
type ThemePreference,
|
|
@@ -275,7 +275,9 @@ export class DgmoDiagram extends HTMLElement {
|
|
|
275
275
|
line?: number;
|
|
276
276
|
column?: number;
|
|
277
277
|
}): void {
|
|
278
|
-
|
|
278
|
+
// The standard error card carries `.dgmo.dgmo--error` on its own root,
|
|
279
|
+
// so the container itself stays class-free.
|
|
280
|
+
this.mount(buildErrorBlock({ ...opts, source: this.source ?? '' }), '');
|
|
279
281
|
}
|
|
280
282
|
|
|
281
283
|
private async rerender(): Promise<void> {
|
|
@@ -289,9 +291,8 @@ export class DgmoDiagram extends HTMLElement {
|
|
|
289
291
|
|
|
290
292
|
// Loading state (visible only while an async render/fetch is in flight).
|
|
291
293
|
const loading = document.createElement('div');
|
|
292
|
-
loading.className = 'dgmo-error-banner-loc';
|
|
293
294
|
loading.textContent = 'Rendering diagram…';
|
|
294
|
-
this.mount(loading, 'dgmo
|
|
295
|
+
this.mount(loading, 'dgmo--loading');
|
|
295
296
|
|
|
296
297
|
const themePref = this.themePreference();
|
|
297
298
|
const resolvedTheme =
|
|
@@ -382,22 +383,29 @@ export class DgmoDiagram extends HTMLElement {
|
|
|
382
383
|
? 'dgmo-theme-transparent'
|
|
383
384
|
: 'dgmo-theme-light';
|
|
384
385
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
386
|
+
// Showcase chrome: standard embed block (BL-114) with the hover-reveal
|
|
387
|
+
// toolbar (view-source toggle + Copy + Open-in-editor).
|
|
388
|
+
const showcase = this.isShowcase();
|
|
389
|
+
const shareUrl = showcase
|
|
390
|
+
? buildShareUrl(src, {
|
|
391
|
+
palette,
|
|
392
|
+
theme: resolvedTheme === 'dark' ? 'dark' : 'light',
|
|
393
|
+
editorBase: this.editorBase(),
|
|
394
|
+
campaign: VERSION,
|
|
395
|
+
utmSource: 'element-embed',
|
|
396
|
+
})
|
|
397
|
+
: null;
|
|
398
|
+
|
|
399
|
+
const wrapper = buildRenderedBlock({
|
|
400
|
+
source: src,
|
|
401
|
+
svgEl,
|
|
402
|
+
themeClass,
|
|
403
|
+
showSource: showcase,
|
|
404
|
+
showEditorLink: showcase,
|
|
405
|
+
shareUrl,
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
this.mount(wrapper, 'dgmo--rendered');
|
|
401
409
|
}
|
|
402
410
|
}
|
|
403
411
|
|
package/src/infra/renderer.ts
CHANGED
|
@@ -2109,7 +2109,7 @@ function renderLegend(
|
|
|
2109
2109
|
.attr('transform', `translate(0, ${legendY})`);
|
|
2110
2110
|
|
|
2111
2111
|
if (activeGroup) {
|
|
2112
|
-
legendG.attr('data-legend-active', activeGroup
|
|
2112
|
+
legendG.attr('data-legend-active', tagAttrKey(activeGroup));
|
|
2113
2113
|
}
|
|
2114
2114
|
|
|
2115
2115
|
// Build all groups including Playback as a regular group for consistent rendering
|
package/src/render.ts
CHANGED
|
@@ -24,11 +24,29 @@ const DOM_GLOBALS = [
|
|
|
24
24
|
'HTMLElement',
|
|
25
25
|
'SVGElement',
|
|
26
26
|
] as const;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
// The ref-count state lives on `globalThis` under a well-known symbol rather
|
|
28
|
+
// than in module state: dist/index and dist/block are each self-contained
|
|
29
|
+
// bundles, so a host importing both gets two copies of this module. With
|
|
30
|
+
// per-copy state, each copy keeps its own ref-count over the SAME
|
|
31
|
+
// `globalThis.document` — one copy's release tears down globals mid-render of
|
|
32
|
+
// the other. `Symbol.for` puts every copy on one shared count.
|
|
33
|
+
interface DomGlobalsState {
|
|
34
|
+
refCount: number;
|
|
35
|
+
installPromise: Promise<void> | null;
|
|
36
|
+
installedByUs: boolean;
|
|
37
|
+
}
|
|
38
|
+
const DOM_STATE_KEY = Symbol.for('diagrammo.dgmo.dom-globals');
|
|
39
|
+
|
|
40
|
+
function domState(): DomGlobalsState {
|
|
41
|
+
const g = globalThis as { [DOM_STATE_KEY]?: DomGlobalsState };
|
|
42
|
+
return (g[DOM_STATE_KEY] ??= {
|
|
43
|
+
refCount: 0,
|
|
44
|
+
installPromise: null,
|
|
45
|
+
installedByUs: false,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
30
48
|
|
|
31
|
-
async function installDom(): Promise<void> {
|
|
49
|
+
async function installDom(state: DomGlobalsState): Promise<void> {
|
|
32
50
|
const { JSDOM } = await loadJsdom();
|
|
33
51
|
// Concrete URL → non-opaque origin, so host code that touches
|
|
34
52
|
// window.localStorage during a same-process render doesn't throw.
|
|
@@ -49,7 +67,7 @@ async function installDom(): Promise<void> {
|
|
|
49
67
|
configurable: true,
|
|
50
68
|
});
|
|
51
69
|
}
|
|
52
|
-
|
|
70
|
+
state.installedByUs = true;
|
|
53
71
|
}
|
|
54
72
|
|
|
55
73
|
/**
|
|
@@ -58,22 +76,24 @@ async function installDom(): Promise<void> {
|
|
|
58
76
|
* we did not install). Pair every successful call with `releaseDom()`.
|
|
59
77
|
*/
|
|
60
78
|
async function acquireDom(): Promise<void> {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
const state = domState();
|
|
80
|
+
if (typeof document !== 'undefined' && !state.installedByUs) return;
|
|
81
|
+
state.refCount++;
|
|
82
|
+
if (!state.installPromise) state.installPromise = installDom(state);
|
|
83
|
+
await state.installPromise;
|
|
65
84
|
}
|
|
66
85
|
|
|
67
86
|
/** Tear down the jsdom globals once no render is in flight. */
|
|
68
87
|
function releaseDom(): void {
|
|
69
|
-
|
|
70
|
-
if (
|
|
88
|
+
const state = domState();
|
|
89
|
+
if (!state.installedByUs) return;
|
|
90
|
+
if (--state.refCount > 0) return;
|
|
71
91
|
for (const key of DOM_GLOBALS) {
|
|
72
92
|
delete (globalThis as Record<string, unknown>)[key];
|
|
73
93
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
94
|
+
state.installedByUs = false;
|
|
95
|
+
state.installPromise = null;
|
|
96
|
+
state.refCount = 0;
|
|
77
97
|
}
|
|
78
98
|
|
|
79
99
|
/**
|
package/src/sitemap/renderer.ts
CHANGED
|
@@ -663,7 +663,7 @@ export function renderSitemap(
|
|
|
663
663
|
.attr('class', 'sitemap-legend-fixed')
|
|
664
664
|
.attr('transform', `translate(0, ${sDiagramPadding + fixedTitleH})`);
|
|
665
665
|
if (activeTagGroup) {
|
|
666
|
-
legendParent.attr('data-legend-active', activeTagGroup
|
|
666
|
+
legendParent.attr('data-legend-active', tagAttrKey(activeTagGroup));
|
|
667
667
|
}
|
|
668
668
|
renderLegend(
|
|
669
669
|
legendParent,
|
package/src/timeline/renderer.ts
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
// there is no opacity double-up. `render({ bakeHover: false })` opts out.
|
|
26
26
|
// ============================================================
|
|
27
27
|
|
|
28
|
+
import { tagAttrKey } from './tag-groups';
|
|
29
|
+
|
|
28
30
|
/** How a chart's cross-highlight rules are shaped. `self` = self-emphasis only
|
|
29
31
|
* (no cross-highlight — single-series / non-relational charts). */
|
|
30
32
|
export type HoverStrategy = 'enumerated' | 'structural' | 'connection' | 'self';
|
|
@@ -599,7 +601,10 @@ function deriveFromSvg(svg: string, spec: HoverSpec): HoverDerived {
|
|
|
599
601
|
.querySelector('[data-legend-active]')
|
|
600
602
|
?.getAttribute('data-legend-active');
|
|
601
603
|
if (slug) {
|
|
602
|
-
|
|
604
|
+
// Defensive re-slug: legacy SVGs (pre-0.46) carried the raw lowercased
|
|
605
|
+
// group name here, which is not a valid attribute name when the group
|
|
606
|
+
// name contains spaces/parens — querySelectorAll would throw.
|
|
607
|
+
groupAttr = `data-tag-${tagAttrKey(slug)}`;
|
|
603
608
|
} else {
|
|
604
609
|
// Fallback for charts with no legend-active marker (e.g. mindmap): if
|
|
605
610
|
// the marks carry exactly ONE distinct `data-tag-*` group, use it.
|
package/src/utils/legend-d3.ts
CHANGED
|
@@ -74,10 +74,7 @@ export function renderLegendD3(
|
|
|
74
74
|
|
|
75
75
|
// Set active attribute on container
|
|
76
76
|
if (currentState.activeGroup) {
|
|
77
|
-
legendG.attr(
|
|
78
|
-
'data-legend-active',
|
|
79
|
-
currentState.activeGroup.toLowerCase()
|
|
80
|
-
);
|
|
77
|
+
legendG.attr('data-legend-active', tagAttrKey(currentState.activeGroup));
|
|
81
78
|
} else {
|
|
82
79
|
legendG.attr('data-legend-active', null);
|
|
83
80
|
}
|
package/src/utils/legend-svg.ts
CHANGED
|
@@ -180,7 +180,7 @@ export function renderLegendSvg(
|
|
|
180
180
|
|
|
181
181
|
const classAttr = className ? ` class="${esc(className)}"` : '';
|
|
182
182
|
const activeAttr = activeGroup
|
|
183
|
-
? ` data-legend-active="${esc(activeGroup
|
|
183
|
+
? ` data-legend-active="${esc(tagAttrKey(activeGroup))}"`
|
|
184
184
|
: '';
|
|
185
185
|
const svg = `<g${classAttr}${activeAttr}>${parts.join('')}</g>`;
|
|
186
186
|
|