kempo-ui 0.0.11 → 0.0.13

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 (47) hide show
  1. package/docs/components/accordion.html +122 -32
  2. package/docs/components/card.html +57 -41
  3. package/docs/components/collapsible.html +158 -36
  4. package/docs/components/content-slider.html +182 -35
  5. package/docs/components/dialog.html +79 -45
  6. package/docs/components/focus-capture.html +78 -40
  7. package/docs/components/hybrid-component.html +72 -34
  8. package/docs/components/icon.html +122 -41
  9. package/docs/components/import.html +39 -41
  10. package/docs/components/light-component.html +60 -35
  11. package/docs/components/persistant-collapsible.html +84 -38
  12. package/docs/components/photo-viewer.html +186 -37
  13. package/docs/components/resize.html +140 -38
  14. package/docs/components/shadow-component.html +53 -39
  15. package/docs/components/show-more.html +93 -40
  16. package/docs/components/side-menu.html +122 -38
  17. package/docs/components/sortable.html +94 -36
  18. package/docs/components/split.html +112 -39
  19. package/docs/components/table.html +269 -31
  20. package/docs/components/tableControls.html +54 -51
  21. package/docs/components/tableCustomFields.html +90 -51
  22. package/docs/components/tableFetchRecords.html +89 -49
  23. package/docs/components/tableFieldSortHide.html +52 -51
  24. package/docs/components/tablePagination.html +77 -51
  25. package/docs/components/tableRecordEditing.html +121 -51
  26. package/docs/components/tableRecordFiltering.html +63 -49
  27. package/docs/components/tableRecordHiding.html +56 -50
  28. package/docs/components/tableRecordSearching.html +52 -51
  29. package/docs/components/tableRecordSelection.html +53 -52
  30. package/docs/components/tableRowControls.html +56 -52
  31. package/docs/components/tableSorting.html +50 -51
  32. package/docs/components/tabs.html +147 -43
  33. package/docs/components/tags.html +72 -38
  34. package/docs/components/theme-switcher.html +86 -36
  35. package/docs/components/timestamp.html +44 -38
  36. package/docs/components/toast.html +25 -44
  37. package/docs/components/toggle.html +119 -39
  38. package/docs/components/tree.html +145 -39
  39. package/docs/dev.config.json +1 -1
  40. package/docs/index.html +209 -55
  41. package/docs/utils/debounce.html +31 -28
  42. package/docs/utils/drag.html +42 -28
  43. package/docs/utils/formatTimestamp.html +67 -28
  44. package/docs/utils/propConverters.html +80 -23
  45. package/docs/utils/toTitleCase.html +24 -28
  46. package/docs/utils/watchWindowSize.html +96 -5
  47. package/package.json +1 -1
@@ -3,9 +3,8 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>watchWindowSize - Kempo UI</title>
7
- <link rel="stylesheet" href="../kempo-vars.css" />
8
- <link rel="stylesheet" href="../kempo.min.css" />
6
+ <title>Collapsible - Components - Kempo Docs - A Web Components Solution</title>
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
9
8
  <link rel="stylesheet" href="../kempo-hljs.css" />
10
9
  <link rel="stylesheet" href="../styles.css" />
11
10
  <script>window.litDisableBundleWarning = true;</script>
@@ -13,59 +12,182 @@
13
12
  </head>
14
13
  <body>
15
14
  <k-import src="../nav.inc.html"></k-import>
15
+ <h1 class="ta-center">Collapsible</h1>
16
16
  <main>
17
- <h1>watchWindowSize</h1>
18
-
19
- <details
20
- class="b r mb"
21
- >
17
+ <details class="b r mb">
22
18
  <summary class="p">Table of Contents</summary>
23
19
  <div class="m mt0 pl">
24
- <h6>Usage</h6>
20
+ <h6>Examples</h6>
25
21
  <a href="#basicUsage">Basic Usage</a><br />
26
- <a href="#functions">Functions</a><br />
27
- <a href="#examples">Examples</a><br />
22
+ <a href="#defaultOpen">Default Open</a><br />
23
+ <a href="#customLabel">Custom Label</a><br />
24
+ <a href="#customIcon">Custom Icon</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="#properties">Properties</a><br />
30
+ <a href="#methods">Methods</a><br />
31
+ <a href="#events">Events</a><br />
32
+ <a href="#slots">Slots</a><br />
28
33
  </div>
29
34
  </details>
30
35
 
31
36
  <h3>Description</h3>
32
- <p>The <code>watchWindowSize</code> utility provides a debounced way to monitor window resize events. It manages multiple handlers efficiently and automatically debounces resize events to improve performance.</p>
37
+ <p>The Collapsible component provides a way to show/hide content with a clickable label header. It features a rotating chevron icon and smooth transitions. The component extends the <a href="./component.html">ShadowComponent</a> class and supports customizable labels and icons through slots.</p>
33
38
 
