kempo-ui 0.3.7 → 0.3.8

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 (266) hide show
  1. package/dist/components/Accordion.js +5 -5
  2. package/dist/components/Aside.js +16 -16
  3. package/dist/components/Card.js +3 -3
  4. package/dist/components/ColorPicker.js +4 -4
  5. package/dist/components/ContentSlider.js +3 -3
  6. package/dist/components/Context.js +1 -1
  7. package/dist/components/Dialog.js +7 -7
  8. package/dist/components/Dropdown.js +7 -4
  9. package/dist/components/FilterItem.js +2 -2
  10. package/dist/components/FilterList.js +2 -2
  11. package/dist/components/FocusCapture.js +2 -2
  12. package/dist/components/HtmlEditor.js +62 -39
  13. package/dist/components/HybridComponent.js +1 -1
  14. package/dist/components/Icon.js +2 -2
  15. package/dist/components/Import.js +1 -1
  16. package/dist/components/LightComponent.js +1 -1
  17. package/dist/components/Main.js +3 -3
  18. package/dist/components/Nav.js +2 -2
  19. package/dist/components/NavSpacer.js +6 -0
  20. package/dist/components/PhotoViewer.js +3 -3
  21. package/dist/components/Resize.js +3 -3
  22. package/dist/components/ShadowComponent.js +1 -1
  23. package/dist/components/ShowMore.js +3 -3
  24. package/dist/components/Sortable.js +3 -3
  25. package/dist/components/Spinner.js +2 -2
  26. package/dist/components/Split.js +3 -3
  27. package/dist/components/Table.js +27 -27
  28. package/dist/components/Tabs.js +7 -7
  29. package/dist/components/Tags.js +4 -4
  30. package/dist/components/ThemeSelect.js +4 -4
  31. package/dist/components/ThemeSwitcher.js +5 -5
  32. package/dist/components/Timestamp.js +1 -1
  33. package/dist/components/Toast.js +3 -3
  34. package/dist/components/Toggle.js +3 -3
  35. package/dist/components/Tree.js +10 -10
  36. package/dist/components/htmlEditorControls/AlignCenter.js +4 -4
  37. package/dist/components/htmlEditorControls/AlignJustify.js +4 -4
  38. package/dist/components/htmlEditorControls/AlignLeft.js +4 -4
  39. package/dist/components/htmlEditorControls/AlignRight.js +4 -4
  40. package/dist/components/htmlEditorControls/Bold.js +4 -4
  41. package/dist/components/htmlEditorControls/BulletList.js +4 -4
  42. package/dist/components/htmlEditorControls/CharacterCount.js +3 -3
  43. package/dist/components/htmlEditorControls/ClearFormatting.js +4 -4
  44. package/dist/components/htmlEditorControls/CodeBlock.js +3 -3
  45. package/dist/components/htmlEditorControls/ControlGroup.js +2 -2
  46. package/dist/components/htmlEditorControls/ControlSpacer.js +2 -2
  47. package/dist/components/htmlEditorControls/CreateLink.js +3 -3
  48. package/dist/components/htmlEditorControls/DropdownControl.js +3 -3
  49. package/dist/components/htmlEditorControls/FormatBlock.js +4 -4
  50. package/dist/components/htmlEditorControls/HtmlEditorControl.js +2 -2
  51. package/dist/components/htmlEditorControls/InlineCode.js +3 -3
  52. package/dist/components/htmlEditorControls/InsertTable.js +3 -3
  53. package/dist/components/htmlEditorControls/Italic.js +4 -4
  54. package/dist/components/htmlEditorControls/Mode.js +3 -3
  55. package/dist/components/htmlEditorControls/NumberList.js +4 -4
  56. package/dist/components/htmlEditorControls/Strikethrough.js +4 -4
  57. package/dist/components/htmlEditorControls/TextBackgroundColor.js +6 -6
  58. package/dist/components/htmlEditorControls/TextColor.js +7 -7
  59. package/dist/components/htmlEditorControls/Underline.js +4 -4
  60. package/dist/components/htmlEditorControls/WordCount.js +3 -3
  61. package/dist/components/htmlEditorNodes/HtmlComment.js +24 -0
  62. package/dist/components/tableControls/DeleteRecord.js +2 -2
  63. package/dist/components/tableControls/DeleteSelected.js +2 -2
  64. package/dist/components/tableControls/Edit.js +4 -4
  65. package/dist/components/tableControls/ExportCSV.js +2 -2
  66. package/dist/components/tableControls/ExportJson.js +2 -2
  67. package/dist/components/tableControls/FieldSortHide.js +4 -4
  68. package/dist/components/tableControls/Filters.js +17 -17
  69. package/dist/components/tableControls/FirstPage.js +2 -2
  70. package/dist/components/tableControls/HiddenCount.js +2 -2
  71. package/dist/components/tableControls/Hide.js +2 -2
  72. package/dist/components/tableControls/LastPage.js +2 -2
  73. package/dist/components/tableControls/NextPage.js +2 -2
  74. package/dist/components/tableControls/PageSelect.js +4 -4
  75. package/dist/components/tableControls/PageSize.js +3 -3
  76. package/dist/components/tableControls/PrevPage.js +2 -2
  77. package/dist/components/tableControls/Search.js +2 -2
  78. package/dist/components/tableControls/ShowAll.js +2 -2
  79. package/dist/components/tableControls/TableControl.js +2 -2
  80. package/dist/utils/context.js +1 -1
  81. package/dist/utils/debounce.js +1 -1
  82. package/dist/utils/object.js +1 -1
  83. package/dist/utils/theme.js +1 -1
  84. package/dist/utils/wait.js +0 -1
  85. package/docs/components/accordion.html +2 -0
  86. package/docs/components/aside.html +9 -8
  87. package/docs/components/card.html +2 -0
  88. package/docs/components/color-picker.html +2 -0
  89. package/docs/components/content-slider.html +2 -0
  90. package/docs/components/context.html +2 -0
  91. package/docs/components/dialog.html +2 -0
  92. package/docs/components/dropdown.html +2 -0
  93. package/docs/components/filter-list.html +2 -0
  94. package/docs/components/focus-capture.html +2 -0
  95. package/docs/components/html-editor.html +54 -6
  96. package/docs/components/hybrid-component.html +2 -0
  97. package/docs/components/icon.html +2 -0
  98. package/docs/components/import.html +2 -0
  99. package/docs/components/light-component.html +2 -0
  100. package/docs/components/nav-spacer.html +315 -0
  101. package/docs/components/nav.html +2 -0
  102. package/docs/components/photo-viewer.html +2 -0
  103. package/docs/components/resize.html +2 -0
  104. package/docs/components/shadow-component.html +2 -0
  105. package/docs/components/show-more.html +2 -0
  106. package/docs/components/sortable.html +2 -0
  107. package/docs/components/spinner.html +2 -0
  108. package/docs/components/split.html +2 -0
  109. package/docs/components/table.html +2 -0
  110. package/docs/components/tableControls.html +2 -0
  111. package/docs/components/tableCustomFields.html +2 -0
  112. package/docs/components/tableFetchRecords.html +2 -0
  113. package/docs/components/tableFieldSortHide.html +2 -0
  114. package/docs/components/tablePagination.html +2 -0
  115. package/docs/components/tablePlaceholder.html +2 -0
  116. package/docs/components/tableRecordEditing.html +2 -0
  117. package/docs/components/tableRecordFiltering.html +2 -0
  118. package/docs/components/tableRecordHiding.html +2 -0
  119. package/docs/components/tableRecordSearching.html +2 -0
  120. package/docs/components/tableRecordSelection.html +2 -0
  121. package/docs/components/tableRowControls.html +2 -0
  122. package/docs/components/tableServerSync.html +2 -0
  123. package/docs/components/tableSorting.html +2 -0
  124. package/docs/components/tabs.html +2 -0
  125. package/docs/components/tags.html +2 -0
  126. package/docs/components/theme-select.html +2 -0
  127. package/docs/components/theme-switcher.html +2 -0
  128. package/docs/components/timestamp.html +2 -0
  129. package/docs/components/toast.html +2 -0
  130. package/docs/components/toggle.html +2 -0
  131. package/docs/components/tree.html +2 -0
  132. package/docs/icons/comment.svg +1 -0
  133. package/docs/index.html +8 -0
  134. package/docs/src/components/Accordion.js +5 -5
  135. package/docs/src/components/Aside.js +16 -16
  136. package/docs/src/components/Card.js +3 -3
  137. package/docs/src/components/ColorPicker.js +4 -4
  138. package/docs/src/components/ContentSlider.js +3 -3
  139. package/docs/src/components/Context.js +1 -1
  140. package/docs/src/components/Dialog.js +7 -7
  141. package/docs/src/components/Dropdown.js +7 -4
  142. package/docs/src/components/FilterItem.js +2 -2
  143. package/docs/src/components/FilterList.js +2 -2
  144. package/docs/src/components/FocusCapture.js +2 -2
  145. package/docs/src/components/HtmlEditor.js +62 -39
  146. package/docs/src/components/HybridComponent.js +1 -1
  147. package/docs/src/components/Icon.js +2 -2
  148. package/docs/src/components/Import.js +1 -1
  149. package/docs/src/components/LightComponent.js +1 -1
  150. package/docs/src/components/Main.js +3 -3
  151. package/docs/src/components/Nav.js +2 -2
  152. package/docs/src/components/NavSpacer.js +6 -0
  153. package/docs/src/components/PhotoViewer.js +3 -3
  154. package/docs/src/components/Resize.js +3 -3
  155. package/docs/src/components/ShadowComponent.js +1 -1
  156. package/docs/src/components/ShowMore.js +3 -3
  157. package/docs/src/components/Sortable.js +3 -3
  158. package/docs/src/components/Spinner.js +2 -2
  159. package/docs/src/components/Split.js +3 -3
  160. package/docs/src/components/Table.js +27 -27
  161. package/docs/src/components/Tabs.js +7 -7
  162. package/docs/src/components/Tags.js +4 -4
  163. package/docs/src/components/ThemeSelect.js +4 -4
  164. package/docs/src/components/ThemeSwitcher.js +5 -5
  165. package/docs/src/components/Timestamp.js +1 -1
  166. package/docs/src/components/Toast.js +3 -3
  167. package/docs/src/components/Toggle.js +3 -3
  168. package/docs/src/components/Tree.js +10 -10
  169. package/docs/src/components/htmlEditorControls/AlignCenter.js +4 -4
  170. package/docs/src/components/htmlEditorControls/AlignJustify.js +4 -4
  171. package/docs/src/components/htmlEditorControls/AlignLeft.js +4 -4
  172. package/docs/src/components/htmlEditorControls/AlignRight.js +4 -4
  173. package/docs/src/components/htmlEditorControls/Bold.js +4 -4
  174. package/docs/src/components/htmlEditorControls/BulletList.js +4 -4
  175. package/docs/src/components/htmlEditorControls/CharacterCount.js +3 -3
  176. package/docs/src/components/htmlEditorControls/ClearFormatting.js +4 -4
  177. package/docs/src/components/htmlEditorControls/CodeBlock.js +3 -3
  178. package/docs/src/components/htmlEditorControls/ControlGroup.js +2 -2
  179. package/docs/src/components/htmlEditorControls/ControlSpacer.js +2 -2
  180. package/docs/src/components/htmlEditorControls/CreateLink.js +3 -3
  181. package/docs/src/components/htmlEditorControls/DropdownControl.js +3 -3
  182. package/docs/src/components/htmlEditorControls/FormatBlock.js +4 -4
  183. package/docs/src/components/htmlEditorControls/HtmlEditorControl.js +2 -2
  184. package/docs/src/components/htmlEditorControls/InlineCode.js +3 -3
  185. package/docs/src/components/htmlEditorControls/InsertTable.js +3 -3
  186. package/docs/src/components/htmlEditorControls/Italic.js +4 -4
  187. package/docs/src/components/htmlEditorControls/Mode.js +3 -3
  188. package/docs/src/components/htmlEditorControls/NumberList.js +4 -4
  189. package/docs/src/components/htmlEditorControls/Strikethrough.js +4 -4
  190. package/docs/src/components/htmlEditorControls/TextBackgroundColor.js +6 -6
  191. package/docs/src/components/htmlEditorControls/TextColor.js +7 -7
  192. package/docs/src/components/htmlEditorControls/Underline.js +4 -4
  193. package/docs/src/components/htmlEditorControls/WordCount.js +3 -3
  194. package/docs/src/components/htmlEditorNodes/HtmlComment.js +24 -0
  195. package/docs/src/components/tableControls/DeleteRecord.js +2 -2
  196. package/docs/src/components/tableControls/DeleteSelected.js +2 -2
  197. package/docs/src/components/tableControls/Edit.js +4 -4
  198. package/docs/src/components/tableControls/ExportCSV.js +2 -2
  199. package/docs/src/components/tableControls/ExportJson.js +2 -2
  200. package/docs/src/components/tableControls/FieldSortHide.js +4 -4
  201. package/docs/src/components/tableControls/Filters.js +17 -17
  202. package/docs/src/components/tableControls/FirstPage.js +2 -2
  203. package/docs/src/components/tableControls/HiddenCount.js +2 -2
  204. package/docs/src/components/tableControls/Hide.js +2 -2
  205. package/docs/src/components/tableControls/LastPage.js +2 -2
  206. package/docs/src/components/tableControls/NextPage.js +2 -2
  207. package/docs/src/components/tableControls/PageSelect.js +4 -4
  208. package/docs/src/components/tableControls/PageSize.js +3 -3
  209. package/docs/src/components/tableControls/PrevPage.js +2 -2
  210. package/docs/src/components/tableControls/Search.js +2 -2
  211. package/docs/src/components/tableControls/ShowAll.js +2 -2
  212. package/docs/src/components/tableControls/TableControl.js +2 -2
  213. package/docs/src/utils/context.js +1 -1
  214. package/docs/src/utils/debounce.js +1 -1
  215. package/docs/src/utils/object.js +1 -1
  216. package/docs/src/utils/theme.js +1 -1
  217. package/docs/src/utils/wait.js +0 -1
  218. package/docs/utils/context.html +2 -0
  219. package/docs/utils/cookie.html +2 -0
  220. package/docs/utils/debounce.html +2 -0
  221. package/docs/utils/drag.html +2 -0
  222. package/docs/utils/elevation.html +2 -0
  223. package/docs/utils/formatTimestamp.html +2 -0
  224. package/docs/utils/object.html +2 -0
  225. package/docs/utils/propConverters.html +2 -0
  226. package/docs/utils/string.html +2 -0
  227. package/docs/utils/theme.html +2 -0
  228. package/docs/utils/toTitleCase.html +2 -0
  229. package/docs/utils/type.html +2 -0
  230. package/docs/utils/wait.html +2 -0
  231. package/docs-src/components/aside.page.html +7 -8
  232. package/docs-src/components/html-editor.page.html +52 -6
  233. package/docs-src/components/nav-spacer.page.html +65 -0
  234. package/docs-src/index.page.html +6 -0
  235. package/docs-src/nav.fragment.html +2 -0
  236. package/icons/comment.svg +1 -0
  237. package/llm.txt +1 -0
  238. package/package.json +1 -1
  239. package/scripts/build.js +1 -1
  240. package/src/components/Accordion.js +1 -1
  241. package/src/components/Dropdown.js +7 -3
  242. package/src/components/HtmlEditor.js +699 -1206
  243. package/src/components/NavSpacer.js +55 -0
  244. package/src/components/htmlEditorControls/AlignCenter.js +5 -5
  245. package/src/components/htmlEditorControls/AlignJustify.js +5 -5
  246. package/src/components/htmlEditorControls/AlignLeft.js +5 -5
  247. package/src/components/htmlEditorControls/AlignRight.js +5 -5
  248. package/src/components/htmlEditorControls/Bold.js +5 -5
  249. package/src/components/htmlEditorControls/BulletList.js +5 -5
  250. package/src/components/htmlEditorControls/ClearFormatting.js +5 -5
  251. package/src/components/htmlEditorControls/CodeBlock.js +16 -8
  252. package/src/components/htmlEditorControls/CreateLink.js +3 -7
  253. package/src/components/htmlEditorControls/FormatBlock.js +5 -5
  254. package/src/components/htmlEditorControls/InlineCode.js +1 -13
  255. package/src/components/htmlEditorControls/InsertTable.js +43 -44
  256. package/src/components/htmlEditorControls/Italic.js +5 -5
  257. package/src/components/htmlEditorControls/Mode.js +1 -1
  258. package/src/components/htmlEditorControls/NumberList.js +5 -5
  259. package/src/components/htmlEditorControls/Strikethrough.js +5 -5
  260. package/src/components/htmlEditorControls/Underline.js +5 -5
  261. package/src/components/htmlEditorNodes/HtmlComment.js +118 -0
  262. package/tests/components/Accordion.browser-test.js +154 -0
  263. package/tests/components/Dropdown.browser-test.js +85 -0
  264. package/tests/components/HtmlComment.browser-test.js +115 -0
  265. package/tests/components/HtmlEditor.browser-test.js +379 -0
  266. package/tests/components/NavSpacer.browser-test.js +81 -0
