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,528 @@
|
|
|
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: 'Alert' }
|
|
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">Alert</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
|
+
Alert informs users about important events or status messages.
|
|
61
|
+
Supports multiple colors, variants, and optional icons.
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<!-- Basic Usage -->
|
|
65
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
66
|
+
<div class="card-body">
|
|
67
|
+
<h2 class="card-title">Basic Usage</h2>
|
|
68
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Alerts with different colors
|
|
69
|
+
and icons.
|
|
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: 280,
|
|
110
|
+
autoRun: true
|
|
111
|
+
});
|
|
112
|
+
</script><code contenteditable="true">await import('/components/data-display/alert.js');
|
|
113
|
+
const { tags, $ } = Lightview;
|
|
114
|
+
const { div, span, Alert } = tags;
|
|
115
|
+
|
|
116
|
+
const alerts = div({ style: 'display: flex; flex-direction: column; gap: 1rem;' },
|
|
117
|
+
Alert({ color: 'info', icon: 'info' },
|
|
118
|
+
span({}, 'New update available! Click to learn more.')
|
|
119
|
+
),
|
|
120
|
+
Alert({ color: 'success', icon: 'success' },
|
|
121
|
+
span({}, 'Your order has been placed successfully!')
|
|
122
|
+
),
|
|
123
|
+
Alert({ color: 'warning', icon: 'warning' },
|
|
124
|
+
span({}, 'Please review your information before proceeding.')
|
|
125
|
+
),
|
|
126
|
+
Alert({ color: 'error', icon: 'error' },
|
|
127
|
+
span({}, 'Unable to connect to server. Please try again.')
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
$('#example').content(alerts);</code></pre>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<!-- vDOM Syntax -->
|
|
135
|
+
<div id="syntax-vdom" style="display: none;">
|
|
136
|
+
<pre><script>
|
|
137
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
138
|
+
at: document.currentScript.parentElement,
|
|
139
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
140
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
141
|
+
type: 'module',
|
|
142
|
+
minHeight: 280
|
|
143
|
+
});
|
|
144
|
+
</script><code contenteditable="true">await import('/components/data-display/alert.js');
|
|
145
|
+
const { $, tags } = Lightview;
|
|
146
|
+
const { Alert, div, span } = tags;
|
|
147
|
+
|
|
148
|
+
const alerts = {
|
|
149
|
+
tag: div,
|
|
150
|
+
attributes: { style: 'display: flex; flex-direction: column; gap: 1rem;' },
|
|
151
|
+
children: [
|
|
152
|
+
{
|
|
153
|
+
tag: Alert,
|
|
154
|
+
attributes: { color: 'info', icon: 'info' },
|
|
155
|
+
children: [{ tag: span, children: ['New update available! Click to learn more.'] }]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
tag: Alert,
|
|
159
|
+
attributes: { color: 'success', icon: 'success' },
|
|
160
|
+
children: [{ tag: span, children: ['Your order has been placed successfully!'] }]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
tag: Alert,
|
|
164
|
+
attributes: { color: 'warning', icon: 'warning' },
|
|
165
|
+
children: [{ tag: span, children: ['Please review your information before proceeding.'] }]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
tag: Alert,
|
|
169
|
+
attributes: { color: 'error', icon: 'error' },
|
|
170
|
+
children: [{ tag: span, children: ['Unable to connect to server. Please try again.'] }]
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
$('#example').content(alerts);</code></pre>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<!-- Object DOM Syntax -->
|
|
179
|
+
<div id="syntax-object" style="display: none;">
|
|
180
|
+
<pre><script>
|
|
181
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
182
|
+
at: document.currentScript.parentElement,
|
|
183
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
184
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
185
|
+
type: 'module',
|
|
186
|
+
minHeight: 280
|
|
187
|
+
});
|
|
188
|
+
</script><code contenteditable="true">await import('/components/data-display/alert.js');
|
|
189
|
+
const { $ } = Lightview;
|
|
190
|
+
|
|
191
|
+
const alerts = {
|
|
192
|
+
div: {
|
|
193
|
+
style: 'display: flex; flex-direction: column; gap: 1rem;',
|
|
194
|
+
children: [
|
|
195
|
+
{ Alert: { color: 'info', icon: 'info', children: [{ span: { text: 'New update available! Click to learn more.' } }] } },
|
|
196
|
+
{ Alert: { color: 'success', icon: 'success', children: [{ span: { text: 'Your order has been placed successfully!' } }] } },
|
|
197
|
+
{ Alert: { color: 'warning', icon: 'warning', children: [{ span: { text: 'Please review your information before proceeding.' } }] } },
|
|
198
|
+
{ Alert: { color: 'error', icon: 'error', children: [{ span: { text: 'Unable to connect to server. Please try again.' } }] } }
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
$('#example').content(alerts);</code></pre>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<!-- HTML Syntax -->
|
|
207
|
+
<div id="syntax-html" style="display: none;">
|
|
208
|
+
<pre><script>
|
|
209
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
210
|
+
at: document.currentScript.parentElement,
|
|
211
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
212
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
213
|
+
type: 'module',
|
|
214
|
+
language: 'html',
|
|
215
|
+
minHeight: 280
|
|
216
|
+
});
|
|
217
|
+
</script><code contenteditable="true" class="language-html"><!-- Import the component (registers lv-alert) -->
|
|
218
|
+
<script type="module" src="/components/data-display/alert.js"></script>
|
|
219
|
+
|
|
220
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
221
|
+
<lv-alert color="info" icon="info">New update available!</lv-alert>
|
|
222
|
+
<lv-alert color="success" icon="success">Your order has been placed!</lv-alert>
|
|
223
|
+
<lv-alert color="warning" icon="warning">Please review before proceeding.</lv-alert>
|
|
224
|
+
<lv-alert color="error" icon="error">Connection failed.</lv-alert>
|
|
225
|
+
</div></code></pre>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<!-- Reactive Example -->
|
|
231
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
232
|
+
<div class="card-body">
|
|
233
|
+
<h2 class="card-title">Dismissible Alert</h2>
|
|
234
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Alert with close button using
|
|
235
|
+
signals.</p>
|
|
236
|
+
|
|
237
|
+
<!-- Tabs -->
|
|
238
|
+
<script>
|
|
239
|
+
window.switchReactiveSyntaxTab = (tabId) => {
|
|
240
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
241
|
+
tabs.forEach(t => {
|
|
242
|
+
const tabEl = document.getElementById(`reactive-tab-btn-${t}`);
|
|
243
|
+
const contentEl = document.getElementById(`reactive-syntax-${t}`);
|
|
244
|
+
if (t === tabId) {
|
|
245
|
+
tabEl.classList.add('syntax-tab-active');
|
|
246
|
+
contentEl.style.display = 'block';
|
|
247
|
+
} else {
|
|
248
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
249
|
+
contentEl.style.display = 'none';
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
</script>
|
|
254
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
255
|
+
<button id="reactive-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
256
|
+
onclick="switchReactiveSyntaxTab('tagged')">Tagged</button>
|
|
257
|
+
<button id="reactive-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
258
|
+
onclick="switchReactiveSyntaxTab('vdom')">vDOM</button>
|
|
259
|
+
<button id="reactive-tab-btn-object" role="tab" class="syntax-tab"
|
|
260
|
+
onclick="switchReactiveSyntaxTab('object')">Object DOM</button>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<!-- Tagged Syntax -->
|
|
264
|
+
<div id="reactive-syntax-tagged">
|
|
265
|
+
<pre><script>
|
|
266
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
267
|
+
at: document.currentScript.parentElement,
|
|
268
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
269
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
270
|
+
type: 'module',
|
|
271
|
+
minHeight: 100
|
|
272
|
+
});
|
|
273
|
+
</script><code contenteditable="true">await import('/components/data-display/alert.js');
|
|
274
|
+
await import('/components/actions/button.js');
|
|
275
|
+
const { signal, tags, $ } = Lightview;
|
|
276
|
+
const { div, span, Alert, Button } = tags;
|
|
277
|
+
|
|
278
|
+
const visible = signal(true);
|
|
279
|
+
|
|
280
|
+
const demo = div({},
|
|
281
|
+
() => visible.value
|
|
282
|
+
? Alert({ color: 'success', icon: 'success' },
|
|
283
|
+
span({}, 'Message sent successfully!'),
|
|
284
|
+
Button({
|
|
285
|
+
size: 'sm',
|
|
286
|
+
color: 'ghost',
|
|
287
|
+
onclick: () => { visible.value = false; }
|
|
288
|
+
}, '✕')
|
|
289
|
+
)
|
|
290
|
+
: div({ style: 'display: flex; gap: 0.5rem;' },
|
|
291
|
+
span({ style: 'font-size: 0.875rem; opacity: 0.5;' }, 'Alert dismissed'),
|
|
292
|
+
Button({
|
|
293
|
+
size: 'sm',
|
|
294
|
+
color: 'primary',
|
|
295
|
+
onclick: () => { visible.value = true; }
|
|
296
|
+
}, 'Show again')
|
|
297
|
+
)
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
$('#example').content(demo);</code></pre>
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
<!-- vDOM Syntax -->
|
|
304
|
+
<div id="reactive-syntax-vdom" style="display: none;">
|
|
305
|
+
<pre><script>
|
|
306
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
307
|
+
at: document.currentScript.parentElement,
|
|
308
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
309
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
310
|
+
type: 'module',
|
|
311
|
+
minHeight: 100
|
|
312
|
+
});
|
|
313
|
+
</script><code contenteditable="true">await import('/components/data-display/alert.js');
|
|
314
|
+
await import('/components/actions/button.js');
|
|
315
|
+
const { signal, $, tags } = Lightview;
|
|
316
|
+
const { div, span, Alert, Button } = tags;
|
|
317
|
+
|
|
318
|
+
const visible = signal(true);
|
|
319
|
+
|
|
320
|
+
const demo = {
|
|
321
|
+
tag: div,
|
|
322
|
+
children: [
|
|
323
|
+
() => visible.value
|
|
324
|
+
? {
|
|
325
|
+
tag: Alert,
|
|
326
|
+
attributes: { color: 'success', icon: 'success' },
|
|
327
|
+
children: [
|
|
328
|
+
{ tag: span, children: ['Message sent successfully!'] },
|
|
329
|
+
{
|
|
330
|
+
tag: Button,
|
|
331
|
+
attributes: { size: 'sm', color: 'ghost', onclick: () => { visible.value = false; } },
|
|
332
|
+
children: ['✕']
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
: {
|
|
337
|
+
tag: div,
|
|
338
|
+
attributes: { style: 'display: flex; gap: 0.5rem;' },
|
|
339
|
+
children: [
|
|
340
|
+
{ tag: span, attributes: { style: 'font-size: 0.875rem; opacity: 0.5;' }, children: ['Alert dismissed'] },
|
|
341
|
+
{
|
|
342
|
+
tag: Button,
|
|
343
|
+
attributes: { size: 'sm', color: 'primary', onclick: () => { visible.value = true; } },
|
|
344
|
+
children: ['Show again']
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
$('#example').content(demo);</code></pre>
|
|
352
|
+
</div>
|
|
353
|
+
|
|
354
|
+
<!-- Object DOM Syntax -->
|
|
355
|
+
<div id="reactive-syntax-object" style="display: none;">
|
|
356
|
+
<pre><script>
|
|
357
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
358
|
+
at: document.currentScript.parentElement,
|
|
359
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
360
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
361
|
+
type: 'module',
|
|
362
|
+
minHeight: 100
|
|
363
|
+
});
|
|
364
|
+
</script><code contenteditable="true">await import('/components/data-display/alert.js');
|
|
365
|
+
await import('/components/actions/button.js');
|
|
366
|
+
const { signal, $ } = Lightview;
|
|
367
|
+
|
|
368
|
+
const visible = signal(true);
|
|
369
|
+
|
|
370
|
+
const demo = {
|
|
371
|
+
div: {
|
|
372
|
+
children: [
|
|
373
|
+
() => visible.value
|
|
374
|
+
? {
|
|
375
|
+
Alert: {
|
|
376
|
+
color: 'success',
|
|
377
|
+
icon: 'success',
|
|
378
|
+
children: [
|
|
379
|
+
{ span: { text: 'Message sent successfully!' } },
|
|
380
|
+
{ Button: { size: 'sm', color: 'ghost', onclick: () => { visible.value = false; }, text: '✕' } }
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
: {
|
|
385
|
+
div: {
|
|
386
|
+
style: 'display: flex; gap: 0.5rem;',
|
|
387
|
+
children: [
|
|
388
|
+
{ span: { style: 'font-size: 0.875rem; opacity: 0.5;', text: 'Alert dismissed' } },
|
|
389
|
+
{ Button: { size: 'sm', color: 'primary', onclick: () => { visible.value = true; }, text: 'Show again' } }
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
$('#example').content(demo);</code></pre>
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
<!-- Props Table -->
|
|
403
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Props</h2>
|
|
404
|
+
<div style="overflow-x: auto; margin-bottom: 2rem;">
|
|
405
|
+
<table class="table table-zebra">
|
|
406
|
+
<thead>
|
|
407
|
+
<tr>
|
|
408
|
+
<th>Prop</th>
|
|
409
|
+
<th>Type</th>
|
|
410
|
+
<th>Default</th>
|
|
411
|
+
<th>Description</th>
|
|
412
|
+
</tr>
|
|
413
|
+
</thead>
|
|
414
|
+
<tbody>
|
|
415
|
+
<tr>
|
|
416
|
+
<td><code>color</code></td>
|
|
417
|
+
<td>string</td>
|
|
418
|
+
<td>-</td>
|
|
419
|
+
<td>'info' | 'success' | 'warning' | 'error'</td>
|
|
420
|
+
</tr>
|
|
421
|
+
<tr>
|
|
422
|
+
<td><code>icon</code></td>
|
|
423
|
+
<td>string</td>
|
|
424
|
+
<td>-</td>
|
|
425
|
+
<td>Auto-icon: 'info' | 'success' | 'warning' | 'error'</td>
|
|
426
|
+
</tr>
|
|
427
|
+
<tr>
|
|
428
|
+
<td><code>soft</code></td>
|
|
429
|
+
<td>boolean</td>
|
|
430
|
+
<td>false</td>
|
|
431
|
+
<td>Use soft/light background variant</td>
|
|
432
|
+
</tr>
|
|
433
|
+
<tr>
|
|
434
|
+
<td><code>outline</code></td>
|
|
435
|
+
<td>boolean</td>
|
|
436
|
+
<td>false</td>
|
|
437
|
+
<td>Use outlined border style</td>
|
|
438
|
+
</tr>
|
|
439
|
+
<tr>
|
|
440
|
+
<td><code>dash</code></td>
|
|
441
|
+
<td>boolean</td>
|
|
442
|
+
<td>false</td>
|
|
443
|
+
<td>Use dashed border style</td>
|
|
444
|
+
</tr>
|
|
445
|
+
</tbody>
|
|
446
|
+
</table>
|
|
447
|
+
</div>
|
|
448
|
+
|
|
449
|
+
<!-- Colors -->
|
|
450
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Colors</h2>
|
|
451
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem;">
|
|
452
|
+
<div role="alert" class="alert">
|
|
453
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
454
|
+
style="width: 1.25rem; height: 1.25rem; stroke: oklch(var(--in));">
|
|
455
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
456
|
+
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
457
|
+
</svg>
|
|
458
|
+
<span>Default alert — neutral information message.</span>
|
|
459
|
+
</div>
|
|
460
|
+
<div role="alert" class="alert alert-info">
|
|
461
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
462
|
+
style="width: 1.25rem; height: 1.25rem; stroke: currentColor;">
|
|
463
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
464
|
+
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
465
|
+
</svg>
|
|
466
|
+
<span>Info alert — informational message.</span>
|
|
467
|
+
</div>
|
|
468
|
+
<div role="alert" class="alert alert-success">
|
|
469
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
470
|
+
style="width: 1.25rem; height: 1.25rem; stroke: currentColor;" fill="none"
|
|
471
|
+
viewBox="0 0 24 24">
|
|
472
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
473
|
+
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
474
|
+
</svg>
|
|
475
|
+
<span>Success alert — operation completed successfully.</span>
|
|
476
|
+
</div>
|
|
477
|
+
<div role="alert" class="alert alert-warning">
|
|
478
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
479
|
+
style="width: 1.25rem; height: 1.25rem; stroke: currentColor;" fill="none"
|
|
480
|
+
viewBox="0 0 24 24">
|
|
481
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
482
|
+
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
|
483
|
+
</svg>
|
|
484
|
+
<span>Warning alert — caution is advised.</span>
|
|
485
|
+
</div>
|
|
486
|
+
<div role="alert" class="alert alert-error">
|
|
487
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
488
|
+
style="width: 1.25rem; height: 1.25rem; stroke: currentColor;" fill="none"
|
|
489
|
+
viewBox="0 0 24 24">
|
|
490
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
491
|
+
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
492
|
+
</svg>
|
|
493
|
+
<span>Error alert — something went wrong!</span>
|
|
494
|
+
</div>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
<!-- Variants -->
|
|
498
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Variants</h2>
|
|
499
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem;">
|
|
500
|
+
<div role="alert" class="alert alert-soft alert-info">
|
|
501
|
+
<span>Soft variant — lighter background.</span>
|
|
502
|
+
</div>
|
|
503
|
+
<div role="alert" class="alert alert-outline alert-success">
|
|
504
|
+
<span>Outline variant — bordered style.</span>
|
|
505
|
+
</div>
|
|
506
|
+
<div role="alert" class="alert alert-dash alert-warning">
|
|
507
|
+
<span>Dash variant — dashed border.</span>
|
|
508
|
+
</div>
|
|
509
|
+
</div>
|
|
510
|
+
|
|
511
|
+
<!-- With Actions -->
|
|
512
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">With Actions</h2>
|
|
513
|
+
<div role="alert" class="alert" style="margin-bottom: 2rem;">
|
|
514
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
515
|
+
class="stroke-info icon-sm">
|
|
516
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
517
|
+
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
518
|
+
</svg>
|
|
519
|
+
<span>We have sent an email with a confirmation link.</span>
|
|
520
|
+
<div>
|
|
521
|
+
<button class="btn btn-sm">Dismiss</button>
|
|
522
|
+
<button class="btn btn-sm btn-primary">See</button>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
</div>
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|