34
39
  <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
35
- <p>Import and use the window size watching functions:</p>
36
- <pre><code class="hljs javascript"><span class="hljs-keyword">import</span> { watchWindowSize, unwatchWindowSize } <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/watchWindowSize.js'</span>;<br /><br /><span class="hljs-keyword">const</span> handler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Window width:'</span>, width);<br />};<br /><br /><span class="hljs-comment">// Start watching</span><br /><span class="hljs-keyword">const</span> currentWidth = watchWindowSize(handler);<br /><br /><span class="hljs-comment">// Stop watching when done</span><br />unwatchWindowSize(handler);</code></pre>
40
+ <p>Use the collapsible component to create expandable content sections. Click the label to toggle the content visibility.</p>
41
+
42
+ <div class="row -mx mb">
43
+ <div class="col d-span-6 m-span-12 px">
44
+ <k-card label="HTML">
45
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-collapsible</span>&gt;</span>
46
+ <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"label"</span>&gt;</span>Click to expand<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
47
+ <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This content can be collapsed or expanded.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
48
+ <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Add any content here that you want to show/hide.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
49
+ <span class="hljs-tag">&lt;/<span class="hljs-name">k-collapsible</span>&gt;</span></code></pre>
50
+ </k-card>
51
+ </div>
52
+ <div class="col d-span-6 m-span-12 px">
53
+ <k-card label="Output">
54
+ <k-collapsible>
55
+ <span slot="label">Click to expand</span>
56
+ <p>This content can be collapsed or expanded.</p>
57
+ <p>Add any content here that you want to show/hide.</p>
58
+ </k-collapsible>
59
+ </k-card>
60
+ </div>
61
+ </div>
37
62
 
38
- <h3 id="functions"><a href="#functions" class="no-link">Functions</a></h3>
63
+ <h3 id="defaultOpen"><a href="#defaultOpen" class="no-link">Default Open</a></h3>
64
+ <p>Set the <code>opened</code> attribute to have the collapsible start in an expanded state.</p>
39
65
 
40
- <h5><code>watchWindowSize(handler)</code></h5>
41
- <p>Registers a handler function to be called when the window is resized.</p>
42
- <ul>
43
- <li><strong>handler:</strong> Function that receives the new window width</li>
44
- <li><strong>Returns:</strong> Current window width</li>
45
- </ul>
66
+ <div class="row -mx mb">
67
+ <div class="col d-span-6 m-span-12 px">
68
+ <k-card label="HTML">
69
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-collapsible</span> <span class="hljs-attr">opened</span>=<span class="hljs-string">"true"</span>&gt;</span>
70
+ <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"label"</span>&gt;</span>Already expanded<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
71
+ <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This collapsible starts in an open state.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
72
+ <span class="hljs-tag">&lt;/<span class="hljs-name">k-collapsible</span>&gt;</span></code></pre>
73
+ </k-card>
74
+ </div>
75
+ <div class="col d-span-6 m-span-12 px">
76
+ <k-card label="Output">
77
+ <k-collapsible opened="true">
78
+ <span slot="label">Already expanded</span>
79
+ <p>This collapsible starts in an open state.</p>
80
+ </k-collapsible>
81
+ </k-card>
82
+ </div>
83
+ </div>
84
+
85
+ <h3 id="customLabel"><a href="#customLabel" class="no-link">Custom Label</a></h3>
86
+ <p>You can put any content in the label slot, including formatted text, icons, or even other components.</p>
87
+
88
+ <div class="row -mx mb">
89
+ <div class="col d-span-6 m-span-12 px">
90
+ <k-card label="HTML">
91
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-collapsible</span>&gt;</span>
92
+ <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"label"</span>&gt;</span>
93
+ <span class="hljs-tag">&lt;<span class="hljs-name">strong</span>&gt;</span>Advanced Settings<span class="hljs-tag">&lt;/<span class="hljs-name">strong</span>&gt;</span>
94
+ <span class="hljs-tag">&lt;<span class="hljs-name">small</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"opacity-50 ml"</span>&gt;</span>(Optional)<span class="hljs-tag">&lt;/<span class="hljs-name">small</span>&gt;</span>
95
+ <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
96
+ <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Configure advanced options here.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
97
+ <span class="hljs-tag">&lt;/<span class="hljs-name">k-collapsible</span>&gt;</span></code></pre>
98
+ </k-card>
99
+ </div>
100
+ <div class="col d-span-6 m-span-12 px">
101
+ <k-card label="Output">
102
+ <k-collapsible>
103
+ <div slot="label">
104
+ <strong>Advanced Settings</strong>
105
+ <small class="opacity-50 ml">(Optional)</small>
106
+ </div>
107
+ <p>Configure advanced options here.</p>
108
+ </k-collapsible>
109
+ </k-card>
110
+ </div>
111
+ </div>
112
+
113
+ <h3 id="customIcon"><a href="#customIcon" class="no-link">Custom Icon</a></h3>
114
+ <p>Replace the default chevron icon with your own content using the <code>labelIcon</code> slot.</p>
115
+
116
+ <div class="row -mx mb">
117
+ <div class="col d-span-6 m-span-12 px">
118
+ <k-card label="HTML">
119
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-collapsible</span>&gt;</span>
120
+ <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"label"</span>&gt;</span>Custom Icon<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
121
+ <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"labelIcon"</span>&gt;</span>▼<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
122
+ <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Using a custom arrow icon.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
123
+ <span class="hljs-tag">&lt;/<span class="hljs-name">k-collapsible</span>&gt;</span></code></pre>
124
+ </k-card>
125
+ </div>
126
+ <div class="col d-span-6 m-span-12 px">
127
+ <k-card label="Output">
128
+ <k-collapsible>
129
+ <span slot="label">Custom Icon</span>
130
+ <span slot="labelIcon">▼</span>
131
+ <p>Using a custom arrow icon.</p>
132
+ </k-collapsible>
133
+ </k-card>
134
+ </div>
135
+ </div>
136
+
137
+ <h2 id="jsRef">JavaScript Reference</h2>
46
138
 
