@likec4/core 1.30.0 → 1.32.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/README.md +407 -5
- package/dist/builder/index.d.mts +221 -42
- package/dist/builder/index.mjs +118 -65
- package/dist/compute-view/index.d.mts +23 -7
- package/dist/compute-view/index.mjs +11 -6
- package/dist/compute-view/relationships-view/index.d.mts +9 -7
- package/dist/compute-view/relationships-view/index.mjs +3 -2
- package/dist/index.d.mts +10 -14
- package/dist/index.mjs +10 -6
- package/dist/model/index.d.mts +173 -19
- package/dist/model/index.mjs +6 -1
- package/dist/shared/core.BaYE_r29.d.mts +258 -0
- package/dist/shared/core.Bk7wEZFG.mjs +276 -0
- package/dist/shared/core.BrCnZFTn.mjs +32 -0
- package/dist/shared/core.BuO4ncfY.d.mts +146 -0
- package/dist/shared/{core.CAcZ6_cP.mjs → core.CBpKAlhj.mjs} +1742 -4128
- package/dist/shared/core.CCWXGc6G.d.mts +920 -0
- package/dist/shared/core.CUYDgv2-.mjs +214 -0
- package/dist/shared/{core.Cu-UdkSl.mjs → core.CpXlRyE5.mjs} +7 -494
- package/dist/shared/{core.C-YXI-43.mjs → core.Cy9smucx.mjs} +3 -1
- package/dist/shared/core.CywrQs86.d.mts +31 -0
- package/dist/shared/core.DoK86JEe.mjs +518 -0
- package/dist/shared/core.Dpq3P3YJ.d.mts +1265 -0
- package/dist/shared/{core.D2830qgg.d.mts → core.Pf5I9o0e.d.mts} +1 -1
- package/dist/shared/core.cbA9VZ02.mjs +2681 -0
- package/dist/shared/{core.CQXU9DF7.mjs → core.rmvsy0n3.mjs} +23 -32
- package/dist/types/aux.d.mts +3 -0
- package/dist/types/aux.mjs +1 -0
- package/dist/types/index.d.mts +7 -45
- package/dist/types/index.mjs +130 -3
- package/dist/utils/index.d.mts +221 -53
- package/dist/utils/index.mjs +14 -10
- package/package.json +19 -10
- package/src/builder/Builder.deploymentModel.ts +82 -18
- package/src/builder/Builder.element.ts +40 -20
- package/src/builder/Builder.model.ts +66 -17
- package/src/builder/Builder.ts +168 -76
- package/src/builder/Builder.view-common.ts +35 -17
- package/src/builder/Builder.view-deployment.ts +25 -25
- package/src/builder/Builder.view-element.ts +13 -12
- package/src/builder/Builder.views.ts +12 -7
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +62 -34
- package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +319 -0
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +45 -24
- package/src/builder/_types.ts +34 -27
- package/src/compute-view/compute-view.ts +31 -34
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +27 -14
- package/src/compute-view/deployment-view/__test__/fixture.ts +15 -13
- package/src/compute-view/deployment-view/_types.ts +10 -10
- package/src/compute-view/deployment-view/clean-connections.ts +5 -7
- package/src/compute-view/deployment-view/compute.ts +16 -13
- package/src/compute-view/deployment-view/memory/memory.ts +5 -6
- package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +4 -5
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +25 -50
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +5 -7
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +7 -11
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +7 -10
- package/src/compute-view/deployment-view/predicates/utils.ts +37 -31
- package/src/compute-view/deployment-view/predicates/wildcard.ts +3 -2
- package/src/compute-view/deployment-view/stages/stage-final.ts +2 -2
- package/src/compute-view/deployment-view/stages/stage-include.ts +1 -1
- package/src/compute-view/deployment-view/utils.ts +79 -72
- package/src/compute-view/dynamic-view/__test__/fixture.ts +20 -11
- package/src/compute-view/dynamic-view/compute.ts +60 -53
- package/src/compute-view/element-view/__test__/TestHelper.ts +53 -29
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +26 -26
- package/src/compute-view/element-view/__test__/fixture.ts +134 -83
- package/src/compute-view/element-view/_types.ts +14 -19
- package/src/compute-view/element-view/clean-connections.ts +12 -8
- package/src/compute-view/element-view/compute.ts +61 -51
- package/src/compute-view/element-view/memory/NodeGroup.ts +8 -9
- package/src/compute-view/element-view/memory/memory.ts +22 -22
- package/src/compute-view/element-view/memory/stage-include.ts +5 -3
- package/src/compute-view/element-view/predicates/_utils.ts +18 -14
- package/src/compute-view/element-view/predicates/element-expand.ts +4 -5
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +3 -4
- package/src/compute-view/element-view/predicates/element-ref.ts +3 -4
- package/src/compute-view/element-view/predicates/relation-direct.ts +16 -12
- package/src/compute-view/element-view/predicates/relation-in-out.ts +7 -8
- package/src/compute-view/element-view/predicates/relation-in.ts +19 -26
- package/src/compute-view/element-view/predicates/relation-out.ts +20 -21
- package/src/compute-view/element-view/predicates/wildcard.ts +3 -3
- package/src/compute-view/element-view/utils.ts +25 -23
- package/src/compute-view/index.ts +1 -1
- package/src/compute-view/memory/AbstractStageExclude.ts +3 -4
- package/src/compute-view/memory/AbstractStageInclude.ts +1 -1
- package/src/compute-view/memory/_types.ts +3 -2
- package/src/compute-view/relationships-view/_types.ts +3 -4
- package/src/compute-view/relationships-view/compute.ts +8 -11
- package/src/compute-view/relationships-view/layout.ts +6 -6
- package/src/compute-view/relationships-view/utils.ts +4 -4
- package/src/compute-view/utils/ancestorsOfNode.ts +7 -7
- package/src/compute-view/utils/applyCustomElementProperties.ts +16 -8
- package/src/compute-view/utils/applyCustomRelationProperties.ts +19 -9
- package/src/compute-view/utils/applyViewRuleStyles.ts +18 -10
- package/src/compute-view/utils/buildComputedNodes.ts +40 -40
- package/src/compute-view/utils/buildElementNotations.ts +14 -14
- package/src/compute-view/utils/elementExpressionToPredicate.ts +14 -15
- package/src/compute-view/utils/link-nodes-with-edges.ts +6 -4
- package/src/compute-view/utils/merge-props-from-relationships.ts +52 -20
- package/src/compute-view/utils/relationExpressionToPredicates.ts +19 -19
- package/src/compute-view/utils/resolve-extended-views.ts +8 -7
- package/src/compute-view/utils/resolve-global-rules.ts +31 -26
- package/src/compute-view/utils/topological-sort.ts +14 -14
- package/src/compute-view/utils/view-hash.ts +2 -2
- package/src/compute-view/utils/with-readable-edges.ts +9 -5
- package/src/index.ts +0 -32
- package/src/model/DeploymentElementModel.ts +182 -137
- package/src/model/DeploymentModel.ts +88 -65
- package/src/model/ElementModel.ts +92 -72
- package/src/model/LikeC4Model.ts +430 -241
- package/src/model/RelationModel.ts +69 -26
- package/src/model/__test__/fixture.ts +50 -36
- package/src/model/connection/Connection.ts +2 -2
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +21 -24
- package/src/model/connection/deployment/find.ts +1 -1
- package/src/model/connection/model/ConnectionModel.ts +21 -20
- package/src/model/connection/model/find.ts +7 -7
- package/src/model/connection/ops.ts +6 -6
- package/src/model/guards.ts +66 -14
- package/src/model/index.ts +20 -7
- package/src/model/types.ts +41 -97
- package/src/model/view/EdgeModel.ts +47 -41
- package/src/model/view/LikeC4ViewModel.ts +130 -80
- package/src/model/view/NodeModel.ts +102 -96
- package/src/theme/element.ts +1 -1
- package/src/theme/index.ts +9 -9
- package/src/theme/relationships.ts +1 -1
- package/src/types/_common.ts +21 -15
- package/src/types/aux.ts +285 -0
- package/src/types/const.ts +34 -0
- package/src/types/expression-model.ts +292 -0
- package/src/types/expression.ts +311 -0
- package/src/types/fqnRef.ts +88 -0
- package/src/types/geometry.ts +131 -0
- package/src/types/global.ts +10 -8
- package/src/types/index.ts +39 -201
- package/src/types/model-data.ts +52 -84
- package/src/types/model-deployment.ts +87 -0
- package/src/types/model-dump.ts +72 -0
- package/src/types/model-logical.ts +111 -0
- package/src/types/model-spec.ts +81 -0
- package/src/types/operators.ts +51 -52
- package/src/types/scalar.ts +114 -0
- package/src/types/styles.ts +123 -0
- package/src/types/view-changes.ts +4 -5
- package/src/types/view-common.ts +157 -0
- package/src/types/view-computed.ts +113 -0
- package/src/types/view-layouted.ts +82 -0
- package/src/types/view-parsed.deployment.ts +40 -0
- package/src/types/view-parsed.dynamic.ts +78 -0
- package/src/types/view-parsed.element.ts +65 -0
- package/src/types/view.ts +122 -542
- package/src/utils/compare-natural.ts +43 -1
- package/src/utils/getOrCreate.ts +0 -34
- package/src/utils/index.ts +7 -12
- package/src/utils/iterable/filter.ts +1 -1
- package/src/utils/iterable/find.ts +3 -1
- package/src/utils/iterable/head.ts +22 -0
- package/src/utils/iterable/index.ts +1 -0
- package/src/utils/iterable/map.ts +1 -1
- package/src/utils/iterable/reduce.ts +1 -1
- package/src/utils/iterable/some.ts +1 -1
- package/src/utils/memoize-prop.ts +30 -0
- package/src/utils/object-hash.ts +1 -1
- package/src/utils/relations.ts +14 -11
- package/src/utils/string-hash.ts +1 -1
- package/dist/shared/core.CZR9J1Qx.d.mts +0 -146
- package/dist/shared/core.CiFKryGW.d.mts +0 -745
- package/dist/shared/core.DJvmfnEi.d.mts +0 -1153
- package/dist/shared/core.DgfwjBtu.mjs +0 -495
- package/dist/shared/core.SjLhMA7a.d.mts +0 -62
- package/src/builder/__snapshots__/Builder.spec.ts.snap +0 -374
- package/src/compute-view/element-view/predicates.ts +0 -520
- package/src/compute-view/utils/uniqueTags.ts +0 -21
- package/src/types/deployments.ts +0 -170
- package/src/types/element.ts +0 -109
- package/src/types/expression-v2-model.ts +0 -314
- package/src/types/expression-v2.ts +0 -392
- package/src/types/overview-graph.ts +0 -43
- package/src/types/relation.ts +0 -61
- package/src/types/scalars.ts +0 -39
- package/src/types/theme.ts +0 -82
- package/src/types/view-notation.ts +0 -9
- package/src/utils/graphlib.ts +0 -10
- /package/src/{errors/index.ts → utils/invariant.ts} +0 -0
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as getDefaultExportFromCjs, C } from './core.rmvsy0n3.mjs';
|
|
2
2
|
import { u as u$1 } from './core.DbRvwARP.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { m } from './core.DoK86JEe.mjs';
|
|
4
|
+
import { i as invariant } from './core.Cy9smucx.mjs';
|
|
4
5
|
|
|
5
|
-
function d(...e){return u$1(i
|
|
6
|
+
function d(...e){return u$1(i,e,o$1)}var i=(e,n)=>e.length<n.length?e.map((t,r)=>[t,n[r]]):n.map((t,r)=>[e[r],t]),o$1=e=>(n,t)=>({hasNext:true,next:[n,e[t]],done:t>=e.length-1});
|
|
6
7
|
|
|
7
|
-
function
|
|
8
|
+
function u(...e){return u$1(o,e)}function o(e,a){let n=[];for(let[i,r]of e.entries()){if(!a(r,i,e))break;n.push(r);}return n}
|
|
8
9
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function m(...a){return u$1(o,a,p)}var o=(a,e)=>a.map(e),p=a=>(e,t,r)=>({done:false,hasNext:true,next:a(e,t,r)});
|
|
10
|
+
function n(e){return e!==void 0}
|
|
12
11
|
|
|
13
12
|
function l(n){return n!=null}
|
|
14
13
|
|
|
15
|
-
function n(e){return e!==void 0}
|
|
16
|
-
|
|
17
14
|
var support = {};
|
|
18
15
|
|
|
19
16
|
var hasRequiredSupport;
|
|
@@ -214,376 +211,6 @@ function requireIterator () {
|
|
|
214
211
|
return iterator;
|
|
215
212
|
}
|
|
216
213
|
|
|
217
|
-
var set = {};
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Mnemonist Set
|
|
221
|
-
* ==============
|
|
222
|
-
*
|
|
223
|
-
* Useful function related to sets such as union, intersection and so on...
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
var hasRequiredSet;
|
|
227
|
-
|
|
228
|
-
function requireSet () {
|
|
229
|
-
if (hasRequiredSet) return set;
|
|
230
|
-
hasRequiredSet = 1;
|
|
231
|
-
(function (exports) {
|
|
232
|
-
// TODO: optimize versions for less variadicities
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Variadic function computing the intersection of multiple sets.
|
|
236
|
-
*
|
|
237
|
-
* @param {...Set} sets - Sets to intersect.
|
|
238
|
-
* @return {Set} - The intesection.
|
|
239
|
-
*/
|
|
240
|
-
exports.intersection = function() {
|
|
241
|
-
if (arguments.length < 2)
|
|
242
|
-
throw new Error('mnemonist/Set.intersection: needs at least two arguments.');
|
|
243
|
-
|
|
244
|
-
var I = new Set();
|
|
245
|
-
|
|
246
|
-
// First we need to find the smallest set
|
|
247
|
-
var smallestSize = Infinity,
|
|
248
|
-
smallestSet = null;
|
|
249
|
-
|
|
250
|
-
var s, i, l = arguments.length;
|
|
251
|
-
|
|
252
|
-
for (i = 0; i < l; i++) {
|
|
253
|
-
s = arguments[i];
|
|
254
|
-
|
|
255
|
-
// If one of the set has no items, we can stop right there
|
|
256
|
-
if (s.size === 0)
|
|
257
|
-
return I;
|
|
258
|
-
|
|
259
|
-
if (s.size < smallestSize) {
|
|
260
|
-
smallestSize = s.size;
|
|
261
|
-
smallestSet = s;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Now we need to intersect this set with the others
|
|
266
|
-
var iterator = smallestSet.values(),
|
|
267
|
-
step,
|
|
268
|
-
item,
|
|
269
|
-
add,
|
|
270
|
-
set;
|
|
271
|
-
|
|
272
|
-
// TODO: we can optimize by iterating each next time over the current intersection
|
|
273
|
-
// but this probably means more RAM to consume since we'll create n-1 sets rather than
|
|
274
|
-
// only the one.
|
|
275
|
-
while ((step = iterator.next(), !step.done)) {
|
|
276
|
-
item = step.value;
|
|
277
|
-
add = true;
|
|
278
|
-
|
|
279
|
-
for (i = 0; i < l; i++) {
|
|
280
|
-
set = arguments[i];
|
|
281
|
-
|
|
282
|
-
if (set === smallestSet)
|
|
283
|
-
continue;
|
|
284
|
-
|
|
285
|
-
if (!set.has(item)) {
|
|
286
|
-
add = false;
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (add)
|
|
292
|
-
I.add(item);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return I;
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Variadic function computing the union of multiple sets.
|
|
300
|
-
*
|
|
301
|
-
* @param {...Set} sets - Sets to unite.
|
|
302
|
-
* @return {Set} - The union.
|
|
303
|
-
*/
|
|
304
|
-
exports.union = function() {
|
|
305
|
-
if (arguments.length < 2)
|
|
306
|
-
throw new Error('mnemonist/Set.union: needs at least two arguments.');
|
|
307
|
-
|
|
308
|
-
var U = new Set();
|
|
309
|
-
|
|
310
|
-
var i, l = arguments.length;
|
|
311
|
-
|
|
312
|
-
var iterator,
|
|
313
|
-
step;
|
|
314
|
-
|
|
315
|
-
for (i = 0; i < l; i++) {
|
|
316
|
-
iterator = arguments[i].values();
|
|
317
|
-
|
|
318
|
-
while ((step = iterator.next(), !step.done))
|
|
319
|
-
U.add(step.value);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return U;
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Function computing the difference between two sets.
|
|
327
|
-
*
|
|
328
|
-
* @param {Set} A - First set.
|
|
329
|
-
* @param {Set} B - Second set.
|
|
330
|
-
* @return {Set} - The difference.
|
|
331
|
-
*/
|
|
332
|
-
exports.difference = function(A, B) {
|
|
333
|
-
|
|
334
|
-
// If first set is empty
|
|
335
|
-
if (!A.size)
|
|
336
|
-
return new Set();
|
|
337
|
-
|
|
338
|
-
if (!B.size)
|
|
339
|
-
return new Set(A);
|
|
340
|
-
|
|
341
|
-
var D = new Set();
|
|
342
|
-
|
|
343
|
-
var iterator = A.values(),
|
|
344
|
-
step;
|
|
345
|
-
|
|
346
|
-
while ((step = iterator.next(), !step.done)) {
|
|
347
|
-
if (!B.has(step.value))
|
|
348
|
-
D.add(step.value);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return D;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Function computing the symmetric difference between two sets.
|
|
356
|
-
*
|
|
357
|
-
* @param {Set} A - First set.
|
|
358
|
-
* @param {Set} B - Second set.
|
|
359
|
-
* @return {Set} - The symmetric difference.
|
|
360
|
-
*/
|
|
361
|
-
exports.symmetricDifference = function(A, B) {
|
|
362
|
-
var S = new Set();
|
|
363
|
-
|
|
364
|
-
var iterator = A.values(),
|
|
365
|
-
step;
|
|
366
|
-
|
|
367
|
-
while ((step = iterator.next(), !step.done)) {
|
|
368
|
-
if (!B.has(step.value))
|
|
369
|
-
S.add(step.value);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
iterator = B.values();
|
|
373
|
-
|
|
374
|
-
while ((step = iterator.next(), !step.done)) {
|
|
375
|
-
if (!A.has(step.value))
|
|
376
|
-
S.add(step.value);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
return S;
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Function returning whether A is a subset of B.
|
|
384
|
-
*
|
|
385
|
-
* @param {Set} A - First set.
|
|
386
|
-
* @param {Set} B - Second set.
|
|
387
|
-
* @return {boolean}
|
|
388
|
-
*/
|
|
389
|
-
exports.isSubset = function(A, B) {
|
|
390
|
-
var iterator = A.values(),
|
|
391
|
-
step;
|
|
392
|
-
|
|
393
|
-
// Shortcuts
|
|
394
|
-
if (A === B)
|
|
395
|
-
return true;
|
|
396
|
-
|
|
397
|
-
if (A.size > B.size)
|
|
398
|
-
return false;
|
|
399
|
-
|
|
400
|
-
while ((step = iterator.next(), !step.done)) {
|
|
401
|
-
if (!B.has(step.value))
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
return true;
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Function returning whether A is a superset of B.
|
|
410
|
-
*
|
|
411
|
-
* @param {Set} A - First set.
|
|
412
|
-
* @param {Set} B - Second set.
|
|
413
|
-
* @return {boolean}
|
|
414
|
-
*/
|
|
415
|
-
exports.isSuperset = function(A, B) {
|
|
416
|
-
return exports.isSubset(B, A);
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* Function adding the items of set B to the set A.
|
|
421
|
-
*
|
|
422
|
-
* @param {Set} A - First set.
|
|
423
|
-
* @param {Set} B - Second set.
|
|
424
|
-
*/
|
|
425
|
-
exports.add = function(A, B) {
|
|
426
|
-
var iterator = B.values(),
|
|
427
|
-
step;
|
|
428
|
-
|
|
429
|
-
while ((step = iterator.next(), !step.done))
|
|
430
|
-
A.add(step.value);
|
|
431
|
-
|
|
432
|
-
return;
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Function subtracting the items of set B from the set A.
|
|
437
|
-
*
|
|
438
|
-
* @param {Set} A - First set.
|
|
439
|
-
* @param {Set} B - Second set.
|
|
440
|
-
*/
|
|
441
|
-
exports.subtract = function(A, B) {
|
|
442
|
-
var iterator = B.values(),
|
|
443
|
-
step;
|
|
444
|
-
|
|
445
|
-
while ((step = iterator.next(), !step.done))
|
|
446
|
-
A.delete(step.value);
|
|
447
|
-
|
|
448
|
-
return;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Function intersecting the items of A & B.
|
|
453
|
-
*
|
|
454
|
-
* @param {Set} A - First set.
|
|
455
|
-
* @param {Set} B - Second set.
|
|
456
|
-
*/
|
|
457
|
-
exports.intersect = function(A, B) {
|
|
458
|
-
var iterator = A.values(),
|
|
459
|
-
step;
|
|
460
|
-
|
|
461
|
-
while ((step = iterator.next(), !step.done)) {
|
|
462
|
-
if (!B.has(step.value))
|
|
463
|
-
A.delete(step.value);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
return;
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Function disjuncting the items of A & B.
|
|
471
|
-
*
|
|
472
|
-
* @param {Set} A - First set.
|
|
473
|
-
* @param {Set} B - Second set.
|
|
474
|
-
*/
|
|
475
|
-
exports.disjunct = function(A, B) {
|
|
476
|
-
var iterator = A.values(),
|
|
477
|
-
step;
|
|
478
|
-
|
|
479
|
-
var toRemove = [];
|
|
480
|
-
|
|
481
|
-
while ((step = iterator.next(), !step.done)) {
|
|
482
|
-
if (B.has(step.value))
|
|
483
|
-
toRemove.push(step.value);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
iterator = B.values();
|
|
487
|
-
|
|
488
|
-
while ((step = iterator.next(), !step.done)) {
|
|
489
|
-
if (!A.has(step.value))
|
|
490
|
-
A.add(step.value);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
for (var i = 0, l = toRemove.length; i < l; i++)
|
|
494
|
-
A.delete(toRemove[i]);
|
|
495
|
-
|
|
496
|
-
return;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Function returning the size of the intersection of A & B.
|
|
501
|
-
*
|
|
502
|
-
* @param {Set} A - First set.
|
|
503
|
-
* @param {Set} B - Second set.
|
|
504
|
-
* @return {number}
|
|
505
|
-
*/
|
|
506
|
-
exports.intersectionSize = function(A, B) {
|
|
507
|
-
var tmp;
|
|
508
|
-
|
|
509
|
-
// We need to know the smallest set
|
|
510
|
-
if (A.size > B.size) {
|
|
511
|
-
tmp = A;
|
|
512
|
-
A = B;
|
|
513
|
-
B = tmp;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if (A.size === 0)
|
|
517
|
-
return 0;
|
|
518
|
-
|
|
519
|
-
if (A === B)
|
|
520
|
-
return A.size;
|
|
521
|
-
|
|
522
|
-
var iterator = A.values(),
|
|
523
|
-
step;
|
|
524
|
-
|
|
525
|
-
var I = 0;
|
|
526
|
-
|
|
527
|
-
while ((step = iterator.next(), !step.done)) {
|
|
528
|
-
if (B.has(step.value))
|
|
529
|
-
I++;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
return I;
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Function returning the size of the union of A & B.
|
|
537
|
-
*
|
|
538
|
-
* @param {Set} A - First set.
|
|
539
|
-
* @param {Set} B - Second set.
|
|
540
|
-
* @return {number}
|
|
541
|
-
*/
|
|
542
|
-
exports.unionSize = function(A, B) {
|
|
543
|
-
var I = exports.intersectionSize(A, B);
|
|
544
|
-
|
|
545
|
-
return A.size + B.size - I;
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* Function returning the Jaccard similarity between A & B.
|
|
550
|
-
*
|
|
551
|
-
* @param {Set} A - First set.
|
|
552
|
-
* @param {Set} B - Second set.
|
|
553
|
-
* @return {number}
|
|
554
|
-
*/
|
|
555
|
-
exports.jaccard = function(A, B) {
|
|
556
|
-
var I = exports.intersectionSize(A, B);
|
|
557
|
-
|
|
558
|
-
if (I === 0)
|
|
559
|
-
return 0;
|
|
560
|
-
|
|
561
|
-
var U = A.size + B.size - I;
|
|
562
|
-
|
|
563
|
-
return I / U;
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* Function returning the overlap coefficient between A & B.
|
|
568
|
-
*
|
|
569
|
-
* @param {Set} A - First set.
|
|
570
|
-
* @param {Set} B - Second set.
|
|
571
|
-
* @return {number}
|
|
572
|
-
*/
|
|
573
|
-
exports.overlap = function(A, B) {
|
|
574
|
-
var I = exports.intersectionSize(A, B);
|
|
575
|
-
|
|
576
|
-
if (I === 0)
|
|
577
|
-
return 0;
|
|
578
|
-
|
|
579
|
-
return I / Math.min(A.size, B.size);
|
|
580
|
-
};
|
|
581
|
-
} (set));
|
|
582
|
-
return set;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
var setExports = /*@__PURE__*/ requireSet();
|
|
586
|
-
|
|
587
214
|
/**
|
|
588
215
|
* Mnemonist Stack
|
|
589
216
|
* ================
|
|
@@ -819,36 +446,10 @@ function commonHead(sources, targets, equals) {
|
|
|
819
446
|
);
|
|
820
447
|
}
|
|
821
448
|
|
|
822
|
-
function getOrCreate(map, key, create) {
|
|
823
|
-
let entry = map.get(key);
|
|
824
|
-
if (!entry) {
|
|
825
|
-
entry = create(key);
|
|
826
|
-
map.set(key, entry);
|
|
827
|
-
}
|
|
828
|
-
return entry;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
449
|
function isIterable(something) {
|
|
832
450
|
return l(something) && typeof something === "object" && Symbol.iterator in something;
|
|
833
451
|
}
|
|
834
452
|
|
|
835
|
-
function ifind(arg1, arg2) {
|
|
836
|
-
const pred = arg2 ?? arg1;
|
|
837
|
-
invariant(t(pred));
|
|
838
|
-
function _find(iter) {
|
|
839
|
-
for (const value of iter) {
|
|
840
|
-
if (pred(value)) {
|
|
841
|
-
return value;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
return;
|
|
845
|
-
}
|
|
846
|
-
if (!arg2) {
|
|
847
|
-
return _find;
|
|
848
|
-
}
|
|
849
|
-
return _find(arg1);
|
|
850
|
-
}
|
|
851
|
-
|
|
852
453
|
function iflat(iterable) {
|
|
853
454
|
return iterable ? _iflat(iterable) : _iflat;
|
|
854
455
|
}
|
|
@@ -859,23 +460,6 @@ function* _iflat(iterable) {
|
|
|
859
460
|
return;
|
|
860
461
|
}
|
|
861
462
|
|
|
862
|
-
function isome(arg1, arg2) {
|
|
863
|
-
const pred = arg2 ?? arg1;
|
|
864
|
-
invariant(t(pred));
|
|
865
|
-
function _some(iter) {
|
|
866
|
-
for (const value of iter) {
|
|
867
|
-
if (pred(value)) {
|
|
868
|
-
return true;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
return false;
|
|
872
|
-
}
|
|
873
|
-
if (!arg2) {
|
|
874
|
-
return _some;
|
|
875
|
-
}
|
|
876
|
-
return _some(arg1);
|
|
877
|
-
}
|
|
878
|
-
|
|
879
463
|
function iunique(iterable) {
|
|
880
464
|
return iterable ? _iunique(iterable) : _iunique;
|
|
881
465
|
}
|
|
@@ -890,77 +474,6 @@ function* _iunique(iterable) {
|
|
|
890
474
|
return;
|
|
891
475
|
}
|
|
892
476
|
|
|
893
|
-
function union(...sets) {
|
|
894
|
-
let result = /* @__PURE__ */ new Set();
|
|
895
|
-
for (const set of sets) {
|
|
896
|
-
for (const value of set) {
|
|
897
|
-
result.add(value);
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
return result;
|
|
901
|
-
}
|
|
902
|
-
function intersection(first, ...sets) {
|
|
903
|
-
let result = /* @__PURE__ */ new Set();
|
|
904
|
-
if (first.size === 0) {
|
|
905
|
-
return result;
|
|
906
|
-
}
|
|
907
|
-
let other = i$1(sets, 2) ? setExports.intersection(...sets) : sets[0];
|
|
908
|
-
if (other.size === 0) {
|
|
909
|
-
return result;
|
|
910
|
-
}
|
|
911
|
-
for (const value of first) {
|
|
912
|
-
if (other.has(value)) {
|
|
913
|
-
result.add(value);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
return result;
|
|
917
|
-
}
|
|
918
|
-
function difference(a, b) {
|
|
919
|
-
if (a.size === 0) {
|
|
920
|
-
return /* @__PURE__ */ new Set();
|
|
921
|
-
}
|
|
922
|
-
if (b.size === 0) {
|
|
923
|
-
return new Set(a);
|
|
924
|
-
}
|
|
925
|
-
let result = /* @__PURE__ */ new Set();
|
|
926
|
-
for (const value of a) {
|
|
927
|
-
if (!b.has(value)) {
|
|
928
|
-
result.add(value);
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
return result;
|
|
932
|
-
}
|
|
933
|
-
function equals(a, b) {
|
|
934
|
-
return a.size === b.size && [...a].every((value) => b.has(value));
|
|
935
|
-
}
|
|
936
|
-
function symmetricDifference(a, b) {
|
|
937
|
-
return setExports.symmetricDifference(a, b);
|
|
938
|
-
}
|
|
939
|
-
function hasIntersection(a, b) {
|
|
940
|
-
if (a.size === 0 || b.size === 0) {
|
|
941
|
-
return false;
|
|
942
|
-
}
|
|
943
|
-
if (b.size < a.size) {
|
|
944
|
-
[a, b] = [b, a];
|
|
945
|
-
}
|
|
946
|
-
for (const value of a) {
|
|
947
|
-
if (b.has(value)) {
|
|
948
|
-
return true;
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
return false;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
function stringHash(str) {
|
|
955
|
-
let hash = 5381;
|
|
956
|
-
const len = str.length;
|
|
957
|
-
invariant(len > 0, "stringHash: empty string");
|
|
958
|
-
for (let i = 0; i < len; i++) {
|
|
959
|
-
hash = hash * 33 ^ str.charCodeAt(i);
|
|
960
|
-
}
|
|
961
|
-
return (hash >>> 0).toString(36);
|
|
962
|
-
}
|
|
963
|
-
|
|
964
477
|
function commonjsRequire(path) {
|
|
965
478
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
966
479
|
}
|
|
@@ -992,4 +505,4 @@ function objectHash(value) {
|
|
|
992
505
|
});
|
|
993
506
|
}
|
|
994
507
|
|
|
995
|
-
export { Stack as S,
|
|
508
|
+
export { Stack as S, requireIterator as a, iunique as b, commonHead as c, d, iflat as e, isIterable as i, l, n, objectHash as o, requireForeach as r, u };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function t(r){return typeof r=="string"}
|
|
2
|
+
|
|
1
3
|
function nonNullable(value, message) {
|
|
2
4
|
if (typeof value === "undefined" || value == null) {
|
|
3
5
|
const msg = typeof message === "function" ? message() : message;
|
|
@@ -15,4 +17,4 @@ function nonexhaustive(value) {
|
|
|
15
17
|
throw new Error(`NonExhaustive value: ${value}`);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
export { nonexhaustive as a, invariant as i, nonNullable as n };
|
|
20
|
+
export { nonexhaustive as a, invariant as i, nonNullable as n, t };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mnemonist DefaultMap Typings
|
|
3
|
+
* =============================
|
|
4
|
+
*/
|
|
5
|
+
declare class DefaultMap<K, V> implements Iterable<[K, V]> {
|
|
6
|
+
|
|
7
|
+
// Members
|
|
8
|
+
size: number;
|
|
9
|
+
|
|
10
|
+
// Constructor
|
|
11
|
+
constructor(factory: (key: K, index: number) => V);
|
|
12
|
+
|
|
13
|
+
// Methods
|
|
14
|
+
clear(): void;
|
|
15
|
+
set(key: K, value: V): this;
|
|
16
|
+
delete(key: K): boolean;
|
|
17
|
+
has(key: K): boolean;
|
|
18
|
+
get(key: K): V;
|
|
19
|
+
peek(key: K): V | undefined;
|
|
20
|
+
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
21
|
+
keys(): IterableIterator<K>;
|
|
22
|
+
values(): IterableIterator<V>;
|
|
23
|
+
entries(): IterableIterator<[K, V]>;
|
|
24
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
25
|
+
inspect(): any;
|
|
26
|
+
|
|
27
|
+
// Statics
|
|
28
|
+
static autoIncrement(): number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { DefaultMap as D };
|