kempo 2.9.2 → 2.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/components/Accordion.js +1 -1
  2. package/dist/components/Dialog.js +1 -1
  3. package/dist/components/DirectoryViewer.js +1 -1
  4. package/dist/components/FocusCapture.js +1 -1
  5. package/dist/components/Timestamp.js +1 -1
  6. package/dist/components/Toggle.js +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/utils/formatTimestamp.js +1 -1
  9. package/docs/components/_template.html +9 -0
  10. package/docs/components/accordion.html +52 -12
  11. package/docs/components/card.html +68 -8
  12. package/docs/components/component.html +6 -0
  13. package/docs/components/content-slider.html +8 -0
  14. package/docs/components/dialog.html +145 -5
  15. package/docs/components/directory-viewer.html +51 -40
  16. package/docs/components/focus-capture.html +68 -0
  17. package/docs/components/icon.html +76 -5
  18. package/docs/components/import.html +47 -0
  19. package/docs/components/lazy-component.html +45 -15
  20. package/docs/components/reactive-component.html +69 -0
  21. package/docs/components/reactive-lazy-component.html +69 -0
  22. package/docs/components/resize.html +52 -3
  23. package/docs/components/search.html +102 -0
  24. package/docs/components/show-more.html +54 -5
  25. package/docs/components/{sidemenu.html → side-menu.html} +56 -3
  26. package/docs/components/split.html +57 -16
  27. package/docs/components/table.html +20 -20
  28. package/docs/components/tabs.html +72 -4
  29. package/docs/components/tags.html +94 -0
  30. package/docs/components/theme-switcher.html +74 -0
  31. package/docs/components/timestamp.html +86 -0
  32. package/docs/components/toggle.html +37 -34
  33. package/docs/index.html +5 -0
  34. package/docs/kempo/components/Accordion.js +1 -1
  35. package/docs/kempo/components/Dialog.js +1 -1
  36. package/docs/kempo/components/DirectoryViewer.js +1 -1
  37. package/docs/kempo/components/FocusCapture.js +1 -1
  38. package/docs/kempo/components/Timestamp.js +1 -1
  39. package/docs/kempo/components/Toggle.js +1 -1
  40. package/docs/kempo/index.js +1 -1
  41. package/docs/kempo/utils/formatTimestamp.js +1 -1
  42. package/docs/nav-1.inc.html +16 -2
  43. package/docs/nav.inc.html +10 -2
  44. package/docs/search.json +281 -23
  45. package/docs/styles/_template.html +6 -0
  46. package/docs/styles/borders-spacing.html +6 -0
  47. package/docs/styles/buttons.html +6 -0
  48. package/docs/styles/colors.html +6 -0
  49. package/docs/styles/displays-layouts.html +6 -0
  50. package/docs/styles/embed-1.html +6 -0
  51. package/docs/styles/inputs.html +6 -0
  52. package/docs/styles/tables.html +6 -0
  53. package/docs/styles/typography.html +6 -0
  54. package/docs/{components/stacks.html → utils/_template.html} +11 -30
  55. package/docs/utils/cli.html +84 -0
  56. package/docs/utils/cookie.html +87 -0
  57. package/docs/utils/debounce.html +61 -0
  58. package/docs/utils/drag.html +85 -0
  59. package/docs/utils/element.html +124 -0
  60. package/docs/utils/format-timestamp.html +64 -0
  61. package/docs/utils/fuzzy-match.html +60 -0
  62. package/package.json +1 -1
  63. package/src/components/Accordion.js +0 -1
  64. package/src/components/Dialog.js +3 -2
  65. package/src/components/DirectoryViewer.js +21 -92
  66. package/src/components/FocusCapture.js +2 -1
  67. package/src/components/Search.js +4 -1
  68. package/src/components/Timestamp.js +7 -4
  69. package/src/components/Toggle.js +3 -0
  70. package/src/utils/formatTimestamp.js +26 -10
  71. package/docs/table.html +0 -0
  72. package/src/components/Stacks.js +0 -79
  73. package/src/utils/files.js +0 -15
@@ -6,21 +6,46 @@
6
6
  <title>Dialog - Components - Kempo Docs - A Web Components Solution</title>
7
7
  <link rel="stylesheet" href="../kempo/kempo-vars.css" /><link rel="stylesheet" href="../kempo/kempo-styles.css" />
