@jsenv/navi 0.0.1 → 0.1.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.
Files changed (139) hide show
  1. package/dist/jsenv_navi.js +22959 -0
  2. package/index.js +66 -16
  3. package/package.json +23 -11
  4. package/src/actions.js +50 -26
  5. package/src/browser_integration/browser_integration.js +31 -6
  6. package/src/browser_integration/via_history.js +42 -9
  7. package/src/components/action_execution/render_actionable_component.jsx +6 -4
  8. package/src/components/action_execution/use_action.js +51 -282
  9. package/src/components/action_execution/use_execute_action.js +106 -92
  10. package/src/components/action_execution/use_run_on_mount.js +9 -0
  11. package/src/components/action_renderer.jsx +21 -32
  12. package/src/components/demos/0_button_demo.html +574 -103
  13. package/src/components/demos/10_column_reordering_debug.html +277 -0
  14. package/src/components/demos/11_table_selection_debug.html +432 -0
  15. package/src/components/demos/1_checkbox_demo.html +579 -202
  16. package/src/components/demos/2_input_textual_demo.html +81 -138
  17. package/src/components/demos/3_radio_demo.html +0 -2
  18. package/src/components/demos/4_select_demo.html +19 -23
  19. package/src/components/demos/6_tablist_demo.html +77 -0
  20. package/src/components/demos/7_table_selection_demo.html +176 -0
  21. package/src/components/demos/8_table_fixed_headers_demo.html +584 -0
  22. package/src/components/demos/9_table_column_drag_demo.html +325 -0
  23. package/src/components/demos/action/0_button_demo.html +2 -4
  24. package/src/components/demos/action/1_input_text_demo.html +643 -222
  25. package/src/components/demos/action/3_details_demo.html +146 -115
  26. package/src/components/demos/action/4_input_checkbox_demo.html +442 -322
  27. package/src/components/demos/action/5_input_checkbox_state_demo.html +270 -0
  28. package/src/components/demos/action/6_checkbox_list_demo.html +304 -72
  29. package/src/components/demos/action/7_radio_list_demo.html +310 -170
  30. package/src/components/demos/action/{8_editable_text_demo.html → 8_editable_demo.html} +65 -76
  31. package/src/components/demos/action/9_link_demo.html +84 -62
  32. package/src/components/demos/ui_transition/0_action_renderer_ui_transition_demo.html +695 -0
  33. package/src/components/demos/ui_transition/1_nested_ui_transition_demo.html +429 -0
  34. package/src/components/demos/ui_transition/2_height_transition_test.html +295 -0
  35. package/src/components/details/details.jsx +62 -64
  36. package/src/components/edition/editable.jsx +186 -0
  37. package/src/components/field/README.md +247 -0
  38. package/src/components/{input → field}/button.jsx +151 -130
  39. package/src/components/field/checkbox_list.jsx +184 -0
  40. package/src/components/{collect_form_element_values.js → field/collect_form_element_values.js} +7 -4
  41. package/src/components/{input → field}/field_css.js +4 -1
  42. package/src/components/field/form.jsx +211 -0
  43. package/src/components/{input → field}/input.jsx +1 -0
  44. package/src/components/{input → field}/input_checkbox.jsx +132 -155
  45. package/src/components/{input → field}/input_radio.jsx +135 -46
  46. package/src/components/field/input_textual.jsx +418 -0
  47. package/src/components/field/label.jsx +32 -0
  48. package/src/components/field/radio_list.jsx +182 -0
  49. package/src/components/{input → field}/select.jsx +17 -32
  50. package/src/components/field/use_action_events.js +132 -0
  51. package/src/components/field/use_form_events.js +55 -0
  52. package/src/components/field/use_ui_state_controller.js +506 -0
  53. package/src/components/item_tracker/README.md +461 -0
  54. package/src/components/item_tracker/use_isolated_item_tracker.jsx +209 -0
  55. package/src/components/item_tracker/use_isolated_item_tracker_demo.html +148 -0
  56. package/src/components/item_tracker/use_isolated_item_tracker_demo.jsx +460 -0
  57. package/src/components/item_tracker/use_item_tracker.jsx +143 -0
  58. package/src/components/item_tracker/use_item_tracker_demo.html +207 -0
  59. package/src/components/item_tracker/use_item_tracker_demo.jsx +216 -0
  60. package/src/components/keyboard_shortcuts/active_keyboard_shortcuts.jsx +87 -0
  61. package/src/components/keyboard_shortcuts/aria_key_shortcuts.js +61 -0
  62. package/src/components/keyboard_shortcuts/keyboard_key_meta.js +17 -0
  63. package/src/components/keyboard_shortcuts/keyboard_shortcuts.js +371 -0
  64. package/src/components/link/link.jsx +65 -102
  65. package/src/components/link/link_with_icon.jsx +52 -0
  66. package/src/components/loader/loader_background.jsx +85 -64
  67. package/src/components/loader/rectangle_loading.jsx +38 -19
  68. package/src/components/route.jsx +8 -4
  69. package/src/components/selection/selection.jsx +1583 -0
  70. package/src/components/svg/font_sized_svg.jsx +45 -0
  71. package/src/components/svg/icon_and_text.jsx +21 -0
  72. package/src/components/svg/svg_mask_overlay.jsx +105 -0
  73. package/src/components/table/drag/table_drag.jsx +506 -0
  74. package/src/components/table/resize/table_resize.jsx +650 -0
  75. package/src/components/table/resize/table_size.js +43 -0
  76. package/src/components/table/selection/table_selection.js +106 -0
  77. package/src/components/table/selection/table_selection.jsx +203 -0
  78. package/src/components/table/sticky/sticky_group.js +354 -0
  79. package/src/components/table/sticky/table_sticky.js +25 -0
  80. package/src/components/table/sticky/table_sticky.jsx +501 -0
  81. package/src/components/table/table.jsx +721 -0
  82. package/src/components/table/table_css.js +211 -0
  83. package/src/components/table/table_ui.jsx +49 -0
  84. package/src/components/table/use_cells_and_columns.js +90 -0
  85. package/src/components/table/use_object_array_to_cells.js +46 -0
  86. package/src/components/table/z_indexes.js +23 -0
  87. package/src/components/tablist/tablist.jsx +99 -0
  88. package/src/components/text/overflow.jsx +15 -0
  89. package/src/components/text/text_and_count.jsx +28 -0
  90. package/src/components/ui_transition.jsx +128 -0
  91. package/src/components/use_auto_focus.js +58 -7
  92. package/src/components/use_batch_during_render.js +33 -0
  93. package/src/components/use_debounce_true.js +7 -7
  94. package/src/components/use_dependencies_diff.js +35 -0
  95. package/src/components/use_focus_group.js +4 -3
  96. package/src/components/use_initial_value.js +8 -34
  97. package/src/components/use_signal_sync.js +1 -1
  98. package/src/components/use_stable_callback.js +68 -0
  99. package/src/components/use_state_array.js +16 -9
  100. package/src/docs/actions.md +22 -0
  101. package/src/notes.md +33 -12
  102. package/src/route/route.js +97 -47
  103. package/src/store/resource_graph.js +2 -1
  104. package/src/store/tests/{resource_graph_dependencies.test.js → resource_graph_dependencies.test_manual.js} +13 -13
  105. package/src/utils/is_signal.js +20 -0
  106. package/src/utils/stringify_for_display.js +4 -23
  107. package/src/validation/constraints/confirm_constraint.js +14 -0
  108. package/src/validation/constraints/create_unique_value_constraint.js +27 -0
  109. package/src/validation/constraints/native_constraints.js +313 -0
  110. package/src/validation/constraints/readonly_constraint.js +36 -0
  111. package/src/validation/constraints/single_space_constraint.js +13 -0
  112. package/src/validation/custom_constraint_validation.js +599 -0
  113. package/src/validation/custom_message.js +18 -0
  114. package/src/validation/demos/browser_style.png +0 -0
  115. package/src/validation/demos/form_validation_demo.html +142 -0
  116. package/src/validation/demos/form_validation_demo_preact.html +87 -0
  117. package/src/validation/demos/form_validation_native_popover_demo.html +168 -0
  118. package/src/validation/demos/form_validation_vs_native_demo.html +172 -0
  119. package/src/validation/demos/validation_message_demo.html +203 -0
  120. package/src/validation/hooks/use_constraints.js +23 -0
  121. package/src/validation/hooks/use_custom_validation_ref.js +73 -0
  122. package/src/validation/hooks/use_validation_message.js +19 -0
  123. package/src/validation/validation_message.js +741 -0
  124. package/src/components/editable_text/editable_text.jsx +0 -96
  125. package/src/components/form.jsx +0 -144
  126. package/src/components/input/checkbox_list.jsx +0 -294
  127. package/src/components/input/field.jsx +0 -61
  128. package/src/components/input/input_textual.jsx +0 -338
  129. package/src/components/input/radio_list.jsx +0 -283
  130. package/src/components/input/use_form_event.js +0 -20
  131. package/src/components/input/use_on_change.js +0 -12
  132. package/src/components/selection/selection.js +0 -5
  133. package/src/components/selection/selection_context.jsx +0 -262
  134. package/src/components/shortcut/shortcut_context.jsx +0 -390
  135. package/src/components/use_action_events.js +0 -37
  136. package/src/utils/iterable_weak_set.js +0 -62
  137. /package/src/components/demos/action/{11_nested_shortcuts_demo.html → 11_nested_shortcuts_demo.xhtml} +0 -0
  138. /package/src/components/{shortcut → keyboard_shortcuts}/os.js +0 -0
  139. /package/src/route/{route.test.html → route.xtest.html} +0 -0
