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,423 @@
|
|
|
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: 'Tooltip' }
|
|
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">Tooltip</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
|
+
Tooltip displays informative text when users hover, focus, or tap an element.
|
|
61
|
+
Supports multiple positions and colors.
|
|
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;">Tooltips with different
|
|
69
|
+
positions</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: 100,
|
|
107
|
+
autoRun: true,
|
|
108
|
+
html: '<div id="demo" class="p-8"></div>'
|
|
109
|
+
});
|
|
110
|
+
</script><code contenteditable="true">await import('/components/data-display/tooltip.js');
|
|
111
|
+
await import('/components/actions/button.js');
|
|
112
|
+
|
|
113
|
+
const { tags, $ } = Lightview;
|
|
114
|
+
const { div, Tooltip, Button } = tags;
|
|
115
|
+
|
|
116
|
+
const tooltips = div({ style: 'display: flex; flex-wrap: wrap; gap: 1rem' },
|
|
117
|
+
Tooltip({ tip: 'Tooltip on top', position: 'top' },
|
|
118
|
+
Button({}, 'Top')
|
|
119
|
+
),
|
|
120
|
+
Tooltip({ tip: 'Tooltip on bottom', position: 'bottom' },
|
|
121
|
+
Button({}, 'Bottom')
|
|
122
|
+
),
|
|
123
|
+
Tooltip({ tip: 'Tooltip on left', position: 'left' },
|
|
124
|
+
Button({}, 'Left')
|
|
125
|
+
),
|
|
126
|
+
Tooltip({ tip: 'Tooltip on right', position: 'right' },
|
|
127
|
+
Button({}, 'Right')
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
$('#demo').content(tooltips);</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: 100,
|
|
143
|
+
html: '<div id="demo" class="p-8"></div>'
|
|
144
|
+
});
|
|
145
|
+
</script><code contenteditable="true">await import('/components/data-display/tooltip.js');
|
|
146
|
+
await import('/components/actions/button.js');
|
|
147
|
+
const { $, tags } = Lightview;
|
|
148
|
+
const { Tooltip, Button, div } = tags;
|
|
149
|
+
|
|
150
|
+
const tooltips = {
|
|
151
|
+
tag: div,
|
|
152
|
+
attributes: { style: 'display: flex; flex-wrap: wrap; gap: 1rem' },
|
|
153
|
+
children: [
|
|
154
|
+
{
|
|
155
|
+
tag: Tooltip,
|
|
156
|
+
attributes: { tip: 'Tooltip on top', position: 'top' },
|
|
157
|
+
children: [{ tag: Button, children: ['Top'] }]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
tag: Tooltip,
|
|
161
|
+
attributes: { tip: 'Tooltip on bottom', position: 'bottom' },
|
|
162
|
+
children: [{ tag: Button, children: ['Bottom'] }]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
tag: Tooltip,
|
|
166
|
+
attributes: { tip: 'Tooltip on left', position: 'left' },
|
|
167
|
+
children: [{ tag: Button, children: ['Left'] }]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
tag: Tooltip,
|
|
171
|
+
attributes: { tip: 'Tooltip on right', position: 'right' },
|
|
172
|
+
children: [{ tag: Button, children: ['Right'] }]
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
$('#demo').content(tooltips);</code></pre>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<!-- Object DOM Syntax -->
|
|
181
|
+
<div id="syntax-object" style="display: none;">
|
|
182
|
+
<pre><script>
|
|
183
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
184
|
+
at: document.currentScript.parentElement,
|
|
185
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
186
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
187
|
+
type: 'module',
|
|
188
|
+
minHeight: 100,
|
|
189
|
+
html: '<div id="demo" class="p-8"></div>'
|
|
190
|
+
});
|
|
191
|
+
</script><code contenteditable="true">await import('/components/data-display/tooltip.js');
|
|
192
|
+
await import('/components/actions/button.js');
|
|
193
|
+
const { $ } = Lightview;
|
|
194
|
+
|
|
195
|
+
const tooltips = {
|
|
196
|
+
div: {
|
|
197
|
+
style: 'display: flex; flex-wrap: wrap; gap: 1rem',
|
|
198
|
+
children: [
|
|
199
|
+
{ Tooltip: { tip: 'Tooltip on top', position: 'top', children: [{ Button: { children: ['Top'] } }] } },
|
|
200
|
+
{ Tooltip: { tip: 'Tooltip on bottom', position: 'bottom', children: [{ Button: { children: ['Bottom'] } }] } },
|
|
201
|
+
{ Tooltip: { tip: 'Tooltip on left', position: 'left', children: [{ Button: { children: ['Left'] } }] } },
|
|
202
|
+
{ Tooltip: { tip: 'Tooltip on right', position: 'right', children: [{ Button: { children: ['Right'] } }] } }
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
$('#demo').content(tooltips);</code></pre>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<!-- Reactive Example with Examplify -->
|
|
213
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
214
|
+
<div class="card-body">
|
|
215
|
+
<h2 class="card-title">Colored Tooltips</h2>
|
|
216
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Tooltips with semantic colors
|
|
217
|
+
</p>
|
|
218
|
+
|
|
219
|
+
<!-- Tabs -->
|
|
220
|
+
<script>
|
|
221
|
+
window.switchReactiveSyntaxTab = (tabId) => {
|
|
222
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
223
|
+
tabs.forEach(t => {
|
|
224
|
+
const tabEl = document.getElementById(`reactive-tab-btn-${t}`);
|
|
225
|
+
const contentEl = document.getElementById(`reactive-syntax-${t}`);
|
|
226
|
+
if (t === tabId) {
|
|
227
|
+
tabEl.classList.add('syntax-tab-active');
|
|
228
|
+
contentEl.style.display = 'block';
|
|
229
|
+
} else {
|
|
230
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
231
|
+
contentEl.style.display = 'none';
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
</script>
|
|
236
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
237
|
+
<button id="reactive-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
238
|
+
onclick="switchReactiveSyntaxTab('tagged')">Tagged</button>
|
|
239
|
+
<button id="reactive-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
240
|
+
onclick="switchReactiveSyntaxTab('vdom')">vDOM</button>
|
|
241
|
+
<button id="reactive-tab-btn-object" role="tab" class="syntax-tab"
|
|
242
|
+
onclick="switchReactiveSyntaxTab('object')">Object DOM</button>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<!-- Tagged Syntax -->
|
|
246
|
+
<div id="reactive-syntax-tagged">
|
|
247
|
+
<pre><script>
|
|
248
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
249
|
+
at: document.currentScript.parentElement,
|
|
250
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
251
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
252
|
+
type: 'module',
|
|
253
|
+
minHeight: 100,
|
|
254
|
+
html: '<div id="demo" class="p-8"></div>'
|
|
255
|
+
});
|
|
256
|
+
</script><code contenteditable="true">await import('/components/data-display/tooltip.js');
|
|
257
|
+
await import('/components/actions/button.js');
|
|
258
|
+
|
|
259
|
+
const { tags, $ } = Lightview;
|
|
260
|
+
const { div, Tooltip, Button } = tags;
|
|
261
|
+
|
|
262
|
+
const colors = ['primary', 'secondary', 'accent', 'info', 'success', 'warning', 'error'];
|
|
263
|
+
|
|
264
|
+
const tooltips = div({ style: 'display: flex; flex-wrap: wrap; gap: 1rem' },
|
|
265
|
+
...colors.map(color =>
|
|
266
|
+
Tooltip({ tip: `${color.charAt(0).toUpperCase() + color.slice(1)} tooltip`, color },
|
|
267
|
+
Button({ color, size: 'sm' }, color)
|
|
268
|
+
)
|
|
269
|
+
)
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
$('#demo').content(tooltips);</code></pre>
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
<!-- vDOM Syntax -->
|
|
276
|
+
<div id="reactive-syntax-vdom" style="display: none;">
|
|
277
|
+
<pre><script>
|
|
278
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
279
|
+
at: document.currentScript.parentElement,
|
|
280
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
281
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
282
|
+
type: 'module',
|
|
283
|
+
minHeight: 100,
|
|
284
|
+
html: '<div id="demo" class="p-8"></div>'
|
|
285
|
+
});
|
|
286
|
+
</script><code contenteditable="true">await import('/components/data-display/tooltip.js');
|
|
287
|
+
await import('/components/actions/button.js');
|
|
288
|
+
const { $, tags } = Lightview;
|
|
289
|
+
const { Tooltip, Button, div } = tags;
|
|
290
|
+
|
|
291
|
+
const colors = ['primary', 'secondary', 'accent', 'info', 'success', 'warning', 'error'];
|
|
292
|
+
|
|
293
|
+
const tooltips = {
|
|
294
|
+
tag: div,
|
|
295
|
+
attributes: { style: 'display: flex; flex-wrap: wrap; gap: 1rem' },
|
|
296
|
+
children: colors.map(color => ({
|
|
297
|
+
tag: Tooltip,
|
|
298
|
+
attributes: { tip: `${color.charAt(0).toUpperCase() + color.slice(1)} tooltip`, color },
|
|
299
|
+
children: [{ tag: Button, attributes: { color, size: 'sm' }, children: [color] }]
|
|
300
|
+
}))
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
$('#demo').content(tooltips);</code></pre>
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
<!-- Object DOM Syntax -->
|
|
307
|
+
<div id="reactive-syntax-object" style="display: none;">
|
|
308
|
+
<pre><script>
|
|
309
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
310
|
+
at: document.currentScript.parentElement,
|
|
311
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
312
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
313
|
+
type: 'module',
|
|
314
|
+
minHeight: 100,
|
|
315
|
+
html: '<div id="demo" class="p-8"></div>'
|
|
316
|
+
});
|
|
317
|
+
</script><code contenteditable="true">await import('/components/data-display/tooltip.js');
|
|
318
|
+
await import('/components/actions/button.js');
|
|
319
|
+
const { $ } = Lightview;
|
|
320
|
+
|
|
321
|
+
const colors = ['primary', 'secondary', 'accent', 'info', 'success', 'warning', 'error'];
|
|
322
|
+
|
|
323
|
+
const tooltips = {
|
|
324
|
+
div: {
|
|
325
|
+
style: 'display: flex; flex-wrap: wrap; gap: 1rem',
|
|
326
|
+
children: colors.map(color => ({
|
|
327
|
+
Tooltip: {
|
|
328
|
+
tip: `${color.charAt(0).toUpperCase() + color.slice(1)} tooltip`,
|
|
329
|
+
color,
|
|
330
|
+
children: [
|
|
331
|
+
{ Button: { color, size: 'sm', children: [color] } }
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
}))
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
$('#demo').content(tooltips);</code></pre>
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
<!-- Props Table -->
|
|
344
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Props</h2>
|
|
345
|
+
<div style="overflow-x: auto; margin-bottom: 2rem;">
|
|
346
|
+
<table class="table table-zebra">
|
|
347
|
+
<thead>
|
|
348
|
+
<tr>
|
|
349
|
+
<th>Prop</th>
|
|
350
|
+
<th>Type</th>
|
|
351
|
+
<th>Default</th>
|
|
352
|
+
<th>Description</th>
|
|
353
|
+
</tr>
|
|
354
|
+
</thead>
|
|
355
|
+
<tbody>
|
|
356
|
+
<tr>
|
|
357
|
+
<td><code>tip</code></td>
|
|
358
|
+
<td>string</td>
|
|
359
|
+
<td>-</td>
|
|
360
|
+
<td>Tooltip text content</td>
|
|
361
|
+
</tr>
|
|
362
|
+
<tr>
|
|
363
|
+
<td><code>position</code></td>
|
|
364
|
+
<td>string</td>
|
|
365
|
+
<td>'top'</td>
|
|
366
|
+
<td>'top' | 'bottom' | 'left' | 'right'</td>
|
|
367
|
+
</tr>
|
|
368
|
+
<tr>
|
|
369
|
+
<td><code>color</code></td>
|
|
370
|
+
<td>string</td>
|
|
371
|
+
<td>-</td>
|
|
372
|
+
<td>'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
|
|
373
|
+
</td>
|
|
374
|
+
</tr>
|
|
375
|
+
<tr>
|
|
376
|
+
<td><code>open</code></td>
|
|
377
|
+
<td>boolean</td>
|
|
378
|
+
<td>false</td>
|
|
379
|
+
<td>Force tooltip to stay open</td>
|
|
380
|
+
</tr>
|
|
381
|
+
</tbody>
|
|
382
|
+
</table>
|
|
383
|
+
</div>
|
|
384
|
+
|
|
385
|
+
<!-- Positions -->
|
|
386
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Positions</h2>
|
|
387
|
+
<div style="display: flex; flex-wrap: wrap; gap: 1rem; padding: 2rem; margin-bottom: 2rem;">
|
|
388
|
+
<div class="tooltip tooltip-top" data-tip="Top"><button class="btn">Top</button></div>
|
|
389
|
+
<div class="tooltip tooltip-bottom" data-tip="Bottom"><button class="btn">Bottom</button></div>
|
|
390
|
+
<div class="tooltip tooltip-left" data-tip="Left"><button class="btn">Left</button></div>
|
|
391
|
+
<div class="tooltip tooltip-right" data-tip="Right"><button class="btn">Right</button></div>
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<!-- Colors -->
|
|
395
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Colors</h2>
|
|
396
|
+
<div class="example-flex" style="margin-bottom: 2rem;">
|
|
397
|
+
<div class="tooltip tooltip-primary" data-tip="Primary"><button class="btn">Primary</button>
|
|
398
|
+
</div>
|
|
399
|
+
<div class="tooltip tooltip-secondary" data-tip="Secondary"><button
|
|
400
|
+
class="btn">Secondary</button></div>
|
|
401
|
+
<div class="tooltip tooltip-accent" data-tip="Accent"><button class="btn">Accent</button></div>
|
|
402
|
+
<div class="tooltip tooltip-info" data-tip="Info"><button class="btn">Info</button></div>
|
|
403
|
+
<div class="tooltip tooltip-success" data-tip="Success"><button class="btn">Success</button>
|
|
404
|
+
</div>
|
|
405
|
+
<div class="tooltip tooltip-warning" data-tip="Warning"><button class="btn">Warning</button>
|
|
406
|
+
</div>
|
|
407
|
+
<div class="tooltip tooltip-error" data-tip="Error"><button class="btn">Error</button></div>
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
<!-- Force Open -->
|
|
411
|
+
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Force Open</h2>
|
|
412
|
+
<div style="margin-bottom: 2rem;">
|
|
413
|
+
<div class="tooltip tooltip-open tooltip-primary" data-tip="Always visible">
|
|
414
|
+
<button class="btn btn-primary">Always Open</button>
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
</div>
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
</div>
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
<!DOCTYPE html>
|
|
10
|
+
<html>
|
|
11
|
+
|
|
12
|
+
<head>
|
|
13
|
+
<title>My First Lightview App</title>
|
|
14
|
+
<script src="lightview.js"></script>
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<div id="app"></div>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
// Get the tools we need
|
|
22
|
+
const { signal, tags } = Lightview;
|
|
23
|
+
const { div, h1, p, button } = tags;
|
|
24
|
+
|
|
25
|
+
// Create reactive state
|
|
26
|
+
const count = signal(0);
|
|
27
|
+
|
|
28
|
+
// Build the UI
|
|
29
|
+
const app = div(
|
|
30
|
+
h1('Hello Lightview! 👋'),
|
|
31
|
+
p(() => `You clicked ${count.value} times`),
|
|
32
|
+
button({ onclick: () => count.value++ }, 'Click me!')
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Mount to the DOM
|
|
36
|
+
document.getElementById('app').appendChild(app.domEl);
|
|
37
|
+
</script>
|
|
38
|
+
</body>
|
|
39
|
+
|
|
40
|
+
</html>
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
<div class="section">
|
|
10
|
+
<div class="section-content">
|
|
11
|
+
<h1>Examples</h1>
|
|
12
|
+
<p class="text-secondary" style="font-size: 1.125rem;">
|
|
13
|
+
Learn by example. Click any card to open it in the playground.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<div class="example-grid" style="margin-top: 2rem;">
|
|
17
|
+
<a href="/docs/playground" class="example-card"
|
|
18
|
+
onclick="localStorage.setItem('playground-example', 'counter')">
|
|
19
|
+
<div class="example-card-preview" style="background: linear-gradient(135deg, #e0e7ff, #c7d2fe);">
|
|
20
|
+
<span style="font-size: 3rem;">🎯</span>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="example-card-content">
|
|
23
|
+
<h3 class="example-card-title">Counter</h3>
|
|
24
|
+
<p class="example-card-description">The classic. Learn signals with increment/decrement buttons.</p>
|
|
25
|
+
</div>
|
|
26
|
+
</a>
|
|
27
|
+
|
|
28
|
+
<a href="/docs/playground" class="example-card"
|
|
29
|
+
onclick="localStorage.setItem('playground-example', 'todo')">
|
|
30
|
+
<div class="example-card-preview" style="background: linear-gradient(135deg, #d1fae5, #a7f3d0);">
|
|
31
|
+
<span style="font-size: 3rem;">✅</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="example-card-content">
|
|
34
|
+
<h3 class="example-card-title">Todo List</h3>
|
|
35
|
+
<p class="example-card-description">State management with arrays. Add, toggle, and delete tasks.</p>
|
|
36
|
+
</div>
|
|
37
|
+
</a>
|
|
38
|
+
|
|
39
|
+
<a href="/docs/playground" class="example-card"
|
|
40
|
+
onclick="localStorage.setItem('playground-example', 'form')">
|
|
41
|
+
<div class="example-card-preview" style="background: linear-gradient(135deg, #fef3c7, #fde68a);">
|
|
42
|
+
<span style="font-size: 3rem;">📝</span>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="example-card-content">
|
|
45
|
+
<h3 class="example-card-title">Form Validation</h3>
|
|
46
|
+
<p class="example-card-description">Computed values for real-time validation feedback.</p>
|
|
47
|
+
</div>
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a href="/docs/playground" class="example-card"
|
|
51
|
+
onclick="localStorage.setItem('playground-example', 'fetch')">
|
|
52
|
+
<div class="example-card-preview" style="background: linear-gradient(135deg, #dbeafe, #bfdbfe);">
|
|
53
|
+
<span style="font-size: 3rem;">👥</span>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="example-card-content">
|
|
56
|
+
<h3 class="example-card-title">Fetch Data</h3>
|
|
57
|
+
<p class="example-card-description">Async data loading with loading states and error handling.</p>
|
|
58
|
+
</div>
|
|
59
|
+
</a>
|
|
60
|
+
|
|
61
|
+
<a href="/docs/playground" class="example-card"
|
|
62
|
+
onclick="localStorage.setItem('playground-example', 'tabs')">
|
|
63
|
+
<div class="example-card-preview" style="background: linear-gradient(135deg, #f3e8ff, #e9d5ff);">
|
|
64
|
+
<span style="font-size: 3rem;">📑</span>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="example-card-content">
|
|
67
|
+
<h3 class="example-card-title">Tabs</h3>
|
|
68
|
+
<p class="example-card-description">Tab navigation pattern with reactive content switching.</p>
|
|
69
|
+
</div>
|
|
70
|
+
</a>
|
|
71
|
+
|
|
72
|
+
<a href="/docs/playground" class="example-card"
|
|
73
|
+
onclick="localStorage.setItem('playground-example', 'theme')">
|
|
74
|
+
<div class="example-card-preview" style="background: linear-gradient(135deg, #1e293b, #334155);">
|
|
75
|
+
<span style="font-size: 3rem;">🌙</span>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="example-card-content">
|
|
78
|
+
<h3 class="example-card-title">Theme Toggle</h3>
|
|
79
|
+
<p class="example-card-description">Dark/light mode with effects for side effects.</p>
|
|
80
|
+
</div>
|
|
81
|
+
</a>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div
|
|
85
|
+
style="margin-top: 3rem; padding: 2rem; background: var(--site-bg-alt); border-radius: var(--site-radius-lg); text-align: center;">
|
|
86
|
+
<h3 style="margin: 0 0 0.5rem;">Want to experiment?</h3>
|
|
87
|
+
<p style="color: var(--site-text-secondary); margin: 0 0 1rem;">
|
|
88
|
+
Open the playground and write your own code.
|
|
89
|
+
</p>
|
|
90
|
+
<a href="/docs/playground" class="btn btn-primary">Open Playground</a>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|