@likec4/core 1.48.0 → 1.49.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.
Files changed (134) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +1012 -0
  2. package/dist/_chunks/Builder.view-element.mjs +2 -3284
  3. package/dist/_chunks/LikeC4Model.d.mts +21 -25
  4. package/dist/_chunks/RichText.mjs +1 -148
  5. package/dist/_chunks/_types.d.mts +1 -5
  6. package/dist/_chunks/_types2.d.mts +2 -4
  7. package/dist/_chunks/assignTagColors.mjs +1 -24
  8. package/dist/_chunks/calcDriftsFromSnapshot.mjs +1 -379
  9. package/dist/_chunks/guards.d.mts +2026 -0
  10. package/dist/_chunks/guards.mjs +4 -0
  11. package/dist/_chunks/index.d.mts +255 -136
  12. package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
  13. package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
  14. package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
  15. package/dist/_chunks/libs/bail.mjs +1 -14
  16. package/dist/_chunks/libs/ccount.mjs +1 -25
  17. package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
  18. package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
  19. package/dist/_chunks/libs/character-entities.mjs +2 -2136
  20. package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
  21. package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
  22. package/dist/_chunks/libs/defu.mjs +1 -42
  23. package/dist/_chunks/libs/devlop.mjs +1 -5
  24. package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
  25. package/dist/_chunks/libs/extend.mjs +1 -77
  26. package/dist/_chunks/libs/graphology-dag.mjs +1 -703
  27. package/dist/_chunks/libs/graphology.mjs +1 -4565
  28. package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
  29. package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
  30. package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
  31. package/dist/_chunks/libs/longest-streak.mjs +1 -30
  32. package/dist/_chunks/libs/markdown-table.mjs +2 -290
  33. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
  34. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
  35. package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
  36. package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
  37. package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
  38. package/dist/_chunks/libs/mnemonist.d.mts +1 -91
  39. package/dist/_chunks/libs/mnemonist.mjs +1 -1978
  40. package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
  41. package/dist/_chunks/libs/ohash.mjs +1 -0
  42. package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
  43. package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
  44. package/dist/_chunks/libs/remark-gfm.mjs +1 -36
  45. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
  46. package/dist/_chunks/libs/remark-parse.mjs +1 -39
  47. package/dist/_chunks/libs/remark-rehype.mjs +1 -171
  48. package/dist/_chunks/libs/remeda.mjs +1 -702
  49. package/dist/_chunks/libs/trough.mjs +1 -158
  50. package/dist/_chunks/libs/unified.mjs +1 -2212
  51. package/dist/_chunks/rolldown-runtime.mjs +1 -42
  52. package/dist/_chunks/{index3.d.mts → theme.d.mts} +15 -13
  53. package/dist/_chunks/{index7.d.mts → to-text.d.mts} +165 -29
  54. package/dist/_chunks/to-text.mjs +1 -0
  55. package/dist/_chunks/vector.d.mts +198 -0
  56. package/dist/_chunks/vector.mjs +1 -0
  57. package/dist/builder/index.d.mts +2 -8
  58. package/dist/builder/index.mjs +1 -662
  59. package/dist/compute-view/index.d.mts +86 -15
  60. package/dist/compute-view/index.mjs +2 -262
  61. package/dist/geometry/index.d.mts +2 -2
  62. package/dist/geometry/index.mjs +1 -3
  63. package/dist/index.d.mts +9 -13
  64. package/dist/index.mjs +1 -27
  65. package/dist/model/index.d.mts +4 -14
  66. package/dist/model/index.mjs +1 -11
  67. package/dist/styles/index.d.mts +2 -8
  68. package/dist/styles/index.mjs +1 -30
  69. package/dist/types/index.d.mts +3 -9
  70. package/dist/types/index.mjs +1 -15
  71. package/dist/utils/graphology/index.d.mts +1 -1
  72. package/dist/utils/graphology/index.mjs +1 -3
  73. package/dist/utils/index.d.mts +4 -11
  74. package/dist/utils/index.mjs +1 -17
  75. package/package.json +13 -12
  76. package/dist/_chunks/LikeC4Styles.mjs +0 -691
  77. package/dist/_chunks/RichText.d.mts +0 -84
  78. package/dist/_chunks/_aux.d.mts +0 -289
  79. package/dist/_chunks/_aux.mjs +0 -18
  80. package/dist/_chunks/connection.mjs +0 -0
  81. package/dist/_chunks/const.d.mts +0 -43
  82. package/dist/_chunks/const.mjs +0 -33
  83. package/dist/_chunks/expression-model.d.mts +0 -192
  84. package/dist/_chunks/expression-model.mjs +0 -103
  85. package/dist/_chunks/expression.d.mts +0 -347
  86. package/dist/_chunks/expression.mjs +0 -107
  87. package/dist/_chunks/find.d.mts +0 -82
  88. package/dist/_chunks/find.mjs +0 -646
  89. package/dist/_chunks/find2.d.mts +0 -78
  90. package/dist/_chunks/find2.mjs +0 -287
  91. package/dist/_chunks/fqnRef.d.mts +0 -58
  92. package/dist/_chunks/fqnRef.mjs +0 -41
  93. package/dist/_chunks/geometry.mjs +0 -335
  94. package/dist/_chunks/index2.d.mts +0 -937
  95. package/dist/_chunks/index4.d.mts +0 -62
  96. package/dist/_chunks/index5.d.mts +0 -42
  97. package/dist/_chunks/index6.d.mts +0 -43
  98. package/dist/_chunks/index8.d.mts +0 -144
  99. package/dist/_chunks/invariant.mjs +0 -18
  100. package/dist/_chunks/iterable.mjs +0 -146
  101. package/dist/_chunks/libs/graphology-types.d.mts +0 -601
  102. package/dist/_chunks/libs/graphology.d.mts +0 -6
  103. package/dist/_chunks/mnemonist.d.mts +0 -1
  104. package/dist/_chunks/mnemonist.mjs +0 -0
  105. package/dist/_chunks/model.mjs +0 -1898
  106. package/dist/_chunks/model2.mjs +0 -0
  107. package/dist/_chunks/relationships-view.mjs +0 -132
  108. package/dist/_chunks/scalar.d.mts +0 -109
  109. package/dist/_chunks/scalar.mjs +0 -84
  110. package/dist/_chunks/utils.mjs +0 -483
  111. package/dist/compute-view/relationships-view/index.d.mts +0 -16
  112. package/dist/compute-view/relationships-view/index.mjs +0 -7
  113. package/dist/model/connection/deployment/index.d.mts +0 -12
  114. package/dist/model/connection/deployment/index.mjs +0 -9
  115. package/dist/model/connection/index.d.mts +0 -14
  116. package/dist/model/connection/index.mjs +0 -10
  117. package/dist/model/connection/model/index.d.mts +0 -12
  118. package/dist/model/connection/model/index.mjs +0 -8
  119. package/dist/types/RichText.d.mts +0 -3
  120. package/dist/types/RichText.mjs +0 -7
  121. package/dist/types/_aux.d.mts +0 -3
  122. package/dist/types/_aux.mjs +0 -3
  123. package/dist/types/expression-model.d.mts +0 -6
  124. package/dist/types/expression-model.mjs +0 -7
  125. package/dist/types/expression.d.mts +0 -5
  126. package/dist/types/expression.mjs +0 -7
  127. package/dist/types/fqnRef.d.mts +0 -4
  128. package/dist/types/fqnRef.mjs +0 -7
  129. package/dist/types/scalar.d.mts +0 -2
  130. package/dist/types/scalar.mjs +0 -7
  131. package/dist/utils/iterable/index.d.mts +0 -9
  132. package/dist/utils/iterable/index.mjs +0 -3
  133. package/dist/utils/mnemonist.d.mts +0 -2
  134. package/dist/utils/mnemonist.mjs +0 -12
