@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.
Files changed (207) hide show
  1. package/dist/jsenv_navi.js +13838 -23291
  2. package/dist/jsenv_navi.js.map +1281 -0
  3. package/package.json +5 -7
  4. package/index.js +0 -122
  5. package/src/action_private_properties.js +0 -11
  6. package/src/action_proxy_test.html +0 -353
  7. package/src/action_run_states.js +0 -5
  8. package/src/actions.js +0 -1401
  9. package/src/browser_integration/browser_integration.js +0 -216
  10. package/src/browser_integration/document_back_and_forward.js +0 -17
  11. package/src/browser_integration/document_loading_signal.js +0 -100
  12. package/src/browser_integration/document_state_signal.js +0 -9
  13. package/src/browser_integration/document_url_signal.js +0 -9
  14. package/src/browser_integration/use_is_visited.js +0 -19
  15. package/src/browser_integration/via_history.js +0 -232
  16. package/src/browser_integration/via_navigation.js +0 -168
  17. package/src/components/action_execution/form_context.js +0 -5
  18. package/src/components/action_execution/render_actionable_component.jsx +0 -29
  19. package/src/components/action_execution/use_action.js +0 -99
  20. package/src/components/action_execution/use_execute_action.js +0 -193
  21. package/src/components/action_execution/use_run_on_mount.js +0 -9
  22. package/src/components/action_renderer.jsx +0 -125
  23. package/src/components/callout/callout.js +0 -990
  24. package/src/components/callout/callout_demo.html +0 -201
  25. package/src/components/callout/test_dynamic_positioning.html +0 -161
  26. package/src/components/callout/test_html_document_iframe.html +0 -182
  27. package/src/components/demos/0_button_demo.html +0 -707
  28. package/src/components/demos/10_column_reordering_debug.html +0 -277
  29. package/src/components/demos/11_table_selection_debug.html +0 -432
  30. package/src/components/demos/1_checkbox_demo.html +0 -754
  31. package/src/components/demos/2_input_textual_demo.html +0 -286
  32. package/src/components/demos/3_radio_demo.html +0 -874
  33. package/src/components/demos/4_select_demo.html +0 -100
  34. package/src/components/demos/5_list_scrollable_demo.html +0 -153
  35. package/src/components/demos/6_tablist_demo.html +0 -77
  36. package/src/components/demos/7_table_selection_demo.html +0 -176
  37. package/src/components/demos/8_table_fixed_headers_demo.html +0 -584
  38. package/src/components/demos/9_table_column_drag_demo.html +0 -325
  39. package/src/components/demos/action/0_button_demo.html +0 -204
  40. package/src/components/demos/action/10_shortcuts_demo.html +0 -189
  41. package/src/components/demos/action/11_nested_shortcuts_demo.xhtml +0 -401
  42. package/src/components/demos/action/1_input_text_demo.html +0 -876
  43. package/src/components/demos/action/2_form_multiple.html +0 -303
  44. package/src/components/demos/action/3_details_demo.html +0 -203
  45. package/src/components/demos/action/4_input_checkbox_demo.html +0 -731
  46. package/src/components/demos/action/5_input_checkbox_state_demo.html +0 -270
  47. package/src/components/demos/action/6_checkbox_list_demo.html +0 -341
  48. package/src/components/demos/action/7_radio_list_demo.html +0 -357
  49. package/src/components/demos/action/8_editable_demo.html +0 -431
  50. package/src/components/demos/action/9_link_demo.html +0 -194
  51. package/src/components/demos/demo.md +0 -0
  52. package/src/components/demos/route/basic/basic.html +0 -14
  53. package/src/components/demos/route/basic/basic_route_demo.jsx +0 -224
  54. package/src/components/demos/route/multi/multi.html +0 -14
  55. package/src/components/demos/route/multi/multi_route_demo.jsx +0 -277
  56. package/src/components/demos/ui_transition/0_action_renderer_ui_transition_demo.html +0 -695
  57. package/src/components/demos/ui_transition/1_nested_ui_transition_demo.html +0 -429
  58. package/src/components/demos/ui_transition/2_height_transition_test.html +0 -295
  59. package/src/components/details/details.jsx +0 -245
  60. package/src/components/details/summary_marker.jsx +0 -141
  61. package/src/components/edition/editable.jsx +0 -186
  62. package/src/components/error_boundary_context.js +0 -9
  63. package/src/components/field/README.md +0 -247
  64. package/src/components/field/button.jsx +0 -429
  65. package/src/components/field/checkbox_list.jsx +0 -185
  66. package/src/components/field/collect_form_element_values.js +0 -82
  67. package/src/components/field/custom_field.js +0 -106
  68. package/src/components/field/form.jsx +0 -209
  69. package/src/components/field/input.jsx +0 -16
  70. package/src/components/field/input_checkbox.jsx +0 -434
  71. package/src/components/field/input_radio.jsx +0 -432
  72. package/src/components/field/input_textual.jsx +0 -389
  73. package/src/components/field/label.jsx +0 -46
  74. package/src/components/field/radio_list.jsx +0 -183
  75. package/src/components/field/select.jsx +0 -256
  76. package/src/components/field/use_action_events.js +0 -132
  77. package/src/components/field/use_form_events.js +0 -59
  78. package/src/components/field/use_ui_state_controller.js +0 -506
  79. package/src/components/item_tracker/README.md +0 -461
  80. package/src/components/item_tracker/use_isolated_item_tracker.jsx +0 -209
  81. package/src/components/item_tracker/use_isolated_item_tracker_demo.html +0 -148
  82. package/src/components/item_tracker/use_isolated_item_tracker_demo.jsx +0 -460
  83. package/src/components/item_tracker/use_item_tracker.jsx +0 -143
  84. package/src/components/item_tracker/use_item_tracker_demo.html +0 -207
  85. package/src/components/item_tracker/use_item_tracker_demo.jsx +0 -216
  86. package/src/components/keyboard_shortcuts/active_keyboard_shortcuts.jsx +0 -87
  87. package/src/components/keyboard_shortcuts/aria_key_shortcuts.js +0 -61
  88. package/src/components/keyboard_shortcuts/keyboard_key_meta.js +0 -17
  89. package/src/components/keyboard_shortcuts/keyboard_shortcuts.js +0 -371
  90. package/src/components/keyboard_shortcuts/os.js +0 -9
  91. package/src/components/layout/demos/demo_flex.html +0 -638
  92. package/src/components/layout/demos/demo_layout_style_buttons.html +0 -351
  93. package/src/components/layout/demos/demo_layout_style_input.html +0 -226
  94. package/src/components/layout/demos/demo_layout_style_text.html +0 -514
  95. package/src/components/layout/flex.jsx +0 -109
  96. package/src/components/layout/layout_context.jsx +0 -3
  97. package/src/components/layout/spacing.jsx +0 -20
  98. package/src/components/layout/use_layout_style.js +0 -249
  99. package/src/components/link/link.jsx +0 -267
  100. package/src/components/link/link_with_icon.jsx +0 -52
  101. package/src/components/loader/loader_background.jsx +0 -372
  102. package/src/components/loader/loading_spinner.jsx +0 -68
  103. package/src/components/loader/network_speed.js +0 -83
  104. package/src/components/loader/rectangle_loading.jsx +0 -244
  105. package/src/components/props_composition/demos/demo_with_props_style.html +0 -81
  106. package/src/components/props_composition/with_props_class_name.js +0 -37
  107. package/src/components/props_composition/with_props_style.js +0 -26
  108. package/src/components/route.jsx +0 -19
  109. package/src/components/selection/selection.jsx +0 -1583
  110. package/src/components/svg/font_sized_svg.jsx +0 -59
  111. package/src/components/svg/icon_and_text.jsx +0 -21
  112. package/src/components/svg/svg_mask_overlay.jsx +0 -105
  113. package/src/components/table/drag/table_drag.jsx +0 -506
  114. package/src/components/table/resize/table_resize.jsx +0 -650
  115. package/src/components/table/resize/table_size.js +0 -43
  116. package/src/components/table/selection/table_selection.js +0 -106
  117. package/src/components/table/selection/table_selection.jsx +0 -203
  118. package/src/components/table/sticky/sticky_group.js +0 -354
  119. package/src/components/table/sticky/table_sticky.js +0 -25
  120. package/src/components/table/sticky/table_sticky.jsx +0 -501
  121. package/src/components/table/table.jsx +0 -721
  122. package/src/components/table/table_css.js +0 -211
  123. package/src/components/table/table_ui.jsx +0 -49
  124. package/src/components/table/use_cells_and_columns.js +0 -90
  125. package/src/components/table/use_object_array_to_cells.js +0 -46
  126. package/src/components/table/z_indexes.js +0 -23
  127. package/src/components/tablist/tablist.jsx +0 -99
  128. package/src/components/text/demos/demo_text_and_icon.html +0 -421
  129. package/src/components/text/overflow.jsx +0 -15
  130. package/src/components/text/text.jsx +0 -83
  131. package/src/components/text/text_and_count.jsx +0 -28
  132. package/src/components/ui_transition.jsx +0 -128
  133. package/src/components/use_auto_focus.js +0 -94
  134. package/src/components/use_batch_during_render.js +0 -33
  135. package/src/components/use_debounce_true.js +0 -31
  136. package/src/components/use_dependencies_diff.js +0 -35
  137. package/src/components/use_focus_group.js +0 -20
  138. package/src/components/use_initial_value.js +0 -78
  139. package/src/components/use_is_visited.js +0 -19
  140. package/src/components/use_ref_array.js +0 -38
  141. package/src/components/use_signal_sync.js +0 -50
  142. package/src/components/use_stable_callback.js +0 -68
  143. package/src/components/use_state_array.js +0 -47
  144. package/src/docs/actions.md +0 -250
  145. package/src/docs/demos/resource/action_status.jsx +0 -42
  146. package/src/docs/demos/resource/demo.md +0 -1
  147. package/src/docs/demos/resource/resource_demo_0.html +0 -84
  148. package/src/docs/demos/resource/resource_demo_10_post_gc.html +0 -364
  149. package/src/docs/demos/resource/resource_demo_11_describe_many.html +0 -362
  150. package/src/docs/demos/resource/resource_demo_2.html +0 -173
  151. package/src/docs/demos/resource/resource_demo_3_filtered_users.html +0 -415
  152. package/src/docs/demos/resource/resource_demo_4_details.html +0 -284
  153. package/src/docs/demos/resource/resource_demo_5_renderer_lazy.html +0 -115
  154. package/src/docs/demos/resource/resource_demo_6_gc.html +0 -217
  155. package/src/docs/demos/resource/resource_demo_7_child_gc.html +0 -240
  156. package/src/docs/demos/resource/resource_demo_8_proxy_gc.html +0 -319
  157. package/src/docs/demos/resource/resource_demo_9_describe_one.html +0 -472
  158. package/src/docs/demos/resource/tata.jsx +0 -3
  159. package/src/docs/demos/resource/toto.jsx +0 -3
  160. package/src/docs/demos/user_nav/user_nav.html +0 -12
  161. package/src/docs/demos/user_nav/user_nav.jsx +0 -330
  162. package/src/docs/resource_dependencies.md +0 -103
  163. package/src/docs/resource_with_params.md +0 -80
  164. package/src/navi_css_vars.js +0 -14
  165. package/src/notes.md +0 -34
  166. package/src/route/route.js +0 -596
  167. package/src/route/route.xtest.html +0 -228
  168. package/src/store/array_signal_store.js +0 -537
  169. package/src/store/local_storage_signal.js +0 -17
  170. package/src/store/resource_graph.js +0 -1304
  171. package/src/store/tests/resource_graph_autoreload_demo.html +0 -12
  172. package/src/store/tests/resource_graph_autoreload_demo.jsx +0 -964
  173. package/src/store/tests/resource_graph_dependencies.test_manual.js +0 -95
  174. package/src/store/value_in_local_storage.js +0 -187
  175. package/src/symbol_object_signal.js +0 -1
  176. package/src/use_action_data.js +0 -10
  177. package/src/use_action_status.js +0 -47
  178. package/src/utils/add_many_event_listeners.js +0 -15
  179. package/src/utils/array_add_remove.js +0 -61
  180. package/src/utils/array_signal.js +0 -15
  181. package/src/utils/compare_two_js_values.js +0 -172
  182. package/src/utils/execute_with_cleanup.js +0 -21
  183. package/src/utils/get_caller_info.js +0 -85
  184. package/src/utils/is_signal.js +0 -20
  185. package/src/utils/js_value_weak_map.js +0 -162
  186. package/src/utils/js_value_weak_map_demo.html +0 -690
  187. package/src/utils/merge_two_js_values.js +0 -53
  188. package/src/utils/stringify_for_display.js +0 -131
  189. package/src/utils/weak_effect.js +0 -48
  190. package/src/validation/constraints/confirm_constraint.js +0 -14
  191. package/src/validation/constraints/create_unique_value_constraint.js +0 -27
  192. package/src/validation/constraints/native_constraints.js +0 -338
  193. package/src/validation/constraints/readonly_constraint.js +0 -41
  194. package/src/validation/constraints/same_as_constraint.js +0 -42
  195. package/src/validation/constraints/single_space_constraint.js +0 -13
  196. package/src/validation/custom_constraint_validation.js +0 -793
  197. package/src/validation/custom_message.js +0 -18
  198. package/src/validation/demos/browser_style.png +0 -0
  199. package/src/validation/demos/demo_same_as_constraint.html +0 -259
  200. package/src/validation/demos/form_validation_demo.html +0 -142
  201. package/src/validation/demos/form_validation_demo_preact.html +0 -87
  202. package/src/validation/demos/form_validation_native_popover_demo.html +0 -168
  203. package/src/validation/demos/form_validation_vs_native_demo.html +0 -172
  204. package/src/validation/hooks/use_constraints.js +0 -23
  205. package/src/validation/hooks/use_custom_validation_ref.js +0 -73
  206. package/src/validation/hooks/use_validation_message.js +0 -19
  207. package/src/validation/input_change_effect.js +0 -106
