@likec4/generators 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/dist/_chunks/chunk.mjs +2 -0
- package/dist/index.mjs +59 -63
- package/dist/likec4/index.d.mts +58 -18
- package/dist/likec4/index.mjs +138 -117
- package/package.json +7 -7
- package/src/likec4/generate-likec4.ts +30 -12
- package/src/likec4/index.ts +4 -4
- package/src/likec4/operators/views.ts +10 -0
- package/src/likec4/schemas/views.ts +6 -0
package/dist/likec4/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import * as z$1 from "zod/v4";
|
|
|
9
9
|
import { BorderStyles, ElementShapes, IconPositions, RelationshipArrowTypes, Sizes, ThemeColors } from "@likec4/core/styles";
|
|
10
10
|
import { produce } from "immer";
|
|
11
11
|
import { LikeC4StylesConfigSchema } from "@likec4/config";
|
|
12
|
+
//#region src/likec4/operators/base.ts
|
|
12
13
|
var base_exports = /* @__PURE__ */ __exportAll({
|
|
13
14
|
body: () => body,
|
|
14
15
|
eachOnFresh: () => eachOnFresh,
|
|
@@ -25,13 +26,13 @@ var base_exports = /* @__PURE__ */ __exportAll({
|
|
|
25
26
|
lazy: () => lazy,
|
|
26
27
|
lines: () => lines,
|
|
27
28
|
markdown: () => markdown,
|
|
28
|
-
markdownOrString: () => markdownOrString
|
|
29
|
+
markdownOrString: () => markdownOrString,
|
|
29
30
|
materialize: () => materialize,
|
|
30
31
|
merge: () => merge,
|
|
31
32
|
newline: () => newline,
|
|
32
33
|
noop: () => noop,
|
|
33
34
|
operation: () => operation,
|
|
34
|
-
print: () => print
|
|
35
|
+
print: () => print,
|
|
35
36
|
printProperty: () => printProperty,
|
|
36
37
|
property: () => property,
|
|
37
38
|
select: () => select,
|
|
@@ -103,7 +104,7 @@ function operation(opOrName, fn) {
|
|
|
103
104
|
function isPrintable(value) {
|
|
104
105
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
105
106
|
}
|
|
106
|
-
function print
|
|
107
|
+
function print(value) {
|
|
107
108
|
return operation(function printOp({ ctx, out }) {
|
|
108
109
|
let v = typeof value === "function" ? value(ctx) : value ?? ctx;
|
|
109
110
|
if (isNullish(v) || v === "") return;
|
|
@@ -111,8 +112,8 @@ function print$1(value) {
|
|
|
111
112
|
out.append(String(v));
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
const eq = () => print
|
|
115
|
-
const space = () => print
|
|
115
|
+
const eq = () => print("=");
|
|
116
|
+
const space = () => print(" ");
|
|
116
117
|
function noop() {
|
|
117
118
|
return identity();
|
|
118
119
|
}
|
|
@@ -178,7 +179,7 @@ function body(...args) {
|
|
|
178
179
|
return body("{", "}")(...ops);
|
|
179
180
|
}
|
|
180
181
|
const QUOTE = "'";
|
|
181
|
-
const ESCAPED_QUOTE = "\\"
|
|
182
|
+
const ESCAPED_QUOTE = "\\'";
|
|
182
183
|
function inlineText(value) {
|
|
183
184
|
return operation(({ ctx, out }) => {
|
|
184
185
|
let v = value ?? ctx;
|
|
@@ -189,7 +190,7 @@ function inlineText(value) {
|
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
192
|
function multilineText(value, quotes = QUOTE) {
|
|
192
|
-
return merge(print
|
|
193
|
+
return merge(print(quotes), indent(value.replaceAll(QUOTE, ESCAPED_QUOTE)), print(quotes));
|
|
193
194
|
}
|
|
194
195
|
function text(value) {
|
|
195
196
|
return operation(function text({ ctx, out }) {
|
|
@@ -215,7 +216,7 @@ function markdown(value) {
|
|
|
215
216
|
return multilineText(v, TRIPLE_QUOTE)(ctx);
|
|
216
217
|
});
|
|
217
218
|
}
|
|
218
|
-
function markdownOrString
|
|
219
|
+
function markdownOrString(value) {
|
|
219
220
|
return operation(function markdownOrString(ctx) {
|
|
220
221
|
let v = value ?? ctx.ctx;
|
|
221
222
|
if (isNullish(v)) return;
|
|
@@ -354,7 +355,7 @@ function property(propertyName, op) {
|
|
|
354
355
|
* ```
|
|
355
356
|
*/
|
|
356
357
|
function printProperty(propertyName) {
|
|
357
|
-
return property(propertyName, print
|
|
358
|
+
return property(propertyName, print());
|
|
358
359
|
}
|
|
359
360
|
function foreach(...args) {
|
|
360
361
|
const [arg1, arg2] = args;
|
|
@@ -527,6 +528,8 @@ function zodOp(schema) {
|
|
|
527
528
|
};
|
|
528
529
|
};
|
|
529
530
|
}
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/likec4/schemas/common.ts
|
|
530
533
|
var common_exports = /* @__PURE__ */ __exportAll({
|
|
531
534
|
arrow: () => arrow,
|
|
532
535
|
border: () => border,
|
|
@@ -540,7 +543,7 @@ var common_exports = /* @__PURE__ */ __exportAll({
|
|
|
540
543
|
line: () => line,
|
|
541
544
|
link: () => link,
|
|
542
545
|
links: () => links,
|
|
543
|
-
markdownOrString: () => markdownOrString,
|
|
546
|
+
markdownOrString: () => markdownOrString$1,
|
|
544
547
|
metadata: () => metadata,
|
|
545
548
|
metadataValue: () => metadataValue$1,
|
|
546
549
|
opacity: () => opacity,
|
|
@@ -578,7 +581,7 @@ const themeColor = z$1.literal(ThemeColors);
|
|
|
578
581
|
const customColor = z$1.custom().refine((v) => typeof v === "string", "Custom color name must be a string").transform((value) => value);
|
|
579
582
|
const tag = z$1.string().nonempty("Tag cannot be empty").transform((tag) => tag.startsWith("#") ? tag.slice(1) : tag);
|
|
580
583
|
const tags = z$1.array(tag).readonly();
|
|
581
|
-
const markdownOrString = z$1.union([
|
|
584
|
+
const markdownOrString$1 = z$1.union([
|
|
582
585
|
z$1.string(),
|
|
583
586
|
z$1.strictObject({ md: z$1.string() }),
|
|
584
587
|
z$1.strictObject({ txt: z$1.string() })
|
|
@@ -607,13 +610,15 @@ const metadata = z$1.record(z$1.string(), metadataValue$1.or(z$1.array(metadataV
|
|
|
607
610
|
const props = z$1.object({
|
|
608
611
|
tags: tags.nullable(),
|
|
609
612
|
title: z$1.string(),
|
|
610
|
-
summary: markdownOrString.nullable(),
|
|
611
|
-
description: markdownOrString.nullable(),
|
|
613
|
+
summary: markdownOrString$1.nullable(),
|
|
614
|
+
description: markdownOrString$1.nullable(),
|
|
612
615
|
notation: z$1.string().nullable(),
|
|
613
616
|
technology: z$1.string().nullable(),
|
|
614
617
|
links: links.nullable(),
|
|
615
618
|
metadata
|
|
616
619
|
}).partial();
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/likec4/schemas/expression.ts
|
|
617
622
|
var expression_exports = /* @__PURE__ */ __exportAll({
|
|
618
623
|
directRelationExpr: () => directRelationExpr$1,
|
|
619
624
|
elementKindExpr: () => elementKindExpr,
|
|
@@ -732,10 +737,10 @@ const fqnExprOrWhere$1 = z$1.union([fqnExpr$1, fqnExprWhere]);
|
|
|
732
737
|
*/
|
|
733
738
|
const commonCustomProperties = z$1.object({
|
|
734
739
|
title: z$1.string(),
|
|
735
|
-
description: markdownOrString,
|
|
740
|
+
description: markdownOrString$1,
|
|
736
741
|
technology: z$1.string(),
|
|
737
742
|
notation: z$1.string(),
|
|
738
|
-
notes: markdownOrString,
|
|
743
|
+
notes: markdownOrString$1,
|
|
739
744
|
navigateTo: viewId,
|
|
740
745
|
color
|
|
741
746
|
});
|
|
@@ -796,6 +801,8 @@ const expression$1 = z$1.union([
|
|
|
796
801
|
relationExprCustom$1,
|
|
797
802
|
whereExpr
|
|
798
803
|
]);
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region src/likec4/schemas/deployment.ts
|
|
799
806
|
var deployment_exports$1 = /* @__PURE__ */ __exportAll({
|
|
800
807
|
element: () => element$3,
|
|
801
808
|
instance: () => instance$1,
|
|
@@ -807,6 +814,11 @@ const node$1 = props.extend({
|
|
|
807
814
|
id: fqn,
|
|
808
815
|
kind,
|
|
809
816
|
style: style.optional(),
|
|
817
|
+
/**
|
|
818
|
+
* Allowing shape, color and icon to be defined at the element level for convenience,
|
|
819
|
+
* they will be moved to the style property during parsing
|
|
820
|
+
* (and will override properties)
|
|
821
|
+
*/
|
|
810
822
|
shape: shape.optional(),
|
|
811
823
|
color: color.optional(),
|
|
812
824
|
icon: icon.optional()
|
|
@@ -824,6 +836,11 @@ const instance$1 = props.extend({
|
|
|
824
836
|
id: fqn,
|
|
825
837
|
element: fqn,
|
|
826
838
|
style: style.optional(),
|
|
839
|
+
/**
|
|
840
|
+
* Allowing shape, color and icon to be defined at the element level for convenience,
|
|
841
|
+
* they will be moved to the style property during parsing
|
|
842
|
+
* (and will override properties)
|
|
843
|
+
*/
|
|
827
844
|
shape: shape.optional(),
|
|
828
845
|
color: color.optional(),
|
|
829
846
|
icon: icon.optional()
|
|
@@ -859,6 +876,8 @@ const schema$2 = z$1.object({
|
|
|
859
876
|
elements: z$1.union([elements$1, z$1.array(element$3)]).transform((v) => isArray(v) ? indexBy(v, prop("id")) : v).optional(),
|
|
860
877
|
relations: z$1.union([relationships$1, z$1.array(relationship$4)]).transform((v) => isArray(v) ? indexBy(v, genRelationshipId$1) : v).optional()
|
|
861
878
|
});
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/likec4/schemas/model.ts
|
|
862
881
|
var model_exports$1 = /* @__PURE__ */ __exportAll({
|
|
863
882
|
element: () => element$2,
|
|
864
883
|
relationship: () => relationship$3,
|
|
@@ -873,6 +892,11 @@ const element$2 = z$1.object({
|
|
|
873
892
|
id: fqn,
|
|
874
893
|
kind,
|
|
875
894
|
style: style.optional(),
|
|
895
|
+
/**
|
|
896
|
+
* Allowing shape, color and icon to be defined at the element level for convenience,
|
|
897
|
+
* they will be moved to the style property during parsing
|
|
898
|
+
* (and will override properties)
|
|
899
|
+
*/
|
|
876
900
|
shape: shape.optional(),
|
|
877
901
|
color: color.optional(),
|
|
878
902
|
icon: icon.optional()
|
|
@@ -908,6 +932,8 @@ const schema$1 = z$1.object({
|
|
|
908
932
|
elements: z$1.union([elements, z$1.array(element$2)]).transform((v) => isArray(v) ? indexBy(v, prop("id")) : v).optional(),
|
|
909
933
|
relations: z$1.union([relationships, z$1.array(relationship$3)]).transform((v) => isArray(v) ? indexBy(v, genRelationshipId) : v).optional()
|
|
910
934
|
});
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region src/likec4/schemas/specification.ts
|
|
911
937
|
var specification_exports$1 = /* @__PURE__ */ __exportAll({
|
|
912
938
|
element: () => element$1,
|
|
913
939
|
relationship: () => relationship$2,
|
|
@@ -921,8 +947,8 @@ var specification_exports$1 = /* @__PURE__ */ __exportAll({
|
|
|
921
947
|
const element$1 = z$1.object({
|
|
922
948
|
tags: tags.nullable(),
|
|
923
949
|
title: z$1.string().nullable(),
|
|
924
|
-
summary: markdownOrString.nullable(),
|
|
925
|
-
description: markdownOrString.nullable(),
|
|
950
|
+
summary: markdownOrString$1.nullable(),
|
|
951
|
+
description: markdownOrString$1.nullable(),
|
|
926
952
|
technology: z$1.string().nullable(),
|
|
927
953
|
notation: z$1.string().nullable(),
|
|
928
954
|
links: links.nullable(),
|
|
@@ -942,16 +968,32 @@ const relationship$2 = z$1.object({
|
|
|
942
968
|
}).partial().transform(pickBy(isNonNullish));
|
|
943
969
|
const tagSpec = z$1.object({ color: z$1.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).optional().catch(void 0) }).partial().transform(pickBy(isNonNullish));
|
|
944
970
|
const schema = z$1.object({
|
|
971
|
+
/**
|
|
972
|
+
* Element kinds specifications, where key is the kind name
|
|
973
|
+
*/
|
|
945
974
|
elements: z$1.record(kind, element$1),
|
|
975
|
+
/**
|
|
976
|
+
* Element kinds specifications, where key is the kind name
|
|
977
|
+
*/
|
|
946
978
|
deployments: z$1.record(kind, element$1),
|
|
979
|
+
/**
|
|
980
|
+
* Relationship kinds specifications, where key is the kind name
|
|
981
|
+
*/
|
|
947
982
|
relationships: z$1.record(kind, relationship$2),
|
|
983
|
+
/**
|
|
984
|
+
* Tag specifications, where key is the tag name
|
|
985
|
+
* Or an array of tags, if no additional properties are needed for tags (like color)
|
|
986
|
+
*/
|
|
948
987
|
tags: z$1.union([z$1.record(tag, tagSpec), z$1.array(tag).transform((tags) => mapToObj(tags, (t) => [t, {}]))])
|
|
949
988
|
}).partial();
|
|
989
|
+
//#endregion
|
|
990
|
+
//#region src/likec4/schemas/views.ts
|
|
950
991
|
var views_exports$1 = /* @__PURE__ */ __exportAll({
|
|
951
992
|
anyView: () => anyView$1,
|
|
952
993
|
autoLayoutDirection: () => autoLayoutDirection,
|
|
953
994
|
deploymentView: () => deploymentView$1,
|
|
954
995
|
deploymentViewRule: () => deploymentViewRule$1,
|
|
996
|
+
deploymentViewRuleIncludeAncestors: () => deploymentViewRuleIncludeAncestors$1,
|
|
955
997
|
dynamicStep: () => dynamicStep$1,
|
|
956
998
|
dynamicStepsParallel: () => dynamicStepsParallel$1,
|
|
957
999
|
dynamicStepsSeries: () => dynamicStepsSeries$1,
|
|
@@ -984,6 +1026,7 @@ const viewRuleAutoLayout$1 = z$1.object({
|
|
|
984
1026
|
nodeSep: z$1.number().optional(),
|
|
985
1027
|
rankSep: z$1.number().optional()
|
|
986
1028
|
}).transform((v) => v);
|
|
1029
|
+
const deploymentViewRuleIncludeAncestors$1 = z$1.strictObject({ includeAncestors: z$1.boolean() });
|
|
987
1030
|
const viewRuleInclude = z$1.strictObject({ include: z$1.array(expression$1) });
|
|
988
1031
|
const viewRuleExclude = z$1.strictObject({ exclude: z$1.array(expression$1) });
|
|
989
1032
|
const viewRulePredicate$1 = z$1.union([viewRuleInclude, viewRuleExclude]).transform((v) => v);
|
|
@@ -1029,7 +1072,7 @@ const viewProps = z$1.object({
|
|
|
1029
1072
|
id: viewId,
|
|
1030
1073
|
_stage: z$1.literal("parsed").default("parsed"),
|
|
1031
1074
|
title: z$1.string().nullish(),
|
|
1032
|
-
description: markdownOrString.nullish(),
|
|
1075
|
+
description: markdownOrString$1.nullish(),
|
|
1033
1076
|
tags: tags.nullish(),
|
|
1034
1077
|
links: links.nullish()
|
|
1035
1078
|
});
|
|
@@ -1048,7 +1091,8 @@ const deploymentViewRule$1 = z$1.union([
|
|
|
1048
1091
|
viewRuleAutoLayout$1,
|
|
1049
1092
|
viewRuleStyle$1,
|
|
1050
1093
|
viewRuleGlobalStyle$1,
|
|
1051
|
-
viewRuleGlobalPredicate$1
|
|
1094
|
+
viewRuleGlobalPredicate$1,
|
|
1095
|
+
deploymentViewRuleIncludeAncestors$1
|
|
1052
1096
|
]);
|
|
1053
1097
|
/**
|
|
1054
1098
|
* Replicates ParsedElementView from the core,
|
|
@@ -1063,10 +1107,10 @@ const dynamicStep$1 = z$1.object({
|
|
|
1063
1107
|
target: fqn,
|
|
1064
1108
|
title: z$1.string().nullish().default(null),
|
|
1065
1109
|
kind: z$1.string().nullish(),
|
|
1066
|
-
description: markdownOrString.nullish(),
|
|
1110
|
+
description: markdownOrString$1.nullish(),
|
|
1067
1111
|
technology: z$1.string().nullish(),
|
|
1068
1112
|
notation: z$1.string().nullish(),
|
|
1069
|
-
notes: markdownOrString.nullish(),
|
|
1113
|
+
notes: markdownOrString$1.nullish(),
|
|
1070
1114
|
color: color.optional(),
|
|
1071
1115
|
line: line.optional(),
|
|
1072
1116
|
head: arrow.optional(),
|
|
@@ -1150,6 +1194,8 @@ function normalizeElementStyles(element, specs) {
|
|
|
1150
1194
|
for (const [key, value] of entries(specStyle)) if (isDeepEqual(element.style?.[key], value)) delete draft.style[key];
|
|
1151
1195
|
});
|
|
1152
1196
|
}
|
|
1197
|
+
//#endregion
|
|
1198
|
+
//#region src/likec4/schemas/index.ts
|
|
1153
1199
|
const schemas = {
|
|
1154
1200
|
common: common_exports,
|
|
1155
1201
|
expr: expression_exports,
|
|
@@ -1159,6 +1205,8 @@ const schemas = {
|
|
|
1159
1205
|
views: views_exports$1,
|
|
1160
1206
|
likec4data: likec4data$1
|
|
1161
1207
|
};
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/likec4/operators/properties.ts
|
|
1162
1210
|
var properties_exports = /* @__PURE__ */ __exportAll({
|
|
1163
1211
|
colorProperty: () => colorProperty,
|
|
1164
1212
|
descriptionProperty: () => descriptionProperty,
|
|
@@ -1183,27 +1231,27 @@ var properties_exports = /* @__PURE__ */ __exportAll({
|
|
|
1183
1231
|
* Print a property from the context as a text.
|
|
1184
1232
|
*/
|
|
1185
1233
|
function textProperty(propertyName, keyword) {
|
|
1186
|
-
return select((e) => e[propertyName], spaceBetween(print
|
|
1234
|
+
return select((e) => e[propertyName], spaceBetween(print(keyword ?? propertyName), text()));
|
|
1187
1235
|
}
|
|
1188
1236
|
/**
|
|
1189
1237
|
* Print a property from the context as a markdown string.
|
|
1190
1238
|
*/
|
|
1191
1239
|
function markdownProperty(propertyName, keyword) {
|
|
1192
|
-
return select((e) => e[propertyName], spaceBetween(print
|
|
1193
|
-
}
|
|
1194
|
-
const titleProperty = () => property("title", spaceBetween(print
|
|
1195
|
-
const summaryProperty = () => property("summary", spaceBetween(print
|
|
1196
|
-
const descriptionProperty = () => property("description", spaceBetween(print
|
|
1197
|
-
const notesProperty = () => property("notes", spaceBetween(print
|
|
1198
|
-
const technologyProperty = () => property("technology", spaceBetween(print
|
|
1199
|
-
const notationProperty = () => property("notation", spaceBetween(print
|
|
1240
|
+
return select((e) => e[propertyName], spaceBetween(print(keyword ?? propertyName), markdownOrString()));
|
|
1241
|
+
}
|
|
1242
|
+
const titleProperty = () => property("title", spaceBetween(print("title"), text()));
|
|
1243
|
+
const summaryProperty = () => property("summary", spaceBetween(print("summary"), markdownOrString()));
|
|
1244
|
+
const descriptionProperty = () => property("description", spaceBetween(print("description"), markdownOrString()));
|
|
1245
|
+
const notesProperty = () => property("notes", spaceBetween(print("notes"), markdownOrString()));
|
|
1246
|
+
const technologyProperty = () => property("technology", spaceBetween(print("technology"), text()));
|
|
1247
|
+
const notationProperty = () => property("notation", spaceBetween(print("notation"), text()));
|
|
1200
1248
|
function printMetadataValue() {
|
|
1201
1249
|
return operation(({ ctx, out }) => {
|
|
1202
1250
|
if (isString(ctx)) return text()({
|
|
1203
1251
|
ctx,
|
|
1204
1252
|
out
|
|
1205
1253
|
});
|
|
1206
|
-
return print
|
|
1254
|
+
return print()({
|
|
1207
1255
|
ctx,
|
|
1208
1256
|
out
|
|
1209
1257
|
});
|
|
@@ -1217,28 +1265,30 @@ function metadataValue() {
|
|
|
1217
1265
|
}
|
|
1218
1266
|
}))));
|
|
1219
1267
|
}
|
|
1220
|
-
const metadataProperty = () => select((e) => e.metadata ? entries(e.metadata) : void 0, body("metadata")(foreach(spaceBetween(print
|
|
1221
|
-
const tagsProperty = () => property("tags", print
|
|
1268
|
+
const metadataProperty = () => select((e) => e.metadata ? entries(e.metadata) : void 0, body("metadata")(foreach(spaceBetween(print((v) => v[0]), property("1", metadataValue())), separateNewLine())));
|
|
1269
|
+
const tagsProperty = () => property("tags", print((v) => v.map((t) => `#${t}`).join(", ")));
|
|
1222
1270
|
function linkProperty() {
|
|
1223
1271
|
return spaceBetween(select((l) => typeof l === "string" ? { url: l } : exact({
|
|
1224
1272
|
url: l.url,
|
|
1225
1273
|
title: l.title
|
|
1226
|
-
}), print
|
|
1274
|
+
}), print("link"), print((v) => v.url), property("title", inlineText())));
|
|
1227
1275
|
}
|
|
1228
1276
|
const linksProperty = () => property("links", foreachNewLine(linkProperty()));
|
|
1229
1277
|
function styleBlockProperty() {
|
|
1230
1278
|
return select((e) => e.style, body("style")(styleProperties()));
|
|
1231
1279
|
}
|
|
1232
1280
|
function colorProperty() {
|
|
1233
|
-
return property("color", spaceBetween(print
|
|
1281
|
+
return property("color", spaceBetween(print("color"), print()));
|
|
1234
1282
|
}
|
|
1235
1283
|
function opacityProperty() {
|
|
1236
|
-
return property("opacity", spaceBetween(print
|
|
1284
|
+
return property("opacity", spaceBetween(print("opacity"), print((v) => `${v}%`)));
|
|
1237
1285
|
}
|
|
1238
1286
|
function iconProperty() {
|
|
1239
|
-
return property("icon", spaceBetween(print
|
|
1287
|
+
return property("icon", spaceBetween(print("icon"), print()));
|
|
1240
1288
|
}
|
|
1241
1289
|
const styleProperties = zodOp(style)(lines(property("shape"), colorProperty(), iconProperty(), property("iconColor"), property("iconSize"), property("iconPosition"), property("border"), opacityProperty(), property("size"), property("padding"), property("textSize"), property("multiple")));
|
|
1290
|
+
//#endregion
|
|
1291
|
+
//#region src/likec4/operators/expressions.ts
|
|
1242
1292
|
var expressions_exports = /* @__PURE__ */ __exportAll({
|
|
1243
1293
|
directRelationExpr: () => directRelationExpr,
|
|
1244
1294
|
expression: () => expression,
|
|
@@ -1298,7 +1348,7 @@ const whereMetadataEqual = zodOp(whereMetadata)(function whereMetadataEqualOp({
|
|
|
1298
1348
|
if ("neq" in value) return out.append(`metadata.${key} is not ${quoteMetadataValue(value.neq)}`);
|
|
1299
1349
|
nonexhaustive(value);
|
|
1300
1350
|
});
|
|
1301
|
-
const whereNot = zodOp(whereNot$1)(property("not", spaceBetween(print
|
|
1351
|
+
const whereNot = zodOp(whereNot$1)(property("not", spaceBetween(print("not ("), lazy(() => whereOperator()), print(")"))));
|
|
1302
1352
|
const whereParticipant = zodOp(whereParticipant$1)(function whereParticipantOp({ ctx: { participant, operator }, out }) {
|
|
1303
1353
|
out.append(participant, ".");
|
|
1304
1354
|
if ("tag" in operator) {
|
|
@@ -1390,7 +1440,7 @@ const fqnExprCustom = zodOp(fqnExprCustom$1)(({ ctx: { custom }, exec }) => {
|
|
|
1390
1440
|
const fqnExprOrWhere = zodOp(fqnExprOrWhere$1)(({ ctx, exec }) => {
|
|
1391
1441
|
if ("where" in ctx) {
|
|
1392
1442
|
exec(ctx.where.expr, fqnExpr());
|
|
1393
|
-
exec(ctx.where.condition, indent(print
|
|
1443
|
+
exec(ctx.where.condition, indent(print("where"), indent(whereOperator())));
|
|
1394
1444
|
return;
|
|
1395
1445
|
}
|
|
1396
1446
|
exec(ctx, fqnExpr());
|
|
@@ -1405,10 +1455,10 @@ const fqnExprAny = zodOp(fqnExprAny$1)(({ ctx, out }) => {
|
|
|
1405
1455
|
out
|
|
1406
1456
|
});
|
|
1407
1457
|
});
|
|
1408
|
-
const directRelationExpr = zodOp(directRelationExpr$1)(merge(property("source", fqnExpr()), print
|
|
1409
|
-
const incomingRelationExpr = zodOp(incomingRelationExpr$1)(merge(print
|
|
1410
|
-
const outgoingRelationExpr = zodOp(outgoingRelationExpr$1)(merge(property("outgoing", fqnExpr()), print
|
|
1411
|
-
const inOutRelationExpr = zodOp(inoutRelationExpr)(merge(print
|
|
1458
|
+
const directRelationExpr = zodOp(directRelationExpr$1)(merge(property("source", fqnExpr()), print((v) => v.isBidirectional ? " <-> " : " -> "), property("target", fqnExpr())));
|
|
1459
|
+
const incomingRelationExpr = zodOp(incomingRelationExpr$1)(merge(print("-> "), property("incoming", fqnExpr())));
|
|
1460
|
+
const outgoingRelationExpr = zodOp(outgoingRelationExpr$1)(merge(property("outgoing", fqnExpr()), print(" ->")));
|
|
1461
|
+
const inOutRelationExpr = zodOp(inoutRelationExpr)(merge(print("-> "), property("inout", fqnExpr()), print(" ->")));
|
|
1412
1462
|
const relationExpr = zodOp(relationExpr$1)(({ ctx, exec }) => {
|
|
1413
1463
|
if ("source" in ctx) return exec(ctx, directRelationExpr());
|
|
1414
1464
|
if ("incoming" in ctx) return exec(ctx, incomingRelationExpr());
|
|
@@ -1417,7 +1467,7 @@ const relationExpr = zodOp(relationExpr$1)(({ ctx, exec }) => {
|
|
|
1417
1467
|
nonexhaustive(ctx);
|
|
1418
1468
|
});
|
|
1419
1469
|
const relationExprOrWhere = zodOp(relationExprOrWhere$1)(({ ctx, out }) => {
|
|
1420
|
-
if ("where" in ctx) return merge(withctx(ctx.where.expr)(relationExpr()), indent(print
|
|
1470
|
+
if ("where" in ctx) return merge(withctx(ctx.where.expr)(relationExpr()), indent(print("where"), indent(withctx(ctx.where.condition)(whereOperator()))))({
|
|
1421
1471
|
ctx,
|
|
1422
1472
|
out
|
|
1423
1473
|
});
|
|
@@ -1454,6 +1504,8 @@ const expression = zodOp(expression$1)(({ ctx, exec }) => {
|
|
|
1454
1504
|
}
|
|
1455
1505
|
nonexhaustive(ctx);
|
|
1456
1506
|
});
|
|
1507
|
+
//#endregion
|
|
1508
|
+
//#region src/likec4/operators/deployment.ts
|
|
1457
1509
|
var deployment_exports = /* @__PURE__ */ __exportAll({
|
|
1458
1510
|
deployment: () => deployment,
|
|
1459
1511
|
instance: () => instance,
|
|
@@ -1490,7 +1542,7 @@ function hasElementProps$1(el) {
|
|
|
1490
1542
|
return !!(el.description || el.summary || el.technology || el.notation || el.tags && el.tags.length > 0 || el.links && el.links.length > 0 || !isEmptyish(el.metadata) || hasStyleProps$1(el));
|
|
1491
1543
|
}
|
|
1492
1544
|
const elementProperties$1 = zodOp(schemas.deployment.element)(lines(tagsProperty(), technologyProperty(), summaryProperty(), descriptionProperty(), linksProperty(), metadataProperty(), select((e) => hasStyleProps$1(e) ? e.style : void 0, body("style")(styleProperties()))));
|
|
1493
|
-
const instance = zodOp(schemas.deployment.instance)(spaceBetween(when((v) => nameFromFqn(v.id) !== nameFromFqn(v.element), print
|
|
1545
|
+
const instance = zodOp(schemas.deployment.instance)(spaceBetween(when((v) => nameFromFqn(v.id) !== nameFromFqn(v.element), print((v) => nameFromFqn(v.id)), print(" =")), print("instanceOf"), printProperty("element"), when((v) => !!v.title && v.title !== nameFromFqn(v.id), property("title", inlineText())), when((e) => hasElementProps$1(e), body(elementProperties$1()))));
|
|
1494
1546
|
function node() {
|
|
1495
1547
|
return function nodeOp({ ctx, out }) {
|
|
1496
1548
|
const el = ctx;
|
|
@@ -1508,9 +1560,9 @@ function node() {
|
|
|
1508
1560
|
const needsBody = el.children.length > 0 || hasElementProps$1(el);
|
|
1509
1561
|
const name = nameFromFqn(el.id);
|
|
1510
1562
|
const inline = [
|
|
1511
|
-
print
|
|
1512
|
-
print
|
|
1513
|
-
print
|
|
1563
|
+
print(name),
|
|
1564
|
+
print("="),
|
|
1565
|
+
print(el.kind)
|
|
1514
1566
|
];
|
|
1515
1567
|
if (el.title && el.title !== name) inline.push(inlineText(el.title));
|
|
1516
1568
|
if (needsBody) inline.push(body(lines(2)(withctx(el, elementProperties$1()), ...el.children.map((node) => withctx(node, nodeOp)))));
|
|
@@ -1526,8 +1578,10 @@ function hasRelationStyle$1(rel) {
|
|
|
1526
1578
|
function hasRelationProps$1(rel) {
|
|
1527
1579
|
return !!(rel.description || rel.summary || rel.technology || rel.tags && rel.tags.length > 0 || rel.links && rel.links.length > 0 || !isEmptyish(rel.metadata) || hasRelationStyle$1(rel) || rel.navigateTo);
|
|
1528
1580
|
}
|
|
1529
|
-
const relationship$1 = zodOp(schemas.deployment.relationship)(spaceBetween(property("source", fqnRef()), print
|
|
1581
|
+
const relationship$1 = zodOp(schemas.deployment.relationship)(spaceBetween(property("source", fqnRef()), print((rel) => rel.kind ? `-[${rel.kind}]->` : "->"), property("target", fqnRef()), property("title", inlineText()), when(hasRelationProps$1, body(tagsProperty(), technologyProperty(), summaryProperty(), descriptionProperty(), property("navigateTo"), linksProperty(), metadataProperty(), when(hasRelationStyle$1, body("style")(colorProperty(), property("line"), property("head"), property("tail")))))));
|
|
1530
1582
|
const deployment = zodOp(schemas.deployment.schema)(body("deployment")(lines(2)(select((d) => buildTree$1(d.elements ? values(d.elements) : []).roots, lines(2)(foreach(node()))), select((d) => d.relations ? values(d.relations) : void 0, lines(2)(foreach(relationship$1()))))));
|
|
1583
|
+
//#endregion
|
|
1584
|
+
//#region src/likec4/operators/model.ts
|
|
1531
1585
|
var model_exports = /* @__PURE__ */ __exportAll({
|
|
1532
1586
|
element: () => element,
|
|
1533
1587
|
model: () => model,
|
|
@@ -1567,9 +1621,9 @@ function elementTree() {
|
|
|
1567
1621
|
const needsBody = (ctx.children?.length ?? 0) > 0 || hasElementProps(el);
|
|
1568
1622
|
const name = nameFromFqn(el.id);
|
|
1569
1623
|
const inline = [
|
|
1570
|
-
print
|
|
1571
|
-
print
|
|
1572
|
-
print
|
|
1624
|
+
print(name),
|
|
1625
|
+
print("="),
|
|
1626
|
+
print(el.kind)
|
|
1573
1627
|
];
|
|
1574
1628
|
if (el.title && el.title !== name) inline.push(inlineText(el.title));
|
|
1575
1629
|
if (needsBody) inline.push(body(lines(2)(withctx(el, elementProperties()), ...(ctx.children ?? []).map((node) => withctx(node, elementTree())))));
|
|
@@ -1585,23 +1639,28 @@ function hasRelationStyle(rel) {
|
|
|
1585
1639
|
function hasRelationProps(rel) {
|
|
1586
1640
|
return !!(rel.description || rel.summary || rel.technology || rel.tags && rel.tags.length > 0 || rel.links && rel.links.length > 0 || !isEmptyish(rel.metadata) || hasRelationStyle(rel) || rel.navigateTo);
|
|
1587
1641
|
}
|
|
1588
|
-
const relationship = zodOp(schemas.model.relationship)(spaceBetween(property("source", fqnRef()), print
|
|
1642
|
+
const relationship = zodOp(schemas.model.relationship)(spaceBetween(property("source", fqnRef()), print((rel) => rel.kind ? `-[${rel.kind}]->` : "->"), property("target", fqnRef()), property("title", inlineText()), when(hasRelationProps, body(tagsProperty(), technologyProperty(), summaryProperty(), descriptionProperty(), property("navigateTo"), linksProperty(), metadataProperty(), when(hasRelationStyle, body("style")(colorProperty(), property("line"), property("head"), property("tail")))))));
|
|
1589
1643
|
const element = zodOp(schemas.model.element)(elementTree());
|
|
1590
1644
|
const model = zodOp(schemas.model.schema)(body("model")(lines(2)(select((d) => buildTree(d.elements ? values(d.elements) : []).roots, lines(2)(foreach(elementTree()))), select((d) => d.relations ? values(d.relations) : void 0, lines(2)(foreach(relationship()))))));
|
|
1645
|
+
//#endregion
|
|
1646
|
+
//#region src/likec4/operators/specification.ts
|
|
1591
1647
|
var specification_exports = /* @__PURE__ */ __exportAll({
|
|
1592
1648
|
elementKind: () => elementKind,
|
|
1593
1649
|
relationshipKind: () => relationshipKind,
|
|
1594
1650
|
specification: () => specification,
|
|
1595
1651
|
tagSpecification: () => tagSpecification
|
|
1596
1652
|
});
|
|
1597
|
-
const tagSpecification = zodOp(z$1.tuple([z$1.string(), tagSpec]))(spaceBetween(print
|
|
1598
|
-
const elementKind = (keyword) => zodOp(z$1.tuple([z$1.string(), element$1]))(spaceBetween(print
|
|
1599
|
-
const relationshipKind = zodOp(z$1.tuple([z$1.string(), relationship$2]))(spaceBetween(print
|
|
1653
|
+
const tagSpecification = zodOp(z$1.tuple([z$1.string(), tagSpec]))(spaceBetween(print("tag"), printProperty("0"), property("1", property("color", body(spaceBetween(print("color"), print()))))));
|
|
1654
|
+
const elementKind = (keyword) => zodOp(z$1.tuple([z$1.string(), element$1]))(spaceBetween(print(keyword), printProperty("0"), property("1", body(tagsProperty(), titleProperty(), summaryProperty(), descriptionProperty(), technologyProperty(), notationProperty(), linksProperty(), property("style", body("style")(styleProperties()))))));
|
|
1655
|
+
const relationshipKind = zodOp(z$1.tuple([z$1.string(), relationship$2]))(spaceBetween(print("relationship"), printProperty("0"), property("1", body(technologyProperty(), notationProperty(), colorProperty(), property("line"), property("head"), property("tail")))));
|
|
1600
1656
|
const specification = zodOp(schema)(body("specification")(lines(2)(select((c) => c.elements && entries(c.elements), foreachNewLine(elementKind("element")())), select((c) => c.deployments && entries(c.deployments), foreachNewLine(elementKind("deploymentNode")())), select((c) => c.relationships && entries(c.relationships), foreachNewLine(relationshipKind())), select((c) => c.tags && entries(c.tags), foreachNewLine(tagSpecification())))));
|
|
1657
|
+
//#endregion
|
|
1658
|
+
//#region src/likec4/operators/views.ts
|
|
1601
1659
|
var views_exports = /* @__PURE__ */ __exportAll({
|
|
1602
1660
|
anyView: () => anyView,
|
|
1603
1661
|
deploymentView: () => deploymentView,
|
|
1604
1662
|
deploymentViewRule: () => deploymentViewRule,
|
|
1663
|
+
deploymentViewRuleIncludeAncestors: () => deploymentViewRuleIncludeAncestors,
|
|
1605
1664
|
dynamicStep: () => dynamicStep,
|
|
1606
1665
|
dynamicStepsParallel: () => dynamicStepsParallel,
|
|
1607
1666
|
dynamicStepsSeries: () => dynamicStepsSeries,
|
|
@@ -1620,7 +1679,7 @@ var views_exports = /* @__PURE__ */ __exportAll({
|
|
|
1620
1679
|
viewRuleStyle: () => viewRuleStyle,
|
|
1621
1680
|
views: () => views
|
|
1622
1681
|
});
|
|
1623
|
-
const viewTitleProperty = () => property("title", spaceBetween(print
|
|
1682
|
+
const viewTitleProperty = () => property("title", spaceBetween(print("title"), inlineText()));
|
|
1624
1683
|
const viewRulePredicate = zodOp(schemas.views.viewRulePredicate)(({ ctx, exec }) => {
|
|
1625
1684
|
let exprs;
|
|
1626
1685
|
let type;
|
|
@@ -1635,9 +1694,9 @@ const viewRulePredicate = zodOp(schemas.views.viewRulePredicate)(({ ctx, exec })
|
|
|
1635
1694
|
if (!hasAtLeast(exprs, 1)) return;
|
|
1636
1695
|
const isMultiple = hasAtLeast(exprs, 2);
|
|
1637
1696
|
const exprOp = withctx(exprs)(foreach(expression(), separateComma(isMultiple)));
|
|
1638
|
-
exec(ctx, merge(print
|
|
1697
|
+
exec(ctx, merge(print(type), ...isMultiple ? [indent(exprOp)] : [space(), exprOp]));
|
|
1639
1698
|
});
|
|
1640
|
-
const viewRuleStyle = zodOp(schemas.views.viewRuleStyle)(spaceBetween(print
|
|
1699
|
+
const viewRuleStyle = zodOp(schemas.views.viewRuleStyle)(spaceBetween(print("style"), property("targets", foreach(expression(), separateComma())), body("{", "}")(notationProperty(), property("style", styleProperties()))));
|
|
1641
1700
|
const viewRuleGroup = zodOp(schemas.views.viewRuleGroup)(({ ctx, exec }) => {
|
|
1642
1701
|
throw new Error("not implemented");
|
|
1643
1702
|
});
|
|
@@ -1653,7 +1712,8 @@ const mapping = {
|
|
|
1653
1712
|
"LR": "LeftRight",
|
|
1654
1713
|
"RL": "RightLeft"
|
|
1655
1714
|
};
|
|
1656
|
-
const viewRuleAutoLayout = zodOp(schemas.views.viewRuleAutoLayout)(spaceBetween(print
|
|
1715
|
+
const viewRuleAutoLayout = zodOp(schemas.views.viewRuleAutoLayout)(spaceBetween(print("autoLayout"), property("direction", print((v) => mapping[v])), guard(hasProp("rankSep"), spaceBetween(printProperty("rankSep"), printProperty("nodeSep")))));
|
|
1716
|
+
const deploymentViewRuleIncludeAncestors = zodOp(schemas.views.deploymentViewRuleIncludeAncestors)(spaceBetween(print("includeAncestors"), printProperty("includeAncestors")));
|
|
1657
1717
|
const viewRuleRank = zodOp(schemas.views.viewRuleRank)(({ ctx, exec }) => {
|
|
1658
1718
|
throw new Error("not implemented");
|
|
1659
1719
|
});
|
|
@@ -1667,17 +1727,18 @@ const elementViewRule = zodOp(schemas.views.elementViewRule)(({ ctx, exec }) =>
|
|
|
1667
1727
|
if ("targets" in ctx && "style" in ctx) return exec(ctx, viewRuleStyle());
|
|
1668
1728
|
nonexhaustive(ctx);
|
|
1669
1729
|
});
|
|
1670
|
-
const elementView = zodOp(schemas.views.elementView.partial({ _type: true }))(spaceBetween(print
|
|
1730
|
+
const elementView = zodOp(schemas.views.elementView.partial({ _type: true }))(spaceBetween(print("view"), print((v) => v.id), property("viewOf", spaceBetween(print("of"), print())), body(lines(2)(lines(tagsProperty(), viewTitleProperty(), descriptionProperty(), linksProperty()), property("rules", foreachNewLine(elementViewRule()))))));
|
|
1671
1731
|
const deploymentViewRule = zodOp(schemas.views.deploymentViewRule)(({ ctx, exec }) => {
|
|
1672
1732
|
if ("include" in ctx || "exclude" in ctx) return exec(ctx, viewRulePredicate());
|
|
1733
|
+
if ("includeAncestors" in ctx) return exec(ctx, deploymentViewRuleIncludeAncestors());
|
|
1673
1734
|
if ("direction" in ctx) return exec(ctx, viewRuleAutoLayout());
|
|
1674
1735
|
if ("styleId" in ctx) return exec(ctx, viewRuleGlobalStyle());
|
|
1675
1736
|
if ("predicateId" in ctx) return exec(ctx, viewRuleGlobalPredicate());
|
|
1676
1737
|
if ("targets" in ctx && "style" in ctx) return exec(ctx, viewRuleStyle());
|
|
1677
1738
|
nonexhaustive(ctx);
|
|
1678
1739
|
});
|
|
1679
|
-
const deploymentView = zodOp(schemas.views.deploymentView.partial({ _type: true }))(spaceBetween(print
|
|
1680
|
-
const dynamicStep = zodOp(schemas.views.dynamicStep)(spaceBetween(print
|
|
1740
|
+
const deploymentView = zodOp(schemas.views.deploymentView.partial({ _type: true }))(spaceBetween(print("deployment view"), print((v) => v.id), body(lines(2)(lines(tagsProperty(), viewTitleProperty(), descriptionProperty(), linksProperty()), property("rules", foreachNewLine(deploymentViewRule()))))));
|
|
1741
|
+
const dynamicStep = zodOp(schemas.views.dynamicStep)(spaceBetween(print((v) => v.source), print((v) => v.isBackward ? "<-" : "->"), print((v) => v.target), body(lines(titleProperty(), technologyProperty(), descriptionProperty(), notesProperty(), property("navigateTo"), notationProperty(), colorProperty(), property("line"), property("head"), property("tail")))));
|
|
1681
1742
|
const dynamicStepsSeries = zodOp(schemas.views.dynamicStepsSeries)(({ ctx, exec }) => {
|
|
1682
1743
|
throw new Error("Not implemented");
|
|
1683
1744
|
});
|
|
@@ -1693,7 +1754,7 @@ const dynamicViewIncludeRule = zodOp(schemas.views.dynamicViewIncludeRule)(({ ct
|
|
|
1693
1754
|
if (!hasAtLeast(ctx.include, 1)) return;
|
|
1694
1755
|
const isMultiple = hasAtLeast(ctx.include, 2);
|
|
1695
1756
|
const exprOp = withctx(ctx.include)(foreach(expression(), separateComma(isMultiple)));
|
|
1696
|
-
exec(ctx, merge(print
|
|
1757
|
+
exec(ctx, merge(print("include"), ...isMultiple ? [indent(exprOp)] : [space(), exprOp]));
|
|
1697
1758
|
});
|
|
1698
1759
|
const dynamicViewRule = zodOp(schemas.views.dynamicViewRule)(({ ctx, exec }) => {
|
|
1699
1760
|
if ("include" in ctx) return exec(ctx, dynamicViewIncludeRule());
|
|
@@ -1703,7 +1764,7 @@ const dynamicViewRule = zodOp(schemas.views.dynamicViewRule)(({ ctx, exec }) =>
|
|
|
1703
1764
|
if ("direction" in ctx) return exec(ctx, viewRuleAutoLayout());
|
|
1704
1765
|
nonexhaustive(ctx);
|
|
1705
1766
|
});
|
|
1706
|
-
const dynamicView = zodOp(schemas.views.dynamicView.partial({ _type: true }))(spaceBetween(print
|
|
1767
|
+
const dynamicView = zodOp(schemas.views.dynamicView.partial({ _type: true }))(spaceBetween(print("dynamic view"), print((v) => v.id), body(lines(2)(lines(tagsProperty(), viewTitleProperty(), descriptionProperty(), linksProperty(), property("variant")), property("steps", foreachNewLine(dynamicViewStep())), property("rules", foreachNewLine(dynamicViewRule()))))));
|
|
1707
1768
|
const anyView = zodOp(schemas.views.anyView)(({ ctx, exec }) => {
|
|
1708
1769
|
if ("_type" in ctx) {
|
|
1709
1770
|
if (ctx._type == "element") return exec(ctx, elementView());
|
|
@@ -1716,8 +1777,12 @@ const views = zodOp(schemas.views.views)(body("views")(select((ctx) => values(ct
|
|
|
1716
1777
|
separator: new CompositeGeneratorNode().appendNewLine().appendNewLine(),
|
|
1717
1778
|
prefix: (_, index, isLast) => index === 0 && !isLast ? NL : void 0
|
|
1718
1779
|
}))));
|
|
1780
|
+
//#endregion
|
|
1781
|
+
//#region src/likec4/operators/likec4data.ts
|
|
1719
1782
|
z$1.object({});
|
|
1720
1783
|
const likec4data = zodOp(schemas.likec4data)(lines(2)(property("specification", specification()), model(), property("deployment", deployment()), property("deployments", deployment()), property("views", views())));
|
|
1784
|
+
//#endregion
|
|
1785
|
+
//#region src/likec4/operators/index.ts
|
|
1721
1786
|
var operators_exports = /* @__PURE__ */ __exportAll({
|
|
1722
1787
|
base: () => base_exports,
|
|
1723
1788
|
deployment: () => deployment,
|
|
@@ -1735,6 +1800,8 @@ var operators_exports = /* @__PURE__ */ __exportAll({
|
|
|
1735
1800
|
specifications: () => specification_exports,
|
|
1736
1801
|
views: () => views_exports
|
|
1737
1802
|
});
|
|
1803
|
+
//#endregion
|
|
1804
|
+
//#region src/likec4/generate-likec4.ts
|
|
1738
1805
|
function generateLikeC4(input, params) {
|
|
1739
1806
|
params = {
|
|
1740
1807
|
indentation: 2,
|
|
@@ -1742,57 +1809,11 @@ function generateLikeC4(input, params) {
|
|
|
1742
1809
|
};
|
|
1743
1810
|
return materialize(withctx(input, likec4data()), params.indentation);
|
|
1744
1811
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
*
|
|
1748
|
-
* @see operators
|
|
1749
|
-
*
|
|
1750
|
-
* @example
|
|
1751
|
-
* ```ts
|
|
1752
|
-
* print(operators.expression, {
|
|
1753
|
-
* ref: {
|
|
1754
|
-
* model: 'some.el',
|
|
1755
|
-
* },
|
|
1756
|
-
* selector: 'descendants',
|
|
1757
|
-
* })
|
|
1758
|
-
* // "some.el.**"
|
|
1759
|
-
* ```
|
|
1760
|
-
*
|
|
1761
|
-
* @example
|
|
1762
|
-
* ```ts
|
|
1763
|
-
* print(operators.model, {
|
|
1764
|
-
* elements: [
|
|
1765
|
-
* {
|
|
1766
|
-
* id: 'cloud',
|
|
1767
|
-
* kind: 'system',
|
|
1768
|
-
* },
|
|
1769
|
-
* {
|
|
1770
|
-
* id: 'cloud.mobile',
|
|
1771
|
-
* kind: 'mobileapp',
|
|
1772
|
-
* shape: 'mobile',
|
|
1773
|
-
* color: 'amber',
|
|
1774
|
-
* }
|
|
1775
|
-
* ],
|
|
1776
|
-
* })
|
|
1777
|
-
* // model {
|
|
1778
|
-
* // cloud = system {
|
|
1779
|
-
* // mobile = mobileapp {
|
|
1780
|
-
* // style {
|
|
1781
|
-
* // shape mobile
|
|
1782
|
-
* // color amber
|
|
1783
|
-
* // }
|
|
1784
|
-
* // }
|
|
1785
|
-
* // }
|
|
1786
|
-
* // }
|
|
1787
|
-
* ```
|
|
1788
|
-
*/
|
|
1789
|
-
function print(operator, data, params) {
|
|
1790
|
-
return materialize(withctx(data, operator()), params?.indentation);
|
|
1812
|
+
function printOperation(operation, data, params) {
|
|
1813
|
+
return materialize(withctx(data ?? {}, operation), params?.indentation);
|
|
1791
1814
|
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
*/
|
|
1795
|
-
function printTabIndent(operator, data) {
|
|
1796
|
-
return materialize(withctx(data, operator()), " ");
|
|
1815
|
+
function printWithTabIndent(operation, data) {
|
|
1816
|
+
return materialize(withctx(data ?? {}, operation), " ");
|
|
1797
1817
|
}
|
|
1798
|
-
|
|
1818
|
+
//#endregion
|
|
1819
|
+
export { body, eachOnFresh, eq, executeOnCtx, executeOnFresh, foreach, foreachNewLine, fresh, generateLikeC4 as generate, guard, indent, inlineText, join, lazy, lines, markdown, markdownOrString, materialize, merge, newline, noop, operation, operators_exports as ops, print, printOperation, printProperty, printWithTabIndent, property, select, separateComma, separateNewLine, separateWith, space, spaceBetween, text, when, withctx, zodOp };
|