@rededor/cura 2.0.0-alpha.4 → 2.0.0-alpha.5

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 (36) hide show
  1. package/dist/cjs/cura-accordion_21.cjs.entry.js +69 -179
  2. package/dist/cjs/cura-accordion_21.cjs.entry.js.map +1 -1
  3. package/dist/cjs/cura-alert.cjs.entry.js +4 -3
  4. package/dist/cjs/cura-alert.cjs.entry.js.map +1 -1
  5. package/dist/cjs/cura-alert.entry.cjs.js.map +1 -1
  6. package/dist/cjs/index-BK9MSAiE.js.map +1 -1
  7. package/dist/collection/components/cura-alert/cura-alert.js +4 -3
  8. package/dist/collection/components/cura-alert/cura-alert.js.map +1 -1
  9. package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
  10. package/dist/components/cura-alert.js +4 -3
  11. package/dist/components/cura-alert.js.map +1 -1
  12. package/dist/components/cura-calendar.js +1 -1
  13. package/dist/components/cura-input-date.js +2 -2
  14. package/dist/components/cura-select.js +1 -1
  15. package/dist/components/{p-CvdWbsfO.js → p-Cs5scX1L.js} +71 -181
  16. package/dist/components/p-Cs5scX1L.js.map +1 -0
  17. package/dist/components/p-D1cPOZpG.js.map +1 -1
  18. package/dist/components/{p-DETZu2ie.js → p-D6PpdPRJ.js} +3 -3
  19. package/dist/components/{p-DETZu2ie.js.map → p-D6PpdPRJ.js.map} +1 -1
  20. package/dist/cura/cura-alert.entry.esm.js.map +1 -1
  21. package/dist/cura/cura.esm.js +1 -1
  22. package/dist/cura/{p-2ab58335.entry.js → p-6dfc7c02.entry.js} +2 -2
  23. package/dist/cura/p-6dfc7c02.entry.js.map +1 -0
  24. package/dist/cura/p-PPMZr_VE.js.map +1 -1
  25. package/dist/cura/p-bdfe9af2.entry.js +2 -0
  26. package/dist/cura/p-bdfe9af2.entry.js.map +1 -0
  27. package/dist/esm/cura-accordion_21.entry.js +69 -179
  28. package/dist/esm/cura-accordion_21.entry.js.map +1 -1
  29. package/dist/esm/cura-alert.entry.js +4 -3
  30. package/dist/esm/cura-alert.entry.js.map +1 -1
  31. package/dist/esm/index-OdKytJIH.js.map +1 -1
  32. package/package.json +2 -2
  33. package/dist/components/p-CvdWbsfO.js.map +0 -1
  34. package/dist/cura/p-2ab58335.entry.js.map +0 -1
  35. package/dist/cura/p-6feba852.entry.js +0 -2
  36. package/dist/cura/p-6feba852.entry.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{r as e,c as s,h as t,H as a,a as c}from"./p-PPMZr_VE.js";import"./p-BPKQjAwN.js";const r=":host{display:block;box-sizing:border-box}:host .conteiner{display:flex;box-sizing:border-box;padding:calc(var(--cura-spacing-base) * 3px);gap:calc(var(--cura-spacing-base) * 3px);flex-shrink:0;border:1px solid var(--color-base);border-radius:4px;background-color:var(--color-lighter)}:host .conteiner.floating{box-shadow:0px 4px 8px 0px rgba(38, 38, 38, 0.16)}:host .content{flex:1;flex-direction:column;display:flex;gap:calc(var(--cura-spacing-base) * 1px)}:host .icon-right{cursor:pointer}";const i=class{constructor(t){e(this,t);this.close=s(this,"close");this.type="info";this.floating=false;this.closeable=true;this.styles={};this.handleClose=()=>{this.close.emit();this.host.remove()}}setColors(){const e=[{name:"--color-lighter",theme:`${this.type}-lighter`},{name:"--neutral-black",theme:"neutral-black"},{name:"--color-light",theme:`${this.type}-light`},{name:"--color-base",theme:`${this.type}-base`}];const s=Object.assign({},this.styles);e.forEach((e=>{s[e.name]=window.CuraAPI.theme.colors.getColor(e.theme)}));this.styles=s}connectedCallback(){this.styles["--base-spacing"]=window.CuraAPI.theme.spacing.getSpacing();this.setColors()}getClasses(){const e={};e["conteiner"]=true;e["floating"]=this.floating;return e}getNameIcon(){const e={info:"infoCircle",success:"checkCircle",warning:"alertCircle",error:"alertTriangle"};return this.icon?this.icon:e[this.type]}render(){return t(a,{key:"f64ddb202b9436f9bebd4316979ffc1ad8d2c711",role:"alert","aria-live":"polite","aria-atomic":"true","aria-label":this.label},t("div",{key:"c1320f2a8007169776bf1d8b59301c9e070d97f3",class:this.getClasses(),style:this.styles},t("cura-icon",{key:"18b352ca24b9904624e10beadc8ef2a214ef3ee4",name:this.getNameIcon(),class:"icon-left",size:16,color:`${this.type}-dark`}),t("div",{key:"4f025525470856227ff65b36c27c8dcffc73be99",class:"content"},this.label?t("cura-heading",{class:"title",size:"xsmall",color:"neutral-black",weight:"bold","margin-block":"1px 0"},this.label):"",t("cura-paragraph",{key:"b1dcbf2fc75c387a8e30b255b94a3439d6443548",class:"text",color:`${this.type}-darker`,size:"xsmall",marginBlock:"0",lineHeight:"133.33%"},t("slot",{key:"d4473ba49462f93fe5b4c5b2729ca018c7cc322c"})),t("slot",{key:"2d3d5e549a600424c13ae2642845af40fb3c0894",name:"actions"})),this.closeable?t("cura-icon",{name:"close",size:16,color:"error-dark",class:"icon-right",onClick:this.handleClose}):""))}get host(){return c(this)}static get watchers(){return{type:["setColors"]}}};i.style=r;export{i as cura_alert};
