@oscarpalmer/oui 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/css/a11y.css +0 -1
  2. package/dist/css/badge.css +10 -10
  3. package/dist/css/button.css +9 -9
  4. package/dist/css/color.css +99 -99
  5. package/dist/css/content.css +1 -1
  6. package/dist/css/flex.css +39 -39
  7. package/dist/css/form.css +29 -57
  8. package/dist/css/message.css +6 -6
  9. package/dist/css/popover.css +22 -0
  10. package/dist/css/reset.css +11 -10
  11. package/dist/css/table.css +5 -5
  12. package/dist/css/tooltip.css +61 -1
  13. package/dist/js/attributable.d.mts +4 -0
  14. package/dist/js/{attributable.js → attributable.mjs} +8 -1
  15. package/dist/js/floatable.d.mts +26 -0
  16. package/dist/js/{floatable.js → floatable.mjs} +73 -50
  17. package/dist/js/focus-trap/embedded.d.mts +26 -0
  18. package/dist/js/focus-trap/{embedded.js → embedded.mjs} +10 -8
  19. package/dist/js/focus-trap/standalone.d.mts +1 -0
  20. package/dist/js/focus-trap/{standalone.js → standalone.mjs} +5 -2
  21. package/dist/js/index.d.mts +4 -0
  22. package/dist/js/index.mjs +5 -0
  23. package/dist/js/popover.d.mts +20 -0
  24. package/dist/js/{popover.js → popover.mjs} +11 -9
  25. package/dist/js/splitter.d.mts +25 -0
  26. package/dist/js/{splitter.js → splitter.mjs} +60 -58
  27. package/dist/js/tooltip.d.mts +4 -0
  28. package/dist/js/{tooltip.js → tooltip.mjs} +21 -19
  29. package/package.json +65 -70
  30. package/src/css/a11y.scss +1 -1
  31. package/src/css/badge.scss +23 -19
  32. package/src/css/button.scss +9 -9
  33. package/src/css/color.scss +99 -99
  34. package/src/css/content.scss +6 -8
  35. package/src/css/flex.scss +21 -20
  36. package/src/css/form.scss +37 -60
  37. package/src/css/message.scss +8 -12
  38. package/src/css/mixins.scss +41 -13
  39. package/src/css/popover.scss +7 -2
  40. package/src/css/reset.scss +18 -18
  41. package/src/css/splitter.scss +15 -13
  42. package/src/css/table.scss +12 -12
  43. package/src/css/tooltip.scss +79 -4
  44. package/src/js/attributable.ts +14 -11
  45. package/src/js/floatable.ts +134 -74
  46. package/src/js/focus-trap/embedded.ts +7 -31
  47. package/src/js/popover.ts +3 -3
  48. package/src/js/splitter.ts +10 -43
  49. package/src/js/tooltip.ts +8 -20
  50. package/dist/css/value.css +0 -1
  51. package/dist/js/attributable.full.js +0 -48
  52. package/dist/js/floatable.full.js +0 -413
  53. package/dist/js/focus-trap/embedded.full.js +0 -351
  54. package/dist/js/focus-trap/standalone.full.js +0 -402
  55. package/dist/js/index.js +0 -5
  56. package/dist/js/oui.full.js +0 -1596
  57. package/dist/js/popover.full.js +0 -822
  58. package/dist/js/splitter.full.js +0 -605
  59. package/dist/js/tooltip.full.js +0 -679
  60. package/types/attributable.d.ts +0 -1
  61. package/types/floatable.d.ts +0 -24
  62. package/types/focus-trap/embedded.d.ts +0 -24
  63. package/types/focus-trap/standalone.d.ts +0 -1
  64. package/types/index.d.ts +0 -4
  65. package/types/popover.d.ts +0 -17
  66. package/types/splitter.d.ts +0 -23
  67. package/types/tooltip.d.ts +0 -2