@@ -136,7 +136,7 @@
136
136
  <div class="col m-span-12 px">
137
137
  <k-card label="Output">
138
138
  <k-aside id="aside5" main="push" state="offscreen">
139
- <div class="navbar-spacer"></div>
139
+ <k-nav-spacer></k-nav-spacer>
140
140
  <nav>
141
141
  <h3>Sidebar</h3>
142
142
  <a href="#">Home</a>
@@ -165,7 +165,7 @@
165
165
  <div class="col m-span-12 px">
166
166
  <k-card label="Output">
167
167
  <k-aside id="aside6" main="push" state="offscreen">
168
- <div class="navbar-spacer"></div>
168
+ <k-nav-spacer></k-nav-spacer>
169
169
  <nav>
170
170
  <h3>Menu</h3>
171
171
  <a href="#">Dashboard</a>
@@ -196,7 +196,7 @@
196
196
  <div class="col m-span-12 px">
197
197
  <k-card label="Output">
198
198
  <k-aside id="aside7" main="push" side="right" state="offscreen">
199
- <div class="navbar-spacer"></div>
199
+ <k-nav-spacer></k-nav-spacer>
200
200
  <nav>
201
201
  <h3>Right Panel</h3>
202
202
  <a href="#">Item 1</a>
@@ -279,7 +279,7 @@
279
279
  <k-card label="Output">
