likec4 1.55.1 → 1.57.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__/chunks/AIChat2.mjs +2 -0
- package/__app__/chunks/DiagramActorProvider.mjs +10 -0
- package/__app__/chunks/EmbedPage.mjs +1 -0
- package/__app__/chunks/ExportPage.mjs +2 -0
- package/__app__/chunks/LikeC4Diagram.mjs +19 -0
- package/__app__/chunks/LikeC4Styles.mjs +48 -0
- package/__app__/chunks/Markdown.mjs +1 -0
- package/__app__/chunks/NavigationPanel.mjs +1 -0
- package/__app__/chunks/ViewReact.mjs +1 -0
- package/__app__/chunks/adhoc-editor.mjs +1 -0
- package/__app__/chunks/aichat.mjs +1 -0
- package/__app__/chunks/box.mjs +1 -0
- package/__app__/chunks/create-style-context.mjs +1 -0
- package/__app__/chunks/css.mjs +1 -0
- package/__app__/chunks/factory.mjs +1 -0
- package/__app__/chunks/hooks.mjs +1 -0
- package/__app__/chunks/hstack.mjs +1 -0
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/core.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/react.mjs +1 -0
- package/__app__/chunks/libs/@mantine/core.mjs +41 -0
- package/__app__/chunks/libs/@mantine/hooks.mjs +1 -0
- package/__app__/chunks/libs/@nanostores/react.mjs +1 -0
- package/__app__/chunks/libs/@react-hookz/web.mjs +1 -0
- package/__app__/chunks/libs/@tabler/icons-react.mjs +358 -0
- package/__app__/chunks/libs/@tanstack/ai-client.mjs +2 -0
- package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/ai-react.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/ai.mjs +2 -0
- package/__app__/chunks/libs/@tanstack/history.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -0
- package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -0
- package/__app__/chunks/libs/@xstate/react.mjs +1 -0
- package/__app__/chunks/libs/@xstate/store.mjs +1 -0
- package/__app__/chunks/libs/@xyflow/react.mjs +7 -0
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/collection.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/core.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/react.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -0
- package/__app__/chunks/libs/bezier-js.mjs +1 -0
- package/__app__/chunks/libs/copy-anything.mjs +1 -0
- package/__app__/chunks/libs/d3-path.mjs +1 -0
- package/__app__/chunks/libs/d3-shape.mjs +1 -0
- package/__app__/chunks/libs/fast-equals.mjs +1 -0
- package/__app__/chunks/libs/framer-motion.mjs +9 -0
- package/__app__/chunks/libs/html-to-image.mjs +2 -0
- package/__app__/chunks/libs/motion-dom.mjs +1 -0
- package/__app__/chunks/libs/nanostores.mjs +1 -0
- package/__app__/chunks/libs/react-error-boundary.mjs +1 -0
- package/__app__/chunks/libs/react-resizable-panels.mjs +1 -0
- package/__app__/chunks/libs/remeda.mjs +1 -0
- package/__app__/chunks/libs/superjson.mjs +1 -0
- package/__app__/chunks/libs/zod.mjs +64 -0
- package/__app__/chunks/rolldown-runtime.mjs +1 -0
- package/__app__/chunks/styles.css.mjs +1 -0
- package/__app__/chunks/txt.mjs +1 -0
- package/__app__/chunks/useLikeC4Project.mjs +1 -0
- package/__app__/codegen/react.mjs +11 -0
- package/__app__/codegen/webcomponent.mjs +942 -0
- package/__app__/src/aichat/index.mjs +1 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +45 -0
- package/__app__/src/pages/AdHocViewEditor.mjs +1 -0
- package/__app__/src/pages/EmbedPage.mjs +1 -0
- package/__app__/src/pages/ExportPage.mjs +1 -0
- package/__app__/src/pages/ProjectsOverview.mjs +1 -0
- package/__app__/src/pages/ViewAsD2.mjs +1 -0
- package/__app__/src/pages/ViewAsDot.mjs +1 -0
- package/__app__/src/pages/ViewAsMmd.mjs +1 -0
- package/__app__/src/pages/ViewAsPuml.mjs +1 -0
- package/__app__/src/pages/ViewEditor.mjs +1 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- 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 +17 -0
- package/dist/{_chunks → chunks}/index.d.mts +2 -1
- package/dist/{_chunks → chunks}/index2.d.mts +639 -388
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
- package/dist/chunks/libs/@hono/mcp.mjs +70 -0
- package/dist/chunks/libs/@hono/node-server.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/@logtape/logtape.d.mts +2 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
- 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/ajv.mjs +1 -0
- package/dist/chunks/libs/ansi-align.mjs +2 -0
- package/dist/chunks/libs/ansi-regex.mjs +1 -0
- package/dist/chunks/libs/ansi-styles.mjs +1 -0
- package/dist/chunks/libs/atomically.mjs +1 -0
- package/dist/chunks/libs/birpc.mjs +1 -0
- package/dist/chunks/libs/boxen.mjs +22 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
- package/dist/chunks/libs/chevrotain.mjs +58 -0
- package/dist/chunks/libs/conf.mjs +1 -0
- package/dist/chunks/libs/defu.mjs +1 -0
- package/dist/chunks/libs/destr.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -0
- package/dist/chunks/libs/find-up-simple.mjs +1 -0
- package/dist/chunks/libs/get-port.mjs +1 -0
- package/dist/chunks/libs/hono.mjs +1 -0
- package/dist/chunks/libs/is-docker.mjs +1 -0
- package/dist/chunks/libs/is-error-instance.mjs +1 -0
- package/dist/chunks/libs/is-inside-container.mjs +1 -0
- package/dist/chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/chunks/libs/isexe.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +14 -0
- package/dist/chunks/libs/khroma.mjs +1 -0
- package/dist/chunks/libs/ky.mjs +3 -0
- package/dist/{_chunks → chunks}/libs/langium.d.mts +9 -9
- package/dist/chunks/libs/langium.mjs +32 -0
- package/dist/chunks/libs/merge-error-cause.mjs +2 -0
- package/dist/chunks/libs/p-debounce.mjs +1 -0
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -0
- package/dist/chunks/libs/p-timeout.mjs +1 -0
- package/dist/chunks/libs/package-manager-detector.mjs +1 -0
- package/dist/chunks/libs/package-up.mjs +1 -0
- package/dist/chunks/libs/pako.mjs +3 -0
- package/dist/chunks/libs/parse-ms.mjs +1 -0
- package/dist/chunks/libs/pathe.mjs +1 -0
- package/dist/chunks/libs/picomatch.mjs +1 -0
- package/dist/chunks/libs/pretty-ms.mjs +1 -0
- package/dist/chunks/libs/remeda.mjs +1 -0
- package/dist/chunks/libs/safe-stringify.mjs +1 -0
- package/dist/chunks/libs/strip-indent.mjs +1 -0
- package/dist/chunks/libs/tinyrainbow.mjs +1 -0
- package/dist/chunks/libs/ts-graphviz.mjs +1 -0
- package/dist/chunks/libs/ufo.mjs +1 -0
- package/dist/chunks/libs/unctx.mjs +1 -0
- package/dist/chunks/libs/unstorage.mjs +1 -0
- package/dist/chunks/libs/vscode-languageserver.mjs +1 -0
- package/dist/chunks/libs/which.mjs +1 -0
- package/dist/chunks/libs/word-wrap.mjs +12 -0
- package/dist/{_chunks → chunks}/libs/zod.d.mts +62 -25
- package/dist/chunks/node.mjs +93 -0
- package/dist/chunks/plugin.mjs +593 -0
- package/dist/chunks/rolldown-runtime.mjs +1 -0
- package/dist/chunks/sequence-view.mjs +1 -0
- package/dist/cli/index.mjs +188 -59
- package/dist/config/index.d.mts +1 -2
- package/dist/config/index.mjs +1 -1
- package/dist/index.d.mts +2 -135
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +3 -2
- package/dist/model/index.mjs +1 -1
- package/dist/vite-plugin/index.d.mts +90 -9
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -0
- package/dist/{_chunks/libs/@nanostores/react.d.mts → vite-plugin/internal/index.d.mts} +103 -45
- package/dist/vite-plugin/internal/index.mjs +1 -0
- package/package.json +74 -80
- package/react/index.d.mts +84 -78
- package/react/index.mjs +51954 -53701
- package/vite-plugin/internal/package.json +2 -2
- package/vite-plugin-modules.d.ts +18 -0
- package/__app__/react/likec4.tsx +0 -25
- package/__app__/src/ProjectsOverview.js +0 -16
- package/__app__/src/const.js +0 -19
- package/__app__/src/likec4.js +0 -21254
- package/__app__/src/main.js +0 -7
- package/__app__/src/routes/index.js +0 -324
- package/__app__/src/routes/projects.js +0 -193
- package/__app__/src/routes/single.js +0 -1983
- package/__app__/src/vendors.js +0 -52683
- package/__app__/src/webcomponent.js +0 -68
- package/dist/THIRD-PARTY-LICENSES.md +0 -1609
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
- package/dist/_chunks/libs/@chevrotain/types.d.mts +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.mjs +0 -4
- package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/_chunks/libs/@nanostores/react.mjs +0 -1
- 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/birpc.mjs +0 -1
- package/dist/_chunks/libs/boxen.mjs +0 -22
- package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
- package/dist/_chunks/libs/chevrotain.mjs +0 -58
- 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/esm-env.mjs +0 -1
- package/dist/_chunks/libs/eventemitter3.mjs +0 -1
- package/dist/_chunks/libs/fast-equals.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/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/json5.mjs +0 -14
- package/dist/_chunks/libs/khroma.mjs +0 -1
- package/dist/_chunks/libs/ky.mjs +0 -3
- package/dist/_chunks/libs/langium.mjs +0 -33
- package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
- package/dist/_chunks/libs/p-limit.mjs +0 -1
- package/dist/_chunks/libs/p-queue.mjs +0 -1
- package/dist/_chunks/libs/p-timeout.mjs +0 -1
- package/dist/_chunks/libs/package-manager-detector.mjs +0 -1
- package/dist/_chunks/libs/package-up.mjs +0 -1
- package/dist/_chunks/libs/pako.mjs +0 -1
- package/dist/_chunks/libs/parse-ms.mjs +0 -1
- package/dist/_chunks/libs/pathe.mjs +0 -1
- package/dist/_chunks/libs/picomatch.mjs +0 -1
- package/dist/_chunks/libs/pretty-ms.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -2
- 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 -10
- package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/_chunks/libs/ufo.mjs +0 -1
- package/dist/_chunks/libs/unstorage.mjs +0 -1
- package/dist/_chunks/libs/vscode-languageserver.mjs +0 -1
- package/dist/_chunks/libs/which.mjs +0 -1
- package/dist/_chunks/libs/word-wrap.mjs +0 -12
- package/dist/_chunks/node.mjs +0 -76
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/_chunks/sequence.mjs +0 -1
- package/dist/_chunks/src.mjs +0 -17
- package/dist/_chunks/src2.mjs +0 -499
- package/dist/vite-plugin/internal.d.mts +0 -44
- package/dist/vite-plugin/internal.mjs +0 -1
package/dist/config/index.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { _ as isLikeC4JsonConfig, a as LikeC4ProjectConfig, c as LikeC4ProjectJsonConfig, d as defineConfig, f as defineGenerators, g as isLikeC4Config, h as defineThemeColor, l as LikeC4StylesConfig, m as defineTheme, n as GeneratorFnContext, o as LikeC4ProjectConfigInput, p as defineStyle, r as GeneratorFnParams, s as LikeC4ProjectConfigOps, t as GeneratorFn, u as LikeC4StylesConfigInput, v as isLikeC4NonJsonConfig } from "../_chunks/index.mjs";
|
|
1
|
+
import { _ as isLikeC4JsonConfig, a as LikeC4ProjectConfig, c as LikeC4ProjectJsonConfig, d as defineConfig, f as defineGenerators, g as isLikeC4Config, h as defineThemeColor, l as LikeC4StylesConfig, m as defineTheme, n as GeneratorFnContext, o as LikeC4ProjectConfigInput, p as defineStyle, r as GeneratorFnParams, s as LikeC4ProjectConfigOps, t as GeneratorFn, u as LikeC4StylesConfigInput, v as isLikeC4NonJsonConfig } from "../chunks/index.mjs";
|
|
3
2
|
export { type GeneratorFn, type GeneratorFnContext, type GeneratorFnParams, type LikeC4ProjectConfig, type LikeC4ProjectConfigInput, LikeC4ProjectConfigOps, type LikeC4ProjectJsonConfig, type LikeC4StylesConfig, type LikeC4StylesConfigInput, defineConfig, defineGenerators, defineStyle, defineTheme, defineThemeColor, isLikeC4Config, isLikeC4JsonConfig, isLikeC4NonJsonConfig };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../chunks/rolldown-runtime.mjs";import{a as e,d as t,i as n,l as r,n as i,o as a,r as o,t as s,u as c}from"../chunks/filenames.mjs";function defineConfig(e){return a.parse(e)}function defineGenerators(e){return n.parse(e)}function defineThemeColor(e){return t.parse(e)}function defineTheme(e){return r.parse(e)}function defineStyle(e){return c.parse(e)}export{e as LikeC4ProjectConfigOps,defineConfig,defineGenerators,defineStyle,defineTheme,defineThemeColor,s as isLikeC4Config,i as isLikeC4JsonConfig,o as isLikeC4NonJsonConfig};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,133 +1,7 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import { t as Logger } from "./_chunks/libs/@logtape/logtape.mjs";
|
|
4
|
-
import "./_chunks/libs/langium.mjs";
|
|
5
|
-
import { a as LikeC4Views, i as LikeC4SharedServices, n as LikeC4ModelBuilder, o as ProjectsManager, r as LikeC4Services, t as LikeC4LanguageServices } from "./_chunks/index2.mjs";
|
|
6
|
-
import "./_chunks/libs/@chevrotain/types.mjs";
|
|
7
|
-
import "./_chunks/libs/ts-graphviz.mjs";
|
|
8
|
-
import { LikeC4Model } from "@likec4/core/model";
|
|
9
|
-
import { LayoutedView, NonEmptyArray, ProjectId } from "@likec4/core/types";
|
|
1
|
+
import { i as __name } from "./chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { t as LikeC4$1 } from "./chunks/index2.mjs";
|
|
10
3
|
export * from "@likec4/core/types";
|
|
11
4
|
|
|
12
|
-
//#region ../language-services/dist/_chunks/options.d.mts
|
|
13
|
-
//#region src/common/LikeC4.d.ts
|
|
14
|
-
interface LikeC4Langium {
|
|
15
|
-
shared: LikeC4SharedServices;
|
|
16
|
-
likec4: LikeC4Services;
|
|
17
|
-
}
|
|
18
|
-
declare class LikeC4$1 {
|
|
19
|
-
protected readonly langium: LikeC4Langium;
|
|
20
|
-
protected readonly logger: Logger;
|
|
21
|
-
constructor(langium: LikeC4Langium, logger?: Logger);
|
|
22
|
-
/**
|
|
23
|
-
* File system path to the workspace root
|
|
24
|
-
*/
|
|
25
|
-
get workspace(): any;
|
|
26
|
-
/**
|
|
27
|
-
* URI of the workspace root
|
|
28
|
-
*/
|
|
29
|
-
get workspaceURI(): any;
|
|
30
|
-
/**
|
|
31
|
-
* URL of the workspace root
|
|
32
|
-
*/
|
|
33
|
-
get workspaceURL(): any;
|
|
34
|
-
get languageServices(): LikeC4LanguageServices;
|
|
35
|
-
get projectsManager(): ProjectsManager;
|
|
36
|
-
get viewsService(): LikeC4Views;
|
|
37
|
-
get modelBuilder(): LikeC4ModelBuilder;
|
|
38
|
-
private get LangiumDocuments();
|
|
39
|
-
ensureSingleProject(): void;
|
|
40
|
-
/**
|
|
41
|
-
* Diagram is a computed view, layouted using Graphviz
|
|
42
|
-
* If diagram has manual layout, it will be used.
|
|
43
|
-
* Used in React components
|
|
44
|
-
*/
|
|
45
|
-
diagrams(project?: string | undefined): Promise<LayoutedView[]>;
|
|
46
|
-
/**
|
|
47
|
-
* Builds LikeC4Model from all documents
|
|
48
|
-
* Only computes view predicates {@link ComputedView} - i.e. no layout
|
|
49
|
-
* Not ready for rendering, but enough to traverse
|
|
50
|
-
*
|
|
51
|
-
* Sync version does not read manual layouts
|
|
52
|
-
* Use {@link computedModel} for a version that includes manual layouts
|
|
53
|
-
*/
|
|
54
|
-
syncComputedModel(project?: string | undefined): LikeC4Model.Computed;
|
|
55
|
-
/**
|
|
56
|
-
* Builds LikeC4Model from all documents
|
|
57
|
-
* Only computes view predicates {@link ComputedView} - i.e. no layout
|
|
58
|
-
* Not ready for rendering, but enough to traverse
|
|
59
|
-
*/
|
|
60
|
-
computedModel(project?: string | undefined): Promise<LikeC4Model.Computed>;
|
|
61
|
-
projects(): NonEmptyArray<ProjectId>;
|
|
62
|
-
/**
|
|
63
|
-
* Same as {@link computedModel()}, but also applies layout
|
|
64
|
-
* Ready for rendering
|
|
65
|
-
*/
|
|
66
|
-
layoutedModel(project?: string | undefined): Promise<LikeC4Model.Layouted>;
|
|
67
|
-
getErrors(): Array<{
|
|
68
|
-
message: string;
|
|
69
|
-
line: number;
|
|
70
|
-
range: {
|
|
71
|
-
start: {
|
|
72
|
-
line: number;
|
|
73
|
-
character: number;
|
|
74
|
-
};
|
|
75
|
-
end: {
|
|
76
|
-
line: number;
|
|
77
|
-
character: number;
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
sourceFsPath: string;
|
|
81
|
-
}>;
|
|
82
|
-
hasErrors(): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* @returns true if there are errors
|
|
85
|
-
*/
|
|
86
|
-
printErrors(): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Returns the number of parsed documents in the workspace
|
|
89
|
-
*/
|
|
90
|
-
documentCount(): number;
|
|
91
|
-
/**
|
|
92
|
-
* @returns a function to dispose the listener
|
|
93
|
-
*/
|
|
94
|
-
onModelUpdate(listener: () => void): () => void;
|
|
95
|
-
/**
|
|
96
|
-
* Formats documents and returns a map of document URI → formatted source text.
|
|
97
|
-
*
|
|
98
|
-
* Target selection uses union semantics:
|
|
99
|
-
* - Omit both `projects` and `documentUris` to format **all** documents.
|
|
100
|
-
* - Provide `projects` to include all documents from those projects.
|
|
101
|
-
* - Provide `documentUris` to include specific documents.
|
|
102
|
-
* - Provide both to format the **union** (deduplicated).
|
|
103
|
-
*/
|
|
104
|
-
format(options?: LikeC4FormatOptions): Promise<Map<string, string>>;
|
|
105
|
-
dispose(): Promise<void>;
|
|
106
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Options for {@link LikeC4.format}.
|
|
110
|
-
*
|
|
111
|
-
* Same as {@link FormatOptions} but uses project name strings instead of {@link ProjectId}.
|
|
112
|
-
*/
|
|
113
|
-
interface LikeC4FormatOptions {
|
|
114
|
-
/** Include all documents from these projects (by name). */
|
|
115
|
-
projects?: ReadonlyArray<string>;
|
|
116
|
-
/** Include these specific documents (by URI string). */
|
|
117
|
-
documentUris?: ReadonlyArray<string>;
|
|
118
|
-
/** Size of a tab in spaces (default: 2). */
|
|
119
|
-
tabSize?: number;
|
|
120
|
-
/** Prefer spaces over tabs (default: true). */
|
|
121
|
-
insertSpaces?: boolean;
|
|
122
|
-
/** Trim trailing whitespace on a line. */
|
|
123
|
-
trimTrailingWhitespace?: boolean;
|
|
124
|
-
/** Insert a newline character at the end of the file if one does not exist. */
|
|
125
|
-
insertFinalNewline?: boolean;
|
|
126
|
-
/** Trim all newlines after the final newline at the end of the file. */
|
|
127
|
-
trimFinalNewlines?: boolean;
|
|
128
|
-
} //#endregion
|
|
129
|
-
//#region src/common/options.d.ts
|
|
130
|
-
//#endregion
|
|
131
5
|
//#region src/LikeC4.d.ts
|
|
132
6
|
type LikeC4Options = {
|
|
133
7
|
/**
|
|
@@ -154,13 +28,6 @@ type LikeC4Options = {
|
|
|
154
28
|
* @default 'wasm'
|
|
155
29
|
*/
|
|
156
30
|
graphviz?: 'wasm' | 'binary';
|
|
157
|
-
/**
|
|
158
|
-
* Whether to start MCP server
|
|
159
|
-
* @default false
|
|
160
|
-
*/
|
|
161
|
-
mcp?: false | 'stdio' | {
|
|
162
|
-
port: number;
|
|
163
|
-
};
|
|
164
31
|
/**
|
|
165
32
|
* Whether to watch for changes in the workspace.
|
|
166
33
|
* @default false
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./
|
|
1
|
+
import{i as e}from"./chunks/rolldown-runtime.mjs";import{n as t,t as n}from"./chunks/node.mjs";import{t as r}from"./chunks/libs/defu.mjs";import{exact as i}from"@likec4/core";let a;(function(a){async function fromSource$1(e,t){let{logger:a,watch:o,...s}=t??{};return n(e,r(i({...s,configureLogger:a}),{configureLogger:`console`}))}e(fromSource$1,`fromSource`),a.fromSource=fromSource$1;async function fromWorkspace$1(e=``,n){let{logger:a,watch:o,...s}=n??{};return t(e,r(i({...s,configureLogger:a}),{configureLogger:`console`}))}e(fromWorkspace$1,`fromWorkspace`),a.fromWorkspace=fromWorkspace$1})(a||={});export{a as LikeC4};
|
package/dist/model/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as __name } from "../chunks/rolldown-runtime.mjs";
|
|
2
2
|
import * as types from "@likec4/core/types";
|
|
3
|
-
import { BBox, LayoutedDynamicView, NodeId, ViewId } from "@likec4/core/types";
|
|
3
|
+
import { BBox, EdgeId, LayoutedDynamicView, NodeId, ViewId } from "@likec4/core/types";
|
|
4
|
+
import { Connection, ConnectionModel, DeployedInstanceModel, DeploymentConnectionModel, DeploymentElementModel, DeploymentNodeModel, DeploymentRelationEndpoint, DeploymentRelationModel, EdgeModel, ElementModel, LikeC4DeploymentModel, LikeC4Model, LikeC4Model as LikeC4Model$1, LikeC4ViewModel, NodeModel, RelationshipModel, deploymentConnection, differenceConnections, findAscendingConnections, findDeepestNestedConnection, findDescendantConnections, hasSameSource, hasSameSourceTarget, hasSameTarget, isAnyInOut, isDeployedInstanceModel, isDeploymentElementModel, isDeploymentNodeModel, isDeploymentRelationModel, isEdgeModel, isElementModel, isIncoming, isLikeC4ViewModel, isNestedConnection, isNestedElementOfDeployedInstanceModel, isNodeModel, isOutgoing, isRelationModel, mergeConnections, modelConnection, sortConnectionsByBoundaryHierarchy, sortDeepestFirst } from "@likec4/core/model";
|
|
4
5
|
import { ComputedProjectEdge, ComputedProjectNode, ComputedProjectsView, LayoutedProjectEdge, LayoutedProjectNode, LayoutedProjectsView } from "@likec4/core/compute-view";
|
|
5
6
|
export * from "@likec4/core/types";
|
|
6
7
|
|
package/dist/model/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../chunks/rolldown-runtime.mjs";import{t as e}from"../chunks/sequence-view.mjs";import{Connection as t,ConnectionModel as n,DeployedInstanceModel as r,DeploymentConnectionModel as i,DeploymentNodeModel as a,DeploymentRelationModel as o,EdgeModel as s,ElementModel as c,LikeC4DeploymentModel as l,LikeC4Model as u,LikeC4Model as d,LikeC4ViewModel as f,NodeModel as p,RelationshipModel as m,deploymentConnection as h,differenceConnections as g,findAscendingConnections as _,findDeepestNestedConnection as v,findDescendantConnections as y,hasSameSource as b,hasSameSourceTarget as x,hasSameTarget as S,isAnyInOut as C,isDeployedInstanceModel as w,isDeploymentElementModel as T,isDeploymentNodeModel as E,isDeploymentRelationModel as D,isEdgeModel as O,isElementModel as k,isIncoming as A,isLikeC4ViewModel as j,isNestedConnection as M,isNestedElementOfDeployedInstanceModel as N,isNodeModel as P,isOutgoing as F,isRelationModel as I,mergeConnections as L,modelConnection as R,sortConnectionsByBoundaryHierarchy as z,sortDeepestFirst as B}from"@likec4/core/model";function createLikeC4Model(e){return d.create(e)}export{t as Connection,n as ConnectionModel,r as DeployedInstanceModel,i as DeploymentConnectionModel,a as DeploymentNodeModel,o as DeploymentRelationModel,s as EdgeModel,c as ElementModel,l as LikeC4DeploymentModel,u as LikeC4Model,f as LikeC4ViewModel,p as NodeModel,m as RelationshipModel,e as calcSequenceLayout,createLikeC4Model,h as deploymentConnection,g as differenceConnections,_ as findAscendingConnections,v as findDeepestNestedConnection,y as findDescendantConnections,b as hasSameSource,x as hasSameSourceTarget,S as hasSameTarget,C as isAnyInOut,w as isDeployedInstanceModel,T as isDeploymentElementModel,E as isDeploymentNodeModel,D as isDeploymentRelationModel,O as isEdgeModel,k as isElementModel,A as isIncoming,j as isLikeC4ViewModel,M as isNestedConnection,N as isNestedElementOfDeployedInstanceModel,P as isNodeModel,F as isOutgoing,I as isRelationModel,L as mergeConnections,R as modelConnection,z as sortConnectionsByBoundaryHierarchy,B as sortDeepestFirst};
|
|
@@ -1,19 +1,92 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
5
|
-
import "../_chunks/libs/@chevrotain/types.mjs";
|
|
6
|
-
import "../_chunks/libs/ts-graphviz.mjs";
|
|
7
|
-
import { Plugin } from "vite";
|
|
1
|
+
import { i as __name } from "../chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { n as LikeC4LanguageServices } from "../chunks/index2.mjs";
|
|
3
|
+
import { PluginOption } from "vite";
|
|
4
|
+
import { AnyTextAdapter } from "@tanstack/ai";
|
|
8
5
|
|
|
9
6
|
//#region ../vite-plugin/dist/index.d.mts
|
|
7
|
+
//#region src/virtuals/app-config.d.ts
|
|
8
|
+
interface AppConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Webcomponent prefix for likec4 webcomponents
|
|
11
|
+
* @default 'likec4'
|
|
12
|
+
*/
|
|
13
|
+
webcomponentPrefix?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Page title for the application
|
|
16
|
+
* @default 'LikeC4'
|
|
17
|
+
*/
|
|
18
|
+
pageTitle?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to use hash history for the application
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
useHashHistory?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Default color scheme for the application
|
|
26
|
+
* @default 'auto'
|
|
27
|
+
*/
|
|
28
|
+
theme?: 'light' | 'dark' | undefined;
|
|
29
|
+
} //#endregion
|
|
10
30
|
//#region src/plugin.d.ts
|
|
31
|
+
interface AIOptions<TAdapter extends AnyTextAdapter = AnyTextAdapter> {
|
|
32
|
+
/**
|
|
33
|
+
* The AI adapter to use
|
|
34
|
+
*
|
|
35
|
+
* @see https://tanstack.com/ai/latest/docs/getting-started/overview#adapters
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { openRouterText } from '@tanstack/ai-openrouter'
|
|
39
|
+
*
|
|
40
|
+
* export default defineConfig({
|
|
41
|
+
* plugins: [
|
|
42
|
+
* likec4VitePlugin({
|
|
43
|
+
* ai: {
|
|
44
|
+
* adapter: openRouterText("openai/gpt-5")
|
|
45
|
+
* },
|
|
46
|
+
* }),
|
|
47
|
+
* ],
|
|
48
|
+
* })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
adapter: TAdapter;
|
|
52
|
+
/** Model-specific provider options (type comes from adapter) */
|
|
53
|
+
modelOptions?: TAdapter['~types']['providerOptions'];
|
|
54
|
+
maxTokens?: number;
|
|
55
|
+
}
|
|
11
56
|
type SharedOptions = {
|
|
57
|
+
/**
|
|
58
|
+
* AI configuration, by default enabled with automatic detection based on environment variables.
|
|
59
|
+
* You can also provide explicit configuration.
|
|
60
|
+
* Or set to `disabled` to disable AI.
|
|
61
|
+
*
|
|
62
|
+
* @default 'auto' (automatic detection based on environment variables)
|
|
63
|
+
*
|
|
64
|
+
* @see https://tanstack.com/ai/latest/docs/getting-started/overview#adapters
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { openRouterText } from '@tanstack/ai-openrouter'
|
|
68
|
+
*
|
|
69
|
+
* export default defineConfig({
|
|
70
|
+
* plugins: [
|
|
71
|
+
* likec4VitePlugin({
|
|
72
|
+
* ai: {
|
|
73
|
+
* adapter: openRouterText("openai/gpt-5")
|
|
74
|
+
* },
|
|
75
|
+
* }),
|
|
76
|
+
* ],
|
|
77
|
+
* })
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
ai?: 'disabled' | 'auto' | AIOptions | undefined;
|
|
12
81
|
/**
|
|
13
82
|
* Define vite environments where this plugin should be active
|
|
14
83
|
* By default, the plugin is active in all environments
|
|
15
84
|
*/
|
|
16
85
|
environments?: string | string[];
|
|
86
|
+
/**
|
|
87
|
+
* Configuration for the static application
|
|
88
|
+
*/
|
|
89
|
+
appConfig?: AppConfig;
|
|
17
90
|
};
|
|
18
91
|
type LikeC4VitePluginOptions = SharedOptions & ({
|
|
19
92
|
/**
|
|
@@ -44,6 +117,11 @@ type LikeC4VitePluginOptions = SharedOptions & ({
|
|
|
44
117
|
* @default true if vite mode is 'development', false otherwise
|
|
45
118
|
*/
|
|
46
119
|
watch?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The log level to use.
|
|
122
|
+
* @default 'warning'
|
|
123
|
+
*/
|
|
124
|
+
logLevel?: 'trace' | 'debug' | 'info' | 'warning' | 'error' | undefined;
|
|
47
125
|
languageServices?: never;
|
|
48
126
|
} | {
|
|
49
127
|
/**
|
|
@@ -56,10 +134,13 @@ type LikeC4VitePluginOptions = SharedOptions & ({
|
|
|
56
134
|
throwIfInvalid?: never;
|
|
57
135
|
graphviz?: never;
|
|
58
136
|
watch?: never;
|
|
137
|
+
logLevel?: never;
|
|
59
138
|
});
|
|
60
139
|
declare function LikeC4VitePlugin({
|
|
61
140
|
environments,
|
|
62
|
-
|
|
63
|
-
|
|
141
|
+
appConfig,
|
|
142
|
+
ai: _ai,
|
|
143
|
+
...pluginOpts
|
|
144
|
+
}: LikeC4VitePluginOptions): PluginOption; //#endregion
|
|
64
145
|
//#endregion
|
|
65
146
|
export { LikeC4VitePlugin, type LikeC4VitePluginOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{t as e}from"../chunks/plugin.mjs";export{e as LikeC4VitePlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";import{useCallback as e,useRef as t,useSyncExternalStore as n}from"react";function listenKeys(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}let emit=(e,t)=>n=>{e.current!==n&&(e.current=n,t())};function useStore(r,{keys:i,deps:a=[r,i],ssr:o}={}){let s=t();s.current=r.get();let c=e(e=>(emit(s,e)(r.value),i?.length>0?listenKeys(r,i,emit(s,e)):r.listen(emit(s,e))),a),get=()=>s.current,l=get;return o&&`init`in r&&(l=o===`initial`?()=>r.init:o),n(c,get,l)}export{useStore as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../rolldown-runtime.mjs";function createPromiseWithResolvers(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const e=Math.random.bind(Math);function nanoid(t=21){let n=``,r=t;for(;r--;)n+=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`[e()*64|0];return n}const defaultSerialize=e=>e,t=defaultSerialize,{clearTimeout:n,setTimeout:r}=globalThis;function createBirpc(e,i){let{post:a,on:o,off=()=>{},eventNames:s=[],serialize:c=defaultSerialize,deserialize:l=t,resolver:u,bind:d=`rpc`,timeout:f=6e4,proxify:p=!0}=i,m=!1,h=new Map,g,_;async function _call(e,t,o,s){if(m)throw Error(`[birpc] rpc is closed, cannot call "${e}"`);let l={m:e,a:t,t:`q`};s&&(l.o=!0);let send=async e=>a(c(e));if(o){await send(l);return}if(g)try{await g}finally{g=void 0}let{promise:u,resolve:d,reject:p}=createPromiseWithResolvers(),v=nanoid();l.i=v;let y;async function handler(n=l){return f>=0&&(y=r(()=>{try{if(i.onTimeoutError?.call(_,e,t)!==!0)throw Error(`[birpc] timeout on calling "${e}"`)}catch(e){p(e)}h.delete(v)},f),typeof y==`object`&&(y=y.unref?.())),h.set(v,{resolve:d,reject:p,timeoutId:y,method:e}),await send(n),u}try{i.onRequest?await i.onRequest.call(_,l,handler,d):await handler()}catch(e){if(i.onGeneralError?.call(_,e)!==!0)throw e;return}finally{n(y),h.delete(v)}return u}let v={$call:(e,...t)=>_call(e,t,!1),$callOptional:(e,...t)=>_call(e,t,!1,!0),$callEvent:(e,...t)=>_call(e,t,!0),$callRaw:e=>_call(e.method,e.args,e.event,e.optional),$rejectPendingCalls,get $closed(){return m},get $meta(){return i.meta},$close,$functions:e};_=p?new Proxy({},{get(t,n){if(Object.prototype.hasOwnProperty.call(v,n))return v[n];if(n===`then`&&!s.includes(`then`)&&!(`then`in e))return;let sendEvent=(...e)=>_call(n,e,!0);if(s.includes(n))return sendEvent.asEvent=sendEvent,sendEvent;let sendCall=(...e)=>_call(n,e,!1);return sendCall.asEvent=sendEvent,sendCall}}):v;function $close(e){m=!0,h.forEach(({reject:t,method:n})=>{let r=Error(`[birpc] rpc is closed, cannot call "${n}"`);if(e)return e.cause??=r,t(e);t(r)}),h.clear(),off(onMessage)}function $rejectPendingCalls(e){let t=Array.from(h.values()).map(({method:t,reject:n})=>e?e({method:t,reject:n}):n(Error(`[birpc]: rejected pending call "${t}".`)));return h.clear(),t}async function onMessage(t,...r){let o;try{o=l(t)}catch(e){if(i.onGeneralError?.call(_,e)!==!0)throw e;return}if(o.t===`q`){let{m:t,a:n,o:s}=o,l,f,fn=await(u?u.call(_,t,e[t]):e[t]);if(s&&(fn||=()=>void 0),!fn)f=Error(`[birpc] function "${t}" not found`);else try{l=await fn.apply(d===`rpc`?_:e,n)}catch(e){f=e}if(o.i){if(f&&i.onFunctionError&&i.onFunctionError.call(_,f,t,n)===!0)return;if(!f)try{await a(c({t:`s`,i:o.i,r:l}),...r);return}catch(e){if(f=e,i.onGeneralError?.call(_,e,t,n)!==!0)throw e}try{await a(c({t:`s`,i:o.i,e:f}),...r)}catch(e){if(i.onGeneralError?.call(_,e,t,n)!==!0)throw e}}}else{let{i:e,r:t,e:r}=o,i=h.get(e);i&&(n(i.timeoutId),r?i.reject(r):i.resolve(t)),h.delete(e)}}return g=o(onMessage),_}export{createBirpc as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../rolldown-runtime.mjs";const{getOwnPropertyNames:e,getOwnPropertySymbols:t}=Object,{hasOwnProperty:n}=Object.prototype;function combineComparators(e,t){return function isEqual(n,r,i){return e(n,r,i)&&t(n,r,i)}}function createIsCircular(e){return function isCircular(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function getStrictProperties(n){return e(n).concat(t(n))}const r=Object.hasOwn||((e,t)=>n.call(e,t)),{getOwnPropertyDescriptor:i,keys:a}=Object,o=Object.is||function sameValueEqual(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t};function strictEqual(e,t){return e===t}function areArrayBuffersEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e),new Uint8Array(t))}function areArraysEqual(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function areDataViewsEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function areDatesEqual(e,t){return o(e.getTime(),t.getTime())}function areErrorsEqual(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function areMapsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function areObjectsEqual(e,t,n){let r=a(e),i=r.length;if(a(t).length!==i)return!1;for(;i-- >0;)if(!isPropertyEqual(e,t,n,r[i]))return!1;return!0}function areObjectsEqualStrict(e,t,n){let r=getStrictProperties(e),a=r.length;if(getStrictProperties(t).length!==a)return!1;let o,s,c;for(;a-- >0;)if(o=r[a],!isPropertyEqual(e,t,n,o)||(s=i(e,o),c=i(t,o),(s||c)&&(!s||!c||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable)))return!1;return!0}function arePrimitiveWrappersEqual(e,t){return o(e.valueOf(),t.valueOf())}function areRegExpsEqual(e,t){return e.source===t.source&&e.flags===t.flags}function areSetsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function areTypedArraysEqual(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function areUrlsEqual(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function isPropertyEqual(e,t,n,i){return(i===`_owner`||i===`__o`||i===`__v`)&&(e.$$typeof||t.$$typeof)?!0:r(t,i)&&n.equals(e[i],t[i],i,i,e,t,n)}const s=Object.prototype.toString;function createEqualityComparator(e){let t=createSupportedComparatorMap(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:c,areRegExpsEqual:l,areSetsEqual:u,getUnsupportedCustomComparator:d}=e;return function comparator(e,f,p){if(e===f)return!0;if(e==null||f==null)return!1;let m=typeof e;if(m!==typeof f)return!1;if(m!==`object`)return m===`number`||m===`bigint`?o(e,f,p):m===`function`?i(e,f,p):!1;let h=e.constructor;if(h!==f.constructor)return!1;if(h===Object)return c(e,f,p);if(h===Array)return n(e,f,p);if(h===Date)return r(e,f,p);if(h===RegExp)return l(e,f,p);if(h===Map)return a(e,f,p);if(h===Set)return u(e,f,p);if(h===Promise)return!1;if(Array.isArray(e))return n(e,f,p);let g=s.call(e),_=t[g];if(_)return _(e,f,p);let v=d&&d(e,f,p,g);return v?v(e,f,p):!1}}function createEqualityComparatorConfig({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual,areArraysEqual:n?areObjectsEqualStrict:areArraysEqual,areDataViewsEqual,areDatesEqual,areErrorsEqual,areFunctionsEqual:strictEqual,areMapsEqual:n?combineComparators(areMapsEqual,areObjectsEqualStrict):areMapsEqual,areNumbersEqual:o,areObjectsEqual:n?areObjectsEqualStrict:areObjectsEqual,arePrimitiveWrappersEqual,areRegExpsEqual,areSetsEqual:n?combineComparators(areSetsEqual,areObjectsEqualStrict):areSetsEqual,areTypedArraysEqual:n?combineComparators(areTypedArraysEqual,areObjectsEqualStrict):areTypedArraysEqual,areUrlsEqual,getUnsupportedCustomComparator:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=createIsCircular(r.areArraysEqual),t=createIsCircular(r.areMapsEqual),n=createIsCircular(r.areObjectsEqual),i=createIsCircular(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function createInternalEqualityComparator(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function createIsEqual({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function isEqual(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function isEqual(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function isEqual(e,n){return t(e,n,a)}}function createSupportedComparatorMap({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}const c=createCustomEqual();createCustomEqual({strict:!0}),createCustomEqual({circular:!0}),createCustomEqual({circular:!0,strict:!0});const l=createCustomEqual({createInternalComparator:()=>o});createCustomEqual({strict:!0,createInternalComparator:()=>o}),createCustomEqual({circular:!0,createInternalComparator:()=>o}),createCustomEqual({circular:!0,createInternalComparator:()=>o,strict:!0});function createCustomEqual(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=createEqualityComparator(createEqualityComparatorConfig(e));return createIsEqual({circular:t,comparator:a,createState:r,equals:n?n(a):createInternalEqualityComparator(a),strict:i})}export{l as n,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../rolldown-runtime.mjs";let e=[],t=0,n=0;const atom=r=>{let i=[],a={get(){return a.lc||a.listen(()=>{})(),a.value},init:r,lc:0,listen(n){return a.lc=i.push(n),()=>{for(let r=t+4;r<e.length;)e[r]===n?e.splice(r,4):r+=4;let r=i.indexOf(n);~r&&(i.splice(r,1),--a.lc||a.off())}},notify(r,o){n++;let s=!e.length;for(let t of i)e.push(t,a.value,r,o);if(s){for(t=0;t<e.length;t+=4)e[t](e[t+1],e[t+2],e[t+3]);e.length=0}},off(){},set(e){let t=a.value;t!==e&&(a.value=e,a.notify(t))},subscribe(e){let t=a.listen(e);return e(a.value),t},value:r};return a};let on=(e,t,n,r)=>(e.events=e.events||{},e.events[n+10]||(e.events[n+10]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+10](),delete e.events[n+10])}),onMount=(e,t)=>{let listener=n=>{let r=t(n);r&&e.events[6].push(r)};return on(e,listener,5,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[6]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[6])t();e.events[6]=[]}},1e3)},()=>{e.listen=n,e.off=r}})},computedStore=(e,t,r)=>{Array.isArray(e)||(e=[e]);let i,a,set=()=>{if(a===n)return;a=n;let r=e.map(e=>e.get());if(!i||r.some((e,t)=>e!==i[t])){i=r;let e=t(...r);e&&e.then&&e.t?e.then(e=>{i===r&&o.set(e)}):(o.set(e),a=n)}},o=atom(void 0),s=o.get;o.get=()=>(set(),s());let c,l=r?()=>{clearTimeout(c),c=setTimeout(set)}:set;return onMount(o,()=>{let t=e.map(e=>e.listen(l));return set(),()=>{for(let e of t)e()}}),o};const computed=(e,t)=>computedStore(e,t),batched=(e,t)=>computedStore(e,t,!0),map=(e={})=>{let t=atom(e);return t.setKey=function(e,n){let r=t.value;n===void 0&&e in t.value?(t.value={...t.value},delete t.value[e],t.notify(r,e)):t.value[e]!==n&&(t.value={...t.value,[e]:n},t.notify(r,e))},t};export{atom as i,batched as n,computed as r,map as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as i}from"../rolldown-runtime.mjs";function e(i,a,o){let r=o=>i(o,...a);return o===void 0?r:Object.assign(r,{lazy:o,lazyArgs:a})}function t$1(i,a,o){let s=i.length-a.length;if(s===0)return i(...a);if(s===1)return e(i,a,o);throw Error(`Wrong number of arguments`)}i(t$1,`t`);function t(...i){return t$1(n,i)}function n(i,a){let o={};for(let[s,c]of Object.entries(i))o[s]=a(c,s,i);return o}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name as t};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { t as __name } from "./chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { LikeC4Model } from "@likec4/core/model";
|
|
1
3
|
import { DependencyList } from "react";
|
|
4
|
+
import { LayoutedElementView, LayoutedLikeC4ModelData, LayoutedView, ProjectId, ViewChange, ViewId } from "@likec4/core/types";
|
|
5
|
+
import { AdhocViewPredicate } from "@likec4/core/compute-view";
|
|
2
6
|
|
|
7
|
+
//#region ../vite-plugin/dist/internal/chunks/libs/@nanostores/react.d.mts
|
|
3
8
|
//#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/atom/index.d.ts
|
|
4
9
|
type AllKeys<T> = T extends any ? keyof T : never;
|
|
5
10
|
type Primitive = boolean | number | string;
|
|
@@ -121,8 +126,7 @@ type Atom<Value = any> = ReadableAtom<Value> | WritableAtom<Value>;
|
|
|
121
126
|
* @param initialValue Initial value of the store.
|
|
122
127
|
* @returns The store object with methods to subscribe.
|
|
123
128
|
*/
|
|
124
|
-
declare function atom<Value, StoreExt = object>(...args: undefined extends Value ? [] | [Value] : [Value]): PreinitializedWritableAtom<Value> & StoreExt;
|
|
125
|
-
//#endregion
|
|
129
|
+
declare function atom<Value, StoreExt = object>(...args: undefined extends Value ? [] | [Value] : [Value]): PreinitializedWritableAtom<Value> & StoreExt; //#endregion
|
|
126
130
|
//#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/map/index.d.ts
|
|
127
131
|
type KeyofBase = keyof any;
|
|
128
132
|
type Get<T, K extends KeyofBase> = Extract<T, { [K1 in K]: any }>[K];
|
|
@@ -215,13 +219,60 @@ interface PreinitializedMapStore<Value extends object = any> extends MapStore<Va
|
|
|
215
219
|
* @param init Initialize store and return store destructor.
|
|
216
220
|
* @returns The store object with methods to subscribe.
|
|
217
221
|
*/
|
|
218
|
-
declare function map<Value extends object, StoreExt extends object = object>(value?: Value): PreinitializedMapStore<Value> & StoreExt;
|
|
222
|
+
declare function map<Value extends object, StoreExt extends object = object>(value?: Value): PreinitializedMapStore<Value> & StoreExt; //#endregion
|
|
223
|
+
//#region ../../node_modules/.pnpm/@nanostores+react@1.1.0_nanostores@1.2.0_react@19.2.6/node_modules/@nanostores/react/index.d.ts
|
|
224
|
+
type StoreKeys<T> = T extends {
|
|
225
|
+
setKey: (k: infer K, v: any) => unknown;
|
|
226
|
+
} ? K : never;
|
|
227
|
+
interface UseStoreOptions<SomeStore> {
|
|
228
|
+
/**
|
|
229
|
+
* @default
|
|
230
|
+
* ```ts
|
|
231
|
+
* [store, options.keys]
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
deps?: DependencyList;
|
|
235
|
+
/**
|
|
236
|
+
* Will re-render components only on specific key changes.
|
|
237
|
+
*/
|
|
238
|
+
keys?: StoreKeys<SomeStore>[];
|
|
239
|
+
/**
|
|
240
|
+
* Enable SSR support. Set `initial` when store's initial value is the same on
|
|
241
|
+
* server and client, or provide a function to return the server store state
|
|
242
|
+
* for advanced cases (per useSyncExternalStore's getServerSnapshot).
|
|
243
|
+
*/
|
|
244
|
+
ssr?: (() => StoreValue<SomeStore>) | 'initial' | false;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Subscribe to store changes and get store’s value.
|
|
248
|
+
*
|
|
249
|
+
* Can be user with store builder too.
|
|
250
|
+
*
|
|
251
|
+
* ```js
|
|
252
|
+
* import { useStore } from 'nanostores/react'
|
|
253
|
+
*
|
|
254
|
+
* import { router } from '../store/router'
|
|
255
|
+
*
|
|
256
|
+
* export const Layout = () => {
|
|
257
|
+
* let page = useStore(router)
|
|
258
|
+
* if (page.route === 'home') {
|
|
259
|
+
* return <HomePage />
|
|
260
|
+
* } else {
|
|
261
|
+
* return <Error404 />
|
|
262
|
+
* }
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @param store Store instance.
|
|
267
|
+
* @returns Store value.
|
|
268
|
+
*/
|
|
269
|
+
declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>; //#endregion
|
|
219
270
|
//#endregion
|
|
271
|
+
//#region ../vite-plugin/dist/internal/chunks/libs/nanostores.d.mts
|
|
220
272
|
//#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/task/index.d.ts
|
|
221
273
|
interface Task<Value> extends Promise<Value> {
|
|
222
274
|
t: true;
|
|
223
|
-
}
|
|
224
|
-
//#endregion
|
|
275
|
+
} //#endregion
|
|
225
276
|
//#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/computed/index.d.ts
|
|
226
277
|
type StoreValues<Stores extends AnyStore[]> = { [Index in keyof Stores]: StoreValue<Stores[Index]> };
|
|
227
278
|
interface Computed {
|
|
@@ -270,54 +321,61 @@ interface Batched {
|
|
|
270
321
|
*/
|
|
271
322
|
<Value, OriginStores extends AnyStore[]>(stores: [...OriginStores], cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value): ReadableAtom<Value>;
|
|
272
323
|
}
|
|
273
|
-
declare const batched: Batched;
|
|
324
|
+
declare const batched: Batched; //#endregion
|
|
274
325
|
//#endregion
|
|
275
|
-
//#region
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
} ? K : never;
|
|
279
|
-
interface UseStoreOptions<SomeStore> {
|
|
326
|
+
//#region ../vite-plugin/dist/internal/index.d.mts
|
|
327
|
+
//#region src/rpc/protocol.d.ts
|
|
328
|
+
interface LikeC4VitePluginRpc {
|
|
280
329
|
/**
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
330
|
+
* Apply semantic layout (if AI is available)
|
|
331
|
+
* See vite-plugin for more details
|
|
332
|
+
*
|
|
333
|
+
* (Available in the dev server)
|
|
285
334
|
*/
|
|
286
|
-
|
|
335
|
+
applySemanticLayout(payload: {
|
|
336
|
+
projectId: ProjectId;
|
|
337
|
+
viewId: ViewId;
|
|
338
|
+
}): Promise<void>;
|
|
287
339
|
/**
|
|
288
|
-
*
|
|
340
|
+
* Send a view change to the server
|
|
341
|
+
* (Available in the dev server)
|
|
289
342
|
*/
|
|
290
|
-
|
|
343
|
+
updateView(payload: {
|
|
344
|
+
projectId: ProjectId;
|
|
345
|
+
viewId: ViewId;
|
|
346
|
+
change: ViewChange;
|
|
347
|
+
}): Promise<void>;
|
|
291
348
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* for advanced cases (per useSyncExternalStore's getServerSnapshot).
|
|
349
|
+
* Calculate an adhoc view
|
|
350
|
+
* (Available in the dev server)
|
|
295
351
|
*/
|
|
296
|
-
|
|
352
|
+
calcAdhocView(payload: {
|
|
353
|
+
projectId: ProjectId;
|
|
354
|
+
predicates: AdhocViewPredicate[];
|
|
355
|
+
}): Promise<LayoutedElementView>;
|
|
356
|
+
} //#endregion
|
|
357
|
+
//#region src/internal.d.ts
|
|
358
|
+
interface LikeC4VitePluginRpcOptions {
|
|
359
|
+
/**
|
|
360
|
+
* Function to post raw message
|
|
361
|
+
*/
|
|
362
|
+
send: (event: string, data: any) => void;
|
|
363
|
+
/**
|
|
364
|
+
* Listener to receive raw message
|
|
365
|
+
*/
|
|
366
|
+
on: (event: string, fn: (data: any, ...extras: any[]) => void) => void;
|
|
297
367
|
}
|
|
298
368
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* Can be user with store builder too.
|
|
302
|
-
*
|
|
303
|
-
* ```js
|
|
304
|
-
* import { useStore } from 'nanostores/react'
|
|
305
|
-
*
|
|
306
|
-
* import { router } from '../store/router'
|
|
307
|
-
*
|
|
308
|
-
* export const Layout = () => {
|
|
309
|
-
* let page = useStore(router)
|
|
310
|
-
* if (page.route === 'home') {
|
|
311
|
-
* return <HomePage />
|
|
312
|
-
* } else {
|
|
313
|
-
* return <Error404 />
|
|
314
|
-
* }
|
|
315
|
-
* }
|
|
316
|
-
* ```
|
|
317
|
-
*
|
|
318
|
-
* @param store Store instance.
|
|
319
|
-
* @returns Store value.
|
|
369
|
+
* Create a PluginRPC instance for the LikeC4 Vite plugin
|
|
370
|
+
* used by the Vite plugin in virtual modules
|
|
320
371
|
*/
|
|
321
|
-
declare function
|
|
372
|
+
declare function createRpc(options: LikeC4VitePluginRpcOptions): LikeC4VitePluginRpc;
|
|
373
|
+
declare function createHooksForModel($atom: WritableAtom<LayoutedLikeC4ModelData>): {
|
|
374
|
+
updateModel: (data: LayoutedLikeC4ModelData) => void;
|
|
375
|
+
$likec4model: Atom<LikeC4Model.Layouted>;
|
|
376
|
+
useLikeC4Model: () => LikeC4Model.Layouted;
|
|
377
|
+
useLikeC4Views: () => ReadonlyArray<LayoutedView>;
|
|
378
|
+
useLikeC4View: (viewId: string) => LayoutedView | null;
|
|
379
|
+
}; //#endregion
|
|
322
380
|
//#endregion
|
|
323
|
-
export { Atom
|
|
381
|
+
export { type Atom, type LikeC4VitePluginRpc, LikeC4VitePluginRpcOptions, type ReadableAtom, type WritableAtom, atom, batched, computed, createHooksForModel, createRpc, map, useStore };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunks/rolldown-runtime.mjs";import{i as e,n as t,r as n,t as r}from"./chunks/libs/nanostores.mjs";import{t as i}from"./chunks/libs/@nanostores/react.mjs";import{t as a}from"./chunks/libs/birpc.mjs";import{n as o,t as s}from"./chunks/libs/fast-equals.mjs";import{t as c}from"./chunks/libs/remeda.mjs";import{LikeC4Model as l}from"@likec4/core/model";import{useMemo as u}from"react";function createRpc(e){return a({},{timeout:120*1e3,post:t=>e.send(`likec4:rpc`,t),on:t=>e.on(`likec4:rpc`,t),onTimeoutError(e){return e===`applySemanticLayout`},onGeneralError(e,t){console.error(`RPC error in ${t}`,{error:e})},onFunctionError:(e,t)=>{console.error(`RPC error in ${t}`,{error:e})}})}function createHooksForModel(e){let t=n(e,e=>l.create(e));function updateModel(t){let n=e.get(),r={...t,views:c(t.views,e=>{let t=n.views[e.id];return s(t,e)?t:e})};o(r.views,n.views)&&s(r,n)||e.set(r)}let r=n(t,e=>[...e.views()].map(e=>e.$layouted));function useLikeC4Model(){return i(t)}function useLikeC4Views(){return i(r)}function useLikeC4View(e){return i(u(()=>n(t,t=>t.findView(e)?.$layouted??null),[e]))}return{updateModel,$likec4model:t,useLikeC4Model,useLikeC4Views,useLikeC4View}}export{e as atom,t as batched,n as computed,createHooksForModel,createRpc,r as map,i as useStore};
|