@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/navi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Library of components including navigation to create frontend applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"email": "dmaillard06@gmail.com"
|
|
14
14
|
},
|
|
15
15
|
"sideEffects": [
|
|
16
|
-
"./
|
|
17
|
-
"./
|
|
16
|
+
"./src/navi_css_vars.js",
|
|
17
|
+
"./dist/jsenv_navi.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
20
|
"exports": {
|
|
@@ -25,16 +25,14 @@
|
|
|
25
25
|
"./*": "./*"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
-
"/dist/"
|
|
29
|
-
"/src/",
|
|
30
|
-
"/index.js"
|
|
28
|
+
"/dist/"
|
|
31
29
|
],
|
|
32
30
|
"scripts": {
|
|
33
31
|
"build": "node ./scripts/build.mjs",
|
|
34
32
|
"prepublishOnly": "npm run build"
|
|
35
33
|
},
|
|
36
34
|
"dependencies": {
|
|
37
|
-
"@jsenv/dom": "0.
|
|
35
|
+
"@jsenv/dom": "0.6.0",
|
|
38
36
|
"@jsenv/humanize": "1.6.0"
|
|
39
37
|
},
|
|
40
38
|
"devDependencies": {
|
package/index.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import "./src/navi_css_vars.js";
|
|
2
|
-
|
|
3
|
-
// actions
|
|
4
|
-
export { createAction, rerunActions, updateActions } from "./src/actions.js";
|
|
5
|
-
export { useRunOnMount } from "./src/components/action_execution/use_run_on_mount.js";
|
|
6
|
-
export { useKeyboardShortcuts } from "./src/components/keyboard_shortcuts/keyboard_shortcuts.js";
|
|
7
|
-
export { useActionData } from "./src/use_action_data.js";
|
|
8
|
-
export { useActionStatus } from "./src/use_action_status.js";
|
|
9
|
-
|
|
10
|
-
// state management (store)
|
|
11
|
-
export { useStateArray } from "./src/components/use_state_array.js";
|
|
12
|
-
export { resource } from "./src/store/resource_graph.js";
|
|
13
|
-
export { valueInLocalStorage } from "./src/store/value_in_local_storage.js";
|
|
14
|
-
|
|
15
|
-
// routing
|
|
16
|
-
export {
|
|
17
|
-
actionIntegratedVia,
|
|
18
|
-
goBack,
|
|
19
|
-
goForward,
|
|
20
|
-
goTo,
|
|
21
|
-
reload,
|
|
22
|
-
stopLoad,
|
|
23
|
-
useNavState,
|
|
24
|
-
} from "./src/browser_integration/browser_integration.js";
|
|
25
|
-
export { useDocumentState } from "./src/browser_integration/document_state_signal.js";
|
|
26
|
-
export { useDocumentUrl } from "./src/browser_integration/document_url_signal.js";
|
|
27
|
-
export {
|
|
28
|
-
defineRoutes,
|
|
29
|
-
rawUrlPart,
|
|
30
|
-
setBaseUrl,
|
|
31
|
-
useRouteStatus,
|
|
32
|
-
} from "./src/route/route.js";
|
|
33
|
-
|
|
34
|
-
// Components
|
|
35
|
-
export { ActionRenderer } from "./src/components/action_renderer.jsx";
|
|
36
|
-
export { Details } from "./src/components/details/details.jsx";
|
|
37
|
-
export { SummaryMarker } from "./src/components/details/summary_marker.jsx";
|
|
38
|
-
export {
|
|
39
|
-
Editable,
|
|
40
|
-
useEditionController,
|
|
41
|
-
} from "./src/components/edition/editable.jsx";
|
|
42
|
-
export { ErrorBoundaryContext } from "./src/components/error_boundary_context.js";
|
|
43
|
-
export { Button } from "./src/components/field/button.jsx";
|
|
44
|
-
export {
|
|
45
|
-
Checkbox,
|
|
46
|
-
CheckboxList,
|
|
47
|
-
} from "./src/components/field/checkbox_list.jsx";
|
|
48
|
-
export { Form } from "./src/components/field/form.jsx";
|
|
49
|
-
export { Input } from "./src/components/field/input.jsx";
|
|
50
|
-
export { Label } from "./src/components/field/label.jsx";
|
|
51
|
-
export { Radio, RadioList } from "./src/components/field/radio_list.jsx";
|
|
52
|
-
export { Select } from "./src/components/field/select.jsx";
|
|
53
|
-
export { ActiveKeyboardShortcuts } from "./src/components/keyboard_shortcuts/active_keyboard_shortcuts.jsx";
|
|
54
|
-
export { Link } from "./src/components/link/link.jsx";
|
|
55
|
-
export { Route } from "./src/components/route.jsx";
|
|
56
|
-
export {
|
|
57
|
-
SelectionContext,
|
|
58
|
-
createSelectionKeyboardShortcuts,
|
|
59
|
-
useSelectableElement,
|
|
60
|
-
useSelectionController,
|
|
61
|
-
} from "./src/components/selection/selection.jsx";
|
|
62
|
-
// Table start
|
|
63
|
-
export {
|
|
64
|
-
isCellSelected,
|
|
65
|
-
isColumnSelected,
|
|
66
|
-
isRowSelected,
|
|
67
|
-
stringifyTableSelectionValue,
|
|
68
|
-
} from "./src/components/table/selection/table_selection.js";
|
|
69
|
-
export {
|
|
70
|
-
Col,
|
|
71
|
-
Colgroup,
|
|
72
|
-
RowNumberCol,
|
|
73
|
-
RowNumberTableCell,
|
|
74
|
-
Table,
|
|
75
|
-
TableCell,
|
|
76
|
-
Tbody,
|
|
77
|
-
Thead,
|
|
78
|
-
Tr,
|
|
79
|
-
} from "./src/components/table/table.jsx";
|
|
80
|
-
export { useCellsAndColumns } from "./src/components/table/use_cells_and_columns.js";
|
|
81
|
-
// Table end
|
|
82
|
-
export { Tab, TabList } from "./src/components/tablist/tablist.jsx";
|
|
83
|
-
export { UITransition } from "./src/components/ui_transition.jsx";
|
|
84
|
-
export { useSignalSync } from "./src/components/use_signal_sync.js";
|
|
85
|
-
// Text and icons
|
|
86
|
-
export { LinkWithIcon } from "./src/components/link/link_with_icon.jsx";
|
|
87
|
-
export { FontSizedSvg } from "./src/components/svg/font_sized_svg.jsx";
|
|
88
|
-
export { IconAndText } from "./src/components/svg/icon_and_text.jsx";
|
|
89
|
-
export { SVGMaskOverlay } from "./src/components/svg/svg_mask_overlay.jsx";
|
|
90
|
-
export { Overflow } from "./src/components/text/overflow.jsx";
|
|
91
|
-
export { Icon, Text } from "./src/components/text/text.jsx";
|
|
92
|
-
export { TextAndCount } from "./src/components/text/text_and_count.jsx";
|
|
93
|
-
// Callout, dialogs, ...
|
|
94
|
-
export { openCallout } from "./src/components/callout/callout.js";
|
|
95
|
-
// Layout
|
|
96
|
-
export {
|
|
97
|
-
FlexColumn,
|
|
98
|
-
FlexItem,
|
|
99
|
-
FlexRow,
|
|
100
|
-
} from "./src/components/layout/flex.jsx";
|
|
101
|
-
export { Spacing } from "./src/components/layout/spacing.jsx";
|
|
102
|
-
|
|
103
|
-
// Validation
|
|
104
|
-
export { createUniqueValueConstraint } from "./src/validation/constraints/create_unique_value_constraint.js";
|
|
105
|
-
export { SINGLE_SPACE_CONSTRAINT } from "./src/validation/constraints/single_space_constraint.js";
|
|
106
|
-
export {
|
|
107
|
-
addCustomMessage,
|
|
108
|
-
removeCustomMessage,
|
|
109
|
-
} from "./src/validation/custom_message.js";
|
|
110
|
-
// advanced constraint validation functions
|
|
111
|
-
export {
|
|
112
|
-
forwardActionRequested,
|
|
113
|
-
installCustomConstraintValidation,
|
|
114
|
-
} from "./src/validation/custom_constraint_validation.js";
|
|
115
|
-
|
|
116
|
-
// Other
|
|
117
|
-
export { useDependenciesDiff } from "./src/components/use_dependencies_diff.js";
|
|
118
|
-
export { useFocusGroup } from "./src/components/use_focus_group.js";
|
|
119
|
-
|
|
120
|
-
// for debugging testing purposes
|
|
121
|
-
export { enableDebugActions } from "./src/actions.js";
|
|
122
|
-
export { enableDebugOnDocumentLoading } from "./src/browser_integration/document_loading_signal.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const actionPrivatePropertiesWeakMap = new WeakMap();
|
|
2
|
-
export const getActionPrivateProperties = (action) => {
|
|
3
|
-
const actionPrivateProperties = actionPrivatePropertiesWeakMap.get(action);
|
|
4
|
-
if (!actionPrivateProperties) {
|
|
5
|
-
throw new Error(`Cannot find action private properties for "${action}"`);
|
|
6
|
-
}
|
|
7
|
-
return actionPrivateProperties;
|
|
8
|
-
};
|
|
9
|
-
export const setActionPrivateProperties = (action, properties) => {
|
|
10
|
-
actionPrivatePropertiesWeakMap.set(action, properties);
|
|
11
|
-
};
|
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Action Proxy Test</title>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<link rel="icon" href="data:," />
|
|
7
|
-
<style>
|
|
8
|
-
body {
|
|
9
|
-
font-family: Arial, sans-serif;
|
|
10
|
-
max-width: 1000px;
|
|
11
|
-
margin: 0 auto;
|
|
12
|
-
padding: 10px;
|
|
13
|
-
}
|
|
14
|
-
.section {
|
|
15
|
-
border: 1px solid #ccc;
|
|
16
|
-
margin: 10px 0;
|
|
17
|
-
padding: 15px;
|
|
18
|
-
border-radius: 5px;
|
|
19
|
-
}
|
|
20
|
-
.section h3 {
|
|
21
|
-
margin-top: 0;
|
|
22
|
-
}
|
|
23
|
-
.controls {
|
|
24
|
-
margin: 10px 0;
|
|
25
|
-
}
|
|
26
|
-
.controls button {
|
|
27
|
-
margin: 5px;
|
|
28
|
-
padding: 8px 16px;
|
|
29
|
-
border: 1px solid #007acc;
|
|
30
|
-
background: #007acc;
|
|
31
|
-
color: white;
|
|
32
|
-
border-radius: 3px;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
|
-
.controls button:hover {
|
|
36
|
-
background: #005999;
|
|
37
|
-
}
|
|
38
|
-
.controls button:disabled {
|
|
39
|
-
background: #ccc;
|
|
40
|
-
border-color: #ccc;
|
|
41
|
-
cursor: not-allowed;
|
|
42
|
-
}
|
|
43
|
-
.status {
|
|
44
|
-
background: #f5f5f5;
|
|
45
|
-
padding: 10px;
|
|
46
|
-
margin: 10px 0;
|
|
47
|
-
border-radius: 3px;
|
|
48
|
-
font-family: monospace;
|
|
49
|
-
}
|
|
50
|
-
.input-group {
|
|
51
|
-
margin: 10px 0;
|
|
52
|
-
}
|
|
53
|
-
.input-group label {
|
|
54
|
-
display: inline-block;
|
|
55
|
-
width: 100px;
|
|
56
|
-
font-weight: bold;
|
|
57
|
-
}
|
|
58
|
-
.input-group input {
|
|
59
|
-
padding: 5px;
|
|
60
|
-
border: 1px solid #ccc;
|
|
61
|
-
border-radius: 3px;
|
|
62
|
-
}
|
|
63
|
-
.execution-count {
|
|
64
|
-
font-size: 18px;
|
|
65
|
-
font-weight: bold;
|
|
66
|
-
color: #007acc;
|
|
67
|
-
}
|
|
68
|
-
.log {
|
|
69
|
-
background: #f9f9f9;
|
|
70
|
-
border: 1px solid #ddd;
|
|
71
|
-
padding: 10px;
|
|
72
|
-
height: 200px;
|
|
73
|
-
overflow-y: auto;
|
|
74
|
-
font-family: monospace;
|
|
75
|
-
font-size: 12px;
|
|
76
|
-
}
|
|
77
|
-
</style>
|
|
78
|
-
</head>
|
|
79
|
-
|
|
80
|
-
<body>
|
|
81
|
-
<h1>Action Proxy with Signal Parameters Test</h1>
|
|
82
|
-
|
|
83
|
-
<div class="section">
|
|
84
|
-
<h3>Signal Control</h3>
|
|
85
|
-
<div class="input-group">
|
|
86
|
-
<label>User ID:</label>
|
|
87
|
-
<input type="number" id="userIdInput" value="123" />
|
|
88
|
-
<button onclick="updateSignal()">Update Signal</button>
|
|
89
|
-
<button onclick="replaceParams()">Replace Params</button>
|
|
90
|
-
</div>
|
|
91
|
-
<div class="status">
|
|
92
|
-
Current Signal Value: <span id="signalValue">123</span>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
<div style="display: flex; gap: 10px; flex: 1; width: 100%">
|
|
97
|
-
<div class="section" style="flex: 1">
|
|
98
|
-
<h3>Action Proxy Status</h3>
|
|
99
|
-
<div class="status">
|
|
100
|
-
<div>Name: <span id="proxyName">-</span></div>
|
|
101
|
-
<div>Params: <span id="proxyParams">-</span></div>
|
|
102
|
-
<div>Loading State: <span id="proxyLoadingState">-</span></div>
|
|
103
|
-
<div>Load Requested: <span id="proxyLoadRequested">-</span></div>
|
|
104
|
-
<div>Data: <span id="proxyData">-</span></div>
|
|
105
|
-
<div>Error: <span id="proxyError">-</span></div>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
<div class="section" style="flex: 1">
|
|
110
|
-
<h3>All Actions & Proxy Target</h3>
|
|
111
|
-
<div class="status">
|
|
112
|
-
<div id="actionsList" style="margin-top: 5px; font-size: 11px">-</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
<div class="section">
|
|
118
|
-
<h3>Execution Counter</h3>
|
|
119
|
-
<div class="status">
|
|
120
|
-
<div class="execution-count">
|
|
121
|
-
Action executed: <span id="executionCount">0</span> times
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
<div class="section">
|
|
127
|
-
<h3>Controls</h3>
|
|
128
|
-
<div class="controls">
|
|
129
|
-
<button onclick="loadAction()">Load</button>
|
|
130
|
-
<button onclick="reloadAction()">Reload</button>
|
|
131
|
-
<button onclick="unloadAction()">Unload</button>
|
|
132
|
-
<button onclick="abortAction()">Abort</button>
|
|
133
|
-
<button onclick="preloadAction()">Preload</button>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
<div class="section">
|
|
138
|
-
<h3>Log</h3>
|
|
139
|
-
<div id="log" class="log"></div>
|
|
140
|
-
<button onclick="clearLog()">Clear Log</button>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<script type="module">
|
|
144
|
-
import { signal, effect } from "@preact/signals";
|
|
145
|
-
import { createAction } from "./actions.js";
|
|
146
|
-
import { getActionPrivateProperties } from "./action_private_properties.js";
|
|
147
|
-
|
|
148
|
-
// Global state
|
|
149
|
-
let executionCount = 0;
|
|
150
|
-
let userAction;
|
|
151
|
-
let userActionProxy;
|
|
152
|
-
let userIdSignal;
|
|
153
|
-
|
|
154
|
-
// DOM elements
|
|
155
|
-
const elements = {
|
|
156
|
-
signalValue: document.getElementById("signalValue"),
|
|
157
|
-
proxyName: document.getElementById("proxyName"),
|
|
158
|
-
proxyParams: document.getElementById("proxyParams"),
|
|
159
|
-
proxyLoadingState: document.getElementById("proxyLoadingState"),
|
|
160
|
-
proxyLoadRequested: document.getElementById("proxyLoadRequested"),
|
|
161
|
-
proxyData: document.getElementById("proxyData"),
|
|
162
|
-
proxyError: document.getElementById("proxyError"),
|
|
163
|
-
actionsList: document.getElementById("actionsList"),
|
|
164
|
-
executionCount: document.getElementById("executionCount"),
|
|
165
|
-
userIdInput: document.getElementById("userIdInput"),
|
|
166
|
-
log: document.getElementById("log"),
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// Logging utility
|
|
170
|
-
function log(message) {
|
|
171
|
-
const timestamp = new Date().toLocaleTimeString();
|
|
172
|
-
const logElement = elements.log;
|
|
173
|
-
logElement.innerHTML += `[${timestamp}] ${message}\n`;
|
|
174
|
-
logElement.scrollTop = logElement.scrollHeight;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Create the action that simulates fetching user data
|
|
178
|
-
userAction = createAction(
|
|
179
|
-
async (userId, { signal, reason, isPreload }) => {
|
|
180
|
-
executionCount++;
|
|
181
|
-
elements.executionCount.textContent = executionCount;
|
|
182
|
-
|
|
183
|
-
log(
|
|
184
|
-
`🚀 Action executing with userId: ${userId} (reason: ${reason}, isPreload: ${isPreload})`,
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
// Simulate async work
|
|
188
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
189
|
-
|
|
190
|
-
// Check if aborted
|
|
191
|
-
if (signal.aborted) {
|
|
192
|
-
log(`❌ Action aborted: ${signal.reason}`);
|
|
193
|
-
throw new Error(`Aborted: ${signal.reason}`);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const userData = {
|
|
197
|
-
id: userId,
|
|
198
|
-
loadedAt: new Date().toISOString(),
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
log(`✅ Action completed with data: ${JSON.stringify(userData)}`);
|
|
202
|
-
return userData;
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: "fetchUser",
|
|
206
|
-
},
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
// Create signal for user ID
|
|
210
|
-
userIdSignal = signal("123");
|
|
211
|
-
|
|
212
|
-
// Create proxy action bound to the signal
|
|
213
|
-
userActionProxy = userAction.bindParams(userIdSignal);
|
|
214
|
-
|
|
215
|
-
// Update UI functions
|
|
216
|
-
function updateSignalDisplay() {
|
|
217
|
-
elements.signalValue.textContent = userIdSignal.value;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function updateProxyDisplay() {
|
|
221
|
-
// Watch proxy properties through private properties signals
|
|
222
|
-
const {
|
|
223
|
-
paramsSignal,
|
|
224
|
-
loadingStateSignal,
|
|
225
|
-
loadRequestedSignal,
|
|
226
|
-
dataSignal,
|
|
227
|
-
errorSignal,
|
|
228
|
-
} = getActionPrivateProperties(userActionProxy);
|
|
229
|
-
|
|
230
|
-
elements.proxyName.textContent = userActionProxy.name;
|
|
231
|
-
elements.proxyParams.textContent = JSON.stringify(paramsSignal.value);
|
|
232
|
-
elements.proxyLoadingState.textContent = loadingStateSignal.value.id;
|
|
233
|
-
elements.proxyLoadRequested.textContent = loadRequestedSignal.value;
|
|
234
|
-
elements.proxyData.textContent = JSON.stringify(dataSignal.value);
|
|
235
|
-
elements.proxyError.textContent = errorSignal.value || "null";
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function updateActionsDisplay() {
|
|
239
|
-
// Get all actions (exclude proxies)
|
|
240
|
-
const allActions = userAction.matchAllSelfOrDescendant(() => true);
|
|
241
|
-
|
|
242
|
-
// Get the current action the proxy is pointing at
|
|
243
|
-
const currentProxyTarget =
|
|
244
|
-
getActionPrivateProperties(userActionProxy).currentAction;
|
|
245
|
-
|
|
246
|
-
// Create actions list
|
|
247
|
-
if (allActions.length === 0) {
|
|
248
|
-
elements.actionsList.innerHTML = "No actions exist";
|
|
249
|
-
} else {
|
|
250
|
-
const actionsHtml = allActions
|
|
251
|
-
.map((action) => {
|
|
252
|
-
const isCurrentTarget = action === currentProxyTarget;
|
|
253
|
-
const actionData = action.data
|
|
254
|
-
? JSON.stringify(action.data).substring(0, 50) +
|
|
255
|
-
(JSON.stringify(action.data).length > 50 ? "..." : "")
|
|
256
|
-
: "null";
|
|
257
|
-
const style = isCurrentTarget
|
|
258
|
-
? "background: #ffffcc; font-weight: bold;"
|
|
259
|
-
: "";
|
|
260
|
-
const indicator = isCurrentTarget ? "👉 " : " ";
|
|
261
|
-
|
|
262
|
-
return `<div style="${style}; padding: 2px; margin: 1px 0; border-radius: 2px;">
|
|
263
|
-
${indicator}<strong>${action.name}</strong> | Data: ${actionData} | State: ${action.loadingState.id}
|
|
264
|
-
</div>`;
|
|
265
|
-
})
|
|
266
|
-
.join("");
|
|
267
|
-
|
|
268
|
-
elements.actionsList.innerHTML = actionsHtml;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Set up reactive updates
|
|
273
|
-
effect(() => {
|
|
274
|
-
// Watch the signal value
|
|
275
|
-
updateSignalDisplay();
|
|
276
|
-
|
|
277
|
-
updateProxyDisplay();
|
|
278
|
-
|
|
279
|
-
// Watch underlying action properties
|
|
280
|
-
const currentAction = userActionProxy.matchAllSelfOrDescendant(
|
|
281
|
-
() => true,
|
|
282
|
-
{ includeProxies: false },
|
|
283
|
-
)[0];
|
|
284
|
-
if (currentAction) {
|
|
285
|
-
const actionPrivateProps = getActionPrivateProperties(currentAction);
|
|
286
|
-
// Subscribe to action state changes by accessing signal values
|
|
287
|
-
/* eslint-disable-next-line no-unused-expressions */
|
|
288
|
-
actionPrivateProps.loadingStateSignal.value;
|
|
289
|
-
/* eslint-disable-next-line no-unused-expressions */
|
|
290
|
-
actionPrivateProps.loadRequestedSignal.value;
|
|
291
|
-
/* eslint-disable-next-line no-unused-expressions */
|
|
292
|
-
actionPrivateProps.dataSignal.value;
|
|
293
|
-
/* eslint-disable-next-line no-unused-expressions */
|
|
294
|
-
actionPrivateProps.errorSignal.value;
|
|
295
|
-
}
|
|
296
|
-
updateActionsDisplay();
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
// Global functions for buttons
|
|
300
|
-
window.updateSignal = function () {
|
|
301
|
-
const newValue = elements.userIdInput.valueAsNumber;
|
|
302
|
-
log(`📡 Updating signal from "${userIdSignal.value}" to "${newValue}"`);
|
|
303
|
-
userIdSignal.value = newValue;
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
window.replaceParams = function () {
|
|
307
|
-
const newValue = elements.userIdInput.valueAsNumber;
|
|
308
|
-
log(
|
|
309
|
-
`🔄 Replacing params from "${JSON.stringify(userActionProxy.params)}" to "{userId: ${newValue}}"`,
|
|
310
|
-
);
|
|
311
|
-
userActionProxy.replaceParams(newValue);
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
window.loadAction = function () {
|
|
315
|
-
log(`🔄 Loading action proxy`);
|
|
316
|
-
userActionProxy.load({ reason: "Manual load button clicked" });
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
window.reloadAction = function () {
|
|
320
|
-
log(`🔄 Reloading action proxy`);
|
|
321
|
-
userActionProxy.reload({ reason: "Manual reload button clicked" });
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
window.unloadAction = function () {
|
|
325
|
-
log(`🛑 Unloading action proxy`);
|
|
326
|
-
userActionProxy.unload();
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
window.abortAction = function () {
|
|
330
|
-
log(`⚠️ Aborting action proxy`);
|
|
331
|
-
userActionProxy.abort("Manual abort button clicked");
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
window.preloadAction = function () {
|
|
335
|
-
log(`⏳ Preloading action proxy`);
|
|
336
|
-
userActionProxy.preload({ reason: "Manual preload button clicked" });
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
window.clearLog = function () {
|
|
340
|
-
elements.log.innerHTML = "";
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
// Initial update
|
|
344
|
-
updateSignalDisplay();
|
|
345
|
-
updateProxyDisplay();
|
|
346
|
-
updateActionsDisplay();
|
|
347
|
-
|
|
348
|
-
log(
|
|
349
|
-
`🎯 Test setup complete. Action proxy bound to signal with initial value: ${userIdSignal.value}`,
|
|
350
|
-
);
|
|
351
|
-
</script>
|
|
352
|
-
</body>
|
|
353
|
-
</html>
|