lightview 1.8.2 → 2.0.1

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 (262) hide show
  1. package/.codacy/cli.sh +149 -0
  2. package/.codacy/codacy.yaml +15 -0
  3. package/.github/instructions/codacy.instructions.md +72 -0
  4. package/.wranglerignore +21 -0
  5. package/README.md +1330 -19
  6. package/_headers +4 -0
  7. package/build.js +70 -0
  8. package/components/actions/button.js +151 -0
  9. package/components/actions/dropdown.js +120 -0
  10. package/components/actions/modal.js +146 -0
  11. package/components/actions/swap.js +118 -0
  12. package/components/daisyui.js +288 -0
  13. package/components/data-display/accordion.js +128 -0
  14. package/components/data-display/alert.js +112 -0
  15. package/components/data-display/avatar.js +170 -0
  16. package/components/data-display/badge.js +82 -0
  17. package/components/data-display/card.js +151 -0
  18. package/components/data-display/carousel.js +94 -0
  19. package/components/data-display/chart.js +220 -0
  20. package/components/data-display/chat.js +128 -0
  21. package/components/data-display/collapse.js +103 -0
  22. package/components/data-display/countdown.js +69 -0
  23. package/components/data-display/diff.js +111 -0
  24. package/components/data-display/kbd.js +65 -0
  25. package/components/data-display/loading.js +75 -0
  26. package/components/data-display/progress.js +79 -0
  27. package/components/data-display/radial-progress.js +88 -0
  28. package/components/data-display/skeleton.js +66 -0
  29. package/components/data-display/stats.js +159 -0
  30. package/components/data-display/table.js +146 -0
  31. package/components/data-display/timeline.js +146 -0
  32. package/components/data-display/toast.js +72 -0
  33. package/components/data-display/tooltip.js +74 -0
  34. package/components/data-input/checkbox.js +253 -0
  35. package/components/data-input/file-input.js +224 -0
  36. package/components/data-input/input.js +264 -0
  37. package/components/data-input/radio.js +338 -0
  38. package/components/data-input/range.js +204 -0
  39. package/components/data-input/rating.js +219 -0
  40. package/components/data-input/select.js +287 -0
  41. package/components/data-input/textarea.js +287 -0
  42. package/components/data-input/toggle.js +201 -0
  43. package/components/index.js +137 -0
  44. package/components/layout/divider.js +72 -0
  45. package/components/layout/drawer.js +142 -0
  46. package/components/layout/footer.js +100 -0
  47. package/components/layout/hero.js +109 -0
  48. package/components/layout/indicator.js +90 -0
  49. package/components/layout/join.js +78 -0
  50. package/components/layout/navbar.js +110 -0
  51. package/components/navigation/breadcrumbs.js +91 -0
  52. package/components/navigation/dock.js +103 -0
  53. package/components/navigation/menu.js +126 -0
  54. package/components/navigation/pagination.js +105 -0
  55. package/components/navigation/steps.js +89 -0
  56. package/components/navigation/tabs.css +177 -0
  57. package/components/navigation/tabs.js +123 -0
  58. package/components/theme/theme-switch.css +65 -0
  59. package/components/theme/theme-switch.js +177 -0
  60. package/docs/about.html +164 -0
  61. package/docs/api/computed.html +184 -0
  62. package/docs/api/effects.html +173 -0
  63. package/docs/api/elements.html +180 -0
  64. package/docs/api/enhance.html +225 -0
  65. package/docs/api/hypermedia.html +165 -0
  66. package/docs/api/index.html +178 -0
  67. package/docs/api/nav.html +18 -0
  68. package/docs/api/signals.html +136 -0
  69. package/docs/api/state.html +217 -0
  70. package/docs/assets/images/logo-favicon.svg +42 -0
  71. package/docs/assets/images/logo-static.svg +40 -0
  72. package/docs/assets/images/logo.svg +66 -0
  73. package/docs/assets/js/examplify.js +395 -0
  74. package/docs/assets/styles/site.css +1102 -0
  75. package/docs/assets/styles/themes.css +236 -0
  76. package/docs/components/accordion.html +439 -0
  77. package/docs/components/alert.html +528 -0
  78. package/docs/components/avatar.html +586 -0
  79. package/docs/components/badge.html +531 -0
  80. package/docs/components/breadcrumbs.html +278 -0
  81. package/docs/components/button.html +579 -0
  82. package/docs/components/card.html +561 -0
  83. package/docs/components/carousel.html +286 -0
  84. package/docs/components/chart-area.html +702 -0
  85. package/docs/components/chart-bar.html +782 -0
  86. package/docs/components/chart-column.html +735 -0
  87. package/docs/components/chart-line.html +794 -0
  88. package/docs/components/chart-pie.html +823 -0
  89. package/docs/components/chart.html +610 -15
  90. package/docs/components/chat.html +547 -0
  91. package/docs/components/checkbox.html +641 -0
  92. package/docs/components/collapse.html +536 -0
  93. package/docs/components/component-nav.html +53 -0
  94. package/docs/components/countdown.html +470 -0
  95. package/docs/components/diff.html +245 -0
  96. package/docs/components/divider.html +240 -0
  97. package/docs/components/dock.html +277 -0
  98. package/docs/components/drawer.html +515 -0
  99. package/docs/components/dropdown.html +479 -0
  100. package/docs/components/file-input.html +591 -0
  101. package/docs/components/footer.html +301 -0
  102. package/docs/components/gallery.html +504 -0
  103. package/docs/components/hero.html +264 -0
  104. package/docs/components/index.css +840 -0
  105. package/docs/components/index.html +735 -0
  106. package/docs/components/indicator.html +342 -0
  107. package/docs/components/input.html +644 -0
  108. package/docs/components/join.html +285 -0
  109. package/docs/components/kbd.html +322 -0
  110. package/docs/components/loading.html +521 -0
  111. package/docs/components/menu.html +461 -0
  112. package/docs/components/modal.html +639 -0
  113. package/docs/components/navbar.html +321 -0
  114. package/docs/components/pagination.html +279 -0
  115. package/docs/components/progress.html +514 -0
  116. package/docs/components/radial-progress.html +434 -0
  117. package/docs/components/radio.html +655 -0
  118. package/docs/components/range.html +611 -0
  119. package/docs/components/rating.html +642 -0
  120. package/docs/components/select.html +696 -0
  121. package/docs/components/sidebar-setup.js +93 -0
  122. package/docs/components/skeleton.html +447 -0
  123. package/docs/components/spinner.html +68 -0
  124. package/docs/components/stats.html +486 -0
  125. package/docs/components/steps.html +356 -0
  126. package/docs/components/swap.html +517 -0
  127. package/docs/components/switch.html +68 -0
  128. package/docs/components/table.html +668 -0
  129. package/docs/components/tabs.html +506 -0
  130. package/docs/components/text-input.html +68 -0
  131. package/docs/components/textarea.html +603 -0
  132. package/docs/components/timeline.html +485 -42
  133. package/docs/components/toast.html +474 -0
  134. package/docs/components/toggle.html +564 -0
  135. package/docs/components/tooltip.html +423 -0
  136. package/docs/examples/getting-started-example.html +40 -0
  137. package/docs/examples/index.html +93 -0
  138. package/docs/getting-started/index.html +739 -0
  139. package/docs/getting-started/reviews.html +23 -0
  140. package/docs/getting-started/reviews.odom +108 -0
  141. package/docs/getting-started/reviews.vdom +84 -0
  142. package/docs/index.html +132 -42
  143. package/docs/playground.html +416 -0
  144. package/docs/router.html +285 -0
  145. package/docs/styles/index.html +190 -0
  146. package/functions/_middleware.js +32 -0
  147. package/index.html +309 -0
  148. package/lightview-router.js +364 -0
  149. package/lightview-x.js +1577 -0
  150. package/lightview.js +659 -1200
  151. package/middleware/locale.js +25 -0
  152. package/middleware/markdown.js +44 -0
  153. package/middleware/notFound.js +37 -0
  154. package/package.json +27 -41
  155. package/watch.js +92 -0
  156. package/wrangler.toml +12 -0
  157. package/.idea/lightview.iml +0 -12
  158. package/.idea/modules.xml +0 -8
  159. package/.idea/vcs.xml +0 -6
  160. package/LICENSE +0 -21
  161. package/codepen-no-tabs-embed.css +0 -2
  162. package/docs/CNAME +0 -1
  163. package/docs/api.html +0 -674
  164. package/docs/blank.html +0 -10
  165. package/docs/comparedto.html +0 -89
  166. package/docs/components/chart-repl.html +0 -69
  167. package/docs/components/components.js +0 -113
  168. package/docs/components/contents.html +0 -17
  169. package/docs/components/gantt-repl.html +0 -61
  170. package/docs/components/gantt.html +0 -42
  171. package/docs/components/gauge-repl.html +0 -66
  172. package/docs/components/gauge.html +0 -20
  173. package/docs/components/orgchart-repl.html +0 -64
  174. package/docs/components/orgchart.html +0 -41
  175. package/docs/components/repl-as-src.html +0 -17
  176. package/docs/components/repl-repl.html +0 -95
  177. package/docs/components/repl.html +0 -527
  178. package/docs/components/timeline-repl.html +0 -72
  179. package/docs/components.html +0 -14
  180. package/docs/css/highlightjs.min.css +0 -9
  181. package/docs/css/tutorial.css +0 -35
  182. package/docs/examples/anchor.html +0 -11
  183. package/docs/examples/chart.html +0 -34
  184. package/docs/examples/counter.html +0 -26
  185. package/docs/examples/counter.test.mjs +0 -47
  186. package/docs/examples/counter2.html +0 -26
  187. package/docs/examples/directives.html +0 -79
  188. package/docs/examples/foreign.html +0 -50
  189. package/docs/examples/forgeinform.html +0 -98
  190. package/docs/examples/form.html +0 -61
  191. package/docs/examples/gauge.html +0 -18
  192. package/docs/examples/invalid-template-literals.html +0 -44
  193. package/docs/examples/medium/remote.html +0 -60
  194. package/docs/examples/message.html +0 -18
  195. package/docs/examples/nested.html +0 -11
  196. package/docs/examples/object-bound-form.html +0 -34
  197. package/docs/examples/remote-server.js +0 -51
  198. package/docs/examples/remote.html +0 -34
  199. package/docs/examples/remote.json +0 -1
  200. package/docs/examples/scratch.html +0 -69
  201. package/docs/examples/sensors/index.html +0 -44
  202. package/docs/examples/sensors/sensor-server.js +0 -30
  203. package/docs/examples/shared.html +0 -41
  204. package/docs/examples/template.html +0 -33
  205. package/docs/examples/timeline.html +0 -21
  206. package/docs/examples/todo.html +0 -40
  207. package/docs/examples/top.html +0 -10
  208. package/docs/examples/types.html +0 -94
  209. package/docs/examples/xor.html +0 -62
  210. package/docs/examples.html +0 -25
  211. package/docs/javascript/codejar.min.js +0 -8
  212. package/docs/javascript/highlightjs.min.js +0 -1173
  213. package/docs/javascript/isomorphic-git.js +0 -9
  214. package/docs/javascript/json5.min.js +0 -1
  215. package/docs/javascript/lightning-fs.js +0 -1
  216. package/docs/javascript/lightview.js +0 -1285
  217. package/docs/javascript/marked.min.js +0 -6
  218. package/docs/javascript/peerjs.min.js +0 -70
  219. package/docs/javascript/turndown.js +0 -973
  220. package/docs/javascript/types.js +0 -606
  221. package/docs/javascript/utils.js +0 -45
  222. package/docs/lightview.html +0 -63
  223. package/docs/old_index.html +0 -965
  224. package/docs/old_index.md +0 -1132
  225. package/docs/slidein.html +0 -51
  226. package/docs/tutorial/0-getting-started.html +0 -67
  227. package/docs/tutorial/1-intro-to-variables.html +0 -103
  228. package/docs/tutorial/10-template-components.html +0 -80
  229. package/docs/tutorial/11-linked-components.html +0 -76
  230. package/docs/tutorial/12-imported-components.html +0 -67
  231. package/docs/tutorial/13-input-binding.html +0 -94
  232. package/docs/tutorial/14-automatic-variable-creation.html +0 -74
  233. package/docs/tutorial/15-form-binding.html +0 -110
  234. package/docs/tutorial/16-if-directive.html +0 -60
  235. package/docs/tutorial/17-loop-directives.html +0 -83
  236. package/docs/tutorial/18-sanitizing-and-escaping-input.html +0 -79
  237. package/docs/tutorial/2-imported-and-exported-variables.html +0 -80
  238. package/docs/tutorial/3-data-types.html +0 -89
  239. package/docs/tutorial/4-extended-data-types.html +0 -83
  240. package/docs/tutorial/5-extended-functional-types.html +0 -96
  241. package/docs/tutorial/5.1-extended-functional-types.html +0 -79
  242. package/docs/tutorial/5.2-extended-functional-types.html +0 -70
  243. package/docs/tutorial/6-conventional-javascript.html +0 -75
  244. package/docs/tutorial/7-monitoring-with-observers.html +0 -107
  245. package/docs/tutorial/8-event-listeners.html +0 -65
  246. package/docs/tutorial/9-intro-to-components.html +0 -91
  247. package/docs/tutorial/contents.html +0 -32
  248. package/docs/tutorial/my-component.html +0 -29
  249. package/docs/tutorial/remote-value.json +0 -4
  250. package/docs/websiterepl.html +0 -46
  251. package/jest-puppeteer.config.js +0 -5
  252. package/jest.config.json +0 -12
  253. package/lightview.min.js +0 -1
  254. package/lightview_good.js +0 -1267
  255. package/lightview_optimized.js +0 -1274
  256. package/repl_hold.html +0 -320
  257. package/test/basic.html +0 -104
  258. package/test/basic.test.mjs +0 -315
  259. package/test/extended.html +0 -29
  260. package/test/extended.test.mjs +0 -448
  261. package/types.js +0 -607
  262. package/unsplash.key +0 -1