@@ -1,42 +1 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
- var __exportAll = (all, symbols) => {
10
- let target = {};
11
- for (var name in all) {
12
- __defProp(target, name, {
13
- get: all[name],
14
- enumerable: true
15
- });
16
- }
17
- if (symbols) {
18
- __defProp(target, Symbol.toStringTag, { value: "Module" });
19
- }
20
- return target;
21
- };
22
- var __copyProps = (to, from, except, desc) => {
23
- if (from && typeof from === "object" || typeof from === "function") {
24
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
25
- key = keys[i];
26
- if (!__hasOwnProp.call(to, key) && key !== except) {
27
- __defProp(to, key, {
28
- get: ((k) => from[k]).bind(null, key),
29
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
- });
31
- }
32
- }
33
- }
34
- return to;
35
- };
36
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
37
- value: mod,
38
- enumerable: true
39
- }) : target, mod));
40
-
41
- //#endregion
42
- export { __exportAll as n, __toESM as r, __commonJSMin as t };
1
+ var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),__exportAll=(e,n)=>{let r={};for(var i in e)__defProp(r,i,{get:e[i],enumerable:!0});return n||__defProp(r,Symbol.toStringTag,{value:`Module`}),r},__copyProps=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=__getOwnPropNames(i),l=0,u=c.length,d;l<u;l++)d=c[l],!__hasOwnProp.call(e,d)&&d!==o&&__defProp(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=__getOwnPropDesc(i,d))||s.enumerable});return e},__toESM=(n,r,a)=>(a=n==null?{}:__create(__getProtoOf(n)),__copyProps(r||!n||!n.__esModule?__defProp(a,`default`,{value:n,enumerable:!0}):a,n));export{__exportAll as n,__toESM as r,__commonJSMin as t};
@@ -1,9 +1,11 @@
1
- import { Ct as NTuple } from "./_aux.mjs";
2
- import { S as Tag } from "./scalar.mjs";
3
- import { B as ShapeSize, C as BorderStyle, F as LikeC4Theme, G as ThemeColorValues, H as SpacingSize, M as IconSize, N as LikeC4StyleDefaults, O as ElementColorValues, P as LikeC4StylesConfig, R as RelationshipColorValues, T as ColorLiteral, U as TextSize, W as ThemeColor, j as IconPosition, w as Color } from "./expression.mjs";
4
- import { Z as ComputedNodeStyle, ct as TagSpecification, nt as LikeC4ProjectStylesConfig } from "./index2.mjs";
1
+ import { Er as DefaultTagColors, Fi as Tag, Sr as ThemeColorValues, _r as ShapeSize, _t as TagSpecification, ar as ElementColorValues, br as TextSize, cr as IconPosition, dr as LikeC4StylesConfig, dt as LikeC4ProjectStylesConfig, er as BorderStyle, fr as LikeC4Theme, ft as LikeC4ProjectStylesCustomStylesheets, hr as RelationshipColorValues, ir as CustomColorDefinitions, lr as IconSize, nr as ColorLiteral, ot as ComputedNodeStyle, ra as NTuple, tr as Color, ur as LikeC4StyleDefaults, xr as ThemeColor, yr as SpacingSize } from "./guards.mjs";
5
2
  import { LiteralUnion } from "type-fest";
6
3
 
4
+ //#region src/styles/assignTagColors.d.ts
5
+ declare function assignTagColors(tags: {
6
+ [kind: string]: Partial<TagSpecification>;
7
+ }): Record<Tag, TagSpecification>;
8
+ //#endregion
7
9
  //#region src/styles/LikeC4Styles.d.ts
8
10
  /**
9
11
  * Styles of a LikeC4 project
@@ -17,10 +19,11 @@ import { LiteralUnion } from "type-fest";
17
19
  */
18
20
  declare class LikeC4Styles {
19
21
  protected config: LikeC4StylesConfig;
22
+ protected customCss?: LikeC4ProjectStylesCustomStylesheets | undefined;
20
23
  readonly theme: LikeC4Theme;
21
24
  readonly defaults: LikeC4StyleDefaults;
22
25
  static readonly DEFAULT: LikeC4Styles;
23
- static from(...configs: Array<LikeC4ProjectStylesConfig | undefined | null>): LikeC4Styles;
26
+ static from(stylesConfig: LikeC4ProjectStylesConfig | undefined, customColors?: CustomColorDefinitions | undefined): LikeC4Styles;
24
27
  private constructor();
25
28
  /**
26
29
  * Default element colors
@@ -105,10 +108,10 @@ declare class LikeC4Styles {
105
108
  readonly size?: ShapeSize;
106
109
  readonly padding?: SpacingSize;
107
110
  readonly textSize?: TextSize;
108
- }, "iconSize" | "size" | "padding" | "textSize"> & Required<{
109
- readonly iconSize?: IconSize;
111
+ }, "size" | "padding" | "iconSize" | "textSize"> & Required<{
110
112
  readonly size?: ShapeSize;
111
113
  readonly padding?: SpacingSize;
114
+ readonly iconSize?: IconSize;
112
115
  readonly textSize?: TextSize;
113
116
  }>;
114
117
  values: {
@@ -127,13 +130,12 @@ declare class LikeC4Styles {
127
130
  */
128
131
  computeFrom(color: string): ThemeColorValues;
129
132
  equals(other: LikeC4Styles): boolean;
133
+ /**
134
+ * Get color values for a tag (including default tag colors)
135
+ */
136
+ tagColor(tag: typeof DefaultTagColors[number] | ThemeColor | ColorLiteral): ThemeColorValues['elements'];
130
137
  }
131
138
  //#endregion
132
- //#region src/styles/assignTagColors.d.ts
133
- declare function assignTagColors(tags: {
134
- [kind: string]: Partial<TagSpecification>;
135
- }): Record<Tag, TagSpecification>;
136
- //#endregion
137
139
  //#region src/styles/compute-color-values.d.ts
