@likec4/core 1.12.1 → 1.13.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/index.cjs +777 -251
- package/dist/index.d.cts +301 -32
- package/dist/index.d.mts +301 -32
- package/dist/index.d.ts +301 -32
- package/dist/index.mjs +774 -252
- package/dist/shared/{core.BvFch1jG.mjs → core.BJDxVHFh.mjs} +19 -19
- package/dist/shared/{core.dY8efyk0.d.ts → core.C4jDMQ1i.d.cts} +242 -238
- package/dist/shared/{core.dY8efyk0.d.cts → core.C4jDMQ1i.d.mts} +242 -238
- package/dist/shared/{core.dY8efyk0.d.mts → core.C4jDMQ1i.d.ts} +242 -238
- package/dist/shared/{core.CTiE4teS.cjs → core.IR7XOEkQ.cjs} +19 -18
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +4 -3
- package/src/builder/Builder.element.ts +221 -0
- package/src/builder/Builder.model.ts +346 -0
- package/src/builder/Builder.test-d.ts +69 -0
- package/src/builder/Builder.ts +574 -0
- package/src/builder/Builder.view.ts +358 -0
- package/src/builder/Builder.views.ts +318 -0
- package/src/builder/_types.ts +195 -0
- package/src/builder/index.ts +5 -0
- package/src/index.ts +4 -0
- package/src/model/LikeC4DiagramModel.ts +5 -5
- package/src/model/LikeC4Model.ts +63 -46
- package/src/model/LikeC4ViewModel.ts +7 -7
- package/src/model/__test__/fixture.ts +5 -0
- package/src/types/element.ts +19 -11
- package/src/types/model.ts +13 -8
- package/src/types/relation.ts +1 -1
- package/src/types/view-changes.ts +6 -2
- package/src/types/view.ts +53 -22
- package/src/utils/fqn.ts +12 -11
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
function u$1(t,n,a){let o=r=>t(r,...n);return a===void 0?o:Object.assign(o,{lazy:a,lazyArgs:n})}
|
|
4
|
+
|
|
5
|
+
function u(r,n,a){let o=r.length-n.length;if(o===0)return r(...n);if(o===1)return u$1(r,n,a);throw new Error("Wrong number of arguments")}
|
|
6
|
+
|
|
7
|
+
function o(a){return t=>!a(t)}
|
|
8
|
+
|
|
9
|
+
function e$1(n){return n==null}
|
|
10
|
+
|
|
11
|
+
function n(r){return Array.isArray(r)}
|
|
12
|
+
|
|
13
|
+
function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
|
|
14
|
+
|
|
15
|
+
function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
|
|
16
|
+
|
|
3
17
|
function nonNullable(value, message) {
|
|
4
18
|
if (typeof value === "undefined" || value == null) {
|
|
5
19
|
throw new Error(message ?? `Expected defined value, but received ${value}`);
|
|
@@ -16,24 +30,6 @@ function nonexhaustive(value) {
|
|
|
16
30
|
throw new Error(`NonExhaustive value: ${value}`);
|
|
17
31
|
}
|
|
18
32
|
|
|
19
|
-
function u$1(t,n,a){let o=r=>t(r,...n);return a===void 0?o:Object.assign(o,{lazy:a,lazyArgs:n})}
|
|
20
|
-
|
|
21
|
-
function u(r,n,a){let o=r.length-n.length;if(o===0)return r(...n);if(o===1)return u$1(r,n,a);throw new Error("Wrong number of arguments")}
|
|
22
|
-
|
|
23
|
-
function o(a){return t=>!a(t)}
|
|
24
|
-
|
|
25
|
-
function e$1(n){return n==null}
|
|
26
|
-
|
|
27
|
-
function n(r){return Array.isArray(r)}
|
|
28
|
-
|
|
29
|
-
function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
|
|
30
|
-
|
|
31
|
-
function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
|
|
32
|
-
|
|
33
|
-
const DefaultLineStyle = "dashed";
|
|
34
|
-
const DefaultArrowType = "normal";
|
|
35
|
-
const DefaultRelationshipColor = "gray";
|
|
36
|
-
|
|
37
33
|
function AsFqn(name, parent) {
|
|
38
34
|
return parent ? parent + "." + name : name;
|
|
39
35
|
}
|
|
@@ -181,6 +177,10 @@ function whereOperatorAsPredicate(operator) {
|
|
|
181
177
|
}
|
|
182
178
|
}
|
|
183
179
|
|
|
180
|
+
const DefaultLineStyle = "dashed";
|
|
181
|
+
const DefaultArrowType = "normal";
|
|
182
|
+
const DefaultRelationshipColor = "gray";
|
|
183
|
+
|
|
184
184
|
const ThemeColors = [
|
|
185
185
|
"amber",
|
|
186
186
|
"blue",
|
|
@@ -316,6 +316,7 @@ exports.isViewRuleAutoLayout = isViewRuleAutoLayout;
|
|
|
316
316
|
exports.isViewRulePredicate = isViewRulePredicate;
|
|
317
317
|
exports.isViewRuleStyle = isViewRuleStyle;
|
|
318
318
|
exports.isWildcard = isWildcard;
|
|
319
|
+
exports.n = n;
|
|
319
320
|
exports.nonNullable = nonNullable;
|
|
320
321
|
exports.nonexhaustive = nonexhaustive;
|
|
321
322
|
exports.u = u;
|
package/dist/types/index.cjs
CHANGED
package/dist/types/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aA as AndOperator, G as AsFqn, A as AutoLayoutDirection, br as BBox, a_ as BasicElementView, aZ as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aL as ColorLiteral, bo as ComputedDynamicView, q as ComputedEdge, bn as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, ba as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aI as DefaultArrowType, O as DefaultElementShape, aH as DefaultLineStyle, aJ as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, b8 as DynamicView, b5 as DynamicViewIncludeRule, b3 as DynamicViewParallelSteps, b7 as DynamicViewRule, b2 as DynamicViewStep, b4 as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bv as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aN as ElementThemeColorValues, aO as ElementThemeColors, b1 as ElementView, aa as ElementWhereExpr, at as EqualOperator, $ as ExpandedElementExpr, f as Expression, b0 as ExtendsElementView, F as Fqn, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aw as KindEqual, s as LayoutedLikeC4Model, aR as LikeC4Theme, L as LikeC4View, U as Link, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, ay as NotOperator, aC as OrOperator, ak as OutgoingExpr, aG as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aP as RelationshipThemeColorValues, aQ as RelationshipThemeColors, a$ as ScopedElementView, bg as StepEdgeId, bf as StepEdgeIdLiteral, m as Tag, au as TagEqual, S as TagSpec, aK as ThemeColor, T as ThemeColorValues, W as TypedElement, bm as ViewAutoLayout, bu as ViewChange, j as ViewID, bt as ViewManualLayout, aY as ViewRule, aW as ViewRuleAutoLayout, aS as ViewRulePredicate, V as ViewRuleStyle, bk as ViewWithHash, bl as ViewWithNotation, aE as WhereOperator, a2 as WildcardExpr, X as XYPoint, bi as extractStep, bs as getBBoxCenter, bj as getParallelStepsPrefix, aB as isAndOperator, aV as isAutoLayoutDirection, bp as isComputedDynamicView, bq as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bb as isDynamicView, b6 as isDynamicViewIncludeRule, b9 as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bc as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, bd as isExtendsElementView, ah as isInOut, aj as isIncoming, ax as isKindEqual, az as isNotOperator, aD as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, be as isScopedElementView, bh as isStepEdgeId, av as isTagEqual, aM as isThemeColor, aX as isViewRuleAutoLayout, aT as isViewRulePredicate, aU as isViewRuleStyle, a3 as isWildcard, aF as whereOperatorAsPredicate } from '../shared/core.C4jDMQ1i.cjs';
|
|
2
2
|
import 'type-fest';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aA as AndOperator, G as AsFqn, A as AutoLayoutDirection, br as BBox, a_ as BasicElementView, aZ as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aL as ColorLiteral, bo as ComputedDynamicView, q as ComputedEdge, bn as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, ba as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aI as DefaultArrowType, O as DefaultElementShape, aH as DefaultLineStyle, aJ as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, b8 as DynamicView, b5 as DynamicViewIncludeRule, b3 as DynamicViewParallelSteps, b7 as DynamicViewRule, b2 as DynamicViewStep, b4 as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bv as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aN as ElementThemeColorValues, aO as ElementThemeColors, b1 as ElementView, aa as ElementWhereExpr, at as EqualOperator, $ as ExpandedElementExpr, f as Expression, b0 as ExtendsElementView, F as Fqn, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aw as KindEqual, s as LayoutedLikeC4Model, aR as LikeC4Theme, L as LikeC4View, U as Link, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, ay as NotOperator, aC as OrOperator, ak as OutgoingExpr, aG as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aP as RelationshipThemeColorValues, aQ as RelationshipThemeColors, a$ as ScopedElementView, bg as StepEdgeId, bf as StepEdgeIdLiteral, m as Tag, au as TagEqual, S as TagSpec, aK as ThemeColor, T as ThemeColorValues, W as TypedElement, bm as ViewAutoLayout, bu as ViewChange, j as ViewID, bt as ViewManualLayout, aY as ViewRule, aW as ViewRuleAutoLayout, aS as ViewRulePredicate, V as ViewRuleStyle, bk as ViewWithHash, bl as ViewWithNotation, aE as WhereOperator, a2 as WildcardExpr, X as XYPoint, bi as extractStep, bs as getBBoxCenter, bj as getParallelStepsPrefix, aB as isAndOperator, aV as isAutoLayoutDirection, bp as isComputedDynamicView, bq as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bb as isDynamicView, b6 as isDynamicViewIncludeRule, b9 as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bc as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, bd as isExtendsElementView, ah as isInOut, aj as isIncoming, ax as isKindEqual, az as isNotOperator, aD as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, be as isScopedElementView, bh as isStepEdgeId, av as isTagEqual, aM as isThemeColor, aX as isViewRuleAutoLayout, aT as isViewRulePredicate, aU as isViewRuleStyle, a3 as isWildcard, aF as whereOperatorAsPredicate } from '../shared/core.C4jDMQ1i.mjs';
|
|
2
2
|
import 'type-fest';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aA as AndOperator, G as AsFqn, A as AutoLayoutDirection, br as BBox, a_ as BasicElementView, aZ as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aL as ColorLiteral, bo as ComputedDynamicView, q as ComputedEdge, bn as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, ba as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aI as DefaultArrowType, O as DefaultElementShape, aH as DefaultLineStyle, aJ as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, b8 as DynamicView, b5 as DynamicViewIncludeRule, b3 as DynamicViewParallelSteps, b7 as DynamicViewRule, b2 as DynamicViewStep, b4 as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bv as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aN as ElementThemeColorValues, aO as ElementThemeColors, b1 as ElementView, aa as ElementWhereExpr, at as EqualOperator, $ as ExpandedElementExpr, f as Expression, b0 as ExtendsElementView, F as Fqn, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aw as KindEqual, s as LayoutedLikeC4Model, aR as LikeC4Theme, L as LikeC4View, U as Link, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, ay as NotOperator, aC as OrOperator, ak as OutgoingExpr, aG as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aP as RelationshipThemeColorValues, aQ as RelationshipThemeColors, a$ as ScopedElementView, bg as StepEdgeId, bf as StepEdgeIdLiteral, m as Tag, au as TagEqual, S as TagSpec, aK as ThemeColor, T as ThemeColorValues, W as TypedElement, bm as ViewAutoLayout, bu as ViewChange, j as ViewID, bt as ViewManualLayout, aY as ViewRule, aW as ViewRuleAutoLayout, aS as ViewRulePredicate, V as ViewRuleStyle, bk as ViewWithHash, bl as ViewWithNotation, aE as WhereOperator, a2 as WildcardExpr, X as XYPoint, bi as extractStep, bs as getBBoxCenter, bj as getParallelStepsPrefix, aB as isAndOperator, aV as isAutoLayoutDirection, bp as isComputedDynamicView, bq as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bb as isDynamicView, b6 as isDynamicViewIncludeRule, b9 as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bc as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, bd as isExtendsElementView, ah as isInOut, aj as isIncoming, ax as isKindEqual, az as isNotOperator, aD as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, be as isScopedElementView, bh as isStepEdgeId, av as isTagEqual, aM as isThemeColor, aX as isViewRuleAutoLayout, aT as isViewRulePredicate, aU as isViewRuleStyle, a3 as isWildcard, aF as whereOperatorAsPredicate } from '../shared/core.C4jDMQ1i.js';
|
|
2
2
|
import 'type-fest';
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AsFqn, B as BorderStyles,
|
|
1
|
+
export { A as AsFqn, B as BorderStyles, M as DefaultArrowType, c as DefaultElementShape, L as DefaultLineStyle, f as DefaultRelationshipColor, D as DefaultThemeColor, E as ElementShapes, X as StepEdgeId, Z as extractStep, a1 as getBBoxCenter, _ as getParallelStepsPrefix, I as isAndOperator, Q as isAutoLayoutDirection, $ as isComputedDynamicView, a0 as isComputedElementView, l as isCustomElement, z as isCustomRelationExpr, U as isDynamicView, S as isDynamicViewIncludeRule, T as isDynamicViewParallelSteps, q as isElement, o as isElementKindExpr, i as isElementPredicateExpr, j as isElementRef, p as isElementTagExpr, V as isElementView, r as isElementWhere, k as isExpandedElementExpr, W as isExtendsElementView, t as isInOut, v as isIncoming, G as isKindEqual, H as isNotOperator, J as isOrOperator, w as isOutgoing, s as isRelation, x as isRelationExpression, C as isRelationPredicateExpr, y as isRelationWhere, b as isScopedElementView, Y as isStepEdgeId, F as isTagEqual, N as isThemeColor, R as isViewRuleAutoLayout, O as isViewRulePredicate, P as isViewRuleStyle, m as isWildcard, K as whereOperatorAsPredicate } from '../shared/core.BJDxVHFh.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://likec4.dev",
|
|
6
6
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -76,10 +76,11 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
+
"defu": "^6.1.4",
|
|
79
80
|
"type-fest": "4.26.1"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@likec4/tsconfig": "1.
|
|
83
|
+
"@likec4/tsconfig": "1.13.0",
|
|
83
84
|
"@mantine/colors-generator": "^7.13.2",
|
|
84
85
|
"@types/natural-compare-lite": "^1.4.2",
|
|
85
86
|
"chroma-js": "^3.1.1",
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
"natural-compare-lite": "^1.4.0",
|
|
88
89
|
"remeda": "^2.14.0",
|
|
89
90
|
"turbo": "^2.1.3",
|
|
90
|
-
"typescript": "^5.6.
|
|
91
|
+
"typescript": "^5.6.3",
|
|
91
92
|
"unbuild": "^3.0.0-rc.11",
|
|
92
93
|
"vitest": "^2.1.2"
|
|
93
94
|
},
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { AnyTypes, Invalid, Types, TypesNested } from './_types'
|
|
2
|
+
import type { ModelBuilder } from './Builder.model'
|
|
3
|
+
|
|
4
|
+
type ToNested<T, Id extends string> = T extends TypesNested<infer P, any, infer F, any, any, any, any> ? TypesNested<
|
|
5
|
+
`${P}.${Id}`,
|
|
6
|
+
T['ElementKind'],
|
|
7
|
+
`${P}.${Id}` | F,
|
|
8
|
+
T['ViewId'],
|
|
9
|
+
T['RelationshipKind'],
|
|
10
|
+
T['Tag'],
|
|
11
|
+
T['MetadataKey']
|
|
12
|
+
>
|
|
13
|
+
: T extends AnyTypes ? TypesNested<
|
|
14
|
+
Id,
|
|
15
|
+
T['ElementKind'],
|
|
16
|
+
Id | T['Fqn'],
|
|
17
|
+
T['ViewId'],
|
|
18
|
+
T['RelationshipKind'],
|
|
19
|
+
T['Tag'],
|
|
20
|
+
T['MetadataKey']
|
|
21
|
+
>
|
|
22
|
+
: never
|
|
23
|
+
|
|
24
|
+
type FromNested<T extends AnyTypes, N> = N extends TypesNested<any, any, infer F, any, any, any, any>
|
|
25
|
+
? T extends TypesNested<infer P, any, any, any, any, any, any> ? TypesNested<
|
|
26
|
+
P,
|
|
27
|
+
T['ElementKind'],
|
|
28
|
+
F,
|
|
29
|
+
T['ViewId'],
|
|
30
|
+
T['RelationshipKind'],
|
|
31
|
+
T['Tag'],
|
|
32
|
+
T['MetadataKey']
|
|
33
|
+
>
|
|
34
|
+
: T extends AnyTypes ? Types<
|
|
35
|
+
T['ElementKind'],
|
|
36
|
+
F,
|
|
37
|
+
T['ViewId'],
|
|
38
|
+
T['RelationshipKind'],
|
|
39
|
+
T['Tag'],
|
|
40
|
+
T['MetadataKey']
|
|
41
|
+
>
|
|
42
|
+
: never
|
|
43
|
+
: never
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Chainable builder to create element
|
|
47
|
+
*/
|
|
48
|
+
export interface AddElement<Id extends string> {
|
|
49
|
+
<T extends AnyTypes>(builder: ModelBuilder<T>): ModelBuilder<Types.AddFqn<T, Id>>
|
|
50
|
+
|
|
51
|
+
with<
|
|
52
|
+
T extends AnyTypes,
|
|
53
|
+
A extends AnyTypes
|
|
54
|
+
>(
|
|
55
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>
|
|
56
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, A>>
|
|
57
|
+
|
|
58
|
+
with<
|
|
59
|
+
T extends AnyTypes,
|
|
60
|
+
A extends AnyTypes,
|
|
61
|
+
B extends AnyTypes
|
|
62
|
+
>(
|
|
63
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
64
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>
|
|
65
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, B>>
|
|
66
|
+
|
|
67
|
+
with<
|
|
68
|
+
T extends AnyTypes,
|
|
69
|
+
A extends AnyTypes,
|
|
70
|
+
B extends AnyTypes,
|
|
71
|
+
C extends AnyTypes
|
|
72
|
+
>(
|
|
73
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
74
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
75
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>
|
|
76
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, C>>
|
|
77
|
+
|
|
78
|
+
with<
|
|
79
|
+
T extends AnyTypes,
|
|
80
|
+
A extends AnyTypes,
|
|
81
|
+
B extends AnyTypes,
|
|
82
|
+
C extends AnyTypes,
|
|
83
|
+
D extends AnyTypes
|
|
84
|
+
>(
|
|
85
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
86
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
87
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>,
|
|
88
|
+
op4: (input: ModelBuilder<C>) => ModelBuilder<D>
|
|
89
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, D>>
|
|
90
|
+
|
|
91
|
+
with<
|
|
92
|
+
T extends AnyTypes,
|
|
93
|
+
A extends AnyTypes,
|
|
94
|
+
B extends AnyTypes,
|
|
95
|
+
C extends AnyTypes,
|
|
96
|
+
D extends AnyTypes,
|
|
97
|
+
E extends AnyTypes
|
|
98
|
+
>(
|
|
99
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
100
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
101
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>,
|
|
102
|
+
op4: (input: ModelBuilder<C>) => ModelBuilder<D>,
|
|
103
|
+
op5: (input: ModelBuilder<D>) => ModelBuilder<E>
|
|
104
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, E>>
|
|
105
|
+
|
|
106
|
+
with<
|
|
107
|
+
T extends AnyTypes,
|
|
108
|
+
A extends AnyTypes,
|
|
109
|
+
B extends AnyTypes,
|
|
110
|
+
C extends AnyTypes,
|
|
111
|
+
D extends AnyTypes,
|
|
112
|
+
E extends AnyTypes,
|
|
113
|
+
F extends AnyTypes
|
|
114
|
+
>(
|
|
115
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
116
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
117
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>,
|
|
118
|
+
op4: (input: ModelBuilder<C>) => ModelBuilder<D>,
|
|
119
|
+
op5: (input: ModelBuilder<D>) => ModelBuilder<E>,
|
|
120
|
+
op6: (input: ModelBuilder<E>) => ModelBuilder<F>
|
|
121
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, F>>
|
|
122
|
+
|
|
123
|
+
with<
|
|
124
|
+
T extends AnyTypes,
|
|
125
|
+
A extends AnyTypes,
|
|
126
|
+
B extends AnyTypes,
|
|
127
|
+
C extends AnyTypes,
|
|
128
|
+
D extends AnyTypes,
|
|
129
|
+
E extends AnyTypes,
|
|
130
|
+
F extends AnyTypes,
|
|
131
|
+
G extends AnyTypes
|
|
132
|
+
>(
|
|
133
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
134
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
135
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>,
|
|
136
|
+
op4: (input: ModelBuilder<C>) => ModelBuilder<D>,
|
|
137
|
+
op5: (input: ModelBuilder<D>) => ModelBuilder<E>,
|
|
138
|
+
op6: (input: ModelBuilder<E>) => ModelBuilder<F>,
|
|
139
|
+
op7: (input: ModelBuilder<F>) => ModelBuilder<G>
|
|
140
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, G>>
|
|
141
|
+
|
|
142
|
+
with<
|
|
143
|
+
T extends AnyTypes,
|
|
144
|
+
A extends AnyTypes,
|
|
145
|
+
B extends AnyTypes,
|
|
146
|
+
C extends AnyTypes,
|
|
147
|
+
D extends AnyTypes,
|
|
148
|
+
E extends AnyTypes,
|
|
149
|
+
F extends AnyTypes,
|
|
150
|
+
G extends AnyTypes,
|
|
151
|
+
H extends AnyTypes
|
|
152
|
+
>(
|
|
153
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
154
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
155
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>,
|
|
156
|
+
op4: (input: ModelBuilder<C>) => ModelBuilder<D>,
|
|
157
|
+
op5: (input: ModelBuilder<D>) => ModelBuilder<E>,
|
|
158
|
+
op6: (input: ModelBuilder<E>) => ModelBuilder<F>,
|
|
159
|
+
op7: (input: ModelBuilder<F>) => ModelBuilder<G>,
|
|
160
|
+
op8: (input: ModelBuilder<G>) => ModelBuilder<H>
|
|
161
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, H>>
|
|
162
|
+
|
|
163
|
+
with<
|
|
164
|
+
T extends AnyTypes,
|
|
165
|
+
A extends AnyTypes,
|
|
166
|
+
B extends AnyTypes,
|
|
167
|
+
C extends AnyTypes,
|
|
168
|
+
D extends AnyTypes,
|
|
169
|
+
E extends AnyTypes,
|
|
170
|
+
F extends AnyTypes,
|
|
171
|
+
G extends AnyTypes,
|
|
172
|
+
H extends AnyTypes,
|
|
173
|
+
I extends AnyTypes
|
|
174
|
+
>(
|
|
175
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
176
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
177
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>,
|
|
178
|
+
op4: (input: ModelBuilder<C>) => ModelBuilder<D>,
|
|
179
|
+
op5: (input: ModelBuilder<D>) => ModelBuilder<E>,
|
|
180
|
+
op6: (input: ModelBuilder<E>) => ModelBuilder<F>,
|
|
181
|
+
op7: (input: ModelBuilder<F>) => ModelBuilder<G>,
|
|
182
|
+
op8: (input: ModelBuilder<G>) => ModelBuilder<H>,
|
|
183
|
+
op9: (input: ModelBuilder<H>) => ModelBuilder<I>
|
|
184
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, I>>
|
|
185
|
+
|
|
186
|
+
with<
|
|
187
|
+
T extends AnyTypes,
|
|
188
|
+
A extends AnyTypes,
|
|
189
|
+
B extends AnyTypes,
|
|
190
|
+
C extends AnyTypes,
|
|
191
|
+
D extends AnyTypes,
|
|
192
|
+
E extends AnyTypes,
|
|
193
|
+
F extends AnyTypes,
|
|
194
|
+
G extends AnyTypes,
|
|
195
|
+
H extends AnyTypes,
|
|
196
|
+
I extends AnyTypes,
|
|
197
|
+
J extends AnyTypes
|
|
198
|
+
>(
|
|
199
|
+
op1: (input: ModelBuilder<ToNested<T, Id>>) => ModelBuilder<A>,
|
|
200
|
+
op2: (input: ModelBuilder<A>) => ModelBuilder<B>,
|
|
201
|
+
op3: (input: ModelBuilder<B>) => ModelBuilder<C>,
|
|
202
|
+
op4: (input: ModelBuilder<C>) => ModelBuilder<D>,
|
|
203
|
+
op5: (input: ModelBuilder<D>) => ModelBuilder<E>,
|
|
204
|
+
op6: (input: ModelBuilder<E>) => ModelBuilder<F>,
|
|
205
|
+
op7: (input: ModelBuilder<F>) => ModelBuilder<G>,
|
|
206
|
+
op8: (input: ModelBuilder<G>) => ModelBuilder<H>,
|
|
207
|
+
op9: (input: ModelBuilder<H>) => ModelBuilder<I>,
|
|
208
|
+
op10: (input: ModelBuilder<I>) => ModelBuilder<J>
|
|
209
|
+
): (builder: ModelBuilder<T>) => ModelBuilder<FromNested<T, J>>
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
type AddElementHelper<T = unknown> = <const Id extends string>(
|
|
213
|
+
id: Id,
|
|
214
|
+
titleOrProps?: string | T
|
|
215
|
+
) => AddElement<Id>
|
|
216
|
+
|
|
217
|
+
export type AddElementHelpers<T extends AnyTypes> = T extends Types<infer Kinds extends string, any, any, any, any, any>
|
|
218
|
+
? {
|
|
219
|
+
[Kind in Kinds]: AddElementHelper<T['NewElementProps']>
|
|
220
|
+
}
|
|
221
|
+
: Invalid<'No Element Kinds'>
|