@oscarpalmer/oui 0.39.0 → 0.41.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/color-picker.css +80 -69
- package/dist/css/listbox.css +169 -0
- package/dist/js/color-picker/color-picker.constants.d.mts +2 -0
- package/dist/js/color-picker/{constants.color-picker.mjs → color-picker.constants.mjs} +7 -4
- package/dist/js/color-picker/{dom.color-picker.d.mts → color-picker.dom.d.mts} +2 -2
- package/dist/js/color-picker/{dom.color-picker.mjs → color-picker.dom.mjs} +33 -16
- package/dist/js/color-picker/{event.color-picker.d.mts → color-picker.event.d.mts} +3 -3
- package/dist/js/color-picker/color-picker.event.mjs +233 -0
- package/dist/js/color-picker/{form.color-picker.d.mts → color-picker.form.d.mts} +2 -2
- package/dist/js/color-picker/{form.color-picker.mjs → color-picker.form.mjs} +9 -8
- package/dist/js/color-picker/color-picker.misc.d.mts +2 -0
- package/dist/js/color-picker/color-picker.misc.mjs +104 -0
- package/dist/js/color-picker/color-picker.model.d.mts +2 -0
- package/dist/js/color-picker/{models.color-picker.mjs → color-picker.model.mjs} +1 -1
- package/dist/js/color-picker/{output.color-picker.d.mts → color-picker.output.d.mts} +2 -2
- package/dist/js/color-picker/{output.color-picker.mjs → color-picker.output.mjs} +19 -18
- package/dist/js/color-picker/color-picker.state.d.mts +8 -0
- package/dist/js/color-picker/color-picker.state.mjs +168 -0
- package/dist/js/color-picker/index.d.mts +172 -2
- package/dist/js/color-picker/index.mjs +66 -59
- package/dist/js/color-picker.constants-BZgXQr5o.d.mts +177 -0
- package/dist/js/color-picker.misc-BIS3R6jk.d.mts +31 -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 +25 -0
- package/dist/js/combobox/{dom.combobox.mjs → combobox.dom.mjs} +51 -49
- package/dist/js/combobox/{event.combobox.d.mts → combobox.event.d.mts} +9 -9
- 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/combobox.misc.mjs +2 -0
- package/dist/js/combobox/combobox.model.d.mts +2 -0
- package/dist/js/combobox/combobox.state.d.mts +9 -0
- package/dist/js/combobox/combobox.state.mjs +2 -0
- package/dist/js/combobox/index.d.mts +152 -2
- package/dist/js/combobox/index.mjs +54 -55
- package/dist/js/combobox.constants-Hb3bqqQJ.d.mts +19 -0
- package/dist/js/combobox.misc-DRDFk6X8.d.mts +26 -0
- package/dist/js/combobox.model-gjEI2VqZ.d.mts +46 -0
- package/dist/js/{state.combobox-BWDFHwoi.mjs → combobox.state-AstCICiH.mjs} +109 -106
- 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-HVzYWoDo.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-ncshL3Sa.d.mts +17 -0
- package/dist/js/{floatable.embedded-DQYkXt8X.d.mts → floatable.model-DXsQgoU7.d.mts} +13 -20
- package/dist/js/focus-trap/focus-trap.embedded.d.mts +2 -2
- package/dist/js/focus-trap/focus-trap.embedded.mjs +117 -138
- 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-DpcPkP7c.d.mts +13 -0
- package/dist/js/{focus-trap.embedded-CjyFQYow.d.mts → focus-trap.model-CpltX5B5.d.mts} +16 -18
- package/dist/js/index.d.mts +26 -14
- package/dist/js/index.mjs +18 -17
- package/dist/js/internal/attributable.d.mts +1 -1
- 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/index.mjs +243 -0
- package/dist/js/internal/l10n/index.d.mts +5 -0
- package/dist/js/internal/l10n/index.mjs +147 -0
- package/dist/js/internal/l10n/l10n.model.d.mts +2 -0
- package/dist/js/internal/l10n/l10n.model.mjs +12 -0
- package/dist/js/internal/misc.d.mts +3 -2
- package/dist/js/internal/misc.mjs +4 -6
- 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/internal/option-list/option-list.constants.d.mts +8 -0
- package/dist/js/internal/option-list/option-list.constants.mjs +22 -0
- package/dist/js/internal/option-list/option-list.data.d.mts +21 -0
- package/dist/js/internal/option-list/option-list.data.mjs +2 -0
- package/dist/js/internal/option-list/option-list.dom.d.mts +18 -0
- package/dist/js/internal/option-list/option-list.dom.mjs +2 -0
- package/dist/js/internal/option-list/option-list.event.d.mts +6 -0
- package/dist/js/internal/option-list/option-list.event.mjs +66 -0
- package/dist/js/internal/option-list/option-list.form.d.mts +7 -0
- package/dist/js/internal/option-list/option-list.form.mjs +53 -0
- package/dist/js/internal/option-list/option-list.misc.d.mts +13 -0
- package/dist/js/internal/option-list/option-list.misc.mjs +2 -0
- package/dist/js/internal/option-list/option-list.model.d.mts +2 -0
- package/dist/js/internal/option-list/option-list.state.d.mts +8 -0
- package/dist/js/internal/option-list/option-list.state.mjs +39 -0
- package/dist/js/l10n/index.d.mts +3 -0
- package/dist/js/l10n/index.mjs +2 -0
- package/dist/js/l10n.model-D1E1u35L.d.mts +54 -0
- package/dist/js/listbox/index.d.mts +9 -18
- package/dist/js/listbox/index.mjs +49 -52
- package/dist/js/listbox/listbox.constants.d.mts +2 -0
- package/dist/js/listbox/{constants.listbox.mjs → listbox.constants.mjs} +11 -15
- package/dist/js/listbox/listbox.dom.d.mts +5 -0
- package/dist/js/listbox/listbox.dom.mjs +2 -0
- package/dist/js/listbox/listbox.event.d.mts +9 -0
- package/dist/js/listbox/listbox.event.mjs +2 -0
- package/dist/js/listbox/listbox.misc.d.mts +2 -0
- package/dist/js/listbox/listbox.misc.mjs +2 -0
- package/dist/js/listbox/listbox.model.d.mts +2 -0
- package/dist/js/listbox/listbox.model.mjs +1 -0
- package/dist/js/listbox/listbox.state.d.mts +9 -0
- package/dist/js/listbox/listbox.state.mjs +2 -0
- package/dist/js/listbox.constants-DOBMwKup.d.mts +9 -0
- package/dist/js/listbox.misc-DwfB4Mu_.d.mts +24 -0
- package/dist/js/listbox.model-C0MYWXZe.d.mts +20 -0
- package/dist/js/listbox.state-BrN296BM.mjs +240 -0
- package/dist/js/menu/index.mjs +171 -0
- package/dist/js/menu/menu.model.d.mts +33 -0
- package/dist/js/menu/menu.model.mjs +15 -0
- package/dist/js/movable/movable.embedded.d.mts +2 -2
- package/dist/js/movable/movable.embedded.mjs +77 -86
- 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-C1bDTLGs.d.mts +11 -0
- package/dist/js/movable.model-D9nnPWKk.d.mts +186 -0
- package/dist/js/navigable.model-BqoR6iBv.d.mts +44 -0
- package/dist/js/option-list.data-CgMyUwPc.mjs +441 -0
- package/dist/js/option-list.model-CCPUlPeX.d.mts +169 -0
- package/dist/js/popover/index.d.mts +12 -0
- package/dist/js/{popover.mjs → popover/index.mjs} +41 -51
- package/dist/js/popover/popover.model.d.mts +2 -0
- package/dist/js/popover/popover.model.mjs +12 -0
- package/dist/js/popover.model-DiLdz0Hc.d.mts +38 -0
- package/dist/js/resizable/resizable.embedded.d.mts +2 -2
- package/dist/js/resizable/resizable.embedded.mjs +43 -58
- 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-BemH-7Re.d.mts +11 -0
- package/dist/js/resizable.model-YEtcC9li.d.mts +46 -0
- package/dist/js/sortable/sortable.embedded.d.mts +2 -2
- package/dist/js/sortable/sortable.embedded.mjs +111 -116
- 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-CrEGff9k.d.mts +11 -0
- package/dist/js/{splitter.d.mts → splitter/index.d.mts} +6 -4
- package/dist/js/{splitter.mjs → splitter/index.mjs} +90 -128
- package/dist/js/splitter/splitter.model.d.mts +2 -0
- package/dist/js/splitter/splitter.model.mjs +37 -0
- package/dist/js/splitter.model-C24W6eZ7.d.mts +57 -0
- package/dist/js/{tabs.d.mts → tabs/index.d.mts} +8 -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-BHPy7fPo.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} +61 -86
- package/dist/js/tooltip/tooltip.model.d.mts +2 -0
- package/dist/js/tooltip/tooltip.model.mjs +15 -0
- package/dist/js/tooltip.model-BpNStw5z.d.mts +37 -0
- package/package.json +30 -24
- package/dist/js/color-picker/constants.color-picker.d.mts +0 -2
- package/dist/js/color-picker/event.color-picker.mjs +0 -2
- package/dist/js/color-picker/misc.color-picker.d.mts +0 -2
- package/dist/js/color-picker/misc.color-picker.mjs +0 -2
- package/dist/js/color-picker/models.color-picker.d.mts +0 -2
- package/dist/js/color-picker/state.color-picker.d.mts +0 -8
- package/dist/js/color-picker/state.color-picker.mjs +0 -2
- package/dist/js/combobox/constants.combobox.d.mts +0 -2
- package/dist/js/combobox/dom.combobox.d.mts +0 -26
- package/dist/js/combobox/misc.combobox.d.mts +0 -2
- package/dist/js/combobox/misc.combobox.mjs +0 -2
- package/dist/js/combobox/models.combobox.d.mts +0 -43
- package/dist/js/combobox/state.combobox.d.mts +0 -11
- package/dist/js/combobox/state.combobox.mjs +0 -2
- package/dist/js/constants.color-picker-B-gFjL8m.d.mts +0 -364
- package/dist/js/constants.combobox-8EMRmv09.d.mts +0 -18
- package/dist/js/constants.listbox-DGnX32kv.d.mts +0 -8
- package/dist/js/dialog.d.mts +0 -47
- package/dist/js/dialog.mjs +0 -131
- package/dist/js/draggable-B5-70SZm.d.mts +0 -155
- package/dist/js/event.color-picker-BEpq0Adu.mjs +0 -485
- package/dist/js/index-C5D3-oiI.d.mts +0 -177
- package/dist/js/internal/draggable.d.mts +0 -2
- package/dist/js/internal/draggable.mjs +0 -265
- package/dist/js/internal/listbox/listbox.constants.d.mts +0 -8
- package/dist/js/internal/listbox/listbox.constants.mjs +0 -22
- package/dist/js/internal/listbox/listbox.data.d.mts +0 -19
- package/dist/js/internal/listbox/listbox.data.mjs +0 -2
- package/dist/js/internal/listbox/listbox.dom.d.mts +0 -65
- package/dist/js/internal/listbox/listbox.dom.mjs +0 -2
- package/dist/js/internal/listbox/listbox.event.d.mts +0 -4
- package/dist/js/internal/listbox/listbox.event.mjs +0 -63
- package/dist/js/internal/listbox/listbox.form.d.mts +0 -5
- package/dist/js/internal/listbox/listbox.form.mjs +0 -53
- package/dist/js/internal/listbox/listbox.misc.d.mts +0 -11
- package/dist/js/internal/listbox/listbox.misc.mjs +0 -2
- package/dist/js/internal/listbox/listbox.model.d.mts +0 -2
- package/dist/js/internal/listbox/listbox.state.d.mts +0 -6
- package/dist/js/internal/listbox/listbox.state.mjs +0 -40
- package/dist/js/internal/navigable.d.mts +0 -36
- 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/l10n.mjs +0 -80
- package/dist/js/listbox/constants.listbox.d.mts +0 -2
- package/dist/js/listbox/event.listbox.d.mts +0 -7
- package/dist/js/listbox/event.listbox.mjs +0 -2
- package/dist/js/listbox/misc.listbox.d.mts +0 -2
- package/dist/js/listbox/misc.listbox.mjs +0 -2
- package/dist/js/listbox/state.listbox.d.mts +0 -10
- package/dist/js/listbox/state.listbox.mjs +0 -2
- package/dist/js/listbox.data-DQ7-x2uY.mjs +0 -425
- package/dist/js/listbox.model-BHPA7GM4.d.mts +0 -125
- package/dist/js/menu.mjs +0 -172
- package/dist/js/misc.listbox-DKB-j0UK.mjs +0 -196
- package/dist/js/misc.listbox-mZMuYOxg.d.mts +0 -20
- package/dist/js/popover.d.mts +0 -38
- package/dist/js/resizable.embedded-dvhdfQgt.d.mts +0 -34
- package/dist/js/toolbar.mjs +0 -31
- package/dist/js/tooltip.d.mts +0 -45
- /package/dist/js/combobox/{models.combobox.mjs → combobox.model.mjs} +0 -0
- /package/dist/js/internal/{listbox/listbox.model.mjs → option-list/option-list.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,70 +1,24 @@
|
|
|
1
|
+
import { FLOATABLE_AREAS, FLOATABLE_ATTRIBUTE, FLOATABLE_ATTRIBUTE_POSITION, FLOATABLE_MESSAGE, FLOATABLE_POSITIONS, FLOATABLE_SYMBOL, floatables } from "./floatable.model.mjs";
|
|
1
2
|
import { getAria } from "@oscarpalmer/toretto/aria";
|
|
3
|
+
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
2
4
|
import { on } from "@oscarpalmer/toretto/event";
|
|
3
5
|
import { isPlainObject } from "@oscarpalmer/atoms/is";
|
|
4
|
-
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
5
6
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
6
7
|
import { setStyle, setStyles } from "@oscarpalmer/toretto/style";
|
|
7
8
|
//#region src/js/floatable/floatable.embedded.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (value === true) this.show();
|
|
22
|
-
else if (value === false) this.hide();
|
|
23
|
-
}
|
|
24
|
-
constructor(state, standalone) {
|
|
25
|
-
this.#state = state;
|
|
26
|
-
this.#initialize(state, standalone);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Destroy the floatable, removing it from the DOM and cleaning up references
|
|
30
|
-
*/
|
|
31
|
-
destroy() {
|
|
32
|
-
if (this.#destroyed) return;
|
|
33
|
-
this.#destroyed = true;
|
|
34
|
-
removeFloatable(this.#state.content);
|
|
35
|
-
this.#state.anchor = null;
|
|
36
|
-
this.#state.content = null;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Closes the floatable
|
|
40
|
-
*/
|
|
41
|
-
hide() {
|
|
42
|
-
if (!this.#destroyed && this.open) this.#state.content.hidePopover();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Opens the floatable
|
|
46
|
-
*/
|
|
47
|
-
show() {
|
|
48
|
-
if (!this.#destroyed && !this.open) this.#state.content.showPopover();
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Update the position of the floatable, with an optional new position
|
|
52
|
-
*
|
|
53
|
-
* @param position Optional new position
|
|
54
|
-
*/
|
|
55
|
-
update(position) {
|
|
56
|
-
if (!this.#destroyed) setPosition(this.#state, position);
|
|
57
|
-
}
|
|
58
|
-
#initialize(state, standalone) {
|
|
59
|
-
const { anchor, content } = state;
|
|
60
|
-
if (standalone) {
|
|
61
|
-
setAttribute(content, ATTRIBUTE_FLOATABLE, "");
|
|
62
|
-
content.popover = "manual";
|
|
63
|
-
} else content.popover ??= "auto";
|
|
64
|
-
setStyle(anchor, "anchorName", state.name);
|
|
65
|
-
setStyle(content, "positionAnchor", state.name);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
9
|
+
function OuiFloatable(state, standalone) {
|
|
10
|
+
this[FLOATABLE_SYMBOL] = state;
|
|
11
|
+
initialize(state, standalone);
|
|
12
|
+
}
|
|
13
|
+
OuiFloatable.prototype.destroy = destroyFloatable;
|
|
14
|
+
OuiFloatable.prototype.hide = hideFloatable;
|
|
15
|
+
OuiFloatable.prototype.show = showFloatable;
|
|
16
|
+
OuiFloatable.prototype.update = updateFloatable;
|
|
17
|
+
Object.defineProperties(OuiFloatable.prototype, { open: {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: getOpen,
|
|
20
|
+
set: setOpen
|
|
21
|
+
} });
|
|
68
22
|
function getAnchorName(anchor) {
|
|
69
23
|
let { anchorName } = anchor.style;
|
|
70
24
|
if (anchorName.length > 0) return anchorName;
|
|
@@ -93,74 +47,92 @@ function createFloatable(anchor, content, options) {
|
|
|
93
47
|
return floatable;
|
|
94
48
|
}
|
|
95
49
|
function createInstance(anchor, content, options, standalone) {
|
|
96
|
-
if (!isHTMLOrSVGElement(anchor) || !isHTMLOrSVGElement(content)) throw new TypeError(
|
|
97
|
-
let floatable = options.reusable ? void 0 :
|
|
50
|
+
if (!isHTMLOrSVGElement(anchor) || !isHTMLOrSVGElement(content)) throw new TypeError(FLOATABLE_MESSAGE);
|
|
51
|
+
let floatable = options.reusable ? void 0 : floatables.get(content);
|
|
98
52
|
if (floatable == null) {
|
|
99
53
|
floatable = new OuiFloatable(getState(anchor, content, options), standalone);
|
|
100
|
-
if (!options.reusable)
|
|
54
|
+
if (!options.reusable) floatables.set(content, floatable);
|
|
101
55
|
}
|
|
102
56
|
return floatable;
|
|
103
57
|
}
|
|
58
|
+
function destroyFloatable() {
|
|
59
|
+
const state = this[FLOATABLE_SYMBOL];
|
|
60
|
+
if (state.destroyed) return;
|
|
61
|
+
state.destroyed = true;
|
|
62
|
+
removeFloatable(state.content);
|
|
63
|
+
state.anchor = void 0;
|
|
64
|
+
state.content = void 0;
|
|
65
|
+
}
|
|
104
66
|
function getOnBeforeToggleListener(element) {
|
|
105
67
|
return on(element, "beforetoggle", (event) => {
|
|
106
68
|
const { newState, source } = event;
|
|
107
69
|
if (newState === "open" && source != null && getAria(source, "disabled") === true) event.preventDefault();
|
|
108
70
|
}, { passive: false });
|
|
109
71
|
}
|
|
72
|
+
function getOpen() {
|
|
73
|
+
return this[FLOATABLE_SYMBOL].content.checkVisibility();
|
|
74
|
+
}
|
|
110
75
|
function getOptions(input) {
|
|
111
76
|
const object = isPlainObject(input) ? input : {};
|
|
112
77
|
return {
|
|
113
78
|
open: typeof object.open === "boolean" ? object.open : true,
|
|
114
|
-
position: object.position != null && object.position in
|
|
79
|
+
position: object.position != null && object.position in FLOATABLE_AREAS ? object.position : "below"
|
|
115
80
|
};
|
|
116
81
|
}
|
|
117
82
|
function getPosition(state, override) {
|
|
118
|
-
if (override != null && override in
|
|
83
|
+
if (override != null && override in FLOATABLE_AREAS) return override;
|
|
119
84
|
const { anchor, options } = state;
|
|
120
85
|
if (options.attribute == null) return options.position;
|
|
121
86
|
const attribute = getAttribute(anchor, options.attribute);
|
|
122
|
-
return attribute != null && attribute in
|
|
87
|
+
return attribute != null && attribute in FLOATABLE_AREAS ? attribute : options.position;
|
|
123
88
|
}
|
|
124
89
|
function getState(anchor, content, options) {
|
|
125
90
|
return {
|
|
126
91
|
anchor,
|
|
127
92
|
content,
|
|
128
93
|
name: getAnchorName(anchor),
|
|
129
|
-
options
|
|
94
|
+
options,
|
|
95
|
+
destroyed: false
|
|
130
96
|
};
|
|
131
97
|
}
|
|
98
|
+
function hideFloatable() {
|
|
99
|
+
const { content, destroyed } = this[FLOATABLE_SYMBOL];
|
|
100
|
+
if (!destroyed && this.open) content.hidePopover();
|
|
101
|
+
}
|
|
102
|
+
function initialize(state, standalone) {
|
|
103
|
+
const { anchor, content } = state;
|
|
104
|
+
if (standalone) {
|
|
105
|
+
setAttribute(content, FLOATABLE_ATTRIBUTE, "");
|
|
106
|
+
content.popover = "manual";
|
|
107
|
+
} else content.popover ??= "auto";
|
|
108
|
+
setStyle(anchor, "anchorName", state.name);
|
|
109
|
+
setStyle(content, "positionAnchor", state.name);
|
|
110
|
+
}
|
|
132
111
|
function removeFloatable(content) {
|
|
133
|
-
|
|
134
|
-
|
|
112
|
+
floatables.get(content)?.destroy();
|
|
113
|
+
floatables.delete(content);
|
|
114
|
+
}
|
|
115
|
+
function setOpen(value) {
|
|
116
|
+
if (value === true) this.show();
|
|
117
|
+
else if (value === false) this.hide();
|
|
135
118
|
}
|
|
136
119
|
function setPosition(state, override) {
|
|
137
120
|
const position = getPosition(state, override);
|
|
138
|
-
const area =
|
|
139
|
-
setAttribute(state.content,
|
|
121
|
+
const area = FLOATABLE_AREAS[position];
|
|
122
|
+
setAttribute(state.content, FLOATABLE_ATTRIBUTE_POSITION, FLOATABLE_POSITIONS[area]);
|
|
140
123
|
setStyles(state.content, {
|
|
141
124
|
positionAnchor: state.name,
|
|
142
125
|
positionArea: area
|
|
143
126
|
});
|
|
144
127
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"end-bottom": "span-start end",
|
|
154
|
-
"end-top": "span-end end",
|
|
155
|
-
start: "center start",
|
|
156
|
-
"start-bottom": "span-start start",
|
|
157
|
-
"start-top": "span-end start"
|
|
158
|
-
};
|
|
159
|
-
const ATTRIBUTE_FLOATABLE = "oui-floatable";
|
|
160
|
-
const ATTRIBUTE_POSITION = "oui-position";
|
|
161
|
-
const MESSAGE = "Anchor and content must be an HTMLElement or SVGElement";
|
|
162
|
-
const POSITIONS = Object.fromEntries(Object.entries(AREAS).map(([position, area]) => [area, position]));
|
|
163
|
-
const instances = /* @__PURE__ */ new WeakMap();
|
|
128
|
+
function showFloatable() {
|
|
129
|
+
const { content, destroyed } = this[FLOATABLE_SYMBOL];
|
|
130
|
+
if (!destroyed && !this.open) content.showPopover();
|
|
131
|
+
}
|
|
132
|
+
function updateFloatable(position) {
|
|
133
|
+
const state = this[FLOATABLE_SYMBOL];
|
|
134
|
+
if (!state.destroyed) setPosition(state, position);
|
|
135
|
+
}
|
|
164
136
|
let index = 0;
|
|
165
137
|
//#endregion
|
|
166
|
-
export {
|
|
138
|
+
export { createEmbeddedFloatable, createFloatable, getOnBeforeToggleListener, removeFloatable };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as FLOATABLE_MESSAGE, c as OuiFloatable, d as OuiFloatableState, f as floatables, i as FLOATABLE_ATTRIBUTE_POSITION, l as OuiFloatableOptions, n as FLOATABLE_AREAS, o as FLOATABLE_POSITIONS, r as FLOATABLE_ATTRIBUTE, s as FLOATABLE_SYMBOL, t as CreateOuiFloatableOptions, u as OuiFloatablePosition } from "../floatable.model-DXsQgoU7.mjs";
|
|
2
|
+
export { CreateOuiFloatableOptions, FLOATABLE_AREAS, FLOATABLE_ATTRIBUTE, FLOATABLE_ATTRIBUTE_POSITION, FLOATABLE_MESSAGE, FLOATABLE_POSITIONS, FLOATABLE_SYMBOL, OuiFloatable, OuiFloatableOptions, OuiFloatablePosition, OuiFloatableState, floatables };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/js/floatable/floatable.model.ts
|
|
2
|
+
const FLOATABLE_AREAS = {
|
|
3
|
+
above: "block-start",
|
|
4
|
+
"above-end": "start span-start",
|
|
5
|
+
"above-start": "start span-end",
|
|
6
|
+
below: "block-end",
|
|
7
|
+
"below-end": "end span-start",
|
|
8
|
+
"below-start": "end span-end",
|
|
9
|
+
end: "center end",
|
|
10
|
+
"end-bottom": "span-start end",
|
|
11
|
+
"end-top": "span-end end",
|
|
12
|
+
start: "center start",
|
|
13
|
+
"start-bottom": "span-start start",
|
|
14
|
+
"start-top": "span-end start"
|
|
15
|
+
};
|
|
16
|
+
const FLOATABLE_ATTRIBUTE = "oui-floatable";
|
|
17
|
+
const FLOATABLE_ATTRIBUTE_POSITION = "oui-position";
|
|
18
|
+
const FLOATABLE_MESSAGE = "Anchor and content must be an HTMLElement or SVGElement";
|
|
19
|
+
const FLOATABLE_POSITIONS = Object.fromEntries(Object.entries(FLOATABLE_AREAS).map(([position, area]) => [area, position]));
|
|
20
|
+
const FLOATABLE_SYMBOL = Symbol(FLOATABLE_ATTRIBUTE);
|
|
21
|
+
const floatables = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
//#endregion
|
|
23
|
+
export { FLOATABLE_AREAS, FLOATABLE_ATTRIBUTE, FLOATABLE_ATTRIBUTE_POSITION, FLOATABLE_MESSAGE, FLOATABLE_POSITIONS, FLOATABLE_SYMBOL, floatables };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as OuiFloatable, t as CreateOuiFloatableOptions, u as OuiFloatablePosition } from "../floatable.model-DXsQgoU7.mjs";
|
|
2
|
+
import { n as createFloatable } from "../floatable.embedded-ncshL3Sa.mjs";
|
|
2
3
|
export { type CreateOuiFloatableOptions, type OuiFloatable, type OuiFloatablePosition, createFloatable };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { c as OuiFloatable, l as OuiFloatableOptions, t as CreateOuiFloatableOptions } from "./floatable.model-DXsQgoU7.mjs";
|
|
2
|
+
import { RemovableEventListener } from "@oscarpalmer/toretto/models";
|
|
3
|
+
//#region src/js/floatable/floatable.embedded.d.ts
|
|
4
|
+
declare function createEmbeddedFloatable(anchor: Element, content: Element, options: OuiFloatableOptions): OuiFloatable;
|
|
5
|
+
/**
|
|
6
|
+
* Create a _OuiFloatable_ for an anchor and content element
|
|
7
|
+
*
|
|
8
|
+
* @param anchor Anchor element
|
|
9
|
+
* @param content Content element
|
|
10
|
+
* @param options _OuiFloatable_ options
|
|
11
|
+
* @returns _OuiFloatable_ instance
|
|
12
|
+
*/
|
|
13
|
+
declare function createFloatable(anchor: Element, content: Element, options?: CreateOuiFloatableOptions): OuiFloatable;
|
|
14
|
+
declare function getOnBeforeToggleListener(element: Element): RemovableEventListener;
|
|
15
|
+
declare function removeFloatable(content: HTMLElement): void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { removeFloatable as i, createFloatable as n, getOnBeforeToggleListener as r, createEmbeddedFloatable as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/js/floatable/floatable.embedded.d.ts
|
|
1
|
+
//#region src/js/floatable/floatable.model.d.ts
|
|
3
2
|
type CreateOuiFloatableOptions = {
|
|
4
3
|
/**
|
|
5
4
|
* Open the floatable when created? _(defaults to `true`)_
|
|
@@ -10,8 +9,8 @@ type CreateOuiFloatableOptions = {
|
|
|
10
9
|
*/
|
|
11
10
|
position?: OuiFloatablePosition;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
type OuiFloatable = {
|
|
13
|
+
[FLOATABLE_SYMBOL]: OuiFloatableState;
|
|
15
14
|
/**
|
|
16
15
|
* Is the floatable open?
|
|
17
16
|
*/
|
|
@@ -20,7 +19,6 @@ declare class OuiFloatable {
|
|
|
20
19
|
* Open or close the floatable
|
|
21
20
|
*/
|
|
22
21
|
set open(value: boolean);
|
|
23
|
-
constructor(state: OuiFloatableState, standalone: boolean);
|
|
24
22
|
/**
|
|
25
23
|
* Destroy the floatable, removing it from the DOM and cleaning up references
|
|
26
24
|
*/
|
|
@@ -39,7 +37,7 @@ declare class OuiFloatable {
|
|
|
39
37
|
* @param position Optional new position
|
|
40
38
|
*/
|
|
41
39
|
update(position?: OuiFloatablePosition): void;
|
|
42
|
-
}
|
|
40
|
+
};
|
|
43
41
|
type OuiFloatableOptions = {
|
|
44
42
|
attribute?: string;
|
|
45
43
|
position: OuiFloatablePosition;
|
|
@@ -49,21 +47,16 @@ type OuiFloatablePosition = "above" | "above-end" | "above-start" | "below" | "b
|
|
|
49
47
|
type OuiFloatableState = {
|
|
50
48
|
anchor: HTMLElement;
|
|
51
49
|
content: HTMLElement;
|
|
50
|
+
destroyed: boolean;
|
|
52
51
|
name: string;
|
|
53
52
|
options: OuiFloatableOptions;
|
|
54
53
|
};
|
|
55
|
-
declare
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* @returns _OuiFloatable_ instance
|
|
63
|
-
*/
|
|
64
|
-
declare function createFloatable(anchor: HTMLElement, content: HTMLElement, options?: CreateOuiFloatableOptions): OuiFloatable;
|
|
65
|
-
declare function getOnBeforeToggleListener(element: HTMLElement): RemovableEventListener;
|
|
66
|
-
declare function removeFloatable(content: HTMLElement): void;
|
|
67
|
-
declare const ATTRIBUTE_FLOATABLE = "oui-floatable";
|
|
54
|
+
declare const FLOATABLE_AREAS: Record<OuiFloatablePosition, string>;
|
|
55
|
+
declare const FLOATABLE_ATTRIBUTE = "oui-floatable";
|
|
56
|
+
declare const FLOATABLE_ATTRIBUTE_POSITION = "oui-position";
|
|
57
|
+
declare const FLOATABLE_MESSAGE = "Anchor and content must be an HTMLElement or SVGElement";
|
|
58
|
+
declare const FLOATABLE_POSITIONS: Record<string, OuiFloatablePosition>;
|
|
59
|
+
declare const FLOATABLE_SYMBOL: unique symbol;
|
|
60
|
+
declare const floatables: WeakMap<HTMLElement, OuiFloatable>;
|
|
68
61
|
//#endregion
|
|
69
|
-
export {
|
|
62
|
+
export { FLOATABLE_MESSAGE as a, OuiFloatable as c, OuiFloatableState as d, floatables as f, FLOATABLE_ATTRIBUTE_POSITION as i, OuiFloatableOptions as l, FLOATABLE_AREAS as n, FLOATABLE_POSITIONS as o, FLOATABLE_ATTRIBUTE as r, FLOATABLE_SYMBOL as s, CreateOuiFloatableOptions as t, OuiFloatablePosition as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { n as removeFocusTrap, t as createFocusTrap } from "../focus-trap.embedded-DpcPkP7c.mjs";
|
|
2
|
+
export { createFocusTrap, removeFocusTrap };
|