138
140
  declare function computeColorValues(color: ColorLiteral): ThemeColorValues;
139
141
  //#endregion
@@ -143,4 +145,4 @@ declare const styleDefaults: LikeC4StyleDefaults;
143
145
  //#region src/styles/theme.d.ts
144
146
  declare const defaultTheme: LikeC4Theme;
145
147
  //#endregion
146
- export { LikeC4Styles as a, assignTagColors as i, styleDefaults as n, computeColorValues as r, defaultTheme as t };
148
+ export { assignTagColors as a, LikeC4Styles as i, styleDefaults as n, computeColorValues as r, defaultTheme as t };
@@ -1,6 +1,4 @@
1
- import { Dt as ReorderedArray, wt as NonEmptyArray, yt as IterableContainer } from "./_aux.mjs";
2
- import { s as Fqn } from "./scalar.mjs";
3
- import { SetNonNullable, SetRequired } from "type-fest";
1
+ import { $i as IterableContainer, bi as Fqn, ea as IteratorLike, ia as NonEmptyArray, sa as ReorderedArray } from "./guards.mjs";
4
2
 
5
3
  //#region src/utils/invariant.d.ts
6
4
  declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
@@ -17,6 +15,8 @@ declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray
17
15
  //#endregion
18
16
  //#region src/utils/compare-natural.d.ts
19
17
  declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
18
+ declare function sortNatural(): <T extends IterableContainer<string>>(elements: T) => ReorderedArray<T>;
19
+ declare function sortNatural<T extends IterableContainer<string>>(elements: T): ReorderedArray<T>;
20
20
  /**
21
21
  * Compares two strings lexicographically first, then hierarchically based on their depth.\
22
22
  * From parent nodes to leaves
@@ -84,6 +84,11 @@ declare function commonAncestor<E extends string>(first: E, second: E): E | null
84
84
  /**
85
85
  * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
86
86
  * going up from parent to the root
87
+ * @example
88
+ * ```ts
89
+ * ancestorsFqn('a.b.c.d')
90
+ * // ['a.b.c', 'a.b', 'a']
91
+ * ```
87
92
  */
88
93
  declare function ancestorsFqn<Id extends string>(fqn: Id): Id[];
89
94
  /**
@@ -130,10 +135,25 @@ declare function sortByFqnHierarchically<T extends {
130
135
  }, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
131
136
  /**
132
137
  * Keeps initial order of the elements, but ensures that parents are before children
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const items = [
142
+ * {id: 'a.c'},
143
+ * {id: 'a'},
144
+ * {id: 'a.b.c'},
145
+ * {id: 'a.b'},
146
+ * ];
147
+ * sortParentsFirst(items);
148
+ * // Result: [
149
+ * // { id: "a" },
150
+ * // { id: "a.c" }, // because of initial order
151
+ * // { id: "a.b" },
152
+ * // { id: "a.b.c" },
153
+ * // ]
154
+ * ```
133
155
  */