8
8
  <link rel="stylesheet" href="../kempo/kempo-hljs.css" />
9
+ <script type="module">
10
+ import Icon from '../kempo/components/Icon.js';
11
+ import Search from '../kempo/components/Search.js';
12
+ Icon.pathToIcons = ['../icons'];
13
+ Search.searchDataUrl = '../search.json';
14
+ </script>
9
15
  </head>
10
16
  <body>
11
17
  <k-import src="../nav-1.inc.html"></k-import>
12
18
  <main>
13
19
  <h1 class="ta-center">Dialog</h1>
14
20
 
15
- <h5>Basic Dialog</h5>
16
- <p>Create dialogs using the <code>k-dialog</code> component. Open the dialog by calling the <code>open()</code> method, and close it by calling the <code>close()</code> method. Or it can closed using the dialogs GUI (clicking the overlay, clicking the close button, or the cancel or confirm action buttons).</p>
21
+ <details class="b r mb">
22
+ <summary class="p">Table of Contents</summary>
23
+ <div class="m mt0 pl">
24
+ <h6>Examples</h6>
25
+ <a href="#basicUsage">Basic Usage</a><br />
26
+ <a href="#titles">Titles</a><br />
27
+ <a href="#actionButtons">Action Buttons</a><br />
28
+ <a href="#jsUsage">JavaScript Usage</a><br />
29
+
30
+ <h6 class="mt">JavaScript Reference</h6>
31
+ <a href="#constructor">Constructor</a><br />
32
+ <a href="#requirements">Requirements</a><br />
33
+ <a href="#attributes">Attributes</a><br />
34
+ <a href="#properties">Properties</a><br />
35
+ <a href="#methods">Methods</a><br />
36
+ <a href="#staticMethods">Static Methods</a><br />
37
+ </div>
38
+ </details>
39
+
40
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
41
+ <p>Create dialogs using the <code>k-dialog</code> component. Open the dialog by calling the <code>open()</code> method, and close it by calling the <code>close()</code> method. Or it can be closed using the dialog's GUI (clicking the overlay, clicking the close button, or the cancel or confirm action buttons).</p>
17
42
  <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-dialog</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d1"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>&gt;</span>Hello World<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-dialog</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"doument.getElementById('d1').open()"</span>&gt;</span>Open Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></code></pre>
18
43
  <button class="openDialog mb" data-dialog="d1" slot="right">Open Dialog</button>
19
44
  <k-dialog id="d1">
20
45
  <p class="p">Hello World</p>
21
46
  </k-dialog>
22
47
 
23
- <h5>Titles</h5>
48
+ <h3 id="titles"><a href="#titles" class="no-link">Titles</a></h3>
24
49
  <p>Assign an element to the <code>title</code> slot to have it appear as the dialog title.</p>
25
50
  <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-dialog</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d2"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">h6</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"m0 px"</span><br /> <span class="hljs-attr">slot</span>=<span class="hljs-string">"title"</span><br /> &gt;</span>This is a fact<span class="hljs-tag">&lt;/<span class="hljs-name">h6</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>&gt;</span>A hotdog is a sandwhich<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-dialog</span>&gt;</span></code></pre>
26
51
  <button class="openDialog mb" data-dialog="d2" slot="right">Open Dialog</button>
@@ -34,7 +59,7 @@
34
59
  <p class="p">A hotdog is a sandwhich</p>
35
60
  </k-dialog>
36
61
 
37
- <h5>Action Buttons</h5>
62
+ <h3 id="actionButtons"><a href="#actionButtons" class="no-link">Action Buttons</a></h3>
38
63
  <p>Add a cancel button using the <code>cancel-text</code> attribute.</p>
39
64
  <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-dialog</span><br /> <span class="hljs-attr">id</span>=<span class="hljs-string">"d4"</span><br /> <span class="hljs-attr">cancel-text</span>=<span class="hljs-string">"Absolutly Not"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"p"</span>&gt;</span>Mint and Chocolate belong together<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-dialog</span>&gt;</span></code></pre>
40
65
  <button class="openDialog mb" data-dialog="d4" slot="right">Open Dialog</button>
@@ -66,7 +91,7 @@
66
91
  <p class="p">Ranch is gross</p>