2
+ //# sourceMappingURL=p-bdfe9af2.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["curaAlertCss","CuraAlert","constructor","hostRef","this","type","floating","closeable","styles","handleClose","close","emit","host","remove","setColors","colors","name","theme","updatedStyles","Object","assign","forEach","color","window","CuraAPI","getColor","connectedCallback","spacing","getSpacing","getClasses","classes","getNameIcon","iconMapping","info","success","warning","error","icon","render","h","Host","key","role","label","class","style","size","weight","marginBlock","lineHeight","onClick"],"sources":["src/components/cura-alert/cura-alert.scss?tag=cura-alert&encapsulation=shadow","src/components/cura-alert/cura-alert.tsx"],"sourcesContent":["@import \"../../scss/mixins/spacing.scss\";\n\n:host {\n display: block;\n box-sizing: border-box;\n\n .conteiner {\n display: flex;\n box-sizing: border-box;\n padding: #{$spacing-xxxs};\n gap: #{$spacing-xxxs};\n flex-shrink: 0;\n border: 1px solid var(--color-base);\n border-radius: 4px;\n background-color: var(--color-lighter);\n &.floating {\n box-shadow: 0px 4px 8px 0px rgba(38, 38, 38, 0.16);\n }\n }\n\n .content {\n flex: 1;\n flex-direction: column;\n display: flex;\n gap: #{$spacing-tiny};\n }\n\n .icon-right {\n cursor: pointer;\n }\n\n}\n","import { Component, Element, Prop, Host, h, State, Watch, Event, EventEmitter } from '@stencil/core';\n@Component({\n tag: 'cura-alert',\n styleUrl: 'cura-alert.scss',\n shadow: true,\n})\nexport class CuraAlert {\n @Element() host: HTMLElement;\n\n @Prop() type: 'info' | 'success' | 'warning' | 'error' = 'info';\n @Prop({ reflect: true }) floating = false;\n @Prop({ reflect: true }) label: string;\n @Prop({ reflect: true }) closeable = true;\n @Prop({ reflect: true }) icon: string;\n\n @State() styles = {};\n\n @Event({ eventName: 'close' }) close: EventEmitter<void>;\n\n @Watch('type')\n setColors() {\n const colors = [\n { name: '--color-lighter', theme: `${this.type}-lighter` },\n { name: '--neutral-black', theme: 'neutral-black' },\n { name: '--color-light', theme: `${this.type}-light` },\n { name: '--color-base', theme: `${this.type}-base` },\n ];\n\n const updatedStyles = {\n ...this.styles\n }\n\n colors.forEach(color => {\n updatedStyles[color.name] = window.CuraAPI.theme.colors.getColor(color.theme);\n });\n \n this.styles = updatedStyles;\n }\n\n connectedCallback() {\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.setColors();\n }\n\n getClasses() {\n const classes = {};\n classes['conteiner'] = true;\n classes['floating'] = this.floating;\n return classes;\n }\n\n getNameIcon() {\n const iconMapping = {\n info: 'infoCircle',\n success: 'checkCircle',\n warning: 'alertCircle',\n error: 'alertTriangle',\n };\n return this.icon ? this.icon : iconMapping[this.type];\n }\n\n handleClose = () => {\n this.close.emit();\n this.host.remove();\n };\n\n render() {\n return (\n <Host role=\"alert\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n aria-label={this.label}>\n <div class={this.getClasses()} style={this.styles}>\n <cura-icon name={this.getNameIcon()} class=\"icon-left\" size={16} color={`${this.type}-dark`}></cura-icon>\n <div class=\"content\">\n { this.label ? (\n <cura-heading class=\"title\" size=\"xsmall\" color=\"neutral-black\" weight=\"bold\" margin-block=\"1px 0\">\n {this.label}\n </cura-heading>\n ) : ''}\n <cura-paragraph class=\"text\" color={`${this.type}-darker`} size=\"xsmall\" marginBlock=\"0\" lineHeight=\"133.33%\">\n <slot></slot>\n </cura-paragraph>\n <slot name=\"actions\"></slot>\n </div>\n { this.closeable ?\n (<cura-icon name=\"close\" size={16} color=\"error-dark\" class=\"icon-right\" onClick={this.handleClose}></cura-icon>)\n : '' }\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"wFAAA,MAAMA,EAAe,+e,MCMRC,EAAS,MALtB,WAAAC,CAAAC,G,qCAQUC,KAAIC,KAA6C,OAChCD,KAAQE,SAAG,MAEXF,KAASG,UAAG,KAG5BH,KAAMI,OAAG,GA8ClBJ,KAAWK,YAAG,KACZL,KAAKM,MAAMC,OACXP,KAAKQ,KAAKC,QAAQ,CA6BrB,CAxEC,SAAAC,GACE,MAAMC,EAAS,CACb,CAAEC,KAAM,kBAAmBC,MAAO,GAAGb,KAAKC,gBAC1C,CAAEW,KAAM,kBAAmBC,MAAO,iBAClC,CAAED,KAAM,gBAAiBC,MAAO,GAAGb,KAAKC,cACxC,CAAEW,KAAM,eAAgBC,MAAO,GAAGb,KAAKC,cAGzC,MAAMa,EACDC,OAAAC,OAAA,GAAAhB,KAAKI,QAGVO,EAAOM,SAAQC,IACbJ,EAAcI,EAAMN,MAAQO,OAAOC,QAAQP,MAAMF,OAAOU,SAASH,EAAML,MAAM,IAG/Eb,KAAKI,OAASU,C,CAGhB,iBAAAQ,GACEtB,KAAKI,OAAO,kBAAoBe,OAAOC,QAAQP,MAAMU,QAAQC,aAC7DxB,KAAKU,W,CAGP,UAAAe,GACE,MAAMC,EAAU,GAChBA,EAAQ,aAAe,KACvBA,EAAQ,YAAc1B,KAAKE,SAC3B,OAAOwB,C,CAGT,WAAAC,GACE,MAAMC,EAAc,CAClBC,KAAM,aACNC,QAAS,cACTC,QAAS,cACTC,MAAO,iBAET,OAAOhC,KAAKiC,KAAOjC,KAAKiC,KAAOL,EAAY5B,KAAKC,K,CAQlD,MAAAiC,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,2CAACC,KAAK,QACC,qBACE,qBACA,aAAAtC,KAAKuC,OACjBJ,EAAK,OAAAE,IAAA,2CAAAG,MAAOxC,KAAKyB,aAAcgB,MAAOzC,KAAKI,QACzC+B,EAAW,aAAAE,IAAA,2CAAAzB,KAAMZ,KAAK2B,cAAea,MAAM,YAAYE,KAAM,GAAIxB,MAAO,GAAGlB,KAAKC,cAChFkC,EAAK,OAAAE,IAAA,2CAAAG,MAAM,WACPxC,KAAKuC,MACPJ,EAAA,gBAAcK,MAAM,QAAQE,KAAK,SAASxB,MAAM,gBAAgByB,OAAO,OAAM,eAAc,SACxF3C,KAAKuC,OAEJ,GACJJ,EAAgB,kBAAAE,IAAA,2CAAAG,MAAM,OAAOtB,MAAO,GAAGlB,KAAKC,cAAeyC,KAAK,SAASE,YAAY,IAAIC,WAAW,WAClGV,EAAA,QAAAE,IAAA,8CAEFF,EAAA,QAAAE,IAAA,2CAAMzB,KAAK,aAEXZ,KAAKG,UACNgC,EAAA,aAAWvB,KAAK,QAAQ8B,KAAM,GAAIxB,MAAM,aAAasB,MAAM,aAAaM,QAAS9C,KAAKK,cACrF,I","ignoreList":[]}
@@ -5565,9 +5565,8 @@ function getOppositeAxis(axis) {
5565
5565
  function getAxisLength(axis) {
5566
5566
  return axis === 'y' ? 'height' : 'width';
5567
5567
  }
5568
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
5569
5568
  function getSideAxis(placement) {
5570
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
5569
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
5571
5570
  }
5572
5571
  function getAlignmentAxis(placement) {
5573
5572
  return getOppositeAxis(getSideAxis(placement));
@@ -5592,19 +5591,19 @@ function getExpandedPlacements(placement) {
5592
5591
  function getOppositeAlignmentPlacement(placement) {
5593
5592
  return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
5594
5593
  }
5595
- const lrPlacement = ['left', 'right'];
5596
- const rlPlacement = ['right', 'left'];
5597
- const tbPlacement = ['top', 'bottom'];
5598
- const btPlacement = ['bottom', 'top'];
5599
5594
  function getSideList(side, isStart, rtl) {
5595
+ const lr = ['left', 'right'];
5596
+ const rl = ['right', 'left'];
5597
+ const tb = ['top', 'bottom'];
5598
+ const bt = ['bottom', 'top'];
5600
5599
  switch (side) {
5601
5600
  case 'top':
5602
5601
  case 'bottom':
5603
- if (rtl) return isStart ? rlPlacement : lrPlacement;
5604
- return isStart ? lrPlacement : rlPlacement;
5602
+ if (rtl) return isStart ? rl : lr;
5603
+ return isStart ? lr : rl;
5605
5604
  case 'left':
5606
5605
  case 'right':
5607
- return isStart ? tbPlacement : btPlacement;
5606
+ return isStart ? tb : bt;
5608
5607
  default:
5609
5608
  return [];
5610
5609
  }
@@ -5942,22 +5941,16 @@ const flip$1 = function (options) {
5942
5941
  const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
5943
5942
  const nextPlacement = placements[nextIndex];
5944
5943
  if (nextPlacement) {
5945
- const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
5946
- if (!ignoreCrossAxisOverflow ||
5947
- // We leave the current main axis only if every placement on that axis
5948
- // overflows the main axis.
5949
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
5950
- // Try next placement and re-run the lifecycle.
5951
- return {
5952
- data: {
5953
- index: nextIndex,
5954
- overflows: overflowsData
5955
- },
5956
- reset: {
5957
- placement: nextPlacement
5958
- }
5959
- };
5960
- }
5944
+ // Try next placement and re-run the lifecycle.
5945
+ return {
5946
+ data: {
5947
+ index: nextIndex,
5948
+ overflows: overflowsData
5949
+ },
5950
+ reset: {
5951
+ placement: nextPlacement
5952
+ }
5953
+ };
5961
5954
  }
5962
5955
 
5963
5956
  // First, find the candidates that fit on the mainAxis side of overflow,
@@ -6003,8 +5996,6 @@ const flip$1 = function (options) {
6003
5996
  };
6004
5997
  };
6005
5998
 
6006
- const originSides = /*#__PURE__*/new Set(['left', 'top']);
6007
-
6008
5999
  // For type backwards-compatibility, the `OffsetOptions` type was also
6009
6000
  // Derivable.
6010
6001
 
@@ -6018,7 +6009,7 @@ async function convertValueToCoords(state, options) {
6018
6009
  const side = getSide(placement);
6019
6010
  const alignment = getAlignment(placement);
6020
6011
  const isVertical = getSideAxis(placement) === 'y';
6021
- const mainAxisMulti = originSides.has(side) ? -1 : 1;
6012
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
6022
6013
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
6023
6014
  const rawValue = evaluate(options, state);
6024
6015
 
@@ -6032,9 +6023,10 @@ async function convertValueToCoords(state, options) {
6032
6023
  crossAxis: 0,
6033
6024
  alignmentAxis: null
6034
6025
  } : {
6035
- mainAxis: rawValue.mainAxis || 0,
6036
- crossAxis: rawValue.crossAxis || 0,
6037
- alignmentAxis: rawValue.alignmentAxis
6026
+ mainAxis: 0,
6027
+ crossAxis: 0,
6028
+ alignmentAxis: null,
6029
+ ...rawValue
6038
6030
  };
6039
6031
  if (alignment && typeof alignmentAxis === 'number') {
6040
6032
  crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
@@ -6156,11 +6148,7 @@ const shift$1 = function (options) {
6156
6148
  ...limitedCoords,
6157
6149
  data: {
6158
6150
  x: limitedCoords.x - x,
6159
- y: limitedCoords.y - y,
6160
- enabled: {
6161
- [mainAxis]: checkMainAxis,
6162
- [crossAxis]: checkCrossAxis
6163
- }
6151
+ y: limitedCoords.y - y
6164
6152
  }
6165
6153
  };
6166
6154
  }
@@ -6181,7 +6169,6 @@ const size$1 = function (options) {
6181
6169
  name: 'size',
6182
6170
  options,
6183
6171
  async fn(state) {
6184
- var _state$middlewareData, _state$middlewareData2;
6185
6172
  const {
6186
6173
  placement,
6187
6174
  rects,
@@ -6216,11 +6203,10 @@ const size$1 = function (options) {
6216
6203
  const noShift = !state.middlewareData.shift;
6217
6204
  let availableHeight = overflowAvailableHeight;
6218
6205
  let availableWidth = overflowAvailableWidth;
6219
- if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
6220
- availableWidth = maximumClippingWidth;
6221
- }
6222
- if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
6223
- availableHeight = maximumClippingHeight;
6206
+ if (isYAxis) {
6207
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
6208
+ } else {
6209
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
6224
6210
  }
6225
6211
  if (noShift && !alignment) {
6226
6212
  const xMin = max(overflow.left, 0);
@@ -6251,9 +6237,6 @@ const size$1 = function (options) {
6251
6237
  };
6252
6238
  };
6253
6239
 
6254
- function hasWindow() {
6255
- return typeof window !== 'undefined';
6256
- }
6257
6240
  function getNodeName(node) {
6258
6241
  if (isNode(node)) {
6259
6242
  return (node.nodeName || '').toLowerCase();
@@ -6272,63 +6255,48 @@ function getDocumentElement(node) {
6272
6255
  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
6273
6256
  }
6274
6257
  function isNode(value) {
6275
- if (!hasWindow()) {
6276
- return false;
6277
- }
6278
6258
  return value instanceof Node || value instanceof getWindow(value).Node;
6279
6259
  }
6280
6260
  function isElement(value) {
6281
- if (!hasWindow()) {
6282
- return false;
6283
- }
6284
6261
  return value instanceof Element || value instanceof getWindow(value).Element;
6285
6262
  }
6286
6263
  function isHTMLElement(value) {
6287
- if (!hasWindow()) {
6288
- return false;
6289
- }
6290
6264
  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
6291
6265
  }
6292
6266
  function isShadowRoot(value) {
6293
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
6267
+ // Browsers without `ShadowRoot` support.
6268
+ if (typeof ShadowRoot === 'undefined') {
6294
6269
  return false;
6295
6270
  }
6296
6271
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
6297
6272
  }
6298
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
6299
6273
  function isOverflowElement(element) {
6300
6274
  const {
6301
6275
  overflow,
6302
6276
  overflowX,
6303
6277
  overflowY,
6304
6278
  display
6305
- } = getComputedStyle$1(element);
6306
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
6279
+ } = getComputedStyle(element);
6280
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
6307
6281
  }
6308
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
6309
6282
  function isTableElement(element) {
6310
- return tableElements.has(getNodeName(element));
6283
+ return ['table', 'td', 'th'].includes(getNodeName(element));
6311
6284
  }
6312
- const topLayerSelectors = [':popover-open', ':modal'];
6313
6285
  function isTopLayer(element) {
6314
- return topLayerSelectors.some(selector => {
6286
+ return [':popover-open', ':modal'].some(selector => {
6315
6287
  try {
6316
6288
  return element.matches(selector);
6317
- } catch (_e) {
6289
+ } catch (e) {
6318
6290
  return false;
6319
6291
  }
6320
6292
  });
6321
6293
  }
6322
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
6323
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
6324
- const containValues = ['paint', 'layout', 'strict', 'content'];
6325
6294
  function isContainingBlock(elementOrCss) {
6326
6295
  const webkit = isWebKit();
6327
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
6296
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
6328
6297
 
6329
6298
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
6330
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
6331
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
6299
+ 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) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
6332
6300
  }
6333
6301
  function getContainingBlock(element) {
6334
6302
  let currentNode = getParentNode(element);
@@ -6346,11 +6314,10 @@ function isWebKit() {
6346
6314
  if (typeof CSS === 'undefined' || !CSS.supports) return false;
6347
6315
  return CSS.supports('-webkit-backdrop-filter', 'none');
6348
6316
  }
6349
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
6350
6317
  function isLastTraversableNode(node) {
6351
- return lastTraversableNodeNames.has(getNodeName(node));
6318
+ return ['html', 'body', '#document'].includes(getNodeName(node));
6352
6319
  }
6353
- function getComputedStyle$1(element) {
6320
+ function getComputedStyle(element) {
6354
6321
  return getWindow(element).getComputedStyle(element);
6355
6322
  }
6356
6323
  function getNodeScroll(element) {
@@ -6402,17 +6369,13 @@ function getOverflowAncestors(node, list, traverseIframes) {
6402
6369
  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
6403
6370
  const win = getWindow(scrollableAncestor);
6404
6371
  if (isBody) {
6405
- const frameElement = getFrameElement(win);
6406
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
6372
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
6407
6373
  }
6408
6374
  return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
6409
6375
  }
6410
- function getFrameElement(win) {
6411
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
6412
- }
6413
6376
 
6414
6377
  function getCssDimensions(element) {
6415
- const css = getComputedStyle$1(element);
6378
+ const css = getComputedStyle(element);
6416
6379
  // In testing environments, the `width` and `height` properties are empty
6417
6380
  // strings for SVG elements, returning NaN. Fallback to `0` in this case.
6418
6381
  let width = parseFloat(css.width) || 0;
@@ -6513,11 +6476,11 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
6513
6476
  const win = getWindow(domElement);
6514
6477
  const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
6515
6478
  let currentWin = win;
6516
- let currentIFrame = getFrameElement(currentWin);
6479
+ let currentIFrame = currentWin.frameElement;
6517
6480
  while (currentIFrame && offsetParent && offsetWin !== currentWin) {
6518
6481
  const iframeScale = getScale(currentIFrame);
6519
6482
  const iframeRect = currentIFrame.getBoundingClientRect();
6520
- const css = getComputedStyle$1(currentIFrame);
6483
+ const css = getComputedStyle(currentIFrame);
6521
6484
  const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
6522
6485
  const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
6523
6486
  x *= iframeScale.x;
@@ -6527,7 +6490,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
6527
6490
  x += left;
6528
6491
  y += top;
6529
6492
  currentWin = getWindow(currentIFrame);
6530
- currentIFrame = getFrameElement(currentWin);
6493
+ currentIFrame = currentWin.frameElement;
6531
6494
  }
6532
6495
  }
6533
6496
  return rectToClientRect({
@@ -6538,26 +6501,6 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
6538
6501
  });
6539
6502
  }
6540
6503
 
6541
- // If <html> has a CSS width greater than the viewport, then this will be
6542
- // incorrect for RTL.
6543
- function getWindowScrollBarX(element, rect) {
6544
- const leftScroll = getNodeScroll(element).scrollLeft;
6545
- if (!rect) {
6546
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
6547
- }
6548
- return rect.left + leftScroll;
6549
- }
6550
-
6551
- function getHTMLOffset(documentElement, scroll) {
6552
- const htmlRect = documentElement.getBoundingClientRect();
6553
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
6554
- const y = htmlRect.top + scroll.scrollTop;
6555
- return {
6556
- x,
6557
- y
6558
- };
6559
- }
6560
-
6561
6504
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
6562
6505
  let {
6563
6506
  elements,
@@ -6589,12 +6532,11 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
6589
6532
  offsets.y = offsetRect.y + offsetParent.clientTop;
6590
6533
  }
6591
6534
  }
6592
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
6593
6535
  return {
6594
6536
  width: rect.width * scale.x,
6595
6537
  height: rect.height * scale.y,
6596
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
6597
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
6538
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
6539
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
6598
6540
  };
6599
6541
  }
6600
6542
 
@@ -6602,6 +6544,12 @@ function getClientRects(element) {
6602
6544
  return Array.from(element.getClientRects());
6603
6545
  }
6604
6546
 
6547
+ function getWindowScrollBarX(element) {
6548
+ // If <html> has a CSS width greater than the viewport, then this will be
6549
+ // incorrect for RTL.
6550
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
6551
+ }
6552
+
6605
6553
  // Gets the entire size of the scrollable document area, even extending outside
6606
6554
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
6607
6555
  function getDocumentRect(element) {
@@ -6612,7 +6560,7 @@ function getDocumentRect(element) {
6612
6560
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
6613
6561
  let x = -scroll.scrollLeft + getWindowScrollBarX(element);
6614
6562
  const y = -scroll.scrollTop;
6615
- if (getComputedStyle$1(body).direction === 'rtl') {
6563
+ if (getComputedStyle(body).direction === 'rtl') {
6616
6564
  x += max(html.clientWidth, body.clientWidth) - width;
6617
6565
  }
6618
6566
  return {
@@ -6623,10 +6571,6 @@ function getDocumentRect(element) {
6623
6571
  };
6624
6572
  }
6625
6573
 
6626
- // Safety check: ensure the scrollbar space is reasonable in case this
6627
- // calculation is affected by unusual styles.
6628
- // Most scrollbars leave 15-18px of space.
6629
- const SCROLLBAR_MAX = 25;
6630
6574
  function getViewportRect(element, strategy) {
6631
6575
  const win = getWindow(element);
6632
6576
  const html = getDocumentElement(element);
@@ -6644,24 +6588,6 @@ function getViewportRect(element, strategy) {
6644
6588
  y = visualViewport.offsetTop;
6645
6589
  }
6646
6590
  }
6647
- const windowScrollbarX = getWindowScrollBarX(html);
6648
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
6649
- // visual width of the <html> but this is not considered in the size
6650
- // of `html.clientWidth`.
6651
- if (windowScrollbarX <= 0) {
6652
- const doc = html.ownerDocument;
6653
- const body = doc.body;
6654
- const bodyStyles = getComputedStyle(body);
6655
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
6656
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
6657
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
6658
- width -= clippingStableScrollbarWidth;
6659
- }
6660
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
6661
- // If the <body> scrollbar is on the left, the width needs to be extended
6662
- // by the scrollbar amount so there isn't extra space on the right.
6663
- width += windowScrollbarX;
6664
- }
6665
6591
  return {
6666
6592
  width,
6667
6593
  height,
@@ -6670,7 +6596,6 @@ function getViewportRect(element, strategy) {
6670
6596
  };
6671
6597
  }
6672
6598
 
6673
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
6674
6599
  // Returns the inner client rect, subtracting scrollbars if present.
6675
6600
  function getInnerBoundingClientRect(element, strategy) {
6676
6601
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -6699,10 +6624,9 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
6699
6624
  } else {
6700
6625
  const visualOffsets = getVisualOffsets(element);
6701
6626
  rect = {
6627
+ ...clippingAncestor,
6702
6628
  x: clippingAncestor.x - visualOffsets.x,
6703
- y: clippingAncestor.y - visualOffsets.y,
6704
- width: clippingAncestor.width,
6705
- height: clippingAncestor.height
6629
+ y: clippingAncestor.y - visualOffsets.y
6706
6630
  };
6707
6631
  }
6708
6632
  return rectToClientRect(rect);
@@ -6712,7 +6636,7 @@ function hasFixedPositionAncestor(element, stopNode) {
6712
6636
  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
6713
6637
  return false;
6714
6638
  }
6715
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
6639
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
6716
6640
  }
6717
6641
 
6718
6642
  // A "clipping ancestor" is an `overflow` element with the characteristic of
@@ -6725,17 +6649,17 @@ function getClippingElementAncestors(element, cache) {
6725
6649
  }
6726
6650
  let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
6727
6651
  let currentContainingBlockComputedStyle = null;
6728
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
6652
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
6729
6653
  let currentNode = elementIsFixed ? getParentNode(element) : element;
6730
6654
 
6731
6655
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
6732
6656
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
6733
- const computedStyle = getComputedStyle$1(currentNode);
6657
+ const computedStyle = getComputedStyle(currentNode);
6734
6658
  const currentNodeIsContaining = isContainingBlock(currentNode);
6735
6659
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
6736
6660
  currentContainingBlockComputedStyle = null;
6737
6661
  }
6738
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
6662
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
6739
6663
  if (shouldDropCurrentNode) {
6740
6664
  // Drop non-containing blocks.
6741
6665
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -6798,12 +6722,6 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
6798
6722
  scrollTop: 0
6799
6723
  };
6800
6724
  const offsets = createCoords(0);
6801
-
6802
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
6803
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
6804
- function setLeftRTLScrollbarOffset() {
6805
- offsets.x = getWindowScrollBarX(documentElement);
6806
- }
6807
6725
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
6808
6726
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
6809
6727
  scroll = getNodeScroll(offsetParent);
@@ -6813,15 +6731,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
6813
6731
  offsets.x = offsetRect.x + offsetParent.clientLeft;
6814
6732
  offsets.y = offsetRect.y + offsetParent.clientTop;
6815
6733
  } else if (documentElement) {
6816
- setLeftRTLScrollbarOffset();
6734
+ offsets.x = getWindowScrollBarX(documentElement);
6817
6735
  }
6818
6736
  }
6819
- if (isFixed && !isOffsetParentAnElement && documentElement) {
6820
- setLeftRTLScrollbarOffset();
6821
- }
6822
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
6823
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
6824
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
6737
+ const x = rect.left + scroll.scrollLeft - offsets.x;
6738
+ const y = rect.top + scroll.scrollTop - offsets.y;
6825
6739
  return {
6826
6740
  x,
6827
6741
  y,
@@ -6831,26 +6745,17 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
6831
6745
  }
6832
6746
 
6833
6747
  function isStaticPositioned(element) {
6834
- return getComputedStyle$1(element).position === 'static';
6748
+ return getComputedStyle(element).position === 'static';
6835
6749
  }
6836
6750
 
6837
6751
  function getTrueOffsetParent(element, polyfill) {
6838
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
6752
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
6839
6753
  return null;
6840
6754
  }
6841
6755
  if (polyfill) {
6842
6756
  return polyfill(element);
6843
6757
  }
6844
- let rawOffsetParent = element.offsetParent;
6845
-
6846
- // Firefox returns the <html> element as the offsetParent if it's non-static,
6847
- // while Chrome and Safari return the <body> element. The <body> element must
6848
- // be used to perform the correct calculations even if the <html> element is
6849
- // non-static.
6850
- if (getDocumentElement(element) === rawOffsetParent) {
6851
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
6852
- }
6853
- return rawOffsetParent;
6758
+ return element.offsetParent;
6854
6759
  }
6855
6760
 
6856
6761
  // Gets the closest ancestor positioned element. Handles some edge cases,
@@ -6896,7 +6801,7 @@ const getElementRects = async function (data) {
6896
6801
  };
6897
6802
 
6898
6803
  function isRTL(element) {
6899
- return getComputedStyle$1(element).direction === 'rtl';
6804
+ return getComputedStyle(element).direction === 'rtl';
6900
6805
  }
6901
6806
 
6902
6807
  const platform = {
@@ -6912,10 +6817,6 @@ const platform = {
6912
6817
  isRTL
6913
6818
  };
6914
6819
 
6915
- function rectsAreEqual(a, b) {
6916
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
6917
- }
6918
-
6919
6820
  // https://samthor.au/2021/observing-dom/
6920
6821
  function observeMove(element, onMove) {
6921
6822
  let io = null;
@@ -6935,13 +6836,12 @@ function observeMove(element, onMove) {
6935
6836
  threshold = 1;
6936
6837
  }
6937
6838
  cleanup();
6938
- const elementRectForRootMargin = element.getBoundingClientRect();
6939
6839
  const {
6940
6840
  left,
6941
6841
  top,
6942
6842
  width,
6943
6843
  height
6944
- } = elementRectForRootMargin;
6844
+ } = element.getBoundingClientRect();
6945
6845
  if (!skip) {
6946
6846
  onMove();
6947
6847
  }
@@ -6974,16 +6874,6 @@ function observeMove(element, onMove) {
6974
6874
  refresh(false, ratio);
6975
6875
  }
6976
6876
  }
6977
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
6978
- // It's possible that even though the ratio is reported as 1, the
6979
- // element is not actually fully within the IntersectionObserver's root
6980
- // area anymore. This can happen under performance constraints. This may
6981
- // be a bug in the browser's IntersectionObserver implementation. To
6982
- // work around this, we compare the element's bounding rect now with
6983
- // what it was at the time we created the IntersectionObserver. If they
6984
- // are not equal then the element moved, so we refresh.
6985
- refresh();
6986
- }
6987
6877
  isFirstUpdate = false;
6988
6878
  }
6989
6879
 
@@ -6995,7 +6885,7 @@ function observeMove(element, onMove) {
6995
6885
  // Handle <iframe>s
6996
6886
  root: root.ownerDocument
6997
6887
  });
6998
- } catch (_e) {
6888
+ } catch (e) {
6999
6889
  io = new IntersectionObserver(handleObserve, options);
7000
6890
  }
7001
6891
  io.observe(element);
@@ -7061,7 +6951,7 @@ function autoUpdate(reference, floating, update, options) {
7061
6951
  }
7062
6952
  function frameLoop() {
7063
6953
  const nextRefRect = getBoundingClientRect(reference);
7064
- if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
6954
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
7065
6955
  update();
7066
6956
  }
7067
6957
  prevRefRect = nextRefRect;