@oscarpalmer/oui 0.42.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.
- package/dist/css/grid.css +38 -0
- package/dist/js/color-picker/color-picker.constants.d.mts +1 -1
- package/dist/js/color-picker/color-picker.constants.mjs +1 -2
- package/dist/js/color-picker/color-picker.dom.d.mts +2 -4
- package/dist/js/color-picker/color-picker.dom.mjs +1 -2
- package/dist/js/color-picker/color-picker.event.d.mts +2 -4
- package/dist/js/color-picker/color-picker.event.mjs +6 -7
- package/dist/js/color-picker/color-picker.form.d.mts +2 -4
- package/dist/js/color-picker/color-picker.form.mjs +2 -3
- package/dist/js/color-picker/color-picker.misc.d.mts +1 -1
- package/dist/js/color-picker/color-picker.misc.mjs +1 -2
- package/dist/js/color-picker/color-picker.model.d.mts +1 -1
- package/dist/js/color-picker/color-picker.model.mjs +1 -2
- package/dist/js/color-picker/color-picker.output.d.mts +2 -4
- package/dist/js/color-picker/color-picker.output.mjs +4 -5
- package/dist/js/color-picker/color-picker.state.d.mts +2 -4
- package/dist/js/color-picker/color-picker.state.mjs +4 -5
- package/dist/js/color-picker/index.d.mts +5 -7
- package/dist/js/color-picker/index.mjs +3 -4
- package/dist/js/{color-picker.constants-BZgXQr5o.d.mts → color-picker.constants-DdttC4ab.d.mts} +3 -8
- package/dist/js/{color-picker.misc-BIS3R6jk.d.mts → color-picker.misc-BH_tFyWR.d.mts} +1 -3
- package/dist/js/combobox/combobox.constants.d.mts +2 -2
- package/dist/js/combobox/combobox.constants.mjs +3 -3
- package/dist/js/combobox/combobox.dom.d.mts +2 -4
- package/dist/js/combobox/combobox.dom.mjs +3 -3
- package/dist/js/combobox/combobox.event.d.mts +3 -5
- package/dist/js/combobox/combobox.event.mjs +1 -1
- package/dist/js/combobox/combobox.misc.d.mts +1 -1
- package/dist/js/combobox/combobox.misc.mjs +1 -1
- package/dist/js/combobox/combobox.model.d.mts +1 -1
- package/dist/js/combobox/combobox.state.d.mts +3 -5
- package/dist/js/combobox/combobox.state.mjs +1 -1
- package/dist/js/combobox/index.d.mts +7 -9
- package/dist/js/combobox/index.mjs +3 -4
- package/dist/js/{combobox.constants-Hb3bqqQJ.d.mts → combobox.constants-CDnBNJC0.d.mts} +3 -4
- package/dist/js/{combobox.misc-DRDFk6X8.d.mts → combobox.misc-Csh9lm9_.d.mts} +1 -3
- package/dist/js/{combobox.model-gjEI2VqZ.d.mts → combobox.model-BRGQDuRl.d.mts} +2 -4
- package/dist/js/{combobox.state-AstCICiH.mjs → combobox.state-Bjt0dwe3.mjs} +29 -29
- package/dist/js/dialog/dialog.model.d.mts +1 -1
- package/dist/js/dialog/dialog.model.mjs +1 -2
- package/dist/js/dialog/index.d.mts +1 -3
- package/dist/js/dialog/index.mjs +2 -3
- package/dist/js/{dialog.model-Dv_h9Kns.d.mts → dialog.model-cYq7rTKL.d.mts} +2 -4
- package/dist/js/floatable/floatable.embedded.d.mts +1 -1
- package/dist/js/floatable/floatable.embedded.mjs +1 -2
- package/dist/js/floatable/floatable.model.d.mts +1 -1
- package/dist/js/floatable/floatable.model.mjs +1 -2
- package/dist/js/floatable/floatable.standalone.d.mts +2 -2
- package/dist/js/{floatable.embedded-ncshL3Sa.d.mts → floatable.embedded-Cr1KX6GZ.d.mts} +1 -3
- package/dist/js/{floatable.model-DXsQgoU7.d.mts → floatable.model-jS5Ui5Av.d.mts} +0 -2
- package/dist/js/focus-trap/focus-trap.embedded.d.mts +1 -1
- package/dist/js/focus-trap/focus-trap.embedded.mjs +4 -5
- package/dist/js/focus-trap/focus-trap.model.d.mts +2 -2
- package/dist/js/focus-trap/focus-trap.model.mjs +3 -3
- package/dist/js/focus-trap/focus-trap.standalone.d.mts +2 -2
- package/dist/js/{focus-trap.embedded-DpcPkP7c.d.mts → focus-trap.embedded-BVXcd4OO.d.mts} +1 -3
- package/dist/js/{focus-trap.model-CpltX5B5.d.mts → focus-trap.model-wg0iAZ7x.d.mts} +2 -3
- package/dist/js/grid/grid.dom.d.mts +7 -0
- package/dist/js/grid/grid.dom.mjs +171 -0
- package/dist/js/grid/grid.event.d.mts +7 -0
- package/dist/js/grid/grid.event.mjs +1 -0
- package/dist/js/grid/grid.misc.d.mts +6 -0
- package/dist/js/grid/grid.misc.mjs +1 -0
- package/dist/js/grid/grid.model.d.mts +2 -0
- package/dist/js/grid/grid.model.mjs +39 -0
- package/dist/js/grid/index.d.mts +22 -0
- package/dist/js/grid/index.mjs +48 -0
- package/dist/js/grid.event-K_pG2vmS.mjs +192 -0
- package/dist/js/grid.model-SiNst5db.d.mts +90 -0
- package/dist/js/index.d.mts +22 -21
- package/dist/js/index.mjs +5 -3
- package/dist/js/internal/attributable.d.mts +1 -3
- package/dist/js/internal/attributable.mjs +3 -3
- package/dist/js/internal/draggable/draggable.model.d.mts +2 -2
- package/dist/js/internal/draggable/draggable.model.mjs +3 -3
- package/dist/js/internal/draggable/index.d.mts +2 -4
- package/dist/js/internal/draggable/index.mjs +18 -14
- package/dist/js/internal/l10n/index.d.mts +2 -4
- package/dist/js/internal/l10n/index.mjs +30 -22
- package/dist/js/internal/l10n/l10n.model.d.mts +1 -1
- package/dist/js/internal/l10n/l10n.model.mjs +1 -2
- package/dist/js/internal/misc.d.mts +2 -3
- package/dist/js/internal/misc.mjs +5 -3
- package/dist/js/internal/navigable/index.d.mts +2 -4
- package/dist/js/internal/navigable/index.mjs +1 -2
- package/dist/js/internal/navigable/navigable.model.d.mts +1 -1
- package/dist/js/internal/navigable/navigable.model.mjs +1 -2
- package/dist/js/internal/option-list/option-list.constants.d.mts +3 -5
- package/dist/js/internal/option-list/option-list.constants.mjs +3 -4
- package/dist/js/internal/option-list/option-list.data.d.mts +2 -4
- package/dist/js/internal/option-list/option-list.data.mjs +1 -1
- package/dist/js/internal/option-list/option-list.dom.d.mts +3 -5
- package/dist/js/internal/option-list/option-list.dom.mjs +1 -1
- package/dist/js/internal/option-list/option-list.event.d.mts +3 -5
- package/dist/js/internal/option-list/option-list.event.mjs +4 -5
- package/dist/js/internal/option-list/option-list.form.d.mts +3 -5
- package/dist/js/internal/option-list/option-list.form.mjs +2 -3
- package/dist/js/internal/option-list/option-list.misc.d.mts +3 -5
- package/dist/js/internal/option-list/option-list.misc.mjs +1 -1
- package/dist/js/internal/option-list/option-list.model.d.mts +2 -2
- package/dist/js/internal/option-list/option-list.model.mjs +7 -1
- package/dist/js/internal/option-list/option-list.state.d.mts +3 -5
- package/dist/js/internal/option-list/option-list.state.mjs +2 -3
- package/dist/js/l10n/index.d.mts +1 -1
- package/dist/js/{l10n.model-D1E1u35L.d.mts → l10n.model-DxwLXnFl.d.mts} +0 -2
- package/dist/js/listbox/index.d.mts +6 -8
- package/dist/js/listbox/index.mjs +3 -4
- package/dist/js/listbox/listbox.constants.d.mts +1 -1
- package/dist/js/listbox/listbox.constants.mjs +1 -2
- package/dist/js/listbox/listbox.dom.d.mts +2 -4
- package/dist/js/listbox/listbox.dom.mjs +1 -1
- package/dist/js/listbox/listbox.event.d.mts +3 -5
- package/dist/js/listbox/listbox.event.mjs +1 -1
- package/dist/js/listbox/listbox.misc.d.mts +1 -1
- package/dist/js/listbox/listbox.misc.mjs +1 -1
- package/dist/js/listbox/listbox.model.d.mts +1 -1
- package/dist/js/listbox/listbox.state.d.mts +3 -5
- package/dist/js/listbox/listbox.state.mjs +1 -1
- package/dist/js/{listbox.constants-DOBMwKup.d.mts → listbox.constants-1yMPRl2C.d.mts} +1 -3
- package/dist/js/{listbox.misc-DwfB4Mu_.d.mts → listbox.misc-CkW28nUS.d.mts} +1 -3
- package/dist/js/{listbox.model-C0MYWXZe.d.mts → listbox.model-CUA_DaR9.d.mts} +1 -3
- package/dist/js/{listbox.state-BrN296BM.mjs → listbox.state-DO58GDqc.mjs} +8 -12
- package/dist/js/menu/index.mjs +2 -3
- package/dist/js/menu/menu.model.d.mts +3 -5
- package/dist/js/menu/menu.model.mjs +1 -2
- package/dist/js/movable/movable.embedded.d.mts +1 -1
- package/dist/js/movable/movable.embedded.mjs +3 -4
- package/dist/js/movable/movable.model.d.mts +2 -2
- package/dist/js/movable/movable.model.mjs +3 -3
- package/dist/js/movable/movable.standalone.d.mts +2 -2
- package/dist/js/{movable.embedded-C1bDTLGs.d.mts → movable.embedded-HjPPob-Z.d.mts} +1 -3
- package/dist/js/{movable.model-D9nnPWKk.d.mts → movable.model-CQ3AbTrq.d.mts} +13 -7
- package/dist/js/{navigable.model-BqoR6iBv.d.mts → navigable.model-CrzJqKE7.d.mts} +0 -2
- package/dist/js/{option-list.data-CgMyUwPc.mjs → option-list.data-Be6wopy9.mjs} +7 -10
- package/dist/js/{option-list.model-CCPUlPeX.d.mts → option-list.model-DNZq-X0d.d.mts} +7 -4
- package/dist/js/popover/index.d.mts +1 -3
- package/dist/js/popover/index.mjs +3 -4
- package/dist/js/popover/popover.model.d.mts +1 -1
- package/dist/js/popover/popover.model.mjs +1 -2
- package/dist/js/{popover.model-DiLdz0Hc.d.mts → popover.model-CrrIdSmS.d.mts} +2 -4
- package/dist/js/resizable/resizable.embedded.d.mts +2 -2
- package/dist/js/resizable/resizable.embedded.mjs +113 -38
- package/dist/js/resizable/resizable.model.d.mts +2 -2
- package/dist/js/resizable/resizable.model.mjs +8 -3
- package/dist/js/resizable/resizable.standalone.d.mts +3 -3
- package/dist/js/resizable/resizable.standalone.mjs +3 -1
- package/dist/js/{resizable.embedded-D9mb-Wm_.d.mts → resizable.embedded-DQclAEP-.d.mts} +3 -4
- package/dist/js/{resizable.model-vCxaFdOA.d.mts → resizable.model-BOufXDXx.d.mts} +18 -3
- package/dist/js/sortable/sortable.embedded.d.mts +1 -1
- package/dist/js/sortable/sortable.embedded.mjs +5 -6
- package/dist/js/sortable/sortable.model.d.mts +2 -2
- package/dist/js/sortable/sortable.model.mjs +4 -3
- package/dist/js/sortable/sortable.standalone.d.mts +2 -2
- package/dist/js/{sortable.embedded-CrEGff9k.d.mts → sortable.embedded-B5LPz-c_.d.mts} +1 -3
- package/dist/js/splitter/index.d.mts +2 -4
- package/dist/js/splitter/index.mjs +4 -4
- package/dist/js/splitter/splitter.model.d.mts +1 -1
- package/dist/js/splitter/splitter.model.mjs +1 -2
- package/dist/js/{splitter.model-C24W6eZ7.d.mts → splitter.model-DQDbIe4P.d.mts} +0 -2
- package/dist/js/tabs/index.d.mts +2 -4
- package/dist/js/tabs/index.mjs +10 -11
- package/dist/js/tabs/tabs.model.d.mts +1 -1
- package/dist/js/tabs/tabs.model.mjs +1 -2
- package/dist/js/{tabs.model-BHPy7fPo.d.mts → tabs.model-CvylbR2o.d.mts} +1 -3
- package/dist/js/toolbar/index.mjs +1 -2
- package/dist/js/toolbar/toolbar.model.d.mts +2 -4
- package/dist/js/toolbar/toolbar.model.mjs +1 -2
- package/dist/js/tooltip/index.d.mts +1 -3
- package/dist/js/tooltip/index.mjs +1 -2
- package/dist/js/tooltip/tooltip.model.d.mts +1 -1
- package/dist/js/tooltip/tooltip.model.mjs +1 -2
- package/dist/js/{tooltip.model-BpNStw5z.d.mts → tooltip.model-BI3UK-VU.d.mts} +1 -3
- package/package.json +11 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as onBeginResizeGridItem, n as onGridAttributeChanged, r as onGridItemResized, i as onGridMutation, a as onGridResized } from "../grid.event-K_pG2vmS.mjs";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { O as GridSort, k as GridState } from "../grid.model-SiNst5db.mjs";
|
|
2
|
+
export declare function connectGrid(state: GridState): void;
|
|
3
|
+
export declare function createGridState(host: HTMLElement): GridState;
|
|
4
|
+
export declare function disconnectGrid(state: GridState): void;
|
|
5
|
+
export declare function endGridSort(sort: GridSort, target?: HTMLElement): undefined;
|
|
6
|
+
export declare function updateGrid(state: GridState): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { o as connectGrid, s as createGridState, c as disconnectGrid, l as endGridSort, u as updateGrid } from "../grid.event-K_pG2vmS.mjs";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as OuiGridEventSortDetail, C as GRID_SYMBOL, D as GridItem, E as GridGap, F as OuiGridSortEvent, I as gridStyling, M as OuiGridResizeEventDetail, N as OuiGridResizeHandlerEvent, O as GridSort, P as OuiGridResizeHandlerEventDetail, S as GRID_SELECTOR_ITEM_SCOPED, T as GridColumns, _ as GRID_EVENT_SORT_CANCEL, a as GRID_ATTRIBUTE_ITEM_HANDLE, b as GRID_SELECTOR_HANDLE, c as GRID_ATTRIBUTE_SORTABLE, d as GRID_EVENT_RESIZE_BEGIN, f as GRID_EVENT_RESIZE_CANCEL, g as GRID_EVENT_SORT_BEGIN, h as GRID_EVENT_RESIZE_HANDLE, i as GRID_ATTRIBUTE_ITEM_ACTIVE, j as OuiGridResizeEvent, k as GridState, l as GRID_ATTRIBUTE_SORTING, m as GRID_EVENT_RESIZE_END, n as GRID_ATTRIBUTE_GAP, o as GRID_ATTRIBUTE_PLACEHOLDER, p as GRID_EVENT_RESIZE_CHANGE, r as GRID_ATTRIBUTE_ITEM, s as GRID_ATTRIBUTE_RESIZABLE, t as GRID_ATTRIBUTE_COLUMNS, u as GRID_ATTRIBUTE_SPAN, v as GRID_EVENT_SORT_CHANGE, w as GRID_TAGNAME, x as GRID_SELECTOR_ITEM, y as GRID_EVENT_SORT_END } from "../grid.model-SiNst5db.mjs";
|
|
2
|
+
export { GRID_ATTRIBUTE_COLUMNS, GRID_ATTRIBUTE_GAP, GRID_ATTRIBUTE_ITEM, GRID_ATTRIBUTE_ITEM_ACTIVE, GRID_ATTRIBUTE_ITEM_HANDLE, GRID_ATTRIBUTE_PLACEHOLDER, GRID_ATTRIBUTE_RESIZABLE, GRID_ATTRIBUTE_SORTABLE, GRID_ATTRIBUTE_SORTING, GRID_ATTRIBUTE_SPAN, GRID_EVENT_RESIZE_BEGIN, GRID_EVENT_RESIZE_CANCEL, GRID_EVENT_RESIZE_CHANGE, GRID_EVENT_RESIZE_END, GRID_EVENT_RESIZE_HANDLE, GRID_EVENT_SORT_BEGIN, GRID_EVENT_SORT_CANCEL, GRID_EVENT_SORT_CHANGE, GRID_EVENT_SORT_END, GRID_SELECTOR_HANDLE, GRID_SELECTOR_ITEM, GRID_SELECTOR_ITEM_SCOPED, GRID_SYMBOL, GRID_TAGNAME, GridColumns, GridGap, GridItem, GridSort, GridState, OuiGridEventSortDetail, OuiGridResizeEvent, OuiGridResizeEventDetail, OuiGridResizeHandlerEvent, OuiGridResizeHandlerEventDetail, OuiGridSortEvent, gridStyling };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { toggleStyles } from "@oscarpalmer/toretto/style";
|
|
2
|
+
// src/js/grid/grid.model.ts
|
|
3
|
+
var OuiGridResizeEvent = class extends CustomEvent {};
|
|
4
|
+
var OuiGridResizeHandlerEvent = class extends CustomEvent {
|
|
5
|
+
constructor(detail) {
|
|
6
|
+
super(GRID_EVENT_RESIZE_HANDLE, { detail });
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var OuiGridSortEvent = class extends CustomEvent {};
|
|
10
|
+
const GRID_TAGNAME = "oui-grid";
|
|
11
|
+
const GRID_ATTRIBUTE_COLUMNS = "columns";
|
|
12
|
+
const GRID_ATTRIBUTE_GAP = "gap";
|
|
13
|
+
const GRID_ATTRIBUTE_ITEM = `${GRID_TAGNAME}-item`;
|
|
14
|
+
const GRID_ATTRIBUTE_ITEM_ACTIVE = `${GRID_ATTRIBUTE_ITEM}-active`;
|
|
15
|
+
const GRID_ATTRIBUTE_ITEM_HANDLE = `${GRID_ATTRIBUTE_ITEM}-handle`;
|
|
16
|
+
const GRID_ATTRIBUTE_PLACEHOLDER = `${GRID_TAGNAME}-placeholder`;
|
|
17
|
+
const GRID_ATTRIBUTE_RESIZABLE = "resizable";
|
|
18
|
+
const GRID_ATTRIBUTE_SORTABLE = "sortable";
|
|
19
|
+
const GRID_ATTRIBUTE_SORTING = `${GRID_TAGNAME}-sorting`;
|
|
20
|
+
const GRID_ATTRIBUTE_SPAN = `${GRID_TAGNAME}-span`;
|
|
21
|
+
const GRID_EVENT_RESIZE_BEGIN = "resize:begin";
|
|
22
|
+
const GRID_EVENT_RESIZE_CANCEL = "resize:cancel";
|
|
23
|
+
const GRID_EVENT_RESIZE_CHANGE = "resize:change";
|
|
24
|
+
const GRID_EVENT_RESIZE_END = "resize:end";
|
|
25
|
+
const GRID_EVENT_RESIZE_HANDLE = "resize:handle";
|
|
26
|
+
const GRID_EVENT_SORT_BEGIN = "sort:begin";
|
|
27
|
+
const GRID_EVENT_SORT_CANCEL = "sort:cancel";
|
|
28
|
+
const GRID_EVENT_SORT_CHANGE = "sort:change";
|
|
29
|
+
const GRID_EVENT_SORT_END = "sort:end";
|
|
30
|
+
const GRID_SELECTOR_HANDLE = `[${GRID_ATTRIBUTE_ITEM_HANDLE}]`;
|
|
31
|
+
const GRID_SELECTOR_ITEM = `${GRID_TAGNAME} > *`;
|
|
32
|
+
const GRID_SELECTOR_ITEM_SCOPED = `:scope > *`;
|
|
33
|
+
const GRID_SYMBOL = Symbol(GRID_TAGNAME);
|
|
34
|
+
const gridStyling = toggleStyles(document.body, {
|
|
35
|
+
touchAction: "none",
|
|
36
|
+
userSelect: "none",
|
|
37
|
+
webkitUserSelect: "none"
|
|
38
|
+
});
|
|
39
|
+
export { GRID_ATTRIBUTE_COLUMNS, GRID_ATTRIBUTE_GAP, GRID_ATTRIBUTE_ITEM, GRID_ATTRIBUTE_ITEM_ACTIVE, GRID_ATTRIBUTE_ITEM_HANDLE, GRID_ATTRIBUTE_PLACEHOLDER, GRID_ATTRIBUTE_RESIZABLE, GRID_ATTRIBUTE_SORTABLE, GRID_ATTRIBUTE_SORTING, GRID_ATTRIBUTE_SPAN, GRID_EVENT_RESIZE_BEGIN, GRID_EVENT_RESIZE_CANCEL, GRID_EVENT_RESIZE_CHANGE, GRID_EVENT_RESIZE_END, GRID_EVENT_RESIZE_HANDLE, GRID_EVENT_SORT_BEGIN, GRID_EVENT_SORT_CANCEL, GRID_EVENT_SORT_CHANGE, GRID_EVENT_SORT_END, GRID_SELECTOR_HANDLE, GRID_SELECTOR_ITEM, GRID_SELECTOR_ITEM_SCOPED, GRID_SYMBOL, GRID_TAGNAME, OuiGridResizeEvent, OuiGridResizeHandlerEvent, OuiGridSortEvent, gridStyling };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { C as GRID_SYMBOL, E as GridGap, k as GridState, w as GRID_TAGNAME } from "../grid.model-SiNst5db.mjs";
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
[GRID_TAGNAME]: OuiGridElement;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export interface OuiGridElement {
|
|
8
|
+
[GRID_SYMBOL]: GridState;
|
|
9
|
+
}
|
|
10
|
+
export declare class OuiGridElement extends HTMLElement {
|
|
11
|
+
static readonly observedAttributes: string[];
|
|
12
|
+
get columns(): [number, number | undefined] | undefined;
|
|
13
|
+
set columns(value: number | [number, number | undefined] | undefined);
|
|
14
|
+
get gap(): GridGap;
|
|
15
|
+
set gap(value: number);
|
|
16
|
+
constructor();
|
|
17
|
+
attributeChangedCallback(name: string): void;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
update(): void;
|
|
21
|
+
updateResizers(updater: (item: HTMLElement, handle: HTMLElement) => void): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RESIZABLE_SELECTOR_HANDLE_SCOPED } from "../resizable/resizable.model.mjs";
|
|
2
|
+
import { getGridColumns, setGridColumns } from "./grid.dom.mjs";
|
|
3
|
+
import { c as disconnectGrid, n as onGridAttributeChanged, o as connectGrid, s as createGridState, u as updateGrid } from "../grid.event-K_pG2vmS.mjs";
|
|
4
|
+
import { GRID_ATTRIBUTE_COLUMNS, GRID_SYMBOL, GRID_TAGNAME } from "./grid.model.mjs";
|
|
5
|
+
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
6
|
+
// src/js/grid/index.ts
|
|
7
|
+
var OuiGridElement = class extends HTMLElement {
|
|
8
|
+
static observedAttributes = [GRID_ATTRIBUTE_COLUMNS, "gap"];
|
|
9
|
+
get columns() {
|
|
10
|
+
return getGridColumns(this[GRID_SYMBOL]);
|
|
11
|
+
}
|
|
12
|
+
set columns(value) {
|
|
13
|
+
setGridColumns(this[GRID_SYMBOL], value);
|
|
14
|
+
}
|
|
15
|
+
get gap() {
|
|
16
|
+
return { ...this[GRID_SYMBOL].gap };
|
|
17
|
+
}
|
|
18
|
+
set gap(value) {
|
|
19
|
+
setAttribute(this, "gap", typeof value === "number" ? value : void 0);
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this[GRID_SYMBOL] = createGridState(this);
|
|
24
|
+
}
|
|
25
|
+
attributeChangedCallback(name) {
|
|
26
|
+
onGridAttributeChanged(this[GRID_SYMBOL], name);
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
connectGrid(this[GRID_SYMBOL]);
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
disconnectGrid(this[GRID_SYMBOL]);
|
|
33
|
+
}
|
|
34
|
+
update() {
|
|
35
|
+
updateGrid(this[GRID_SYMBOL]);
|
|
36
|
+
}
|
|
37
|
+
updateResizers(updater) {
|
|
38
|
+
if (!this.hasAttribute("resizable")) return;
|
|
39
|
+
const { length } = this[GRID_SYMBOL].elements;
|
|
40
|
+
for (let index = 0; index < length; index += 1) {
|
|
41
|
+
const element = this[GRID_SYMBOL].elements[index];
|
|
42
|
+
const handle = element.querySelector(RESIZABLE_SELECTOR_HANDLE_SCOPED);
|
|
43
|
+
if (handle != null) updater(element, handle);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
customElements.define(GRID_TAGNAME, OuiGridElement);
|
|
48
|
+
export { OuiGridElement };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { ignoreEvent } from "./internal/misc.mjs";
|
|
2
|
+
import { getResizable } from "./resizable/resizable.embedded.mjs";
|
|
3
|
+
import { getGridElements, getGridPlaceholder, updateGridPositions, updateGridResizables } from "./grid/grid.dom.mjs";
|
|
4
|
+
import { GRID_ATTRIBUTE_ITEM_ACTIVE, GRID_ATTRIBUTE_SORTABLE, GRID_ATTRIBUTE_SORTING, GRID_ATTRIBUTE_SPAN, GRID_EVENT_RESIZE_BEGIN, GRID_EVENT_RESIZE_CANCEL, GRID_EVENT_RESIZE_CHANGE, GRID_EVENT_RESIZE_END, GRID_EVENT_SORT_BEGIN, GRID_EVENT_SORT_CANCEL, GRID_EVENT_SORT_CHANGE, GRID_EVENT_SORT_END, GRID_SELECTOR_HANDLE, GRID_SELECTOR_ITEM, GRID_SYMBOL, GRID_TAGNAME, OuiGridResizeEvent, OuiGridSortEvent, gridStyling } from "./grid/grid.model.mjs";
|
|
5
|
+
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
6
|
+
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
7
|
+
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
8
|
+
import { supportsTouch } from "@oscarpalmer/toretto/touch";
|
|
9
|
+
import { max, min, round } from "@oscarpalmer/atoms/math";
|
|
10
|
+
import { getString } from "@oscarpalmer/atoms/string";
|
|
11
|
+
// src/js/grid/grid.misc.ts
|
|
12
|
+
function connectGrid(state) {
|
|
13
|
+
state.elements = getGridElements(state);
|
|
14
|
+
state.mutationObserver.observe(state.host, mutationOptions);
|
|
15
|
+
resizeObserver.observe(state.host);
|
|
16
|
+
updateGridResizables(state);
|
|
17
|
+
}
|
|
18
|
+
function createGridState(host) {
|
|
19
|
+
const state = {
|
|
20
|
+
host,
|
|
21
|
+
callbacks: {
|
|
22
|
+
onResizeBegin: (element, size) => onBeginResizeGridItem(state, element, size),
|
|
23
|
+
onResizeCancel: (element, size) => onGridItemResized(GRID_EVENT_RESIZE_CANCEL, state, element, size),
|
|
24
|
+
onResizeEnd: (element, size) => onGridItemResized(GRID_EVENT_RESIZE_END, state, element, size),
|
|
25
|
+
onResizeUpdate: (element, size) => onGridItemResized(GRID_EVENT_RESIZE_CHANGE, state, element, size)
|
|
26
|
+
},
|
|
27
|
+
elements: [],
|
|
28
|
+
gap: { value: 0 },
|
|
29
|
+
mutationObserver: new MutationObserver(() => onGridMutation(state)),
|
|
30
|
+
sortable: host.hasAttribute(GRID_ATTRIBUTE_SORTABLE)
|
|
31
|
+
};
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
function disconnectGrid(state) {
|
|
35
|
+
state.mutationObserver.disconnect();
|
|
36
|
+
resizeObserver.unobserve(state.host);
|
|
37
|
+
}
|
|
38
|
+
function endGridSort(sort, target) {
|
|
39
|
+
sort.item.style.pointerEvents = sort.style.pointerEvents;
|
|
40
|
+
sort.item.style.position = "";
|
|
41
|
+
sort.item.style.transform = sort.style.transform;
|
|
42
|
+
sort.item.style.zIndex = sort.style.zIndex;
|
|
43
|
+
sort.state.active = void 0;
|
|
44
|
+
const placeholder = getGridPlaceholder();
|
|
45
|
+
if (target == null) {
|
|
46
|
+
placeholder?.replaceWith(sort.item);
|
|
47
|
+
dispatch(sort.state.host, new OuiGridSortEvent(GRID_EVENT_SORT_CANCEL, { detail: { item: sort.item } }));
|
|
48
|
+
} else {
|
|
49
|
+
const event = new OuiGridSortEvent(GRID_EVENT_SORT_END, { detail: {
|
|
50
|
+
destination: target,
|
|
51
|
+
item: sort.item
|
|
52
|
+
} });
|
|
53
|
+
if (dispatch(sort.state.host, event).defaultPrevented) placeholder?.replaceWith(sort.item);
|
|
54
|
+
else {
|
|
55
|
+
const next = sort.state.elements.indexOf(target);
|
|
56
|
+
if (sort.index < next) target?.after(sort.item);
|
|
57
|
+
else target?.before(sort.item);
|
|
58
|
+
placeholder?.remove();
|
|
59
|
+
updateGridPositions(sort.state);
|
|
60
|
+
updateGridResizables(sort.state);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
setAttribute(sort.state.host, GRID_ATTRIBUTE_SORTING);
|
|
64
|
+
setAttribute(sort.item, GRID_ATTRIBUTE_ITEM_ACTIVE);
|
|
65
|
+
gridStyling.remove();
|
|
66
|
+
}
|
|
67
|
+
function updateGrid(state) {
|
|
68
|
+
if (state.host.isConnected) updateGridPositions(state);
|
|
69
|
+
}
|
|
70
|
+
const mutationOptions = { childList: true };
|
|
71
|
+
const resizeObserver = new ResizeObserver(onGridResized);
|
|
72
|
+
// src/js/grid/grid.event.ts
|
|
73
|
+
function onBeginResizeGridItem(state, element, size) {
|
|
74
|
+
const event = new OuiGridResizeEvent(GRID_EVENT_RESIZE_BEGIN, { detail: {
|
|
75
|
+
...size,
|
|
76
|
+
item: element
|
|
77
|
+
} });
|
|
78
|
+
if (dispatch(state.host, event).defaultPrevented) return;
|
|
79
|
+
const { columns } = state;
|
|
80
|
+
if (columns == null) return;
|
|
81
|
+
const resizable = getResizable(element);
|
|
82
|
+
if (resizable == null) return;
|
|
83
|
+
state.active = element;
|
|
84
|
+
const step = columns.width + state.gap.value;
|
|
85
|
+
resizable.configure({
|
|
86
|
+
maximumWidth: columns.count * step - state.gap.value,
|
|
87
|
+
minimumWidth: columns.width,
|
|
88
|
+
stepWidth: step
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function onGridAttributeChanged(state, name) {
|
|
92
|
+
if (!state.host.isConnected) return;
|
|
93
|
+
if (name === "columns" || name === "gap") updateGridPositions(state);
|
|
94
|
+
}
|
|
95
|
+
function onGridItemResized(type, state, element, size) {
|
|
96
|
+
const event = new OuiGridResizeEvent(type, { detail: {
|
|
97
|
+
...size,
|
|
98
|
+
item: element
|
|
99
|
+
} });
|
|
100
|
+
if (dispatch(state.host, event).defaultPrevented) return;
|
|
101
|
+
const { columns } = state;
|
|
102
|
+
if (columns != null) {
|
|
103
|
+
const span = max([1, min([round((size.width + state.gap.value) / (columns.width + state.gap.value)), columns.count])]);
|
|
104
|
+
setAttribute(element, GRID_ATTRIBUTE_SPAN, getString(span));
|
|
105
|
+
}
|
|
106
|
+
updateGridPositions(state);
|
|
107
|
+
if (type === "resize:cancel" || type === "resize:end") state.active = void 0;
|
|
108
|
+
}
|
|
109
|
+
function onGridMutation(state) {
|
|
110
|
+
state.elements = getGridElements(state);
|
|
111
|
+
updateGridPositions(state);
|
|
112
|
+
updateGridResizables(state);
|
|
113
|
+
}
|
|
114
|
+
function onGridResized(entries) {
|
|
115
|
+
const { length } = entries;
|
|
116
|
+
for (let index = 0; index < length; index += 1) {
|
|
117
|
+
const entry = entries[index];
|
|
118
|
+
if (GRID_SYMBOL in entry.target) updateGridPositions(entry.target[GRID_SYMBOL]);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function onKeydown(event) {
|
|
122
|
+
if (event.key === "Escape" && sort != null) sort = endGridSort(sort);
|
|
123
|
+
}
|
|
124
|
+
function onPointerdown(event) {
|
|
125
|
+
if (ignoreEvent(event, supportsTouch.value)) return;
|
|
126
|
+
const item = findAncestor(event, GRID_SELECTOR_ITEM);
|
|
127
|
+
if (item == null) return;
|
|
128
|
+
const handle = item.querySelector(GRID_SELECTOR_HANDLE);
|
|
129
|
+
if (handle != null && !(event.target === handle || handle.contains(event.target))) return;
|
|
130
|
+
const grid = findAncestor(item, GRID_TAGNAME);
|
|
131
|
+
if (grid == null) return;
|
|
132
|
+
const state = grid[GRID_SYMBOL];
|
|
133
|
+
if (!state.sortable) return;
|
|
134
|
+
if (supportsTouch.value) event.preventDefault();
|
|
135
|
+
const dispatched = new OuiGridSortEvent(GRID_EVENT_SORT_BEGIN, { detail: { item } });
|
|
136
|
+
if (dispatch(state.host, dispatched).defaultPrevented) return;
|
|
137
|
+
state.active = item;
|
|
138
|
+
const placeholder = getGridPlaceholder(item);
|
|
139
|
+
const position = getEventPosition(event);
|
|
140
|
+
const rectangle = item.getBoundingClientRect();
|
|
141
|
+
item.replaceWith(placeholder);
|
|
142
|
+
document.body.append(item);
|
|
143
|
+
sort = {
|
|
144
|
+
item,
|
|
145
|
+
state,
|
|
146
|
+
index: state.elements.indexOf(item),
|
|
147
|
+
offset: {
|
|
148
|
+
x: position.x - rectangle.left,
|
|
149
|
+
y: position.y - rectangle.top
|
|
150
|
+
},
|
|
151
|
+
style: {
|
|
152
|
+
pointerEvents: item.style.pointerEvents,
|
|
153
|
+
transform: item.style.transform,
|
|
154
|
+
zIndex: item.style.zIndex
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
setAttribute(sort.state.host, GRID_ATTRIBUTE_SORTING, "");
|
|
158
|
+
setAttribute(sort.item, GRID_ATTRIBUTE_ITEM_ACTIVE, "");
|
|
159
|
+
gridStyling.set();
|
|
160
|
+
onPointermove(event);
|
|
161
|
+
}
|
|
162
|
+
function onPointermove(event) {
|
|
163
|
+
if (sort == null) return;
|
|
164
|
+
const { x, y } = getEventPosition(event);
|
|
165
|
+
sort.item.style.pointerEvents = "none";
|
|
166
|
+
sort.item.style.position = "fixed";
|
|
167
|
+
sort.item.style.transform = `translate3d(${x - sort.offset.x}px, ${y - sort.offset.y}px, 0)`;
|
|
168
|
+
sort.item.style.zIndex = "1000";
|
|
169
|
+
const dispatched = new OuiGridSortEvent(GRID_EVENT_SORT_CHANGE, { detail: { item: sort.item } });
|
|
170
|
+
if (dispatch(sort.state.host, dispatched).defaultPrevented) sort = endGridSort(sort);
|
|
171
|
+
}
|
|
172
|
+
function onPointerup(event) {
|
|
173
|
+
if (sort == null) return;
|
|
174
|
+
const target = findAncestor(event, GRID_SELECTOR_ITEM);
|
|
175
|
+
if (target == null) {
|
|
176
|
+
sort = endGridSort(sort);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (findAncestor(target, "oui-grid")?.[GRID_SYMBOL] !== sort.state) {
|
|
180
|
+
sort = endGridSort(sort);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
sort = endGridSort(sort, target);
|
|
184
|
+
}
|
|
185
|
+
let sort;
|
|
186
|
+
on(document, "keydown", onKeydown);
|
|
187
|
+
on(document, "mousedown", onPointerdown);
|
|
188
|
+
on(document, "pointermove", onPointermove);
|
|
189
|
+
on(document, "pointerup", onPointerup);
|
|
190
|
+
on(document, "touchcancel", onPointerup);
|
|
191
|
+
on(document, "touchstart", onPointerdown, { passive: false });
|
|
192
|
+
export { onGridResized as a, disconnectGrid as c, onGridMutation as i, endGridSort as l, onGridAttributeChanged as n, connectGrid as o, onGridItemResized as r, createGridState as s, onBeginResizeGridItem as t, updateGrid as u };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { a as OuiResizableEventDetail } from "./resizable.model-BOufXDXx.mjs";
|
|
2
|
+
import { StyleToggler } from "@oscarpalmer/toretto/style";
|
|
3
|
+
import { EventPosition } from "@oscarpalmer/toretto/models";
|
|
4
|
+
type GridColumns = {
|
|
5
|
+
attribute: [number, number | undefined];
|
|
6
|
+
count: number;
|
|
7
|
+
width: number;
|
|
8
|
+
};
|
|
9
|
+
type GridGap = {
|
|
10
|
+
attribute?: number;
|
|
11
|
+
style?: string;
|
|
12
|
+
value: number;
|
|
13
|
+
};
|
|
14
|
+
type GridItem = {
|
|
15
|
+
height: number;
|
|
16
|
+
width: number;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
type GridSort = {
|
|
21
|
+
index: number;
|
|
22
|
+
item: HTMLElement;
|
|
23
|
+
offset: EventPosition;
|
|
24
|
+
state: GridState;
|
|
25
|
+
style: GridSortStyle;
|
|
26
|
+
};
|
|
27
|
+
type GridSortStyle = {
|
|
28
|
+
pointerEvents: string;
|
|
29
|
+
transform: string;
|
|
30
|
+
zIndex: string;
|
|
31
|
+
};
|
|
32
|
+
type GridState = {
|
|
33
|
+
active?: HTMLElement;
|
|
34
|
+
callbacks: GridStateCallbacks;
|
|
35
|
+
columns?: GridColumns;
|
|
36
|
+
elements: HTMLElement[];
|
|
37
|
+
gap: GridGap;
|
|
38
|
+
height?: number;
|
|
39
|
+
host: HTMLElement;
|
|
40
|
+
mutationObserver: MutationObserver;
|
|
41
|
+
sortable: boolean;
|
|
42
|
+
};
|
|
43
|
+
type GridStateCallbacks = {
|
|
44
|
+
onResizeBegin: (element: Element, size: OuiResizableEventDetail) => void;
|
|
45
|
+
onResizeCancel: (element: Element, size: OuiResizableEventDetail) => void;
|
|
46
|
+
onResizeEnd: (element: Element, size: OuiResizableEventDetail) => void;
|
|
47
|
+
onResizeUpdate: (element: Element, size: OuiResizableEventDetail) => void;
|
|
48
|
+
};
|
|
49
|
+
declare class OuiGridResizeEvent extends CustomEvent<OuiGridResizeEventDetail> {}
|
|
50
|
+
type OuiGridResizeEventDetail = {
|
|
51
|
+
item: HTMLElement;
|
|
52
|
+
} & OuiResizableEventDetail;
|
|
53
|
+
declare class OuiGridResizeHandlerEvent extends CustomEvent<OuiGridResizeHandlerEventDetail> {
|
|
54
|
+
constructor(detail: OuiGridResizeHandlerEventDetail);
|
|
55
|
+
}
|
|
56
|
+
type OuiGridResizeHandlerEventDetail = {
|
|
57
|
+
handle: HTMLElement;
|
|
58
|
+
item: HTMLElement;
|
|
59
|
+
};
|
|
60
|
+
declare class OuiGridSortEvent extends CustomEvent<OuiGridEventSortDetail> {}
|
|
61
|
+
type OuiGridEventSortDetail = {
|
|
62
|
+
destination?: HTMLElement;
|
|
63
|
+
item: HTMLElement;
|
|
64
|
+
};
|
|
65
|
+
declare const GRID_TAGNAME = "oui-grid";
|
|
66
|
+
declare const GRID_ATTRIBUTE_COLUMNS = "columns";
|
|
67
|
+
declare const GRID_ATTRIBUTE_GAP = "gap";
|
|
68
|
+
declare const GRID_ATTRIBUTE_ITEM: string;
|
|
69
|
+
declare const GRID_ATTRIBUTE_ITEM_ACTIVE: string;
|
|
70
|
+
declare const GRID_ATTRIBUTE_ITEM_HANDLE: string;
|
|
71
|
+
declare const GRID_ATTRIBUTE_PLACEHOLDER: string;
|
|
72
|
+
declare const GRID_ATTRIBUTE_RESIZABLE = "resizable";
|
|
73
|
+
declare const GRID_ATTRIBUTE_SORTABLE = "sortable";
|
|
74
|
+
declare const GRID_ATTRIBUTE_SORTING: string;
|
|
75
|
+
declare const GRID_ATTRIBUTE_SPAN: string;
|
|
76
|
+
declare const GRID_EVENT_RESIZE_BEGIN = "resize:begin";
|
|
77
|
+
declare const GRID_EVENT_RESIZE_CANCEL = "resize:cancel";
|
|
78
|
+
declare const GRID_EVENT_RESIZE_CHANGE = "resize:change";
|
|
79
|
+
declare const GRID_EVENT_RESIZE_END = "resize:end";
|
|
80
|
+
declare const GRID_EVENT_RESIZE_HANDLE = "resize:handle";
|
|
81
|
+
declare const GRID_EVENT_SORT_BEGIN = "sort:begin";
|
|
82
|
+
declare const GRID_EVENT_SORT_CANCEL = "sort:cancel";
|
|
83
|
+
declare const GRID_EVENT_SORT_CHANGE = "sort:change";
|
|
84
|
+
declare const GRID_EVENT_SORT_END = "sort:end";
|
|
85
|
+
declare const GRID_SELECTOR_HANDLE: string;
|
|
86
|
+
declare const GRID_SELECTOR_ITEM: string;
|
|
87
|
+
declare const GRID_SELECTOR_ITEM_SCOPED: string;
|
|
88
|
+
declare const GRID_SYMBOL: unique symbol;
|
|
89
|
+
declare const gridStyling: StyleToggler;
|
|
90
|
+
export { OuiGridEventSortDetail as A, GRID_SYMBOL as C, GridItem as D, GridGap as E, OuiGridSortEvent as F, gridStyling as I, OuiGridResizeEventDetail as M, OuiGridResizeHandlerEvent as N, GridSort as O, OuiGridResizeHandlerEventDetail as P, GRID_SELECTOR_ITEM_SCOPED as S, GridColumns as T, GRID_EVENT_SORT_CANCEL as _, GRID_ATTRIBUTE_ITEM_HANDLE as a, GRID_SELECTOR_HANDLE as b, GRID_ATTRIBUTE_SORTABLE as c, GRID_EVENT_RESIZE_BEGIN as d, GRID_EVENT_RESIZE_CANCEL as f, GRID_EVENT_SORT_BEGIN as g, GRID_EVENT_RESIZE_HANDLE as h, GRID_ATTRIBUTE_ITEM_ACTIVE as i, OuiGridResizeEvent as j, GridState as k, GRID_ATTRIBUTE_SORTING as l, GRID_EVENT_RESIZE_END as m, GRID_ATTRIBUTE_GAP as n, GRID_ATTRIBUTE_PLACEHOLDER as o, GRID_EVENT_RESIZE_CHANGE as p, GRID_ATTRIBUTE_ITEM as r, GRID_ATTRIBUTE_RESIZABLE as s, GRID_ATTRIBUTE_COLUMNS as t, GRID_ATTRIBUTE_SPAN as u, GRID_EVENT_SORT_CHANGE as v, GRID_TAGNAME as w, GRID_SELECTOR_ITEM as x, GRID_EVENT_SORT_END as y };
|
package/dist/js/index.d.mts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { c as OuiFloatable, t as CreateOuiFloatableOptions, u as OuiFloatablePosition } from "./floatable.model-
|
|
2
|
-
import { N as OuiColorPickerEvent } from "./color-picker.constants-
|
|
3
|
-
import { a as setColorPickerLocalizations } from "./color-picker.misc-
|
|
4
|
-
import { OuiColorPickerElement } from "./color-picker/index.mjs";
|
|
5
|
-
import { i as setComboboxLocalizations } from "./combobox.misc-DRDFk6X8.mjs";
|
|
6
|
-
import { OuiComboboxElement } from "./combobox/index.mjs";
|
|
7
|
-
import { $ as OuiSortable, p as CreateOuiDraggableOptions, u as OuiMovable } from "./movable.model-D9nnPWKk.mjs";
|
|
8
|
-
import { n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.model-vCxaFdOA.mjs";
|
|
9
|
-
import { c as OuiDialog } from "./dialog.model-Dv_h9Kns.mjs";
|
|
10
|
-
import { getDialog } from "./dialog/index.mjs";
|
|
11
|
-
import { n as createFloatable } from "./floatable.embedded-ncshL3Sa.mjs";
|
|
1
|
+
import { c as OuiFloatable, t as CreateOuiFloatableOptions, u as OuiFloatablePosition } from "./floatable.model-jS5Ui5Av.mjs";
|
|
2
|
+
import { N as OuiColorPickerEvent } from "./color-picker.constants-DdttC4ab.mjs";
|
|
3
|
+
import { a as setColorPickerLocalizations } from "./color-picker.misc-BH_tFyWR.mjs";
|
|
12
4
|
import "./floatable/floatable.standalone.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import { t as createFocusTrap } from "./focus-trap.embedded-DpcPkP7c.mjs";
|
|
15
|
-
import { t as createMovable } from "./movable.embedded-C1bDTLGs.mjs";
|
|
5
|
+
import { i as setComboboxLocalizations } from "./combobox.misc-Csh9lm9_.mjs";
|
|
16
6
|
import "./movable/movable.standalone.mjs";
|
|
17
|
-
import {
|
|
7
|
+
import { d as OuiMovable, m as CreateOuiDraggableOptions, nt as OuiSortable } from "./movable.model-CQ3AbTrq.mjs";
|
|
8
|
+
import { i as OuiResizableEvent, n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.model-BOufXDXx.mjs";
|
|
9
|
+
import { c as OuiDialog } from "./dialog.model-cYq7rTKL.mjs";
|
|
18
10
|
import "./resizable/resizable.standalone.mjs";
|
|
19
|
-
import {
|
|
11
|
+
import { n as createFloatable } from "./floatable.embedded-Cr1KX6GZ.mjs";
|
|
20
12
|
import "./sortable/sortable.standalone.mjs";
|
|
21
|
-
import {
|
|
13
|
+
import { l as OuiFocusTrap, u as OuiFocusTrapOptions } from "./focus-trap.model-wg0iAZ7x.mjs";
|
|
14
|
+
import { t as createFocusTrap } from "./focus-trap.embedded-BVXcd4OO.mjs";
|
|
15
|
+
import { OuiColorPickerElement } from "./color-picker/index.mjs";
|
|
16
|
+
import { t as createMovable } from "./movable.embedded-HjPPob-Z.mjs";
|
|
17
|
+
import { OuiComboboxElement } from "./combobox/index.mjs";
|
|
18
|
+
import { t as createResizable } from "./resizable.embedded-DQclAEP-.mjs";
|
|
19
|
+
import { getDialog } from "./dialog/index.mjs";
|
|
20
|
+
import { t as createSortable } from "./sortable.embedded-B5LPz-c_.mjs";
|
|
21
|
+
import { OuiGridElement } from "./grid/index.mjs";
|
|
22
|
+
import { n as setListboxLocalizations } from "./listbox.misc-CkW28nUS.mjs";
|
|
22
23
|
import { OuiListboxElement } from "./listbox/index.mjs";
|
|
23
|
-
import { t as OuiPopover } from "./popover.model-
|
|
24
|
+
import { t as OuiPopover } from "./popover.model-CrrIdSmS.mjs";
|
|
24
25
|
import { getPopover } from "./popover/index.mjs";
|
|
25
26
|
import { OuiSplitterElement } from "./splitter/index.mjs";
|
|
26
|
-
import { r as OuiTabsEvent } from "./tabs.model-
|
|
27
|
+
import { r as OuiTabsEvent } from "./tabs.model-CvylbR2o.mjs";
|
|
27
28
|
import { OuiTabsElement } from "./tabs/index.mjs";
|
|
28
|
-
import { t as OuiTooltip } from "./tooltip.model-
|
|
29
|
+
import { t as OuiTooltip } from "./tooltip.model-BI3UK-VU.mjs";
|
|
29
30
|
import { getTooltip, setTooltipDelay } from "./tooltip/index.mjs";
|
|
30
|
-
export { type CreateOuiFloatableOptions, type CreateOuiDraggableOptions as CreateOuiMovableOptions, type CreateOuiDraggableOptions as CreateOuiSortableOptions, type CreateOuiResizableOptions, OuiColorPickerElement, OuiColorPickerEvent, OuiComboboxElement, type OuiDialog, type OuiFloatable, type OuiFloatablePosition, type OuiFocusTrap, type OuiFocusTrapOptions, OuiListboxElement, type OuiMovable, type OuiPopover, type OuiResizable, type OuiSortable, OuiSplitterElement, OuiTabsElement, OuiTabsEvent, type OuiTooltip, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setColorPickerLocalizations, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
|
31
|
+
export { type CreateOuiFloatableOptions, type CreateOuiDraggableOptions as CreateOuiMovableOptions, type CreateOuiDraggableOptions as CreateOuiSortableOptions, type CreateOuiResizableOptions, OuiColorPickerElement, OuiColorPickerEvent, OuiComboboxElement, type OuiDialog, type OuiFloatable, type OuiFloatablePosition, type OuiFocusTrap, type OuiFocusTrapOptions, OuiGridElement, OuiListboxElement, type OuiMovable, type OuiPopover, type OuiResizable, OuiResizableEvent, type OuiSortable, OuiSplitterElement, OuiTabsElement, OuiTabsEvent, type OuiTooltip, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setColorPickerLocalizations, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
package/dist/js/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { createFocusTrap } from "./focus-trap/focus-trap.embedded.mjs";
|
|
|
6
6
|
import "./focus-trap/focus-trap.standalone.mjs";
|
|
7
7
|
import { createMovable } from "./movable/movable.embedded.mjs";
|
|
8
8
|
import "./movable/movable.standalone.mjs";
|
|
9
|
+
import { OuiResizableEvent } from "./resizable/resizable.model.mjs";
|
|
9
10
|
import { createResizable } from "./resizable/resizable.embedded.mjs";
|
|
10
11
|
import "./resizable/resizable.standalone.mjs";
|
|
11
12
|
import { createSortable } from "./sortable/sortable.embedded.mjs";
|
|
@@ -13,14 +14,15 @@ import "./sortable/sortable.standalone.mjs";
|
|
|
13
14
|
import { OuiColorPickerEvent } from "./color-picker/color-picker.model.mjs";
|
|
14
15
|
import { setColorPickerLocalizations } from "./color-picker/color-picker.misc.mjs";
|
|
15
16
|
import { OuiColorPickerElement } from "./color-picker/index.mjs";
|
|
16
|
-
import { D as setComboboxLocalizations } from "./combobox.state-
|
|
17
|
+
import { D as setComboboxLocalizations } from "./combobox.state-Bjt0dwe3.mjs";
|
|
17
18
|
import { OuiComboboxElement } from "./combobox/index.mjs";
|
|
18
19
|
import { getDialog } from "./dialog/index.mjs";
|
|
19
|
-
import {
|
|
20
|
+
import { OuiGridElement } from "./grid/index.mjs";
|
|
21
|
+
import { s as setListboxLocalizations } from "./listbox.state-DO58GDqc.mjs";
|
|
20
22
|
import { OuiListboxElement } from "./listbox/index.mjs";
|
|
21
23
|
import { getPopover } from "./popover/index.mjs";
|
|
22
24
|
import { OuiSplitterElement } from "./splitter/index.mjs";
|
|
23
25
|
import { OuiTabsEvent } from "./tabs/tabs.model.mjs";
|
|
24
26
|
import { OuiTabsElement } from "./tabs/index.mjs";
|
|
25
27
|
import { getTooltip, setTooltipDelay } from "./tooltip/index.mjs";
|
|
26
|
-
export { OuiColorPickerElement, OuiColorPickerEvent, OuiComboboxElement, OuiListboxElement, OuiSplitterElement, OuiTabsElement, OuiTabsEvent, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setColorPickerLocalizations, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
|
28
|
+
export { OuiColorPickerElement, OuiColorPickerEvent, OuiComboboxElement, OuiGridElement, OuiListboxElement, OuiResizableEvent, OuiSplitterElement, OuiTabsElement, OuiTabsEvent, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setColorPickerLocalizations, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function attributable(attribute: string, add: (element: Element) => void, remove: (element: Element) => void): void;
|
|
3
|
-
//#endregion
|
|
1
|
+
export declare function attributable(attribute: string, add: (element: Element) => void, remove: (element: Element) => void): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filter } from "@oscarpalmer/atoms/array/filter";
|
|
2
|
-
|
|
2
|
+
// src/js/internal/attributable.ts
|
|
3
3
|
function attributable(attribute, add, remove) {
|
|
4
4
|
new MutationObserver((entries) => {
|
|
5
5
|
const { length } = entries;
|
|
@@ -7,7 +7,7 @@ function attributable(attribute, add, remove) {
|
|
|
7
7
|
const entry = entries[index];
|
|
8
8
|
if (entry.type === "attributes" && entry.target instanceof Element) {
|
|
9
9
|
if (entry.target.hasAttribute(attribute)) handleAdded(attribute, [entry.target], add);
|
|
10
|
-
else
|
|
10
|
+
else remove(entry.target);
|
|
11
11
|
} else if (entry.type === "childList") {
|
|
12
12
|
handleAdded(attribute, entry.addedNodes, add);
|
|
13
13
|
handleRemoved(entry.removedNodes, remove);
|
|
@@ -37,9 +37,9 @@ function handleRemoved(nodes, remove) {
|
|
|
37
37
|
const { length } = elements;
|
|
38
38
|
for (let index = 0; index < length; index += 1) {
|
|
39
39
|
const element = elements[index];
|
|
40
|
+
if (element.isConnected) continue;
|
|
40
41
|
remove(element);
|
|
41
42
|
if (element.hasChildNodes()) handleRemoved(element.childNodes, remove);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
//#endregion
|
|
45
45
|
export { attributable };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { CreateOuiDraggableOptions, DRAGGABLE_ATTRIBUTE_MOVABLE, DRAGGABLE_ATTRIBUTE_SORTABLE, DRAGGABLE_KEY_ESCAPE, DRAGGABLE_SELECTOR, DRAGGABLE_SELECTOR_MOVABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_ITEM, DRAGGABLE_SYMBOL, OuiDragBegin, OuiDragCancel, OuiDragEnd, OuiDragMove, OuiDragMovePosition, OuiDraggable, OuiDraggableBound, OuiDraggableDirection, OuiDraggableGlobals, OuiDraggableGlobalsElement, OuiDraggableInstances, OuiDraggableItem, OuiDraggableOptions, OuiDraggableOptionsContainer, OuiDraggableOptionsContainerOnDestroy, OuiDraggableOptionsContainerOnInitialize, OuiDraggableOptionsDirection, OuiDraggableOptionsDirectionOnAfter, OuiDraggableOptionsDrag, OuiDraggableOptionsPosition, OuiDraggableOptionsPositionGetOffset, OuiDraggableOptionsPositionGetOriginal, OuiDraggableState, OuiDraggableStates, draggableContainers, draggableGlobals, draggableHorizontals, draggableProperties, draggableStyleToggler, draggableStyles, draggableVerticals };
|
|
1
|
+
import { $ as draggableStyleToggler, A as OuiDraggableDirection, B as OuiDraggableOptionsContainerOnInitialize, C as OuiDragBegin, D as OuiDragMovePosition, E as OuiDragMove, F as OuiDraggableInstances, G as OuiDraggableOptionsPositionGetOffset, H as OuiDraggableOptionsDirectionOnAfter, I as OuiDraggableItem, J as OuiDraggableStates, K as OuiDraggableOptionsPositionGetOriginal, L as OuiDraggableOptions, M as OuiDraggableEventDetail, N as OuiDraggableGlobals, O as OuiDraggable, P as OuiDraggableGlobalsElement, Q as draggableProperties, R as OuiDraggableOptionsContainer, S as DRAGGABLE_SYMBOL, T as OuiDragEnd, U as OuiDraggableOptionsDrag, V as OuiDraggableOptionsDirection, W as OuiDraggableOptionsPosition, X as draggableGlobals, Y as draggableContainers, Z as draggableHorizontals, _ as DRAGGABLE_KEY_ESCAPE, b as DRAGGABLE_SELECTOR_SORTABLE_HANDLE, et as draggableStyles, g as DRAGGABLE_ATTRIBUTE_SORTABLE, h as DRAGGABLE_ATTRIBUTE_MOVABLE, j as OuiDraggableEvent, k as OuiDraggableBound, m as CreateOuiDraggableOptions, q as OuiDraggableState, tt as draggableVerticals, v as DRAGGABLE_SELECTOR, w as OuiDragCancel, x as DRAGGABLE_SELECTOR_SORTABLE_ITEM, y as DRAGGABLE_SELECTOR_MOVABLE_HANDLE, z as OuiDraggableOptionsContainerOnDestroy } from "../../movable.model-CQ3AbTrq.mjs";
|
|
2
|
+
export { CreateOuiDraggableOptions, DRAGGABLE_ATTRIBUTE_MOVABLE, DRAGGABLE_ATTRIBUTE_SORTABLE, DRAGGABLE_KEY_ESCAPE, DRAGGABLE_SELECTOR, DRAGGABLE_SELECTOR_MOVABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_ITEM, DRAGGABLE_SYMBOL, OuiDragBegin, OuiDragCancel, OuiDragEnd, OuiDragMove, OuiDragMovePosition, OuiDraggable, OuiDraggableBound, OuiDraggableDirection, OuiDraggableEvent, OuiDraggableEventDetail, OuiDraggableGlobals, OuiDraggableGlobalsElement, OuiDraggableInstances, OuiDraggableItem, OuiDraggableOptions, OuiDraggableOptionsContainer, OuiDraggableOptionsContainerOnDestroy, OuiDraggableOptionsContainerOnInitialize, OuiDraggableOptionsDirection, OuiDraggableOptionsDirectionOnAfter, OuiDraggableOptionsDrag, OuiDraggableOptionsPosition, OuiDraggableOptionsPositionGetOffset, OuiDraggableOptionsPositionGetOriginal, OuiDraggableState, OuiDraggableStates, draggableContainers, draggableGlobals, draggableHorizontals, draggableProperties, draggableStyleToggler, draggableStyles, draggableVerticals };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toggleStyles } from "@oscarpalmer/toretto/style";
|
|
2
|
-
|
|
2
|
+
// src/js/internal/draggable/draggable.model.ts
|
|
3
|
+
var OuiDraggableEvent = class extends CustomEvent {};
|
|
3
4
|
const DRAGGABLE_ATTRIBUTE_MOVABLE = "oui-movable";
|
|
4
5
|
const DRAGGABLE_ATTRIBUTE_SORTABLE = "oui-sortable";
|
|
5
6
|
const DRAGGABLE_KEY_ESCAPE = "Escape";
|
|
@@ -33,5 +34,4 @@ const draggableStyles = {
|
|
|
33
34
|
};
|
|
34
35
|
const draggableStyleToggler = toggleStyles(document.body, draggableStyles);
|
|
35
36
|
const draggableVerticals = /* @__PURE__ */ new Set(["vertical", "y"]);
|
|
36
|
-
|
|
37
|
-
export { DRAGGABLE_ATTRIBUTE_MOVABLE, DRAGGABLE_ATTRIBUTE_SORTABLE, DRAGGABLE_KEY_ESCAPE, DRAGGABLE_SELECTOR, DRAGGABLE_SELECTOR_MOVABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_ITEM, DRAGGABLE_SYMBOL, draggableContainers, draggableGlobals, draggableHorizontals, draggableProperties, draggableStyleToggler, draggableStyles, draggableVerticals };
|
|
37
|
+
export { DRAGGABLE_ATTRIBUTE_MOVABLE, DRAGGABLE_ATTRIBUTE_SORTABLE, DRAGGABLE_KEY_ESCAPE, DRAGGABLE_SELECTOR, DRAGGABLE_SELECTOR_MOVABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_ITEM, DRAGGABLE_SYMBOL, OuiDraggableEvent, draggableContainers, draggableGlobals, draggableHorizontals, draggableProperties, draggableStyleToggler, draggableStyles, draggableVerticals };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as OuiDraggableInstances, J as OuiDraggableStates, L as OuiDraggableOptions, O as OuiDraggable, k as OuiDraggableBound, m as CreateOuiDraggableOptions, q as OuiDraggableState } from "../../movable.model-CQ3AbTrq.mjs";
|
|
2
2
|
import { PlainObject } from "@oscarpalmer/atoms/models";
|
|
3
|
-
//#region src/js/internal/draggable/index.d.ts
|
|
4
3
|
export declare function addDraggable<Property extends keyof OuiDraggableInstances, Instance extends OuiDraggableInstances[Property]>(this: OuiDraggableBound<Property, Instance>, element: Element, options?: CreateOuiDraggableOptions): Instance;
|
|
5
4
|
export declare function destroyDraggable<ExtraState extends PlainObject>(draggable: OuiDraggable<ExtraState>): void;
|
|
6
5
|
export declare function getDraggableStates(element: Element): OuiDraggableStates | undefined;
|
|
@@ -9,5 +8,4 @@ export declare function initializeDraggable<ExtraState extends PlainObject>(drag
|
|
|
9
8
|
export declare function removeDraggable<Property extends keyof OuiDraggableInstances, Instance extends OuiDraggableInstances[Property]>(this: {
|
|
10
9
|
constructor: new (element: Element) => Instance;
|
|
11
10
|
property: Property;
|
|
12
|
-
}, element: Element): void;
|
|
13
|
-
//#endregion
|
|
11
|
+
}, element: Element): void;
|