kempo-ui 0.0.3 → 0.0.5
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/.github/workflows/publish-major.yml +39 -0
- package/.github/workflows/publish-minor.yml +39 -0
- package/.github/workflows/{publish-npm.yml → publish-patch.yml} +1 -1
- package/.vscode/settings.json +2 -0
- package/dist/kempo-hljs.css +1 -0
- package/dist/src/components/Accordion.js +36 -0
- package/dist/src/components/Card.js +37 -0
- package/dist/src/components/Collapsible.js +41 -0
- package/dist/src/components/ContentSlider.js +44 -0
- package/dist/src/components/Dialog.js +120 -0
- package/dist/src/components/Icon.js +2 -2
- package/dist/src/components/PersistantCollapsible.js +1 -0
- package/dist/src/components/PhotoViewer.js +135 -0
- package/dist/src/components/Resize.js +96 -0
- package/dist/src/components/ShadowComponent.js +1 -1
- package/dist/src/components/ShowMore.js +42 -0
- package/dist/src/components/SideMenu.js +1 -1
- package/dist/src/components/Sortable.js +45 -0
- package/dist/src/components/Split.js +84 -0
- package/dist/src/components/Table.js +151 -0
- package/dist/src/components/Tabs.js +155 -0
- package/dist/src/components/Tags.js +69 -0
- package/dist/src/components/ThemeSwitcher.js +23 -0
- package/dist/src/components/Timestamp.js +1 -0
- package/dist/src/components/Toast.js +141 -0
- package/dist/src/components/Toggle.js +74 -0
- package/dist/src/components/tableControls/DeleteRecord.js +7 -0
- package/dist/src/components/tableControls/Edit.js +18 -0
- package/dist/src/components/tableControls/ExportCSV.js +8 -0
- package/dist/src/components/tableControls/ExportJson.js +8 -0
- package/dist/src/components/tableControls/FieldSortHide.js +26 -0
- package/dist/src/components/tableControls/Filters.js +47 -0
- package/dist/src/components/tableControls/FirstPage.js +9 -0
- package/dist/src/components/tableControls/HiddenCount.js +3 -0
- package/dist/src/components/tableControls/Hide.js +5 -0
- package/dist/src/components/tableControls/LastPage.js +9 -0
- package/dist/src/components/tableControls/NextPage.js +9 -0
- package/dist/src/components/tableControls/PageSelect.js +22 -0
- package/dist/src/components/tableControls/PageSize.js +5 -0
- package/dist/src/components/tableControls/PrevPage.js +9 -0
- package/dist/src/components/tableControls/Search.js +9 -0
- package/dist/src/components/tableControls/ShowAll.js +5 -0
- package/dist/src/components/tableControls/TableControl.js +16 -0
- package/dist/src/utils/debounce.js +1 -0
- package/dist/src/utils/drag.js +1 -0
- package/dist/src/utils/formatTimestamp.js +1 -0
- package/dist/src/utils/propConverters.js +1 -0
- package/dist/src/utils/toTitleCase.js +1 -0
- package/dist/src/utils/watchWindowSize.js +1 -0
- package/docs/components/accordion.html +69 -25
- package/docs/components/card.html +6 -5
- package/docs/components/collapsible.html +198 -0
- package/docs/components/content-slider.html +56 -26
- package/docs/components/dialog.html +54 -48
- package/docs/components/focus-capture.html +59 -15
- package/docs/components/hybrid-component.html +112 -0
- package/docs/components/icon.html +5 -10
- package/docs/components/import.html +1 -6
- package/docs/components/light-component.html +99 -0
- package/docs/components/persistant-collapsible.html +123 -0
- package/docs/components/photo-viewer.html +226 -0
- package/docs/components/resize.html +44 -18
- package/docs/components/shadow-component.html +88 -0
- package/docs/components/show-more.html +12 -6
- package/docs/components/side-menu.html +3 -12
- package/docs/components/sortable.html +91 -55
- package/docs/components/split.html +26 -5
- package/docs/components/tablePagination.html +4 -4
- package/docs/components/tableRecordFiltering.html +16 -3
- package/docs/components/tableRecordSelection.html +2 -2
- package/docs/components/tabs.html +24 -7
- package/docs/components/tags.html +24 -8
- package/docs/components/theme-switcher.html +3 -6
- package/docs/components/timestamp.html +20 -24
- package/docs/components/toast.html +23 -32
- package/docs/components/toggle.html +4 -3
- package/docs/icons/error.svg +1 -1
- package/docs/icons/warning.svg +1 -1
- package/docs/index.html +197 -5
- package/docs/kempo-hljs.css +1 -0
- package/docs/kempo.min.css +1 -1
- package/docs/media/civic.jpg +0 -0
- package/docs/media/corvette.jpg +0 -0
- package/docs/media/evo.jpg +0 -0
- package/docs/media/gtr.jpg +0 -0
- package/docs/media/nsx.jpg +0 -0
- package/docs/nav.inc.html +19 -24
- package/docs/src/components/Accordion.js +36 -0
- package/docs/src/components/Card.js +37 -0
- package/docs/src/components/Collapsible.js +41 -0
- package/docs/src/components/ContentSlider.js +44 -0
- package/docs/src/components/Dialog.js +120 -0
- package/docs/src/components/Icon.js +2 -2
- package/docs/src/components/PersistantCollapsible.js +1 -0
- package/docs/src/components/PhotoViewer.js +135 -0
- package/docs/src/components/Resize.js +96 -0
- package/docs/src/components/ShadowComponent.js +1 -1
- package/docs/src/components/ShowMore.js +42 -0
- package/docs/src/components/SideMenu.js +1 -1
- package/docs/src/components/Sortable.js +45 -0
- package/docs/src/components/Split.js +84 -0
- package/docs/src/components/Table.js +151 -0
- package/docs/src/components/Tabs.js +155 -0
- package/docs/src/components/Tags.js +69 -0
- package/docs/src/components/ThemeSwitcher.js +23 -0
- package/docs/src/components/Timestamp.js +1 -0
- package/docs/src/components/Toast.js +141 -0
- package/docs/src/components/Toggle.js +74 -0
- package/docs/src/components/tableControls/DeleteRecord.js +7 -0
- package/docs/src/components/tableControls/Edit.js +18 -0
- package/docs/src/components/tableControls/ExportCSV.js +8 -0
- package/docs/src/components/tableControls/ExportJson.js +8 -0
- package/docs/src/components/tableControls/FieldSortHide.js +26 -0
- package/docs/src/components/tableControls/Filters.js +47 -0
- package/docs/src/components/tableControls/FirstPage.js +9 -0
- package/docs/src/components/tableControls/HiddenCount.js +3 -0
- package/docs/src/components/tableControls/Hide.js +5 -0
- package/docs/src/components/tableControls/LastPage.js +9 -0
- package/docs/src/components/tableControls/NextPage.js +9 -0
- package/docs/src/components/tableControls/PageSelect.js +22 -0
- package/docs/src/components/tableControls/PageSize.js +5 -0
- package/docs/src/components/tableControls/PrevPage.js +9 -0
- package/docs/src/components/tableControls/Search.js +9 -0
- package/docs/src/components/tableControls/ShowAll.js +5 -0
- package/docs/src/components/tableControls/TableControl.js +16 -0
- package/docs/src/utils/debounce.js +1 -0
- package/docs/src/utils/drag.js +1 -0
- package/docs/src/utils/formatTimestamp.js +1 -0
- package/docs/src/utils/propConverters.js +1 -0
- package/docs/src/utils/toTitleCase.js +1 -0
- package/docs/src/utils/watchWindowSize.js +1 -0
- package/docs/utils/debounce.html +78 -0
- package/docs/utils/drag.html +89 -0
- package/docs/utils/formatTimestamp.html +114 -0
- package/docs/utils/propConverters.html +132 -0
- package/docs/utils/toTitleCase.html +71 -0
- package/docs/utils/watchWindowSize.html +166 -0
- package/icons/error.svg +1 -1
- package/icons/warning.svg +1 -1
- package/package.json +1 -1
- package/scripts/build.js +4 -1
- package/scripts/docs.js +4 -2
- package/src/components/Accordion.js +229 -0
- package/src/components/Collapsible.js +109 -0
- package/src/components/ContentSlider.js +205 -0
- package/src/components/Dialog.js +376 -0
- package/src/components/PersistantCollapsible.js +69 -0
- package/src/components/PhotoViewer.js +368 -0
- package/src/components/Resize.js +210 -0
- package/src/components/ShadowComponent.js +3 -1
- package/src/components/ShowMore.js +109 -0
- package/src/components/Sortable.js +193 -0
- package/src/components/Split.js +192 -0
- package/src/components/Table.js +1202 -0
- package/src/components/Tabs.js +428 -0
- package/src/components/Tags.js +253 -0
- package/src/components/Timestamp.js +31 -0
- package/src/components/Toast.js +454 -0
- package/src/components/Toggle.js +173 -0
- package/src/components/tableControls/DeleteRecord.js +29 -0
- package/src/components/tableControls/Edit.js +88 -0
- package/src/components/tableControls/ExportCSV.js +71 -0
- package/src/components/tableControls/ExportJson.js +55 -0
- package/src/components/tableControls/FieldSortHide.js +76 -0
- package/src/components/tableControls/Filters.js +114 -0
- package/src/components/tableControls/FirstPage.js +65 -0
- package/src/components/tableControls/HiddenCount.js +45 -0
- package/src/components/tableControls/Hide.js +34 -0
- package/src/components/tableControls/LastPage.js +65 -0
- package/src/components/tableControls/NextPage.js +65 -0
- package/src/components/tableControls/PageSelect.js +109 -0
- package/src/components/tableControls/PageSize.js +68 -0
- package/src/components/tableControls/PrevPage.js +65 -0
- package/src/components/tableControls/Search.js +58 -0
- package/src/components/tableControls/ShowAll.js +34 -0
- package/src/components/tableControls/TableControl.js +105 -0
- package/src/utils/debounce.js +9 -0
- package/src/utils/drag.js +80 -0
- package/src/utils/formatTimestamp.js +27 -0
- package/src/utils/toTitleCase.js +9 -0
- package/src/utils/watchWindowSize.js +16 -0
- package/dist/src/utils/cli.js +0 -1
- package/dist/src/utils/fs-utils.js +0 -1
- package/docs/components/component.html +0 -90
- package/docs/components/directory-viewer.html +0 -90
- package/docs/components/lazy-component.html +0 -84
- package/docs/components/reactive-component.html +0 -69
- package/docs/components/reactive-lazy-component.html +0 -69
- package/docs/components/search.html +0 -102
- package/docs/src/utils/cli.js +0 -1
- package/docs/src/utils/fs-utils.js +0 -1
- package/src/utils/cli.js +0 -43
- package/src/utils/fs-utils.js +0 -41
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
8
|
<link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
|
|
9
9
|
<script type="module">
|
|
10
|
+
import ShadowComponent from '../src/components/ShadowComponent.js';
|
|
10
11
|
import Import from '../src/components/Import.js';
|
|
11
12
|
import Icon from '../src/components/Icon.js';
|
|
13
|
+
ShadowComponent.stylesheetPath = '../kempo.min.css';
|
|
12
14
|
Import.replacements.root = '../';
|
|
13
15
|
Icon.pathToIcons = ['../icons'];
|
|
14
16
|
</script>
|
|
@@ -30,7 +32,6 @@
|
|
|
30
32
|
<h6 class="mt">JavaScript Reference</h6>
|
|
31
33
|
<a href="#constructor">Constructor</a><br />
|
|
32
34
|
<a href="#requirements">Requirements</a><br />
|
|
33
|
-
<a href="#attributes">Attributes</a><br />
|
|
34
35
|
<a href="#properties">Properties</a><br />
|
|
35
36
|
<a href="#methods">Methods</a><br />
|
|
36
37
|
<a href="#staticMethods">Static Methods</a><br />
|
|
@@ -93,20 +94,20 @@
|
|
|
93
94
|
|
|
94
95
|
<h3 id="jsUsage"><a href="#jsUsage" class="no-link">JavaScript Usage</a></h3>
|
|
95
96
|
<h5>Create Dialog</h5>
|
|
96
|
-
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d7"</span>></span>Open Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></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><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/
|
|
97
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d7"</span>></span>Open Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></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><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d7'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Dialog.create(<span class="hljs-string">'<p>Hello World</p>'</span>);<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
97
98
|
<button id="d7" class="mb">Open Dialog</button>
|
|
98
99
|
<script type="module">
|
|
99
|
-
import Dialog from '/
|
|
100
|
+
import Dialog from '/src/components/Dialog.js';
|
|
100
101
|
document.getElementById('d7').addEventListener('click', () => {
|
|
101
102
|
Dialog.create('<p>Hello World</p>');
|
|
102
103
|
});
|
|
103
104
|
</script>
|
|
104
105
|
|
|
105
106
|
<h5>Error Dialog</h5>
|
|
106
|
-
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d8"</span>></span>Open Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></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><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/
|
|
107
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d8"</span>></span>Open Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></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><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d8'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Dialog.error(<span class="hljs-string">"<p>Oh no, don't do that!</p>"</span>);<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
107
108
|
<button id="d8" class="mb">Open Dialog</button>
|
|
108
109
|
<script type="module">
|
|
109
|
-
import Dialog from '/
|
|
110
|
+
import Dialog from '/src/components/Dialog.js';
|
|
110
111
|
document.getElementById('d8').addEventListener('click', () => {
|
|
111
112
|
Dialog.error("Oh no, don't do that!");
|
|
112
113
|
});
|
|
@@ -114,10 +115,10 @@
|
|
|
114
115
|
|
|
115
116
|
<h3 id="confirmDialog"><a href="#confirmDialog" class="no-link">Confirm Dialog</a></h3>
|
|
116
117
|
<p>Use the <code>Dialog.confirm</code> static method to create a confirmation dialog. This method takes a text message, a response callback, and an options object.</p>
|
|
117
|
-
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d9"</span>></span>Open Confirm Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></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><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/
|
|
118
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d9"</span>></span>Open Confirm Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></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><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/src/components/Dialog.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'d9'</span>).addEventListener(<span class="hljs-string">'click'</span>, () => {<br /> Dialog.confirm(<span class="hljs-string">"Are you sure you want to proceed?"</span>, <span class="hljs-function"><span class="hljs-params">response</span> =></span> {<br /> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"User response:"</span>, response);<br /> });<br /> });<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
118
119
|
<button id="d9" class="mb">Open Confirm Dialog</button>
|
|
119
120
|
<script type="module">
|
|
120
|
-
import Dialog from '/
|
|
121
|
+
import Dialog from '/src/components/Dialog.js';
|
|
121
122
|
document.getElementById('d9').addEventListener('click', () => {
|
|
122
123
|
Dialog.confirm("Are you sure you want to proceed?", response => {
|
|
123
124
|
console.log("User response:", response);
|
|
@@ -128,55 +129,43 @@
|
|
|
128
129
|
<h2 id="jsRef">JavaScript Reference</h2>
|
|
129
130
|
|
|
130
131
|
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
131
|
-
<h6>Extends <a href="./
|
|
132
|
+
<h6>Extends <a href="./ShadowComponent.html">ShadowComponent</a></h6>
|
|
132
133
|
<h5>
|
|
133
|
-
<code>new Dialog(
|
|
134
|
+
<code>new Dialog()</code>
|
|
134
135
|
</h5>
|
|
135
136
|
|
|
136
137
|
<h4>Parameters</h4>
|
|
137
|
-
<
|
|
138
|
-
<p>An object containing the initial configuration for the dialog. The options object can contain the following properties:</p>
|
|
139
|
-
<ul>
|
|
140
|
-
<li><code>opened</code>: <i>boolean</i> - Whether the dialog is initially opened.</li>
|
|
141
|
-
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
142
|
-
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
143
|
-
<li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
|
|
144
|
-
<li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
|
|
145
|
-
<li><code>confirmAction</code>: <i>function</i> - Action to perform on confirm.</li>
|
|
146
|
-
<li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
|
|
147
|
-
<li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
|
|
148
|
-
<li><code>cancelAction</code>: <i>function</i> - Action to perform on cancel.</li>
|
|
149
|
-
<li><code>closeCallback</code>: <i>function</i> - Callback to execute when the dialog is closed.</li>
|
|
150
|
-
</ul>
|
|
138
|
+
<p>The Dialog constructor takes no parameters. Configuration is done through attributes or properties after instantiation.</p>
|
|
151
139
|
|
|
152
140
|
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
153
141
|
<ul>
|
|
154
|
-
<li><a href="./component.html">
|
|
142
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
143
|
+
<li><a href="./icon.html">Icon</a></li>
|
|
155
144
|
</ul>
|
|
156
145
|
|
|
157
|
-
<h3 id="
|
|
146
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
158
147
|
<h5><code>opened<i>: boolean</i></code></h5>
|
|
159
|
-
<p>Whether the dialog is opened.</p>
|
|
148
|
+
<p>Whether the dialog is opened. Syncs with the <code>opened</code> attribute.</p>
|
|
160
149
|
<h5><code>closeBtn<i>: boolean</i></code></h5>
|
|
161
|
-
<p>Whether to show the close button.</p>
|
|
150
|
+
<p>Whether to show the close button. Syncs with the <code>close-btn</code> attribute.</p>
|
|
162
151
|
<h5><code>overlayClose<i>: boolean</i></code></h5>
|
|
163
|
-
<p>Whether clicking the overlay closes the dialog.</p>
|
|
152
|
+
<p>Whether clicking the overlay closes the dialog. Syncs with the <code>overlay-close</code> attribute.</p>
|
|
164
153
|
<h5><code>confirmText<i>: string</i></code></h5>
|
|
165
|
-
<p>Text for the confirm button.</p>
|
|
154
|
+
<p>Text for the confirm button. Syncs with the <code>confirm-text</code> attribute.</p>
|
|
166
155
|
<h5><code>confirmClasses<i>: string</i></code></h5>
|
|
167
|
-
<p>Classes for the confirm button.</p>
|
|
156
|
+
<p>Classes for the confirm button. Syncs with the <code>confirm-classes</code> attribute.</p>
|
|
168
157
|
<h5><code>cancelText<i>: string</i></code></h5>
|
|
169
|
-
<p>Text for the cancel button.</p>
|
|
158
|
+
<p>Text for the cancel button. Syncs with the <code>cancel-text</code> attribute.</p>
|
|
170
159
|
<h5><code>cancelClasses<i>: string</i></code></h5>
|
|
171
|
-
<p>Classes for the cancel button.</p>
|
|
172
|
-
|
|
173
|
-
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
160
|
+
<p>Classes for the cancel button. Syncs with the <code>cancel-classes</code> attribute.</p>
|
|
174
161
|
<h5><code>confirmAction<i>: function</i></code></h5>
|
|
175
|
-
<p>Action to perform
|
|
162
|
+
<p>Action to perform when the confirm button is clicked. Not reflected as an attribute.</p>
|
|
176
163
|
<h5><code>cancelAction<i>: function</i></code></h5>
|
|
177
|
-
<p>Action to perform
|
|
164
|
+
<p>Action to perform when the cancel button is clicked. Not reflected as an attribute.</p>
|
|
178
165
|
<h5><code>closeCallback<i>: function</i></code></h5>
|
|
179
|
-
<p>Callback to execute when the dialog is closed.</p>
|
|
166
|
+
<p>Callback to execute when the dialog is closed. Not reflected as an attribute.</p>
|
|
167
|
+
<h5><code>previousFocus<i>: Element</i></code></h5>
|
|
168
|
+
<p>Reference to the element that had focus before the dialog was opened. Not reflected as an attribute.</p>
|
|
180
169
|
|
|
181
170
|
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
182
171
|
<h5><code>open()<i>: void</i></code></h5>
|
|
@@ -206,25 +195,42 @@
|
|
|
206
195
|
<li><code>cancelAction</code>: <i>function</i> - Action to perform on cancel.</li>
|
|
207
196
|
<li><code>closeCallback</code>: <i>function</i> - Callback to execute when the dialog is closed.</li>
|
|
208
197
|
</ul>
|
|
209
|
-
<h5><code>confirm(text, responseCallback, options)<i>:
|
|
210
|
-
<p>Creates and opens a confirmation dialog with the specified text and options.</p>
|
|
198
|
+
<h5><code>confirm(text, responseCallback, options)<i>: Dialog</i></code></h5>
|
|
199
|
+
<p>Creates and opens a confirmation dialog with the specified text and options. The responseCallback receives a boolean indicating the user's choice.</p>
|
|
211
200
|
<h6>Options</h6>
|
|
212
201
|
<ul>
|
|
213
|
-
<li><code>title</code>: <i>string</i> - The title of the dialog.</li>
|
|
214
|
-
<li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
|
|
215
|
-
<li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
|
|
216
|
-
<li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
|
|
217
|
-
<li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
|
|
202
|
+
<li><code>title</code>: <i>string</i> - The title of the dialog (default: "Confirm").</li>
|
|
203
|
+
<li><code>confirmText</code>: <i>string</i> - Text for the confirm button (default: "Yes").</li>
|
|
204
|
+
<li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button (default: "success ml").</li>
|
|
205
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the cancel button (default: "No").</li>
|
|
206
|
+
<li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button (default: "danger").</li>
|
|
207
|
+
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button (default: false).</li>
|
|
208
|
+
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog (default: false).</li>
|
|
209
|
+
</ul>
|
|
210
|
+
<h5><code>alert(text, responseCallback, options)<i>: Dialog</i></code></h5>
|
|
211
|
+
<p>Creates and opens an alert dialog with the specified text and options.</p>
|
|
212
|
+
<h6>Options</h6>
|
|
213
|
+
<ul>
|
|
214
|
+
<li><code>title</code>: <i>string</i> - The title of the dialog (default: "Alert").</li>
|
|
215
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the ok button (default: "Ok").</li>
|
|
218
216
|
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
219
217
|
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
220
218
|
</ul>
|
|
221
|
-
<h5><code>error(text, responseCallback, options)<i>:
|
|
219
|
+
<h5><code>error(text, responseCallback, options)<i>: Dialog</i></code></h5>
|
|
222
220
|
<p>Creates and opens an error dialog with the specified text and options.</p>
|
|
223
221
|
<h6>Options</h6>
|
|
224
222
|
<ul>
|
|
225
|
-
<li><code>title</code>: <i>string</i> - The title of the dialog.</li>
|
|
226
|
-
<li><code>cancelText</code>: <i>string</i> - Text for the
|
|
227
|
-
<li><code>
|
|
223
|
+
<li><code>title</code>: <i>string</i> - The title of the dialog (default: "Error").</li>
|
|
224
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the ok button (default: "Ok").</li>
|
|
225
|
+
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
226
|
+
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
227
|
+
</ul>
|
|
228
|
+
<h5><code>success(text, responseCallback, options)<i>: Dialog</i></code></h5>
|
|
229
|
+
<p>Creates and opens a success dialog with the specified text and options.</p>
|
|
230
|
+
<h6>Options</h6>
|
|
231
|
+
<ul>
|
|
232
|
+
<li><code>title</code>: <i>string</i> - The title of the dialog (default: "Success").</li>
|
|
233
|
+
<li><code>cancelText</code>: <i>string</i> - Text for the ok button (default: "Ok").</li>
|
|
228
234
|
<li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
|
|
229
235
|
<li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
|
|
230
236
|
</ul>
|
|
@@ -22,47 +22,91 @@
|
|
|
22
22
|
<div class="m mt0 pl">
|
|
23
23
|
<h6>Examples</h6>
|
|
24
24
|
<a href="#basicUsage">Basic Usage</a><br />
|
|
25
|
+
<a href="#dialogExample">Dialog Example</a><br />
|
|
25
26
|
|
|
26
27
|
<h6 class="mt">JavaScript Reference</h6>
|
|
27
28
|
<a href="#constructor">Constructor</a><br />
|
|
28
29
|
<a href="#requirements">Requirements</a><br />
|
|
29
|
-
<a href="#attributes">Attributes</a><br />
|
|
30
30
|
<a href="#properties">Properties</a><br />
|
|
31
31
|
<a href="#methods">Methods</a><br />
|
|
32
32
|
</div>
|
|
33
33
|
</details>
|
|
34
34
|
|
|
35
|
-
<h3>Description</h3>
|
|
36
|
-
<p>The <code>FocusCapture</code> class extends the <a href="./lazy-component.html">LazyComponent</a> class and provides functionality to capture focus within the component.</p>
|
|
37
|
-
|
|
38
35
|
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
39
|
-
<p>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
<p>The <code>k-focus-capture</code> component traps focus within its children. When focus reaches the end of the focusable elements, it cycles back to the first focusable element. This is useful for modal dialogs, side menus, or any UI where you want to keep focus contained within a specific area.</p>
|
|
37
|
+
<div class="row -mx">
|
|
38
|
+
<div class="col m-span-12 px">
|
|
39
|
+
<k-card label="HTML">
|
|
40
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-focus-capture</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"card"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"mb"</span>></span>First Button<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Input field"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"mb"</span> /></span><br /> <span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"mb"</span>></span>Second Button<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"d-b mb"</span>></span>Link<span class="hljs-tag"></<span class="hljs-name">a</span>></span><br /> <span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-focus-capture</span>></span></code></pre>
|
|
41
|
+
</k-card>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="col m-span-12 px">
|
|
44
|
+
<k-card label="Output">
|
|
45
|
+
<p class="mb"><em>Tab through the elements below. Focus will cycle back to the first element after the last one.</em></p>
|
|
46
|
+
<k-focus-capture>
|
|
47
|
+
<div class="card">
|
|
48
|
+
<button class="mb">First Button</button>
|
|
49
|
+
<input type="text" placeholder="Input field" class="mb" />
|
|
50
|
+
<button class="mb">Second Button</button>
|
|
51
|
+
<a href="#" class="d-b mb">Link</a>
|
|
52
|
+
</div>
|
|
53
|
+
</k-focus-capture>
|
|
54
|
+
</k-card>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<h3 id="dialogExample"><a href="#dialogExample" class="no-link">Dialog Example</a></h3>
|
|
59
|
+
<p>FocusCapture is used internally by the <a href="dialog.html">Dialog</a> and <a href="side-menu.html">SideMenu</a> components. You do not need to add it yourself. Open the dialog below and tab through the elements to see how focus is trapped within the dialog.</p>
|
|
60
|
+
<div class="row -mx">
|
|
61
|
+
<div class="col m-span-12 px">
|
|
62
|
+
<k-card label="HTML">
|
|
63
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-dialog</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"focusDialog"</span> <span class="hljs-attr">cancel-text</span>=<span class="hljs-string">"Close"</span> <span class="hljs-attr">confirm-text</span>=<span class="hljs-string">"Submit"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">h6</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"title"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"m0 px"</span>></span>Focus Capture Dialog<span class="hljs-tag"></<span class="hljs-name">h6</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">p</span>></span>Tab through the elements. Focus stays trapped in the dialog.<span class="hljs-tag"></<span class="hljs-name">p</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Name"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"mb"</span> /></span><br /> <span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"email"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Email"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"mb"</span> /></span><br /> <span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-dialog</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"document.getElementById('focusDialog').open()"</span>></span>Open Dialog<span class="hljs-tag"></<span class="hljs-name">button</span>></span></code></pre>
|
|
64
|
+
</k-card>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="col m-span-12 px">
|
|
67
|
+
<k-card label="Output">
|
|
68
|
+
<button onclick="document.getElementById('focusDialog').open()">Open Dialog</button>
|
|
69
|
+
<k-dialog
|
|
70
|
+
id="focusDialog"
|
|
71
|
+
cancel-text="Close"
|
|
72
|
+
confirm-text="Submit"
|
|
73
|
+
>
|
|
74
|
+
<h6 slot="title" class="m0 px">Focus Capture Dialog</h6>
|
|
75
|
+
<div class="p">
|
|
76
|
+
<p>Tab through the elements. Focus stays trapped in the dialog.</p>
|
|
77
|
+
<input type="text" placeholder="Name" class="mb" />
|
|
78
|
+
<input type="email" placeholder="Email" class="mb" />
|
|
79
|
+
</div>
|
|
80
|
+
</k-dialog>
|
|
81
|
+
</k-card>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
45
84
|
|
|
46
85
|
<h2 id="jsRef">JavaScript Reference</h2>
|
|
47
86
|
|
|
48
87
|
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
49
|
-
<h6>Extends
|
|
88
|
+
<h6>Extends LitElement</h6>
|
|
50
89
|
<h5>
|
|
51
90
|
<code>new FocusCapture()</code>
|
|
52
91
|
</h5>
|
|
53
92
|
|
|
54
93
|
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
55
94
|
<ul>
|
|
56
|
-
<li
|
|
95
|
+
<li>Lit</li>
|
|
57
96
|
</ul>
|
|
58
97
|
|
|
59
|
-
<h3 id="
|
|
60
|
-
<
|
|
98
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
99
|
+
<h5><code>afterFocus<i>: function</i></code></h5>
|
|
100
|
+
<p>A method that is called when focus reaches the end capture element. By default, it finds the first focusable element within the component and focuses it. Focusable elements include: <code>button</code>, <code>[href]</code>, <code>input</code>, <code>select</code>, <code>textarea</code>, and <code>[tabindex]:not([tabindex="-1"])</code>.</p>
|
|
61
101
|
|
|
62
102
|
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
63
|
-
<
|
|
103
|
+
<h5><code>render()<i>: TemplateResult</i></code></h5>
|
|
104
|
+
<p>Renders the component with a slot for children and an invisible div with <code>tabindex="0"</code> that captures focus and cycles it back to the beginning.</p>
|
|
64
105
|
|
|
65
106
|
</main>
|
|
107
|
+
<div style="height:33vh"></div>
|
|
66
108
|
<script type="module" src="../src/components/Import.js"></script>
|
|
109
|
+
<script type="module" src="../src/components/FocusCapture.js"></script>
|
|
110
|
+
<script type="module" src="../src/components/Dialog.js"></script>
|
|
67
111
|
</body>
|
|
68
112
|
</html>
|
|
@@ -0,0 +1,112 @@
|
|
|
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>HybridComponent - Base Components - Kempo Docs - A Web Components Solution</title>
|
|
7
|
+
<link rel="stylesheet" href="../src/kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
|
|
8
|
+
<link rel="stylesheet" href="../src/kempo-hljs.css" />`n <link rel="stylesheet" href="../styles.css" />
|
|
9
|
+
<script type="module">
|
|
10
|
+
import Import from '../src/components/Import.js';
|
|
11
|
+
import Icon from '../src/components/Icon.js';
|
|
12
|
+
Import.replacements.root = '../';
|
|
13
|
+
Icon.pathToIcons = ['../icons'];
|
|
14
|
+
</script>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<k-import src="../nav.inc.html"></k-import>
|
|
18
|
+
<h1 class="ta-center">HybridComponent</h1>
|
|
19
|
+
<main>
|
|
20
|
+
<details class="b r mb">
|
|
21
|
+
<summary class="p">Table of Contents</summary>
|
|
22
|
+
<div class="m mt0 pl">
|
|
23
|
+
<h6>Guide</h6>
|
|
24
|
+
<a href="#overview">Overview</a><br />
|
|
25
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
26
|
+
<a href="#whenToUse">When to Use</a><br />
|
|
27
|
+
|
|
28
|
+
<h6 class="mt">JavaScript Reference</h6>
|
|
29
|
+
<a href="#constructor">Constructor</a><br />
|
|
30
|
+
<a href="#requirements">Requirements</a><br />
|
|
31
|
+
<a href="#properties">Properties</a><br />
|
|
32
|
+
<a href="#methods">Methods</a><br />
|
|
33
|
+
</div>
|
|
34
|
+
</details>
|
|
35
|
+
|
|
36
|
+
<h3 id="overview"><a href="#overview" class="no-link">Overview</a></h3>
|
|
37
|
+
<p>HybridComponent is a base class that extends <a href="shadow-component.html">ShadowComponent</a> and provides both shadow DOM rendering with Kempo CSS styles AND light DOM rendering. Use this when you want your component to:</p>
|
|
38
|
+
<ul>
|
|
39
|
+
<li>Have shadow DOM with Kempo CSS for internal UI elements</li>
|
|
40
|
+
<li>Also render content to the light DOM alongside natural children</li>
|
|
41
|
+
<li>Combine the benefits of both shadow and light DOM</li>
|
|
42
|
+
</ul>
|
|
43
|
+
<p>Components like <a href="collapsible.html">Collapsible</a>, <a href="dialog.html">Dialog</a>, and <a href="side-menu.html">SideMenu</a> extend HybridComponent.</p>
|
|
44
|
+
|
|
45
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
46
|
+
<p>Create a custom component by extending HybridComponent and implementing both <code>render()</code> for shadow DOM and <code>renderLightDom()</code> for light DOM:</p>
|
|
47
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">import</span> HybridComponent <span class="hljs-keyword">from</span> <span class="hljs-string">'./HybridComponent.js'</span>;<br /><span class="hljs-keyword">import</span> { html, css } <span class="hljs-keyword">from</span> <span class="hljs-string">'../lit-all.min.js'</span>;<br /><br /><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyHybridComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title class_">HybridComponent</span> {<br /> <span class="hljs-keyword">static</span> properties = {<br /> <span class="hljs-attr">title</span>: { <span class="hljs-attr">type</span>: <span class="hljs-title class_">String</span> }<br /> };<br /><br /> <span class="hljs-keyword">static</span> styles = css<span class="hljs-string">`<br /> :host {<br /> display: block;<br /> }<br /> .shadow-content {<br /> background: var(--c_primary);<br /> color: var(--tc_on_primary);<br /> padding: var(--spacer);<br /> }<br /> `</span>;<br /><br /> <span class="hljs-title function_">constructor</span>() {<br /> <span class="hljs-variable language_">super</span>();<br /> <span class="hljs-variable language_">this</span>.title = <span class="hljs-string">'Hybrid'</span>;<br /> }<br /><br /> <span class="hljs-comment">// Shadow DOM content with Kempo CSS styles</span><br /> <span class="hljs-title function_">render</span>() {<br /> <span class="hljs-keyword">return</span> html<span class="hljs-string">`<br /> <div class="shadow-content"><br /> <h3><span class="hljs-subst">${<span class="hljs-variable language_">this</span>.title}</span> Component</h3><br /> <slot name="lightRoot"></slot><br /> </div><br /> `</span>;<br /> }<br /><br /> <span class="hljs-comment">// Light DOM content alongside natural children</span><br /> <span class="hljs-title function_">renderLightDom</span>() {<br /> <span class="hljs-keyword">return</span> html<span class="hljs-string">`<br /> <p class="p">This is rendered to light DOM</p><br /> <slot></slot><br /> `</span>;<br /> }<br />}<br /><br /><span class="hljs-variable language_">customElements</span>.<span class="hljs-title function_">define</span>(<span class="hljs-string">'my-hybrid-component'</span>, MyHybridComponent);</code></pre>
|
|
48
|
+
|
|
49
|
+
<p><strong>Important:</strong> The default <code>render()</code> method includes <code><slot name="lightRoot"></slot></code> which is where the light DOM content appears. If you override <code>render()</code>, make sure to include this slot.</p>
|
|
50
|
+
|
|
51
|
+
<p><strong>Also Important:</strong> Always call <code>super.updated()</code> when overriding the <code>updated()</code> lifecycle method:</p>
|
|
52
|
+
<pre><code class="hljs javascript"><span class="hljs-title function_">updated</span>(changedProperties) {<br /> <span class="hljs-variable language_">super</span>.<span class="hljs-title function_">updated</span>(); <span class="hljs-comment">// Required!</span><br /> <br /> <span class="hljs-comment">// Your custom logic here</span><br />}</code></pre>
|
|
53
|
+
|
|
54
|
+
<h3 id="whenToUse"><a href="#whenToUse" class="no-link">When to Use</a></h3>
|
|
55
|
+
<p>Use HybridComponent when:</p>
|
|
56
|
+
<ul>
|
|
57
|
+
<li>You need styled internal UI elements (buttons, headers, etc.) in shadow DOM</li>
|
|
58
|
+
<li>You also need to render content to light DOM alongside natural children</li>
|
|
59
|
+
<li>You want Kempo CSS styles for your component UI but need flexibility for user content</li>
|
|
60
|
+
</ul>
|
|
61
|
+
|
|
62
|
+
<p><strong>Example use cases:</strong></p>
|
|
63
|
+
<ul>
|
|
64
|
+
<li><strong>Dialog:</strong> Shadow DOM for styled dialog chrome (header, footer, overlay), light DOM for user content</li>
|
|
65
|
+
<li><strong>Collapsible:</strong> Shadow DOM for toggle button, light DOM for collapsible content</li>
|
|
66
|
+
<li><strong>SideMenu:</strong> Shadow DOM for menu structure and styling, light DOM for menu items</li>
|
|
67
|
+
</ul>
|
|
68
|
+
|
|
69
|
+
<p>Use <a href="shadow-component.html">ShadowComponent</a> instead when you only need shadow DOM.</p>
|
|
70
|
+
<p>Use <a href="light-component.html">LightComponent</a> instead when you only need light DOM.</p>
|
|
71
|
+
|
|
72
|
+
<h2 id="jsRef">JavaScript Reference</h2>
|
|
73
|
+
|
|
74
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
75
|
+
<h6>Extends ShadowComponent</h6>
|
|
76
|
+
<h5><code>new HybridComponent()</code></h5>
|
|
77
|
+
<p>Creates a new HybridComponent instance with both shadow DOM (with Kempo CSS) and light DOM rendering.</p>
|
|
78
|
+
|
|
79
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
80
|
+
<ul>
|
|
81
|
+
<li>Lit (html, render)</li>
|
|
82
|
+
<li><a href="shadow-component.html">ShadowComponent</a></li>
|
|
83
|
+
</ul>
|
|
84
|
+
|
|
85
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
86
|
+
<h5><code>lightRoot<i>: HTMLElement</i></code></h5>
|
|
87
|
+
<p>A container element with <code>display: contents</code> that holds the rendered light DOM content. It has <code>slot="lightRoot"</code> to connect it to the shadow DOM slot. Created automatically by <code>createRenderRoot()</code>.</p>
|
|
88
|
+
|
|
89
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
90
|
+
<h5><code>createRenderRoot()<i>: Element</i></code></h5>
|
|
91
|
+
<p>Creates both shadow DOM (via <code>super.createRenderRoot()</code>) and light DOM render containers. This method:</p>
|
|
92
|
+
<ul>
|
|
93
|
+
<li>Calls the parent ShadowComponent's <code>createRenderRoot()</code> to set up shadow DOM with Kempo CSS</li>
|
|
94
|
+
<li>Creates a <code>lightRoot</code> div with <code>display: contents</code> and <code>slot="lightRoot"</code></li>
|
|
95
|
+
<li>Appends <code>lightRoot</code> to the component element</li>
|
|
96
|
+
<li>Returns the shadow render container</li>
|
|
97
|
+
</ul>
|
|
98
|
+
|
|
99
|
+
<h5><code>updated()<i>: void</i></code></h5>
|
|
100
|
+
<p>Called automatically by Lit when the component updates. Renders the result of <code>renderLightDom()</code> into <code>lightRoot</code>. Override this method if needed, but always call <code>super.updated()</code>.</p>
|
|
101
|
+
|
|
102
|
+
<h5><code>renderLightDom()<i>: TemplateResult</i></code></h5>
|
|
103
|
+
<p>Override this method to define what should be rendered to the light DOM. Returns an empty template by default. Use Lit's <code>html</code> tagged template literal to return your content. Typically includes a <code><slot></slot></code> for natural children.</p>
|
|
104
|
+
|
|
105
|
+
<h5><code>render()<i>: TemplateResult</i></code></h5>
|
|
106
|
+
<p>Override this method to define what should be rendered to the shadow DOM. The default implementation returns <code>html`<slot name="lightRoot"></slot>`</code> which displays the light DOM content. When overriding, make sure to include this slot where you want the light DOM content to appear.</p>
|
|
107
|
+
|
|
108
|
+
</main>
|
|
109
|
+
<div style="height:33vh"></div>
|
|
110
|
+
<script type="module" src="../src/components/Import.js"></script>
|
|
111
|
+
</body>
|
|
112
|
+
</html>
|
|
@@ -10,10 +10,8 @@
|
|
|
10
10
|
<script type="module">
|
|
11
11
|
import Import from '../src/components/Import.js';
|
|
12
12
|
import Icon from '../src/components/Icon.js';
|
|
13
|
-
// import Search from '../src/components/Search.js';
|
|
14
13
|
Import.replacements.root = '../';
|
|
15
14
|
Icon.pathToIcons = ['../icons'];
|
|
16
|
-
// Search.searchDataUrl = '../search.json';
|
|
17
15
|
</script>
|
|
18
16
|
</head>
|
|
19
17
|
<body>
|
|
@@ -34,7 +32,6 @@
|
|
|
34
32
|
<h6 class="mt">JavaScript Reference</h6>
|
|
35
33
|
<a href="#constructor">Constructor</a><br />
|
|
36
34
|
<a href="#requirements">Requirements</a><br />
|
|
37
|
-
<a href="#attributes">Attributes</a><br />
|
|
38
35
|
<a href="#properties">Properties</a><br />
|
|
39
36
|
<a href="#methods">Methods</a><br />
|
|
40
37
|
</div>
|
|
@@ -139,18 +136,16 @@
|
|
|
139
136
|
|
|
140
137
|
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
141
138
|
<ul>
|
|
142
|
-
<li><a href="./component.html">
|
|
139
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
143
140
|
</ul>
|
|
144
141
|
|
|
145
|
-
<h3 id="
|
|
142
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
146
143
|
<h5><code>name<i>: string</i></code></h5>
|
|
147
|
-
<p>The name of the icon.</p>
|
|
144
|
+
<p>The name of the icon. Syncs with the <code>name</code> attribute.</p>
|
|
148
145
|
<h5><code>src<i>: string</i></code></h5>
|
|
149
|
-
<p>The source URL of the icon.</p>
|
|
150
|
-
|
|
151
|
-
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
146
|
+
<p>The source URL of the icon. Syncs with the <code>src</code> attribute.</p>
|
|
152
147
|
<h5><code>pathToIcons<i>: Array</i></code></h5>
|
|
153
|
-
<p>An array of paths to directories containing icons.</p>
|
|
148
|
+
<p>An array of paths to directories containing icons. This is a static property that affects all icon instances.</p>
|
|
154
149
|
|
|
155
150
|
</main>
|
|
156
151
|
<div style="height:33vh"></div>
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
<h6 class="mt">JavaScript Reference</h6>
|
|
28
28
|
<a href="#constructor">Constructor</a><br />
|
|
29
29
|
<a href="#requirements">Requirements</a><br />
|
|
30
|
-
<a href="#attributes">Attributes</a><br />
|
|
31
30
|
<a href="#properties">Properties</a><br />
|
|
32
31
|
<a href="#methods">Methods</a><br />
|
|
33
32
|
</div>
|
|
@@ -58,13 +57,9 @@
|
|
|
58
57
|
<li><a href="./component.html">Component</a></li>
|
|
59
58
|
</ul>
|
|
60
59
|
|
|
61
|
-
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
62
|
-
<h5><code>src<i>: string</i></code></h5>
|
|
63
|
-
<p>The source URL of the HTML snippet to import.</p>
|
|
64
|
-
|
|
65
60
|
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
66
61
|
<h5><code>src<i>: string</i></code></h5>
|
|
67
|
-
<p>The source URL of the HTML snippet to import.</p>
|
|
62
|
+
<p>The source URL of the HTML snippet to import. Syncs to <code>src</code> attribute.</p>
|
|
68
63
|
|
|
69
64
|
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
70
65
|
<h5><code>load()<i>: Promise</i></code></h5>
|