280
280
  <style>k-aside#aside13 { --collapsed-width: 5rem; }</style>
281
281
  <k-aside id="aside13" main="push" state="offscreen">
282
- <div class="navbar-spacer"></div>
282
+ <k-nav-spacer></k-nav-spacer>
283
283
  <nav>
284
284
  <h3>Sidebar</h3>
285
285
  <a href="#">Dashboard</a>
@@ -311,10 +311,8 @@
311
311
  <div class="col m-span-12 px">
312
312
  <k-card label="Output">
313
313
  <k-aside id="aside-persist" main="push" state="offscreen" persistent-id="docs-aside-persist-demo">
314
- <div class="navbar-spacer"></div>
315
- <nav>
316
- <p>Sidebar Content</p>
317
- </nav>
314
+ <k-nav-spacer></k-nav-spacer>
315
+ <p>Sidebar Content</p>
318
316
  </k-aside>
319
317
  <button id="btn-persist-expand">Expand</button>
320
318
  <button id="btn-persist-collapse">Collapse</button>
@@ -490,5 +488,6 @@
490
488
  <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
491
489
  <script type="module" src="{{pathToRoot}}src/components/Aside.js"></script>
492
490
  <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
491
+ <script type="module" src="{{pathToRoot}}src/components/NavSpacer.js"></script>
493
492
  </content>
