@jsenv/navi 0.0.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/index.js +51 -0
- package/package.json +38 -0
- package/src/action_private_properties.js +11 -0
- package/src/action_proxy_test.html +353 -0
- package/src/action_run_states.js +5 -0
- package/src/actions.js +1377 -0
- package/src/browser_integration/browser_integration.js +191 -0
- package/src/browser_integration/document_back_and_forward.js +17 -0
- package/src/browser_integration/document_loading_signal.js +100 -0
- package/src/browser_integration/document_state_signal.js +9 -0
- package/src/browser_integration/document_url_signal.js +9 -0
- package/src/browser_integration/use_is_visited.js +19 -0
- package/src/browser_integration/via_history.js +199 -0
- package/src/browser_integration/via_navigation.js +168 -0
- package/src/components/action_execution/form_context.js +8 -0
- package/src/components/action_execution/render_actionable_component.jsx +27 -0
- package/src/components/action_execution/use_action.js +330 -0
- package/src/components/action_execution/use_execute_action.js +161 -0
- package/src/components/action_renderer.jsx +136 -0
- package/src/components/collect_form_element_values.js +79 -0
- package/src/components/demos/0_button_demo.html +155 -0
- package/src/components/demos/1_checkbox_demo.html +257 -0
- package/src/components/demos/2_input_textual_demo.html +354 -0
- package/src/components/demos/3_radio_demo.html +222 -0
- package/src/components/demos/4_select_demo.html +104 -0
- package/src/components/demos/5_list_scrollable_demo.html +153 -0
- package/src/components/demos/action/0_button_demo.html +204 -0
- package/src/components/demos/action/10_shortcuts_demo.html +189 -0
- package/src/components/demos/action/11_nested_shortcuts_demo.html +401 -0
- package/src/components/demos/action/1_input_text_demo.html +461 -0
- package/src/components/demos/action/2_form_multiple.html +303 -0
- package/src/components/demos/action/3_details_demo.html +172 -0
- package/src/components/demos/action/4_input_checkbox_demo.html +611 -0
- package/src/components/demos/action/6_checkbox_list_demo.html +109 -0
- package/src/components/demos/action/7_radio_list_demo.html +217 -0
- package/src/components/demos/action/8_editable_text_demo.html +442 -0
- package/src/components/demos/action/9_link_demo.html +172 -0
- package/src/components/demos/demo.md +0 -0
- package/src/components/demos/route/basic/basic.html +14 -0
- package/src/components/demos/route/basic/basic_route_demo.jsx +224 -0
- package/src/components/demos/route/multi/multi.html +14 -0
- package/src/components/demos/route/multi/multi_route_demo.jsx +277 -0
- package/src/components/details/details.jsx +248 -0
- package/src/components/details/summary_marker.jsx +141 -0
- package/src/components/editable_text/editable_text.jsx +96 -0
- package/src/components/error_boundary_context.js +9 -0
- package/src/components/form.jsx +144 -0
- package/src/components/input/button.jsx +333 -0
- package/src/components/input/checkbox_list.jsx +294 -0
- package/src/components/input/field.jsx +61 -0
- package/src/components/input/field_css.js +118 -0
- package/src/components/input/input.jsx +15 -0
- package/src/components/input/input_checkbox.jsx +370 -0
- package/src/components/input/input_radio.jsx +299 -0
- package/src/components/input/input_textual.jsx +338 -0
- package/src/components/input/radio_list.jsx +283 -0
- package/src/components/input/select.jsx +273 -0
- package/src/components/input/use_form_event.js +20 -0
- package/src/components/input/use_on_change.js +12 -0
- package/src/components/link/link.jsx +291 -0
- package/src/components/loader/loader_background.jsx +324 -0
- package/src/components/loader/loading_spinner.jsx +68 -0
- package/src/components/loader/network_speed.js +83 -0
- package/src/components/loader/rectangle_loading.jsx +225 -0
- package/src/components/route.jsx +15 -0
- package/src/components/selection/selection.js +5 -0
- package/src/components/selection/selection_context.jsx +262 -0
- package/src/components/shortcut/os.js +9 -0
- package/src/components/shortcut/shortcut_context.jsx +390 -0
- package/src/components/use_action_events.js +37 -0
- package/src/components/use_auto_focus.js +43 -0
- package/src/components/use_debounce_true.js +31 -0
- package/src/components/use_focus_group.js +19 -0
- package/src/components/use_initial_value.js +104 -0
- package/src/components/use_is_visited.js +19 -0
- package/src/components/use_ref_array.js +38 -0
- package/src/components/use_signal_sync.js +50 -0
- package/src/components/use_state_array.js +40 -0
- package/src/docs/actions.md +228 -0
- package/src/docs/demos/resource/action_status.jsx +42 -0
- package/src/docs/demos/resource/demo.md +1 -0
- package/src/docs/demos/resource/resource_demo_0.html +84 -0
- package/src/docs/demos/resource/resource_demo_10_post_gc.html +364 -0
- package/src/docs/demos/resource/resource_demo_11_describe_many.html +362 -0
- package/src/docs/demos/resource/resource_demo_2.html +173 -0
- package/src/docs/demos/resource/resource_demo_3_filtered_users.html +415 -0
- package/src/docs/demos/resource/resource_demo_4_details.html +284 -0
- package/src/docs/demos/resource/resource_demo_5_renderer_lazy.html +115 -0
- package/src/docs/demos/resource/resource_demo_6_gc.html +217 -0
- package/src/docs/demos/resource/resource_demo_7_child_gc.html +240 -0
- package/src/docs/demos/resource/resource_demo_8_proxy_gc.html +319 -0
- package/src/docs/demos/resource/resource_demo_9_describe_one.html +472 -0
- package/src/docs/demos/resource/tata.jsx +3 -0
- package/src/docs/demos/resource/toto.jsx +3 -0
- package/src/docs/demos/user_nav/user_nav.html +12 -0
- package/src/docs/demos/user_nav/user_nav.jsx +330 -0
- package/src/docs/resource_dependencies.md +103 -0
- package/src/docs/resource_with_params.md +80 -0
- package/src/notes.md +13 -0
- package/src/route/route.js +518 -0
- package/src/route/route.test.html +228 -0
- package/src/store/array_signal_store.js +537 -0
- package/src/store/local_storage_signal.js +17 -0
- package/src/store/resource_graph.js +1303 -0
- package/src/store/tests/resource_graph_autoreload_demo.html +12 -0
- package/src/store/tests/resource_graph_autoreload_demo.jsx +964 -0
- package/src/store/tests/resource_graph_dependencies.test.js +95 -0
- package/src/store/value_in_local_storage.js +187 -0
- package/src/symbol_object_signal.js +1 -0
- package/src/use_action_data.js +10 -0
- package/src/use_action_status.js +47 -0
- package/src/utils/add_many_event_listeners.js +15 -0
- package/src/utils/array_add_remove.js +61 -0
- package/src/utils/array_signal.js +15 -0
- package/src/utils/compare_two_js_values.js +172 -0
- package/src/utils/execute_with_cleanup.js +21 -0
- package/src/utils/get_caller_info.js +85 -0
- package/src/utils/iterable_weak_set.js +62 -0
- package/src/utils/js_value_weak_map.js +162 -0
- package/src/utils/js_value_weak_map_demo.html +690 -0
- package/src/utils/merge_two_js_values.js +53 -0
- package/src/utils/stringify_for_display.js +150 -0
- package/src/utils/weak_effect.js +48 -0
|
@@ -0,0 +1,109 @@
|
|
|
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>Checkbox list demo</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root" style="position: relative"></div>
|
|
11
|
+
|
|
12
|
+
<script type="module" jsenv-type="module/jsx">
|
|
13
|
+
import { render } from "preact";
|
|
14
|
+
import {
|
|
15
|
+
// eslint-disable-next-line no-unused-vars
|
|
16
|
+
Button,
|
|
17
|
+
// eslint-disable-next-line no-unused-vars
|
|
18
|
+
Form,
|
|
19
|
+
// eslint-disable-next-line no-unused-vars
|
|
20
|
+
CheckboxList,
|
|
21
|
+
} from "@jsenv/navi";
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line no-unused-vars
|
|
24
|
+
const App = () => {
|
|
25
|
+
return (
|
|
26
|
+
<div style="display: flex; flex-direction: row; gap: 30px">
|
|
27
|
+
<div>
|
|
28
|
+
<p>
|
|
29
|
+
<strong>Action + log after 1s</strong>
|
|
30
|
+
</p>
|
|
31
|
+
<CheckboxList
|
|
32
|
+
name="colors"
|
|
33
|
+
label="Select your favorite colors:"
|
|
34
|
+
value={["red", "blue"]}
|
|
35
|
+
action={async ({ colors }) => {
|
|
36
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
37
|
+
console.log(`Colors selected: ${JSON.stringify(colors)}`);
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{[
|
|
41
|
+
{ label: "Red", value: "red" },
|
|
42
|
+
{ label: "Blue", value: "blue" },
|
|
43
|
+
{ label: "Green", value: "green" },
|
|
44
|
+
]}
|
|
45
|
+
</CheckboxList>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div>
|
|
49
|
+
<p>
|
|
50
|
+
<strong>Form + alert after 1s</strong>
|
|
51
|
+
</p>
|
|
52
|
+
<Form
|
|
53
|
+
action={async ({ colors }) => {
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
55
|
+
// eslint-disable-next-line no-alert
|
|
56
|
+
window.alert(`Colors selected: ${JSON.stringify(colors)}`);
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<CheckboxList
|
|
60
|
+
id="form_alert_1"
|
|
61
|
+
name="colors"
|
|
62
|
+
label="Select your favorite colors:"
|
|
63
|
+
value={["blue"]}
|
|
64
|
+
>
|
|
65
|
+
{[
|
|
66
|
+
{ label: "Red", id: "red", value: "red" },
|
|
67
|
+
{ label: "Blue", id: "blue", value: "blue" },
|
|
68
|
+
{ label: "Green", id: "green", value: "green" },
|
|
69
|
+
]}
|
|
70
|
+
</CheckboxList>
|
|
71
|
+
|
|
72
|
+
<Button type="submit">Submit</Button>
|
|
73
|
+
<Button type="reset">Reset</Button>
|
|
74
|
+
</Form>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div>
|
|
78
|
+
<p>
|
|
79
|
+
<strong>Form + throw after 1s</strong>
|
|
80
|
+
</p>
|
|
81
|
+
<Form
|
|
82
|
+
action={async ({ colors }) => {
|
|
83
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
84
|
+
throw new Error(`Colors selected: ${JSON.stringify(colors)}`);
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<CheckboxList
|
|
88
|
+
label="Select your favorite colors:"
|
|
89
|
+
name="colors"
|
|
90
|
+
value={["red", "blue"]}
|
|
91
|
+
>
|
|
92
|
+
{[
|
|
93
|
+
{ label: "Red", value: "red" },
|
|
94
|
+
{ label: "Blue", value: "blue" },
|
|
95
|
+
{ label: "Green", value: "green" },
|
|
96
|
+
]}
|
|
97
|
+
</CheckboxList>
|
|
98
|
+
<Button type="submit">Submit</Button>
|
|
99
|
+
<Button type="reset">Reset</Button>
|
|
100
|
+
</Form>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
render(<App />, document.querySelector("#root"));
|
|
107
|
+
</script>
|
|
108
|
+
</body>
|
|
109
|
+
</html>
|
|
@@ -0,0 +1,217 @@
|
|
|
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>Radio list demo</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root" style="position: relative"></div>
|
|
11
|
+
|
|
12
|
+
<script type="module" jsenv-type="module/jsx">
|
|
13
|
+
import { render } from "preact";
|
|
14
|
+
import {
|
|
15
|
+
// eslint-disable-next-line no-unused-vars
|
|
16
|
+
Button,
|
|
17
|
+
// eslint-disable-next-line no-unused-vars
|
|
18
|
+
Form,
|
|
19
|
+
// eslint-disable-next-line no-unused-vars
|
|
20
|
+
RadioList,
|
|
21
|
+
} from "@jsenv/navi";
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line no-unused-vars
|
|
24
|
+
const App = () => {
|
|
25
|
+
return (
|
|
26
|
+
<div>
|
|
27
|
+
<div style="display: flex; flex-direction: row; gap: 30px">
|
|
28
|
+
<div>
|
|
29
|
+
<p>
|
|
30
|
+
<strong>No action </strong>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<RadioList
|
|
34
|
+
id="no_action"
|
|
35
|
+
name="color"
|
|
36
|
+
label="Select your favorite color:"
|
|
37
|
+
>
|
|
38
|
+
{[
|
|
39
|
+
{ label: "Red", value: "red" },
|
|
40
|
+
{ label: "Blue", value: "blue" },
|
|
41
|
+
{ label: "Green", value: "green" },
|
|
42
|
+
]}
|
|
43
|
+
</RadioList>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div>
|
|
47
|
+
<p>
|
|
48
|
+
<strong>action log after 1s</strong>
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
<RadioList
|
|
52
|
+
id="action_alert"
|
|
53
|
+
name="color_alert"
|
|
54
|
+
label="Select your favorite color:"
|
|
55
|
+
action={async ({ color_alert }) => {
|
|
56
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
57
|
+
console.log(
|
|
58
|
+
`Color selected: ${JSON.stringify(color_alert)}`,
|
|
59
|
+
);
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{[
|
|
63
|
+
{ label: "Red", value: "red" },
|
|
64
|
+
{ label: "Blue", value: "blue" },
|
|
65
|
+
{ label: "Green", value: "green" },
|
|
66
|
+
]}
|
|
67
|
+
</RadioList>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div>
|
|
71
|
+
<p>
|
|
72
|
+
<strong>Form + log after 1s</strong>
|
|
73
|
+
</p>
|
|
74
|
+
<Form
|
|
75
|
+
action={async ({ color }) => {
|
|
76
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
77
|
+
console.log(`Color selected: ${JSON.stringify(color)}`);
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
<RadioList
|
|
81
|
+
id="color_form_log"
|
|
82
|
+
label="Select your favorite color:"
|
|
83
|
+
name="color"
|
|
84
|
+
>
|
|
85
|
+
{[
|
|
86
|
+
{ label: "Red", id: "red", value: "red" },
|
|
87
|
+
{ label: "Blue", id: "blue", value: "blue" },
|
|
88
|
+
{ label: "Green", id: "green", value: "green" },
|
|
89
|
+
]}
|
|
90
|
+
</RadioList>
|
|
91
|
+
|
|
92
|
+
<Button type="submit">Submit</Button>
|
|
93
|
+
<Button type="reset">Reset</Button>
|
|
94
|
+
</Form>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div>
|
|
99
|
+
<p>
|
|
100
|
+
<strong>Action + throw after 1s</strong>
|
|
101
|
+
</p>
|
|
102
|
+
|
|
103
|
+
<RadioList
|
|
104
|
+
id="color_action_throw"
|
|
105
|
+
name="color_action_throw"
|
|
106
|
+
label="Select your favorite color:"
|
|
107
|
+
action={async ({ color_action_throw }) => {
|
|
108
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Color selected: ${JSON.stringify(color_action_throw)}`,
|
|
111
|
+
);
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
{[
|
|
115
|
+
{ label: "Red", id: "red", value: "red" },
|
|
116
|
+
{ label: "Blue", id: "blue", value: "blue" },
|
|
117
|
+
{ label: "Green", id: "green", value: "green" },
|
|
118
|
+
]}
|
|
119
|
+
</RadioList>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div>
|
|
123
|
+
<div>
|
|
124
|
+
<p>
|
|
125
|
+
<strong>Form + throw after 1s</strong>
|
|
126
|
+
</p>
|
|
127
|
+
<Form
|
|
128
|
+
action={async ({ color_form_throw }) => {
|
|
129
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Color selected: ${JSON.stringify(color_form_throw)}`,
|
|
132
|
+
);
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<RadioList
|
|
136
|
+
id="color_form_throw"
|
|
137
|
+
name="color_form_throw"
|
|
138
|
+
label="Select your favorite color:"
|
|
139
|
+
>
|
|
140
|
+
{[
|
|
141
|
+
{ label: "Red", id: "red", value: "red" },
|
|
142
|
+
{ label: "Blue", id: "blue", value: "blue" },
|
|
143
|
+
{ label: "Green", id: "green", value: "green" },
|
|
144
|
+
]}
|
|
145
|
+
</RadioList>
|
|
146
|
+
|
|
147
|
+
<Button type="submit">Submit</Button>
|
|
148
|
+
<Button type="reset">Reset</Button>
|
|
149
|
+
</Form>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div>
|
|
154
|
+
<p>
|
|
155
|
+
<strong>Form + ref checked throw after 1s</strong>
|
|
156
|
+
</p>
|
|
157
|
+
<Form
|
|
158
|
+
action={async ({ color_form_checked_throw }) => {
|
|
159
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Color selected: ${JSON.stringify(color_form_checked_throw)}`,
|
|
162
|
+
);
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
<RadioList
|
|
166
|
+
id="color_form_checked_throw"
|
|
167
|
+
name="color_form_checked_throw"
|
|
168
|
+
label="Select your favorite color:"
|
|
169
|
+
value="red"
|
|
170
|
+
>
|
|
171
|
+
{[
|
|
172
|
+
{ label: "Red", id: "red", value: "red" },
|
|
173
|
+
{ label: "Blue", id: "blue", value: "blue" },
|
|
174
|
+
{ label: "Green", id: "green", value: "green" },
|
|
175
|
+
]}
|
|
176
|
+
</RadioList>
|
|
177
|
+
|
|
178
|
+
<Button type="submit">Submit</Button>
|
|
179
|
+
<Button type="reset">Reset</Button>
|
|
180
|
+
</Form>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<div>
|
|
184
|
+
<p>
|
|
185
|
+
<strong>Form + required</strong>
|
|
186
|
+
</p>
|
|
187
|
+
<Form
|
|
188
|
+
action={async () => {
|
|
189
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<RadioList
|
|
193
|
+
id="color_form_required"
|
|
194
|
+
label="Select your favorite color:"
|
|
195
|
+
name="color"
|
|
196
|
+
required
|
|
197
|
+
data-required-message="Veuillez sélectionner une couleur"
|
|
198
|
+
>
|
|
199
|
+
{[
|
|
200
|
+
{ label: "Red", id: "red", value: "red" },
|
|
201
|
+
{ label: "Blue", id: "blue", value: "blue" },
|
|
202
|
+
{ label: "Green", id: "green", value: "green" },
|
|
203
|
+
]}
|
|
204
|
+
</RadioList>
|
|
205
|
+
|
|
206
|
+
<Button type="submit">Submit</Button>
|
|
207
|
+
<Button type="reset">Reset</Button>
|
|
208
|
+
</Form>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
render(<App />, document.querySelector("#root"));
|
|
215
|
+
</script>
|
|
216
|
+
</body>
|
|
217
|
+
</html>
|