kempo-ui 0.3.5 → 0.3.7

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 (146) hide show
  1. package/AGENTS.md +2 -1
  2. package/dist/components/Aside.js +1 -1
  3. package/dist/components/Main.js +1 -1
  4. package/docs/components/accordion.html +240 -8
  5. package/docs/components/aside-items.html +13 -9
  6. package/docs/components/aside-menu.html +13 -9
  7. package/docs/components/aside-push.html +11 -6
  8. package/docs/components/aside.html +289 -115
  9. package/docs/components/card.html +238 -7
  10. package/docs/components/color-picker.html +245 -14
  11. package/docs/components/content-slider.html +240 -8
  12. package/docs/components/context.html +241 -7
  13. package/docs/components/dialog.html +238 -7
  14. package/docs/components/dropdown.html +238 -7
  15. package/docs/components/filter-list.html +239 -10
  16. package/docs/components/focus-capture.html +241 -10
  17. package/docs/components/html-editor.html +266 -35
  18. package/docs/components/hybrid-component.html +238 -6
  19. package/docs/components/icon.html +239 -9
  20. package/docs/components/import.html +239 -8
  21. package/docs/components/light-component.html +239 -7
  22. package/docs/components/nav.html +240 -8
  23. package/docs/components/photo-viewer.html +239 -9
  24. package/docs/components/resize.html +240 -9
  25. package/docs/components/shadow-component.html +239 -7
  26. package/docs/components/show-more.html +237 -8
  27. package/docs/components/sortable.html +239 -8
  28. package/docs/components/spinner.html +237 -6
  29. package/docs/components/split.html +241 -10
  30. package/docs/components/table.html +241 -11
  31. package/docs/components/tableControls.html +240 -7
  32. package/docs/components/tableCustomFields.html +241 -8
  33. package/docs/components/tableFetchRecords.html +239 -7
  34. package/docs/components/tableFieldSortHide.html +239 -7
  35. package/docs/components/tablePagination.html +246 -13
  36. package/docs/components/tablePlaceholder.html +241 -8
  37. package/docs/components/tableRecordEditing.html +241 -8
  38. package/docs/components/tableRecordFiltering.html +239 -7
  39. package/docs/components/tableRecordHiding.html +241 -9
  40. package/docs/components/tableRecordSearching.html +239 -7
  41. package/docs/components/tableRecordSelection.html +240 -7
  42. package/docs/components/tableRowControls.html +241 -8
  43. package/docs/components/tableServerSync.html +245 -11
  44. package/docs/components/tableSorting.html +239 -7
  45. package/docs/components/tabs.html +240 -7
  46. package/docs/components/tags.html +239 -7
  47. package/docs/components/theme-select.html +239 -7
  48. package/docs/components/theme-switcher.html +240 -8
  49. package/docs/components/timestamp.html +239 -8
  50. package/docs/components/toast.html +240 -8
  51. package/docs/components/toggle.html +240 -9
  52. package/docs/components/tree.html +239 -8
  53. package/docs/index.html +244 -6
  54. package/docs/prod.config.json +0 -4
  55. package/docs/src/components/Aside.js +1 -1
  56. package/docs/src/components/Main.js +1 -1
  57. package/docs/utils/context.html +237 -6
  58. package/docs/utils/cookie.html +251 -21
  59. package/docs/utils/debounce.html +236 -5
  60. package/docs/utils/drag.html +236 -5
  61. package/docs/utils/elevation.html +238 -6
  62. package/docs/utils/formatTimestamp.html +239 -9
  63. package/docs/utils/object.html +236 -5
  64. package/docs/utils/propConverters.html +233 -3
  65. package/docs/utils/string.html +236 -5
  66. package/docs/utils/theme.html +237 -6
  67. package/docs/utils/toTitleCase.html +239 -9
  68. package/docs/utils/type.html +236 -5
  69. package/docs/utils/wait.html +236 -5
  70. package/docs-src/.config.js +16 -0
  71. package/docs-src/bare.template.html +16 -0
  72. package/docs-src/components/accordion.page.html +201 -0
  73. package/docs-src/components/aside-items.page.html +36 -0
  74. package/docs-src/components/aside-menu.page.html +36 -0
  75. package/docs-src/components/aside-push.page.html +20 -0
  76. package/docs-src/components/aside.page.html +494 -0
  77. package/docs-src/components/card.page.html +78 -0
  78. package/docs-src/components/color-picker.page.html +559 -0
  79. package/docs-src/components/content-slider.page.html +266 -0
  80. package/docs-src/components/context.page.html +214 -0
  81. package/docs-src/components/dialog.page.html +365 -0
  82. package/docs-src/components/dropdown.page.html +300 -0
  83. package/docs-src/components/filter-list.page.html +117 -0
  84. package/docs-src/components/focus-capture.page.html +97 -0
  85. package/docs-src/components/html-editor.page.html +423 -0
  86. package/docs-src/components/hybrid-component.page.html +96 -0
  87. package/docs-src/components/icon.page.html +208 -0
  88. package/docs-src/components/import.page.html +76 -0
  89. package/docs-src/components/light-component.page.html +99 -0
  90. package/docs-src/components/nav.page.html +106 -0
  91. package/docs-src/components/photo-viewer.page.html +253 -0
  92. package/docs-src/components/resize.page.html +161 -0
  93. package/docs-src/components/shadow-component.page.html +84 -0
  94. package/docs-src/components/show-more.page.html +113 -0
  95. package/docs-src/components/sortable.page.html +117 -0
  96. package/docs-src/components/spinner.page.html +197 -0
  97. package/docs-src/components/split.page.html +195 -0
  98. package/docs-src/components/table.page.html +283 -0
  99. package/docs-src/components/tableControls.page.html +64 -0
  100. package/docs-src/components/tableCustomFields.page.html +124 -0
  101. package/docs-src/components/tableFetchRecords.page.html +95 -0
  102. package/docs-src/components/tableFieldSortHide.page.html +56 -0
  103. package/docs-src/components/tablePagination.page.html +85 -0
  104. package/docs-src/components/tablePlaceholder.page.html +73 -0
  105. package/docs-src/components/tableRecordEditing.page.html +161 -0
  106. package/docs-src/components/tableRecordFiltering.page.html +69 -0
  107. package/docs-src/components/tableRecordHiding.page.html +65 -0
  108. package/docs-src/components/tableRecordSearching.page.html +56 -0
  109. package/docs-src/components/tableRecordSelection.page.html +60 -0
  110. package/docs-src/components/tableRowControls.page.html +62 -0
  111. package/docs-src/components/tableServerSync.page.html +129 -0
  112. package/docs-src/components/tableSorting.page.html +54 -0
  113. package/docs-src/components/tabs.page.html +201 -0
  114. package/docs-src/components/tags.page.html +157 -0
  115. package/docs-src/components/theme-select.page.html +106 -0
  116. package/docs-src/components/theme-switcher.page.html +122 -0
  117. package/docs-src/components/timestamp.page.html +109 -0
  118. package/docs-src/components/toast.page.html +338 -0
  119. package/docs-src/components/toggle.page.html +177 -0
  120. package/docs-src/components/tree.page.html +356 -0
  121. package/docs-src/default.template.html +28 -0
  122. package/docs-src/index.page.html +312 -0
  123. package/docs-src/nav.fragment.html +228 -0
  124. package/docs-src/utils/context.page.html +143 -0
  125. package/docs-src/utils/cookie.page.html +128 -0
  126. package/docs-src/utils/debounce.page.html +42 -0
  127. package/docs-src/utils/drag.page.html +64 -0
  128. package/docs-src/utils/elevation.page.html +144 -0
  129. package/docs-src/utils/formatTimestamp.page.html +76 -0
  130. package/docs-src/utils/object.page.html +76 -0
  131. package/docs-src/utils/propConverters.page.html +73 -0
  132. package/docs-src/utils/string.page.html +66 -0
  133. package/docs-src/utils/theme.page.html +136 -0
  134. package/docs-src/utils/toTitleCase.page.html +52 -0
  135. package/docs-src/utils/type.page.html +31 -0
  136. package/docs-src/utils/wait.page.html +31 -0
  137. package/package.json +4 -4
  138. package/scripts/build.js +5 -0
  139. package/scripts/docs.js +5 -52
  140. package/src/components/Aside.js +12 -1
  141. package/src/components/Main.js +1 -1
  142. package/tests/components/Aside.browser-test.js +75 -0
  143. package/docs/dev.config.json +0 -20
  144. package/docs/nav-1.inc.html +0 -168
  145. package/docs/nav.inc.html +0 -168
  146. package/docs/nav.inc.js +0 -70
