kempo 2.9.2 → 2.10.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 (125) 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/Icon.js +1 -1
  6. package/dist/components/Search.js +1 -1
  7. package/dist/components/Table.js +1 -1
  8. package/dist/components/Timestamp.js +1 -1
  9. package/dist/components/Toggle.js +1 -1
  10. package/dist/components/tableControls/DeleteSelected.js +1 -1
  11. package/dist/components/tableControls/Edit.js +1 -0
  12. package/dist/components/tableControls/Filters.js +1 -0
  13. package/dist/components/tableControls/HiddenCount.js +1 -0
  14. package/dist/components/tableControls/Hide.js +1 -0
  15. package/dist/components/tableControls/PageSelect.js +1 -1
  16. package/dist/components/tableControls/PageSize.js +1 -1
  17. package/dist/components/tableControls/ShowAll.js +1 -0
  18. package/dist/index.js +1 -1
  19. package/dist/kempo-styles.css +1 -1
  20. package/dist/kempo-vars.css +1 -1
  21. package/dist/utils/formatTimestamp.js +1 -1
  22. package/docs/components/_template.html +9 -0
  23. package/docs/components/accordion.html +52 -12
  24. package/docs/components/card.html +68 -8
  25. package/docs/components/component.html +6 -0
  26. package/docs/components/content-slider.html +8 -0
  27. package/docs/components/dialog.html +145 -5
  28. package/docs/components/directory-viewer.html +51 -40
  29. package/docs/components/focus-capture.html +68 -0
  30. package/docs/components/icon.html +76 -5
  31. package/docs/components/import.html +47 -0
  32. package/docs/components/lazy-component.html +45 -15
  33. package/docs/components/reactive-component.html +69 -0
  34. package/docs/components/reactive-lazy-component.html +69 -0
  35. package/docs/components/resize.html +52 -3
  36. package/docs/components/search.html +102 -0
  37. package/docs/components/show-more.html +54 -5
  38. package/docs/components/{sidemenu.html → side-menu.html} +56 -3
  39. package/docs/components/split.html +57 -16
  40. package/docs/components/table.html +90 -189
  41. package/docs/components/tableControls.html +91 -0
  42. package/docs/components/tableCustomFields.html +112 -0
  43. package/docs/components/tablePagination.html +92 -0
  44. package/docs/components/tableRecordEditing.html +144 -0
  45. package/docs/components/tableRecordFiltering.html +82 -0
  46. package/docs/components/tableRecordHiding.html +84 -0
  47. package/docs/components/tableRecordSelection.html +86 -0
  48. package/docs/components/tableRowControls.html +103 -0
  49. package/docs/components/tabs.html +72 -4
  50. package/docs/components/tags.html +94 -0
  51. package/docs/components/theme-switcher.html +74 -0
  52. package/docs/components/timestamp.html +86 -0
  53. package/docs/components/toggle.html +37 -34
  54. package/docs/icons/check.svg +1 -0
  55. package/docs/icons/hide.svg +1 -0
  56. package/docs/icons/show.svg +1 -0
  57. package/docs/index.html +5 -0
  58. package/docs/kempo/components/Accordion.js +1 -1
  59. package/docs/kempo/components/Dialog.js +1 -1
  60. package/docs/kempo/components/DirectoryViewer.js +1 -1
  61. package/docs/kempo/components/FocusCapture.js +1 -1
  62. package/docs/kempo/components/Icon.js +1 -1
  63. package/docs/kempo/components/Search.js +1 -1
  64. package/docs/kempo/components/Table.js +1 -1
  65. package/docs/kempo/components/Timestamp.js +1 -1
  66. package/docs/kempo/components/Toggle.js +1 -1
  67. package/docs/kempo/components/tableControls/DeleteSelected.js +1 -1
  68. package/docs/kempo/components/tableControls/Edit.js +1 -0
  69. package/docs/kempo/components/tableControls/Filters.js +1 -0
  70. package/docs/kempo/components/tableControls/HiddenCount.js +1 -0
  71. package/docs/kempo/components/tableControls/Hide.js +1 -0
  72. package/docs/kempo/components/tableControls/PageSelect.js +1 -1
  73. package/docs/kempo/components/tableControls/PageSize.js +1 -1
  74. package/docs/kempo/components/tableControls/ShowAll.js +1 -0
  75. package/docs/kempo/index.js +1 -1
  76. package/docs/kempo/kempo-styles.css +1 -1
  77. package/docs/kempo/kempo-vars.css +1 -1
  78. package/docs/kempo/utils/formatTimestamp.js +1 -1
  79. package/docs/nav-1.inc.html +16 -2
  80. package/docs/nav.inc.html +10 -2
  81. package/docs/search.json +281 -23
  82. package/docs/styles/_template.html +6 -0
  83. package/docs/styles/borders-spacing.html +6 -0
  84. package/docs/styles/buttons.html +6 -0
  85. package/docs/styles/colors.html +6 -0
  86. package/docs/styles/displays-layouts.html +6 -0
  87. package/docs/styles/embed-1.html +6 -0
  88. package/docs/styles/inputs.html +6 -0
  89. package/docs/styles/tables.html +6 -0
  90. package/docs/styles/typography.html +6 -0
  91. package/docs/{components/stacks.html → utils/_template.html} +11 -30
  92. package/docs/utils/cli.html +84 -0
  93. package/docs/utils/cookie.html +87 -0
  94. package/docs/utils/debounce.html +61 -0
  95. package/docs/utils/drag.html +85 -0
  96. package/docs/utils/element.html +124 -0
  97. package/docs/utils/format-timestamp.html +64 -0
  98. package/docs/utils/fuzzy-match.html +60 -0
  99. package/icons/check.svg +1 -0
  100. package/icons/hide.svg +1 -0
  101. package/icons/show.svg +1 -0
  102. package/package.json +1 -1
  103. package/src/components/Accordion.js +0 -1
  104. package/src/components/Dialog.js +15 -6
  105. package/src/components/DirectoryViewer.js +21 -92
  106. package/src/components/FocusCapture.js +2 -1
  107. package/src/components/Icon.js +3 -1
  108. package/src/components/Search.js +4 -1
  109. package/src/components/Table.js +469 -139
  110. package/src/components/Timestamp.js +7 -4
  111. package/src/components/Toggle.js +3 -0
  112. package/src/components/tableControls/DeleteSelected.js +36 -22
  113. package/src/components/tableControls/Edit.js +88 -0
  114. package/src/components/tableControls/Filters.js +128 -0
  115. package/src/components/tableControls/HiddenCount.js +42 -0
  116. package/src/components/tableControls/Hide.js +43 -0
  117. package/src/components/tableControls/PageSelect.js +54 -30
  118. package/src/components/tableControls/PageSize.js +33 -16
  119. package/src/components/tableControls/ShowAll.js +40 -0
  120. package/src/kempo-styles.css +7 -0
  121. package/src/kempo-vars.css +2 -0
  122. package/src/utils/formatTimestamp.js +26 -10
  123. package/docs/table.html +0 -0
  124. package/src/components/Stacks.js +0 -79
  125. package/src/utils/files.js +0 -15
