likec4 1.41.0 → 1.42.1

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 (42) hide show
  1. package/__app__/src/likec4.js +11520 -11895
  2. package/__app__/src/main.js +185 -129
  3. package/__app__/src/style.css +1 -1
  4. package/__app__/src/vendors.js +38559 -17023
  5. package/__app__/src/webcomponent.js +68 -0
  6. package/config/package.json +2 -2
  7. package/config/schema.json +575 -0
  8. package/dist/cli/index.mjs +569 -564
  9. package/dist/config/index.d.mts +4 -1
  10. package/dist/config/index.mjs +1 -1
  11. package/dist/index.d.mts +4 -4
  12. package/dist/index.mjs +1 -1
  13. package/dist/model/index.d.mts +47 -4
  14. package/dist/model/index.mjs +1 -1
  15. package/dist/shared/likec4.B5Q51Z1F.mjs +543 -0
  16. package/dist/shared/likec4.BCSBNe4z.d.mts +6808 -0
  17. package/dist/shared/likec4.BEwUtMsL.mjs +256 -0
  18. package/dist/shared/likec4.CB2-Uaub.mjs +47 -0
  19. package/dist/shared/{likec4.3AlS7pfZ.d.mts → likec4.CaOUU1HJ.d.mts} +204 -149
  20. package/dist/shared/likec4.D51sTGt6.mjs +4038 -0
  21. package/dist/shared/likec4.DOUP9ptn.mjs +1 -0
  22. package/dist/shared/{likec4.C8C0fF8a.mjs → likec4.DO_7oUns.mjs} +1 -1
  23. package/dist/vite-plugin/index.d.mts +4 -3
  24. package/dist/vite-plugin/index.mjs +1 -1
  25. package/dist/vite-plugin/internal.mjs +3 -3
  26. package/icons/all/package.json +4 -0
  27. package/model/builder/package.json +4 -0
  28. package/model/package.json +4 -0
  29. package/package.json +41 -41
  30. package/react/index.d.ts +6637 -0
  31. package/react/index.js +48759 -0
  32. package/react/package.json +3 -2
  33. package/vite-plugin/package.json +2 -2
  34. package/vite-plugin-modules.d.ts +5 -5
  35. package/__app__/src/webcomponent.tsx +0 -81
  36. package/dist/shared/likec4.CdNNo2L4.mjs +0 -1
  37. package/dist/shared/likec4.CxmGAh_J.mjs +0 -144
  38. package/dist/shared/likec4.DX1wM3Or.d.mts +0 -1704
  39. package/dist/shared/likec4.Db3cTW-C.mjs +0 -257
  40. package/dist/shared/likec4.bxIrQhth.mjs +0 -4174
  41. package/react/index.d.mts +0 -6578
  42. package/react/index.mjs +0 -185
