@oscarpalmer/oui 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/dist/css/grid.css +38 -0
  2. package/dist/js/color-picker/color-picker.constants.d.mts +1 -1
  3. package/dist/js/color-picker/color-picker.constants.mjs +1 -2
  4. package/dist/js/color-picker/color-picker.dom.d.mts +2 -4
  5. package/dist/js/color-picker/color-picker.dom.mjs +1 -2
  6. package/dist/js/color-picker/color-picker.event.d.mts +2 -4
  7. package/dist/js/color-picker/color-picker.event.mjs +8 -9
  8. package/dist/js/color-picker/color-picker.form.d.mts +2 -4
  9. package/dist/js/color-picker/color-picker.form.mjs +2 -3
  10. package/dist/js/color-picker/color-picker.misc.d.mts +1 -1
  11. package/dist/js/color-picker/color-picker.misc.mjs +1 -2
  12. package/dist/js/color-picker/color-picker.model.d.mts +1 -1
  13. package/dist/js/color-picker/color-picker.model.mjs +1 -2
  14. package/dist/js/color-picker/color-picker.output.d.mts +2 -4
  15. package/dist/js/color-picker/color-picker.output.mjs +4 -5
  16. package/dist/js/color-picker/color-picker.state.d.mts +2 -4
  17. package/dist/js/color-picker/color-picker.state.mjs +4 -5
  18. package/dist/js/color-picker/index.d.mts +5 -7
  19. package/dist/js/color-picker/index.mjs +3 -4
  20. package/dist/js/{color-picker.constants-BZgXQr5o.d.mts → color-picker.constants-DdttC4ab.d.mts} +3 -8
  21. package/dist/js/{color-picker.misc-BIS3R6jk.d.mts → color-picker.misc-BH_tFyWR.d.mts} +1 -3
  22. package/dist/js/combobox/combobox.constants.d.mts +2 -2
  23. package/dist/js/combobox/combobox.constants.mjs +3 -3
  24. package/dist/js/combobox/combobox.dom.d.mts +3 -4
  25. package/dist/js/combobox/combobox.dom.mjs +3 -3
  26. package/dist/js/combobox/combobox.event.d.mts +3 -5
  27. package/dist/js/combobox/combobox.event.mjs +1 -2
  28. package/dist/js/combobox/combobox.misc.d.mts +1 -1
  29. package/dist/js/combobox/combobox.misc.mjs +1 -2
  30. package/dist/js/combobox/combobox.model.d.mts +1 -1
  31. package/dist/js/combobox/combobox.state.d.mts +3 -5
  32. package/dist/js/combobox/combobox.state.mjs +1 -2
  33. package/dist/js/combobox/index.d.mts +7 -9
  34. package/dist/js/combobox/index.mjs +3 -4
  35. package/dist/js/{combobox.constants-Hb3bqqQJ.d.mts → combobox.constants-CDnBNJC0.d.mts} +3 -4
  36. package/dist/js/{combobox.misc-DRDFk6X8.d.mts → combobox.misc-Csh9lm9_.d.mts} +1 -3
  37. package/dist/js/{combobox.model-gjEI2VqZ.d.mts → combobox.model-BRGQDuRl.d.mts} +2 -4
  38. package/dist/js/{combobox.state-AstCICiH.mjs → combobox.state-Bjt0dwe3.mjs} +29 -29
  39. package/dist/js/dialog/dialog.model.d.mts +1 -1
  40. package/dist/js/dialog/dialog.model.mjs +1 -2
  41. package/dist/js/dialog/index.d.mts +1 -3
  42. package/dist/js/dialog/index.mjs +2 -3
  43. package/dist/js/{dialog.model-HVzYWoDo.d.mts → dialog.model-cYq7rTKL.d.mts} +2 -4
  44. package/dist/js/floatable/floatable.embedded.d.mts +1 -1
  45. package/dist/js/floatable/floatable.embedded.mjs +1 -2
  46. package/dist/js/floatable/floatable.model.d.mts +1 -1
  47. package/dist/js/floatable/floatable.model.mjs +1 -2
  48. package/dist/js/floatable/floatable.standalone.d.mts +2 -2
  49. package/dist/js/floatable/floatable.standalone.mjs +1 -2
  50. package/dist/js/{floatable.embedded-ncshL3Sa.d.mts → floatable.embedded-Cr1KX6GZ.d.mts} +1 -3
  51. package/dist/js/{floatable.model-DXsQgoU7.d.mts → floatable.model-jS5Ui5Av.d.mts} +0 -2
  52. package/dist/js/focus-trap/focus-trap.embedded.d.mts +1 -1
  53. package/dist/js/focus-trap/focus-trap.embedded.mjs +4 -5
  54. package/dist/js/focus-trap/focus-trap.model.d.mts +2 -2
  55. package/dist/js/focus-trap/focus-trap.model.mjs +3 -3
  56. package/dist/js/focus-trap/focus-trap.standalone.d.mts +2 -2
  57. package/dist/js/focus-trap/focus-trap.standalone.mjs +1 -2
  58. package/dist/js/{focus-trap.embedded-DpcPkP7c.d.mts → focus-trap.embedded-BVXcd4OO.d.mts} +1 -3
  59. package/dist/js/{focus-trap.model-CpltX5B5.d.mts → focus-trap.model-wg0iAZ7x.d.mts} +2 -3
  60. package/dist/js/grid/grid.dom.d.mts +7 -0
  61. package/dist/js/grid/grid.dom.mjs +171 -0
  62. package/dist/js/grid/grid.event.d.mts +7 -0
  63. package/dist/js/grid/grid.event.mjs +1 -0
  64. package/dist/js/grid/grid.misc.d.mts +6 -0
  65. package/dist/js/grid/grid.misc.mjs +1 -0
  66. package/dist/js/grid/grid.model.d.mts +2 -0
  67. package/dist/js/grid/grid.model.mjs +39 -0
  68. package/dist/js/grid/index.d.mts +22 -0
  69. package/dist/js/grid/index.mjs +48 -0
  70. package/dist/js/grid.event-K_pG2vmS.mjs +192 -0
  71. package/dist/js/grid.model-SiNst5db.d.mts +90 -0
  72. package/dist/js/index.d.mts +22 -21
  73. package/dist/js/index.mjs +5 -3
  74. package/dist/js/internal/attributable.d.mts +1 -3
  75. package/dist/js/internal/attributable.mjs +3 -3
  76. package/dist/js/internal/draggable/draggable.model.d.mts +2 -2
  77. package/dist/js/internal/draggable/draggable.model.mjs +3 -3
  78. package/dist/js/internal/draggable/index.d.mts +2 -4
  79. package/dist/js/internal/draggable/index.mjs +18 -14
  80. package/dist/js/internal/l10n/index.d.mts +2 -4
  81. package/dist/js/internal/l10n/index.mjs +30 -22
  82. package/dist/js/internal/l10n/l10n.model.d.mts +1 -1
  83. package/dist/js/internal/l10n/l10n.model.mjs +1 -2
  84. package/dist/js/internal/misc.d.mts +2 -3
  85. package/dist/js/internal/misc.mjs +5 -3
  86. package/dist/js/internal/navigable/index.d.mts +2 -4
  87. package/dist/js/internal/navigable/index.mjs +1 -2
  88. package/dist/js/internal/navigable/navigable.model.d.mts +1 -1
  89. package/dist/js/internal/navigable/navigable.model.mjs +1 -2
  90. package/dist/js/internal/option-list/option-list.constants.d.mts +3 -5
  91. package/dist/js/internal/option-list/option-list.constants.mjs +3 -4
  92. package/dist/js/internal/option-list/option-list.data.d.mts +3 -4
  93. package/dist/js/internal/option-list/option-list.data.mjs +1 -2
  94. package/dist/js/internal/option-list/option-list.dom.d.mts +3 -5
  95. package/dist/js/internal/option-list/option-list.dom.mjs +1 -2
  96. package/dist/js/internal/option-list/option-list.event.d.mts +3 -5
  97. package/dist/js/internal/option-list/option-list.event.mjs +4 -5
  98. package/dist/js/internal/option-list/option-list.form.d.mts +3 -5
  99. package/dist/js/internal/option-list/option-list.form.mjs +2 -3
  100. package/dist/js/internal/option-list/option-list.misc.d.mts +3 -5
  101. package/dist/js/internal/option-list/option-list.misc.mjs +1 -2
  102. package/dist/js/internal/option-list/option-list.model.d.mts +2 -2
  103. package/dist/js/internal/option-list/option-list.model.mjs +7 -1
  104. package/dist/js/internal/option-list/option-list.state.d.mts +3 -5
  105. package/dist/js/internal/option-list/option-list.state.mjs +2 -3
  106. package/dist/js/l10n/index.d.mts +1 -1
  107. package/dist/js/l10n/index.mjs +1 -2
  108. package/dist/js/{l10n.model-D1E1u35L.d.mts → l10n.model-DxwLXnFl.d.mts} +0 -2
  109. package/dist/js/listbox/index.d.mts +6 -8
  110. package/dist/js/listbox/index.mjs +3 -4
  111. package/dist/js/listbox/listbox.constants.d.mts +1 -1
  112. package/dist/js/listbox/listbox.constants.mjs +1 -2
  113. package/dist/js/listbox/listbox.dom.d.mts +2 -4
  114. package/dist/js/listbox/listbox.dom.mjs +1 -2
  115. package/dist/js/listbox/listbox.event.d.mts +3 -5
  116. package/dist/js/listbox/listbox.event.mjs +1 -2
  117. package/dist/js/listbox/listbox.misc.d.mts +1 -1
  118. package/dist/js/listbox/listbox.misc.mjs +1 -2
  119. package/dist/js/listbox/listbox.model.d.mts +1 -1
  120. package/dist/js/listbox/listbox.state.d.mts +3 -5
  121. package/dist/js/listbox/listbox.state.mjs +1 -2
  122. package/dist/js/{listbox.constants-DOBMwKup.d.mts → listbox.constants-1yMPRl2C.d.mts} +1 -3
  123. package/dist/js/{listbox.misc-DwfB4Mu_.d.mts → listbox.misc-CkW28nUS.d.mts} +1 -3
  124. package/dist/js/{listbox.model-C0MYWXZe.d.mts → listbox.model-CUA_DaR9.d.mts} +1 -3
  125. package/dist/js/{listbox.state-BrN296BM.mjs → listbox.state-DO58GDqc.mjs} +8 -12
  126. package/dist/js/menu/index.mjs +5 -6
  127. package/dist/js/menu/menu.model.d.mts +3 -5
  128. package/dist/js/menu/menu.model.mjs +1 -2
  129. package/dist/js/movable/movable.embedded.d.mts +1 -1
  130. package/dist/js/movable/movable.embedded.mjs +3 -4
  131. package/dist/js/movable/movable.model.d.mts +2 -2
  132. package/dist/js/movable/movable.model.mjs +3 -3
  133. package/dist/js/movable/movable.standalone.d.mts +2 -2
  134. package/dist/js/movable/movable.standalone.mjs +1 -2
  135. package/dist/js/{movable.embedded-C1bDTLGs.d.mts → movable.embedded-HjPPob-Z.d.mts} +1 -3
  136. package/dist/js/{movable.model-D9nnPWKk.d.mts → movable.model-CQ3AbTrq.d.mts} +13 -7
  137. package/dist/js/{navigable.model-BqoR6iBv.d.mts → navigable.model-CrzJqKE7.d.mts} +0 -2
  138. package/dist/js/{option-list.data-CgMyUwPc.mjs → option-list.data-Be6wopy9.mjs} +7 -10
  139. package/dist/js/{option-list.model-CCPUlPeX.d.mts → option-list.model-DNZq-X0d.d.mts} +7 -4
  140. package/dist/js/popover/index.d.mts +1 -3
  141. package/dist/js/popover/index.mjs +3 -4
  142. package/dist/js/popover/popover.model.d.mts +1 -1
  143. package/dist/js/popover/popover.model.mjs +1 -2
  144. package/dist/js/{popover.model-DiLdz0Hc.d.mts → popover.model-CrrIdSmS.d.mts} +2 -4
  145. package/dist/js/resizable/resizable.embedded.d.mts +2 -2
  146. package/dist/js/resizable/resizable.embedded.mjs +122 -38
  147. package/dist/js/resizable/resizable.model.d.mts +2 -2
  148. package/dist/js/resizable/resizable.model.mjs +11 -3
  149. package/dist/js/resizable/resizable.standalone.d.mts +3 -3
  150. package/dist/js/resizable/resizable.standalone.mjs +2 -1
  151. package/dist/js/{resizable.embedded-BemH-7Re.d.mts → resizable.embedded-DQclAEP-.d.mts} +3 -4
  152. package/dist/js/resizable.model-BOufXDXx.d.mts +67 -0
  153. package/dist/js/sortable/sortable.embedded.d.mts +1 -1
  154. package/dist/js/sortable/sortable.embedded.mjs +5 -6
  155. package/dist/js/sortable/sortable.model.d.mts +2 -2
  156. package/dist/js/sortable/sortable.model.mjs +4 -3
  157. package/dist/js/sortable/sortable.standalone.d.mts +2 -2
  158. package/dist/js/sortable/sortable.standalone.mjs +1 -2
  159. package/dist/js/{sortable.embedded-CrEGff9k.d.mts → sortable.embedded-B5LPz-c_.d.mts} +1 -3
  160. package/dist/js/splitter/index.d.mts +2 -4
  161. package/dist/js/splitter/index.mjs +5 -5
  162. package/dist/js/splitter/splitter.model.d.mts +1 -1
  163. package/dist/js/splitter/splitter.model.mjs +1 -2
  164. package/dist/js/{splitter.model-C24W6eZ7.d.mts → splitter.model-DQDbIe4P.d.mts} +0 -2
  165. package/dist/js/tabs/index.d.mts +2 -4
  166. package/dist/js/tabs/index.mjs +10 -11
  167. package/dist/js/tabs/tabs.model.d.mts +1 -1
  168. package/dist/js/tabs/tabs.model.mjs +1 -2
  169. package/dist/js/{tabs.model-BHPy7fPo.d.mts → tabs.model-CvylbR2o.d.mts} +1 -3
  170. package/dist/js/toolbar/index.mjs +1 -2
  171. package/dist/js/toolbar/toolbar.model.d.mts +2 -4
  172. package/dist/js/toolbar/toolbar.model.mjs +1 -2
  173. package/dist/js/tooltip/index.d.mts +1 -3
  174. package/dist/js/tooltip/index.mjs +2 -3
  175. package/dist/js/tooltip/tooltip.model.d.mts +1 -1
  176. package/dist/js/tooltip/tooltip.model.mjs +1 -2
  177. package/dist/js/{tooltip.model-BpNStw5z.d.mts → tooltip.model-BI3UK-VU.d.mts} +1 -3
  178. package/package.json +11 -8
  179. package/dist/js/resizable.model-YEtcC9li.d.mts +0 -46
