kempo 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/.gitattributes +2 -0
  2. package/LICENSE +21 -0
  3. package/README.md +2 -0
  4. package/dist/components/Card.js +1 -0
  5. package/dist/components/CodeEditor.js +1 -0
  6. package/dist/components/Component.js +1 -0
  7. package/dist/components/Dialog.js +1 -0
  8. package/dist/components/FocusCapture.js +1 -0
  9. package/dist/components/Icon.js +1 -0
  10. package/dist/components/Import.js +1 -0
  11. package/dist/components/LazyComponent.js +1 -0
  12. package/dist/components/ReactiveComponent.js +1 -0
  13. package/dist/components/ReactiveLazyComponent.js +1 -0
  14. package/dist/components/Resize.js +1 -0
  15. package/dist/components/Search.js +1 -0
  16. package/dist/components/ShowMore.js +1 -0
  17. package/dist/components/SideMenu.js +1 -0
  18. package/dist/components/Split.js +1 -0
  19. package/dist/components/Tabs.js +1 -0
  20. package/dist/components/ThemeSwitcher.js +1 -0
  21. package/dist/components/Timestamp.js +1 -0
  22. package/dist/components/WebSnippetEditor.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/kempo-hljs.css +1 -0
  25. package/dist/kempo-styles.css +1 -0
  26. package/dist/kempo-vars.css +1 -0
  27. package/dist/kempo.css +1 -0
  28. package/dist/kempo.js +1 -0
  29. package/dist/utils/cli.js +1 -0
  30. package/dist/utils/cookie.js +1 -0
  31. package/dist/utils/debounce.js +1 -0
  32. package/dist/utils/drag.js +1 -0
  33. package/dist/utils/element.js +1 -0
  34. package/dist/utils/formatTimestamp.js +1 -0
  35. package/dist/utils/fuzzyMatch.js +1 -0
  36. package/dist/utils/getPreferredTheme.js +1 -0
  37. package/dist/utils/loadCss.js +1 -0
  38. package/dist/utils/loadScript.js +1 -0
  39. package/dist/utils/object.js +1 -0
  40. package/dist/utils/string.js +1 -0
  41. package/dist/utils/toFunction.js +1 -0
  42. package/dist/utils/type.js +1 -0
  43. package/dist/utils/waitFrames.js +1 -0
  44. package/docs/components/_template.html +22 -0
  45. package/docs/components/card.html +35 -0
  46. package/docs/components/codeeditor.html +29 -0
  47. package/docs/components/component.html +88 -0
  48. package/docs/components/dialog.html +89 -0
  49. package/docs/components/icon.html +73 -0
  50. package/docs/components/import.html +34 -0
  51. package/docs/components/lazycomponent.html +50 -0
  52. package/docs/components/resize.html +107 -0
  53. package/docs/components/show-more.html +92 -0
  54. package/docs/components/sidemenu.html +97 -0
  55. package/docs/components/split.html +70 -0
  56. package/docs/components/tabs.html +33 -0
  57. package/docs/components/websnippeteditor.html +42 -0
  58. package/docs/index.html +17 -0
  59. package/docs/kempo/components/Card.js +1 -0
  60. package/docs/kempo/components/CodeEditor.js +1 -0
  61. package/docs/kempo/components/Collapse.js +1 -0
  62. package/docs/kempo/components/Component.js +1 -0
  63. package/docs/kempo/components/Dialog.js +1 -0
  64. package/docs/kempo/components/FocusCapture.js +1 -0
  65. package/docs/kempo/components/Icon.js +1 -0
  66. package/docs/kempo/components/Import.js +1 -0
  67. package/docs/kempo/components/LazyComponent.js +1 -0
  68. package/docs/kempo/components/ReactiveComponent.js +1 -0
  69. package/docs/kempo/components/ReactiveLazyComponent.js +1 -0
  70. package/docs/kempo/components/Resize.js +1 -0
  71. package/docs/kempo/components/Search.js +1 -0
  72. package/docs/kempo/components/ShowMore.js +1 -0
  73. package/docs/kempo/components/SideMenu.js +1 -0
  74. package/docs/kempo/components/Split.js +1 -0
  75. package/docs/kempo/components/Tabs.js +1 -0
  76. package/docs/kempo/components/ThemeSwitcher.js +1 -0
  77. package/docs/kempo/components/Timestamp.js +1 -0
  78. package/docs/kempo/components/WebSnippetEditor.js +1 -0
  79. package/docs/kempo/icons/arrow-down-double.svg +1 -0
  80. package/docs/kempo/icons/arrow-up-double.svg +1 -0
  81. package/docs/kempo/icons/close.svg +2 -0
  82. package/docs/kempo/icons/compare.svg +1 -0
  83. package/docs/kempo/icons/dark-mode.svg +1 -0
  84. package/docs/kempo/icons/delete.svg +1 -0
  85. package/docs/kempo/icons/filter-off.svg +1 -0
  86. package/docs/kempo/icons/filter.svg +1 -0
  87. package/docs/kempo/icons/light-mode.svg +1 -0
  88. package/docs/kempo/icons/menu.svg +1 -0
  89. package/docs/kempo/icons/pause.svg +1 -0
  90. package/docs/kempo/icons/play.svg +1 -0
  91. package/docs/kempo/icons/search.svg +1 -0
  92. package/docs/kempo/icons/settings.svg +1 -0
  93. package/docs/kempo/icons/storage.svg +1 -0
  94. package/docs/kempo/icons/trash-x.svg +1 -0
  95. package/docs/kempo/index.js +1 -0
  96. package/docs/kempo/kempo-hljs.css +1 -0
  97. package/docs/kempo/kempo-styles.css +1 -0
  98. package/docs/kempo/kempo-vars.css +1 -0
  99. package/docs/kempo/kempo.css +1 -0
  100. package/docs/kempo/kempo.js +1 -0
  101. package/docs/kempo/utils/cli.js +1 -0
  102. package/docs/kempo/utils/cookie.js +1 -0
  103. package/docs/kempo/utils/debounce.js +1 -0
  104. package/docs/kempo/utils/drag.js +1 -0
  105. package/docs/kempo/utils/element.js +1 -0
  106. package/docs/kempo/utils/formatTimestamp.js +1 -0
  107. package/docs/kempo/utils/fuzzyMatch.js +1 -0
  108. package/docs/kempo/utils/getPreferredTheme.js +1 -0
  109. package/docs/kempo/utils/loadCss.js +1 -0
  110. package/docs/kempo/utils/loadScript.js +1 -0
  111. package/docs/kempo/utils/object.js +1 -0
  112. package/docs/kempo/utils/string.js +1 -0
  113. package/docs/kempo/utils/toFunction.js +1 -0
  114. package/docs/kempo/utils/type.js +1 -0
  115. package/docs/kempo/utils/waitFrames.js +1 -0
  116. package/docs/nav-1.inc.html +66 -0
  117. package/docs/nav.inc.html +66 -0
  118. package/docs/search.json +94 -0
  119. package/docs/styles/_template.html +22 -0
  120. package/docs/styles/borders-spacing.html +193 -0
  121. package/docs/styles/buttons.html +113 -0
  122. package/docs/styles/colors.html +65 -0
  123. package/docs/styles/displays-layouts.html +156 -0
  124. package/docs/styles/embed-1.html +35 -0
  125. package/docs/styles/inputs.html +89 -0
  126. package/docs/styles/tables.html +143 -0
  127. package/docs/styles/typography.html +116 -0
  128. package/icons/arrow-down-double.svg +1 -0
  129. package/icons/arrow-up-double.svg +1 -0
  130. package/icons/close.svg +2 -0
  131. package/icons/compare.svg +1 -0
  132. package/icons/dark-mode.svg +1 -0
  133. package/icons/delete.svg +1 -0
  134. package/icons/filter-off.svg +1 -0
  135. package/icons/filter.svg +1 -0
  136. package/icons/light-mode.svg +1 -0
  137. package/icons/menu.svg +1 -0
  138. package/icons/pause.svg +1 -0
  139. package/icons/play.svg +1 -0
  140. package/icons/search.svg +1 -0
  141. package/icons/settings.svg +1 -0
  142. package/icons/storage.svg +1 -0
  143. package/icons/trash-x.svg +1 -0
  144. package/kempo/components/Card.js +65 -0
  145. package/kempo/components/CodeEditor.js +141 -0
  146. package/kempo/components/Component.js +109 -0
  147. package/kempo/components/Dialog.js +277 -0
  148. package/kempo/components/FocusCapture.js +30 -0
  149. package/kempo/components/Icon.js +60 -0
  150. package/kempo/components/Import.js +40 -0
  151. package/kempo/components/LazyComponent.js +40 -0
  152. package/kempo/components/ReactiveComponent.js +11 -0
  153. package/kempo/components/ReactiveLazyComponent.js +11 -0
  154. package/kempo/components/Resize.js +168 -0
  155. package/kempo/components/Search.js +136 -0
  156. package/kempo/components/ShowMore.js +82 -0
  157. package/kempo/components/SideMenu.js +156 -0
  158. package/kempo/components/Split.js +133 -0
  159. package/kempo/components/Tabs.js +254 -0
  160. package/kempo/components/ThemeSwitcher.js +77 -0
  161. package/kempo/components/Timestamp.js +25 -0
  162. package/kempo/components/WebSnippetEditor.js +159 -0
  163. package/kempo/kempo-hljs.css +145 -0
  164. package/kempo/kempo-styles.css +893 -0
  165. package/kempo/kempo-vars.css +154 -0
  166. package/kempo/kempo.js +48 -0
  167. package/kempo/utils/cli.js +54 -0
  168. package/kempo/utils/cookie.js +16 -0
  169. package/kempo/utils/debounce.js +9 -0
  170. package/kempo/utils/drag.js +74 -0
  171. package/kempo/utils/element.js +69 -0
  172. package/kempo/utils/formatTimestamp.js +11 -0
  173. package/kempo/utils/fuzzyMatch.js +55 -0
  174. package/kempo/utils/getPreferredTheme.js +1 -0
  175. package/kempo/utils/loadCss.js +10 -0
  176. package/kempo/utils/loadScript.js +10 -0
  177. package/kempo/utils/object.js +177 -0
  178. package/kempo/utils/string.js +54 -0
  179. package/kempo/utils/toFunction.js +24 -0
  180. package/kempo/utils/type.js +8 -0
  181. package/kempo/utils/waitFrames.js +17 -0
  182. package/package.json +33 -0
  183. package/scripts/build.js +131 -0
  184. package/scripts/docs.js +14 -0
  185. package/test/components/SuiteList.js +26 -0
  186. package/test/components/Test.js +357 -0
  187. package/test/index.html +49 -0
  188. package/test/index.js +25 -0
  189. package/test/suite.html +45 -0
  190. package/test/suites.inc.html +4 -0
  191. package/test/tests/components/Component.test.js +138 -0
  192. package/test/tests/utils/cli.test.js +113 -0
  193. package/test/tests/utils/cookie.test.js +87 -0
  194. package/test/tests/utils/debounce.test.js +71 -0
