@quadrel-enterprise-ui/framework 21.13.3 → 21.13.4

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.
@@ -7696,17 +7696,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
7696
7696
  * two errors with the same name and message stay equal despite different stacks.
7697
7697
  * - `WeakMap` and `WeakSet` have no readable content and are only equal to
7698
7698
  * themselves.
7699
+ * - Values on `Object.prototype` skip the slot check and count as plain
7700
+ * objects, as in Node. This keeps large form values fast.
7699
7701
  * - Structures deeper than 1200 levels report a difference instead of exhausting
7700
7702
  * the call stack.
7701
7703
  */
7702
- const qdIsDeepEqual = (left, right) => compare(left, right, {
7703
- positions: new Map(),
7704
- partners: new Map(),
7705
- results: new Map(),
7706
- assumptions: 0,
7707
- depth: 0,
7708
- nextPosition: 0
7709
- });
7704
+ const qdIsDeepEqual = (left, right) => quickCompare(left, right, new Set(), 0) ??
7705
+ compare(left, right, {
7706
+ positions: new Map(),
7707
+ partners: new Map(),
7708
+ results: new Map(),
7709
+ assumptions: 0,
7710
+ depth: 0,
7711
+ nextPosition: 0
7712
+ });
7710
7713
  const MAX_DEPTH = 1200;
7711
7714
  const getterOf = (target, key) => Object.getOwnPropertyDescriptor(target, key)?.get;
7712
7715
  const TYPED_ARRAY_PROTOTYPE = Object.getPrototypeOf(Int8Array.prototype);
@@ -7738,6 +7741,15 @@ const survives = (probe) => {
7738
7741
  };
7739
7742
  const callable = (reader, value) => survives(() => reader.call(value));
7740
7743
  const isSameValueZero = (left, right) => left === right || (left !== left && right !== right);