134
- declare function sortParentsFirst<T extends {
135
- id: string;
136
- }, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
156
+ declare function sortParentsFirst<T extends WithId<string>, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
137
157
  /**
138
158
  * Sorts an array of objects naturally by their fully qualified name (FQN) identifier.
139
159
  *
@@ -157,30 +177,146 @@ declare function sortNaturalByFqn<A extends IterableContainer<WithId>>(array: A,
157
177
  declare function getOrCreate<K, V>(map: Map<K, V>, key: K, create: (key: K) => V): V;
158
178
  declare function getOrCreate<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, create: (key: K) => V): V;
159
179
  //#endregion
160
- //#region src/utils/guards.d.ts
161
- declare function isString(value: unknown): value is string;
162
- declare function isNonEmptyArray<A>(arr: ArrayLike<A> | undefined): arr is NonEmptyArray<A>;
163
- declare function hasProp<T extends object, P extends keyof T & string>(value: T, path: P): value is SetRequired<SetNonNullable<T, P>, P>;
164
- type Guard<N = unknown> = (n: unknown) => n is N;
165
- type Guarded<G> = G extends Guard<infer N> ? N : never;
166
- /**
167
- * Creates a type guard that checks if a value matches any of the provided predicates.
168
- *
169
- * @template Predicates - A non-empty array of guard functions
170
- * @param predicates - The guard functions to test against
171
- * @returns A type guard function that returns true if the value matches any of the predicates
172
- *
180
+ //#region src/utils/iterable/_types.d.ts
181
+ declare function isIterable<T, I extends Iterable<T>>(something: I | unknown): something is Iterable<T>;
182
+ //#endregion
183
+ //#region src/utils/iterable/filter.d.ts
184
+ /**
185
+ * Filters an iterable based on a predicate.
186
+ * Composabel first version of `ifilter`.
187
+ * @signature
188
+ * ifilter(predicate)(data)
189
+ */
190
+ declare function ifilter<T, S extends T>(predicate: (v: T) => v is S): (iterable: Iterable<T>) => IteratorLike<S>;
191
+ declare function ifilter<T>(predicate: (v: T) => boolean): (iterable: Iterable<T>) => IteratorLike<T>;
192
+ /**
193
+ * Filters an iterable based on a predicate.
194
+ * Data first version of `ifilter`.
195
+ * @signature
196
+ * ifilter(data, predicate)
173
197
  * @example
174
- * ```typescript
175
- * const isStringOrNumber = isAnyOf(isString, isNumber);
176
- *
177
- * if (isStringOrNumber(value)) {
178
- * // value is now typed as string | number
179
- * console.log(value);
180
- * }
181
- * ```
198
+ * ifilter(new Set([1, 2, 3]), x => x % 2 === 1) // => Iterable<[1, 3]>
199
+ */
200
+ declare function ifilter<T, S extends T>(iterable: Iterable<T>, predicate: (v: T) => v is S): IteratorLike<S>;
201
+ declare function ifilter<T>(iterable: Iterable<T>, predicate: (v: T) => boolean): IteratorLike<T>;
202
+ //#endregion
203
+ //#region src/utils/iterable/find.d.ts
204
+ /**
205
+ * Finds the first element in the iterable that satisfies the predicate.
206
+ * Composable first version of `find`.
207
+ * @signature
208
+ * ifind(predicate)(data)
209
+ */
210
+ declare function ifind<T, S extends T>(predicate: (item: T) => item is S): (iterable: Iterable<T>) => S | undefined;
211
+ declare function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined;
212
+ /**
213
+ * Finds the first element in the iterable that satisfies the predicate.
214
+ * Data first version of `find`.
215
+ * @signature
216
+ * ifind(data, predicate)
217
+ */
218
+ declare function ifind<T, S extends T>(iterable: Iterable<T>, predicate: (item: T) => item is S): S | undefined;
219
+ declare function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
220
+ //#endregion
221
+ //#region src/utils/iterable/first.d.ts
222
+ /**
223
+ * Takes the first N elements from an iterable.
224
+ * Composable first version of `ifirst`.
225
+ * @signature
226
+ * ifirst(count)(data)
227
+ */
228
+ declare function ifirst<T>(count: number): (iterable: Iterable<T>) => IteratorLike<T>;
229
+ /**
230
+ * Takes the first N elements from an iterable.
231
+ * Data first version of `ifirst`.
232
+ * @signature
233
+ * ifirst(data, count)
234
+ * @example
235
+ * ifirst([1, 2, 3, 4, 5], 3) // => Iterable<[1, 2, 3]>
236
+ */
237
+ declare function ifirst<T>(iterable: Iterable<T>, count: number): IteratorLike<T>;
238
+ //#endregion
239
+ //#region src/utils/iterable/flat.d.ts
240
+ declare function iflat(): <T>(iterable: Iterable<IteratorLike<T>>) => IteratorLike<T>;
241
+ declare function iflat<T>(iterable: Iterable<IteratorLike<T>>): IteratorLike<T>;
242
+ //#endregion
243
+ //#region src/utils/iterable/flatMap.d.ts
244
+ type FlatMapFunction<T, S> = (item: T) => Iterable<S>;
245
+ /**
246
+ * Maps an iterable using a mapper function and flattens the result by one level.
247
+ * Composable first version of `iflatMap`.
248
+ * @signature
249
+ * iflatMap(mapper)(data)
250
+ */
251
+ declare function iflatMap<T, S>(mapper: FlatMapFunction<T, S>): (iterable: Iterable<T>) => IteratorLike<S>;
252
+ /**
253
+ * Maps an iterable using a mapper function and flattens the result by one level.
254
+ * Data first version of `iflatMap`.
255
+ * @signature
256
+ * iflatMap(data, mapper)
257
+ */
258
+ declare function iflatMap<T, S>(iterable: Iterable<T>, mapper: FlatMapFunction<T, S>): IteratorLike<S>;
259
+ //#endregion
260
+ //#region src/utils/iterable/head.d.ts
261
+ declare function ihead<T>(): (iterable: Iterable<T>) => T | undefined;
262
+ /**
263
+ * Finds the first element in the iterable that satisfies the predicate.
264
+ * Data first version of `find`.
265
+ * @signature
266
+ * ifind(data, predicate)
267
+ */
268
+ declare function ihead<T>(iterable: Iterable<T>): T | undefined;
269
+ //#endregion
270
+ //#region src/utils/iterable/map.d.ts
271
+ type MapFunction<T, S> = (item: T) => S;
272
+ /**
273
+ * Maps an iterable using a mapper function.
274
+ * Composable first version of `imap`.
275
+ * @signature
276
+ * imap(mapper)(data)
277
+ */
278
+ declare function imap<T, S>(mapper: MapFunction<T, S>): (iterable: Iterable<T>) => IteratorLike<S>;
279
+ /**
280
+ * Maps an iterable using a mapper function.
281
+ * Data first version of `imap`.
282
+ * @signature
283
+ * imap(data, mapper)
284
+ */
285
+ declare function imap<T, S>(iterable: Iterable<T>, mapper: MapFunction<T, S>): IteratorLike<S>;
286
+ //#endregion
287
+ //#region src/utils/iterable/reduce.d.ts
288
+ declare function ireduce<T, R>(reducer: (acc: R, item: T) => R, initialValue: R): (iterable: Iterable<T>) => R;
289
+ declare function ireduce<T, R>(iterable: Iterable<T>, reducer: (acc: R, item: T) => R, initialValue: R): R;
290
+ //#endregion
291
+ //#region src/utils/iterable/some.d.ts
292
+ /**
293
+ * Checks if at least one element in the iterable satisfies the predicate.
294
+ * Composable first version of `some`.
295
+ * @signature
296
+ * isome(predicate)(data)
297
+ */
298
+ declare function isome<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => boolean;
299
+ /**
300
+ * Checks if at least one element in the iterable satisfies the predicate.
301
+ * Data first version of `some`.
302
+ * @signature
303
+ * isome(data, predicate)
304
+ */
305
+ declare function isome<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): boolean;
306
+ //#endregion
307
+ //#region src/utils/iterable/to.d.ts
308
+ declare function toArray(): <T>(iterable: Iterable<T> | ArrayLike<T>) => T[];
309
+ declare function toArray<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
310
+ declare function toSet(): <T>(iterable: Iterable<T>) => Set<T>;
311
+ declare function toSet<T>(iterable: Iterable<T>): Set<T>;
312
+ //#endregion
313
+ //#region src/utils/iterable/unique.d.ts
314
+ /**
315
+ * Returns an iterable that yields only unique values.
316
+ * It uses a Set to keep track of the values.
182
317
  */
183
- declare function isAnyOf<const Predicates extends NonEmptyArray<Guard>>(...predicates: Predicates): (value: unknown) => value is Guarded<Predicates[number]>;
318
+ declare function iunique(): <T>(iterable: Iterable<T>) => IteratorLike<T>;
319
+ declare function iunique<T>(iterable: Iterable<T>): IteratorLike<T>;
184
320
  //#endregion
185
321
  //#region src/utils/memoize-prop.d.ts
186
322
  /**
@@ -265,4 +401,4 @@ declare function markdownToHtml(markdown: string): string;
265
401
  */
266
402
  declare function markdownToText(markdown: string): string;
267
403
  //#endregion