@@ -0,0 +1,89 @@
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>Dialog - 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
+ </head>
10
+ <body>
11
+ <k-import src="../nav-1.inc.html"></k-import>
12
+ <main>
13
+ <h1 class="ta-center">Dialog</h1>
14
+
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>
17
+ <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
+ <button class="openDialog mb" data-dialog="d1" slot="right">Open Dialog</button>
19
+ <k-dialog id="d1">
20
+ <p class="p">Hello World</p>
21
+ </k-dialog>
22
+
23
+ <h5>Titles</h5>
24
+ <p>Assign an element to the <code>title</code> slot to have it appear as the dialog title.</p>
25
+ <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
+ <button class="openDialog mb" data-dialog="d2" slot="right">Open Dialog</button>
27
+ <k-dialog
28
+ id="d2"
29
+ >
30
+ <h6
31
+ class="m0 px"
32
+ slot="title"
33
+ >This is a fact</h6>
34
+ <p class="p">A hotdog is a sandwhich</p>
35
+ </k-dialog>
36
+
37
+ <h5>Action Buttons</h5>
38
+ <p>Add a cancel button using the <code>cancel-text</code> attribute.</p>
39
+ <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
+ <button class="openDialog mb" data-dialog="d4" slot="right">Open Dialog</button>
41
+ <k-dialog
42
+ id="d4"
43
+ cancel-text="Absolutly Not"
44
+ >
45
+ <p class="p">Mint and Chocolate belong together</p>
46
+ </k-dialog>
47
+
48
+ <p>Add a confirm button using the <code>confirm-text</code> attribute.</p>
49
+ <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">"d5"</span><br /> <span class="hljs-attr">confirm-text</span>=<span class="hljs-string">"Confirm"</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>Spaghetti is the greatest food<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>
50
+ <button class="openDialog mb" data-dialog="d5" slot="right">Open Dialog</button>
51
+ <k-dialog
52
+ id="d5"
53
+ confirm-text="Confirm"
54
+ >
55
+ <p class="p">Spaghetti is the greatest food</p>
56
+ </k-dialog>
57
+
58
+ <p>Try it with both a cancel and confirm button.</p>
59
+ <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">"d6"</span><br /> <span class="hljs-attr">cancel-text</span>=<span class="hljs-string">"It should be outlawed"</span><br /> <span class="hljs-attr">confirm-text</span>=<span class="hljs-string">"Of course it is"</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>Ranch is gross<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>
60
+ <button class="openDialog mb" data-dialog="d6" slot="right">Open Dialog</button>
61
+ <k-dialog
62
+ id="d6"
63
+ cancel-text="It should be outlawed"
64
+ confirm-text="Of course it is"
65
+ >
66
+ <p class="p">Ranch is gross</p>
67
+ </k-dialog>
68
+
69
+
70
+
71
+ </main>
72
+ <div style="height:33vh"></div>
73
+ <script type="module">
74
+ import Icon from '../kempo/components/Icon.js';
75
+ Icon.pathToIcons = '../kempo/icons';
76
+ </script>
77
+ <script type="module" src="../kempo/components/Import.js"></script>
78
+ <script type="module" src="../kempo/components/Dialog.js"></script>
79
+ <script>
80
+ document.querySelectorAll('.openDialog').forEach( $btn => {
81
+ $btn.addEventListener('click', () => {
82
+ const $dialog = document.getElementById($btn.dataset.dialog);
83
+ console.log($dialog);
84
+ if($dialog) $dialog.open();
85
+ });
86
+ });
87
+ </script>
88
+ </body>
89
+ </html>
@@ -0,0 +1,73 @@
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>Icon - 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
+ </head>
10
+ <body>
11
+ <k-import src="../nav-1.inc.html"></k-import>
12
+ <h1 class="ta-center">Icon</h1>
13
+ <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>
15
+ <div class="row -mx mb">
16
+ <div class="col d-span-6 m-span-12 px">
17
+ <k-card label="HTML">
18
+ <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">"menu"</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">name</span>=<span class="hljs-string">"close"</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">name</span>=<span class="hljs-string">"play"</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">name</span>=<span class="hljs-string">"pause"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span></code></pre>
19
+ </k-card>
20
+ </div>
21
+ <div class="col d-span-6 m-span-12 px">
22
+ <k-card label="Output*">
23
+ <k-icon name="menu"></k-icon>
24
+ <k-icon name="close"></k-icon>
25
+ <k-icon name="play"></k-icon>
26
+ <k-icon name="pause"></k-icon>
27
+ </k-card>
28
+ </div>
29
+ </div>
30
+
31
+ <h3>Explicity set the Source</h3>
32
+ <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
+ <div class="row -mx mb">
34
+ <div class="col d-span-6 m-span-12 px">
35
+ <k-card label="HTML">
36
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-icon</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/wysiwyg/default/24px.svg"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span></code></pre>
37
+ </k-card>
38
+ </div>
39
+ <div class="col d-span-6 m-span-12 px">
40
+ <k-card label="Output*">
41
+ <k-icon src="https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/wysiwyg/default/24px.svg"></k-icon>
42
+ </k-card>
43
+ </div>
44
+ </div>
45
+
46
+ <h3>Changing the icon directory location</h3>
47
+ <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>
48
+ <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>
49
+
50
+ <h3>Adding Icons</h3>
51
+ <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>
52
+ <div class="row -mx mb">
53
+ <div class="col d-span-6 m-span-12 px">
54
+ <k-card label="Before">
55
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">svg</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 -960 960 960"</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"24"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"24"</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">path</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M480-200 240-440l56-56 184 183 184-183 56 56-240 240Zm0-240L240-680l56-56 184 183 184-183 56 56-240 240Z"</span>/&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">svg</span>&gt;</span></code></pre>
56
+ </k-card>
57
+ </div>
58
+ <div class="col d-span-6 m-span-12 px">
59
+ <k-card label="After">
60
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">svg</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.w3.org/2000/svg"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 -960 960 960"</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">path</span> <span class="hljs-attr">fill</span>=<span class="hljs-string">"currentColor"</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M480-200 240-440l56-56 184 183 184-183 56 56-240 240Zm0-240L240-680l56-56 184 183 184-183 56 56-240 240Z"</span>/&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">svg</span>&gt;</span></code></pre>
61
+ </k-card>
62
+ </div>
63
+ </div>
64
+ </main>
65
+ <div style="height:33vh"></div>
66
+ <script type="module">
67
+ import Icon from '../kempo/components/Icon.js';
68
+ Icon.pathToIcons = '../kempo/icons';
69
+ </script>
70
+ <script type="module" src="../kempo/components/Import.js"></script>
71
+ <script type="module" src="../kempo/components/Card.js"></script>
72
+ </body>
73
+ </html>
@@ -0,0 +1,34 @@
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>Import - 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
+ </head>
10
+ <body>
11
+ <k-import src="../nav-1.inc.html"></k-import>
12
+ <h1 class="ta-center">Import</h1>
13
+ <main>
14
+ <h3>What is an import</h3>
15
+ <p>Import commonly used HTML snippets.</p>
16
+ <k-card label="import-me.html">
17
+ <pre><code class="hljs xml"><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></code></pre>
18
+ </k-card>
19
+ <k-card label="HTML">
20
+ <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>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-import</span>&gt;</span></code></pre>
21
+ </k-card>
22
+ <k-card label="Results">
23
+ <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
+ </k-card>
25
+ </main>
26
+ <div style="height:33vh"></div>
27
+ <script type="module">
28
+ import Icon from '../kempo/components/Icon.js';
29
+ Icon.pathToIcons = '../kempo/icons';
30
+ </script>
31
+ <script type="module" src="../kempo/components/Import.js"></script>
32
+ <script type="module" src="../kempo/components/Card.js"></script>
33
+ </body>
34
+ </html>
@@ -0,0 +1,50 @@
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>LazyComponent - 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
+ </head>
10
+ <body>
11
+ <k-import src="../nav-1.inc.html"></k-import>
12
+ <h1 class="ta-center">LazyComponent</h1>
13
+ <main>
14
+ <details
15
+ class="b r mb"
16
+ >
17
+ <summary class="p">Table of Contents</summary>
18
+ <div class="m mt0 pl">
19
+ <a href="#constructor">Constructor</a><br />
20
+ <a href="#requirements">Requirements</a><br />
21
+ <a href="#attributes">Attributes</a><br />
22
+ <a href="#properties">Properties</a><br />
23
+ <a href="#methods">Methods</a><br />
24
+ </div>
25
+ </details>
26
+
27
+ <h3>Description</h3>
28
+ <p>This is a base class like <a href="./component.html">component</a> but the <code>render</code> method is not called until the element is visible (in the view), a skeleton is rendered until then.</p>
29
+
30
+ <h3 id="requirements">Requirements</h3>
31
+ <ul>
32
+ <li><a href="">Component Class</a></li>
33
+ <li><a href="">isInView Utility Function</a></li>
34
+ </ul>
35
+ <h3 id="constructor">Constructor</h3>
36
+ <h6>Extends <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement" target="_blank">HTMLElement</a></h6>
37
+ <h5>
38
+ <code>super()</code><br />
39
+ <code>super(<i>Object shadowOptions</i>)</code>
40
+ </h5>
41
+ <p>This class <b class="tc-danger">can not</b> be instatiated directly, but rather <b class="tc-success">should be</b> extended, optionally passing in the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow#options" target="_blank">shadowOptions</a>.</p>
42
+
43
+ </main>
44
+ <script type="module">
45
+ import Icon from '../kempo/components/Icon.js';
46
+ Icon.pathToIcons = '../kempo/icons';
47
+ </script>
48
+ <script type="module" src="../kempo/components/Import.js"></script>
49
+ </body>
50
+ </html>
@@ -0,0 +1,107 @@
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>Resize - 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
+ </head>
10
+ <body>
11
+ <k-import src="../nav-1.inc.html"></k-import>
12
+ <h1 class="ta-center">Resize</h1>
13
+ <main>
14
+ <h3>Basic Usage</h3>
15
+ <p>Set the initial height and width using normal styles.</p>
16
+ <div class="row -mx mb">
17
+ <div class="col d-span-6 m-span-12 px">
18
+ <k-card label="HTML">
19
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-resize</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 200px; width: 200px;"</span><br />&gt;</span><br /> Resize Me<br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-resize</span>&gt;</span></code></pre>
20
+ </k-card>
21
+ </div>
22
+ <div class="col d-span-6 m-span-12 px">
23
+ <k-card label="Output*" class="pb">
24
+ <k-resize
25
+ style="height: 200px; width: 200px;"
26
+ >
27
+ <p class="p">
28
+ Resize Me
29
+ </p>
30
+ </k-resize>
31
+ </k-card>
32
+ </div>
33
+ </div>
34
+ <p>Set the minimum and maximum height and width using normal styles. The default min-height and min-width is <code>10rem</code> and the default max-height and max-width is <code>100%</code>.</p>
35
+ <div class="row -mx mb">
36
+ <div class="col d-span-6 m-span-12 px">
37
+ <k-card label="HTML">
38
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-resize</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"min-height: 100px; height: 200px; max-height: 300px; min-width: 100px; width: 200px; max-width: 300px;"</span><br />&gt;</span><br /> Resize Me<br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-resize</span>&gt;</span></code></pre>
39
+ </k-card>
40
+ </div>
41
+ <div class="col d-span-6 m-span-12 px">
42
+ <k-card label="Output*" class="pb">
43
+ <k-resize
44
+ style="min-height: 100px; height: 200px; max-height: 300px; min-width: 100px; width: 200px; max-width: 300px;"
45
+ >
46
+ <p class="p">
47
+ Resize Me
48
+ </p>
49
+ </k-resize>
50
+ </k-card>
51
+ </div>
52
+ </div>
53
+
54
+ <h3>Resize Dimention</h3>
55
+ <div class="row -mx mb">
56
+ <div class="col d-span-6 m-span-12 px">
57
+ <k-card label="HTML">
58
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-resize</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 200px; width: 200px;"</span><br /> <span class="hljs-attr">dimention</span>=<span class="hljs-string">"width"</span><br />&gt;</span><br /> Resize Width<br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-resize</span>&gt;</span></code></pre>
59
+ </k-card>
60
+ </div>
61
+ <div class="col d-span-6 m-span-12 px">
62
+ <k-card label="Output*" class="pb">
63
+ <k-resize
64
+ style="height: 200px; width: 200px;"
65
+ dimention="width"
66
+ >
67
+ <p class="p">
68
+ Resize Width
69
+ </p>
70
+ </k-resize>
71
+ </k-card>
72
+ </div>
73
+ </div>
74
+ <div class="row -mx mb">
75
+ <div class="col d-span-6 m-span-12 px">
76
+ <k-card label="HTML">
77
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-resize</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 200px; width: 200px;"</span><br /> <span class="hljs-attr">dimention</span>=<span class="hljs-string">"height"</span><br />&gt;</span><br /> Resize Height<br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-resize</span>&gt;</span></code></pre>
78
+ </k-card>
79
+ </div>
80
+ <div class="col d-span-6 m-span-12 px">
81
+ <k-card label="Output*" class="pb">
82
+ <k-resize
83
+ style="height: 200px; width: 200px;"
84
+ dimention="height"
85
+ >
86
+ <p class="p">
87
+ Resize Height
88
+ </p>
89
+ </k-resize>
90
+ </k-card>
91
+ </div>
92
+ </div>
93
+
94
+
95
+ <h3>* Notes</h3>
96
+ <p><i>Additional styles may be added to the example output (borders, spacing, colors) for demonstration.</i></p>
97
+
98
+ </main>
99
+ <div style="height:33vh"></div>
100
+ <script type="module">
101
+ import Icon from '../kempo/components/Icon.js';
102
+ Icon.pathToIcons = '../kempo/icons';
103
+ </script>
104
+ <script type="module" src="../kempo/components/Import.js"></script>
105
+ <script type="module" src="../kempo/components/Resize.js"></script>
106
+ </body>
107
+ </html>
@@ -0,0 +1,92 @@
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>ShowMore - 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
+ Icon.pathToIcons = '../kempo/icons';
12
+ </script>
13
+ </head>
14
+ <body>
15
+ <k-import src="../nav-1.inc.html"></k-import>
16
+ <main>
17
+ <h1 class="ta-center">Show More</h1>
18
+ <h3>Basic Usage</h3>
19
+ <div class="row -mx">
20
+ <div class="col m-span-12 px">
21
+ <k-card label="HTML">
22
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-show-more</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Lorem ipsum dolor...<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-show-more</span>&gt;</span></code></pre>
23
+ </k-card>
24
+ </div>
25
+ <div class="col m-span-12 px">
26
+ <k-card label="Output">
27
+ <k-show-more>
28
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius explicabo similique laudantium ipsa suscipit officia! Iusto, maxime. Sapiente velit nostrum perspiciatis aut quod ipsa maiores libero praesentium, ducimus optio ex repellendus deleniti eaque quam, consectetur vero dicta molestias est voluptate deserunt, rerum earum dolorem sequi. Doloribus deserunt ab dolor nihil! Eos quisquam, reprehenderit hic facere cumque ea possimus natus vitae veniam ratione totam aliquid iure enim, error magni. Animi laborum dignissimos odit, minima suscipit assumenda voluptates aspernatur deserunt harum atque consequuntur laudantium libero maxime nobis impedit, ducimus ipsam enim! Magnam voluptatem numquam nemo dignissimos? Dolores suscipit beatae hic aperiam dignissimos?</p>
29
+ </k-show-more>
30
+ </k-card>
31
+ </div>
32
+ </div>
33
+
34
+ <h3>"More" / "Less" Button Text</h3>
35
+ <p>Change the text of the show "more" or "less" buttons by creating an element that has a <code>slot</code> attribute of <code>"more"</code> or <code>"less"</code>.</p>
36
+ <div class="row -mx">
37
+ <div class="col m-span-12 px">
38
+ <k-card label="HTML">
39
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-show-more</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Lorem ipsum dolor...<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"more"</span>&gt;</span>Reveal Details<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"less"</span>&gt;</span>Hide Details<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-show-more</span>&gt;</span></code></pre>
40
+ </k-card>
41
+ </div>
42
+ <div class="col m-span-12 px">
43
+ <k-card label="Output">
44
+ <k-show-more>
45
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius explicabo similique laudantium ipsa suscipit officia! Iusto, maxime. Sapiente velit nostrum perspiciatis aut quod ipsa maiores libero praesentium, ducimus optio ex repellendus deleniti eaque quam, consectetur vero dicta molestias est voluptate deserunt, rerum earum dolorem sequi. Doloribus deserunt ab dolor nihil! Eos quisquam, reprehenderit hic facere cumque ea possimus natus vitae veniam ratione totam aliquid iure enim, error magni. Animi laborum dignissimos odit, minima suscipit assumenda voluptates aspernatur deserunt harum atque consequuntur laudantium libero maxime nobis impedit, ducimus ipsam enim! Magnam voluptatem numquam nemo dignissimos? Dolores suscipit beatae hic aperiam dignissimos?</p>
46
+ <span slot="more">Reveal Details</span>
47
+ <span slot="less">Hide Details</span>
48
+ </k-show-more>
49
+ </k-card>
50
+ </div>
51
+ </div>
52
+
53
+ <h3>Closed Height</h3>
54
+ <p>Change the height of the closed state by setting the <code>--closed_height</code> CSS Custom Property.</p>
55
+ <div class="row -mx">
56
+ <div class="col m-span-12 px">
57
+ <k-card label="HTML">
58
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-show-more</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"--closed_height: 4rem"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Lorem ipsum dolor...<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-show-more</span>&gt;</span></code></pre>
59
+ </k-card>
60
+ </div>
61
+ <div class="col m-span-12 px">
62
+ <k-card label="Output">
63
+ <k-show-more
64
+ style="--closed_height: 4rem"
65
+ >
66
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius explicabo similique laudantium ipsa suscipit officia! Iusto, maxime. Sapiente velit nostrum perspiciatis aut quod ipsa maiores libero praesentium, ducimus optio ex repellendus deleniti eaque quam, consectetur vero dicta molestias est voluptate deserunt, rerum earum dolorem sequi. Doloribus deserunt ab dolor nihil! Eos quisquam, reprehenderit hic facere cumque ea possimus natus vitae veniam ratione totam aliquid iure enim, error magni. Animi laborum dignissimos odit, minima suscipit assumenda voluptates aspernatur deserunt harum atque consequuntur laudantium libero maxime nobis impedit, ducimus ipsam enim! Magnam voluptatem numquam nemo dignissimos? Dolores suscipit beatae hic aperiam dignissimos?</p>
67
+ </k-show-more>
68
+ </k-card>
69
+ </div>
70
+ </div>
71
+
72
+ <h3>Try It Yourself</h3>
73
+ <k-web-snippet-editor
74
+ show-css="false"
75
+ show-js="false"
76
+ use-kempo="true"
77
+ scripts="../kempo/components/ShowMore.js"
78
+ >
79
+ <pre for="html">&lt;k-show-more style="--closed_height: 10rem">
80
+ &lt;p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatibus eum pariatur voluptas aspernatur ad laborum nostrum deserunt quo consequuntur, molestias id quos rem cum, distinctio quam obcaecati recusandae ut quod non vel ipsam architecto fuga. Tempore placeat quidem aperiam consectetur optio beatae assumenda dolor corrupti saepe eum, natus doloremque reprehenderit sequi laboriosam suscipit eos esse dolore facilis alias. Pariatur beatae ex suscipit nulla voluptate nobis quisquam alias. Nesciunt unde asperiores iste, praesentium quod cumque. Quos numquam sunt quisquam enim explicabo nobis fugiat, distinctio illum et corporis necessitatibus, ab ullam nesciunt tempora quas totam odio autem. Similique maiores facilis saepe exercitationem dolores, quisquam consequuntur atque in molestiae sint voluptatem. Eveniet vel recusandae sit. Doloribus eum magni cumque animi tempore error dicta dignissimos repellat porro, recusandae iusto quas? Soluta explicabo vitae cupiditate repellat magnam blanditiis, quam animi nihil, totam similique est eum, magni impedit deleniti! Laboriosam explicabo libero laudantium reiciendis autem officia obcaecati eius incidunt earum quibusdam, cumque quasi aspernatur quod at, placeat dolorum, vel illum commodi odit non. Iure adipisci, unde assumenda laboriosam quaerat beatae optio, aliquid tenetur ex nemo velit earum tempore nulla, animi neque nam ipsam quia accusantium enim et quis reprehenderit quas? Labore modi maiores in suscipit laboriosam.&lt;/p>
81
+ &lt;span slot="more">Show me all the text&lt;/span>
82
+ &lt;span slot="less">Whoa, that's too much text, hide some&lt;/span>
83
+ &lt;/k-show-more></pre>
84
+ </k-web-snippet-editor>
85
+ </main>
86
+ <div style="height:33vh"></div>
87
+
88
+ <script type="module" src="../kempo/components/Import.js"></script>
89
+ <script type="module" src="../kempo/components/ShowMore.js"></script>
90
+ <script type="module" src="../kempo/components/WebSnippetEditor.js"></script>
91
+ </body>
92
+ </html>
@@ -0,0 +1,97 @@
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>SideMenu - 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
+ </head>
10
+ <body>
11
+ <k-import src="../nav-1.inc.html"></k-import>
12
+ <h1 class="ta-center">SideMenu</h1>
13
+ <main>
14
+ <h3>Basic Usage</h3>
15
+ <p>Side Menus are closed by default, to open them call the <code>open()</code> method.</p>
16
+ <div class="row -mx">
17
+ <div class="col m-span-12 px">
18
+ <k-card label="HTML">
19
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-side-menu</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sm1"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Side Menu 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-side-menu</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open-sm1"</span>&gt;</span>Open Side Menu 1<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>&gt;</span><span class="javascript"><br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'open-sm1'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sm1'</span>).open();<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
20
+ </k-card>
21
+ </div>
22
+ <div class="col m-span-12 px">
23
+ <k-card label="Output">
24
+ <k-side-menu id="sm1">
25
+ <p>Side Menu 1</p>
26
+ </k-side-menu>
27
+ <button id="open-sm1">Open Side Menu 1</button>
28
+ <script>
29
+ document.getElementById('open-sm1').addEventListener('click',()=>{
30
+ document.getElementById('sm1').open();
31
+ });
32
+ </script>
33
+ </k-card>
34
+ </div>
35
+ </div>
36
+
37
+ <h3>Closing</h3>
38
+ <p>By default clicking on the overlay (the part that covers the page while the Side Menu is open) will close the Side Menu. Use the <code>overlay-close="false"</code> attribute/value to disable this.</p>
39
+ <p>Use the <code>close()</code> method to close the Side Menu, alternately you can use the <code>toggle()</code> method which can be used to open or close the Side Menu.</p>
40
+ <div class="row -mx">
41
+ <div class="col m-span-12 px">
42
+ <k-card label="HTML">
43
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-side-menu</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sm2"</span> <span class="hljs-attr">overlay-close</span>=<span class="hljs-string">"false"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Side Menu 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"close-sm2"</span>&gt;</span>Close<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-side-menu</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open-sm2"</span>&gt;</span>Open Side Menu 2<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>&gt;</span><span class="javascript"><br /> <span class="hljs-keyword">const</span> $sm2 = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sm2'</span>);<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'open-sm2'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> $sm2.open();<br /> });<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'close-sm2'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> $sm2.close();<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
44
+ </k-card>
45
+ </div>
46
+ <div class="col m-span-12 px">
47
+ <k-card label="Output">
48
+ <k-side-menu id="sm2" overlay-close="false">
49
+ <p>Side Menu 2</p>
50
+ <button id="close-sm2">Close</button>
51
+ </k-side-menu>
52
+ <button id="open-sm2">Open Side Menu 2</button>
53
+ <script>
54
+ const $sm2 = document.getElementById('sm2');
55
+ document.getElementById('open-sm2').addEventListener('click',()=>{
56
+ $sm2.open();
57
+ });
58
+ document.getElementById('close-sm2').addEventListener('click',()=>{
59
+ $sm2.close();
60
+ });
61
+ </script>
62
+ </k-card>
63
+ </div>
64
+ </div>
65
+
66
+ <h3>Right Side Menu</h3>
67
+ <p>Give the menu the <code>side="right"</code> attribute/value to make it open from the right side.</p>
68
+ <div class="row -mx">
69
+ <div class="col m-span-12 px">
70
+ <k-card label="HTML">
71
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-side-menu</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sm3"</span> <span class="hljs-attr">side</span>=<span class="hljs-string">"right"</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Side Menu 3<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-side-menu</span>&gt;</span><br /><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"open-sm3"</span>&gt;</span>Open Side Menu 3<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>&gt;</span><span class="javascript"><br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'open-sm3'</span>).addEventListener(<span class="hljs-string">'click'</span>,()=&gt;{<br /> <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'sm3'</span>).open();<br /> });<br /></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
72
+ </k-card>
73
+ </div>
74
+ <div class="col m-span-12 px">
75
+ <k-card label="Output">
76
+ <k-side-menu id="sm3" side="right">
77
+ <p>Side Menu 3</p>
78
+ </k-side-menu>
79
+ <button id="open-sm3">Open Side Menu 3</button>
80
+ <script>
81
+ document.getElementById('open-sm3').addEventListener('click',()=>{
82
+ document.getElementById('sm3').open();
83
+ });
84
+ </script>
85
+ </k-card>
86
+ </div>
87
+ </div>
88
+ </main>
89
+ <div style="height:33vh"></div>
90
+ <script type="module">
91
+ import Icon from '../kempo/components/Icon.js';
92
+ Icon.pathToIcons = '../kempo/icons';
93
+ </script>
94
+ <script type="module" src="../kempo/components/Import.js"></script>
95
+ <script type="module" src="../kempo/components/SideMenu.js"></script>
96
+ </body>
97
+ </html>