7744
+ const hasPlainTag = (value) => {
7745
+ try {
7746
+ return Object.prototype.toString.call(value) === '[object Object]';
7747
+ }
7748
+ catch {
7749
+ return false;
7750
+ }
7751
+ };
7752
+ const isObjectLiteral = (value) => Object.getPrototypeOf(value) === Object.prototype && hasPlainTag(value);
7741
7753
  const hasErrorAncestor = (value) => {
7742
7754
  let current = Object.getPrototypeOf(value);
7743
7755
  while (current !== null) {
@@ -7808,18 +7820,33 @@ const hidesStateBehindSlots = (value) => {
7808
7820
  return false;
7809
7821
  return ownEnumerableKeys(value).length === 0;
7810
7822
  };
7811
- const kindOf = (value) => {
7812
- if (Array.isArray(value))
7813
- return 'array';
7814
- if (ArrayBuffer.isView(value))
7815
- return callable(readViewLength, value) ? 'dataView' : 'typedArray';
7823
+ const readSlotKind = (value) => {
7816
7824
  const probed = probedKind(value);
7817
7825
  if (probed !== undefined)
7818
7826
  return probed;
7819
7827
  if (callable(readUrlHref, value))
7820
7828
  return 'url';
7821
- if (isWeakCollection(value))
7822
- return 'opaque';
7829
+ return isWeakCollection(value) ? 'opaque' : null;
7830
+ };
7831
+ const SLOT_KINDS = new WeakMap();
7832
+ const slotKindOf = (value) => {
7833
+ const known = SLOT_KINDS.get(value);
7834
+ if (known !== undefined)
7835
+ return known;
7836
+ const kind = readSlotKind(value);
7837
+ SLOT_KINDS.set(value, kind);
7838
+ return kind;
7839
+ };
7840
+ const kindOf = (value) => {
7841
+ if (Array.isArray(value))
7842
+ return 'array';
7843
+ if (isObjectLiteral(value))
7844
+ return 'plain';
7845
+ if (ArrayBuffer.isView(value))
7846
+ return callable(readViewLength, value) ? 'dataView' : 'typedArray';
7847
+ const slotKind = slotKindOf(value);
7848
+ if (slotKind !== null)
7849
+ return slotKind;
7823
7850
  if (hasErrorAncestor(value))
7824
7851
  return 'error';
7825
7852
  if (hidesStateBehindSlots(value))
@@ -8080,6 +8107,141 @@ const compare = (left, right, state) => {
8080
8107
  return false;
8081
8108
  return compareObjects(left, right, state);
8082
8109
  };
8110
+ const QUICK_MAX_DEPTH = 64;
8111
+ const hasSymbolKeys = (value) => Object.getOwnPropertySymbols(value).length !== 0;
8112
+ const hasOwnKeys = (value) => Object.keys(value).length !== 0 || hasSymbolKeys(value);
8113
+ const stringKeysOf = (value) => {
8114
+ const keys = Object.keys(value);
8115
+ return hasSymbolKeys(value) ? undefined : keys;
8116
+ };
8117
+ const matchesOnlyItself = (value) => value === null || typeof value !== 'object';
8118
+ const isListedIndex = (list, index) => Object.prototype.propertyIsEnumerable.call(list, index);
8119
+ const isOwnIndex = (list, index, listed) => listed || Object.prototype.hasOwnProperty.call(list, index);
8120
+ const matchUnlistedIndex = (left, right, index, leftListed, rightListed) => {
8121
+ const inLeft = isOwnIndex(left, index, leftListed);
8122
+ if (inLeft !== isOwnIndex(right, index, rightListed))
8123
+ return 'differ';
8124
+ return inLeft ? 'compare' : 'skip';
8125
+ };
8126
+ const hasOnlyIndices = (list, listedIndices) => stringKeysOf(list)?.length === listedIndices;
8127
+ const quickCompareOwnKeys = (left, right, seen, depth) => {
8128
+ const keys = stringKeysOf(left);
8129
+ if (keys === undefined)
8130
+ return undefined;
8131
+ const rightKeys = stringKeysOf(right);
8132
+ if (rightKeys === undefined)
8133
+ return undefined;
8134
+ if (keys.length !== rightKeys.length)
8135
+ return false;
8136
+ for (const key of keys) {
8137
+ if (!Object.prototype.propertyIsEnumerable.call(right, key))
8138
+ return false;
8139
+ const verdict = quickCompare(readKey(left, key), readKey(right, key), seen, depth);
8140
+ if (verdict !== true)
8141
+ return verdict;
8142
+ }
8143
+ return true;
8144
+ };
8145
+ const quickCompareArrays = (left, right, seen, depth) => {
8146
+ if (!Array.isArray(left) || !Array.isArray(right))
8147
+ return undefined;
8148
+ const length = left.length;
8149
+ if (length !== right.length)
8150
+ return false;
8151
+ let leftUnlisted = 0;
8152
+ let rightUnlisted = 0;
8153
+ for (let index = 0; index !== length; index++) {
8154
+ const leftListed = isListedIndex(left, index);
8155
+ const rightListed = isListedIndex(right, index);
8156
+ const match = leftListed && rightListed ? 'compare' : matchUnlistedIndex(left, right, index, leftListed, rightListed);
8157
+ if (match === 'differ')
8158
+ return false;
8159
+ leftUnlisted += Number(!leftListed);
8160
+ rightUnlisted += Number(!rightListed);
8161
+ if (match !== 'compare')
8162
+ continue;
8163
+ const verdict = quickCompare(left[index], right[index], seen, depth);
8164
+ if (verdict !== true)
8165
+ return verdict;
8166
+ }
8167
+ return hasOnlyIndices(left, length - leftUnlisted) && hasOnlyIndices(right, length - rightUnlisted)
8168
+ ? true
8169
+ : undefined;
8170
+ };
8171
+ const areBareValues = (reader, left, right) => callable(reader, left) && callable(reader, right) && !hasOwnKeys(left) && !hasOwnKeys(right);
8172
+ const quickCompareDates = (left, right) => {
8173
+ if (!areBareValues(readDateValue, left, right))
8174
+ return undefined;
8175
+ return isSameValueZero(readDateValue.call(left), readDateValue.call(right));
8176
+ };
8177
+ const quickCompareMapEntry = (right, key, value, seen, depth) => {
8178
+ if (!Map.prototype.has.call(right, key))
8179
+ return matchesOnlyItself(key) ? false : undefined;
8180
+ const verdict = quickCompare(value, Map.prototype.get.call(right, key), seen, depth);
8181
+ return verdict === false && !matchesOnlyItself(key) ? undefined : verdict;
8182
+ };
8183
+ const quickCompareMaps = (left, right, seen, depth) => {
8184
+ if (!areBareValues(readMapSize, left, right))
8185
+ return undefined;
8186
+ if (readMapSize.call(left) !== readMapSize.call(right))
8187
+ return false;
8188
+ let allMatch = true;
8189
+ for (const [key, value] of mapEntriesOf(left)) {
8190
+ const verdict = quickCompareMapEntry(right, key, value, seen, depth);
8191
+ if (verdict === undefined)
8192
+ return undefined;
8193
+ allMatch &&= verdict;
8194
+ }
8195
+ return allMatch;
8196
+ };
8197
+ const quickCompareSets = (left, right) => {
8198
+ if (!areBareValues(readSetSize, left, right))
8199
+ return undefined;
8200
+ if (readSetSize.call(left) !== readSetSize.call(right))
8201
+ return false;
8202
+ for (const entry of setEntriesOf(left)) {
8203
+ if (!Set.prototype.has.call(right, entry))
8204
+ return matchesOnlyItself(entry) ? false : undefined;
8205
+ }
8206
+ return true;
8207
+ };
8208
+ const QUICK_COMPARATORS_BY_KIND = new Map([
8209
+ ['plain', quickCompareOwnKeys],
8210
+ ['array', quickCompareArrays],
8211
+ ['date', quickCompareDates],
8212
+ ['map', quickCompareMaps],
8213
+ ['set', quickCompareSets]
8214
+ ]);
8215
+ const quickCompareByKind = (left, right, seen, depth) => {
8216
+ const kind = kindOf(left);
8217
+ if (kind !== kindOf(right))
8218
+ return false;
8219
+ return QUICK_COMPARATORS_BY_KIND.get(kind)?.(left, right, seen, depth);
8220
+ };
8221
+ const isPlainRecord = (value) => !Array.isArray(value) && hasPlainTag(value);
8222
+ const quickCompareRecords = (left, right, seen, depth) => isPlainRecord(left) && isPlainRecord(right)
8223
+ ? quickCompareOwnKeys(left, right, seen, depth)
8224
+ : quickCompareByKind(left, right, seen, depth);
8225
+ const QUICK_COMPARATORS = new Map([
8226
+ [Object.prototype, quickCompareRecords],
8227
+ [Array.prototype, quickCompareArrays],
8228
+ [Date.prototype, quickCompareDates],
8229
+ [Map.prototype, quickCompareMaps],
8230
+ [Set.prototype, quickCompareSets]
8231
+ ]);
8232
+ const quickCompare = (left, right, seen, depth) => {
8233
+ if (isSameValueZero(left, right))
8234
+ return true;
8235
+ if (left === null || right === null || typeof left !== 'object' || typeof right !== 'object')
8236
+ return false;
8237
+ if (depth === QUICK_MAX_DEPTH || seen.has(left))
8238
+ return undefined;
8239
+ seen.add(left);
8240
+ const prototype = Object.getPrototypeOf(left);
8241
+ if (prototype !== Object.getPrototypeOf(right))
8242
+ return false;
8243
+ return (QUICK_COMPARATORS.get(prototype) ?? quickCompareByKind)(left, right, seen, depth + 1);
8244
+ };
8083
8245
 
8084
8246
  /**
8085
8247
  * The maximum number of characters a tooltip shows, headline and paragraphs together.