67
92
  </k-dialog>
68
93
 
69
- <h3>JavaScript Usage</h3>
94
+ <h3 id="jsUsage"><a href="#jsUsage" class="no-link">JavaScript Usage</a></h3>
70
95
  <h5>Create Dialog</h5>
71
96
  <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d7"</span>&gt;</span>Open Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/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>, () =&gt; {<br /> Dialog.create(<span class="hljs-string">'&lt;p&gt;Hello World&lt;/p&gt;'</span>);<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
72
97
  <button id="d7" class="mb">Open Dialog</button>
@@ -87,7 +112,122 @@
87
112
  });
88
113
  </script>
89
114
 
115
+ <h3 id="confirmDialog"><a href="#confirmDialog" class="no-link">Confirm Dialog</a></h3>
116
+ <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">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"d9"</span>&gt;</span>Open Confirm Dialog<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Dialog <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/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>, () =&gt; {<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> =&gt;</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">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
118
+ <button id="d9" class="mb">Open Confirm Dialog</button>
119
+ <script type="module">
120
+ import Dialog from '/kempo/components/Dialog.js';
121
+ document.getElementById('d9').addEventListener('click', () => {
122
+ Dialog.confirm("Are you sure you want to proceed?", response => {
123
+ console.log("User response:", response);
124
+ });
125
+ });
126
+ </script>
127
+
128
+ <h2 id="jsRef">JavaScript Reference</h2>
129
+
130
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
131
+ <h6>Extends <a href="./component.html">Component</a></h6>
132
+ <h5>
133
+ <code>new Dialog(options)</code>
134
+ </h5>
135
+
136
+ <h4>Parameters</h4>
137
+ <h5><code>options<i>: object</i></code></h5>
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>
151
+
152
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
153
+ <ul>
154
+ <li><a href="./component.html">Component</a></li>
155
+ </ul>
156
+
157
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
158
+ <h5><code>opened<i>: boolean</i></code></h5>
159
+ <p>Whether the dialog is opened.</p>
160
+ <h5><code>closeBtn<i>: boolean</i></code></h5>
161
+ <p>Whether to show the close button.</p>
162
+ <h5><code>overlayClose<i>: boolean</i></code></h5>
163
+ <p>Whether clicking the overlay closes the dialog.</p>
164
+ <h5><code>confirmText<i>: string</i></code></h5>
165
+ <p>Text for the confirm button.</p>
166
+ <h5><code>confirmClasses<i>: string</i></code></h5>
167
+ <p>Classes for the confirm button.</p>
168
+ <h5><code>cancelText<i>: string</i></code></h5>
169
+ <p>Text for the cancel button.</p>
170
+ <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>
174
+ <h5><code>confirmAction<i>: function</i></code></h5>
175
+ <p>Action to perform on confirm.</p>
176
+ <h5><code>cancelAction<i>: function</i></code></h5>
177
+ <p>Action to perform on cancel.</p>
178
+ <h5><code>closeCallback<i>: function</i></code></h5>
179
+ <p>Callback to execute when the dialog is closed.</p>
180
+
181
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
182
+ <h5><code>open()<i>: void</i></code></h5>
183
+ <p>Opens the dialog.</p>
184
+ <h5><code>close()<i>: void</i></code></h5>
185
+ <p>Closes the dialog.</p>
186
+ <h5><code>toggle()<i>: void</i></code></h5>
187
+ <p>Toggles the dialog open or closed.</p>
188
+ <h5><code>focus()<i>: void</i></code></h5>
189
+ <p>Focuses the first focusable element in the dialog.</p>
190
+ <h5><code>blur()<i>: void</i></code></h5>
191
+ <p>Returns focus to the element that had focus before the dialog was opened.</p>
90
192
 