47
- <h5><code>unwatchWindowSize(handler)</code></h5>
48
- <p>Unregisters a previously registered handler function.</p>
139
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
140
+ <h6>Extends <a href="./component.html">ShadowComponent</a></h6>
141
+ <h5>
142
+ <code>new Collapsible()</code>
143
+ </h5>
144
+
145
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
49
146
  <ul>
50
- <li><strong>handler:</strong> The same function reference that was registered</li>
147
+ <li><a href="./component.html">ShadowComponent</a></li>
148
+ <li><a href="./icon.html">Icon</a></li>
51
149
  </ul>
52
150
 
53
- <h3 id="examples"><a href="#examples" class="no-link">Examples</a></h3>
54
-
55
- <h4>Responsive Component</h4>
56
- <pre><code class="hljs javascript"><span class="hljs-keyword">import</span> { watchWindowSize, unwatchWindowSize } <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/watchWindowSize.js'</span>;<br /><br /><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ResponsiveComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">LitElement</span> </span>{<br /> <span class="hljs-keyword">constructor</span>() {<br /> <span class="hljs-keyword">super</span>();<br /> <span class="hljs-keyword">this</span>.isMobile = <span class="hljs-literal">false</span>;<br /> <span class="hljs-keyword">this</span>.resizeHandler = <span class="hljs-keyword">this</span>.handleResize.bind(<span class="hljs-keyword">this</span>);<br /> }<br /><br /> connectedCallback() {<br /> <span class="hljs-keyword">super</span>.connectedCallback();<br /> <span class="hljs-keyword">const</span> currentWidth = watchWindowSize(<span class="hljs-keyword">this</span>.resizeHandler);<br /> <span class="hljs-keyword">this</span>.handleResize(currentWidth);<br /> }<br /><br /> disconnectedCallback() {<br /> <span class="hljs-keyword">super</span>.disconnectedCallback();<br /> unwatchWindowSize(<span class="hljs-keyword">this</span>.resizeHandler);<br /> }<br /><br /> handleResize(width) {<br /> <span class="hljs-keyword">this</span>.isMobile = width &lt; <span class="hljs-number">768</span>;<br /> <span class="hljs-keyword">this</span>.requestUpdate();<br /> }<br /><br /> render() {<br /> <span class="hljs-keyword">return</span> html`<span class="xml"><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"</span></span></span><span class="hljs-subst">${<span class="hljs-keyword">this</span>.isMobile ? <span class="hljs-string">'mobile'</span> : <span class="hljs-string">'desktop'</span>}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span><br /> Content adapts to screen size<br /> <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> `</span>;<br /> }<br />}</code></pre>
151
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
152
+ <h5><code>opened<i>: boolean</i></code></h5>
153
+ <p>Gets or sets whether the collapsible is currently expanded. Changing this property will trigger the appropriate events and visual state changes. Syncs to <code>opened</code> attribute. Default value is <code>false</code>.</p>
57
154
 
