@likec4/core 1.48.0 → 1.49.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.
Files changed (134) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +1012 -0
  2. package/dist/_chunks/Builder.view-element.mjs +2 -3284
  3. package/dist/_chunks/LikeC4Model.d.mts +21 -25
  4. package/dist/_chunks/RichText.mjs +1 -148
  5. package/dist/_chunks/_types.d.mts +1 -5
  6. package/dist/_chunks/_types2.d.mts +2 -4
  7. package/dist/_chunks/assignTagColors.mjs +1 -24
  8. package/dist/_chunks/calcDriftsFromSnapshot.mjs +1 -379
  9. package/dist/_chunks/guards.d.mts +2026 -0
  10. package/dist/_chunks/guards.mjs +4 -0
  11. package/dist/_chunks/index.d.mts +255 -136
  12. package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
  13. package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
  14. package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
  15. package/dist/_chunks/libs/bail.mjs +1 -14
  16. package/dist/_chunks/libs/ccount.mjs +1 -25
  17. package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
  18. package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
  19. package/dist/_chunks/libs/character-entities.mjs +2 -2136
  20. package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
  21. package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
  22. package/dist/_chunks/libs/defu.mjs +1 -42
  23. package/dist/_chunks/libs/devlop.mjs +1 -5
  24. package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
  25. package/dist/_chunks/libs/extend.mjs +1 -77
  26. package/dist/_chunks/libs/graphology-dag.mjs +1 -703
  27. package/dist/_chunks/libs/graphology.mjs +1 -4565
  28. package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
  29. package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
  30. package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
  31. package/dist/_chunks/libs/longest-streak.mjs +1 -30
  32. package/dist/_chunks/libs/markdown-table.mjs +2 -290
  33. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
  34. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
  35. package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
  36. package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
  37. package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
  38. package/dist/_chunks/libs/mnemonist.d.mts +1 -91
  39. package/dist/_chunks/libs/mnemonist.mjs +1 -1978
  40. package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
  41. package/dist/_chunks/libs/ohash.mjs +1 -0
  42. package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
  43. package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
  44. package/dist/_chunks/libs/remark-gfm.mjs +1 -36
  45. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
  46. package/dist/_chunks/libs/remark-parse.mjs +1 -39
  47. package/dist/_chunks/libs/remark-rehype.mjs +1 -171
  48. package/dist/_chunks/libs/remeda.mjs +1 -702
  49. package/dist/_chunks/libs/trough.mjs +1 -158
  50. package/dist/_chunks/libs/unified.mjs +1 -2212
  51. package/dist/_chunks/rolldown-runtime.mjs +1 -42
  52. package/dist/_chunks/{index3.d.mts → theme.d.mts} +15 -13
  53. package/dist/_chunks/{index7.d.mts → to-text.d.mts} +165 -29
  54. package/dist/_chunks/to-text.mjs +1 -0
  55. package/dist/_chunks/vector.d.mts +198 -0
  56. package/dist/_chunks/vector.mjs +1 -0
  57. package/dist/builder/index.d.mts +2 -8
  58. package/dist/builder/index.mjs +1 -662
  59. package/dist/compute-view/index.d.mts +86 -15
  60. package/dist/compute-view/index.mjs +2 -262
  61. package/dist/geometry/index.d.mts +2 -2
  62. package/dist/geometry/index.mjs +1 -3
  63. package/dist/index.d.mts +9 -13
  64. package/dist/index.mjs +1 -27
  65. package/dist/model/index.d.mts +4 -14
  66. package/dist/model/index.mjs +1 -11
  67. package/dist/styles/index.d.mts +2 -8
  68. package/dist/styles/index.mjs +1 -30
  69. package/dist/types/index.d.mts +3 -9
  70. package/dist/types/index.mjs +1 -15
  71. package/dist/utils/graphology/index.d.mts +1 -1
  72. package/dist/utils/graphology/index.mjs +1 -3
  73. package/dist/utils/index.d.mts +4 -11
  74. package/dist/utils/index.mjs +1 -17
  75. package/package.json +13 -12
  76. package/dist/_chunks/LikeC4Styles.mjs +0 -691
  77. package/dist/_chunks/RichText.d.mts +0 -84
  78. package/dist/_chunks/_aux.d.mts +0 -289
  79. package/dist/_chunks/_aux.mjs +0 -18
  80. package/dist/_chunks/connection.mjs +0 -0
  81. package/dist/_chunks/const.d.mts +0 -43
  82. package/dist/_chunks/const.mjs +0 -33
  83. package/dist/_chunks/expression-model.d.mts +0 -192
  84. package/dist/_chunks/expression-model.mjs +0 -103
  85. package/dist/_chunks/expression.d.mts +0 -347
  86. package/dist/_chunks/expression.mjs +0 -107
  87. package/dist/_chunks/find.d.mts +0 -82
  88. package/dist/_chunks/find.mjs +0 -646
  89. package/dist/_chunks/find2.d.mts +0 -78
  90. package/dist/_chunks/find2.mjs +0 -287
  91. package/dist/_chunks/fqnRef.d.mts +0 -58
  92. package/dist/_chunks/fqnRef.mjs +0 -41
  93. package/dist/_chunks/geometry.mjs +0 -335
  94. package/dist/_chunks/index2.d.mts +0 -937
  95. package/dist/_chunks/index4.d.mts +0 -62
  96. package/dist/_chunks/index5.d.mts +0 -42
  97. package/dist/_chunks/index6.d.mts +0 -43
  98. package/dist/_chunks/index8.d.mts +0 -144
  99. package/dist/_chunks/invariant.mjs +0 -18
  100. package/dist/_chunks/iterable.mjs +0 -146
  101. package/dist/_chunks/libs/graphology-types.d.mts +0 -601
  102. package/dist/_chunks/libs/graphology.d.mts +0 -6
  103. package/dist/_chunks/mnemonist.d.mts +0 -1
  104. package/dist/_chunks/mnemonist.mjs +0 -0
  105. package/dist/_chunks/model.mjs +0 -1898
  106. package/dist/_chunks/model2.mjs +0 -0
  107. package/dist/_chunks/relationships-view.mjs +0 -132
  108. package/dist/_chunks/scalar.d.mts +0 -109
  109. package/dist/_chunks/scalar.mjs +0 -84
  110. package/dist/_chunks/utils.mjs +0 -483
  111. package/dist/compute-view/relationships-view/index.d.mts +0 -16
  112. package/dist/compute-view/relationships-view/index.mjs +0 -7
  113. package/dist/model/connection/deployment/index.d.mts +0 -12
  114. package/dist/model/connection/deployment/index.mjs +0 -9
  115. package/dist/model/connection/index.d.mts +0 -14
  116. package/dist/model/connection/index.mjs +0 -10
  117. package/dist/model/connection/model/index.d.mts +0 -12
  118. package/dist/model/connection/model/index.mjs +0 -8
  119. package/dist/types/RichText.d.mts +0 -3
  120. package/dist/types/RichText.mjs +0 -7
  121. package/dist/types/_aux.d.mts +0 -3
  122. package/dist/types/_aux.mjs +0 -3
  123. package/dist/types/expression-model.d.mts +0 -6
  124. package/dist/types/expression-model.mjs +0 -7
  125. package/dist/types/expression.d.mts +0 -5
  126. package/dist/types/expression.mjs +0 -7
  127. package/dist/types/fqnRef.d.mts +0 -4
  128. package/dist/types/fqnRef.mjs +0 -7
  129. package/dist/types/scalar.d.mts +0 -2
  130. package/dist/types/scalar.mjs +0 -7
  131. package/dist/utils/iterable/index.d.mts +0 -9
  132. package/dist/utils/iterable/index.mjs +0 -3
  133. package/dist/utils/mnemonist.d.mts +0 -2
  134. package/dist/utils/mnemonist.mjs +0 -12
