@jsenv/navi 0.10.1 → 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 +13858 -23295
- 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 -177
- 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,421 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<title>Text and Icon Demo</title>
|
|
6
|
-
<script type="importmap">
|
|
7
|
-
{
|
|
8
|
-
"imports": {
|
|
9
|
-
"preact": "https://esm.sh/preact@10.22.0",
|
|
10
|
-
"preact/": "https://esm.sh/preact@10.22.0/"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
</script>
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<div id="app"></div>
|
|
17
|
-
<script type="module" jsenv-type="module/jsx">
|
|
18
|
-
import { render } from "preact";
|
|
19
|
-
/* eslint-disable no-unused-vars */
|
|
20
|
-
import { Text, Icon } from "../text.jsx";
|
|
21
|
-
|
|
22
|
-
// Sample SVG icons
|
|
23
|
-
const HomeIcon = () => (
|
|
24
|
-
<svg
|
|
25
|
-
viewBox="0 0 24 24"
|
|
26
|
-
width="100%"
|
|
27
|
-
height="100%"
|
|
28
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
-
>
|
|
30
|
-
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" fill="currentColor" />
|
|
31
|
-
</svg>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const UserIcon = () => (
|
|
35
|
-
<svg
|
|
36
|
-
viewBox="0 0 24 24"
|
|
37
|
-
width="100%"
|
|
38
|
-
height="100%"
|
|
39
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
40
|
-
>
|
|
41
|
-
<path
|
|
42
|
-
d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
|
|
43
|
-
fill="currentColor"
|
|
44
|
-
/>
|
|
45
|
-
</svg>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const SettingsIcon = () => (
|
|
49
|
-
<svg
|
|
50
|
-
viewBox="0 0 24 24"
|
|
51
|
-
width="100%"
|
|
52
|
-
height="100%"
|
|
53
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
54
|
-
>
|
|
55
|
-
<path
|
|
56
|
-
d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.82,11.69,4.82,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"
|
|
57
|
-
fill="currentColor"
|
|
58
|
-
/>
|
|
59
|
-
</svg>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const SearchIcon = () => (
|
|
63
|
-
<svg
|
|
64
|
-
viewBox="0 0 24 24"
|
|
65
|
-
width="100%"
|
|
66
|
-
height="100%"
|
|
67
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
68
|
-
>
|
|
69
|
-
<path
|
|
70
|
-
d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
|
|
71
|
-
fill="currentColor"
|
|
72
|
-
/>
|
|
73
|
-
</svg>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const StarIcon = () => (
|
|
77
|
-
<svg
|
|
78
|
-
viewBox="0 0 24 24"
|
|
79
|
-
width="100%"
|
|
80
|
-
height="100%"
|
|
81
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
82
|
-
>
|
|
83
|
-
<path
|
|
84
|
-
d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"
|
|
85
|
-
fill="currentColor"
|
|
86
|
-
/>
|
|
87
|
-
</svg>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const HeartIcon = () => (
|
|
91
|
-
<svg
|
|
92
|
-
viewBox="0 0 24 24"
|
|
93
|
-
width="100%"
|
|
94
|
-
height="100%"
|
|
95
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
96
|
-
>
|
|
97
|
-
<path
|
|
98
|
-
d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"
|
|
99
|
-
fill="currentColor"
|
|
100
|
-
/>
|
|
101
|
-
</svg>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
const Demo = () => {
|
|
105
|
-
return (
|
|
106
|
-
<div
|
|
107
|
-
style={{
|
|
108
|
-
padding: "20px",
|
|
109
|
-
fontFamily: "system-ui, sans-serif",
|
|
110
|
-
lineHeight: "1.6",
|
|
111
|
-
maxWidth: "800px",
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
<h1>Text and Icon Combinations</h1>
|
|
115
|
-
|
|
116
|
-
<section style={{ marginBottom: "40px" }}>
|
|
117
|
-
<h2>Basic Icon + Text</h2>
|
|
118
|
-
<div
|
|
119
|
-
style={{
|
|
120
|
-
display: "flex",
|
|
121
|
-
flexDirection: "column",
|
|
122
|
-
gap: "10px",
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
<Text>
|
|
126
|
-
<Icon>
|
|
127
|
-
<HomeIcon />
|
|
128
|
-
</Icon>
|
|
129
|
-
Home
|
|
130
|
-
</Text>
|
|
131
|
-
|
|
132
|
-
<Text>
|
|
133
|
-
<Icon>
|
|
134
|
-
<UserIcon />
|
|
135
|
-
</Icon>
|
|
136
|
-
Profile
|
|
137
|
-
</Text>
|
|
138
|
-
|
|
139
|
-
<Text>
|
|
140
|
-
<Icon>
|
|
141
|
-
<SettingsIcon />
|
|
142
|
-
</Icon>
|
|
143
|
-
Settings
|
|
144
|
-
</Text>
|
|
145
|
-
</div>
|
|
146
|
-
</section>
|
|
147
|
-
|
|
148
|
-
<section style={{ marginBottom: "40px" }}>
|
|
149
|
-
<h2>Text + Icon (Reversed Order)</h2>
|
|
150
|
-
<div
|
|
151
|
-
style={{
|
|
152
|
-
display: "flex",
|
|
153
|
-
flexDirection: "column",
|
|
154
|
-
gap: "10px",
|
|
155
|
-
}}
|
|
156
|
-
>
|
|
157
|
-
<Text>
|
|
158
|
-
Search
|
|
159
|
-
<Icon>
|
|
160
|
-
<SearchIcon />
|
|
161
|
-
</Icon>
|
|
162
|
-
</Text>
|
|
163
|
-
</div>
|
|
164
|
-
</section>
|
|
165
|
-
|
|
166
|
-
<section style={{ marginBottom: "40px" }}>
|
|
167
|
-
<h2>Multiple Icons</h2>
|
|
168
|
-
<div
|
|
169
|
-
style={{
|
|
170
|
-
display: "flex",
|
|
171
|
-
flexDirection: "column",
|
|
172
|
-
gap: "10px",
|
|
173
|
-
}}
|
|
174
|
-
>
|
|
175
|
-
<Text>
|
|
176
|
-
<Icon>
|
|
177
|
-
<HomeIcon />
|
|
178
|
-
</Icon>
|
|
179
|
-
Left and right
|
|
180
|
-
<Icon>
|
|
181
|
-
<StarIcon />
|
|
182
|
-
</Icon>
|
|
183
|
-
</Text>
|
|
184
|
-
|
|
185
|
-
<Text>
|
|
186
|
-
<Icon>
|
|
187
|
-
<UserIcon />
|
|
188
|
-
</Icon>
|
|
189
|
-
<Icon>
|
|
190
|
-
<SettingsIcon />
|
|
191
|
-
</Icon>
|
|
192
|
-
Two on the left
|
|
193
|
-
</Text>
|
|
194
|
-
|
|
195
|
-
<Text>
|
|
196
|
-
Two on the right
|
|
197
|
-
<Icon>
|
|
198
|
-
<StarIcon />
|
|
199
|
-
</Icon>
|
|
200
|
-
<Icon>
|
|
201
|
-
<HeartIcon />
|
|
202
|
-
</Icon>
|
|
203
|
-
</Text>
|
|
204
|
-
|
|
205
|
-
<Text>
|
|
206
|
-
<Icon>
|
|
207
|
-
<HomeIcon />
|
|
208
|
-
</Icon>
|
|
209
|
-
<Icon>
|
|
210
|
-
<UserIcon />
|
|
211
|
-
</Icon>
|
|
212
|
-
Two on the left and right
|
|
213
|
-
<Icon>
|
|
214
|
-
<StarIcon />
|
|
215
|
-
</Icon>
|
|
216
|
-
<Icon>
|
|
217
|
-
<HeartIcon />
|
|
218
|
-
</Icon>
|
|
219
|
-
</Text>
|
|
220
|
-
</div>
|
|
221
|
-
</section>
|
|
222
|
-
|
|
223
|
-
<section style={{ marginBottom: "40px" }}>
|
|
224
|
-
<h2>Different Font Sizes</h2>
|
|
225
|
-
<div
|
|
226
|
-
style={{
|
|
227
|
-
display: "flex",
|
|
228
|
-
flexDirection: "column",
|
|
229
|
-
gap: "15px",
|
|
230
|
-
}}
|
|
231
|
-
>
|
|
232
|
-
<Text style={{ fontSize: "12px" }}>
|
|
233
|
-
<Icon>
|
|
234
|
-
<HomeIcon />
|
|
235
|
-
</Icon>
|
|
236
|
-
Small text with icon
|
|
237
|
-
</Text>
|
|
238
|
-
|
|
239
|
-
<Text style={{ fontSize: "16px" }}>
|
|
240
|
-
<Icon>
|
|
241
|
-
<UserIcon />
|
|
242
|
-
</Icon>
|
|
243
|
-
Normal text with icon
|
|
244
|
-
</Text>
|
|
245
|
-
|
|
246
|
-
<Text style={{ fontSize: "24px" }}>
|
|
247
|
-
<Icon>
|
|
248
|
-
<SettingsIcon />
|
|
249
|
-
</Icon>
|
|
250
|
-
Large text with icon
|
|
251
|
-
</Text>
|
|
252
|
-
|
|
253
|
-
<Text style={{ fontSize: "32px" }}>
|
|
254
|
-
<Icon>
|
|
255
|
-
<StarIcon />
|
|
256
|
-
</Icon>
|
|
257
|
-
Extra large text
|
|
258
|
-
</Text>
|
|
259
|
-
</div>
|
|
260
|
-
</section>
|
|
261
|
-
|
|
262
|
-
<section style={{ marginBottom: "40px" }}>
|
|
263
|
-
<h2>Colored Examples</h2>
|
|
264
|
-
<div
|
|
265
|
-
style={{
|
|
266
|
-
display: "flex",
|
|
267
|
-
flexDirection: "column",
|
|
268
|
-
gap: "10px",
|
|
269
|
-
}}
|
|
270
|
-
>
|
|
271
|
-
<Text style={{ color: "blue" }}>
|
|
272
|
-
<Icon>
|
|
273
|
-
<HomeIcon />
|
|
274
|
-
</Icon>
|
|
275
|
-
Blue home link
|
|
276
|
-
</Text>
|
|
277
|
-
|
|
278
|
-
<Text style={{ color: "green" }}>
|
|
279
|
-
<Icon>
|
|
280
|
-
<UserIcon />
|
|
281
|
-
</Icon>
|
|
282
|
-
Green user profile
|
|
283
|
-
</Text>
|
|
284
|
-
|
|
285
|
-
<Text style={{ color: "red" }}>
|
|
286
|
-
<Icon>
|
|
287
|
-
<HeartIcon />
|
|
288
|
-
</Icon>
|
|
289
|
-
Red heart favorite
|
|
290
|
-
</Text>
|
|
291
|
-
|
|
292
|
-
<Text style={{ color: "purple" }}>
|
|
293
|
-
<Icon>
|
|
294
|
-
<StarIcon />
|
|
295
|
-
</Icon>
|
|
296
|
-
Purple star rating
|
|
297
|
-
</Text>
|
|
298
|
-
</div>
|
|
299
|
-
</section>
|
|
300
|
-
|
|
301
|
-
<section style={{ marginBottom: "40px" }}>
|
|
302
|
-
<h2>Interactive Buttons</h2>
|
|
303
|
-
<div
|
|
304
|
-
style={{
|
|
305
|
-
display: "flex",
|
|
306
|
-
flexDirection: "column",
|
|
307
|
-
gap: "10px",
|
|
308
|
-
}}
|
|
309
|
-
>
|
|
310
|
-
<button
|
|
311
|
-
style={{
|
|
312
|
-
padding: "10px 15px",
|
|
313
|
-
border: "1px solid #ccc",
|
|
314
|
-
borderRadius: "4px",
|
|
315
|
-
background: "white",
|
|
316
|
-
cursor: "pointer",
|
|
317
|
-
fontSize: "14px",
|
|
318
|
-
}}
|
|
319
|
-
>
|
|
320
|
-
<Text>
|
|
321
|
-
<Icon>
|
|
322
|
-
<SearchIcon />
|
|
323
|
-
</Icon>
|
|
324
|
-
Search Files
|
|
325
|
-
</Text>
|
|
326
|
-
</button>
|
|
327
|
-
</div>
|
|
328
|
-
</section>
|
|
329
|
-
|
|
330
|
-
<section style={{ marginBottom: "40px" }}>
|
|
331
|
-
<h2>Navigation Menu Style</h2>
|
|
332
|
-
<nav
|
|
333
|
-
style={{
|
|
334
|
-
background: "#f8f9fa",
|
|
335
|
-
padding: "20px",
|
|
336
|
-
borderRadius: "8px",
|
|
337
|
-
}}
|
|
338
|
-
>
|
|
339
|
-
<div
|
|
340
|
-
style={{
|
|
341
|
-
display: "flex",
|
|
342
|
-
flexDirection: "column",
|
|
343
|
-
gap: "15px",
|
|
344
|
-
}}
|
|
345
|
-
>
|
|
346
|
-
<Text
|
|
347
|
-
style={{
|
|
348
|
-
cursor: "pointer",
|
|
349
|
-
padding: "8px 12px",
|
|
350
|
-
borderRadius: "4px",
|
|
351
|
-
background: "#007bff",
|
|
352
|
-
color: "white",
|
|
353
|
-
}}
|
|
354
|
-
>
|
|
355
|
-
<Icon>
|
|
356
|
-
<UserIcon />
|
|
357
|
-
</Icon>
|
|
358
|
-
Users
|
|
359
|
-
</Text>
|
|
360
|
-
</div>
|
|
361
|
-
</nav>
|
|
362
|
-
</section>
|
|
363
|
-
|
|
364
|
-
<section>
|
|
365
|
-
<h2>Inline Text with Icons</h2>
|
|
366
|
-
<p style={{ fontSize: "16px", lineHeight: "1.6" }}>
|
|
367
|
-
Welcome to our platform! Click on the{" "}
|
|
368
|
-
<Text bold>
|
|
369
|
-
<Icon>
|
|
370
|
-
<HomeIcon />
|
|
371
|
-
</Icon>
|
|
372
|
-
home
|
|
373
|
-
</Text>{" "}
|
|
374
|
-
button to return to the dashboard, or visit your{" "}
|
|
375
|
-
<Text italic>
|
|
376
|
-
<Icon>
|
|
377
|
-
<UserIcon />
|
|
378
|
-
</Icon>
|
|
379
|
-
profile
|
|
380
|
-
</Text>{" "}
|
|
381
|
-
to update your settings. Don't forget to{" "}
|
|
382
|
-
<Text underline>
|
|
383
|
-
<Icon>
|
|
384
|
-
<StarIcon />
|
|
385
|
-
</Icon>
|
|
386
|
-
star
|
|
387
|
-
</Text>{" "}
|
|
388
|
-
your favorite items and{" "}
|
|
389
|
-
<Text bold italic>
|
|
390
|
-
<Icon>
|
|
391
|
-
<HeartIcon />
|
|
392
|
-
</Icon>
|
|
393
|
-
like
|
|
394
|
-
</Text>{" "}
|
|
395
|
-
the content you enjoy. Use the{" "}
|
|
396
|
-
<Text bold underline>
|
|
397
|
-
<Icon>
|
|
398
|
-
<SearchIcon />
|
|
399
|
-
</Icon>
|
|
400
|
-
search
|
|
401
|
-
</Text>{" "}
|
|
402
|
-
feature to find what you're looking for quickly. You can also
|
|
403
|
-
combine{" "}
|
|
404
|
-
<Text italic underline>
|
|
405
|
-
multiple styles
|
|
406
|
-
</Text>{" "}
|
|
407
|
-
together for{" "}
|
|
408
|
-
<Text bold italic underline>
|
|
409
|
-
maximum emphasis
|
|
410
|
-
</Text>
|
|
411
|
-
!
|
|
412
|
-
</p>
|
|
413
|
-
</section>
|
|
414
|
-
</div>
|
|
415
|
-
);
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
render(<Demo />, document.getElementById("app"));
|
|
419
|
-
</script>
|
|
420
|
-
</body>
|
|
421
|
-
</html>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const Overflow = ({ className, children, afterContent }) => {
|
|
2
|
-
return (
|
|
3
|
-
<div
|
|
4
|
-
className={className}
|
|
5
|
-
style="display: flex; flex-wrap: wrap; overflow: hidden; width: 100%; box-sizing: border-box; white-space: nowrap; text-overflow: ellipsis;"
|
|
6
|
-
>
|
|
7
|
-
<div style="display: flex; flex-grow: 1; width: 0; gap: 0.3em">
|
|
8
|
-
<div style="overflow: hidden; max-width: 100%; text-overflow: ellipsis;">
|
|
9
|
-
{children}
|
|
10
|
-
</div>
|
|
11
|
-
{afterContent}
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { useLayoutStyle } from "../layout/use_layout_style.js";
|
|
2
|
-
import { withPropsStyle } from "../props_composition/with_props_style.js";
|
|
3
|
-
|
|
4
|
-
import.meta.css = /* css */ `
|
|
5
|
-
:root {
|
|
6
|
-
--navi-icon-align-y: center;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.navi_text {
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
align-items: baseline;
|
|
12
|
-
gap: 0.1em;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.navi_icon {
|
|
16
|
-
--align-y: var(--navi-icon-align-y, center);
|
|
17
|
-
|
|
18
|
-
display: inline-flex;
|
|
19
|
-
width: 1em;
|
|
20
|
-
height: 1em;
|
|
21
|
-
flex-shrink: 0;
|
|
22
|
-
align-self: var(--align-y);
|
|
23
|
-
line-height: 1em;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
export const useTypographyStyle = (props) => {
|
|
28
|
-
const color = props.color;
|
|
29
|
-
const bold = props.bold;
|
|
30
|
-
const italic = props.italic;
|
|
31
|
-
const underline = props.underline;
|
|
32
|
-
const size = props.size;
|
|
33
|
-
delete props.color;
|
|
34
|
-
delete props.bold;
|
|
35
|
-
delete props.italic;
|
|
36
|
-
delete props.underline;
|
|
37
|
-
delete props.size;
|
|
38
|
-
return {
|
|
39
|
-
color,
|
|
40
|
-
fontWeight: bold ? "bold" : bold === undefined ? undefined : "normal",
|
|
41
|
-
fontStyle: italic ? "italic" : italic === undefined ? undefined : "normal",
|
|
42
|
-
fontSize: size,
|
|
43
|
-
textDecoration: underline
|
|
44
|
-
? "underline"
|
|
45
|
-
: underline === undefined
|
|
46
|
-
? undefined
|
|
47
|
-
: "none",
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const Text = ({ style, children, ...rest }) => {
|
|
52
|
-
const { all } = useLayoutStyle(rest);
|
|
53
|
-
const innerStyle = withPropsStyle(
|
|
54
|
-
{
|
|
55
|
-
...all,
|
|
56
|
-
...useTypographyStyle(rest),
|
|
57
|
-
},
|
|
58
|
-
style,
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<span {...rest} className="navi_text" style={innerStyle}>
|
|
63
|
-
{children}
|
|
64
|
-
</span>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const Icon = ({ style, children, ...rest }) => {
|
|
69
|
-
const { all } = useLayoutStyle(rest);
|
|
70
|
-
const innerStyle = withPropsStyle(
|
|
71
|
-
{
|
|
72
|
-
...all,
|
|
73
|
-
...useTypographyStyle(rest),
|
|
74
|
-
},
|
|
75
|
-
style,
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<span {...rest} className="navi_icon" style={innerStyle}>
|
|
80
|
-
{children}
|
|
81
|
-
</span>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Overflow } from "./overflow.jsx";
|
|
2
|
-
|
|
3
|
-
import.meta.css = /* css */ `
|
|
4
|
-
.text_and_count {
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: 3px;
|
|
8
|
-
flex: 1;
|
|
9
|
-
white-space: nowrap;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.count {
|
|
13
|
-
position: relative;
|
|
14
|
-
top: -1px;
|
|
15
|
-
color: rgba(28, 43, 52, 0.4);
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
export const TextAndCount = ({ text, count }) => {
|
|
20
|
-
return (
|
|
21
|
-
<Overflow
|
|
22
|
-
className="text_and_count"
|
|
23
|
-
afterContent={count > 0 && <span className="count">({count})</span>}
|
|
24
|
-
>
|
|
25
|
-
<span className="label">{text}</span>
|
|
26
|
-
</Overflow>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UITransition
|
|
3
|
-
*
|
|
4
|
-
* A Preact component that enables smooth animated transitions between its children when the content changes.
|
|
5
|
-
* It observes content keys and phases to create different types of transitions.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Content transitions: Between different content keys (e.g., user profiles, search results)
|
|
9
|
-
* - Phase transitions: Between loading/content/error states for the same content key
|
|
10
|
-
* - Automatic size animation to accommodate content changes
|
|
11
|
-
* - Configurable transition types: "slide-left", "cross-fade"
|
|
12
|
-
* - Independent duration control for content and phase transitions
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
* - Wrap dynamic content in <UITransition> to animate between states
|
|
16
|
-
* - Set a unique `data-content-key` on your rendered content to identify each content variant
|
|
17
|
-
* - Use `data-content-phase` to mark loading/error states for phase transitions
|
|
18
|
-
* - Configure transition types and durations for both content and phase changes
|
|
19
|
-
*
|
|
20
|
-
* Example:
|
|
21
|
-
*
|
|
22
|
-
* <UITransition
|
|
23
|
-
* transitionType="slide-left"
|
|
24
|
-
* transitionDuration={400}
|
|
25
|
-
* phaseTransitionType="cross-fade"
|
|
26
|
-
* phaseTransitionDuration={300}
|
|
27
|
-
* >
|
|
28
|
-
* {isLoading
|
|
29
|
-
* ? <Spinner data-content-key={userId} data-content-phase />
|
|
30
|
-
* : <UserProfile user={user} data-content-key={userId} />}
|
|
31
|
-
* </UITransition>
|
|
32
|
-
*
|
|
33
|
-
* When `data-content-key` changes, UITransition animates content transitions.
|
|
34
|
-
* When `data-content-phase` changes for the same key, it animates phase transitions.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
import { initUITransition } from "@jsenv/dom";
|
|
38
|
-
import { createContext } from "preact";
|
|
39
|
-
import { useContext, useLayoutEffect, useRef, useState } from "preact/hooks";
|
|
40
|
-
|
|
41
|
-
const ContentKeyContext = createContext();
|
|
42
|
-
|
|
43
|
-
export const UITransition = ({
|
|
44
|
-
children,
|
|
45
|
-
contentKey,
|
|
46
|
-
sizeTransition,
|
|
47
|
-
sizeTransitionDuration,
|
|
48
|
-
transitionType,
|
|
49
|
-
transitionDuration,
|
|
50
|
-
phaseTransitionType,
|
|
51
|
-
phaseTransitionDuration,
|
|
52
|
-
debugTransition,
|
|
53
|
-
...props
|
|
54
|
-
}) => {
|
|
55
|
-
const [contentKeyFromContext, setContentKeyFromContext] = useState();
|
|
56
|
-
const effectiveContentKey = contentKey || contentKeyFromContext;
|
|
57
|
-
|
|
58
|
-
const ref = useRef();
|
|
59
|
-
useLayoutEffect(() => {
|
|
60
|
-
const uiTransition = initUITransition(ref.current);
|
|
61
|
-
return () => {
|
|
62
|
-
uiTransition.cleanup();
|
|
63
|
-
};
|
|
64
|
-
}, []);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<ContentKeyContext.Provider value={setContentKeyFromContext}>
|
|
68
|
-
<div
|
|
69
|
-
ref={ref}
|
|
70
|
-
{...props}
|
|
71
|
-
className="ui_transition_container"
|
|
72
|
-
data-size-transition={sizeTransition ? "" : undefined}
|
|
73
|
-
data-size-transition-duration={
|
|
74
|
-
sizeTransitionDuration ? sizeTransitionDuration : undefined
|
|
75
|
-
}
|
|
76
|
-
data-content-transition={transitionType ? transitionType : undefined}
|
|
77
|
-
data-content-transition-duration={
|
|
78
|
-
transitionDuration ? transitionDuration : undefined
|
|
79
|
-
}
|
|
80
|
-
data-phase-transition={
|
|
81
|
-
phaseTransitionType ? phaseTransitionType : undefined
|
|
82
|
-
}
|
|
83
|
-
data-phase-transition-duration={
|
|
84
|
-
phaseTransitionDuration ? phaseTransitionDuration : undefined
|
|
85
|
-
}
|
|
86
|
-
data-debug-transition={debugTransition ? "" : undefined}
|
|
87
|
-
>
|
|
88
|
-
<div className="ui_transition_outer_wrapper">
|
|
89
|
-
<div className="ui_transition_measure_wrapper">
|
|
90
|
-
<div
|
|
91
|
-
className="ui_transition_slot"
|
|
92
|
-
data-content-key={
|
|
93
|
-
effectiveContentKey ? effectiveContentKey : undefined
|
|
94
|
-
}
|
|
95
|
-
>
|
|
96
|
-
{children}
|
|
97
|
-
</div>
|
|
98
|
-
<div className="ui_transition_phase_overlay"></div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
<div className="ui_transition_content_overlay"></div>
|
|
102
|
-
</div>
|
|
103
|
-
</ContentKeyContext.Provider>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export const useContentKey = (key, enabled) => {
|
|
108
|
-
const setKey = useContext(ContentKeyContext);
|
|
109
|
-
if (setKey && enabled) {
|
|
110
|
-
setKey(key);
|
|
111
|
-
}
|
|
112
|
-
useLayoutEffect(() => {
|
|
113
|
-
if (!setKey || !enabled) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
return () => {
|
|
117
|
-
setKey((v) => {
|
|
118
|
-
if (v !== key) {
|
|
119
|
-
// the current key is different from the one we set
|
|
120
|
-
// it means another component set it in the meantime
|
|
121
|
-
// we should not clear it
|
|
122
|
-
return v;
|
|
123
|
-
}
|
|
124
|
-
return undefined;
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
}, [enabled]);
|
|
128
|
-
};
|