@@ -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>
@@ -6,16 +6,24 @@
6
6
  <title>LazyComponent - 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">LazyComponent</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>
24
+ <a href="#basicUsage">Basic Usage</a><br />
25
+
26
+ <h6 class="mt">JavaScript Reference</h6>
19
27
  <a href="#constructor">Constructor</a><br />
20
28
  <a href="#requirements">Requirements</a><br />
21
29
  <a href="#attributes">Attributes</a><br />
@@ -25,21 +33,43 @@
25
33
  </details>
26
34
 
27
35
  <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>
36
+ <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
37
 
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>
38
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
39
+ <p>Extend the <code>LazyComponent</code> class to create a lazy-loaded component. The component will render its content only when it becomes visible in the viewport.</p>
40
+ <pre><code class="hljs javascript"><span class="hljs-keyword">import</span> LazyComponent <span class="hljs-keyword">from</span> <span class="hljs-string">'kempo'</span>;<br /><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyLazyComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">LazyComponent</span> </span>{<br /> <span class="hljs-keyword">constructor</span>(){<br /> <span class="hljs-keyword">super</span>();<br /> <span class="hljs-comment">// Your Constructor</span><br /> }<br /> <span class="hljs-keyword">async</span> render(force){<br /> <span class="hljs-keyword">if</span>(<span class="hljs-keyword">await</span> <span class="hljs-keyword">super</span>.render(force)){<br /> <span class="hljs-comment">// Your render logic</span><br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;<br /> }<br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;<br /> }<br />}<br /><span class="hljs-built_in">window</span>.customElements.define(<span class="hljs-string">'my-lazy-component'</span>, MyLazyComponent);</code></pre>
41
+
42
+ <h2 id="jsRef">JavaScript Reference</h2>
43
+
44
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
45
+ <h6>Extends <a href="./component.html">Component</a></h6>
37
46
  <h5>
38
- <code>super()</code><br />
39
- <code>super(<i>Object shadowOptions</i>)</code>
47
+ <code>new LazyComponent()</code><br />
48
+ <code>new LazyComponent(<i>Object</i> shadowOptions)</code>
40
49
  </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
