@oscarpalmer/oui 0.38.0 → 0.40.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/README.md +1 -1
- package/dist/css/badge.css +11 -8
- package/dist/css/button.css +106 -14
- package/dist/css/color-picker.css +555 -73
- package/dist/css/color.css +86 -86
- package/dist/css/combobox.css +98 -4
- package/dist/css/content.css +7 -6
- package/dist/css/floatable.css +1 -3
- package/dist/css/form.css +99 -6
- package/dist/css/icon.css +99 -0
- package/dist/css/listbox.css +3 -0
- package/dist/css/message.css +4 -3
- package/dist/css/mixins/button.mixins.css +1 -0
- package/dist/css/reset.css +1 -1
- package/dist/css/tabs.css +95 -3
- package/dist/css/typography.css +90 -0
- package/dist/js/color-picker/color-picker.constants.d.mts +2 -0
- package/dist/js/color-picker/color-picker.constants.mjs +60 -0
- package/dist/js/color-picker/color-picker.dom.d.mts +8 -0
- package/dist/js/color-picker/color-picker.dom.mjs +191 -0
- package/dist/js/color-picker/color-picker.event.d.mts +9 -0
- package/dist/js/color-picker/color-picker.event.mjs +2 -0
- package/dist/js/color-picker/color-picker.form.d.mts +5 -0
- package/dist/js/color-picker/color-picker.form.mjs +27 -0
- package/dist/js/color-picker/color-picker.misc.d.mts +2 -0
- package/dist/js/color-picker/color-picker.misc.mjs +2 -0
- package/dist/js/color-picker/color-picker.model.d.mts +2 -0
- package/dist/js/color-picker/color-picker.model.mjs +24 -0
- package/dist/js/color-picker/color-picker.output.d.mts +8 -0
- package/dist/js/color-picker/color-picker.output.mjs +235 -0
- package/dist/js/color-picker/color-picker.state.d.mts +8 -0
- package/dist/js/color-picker/color-picker.state.mjs +2 -0
- package/dist/js/{color-picker.d.mts → color-picker/index.d.mts} +10 -43
- package/dist/js/color-picker/index.mjs +305 -0
- package/dist/js/color-picker.constants-D1mxw_Le.d.mts +179 -0
- package/dist/js/color-picker.event-Cksj5TvS.mjs +500 -0
- package/dist/js/color-picker.misc-CtsXGrOe.d.mts +27 -0
- package/dist/js/combobox/combobox.constants.d.mts +2 -0
- package/dist/js/combobox/{constants.combobox.mjs → combobox.constants.mjs} +21 -21
- package/dist/js/combobox/combobox.dom.d.mts +26 -0
- package/dist/js/combobox/{dom.combobox.mjs → combobox.dom.mjs} +44 -37
- package/dist/js/combobox/combobox.event.d.mts +22 -0
- package/dist/js/combobox/{event.combobox.mjs → combobox.event.mjs} +1 -1
- package/dist/js/combobox/combobox.misc.d.mts +2 -0
- package/dist/js/combobox/{misc.combobox.mjs → combobox.misc.mjs} +1 -1
- package/dist/js/combobox/combobox.model.d.mts +2 -0
- package/dist/js/combobox/combobox.state.d.mts +10 -0
- package/dist/js/combobox/combobox.state.mjs +2 -0
- package/dist/js/combobox/index.d.mts +163 -2
- package/dist/js/combobox/index.mjs +53 -52
- package/dist/js/combobox.constants-DZVkMP5g.d.mts +19 -0
- package/dist/js/combobox.misc-C1tPZZDi.d.mts +22 -0
- package/dist/js/{combobox/models.combobox.d.mts → combobox.model-oDV06XCN.d.mts} +6 -6
- package/dist/js/{state.combobox-Qm3FWzYW.mjs → combobox.state-BfJ3Hxg8.mjs} +96 -82
- package/dist/js/constants.listbox-C5Ap6Ag_.d.mts +9 -0
- package/dist/js/dialog/dialog.model.d.mts +2 -0
- package/dist/js/dialog/dialog.model.mjs +11 -0
- package/dist/js/dialog/index.d.mts +12 -0
- package/dist/js/dialog/index.mjs +123 -0
- package/dist/js/dialog.model-DX2mndMh.d.mts +45 -0
- package/dist/js/floatable/floatable.embedded.d.mts +2 -2
- package/dist/js/floatable/floatable.embedded.mjs +64 -92
- package/dist/js/floatable/floatable.model.d.mts +2 -0
- package/dist/js/floatable/floatable.model.mjs +23 -0
- package/dist/js/floatable/floatable.standalone.d.mts +2 -1
- package/dist/js/floatable.embedded-MeTyXjFn.d.mts +17 -0
- package/dist/js/floatable.model-DXsQgoU7.d.mts +62 -0
- package/dist/js/focus-trap/focus-trap.embedded.d.mts +2 -2
- package/dist/js/focus-trap/focus-trap.embedded.mjs +112 -134
- package/dist/js/focus-trap/focus-trap.model.d.mts +2 -0
- package/dist/js/focus-trap/focus-trap.model.mjs +15 -0
- package/dist/js/focus-trap/focus-trap.standalone.d.mts +2 -1
- package/dist/js/focus-trap.embedded-DIU05m1z.d.mts +13 -0
- package/dist/js/{focus-trap.embedded-DR8NpZfr.d.mts → focus-trap.model-BeX6UYlw.d.mts} +16 -18
- package/dist/js/index.d.mts +26 -14
- package/dist/js/index.mjs +18 -15
- package/dist/js/internal/attributable.d.mts +2 -3
- package/dist/js/internal/attributable.mjs +3 -2
- package/dist/js/internal/draggable/draggable.model.d.mts +2 -0
- package/dist/js/internal/draggable/draggable.model.mjs +37 -0
- package/dist/js/internal/draggable/index.d.mts +13 -0
- package/dist/js/internal/{draggable.mjs → draggable/index.mjs} +83 -114
- package/dist/js/internal/listbox/listbox.constants.d.mts +7 -10
- package/dist/js/internal/listbox/listbox.constants.mjs +15 -16
- package/dist/js/internal/listbox/listbox.data.d.mts +9 -10
- package/dist/js/internal/listbox/listbox.data.mjs +1 -1
- package/dist/js/internal/listbox/listbox.dom.d.mts +19 -20
- package/dist/js/internal/listbox/listbox.dom.mjs +1 -1
- package/dist/js/internal/listbox/listbox.event.d.mts +3 -4
- package/dist/js/internal/listbox/listbox.event.mjs +23 -20
- package/dist/js/internal/listbox/listbox.form.d.mts +4 -5
- package/dist/js/internal/listbox/listbox.form.mjs +15 -12
- package/dist/js/internal/listbox/listbox.misc.d.mts +10 -11
- package/dist/js/internal/listbox/listbox.misc.mjs +1 -1
- package/dist/js/internal/listbox/listbox.model.d.mts +2 -2
- package/dist/js/internal/listbox/listbox.state.d.mts +5 -6
- package/dist/js/internal/listbox/listbox.state.mjs +19 -20
- package/dist/js/internal/misc.d.mts +5 -4
- package/dist/js/internal/misc.mjs +7 -1
- package/dist/js/internal/navigable/index.d.mts +6 -0
- package/dist/js/internal/navigable/index.mjs +125 -0
- package/dist/js/internal/navigable/navigable.model.d.mts +2 -0
- package/dist/js/internal/navigable/navigable.model.mjs +18 -0
- package/dist/js/l10n/index.d.mts +9 -0
- package/dist/js/{l10n.mjs → l10n/index.mjs} +50 -23
- package/dist/js/l10n/l10n.model.d.mts +2 -0
- package/dist/js/l10n/l10n.model.mjs +9 -0
- package/dist/js/l10n.model-D6a9frgl.d.mts +26 -0
- package/dist/js/listbox/constants.listbox.d.mts +2 -2
- package/dist/js/listbox/constants.listbox.mjs +10 -14
- package/dist/js/listbox/event.listbox.d.mts +6 -7
- package/dist/js/listbox/event.listbox.mjs +47 -1
- package/dist/js/listbox/index.d.mts +8 -6
- package/dist/js/listbox/index.mjs +47 -49
- package/dist/js/listbox/misc.listbox.d.mts +1 -1
- package/dist/js/listbox/misc.listbox.mjs +1 -1
- package/dist/js/listbox/state.listbox.d.mts +8 -10
- package/dist/js/listbox/state.listbox.mjs +2 -2
- package/dist/js/{listbox.data-C7CRa5Ya.mjs → listbox.data-BQyZGKgr.mjs} +83 -66
- package/dist/js/{listbox.model-CRReGOmu.d.mts → listbox.model-CuBOj4qe.d.mts} +15 -11
- package/dist/js/menu/index.mjs +167 -0
- package/dist/js/menu/menu.model.d.mts +33 -0
- package/dist/js/menu/menu.model.mjs +15 -0
- package/dist/js/{misc.listbox-Cyz2CRDy.mjs → misc.listbox-CjfBUbHD.mjs} +27 -69
- package/dist/js/{misc.listbox-gnoJhrTr.d.mts → misc.listbox-CtoGvXQo.d.mts} +2 -2
- package/dist/js/movable/movable.embedded.d.mts +2 -2
- package/dist/js/movable/movable.embedded.mjs +60 -72
- package/dist/js/movable/movable.model.d.mts +2 -0
- package/dist/js/movable/movable.model.mjs +12 -0
- package/dist/js/movable/movable.standalone.d.mts +2 -1
- package/dist/js/movable.embedded-DoyXLegc.d.mts +11 -0
- package/dist/js/movable.model-BHaK_mKw.d.mts +186 -0
- package/dist/js/navigable.model-BPOM8DZk.d.mts +44 -0
- package/dist/js/popover/index.d.mts +12 -0
- package/dist/js/{popover.mjs → popover/index.mjs} +40 -50
- package/dist/js/popover/popover.model.d.mts +2 -0
- package/dist/js/popover/popover.model.mjs +12 -0
- package/dist/js/popover.model-ubKNG612.d.mts +38 -0
- package/dist/js/resizable/resizable.embedded.d.mts +2 -2
- package/dist/js/resizable/resizable.embedded.mjs +44 -59
- package/dist/js/resizable/resizable.model.d.mts +2 -0
- package/dist/js/resizable/resizable.model.mjs +21 -0
- package/dist/js/resizable/resizable.standalone.d.mts +2 -1
- package/dist/js/resizable.embedded-Bf1qBUdt.d.mts +11 -0
- package/dist/js/resizable.model-BwzJcTVJ.d.mts +46 -0
- package/dist/js/sortable/sortable.embedded.d.mts +2 -2
- package/dist/js/sortable/sortable.embedded.mjs +69 -82
- package/dist/js/sortable/sortable.model.d.mts +2 -0
- package/dist/js/sortable/sortable.model.mjs +24 -0
- package/dist/js/sortable/sortable.standalone.d.mts +2 -1
- package/dist/js/sortable.embedded-DzBKAwSG.d.mts +11 -0
- package/dist/js/{splitter.d.mts → splitter/index.d.mts} +8 -7
- package/dist/js/splitter/index.mjs +284 -0
- package/dist/js/splitter/splitter.model.d.mts +2 -0
- package/dist/js/splitter/splitter.model.mjs +37 -0
- package/dist/js/splitter.model-DOLNjLVS.d.mts +57 -0
- package/dist/js/{tabs.d.mts → tabs/index.d.mts} +7 -8
- package/dist/js/{tabs.mjs → tabs/index.mjs} +58 -58
- package/dist/js/tabs/tabs.model.d.mts +2 -0
- package/dist/js/tabs/tabs.model.mjs +18 -0
- package/dist/js/tabs.model-DRBX_JtI.d.mts +40 -0
- package/dist/js/toolbar/index.mjs +27 -0
- package/dist/js/toolbar/toolbar.model.d.mts +11 -0
- package/dist/js/toolbar/toolbar.model.mjs +7 -0
- package/dist/js/tooltip/index.d.mts +19 -0
- package/dist/js/{tooltip.mjs → tooltip/index.mjs} +60 -85
- package/dist/js/tooltip/tooltip.model.d.mts +2 -0
- package/dist/js/tooltip/tooltip.model.mjs +15 -0
- package/dist/js/tooltip.model-DRkY_BsL.d.mts +37 -0
- package/package.json +43 -37
- package/dist/js/color-picker.mjs +0 -924
- package/dist/js/combobox/constants.combobox.d.mts +0 -2
- package/dist/js/combobox/dom.combobox.d.mts +0 -27
- package/dist/js/combobox/event.combobox.d.mts +0 -23
- package/dist/js/combobox/misc.combobox.d.mts +0 -2
- package/dist/js/combobox/state.combobox.d.mts +0 -12
- package/dist/js/combobox/state.combobox.mjs +0 -2
- package/dist/js/constants.combobox-DmRAMC64.d.mts +0 -26
- package/dist/js/constants.listbox-DRsXUxd3.d.mts +0 -14
- package/dist/js/dialog.d.mts +0 -47
- package/dist/js/dialog.mjs +0 -131
- package/dist/js/draggable-a6w0J1OD.d.mts +0 -154
- package/dist/js/floatable.embedded-Bct4U5Dm.d.mts +0 -69
- package/dist/js/index-DJdFlTLm.d.mts +0 -177
- package/dist/js/internal/draggable.d.mts +0 -2
- package/dist/js/internal/navigable.d.mts +0 -37
- package/dist/js/internal/navigable.mjs +0 -135
- package/dist/js/l10n-Bn-7RcwR.d.mts +0 -20
- package/dist/js/l10n.d.mts +0 -2
- package/dist/js/menu.mjs +0 -172
- package/dist/js/popover.d.mts +0 -38
- package/dist/js/resizable.embedded-3qoR0Bjm.d.mts +0 -34
- package/dist/js/splitter.mjs +0 -322
- package/dist/js/toolbar.mjs +0 -31
- package/dist/js/tooltip.d.mts +0 -45
- package/src/css/a11y.scss +0 -13
- package/src/css/badge.scss +0 -62
- package/src/css/button.scss +0 -50
- package/src/css/color-picker.scss +0 -344
- package/src/css/color.scss +0 -113
- package/src/css/combobox.scss +0 -255
- package/src/css/content.scss +0 -181
- package/src/css/flex.scss +0 -107
- package/src/css/floatable.scss +0 -155
- package/src/css/form.scss +0 -575
- package/src/css/listbox.scss +0 -121
- package/src/css/message.scss +0 -74
- package/src/css/mixins/badge.mixins.scss +0 -53
- package/src/css/mixins/button.mixins.scss +0 -112
- package/src/css/mixins/input.mixins.scss +0 -114
- package/src/css/mixins/message.mixins.scss +0 -41
- package/src/css/mixins/misc.mixins.scss +0 -48
- package/src/css/mixins/shadow.mixins.scss +0 -57
- package/src/css/reset.scss +0 -392
- package/src/css/splitter.scss +0 -89
- package/src/css/table.scss +0 -107
- package/src/css/tabs.scss +0 -74
- package/src/js/color-picker.ts +0 -1653
- package/src/js/combobox/constants.combobox.ts +0 -83
- package/src/js/combobox/dom.combobox.ts +0 -411
- package/src/js/combobox/event.combobox.ts +0 -365
- package/src/js/combobox/index.ts +0 -382
- package/src/js/combobox/misc.combobox.ts +0 -104
- package/src/js/combobox/models.combobox.ts +0 -54
- package/src/js/combobox/state.combobox.ts +0 -246
- package/src/js/dialog.ts +0 -255
- package/src/js/floatable/floatable.embedded.ts +0 -336
- package/src/js/floatable/floatable.standalone.ts +0 -6
- package/src/js/focus-trap/focus-trap.embedded.ts +0 -411
- package/src/js/focus-trap/focus-trap.standalone.ts +0 -1
- package/src/js/index.ts +0 -16
- package/src/js/internal/attributable.ts +0 -73
- package/src/js/internal/draggable.ts +0 -657
- package/src/js/internal/listbox/listbox.constants.ts +0 -25
- package/src/js/internal/listbox/listbox.data.ts +0 -287
- package/src/js/internal/listbox/listbox.dom.ts +0 -446
- package/src/js/internal/listbox/listbox.event.ts +0 -129
- package/src/js/internal/listbox/listbox.form.ts +0 -125
- package/src/js/internal/listbox/listbox.misc.ts +0 -135
- package/src/js/internal/listbox/listbox.model.ts +0 -169
- package/src/js/internal/listbox/listbox.state.ts +0 -82
- package/src/js/internal/misc.ts +0 -27
- package/src/js/internal/navigable.ts +0 -317
- package/src/js/l10n.ts +0 -192
- package/src/js/listbox/constants.listbox.ts +0 -61
- package/src/js/listbox/event.listbox.ts +0 -106
- package/src/js/listbox/index.ts +0 -364
- package/src/js/listbox/misc.listbox.ts +0 -70
- package/src/js/listbox/state.listbox.ts +0 -194
- package/src/js/menu.ts +0 -348
- package/src/js/movable/movable.embedded.ts +0 -318
- package/src/js/movable/movable.standalone.ts +0 -2
- package/src/js/popover.ts +0 -229
- package/src/js/resizable/resizable.embedded.ts +0 -413
- package/src/js/resizable/resizable.standalone.ts +0 -5
- package/src/js/sortable/sortable.embedded.ts +0 -527
- package/src/js/sortable/sortable.standalone.ts +0 -2
- package/src/js/splitter.ts +0 -583
- package/src/js/tabs.ts +0 -441
- package/src/js/toolbar.ts +0 -63
- package/src/js/tooltip.ts +0 -367
- /package/dist/js/combobox/{models.combobox.mjs → combobox.model.mjs} +0 -0
- /package/dist/js/{menu.d.mts → menu/index.d.mts} +0 -0
- /package/dist/js/{toolbar.d.mts → toolbar/index.d.mts} +0 -0
|
@@ -1,63 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as updateListboxValueLabel, c as createListboxContent, n as filterListbox, s as toggleListboxOption, t as applyListboxSelection, v as updateListboxMessage, x as generateListboxIds, y as updateListboxPreview } from "./listbox.data-C7CRa5Ya.mjs";
|
|
3
|
-
import { initializeListboxState } from "./internal/listbox/listbox.state.mjs";
|
|
1
|
+
import { createLocalizations, updateLocalizations } from "./l10n/index.mjs";
|
|
4
2
|
import { getBooleanAriaValue } from "./internal/misc.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { b as updateListboxValueLabel, c as createListboxContent, o as setListboxValues, v as updateListboxMessage, x as generateListboxIds } from "./listbox.data-BQyZGKgr.mjs";
|
|
4
|
+
import { initializeListboxState } from "./internal/listbox/listbox.state.mjs";
|
|
5
|
+
import { listboxAttributes, listboxMessages } from "./listbox/constants.listbox.mjs";
|
|
6
|
+
import { onListboxEnter, onListboxFilter, onListboxNavigation, onListboxToggle } from "./listbox/event.listbox.mjs";
|
|
7
7
|
import { setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
8
|
-
import { on } from "@oscarpalmer/toretto/event";
|
|
9
|
-
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
10
|
-
import { getData } from "@oscarpalmer/toretto/data";
|
|
11
8
|
import { noop } from "@oscarpalmer/atoms/function";
|
|
12
|
-
|
|
13
|
-
function onListboxClick(event) {
|
|
14
|
-
const listbox = findAncestor(event, LISTBOX_TAGNAME);
|
|
15
|
-
const state = listboxStates.map.get(listbox);
|
|
16
|
-
if (listbox == null || state == null) return;
|
|
17
|
-
const option = findAncestor(event, LISTBOX_SELECTORS.option);
|
|
18
|
-
if (option == null) return;
|
|
19
|
-
if (state.disabled) state.filter.element.focus();
|
|
20
|
-
else if (state.readonly) updateListboxPreview("none", state, option, false);
|
|
21
|
-
else toggleListboxOption(state, option);
|
|
22
|
-
}
|
|
23
|
-
function onListboxEnter(state) {
|
|
24
|
-
if (!state.disabled && !state.readonly) toggleListboxOption(state, state.active);
|
|
25
|
-
}
|
|
26
|
-
function onListboxFilter(preview, state, _, active) {
|
|
27
|
-
updateListboxPreview(preview, state, active);
|
|
28
|
-
}
|
|
29
|
-
function onListboxInput(event) {
|
|
30
|
-
const listbox = findAncestor(event, LISTBOX_TAGNAME);
|
|
31
|
-
const state = listboxStates.map.get(listbox);
|
|
32
|
-
if (state?.filter.element === event.target) filterListbox(event.inputType, state);
|
|
33
|
-
}
|
|
34
|
-
function onListboxKeydown(event) {
|
|
35
|
-
const listbox = findAncestor(event, LISTBOX_TAGNAME);
|
|
36
|
-
const state = listboxStates.map.get(listbox);
|
|
37
|
-
if (state?.filter.element === event.target) processListboxKeydown(event, state);
|
|
38
|
-
}
|
|
39
|
-
function onListboxNavigation(preview, state, active) {
|
|
40
|
-
if (state.multiple || state.readonly) updateListboxPreview(preview, state, active);
|
|
41
|
-
else applyListboxSelection({
|
|
42
|
-
state,
|
|
43
|
-
option: active,
|
|
44
|
-
added: true,
|
|
45
|
-
selected: active == null ? [] : [active]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function onListboxToggle(state) {
|
|
49
|
-
state.filter.element.focus();
|
|
50
|
-
}
|
|
51
|
-
on(document, "click", onListboxClick);
|
|
52
|
-
on(document, "input", onListboxInput);
|
|
53
|
-
on(document, "keydown", onListboxKeydown, { passive: false });
|
|
54
|
-
//#endregion
|
|
9
|
+
import { getData } from "@oscarpalmer/toretto/data";
|
|
55
10
|
//#region src/js/listbox/state.listbox.ts
|
|
56
|
-
function
|
|
11
|
+
function createComponentState(element, state) {
|
|
57
12
|
const select = element.querySelector("select");
|
|
58
|
-
if (select == null) throw new Error(
|
|
13
|
+
if (select == null) throw new Error(listboxMessages.select);
|
|
59
14
|
const label = element.querySelector(`label[for="${select.id}"]`);
|
|
60
|
-
if (label == null) throw new Error(
|
|
15
|
+
if (label == null) throw new Error(listboxMessages.label);
|
|
61
16
|
element.id = select.id;
|
|
62
17
|
const disabled = getBooleanAriaValue(element, "disabled") || select.disabled;
|
|
63
18
|
const multiple = element.multiple || select.multiple;
|
|
@@ -80,24 +35,22 @@ function createListboxState(element, internals) {
|
|
|
80
35
|
multiple,
|
|
81
36
|
select,
|
|
82
37
|
type,
|
|
83
|
-
attributes:
|
|
38
|
+
attributes: listboxAttributes,
|
|
84
39
|
autocomplete: listboxAutoComplete,
|
|
85
40
|
listbox: true
|
|
86
41
|
});
|
|
87
42
|
const { selected } = content.list.options;
|
|
88
43
|
const values = selected.length === 0 ? [""] : selected.map((option) => getData(option, "value", false) ?? "");
|
|
89
|
-
|
|
44
|
+
state.component = {
|
|
90
45
|
disabled,
|
|
91
46
|
id,
|
|
92
|
-
internals,
|
|
93
|
-
message: content.message,
|
|
94
47
|
multiple,
|
|
95
48
|
readonly,
|
|
96
49
|
required,
|
|
97
50
|
select,
|
|
98
51
|
type,
|
|
99
52
|
active: selected[0],
|
|
100
|
-
attributes:
|
|
53
|
+
attributes: listboxAttributes,
|
|
101
54
|
autocomplete: listboxAutoComplete,
|
|
102
55
|
callbacks: listboxCallbacks,
|
|
103
56
|
content: content.element,
|
|
@@ -118,6 +71,7 @@ function createListboxState(element, internals) {
|
|
|
118
71
|
component: {},
|
|
119
72
|
global: listboxLocalizations
|
|
120
73
|
},
|
|
74
|
+
message: content.message,
|
|
121
75
|
name: element.name,
|
|
122
76
|
options: content.list.options,
|
|
123
77
|
values: {
|
|
@@ -126,16 +80,23 @@ function createListboxState(element, internals) {
|
|
|
126
80
|
label: content.value
|
|
127
81
|
}
|
|
128
82
|
};
|
|
129
|
-
return initializeListboxState(state,
|
|
83
|
+
return initializeListboxState(state, listboxes, onAttachListbox);
|
|
84
|
+
}
|
|
85
|
+
function initializeListbox(element, state) {
|
|
86
|
+
createComponentState(element, state);
|
|
87
|
+
if (state.form.restored != null) {
|
|
88
|
+
setListboxValues(state, state.form.restored);
|
|
89
|
+
state.form.restored = void 0;
|
|
90
|
+
}
|
|
130
91
|
}
|
|
131
92
|
function onAttachListbox(state) {
|
|
132
|
-
const { content, select } = state;
|
|
93
|
+
const { content, select } = state.component;
|
|
133
94
|
select.hidden = true;
|
|
134
95
|
select.insertAdjacentElement("afterend", content);
|
|
135
96
|
select.remove();
|
|
136
97
|
}
|
|
137
98
|
function onDetachListbox(state) {
|
|
138
|
-
const { content, select } = state;
|
|
99
|
+
const { content, select } = state.component;
|
|
139
100
|
content.insertAdjacentElement("beforebegin", select);
|
|
140
101
|
content.remove();
|
|
141
102
|
select.hidden = false;
|
|
@@ -160,7 +121,7 @@ const listboxCallbacks = {
|
|
|
160
121
|
onToggle: onListboxToggle
|
|
161
122
|
}
|
|
162
123
|
};
|
|
163
|
-
const listboxLocalizations =
|
|
124
|
+
const listboxLocalizations = createLocalizations({
|
|
164
125
|
empty: "No results found",
|
|
165
126
|
input: "",
|
|
166
127
|
invalid: "Please select an option from the list",
|
|
@@ -170,10 +131,7 @@ const listboxLocalizations = getLocalizations({
|
|
|
170
131
|
results: (amount) => `${amount} results available`,
|
|
171
132
|
selected: (amount) => `${amount} selected`
|
|
172
133
|
});
|
|
173
|
-
const
|
|
174
|
-
map: /* @__PURE__ */ new WeakMap(),
|
|
175
|
-
set: /* @__PURE__ */ new Set()
|
|
176
|
-
};
|
|
134
|
+
const listboxes = /* @__PURE__ */ new Set();
|
|
177
135
|
//#endregion
|
|
178
136
|
//#region src/js/listbox/misc.listbox.ts
|
|
179
137
|
function getListboxId() {
|
|
@@ -185,7 +143,7 @@ function setListboxLocalizations(first, second) {
|
|
|
185
143
|
}
|
|
186
144
|
function updateListboxLocalizations(instance, destination, first, second) {
|
|
187
145
|
updateLocalizations(instance, typeof first === "string" ? { [first]: second } : first, destination, () => {
|
|
188
|
-
for (const state of
|
|
146
|
+
for (const state of listboxes) {
|
|
189
147
|
updateListboxMessage(state);
|
|
190
148
|
updateListboxValueLabel(state);
|
|
191
149
|
}
|
|
@@ -193,4 +151,4 @@ function updateListboxLocalizations(instance, destination, first, second) {
|
|
|
193
151
|
}
|
|
194
152
|
let index = 0;
|
|
195
153
|
//#endregion
|
|
196
|
-
export { listboxLocalizations as a, onDetachListbox as c,
|
|
154
|
+
export { listboxLocalizations as a, onDetachListbox as c, initializeListbox as i, setListboxLocalizations as n, listboxes as o, updateListboxLocalizations as r, onAttachListbox as s, getListboxId as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as OuiListboxLocalizations } from "./listbox.model-
|
|
1
|
+
import { c as OuiLocalizations } from "./l10n.model-D6a9frgl.mjs";
|
|
2
|
+
import { o as OuiListboxLocalizations } from "./listbox.model-CuBOj4qe.mjs";
|
|
3
3
|
//#region src/js/listbox/misc.listbox.d.ts
|
|
4
4
|
declare function getListboxId(): string;
|
|
5
5
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { t as createMovable } from "../movable.embedded-DoyXLegc.mjs";
|
|
2
|
+
export { createMovable };
|
|
@@ -1,62 +1,53 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { DRAGGABLE_SYMBOL } from "../internal/draggable/draggable.model.mjs";
|
|
3
|
+
import { MOVABLE_ATTRIBUTE, MOVABLE_ATTRIBUTE_CONTAINER, MOVABLE_ATTRIBUTE_DIRECTION, MOVABLE_ATTRIBUTE_MOVING, MOVABLE_CONTAINERS, MOVABLE_MESSAGE, MOVABLE_MOVED, MOVABLE_SELECTOR_HANDLE } from "./movable.model.mjs";
|
|
4
|
+
import { addDraggable, destroyDraggable, getDraggableElement, getDraggableStates, initializeDraggable, removeDraggable } from "../internal/draggable/index.mjs";
|
|
3
5
|
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
6
|
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
5
|
-
import { getStyles, setStyle, setStyles } from "@oscarpalmer/toretto/style";
|
|
6
7
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
8
|
+
import { getStyles, setStyle, setStyles } from "@oscarpalmer/toretto/style";
|
|
7
9
|
//#region src/js/movable/movable.embedded.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Destroys the _Movable_
|
|
51
|
-
*/
|
|
52
|
-
destroy() {
|
|
53
|
-
MOVED.delete(this);
|
|
54
|
-
setStyles(this.#element, this.#style);
|
|
55
|
-
this.#element = void 0;
|
|
56
|
-
this.#style = void 0;
|
|
57
|
-
super.destroy();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
10
|
+
function OuiMovable(element, options) {
|
|
11
|
+
const style = getStyles(element, ["inset", "position"]);
|
|
12
|
+
this[DRAGGABLE_SYMBOL] = initializeDraggable(this, "movable", "move", MOVABLE_ATTRIBUTE, element, {
|
|
13
|
+
container: {
|
|
14
|
+
attribute: MOVABLE_ATTRIBUTE_CONTAINER,
|
|
15
|
+
map: MOVABLE_CONTAINERS,
|
|
16
|
+
onDestroy: destroyContainer,
|
|
17
|
+
onInitialize: initializeContainer
|
|
18
|
+
},
|
|
19
|
+
direction: {
|
|
20
|
+
attribute: MOVABLE_ATTRIBUTE_DIRECTION,
|
|
21
|
+
onAfter: afterDirection
|
|
22
|
+
},
|
|
23
|
+
drag: {
|
|
24
|
+
onBegin,
|
|
25
|
+
onCancel,
|
|
26
|
+
onEnd,
|
|
27
|
+
onMove
|
|
28
|
+
},
|
|
29
|
+
input: options,
|
|
30
|
+
position: {
|
|
31
|
+
getOffset: getOffsetPosition,
|
|
32
|
+
getOriginal: getOriginalPosition
|
|
33
|
+
},
|
|
34
|
+
getDragged() {
|
|
35
|
+
return element;
|
|
36
|
+
},
|
|
37
|
+
getOrigin() {
|
|
38
|
+
return element;
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
style,
|
|
42
|
+
hasHandles: element.querySelector(MOVABLE_SELECTOR_HANDLE) != null,
|
|
43
|
+
moved: false
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
OuiMovable.prototype.destroy = destroyMovable;
|
|
47
|
+
Object.defineProperties(OuiMovable.prototype, { element: {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: getDraggableElement
|
|
50
|
+
} });
|
|
60
51
|
function afterDirection(item) {
|
|
61
52
|
const container = item.state.container?.getBoundingClientRect();
|
|
62
53
|
if (container != null) setOffset(item.state, container);
|
|
@@ -68,12 +59,18 @@ function afterDirection(item) {
|
|
|
68
59
|
* @returns _OuiMovable_ instance
|
|
69
60
|
*/
|
|
70
61
|
function createMovable(element, options) {
|
|
71
|
-
if (!isHTMLOrSVGElement(element)) throw new TypeError(
|
|
62
|
+
if (!isHTMLOrSVGElement(element)) throw new TypeError(MOVABLE_MESSAGE);
|
|
72
63
|
return addMovable(element, options);
|
|
73
64
|
}
|
|
74
65
|
function destroyContainer(_, container, empty) {
|
|
75
66
|
if (empty) resizer.unobserve(container);
|
|
76
67
|
}
|
|
68
|
+
function destroyMovable() {
|
|
69
|
+
const { element, style } = this[DRAGGABLE_SYMBOL];
|
|
70
|
+
MOVABLE_MOVED.delete(this);
|
|
71
|
+
setStyles(element, style);
|
|
72
|
+
destroyDraggable(this);
|
|
73
|
+
}
|
|
77
74
|
function getOffsetPosition(globals, _, __, position) {
|
|
78
75
|
return {
|
|
79
76
|
x: position.x - (globals.element?.rectangle.left ?? 0),
|
|
@@ -98,15 +95,15 @@ function onCancel(globals, item) {
|
|
|
98
95
|
};
|
|
99
96
|
if (moved) setStyle(element, "inset", `${y}px auto auto ${x}px`);
|
|
100
97
|
else setStyles(element, style);
|
|
101
|
-
element.removeAttribute(
|
|
98
|
+
element.removeAttribute(MOVABLE_ATTRIBUTE_MOVING);
|
|
102
99
|
}
|
|
103
100
|
function onEnd(event, globals, item, reset) {
|
|
104
101
|
const movable = item.instance;
|
|
105
102
|
const state = item.state;
|
|
106
|
-
state.element.removeAttribute(
|
|
103
|
+
state.element.removeAttribute(MOVABLE_ATTRIBUTE_MOVING);
|
|
107
104
|
if (!state.moved) {
|
|
108
105
|
state.moved = true;
|
|
109
|
-
if (state.container != null)
|
|
106
|
+
if (state.container != null) MOVABLE_MOVED.add(movable);
|
|
110
107
|
}
|
|
111
108
|
const container = state.container?.getBoundingClientRect();
|
|
112
109
|
if (container != null) setOffset(state, container);
|
|
@@ -117,7 +114,7 @@ function onEnd(event, globals, item, reset) {
|
|
|
117
114
|
reset();
|
|
118
115
|
}
|
|
119
116
|
function onMove(_, globals, __, position) {
|
|
120
|
-
setAttribute(globals.element?.node,
|
|
117
|
+
setAttribute(globals.element?.node, MOVABLE_ATTRIBUTE_MOVING, "");
|
|
121
118
|
return {
|
|
122
119
|
from: { ...globals.original },
|
|
123
120
|
to: { ...position.calculated }
|
|
@@ -127,13 +124,13 @@ function onResize(entries) {
|
|
|
127
124
|
const { length } = entries;
|
|
128
125
|
for (let index = 0; index < length; index += 1) {
|
|
129
126
|
const entry = entries[index];
|
|
130
|
-
const set =
|
|
127
|
+
const set = MOVABLE_CONTAINERS.get(entry.target);
|
|
131
128
|
if (set == null) continue;
|
|
132
129
|
for (const movable of set) reposition(movable);
|
|
133
130
|
}
|
|
134
131
|
}
|
|
135
132
|
function onScroll() {
|
|
136
|
-
for (const moved of
|
|
133
|
+
for (const moved of MOVABLE_MOVED) reposition(moved);
|
|
137
134
|
}
|
|
138
135
|
function reposition(movable) {
|
|
139
136
|
const state = getDraggableStates(movable.element)?.movable;
|
|
@@ -149,15 +146,6 @@ function setOffset(state, container) {
|
|
|
149
146
|
state.offset.y = element.top - container.top;
|
|
150
147
|
state.offset.x = element.left - container.left;
|
|
151
148
|
}
|
|
152
|
-
const ATTRIBUTE_MOVABLE = "oui-movable";
|
|
153
|
-
const ATTRIBUTE_CONTAINER = `${ATTRIBUTE_MOVABLE}-container`;
|
|
154
|
-
const ATTRIBUTE_DIRECTION = `${ATTRIBUTE_MOVABLE}-direction`;
|
|
155
|
-
const ATTRIBUTE_MOVABLE_HANDLE = `${ATTRIBUTE_MOVABLE}-handle`;
|
|
156
|
-
const ATTRIBUTE_MOVING = `${ATTRIBUTE_MOVABLE}-moving`;
|
|
157
|
-
const CONTAINERS = /* @__PURE__ */ new Map();
|
|
158
|
-
const MESSAGE = "The element must be an instance of HTMLElement or SVGElement";
|
|
159
|
-
const MOVED = /* @__PURE__ */ new Set();
|
|
160
|
-
const SELECTOR_HANDLE = `[${ATTRIBUTE_MOVABLE_HANDLE}]`;
|
|
161
149
|
const bound = {
|
|
162
150
|
constructor: OuiMovable,
|
|
163
151
|
property: "movable"
|
|
@@ -166,6 +154,6 @@ const resizer = new ResizeObserver(onResize);
|
|
|
166
154
|
const addMovable = addDraggable.bind(bound);
|
|
167
155
|
const removeMovable = removeDraggable.bind(bound);
|
|
168
156
|
on(document, "scroll", onScroll);
|
|
169
|
-
attributable(
|
|
157
|
+
attributable(MOVABLE_ATTRIBUTE, addMovable, removeMovable);
|
|
170
158
|
//#endregion
|
|
171
|
-
export {
|
|
159
|
+
export { createMovable };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as MOVABLE_ATTRIBUTE_MOVING, c as MOVABLE_MOVED, d as OuiMovableState, f as OuiMovableStyle, i as MOVABLE_ATTRIBUTE_HANDLE, l as MOVABLE_SELECTOR_HANDLE, n as MOVABLE_ATTRIBUTE_CONTAINER, o as MOVABLE_CONTAINERS, r as MOVABLE_ATTRIBUTE_DIRECTION, s as MOVABLE_MESSAGE, t as MOVABLE_ATTRIBUTE, u as OuiMovable } from "../movable.model-BHaK_mKw.mjs";
|
|
2
|
+
export { MOVABLE_ATTRIBUTE, MOVABLE_ATTRIBUTE_CONTAINER, MOVABLE_ATTRIBUTE_DIRECTION, MOVABLE_ATTRIBUTE_HANDLE, MOVABLE_ATTRIBUTE_MOVING, MOVABLE_CONTAINERS, MOVABLE_MESSAGE, MOVABLE_MOVED, MOVABLE_SELECTOR_HANDLE, OuiMovable, OuiMovableState, OuiMovableStyle };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/js/movable/movable.model.ts
|
|
2
|
+
const MOVABLE_ATTRIBUTE = "oui-movable";
|
|
3
|
+
const MOVABLE_ATTRIBUTE_CONTAINER = `${MOVABLE_ATTRIBUTE}-container`;
|
|
4
|
+
const MOVABLE_ATTRIBUTE_DIRECTION = `${MOVABLE_ATTRIBUTE}-direction`;
|
|
5
|
+
const MOVABLE_ATTRIBUTE_HANDLE = `${MOVABLE_ATTRIBUTE}-handle`;
|
|
6
|
+
const MOVABLE_ATTRIBUTE_MOVING = `${MOVABLE_ATTRIBUTE}-moving`;
|
|
7
|
+
const MOVABLE_CONTAINERS = /* @__PURE__ */ new Map();
|
|
8
|
+
const MOVABLE_MESSAGE = "The element must be an instance of HTMLElement or SVGElement";
|
|
9
|
+
const MOVABLE_MOVED = /* @__PURE__ */ new Set();
|
|
10
|
+
const MOVABLE_SELECTOR_HANDLE = `[${MOVABLE_ATTRIBUTE_HANDLE}]`;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { MOVABLE_ATTRIBUTE, MOVABLE_ATTRIBUTE_CONTAINER, MOVABLE_ATTRIBUTE_DIRECTION, MOVABLE_ATTRIBUTE_HANDLE, MOVABLE_ATTRIBUTE_MOVING, MOVABLE_CONTAINERS, MOVABLE_MESSAGE, MOVABLE_MOVED, MOVABLE_SELECTOR_HANDLE };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as CreateOuiDraggableOptions, u as OuiMovable } from "../movable.model-BHaK_mKw.mjs";
|
|
2
|
+
import { t as createMovable } from "../movable.embedded-DoyXLegc.mjs";
|
|
2
3
|
export { type CreateOuiDraggableOptions as CreateOuiMovableOptions, type OuiMovable, createMovable };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { p as CreateOuiDraggableOptions, u as OuiMovable } from "./movable.model-BHaK_mKw.mjs";
|
|
2
|
+
//#region src/js/movable/movable.embedded.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Creates _(or retrieves)_ a _OuiMovable_ instance for an element
|
|
5
|
+
*
|
|
6
|
+
* @param element Element to make movable
|
|
7
|
+
* @returns _OuiMovable_ instance
|
|
8
|
+
*/
|
|
9
|
+
declare function createMovable(element: HTMLElement, options?: CreateOuiDraggableOptions): OuiMovable;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createMovable as t };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { StyleToggler } from "@oscarpalmer/toretto/style";
|
|
2
|
+
import { PlainObject } from "@oscarpalmer/atoms/models";
|
|
3
|
+
import { EventPosition } from "@oscarpalmer/toretto/models";
|
|
4
|
+
//#region src/js/sortable/sortable.model.d.ts
|
|
5
|
+
type OuiSortable = {
|
|
6
|
+
destroy(): void;
|
|
7
|
+
} & OuiDraggable<OuiSortableState>;
|
|
8
|
+
type OuiSortablePlaceholder = {
|
|
9
|
+
drag: OuiSortablePlaceholderDrag;
|
|
10
|
+
position: HTMLElement | undefined;
|
|
11
|
+
};
|
|
12
|
+
type OuiSortablePlaceholderDrag = {
|
|
13
|
+
custom: HTMLElement | undefined;
|
|
14
|
+
default: HTMLElement | undefined;
|
|
15
|
+
};
|
|
16
|
+
type OuiSortableState = {
|
|
17
|
+
connections: string | null | undefined;
|
|
18
|
+
origin?: HTMLElement;
|
|
19
|
+
};
|
|
20
|
+
declare const SORTABLE_ATTRIBUTE = "oui-sortable";
|
|
21
|
+
declare const SORTABLE_ATTRIBUTE_ACTIVE: string;
|
|
22
|
+
declare const SORTABLE_ATTRIBUTE_CONNECTIONS: string;
|
|
23
|
+
declare const SORTABLE_ATTRIBUTE_CONTAINER: string;
|
|
24
|
+
declare const SORTABLE_ATTRIBUTE_DIRECTION: string;
|
|
25
|
+
declare const SORTABLE_ATTRIBUTE_HORIZONTAL: string;
|
|
26
|
+
declare const SORTABLE_ATTRIBUTE_ORIGIN: string;
|
|
27
|
+
declare const SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG: string;
|
|
28
|
+
declare const SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION: string;
|
|
29
|
+
declare const SORTABLE_ATTRIBUTE_VERTICAL: string;
|
|
30
|
+
declare const SORTABLE_CONTAINERS: Map<HTMLElement, Set<OuiSortable>>;
|
|
31
|
+
declare const SORTABLE_MESSAGE = "The element must be an instance of HTMLElement or SVGElement";
|
|
32
|
+
declare const SORTABLE_SELECTOR: string;
|
|
33
|
+
declare const SORTABLE_SELECTOR_ITEM: string;
|
|
34
|
+
declare const sortablePlaceholder: OuiSortablePlaceholder;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/js/internal/draggable/draggable.model.d.ts
|
|
37
|
+
type CreateOuiDraggableOptions = {
|
|
38
|
+
/**
|
|
39
|
+
* Container to hold the draggable element and restrict its movement within. Can be `body`, `document`, `window`, a _CSS_ selector, or an element. _(If not provided, the draggable element will not have any constraints)_
|
|
40
|
+
*/
|
|
41
|
+
container?: string | HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* Direction in which the element can be dragged. _(If not provided, the element can be dragged in any direction)_
|
|
44
|
+
*/
|
|
45
|
+
direction?: OuiDraggableDirection;
|
|
46
|
+
};
|
|
47
|
+
type OuiDraggableDirection = "horizontal" | "vertical" | "x" | "y";
|
|
48
|
+
interface OuiDraggable<ExtraState extends PlainObject = PlainObject> {
|
|
49
|
+
[DRAGGABLE_SYMBOL]: OuiDraggableState & ExtraState;
|
|
50
|
+
get element(): HTMLElement;
|
|
51
|
+
destroy(): void;
|
|
52
|
+
}
|
|
53
|
+
type OuiDragBegin<State extends PlainObject = PlainObject> = (event: MouseEvent | TouchEvent, globals: OuiDraggableGlobals, item: OuiDraggableItem<State>, element: HTMLElement, handle: HTMLElement, position: EventPosition) => void;
|
|
54
|
+
type OuiDragCancel<State extends PlainObject = PlainObject> = (globals: OuiDraggableGlobals, item: OuiDraggableItem<State>) => void;
|
|
55
|
+
type OuiDragEnd<State extends PlainObject = PlainObject> = (event: MouseEvent | TouchEvent, globals: OuiDraggableGlobals, item: OuiDraggableItem<State>, reset: () => void) => void;
|
|
56
|
+
type OuiDragMove<State extends PlainObject = PlainObject> = (event: MouseEvent | TouchEvent, globals: OuiDraggableGlobals, item: OuiDraggableItem<State>, position: OuiDragMovePosition) => PlainObject | undefined;
|
|
57
|
+
type OuiDragMovePosition = {
|
|
58
|
+
calculated: EventPosition;
|
|
59
|
+
original: EventPosition;
|
|
60
|
+
};
|
|
61
|
+
type OuiDraggableBound<Property extends keyof OuiDraggableInstances = keyof OuiDraggableInstances, Instance extends OuiDraggableInstances[Property] = OuiDraggableInstances[Property]> = {
|
|
62
|
+
constructor: new (element: HTMLElement, options?: CreateOuiDraggableOptions) => Instance;
|
|
63
|
+
property: Property;
|
|
64
|
+
};
|
|
65
|
+
type OuiDraggableGlobals = {
|
|
66
|
+
container?: DOMRect;
|
|
67
|
+
element?: OuiDraggableGlobalsElement;
|
|
68
|
+
instances: WeakMap<HTMLElement, OuiDraggableInstances>;
|
|
69
|
+
offset?: EventPosition;
|
|
70
|
+
original?: EventPosition;
|
|
71
|
+
states: WeakMap<HTMLElement, OuiDraggableStates>;
|
|
72
|
+
};
|
|
73
|
+
type OuiDraggableGlobalsElement = {
|
|
74
|
+
node: HTMLElement;
|
|
75
|
+
rectangle: DOMRect;
|
|
76
|
+
};
|
|
77
|
+
type OuiDraggableInstances = {
|
|
78
|
+
movable?: OuiMovable;
|
|
79
|
+
sortable?: OuiSortable;
|
|
80
|
+
};
|
|
81
|
+
type OuiDraggableItem<ExtraState extends PlainObject = PlainObject> = {
|
|
82
|
+
instance: OuiDraggable<ExtraState>;
|
|
83
|
+
state: OuiDraggableState & ExtraState;
|
|
84
|
+
};
|
|
85
|
+
type OuiDraggableOptions<ExtraState extends PlainObject = PlainObject> = {
|
|
86
|
+
container: OuiDraggableOptionsContainer<ExtraState>;
|
|
87
|
+
direction: OuiDraggableOptionsDirection<ExtraState>;
|
|
88
|
+
drag: OuiDraggableOptionsDrag<ExtraState>;
|
|
89
|
+
input?: CreateOuiDraggableOptions;
|
|
90
|
+
position: OuiDraggableOptionsPosition<ExtraState>;
|
|
91
|
+
getDragged(): HTMLElement;
|
|
92
|
+
getOrigin(): HTMLElement | undefined;
|
|
93
|
+
};
|
|
94
|
+
type OuiDraggableOptionsContainer<ExtraState extends PlainObject = PlainObject> = {
|
|
95
|
+
attribute: string;
|
|
96
|
+
map: Map<HTMLElement, Set<OuiDraggable>>;
|
|
97
|
+
onDestroy?: OuiDraggableOptionsContainerOnDestroy<ExtraState>;
|
|
98
|
+
onInitialize?: OuiDraggableOptionsContainerOnInitialize;
|
|
99
|
+
};
|
|
100
|
+
type OuiDraggableOptionsContainerOnDestroy<ExtraState extends PlainObject = PlainObject> = (item: OuiDraggableItem<ExtraState>, container: HTMLElement, empty: boolean) => void;
|
|
101
|
+
type OuiDraggableOptionsContainerOnInitialize<ExtraState extends PlainObject = PlainObject> = (item: OuiDraggableItem<ExtraState>) => void;
|
|
102
|
+
type OuiDraggableOptionsDirection<ExtraState extends PlainObject = PlainObject> = {
|
|
103
|
+
attribute: string;
|
|
104
|
+
onAfter?: OuiDraggableOptionsDirectionOnAfter<ExtraState>;
|
|
105
|
+
};
|
|
106
|
+
type OuiDraggableOptionsDirectionOnAfter<ExtraState extends PlainObject = PlainObject> = (item: OuiDraggableItem<ExtraState>) => void;
|
|
107
|
+
type OuiDraggableOptionsDrag<ExtraState extends PlainObject = PlainObject> = {
|
|
108
|
+
onBegin: OuiDragBegin<ExtraState>;
|
|
109
|
+
onCancel: OuiDragCancel<ExtraState>;
|
|
110
|
+
onEnd: OuiDragEnd<ExtraState>;
|
|
111
|
+
onMove: OuiDragMove<ExtraState>;
|
|
112
|
+
};
|
|
113
|
+
type OuiDraggableOptionsPosition<ExtraState extends PlainObject = PlainObject> = {
|
|
114
|
+
getOffset: OuiDraggableOptionsPositionGetOffset<ExtraState>;
|
|
115
|
+
getOriginal: OuiDraggableOptionsPositionGetOriginal<ExtraState>;
|
|
116
|
+
};
|
|
117
|
+
type OuiDraggableOptionsPositionGetOffset<ExtraState extends PlainObject = PlainObject> = (globals: OuiDraggableGlobals, item: OuiDraggableItem<ExtraState>, element: HTMLElement, position: EventPosition) => EventPosition;
|
|
118
|
+
type OuiDraggableOptionsPositionGetOriginal<ExtraState extends PlainObject = PlainObject> = (globals: OuiDraggableGlobals, item: OuiDraggableItem<ExtraState>, position: EventPosition) => EventPosition;
|
|
119
|
+
type OuiDraggableState = {
|
|
120
|
+
attribute: string;
|
|
121
|
+
container?: HTMLElement;
|
|
122
|
+
destroyed: boolean;
|
|
123
|
+
element: HTMLElement;
|
|
124
|
+
hasHandles?: boolean;
|
|
125
|
+
horizontal: boolean;
|
|
126
|
+
name: keyof OuiDraggableStates;
|
|
127
|
+
options: OuiDraggableOptions;
|
|
128
|
+
styling: StyleToggler;
|
|
129
|
+
vertical: boolean;
|
|
130
|
+
};
|
|
131
|
+
type OuiDraggableStates = {
|
|
132
|
+
movable?: OuiDraggableState;
|
|
133
|
+
sortable?: OuiDraggableState;
|
|
134
|
+
};
|
|
135
|
+
declare const DRAGGABLE_ATTRIBUTE_MOVABLE = "oui-movable";
|
|
136
|
+
declare const DRAGGABLE_ATTRIBUTE_SORTABLE = "oui-sortable";
|
|
137
|
+
declare const DRAGGABLE_KEY_ESCAPE = "Escape";
|
|
138
|
+
declare const DRAGGABLE_SELECTOR: string;
|
|
139
|
+
declare const DRAGGABLE_SELECTOR_MOVABLE_HANDLE: string;
|
|
140
|
+
declare const DRAGGABLE_SELECTOR_SORTABLE_HANDLE: string;
|
|
141
|
+
declare const DRAGGABLE_SELECTOR_SORTABLE_ITEM: string;
|
|
142
|
+
declare const DRAGGABLE_SYMBOL: unique symbol;
|
|
143
|
+
declare const draggableContainers: Set<string>;
|
|
144
|
+
declare const draggableHorizontals: Set<OuiDraggableDirection>;
|
|
145
|
+
declare const draggableProperties: Record<keyof OuiDraggableInstances, keyof OuiDraggableInstances>;
|
|
146
|
+
declare const draggableGlobals: OuiDraggableGlobals;
|
|
147
|
+
declare const draggableStyles: {
|
|
148
|
+
touchAction: string;
|
|
149
|
+
userSelect: string;
|
|
150
|
+
webkitUserSelect: string;
|
|
151
|
+
};
|
|
152
|
+
declare const draggableStyleToggler: StyleToggler;
|
|
153
|
+
declare const draggableVerticals: Set<OuiDraggableDirection>;
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/js/movable/movable.model.d.ts
|
|
156
|
+
type OuiMovable = {
|
|
157
|
+
/**
|
|
158
|
+
* The movable element
|
|
159
|
+
*/
|
|
160
|
+
get element(): HTMLElement;
|
|
161
|
+
/**
|
|
162
|
+
* Destroy the movable
|
|
163
|
+
*/
|
|
164
|
+
destroy(): void;
|
|
165
|
+
} & OuiDraggable<OuiMovableState>;
|
|
166
|
+
type OuiMovableState = {
|
|
167
|
+
hasHandles?: boolean;
|
|
168
|
+
moved: boolean;
|
|
169
|
+
offset?: Partial<EventPosition>;
|
|
170
|
+
style: OuiMovableStyle;
|
|
171
|
+
};
|
|
172
|
+
type OuiMovableStyle = {
|
|
173
|
+
inset?: string;
|
|
174
|
+
position?: string;
|
|
175
|
+
};
|
|
176
|
+
declare const MOVABLE_ATTRIBUTE = "oui-movable";
|
|
177
|
+
declare const MOVABLE_ATTRIBUTE_CONTAINER: string;
|
|
178
|
+
declare const MOVABLE_ATTRIBUTE_DIRECTION: string;
|
|
179
|
+
declare const MOVABLE_ATTRIBUTE_HANDLE: string;
|
|
180
|
+
declare const MOVABLE_ATTRIBUTE_MOVING: string;
|
|
181
|
+
declare const MOVABLE_CONTAINERS: Map<HTMLElement, Set<OuiMovable>>;
|
|
182
|
+
declare const MOVABLE_MESSAGE = "The element must be an instance of HTMLElement or SVGElement";
|
|
183
|
+
declare const MOVABLE_MOVED: Set<OuiMovable>;
|
|
184
|
+
declare const MOVABLE_SELECTOR_HANDLE: string;
|
|
185
|
+
//#endregion
|
|
186
|
+
export { OuiSortable as $, OuiDraggableGlobals as A, OuiDraggableOptionsDrag as B, OuiDragCancel as C, OuiDraggable as D, OuiDragMovePosition as E, OuiDraggableOptionsContainer as F, OuiDraggableStates as G, OuiDraggableOptionsPositionGetOffset as H, OuiDraggableOptionsContainerOnDestroy as I, draggableHorizontals as J, draggableContainers as K, OuiDraggableOptionsContainerOnInitialize as L, OuiDraggableInstances as M, OuiDraggableItem as N, OuiDraggableBound as O, OuiDraggableOptions as P, draggableVerticals as Q, OuiDraggableOptionsDirection as R, OuiDragBegin as S, OuiDragMove as T, OuiDraggableOptionsPositionGetOriginal as U, OuiDraggableOptionsPosition as V, OuiDraggableState as W, draggableStyleToggler as X, draggableProperties as Y, draggableStyles as Z, DRAGGABLE_SELECTOR as _, sortablePlaceholder as _t, MOVABLE_ATTRIBUTE_MOVING as a, SORTABLE_ATTRIBUTE_CONNECTIONS as at, DRAGGABLE_SELECTOR_SORTABLE_ITEM as b, MOVABLE_MOVED as c, SORTABLE_ATTRIBUTE_HORIZONTAL as ct, OuiMovableState as d, SORTABLE_ATTRIBUTE_PLACEHOLDER_POSITION as dt, OuiSortablePlaceholder as et, OuiMovableStyle as f, SORTABLE_ATTRIBUTE_VERTICAL as ft, DRAGGABLE_KEY_ESCAPE as g, SORTABLE_SELECTOR_ITEM as gt, DRAGGABLE_ATTRIBUTE_SORTABLE as h, SORTABLE_SELECTOR as ht, MOVABLE_ATTRIBUTE_HANDLE as i, SORTABLE_ATTRIBUTE_ACTIVE as it, OuiDraggableGlobalsElement as j, OuiDraggableDirection as k, MOVABLE_SELECTOR_HANDLE as l, SORTABLE_ATTRIBUTE_ORIGIN as lt, DRAGGABLE_ATTRIBUTE_MOVABLE as m, SORTABLE_MESSAGE as mt, MOVABLE_ATTRIBUTE_CONTAINER as n, OuiSortableState as nt, MOVABLE_CONTAINERS as o, SORTABLE_ATTRIBUTE_CONTAINER as ot, CreateOuiDraggableOptions as p, SORTABLE_CONTAINERS as pt, draggableGlobals as q, MOVABLE_ATTRIBUTE_DIRECTION as r, SORTABLE_ATTRIBUTE as rt, MOVABLE_MESSAGE as s, SORTABLE_ATTRIBUTE_DIRECTION as st, MOVABLE_ATTRIBUTE as t, OuiSortablePlaceholderDrag as tt, OuiMovable as u, SORTABLE_ATTRIBUTE_PLACEHOLDER_DRAG as ut, DRAGGABLE_SELECTOR_MOVABLE_HANDLE as v, OuiDragEnd as w, DRAGGABLE_SYMBOL as x, DRAGGABLE_SELECTOR_SORTABLE_HANDLE as y, OuiDraggableOptionsDirectionOnAfter as z };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AriaRole, RemovableEventListener } from "@oscarpalmer/toretto/models";
|
|
2
|
+
//#region src/js/internal/navigable/navigable.model.d.ts
|
|
3
|
+
type OuiNavigable = {
|
|
4
|
+
[NAVIGABLE_SYMBOL]: OuiNavigableState;
|
|
5
|
+
destroy(): void;
|
|
6
|
+
navigate(index: number, focus?: boolean): void;
|
|
7
|
+
};
|
|
8
|
+
type OuiNavigableActive = {
|
|
9
|
+
element?: HTMLElement;
|
|
10
|
+
index: number;
|
|
11
|
+
};
|
|
12
|
+
type OuiNavigableCallback<ReturnType> = (event: KeyboardEvent, navigable: OuiNavigable) => ReturnType;
|
|
13
|
+
type OuiNavigableOptions = {
|
|
14
|
+
orientation?: OuiNavigableOrientation;
|
|
15
|
+
role?: AriaRole;
|
|
16
|
+
selector: string;
|
|
17
|
+
vertical: boolean;
|
|
18
|
+
onActivate?: (navigable: OuiNavigable) => void;
|
|
19
|
+
onDeactivate?: OuiNavigableCallback<void>;
|
|
20
|
+
onNavigation?: (navigable: OuiNavigable) => void;
|
|
21
|
+
onPreventNavigation?: OuiNavigableCallback<boolean>;
|
|
22
|
+
onShouldActivate?: OuiNavigableCallback<boolean>;
|
|
23
|
+
onShouldDeactivate?: OuiNavigableCallback<boolean | undefined>;
|
|
24
|
+
};
|
|
25
|
+
type OuiNavigableOrientation = "horizontal" | "vertical";
|
|
26
|
+
type OuiNavigableState = {
|
|
27
|
+
active: OuiNavigableActive;
|
|
28
|
+
element: HTMLElement;
|
|
29
|
+
listeners: RemovableEventListener[];
|
|
30
|
+
options: OuiNavigableOptions;
|
|
31
|
+
orientation: OuiNavigableOrientation;
|
|
32
|
+
};
|
|
33
|
+
declare const NAVIGABLE_KEYS_ABSOLUTE: Set<string>;
|
|
34
|
+
declare const NAVIGABLE_KEYS_ACTIVATE: Set<string>;
|
|
35
|
+
declare const NAVIGABLE_KEYS_HORIZONTAL: Set<string>;
|
|
36
|
+
declare const NAVIGABLE_KEYS_VERTICAL: Set<string>;
|
|
37
|
+
declare const NAVIGABLE_KEYS_ALL: Set<string>;
|
|
38
|
+
declare const NAVIGABLE_KEYS_NEXT: Set<string>;
|
|
39
|
+
declare const NAVIGABLE_ORIENTATION_HORIZONTAL: OuiNavigableOrientation;
|
|
40
|
+
declare const NAVIGABLE_ORIENTATION_VERTICAL: OuiNavigableOrientation;
|
|
41
|
+
declare const NAVIGABLE_ORIENTATIONS: Set<OuiNavigableOrientation>;
|
|
42
|
+
declare const NAVIGABLE_SYMBOL: unique symbol;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { NAVIGABLE_KEYS_NEXT as a, NAVIGABLE_ORIENTATION_HORIZONTAL as c, OuiNavigable as d, OuiNavigableActive as f, OuiNavigableState as g, OuiNavigableOrientation as h, NAVIGABLE_KEYS_HORIZONTAL as i, NAVIGABLE_ORIENTATION_VERTICAL as l, OuiNavigableOptions as m, NAVIGABLE_KEYS_ACTIVATE as n, NAVIGABLE_KEYS_VERTICAL as o, OuiNavigableCallback as p, NAVIGABLE_KEYS_ALL as r, NAVIGABLE_ORIENTATIONS as s, NAVIGABLE_KEYS_ABSOLUTE as t, NAVIGABLE_SYMBOL as u };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { n as OuiPopoverState, t as OuiPopover } from "../popover.model-ubKNG612.mjs";
|
|
2
|
+
//#region src/js/popover/index.d.ts
|
|
3
|
+
declare function OuiPopover(this: OuiPopover, state: OuiPopoverState): void;
|
|
4
|
+
/**
|
|
5
|
+
* Get the _OuiPopover_ for an element
|
|
6
|
+
*
|
|
7
|
+
* @param element Element to get _OuiPopover_ for
|
|
8
|
+
* @returns _OuiPopover_ instance
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPopover(element: HTMLElement): OuiPopover | undefined;
|
|
11
|
+
//#endregion
|
|
12
|
+
export type { OuiPopover };
|