likec4 1.2.1 → 1.3.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/react/styles.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import '@mantine/core/styles.css';
2
1
  import { type MantineTheme } from '@mantine/core';
3
2
  export declare const useCreateStyleSheet: (injectFontCss: boolean) => () => CSSStyleSheet;
4
3
  type ColorScheme = 'light' | 'dark' | undefined;
@@ -1 +0,0 @@
1
- import "./main-yVRq2dIl.js";
@@ -1,46 +0,0 @@
1
- import { k as createLazyFileRoute, j as jsxRuntimeExports, S as ScrollArea, C as Code, o as notFound } from "./main-yVRq2dIl.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-LQsQcFpp.js";
3
- import { d2Source } from "virtual:likec4/d2-sources";
4
- const Route = createLazyFileRoute("/view/$viewId/d2")({
5
- component: ViewAsD2
6
- }), useData = () => {
7
- const { viewId } = Route.useParams();
8
- try {
9
- return d2Source(viewId);
10
- } catch {
11
- throw notFound();
12
- }
13
- };
14
- function ViewAsD2() {
15
- const source = useData();
16
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(PanelGroup, { direction: "horizontal", autoSaveId: "viewAsD2", children: [
17
- /* @__PURE__ */ jsxRuntimeExports.jsx(Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
18
- ScrollArea,
19
- {
20
- className: cssScrollArea,
21
- p: 5,
22
- styles: {
23
- viewport: {
24
- borderRadius: 6
25
- }
26
- },
27
- children: [
28
- /* @__PURE__ */ jsxRuntimeExports.jsx(Code, { block: !0, className: cssCodeBlock, children: source }),
29
- /* @__PURE__ */ jsxRuntimeExports.jsx(CopyToClipboard, { text: source })
30
- ]
31
- }
32
- ) }),
33
- /* @__PURE__ */ jsxRuntimeExports.jsx(
34
- PanelResizeHandle,
35
- {
36
- style: {
37
- width: 10
38
- }
39
- }
40
- ),
41
- /* @__PURE__ */ jsxRuntimeExports.jsx(Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { h: "100%" }) })
42
- ] });
43
- }
44
- export {
45
- Route
46
- };
@@ -1,49 +0,0 @@
1
- import { k as createLazyFileRoute, j as jsxRuntimeExports, S as ScrollArea, C as Code, p as svgContainer, o as notFound } from "./main-yVRq2dIl.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-LQsQcFpp.js";
3
- import { dotSource, svgSource } from "virtual:likec4/dot-sources";
4
- const Route = createLazyFileRoute("/view/$viewId/dot")({
5
- component: ViewAsDot
6
- }), useData = () => {
7
- const { viewId } = Route.useParams();
8
- try {
9
- return {
10
- dot: dotSource(viewId),
11
- dotSvg: svgSource(viewId)
12
- };
13
- } catch {
14
- throw notFound();
15
- }
16
- };
17
- function ViewAsDot() {
18
- const { dot, dotSvg } = useData();
19
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(PanelGroup, { direction: "horizontal", autoSaveId: "viewAsDot", children: [
20
- /* @__PURE__ */ jsxRuntimeExports.jsx(Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
21
- ScrollArea,
22
- {
23
- className: cssScrollArea,
24
- p: 5,
25
- styles: {
26
- viewport: {
27
- borderRadius: 6
28
- }
29
- },
30
- children: [
31
- /* @__PURE__ */ jsxRuntimeExports.jsx(Code, { block: !0, className: cssCodeBlock, children: dot }),
32
- /* @__PURE__ */ jsxRuntimeExports.jsx(CopyToClipboard, { text: dot })
33
- ]
34
- }
35
- ) }),
36
- /* @__PURE__ */ jsxRuntimeExports.jsx(
37
- PanelResizeHandle,
38
- {
39
- style: {
40
- width: 10
41
- }
42
- }
43
- ),
44
- /* @__PURE__ */ jsxRuntimeExports.jsx(Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { h: "100%", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: dotSvg } }) }) })
45
- ] });
46
- }
47
- export {
48
- Route
49
- };
@@ -1,89 +0,0 @@
1
- import { r as reactExports, u as useSyncedRef, k as createLazyFileRoute, j as jsxRuntimeExports, S as ScrollArea, C as Code, p as svgContainer, o as notFound } from "./main-yVRq2dIl.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-LQsQcFpp.js";
3
- import { mmdSource } from "virtual:likec4/mmd-sources";
4
- function useAsync(asyncFn, initialValue) {
5
- const [state, setState] = reactExports.useState({
6
- status: "not-executed",
7
- error: void 0,
8
- result: initialValue
9
- }), promiseRef = reactExports.useRef(), argsRef = reactExports.useRef(), methods = useSyncedRef({
10
- execute(...params) {
11
- argsRef.current = params;
12
- const promise = asyncFn(...params);
13
- return promiseRef.current = promise, setState((s) => ({ ...s, status: "loading" })), promise.then((result) => {
14
- promise === promiseRef.current && setState((s) => ({ ...s, status: "success", error: void 0, result }));
15
- }, (error) => {
16
- promise === promiseRef.current && setState((s) => ({ ...s, status: "error", error }));
17
- }), promise;
18
- },
19
- reset() {
20
- setState({
21
- status: "not-executed",
22
- error: void 0,
23
- result: initialValue
24
- }), promiseRef.current = void 0, argsRef.current = void 0;
25
- }
26
- });
27
- return [
28
- state,
29
- reactExports.useMemo(() => ({
30
- reset() {
31
- methods.current.reset();
32
- },
33
- execute: (...params) => methods.current.execute(...params)
34
- }), []),
35
- { promise: promiseRef.current, lastArgs: argsRef.current }
36
- ];
37
- }
38
- const Route = createLazyFileRoute("/view/$viewId/mmd")({
39
- component: ViewAsMmd
40
- }), renderSvg = async (viewId, diagram) => {
41
- const { default: mermaid } = await import("https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs");
42
- mermaid.initialize({
43
- theme: "dark"
44
- });
45
- const { svg } = await mermaid.render(viewId, diagram);
46
- return svg;
47
- }, useData = () => {
48
- const { viewId } = Route.useParams();
49
- try {
50
- return mmdSource(viewId);
51
- } catch {
52
- throw notFound();
53
- }
54
- };
55
- function ViewAsMmd() {
56
- const { viewId } = Route.useParams(), source = useData(), [mmdSvg, { execute }] = useAsync(renderSvg, null);
57
- return reactExports.useEffect(() => {
58
- execute(viewId, source);
59
- }, [source]), /* @__PURE__ */ jsxRuntimeExports.jsxs(PanelGroup, { direction: "horizontal", autoSaveId: "viewAsMmd", children: [
60
- /* @__PURE__ */ jsxRuntimeExports.jsx(Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
61
- ScrollArea,
62
- {
63
- className: cssScrollArea,
64
- p: 5,
65
- styles: {
66
- viewport: {
67
- borderRadius: 6
68
- }
69
- },
70
- children: [
71
- /* @__PURE__ */ jsxRuntimeExports.jsx(Code, { block: !0, className: cssCodeBlock, children: source }),
72
- /* @__PURE__ */ jsxRuntimeExports.jsx(CopyToClipboard, { text: source })
73
- ]
74
- }
75
- ) }),
76
- /* @__PURE__ */ jsxRuntimeExports.jsx(
77
- PanelResizeHandle,
78
- {
79
- style: {
80
- width: 10
81
- }
82
- }
83
- ),
84
- /* @__PURE__ */ jsxRuntimeExports.jsx(Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { h: "100%", children: mmdSvg.result && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: svgContainer, dangerouslySetInnerHTML: { __html: mmdSvg.result } }) }) })
85
- ] });
86
- }
87
- export {
88
- Route
89
- };