-
50
+ <p>This class <b class="tc-danger">cannot</b> be instantiated 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>
51
+
52
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
53
+ <ul>
54
+ <li><a href="./component.html">Component</a></li>
55
+ <li><a href="../utils/element.js">isInView Utility Function</a></li>
56
+ <li><a href="../utils/raf.js">raf Utility Function</a></li>
57
+ </ul>
58
+
59
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
60
+ <h5><code>unrender<i>: boolean</i></code></h5>
61
+ <p>If set to <code>true</code>, the component will unrender its content when it goes out of view.</p>
62
+
63
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
64
+ <h5><code>async renderSkelton()<i>: Promise</i></code></h5>
65
+ <p>Renders the skeleton template of the component. This is called when the component is not yet visible in the viewport or when it goes out of view and <code>unrender</code> is set to <code>true</code>.</p>
66
+
67
+ <h5><code>async inViewCallback()<i>: Promise</i></code></h5>
68
+ <p>Callback method that is called when the component becomes visible in the viewport. By default, it calls the <code>render</code> method.</p>
69
+
70
+ <h5><code>async outOfViewCallback()<i>: Promise</i></code></h5>
71
+ <p>Callback method that is called when the component goes out of view. If <code>unrender</code> is set to <code>true</code>, it calls the <code>renderSkelton</code> method.</p>
72
+
43
73
  </main>
44
74
  <script type="module" src="../kempo/components/Import.js"></script>
45
75
  </body>