58
- <h4>Multiple Handlers</h4>
59
- <pre><code class="hljs javascript"><span class="hljs-comment">// Handler for navigation</span><br /><span class="hljs-keyword">const</span> navHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-keyword">const</span> nav = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'.navigation'</span>);<br /> nav.classList.toggle(<span class="hljs-string">'mobile'</span>, width &lt; <span class="hljs-number">1024</span>);<br />};<br /><br /><span class="hljs-comment">// Handler for sidebar</span><br /><span class="hljs-keyword">const</span> sidebarHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-keyword">const</span> sidebar = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'.sidebar'</span>);<br /> sidebar.style.display = width &lt; <span class="hljs-number">768</span> ? <span class="hljs-string">'none'</span> : <span class="hljs-string">'block'</span>;<br />};<br /><br /><span class="hljs-comment">// Both handlers will be called on resize</span><br />watchWindowSize(navHandler);<br />watchWindowSize(sidebarHandler);<br /><br /><span class="hljs-comment">// Clean up when needed</span><br />unwatchWindowSize(navHandler);<br />unwatchWindowSize(sidebarHandler);</code></pre>
155
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
156
+ <h5><code>open()<i>: void</i></code></h5>
157
+ <p>Expands the collapsible to show its content. Sets <code>opened</code> to <code>true</code>.</p>
60
158
 
61
- <h4>Breakpoint Detection</h4>
62
- <pre><code class="hljs javascript"><span class="hljs-keyword">const</span> breakpoints = {<br /> <span class="hljs-attr">mobile</span>: <span class="hljs-number">768</span>,<br /> <span class="hljs-attr">tablet</span>: <span class="hljs-number">1024</span>,<br /> <span class="hljs-attr">desktop</span>: <span class="hljs-number">1200</span><br />};<br /><br /><span class="hljs-keyword">const</span> breakpointHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-keyword">let</span> currentBreakpoint = <span class="hljs-string">'mobile'</span>;<br /> <br /> <span class="hljs-keyword">if</span> (width &gt;= breakpoints.desktop) {<br /> currentBreakpoint = <span class="hljs-string">'desktop'</span>;<br /> } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (width &gt;= breakpoints.tablet) {<br /> currentBreakpoint = <span class="hljs-string">'tablet'</span>;<br /> }<br /> <br /> <span class="hljs-built_in">document</span>.body.setAttribute(<span class="hljs-string">'data-breakpoint'</span>, currentBreakpoint);<br /> <br /> <span class="hljs-comment">// Dispatch custom event</span><br /> <span class="hljs-built_in">window</span>.dispatchEvent(<span class="hljs-keyword">new</span> CustomEvent(<span class="hljs-string">'breakpointchange'</span>, {<br /> <span class="hljs-attr">detail</span>: { width, <span class="hljs-attr">breakpoint</span>: currentBreakpoint }<br /> }));<br />};<br /><br />watchWindowSize(breakpointHandler);</code></pre>
159
+ <h5><code>close()<i>: void</i></code></h5>
160
+ <p>Collapses the collapsible to hide its content. Sets <code>opened</code> to <code>false</code>.</p>
161
+
162
+ <h5><code>toggle()<i>: void</i></code></h5>
163
+ <p>Toggles the collapsible state (expands if collapsed, collapses if expanded). Dispatches an <code>openedtoggled</code> event.</p>
63
164
 
64
- <h4>Performance Benefits</h4>
65
- <p>The utility automatically debounces resize events, so you don't need to worry about performance:</p>
66
- <pre><code class="hljs javascript"><span class="hljs-comment">// This handler will only be called after resize events stop</span><br /><span class="hljs-keyword">const</span> expensiveHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-comment">// Expensive DOM calculations or API calls</span><br /> recalculateLayout();<br /> updateCharts();<br /> reflow();<br />};<br /><br />watchWindowSize(expensiveHandler); <span class="hljs-comment">// Automatically debounced</span></code></pre>
165
+ <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
166
+ <h5><code>openedchanged</code></h5>
167
+ <p>Fired when the opened state changes. The event detail contains the string <code>"open"</code> or <code>"close"</code>.</p>
168
+
169
+ <h5><code>open</code></h5>
170
+ <p>Fired when the collapsible is expanded.</p>
171
+
172
+ <h5><code>close</code></h5>
173
+ <p>Fired when the collapsible is collapsed.</p>
174
+
175
+ <h5><code>openedtoggled</code></h5>
176
+ <p>Fired when the <code>toggle()</code> method is called (typically when the label is clicked).</p>
67
177
 
178
+ <h3 id="slots"><a href="#slots" class="no-link">Slots</a></h3>
179
+ <h5><code>Default Slot</code></h5>
180
+ <p>The main content area that can be collapsed or expanded.</p>
181
+
182
+ <h5><code>label</code></h5>
183
+ <p>The clickable label content. This is what users click to toggle the collapsible state.</p>
184
+
185
+ <h5><code>labelIcon</code></h5>
186
+ <p>Custom content for the toggle icon. Defaults to a right-pointing chevron that rotates when expanded. The icon automatically gets hover effects and rotation animations.</p>
187
+
68
188
  </main>
69
- <div style="height:33vh"></div>
189
+ <div style="height:33vh"></div>
190
+ <script type="module" src="../src/components/Import.js"></script>
191
+ <script type="module" src="../src/components/Collapsible.js"></script>
70
192
  </body>
