lightview 1.8.2 → 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 +1330 -19
- 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 +610 -15
- 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 +485 -42
- 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 +132 -42
- 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 +659 -1200
- 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/docs/CNAME +0 -1
- package/docs/api.html +0 -674
- package/docs/blank.html +0 -10
- package/docs/comparedto.html +0 -89
- package/docs/components/chart-repl.html +0 -69
- package/docs/components/components.js +0 -113
- package/docs/components/contents.html +0 -17
- package/docs/components/gantt-repl.html +0 -61
- package/docs/components/gantt.html +0 -42
- package/docs/components/gauge-repl.html +0 -66
- package/docs/components/gauge.html +0 -20
- package/docs/components/orgchart-repl.html +0 -64
- package/docs/components/orgchart.html +0 -41
- package/docs/components/repl-as-src.html +0 -17
- package/docs/components/repl-repl.html +0 -95
- package/docs/components/repl.html +0 -527
- package/docs/components/timeline-repl.html +0 -72
- package/docs/components.html +0 -14
- package/docs/css/highlightjs.min.css +0 -9
- package/docs/css/tutorial.css +0 -35
- package/docs/examples/anchor.html +0 -11
- package/docs/examples/chart.html +0 -34
- package/docs/examples/counter.html +0 -26
- package/docs/examples/counter.test.mjs +0 -47
- package/docs/examples/counter2.html +0 -26
- package/docs/examples/directives.html +0 -79
- package/docs/examples/foreign.html +0 -50
- package/docs/examples/forgeinform.html +0 -98
- package/docs/examples/form.html +0 -61
- package/docs/examples/gauge.html +0 -18
- package/docs/examples/invalid-template-literals.html +0 -44
- package/docs/examples/medium/remote.html +0 -60
- package/docs/examples/message.html +0 -18
- package/docs/examples/nested.html +0 -11
- package/docs/examples/object-bound-form.html +0 -34
- package/docs/examples/remote-server.js +0 -51
- package/docs/examples/remote.html +0 -34
- package/docs/examples/remote.json +0 -1
- package/docs/examples/scratch.html +0 -69
- package/docs/examples/sensors/index.html +0 -44
- package/docs/examples/sensors/sensor-server.js +0 -30
- package/docs/examples/shared.html +0 -41
- package/docs/examples/template.html +0 -33
- package/docs/examples/timeline.html +0 -21
- package/docs/examples/todo.html +0 -40
- package/docs/examples/top.html +0 -10
- package/docs/examples/types.html +0 -94
- package/docs/examples/xor.html +0 -62
- package/docs/examples.html +0 -25
- package/docs/javascript/codejar.min.js +0 -8
- package/docs/javascript/highlightjs.min.js +0 -1173
- package/docs/javascript/isomorphic-git.js +0 -9
- package/docs/javascript/json5.min.js +0 -1
- package/docs/javascript/lightning-fs.js +0 -1
- package/docs/javascript/lightview.js +0 -1285
- package/docs/javascript/marked.min.js +0 -6
- package/docs/javascript/peerjs.min.js +0 -70
- package/docs/javascript/turndown.js +0 -973
- package/docs/javascript/types.js +0 -606
- package/docs/javascript/utils.js +0 -45
- package/docs/lightview.html +0 -63
- package/docs/old_index.html +0 -965
- package/docs/old_index.md +0 -1132
- package/docs/slidein.html +0 -51
- package/docs/tutorial/0-getting-started.html +0 -67
- package/docs/tutorial/1-intro-to-variables.html +0 -103
- package/docs/tutorial/10-template-components.html +0 -80
- package/docs/tutorial/11-linked-components.html +0 -76
- package/docs/tutorial/12-imported-components.html +0 -67
- package/docs/tutorial/13-input-binding.html +0 -94
- package/docs/tutorial/14-automatic-variable-creation.html +0 -74
- package/docs/tutorial/15-form-binding.html +0 -110
- package/docs/tutorial/16-if-directive.html +0 -60
- package/docs/tutorial/17-loop-directives.html +0 -83
- package/docs/tutorial/18-sanitizing-and-escaping-input.html +0 -79
- package/docs/tutorial/2-imported-and-exported-variables.html +0 -80
- package/docs/tutorial/3-data-types.html +0 -89
- package/docs/tutorial/4-extended-data-types.html +0 -83
- package/docs/tutorial/5-extended-functional-types.html +0 -96
- package/docs/tutorial/5.1-extended-functional-types.html +0 -79
- package/docs/tutorial/5.2-extended-functional-types.html +0 -70
- package/docs/tutorial/6-conventional-javascript.html +0 -75
- package/docs/tutorial/7-monitoring-with-observers.html +0 -107
- package/docs/tutorial/8-event-listeners.html +0 -65
- package/docs/tutorial/9-intro-to-components.html +0 -91
- package/docs/tutorial/contents.html +0 -32
- package/docs/tutorial/my-component.html +0 -29
- package/docs/tutorial/remote-value.json +0 -4
- package/docs/websiterepl.html +0 -46
- package/jest-puppeteer.config.js +0 -5
- package/jest.config.json +0 -12
- package/lightview.min.js +0 -1
- package/lightview_good.js +0 -1267
- package/lightview_optimized.js +0 -1274
- package/repl_hold.html +0 -320
- package/test/basic.html +0 -104
- package/test/basic.test.mjs +0 -315
- package/test/extended.html +0 -29
- package/test/extended.test.mjs +0 -448
- package/types.js +0 -607
- package/unsplash.key +0 -1
|
@@ -0,0 +1,586 @@
|
|
|
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
|
+
<!-- Load DaisyUI and Avatar Component -->
|
|
12
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css">
|
|
13
|
+
<script type="module" src="/components/data-display/avatar.js"></script>
|
|
14
|
+
|
|
15
|
+
<!-- Gallery Structure -->
|
|
16
|
+
<div class="gallery-page">
|
|
17
|
+
<div class="gallery-layout">
|
|
18
|
+
<!-- Sidebar Overlay -->
|
|
19
|
+
<div id="sidebar-overlay" class="sidebar-overlay"></div>
|
|
20
|
+
|
|
21
|
+
<!-- Sidebar -->
|
|
22
|
+
<div id="gallery-sidebar" class="gallery-sidebar" style="visibility: hidden" src="./component-nav.html"></div>
|
|
23
|
+
|
|
24
|
+
<!-- Main Content -->
|
|
25
|
+
<div id="gallery-main" class="gallery-main">
|
|
26
|
+
<!-- Header Container -->
|
|
27
|
+
<div
|
|
28
|
+
style="position: sticky; top: 0; z-index: 30; background: var(--gallery-surface); border-bottom: 1px solid var(--gallery-border); backdrop-filter: blur(8px);">
|
|
29
|
+
<!-- Breadcrumbs Row -->
|
|
30
|
+
<div style="padding: 0.75rem 1.5rem 0;">
|
|
31
|
+
<script>
|
|
32
|
+
(() => {
|
|
33
|
+
const { Breadcrumbs } = Lightview.tags;
|
|
34
|
+
const breadcrumbs = Breadcrumbs({
|
|
35
|
+
id: 'page-breadcrumbs',
|
|
36
|
+
items: [
|
|
37
|
+
{ label: 'Components', href: '/docs/components' },
|
|
38
|
+
{ label: 'Avatar' }
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
document.currentScript.replaceWith(breadcrumbs.domEl);
|
|
42
|
+
})();
|
|
43
|
+
</script>
|
|
44
|
+
</div>
|
|
45
|
+
<!-- Title Row -->
|
|
46
|
+
<div class="gallery-header"
|
|
47
|
+
style="border-bottom: none; height: auto; padding-top: 0.5rem; padding-bottom: 0.75rem;">
|
|
48
|
+
<button id="toggle-btn" class="toggle-btn" aria-label="Toggle Sidebar">
|
|
49
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="toggle-icon"
|
|
50
|
+
style="stroke: currentColor; stroke-width: 2;">
|
|
51
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
|
|
52
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M11 19l-7-7 7-7" />
|
|
53
|
+
</svg>
|
|
54
|
+
</button>
|
|
55
|
+
<h1 class="gallery-title">Avatar</h1>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<!-- Content -->
|
|
60
|
+
<div class="gallery-content">
|
|
61
|
+
<div class="section-content" style="max-width: 1000px;">
|
|
62
|
+
<p class="text-lg" style="opacity: 0.7; margin-bottom: 1.5rem;">
|
|
63
|
+
Avatar is used to show a thumbnail representation of an individual or business.
|
|
64
|
+
Supports images, placeholders, status indicators, and grouping.
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
<!-- Basic Usage -->
|
|
68
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
69
|
+
<div class="card-body">
|
|
70
|
+
<h2 class="card-title">Basic Usage</h2>
|
|
71
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Avatars with different shapes
|
|
72
|
+
and
|
|
73
|
+
features.</p>
|
|
74
|
+
|
|
75
|
+
<!-- Tabs -->
|
|
76
|
+
<script>
|
|
77
|
+
window.switchSyntaxTab = (tabId) => {
|
|
78
|
+
const tabs = ['tagged', 'vdom', 'object', 'html'];
|
|
79
|
+
tabs.forEach(t => {
|
|
80
|
+
const tabEl = document.getElementById(`tab-btn-${t}`);
|
|
81
|
+
const contentEl = document.getElementById(`syntax-${t}`);
|
|
82
|
+
if (t === tabId) {
|
|
83
|
+
tabEl.classList.add('syntax-tab-active');
|
|
84
|
+
contentEl.style.display = 'block';
|
|
85
|
+
} else {
|
|
86
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
87
|
+
contentEl.style.display = 'none';
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
92
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
93
|
+
<button id="tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
94
|
+
onclick="switchSyntaxTab('tagged')">Tagged</button>
|
|
95
|
+
<button id="tab-btn-vdom" role="tab" class="syntax-tab"
|
|
96
|
+
onclick="switchSyntaxTab('vdom')">vDOM</button>
|
|
97
|
+
<button id="tab-btn-object" role="tab" class="syntax-tab"
|
|
98
|
+
onclick="switchSyntaxTab('object')">Object
|
|
99
|
+
DOM</button>
|
|
100
|
+
<button id="tab-btn-html" role="tab" class="syntax-tab"
|
|
101
|
+
onclick="switchSyntaxTab('html')">HTML</button>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<!-- Tagged Syntax -->
|
|
105
|
+
<div id="syntax-tagged">
|
|
106
|
+
<pre><script>
|
|
107
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
108
|
+
at: document.currentScript.parentElement,
|
|
109
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
110
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
111
|
+
type: 'module',
|
|
112
|
+
minHeight: 75,
|
|
113
|
+
autoRun: true
|
|
114
|
+
});
|
|
115
|
+
</script><code contenteditable="true">await import('/components/data-display/avatar.js');
|
|
116
|
+
const { tags, $ } = Lightview;
|
|
117
|
+
const { div, Avatar } = tags;
|
|
118
|
+
|
|
119
|
+
const avatars = div({ style: 'display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;' },
|
|
120
|
+
// Image avatar - default circle
|
|
121
|
+
Avatar({
|
|
122
|
+
src: 'https://i.pravatar.cc/100?img=1',
|
|
123
|
+
alt: 'User 1',
|
|
124
|
+
size: 'w-16'
|
|
125
|
+
}),
|
|
126
|
+
// Squircle shape
|
|
127
|
+
Avatar({
|
|
128
|
+
src: 'https://i.pravatar.cc/100?img=2',
|
|
129
|
+
size: 'w-16',
|
|
130
|
+
shape: 'squircle'
|
|
131
|
+
}),
|
|
132
|
+
// Hexagon shape
|
|
133
|
+
Avatar({
|
|
134
|
+
src: 'https://i.pravatar.cc/100?img=3',
|
|
135
|
+
size: 'w-16',
|
|
136
|
+
shape: 'hexagon'
|
|
137
|
+
}),
|
|
138
|
+
// Rounded shape
|
|
139
|
+
Avatar({
|
|
140
|
+
src: 'https://i.pravatar.cc/100?img=4',
|
|
141
|
+
size: 'w-16',
|
|
142
|
+
shape: 'rounded'
|
|
143
|
+
}),
|
|
144
|
+
// With ring
|
|
145
|
+
Avatar({
|
|
146
|
+
src: 'https://i.pravatar.cc/100?img=5',
|
|
147
|
+
size: 'w-16',
|
|
148
|
+
ring: true,
|
|
149
|
+
ringColor: 'ring-primary'
|
|
150
|
+
}),
|
|
151
|
+
// Online status
|
|
152
|
+
Avatar({
|
|
153
|
+
src: 'https://i.pravatar.cc/100?img=6',
|
|
154
|
+
size: 'w-16',
|
|
155
|
+
online: true
|
|
156
|
+
})
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
$('#example').content(avatars);</code></pre>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<!-- vDOM Syntax -->
|
|
163
|
+
<div id="syntax-vdom" style="display: none;">
|
|
164
|
+
<pre><script>
|
|
165
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
166
|
+
at: document.currentScript.parentElement,
|
|
167
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
168
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
169
|
+
type: 'module',
|
|
170
|
+
minHeight: 75
|
|
171
|
+
});
|
|
172
|
+
</script><code contenteditable="true">await import('/components/data-display/avatar.js');
|
|
173
|
+
const { $, tags } = Lightview;
|
|
174
|
+
const { div, Avatar } = tags;
|
|
175
|
+
|
|
176
|
+
const avatars = {
|
|
177
|
+
tag: div,
|
|
178
|
+
attributes: { style: 'display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;' },
|
|
179
|
+
children: [
|
|
180
|
+
{ tag: Avatar, attributes: { src: 'https://i.pravatar.cc/100?img=1', alt: 'User 1', size: 'w-16' } },
|
|
181
|
+
{ tag: Avatar, attributes: { src: 'https://i.pravatar.cc/100?img=2', size: 'w-16', shape: 'squircle' } },
|
|
182
|
+
{ tag: Avatar, attributes: { src: 'https://i.pravatar.cc/100?img=3', size: 'w-16', shape: 'hexagon' } },
|
|
183
|
+
{ tag: Avatar, attributes: { src: 'https://i.pravatar.cc/100?img=5', size: 'w-16', ring: true, ringColor: 'ring-primary' } },
|
|
184
|
+
{ tag: Avatar, attributes: { placeholder: 'JD', size: 'w-16' } },
|
|
185
|
+
{ tag: Avatar, attributes: { src: 'https://i.pravatar.cc/100?img=4', size: 'w-16', online: true } }
|
|
186
|
+
]
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
$('#example').content(avatars);</code></pre>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<!-- Object DOM Syntax -->
|
|
193
|
+
<div id="syntax-object" style="display: none;">
|
|
194
|
+
<pre><script>
|
|
195
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
196
|
+
at: document.currentScript.parentElement,
|
|
197
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
198
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
199
|
+
type: 'module',
|
|
200
|
+
minHeight: 75
|
|
201
|
+
});
|
|
202
|
+
</script><code contenteditable="true">await import('/components/data-display/avatar.js');
|
|
203
|
+
const { $ } = Lightview;
|
|
204
|
+
|
|
205
|
+
const avatars = {
|
|
206
|
+
div: {
|
|
207
|
+
style: 'display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;',
|
|
208
|
+
children: [
|
|
209
|
+
{ Avatar: { src: 'https://i.pravatar.cc/100?img=1', alt: 'User 1', size: 'w-16' } },
|
|
210
|
+
{ Avatar: { src: 'https://i.pravatar.cc/100?img=2', size: 'w-16', shape: 'squircle' } },
|
|
211
|
+
{ Avatar: { src: 'https://i.pravatar.cc/100?img=3', size: 'w-16', shape: 'hexagon' } },
|
|
212
|
+
{ Avatar: { src: 'https://i.pravatar.cc/100?img=5', size: 'w-16', ring: true, ringColor: 'ring-primary' } },
|
|
213
|
+
{ Avatar: { placeholder: 'JD', size: 'w-16' } },
|
|
214
|
+
{ Avatar: { src: 'https://i.pravatar.cc/100?img=4', size: 'w-16', online: true } }
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
$('#example').content(avatars);</code></pre>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<!-- HTML Syntax -->
|
|
223
|
+
<div id="syntax-html" style="display: none;">
|
|
224
|
+
<pre><script>
|
|
225
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
226
|
+
at: document.currentScript.parentElement,
|
|
227
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
228
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
229
|
+
type: 'module',
|
|
230
|
+
language: 'html',
|
|
231
|
+
minHeight: 75
|
|
232
|
+
});
|
|
233
|
+
</script><code contenteditable="true" class="language-html"><!-- Import the component (registers lv-avatar) -->
|
|
234
|
+
<script type="module" src="/components/data-display/avatar.js"></script>
|
|
235
|
+
|
|
236
|
+
<div style="display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;">
|
|
237
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=1" size="w-16"></lv-avatar>
|
|
238
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=2" size="w-16" shape="squircle"></lv-avatar>
|
|
239
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=3" size="w-16" shape="hexagon"></lv-avatar>
|
|
240
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=5" size="w-16" ring ring-color="ring-primary"></lv-avatar>
|
|
241
|
+
<lv-avatar placeholder="JD" size="w-16"></lv-avatar>
|
|
242
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=4" size="w-16" online></lv-avatar>
|
|
243
|
+
</div></code></pre>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<!-- Reactive Example -->
|
|
249
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
250
|
+
<div class="card-body">
|
|
251
|
+
<h2 class="card-title">User Status Toggle</h2>
|
|
252
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Avatar with reactive
|
|
253
|
+
online/offline status
|
|
254
|
+
</p>
|
|
255
|
+
|
|
256
|
+
<!-- Tabs -->
|
|
257
|
+
<script>
|
|
258
|
+
window.switchReactiveSyntaxTab = (tabId) => {
|
|
259
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
260
|
+
tabs.forEach(t => {
|
|
261
|
+
const tabEl = document.getElementById(`reactive-tab-btn-${t}`);
|
|
262
|
+
const contentEl = document.getElementById(`reactive-syntax-${t}`);
|
|
263
|
+
if (t === tabId) {
|
|
264
|
+
tabEl.classList.add('syntax-tab-active');
|
|
265
|
+
contentEl.style.display = 'block';
|
|
266
|
+
} else {
|
|
267
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
268
|
+
contentEl.style.display = 'none';
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
</script>
|
|
273
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
274
|
+
<button id="reactive-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
275
|
+
onclick="switchReactiveSyntaxTab('tagged')">Tagged</button>
|
|
276
|
+
<button id="reactive-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
277
|
+
onclick="switchReactiveSyntaxTab('vdom')">vDOM</button>
|
|
278
|
+
<button id="reactive-tab-btn-object" role="tab" class="syntax-tab"
|
|
279
|
+
onclick="switchReactiveSyntaxTab('object')">Object DOM</button>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<!-- Tagged Syntax -->
|
|
283
|
+
<div id="reactive-syntax-tagged">
|
|
284
|
+
<pre><script>
|
|
285
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
286
|
+
at: document.currentScript.parentElement,
|
|
287
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
288
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
289
|
+
autoRun: true,
|
|
290
|
+
type: 'module',
|
|
291
|
+
minHeight: 120
|
|
292
|
+
});
|
|
293
|
+
</script><code contenteditable="true">await import('/components/data-display/avatar.js');
|
|
294
|
+
await import('/components/actions/button.js');
|
|
295
|
+
const { signal, tags, $ } = Lightview;
|
|
296
|
+
const { div, span, Avatar, Button } = tags;
|
|
297
|
+
|
|
298
|
+
const isOnline = signal(true);
|
|
299
|
+
|
|
300
|
+
const demo = div({ style: 'display: flex; align-items: center; gap: 1.5rem;' },
|
|
301
|
+
() => Avatar({
|
|
302
|
+
src: 'https://i.pravatar.cc/100?img=5',
|
|
303
|
+
size: 'w-20',
|
|
304
|
+
ring: true,
|
|
305
|
+
ringColor: isOnline.value ? 'ring-success' : 'ring-error',
|
|
306
|
+
online: isOnline.value,
|
|
307
|
+
offline: !isOnline.value
|
|
308
|
+
}),
|
|
309
|
+
div({ style: 'display: flex; flex-direction: column; gap: 0.5rem;' },
|
|
310
|
+
span({ style: 'font-weight: 700;' }, 'Sarah Johnson'),
|
|
311
|
+
span({ style: 'font-size: 0.875rem;' },
|
|
312
|
+
() => isOnline.value ? '🟢 Online' : '⚫ Offline'
|
|
313
|
+
),
|
|
314
|
+
Button({
|
|
315
|
+
size: 'sm',
|
|
316
|
+
onclick: () => { isOnline.value = !isOnline.value; }
|
|
317
|
+
}, () => isOnline.value ? 'Go Offline' : 'Go Online')
|
|
318
|
+
)
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
$('#example').content(demo);</code></pre>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
<!-- vDOM Syntax -->
|
|
325
|
+
<div id="reactive-syntax-vdom" style="display: none;">
|
|
326
|
+
<pre><script>
|
|
327
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
328
|
+
at: document.currentScript.parentElement,
|
|
329
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
330
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
331
|
+
type: 'module',
|
|
332
|
+
minHeight: 120
|
|
333
|
+
});
|
|
334
|
+
</script><code contenteditable="true">await import('/components/data-display/avatar.js');
|
|
335
|
+
await import('/components/actions/button.js');
|
|
336
|
+
const { signal, $, tags } = Lightview;
|
|
337
|
+
const { div, span, Avatar, Button } = tags;
|
|
338
|
+
|
|
339
|
+
const isOnline = signal(true);
|
|
340
|
+
|
|
341
|
+
const demo = {
|
|
342
|
+
tag: div,
|
|
343
|
+
attributes: { style: 'display: flex; align-items: center; gap: 1.5rem;' },
|
|
344
|
+
children: [
|
|
345
|
+
() => ({
|
|
346
|
+
tag: Avatar,
|
|
347
|
+
attributes: {
|
|
348
|
+
src: 'https://i.pravatar.cc/100?img=5',
|
|
349
|
+
size: 'w-20',
|
|
350
|
+
ring: true,
|
|
351
|
+
ringColor: isOnline.value ? 'ring-success' : 'ring-error',
|
|
352
|
+
online: isOnline.value,
|
|
353
|
+
offline: !isOnline.value
|
|
354
|
+
}
|
|
355
|
+
}),
|
|
356
|
+
{
|
|
357
|
+
tag: div,
|
|
358
|
+
attributes: { style: 'display: flex; flex-direction: column; gap: 0.5rem;' },
|
|
359
|
+
children: [
|
|
360
|
+
{ tag: span, attributes: { style: 'font-weight: 700;' }, children: ['Sarah Johnson'] },
|
|
361
|
+
{ tag: span, attributes: { style: 'font-size: 0.875rem;' }, children: [() => isOnline.value ? '🟢 Online' : '⚫ Offline'] },
|
|
362
|
+
{
|
|
363
|
+
tag: Button,
|
|
364
|
+
attributes: {
|
|
365
|
+
size: 'sm',
|
|
366
|
+
onclick: () => { isOnline.value = !isOnline.value; }
|
|
367
|
+
},
|
|
368
|
+
children: [() => isOnline.value ? 'Go Offline' : 'Go Online']
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
]
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
$('#example').content(demo);</code></pre>
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
<!-- Object DOM Syntax -->
|
|
379
|
+
<div id="reactive-syntax-object" style="display: none;">
|
|
380
|
+
<pre><script>
|
|
381
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
382
|
+
at: document.currentScript.parentElement,
|
|
383
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
384
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
385
|
+
type: 'module',
|
|
386
|
+
minHeight: 120
|
|
387
|
+
});
|
|
388
|
+
</script><code contenteditable="true">await import('/components/data-display/avatar.js');
|
|
389
|
+
await import('/components/actions/button.js');
|
|
390
|
+
const { signal, $ } = Lightview;
|
|
391
|
+
|
|
392
|
+
const isOnline = signal(true);
|
|
393
|
+
|
|
394
|
+
const demo = {
|
|
395
|
+
div: {
|
|
396
|
+
style: 'display: flex; align-items: center; gap: 1.5rem;',
|
|
397
|
+
children: [
|
|
398
|
+
() => ({
|
|
399
|
+
Avatar: {
|
|
400
|
+
src: 'https://i.pravatar.cc/100?img=5',
|
|
401
|
+
size: 'w-20',
|
|
402
|
+
ring: true,
|
|
403
|
+
ringColor: isOnline.value ? 'ring-success' : 'ring-error',
|
|
404
|
+
online: isOnline.value,
|
|
405
|
+
offline: !isOnline.value
|
|
406
|
+
}
|
|
407
|
+
}),
|
|
408
|
+
{
|
|
409
|
+
div: {
|
|
410
|
+
style: 'display: flex; flex-direction: column; gap: 0.5rem;',
|
|
411
|
+
children: [
|
|
412
|
+
{ span: { style: 'font-weight: 700;', children: ['Sarah Johnson'] } },
|
|
413
|
+
{ span: { style: 'font-size: 0.875rem;', children: [() => isOnline.value ? '🟢 Online' : '⚫ Offline'] } },
|
|
414
|
+
{
|
|
415
|
+
Button: {
|
|
416
|
+
size: 'sm',
|
|
417
|
+
onclick: () => { isOnline.value = !isOnline.value; },
|
|
418
|
+
children: [() => isOnline.value ? 'Go Offline' : 'Go Online']
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
$('#example').content(demo);</code></pre>
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
|
|
433
|
+
<!-- Props Table -->
|
|
434
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Props</h2>
|
|
435
|
+
<div style="overflow-x: auto; margin-bottom: 2rem;">
|
|
436
|
+
<table class="table table-zebra">
|
|
437
|
+
<thead>
|
|
438
|
+
<tr>
|
|
439
|
+
<th>Prop</th>
|
|
440
|
+
<th>Type</th>
|
|
441
|
+
<th>Default</th>
|
|
442
|
+
<th>Description</th>
|
|
443
|
+
</tr>
|
|
444
|
+
</thead>
|
|
445
|
+
<tbody>
|
|
446
|
+
<tr>
|
|
447
|
+
<td><code>src</code></td>
|
|
448
|
+
<td>string</td>
|
|
449
|
+
<td>-</td>
|
|
450
|
+
<td>Image source URL</td>
|
|
451
|
+
</tr>
|
|
452
|
+
<tr>
|
|
453
|
+
<td><code>alt</code></td>
|
|
454
|
+
<td>string</td>
|
|
455
|
+
<td>'Avatar'</td>
|
|
456
|
+
<td>Alt text for image</td>
|
|
457
|
+
</tr>
|
|
458
|
+
<tr>
|
|
459
|
+
<td><code>placeholder</code></td>
|
|
460
|
+
<td>string</td>
|
|
461
|
+
<td>-</td>
|
|
462
|
+
<td>Text to show when no image (e.g., initials)</td>
|
|
463
|
+
</tr>
|
|
464
|
+
<tr>
|
|
465
|
+
<td><code>size</code></td>
|
|
466
|
+
<td>string</td>
|
|
467
|
+
<td>'w-12'</td>
|
|
468
|
+
<td>Width class (w-8, w-12, w-16, w-24, etc.)</td>
|
|
469
|
+
</tr>
|
|
470
|
+
<tr>
|
|
471
|
+
<td><code>shape</code></td>
|
|
472
|
+
<td>string</td>
|
|
473
|
+
<td>'circle'</td>
|
|
474
|
+
<td>'circle' | 'rounded' | 'squircle' | 'hexagon' | 'triangle'</td>
|
|
475
|
+
</tr>
|
|
476
|
+
<tr>
|
|
477
|
+
<td><code>ring</code></td>
|
|
478
|
+
<td>boolean</td>
|
|
479
|
+
<td>false</td>
|
|
480
|
+
<td>Add ring border</td>
|
|
481
|
+
</tr>
|
|
482
|
+
<tr>
|
|
483
|
+
<td><code>ringColor</code></td>
|
|
484
|
+
<td>string</td>
|
|
485
|
+
<td>'ring-primary'</td>
|
|
486
|
+
<td>Ring color class</td>
|
|
487
|
+
</tr>
|
|
488
|
+
<tr>
|
|
489
|
+
<td><code>online</code></td>
|
|
490
|
+
<td>boolean</td>
|
|
491
|
+
<td>false</td>
|
|
492
|
+
<td>Show online indicator</td>
|
|
493
|
+
</tr>
|
|
494
|
+
<tr>
|
|
495
|
+
<td><code>offline</code></td>
|
|
496
|
+
<td>boolean</td>
|
|
497
|
+
<td>false</td>
|
|
498
|
+
<td>Show offline indicator</td>
|
|
499
|
+
</tr>
|
|
500
|
+
</tbody>
|
|
501
|
+
</table>
|
|
502
|
+
</div>
|
|
503
|
+
|
|
504
|
+
<!-- Shapes -->
|
|
505
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Shapes</h2>
|
|
506
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;">
|
|
507
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=1" size="w-16" shape="circle"></lv-avatar>
|
|
508
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=2" size="w-16" shape="rounded"></lv-avatar>
|
|
509
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=3" size="w-16" shape="squircle"></lv-avatar>
|
|
510
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=4" size="w-16" shape="hexagon"></lv-avatar>
|
|
511
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=5" size="w-16" shape="triangle"></lv-avatar>
|
|
512
|
+
</div>
|
|
513
|
+
|
|
514
|
+
<pre class="code-block" style="margin-bottom: 2rem;"><code><!-- Tagged Syntax -->
|
|
515
|
+
Avatar({ src: '...', shape: 'squircle' })
|
|
516
|
+
|
|
517
|
+
<!-- HTML Syntax -->
|
|
518
|
+
<lv-avatar src="..." shape="squircle"></lv-avatar></code></pre>
|
|
519
|
+
|
|
520
|
+
<!-- With Ring -->
|
|
521
|
+
<h2 class="text-xl font-bold" style="margin-top: 2rem; margin-bottom: 1rem;">With Ring</h2>
|
|
522
|
+
<div style="margin-bottom: 1.5rem;">
|
|
523
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=6" size="w-16" ring
|
|
524
|
+
ringColor="ring-primary"></lv-avatar>
|
|
525
|
+
</div>
|
|
526
|
+
<pre class="code-block" style="margin-bottom: 2rem;"><code><!-- Tagged Syntax -->
|
|
527
|
+
Avatar({ src: '...', ring: true, ringColor: 'ring-primary' })
|
|
528
|
+
|
|
529
|
+
<!-- HTML Syntax -->
|
|
530
|
+
<lv-avatar src="..." ring ring-color="ring-primary"></lv-avatar></code></pre>
|
|
531
|
+
|
|
532
|
+
<!-- Online/Offline Status -->
|
|
533
|
+
<h2 class="text-xl font-bold" style="margin-top: 2rem; margin-bottom: 1rem;">Online/Offline Status
|
|
534
|
+
</h2>
|
|
535
|
+
<div style="display: flex; gap: 1rem; margin-bottom: 1.5rem;">
|
|
536
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=7" size="w-16" online></lv-avatar>
|
|
537
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=8" size="w-16" offline></lv-avatar>
|
|
538
|
+
</div>
|
|
539
|
+
<pre class="code-block" style="margin-bottom: 2rem;"><code><!-- Tagged Syntax -->
|
|
540
|
+
Avatar({ src: '...', online: true })
|
|
541
|
+
|
|
542
|
+
<!-- HTML Syntax -->
|
|
543
|
+
<lv-avatar src="..." online></lv-avatar></code></pre>
|
|
544
|
+
|
|
545
|
+
<!-- Placeholder -->
|
|
546
|
+
<h2 class="text-xl font-bold" style="margin-top: 2rem; margin-bottom: 1rem;">Placeholder</h2>
|
|
547
|
+
<div style="display: flex; gap: 1rem; align-items: center; margin-bottom: 1.5rem;">
|
|
548
|
+
<lv-avatar placeholder="AI" size="w-12"
|
|
549
|
+
style="--lv-avatar-bg: oklch(var(--n)); --lv-avatar-text: oklch(var(--nc));"></lv-avatar>
|
|
550
|
+
<lv-avatar placeholder="AV" size="w-20" shape="squircle"
|
|
551
|
+
style="--lv-avatar-bg: oklch(var(--p)); --lv-avatar-text: oklch(var(--pc));"></lv-avatar>
|
|
552
|
+
<lv-avatar placeholder="LRG" size="w-32" shape="hexagon"
|
|
553
|
+
style="--lv-avatar-bg: oklch(var(--s)); --lv-avatar-text: oklch(var(--sc));"></lv-avatar>
|
|
554
|
+
</div>
|
|
555
|
+
<pre class="code-block" style="margin-bottom: 2rem;"><code><!-- Tagged Syntax -->
|
|
556
|
+
Avatar({ placeholder: 'AI', size: 'w-12' })
|
|
557
|
+
Avatar({ placeholder: 'AV', size: 'w-20', shape: 'squircle' })
|
|
558
|
+
|
|
559
|
+
<!-- HTML Syntax -->
|
|
560
|
+
<lv-avatar placeholder="LRG" size="w-32" shape="hexagon"></lv-avatar></code></pre>
|
|
561
|
+
|
|
562
|
+
<!-- Avatar Group -->
|
|
563
|
+
<h2 class="text-xl font-bold" style="margin-top: 2rem; margin-bottom: 1rem;">Avatar Group</h2>
|
|
564
|
+
<div style="margin-bottom: 1.5rem;">
|
|
565
|
+
<lv-avatar-group>
|
|
566
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=10" size="w-12"></lv-avatar>
|
|
567
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=11" size="w-12"></lv-avatar>
|
|
568
|
+
<lv-avatar src="https://i.pravatar.cc/100?img=12" size="w-12"></lv-avatar>
|
|
569
|
+
<lv-avatar placeholder="+99" size="w-12"></lv-avatar>
|
|
570
|
+
</lv-avatar-group>
|
|
571
|
+
</div>
|
|
572
|
+
<pre class="code-block" style="margin-bottom: 2rem;"><code><!-- Tagged Syntax -->
|
|
573
|
+
Avatar.Group({},
|
|
574
|
+
Avatar({ src: '...', size: 'w-12' }),
|
|
575
|
+
Avatar({ placeholder: '+99', size: 'w-12' })
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
<!-- HTML Syntax -->
|
|
579
|
+
<lv-avatar-group>
|
|
580
|
+
<lv-avatar src="..." size="w-12"></lv-avatar>
|
|
581
|
+
<lv-avatar placeholder="+99" size="w-12"></lv-avatar>
|
|
582
|
+
</lv-avatar-group></code></pre>
|
|
583
|
+
</div>
|
|
584
|
+
</div>
|
|
585
|
+
</div>
|
|
586
|
+
</div>
|