193
+ <h3 id="staticMethods"><a href="#staticMethods" class="no-link">Static Methods</a></h3>
194
+ <h5><code>create(contents, options)<i>: Dialog</i></code></h5>
195
+ <p>Creates and opens a new dialog with the specified contents and options.</p>
196
+ <h6>Options</h6>
197
+ <ul>
198
+ <li><code>opened</code>: <i>boolean</i> - Whether the dialog is initially opened.</li>
199
+ <li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
200
+ <li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
201
+ <li><code>confirmText</code>: <i>string</i> - Text for the confirm button.</li>
202
+ <li><code>confirmClasses</code>: <i>string</i> - Classes for the confirm button.</li>
203
+ <li><code>confirmAction</code>: <i>function</i> - Action to perform on confirm.</li>
204
+ <li><code>cancelText</code>: <i>string</i> - Text for the cancel button.</li>
205
+ <li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
206
+ <li><code>cancelAction</code>: <i>function</i> - Action to perform on cancel.</li>
207
+ <li><code>closeCallback</code>: <i>function</i> - Callback to execute when the dialog is closed.</li>
208
+ </ul>
209
+ <h5><code>confirm(text, responseCallback, options)<i>: void</i></code></h5>
210
+ <p>Creates and opens a confirmation dialog with the specified text and options.</p>
211
+ <h6>Options</h6>
212
+ <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>
218
+ <li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
219
+ <li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
220
+ </ul>
221
+ <h5><code>error(text, responseCallback, options)<i>: void</i></code></h5>
222
+ <p>Creates and opens an error dialog with the specified text and options.</p>
223
+ <h6>Options</h6>
224
+ <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 cancel button.</li>
227
+ <li><code>cancelClasses</code>: <i>string</i> - Classes for the cancel button.</li>
228
+ <li><code>closeBtn</code>: <i>boolean</i> - Whether to show the close button.</li>
229
+ <li><code>overlayClose</code>: <i>boolean</i> - Whether clicking the overlay closes the dialog.</li>
230
+ </ul>
91
231
 
92
232
  </main>
93
233
  <div style="height:33vh"></div>
@@ -6,17 +6,24 @@
6
6
  <title>Directory Viewer - Components - Kempo Docs - A Web Components Solution</title>
7
7
  <link rel="stylesheet" href="../kempo/kempo-vars.css" /><link rel="stylesheet" href="../kempo/kempo-styles.css" />
8
8
  <link rel="stylesheet" href="../kempo/kempo-hljs.css" />
9
+ <script type="module">
10
+ import Icon from '../kempo/components/Icon.js';
11
+ import Search from '../kempo/components/Search.js';
12
+ Icon.pathToIcons = ['../icons'];
13
+ Search.searchDataUrl = '../search.json';
14
+ </script>
9
15
  </head>
10
16
  <body>
11
17
  <k-import src="../nav-1.inc.html"></k-import>
12
18
  <h1 class="ta-center">Directory Viewer</h1>
13
19
  <main>
14
- <details
15
- class="b r mb"
16
- >
20
+ <details class="b r mb">
17
21
  <summary class="p">Table of Contents</summary>
18
22
  <div class="m mt0 pl">
23
+ <h6>Examples</h6>
19
24
  <a href="#basicUsage">Basic Usage</a><br />
25
+
26
+ <h6 class="mt">JavaScript Reference</h6>
20
27
  <a href="#constructor">Constructor</a><br />
21
28
  <a href="#requirements">Requirements</a><br />
22
29
  <a href="#attributes">Attributes</a><br />
@@ -25,55 +32,59 @@
25
32
  </div>
26
33
  </details>
27
34
 
28
- <h3>Description</h3>
29
- <p>The directory viewer allows the user to select a directory from their local filesystem, and the component allows them to open/close subdirectories and select files.</p>
30
-
31
35
  <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
32
- <div class="row -mx">
33
- <div class="col d-span-6 t-span-6 m-span-12 px">
34
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-directory-viewer</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-directory-viewer</span>&gt;</span></code></pre>
35
- </div>
36
- <div class="col d-span-6 t-span-6 m-span-12 px">
37
- <k-directory-viewer id="dv"></k-directory-viewer>
38
- <script type="module">
39
- await window.customElements.whenDefined('k-directory-viewer');
40
- document.getElementById('dv').addFilter(({kind})=>kind!='file');
41
- document.getElementById('dv').addFilter(({name})=>!name.startsWith('.')&&!name.startsWith('_'));
42
- </script>
43
- </div>
44
- </div>
45
-
36
+ <p>Create a directory viewer using the <code>k-directory-viewer</code> component. Load a directory by calling the <code>loadDirectory()</code> method.</p>
37
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-directory-viewer</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"dv1"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-directory-viewer</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> DirectoryViewer <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/DirectoryViewer.js'</span>;<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'dv1'</span>).loadDirectory();<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
38
+ <k-directory-viewer id="dv1"></k-directory-viewer>
39
+ <script type="module">
40
+ import DirectoryViewer from '/kempo/components/DirectoryViewer.js';
41
+ // document.getElementById('dv1').loadDirectory();
42
+ </script>
46
43
 