71
193
  </html>
@@ -3,9 +3,8 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>watchWindowSize - Kempo UI</title>
7
- <link rel="stylesheet" href="../kempo-vars.css" />
8
- <link rel="stylesheet" href="../kempo.min.css" />
6
+ <title>Content Slider - Components - Kempo Docs - A Web Components Solution</title>
7
+ <link rel="stylesheet" href="../kempo-vars.css" /><link rel="stylesheet" href="../kempo.min.css" />
9
8
  <link rel="stylesheet" href="../kempo-hljs.css" />
10
9
  <link rel="stylesheet" href="../styles.css" />
11
10
  <script>window.litDisableBundleWarning = true;</script>
@@ -13,59 +12,207 @@
13
12
  </head>
14
13
  <body>
15
14
  <k-import src="../nav.inc.html"></k-import>
15
+ <h1 class="ta-center">Content Slider</h1>
16
16
  <main>
17
- <h1>watchWindowSize</h1>
18
-
19
17
  <details
20
18
  class="b r mb"
21
19
  >
22
20
  <summary class="p">Table of Contents</summary>
23
21
  <div class="m mt0 pl">
24
- <h6>Usage</h6>
22
+ <h6>Examples</h6>
25
23
  <a href="#basicUsage">Basic Usage</a><br />
26
- <a href="#functions">Functions</a><br />
27
- <a href="#examples">Examples</a><br />
24
+ <a href="#keyboardControls">Keyboard Controls</a><br />
25
+ <a href="#globalControls">Global Controls</a><br />
26
+ <a href="#controls">Controls</a><br />
27
+ <a href="#loop">Loop</a><br />
28
+ <h6 class="mt">JavaScript Reference</h6>
29
+ <a href="#constructor">Constructor</a><br />
30
+ <a href="#requirements">Requirements</a><br />
31
+ <a href="#properties">Properties</a><br />
32
+ <a href="#methods">Methods</a><br />
33
+ <a href="#events">Events</a><br />
34
+ <a href="#slots">Slots</a><br />
28
35
  </div>
29
36
  </details>
30
37
 
31
38
  <h3>Description</h3>
32
- <p>The <code>watchWindowSize</code> utility provides a debounced way to monitor window resize events. It manages multiple handlers efficiently and automatically debounces resize events to improve performance.</p>
39
+ <p>The ContentSlider component provides a way to display multiple content slides with navigation controls. Users can navigate through slides using previous/next buttons, keyboard arrows, or programmatically. It extends the <a href="./component.html">ShadowComponent</a> class and supports looping, keyboard controls, and customizable navigation.</p>
33
40
 
34
41
  <h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
35
- <p>Import and use the window size watching functions:</p>
36
- <pre><code class="hljs javascript"><span class="hljs-keyword">import</span> { watchWindowSize, unwatchWindowSize } <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/watchWindowSize.js'</span>;<br /><br /><span class="hljs-keyword">const</span> handler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Window width:'</span>, width);<br />};<br /><br /><span class="hljs-comment">// Start watching</span><br /><span class="hljs-keyword">const</span> currentWidth = watchWindowSize(handler);<br /><br /><span class="hljs-comment">// Stop watching when done</span><br />unwatchWindowSize(handler);</code></pre>
42
+ <div class="row -mx">
43
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
44
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-content-slider</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"bg-alt"</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 10rem"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 3<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 4<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-content-slider</span>&gt;</span></code></pre>
45
+ </div>
46
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
47
+ <k-content-slider
48
+ class="bg-alt"
49
+ style="height: 10rem"
50
+ >
51
+ <div><p>Slide 1</p></div>
52
+ <div><p>Slide 2</p></div>
53
+ <div><p>Slide 3</p></div>
54
+ <div><p>Slide 4</p></div>
55
+ </k-content-slider>
56
+ </div>
57
+ </div>
37
58
 