@@ -0,0 +1,106 @@
1
+ <page pageName="ThemeSelect" title="ThemeSelect - Components - Kempo Docs - A Web Components Solution">
2
+ <content>
3
+ <k-accordion persistent-id="toc" class="b r mb">
4
+ <k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
5
+ <k-accordion-panel name="toc-panel">
6
+ <div class="m pl">
7
+ <h6>Examples</h6>
8
+ <a href="#basicUsage">Basic Usage</a><br />
9
+ <a href="#withLabel">With Label</a><br />
10
+
11
+ <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
12
+ <a href="#constructor">Constructor</a><br />
13
+ <a href="#requirements">Requirements</a><br />
14
+ <a href="#properties">Properties</a><br />
15
+ <a href="#slots">Slots</a><br />
16
+ <a href="#staticMethods">Static Methods</a><br />
17
+ </div>
18
+ </k-accordion-panel>
19
+ </k-accordion>
20
+
21
+ <h3>Description</h3>
22
+ <p>The <code>ThemeSelect</code> component provides a dropdown select for users to choose between Light, Dark, and System Default themes. It extends the <a href="./shadow-component.html">ShadowComponent</a> class and uses the <a href="{{pathToRoot}}utils/theme.html">theme utility</a> internally for state management, persistence, and synchronization.</p>
23
+ <p>If child content is provided, it renders as a label above the select. If no children are provided, no label is rendered.</p>
24
+ <p><strong>Note:</strong> You can manage theme state without this component by directly importing the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>.</p>
25
+
26
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
27
+ <p>Use the <code>ThemeSelect</code> component without any children to render just the select dropdown.</p>
28
+
29
+ <div class="row -mx mb">
30
+ <div class="col d-span-6 m-span-12 px">
31
+ <k-card label="HTML">
32
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-theme-select</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-theme-select</span>&gt;</span></code></pre>
33
+ </k-card>
34
+ </div>
35
+ <div class="col d-span-6 m-span-12 px">
36
+ <k-card label="Output">
37
+ <k-theme-select></k-theme-select>
38
+ </k-card>
39
+ </div>
40
+ </div>
41
+
42
+ <h3 id="withLabel"><a href="#withLabel" class="no-link">With Label</a></h3>
43
+ <p>Provide child content to render a label above the select.</p>
44
+
45
+ <div class="row -mx mb">
46
+ <div class="col d-span-6 m-span-12 px">
47
+ <k-card label="HTML">
48
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-theme-select</span>&gt;</span>Theme<span class="hljs-tag">&lt;/<span class="hljs-name">k-theme-select</span>&gt;</span></code></pre>
49
+ </k-card>
50
+ </div>
51
+ <div class="col d-span-6 m-span-12 px">
52
+ <k-card label="Output">
53
+ <k-theme-select>Theme</k-theme-select>
54
+ </k-card>
55
+ </div>
56
+ </div>
57
+
58
+ <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
59
+
60
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
61
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
62
+ <h5>
63
+ <code>new ThemeSelect()</code>
64
+ </h5>
65
+
66
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
67
+ <ul>
68
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
69
+ <li><a href="{{pathToRoot}}utils/theme.html">theme</a> utility</li>
70
+ </ul>
71
+
72
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
73
+ <h5><code>currentTheme<i>: string</i></code></h5>
74
+ <p>Gets or sets the current theme. Possible values are <code>"auto"</code>, <code>"light"</code>, or <code>"dark"</code>. This property is reactive and will trigger a re-render when changed. Syncs to <code>current-theme</code> attribute.</p>
75
+
76
+ <h3 id="slots"><a href="#slots" class="no-link">Slots</a></h3>
77
+ <h5><code>default</code></h5>
78
+ <p>The default slot renders as a label above the select. If no content is provided, no label is rendered.</p>
79
+
80
+ <h3 id="staticMethods"><a href="#staticMethods" class="no-link">Static Methods</a></h3>
81
+ <p><strong>Note:</strong> These static methods are convenience wrappers around the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>. For direct theme management without the component, use the theme utility directly.</p>
82
+ <h5><code>static setTheme(theme)<i>: void</i></code></h5>
83
+ <p>Sets the specified theme. Internally calls the <a href="{{pathToRoot}}utils/theme.html">theme utility</a> which handles persistence and DOM updates.</p>
84
+ <ul>
85
+ <li><strong>theme</strong> <code>string</code> - The theme to set. Must be one of: <code>"auto"</code>, <code>"light"</code>, or <code>"dark"</code></li>
86
+ </ul>
87
+ <pre><code class="hljs javascript"><span class="hljs-title class_">ThemeSelect</span>.<span class="hljs-title function_">setTheme</span>(<span class="hljs-string">&#x27;dark&#x27;</span>);</code></pre>
88
+
89
+ <h5><code>static getCurrentTheme()<i>: string</i></code></h5>
90
+ <p>Gets the current theme. Returns <code>"auto"</code> if no theme is set. Internally calls the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>.</p>
91
+ <pre><code class="hljs javascript"><span class="hljs-keyword">const</span> currentTheme = <span class="hljs-title class_">ThemeSelect</span>.<span class="hljs-title function_">getCurrentTheme</span>();<br><span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(currentTheme);</code></pre>
92
+
93
+ <h5><code>static getCalculatedCurrentTheme()<i>: string</i></code></h5>
94
+ <p>Returns the effective theme, always <code>"dark"</code> or <code>"light"</code>. If the current theme is <code>"auto"</code>, this method uses the user's system preference (<code>prefers-color-scheme</code> media query) to determine the theme. Internally calls the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>.</p>
95
+ <pre><code class="hljs javascript"><span class="hljs-keyword">const</span> effectiveTheme = <span class="hljs-title class_">ThemeSelect</span>.<span class="hljs-title function_">getCalculatedCurrentTheme</span>();<br><span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(effectiveTheme);</code></pre>
96
+
97
+ <h3>Related</h3>
98
+ <p>See the <a href="{{pathToRoot}}utils/theme.html">theme utility</a> documentation for programmatic theme management without using this component.</p>
99
+ <p>See the <a href="./theme-switcher.html">ThemeSwitcher</a> component for a button-based toggle alternative.</p>
100
+ </content>
101
+ <content location="scripts">
102
+ <script type="module" src="{{pathToRoot}}src/components/ThemeSelect.js"></script>
103
+ <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
104
+ <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
105
+ </content>
106
+ </page>
@@ -0,0 +1,122 @@
1
+ <page pageName="ThemeSwitcher" title="ThemeSwitcher - Components - Kempo Docs - A Web Components Solution">
2
+ <content>
3
+ <k-accordion persistent-id="toc" class="b r mb">
4
+ <k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
5
+ <k-accordion-panel name="toc-panel">
6
+ <div class="m pl">
7
+ <h6>Examples</h6>
8
+ <a href="#basicUsage">Basic Usage</a><br />
9
+ <a href="#customPadding">Custom Padding</a><br />
10
+
11
+ <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
12
+ <a href="#constructor">Constructor</a><br />
13
+ <a href="#requirements">Requirements</a><br />
14
+ <a href="#properties">Properties</a><br />
15
+ <a href="#cssCustomProperties">CSS Custom Properties</a><br />
16
+ <a href="#methods">Methods</a><br />
17
+ <a href="#staticMethods">Static Methods</a><br />
18
+ </div>
19
+ </k-accordion-panel>
20
+ </k-accordion>
21
+
22
+ <h3>Description</h3>
23
+ <p>The <code>ThemeSwitcher</code> component provides a UI control for users to switch between different themes (auto, light, dark). It extends the <a href="./shadow-component.html">ShadowComponent</a> class and uses the <a href="{{pathToRoot}}utils/theme.html">theme utility</a> internally for state management, persistence, and synchronization.</p>
24
+ <p><strong>Note:</strong> You can manage theme state without this component by directly importing the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>.</p>
25
+
26
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
27
+ <p>Use the <code>ThemeSwitcher</code> component to allow users to cycle through themes. Clicking the button cycles through auto → light → dark → auto. The component automatically detects the user's system preference when in auto mode.</p>
28
+
29
+ <div class="row -mx mb">
30
+ <div class="col d-span-6 m-span-12 px">
31
+ <k-card label="HTML">
32
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-theme-switcher</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-theme-switcher</span>&gt;</span></code></pre>
33
+ </k-card>
34
+ </div>
35
+ <div class="col d-span-6 m-span-12 px">
36
+ <k-card label="Output">
37
+ <k-theme-switcher></k-theme-switcher>
38
+ </k-card>
39
+ </div>
40
+ </div>
41
+
42
+ <h3 id="customPadding"><a href="#customPadding" class="no-link">Custom Padding</a></h3>
43
+ <p>You can customize the button padding by setting the <code>--padding</code> CSS custom property. The default padding uses <code>var(--spacer, 1rem)</code>.</p>
44
+
45
+ <div class="row -mx mb">
46
+ <div class="col d-span-6 m-span-12 px">
47
+ <k-card label="HTML">
48
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-theme-switcher</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"--padding: 0.5rem;"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-theme-switcher</span>&gt;</span><br/><span class="hljs-tag">&lt;<span class="hljs-name">k-theme-switcher</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"--padding: 2rem;"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-theme-switcher</span>&gt;</span></code></pre>
49
+ </k-card>
50
+ </div>
51
+ <div class="col d-span-6 m-span-12 px">
52
+ <k-card label="Output">
53
+ <k-theme-switcher style="--padding: 0.5rem;"></k-theme-switcher>
54
+ <k-theme-switcher style="--padding: 2rem;"></k-theme-switcher>
55
+ </k-card>
56
+ </div>
57
+ </div>
58
+
59
+ <h2 id="jsRef"><a href="jsRef" class="no-link">JavaScript Reference</a></h2>
60
+
61
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
62
+ <h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
63
+ <h5>
64
+ <code>new ThemeSwitcher()</code>
65
+ </h5>
66
+
67
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
68
+ <ul>
69
+ <li><a href="./shadow-component.html">ShadowComponent</a></li>
70
+ <li><a href="./icon.html">Icon</a></li>
71
+ <li><a href="{{pathToRoot}}utils/theme.html">theme</a> utility</li>
72
+ </ul>
73
+
74
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
75
+ <h5><code>currentTheme<i>: string</i></code></h5>
76
+ <p>Gets or sets the current theme. Possible values are <code>"auto"</code>, <code>"light"</code>, or <code>"dark"</code>. This property is reactive and will trigger a re-render when changed. Syncs to <code>current-theme</code> attribute.</p>
77
+
78
+ <h3 id="cssCustomProperties"><a href="#cssCustomProperties" class="no-link">CSS Custom Properties</a></h3>
79
+ <h5><code>--padding<i>: length</i></code></h5>
80
+ <p>Controls the padding of the theme switcher button. Defaults to <code>var(--spacer, 1rem)</code>. You can override this to customize the button's spacing.</p>
81
+ <pre><code class="hljs css"><span class="hljs-selector-tag">k-theme-switcher</span> {
82
+ <span class="hljs-attribute">--padding</span>: <span class="hljs-number">0.5rem</span>;
83
+ }</code></pre>
84
+
85
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
86
+ <p>The <code>ThemeSwitcher</code> class does not introduce any new public methods beyond those provided by the <a href="./shadow-component.html">ShadowComponent</a> class.</p>
87
+
88
+ <h3 id="staticMethods"><a href="#staticMethods" class="no-link">Static Methods</a></h3>
89
+ <p><strong>Note:</strong> These static methods are convenience wrappers around the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>. For direct theme management without the component, use the theme utility directly.</p>
90
+ <h5><code>static setTheme(theme)<i>: void</i></code></h5>
91
+ <p>Sets the specified theme. Internally calls the <a href="{{pathToRoot}}utils/theme.html">theme utility</a> which handles persistence and DOM updates.</p>
92
+ <ul>
93
+ <li><strong>theme</strong> <code>string</code> - The theme to set. Must be one of: <code>"auto"</code>, <code>"light"</code>, or <code>"dark"</code></li>
94
+ </ul>
95
+ <pre><code class="hljs javascript"><span class="hljs-comment">// Programmatically set theme to dark mode</span>
96
+ <span class="hljs-title class_">ThemeSwitcher</span>.<span class="hljs-title function_">setTheme</span>(<span class="hljs-string">'dark'</span>);</code></pre>
97
+
98
+ <h5><code>static getCurrentTheme()<i>: string</i></code></h5>
99
+ <p>Gets the current theme. Returns <code>"auto"</code> if no theme is set. Internally calls the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>.</p>
100
+ <pre><code class="hljs javascript"><span class="hljs-comment">// Get the current theme</span>
101
+ <span class="hljs-keyword">const</span> currentTheme = <span class="hljs-title class_">ThemeSwitcher</span>.<span class="hljs-title function_">getCurrentTheme</span>();
102
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(currentTheme); <span class="hljs-comment">// "auto", "light", or "dark"</span></code></pre>
103
+
104
+ <h5><code>static getCalculatedCurrentTheme()<i>: string</i></code></h5>
105
+ <p>Returns the effective theme, always <code>"dark"</code> or <code>"light"</code>. If the current theme is <code>"auto"</code>, this method uses the user's system preference (<code>prefers-color-scheme</code> media query) to determine the theme. Internally calls the <a href="{{pathToRoot}}utils/theme.html">theme utility</a>.</p>
106
+ <pre><code class="hljs javascript"><span class="hljs-comment">// Get the calculated current theme</span>
107
+ <span class="hljs-keyword">const</span> effectiveTheme = <span class="hljs-title class_">ThemeSwitcher</span>.<span class="hljs-title function_">getCalculatedCurrentTheme</span>();
108
+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(effectiveTheme); <span class="hljs.comment">// "dark" or "light"</span></code></pre>
109
+
110
+ <h3 id="themeDetection"><a href="#themeDetection" class="no-link">Automatic Theme Detection</a></h3>
111
+ <p>When the theme is set to <code>"auto"</code>, the <a href="{{pathToRoot}}utils/theme.html">theme utility</a> automatically detects the user's system preference using <code>prefers-color-scheme</code> media query. The detected theme is applied to the document element as an <code>auto-theme</code> attribute.</p>
112
+ <p>The theme utility handles persistence via localStorage and ensures theme changes are reflected in the DOM, providing a consistent user experience.</p>
113
+
114
+ <h3>Related</h3>
115
+ <p>See the <a href="{{pathToRoot}}utils/theme.html">theme utility</a> documentation for programmatic theme management without using this component.</p>
116
+ </content>
117
+ <content location="scripts">
118
+ <script type="module" src="{{pathToRoot}}src/components/ThemeSwitcher.js"></script>
119
+ <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
120
+ <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
121
+ </content>
122
+ </page>
@@ -0,0 +1,109 @@
1
+ <page pageName="Timestamp" title="Timestamp - Components - Kempo Docs - A Web Components Solution">
2
+ <content>
3
+ <k-accordion persistent-id="toc" class="b r mb">
4
+ <k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
5
+ <k-accordion-panel name="toc-panel">
6
+ <div class="m ">
7
+ <h6>Examples</h6>
8
+ <a href="#basicUsage">Basic Usage</a><br />
9
+ <a href="#customFormat">Custom Format</a><br />
10
+ <ul>
11
+ <li><a href="#timeFormat">Time Format</a></li>
12
+ </ul>
13
+
14
+ <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
15
+ <a href="#constructor">Constructor</a><br />
16
+ <a href="#requirements">Requirements</a><br />
17
+ <a href="#properties">Properties</a><br />
18
+ <a href="#methods">Methods</a><br />
19
+ </div>
20
+ </k-accordion-panel>
21
+ </k-accordion>
22
+
23
+ <h3>Description</h3>
24
+ <p>The <code>Timestamp</code> component displays a formatted timestamp using custom format tokens. It extends the
25
+ ShadowComponent class for encapsulated styling.</p>
26
+
27
+ <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
28
+ <p>Use the <code>Timestamp</code> component to display a formatted timestamp. The component will automatically
29
+ format the timestamp using the default format or a custom format with tokens.</p>
30
+ <div class="row -mx mb">
31
+ <div class="col d-span-6 m-span-12 px">
32
+ <k-card label="HTML">
33
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-timestamp</span>&gt;</span></code></pre>
34
+ </k-card>
35
+ </div>
36
+ <div class="col d-span-6 m-span-12 px">
37
+ <k-card label="Results">
38
+ <k-timestamp timestamp="1633024800000"></k-timestamp>
39
+ </k-card>
40
+ </div>
41
+ </div>
42
+
43
+ <h3 id="customFormat"><a href="#customFormat" class="no-link">Custom Format</a></h3>
44
+ <p>Use the <code>format</code> attribute to specify a custom format using tokens like <code>YYYY</code> (4-digit
45
+ year), <code>MM</code> (2-digit month), <code>DD</code> (2-digit day), <code>hh</code> (2-digit hour),
46
+ <code>mm</code> (2-digit minute), and <code>ss</code> (2-digit second).
47
+ </p>
48
+ <div class="row -mx mb">
49
+ <div class="col d-span-6 m-span-12 px">
50
+ <k-card label="HTML">
51
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span> <span class="hljs-attr">format</span>=<span class="hljs-string">"MM/DD/YYYY"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-timestamp</span>&gt;</span></code></pre>
52
+ </k-card>
53
+ </div>
54
+ <div class="col d-span-6 m-span-12 px">
55
+ <k-card label="Results">
56
+ <k-timestamp timestamp="1633024800000" format="MM/DD/YYYY"></k-timestamp>
57
+ </k-card>
58
+ </div>
59
+ </div>
60
+
61
+
62
+
63
+ <h4 id="timeFormat"><a href="#timeFormat" class="no-link">Time Format</a></h4>
64
+ <p>Display time with custom formatting using hour, minute, and second tokens.</p>
65
+ <div class="row -mx mb">
66
+ <div class="col d-span-6 m-span-12 px">
67
+ <k-card label="HTML">
68
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-timestamp</span> <span class="hljs-attr">timestamp</span>=<span class="hljs-string">"1633024800000"</span> <span class="hljs-attr">format</span>=<span class="hljs-string">"hh:mm:ss"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-timestamp</span>&gt;</span></code></pre>
69
+ </k-card>
70
+ </div>
71
+ <div class="col d-span-6 m-span-12 px">
72
+ <k-card label="Results">
73
+ <k-timestamp timestamp="1633024800000" format="hh:mm:ss"></k-timestamp>
74
+ </k-card>
75
+ </div>
76
+ </div>
77
+
78
+
79
+
80
+ <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
81
+
82
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
83
+ <h6>Extends ShadowComponent</h6>
84
+
85
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
86
+ <ul>
87
+ <li>ShadowComponent</li>
88
+ <li><a href="{{pathToRoot}}utils/formatTimestamp.js">formatTimestamp Utility Function</a></li>
89
+ </ul>
90
+
91
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
92
+ <h5><code>timestamp<i>: number</i></code></h5>
93
+ <p>The timestamp to be formatted and displayed. Syncs to <code>timestamp</code> attribute.</p>
94
+ <h5><code>format<i>: string</i></code></h5>
95
+ <p>The format to be used for formatting the timestamp using tokens like YYYY, MM, DD, hh, mm, ss. If not provided,
96
+ uses the default format. Syncs to <code>format</code> attribute.</p>
97
+ <h5><code>locale<i>: string</i></code></h5>
98
+ <p>The locale to be used for formatting the timestamp. Syncs to <code>locale</code> attribute.</p>
99
+
100
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
101
+ <p>The <code>Timestamp</code> class does not introduce any new methods beyond those provided by the ShadowComponent
102
+ class.</p>
103
+ </content>
104
+ <content location="scripts">
105
+ <script type="module" src="{{pathToRoot}}src/components/Timestamp.js"></script>
106
+ <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
107
+ <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
108
+ </content>
109
+ </page>