@@ -0,0 +1,69 @@
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>ReactiveComponent - 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">ReactiveComponent</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>ReactiveComponent</code> class extends the <a href="./component.html">Component</a> class and provides additional functionality to automatically re-render the component when specified attributes change.</p>
37
+
38
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
39
+ <p>Extend the <code>ReactiveComponent</code> class to create a component that automatically re-renders when specified attributes change.</p>
40
+ <pre><code class="hljs javascript"><span class="hljs-keyword">import</span> ReactiveComponent <span class="hljs-keyword">from</span> <span class="hljs-string">'kempo'</span>;<br /><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyReactiveComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactiveComponent</span> </span>{<br /> <span class="hljs-keyword">constructor</span>(){<br /> <span class="hljs-keyword">super</span>();<br /> <span class="hljs-comment">// Your Constructor</span><br /> }<br /> <span class="hljs-keyword">static</span> get renderOnChange(){<br /> <span class="hljs-keyword">return</span> [<span class="hljs-string">'my-attr'</span>];<br /> }<br /> <span class="hljs-keyword">async</span> render(force){<br /> <span class="hljs-keyword">if</span>(<span class="hljs-keyword">await</span> <span class="hljs-keyword">super</span>.render(force)){<br /> <span class="hljs-comment">// Your render logic</span><br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;<br /> }<br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;<br /> }<br />}<br /><span class="hljs-built_in">window</span>.customElements.define(<span class="hljs-string">'my-reactive-component'</span>, MyReactiveComponent);</code></pre>
41
+
42
+ <h2 id="jsRef">JavaScript Reference</h2>
43
+
44
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
45
+ <h6>Extends <a href="./component.html">Component</a></h6>
46
+ <h5>
47
+ <code>new ReactiveComponent()</code>
48
+ </h5>
49
+
50
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
51
+ <ul>
52
+ <li><a href="./component.html">Component</a></li>
53
+ </ul>
54
+
55
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
56
+ <p>The <code>ReactiveComponent</code> class does not introduce any new attributes beyond those provided by the <a href="./component.html">Component</a> class.</p>
57
+
58
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
59
+ <h5><code>attributeChangedCallback(n, oV, nV)<i>: void</i></code></h5>
60
+ <p>Overrides the <code>attributeChangedCallback</code> method to automatically re-render the component when specified attributes change.</p>
61
+
62
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
63
+ <h5><code>static renderOnChange<i>: Array</i></code></h5>
64
+ <p>An array of attribute names that should trigger a re-render when they change. This property should be overridden in your component class.</p>
65
+
66
+ </main>
67
+ <script type="module" src="../kempo/components/Import.js"></script>
68
+ </body>
69
+ </html>
@@ -0,0 +1,69 @@
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>ReactiveLazyComponent - 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">ReactiveLazyComponent</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>ReactiveLazyComponent</code> class extends the <a href="./lazy-component.html">LazyComponent</a> class and provides additional functionality to automatically re-render the component when specified attributes change.</p>
37
+
38
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
39
+ <p>Extend the <code>ReactiveLazyComponent</code> class to create a component that automatically re-renders when specified attributes change and only renders its content when it becomes visible in the viewport.</p>
40
+ <pre><code class="hljs javascript"><span class="hljs-keyword">import</span> ReactiveLazyComponent <span class="hljs-keyword">from</span> <span class="hljs-string">'kempo'</span>;<br /><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyReactiveLazyComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ReactiveLazyComponent</span> </span>{<br /> <span class="hljs-keyword">constructor</span>(){<br /> <span class="hljs-keyword">super</span>();<br /> <span class="hljs-comment">// Your Constructor</span><br /> }<br /> <span class="hljs-keyword">static</span> get renderOnChange(){<br /> <span class="hljs-keyword">return</span> [<span class="hljs-string">'my-attr'</span>];<br /> }<br /> <span class="hljs-keyword">async</span> render(force){<br /> <span class="hljs-keyword">if</span>(<span class="hljs-keyword">await</span> <span class="hljs-keyword">super</span>.render(force)){<br /> <span class="hljs-comment">// Your render logic</span><br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;<br /> }<br /> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;<br /> }<br />}<br /><span class="hljs-built_in">window</span>.customElements.define(<span class="hljs-string">'my-reactive-lazy-component'</span>, MyReactiveLazyComponent);</code></pre>
41
+
42
+ <h2 id="jsRef">JavaScript Reference</h2>
43
+
44
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
45
+ <h6>Extends <a href="./lazy-component.html">LazyComponent</a></h6>
46
+ <h5>
47
+ <code>new ReactiveLazyComponent()</code>
48
+ </h5>
49
+
50
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
51
+ <ul>
52
+ <li><a href="./lazy-component.html">LazyComponent</a></li>
53
+ </ul>
54
+
55
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
56
+ <p>The <code>ReactiveLazyComponent</code> class does not introduce any new attributes beyond those provided by the <a href="./lazy-component.html">LazyComponent</a> class.</p>
57
+
58
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
59
+ <h5><code>attributeChangedCallback(n, oV, nV)<i>: void</i></code></h5>
60
+ <p>Overrides the <code>attributeChangedCallback</code> method to automatically re-render the component when specified attributes change.</p>
61
+
62
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
63
+ <h5><code>static renderOnChange<i>: Array</i></code></h5>
64
+ <p>An array of attribute names that should trigger a re-render when they change. This property should be overridden in your component class.</p>
65
+
66
+ </main>
67
+ <script type="module" src="../kempo/components/Import.js"></script>
68
+ </body>
69
+ </html>
@@ -6,12 +6,34 @@
6
6
  <title>Resize - 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">Resize</h1>
13
19
  <main>
14
- <h3>Basic Usage</h3>
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="#resizeDimention">Resize Dimension</a><br />
26
+
27
+ <h6 class="mt">JavaScript Reference</h6>
28
+ <a href="#constructor">Constructor</a><br />
29
+ <a href="#requirements">Requirements</a><br />
30
+ <a href="#attributes">Attributes</a><br />
31
+ <a href="#properties">Properties</a><br />
32
+ <a href="#methods">Methods</a><br />
33
+ </div>
34
+ </details>
35
+
36
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
15
37
  <p>Set the initial height and width using normal styles.</p>
16
38
  <div class="row -mx mb">
17
39
  <div class="col d-span-6 m-span-12 px">
@@ -51,7 +73,7 @@
51
73
  </div>
52
74
  </div>
53
75
 
54
- <h3>Resize Dimention</h3>
76
+ <h3 id="resizeDimention"><a href="#resizeDimention" class="no-link">Resize Dimension</a></h3>
55
77
  <div class="row -mx mb">
56
78
  <div class="col d-span-6 m-span-12 px">
57
79
  <k-card label="HTML">
@@ -94,7 +116,34 @@
94
116
 
95
117
  <h3>* Notes</h3>
96
118
  <p><i>Additional styles may be added to the example output (borders, spacing, colors) for demonstration.</i></p>
97
-
119
+
120
+ <h2 id="jsRef">JavaScript Reference</h2>
121
+
122
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
123
+ <h6>Extends <a href="./component.html">Component</a></h6>
124
+ <h5>
125
+ <code>new Resize()</code>
126
+ </h5>
127
+
128
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
129
+ <ul>
130
+ <li><a href="./component.html">Component</a></li>
131
+ </ul>
132
+
133
+ <h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
134
+ <h5><code>resizing<i>: string</i></code></h5>
135
+ <p>Indicates which handle is currently being used to resize the element.</p>
136
+ <h5><code>dimention<i>: string</i></code></h5>
137
+ <p>Specifies which dimension to resize. Can be <code>"width"</code> or <code>"height"</code>.</p>
138
+
139
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
140
+ <h5><code>resizing<i>: string</i></code></h5>
141
+ <p>Indicates which handle is currently being used to resize the element.</p>
142
+
143
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
144
+ <h5><code>render(force)<i>: Promise</i></code></h5>
145
+ <p>Renders the component. If <code>force</code> is <code>true</code>, the component will be re-rendered even if it has already been rendered.</p>
146
+
98
147
  </main>
99
148
  <div style="height:33vh"></div>
100
149
  <script type="module" src="../kempo/components/Import.js"></script>