@@ -0,0 +1,696 @@
1
+ <!-- SEO-friendly SPA Shim -->
2
+ <script src="/lightview-router.js"></script>
3
+ <script>
4
+ if (window.LightviewRouter) {
5
+ LightviewRouter.base('/index.html');
6
+ }
7
+ </script>
8
+
9
+ <!-- Load the page-specific stylesheet -->
10
+ <link rel="stylesheet" href="./index.css">
11
+
12
+ <!-- Gallery Structure -->
13
+ <div class="gallery-page">
14
+ <div class="gallery-layout">
15
+ <!-- Sidebar Overlay -->
16
+ <div id="sidebar-overlay" class="sidebar-overlay"></div>
17
+
18
+ <!-- Sidebar -->
19
+ <div id="gallery-sidebar" class="gallery-sidebar" style="visibility: hidden" src="./component-nav.html"></div>
20
+
21
+ <!-- Main Content -->
22
+ <div id="gallery-main" class="gallery-main">
23
+ <!-- Header Container -->
24
+ <div
25
+ style="position: sticky; top: 0; z-index: 30; background: var(--gallery-surface); border-bottom: 1px solid var(--gallery-border); backdrop-filter: blur(8px);">
26
+ <!-- Breadcrumbs Row -->
27
+ <div style="padding: 0.75rem 1.5rem 0;">
28
+ <script>
29
+ (() => {
30
+ const { Breadcrumbs } = Lightview.tags;
31
+ const breadcrumbs = Breadcrumbs({
32
+ id: 'page-breadcrumbs',
33
+ items: [
34
+ { label: 'Components', href: '/docs/components' },
35
+ { label: 'Select' }
36
+ ]
37
+ });
38
+ document.currentScript.replaceWith(breadcrumbs.domEl);
39
+ })();
40
+ </script>
41
+ </div>
42
+ <!-- Title Row -->
43
+ <div class="gallery-header"
44
+ style="border-bottom: none; height: auto; padding-top: 0.5rem; padding-bottom: 0.75rem;">
45
+ <button id="toggle-btn" class="toggle-btn" aria-label="Toggle Sidebar">
46
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="toggle-icon"
47
+ style="stroke: currentColor; stroke-width: 2;">
48
+ <path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
49
+ <path stroke-linecap="round" stroke-linejoin="round" d="M11 19l-7-7 7-7" />
50
+ </svg>
51
+ </button>
52
+ <h1 class="gallery-title">Select</h1>
53
+ </div>
54
+ </div>
55
+
56
+ <!-- Content -->
57
+ <div class="gallery-content">
58
+ <div class="section-content" style="max-width: 1000px;">
59
+ <p class="text-lg" style="opacity: 0.7; margin-bottom: 1.5rem;">
60
+ Select allows the user to pick a value from a list of options.
61
+ Supports labels, validation, helper text, and reactive state binding.
62
+ </p>
63
+
64
+ <!-- Basic Example with Examplify -->
65
+ <div class="card bg-base-200" style="margin-bottom: 2rem;">
66
+ <div class="card-body">
67
+ <h2 class="card-title">Basic Examples</h2>
68
+ <p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Simple selects with various
69
+ configurations
70
+ </p>
71
+
72
+ <!-- Tabs -->
73
+ <script>
74
+ window.switchSyntaxTab = (tabId) => {
75
+ const tabs = ['tagged', 'vdom', 'object', 'html'];
76
+ tabs.forEach(t => {
77
+ const tabEl = document.getElementById(`tab-btn-${t}`);
78
+ const contentEl = document.getElementById(`syntax-${t}`);
79
+ if (t === tabId) {
80
+ tabEl.classList.add('syntax-tab-active');
81
+ contentEl.style.display = 'block';
82
+ } else {
83
+ tabEl.classList.remove('syntax-tab-active');
84
+ contentEl.style.display = 'none';
85
+ }
86
+ });
87
+ };
88
+ </script>
89
+ <div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
90
+ <button id="tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
91
+ onclick="switchSyntaxTab('tagged')">Tagged</button>
92
+ <button id="tab-btn-vdom" role="tab" class="syntax-tab"
93
+ onclick="switchSyntaxTab('vdom')">vDOM</button>
94
+ <button id="tab-btn-object" role="tab" class="syntax-tab"
95
+ onclick="switchSyntaxTab('object')">Object
96
+ DOM</button>
97
+ <button id="tab-btn-html" role="tab" class="syntax-tab"
98
+ onclick="switchSyntaxTab('html')">HTML</button>
99
+ </div>
100
+
101
+ <!-- Tagged Syntax -->
102
+ <div id="syntax-tagged">
103
+ <pre><script>
104
+ examplify(document.currentScript.nextElementSibling, {
105
+ at: document.currentScript.parentElement,
106
+ scripts: ['/lightview.js', '/lightview-x.js'],
107
+ styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
108
+ type: 'module',
109
+ minHeight: 320,
110
+ autoRun: true
111
+ });
112
+ </script><code contenteditable="true">await import('/components/data-input/select.js');
113
+ const { tags, $ } = Lightview;
114
+ const { div, Select } = tags;
115
+
116
+ // 1. Basic select with string options
117
+ const basic = Select({
118
+ placeholder: 'Pick a movie franchise',
119
+ options: ['Star Wars', 'Harry Potter', 'Lord of the Rings', 'Marvel']
120
+ });
121
+
122
+ // 2. Select with label and helper
123
+ const withLabel = Select({
124
+ label: 'Country',
125
+ placeholder: 'Select your country',
126
+ options: [
127
+ { value: 'us', label: 'United States' },
128
+ { value: 'uk', label: 'United Kingdom' },
129
+ { value: 'ca', label: 'Canada' },
130
+ { value: 'au', label: 'Australia' }
131
+ ],
132
+ helper: 'We use this for shipping calculations'
133
+ });
134
+
135
+ // 3. Required select with color
136
+ const required = Select({
137
+ label: 'Priority',
138
+ placeholder: 'Select priority...',
139
+ options: ['Low', 'Medium', 'High', 'Critical'],
140
+ color: 'primary',
141
+ required: true
142
+ });
143
+
144
+ // Insert all examples
145
+ $('#example').content(
146
+ div({ style: 'display: flex; flex-direction: column; gap: 1rem; max-width: 28rem;' }, basic, withLabel, required)
147
+ );</code></pre>
148
+ </div>
149
+
150
+ <!-- vDOM Syntax -->
151
+ <div id="syntax-vdom" style="display: none;">
152
+ <pre><script>
153
+ examplify(document.currentScript.nextElementSibling, {
154
+ at: document.currentScript.parentElement,
155
+ scripts: ['/lightview.js', '/lightview-x.js'],
156
+ styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
157
+ type: 'module',
158
+ minHeight: 320
159
+ });
160
+ </script><code contenteditable="true">await import('/components/data-input/select.js');
161
+ const { $, tags } = Lightview;
162
+ const { Select, div } = tags;
163
+
164
+ const basic = {
165
+ tag: Select,
166
+ attributes: {
167
+ placeholder: 'Pick a movie franchise',
168
+ options: ['Star Wars', 'Harry Potter', 'Lord of the Rings', 'Marvel']
169
+ }
170
+ };
171
+
172
+ const withLabel = {
173
+ tag: Select,
174
+ attributes: {
175
+ label: 'Country',
176
+ placeholder: 'Select your country',
177
+ options: [
178
+ { value: 'us', label: 'United States' },
179
+ { value: 'uk', label: 'United Kingdom' },
180
+ { value: 'ca', label: 'Canada' },
181
+ { value: 'au', label: 'Australia' }
182
+ ],
183
+ helper: 'We use this for shipping calculations'
184
+ }
185
+ };
186
+
187
+ const required = {
188
+ tag: Select,
189
+ attributes: {
190
+ label: 'Priority',
191
+ placeholder: 'Select priority...',
192
+ options: ['Low', 'Medium', 'High', 'Critical'],
193
+ color: 'primary',
194
+ required: true
195
+ }
196
+ };
197
+
198
+ $('#example').content({
199
+ tag: div,
200
+ attributes: { style: 'display: flex; flex-direction: column; gap: 1rem; max-width: 28rem;' },
201
+ children: [basic, withLabel, required]
202
+ });</code></pre>
203
+ </div>
204
+
205
+ <!-- Object DOM Syntax -->
206
+ <div id="syntax-object" style="display: none;">
207
+ <pre><script>
208
+ examplify(document.currentScript.nextElementSibling, {
209
+ at: document.currentScript.parentElement,
210
+ scripts: ['/lightview.js', '/lightview-x.js'],
211
+ styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
212
+ type: 'module',
213
+ minHeight: 320
214
+ });
215
+ </script><code contenteditable="true">await import('/components/data-input/select.js');
216
+ const { $ } = Lightview;
217
+
218
+ const demo = {
219
+ div: {
220
+ style: 'display: flex; flex-direction: column; gap: 1rem; max-width: 28rem;',
221
+ children: [
222
+ {
223
+ Select: {
224
+ placeholder: 'Pick a movie franchise',
225
+ options: ['Star Wars', 'Harry Potter', 'Lord of the Rings', 'Marvel']
226
+ }
227
+ },
228
+ {
229
+ Select: {
230
+ label: 'Country',
231
+ placeholder: 'Select your country',
232
+ options: [
233
+ { value: 'us', label: 'United States' },
234
+ { value: 'uk', label: 'United Kingdom' },
235
+ { value: 'ca', label: 'Canada' },
236
+ { value: 'au', label: 'Australia' }
237
+ ],
238
+ helper: 'We use this for shipping calculations'
239
+ }
240
+ },
241
+ {
242
+ Select: {
243
+ label: 'Priority',
244
+ placeholder: 'Select priority...',
245
+ options: ['Low', 'Medium', 'High', 'Critical'],
246
+ color: 'primary',
247
+ required: true
248
+ }
249
+ }
250
+ ]
251
+ }
252
+ };
253
+
254
+ $('#example').content(demo);</code></pre>
255
+ </div>
256
+
257
+ <!-- HTML Syntax -->
258
+ <div id="syntax-html" style="display: none;">
259
+ <pre><script>
260
+ examplify(document.currentScript.nextElementSibling, {
261
+ at: document.currentScript.parentElement,
262
+ scripts: ['/lightview.js', '/lightview-x.js'],
263
+ styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
264
+ type: 'module',
265
+ language: 'html',
266
+ minHeight: 320
267
+ });
268
+ </script><code contenteditable="true" class="language-html">&lt;!-- Import the component (registers lv-select) --&gt;
269
+ &lt;script type="module" src="/components/data-input/select.js"&gt;&lt;/script&gt;
270
+
271
+ &lt;div style="display: flex; flex-direction: column; gap: 1rem; max-width: 28rem;"&gt;
272
+ &lt;lv-select
273
+ placeholder="Pick a movie franchise"
274
+ options='["Star Wars", "Harry Potter", "Lord of the Rings", "Marvel"]'&gt;
275
+ &lt;/lv-select&gt;
276
+
277
+ &lt;lv-select
278
+ label="Country"
279
+ placeholder="Select your country"
280
+ options='[{"value":"us","label":"United States"},{"value":"uk","label":"United Kingdom"}]'
281
+ helper="We'll never share your data."&gt;
282
+ &lt;/lv-select&gt;
283
+
284
+ &lt;lv-select
285
+ label="Priority"
286
+ placeholder="Select priority..."
287
+ options='["Low", "Medium", "High", "Critical"]'
288
+ color="primary"
289
+ required&gt;
290
+ &lt;/lv-select&gt;
291
+ &lt;/div&gt;</code></pre>
292
+ </div>
293
+ </div>
294
+ </div>
295
+
296
+ <!-- Reactive Example with Examplify -->
297
+ <div class="card bg-base-200" style="margin-bottom: 2rem;">
298
+ <div class="card-body">
299
+ <h2 class="card-title">Reactive Example</h2>
300
+ <p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Two-way binding with signals
301
+ and live
302
+ validation</p>
303
+
304
+ <!-- Tabs -->
305
+ <script>
306
+ window.switchReactiveSyntaxTab = (tabId) => {
307
+ const tabs = ['tagged', 'vdom', 'object'];
308
+ tabs.forEach(t => {
309
+ const tabEl = document.getElementById(`reactive-tab-btn-${t}`);
310
+ const contentEl = document.getElementById(`reactive-syntax-${t}`);
311
+ if (t === tabId) {
312
+ tabEl.classList.add('syntax-tab-active');
313
+ contentEl.style.display = 'block';
314
+ } else {
315
+ tabEl.classList.remove('syntax-tab-active');
316
+ contentEl.style.display = 'none';
317
+ }
318
+ });
319
+ };
320
+ </script>
321
+ <div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
322
+ <button id="reactive-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
323
+ onclick="switchReactiveSyntaxTab('tagged')">Tagged</button>
324
+ <button id="reactive-tab-btn-vdom" role="tab" class="syntax-tab"
325
+ onclick="switchReactiveSyntaxTab('vdom')">vDOM</button>
326
+ <button id="reactive-tab-btn-object" role="tab" class="syntax-tab"
327
+ onclick="switchReactiveSyntaxTab('object')">Object DOM</button>
328
+ </div>
329
+
330
+ <!-- Tagged Syntax -->
331
+ <div id="reactive-syntax-tagged">
332
+ <pre><script>
333
+ examplify(document.currentScript.nextElementSibling, {
334
+ at: document.currentScript.parentElement,
335
+ scripts: ['/lightview.js', '/lightview-x.js'],
336
+ styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
337
+ type: 'module',
338
+ minHeight: 180
339
+ });
340
+ </script><code contenteditable="true">await import('/components/data-input/select.js');
341
+ const { signal, tags, $ } = Lightview;
342
+ const { div, p, span, Select } = tags;
343
+
344
+ // Signal for two-way binding
345
+ const selectedRole = signal('');
346
+
347
+ // Validation function
348
+ const validateRole = (val) => {
349
+ if (!val) return 'Please select a role';
350
+ return null;
351
+ };
352
+
353
+ // Role descriptions
354
+ const roleDescriptions = {
355
+ admin: 'Full access to all features',
356
+ editor: 'Can edit and publish content',
357
+ viewer: 'Read-only access',
358
+ guest: 'Limited access to public content'
359
+ };
360
+
361
+ // Reactive select with validation
362
+ const reactiveDemo = div({ style: 'display: flex; flex-direction: column; gap: 1rem; max-width: 28rem;' },
363
+ Select({
364
+ label: 'User Role',
365
+ placeholder: 'Assign a role...',
366
+ value: selectedRole,
367
+ options: [
368
+ { value: 'admin', label: 'Administrator' },
369
+ { value: 'editor', label: 'Editor' },
370
+ { value: 'viewer', label: 'Viewer' },
371
+ { value: 'guest', label: 'Guest' }
372
+ ],
373
+ validate: validateRole,
374
+ required: true
375
+ }),
376
+ p({ style: 'font-size: 0.875rem;' },
377
+ () => {
378
+ const role = selectedRole.value;
379
+ if (!role) return span({ style: 'opacity: 0.7;' }, 'Select a role to see its description');
380
+ return span({ style: 'color: oklch(var(--p));' }, roleDescriptions[role]);
381
+ }
382
+ )
383
+ );
384
+
385
+ $('#example').content(reactiveDemo);</code></pre>
386
+ </div>
387
+
388
+ <!-- vDOM Syntax -->
389
+ <div id="reactive-syntax-vdom" style="display: none;">
390
+ <pre><script>
391
+ examplify(document.currentScript.nextElementSibling, {
392
+ at: document.currentScript.parentElement,
393
+ scripts: ['/lightview.js', '/lightview-x.js'],
394
+ styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
395
+ type: 'module',
396
+ minHeight: 180
397
+ });
398
+ </script><code contenteditable="true">await import('/components/data-input/select.js');
399
+ const { signal, $, tags } = Lightview;
400
+ const { Select, div, p, span } = tags;
401
+
402
+ const selectedRole = signal('');
403
+
404
+ const validateRole = (val) => {
405
+ if (!val) return 'Please select a role';
406
+ return null;
407
+ };
408
+
409
+ const roleDescriptions = {
410
+ admin: 'Full access to all features',
411
+ editor: 'Can edit and publish content',
412
+ viewer: 'Read-only access',
413
+ guest: 'Limited access to public content'
414
+ };
415
+
416
+ const reactiveDemo = {
417
+ tag: div,
418
+ attributes: { style: 'display: flex; flex-direction: column; gap: 1rem; max-width: 28rem;' },
419
+ children: [
420
+ {
421
+ tag: Select,
422
+ attributes: {
423
+ label: 'User Role',
424
+ placeholder: 'Assign a role...',
425
+ value: selectedRole,
426
+ options: [
427
+ { value: 'admin', label: 'Administrator' },
428
+ { value: 'editor', label: 'Editor' },
429
+ { value: 'viewer', label: 'Viewer' },
430
+ { value: 'guest', label: 'Guest' }
431
+ ],
432
+ validate: validateRole,
433
+ required: true
434
+ }
435
+ },
436
+ {
437
+ tag: p,
438
+ attributes: { style: 'font-size: 0.875rem;' },
439
+ children: [
440
+ () => {
441
+ const role = selectedRole.value;
442
+ if (!role) return { tag: span, attributes: { style: 'opacity: 0.7;' }, children: ['Select a role to see its description'] };
443
+ return { tag: span, attributes: { style: 'color: oklch(var(--p));' }, children: [roleDescriptions[role]] };
444
+ }
445
+ ]
446
+ }
447
+ ]
448
+ };
449
+
450
+ $('#example').content(reactiveDemo);</code></pre>
451
+ </div>
452
+
453
+ <!-- Object DOM Syntax -->
454
+ <div id="reactive-syntax-object" style="display: none;">
455
+ <pre><script>
456
+ examplify(document.currentScript.nextElementSibling, {
457
+ at: document.currentScript.parentElement,
458
+ scripts: ['/lightview.js', '/lightview-x.js'],
459
+ styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
460
+ type: 'module',
461
+ minHeight: 180
462
+ });
463
+ </script><code contenteditable="true">await import('/components/data-input/select.js');
464
+ const { signal, $ } = Lightview;
465
+
466
+ const selectedRole = signal('');
467
+
468
+ const validateRole = (val) => {
469
+ if (!val) return 'Please select a role';
470
+ return null;
471
+ };
472
+
473
+ const roleDescriptions = {
474
+ admin: 'Full access to all features',
475
+ editor: 'Can edit and publish content',
476
+ viewer: 'Read-only access',
477
+ guest: 'Limited access to public content'
478
+ };
479
+
480
+ const reactiveDemo = {
481
+ div: {
482
+ style: 'display: flex; flex-direction: column; gap: 1rem; max-width: 28rem;',
483
+ children: [
484
+ {
485
+ Select: {
486
+ label: 'User Role',
487
+ placeholder: 'Assign a role...',
488
+ value: selectedRole,
489
+ options: [
490
+ { value: 'admin', label: 'Administrator' },
491
+ { value: 'editor', label: 'Editor' },
492
+ { value: 'viewer', label: 'Viewer' },
493
+ { value: 'guest', label: 'Guest' }
494
+ ],
495
+ validate: validateRole,
496
+ required: true
497
+ }
498
+ },
499
+ {
500
+ p: {
501
+ style: 'font-size: 0.875rem;',
502
+ children: [
503
+ () => {
504
+ const role = selectedRole.value;
505
+ if (!role) return { span: { style: 'opacity: 0.7;', children: ['Select a role to see its description'] } };
506
+ return { span: { style: 'color: oklch(var(--p));', children: [roleDescriptions[role]] } };
507
+ }
508
+ ]
509
+ }
510
+ }
511
+ ]
512
+ }
513
+ };
514
+
515
+ $('#example').content(reactiveDemo);</code></pre>
516
+ </div>
517
+ </div>
518
+ </div>
519
+
520
+ <!-- Props Table -->
521
+ <h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Props</h2>
522
+ <div style="overflow-x: auto; margin-bottom: 2rem;">
523
+ <table class="table table-zebra">
524
+ <thead>
525
+ <tr>
526
+ <th>Prop</th>
527
+ <th>Type</th>
528
+ <th>Default</th>
529
+ <th>Description</th>
530
+ </tr>
531
+ </thead>
532
+ <tbody>
533
+ <tr>
534
+ <td><code>options</code></td>
535
+ <td>array</td>
536
+ <td>[]</td>
537
+ <td>Array of strings or objects <code>{value, label, disabled}</code></td>
538
+ </tr>
539
+ <tr>
540
+ <td><code>value</code></td>
541
+ <td>* | signal</td>
542
+ <td>-</td>
543
+ <td>Selected value (reactive with signals)</td>
544
+ </tr>
545
+ <tr>
546
+ <td><code>defaultValue</code></td>
547
+ <td>*</td>
548
+ <td>''</td>
549
+ <td>Default value for uncontrolled mode</td>
550
+ </tr>
551
+ <tr>
552
+ <td><code>placeholder</code></td>
553
+ <td>string</td>
554
+ <td>-</td>
555
+ <td>Placeholder option (disabled first option)</td>
556
+ </tr>
557
+ <tr>
558
+ <td><code>label</code></td>
559
+ <td>string</td>
560
+ <td>-</td>
561
+ <td>Label text displayed above select</td>
562
+ </tr>
563
+ <tr>
564
+ <td><code>helper</code></td>
565
+ <td>string</td>
566
+ <td>-</td>
567
+ <td>Helper text displayed below the select</td>
568
+ </tr>
569
+ <tr>
570
+ <td><code>error</code></td>
571
+ <td>string | function</td>
572
+ <td>-</td>
573
+ <td>Error message or reactive error function</td>
574
+ </tr>
575
+ <tr>
576
+ <td><code>validate</code></td>
577
+ <td>function</td>
578
+ <td>-</td>
579
+ <td>Validation function: <code>(value) => errorMessage | null</code></td>
580
+ </tr>
581
+ <tr>
582
+ <td><code>color</code></td>
583
+ <td>string</td>
584
+ <td>-</td>
585
+ <td>'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
586
+ </td>
587
+ </tr>
588
+ <tr>
589
+ <td><code>size</code></td>
590
+ <td>string</td>
591
+ <td>'md'</td>
592
+ <td>'xs' | 'sm' | 'md' | 'lg'</td>
593
+ </tr>
594
+ <tr>
595
+ <td><code>ghost</code></td>
596
+ <td>boolean</td>
597
+ <td>false</td>
598
+ <td>Ghost style (no background)</td>
599
+ </tr>
600
+ <tr>
601
+ <td><code>disabled</code></td>
602
+ <td>boolean</td>
603
+ <td>false</td>
604
+ <td>Disable the select</td>
605
+ </tr>
606
+ <tr>
607
+ <td><code>required</code></td>
608
+ <td>boolean</td>
609
+ <td>false</td>
610
+ <td>Mark as required field (shows asterisk)</td>
611
+ </tr>
612
+ <tr>
613
+ <td><code>onChange</code></td>
614
+ <td>function</td>
615
+ <td>-</td>
616
+ <td>Callback when value changes: <code>(value, event) => void</code></td>
617
+ </tr>
618
+ <tr>
619
+ <td><code>useShadow</code></td>
620
+ <td>boolean</td>
621
+ <td>*</td>
622
+ <td>Render in Shadow DOM. *Follows global <code>initComponents()</code> setting</td>
623
+ </tr>
624
+ </tbody>
625
+ </table>
626
+ </div>
627
+
628
+ <!-- Sizes Example -->
629
+ <h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Sizes</h2>
630
+ <div
631
+ style="display: flex; flex-direction: column; gap: 0.5rem; max-width: 20rem; margin-bottom: 2rem;">
632
+ <select class="select select-xs">
633
+ <option>Extra Small</option>
634
+ </select>
635
+ <select class="select select-sm">
636
+ <option>Small</option>
637
+ </select>
638
+ <select class="select">
639
+ <option>Medium</option>
640
+ </select>
641
+ <select class="select select-lg">
642
+ <option>Large</option>
643
+ </select>
644
+ </div>
645
+
646
+ <!-- Colors Example -->
647
+ <h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Colors</h2>
648
+ <div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 2rem;">
649
+ <select class="select select-primary">
650
+ <option>Primary</option>
651
+ </select>
652
+ <select class="select select-secondary">
653
+ <option>Secondary</option>
654
+ </select>
655
+ <select class="select select-accent">
656
+ <option>Accent</option>
657
+ </select>
658
+ <select class="select select-info">
659
+ <option>Info</option>
660
+ </select>
661
+ <select class="select select-success">
662
+ <option>Success</option>
663
+ </select>
664
+ <select class="select select-warning">
665
+ <option>Warning</option>
666
+ </select>
667
+ <select class="select select-error">
668
+ <option>Error</option>
669
+ </select>
670
+ <select class="select select-ghost">
671
+ <option>Ghost</option>
672
+ </select>
673
+ </div>
674
+
675
+ <!-- With Fieldset -->
676
+ <h2 class="text-xl font-bold" style="margin-bottom: 1rem;">With Label (Fieldset Pattern)</h2>
677
+ <div style="max-width: 28rem; margin-bottom: 2rem;">
678
+ <fieldset
679
+ style="display: flex; flex-direction: column; gap: 0.5rem; border: none; padding: 0.5rem 0;">
680
+ <legend
681
+ style="font-size: 0.875rem; font-weight: 700; color: oklch(var(--bc)/0.8); padding: 0 0.5rem;">
682
+ Country</legend>
683
+ <select class="select" style="width: 100%;">
684
+ <option disabled selected>Select your country</option>
685
+ <option>United States</option>
686
+ <option>United Kingdom</option>
687
+ <option>Canada</option>
688
+ </select>
689
+ <p style="font-size: 0.875rem; color: oklch(var(--bc)/0.6); padding: 0 0.5rem;">Used for
690
+ shipping calculations.</p>
691
+ </fieldset>
692
+ </div>
693
+ </div>
694
+ </div>
695
+ </div>
696
+ </div>