likec4 1.59.3 → 1.60.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/__app__/codegen/react.mjs +6 -6
- package/__app__/codegen/webcomponent.mjs +147 -69
- package/__app__/src/aichat/index.mjs +10 -5
- package/__app__/src/chunks/AIChat.mjs +1134 -693
- package/__app__/src/chunks/LikeC4Styles.mjs +4101 -1737
- package/__app__/src/chunks/ProjectsOverview.mjs +624 -334
- package/__app__/src/chunks/es.mjs +515 -335
- package/__app__/src/chunks/hooks.mjs +578 -366
- package/__app__/src/chunks/libs/@floating-ui.mjs +2720 -1966
- package/__app__/src/chunks/libs/@mantine.mjs +14067 -9487
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +2266 -1146
- package/__app__/src/chunks/libs/@tanstack.mjs +3152 -1932
- package/__app__/src/chunks/libs/@xstate/react.mjs +2924 -1468
- package/__app__/src/chunks/libs/@xyflow/react.mjs +6627 -4067
- package/__app__/src/chunks/libs/bezier-js.mjs +1312 -726
- package/__app__/src/chunks/libs/d3.mjs +3218 -1509
- package/__app__/src/chunks/libs/fast-equals.mjs +437 -201
- package/__app__/src/chunks/libs/framer.mjs +9251 -3846
- package/__app__/src/chunks/libs/nanostores.mjs +174 -0
- package/__app__/src/chunks/libs/zod.mjs +4591 -2363
- package/__app__/src/chunks/rolldown-runtime.mjs +39 -23
- package/__app__/src/chunks/styled-system.mjs +3538 -756
- package/__app__/src/fonts.css +112 -1
- package/__app__/src/main.mjs +44398 -24039
- package/__app__/src/style.css +18488 -1
- package/config/schema.json +136 -97
- package/dist/app/render-view-client.css +1 -1
- package/dist/app/render-view-client.js +506 -338
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +16 -14
- package/dist/chunks/generate-likec4.mjs +5 -0
- package/dist/chunks/index.d.mts +246 -180
- package/dist/chunks/index2.d.mts +2882 -1977
- package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
- package/dist/chunks/libs/@chevrotain/types.d.mts +111 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
- 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 +87 -35
- package/dist/chunks/libs/eventemitter3.mjs +1 -1
- package/dist/chunks/libs/json5.mjs +4 -4
- package/dist/chunks/libs/langium.d.mts +9903 -5297
- 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 +2 -2
- 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 +60 -60
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +55 -52
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.mjs +208 -1300
- package/dist/config/index.d.mts +2 -2
- package/dist/generators/likec4.d.mts +6578 -0
- package/dist/generators/likec4.mjs +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/model/index.d.mts +8 -5
- package/dist/vite-plugin/index.d.mts +6 -3
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +9 -0
- package/dist/vite-plugin/internal/index.d.mts +16 -15
- package/dist/vite-plugin/internal/index.mjs +144 -46
- package/generators/likec4/package.json +4 -0
- package/package.json +117 -110
- package/react/index.d.mts +8500 -5399
- package/react/index.mjs +534 -58617
- package/react/rolldown-runtime-DnkiqaRY.js +1 -0
- package/skills/likec4-dsl/SKILL.md +428 -0
- package/skills/likec4-dsl/evals/evals-public.json +202 -0
- package/skills/likec4-dsl/evals/grading-spec.json +589 -0
- package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
- package/skills/likec4-dsl/references/cli.md +139 -0
- package/skills/likec4-dsl/references/configuration.md +266 -0
- package/skills/likec4-dsl/references/deployment.md +160 -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 +179 -0
- package/skills/likec4-dsl/references/model.md +151 -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 +75 -0
- package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
- package/skills/likec4-dsl/references/troubleshooting.md +96 -0
- package/skills/likec4-dsl/references/views.md +329 -0
- package/vite-plugin-modules.d.ts +4 -2
- package/dist/chunks/libs/picomatch.mjs +0 -1
- package/dist/chunks/libs/zod.d.mts +0 -2140
- package/dist/chunks/libs/zod.mjs +0 -65
|
@@ -1,269 +1,505 @@
|
|
|
1
1
|
import "../rolldown-runtime.mjs";
|
|
2
|
-
//#region ../../node_modules/.pnpm/fast-equals@6.
|
|
3
|
-
var { getOwnPropertyNames
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
//#region ../../node_modules/.pnpm/fast-equals@6.1.1/node_modules/fast-equals/dist/es/index.mjs
|
|
3
|
+
var { getOwnPropertyNames, getOwnPropertySymbols } = Object;
|
|
4
|
+
var { hasOwnProperty, toString: toString$1 } = Object.prototype;
|
|
5
|
+
var OBJECT_TAG = "[object Object]";
|
|
6
|
+
/**
|
|
7
|
+
* Combine two comparators into a single comparators.
|
|
8
|
+
*/
|
|
9
|
+
function combineComparators(comparatorA, comparatorB) {
|
|
10
|
+
return function isEqual(a, b, state) {
|
|
11
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
7
12
|
};
|
|
8
13
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Wrap the provided `areItemsEqual` method to manage the circular state, allowing
|
|
16
|
+
* for circular references to be safely included in the comparison without creating
|
|
17
|
+
* stack overflows.
|
|
18
|
+
*/
|
|
19
|
+
function createIsCircular(areItemsEqual) {
|
|
20
|
+
return function isCircular(a, b, state) {
|
|
21
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") return areItemsEqual(a, b, state);
|
|
22
|
+
const { cache } = state;
|
|
23
|
+
const cachedA = cache.get(a);
|
|
24
|
+
const cachedB = cache.get(b);
|
|
25
|
+
if (cachedA && cachedB) return cachedA === b && cachedB === a;
|
|
26
|
+
cache.set(a, b);
|
|
27
|
+
cache.set(b, a);
|
|
28
|
+
const result = areItemsEqual(a, b, state);
|
|
29
|
+
cache.delete(a);
|
|
30
|
+
cache.delete(b);
|
|
31
|
+
return result;
|
|
17
32
|
};
|
|
18
33
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Get the properties to strictly examine, which include both own properties that are
|
|
36
|
+
* not enumerable and symbol properties.
|
|
37
|
+
*/
|
|
38
|
+
function getStrictProperties(object) {
|
|
39
|
+
const symbols = getOwnPropertySymbols(object);
|
|
40
|
+
return symbols.length ? getOwnPropertyNames(object).concat(symbols) : getOwnPropertyNames(object);
|
|
22
41
|
}
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Whether the object contains the property passed as an own property.
|
|
44
|
+
*/
|
|
45
|
+
var hasOwn = Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
|
|
46
|
+
/**
|
|
47
|
+
* Whether a null-prototype object is being compared with a plain object. Only one side can be
|
|
48
|
+
* null-prototype when the constructors differ. The other side must be a plain object by
|
|
49
|
+
* constructor, or by tag when it comes from another realm.
|
|
50
|
+
*/
|
|
51
|
+
function isNullPrototypeComparable(a, b) {
|
|
52
|
+
const aConstructor = a.constructor;
|
|
53
|
+
const bConstructor = b.constructor;
|
|
54
|
+
if (aConstructor == null) return bConstructor === Object || toString$1.call(b) === OBJECT_TAG;
|
|
55
|
+
if (bConstructor == null) return aConstructor === Object || toString$1.call(a) === OBJECT_TAG;
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
var PREACT_VNODE = "__v";
|
|
59
|
+
var PREACT_OWNER = "__o";
|
|
60
|
+
var REACT_OWNER = "_owner";
|
|
61
|
+
var { getOwnPropertyDescriptor, keys } = Object;
|
|
62
|
+
/**
|
|
63
|
+
* Identify the element type of TypedArrays across realms and subclasses.
|
|
64
|
+
*/
|
|
65
|
+
var getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
|
|
68
|
+
* Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
|
|
69
|
+
*
|
|
70
|
+
* @note
|
|
71
|
+
* When available in the environment, this is just a re-export of the global
|
|
72
|
+
* [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) method.
|
|
73
|
+
*/
|
|
74
|
+
var sameValueEqual = Object.is || function sameValueEqual(a, b) {
|
|
75
|
+
return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
|
|
25
76
|
};
|
|
26
|
-
|
|
27
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Whether the values passed are equal based on a
|
|
79
|
+
* [Strict Equality Comparison](https://262.ecma-international.org/7.0/#sec-strict-equality-comparison) basis.
|
|
80
|
+
* Simplified, this maps to if the two values are referentially equal to one another (`a === b`).
|
|
81
|
+
*
|
|
82
|
+
* @note
|
|
83
|
+
* This is mainly available as a convenience function, such as being a default when a function to determine equality between
|
|
84
|
+
* two objects is used.
|
|
85
|
+
*/
|
|
86
|
+
function strictEqual(a, b) {
|
|
87
|
+
return a === b;
|
|
28
88
|
}
|
|
29
|
-
|
|
30
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Whether the array buffers are equal in value.
|
|
91
|
+
*/
|
|
92
|
+
function areArrayBuffersEqual(a, b) {
|
|
93
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
|
|
31
94
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Whether the arrays are equal in value.
|
|
97
|
+
*/
|
|
98
|
+
function areArraysEqual(a, b, state) {
|
|
99
|
+
let index = a.length;
|
|
100
|
+
if (b.length !== index) return false;
|
|
101
|
+
while (index-- > 0) if (!state.equals(a[index], b[index], index, index, a, b, state)) return false;
|
|
102
|
+
return true;
|
|
37
103
|
}
|
|
38
|
-
|
|
39
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Whether the dataviews are equal in value.
|
|
106
|
+
*/
|
|
107
|
+
function areDataViewsEqual(a, b) {
|
|
108
|
+
return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
|
|
40
109
|
}
|
|
41
|
-
|
|
42
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Whether the dates passed are equal in value.
|
|
112
|
+
*/
|
|
113
|
+
function areDatesEqual(a, b) {
|
|
114
|
+
return sameValueEqual(a.getTime(), b.getTime());
|
|
43
115
|
}
|
|
44
|
-
|
|
45
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Whether the errors passed are equal in value.
|
|
118
|
+
*
|
|
119
|
+
* @note
|
|
120
|
+
* `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
|
|
121
|
+
* explicitly. `cause` is compared by value rather than by reference, matching how every other
|
|
122
|
+
* nested value in the comparison is treated. Own enumerable properties (which custom `Error`
|
|
123
|
+
* subclasses commonly add) are compared by composing this with the object comparator in the
|
|
124
|
+
* comparator config, so that the strict and circular variants apply to them as well.
|
|
125
|
+
*/
|
|
126
|
+
function areErrorsEqual(a, b, state) {
|
|
127
|
+
return a.name === b.name && a.message === b.message && a.stack === b.stack && state.equals(a.cause, b.cause, "cause", "cause", a, b, state);
|
|
46
128
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Whether the `Map`s are equal in value.
|
|
131
|
+
*/
|
|
132
|
+
function areMapsEqual(a, b, state) {
|
|
133
|
+
const size = a.size;
|
|
134
|
+
if (size !== b.size) return false;
|
|
135
|
+
if (!size) return true;
|
|
136
|
+
const matchedIndices = new Uint8Array(size);
|
|
137
|
+
const aIterable = a.entries();
|
|
138
|
+
let aResult;
|
|
139
|
+
let bResult;
|
|
140
|
+
let index = 0;
|
|
141
|
+
while (aResult = aIterable.next()) {
|
|
142
|
+
if (aResult.done) break;
|
|
143
|
+
const bIterable = b.entries();
|
|
144
|
+
let hasMatch = 0;
|
|
145
|
+
let matchIndex = 0;
|
|
146
|
+
while (bResult = bIterable.next()) {
|
|
147
|
+
if (bResult.done) break;
|
|
148
|
+
if (matchedIndices[matchIndex]) {
|
|
149
|
+
matchIndex++;
|
|
57
150
|
continue;
|
|
58
151
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
152
|
+
const aEntry = aResult.value;
|
|
153
|
+
const bEntry = bResult.value;
|
|
154
|
+
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)) {
|
|
155
|
+
hasMatch = matchedIndices[matchIndex] = 1;
|
|
62
156
|
break;
|
|
63
157
|
}
|
|
64
|
-
|
|
158
|
+
matchIndex++;
|
|
65
159
|
}
|
|
66
|
-
if (!
|
|
67
|
-
|
|
160
|
+
if (!hasMatch) return false;
|
|
161
|
+
index++;
|
|
68
162
|
}
|
|
69
|
-
return
|
|
163
|
+
return true;
|
|
70
164
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Whether the objects are equal in value.
|
|
167
|
+
*/
|
|
168
|
+
function areObjectsEqual(a, b, state) {
|
|
169
|
+
const properties = keys(a);
|
|
170
|
+
let index = properties.length;
|
|
171
|
+
if (keys(b).length !== index) return false;
|
|
172
|
+
while (index-- > 0) if (!isPropertyEqual(a, b, state, properties[index])) return false;
|
|
173
|
+
return true;
|
|
76
174
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Whether the objects are equal in value with strict property checking.
|
|
177
|
+
*/
|
|
178
|
+
function areObjectsEqualStrict(a, b, state) {
|
|
179
|
+
const properties = getStrictProperties(a);
|
|
180
|
+
let index = properties.length;
|
|
181
|
+
if (getStrictProperties(b).length !== index) return false;
|
|
182
|
+
let property;
|
|
183
|
+
let descriptorA;
|
|
184
|
+
let descriptorB;
|
|
185
|
+
while (index-- > 0) {
|
|
186
|
+
property = properties[index];
|
|
187
|
+
if (!isPropertyEqual(a, b, state, property)) return false;
|
|
188
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
189
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
190
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
83
193
|
}
|
|
84
|
-
|
|
85
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Whether the primitive wrappers passed are equal in value.
|
|
196
|
+
*/
|
|
197
|
+
function arePrimitiveWrappersEqual(a, b) {
|
|
198
|
+
return sameValueEqual(a.valueOf(), b.valueOf());
|
|
86
199
|
}
|
|
87
|
-
|
|
88
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Whether the regexps passed are equal in value.
|
|
202
|
+
*/
|
|
203
|
+
function areRegExpsEqual(a, b) {
|
|
204
|
+
return a.source === b.source && a.flags === b.flags;
|
|
89
205
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Whether the `Set`s are equal in value.
|
|
208
|
+
*/
|
|
209
|
+
function areSetsEqual(a, b, state) {
|
|
210
|
+
const size = a.size;
|
|
211
|
+
if (size !== b.size) return false;
|
|
212
|
+
if (!size) return true;
|
|
213
|
+
const matchedIndices = new Uint8Array(size);
|
|
214
|
+
const aIterable = a.values();
|
|
215
|
+
let aResult;
|
|
216
|
+
let bResult;
|
|
217
|
+
while (aResult = aIterable.next()) {
|
|
218
|
+
if (aResult.done) break;
|
|
219
|
+
const bIterable = b.values();
|
|
220
|
+
let hasMatch = 0;
|
|
221
|
+
let matchIndex = 0;
|
|
222
|
+
while (bResult = bIterable.next()) {
|
|
223
|
+
if (bResult.done) break;
|
|
224
|
+
if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
|
|
225
|
+
hasMatch = matchedIndices[matchIndex] = 1;
|
|
100
226
|
break;
|
|
101
227
|
}
|
|
102
|
-
|
|
228
|
+
matchIndex++;
|
|
103
229
|
}
|
|
104
|
-
if (!
|
|
230
|
+
if (!hasMatch) return false;
|
|
231
|
+
}
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Whether the TypedArray instances are equal in value.
|
|
236
|
+
*/
|
|
237
|
+
function areTypedArraysEqual(a, b) {
|
|
238
|
+
let index = a.length;
|
|
239
|
+
if (b.length !== index || a.byteOffset !== b.byteOffset) return false;
|
|
240
|
+
const tag = getTypedArrayTag.call(a);
|
|
241
|
+
if (tag === "Float64Array" || tag === "Float32Array" || tag === "Float16Array") {
|
|
242
|
+
while (index-- > 0) if (a[index] !== b[index] && (a[index] === a[index] || b[index] === b[index])) return false;
|
|
243
|
+
return true;
|
|
105
244
|
}
|
|
106
|
-
return
|
|
245
|
+
while (index-- > 0) if (a[index] !== b[index]) return false;
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Whether the URL instances are equal in value.
|
|
250
|
+
*/
|
|
251
|
+
function areUrlsEqual(a, b) {
|
|
252
|
+
if (a.href === b.href) return true;
|
|
253
|
+
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);
|
|
107
254
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
255
|
+
/**
|
|
256
|
+
* Whether the search params passed are equal in value.
|
|
257
|
+
*
|
|
258
|
+
* @note
|
|
259
|
+
* Order is not significant, matching how the other unordered collections in the library are
|
|
260
|
+
* compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
|
|
261
|
+
* `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
|
|
262
|
+
*/
|
|
263
|
+
function areSearchParamsEqual(a, b) {
|
|
264
|
+
const serializedA = a.toString();
|
|
265
|
+
const serializedB = b.toString();
|
|
266
|
+
return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
|
|
113
267
|
}
|
|
114
|
-
|
|
115
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Reorder a serialized query string so that params holding the same pairs compare as equal
|
|
270
|
+
* regardless of the order they appear in.
|
|
271
|
+
*
|
|
272
|
+
* @note
|
|
273
|
+
* The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
|
|
274
|
+
* splitting on `&` recovers exactly the pairs and nothing else.
|
|
275
|
+
*/
|
|
276
|
+
function sortSearchParams(serialized) {
|
|
277
|
+
return serialized.split("&").sort().join("&");
|
|
116
278
|
}
|
|
117
|
-
function isPropertyEqual(
|
|
118
|
-
|
|
279
|
+
function isPropertyEqual(a, b, state, property) {
|
|
280
|
+
if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) return true;
|
|
281
|
+
return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
|
|
119
282
|
}
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
283
|
+
var { toString } = Object.prototype;
|
|
284
|
+
/**
|
|
285
|
+
* Create a comparator method based on the type-specific equality comparators passed.
|
|
286
|
+
*/
|
|
287
|
+
function createEqualityComparator(config) {
|
|
288
|
+
const supportedComparatorMap = createSupportedComparatorMap(config);
|
|
289
|
+
const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator, strictNullPrototypeComparison } = config;
|
|
290
|
+
/**
|
|
291
|
+
* Whether the custom objects are equal in value, based on their string tag. If not matching any tags
|
|
292
|
+
* that require a specific type of comparison, then we hard-code false because the only thing remaining
|
|
293
|
+
* is strict equality, which has already been compared. This is for a few reasons:
|
|
294
|
+
* - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
|
|
295
|
+
* comparison that can be made.
|
|
296
|
+
* - For types that can be introspected but do not have an objective definition of what
|
|
297
|
+
* equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
|
|
298
|
+
* In all cases, these decisions should be reevaluated based on changes to the language and
|
|
299
|
+
* common development practices.
|
|
300
|
+
*
|
|
301
|
+
* Capturing the tag is reasonably performant in modern environments like v8 and SpiderMonkey. This is
|
|
302
|
+
* kept out of the main comparator so that it stays within the engine's bytecode budget for inlining.
|
|
303
|
+
* See [#207](https://github.com/planttheidea/fast-equals/pull/207) for more details.
|
|
304
|
+
*/
|
|
305
|
+
const areTaggedObjectsEqual = getUnsupportedCustomComparator ? function areTaggedObjectsEqual(a, b, state) {
|
|
306
|
+
const tag = toString.call(a);
|
|
307
|
+
const supportedComparator = supportedComparatorMap[tag];
|
|
308
|
+
if (supportedComparator) return supportedComparator(a, b, state);
|
|
309
|
+
const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag);
|
|
310
|
+
return unsupportedCustomComparator ? unsupportedCustomComparator(a, b, state) : false;
|
|
311
|
+
} : function areTaggedObjectsEqual(a, b, state) {
|
|
312
|
+
const supportedComparator = supportedComparatorMap[toString.call(a)];
|
|
313
|
+
return supportedComparator ? supportedComparator(a, b, state) : false;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* compare the value of the two objects and return true if they are equivalent in values
|
|
317
|
+
*/
|
|
318
|
+
return function comparator(a, b, state) {
|
|
319
|
+
if (a === b) return true;
|
|
320
|
+
if (a == null || b == null) return false;
|
|
321
|
+
const type = typeof a;
|
|
322
|
+
if (type !== typeof b) return false;
|
|
323
|
+
if (type !== "object") {
|
|
324
|
+
if (type === "number" || type === "bigint") return areNumbersEqual(a, b, state);
|
|
325
|
+
if (type === "function") return areFunctionsEqual(a, b, state);
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
const constructor = a.constructor;
|
|
329
|
+
if (constructor !== b.constructor) return strictNullPrototypeComparison ? false : isNullPrototypeComparable(a, b) && areObjectsEqual(a, b, state);
|
|
330
|
+
if (constructor === Object) return areObjectsEqual(a, b, state);
|
|
331
|
+
if (constructor === Array) return areArraysEqual(a, b, state);
|
|
332
|
+
if (constructor === Date) return areDatesEqual(a, b, state);
|
|
333
|
+
if (constructor === RegExp) return areRegExpsEqual(a, b, state);
|
|
334
|
+
if (constructor === Map) return areMapsEqual(a, b, state);
|
|
335
|
+
if (constructor === Set) return areSetsEqual(a, b, state);
|
|
336
|
+
if (constructor == null) return areObjectsEqual(a, b, state);
|
|
337
|
+
if (constructor === Promise) return false;
|
|
338
|
+
if (Array.isArray(a)) return areArraysEqual(a, b, state);
|
|
339
|
+
return areTaggedObjectsEqual(a, b, state);
|
|
143
340
|
};
|
|
144
341
|
}
|
|
145
|
-
|
|
146
|
-
|
|
342
|
+
/**
|
|
343
|
+
* Create the configuration object used for building comparators.
|
|
344
|
+
*/
|
|
345
|
+
function createEqualityComparatorConfig({ circular, createCustomConfig, strict, strictNullPrototypeComparison = true }) {
|
|
346
|
+
let config = {
|
|
147
347
|
areArrayBuffersEqual,
|
|
148
|
-
areArraysEqual:
|
|
348
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
149
349
|
areDataViewsEqual,
|
|
150
350
|
areDatesEqual,
|
|
151
|
-
areErrorsEqual,
|
|
351
|
+
areErrorsEqual: strict ? combineComparators(areErrorsEqual, areObjectsEqualStrict) : combineComparators(areErrorsEqual, areObjectsEqual),
|
|
152
352
|
areFunctionsEqual: strictEqual,
|
|
153
|
-
areMapsEqual:
|
|
154
|
-
areNumbersEqual:
|
|
155
|
-
areObjectsEqual:
|
|
353
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
354
|
+
areNumbersEqual: sameValueEqual,
|
|
355
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
156
356
|
arePrimitiveWrappersEqual,
|
|
157
357
|
areRegExpsEqual,
|
|
158
|
-
areSetsEqual:
|
|
159
|
-
areTypedArraysEqual:
|
|
358
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
359
|
+
areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
|
|
160
360
|
areUrlsEqual,
|
|
161
|
-
getUnsupportedCustomComparator: void 0
|
|
361
|
+
getUnsupportedCustomComparator: void 0,
|
|
362
|
+
strictNullPrototypeComparison
|
|
162
363
|
};
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
364
|
+
if (createCustomConfig) config = Object.assign({}, config, createCustomConfig(config));
|
|
365
|
+
if (circular) {
|
|
366
|
+
const areArraysEqual = createIsCircular(config.areArraysEqual);
|
|
367
|
+
const areErrorsEqual = createIsCircular(config.areErrorsEqual);
|
|
368
|
+
const areMapsEqual = createIsCircular(config.areMapsEqual);
|
|
369
|
+
const areObjectsEqual = createIsCircular(config.areObjectsEqual);
|
|
370
|
+
const areSetsEqual = createIsCircular(config.areSetsEqual);
|
|
371
|
+
config = Object.assign({}, config, {
|
|
372
|
+
areArraysEqual,
|
|
373
|
+
areErrorsEqual,
|
|
374
|
+
areMapsEqual,
|
|
375
|
+
areObjectsEqual,
|
|
376
|
+
areSetsEqual
|
|
170
377
|
});
|
|
171
378
|
}
|
|
172
|
-
return
|
|
379
|
+
return config;
|
|
173
380
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
381
|
+
/**
|
|
382
|
+
* Default equality comparator pass-through, used as the standard `isEqual` creator for
|
|
383
|
+
* use inside the built comparator.
|
|
384
|
+
*/
|
|
385
|
+
function createInternalEqualityComparator(compare) {
|
|
386
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
|
387
|
+
return compare(a, b, state);
|
|
177
388
|
};
|
|
178
389
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
390
|
+
/**
|
|
391
|
+
* Create the `isEqual` function used by the consuming application.
|
|
392
|
+
*/
|
|
393
|
+
function createIsEqual({ circular, comparator, createState, equals, strict }) {
|
|
394
|
+
if (createState) return function isEqual(a, b) {
|
|
395
|
+
const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
|
|
396
|
+
return comparator(a, b, {
|
|
397
|
+
cache,
|
|
398
|
+
equals,
|
|
399
|
+
meta,
|
|
400
|
+
strict
|
|
187
401
|
});
|
|
188
402
|
};
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
403
|
+
if (circular) return function isEqual(a, b) {
|
|
404
|
+
return comparator(a, b, {
|
|
191
405
|
cache: /* @__PURE__ */ new WeakMap(),
|
|
192
|
-
equals
|
|
406
|
+
equals,
|
|
193
407
|
meta: void 0,
|
|
194
|
-
strict
|
|
408
|
+
strict
|
|
195
409
|
});
|
|
196
410
|
};
|
|
197
|
-
|
|
411
|
+
const state = {
|
|
198
412
|
cache: void 0,
|
|
199
|
-
equals
|
|
413
|
+
equals,
|
|
200
414
|
meta: void 0,
|
|
201
|
-
strict
|
|
415
|
+
strict
|
|
202
416
|
};
|
|
203
|
-
return function isEqual(
|
|
204
|
-
return
|
|
417
|
+
return function isEqual(a, b) {
|
|
418
|
+
return comparator(a, b, state);
|
|
205
419
|
};
|
|
206
420
|
}
|
|
207
|
-
|
|
421
|
+
/**
|
|
422
|
+
* Create a map of `toString()` values to their respective handlers for `tag`-based lookups.
|
|
423
|
+
*/
|
|
424
|
+
function createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual }) {
|
|
208
425
|
return {
|
|
209
|
-
"[object Arguments]":
|
|
210
|
-
"[object Array]":
|
|
211
|
-
"[object ArrayBuffer]":
|
|
212
|
-
"[object AsyncGeneratorFunction]":
|
|
213
|
-
"[object BigInt]":
|
|
214
|
-
"[object BigInt64Array]":
|
|
215
|
-
"[object BigUint64Array]":
|
|
216
|
-
"[object Boolean]":
|
|
217
|
-
"[object DataView]":
|
|
218
|
-
"[object Date]":
|
|
219
|
-
"[object Error]":
|
|
220
|
-
"[object Float16Array]":
|
|
221
|
-
"[object Float32Array]":
|
|
222
|
-
"[object Float64Array]":
|
|
223
|
-
"[object Function]":
|
|
224
|
-
"[object GeneratorFunction]":
|
|
225
|
-
"[object Int8Array]":
|
|
226
|
-
"[object Int16Array]":
|
|
227
|
-
"[object Int32Array]":
|
|
228
|
-
"[object Map]":
|
|
229
|
-
"[object Number]":
|
|
230
|
-
"[object Object]": (
|
|
231
|
-
"[object RegExp]":
|
|
232
|
-
"[object Set]":
|
|
233
|
-
"[object String]":
|
|
234
|
-
"[object URL]":
|
|
235
|
-
"[object Uint8Array]":
|
|
236
|
-
"[object Uint8ClampedArray]":
|
|
237
|
-
"[object Uint16Array]":
|
|
238
|
-
"[object Uint32Array]":
|
|
426
|
+
"[object Arguments]": areObjectsEqual,
|
|
427
|
+
"[object Array]": areArraysEqual,
|
|
428
|
+
"[object ArrayBuffer]": areArrayBuffersEqual,
|
|
429
|
+
"[object AsyncGeneratorFunction]": areFunctionsEqual,
|
|
430
|
+
"[object BigInt]": arePrimitiveWrappersEqual,
|
|
431
|
+
"[object BigInt64Array]": areTypedArraysEqual,
|
|
432
|
+
"[object BigUint64Array]": areTypedArraysEqual,
|
|
433
|
+
"[object Boolean]": arePrimitiveWrappersEqual,
|
|
434
|
+
"[object DataView]": areDataViewsEqual,
|
|
435
|
+
"[object Date]": areDatesEqual,
|
|
436
|
+
"[object Error]": areErrorsEqual,
|
|
437
|
+
"[object Float16Array]": areTypedArraysEqual,
|
|
438
|
+
"[object Float32Array]": areTypedArraysEqual,
|
|
439
|
+
"[object Float64Array]": areTypedArraysEqual,
|
|
440
|
+
"[object Function]": areFunctionsEqual,
|
|
441
|
+
"[object GeneratorFunction]": areFunctionsEqual,
|
|
442
|
+
"[object Int8Array]": areTypedArraysEqual,
|
|
443
|
+
"[object Int16Array]": areTypedArraysEqual,
|
|
444
|
+
"[object Int32Array]": areTypedArraysEqual,
|
|
445
|
+
"[object Map]": areMapsEqual,
|
|
446
|
+
"[object Number]": arePrimitiveWrappersEqual,
|
|
447
|
+
"[object Object]": (a, b, state) => typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual(a, b, state),
|
|
448
|
+
"[object RegExp]": areRegExpsEqual,
|
|
449
|
+
"[object Set]": areSetsEqual,
|
|
450
|
+
"[object String]": arePrimitiveWrappersEqual,
|
|
451
|
+
"[object URL]": areUrlsEqual,
|
|
452
|
+
"[object Uint8Array]": areTypedArraysEqual,
|
|
453
|
+
"[object Uint8ClampedArray]": areTypedArraysEqual,
|
|
454
|
+
"[object Uint16Array]": areTypedArraysEqual,
|
|
455
|
+
"[object Uint32Array]": areTypedArraysEqual
|
|
239
456
|
};
|
|
240
457
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
458
|
+
/**
|
|
459
|
+
* Whether the items passed are deeply-equal in value.
|
|
460
|
+
*/
|
|
461
|
+
var deepEqual = createCustomEqual();
|
|
462
|
+
createCustomEqual({ strict: true });
|
|
463
|
+
createCustomEqual({ circular: true });
|
|
464
|
+
createCustomEqual({
|
|
465
|
+
circular: true,
|
|
466
|
+
strict: true
|
|
467
|
+
});
|
|
468
|
+
/**
|
|
469
|
+
* Whether the items passed are shallowly-equal in value.
|
|
470
|
+
*/
|
|
471
|
+
var shallowEqual = createCustomEqual({ createInternalComparator: () => sameValueEqual });
|
|
472
|
+
createCustomEqual({
|
|
473
|
+
strict: true,
|
|
474
|
+
createInternalComparator: () => sameValueEqual
|
|
475
|
+
});
|
|
476
|
+
createCustomEqual({
|
|
477
|
+
circular: true,
|
|
478
|
+
createInternalComparator: () => sameValueEqual
|
|
245
479
|
});
|
|
246
|
-
var f = createCustomEqual({ createInternalComparator: () => l });
|
|
247
480
|
createCustomEqual({
|
|
248
|
-
|
|
249
|
-
createInternalComparator: () =>
|
|
250
|
-
|
|
251
|
-
circular: !0,
|
|
252
|
-
createInternalComparator: () => l
|
|
253
|
-
}), createCustomEqual({
|
|
254
|
-
circular: !0,
|
|
255
|
-
createInternalComparator: () => l,
|
|
256
|
-
strict: !0
|
|
481
|
+
circular: true,
|
|
482
|
+
createInternalComparator: () => sameValueEqual,
|
|
483
|
+
strict: true
|
|
257
484
|
});
|
|
258
|
-
|
|
259
|
-
|
|
485
|
+
/**
|
|
486
|
+
* Create a custom equality comparison method.
|
|
487
|
+
*
|
|
488
|
+
* This can be done to create very targeted comparisons in extreme hot-path scenarios
|
|
489
|
+
* where the standard methods are not performant enough, but can also be used to provide
|
|
490
|
+
* support for legacy environments that do not support expected features like
|
|
491
|
+
* `RegExp.prototype.flags` out of the box.
|
|
492
|
+
*/
|
|
493
|
+
function createCustomEqual(options = {}) {
|
|
494
|
+
const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
|
|
495
|
+
const comparator = createEqualityComparator(createEqualityComparatorConfig(options));
|
|
260
496
|
return createIsEqual({
|
|
261
|
-
circular
|
|
262
|
-
comparator
|
|
263
|
-
createState
|
|
264
|
-
equals:
|
|
265
|
-
strict
|
|
497
|
+
circular,
|
|
498
|
+
comparator,
|
|
499
|
+
createState,
|
|
500
|
+
equals: createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator),
|
|
501
|
+
strict
|
|
266
502
|
});
|
|
267
503
|
}
|
|
268
504
|
//#endregion
|
|
269
|
-
export {
|
|
505
|
+
export { shallowEqual as n, deepEqual as t };
|