@@ -0,0 +1,68 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { LikeC4View as LikeC4View$1 } from "likec4:react";
3
+ import { createRoot } from "react-dom/client";
4
+ import { ComponentName } from "./const.js";
5
+ import { dv as object, dw as literal, dx as stringbool, dy as string, dz as formatError } from "./vendors.js";
6
+ const propsSchema = object({
7
+ viewId: string().default("index"),
8
+ browser: stringbool().default(!0),
9
+ dynamicViewVariant: literal(["diagram", "sequence"]).optional()
10
+ });
11
+ class LikeC4View extends HTMLElement {
12
+ shadow;
13
+ root;
14
+ hostCss;
15
+ lastHostCss = "";
16
+ constructor() {
17
+ super(), this.shadow = this.attachShadow({ mode: "open", delegatesFocus: !0 });
18
+ }
19
+ updateHostCss() {
20
+ const hostCss = `
21
+ :host {
22
+ display: block;
23
+ position: relative;
24
+ background-color: transparent;
25
+ width: 100%;
26
+ height: 100%;
27
+ box-sizing: border-box;
28
+ overflow: hidden;
29
+ border: 0px solid transparent;
30
+ padding: 0;
31
+ }`;
32
+ hostCss !== this.lastHostCss && (this.hostCss?.replaceSync(hostCss), this.lastHostCss = hostCss);
33
+ }
34
+ connectedCallback() {
35
+ this.lastHostCss = "", this.hostCss = new CSSStyleSheet(), this.updateHostCss(), this.shadow.adoptedStyleSheets = [
36
+ this.hostCss
37
+ ], this.render();
38
+ }
39
+ disconnectedCallback() {
40
+ this.root?.unmount(), this.root = void 0, this.shadow.adoptedStyleSheets.length = 0, this.hostCss = void 0;
41
+ }
42
+ static observedAttributes = ["view-id", "browser", "dynamic-variant"];
43
+ getProps() {
44
+ const props = propsSchema.safeParse(
45
+ {
46
+ viewId: this.getAttribute("view-id"),
47
+ browser: this.getAttribute("browser") ?? void 0,
48
+ dynamicViewVariant: this.getAttribute("dynamic-variant") ?? void 0
49
+ }
50
+ );
51
+ return props.success ? props.data : (console.error("Invalid props", formatError(props.error)), {
52
+ viewId: "index"
53
+ });
54
+ }
55
+ render() {
56
+ const props = this.getProps();
57
+ this.updateHostCss(), this.root ??= createRoot(this.shadow), this.root.render(
58
+ /* @__PURE__ */ jsx(LikeC4View$1, { ...props })
59
+ );
60
+ }
61
+ attributeChangedCallback(_name) {
62
+ this.root && this.render();
63
+ }
64
+ }
65
+ customElements.define(ComponentName.View, LikeC4View);
66
+ export {
67
+ LikeC4View
68
+ };
@@ -1,4 +1,4 @@
1
1
  {
2
- "module": "../dist/config/index.mjs",
3
- "types": "../dist/config/index.d.mts"
2
+ "types": "../dist/config/index.d.mts",
3
+ "module": "../dist/config/index.mjs"
4
4
  }
