likec4 1.29.1 → 1.31.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/main.js +6470 -6181
- package/__app__/src/style.css +1 -1
- package/dist/cli/index.mjs +396 -395
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/model/index.d.mts +3 -3
- package/dist/model/index.mjs +2 -2
- package/dist/shared/{likec4.tyGQtUCS.d.mts → likec4.BaUvDeNQ.d.mts} +35 -15
- package/dist/shared/{likec4.CLg3BMaP.mjs → likec4.CJIOuLMn.mjs} +1968 -1957
- package/dist/shared/{likec4.KsxCQmkB.mjs → likec4.Dj4xsbiA.mjs} +36 -36
- package/dist/vite-plugin/index.d.mts +1 -1
- package/dist/vite-plugin/index.mjs +2 -2
- package/package.json +39 -38
- package/react/index.d.mts +266 -3
- package/react/index.mjs +58 -53
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import{relative as Z}from"node:path";import{f as ee,g as x,T as te,N as U,i as ne,n as _,j as S,u as m,l as ie,C as re,a as oe,b as D,c as
|
|
2
|
-
lement"in t&&"text"in t}function fe(t){try{return x(t).uri.toString()}catch{return}}function ge(t){var e,i;const{astNode:n,property:r,index:
|
|
3
|
-
return d&&v(d,T(n))}else return}}}function T(t){var e,i,n,r;return t.$cstNode?(i=(e=x(t))===null||e===void 0?void 0:e.uri)===null||i===void 0?void 0:i.toString():t.$textRegion?t.$textRegion.documentURI||((r=(n=new te(t,
|
|
4
|
-
void 0?i:t.offset+t.length,length:(n=t.length)!==null&&n!==void 0?n:t.end-t.offset};return t.range&&(r.range=t.range),e??(e=t.fileURI),e&&(r.fileURI=e),r}function A(t,e){var i,n;if(t){if(!e)return t&&v(t)}else return e&&v(e);const r=(i=t.end)!==null&&i!==void 0?i:t.offset+t.length,
|
|
5
|
-
line===t.range.start.line&&e.range.start.character<t.range.start.character?e.range.start:t.range.start,end:e.range.end.line>t.range.end.line||e.range.end.line===t.range.end.line&&e.range.end.character>t.range.end.character?e.range.end:t.range.end}),t.fileURI||e.fileURI){const
|
|
1
|
+
import{relative as Z}from"node:path";import{f as ee,g as x,T as te,N as U,i as ne,n as _,j as S,u as m,l as ie,C as re,a as oe,b as D,c as se,t as ae,d as P,m as de,p as ce,e as O,L as le}from"./likec4.CJIOuLMn.mjs";function pe(t){var e,i;if(t){if("astNode"in t)return ge(t);if(Array.isArray(t))return t.reduce(A,void 0);{const n=t,r=ue(n)?fe((i=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&i!==void 0?i:n?.astNode):void 0;return v(n,r)}}else return}function ue(t){return typeof t<"u"&&"e\
|
|
2
|
+
lement"in t&&"text"in t}function fe(t){try{return x(t).uri.toString()}catch{return}}function ge(t){var e,i;const{astNode:n,property:r,index:s}=t??{},o=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||o===void 0)){if(r===void 0)return v(o,T(n));{const a=d=>s!==void 0&&s>-1&&Array.isArray(n[r])?s<d.length?d[s]:void 0:d.reduce(A,void 0);if(!((i=o.assignments)===null||i===void 0)&&i[r]){const d=a(o.assignments[r]);return d&&v(d,T(n))}else if(n.$cstNode){const d=a(ee(n.$cstNode,r));
|
|
3
|
+
return d&&v(d,T(n))}else return}}}function T(t){var e,i,n,r;return t.$cstNode?(i=(e=x(t))===null||e===void 0?void 0:e.uri)===null||i===void 0?void 0:i.toString():t.$textRegion?t.$textRegion.documentURI||((r=(n=new te(t,s=>s.$container?[s.$container]:[]).find(s=>{var o;return(o=s.$textRegion)===null||o===void 0?void 0:o.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||r===void 0?void 0:r.documentURI):void 0}function v(t,e){var i,n;const r={offset:t.offset,end:(i=t.end)!==null&&i!==
|
|
4
|
+
void 0?i:t.offset+t.length,length:(n=t.length)!==null&&n!==void 0?n:t.end-t.offset};return t.range&&(r.range=t.range),e??(e=t.fileURI),e&&(r.fileURI=e),r}function A(t,e){var i,n;if(t){if(!e)return t&&v(t)}else return e&&v(e);const r=(i=t.end)!==null&&i!==void 0?i:t.offset+t.length,s=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,o=Math.min(t.offset,e.offset),a=Math.max(r,s),d=a-o,c={offset:o,end:a,length:d};if(t.range&&e.range&&(c.range={start:e.range.start.line<t.range.start.line||e.range.start.
|
|
5
|
+
line===t.range.start.line&&e.range.start.character<t.range.start.character?e.range.start:t.range.start,end:e.range.end.line>t.range.end.line||e.range.end.line===t.range.end.line&&e.range.end.character>t.range.end.character?e.range.end:t.range.end}),t.fileURI||e.fileURI){const u=t.fileURI,f=e.fileURI,p=u&&f&&u!==f?`<unmergable text regions of ${u}, ${f}>`:u??f;c.fileURI=p}return c}class he{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=
|
|
6
6
|
[],this.traceData=[],this.lines=[[]],this.length=0,typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.
|
|
7
7
|
length}}append(e,i){if(e.length>0){const n=i&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let i=this.traceData.length-1;i>=0;i--){const n=this.traceData[i];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){
|
|
8
|
-
return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join("").length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}addNewLine(){this.lines.push([]),this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}pushTraceRegion(e){const i=me(e,this.currentPosition,n=>{var r,
|
|
9
|
-
r.children)===null||
|
|
10
|
-
var
|
|
11
|
-
complete&&n.complete(i.currentPosition);const r=n.children&&n.children.length===1?n.children[0]:void 0,
|
|
12
|
-
length===0):!1}function we(t,e){t&&(W(e,!1),e.append(t))}function W(t,e){var i;if(t.pendingIndent){let n="";for(const r of t.relevantIndents.filter(
|
|
8
|
+
return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join("").length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}addNewLine(){this.lines.push([]),this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}pushTraceRegion(e){const i=me(e,this.currentPosition,n=>{var r,s;return(s=(r=this.traceData[this.traceData.length-1])===null||r===void 0?void 0:
|
|
9
|
+
r.children)===null||s===void 0?void 0:s.push(n)});return this.traceData.push(i),i}popTraceRegion(e){const i=this.traceData.pop();return this.assertTrue(i===e,"Trace region mismatch!"),i}getParentTraceSourceFileURI(){var e;for(let i=this.traceData.length-1;i>-1;i--){const n=(e=this.traceData[i].sourceRegion)===null||e===void 0?void 0:e.fileURI;if(n)return n}}assertTrue(e,i){if(!e)throw new Error(i)}}function me(t,e,i){const n={sourceRegion:t,targetRegion:void 0,children:[],targetStart:e,complete:r=>{
|
|
10
|
+
var s,o;return n.targetRegion={offset:n.targetStart.offset,end:r.offset,length:r.offset-n.targetStart.offset,range:{start:{line:n.targetStart.line,character:n.targetStart.character},end:{line:r.line,character:r.character}}},delete n.targetStart,((s=n.children)===null||s===void 0?void 0:s.length)===0&&delete n.children,!((o=n.targetRegion)===null||o===void 0)&&o.length&&i(n),delete n.complete,n}};return n}function Ie(t,e){const i=new he(e),n=i.pushTraceRegion(void 0);J(t,i),i.popTraceRegion(n),n.
|
|
11
|
+
complete&&n.complete(i.currentPosition);const r=n.children&&n.children.length===1?n.children[0]:void 0,s=r?.targetRegion,o=n.targetRegion;return s&&r.sourceRegion&&s.offset===o.offset&&s.length===o.length?{text:i.content,trace:r}:{text:i.content,trace:n}}function J(t,e){typeof t=="string"?we(t,e):t instanceof E?Ne(t,e):t instanceof g?G(t,e):t instanceof $&&ve(t,e)}function V(t,e){return typeof t=="string"?t.length!==0:t instanceof g?t.contents.some(i=>V(i,e)):t instanceof $?!(t.ifNotEmpty&&e.currentLineContent.
|
|
12
|
+
length===0):!1}function we(t,e){t&&(W(e,!1),e.append(t))}function W(t,e){var i;if(t.pendingIndent){let n="";for(const r of t.relevantIndents.filter(s=>s.indentEmptyLines||!e))n+=(i=r.indentation)!==null&&i!==void 0?i:t.defaultIndentation;t.append(n,!0),t.pendingIndent=!1}}function G(t,e){let i;const n=pe(t.tracedSource);n&&(i=e.pushTraceRegion(n));for(const r of t.contents)J(r,e);if(i){e.popTraceRegion(i);const r=e.getParentTraceSourceFileURI();r&&n?.fileURI===r&&delete n.fileURI,i.complete&&i.complete(
|
|
13
13
|
e.currentPosition)}}function Ne(t,e){var i;if(V(t,e)){t.indentImmediately&&!e.pendingIndent&&e.append((i=t.indentation)!==null&&i!==void 0?i:e.defaultIndentation,!0);try{e.increaseIndent(t),G(t,e)}finally{e.decreaseIndent()}}}function ve(t,e){t.ifNotEmpty&&!ye(e.currentLineContent)?e.resetCurrentLine():(W(e,!0),e.append(t.lineDelimiter),e.addNewLine())}function ye(t){return t.trimStart()!==""}Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__");const ke=/\S|$/;function Le(t){const e=t.filter(n=>n.
|
|
14
|
-
length>0).map(n=>n.search(ke)),i=e.length===0?0:Math.min(...e);return Math.max(0,i)}function w(t,...e){const i
|
|
15
|
-
length-1].trim().length===0};{let r=i?e.slice(1):e;r=n?r.slice(0,r.length-1):r,r=r.filter(o=>o.length!==0);const
|
|
16
|
-
(
|
|
17
|
-
1]=="string"&&(C(t[r-2])||L(t[r-2]))?i.node.appendNewLineIfNotEmpty():i.node.appendNewLine()}:(()=>{var
|
|
14
|
+
length>0).map(n=>n.search(ke)),i=e.length===0?0:Math.min(...e);return Math.max(0,i)}function w(t,...e){const i=je(t),n=Se(t,e,i);return Te(n)}function $e(t,e,i){return(n,...r)=>Ee(t,e,i)(w(n,...r))}function je(t){const e=t.join("_").split(U),i=e.length>1&&e[0].trim().length===0,n=i&&e.length>1&&e[e.length-1].trim().length===0;if(e.length===1||e.length!==0&&e[0].trim().length!==0||e.length===2&&e[1].trim().length===0)return{indentation:0,omitFirstLine:i,omitLastLine:n,trimLastLine:e.length!==1&&e[e.
|
|
15
|
+
length-1].trim().length===0};{let r=i?e.slice(1):e;r=n?r.slice(0,r.length-1):r,r=r.filter(o=>o.length!==0);const s=Le(r);return{indentation:s,omitFirstLine:i,omitLastLine:n&&(e[e.length-1].length<s||!e[e.length-1].startsWith(r[0].substring(0,s)))}}}function Se(t,e,{indentation:i,omitFirstLine:n,omitLastLine:r,trimLastLine:s}){const o=[];t.forEach((c,u)=>{o.push(...c.split(U).map((f,p)=>p===0||f.length<i?f:f.substring(i)).reduce(u===0?(f,p,h)=>h===0?n?[]:[p]:h===1&&f.length===0?[p]:f.concat(R,p):
|
|
16
|
+
(f,p,h)=>h===0?[p]:f.concat(R,p),[]).filter(f=>!(typeof f=="string"&&f.length===0)).concat(L(e[u])?e[u]:e[u]!==void 0?{content:String(e[u])}:u<e.length?F:[]))});const a=o.length,d=a!==0?o[a-1]:void 0;return(r||s)&&typeof d=="string"&&d.trim().length===0?n&&a!==1&&o[a-2]===R?o.slice(0,a-2):o.slice(0,a-1):o}const R={isNewLine:!0},F={isUndefinedSegment:!0},z=t=>t===R,C=t=>t===F,Re=t=>t.content!==void 0;function Te(t){return t.reduce((i,n,r)=>C(n)?i:z(n)?{node:r!==0&&(C(t[r-1])||L(t[r-1]))||r>1&&typeof t[r-
|
|
17
|
+
1]=="string"&&(C(t[r-2])||L(t[r-2]))?i.node.appendNewLineIfNotEmpty():i.node.appendNewLine()}:(()=>{var s;const o=(r===0||z(t[r-1]))&&typeof n=="string"&&n.length!==0?"".padStart(n.length-n.trimStart().length):"",a=Re(n)?n.content:n;let d;return{node:i.indented?i.node:o.length!==0?i.node.indent({indentation:o,indentImmediately:!1,indentedChildren:c=>d=c.append(a)}):i.node.append(a),indented:d??((s=i.indented)===null||s===void 0?void 0:s.append(a))}})(),{node:new g}).node}const Ce=typeof process>
|
|
18
18
|
"u"?`
|
|
19
19
|
`:process.platform==="win32"?`\r
|
|
20
20
|
`:`
|
|
21
|
-
`;function L(t){return t instanceof g||t instanceof E||t instanceof
|
|
21
|
+
`;function L(t){return t instanceof g||t instanceof E||t instanceof $}function y(t,e){return L(t)?Ie(t,e).text:String(t)}class g{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,i,n){if(ne(e)){if(this.tracedSource={astNode:e,property:i,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative valu\
|
|
22
22
|
e is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(const i of e)typeof i=="function"?i(this):i&&this.contents.push(i);return this}appendIf(e,...i){return e?this.append(...i):this}appendNewLine(){return this.append(l)}appendNewLineIf(e){return e?this.append(l):this}appendNewLineIfNotEmpty(){return this.append(Me)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...i){return this.append(
|
|
23
|
-
w(e,...i))}appendTemplateIf(e){return e?(i,...n)=>this.appendTemplate(i,...n):()=>this}indent(e){const{indentedChildren:i,indentation:n,indentEmptyLines:r,indentImmediately:
|
|
24
|
-
i():i,n,r):()=>this}appendTracedTemplate(e,i,n){return(r,...
|
|
25
|
-
padStart(e)),this.indentImmediately=i,this.indentEmptyLines=n}}class
|
|
26
|
-
if(r&&!r(h
|
|
27
|
-
switch(t.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},Pe=({shape:t})=>{switch(t){case"queue":case"cylinder":case"rectangle":case"person":return t;case"storage":return"stored_data";case"mobile":case"browser":return"rectangle"}};function Y(t){const{nodes:e,edges:i}=t,n=new Map,r=(o,
|
|
28
|
-
el: ",
|
|
29
|
-
t.slice(1),Ae=t=>t.split(".").map(Oe).join(""),Je=t=>Ae(t.parent?t.id.slice(t.parent.length+1):t.id),Ve=({shape:t})=>{switch(t){case"queue":case"cylinder":return["[(",")]"];case"person":return["[fa:fa-user ","]"];case"storage":return["([","])"];case"mobile":case"browser":case"rectangle":return["[","]"]}};function q(t){const{nodes:e,edges:i}=t,n=new Map,r=(o,
|
|
30
|
-
`,"\\n"),
|
|
31
|
-
`,"\\n")+'" .-':"-","> ",n.get(o.target));return y(new g().appendIf(t.title!==null&&t.title.length>0,"---",l,`title: ${JSON.stringify(t.title)}`,l,"---",l).append("graph ",t.autoLayout.direction,l).indent({indentedChildren:o=>{o.append(I(e.filter(
|
|
32
|
-
groups??e.match(/^likec4:(?<module>.+)\/(?<projectId>.+)$/)?.groups??{};return!i||!n?null:(i.endsWith(".js")&&(i=i.slice(0,-3)),i===t?n:null)},virtualId:e=>S("likec4:plugin",e,t)+".js"}}function M(t,e){return{id:`likec4:${t}`,virtualId:`likec4:plugin/${t}.js`,async load({likec4:i,logger:n,projects:r,assetsDir:
|
|
23
|
+
w(e,...i))}appendTemplateIf(e){return e?(i,...n)=>this.appendTemplate(i,...n):()=>this}indent(e){const{indentedChildren:i,indentation:n,indentEmptyLines:r,indentImmediately:s}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},o=new E(n,s,r);return this.contents.push(o),Array.isArray(i)?o.append(...i):i&&o.append(i),this}appendTraced(e,i,n){return r=>this.append(new g().trace(e,i,n).append(r))}appendTracedIf(e,i,n,r){return e?this.appendTraced(typeof i=="function"?
|
|
24
|
+
i():i,n,r):()=>this}appendTracedTemplate(e,i,n){return(r,...s)=>this.append($e(e,i,n)(r,...s))}appendTracedTemplateIf(e,i,n,r){return e?this.appendTracedTemplate(typeof i=="function"?i():i,n,r):()=>this}}function Ee(t,e,i){return n=>n instanceof g&&n.tracedSource===void 0?n.trace(t,e,i):new g().trace(t,e,i).append(n)}class E extends g{constructor(e,i=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".
|
|
25
|
+
padStart(e)),this.indentImmediately=i,this.indentEmptyLines=n}}class ${constructor(e,i=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??Ce,this.ifNotEmpty=i}}const l=new $,Me=new $(void 0,!0),B=t=>t===void 0||typeof t=="string"||L(t)?t:String(t);function I(t,e=B,i={}){const n=typeof e=="function"?e:B,{filter:r,prefix:s,suffix:o,separator:a,appendNewLineIfNotEmpty:d,skipNewLineAfterLastItem:c}=typeof e=="object"?e:i,u=typeof s=="function"?s:()=>s,f=typeof o=="function"?o:()=>o;return be(t,(p,h,j,N)=>{
|
|
26
|
+
if(r&&!r(h,j,N))return p;const b=n(h,j,N);return b===void 0?p:(p??(p=new g)).append(u(h,j,N)).append(b).append(f(h,j,N)).appendIf(!N,a).appendNewLineIfNotEmptyIf(!p.isEmpty()&&!!d&&(!N||!c))})}function be(t,e,i){const n=t[Symbol.iterator]();let r=n.next(),s=0,o=i;for(;!r.done;){const a=n.next();o=e(o,r.value,s,!!a.done),r=a,s++}return o}const xe=t=>t.charAt(0).toLocaleUpperCase()+t.slice(1),Ue=t=>t.split(".").map(xe).join(""),_e=t=>Ue(t.parent?t.id.slice(t.parent.length+1):t.id),De=({autoLayout:t})=>{
|
|
27
|
+
switch(t.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},Pe=({shape:t})=>{switch(t){case"queue":case"cylinder":case"rectangle":case"person":return t;case"storage":return"stored_data";case"mobile":case"browser":return"rectangle"}};function Y(t){const{nodes:e,edges:i}=t,n=new Map,r=(o,a)=>{const d=_e(o),c=(a?a+".":"")+d;n.set(o.id,c);const u=JSON.stringify(o.title),f=Pe(o);return new g().append(d,": {",l).indent({indentedChildren:p=>p.append("lab\
|
|
28
|
+
el: ",u,l).appendIf(f!=="rectangle","shape: ",f,l).appendIf(o.children.length>0,l,I(e.filter(h=>h.parent===o.id),h=>r(h,c))),indentation:2}).append("}",l)},s=o=>new g().append(n.get(o.source)," -> ",n.get(o.target)).append(a=>o.label&&a.append(": ",JSON.stringify(o.label)));return y(new g().append("direction: ",De(t),l,l).append(I(e.filter(o=>_(o.parent)),o=>r(o),{appendNewLineIfNotEmpty:!0})).appendIf(i.length>0,l,I(i,o=>s(o),{appendNewLineIfNotEmpty:!0})))}const Oe=t=>t.charAt(0).toLocaleUpperCase()+
|
|
29
|
+
t.slice(1),Ae=t=>t.split(".").map(Oe).join(""),Je=t=>Ae(t.parent?t.id.slice(t.parent.length+1):t.id),Ve=({shape:t})=>{switch(t){case"queue":case"cylinder":return["[(",")]"];case"person":return["[fa:fa-user ","]"];case"storage":return["([","])"];case"mobile":case"browser":case"rectangle":return["[","]"]}};function q(t){const{nodes:e,edges:i}=t,n=new Map,r=(o,a)=>{const d=Je(o),c=(a?a+".":"")+d;n.set(o.id,c);const u=o.title.replaceAll(`
|
|
30
|
+
`,"\\n"),f=Ve(o),p=new g;return o.children.length>0?p.append("subgraph ",c,"[",JSON.stringify(o.title),"]",l).indent({indentedChildren:[I(e.filter(h=>h.parent===o.id),h=>r(h,c),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",l):p.append(c,f[0],u,f[1]),p},s=o=>new g().append(n.get(o.source)," -.",o.label?' "'+o.label.replaceAll(`
|
|
31
|
+
`,"\\n")+'" .-':"-","> ",n.get(o.target));return y(new g().appendIf(t.title!==null&&t.title.length>0,"---",l,`title: ${JSON.stringify(t.title)}`,l,"---",l).append("graph ",t.autoLayout.direction,l).indent({indentedChildren:o=>{o.append(I(e.filter(a=>_(a.parent)),a=>r(a),{appendNewLineIfNotEmpty:!0})).appendIf(i.length>0,I(i,a=>s(a),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}function k(t){return{matches:e=>{let{module:i,projectId:n}=e.match(/^likec4:plugin\/(?<projectId>.+)\/(?<module>.+)$/)?.
|
|
32
|
+
groups??e.match(/^likec4:(?<module>.+)\/(?<projectId>.+)$/)?.groups??{};return!i||!n?null:(i.endsWith(".js")&&(i=i.slice(0,-3)),i===t?n:null)},virtualId:e=>S("likec4:plugin",e,t)+".js"}}function M(t,e){return{id:`likec4:${t}`,virtualId:`likec4:plugin/${t}.js`,async load({likec4:i,logger:n,projects:r,assetsDir:s}){n.info(m.dim(`generating likec4:${t}`));const o=r.map(({id:a})=>{const d=S(`likec4:${t}`,a);return` case ${JSON.stringify(a)}: return await import(${JSON.stringify(d)})`});return`
|
|
33
33
|
export async function ${e}(projectId) {
|
|
34
34
|
switch (projectId) {
|
|
35
35
|
${o.join(`
|
|
@@ -86,8 +86,8 @@ export async function ${e}(projectId) {
|
|
|
86
86
|
default: {
|
|
87
87
|
throw new Error('Unknown viewId: ' + viewId)
|
|
88
88
|
}
|
|
89
|
-
`}}).append(l," }",l,"}",l,l),y(e)}const Be={...k("dot"),async load({likec4:t,projectId:e,logger:i}){i.info(m.dim(`generating likec4:dot/${e}`));const n=await t.views.viewsAsGraphvizOut(e),r=ie(n,({id:
|
|
90
|
-
padStart(2,"0");return r.imports.push(`import ${c} from 'likec4/icons/${
|
|
89
|
+
`}}).append(l," }",l,"}",l,l),y(e)}const Be={...k("dot"),async load({likec4:t,projectId:e,logger:i}){i.info(m.dim(`generating likec4:dot/${e}`));const n=await t.views.viewsAsGraphvizOut(e),r=ie(n,({id:s,svg:o,dot:a})=>[s,{dot:a,svg:o}]);return ze(r)}},Ye=M("dot","loadDotSources");function qe(t){const e=re(t.flatMap(r=>r.nodes.map(s=>s.icon)),D(ae),D(r=>se(r)&&!(r.toLowerCase().startsWith("http:")||r.toLowerCase().startsWith("https:"))),oe()).sort(),{imports:i,cases:n}=e.reduce((r,s,o)=>{
|
|
90
|
+
const a=s.startsWith("file:"),d="Icon"+o.toString().padStart(2,"0");if(a)return r.imports.push(`import ${d} from '${s}?inline'`),r.cases.push(` '${s}': () => jsx('img', { src: ${d} })`),r;const[c,u]=s.split(":");return r.imports.push(`import ${d} from 'likec4/icons/${c}/${u}'`),r.cases.push(` '${c}:${u}': ${d}`),r},{imports:[],cases:[]});return`
|
|
91
91
|
import { jsx } from 'react/jsx-runtime'
|
|
92
92
|
${i.join(`
|
|
93
93
|
`)}
|
|
@@ -117,8 +117,8 @@ if (import.meta.hot) {
|
|
|
117
117
|
}
|
|
118
118
|
})
|
|
119
119
|
}
|
|
120
|
-
`}const He={...k("icons"),async load({likec4:t,projectId:e,logger:i}){i.info(m.dim(`generating likec4:icons/${e}`));const n=await t.views.computedViews(e);return qe(n)}},Ke={id:"likec4:icons",virtualId:"likec4:plugin/icons.
|
|
121
|
-
c)}`),
|
|
120
|
+
`}const He={...k("icons"),async load({likec4:t,projectId:e,logger:i}){i.info(m.dim(`generating likec4:icons/${e}`));const n=await t.views.computedViews(e);return qe(n)}},Ke={id:"likec4:icons",virtualId:"likec4:plugin/icons.jsx",async load({likec4:t,projects:e,logger:i}){i.info(m.dim("generating likec4:icons"));const{imports:n,cases:r}=e.reduce((s,{id:o},a)=>{const d="Icons"+a.toString().padStart(2,"0"),c=S("likec4:icons",o);return s.imports.push(`import { IconRenderer as ${d} } from ${JSON.stringify(
|
|
121
|
+
c)}`),s.cases.push(` case ${JSON.stringify(o)}: return ${d}`),s},{imports:[],cases:[]});return`
|
|
122
122
|
${n.join(`
|
|
123
123
|
`)}
|
|
124
124
|
|
|
@@ -179,7 +179,7 @@ if (import.meta.hot) {
|
|
|
179
179
|
`,tt={...k("model"),async load({likec4:t,projectId:e,logger:i,assetsDir:n}){i.info(m.dim(`generating likec4:model/${e}`));const r=await t.layoutedModel(e);return et(r)}},nt={id:"likec4:model",virtualId:"likec4:plugin/model.js",async load({likec4:t,logger:e,projects:i,assetsDir:n}){return e.info(m.dim("generating likec4:model")),`
|
|
180
180
|
export async function loadModel(projectId) {
|
|
181
181
|
switch (projectId) {
|
|
182
|
-
${i.map(({id:r})=>{const
|
|
182
|
+
${i.map(({id:r})=>{const s=S("likec4:model",r);return` case ${JSON.stringify(r)}: return await import(${JSON.stringify(s)})`}).join(`
|
|
183
183
|
`)}
|
|
184
184
|
default: throw new Error('Unknown projectId: ' + projectId)
|
|
185
185
|
}
|
|
@@ -210,7 +210,7 @@ export {
|
|
|
210
210
|
useLikeC4View,
|
|
211
211
|
useLikeC4Views
|
|
212
212
|
}
|
|
213
|
-
`,ot={...k("react"),async load({projectId:t,logger:e}){return e.info(m.dim(`generating likec4:react/${t}`)),H(t)}},
|
|
213
|
+
`,ot={...k("react"),async load({projectId:t,logger:e}){return e.info(m.dim(`generating likec4:react/${t}`)),H(t)}},st={id:"likec4:react",virtualId:"likec4:plugin/react.js",async load({logger:t,projects:e}){const i=O(e);return t.info(m.dim("generating likec4:react for")+" "+i.id),H(i.id)}},at=t=>`
|
|
214
214
|
export { IconRenderer } from 'likec4:icons/${t}'
|
|
215
215
|
export {
|
|
216
216
|
$likec4data,
|
|
@@ -220,8 +220,8 @@ export {
|
|
|
220
220
|
useLikeC4View
|
|
221
221
|
} from 'likec4:model/${t}'
|
|
222
222
|
export const projectId = ${JSON.stringify(t)}
|
|
223
|
-
`,dt={id:"likec4:single-project",virtualId:"likec4:plugin/single-project.js",async load({likec4:t,logger:e,projects:i,assetsDir:n}){const r=O(i);return e.info(m.dim("generating likec4:single-project for")+" "+r.id),
|
|
224
|
-
if(i=o.root,n=o.logger,t===!0){const
|
|
225
|
-
virtualId(d)}for(const
|
|
226
|
-
ct(
|
|
227
|
-
`+c.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:Z(i,c.sourceFsPath),line:c.range.start.line+1,column:c.range.start.character+1}}});return}for(const
|
|
223
|
+
`,dt={id:"likec4:single-project",virtualId:"likec4:plugin/single-project.js",async load({likec4:t,logger:e,projects:i,assetsDir:n}){const r=O(i);return e.info(m.dim("generating likec4:single-project for")+" "+r.id),at(r.id)}},K=[tt,He,Ge,Be,Qe],X=[...K,ot],Q=[rt,nt,dt,st,Fe,Ye,Ze,Ke],ct=t=>{const e=t.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function lt({useOverviewGraph:t=!1,...e}){let i,n,r,s;return{name:"vite-plugin-likec4",async configResolved(o){
|
|
224
|
+
if(i=o.root,n=o.logger,t===!0){const a=o.resolve.alias.find(d=>d.find==="likec4/previews")?.replacement;a?(s=a,n.info(m.dim("likec4/previews alias")+" "+m.dim(s))):n.warn("likec4/previews alias not found")}e.languageServices?r=e.languageServices:r=(await le.fromWorkspace(e.workspace??o.root,{logger:n,graphviz:e.graphviz??"wasm",printErrors:e.printErrors??!0,throwIfInvalid:e.throwIfInvalid??!1})).languageServices,s=r.workspaceUri.fsPath},resolveId(o){for(const a of X){const d=a.matches(o);if(d)return a.
|
|
225
|
+
virtualId(d)}for(const a of Q)if(a.id===o)return a.virtualId;return null},async load(o){for(const a of X){const d=a.matches(o);if(d)return await a.load({logger:n,likec4:r,projectId:d,assetsDir:s,useOverviewGraph:t})}for(const a of Q)if(a.virtualId===o){const d=await r.projects();return await a.load({logger:n,likec4:r,projects:d,assetsDir:s,useOverviewGraph:t})}return null},configureServer(o){const a=r.projects().map(({folder:c})=>c.fsPath);for(const c of a)n.info(`${m.dim("watch")} ${c}`);const d=c=>u=>{
|
|
226
|
+
ct(u)&&r.notifyUpdate({[c]:u})};o.watcher.add(a).on("add",d("changed")).on("change",d("changed")).on("unlink",d("removed")),r.builder.onModelParsed(async()=>{const[c]=r.getErrors();if(c){o.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:`Validation failed
|
|
227
|
+
`+c.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:Z(i,c.sourceFsPath),line:c.range.start.line+1,column:c.range.start.character+1}}});return}for(const u of r.projects())for(const f of K){const p=o.moduleGraph.getModuleById(f.virtualId(u.id));if(p&&p.importers.size>0){n.info(`${m.green("reload")} ${m.dim(p.id??p.url)}`);try{await o.reloadModule(p)}catch(h){n.error(h)}}}})}}}export{g as C,lt as L,l as N,Y as a,w as e,q as g,I as j,y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LikeC4LanguageServices } from '../shared/likec4.
|
|
1
|
+
import { L as LikeC4LanguageServices } from '../shared/likec4.BaUvDeNQ.mjs';
|
|
2
2
|
import '@likec4/core';
|
|
3
3
|
import 'type-fest';
|
|
4
4
|
import '/home/runner/work/likec4/likec4/node_modules/.pnpm/@types+picomatch@4.0.0/node_modules/@types/picomatch/posix.d.ts';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{L as LikeC4VitePlugin}from"../shared/likec4.
|
|
2
|
-
import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:os";import"fs/promises";import"@likec4/core/model";
|
|
1
|
+
export{L as LikeC4VitePlugin}from"../shared/likec4.Dj4xsbiA.mjs";import"node:path";import"../shared/likec4.CJIOuLMn.mjs";import"node:fs";import"node:url";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core";import"@likec4/core/types";import"events";import"buffer";import"@hpcc-js/wasm-graphviz";import"@likec4/core/compute-view";import"@likec4/core/utils";import"node:process";import"boxen";import"node:child_process";
|
|
2
|
+
import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:readline/promises";import"node:os";import"fs/promises";import"@likec4/core/model";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "likec4",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://likec4.dev",
|
|
6
6
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"graph"
|
|
20
20
|
],
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=20.19.
|
|
22
|
+
"node": ">=20.19.1"
|
|
23
23
|
},
|
|
24
24
|
"engineStrict": true,
|
|
25
25
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@hpcc-js/wasm-graphviz": "1.7.0",
|
|
81
|
-
"@vitejs/plugin-react": "^4.
|
|
81
|
+
"@vitejs/plugin-react": "^4.5.0",
|
|
82
82
|
"boxen": "^8.0.1",
|
|
83
|
-
"playwright": "^1.
|
|
84
|
-
"rollup": "^4.
|
|
85
|
-
"type-fest": "^4.
|
|
86
|
-
"vite": "^6.3.
|
|
87
|
-
"@likec4/core": "1.
|
|
83
|
+
"playwright": "^1.52.0",
|
|
84
|
+
"rollup": "^4.41.0",
|
|
85
|
+
"type-fest": "^4.40.0",
|
|
86
|
+
"vite": "^6.3.5",
|
|
87
|
+
"@likec4/core": "1.31.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"react": "^18.x || ^19.x",
|
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@dagrejs/dagre": "1.1.4",
|
|
95
95
|
"@fontsource/ibm-plex-sans": "^5.2.5",
|
|
96
|
-
"@mantine/core": "
|
|
97
|
-
"@mantine/hooks": "
|
|
96
|
+
"@mantine/core": "8.0.1",
|
|
97
|
+
"@mantine/hooks": "8.0.1",
|
|
98
98
|
"@nanostores/react": "1.0.0",
|
|
99
|
-
"@pandacss/dev": "^0.53.
|
|
99
|
+
"@pandacss/dev": "^0.53.6",
|
|
100
100
|
"@react-hookz/web": "^25.1.1",
|
|
101
101
|
"@tabler/icons-react": "3.31.0",
|
|
102
102
|
"@tanstack/react-router": "^1.114.13",
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"@types/node": "^20.17.30",
|
|
106
106
|
"@types/picomatch": "^4.0.0",
|
|
107
107
|
"@types/prop-types": "^15.7.14",
|
|
108
|
-
"@types/react
|
|
109
|
-
"@types/react": "^19.1.
|
|
108
|
+
"@types/react": "^19.1.2",
|
|
109
|
+
"@types/react-dom": "^19.1.3",
|
|
110
110
|
"@types/semver": "^7.7.0",
|
|
111
111
|
"@types/yargs": "^17.0.33",
|
|
112
|
-
"@xyflow/react": "^12.
|
|
113
|
-
"@xyflow/system": "^0.0.
|
|
112
|
+
"@xyflow/react": "^12.6.0",
|
|
113
|
+
"@xyflow/system": "^0.0.57",
|
|
114
114
|
"autoprefixer": "^10.4.21",
|
|
115
115
|
"classnames": "^2.5.1",
|
|
116
116
|
"clsx": "^2.1.1",
|
|
@@ -118,20 +118,20 @@
|
|
|
118
118
|
"consola": "^3.4.2",
|
|
119
119
|
"defu": "^6.1.4",
|
|
120
120
|
"dts-bundle-generator": "^9.5.1",
|
|
121
|
+
"esbuild": "^0.25.3",
|
|
121
122
|
"esbuild-node-externals": "^1.18.0",
|
|
122
|
-
"esbuild": "^0.25.2",
|
|
123
123
|
"esm-env": "^1.2.2",
|
|
124
124
|
"fast-equals": "^5.2.2",
|
|
125
|
-
"fdir": "^6.4.
|
|
125
|
+
"fdir": "^6.4.4",
|
|
126
126
|
"get-port": "^7.1.0",
|
|
127
127
|
"html-to-image": "^1.11.13",
|
|
128
128
|
"json5": "^2.2.3",
|
|
129
|
-
"ky": "^1.8.
|
|
130
|
-
"langium": "3.
|
|
129
|
+
"ky": "^1.8.1",
|
|
130
|
+
"langium": "3.5.0",
|
|
131
131
|
"merge-error-cause": "^5.0.2",
|
|
132
132
|
"mkdirp": "^3.0.1",
|
|
133
|
-
"motion": "^12.
|
|
134
|
-
"nano-spawn": "^0.2
|
|
133
|
+
"motion": "^12.12.2",
|
|
134
|
+
"nano-spawn": "^1.0.2",
|
|
135
135
|
"nanostores": "1.0.1",
|
|
136
136
|
"npm-run-all2": "^7.0.1",
|
|
137
137
|
"p-limit": "^6.2.0",
|
|
@@ -141,48 +141,49 @@
|
|
|
141
141
|
"postcss": "^8.5.3",
|
|
142
142
|
"pretty-ms": "^9.2.0",
|
|
143
143
|
"prop-types": "^15.8.1",
|
|
144
|
+
"react": "^19.1.0",
|
|
144
145
|
"react-dom": "^19.1.0",
|
|
145
146
|
"react-error-boundary": "^5.0.0",
|
|
146
|
-
"react-resizable-panels": "^
|
|
147
|
+
"react-resizable-panels": "^3.0.2",
|
|
147
148
|
"react-shadow": "^20.6.0",
|
|
148
|
-
"
|
|
149
|
-
"remeda": "^2.21.2",
|
|
149
|
+
"remeda": "^2.21.3",
|
|
150
150
|
"semver": "^7.7.1",
|
|
151
151
|
"std-env": "^3.9.0",
|
|
152
152
|
"strip-indent": "^4.0.0",
|
|
153
153
|
"terser": "^5.39.0",
|
|
154
154
|
"tinyrainbow": "^2.0.0",
|
|
155
155
|
"tsx": "~4.19.3",
|
|
156
|
-
"turbo": "^2.5.
|
|
156
|
+
"turbo": "^2.5.2",
|
|
157
157
|
"typescript": "^5.8.3",
|
|
158
158
|
"ufo": "^1.6.1",
|
|
159
159
|
"unbuild": "^3.5.0",
|
|
160
|
-
"vite-plugin-dts": "^4.5.
|
|
161
|
-
"vite-plugin-inspect": "^11.0.
|
|
160
|
+
"vite-plugin-dts": "^4.5.4",
|
|
161
|
+
"vite-plugin-inspect": "^11.0.1",
|
|
162
162
|
"vite-plugin-singlefile": "^2.2.0",
|
|
163
|
-
"vitest": "^3.1.
|
|
163
|
+
"vitest": "^3.1.2",
|
|
164
164
|
"vscode-jsonrpc": "8.2.0",
|
|
165
|
-
"vscode-languageserver-types": "3.17.5",
|
|
166
165
|
"vscode-languageserver": "9.0.1",
|
|
166
|
+
"vscode-languageserver-types": "3.17.5",
|
|
167
167
|
"vscode-uri": "3.1.0",
|
|
168
168
|
"which": "^5.0.0",
|
|
169
169
|
"wireit": "^0.14.12",
|
|
170
170
|
"yargs": "17.7.2",
|
|
171
|
-
"@likec4/diagram": "1.
|
|
172
|
-
"@likec4/generators": "1.
|
|
173
|
-
"@likec4/
|
|
174
|
-
"@likec4/layouts": "1.
|
|
175
|
-
"@likec4/
|
|
176
|
-
"@likec4/log": "1.
|
|
177
|
-
"@likec4/style-preset": "1.
|
|
178
|
-
"@likec4/styles": "1.
|
|
179
|
-
"@likec4/tsconfig": "1.
|
|
171
|
+
"@likec4/diagram": "1.31.0",
|
|
172
|
+
"@likec4/generators": "1.31.0",
|
|
173
|
+
"@likec4/icons": "1.31.0",
|
|
174
|
+
"@likec4/layouts": "1.31.0",
|
|
175
|
+
"@likec4/language-server": "1.31.0",
|
|
176
|
+
"@likec4/log": "1.31.0",
|
|
177
|
+
"@likec4/style-preset": "1.31.0",
|
|
178
|
+
"@likec4/styles": "1.31.0",
|
|
179
|
+
"@likec4/tsconfig": "1.31.0"
|
|
180
180
|
},
|
|
181
181
|
"scripts": {
|
|
182
182
|
"typecheck": "tsc --build --verbose",
|
|
183
183
|
"build-cli": "unbuild",
|
|
184
184
|
"build-app": "tsx scripts/bundle-app.ts",
|
|
185
185
|
"build-react": "tsx scripts/bundle-react.ts",
|
|
186
|
+
"build": "echo \"use pnpm turbo run build\" || true",
|
|
186
187
|
"generate:app": "tsr generate && panda codegen",
|
|
187
188
|
"generate:icons": "tsx --conditions=sources scripts/generate-icons.ts",
|
|
188
189
|
"pack": "pnpm pack",
|