44
+ <h2 id="jsRef">JavaScript Reference</h2>
47
45
 
48
46
  <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
49
- <h6>Extends <a href="./lazy-component.html">LazyComponent</a></h6>
47
+ <h6>Extends <a href="./component.html">Component</a></h6>
50
48
  <h5>
51
- <code>new DirectoryViewer()</code><br />
49
+ <code>new DirectoryViewer(handle)</code>
52
50
  </h5>
53
51
 
52
+ <h4>Parameters</h4>
53
+ <h5><code>handle<i>: FileSystemDirectoryHandle</i></code></h5>
54
+ <p>The handle to the directory.</p>
55
+
54
56
  <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
55
57
  <ul>
56
- <li><a href="">class <code>LazyComponent</code></a></li>
57
- <li><a href="">class <code>Component</code></a></li>
58
- <li><a href="">class <code>Icon</code></a></li>
59
- <li><a href="">util <code>element.js</code></a></li>
60
- <li><a href="">util <code>watchDirectoryHandle.js</code></a></li>
58
+ <li><a href="./component.html">Component</a></li>
61
59
  </ul>
62
60
 
61
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
62
+ <h5><code>hasHandle<i>: boolean</i></code></h5>
63
+ <p>Whether the directory viewer has a handle.</p>
64
+ <h5><code>selected<i>: boolean</i></code></h5>
65
+ <p>Whether the directory viewer is selected.</p>
66
+
67
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
68
+ <h5><code>handle<i>: FileSystemDirectoryHandle</i></code></h5>
69
+ <p>The handle to the directory.</p>
70
+ <h5><code>filters<i>: Array</i></code></h5>
71
+ <p>An array of filters applied to the directory viewer.</p>
72
+
63
73
  <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
64
- <h5><code>async selectDirectory()<i>: undefined</i></code></h5>
65
- <p>Opens the directory selection dialog. When a dialog is selected it will render the directory's contents.</p>
66
- <h5><code>open()<i>: undefined</i></code></h5>
67
- <p>Opens the directory, this should only be called on auto-generated sub-directories.</p>
68
- <h5><code>close()<i>: undefined</i></code></h5>
69
- <p>Closes the directory, this should only be called on auto-generated sub-directories.</p>
70
- <h5><code>toggleOpen()<i>: undefined</i></code></h5>
71
- <p>Opens/Closes the directory, this should only be called on auto-generated sub-directories.</p>
72
- <h5><code>clearDirectoryHandle()<i>: undefined</i></code></h5>
73
- <p>Clears the handle that represents the user selected directory, allowing the user to choose a new directory.</p>
74
-
74
+ <h5><code>loadDirectory()<i>: Promise</i></code></h5>
75
+ <p>Loads a directory using the file picker API.</p>
76
+ <h5><code>clearDirectoryHandle()<i>: void</i></code></h5>
77
+ <p>Clears the directory handle.</p>
78
+ <h5><code>updateContents()<i>: void</i></code></h5>
79
+ <p>Updates the contents of the directory viewer.</p>
80
+ <h5><code>select()<i>: void</i></code></h5>
81
+ <p>Selects the directory viewer.</p>
82
+ <h5><code>addFilter(filter)<i>: void</i></code></h5>
83
+ <p>Adds a filter to the directory viewer.</p>
84
+
75
85
  </main>
76
- <script type="module" src="../kempo/components/Import.js"></script>
77
- <script type="module" src="../kempo/components/DirectoryViewer.js"></script>
86
+ <div style="height:33vh"></div>
87
+ <script type="module" src="../kempo/components/Import.js"></script>
88
+ <script type="module" src="../kempo/components/DirectoryViewer.js"></script>
78
89
  </body>
79
90
  </html>
