@odx/foundation 1.0.0-beta.2 → 1.0.0-beta.20

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 (85) hide show
  1. package/dist/{lib/facade → cdk/control}/checkbox-form-control.d.ts +2 -2
  2. package/dist/{lib/facade → cdk/control}/checkbox-group-form-control.d.ts +2 -2
  3. package/dist/cdk/control/listbox-form-control.d.ts +22 -0
  4. package/dist/cdk/control/option-control.d.ts +24 -0
  5. package/dist/{lib/facade → cdk/control}/radio-group-form-control.d.ts +2 -2
  6. package/dist/cdk/drag-drop/drag.controller.d.ts +1 -0
  7. package/dist/{components/button/base-button.d.ts → cdk/interactive/interactive-element.d.ts} +9 -8
  8. package/dist/cdk/interactive/interactive-link.d.ts +15 -0
  9. package/dist/cdk/main.d.ts +7 -0
  10. package/dist/cdk/popover/popover-host.d.ts +12 -6
  11. package/dist/cdk/popover/popover.models.d.ts +1 -1
  12. package/dist/cdk.js +721 -127
  13. package/dist/components/accordion/accordion-header.d.ts +1 -2
  14. package/dist/components/accordion/accordion-panel.d.ts +1 -0
  15. package/dist/components/accordion/accordion.d.ts +4 -4
  16. package/dist/components/button/button.d.ts +4 -6
  17. package/dist/components/button/button.models.d.ts +12 -0
  18. package/dist/components/button/index.d.ts +0 -1
  19. package/dist/components/button-group/button-group.d.ts +0 -8
  20. package/dist/components/checkbox/checkbox.d.ts +2 -2
  21. package/dist/components/checkbox-group/checkbox-group.d.ts +1 -1
  22. package/dist/components/chip/chip.d.ts +2 -2
  23. package/dist/components/combobox/combobox.d.ts +20 -0
  24. package/dist/components/combobox/index.d.ts +2 -0
  25. package/dist/components/dropdown/dropdown.d.ts +8 -4
  26. package/dist/components/highlight/highlight.d.ts +3 -0
  27. package/dist/components/input/input.d.ts +3 -0
  28. package/dist/components/link/base-link.d.ts +2 -2
  29. package/dist/components/list/list-item.d.ts +6 -6
  30. package/dist/components/list/list.d.ts +2 -0
  31. package/dist/components/main.d.ts +1 -0
  32. package/dist/components/menu/menu.d.ts +1 -4
  33. package/dist/components/menu-item/menu-item.d.ts +3 -4
  34. package/dist/components/navigation-item/navigation-item.d.ts +2 -2
  35. package/dist/components/option/option.d.ts +1 -2
  36. package/dist/components/radio-button/radio-button.d.ts +1 -1
  37. package/dist/components/radio-group/radio-group.d.ts +1 -1
  38. package/dist/components/select/select.d.ts +9 -5
  39. package/dist/components/stack/stack.d.ts +3 -3
  40. package/dist/components/stack/stack.models.d.ts +1 -1
  41. package/dist/components/switch/switch.d.ts +1 -1
  42. package/dist/components/table/table-header.d.ts +1 -1
  43. package/dist/components/table/table-row.d.ts +1 -1
  44. package/dist/components/text/text.models.d.ts +1 -1
  45. package/dist/components/toggle-button/toggle-button.d.ts +1 -1
  46. package/dist/components/toggle-content/toggle-content.d.ts +2 -3
  47. package/dist/components/tooltip/tooltip.d.ts +1 -4
  48. package/dist/components.js +705 -649
  49. package/dist/i18n/lib/config.d.ts +4 -3
  50. package/dist/i18n.js +14 -10
  51. package/dist/lib/controllers/active-desendants-controller.d.ts +25 -0
  52. package/dist/lib/controllers/expandable-controller.d.ts +17 -0
  53. package/dist/lib/controllers/focus-trap.controller.d.ts +1 -0
  54. package/dist/lib/custom-element.d.ts +1 -1
  55. package/dist/lib/main.d.ts +9 -12
  56. package/dist/lib/mixins/can-be-disabled.d.ts +1 -1
  57. package/dist/lib/mixins/can-be-expanded.d.ts +2 -4
  58. package/dist/lib/mixins/can-be-highlighted.d.ts +8 -0
  59. package/dist/lib/mixins/can-be-readonly.d.ts +1 -1
  60. package/dist/lib/mixins/can-be-required.d.ts +1 -1
  61. package/dist/lib/mixins/can-be-selected.d.ts +2 -2
  62. package/dist/lib/mixins/can-be-validated.d.ts +1 -1
  63. package/dist/lib/mixins/form-control.d.ts +2 -2
  64. package/dist/lib/mixins/number-control.d.ts +1 -1
  65. package/dist/lib/mixins/with-loading-state.d.ts +1 -1
  66. package/dist/lib/{utils → types}/a11y.d.ts +0 -6
  67. package/dist/lib/utils/dom.d.ts +0 -2
  68. package/dist/lib/{directives/slot-fallback.d.ts → utils/empty-slot-fallback-fix.d.ts} +1 -1
  69. package/dist/lib/utils/lit.d.ts +5 -0
  70. package/dist/lib/utils/query-assigned-element.d.ts +16 -0
  71. package/dist/lib/utils/search-text-content.d.ts +1 -0
  72. package/dist/lib/utils/transformers.d.ts +5 -0
  73. package/dist/main.js +366 -626
  74. package/dist/styles.css +1 -1
  75. package/dist/vendor-dJxQG085.js +138 -0
  76. package/package.json +8 -8
  77. package/dist/lib/decorators/request-update-on-aria-change.d.ts +0 -4
  78. package/dist/lib/directives/optional-attr.d.ts +0 -2
  79. package/dist/lib/directives/optional-slot.d.ts +0 -3
  80. package/dist/lib/facade/option-control.d.ts +0 -16
  81. package/dist/lib/facade/select-form-control.d.ts +0 -19
  82. package/dist/lib/utils/object.d.ts +0 -2
  83. package/dist/vendor-C_WVAD3D.js +0 -3680
  84. package/dist/vite.config.d.ts +0 -3
  85. /package/dist/lib/{mixins → utils}/dedupe-mixin.d.ts +0 -0
