likec4 1.59.4 → 1.61.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 +2 -0
- package/__app__/codegen/react.mjs +4 -10
- package/__app__/codegen/webcomponent.mjs +6 -131
- package/__app__/index.html +15 -15
- package/__app__/src/aichat/index.mjs +11 -7
- package/__app__/src/chunks/AIChat.mjs +1355 -739
- package/__app__/src/chunks/ErrorComponent.mjs +444 -0
- package/__app__/src/chunks/Header.mjs +269 -0
- package/__app__/src/chunks/ViewReact.mjs +438 -0
- package/__app__/src/chunks/find.mjs +38 -0
- package/__app__/src/chunks/hooks.mjs +158 -472
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +340 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +11841 -1417
- package/__app__/src/chunks/libs/@tanstack.mjs +5110 -2404
- package/__app__/src/chunks/libs/fast-equals.mjs +507 -214
- package/__app__/src/chunks/libs/html-to-image.mjs +613 -0
- package/__app__/src/chunks/libs/nanostores.mjs +170 -0
- package/__app__/src/chunks/libs/react-resizable-panels.mjs +2792 -0
- package/__app__/src/chunks/react.mjs +22 -0
- package/__app__/src/chunks/rolldown-runtime.mjs +16 -29
- package/__app__/src/chunks/router.mjs +106 -0
- package/__app__/src/chunks/scope.mjs +106 -0
- package/__app__/src/chunks/searchParams.mjs +29 -0
- package/__app__/src/chunks/single-index.mjs +465 -0
- package/__app__/src/chunks/styled-system.mjs +1826 -2528
- package/__app__/src/chunks/useAsync.mjs +69 -0
- package/__app__/src/chunks/useSyncedRef.mjs +16 -0
- package/__app__/src/components/ColorSchemeToggle.mjs +124 -0
- package/__app__/src/components/CopyToClipboard.mjs +53 -0
- package/__app__/src/components/ErrorComponent.mjs +1 -0
- package/__app__/src/components/NavigationPanel.mjs +63 -0
- package/__app__/src/components/NotFound.mjs +155 -0
- package/__app__/src/components/ViewOutlet.mjs +9 -0
- package/__app__/src/components/model-diff/CompareModelProvider.mjs +44 -0
- package/__app__/src/components/model-diff/ModelDiffPanel.mjs +179 -0
- package/__app__/src/components/model-diff/compare-model.mjs +76 -0
- package/__app__/src/components/model-diff/state.mjs +45 -0
- package/__app__/src/components/search/OverviewSearch.mjs +92 -0
- package/__app__/src/components/search/OverviewSearchAdapter.mjs +94 -0
- package/__app__/src/components/sidebar/DiagramTree.css.mjs +48 -0
- package/__app__/src/components/sidebar/DiagramsTree.mjs +304 -0
- package/__app__/src/components/sidebar/Drawer.mjs +178 -0
- package/__app__/src/components/sidebar/SidebarBurger.mjs +28 -0
- package/__app__/src/components/sidebar/data.mjs +94 -0
- package/__app__/src/components/sidebar/state.mjs +16 -0
- package/__app__/src/components/view-page/Header.mjs +1 -0
- package/__app__/src/components/view-page/SelectProject.mjs +258 -0
- package/__app__/src/components/view-page/ShareModal.mjs +111 -0
- package/__app__/src/components/view-page/share-modal/AlertLocalhost.mjs +31 -0
- package/__app__/src/components/view-page/share-modal/CopyButtonChild.mjs +36 -0
- package/__app__/src/components/view-page/share-modal/EmbedPanel.mjs +100 -0
- package/__app__/src/components/view-page/share-modal/WebcomponentsPanel.mjs +264 -0
- package/__app__/src/components/view-page/state.mjs +17 -0
- package/__app__/src/context/LikeC4CustomizationContext.mjs +26 -0
- package/__app__/src/context/LikeC4IconRendererContext.mjs +29 -0
- package/__app__/src/context/LikeC4ModelContext.mjs +34 -0
- package/__app__/src/context/LikeC4ProjectsContext.mjs +40 -0
- package/__app__/src/context/ModelDiffsContext.mjs +33 -0
- package/__app__/src/context/safeCtx.mjs +14 -0
- package/__app__/src/fonts.css +112 -1
- package/__app__/src/hooks.mjs +1 -0
- package/__app__/src/main.mjs +6 -29151
- package/__app__/src/pages/EmbedPage.mjs +93 -0
- package/__app__/src/pages/ExportPage.mjs +691 -0
- package/__app__/src/pages/ProjectsOverview.mjs +23 -0
- package/__app__/src/pages/ViewAsD2.mjs +105 -0
- package/__app__/src/pages/ViewAsDot.mjs +65 -0
- package/__app__/src/pages/ViewAsMmd.mjs +109 -0
- package/__app__/src/pages/ViewAsPuml.mjs +105 -0
- package/__app__/src/pages/ViewEditor.mjs +220 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- package/__app__/src/pages/export-layout.mjs +95 -0
- package/__app__/src/pages/export-page-params.mjs +9 -0
- package/__app__/src/pages/styles.css.mjs +23 -0
- package/__app__/src/routeTree.gen.mjs +105 -0
- package/__app__/src/router.mjs +1 -0
- package/__app__/src/routes/__root.mjs +65 -0
- package/__app__/src/routes/index.css.mjs +29 -0
- package/__app__/src/routes/index.mjs +32 -0
- package/__app__/src/routes/project._projectId/-components.mjs +100 -0
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +5 -0
- package/__app__/src/routes/project._projectId/export._viewId.mjs +24 -0
- package/__app__/src/routes/project._projectId/index.mjs +14 -0
- package/__app__/src/routes/project._projectId/route.mjs +93 -0
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +34 -0
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +41 -0
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +7 -0
- package/__app__/src/routes/project._projectId/view._viewId.mjs +23 -0
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +39 -0
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +34 -0
- package/__app__/src/routes/projects.mjs +36 -0
- package/__app__/src/routes/single-index.mjs +1 -0
- package/__app__/src/routes/webcomponent._.mjs +94 -0
- package/__app__/src/style.css +18497 -1
- package/config/schema.json +146 -97
- package/dist/app/render-view-client.css +1 -1
- package/dist/app/render-view-client.js +394 -238
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +25 -17
- package/dist/chunks/generate-likec4.mjs +5 -0
- package/dist/chunks/index.d.mts +255 -194
- package/dist/chunks/index2.d.mts +8246 -3610
- package/dist/chunks/libs/@chenglou/pretext.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
- package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +2 -4
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
- package/dist/chunks/libs/birpc.mjs +1 -1
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +88 -36
- package/dist/chunks/libs/clone.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -1
- package/dist/chunks/libs/fast-equals.mjs +1 -0
- package/dist/chunks/libs/fontkit.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +4 -4
- package/dist/chunks/libs/langium.d.mts +6707 -6715
- package/dist/chunks/libs/langium.mjs +16 -24
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -1
- package/dist/chunks/libs/package-manager-detector.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +1 -1
- package/dist/chunks/libs/pathe.mjs +1 -1
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/node.mjs +111 -77
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +185 -166
- package/dist/cli/index.mjs +254 -1306
- package/dist/config/index.d.mts +66 -5
- package/dist/config/index.mjs +1 -1
- package/dist/generators/likec4.d.mts +6530 -0
- package/dist/generators/likec4.mjs +1 -0
- package/dist/index.d.mts +2 -4
- package/dist/model/index.d.mts +0 -7
- package/dist/vite-plugin/index.d.mts +83 -58
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +8 -0
- package/dist/vite-plugin/internal/index.d.mts +92 -17
- package/dist/vite-plugin/internal/index.mjs +225 -126
- package/generators/likec4/package.json +4 -0
- package/package.json +134 -122
- package/react/index.d.mts +7496 -26659
- package/react/index.mjs +533 -63936
- package/react/rolldown-runtime-CfRud99p.js +1 -0
- package/skills/likec4-dsl/SKILL.md +474 -0
- package/skills/likec4-dsl/evals/evals-public.json +207 -0
- package/skills/likec4-dsl/evals/grading-spec.json +603 -0
- package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
- package/skills/likec4-dsl/references/cli.md +168 -0
- package/skills/likec4-dsl/references/configuration.md +266 -0
- package/skills/likec4-dsl/references/deployment.md +160 -0
- package/skills/likec4-dsl/references/diffs.md +52 -0
- package/skills/likec4-dsl/references/dynamic-views.md +455 -0
- package/skills/likec4-dsl/references/examples.md +370 -0
- package/skills/likec4-dsl/references/identifier-validity.md +90 -0
- package/skills/likec4-dsl/references/include-predicates-wildcards.md +180 -0
- package/skills/likec4-dsl/references/model.md +182 -0
- package/skills/likec4-dsl/references/predicates.md +123 -0
- package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
- package/skills/likec4-dsl/references/specification.md +79 -0
- package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
- package/skills/likec4-dsl/references/troubleshooting.md +101 -0
- package/skills/likec4-dsl/references/views.md +329 -0
- package/vite-plugin-modules.d.ts +126 -51
- package/__app__/src/chunks/LikeC4Styles.mjs +0 -2306
- package/__app__/src/chunks/ProjectsOverview.mjs +0 -537
- package/__app__/src/chunks/es.mjs +0 -439
- package/__app__/src/chunks/libs/@floating-ui.mjs +0 -2532
- package/__app__/src/chunks/libs/@mantine.mjs +0 -13868
- package/__app__/src/chunks/libs/@xstate/react.mjs +0 -2015
- package/__app__/src/chunks/libs/@xyflow/react.mjs +0 -5367
- package/__app__/src/chunks/libs/bezier-js.mjs +0 -1007
- package/__app__/src/chunks/libs/d3.mjs +0 -2817
- package/__app__/src/chunks/libs/framer.mjs +0 -5926
- package/__app__/src/chunks/libs/zod.mjs +0 -3176
- package/dist/chunks/libs/@chevrotain/types.d.mts +0 -108
- package/dist/chunks/libs/picomatch.mjs +0 -1
- package/dist/chunks/libs/zod.d.mts +0 -3840
- package/dist/chunks/libs/zod.mjs +0 -65
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __name } from "./chunks/rolldown-runtime.mjs";
|
|
2
2
|
import { useCallback, useMemo, useRef, useSyncExternalStore } from "react";
|
|
3
|
+
import { LikeC4Model as LikeC4Model$1 } from "@likec4/core/model";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
// ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/atom/index.js
|
|
5
6
|
let listenerQueue = [];
|
|
6
7
|
let lqIndex = 0;
|
|
7
8
|
let batchSeen = null;
|
|
@@ -13,6 +14,11 @@ let drainQueue = () => {
|
|
|
13
14
|
while (lqIndex < listenerQueue.length) {
|
|
14
15
|
i = lqIndex;
|
|
15
16
|
lqIndex += QUEUE_ITEMS_PER_LISTENER;
|
|
17
|
+
let pendingStores = batchSeen?.get(listenerQueue[i]);
|
|
18
|
+
if (pendingStores) {
|
|
19
|
+
if (!pendingStores.has(listenerQueue[i + 1])) continue;
|
|
20
|
+
pendingStores.clear();
|
|
21
|
+
}
|
|
16
22
|
try {
|
|
17
23
|
listenerQueue[i](listenerQueue[i + 1].value, listenerQueue[i + 2], listenerQueue[i + 3]);
|
|
18
24
|
} catch (e) {
|
|
@@ -35,7 +41,8 @@ const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
|
|
|
35
41
|
listen(listener) {
|
|
36
42
|
$atom.lc = listeners.push(listener);
|
|
37
43
|
return () => {
|
|
38
|
-
|
|
44
|
+
batchSeen?.get(listener)?.delete($atom);
|
|
45
|
+
for (let i = lqIndex; i < listenerQueue.length;) if (listenerQueue[i] === listener && listenerQueue[i + 1] === $atom) listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
|
|
39
46
|
else i += QUEUE_ITEMS_PER_LISTENER;
|
|
40
47
|
let index = listeners.indexOf(listener);
|
|
41
48
|
if (~index) {
|
|
@@ -48,8 +55,12 @@ const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
|
|
|
48
55
|
nanostoresGlobal.epoch++;
|
|
49
56
|
let runListenerQueue = !listenerQueue.length && !batchSeen;
|
|
50
57
|
for (let listener of listeners) {
|
|
51
|
-
if (batchSeen
|
|
52
|
-
|
|
58
|
+
if (batchSeen) {
|
|
59
|
+
let pendingStores = batchSeen.get(listener);
|
|
60
|
+
if (!pendingStores) batchSeen.set(listener, pendingStores = /* @__PURE__ */ new Set());
|
|
61
|
+
if (pendingStores.has($atom)) continue;
|
|
62
|
+
pendingStores.add($atom);
|
|
63
|
+
}
|
|
53
64
|
listenerQueue.push(listener, $atom, oldValue, batchSeen ? void 0 : changedKey);
|
|
54
65
|
}
|
|
55
66
|
if (runListenerQueue) drainQueue();
|
|
@@ -72,8 +83,7 @@ const atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
|
|
|
72
83
|
return $atom;
|
|
73
84
|
};
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
//#region ../../node_modules/.pnpm/nanostores@1.5.3/node_modules/nanostores/lifecycle/index.js
|
|
86
|
+
// ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/lifecycle/index.js
|
|
77
87
|
const MOUNT = 5;
|
|
78
88
|
const UNMOUNT = 6;
|
|
79
89
|
const REVERT_MUTATION = 10;
|
|
@@ -133,8 +143,7 @@ let onMount = ($store, initialize) => {
|
|
|
133
143
|
});
|
|
134
144
|
};
|
|
135
145
|
|
|
136
|
-
|
|
137
|
-
//#region ../../node_modules/.pnpm/nanostores@1.5.3/node_modules/nanostores/computed/index.js
|
|
146
|
+
// ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/computed/index.js
|
|
138
147
|
let computedStore = (stores, cb, batched) => {
|
|
139
148
|
if (!Array.isArray(stores)) stores = [stores];
|
|
140
149
|
let previousArgs;
|
|
@@ -178,8 +187,7 @@ let computedStore = (stores, cb, batched) => {
|
|
|
178
187
|
const computed = /* @__NO_SIDE_EFFECTS__ */ (stores, fn) => computedStore(stores, fn);
|
|
179
188
|
const batched = /* @__NO_SIDE_EFFECTS__ */ (stores, fn) => computedStore(stores, fn, true);
|
|
180
189
|
|
|
181
|
-
|
|
182
|
-
//#region ../../node_modules/.pnpm/nanostores@1.5.3/node_modules/nanostores/deep-map/path.js
|
|
190
|
+
// ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/deep-map/path.js
|
|
183
191
|
function getPath(obj, path) {
|
|
184
192
|
let allKeys = getAllKeysFromPath(path);
|
|
185
193
|
let res = obj;
|
|
@@ -201,17 +209,16 @@ function getKeyAndIndicesFromKey(key) {
|
|
|
201
209
|
return [key];
|
|
202
210
|
}
|
|
203
211
|
|
|
204
|
-
|
|
205
|
-
//#region ../../node_modules/.pnpm/nanostores@1.5.3/node_modules/nanostores/listen-keys/index.js
|
|
212
|
+
// ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/listen-keys/index.js
|
|
206
213
|
function listenKeys($store, keys, listener) {
|
|
207
214
|
let keysSet = new Set(keys);
|
|
208
215
|
return $store.listen((value, oldValue, changed) => {
|
|
209
|
-
|
|
216
|
+
let pathChanged = (key) => !Object.is(getPath(value, key), getPath(oldValue, key));
|
|
217
|
+
if (changed === void 0 ? keys.some((key) => oldValue === void 0 || ($store.eqKey ? !$store.eqKey(oldValue[key], value[key], key) : pathChanged(key))) : keysSet.has(changed) || typeof changed === "string" && (keysSet.has(changed.split(/\.|\[/)[0]) || !$store.eqKey && oldValue !== void 0 && keys.some(pathChanged))) listener(value, oldValue, changed);
|
|
210
218
|
});
|
|
211
219
|
}
|
|
212
220
|
|
|
213
|
-
|
|
214
|
-
//#region ../../node_modules/.pnpm/nanostores@1.5.3/node_modules/nanostores/map/index.js
|
|
221
|
+
// ../../node_modules/.pnpm/nanostores@1.5.5/node_modules/nanostores/map/index.js
|
|
215
222
|
const map = /* @__NO_SIDE_EFFECTS__ */ (initial = {}) => {
|
|
216
223
|
let $map = /* @__PURE__ */ atom(initial);
|
|
217
224
|
$map.eqKey = Object.is;
|
|
@@ -232,8 +239,7 @@ const map = /* @__NO_SIDE_EFFECTS__ */ (initial = {}) => {
|
|
|
232
239
|
return $map;
|
|
233
240
|
};
|
|
234
241
|
|
|
235
|
-
|
|
236
|
-
//#region ../../node_modules/.pnpm/@nanostores+react@1.1.0_nanostores@1.5.3_react@19.2.8/node_modules/@nanostores/react/index.js
|
|
242
|
+
// ../../node_modules/.pnpm/@nanostores+react@2.0.1_nanostores@1.5.5_react@19.3.1/node_modules/@nanostores/react/index.js
|
|
237
243
|
let emit = (snapshotRef, onChange) => (value) => {
|
|
238
244
|
if (snapshotRef.current === value) return;
|
|
239
245
|
snapshotRef.current = value;
|
|
@@ -252,8 +258,7 @@ function useStore(store, { keys, deps = [store, keys], ssr } = {}) {
|
|
|
252
258
|
return useSyncExternalStore(subscribe, get, server);
|
|
253
259
|
}
|
|
254
260
|
|
|
255
|
-
|
|
256
|
-
//#region ../../node_modules/.pnpm/birpc@4.2.0/node_modules/birpc/dist/index.mjs
|
|
261
|
+
// ../../node_modules/.pnpm/birpc@4.2.0/node_modules/birpc/dist/index.mjs
|
|
257
262
|
function createPromiseWithResolvers() {
|
|
258
263
|
let resolve;
|
|
259
264
|
let reject;
|
|
@@ -401,7 +406,8 @@ function createBirpc($functions, options) {
|
|
|
401
406
|
}
|
|
402
407
|
if (msg.t === "q") {
|
|
403
408
|
const { m: method, a: args, o: optional } = msg;
|
|
404
|
-
let result
|
|
409
|
+
let result;
|
|
410
|
+
let error;
|
|
405
411
|
let fn = await (resolver ? resolver.call(rpc, method, $functions[method]) : $functions[method]);
|
|
406
412
|
if (optional) fn ||= () => void 0;
|
|
407
413
|
if (!fn) error = /* @__PURE__ */ new Error(`[birpc] function "${method}" not found`);
|
|
@@ -450,10 +456,28 @@ function createBirpc($functions, options) {
|
|
|
450
456
|
return rpc;
|
|
451
457
|
}
|
|
452
458
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
const {
|
|
456
|
-
const
|
|
459
|
+
// ../../node_modules/.pnpm/fast-equals@6.2.2/node_modules/fast-equals/dist/es/index.mjs
|
|
460
|
+
const { getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
461
|
+
const { hasOwnProperty, toString: toString$1 } = Object.prototype;
|
|
462
|
+
const OBJECT_TAG = "[object Object]";
|
|
463
|
+
/**
|
|
464
|
+
* Whether the own properties from `end` onward are equal with strict property checking, where the
|
|
465
|
+
* caller has already verified that both objects have the same number of own properties.
|
|
466
|
+
*/
|
|
467
|
+
function areStrictPropertiesEqual(a, b, state, properties, end) {
|
|
468
|
+
let index = properties.length;
|
|
469
|
+
let property;
|
|
470
|
+
let descriptorA;
|
|
471
|
+
let descriptorB;
|
|
472
|
+
while (index-- > end) {
|
|
473
|
+
property = properties[index];
|
|
474
|
+
if (!isReactProperty(a, b, property) && (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state))) return false;
|
|
475
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
476
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
477
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
|
|
478
|
+
}
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
457
481
|
/**
|
|
458
482
|
* Combine two comparators into a single comparators.
|
|
459
483
|
*/
|
|
@@ -491,14 +515,51 @@ function getStrictProperties(object) {
|
|
|
491
515
|
return symbols.length ? getOwnPropertyNames(object).concat(symbols) : getOwnPropertyNames(object);
|
|
492
516
|
}
|
|
493
517
|
/**
|
|
518
|
+
* Identify the element type of TypedArrays across realms and subclasses.
|
|
519
|
+
*/
|
|
520
|
+
const getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
521
|
+
/**
|
|
494
522
|
* Whether the object contains the property passed as an own property.
|
|
495
523
|
*/
|
|
496
524
|
const hasOwn = Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
525
|
+
/**
|
|
526
|
+
* Whether a null-prototype object is being compared with a plain object. Only one side can be
|
|
527
|
+
* null-prototype when the constructors differ. The other side must be a plain object by
|
|
528
|
+
* constructor, or by tag when it comes from another realm.
|
|
529
|
+
*/
|
|
530
|
+
function isNullPrototypeComparable(a, b) {
|
|
531
|
+
const aConstructor = a.constructor;
|
|
532
|
+
const bConstructor = b.constructor;
|
|
533
|
+
if (aConstructor == null) return bConstructor === Object || toString$1.call(b) === OBJECT_TAG;
|
|
534
|
+
if (bConstructor == null) return aConstructor === Object || toString$1.call(a) === OBJECT_TAG;
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Whether the property passed is a property specific to React/Preact elements. These are ignored in comparison, as they
|
|
539
|
+
* are deeply circular and will return frequent false negatives for the comparison that matters, which is often the
|
|
540
|
+
* React element's aspects (`props`, `type`, etc.).
|
|
541
|
+
*/
|
|
542
|
+
function isReactProperty(a, b, property) {
|
|
543
|
+
return (property === "_owner" || property === "__o" || property === "__v") && !!(a.$$typeof || b.$$typeof);
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Reorder a serialized query string so that params holding the same pairs compare as equal
|
|
547
|
+
* regardless of the order they appear in.
|
|
548
|
+
*
|
|
549
|
+
* @note
|
|
550
|
+
* The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
|
|
551
|
+
* splitting on `&` recovers exactly the pairs and nothing else.
|
|
552
|
+
*/
|
|
553
|
+
function sortSearchParams(serialized) {
|
|
554
|
+
return serialized.split("&").sort().join("&");
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Above this many keys, out-of-position keys are checked with `propertyIsEnumerable` rather than by
|
|
558
|
+
* scanning the other object's keys. Measured in V8: scanning wins up to 50 keys and loses from 100.
|
|
559
|
+
*/
|
|
560
|
+
const MAX_SCANNED_PROPERTIES = 64;
|
|
561
|
+
const { keys } = Object;
|
|
562
|
+
const { propertyIsEnumerable } = Object.prototype;
|
|
502
563
|
/**
|
|
503
564
|
* Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
|
|
504
565
|
* Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
|
|
@@ -554,13 +615,49 @@ function areDatesEqual(a, b) {
|
|
|
554
615
|
*
|
|
555
616
|
* @note
|
|
556
617
|
* `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
|
|
557
|
-
* explicitly. `cause`
|
|
558
|
-
* nested value in the comparison is treated.
|
|
559
|
-
*
|
|
560
|
-
*
|
|
618
|
+
* explicitly. `cause` and `errors` are compared by value rather than by reference, matching how
|
|
619
|
+
* every other nested value in the comparison is treated. They are compared exactly once, regardless
|
|
620
|
+
* of whether they were assigned (enumerable) or set by the constructor (non-enumerable). Other own
|
|
621
|
+
* enumerable properties (which custom `Error` subclasses commonly add) are compared afterward.
|
|
622
|
+
*
|
|
623
|
+
* The own property comparison is inlined rather than extracted, which measured faster in V8 when
|
|
624
|
+
* recursing through `cause`. Keep the bytecode under V8's 460-byte TurboFan inlining limit (383 bytes
|
|
625
|
+
* at time of writing; check with `node --print-bytecode --print-bytecode-filter=areErrorsEqual`), or
|
|
626
|
+
* this stops being inlined into its callers.
|
|
561
627
|
*/
|
|
562
628
|
function areErrorsEqual(a, b, state) {
|
|
563
|
-
|
|
629
|
+
if (a.name !== b.name || a.message !== b.message || a.stack !== b.stack) return false;
|
|
630
|
+
const causeA = a.cause;
|
|
631
|
+
const causeB = b.cause;
|
|
632
|
+
if (causeA !== causeB && !state.equals(causeA, causeB, "cause", "cause", a, b, state)) return false;
|
|
633
|
+
const errorsA = a.errors;
|
|
634
|
+
const errorsB = b.errors;
|
|
635
|
+
if (errorsA !== errorsB && !state.equals(errorsA, errorsB, "errors", "errors", a, b, state)) return false;
|
|
636
|
+
const propertiesA = keys(a);
|
|
637
|
+
const propertiesB = keys(b);
|
|
638
|
+
let index = propertiesA.length;
|
|
639
|
+
if (!index && !propertiesB.length) return true;
|
|
640
|
+
let compared = 0;
|
|
641
|
+
let property;
|
|
642
|
+
while (index-- > 0) {
|
|
643
|
+
property = propertiesA[index];
|
|
644
|
+
if (property === "cause" || property === "errors") continue;
|
|
645
|
+
if (property !== propertiesB[index] && !propertyIsEnumerable.call(b, property) || !state.equals(a[property], b[property], property, property, a, b, state)) return false;
|
|
646
|
+
++compared;
|
|
647
|
+
}
|
|
648
|
+
const remaining = propertiesB.length - compared;
|
|
649
|
+
return !remaining || remaining === (propertyIsEnumerable.call(b, "cause") ? 1 : 0) + (propertyIsEnumerable.call(b, "errors") ? 1 : 0);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Whether the errors passed are equal in value.
|
|
653
|
+
*
|
|
654
|
+
* @note
|
|
655
|
+
* `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
|
|
656
|
+
* explicitly. `cause` and `errors` are own properties, so `areObjectsEqualStrict` compares them along
|
|
657
|
+
* with every other own property; they are not compared explicitly to avoid comparing them twice.
|
|
658
|
+
*/
|
|
659
|
+
function areErrorsEqualStrict(a, b, state) {
|
|
660
|
+
return a.name === b.name && a.message === b.message && a.stack === b.stack && areObjectsEqualStrict(a, b, state);
|
|
564
661
|
}
|
|
565
662
|
/**
|
|
566
663
|
* Whether the `Map`s are equal in value.
|
|
@@ -569,7 +666,7 @@ function areMapsEqual(a, b, state) {
|
|
|
569
666
|
const size = a.size;
|
|
570
667
|
if (size !== b.size) return false;
|
|
571
668
|
if (!size) return true;
|
|
572
|
-
const matchedIndices = new
|
|
669
|
+
const matchedIndices = new Array(size);
|
|
573
670
|
const aIterable = a.entries();
|
|
574
671
|
let aResult;
|
|
575
672
|
let bResult;
|
|
@@ -577,7 +674,7 @@ function areMapsEqual(a, b, state) {
|
|
|
577
674
|
while (aResult = aIterable.next()) {
|
|
578
675
|
if (aResult.done) break;
|
|
579
676
|
const bIterable = b.entries();
|
|
580
|
-
let hasMatch =
|
|
677
|
+
let hasMatch = false;
|
|
581
678
|
let matchIndex = 0;
|
|
582
679
|
while (bResult = bIterable.next()) {
|
|
583
680
|
if (bResult.done) break;
|
|
@@ -588,7 +685,7 @@ function areMapsEqual(a, b, state) {
|
|
|
588
685
|
const aEntry = aResult.value;
|
|
589
686
|
const bEntry = bResult.value;
|
|
590
687
|
if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
|
|
591
|
-
hasMatch = matchedIndices[matchIndex] =
|
|
688
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
592
689
|
break;
|
|
593
690
|
}
|
|
594
691
|
matchIndex++;
|
|
@@ -603,9 +700,16 @@ function areMapsEqual(a, b, state) {
|
|
|
603
700
|
*/
|
|
604
701
|
function areObjectsEqual(a, b, state) {
|
|
605
702
|
const properties = keys(a);
|
|
703
|
+
const propertiesB = keys(b);
|
|
606
704
|
let index = properties.length;
|
|
607
|
-
if (
|
|
608
|
-
|
|
705
|
+
if (propertiesB.length !== index) return false;
|
|
706
|
+
const isScannable = index <= MAX_SCANNED_PROPERTIES;
|
|
707
|
+
let property;
|
|
708
|
+
while (index-- > 0) {
|
|
709
|
+
property = properties[index];
|
|
710
|
+
if (isReactProperty(a, b, property)) continue;
|
|
711
|
+
if (property !== propertiesB[index] && !(isScannable ? propertiesB.includes(property) : propertyIsEnumerable.call(b, property)) || !state.equals(a[property], b[property], property, property, a, b, state)) return false;
|
|
712
|
+
}
|
|
609
713
|
return true;
|
|
610
714
|
}
|
|
611
715
|
/**
|
|
@@ -613,19 +717,7 @@ function areObjectsEqual(a, b, state) {
|
|
|
613
717
|
*/
|
|
614
718
|
function areObjectsEqualStrict(a, b, state) {
|
|
615
719
|
const properties = getStrictProperties(a);
|
|
616
|
-
|
|
617
|
-
if (getStrictProperties(b).length !== index) return false;
|
|
618
|
-
let property;
|
|
619
|
-
let descriptorA;
|
|
620
|
-
let descriptorB;
|
|
621
|
-
while (index-- > 0) {
|
|
622
|
-
property = properties[index];
|
|
623
|
-
if (!isPropertyEqual(a, b, state, property)) return false;
|
|
624
|
-
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
625
|
-
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
626
|
-
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
|
|
627
|
-
}
|
|
628
|
-
return true;
|
|
720
|
+
return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, 0);
|
|
629
721
|
}
|
|
630
722
|
/**
|
|
631
723
|
* Whether the primitive wrappers passed are equal in value.
|
|
@@ -640,25 +732,38 @@ function areRegExpsEqual(a, b) {
|
|
|
640
732
|
return a.source === b.source && a.flags === b.flags;
|
|
641
733
|
}
|
|
642
734
|
/**
|
|
735
|
+
* Whether the search params passed are equal in value.
|
|
736
|
+
*
|
|
737
|
+
* @note
|
|
738
|
+
* Order is not significant, matching how the other unordered collections in the library are
|
|
739
|
+
* compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
|
|
740
|
+
* `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
|
|
741
|
+
*/
|
|
742
|
+
function areSearchParamsEqual(a, b) {
|
|
743
|
+
const serializedA = a.toString();
|
|
744
|
+
const serializedB = b.toString();
|
|
745
|
+
return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
643
748
|
* Whether the `Set`s are equal in value.
|
|
644
749
|
*/
|
|
645
750
|
function areSetsEqual(a, b, state) {
|
|
646
751
|
const size = a.size;
|
|
647
752
|
if (size !== b.size) return false;
|
|
648
753
|
if (!size) return true;
|
|
649
|
-
const matchedIndices = new
|
|
754
|
+
const matchedIndices = new Array(size);
|
|
650
755
|
const aIterable = a.values();
|
|
651
756
|
let aResult;
|
|
652
757
|
let bResult;
|
|
653
758
|
while (aResult = aIterable.next()) {
|
|
654
759
|
if (aResult.done) break;
|
|
655
760
|
const bIterable = b.values();
|
|
656
|
-
let hasMatch =
|
|
761
|
+
let hasMatch = false;
|
|
657
762
|
let matchIndex = 0;
|
|
658
763
|
while (bResult = bIterable.next()) {
|
|
659
764
|
if (bResult.done) break;
|
|
660
765
|
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
661
|
-
hasMatch = matchedIndices[matchIndex] =
|
|
766
|
+
hasMatch = matchedIndices[matchIndex] = true;
|
|
662
767
|
break;
|
|
663
768
|
}
|
|
664
769
|
matchIndex++;
|
|
@@ -673,7 +778,8 @@ function areSetsEqual(a, b, state) {
|
|
|
673
778
|
function areTypedArraysEqual(a, b) {
|
|
674
779
|
let index = a.length;
|
|
675
780
|
if (b.length !== index || a.byteOffset !== b.byteOffset) return false;
|
|
676
|
-
|
|
781
|
+
const tag = getTypedArrayTag.call(a);
|
|
782
|
+
if (tag === "Float64Array" || tag === "Float32Array" || tag === "Float16Array") {
|
|
677
783
|
while (index-- > 0) if (a[index] !== b[index] && (a[index] === a[index] || b[index] === b[index])) return false;
|
|
678
784
|
return true;
|
|
679
785
|
}
|
|
@@ -681,47 +787,57 @@ function areTypedArraysEqual(a, b) {
|
|
|
681
787
|
return true;
|
|
682
788
|
}
|
|
683
789
|
/**
|
|
684
|
-
* Whether the
|
|
685
|
-
*/
|
|
686
|
-
function areUrlsEqual(a, b) {
|
|
687
|
-
if (a.href === b.href) return true;
|
|
688
|
-
return a.protocol === b.protocol && a.username === b.username && a.password === b.password && a.host === b.host && a.pathname === b.pathname && a.hash === b.hash && areSearchParamsEqual(a.searchParams, b.searchParams);
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Whether the search params passed are equal in value.
|
|
790
|
+
* Whether the TypedArray instances are equal in value with strict property checking.
|
|
692
791
|
*
|
|
693
792
|
* @note
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
793
|
+
* Indexed elements are also own properties, listed first and in order, with descriptors fixed by the
|
|
794
|
+
* spec. They are compared once by `areTypedArraysEqual`, so only the own properties after them
|
|
795
|
+
* (including symbols) are compared with strict property checking.
|
|
697
796
|
*/
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
const
|
|
701
|
-
return
|
|
797
|
+
function areTypedArraysEqualStrict(a, b, state) {
|
|
798
|
+
if (!areTypedArraysEqual(a, b)) return false;
|
|
799
|
+
const properties = getStrictProperties(a);
|
|
800
|
+
return getStrictProperties(b).length === properties.length && areStrictPropertiesEqual(a, b, state, properties, a.length);
|
|
702
801
|
}
|
|
703
802
|
/**
|
|
704
|
-
*
|
|
705
|
-
* regardless of the order they appear in.
|
|
706
|
-
*
|
|
707
|
-
* @note
|
|
708
|
-
* The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
|
|
709
|
-
* splitting on `&` recovers exactly the pairs and nothing else.
|
|
803
|
+
* Whether the URL instances are equal in value.
|
|
710
804
|
*/
|
|
711
|
-
function
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
function isPropertyEqual(a, b, state, property) {
|
|
715
|
-
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) return true;
|
|
716
|
-
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
805
|
+
function areUrlsEqual(a, b) {
|
|
806
|
+
if (a.href === b.href) return true;
|
|
807
|
+
return a.protocol === b.protocol && a.username === b.username && a.password === b.password && a.host === b.host && a.pathname === b.pathname && a.hash === b.hash && areSearchParamsEqual(a.searchParams, b.searchParams);
|
|
717
808
|
}
|
|
718
|
-
const toString = Object.prototype
|
|
809
|
+
const { toString } = Object.prototype;
|
|
719
810
|
/**
|
|
720
811
|
* Create a comparator method based on the type-specific equality comparators passed.
|
|
721
812
|
*/
|
|
722
813
|
function createEqualityComparator(config) {
|
|
723
814
|
const supportedComparatorMap = createSupportedComparatorMap(config);
|
|
724
|
-
const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator } = config;
|
|
815
|
+
const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator, strictNullPrototypeComparison } = config;
|
|
816
|
+
/**
|
|
817
|
+
* Whether the custom objects are equal in value, based on their string tag. If not matching any tags
|
|
818
|
+
* that require a specific type of comparison, then we hard-code false because the only thing remaining
|
|
819
|
+
* is strict equality, which has already been compared. This is for a few reasons:
|
|
820
|
+
* - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
|
|
821
|
+
* comparison that can be made.
|
|
822
|
+
* - For types that can be introspected but do not have an objective definition of what
|
|
823
|
+
* equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
|
|
824
|
+
* In all cases, these decisions should be reevaluated based on changes to the language and
|
|
825
|
+
* common development practices.
|
|
826
|
+
*
|
|
827
|
+
* Capturing the tag is reasonably performant in modern environments like v8 and SpiderMonkey. This is
|
|
828
|
+
* kept out of the main comparator so that it stays within the engine's bytecode budget for inlining.
|
|
829
|
+
* See [#207](https://github.com/planttheidea/fast-equals/pull/207) for more details.
|
|
830
|
+
*/
|
|
831
|
+
const areTaggedObjectsEqual = getUnsupportedCustomComparator ? function areTaggedObjectsEqual(a, b, state) {
|
|
832
|
+
const tag = toString.call(a);
|
|
833
|
+
const supportedComparator = supportedComparatorMap[tag];
|
|
834
|
+
if (supportedComparator) return supportedComparator(a, b, state);
|
|
835
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag);
|
|
836
|
+
return unsupportedCustomComparator ? unsupportedCustomComparator(a, b, state) : false;
|
|
837
|
+
} : function areTaggedObjectsEqual(a, b, state) {
|
|
838
|
+
const supportedComparator = supportedComparatorMap[toString.call(a)];
|
|
839
|
+
return supportedComparator ? supportedComparator(a, b, state) : false;
|
|
840
|
+
};
|
|
725
841
|
/**
|
|
726
842
|
* compare the value of the two objects and return true if they are equivalent in values
|
|
727
843
|
*/
|
|
@@ -736,33 +852,29 @@ function createEqualityComparator(config) {
|
|
|
736
852
|
return false;
|
|
737
853
|
}
|
|
738
854
|
const constructor = a.constructor;
|
|
739
|
-
if (constructor !== b.constructor) return false;
|
|
855
|
+
if (constructor !== b.constructor) return strictNullPrototypeComparison ? false : isNullPrototypeComparable(a, b) && areObjectsEqual(a, b, state);
|
|
740
856
|
if (constructor === Object) return areObjectsEqual(a, b, state);
|
|
741
857
|
if (constructor === Array) return areArraysEqual(a, b, state);
|
|
742
858
|
if (constructor === Date) return areDatesEqual(a, b, state);
|
|
743
859
|
if (constructor === RegExp) return areRegExpsEqual(a, b, state);
|
|
744
860
|
if (constructor === Map) return areMapsEqual(a, b, state);
|
|
745
861
|
if (constructor === Set) return areSetsEqual(a, b, state);
|
|
862
|
+
if (constructor == null) return areObjectsEqual(a, b, state);
|
|
746
863
|
if (constructor === Promise) return false;
|
|
747
864
|
if (Array.isArray(a)) return areArraysEqual(a, b, state);
|
|
748
|
-
|
|
749
|
-
const supportedComparator = supportedComparatorMap[tag];
|
|
750
|
-
if (supportedComparator) return supportedComparator(a, b, state);
|
|
751
|
-
const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);
|
|
752
|
-
if (unsupportedCustomComparator) return unsupportedCustomComparator(a, b, state);
|
|
753
|
-
return false;
|
|
865
|
+
return areTaggedObjectsEqual(a, b, state);
|
|
754
866
|
};
|
|
755
867
|
}
|
|
756
868
|
/**
|
|
757
869
|
* Create the configuration object used for building comparators.
|
|
758
870
|
*/
|
|
759
|
-
function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
|
|
871
|
+
function createEqualityComparatorConfig({ circular, createCustomConfig, strict, strictNullPrototypeComparison = true }) {
|
|
760
872
|
let config = {
|
|
761
873
|
areArrayBuffersEqual,
|
|
762
874
|
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
763
875
|
areDataViewsEqual,
|
|
764
|
-
areDatesEqual,
|
|
765
|
-
areErrorsEqual: strict ?
|
|
876
|
+
areDatesEqual: strict ? combineComparators(areDatesEqual, areObjectsEqualStrict) : areDatesEqual,
|
|
877
|
+
areErrorsEqual: strict ? areErrorsEqualStrict : areErrorsEqual,
|
|
766
878
|
areFunctionsEqual: strictEqual,
|
|
767
879
|
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
768
880
|
areNumbersEqual: sameValueEqual,
|
|
@@ -770,23 +882,28 @@ function createEqualityComparatorConfig({ circular, createCustomConfig, strict }
|
|
|
770
882
|
arePrimitiveWrappersEqual,
|
|
771
883
|
areRegExpsEqual,
|
|
772
884
|
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
773
|
-
areTypedArraysEqual: strict ?
|
|
885
|
+
areTypedArraysEqual: strict ? areTypedArraysEqualStrict : areTypedArraysEqual,
|
|
774
886
|
areUrlsEqual,
|
|
775
|
-
getUnsupportedCustomComparator: void 0
|
|
887
|
+
getUnsupportedCustomComparator: void 0,
|
|
888
|
+
strictNullPrototypeComparison
|
|
776
889
|
};
|
|
777
890
|
if (createCustomConfig) config = Object.assign({}, config, createCustomConfig(config));
|
|
778
891
|
if (circular) {
|
|
779
892
|
const areArraysEqual = createIsCircular(config.areArraysEqual);
|
|
893
|
+
const areDatesEqual = strict ? createIsCircular(config.areDatesEqual) : config.areDatesEqual;
|
|
780
894
|
const areErrorsEqual = createIsCircular(config.areErrorsEqual);
|
|
781
895
|
const areMapsEqual = createIsCircular(config.areMapsEqual);
|
|
782
896
|
const areObjectsEqual = createIsCircular(config.areObjectsEqual);
|
|
783
897
|
const areSetsEqual = createIsCircular(config.areSetsEqual);
|
|
898
|
+
const areTypedArraysEqual = strict ? createIsCircular(config.areTypedArraysEqual) : config.areTypedArraysEqual;
|
|
784
899
|
config = Object.assign({}, config, {
|
|
785
900
|
areArraysEqual,
|
|
901
|
+
areDatesEqual,
|
|
786
902
|
areErrorsEqual,
|
|
787
903
|
areMapsEqual,
|
|
788
904
|
areObjectsEqual,
|
|
789
|
-
areSetsEqual
|
|
905
|
+
areSetsEqual,
|
|
906
|
+
areTypedArraysEqual
|
|
790
907
|
});
|
|
791
908
|
}
|
|
792
909
|
return config;
|
|
@@ -935,27 +1052,13 @@ function createCustomEqual(options = {}) {
|
|
|
935
1052
|
});
|
|
936
1053
|
}
|
|
937
1054
|
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
function e(e, t, n) {
|
|
941
|
-
let r = (n) => e(n, ...t);
|
|
942
|
-
return n === void 0 ? r : Object.assign(r, {
|
|
943
|
-
lazy: n,
|
|
944
|
-
lazyArgs: t
|
|
945
|
-
});
|
|
946
|
-
}
|
|
1055
|
+
// ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/dataLastImplementation-D-BXl-Tn.js
|
|
1056
|
+
const e = (e, t) => t.length === 1 ? (n) => e(n, t[0]) : (n) => e(n, ...t);
|
|
947
1057
|
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
function t$1(t, n, r) {
|
|
951
|
-
let i = t.length - n.length;
|
|
952
|
-
if (i === 0) return t(...n);
|
|
953
|
-
if (i === 1) return e(t, n, r);
|
|
954
|
-
throw Error(`Wrong number of arguments`);
|
|
955
|
-
}
|
|
1058
|
+
// ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/purry.js
|
|
1059
|
+
const t$1 = /* @__PURE__ */ __name((t, n) => n.length >= t.length ? t(...n) : e(t, n), "t");
|
|
956
1060
|
|
|
957
|
-
|
|
958
|
-
//#region ../../node_modules/.pnpm/remeda@2.45.0/node_modules/remeda/dist/mapValues.js
|
|
1061
|
+
// ../../node_modules/.pnpm/remeda@2.52.0/node_modules/remeda/dist/mapValues.js
|
|
959
1062
|
function t(...t) {
|
|
960
1063
|
return t$1(n, t);
|
|
961
1064
|
}
|
|
@@ -965,11 +1068,7 @@ function n(e, t) {
|
|
|
965
1068
|
return n;
|
|
966
1069
|
}
|
|
967
1070
|
|
|
968
|
-
|
|
969
|
-
//#region ../vite-plugin/src/internal.ts
|
|
970
|
-
/**
|
|
971
|
-
* This module is used by the Vite plugin to generate the virtual modules
|
|
972
|
-
*/
|
|
1071
|
+
// ../vite-plugin/src/internal.ts
|
|
973
1072
|
/**
|
|
974
1073
|
* Create a PluginRPC instance for the LikeC4 Vite plugin
|
|
975
1074
|
* used by the Vite plugin in virtual modules
|
|
@@ -991,7 +1090,7 @@ function createRpc(options) {
|
|
|
991
1090
|
});
|
|
992
1091
|
}
|
|
993
1092
|
function createHooksForModel($atom) {
|
|
994
|
-
const $likec4model = /* @__PURE__ */ computed($atom, (data) => LikeC4Model.create(data));
|
|
1093
|
+
const $likec4model = /* @__PURE__ */ computed($atom, (data) => LikeC4Model$1.create(data));
|
|
995
1094
|
function updateModel(data) {
|
|
996
1095
|
const current = $atom.get();
|
|
997
1096
|
const next = {
|
|
@@ -1020,9 +1119,9 @@ function createHooksForModel($atom) {
|
|
|
1020
1119
|
$likec4model,
|
|
1021
1120
|
useLikeC4Model,
|
|
1022
1121
|
useLikeC4Views,
|
|
1023
|
-
useLikeC4View
|
|
1122
|
+
useLikeC4View,
|
|
1123
|
+
isLikeC4ViewId: (id) => typeof id === "string" && Object.hasOwn($atom.get().views, id)
|
|
1024
1124
|
};
|
|
1025
1125
|
}
|
|
1026
1126
|
|
|
1027
|
-
//#endregion
|
|
1028
1127
|
export { atom, batched, computed, createHooksForModel, createRpc, map, useStore };
|