@@ -1,691 +0,0 @@
1
- import { B as t, D as e, M as e$3, O as e$1, Q as t$4, Z as t$7, b as t$1, j as e$2, nt as t$2, t as t$5, tt as t$3, w as t$6, z as e$4 } from "./libs/remeda.mjs";
2
- import { h as memoizeProp } from "./utils.mjs";
3
- import { r as nonexhaustive, t as invariant } from "./invariant.mjs";
4
- import { n as chroma_js_default, t as generateColors } from "./libs/@mantine/colors-generator.mjs";
5
- import { n as import_default_map, r as import_default_weak_map } from "./libs/mnemonist.mjs";
6
- import { t as defu } from "./libs/defu.mjs";
7
- import { g as isStepEdgeId } from "./scalar.mjs";
8
-
9
- //#region ../../styled-system/preset/dist/_chunks/defaults.mjs
10
- const blue$1 = {
11
- fill: "#3b82f6",
12
- stroke: "#2563eb",
13
- hiContrast: "#eff6ff",
14
- loContrast: "#bfdbfe"
15
- };
16
- const sky$1 = {
17
- fill: "#0284c7",
18
- stroke: "#0369a1",
19
- hiContrast: "#f0f9ff",
20
- loContrast: "#B6ECF7"
21
- };
22
- const slate$1 = {
23
- fill: "#64748b",
24
- stroke: "#475569",
25
- hiContrast: "#f8fafc",
26
- loContrast: "#cbd5e1"
27
- };
28
- const ElementColors = {
29
- primary: blue$1,
30
- blue: blue$1,
31
- secondary: sky$1,
32
- sky: sky$1,
33
- muted: slate$1,
34
- slate: slate$1,
35
- gray: {
36
- fill: "#737373",
37
- stroke: "#525252",
38
- hiContrast: "#fafafa",
39
- loContrast: "#d4d4d4"
40
- },
41
- red: {
42
- fill: "#AC4D39",
43
- stroke: "#853A2D",
44
- hiContrast: "#FBD3CB",
45
- loContrast: "#f5b2a3"
46
- },
47
- green: {
48
- fill: "#428a4f",
49
- stroke: "#2d5d39",
50
- hiContrast: "#f8fafc",
51
- loContrast: "#c2f0c2"
52
- },
53
- amber: {
54
- fill: "#A35829",
55
- stroke: "#7E451D",
56
- hiContrast: "#FFE0C2",
57
- loContrast: "#f9b27c"
58
- },
59
- indigo: {
60
- fill: "#6366f1",
61
- stroke: "#4f46e5",
62
- hiContrast: "#eef2ff",
63
- loContrast: "#c7d2fe"
64
- }
65
- };
66
- const gray = {
67
- line: "#8D8D8D",
68
- labelBg: "#18191B",
69
- label: "#C9C9C9"
70
- };
71
- const slate = {
72
- line: "#64748b",
73
- labelBg: "#0f172a",
74
- label: "#cbd5e1"
75
- };
76
- const blue = {
77
- line: "#3b82f6",
78
- labelBg: "#172554",
79
- label: "#60a5fa"
80
- };
81
- const sky = {
82
- line: "#0ea5e9",
83
- labelBg: "#082f49",
84
- label: "#38bdf8"
85
- };
86
- const RelationshipColors = {
87
- amber: {
88
- line: "#b45309",
89
- labelBg: "#78350f",
90
- label: "#FFE0C2"
91
- },
92
- blue,
93
- gray,
94
- green: {
95
- line: "#15803d",
96
- labelBg: "#052e16",
97
- label: "#22c55e"
98
- },
99
- indigo: {
100
- line: "#6366f1",
101
- labelBg: "#1e1b4b",
102
- label: "#818cf8"
103
- },
104
- muted: slate,
105
- primary: blue,
106
- red: {
107
- line: "#AC4D39",
108
- labelBg: "#b91c1c",
109
- label: "#f5b2a3"
110
- },
111
- secondary: sky,
112
- sky,
113
- slate
114
- };
115
- const defaultSizes = {
116
- sizes: {
117
- xs: {
118
- width: 180,
119
- height: 100
120
- },
121
- sm: {
122
- width: 240,
123
- height: 135
124
- },
125
- md: {
126
- width: 320,
127
- height: 180
128
- },
129
- lg: {
130
- width: 420,
131
- height: 234
132
- },
133
- xl: {
134
- width: 520,
135
- height: 290
136
- }
137
- },
138
- spacing: {
139
- xs: 8,
140
- sm: 10,
141
- md: 16,
142
- lg: 24,
143
- xl: 32
144
- },
145
- textSizes: {
146
- xs: 13.33,
147
- sm: 16,
148
- md: 19.2,
149
- lg: 23.04,
150
- xl: 27.65
151
- },
152
- iconSizes: {
153
- xs: 24,
154
- sm: 36,
155
- md: 60,
156
- lg: 82,
157
- xl: 90
158
- }
159
- };
160
- const Sizes = [
161
- "xs",
162
- "sm",
163
- "md",
164
- "lg",
165
- "xl"
166
- ];
167
- const IconPositions = [
168
- "left",
169
- "right",
170
- "top",
171
- "bottom"
172
- ];
173
- const BorderStyles = [
174
- "solid",
175
- "dashed",
176
- "dotted",
177
- "none"
178
- ];
179
- const ElementShapes = [
180
- "rectangle",
181
- "person",
182
- "browser",
183
- "mobile",
184
- "cylinder",
185
- "storage",
186
- "queue",
187
- "bucket",
188
- "document"
189
- ];
190
- const ThemeColors = [
191
- "amber",
192
- "blue",
193
- "gray",
194
- "slate",
195
- "green",
196
- "indigo",
197
- "muted",
198
- "primary",
199
- "red",
200
- "secondary",
201
- "sky"
202
- ];
203
- const DefaultTagColors = [
204
- "tomato",
205
- "grass",
206
- "blue",
207
- "ruby",
208
- "orange",
209
- "indigo",
210
- "pink",
211
- "teal",
212
- "purple",
213
- "amber",
214
- "crimson",
215
- "red",
216
- "lime",
217
- "yellow",
218
- "violet"
219
- ];
220
- const defaultTheme$1 = {
221
- colors: ThemeColors.reduce((acc, key) => {
222
- acc[key] = {
223
- elements: ElementColors[key],
224
- relationships: RelationshipColors[key]
225
- };
226
- return acc;
227
- }, {}),
228
- ...defaultSizes
229
- };
230
-
231
- //#endregion
232
- //#region src/styles/compute-color-values.ts
233
- const CONTRAST_MIN_WITH_FOREGROUND = 60;
234
- const CONTRAST_START_TONE_DIFFERENCE = 2;
235
- const CONTRAST_STEP_TONE_DIFFERENCE = 1;
236
- function computeColorValues(color) {
237
- invariant(chroma_js_default.valid(color), `Invalid color: ${color}`);
238
- const colors = generateColors(color);
239
- const fillColor = colors[6];
240
- const contrastedColors = getContrastedColorsAPCA(fillColor);
241
- return {
242
- elements: {
243
- fill: fillColor,
244
- stroke: colors[7],
245
- ...contrastedColors
246
- },
247
- relationships: {
248
- line: colors[4],
249
- label: colors[3],
250
- labelBg: colors[9]
251
- }
252
- };
253
- }
254
- function getContrastedColorsAPCA(refColor) {
255
- const refColorChroma = chroma_js_default(refColor);
256
- let lightColorRgb = refColorChroma.brighten(CONTRAST_START_TONE_DIFFERENCE);
257
- let darkColorRgb = refColorChroma.darken(CONTRAST_START_TONE_DIFFERENCE);
258
- let previousLight;
259
- let previousDark;
260
- let contrastWithLight;
261
- let contrastWithDark;
262
- do {
263
- previousLight = lightColorRgb;
264
- previousDark = darkColorRgb;
265
- lightColorRgb = lightColorRgb.brighten(CONTRAST_STEP_TONE_DIFFERENCE);
266
- darkColorRgb = darkColorRgb.darken(CONTRAST_STEP_TONE_DIFFERENCE);
267
- contrastWithLight = chroma_js_default.contrastAPCA(refColorChroma, lightColorRgb);
268
- contrastWithDark = chroma_js_default.contrastAPCA(refColorChroma, darkColorRgb);
269
- } while (Math.abs(contrastWithLight) < CONTRAST_MIN_WITH_FOREGROUND && Math.abs(contrastWithDark) < CONTRAST_MIN_WITH_FOREGROUND && (!t(lightColorRgb, previousLight) || !t(darkColorRgb, previousDark)));
270
- if (Math.abs(contrastWithLight) > Math.abs(contrastWithDark)) return {
271
- hiContrast: lightColorRgb.brighten(.4).hex(),
272
- loContrast: lightColorRgb.hex()
273
- };
274
- else return {
275
- hiContrast: darkColorRgb.darken(.4).hex(),
276
- loContrast: darkColorRgb.hex()
277
- };
278
- }
279
-
280
- //#endregion
281
- //#region src/styles/defaults.ts
282
- const styleDefaults = {
283
- color: "primary",
284
- size: "md",
285
- opacity: 15,
286
- shape: "rectangle",
287
- group: {
288
- opacity: 15,
289
- border: "dashed"
290
- },
291
- relationship: {
292
- color: "gray",
293
- line: "dashed",
294
- arrow: "normal"
295
- }
296
- };
297
-
298
- //#endregion
299
- //#region src/styles/theme.ts
300
- const defaultTheme = defaultTheme$1;
301
-
302
- //#endregion
303
- //#region src/types/_common.ts
304
- /**
305
- * Allows only exact properties of `U` to be present in `T` and omits undefined values
306
- *
307
- * See {@link Exact} for more details (this version is non-deep)
308
- */
309
- function exact(a) {
310
- return t$1(a, (v) => v === void 0);
311
- }
312
-
313
- //#endregion
314
- //#region src/types/const.ts
315
- function isOnStage(value, stage) {
316
- return value[_stage] === stage;
317
- }
318
- /**
319
- * Property name to store the stage of the model
320
- *
321
- * @internal
322
- */
323
- const _stage = "_stage";
324
- /**
325
- * Property name to store type information, used to identify the type of the view
326
- *
327
- * @internal
328
- */
329
- const _type = "_type";
330
- /**
331
- * Property name to store layout type information, used to identify the type of the layout*
332
- * @internal
333
- */
334
- const _layout = "_layout";
335
-
336
- //#endregion
337
- //#region src/types/model-deployment.ts
338
- function isDeploymentNode(el) {
339
- return e(el.kind) && !e(el.element);
340
- }
341
- function isDeployedInstance(el) {
342
- return e(el.element) && !e(el.kind);
343
- }
344
-
345
- //#endregion
346
- //#region src/types/model-logical.ts
347
- /**
348
- * Ensures that the sizes are set to default values if they are not set
349
- */
350
- function ensureSizes({ size, padding, textSize, iconSize, ...rest }, defaultSize = defaultStyle.defaults.size) {
351
- size ??= defaultSize;
352
- textSize ??= size;
353
- padding ??= size;
354
- iconSize ??= size;
355
- return {
356
- ...rest,
357
- size,
358
- padding,
359
- textSize,
360
- iconSize
361
- };
362
- }
363
-
364
- //#endregion
365
- //#region src/types/model-spec.ts
366
- /**
367
- * Checks if tag color is defined in the specification
368
- * Expects HEX, `rgb(...)` or `rgba(...)` color
369
- */
370
- function isTagColorSpecified(spec) {
371
- const color = typeof spec === "string" ? spec : spec.color;
372
- return color.startsWith("#") || color.startsWith("rgb");
373
- }
374
-
375
- //#endregion
376
- //#region src/types/operators.ts
377
- function isTagEqual(operator) {
378
- return "tag" in operator;
379
- }
380
- function isKindEqual(operator) {
381
- return "kind" in operator;
382
- }
383
- function isParticipantOperator(operator) {
384
- return "participant" in operator;
385
- }
386
- function isNotOperator(operator) {
387
- return "not" in operator;
388
- }
389
- function isAndOperator(operator) {
390
- return "and" in operator;
391
- }
392
- function isOrOperator(operator) {
393
- return "or" in operator;
394
- }
395
- function whereOperatorAsPredicate(operator) {
396
- switch (true) {
397
- case isParticipantOperator(operator): {
398
- const participant = operator.participant;
399
- return participantIs(participant, whereOperatorAsPredicate(operator.operator));
400
- }
401
- case isTagEqual(operator): {
402
- if (e$1(operator.tag) || "eq" in operator.tag) {
403
- const tag = e$1(operator.tag) ? operator.tag : operator.tag.eq;
404
- return (value) => {
405
- return Array.isArray(value.tags) && value.tags.includes(tag);
406
- };
407
- }
408
- const tag = operator.tag.neq;
409
- return (value) => {
410
- return !Array.isArray(value.tags) || !value.tags.includes(tag);
411
- };
412
- }
413
- case isKindEqual(operator): {
414
- if (e$1(operator.kind) || "eq" in operator.kind) {
415
- const kind = e$1(operator.kind) ? operator.kind : operator.kind.eq;
416
- return (value) => {
417
- return value.kind === kind;
418
- };
419
- }
420
- const kind = operator.kind.neq;
421
- return (value) => {
422
- return e$2(value.kind) || value.kind !== kind;
423
- };
424
- }
425
- case isNotOperator(operator): return e$3(whereOperatorAsPredicate(operator.not));
426
- case isAndOperator(operator): return t$2(operator.and.map(whereOperatorAsPredicate));
427
- case isOrOperator(operator): return t$3(operator.or.map(whereOperatorAsPredicate));
428
- default: nonexhaustive(operator);
429
- }
430
- }
431
- function participantIs(participant, predicate) {
432
- return (value) => {
433
- if (!value.source || !value.target) return false;
434
- switch (participant) {
435
- case "source": return predicate(value.source);
436
- case "target": return predicate(value.target);
437
- }
438
- };
439
- }
440
-
441
- //#endregion
442
- //#region src/types/view.ts
443
- function isViewRulePredicate(rule) {
444
- return "include" in rule || "exclude" in rule;
445
- }
446
- function isViewRuleStyle(rule) {
447
- return "targets" in rule && "style" in rule;
448
- }
449
- function isComputedView(view) {
450
- return view._stage === "computed";
451
- }
452
- function isDiagramView(view) {
453
- return view._stage === "layouted";
454
- }
455
- function isElementView(view) {
456
- return view._type === "element";
457
- }
458
- function isScopedElementView(view) {
459
- return isElementView(view) && e(view.viewOf);
460
- }
461
- function isExtendsElementView(view) {
462
- return isElementView(view) && e(view.extends);
463
- }
464
- function isDeploymentView(view) {
465
- return view._type === "deployment";
466
- }
467
- function isDynamicView(view) {
468
- return view._type === "dynamic";
469
- }
470
-
471
- //#endregion
472
- //#region src/types/view-common.ts
473
- function isViewRuleGlobalStyle(rule) {
474
- return "styleId" in rule;
475
- }
476
- function isViewRuleGlobalPredicateRef(rule) {
477
- return "predicateId" in rule;
478
- }
479
- function isAutoLayoutDirection(autoLayout) {
480
- return autoLayout === "TB" || autoLayout === "BT" || autoLayout === "LR" || autoLayout === "RL";
481
- }
482
- function isViewRuleAutoLayout(rule) {
483
- return "direction" in rule;
484
- }
485
-
486
- //#endregion
487
- //#region src/types/view-parsed.dynamic.ts
488
- function getParallelStepsPrefix(id) {
489
- if (isStepEdgeId(id) && id.includes(".")) return id.slice(0, id.indexOf(".") + 1);
490
- return null;
491
- }
492
- function isDynamicStep(step) {
493
- return !!step && !("__series" in step || "__parallel" in step);
494
- }
495
- function isDynamicStepsParallel(step) {
496
- return !!step && "__parallel" in step && e$4(step.__parallel);
497
- }
498
- function isDynamicStepsSeries(step) {
499
- return !!step && "__series" in step && e$4(step.__series);
500
- }
501
-
502
- //#endregion
503
- //#region src/types/view-parsed.element.ts
504
- function isViewRuleGroup(rule) {
505
- return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
506
- }
507
- function isViewRuleRank(rule) {
508
- return "rank" in rule && Array.isArray(rule.targets);
509
- }
510
-
511
- //#endregion
512
- //#region src/styles/compute-compound-colors.ts
513
- /**
514
- * Compute color values for compound nodes (for six depth levels)
515
- *
516
- * @param base The base element colors
517
- */
518
- function computeCompoundColorValues(base, depth) {
519
- const d = depth ?? 6;
520
- let fill = chroma_js_default(base.fill);
521
- let stroke = chroma_js_default(base.stroke);
522
- const isFillTooLight = fill.luminance() > .8;
523
- const colors = t$4(t$5(chroma_js_default.scale(isFillTooLight ? [fill.darken(.02).desaturate(.05), fill.darken(.1).desaturate(.1)] : [fill.shade(.12, "lch").desaturate(.05), fill.shade(.35, "lch").desaturate(.4)]).mode("oklch").correctLightness().colors(d, null), chroma_js_default.scale(isFillTooLight ? [stroke.darken(.04).desaturate(.05), stroke.darken(.12).desaturate(.1)] : [stroke.shade(.15, "lch").desaturate(.08), stroke.shade(.4, "lch").desaturate(.4)]).mode("oklch").correctLightness().colors(d, null)), t$6(([fill, stroke]) => ({
524
- ...base,
525
- fill: fill.hex(),
526
- stroke: stroke.hex()
527
- })));
528
- invariant(colors.length === d, `Expected ${d} colors, got ${colors.length}`);
529
- return colors;
530
- }
531
-
532
- //#endregion
533
- //#region src/styles/LikeC4Styles.ts
534
- const defaultStyle = {
535
- theme: defaultTheme,
536
- defaults: styleDefaults
537
- };
538
- /**
539
- * Styles of a LikeC4 project
540
- *
541
- * Accepts an array of LikeC4ProjectStylesConfig objects as a parameter
542
- * and constructs a LikeC4Styles merged with the default styles.
543
- *
544
- * The class provides methods to get the default element colors, relationship
545
- * colors, group colors, font size in pixels, padding in pixels, and to compute
546
- * the ThemeColorValues from a given color.
547
- */
548
- var LikeC4Styles = class LikeC4Styles {
549
- theme;
550
- defaults;
551
- static DEFAULT = new LikeC4Styles(defaultStyle);
552
- static from(...configs) {
553
- if (t$7(configs, 1)) return new LikeC4Styles(defu(...configs, defaultStyle));
554
- return this.DEFAULT;
555
- }
556
- constructor(config) {
557
- this.config = config;
558
- this.theme = config.theme;
559
- this.defaults = config.defaults;
560
- }
561
- /**
562
- * Default element colors
563
- */
564
- get elementColors() {
565
- return this.theme.colors[this.defaults.color].elements;
566
- }
567
- /**
568
- * Default relationship colors
569
- */
570
- get relationshipColors() {
571
- return this.theme.colors[this.defaults.relationship.color].relationships;
572
- }
573
- /**
574
- * Default group colors
575
- */
576
- get groupColors() {
577
- const color = this.defaults.group?.color;
578
- if (!color) return this.elementColors;
579
- return memoizeProp(this, "defaultGroup", () => ({
580
- ...this.elementColors,
581
- ...this.theme.colors[color].elements
582
- }));
583
- }
584
- isDefaultColor(color) {
585
- return color === this.defaults.color;
586
- }
587
- /**
588
- * Get color values
589
- *
590
- * @param color - The color to use
591
- * @default color From the defaults
592
- */
593
- colors(color) {
594
- color ??= this.defaults.color;
595
- if (this.isThemeColor(color)) return this.theme.colors[color];
596
- throw new Error(`Unknown color: ${color}`);
597
- }
598
- compoundColorsCache = new import_default_weak_map.default((baseElementColors) => new import_default_map.default((depth) => computeCompoundColorValues(baseElementColors, depth)));
599
- /**
600
- * Get colors for compound nodes
601
- *
602
- * @param baseElementColors - The base element colors to compute from
603
- */
604
- colorsForCompounds(baseElementColors, depth) {
605
- return this.compoundColorsCache.get(baseElementColors).get(depth ?? 6);
606
- }
607
- /**
608
- * Get font size in pixels
609
- *
610
- * @param textSize - The text size to use
611
- * @default textSize From the defaults
612
- */
613
- fontSize(textSize) {
614
- textSize ??= this.defaults.text ?? this.defaults.size;
615
- return this.theme.textSizes[textSize];
616
- }
617
- /**
618
- * Get padding in pixels
619
- *
620
- * @param paddingSize - The padding size to use
621
- * @default paddingSize From the defaults
622
- */
623
- padding(paddingSize) {
624
- paddingSize ??= this.defaults.padding ?? this.defaults.size;
625
- return this.theme.spacing[paddingSize];
626
- }
627
- /**
628
- * Get icon size in pixels
629
- *
630
- * @param iconSize - The icon size to use
631
- * @default iconSize From the defaults
632
- */
633
- iconSize(iconSize) {
634
- iconSize ??= this.defaults.size;
635
- return this.theme.iconSizes[iconSize];
636
- }
637
- isThemeColor(color) {
638
- return color in this.theme.colors;
639
- }
640
- /**
641
- * Calculate sizes and values based on the node styles
642
- *
643
- * @example
644
- * ```typescript
645
- * const { sizes, values } = styles.nodeSizes(node.style)
646
- *
647
- * // sizes
648
- * sizes.size // enum Size
649
- * sizes.padding // enum SpacingSize
650
- * sizes.textSize // enum TextSize
651
- * sizes.iconSize // enum ShapeSize
652
- *
653
- * // values
654
- * values.sizes // { width: number, height: number }
655
- * values.padding // number
656
- * values.textSize // number
657
- * values.iconSize // number
658
- * ```
659
- */
660
- nodeSizes(nodestyles) {
661
- const sizes = ensureSizes(nodestyles, this.defaults.size);
662
- return {
663
- sizes,
664
- values: {
665
- sizes: this.theme.sizes[sizes.size],
666
- padding: this.padding(sizes.padding),
667
- textSize: this.fontSize(sizes.textSize),
668
- iconSize: this.iconSize(sizes.iconSize)
669
- }
670
- };
671
- }
672
- /**
673
- * Compute ThemeColorValues from a given color
674
- * @param color - HEX, RGB, RGBA, etc.
675
- */
676
- computeFrom(color) {
677
- if (this.isThemeColor(color)) return this.theme.colors[color];
678
- return memoizeProp(this, `compute-${color}`, () => {
679
- if (!chroma_js_default.valid(color)) throw new Error(`Invalid color value: "${color}"`);
680
- return computeColorValues(color);
681
- });
682
- }
683
- equals(other) {
684
- if (other === this) return true;
685
- if (this.constructor !== other.constructor) return false;
686
- return t(this.config, other.config);
687
- }
688
- };
689
-
690
- //#endregion
691
- export { isDeployedInstance as A, BorderStyles as B, isNotOperator as C, whereOperatorAsPredicate as D, isTagEqual as E, isOnStage as F, ThemeColors as G, ElementShapes as H, exact as I, defaultTheme as L, _layout as M, _stage as N, isTagColorSpecified as O, _type as P, styleDefaults as R, isKindEqual as S, isParticipantOperator as T, IconPositions as U, DefaultTagColors as V, Sizes as W, isExtendsElementView as _, isDynamicStep as a, isViewRuleStyle as b, isAutoLayoutDirection as c, isViewRuleGlobalStyle as d, isComputedView as f, isElementView as g, isDynamicView as h, getParallelStepsPrefix as i, isDeploymentNode as j, ensureSizes as k, isViewRuleAutoLayout as l, isDiagramView as m, isViewRuleGroup as n, isDynamicStepsParallel as o, isDeploymentView as p, isViewRuleRank as r, isDynamicStepsSeries as s, LikeC4Styles as t, isViewRuleGlobalPredicateRef as u, isScopedElementView as v, isOrOperator as w, isAndOperator as x, isViewRulePredicate as y, computeColorValues as z };