@@ -0,0 +1,68 @@
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>FocusCapture - Components - Kempo Docs - A Web Components Solution</title>
7
+ <link rel="stylesheet" href="../kempo/kempo-vars.css" /><link rel="stylesheet" href="../kempo/kempo-styles.css" />
8
+ <link rel="stylesheet" href="../kempo/kempo-hljs.css" />
9
+ <script type="module">
10
+ import Icon from '../kempo/components/Icon.js';
11
+ import Search from '../kempo/components/Search.js';
12
+ Icon.pathToIcons = ['../icons'];
13
+ Search.searchDataUrl = '../search.json';
14
+ </script>
15
+ </head>
16
+ <body>
17
+ <k-import src="../nav-1.inc.html"></k-import>
18
+ <h1 class="ta-center">FocusCapture</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>Examples</h6>
24
+ <a href="#basicUsage">Basic Usage</a><br />
25
+
26
+ <h6 class="mt">JavaScript Reference</h6>
27
+ <a href="#constructor">Constructor</a><br />
28
+ <a href="#requirements">Requirements</a><br />
29
+ <a href="#attributes">Attributes</a><br />
30
+ <a href="#properties">Properties</a><br />
31
+ <a href="#methods">Methods</a><br />
32
+ </div>
33
+ </details>
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
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
39
+ <p>Use the <code>FocusCapture</code> component to capture focus within the component. When the focus moves out of the component, it will automatically move back to the first focusable element inside the component.</p>
40
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-focus-capture</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Button 1<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Button 2<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-focus-capture</span>&gt;</span></code></pre>
41
+ <k-focus-capture>
42
+ <button>Button 1</button>
43
+ <button>Button 2</button>
44
+ </k-focus-capture>
45
+
46
+ <h2 id="jsRef">JavaScript Reference</h2>
47
+
48
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
49
+ <h6>Extends <a href="./lazy-component.html">LazyComponent</a></h6>
50
+ <h5>
51
+ <code>new FocusCapture()</code>
52
+ </h5>
53
+
54
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
55
+ <ul>
56
+ <li><a href="./lazy-component.html">LazyComponent</a></li>
57
+ </ul>
58
+
59
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
60
+ <p>The <code>FocusCapture</code> class does not introduce any new attributes beyond those provided by the <a href="./lazy-component.html">LazyComponent</a> class.</p>
61
+
62
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
63
+ <p>The <code>FocusCapture</code> class does not introduce any new methods beyond those provided by the <a href="./lazy-component.html">LazyComponent</a> class.</p>
64
+
65
+ </main>
66
+ <script type="module" src="../kempo/components/Import.js"></script>
67
+ </body>
68
+ </html>
@@ -6,12 +6,49 @@
6
6
  <title>Icon - Components - Kempo Docs - A Web Components Solution</title>
7
7
  <link rel="stylesheet" href="../kempo/kempo-vars.css" /><link rel="stylesheet" href="../kempo/kempo-styles.css" />
8
8
  <link rel="stylesheet" href="../kempo/kempo-hljs.css" />
9
+ <script type="module">
10
+ import Icon from '../kempo/components/Icon.js';
11
+ import Search from '../kempo/components/Search.js';
12
+ Icon.pathToIcons = ['../icons'];
13
+ Search.searchDataUrl = '../search.json';
14
+ </script>
9
15
  </head>
10
16
  <body>
11
17
  <k-import src="../nav-1.inc.html"></k-import>
12
18
  <h1 class="ta-center">Icon</h1>
13
19
  <main>
14
- <p>Icons are SVG files that live in a directory accessible to your website, by default this is in <code>/kempo/icons</code>. In these examples the "name" is the filename without the file extension (<code>.svg</code>).</p>
20
+ <details class="b r mb">
21
+ <summary class="p">Table of Contents</summary>
22
+ <div class="m mt0 pl">
23
+ <h6>Examples</h6>
24
+ <a href="#basicUsage">Basic Usage</a><br />
25
+ <a href="#explicitSource">Explicitly Set the Source</a><br />
26
+ <a href="#fallbackIcon">Fallback Icon</a><br />
27
+ <a href="#changingIconDirectory">Changing the Icon Directory Location</a><br />
28
+ <a href="#addingIcons">Adding Icons</a><br />
29
+ <a href="#updatingIconDirectoryPath">Updating the Icon Directory Path</a><br />
30
+
31
+ <h6 class="mt">JavaScript Reference</h6>
32
+ <a href="#constructor">Constructor</a><br />
33
+ <a href="#requirements">Requirements</a><br />
34
+ <a href="#attributes">Attributes</a><br />
35
+ <a href="#properties">Properties</a><br />
36
+ <a href="#methods">Methods</a><br />
37
+ </div>
38
+ </details>
39
+
40
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
41
+ <p>Create an icon using the <code>k-icon</code> component. You can specify the icon by setting the <code>name</code> or <code>src</code> attribute.</p>
42
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"folder"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">k-icon</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"/path/to/icon.svg"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span></code></pre>
43
+ <div class="row -mx mb">
44
+ <div class="col d-span-6 m-span-12 px">
45
+ <k-icon name="folder"></k-icon>
46
+ </div>
47
+ <div class="col d-span-6 m-span-12 px">
48
+ <k-icon src="/path/to/icon.svg"></k-icon>
49
+ </div>
50
+ </div>
51
+
15
52
  <div class="row -mx mb">
