@jsenv/navi 0.10.2 → 0.11.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_navi.js +13838 -23291
- package/dist/jsenv_navi.js.map +1281 -0
- package/package.json +5 -7
- package/index.js +0 -122
- package/src/action_private_properties.js +0 -11
- package/src/action_proxy_test.html +0 -353
- package/src/action_run_states.js +0 -5
- package/src/actions.js +0 -1401
- package/src/browser_integration/browser_integration.js +0 -216
- package/src/browser_integration/document_back_and_forward.js +0 -17
- package/src/browser_integration/document_loading_signal.js +0 -100
- package/src/browser_integration/document_state_signal.js +0 -9
- package/src/browser_integration/document_url_signal.js +0 -9
- package/src/browser_integration/use_is_visited.js +0 -19
- package/src/browser_integration/via_history.js +0 -232
- package/src/browser_integration/via_navigation.js +0 -168
- package/src/components/action_execution/form_context.js +0 -5
- package/src/components/action_execution/render_actionable_component.jsx +0 -29
- package/src/components/action_execution/use_action.js +0 -99
- package/src/components/action_execution/use_execute_action.js +0 -193
- package/src/components/action_execution/use_run_on_mount.js +0 -9
- package/src/components/action_renderer.jsx +0 -125
- package/src/components/callout/callout.js +0 -990
- package/src/components/callout/callout_demo.html +0 -201
- package/src/components/callout/test_dynamic_positioning.html +0 -161
- package/src/components/callout/test_html_document_iframe.html +0 -182
- package/src/components/demos/0_button_demo.html +0 -707
- package/src/components/demos/10_column_reordering_debug.html +0 -277
- package/src/components/demos/11_table_selection_debug.html +0 -432
- package/src/components/demos/1_checkbox_demo.html +0 -754
- package/src/components/demos/2_input_textual_demo.html +0 -286
- package/src/components/demos/3_radio_demo.html +0 -874
- package/src/components/demos/4_select_demo.html +0 -100
- package/src/components/demos/5_list_scrollable_demo.html +0 -153
- package/src/components/demos/6_tablist_demo.html +0 -77
- package/src/components/demos/7_table_selection_demo.html +0 -176
- package/src/components/demos/8_table_fixed_headers_demo.html +0 -584
- package/src/components/demos/9_table_column_drag_demo.html +0 -325
- package/src/components/demos/action/0_button_demo.html +0 -204
- package/src/components/demos/action/10_shortcuts_demo.html +0 -189
- package/src/components/demos/action/11_nested_shortcuts_demo.xhtml +0 -401
- package/src/components/demos/action/1_input_text_demo.html +0 -876
- package/src/components/demos/action/2_form_multiple.html +0 -303
- package/src/components/demos/action/3_details_demo.html +0 -203
- package/src/components/demos/action/4_input_checkbox_demo.html +0 -731
- package/src/components/demos/action/5_input_checkbox_state_demo.html +0 -270
- package/src/components/demos/action/6_checkbox_list_demo.html +0 -341
- package/src/components/demos/action/7_radio_list_demo.html +0 -357
- package/src/components/demos/action/8_editable_demo.html +0 -431
- package/src/components/demos/action/9_link_demo.html +0 -194
- package/src/components/demos/demo.md +0 -0
- package/src/components/demos/route/basic/basic.html +0 -14
- package/src/components/demos/route/basic/basic_route_demo.jsx +0 -224
- package/src/components/demos/route/multi/multi.html +0 -14
- package/src/components/demos/route/multi/multi_route_demo.jsx +0 -277
- package/src/components/demos/ui_transition/0_action_renderer_ui_transition_demo.html +0 -695
- package/src/components/demos/ui_transition/1_nested_ui_transition_demo.html +0 -429
- package/src/components/demos/ui_transition/2_height_transition_test.html +0 -295
- package/src/components/details/details.jsx +0 -245
- package/src/components/details/summary_marker.jsx +0 -141
- package/src/components/edition/editable.jsx +0 -186
- package/src/components/error_boundary_context.js +0 -9
- package/src/components/field/README.md +0 -247
- package/src/components/field/button.jsx +0 -429
- package/src/components/field/checkbox_list.jsx +0 -185
- package/src/components/field/collect_form_element_values.js +0 -82
- package/src/components/field/custom_field.js +0 -106
- package/src/components/field/form.jsx +0 -209
- package/src/components/field/input.jsx +0 -16
- package/src/components/field/input_checkbox.jsx +0 -434
- package/src/components/field/input_radio.jsx +0 -432
- package/src/components/field/input_textual.jsx +0 -389
- package/src/components/field/label.jsx +0 -46
- package/src/components/field/radio_list.jsx +0 -183
- package/src/components/field/select.jsx +0 -256
- package/src/components/field/use_action_events.js +0 -132
- package/src/components/field/use_form_events.js +0 -59
- package/src/components/field/use_ui_state_controller.js +0 -506
- package/src/components/item_tracker/README.md +0 -461
- package/src/components/item_tracker/use_isolated_item_tracker.jsx +0 -209
- package/src/components/item_tracker/use_isolated_item_tracker_demo.html +0 -148
- package/src/components/item_tracker/use_isolated_item_tracker_demo.jsx +0 -460
- package/src/components/item_tracker/use_item_tracker.jsx +0 -143
- package/src/components/item_tracker/use_item_tracker_demo.html +0 -207
- package/src/components/item_tracker/use_item_tracker_demo.jsx +0 -216
- package/src/components/keyboard_shortcuts/active_keyboard_shortcuts.jsx +0 -87
- package/src/components/keyboard_shortcuts/aria_key_shortcuts.js +0 -61
- package/src/components/keyboard_shortcuts/keyboard_key_meta.js +0 -17
- package/src/components/keyboard_shortcuts/keyboard_shortcuts.js +0 -371
- package/src/components/keyboard_shortcuts/os.js +0 -9
- package/src/components/layout/demos/demo_flex.html +0 -638
- package/src/components/layout/demos/demo_layout_style_buttons.html +0 -351
- package/src/components/layout/demos/demo_layout_style_input.html +0 -226
- package/src/components/layout/demos/demo_layout_style_text.html +0 -514
- package/src/components/layout/flex.jsx +0 -109
- package/src/components/layout/layout_context.jsx +0 -3
- package/src/components/layout/spacing.jsx +0 -20
- package/src/components/layout/use_layout_style.js +0 -249
- package/src/components/link/link.jsx +0 -267
- package/src/components/link/link_with_icon.jsx +0 -52
- package/src/components/loader/loader_background.jsx +0 -372
- package/src/components/loader/loading_spinner.jsx +0 -68
- package/src/components/loader/network_speed.js +0 -83
- package/src/components/loader/rectangle_loading.jsx +0 -244
- package/src/components/props_composition/demos/demo_with_props_style.html +0 -81
- package/src/components/props_composition/with_props_class_name.js +0 -37
- package/src/components/props_composition/with_props_style.js +0 -26
- package/src/components/route.jsx +0 -19
- package/src/components/selection/selection.jsx +0 -1583
- package/src/components/svg/font_sized_svg.jsx +0 -59
- package/src/components/svg/icon_and_text.jsx +0 -21
- package/src/components/svg/svg_mask_overlay.jsx +0 -105
- package/src/components/table/drag/table_drag.jsx +0 -506
- package/src/components/table/resize/table_resize.jsx +0 -650
- package/src/components/table/resize/table_size.js +0 -43
- package/src/components/table/selection/table_selection.js +0 -106
- package/src/components/table/selection/table_selection.jsx +0 -203
- package/src/components/table/sticky/sticky_group.js +0 -354
- package/src/components/table/sticky/table_sticky.js +0 -25
- package/src/components/table/sticky/table_sticky.jsx +0 -501
- package/src/components/table/table.jsx +0 -721
- package/src/components/table/table_css.js +0 -211
- package/src/components/table/table_ui.jsx +0 -49
- package/src/components/table/use_cells_and_columns.js +0 -90
- package/src/components/table/use_object_array_to_cells.js +0 -46
- package/src/components/table/z_indexes.js +0 -23
- package/src/components/tablist/tablist.jsx +0 -99
- package/src/components/text/demos/demo_text_and_icon.html +0 -421
- package/src/components/text/overflow.jsx +0 -15
- package/src/components/text/text.jsx +0 -83
- package/src/components/text/text_and_count.jsx +0 -28
- package/src/components/ui_transition.jsx +0 -128
- package/src/components/use_auto_focus.js +0 -94
- package/src/components/use_batch_during_render.js +0 -33
- package/src/components/use_debounce_true.js +0 -31
- package/src/components/use_dependencies_diff.js +0 -35
- package/src/components/use_focus_group.js +0 -20
- package/src/components/use_initial_value.js +0 -78
- package/src/components/use_is_visited.js +0 -19
- package/src/components/use_ref_array.js +0 -38
- package/src/components/use_signal_sync.js +0 -50
- package/src/components/use_stable_callback.js +0 -68
- package/src/components/use_state_array.js +0 -47
- package/src/docs/actions.md +0 -250
- package/src/docs/demos/resource/action_status.jsx +0 -42
- package/src/docs/demos/resource/demo.md +0 -1
- package/src/docs/demos/resource/resource_demo_0.html +0 -84
- package/src/docs/demos/resource/resource_demo_10_post_gc.html +0 -364
- package/src/docs/demos/resource/resource_demo_11_describe_many.html +0 -362
- package/src/docs/demos/resource/resource_demo_2.html +0 -173
- package/src/docs/demos/resource/resource_demo_3_filtered_users.html +0 -415
- package/src/docs/demos/resource/resource_demo_4_details.html +0 -284
- package/src/docs/demos/resource/resource_demo_5_renderer_lazy.html +0 -115
- package/src/docs/demos/resource/resource_demo_6_gc.html +0 -217
- package/src/docs/demos/resource/resource_demo_7_child_gc.html +0 -240
- package/src/docs/demos/resource/resource_demo_8_proxy_gc.html +0 -319
- package/src/docs/demos/resource/resource_demo_9_describe_one.html +0 -472
- package/src/docs/demos/resource/tata.jsx +0 -3
- package/src/docs/demos/resource/toto.jsx +0 -3
- package/src/docs/demos/user_nav/user_nav.html +0 -12
- package/src/docs/demos/user_nav/user_nav.jsx +0 -330
- package/src/docs/resource_dependencies.md +0 -103
- package/src/docs/resource_with_params.md +0 -80
- package/src/navi_css_vars.js +0 -14
- package/src/notes.md +0 -34
- package/src/route/route.js +0 -596
- package/src/route/route.xtest.html +0 -228
- package/src/store/array_signal_store.js +0 -537
- package/src/store/local_storage_signal.js +0 -17
- package/src/store/resource_graph.js +0 -1304
- package/src/store/tests/resource_graph_autoreload_demo.html +0 -12
- package/src/store/tests/resource_graph_autoreload_demo.jsx +0 -964
- package/src/store/tests/resource_graph_dependencies.test_manual.js +0 -95
- package/src/store/value_in_local_storage.js +0 -187
- package/src/symbol_object_signal.js +0 -1
- package/src/use_action_data.js +0 -10
- package/src/use_action_status.js +0 -47
- package/src/utils/add_many_event_listeners.js +0 -15
- package/src/utils/array_add_remove.js +0 -61
- package/src/utils/array_signal.js +0 -15
- package/src/utils/compare_two_js_values.js +0 -172
- package/src/utils/execute_with_cleanup.js +0 -21
- package/src/utils/get_caller_info.js +0 -85
- package/src/utils/is_signal.js +0 -20
- package/src/utils/js_value_weak_map.js +0 -162
- package/src/utils/js_value_weak_map_demo.html +0 -690
- package/src/utils/merge_two_js_values.js +0 -53
- package/src/utils/stringify_for_display.js +0 -131
- package/src/utils/weak_effect.js +0 -48
- package/src/validation/constraints/confirm_constraint.js +0 -14
- package/src/validation/constraints/create_unique_value_constraint.js +0 -27
- package/src/validation/constraints/native_constraints.js +0 -338
- package/src/validation/constraints/readonly_constraint.js +0 -41
- package/src/validation/constraints/same_as_constraint.js +0 -42
- package/src/validation/constraints/single_space_constraint.js +0 -13
- package/src/validation/custom_constraint_validation.js +0 -793
- package/src/validation/custom_message.js +0 -18
- package/src/validation/demos/browser_style.png +0 -0
- package/src/validation/demos/demo_same_as_constraint.html +0 -259
- package/src/validation/demos/form_validation_demo.html +0 -142
- package/src/validation/demos/form_validation_demo_preact.html +0 -87
- package/src/validation/demos/form_validation_native_popover_demo.html +0 -168
- package/src/validation/demos/form_validation_vs_native_demo.html +0 -172
- package/src/validation/hooks/use_constraints.js +0 -23
- package/src/validation/hooks/use_custom_validation_ref.js +0 -73
- package/src/validation/hooks/use_validation_message.js +0 -19
- package/src/validation/input_change_effect.js +0 -106
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" href="data:," />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Height Transition Test - Big to Small</title>
|
|
8
|
-
<style>
|
|
9
|
-
body {
|
|
10
|
-
font-family:
|
|
11
|
-
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
12
|
-
max-width: 600px;
|
|
13
|
-
margin: 0 auto;
|
|
14
|
-
padding: 20px;
|
|
15
|
-
background: #f5f5f5;
|
|
16
|
-
line-height: 1.5;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
h1 {
|
|
20
|
-
color: #333;
|
|
21
|
-
margin-bottom: 20px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.controls {
|
|
25
|
-
background: white;
|
|
26
|
-
border-radius: 8px;
|
|
27
|
-
padding: 20px;
|
|
28
|
-
margin-bottom: 20px;
|
|
29
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.controls h3 {
|
|
33
|
-
margin-top: 0;
|
|
34
|
-
margin-bottom: 15px;
|
|
35
|
-
color: #555;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.button-group {
|
|
39
|
-
display: flex;
|
|
40
|
-
gap: 10px;
|
|
41
|
-
margin-bottom: 10px;
|
|
42
|
-
flex-wrap: wrap;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
button {
|
|
46
|
-
padding: 10px 16px;
|
|
47
|
-
border: 1px solid #ddd;
|
|
48
|
-
border-radius: 6px;
|
|
49
|
-
background: #fff;
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
font: inherit;
|
|
52
|
-
transition: all 0.15s;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
button:hover {
|
|
56
|
-
background: #f8f9fa;
|
|
57
|
-
border-color: #007acc;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
button:active {
|
|
61
|
-
background: #e9ecef;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.demo-container {
|
|
65
|
-
background: white;
|
|
66
|
-
border-radius: 8px;
|
|
67
|
-
padding: 20px;
|
|
68
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* UI Transition Container */
|
|
72
|
-
#transition-box {
|
|
73
|
-
border: 2px solid #007acc;
|
|
74
|
-
border-radius: 8px;
|
|
75
|
-
background: #f8fbff;
|
|
76
|
-
max-width: 400px;
|
|
77
|
-
margin: 20px 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/* Content styles */
|
|
81
|
-
.big-content {
|
|
82
|
-
padding: 30px;
|
|
83
|
-
background: repeating-linear-gradient(
|
|
84
|
-
to bottom,
|
|
85
|
-
rgba(0, 0, 0, 0.05) 0px,
|
|
86
|
-
rgba(0, 0, 0, 0.05) 20px,
|
|
87
|
-
rgba(0, 0, 0, 0.1) 20px,
|
|
88
|
-
rgba(0, 0, 0, 0.1) 40px
|
|
89
|
-
);
|
|
90
|
-
color: #222;
|
|
91
|
-
border-radius: 6px;
|
|
92
|
-
min-height: 300px;
|
|
93
|
-
display: flex;
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
justify-content: center;
|
|
96
|
-
align-items: center;
|
|
97
|
-
text-align: center;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.big-content h2 {
|
|
101
|
-
margin: 0 0 15px 0;
|
|
102
|
-
font-size: 24px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.big-content p {
|
|
106
|
-
margin: 5px 0;
|
|
107
|
-
opacity: 0.9;
|
|
108
|
-
font-size: 16px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.small-content {
|
|
112
|
-
padding: 15px;
|
|
113
|
-
background: transparent; /* reveal any cropping during cross-fade */
|
|
114
|
-
color: #222;
|
|
115
|
-
border-radius: 6px;
|
|
116
|
-
text-align: center;
|
|
117
|
-
font-weight: 600;
|
|
118
|
-
border: 1px dashed #bbb; /* show where the new smaller height is */
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/* A bright bar anchored at the bottom to make cropping obvious when height shrinks */
|
|
122
|
-
.big-content .bottom-flag {
|
|
123
|
-
margin-top: 20px;
|
|
124
|
-
width: 100%;
|
|
125
|
-
height: 40px;
|
|
126
|
-
border-radius: 4px;
|
|
127
|
-
background: repeating-linear-gradient(
|
|
128
|
-
45deg,
|
|
129
|
-
#ff1744,
|
|
130
|
-
#ff1744 10px,
|
|
131
|
-
#ff9100 10px,
|
|
132
|
-
#ff9100 20px
|
|
133
|
-
);
|
|
134
|
-
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15) inset;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.note {
|
|
138
|
-
background: #e7f3ff;
|
|
139
|
-
border: 1px solid #b8daff;
|
|
140
|
-
color: #004085;
|
|
141
|
-
padding: 12px;
|
|
142
|
-
border-radius: 6px;
|
|
143
|
-
font-size: 14px;
|
|
144
|
-
margin-top: 15px;
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
147
|
-
</head>
|
|
148
|
-
<body>
|
|
149
|
-
<h1>Height Transition Test</h1>
|
|
150
|
-
|
|
151
|
-
<div class="controls">
|
|
152
|
-
<h3>Test Controls</h3>
|
|
153
|
-
<div class="button-group">
|
|
154
|
-
<button id="show-big">Show Big Content</button>
|
|
155
|
-
<button id="show-small">Show Small Content</button>
|
|
156
|
-
<button id="clear">Clear Content</button>
|
|
157
|
-
</div>
|
|
158
|
-
<div class="button-group">
|
|
159
|
-
<label style="display: flex; align-items: center; gap: 8px">
|
|
160
|
-
<input type="checkbox" id="toggle-transitions" />
|
|
161
|
-
Enable Size Transitions
|
|
162
|
-
</label>
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
<div class="demo-container">
|
|
167
|
-
<h3>Transition Container</h3>
|
|
168
|
-
<div class="note">
|
|
169
|
-
Tip: With size transitions DISABLED (default), switching from the tall
|
|
170
|
-
content to the small content will crop the outgoing element while the
|
|
171
|
-
content transition runs. Toggle size transitions ON to see the
|
|
172
|
-
difference. The striped bar at the bottom of the big content helps
|
|
173
|
-
visualize cropping when the container height shrinks instantly.
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div
|
|
177
|
-
id="transition-box"
|
|
178
|
-
class="ui_transition_container"
|
|
179
|
-
data-content-transition="cross-fade"
|
|
180
|
-
data-content-transition-duration="600"
|
|
181
|
-
>
|
|
182
|
-
<div class="ui_transition_outer_wrapper">
|
|
183
|
-
<div class="ui_transition_measure_wrapper">
|
|
184
|
-
<div class="ui_transition_slot" data-content-key="initial">
|
|
185
|
-
<div class="big-content">
|
|
186
|
-
<h2>🎯 Big Content</h2>
|
|
187
|
-
<p>This is a tall element with lots of content</p>
|
|
188
|
-
<p>It takes up significant vertical space</p>
|
|
189
|
-
<p>Perfect for testing height transitions</p>
|
|
190
|
-
<p>When you switch to small content,</p>
|
|
191
|
-
<p>watch how smoothly it transitions!</p>
|
|
192
|
-
<div
|
|
193
|
-
class="bottom-flag"
|
|
194
|
-
title="Bottom area to reveal cropping"
|
|
195
|
-
></div>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
<div class="ui_transition_content_overlay"></div>
|
|
201
|
-
</div>
|
|
202
|
-
</div>
|
|
203
|
-
|
|
204
|
-
<script type="module">
|
|
205
|
-
import { initUITransition } from "../../../../../dom/src/ui_transition/ui_transition.js";
|
|
206
|
-
|
|
207
|
-
const transitionBox = document.getElementById("transition-box");
|
|
208
|
-
const { slot } = initUITransition(transitionBox);
|
|
209
|
-
|
|
210
|
-
// Content templates
|
|
211
|
-
const createBigContent = () => {
|
|
212
|
-
const div = document.createElement("div");
|
|
213
|
-
div.className = "big-content";
|
|
214
|
-
div.setAttribute("data-content-key", "big");
|
|
215
|
-
div.innerHTML = `
|
|
216
|
-
<h2>🎯 Big Content</h2>
|
|
217
|
-
<p>This is a tall element with lots of content</p>
|
|
218
|
-
<p>It takes up significant vertical space</p>
|
|
219
|
-
<p>Perfect for testing height transitions</p>
|
|
220
|
-
<p>When you switch to small content,</p>
|
|
221
|
-
<p>watch how smoothly it transitions!</p>
|
|
222
|
-
<div class="bottom-flag" title="Bottom area to reveal cropping"></div>
|
|
223
|
-
`;
|
|
224
|
-
return div;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const createSmallContent = () => {
|
|
228
|
-
const div = document.createElement("div");
|
|
229
|
-
div.className = "small-content";
|
|
230
|
-
div.setAttribute("data-content-key", "small");
|
|
231
|
-
div.textContent = "📦 Small Content - Compact and concise!";
|
|
232
|
-
return div;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
// no loading state in this simplified demo
|
|
236
|
-
|
|
237
|
-
// Button handlers
|
|
238
|
-
document.getElementById("show-big").addEventListener("click", () => {
|
|
239
|
-
slot.innerHTML = "";
|
|
240
|
-
slot.appendChild(createBigContent());
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
document.getElementById("show-small").addEventListener("click", () => {
|
|
244
|
-
slot.innerHTML = "";
|
|
245
|
-
slot.appendChild(createSmallContent());
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
// removed loading button
|
|
249
|
-
|
|
250
|
-
document.getElementById("clear").addEventListener("click", () => {
|
|
251
|
-
slot.innerHTML = "";
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
// Initialize and handle size transitions checkbox
|
|
255
|
-
const sizeToggle = document.getElementById("toggle-transitions");
|
|
256
|
-
sizeToggle.checked = transitionBox.hasAttribute("data-size-transition");
|
|
257
|
-
sizeToggle.addEventListener("change", (e) => {
|
|
258
|
-
if (e.target.checked) {
|
|
259
|
-
transitionBox.setAttribute("data-size-transition", "");
|
|
260
|
-
} else {
|
|
261
|
-
transitionBox.removeAttribute("data-size-transition");
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
// removed debug toggle
|
|
266
|
-
|
|
267
|
-
// Quick test sequence
|
|
268
|
-
let testRunning = false;
|
|
269
|
-
document.addEventListener("keydown", (e) => {
|
|
270
|
-
if (e.key === " " && !testRunning) {
|
|
271
|
-
e.preventDefault();
|
|
272
|
-
testRunning = true;
|
|
273
|
-
|
|
274
|
-
// Auto-cycle through states (big -> small -> big)
|
|
275
|
-
setTimeout(() => {
|
|
276
|
-
slot.innerHTML = "";
|
|
277
|
-
slot.appendChild(createSmallContent());
|
|
278
|
-
}, 1000);
|
|
279
|
-
|
|
280
|
-
setTimeout(() => {
|
|
281
|
-
slot.innerHTML = "";
|
|
282
|
-
slot.appendChild(createBigContent());
|
|
283
|
-
}, 2500);
|
|
284
|
-
|
|
285
|
-
setTimeout(() => {
|
|
286
|
-
testRunning = false;
|
|
287
|
-
}, 5500);
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
console.log("Height Transition Test loaded!");
|
|
292
|
-
console.log("Press SPACEBAR for auto-cycle test");
|
|
293
|
-
</script>
|
|
294
|
-
</body>
|
|
295
|
-
</html>
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { elementIsFocusable, findAfter } from "@jsenv/dom";
|
|
2
|
-
import { forwardRef } from "preact/compat";
|
|
3
|
-
import { useEffect, useImperativeHandle, useRef, useState } from "preact/hooks";
|
|
4
|
-
|
|
5
|
-
import { useNavState } from "../../browser_integration/browser_integration.js";
|
|
6
|
-
import { useActionStatus } from "../../use_action_status.js";
|
|
7
|
-
import { requestAction } from "../../validation/custom_constraint_validation.js";
|
|
8
|
-
import { renderActionableComponent } from "../action_execution/render_actionable_component.jsx";
|
|
9
|
-
import { useAction } from "../action_execution/use_action.js";
|
|
10
|
-
import { useExecuteAction } from "../action_execution/use_execute_action.js";
|
|
11
|
-
import { ActionRenderer } from "../action_renderer.jsx";
|
|
12
|
-
import { useActionEvents } from "../field/use_action_events.js";
|
|
13
|
-
import { useKeyboardShortcuts } from "../keyboard_shortcuts/keyboard_shortcuts.js";
|
|
14
|
-
import { useFocusGroup } from "../use_focus_group.js";
|
|
15
|
-
import { SummaryMarker } from "./summary_marker.jsx";
|
|
16
|
-
|
|
17
|
-
import.meta.css = /* css */ `
|
|
18
|
-
.navi_details {
|
|
19
|
-
position: relative;
|
|
20
|
-
z-index: 1;
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-shrink: 0;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.navi_details > summary {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-shrink: 0;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
user-select: none;
|
|
32
|
-
}
|
|
33
|
-
.summary_body {
|
|
34
|
-
display: flex;
|
|
35
|
-
width: 100%;
|
|
36
|
-
flex-direction: row;
|
|
37
|
-
align-items: center;
|
|
38
|
-
gap: 0.2em;
|
|
39
|
-
}
|
|
40
|
-
.summary_label {
|
|
41
|
-
display: flex;
|
|
42
|
-
padding-right: 10px;
|
|
43
|
-
flex: 1;
|
|
44
|
-
align-items: center;
|
|
45
|
-
gap: 0.2em;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.navi_details > summary:focus {
|
|
49
|
-
z-index: 1;
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
export const Details = forwardRef((props, ref) => {
|
|
54
|
-
return renderActionableComponent(props, ref, {
|
|
55
|
-
Basic: DetailsBasic,
|
|
56
|
-
WithAction: DetailsWithAction,
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const DetailsBasic = forwardRef((props, ref) => {
|
|
61
|
-
const {
|
|
62
|
-
id,
|
|
63
|
-
label = "Summary",
|
|
64
|
-
open,
|
|
65
|
-
loading,
|
|
66
|
-
className,
|
|
67
|
-
focusGroup,
|
|
68
|
-
focusGroupDirection,
|
|
69
|
-
arrowKeyShortcuts = true,
|
|
70
|
-
openKeyShortcut = "ArrowRight",
|
|
71
|
-
closeKeyShortcut = "ArrowLeft",
|
|
72
|
-
onToggle,
|
|
73
|
-
children,
|
|
74
|
-
...rest
|
|
75
|
-
} = props;
|
|
76
|
-
const innerRef = useRef();
|
|
77
|
-
useImperativeHandle(ref, () => innerRef.current);
|
|
78
|
-
|
|
79
|
-
const [navState, setNavState] = useNavState(id);
|
|
80
|
-
const [innerOpen, innerOpenSetter] = useState(open || navState);
|
|
81
|
-
useFocusGroup(innerRef, {
|
|
82
|
-
enabled: focusGroup,
|
|
83
|
-
name: typeof focusGroup === "string" ? focusGroup : undefined,
|
|
84
|
-
direction: focusGroupDirection,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Browser will dispatch "toggle" event even if we set open={true}
|
|
89
|
-
* When rendering the component for the first time
|
|
90
|
-
* We have to ensure the initial "toggle" event is ignored.
|
|
91
|
-
*
|
|
92
|
-
* If we don't do that code will think the details has changed and run logic accordingly
|
|
93
|
-
* For example it will try to navigate to the current url while we are already there
|
|
94
|
-
*
|
|
95
|
-
* See:
|
|
96
|
-
* - https://techblog.thescore.com/2024/10/08/why-we-decided-to-change-how-the-details-element-works/
|
|
97
|
-
* - https://github.com/whatwg/html/issues/4500
|
|
98
|
-
* - https://stackoverflow.com/questions/58942600/react-html-details-toggles-uncontrollably-when-starts-open
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
const summaryRef = useRef(null);
|
|
103
|
-
useKeyboardShortcuts(innerRef, [
|
|
104
|
-
{
|
|
105
|
-
key: openKeyShortcut,
|
|
106
|
-
enabled: arrowKeyShortcuts,
|
|
107
|
-
when: (e) =>
|
|
108
|
-
document.activeElement === summaryRef.current &&
|
|
109
|
-
// avoid handling openKeyShortcut twice when keydown occurs inside nested details
|
|
110
|
-
!e.defaultPrevented,
|
|
111
|
-
action: (e) => {
|
|
112
|
-
const details = innerRef.current;
|
|
113
|
-
if (!details.open) {
|
|
114
|
-
e.preventDefault();
|
|
115
|
-
details.open = true;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const summary = summaryRef.current;
|
|
119
|
-
const firstFocusableElementInDetails = findAfter(
|
|
120
|
-
summary,
|
|
121
|
-
elementIsFocusable,
|
|
122
|
-
{ root: details },
|
|
123
|
-
);
|
|
124
|
-
if (!firstFocusableElementInDetails) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
e.preventDefault();
|
|
128
|
-
firstFocusableElementInDetails.focus();
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
key: closeKeyShortcut,
|
|
133
|
-
enabled: arrowKeyShortcuts,
|
|
134
|
-
when: () => {
|
|
135
|
-
const details = innerRef.current;
|
|
136
|
-
return details.open;
|
|
137
|
-
},
|
|
138
|
-
action: (e) => {
|
|
139
|
-
const details = innerRef.current;
|
|
140
|
-
const summary = summaryRef.current;
|
|
141
|
-
if (document.activeElement === summary) {
|
|
142
|
-
e.preventDefault();
|
|
143
|
-
summary.focus();
|
|
144
|
-
details.open = false;
|
|
145
|
-
} else {
|
|
146
|
-
e.preventDefault();
|
|
147
|
-
summary.focus();
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
]);
|
|
152
|
-
|
|
153
|
-
const mountedRef = useRef(false);
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
mountedRef.current = true;
|
|
156
|
-
}, []);
|
|
157
|
-
|
|
158
|
-
return (
|
|
159
|
-
<details
|
|
160
|
-
{...rest}
|
|
161
|
-
ref={innerRef}
|
|
162
|
-
id={id}
|
|
163
|
-
className={[
|
|
164
|
-
"navi_details",
|
|
165
|
-
...(className ? className.split(" ") : []),
|
|
166
|
-
].join(" ")}
|
|
167
|
-
onToggle={(e) => {
|
|
168
|
-
const isOpen = e.newState === "open";
|
|
169
|
-
if (mountedRef.current) {
|
|
170
|
-
if (isOpen) {
|
|
171
|
-
innerOpenSetter(true);
|
|
172
|
-
setNavState(true);
|
|
173
|
-
} else {
|
|
174
|
-
innerOpenSetter(false);
|
|
175
|
-
setNavState(undefined);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
onToggle?.(e);
|
|
179
|
-
}}
|
|
180
|
-
open={innerOpen}
|
|
181
|
-
>
|
|
182
|
-
<summary ref={summaryRef}>
|
|
183
|
-
<div className="summary_body">
|
|
184
|
-
<SummaryMarker open={innerOpen} loading={loading} />
|
|
185
|
-
<div className="summary_label">{label}</div>
|
|
186
|
-
</div>
|
|
187
|
-
</summary>
|
|
188
|
-
{children}
|
|
189
|
-
</details>
|
|
190
|
-
);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
const DetailsWithAction = forwardRef((props, ref) => {
|
|
194
|
-
const {
|
|
195
|
-
action,
|
|
196
|
-
loading,
|
|
197
|
-
onToggle,
|
|
198
|
-
onActionPrevented,
|
|
199
|
-
onActionStart,
|
|
200
|
-
onActionError,
|
|
201
|
-
onActionEnd,
|
|
202
|
-
children,
|
|
203
|
-
...rest
|
|
204
|
-
} = props;
|
|
205
|
-
const innerRef = useRef();
|
|
206
|
-
useImperativeHandle(ref, () => innerRef.current);
|
|
207
|
-
|
|
208
|
-
const effectiveAction = useAction(action);
|
|
209
|
-
const { loading: actionLoading } = useActionStatus(effectiveAction);
|
|
210
|
-
const executeAction = useExecuteAction(innerRef, {
|
|
211
|
-
// the error will be displayed by actionRenderer inside <details>
|
|
212
|
-
errorEffect: "none",
|
|
213
|
-
});
|
|
214
|
-
useActionEvents(innerRef, {
|
|
215
|
-
onPrevented: onActionPrevented,
|
|
216
|
-
onAction: (e) => {
|
|
217
|
-
executeAction(e);
|
|
218
|
-
},
|
|
219
|
-
onStart: onActionStart,
|
|
220
|
-
onError: onActionError,
|
|
221
|
-
onEnd: onActionEnd,
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
return (
|
|
225
|
-
<DetailsBasic
|
|
226
|
-
{...rest}
|
|
227
|
-
ref={innerRef}
|
|
228
|
-
loading={loading || actionLoading}
|
|
229
|
-
onToggle={(toggleEvent) => {
|
|
230
|
-
const isOpen = toggleEvent.newState === "open";
|
|
231
|
-
if (isOpen) {
|
|
232
|
-
requestAction(toggleEvent.target, effectiveAction, {
|
|
233
|
-
event: toggleEvent,
|
|
234
|
-
method: "run",
|
|
235
|
-
});
|
|
236
|
-
} else {
|
|
237
|
-
effectiveAction.abort();
|
|
238
|
-
}
|
|
239
|
-
onToggle?.(toggleEvent);
|
|
240
|
-
}}
|
|
241
|
-
>
|
|
242
|
-
<ActionRenderer action={effectiveAction}>{children}</ActionRenderer>
|
|
243
|
-
</DetailsBasic>
|
|
244
|
-
);
|
|
245
|
-
});
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { useLayoutEffect, useRef } from "preact/hooks";
|
|
2
|
-
import { useDebounceTrue } from "../use_debounce_true.js";
|
|
3
|
-
|
|
4
|
-
const rightArrowPath = "M680-480L360-160l-80-80 240-240-240-240 80-80 320 320z";
|
|
5
|
-
const downArrowPath = "M480-280L160-600l80-80 240 240 240-240 80 80-320 320z";
|
|
6
|
-
|
|
7
|
-
import.meta.css = /* css */ `
|
|
8
|
-
.summary_marker {
|
|
9
|
-
width: 1em;
|
|
10
|
-
height: 1em;
|
|
11
|
-
line-height: 1em;
|
|
12
|
-
}
|
|
13
|
-
.summary_marker_svg .arrow {
|
|
14
|
-
animation-duration: 0.3s;
|
|
15
|
-
animation-fill-mode: forwards;
|
|
16
|
-
animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
17
|
-
}
|
|
18
|
-
.summary_marker_svg .arrow[data-animation-target="down"] {
|
|
19
|
-
animation-name: morph-to-down;
|
|
20
|
-
}
|
|
21
|
-
@keyframes morph-to-down {
|
|
22
|
-
from {
|
|
23
|
-
d: path("${rightArrowPath}");
|
|
24
|
-
}
|
|
25
|
-
to {
|
|
26
|
-
d: path("${downArrowPath}");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
.summary_marker_svg .arrow[data-animation-target="right"] {
|
|
30
|
-
animation-name: morph-to-right;
|
|
31
|
-
}
|
|
32
|
-
@keyframes morph-to-right {
|
|
33
|
-
from {
|
|
34
|
-
d: path("${downArrowPath}");
|
|
35
|
-
}
|
|
36
|
-
to {
|
|
37
|
-
d: path("${rightArrowPath}");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.summary_marker_svg .foreground_circle {
|
|
42
|
-
stroke-dasharray: 503 1507; /* ~25% of circle perimeter */
|
|
43
|
-
stroke-dashoffset: 0;
|
|
44
|
-
animation: progress-around-circle 1.5s linear infinite;
|
|
45
|
-
}
|
|
46
|
-
@keyframes progress-around-circle {
|
|
47
|
-
0% {
|
|
48
|
-
stroke-dashoffset: 0;
|
|
49
|
-
}
|
|
50
|
-
100% {
|
|
51
|
-
stroke-dashoffset: -2010;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* fading and scaling */
|
|
56
|
-
.summary_marker_svg .arrow {
|
|
57
|
-
transition: opacity 0.3s ease-in-out;
|
|
58
|
-
opacity: 1;
|
|
59
|
-
}
|
|
60
|
-
.summary_marker_svg .loading_container {
|
|
61
|
-
transition: transform 0.3s linear;
|
|
62
|
-
transform: scale(0.3);
|
|
63
|
-
}
|
|
64
|
-
.summary_marker_svg .background_circle,
|
|
65
|
-
.summary_marker_svg .foreground_circle {
|
|
66
|
-
transition: opacity 0.3s ease-in-out;
|
|
67
|
-
opacity: 0;
|
|
68
|
-
}
|
|
69
|
-
.summary_marker_svg[data-loading] .arrow {
|
|
70
|
-
opacity: 0;
|
|
71
|
-
}
|
|
72
|
-
.summary_marker_svg[data-loading] .loading_container {
|
|
73
|
-
transform: scale(1);
|
|
74
|
-
}
|
|
75
|
-
.summary_marker_svg[data-loading] .background_circle {
|
|
76
|
-
opacity: 0.2;
|
|
77
|
-
}
|
|
78
|
-
.summary_marker_svg[data-loading] .foreground_circle {
|
|
79
|
-
opacity: 1;
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
export const SummaryMarker = ({ open, loading }) => {
|
|
84
|
-
const showLoading = useDebounceTrue(loading, 300);
|
|
85
|
-
const mountedRef = useRef(false);
|
|
86
|
-
const prevOpenRef = useRef(open);
|
|
87
|
-
|
|
88
|
-
useLayoutEffect(() => {
|
|
89
|
-
mountedRef.current = true;
|
|
90
|
-
return () => {
|
|
91
|
-
mountedRef.current = false;
|
|
92
|
-
};
|
|
93
|
-
}, []);
|
|
94
|
-
const shouldAnimate = mountedRef.current && prevOpenRef.current !== open;
|
|
95
|
-
prevOpenRef.current = open;
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<span className="summary_marker">
|
|
99
|
-
<svg
|
|
100
|
-
className="summary_marker_svg"
|
|
101
|
-
viewBox="0 -960 960 960"
|
|
102
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
-
data-loading={open ? showLoading || undefined : undefined}
|
|
104
|
-
>
|
|
105
|
-
<g className="loading_container" transform-origin="480px -480px">
|
|
106
|
-
<circle
|
|
107
|
-
className="background_circle"
|
|
108
|
-
cx="480"
|
|
109
|
-
cy="-480"
|
|
110
|
-
r="320"
|
|
111
|
-
stroke="currentColor"
|
|
112
|
-
fill="none"
|
|
113
|
-
strokeWidth="60"
|
|
114
|
-
opacity="0.2"
|
|
115
|
-
/>
|
|
116
|
-
<circle
|
|
117
|
-
className="foreground_circle"
|
|
118
|
-
cx="480"
|
|
119
|
-
cy="-480"
|
|
120
|
-
r="320"
|
|
121
|
-
stroke="currentColor"
|
|
122
|
-
fill="none"
|
|
123
|
-
strokeWidth="60"
|
|
124
|
-
strokeLinecap="round"
|
|
125
|
-
strokeDasharray="503 1507"
|
|
126
|
-
/>
|
|
127
|
-
</g>
|
|
128
|
-
<g className="arrow_container" transform-origin="480px -480px">
|
|
129
|
-
<path
|
|
130
|
-
className="arrow"
|
|
131
|
-
fill="currentColor"
|
|
132
|
-
data-animation-target={
|
|
133
|
-
shouldAnimate ? (open ? "down" : "right") : undefined
|
|
134
|
-
}
|
|
135
|
-
d={open ? downArrowPath : rightArrowPath}
|
|
136
|
-
/>
|
|
137
|
-
</g>
|
|
138
|
-
</svg>
|
|
139
|
-
</span>
|
|
140
|
-
);
|
|
141
|
-
};
|