268
- export { parentFqn as A, compareFqnHierarchically as C, isDescendantOf as D, isAncestor as E, compareNaturalHierarchically as F, commonHead as I, invariant as L, sortNaturalByFqn as M, sortParentsFirst as N, isSameHierarchy as O, compareNatural as P, nonNullable as R, compareByFqnHierarchically as S, hierarchyLevel as T, isNonEmptyArray as _, difference as a, ancestorsFqn as b, symmetricDifference as c, delay as d, onNextTick as f, isAnyOf as g, hasProp as h, objectHash as i, sortByFqnHierarchically as j, nameFromFqn as k, union as l, memoizeProp as m, markdownToHtml as n, equals as o, promiseNextTick as p, stringHash as r, intersection as s, markdownToText as t, compareRelations as u, isString as v, hierarchyDistance as w, commonAncestor as x, getOrCreate as y, nonexhaustive as z };
404
+ export { commonAncestor as A, sortByFqnHierarchically as B, iflat as C, isIterable as D, ifilter as E, isAncestor as F, sortNatural as G, sortParentsFirst as H, isDescendantOf as I, nonNullable as J, commonHead as K, isSameHierarchy as L, compareFqnHierarchically as M, hierarchyDistance as N, getOrCreate as O, hierarchyLevel as P, nameFromFqn as R, iflatMap as S, ifind as T, compareNatural as U, sortNaturalByFqn as V, compareNaturalHierarchically as W, nonexhaustive as Y, toSet as _, difference as a, imap as b, symmetricDifference as c, delay as d, onNextTick as f, toArray as g, iunique as h, objectHash as i, compareByFqnHierarchically as j, ancestorsFqn as k, union as l, memoizeProp as m, markdownToHtml as n, equals as o, promiseNextTick as p, invariant as q, stringHash as r, intersection as s, markdownToText as t, compareRelations as u, isome as v, ifirst as w, ihead as x, ireduce as y, parentFqn as z };
@@ -0,0 +1 @@
1
+ import{r as __toESM}from"./rolldown-runtime.mjs";import{t as defu}from"./libs/defu.mjs";import{F as e$1,P as e$4,Q as t$5,R as e$2,T as t$3,a as t$2,et as t,f as e$3,k as e,l as t$4,t as t$1}from"./libs/remeda.mjs";import{s as import_set}from"./libs/mnemonist.mjs";import{t as require_natural_compare_lite}from"./libs/natural-compare-lite.mjs";import{t as hash}from"./libs/ohash.mjs";import{n as defaultSchema}from"./libs/hast-util-sanitize.mjs";import{t as rehypeSanitize}from"./libs/rehype-sanitize.mjs";import{t as rehypeStringify}from"./libs/rehype-stringify.mjs";import{c as toString,t as fromMarkdown}from"./libs/mdast-util-from-markdown.mjs";import{t as remarkGfm}from"./libs/remark-gfm.mjs";import{t as remarkAlert}from"./libs/remark-github-blockquote-alert.mjs";import{t as remarkParse}from"./libs/remark-parse.mjs";import{t as remarkRehype}from"./libs/remark-rehype.mjs";import{t as unified}from"./libs/unified.mjs";function nonNullable(n,r){if(n===void 0||n==null){let i=typeof r==`function`?r():r;throw Error(i??`Expected defined value, but received ${n}`)}return n}function invariant(n,r){if(!n)throw Error(r??`Invariant failed`)}function nonexhaustive(n){throw Error(`NonExhaustive value: ${n}`)}function commonHead(n,r,i){return n.length===0||r.length===0?[]:(i??=Object.is,t(t$1(n,r),t$2(([n,r])=>i(n,r)),t$3(([n,r])=>n)))}var import_natural_compare_lite=__toESM(require_natural_compare_lite(),1);function compareNatural(n,r){return n===r?0:e(n)?e(r)?(0,import_natural_compare_lite.default)(n,r):1:e(r)?-1:0}function _sortNatural(n){return t$4(n,compareNatural)}function sortNatural(...n){return n.length===0?_sortNatural:_sortNatural(n[0])}function compareNaturalHierarchically(n=`.`,r=!1){return(i,a)=>{if(i===a)return 0;if(!i)return-1;if(!a)return 1;let o=i.split(n),s=a.split(n),c=Math.min(o.length,s.length);for(let n=0;n<c;n++){let r=o[n],i=s[n],a=(0,import_natural_compare_lite.default)(r,i);if(a!==0)return a}let l=o.length-s.length;return r?-1*l:l}}function isString(n){return n!=null&&typeof n==`string`}function isNonEmptyArray(n){return!!n&&Array.isArray(n)&&n.length>0}function hasProp(n,r){return n[r]!=null}function isAnyOf(...n){return(r=>n.some(n=>n(r)))}function parentFqn(n){let r=n.lastIndexOf(`.`);return r>0?n.slice(0,r):null}function nameFromFqn(n){let r=n.lastIndexOf(`.`);return r>0?n.slice(r+1):n}const asString=n=>isString(n)?n:n.id;function isAncestor(n,r){let i=asString(n);return r?asString(r).startsWith(i+`.`):n=>{let r=asString(n);return i.startsWith(r+`.`)}}function isSameHierarchy(n,r){if(!r)return r=>isSameHierarchy(n,r);let i=asString(n),a=asString(r);return i===a||a.startsWith(i+`.`)||i.startsWith(a+`.`)}function isDescendantOf(n,r){return r?isAncestor(r,n):r=>isAncestor(n,r)}function hierarchyLevel(n){return(isString(n)?n:n.id).split(`.`).length}function hierarchyDistance(n,r){let i=isString(n)?n:n.id,a=isString(r)?r:r.id;if(i===a)return 0;let o=hierarchyLevel(i),s=hierarchyLevel(a);if(isSameHierarchy(i,a))return Math.abs(o-s);let c=commonAncestor(i,a),l=c?hierarchyLevel(c):0;return o+s-(2*l+1)}function commonAncestor(n,r){let i=n.split(`.`);if(i.length<2)return null;let a=r.split(`.`);if(a.length<2)return null;let o=[];for(let n=0;n<Math.min(i.length,a.length)-1&&i[n]===a[n];n++)o.push(i[n]);return o.length===0?null:o.join(`.`)}function ancestorsFqn(n){let r=n.split(`.`);if(r.pop(),!t$5(r,2))return r;for(let n=1;n<r.length;n++)r[n]=r[n-1]+`.`+r[n];return r.reverse()}function compareFqnHierarchically(n,r){let i=n.split(`.`).length,a=r.split(`.`).length;switch(!0){case i>a:return 1;case i<a:return-1;default:return 0}}function compareByFqnHierarchically(n,r){return compareFqnHierarchically(n.id,r.id)}function sortByFqnHierarchically(n){return n.map(n=>({item:n,fqn:n.id.split(`.`)})).sort((n,r)=>n.fqn.length-r.fqn.length).map(({item:n})=>n)}function findTopAncestor(n,r){let i=r;for(let r of n)r!==i&&isAncestor(r,i)&&(i=r);return i===r?null:i}function sortParentsFirst(n){let r=[],i=[...n],a;for(;a=i.shift();){let n;for(;n=findTopAncestor(i,a);)r.push(...i.splice(i.indexOf(n),1));r.push(a)}return r}function sortNaturalByFqn(n,r){if(!n||isString(n)){let r=n??`asc`;return n=>sortNaturalByFqn(n,r)}let i=r===`desc`?-1:1;return n.map(n=>({item:n,fqn:n.id.split(`.`)})).sort((n,r)=>{if(n.fqn.length!==r.fqn.length)return(n.fqn.length-r.fqn.length)*i;for(let i=0;i<n.fqn.length;i++){let a=compareNatural(n.fqn[i],r.fqn[i]);if(a!==0)return a}return 0}).map(({item:n})=>n)}function getOrCreate(n,r,i){let a=n.get(r);return a||(a=i(r),n.set(r,a)),a}function isIterable(n){return typeof n==`object`&&!!n&&Symbol.iterator in n}function ifilter(n,r){let a=r??n;invariant(e$1(a));function*o(n){for(let r of n)a(r)&&(yield r)}return r?o(n):o}function ifind(n,r){let a=r??n;invariant(e$1(a));function o(n){for(let r of n)if(a(r))return r}return r?o(n):o}function ifirst(n,r){let i=r??n;invariant(typeof i==`number`&&i>=0,`Count must be a non-negative number`);function*a(n){let r=0;for(let a of n){if(r>=i)break;yield a,r++}}return r===void 0?n=>a(n):a(n)}function iflat(n){return n?_iflat(n):_iflat}function*_iflat(n){for(let r of n)yield*r}function iflatMap(n,r){let a=r??n;invariant(e$1(a));function*o(n){for(let r of n)yield*a(r)}return r?o(n):o}function ihead(n){return n?_head(n):_head}function _head(n){let{value:r}=n[Symbol.iterator]().next();return r}function imap(n,r){let a=r??n;invariant(e$1(a));function*o(n){for(let r of n)yield a(r)}return r?o(n):o}function ireduce(n,r,a){let o=e$2(a)?r:n,c=a??r;invariant(e$1(o));function l(n){let r=c;for(let i of n)r=o(r,i);return r}return e$2(a)?l(n):l}function isome(n,r){let a=r??n;invariant(e$1(a));function o(n){for(let r of n)if(a(r))return!0;return!1}return r?o(n):o}function toArray(n){return n?Array.from(n):n=>Array.from(n)}function toSet(n){return n?new Set(n):n=>new Set(n)}function iunique(n){return n?_iunique(n):_iunique}function*_iunique(n){let r=new Set;for(let i of n)r.has(i)||(r.add(i),yield i)}function memoizeProp(n,r,i){let a=typeof r==`symbol`?r:Symbol.for(r);return n.hasOwnProperty(a)||Object.defineProperty(n,a,{enumerable:!1,writable:!1,value:i()}),n[a]}function delay(...n){let r=100;return n.length===2?r=e$3(n[0],n[1]):n.length===1&&(r=n[0]),new Promise(n=>{setTimeout(()=>{n(`LIKEC4_DELAY`)},r??100)})}function promiseNextTick(){return Promise.resolve().then(()=>void 0)}function onNextTick(n){Promise.resolve().then(n)}const compareRelations=(n,r)=>{let i=commonAncestor(n.source.id,n.target.id),a=commonAncestor(r.source.id,r.target.id);if(i&&!a)return 1;if(!i&&a)return-1;let o=i&&a?compareFqnHierarchically(i,a):0;if(o!==0)return o;let s=compareFqnHierarchically(n.source.id,r.source.id);return s===0?compareFqnHierarchically(n.target.id,r.target.id):s};function union(...n){let r=new Set;for(let i of n)for(let n of i)r.add(n);return r}function intersection(n,...r){let i=new Set;if(n.size===0)return i;let a=t$5(r,2)?(0,import_set.intersection)(...r):r[0];if(a.size===0)return i;for(let r of n)a.has(r)&&i.add(r);return i}function difference(n,r){if(n.size===0)return new Set;if(r.size===0)return new Set(n);let i=new Set;for(let a of n)r.has(a)||i.add(a);return i}function equals(n,r){return n.size===r.size&&[...n].every(n=>r.has(n))}function symmetricDifference(n,r){return(0,import_set.symmetricDifference)(n,r)}function hasIntersection(n,r){if(n.size===0||r.size===0)return!1;r.size<n.size&&([n,r]=[r,n]);for(let i of n)if(r.has(i))return!0;return!1}function objectHash(n){return invariant(typeof n==`object`&&e$4(n),`objectHash: value must be an object`),hash(n)}function stringHash(n){let r=5381,i=n.length;invariant(i>0,`stringHash: empty string`);for(let a=0;a<i;a++)r=r*33^n.charCodeAt(a);return(r>>>0).toString(36)}function parser(){return unified().use(remarkParse).use(remarkGfm).use(remarkAlert).use(remarkRehype,{allowDangerousHtml:!0}).use(rehypeSanitize,defu({attributes:{"*":[`className`],svg:[`width`,`height`,`viewBox`,`fill`,`ariaHidden`],path:[`d`,`fill`,`stroke`,`strokeWidth`,`strokeLinecap`,`strokeLinejoin`]},tagNames:[`svg`,`g`,`path`,`div`]},defaultSchema)).use(rehypeStringify,{allowDangerousHtml:!0})}function markdownToHtml(n){return(``+parser().processSync(n)).trim()}function markdownToText(n){return toString(fromMarkdown(n),{includeHtml:!1,includeImageAlt:!1})}export{nonNullable as $,ancestorsFqn as A,parentFqn as B,iflatMap as C,ifilter as D,ifind as E,hierarchyLevel as F,isAnyOf as G,sortNaturalByFqn as H,isAncestor as I,compareNatural as J,isNonEmptyArray as K,isDescendantOf as L,compareByFqnHierarchically as M,compareFqnHierarchically as N,isIterable as O,hierarchyDistance as P,invariant as Q,isSameHierarchy as R,ihead as S,ifirst as T,sortParentsFirst as U,sortByFqnHierarchically as V,hasProp as W,sortNatural as X,compareNaturalHierarchically as Y,commonHead as Z,toArray as _,difference as a,ireduce as b,intersection as c,compareRelations as d,nonexhaustive as et,delay as f,iunique as g,memoizeProp as h,objectHash as i,commonAncestor as j,getOrCreate as k,symmetricDifference as l,promiseNextTick as m,markdownToHtml as n,equals as o,onNextTick as p,isString as q,stringHash as r,hasIntersection as s,markdownToText as t,union as u,toSet as v,iflat as w,imap as x,isome as y,nameFromFqn as z};
@@ -0,0 +1,198 @@
1
+ //#region src/geometry/types.d.ts
2
+ interface XYPoint {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ interface Dimensions {
7
+ width: number;
8
+ height: number;
9
+ }
10
+ type Point = readonly [x: number, y: number];
11
+ declare function isPoint(point: unknown): point is Point;
12
+ /**
13
+ * Converts between Point (tuple) and XYPoint (object) representations.
14
+ *
15
+ * @param point - The point to convert (either XYPoint or Point tuple)
16
+ * @returns The converted point in the alternate format
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Convert tuple to object
21
+ * convertPoint([10, 20]) // returns { x: 10, y: 20 }
22
+ *
23
+ * // Convert object to tuple
24
+ * convertPoint({ x: 10, y: 20 }) // returns [10, 20]
25
+ * ```
26
+ */
27
+ declare function convertPoint(point: Point): XYPoint;
28
+ declare function convertPoint(point: XYPoint): Point;
29
+ //#endregion
30
+ //#region src/geometry/bbox.d.ts
31
+ interface BBox {
32
+ x: number;
33
+ y: number;
34
+ width: number;
35
+ height: number;
36
+ }
37
+ declare const BBox: {
38
+ center({
39
+ x,
40
+ y,
41
+ width,
42
+ height
43
+ }: BBox): XYPoint;
44
+ /**
45
+ * Returns the four corner points of the box in clockwise order starting from top-left
46
+ */
47
+ toPoints({
48
+ x,
49
+ y,
50
+ width,
51
+ height
52
+ }: BBox): [XYPoint, XYPoint, XYPoint, XYPoint];
53
+ fromPoints(points: Point[]): BBox;
54
+ merge(...boxes: BBox[]): BBox;
55
+ fromRectBox(rect: RectBox): BBox;
56
+ toRectBox(box: BBox): RectBox;
57
+ expand(box: BBox, plus: number): BBox;
58
+ shrink(box: BBox, minus: number): BBox;
59
+ /**
60
+ * Returns true if `a` includes `b` (i.e. `b` is inside `a`)
61
+ */
62
+ includes(a: BBox, b: BBox): boolean;
63
+ };
64
+ interface RectBox {
65
+ x1: number;
66
+ y1: number;
67
+ x2: number;
68
+ y2: number;
69
+ }
70
+ declare const RectBox: {
71
+ center({
72
+ x1,
73
+ y1,
74
+ x2,
75
+ y2
76
+ }: RectBox): XYPoint;
77
+ fromPoints(points: Point[]): RectBox;
78
+ merge(...boxes: RectBox[]): RectBox;
79
+ toBBox(box: RectBox): BBox;
80
+ /**
81
+ * Returns true if `a` includes `b` (i.e. `b` is inside `a`)
82
+ */
83
+ includes(a: RectBox, b: RectBox): boolean;
84
+ };
85
+ //#endregion
86
+ //#region src/geometry/vector.d.ts
87
+ interface VectorValue {
88
+ readonly x: number;
89
+ readonly y: number;
90
+ }
91
+ declare class Vector implements VectorValue {
92
+ readonly x: number;
93
+ readonly y: number;
94
+ constructor(x: number, y: number);
95
+ static create(position: VectorValue): Vector;
96
+ static create(x: number, y: number): Vector;
97
+ /**
98
+ * Adds two vectors.
99
+ * @param a The first vector.
100
+ * @param b The second vector.
101
+ * @returns The sum of the two vectors.
102
+ */
103
+ static add(a: VectorValue, b: VectorValue): VectorValue;
104
+ /**
105
+ * Subtracts two vectors.
106
+ * @param a The first vector.
107
+ * @param b The second vector.
108
+ * @returns The difference of the two vectors.
109
+ */
110
+ static subtract(a: VectorValue, b: VectorValue): VectorValue;
111
+ /**
112
+ * Multiplies a vector by a scalar.
113
+ * @param a The vector.
114
+ * @param b The scalar.
115
+ * @returns The scaled vector.
116
+ */
117
+ static multiply(a: VectorValue, b: number): VectorValue;
118
+ /**
119
+ * Divides a vector by a scalar.
120
+ * @param a The vector.
121
+ * @param b The scalar.
122
+ * @returns The scaled vector.
123
+ */
124
+ static divide(a: VectorValue, b: number): VectorValue;
125
+ /**
126
+ * Calculates the dot product of the vectors.
127
+ * @param a The first vector.
128
+ * @param b The second vector.
129
+ * @returns The dot product.
130
+ */
131
+ static dot(a: VectorValue, b: VectorValue): number;
132
+ /**
133
+ * Adds the given vector to this vector.
134
+ * @param b The vector to add.
135
+ * @returns A new vector that is the sum of this vector and the given vector.
136
+ */
137
+ add(b: VectorValue): Vector;
138
+ /**
139
+ * Subtracts the given vector from this vector.
140
+ * @param b The vector to subtract.
141
+ * @returns A new vector that is the difference of this vector and the given vector.
142
+ */
143
+ subtract(b: VectorValue): Vector;
144
+ /**
145
+ * Multiplies this vector by a scalar.
146
+ * @param b The scalar to multiply by.
147
+ * @returns A new vector that is the product of this vector and the given scalar.
148
+ */
149
+ multiply(b: number): Vector;
150
+ /**
151
+ * Divides this vector by a scalar.
152
+ * @param b The scalar to divide by.
153
+ * @returns A new vector that is the quotient of this vector and the given scalar.
154
+ */
155
+ divide(b: number): Vector;
156
+ /**
157
+ * Calculates the dot product of this vector and another vector.
158
+ * @param b The other vector.
159
+ * @returns The dot product.
160
+ */
161
+ dot(b: VectorValue): number;
162
+ /**
163
+ * Calculates the cross product of this vector and another vector.
164
+ * The cross product of two 2D vectors is a scalar value: a.x * b.y - a.y * b.x
165
+ * @param b The other vector.
166
+ * @returns The cross product as a scalar.
167
+ */
168
+ cross(b: VectorValue): number;
169
+ /**
170
+ * Calculates the length (magnitude) of this vector.
171
+ * @returns The length of the vector.
172
+ */
173
+ length(): number;
174
+ /**
175
+ * Normalizes the vector (makes it unit length, i.e., has a length of 1).
176
+ * @returns A new vector that is the normalized version of this vector.
177
+ */
178
+ normalize(): Vector;
179
+ /**
180
+ * Rounds the components of the vector to the nearest integers.
181
+ * @returns A new vector with rounded components.
182
+ */
183
+ round(): Vector;
184
+ /**
185
+ * Truncates the components of the vector (removes the decimal part).
186
+ * @returns A new vector with truncated components.
187
+ */
188
+ trunc(): Vector;
189
+ /**
190
+ * Converts the vector to a plain object.
191
+ * @returns An object with x and y properties.
192
+ */
193
+ toObject(): VectorValue;
194
+ }
195
+ declare function vector(source: VectorValue | Vector): Vector;
196
+ declare function vector(x: number, y: number): Vector;
197
+ //#endregion
198
+ export { RectBox as a, XYPoint as c, BBox as i, convertPoint as l, VectorValue as n, Dimensions as o, vector as r, Point as s, Vector as t, isPoint as u };
@@ -0,0 +1 @@
1
+ import{Q as t}from"./libs/remeda.mjs";import{Q as invariant}from"./to-text.mjs";function isPoint(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function convertPoint(e){return isPoint(e)?{x:e[0],y:e[1]}:[e.x,e.y]}const BBox={center({x:e,y:n,width:r,height:i}){return{x:e+r/2,y:n+i/2}},toPoints({x:e,y:n,width:r,height:i}){return[{x:e,y:n},{x:e+r,y:n},{x:e+r,y:n+i},{x:e,y:n+i}]},fromPoints(e){let{x1:n,y1:r,x2:i,y2:a}=RectBox.fromPoints(e);return{x:n,y:r,width:i-n,height:a-r}},merge(...r){if(invariant(t(r,1),`No boxes provided`),r.length===1)return r[0];let i=r[0].x,a=r[0].y,o=r[0].x+r[0].width,s=r[0].y+r[0].height;for(let e=1;e<r.length;e++){let n=r[e];i=Math.min(i,n.x),a=Math.min(a,n.y),o=Math.max(o,n.x+n.width),s=Math.max(s,n.y+n.height)}return{x:Math.floor(i),y:Math.floor(a),width:Math.round(o-i),height:Math.round(s-a)}},fromRectBox(e){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x2-e.x1),height:Math.abs(e.y2-e.y1)}},toRectBox(e){return{x1:e.x,y1:e.y,x2:e.x+e.width,y2:e.y+e.height}},expand(e,n){return n===0?e:{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}},shrink(e,n){return n===0?e:{x:e.x+n,y:e.y+n,width:e.width-n*2,height:e.height-n*2}},includes(e,n){return e===n?!0:e.x<=n.x&&e.y<=n.y&&e.x+e.width>=n.x+n.width&&e.y+e.height>=n.y+n.height}},RectBox={center({x1:e,y1:n,x2:r,y2:i}){return{x:(e+r)/2,y:(n+i)/2}},fromPoints(e){invariant(e.length>0,`At least one point is required`);let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let[n,s]of e)r=Math.min(r,n),i=Math.min(i,s),a=Math.max(a,n),o=Math.max(o,s);return{x1:r,y1:i,x2:a,y2:o}},merge(...e){invariant(e.length>0,`No boxes provided`);let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let n of e)r=Math.min(r,n.x1),i=Math.min(i,n.y1),a=Math.max(a,n.x2),o=Math.max(o,n.y2);return{x1:r,y1:i,x2:a,y2:o}},toBBox(e){return{x:e.x1,y:e.y1,width:e.x2-e.x1,height:e.y2-e.y1}},includes(e,n){return e===n?!0:e.x1<=n.x1&&e.y1<=n.y1&&e.x2>=n.x2&&e.y2>=n.y2}};var Vector=class e{constructor(e,r){this.x=e,this.y=r,invariant(typeof e==`number`&&!isNaN(e)&&isFinite(e)&&typeof r==`number`&&!isNaN(r)&&isFinite(r),`Invalid arguments for Vector: (${e}, ${r})`)}static create(...n){return n.length===2?new e(n[0],n[1]):new e(n[0].x,n[0].y)}static add(e,n){return{x:e.x+n.x,y:e.y+n.y}}static subtract(e,n){return{x:e.x-n.x,y:e.y-n.y}}static multiply(e,n){return{x:e.x*n,y:e.y*n}}static divide(e,n){return{x:e.x/n,y:e.y/n}}static dot(e,n){return e.x*n.x+e.y*n.y}add(n){return new e(this.x+n.x,this.y+n.y)}subtract(n){return new e(this.x-n.x,this.y-n.y)}multiply(n){return new e(this.x*n,this.y*n)}divide(n){return new e(this.x/n,this.y/n)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}length(){return this.x===0&&this.y===0?0:Math.sqrt(this.x**2+this.y**2)}normalize(){let n=this.length();return n===0?new e(0,0):new e(this.x/n,this.y/n)}round(){return new e(Math.round(this.x),Math.round(this.y))}trunc(){return new e(Math.trunc(this.x),Math.trunc(this.y))}toObject(){return{x:this.x,y:this.y}}};function vector(...e){return e.length===1&&e[0]instanceof Vector?e[0]:e.length===2?new Vector(e[0],e[1]):new Vector(e[0].x,e[0].y)}export{convertPoint as a,RectBox as i,vector as n,isPoint as o,BBox as r,Vector as t};
@@ -1,11 +1,5 @@
1
- import "../_chunks/_aux.mjs";
2
- import "../_chunks/scalar.mjs";
3
- import "../_chunks/expression.mjs";
4
- import "../_chunks/fqnRef.mjs";
5
- import "../_chunks/expression-model.mjs";
6
- import "../_chunks/index2.mjs";
7
- import "../_chunks/RichText.mjs";
8
- import "../_chunks/index3.mjs";
1
+ import "../_chunks/guards.mjs";
2
+ import "../_chunks/theme.mjs";
9
3
  import "../_chunks/LikeC4Model.mjs";