@@ -0,0 +1,575 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "LikeC4 project configuration",
4
+ "type": "object",
5
+ "properties": {
6
+ "name": {
7
+ "description": "Project name, must be unique in the workspace",
8
+ "type": "string",
9
+ "minLength": 1
10
+ },
11
+ "title": {
12
+ "description": "A human readable title for the project",
13
+ "type": "string",
14
+ "minLength": 1
15
+ },
16
+ "contactPerson": {
17
+ "description": "A person who has been involved in creating or maintaining this project",
18
+ "type": "string",
19
+ "minLength": 1
20
+ },
21
+ "imageAliases": {
22
+ "description": "Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).",
23
+ "type": "object",
24
+ "propertyNames": {
25
+ "type": "string"
26
+ },
27
+ "additionalProperties": {
28
+ "type": "string",
29
+ "minLength": 1,
30
+ "pattern": "^(?!\\/|[A-Za-z]:[\\\\\\/])(?!.*:\\/\\/).*$"
31
+ }
32
+ },
33
+ "styles": {
34
+ "allOf": [
35
+ {
36
+ "$ref": "#/definitions/StylesConfiguration"
37
+ }
38
+ ]
39
+ },
40
+ "exclude": {
41
+ "description": "List of file patterns to exclude from the project, default is [\"**/node_modules/**\"]",
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string"
45
+ }
46
+ }
47
+ },
48
+ "required": [
49
+ "name"
50
+ ],
51
+ "definitions": {
52
+ "StylesConfiguration": {
53
+ "id": "StylesConfiguration",
54
+ "description": "Project styles customization",
55
+ "type": "object",
56
+ "properties": {
57
+ "theme": {
58
+ "allOf": [
59
+ {
60
+ "$ref": "#/definitions/ThemeCustomization"
61
+ }
62
+ ]
63
+ },
64
+ "defaults": {
65
+ "allOf": [
66
+ {
67
+ "$ref": "#/definitions/DefaultStyleValues"
68
+ }
69
+ ]
70
+ }
71
+ }
72
+ },
73
+ "ThemeCustomization": {
74
+ "id": "ThemeCustomization",
75
+ "description": "Theme customization",
76
+ "type": "object",
77
+ "properties": {
78
+ "colors": {
79
+ "allOf": [
80
+ {
81
+ "$ref": "#/definitions/ThemeColors"
82
+ }
83
+ ]
84
+ },
85
+ "sizes": {
86
+ "description": "Map of theme sizes.",
87
+ "type": "object",
88
+ "properties": {
89
+ "xs": {
90
+ "allOf": [
91
+ {
92
+ "$ref": "#/definitions/Dimensions"
93
+ }
94
+ ]
95
+ },
96
+ "sm": {
97
+ "allOf": [
98
+ {
99
+ "$ref": "#/definitions/Dimensions"
100
+ }
101
+ ]
102
+ },
103
+ "md": {
104
+ "allOf": [
105
+ {
106
+ "$ref": "#/definitions/Dimensions"
107
+ }
108
+ ]
109
+ },
110
+ "lg": {
111
+ "allOf": [
112
+ {
113
+ "$ref": "#/definitions/Dimensions"
114
+ }
115
+ ]
116
+ },
117
+ "xl": {
118
+ "allOf": [
119
+ {
120
+ "$ref": "#/definitions/Dimensions"
121
+ }
122
+ ]
123
+ }
124
+ }
125
+ }
126
+ }
127
+ },
128
+ "ThemeColors": {
129
+ "id": "ThemeColors",
130
+ "description": "Override of theme colors",
131
+ "anyOf": [
132
+ {
133
+ "type": "object",
134
+ "propertyNames": {
135
+ "$ref": "#/definitions/ColorName"
136
+ },
137
+ "additionalProperties": {
138
+ "allOf": [
139
+ {
140
+ "$ref": "#/definitions/ThemeColorValues"
141
+ }
142
+ ]
143
+ }
144
+ },
145
+ {
146
+ "type": "object",
147
+ "properties": {
148
+ "amber": {
149
+ "allOf": [
150
+ {
151
+ "$ref": "#/definitions/ThemeColorValues"
152
+ }
153
+ ]
154
+ },
155
+ "blue": {
156
+ "allOf": [
157
+ {
158
+ "$ref": "#/definitions/ThemeColorValues"
159
+ }
160
+ ]
161
+ },
162
+ "gray": {
163
+ "allOf": [
164
+ {
165
+ "$ref": "#/definitions/ThemeColorValues"
166
+ }
167
+ ]
168
+ },
169
+ "slate": {
170
+ "allOf": [
171
+ {
172
+ "$ref": "#/definitions/ThemeColorValues"
173
+ }
174
+ ]
175
+ },
176
+ "green": {
177
+ "allOf": [
178
+ {
179
+ "$ref": "#/definitions/ThemeColorValues"
180
+ }
181
+ ]
182
+ },
183
+ "indigo": {
184
+ "allOf": [
185
+ {
186
+ "$ref": "#/definitions/ThemeColorValues"
187
+ }
188
+ ]
189
+ },
190
+ "muted": {
191
+ "allOf": [
192
+ {
193
+ "$ref": "#/definitions/ThemeColorValues"
194
+ }
195
+ ]
196
+ },
197
+ "primary": {
198
+ "allOf": [
199
+ {
200
+ "$ref": "#/definitions/ThemeColorValues"
201
+ }
202
+ ]
203
+ },
204
+ "red": {
205
+ "allOf": [
206
+ {
207
+ "$ref": "#/definitions/ThemeColorValues"
208
+ }
209
+ ]
210
+ },
211
+ "secondary": {
212
+ "allOf": [
213
+ {
214
+ "$ref": "#/definitions/ThemeColorValues"
215
+ }
216
+ ]
217
+ },
218
+ "sky": {
219
+ "allOf": [
220
+ {
221
+ "$ref": "#/definitions/ThemeColorValues"
222
+ }
223
+ ]
224
+ }
225
+ }
226
+ }
227
+ ]
228
+ },
229
+ "ColorName": {
230
+ "id": "ColorName",
231
+ "description": "Color name (Theme color name or custom color name)",
232
+ "anyOf": [
233
+ {
234
+ "$ref": "#/definitions/ThemeColor"
235
+ },
236
+ {
237
+ "type": "string",
238
+ "minLength": 1
239
+ }
240
+ ]
241
+ },
242
+ "ThemeColor": {
243
+ "id": "ThemeColor",
244
+ "description": "Reserved theme color name",
245
+ "type": "string",
246
+ "enum": [
247
+ "amber",
248
+ "blue",
249
+ "gray",
250
+ "slate",
251
+ "green",
252
+ "indigo",
253
+ "muted",
254
+ "primary",
255
+ "red",
256
+ "secondary",
257
+ "sky"
258
+ ]
259
+ },
260
+ "ThemeColorValues": {
261
+ "id": "ThemeColorValues",
262
+ "description": "Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values",
263
+ "anyOf": [
264
+ {
265
+ "$ref": "#/definitions/ColorLiteral"
266
+ },
267
+ {
268
+ "type": "object",
269
+ "properties": {
270
+ "elements": {
271
+ "anyOf": [
272
+ {
273
+ "$ref": "#/definitions/ColorLiteral"
274
+ },
275
+ {
276
+ "allOf": [
277
+ {
278
+ "$ref": "#/definitions/ElementColorValues"
279
+ }
280
+ ]
281
+ }
282
+ ]
283
+ },
284
+ "relationships": {
285
+ "anyOf": [
286
+ {
287
+ "$ref": "#/definitions/ColorLiteral"
288
+ },
289
+ {
290
+ "allOf": [
291
+ {
292
+ "$ref": "#/definitions/RelationshipColorValues"
293
+ }
294
+ ]
295
+ }
296
+ ]
297
+ }
298
+ },
299
+ "required": [
300
+ "elements",
301
+ "relationships"
302
+ ]
303
+ }
304
+ ]
305
+ },
306
+ "ColorLiteral": {
307
+ "id": "ColorLiteral",
308
+ "description": "Color value in any valid CSS format: hex, rgb, rgba, hsl, hsla ...",
309
+ "type": "string",
310
+ "minLength": 1
311
+ },
312
+ "ElementColorValues": {
313
+ "id": "ElementColorValues",
314
+ "description": "Specific element colors",
315
+ "type": "object",
316
+ "properties": {
317
+ "fill": {
318
+ "description": "Background color",
319
+ "allOf": [
320
+ {
321
+ "$ref": "#/definitions/ColorLiteral"
322
+ }
323
+ ]
324
+ },
325
+ "stroke": {
326
+ "description": "Stroke color (border, paths above background)",
327
+ "allOf": [
328
+ {
329
+ "$ref": "#/definitions/ColorLiteral"
330
+ }
331
+ ]
332
+ },
333
+ "hiContrast": {
334
+ "description": "High contrast text color (title)",
335
+ "allOf": [
336
+ {
337
+ "$ref": "#/definitions/ColorLiteral"
338
+ }
339
+ ]
340
+ },
341
+ "loContrast": {
342
+ "description": "Low contrast text color (description)",
343
+ "allOf": [
344
+ {
345
+ "$ref": "#/definitions/ColorLiteral"
346
+ }
347
+ ]
348
+ }
349
+ },
350
+ "required": [
351
+ "fill",
352
+ "stroke",
353
+ "hiContrast",
354
+ "loContrast"
355
+ ]
356
+ },
357
+ "RelationshipColorValues": {
358
+ "id": "RelationshipColorValues",
359
+ "description": "Specefic relationship colors",
360
+ "type": "object",
361
+ "properties": {
362
+ "line": {
363
+ "description": "Line color",
364
+ "allOf": [
365
+ {
366
+ "$ref": "#/definitions/ColorLiteral"
367
+ }
368
+ ]
369
+ },
370
+ "label": {
371
+ "description": "Label text color",
372
+ "allOf": [
373
+ {
374
+ "$ref": "#/definitions/ColorLiteral"
375
+ }
376
+ ]
377
+ },
378
+ "labelBg": {
379
+ "description": "Label background color",
380
+ "allOf": [
381
+ {
382
+ "$ref": "#/definitions/ColorLiteral"
383
+ }
384
+ ]
385
+ }
386
+ },
387
+ "required": [
388
+ "line",
389
+ "label"
390
+ ]
391
+ },
392
+ "Dimensions": {
393
+ "id": "Dimensions",
394
+ "description": "Dimensions",
395
+ "type": "object",
396
+ "properties": {
397
+ "width": {
398
+ "type": "number"
399
+ },
400
+ "height": {
401
+ "type": "number"
402
+ }
403
+ },
404
+ "required": [
405
+ "width",
406
+ "height"
407
+ ]
408
+ },
409
+ "DefaultStyleValues": {
410
+ "id": "DefaultStyleValues",
411
+ "description": "Override default values for style properties\nThese values will be used if such property is not defined",
412
+ "type": "object",
413
+ "properties": {
414
+ "color": {
415
+ "allOf": [
416
+ {
417
+ "$ref": "#/definitions/ColorName"
418
+ }
419
+ ]
420
+ },
421
+ "opacity": {
422
+ "allOf": [
423
+ {
424
+ "$ref": "#/definitions/Opacity"
425
+ }
426
+ ]
427
+ },
428
+ "border": {
429
+ "allOf": [
430
+ {
431
+ "$ref": "#/definitions/BorderStyle"
432
+ }
433
+ ]
434
+ },
435
+ "size": {
436
+ "allOf": [
437
+ {
438
+ "$ref": "#/definitions/ElementSize"
439
+ }
440
+ ]
441
+ },
442
+ "shape": {
443
+ "allOf": [
444
+ {
445
+ "$ref": "#/definitions/ElementShape"
446
+ }
447
+ ]
448
+ },
449
+ "group": {
450
+ "type": "object",
451
+ "properties": {
452
+ "color": {
453
+ "allOf": [
454
+ {
455
+ "$ref": "#/definitions/ColorName"
456
+ }
457
+ ]
458
+ },
459
+ "opacity": {
460
+ "allOf": [
461
+ {
462
+ "$ref": "#/definitions/Opacity"
463
+ }
464
+ ]
465
+ },
466
+ "border": {
467
+ "allOf": [
468
+ {
469
+ "$ref": "#/definitions/BorderStyle"
470
+ }
471
+ ]
472
+ }
473
+ }
474
+ },
475
+ "relationship": {
476
+ "type": "object",
477
+ "properties": {
478
+ "color": {
479
+ "allOf": [
480
+ {
481
+ "$ref": "#/definitions/ColorName"
482
+ }
483
+ ]
484
+ },
485
+ "line": {
486
+ "allOf": [
487
+ {
488
+ "$ref": "#/definitions/LineType"
489
+ }
490
+ ]
491
+ },
492
+ "arrow": {
493
+ "allOf": [
494
+ {
495
+ "$ref": "#/definitions/ArrowType"
496
+ }
497
+ ]
498
+ }
499
+ }
500
+ }
501
+ }
502
+ },
503
+ "Opacity": {
504
+ "id": "Opacity",
505
+ "description": "Opacity 0%-100%",
506
+ "type": "number",
507
+ "minimum": 0,
508
+ "maximum": 100
509
+ },
510
+ "BorderStyle": {
511
+ "id": "BorderStyle",
512
+ "description": "Border style",
513
+ "type": "string",
514
+ "enum": [
515
+ "solid",
516
+ "dashed",
517
+ "dotted",
518
+ "none"
519
+ ]
520
+ },
521
+ "ElementSize": {
522
+ "id": "ElementSize",
523
+ "description": "Element size",
524
+ "type": "string",
525
+ "enum": [
526
+ "xs",
527
+ "sm",
528
+ "md",
529
+ "lg",
530
+ "xl"
531
+ ]
532
+ },
533
+ "ElementShape": {
534
+ "id": "ElementShape",
535
+ "description": "Element shape",
536
+ "type": "string",
537
+ "enum": [
538
+ "rectangle",
539
+ "person",
540
+ "browser",
541
+ "mobile",
542
+ "cylinder",
543
+ "storage",
544
+ "queue"
545
+ ]
546
+ },
547
+ "LineType": {
548
+ "id": "LineType",
549
+ "description": "Default line type for relationships",
550
+ "type": "string",
551
+ "enum": [
552
+ "dashed",
553
+ "solid",
554
+ "dotted"
555
+ ]
556
+ },
557
+ "ArrowType": {
558
+ "id": "ArrowType",
559
+ "description": "Relationship arrow type",
560
+ "type": "string",
561
+ "enum": [
562
+ "none",
563
+ "normal",
564
+ "onormal",
565
+ "dot",
566
+ "odot",
567
+ "diamond",
568
+ "odiamond",
569
+ "crow",
570
+ "open",
571
+ "vee"
572
+ ]
573
+ }
574
+ }
575
+ }