@digipair/skill-web-spectrum 0.63.1 → 0.64.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs.js +39 -14
  2. package/index.esm.js +39 -14
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -29585,8 +29585,20 @@ function isContainingBlock(elementOrCss) {
29585
29585
  var webkit = isWebKit();
29586
29586
  var css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
29587
29587
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
29588
- return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || [
29588
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
29589
+ return [
29590
+ "transform",
29591
+ "translate",
29592
+ "scale",
29593
+ "rotate",
29594
+ "perspective"
29595
+ ].some(function(value) {
29596
+ return css[value] ? css[value] !== "none" : false;
29597
+ }) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || [
29589
29598
  "transform",
29599
+ "translate",
29600
+ "scale",
29601
+ "rotate",
29590
29602
  "perspective",
29591
29603
  "filter"
29592
29604
  ].some(function(value) {
@@ -30383,6 +30395,9 @@ var platform = {
30383
30395
  isElement: isElement,
30384
30396
  isRTL: isRTL
30385
30397
  };
30398
+ function rectsAreEqual(a, b) {
30399
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
30400
+ }
30386
30401
  // https://samthor.au/2021/observing-dom/
30387
30402
  function observeMove(element, onMove) {
30388
30403
  var io = null;
@@ -30402,7 +30417,8 @@ function observeMove(element, onMove) {
30402
30417
  threshold = 1;
30403
30418
  }
30404
30419
  cleanup();
30405
- var _element_getBoundingClientRect = element.getBoundingClientRect(), left = _element_getBoundingClientRect.left, top = _element_getBoundingClientRect.top, width = _element_getBoundingClientRect.width, height = _element_getBoundingClientRect.height;
30420
+ var elementRectForRootMargin = element.getBoundingClientRect();
30421
+ var left = elementRectForRootMargin.left, top = elementRectForRootMargin.top, width = elementRectForRootMargin.width, height = elementRectForRootMargin.height;
30406
30422
  if (!skip) {
30407
30423
  onMove();
30408
30424
  }
@@ -30435,6 +30451,16 @@ function observeMove(element, onMove) {
30435
30451
  refresh(false, ratio);
30436
30452
  }
30437
30453
  }
30454
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
30455
+ // It's possible that even though the ratio is reported as 1, the
30456
+ // element is not actually fully within the IntersectionObserver's root
30457
+ // area anymore. This can happen under performance constraints. This may
30458
+ // be a bug in the browser's IntersectionObserver implementation. To
30459
+ // work around this, we compare the element's bounding rect now with
30460
+ // what it was at the time we created the IntersectionObserver. If they
30461
+ // are not equal then the element moved, so we refresh.
30462
+ refresh();
30463
+ }
30438
30464
  isFirstUpdate = false;
30439
30465
  }
30440
30466
  // Older browsers don't support a `document` as the root and will throw an
@@ -30502,7 +30528,7 @@ function observeMove(element, onMove) {
30502
30528
  }
30503
30529
  function frameLoop() {
30504
30530
  var nextRefRect = getBoundingClientRect(reference);
30505
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
30531
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
30506
30532
  update();
30507
30533
  }
30508
30534
  prevRefRect = nextRefRect;
@@ -39342,7 +39368,6 @@ function _unsupported_iterable_to_array$g(o, minLen) {
39342
39368
  var $488c6ddbf4ef74c2$var$formatterCache = new Map();
39343
39369
  var $488c6ddbf4ef74c2$var$supportsSignDisplay = false;
39344
39370
  try {
39345
- // @ts-ignore
39346
39371
  $488c6ddbf4ef74c2$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", {
39347
39372
  signDisplay: "exceptZero"
39348
39373
  }).resolvedOptions().signDisplay === "exceptZero";
@@ -39350,7 +39375,6 @@ try {
39350
39375
  } catch (e) {}
39351
39376
  var $488c6ddbf4ef74c2$var$supportsUnit = false;
39352
39377
  try {
39353
- // @ts-ignore
39354
39378
  $488c6ddbf4ef74c2$var$supportsUnit = new Intl.NumberFormat("de-DE", {
39355
39379
  style: "unit",
39356
39380
  unit: "degree"
@@ -39398,14 +39422,12 @@ var $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 = /*#__PURE__*/ function() {
39398
39422
  /** Formats a number to an array of parts such as separators, digits, punctuation, and more. */ key: "formatToParts",
39399
39423
  value: function formatToParts(value) {
39400
39424
  // TODO: implement signDisplay for formatToParts
39401
- // @ts-ignore
39402
39425
  return this.numberFormatter.formatToParts(value);
39403
39426
  }
39404
39427
  },
39405
39428
  {
39406
39429
  /** Formats a number range as a string. */ key: "formatRange",
39407
39430
  value: function formatRange(start, end) {
39408
- // @ts-ignore
39409
39431
  if (typeof this.numberFormatter.formatRange === "function") return this.numberFormatter.formatRange(start, end);
39410
39432
  if (end < start) throw new RangeError("End date must be >= start date");
39411
39433
  // Very basic fallback for old browsers.
@@ -39415,7 +39437,6 @@ var $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 = /*#__PURE__*/ function() {
39415
39437
  {
39416
39438
  /** Formats a number range as an array of parts. */ key: "formatRangeToParts",
39417
39439
  value: function formatRangeToParts(start, end) {
39418
- // @ts-ignore
39419
39440
  if (typeof this.numberFormatter.formatRangeToParts === "function") return this.numberFormatter.formatRangeToParts(start, end);
39420
39441
  if (end < start) throw new RangeError("End date must be >= start date");
39421
39442
  var startParts = this.numberFormatter.formatToParts(start);
@@ -39611,7 +39632,9 @@ function _unsupported_iterable_to_array$f(o, minLen) {
39611
39632
  var $6c7bd7858deea686$var$NUMBERING_SYSTEMS = [
39612
39633
  "latn",
39613
39634
  "arab",
39614
- "hanidec"
39635
+ "hanidec",
39636
+ "deva",
39637
+ "beng"
39615
39638
  ];
39616
39639
  var $6c7bd7858deea686$export$cd11ab140839f11d = /*#__PURE__*/ function() {
39617
39640
  function $6c7bd7858deea686$export$cd11ab140839f11d(locale) {
@@ -39824,8 +39847,12 @@ function $6c7bd7858deea686$var$getSymbols(locale, formatter, intlOptions, origin
39824
39847
  var _allParts_find, _posAllParts_find, _decimalParts_find, _allParts_find1;
39825
39848
  // formatter needs access to all decimal places in order to generate the correct literal strings for the plural set
39826
39849
  var symbolFormatter = new Intl.NumberFormat(locale, _object_spread_props$2(_object_spread$3({}, intlOptions), {
39850
+ // Resets so we get the full range of symbols
39827
39851
  minimumSignificantDigits: 1,
39828
- maximumSignificantDigits: 21
39852
+ maximumSignificantDigits: 21,
39853
+ roundingIncrement: 1,
39854
+ roundingPriority: "auto",
39855
+ roundingMode: "halfExpand"
39829
39856
  }));
39830
39857
  // Note: some locale's don't add a group symbol until there is a ten thousands place
39831
39858
  var allParts = symbolFormatter.formatToParts(-10000.111);
@@ -39842,7 +39869,6 @@ function $6c7bd7858deea686$var$getSymbols(locale, formatter, intlOptions, origin
39842
39869
  })) === null || _posAllParts_find === void 0 ? void 0 : _posAllParts_find.value;
39843
39870
  // Safari does not support the signDisplay option, but our number parser polyfills it.
39844
39871
  // If no plus sign was returned, but the original options contained signDisplay, default to the '+' character.
39845
- // @ts-ignore
39846
39872
  if (!plusSign && ((originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "exceptZero" || (originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "always")) plusSign = "+";
39847
39873
  // If maximumSignificantDigits is 1 (the minimum) then we won't get decimal characters out of the above formatters
39848
39874
  // Percent also defaults to 0 fractionDigits, so we need to make a new one that isn't percent to get an accurate decimal
@@ -39899,7 +39925,6 @@ function $6c7bd7858deea686$var$getSymbols(locale, formatter, intlOptions, origin
39899
39925
  };
39900
39926
  }
39901
39927
  function $6c7bd7858deea686$var$replaceAll(str, find, replace) {
39902
- // @ts-ignore
39903
39928
  if (str.replaceAll) return str.replaceAll(find, replace);
39904
39929
  return str.split(find).join(replace);
39905
39930
  }
@@ -51578,8 +51603,8 @@ var DefaultLayoutConstructor;
51578
51603
  };
51579
51604
  var scrollTop = top - hostElementBounds.top + hostElement.scrollTop;
51580
51605
  var scrollLeft = left - hostElementBounds.left + hostElement.scrollLeft;
51581
- var height = bottom - top;
51582
- var width = right - left;
51606
+ var height = Math.max(0, bottom - top);
51607
+ var width = Math.max(0, right - left);
51583
51608
  layout.viewportSize = {
51584
51609
  width: width,
51585
51610
  height: height
package/index.esm.js CHANGED
@@ -29583,8 +29583,20 @@ function isContainingBlock(elementOrCss) {
29583
29583
  var webkit = isWebKit();
29584
29584
  var css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
29585
29585
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
29586
- return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || [
29586
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
29587
+ return [
29588
+ "transform",
29589
+ "translate",
29590
+ "scale",
29591
+ "rotate",
29592
+ "perspective"
29593
+ ].some(function(value) {
29594
+ return css[value] ? css[value] !== "none" : false;
29595
+ }) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || [
29587
29596
  "transform",
29597
+ "translate",
29598
+ "scale",
29599
+ "rotate",
29588
29600
  "perspective",
29589
29601
  "filter"
29590
29602
  ].some(function(value) {
@@ -30381,6 +30393,9 @@ var platform = {
30381
30393
  isElement: isElement,
30382
30394
  isRTL: isRTL
30383
30395
  };
30396
+ function rectsAreEqual(a, b) {
30397
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
30398
+ }
30384
30399
  // https://samthor.au/2021/observing-dom/
30385
30400
  function observeMove(element, onMove) {
30386
30401
  var io = null;
@@ -30400,7 +30415,8 @@ function observeMove(element, onMove) {
30400
30415
  threshold = 1;
30401
30416
  }
30402
30417
  cleanup();
30403
- var _element_getBoundingClientRect = element.getBoundingClientRect(), left = _element_getBoundingClientRect.left, top = _element_getBoundingClientRect.top, width = _element_getBoundingClientRect.width, height = _element_getBoundingClientRect.height;
30418
+ var elementRectForRootMargin = element.getBoundingClientRect();
30419
+ var left = elementRectForRootMargin.left, top = elementRectForRootMargin.top, width = elementRectForRootMargin.width, height = elementRectForRootMargin.height;
30404
30420
  if (!skip) {
30405
30421
  onMove();
30406
30422
  }
@@ -30433,6 +30449,16 @@ function observeMove(element, onMove) {
30433
30449
  refresh(false, ratio);
30434
30450
  }
30435
30451
  }
30452
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
30453
+ // It's possible that even though the ratio is reported as 1, the
30454
+ // element is not actually fully within the IntersectionObserver's root
30455
+ // area anymore. This can happen under performance constraints. This may
30456
+ // be a bug in the browser's IntersectionObserver implementation. To
30457
+ // work around this, we compare the element's bounding rect now with
30458
+ // what it was at the time we created the IntersectionObserver. If they
30459
+ // are not equal then the element moved, so we refresh.
30460
+ refresh();
30461
+ }
30436
30462
  isFirstUpdate = false;
30437
30463
  }
30438
30464
  // Older browsers don't support a `document` as the root and will throw an
@@ -30500,7 +30526,7 @@ function observeMove(element, onMove) {
30500
30526
  }
30501
30527
  function frameLoop() {
30502
30528
  var nextRefRect = getBoundingClientRect(reference);
30503
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
30529
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
30504
30530
  update();
30505
30531
  }
30506
30532
  prevRefRect = nextRefRect;
@@ -39340,7 +39366,6 @@ function _unsupported_iterable_to_array$g(o, minLen) {
39340
39366
  var $488c6ddbf4ef74c2$var$formatterCache = new Map();
39341
39367
  var $488c6ddbf4ef74c2$var$supportsSignDisplay = false;
39342
39368
  try {
39343
- // @ts-ignore
39344
39369
  $488c6ddbf4ef74c2$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", {
39345
39370
  signDisplay: "exceptZero"
39346
39371
  }).resolvedOptions().signDisplay === "exceptZero";
@@ -39348,7 +39373,6 @@ try {
39348
39373
  } catch (e) {}
39349
39374
  var $488c6ddbf4ef74c2$var$supportsUnit = false;
39350
39375
  try {
39351
- // @ts-ignore
39352
39376
  $488c6ddbf4ef74c2$var$supportsUnit = new Intl.NumberFormat("de-DE", {
39353
39377
  style: "unit",
39354
39378
  unit: "degree"
@@ -39396,14 +39420,12 @@ var $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 = /*#__PURE__*/ function() {
39396
39420
  /** Formats a number to an array of parts such as separators, digits, punctuation, and more. */ key: "formatToParts",
39397
39421
  value: function formatToParts(value) {
39398
39422
  // TODO: implement signDisplay for formatToParts
39399
- // @ts-ignore
39400
39423
  return this.numberFormatter.formatToParts(value);
39401
39424
  }
39402
39425
  },
39403
39426
  {
39404
39427
  /** Formats a number range as a string. */ key: "formatRange",
39405
39428
  value: function formatRange(start, end) {
39406
- // @ts-ignore
39407
39429
  if (typeof this.numberFormatter.formatRange === "function") return this.numberFormatter.formatRange(start, end);
39408
39430
  if (end < start) throw new RangeError("End date must be >= start date");
39409
39431
  // Very basic fallback for old browsers.
@@ -39413,7 +39435,6 @@ var $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 = /*#__PURE__*/ function() {
39413
39435
  {
39414
39436
  /** Formats a number range as an array of parts. */ key: "formatRangeToParts",
39415
39437
  value: function formatRangeToParts(start, end) {
39416
- // @ts-ignore
39417
39438
  if (typeof this.numberFormatter.formatRangeToParts === "function") return this.numberFormatter.formatRangeToParts(start, end);
39418
39439
  if (end < start) throw new RangeError("End date must be >= start date");
39419
39440
  var startParts = this.numberFormatter.formatToParts(start);
@@ -39609,7 +39630,9 @@ function _unsupported_iterable_to_array$f(o, minLen) {
39609
39630
  var $6c7bd7858deea686$var$NUMBERING_SYSTEMS = [
39610
39631
  "latn",
39611
39632
  "arab",
39612
- "hanidec"
39633
+ "hanidec",
39634
+ "deva",
39635
+ "beng"
39613
39636
  ];
39614
39637
  var $6c7bd7858deea686$export$cd11ab140839f11d = /*#__PURE__*/ function() {
39615
39638
  function $6c7bd7858deea686$export$cd11ab140839f11d(locale) {
@@ -39822,8 +39845,12 @@ function $6c7bd7858deea686$var$getSymbols(locale, formatter, intlOptions, origin
39822
39845
  var _allParts_find, _posAllParts_find, _decimalParts_find, _allParts_find1;
39823
39846
  // formatter needs access to all decimal places in order to generate the correct literal strings for the plural set
39824
39847
  var symbolFormatter = new Intl.NumberFormat(locale, _object_spread_props$2(_object_spread$3({}, intlOptions), {
39848
+ // Resets so we get the full range of symbols
39825
39849
  minimumSignificantDigits: 1,
39826
- maximumSignificantDigits: 21
39850
+ maximumSignificantDigits: 21,
39851
+ roundingIncrement: 1,
39852
+ roundingPriority: "auto",
39853
+ roundingMode: "halfExpand"
39827
39854
  }));
39828
39855
  // Note: some locale's don't add a group symbol until there is a ten thousands place
39829
39856
  var allParts = symbolFormatter.formatToParts(-10000.111);
@@ -39840,7 +39867,6 @@ function $6c7bd7858deea686$var$getSymbols(locale, formatter, intlOptions, origin
39840
39867
  })) === null || _posAllParts_find === void 0 ? void 0 : _posAllParts_find.value;
39841
39868
  // Safari does not support the signDisplay option, but our number parser polyfills it.
39842
39869
  // If no plus sign was returned, but the original options contained signDisplay, default to the '+' character.
39843
- // @ts-ignore
39844
39870
  if (!plusSign && ((originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "exceptZero" || (originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "always")) plusSign = "+";
39845
39871
  // If maximumSignificantDigits is 1 (the minimum) then we won't get decimal characters out of the above formatters
39846
39872
  // Percent also defaults to 0 fractionDigits, so we need to make a new one that isn't percent to get an accurate decimal
@@ -39897,7 +39923,6 @@ function $6c7bd7858deea686$var$getSymbols(locale, formatter, intlOptions, origin
39897
39923
  };
39898
39924
  }
39899
39925
  function $6c7bd7858deea686$var$replaceAll(str, find, replace) {
39900
- // @ts-ignore
39901
39926
  if (str.replaceAll) return str.replaceAll(find, replace);
39902
39927
  return str.split(find).join(replace);
39903
39928
  }
@@ -51576,8 +51601,8 @@ var DefaultLayoutConstructor;
51576
51601
  };
51577
51602
  var scrollTop = top - hostElementBounds.top + hostElement.scrollTop;
51578
51603
  var scrollLeft = left - hostElementBounds.left + hostElement.scrollLeft;
51579
- var height = bottom - top;
51580
- var width = right - left;
51604
+ var height = Math.max(0, bottom - top);
51605
+ var width = Math.max(0, right - left);
51581
51606
  layout.viewportSize = {
51582
51607
  width: width,
51583
51608
  height: height
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web-spectrum",
3
- "version": "0.63.1",
3
+ "version": "0.64.3",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"