lightview 1.8.1-b → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/workflows/daisyui-component-migration.md +155 -0
- package/.codacy/cli.sh +149 -0
- package/.codacy/codacy.yaml +15 -0
- package/.github/instructions/codacy.instructions.md +72 -0
- package/.wranglerignore +21 -0
- package/README.md +1331 -21
- package/_headers +4 -0
- package/build.js +70 -0
- package/components/actions/button.js +151 -0
- package/components/actions/dropdown.js +120 -0
- package/components/actions/modal.js +146 -0
- package/components/actions/swap.js +118 -0
- package/components/daisyui.js +288 -0
- package/components/data-display/accordion.js +128 -0
- package/components/data-display/alert.js +112 -0
- package/components/data-display/avatar.js +170 -0
- package/components/data-display/badge.js +82 -0
- package/components/data-display/card.js +151 -0
- package/components/data-display/carousel.js +94 -0
- package/components/data-display/chart.js +220 -0
- package/components/data-display/chat.js +128 -0
- package/components/data-display/collapse.js +103 -0
- package/components/data-display/countdown.js +69 -0
- package/components/data-display/diff.js +111 -0
- package/components/data-display/kbd.js +65 -0
- package/components/data-display/loading.js +75 -0
- package/components/data-display/progress.js +79 -0
- package/components/data-display/radial-progress.js +88 -0
- package/components/data-display/skeleton.js +66 -0
- package/components/data-display/stats.js +159 -0
- package/components/data-display/table.js +146 -0
- package/components/data-display/timeline.js +146 -0
- package/components/data-display/toast.js +72 -0
- package/components/data-display/tooltip.js +74 -0
- package/components/data-input/checkbox.js +253 -0
- package/components/data-input/file-input.js +224 -0
- package/components/data-input/input.js +264 -0
- package/components/data-input/radio.js +338 -0
- package/components/data-input/range.js +204 -0
- package/components/data-input/rating.js +219 -0
- package/components/data-input/select.js +287 -0
- package/components/data-input/textarea.js +287 -0
- package/components/data-input/toggle.js +201 -0
- package/components/index.js +137 -0
- package/components/layout/divider.js +72 -0
- package/components/layout/drawer.js +142 -0
- package/components/layout/footer.js +100 -0
- package/components/layout/hero.js +109 -0
- package/components/layout/indicator.js +90 -0
- package/components/layout/join.js +78 -0
- package/components/layout/navbar.js +110 -0
- package/components/navigation/breadcrumbs.js +91 -0
- package/components/navigation/dock.js +103 -0
- package/components/navigation/menu.js +126 -0
- package/components/navigation/pagination.js +105 -0
- package/components/navigation/steps.js +89 -0
- package/components/navigation/tabs.css +177 -0
- package/components/navigation/tabs.js +123 -0
- package/components/theme/theme-switch.css +65 -0
- package/components/theme/theme-switch.js +177 -0
- package/docs/about.html +164 -0
- package/docs/api/computed.html +184 -0
- package/docs/api/effects.html +173 -0
- package/docs/api/elements.html +180 -0
- package/docs/api/enhance.html +225 -0
- package/docs/api/hypermedia.html +165 -0
- package/docs/api/index.html +178 -0
- package/docs/api/nav.html +18 -0
- package/docs/api/signals.html +136 -0
- package/docs/api/state.html +217 -0
- package/docs/assets/images/logo-favicon.svg +42 -0
- package/docs/assets/images/logo-static.svg +40 -0
- package/docs/assets/images/logo.svg +66 -0
- package/docs/assets/js/examplify.js +395 -0
- package/docs/assets/styles/site.css +1102 -0
- package/docs/assets/styles/themes.css +236 -0
- package/docs/components/accordion.html +439 -0
- package/docs/components/alert.html +528 -0
- package/docs/components/avatar.html +586 -0
- package/docs/components/badge.html +531 -0
- package/docs/components/breadcrumbs.html +278 -0
- package/docs/components/button.html +579 -0
- package/docs/components/card.html +561 -0
- package/docs/components/carousel.html +286 -0
- package/docs/components/chart-area.html +702 -0
- package/docs/components/chart-bar.html +782 -0
- package/docs/components/chart-column.html +735 -0
- package/docs/components/chart-line.html +794 -0
- package/docs/components/chart-pie.html +823 -0
- package/docs/components/chart.html +612 -0
- package/docs/components/chat.html +547 -0
- package/docs/components/checkbox.html +641 -0
- package/docs/components/collapse.html +536 -0
- package/docs/components/component-nav.html +53 -0
- package/docs/components/countdown.html +470 -0
- package/docs/components/diff.html +245 -0
- package/docs/components/divider.html +240 -0
- package/docs/components/dock.html +277 -0
- package/docs/components/drawer.html +515 -0
- package/docs/components/dropdown.html +479 -0
- package/docs/components/file-input.html +591 -0
- package/docs/components/footer.html +301 -0
- package/docs/components/gallery.html +504 -0
- package/docs/components/hero.html +264 -0
- package/docs/components/index.css +840 -0
- package/docs/components/index.html +735 -0
- package/docs/components/indicator.html +342 -0
- package/docs/components/input.html +644 -0
- package/docs/components/join.html +285 -0
- package/docs/components/kbd.html +322 -0
- package/docs/components/loading.html +521 -0
- package/docs/components/menu.html +461 -0
- package/docs/components/modal.html +639 -0
- package/docs/components/navbar.html +321 -0
- package/docs/components/pagination.html +279 -0
- package/docs/components/progress.html +514 -0
- package/docs/components/radial-progress.html +434 -0
- package/docs/components/radio.html +655 -0
- package/docs/components/range.html +611 -0
- package/docs/components/rating.html +642 -0
- package/docs/components/select.html +696 -0
- package/docs/components/sidebar-setup.js +93 -0
- package/docs/components/skeleton.html +447 -0
- package/docs/components/spinner.html +68 -0
- package/docs/components/stats.html +486 -0
- package/docs/components/steps.html +356 -0
- package/docs/components/swap.html +517 -0
- package/docs/components/switch.html +68 -0
- package/docs/components/table.html +668 -0
- package/docs/components/tabs.html +506 -0
- package/docs/components/text-input.html +68 -0
- package/docs/components/textarea.html +603 -0
- package/docs/components/timeline.html +487 -0
- package/docs/components/toast.html +474 -0
- package/docs/components/toggle.html +564 -0
- package/docs/components/tooltip.html +423 -0
- package/docs/examples/getting-started-example.html +40 -0
- package/docs/examples/index.html +93 -0
- package/docs/getting-started/index.html +739 -0
- package/docs/getting-started/reviews.html +23 -0
- package/docs/getting-started/reviews.odom +108 -0
- package/docs/getting-started/reviews.vdom +84 -0
- package/docs/index.html +134 -0
- package/docs/playground.html +416 -0
- package/docs/router.html +285 -0
- package/docs/styles/index.html +190 -0
- package/functions/_middleware.js +32 -0
- package/index.html +309 -0
- package/lightview-router.js +364 -0
- package/lightview-x.js +1577 -0
- package/lightview.js +658 -1109
- package/lightview.js.backup +793 -0
- package/middleware/locale.js +25 -0
- package/middleware/markdown.js +44 -0
- package/middleware/notFound.js +37 -0
- package/package.json +27 -41
- package/watch.js +92 -0
- package/wrangler.toml +12 -0
- package/.idea/lightview.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/LICENSE +0 -21
- package/codepen-no-tabs-embed.css +0 -2
- package/components/chart/chart.html +0 -17
- package/components/chart/example.html +0 -32
- package/components/chart.html +0 -83
- package/components/components.js +0 -113
- package/components/gantt/example.html +0 -22
- package/components/gantt/gantt.html +0 -42
- package/components/gauge/example.html +0 -28
- package/components/gauge/gauge.html +0 -20
- package/components/gauge.html +0 -60
- package/components/orgchart/example.html +0 -25
- package/components/orgchart/orgchart.html +0 -41
- package/components/repl/code-editor.html +0 -64
- package/components/repl/editor.html +0 -37
- package/components/repl/editorjs-inline-tool/index.js +0 -3
- package/components/repl/editorjs-inline-tool/inline-tools.js +0 -28
- package/components/repl/editorjs-inline-tool/tool.js +0 -175
- package/components/repl/repl-with-wysiwyg.html +0 -355
- package/components/repl/repl.html +0 -345
- package/components/repl/sup.js +0 -44
- package/components/repl/wysiwyg-repl.html +0 -258
- package/components/timeline/example.html +0 -33
- package/components/timeline/timeline.html +0 -44
- package/components/timeline.html +0 -81
- package/examples/anchor.html +0 -11
- package/examples/chart.html +0 -34
- package/examples/counter.html +0 -26
- package/examples/counter.test.mjs +0 -47
- package/examples/counter2.html +0 -26
- package/examples/directives.html +0 -79
- package/examples/foreign.html +0 -50
- package/examples/forgeinform.html +0 -98
- package/examples/form.html +0 -61
- package/examples/gauge.html +0 -18
- package/examples/invalid-template-literals.html +0 -44
- package/examples/medium/remote.html +0 -60
- package/examples/message.html +0 -18
- package/examples/nested.html +0 -11
- package/examples/object-bound-form.html +0 -34
- package/examples/remote-server.js +0 -51
- package/examples/remote.html +0 -34
- package/examples/remote.json +0 -1
- package/examples/scratch.html +0 -69
- package/examples/sensors/index.html +0 -30
- package/examples/sensors/sensor-server.js +0 -30
- package/examples/shared.html +0 -41
- package/examples/template.html +0 -33
- package/examples/timeline.html +0 -21
- package/examples/todo.html +0 -38
- package/examples/top.html +0 -10
- package/examples/types.html +0 -94
- package/examples/xor.html +0 -62
- package/jest-puppeteer.config.js +0 -5
- package/jest.config.json +0 -12
- package/sites/client.html +0 -48
- package/sites/index.html +0 -247
- package/test/basic.html +0 -93
- package/test/basic.test.mjs +0 -315
- package/test/extended.html +0 -29
- package/test/extended.test.mjs +0 -448
- package/types.js +0 -534
- package/unsplash.key +0 -1
|
@@ -0,0 +1,536 @@
|
|
|
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: 'Collapse' }
|
|
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">Collapse</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
|
+
Collapse is used for showing and hiding content.
|
|
61
|
+
Unlike Accordion, multiple collapses can be open simultaneously.
|
|
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 Example</h2>
|
|
68
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Independent collapse sections
|
|
69
|
+
</p>
|
|
70
|
+
|
|
71
|
+
<!-- Tabs -->
|
|
72
|
+
<script>
|
|
73
|
+
window.switchSyntaxTab = (tabId) => {
|
|
74
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
75
|
+
tabs.forEach(t => {
|
|
76
|
+
const tabEl = document.getElementById(`tab-btn-${t}`);
|
|
77
|
+
const contentEl = document.getElementById(`syntax-${t}`);
|
|
78
|
+
if (t === tabId) {
|
|
79
|
+
tabEl.classList.add('syntax-tab-active');
|
|
80
|
+
contentEl.style.display = 'block';
|
|
81
|
+
} else {
|
|
82
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
83
|
+
contentEl.style.display = 'none';
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
</script>
|
|
88
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
89
|
+
<button id="tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
90
|
+
onclick="switchSyntaxTab('tagged')">Tagged</button>
|
|
91
|
+
<button id="tab-btn-vdom" role="tab" class="syntax-tab"
|
|
92
|
+
onclick="switchSyntaxTab('vdom')">vDOM</button>
|
|
93
|
+
<button id="tab-btn-object" role="tab" class="syntax-tab"
|
|
94
|
+
onclick="switchSyntaxTab('object')">Object
|
|
95
|
+
DOM</button>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<!-- Tagged Syntax -->
|
|
99
|
+
<div id="syntax-tagged">
|
|
100
|
+
<pre><script>
|
|
101
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
102
|
+
at: document.currentScript.parentElement,
|
|
103
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
104
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
105
|
+
type: 'module',
|
|
106
|
+
minHeight: 180,
|
|
107
|
+
autoRun: true
|
|
108
|
+
});
|
|
109
|
+
</script><code contenteditable="true">await import('/components/data-display/collapse.js');
|
|
110
|
+
const { tags, $ } = Lightview;
|
|
111
|
+
const { div, p, Collapse } = tags;
|
|
112
|
+
|
|
113
|
+
const demo = div({ style: 'display: flex; flex-direction: column; gap: 0.5rem' },
|
|
114
|
+
Collapse({ icon: 'arrow' },
|
|
115
|
+
Collapse.Title({}, '📖 Description'),
|
|
116
|
+
Collapse.Content({},
|
|
117
|
+
p({}, 'This is a detailed product description that can be expanded.')
|
|
118
|
+
)
|
|
119
|
+
),
|
|
120
|
+
Collapse({ icon: 'arrow' },
|
|
121
|
+
Collapse.Title({}, '📦 Shipping Info'),
|
|
122
|
+
Collapse.Content({},
|
|
123
|
+
p({}, 'Free shipping on orders over $50. Delivery in 3-5 days.')
|
|
124
|
+
)
|
|
125
|
+
),
|
|
126
|
+
Collapse({ icon: 'arrow' },
|
|
127
|
+
Collapse.Title({}, '🔄 Returns'),
|
|
128
|
+
Collapse.Content({},
|
|
129
|
+
p({}, '30-day return policy for unused items in original packaging.')
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
$('#example').content(demo);</code></pre>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<!-- vDOM Syntax -->
|
|
138
|
+
<div id="syntax-vdom" style="display: none;">
|
|
139
|
+
<pre><script>
|
|
140
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
141
|
+
at: document.currentScript.parentElement,
|
|
142
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
143
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
144
|
+
type: 'module',
|
|
145
|
+
minHeight: 180
|
|
146
|
+
});
|
|
147
|
+
</script><code contenteditable="true">await import('/components/data-display/collapse.js');
|
|
148
|
+
const { $, tags } = Lightview;
|
|
149
|
+
const { Collapse, div, p } = tags;
|
|
150
|
+
|
|
151
|
+
const demo = {
|
|
152
|
+
tag: div,
|
|
153
|
+
attributes: { style: 'display: flex; flex-direction: column; gap: 0.5rem' },
|
|
154
|
+
children: [
|
|
155
|
+
{
|
|
156
|
+
tag: Collapse,
|
|
157
|
+
attributes: { icon: 'arrow' },
|
|
158
|
+
children: [
|
|
159
|
+
{ tag: Collapse.Title, children: ['📖 Description'] },
|
|
160
|
+
{ tag: Collapse.Content, children: [{ tag: p, children: ['This is a detailed product description that can be expanded.'] }] }
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
tag: Collapse,
|
|
165
|
+
attributes: { icon: 'arrow' },
|
|
166
|
+
children: [
|
|
167
|
+
{ tag: Collapse.Title, children: ['📦 Shipping Info'] },
|
|
168
|
+
{ tag: Collapse.Content, children: [{ tag: p, children: ['Free shipping on orders over $50. Delivery in 3-5 days.'] }] }
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
tag: Collapse,
|
|
173
|
+
attributes: { icon: 'arrow' },
|
|
174
|
+
children: [
|
|
175
|
+
{ tag: Collapse.Title, children: ['🔄 Returns'] },
|
|
176
|
+
{ tag: Collapse.Content, children: [{ tag: p, children: ['30-day return policy for unused items in original packaging.'] }] }
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
$('#example').content(demo);</code></pre>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<!-- Object DOM Syntax -->
|
|
186
|
+
<div id="syntax-object" style="display: none;">
|
|
187
|
+
<pre><script>
|
|
188
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
189
|
+
at: document.currentScript.parentElement,
|
|
190
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
191
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
192
|
+
type: 'module',
|
|
193
|
+
minHeight: 180
|
|
194
|
+
});
|
|
195
|
+
</script><code contenteditable="true">await import('/components/data-display/collapse.js');
|
|
196
|
+
const { $ } = Lightview;
|
|
197
|
+
|
|
198
|
+
const demo = {
|
|
199
|
+
div: {
|
|
200
|
+
style: 'display: flex; flex-direction: column; gap: 0.5rem',
|
|
201
|
+
children: [
|
|
202
|
+
{
|
|
203
|
+
Collapse: {
|
|
204
|
+
icon: 'arrow',
|
|
205
|
+
children: [
|
|
206
|
+
{ 'Collapse.Title': { text: '📖 Description' } },
|
|
207
|
+
{ 'Collapse.Content': { children: [{ p: { text: 'This is a detailed product description that can be expanded.' } }] } }
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
Collapse: {
|
|
213
|
+
icon: 'arrow',
|
|
214
|
+
children: [
|
|
215
|
+
{ 'Collapse.Title': { text: '📦 Shipping Info' } },
|
|
216
|
+
{ 'Collapse.Content': { children: [{ p: { text: 'Free shipping on orders over $50. Delivery in 3-5 days.' } }] } }
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
Collapse: {
|
|
222
|
+
icon: 'arrow',
|
|
223
|
+
children: [
|
|
224
|
+
{ 'Collapse.Title': { text: '🔄 Returns' } },
|
|
225
|
+
{ 'Collapse.Content': { children: [{ p: { text: '30-day return policy for unused items in original packaging.' } }] } }
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
$('#example').content(demo);</code></pre>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
<!-- Reactive Example with Examplify -->
|
|
239
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
240
|
+
<div class="card-body">
|
|
241
|
+
<h2 class="card-title">Initially Open</h2>
|
|
242
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Collapse with open prop</p>
|
|
243
|
+
|
|
244
|
+
<!-- Tabs -->
|
|
245
|
+
<script>
|
|
246
|
+
window.switchReactiveSyntaxTab = (tabId) => {
|
|
247
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
248
|
+
tabs.forEach(t => {
|
|
249
|
+
const tabEl = document.getElementById(`reactive-tab-btn-${t}`);
|
|
250
|
+
const contentEl = document.getElementById(`reactive-syntax-${t}`);
|
|
251
|
+
if (t === tabId) {
|
|
252
|
+
tabEl.classList.add('syntax-tab-active');
|
|
253
|
+
contentEl.style.display = 'block';
|
|
254
|
+
} else {
|
|
255
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
256
|
+
contentEl.style.display = 'none';
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
</script>
|
|
261
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
262
|
+
<button id="reactive-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
263
|
+
onclick="switchReactiveSyntaxTab('tagged')">Tagged</button>
|
|
264
|
+
<button id="reactive-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
265
|
+
onclick="switchReactiveSyntaxTab('vdom')">vDOM</button>
|
|
266
|
+
<button id="reactive-tab-btn-object" role="tab" class="syntax-tab"
|
|
267
|
+
onclick="switchReactiveSyntaxTab('object')">Object DOM</button>
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
<!-- Tagged Syntax -->
|
|
271
|
+
<div id="reactive-syntax-tagged">
|
|
272
|
+
<pre><script>
|
|
273
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
274
|
+
at: document.currentScript.parentElement,
|
|
275
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
276
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
277
|
+
type: 'module',
|
|
278
|
+
minHeight: 200
|
|
279
|
+
});
|
|
280
|
+
</script><code contenteditable="true">await import('/components/data-display/collapse.js');
|
|
281
|
+
const { tags, $ } = Lightview;
|
|
282
|
+
const { div, p, ul, li, Collapse } = tags;
|
|
283
|
+
|
|
284
|
+
const demo = div({ style: 'display: flex; flex-direction: column; gap: 0.5rem' },
|
|
285
|
+
Collapse({ icon: 'plus', open: true },
|
|
286
|
+
Collapse.Title({}, '🎁 What\'s included'),
|
|
287
|
+
Collapse.Content({},
|
|
288
|
+
ul({ style: 'list-style-type: disc; padding-left: 1rem;' },
|
|
289
|
+
li({}, 'Premium headphones'),
|
|
290
|
+
li({}, 'Carrying case'),
|
|
291
|
+
li({}, '3.5mm audio cable'),
|
|
292
|
+
li({}, 'User manual')
|
|
293
|
+
)
|
|
294
|
+
)
|
|
295
|
+
),
|
|
296
|
+
Collapse({ icon: 'plus' },
|
|
297
|
+
Collapse.Title({}, '⚡ Specifications'),
|
|
298
|
+
Collapse.Content({},
|
|
299
|
+
ul({ style: 'list-style-type: disc; padding-left: 1rem;' },
|
|
300
|
+
li({}, 'Driver size: 40mm'),
|
|
301
|
+
li({}, 'Battery: 30h playtime'),
|
|
302
|
+
li({}, 'Bluetooth 5.0')
|
|
303
|
+
)
|
|
304
|
+
)
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
$('#example').content(demo);</code></pre>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<!-- vDOM Syntax -->
|
|
312
|
+
<div id="reactive-syntax-vdom" style="display: none;">
|
|
313
|
+
<pre><script>
|
|
314
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
315
|
+
at: document.currentScript.parentElement,
|
|
316
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
317
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
318
|
+
type: 'module',
|
|
319
|
+
minHeight: 200
|
|
320
|
+
});
|
|
321
|
+
</script><code contenteditable="true">await import('/components/data-display/collapse.js');
|
|
322
|
+
const { $, tags } = Lightview;
|
|
323
|
+
const { Collapse, div, ul, li } = tags;
|
|
324
|
+
|
|
325
|
+
const demo = {
|
|
326
|
+
tag: div,
|
|
327
|
+
attributes: { style: 'display: flex; flex-direction: column; gap: 0.5rem' },
|
|
328
|
+
children: [
|
|
329
|
+
{
|
|
330
|
+
tag: Collapse,
|
|
331
|
+
attributes: { icon: 'plus', open: true },
|
|
332
|
+
children: [
|
|
333
|
+
{ tag: Collapse.Title, children: ['🎁 What\'s included'] },
|
|
334
|
+
{
|
|
335
|
+
tag: Collapse.Content,
|
|
336
|
+
children: [{
|
|
337
|
+
tag: ul,
|
|
338
|
+
attributes: { style: 'list-style-type: disc; padding-left: 1rem;' },
|
|
339
|
+
children: [
|
|
340
|
+
{ tag: li, children: ['Premium headphones'] },
|
|
341
|
+
{ tag: li, children: ['Carrying case'] },
|
|
342
|
+
{ tag: li, children: ['3.5mm audio cable'] },
|
|
343
|
+
{ tag: li, children: ['User manual'] }
|
|
344
|
+
]
|
|
345
|
+
}]
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
tag: Collapse,
|
|
351
|
+
attributes: { icon: 'plus' },
|
|
352
|
+
children: [
|
|
353
|
+
{ tag: Collapse.Title, children: ['⚡ Specifications'] },
|
|
354
|
+
{
|
|
355
|
+
tag: Collapse.Content,
|
|
356
|
+
children: [{
|
|
357
|
+
tag: ul,
|
|
358
|
+
attributes: { style: 'list-style-type: disc; padding-left: 1rem;' },
|
|
359
|
+
children: [
|
|
360
|
+
{ tag: li, children: ['Driver size: 40mm'] },
|
|
361
|
+
{ tag: li, children: ['Battery: 30h playtime'] },
|
|
362
|
+
{ tag: li, children: ['Bluetooth 5.0'] }
|
|
363
|
+
]
|
|
364
|
+
}]
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
$('#example').content(demo);</code></pre>
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
<!-- Object DOM Syntax -->
|
|
375
|
+
<div id="reactive-syntax-object" style="display: none;">
|
|
376
|
+
<pre><script>
|
|
377
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
378
|
+
at: document.currentScript.parentElement,
|
|
379
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
380
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
381
|
+
type: 'module',
|
|
382
|
+
minHeight: 200
|
|
383
|
+
});
|
|
384
|
+
</script><code contenteditable="true">await import('/components/data-display/collapse.js');
|
|
385
|
+
const { $ } = Lightview;
|
|
386
|
+
|
|
387
|
+
const demo = {
|
|
388
|
+
div: {
|
|
389
|
+
style: 'display: flex; flex-direction: column; gap: 0.5rem',
|
|
390
|
+
children: [
|
|
391
|
+
{
|
|
392
|
+
Collapse: {
|
|
393
|
+
icon: 'plus',
|
|
394
|
+
open: true,
|
|
395
|
+
children: [
|
|
396
|
+
{ 'Collapse.Title': { children: ['🎁 What\'s included'] } },
|
|
397
|
+
{
|
|
398
|
+
'Collapse.Content': {
|
|
399
|
+
children: [{
|
|
400
|
+
ul: {
|
|
401
|
+
style: 'list-style-type: disc; padding-left: 1rem;',
|
|
402
|
+
children: [
|
|
403
|
+
{ li: { children: ['Premium headphones'] } },
|
|
404
|
+
{ li: { children: ['Carrying case'] } },
|
|
405
|
+
{ li: { children: ['3.5mm audio cable'] } },
|
|
406
|
+
{ li: { children: ['User manual'] } }
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
}]
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
Collapse: {
|
|
417
|
+
icon: 'plus',
|
|
418
|
+
children: [
|
|
419
|
+
{ 'Collapse.Title': { children: ['⚡ Specifications'] } },
|
|
420
|
+
{
|
|
421
|
+
'Collapse.Content': {
|
|
422
|
+
children: [{
|
|
423
|
+
ul: {
|
|
424
|
+
style: 'list-style-type: disc; padding-left: 1rem;',
|
|
425
|
+
children: [
|
|
426
|
+
{ li: { children: ['Driver size: 40mm'] } },
|
|
427
|
+
{ li: { children: ['Battery: 30h playtime'] } },
|
|
428
|
+
{ li: { children: ['Bluetooth 5.0'] } }
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
}]
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
$('#example').content(demo);</code></pre>
|
|
442
|
+
</div>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
<!-- Props Table -->
|
|
447
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Props</h2>
|
|
448
|
+
<div style="overflow-x: auto; margin-bottom: 2rem;">
|
|
449
|
+
<table class="table table-zebra">
|
|
450
|
+
<thead>
|
|
451
|
+
<tr>
|
|
452
|
+
<th>Prop</th>
|
|
453
|
+
<th>Type</th>
|
|
454
|
+
<th>Default</th>
|
|
455
|
+
<th>Description</th>
|
|
456
|
+
</tr>
|
|
457
|
+
</thead>
|
|
458
|
+
<tbody>
|
|
459
|
+
<tr>
|
|
460
|
+
<td><code>icon</code></td>
|
|
461
|
+
<td>string</td>
|
|
462
|
+
<td>'arrow'</td>
|
|
463
|
+
<td>'arrow' | 'plus'</td>
|
|
464
|
+
</tr>
|
|
465
|
+
<tr>
|
|
466
|
+
<td><code>open</code></td>
|
|
467
|
+
<td>boolean</td>
|
|
468
|
+
<td>false</td>
|
|
469
|
+
<td>Initially open</td>
|
|
470
|
+
</tr>
|
|
471
|
+
<tr>
|
|
472
|
+
<td><code>focus</code></td>
|
|
473
|
+
<td>boolean</td>
|
|
474
|
+
<td>false</td>
|
|
475
|
+
<td>Open on focus (accessibility)</td>
|
|
476
|
+
</tr>
|
|
477
|
+
</tbody>
|
|
478
|
+
</table>
|
|
479
|
+
</div>
|
|
480
|
+
|
|
481
|
+
<!-- Sub-components -->
|
|
482
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Sub-components</h2>
|
|
483
|
+
<div style="overflow-x: auto; margin-bottom: 2rem;">
|
|
484
|
+
<table class="table table-zebra">
|
|
485
|
+
<thead>
|
|
486
|
+
<tr>
|
|
487
|
+
<th>Component</th>
|
|
488
|
+
<th>Description</th>
|
|
489
|
+
</tr>
|
|
490
|
+
</thead>
|
|
491
|
+
<tbody>
|
|
492
|
+
<tr>
|
|
493
|
+
<td><code>Collapse.Title</code></td>
|
|
494
|
+
<td>Clickable header area</td>
|
|
495
|
+
</tr>
|
|
496
|
+
<tr>
|
|
497
|
+
<td><code>Collapse.Content</code></td>
|
|
498
|
+
<td>Hidden content container</td>
|
|
499
|
+
</tr>
|
|
500
|
+
</tbody>
|
|
501
|
+
</table>
|
|
502
|
+
</div>
|
|
503
|
+
|
|
504
|
+
<!-- Static Examples -->
|
|
505
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Arrow Icon</h2>
|
|
506
|
+
<div class="collapse collapse-arrow"
|
|
507
|
+
style="background-color: oklch(var(--b1)); border: 1px solid oklch(var(--b3)); border-radius: var(--rounded-box, 1rem); margin-bottom: 1rem;">
|
|
508
|
+
<input type="checkbox" />
|
|
509
|
+
<div class="collapse-title font-semibold">Click to open/close</div>
|
|
510
|
+
<div class="collapse-content">
|
|
511
|
+
<p>This content is hidden by default.</p>
|
|
512
|
+
</div>
|
|
513
|
+
</div>
|
|
514
|
+
|
|
515
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Plus/Minus Icon</h2>
|
|
516
|
+
<div class="collapse collapse-plus"
|
|
517
|
+
style="background-color: oklch(var(--b1)); border: 1px solid oklch(var(--b3)); border-radius: var(--rounded-box, 1rem); margin-bottom: 1rem;">
|
|
518
|
+
<input type="checkbox" />
|
|
519
|
+
<div class="collapse-title font-semibold">Click to expand</div>
|
|
520
|
+
<div class="collapse-content">
|
|
521
|
+
<p>Expanded content here.</p>
|
|
522
|
+
</div>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Force Open</h2>
|
|
526
|
+
<div class="collapse collapse-open"
|
|
527
|
+
style="background-color: oklch(var(--b1)); border: 1px solid oklch(var(--b3)); border-radius: var(--rounded-box, 1rem); margin-bottom: 2rem;">
|
|
528
|
+
<div class="collapse-title font-semibold">I am always open</div>
|
|
529
|
+
<div class="collapse-content">
|
|
530
|
+
<p>This collapse is forced open with <code>collapse-open</code>.</p>
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
</div>
|
|
536
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- Component Navigation Sidebar -->
|
|
2
|
+
<div class="sidebar-header">
|
|
3
|
+
<h2 class="sidebar-title">Components</h2>
|
|
4
|
+
<p class="sidebar-subtitle">Over 50 components</p>
|
|
5
|
+
</div>
|
|
6
|
+
<ul class="sidebar-nav"
|
|
7
|
+
style="max-height: calc(100vh - 120px); overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; grid-auto-flow: row;"
|
|
8
|
+
id="sidebar-links"></ul>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
(() => {
|
|
12
|
+
const { tags, $ } = Lightview;
|
|
13
|
+
const { li, a } = tags;
|
|
14
|
+
|
|
15
|
+
// Populate sidebar links - alphabetically sorted
|
|
16
|
+
const sidebarLinks = [
|
|
17
|
+
'Accordion', 'Alert', 'Avatar', 'Badge', 'Breadcrumbs', 'Button', 'Card',
|
|
18
|
+
'Carousel', 'Chart', 'Chart Area', 'Chart Bar', 'Chart Column', 'Chart Line', 'Chart Pie',
|
|
19
|
+
'Chat', 'Checkbox', 'Collapse', 'Countdown', 'Diff',
|
|
20
|
+
'Divider', 'Dock', 'Drawer', 'Dropdown', 'File Input', 'Footer', 'Hero',
|
|
21
|
+
'Indicator', 'Input', 'Join', 'Kbd', 'Loading', 'Menu', 'Modal', 'Navbar',
|
|
22
|
+
'Pagination', 'Progress', 'Radial Progress', 'Radio', 'Range', 'Rating',
|
|
23
|
+
'Select', 'Skeleton', 'Stats', 'Steps', 'Swap', 'Table', 'Tabs', 'Textarea',
|
|
24
|
+
'Theme Controller', 'Timeline', 'Toast', 'Toggle', 'Tooltip'
|
|
25
|
+
].sort(); // Sort alphabetically
|
|
26
|
+
|
|
27
|
+
const linksContainer = $('#sidebar-links');
|
|
28
|
+
const items = sidebarLinks.map(name => {
|
|
29
|
+
const slug = name.toLowerCase().replace(/\s+/g, '-');
|
|
30
|
+
return li({}, a({ href: `/docs/components/${slug}` }, name));
|
|
31
|
+
});
|
|
32
|
+
linksContainer.content(items);
|
|
33
|
+
})();
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<script type="module">
|
|
37
|
+
import { initSidebar } from './sidebar-setup.js';
|
|
38
|
+
const sidebarAPI = initSidebar();
|
|
39
|
+
|
|
40
|
+
// Close drawer when clicking navigation links to prevent page shift
|
|
41
|
+
if (sidebarAPI) {
|
|
42
|
+
const sidebarLinks = document.getElementById('sidebar-links');
|
|
43
|
+
if (sidebarLinks) {
|
|
44
|
+
sidebarLinks.addEventListener('click', (e) => {
|
|
45
|
+
// Check if clicked element is a link or inside a link
|
|
46
|
+
const link = e.target.closest('a');
|
|
47
|
+
if (link) {
|
|
48
|
+
sidebarAPI.close();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</script>
|