package/dist/styles.css CHANGED
@@ -1 +1 @@
1
- @layer reset,base,variant,state,theme;@layer reset{:is(*){box-sizing:border-box;scrollbar-width:thin}:before,:after{box-sizing:border-box}[popover]{border:none;outline:none}img,picture,video,canvas,svg{display:block;max-width:100%;margin:0}input,button,textarea,select{font:inherit;margin:0}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word;margin:0}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}#root,#__next{isolation:isolate;margin:0}}@layer base{h1,h2,h3,h4,h5,h6{display:block;font-family:var(--odx-typography-font-family-brand);font-size:var(--_font-size);font-weight:var(--odx-typography-font-weight-semibold);line-height:var(--_line-height)}h6{--_font-size: var(--odx-breakpoint-font-size-heading-6);--_line-height: var(--odx-breakpoint-line-height-heading-6)}h5{--_font-size: var(--odx-breakpoint-font-size-heading-5);--_line-height: var(--odx-breakpoint-line-height-heading-5)}h4{--_font-size: var(--odx-breakpoint-font-size-heading-4);--_line-height: var(--odx-breakpoint-line-height-heading-4)}h3{--_font-size: var(--odx-breakpoint-font-size-heading-3);--_line-height: var(--odx-breakpoint-line-height-heading-3)}h2{--_font-size: var(--odx-breakpoint-font-size-heading-2);--_line-height: var(--odx-breakpoint-line-height-heading-2)}h1{--_font-size: var(--odx-breakpoint-font-size-heading-1);--_line-height: var(--odx-breakpoint-line-height-heading-1)}[odxPreventTextOverflow]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}@layer base{:root{--odx-transition-default: all var(--odx-motion-duration-default) var(--odx-motion-easing-default);--odx-transition-slow: all var(--odx-motion-duration-slow) var(--odx-motion-easing-default);--odx-transition-reduced: all var(--odx-motion-duration-fast) var(--odx-motion-easing-reduced);--odx-page-max-inline-size: 1600px;--odx-page-max-inline-size-narrow: 1200px;--odx-page-max-inline-size-wide: 2400px;scrollbar-color:var(--odx-color-primary-rest) var(--odx-palette-transparent)}html,body{margin:0;padding:0}html{scroll-behavior:smooth}body{color:var(--odx-color-foreground-base);background-color:var(--odx-color-background-cool);font-family:var(--odx-typography-font-family-base),"Noto Sans","Kanit",sans-serif;font-size:var(--odx-typography-font-size-base);line-height:var(--odx-typography-line-height-base)}}
1
+ @layer reset,base,variant,state,theme;@layer reset{:is(*){box-sizing:border-box;scrollbar-width:thin}:not(:defined){display:none}:before,:after{box-sizing:border-box}[popover]{border:none;outline:none}img,picture,video,canvas,svg{display:block;max-width:100%;margin:0}input,button,textarea,select{font:inherit;margin:0}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word;margin:0}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}#root,#__next{isolation:isolate;margin:0}}@layer base{odx-stack{display:block}.odx-stack{&.odx-stack-horizontal{flex-flow:row}&.odx-stack-wrap{flex-flow:column wrap}&.odx-stack-horizontal.odx-stack-wrap{flex-flow:row wrap}--flow: column;display:flex;flex-flow:var(--flow);max-inline-size:100%;align-items:stretch;justify-content:flex-start;gap:var(--odx-size-75);text-align:start}}@layer base{.odx-align-start{align-items:flex-start}.odx-align-center{align-items:center}.odx-align-end{align-items:end}.odx-justify-start{justify-content:flex-start}.odx-justify-end{justify-content:flex-end}.odx-justify-center{justify-content:center}.odx-justify-space-between{justify-content:space-between}.odx-justify-space-around{justify-content:space-around}.odx-justify-space-evenly{justify-content:space-evenly}}@layer base{.odx-gap-none{gap:0}.odx-gap-xs{gap:var(--odx-size-25)}.odx-gap-sm{gap:var(--odx-size-50)}.odx-gap-md{gap:var(--odx-size-75)}.odx-gap-lg{gap:var(--odx-size-150)}.odx-gap-xl{gap:var(--odx-size-225)}}@layer base{h1,h2,h3,h4,h5,h6{display:block;font-family:var(--odx-typography-font-family-brand);font-size:var(--_font-size);font-weight:var(--odx-typography-font-weight-semibold);line-height:var(--_line-height)}h6{--_font-size: var(--odx-breakpoint-font-size-heading-6);--_line-height: var(--odx-breakpoint-line-height-heading-6)}h5{--_font-size: var(--odx-breakpoint-font-size-heading-5);--_line-height: var(--odx-breakpoint-line-height-heading-5)}h4{--_font-size: var(--odx-breakpoint-font-size-heading-4);--_line-height: var(--odx-breakpoint-line-height-heading-4)}h3{--_font-size: var(--odx-breakpoint-font-size-heading-3);--_line-height: var(--odx-breakpoint-line-height-heading-3)}h2{--_font-size: var(--odx-breakpoint-font-size-heading-2);--_line-height: var(--odx-breakpoint-line-height-heading-2)}h1{--_font-size: var(--odx-breakpoint-font-size-heading-1);--_line-height: var(--odx-breakpoint-line-height-heading-1)}odx-icon{--rotate: 0deg;transition:var(--odx-transition-default);transition-property:transform;transform:rotate(var(--rotate))}[odxPreventTextOverflow]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}odx-list-item:has(:is(odx-button,odx-icon-button,odx-list-item::part(control)):not([aria-disabled=true]):active){--_color-background-pressed: var(--_color-background-hover)}odx-button:has(odx-icon:only-child),odx-button:has(odx-avatar){--_min-inline-size: 0}odx-accordion[control-position=start] odx-accordion-header::part(expand-control){--icon-rotation: -90deg;order:-1}odx-accordion[control-position=start] odx-accordion-header[expanded]::part(expand-control){--icon-rotation: 0}odx-input:has([slot=suffix])::part(base){padding-inline-end:var(--odx-size-px)}}@layer base{:root{--odx-transition-default: all var(--odx-motion-duration-default) var(--odx-motion-easing-default);--odx-transition-slow: all var(--odx-motion-duration-slow) var(--odx-motion-easing-default);--odx-transition-reduced: all var(--odx-motion-duration-fast) var(--odx-motion-easing-reduced);--odx-page-max-inline-size: 1600px;--odx-page-max-inline-size-narrow: 1200px;--odx-page-max-inline-size-wide: 2400px;scrollbar-color:var(--odx-color-primary-rest) var(--odx-palette-transparent)}html,body{margin:0;padding:0}html{scroll-behavior:smooth}body{color:var(--odx-color-foreground-base);background-color:var(--odx-color-background-cool);font-family:var(--odx-typography-font-family-base),"Noto Sans","Kanit",sans-serif;font-size:var(--odx-typography-font-size-base);line-height:var(--odx-typography-line-height-base)}}
@@ -0,0 +1,138 @@
1
+ function round(value, precision = 0) {
2
+ if (!Number.isInteger(precision)) {
3
+ throw new Error('Precision must be an integer.');
4
+ }
5
+ const multiplier = Math.pow(10, precision);
6
+ return Math.round(value * multiplier) / multiplier;
7
+ }
8
+
9
+ function minBy(items, getValue) {
10
+ let minElement = items[0];
11
+ let min = Infinity;
12
+ for (let i = 0; i < items.length; i++) {
13
+ const element = items[i];
14
+ const value = getValue(element);
15
+ if (value < min) {
16
+ min = value;
17
+ minElement = element;
18
+ }
19
+ }
20
+ return minElement;
21
+ }
22
+
23
+ function uniqBy(arr, mapper) {
24
+ const map = new Map();
25
+ for (let i = 0; i < arr.length; i++) {
26
+ const item = arr[i];
27
+ const key = mapper(item);
28
+ if (!map.has(key)) {
29
+ map.set(key, item);
30
+ }
31
+ }
32
+ return Array.from(map.values());
33
+ }
34
+
35
+ function o(i,e,t){return typeof i===e?()=>i:typeof i=="function"?i:t}class FocusGroupController{constructor(e,{hostDelegatesFocus:t,direction:n,elementEnterAction:s,elements:r,focusInIndex:h,isFocusableElement:c,listenerScope:l}={elements:()=>[]}){this._currentIndex=-1;this.prevIndex=-1;this._direction=()=>"both";this.directionLength=5;this.hostDelegatesFocus=false;this.elementEnterAction=e=>{};this._focused=false;this._focusInIndex=e=>0;this.isFocusableElement=e=>true;this._listenerScope=()=>this.host;this.offset=0;this.recentlyConnected=false;this.handleFocusin=e=>{if(!this.isEventWithinListenerScope(e))return;const t=e.composedPath();let n=-1;t.find(s=>(n=this.elements.indexOf(s),n!==-1)),this.prevIndex=this.currentIndex,this.currentIndex=n>-1?n:this.currentIndex,this.isRelatedTargetOrContainAnElement(e)&&this.hostContainsFocus();};this.handleClick=()=>{var n;const e=this.elements;if(!e.length)return;let t=e[this.currentIndex];this.currentIndex<0||((!t||!this.isFocusableElement(t))&&(this.setCurrentIndexCircularly(1),t=e[this.currentIndex]),t&&this.isFocusableElement(t)&&((n=e[this.prevIndex])==null||n.setAttribute("tabindex","-1"),t.setAttribute("tabindex","0")));};this.handleFocusout=e=>{this.isRelatedTargetOrContainAnElement(e)&&this.hostNoLongerContainsFocus();};this.handleKeydown=e=>{if(!this.acceptsEventKey(e.key)||e.defaultPrevented)return;let t=0;switch(this.prevIndex=this.currentIndex,e.key){case "ArrowRight":t+=1;break;case "ArrowDown":t+=this.direction==="grid"?this.directionLength:1;break;case "ArrowLeft":t-=1;break;case "ArrowUp":t-=this.direction==="grid"?this.directionLength:1;break;case "End":this.currentIndex=0,t-=1;break;case "Home":this.currentIndex=this.elements.length-1,t+=1;break}e.preventDefault(),this.direction==="grid"&&this.currentIndex+t<0?this.currentIndex=0:this.direction==="grid"&&this.currentIndex+t>this.elements.length-1?this.currentIndex=this.elements.length-1:this.setCurrentIndexCircularly(t),this.elementEnterAction(this.elements[this.currentIndex]),this.focus();};this.mutationObserver=new MutationObserver(()=>{this.handleItemMutation();}),this.hostDelegatesFocus=t||false,this.host=e,this.host.addController(this),this._elements=r,this.isFocusableElement=c||this.isFocusableElement,this._direction=o(n,"string",this._direction),this.elementEnterAction=s||this.elementEnterAction,this._focusInIndex=o(h,"number",this._focusInIndex),this._listenerScope=o(l,"object",this._listenerScope);}get currentIndex(){return this._currentIndex===-1&&(this._currentIndex=this.focusInIndex),this._currentIndex-this.offset}set currentIndex(e){this._currentIndex=e+this.offset;}get direction(){return this._direction()}get elements(){return this.cachedElements||(this.cachedElements=this._elements()),this.cachedElements}set focused(e){e!==this.focused&&(this._focused=e);}get focused(){return this._focused}get focusInElement(){return this.elements[this.focusInIndex]}get focusInIndex(){return this._focusInIndex(this.elements)}isEventWithinListenerScope(e){return this._listenerScope()===this.host?true:e.composedPath().includes(this._listenerScope())}handleItemMutation(){if(this._currentIndex==-1||this.elements.length<=this._elements().length)return;const e=this.elements[this.currentIndex];if(this.clearElementCache(),this.elements.includes(e))return;const t=this.currentIndex!==this.elements.length,n=t?1:-1;t&&this.setCurrentIndexCircularly(-1),this.setCurrentIndexCircularly(n),this.focus();}update({elements:e}={elements:()=>[]}){this.unmanage(),this._elements=e,this.clearElementCache(),this.manage();}reset(){var n;const e=this.elements;if(!e.length)return;this.setCurrentIndexCircularly(this.focusInIndex-this.currentIndex);let t=e[this.currentIndex];this.currentIndex<0||((!t||!this.isFocusableElement(t))&&(this.setCurrentIndexCircularly(1),t=e[this.currentIndex]),t&&this.isFocusableElement(t)&&((n=e[this.prevIndex])==null||n.setAttribute("tabindex","-1"),t.setAttribute("tabindex","0")));}focusOnItem(e,t){var n;if(e&&this.isFocusableElement(e)&&this.elements.indexOf(e)){const s=this.elements.indexOf(e)-this.currentIndex;this.setCurrentIndexCircularly(s),(n=this.elements[this.prevIndex])==null||n.setAttribute("tabindex","-1");}this.focus(t);}focus(e){var s;const t=this.elements;if(!t.length)return;let n=t[this.currentIndex];(!n||!this.isFocusableElement(n))&&(this.setCurrentIndexCircularly(1),n=t[this.currentIndex]),n&&this.isFocusableElement(n)&&((!this.hostDelegatesFocus||t[this.prevIndex]!==n)&&((s=t[this.prevIndex])==null||s.setAttribute("tabindex","-1")),n.tabIndex=0,n.focus(e),this.hostDelegatesFocus&&!this.focused&&this.hostContainsFocus());}clearElementCache(e=0){this.mutationObserver.disconnect(),delete this.cachedElements,this.offset=e,requestAnimationFrame(()=>{this.elements.forEach(t=>{this.mutationObserver.observe(t,{attributes:true});});});}setCurrentIndexCircularly(e){const{length:t}=this.elements;let n=t;this.prevIndex=this.currentIndex;let s=(t+this.currentIndex+e)%t;for(;n&&this.elements[s]&&!this.isFocusableElement(this.elements[s]);)s=(t+s+e)%t,n-=1;this.currentIndex=s;}hostContainsFocus(){this.host.addEventListener("focusout",this.handleFocusout),this.host.addEventListener("keydown",this.handleKeydown),this.focused=true;}hostNoLongerContainsFocus(){this.host.addEventListener("focusin",this.handleFocusin),this.host.removeEventListener("focusout",this.handleFocusout),this.host.removeEventListener("keydown",this.handleKeydown),this.focused=false;}isRelatedTargetOrContainAnElement(e){const t=e.relatedTarget,n=this.elements.includes(t),s=this.elements.some(r=>r.contains(t));return !(n||s)}acceptsEventKey(e){if(e==="End"||e==="Home")return true;switch(this.direction){case "horizontal":return e==="ArrowLeft"||e==="ArrowRight";case "vertical":return e==="ArrowUp"||e==="ArrowDown";case "both":case "grid":return e.startsWith("Arrow")}}manage(){this.addEventListeners();}unmanage(){this.removeEventListeners();}addEventListeners(){this.host.addEventListener("focusin",this.handleFocusin),this.host.addEventListener("click",this.handleClick);}removeEventListeners(){this.host.removeEventListener("focusin",this.handleFocusin),this.host.removeEventListener("focusout",this.handleFocusout),this.host.removeEventListener("keydown",this.handleKeydown),this.host.removeEventListener("click",this.handleClick);}hostConnected(){this.recentlyConnected=true,this.addEventListeners();}hostDisconnected(){this.mutationObserver.disconnect(),this.removeEventListeners();}hostUpdated(){this.recentlyConnected&&(this.recentlyConnected=false,this.elements.forEach(e=>{this.mutationObserver.observe(e,{attributes:true});}));}}
36
+
37
+ class RovingTabindexController extends FocusGroupController{constructor(){super(...arguments);this.managed=true;this.manageIndexesAnimationFrame=0;}set focused(e){e!==this.focused&&(super.focused=e,this.manageTabindexes());}get focused(){return super.focused}clearElementCache(e=0){cancelAnimationFrame(this.manageIndexesAnimationFrame),super.clearElementCache(e),this.managed&&(this.manageIndexesAnimationFrame=requestAnimationFrame(()=>this.manageTabindexes()));}manageTabindexes(){this.focused&&!this.hostDelegatesFocus?this.updateTabindexes(()=>({tabIndex:-1})):this.updateTabindexes(e=>({removeTabIndex:e.contains(this.focusInElement)&&e!==this.focusInElement,tabIndex:e===this.focusInElement?0:-1}));}updateTabindexes(e){this.elements.forEach(a=>{const{tabIndex:n,removeTabIndex:s}=e(a);if(!s){this.focused?a!==this.elements[this.currentIndex]&&(a.tabIndex=n):a.tabIndex=n;return}const t=a;t.requestUpdate&&t.requestUpdate();});}manage(){this.managed=true,this.manageTabindexes(),super.manage();}unmanage(){this.managed=false,this.updateTabindexes(()=>({tabIndex:0})),super.unmanage();}hostUpdated(){super.hostUpdated(),this.host.hasUpdated||this.manageTabindexes();}}
38
+
39
+ function debounce(func, debounceMs, { signal, edges } = {}) {
40
+ let pendingThis = undefined;
41
+ let pendingArgs = null;
42
+ const leading = edges != null && edges.includes('leading');
43
+ const trailing = edges == null || edges.includes('trailing');
44
+ const invoke = () => {
45
+ if (pendingArgs !== null) {
46
+ func.apply(pendingThis, pendingArgs);
47
+ pendingThis = undefined;
48
+ pendingArgs = null;
49
+ }
50
+ };
51
+ const onTimerEnd = () => {
52
+ if (trailing) {
53
+ invoke();
54
+ }
55
+ cancel();
56
+ };
57
+ let timeoutId = null;
58
+ const schedule = () => {
59
+ if (timeoutId != null) {
60
+ clearTimeout(timeoutId);
61
+ }
62
+ timeoutId = setTimeout(() => {
63
+ timeoutId = null;
64
+ onTimerEnd();
65
+ }, debounceMs);
66
+ };
67
+ const cancelTimer = () => {
68
+ if (timeoutId !== null) {
69
+ clearTimeout(timeoutId);
70
+ timeoutId = null;
71
+ }
72
+ };
73
+ const cancel = () => {
74
+ cancelTimer();
75
+ pendingThis = undefined;
76
+ pendingArgs = null;
77
+ };
78
+ const flush = () => {
79
+ cancelTimer();
80
+ invoke();
81
+ };
82
+ const debounced = function (...args) {
83
+ if (signal?.aborted) {
84
+ return;
85
+ }
86
+ pendingThis = this;
87
+ pendingArgs = args;
88
+ const isFirstCall = timeoutId == null;
89
+ schedule();
90
+ if (leading && isFirstCall) {
91
+ invoke();
92
+ }
93
+ };
94
+ debounced.schedule = schedule;
95
+ debounced.cancel = cancel;
96
+ debounced.flush = flush;
97
+ signal?.addEventListener('abort', cancel, { once: true });
98
+ return debounced;
99
+ }
100
+
101
+ function isPlainObject(value) {
102
+ if (!value || typeof value !== 'object') {
103
+ return false;
104
+ }
105
+ const proto = Object.getPrototypeOf(value);
106
+ const hasObjectPrototype = proto === null ||
107
+ proto === Object.prototype ||
108
+ Object.getPrototypeOf(proto) === null;
109
+ if (!hasObjectPrototype) {
110
+ return false;
111
+ }
112
+ return Object.prototype.toString.call(value) === '[object Object]';
113
+ }
114
+
115
+ function flattenObject(object, { delimiter = '.' } = {}) {
116
+ return flattenObjectImpl(object, '', delimiter);
117
+ }
118
+ function flattenObjectImpl(object, prefix = '', delimiter = '.') {
119
+ const result = {};
120
+ const keys = Object.keys(object);
121
+ for (let i = 0; i < keys.length; i++) {
122
+ const key = keys[i];
123
+ const value = object[key];
124
+ const prefixedKey = prefix ? `${prefix}${delimiter}${key}` : key;
125
+ if (isPlainObject(value) && Object.keys(value).length > 0) {
126
+ Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
127
+ continue;
128
+ }
129
+ if (Array.isArray(value)) {
130
+ Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
131
+ continue;
132
+ }
133
+ result[prefixedKey] = value;
134
+ }
135
+ return result;
136
+ }
137
+
138
+ export { RovingTabindexController as R, debounce as d, flattenObject as f, minBy as m, round as r, uniqBy as u };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odx/foundation",
3
3
  "description": "A library of Web Component building blocks for ODX",