@@ -1,605 +0,0 @@
1
- function isNumber(value) {
2
- return typeof value === "number" && !Number.isNaN(value);
3
- }
4
- function isPlainObject(value) {
5
- if (value === null || typeof value !== "object") return false;
6
- if (Symbol.toStringTag in value || Symbol.iterator in value) return false;
7
- const prototype = Object.getPrototypeOf(value);
8
- return prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null;
9
- }
10
-
11
- function compact(array, strict) {
12
- if (!Array.isArray(array)) return [];
13
- const { length } = array;
14
- const compacted = [];
15
- for (let index = 0; index < length; index += 1) {
16
- const item = array[index];
17
- if (item != null) compacted.push(item);
18
- }
19
- return compacted;
20
- }
21
-
22
- function getString(value) {
23
- if (typeof value === "string") return value;
24
- if (value == null) return "";
25
- if (typeof value !== "object") return String(value);
26
- const asString = String(value.valueOf?.() ?? value);
27
- return asString.startsWith("[object ") ? JSON.stringify(value) : asString;
28
- }
29
- function join(value, delimiter) {
30
- return compact(value).map(getString).join(delimiter );
31
- }
32
- function words(value) {
33
- return typeof value === "string" ? value.match(EXPRESSION_WORDS) ?? [] : [];
34
- }
35
- var EXPRESSION_WORDS = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
36
-
37
- function isNullableOrWhitespace(value) {
38
- return value == null || EXPRESSION_WHITESPACE.test(getString(value));
39
- }
40
- var EXPRESSION_WHITESPACE = /^\s*$/;
41
-
42
- function round(value, decimals) {
43
- if (typeof value !== "number") return NaN;
44
- const mod = 10 ** decimals;
45
- return Math.round((value + Number.EPSILON) * mod) / mod;
46
- }
47
-
48
- function clamp(value, minimum, maximum, loop) {
49
- if (![
50
- value,
51
- minimum,
52
- maximum
53
- ].every(isNumber)) return NaN;
54
- if (value < minimum) return loop === true ? maximum : minimum;
55
- return value > maximum ? loop === true ? minimum : maximum : value;
56
- }
57
-
58
- function isEventTarget(value) {
59
- return typeof value === "object" && value != null && typeof value.addEventListener === "function" && typeof value.removeEventListener === "function" && typeof value.dispatchEvent === "function";
60
- }
61
- function isHTMLOrSVGElement(value) {
62
- return value instanceof HTMLElement || value instanceof SVGElement;
63
- }
64
-
65
- function camelCase(value) {
66
- return toCase(value, "");
67
- }
68
- function capitalize(value) {
69
- if (typeof value !== "string" || value.length === 0) return "";
70
- return value.length === 1 ? value.toLocaleUpperCase() : `${value.charAt(0).toLocaleUpperCase()}${value.slice(1).toLocaleLowerCase()}`;
71
- }
72
- function toCase(value, delimiter, capitalizeAny, capitalizeFirst) {
73
- if (typeof value !== "string") return "";
74
- if (value.length < 1) return value;
75
- const parts = words(value);
76
- const partsLength = parts.length;
77
- const result = [];
78
- for (let partIndex = 0; partIndex < partsLength; partIndex += 1) {
79
- const items = parts[partIndex].replace(EXPRESSION_ACRONYM, (full, one, two, three) => three === "s" ? full : `${one}-${two}${three}`).replace(EXPRESSION_CAMEL_CASE, "$1-$2").split("-");
80
- const itemsLength = items.length;
81
- const partResult = [];
82
- let itemCount = 0;
83
- for (let itemIndex = 0; itemIndex < itemsLength; itemIndex += 1) {
84
- const item = items[itemIndex];
85
- if (item.length === 0) continue;
86
- if (itemCount === 0 && partIndex === 0 && true) partResult.push(item.toLocaleLowerCase());
87
- else partResult.push(capitalize(item));
88
- itemCount += 1;
89
- }
90
- result.push(join(partResult, delimiter));
91
- }
92
- return join(result, delimiter);
93
- }
94
- var EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
95
- var EXPRESSION_ACRONYM = /(\p{Lu}*)(\p{Lu})(\p{Ll}+)/gu;
96
-
97
- function getBoolean(value, defaultValue) {
98
- return typeof value === "boolean" ? value : defaultValue ?? false;
99
- }
100
- function getStyleValue(element, property, computed) {
101
- const name = camelCase(property);
102
- return computed ? getComputedStyle(element)[name] : element.style[name];
103
- }
104
-
105
- function calculate() {
106
- return new Promise((resolve) => {
107
- const values = [];
108
- let last;
109
- function step(now) {
110
- if (last != null) values.push(now - last);
111
- last = now;
112
- if (values.length >= CALCULATION_TOTAL) {
113
- const median = values.sort().slice(2, -2).reduce((first, second) => first + second, 0) / (values.length - CALCULATION_TRIM);
114
- resolve(median);
115
- } else requestAnimationFrame(step);
116
- }
117
- requestAnimationFrame(step);
118
- });
119
- }
120
- function noop() {}
121
- var CALCULATION_TOTAL = 10;
122
- var CALCULATION_TRIM = 4;
123
- calculate().then((value) => {
124
- });
125
-
126
- function createEventOptions(options) {
127
- return {
128
- capture: getBoolean(options?.capture),
129
- once: getBoolean(options?.once),
130
- passive: getBoolean(options?.passive, true),
131
- signal: options?.signal
132
- };
133
- }
134
- function getPosition(event) {
135
- let x;
136
- let y;
137
- if (event instanceof MouseEvent) {
138
- x = event.clientX;
139
- y = event.clientY;
140
- } else if (event instanceof TouchEvent) {
141
- x = event.touches[0]?.clientX;
142
- y = event.touches[0]?.clientY;
143
- }
144
- return typeof x === "number" && typeof y === "number" ? {
145
- x,
146
- y
147
- } : void 0;
148
- }
149
- function on(target, type, listener, options) {
150
- if (!isEventTarget(target) || typeof type !== "string" || typeof listener !== "function") return noop;
151
- const extended = createEventOptions(options);
152
- target.addEventListener(type, listener, extended);
153
- return () => {
154
- target.removeEventListener(type, listener, extended);
155
- };
156
- }
157
-
158
- function findAncestor(origin, selector) {
159
- if (!(origin instanceof Element) || selector == null) return null;
160
- if (typeof selector === "string") {
161
- if (origin.matches?.(selector)) return origin;
162
- return origin.closest(selector);
163
- }
164
- if (typeof selector !== "function") return null;
165
- if (selector(origin)) return origin;
166
- let parent = origin.parentElement;
167
- while (parent != null && !selector(parent)) {
168
- if (parent === document.body) return null;
169
- parent = parent.parentElement;
170
- }
171
- return parent;
172
- }
173
-
174
- function setElementValues(element, first, second, callback) {
175
- if (!isHTMLOrSVGElement(element)) return;
176
- if (isPlainObject(first)) {
177
- const entries = Object.entries(first);
178
- const { length } = entries;
179
- for (let index = 0; index < length; index += 1) {
180
- const [key, value] = entries[index];
181
- callback(element, key, value);
182
- }
183
- } else if (typeof first === "string") callback(element, first, second);
184
- }
185
- function updateElementValue(element, key, value, set, remove, json) {
186
- if (isNullableOrWhitespace(value)) remove.call(element, key);
187
- else set.call(element, key, String(value));
188
- }
189
-
190
- function getStyles(element, properties, computed) {
191
- const styles = {};
192
- if (!(isHTMLOrSVGElement(element) && Array.isArray(properties))) return styles;
193
- const { length } = properties;
194
- for (let index = 0; index < length; index += 1) {
195
- const property = properties[index];
196
- if (typeof property === "string") styles[property] = getStyleValue(element, property, computed === true);
197
- }
198
- return styles;
199
- }
200
- function setStyles(element, styles) {
201
- setElementValues(element, styles, null, updateStyleProperty);
202
- }
203
- function toggleStyles(element, styles) {
204
- function toggle(set) {
205
- hasSet = set;
206
- let next;
207
- if (set) {
208
- values = getStyles(element, keys);
209
- next = styles;
210
- } else {
211
- next = { ...values };
212
- values = {};
213
- for (const key of keys) values[key] = void 0;
214
- }
215
- setStyles(element, next);
216
- }
217
- const keys = Object.keys(styles);
218
- let hasSet = false;
219
- let values = {};
220
- return {
221
- set() {
222
- if (!hasSet) toggle(true);
223
- },
224
- remove() {
225
- if (hasSet) toggle(false);
226
- }
227
- };
228
- }
229
- function updateStyleProperty(element, key, value) {
230
- updateElementValue(element, key, value, function(property, value$1) {
231
- this.style[property] = value$1;
232
- }, function(property) {
233
- this.style[property] = "";
234
- });
235
- }
236
-
237
- function getSupport() {
238
- if (window == null || navigator == null) return false;
239
- if ("matchMedia" in window) {
240
- const media = matchMedia?.("(pointer: coarse)");
241
- if (typeof media?.matches === "boolean" && media.matches) return true;
242
- }
243
- if ("ontouchstart" in window) return true;
244
- if (typeof navigator.maxTouchPoints === "number" && navigator.maxTouchPoints > 0) return true;
245
- if (typeof navigator.msMaxTouchPoints === "number" && navigator.msMaxTouchPoints > 0) return true;
246
- return false;
247
- }
248
- var touch_default = (() => {
249
- let support = getSupport();
250
- const instance = Object.create({
251
- get() {
252
- return support;
253
- },
254
- update() {
255
- support = getSupport();
256
- return support;
257
- }
258
- });
259
- Object.defineProperty(instance, "value", { get() {
260
- return support;
261
- } });
262
- return instance;
263
- })();
264
-
265
- class OuiSplitterElement extends HTMLElement {
266
- static observedAttributes = ['max', 'min', 'size', 'type'];
267
- #splitter;
268
- // Getters and setters
269
- get max() {
270
- return this.#splitter.values.max;
271
- }
272
- set max(value) {
273
- this.setAttribute('max', String(value));
274
- }
275
- get min() {
276
- return this.#splitter.values.min;
277
- }
278
- set min(value) {
279
- this.setAttribute('min', String(value));
280
- }
281
- get size() {
282
- return this.#splitter.values.now.current;
283
- }
284
- set size(value) {
285
- this.setAttribute('size', String(value));
286
- }
287
- get type() {
288
- return this.getAttribute('type') ?? 'vertical';
289
- }
290
- set type(value) {
291
- this.setAttribute('type', value);
292
- }
293
- // Constructor
294
- constructor() {
295
- super();
296
- const panels = [...this.children].filter(child => child instanceof HTMLElement);
297
- if (panels.length !== 2) {
298
- throw new Error(`${SELECTOR} must have exactly two panels.`);
299
- }
300
- this.#splitter = new Splitter(this, panels);
301
- }
302
- // Methods
303
- connectedCallback() {
304
- this.#splitter.updateConnections(1);
305
- }
306
- disconnectedCallback() {
307
- this.#splitter.updateConnections(0);
308
- }
309
- attributeChangedCallback(name) {
310
- switch (name) {
311
- case 'max':
312
- case 'min':
313
- case 'size':
314
- this.#splitter.updateValues();
315
- break;
316
- case 'type':
317
- this.#splitter.updateOrientation();
318
- break;
319
- }
320
- }
321
- }
322
- let index = 0;
323
- class Splitter {
324
- element;
325
- handle;
326
- panels;
327
- rectangle;
328
- separator;
329
- types;
330
- values;
331
- constructor(element, panels) {
332
- this.element = element;
333
- this.panels = panels;
334
- if (isNullableOrWhitespace(element.id)) {
335
- element.id = `oui_splitter_${++index}`;
336
- }
337
- this.values = getValues(element);
338
- this.handle = createHandle();
339
- this.rectangle = element.getBoundingClientRect();
340
- this.separator = createSeparator(this);
341
- this.separator.append(this.handle);
342
- panels[0].insertAdjacentElement('afterend', this.separator);
343
- this.updateOrientation();
344
- this.updateValues();
345
- }
346
- updateConnections(add) {
347
- const method = METHODS_CONNECT[add];
348
- MAPPED_ELEMENTS[method](this.element, this);
349
- MAPPED_ELEMENTS[method](this.handle, this);
350
- MAPPED_ELEMENTS[method](this.separator, this);
351
- if (this.types.auto) {
352
- RESIZE_OBSERVER[METHODS_OBSERVE[add]](this.element);
353
- }
354
- }
355
- updateOrientation() {
356
- this.types = getTypes(this);
357
- if (this.types.auto) {
358
- RESIZE_OBSERVER.observe(this.element);
359
- }
360
- else {
361
- RESIZE_OBSERVER.unobserve(this.element);
362
- }
363
- if (this.types.horizontal) {
364
- this.element.setAttribute(ATTRIBUTE_HORIZONTAL, '');
365
- }
366
- else {
367
- this.element.removeAttribute(ATTRIBUTE_HORIZONTAL);
368
- }
369
- setAriaOrientation(this);
370
- }
371
- updateValues() {
372
- this.values = getValues(this.element);
373
- requestAnimationFrame(() => {
374
- setSize(this, this.values.now.current);
375
- setAriaValue(this);
376
- });
377
- }
378
- }
379
- //
380
- function createHandle() {
381
- const handle = document.createElement('span');
382
- handle.setAttribute('aria-hidden', 'true');
383
- handle.setAttribute(ATTRIBUTE_HANDLE, '');
384
- return handle;
385
- }
386
- function createSeparator(splitter) {
387
- const separator = document.createElement('div');
388
- separator.role = 'separator';
389
- separator.tabIndex = 0;
390
- separator.setAttribute('aria-controls', splitter.element.id);
391
- separator.setAttribute('aria-label', 'Resize panels');
392
- separator.setAttribute(ATTRIBUTE_SEPARATOR, '');
393
- return separator;
394
- }
395
- function getContained(min, value, max) {
396
- return round(clamp(value, min, max), VALUE_DECIMALS);
397
- }
398
- function getSize(splitter, value) {
399
- const { height, left, top, width } = splitter.rectangle;
400
- const offset = value - (splitter.types.horizontal ? top : left);
401
- const fraction = offset / (splitter.types.horizontal ? height : width);
402
- return getContained(splitter.values.min, fraction, splitter.values.max);
403
- }
404
- function getTypes(splitter, width, height) {
405
- const type = splitter.element.getAttribute('type')?.trim() ?? '';
406
- if (type === 'horizontal') {
407
- return {
408
- auto: false,
409
- horizontal: true,
410
- };
411
- }
412
- if (type === 'auto') {
413
- return {
414
- auto: true,
415
- horizontal: (height ?? splitter.rectangle.height) >
416
- (width ?? splitter.rectangle.width),
417
- };
418
- }
419
- return {
420
- auto: false,
421
- horizontal: false,
422
- };
423
- }
424
- function getValue(element, name, defaultValue) {
425
- const value = element.getAttribute(name);
426
- if (isNullableOrWhitespace(value)) {
427
- return defaultValue;
428
- }
429
- const parsed = Number.parseFloat(value);
430
- if (Number.isNaN(parsed)) {
431
- return defaultValue;
432
- }
433
- if (parsed < 0) {
434
- return defaultValue;
435
- }
436
- return parsed > 1 ? parsed / NAVIGATION_MAXIMUM_TOTAL : parsed;
437
- }
438
- function getValues(element) {
439
- const values = {
440
- max: getValue(element, 'max', NAVIGATION_MAXIMUM_PERCENTAGE),
441
- min: getValue(element, 'min', NAVIGATION_MINIMUM_PERCENTAGE),
442
- now: {
443
- current: 0.5,
444
- previous: 0.5,
445
- },
446
- };
447
- const value = getContained(values.min, getValue(element, 'size', values.now.current), values.max);
448
- values.now.current = value;
449
- values.now.previous = value;
450
- return values;
451
- }
452
- function onEnd(reset) {
453
- if (splitter == null) {
454
- return;
455
- }
456
- splitter.handle.removeAttribute(ATTRIBUTE_ACTIVE);
457
- splitter.separator.removeAttribute(ATTRIBUTE_ACTIVE);
458
- if (reset) {
459
- setSize(splitter, splitter.values.now.previous);
460
- }
461
- else {
462
- splitter.values.now.previous = splitter.values.now.current;
463
- }
464
- splitter = undefined;
465
- STYLING_TOGGLER.remove();
466
- }
467
- function onKeydown(event) {
468
- switch (true) {
469
- case KEYS_ALL.has(event.key):
470
- onNavigate(event);
471
- break;
472
- case event.key === 'Escape':
473
- onEnd(true);
474
- break;
475
- }
476
- }
477
- function onNavigate(event) {
478
- const splitter = MAPPED_ELEMENTS.get(findAncestor(event.target, '[oui-splitter-separator]'));
479
- if (splitter == null) {
480
- return;
481
- }
482
- const { types, values } = splitter;
483
- if (KEYS_ABSOLUTE.has(event.key)) {
484
- setSize(splitter, event.key === 'End' ? values.max : values.min, true);
485
- return;
486
- }
487
- if ((types.horizontal && !KEYS_HORIZONTAL.has(event.key)) ||
488
- !(types.horizontal || KEYS_VERTICAL.has(event.key))) {
489
- return;
490
- }
491
- const offset = KEYS_NEGATIVE.has(event.key) ? -1 : 1;
492
- setSize(splitter, getContained(values.min, values.now.current + offset * NAVIGATION_MODIFIER, values.max), true);
493
- }
494
- function onObservation(entries) {
495
- if (frame != null) {
496
- cancelAnimationFrame(frame);
497
- }
498
- frame = requestAnimationFrame(() => {
499
- for (const entry of entries) {
500
- const splitter = MAPPED_ELEMENTS.get(entry.target);
501
- if (splitter == null) {
502
- return;
503
- }
504
- splitter.types = getTypes(splitter, entry.contentRect.width, entry.contentRect.height);
505
- if (splitter.types.horizontal) {
506
- splitter.element.setAttribute(ATTRIBUTE_HORIZONTAL, '');
507
- }
508
- else {
509
- splitter.element.removeAttribute(ATTRIBUTE_HORIZONTAL);
510
- }
511
- setAriaOrientation(splitter);
512
- }
513
- frame = undefined;
514
- });
515
- }
516
- function onPointerdown(event) {
517
- if ((event.type === 'mousedown' && touch_default.value) ||
518
- (event.type === 'touchstart' && !touch_default.value)) {
519
- return;
520
- }
521
- splitter = MAPPED_ELEMENTS.get(findAncestor(event.target, SELECTOR_HANDLE));
522
- if (splitter == null) {
523
- return;
524
- }
525
- if (touch_default.value) {
526
- event.preventDefault();
527
- }
528
- splitter.handle.setAttribute(ATTRIBUTE_ACTIVE, '');
529
- splitter.separator.setAttribute(ATTRIBUTE_ACTIVE, '');
530
- splitter.rectangle = splitter.element.getBoundingClientRect();
531
- STYLING_TOGGLER.set();
532
- }
533
- function onPointermove(event) {
534
- if (splitter == null) {
535
- return;
536
- }
537
- const position = getPosition(event);
538
- if (position != null) {
539
- splitter.values.now.current = getSize(splitter, splitter.types.horizontal ? position.y : position.x);
540
- setSize(splitter, splitter.values.now.current);
541
- }
542
- }
543
- function onPointerup() {
544
- if (splitter != null) {
545
- onEnd(false);
546
- }
547
- }
548
- function setAriaOrientation(splitter) {
549
- splitter.separator.setAttribute('aria-orientation', splitter.types.horizontal ? 'horizontal' : 'vertical');
550
- }
551
- function setAriaValue(splitter) {
552
- splitter.separator.setAttribute('aria-valuemax', String(splitter.values.max));
553
- splitter.separator.setAttribute('aria-valuemin', String(splitter.values.min));
554
- splitter.separator.setAttribute('aria-valuenow', String(splitter.values.now.current));
555
- }
556
- function setSize(splitter, size, previous) {
557
- splitter.values.now.current = size;
558
- if (previous) {
559
- splitter.values.now.previous = size;
560
- }
561
- splitter.element.style.setProperty('--oui-splitter-size', `${size}`);
562
- setAriaValue(splitter);
563
- }
564
- //
565
- const SELECTOR = 'oui-splitter';
566
- const ATTRIBUTE_ACTIVE = `${SELECTOR}-active`;
567
- const ATTRIBUTE_HANDLE = `${SELECTOR}-handle`;
568
- const ATTRIBUTE_HORIZONTAL = `${SELECTOR}-horizontal`;
569
- const ATTRIBUTE_SEPARATOR = `${SELECTOR}-separator`;
570
- const KEYS_ABSOLUTE = new Set(['End', 'Home']);
571
- const KEYS_HORIZONTAL = new Set(['ArrowDown', 'ArrowUp']);
572
- const KEYS_NEGATIVE = new Set(['ArrowLeft', 'ArrowUp']);
573
- const KEYS_VERTICAL = new Set(['ArrowLeft', 'ArrowRight']);
574
- const KEYS_ALL = new Set([
575
- ...KEYS_ABSOLUTE,
576
- ...KEYS_HORIZONTAL,
577
- ...KEYS_VERTICAL,
578
- ]);
579
- const MAPPED_ELEMENTS = new WeakMap();
580
- const METHODS_CONNECT = ['delete', 'set'];
581
- const METHODS_OBSERVE = ['unobserve', 'observe'];
582
- const NAVIGATION_MAXIMUM_PERCENTAGE = 0.9;
583
- const NAVIGATION_MAXIMUM_TOTAL = 100;
584
- const NAVIGATION_MINIMUM_PERCENTAGE = 0.1;
585
- const NAVIGATION_MODIFIER = 0.05;
586
- const RESIZE_OBSERVER = new ResizeObserver(onObservation);
587
- const SELECTOR_HANDLE = `[${ATTRIBUTE_HANDLE}]`;
588
- const STYLING_TOGGLER = toggleStyles(document.body, {
589
- touchAction: 'none',
590
- userSelect: 'none',
591
- webkitUserSelect: 'none',
592
- });
593
- const VALUE_DECIMALS = 6;
594
- let frame;
595
- let splitter;
596
- //
597
- customElements.define(SELECTOR, OuiSplitterElement);
598
- on(document, 'keydown', onKeydown);
599
- on(document, 'mousedown', onPointerdown);
600
- on(document, 'pointermove', onPointermove);
601
- on(document, 'pointerup', onPointerup);
602
- on(document, 'touchcancel', onPointerup, { passive: false });
603
- on(document, 'touchstart', onPointerdown, { passive: false });
604
-
605
- export { OuiSplitterElement };