@@ -24,130 +24,143 @@
24
24
  return (
25
25
  <>
26
26
  <div style="display: flex; flex-direction: row; gap: 30px">
27
- <div>
28
- <p>
29
- <strong>Loaded sync</strong>
30
- </p>
31
- <Details
32
- id="test"
33
- action={() => {
34
- return "Hello";
35
- }}
36
- >
37
- {(message) => <span>{message}</span>}
38
- </Details>
39
- </div>
27
+ <DetailsLoadSyncDemo />
28
+ <DetailsLoadAfter1sDemo />
29
+ <DetailsThrowSyncDemo />
30
+ </div>
40
31
 
41
- <div>
42
- <p>
43
- <strong>Loaded after 1s</strong>
44
- </p>
45
- <Details
46
- id="test_2"
47
- action={async () => {
48
- await new Promise((resolve) => {
49
- setTimeout(resolve, 1000);
50
- });
51
- return "Hello";
52
- }}
53
- label="Custom summary"
54
- >
55
- {(content) => content}
56
- </Details>
57
- </div>
32
+ <DetailsFullControlDemo />
33
+ <DetailsWithActionPreloadedDemo />
34
+ </>
35
+ );
36
+ };
58
37
 
59
- <div>
60
- <p>
61
- <strong>Throw sync</strong>
62
- </p>
63
- <Details
64
- id="test_3"
65
- action={() => {
66
- throw new Error("error");
67
- }}
68
- label={
69
- <>
70
- <span>A</span>
71
- <span style="font-weight: bold">mixed summary</span>
72
- </>
73
- }
74
- ></Details>
75
- </div>
76
- </div>
38
+ // eslint-disable-next-line no-unused-vars
39
+ const DetailsLoadSyncDemo = () => {
40
+ return (
41
+ <div>
42
+ <p>
43
+ <strong>Loaded sync</strong>
44
+ </p>
45
+ <Details
46
+ id="test"
47
+ action={() => {
48
+ return "Hello";
49
+ }}
50
+ >
51
+ {(message) => <span>{message}</span>}
52
+ </Details>
53
+ </div>
54
+ );
55
+ };
56
+
57
+ // eslint-disable-next-line no-unused-vars
58
+ const DetailsLoadAfter1sDemo = () => {
59
+ return (
60
+ <div>
61
+ <p>
62
+ <strong>Loaded after 1s</strong>
63
+ </p>
64
+ <Details
65
+ id="test_2"
66
+ action={async () => {
67
+ await new Promise((resolve) => {
68
+ setTimeout(resolve, 1000);
69
+ });
70
+ return "Hello";
71
+ }}
72
+ label="Custom summary"
73
+ >
74
+ {(content) => content}
75
+ </Details>
76
+ </div>
77
+ );
78
+ };
79
+
80
+ // eslint-disable-next-line no-unused-vars
81
+ const DetailsThrowSyncDemo = () => {
82
+ return (
83
+ <div>
84
+ <p>
85
+ <strong>Throw sync</strong>
86
+ </p>
87
+ <Details
88
+ // id="test_3"
89
+ action={() => {
90
+ throw new Error("error");
91
+ }}
92
+ label={
93
+ <>
94
+ <span>A</span>
95
+ <span style="font-weight: bold">mixed summary</span>
96
+ </>
97
+ }
98
+ ></Details>
99
+ </div>
100
+ );
101
+ };
77
102
 
