likec4 1.0.2 → 1.1.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/__app__/react/likec4.tsx +5 -2
- package/dist/__app__/src/lib/webcomponent.mjs +332 -1161
- package/dist/__app__/src/{main-DDd-kcC2.js → main-Ccc7-VWf.js} +384 -1217
- package/dist/__app__/src/main.js +1 -1
- package/dist/__app__/src/style.css +1 -1
- package/dist/__app__/src/{view._viewId.d2.lazy-DTd-VfOz.js → view._viewId.d2.lazy-BX8VfXLS.js} +2 -2
- package/dist/__app__/src/{view._viewId.dot.lazy-DC6I8DnA.js → view._viewId.dot.lazy-_gnghLVA.js} +2 -2
- package/dist/__app__/src/{view._viewId.mmd.lazy-CkKTxoM5.js → view._viewId.mmd.lazy-o20hkhat.js} +2 -2
- package/dist/__app__/src/{view._viewId.react-legacy.lazy-D82hW8RW.js → view._viewId.react-legacy.lazy-DvQqUilU.js} +490 -24
- package/dist/__app__/src/{view_viewId_.css-Dhp7OfYa.js → view_viewId_.css-DBWYV6RO.js} +1 -1
- package/dist/cli/index.mjs +292 -280
- package/package.json +8 -8
- package/react/LikeC4Browser.d.ts +1 -1
- package/react/LikeC4ViewElement.d.ts +2 -2
- package/react/ShadowRoot.d.ts +1 -1
- package/react/index.mjs +387 -1182
- package/react/styles.d.ts +3 -1
- package/react/types.d.ts +12 -0
package/dist/__app__/src/{view._viewId.d2.lazy-DTd-VfOz.js → view._viewId.d2.lazy-BX8VfXLS.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as PanelGroup, a as Panel, c as cssScrollArea, b as cssCodeBlock, C as CopyToClipboard, d as PanelResizeHandle } from "./view_viewId_.css-
|
|
1
|
+
import { l as createLazyFileRoute, j as jsxRuntimeExports, S as ScrollArea, C as Code, p as notFound } from "./main-Ccc7-VWf.js";
|
|
2
|
+
import { P as PanelGroup, a as Panel, c as cssScrollArea, b as cssCodeBlock, C as CopyToClipboard, d as PanelResizeHandle } from "./view_viewId_.css-DBWYV6RO.js";
|
|
3
3
|
import { d2Source } from "virtual:likec4/d2-sources";
|
|
4
4
|
const Route = createLazyFileRoute("/view/$viewId/d2")({
|
|
5
5
|
component: ViewAsD2
|
package/dist/__app__/src/{view._viewId.dot.lazy-DC6I8DnA.js → view._viewId.dot.lazy-_gnghLVA.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as PanelGroup, a as Panel, c as cssScrollArea, b as cssCodeBlock, C as CopyToClipboard, d as PanelResizeHandle } from "./view_viewId_.css-
|
|
1
|
+
import { l as createLazyFileRoute, j as jsxRuntimeExports, S as ScrollArea, C as Code, q as svgContainer, p as notFound } from "./main-Ccc7-VWf.js";
|
|
2
|
+
import { P as PanelGroup, a as Panel, c as cssScrollArea, b as cssCodeBlock, C as CopyToClipboard, d as PanelResizeHandle } from "./view_viewId_.css-DBWYV6RO.js";
|
|
3
3
|
import { dotSource, svgSource } from "virtual:likec4/dot-sources";
|
|
4
4
|
const Route = createLazyFileRoute("/view/$viewId/dot")({
|
|
5
5
|
component: ViewAsDot
|
package/dist/__app__/src/{view._viewId.mmd.lazy-CkKTxoM5.js → view._viewId.mmd.lazy-o20hkhat.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as reactExports, b as useSyncedRef,
|
|
2
|
-
import { P as PanelGroup, a as Panel, c as cssScrollArea, b as cssCodeBlock, C as CopyToClipboard, d as PanelResizeHandle } from "./view_viewId_.css-
|
|
1
|
+
import { r as reactExports, b as useSyncedRef, l as createLazyFileRoute, j as jsxRuntimeExports, S as ScrollArea, C as Code, q as svgContainer, p as notFound } from "./main-Ccc7-VWf.js";
|
|
2
|
+
import { P as PanelGroup, a as Panel, c as cssScrollArea, b as cssCodeBlock, C as CopyToClipboard, d as PanelResizeHandle } from "./view_viewId_.css-DBWYV6RO.js";
|
|
3
3
|
import { mmdSource } from "virtual:likec4/mmd-sources";
|
|
4
4
|
function useAsync(asyncFn, initialValue) {
|
|
5
5
|
const [state, setState] = reactExports.useState({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as reactExports, u as useRafCallback, a as useUnmountEffect, b as useSyncedRef$1, c as useFirstMountState, i as isBrowser$1, d as
|
|
1
|
+
import { r as reactExports, u as useRafCallback, a as useUnmountEffect, b as useSyncedRef$1, c as useFirstMountState, i as isBrowser$1, d as commonjsGlobal, g as getDefaultExportFromCjs, s as schedulerExports, R as React, j as jsxRuntimeExports, e as invariant, n as nonexhaustive, f as useUpdateEffect, h as nonNullable, k as defaultTheme, B as Box, l as createLazyFileRoute, m as useRouter, o as useLikeC4View, p as notFound } from "./main-Ccc7-VWf.js";
|
|
2
2
|
function useIsMounted$1(initialValue = !1) {
|
|
3
3
|
const isMounted = reactExports.useRef(initialValue), get = reactExports.useCallback(() => isMounted.current, []);
|
|
4
4
|
return reactExports.useEffect(() => (isMounted.current = !0, () => {
|
|
@@ -61,23 +61,7 @@ function useWindowSize(stateHook = useRafState, measureOnMount) {
|
|
|
61
61
|
listeners.delete(setSize), listeners.size === 0 && window.removeEventListener("resize", callAllListeners);
|
|
62
62
|
}), [setSize]), size;
|
|
63
63
|
}
|
|
64
|
-
const DefaultLineStyle = "dashed", DefaultArrowType = "normal", DefaultRelationshipColor = "gray"
|
|
65
|
-
if (typeof r != "number")
|
|
66
|
-
return change(r, { a: g });
|
|
67
|
-
const channels$1 = channels.set({
|
|
68
|
-
r: Utils.channel.clamp.r(r),
|
|
69
|
-
g: Utils.channel.clamp.g(g),
|
|
70
|
-
b: Utils.channel.clamp.b(b),
|
|
71
|
-
a: Utils.channel.clamp.a(a)
|
|
72
|
-
});
|
|
73
|
-
return Color.stringify(channels$1);
|
|
74
|
-
}, rgba$2 = rgba$1, adjustChannel = (color, channel, amount) => {
|
|
75
|
-
const channels2 = Color.parse(color), amountCurrent = channels2[channel], amountNext = Utils.channel.clamp[channel](amountCurrent + amount);
|
|
76
|
-
return amountCurrent !== amountNext && (channels2[channel] = amountNext), Color.stringify(channels2);
|
|
77
|
-
}, adjustChannel$1 = adjustChannel, lighten = (color, amount) => adjustChannel$1(color, "l", amount), lighten$1 = lighten, mix = (color1, color2, weight = 50) => {
|
|
78
|
-
const { r: r1, g: g1, b: b1, a: a1 } = Color.parse(color1), { r: r2, g: g2, b: b2, a: a2 } = Color.parse(color2), weightScale = weight / 100, weightNormalized = weightScale * 2 - 1, alphaDelta = a1 - a2, weight1 = ((weightNormalized * alphaDelta === -1 ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta)) + 1) / 2, weight2 = 1 - weight1, r = r1 * weight1 + r2 * weight2, g = g1 * weight1 + g2 * weight2, b = b1 * weight1 + b2 * weight2, a = a1 * weightScale + a2 * (1 - weightScale);
|
|
79
|
-
return rgba$2(r, g, b, a);
|
|
80
|
-
}, mix$1 = mix;
|
|
64
|
+
const DefaultLineStyle = "dashed", DefaultArrowType = "normal", DefaultRelationshipColor = "gray";
|
|
81
65
|
var __defProp$1 = Object.defineProperty, __export = (target, all) => {
|
|
82
66
|
for (var name in all)
|
|
83
67
|
__defProp$1(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -438,7 +422,7 @@ var clamp$2 = (min, max, v) => Math.min(Math.max(v, min), max), colors2 = {
|
|
|
438
422
|
function call$1(...parts) {
|
|
439
423
|
return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)";
|
|
440
424
|
}
|
|
441
|
-
var rgb = new RegExp("rgb" + call$1(NUMBER, NUMBER, NUMBER)), rgba = new RegExp("rgba" + call$1(NUMBER, NUMBER, NUMBER, NUMBER)), hsl = new RegExp("hsl" + call$1(NUMBER, PERCENTAGE, PERCENTAGE)), hsla = new RegExp(
|
|
425
|
+
var rgb = new RegExp("rgb" + call$1(NUMBER, NUMBER, NUMBER)), rgba$2 = new RegExp("rgba" + call$1(NUMBER, NUMBER, NUMBER, NUMBER)), hsl = new RegExp("hsl" + call$1(NUMBER, PERCENTAGE, PERCENTAGE)), hsla = new RegExp(
|
|
442
426
|
"hsla" + call$1(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)
|
|
443
427
|
), hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6 = /^#([0-9a-fA-F]{6})$/, hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
444
428
|
function normalizeColor(color) {
|
|
@@ -447,7 +431,7 @@ function normalizeColor(color) {
|
|
|
447
431
|
parse255(match[2]) << 16 | // g
|
|
448
432
|
parse255(match[3]) << 8 | // b
|
|
449
433
|
255) >>> // a
|
|
450
|
-
0 : (match = rgba.exec(color)) ? (parse255(match[1]) << 24 | // r
|
|
434
|
+
0 : (match = rgba$2.exec(color)) ? (parse255(match[1]) << 24 | // r
|
|
451
435
|
parse255(match[2]) << 16 | // g
|
|
452
436
|
parse255(match[3]) << 8 | // b
|
|
453
437
|
parse1(match[4])) >>> // a
|
|
@@ -12174,7 +12158,489 @@ const AnimatedStage = /* @__PURE__ */ animated(Stage), AnimatedRect = /* @__PURE
|
|
|
12174
12158
|
return ctor !== b.constructor ? !1 : ctor === Array ? compareArrays(a, b, isEqual) : ctor === Date ? compareDates(a, b) : ctor === RegExp ? compareRegexps(a, b) : a.valueOf !== valueOf ? a.valueOf() === b.valueOf() : a.toString !== toString ? a.toString() === b.toString() : compareObjects(a, b, isEqual);
|
|
12175
12159
|
}
|
|
12176
12160
|
return a !== a && b !== b;
|
|
12161
|
+
}, Channel = {
|
|
12162
|
+
/* CLAMP */
|
|
12163
|
+
min: {
|
|
12164
|
+
r: 0,
|
|
12165
|
+
g: 0,
|
|
12166
|
+
b: 0,
|
|
12167
|
+
s: 0,
|
|
12168
|
+
l: 0,
|
|
12169
|
+
a: 0
|
|
12170
|
+
},
|
|
12171
|
+
max: {
|
|
12172
|
+
r: 255,
|
|
12173
|
+
g: 255,
|
|
12174
|
+
b: 255,
|
|
12175
|
+
h: 360,
|
|
12176
|
+
s: 100,
|
|
12177
|
+
l: 100,
|
|
12178
|
+
a: 1
|
|
12179
|
+
},
|
|
12180
|
+
clamp: {
|
|
12181
|
+
r: (r) => r >= 255 ? 255 : r < 0 ? 0 : r,
|
|
12182
|
+
g: (g) => g >= 255 ? 255 : g < 0 ? 0 : g,
|
|
12183
|
+
b: (b) => b >= 255 ? 255 : b < 0 ? 0 : b,
|
|
12184
|
+
h: (h) => h % 360,
|
|
12185
|
+
s: (s) => s >= 100 ? 100 : s < 0 ? 0 : s,
|
|
12186
|
+
l: (l) => l >= 100 ? 100 : l < 0 ? 0 : l,
|
|
12187
|
+
a: (a) => a >= 1 ? 1 : a < 0 ? 0 : a
|
|
12188
|
+
},
|
|
12189
|
+
/* CONVERSION */
|
|
12190
|
+
//SOURCE: https://planetcalc.com/7779
|
|
12191
|
+
toLinear: (c) => {
|
|
12192
|
+
const n = c / 255;
|
|
12193
|
+
return c > 0.03928 ? Math.pow((n + 0.055) / 1.055, 2.4) : n / 12.92;
|
|
12194
|
+
},
|
|
12195
|
+
//SOURCE: https://gist.github.com/mjackson/5311256
|
|
12196
|
+
hue2rgb: (p, q, t) => (t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? p + (q - p) * 6 * t : t < 1 / 2 ? q : t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 : p),
|
|
12197
|
+
hsl2rgb: ({ h, s, l }, channel) => {
|
|
12198
|
+
if (!s)
|
|
12199
|
+
return l * 2.55;
|
|
12200
|
+
h /= 360, s /= 100, l /= 100;
|
|
12201
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q;
|
|
12202
|
+
switch (channel) {
|
|
12203
|
+
case "r":
|
|
12204
|
+
return Channel.hue2rgb(p, q, h + 1 / 3) * 255;
|
|
12205
|
+
case "g":
|
|
12206
|
+
return Channel.hue2rgb(p, q, h) * 255;
|
|
12207
|
+
case "b":
|
|
12208
|
+
return Channel.hue2rgb(p, q, h - 1 / 3) * 255;
|
|
12209
|
+
}
|
|
12210
|
+
},
|
|
12211
|
+
rgb2hsl: ({ r, g, b }, channel) => {
|
|
12212
|
+
r /= 255, g /= 255, b /= 255;
|
|
12213
|
+
const max = Math.max(r, g, b), min = Math.min(r, g, b), l = (max + min) / 2;
|
|
12214
|
+
if (channel === "l")
|
|
12215
|
+
return l * 100;
|
|
12216
|
+
if (max === min)
|
|
12217
|
+
return 0;
|
|
12218
|
+
const d = max - min, s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
12219
|
+
if (channel === "s")
|
|
12220
|
+
return s * 100;
|
|
12221
|
+
switch (max) {
|
|
12222
|
+
case r:
|
|
12223
|
+
return ((g - b) / d + (g < b ? 6 : 0)) * 60;
|
|
12224
|
+
case g:
|
|
12225
|
+
return ((b - r) / d + 2) * 60;
|
|
12226
|
+
case b:
|
|
12227
|
+
return ((r - g) / d + 4) * 60;
|
|
12228
|
+
default:
|
|
12229
|
+
return -1;
|
|
12230
|
+
}
|
|
12231
|
+
}
|
|
12232
|
+
}, Lang = {
|
|
12233
|
+
/* API */
|
|
12234
|
+
clamp: (number, lower, upper) => lower > upper ? Math.min(lower, Math.max(upper, number)) : Math.min(upper, Math.max(lower, number)),
|
|
12235
|
+
round: (number) => Math.round(number * 1e10) / 1e10
|
|
12236
|
+
}, lang = Lang, Unit = {
|
|
12237
|
+
/* API */
|
|
12238
|
+
dec2hex: (dec) => {
|
|
12239
|
+
const hex = Math.round(dec).toString(16);
|
|
12240
|
+
return hex.length > 1 ? hex : `0${hex}`;
|
|
12241
|
+
}
|
|
12242
|
+
}, unit = Unit, Utils = {
|
|
12243
|
+
channel: Channel,
|
|
12244
|
+
lang,
|
|
12245
|
+
unit
|
|
12246
|
+
}, DEC2HEX = {};
|
|
12247
|
+
for (let i = 0; i <= 255; i++)
|
|
12248
|
+
DEC2HEX[i] = Utils.unit.dec2hex(i);
|
|
12249
|
+
const TYPE = {
|
|
12250
|
+
ALL: 0,
|
|
12251
|
+
RGB: 1,
|
|
12252
|
+
HSL: 2
|
|
12177
12253
|
};
|
|
12254
|
+
class Type {
|
|
12255
|
+
constructor() {
|
|
12256
|
+
this.type = TYPE.ALL;
|
|
12257
|
+
}
|
|
12258
|
+
/* API */
|
|
12259
|
+
get() {
|
|
12260
|
+
return this.type;
|
|
12261
|
+
}
|
|
12262
|
+
set(type2) {
|
|
12263
|
+
if (this.type && this.type !== type2)
|
|
12264
|
+
throw new Error("Cannot change both RGB and HSL channels at the same time");
|
|
12265
|
+
this.type = type2;
|
|
12266
|
+
}
|
|
12267
|
+
reset() {
|
|
12268
|
+
this.type = TYPE.ALL;
|
|
12269
|
+
}
|
|
12270
|
+
is(type2) {
|
|
12271
|
+
return this.type === type2;
|
|
12272
|
+
}
|
|
12273
|
+
}
|
|
12274
|
+
class Channels {
|
|
12275
|
+
/* CONSTRUCTOR */
|
|
12276
|
+
constructor(data, color) {
|
|
12277
|
+
this.color = color, this.changed = !1, this.data = data, this.type = new Type();
|
|
12278
|
+
}
|
|
12279
|
+
/* API */
|
|
12280
|
+
set(data, color) {
|
|
12281
|
+
return this.color = color, this.changed = !1, this.data = data, this.type.type = TYPE.ALL, this;
|
|
12282
|
+
}
|
|
12283
|
+
/* HELPERS */
|
|
12284
|
+
_ensureHSL() {
|
|
12285
|
+
const data = this.data, { h, s, l } = data;
|
|
12286
|
+
h === void 0 && (data.h = Utils.channel.rgb2hsl(data, "h")), s === void 0 && (data.s = Utils.channel.rgb2hsl(data, "s")), l === void 0 && (data.l = Utils.channel.rgb2hsl(data, "l"));
|
|
12287
|
+
}
|
|
12288
|
+
_ensureRGB() {
|
|
12289
|
+
const data = this.data, { r, g, b } = data;
|
|
12290
|
+
r === void 0 && (data.r = Utils.channel.hsl2rgb(data, "r")), g === void 0 && (data.g = Utils.channel.hsl2rgb(data, "g")), b === void 0 && (data.b = Utils.channel.hsl2rgb(data, "b"));
|
|
12291
|
+
}
|
|
12292
|
+
/* GETTERS */
|
|
12293
|
+
get r() {
|
|
12294
|
+
const data = this.data, r = data.r;
|
|
12295
|
+
return !this.type.is(TYPE.HSL) && r !== void 0 ? r : (this._ensureHSL(), Utils.channel.hsl2rgb(data, "r"));
|
|
12296
|
+
}
|
|
12297
|
+
get g() {
|
|
12298
|
+
const data = this.data, g = data.g;
|
|
12299
|
+
return !this.type.is(TYPE.HSL) && g !== void 0 ? g : (this._ensureHSL(), Utils.channel.hsl2rgb(data, "g"));
|
|
12300
|
+
}
|
|
12301
|
+
get b() {
|
|
12302
|
+
const data = this.data, b = data.b;
|
|
12303
|
+
return !this.type.is(TYPE.HSL) && b !== void 0 ? b : (this._ensureHSL(), Utils.channel.hsl2rgb(data, "b"));
|
|
12304
|
+
}
|
|
12305
|
+
get h() {
|
|
12306
|
+
const data = this.data, h = data.h;
|
|
12307
|
+
return !this.type.is(TYPE.RGB) && h !== void 0 ? h : (this._ensureRGB(), Utils.channel.rgb2hsl(data, "h"));
|
|
12308
|
+
}
|
|
12309
|
+
get s() {
|
|
12310
|
+
const data = this.data, s = data.s;
|
|
12311
|
+
return !this.type.is(TYPE.RGB) && s !== void 0 ? s : (this._ensureRGB(), Utils.channel.rgb2hsl(data, "s"));
|
|
12312
|
+
}
|
|
12313
|
+
get l() {
|
|
12314
|
+
const data = this.data, l = data.l;
|
|
12315
|
+
return !this.type.is(TYPE.RGB) && l !== void 0 ? l : (this._ensureRGB(), Utils.channel.rgb2hsl(data, "l"));
|
|
12316
|
+
}
|
|
12317
|
+
get a() {
|
|
12318
|
+
return this.data.a;
|
|
12319
|
+
}
|
|
12320
|
+
/* SETTERS */
|
|
12321
|
+
set r(r) {
|
|
12322
|
+
this.type.set(TYPE.RGB), this.changed = !0, this.data.r = r;
|
|
12323
|
+
}
|
|
12324
|
+
set g(g) {
|
|
12325
|
+
this.type.set(TYPE.RGB), this.changed = !0, this.data.g = g;
|
|
12326
|
+
}
|
|
12327
|
+
set b(b) {
|
|
12328
|
+
this.type.set(TYPE.RGB), this.changed = !0, this.data.b = b;
|
|
12329
|
+
}
|
|
12330
|
+
set h(h) {
|
|
12331
|
+
this.type.set(TYPE.HSL), this.changed = !0, this.data.h = h;
|
|
12332
|
+
}
|
|
12333
|
+
set s(s) {
|
|
12334
|
+
this.type.set(TYPE.HSL), this.changed = !0, this.data.s = s;
|
|
12335
|
+
}
|
|
12336
|
+
set l(l) {
|
|
12337
|
+
this.type.set(TYPE.HSL), this.changed = !0, this.data.l = l;
|
|
12338
|
+
}
|
|
12339
|
+
set a(a) {
|
|
12340
|
+
this.changed = !0, this.data.a = a;
|
|
12341
|
+
}
|
|
12342
|
+
}
|
|
12343
|
+
const Channels$1 = Channels, channels = new Channels$1({ r: 0, g: 0, b: 0, a: 0 }, "transparent"), Hex = {
|
|
12344
|
+
/* VARIABLES */
|
|
12345
|
+
re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,
|
|
12346
|
+
/* API */
|
|
12347
|
+
parse: (color) => {
|
|
12348
|
+
if (color.charCodeAt(0) !== 35)
|
|
12349
|
+
return;
|
|
12350
|
+
const match = color.match(Hex.re);
|
|
12351
|
+
if (!match)
|
|
12352
|
+
return;
|
|
12353
|
+
const hex = match[1], dec = parseInt(hex, 16), length = hex.length, hasAlpha = length % 4 === 0, isFullLength = length > 4, multiplier = isFullLength ? 1 : 17, bits = isFullLength ? 8 : 4, bitsOffset = hasAlpha ? 0 : -1, mask = isFullLength ? 255 : 15;
|
|
12354
|
+
return channels.set({
|
|
12355
|
+
r: (dec >> bits * (bitsOffset + 3) & mask) * multiplier,
|
|
12356
|
+
g: (dec >> bits * (bitsOffset + 2) & mask) * multiplier,
|
|
12357
|
+
b: (dec >> bits * (bitsOffset + 1) & mask) * multiplier,
|
|
12358
|
+
a: hasAlpha ? (dec & mask) * multiplier / 255 : 1
|
|
12359
|
+
}, color);
|
|
12360
|
+
},
|
|
12361
|
+
stringify: (channels2) => {
|
|
12362
|
+
const { r, g, b, a } = channels2;
|
|
12363
|
+
return a < 1 ? `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}${DEC2HEX[Math.round(a * 255)]}` : `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}`;
|
|
12364
|
+
}
|
|
12365
|
+
}, HSL = {
|
|
12366
|
+
/* VARIABLES */
|
|
12367
|
+
re: /^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,
|
|
12368
|
+
hueRe: /^(.+?)(deg|grad|rad|turn)$/i,
|
|
12369
|
+
/* HELPERS */
|
|
12370
|
+
_hue2deg: (hue) => {
|
|
12371
|
+
const match = hue.match(HSL.hueRe);
|
|
12372
|
+
if (match) {
|
|
12373
|
+
const [, number, unit2] = match;
|
|
12374
|
+
switch (unit2) {
|
|
12375
|
+
case "grad":
|
|
12376
|
+
return Utils.channel.clamp.h(parseFloat(number) * 0.9);
|
|
12377
|
+
case "rad":
|
|
12378
|
+
return Utils.channel.clamp.h(parseFloat(number) * 180 / Math.PI);
|
|
12379
|
+
case "turn":
|
|
12380
|
+
return Utils.channel.clamp.h(parseFloat(number) * 360);
|
|
12381
|
+
}
|
|
12382
|
+
}
|
|
12383
|
+
return Utils.channel.clamp.h(parseFloat(hue));
|
|
12384
|
+
},
|
|
12385
|
+
/* API */
|
|
12386
|
+
parse: (color) => {
|
|
12387
|
+
const charCode = color.charCodeAt(0);
|
|
12388
|
+
if (charCode !== 104 && charCode !== 72)
|
|
12389
|
+
return;
|
|
12390
|
+
const match = color.match(HSL.re);
|
|
12391
|
+
if (!match)
|
|
12392
|
+
return;
|
|
12393
|
+
const [, h, s, l, a, isAlphaPercentage] = match;
|
|
12394
|
+
return channels.set({
|
|
12395
|
+
h: HSL._hue2deg(h),
|
|
12396
|
+
s: Utils.channel.clamp.s(parseFloat(s)),
|
|
12397
|
+
l: Utils.channel.clamp.l(parseFloat(l)),
|
|
12398
|
+
a: a ? Utils.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
|
|
12399
|
+
}, color);
|
|
12400
|
+
},
|
|
12401
|
+
stringify: (channels2) => {
|
|
12402
|
+
const { h, s, l, a } = channels2;
|
|
12403
|
+
return a < 1 ? `hsla(${Utils.lang.round(h)}, ${Utils.lang.round(s)}%, ${Utils.lang.round(l)}%, ${a})` : `hsl(${Utils.lang.round(h)}, ${Utils.lang.round(s)}%, ${Utils.lang.round(l)}%)`;
|
|
12404
|
+
}
|
|
12405
|
+
}, Keyword = {
|
|
12406
|
+
/* VARIABLES */
|
|
12407
|
+
colors: {
|
|
12408
|
+
aliceblue: "#f0f8ff",
|
|
12409
|
+
antiquewhite: "#faebd7",
|
|
12410
|
+
aqua: "#00ffff",
|
|
12411
|
+
aquamarine: "#7fffd4",
|
|
12412
|
+
azure: "#f0ffff",
|
|
12413
|
+
beige: "#f5f5dc",
|
|
12414
|
+
bisque: "#ffe4c4",
|
|
12415
|
+
black: "#000000",
|
|
12416
|
+
blanchedalmond: "#ffebcd",
|
|
12417
|
+
blue: "#0000ff",
|
|
12418
|
+
blueviolet: "#8a2be2",
|
|
12419
|
+
brown: "#a52a2a",
|
|
12420
|
+
burlywood: "#deb887",
|
|
12421
|
+
cadetblue: "#5f9ea0",
|
|
12422
|
+
chartreuse: "#7fff00",
|
|
12423
|
+
chocolate: "#d2691e",
|
|
12424
|
+
coral: "#ff7f50",
|
|
12425
|
+
cornflowerblue: "#6495ed",
|
|
12426
|
+
cornsilk: "#fff8dc",
|
|
12427
|
+
crimson: "#dc143c",
|
|
12428
|
+
cyanaqua: "#00ffff",
|
|
12429
|
+
darkblue: "#00008b",
|
|
12430
|
+
darkcyan: "#008b8b",
|
|
12431
|
+
darkgoldenrod: "#b8860b",
|
|
12432
|
+
darkgray: "#a9a9a9",
|
|
12433
|
+
darkgreen: "#006400",
|
|
12434
|
+
darkgrey: "#a9a9a9",
|
|
12435
|
+
darkkhaki: "#bdb76b",
|
|
12436
|
+
darkmagenta: "#8b008b",
|
|
12437
|
+
darkolivegreen: "#556b2f",
|
|
12438
|
+
darkorange: "#ff8c00",
|
|
12439
|
+
darkorchid: "#9932cc",
|
|
12440
|
+
darkred: "#8b0000",
|
|
12441
|
+
darksalmon: "#e9967a",
|
|
12442
|
+
darkseagreen: "#8fbc8f",
|
|
12443
|
+
darkslateblue: "#483d8b",
|
|
12444
|
+
darkslategray: "#2f4f4f",
|
|
12445
|
+
darkslategrey: "#2f4f4f",
|
|
12446
|
+
darkturquoise: "#00ced1",
|
|
12447
|
+
darkviolet: "#9400d3",
|
|
12448
|
+
deeppink: "#ff1493",
|
|
12449
|
+
deepskyblue: "#00bfff",
|
|
12450
|
+
dimgray: "#696969",
|
|
12451
|
+
dimgrey: "#696969",
|
|
12452
|
+
dodgerblue: "#1e90ff",
|
|
12453
|
+
firebrick: "#b22222",
|
|
12454
|
+
floralwhite: "#fffaf0",
|
|
12455
|
+
forestgreen: "#228b22",
|
|
12456
|
+
fuchsia: "#ff00ff",
|
|
12457
|
+
gainsboro: "#dcdcdc",
|
|
12458
|
+
ghostwhite: "#f8f8ff",
|
|
12459
|
+
gold: "#ffd700",
|
|
12460
|
+
goldenrod: "#daa520",
|
|
12461
|
+
gray: "#808080",
|
|
12462
|
+
green: "#008000",
|
|
12463
|
+
greenyellow: "#adff2f",
|
|
12464
|
+
grey: "#808080",
|
|
12465
|
+
honeydew: "#f0fff0",
|
|
12466
|
+
hotpink: "#ff69b4",
|
|
12467
|
+
indianred: "#cd5c5c",
|
|
12468
|
+
indigo: "#4b0082",
|
|
12469
|
+
ivory: "#fffff0",
|
|
12470
|
+
khaki: "#f0e68c",
|
|
12471
|
+
lavender: "#e6e6fa",
|
|
12472
|
+
lavenderblush: "#fff0f5",
|
|
12473
|
+
lawngreen: "#7cfc00",
|
|
12474
|
+
lemonchiffon: "#fffacd",
|
|
12475
|
+
lightblue: "#add8e6",
|
|
12476
|
+
lightcoral: "#f08080",
|
|
12477
|
+
lightcyan: "#e0ffff",
|
|
12478
|
+
lightgoldenrodyellow: "#fafad2",
|
|
12479
|
+
lightgray: "#d3d3d3",
|
|
12480
|
+
lightgreen: "#90ee90",
|
|
12481
|
+
lightgrey: "#d3d3d3",
|
|
12482
|
+
lightpink: "#ffb6c1",
|
|
12483
|
+
lightsalmon: "#ffa07a",
|
|
12484
|
+
lightseagreen: "#20b2aa",
|
|
12485
|
+
lightskyblue: "#87cefa",
|
|
12486
|
+
lightslategray: "#778899",
|
|
12487
|
+
lightslategrey: "#778899",
|
|
12488
|
+
lightsteelblue: "#b0c4de",
|
|
12489
|
+
lightyellow: "#ffffe0",
|
|
12490
|
+
lime: "#00ff00",
|
|
12491
|
+
limegreen: "#32cd32",
|
|
12492
|
+
linen: "#faf0e6",
|
|
12493
|
+
magenta: "#ff00ff",
|
|
12494
|
+
maroon: "#800000",
|
|
12495
|
+
mediumaquamarine: "#66cdaa",
|
|
12496
|
+
mediumblue: "#0000cd",
|
|
12497
|
+
mediumorchid: "#ba55d3",
|
|
12498
|
+
mediumpurple: "#9370db",
|
|
12499
|
+
mediumseagreen: "#3cb371",
|
|
12500
|
+
mediumslateblue: "#7b68ee",
|
|
12501
|
+
mediumspringgreen: "#00fa9a",
|
|
12502
|
+
mediumturquoise: "#48d1cc",
|
|
12503
|
+
mediumvioletred: "#c71585",
|
|
12504
|
+
midnightblue: "#191970",
|
|
12505
|
+
mintcream: "#f5fffa",
|
|
12506
|
+
mistyrose: "#ffe4e1",
|
|
12507
|
+
moccasin: "#ffe4b5",
|
|
12508
|
+
navajowhite: "#ffdead",
|
|
12509
|
+
navy: "#000080",
|
|
12510
|
+
oldlace: "#fdf5e6",
|
|
12511
|
+
olive: "#808000",
|
|
12512
|
+
olivedrab: "#6b8e23",
|
|
12513
|
+
orange: "#ffa500",
|
|
12514
|
+
orangered: "#ff4500",
|
|
12515
|
+
orchid: "#da70d6",
|
|
12516
|
+
palegoldenrod: "#eee8aa",
|
|
12517
|
+
palegreen: "#98fb98",
|
|
12518
|
+
paleturquoise: "#afeeee",
|
|
12519
|
+
palevioletred: "#db7093",
|
|
12520
|
+
papayawhip: "#ffefd5",
|
|
12521
|
+
peachpuff: "#ffdab9",
|
|
12522
|
+
peru: "#cd853f",
|
|
12523
|
+
pink: "#ffc0cb",
|
|
12524
|
+
plum: "#dda0dd",
|
|
12525
|
+
powderblue: "#b0e0e6",
|
|
12526
|
+
purple: "#800080",
|
|
12527
|
+
rebeccapurple: "#663399",
|
|
12528
|
+
red: "#ff0000",
|
|
12529
|
+
rosybrown: "#bc8f8f",
|
|
12530
|
+
royalblue: "#4169e1",
|
|
12531
|
+
saddlebrown: "#8b4513",
|
|
12532
|
+
salmon: "#fa8072",
|
|
12533
|
+
sandybrown: "#f4a460",
|
|
12534
|
+
seagreen: "#2e8b57",
|
|
12535
|
+
seashell: "#fff5ee",
|
|
12536
|
+
sienna: "#a0522d",
|
|
12537
|
+
silver: "#c0c0c0",
|
|
12538
|
+
skyblue: "#87ceeb",
|
|
12539
|
+
slateblue: "#6a5acd",
|
|
12540
|
+
slategray: "#708090",
|
|
12541
|
+
slategrey: "#708090",
|
|
12542
|
+
snow: "#fffafa",
|
|
12543
|
+
springgreen: "#00ff7f",
|
|
12544
|
+
tan: "#d2b48c",
|
|
12545
|
+
teal: "#008080",
|
|
12546
|
+
thistle: "#d8bfd8",
|
|
12547
|
+
transparent: "#00000000",
|
|
12548
|
+
turquoise: "#40e0d0",
|
|
12549
|
+
violet: "#ee82ee",
|
|
12550
|
+
wheat: "#f5deb3",
|
|
12551
|
+
white: "#ffffff",
|
|
12552
|
+
whitesmoke: "#f5f5f5",
|
|
12553
|
+
yellow: "#ffff00",
|
|
12554
|
+
yellowgreen: "#9acd32"
|
|
12555
|
+
},
|
|
12556
|
+
/* API */
|
|
12557
|
+
parse: (color) => {
|
|
12558
|
+
color = color.toLowerCase();
|
|
12559
|
+
const hex = Keyword.colors[color];
|
|
12560
|
+
if (hex)
|
|
12561
|
+
return Hex.parse(hex);
|
|
12562
|
+
},
|
|
12563
|
+
stringify: (channels2) => {
|
|
12564
|
+
const hex = Hex.stringify(channels2);
|
|
12565
|
+
for (const name in Keyword.colors)
|
|
12566
|
+
if (Keyword.colors[name] === hex)
|
|
12567
|
+
return name;
|
|
12568
|
+
}
|
|
12569
|
+
}, RGB = {
|
|
12570
|
+
/* VARIABLES */
|
|
12571
|
+
re: /^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,
|
|
12572
|
+
/* API */
|
|
12573
|
+
parse: (color) => {
|
|
12574
|
+
const charCode = color.charCodeAt(0);
|
|
12575
|
+
if (charCode !== 114 && charCode !== 82)
|
|
12576
|
+
return;
|
|
12577
|
+
const match = color.match(RGB.re);
|
|
12578
|
+
if (!match)
|
|
12579
|
+
return;
|
|
12580
|
+
const [, r, isRedPercentage, g, isGreenPercentage, b, isBluePercentage, a, isAlphaPercentage] = match;
|
|
12581
|
+
return channels.set({
|
|
12582
|
+
r: Utils.channel.clamp.r(isRedPercentage ? parseFloat(r) * 2.55 : parseFloat(r)),
|
|
12583
|
+
g: Utils.channel.clamp.g(isGreenPercentage ? parseFloat(g) * 2.55 : parseFloat(g)),
|
|
12584
|
+
b: Utils.channel.clamp.b(isBluePercentage ? parseFloat(b) * 2.55 : parseFloat(b)),
|
|
12585
|
+
a: a ? Utils.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
|
|
12586
|
+
}, color);
|
|
12587
|
+
},
|
|
12588
|
+
stringify: (channels2) => {
|
|
12589
|
+
const { r, g, b, a } = channels2;
|
|
12590
|
+
return a < 1 ? `rgba(${Utils.lang.round(r)}, ${Utils.lang.round(g)}, ${Utils.lang.round(b)}, ${Utils.lang.round(a)})` : `rgb(${Utils.lang.round(r)}, ${Utils.lang.round(g)}, ${Utils.lang.round(b)})`;
|
|
12591
|
+
}
|
|
12592
|
+
}, Color = {
|
|
12593
|
+
/* VARIABLES */
|
|
12594
|
+
format: {
|
|
12595
|
+
keyword: Keyword,
|
|
12596
|
+
hex: Hex,
|
|
12597
|
+
rgb: RGB,
|
|
12598
|
+
rgba: RGB,
|
|
12599
|
+
hsl: HSL,
|
|
12600
|
+
hsla: HSL
|
|
12601
|
+
},
|
|
12602
|
+
/* API */
|
|
12603
|
+
parse: (color) => {
|
|
12604
|
+
if (typeof color != "string")
|
|
12605
|
+
return color;
|
|
12606
|
+
const channels2 = Hex.parse(color) || RGB.parse(color) || HSL.parse(color) || Keyword.parse(color);
|
|
12607
|
+
if (channels2)
|
|
12608
|
+
return channels2;
|
|
12609
|
+
throw new Error(`Unsupported color format: "${color}"`);
|
|
12610
|
+
},
|
|
12611
|
+
stringify: (channels2) => !channels2.changed && channels2.color ? channels2.color : channels2.type.is(TYPE.HSL) || channels2.data.r === void 0 ? HSL.stringify(channels2) : channels2.a < 1 || !Number.isInteger(channels2.r) || !Number.isInteger(channels2.g) || !Number.isInteger(channels2.b) ? RGB.stringify(channels2) : Hex.stringify(channels2)
|
|
12612
|
+
}, change = (color, channels2) => {
|
|
12613
|
+
const ch = Color.parse(color);
|
|
12614
|
+
for (const c in channels2)
|
|
12615
|
+
ch[c] = Utils.channel.clamp[c](channels2[c]);
|
|
12616
|
+
return Color.stringify(ch);
|
|
12617
|
+
}, change$1 = change, rgba = (r, g, b = 0, a = 1) => {
|
|
12618
|
+
if (typeof r != "number")
|
|
12619
|
+
return change$1(r, { a: g });
|
|
12620
|
+
const channels$1 = channels.set({
|
|
12621
|
+
r: Utils.channel.clamp.r(r),
|
|
12622
|
+
g: Utils.channel.clamp.g(g),
|
|
12623
|
+
b: Utils.channel.clamp.b(b),
|
|
12624
|
+
a: Utils.channel.clamp.a(a)
|
|
12625
|
+
});
|
|
12626
|
+
return Color.stringify(channels$1);
|
|
12627
|
+
}, rgba$1 = rgba, toHex = (color) => Color.format.hex.stringify(Color.parse(color)), adjustChannel = (color, channel, amount) => {
|
|
12628
|
+
const channels2 = Color.parse(color), amountCurrent = channels2[channel], amountNext = Utils.channel.clamp[channel](amountCurrent + amount);
|
|
12629
|
+
return amountCurrent !== amountNext && (channels2[channel] = amountNext), Color.stringify(channels2);
|
|
12630
|
+
}, adjustChannel$1 = adjustChannel, lighten = (color, amount) => adjustChannel$1(color, "l", amount), lighten$1 = lighten, adjust = (color, channels2) => {
|
|
12631
|
+
const ch = Color.parse(color), changes = {};
|
|
12632
|
+
for (const c in channels2)
|
|
12633
|
+
channels2[c] && (changes[c] = ch[c] + channels2[c]);
|
|
12634
|
+
return change$1(color, changes);
|
|
12635
|
+
}, adjust$1 = adjust, mix = (color1, color2, weight = 50) => {
|
|
12636
|
+
const { r: r1, g: g1, b: b1, a: a1 } = Color.parse(color1), { r: r2, g: g2, b: b2, a: a2 } = Color.parse(color2), weightScale = weight / 100, weightNormalized = weightScale * 2 - 1, alphaDelta = a1 - a2, weight1 = ((weightNormalized * alphaDelta === -1 ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta)) + 1) / 2, weight2 = 1 - weight1, r = r1 * weight1 + r2 * weight2, g = g1 * weight1 + g2 * weight2, b = b1 * weight1 + b2 * weight2, a = a1 * weightScale + a2 * (1 - weightScale);
|
|
12637
|
+
return rgba$1(r, g, b, a);
|
|
12638
|
+
}, mix$1 = mix, scale = (color, channels2) => {
|
|
12639
|
+
const ch = Color.parse(color), adjustments = {}, delta = (amount, weight, max) => weight > 0 ? (max - amount) * weight / 100 : amount * weight / 100;
|
|
12640
|
+
for (const c in channels2)
|
|
12641
|
+
adjustments[c] = delta(ch[c], channels2[c], Utils.channel.max[c]);
|
|
12642
|
+
return adjust$1(color, adjustments);
|
|
12643
|
+
}, scale$1 = scale;
|
|
12178
12644
|
function EdgeArrow({
|
|
12179
12645
|
arrowType,
|
|
12180
12646
|
points,
|
|
@@ -12822,18 +13288,18 @@ function DiagramStateProvider({ children }) {
|
|
|
12822
13288
|
}
|
|
12823
13289
|
const edgeColors = memoize((colors3, isHovered) => isHovered ? {
|
|
12824
13290
|
lineColor: toHex(
|
|
12825
|
-
scale(colors3.lineColor, {
|
|
13291
|
+
scale$1(colors3.lineColor, {
|
|
12826
13292
|
l: 30
|
|
12827
13293
|
})
|
|
12828
13294
|
),
|
|
12829
13295
|
labelColor: toHex(
|
|
12830
|
-
scale(colors3.labelColor, {
|
|
13296
|
+
scale$1(colors3.labelColor, {
|
|
12831
13297
|
l: 40,
|
|
12832
13298
|
s: 5
|
|
12833
13299
|
})
|
|
12834
13300
|
),
|
|
12835
13301
|
labelBgColor: toHex(
|
|
12836
|
-
scale(colors3.labelBgColor, {
|
|
13302
|
+
scale$1(colors3.labelBgColor, {
|
|
12837
13303
|
l: -10
|
|
12838
13304
|
})
|
|
12839
13305
|
)
|
|
@@ -14455,7 +14921,7 @@ function CompoundShape({ node, theme, springs, labelOffsetX = 0 }) {
|
|
|
14455
14921
|
}
|
|
14456
14922
|
const compoundColor = memoize(
|
|
14457
14923
|
(color, depth) => toHex(
|
|
14458
|
-
scale(color, {
|
|
14924
|
+
scale$1(color, {
|
|
14459
14925
|
l: -35 - 5 * depth,
|
|
14460
14926
|
s: -15 - 5 * depth
|
|
14461
14927
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as React, j as jsxRuntimeExports, B as Box, v as CopyButton$1, T as Tooltip, A as ActionIcon, I as IconCheck, w as rem, x as IconCopy } from "./main-Ccc7-VWf.js";
|
|
2
2
|
const {
|
|
3
3
|
createElement,
|
|
4
4
|
createContext,
|