@jsenv/dom 0.6.0 → 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.
Files changed (109) hide show
  1. package/dist/jsenv_dom.js +262 -330
  2. package/package.json +2 -4
  3. package/index.js +0 -124
  4. package/src/attr/add_attribute_effect.js +0 -93
  5. package/src/attr/attributes.js +0 -32
  6. package/src/color/color_constrast.js +0 -69
  7. package/src/color/color_parsing.js +0 -319
  8. package/src/color/color_scheme.js +0 -28
  9. package/src/color/pick_light_or_dark.js +0 -34
  10. package/src/color/resolve_css_color.js +0 -60
  11. package/src/demos/3_columns_resize_demo.html +0 -84
  12. package/src/demos/3_rows_resize_demo.html +0 -89
  13. package/src/demos/aside_and_main_demo.html +0 -93
  14. package/src/demos/coordinates_demo.html +0 -450
  15. package/src/demos/document_autoscroll_demo.html +0 -517
  16. package/src/demos/drag_gesture_constraints_demo.html +0 -701
  17. package/src/demos/drag_gesture_demo.html +0 -1047
  18. package/src/demos/drag_gesture_element_to_impact_demo.html +0 -445
  19. package/src/demos/drag_reference_element_demo.html +0 -480
  20. package/src/demos/flex_details_set_demo.html +0 -302
  21. package/src/demos/flex_details_set_demo_2.html +0 -315
  22. package/src/demos/visible_rect_demo.html +0 -525
  23. package/src/element_signature.js +0 -100
  24. package/src/interaction/drag/constraint_feedback_line.js +0 -92
  25. package/src/interaction/drag/drag_constraint.js +0 -659
  26. package/src/interaction/drag/drag_debug_markers.js +0 -635
  27. package/src/interaction/drag/drag_element_positioner.js +0 -382
  28. package/src/interaction/drag/drag_gesture.js +0 -566
  29. package/src/interaction/drag/drag_resize_demo.html +0 -571
  30. package/src/interaction/drag/drag_to_move.js +0 -301
  31. package/src/interaction/drag/drag_to_resize_gesture.js +0 -68
  32. package/src/interaction/drag/drop_target_detection.js +0 -148
  33. package/src/interaction/drag/sticky_frontiers.js +0 -160
  34. package/src/interaction/event_marker.js +0 -14
  35. package/src/interaction/focus/active_element.js +0 -33
  36. package/src/interaction/focus/arrow_navigation.js +0 -599
  37. package/src/interaction/focus/element_is_focusable.js +0 -57
  38. package/src/interaction/focus/element_visibility.js +0 -111
  39. package/src/interaction/focus/find_focusable.js +0 -21
  40. package/src/interaction/focus/focus_group.js +0 -91
  41. package/src/interaction/focus/focus_group_registry.js +0 -12
  42. package/src/interaction/focus/focus_nav.js +0 -12
  43. package/src/interaction/focus/focus_nav_event_marker.js +0 -14
  44. package/src/interaction/focus/focus_trap.js +0 -105
  45. package/src/interaction/focus/tab_navigation.js +0 -128
  46. package/src/interaction/focus/tests/focus_group_skip_tab_test.html +0 -206
  47. package/src/interaction/focus/tests/tree_focus_test.html +0 -304
  48. package/src/interaction/focus/tests/tree_focus_test.jsx +0 -261
  49. package/src/interaction/focus/tests/tree_focus_test_preact.html +0 -13
  50. package/src/interaction/isolate_interactions.js +0 -161
  51. package/src/interaction/keyboard.js +0 -26
  52. package/src/interaction/scroll/capture_scroll.js +0 -47
  53. package/src/interaction/scroll/is_scrollable.js +0 -159
  54. package/src/interaction/scroll/scroll_container.js +0 -110
  55. package/src/interaction/scroll/scroll_trap.js +0 -44
  56. package/src/interaction/scroll/scrollbar_size.js +0 -20
  57. package/src/interaction/scroll/wheel_through.js +0 -138
  58. package/src/iterable_weak_set.js +0 -66
  59. package/src/position/dom_coords.js +0 -340
  60. package/src/position/offset_parent.js +0 -15
  61. package/src/position/position_fixed.js +0 -15
  62. package/src/position/position_sticky.js +0 -213
  63. package/src/position/sticky_rect.js +0 -79
  64. package/src/position/visible_rect.js +0 -486
  65. package/src/pub_sub.js +0 -31
  66. package/src/size/can_take_size.js +0 -11
  67. package/src/size/details_content_full_height.js +0 -63
  68. package/src/size/flex_details_set.js +0 -974
  69. package/src/size/get_available_height.js +0 -22
  70. package/src/size/get_available_width.js +0 -22
  71. package/src/size/get_border_sizes.js +0 -14
  72. package/src/size/get_height.js +0 -4
  73. package/src/size/get_inner_height.js +0 -15
  74. package/src/size/get_inner_width.js +0 -15
  75. package/src/size/get_margin_sizes.js +0 -10
  76. package/src/size/get_max_height.js +0 -57
  77. package/src/size/get_max_width.js +0 -47
  78. package/src/size/get_min_height.js +0 -14
  79. package/src/size/get_min_width.js +0 -14
  80. package/src/size/get_padding_sizes.js +0 -10
  81. package/src/size/get_width.js +0 -4
  82. package/src/size/hooks/use_available_height.js +0 -27
  83. package/src/size/hooks/use_available_width.js +0 -27
  84. package/src/size/hooks/use_max_height.js +0 -10
  85. package/src/size/hooks/use_max_width.js +0 -10
  86. package/src/size/hooks/use_resize_status.js +0 -62
  87. package/src/size/resize.js +0 -695
  88. package/src/size/resolve_css_size.js +0 -32
  89. package/src/style/dom_styles.js +0 -97
  90. package/src/style/style_composition.js +0 -121
  91. package/src/style/style_controller.js +0 -345
  92. package/src/style/style_default.js +0 -153
  93. package/src/style/style_default_demo.html +0 -128
  94. package/src/style/style_parsing.js +0 -375
  95. package/src/transition/demos/animation_resumption_test.xhtml +0 -500
  96. package/src/transition/demos/height_toggle_test.xhtml +0 -515
  97. package/src/transition/dom_transition.js +0 -254
  98. package/src/transition/easing.js +0 -48
  99. package/src/transition/group_transition.js +0 -261
  100. package/src/transition/transform_style_parser.js +0 -32
  101. package/src/transition/transition_playback.js +0 -366
  102. package/src/transition/transition_timeline.js +0 -79
  103. package/src/traversal.js +0 -247
  104. package/src/ui_transition/demos/content_states_transition_demo.html +0 -628
  105. package/src/ui_transition/demos/smooth_height_transition_demo.html +0 -149
  106. package/src/ui_transition/demos/transition_testing.html +0 -354
  107. package/src/ui_transition/ui_transition.js +0 -1491
  108. package/src/utils.js +0 -69
  109. 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
- };
@@ -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
- };