16
53
  <div class="col d-span-6 m-span-12 px">
17
54
  <k-card label="HTML">
@@ -28,7 +65,7 @@
28
65
  </div>
29
66
  </div>
30
67
 
31
- <h3>Explicity set the Source</h3>
68
+ <h3 id="explicitSource"><a href="#explicitSource" class="no-link">Explicitly Set the Source</a></h3>
32
69
  <p>You can use any svg file that is publically available (on your site or any other public domain) buy using the <code>src</code> attribute instead of <code>name</code>. The code will attempt to ensure compatability.</p>
33
70
  <div class="row -mx mb">
34
71
  <div class="col d-span-6 m-span-12 px">
@@ -43,7 +80,7 @@
43
80
  </div>
44
81
  </div>
45
82
 
46
- <h3>Fallback Icon</h3>
83
+ <h3 id="fallbackIcon"><a href="#fallbackIcon" class="no-link">Fallback Icon</a></h3>
47
84
  <p>Put an SVG inside of the <code>k-icon</code> to be the fallback if one is not found that matches the provided name or source. Otherwise a <k-icon></k-icon> will be the fallback icon.</p>
48
85
  <div class="row -mx mb">
49
86
  <div class="col d-span-6 m-span-12 px">
@@ -61,11 +98,11 @@
61
98
  </div>
62
99
  </div>
63
100
 
64
- <h3>Changing the icon directory location</h3>
101
+ <h3 id="changingIconDirectory"><a href="#changingIconDirectory" class="no-link">Changing the Icon Directory Location</a></h3>
65
102
  <p>To change the location of the directory holding the icons import the <code>Icon</code> class, and set the static member <code>pathToIcons</code> to point to the correct location, do this before icons are loaded (for example in the head of the document).</p>
66
103
  <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Icon <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Icon.js'</span>;<br /> Icon.pathToIcons = <span class="hljs-string">'./pathTo/icons'</span>;<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
67
104
 
68
- <h3>Adding Icons</h3>
105
+ <h3 id="addingIcons"><a href="#addingIcons" class="no-link">Adding Icons</a></h3>
69
106
  <p>Add your SVGs to the directory, remove the <code>height</code> and <code>width</code> attributes from the <code>svg</code> tag (if you do not, the Icon component will attempt to do it for you). The height and width will be managed by CSS to match the font-size. Give all objects (path, rect, circle) a fill of <code>currentColor</code>, this will allow the icon to adapt to the font color where it is rendered.</p>
70
107
  <div class="row -mx mb">
71
108
  <div class="col d-span-6 m-span-12 px">
@@ -79,9 +116,43 @@
79
116
  </k-card>
80
117
  </div>
81
118
  </div>