494
493
  </page>
@@ -7,6 +7,8 @@
7
7
  <h6>Examples</h6>
8
8
  <a href="#fullExample">Complete Editor Example</a><br />
9
9
  <a href="#javascriptUsage">JavaScript API Example</a><br />
10
+ <a href="#incompatibleContent">Incompatible Content Example</a><br />
11
+ <a href="#customNodes">Custom Nodes Example</a><br />
10
12
 
11
13
  <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
12
14
  <a href="#constructor">Constructor</a><br />
@@ -180,9 +182,9 @@
180
182
  <k-html-editor id="myEditor" class="b r"></k-html-editor>
181
183
  <script>
182
184
  const myEditor = document.getElementById('myEditor');
183
- setTimeout(() => {
185
+ myEditor.addEventListener('ready', () => {
184
186
  myEditor.setValue('<p>Select text and use the buttons above to format it!</p><p>The editor works without any built-in controls - you have full control via JavaScript.</p>');
185
- }, 100);
187
+ });
186
188
 
187
189
  function insertMyEditorHTML() {
188
190
  myEditor.insertHTML('<p><b>Inserted content!</b></p>');
@@ -196,6 +198,43 @@
196
198
  </div>
197
199
  </div>
198
200
 
201
+ <h3 id="incompatibleContent"><a href="#incompatibleContent" class="no-link">Incompatible Content Example</a></h3>
202
+ <p>When the editor's value contains HTML that Lexical does not support (such as <code>&lt;svg&gt;</code>, <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, <code>&lt;video&gt;</code>, etc.), it automatically defaults to code mode to preserve the content. If the user attempts to switch to visual mode, a confirmation dialog warns that the incompatible code will be lost.</p>
203
+ <div class="row -mx">
204
+ <div class="col m-span-12 px">
205
+ <k-card label="HTML">
206
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;svgEditor&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;&lt;p&gt;This value contains an inline SVG which Lexical does not support:&lt;/p&gt;&lt;svg width=&#x27;120&#x27; height=&#x27;60&#x27; xmlns=&#x27;http://www.w3.org/2000/svg&#x27;&gt;&lt;rect width=&#x27;120&#x27; height=&#x27;60&#x27; rx=&#x27;8&#x27; fill=&#x27;#4a90d9&#x27;/&gt;&lt;text x=&#x27;50%&#x27; y=&#x27;50%&#x27; dominant-baseline=&#x27;middle&#x27; text-anchor=&#x27;middle&#x27; fill=&#x27;white&#x27; font-size=&#x27;14&#x27;&gt;SVG&lt;/text&gt;&lt;/svg&gt;&lt;p&gt;The editor detected incompatible content and defaulted to code mode automatically.&lt;/p&gt;&quot;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&quot;toolbar-top&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-spacer</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&quot;toolbar-top&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
207
+ </k-card>
208
+ </div>
209
+ <div class="col m-span-12 px">
210
+ <k-card label="Output">
211
+ <k-html-editor id="svgEditor" class="b r" value="<p>This value contains an inline SVG which Lexical does not support:</p><svg width='120' height='60' xmlns='http://www.w3.org/2000/svg'><rect width='120' height='60' rx='8' fill='#4a90d9'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' fill='white' font-size='14'>SVG</text></svg><p>The editor detected incompatible content and defaulted to code mode automatically.</p>">
212
+ <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
213
+ <k-hec-mode slot="toolbar-top"></k-hec-mode>
214
+ </k-html-editor>
215
+ </k-card>
216
+ </div>
217
+ </div>
218
+
219
+ <h3 id="customNodes"><a href="#customNodes" class="no-link">Custom Nodes Example</a></h3>
220
+ <p>Custom nodes extend what Lexical understands in visual mode. Import a node file and list its name in the <code>nodes</code> attribute (comma-separated filenames without <code>.js</code>). The built-in <code>HtmlComment</code> node preserves HTML comments as inline visual chips rather than forcing code mode — comments round-trip through the editor without being stripped.</p>
221
+ <div class="row -mx">
222
+ <div class="col m-span-12 px">
223
+ <k-card label="HTML">
224
+ <pre><code class="hljs xml"><span class="hljs-comment">&lt;!-- Import the HtmlComment node --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&#x27;module&#x27;</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&#x27;src/components/htmlEditorNodes/HtmlComment.js&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span><br><span class="hljs-comment">&lt;!-- Register the node with nodes attribute --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">nodes</span>=<span class="hljs-string">&#x27;HtmlComment&#x27;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&#x27;&lt;p&gt;This paragraph has an &lt;!-- important note --&gt; inline comment.&lt;/p&gt;&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-spacer</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
225
+ </k-card>
226
+ </div>
227
+ <div class="col m-span-12 px">
228
+ <k-card label="Output">
229
+ <script type="module" src="/src/components/htmlEditorNodes/HtmlComment.js"></script>
230
+ <k-html-editor id="commentEditor" class="b r" nodes="HtmlComment" value="<p>This paragraph has an <!-- important note --> inline comment.</p>">
231
+ <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
232
+ <k-hec-mode slot="toolbar-top"></k-hec-mode>
233
+ </k-html-editor>
234
+ </k-card>
235
+ </div>
236
+ </div>
237
+
199
238
  <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
200
239
 
201
240
  <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
@@ -211,23 +250,30 @@
211
250
  <p>The HTML content of the editor. Can be get or set via JavaScript or HTML attribute.</p>
212
251
 
213
252
  <h5><code>mode<i>: String</i></code></h5>
214
- <p>Current editing mode. Either <code>'visual'</code> (WYSIWYG) or <code>'code'</code> (raw HTML). Default: <code>'visual'</code></p>
253
+ <p>Current editing mode. Either <code>'visual'</code> (WYSIWYG) or <code>'code'</code> (raw HTML). Default: <code>'visual'</code>. If the initial <code>value</code> contains content that is incompatible with the visual editor (such as <code>&lt;svg&gt;</code>, <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, etc.), the editor automatically switches to <code>'code'</code> mode to preserve the content. Custom nodes can extend what is considered compatible by defining a static <code>isVisualCompatible(domNode)</code> method.</p>
254
+
255
+ <h5><code>nodes<i>: String</i></code></h5>
256
+ <p>Comma-separated list of custom Lexical node module filenames (without <code>.js</code>) to load from the <code>htmlEditorNodes/</code> directory. Custom nodes can define two static hooks:</p>
257
+ <ul>
258
+ <li><code>isVisualCompatible(domNode)</code> — returns <code>true</code> if the node handles a DOM construct that would otherwise be considered incompatible (e.g., HTML comments)</li>
259
+ <li><code>preprocessHtml(htmlString)</code> — transforms raw HTML before Lexical parses it (e.g., converting <code>&lt;!-- --&gt;</code> to a parseable <code>&lt;span&gt;</code>)</li>
260
+ </ul>
215
261
 
216
262
  <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
217
263
 
218
264
  <h4>Mode Control</h4>
219
265
  <h5><code>setMode(mode)<i>: this</i></code></h5>
220
- <p>Set the editing mode. Accepts <code>'visual'</code> or <code>'code'</code>.</p>
266
+ <p>Set the editing mode. Accepts <code>'visual'</code> or <code>'code'</code>. If switching to <code>'visual'</code> and the current content is incompatible, a confirmation dialog warns that incompatible code will be lost.</p>
221
267
 
222
268
  <h5><code>toggleMode()<i>: this</i></code></h5>
223
- <p>Toggle between visual and code modes.</p>
269
+ <p>Toggle between visual and code modes. Same incompatibility warning applies when switching to visual mode.</p>
224
270
 
225
271
  <h4>Content Management</h4>
226
272
  <h5><code>getValue()<i>: String</i></code></h5>
227
273
  <p>Returns the current HTML content.</p>
228
274
 
229
275
  <h5><code>setValue(html)<i>: this</i></code></h5>
230
- <p>Sets the HTML content of the editor.</p>
276
+ <p>Sets the HTML content of the editor. If the editor is in visual mode and the new content is incompatible, automatically switches to code mode.</p>
231
277
 
232
278
  <h5><code>clear()<i>: this</i></code></h5>
233
279
  <p>Clears all content from the editor.</p>
@@ -0,0 +1,65 @@
1
+ <page pageName="Nav Spacer" title="Nav Spacer - Components - Kempo Docs - A Web Components Solution">
2
+ <content location="header"></content>
3
+ <content>
4
+ <h1 class="ta-center">Nav Spacer</h1>
5
+
6
+ <k-accordion persistent-id="toc-nav-spacer" class="b r mb">
7
+ <k-accordion-header for-panel="toc-nav-spacer-panel">Table of Contents</k-accordion-header>
8
+ <k-accordion-panel name="toc-nav-spacer-panel">
9
+ <div class="m">
10
+ <h6>Examples</h6>
11
+ <a href="#basicUsage">Basic Usage</a><br />
12
+ <a href="#noMargin">No Margin</a><br />
13
+
14
+ <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
15
+ <a href="#constructor">Constructor</a><br />
16
+ <a href="#requirements">Requirements</a><br />
17
+ <a href="#cssVariables">CSS Variables</a><br />
18
+ </div>
19
+ </k-accordion-panel>
20
+ </k-accordion>
21
+
22
+ <p>Place <code>k-nav-spacer</code> immediately after a <code>&lt;k-nav fixed&gt;</code> element. It automatically measures the nav's height using a <code>ResizeObserver</code> and sets its own height to match, ensuring page content is not hidden behind the fixed nav. A default bottom margin of <code>var(--spacer)</code> separates the spacer from the content below; override it with kempo-css margin utilities like <code>mb0</code>, <code>mbh</code>, etc.</p>
23
+
24
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
25
+ <p>Place <code>k-nav-spacer</code> directly after the fixed nav in your HTML. It will size itself to match the nav height.</p>
26
+ <div class="row -mx">
27
+ <div class="col m-span-12 px">
28
+ <k-card label="HTML">
29
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-nav</span> <span class="hljs-attr">fixed</span>&gt;</span><br> <span class="hljs-comment">&lt;!-- nav content --&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-nav</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">k-nav-spacer</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-nav-spacer</span>&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">main</span>&gt;</span><br> <span class="hljs-comment">&lt;!-- page content --&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">main</span>&gt;</span></code></pre>
30
+ </k-card>
31
+ </div>
32
+ </div>
33
+
34
+ <h3 id="noMargin"><a href="#noMargin" class="no-link">No Margin</a></h3>
35
+ <p>Add <code>mb0</code> to remove the default bottom margin, or use any kempo-css margin utility to customise it.</p>
36
+ <div class="row -mx">
37
+ <div class="col m-span-12 px">
38
+ <k-card label="HTML">
39
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-nav-spacer</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&#x27;mb0&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-nav-spacer</span>&gt;</span></code></pre>
40
+ </k-card>
41
+ </div>
42
+ </div>
43
+
44
+ <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
45
+
46
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
47
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
48
+ <h5><code>new NavSpacer()</code></h5>
49
+
50
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
51
+ <ul>
52
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
53
+ </ul>
54
+
55
+ <h3 id="cssVariables"><a href="#cssVariables" class="no-link">CSS Variables</a></h3>
56
+ <h5><code>--spacer</code></h5>
57
+ <p>Controls the default bottom margin. Inherited from kempo-css (default <code>1rem</code>). Override by applying a margin utility class directly to the element.</p>
58
+ </content>
59
+ <content location="scripts">
60
+ <script type="module" src="{{pathToRoot}}src/components/NavSpacer.js"></script>
61
+ <script type="module" src="{{pathToRoot}}src/components/Nav.js"></script>
62
+ <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
63
+ <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
64
+ </content>
65
+ </page>
@@ -119,6 +119,12 @@
119
119
  <p class="tc-muted">Fixed navigation bar with automatic elevation applied at the correct stacking level.</p>
120
120
  </a>
121
121
  </div>
122
+ <div class="span-12 t-span-6 d-span-4 px">
123
+ <a href="{{pathToRoot}}components/nav-spacer.html" class="card mb no-link d-b">
124
+ <h3 class="tc-primary">Nav Spacer</h3>
125
+ <p class="tc-muted">Auto-sizing spacer that offsets page content below a fixed nav bar.</p>
126
+ </a>
127
+ </div>
122
128
  <div class="span-12 t-span-6 d-span-4 px">
123
129
  <a href="{{pathToRoot}}components/photo-viewer.html" class="card mb no-link d-b">
124
130
  <h3 class="tc-primary">Photo Viewer</h3>
@@ -25,6 +25,7 @@
25
25
  <k-filter-item filter-keywords="icon components"><a href="{{pathToRoot}}components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
26
26
  <k-filter-item filter-keywords="import components"><a href="{{pathToRoot}}components/import.html">Import<br><small>Component</small></a></k-filter-item>
27
27
  <k-filter-item filter-keywords="nav navbar navigation components"><a href="{{pathToRoot}}components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
28
+ <k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="{{pathToRoot}}components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
28
29
  <k-filter-item filter-keywords="photo viewer photoviewer components"><a href="{{pathToRoot}}components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
29
30
  <k-filter-item filter-keywords="resize components"><a href="{{pathToRoot}}components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
30
31
  <k-filter-item filter-keywords="show more showmore components"><a href="{{pathToRoot}}components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
@@ -102,6 +103,7 @@
102
103
  <a href="{{pathToRoot}}components/icon.html">Icon</a>
103
104
  <a href="{{pathToRoot}}components/import.html">Import</a>
104
105
  <a href="{{pathToRoot}}components/nav.html">Nav</a>
106
+ <a href="{{pathToRoot}}components/nav-spacer.html">Nav Spacer</a>
105
107
  <a href="{{pathToRoot}}components/photo-viewer.html">Photo Viewer</a>
106
108
  <a href="{{pathToRoot}}components/resize.html">Resize</a>
107
109
  <a href="{{pathToRoot}}components/show-more.html">Show More</a>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM880-80 720-240H160q-33 0-56.5-23.5T80-320v-480q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v720ZM160-320h594l46 45v-525H160v480Zm0 0v-480 480Z"/></svg>
package/llm.txt CHANGED
@@ -67,6 +67,7 @@ import { html, css, LitElement } from 'kempo-ui/src/lit-all.min.js';
67
67
  | `<k-import>` | `Import.js` | Includes external HTML fragments; `src` attribute | [import.html](https://dustinpoissant.github.io/kempo-ui/components/import.html) |
68
68
  | `<k-main>` | `Main.js` | Layout main; automatically adjusts margins when a `k-aside[main="push"]` opens | — |
69
69
  | `<k-nav>` | `Nav.js` | Navigation bar | [nav.html](https://dustinpoissant.github.io/kempo-ui/components/nav.html) |
70
+ | `<k-nav-spacer>` | `NavSpacer.js` | Auto-sizing spacer that offsets page content below a fixed `k-nav` bar; default bottom margin of `var(--spacer)` can be overridden with kempo-css margin utilities | [nav-spacer.html](https://dustinpoissant.github.io/kempo-ui/components/nav-spacer.html) |
70
71
  | `<k-photo-viewer>` | `PhotoViewer.js` | Lightbox/gallery viewer | [photo-viewer.html](https://dustinpoissant.github.io/kempo-ui/components/photo-viewer.html) |
71
72
  | `<k-resize>` | `Resize.js` | Resizable pane with drag handle | [resize.html](https://dustinpoissant.github.io/kempo-ui/components/resize.html) |
72
73
  | `<k-show-more>` | `ShowMore.js` | Truncated content with expand toggle | [show-more.html](https://dustinpoissant.github.io/kempo-ui/components/show-more.html) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kempo-ui",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "type": "module",
5
5
  "description": "A Lit based web-component library",
6
6
  "main": "index.js",
package/scripts/build.js CHANGED
@@ -55,7 +55,7 @@ await Promise.all(allJSFiles.map(async jsFile => {
55
55
  processedJS[jsFile] = code;
56
56
  } else {
57
57
  // Minify the file
58
- code = (await minify(code)).code;
58
+ code = (await minify(code, { module: true })).code;
59
59
  }
60
60
 
61
61
  // Convert absolute paths to relative paths for GitHub Pages compatibility
@@ -33,7 +33,7 @@ export default class Accordion extends ShadowComponent {
33
33
  if (changedProps.has('persistentId') && this.persistentId && window?.localStorage) {
34
34
  const key = `accordion-persistent-id-${this.persistentId}`;
35
35
  const value = window.localStorage.getItem(key);
36
- if (value) {
36
+ if (value !== null) {
37
37
  const openPanels = value.split(',');
38
38
  this.querySelectorAll('k-accordion-panel').forEach(panel => {
39
39
  panel.active = openPanels.includes(panel.name);
@@ -73,7 +73,8 @@ export default class Dropdown extends ShadowComponent {
73
73
  Event Handlers
74
74
  */
75
75
  handleDocumentClick = e => {
76
- const isTrigger = e.target.closest('[slot="trigger"]');
76
+ const path = e.composedPath();
77
+ const isTrigger = path.find(el => el.matches?.('[slot="trigger"]'));
77
78
 
78
79
  if(isTrigger) {
79
80
  const triggerDropdown = isTrigger.closest('k-dropdown');
@@ -87,13 +88,13 @@ export default class Dropdown extends ShadowComponent {
87
88
  if(!this.opened) return;
88
89
 
89
90
  // Click is outside this dropdown entirely
90
- if(!this.contains(e.target)) {
91
+ if(!path.includes(this)) {
91
92
  if(this.closeOnClickOutside) this.close();
92
93
  return;
93
94
  }
94
95
 
95
96
  // Click is inside the menu on an interactive element (including submenu items)
96
- const isInteractive = e.target.closest('a, button');
97
+ const isInteractive = path.find(el => el.matches?.('a, button'));
97
98
  if(isInteractive && !isInteractive.closest('[slot="trigger"]') && this.closeOnSelect) this.close();
98
99
  };
99
100
 
@@ -235,8 +236,11 @@ export default class Dropdown extends ShadowComponent {
235
236
  :host {
236
237
  display: inline-block;
237
238
  position: relative;
239
+ white-space: normal;
238
240
  }
239
241
  #trigger {
242
+ display: inline-flex;
243
+ align-items: center;
240
244
  cursor: pointer;
241
245
  anchor-name: --dropdown-trigger;
242
246
  }