@@ -1,514 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <title>useLayoutStyle Demo - Text</title>
6
- <style>
7
- .demo-container {
8
- margin-bottom: 30px;
9
- padding: 20px;
10
- background: #f8f9fa;
11
- border-radius: 8px;
12
- }
13
-
14
- .demo-box {
15
- min-width: 60px;
16
- padding: 10px;
17
- text-align: center;
18
- background: #e3f2fd;
19
- border: 1px solid #90caf9;
20
- border-radius: 4px;
21
- }
22
-
23
- .visual-container {
24
- margin: 10px 0;
25
- padding: 10px;
26
- background: #fff3e0;
27
- border: 2px dashed #ff9800;
28
- }
29
-
30
- .text-showcase {
31
- margin: 10px 0;
32
- padding: 15px;
33
- background: #f5f5f5;
34
- border: 1px solid #ddd;
35
- border-radius: 4px;
36
- }
37
-
38
- h3 {
39
- margin-top: 0;
40
- }
41
-
42
- /* Helper to visualize the container boundaries */
43
- .bounded {
44
- width: 400px;
45
- height: 100px;
46
- padding: 10px;
47
- background: #f0f4ff;
48
- border: 1px solid #6366f1;
49
- }
50
-
51
- /* Helper to show text boundaries */
52
- .text-boundary {
53
- display: inline-block;
54
- border: 1px dashed #999;
55
- }
56
- </style>
57
- </head>
58
- <body>
59
- <div id="app"></div>
60
- <script type="module" jsenv-type="module/jsx">
61
- /* eslint-disable no-unused-vars */
62
- import { render } from "preact";
63
- import { FlexRow, FlexColumn, Text, Button } from "@jsenv/navi";
64
-
65
- const DemoBox = ({ children, ...props }) => (
66
- <div className="demo-box" {...props}>
67
- {children}
68
- </div>
69
- );
70
-
71
- const Demo = () => {
72
- return (
73
- <div style={{ padding: "20px", fontFamily: "system-ui, sans-serif" }}>
74
- <h1>useLayoutStyle Demo - Text Elements</h1>
75
- <p>
76
- Testing spacing (margin/padding), alignment, and expand behavior
77
- specifically with Text components in various layout contexts.
78
- </p>
79
-
80
- <div className="demo-container">
81
- <h3>1. Text with Expand in FlexRow</h3>
82
- <div className="visual-container">
83
- <FlexRow gap="10px">
84
- <DemoBox>Start</DemoBox>
85
- <Text
86
- expand
87
- style={{ background: "#e8f5e8", padding: "10px" }}
88
- >
89
- This text expands to fill available horizontal space
90
- </Text>
91
- <DemoBox>End</DemoBox>
92
- </FlexRow>
93
- </div>
94
- </div>
95
-
96
- <div className="demo-container">
97
- <h3>2. Text with Expand in FlexColumn</h3>
98
- <div className="visual-container">
99
- <FlexColumn gap="10px" style={{ height: "200px" }}>
100
- <Text style={{ background: "#fff3e0", padding: "10px" }}>
101
- Fixed text at top
102
- </Text>
103
- <Text
104
- expand
105
- style={{ background: "#e8f5e8", padding: "10px" }}
106
- >
107
- This text expands vertically to fill available space
108
- </Text>
109
- <Text style={{ background: "#fff3e0", padding: "10px" }}>
110
- Fixed text at bottom
111
- </Text>
112
- </FlexColumn>
113
- </div>
114
- </div>
115
-
116
- <div className="demo-container">
117
- <h3>3. Text with Expand outside Flex context</h3>
118
- <div className="visual-container">
119
- <div
120
- style={{
121
- width: "300px",
122
- border: "1px solid #ccc",
123
- padding: "10px",
124
- }}
125
- >
126
- <Text style={{ background: "#fff3e0", padding: "5px" }}>
127
- Normal text width
128
- </Text>
129
- <br />
130
- <br />
131
- <Text
132
- expand
133
- style={{ background: "#e8f5e8", padding: "5px" }}
134
- >
135
- Expanding text (should take full width)
136
- </Text>
137
- </div>
138
- </div>
139
- </div>
140
-
141
- <div className="demo-container">
142
- <h3>4. Text Spacing - Margins</h3>
143
- <div className="visual-container">
144
- <div className="text-showcase">
145
- <Text
146
- margin="15px"
147
- style={{ background: "#e3f2fd", padding: "5px" }}
148
- >
149
- Text with margin all sides
150
- </Text>
151
- <br />
152
- <Text
153
- marginX="25px"
154
- style={{ background: "#f3e5f5", padding: "5px" }}
155
- >
156
- Text with marginX only
157
- </Text>
158
- <br />
159
- <Text
160
- marginY="20px"
161
- style={{ background: "#e8f5e8", padding: "5px" }}
162
- >
163
- Text with marginY only
164
- </Text>
165
- <br />
166
- <Text
167
- marginLeft="40px"
168
- style={{ background: "#fff3e0", padding: "5px" }}
169
- >
170
- Text with marginLeft only
171
- </Text>
172
- </div>
173
- </div>
174
- </div>
175
-
176
- <div className="demo-container">
177
- <h3>5. Text Spacing - Padding</h3>
178
- <div className="visual-container">
179
- <div className="text-showcase">
180
- <Text
181
- style={{
182
- background: "#e3f2fd",
183
- border: "1px solid #90caf9",
184
- }}
185
- >
186
- Default padding
187
- </Text>
188
- <br />
189
- <br />
190
- <Text
191
- padding="20px"
192
- style={{
193
- background: "#f3e5f5",
194
- border: "1px solid #ce93d8",
195
- }}
196
- >
197
- Extra padding all sides
198
- </Text>
199
- <br />
200
- <br />
201
- <Text
202
- paddingX="30px"
203
- style={{
204
- background: "#e8f5e8",
205
- border: "1px solid #81c784",
206
- }}
207
- >
208
- PaddingX only
209
- </Text>
210
- <br />
211
- <br />
212
- <Text
213
- paddingY="15px"
214
- style={{
215
- background: "#fff3e0",
216
- border: "1px solid #ffb74d",
217
- }}
218
- >
219
- PaddingY only
220
- </Text>
221
- </div>
222
- </div>
223
- </div>
224
-
225
- <div className="demo-container">
226
- <h3>6. Text AlignX Test: FlexRow + alignX="end"</h3>
227
- <div className="visual-container">
228
- <div className="bounded">
229
- <FlexRow gap="10px" style={{ height: "100%" }}>
230
- <Text style={{ background: "#e3f2fd", padding: "5px" }}>
231
- Default position
232
- </Text>
233
- <Text
234
- alignX="end"
235
- style={{ background: "#f3e5f5", padding: "5px" }}
236
- >
237
- Pushed to end
238
- </Text>
239
- </FlexRow>
240
- </div>
241
- </div>
242
- </div>
243
-
244
- <div className="demo-container">
245
- <h3>7. Text Labels and Content Layout</h3>
246
- <div className="visual-container">
247
- <FlexColumn gap="15px">
248
- <FlexRow gap="10px">
249
- <Text style={{ minWidth: "80px", fontWeight: "bold" }}>
250
- Name:
251
- </Text>
252
- <Text
253
- expand
254
- style={{ background: "#f5f5f5", padding: "8px" }}
255
- >
256
- John Doe
257
- </Text>
258
- </FlexRow>
259
-
260
- <FlexRow gap="10px">
261
- <Text style={{ minWidth: "80px", fontWeight: "bold" }}>
262
- Email:
263
- </Text>
264
- <Text
265
- expand
266
- style={{ background: "#f5f5f5", padding: "8px" }}
267
- >
268
- john.doe@example.com
269
- </Text>
270
- <Button>Edit</Button>
271
- </FlexRow>
272
-
273
- <FlexRow gap="10px">
274
- <Text style={{ minWidth: "80px", fontWeight: "bold" }}>
275
- Status:
276
- </Text>
277
- <Text
278
- expand
279
- style={{
280
- background: "#e8f5e8",
281
- padding: "8px",
282
- color: "#2e7d32",
283
- }}
284
- >
285
- Active
286
- </Text>
287
- </FlexRow>
288
- </FlexColumn>
289
- </div>
290
- </div>
291
-
292
- <div className="demo-container">
293
- <h3>8. Text in Card Layout</h3>
294
- <div className="visual-container">
295
- <div
296
- style={{
297
- border: "1px solid #ddd",
298
- borderRadius: "8px",
299
- padding: "20px",
300
- width: "350px",
301
- }}
302
- >
303
- <FlexRow gap="15px" style={{ marginBottom: "15px" }}>
304
- <Text style={{ fontSize: "20px", fontWeight: "bold" }}>
305
- Article Title
306
- </Text>
307
- <Text
308
- alignX="end"
309
- style={{ fontSize: "12px", color: "#666" }}
310
- >
311
- 2 min read
312
- </Text>
313
- </FlexRow>
314
-
315
- <Text
316
- style={{
317
- lineHeight: "1.6",
318
- color: "#555",
319
- marginBottom: "15px",
320
- }}
321
- >
322
- This is the article content that can expand and flow
323
- naturally. It demonstrates how text components work with
324
- layout props.
325
- </Text>
326
-
327
- <FlexRow gap="10px">
328
- <Text style={{ fontSize: "12px", color: "#999" }}>
329
- Published: Oct 29, 2025
330
- </Text>
331
- <Text
332
- alignX="end"
333
- style={{ fontSize: "12px", color: "#666" }}
334
- >
335
- By Author Name
336
- </Text>
337
- </FlexRow>
338
- </div>
339
- </div>
340
- </div>
341
-
342
- <div className="demo-container">
343
- <h3>9. Text Navigation and Breadcrumbs</h3>
344
- <div className="visual-container">
345
- <FlexColumn gap="15px">
346
- <FlexRow gap="10px">
347
- <Text style={{ fontWeight: "bold" }}>Home</Text>
348
- <Text>/</Text>
349
- <Text style={{ fontWeight: "bold" }}>Products</Text>
350
- <Text>/</Text>
351
- <Text>Current Page</Text>
352
- <Text
353
- alignX="end"
354
- style={{ fontSize: "12px", color: "#666" }}
355
- >
356
- Help
357
- </Text>
358
- </FlexRow>
359
-
360
- <FlexRow gap="15px">
361
- <Text
362
- expand
363
- style={{ fontSize: "18px", fontWeight: "bold" }}
364
- >
365
- Page Title
366
- </Text>
367
- <Text alignX="end" style={{ fontSize: "12px" }}>
368
- Last updated: Today
369
- </Text>
370
- </FlexRow>
371
- </FlexColumn>
372
- </div>
373
- </div>
374
-
375
- <div className="demo-container">
376
- <h3>10. Text with Mixed Alignment</h3>
377
- <div className="visual-container">
378
- <FlexColumn gap="10px">
379
- <FlexRow gap="10px">
380
- <Text style={{ background: "#e3f2fd", padding: "8px" }}>
381
- Default (start)
382
- </Text>
383
- <Text
384
- alignX="center"
385
- style={{ background: "#f3e5f5", padding: "8px" }}
386
- >
387
- Centered
388
- </Text>
389
- <Text
390
- alignX="end"
391
- style={{ background: "#e8f5e8", padding: "8px" }}
392
- >
393
- End aligned
394
- </Text>
395
- </FlexRow>
396
-
397
- <FlexRow gap="10px">
398
- <Text
399
- expand
400
- style={{ background: "#fff3e0", padding: "8px" }}
401
- >
402
- Expanding text that fills remaining space
403
- </Text>
404
- <Text
405
- alignX="end"
406
- style={{ background: "#ffebee", padding: "8px" }}
407
- >
408
- Fixed end
409
- </Text>
410
- </FlexRow>
411
- </FlexColumn>
412
- </div>
413
- </div>
414
-
415
- <div className="demo-container">
416
- <h3>11. Text in Message/Chat Layout</h3>
417
- <div className="visual-container">
418
- <FlexColumn gap="10px" style={{ width: "400px" }}>
419
- <FlexRow gap="10px">
420
- <Text
421
- style={{
422
- background: "#e3f2fd",
423
- padding: "10px",
424
- borderRadius: "12px",
425
- maxWidth: "70%",
426
- }}
427
- >
428
- Hello! This is a message from the left side.
429
- </Text>
430
- </FlexRow>
431
-
432
- <FlexRow gap="10px">
433
- <Text
434
- alignX="end"
435
- style={{
436
- background: "#e8f5e8",
437
- padding: "10px",
438
- borderRadius: "12px",
439
- maxWidth: "70%",
440
- }}
441
- >
442
- This message is aligned to the right side.
443
- </Text>
444
- </FlexRow>
445
-
446
- <FlexRow gap="10px">
447
- <Text
448
- style={{
449
- background: "#fff3e0",
450
- padding: "10px",
451
- borderRadius: "12px",
452
- maxWidth: "70%",
453
- }}
454
- >
455
- Another left message with some longer content to show
456
- wrapping.
457
- </Text>
458
- </FlexRow>
459
- </FlexColumn>
460
- </div>
461
- </div>
462
-
463
- <div className="demo-container">
464
- <h3>12. Combined Text Styling and Layout</h3>
465
- <div className="visual-container">
466
- <FlexColumn gap="15px">
467
- <Text bold marginBottom="10px" style={{ fontSize: "24px" }}>
468
- Main Heading
469
- </Text>
470
-
471
- <FlexRow gap="15px">
472
- <Text italic marginRight="20px" style={{ color: "#666" }}>
473
- Subtitle
474
- </Text>
475
- <Text alignX="end" style={{ fontSize: "12px" }}>
476
- Metadata
477
- </Text>
478
- </FlexRow>
479
-
480
- <Text
481
- paddingX="15px"
482
- paddingY="10px"
483
- style={{
484
- background: "#f8f9fa",
485
- borderLeft: "4px solid #007bff",
486
- fontStyle: "italic",
487
- }}
488
- >
489
- This is a quote or highlighted text with custom padding and
490
- styling.
491
- </Text>
492
-
493
- <FlexRow gap="10px">
494
- <Text underline style={{ color: "#007bff" }}>
495
- Link text
496
- </Text>
497
- <Text expand style={{ textAlign: "center" }}>
498
- Centered expanding content
499
- </Text>
500
- <Text bold style={{ color: "#dc3545" }}>
501
- Important
502
- </Text>
503
- </FlexRow>
504
- </FlexColumn>
505
- </div>
506
- </div>
507
- </div>
508
- );
509
- };
510
-
511
- render(<Demo />, document.getElementById("app"));
512
- </script>
513
- </body>
514
- </html>
@@ -1,109 +0,0 @@
1
- import { useContext } from "preact/hooks";
2
-
3
- import { withPropsClassName } from "../props_composition/with_props_class_name.js";
4
- import { withPropsStyle } from "../props_composition/with_props_style.js";
5
- import { FlexDirectionContext } from "./layout_context.jsx";
6
- import { useLayoutStyle } from "./use_layout_style.js";
7
-
8
- import.meta.css = /* css */ `
9
- .navi_flex_row {
10
- display: flex;
11
- flex-direction: row;
12
- gap: 0;
13
- }
14
-
15
- .navi_flex_column {
16
- display: flex;
17
- flex-direction: column;
18
- gap: 0;
19
- }
20
-
21
- .navi_flex_item {
22
- flex-shrink: 0;
23
- }
24
- `;
25
-
26
- export const FlexRow = ({ alignX, alignY, gap, style, children, ...rest }) => {
27
- const { all } = useLayoutStyle(rest);
28
- const innerStyle = withPropsStyle(
29
- {
30
- ...all,
31
- // Only set justifyContent if it's not the default "start"
32
- justifyContent: alignX !== "start" ? alignX : undefined,
33
- // Only set alignItems if it's not the default "stretch"
34
- alignItems: alignY !== "stretch" ? alignY : undefined,
35
- gap,
36
- },
37
- style,
38
- );
39
-
40
- return (
41
- <div {...rest} className="navi_flex_row" style={innerStyle}>
42
- <FlexDirectionContext.Provider value="row">
43
- {children}
44
- </FlexDirectionContext.Provider>
45
- </div>
46
- );
47
- };
48
- export const FlexColumn = ({
49
- alignX,
50
- alignY,
51
- gap,
52
- style,
53
- children,
54
- ...rest
55
- }) => {
56
- const { all } = useLayoutStyle(rest);
57
- const innerStyle = withPropsStyle(
58
- {
59
- ...all,
60
- // Only set alignItems if it's not the default "stretch"
61
- alignItems: alignX !== "stretch" ? alignX : undefined,
62
- // Only set justifyContent if it's not the default "start"
63
- justifyContent: alignY !== "start" ? alignY : undefined,
64
- gap,
65
- },
66
- style,
67
- );
68
-
69
- return (
70
- <div {...rest} className="navi_flex_column" style={innerStyle}>
71
- <FlexDirectionContext.Provider value="column">
72
- {children}
73
- </FlexDirectionContext.Provider>
74
- </div>
75
- );
76
- };
77
-
78
- export const FlexItem = ({
79
- shrink,
80
- className,
81
- expand,
82
- style,
83
- children,
84
- ...rest
85
- }) => {
86
- const flexDirection = useContext(FlexDirectionContext);
87
- if (!flexDirection) {
88
- console.warn(
89
- "FlexItem must be used within a FlexRow or FlexColumn component.",
90
- );
91
- }
92
-
93
- const innerClassName = withPropsClassName("navi_flex_item", className);
94
- const { all } = useLayoutStyle(rest);
95
- const innerStyle = withPropsStyle(
96
- {
97
- ...all,
98
- flexGrow: expand ? 1 : undefined,
99
- flexShrink: shrink ? 1 : undefined,
100
- },
101
- style,
102
- );
103
-
104
- return (
105
- <div {...rest} className={innerClassName} style={innerStyle}>
106
- {children}
107
- </div>
108
- );
109
- };
@@ -1,3 +0,0 @@
1
- import { createContext } from "preact";
2
-
3
- export const FlexDirectionContext = createContext();
@@ -1,20 +0,0 @@
1
- import { withPropsStyle } from "../props_composition/with_props_style.js";
2
- import { useLayoutStyle } from "./use_layout_style.js";
3
-
4
- export const Spacing = ({ style, children, ...rest }) => {
5
- const { padding, margin } = useLayoutStyle(rest);
6
- return (
7
- <div
8
- {...rest}
9
- style={withPropsStyle(
10
- {
11
- ...margin,
12
- ...padding,
13
- },
14
- style,
15
- )}
16
- >
17
- {children}
18
- </div>
19
- );
20
- };