38
- <h3 id="functions"><a href="#functions" class="no-link">Functions</a></h3>
39
-
40
- <h5><code>watchWindowSize(handler)</code></h5>
41
- <p>Registers a handler function to be called when the window is resized.</p>
42
- <ul>
43
- <li><strong>handler:</strong> Function that receives the new window width</li>
44
- <li><strong>Returns:</strong> Current window width</li>
45
- </ul>
59
+ <h3 id="keyboardControls"><a href="#keyboardControls" class="no-link">Keyboard Controls</a></h3>
60
+ <p>By default the <code>keyboard-controls</code> attribute is set to <code>"true"</code>, which allows the left and right keyboard buttons to change the slides when the component is focused. Set it to <code>"false"</code> to disable this functionality.</p>
61
+ <div class="row -mx">
62
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
63
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-content-slider</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"bg-alt"</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 10rem"</span><br /> <span class="hljs-attr">keyboard-controls</span>=<span class="hljs-string">"false"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 3<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 4<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-content-slider</span>&gt;</span></code></pre>
64
+ </div>
65
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
66
+ <k-content-slider
67
+ class="bg-alt"
68
+ style="height: 10rem"
69
+ keyboard-controls="false"
70
+ >
71
+ <div><p>Slide 1</p></div>
72
+ <div><p>Slide 2</p></div>
73
+ <div><p>Slide 3</p></div>
74
+ <div><p>Slide 4</p></div>
75
+ </k-content-slider>
76
+ </div>
77
+ </div>
78
+
79
+ <h3 id="globalControls"><a href="#globalControls" class="no-link">Global Controls</a></h3>
80
+ <p>Use the <code>global-controls="true"</code> attribute to enable global controls (next and back arrows) anywhere in the window, even when this component is not focused. This is suggested when there is only one content slider on a page and it is of prominance (large slider on top of the page).</p>
81
+ <div class="row -mx">
82
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
83
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-content-slider</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"bg-alt"</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 10rem"</span><br /> <span class="hljs-attr">global-controls</span>=<span class="hljs-string">"true"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 3<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 4<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-content-slider</span>&gt;</span></code></pre>
84
+ </div>
85
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
86
+ <k-content-slider
87
+ class="bg-alt"
88
+ style="height: 10rem"
89
+ global-controls="true"
90
+ >
91
+ <div><p>Slide 1</p></div>
92
+ <div><p>Slide 2</p></div>
93
+ <div><p>Slide 3</p></div>
94
+ <div><p>Slide 4</p></div>
95
+ </k-content-slider>
96
+ </div>
97
+ </div>
98
+
99
+ <h3 id="controls"><a href="#controls" class="no-link">Controls</a></h3>
100
+ <p>By default the <code>controls</code> attribute is set to <code>"true"</code>, this shows the previous and next buttons. To hide them set <code>controls="false"</code>.</p>
101
+ <div class="row -mx">
102
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
103
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-content-slider</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"bg-alt"</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 10rem"</span><br /> <span class="hljs-attr">controls</span>=<span class="hljs-string">"false"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 3<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 4<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-content-slider</span>&gt;</span></code></pre>
104
+ </div>
105
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
106
+ <k-content-slider
107
+ class="bg-alt"
108
+ style="height: 10rem"
109
+ controls="false"
110
+ >
111
+ <div><p>Slide 1</p></div>
112
+ <div><p>Slide 2</p></div>
113
+ <div><p>Slide 3</p></div>
114
+ <div><p>Slide 4</p></div>
115
+ </k-content-slider>
116
+ </div>
117
+ </div>
118
+
119
+ <h3 id="loop"><a href="#loop" class="no-link">Loop</a></h3>
120
+ <p>To make the slider loop (go back to the beginning after it hits the last slide) use the <code>loop="true"</code> attribute.</p>
121
+ <div class="row -mx">
122
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
123
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-content-slider</span><br /> <span class="hljs-attr">class</span>=<span class="hljs-string">"bg-alt"</span><br /> <span class="hljs-attr">style</span>=<span class="hljs-string">"height: 10rem"</span><br /> <span class="hljs-attr">loop</span>=<span class="hljs-string">"true"</span><br />&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 1<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 2<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 3<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Slide 4<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /><span class="hljs-tag">&lt;/<span class="hljs-name">k-content-slider</span>&gt;</span></code></pre>
124
+ </div>
125
+ <div class="col d-span-6 t-span-6 m-spane-12 p">
126
+ <k-content-slider
127
+ class="bg-alt"
128
+ style="height: 10rem"
129
+ loop="true"
130
+ >
131
+ <div><p>Slide 1</p></div>
132
+ <div><p>Slide 2</p></div>
133
+ <div><p>Slide 3</p></div>
134
+ <div><p>Slide 4</p></div>
135
+ </k-content-slider>
136
+ </div>
137
+ </div>
138
+
139
+ <h2 id="jsRef">JavaScript Refrerence</h2>
46
140
 
47
- <h5><code>unwatchWindowSize(handler)</code></h5>
48
- <p>Unregisters a previously registered handler function.</p>
141
+ <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
142
+ <h6>Extends <a href="./component.html">ShadowComponent</a></h6>
143
+ <h5>
144
+ <code>new ContentSlider()</code>
145
+ </h5>
146
+
147
+ <h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
49
148
  <ul>
50
- <li><strong>handler:</strong> The same function reference that was registered</li>
149
+ <li><a href="./component.html">ShadowComponent</a></li>
150
+ <li><a href="./icon.html">Icon</a></li>
51
151
  </ul>
52
152
 