119
+
120
+ <h3 id="updatingIconDirectoryPath"><a href="#updatingIconDirectoryPath" class="no-link">Updating the Icon Directory Path</a></h3>
121
+ <p>To change the location of the directory holding the icons, import the <code>Icon</code> class, and set the static member <code>pathToIcons</code> to point to the correct location. Do this before icons are loaded (for example, in the head of the document).</p>
122
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">import</span> Icon <span class="hljs-keyword">from</span> <span class="hljs-string">'/kempo/components/Icon.js'</span>;<br /> Icon.pathToIcons = [<span class="hljs-string">'./pathTo/icons'</span>];<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
123
+
124
+ <h2 id="jsRef">JavaScript Reference</h2>
125
+
126
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
127
+ <h6>Extends <a href="./component.html">Component</a></h6>
128
+ <h5>
129
+ <code>new Icon()</code><br />
130
+ <code>new Icon(<i>string</i> name)</code>
131
+ </h5>
132
+
133
+ <h4>Parameters</h4>
134
+ <h5><code>name<i>: string</i></code></h5>
135
+ <p>The name of the icon.</p>
136
+
137
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
138
+ <ul>
139
+ <li><a href="./component.html">Component</a></li>
140
+ </ul>
141
+
142
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
143
+ <h5><code>name<i>: string</i></code></h5>
144
+ <p>The name of the icon.</p>
145
+ <h5><code>src<i>: string</i></code></h5>
146
+ <p>The source URL of the icon.</p>
147
+
148
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
149
+ <h5><code>pathToIcons<i>: Array</i></code></h5>
150
+ <p>An array of paths to directories containing icons.</p>
151
+
82
152
  </main>
83
153
  <div style="height:33vh"></div>
84
154
  <script type="module" src="../kempo/components/Import.js"></script>
85
155
  <script type="module" src="../kempo/components/Card.js"></script>
156
+ <script type="module" src="../kempo/components/Icon.js"></script>
86
157
  </body>
87
158
  </html>
@@ -6,11 +6,32 @@
6
6
  <title>Import - Components - Kempo Docs - A Web Components Solution</title>
7
7
  <link rel="stylesheet" href="../kempo/kempo-vars.css" /><link rel="stylesheet" href="../kempo/kempo-styles.css" />
8
8
  <link rel="stylesheet" href="../kempo/kempo-hljs.css" />
9
+ <script type="module">
10
+ import Icon from '../kempo/components/Icon.js';
11
+ import Search from '../kempo/components/Search.js';
12
+ Icon.pathToIcons = ['../icons'];
13
+ Search.searchDataUrl = '../search.json';
14
+ </script>
9
15
  </head>
10
16
  <body>
11
17
  <k-import src="../nav-1.inc.html"></k-import>
12
18
  <h1 class="ta-center">Import</h1>
13
19
  <main>
20
+ <details class="b r mb">
21
+ <summary class="p">Table of Contents</summary>
22
+ <div class="m mt0 pl">
23
+ <h6>Examples</h6>
24
+ <a href="#basicUsage">Basic Usage</a><br />
25
+
26
+ <h6 class="mt">JavaScript Reference</h6>
27
+ <a href="#constructor">Constructor</a><br />
28
+ <a href="#requirements">Requirements</a><br />
29
+ <a href="#attributes">Attributes</a><br />
30
+ <a href="#properties">Properties</a><br />
31
+ <a href="#methods">Methods</a><br />
32
+ </div>
33
+ </details>
34
+
14
35
  <h3>What is an import</h3>
15
36
  <p>Import commonly used HTML snippets.</p>
16
37
  <k-card label="import-me.html">
@@ -22,6 +43,32 @@
22
43
  <k-card label="Results">
23
44
  <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-import</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"import-me.html"</span> <span class="hljs-attr">rendered</span>=<span class="hljs-string">"true"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>I am html<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-import</span>&gt;</span></code></pre>
24
45
  </k-card>
46
+
47
+ <h2 id="jsRef">JavaScript Reference</h2>
48
+
49
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
50
+ <h6>Extends <a href="./component.html">Component</a></h6>
51
+ <h5>
52
+ <code>new Import()</code>
53
+ </h5>
54
+
55
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
56
+ <ul>
57
+ <li><a href="./component.html">Component</a></li>
58
+ </ul>
59
+
60
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
61
+ <h5><code>src<i>: string</i></code></h5>
62
+ <p>The source URL of the HTML snippet to import.</p>
63
+
64
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
65
+ <h5><code>src<i>: string</i></code></h5>
66
+ <p>The source URL of the HTML snippet to import.</p>
67
+
68
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
69
+ <h5><code>load()<i>: Promise</i></code></h5>
70
+ <p>Loads the HTML snippet from the specified source URL.</p>
71
+
25
72
  </main>
26
73
  <div style="height:33vh"></div>
27
74
  <script type="module" src="../kempo/components/Import.js"></script>