@jsenv/dom 0.6.1 → 0.7.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/jsenv_dom.js +259 -314
- package/package.json +2 -4
- package/index.js +0 -124
- package/src/attr/add_attribute_effect.js +0 -93
- package/src/attr/attributes.js +0 -32
- package/src/color/color_constrast.js +0 -69
- package/src/color/color_parsing.js +0 -319
- package/src/color/color_scheme.js +0 -28
- package/src/color/pick_light_or_dark.js +0 -34
- package/src/color/resolve_css_color.js +0 -60
- package/src/demos/3_columns_resize_demo.html +0 -84
- package/src/demos/3_rows_resize_demo.html +0 -89
- package/src/demos/aside_and_main_demo.html +0 -93
- package/src/demos/coordinates_demo.html +0 -450
- package/src/demos/document_autoscroll_demo.html +0 -517
- package/src/demos/drag_gesture_constraints_demo.html +0 -701
- package/src/demos/drag_gesture_demo.html +0 -1047
- package/src/demos/drag_gesture_element_to_impact_demo.html +0 -445
- package/src/demos/drag_reference_element_demo.html +0 -480
- package/src/demos/flex_details_set_demo.html +0 -302
- package/src/demos/flex_details_set_demo_2.html +0 -315
- package/src/demos/visible_rect_demo.html +0 -525
- package/src/element_signature.js +0 -100
- package/src/interaction/drag/constraint_feedback_line.js +0 -92
- package/src/interaction/drag/drag_constraint.js +0 -659
- package/src/interaction/drag/drag_debug_markers.js +0 -635
- package/src/interaction/drag/drag_element_positioner.js +0 -382
- package/src/interaction/drag/drag_gesture.js +0 -566
- package/src/interaction/drag/drag_resize_demo.html +0 -571
- package/src/interaction/drag/drag_to_move.js +0 -301
- package/src/interaction/drag/drag_to_resize_gesture.js +0 -68
- package/src/interaction/drag/drop_target_detection.js +0 -148
- package/src/interaction/drag/sticky_frontiers.js +0 -160
- package/src/interaction/event_marker.js +0 -14
- package/src/interaction/focus/active_element.js +0 -33
- package/src/interaction/focus/arrow_navigation.js +0 -599
- package/src/interaction/focus/element_is_focusable.js +0 -57
- package/src/interaction/focus/element_visibility.js +0 -111
- package/src/interaction/focus/find_focusable.js +0 -21
- package/src/interaction/focus/focus_group.js +0 -91
- package/src/interaction/focus/focus_group_registry.js +0 -12
- package/src/interaction/focus/focus_nav.js +0 -12
- package/src/interaction/focus/focus_nav_event_marker.js +0 -14
- package/src/interaction/focus/focus_trap.js +0 -105
- package/src/interaction/focus/tab_navigation.js +0 -128
- package/src/interaction/focus/tests/focus_group_skip_tab_test.html +0 -206
- package/src/interaction/focus/tests/tree_focus_test.html +0 -304
- package/src/interaction/focus/tests/tree_focus_test.jsx +0 -261
- package/src/interaction/focus/tests/tree_focus_test_preact.html +0 -13
- package/src/interaction/isolate_interactions.js +0 -161
- package/src/interaction/keyboard.js +0 -26
- package/src/interaction/scroll/capture_scroll.js +0 -47
- package/src/interaction/scroll/is_scrollable.js +0 -159
- package/src/interaction/scroll/scroll_container.js +0 -110
- package/src/interaction/scroll/scroll_trap.js +0 -44
- package/src/interaction/scroll/scrollbar_size.js +0 -20
- package/src/interaction/scroll/wheel_through.js +0 -138
- package/src/iterable_weak_set.js +0 -66
- package/src/position/dom_coords.js +0 -340
- package/src/position/offset_parent.js +0 -15
- package/src/position/position_fixed.js +0 -15
- package/src/position/position_sticky.js +0 -213
- package/src/position/sticky_rect.js +0 -79
- package/src/position/visible_rect.js +0 -486
- package/src/pub_sub.js +0 -31
- package/src/size/can_take_size.js +0 -11
- package/src/size/details_content_full_height.js +0 -63
- package/src/size/flex_details_set.js +0 -974
- package/src/size/get_available_height.js +0 -22
- package/src/size/get_available_width.js +0 -22
- package/src/size/get_border_sizes.js +0 -14
- package/src/size/get_height.js +0 -4
- package/src/size/get_inner_height.js +0 -15
- package/src/size/get_inner_width.js +0 -15
- package/src/size/get_margin_sizes.js +0 -10
- package/src/size/get_max_height.js +0 -57
- package/src/size/get_max_width.js +0 -47
- package/src/size/get_min_height.js +0 -14
- package/src/size/get_min_width.js +0 -14
- package/src/size/get_padding_sizes.js +0 -10
- package/src/size/get_width.js +0 -4
- package/src/size/hooks/use_available_height.js +0 -27
- package/src/size/hooks/use_available_width.js +0 -27
- package/src/size/hooks/use_max_height.js +0 -10
- package/src/size/hooks/use_max_width.js +0 -10
- package/src/size/hooks/use_resize_status.js +0 -62
- package/src/size/resize.js +0 -695
- package/src/size/resolve_css_size.js +0 -32
- package/src/style/dom_styles.js +0 -97
- package/src/style/style_composition.js +0 -121
- package/src/style/style_controller.js +0 -345
- package/src/style/style_default.js +0 -153
- package/src/style/style_default_demo.html +0 -128
- package/src/style/style_parsing.js +0 -375
- package/src/transition/demos/animation_resumption_test.xhtml +0 -500
- package/src/transition/demos/height_toggle_test.xhtml +0 -515
- package/src/transition/dom_transition.js +0 -254
- package/src/transition/easing.js +0 -48
- package/src/transition/group_transition.js +0 -261
- package/src/transition/transform_style_parser.js +0 -32
- package/src/transition/transition_playback.js +0 -366
- package/src/transition/transition_timeline.js +0 -79
- package/src/traversal.js +0 -247
- package/src/ui_transition/demos/content_states_transition_demo.html +0 -628
- package/src/ui_transition/demos/smooth_height_transition_demo.html +0 -149
- package/src/ui_transition/demos/transition_testing.html +0 -354
- package/src/ui_transition/ui_transition.js +0 -1470
- package/src/utils.js +0 -69
- package/src/value_effect.js +0 -35
package/src/utils.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// https://github.com/davidtheclark/tabbable/blob/master/index.js
|
|
2
|
-
export const isDocumentElement = (node) =>
|
|
3
|
-
node === node.ownerDocument.documentElement;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* elementToOwnerWindow returns the window owning the element.
|
|
7
|
-
* Usually an element window will just be window.
|
|
8
|
-
* But when an element is inside an iframe, the window of that element
|
|
9
|
-
* is iframe.contentWindow
|
|
10
|
-
* It's often important to work with the correct window because
|
|
11
|
-
* element are scoped per iframes.
|
|
12
|
-
*/
|
|
13
|
-
export const elementToOwnerWindow = (element) => {
|
|
14
|
-
if (elementIsWindow(element)) {
|
|
15
|
-
return element;
|
|
16
|
-
}
|
|
17
|
-
if (elementIsDocument(element)) {
|
|
18
|
-
return element.defaultView;
|
|
19
|
-
}
|
|
20
|
-
return elementToOwnerDocument(element).defaultView;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* elementToOwnerDocument returns the document containing the element.
|
|
24
|
-
* Usually an element document is window.document.
|
|
25
|
-
* But when an element is inside an iframe, the document of that element
|
|
26
|
-
* is iframe.contentWindow.document
|
|
27
|
-
* It's often important to work with the correct document because
|
|
28
|
-
* element are scoped per iframes.
|
|
29
|
-
*/
|
|
30
|
-
export const elementToOwnerDocument = (element) => {
|
|
31
|
-
if (elementIsWindow(element)) {
|
|
32
|
-
return element.document;
|
|
33
|
-
}
|
|
34
|
-
if (elementIsDocument(element)) {
|
|
35
|
-
return element;
|
|
36
|
-
}
|
|
37
|
-
return element.ownerDocument;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const elementIsWindow = (a) => a.window === a;
|
|
41
|
-
export const elementIsDocument = (a) => a.nodeType === 9;
|
|
42
|
-
export const elementIsIframe = ({ nodeName }) => nodeName === "IFRAME";
|
|
43
|
-
export const elementIsDetails = ({ nodeName }) => nodeName === "DETAILS";
|
|
44
|
-
export const elementIsSummary = ({ nodeName }) => nodeName === "SUMMARY";
|
|
45
|
-
|
|
46
|
-
// should be used ONLY when an element is related to other elements that are not descendants of this element
|
|
47
|
-
export const getAssociatedElements = (element) => {
|
|
48
|
-
if (element.tagName === "COL") {
|
|
49
|
-
const columnCells = [];
|
|
50
|
-
const colgroup = element.parentNode;
|
|
51
|
-
const columnIndex = Array.from(colgroup.children).indexOf(element);
|
|
52
|
-
const table = element.closest("table");
|
|
53
|
-
const rows = table.querySelectorAll("tr");
|
|
54
|
-
for (const row of rows) {
|
|
55
|
-
const rowCells = row.children;
|
|
56
|
-
for (const rowCell of rowCells) {
|
|
57
|
-
if (rowCell.cellIndex === columnIndex) {
|
|
58
|
-
columnCells.push(rowCell);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return columnCells;
|
|
63
|
-
}
|
|
64
|
-
// if (element.tagName === "TR") {
|
|
65
|
-
// const rowCells = Array.from(element.children);
|
|
66
|
-
// return rowCells;
|
|
67
|
-
// }
|
|
68
|
-
return null;
|
|
69
|
-
};
|
package/src/value_effect.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export const createValueEffect = (value) => {
|
|
2
|
-
const callbackSet = new Set();
|
|
3
|
-
const valueCleanupSet = new Set();
|
|
4
|
-
|
|
5
|
-
const cleanup = () => {
|
|
6
|
-
for (const valueCleanup of valueCleanupSet) {
|
|
7
|
-
valueCleanup();
|
|
8
|
-
}
|
|
9
|
-
valueCleanupSet.clear();
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const updateValue = (newValue) => {
|
|
13
|
-
if (newValue === value) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
cleanup();
|
|
17
|
-
const oldValue = value;
|
|
18
|
-
value = newValue;
|
|
19
|
-
for (const callback of callbackSet) {
|
|
20
|
-
const returnValue = callback(newValue, oldValue);
|
|
21
|
-
if (typeof returnValue === "function") {
|
|
22
|
-
valueCleanupSet.add(returnValue);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const addEffect = (callback) => {
|
|
28
|
-
callbackSet.add(callback);
|
|
29
|
-
return () => {
|
|
30
|
-
callbackSet.delete(callback);
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return [updateValue, addEffect, cleanup];
|
|
35
|
-
};
|