10
4
  import { $ as DeloymentModelHelpers, A as AddDeploymentViewHelper, B as ViewPredicate, C as AddViewHelper, D as ElementViewRulesBuilder, E as ElementViewBuilder, F as $exclude, G as NestedRelationshipHelper, H as ModelBuilder, I as $include, J as AddElement, K as RelationshipHelper, L as $rules, M as DeploymentRulesBuilderOp, N as DeploymentViewBuilder, O as TypedAddViewOfHelper, P as $autoLayout, Q as DeloymentModelBuildFunction, R as $style, S as $expr, T as AddViewRules, U as ModelBuilderFunction, V as AddElementHelpers, W as ModelHelpers, X as AddDeploymentNodeHelpers, Y as AddDeployedInstance, Z as AddDeploymentRelation, _ as ViewsBuilder, a as Invalid, b as mkViewBuilder, c as NewElementProps, d as Types, et as DeploymentModelBuilder, f as TypesNested, g as BuilderMethods, h as Builder, i as BuilderSpecification, j as AddDeploymentViewRules, k as $deploymentExpr, l as NewRelationProps, m as Warn, n as AnyTypesNested, nt as AddDeploymentNode, o as Metadata, p as ValidId, q as model, r as BuilderProjectSpecification, s as NewDeploymentNodeProps, t as AnyTypes, tt as deployment, u as NewViewProps, v as ViewsBuilderFunction, w as AddViewOfHelper, x as views, y as ViewsHelpers, z as LikeC4ViewBuilder } from "../_chunks/_types.mjs";
11
5
  export { $autoLayout, $deploymentExpr, $exclude, $expr, $include, $rules, $style, AddDeployedInstance, AddDeploymentNode, AddDeploymentNodeHelpers, AddDeploymentRelation, AddDeploymentViewHelper, AddDeploymentViewRules, AddElement, AddElementHelpers, AddViewHelper, AddViewOfHelper, AddViewRules, AnyTypes, AnyTypesNested, Builder, BuilderMethods, BuilderProjectSpecification, BuilderSpecification, DeloymentModelBuildFunction, DeloymentModelHelpers, DeploymentModelBuilder, DeploymentRulesBuilderOp, DeploymentViewBuilder, ElementViewBuilder, ElementViewRulesBuilder, Invalid, LikeC4ViewBuilder, Metadata, ModelBuilder, ModelBuilderFunction, ModelHelpers, NestedRelationshipHelper, NewDeploymentNodeProps, NewElementProps, NewRelationProps, NewViewProps, RelationshipHelper, TypedAddViewOfHelper, Types, TypesNested, ValidId, ViewPredicate, ViewsBuilder, ViewsBuilderFunction, ViewsHelpers, Warn, deployment, mkViewBuilder, model, views };