@jsenv/navi 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist/jsenv_navi.js +13858 -23295
  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 -177
  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,201 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>Simple Callout Demo</title>
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <meta charset="utf-8" />
7
- <link rel="icon" href="data:," />
8
- <style>
9
- body {
10
- min-height: 300vh; /* Make page scrollable */
11
- margin: 0;
12
- padding: 20px;
13
- font-family: Arial, sans-serif;
14
- background: linear-gradient(45deg, #f0f8ff, #e6f3ff);
15
- }
16
-
17
- .container {
18
- max-width: 800px;
19
- margin: 0 auto;
20
- }
21
-
22
- .section {
23
- margin: 40px 0;
24
- padding: 20px;
25
- background: white;
26
- border-radius: 8px;
27
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
28
- }
29
-
30
- .target-element {
31
- display: inline-block;
32
- margin: 10px;
33
- padding: 12px 20px;
34
- color: white;
35
- font-size: 16px;
36
- background: #4caf50;
37
- border: none;
38
- border-radius: 4px;
39
- cursor: pointer;
40
- }
41
-
42
- .target-element:hover {
43
- background: #45a049;
44
- }
45
-
46
- .spacer {
47
- display: flex;
48
- height: 200px;
49
- margin: 40px 0;
50
- align-items: center;
51
- justify-content: center;
52
- color: #666;
53
- font-weight: bold;
54
- font-size: 18px;
55
- background: repeating-linear-gradient(
56
- 45deg,
57
- transparent,
58
- transparent 20px,
59
- rgba(0, 0, 0, 0.1) 20px,
60
- rgba(0, 0, 0, 0.1) 40px
61
- );
62
- }
63
-
64
- .scroll-instruction {
65
- position: fixed;
66
- top: 10px;
67
- right: 10px;
68
- z-index: 1000;
69
- padding: 10px;
70
- color: white;
71
- font-size: 14px;
72
- background: #333;
73
- border-radius: 4px;
74
- }
75
-
76
- .scrollable-container {
77
- width: 100%;
78
- height: 300px;
79
- padding: 20px;
80
- background: #f9f9f9;
81
- border: 2px solid #ddd;
82
- border-radius: 8px;
83
- overflow: auto;
84
- }
85
-
86
- .scrollable-content {
87
- display: flex;
88
- width: 800px;
89
- height: 600px;
90
- flex-direction: column;
91
- align-items: center;
92
- justify-content: space-around;
93
- background: repeating-linear-gradient(
94
- 45deg,
95
- transparent,
96
- transparent 30px,
97
- rgba(0, 0, 255, 0.1) 30px,
98
- rgba(0, 0, 255, 0.1) 60px
99
- );
100
- }
101
- </style>
102
- </head>
103
- <body>
104
- <div class="scroll-instruction">Scroll to test callout positioning</div>
105
-
106
- <div class="container">
107
- <h1>Simple Callout Demo</h1>
108
- <p>
109
- This demo shows how the callout follows its target element during
110
- scrolling.
111
- </p>
112
-
113
- <div class="section">
114
- <h2>Auto-opened Callout</h2>
115
- <p>This callout opens automatically when the page loads:</p>
116
- <p>
117
- <strong
118
- >Scroll inside the container below to test positioning within a
119
- scrollable parent:</strong
120
- >
121
- </p>
122
- <div class="scrollable-container">
123
- <div class="scrollable-content">
124
- <div>Top of scrollable area</div>
125
- <button id="auto-target" class="target-element">
126
- Target Element (Auto-opened message)
127
- </button>
128
- <div>Bottom of scrollable area</div>
129
- </div>
130
- </div>
131
- </div>
132
-
133
- <div class="spacer">
134
- Scroll Area 1 - Keep scrolling to test positioning
135
- </div>
136
-
137
- <div class="section">
138
- <h2>Middle Section</h2>
139
- <p>
140
- The callout should follow the target element as you scroll past this
141
- section.
142
- </p>
143
- </div>
144
-
145
- <div class="spacer">Scroll Area 2 - More scrolling space</div>
146
-
147
- <div class="section">
148
- <h2>Another Section</h2>
149
- <p>
150
- Continue scrolling to test the message positioning at different scroll
151
- positions.
152
- </p>
153
- </div>
154
-
155
- <div class="spacer">Scroll Area 3 - Bottom section</div>
156
-
157
- <div class="section">
158
- <h2>Final Section</h2>
159
- <p>Scroll back up to see how the callout behaves.</p>
160
- </div>
161
-
162
- <div
163
- style="
164
- height: 50vh;
165
- background: #f0f0f0;
166
- display: flex;
167
- align-items: center;
168
- justify-content: center;
169
- margin-top: 40px;
170
- "
171
- >
172
- <p>Bottom spacer - scroll back up to see callouts</p>
173
- </div>
174
- </div>
175
-
176
- <script type="module">
177
- import { openCallout } from "@jsenv/navi";
178
-
179
- // Auto-open callout on page load
180
- window.addEventListener("load", () => {
181
- const autoTarget = document.getElementById("auto-target");
182
- openCallout(
183
- `This is a very long callout that was opened automatically when the page loaded. <strong>Try scrolling both horizontally and vertically</strong> within the container to see how the callout follows the target element! This message is intentionally made very long to test how the positioning system handles callouts that exceed the visible area of their container. The callout should properly position itself even when parts of it would normally be clipped by the container boundaries. You can scroll in any direction - up, down, left, right - to test the robustness of the positioning algorithm. This lengthy content helps verify that the callout system can handle edge cases where the callout content is larger than the available viewport space within scrollable containers.`,
184
- {
185
- anchorElement: autoTarget,
186
- level: "warning",
187
- debug: true,
188
- canClickThrough: true,
189
- onClose: () => {
190
- console.log("Callout was closed");
191
- },
192
- },
193
- );
194
- });
195
-
196
- console.log(
197
- "Simple callout demo loaded. Check console for debug output.",
198
- );
199
- </script>
200
- </body>
201
- </html>
@@ -1,161 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <title>Dynamic Callout Positioning Test</title>
6
- <style>
7
- body {
8
- margin: 0;
9
- padding: 20px;
10
- font-family: Arial, sans-serif;
11
- }
12
- .anchor {
13
- display: inline-block;
14
- margin: 10px;
15
- padding: 10px 20px;
16
- color: white;
17
- background: #007acc;
18
- border-radius: 4px;
19
- cursor: pointer;
20
- }
21
- .test-section {
22
- margin: 40px 0;
23
- padding: 20px;
24
- border: 1px solid #ddd;
25
- border-radius: 4px;
26
- }
27
- .resize-controls {
28
- position: fixed;
29
- top: 10px;
30
- right: 10px;
31
- z-index: 1000;
32
- padding: 10px;
33
- background: white;
34
- border: 1px solid #ccc;
35
- border-radius: 4px;
36
- }
37
- .large-anchor {
38
- display: flex;
39
- width: 300px;
40
- height: 200px;
41
- margin: 20px;
42
- align-items: center;
43
- justify-content: center;
44
- background: #28a745;
45
- }
46
- .tiny-anchor {
47
- display: flex;
48
- width: 50px;
49
- height: 20px;
50
- margin: 20px;
51
- align-items: center;
52
- justify-content: center;
53
- font-size: 12px;
54
- background: #dc3545;
55
- }
56
- </style>
57
- </head>
58
- <body>
59
- <div class="resize-controls">
60
- <button onclick="resizeWindow(800, 600)">Small (800x600)</button>
61
- <button onclick="resizeWindow(1200, 800)">Medium (1200x800)</button>
62
- <button onclick="resizeWindow(1600, 1000)">Large (1600x1000)</button>
63
- <div>Current: <span id="current-size"></span></div>
64
- </div>
65
-
66
- <div class="test-section">
67
- <h2>Test 1: Normal anchor element</h2>
68
- <div
69
- class="anchor"
70
- id="anchor1"
71
- onclick="openTestCallout(this, 'Normal anchor test')"
72
- >
73
- Click me - Normal anchor
74
- </div>
75
- <p>
76
- This should show an anchored callout with arrow when viewport is large
77
- enough.
78
- </p>
79
- </div>
80
-
81
- <div class="test-section">
82
- <h2>Test 2: Large anchor element</h2>
83
- <div
84
- class="large-anchor"
85
- id="anchor2"
86
- onclick="openTestCallout(this, 'Large anchor test - should be centered when too big for viewport')"
87
- >
88
- Large Anchor Element
89
- </div>
90
- <p>
91
- This should center in viewport when anchor is too large relative to
92
- viewport height.
93
- </p>
94
- </div>
95
-
96
- <div class="test-section">
97
- <h2>Test 3: Tiny anchor element</h2>
98
- <div
99
- class="tiny-anchor"
100
- id="anchor3"
101
- onclick="openTestCallout(this, 'Tiny anchor test')"
102
- >
103
- Tiny
104
- </div>
105
- <p>This should work with anchored positioning in most cases.</p>
106
- </div>
107
-
108
- <script type="module">
109
- import { openCallout } from "./callout.js";
110
-
111
- let currentCallout = null;
112
-
113
- window.openTestCallout = (anchorElement, message) => {
114
- // Close existing callout
115
- if (currentCallout) {
116
- currentCallout.close();
117
- }
118
-
119
- currentCallout = openCallout({
120
- anchorElement,
121
- calloutElement: createCalloutContent(message),
122
- level: "info",
123
- debug: true,
124
- });
125
- };
126
-
127
- function createCalloutContent(message) {
128
- const div = document.createElement("div");
129
- div.style.padding = "20px";
130
- div.style.maxWidth = "300px";
131
- div.style.background = "white";
132
- div.innerHTML = `
133
- <h3>Dynamic Positioning Test</h3>
134
- <p>${message}</p>
135
- <p>Window size: ${window.innerWidth} x ${window.innerHeight}</p>
136
- <button onclick="currentCallout?.close()">Close</button>
137
- `;
138
- return div;
139
- }
140
-
141
- window.resizeWindow = (width, height) => {
142
- window.resizeTo(width, height);
143
- updateSizeDisplay();
144
- };
145
-
146
- function updateSizeDisplay() {
147
- document.getElementById("current-size").textContent =
148
- `${window.innerWidth} x ${window.innerHeight}`;
149
- }
150
-
151
- // Update size display on load and resize
152
- window.addEventListener("load", updateSizeDisplay);
153
- window.addEventListener("resize", updateSizeDisplay);
154
-
155
- // Test automatic strategy changes on resize
156
- window.addEventListener("resize", () => {
157
- console.debug("Window resized, callout should re-evaluate strategy");
158
- });
159
- </script>
160
- </body>
161
- </html>
@@ -1,182 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <title>Test HTML Document in Callout</title>
6
- <style>
7
- body {
8
- margin: 0;
9
- padding: 20px;
10
- font-family: Arial, sans-serif;
11
- }
12
- .test-button {
13
- display: inline-block;
14
- margin: 10px;
15
- padding: 10px 20px;
16
- color: white;
17
- font-size: 14px;
18
- background: #007acc;
19
- border: none;
20
- border-radius: 4px;
21
- cursor: pointer;
22
- }
23
- .test-section {
24
- margin: 40px 0;
25
- padding: 20px;
26
- border: 1px solid #ddd;
27
- border-radius: 4px;
28
- }
29
- pre {
30
- padding: 10px;
31
- font-size: 12px;
32
- background: #f5f5f5;
33
- border-radius: 4px;
34
- overflow-x: auto;
35
- }
36
- </style>
37
- </head>
38
- <body>
39
- <h1>HTML Document in Callout Test</h1>
40
-
41
- <div class="test-section">
42
- <h2>Test 1: Regular HTML content (no DOCTYPE)</h2>
43
- <button class="test-button" onclick="showRegularHtml()">
44
- Show Regular HTML
45
- </button>
46
- <p>This should display as normal innerHTML (no iframe).</p>
47
- </div>
48
-
49
- <div class="test-section">
50
- <h2>Test 2: Complete HTML document (with DOCTYPE)</h2>
51
- <button class="test-button" onclick="showHtmlDocument()">
52
- Show HTML Document
53
- </button>
54
- <p>This should display in an iframe to prevent style conflicts.</p>
55
- </div>
56
-
57
- <div class="test-section">
58
- <h2>Test 3: HTML document with conflicting styles</h2>
59
- <button class="test-button" onclick="showConflictingStylesDocument()">
60
- Show Document with Conflicting Styles
61
- </button>
62
- <p>This demonstrates how iframe isolation prevents style conflicts.</p>
63
- </div>
64
-
65
- <script type="module">
66
- import { openCallout } from "@jsenv/navi";
67
-
68
- let currentCallout = null;
69
-
70
- function closeCurrentCallout() {
71
- if (currentCallout) {
72
- currentCallout.close();
73
- currentCallout = null;
74
- }
75
- }
76
-
77
- window.showRegularHtml = () => {
78
- closeCurrentCallout();
79
- const regularHtml = `
80
- <h3>Regular HTML Content</h3>
81
- <p>This is just regular HTML content without DOCTYPE.</p>
82
- <ul>
83
- <li>Item 1</li>
84
- <li>Item 2</li>
85
- <li>Item 3</li>
86
- </ul>
87
- <p><strong>Note:</strong> This should display as innerHTML, not in an iframe.</p>
88
- `;
89
-
90
- currentCallout = openCallout(regularHtml, {
91
- level: "info",
92
- debug: true,
93
- });
94
- };
95
-
96
- window.showHtmlDocument = () => {
97
- closeCurrentCallout();
98
- const htmlDocument = `<!DOCTYPE html>
99
- <html>
100
- <head>
101
- <meta charset="utf-8">
102
- <title>Embedded Document</title>
103
- <style>
104
- body {
105
- font-family: Georgia, serif;
106
- background: linear-gradient(45deg, #e3f2fd, #fff3e0);
107
- margin: 0;
108
- padding: 20px;
109
- }
110
- h1 { color: #1976d2; }
111
- .highlight { background: yellow; padding: 2px 4px; }
112
- </style>
113
- </head>
114
- <body>
115
- <h1>Complete HTML Document</h1>
116
- <p>This is a <span class="highlight">complete HTML document</span> with its own styles.</p>
117
- <p>It's displayed in an iframe to prevent any style conflicts with the parent page.</p>
118
- <div style="border: 2px solid #4caf50; padding: 10px; margin: 10px 0; border-radius: 8px;">
119
- <strong>Isolated Environment:</strong> This document has its own CSS and doesn't interfere with the callout styles.
120
- </div>
121
- </body>
122
- </html>`;
123
-
124
- currentCallout = openCallout(htmlDocument, {
125
- level: "warning",
126
- debug: true,
127
- });
128
- };
129
-
130
- window.showConflictingStylesDocument = () => {
131
- closeCurrentCallout();
132
- const conflictingDocument = `<!DOCTYPE html>
133
- <html>
134
- <head>
135
- <meta charset="utf-8">
136
- <title>Conflicting Styles</title>
137
- <style>
138
- /* These styles would conflict with the main page if not isolated */
139
- body {
140
- background: #ff5722;
141
- color: white;
142
- font-family: 'Comic Sans MS', cursive;
143
- margin: 0;
144
- padding: 15px;
145
- }
146
- button {
147
- background: #4caf50;
148
- color: white;
149
- border: none;
150
- padding: 8px 16px;
151
- border-radius: 20px;
152
- cursor: pointer;
153
- }
154
- .navi_callout {
155
- /* This would break the callout if not isolated */
156
- display: none !important;
157
- }
158
- </style>
159
- </head>
160
- <body>
161
- <h1>🎨 Document with Conflicting Styles</h1>
162
- <p>This document has styles that would completely break the callout if not isolated in an iframe!</p>
163
- <button onclick="alert('This button works inside the iframe!')">Click me!</button>
164
- <p><em>Notice how the styles don't affect the callout container.</em></p>
165
- </body>
166
- </html>`;
167
-
168
- currentCallout = openCallout(conflictingDocument, {
169
- level: "error",
170
- debug: true,
171
- });
172
- };
173
-
174
- // Close callout on escape key
175
- document.addEventListener("keydown", (e) => {
176
- if (e.key === "Escape") {
177
- closeCurrentCallout();
178
- }
179
- });
180
- </script>
181
- </body>
182
- </html>