4
- "version": "1.0.0-beta.2",
4
+ "version": "1.0.0-beta.20",
5
5
  "author": "Drägerwerk AG & Co.KGaA",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "homepage": "https://odx.draeger.com",
@@ -13,25 +13,25 @@
13
13
  "lint": "biome lint ."
14
14
  },
15
15
  "dependencies": {
16
- "@lit-labs/preact-signals": "~1.0.3",
16
+ "@floating-ui/dom": "~1.6.13",
17
17
  "@lit/context": "~1.1.4",
18
+ "@lit-labs/preact-signals": "~1.0.3",
18
19
  "@odx/design-tokens": "^1.0.0-alpha.8",
20
+ "focus-trap": "~7.6.4",
19
21
  "lit": "~3.2.1"
20
22
  },
23
+ "peerDependencies": {
24
+ "@odx/icons": "^4.0.0-rc.15"
25
+ },
21
26
  "devDependencies": {
22
- "@floating-ui/dom": "1.6.13",
23
27
  "@odx/typescript-config": "*",
24
28
  "@spectrum-web-components/reactive-controllers": "1.4.0",
25
29
  "es-toolkit": "1.34.1",
26
- "focus-trap": "7.6.4",
27
30
  "ts-lit-plugin": "2.0.2",
28
- "vite": "6.2.3",
31
+ "vite": "6.2.5",
29
32
  "vite-plugin-checker": "0.9.1",
30
33
  "vite-plugin-dts": "4.5.3"
31
34
  },