78
- <div>
79
- <p>
80
- <strong>Full control (abort, reload)</strong>
81
- </p>
82
- <Details
83
- id="test_4"
84
- action={async (_, { signal }) => {
85
- await new Promise((resolve) => {
86
- const timeout = setTimeout(resolve, 1000);
87
- signal.addEventListener("abort", () => {
88
- clearTimeout(timeout);
89
- });
103
+ // eslint-disable-next-line no-unused-vars
104
+ const DetailsFullControlDemo = () => {
105
+ return (
106
+ <div>
107
+ <p>
108
+ <strong>Full control (abort, reload)</strong>
109
+ </p>
110
+ <Details
111
+ id="test_4"
112
+ action={async (_, { signal }) => {
113
+ await new Promise((resolve) => {
114
+ const timeout = setTimeout(resolve, 1000);
115
+ signal.addEventListener("abort", () => {
116
+ clearTimeout(timeout);
90
117
  });
91
- return "Hello";
92
- }}
93
- >
94
- {{
95
- loading: (action) => {
96
- return (
97
- <span>
98
- Loading...
99
- <button
100
- onClick={() => {
101
- action.abort();
102
- }}
103
- >
104
- Abort
105
- </button>
106
- </span>
107
- );
108
- },
109
- aborted: (action) => (
110
- <>
111
- <span style="color: red">Aborted</span>
118
+ });
119
+ return "Hello";
120
+ }}
121
+ >
122
+ {{
123
+ loading: (action) => {
124
+ return (
125
+ <span>
126
+ Loading...
112
127
  <button
113
128
  onClick={() => {
114
- action.reload();
129
+ action.abort();
115
130
  }}
116
131
  >
117
- Reload
132
+ Abort
118
133
  </button>
119
- </>
120
- ),
121
- completed: (message, action) => (
122
- <>
123
- <span>{message}</span>
124
- <button
125
- onClick={() => {
126
- action.reload();
127
- }}
128
- >
129
- Reload
130
- </button>
131
- </>
132
- ),
133
- }}
134
- </Details>
135
- </div>
136
-
137
- <div>
138
- <p>
139
- <strong>Action preloaded</strong>
140
- </p>
141
-
142
- <Details
143
- id="bound"
144
- action={rootAction}
145
- label="Action using bind params"
146
- >
147
- {(content) => content}
148
- </Details>
149
- </div>
150
- </>
134
+ </span>
135
+ );
136
+ },
137
+ aborted: (action) => (
138
+ <>
139
+ <span style="color: red">Aborted</span>
140
+ <button
141
+ onClick={() => {
142
+ action.rerun();
143
+ }}
144
+ >
145
+ Reload
146
+ </button>
147
+ </>
148
+ ),
149
+ completed: (message, action) => (
150
+ <>
151
+ <span>{message}</span>
152
+ <button
153
+ onClick={() => {
154
+ action.rerun();
155
+ }}
156
+ >
157
+ Reload
158
+ </button>
159
+ </>
160
+ ),
161
+ }}
162
+ </Details>
163
+ </div>
151
164
  );
152
165
  };
153
166
 
@@ -165,6 +178,24 @@
165
178
  // name: "dam",
166
179
  // });
167
180
  rootAction.prerun();
181
+ // eslint-disable-next-line no-unused-vars
182
+ const DetailsWithActionPreloadedDemo = () => {
183
+ return (
184
+ <div>
185
+ <p>
186
+ <strong>Action preloaded</strong>
187
+ </p>
188
+
189
+ <Details
190
+ id="bound"
191
+ action={rootAction}
192
+ label="Action using bind params"
193
+ >
194
+ {(content) => content}
195
+ </Details>
196
+ </div>
197
+ );
198
+ };
168
199
 
169
200
  render(<App />, document.querySelector("#root"));
170
201
  </script>