53
- <h3 id="examples"><a href="#examples" class="no-link">Examples</a></h3>
54
-
55
- <h4>Responsive Component</h4>
56
- <pre><code class="hljs javascript"><span class="hljs-keyword">import</span> { watchWindowSize, unwatchWindowSize } <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/watchWindowSize.js'</span>;<br /><br /><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ResponsiveComponent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">LitElement</span> </span>{<br /> <span class="hljs-keyword">constructor</span>() {<br /> <span class="hljs-keyword">super</span>();<br /> <span class="hljs-keyword">this</span>.isMobile = <span class="hljs-literal">false</span>;<br /> <span class="hljs-keyword">this</span>.resizeHandler = <span class="hljs-keyword">this</span>.handleResize.bind(<span class="hljs-keyword">this</span>);<br /> }<br /><br /> connectedCallback() {<br /> <span class="hljs-keyword">super</span>.connectedCallback();<br /> <span class="hljs-keyword">const</span> currentWidth = watchWindowSize(<span class="hljs-keyword">this</span>.resizeHandler);<br /> <span class="hljs-keyword">this</span>.handleResize(currentWidth);<br /> }<br /><br /> disconnectedCallback() {<br /> <span class="hljs-keyword">super</span>.disconnectedCallback();<br /> unwatchWindowSize(<span class="hljs-keyword">this</span>.resizeHandler);<br /> }<br /><br /> handleResize(width) {<br /> <span class="hljs-keyword">this</span>.isMobile = width &lt; <span class="hljs-number">768</span>;<br /> <span class="hljs-keyword">this</span>.requestUpdate();<br /> }<br /><br /> render() {<br /> <span class="hljs-keyword">return</span> html`<span class="xml"><br /> <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"</span></span></span><span class="hljs-subst">${<span class="hljs-keyword">this</span>.isMobile ? <span class="hljs-string">'mobile'</span> : <span class="hljs-string">'desktop'</span>}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span><br /> Content adapts to screen size<br /> <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span><br /> `</span>;<br /> }<br />}</code></pre>
153
+ <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
154
+ <h5><code>index<i>: number</i></code></h5>
155
+ <p>Gets or sets the current slide index. Automatically validates to stay within bounds. Syncs to <code>index</code> attribute. Default value is <code>0</code>.</p>
156
+
157
+ <h5><code>controls<i>: boolean</i></code></h5>
158
+ <p>Gets or sets whether control buttons are visible. Syncs to <code>controls</code> attribute. Default value is <code>true</code>.</p>
159
+
160
+ <h5><code>keyboardControls<i>: boolean</i></code></h5>
161
+ <p>Gets or sets whether keyboard controls are enabled. Syncs to <code>keyboard-controls</code> attribute. Default value is <code>true</code>.</p>
162
+
163
+ <h5><code>globalControls<i>: boolean</i></code></h5>
164
+ <p>Gets or sets whether global keyboard controls are enabled. Use with caution - recommended only for prominent sliders. Syncs to <code>global-controls</code> attribute. Default value is <code>false</code>.</p>
57
165
 
58
- <h4>Multiple Handlers</h4>
59
- <pre><code class="hljs javascript"><span class="hljs-comment">// Handler for navigation</span><br /><span class="hljs-keyword">const</span> navHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-keyword">const</span> nav = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'.navigation'</span>);<br /> nav.classList.toggle(<span class="hljs-string">'mobile'</span>, width &lt; <span class="hljs-number">1024</span>);<br />};<br /><br /><span class="hljs-comment">// Handler for sidebar</span><br /><span class="hljs-keyword">const</span> sidebarHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-keyword">const</span> sidebar = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'.sidebar'</span>);<br /> sidebar.style.display = width &lt; <span class="hljs-number">768</span> ? <span class="hljs-string">'none'</span> : <span class="hljs-string">'block'</span>;<br />};<br /><br /><span class="hljs-comment">// Both handlers will be called on resize</span><br />watchWindowSize(navHandler);<br />watchWindowSize(sidebarHandler);<br /><br /><span class="hljs-comment">// Clean up when needed</span><br />unwatchWindowSize(navHandler);<br />unwatchWindowSize(sidebarHandler);</code></pre>
166
+ <h5><code>loop<i>: boolean</i></code></h5>
167
+ <p>Gets or sets whether the slider loops continuously (after the last slide, go to the first; before the first slide, go to the last). Syncs to <code>loop</code> attribute. Default value is <code>false</code>.</p>
60
168
 