32
- "peerDependencies": {
33
- "@odx/icons": "^4.0.0-rc.15"
34
- },
35
35
  "sideEffects": ["dist/loader.js", "*.css"],
36
36
  "exports": {
37
37
  ".": {
@@ -1,4 +0,0 @@
1
- import { ReactiveElement } from 'lit';
2
- import { ARIAProperty } from '../utils/a11y.js';
3
- export declare function requestUpdateOnAriaChange(ariaProperties: ARIAProperty[]): (ctor: typeof ReactiveElement) => void;
4
- //# sourceMappingURL=request-update-on-aria-change.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const optionalAttr: <T>(value: T) => NonNullable<T>;
2
- //# sourceMappingURL=optional-attr.d.ts.map
@@ -1,3 +0,0 @@
1
- import { ReactiveElement, TemplateResult, nothing } from 'lit';
2
- export declare function optionalSlot(host: ReactiveElement, slotName: string): TemplateResult | typeof nothing;
3
- //# sourceMappingURL=optional-slot.d.ts.map
@@ -1,16 +0,0 @@
1
- import { PropertyValueMap } from 'lit';
2
- import { CustomElement } from '../custom-element.js';
3
- import { CanBeDisabled } from '../mixins/can-be-disabled.js';
4
- declare const OptionControl_base: import('../main.js').Constructor<CanBeDisabled> & typeof CustomElement;
5
- export declare abstract class OptionControl extends OptionControl_base {
6
- role: 'option' | 'gridcell' | 'row' | 'tab' | null;
7
- selected: boolean;
8
- value: string;
9
- getTextLabel(): string;
10
- setActive(): void;
11
- setInactive(): void;
12
- connectedCallback(): void;
13
- protected willUpdate(changes: PropertyValueMap<this>): void;
14
- }
15
- export {};
16
- //# sourceMappingURL=option-control.d.ts.map
@@ -1,19 +0,0 @@
1
- import { PropertyValues } from 'lit';
2
- import { CustomElement } from '../custom-element.js';
3
- import { OptionControl } from './option-control.js';
4
- declare const SelectFormControl_base: import('../main.js').Constructor<import('../mixins/form-control.js').IsFormControl<string | string[]>> & typeof CustomElement;
5
- export declare abstract class SelectFormControl<Option extends OptionControl = OptionControl> extends SelectFormControl_base {
6
- #private;
7
- protected abstract options: Option[];
8
- multiple: boolean;
9
- value: string[] | string;
10
- get selectedOptions(): MapIterator<Option>;
11
- constructor();
12
- toggle(option: OptionControl, state?: boolean, emitEvent?: boolean): void;
13
- protected updateValue(option: OptionControl): void;
14
- protected willUpdate(changes: PropertyValues<this>): void;
15
- protected updateSelection(): Promise<void>;
16
- protected handleKeyboardEvent: (event: KeyboardEvent) => void;
17
- }
18
- export {};
19
- //# sourceMappingURL=select-form-control.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function createOptions<T extends object>(defaultOptions: T): (options?: Partial<T> | null) => T;
2
- //# sourceMappingURL=object.d.ts.map