likec4 1.56.0 → 1.58.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/__app__/codegen/react.mjs +7 -8
- package/__app__/codegen/webcomponent.mjs +77 -736
- package/__app__/src/aichat/index.mjs +8 -0
- package/__app__/src/chunks/AIChat.mjs +959 -0
- package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
- package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
- package/__app__/src/chunks/Markdown.mjs +146 -0
- package/__app__/src/chunks/NavigationPanel.mjs +61 -0
- package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
- package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
- package/__app__/src/chunks/es.mjs +439 -0
- package/__app__/src/chunks/hooks.mjs +145 -0
- package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
- package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
- package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
- package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
- package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
- package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
- package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
- package/__app__/src/chunks/libs/d3.mjs +2842 -0
- package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
- package/__app__/src/chunks/libs/framer.mjs +5872 -0
- package/__app__/src/chunks/libs/remeda.mjs +642 -0
- package/__app__/src/chunks/libs/zod.mjs +3170 -0
- package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
- package/__app__/src/chunks/styled-system.mjs +1040 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +14847 -1
- package/__app__/src/style.css +1 -1
- package/config/schema.json +14 -41
- package/dist/chunks/enableServer.mjs +1 -0
- package/dist/chunks/filenames.mjs +2 -2
- package/dist/chunks/index2.d.mts +2057 -722
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
- package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +9 -0
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +26 -26
- package/dist/chunks/libs/langium.d.mts +5 -5
- package/dist/chunks/libs/langium.mjs +10 -10
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +3 -1
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/libs/zod.d.mts +60 -25
- package/dist/chunks/libs/zod.mjs +65 -0
- package/dist/chunks/node.mjs +84 -56
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +593 -0
- package/dist/cli/index.mjs +184 -141
- package/dist/index.d.mts +2 -131
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +2 -2
- package/dist/vite-plugin/index.d.mts +53 -2
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/index.d.mts +327 -4
- package/dist/vite-plugin/internal/index.mjs +946 -1
- package/package.json +85 -72
- package/react/index.d.mts +174 -73
- package/react/index.mjs +42468 -38926
- package/vite-plugin-modules.d.ts +4 -0
- package/__app__/chunks/ColorSchemeToggle.mjs +0 -1
- package/__app__/chunks/DiagramActorProvider.mjs +0 -10
- package/__app__/chunks/Fallback.mjs +0 -1
- package/__app__/chunks/Header.mjs +0 -13
- package/__app__/chunks/IconRenderer.mjs +0 -1
- package/__app__/chunks/LikeC4Diagram.mjs +0 -19
- package/__app__/chunks/LikeC4ModelContext.mjs +0 -1
- package/__app__/chunks/LikeC4ModelContext2.mjs +0 -1
- package/__app__/chunks/LikeC4Styles.mjs +0 -48
- package/__app__/chunks/NavigationPanel.mjs +0 -1
- package/__app__/chunks/StaticLikeC4Diagram.mjs +0 -1
- package/__app__/chunks/ViewReact.mjs +0 -1
- package/__app__/chunks/__root.mjs +0 -1
- package/__app__/chunks/adhoc-editor.mjs +0 -1
- package/__app__/chunks/hooks.mjs +0 -1
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
- package/__app__/chunks/libs/@mantine/core.mjs +0 -41
- package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
- package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
- package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
- package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -15
- package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
- package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
- package/__app__/chunks/libs/@xstate/react.mjs +0 -1
- package/__app__/chunks/libs/@xstate/store.mjs +0 -1
- package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
- package/__app__/chunks/libs/bezier-js.mjs +0 -1
- package/__app__/chunks/libs/d3-path.mjs +0 -1
- package/__app__/chunks/libs/d3-shape.mjs +0 -1
- package/__app__/chunks/libs/fast-equals.mjs +0 -1
- package/__app__/chunks/libs/framer-motion.mjs +0 -9
- package/__app__/chunks/libs/html-to-image.mjs +0 -2
- package/__app__/chunks/libs/motion-dom.mjs +0 -1
- package/__app__/chunks/libs/motion.mjs +0 -1
- package/__app__/chunks/libs/nanostores.mjs +0 -1
- package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
- package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
- package/__app__/chunks/libs/remeda.mjs +0 -1
- package/__app__/chunks/libs/xstate.mjs +0 -1
- package/__app__/chunks/libs/zod.mjs +0 -39
- package/__app__/chunks/rolldown-runtime.mjs +0 -1
- package/__app__/chunks/safeCtx.mjs +0 -1
- package/__app__/chunks/searchParams.mjs +0 -1
- package/__app__/chunks/single-index.mjs +0 -1
- package/__app__/chunks/styled-system.mjs +0 -1
- package/__app__/chunks/styles.css.mjs +0 -1
- package/__app__/chunks/useLikeC4Project.mjs +0 -1
- package/__app__/chunks/useUpdateEffect.mjs +0 -1
- package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
- package/__app__/src/pages/EmbedPage.mjs +0 -1
- package/__app__/src/pages/ExportPage.mjs +0 -1
- package/__app__/src/pages/ProjectsOverview.mjs +0 -1
- package/__app__/src/pages/ViewAsD2.mjs +0 -1
- package/__app__/src/pages/ViewAsDot.mjs +0 -1
- package/__app__/src/pages/ViewAsMmd.mjs +0 -1
- package/__app__/src/pages/ViewAsPuml.mjs +0 -1
- package/__app__/src/pages/ViewEditor.mjs +0 -1
- package/__app__/src/pages/ViewReact.mjs +0 -1
- package/__app__/src/routeTree.gen.mjs +0 -1
- package/__app__/src/routes/__root.mjs +0 -1
- package/__app__/src/routes/_single/adhoc.mjs +0 -1
- package/__app__/src/routes/_single/embed._viewId.mjs +0 -1
- package/__app__/src/routes/_single/export._viewId.mjs +0 -1
- package/__app__/src/routes/_single/route.mjs +0 -1
- package/__app__/src/routes/_single/single-index.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.d2.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.dot.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.index.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.mmd.mjs +0 -1
- package/__app__/src/routes/_single/view._viewId.puml.mjs +0 -1
- package/__app__/src/routes/_single/webcomponent._.mjs +0 -33
- package/__app__/src/routes/index.mjs +0 -1
- package/__app__/src/routes/project._projectId/-components.mjs +0 -1
- package/__app__/src/routes/project._projectId/adhoc.mjs +0 -1
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/export._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/index.mjs +0 -1
- package/__app__/src/routes/project._projectId/route.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +0 -1
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +0 -1
- package/__app__/src/routes/projects.mjs +0 -1
- package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/chunks/libs/@hono/mcp.mjs +0 -45
- package/dist/chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/chunks/libs/ajv.mjs +0 -1
- package/dist/chunks/libs/ansi-align.mjs +0 -2
- package/dist/chunks/libs/ansi-regex.mjs +0 -1
- package/dist/chunks/libs/ansi-styles.mjs +0 -1
- package/dist/chunks/libs/atomically.mjs +0 -1
- package/dist/chunks/libs/boxen.mjs +0 -22
- package/dist/chunks/libs/conf.mjs +0 -1
- package/dist/chunks/libs/defu.mjs +0 -1
- package/dist/chunks/libs/destr.mjs +0 -1
- package/dist/chunks/libs/find-up-simple.mjs +0 -1
- package/dist/chunks/libs/get-port.mjs +0 -1
- package/dist/chunks/libs/hono.mjs +0 -1
- package/dist/chunks/libs/is-docker.mjs +0 -1
- package/dist/chunks/libs/is-error-instance.mjs +0 -1
- package/dist/chunks/libs/is-inside-container.mjs +0 -1
- package/dist/chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/chunks/libs/isexe.mjs +0 -1
- package/dist/chunks/libs/ky.mjs +0 -3
- package/dist/chunks/libs/p-debounce.mjs +0 -1
- package/dist/chunks/libs/p-limit.mjs +0 -1
- package/dist/chunks/libs/p-timeout.mjs +0 -1
- package/dist/chunks/libs/package-up.mjs +0 -1
- package/dist/chunks/libs/parse-ms.mjs +0 -1
- package/dist/chunks/libs/safe-stringify.mjs +0 -1
- package/dist/chunks/libs/strip-indent.mjs +0 -1
- package/dist/chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/chunks/libs/ts-graphviz.d.mts +0 -12
- package/dist/chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
- package/dist/chunks/libs/word-wrap.mjs +0 -12
- package/dist/chunks/plugin.mjs +0 -400
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.d.mts +0 -269
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +0 -59
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import "./rolldown-runtime.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/util.js
|
|
3
|
+
function resolveUrl(e, t) {
|
|
4
|
+
if (e.match(/^[a-z]+:\/\//i)) return e;
|
|
5
|
+
if (e.match(/^\/\//)) return window.location.protocol + e;
|
|
6
|
+
if (e.match(/^[a-z]+:/i)) return e;
|
|
7
|
+
let n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
|
|
8
|
+
return n.head.appendChild(r), n.body.appendChild(i), t && (r.href = t), i.href = e, i.href;
|
|
9
|
+
}
|
|
10
|
+
var e = (() => {
|
|
11
|
+
let e = 0, random = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
|
|
12
|
+
return () => (e += 1, `u${random()}${e}`);
|
|
13
|
+
})();
|
|
14
|
+
function toArray(e) {
|
|
15
|
+
let t = [];
|
|
16
|
+
for (let n = 0, r = e.length; n < r; n++) t.push(e[n]);
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
function px(e, t) {
|
|
20
|
+
let n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
|
|
21
|
+
return n ? parseFloat(n.replace("px", "")) : 0;
|
|
22
|
+
}
|
|
23
|
+
function getNodeWidth(e) {
|
|
24
|
+
let t = px(e, "border-left-width"), n = px(e, "border-right-width");
|
|
25
|
+
return e.clientWidth + t + n;
|
|
26
|
+
}
|
|
27
|
+
function getNodeHeight(e) {
|
|
28
|
+
let t = px(e, "border-top-width"), n = px(e, "border-bottom-width");
|
|
29
|
+
return e.clientHeight + t + n;
|
|
30
|
+
}
|
|
31
|
+
function getImageSize(e, t = {}) {
|
|
32
|
+
return {
|
|
33
|
+
width: t.width || getNodeWidth(e),
|
|
34
|
+
height: t.height || getNodeHeight(e)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getPixelRatio() {
|
|
38
|
+
let e, t;
|
|
39
|
+
try {
|
|
40
|
+
t = process;
|
|
41
|
+
} catch {}
|
|
42
|
+
let n = t && t.env ? t.env.devicePixelRatio : null;
|
|
43
|
+
return n && (e = parseInt(n, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
|
|
44
|
+
}
|
|
45
|
+
var t = 16384;
|
|
46
|
+
function checkCanvasDimensions(e) {
|
|
47
|
+
(e.width > t || e.height > t) && (e.width > t && e.height > t ? e.width > e.height ? (e.height *= t / e.width, e.width = t) : (e.width *= t / e.height, e.height = t) : e.width > t ? (e.height *= t / e.width, e.width = t) : (e.width *= t / e.height, e.height = t));
|
|
48
|
+
}
|
|
49
|
+
function canvasToBlob(e, t = {}) {
|
|
50
|
+
return e.toBlob ? new Promise((n) => {
|
|
51
|
+
e.toBlob(n, t.type ? t.type : "image/png", t.quality ? t.quality : 1);
|
|
52
|
+
}) : new Promise((n) => {
|
|
53
|
+
let r = window.atob(e.toDataURL(t.type ? t.type : void 0, t.quality ? t.quality : void 0).split(",")[1]), i = r.length, a = new Uint8Array(i);
|
|
54
|
+
for (let e = 0; e < i; e += 1) a[e] = r.charCodeAt(e);
|
|
55
|
+
n(new Blob([a], { type: t.type ? t.type : "image/png" }));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function createImage(e) {
|
|
59
|
+
return new Promise((t, n) => {
|
|
60
|
+
let r = new Image();
|
|
61
|
+
r.decode = () => t(r), r.onload = () => t(r), r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = e;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async function svgToDataURL(e) {
|
|
65
|
+
return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
66
|
+
}
|
|
67
|
+
async function nodeToDataURL(e, t, n) {
|
|
68
|
+
let r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
|
|
69
|
+
return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e), svgToDataURL(i);
|
|
70
|
+
}
|
|
71
|
+
var isInstanceOfElement = (e, t) => {
|
|
72
|
+
if (e instanceof t) return !0;
|
|
73
|
+
let n = Object.getPrototypeOf(e);
|
|
74
|
+
return n === null ? !1 : n.constructor.name === t.name || isInstanceOfElement(n, t);
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/clone-pseudos.js
|
|
78
|
+
function formatCSSText(e) {
|
|
79
|
+
let t = e.getPropertyValue("content");
|
|
80
|
+
return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
81
|
+
}
|
|
82
|
+
function formatCSSProperties(e) {
|
|
83
|
+
return toArray(e).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
|
|
84
|
+
}
|
|
85
|
+
function getPseudoElementStyle(e, t, n) {
|
|
86
|
+
let r = `.${e}:${t}`, i = n.cssText ? formatCSSText(n) : formatCSSProperties(n);
|
|
87
|
+
return document.createTextNode(`${r}{${i}}`);
|
|
88
|
+
}
|
|
89
|
+
function clonePseudoElement(t, n, r) {
|
|
90
|
+
let i = window.getComputedStyle(t, r), a = i.getPropertyValue("content");
|
|
91
|
+
if (a === "" || a === "none") return;
|
|
92
|
+
let o = e();
|
|
93
|
+
try {
|
|
94
|
+
n.className = `${n.className} ${o}`;
|
|
95
|
+
} catch {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
let s = document.createElement("style");
|
|
99
|
+
s.appendChild(getPseudoElementStyle(o, r, i)), n.appendChild(s);
|
|
100
|
+
}
|
|
101
|
+
function clonePseudoElements(e, t) {
|
|
102
|
+
clonePseudoElement(e, t, ":before"), clonePseudoElement(e, t, ":after");
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/mimes.js
|
|
106
|
+
var n = "application/font-woff", r = "image/jpeg", i = {
|
|
107
|
+
woff: n,
|
|
108
|
+
woff2: n,
|
|
109
|
+
ttf: "application/font-truetype",
|
|
110
|
+
eot: "application/vnd.ms-fontobject",
|
|
111
|
+
png: "image/png",
|
|
112
|
+
jpg: r,
|
|
113
|
+
jpeg: r,
|
|
114
|
+
gif: "image/gif",
|
|
115
|
+
tiff: "image/tiff",
|
|
116
|
+
svg: "image/svg+xml",
|
|
117
|
+
webp: "image/webp"
|
|
118
|
+
};
|
|
119
|
+
function getExtension(e) {
|
|
120
|
+
let t = /\.([^./]*?)$/g.exec(e);
|
|
121
|
+
return t ? t[1] : "";
|
|
122
|
+
}
|
|
123
|
+
function getMimeType(e) {
|
|
124
|
+
return i[getExtension(e).toLowerCase()] || "";
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/dataurl.js
|
|
128
|
+
function getContentFromDataUrl(e) {
|
|
129
|
+
return e.split(/,/)[1];
|
|
130
|
+
}
|
|
131
|
+
function isDataUrl(e) {
|
|
132
|
+
return e.search(/^(data:)/) !== -1;
|
|
133
|
+
}
|
|
134
|
+
function makeDataUrl(e, t) {
|
|
135
|
+
return `data:${t};base64,${e}`;
|
|
136
|
+
}
|
|
137
|
+
async function fetchAsDataURL(e, t, n) {
|
|
138
|
+
let r = await fetch(e, t);
|
|
139
|
+
if (r.status === 404) throw Error(`Resource "${r.url}" not found`);
|
|
140
|
+
let i = await r.blob();
|
|
141
|
+
return new Promise((e, t) => {
|
|
142
|
+
let a = new FileReader();
|
|
143
|
+
a.onerror = t, a.onloadend = () => {
|
|
144
|
+
try {
|
|
145
|
+
e(n({
|
|
146
|
+
res: r,
|
|
147
|
+
result: a.result
|
|
148
|
+
}));
|
|
149
|
+
} catch (e) {
|
|
150
|
+
t(e);
|
|
151
|
+
}
|
|
152
|
+
}, a.readAsDataURL(i);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
var a = {};
|
|
156
|
+
function getCacheKey(e, t, n) {
|
|
157
|
+
let r = e.replace(/\?.*/, "");
|
|
158
|
+
return n && (r = e), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
|
|
159
|
+
}
|
|
160
|
+
async function resourceToDataURL(e, t, n) {
|
|
161
|
+
let r = getCacheKey(e, t, n.includeQueryParams);
|
|
162
|
+
if (a[r] != null) return a[r];
|
|
163
|
+
n.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
164
|
+
let i;
|
|
165
|
+
try {
|
|
166
|
+
i = makeDataUrl(await fetchAsDataURL(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", getContentFromDataUrl(n))), t);
|
|
167
|
+
} catch (t) {
|
|
168
|
+
i = n.imagePlaceholder || "";
|
|
169
|
+
let r = `Failed to fetch resource: ${e}`;
|
|
170
|
+
t && (r = typeof t == "string" ? t : t.message), r && console.warn(r);
|
|
171
|
+
}
|
|
172
|
+
return a[r] = i, i;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/clone-node.js
|
|
176
|
+
async function cloneCanvasElement(e) {
|
|
177
|
+
let t = e.toDataURL();
|
|
178
|
+
return t === "data:," ? e.cloneNode(!1) : createImage(t);
|
|
179
|
+
}
|
|
180
|
+
async function cloneVideoElement(e, t) {
|
|
181
|
+
if (e.currentSrc) {
|
|
182
|
+
let t = document.createElement("canvas"), n = t.getContext("2d");
|
|
183
|
+
return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), createImage(t.toDataURL());
|
|
184
|
+
}
|
|
185
|
+
let n = e.poster;
|
|
186
|
+
return createImage(await resourceToDataURL(n, getMimeType(n), t));
|
|
187
|
+
}
|
|
188
|
+
async function cloneIFrameElement(e) {
|
|
189
|
+
try {
|
|
190
|
+
if (e?.contentDocument?.body) return await cloneNode(e.contentDocument.body, {}, !0);
|
|
191
|
+
} catch {}
|
|
192
|
+
return e.cloneNode(!1);
|
|
193
|
+
}
|
|
194
|
+
async function cloneSingleNode(e, t) {
|
|
195
|
+
return isInstanceOfElement(e, HTMLCanvasElement) ? cloneCanvasElement(e) : isInstanceOfElement(e, HTMLVideoElement) ? cloneVideoElement(e, t) : isInstanceOfElement(e, HTMLIFrameElement) ? cloneIFrameElement(e) : e.cloneNode(!1);
|
|
196
|
+
}
|
|
197
|
+
var isSlotElement = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT";
|
|
198
|
+
async function cloneChildren(e, t, n) {
|
|
199
|
+
let r = [];
|
|
200
|
+
return r = isSlotElement(e) && e.assignedNodes ? toArray(e.assignedNodes()) : isInstanceOfElement(e, HTMLIFrameElement) && e.contentDocument?.body ? toArray(e.contentDocument.body.childNodes) : toArray((e.shadowRoot ?? e).childNodes), r.length === 0 || isInstanceOfElement(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => cloneNode(r, n)).then((e) => {
|
|
201
|
+
e && t.appendChild(e);
|
|
202
|
+
}), Promise.resolve()), t;
|
|
203
|
+
}
|
|
204
|
+
function cloneCSSStyle(e, t) {
|
|
205
|
+
let n = t.style;
|
|
206
|
+
if (!n) return;
|
|
207
|
+
let r = window.getComputedStyle(e);
|
|
208
|
+
r.cssText ? (n.cssText = r.cssText, n.transformOrigin = r.transformOrigin) : toArray(r).forEach((i) => {
|
|
209
|
+
let a = r.getPropertyValue(i);
|
|
210
|
+
i === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - .1}px`), isInstanceOfElement(e, HTMLIFrameElement) && i === "display" && a === "inline" && (a = "block"), i === "d" && t.getAttribute("d") && (a = `path(${t.getAttribute("d")})`), n.setProperty(i, a, r.getPropertyPriority(i));
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function cloneInputValue(e, t) {
|
|
214
|
+
isInstanceOfElement(e, HTMLTextAreaElement) && (t.innerHTML = e.value), isInstanceOfElement(e, HTMLInputElement) && t.setAttribute("value", e.value);
|
|
215
|
+
}
|
|
216
|
+
function cloneSelectValue(e, t) {
|
|
217
|
+
if (isInstanceOfElement(e, HTMLSelectElement)) {
|
|
218
|
+
let n = t, r = Array.from(n.children).find((t) => e.value === t.getAttribute("value"));
|
|
219
|
+
r && r.setAttribute("selected", "");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function decorate(e, t) {
|
|
223
|
+
return isInstanceOfElement(t, Element) && (cloneCSSStyle(e, t), clonePseudoElements(e, t), cloneInputValue(e, t), cloneSelectValue(e, t)), t;
|
|
224
|
+
}
|
|
225
|
+
async function ensureSVGSymbols(e, t) {
|
|
226
|
+
let n = e.querySelectorAll ? e.querySelectorAll("use") : [];
|
|
227
|
+
if (n.length === 0) return e;
|
|
228
|
+
let r = {};
|
|
229
|
+
for (let i = 0; i < n.length; i++) {
|
|
230
|
+
let a = n[i].getAttribute("xlink:href");
|
|
231
|
+
if (a) {
|
|
232
|
+
let n = e.querySelector(a), i = document.querySelector(a);
|
|
233
|
+
!n && i && !r[a] && (r[a] = await cloneNode(i, t, !0));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
let i = Object.values(r);
|
|
237
|
+
if (i.length) {
|
|
238
|
+
let t = "http://www.w3.org/1999/xhtml", n = document.createElementNS(t, "svg");
|
|
239
|
+
n.setAttribute("xmlns", t), n.style.position = "absolute", n.style.width = "0", n.style.height = "0", n.style.overflow = "hidden", n.style.display = "none";
|
|
240
|
+
let r = document.createElementNS(t, "defs");
|
|
241
|
+
n.appendChild(r);
|
|
242
|
+
for (let e = 0; e < i.length; e++) r.appendChild(i[e]);
|
|
243
|
+
e.appendChild(n);
|
|
244
|
+
}
|
|
245
|
+
return e;
|
|
246
|
+
}
|
|
247
|
+
async function cloneNode(e, t, n) {
|
|
248
|
+
return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => cloneSingleNode(e, t)).then((n) => cloneChildren(e, n, t)).then((t) => decorate(e, t)).then((e) => ensureSVGSymbols(e, t));
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/embed-resources.js
|
|
252
|
+
var o = /url\((['"]?)([^'"]+?)\1\)/g, s = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, c = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
253
|
+
function toRegex(e) {
|
|
254
|
+
let t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
255
|
+
return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
256
|
+
}
|
|
257
|
+
function parseURLs(e) {
|
|
258
|
+
let t = [];
|
|
259
|
+
return e.replace(o, (e, n, r) => (t.push(r), e)), t.filter((e) => !isDataUrl(e));
|
|
260
|
+
}
|
|
261
|
+
async function embed(e, t, n, r, i) {
|
|
262
|
+
try {
|
|
263
|
+
let a = n ? resolveUrl(t, n) : t, o = getMimeType(t), s;
|
|
264
|
+
return s = i ? makeDataUrl(await i(a), o) : await resourceToDataURL(a, o, r), e.replace(toRegex(t), `$1${s}$3`);
|
|
265
|
+
} catch {}
|
|
266
|
+
return e;
|
|
267
|
+
}
|
|
268
|
+
function filterPreferredFontFormat(e, { preferredFontFormat: t }) {
|
|
269
|
+
return t ? e.replace(c, (e) => {
|
|
270
|
+
for (;;) {
|
|
271
|
+
let [n, , r] = s.exec(e) || [];
|
|
272
|
+
if (!r) return "";
|
|
273
|
+
if (r === t) return `src: ${n};`;
|
|
274
|
+
}
|
|
275
|
+
}) : e;
|
|
276
|
+
}
|
|
277
|
+
function shouldEmbed(e) {
|
|
278
|
+
return e.search(o) !== -1;
|
|
279
|
+
}
|
|
280
|
+
async function embedResources(e, t, n) {
|
|
281
|
+
if (!shouldEmbed(e)) return e;
|
|
282
|
+
let r = filterPreferredFontFormat(e, n);
|
|
283
|
+
return parseURLs(r).reduce((e, r) => e.then((e) => embed(e, r, t, n)), Promise.resolve(r));
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/embed-images.js
|
|
287
|
+
async function embedProp(e, t, n) {
|
|
288
|
+
let r = t.style?.getPropertyValue(e);
|
|
289
|
+
if (r) {
|
|
290
|
+
let i = await embedResources(r, null, n);
|
|
291
|
+
return t.style.setProperty(e, i, t.style.getPropertyPriority(e)), !0;
|
|
292
|
+
}
|
|
293
|
+
return !1;
|
|
294
|
+
}
|
|
295
|
+
async function embedBackground(e, t) {
|
|
296
|
+
await embedProp("background", e, t) || await embedProp("background-image", e, t), await embedProp("mask", e, t) || await embedProp("mask-image", e, t);
|
|
297
|
+
}
|
|
298
|
+
async function embedImageNode(e, t) {
|
|
299
|
+
let n = isInstanceOfElement(e, HTMLImageElement);
|
|
300
|
+
if (!(n && !isDataUrl(e.src)) && !(isInstanceOfElement(e, SVGImageElement) && !isDataUrl(e.href.baseVal))) return;
|
|
301
|
+
let r = n ? e.src : e.href.baseVal, i = await resourceToDataURL(r, getMimeType(r), t);
|
|
302
|
+
await new Promise((t, r) => {
|
|
303
|
+
e.onload = t, e.onerror = r;
|
|
304
|
+
let a = e;
|
|
305
|
+
a.decode &&= t, a.loading === "lazy" && (a.loading = "eager"), n ? (e.srcset = "", e.src = i) : e.href.baseVal = i;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
async function embedChildren(e, t) {
|
|
309
|
+
let n = toArray(e.childNodes).map((e) => embedImages(e, t));
|
|
310
|
+
await Promise.all(n).then(() => e);
|
|
311
|
+
}
|
|
312
|
+
async function embedImages(e, t) {
|
|
313
|
+
isInstanceOfElement(e, Element) && (await embedBackground(e, t), await embedImageNode(e, t), await embedChildren(e, t));
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/apply-style.js
|
|
317
|
+
function applyStyle(e, t) {
|
|
318
|
+
let { style: n } = e;
|
|
319
|
+
t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.width && (n.width = `${t.width}px`), t.height && (n.height = `${t.height}px`);
|
|
320
|
+
let r = t.style;
|
|
321
|
+
return r != null && Object.keys(r).forEach((e) => {
|
|
322
|
+
n[e] = r[e];
|
|
323
|
+
}), e;
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/embed-webfonts.js
|
|
327
|
+
var l = {};
|
|
328
|
+
async function fetchCSS(e) {
|
|
329
|
+
let t = l[e];
|
|
330
|
+
return t ?? (t = {
|
|
331
|
+
url: e,
|
|
332
|
+
cssText: await (await fetch(e)).text()
|
|
333
|
+
}, l[e] = t, t);
|
|
334
|
+
}
|
|
335
|
+
async function embedFonts(e, t) {
|
|
336
|
+
let n = e.cssText, r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (i) => {
|
|
337
|
+
let a = i.replace(r, "$1");
|
|
338
|
+
return a.startsWith("https://") || (a = new URL(a, e.url).href), fetchAsDataURL(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
|
|
339
|
+
});
|
|
340
|
+
return Promise.all(i).then(() => n);
|
|
341
|
+
}
|
|
342
|
+
function parseCSS(e) {
|
|
343
|
+
if (e == null) return [];
|
|
344
|
+
let t = [], n = e.replace(/(\/\*[\s\S]*?\*\/)/gi, ""), r = /* @__PURE__ */ RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
345
|
+
for (;;) {
|
|
346
|
+
let e = r.exec(n);
|
|
347
|
+
if (e === null) break;
|
|
348
|
+
t.push(e[0]);
|
|
349
|
+
}
|
|
350
|
+
n = n.replace(r, "");
|
|
351
|
+
let i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = /* @__PURE__ */ RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", "gi");
|
|
352
|
+
for (;;) {
|
|
353
|
+
let e = i.exec(n);
|
|
354
|
+
if (e === null) {
|
|
355
|
+
if (e = a.exec(n), e === null) break;
|
|
356
|
+
i.lastIndex = a.lastIndex;
|
|
357
|
+
} else a.lastIndex = i.lastIndex;
|
|
358
|
+
t.push(e[0]);
|
|
359
|
+
}
|
|
360
|
+
return t;
|
|
361
|
+
}
|
|
362
|
+
async function getCSSRules(e, t) {
|
|
363
|
+
let n = [], r = [];
|
|
364
|
+
return e.forEach((n) => {
|
|
365
|
+
if ("cssRules" in n) try {
|
|
366
|
+
toArray(n.cssRules || []).forEach((e, i) => {
|
|
367
|
+
if (e.type === CSSRule.IMPORT_RULE) {
|
|
368
|
+
let a = i + 1, o = e.href, s = fetchCSS(o).then((e) => embedFonts(e, t)).then((e) => parseCSS(e).forEach((e) => {
|
|
369
|
+
try {
|
|
370
|
+
n.insertRule(e, e.startsWith("@import") ? a += 1 : n.cssRules.length);
|
|
371
|
+
} catch (t) {
|
|
372
|
+
console.error("Error inserting rule from remote css", {
|
|
373
|
+
rule: e,
|
|
374
|
+
error: t
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
})).catch((e) => {
|
|
378
|
+
console.error("Error loading remote css", e.toString());
|
|
379
|
+
});
|
|
380
|
+
r.push(s);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
} catch (i) {
|
|
384
|
+
let a = e.find((e) => e.href == null) || document.styleSheets[0];
|
|
385
|
+
n.href != null && r.push(fetchCSS(n.href).then((e) => embedFonts(e, t)).then((e) => parseCSS(e).forEach((e) => {
|
|
386
|
+
a.insertRule(e, n.cssRules.length);
|
|
387
|
+
})).catch((e) => {
|
|
388
|
+
console.error("Error loading remote stylesheet", e);
|
|
389
|
+
})), console.error("Error inlining remote css file", i);
|
|
390
|
+
}
|
|
391
|
+
}), Promise.all(r).then(() => (e.forEach((e) => {
|
|
392
|
+
if ("cssRules" in e) try {
|
|
393
|
+
toArray(e.cssRules || []).forEach((e) => {
|
|
394
|
+
n.push(e);
|
|
395
|
+
});
|
|
396
|
+
} catch (t) {
|
|
397
|
+
console.error(`Error while reading CSS rules from ${e.href}`, t);
|
|
398
|
+
}
|
|
399
|
+
}), n));
|
|
400
|
+
}
|
|
401
|
+
function getWebFontRules(e) {
|
|
402
|
+
return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => shouldEmbed(e.style.getPropertyValue("src")));
|
|
403
|
+
}
|
|
404
|
+
async function parseWebFontRules(e, t) {
|
|
405
|
+
if (e.ownerDocument == null) throw Error("Provided element is not within a Document");
|
|
406
|
+
return getWebFontRules(await getCSSRules(toArray(e.ownerDocument.styleSheets), t));
|
|
407
|
+
}
|
|
408
|
+
async function getWebFontCSS(e, t) {
|
|
409
|
+
let n = await parseWebFontRules(e, t);
|
|
410
|
+
return (await Promise.all(n.map((e) => {
|
|
411
|
+
let n = e.parentStyleSheet ? e.parentStyleSheet.href : null;
|
|
412
|
+
return embedResources(e.cssText, n, t);
|
|
413
|
+
}))).join("\n");
|
|
414
|
+
}
|
|
415
|
+
async function embedWebFonts(e, t) {
|
|
416
|
+
let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await getWebFontCSS(e, t) : t.fontEmbedCSS;
|
|
417
|
+
if (n) {
|
|
418
|
+
let t = document.createElement("style"), r = document.createTextNode(n);
|
|
419
|
+
t.appendChild(r), e.firstChild ? e.insertBefore(t, e.firstChild) : e.appendChild(t);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region ../../node_modules/.pnpm/html-to-image@1.11.11/node_modules/html-to-image/es/index.js
|
|
424
|
+
async function toSvg(e, t = {}) {
|
|
425
|
+
let { width: n, height: r } = getImageSize(e, t), i = await cloneNode(e, t, !0);
|
|
426
|
+
return await embedWebFonts(i, t), await embedImages(i, t), applyStyle(i, t), await nodeToDataURL(i, n, r);
|
|
427
|
+
}
|
|
428
|
+
async function toCanvas(e, t = {}) {
|
|
429
|
+
let { width: n, height: r } = getImageSize(e, t), i = await createImage(await toSvg(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || getPixelRatio(), c = t.canvasWidth || n, l = t.canvasHeight || r;
|
|
430
|
+
return a.width = c * s, a.height = l * s, t.skipAutoScale || checkCanvasDimensions(a), a.style.width = `${c}`, a.style.height = `${l}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(i, 0, 0, a.width, a.height), a;
|
|
431
|
+
}
|
|
432
|
+
async function toJpeg(e, t = {}) {
|
|
433
|
+
return (await toCanvas(e, t)).toDataURL("image/jpeg", t.quality || 1);
|
|
434
|
+
}
|
|
435
|
+
async function toBlob(e, t = {}) {
|
|
436
|
+
return await canvasToBlob(await toCanvas(e, t));
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
export { toBlob, toJpeg };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import "./rolldown-runtime.mjs";
|
|
2
|
+
import { a as e, f as t } from "./libs/@tanstack.mjs";
|
|
3
|
+
import { c as n, o as r, u as i } from "./Markdown.mjs";
|
|
4
|
+
import { n as a, t as o } from "./libs/fast-equals.mjs";
|
|
5
|
+
import { createContext as s, useCallback as c, useContext as l, useEffect as u, useLayoutEffect as d, useRef as f, useState as p } from "react";
|
|
6
|
+
import { c as m } from "react/compiler-runtime";
|
|
7
|
+
import { useLikeC4Projects as h } from "likec4:projects";
|
|
8
|
+
//#region ../../node_modules/.pnpm/@react-hookz+web@25.2.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@react-hookz/web/dist/useIsomorphicLayoutEffect/index.js
|
|
9
|
+
var g = n ? d : u, cancelTimeout = (e) => {
|
|
10
|
+
e && clearTimeout(e);
|
|
11
|
+
};
|
|
12
|
+
function useTimeoutEffect(e, t) {
|
|
13
|
+
let n = i(e), r = i(t), a = f(null), o = c(() => {
|
|
14
|
+
cancelTimeout(a.current);
|
|
15
|
+
}, []), s = c(() => {
|
|
16
|
+
r.current !== void 0 && (o(), a.current = setTimeout(() => {
|
|
17
|
+
n.current();
|
|
18
|
+
}, r.current));
|
|
19
|
+
}, []);
|
|
20
|
+
return u(() => (s(), o), [t]), [o, s];
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../../node_modules/.pnpm/nanostores@1.3.0/node_modules/nanostores/lifecycle/index.js
|
|
24
|
+
var _ = 5, v = 6, y = 10, on = (e, t, n, r) => (e.events = e.events || {}, e.events[n + y] || (e.events[n + y] = r((t) => {
|
|
25
|
+
e.events[n].reduceRight((e, t) => (t(e), e), {
|
|
26
|
+
shared: {},
|
|
27
|
+
...t
|
|
28
|
+
});
|
|
29
|
+
})), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
|
|
30
|
+
let r = e.events[n], i = r.indexOf(t);
|
|
31
|
+
r.splice(i, 1), r.length || (delete e.events[n], e.events[n + y](), delete e.events[n + y]);
|
|
32
|
+
}), b = 1e3, onMount = (e, t) => {
|
|
33
|
+
let listener = (n) => {
|
|
34
|
+
let r = t(n);
|
|
35
|
+
r && e.events[v].push(r);
|
|
36
|
+
};
|
|
37
|
+
return on(e, listener, _, (t) => {
|
|
38
|
+
let n = e.listen;
|
|
39
|
+
e.listen = (...r) => (!e.lc && !e.active && (e.active = !0, t()), n(...r));
|
|
40
|
+
let r = e.off;
|
|
41
|
+
return e.events[v] = [], e.off = () => {
|
|
42
|
+
r(), setTimeout(() => {
|
|
43
|
+
if (e.active && !e.lc) {
|
|
44
|
+
e.active = !1;
|
|
45
|
+
for (let t of e.events[v]) t();
|
|
46
|
+
e.events[v] = [];
|
|
47
|
+
}
|
|
48
|
+
}, b);
|
|
49
|
+
}, () => {
|
|
50
|
+
e.listen = n, e.off = r;
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
}, x = s(null);
|
|
54
|
+
x.displayName = "DiagramActorSafeContext";
|
|
55
|
+
var S = s(null);
|
|
56
|
+
S.displayName = "DiagramApiSafeContext";
|
|
57
|
+
var C = x.Provider, w = S.Provider;
|
|
58
|
+
function useDiagramActorRef() {
|
|
59
|
+
let e = l(x);
|
|
60
|
+
if (e === null) throw Error("DiagramActorRef is not provided");
|
|
61
|
+
return e;
|
|
62
|
+
}
|
|
63
|
+
function useDiagram() {
|
|
64
|
+
let e = l(S);
|
|
65
|
+
if (e === null) throw Error("DiagramApi is not provided");
|
|
66
|
+
return e;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/context/safeCtx.ts
|
|
70
|
+
var T = s(null), E = T.Provider, useLikeC4ModelAtom = () => {
|
|
71
|
+
let e = l(T);
|
|
72
|
+
if (e === null) throw Error("LikeC4ModelAtom is not provided");
|
|
73
|
+
return e;
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/hooks.ts
|
|
77
|
+
function useTransparentBackground(e) {
|
|
78
|
+
let t = m(3), n = e === void 0 ? !0 : e, t1, r;
|
|
79
|
+
t[0] === n ? (t1 = t[1], r = t[2]) : (t1 = () => {
|
|
80
|
+
let e = document.body.parentElement;
|
|
81
|
+
if (!(!e || n !== !0)) return e.classList.add("transparent-bg"), () => {
|
|
82
|
+
e.classList.remove("transparent-bg");
|
|
83
|
+
};
|
|
84
|
+
}, r = [n], t[0] = n, t[1] = t1, t[2] = r), g(t1, r);
|
|
85
|
+
}
|
|
86
|
+
function useLikeC4Views() {
|
|
87
|
+
let e = m(4), t = useLikeC4ModelAtom(), n;
|
|
88
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (n = [], e[0] = n) : n = e[0];
|
|
89
|
+
let [r, i] = p(n), t1, s;
|
|
90
|
+
return e[1] === t ? (t1 = e[2], s = e[3]) : (t1 = () => t.subscribe((e) => {
|
|
91
|
+
i((t) => {
|
|
92
|
+
let n = [...e.views()].map((e) => {
|
|
93
|
+
let n = e.$layouted, r = t.find((t) => t.id === e.id);
|
|
94
|
+
return r && o(n, r) ? r : n;
|
|
95
|
+
});
|
|
96
|
+
return a(t, n) ? t : n;
|
|
97
|
+
});
|
|
98
|
+
}), s = [t], e[1] = t, e[2] = t1, e[3] = s), u(t1, s), r;
|
|
99
|
+
}
|
|
100
|
+
function useCurrentViewId() {
|
|
101
|
+
let e = m(1), n;
|
|
102
|
+
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (n = {
|
|
103
|
+
select: _temp,
|
|
104
|
+
strict: !1
|
|
105
|
+
}, e[0] = n) : n = e[0], t(n) ?? "index";
|
|
106
|
+
}
|
|
107
|
+
function _temp(e) {
|
|
108
|
+
return e.viewId;
|
|
109
|
+
}
|
|
110
|
+
function useCurrentView() {
|
|
111
|
+
let e = m(13), t = useCurrentViewId(), n = useLikeC4ModelAtom(), [i, a] = p("manual"), t0;
|
|
112
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => {
|
|
113
|
+
a("manual");
|
|
114
|
+
}, e[0] = t0) : t0 = e[0];
|
|
115
|
+
let s;
|
|
116
|
+
e[1] === t ? s = e[2] : (s = [t], e[1] = t, e[2] = s), r(t0, s);
|
|
117
|
+
let t2;
|
|
118
|
+
e[3] !== n || e[4] !== t ? (t2 = () => n.get().findView(t)?.$layouted ?? null, e[3] = n, e[4] = t, e[5] = t2) : t2 = e[5];
|
|
119
|
+
let [c, l] = p(t2), t3, d;
|
|
120
|
+
e[6] !== n || e[7] !== i || e[8] !== t ? (t3 = () => n.subscribe((e) => {
|
|
121
|
+
l((n) => {
|
|
122
|
+
let r = e.findView(t);
|
|
123
|
+
if (!r) return null;
|
|
124
|
+
let a = i === "auto" ? r.$view : r.$layouted;
|
|
125
|
+
return o(n, a) ? n : a;
|
|
126
|
+
});
|
|
127
|
+
}), d = [
|
|
128
|
+
n,
|
|
129
|
+
t,
|
|
130
|
+
i
|
|
131
|
+
], e[6] = n, e[7] = i, e[8] = t, e[9] = t3, e[10] = d) : (t3 = e[9], d = e[10]), u(t3, d);
|
|
132
|
+
let f;
|
|
133
|
+
return e[11] === c ? f = e[12] : (f = [c, a], e[11] = c, e[12] = f), f;
|
|
134
|
+
}
|
|
135
|
+
function useCurrentProject() {
|
|
136
|
+
let t = m(4), n = h(), r;
|
|
137
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (r = { select: selectProjectIdFromContext }, t[0] = r) : r = t[0];
|
|
138
|
+
let i = e(r), a;
|
|
139
|
+
return t[1] !== i || t[2] !== n ? (a = i && n.find((e) => e.id === i) || n[0], t[1] = i, t[2] = n, t[3] = a) : a = t[3], a;
|
|
140
|
+
}
|
|
141
|
+
function selectProjectIdFromContext(e) {
|
|
142
|
+
return e.find((e) => e.routeId === "/project/$projectId")?.params?.projectId ?? e.at(-1)?.context.projectId ?? void 0;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { useTransparentBackground as a, C as c, useDiagramActorRef as d, onMount as f, useLikeC4Views as i, w as l, useCurrentView as n, E as o, useTimeoutEffect as p, useCurrentViewId as r, useLikeC4ModelAtom as s, useCurrentProject as t, useDiagram as u };
|