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.
- package/dist/components/Accordion.js +5 -5
- package/dist/components/Aside.js +16 -16
- package/dist/components/Card.js +3 -3
- package/dist/components/ColorPicker.js +4 -4
- package/dist/components/ContentSlider.js +3 -3
- package/dist/components/Context.js +1 -1
- package/dist/components/Dialog.js +7 -7
- package/dist/components/Dropdown.js +7 -4
- package/dist/components/FilterItem.js +2 -2
- package/dist/components/FilterList.js +2 -2
- package/dist/components/FocusCapture.js +2 -2
- package/dist/components/HtmlEditor.js +62 -39
- package/dist/components/HybridComponent.js +1 -1
- package/dist/components/Icon.js +2 -2
- package/dist/components/Import.js +1 -1
- package/dist/components/LightComponent.js +1 -1
- package/dist/components/Main.js +3 -3
- package/dist/components/Nav.js +2 -2
- package/dist/components/NavSpacer.js +6 -0
- package/dist/components/PhotoViewer.js +3 -3
- package/dist/components/Resize.js +3 -3
- package/dist/components/ShadowComponent.js +1 -1
- package/dist/components/ShowMore.js +3 -3
- package/dist/components/Sortable.js +3 -3
- package/dist/components/Spinner.js +2 -2
- package/dist/components/Split.js +3 -3
- package/dist/components/Table.js +27 -27
- package/dist/components/Tabs.js +7 -7
- package/dist/components/Tags.js +4 -4
- package/dist/components/ThemeSelect.js +4 -4
- package/dist/components/ThemeSwitcher.js +5 -5
- package/dist/components/Timestamp.js +1 -1
- package/dist/components/Toast.js +3 -3
- package/dist/components/Toggle.js +3 -3
- package/dist/components/Tree.js +10 -10
- package/dist/components/htmlEditorControls/AlignCenter.js +4 -4
- package/dist/components/htmlEditorControls/AlignJustify.js +4 -4
- package/dist/components/htmlEditorControls/AlignLeft.js +4 -4
- package/dist/components/htmlEditorControls/AlignRight.js +4 -4
- package/dist/components/htmlEditorControls/Bold.js +4 -4
- package/dist/components/htmlEditorControls/BulletList.js +4 -4
- package/dist/components/htmlEditorControls/CharacterCount.js +3 -3
- package/dist/components/htmlEditorControls/ClearFormatting.js +4 -4
- package/dist/components/htmlEditorControls/CodeBlock.js +3 -3
- package/dist/components/htmlEditorControls/ControlGroup.js +2 -2
- package/dist/components/htmlEditorControls/ControlSpacer.js +2 -2
- package/dist/components/htmlEditorControls/CreateLink.js +3 -3
- package/dist/components/htmlEditorControls/DropdownControl.js +3 -3
- package/dist/components/htmlEditorControls/FormatBlock.js +4 -4
- package/dist/components/htmlEditorControls/HtmlEditorControl.js +2 -2
- package/dist/components/htmlEditorControls/InlineCode.js +3 -3
- package/dist/components/htmlEditorControls/InsertTable.js +3 -3
- package/dist/components/htmlEditorControls/Italic.js +4 -4
- package/dist/components/htmlEditorControls/Mode.js +3 -3
- package/dist/components/htmlEditorControls/NumberList.js +4 -4
- package/dist/components/htmlEditorControls/Strikethrough.js +4 -4
- package/dist/components/htmlEditorControls/TextBackgroundColor.js +6 -6
- package/dist/components/htmlEditorControls/TextColor.js +7 -7
- package/dist/components/htmlEditorControls/Underline.js +4 -4
- package/dist/components/htmlEditorControls/WordCount.js +3 -3
- package/dist/components/htmlEditorNodes/HtmlComment.js +24 -0
- package/dist/components/tableControls/DeleteRecord.js +2 -2
- package/dist/components/tableControls/DeleteSelected.js +2 -2
- package/dist/components/tableControls/Edit.js +4 -4
- package/dist/components/tableControls/ExportCSV.js +2 -2
- package/dist/components/tableControls/ExportJson.js +2 -2
- package/dist/components/tableControls/FieldSortHide.js +4 -4
- package/dist/components/tableControls/Filters.js +17 -17
- package/dist/components/tableControls/FirstPage.js +2 -2
- package/dist/components/tableControls/HiddenCount.js +2 -2
- package/dist/components/tableControls/Hide.js +2 -2
- package/dist/components/tableControls/LastPage.js +2 -2
- package/dist/components/tableControls/NextPage.js +2 -2
- package/dist/components/tableControls/PageSelect.js +4 -4
- package/dist/components/tableControls/PageSize.js +3 -3
- package/dist/components/tableControls/PrevPage.js +2 -2
- package/dist/components/tableControls/Search.js +2 -2
- package/dist/components/tableControls/ShowAll.js +2 -2
- package/dist/components/tableControls/TableControl.js +2 -2
- package/dist/utils/context.js +1 -1
- package/dist/utils/debounce.js +1 -1
- package/dist/utils/object.js +1 -1
- package/dist/utils/theme.js +1 -1
- package/dist/utils/wait.js +0 -1
- package/docs/components/accordion.html +2 -0
- package/docs/components/aside.html +9 -8
- package/docs/components/card.html +2 -0
- package/docs/components/color-picker.html +2 -0
- package/docs/components/content-slider.html +2 -0
- package/docs/components/context.html +2 -0
- package/docs/components/dialog.html +2 -0
- package/docs/components/dropdown.html +2 -0
- package/docs/components/filter-list.html +2 -0
- package/docs/components/focus-capture.html +2 -0
- package/docs/components/html-editor.html +54 -6
- package/docs/components/hybrid-component.html +2 -0
- package/docs/components/icon.html +2 -0
- package/docs/components/import.html +2 -0
- package/docs/components/light-component.html +2 -0
- package/docs/components/nav-spacer.html +315 -0
- package/docs/components/nav.html +2 -0
- package/docs/components/photo-viewer.html +2 -0
- package/docs/components/resize.html +2 -0
- package/docs/components/shadow-component.html +2 -0
- package/docs/components/show-more.html +2 -0
- package/docs/components/sortable.html +2 -0
- package/docs/components/spinner.html +2 -0
- package/docs/components/split.html +2 -0
- package/docs/components/table.html +2 -0
- package/docs/components/tableControls.html +2 -0
- package/docs/components/tableCustomFields.html +2 -0
- package/docs/components/tableFetchRecords.html +2 -0
- package/docs/components/tableFieldSortHide.html +2 -0
- package/docs/components/tablePagination.html +2 -0
- package/docs/components/tablePlaceholder.html +2 -0
- package/docs/components/tableRecordEditing.html +2 -0
- package/docs/components/tableRecordFiltering.html +2 -0
- package/docs/components/tableRecordHiding.html +2 -0
- package/docs/components/tableRecordSearching.html +2 -0
- package/docs/components/tableRecordSelection.html +2 -0
- package/docs/components/tableRowControls.html +2 -0
- package/docs/components/tableServerSync.html +2 -0
- package/docs/components/tableSorting.html +2 -0
- package/docs/components/tabs.html +2 -0
- package/docs/components/tags.html +2 -0
- package/docs/components/theme-select.html +2 -0
- package/docs/components/theme-switcher.html +2 -0
- package/docs/components/timestamp.html +2 -0
- package/docs/components/toast.html +2 -0
- package/docs/components/toggle.html +2 -0
- package/docs/components/tree.html +2 -0
- package/docs/icons/comment.svg +1 -0
- package/docs/index.html +8 -0
- package/docs/src/components/Accordion.js +5 -5
- package/docs/src/components/Aside.js +16 -16
- package/docs/src/components/Card.js +3 -3
- package/docs/src/components/ColorPicker.js +4 -4
- package/docs/src/components/ContentSlider.js +3 -3
- package/docs/src/components/Context.js +1 -1
- package/docs/src/components/Dialog.js +7 -7
- package/docs/src/components/Dropdown.js +7 -4
- package/docs/src/components/FilterItem.js +2 -2
- package/docs/src/components/FilterList.js +2 -2
- package/docs/src/components/FocusCapture.js +2 -2
- package/docs/src/components/HtmlEditor.js +62 -39
- package/docs/src/components/HybridComponent.js +1 -1
- package/docs/src/components/Icon.js +2 -2
- package/docs/src/components/Import.js +1 -1
- package/docs/src/components/LightComponent.js +1 -1
- package/docs/src/components/Main.js +3 -3
- package/docs/src/components/Nav.js +2 -2
- package/docs/src/components/NavSpacer.js +6 -0
- package/docs/src/components/PhotoViewer.js +3 -3
- package/docs/src/components/Resize.js +3 -3
- package/docs/src/components/ShadowComponent.js +1 -1
- package/docs/src/components/ShowMore.js +3 -3
- package/docs/src/components/Sortable.js +3 -3
- package/docs/src/components/Spinner.js +2 -2
- package/docs/src/components/Split.js +3 -3
- package/docs/src/components/Table.js +27 -27
- package/docs/src/components/Tabs.js +7 -7
- package/docs/src/components/Tags.js +4 -4
- package/docs/src/components/ThemeSelect.js +4 -4
- package/docs/src/components/ThemeSwitcher.js +5 -5
- package/docs/src/components/Timestamp.js +1 -1
- package/docs/src/components/Toast.js +3 -3
- package/docs/src/components/Toggle.js +3 -3
- package/docs/src/components/Tree.js +10 -10
- package/docs/src/components/htmlEditorControls/AlignCenter.js +4 -4
- package/docs/src/components/htmlEditorControls/AlignJustify.js +4 -4
- package/docs/src/components/htmlEditorControls/AlignLeft.js +4 -4
- package/docs/src/components/htmlEditorControls/AlignRight.js +4 -4
- package/docs/src/components/htmlEditorControls/Bold.js +4 -4
- package/docs/src/components/htmlEditorControls/BulletList.js +4 -4
- package/docs/src/components/htmlEditorControls/CharacterCount.js +3 -3
- package/docs/src/components/htmlEditorControls/ClearFormatting.js +4 -4
- package/docs/src/components/htmlEditorControls/CodeBlock.js +3 -3
- package/docs/src/components/htmlEditorControls/ControlGroup.js +2 -2
- package/docs/src/components/htmlEditorControls/ControlSpacer.js +2 -2
- package/docs/src/components/htmlEditorControls/CreateLink.js +3 -3
- package/docs/src/components/htmlEditorControls/DropdownControl.js +3 -3
- package/docs/src/components/htmlEditorControls/FormatBlock.js +4 -4
- package/docs/src/components/htmlEditorControls/HtmlEditorControl.js +2 -2
- package/docs/src/components/htmlEditorControls/InlineCode.js +3 -3
- package/docs/src/components/htmlEditorControls/InsertTable.js +3 -3
- package/docs/src/components/htmlEditorControls/Italic.js +4 -4
- package/docs/src/components/htmlEditorControls/Mode.js +3 -3
- package/docs/src/components/htmlEditorControls/NumberList.js +4 -4
- package/docs/src/components/htmlEditorControls/Strikethrough.js +4 -4
- package/docs/src/components/htmlEditorControls/TextBackgroundColor.js +6 -6
- package/docs/src/components/htmlEditorControls/TextColor.js +7 -7
- package/docs/src/components/htmlEditorControls/Underline.js +4 -4
- package/docs/src/components/htmlEditorControls/WordCount.js +3 -3
- package/docs/src/components/htmlEditorNodes/HtmlComment.js +24 -0
- package/docs/src/components/tableControls/DeleteRecord.js +2 -2
- package/docs/src/components/tableControls/DeleteSelected.js +2 -2
- package/docs/src/components/tableControls/Edit.js +4 -4
- package/docs/src/components/tableControls/ExportCSV.js +2 -2
- package/docs/src/components/tableControls/ExportJson.js +2 -2
- package/docs/src/components/tableControls/FieldSortHide.js +4 -4
- package/docs/src/components/tableControls/Filters.js +17 -17
- package/docs/src/components/tableControls/FirstPage.js +2 -2
- package/docs/src/components/tableControls/HiddenCount.js +2 -2
- package/docs/src/components/tableControls/Hide.js +2 -2
- package/docs/src/components/tableControls/LastPage.js +2 -2
- package/docs/src/components/tableControls/NextPage.js +2 -2
- package/docs/src/components/tableControls/PageSelect.js +4 -4
- package/docs/src/components/tableControls/PageSize.js +3 -3
- package/docs/src/components/tableControls/PrevPage.js +2 -2
- package/docs/src/components/tableControls/Search.js +2 -2
- package/docs/src/components/tableControls/ShowAll.js +2 -2
- package/docs/src/components/tableControls/TableControl.js +2 -2
- package/docs/src/utils/context.js +1 -1
- package/docs/src/utils/debounce.js +1 -1
- package/docs/src/utils/object.js +1 -1
- package/docs/src/utils/theme.js +1 -1
- package/docs/src/utils/wait.js +0 -1
- package/docs/utils/context.html +2 -0
- package/docs/utils/cookie.html +2 -0
- package/docs/utils/debounce.html +2 -0
- package/docs/utils/drag.html +2 -0
- package/docs/utils/elevation.html +2 -0
- package/docs/utils/formatTimestamp.html +2 -0
- package/docs/utils/object.html +2 -0
- package/docs/utils/propConverters.html +2 -0
- package/docs/utils/string.html +2 -0
- package/docs/utils/theme.html +2 -0
- package/docs/utils/toTitleCase.html +2 -0
- package/docs/utils/type.html +2 -0
- package/docs/utils/wait.html +2 -0
- package/docs-src/components/aside.page.html +7 -8
- package/docs-src/components/html-editor.page.html +52 -6
- package/docs-src/components/nav-spacer.page.html +65 -0
- package/docs-src/index.page.html +6 -0
- package/docs-src/nav.fragment.html +2 -0
- package/icons/comment.svg +1 -0
- package/llm.txt +1 -0
- package/package.json +1 -1
- package/scripts/build.js +1 -1
- package/src/components/Accordion.js +1 -1
- package/src/components/Dropdown.js +7 -3
- package/src/components/HtmlEditor.js +699 -1206
- package/src/components/NavSpacer.js +55 -0
- package/src/components/htmlEditorControls/AlignCenter.js +5 -5
- package/src/components/htmlEditorControls/AlignJustify.js +5 -5
- package/src/components/htmlEditorControls/AlignLeft.js +5 -5
- package/src/components/htmlEditorControls/AlignRight.js +5 -5
- package/src/components/htmlEditorControls/Bold.js +5 -5
- package/src/components/htmlEditorControls/BulletList.js +5 -5
- package/src/components/htmlEditorControls/ClearFormatting.js +5 -5
- package/src/components/htmlEditorControls/CodeBlock.js +16 -8
- package/src/components/htmlEditorControls/CreateLink.js +3 -7
- package/src/components/htmlEditorControls/FormatBlock.js +5 -5
- package/src/components/htmlEditorControls/InlineCode.js +1 -13
- package/src/components/htmlEditorControls/InsertTable.js +43 -44
- package/src/components/htmlEditorControls/Italic.js +5 -5
- package/src/components/htmlEditorControls/Mode.js +1 -1
- package/src/components/htmlEditorControls/NumberList.js +5 -5
- package/src/components/htmlEditorControls/Strikethrough.js +5 -5
- package/src/components/htmlEditorControls/Underline.js +5 -5
- package/src/components/htmlEditorNodes/HtmlComment.js +118 -0
- package/tests/components/Accordion.browser-test.js +154 -0
- package/tests/components/Dropdown.browser-test.js +85 -0
- package/tests/components/HtmlComment.browser-test.js +115 -0
- package/tests/components/HtmlEditor.browser-test.js +379 -0
- package/tests/components/NavSpacer.browser-test.js +81 -0
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -254,6 +256,8 @@
|
|
|
254
256
|
<h6>Examples</h6>
|
|
255
257
|
<a href="#fullExample">Complete Editor Example</a><br />
|
|
256
258
|
<a href="#javascriptUsage">JavaScript API Example</a><br />
|
|
259
|
+
<a href="#incompatibleContent">Incompatible Content Example</a><br />
|
|
260
|
+
<a href="#customNodes">Custom Nodes Example</a><br />
|
|
257
261
|
|
|
258
262
|
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
259
263
|
<a href="#constructor">Constructor</a><br />
|
|
@@ -427,9 +431,9 @@
|
|
|
427
431
|
<k-html-editor id="myEditor" class="b r"></k-html-editor>
|
|
428
432
|
<script>
|
|
429
433
|
const myEditor = document.getElementById('myEditor');
|
|
430
|
-
|
|
434
|
+
myEditor.addEventListener('ready', () => {
|
|
431
435
|
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>');
|
|
432
|
-
}
|
|
436
|
+
});
|
|
433
437
|
|
|
434
438
|
function insertMyEditorHTML() {
|
|
435
439
|
myEditor.insertHTML('<p><b>Inserted content!</b></p>');
|
|
@@ -443,6 +447,43 @@
|
|
|
443
447
|
</div>
|
|
444
448
|
</div>
|
|
445
449
|
|
|
450
|
+
<h3 id="incompatibleContent"><a href="#incompatibleContent" class="no-link">Incompatible Content Example</a></h3>
|
|
451
|
+
<p>When the editor's value contains HTML that Lexical does not support (such as <code><svg></code>, <code><script></code>, <code><style></code>, <code><video></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>
|
|
452
|
+
<div class="row -mx">
|
|
453
|
+
<div class="col m-span-12 px">
|
|
454
|
+
<k-card label="HTML">
|
|
455
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"svgEditor"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"<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>"</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-spacer</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></span></code></pre>
|
|
456
|
+
</k-card>
|
|
457
|
+
</div>
|
|
458
|
+
<div class="col m-span-12 px">
|
|
459
|
+
<k-card label="Output">
|
|
460
|
+
<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>">
|
|
461
|
+
<k-hec-spacer slot="toolbar-top"></k-hec-spacer>
|
|
462
|
+
<k-hec-mode slot="toolbar-top"></k-hec-mode>
|
|
463
|
+
</k-html-editor>
|
|
464
|
+
</k-card>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
|
|
468
|
+
<h3 id="customNodes"><a href="#customNodes" class="no-link">Custom Nodes Example</a></h3>
|
|
469
|
+
<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>
|
|
470
|
+
<div class="row -mx">
|
|
471
|
+
<div class="col m-span-12 px">
|
|
472
|
+
<k-card label="HTML">
|
|
473
|
+
<pre><code class="hljs xml"><span class="hljs-comment"><!-- Import the HtmlComment node --></span><br><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">'module'</span> <span class="hljs-attr">src</span>=<span class="hljs-string">'src/components/htmlEditorNodes/HtmlComment.js'</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span><br><span class="hljs-comment"><!-- Register the node with nodes attribute --></span><br><span class="hljs-tag"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">nodes</span>=<span class="hljs-string">'HtmlComment'</span> <span class="hljs-attr">value</span>=<span class="hljs-string">'<p>This paragraph has an <!-- important note --> inline comment.</p>'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-spacer</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></span></code></pre>
|
|
474
|
+
</k-card>
|
|
475
|
+
</div>
|
|
476
|
+
<div class="col m-span-12 px">
|
|
477
|
+
<k-card label="Output">
|
|
478
|
+
<script type="module" src="/src/components/htmlEditorNodes/HtmlComment.js"></script>
|
|
479
|
+
<k-html-editor id="commentEditor" class="b r" nodes="HtmlComment" value="<p>This paragraph has an <!-- important note --> inline comment.</p>">
|
|
480
|
+
<k-hec-spacer slot="toolbar-top"></k-hec-spacer>
|
|
481
|
+
<k-hec-mode slot="toolbar-top"></k-hec-mode>
|
|
482
|
+
</k-html-editor>
|
|
483
|
+
</k-card>
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
|
|
446
487
|
<h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
447
488
|
|
|
448
489
|
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
@@ -458,23 +499,30 @@
|
|
|
458
499
|
<p>The HTML content of the editor. Can be get or set via JavaScript or HTML attribute.</p>
|
|
459
500
|
|
|
460
501
|
<h5><code>mode<i>: String</i></code></h5>
|
|
461
|
-
<p>Current editing mode. Either <code>'visual'</code> (WYSIWYG) or <code>'code'</code> (raw HTML). Default: <code>'visual'</code
|
|
502
|
+
<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><svg></code>, <code><script></code>, <code><style></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>
|
|
503
|
+
|
|
504
|
+
<h5><code>nodes<i>: String</i></code></h5>
|
|
505
|
+
<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>
|
|
506
|
+
<ul>
|
|
507
|
+
<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>
|
|
508
|
+
<li><code>preprocessHtml(htmlString)</code> — transforms raw HTML before Lexical parses it (e.g., converting <code><!-- --></code> to a parseable <code><span></code>)</li>
|
|
509
|
+
</ul>
|
|
462
510
|
|
|
463
511
|
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
464
512
|
|
|
465
513
|
<h4>Mode Control</h4>
|
|
466
514
|
<h5><code>setMode(mode)<i>: this</i></code></h5>
|
|
467
|
-
<p>Set the editing mode. Accepts <code>'visual'</code> or <code>'code'</code
|
|
515
|
+
<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>
|
|
468
516
|
|
|
469
517
|
<h5><code>toggleMode()<i>: this</i></code></h5>
|
|
470
|
-
<p>Toggle between visual and code modes.</p>
|
|
518
|
+
<p>Toggle between visual and code modes. Same incompatibility warning applies when switching to visual mode.</p>
|
|
471
519
|
|
|
472
520
|
<h4>Content Management</h4>
|
|
473
521
|
<h5><code>getValue()<i>: String</i></code></h5>
|
|
474
522
|
<p>Returns the current HTML content.</p>
|
|
475
523
|
|
|
476
524
|
<h5><code>setValue(html)<i>: this</i></code></h5>
|
|
477
|
-
<p>Sets the HTML content of the editor.</p>
|
|
525
|
+
<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>
|
|
478
526
|
|
|
479
527
|
<h5><code>clear()<i>: this</i></code></h5>
|
|
480
528
|
<p>Clears all content from the editor.</p>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Nav Spacer - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
|
+
<link rel="icon" type="image/png" sizes="48x48" href="../media/icon48.png">
|
|
8
|
+
<link rel="manifest" href="../manifest.json" />
|
|
9
|
+
<link rel="stylesheet" href="../kempo-vars.css" />
|
|
10
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@2/dist/kempo.min.css" />
|
|
11
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
12
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
13
|
+
<script>window.litDisableBundleWarning = true;</script>
|
|
14
|
+
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<k-nav fixed class="bg-primary">
|
|
19
|
+
<button id="toggleNavSideMenu" class="link">
|
|
20
|
+
<k-icon name="menu"></k-icon>
|
|
21
|
+
</button>
|
|
22
|
+
<a href="../" class="d-if ph" style="align-items: center">
|
|
23
|
+
<img src="../media/icon32.png" alt="Kempo UI Icon" class="pr" />
|
|
24
|
+
Kempo UI
|
|
25
|
+
</a>
|
|
26
|
+
<div style="position:relative;margin:0 .25rem;align-self:center;" theme="light">
|
|
27
|
+
<input id="navSearchInput" type="search" placeholder="Search docs..." autocomplete="off" style="width:11rem;" />
|
|
28
|
+
<div id="navSearchDropdown" hidden theme="light" style="position:absolute;top:calc(100% + 4px);left:0;width:min(480px,90vw);max-height:70vh;background:var(--c_bg);border:1px solid var(--c_border);border-radius:var(--radius);overflow:auto;z-index:9999;box-shadow:0 4px 12px rgba(0,0,0,.3);">
|
|
29
|
+
<k-filter-list id="navSearchList" style="display:block;padding:.25rem 0;">
|
|
30
|
+
<k-filter-item filter-keywords="accordion components"><a href="../components/accordion.html">Accordion<br><small>Component</small></a></k-filter-item>
|
|
31
|
+
<k-filter-item filter-keywords="aside sidebar components"><a href="../components/aside.html">Aside<br><small>Component</small></a></k-filter-item>
|
|
32
|
+
<k-filter-item filter-keywords="card components"><a href="../components/card.html">Card<br><small>Component</small></a></k-filter-item>
|
|
33
|
+
<k-filter-item filter-keywords="color picker colorpicker components"><a href="../components/color-picker.html">Color Picker<br><small>Component</small></a></k-filter-item>
|
|
34
|
+
<k-filter-item filter-keywords="content slider components"><a href="../components/content-slider.html">Content Slider<br><small>Component</small></a></k-filter-item>
|
|
35
|
+
<k-filter-item filter-keywords="context state global components"><a href="../components/context.html">Context<br><small>Component</small></a></k-filter-item>
|
|
36
|
+
<k-filter-item filter-keywords="dialog modal popup components"><a href="../components/dialog.html">Dialog<br><small>Component</small></a></k-filter-item>
|
|
37
|
+
<k-filter-item filter-keywords="dropdown select components"><a href="../components/dropdown.html">Dropdown<br><small>Component</small></a></k-filter-item>
|
|
38
|
+
<k-filter-item filter-keywords="filter list filterlist components"><a href="../components/filter-list.html">Filter List<br><small>Component</small></a></k-filter-item>
|
|
39
|
+
<k-filter-item filter-keywords="focus capture focuscapture components"><a href="../components/focus-capture.html">Focus Capture<br><small>Component</small></a></k-filter-item>
|
|
40
|
+
<k-filter-item filter-keywords="html editor components"><a href="../components/html-editor.html">HTML Editor<br><small>Component</small></a></k-filter-item>
|
|
41
|
+
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
|
+
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
|
+
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
45
|
+
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
46
|
+
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
47
|
+
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
48
|
+
<k-filter-item filter-keywords="sortable drag drop sort components"><a href="../components/sortable.html">Sortable<br><small>Component</small></a></k-filter-item>
|
|
49
|
+
<k-filter-item filter-keywords="spinner loading components"><a href="../components/spinner.html">Spinner<br><small>Component</small></a></k-filter-item>
|
|
50
|
+
<k-filter-item filter-keywords="split pane components"><a href="../components/split.html">Split<br><small>Component</small></a></k-filter-item>
|
|
51
|
+
<k-filter-item filter-keywords="table data grid components"><a href="../components/table.html">Table<br><small>Component</small></a></k-filter-item>
|
|
52
|
+
<k-filter-item filter-keywords="table controls advanced example"><a href="../components/tableControls.html">Table — Controls<br><small>Advanced Example</small></a></k-filter-item>
|
|
53
|
+
<k-filter-item filter-keywords="table custom fields advanced example"><a href="../components/tableCustomFields.html">Table — Custom Fields<br><small>Advanced Example</small></a></k-filter-item>
|
|
54
|
+
<k-filter-item filter-keywords="table fetch records advanced example"><a href="../components/tableFetchRecords.html">Table — Fetch Records<br><small>Advanced Example</small></a></k-filter-item>
|
|
55
|
+
<k-filter-item filter-keywords="table field sort hide advanced example"><a href="../components/tableFieldSortHide.html">Table — Field Sort & Hide<br><small>Advanced Example</small></a></k-filter-item>
|
|
56
|
+
<k-filter-item filter-keywords="table pagination advanced example"><a href="../components/tablePagination.html">Table — Pagination<br><small>Advanced Example</small></a></k-filter-item>
|
|
57
|
+
<k-filter-item filter-keywords="table record editing advanced example"><a href="../components/tableRecordEditing.html">Table — Record Editing<br><small>Advanced Example</small></a></k-filter-item>
|
|
58
|
+
<k-filter-item filter-keywords="table record filtering advanced example"><a href="../components/tableRecordFiltering.html">Table — Record Filtering<br><small>Advanced Example</small></a></k-filter-item>
|
|
59
|
+
<k-filter-item filter-keywords="table record hiding advanced example"><a href="../components/tableRecordHiding.html">Table — Record Hiding<br><small>Advanced Example</small></a></k-filter-item>
|
|
60
|
+
<k-filter-item filter-keywords="table record searching advanced example"><a href="../components/tableRecordSearching.html">Table — Record Searching<br><small>Advanced Example</small></a></k-filter-item>
|
|
61
|
+
<k-filter-item filter-keywords="table record selection advanced example"><a href="../components/tableRecordSelection.html">Table — Record Selection<br><small>Advanced Example</small></a></k-filter-item>
|
|
62
|
+
<k-filter-item filter-keywords="table row controls advanced example"><a href="../components/tableRowControls.html">Table — Row Controls<br><small>Advanced Example</small></a></k-filter-item>
|
|
63
|
+
<k-filter-item filter-keywords="table server sync advanced example"><a href="../components/tableServerSync.html">Table — Server Sync<br><small>Advanced Example</small></a></k-filter-item>
|
|
64
|
+
<k-filter-item filter-keywords="table sorting advanced example"><a href="../components/tableSorting.html">Table — Sorting<br><small>Advanced Example</small></a></k-filter-item>
|
|
65
|
+
<k-filter-item filter-keywords="table placeholder advanced example"><a href="../components/tablePlaceholder.html">Table — Placeholder<br><small>Advanced Example</small></a></k-filter-item>
|
|
66
|
+
<k-filter-item filter-keywords="tabs tab panel components"><a href="../components/tabs.html">Tabs<br><small>Component</small></a></k-filter-item>
|
|
67
|
+
<k-filter-item filter-keywords="tags tag input components"><a href="../components/tags.html">Tags<br><small>Component</small></a></k-filter-item>
|
|
68
|
+
<k-filter-item filter-keywords="theme select dropdown dark light components"><a href="../components/theme-select.html">Theme Select<br><small>Component</small></a></k-filter-item>
|
|
69
|
+
<k-filter-item filter-keywords="theme switcher dark light components"><a href="../components/theme-switcher.html">Theme Switcher<br><small>Component</small></a></k-filter-item>
|
|
70
|
+
<k-filter-item filter-keywords="timestamp date time components"><a href="../components/timestamp.html">Timestamp<br><small>Component</small></a></k-filter-item>
|
|
71
|
+
<k-filter-item filter-keywords="toast notification alert components"><a href="../components/toast.html">Toast<br><small>Component</small></a></k-filter-item>
|
|
72
|
+
<k-filter-item filter-keywords="toggle switch checkbox components"><a href="../components/toggle.html">Toggle<br><small>Component</small></a></k-filter-item>
|
|
73
|
+
<k-filter-item filter-keywords="tree treeview components"><a href="../components/tree.html">Tree<br><small>Component</small></a></k-filter-item>
|
|
74
|
+
<k-filter-item filter-keywords="shadow component base"><a href="../components/shadow-component.html">Shadow Component<br><small>Base Component</small></a></k-filter-item>
|
|
75
|
+
<k-filter-item filter-keywords="light component base"><a href="../components/light-component.html">Light Component<br><small>Base Component</small></a></k-filter-item>
|
|
76
|
+
<k-filter-item filter-keywords="hybrid component base"><a href="../components/hybrid-component.html">Hybrid Component<br><small>Base Component</small></a></k-filter-item>
|
|
77
|
+
<k-filter-item filter-keywords="cookie utils utility"><a href="../utils/cookie.html">cookie<br><small>Utility</small></a></k-filter-item>
|
|
78
|
+
<k-filter-item filter-keywords="context utils utility"><a href="../utils/context.html">context<br><small>Utility</small></a></k-filter-item>
|
|
79
|
+
<k-filter-item filter-keywords="debounce utils utility"><a href="../utils/debounce.html">debounce<br><small>Utility</small></a></k-filter-item>
|
|
80
|
+
<k-filter-item filter-keywords="drag utils utility"><a href="../utils/drag.html">drag<br><small>Utility</small></a></k-filter-item>
|
|
81
|
+
<k-filter-item filter-keywords="elevation z-index stacking utils"><a href="../utils/elevation.html">elevation<br><small>Utility</small></a></k-filter-item>
|
|
82
|
+
<k-filter-item filter-keywords="formattimestamp timestamp format date time utils utility"><a href="../utils/formatTimestamp.html">formatTimestamp<br><small>Utility</small></a></k-filter-item>
|
|
83
|
+
<k-filter-item filter-keywords="object utils utility"><a href="../utils/object.html">object<br><small>Utility</small></a></k-filter-item>
|
|
84
|
+
<k-filter-item filter-keywords="propconverters prop converters utils utility"><a href="../utils/propConverters.html">propConverters<br><small>Utility</small></a></k-filter-item>
|
|
85
|
+
<k-filter-item filter-keywords="string utils utility"><a href="../utils/string.html">string<br><small>Utility</small></a></k-filter-item>
|
|
86
|
+
<k-filter-item filter-keywords="theme utils utility"><a href="../utils/theme.html">theme<br><small>Utility</small></a></k-filter-item>
|
|
87
|
+
<k-filter-item filter-keywords="type utils utility"><a href="../utils/type.html">type<br><small>Utility</small></a></k-filter-item>
|
|
88
|
+
<k-filter-item filter-keywords="wait async utils utility"><a href="../utils/wait.html">wait<br><small>Utility</small></a></k-filter-item>
|
|
89
|
+
</k-filter-list>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="flex"></div>
|
|
93
|
+
<a href="https://github.com/dustinpoissant/kempo-ui?tab=License-1-ov-file#creative-commons-attribution-noncommercial-sharealike-20" target="_blank"><k-icon name="license"></k-icon></a>
|
|
94
|
+
<a href="https://www.npmjs.com/package/kempo-ui" target="_blank"><k-icon name="npm"></k-icon></a>
|
|
95
|
+
<a href="https://github.com/dustinpoissant/kempo-ui" target="_blank"><k-icon name="github-mark"></k-icon></a>
|
|
96
|
+
<k-theme-switcher></k-theme-switcher>
|
|
97
|
+
</k-nav>
|
|
98
|
+
<div style="width: 100%; height: 4rem;"></div>
|
|
99
|
+
<k-aside id="navSideMenu" main="overlay" state="offscreen">
|
|
100
|
+
<menu>
|
|
101
|
+
<a href="../" class="ta-center bb mb r0">
|
|
102
|
+
<h1 class="tc-primary">Kempo UI</h1>
|
|
103
|
+
<img src="../media/icon128.png" alt="Kempo UI Icon" />
|
|
104
|
+
</a>
|
|
105
|
+
|
|
106
|
+
<div class="pl mb">
|
|
107
|
+
<h3>Components</h3>
|
|
108
|
+
<a href="../components/accordion.html">Accordion</a>
|
|
109
|
+
<a href="../components/aside.html">Aside</a>
|
|
110
|
+
<a href="../components/card.html">Card</a>
|
|
111
|
+
<a href="../components/color-picker.html">ColorPicker</a>
|
|
112
|
+
<a href="../components/content-slider.html">Content Slider</a>
|
|
113
|
+
<a href="../components/context.html">Context</a>
|
|
114
|
+
<a href="../components/dialog.html">Dialog</a>
|
|
115
|
+
<a href="../components/dropdown.html">Dropdown</a>
|
|
116
|
+
<a href="../components/filter-list.html">Filter List</a>
|
|
117
|
+
<a href="../components/focus-capture.html">FocusCapture</a>
|
|
118
|
+
<a href="../components/html-editor.html">HTML Editor</a>
|
|
119
|
+
<a href="../components/icon.html">Icon</a>
|
|
120
|
+
<a href="../components/import.html">Import</a>
|
|
121
|
+
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
123
|
+
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
124
|
+
<a href="../components/resize.html">Resize</a>
|
|
125
|
+
<a href="../components/show-more.html">Show More</a>
|
|
126
|
+
<a href="../components/sortable.html">Sortable</a>
|
|
127
|
+
<a href="../components/spinner.html">Spinner</a>
|
|
128
|
+
<a href="../components/split.html">Split</a>
|
|
129
|
+
<a href="../components/table.html">Table</a>
|
|
130
|
+
<a href="../components/tabs.html">Tabs</a>
|
|
131
|
+
<a href="../components/tags.html">Tags</a>
|
|
132
|
+
<a href="../components/theme-select.html">Theme Select</a>
|
|
133
|
+
<a href="../components/theme-switcher.html">Theme Switcher</a>
|
|
134
|
+
<a href="../components/timestamp.html">Timestamp</a>
|
|
135
|
+
<a href="../components/toast.html">Toast</a>
|
|
136
|
+
<a href="../components/toggle.html">Toggle</a>
|
|
137
|
+
<a href="../components/tree.html">Tree</a>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<h5 class="mb0">Base Components</h5>
|
|
141
|
+
<div class="pl mb">
|
|
142
|
+
<a href="../components/shadow-component.html">Shadow Component</a>
|
|
143
|
+
<a href="../components/light-component.html">Light Component</a>
|
|
144
|
+
<a href="../components/hybrid-component.html">Hybrid Component</a>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<h5 class="mb0">Utils</h5>
|
|
148
|
+
<div class="pl mb">
|
|
149
|
+
<a href="../utils/cookie.html">cookie</a>
|
|
150
|
+
<a href="../utils/context.html">context</a>
|
|
151
|
+
<a href="../utils/debounce.html">debounce</a>
|
|
152
|
+
<a href="../utils/drag.html">drag</a>
|
|
153
|
+
<a href="../utils/elevation.html">elevation</a>
|
|
154
|
+
<a href="../utils/formatTimestamp.html">formatTimestamp</a>
|
|
155
|
+
<a href="../utils/object.html">object</a>
|
|
156
|
+
<a href="../utils/propConverters.html">propConverters</a>
|
|
157
|
+
<a href="../utils/string.html">string</a>
|
|
158
|
+
<a href="../utils/theme.html">theme</a>
|
|
159
|
+
<a href="../utils/type.html">type</a>
|
|
160
|
+
<a href="../utils/wait.html">wait</a>
|
|
161
|
+
</div>
|
|
162
|
+
</menu>
|
|
163
|
+
</k-aside>
|
|
164
|
+
<style>
|
|
165
|
+
#navSearchList a{display:block;padding:.25rem .5rem;border-radius:var(--radius);text-decoration:none;color:var(--tc);}
|
|
166
|
+
#navSearchList a:hover{background:rgba(128,128,128,.15);}
|
|
167
|
+
#navSearchList a small{display:block;color:var(--tc_muted);}
|
|
168
|
+
</style>
|
|
169
|
+
<script src="../src/components/Nav.js" type="module"></script>
|
|
170
|
+
<script src="../src/components/FilterList.js" type="module"></script>
|
|
171
|
+
<script src="../src/components/FilterItem.js" type="module"></script>
|
|
172
|
+
<script src="../src/components/Aside.js" type="module"></script>
|
|
173
|
+
<script src="../src/components/Icon.js" type="module"></script>
|
|
174
|
+
<script src="../src/components/ThemeSwitcher.js" type="module"></script>
|
|
175
|
+
<script type="module">
|
|
176
|
+
import debounce from '../src/utils/debounce.js';
|
|
177
|
+
|
|
178
|
+
document.getElementById('toggleNavSideMenu').addEventListener('click', async () => {
|
|
179
|
+
await window.customElements.whenDefined('k-aside');
|
|
180
|
+
document.getElementById('navSideMenu').toggle();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
document.addEventListener('click', function(e) {
|
|
184
|
+
if(e.target.matches('a[href^="#"]')) {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
const targetId = e.target.getAttribute('href').replace('#', '');
|
|
187
|
+
const target = document.getElementById(targetId);
|
|
188
|
+
if(target) {
|
|
189
|
+
target.scrollIntoView({ behavior: 'smooth' });
|
|
190
|
+
const url = window.location.pathname + window.location.search + '#' + targetId;
|
|
191
|
+
history.replaceState(null, '', url);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
/*
|
|
197
|
+
Nav Search
|
|
198
|
+
*/
|
|
199
|
+
const searchInput = document.getElementById('navSearchInput');
|
|
200
|
+
const searchDropdown = document.getElementById('navSearchDropdown');
|
|
201
|
+
let navSearchList = null;
|
|
202
|
+
|
|
203
|
+
const openSearch = async () => {
|
|
204
|
+
await customElements.whenDefined('k-filter-list');
|
|
205
|
+
if(!navSearchList) navSearchList = document.getElementById('navSearchList');
|
|
206
|
+
navSearchList.filter(searchInput.value);
|
|
207
|
+
searchDropdown.hidden = false;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const closeSearch = () => {
|
|
211
|
+
searchDropdown.hidden = true;
|
|
212
|
+
navSearchList?.clearFocus();
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
searchInput.addEventListener('focus', openSearch);
|
|
216
|
+
|
|
217
|
+
searchInput.addEventListener('input', debounce(e => {
|
|
218
|
+
navSearchList?.filter(e.target.value);
|
|
219
|
+
}, 150));
|
|
220
|
+
|
|
221
|
+
searchInput.addEventListener('keydown', e => {
|
|
222
|
+
if(e.key === 'Escape') {
|
|
223
|
+
searchInput.value = '';
|
|
224
|
+
searchInput.blur();
|
|
225
|
+
closeSearch();
|
|
226
|
+
} else if(e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter') {
|
|
227
|
+
navSearchList?.handleKeydown(e);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
searchInput.addEventListener('blur', () => {
|
|
232
|
+
setTimeout(closeSearch, 150);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
document.addEventListener('keydown', e => {
|
|
236
|
+
let active = document.activeElement;
|
|
237
|
+
while(active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
238
|
+
const tag = active?.tagName;
|
|
239
|
+
if(tag === 'INPUT' || tag === 'TEXTAREA' || active?.isContentEditable) return;
|
|
240
|
+
if(e.metaKey || e.ctrlKey || e.altKey) return;
|
|
241
|
+
if(e.key.length === 1) {
|
|
242
|
+
searchInput.focus();
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
</script>
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<k-main>
|
|
249
|
+
|
|
250
|
+
<h1 class="ta-center">Nav Spacer</h1>
|
|
251
|
+
|
|
252
|
+
<k-accordion persistent-id="toc-nav-spacer" class="b r mb">
|
|
253
|
+
<k-accordion-header for-panel="toc-nav-spacer-panel">Table of Contents</k-accordion-header>
|
|
254
|
+
<k-accordion-panel name="toc-nav-spacer-panel">
|
|
255
|
+
<div class="m">
|
|
256
|
+
<h6>Examples</h6>
|
|
257
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
258
|
+
<a href="#noMargin">No Margin</a><br />
|
|
259
|
+
|
|
260
|
+
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
261
|
+
<a href="#constructor">Constructor</a><br />
|
|
262
|
+
<a href="#requirements">Requirements</a><br />
|
|
263
|
+
<a href="#cssVariables">CSS Variables</a><br />
|
|
264
|
+
</div>
|
|
265
|
+
</k-accordion-panel>
|
|
266
|
+
</k-accordion>
|
|
267
|
+
|
|
268
|
+
<p>Place <code>k-nav-spacer</code> immediately after a <code><k-nav fixed></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>
|
|
269
|
+
|
|
270
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
271
|
+
<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>
|
|
272
|
+
<div class="row -mx">
|
|
273
|
+
<div class="col m-span-12 px">
|
|
274
|
+
<k-card label="HTML">
|
|
275
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-nav</span> <span class="hljs-attr">fixed</span>></span><br> <span class="hljs-comment"><!-- nav content --></span><br><span class="hljs-tag"></<span class="hljs-name">k-nav</span>></span><br><span class="hljs-tag"><<span class="hljs-name">k-nav-spacer</span>></span><span class="hljs-tag"></<span class="hljs-name">k-nav-spacer</span>></span><br><span class="hljs-tag"><<span class="hljs-name">main</span>></span><br> <span class="hljs-comment"><!-- page content --></span><br><span class="hljs-tag"></<span class="hljs-name">main</span>></span></code></pre>
|
|
276
|
+
</k-card>
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<h3 id="noMargin"><a href="#noMargin" class="no-link">No Margin</a></h3>
|
|
281
|
+
<p>Add <code>mb0</code> to remove the default bottom margin, or use any kempo-css margin utility to customise it.</p>
|
|
282
|
+
<div class="row -mx">
|
|
283
|
+
<div class="col m-span-12 px">
|
|
284
|
+
<k-card label="HTML">
|
|
285
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-nav-spacer</span> <span class="hljs-attr">class</span>=<span class="hljs-string">'mb0'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-nav-spacer</span>></span></code></pre>
|
|
286
|
+
</k-card>
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
<h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
291
|
+
|
|
292
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
293
|
+
<h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
|
|
294
|
+
<h5><code>new NavSpacer()</code></h5>
|
|
295
|
+
|
|
296
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
297
|
+
<ul>
|
|
298
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
299
|
+
</ul>
|
|
300
|
+
|
|
301
|
+
<h3 id="cssVariables"><a href="#cssVariables" class="no-link">CSS Variables</a></h3>
|
|
302
|
+
<h5><code>--spacer</code></h5>
|
|
303
|
+
<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>
|
|
304
|
+
|
|
305
|
+
</k-main>
|
|
306
|
+
<div style="height:33vh"></div>
|
|
307
|
+
<script type="module" src="../src/components/Main.js"></script>
|
|
308
|
+
|
|
309
|
+
<script type="module" src="../src/components/NavSpacer.js"></script>
|
|
310
|
+
<script type="module" src="../src/components/Nav.js"></script>
|
|
311
|
+
<script type="module" src="../src/components/Accordion.js"></script>
|
|
312
|
+
<script type="module" src="../src/components/Card.js"></script>
|
|
313
|
+
|
|
314
|
+
</body>
|
|
315
|
+
</html>
|
package/docs/components/nav.html
CHANGED
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
<k-filter-item filter-keywords="icon components"><a href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
42
42
|
<k-filter-item filter-keywords="import components"><a href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
43
43
|
<k-filter-item filter-keywords="nav navbar navigation components"><a href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
44
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a href="../components/nav-spacer.html">Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
44
45
|
<k-filter-item filter-keywords="photo viewer photoviewer components"><a href="../components/photo-viewer.html">Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
45
46
|
<k-filter-item filter-keywords="resize components"><a href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
46
47
|
<k-filter-item filter-keywords="show more showmore components"><a href="../components/show-more.html">Show More<br><small>Component</small></a></k-filter-item>
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
<a href="../components/icon.html">Icon</a>
|
|
119
120
|
<a href="../components/import.html">Import</a>
|
|
120
121
|
<a href="../components/nav.html">Nav</a>
|
|
122
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
121
123
|
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
122
124
|
<a href="../components/resize.html">Resize</a>
|
|
123
125
|
<a href="../components/show-more.html">Show More</a>
|