61
- <h4>Breakpoint Detection</h4>
62
- <pre><code class="hljs javascript"><span class="hljs-keyword">const</span> breakpoints = {<br /> <span class="hljs-attr">mobile</span>: <span class="hljs-number">768</span>,<br /> <span class="hljs-attr">tablet</span>: <span class="hljs-number">1024</span>,<br /> <span class="hljs-attr">desktop</span>: <span class="hljs-number">1200</span><br />};<br /><br /><span class="hljs-keyword">const</span> breakpointHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-keyword">let</span> currentBreakpoint = <span class="hljs-string">'mobile'</span>;<br /> <br /> <span class="hljs-keyword">if</span> (width &gt;= breakpoints.desktop) {<br /> currentBreakpoint = <span class="hljs-string">'desktop'</span>;<br /> } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (width &gt;= breakpoints.tablet) {<br /> currentBreakpoint = <span class="hljs-string">'tablet'</span>;<br /> }<br /> <br /> <span class="hljs-built_in">document</span>.body.setAttribute(<span class="hljs-string">'data-breakpoint'</span>, currentBreakpoint);<br /> <br /> <span class="hljs-comment">// Dispatch custom event</span><br /> <span class="hljs-built_in">window</span>.dispatchEvent(<span class="hljs-keyword">new</span> CustomEvent(<span class="hljs-string">'breakpointchange'</span>, {<br /> <span class="hljs-attr">detail</span>: { width, <span class="hljs-attr">breakpoint</span>: currentBreakpoint }<br /> }));<br />};<br /><br />watchWindowSize(breakpointHandler);</code></pre>
169
+ <h5><code>content<i>: Array&lt;HTMLElement&gt;</i></code></h5>
170
+ <p>Array of child elements that serve as slides. Automatically updated when the component is connected.</p>
171
+
172
+ <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
173
+ <h5><code>previous()<i>: void</i></code></h5>
174
+ <p>Navigates to the previous slide. If <code>loop</code> is enabled and currently on the first slide, goes to the last slide. Dispatches a <code>previous</code> event.</p>
175
+
176
+ <h5><code>next()<i>: void</i></code></h5>
177
+ <p>Navigates to the next slide. If <code>loop</code> is enabled and currently on the last slide, goes to the first slide. Dispatches a <code>next</code> event.</p>
178
+
179
+ <h5><code>goto(index)<i>: void</i></code></h5>
180
+ <p>Navigates to the slide at the specified index. Index is automatically validated to stay within bounds. Dispatches a <code>goto</code> event.</p>
181
+ <ul>
182
+ <li><strong>index</strong> <code>number</code> - The zero-based index of the slide to navigate to</li>
183
+ </ul>
63
184
 
64
- <h4>Performance Benefits</h4>
65
- <p>The utility automatically debounces resize events, so you don't need to worry about performance:</p>
66
- <pre><code class="hljs javascript"><span class="hljs-comment">// This handler will only be called after resize events stop</span><br /><span class="hljs-keyword">const</span> expensiveHandler = <span class="hljs-function">(<span class="hljs-params">width</span>) =&gt;</span> {<br /> <span class="hljs-comment">// Expensive DOM calculations or API calls</span><br /> recalculateLayout();<br /> updateCharts();<br /> reflow();<br />};<br /><br />watchWindowSize(expensiveHandler); <span class="hljs-comment">// Automatically debounced</span></code></pre>
185
+ <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
186
+ <h5><code>change</code></h5>
187
+ <p>Fired when the active slide changes. The event detail contains <code>{ index }</code>.</p>
188
+
189
+ <h5><code>previous</code></h5>
190
+ <p>Fired when the previous button is clicked or previous navigation is triggered. The event detail contains <code>{ index }</code> of the target slide.</p>
191
+
192
+ <h5><code>next</code></h5>
193
+ <p>Fired when the next button is clicked or next navigation is triggered. The event detail contains <code>{ index }</code> of the target slide.</p>
194
+
195
+ <h5><code>goto</code></h5>
196
+ <p>Fired when programmatic navigation to a specific slide occurs. The event detail contains <code>{ index }</code> of the target slide.</p>
197
+
198
+ <h5><code>keyleft</code></h5>
199
+ <p>Fired when the left arrow key is pressed (before triggering previous navigation).</p>
200
+
201
+ <h5><code>keyright</code></h5>
202
+ <p>Fired when the right arrow key is pressed (before triggering next navigation).</p>
67
203
 
204
+ <h3 id="slots"><a href="#slots" class="no-link">Slots</a></h3>
205
+ <h5><code>Default Slot</code></h5>
206
+ <p>The main content area where slide elements are placed. Each direct child element becomes a slide.</p>
207
+
208
+ <h5><code>prev</code></h5>
209
+ <p>Custom content for the previous button. Defaults to a left chevron icon if not provided.</p>
210
+
211
+ <h5><code>next</code></h5>
212
+ <p>Custom content for the next button. Defaults to a right chevron icon if not provided.</p>
213
+
68
214
  </main>
69
- <div style="height:33vh"></div>
215
+ <script type="module" src="../src/components/Import.js"></script>
216
+ <script type="module" src="../src/components/ContentSlider.js"></script>
70
217
  </body>
71
- </html>
218
+ </html>