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.
- package/AGENTS.md +2 -1
- package/dist/components/Aside.js +1 -1
- package/dist/components/Main.js +1 -1
- package/docs/components/accordion.html +240 -8
- package/docs/components/aside-items.html +13 -9
- package/docs/components/aside-menu.html +13 -9
- package/docs/components/aside-push.html +11 -6
- package/docs/components/aside.html +289 -115
- package/docs/components/card.html +238 -7
- package/docs/components/color-picker.html +245 -14
- package/docs/components/content-slider.html +240 -8
- package/docs/components/context.html +241 -7
- package/docs/components/dialog.html +238 -7
- package/docs/components/dropdown.html +238 -7
- package/docs/components/filter-list.html +239 -10
- package/docs/components/focus-capture.html +241 -10
- package/docs/components/html-editor.html +266 -35
- package/docs/components/hybrid-component.html +238 -6
- package/docs/components/icon.html +239 -9
- package/docs/components/import.html +239 -8
- package/docs/components/light-component.html +239 -7
- package/docs/components/nav.html +240 -8
- package/docs/components/photo-viewer.html +239 -9
- package/docs/components/resize.html +240 -9
- package/docs/components/shadow-component.html +239 -7
- package/docs/components/show-more.html +237 -8
- package/docs/components/sortable.html +239 -8
- package/docs/components/spinner.html +237 -6
- package/docs/components/split.html +241 -10
- package/docs/components/table.html +241 -11
- package/docs/components/tableControls.html +240 -7
- package/docs/components/tableCustomFields.html +241 -8
- package/docs/components/tableFetchRecords.html +239 -7
- package/docs/components/tableFieldSortHide.html +239 -7
- package/docs/components/tablePagination.html +246 -13
- package/docs/components/tablePlaceholder.html +241 -8
- package/docs/components/tableRecordEditing.html +241 -8
- package/docs/components/tableRecordFiltering.html +239 -7
- package/docs/components/tableRecordHiding.html +241 -9
- package/docs/components/tableRecordSearching.html +239 -7
- package/docs/components/tableRecordSelection.html +240 -7
- package/docs/components/tableRowControls.html +241 -8
- package/docs/components/tableServerSync.html +245 -11
- package/docs/components/tableSorting.html +239 -7
- package/docs/components/tabs.html +240 -7
- package/docs/components/tags.html +239 -7
- package/docs/components/theme-select.html +239 -7
- package/docs/components/theme-switcher.html +240 -8
- package/docs/components/timestamp.html +239 -8
- package/docs/components/toast.html +240 -8
- package/docs/components/toggle.html +240 -9
- package/docs/components/tree.html +239 -8
- package/docs/index.html +244 -6
- package/docs/prod.config.json +0 -4
- package/docs/src/components/Aside.js +1 -1
- package/docs/src/components/Main.js +1 -1
- package/docs/utils/context.html +237 -6
- package/docs/utils/cookie.html +251 -21
- package/docs/utils/debounce.html +236 -5
- package/docs/utils/drag.html +236 -5
- package/docs/utils/elevation.html +238 -6
- package/docs/utils/formatTimestamp.html +239 -9
- package/docs/utils/object.html +236 -5
- package/docs/utils/propConverters.html +233 -3
- package/docs/utils/string.html +236 -5
- package/docs/utils/theme.html +237 -6
- package/docs/utils/toTitleCase.html +239 -9
- package/docs/utils/type.html +236 -5
- package/docs/utils/wait.html +236 -5
- package/docs-src/.config.js +16 -0
- package/docs-src/bare.template.html +16 -0
- package/docs-src/components/accordion.page.html +201 -0
- package/docs-src/components/aside-items.page.html +36 -0
- package/docs-src/components/aside-menu.page.html +36 -0
- package/docs-src/components/aside-push.page.html +20 -0
- package/docs-src/components/aside.page.html +494 -0
- package/docs-src/components/card.page.html +78 -0
- package/docs-src/components/color-picker.page.html +559 -0
- package/docs-src/components/content-slider.page.html +266 -0
- package/docs-src/components/context.page.html +214 -0
- package/docs-src/components/dialog.page.html +365 -0
- package/docs-src/components/dropdown.page.html +300 -0
- package/docs-src/components/filter-list.page.html +117 -0
- package/docs-src/components/focus-capture.page.html +97 -0
- package/docs-src/components/html-editor.page.html +423 -0
- package/docs-src/components/hybrid-component.page.html +96 -0
- package/docs-src/components/icon.page.html +208 -0
- package/docs-src/components/import.page.html +76 -0
- package/docs-src/components/light-component.page.html +99 -0
- package/docs-src/components/nav.page.html +106 -0
- package/docs-src/components/photo-viewer.page.html +253 -0
- package/docs-src/components/resize.page.html +161 -0
- package/docs-src/components/shadow-component.page.html +84 -0
- package/docs-src/components/show-more.page.html +113 -0
- package/docs-src/components/sortable.page.html +117 -0
- package/docs-src/components/spinner.page.html +197 -0
- package/docs-src/components/split.page.html +195 -0
- package/docs-src/components/table.page.html +283 -0
- package/docs-src/components/tableControls.page.html +64 -0
- package/docs-src/components/tableCustomFields.page.html +124 -0
- package/docs-src/components/tableFetchRecords.page.html +95 -0
- package/docs-src/components/tableFieldSortHide.page.html +56 -0
- package/docs-src/components/tablePagination.page.html +85 -0
- package/docs-src/components/tablePlaceholder.page.html +73 -0
- package/docs-src/components/tableRecordEditing.page.html +161 -0
- package/docs-src/components/tableRecordFiltering.page.html +69 -0
- package/docs-src/components/tableRecordHiding.page.html +65 -0
- package/docs-src/components/tableRecordSearching.page.html +56 -0
- package/docs-src/components/tableRecordSelection.page.html +60 -0
- package/docs-src/components/tableRowControls.page.html +62 -0
- package/docs-src/components/tableServerSync.page.html +129 -0
- package/docs-src/components/tableSorting.page.html +54 -0
- package/docs-src/components/tabs.page.html +201 -0
- package/docs-src/components/tags.page.html +157 -0
- package/docs-src/components/theme-select.page.html +106 -0
- package/docs-src/components/theme-switcher.page.html +122 -0
- package/docs-src/components/timestamp.page.html +109 -0
- package/docs-src/components/toast.page.html +338 -0
- package/docs-src/components/toggle.page.html +177 -0
- package/docs-src/components/tree.page.html +356 -0
- package/docs-src/default.template.html +28 -0
- package/docs-src/index.page.html +312 -0
- package/docs-src/nav.fragment.html +228 -0
- package/docs-src/utils/context.page.html +143 -0
- package/docs-src/utils/cookie.page.html +128 -0
- package/docs-src/utils/debounce.page.html +42 -0
- package/docs-src/utils/drag.page.html +64 -0
- package/docs-src/utils/elevation.page.html +144 -0
- package/docs-src/utils/formatTimestamp.page.html +76 -0
- package/docs-src/utils/object.page.html +76 -0
- package/docs-src/utils/propConverters.page.html +73 -0
- package/docs-src/utils/string.page.html +66 -0
- package/docs-src/utils/theme.page.html +136 -0
- package/docs-src/utils/toTitleCase.page.html +52 -0
- package/docs-src/utils/type.page.html +31 -0
- package/docs-src/utils/wait.page.html +31 -0
- package/package.json +4 -4
- package/scripts/build.js +5 -0
- package/scripts/docs.js +5 -52
- package/src/components/Aside.js +12 -1
- package/src/components/Main.js +1 -1
- package/tests/components/Aside.browser-test.js +75 -0
- package/docs/dev.config.json +0 -20
- package/docs/nav-1.inc.html +0 -168
- package/docs/nav.inc.html +0 -168
- package/docs/nav.inc.js +0 -70
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<page pageName="Content Slider" title="Content Slider - 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="#keyboardControls">Keyboard Controls</a><br />
|
|
10
|
+
<a href="#globalControls">Global Controls</a><br />
|
|
11
|
+
<a href="#controls">Controls</a><br />
|
|
12
|
+
<a href="#loop">Loop</a><br />
|
|
13
|
+
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
14
|
+
<a href="#constructor">Constructor</a><br />
|
|
15
|
+
<a href="#requirements">Requirements</a><br />
|
|
16
|
+
<a href="#properties">Properties</a><br />
|
|
17
|
+
<a href="#methods">Methods</a><br />
|
|
18
|
+
<a href="#events">Events</a><br />
|
|
19
|
+
<a href="#slots">Slots</a><br />
|
|
20
|
+
</div>
|
|
21
|
+
</k-accordion-panel>
|
|
22
|
+
</k-accordion>
|
|
23
|
+
|
|
24
|
+
<h3>Description</h3>
|
|
25
|
+
<p>The ContentSlider component provides a way to display multiple content slides with navigation controls. Users can
|
|
26
|
+
navigate through slides using previous/next buttons, keyboard arrows, or programmatically. It extends the <a
|
|
27
|
+
href="./component.html">ShadowComponent</a> class and supports looping, keyboard controls, and customizable
|
|
28
|
+
navigation.</p>
|
|
29
|
+
|
|
30
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
31
|
+
<div class="row -mx">
|
|
32
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
33
|
+
<k-card label="HTML">
|
|
34
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<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><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 1<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 2<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 3<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 4<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-content-slider</span>></span></code></pre>
|
|
35
|
+
</k-card>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
38
|
+
<k-card label="Results">
|
|
39
|
+
<k-content-slider class="bg-alt" style="height: 10rem">
|
|
40
|
+
<div>
|
|
41
|
+
<p>Slide 1</p>
|
|
42
|
+
</div>
|
|
43
|
+
<div>
|
|
44
|
+
<p>Slide 2</p>
|
|
45
|
+
</div>
|
|
46
|
+
<div>
|
|
47
|
+
<p>Slide 3</p>
|
|
48
|
+
</div>
|
|
49
|
+
<div>
|
|
50
|
+
<p>Slide 4</p>
|
|
51
|
+
</div>
|
|
52
|
+
</k-content-slider>
|
|
53
|
+
</k-card>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<h3 id="keyboardControls"><a href="#keyboardControls" class="no-link">Keyboard Controls</a></h3>
|
|
58
|
+
<p>By default the <code>keyboard-controls</code> attribute is set to <code>"true"</code>, which allows the left and
|
|
59
|
+
right keyboard buttons to change the slides when the component is focused. Set it to <code>"false"</code> to
|
|
60
|
+
disable this functionality.</p>
|
|
61
|
+
<div class="row -mx">
|
|
62
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
63
|
+
<k-card label="HTML">
|
|
64
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<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 />></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 1<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 2<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 3<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 4<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-content-slider</span>></span></code></pre>
|
|
65
|
+
</k-card>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
68
|
+
<k-card label="Results">
|
|
69
|
+
<k-content-slider class="bg-alt" style="height: 10rem" keyboard-controls="false">
|
|
70
|
+
<div>
|
|
71
|
+
<p>Slide 1</p>
|
|
72
|
+
</div>
|
|
73
|
+
<div>
|
|
74
|
+
<p>Slide 2</p>
|
|
75
|
+
</div>
|
|
76
|
+
<div>
|
|
77
|
+
<p>Slide 3</p>
|
|
78
|
+
</div>
|
|
79
|
+
<div>
|
|
80
|
+
<p>Slide 4</p>
|
|
81
|
+
</div>
|
|
82
|
+
</k-content-slider>
|
|
83
|
+
</k-card>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<h3 id="globalControls"><a href="#globalControls" class="no-link">Global Controls</a></h3>
|
|
88
|
+
<p>Use the <code>global-controls="true"</code> attribute to enable global controls (next and back arrows) anywhere
|
|
89
|
+
in the window, even when this component is not focused. This is suggested when there is only one content slider on
|
|
90
|
+
a page and it is of prominance (large slider on top of the page).</p>
|
|
91
|
+
<div class="row -mx">
|
|
92
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
93
|
+
<k-card label="HTML">
|
|
94
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<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 />></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 1<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 2<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 3<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 4<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-content-slider</span>></span></code></pre>
|
|
95
|
+
</k-card>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
98
|
+
<k-card label="Results">
|
|
99
|
+
<k-content-slider class="bg-alt" style="height: 10rem" global-controls="true">
|
|
100
|
+
<div>
|
|
101
|
+
<p>Slide 1</p>
|
|
102
|
+
</div>
|
|
103
|
+
<div>
|
|
104
|
+
<p>Slide 2</p>
|
|
105
|
+
</div>
|
|
106
|
+
<div>
|
|
107
|
+
<p>Slide 3</p>
|
|
108
|
+
</div>
|
|
109
|
+
<div>
|
|
110
|
+
<p>Slide 4</p>
|
|
111
|
+
</div>
|
|
112
|
+
</k-content-slider>
|
|
113
|
+
</k-card>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<h3 id="controls"><a href="#controls" class="no-link">Controls</a></h3>
|
|
118
|
+
<p>By default the <code>controls</code> attribute is set to <code>"true"</code>, this shows the previous and next
|
|
119
|
+
buttons. To hide them set <code>controls="false"</code>.</p>
|
|
120
|
+
<div class="row -mx">
|
|
121
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
122
|
+
<k-card label="HTML">
|
|
123
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<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 />></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 1<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 2<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 3<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 4<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-content-slider</span>></span></code></pre>
|
|
124
|
+
</k-card>
|
|
125
|
+
</div>
|
|
126
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
127
|
+
<k-card label="Results">
|
|
128
|
+
<k-content-slider class="bg-alt" style="height: 10rem" controls="false">
|
|
129
|
+
<div>
|
|
130
|
+
<p>Slide 1</p>
|
|
131
|
+
</div>
|
|
132
|
+
<div>
|
|
133
|
+
<p>Slide 2</p>
|
|
134
|
+
</div>
|
|
135
|
+
<div>
|
|
136
|
+
<p>Slide 3</p>
|
|
137
|
+
</div>
|
|
138
|
+
<div>
|
|
139
|
+
<p>Slide 4</p>
|
|
140
|
+
</div>
|
|
141
|
+
</k-content-slider>
|
|
142
|
+
</k-card>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<h3 id="loop"><a href="#loop" class="no-link">Loop</a></h3>
|
|
147
|
+
<p>To make the slider loop (go back to the beginning after it hits the last slide) use the <code>loop="true"</code>
|
|
148
|
+
attribute.</p>
|
|
149
|
+
<div class="row -mx">
|
|
150
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
151
|
+
<k-card label="HTML">
|
|
152
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<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 />></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 1<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 2<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 3<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">div</span>></span><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Slide 4<span class="hljs-tag"></<span class="hljs-name">p</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-content-slider</span>></span></code></pre>
|
|
153
|
+
</k-card>
|
|
154
|
+
</div>
|
|
155
|
+
<div class="col d-span-6 t-span-6 m-spane-12 p">
|
|
156
|
+
<k-card label="Results">
|
|
157
|
+
<k-content-slider class="bg-alt" style="height: 10rem" loop="true">
|
|
158
|
+
<div>
|
|
159
|
+
<p>Slide 1</p>
|
|
160
|
+
</div>
|
|
161
|
+
<div>
|
|
162
|
+
<p>Slide 2</p>
|
|
163
|
+
</div>
|
|
164
|
+
<div>
|
|
165
|
+
<p>Slide 3</p>
|
|
166
|
+
</div>
|
|
167
|
+
<div>
|
|
168
|
+
<p>Slide 4</p>
|
|
169
|
+
</div>
|
|
170
|
+
</k-content-slider>
|
|
171
|
+
</k-card>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<h2 id="jsRef" class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
176
|
+
|
|
177
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
178
|
+
<h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
|
|
179
|
+
<h5>
|
|
180
|
+
<code>new ContentSlider()</code>
|
|
181
|
+
</h5>
|
|
182
|
+
|
|
183
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
184
|
+
<ul>
|
|
185
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
186
|
+
<li><a href="./icon.html">Icon</a></li>
|
|
187
|
+
</ul>
|
|
188
|
+
|
|
189
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
190
|
+
<h5><code>index<i>: number</i></code></h5>
|
|
191
|
+
<p>Gets or sets the current slide index. Automatically validates to stay within bounds. Syncs to <code>index</code>
|
|
192
|
+
attribute. Default value is <code>0</code>.</p>
|
|
193
|
+
|
|
194
|
+
<h5><code>controls<i>: boolean</i></code></h5>
|
|
195
|
+
<p>Gets or sets whether control buttons are visible. Syncs to <code>controls</code> attribute. Default value is
|
|
196
|
+
<code>true</code>.</p>
|
|
197
|
+
|
|
198
|
+
<h5><code>keyboardControls<i>: boolean</i></code></h5>
|
|
199
|
+
<p>Gets or sets whether keyboard controls are enabled. Syncs to <code>keyboard-controls</code> attribute. Default
|
|
200
|
+
value is <code>true</code>.</p>
|
|
201
|
+
|
|
202
|
+
<h5><code>globalControls<i>: boolean</i></code></h5>
|
|
203
|
+
<p>Gets or sets whether global keyboard controls are enabled. Use with caution - recommended only for prominent
|
|
204
|
+
sliders. Syncs to <code>global-controls</code> attribute. Default value is <code>false</code>.</p>
|
|
205
|
+
|
|
206
|
+
<h5><code>loop<i>: boolean</i></code></h5>
|
|
207
|
+
<p>Gets or sets whether the slider loops continuously (after the last slide, go to the first; before the first
|
|
208
|
+
slide, go to the last). Syncs to <code>loop</code> attribute. Default value is <code>false</code>.</p>
|
|
209
|
+
|
|
210
|
+
<h5><code>content<i>: Array<HTMLElement></i></code></h5>
|
|
211
|
+
<p>Array of child elements that serve as slides. Automatically updated when the component is connected.</p>
|
|
212
|
+
|
|
213
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
214
|
+
<h5><code>previous()<i>: void</i></code></h5>
|
|
215
|
+
<p>Navigates to the previous slide. If <code>loop</code> is enabled and currently on the first slide, goes to the
|
|
216
|
+
last slide. Dispatches a <code>previous</code> event.</p>
|
|
217
|
+
|
|
218
|
+
<h5><code>next()<i>: void</i></code></h5>
|
|
219
|
+
<p>Navigates to the next slide. If <code>loop</code> is enabled and currently on the last slide, goes to the first
|
|
220
|
+
slide. Dispatches a <code>next</code> event.</p>
|
|
221
|
+
|
|
222
|
+
<h5><code>goto(index)<i>: void</i></code></h5>
|
|
223
|
+
<p>Navigates to the slide at the specified index. Index is automatically validated to stay within bounds. Dispatches
|
|
224
|
+
a <code>goto</code> event.</p>
|
|
225
|
+
<ul>
|
|
226
|
+
<li><strong>index</strong> <code>number</code> - The zero-based index of the slide to navigate to</li>
|
|
227
|
+
</ul>
|
|
228
|
+
|
|
229
|
+
<h3 id="events"><a href="#events" class="no-link">Events</a></h3>
|
|
230
|
+
<h5><code>change</code></h5>
|
|
231
|
+
<p>Fired when the active slide changes. The event detail contains <code>{ index }</code>.</p>
|
|
232
|
+
|
|
233
|
+
<h5><code>previous</code></h5>
|
|
234
|
+
<p>Fired when the previous button is clicked or previous navigation is triggered. The event detail contains
|
|
235
|
+
<code>{ index }</code> of the target slide.</p>
|
|
236
|
+
|
|
237
|
+
<h5><code>next</code></h5>
|
|
238
|
+
<p>Fired when the next button is clicked or next navigation is triggered. The event detail contains
|
|
239
|
+
<code>{ index }</code> of the target slide.</p>
|
|
240
|
+
|
|
241
|
+
<h5><code>goto</code></h5>
|
|
242
|
+
<p>Fired when programmatic navigation to a specific slide occurs. The event detail contains <code>{ index }</code>
|
|
243
|
+
of the target slide.</p>
|
|
244
|
+
|
|
245
|
+
<h5><code>keyleft</code></h5>
|
|
246
|
+
<p>Fired when the left arrow key is pressed (before triggering previous navigation).</p>
|
|
247
|
+
|
|
248
|
+
<h5><code>keyright</code></h5>
|
|
249
|
+
<p>Fired when the right arrow key is pressed (before triggering next navigation).</p>
|
|
250
|
+
|
|
251
|
+
<h3 id="slots"><a href="#slots" class="no-link">Slots</a></h3>
|
|
252
|
+
<h5><code>Default Slot</code></h5>
|
|
253
|
+
<p>The main content area where slide elements are placed. Each direct child element becomes a slide.</p>
|
|
254
|
+
|
|
255
|
+
<h5><code>prev</code></h5>
|
|
256
|
+
<p>Custom content for the previous button. Defaults to a left chevron icon if not provided.</p>
|
|
257
|
+
|
|
258
|
+
<h5><code>next</code></h5>
|
|
259
|
+
<p>Custom content for the next button. Defaults to a right chevron icon if not provided.</p>
|
|
260
|
+
</content>
|
|
261
|
+
<content location="scripts">
|
|
262
|
+
<script type="module" src="{{pathToRoot}}src/components/ContentSlider.js"></script>
|
|
263
|
+
<script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
|
|
264
|
+
<script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
|
|
265
|
+
</content>
|
|
266
|
+
</page>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<page pageName="Context" title="Context - Components - Kempo Docs - A Web Components Solution">
|
|
2
|
+
<content>
|
|
3
|
+
|
|
4
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
5
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
6
|
+
<k-accordion-panel name="toc-panel">
|
|
7
|
+
<div class="m">
|
|
8
|
+
<h6>Examples</h6>
|
|
9
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
10
|
+
<a href="#events">Listening to Events</a><br />
|
|
11
|
+
<a href="#usingInComponents">Using in Components</a><br />
|
|
12
|
+
<a href="#interactiveDemo">Interactive Demo</a><br />
|
|
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="#attributes">Attributes</a><br />
|
|
17
|
+
<a href="#methods">Methods</a><br />
|
|
18
|
+
<a href="#eventsRef">Events</a><br />
|
|
19
|
+
</div>
|
|
20
|
+
</k-accordion-panel>
|
|
21
|
+
</k-accordion>
|
|
22
|
+
|
|
23
|
+
<p><code>k-context</code> is a non-rendering state container inspired by React's <code>useContext</code>. Place it in the DOM as an ancestor of components that need shared state. Descendant components locate the nearest <code>k-context</code> via <code>closest('k-context')</code>, read and write data with its methods, and react to changes by listening for its events.</p>
|
|
24
|
+
|
|
25
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
26
|
+
<p>Declare a <code><k-context></code> element in your markup. It is invisible and renders nothing; its <code>display: contents</code> style ensures its children remain in the normal document flow.</p>
|
|
27
|
+
<div class="row -mx">
|
|
28
|
+
<div class="col m-span-12 px">
|
|
29
|
+
<k-card label="HTML">
|
|
30
|
+
<pre><code class="hljs html"><span class="hljs-tag"><<span class="hljs-name">k-context</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"myContext"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-context</span>></span></code></pre>
|
|
31
|
+
</k-card>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<p>You can pre-populate the store declaratively by setting the <code>data</code> attribute to a valid JSON string:</p>
|
|
35
|
+
<div class="row -mx">
|
|
36
|
+
<div class="col m-span-12 px">
|
|
37
|
+
<k-card label="HTML">
|
|
38
|
+
<pre><code class="hljs html"><span class="hljs-tag"><<span class="hljs-name">k-context</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"myContext"</span> <span class="hljs-attr">data</span>=<span class="hljs-string">'{"count":0,"theme":"dark"}'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-context</span>></span></code></pre>
|
|
39
|
+
</k-card>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<p>Use <code>set()</code> and <code>get()</code> to write and read data by key:</p>
|
|
43
|
+
<div class="row -mx">
|
|
44
|
+
<div class="col m-span-12 px">
|
|
45
|
+
<k-card label="JavaScript">
|
|
46
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">const</span> ctx = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">querySelector</span>(<span class="hljs-string">'k-context'</span>);<br>ctx.<span class="hljs-title function_">set</span>(<span class="hljs-string">'count'</span>, <span class="hljs-number">0</span>);<br>ctx.<span class="hljs-title function_">set</span>(<span class="hljs-string">'theme'</span>, <span class="hljs-string">'dark'</span>);</code></pre>
|
|
47
|
+
</k-card>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<h3 id="events"><a href="#events" class="no-link">Listening to Events</a></h3>
|
|
52
|
+
<p><code>context:create</code> fires when a new key is set for the first time. <code>context:set</code> fires when an existing key's value changes. <code>context:delete</code> fires when a key is removed. All events bubble and are composed.</p>
|
|
53
|
+
<div class="row -mx">
|
|
54
|
+
<div class="col m-span-12 px">
|
|
55
|
+
<k-card label="JavaScript">
|
|
56
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">const</span> ctx = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">querySelector</span>(<span class="hljs-string">'k-context'</span>);<br>ctx.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'context:create'</span>, <span class="hljs-function"><span class="hljs-params">e</span> =></span> {<br> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'Created:'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">key</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">value</span>);<br>});<br>ctx.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'context:set'</span>, <span class="hljs-function"><span class="hljs-params">e</span> =></span> {<br> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'Updated:'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">key</span>, <span class="hljs-string">'from'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">oldValue</span>, <span class="hljs-string">'to'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">value</span>);<br>});<br>ctx.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'context:delete'</span>, <span class="hljs-function"><span class="hljs-params">e</span> =></span> {<br> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'Deleted:'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">key</span>, <span class="hljs-string">'was'</span>, e.<span class="hljs-property">detail</span>.<span class="hljs-property">value</span>);<br>});</code></pre>
|
|
57
|
+
</k-card>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<h3 id="usingInComponents"><a href="#usingInComponents" class="no-link">Using in Components</a></h3>
|
|
62
|
+
<p>Child components locate the nearest ancestor context using <code>closest('k-context')</code>. This follows the same scoping pattern used by all Kempo UI parent–child relationships.</p>
|
|
63
|
+
<div class="row -mx">
|
|
64
|
+
<div class="col m-span-12 px">
|
|
65
|
+
<k-card label="JavaScript">
|
|
66
|
+
<pre><code class="hljs javascript"><span class="hljs-comment">// Inside a child component, find the nearest ancestor context:</span><br><span class="hljs-keyword">const</span> ctx = <span class="hljs-variable language_">this</span>.<span class="hljs-title function_">closest</span>(<span class="hljs-string">'k-context'</span>);<br><span class="hljs-keyword">const</span> count = ctx?.<span class="hljs-title function_">get</span>(<span class="hljs-string">'count'</span>);</code></pre>
|
|
67
|
+
</k-card>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<p>To react to context changes from inside a shadow-DOM component, listen on the context element directly — events bubble and are <code>composed: true</code> so they also cross shadow boundaries.</p>
|
|
71
|
+
|
|
72
|
+
<h3 id="interactiveDemo"><a href="#interactiveDemo" class="no-link">Interactive Demo</a></h3>
|
|
73
|
+
<div class="row -mx">
|
|
74
|
+
<div class="col m-span-12 t-span-6 px">
|
|
75
|
+
<k-card label="HTML">
|
|
76
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-context</span> <span class="hljs-attr">data</span>=<span class="hljs-string">'{"count":0}'</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">button</span><br /> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"const ctx=this.closest('k-context'); ctx.set('count', (ctx.get('count') || 0) - 1)"</span><br /> ></span>-<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">count-view</span>></span><span class="hljs-tag"></<span class="hljs-name">count-view</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">button</span><br /> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"const ctx=this.closest('k-context'); ctx.set('count', (ctx.get('count') || 0) + 1)"</span><br /> ></span>+<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /> <span class="hljs-tag"><<span class="hljs-name">button</span><br /> <span class="hljs-attr">onclick</span>=<span class="hljs-string">"this.closest('k-context').clear()"</span><br /> ></span>Clear<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br /><span class="hljs-tag"></<span class="hljs-name">k-context</span>></span><br /><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>></span><span class="javascript"><br /> <span class="hljs-keyword">import</span> <span class="hljs-string">'../src/components/Context.js'</span>;<br /> <span class="hljs-keyword">import</span> ShadowComponent <span class="hljs-keyword">from</span> <span class="hljs-string">'../src/components/ShadowComponent.js'</span>;<br /> <span class="hljs-keyword">import</span> { html } <span class="hljs-keyword">from</span> <span class="hljs-string">'../src/lit-all.min.js'</span>;<br /> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CountView</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">ShadowComponent</span> </span>{<br /> connectedCallback() {<br /> <span class="hljs-keyword">super</span>.connectedCallback();<br /> <span class="hljs-keyword">const</span> ctx = <span class="hljs-keyword">this</span>.closest(<span class="hljs-string">'k-context'</span>);<br /> ctx?.addEventListener(<span class="hljs-string">'context:create'</span>, () => <span class="hljs-keyword">this</span>.requestUpdate());<br /> ctx?.addEventListener(<span class="hljs-string">'context:set'</span>, () => <span class="hljs-keyword">this</span>.requestUpdate());<br /> ctx?.addEventListener(<span class="hljs-string">'context:delete'</span>, () => <span class="hljs-keyword">this</span>.requestUpdate());<br /> }<br /> render() {<br /> <span class="hljs-keyword">const</span> count = <span class="hljs-keyword">this</span>.closest(<span class="hljs-string">'k-context'</span>)?.get(<span class="hljs-string">'count'</span>);<br /> <span class="hljs-keyword">return</span> count !== <span class="hljs-literal">undefined</span> ? html`<span class="xml"></span><span class="hljs-subst">${count}</span><span class="xml">`</span> : html`<span class="xml"><span class="hljs-tag"><<span class="hljs-name">code</span>></span>undefined<span class="hljs-tag"></<span class="hljs-name">code</span>></span>`</span>;<br /> }<br /> }<br /> customElements.define(<span class="hljs-string">'count-view'</span>, CountView);<br /></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
77
|
+
</k-card>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="col m-span-12 t-span-6 px">
|
|
80
|
+
<k-card label="Output">
|
|
81
|
+
<k-context data='{"count":0}'>
|
|
82
|
+
<button
|
|
83
|
+
onclick="const ctx=this.closest('k-context'); ctx.set('count', (ctx.get('count') || 0) - 1)"
|
|
84
|
+
>-</button>
|
|
85
|
+
<count-view></count-view>
|
|
86
|
+
<button
|
|
87
|
+
onclick="const ctx=this.closest('k-context'); ctx.set('count', (ctx.get('count') || 0) + 1)"
|
|
88
|
+
>+</button>
|
|
89
|
+
<button
|
|
90
|
+
onclick="this.closest('k-context').clear()"
|
|
91
|
+
>Clear</button>
|
|
92
|
+
</k-context>
|
|
93
|
+
<script type="module">
|
|
94
|
+
import '../src/components/Context.js';
|
|
95
|
+
import ShadowComponent from '{{pathToRoot}}src/components/ShadowComponent.js';
|
|
96
|
+
import { html } from '{{pathToRoot}}src/lit-all.min.js';
|
|
97
|
+
class CountView extends ShadowComponent {
|
|
98
|
+
connectedCallback() {
|
|
99
|
+
super.connectedCallback();
|
|
100
|
+
const ctx = this.closest('k-context');
|
|
101
|
+
ctx?.addEventListener('context:create', () => this.requestUpdate());
|
|
102
|
+
ctx?.addEventListener('context:set', () => this.requestUpdate());
|
|
103
|
+
ctx?.addEventListener('context:delete', () => this.requestUpdate());
|
|
104
|
+
}
|
|
105
|
+
render() {
|
|
106
|
+
const count = this.closest('k-context')?.get('count');
|
|
107
|
+
return count !== undefined ? html`${count}` : html`<code>undefined</code>`;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
customElements.define('count-view', CountView);
|
|
111
|
+
</script>
|
|
112
|
+
</k-card>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
117
|
+
|
|
118
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
119
|
+
<p><code>k-context</code> extends <code>LightComponent</code>. It renders nothing and sets <code>display: contents</code> on itself so its children remain in the normal document flow. It accepts an optional <code>data</code> attribute containing a JSON string to pre-populate the context state.</p>
|
|
120
|
+
|
|
121
|
+
<h3 id="attributes"><a href="#attributes" class="no-link">Attributes</a></h3>
|
|
122
|
+
<div class="table-wrapper mb">
|
|
123
|
+
<table>
|
|
124
|
+
<thead>
|
|
125
|
+
<tr>
|
|
126
|
+
<th>Attribute</th>
|
|
127
|
+
<th>Type</th>
|
|
128
|
+
<th>Description</th>
|
|
129
|
+
</tr>
|
|
130
|
+
</thead>
|
|
131
|
+
<tbody>
|
|
132
|
+
<tr>
|
|
133
|
+
<td><code>data</code></td>
|
|
134
|
+
<td><code>String</code> (JSON)</td>
|
|
135
|
+
<td>A JSON string representing the initial store state. Reflects back to the attribute as state changes via the component's methods. Defaults to <code>'{}'</code>.</td>
|
|
136
|
+
</tr>
|
|
137
|
+
</tbody>
|
|
138
|
+
</table>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
142
|
+
<div class="table-wrapper mb">
|
|
143
|
+
<table>
|
|
144
|
+
<thead>
|
|
145
|
+
<tr>
|
|
146
|
+
<th>Method</th>
|
|
147
|
+
<th>Description</th>
|
|
148
|
+
</tr>
|
|
149
|
+
</thead>
|
|
150
|
+
<tbody>
|
|
151
|
+
<tr>
|
|
152
|
+
<td><code>set(key, value)</code></td>
|
|
153
|
+
<td>Creates or updates a key. Fires <code>context:create</code> if the key is new, <code>context:set</code> if it already existed.</td>
|
|
154
|
+
</tr>
|
|
155
|
+
<tr>
|
|
156
|
+
<td><code>get(key)</code></td>
|
|
157
|
+
<td>Returns the stored value for <code>key</code>, or <code>undefined</code> if not set.</td>
|
|
158
|
+
</tr>
|
|
159
|
+
<tr>
|
|
160
|
+
<td><code>has(key)</code></td>
|
|
161
|
+
<td>Returns <code>true</code> if <code>key</code> exists in the store.</td>
|
|
162
|
+
</tr>
|
|
163
|
+
<tr>
|
|
164
|
+
<td><code>delete(key)</code></td>
|
|
165
|
+
<td>Removes a key and fires <code>context:delete</code>. No-op if the key does not exist.</td>
|
|
166
|
+
</tr>
|
|
167
|
+
<tr>
|
|
168
|
+
<td><code>clear()</code></td>
|
|
169
|
+
<td>Calls <code>delete()</code> on every key, firing <code>context:delete</code> for each.</td>
|
|
170
|
+
</tr>
|
|
171
|
+
<tr>
|
|
172
|
+
<td><code>getData()</code></td>
|
|
173
|
+
<td>Returns a shallow copy of the entire data store as a plain object.</td>
|
|
174
|
+
</tr>
|
|
175
|
+
</tbody>
|
|
176
|
+
</table>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<h3 id="eventsRef"><a href="#eventsRef" class="no-link">Events</a></h3>
|
|
180
|
+
<p>All events bubble and are <code>composed: true</code>, so they cross shadow DOM boundaries.</p>
|
|
181
|
+
<div class="table-wrapper mb">
|
|
182
|
+
<table>
|
|
183
|
+
<thead>
|
|
184
|
+
<tr>
|
|
185
|
+
<th>Event</th>
|
|
186
|
+
<th>Fired when</th>
|
|
187
|
+
<th><code>detail</code> shape</th>
|
|
188
|
+
</tr>
|
|
189
|
+
</thead>
|
|
190
|
+
<tbody>
|
|
191
|
+
<tr>
|
|
192
|
+
<td><code>context:create</code></td>
|
|
193
|
+
<td>A new key is set for the first time</td>
|
|
194
|
+
<td><code>{ key, value }</code></td>
|
|
195
|
+
</tr>
|
|
196
|
+
<tr>
|
|
197
|
+
<td><code>context:set</code></td>
|
|
198
|
+
<td>An existing key's value is changed</td>
|
|
199
|
+
<td><code>{ key, value, oldValue }</code></td>
|
|
200
|
+
</tr>
|
|
201
|
+
<tr>
|
|
202
|
+
<td><code>context:delete</code></td>
|
|
203
|
+
<td>A key is removed via <code>delete()</code> or <code>clear()</code></td>
|
|
204
|
+
<td><code>{ key, value }</code></td>
|
|
205
|
+
</tr>
|
|
206
|
+
</tbody>
|
|
207
|
+
</table>
|
|
208
|
+
</div>
|
|
209
|
+
</content>
|
|
210
|
+
<content location="scripts">
|
|
211
|
+
<script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
|
|
212
|
+
<script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
|
|
213
|
+
</content>
|
|
214
|
+
</page>
|