@oscarpalmer/oui 0.16.0 → 0.18.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/badge.css +3 -3
- package/dist/css/content.css +9 -11
- package/dist/css/form.css +36 -22
- package/dist/css/message.css +4 -0
- package/dist/css/popover.css +3 -0
- package/dist/css/reset.css +176 -56
- package/dist/css/splitter.css +3 -3
- package/dist/css/tooltip.css +8 -0
- package/dist/js/attributable.full.js +48 -0
- package/dist/js/attributable.js +30 -45
- package/dist/js/floatable.full.js +413 -0
- package/dist/js/floatable.js +259 -132
- package/dist/js/focus-trap/embedded.full.js +351 -0
- package/dist/js/focus-trap/embedded.js +131 -131
- package/dist/js/focus-trap/standalone.full.js +402 -0
- package/dist/js/focus-trap/standalone.js +4 -4
- package/dist/js/index.js +4 -5
- package/dist/js/oui.full.js +1596 -0
- package/dist/js/popover.full.js +822 -0
- package/dist/js/popover.js +83 -156
- package/dist/js/splitter.full.js +605 -0
- package/dist/js/splitter.js +279 -200
- package/dist/js/tooltip.full.js +679 -0
- package/dist/js/tooltip.js +159 -144
- package/package.json +31 -59
- package/src/css/content.scss +1 -2
- package/src/css/form.scss +12 -4
- package/src/css/message.scss +3 -0
- package/src/css/mixins.scss +7 -0
- package/src/css/popover.scss +4 -0
- package/src/css/reset.scss +180 -54
- package/src/css/splitter.scss +3 -3
- package/src/css/tooltip.scss +8 -0
- package/src/js/floatable.ts +458 -124
- package/src/js/focus-trap/embedded.ts +149 -64
- package/src/js/focus-trap/standalone.ts +4 -4
- package/src/js/index.ts +1 -0
- package/src/js/popover.ts +51 -114
- package/src/js/splitter.ts +346 -109
- package/src/js/tooltip.ts +157 -63
- package/types/floatable.d.ts +19 -7
- package/types/focus-trap/embedded.d.ts +18 -5
- package/types/index.d.ts +1 -0
- package/types/popover.d.ts +2 -0
- package/types/splitter.d.ts +13 -1
- package/types/tooltip.d.ts +2 -1
- package/dist/js/attributable.cjs +0 -51
- package/dist/js/floatable.cjs +0 -134
- package/dist/js/focus-trap/embedded.cjs +0 -150
- package/dist/js/focus-trap/standalone.cjs +0 -8
- package/dist/js/index.cjs +0 -6
- package/dist/js/popover.cjs +0 -160
- package/dist/js/splitter.cjs +0 -211
- package/dist/js/tooltip.cjs +0 -160
- package/types/attributable.d.cts +0 -5
- package/types/floatable.d.cts +0 -16
- package/types/focus-trap/embedded.d.cts +0 -15
- package/types/focus-trap/standalone.d.cts +0 -3
- package/types/index.d.cts +0 -14
- package/types/popover.d.cts +0 -14
- package/types/splitter.d.cts +0 -10
- package/types/tooltip.d.cts +0 -3
package/dist/js/splitter.js
CHANGED
|
@@ -1,211 +1,290 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
|
|
2
|
+
import { getPosition, on } from "@oscarpalmer/toretto/event";
|
|
3
3
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
4
|
+
import { round } from "@oscarpalmer/atoms/math";
|
|
5
|
+
import { clamp } from "@oscarpalmer/atoms/number";
|
|
6
|
+
import { toggleStyles } from "@oscarpalmer/toretto/style";
|
|
7
|
+
import supportsTouch from "@oscarpalmer/toretto/touch";
|
|
8
|
+
var OuiSplitterElement = class extends HTMLElement {
|
|
9
|
+
static observedAttributes = [
|
|
10
|
+
"max",
|
|
11
|
+
"min",
|
|
12
|
+
"size",
|
|
13
|
+
"type"
|
|
14
|
+
];
|
|
15
|
+
#splitter;
|
|
16
|
+
get max() {
|
|
17
|
+
return this.#splitter.values.max;
|
|
18
|
+
}
|
|
19
|
+
set max(value) {
|
|
20
|
+
this.setAttribute("max", String(value));
|
|
21
|
+
}
|
|
22
|
+
get min() {
|
|
23
|
+
return this.#splitter.values.min;
|
|
24
|
+
}
|
|
25
|
+
set min(value) {
|
|
26
|
+
this.setAttribute("min", String(value));
|
|
27
|
+
}
|
|
28
|
+
get size() {
|
|
29
|
+
return this.#splitter.values.now.current;
|
|
30
|
+
}
|
|
31
|
+
set size(value) {
|
|
32
|
+
this.setAttribute("size", String(value));
|
|
33
|
+
}
|
|
34
|
+
get type() {
|
|
35
|
+
return this.getAttribute("type") ?? "vertical";
|
|
36
|
+
}
|
|
37
|
+
set type(value) {
|
|
38
|
+
this.setAttribute("type", value);
|
|
39
|
+
}
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
const panels = [...this.children].filter((child) => child instanceof HTMLElement);
|
|
43
|
+
if (panels.length !== 2) throw new Error(`${SELECTOR} must have exactly two panels.`);
|
|
44
|
+
this.#splitter = new Splitter(this, panels);
|
|
45
|
+
}
|
|
46
|
+
connectedCallback() {
|
|
47
|
+
this.#splitter.updateConnections(1);
|
|
48
|
+
}
|
|
49
|
+
disconnectedCallback() {
|
|
50
|
+
this.#splitter.updateConnections(0);
|
|
51
|
+
}
|
|
52
|
+
attributeChangedCallback(name) {
|
|
53
|
+
switch (name) {
|
|
54
|
+
case "max":
|
|
55
|
+
case "min":
|
|
56
|
+
case "size":
|
|
57
|
+
this.#splitter.updateValues();
|
|
58
|
+
break;
|
|
59
|
+
case "type":
|
|
60
|
+
this.#splitter.updateOrientation();
|
|
61
|
+
break;
|
|
62
|
+
default: break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var index = 0;
|
|
67
|
+
var Splitter = class {
|
|
68
|
+
element;
|
|
69
|
+
handle;
|
|
70
|
+
panels;
|
|
71
|
+
rectangle;
|
|
72
|
+
separator;
|
|
73
|
+
types;
|
|
74
|
+
values;
|
|
75
|
+
constructor(element, panels) {
|
|
76
|
+
this.element = element;
|
|
77
|
+
this.panels = panels;
|
|
78
|
+
if (isNullableOrWhitespace(element.id)) element.id = `oui_splitter_${++index}`;
|
|
79
|
+
this.values = getValues(element);
|
|
80
|
+
this.handle = createHandle();
|
|
81
|
+
this.rectangle = element.getBoundingClientRect();
|
|
82
|
+
this.separator = createSeparator(this);
|
|
83
|
+
this.separator.append(this.handle);
|
|
84
|
+
panels[0].insertAdjacentElement("afterend", this.separator);
|
|
85
|
+
this.updateOrientation();
|
|
86
|
+
this.updateValues();
|
|
87
|
+
}
|
|
88
|
+
updateConnections(add) {
|
|
89
|
+
const method = METHODS_CONNECT[add];
|
|
90
|
+
MAPPED_ELEMENTS[method](this.element, this);
|
|
91
|
+
MAPPED_ELEMENTS[method](this.handle, this);
|
|
92
|
+
MAPPED_ELEMENTS[method](this.separator, this);
|
|
93
|
+
if (this.types.auto) RESIZE_OBSERVER[METHODS_OBSERVE[add]](this.element);
|
|
94
|
+
}
|
|
95
|
+
updateOrientation() {
|
|
96
|
+
this.types = getTypes(this);
|
|
97
|
+
if (this.types.auto) RESIZE_OBSERVER.observe(this.element);
|
|
98
|
+
else RESIZE_OBSERVER.unobserve(this.element);
|
|
99
|
+
if (this.types.horizontal) this.element.setAttribute(ATTRIBUTE_HORIZONTAL, "");
|
|
100
|
+
else this.element.removeAttribute(ATTRIBUTE_HORIZONTAL);
|
|
101
|
+
setAriaOrientation(this);
|
|
102
|
+
}
|
|
103
|
+
updateValues() {
|
|
104
|
+
this.values = getValues(this.element);
|
|
105
|
+
requestAnimationFrame(() => {
|
|
106
|
+
setSize(this, this.values.now.current);
|
|
107
|
+
setAriaValue(this);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
53
111
|
function createHandle() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
112
|
+
const handle = document.createElement("span");
|
|
113
|
+
handle.setAttribute("aria-hidden", "true");
|
|
114
|
+
handle.setAttribute(ATTRIBUTE_HANDLE, "");
|
|
115
|
+
return handle;
|
|
116
|
+
}
|
|
117
|
+
function createSeparator(splitter$1) {
|
|
118
|
+
const separator = document.createElement("div");
|
|
119
|
+
separator.role = "separator";
|
|
120
|
+
separator.tabIndex = 0;
|
|
121
|
+
separator.setAttribute("aria-controls", splitter$1.element.id);
|
|
122
|
+
separator.setAttribute("aria-label", "Resize panels");
|
|
123
|
+
separator.setAttribute(ATTRIBUTE_SEPARATOR, "");
|
|
124
|
+
return separator;
|
|
125
|
+
}
|
|
126
|
+
function getContained(min, value, max) {
|
|
127
|
+
return round(clamp(value, min, max), VALUE_DECIMALS);
|
|
128
|
+
}
|
|
129
|
+
function getSize(splitter$1, value) {
|
|
130
|
+
const { height, left, top, width } = splitter$1.rectangle;
|
|
131
|
+
const fraction = (value - (splitter$1.types.horizontal ? top : left)) / (splitter$1.types.horizontal ? height : width);
|
|
132
|
+
return getContained(splitter$1.values.min, fraction, splitter$1.values.max);
|
|
133
|
+
}
|
|
134
|
+
function getTypes(splitter$1, width, height) {
|
|
135
|
+
const type = splitter$1.element.getAttribute("type")?.trim() ?? "";
|
|
136
|
+
if (type === "horizontal") return {
|
|
137
|
+
auto: false,
|
|
138
|
+
horizontal: true
|
|
139
|
+
};
|
|
140
|
+
if (type === "auto") return {
|
|
141
|
+
auto: true,
|
|
142
|
+
horizontal: (height ?? splitter$1.rectangle.height) > (width ?? splitter$1.rectangle.width)
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
auto: false,
|
|
146
|
+
horizontal: false
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function getValue(element, name, defaultValue) {
|
|
150
|
+
const value = element.getAttribute(name);
|
|
151
|
+
if (isNullableOrWhitespace(value)) return defaultValue;
|
|
152
|
+
const parsed = Number.parseFloat(value);
|
|
153
|
+
if (Number.isNaN(parsed)) return defaultValue;
|
|
154
|
+
if (parsed < 0) return defaultValue;
|
|
155
|
+
return parsed > 1 ? parsed / NAVIGATION_MAXIMUM_TOTAL : parsed;
|
|
156
|
+
}
|
|
157
|
+
function getValues(element) {
|
|
158
|
+
const values = {
|
|
159
|
+
max: getValue(element, "max", NAVIGATION_MAXIMUM_PERCENTAGE),
|
|
160
|
+
min: getValue(element, "min", NAVIGATION_MINIMUM_PERCENTAGE),
|
|
161
|
+
now: {
|
|
162
|
+
current: .5,
|
|
163
|
+
previous: .5
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const value = getContained(values.min, getValue(element, "size", values.now.current), values.max);
|
|
167
|
+
values.now.current = value;
|
|
168
|
+
values.now.previous = value;
|
|
169
|
+
return values;
|
|
89
170
|
}
|
|
90
171
|
function onEnd(reset) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
splitter = void 0;
|
|
172
|
+
if (splitter == null) return;
|
|
173
|
+
splitter.handle.removeAttribute(ATTRIBUTE_ACTIVE);
|
|
174
|
+
splitter.separator.removeAttribute(ATTRIBUTE_ACTIVE);
|
|
175
|
+
if (reset) setSize(splitter, splitter.values.now.previous);
|
|
176
|
+
else splitter.values.now.previous = splitter.values.now.current;
|
|
177
|
+
splitter = void 0;
|
|
178
|
+
STYLING_TOGGLER.remove();
|
|
101
179
|
}
|
|
102
180
|
function onKeydown(event) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
function onMousedown(event) {
|
|
113
|
-
splitter = mapped.get(
|
|
114
|
-
findAncestor(
|
|
115
|
-
event.target,
|
|
116
|
-
"[oui-splitter-handle]"
|
|
117
|
-
)
|
|
118
|
-
);
|
|
119
|
-
if (splitter == null) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
splitter.handle.setAttribute("oui-splitter-active", "");
|
|
123
|
-
splitter.separator.setAttribute("oui-splitter-active", "");
|
|
124
|
-
splitter.rectangle = splitter.element.getBoundingClientRect();
|
|
125
|
-
}
|
|
126
|
-
function onMousemove(event) {
|
|
127
|
-
if (splitter == null) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const position = getPosition(event);
|
|
131
|
-
if (position != null) {
|
|
132
|
-
splitter.flex.value = getFlex(
|
|
133
|
-
splitter,
|
|
134
|
-
splitter.types.horizontal ? position.y : position.x
|
|
135
|
-
);
|
|
136
|
-
setSize(splitter, splitter.flex.value);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function onMouseup() {
|
|
140
|
-
if (splitter != null) {
|
|
141
|
-
onEnd(false);
|
|
142
|
-
}
|
|
181
|
+
switch (true) {
|
|
182
|
+
case KEYS_ALL.has(event.key):
|
|
183
|
+
onNavigate(event);
|
|
184
|
+
break;
|
|
185
|
+
case event.key === "Escape":
|
|
186
|
+
onEnd(true);
|
|
187
|
+
break;
|
|
188
|
+
default: break;
|
|
189
|
+
}
|
|
143
190
|
}
|
|
144
191
|
function onNavigate(event) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
setSize(splitter2, event.key === "End" ? 0.9 : 0.1, true);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
if (splitter2.types.horizontal && !horizontalKeys.has(event.key) || !splitter2.types.horizontal && !verticalKeys.has(event.key)) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const modifier = negativeKeys.has(event.key) ? -1 : 1;
|
|
162
|
-
setSize(splitter2, splitter2.flex.value + modifier * 0.05, true);
|
|
192
|
+
const splitter$1 = MAPPED_ELEMENTS.get(findAncestor(event.target, "[oui-splitter-separator]"));
|
|
193
|
+
if (splitter$1 == null) return;
|
|
194
|
+
const { types, values } = splitter$1;
|
|
195
|
+
if (KEYS_ABSOLUTE.has(event.key)) {
|
|
196
|
+
setSize(splitter$1, event.key === "End" ? values.max : values.min, true);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (types.horizontal && !KEYS_HORIZONTAL.has(event.key) || !(types.horizontal || KEYS_VERTICAL.has(event.key))) return;
|
|
200
|
+
const offset = KEYS_NEGATIVE.has(event.key) ? -1 : 1;
|
|
201
|
+
setSize(splitter$1, getContained(values.min, values.now.current + offset * NAVIGATION_MODIFIER, values.max), true);
|
|
163
202
|
}
|
|
164
203
|
function onObservation(entries) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
if (frame != null) cancelAnimationFrame(frame);
|
|
205
|
+
frame = requestAnimationFrame(() => {
|
|
206
|
+
for (const entry of entries) {
|
|
207
|
+
const splitter$1 = MAPPED_ELEMENTS.get(entry.target);
|
|
208
|
+
if (splitter$1 == null) return;
|
|
209
|
+
splitter$1.types = getTypes(splitter$1, entry.contentRect.width, entry.contentRect.height);
|
|
210
|
+
if (splitter$1.types.horizontal) splitter$1.element.setAttribute(ATTRIBUTE_HORIZONTAL, "");
|
|
211
|
+
else splitter$1.element.removeAttribute(ATTRIBUTE_HORIZONTAL);
|
|
212
|
+
setAriaOrientation(splitter$1);
|
|
213
|
+
}
|
|
214
|
+
frame = void 0;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function onPointerdown(event) {
|
|
218
|
+
if (event.type === "mousedown" && supportsTouch.value || event.type === "touchstart" && !supportsTouch.value) return;
|
|
219
|
+
splitter = MAPPED_ELEMENTS.get(findAncestor(event.target, SELECTOR_HANDLE));
|
|
220
|
+
if (splitter == null) return;
|
|
221
|
+
if (supportsTouch.value) event.preventDefault();
|
|
222
|
+
splitter.handle.setAttribute(ATTRIBUTE_ACTIVE, "");
|
|
223
|
+
splitter.separator.setAttribute(ATTRIBUTE_ACTIVE, "");
|
|
224
|
+
splitter.rectangle = splitter.element.getBoundingClientRect();
|
|
225
|
+
STYLING_TOGGLER.set();
|
|
226
|
+
}
|
|
227
|
+
function onPointermove(event) {
|
|
228
|
+
if (splitter == null) return;
|
|
229
|
+
const position = getPosition(event);
|
|
230
|
+
if (position != null) {
|
|
231
|
+
splitter.values.now.current = getSize(splitter, splitter.types.horizontal ? position.y : position.x);
|
|
232
|
+
setSize(splitter, splitter.values.now.current);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function onPointerup() {
|
|
236
|
+
if (splitter != null) onEnd(false);
|
|
237
|
+
}
|
|
238
|
+
function setAriaOrientation(splitter$1) {
|
|
239
|
+
splitter$1.separator.setAttribute("aria-orientation", splitter$1.types.horizontal ? "horizontal" : "vertical");
|
|
240
|
+
}
|
|
241
|
+
function setAriaValue(splitter$1) {
|
|
242
|
+
splitter$1.separator.setAttribute("aria-valuemax", String(splitter$1.values.max));
|
|
243
|
+
splitter$1.separator.setAttribute("aria-valuemin", String(splitter$1.values.min));
|
|
244
|
+
splitter$1.separator.setAttribute("aria-valuenow", String(splitter$1.values.now.current));
|
|
245
|
+
}
|
|
246
|
+
function setSize(splitter$1, size, previous) {
|
|
247
|
+
splitter$1.values.now.current = size;
|
|
248
|
+
if (previous) splitter$1.values.now.previous = size;
|
|
249
|
+
splitter$1.element.style.setProperty("--oui-splitter-size", `${size}`);
|
|
250
|
+
setAriaValue(splitter$1);
|
|
251
|
+
}
|
|
252
|
+
var SELECTOR = "oui-splitter";
|
|
253
|
+
var ATTRIBUTE_ACTIVE = `${SELECTOR}-active`;
|
|
254
|
+
var ATTRIBUTE_HANDLE = `${SELECTOR}-handle`;
|
|
255
|
+
var ATTRIBUTE_HORIZONTAL = `${SELECTOR}-horizontal`;
|
|
256
|
+
var ATTRIBUTE_SEPARATOR = `${SELECTOR}-separator`;
|
|
257
|
+
var KEYS_ABSOLUTE = new Set(["End", "Home"]);
|
|
258
|
+
var KEYS_HORIZONTAL = new Set(["ArrowDown", "ArrowUp"]);
|
|
259
|
+
var KEYS_NEGATIVE = new Set(["ArrowLeft", "ArrowUp"]);
|
|
260
|
+
var KEYS_VERTICAL = new Set(["ArrowLeft", "ArrowRight"]);
|
|
261
|
+
var KEYS_ALL = new Set([
|
|
262
|
+
...KEYS_ABSOLUTE,
|
|
263
|
+
...KEYS_HORIZONTAL,
|
|
264
|
+
...KEYS_VERTICAL
|
|
265
|
+
]);
|
|
266
|
+
var MAPPED_ELEMENTS = /* @__PURE__ */ new WeakMap();
|
|
267
|
+
var METHODS_CONNECT = ["delete", "set"];
|
|
268
|
+
var METHODS_OBSERVE = ["unobserve", "observe"];
|
|
269
|
+
var NAVIGATION_MAXIMUM_PERCENTAGE = .9;
|
|
270
|
+
var NAVIGATION_MAXIMUM_TOTAL = 100;
|
|
271
|
+
var NAVIGATION_MINIMUM_PERCENTAGE = .1;
|
|
272
|
+
var NAVIGATION_MODIFIER = .05;
|
|
273
|
+
var RESIZE_OBSERVER = new ResizeObserver(onObservation);
|
|
274
|
+
var SELECTOR_HANDLE = `[${ATTRIBUTE_HANDLE}]`;
|
|
275
|
+
var STYLING_TOGGLER = toggleStyles(document.body, {
|
|
276
|
+
touchAction: "none",
|
|
277
|
+
userSelect: "none",
|
|
278
|
+
webkitUserSelect: "none"
|
|
279
|
+
});
|
|
280
|
+
var VALUE_DECIMALS = 6;
|
|
281
|
+
var frame;
|
|
282
|
+
var splitter;
|
|
283
|
+
customElements.define(SELECTOR, OuiSplitterElement);
|
|
205
284
|
on(document, "keydown", onKeydown);
|
|
206
|
-
on(document, "mousedown",
|
|
207
|
-
on(document, "
|
|
208
|
-
on(document, "
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
};
|
|
285
|
+
on(document, "mousedown", onPointerdown);
|
|
286
|
+
on(document, "pointermove", onPointermove);
|
|
287
|
+
on(document, "pointerup", onPointerup);
|
|
288
|
+
on(document, "touchcancel", onPointerup, { passive: false });
|
|
289
|
+
on(document, "touchstart", onPointerdown, { passive: false });
|
|
290
|
+
export { OuiSplitterElement };
|