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,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Collapse Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/collapse/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Collapse Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {string} props.icon - 'arrow' | 'plus'
|
|
12
|
+
* @param {boolean} props.open - Initially open
|
|
13
|
+
* @param {boolean} props.focus - Open on focus
|
|
14
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
15
|
+
*/
|
|
16
|
+
const Collapse = (props = {}, ...children) => {
|
|
17
|
+
const { tags } = window.Lightview || {};
|
|
18
|
+
const LVX = window.LightviewX || {};
|
|
19
|
+
|
|
20
|
+
if (!tags) return null;
|
|
21
|
+
|
|
22
|
+
const { div, input, shadowDOM } = tags;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
icon = 'arrow',
|
|
26
|
+
open = false,
|
|
27
|
+
focus = false,
|
|
28
|
+
useShadow,
|
|
29
|
+
class: className = '',
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const classes = ['collapse', 'bg-base-100', 'border', 'border-base-300', 'rounded-box'];
|
|
34
|
+
if (icon === 'arrow') classes.push('collapse-arrow');
|
|
35
|
+
else if (icon === 'plus') classes.push('collapse-plus');
|
|
36
|
+
if (className) classes.push(className);
|
|
37
|
+
|
|
38
|
+
const collapseEl = div({ class: classes.join(' '), ...rest },
|
|
39
|
+
input({ type: 'checkbox', checked: open }),
|
|
40
|
+
...children
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Check if we should use shadow DOM
|
|
44
|
+
let usesShadow = false;
|
|
45
|
+
if (LVX.shouldUseShadow) {
|
|
46
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
47
|
+
} else {
|
|
48
|
+
usesShadow = useShadow === true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (usesShadow) {
|
|
52
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
53
|
+
|
|
54
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
55
|
+
|
|
56
|
+
return div({ class: 'contents' },
|
|
57
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
58
|
+
div({ 'data-theme': themeValue },
|
|
59
|
+
collapseEl
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return collapseEl;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Collapse Title
|
|
70
|
+
*/
|
|
71
|
+
Collapse.Title = (props = {}, ...children) => {
|
|
72
|
+
const { tags } = window.Lightview || {};
|
|
73
|
+
if (!tags) return null;
|
|
74
|
+
|
|
75
|
+
const { class: className = '', ...rest } = props;
|
|
76
|
+
|
|
77
|
+
return tags.div({
|
|
78
|
+
class: `collapse-title font-semibold ${className}`.trim(),
|
|
79
|
+
...rest
|
|
80
|
+
}, ...children);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Collapse Content
|
|
85
|
+
*/
|
|
86
|
+
Collapse.Content = (props = {}, ...children) => {
|
|
87
|
+
const { tags } = window.Lightview || {};
|
|
88
|
+
if (!tags) return null;
|
|
89
|
+
|
|
90
|
+
const { class: className = '', ...rest } = props;
|
|
91
|
+
|
|
92
|
+
return tags.div({
|
|
93
|
+
class: `collapse-content text-sm ${className}`.trim(),
|
|
94
|
+
...rest
|
|
95
|
+
}, ...children);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const tags = window.Lightview.tags;
|
|
99
|
+
tags.Collapse = Collapse;
|
|
100
|
+
tags['Collapse.Title'] = Collapse.Title;
|
|
101
|
+
tags['Collapse.Content'] = Collapse.Content;
|
|
102
|
+
|
|
103
|
+
export default Collapse;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Countdown Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/countdown/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Countdown Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {number|function} props.value - Countdown value (0-99)
|
|
12
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
13
|
+
*/
|
|
14
|
+
const Countdown = (props = {}, ...children) => {
|
|
15
|
+
const { tags } = window.Lightview || {};
|
|
16
|
+
const LVX = window.LightviewX || {};
|
|
17
|
+
|
|
18
|
+
if (!tags) return null;
|
|
19
|
+
|
|
20
|
+
const { span, div, shadowDOM } = tags;
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
value = 0,
|
|
24
|
+
useShadow,
|
|
25
|
+
class: className = '',
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
const getValue = () => typeof value === 'function' ? value() : value;
|
|
30
|
+
|
|
31
|
+
const countdownEl = span({
|
|
32
|
+
class: `countdown ${className}`.trim(),
|
|
33
|
+
...rest
|
|
34
|
+
},
|
|
35
|
+
span({
|
|
36
|
+
style: typeof value === 'function'
|
|
37
|
+
? () => `--value:${getValue()};`
|
|
38
|
+
: `--value:${value};`
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Check if we should use shadow DOM
|
|
43
|
+
let usesShadow = false;
|
|
44
|
+
if (LVX.shouldUseShadow) {
|
|
45
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
46
|
+
} else {
|
|
47
|
+
usesShadow = useShadow === true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (usesShadow) {
|
|
51
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
52
|
+
|
|
53
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
54
|
+
|
|
55
|
+
return div({ class: 'contents' },
|
|
56
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
57
|
+
div({ 'data-theme': themeValue },
|
|
58
|
+
countdownEl
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return countdownEl;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
window.Lightview.tags.Countdown = Countdown;
|
|
68
|
+
|
|
69
|
+
export default Countdown;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Diff Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/diff/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Diff Component - side-by-side comparison
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {string} props.aspectRatio - Aspect ratio class (e.g., 'aspect-16/9')
|
|
12
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
13
|
+
*/
|
|
14
|
+
const Diff = (props = {}, ...children) => {
|
|
15
|
+
const { tags } = window.Lightview || {};
|
|
16
|
+
const LVX = window.LightviewX || {};
|
|
17
|
+
|
|
18
|
+
if (!tags) return null;
|
|
19
|
+
|
|
20
|
+
const { div, shadowDOM } = tags;
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
aspectRatio = 'aspect-16/9',
|
|
24
|
+
useShadow,
|
|
25
|
+
class: className = '',
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
const diffEl = div({
|
|
30
|
+
class: `diff ${aspectRatio} ${className}`.trim(),
|
|
31
|
+
...rest
|
|
32
|
+
}, ...children);
|
|
33
|
+
|
|
34
|
+
// Check if we should use shadow DOM
|
|
35
|
+
let usesShadow = false;
|
|
36
|
+
if (LVX.shouldUseShadow) {
|
|
37
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
38
|
+
} else {
|
|
39
|
+
usesShadow = useShadow === true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (usesShadow) {
|
|
43
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
44
|
+
|
|
45
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
46
|
+
|
|
47
|
+
return div({ class: 'contents' },
|
|
48
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
49
|
+
div({ 'data-theme': themeValue },
|
|
50
|
+
diffEl
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return diffEl;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Diff Item 1
|
|
61
|
+
*/
|
|
62
|
+
Diff.Item1 = (props = {}, ...children) => {
|
|
63
|
+
const { tags } = window.Lightview || {};
|
|
64
|
+
if (!tags) return null;
|
|
65
|
+
|
|
66
|
+
const { src, alt = '', class: className = '', ...rest } = props;
|
|
67
|
+
|
|
68
|
+
if (src) {
|
|
69
|
+
return tags.div({ class: `diff-item-1 ${className}`.trim(), role: 'img', ...rest },
|
|
70
|
+
tags.img({ src, alt })
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return tags.div({ class: `diff-item-1 ${className}`.trim(), ...rest }, ...children);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Diff Item 2
|
|
79
|
+
*/
|
|
80
|
+
Diff.Item2 = (props = {}, ...children) => {
|
|
81
|
+
const { tags } = window.Lightview || {};
|
|
82
|
+
if (!tags) return null;
|
|
83
|
+
|
|
84
|
+
const { src, alt = '', class: className = '', ...rest } = props;
|
|
85
|
+
|
|
86
|
+
if (src) {
|
|
87
|
+
return tags.div({ class: `diff-item-2 ${className}`.trim(), role: 'img', tabindex: '0', ...rest },
|
|
88
|
+
tags.img({ src, alt })
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return tags.div({ class: `diff-item-2 ${className}`.trim(), tabindex: '0', ...rest }, ...children);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Diff Resizer
|
|
97
|
+
*/
|
|
98
|
+
Diff.Resizer = (props = {}) => {
|
|
99
|
+
const { tags } = window.Lightview || {};
|
|
100
|
+
if (!tags) return null;
|
|
101
|
+
|
|
102
|
+
return tags.div({ class: 'diff-resizer', ...props });
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const tags = window.Lightview.tags;
|
|
106
|
+
tags.Diff = Diff;
|
|
107
|
+
tags['Diff.Item1'] = Diff.Item1;
|
|
108
|
+
tags['Diff.Item2'] = Diff.Item2;
|
|
109
|
+
tags['Diff.Resizer'] = Diff.Resizer;
|
|
110
|
+
|
|
111
|
+
export default Diff;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Kbd Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/kbd/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Kbd Component - keyboard key indicator
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {string} props.size - 'xs' | 'sm' | 'md' | 'lg'
|
|
12
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
13
|
+
*/
|
|
14
|
+
const Kbd = (props = {}, ...children) => {
|
|
15
|
+
const { tags } = window.Lightview || {};
|
|
16
|
+
const LVX = window.LightviewX || {};
|
|
17
|
+
|
|
18
|
+
if (!tags) return null;
|
|
19
|
+
|
|
20
|
+
const { kbd, div, shadowDOM } = tags;
|
|
21
|
+
|
|
22
|
+
const { size, useShadow, class: className = '', ...rest } = props;
|
|
23
|
+
|
|
24
|
+
const classes = ['kbd'];
|
|
25
|
+
if (size) classes.push(`kbd-${size}`);
|
|
26
|
+
if (className) classes.push(className);
|
|
27
|
+
|
|
28
|
+
const kbdEl = kbd({ class: classes.join(' '), ...rest }, ...children);
|
|
29
|
+
|
|
30
|
+
// Check if we should use shadow DOM
|
|
31
|
+
let usesShadow = false;
|
|
32
|
+
if (LVX.shouldUseShadow) {
|
|
33
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
34
|
+
} else {
|
|
35
|
+
usesShadow = useShadow === true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (usesShadow) {
|
|
39
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
40
|
+
|
|
41
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
42
|
+
|
|
43
|
+
return div({ class: 'contents' },
|
|
44
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
45
|
+
div({ 'data-theme': themeValue },
|
|
46
|
+
kbdEl
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return kbdEl;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
window.Lightview.tags.Kbd = Kbd;
|
|
56
|
+
|
|
57
|
+
// Register as Custom Element
|
|
58
|
+
if (window.LightviewX?.createCustomElement) {
|
|
59
|
+
const KbdElement = window.LightviewX.createCustomElement(Kbd);
|
|
60
|
+
if (!customElements.get('lv-kbd')) {
|
|
61
|
+
customElements.define('lv-kbd', KbdElement);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default Kbd;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Loading Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/loading/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Loading Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {string} props.type - 'spinner' | 'dots' | 'ring' | 'ball' | 'bars' | 'infinity'
|
|
12
|
+
* @param {string} props.size - 'xs' | 'sm' | 'md' | 'lg'
|
|
13
|
+
* @param {string} props.color - Color class (e.g., 'text-primary')
|
|
14
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
15
|
+
*/
|
|
16
|
+
const Loading = (props = {}) => {
|
|
17
|
+
const { tags } = window.Lightview || {};
|
|
18
|
+
const LVX = window.LightviewX || {};
|
|
19
|
+
|
|
20
|
+
if (!tags) return null;
|
|
21
|
+
|
|
22
|
+
const { span, div, shadowDOM } = tags;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
type = 'spinner',
|
|
26
|
+
size,
|
|
27
|
+
color,
|
|
28
|
+
useShadow,
|
|
29
|
+
class: className = '',
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const classes = ['loading', `loading-${type}`];
|
|
34
|
+
if (size) classes.push(`loading-${size}`);
|
|
35
|
+
if (color) classes.push(color);
|
|
36
|
+
if (className) classes.push(className);
|
|
37
|
+
|
|
38
|
+
const loadingEl = span({ class: classes.join(' '), ...rest });
|
|
39
|
+
|
|
40
|
+
// Check if we should use shadow DOM
|
|
41
|
+
let usesShadow = false;
|
|
42
|
+
if (LVX.shouldUseShadow) {
|
|
43
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
44
|
+
} else {
|
|
45
|
+
usesShadow = useShadow === true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (usesShadow) {
|
|
49
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
50
|
+
|
|
51
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
52
|
+
|
|
53
|
+
return span({ style: 'margin-right: 0.5rem' },
|
|
54
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
55
|
+
div({ 'data-theme': themeValue, style: 'display: inline-block' },
|
|
56
|
+
loadingEl
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return loadingEl;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
window.Lightview.tags.Loading = Loading;
|
|
66
|
+
|
|
67
|
+
// Register as Custom Element
|
|
68
|
+
if (window.LightviewX?.createCustomElement) {
|
|
69
|
+
const LoadingElement = window.LightviewX.createCustomElement(Loading);
|
|
70
|
+
if (!customElements.get('lv-loading')) {
|
|
71
|
+
customElements.define('lv-loading', LoadingElement);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default Loading;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Progress Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/progress/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Progress Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {number|function} props.value - Progress value (0-100)
|
|
12
|
+
* @param {number} props.max - Maximum value (default: 100)
|
|
13
|
+
* @param {string} props.color - 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
|
|
14
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
15
|
+
*/
|
|
16
|
+
const Progress = (props = {}, ...children) => {
|
|
17
|
+
const { tags } = window.Lightview || {};
|
|
18
|
+
const LVX = window.LightviewX || {};
|
|
19
|
+
|
|
20
|
+
if (!tags) return null;
|
|
21
|
+
|
|
22
|
+
const { progress, div, shadowDOM } = tags;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
value = 0,
|
|
26
|
+
max = 100,
|
|
27
|
+
color,
|
|
28
|
+
useShadow,
|
|
29
|
+
class: className = '',
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const classes = ['progress'];
|
|
34
|
+
if (color) classes.push(`progress-${color}`);
|
|
35
|
+
if (className) classes.push(className);
|
|
36
|
+
|
|
37
|
+
const progressEl = progress({
|
|
38
|
+
class: classes.join(' '),
|
|
39
|
+
value: typeof value === 'function' ? value : value,
|
|
40
|
+
max,
|
|
41
|
+
...rest
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Check if we should use shadow DOM
|
|
45
|
+
let usesShadow = false;
|
|
46
|
+
if (LVX.shouldUseShadow) {
|
|
47
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
48
|
+
} else {
|
|
49
|
+
usesShadow = useShadow === true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (usesShadow) {
|
|
53
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
54
|
+
|
|
55
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
56
|
+
|
|
57
|
+
return div({ class: 'contents' },
|
|
58
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
59
|
+
div({ 'data-theme': themeValue },
|
|
60
|
+
progressEl
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return progressEl;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
window.Lightview.tags.Progress = Progress;
|
|
70
|
+
|
|
71
|
+
// Register as Custom Element
|
|
72
|
+
if (window.LightviewX?.createCustomElement) {
|
|
73
|
+
const ProgressElement = window.LightviewX.createCustomElement(Progress);
|
|
74
|
+
if (!customElements.get('lv-progress')) {
|
|
75
|
+
customElements.define('lv-progress', ProgressElement);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default Progress;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Radial Progress Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/radial-progress/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Radial Progress Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {number|function} props.value - Progress value (0-100)
|
|
12
|
+
* @param {string} props.size - Size in CSS units (e.g., '4rem')
|
|
13
|
+
* @param {string} props.thickness - Border thickness (e.g., '2px')
|
|
14
|
+
* @param {string} props.color - Color class (e.g., 'text-primary')
|
|
15
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
16
|
+
*/
|
|
17
|
+
const RadialProgress = (props = {}, ...children) => {
|
|
18
|
+
const { tags } = window.Lightview || {};
|
|
19
|
+
const LVX = window.LightviewX || {};
|
|
20
|
+
|
|
21
|
+
if (!tags) return null;
|
|
22
|
+
|
|
23
|
+
const { div, span, shadowDOM } = tags;
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
value = 0,
|
|
27
|
+
size = '4rem',
|
|
28
|
+
thickness = '4px',
|
|
29
|
+
color,
|
|
30
|
+
useShadow,
|
|
31
|
+
class: className = '',
|
|
32
|
+
...rest
|
|
33
|
+
} = props;
|
|
34
|
+
|
|
35
|
+
const classes = ['radial-progress'];
|
|
36
|
+
if (color) classes.push(color);
|
|
37
|
+
if (className) classes.push(className);
|
|
38
|
+
|
|
39
|
+
const getValue = () => typeof value === 'function' ? value() : value;
|
|
40
|
+
|
|
41
|
+
const radialEl = div({
|
|
42
|
+
class: classes.join(' '),
|
|
43
|
+
style: typeof value === 'function'
|
|
44
|
+
? () => `--value:${getValue()}; --size:${size}; --thickness:${thickness};`
|
|
45
|
+
: `--value:${value}; --size:${size}; --thickness:${thickness};`,
|
|
46
|
+
role: 'progressbar',
|
|
47
|
+
'aria-valuenow': typeof value === 'function' ? value : value,
|
|
48
|
+
'aria-valuemin': '0',
|
|
49
|
+
'aria-valuemax': '100',
|
|
50
|
+
...rest
|
|
51
|
+
}, children.length ? children : [() => getValue() + '%']);
|
|
52
|
+
|
|
53
|
+
// Check if we should use shadow DOM
|
|
54
|
+
let usesShadow = false;
|
|
55
|
+
if (LVX.shouldUseShadow) {
|
|
56
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
57
|
+
} else {
|
|
58
|
+
usesShadow = useShadow === true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (usesShadow) {
|
|
62
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
63
|
+
|
|
64
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
65
|
+
|
|
66
|
+
return div({ class: 'contents', style: 'display: inline-block' },
|
|
67
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
68
|
+
div({ 'data-theme': themeValue },
|
|
69
|
+
radialEl
|
|
70
|
+
)
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return radialEl;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
window.Lightview.tags.RadialProgress = RadialProgress;
|
|
79
|
+
|
|
80
|
+
// Register as Custom Element
|
|
81
|
+
if (window.LightviewX?.createCustomElement) {
|
|
82
|
+
const RadialProgressElement = window.LightviewX.createCustomElement(RadialProgress);
|
|
83
|
+
if (!customElements.get('lv-radial-progress')) {
|
|
84
|
+
customElements.define('lv-radial-progress', RadialProgressElement);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default RadialProgress;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Skeleton Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/skeleton/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Skeleton Component - loading placeholder
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {string} props.shape - 'circle' | 'rect'
|
|
12
|
+
* @param {string} props.width - Width class or value
|
|
13
|
+
* @param {string} props.height - Height class or value
|
|
14
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
15
|
+
*/
|
|
16
|
+
const Skeleton = (props = {}, ...children) => {
|
|
17
|
+
const { tags } = window.Lightview || {};
|
|
18
|
+
const LVX = window.LightviewX || {};
|
|
19
|
+
|
|
20
|
+
if (!tags) return null;
|
|
21
|
+
|
|
22
|
+
const { div, shadowDOM } = tags;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
shape,
|
|
26
|
+
width = 'w-full',
|
|
27
|
+
height = 'h-4',
|
|
28
|
+
useShadow,
|
|
29
|
+
class: className = '',
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const classes = ['skeleton', width, height];
|
|
34
|
+
if (shape === 'circle') classes.push('rounded-full');
|
|
35
|
+
if (className) classes.push(className);
|
|
36
|
+
|
|
37
|
+
const skeletonEl = div({ class: classes.join(' '), ...rest }, ...children);
|
|
38
|
+
|
|
39
|
+
// Check if we should use shadow DOM
|
|
40
|
+
let usesShadow = false;
|
|
41
|
+
if (LVX.shouldUseShadow) {
|
|
42
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
43
|
+
} else {
|
|
44
|
+
usesShadow = useShadow === true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (usesShadow) {
|
|
48
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
49
|
+
|
|
50
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
51
|
+
|
|
52
|
+
return div({ class: 'contents' },
|
|
53
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
54
|
+
div({ 'data-theme': themeValue },
|
|
55
|
+
skeletonEl
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return skeletonEl;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
window.Lightview.tags.Skeleton = Skeleton;
|
|
65
|
+
|
|
66
|
+
export default Skeleton;
|