@stimulus-plumbers/controllers 0.2.9 → 0.3.1
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 +6 -0
- package/dist/stimulus-plumbers-controllers.es.js +246 -269
- package/dist/stimulus-plumbers-controllers.umd.js +1 -1
- package/package.json +1 -1
- package/src/controllers/calendar_month_controller.js +3 -1
- package/src/controllers/calendar_month_observer_controller.js +1 -1
- package/src/controllers/combobox_date_controller.js +1 -1
- package/src/controllers/combobox_dropdown_controller.js +24 -15
- package/src/controllers/input_combobox_controller.js +1 -1
- package/src/controllers/input_format_controller.js +1 -1
- package/src/controllers/modal_controller.js +2 -2
- package/src/index.js +8 -4
- package/src/plumbers/calendar.js +1 -1
- package/src/plumbers/content_loader.js +9 -63
- package/src/plumbers/dismisser.js +3 -51
- package/src/plumbers/flipper.js +12 -120
- package/src/plumbers/index.js +0 -1
- package/src/plumbers/plumber/config.js +6 -0
- package/src/plumbers/plumber/date.js +14 -0
- package/src/plumbers/plumber/geometry.js +36 -0
- package/src/plumbers/plumber/index.js +2 -1
- package/src/plumbers/plumber/window_observer.js +22 -0
- package/src/plumbers/shifter.js +8 -80
- package/src/plumbers/visibility.js +1 -1
- package/src/requestor.js +24 -0
- package/src/researcher.js +39 -0
- package/src/plumbers/combobox_dropdown.js +0 -60
- package/src/plumbers/plumber/support.js +0 -101
- /package/src/{aria.js → accessibility/aria.js} +0 -0
- /package/src/{focus.js → accessibility/focus.js} +0 -0
- /package/src/{keyboard.js → accessibility/keyboard.js} +0 -0
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
export const visibilityConfig = {
|
|
2
|
-
get visibleOnly() {
|
|
3
|
-
return true;
|
|
4
|
-
},
|
|
5
|
-
hiddenClass: null,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Maps each direction to its opposite direction.
|
|
10
|
-
* Used for flipping and boundary calculations.
|
|
11
|
-
*/
|
|
12
|
-
export const directionMap = {
|
|
13
|
-
get top() {
|
|
14
|
-
return 'bottom';
|
|
15
|
-
},
|
|
16
|
-
get bottom() {
|
|
17
|
-
return 'top';
|
|
18
|
-
},
|
|
19
|
-
get left() {
|
|
20
|
-
return 'right';
|
|
21
|
-
},
|
|
22
|
-
get right() {
|
|
23
|
-
return 'left';
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Creates a rect object with position and dimension properties.
|
|
29
|
-
* @param {Object} params - Rectangle parameters
|
|
30
|
-
* @param {number} params.x - X coordinate
|
|
31
|
-
* @param {number} params.y - Y coordinate
|
|
32
|
-
* @param {number} params.width - Width
|
|
33
|
-
* @param {number} params.height - Height
|
|
34
|
-
* @returns {Object} Rect object with x, y, width, height, left, right, top, bottom properties
|
|
35
|
-
*/
|
|
36
|
-
export function defineRect({ x, y, width, height }) {
|
|
37
|
-
return {
|
|
38
|
-
x: x,
|
|
39
|
-
y: y,
|
|
40
|
-
width: width,
|
|
41
|
-
height: height,
|
|
42
|
-
left: x,
|
|
43
|
-
right: x + width,
|
|
44
|
-
top: y,
|
|
45
|
-
bottom: y + height,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Returns the current viewport dimensions as a rect object.
|
|
51
|
-
* @returns {Object} Viewport rect with dimensions and boundaries
|
|
52
|
-
*/
|
|
53
|
-
export function viewportRect() {
|
|
54
|
-
return defineRect({
|
|
55
|
-
x: 0,
|
|
56
|
-
y: 0,
|
|
57
|
-
width: window.innerWidth || document.documentElement.clientWidth,
|
|
58
|
-
height: window.innerHeight || document.documentElement.clientHeight,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Checks if an element is within the visible viewport.
|
|
64
|
-
* @param {HTMLElement} target - Element to check
|
|
65
|
-
* @returns {boolean} True if element is within viewport
|
|
66
|
-
*/
|
|
67
|
-
export function isWithinViewport(target) {
|
|
68
|
-
if (!(target instanceof HTMLElement)) return false;
|
|
69
|
-
|
|
70
|
-
const outer = viewportRect();
|
|
71
|
-
const inner = target.getBoundingClientRect();
|
|
72
|
-
const vertical = inner.top <= outer.height && inner.top + inner.height > 0;
|
|
73
|
-
const horizontal = inner.left <= outer.width && inner.left + inner.width > 0;
|
|
74
|
-
return vertical && horizontal;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Validates if a value is a valid Date object.
|
|
79
|
-
* @param {*} value - Value to check
|
|
80
|
-
* @returns {boolean} True if value is a valid Date
|
|
81
|
-
*/
|
|
82
|
-
export function isValidDate(value) {
|
|
83
|
-
return value instanceof Date && !isNaN(value);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Attempts to parse values into a Date object.
|
|
88
|
-
* @param {...*} values - Date values to parse
|
|
89
|
-
* @returns {Date|undefined} Parsed Date object or undefined if invalid
|
|
90
|
-
* @throws {string} If no values provided
|
|
91
|
-
*/
|
|
92
|
-
export function tryParseDate(...values) {
|
|
93
|
-
if (values.length === 0) throw 'Missing values to parse as date';
|
|
94
|
-
if (values.length === 1) {
|
|
95
|
-
const parsed = new Date(values[0]);
|
|
96
|
-
if (values[0] && isValidDate(parsed)) return parsed;
|
|
97
|
-
} else {
|
|
98
|
-
const parsed = new Date(...values);
|
|
99
|
-
if (isValidDate(parsed)) return parsed;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|