likec4 1.49.0 → 1.50.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__/src/likec4.js +17 -40
- package/__app__/src/routes/single.js +27 -20
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +1152 -1013
- package/config/schema.json +16 -0
- package/dist/THIRD-PARTY-LICENSES.md +31 -1
- package/dist/_chunks/LikeC4.mjs +1154 -0
- package/dist/_chunks/binary.mjs +72 -0
- package/dist/_chunks/index.d.mts +11 -12
- package/dist/_chunks/index2.d.mts +166 -76
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +30 -0
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +8 -8
- package/dist/_chunks/libs/@chevrotain/types.d.mts +1 -0
- package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -1
- package/dist/_chunks/libs/@hono/mcp.mjs +8 -8
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -1
- package/dist/_chunks/libs/@logtape/logtape.mjs +3 -3
- package/dist/_chunks/libs/@lume/kiwi.mjs +1 -1
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +114 -14
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +7 -7
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -1
- package/dist/_chunks/libs/@nanostores/react.d.mts +61 -1
- package/dist/_chunks/libs/@nanostores/react.mjs +1 -1
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +1 -0
- package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -1
- package/dist/_chunks/libs/ajv.mjs +1 -1
- package/dist/_chunks/libs/atomically.mjs +1 -1
- package/dist/_chunks/libs/birpc.mjs +1 -1
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/_chunks/libs/chevrotain.mjs +35 -35
- package/dist/_chunks/libs/conf.mjs +1 -1
- package/dist/_chunks/libs/defu.mjs +1 -1
- package/dist/_chunks/libs/esm-env.mjs +1 -1
- package/dist/_chunks/libs/eventemitter3.mjs +1 -1
- package/dist/_chunks/libs/fast-equals.mjs +1 -1
- package/dist/_chunks/libs/find-up-simple.mjs +1 -1
- package/dist/_chunks/libs/get-port.mjs +1 -1
- package/dist/_chunks/libs/is-docker.mjs +1 -1
- package/dist/_chunks/libs/is-error-instance.mjs +1 -1
- package/dist/_chunks/libs/is-inside-container.mjs +1 -1
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -1
- package/dist/_chunks/libs/isexe.mjs +1 -1
- package/dist/_chunks/libs/json5.mjs +10 -10
- package/dist/_chunks/libs/khroma.mjs +1 -1
- package/dist/_chunks/libs/ky.mjs +2 -2
- package/dist/_chunks/libs/langium.d.mts +4 -3
- package/dist/_chunks/libs/langium.mjs +20 -19
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -2
- package/dist/_chunks/libs/p-limit.mjs +1 -1
- package/dist/_chunks/libs/p-queue.mjs +1 -1
- package/dist/_chunks/libs/package-manager-detector.mjs +1 -1
- package/dist/_chunks/libs/package-up.mjs +1 -1
- package/dist/_chunks/libs/pako.mjs +1 -0
- package/dist/_chunks/libs/parse-ms.mjs +1 -1
- package/dist/_chunks/libs/pathe.mjs +1 -1
- package/dist/_chunks/libs/picomatch.mjs +1 -1
- package/dist/_chunks/libs/pretty-ms.mjs +1 -1
- package/dist/_chunks/libs/remeda.mjs +2 -1
- package/dist/_chunks/libs/safe-stringify.mjs +1 -1
- package/dist/_chunks/libs/strip-indent.mjs +1 -1
- package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
- package/dist/_chunks/libs/ts-graphviz.mjs +3 -3
- package/dist/_chunks/libs/ufo.mjs +1 -1
- package/dist/_chunks/libs/which.mjs +1 -1
- package/dist/_chunks/libs/word-wrap.mjs +2 -2
- package/dist/_chunks/rolldown-runtime.mjs +1 -1
- package/dist/_chunks/sequence.mjs +1 -0
- package/dist/_chunks/src.mjs +15 -0
- package/dist/_chunks/src2.mjs +499 -0
- package/dist/cli/index.mjs +75 -231
- package/dist/config/index.mjs +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +1 -1
- package/dist/model/index.mjs +1 -1
- package/dist/vite-plugin/index.d.mts +3 -0
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal.d.mts +1 -2
- package/dist/vite-plugin/internal.mjs +1 -1
- package/package.json +26 -26
- package/react/index.d.mts +2 -2
- package/react/index.mjs +36 -54
- package/vite-plugin-modules.d.ts +5 -0
- package/dist/_chunks/GraphvizBinaryAdapter.mjs +0 -72
- package/dist/_chunks/filenames.mjs +0 -14
- package/dist/_chunks/libs/@chevrotain/gast.mjs +0 -1
- package/dist/_chunks/libs/nanostores.d.mts +0 -63
- package/dist/_chunks/libs/nanostores.mjs +0 -1
- package/dist/_chunks/node.mjs +0 -481
- package/dist/_chunks/plugin.mjs +0 -322
- package/dist/_chunks/sequence-view.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
`)),
|
|
1
|
+
function e(e){return typeof e==`object`&&!!e&&typeof e.id==`string`}function t(e){return typeof e==`object`&&!!e&&e.$$type===`Node`&&typeof e.id==`string`}function n(n){return t(n)||e(n)}function r(e){return typeof e==`string`||n(e)}function i(e){return Array.isArray(e)&&e.every(r)}function a(e){return[`n`,`ne`,`e`,`se`,`s`,`sw`,`w`,`nw`,`c`].includes(e)}function o(e){if(n(e))return e;let[t,r,i]=e.split(`:`);return a(i)?{id:t,port:r,compass:i}:{id:t,port:r}}function s(e){if(e.length<2&&(r(e[0])&&r(e[1]))===!1)throw Error(`EdgeTargets must have at least 2 elements.`);return e.map(e=>o(e))}const c=Object.seal({Graph:null,Digraph:null,Subgraph:null,Node:null,Edge:null});function l(e){return Object.assign(Object.seal(Object.assign({},c)),e)}function u(...e){let[t,...n]=e;return(...e)=>n.reduce((e,t)=>t(e),t(...e))}function d(e,...t){return u(e,...t)}const f=e=>(...t)=>n=>e(n,...t),p=e=>({[Symbol.iterator]:e}),m=f((e,t)=>Array.from(p(function*(){for(let n of e)yield t(n)})));var h=class{options;getLocation(){return this.options?.locationFunction?.()??null}constructor(e){this.options=e}createElement(e,t,n=[]){return{location:this.getLocation(),...t,type:e,children:n}}};const g=h.prototype.createElement.bind(new h),_=/\r?\n/;function v(e){return t=>t.join(e)}function y(e){return t=>e+t+e}function b(e,t){return n=>e+n+t}function x(e){return t=>e+t}const S=e=>e.replace(/\r/g,`\\r`).replace(/\n/g,`\\n`).replace(/"/g,`\\"`),C=e=>e.split(_),w=(e,t,n)=>d(C,m(x(e===`space`?` `.repeat(t):`
|
|
2
|
+
`)),v(n)),T=e=>{switch(e){case`crlf`:return`\r
|
|
3
3
|
`;case`lf`:return`
|
|
4
|
-
`}},AttributeListPrintPlugin={match(e){return e.type===`AttributeList`},print(e,t){if(t.children.length===0)return`${t.kind.toLocaleLowerCase()} [];`;let n=endOfLine(e.endOfLine);return pipe(map(e.print),joinBy(n),indent(e.indentStyle,e.indentSize,n),wrapByPair(`${t.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(t.children)}},AttributePrintPlugin={match(e){return e.type===`Attribute`},print(e,t){return`${e.print(t.key)} = ${e.print(t.value)};`}},CommentPrintPlugin={match(e){return e.type===`Comment`},print(e,t){let n=endOfLine(e.endOfLine);switch(t.kind){case`Block`:return pipe(splitByLine,map(leftPadWith(` * `)),joinBy(n),wrapByPair(`/**${n}`,`${n} */`))(t.value);case`Macro`:return pipe(splitByLine,map(leftPadWith(`# `)),joinBy(n))(t.value);default:return pipe(splitByLine,map(leftPadWith(`// `)),joinBy(n))(t.value)}}},DotPrintPlugin={match(e){return e.type===`Dot`},print(e,t){return t.children.map(e.print).join(endOfLine(e.endOfLine))}},EdgePrintPlugin={match(e){return e.type===`Edge`},print(e,t){let n=pipe(map(e.print),joinBy(e.directed?` -> `:` -- `))(t.targets);if(t.children.length===0)return`${n};`;let r=endOfLine(e.endOfLine);return`${n} ${pipe(map(e.print),joinBy(r),indent(e.indentStyle,e.indentSize,r),wrapByPair(`[${r}`,`${r}];`))(t.children)}`}},GraphPrintPlugin={match(e){return e.type===`Graph`},print(e,t){e.directed=t.directed;let n=[];if(t.strict&&n.push(`strict`),n.push(t.directed?`digraph`:`graph`),t.id&&n.push(e.print(t.id)),t.children.length===0)return`${n.join(` `)} {}`;let r=endOfLine(e.endOfLine),i=pipe(map(e.print),joinBy(r),indent(e.indentStyle,e.indentSize,r),wrapByPair(`{${r}`,`${r}}`))(t.children);return`${n.join(` `)} ${i}`}},quoteLiteralValue=pipe(escape,wrapWith(`"`)),quoteHTMLLikeLiteralValue=wrapByPair(`<`,`>`),defaultPlugins$2=[AttributeListPrintPlugin,AttributePrintPlugin,CommentPrintPlugin,DotPrintPlugin,EdgePrintPlugin,GraphPrintPlugin,{match(e){return e.type===`Literal`},print(e,t){switch(t.quoted){case`html`:return quoteHTMLLikeLiteralValue(t.value);case!0:return quoteLiteralValue(t.value);default:return escape(t.value)}}},{match(e){return e.type===`Node`},print(e,t){let n=e.print(t.id);if(t.children.length===0)return`${n};`;let r=endOfLine(e.endOfLine);return`${n} ${pipe(map(e.print),joinBy(r),indent(e.indentStyle,e.indentSize,r),wrapByPair(`[${r}`,`${r}];`))(t.children)}`}},{match(e){return e.type===`NodeRefGroup`},print(e,t){return pipe(map(e.print),joinBy(` `),wrapByPair(`{`,`}`))(t.children)}},{match(e){return e.type===`NodeRef`},print(e,t){let n=[e.print(t.id)];return t.port&&n.push(e.print(t.port)),t.compass&&n.push(e.print(t.compass)),n.join(`:`)}},{match(e){return e.type===`Subgraph`},print(e,t){let n=[`subgraph`];if(t.id&&n.push(e.print(t.id)),t.children.length===0)return`${n.join(` `)} {}`;let r=endOfLine(e.endOfLine),i=pipe(map(e.print),joinBy(r),indent(e.indentStyle,e.indentSize,r),wrapByPair(`{${r}`,`${r}}`))(t.children);return`${n.join(` `)} ${i}`}}];var Printer=class{options;#e=[...defaultPlugins$2];constructor(e={}){this.options=e}print(e){let t=[...this.#e],{indentSize:n=2,indentStyle:r=`space`,endOfLine:i=`lf`}=this.options,a={directed:!0,indentSize:n,indentStyle:r,endOfLine:i,print(e){for(let n of t)if(n.match(e))return n.print(a,e);throw Error()}};return a.print(e)}};function stringify(e,t){let n=new Printer(t).print(e);if(!n)throw Error();return n}function convertAttribute(e,t){if(typeof t==`string`){let n=t.trim();return/^<.+>$/ms.test(n)?createElement(`Attribute`,{key:createElement(`Literal`,{value:e,quoted:!1},[]),value:createElement(`Literal`,{value:n.slice(1,n.length-1),quoted:`html`},[])},[]):createElement(`Attribute`,{key:createElement(`Literal`,{value:e,quoted:!1},[]),value:createElement(`Literal`,{value:t,quoted:!0},[])},[])}return createElement(`Attribute`,{key:createElement(`Literal`,{value:e,quoted:!1},[]),value:createElement(`Literal`,{value:String(t),quoted:!1},[])},[])}function convertComment(e,t){return createElement(`Comment`,{kind:t,value:e},[])}function convertClusterChildren(e,t){return Array.from((function*(){for(let[e,n]of t.values)yield convertAttribute(e,n);for(let n of Object.values(t.attributes))n.size>0&&(n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n));for(let n of t.nodes)n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n);for(let n of t.subgraphs)n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n);for(let n of t.edges)n.comment&&(yield convertComment(n.comment,e.commentKind)),yield e.convert(n)})())}const defaultPlugins$1=[{match(e){return e.$$type===`AttributeList`},convert(e,t){return createElement(`AttributeList`,{kind:t.$$kind},t.values.map(([e,t])=>convertAttribute(e,t)))}},{match(e){return e.$$type===`Edge`},convert(n,r){return createElement(`Edge`,{targets:r.targets.map(n=>isNodeModel(n)?createElement(`NodeRef`,{id:createElement(`Literal`,{value:n.id,quoted:!0},[])},[]):isForwardRefNode(n)?createElement(`NodeRef`,{id:createElement(`Literal`,{value:n.id,quoted:!0},[]),port:n.port?createElement(`Literal`,{value:n.port,quoted:!0},[]):void 0,compass:n.compass?createElement(`Literal`,{value:n.compass,quoted:!0},[]):void 0},[]):createElement(`NodeRefGroup`,{},n.map(e=>isNodeModel(e)?createElement(`NodeRef`,{id:createElement(`Literal`,{value:e.id,quoted:!0},[])},[]):createElement(`NodeRef`,{id:createElement(`Literal`,{value:e.id,quoted:!0},[]),port:e.port?createElement(`Literal`,{value:e.port,quoted:!0},[]):void 0,compass:e.compass?createElement(`Literal`,{value:e.compass,quoted:!0},[]):void 0},[]))))},[...r.attributes.comment?[convertComment(r.attributes.comment,n.commentKind)]:[],...r.attributes.values.map(([e,t])=>convertAttribute(e,t))])}},{match(e){return e.$$type===`Node`},convert(e,t){return createElement(`Node`,{id:createElement(`Literal`,{value:t.id,quoted:!0},[])},[...t.attributes.comment?[convertComment(t.attributes.comment,e.commentKind)]:[],...t.attributes.values.map(([e,t])=>convertAttribute(e,t))])}},{match(e){return e.$$type===`Graph`},convert(e,t){return createElement(`Dot`,{},[...t.comment?[convertComment(t.comment,e.commentKind)]:[],createElement(`Graph`,{directed:t.directed,strict:t.strict,id:t.id?createElement(`Literal`,{value:t.id,quoted:!0},[]):void 0},convertClusterChildren(e,t))])}},{match(e){return e.$$type===`Subgraph`},convert(e,t){return createElement(`Subgraph`,{id:t.id?createElement(`Literal`,{value:t.id,quoted:!0},[]):void 0},convertClusterChildren(e,t))}}];var FromModelConverter=class{options;#e=[...defaultPlugins$1];constructor(e={}){this.options=e}convert(e){let t=[...this.#e],{commentKind:n=`Slash`}=this.options,r={commentKind:n,convert(e){for(let n of t)if(n.match(e))return n.convert(r,e);throw Error()}};return r.convert(e)}};function fromModel(e,t){return new FromModelConverter(t).convert(e)}const attribute=new Proxy(Object.freeze({}),{get:(e,t)=>t});var DotObject=class{},AttributesBase=class extends DotObject{#e=new Map;constructor(e){super(),e!==void 0&&this.apply(e)}get values(){return Array.from(this.#e.entries())}get size(){return this.#e.size}get(e){return this.#e.get(e)}set(e,t){t!=null&&this.#e.set(e,t)}delete(e){this.#e.delete(e)}apply(e){let t=Array.isArray(e)?e:Object.entries(e);for(let[e,n]of t)this.set(e,n)}clear(){this.#e.clear()}},AttributeList=class extends AttributesBase{$$kind;get $$type(){return`AttributeList`}comment;constructor(e,t){super(t),this.$$kind=e}},GraphBase=class extends AttributesBase{#e=RootModelsContext;id;comment;attributes=Object.freeze({graph:new AttributeList(`Graph`),edge:new AttributeList(`Edge`),node:new AttributeList(`Node`)});get nodes(){return Array.from(this.#t.nodes.values())}get edges(){return Array.from(this.#t.edges.values())}get subgraphs(){return Array.from(this.#t.subgraphs.values())}#t={nodes:new Map,edges:new Set,subgraphs:new Set};with(e){this.#e=createModelsContext(e)}addNode(e){this.#t.nodes.set(e.id,e)}addEdge(e){this.#t.edges.add(e)}addSubgraph(e){this.#t.subgraphs.add(e)}existNode(e){return this.#t.nodes.has(e)}existEdge(e){return this.#t.edges.has(e)}existSubgraph(e){return this.#t.subgraphs.has(e)}createSubgraph(...e){let t=new this.#e.Subgraph(...e);return t.with(this.#e),this.addSubgraph(t),t}removeNode(e){this.#t.nodes.delete(typeof e==`string`?e:e.id)}removeEdge(e){this.#t.edges.delete(e)}removeSubgraph(e){this.#t.subgraphs.delete(e)}createNode(e,t){let n=new this.#e.Node(e,t);return this.addNode(n),n}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(t=>t.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,t){let n=e.map(e=>isNodeRefGroupLike(e)?toNodeRefGroup(e):toNodeRef(e)),r=new this.#e.Edge(n,t);return this.addEdge(r),r}subgraph(...e){let t=e.find(e=>typeof e==`string`),n=e.find(e=>typeof e==`object`&&!!e),r=e.find(e=>typeof e==`function`),i=t?this.getSubgraph(t)??this.createSubgraph(t):this.createSubgraph();return n!==void 0&&i.apply(n),r!==void 0&&r(i),i}node(e,...t){if(typeof e==`string`){let n=e,r=t.find(e=>typeof e==`object`&&!!e),i=t.find(e=>typeof e==`function`),a=this.getNode(n)??this.createNode(n);return r!==void 0&&a.attributes.apply(r),i!==void 0&&i(a),a}typeof e==`object`&&e&&this.attributes.node.apply(e)}edge(e,...t){if(Array.isArray(e)){let n=e,r=t.find(e=>typeof e==`object`),i=t.find(e=>typeof e==`function`),a=this.createEdge(n,r);return i!==void 0&&i(a),a}typeof e==`object`&&e&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}},RootGraph=class extends GraphBase{get $$type(){return`Graph`}id;strict;constructor(...e){super(),this.id=e.find(e=>typeof e==`string`),this.strict=e.find(e=>typeof e==`boolean`)??!1;let t=e.find(e=>typeof e==`object`&&!!e);t!==void 0&&this.apply(t)}},Digraph=class extends RootGraph{get directed(){return!0}},Graph=class extends RootGraph{get directed(){return!1}},Subgraph=class extends GraphBase{get $$type(){return`Subgraph`}id;constructor(...e){super(),this.id=e.find(e=>typeof e==`string`);let t=e.find(e=>typeof e==`object`&&!!e);t!==void 0&&this.apply(t)}isSubgraphCluster(){return typeof this.id==`string`?this.id.startsWith(`cluster`):!1}},AttributesGroup=class extends AttributesBase{comment},Node=class extends DotObject{id;get $$type(){return`Node`}comment;attributes;constructor(e,t){super(),this.id=e,this.attributes=new AttributesGroup(t)}port(e){return typeof e==`string`?{id:this.id,port:e}:{id:this.id,...e}}},Edge=class extends DotObject{targets;get $$type(){return`Edge`}comment;attributes;constructor(e,t){if(super(),this.targets=e,e.length<2&&(isNodeRefLike(e[0])&&isNodeRefLike(e[1]))===!1)throw Error(`The element of Edge target is missing or not satisfied as Edge target.`);this.attributes=new AttributesGroup(t)}};Object.assign(RootModelsContext,{Graph,Digraph,Subgraph,Node,Edge});function ModelFactoryBuilder(e,t){return(...n)=>{let r=e?this.Digraph:this.Graph,i=n.find(e=>typeof e==`string`),a=n.find(e=>typeof e==`object`),o=n.find(e=>typeof e==`function`),s=new r(i,t,a);return s.with(this),typeof o==`function`&&o(s),s}}function createModelFactories(e,t=RootModelsContext){return Object.freeze({digraph:ModelFactoryBuilder.call(t,!0,e),graph:ModelFactoryBuilder.call(t,!1,e)})}const noStrict=createModelFactories(!1),digraph=noStrict.digraph;noStrict.graph,createModelFactories(!0);function toDot(e,t){return stringify(fromModel(e,t?.convert),t?.print)}export{digraph as n,toDot as r,attribute as t};
|
|
4
|
+
`}},E={match(e){return e.type===`AttributeList`},print(e,t){if(t.children.length===0)return`${t.kind.toLocaleLowerCase()} [];`;let n=T(e.endOfLine);return d(m(e.print),v(n),w(e.indentStyle,e.indentSize,n),b(`${t.kind.toLocaleLowerCase()} [${n}`,`${n}];`))(t.children)}},D={match(e){return e.type===`Attribute`},print(e,t){return`${e.print(t.key)} = ${e.print(t.value)};`}},O={match(e){return e.type===`Comment`},print(e,t){let n=T(e.endOfLine);switch(t.kind){case`Block`:return d(C,m(x(` * `)),v(n),b(`/**${n}`,`${n} */`))(t.value);case`Macro`:return d(C,m(x(`# `)),v(n))(t.value);default:return d(C,m(x(`// `)),v(n))(t.value)}}},k={match(e){return e.type===`Dot`},print(e,t){return t.children.map(e.print).join(T(e.endOfLine))}},ee={match(e){return e.type===`Edge`},print(e,t){let n=d(m(e.print),v(e.directed?` -> `:` -- `))(t.targets);if(t.children.length===0)return`${n};`;let r=T(e.endOfLine);return`${n} ${d(m(e.print),v(r),w(e.indentStyle,e.indentSize,r),b(`[${r}`,`${r}];`))(t.children)}`}},te={match(e){return e.type===`Graph`},print(e,t){e.directed=t.directed;let n=[];if(t.strict&&n.push(`strict`),n.push(t.directed?`digraph`:`graph`),t.id&&n.push(e.print(t.id)),t.children.length===0)return`${n.join(` `)} {}`;let r=T(e.endOfLine),i=d(m(e.print),v(r),w(e.indentStyle,e.indentSize,r),b(`{${r}`,`${r}}`))(t.children);return`${n.join(` `)} ${i}`}},ne=d(S,y(`"`)),A=b(`<`,`>`),j=[E,D,O,k,ee,te,{match(e){return e.type===`Literal`},print(e,t){switch(t.quoted){case`html`:return A(t.value);case!0:return ne(t.value);default:return S(t.value)}}},{match(e){return e.type===`Node`},print(e,t){let n=e.print(t.id);if(t.children.length===0)return`${n};`;let r=T(e.endOfLine);return`${n} ${d(m(e.print),v(r),w(e.indentStyle,e.indentSize,r),b(`[${r}`,`${r}];`))(t.children)}`}},{match(e){return e.type===`NodeRefGroup`},print(e,t){return d(m(e.print),v(` `),b(`{`,`}`))(t.children)}},{match(e){return e.type===`NodeRef`},print(e,t){let n=[e.print(t.id)];return t.port&&n.push(e.print(t.port)),t.compass&&n.push(e.print(t.compass)),n.join(`:`)}},{match(e){return e.type===`Subgraph`},print(e,t){let n=[`subgraph`];if(t.id&&n.push(e.print(t.id)),t.children.length===0)return`${n.join(` `)} {}`;let r=T(e.endOfLine),i=d(m(e.print),v(r),w(e.indentStyle,e.indentSize,r),b(`{${r}`,`${r}}`))(t.children);return`${n.join(` `)} ${i}`}}];var M=class{options;#e=[...j];constructor(e={}){this.options=e}print(e){let t=[...this.#e],{indentSize:n=2,indentStyle:r=`space`,endOfLine:i=`lf`}=this.options,a={directed:!0,indentSize:n,indentStyle:r,endOfLine:i,print(e){for(let n of t)if(n.match(e))return n.print(a,e);throw Error()}};return a.print(e)}};function N(e,t){let n=new M(t).print(e);if(!n)throw Error();return n}function P(e,t){if(typeof t==`string`){let n=t.trim();return/^<.+>$/ms.test(n)?g(`Attribute`,{key:g(`Literal`,{value:e,quoted:!1},[]),value:g(`Literal`,{value:n.slice(1,n.length-1),quoted:`html`},[])},[]):g(`Attribute`,{key:g(`Literal`,{value:e,quoted:!1},[]),value:g(`Literal`,{value:t,quoted:!0},[])},[])}return g(`Attribute`,{key:g(`Literal`,{value:e,quoted:!1},[]),value:g(`Literal`,{value:String(t),quoted:!1},[])},[])}function F(e,t){return g(`Comment`,{kind:t,value:e},[])}function I(e,t){return Array.from((function*(){for(let[e,n]of t.values)yield P(e,n);for(let n of Object.values(t.attributes))n.size>0&&(n.comment&&(yield F(n.comment,e.commentKind)),yield e.convert(n));for(let n of t.nodes)n.comment&&(yield F(n.comment,e.commentKind)),yield e.convert(n);for(let n of t.subgraphs)n.comment&&(yield F(n.comment,e.commentKind)),yield e.convert(n);for(let n of t.edges)n.comment&&(yield F(n.comment,e.commentKind)),yield e.convert(n)})())}const L=[{match(e){return e.$$type===`AttributeList`},convert(e,t){return g(`AttributeList`,{kind:t.$$kind},t.values.map(([e,t])=>P(e,t)))}},{match(e){return e.$$type===`Edge`},convert(n,r){return g(`Edge`,{targets:r.targets.map(n=>t(n)?g(`NodeRef`,{id:g(`Literal`,{value:n.id,quoted:!0},[])},[]):e(n)?g(`NodeRef`,{id:g(`Literal`,{value:n.id,quoted:!0},[]),port:n.port?g(`Literal`,{value:n.port,quoted:!0},[]):void 0,compass:n.compass?g(`Literal`,{value:n.compass,quoted:!0},[]):void 0},[]):g(`NodeRefGroup`,{},n.map(e=>t(e)?g(`NodeRef`,{id:g(`Literal`,{value:e.id,quoted:!0},[])},[]):g(`NodeRef`,{id:g(`Literal`,{value:e.id,quoted:!0},[]),port:e.port?g(`Literal`,{value:e.port,quoted:!0},[]):void 0,compass:e.compass?g(`Literal`,{value:e.compass,quoted:!0},[]):void 0},[]))))},[...r.attributes.comment?[F(r.attributes.comment,n.commentKind)]:[],...r.attributes.values.map(([e,t])=>P(e,t))])}},{match(e){return e.$$type===`Node`},convert(e,t){return g(`Node`,{id:g(`Literal`,{value:t.id,quoted:!0},[])},[...t.attributes.comment?[F(t.attributes.comment,e.commentKind)]:[],...t.attributes.values.map(([e,t])=>P(e,t))])}},{match(e){return e.$$type===`Graph`},convert(e,t){return g(`Dot`,{},[...t.comment?[F(t.comment,e.commentKind)]:[],g(`Graph`,{directed:t.directed,strict:t.strict,id:t.id?g(`Literal`,{value:t.id,quoted:!0},[]):void 0},I(e,t))])}},{match(e){return e.$$type===`Subgraph`},convert(e,t){return g(`Subgraph`,{id:t.id?g(`Literal`,{value:t.id,quoted:!0},[]):void 0},I(e,t))}}];var R=class{options;#e=[...L];constructor(e={}){this.options=e}convert(e){let t=[...this.#e],{commentKind:n=`Slash`}=this.options,r={commentKind:n,convert(e){for(let n of t)if(n.match(e))return n.convert(r,e);throw Error()}};return r.convert(e)}};function z(e,t){return new R(t).convert(e)}const B=new Proxy(Object.freeze({}),{get:(e,t)=>t});var V=class{},H=class extends V{#e=new Map;constructor(e){super(),e!==void 0&&this.apply(e)}get values(){return Array.from(this.#e.entries())}get size(){return this.#e.size}get(e){return this.#e.get(e)}set(e,t){t!=null&&this.#e.set(e,t)}delete(e){this.#e.delete(e)}apply(e){let t=Array.isArray(e)?e:Object.entries(e);for(let[e,n]of t)this.set(e,n)}clear(){this.#e.clear()}},U=class extends H{$$kind;get $$type(){return`AttributeList`}comment;constructor(e,t){super(t),this.$$kind=e}},W=class extends H{#e=c;id;comment;attributes=Object.freeze({graph:new U(`Graph`),edge:new U(`Edge`),node:new U(`Node`)});get nodes(){return Array.from(this.#t.nodes.values())}get edges(){return Array.from(this.#t.edges.values())}get subgraphs(){return Array.from(this.#t.subgraphs.values())}#t={nodes:new Map,edges:new Set,subgraphs:new Set};with(e){this.#e=l(e)}addNode(e){this.#t.nodes.set(e.id,e)}addEdge(e){this.#t.edges.add(e)}addSubgraph(e){this.#t.subgraphs.add(e)}existNode(e){return this.#t.nodes.has(e)}existEdge(e){return this.#t.edges.has(e)}existSubgraph(e){return this.#t.subgraphs.has(e)}createSubgraph(...e){let t=new this.#e.Subgraph(...e);return t.with(this.#e),this.addSubgraph(t),t}removeNode(e){this.#t.nodes.delete(typeof e==`string`?e:e.id)}removeEdge(e){this.#t.edges.delete(e)}removeSubgraph(e){this.#t.subgraphs.delete(e)}createNode(e,t){let n=new this.#e.Node(e,t);return this.addNode(n),n}getSubgraph(e){return Array.from(this.#t.subgraphs.values()).find(t=>t.id===e)}getNode(e){return this.#t.nodes.get(e)}createEdge(e,t){let n=e.map(e=>i(e)?s(e):o(e)),r=new this.#e.Edge(n,t);return this.addEdge(r),r}subgraph(...e){let t=e.find(e=>typeof e==`string`),n=e.find(e=>typeof e==`object`&&!!e),r=e.find(e=>typeof e==`function`),i=t?this.getSubgraph(t)??this.createSubgraph(t):this.createSubgraph();return n!==void 0&&i.apply(n),r!==void 0&&r(i),i}node(e,...t){if(typeof e==`string`){let n=e,r=t.find(e=>typeof e==`object`&&!!e),i=t.find(e=>typeof e==`function`),a=this.getNode(n)??this.createNode(n);return r!==void 0&&a.attributes.apply(r),i!==void 0&&i(a),a}typeof e==`object`&&e&&this.attributes.node.apply(e)}edge(e,...t){if(Array.isArray(e)){let n=e,r=t.find(e=>typeof e==`object`),i=t.find(e=>typeof e==`function`),a=this.createEdge(n,r);return i!==void 0&&i(a),a}typeof e==`object`&&e&&this.attributes.edge.apply(e)}graph(e){this.attributes.graph.apply(e)}},G=class extends W{get $$type(){return`Graph`}id;strict;constructor(...e){super(),this.id=e.find(e=>typeof e==`string`),this.strict=e.find(e=>typeof e==`boolean`)??!1;let t=e.find(e=>typeof e==`object`&&!!e);t!==void 0&&this.apply(t)}},K=class extends G{get directed(){return!0}},q=class extends G{get directed(){return!1}},J=class extends W{get $$type(){return`Subgraph`}id;constructor(...e){super(),this.id=e.find(e=>typeof e==`string`);let t=e.find(e=>typeof e==`object`&&!!e);t!==void 0&&this.apply(t)}isSubgraphCluster(){return typeof this.id==`string`?this.id.startsWith(`cluster`):!1}},Y=class extends H{comment},X=class extends V{id;get $$type(){return`Node`}comment;attributes;constructor(e,t){super(),this.id=e,this.attributes=new Y(t)}port(e){return typeof e==`string`?{id:this.id,port:e}:{id:this.id,...e}}},re=class extends V{targets;get $$type(){return`Edge`}comment;attributes;constructor(e,t){if(super(),this.targets=e,e.length<2&&(r(e[0])&&r(e[1]))===!1)throw Error(`The element of Edge target is missing or not satisfied as Edge target.`);this.attributes=new Y(t)}};Object.assign(c,{Graph:q,Digraph:K,Subgraph:J,Node:X,Edge:re});function Z(e,t){return(...n)=>{let r=e?this.Digraph:this.Graph,i=n.find(e=>typeof e==`string`),a=n.find(e=>typeof e==`object`),o=n.find(e=>typeof e==`function`),s=new r(i,t,a);return s.with(this),typeof o==`function`&&o(s),s}}function Q(e,t=c){return Object.freeze({digraph:Z.call(t,!0,e),graph:Z.call(t,!1,e)})}const $=Q(!1),ie=$.digraph;$.graph,Q(!0);function ae(e,t){return N(z(e,t?.convert),t?.print)}export{ie as n,ae as r,B as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
String.fromCharCode;const
|
|
1
|
+
String.fromCharCode;const e=/#/g,t=/&/g,n=/\//g,r=/=/g,i=/\+/g,a=/%5e/gi,o=/%60/gi,s=/%7c/gi,c=/%20/gi;function l(e){return encodeURI(``+e).replace(s,`|`)}function u(r){return l(typeof r==`string`?r:JSON.stringify(r)).replace(i,`%2B`).replace(c,`+`).replace(e,`%23`).replace(t,`%26`).replace(o,"`").replace(a,`^`).replace(n,`%2F`)}function d(e){return u(e).replace(r,`%3D`)}function f(e=``){try{return decodeURIComponent(``+e)}catch{return``+e}}function p(e){return f(e.replace(i,` `))}function m(e){return f(e.replace(i,` `))}function h(e=``){let t=Object.create(null);e[0]===`?`&&(e=e.slice(1));for(let n of e.split(`&`)){let e=n.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let r=p(e[1]);if(r===`__proto__`||r===`constructor`)continue;let i=m(e[2]||``);t[r]===void 0?t[r]=i:Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]}return t}function g(e,t){return(typeof t==`number`||typeof t==`boolean`)&&(t=String(t)),t?Array.isArray(t)?t.map(t=>`${d(e)}=${u(t)}`).join(`&`):`${d(e)}=${u(t)}`:d(e)}function _(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>g(t,e[t])).filter(Boolean).join(`&`)}const v=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,y=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,b=/^([/\\]\s*){2,}[^/\\]/,x=/\/$|\/\?|\/#/,S=/^\.?\//;function C(e){return[`./`,`../`].some(t=>e.startsWith(t))}function w(e,t={}){return typeof t==`boolean`&&(t={acceptRelative:t}),t.strict?v.test(e):y.test(e)||(t.acceptRelative?b.test(e):!1)}function T(e=``,t){return t?x.test(e):e.endsWith(`/`)}function E(e=``,t){if(!t)return(T(e)?e.slice(0,-1):e)||`/`;if(!T(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function D(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(T(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function O(e=``){return e.startsWith(`/`)}function k(e=``){return(O(e)?e.slice(1):e)||`/`}function A(e=``){return O(e)?e:`/`+e}function j(e=``){return e.split(`://`).map(e=>e.replace(/\/{2,}/g,`/`)).join(`://`)}function M(e,t){if(P(t))return e;let n=E(t);if(!e.startsWith(n))return e;let r=e[n.length];if(r&&r!==`/`&&r!==`?`)return e;let i=e.slice(n.length);return i[0]===`/`?i:`/`+i}function N(e,t){let n=V(e);return n.search=_({...h(n.search),...t}),U(n)}function P(e){return!e||e===`/`}function F(e){return e&&e!==`/`}function I(e,...t){let n=e||``;for(let e of t.filter(e=>F(e)))if(n){let t=e.replace(S,``);n=D(n)+t}else n=e;return n}function L(...e){let t=/\/(?!\/)/,n=e.filter(Boolean),r=[],i=0;for(let e of n)if(!(!e||e===`/`)){for(let[n,a]of e.split(t).entries())if(!(!a||a===`.`)){if(a===`..`){if(r.length===1&&w(r[0]))continue;r.pop(),i--;continue}if(n===1&&r[r.length-1]?.endsWith(`:/`)){r[r.length-1]+=`/`+a;continue}r.push(a),i++}}let a=r.join(`/`);return i>=0?n[0]?.startsWith(`/`)&&!a.startsWith(`/`)?a=`/`+a:n[0]?.startsWith(`./`)&&!a.startsWith(`./`)&&(a=`./`+a):a=`../`.repeat(-1*i)+a,n[n.length-1]?.endsWith(`/`)&&!a.endsWith(`/`)&&(a+=`/`),a}function R(e){return z(e,``)}function z(e,t){let n=e.match(y);return n||=e.match(/^\/{2,}/),n?t+e.slice(n[0].length):t+e}const B=Symbol.for(`ufo:protocolRelative`);function V(e=``,t){let n=e.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){let[,e,t=``]=n;return{protocol:e.toLowerCase(),pathname:t,href:e+t,auth:``,host:``,search:``,hash:``}}if(!w(e,{acceptRelative:!0}))return t?V(t+e):H(e);let[,r=``,i,a=``]=e.replace(/\\/g,`/`).match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,o=``,s=``]=a.match(/([^#/?]*)(.*)?/)||[];r===`file:`&&(s=s.replace(/\/(?=[A-Za-z]:)/,``));let{pathname:c,search:l,hash:u}=H(s);return{protocol:r.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):``,host:o,pathname:c,search:l,hash:u,[B]:!r}}function H(e=``){let[t=``,n=``,r=``]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:n,hash:r}}function U(e){let t=e.pathname||``,n=e.search?(e.search.startsWith(`?`)?``:`?`)+e.search:``,r=e.hash||``,i=e.auth?e.auth+`@`:``,a=e.host||``;return(e.protocol||e[B]?(e.protocol||``)+`//`:``)+i+a+t+n+r}export{L as a,N as c,k as d,R as f,C as i,D as l,O as n,I as o,E as p,w as r,A as s,j as t,M as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as e,o as t,t as n}from"../rolldown-runtime.mjs";import{n as r,t as i}from"./isexe.mjs";var a=n(((n,a)=>{let{isexe:o,sync:s}=(i(),t(r)),{join:c,delimiter:l,sep:u,posix:d}=e(`path`),f=process.platform===`win32`,p=new RegExp(`[${d.sep}${u===d.sep?``:u}]`.replace(/(\\)/g,`\\$1`)),m=RegExp(`^\\.${p.source}`),h=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),g=(e,{path:t=process.env.PATH,pathExt:n=process.env.PATHEXT,delimiter:r=l})=>{let i=e.match(p)?[``]:[...f?[process.cwd()]:[],...(t||``).split(r)];if(f){let t=n||[`.EXE`,`.CMD`,`.BAT`,`.COM`].join(r),a=t.split(r).flatMap(e=>[e,e.toLowerCase()]);return e.includes(`.`)&&a[0]!==``&&a.unshift(``),{pathEnv:i,pathExt:a,pathExtExe:t}}return{pathEnv:i,pathExt:[``]}},_=(e,t)=>{let n=/^".*"$/.test(e)?e.slice(1,-1):e;return(!n&&m.test(t)?t.slice(0,2):``)+c(n,t)},v=async(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=g(e,t),a=[];for(let s of n){let n=_(s,e);for(let e of r){let r=n+e;if(await o(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw h(e)},y=(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=g(e,t),a=[];for(let o of n){let n=_(o,e);for(let e of r){let r=n+e;if(s(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw h(e)};a.exports=v,v.sync=y}));export{a as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as
|
|
1
|
+
import{t as e}from"../rolldown-runtime.mjs";var t=e(((e,t)=>{
|
|
2
2
|
/*!
|
|
3
3
|
* word-wrap <https://github.com/jonschlinkert/word-wrap>
|
|
4
4
|
*
|
|
@@ -9,4 +9,4 @@ function n(e){let t=e.length-1,n=e[t];for(;n===` `||n===` `;)n=e[--t];return e.s
|
|
|
9
9
|
`).map(e=>n(e)).join(`
|
|
10
10
|
`)}t.exports=function(e,t){if(t||={},e==null)return e;var n=t.width||50,a=typeof t.indent==`string`?t.indent:` `,o=t.newline||`
|
|
11
11
|
`+a,s=typeof t.escape==`function`?t.escape:i,c=`.{1,`+n+`}`;t.cut!==!0&&(c+=`([\\s]+|$)|[^\\s]+?([\\s]+|$)`);var l=new RegExp(c,`g`),u=a+(e.match(l)||[]).map(function(e){return e.slice(-1)===`
|
|
12
|
-
`&&(e=e.slice(0,e.length-1)),s(e)}).join(o);return t.trim===!0&&(u=r(u)),u};function i(e){return e}}));export{
|
|
12
|
+
`&&(e=e.slice(0,e.length-1)),s(e)}).join(o);return t.trim===!0&&(u=r(u)),u};function i(e){return e}}));export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire}from"node:module";var
|
|
1
|
+
import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(e&&(t=e(e=0)),t),c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,t,n)=>(u(e,t,`default`),n&&u(n,t,`default`)),f=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),p=e=>o.call(e,`module.exports`)?e[`module.exports`]:u(n({},`__esModule`,{value:!0}),e),m=e(import.meta.url);export{m as a,d as i,s as n,p as o,l as r,f as s,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as e,I as t,J as n,L as r,X as i,_ as a,b as o,p as s,t as c,y as l}from"./libs/remeda.mjs";import{a as u,i as d,n as f,r as p,t as m}from"./libs/@lume/kiwi.mjs";import{getParallelStepsPrefix as h,isStepEdgeId as g}from"@likec4/core/types";import{DefaultMap as _,Stack as v,invariant as y,isAncestor as b,nonNullable as x,nonexhaustive as S}from"@likec4/core/utils";function C(e){return i(e,r(e=>e.parallelPrefix??void 0),a((e,t)=>e.reduce((e,t)=>(e.min.column=Math.min(e.min.column,t.from.column,t.to.column),e.min.row=Math.min(e.min.row,t.from.row,t.to.row),e.max.column=Math.max(e.max.column,t.from.column,t.to.column),e.max.row=Math.max(e.max.row,t.from.row,t.to.row),e),{parallelPrefix:t,min:{column:1/0,row:1/0},max:{column:-1/0,row:-1/0}})),c())}function w(e,t){if(e.length===0||e.length===t.length)return[];let n=e=>x(t.find(t=>t.id===e));function r(e){let t=e.parent?n(e.parent):null;return t?[t,...r(t)]:[]}let i=new v,a=[];return e.forEach(e=>{let t=r(e);if(t.length===0){i.clear();return}let n=v.from(t),o,s;for(;o=i.peek()?.node,s=n.peek(),!(!s||!o);){if(b(s.id,o.id)||s.id===o.id){n.pop();continue}if(!b(o.id,s.id)){i.pop();continue}break}for(;s=n.pop();){let t={node:s,from:e,to:e,nested:[]},n=i.peek();n?n.nested.push(t):a.push(t),i.push(t)}i.forEach(t=>t.to=e)}),a}var T=class{#e=new m;#t;#n=[];#r;#i;#a;#o=[];#s=[];constructor({actors:e,steps:t,compounds:n}){this.#a=this.newVar(30),this.#r=this.newVar(0),this.#i=this.newVar(0),this.#t=this.addActors(e);for(let e of n){let t=this.addCompound(e),n=t[0];this.constraint(n.y1,`==`,0,d.strong),this.put(this.#i).after(n.bottom),this.put(this.#a).after(n.y2),this.#n.push(...t)}for(let e of t)this.addStep(e);for(let e of C(t))this.addParallelRect(e);let r=this.#t[0];this.constraint(r.offset.left,`==`,0,d.strong);let i=this.#t.reduce((e,t)=>(this.put(t.x).after(e.right,60),this.put(t.offset.left,d.strong).after(e.offset.right,32),this.constraint(t.centerY,`==`,e.centerY,d.strong),this.put(this.#a).after(t.offset.bottom),t));if(this.put(this.#r).after(i.offset.right),this.put(this.#i).after(o(this.#o)?.bottom??this.#a),n.length>0)for(let e of this.#n){let t=e.from.column,n=e.to.column,r=Math.max(e.from.maxRow,e.to.maxRow);for(let e=t+1;e<n;e++){let t=this.actorBox(e);r=Math.max(r,t.maxRow)}let i=x(this.#o[r],`row ${r} not found`);this.put(e.bottom).after(i.bottom,16),this.put(this.#i).after(e.bottom)}this.#e.updateVariables()}getParallelBoxes(){return this.#s.map(({parallelPrefix:e,x1:t,y1:n,x2:r,y2:i})=>({parallelPrefix:e,x:t.value(),y:n.value(),width:r.value()-t.value(),height:i.value()-n.value()}))}getActorBox(e){let t=this.actorBox(e);return{x:t.x.value(),y:t.y.value(),width:t.width,height:t.height}}getCompoundBoxes(){return this.#n.map(({node:e,depth:t,x1:n,y1:r,x2:i,bottom:a})=>({node:e,depth:t,x:n.value(),y:r.value(),width:i.value()-n.value(),height:a.value()-r.value()}))}getPortCenter(e,t){let{column:n,row:r}=t===`source`?e.from:e.to,i=this.actorBox(n).centerX,{y:a}=x(this.#o[r]);return{cx:i.value(),cy:a.value()+32/2+e.offset,height:t===`source`?40:24}}getViewBounds(){return{x:0,y:0,width:this.#r.value(),height:this.#i.value()}}actorBox(e){if(typeof e!=`number`){let t=typeof e==`string`?e:e.id;e=this.#t.findIndex(e=>e.actor.id===t),y(e>=0,`actor ${t} not found`)}return x(this.#t[e],`actor at index ${e} not found`)}addActors(e){let t=0;return l(e,(e,n)=>{let r=this.newVar(t);t+=e.width+60;let i=this.newVar(0),a={column:n,actor:e,x:r,y:i,centerX:r.plus(Math.round(e.width/2)),centerY:i.plus(Math.round(e.height/2)),width:e.width,height:e.height,right:r.plus(e.width),bottom:i.plus(e.height),minRow:1/0,maxRow:-1/0},o=this.newVar(0),s=this.newVar(0),c=this.newVar(0),l=this.newVar(0);return this.put(o,d.strong).before(i),this.put(s,d.strong).before(r),this.put(c,d.strong).after(a.right),this.put(l,d.strong).after(a.bottom),{...a,offset:{top:o,left:s,right:c,bottom:l}}})}addStep(e){let t=this.actorBox(e.source),n=this.actorBox(e.target);t.minRow=Math.min(t.minRow,e.from.row),t.maxRow=Math.max(t.maxRow,e.from.row),n.minRow=Math.min(n.minRow,e.to.row),n.maxRow=Math.max(n.maxRow,e.to.row);let[r,i]=t.column<=n.column?[t,n]:[n,t],a=(e.label?.width??100)+50;r===i?this.constraint(r.centerX.plus(a),`<=`,r.offset.right):this.constraint(r.centerX.plus(a),`<=`,i.centerX);let o=e.label?.height?e.label.height+50+32/2:80;return o=Math.max(o,80)+e.offset,this.ensureRow(e.from.row,o),e.isSelfLoop&&this.ensureRow(e.to.row,80),this}addParallelRect({parallelPrefix:e,min:t,max:n}){let r=this.actorBox(t.column).centerX.minus(30),i=this.actorBox(n.column).centerX.plus(30),a=this.#o[t.row],o=this.#o[n.row];y(a&&o,`parallel box invalid minRow=${t.row} maxRow=${n.row}`);let s=this.newVar(0);this.put(s).before(a.y,40);let c=o.bottom,l=t.row>0&&this.#o[t.row-1];l&&this.put(s).after(l.bottom,16);let u=n.row<this.#o.length-1&&this.#o[n.row+1];u&&this.put(c).before(u.y,16),this.#s.push({parallelPrefix:e,x1:r,y1:s,x2:i,y2:c})}addCompound(e){let t=[],n=e.nested.flatMap(e=>{let n=this.addCompound(e);return t.push(n[0]),n}),r=Math.max(...n.map(e=>e.depth+1),0),i=this.actorBox(e.from),a=this.actorBox(e.to),o=i.offset.left.minus(32);i.offset.left=o;let c=a.offset.right.plus(32);a.offset.right=c;let l=this.newVar(0),u=s(t),d,f;switch(!0){case!!u:d=u.y1.minus(40),f=u.y2.plus(32),this.put(l).after(u.bottom,32);break;case a===i:d=this.newVar(0),f=this.newVar(0),this.put(d).before(i.offset.top,52),this.put(f).after(i.offset.bottom,32),this.put(l).after(f);break;case t.length>0:d=this.newVar(0),f=this.newVar(0);for(let e of t)this.put(d).before(e.y1,32),this.put(f).after(e.y2,32),this.put(l).after(e.bottom,32);break;default:d=this.newVar(0),f=this.newVar(0);for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;this.put(d).before(e.top,52),this.put(f).after(e.bottom,32)}this.put(l).after(f);break}for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;e.top=d,e.bottom=f}return[{node:e.node,depth:r,from:i,to:a,x1:o,y1:d,x2:c,y2:f,bottom:l},...n]}ensureRow(e,t){for(;e>=this.#o.length;){let e=this.#o.length>0&&this.#o[this.#o.length-1]?.bottom||this.#a.plus(30),t=this.newVar(this.#o.length*80);this.put(t).after(e);let n=this.newVar(80);this.require(n,`>=`,80),this.#o.push({y:t,height:n,bottom:t.plus(n),lastHeight:80})}let n=x(this.#o[e]);t>n.lastHeight&&(n.lastHeight=t,this.require(n.height,`>=`,t),this.#e.suggestValue(n.height,t))}newVar(e){let t=new u;return this.#e.addEditVariable(t,d.weak),typeof e==`number`&&(this.#e.suggestValue(t,e),this.constraint(t,`>=`,0,d.strong)),t}require(e,t,n=void 0){switch(this.constraint(e,t,n,d.required),t){case`<=`:case`>=`:this.constraint(e,`==`,n,d.weak);break;case`<= 0`:case`>= 0`:this.constraint(e,`== 0`,void 0,d.weak);break}}constraint(e,t,n=void 0,r=d.medium){let i;switch(t){case`==`:i=p.Eq;break;case`>=`:i=p.Ge;break;case`<=`:i=p.Le;break;case`== 0`:i=p.Eq,n=0;break;case`>= 0`:i=p.Ge,n=0;break;case`<= 0`:i=p.Le,n=0;break;default:S(t)}this.#e.addConstraint(new f(e,i,n??0,r))}put(e,t=d.required){let n=t===d.required?d.medium:d.weak;return{before:(r,i)=>{i&&(r=r.minus(i)),this.constraint(e,`<=`,r,t),this.constraint(e,`==`,r,n)},after:(r,i)=>{i&&(r=r.plus(i)),this.constraint(e,`>=`,r,t),this.constraint(e,`==`,r,n)}}}};function E(r){let o=new Set,s=e=>x(r.nodes.find(t=>t.id===e)),u=[];for(let e of r.edges.filter(e=>g(e.id))){let t=s(e.source),n=s(e.target);if(t.children.length||n.children.length){console.error(`Sequence view does not support nested actors`);continue}o.add(t),o.add(n),u.push({edge:e,source:t,target:n})}let d=r.nodes.filter(e=>o.has(e));y(n(d,1),`actors array must not be empty`);let f=new _(()=>[]),p=[],m=0;for(let{edge:e,source:t,target:n}of u){let r=p.at(-1),i=d.indexOf(t),a=d.indexOf(n),o=t===n,s=i>a,c=h(e.id),l=!1;r&&r.target==t&&r.parallelPrefix===c&&(l=r.isSelfLoop!==o||r.isBack===s),l||m++;let u={id:e.id,from:{column:i,row:m},to:{column:a,row:o?++m:m},edge:e,isSelfLoop:o,isBack:s,parallelPrefix:c,offset:l?(r?.offset??0)+22:0,source:t,target:n,label:e.labelBBox?{height:e.labelBBox.height+8+(e.navigateTo?20:0),width:e.labelBBox.width+16,text:e.label}:null};p.push(u),f.get(t).push({step:u,row:m,type:`source`,position:s&&!o?`left`:`right`}),f.get(n).push({step:u,row:m,type:`target`,position:s||o?`right`:`left`})}let v=new T({actors:d,steps:p,compounds:w(d,r.nodes)}),b=v.getViewBounds(),S=i(v.getCompoundBoxes(),l(({node:e,...t})=>({...t,id:e.id,origin:e.id})),t(`id`),a((e,t)=>n(e,2)?l(e,(e,n)=>({...e,id:`${t}-${n+1}`})):e),c(),e());return{actors:d.map(e=>D({actor:e,ports:f.get(e),layout:v})),compounds:S,steps:l(p,e=>({id:e.id,sourceHandle:e.id+`_source`,targetHandle:e.id+`_target`,...e.label&&{labelBBox:{width:e.label.width,height:e.label.height}}})),parallelAreas:v.getParallelBoxes(),bounds:b}}function D({actor:e,ports:t,layout:n}){let{x:r,y:i,width:a,height:o}=n.getActorBox(e);return{id:e.id,x:r,y:i,width:a,height:o,ports:t.map(e=>{let t=n.getPortCenter(e.step,e.type);return{id:`${e.step.id}_${e.type}`,cx:t.cx-r,cy:t.cy-i,height:t.height,type:e.type,position:e.position}})}}export{E as t};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{t as e}from"./libs/json5.mjs";import{J as t}from"./libs/@hono/mcp.mjs";import{BorderStyles as n,ElementShapes as r,IconPositions as i,RelationshipArrowTypes as a,Sizes as o,ThemeColors as s,computeColorValues as c}from"@likec4/core/styles";import{exact as l}from"@likec4/core/types";const u=/^@[A-Za-z0-9_-]*$/,d=/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,f=t.string().min(1,`Image alias key cannot be empty`).regex(u,`Image alias key must match /^@\\w+$/`),p=t.string().min(1,`Image alias value cannot be empty`).regex(d,`Image alias value must be a relative path (no leading slash or protocol)`),m=t.record(f,p).meta({id:`ImageAliases`,description:`Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).`}),h=t.string().min(1,`Include path cannot be empty`).regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,`Include path must be a relative path (no leading slash, drive letter, or protocol)`),g=t.strictObject({paths:t.array(h).meta({description:[`Additional relative directory paths to include LikeC4 source files from, searched recursively.`,`Paths are relative to the project folder (the folder containing this config file).`,`Example: ["../shared", "../common/specs"]`].join(`
|
|
2
|
+
`)}),maxDepth:t.number().int().min(1).max(20).default(3).meta({description:[`Maximum directory depth to scan when searching for .c4 files in include paths.`,`Prevents excessive scanning of deeply nested directories.`,`Default: 3`].join(`
|
|
3
|
+
`)}),fileThreshold:t.number().int().min(1).max(1e4).default(30).meta({description:[`Maximum number of files to load from include paths before warning.`,`Helps identify performance issues from accidentally including large directories.`,`Default: 30`].join(`
|
|
4
|
+
`)})}).meta({id:`include-config`,description:[`Configuration for including additional LikeC4 source files from other directories.`,`Example: { "paths": ["../shared", "../common/specs"], "maxDepth": 5, "fileThreshold": 50 }`].join(`
|
|
5
|
+
`)}),_=t.int().min(0,`Opacity must be between 0 and 100`).max(100,`Opacity must be between 0 and 100`).meta({id:`Opacity`,description:`Opacity 0-100%`}),v=t.enum(r).meta({id:`ElementShape`}),y=t.enum(n).meta({id:`BorderStyle`}),b=t.enum(o).meta({id:`ElementSize`}),x=t.enum(i).meta({id:`IconPosition`}),S=t.enum(a).meta({id:`ArrowType`}),ee=t.enum([`dashed`,`solid`,`dotted`]).meta({id:`LineType`}),te=t.enum(s).meta({id:`ThemeColorName`}),C=t.custom().refine(e=>typeof e==`string`,`Custom color name must be a string`).transform(e=>e).meta({id:`CustomColorName`}),w=te.or(C).transform(e=>e).meta({id:`ColorName`}),T=t.string().min(1,`Color value cannot be empty`).meta({id:`ColorLiteral`}),E=t.strictObject({fill:T.meta({description:`Background color`}),stroke:T.meta({description:`Stroke color (border, paths above background)`}),hiContrast:T.meta({description:`High contrast text color (title)`}),loContrast:T.meta({description:`Low contrast text color (description)`})}).meta({id:`ElementColorValues`}).transform(e=>e),D=t.strictObject({line:T.meta({description:`Line color`}),label:T.meta({description:`Label text color`}),labelBg:T.optional().default(`rgba(0, 0, 0, 0.5)`).meta({description:`Label background color`})}).meta({id:`RelationshipColorValues`}).transform(e=>e),O=t.strictObject({elements:E.or(T.transform(e=>c(e).elements)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),relationships:D.or(T.transform(e=>c(e).relationships)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`})}).transform(e=>e).meta({id:`StrictThemeColorValues`,description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color value`}).or(T.transform(e=>c(e))).transform(e=>e).meta({id:`ThemeColorValues`,description:`Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),k=t.partialRecord(w,O).transform(e=>e),A=t.strictObject({width:t.number().min(50),height:t.number().min(50)}).meta({id:`Dimensions`,description:`Defines dimensions for theme size`}),j=t.partialRecord(b,A),M=t.strictObject({colors:k.optional().meta({description:`Override theme colors`}),sizes:j.optional().meta({description:`Override theme sizes`})}).meta({id:`ThemeCustomization`,description:`Customize theme colors and sizes`}).transform(({colors:e,sizes:t})=>l({colors:e?l(e):void 0,sizes:t?l(t):void 0})),N=t.strictObject({color:w.optional().meta({description:`Default color for groups
|
|
6
|
+
(must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity for groups`}),border:y.optional().meta({description:`Default border for groups`})}).meta({id:`GroupDefaultStyleValues`}),P=t.strictObject({color:w.optional().meta({description:`Default color for relationships
|
|
7
|
+
(must be a valid color name from the theme)`}),line:ee.optional().meta({description:`Default line style for relationships`}),arrow:S.optional().meta({description:`Default arrow style for relationships`})}).meta({id:`RelationshipDefaultStyleValues`,description:`Override default values for relationship style properties
|
|
8
|
+
These values will be used if such property is not defined`}),F=t.strictObject({color:w.optional().meta({description:`Default color for elements
|
|
9
|
+
(must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity (0-100%) for elements when displayed as a group (like a container)`}),border:y.optional().meta({description:`Default border style for elements when displayed as a group (like a container)`}),size:b.optional().meta({description:`Default size for elements`}),shape:v.optional().meta({description:`Default shape for elements`}),iconPosition:x.optional().meta({description:`Default icon position for elements`}),group:N.optional().meta({description:`Override default values for group style properties
|
|
10
|
+
These values will be used if such property is not defined`}),relationship:P.optional().meta({description:`Override default values for relationship style properties
|
|
11
|
+
These values will be used if such property is not defined`})}).meta({id:`DefaultStyleValues`}),I=t.union([t.string().min(1,`Custom CSS file path cannot be empty`),t.array(t.string().min(1,`Custom CSS file path cannot be empty`))]).meta({id:`CustomStylesheets`}),L=t.strictObject({theme:M.optional().meta({description:`Project theme customization`}),defaults:F.optional().meta({description:`Override default values for style properties
|
|
12
|
+
These values will be used if such property is not defined`}),customCss:I.optional().meta({description:`Custom CSS (or list of CSS files) to be included in the generated diagrams`})}).transform(({theme:e,defaults:t,customCss:n})=>l({defaults:R(t),customCss:ne(n),theme:e}));function R(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function ne(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const z=t.strictObject({outDir:t.string().default(`.likec4`).meta({description:[`Path to the directory where manual layouts will be stored,`,`relative to the folder containing the project config. `,``,`Defaults to '.likec4'.`].join(`
|
|
13
|
+
`)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),B=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!==`default`,{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:L.optional().meta({description:`Project styles customization`}),imageAliases:m.optional(),include:g.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:z.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
|
|
14
|
+
`)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to true.`})}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),V=t.instanceof(Function),H=t.record(t.string(),V),U=B.extend({generators:H.optional()});function W(e){let n=U.safeParse(e);if(n.success)return n.data;throw Error(`Config validation failed:
|
|
15
|
+
`+t.prettifyError(n.error))}function G(t){return W(e.parse(t.trim()||`{}`))}const K={parse:G,validate:W,normalizeInclude:e=>{let t=g.safeParse(e);return t.success?t.data:{paths:[],maxDepth:3,fileThreshold:30}}};function q(e){let t=e.length;for(;t>0&&(e[t-1]===`/`||e[t-1]===`\\`);)t--;return e.slice(0,t)}function J(e){return e.split(`/`).flatMap(e=>e.split(`\\`))}function Y(e){let t=q(e),n=J(t);return n[n.length-1]||t}const X=[`.likec4rc`,`.likec4.config.json`,`likec4.config.json`],Z=[`likec4.config.js`,`likec4.config.cjs`,`likec4.config.mjs`,`likec4.config.ts`,`likec4.config.cts`,`likec4.config.mts`];[...X,...Z];function Q(e){return X.includes(Y(e))}function $(e){return Z.includes(Y(e))}function re(e){return Q(e)||$(e)}function ie(e){return U.parse(e)}function ae(e){return H.parse(e)}function oe(e){return O.parse(e)}function se(e){return M.parse(e)}function ce(e){return L.parse(e)}export{oe as a,$ as c,W as d,se as i,K as l,ae as n,re as o,ce as r,Q as s,ie as t,B as u};
|