@@ -1,7 +1,6 @@
1
- import { _ as OuiLocalizationsValues, p as OuiLocalizations } from "./l10n.model-D1E1u35L.mjs";
1
+ import { _ as OuiLocalizationsValues, p as OuiLocalizations } from "./l10n.model-DxwLXnFl.mjs";
2
2
  import { PlainObject } from "@oscarpalmer/atoms/models";
3
3
  import { RemovableEventListener } from "@oscarpalmer/toretto/models";
4
- //#region src/js/internal/option-list/option-list.model.d.ts
5
4
  type CreateOptionListContent = {
6
5
  element: HTMLDivElement;
7
6
  filter?: CreateOptionListFilter;
@@ -165,5 +164,9 @@ type OptionListValues = {
165
164
  initial: string[];
166
165
  label: Element;
167
166
  };
168
- //#endregion
169
- export { OptionListType as _, CreateOptionListList as a, OptionListAttributes as c, OptionListCallbacks as d, OptionListGroup as f, OptionListState as g, OptionListPreview as h, CreateOptionListGroupParameters as i, OptionListAutoComplete as l, OptionListOptions as m, CreateOptionListContentParameters as n, CreateOptionListOptionParameters as o, OptionListLocalizationValues as p, CreateOptionListFilter as r, CreateOptionListOptionsParameters as s, CreateOptionListContent as t, OptionListAutoCompleteType as u };
167
+ declare const OPTION_LIST_PREVIEW_NONE: OptionListPreview;
168
+ declare const OPTION_LIST_PREVIEW_SET: OptionListPreview;
169
+ declare const OPTION_LIST_PREVIEW_TYPED: OptionListPreview;
170
+ declare const OPTION_LIST_TYPE_AUTOCOMPLETE: OptionListType;
171
+ declare const OPTION_LIST_TYPE_SELECT: OptionListType;
172
+ export { OptionListType as S, OptionListGroup as _, CreateOptionListList as a, OptionListPreview as b, OPTION_LIST_PREVIEW_NONE as c, OPTION_LIST_TYPE_AUTOCOMPLETE as d, OPTION_LIST_TYPE_SELECT as f, OptionListCallbacks as g, OptionListAutoCompleteType as h, CreateOptionListGroupParameters as i, OPTION_LIST_PREVIEW_SET as l, OptionListAutoComplete as m, CreateOptionListContentParameters as n, CreateOptionListOptionParameters as o, OptionListAttributes as p, CreateOptionListFilter as r, CreateOptionListOptionsParameters as s, CreateOptionListContent as t, OPTION_LIST_PREVIEW_TYPED as u, OptionListLocalizationValues as v, OptionListState as x, OptionListOptions as y };
@@ -1,5 +1,4 @@
1
- import { n as OuiPopoverState, t as OuiPopover } from "../popover.model-DiLdz0Hc.mjs";
2
- //#region src/js/popover/index.d.ts
1
+ import { n as OuiPopoverState, t as OuiPopover } from "../popover.model-CrrIdSmS.mjs";
3
2
  declare function OuiPopover(this: OuiPopover, state: OuiPopoverState): void;
4
3
  /**
5
4
  * Get the _OuiPopover_ for an element
@@ -8,5 +7,4 @@ declare function OuiPopover(this: OuiPopover, state: OuiPopoverState): void;
8
7
  * @returns _OuiPopover_ instance
9
8
  */
10
9
  export declare function getPopover(element: Element): OuiPopover | undefined;
11
- //#endregion
12
10
  export type { OuiPopover };
@@ -1,13 +1,13 @@
1
- import "../floatable/floatable.model.mjs";
2
1
  import { createEmbeddedFloatable, getOnBeforeToggleListener } from "../floatable/floatable.embedded.mjs";
3
- import { attributable } from "../internal/attributable.mjs";
2
+ import "../floatable/floatable.model.mjs";
4
3
  import { createFocusTrap } from "../focus-trap/focus-trap.embedded.mjs";
4
+ import { attributable } from "../internal/attributable.mjs";
5
5
  import { POPOVER_ATTRIBUTE, POPOVER_ATTRIBUTE_OPEN, POPOVER_SYMBOL, popoverFloatableOptions, popovers } from "./popover.model.mjs";
6
6
  import { getAria, setAria } from "@oscarpalmer/toretto/aria";
7
7
  import { setAttribute } from "@oscarpalmer/toretto/attribute";
8
8
  import { on } from "@oscarpalmer/toretto/event";
9
9
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
10
- //#region src/js/popover/index.ts
10
+ // src/js/popover/index.ts
11
11
  function OuiPopover(state) {
12
12
  this[POPOVER_SYMBOL] = state;
13
13
  initialize(state);
@@ -109,5 +109,4 @@ let ignoreFocus = false;
109
109
  let index = 0;
110
110
  on(document, "pointerdown", onPointerdown, { capture: true });
111
111
  attributable(POPOVER_ATTRIBUTE, addPopover, removePopover);
112
- //#endregion
113
112
  export { getPopover };
@@ -1,2 +1,2 @@
1
- import { a as POPOVER_SYMBOL, i as POPOVER_ATTRIBUTE_OPEN, n as OuiPopoverState, o as popoverFloatableOptions, r as POPOVER_ATTRIBUTE, s as popovers, t as OuiPopover } from "../popover.model-DiLdz0Hc.mjs";
1
+ import { a as POPOVER_SYMBOL, i as POPOVER_ATTRIBUTE_OPEN, n as OuiPopoverState, o as popoverFloatableOptions, r as POPOVER_ATTRIBUTE, s as popovers, t as OuiPopover } from "../popover.model-CrrIdSmS.mjs";
2
2
  export { OuiPopover, OuiPopoverState, POPOVER_ATTRIBUTE, POPOVER_ATTRIBUTE_OPEN, POPOVER_SYMBOL, popoverFloatableOptions, popovers };
@@ -1,4 +1,4 @@
1
- //#region src/js/popover/popover.model.ts
1
+ // src/js/popover/popover.model.ts
2
2
  const POPOVER_ATTRIBUTE = "oui-popover";
3
3
  const POPOVER_ATTRIBUTE_OPEN = `${POPOVER_ATTRIBUTE}-open`;
4
4
  const POPOVER_SYMBOL = Symbol(POPOVER_ATTRIBUTE);
@@ -8,5 +8,4 @@ const popoverFloatableOptions = {
8
8
  reusable: false
9
9
  };
10
10
  const popovers = /* @__PURE__ */ new WeakMap();
11
- //#endregion
12
11
  export { POPOVER_ATTRIBUTE, POPOVER_ATTRIBUTE_OPEN, POPOVER_SYMBOL, popoverFloatableOptions, popovers };
@@ -1,7 +1,6 @@
1
- import { c as OuiFloatable, l as OuiFloatableOptions } from "./floatable.model-DXsQgoU7.mjs";
2
- import { c as OuiFocusTrap } from "./focus-trap.model-CpltX5B5.mjs";
1
+ import { c as OuiFloatable, l as OuiFloatableOptions } from "./floatable.model-jS5Ui5Av.mjs";
2
+ import { l as OuiFocusTrap } from "./focus-trap.model-wg0iAZ7x.mjs";
3
3
  import { RemovableEventListener } from "@oscarpalmer/toretto/models";
4
- //#region src/js/popover/popover.model.d.ts
5
4
  type OuiPopover = {
6
5
  [POPOVER_SYMBOL]: OuiPopoverState;
7
6
  /**
@@ -34,5 +33,4 @@ declare const POPOVER_ATTRIBUTE_OPEN: string;
34
33
  declare const POPOVER_SYMBOL: unique symbol;
35
34
  declare const popoverFloatableOptions: OuiFloatableOptions;
36
35
  declare const popovers: WeakMap<Element, OuiPopoverState>;
37
- //#endregion
38
36
  export { POPOVER_SYMBOL as a, POPOVER_ATTRIBUTE_OPEN as i, OuiPopoverState as n, popoverFloatableOptions as o, POPOVER_ATTRIBUTE as r, popovers as s, OuiPopover as t };
@@ -1,2 +1,2 @@
1
- import { t as createResizable } from "../resizable.embedded-BemH-7Re.mjs";
2
- export { createResizable };
1
+ import { n as getResizable, t as createResizable } from "../resizable.embedded-DQclAEP-.mjs";
2
+ export { createResizable, getResizable };
@@ -1,5 +1,6 @@
1
1
  import { attributable } from "../internal/attributable.mjs";
2
- import { RESIZABLE_ATTRIBUTE, RESIZABLE_ATTRIBUTE_MAXIMUM, RESIZABLE_ATTRIBUTE_MINIMUM, RESIZABLE_MESSAGE_ELEMENT, RESIZABLE_MESSAGE_HANDLE, RESIZABLE_MESSAGE_HEIGHT, RESIZABLE_MESSAGE_WIDTH, RESIZABLE_SELECTOR, RESIZABLE_SELECTOR_HANDLE, RESIZABLE_SELECTOR_HANDLE_SCOPED, RESIZABLE_SYMBOL, resizableItems, resizableStyles } from "./resizable.model.mjs";
2
+ import { ignoreEvent } from "../internal/misc.mjs";
3
+ import { OuiResizableEvent, RESIZABLE_ATTRIBUTE, RESIZABLE_ATTRIBUTE_DIRECTION, RESIZABLE_ATTRIBUTE_STEP, RESIZABLE_EVENT_BEGIN, RESIZABLE_EVENT_CANCEL, RESIZABLE_EVENT_END, RESIZABLE_EVENT_RESIZE, RESIZABLE_MESSAGE_ELEMENT, RESIZABLE_MESSAGE_HANDLE, RESIZABLE_MESSAGE_HEIGHT, RESIZABLE_MESSAGE_WIDTH, RESIZABLE_SELECTOR_HANDLE, RESIZABLE_SELECTOR_HANDLE_SCOPED, RESIZABLE_SYMBOL, resizableHorizontals, resizableItems, resizableStyles, resizableVerticals } from "./resizable.model.mjs";
3
4
  import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
4
5
  import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
5
6
  import { findAncestor } from "@oscarpalmer/toretto/find";
@@ -7,11 +8,14 @@ import { isPlainObject } from "@oscarpalmer/atoms/is";
7
8
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
8
9
  import { setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
9
10
  import { getNumber } from "@oscarpalmer/atoms/number";
11
+ import { noop } from "@oscarpalmer/atoms/function";
10
12
  import { supportsTouch } from "@oscarpalmer/toretto/touch";
11
- //#region src/js/resizable/resizable.embedded.ts
13
+ import { round } from "@oscarpalmer/atoms/math";
14
+ // src/js/resizable/resizable.embedded.ts
12
15
  function OuiResizable(state) {
13
16
  this[RESIZABLE_SYMBOL] = state;
14
17
  }
18
+ OuiResizable.prototype.configure = configureResizable;
15
19
  OuiResizable.prototype.destroy = destroyResizable;
16
20
  OuiResizable.prototype.reset = resetResizable;
17
21
  OuiResizable.prototype.set = setResizable;
@@ -20,7 +24,7 @@ function addResizable(element, options) {
20
24
  if (item == null) {
21
25
  const handle = element.querySelector(RESIZABLE_SELECTOR_HANDLE_SCOPED);
22
26
  if (!isHTMLOrSVGElement(handle)) return;
23
- const state = getState(element, handle, options);
27
+ const state = createState(element, handle, options);
24
28
  item = {
25
29
  instance: new OuiResizable(state),
26
30
  state
@@ -36,7 +40,22 @@ function cancelResize(item) {
36
40
  width: `${item.state.width}px`
37
41
  });
38
42
  resetResizableStyles();
39
- dispatch(item.state.element, "oui:resizable:cancel");
43
+ const detail = {
44
+ height: item.state.height,
45
+ width: item.state.width
46
+ };
47
+ const cancel = new OuiResizableEvent(RESIZABLE_EVENT_CANCEL, { detail });
48
+ item.state.options.onCancel(item.state.element, detail, cancel);
49
+ dispatch(item.state.element, cancel);
50
+ }
51
+ function configureResizable(options) {
52
+ const state = this[RESIZABLE_SYMBOL];
53
+ const keys = Object.keys(options);
54
+ for (const key of keys) {
55
+ const value = options[key];
56
+ if (typeof value === typeof state.options[key]) state.options[key] = value;
57
+ }
58
+ this.set();
40
59
  }
41
60
  /**
42
61
  * Creates _(or retrieves)_ a _OuiResizable_ instance for an element
@@ -46,9 +65,25 @@ function cancelResize(item) {
46
65
  */
47
66
  function createResizable(element, options) {
48
67
  if (!isHTMLOrSVGElement(element)) throw new TypeError(RESIZABLE_MESSAGE_ELEMENT);
49
- if (!isHTMLOrSVGElement(element.querySelector(RESIZABLE_SELECTOR_HANDLE_SCOPED))) throw new Error(RESIZABLE_MESSAGE_HANDLE);
68
+ if (!isHTMLOrSVGElement(element.querySelector(":scope > [oui-resizable-handle]"))) throw new Error(RESIZABLE_MESSAGE_HANDLE);
50
69
  return addResizable(element, options ?? {});
51
70
  }
71
+ function createState(element, handle, input) {
72
+ setAttribute(element, RESIZABLE_ATTRIBUTE, "");
73
+ const options = getValidOptions(element, input);
74
+ const [width, height] = getAndSetDimensions(element, options);
75
+ const [horizontal, vertical] = getDirections(element);
76
+ return {
77
+ element,
78
+ handle,
79
+ height,
80
+ horizontal,
81
+ options,
82
+ vertical,
83
+ width,
84
+ styles: toggleStyles(element, resizableStyles)
85
+ };
86
+ }
52
87
  function destroyResizable() {
53
88
  const state = this[RESIZABLE_SYMBOL];
54
89
  state.element = void 0;
@@ -57,24 +92,34 @@ function destroyResizable() {
57
92
  state.styles = void 0;
58
93
  }
59
94
  function getAndSetDimensions(element, options, input) {
95
+ const { maximumHeight, maximumWidth, minimumHeight, minimumWidth } = options;
60
96
  let { height, width } = input ?? element.getBoundingClientRect();
61
- if (options.maximumWidth > -1 && width > options.maximumWidth) width = options.maximumWidth;
62
- else if (options.minimumWidth > -1 && width < options.minimumWidth) width = options.minimumWidth;
63
- if (options.maximumHeight > -1 && height > options.maximumHeight) height = options.maximumHeight;
64
- else if (options.minimumHeight > -1 && height < options.minimumHeight) height = options.minimumHeight;
97
+ if (maximumWidth > -1 && width > maximumWidth) width = maximumWidth;
98
+ else if (minimumWidth > -1 && width < minimumWidth) width = minimumWidth;
99
+ if (maximumHeight > -1 && height > maximumHeight) height = maximumHeight;
100
+ else if (minimumHeight > -1 && height < minimumHeight) height = minimumHeight;
65
101
  if (element.checkVisibility()) setStyles(element, {
66
102
  height: `${height}px`,
67
103
  width: `${width}px`
68
104
  });
69
105
  return [width, height];
70
106
  }
107
+ function getDirections(element) {
108
+ const attribute = getAttribute(element, RESIZABLE_ATTRIBUTE_DIRECTION);
109
+ if (resizableHorizontals.has(attribute)) return [true, false];
110
+ if (resizableVerticals.has(attribute)) return [false, true];
111
+ return [true, true];
112
+ }
71
113
  function getProperties(element, widthProperty, heightProperty) {
72
114
  const computed = getComputedStyle(element);
73
115
  return [computed[widthProperty], computed[heightProperty]];
74
116
  }
117
+ function getResizable(element) {
118
+ return resizableItems.get(element)?.instance;
119
+ }
75
120
  function getRestrictions(maximum, minimum) {
76
- const [maximumWidth, maximumHeight] = getXAndY.apply(null, typeof maximum === "string" ? [maximum] : maximum);
77
- const [minimumWidth, minimumHeight] = getXAndY.apply(null, typeof minimum === "string" ? [minimum] : minimum);
121
+ const [maximumWidth, maximumHeight] = getXAndY(maximum);
122
+ const [minimumWidth, minimumHeight] = getXAndY(minimum);
78
123
  if (maximumWidth > -1 && minimumWidth > -1 && maximumWidth <= minimumWidth) throw new Error(RESIZABLE_MESSAGE_WIDTH);
79
124
  if (maximumHeight > -1 && minimumHeight > -1 && maximumHeight <= minimumHeight) throw new Error(RESIZABLE_MESSAGE_HEIGHT);
80
125
  return {
@@ -84,25 +129,25 @@ function getRestrictions(maximum, minimum) {
84
129
  minimumWidth
85
130
  };
86
131
  }
87
- function getState(element, handle, input) {
88
- setAttribute(element, RESIZABLE_ATTRIBUTE, "");
89
- const options = getValidOptions(element, input);
90
- const [width, height] = getAndSetDimensions(element, options);
91
- return {
92
- element,
93
- handle,
94
- height,
95
- options,
96
- width,
97
- styles: toggleStyles(element, resizableStyles)
98
- };
99
- }
100
132
  function getValidOptions(element, input) {
101
133
  const original = isPlainObject(input) ? input : {};
102
- return { ...getRestrictions(input == null ? getAttribute(element, RESIZABLE_ATTRIBUTE_MAXIMUM) ?? getProperties(element, "maxWidth", "maxHeight") : [original.maximumWidth, original.maximumHeight], input == null ? getAttribute(element, RESIZABLE_ATTRIBUTE_MINIMUM) ?? getProperties(element, "minWidth", "minHeight") : [original.minimumWidth, original.minimumHeight]) };
134
+ const [stepWidth, stepHeight] = getXAndY(input == null ? getAttribute(element, RESIZABLE_ATTRIBUTE_STEP) : [original.stepWidth, original.stepHeight]);
135
+ return {
136
+ ...getRestrictions(input == null ? getAttribute(element, "oui-resizable-maximum") ?? getProperties(element, "maxWidth", "maxHeight") : [original.maximumWidth, original.maximumHeight], input == null ? getAttribute(element, "oui-resizable-minimum") ?? getProperties(element, "minWidth", "minHeight") : [original.minimumWidth, original.minimumHeight]),
137
+ onBegin: typeof original.onBegin === "function" ? original.onBegin : noop,
138
+ onCancel: typeof original.onCancel === "function" ? original.onCancel : noop,
139
+ onEnd: typeof original.onEnd === "function" ? original.onEnd : noop,
140
+ onResize: typeof original.onResize === "function" ? original.onResize : noop,
141
+ stepHeight,
142
+ stepWidth
143
+ };
103
144
  }
104
- function getXAndY(first, second) {
105
- const [x, y] = typeof first === "string" && second == null ? first.split(",") : [first, second];
145
+ function getXAndY(value) {
146
+ let first;
147
+ let second;
148
+ if (Array.isArray(value)) [first, second] = value;
149
+ else first = value;
150
+ const [x, y] = typeof first === "string" && second == null ? splitXAndY(first) : [first, second];
106
151
  let xAsNumber = typeof x === "string" ? Number.parseFloat(x) : getNumber(x);
107
152
  let yAsNumber = typeof y === "string" ? Number.parseFloat(y) : getNumber(y);
108
153
  if (Number.isNaN(xAsNumber) || xAsNumber <= 0) xAsNumber = -1;
@@ -113,15 +158,27 @@ function onKeydown(event) {
113
158
  if (current != null && event.key === "Escape") cancelResize(current);
114
159
  }
115
160
  function onPointerdown(event) {
116
- if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || (supportsTouch.value ? event.type === "mousedown" : event.type === "touchstart" || event.button !== 0)) return;
161
+ if (ignoreEvent(event, supportsTouch.value)) return;
117
162
  const handle = findAncestor(event, RESIZABLE_SELECTOR_HANDLE);
118
- const element = handle && findAncestor(handle, RESIZABLE_SELECTOR);
163
+ const element = handle && findAncestor(handle, "[oui-resizable]");
119
164
  const stored = element && resizableItems.get(element);
120
165
  const position = getEventPosition(event);
121
166
  if (stored == null || position == null) return;
122
167
  if (supportsTouch.value) event.preventDefault();
123
- if (dispatch(element, "oui:resizable:begin").defaultPrevented) return;
168
+ const detail = {
169
+ height: stored.state.height,
170
+ width: stored.state.width
171
+ };
172
+ const begin = new OuiResizableEvent(RESIZABLE_EVENT_BEGIN, { detail });
173
+ stored.state.options.onBegin(stored.state.element, detail, begin);
174
+ dispatch(element, begin);
175
+ if (begin.defaultPrevented) return;
176
+ event.stopPropagation();
124
177
  current = stored;
178
+ last = {
179
+ height: stored.state.height,
180
+ width: stored.state.width
181
+ };
125
182
  start = position;
126
183
  current.state.styles.set();
127
184
  styleToggler.set();
@@ -130,19 +187,41 @@ function onPointermove(event) {
130
187
  if (current == null) return;
131
188
  const { x, y } = getEventPosition(event) ?? {};
132
189
  if (x == null || y == null) return;
133
- const width = current.state.width + (x - (start?.x ?? 0));
134
- const height = current.state.height + (y - (start?.y ?? 0));
135
- getAndSetDimensions(current.state.element, current.state.options, {
190
+ const { stepHeight, stepWidth } = current.state.options;
191
+ let deltaX = current.state.horizontal ? x - (start?.x ?? 0) : 0;
192
+ let deltaY = current.state.vertical ? y - (start?.y ?? 0) : 0;
193
+ if (stepWidth > -1) deltaX = round(deltaX / stepWidth) * stepWidth;
194
+ if (stepHeight > -1) deltaY = round(deltaY / stepHeight) * stepHeight;
195
+ let width = current.state.width + deltaX;
196
+ let height = current.state.height + deltaY;
197
+ [width, height] = getAndSetDimensions(current.state.element, current.state.options, {
136
198
  height,
137
199
  width
138
200
  });
139
- if (dispatch(current.state.element, "oui:resizable:resize", { detail: {
201
+ if (last?.height === height && last?.width === width) return;
202
+ last = {
203
+ height,
204
+ width
205
+ };
206
+ const detail = {
140
207
  height,
141
208
  width
142
- } }).defaultPrevented) cancelResize(current);
209
+ };
210
+ const resize = new OuiResizableEvent(RESIZABLE_EVENT_RESIZE, { detail });
211
+ current.state.options.onResize(current.state.element, detail, resize);
212
+ dispatch(current.state.element, resize);
213
+ if (resize.defaultPrevented) cancelResize(current);
143
214
  }
144
215
  function onPointerup() {
145
- if (current == null || dispatch(current.state.element, "oui:resizable:end").defaultPrevented) {
216
+ if (current == null) return;
217
+ const detail = {
218
+ height: last?.height ?? current.state.height,
219
+ width: last?.width ?? current.state.width
220
+ };
221
+ const end = new OuiResizableEvent(RESIZABLE_EVENT_END, { detail });
222
+ current.state.options.onEnd(current.state.element, detail, end);
223
+ dispatch(current.state.element, end);
224
+ if (end.defaultPrevented) {
146
225
  cancelResize(current);
147
226
  return;
148
227
  }
@@ -165,6 +244,7 @@ function resetResizableStyles() {
165
244
  current?.state.styles.remove();
166
245
  styleToggler.remove();
167
246
  current = void 0;
247
+ last = void 0;
168
248
  start = void 0;
169
249
  }
170
250
  function setResizable() {
@@ -173,8 +253,13 @@ function setResizable() {
173
253
  state.width = width;
174
254
  state.height = height;
175
255
  }
256
+ function splitXAndY(value) {
257
+ const parts = value.split(",");
258
+ return [parts[0], parts.length > 1 ? parts[1] : parts[0]];
259
+ }
176
260
  const styleToggler = toggleStyles(document.body, resizableStyles);
177
261
  let current;
262
+ let last;
178
263
  let start;
179
264
  on(document, "keydown", onKeydown);
180
265
  on(document, "mousedown", onPointerdown);
@@ -183,5 +268,4 @@ on(document, "pointerup", onPointerup);
183
268
  on(document, "touchcancel", onPointerup);
184
269
  on(document, "touchstart", onPointerdown, { passive: false });
185
270
  attributable(RESIZABLE_ATTRIBUTE, addResizable, removeResizable);
186
- //#endregion
187
- export { createResizable };
271
+ export { createResizable, getResizable };
@@ -1,2 +1,2 @@
1
- import { _ as resizableItems, a as RESIZABLE_ATTRIBUTE, c as RESIZABLE_ATTRIBUTE_MINIMUM, d as RESIZABLE_MESSAGE_HEIGHT, f as RESIZABLE_MESSAGE_WIDTH, g as RESIZABLE_SYMBOL, h as RESIZABLE_SELECTOR_HANDLE_SCOPED, i as OuiResizableState, l as RESIZABLE_MESSAGE_ELEMENT, m as RESIZABLE_SELECTOR_HANDLE, n as OuiResizable, o as RESIZABLE_ATTRIBUTE_HANDLE, p as RESIZABLE_SELECTOR, r as OuiResizableItem, s as RESIZABLE_ATTRIBUTE_MAXIMUM, t as CreateOuiResizableOptions, u as RESIZABLE_MESSAGE_HANDLE, v as resizableStyles } from "../resizable.model-YEtcC9li.mjs";
2
- export { CreateOuiResizableOptions, OuiResizable, OuiResizableItem, OuiResizableState, RESIZABLE_ATTRIBUTE, RESIZABLE_ATTRIBUTE_HANDLE, RESIZABLE_ATTRIBUTE_MAXIMUM, RESIZABLE_ATTRIBUTE_MINIMUM, RESIZABLE_MESSAGE_ELEMENT, RESIZABLE_MESSAGE_HANDLE, RESIZABLE_MESSAGE_HEIGHT, RESIZABLE_MESSAGE_WIDTH, RESIZABLE_SELECTOR, RESIZABLE_SELECTOR_HANDLE, RESIZABLE_SELECTOR_HANDLE_SCOPED, RESIZABLE_SYMBOL, resizableItems, resizableStyles };
1
+ import { C as RESIZABLE_SELECTOR_HANDLE, D as resizableItems, E as resizableHorizontals, O as resizableStyles, S as RESIZABLE_SELECTOR, T as RESIZABLE_SYMBOL, _ as RESIZABLE_EVENT_RESIZE, a as OuiResizableEventDetail, b as RESIZABLE_MESSAGE_HEIGHT, c as RESIZABLE_ATTRIBUTE, d as RESIZABLE_ATTRIBUTE_MAXIMUM, f as RESIZABLE_ATTRIBUTE_MINIMUM, g as RESIZABLE_EVENT_END, h as RESIZABLE_EVENT_CANCEL, i as OuiResizableEvent, k as resizableVerticals, l as RESIZABLE_ATTRIBUTE_DIRECTION, m as RESIZABLE_EVENT_BEGIN, n as OuiResizable, o as OuiResizableItem, p as RESIZABLE_ATTRIBUTE_STEP, r as OuiResizableDirection, s as OuiResizableState, t as CreateOuiResizableOptions, u as RESIZABLE_ATTRIBUTE_HANDLE, v as RESIZABLE_MESSAGE_ELEMENT, w as RESIZABLE_SELECTOR_HANDLE_SCOPED, x as RESIZABLE_MESSAGE_WIDTH, y as RESIZABLE_MESSAGE_HANDLE } from "../resizable.model-BOufXDXx.mjs";
2
+ export { CreateOuiResizableOptions, OuiResizable, OuiResizableDirection, OuiResizableEvent, OuiResizableEventDetail, OuiResizableItem, OuiResizableState, RESIZABLE_ATTRIBUTE, RESIZABLE_ATTRIBUTE_DIRECTION, RESIZABLE_ATTRIBUTE_HANDLE, RESIZABLE_ATTRIBUTE_MAXIMUM, RESIZABLE_ATTRIBUTE_MINIMUM, RESIZABLE_ATTRIBUTE_STEP, RESIZABLE_EVENT_BEGIN, RESIZABLE_EVENT_CANCEL, RESIZABLE_EVENT_END, RESIZABLE_EVENT_RESIZE, RESIZABLE_MESSAGE_ELEMENT, RESIZABLE_MESSAGE_HANDLE, RESIZABLE_MESSAGE_HEIGHT, RESIZABLE_MESSAGE_WIDTH, RESIZABLE_SELECTOR, RESIZABLE_SELECTOR_HANDLE, RESIZABLE_SELECTOR_HANDLE_SCOPED, RESIZABLE_SYMBOL, resizableHorizontals, resizableItems, resizableStyles, resizableVerticals };
@@ -1,8 +1,15 @@
1
- //#region src/js/resizable/resizable.model.ts
1
+ // src/js/resizable/resizable.model.ts
2
+ var OuiResizableEvent = class extends CustomEvent {};
2
3
  const RESIZABLE_ATTRIBUTE = "oui-resizable";
4
+ const RESIZABLE_ATTRIBUTE_DIRECTION = `${RESIZABLE_ATTRIBUTE}-direction`;
3
5
  const RESIZABLE_ATTRIBUTE_HANDLE = `${RESIZABLE_ATTRIBUTE}-handle`;
4
6
  const RESIZABLE_ATTRIBUTE_MAXIMUM = `${RESIZABLE_ATTRIBUTE}-maximum`;
5
7
  const RESIZABLE_ATTRIBUTE_MINIMUM = `${RESIZABLE_ATTRIBUTE}-minimum`;
8
+ const RESIZABLE_ATTRIBUTE_STEP = `${RESIZABLE_ATTRIBUTE}-step`;
9
+ const RESIZABLE_EVENT_BEGIN = `${RESIZABLE_ATTRIBUTE}:begin`;
10
+ const RESIZABLE_EVENT_CANCEL = `${RESIZABLE_ATTRIBUTE}:cancel`;
11
+ const RESIZABLE_EVENT_RESIZE = `${RESIZABLE_ATTRIBUTE}:resize`;
12
+ const RESIZABLE_EVENT_END = `${RESIZABLE_ATTRIBUTE}:end`;
6
13
  const RESIZABLE_MESSAGE_ELEMENT = "The element must be an instance of HTMLElement or SVGElement";
7
14
  const RESIZABLE_MESSAGE_HEIGHT = "The maximum height must be greater than the minimum height";
8
15
  const RESIZABLE_MESSAGE_HANDLE = `The element must contain a child with the attribute "${RESIZABLE_ATTRIBUTE_HANDLE}"`;
@@ -11,11 +18,12 @@ const RESIZABLE_SELECTOR = `[${RESIZABLE_ATTRIBUTE}]`;
11
18
  const RESIZABLE_SELECTOR_HANDLE = `[${RESIZABLE_ATTRIBUTE_HANDLE}]`;
12
19
  const RESIZABLE_SELECTOR_HANDLE_SCOPED = `:scope > ${RESIZABLE_SELECTOR_HANDLE}`;
13
20
  const RESIZABLE_SYMBOL = Symbol(RESIZABLE_ATTRIBUTE);
21
+ const resizableHorizontals = /* @__PURE__ */ new Set(["horizontal", "x"]);
14
22
  const resizableItems = /* @__PURE__ */ new WeakMap();
15
23
  const resizableStyles = {
16
24
  touchAction: "none",
17
25
  userSelect: "none",
18
26
  webkitUserSelect: "none"
19
27
  };
20
- //#endregion
21
- export { RESIZABLE_ATTRIBUTE, RESIZABLE_ATTRIBUTE_HANDLE, RESIZABLE_ATTRIBUTE_MAXIMUM, RESIZABLE_ATTRIBUTE_MINIMUM, RESIZABLE_MESSAGE_ELEMENT, RESIZABLE_MESSAGE_HANDLE, RESIZABLE_MESSAGE_HEIGHT, RESIZABLE_MESSAGE_WIDTH, RESIZABLE_SELECTOR, RESIZABLE_SELECTOR_HANDLE, RESIZABLE_SELECTOR_HANDLE_SCOPED, RESIZABLE_SYMBOL, resizableItems, resizableStyles };
28
+ const resizableVerticals = /* @__PURE__ */ new Set(["vertical", "y"]);
29
+ export { OuiResizableEvent, RESIZABLE_ATTRIBUTE, RESIZABLE_ATTRIBUTE_DIRECTION, RESIZABLE_ATTRIBUTE_HANDLE, RESIZABLE_ATTRIBUTE_MAXIMUM, RESIZABLE_ATTRIBUTE_MINIMUM, RESIZABLE_ATTRIBUTE_STEP, RESIZABLE_EVENT_BEGIN, RESIZABLE_EVENT_CANCEL, RESIZABLE_EVENT_END, RESIZABLE_EVENT_RESIZE, RESIZABLE_MESSAGE_ELEMENT, RESIZABLE_MESSAGE_HANDLE, RESIZABLE_MESSAGE_HEIGHT, RESIZABLE_MESSAGE_WIDTH, RESIZABLE_SELECTOR, RESIZABLE_SELECTOR_HANDLE, RESIZABLE_SELECTOR_HANDLE_SCOPED, RESIZABLE_SYMBOL, resizableHorizontals, resizableItems, resizableStyles, resizableVerticals };
@@ -1,3 +1,3 @@
1
- import { n as OuiResizable, t as CreateOuiResizableOptions } from "../resizable.model-YEtcC9li.mjs";
2
- import { t as createResizable } from "../resizable.embedded-BemH-7Re.mjs";
3
- export { type CreateOuiResizableOptions, type OuiResizable, createResizable as createOuiResizable };
1
+ import { t as createResizable } from "../resizable.embedded-DQclAEP-.mjs";
2
+ import { i as OuiResizableEvent, n as OuiResizable, t as CreateOuiResizableOptions } from "../resizable.model-BOufXDXx.mjs";
3
+ export { type CreateOuiResizableOptions, type OuiResizable, OuiResizableEvent, createResizable as createOuiResizable };
@@ -1,2 +1,3 @@
1
1
  import { createResizable } from "./resizable.embedded.mjs";
2
- export { createResizable as createOuiResizable };
2
+ import { OuiResizableEvent } from "./resizable.model.mjs";
3
+ export { OuiResizableEvent, createResizable as createOuiResizable };
@@ -1,5 +1,4 @@
1
- import { n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.model-YEtcC9li.mjs";
2
- //#region src/js/resizable/resizable.embedded.d.ts
1
+ import { n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.model-BOufXDXx.mjs";
3
2
  /**
4
3
  * Creates _(or retrieves)_ a _OuiResizable_ instance for an element
5
4
  *
@@ -7,5 +6,5 @@ import { n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.m
7
6
  * @returns _OuiResizable_ instance
8
7
  */
9
8
  declare function createResizable(element: Element, options?: CreateOuiResizableOptions): OuiResizable;
10
- //#endregion
11
- export { createResizable as t };
9
+ declare function getResizable(element: HTMLElement): OuiResizable | undefined;
10
+ export { getResizable as n, createResizable as t };
@@ -0,0 +1,67 @@
1
+ import { StyleToggler } from "@oscarpalmer/toretto/style";
2
+ type CreateOuiResizableOptions = {
3
+ maximumHeight?: number;
4
+ maximumWidth?: number;
5
+ minimumHeight?: number;
6
+ minimumWidth?: number;
7
+ onBegin?: (element: Element, size: OuiResizableEventDetail, event: OuiResizableEvent) => void;
8
+ onCancel?: (element: Element, size: OuiResizableEventDetail, event: OuiResizableEvent) => void;
9
+ onEnd?: (element: Element, size: OuiResizableEventDetail, event: OuiResizableEvent) => void;
10
+ onResize?: (element: Element, size: OuiResizableEventDetail, event: OuiResizableEvent) => void;
11
+ stepHeight?: number;
12
+ stepWidth?: number;
13
+ };
14
+ type OuiResizable = {
15
+ [RESIZABLE_SYMBOL]: OuiResizableState;
16
+ configure(options: CreateOuiResizableOptions): void;
17
+ destroy(): void;
18
+ reset(): void;
19
+ set(): void;
20
+ };
21
+ declare class OuiResizableEvent extends CustomEvent<OuiResizableEventDetail> {}
22
+ type OuiResizableEventDetail = {
23
+ height: number;
24
+ width: number;
25
+ };
26
+ type OuiResizableDirection = "horizontal" | "vertical" | "x" | "y";
27
+ type OuiResizableItem = {
28
+ instance: OuiResizable;
29
+ state: OuiResizableState;
30
+ };
31
+ type OuiResizableState = {
32
+ element: Element;
33
+ handle: Element;
34
+ height: number;
35
+ horizontal: boolean;
36
+ options: Required<CreateOuiResizableOptions>;
37
+ styles: StyleToggler;
38
+ vertical: boolean;
39
+ width: number;
40
+ };
41
+ declare const RESIZABLE_ATTRIBUTE = "oui-resizable";
42
+ declare const RESIZABLE_ATTRIBUTE_DIRECTION: string;
43
+ declare const RESIZABLE_ATTRIBUTE_HANDLE: string;
44
+ declare const RESIZABLE_ATTRIBUTE_MAXIMUM: string;
45
+ declare const RESIZABLE_ATTRIBUTE_MINIMUM: string;
46
+ declare const RESIZABLE_ATTRIBUTE_STEP: string;
47
+ declare const RESIZABLE_EVENT_BEGIN: string;
48
+ declare const RESIZABLE_EVENT_CANCEL: string;
49
+ declare const RESIZABLE_EVENT_RESIZE: string;
50
+ declare const RESIZABLE_EVENT_END: string;
51
+ declare const RESIZABLE_MESSAGE_ELEMENT = "The element must be an instance of HTMLElement or SVGElement";
52
+ declare const RESIZABLE_MESSAGE_HEIGHT = "The maximum height must be greater than the minimum height";
53
+ declare const RESIZABLE_MESSAGE_HANDLE: string;
54
+ declare const RESIZABLE_MESSAGE_WIDTH = "The maximum width must be greater than the minimum width";
55
+ declare const RESIZABLE_SELECTOR: string;
56
+ declare const RESIZABLE_SELECTOR_HANDLE: string;
57
+ declare const RESIZABLE_SELECTOR_HANDLE_SCOPED: string;
58
+ declare const RESIZABLE_SYMBOL: unique symbol;
59
+ declare const resizableHorizontals: Set<OuiResizableDirection>;
60
+ declare const resizableItems: WeakMap<Element, OuiResizableItem>;
61
+ declare const resizableStyles: {
62
+ touchAction: string;
63
+ userSelect: string;
64
+ webkitUserSelect: string;
65
+ };
66
+ declare const resizableVerticals: Set<OuiResizableDirection>;
67
+ export { RESIZABLE_SELECTOR_HANDLE as C, resizableItems as D, resizableHorizontals as E, resizableStyles as O, RESIZABLE_SELECTOR as S, RESIZABLE_SYMBOL as T, RESIZABLE_EVENT_RESIZE as _, OuiResizableEventDetail as a, RESIZABLE_MESSAGE_HEIGHT as b, RESIZABLE_ATTRIBUTE as c, RESIZABLE_ATTRIBUTE_MAXIMUM as d, RESIZABLE_ATTRIBUTE_MINIMUM as f, RESIZABLE_EVENT_END as g, RESIZABLE_EVENT_CANCEL as h, OuiResizableEvent as i, resizableVerticals as k, RESIZABLE_ATTRIBUTE_DIRECTION as l, RESIZABLE_EVENT_BEGIN as m, OuiResizable as n, OuiResizableItem as o, RESIZABLE_ATTRIBUTE_STEP as p, OuiResizableDirection as r, OuiResizableState as s, CreateOuiResizableOptions as t, RESIZABLE_ATTRIBUTE_HANDLE as u, RESIZABLE_MESSAGE_ELEMENT as v, RESIZABLE_SELECTOR_HANDLE_SCOPED as w, RESIZABLE_MESSAGE_WIDTH as x, RESIZABLE_MESSAGE_HANDLE as y };
@@ -1,2 +1,2 @@
1
- import { t as createSortable } from "../sortable.embedded-CrEGff9k.mjs";
1
+ import { t as createSortable } from "../sortable.embedded-B5LPz-c_.mjs";
2
2
  export { createSortable };
@@ -1,14 +1,14 @@
1
1
  import { attributable } from "../internal/attributable.mjs";
2
2
  import { DRAGGABLE_SYMBOL, draggableGlobals } from "../internal/draggable/draggable.model.mjs";
3
3
  import { addDraggable, destroyDraggable, getDraggableElement, getDraggableStates, initializeDraggable, removeDraggable } from "../internal/draggable/index.mjs";
4
- import { SORTABLE_ATTRIBUTE, SORTABLE_ATTRIBUTE_ACTIVE, SORTABLE_ATTRIBUTE_CONNECTIONS, SORTABLE_ATTRIBUTE_CONTAINER, SORTABLE_ATTRIBUTE_DIRECTION, SORTABLE_ATTRIBUTE_HORIZONTAL, SORTABLE_ATTRIBUTE_ORIGIN, SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG, SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, SORTABLE_ATTRIBUTE_VERTICAL, SORTABLE_CONTAINERS, SORTABLE_MESSAGE, SORTABLE_SELECTOR_ITEM, sortablePlaceholder } from "./sortable.model.mjs";
4
+ import { SORTABLE_ATTRIBUTE, SORTABLE_ATTRIBUTE_ACTIVE, SORTABLE_ATTRIBUTE_CONNECTIONS, SORTABLE_ATTRIBUTE_CONTAINER, SORTABLE_ATTRIBUTE_DIRECTION, SORTABLE_ATTRIBUTE_HORIZONTAL, SORTABLE_ATTRIBUTE_ORIGIN, SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG, SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, SORTABLE_ATTRIBUTE_VERTICAL, SORTABLE_CONTAINERS, SORTABLE_EVENT_END, SORTABLE_EVENT_PLACEHOLDER, SORTABLE_MESSAGE, SORTABLE_SELECTOR_ITEM, sortablePlaceholder } from "./sortable.model.mjs";
5
5
  import { getAttribute, setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
6
6
  import { dispatch, getEventPosition } from "@oscarpalmer/toretto/event";
7
7
  import { findAncestor, getElementFromPosition } from "@oscarpalmer/toretto/find";
8
8
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
9
9
  import { setStyle } from "@oscarpalmer/toretto/style";
10
10
  import { createElement } from "@oscarpalmer/toretto/create";
11
- //#region src/js/sortable/sortable.embedded.ts
11
+ // src/js/sortable/sortable.embedded.ts
12
12
  function OuiSortable(element, options) {
13
13
  this[DRAGGABLE_SYMBOL] = initializeDraggable(this, "sortable", "sort", SORTABLE_ATTRIBUTE, element, {
14
14
  container: {
@@ -147,9 +147,9 @@ function onEnd(event, item, reset) {
147
147
  bubbles: false,
148
148
  cancelable: true
149
149
  };
150
- const dispatchedFrom = dispatch(item.instance.element, "sortable:end", options);
150
+ const dispatchedFrom = dispatch(item.instance.element, SORTABLE_EVENT_END, options);
151
151
  let dispatchedTo;
152
- if (item.instance !== instance && instance != null) dispatchedTo = dispatch(instance.element, "sortable:end", options);
152
+ if (item.instance !== instance && instance != null) dispatchedTo = dispatch(instance.element, SORTABLE_EVENT_END, options);
153
153
  setTimeout(() => {
154
154
  afterEnd(insert, item, [dispatchedFrom, dispatchedTo], {
155
155
  origin,
@@ -210,7 +210,7 @@ function setPlaceholder(item, origin) {
210
210
  const element = getDragPlaceholder();
211
211
  if (sortablePlaceholder.drag.default != null) sortablePlaceholder.drag.default.innerHTML = "";
212
212
  updatePlaceholder(item, element);
213
- const dispatched = dispatch(item.instance.element, "sortable:placeholder", { detail: {
213
+ const dispatched = dispatch(item.instance.element, SORTABLE_EVENT_PLACEHOLDER, { detail: {
214
214
  origin,
215
215
  parent: item.instance.element,
216
216
  placeholder: element,
@@ -257,5 +257,4 @@ const bound = {
257
257
  const addSortable = addDraggable.bind(bound);
258
258
  const removeSortable = removeDraggable.bind(bound);
259
259
  attributable(SORTABLE_ATTRIBUTE, addSortable, removeSortable);
260
- //#endregion
261
260
  export { createSortable };
@@ -1,2 +1,2 @@
1
- import { $ as OuiSortable, _t as sortablePlaceholder, at as SORTABLE_ATTRIBUTE_CONNECTIONS, ct as SORTABLE_ATTRIBUTE_HORIZONTAL, dt as SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, et as OuiSortablePlaceholder, ft as SORTABLE_ATTRIBUTE_VERTICAL, gt as SORTABLE_SELECTOR_ITEM, ht as SORTABLE_SELECTOR, it as SORTABLE_ATTRIBUTE_ACTIVE, lt as SORTABLE_ATTRIBUTE_ORIGIN, mt as SORTABLE_MESSAGE, nt as OuiSortableState, ot as SORTABLE_ATTRIBUTE_CONTAINER, pt as SORTABLE_CONTAINERS, rt as SORTABLE_ATTRIBUTE, st as SORTABLE_ATTRIBUTE_DIRECTION, tt as OuiSortablePlaceholderDrag, ut as SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG } from "../movable.model-D9nnPWKk.mjs";
2
- export { OuiSortable, OuiSortablePlaceholder, OuiSortablePlaceholderDrag, OuiSortableState, SORTABLE_ATTRIBUTE, SORTABLE_ATTRIBUTE_ACTIVE, SORTABLE_ATTRIBUTE_CONNECTIONS, SORTABLE_ATTRIBUTE_CONTAINER, SORTABLE_ATTRIBUTE_DIRECTION, SORTABLE_ATTRIBUTE_HORIZONTAL, SORTABLE_ATTRIBUTE_ORIGIN, SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG, SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, SORTABLE_ATTRIBUTE_VERTICAL, SORTABLE_CONTAINERS, SORTABLE_MESSAGE, SORTABLE_SELECTOR, SORTABLE_SELECTOR_ITEM, sortablePlaceholder };
1
+ import { St as sortablePlaceholder, _t as SORTABLE_EVENT_END, at as OuiSortableState, bt as SORTABLE_SELECTOR, ct as SORTABLE_ATTRIBUTE_CONNECTIONS, dt as SORTABLE_ATTRIBUTE_HORIZONTAL, ft as SORTABLE_ATTRIBUTE_ORIGIN, gt as SORTABLE_CONTAINERS, ht as SORTABLE_ATTRIBUTE_VERTICAL, it as OuiSortablePlaceholderDrag, lt as SORTABLE_ATTRIBUTE_CONTAINER, mt as SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, nt as OuiSortable, ot as SORTABLE_ATTRIBUTE, pt as SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG, rt as OuiSortablePlaceholder, st as SORTABLE_ATTRIBUTE_ACTIVE, ut as SORTABLE_ATTRIBUTE_DIRECTION, vt as SORTABLE_EVENT_PLACEHOLDER, xt as SORTABLE_SELECTOR_ITEM, yt as SORTABLE_MESSAGE } from "../movable.model-CQ3AbTrq.mjs";
2
+ export { OuiSortable, OuiSortablePlaceholder, OuiSortablePlaceholderDrag, OuiSortableState, SORTABLE_ATTRIBUTE, SORTABLE_ATTRIBUTE_ACTIVE, SORTABLE_ATTRIBUTE_CONNECTIONS, SORTABLE_ATTRIBUTE_CONTAINER, SORTABLE_ATTRIBUTE_DIRECTION, SORTABLE_ATTRIBUTE_HORIZONTAL, SORTABLE_ATTRIBUTE_ORIGIN, SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG, SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, SORTABLE_ATTRIBUTE_VERTICAL, SORTABLE_CONTAINERS, SORTABLE_EVENT_END, SORTABLE_EVENT_PLACEHOLDER, SORTABLE_MESSAGE, SORTABLE_SELECTOR, SORTABLE_SELECTOR_ITEM, sortablePlaceholder };
@@ -1,4 +1,4 @@
1
- //#region src/js/sortable/sortable.model.ts
1
+ // src/js/sortable/sortable.model.ts
2
2
  const SORTABLE_ATTRIBUTE = "oui-sortable";
3
3
  const SORTABLE_ATTRIBUTE_ACTIVE = `${SORTABLE_ATTRIBUTE}-active`;
4
4
  const SORTABLE_ATTRIBUTE_CONNECTIONS = `${SORTABLE_ATTRIBUTE}-connections`;
@@ -10,6 +10,8 @@ const SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG = `${SORTABLE_ATTRIBUTE}-placeholder-d
10
10
  const SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION = `${SORTABLE_ATTRIBUTE}-placeholder-position`;
11
11
  const SORTABLE_ATTRIBUTE_VERTICAL = `${SORTABLE_ATTRIBUTE}-vertical`;
12
12
  const SORTABLE_CONTAINERS = /* @__PURE__ */ new Map();
13
+ const SORTABLE_EVENT_END = `${SORTABLE_ATTRIBUTE}:end`;
14
+ const SORTABLE_EVENT_PLACEHOLDER = `${SORTABLE_ATTRIBUTE}:placeholder`;
13
15
  const SORTABLE_MESSAGE = "The element must be an instance of HTMLElement or SVGElement";
14
16
  const SORTABLE_SELECTOR = `[${SORTABLE_ATTRIBUTE}]`;
15
17
  const SORTABLE_SELECTOR_ITEM = `[${SORTABLE_ATTRIBUTE}] > *`;
@@ -20,5 +22,4 @@ const sortablePlaceholder = {
20
22
  },
21
23
  position: void 0
22
24
  };
23
- //#endregion
24
- export { SORTABLE_ATTRIBUTE, SORTABLE_ATTRIBUTE_ACTIVE, SORTABLE_ATTRIBUTE_CONNECTIONS, SORTABLE_ATTRIBUTE_CONTAINER, SORTABLE_ATTRIBUTE_DIRECTION, SORTABLE_ATTRIBUTE_HORIZONTAL, SORTABLE_ATTRIBUTE_ORIGIN, SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG, SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, SORTABLE_ATTRIBUTE_VERTICAL, SORTABLE_CONTAINERS, SORTABLE_MESSAGE, SORTABLE_SELECTOR, SORTABLE_SELECTOR_ITEM, sortablePlaceholder };
25
+ export { SORTABLE_ATTRIBUTE, SORTABLE_ATTRIBUTE_ACTIVE, SORTABLE_ATTRIBUTE_CONNECTIONS, SORTABLE_ATTRIBUTE_CONTAINER, SORTABLE_ATTRIBUTE_DIRECTION, SORTABLE_ATTRIBUTE_HORIZONTAL, SORTABLE_ATTRIBUTE_ORIGIN, SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG, SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION, SORTABLE_ATTRIBUTE_VERTICAL, SORTABLE_CONTAINERS, SORTABLE_EVENT_END, SORTABLE_EVENT_PLACEHOLDER, SORTABLE_MESSAGE, SORTABLE_SELECTOR, SORTABLE_SELECTOR_ITEM, sortablePlaceholder };
@@ -1,3 +1,3 @@
1
- import { $ as OuiSortable, p as CreateOuiDraggableOptions } from "../movable.model-D9nnPWKk.mjs";
2
- import { t as createSortable } from "../sortable.embedded-CrEGff9k.mjs";
1
+ import { m as CreateOuiDraggableOptions, nt as OuiSortable } from "../movable.model-CQ3AbTrq.mjs";
2
+ import { t as createSortable } from "../sortable.embedded-B5LPz-c_.mjs";
3
3
  export { type CreateOuiDraggableOptions as CreateOuiSortableOptions, type OuiSortable, createSortable };
@@ -1,2 +1 @@
1
- import { createSortable } from "./sortable.embedded.mjs";
2
- export { createSortable };
1
+ export { createSortable } from "./sortable.embedded.mjs";
@@ -1,5 +1,4 @@
1
- import { $ as OuiSortable, p as CreateOuiDraggableOptions } from "./movable.model-D9nnPWKk.mjs";
2
- //#region src/js/sortable/sortable.embedded.d.ts
1
+ import { m as CreateOuiDraggableOptions, nt as OuiSortable } from "./movable.model-CQ3AbTrq.mjs";
3
2
  /**
4
3
  * Creates _(or retrieves)_ a _OuiSortable_ instance for an element
5
4
  *
@@ -7,5 +6,4 @@ import { $ as OuiSortable, p as CreateOuiDraggableOptions } from "./movable.mode
7
6
  * @returns _OuiSortable_ instance
8
7
  */
9
8
  declare function createSortable(element: Element, options?: CreateOuiDraggableOptions): OuiSortable;
10
- //#endregion
11
9
  export { createSortable as t };