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,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Stat Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/stat/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Stats Container
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {boolean} props.vertical - Vertical layout
|
|
12
|
+
* @param {boolean} props.shadow - Add shadow
|
|
13
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
14
|
+
*/
|
|
15
|
+
const Stats = (props = {}, ...children) => {
|
|
16
|
+
const { tags } = window.Lightview || {};
|
|
17
|
+
const LVX = window.LightviewX || {};
|
|
18
|
+
|
|
19
|
+
if (!tags) return null;
|
|
20
|
+
|
|
21
|
+
const { div, shadowDOM } = tags;
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
vertical = false,
|
|
25
|
+
shadow = false,
|
|
26
|
+
useShadow,
|
|
27
|
+
class: className = '',
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
const classes = ['stats'];
|
|
32
|
+
if (vertical) classes.push('stats-vertical');
|
|
33
|
+
if (shadow) classes.push('shadow');
|
|
34
|
+
if (className) classes.push(className);
|
|
35
|
+
|
|
36
|
+
const statsEl = div({ class: classes.join(' '), ...rest }, ...children);
|
|
37
|
+
|
|
38
|
+
// Check if we should use shadow DOM
|
|
39
|
+
let usesShadow = false;
|
|
40
|
+
if (LVX.shouldUseShadow) {
|
|
41
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
42
|
+
} else {
|
|
43
|
+
usesShadow = useShadow === true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (usesShadow) {
|
|
47
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
48
|
+
|
|
49
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
50
|
+
|
|
51
|
+
return div({ class: 'contents' },
|
|
52
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
53
|
+
div({ 'data-theme': themeValue },
|
|
54
|
+
statsEl
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return statsEl;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Stat Item
|
|
65
|
+
*/
|
|
66
|
+
Stats.Stat = (props = {}, ...children) => {
|
|
67
|
+
const { tags } = window.Lightview || {};
|
|
68
|
+
if (!tags) return null;
|
|
69
|
+
|
|
70
|
+
const { class: className = '', ...rest } = props;
|
|
71
|
+
|
|
72
|
+
return tags.div({ class: `stat ${className}`.trim(), ...rest }, ...children);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Stat Figure (icon/image container)
|
|
77
|
+
*/
|
|
78
|
+
Stats.Figure = (props = {}, ...children) => {
|
|
79
|
+
const { tags } = window.Lightview || {};
|
|
80
|
+
if (!tags) return null;
|
|
81
|
+
|
|
82
|
+
const { class: className = '', ...rest } = props;
|
|
83
|
+
|
|
84
|
+
return tags.div({
|
|
85
|
+
class: `stat-figure ${className}`.trim(),
|
|
86
|
+
...rest
|
|
87
|
+
}, ...children);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Stat Title
|
|
92
|
+
*/
|
|
93
|
+
Stats.Title = (props = {}, ...children) => {
|
|
94
|
+
const { tags } = window.Lightview || {};
|
|
95
|
+
if (!tags) return null;
|
|
96
|
+
|
|
97
|
+
const { class: className = '', ...rest } = props;
|
|
98
|
+
|
|
99
|
+
return tags.div({
|
|
100
|
+
class: `stat-title ${className}`.trim(),
|
|
101
|
+
...rest
|
|
102
|
+
}, ...children);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Stat Value
|
|
107
|
+
*/
|
|
108
|
+
Stats.Value = (props = {}, ...children) => {
|
|
109
|
+
const { tags } = window.Lightview || {};
|
|
110
|
+
if (!tags) return null;
|
|
111
|
+
|
|
112
|
+
const { class: className = '', ...rest } = props;
|
|
113
|
+
|
|
114
|
+
return tags.div({
|
|
115
|
+
class: `stat-value ${className}`.trim(),
|
|
116
|
+
...rest
|
|
117
|
+
}, ...children);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Stat Desc
|
|
122
|
+
*/
|
|
123
|
+
Stats.Desc = (props = {}, ...children) => {
|
|
124
|
+
const { tags } = window.Lightview || {};
|
|
125
|
+
if (!tags) return null;
|
|
126
|
+
|
|
127
|
+
const { class: className = '', ...rest } = props;
|
|
128
|
+
|
|
129
|
+
return tags.div({
|
|
130
|
+
class: `stat-desc ${className}`.trim(),
|
|
131
|
+
...rest
|
|
132
|
+
}, ...children);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Stat Actions
|
|
137
|
+
*/
|
|
138
|
+
Stats.Actions = (props = {}, ...children) => {
|
|
139
|
+
const { tags } = window.Lightview || {};
|
|
140
|
+
if (!tags) return null;
|
|
141
|
+
|
|
142
|
+
const { class: className = '', ...rest } = props;
|
|
143
|
+
|
|
144
|
+
return tags.div({
|
|
145
|
+
class: `stat-actions ${className}`.trim(),
|
|
146
|
+
...rest
|
|
147
|
+
}, ...children);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const tags = window.Lightview.tags;
|
|
151
|
+
tags.Stats = Stats;
|
|
152
|
+
tags['Stats.Stat'] = Stats.Stat;
|
|
153
|
+
tags['Stats.Figure'] = Stats.Figure;
|
|
154
|
+
tags['Stats.Title'] = Stats.Title;
|
|
155
|
+
tags['Stats.Value'] = Stats.Value;
|
|
156
|
+
tags['Stats.Desc'] = Stats.Desc;
|
|
157
|
+
tags['Stats.Actions'] = Stats.Actions;
|
|
158
|
+
|
|
159
|
+
export default Stats;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Table Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/table/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Table Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {boolean} props.zebra - Zebra striping
|
|
12
|
+
* @param {boolean} props.pinRows - Pin rows on scroll
|
|
13
|
+
* @param {boolean} props.pinCols - Pin columns on scroll
|
|
14
|
+
* @param {string} props.size - 'xs' | 'sm' | 'md' | 'lg'
|
|
15
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
16
|
+
*/
|
|
17
|
+
const Table = (props = {}, ...children) => {
|
|
18
|
+
const { tags } = window.Lightview || {};
|
|
19
|
+
const LVX = window.LightviewX || {};
|
|
20
|
+
|
|
21
|
+
if (!tags) return null;
|
|
22
|
+
|
|
23
|
+
const { table, div, shadowDOM } = tags;
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
zebra = false,
|
|
27
|
+
pinRows = false,
|
|
28
|
+
pinCols = false,
|
|
29
|
+
size,
|
|
30
|
+
useShadow,
|
|
31
|
+
class: className = '',
|
|
32
|
+
...rest
|
|
33
|
+
} = props;
|
|
34
|
+
|
|
35
|
+
const classes = ['table'];
|
|
36
|
+
if (zebra) classes.push('table-zebra');
|
|
37
|
+
if (pinRows) classes.push('table-pin-rows');
|
|
38
|
+
if (pinCols) classes.push('table-pin-cols');
|
|
39
|
+
if (size) classes.push(`table-${size}`);
|
|
40
|
+
if (className) classes.push(className);
|
|
41
|
+
|
|
42
|
+
const tableEl = table({ class: classes.join(' '), ...rest }, ...children);
|
|
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
|
+
tableEl
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return tableEl;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Table Head
|
|
71
|
+
*/
|
|
72
|
+
Table.Head = (props = {}, ...children) => {
|
|
73
|
+
const { tags } = window.Lightview || {};
|
|
74
|
+
if (!tags) return null;
|
|
75
|
+
|
|
76
|
+
return tags.thead(props, ...children);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Table Body
|
|
81
|
+
*/
|
|
82
|
+
Table.Body = (props = {}, ...children) => {
|
|
83
|
+
const { tags } = window.Lightview || {};
|
|
84
|
+
if (!tags) return null;
|
|
85
|
+
|
|
86
|
+
return tags.tbody(props, ...children);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Table Row
|
|
91
|
+
*/
|
|
92
|
+
Table.Row = (props = {}, ...children) => {
|
|
93
|
+
const { tags } = window.Lightview || {};
|
|
94
|
+
if (!tags) return null;
|
|
95
|
+
|
|
96
|
+
const { hover = false, active = false, class: className = '', ...rest } = props;
|
|
97
|
+
|
|
98
|
+
const classes = [];
|
|
99
|
+
if (hover) classes.push('hover');
|
|
100
|
+
if (active) classes.push('active');
|
|
101
|
+
if (className) classes.push(className);
|
|
102
|
+
|
|
103
|
+
return tags.tr({ class: classes.join(' ') || undefined, ...rest }, ...children);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Table Header Cell
|
|
108
|
+
*/
|
|
109
|
+
Table.Th = (props = {}, ...children) => {
|
|
110
|
+
const { tags } = window.Lightview || {};
|
|
111
|
+
if (!tags) return null;
|
|
112
|
+
|
|
113
|
+
return tags.th(props, ...children);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Table Data Cell
|
|
118
|
+
*/
|
|
119
|
+
Table.Td = (props = {}, ...children) => {
|
|
120
|
+
const { tags } = window.Lightview || {};
|
|
121
|
+
if (!tags) return null;
|
|
122
|
+
|
|
123
|
+
return tags.td(props, ...children);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Table Foot
|
|
128
|
+
*/
|
|
129
|
+
Table.Foot = (props = {}, ...children) => {
|
|
130
|
+
const { tags } = window.Lightview || {};
|
|
131
|
+
if (!tags) return null;
|
|
132
|
+
|
|
133
|
+
return tags.tfoot(props, ...children);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const tags = window.Lightview.tags;
|
|
137
|
+
|
|
138
|
+
tags.Table = Table;
|
|
139
|
+
tags['Table.Head'] = Table.Head;
|
|
140
|
+
tags['Table.Body'] = Table.Body;
|
|
141
|
+
tags['Table.Row'] = Table.Row;
|
|
142
|
+
tags['Table.Th'] = Table.Th;
|
|
143
|
+
tags['Table.Td'] = Table.Td;
|
|
144
|
+
tags['Table.Foot'] = Table.Foot;
|
|
145
|
+
|
|
146
|
+
export default Table;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Timeline Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/timeline/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Timeline Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {boolean} props.snap - Snap to items
|
|
12
|
+
* @param {boolean} props.vertical - Vertical layout
|
|
13
|
+
* @param {boolean} props.compact - Compact mode
|
|
14
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
15
|
+
*/
|
|
16
|
+
const Timeline = (props = {}, ...children) => {
|
|
17
|
+
const { tags } = window.Lightview || {};
|
|
18
|
+
const LVX = window.LightviewX || {};
|
|
19
|
+
|
|
20
|
+
if (!tags) return null;
|
|
21
|
+
|
|
22
|
+
const { ul, div, shadowDOM } = tags;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
snap = false,
|
|
26
|
+
vertical = true,
|
|
27
|
+
compact = false,
|
|
28
|
+
useShadow,
|
|
29
|
+
class: className = '',
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const classes = ['timeline'];
|
|
34
|
+
if (snap) classes.push('timeline-snap-icon');
|
|
35
|
+
if (vertical) classes.push('timeline-vertical');
|
|
36
|
+
if (compact) classes.push('timeline-compact');
|
|
37
|
+
if (className) classes.push(className);
|
|
38
|
+
|
|
39
|
+
const timelineEl = ul({ class: classes.join(' '), ...rest }, ...children);
|
|
40
|
+
|
|
41
|
+
// Check if we should use shadow DOM
|
|
42
|
+
let usesShadow = false;
|
|
43
|
+
if (LVX.shouldUseShadow) {
|
|
44
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
45
|
+
} else {
|
|
46
|
+
usesShadow = useShadow === true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (usesShadow) {
|
|
50
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
51
|
+
|
|
52
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
53
|
+
|
|
54
|
+
return div({ class: 'contents' },
|
|
55
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
56
|
+
div({ 'data-theme': themeValue },
|
|
57
|
+
timelineEl
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return timelineEl;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Timeline Item
|
|
68
|
+
*/
|
|
69
|
+
Timeline.Item = (props = {}, ...children) => {
|
|
70
|
+
const { tags } = window.Lightview || {};
|
|
71
|
+
if (!tags) return null;
|
|
72
|
+
|
|
73
|
+
return tags.li(props, ...children);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Timeline Start
|
|
78
|
+
*/
|
|
79
|
+
Timeline.Start = (props = {}, ...children) => {
|
|
80
|
+
const { tags } = window.Lightview || {};
|
|
81
|
+
if (!tags) return null;
|
|
82
|
+
|
|
83
|
+
const { class: className = '', ...rest } = props;
|
|
84
|
+
|
|
85
|
+
return tags.div({
|
|
86
|
+
class: `timeline-start ${className}`.trim(),
|
|
87
|
+
...rest
|
|
88
|
+
}, ...children);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Timeline Middle (icon)
|
|
93
|
+
*/
|
|
94
|
+
Timeline.Middle = (props = {}, ...children) => {
|
|
95
|
+
const { tags } = window.Lightview || {};
|
|
96
|
+
if (!tags) return null;
|
|
97
|
+
|
|
98
|
+
const { class: className = '', ...rest } = props;
|
|
99
|
+
|
|
100
|
+
return tags.div({
|
|
101
|
+
class: `timeline-middle ${className}`.trim(),
|
|
102
|
+
...rest
|
|
103
|
+
}, ...children);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Timeline End
|
|
108
|
+
*/
|
|
109
|
+
Timeline.End = (props = {}, ...children) => {
|
|
110
|
+
const { tags } = window.Lightview || {};
|
|
111
|
+
if (!tags) return null;
|
|
112
|
+
|
|
113
|
+
const { class: className = '', box = false, ...rest } = props;
|
|
114
|
+
|
|
115
|
+
const classes = ['timeline-end'];
|
|
116
|
+
if (box) classes.push('timeline-box');
|
|
117
|
+
if (className) classes.push(className);
|
|
118
|
+
|
|
119
|
+
return tags.div({ class: classes.join(' '), ...rest }, ...children);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Timeline HR (connector line)
|
|
124
|
+
*/
|
|
125
|
+
Timeline.Hr = (props = {}) => {
|
|
126
|
+
const { tags } = window.Lightview || {};
|
|
127
|
+
if (!tags) return null;
|
|
128
|
+
|
|
129
|
+
const { color, class: className = '', ...rest } = props;
|
|
130
|
+
|
|
131
|
+
const classes = [];
|
|
132
|
+
if (color) classes.push(`bg-${color}`);
|
|
133
|
+
if (className) classes.push(className);
|
|
134
|
+
|
|
135
|
+
return tags.hr({ class: classes.join(' ') || undefined, ...rest });
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const tags = window.Lightview.tags;
|
|
139
|
+
tags.Timeline = Timeline;
|
|
140
|
+
tags['Timeline.Item'] = Timeline.Item;
|
|
141
|
+
tags['Timeline.Start'] = Timeline.Start;
|
|
142
|
+
tags['Timeline.Middle'] = Timeline.Middle;
|
|
143
|
+
tags['Timeline.End'] = Timeline.End;
|
|
144
|
+
tags['Timeline.Hr'] = Timeline.Hr;
|
|
145
|
+
|
|
146
|
+
export default Timeline;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Toast Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/toast/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Toast Component - positioned container for alerts
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {string} props.position - 'start' | 'center' | 'end'
|
|
12
|
+
* @param {string} props.vertical - 'top' | 'middle' | 'bottom'
|
|
13
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
14
|
+
*/
|
|
15
|
+
const Toast = (props = {}, ...children) => {
|
|
16
|
+
const { tags } = window.Lightview || {};
|
|
17
|
+
const LVX = window.LightviewX || {};
|
|
18
|
+
|
|
19
|
+
if (!tags) return null;
|
|
20
|
+
|
|
21
|
+
const { div, shadowDOM } = tags;
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
position = 'end',
|
|
25
|
+
vertical = 'bottom',
|
|
26
|
+
useShadow,
|
|
27
|
+
class: className = '',
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
const classes = ['toast'];
|
|
32
|
+
|
|
33
|
+
if (position === 'start') classes.push('toast-start');
|
|
34
|
+
else if (position === 'center') classes.push('toast-center');
|
|
35
|
+
else if (position === 'end') classes.push('toast-end');
|
|
36
|
+
|
|
37
|
+
if (vertical === 'top') classes.push('toast-top');
|
|
38
|
+
else if (vertical === 'middle') classes.push('toast-middle');
|
|
39
|
+
else if (vertical === 'bottom') classes.push('toast-bottom');
|
|
40
|
+
|
|
41
|
+
if (className) classes.push(className);
|
|
42
|
+
|
|
43
|
+
const toastEl = div({ class: classes.join(' '), ...rest }, ...children);
|
|
44
|
+
|
|
45
|
+
// Check if we should use shadow DOM
|
|
46
|
+
let usesShadow = false;
|
|
47
|
+
if (LVX.shouldUseShadow) {
|
|
48
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
49
|
+
} else {
|
|
50
|
+
usesShadow = useShadow === true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (usesShadow) {
|
|
54
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
55
|
+
|
|
56
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
57
|
+
|
|
58
|
+
return div({ class: 'contents' },
|
|
59
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
60
|
+
div({ 'data-theme': themeValue },
|
|
61
|
+
toastEl
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return toastEl;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
window.Lightview.tags.Toast = Toast;
|
|
71
|
+
|
|
72
|
+
export default Toast;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightview Tooltip Component (DaisyUI)
|
|
3
|
+
* @see https://daisyui.com/components/tooltip/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import '../daisyui.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Tooltip Component
|
|
10
|
+
* @param {Object} props
|
|
11
|
+
* @param {string} props.tip - Tooltip text
|
|
12
|
+
* @param {string} props.position - 'top' | 'bottom' | 'left' | 'right'
|
|
13
|
+
* @param {string} props.color - 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
|
|
14
|
+
* @param {boolean} props.open - Force open state
|
|
15
|
+
* @param {boolean} props.useShadow - Render in Shadow DOM with isolated DaisyUI styles
|
|
16
|
+
*/
|
|
17
|
+
const Tooltip = (props = {}, ...children) => {
|
|
18
|
+
const { tags } = window.Lightview || {};
|
|
19
|
+
const LVX = window.LightviewX || {};
|
|
20
|
+
|
|
21
|
+
if (!tags) return null;
|
|
22
|
+
|
|
23
|
+
const { div, shadowDOM } = tags;
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
tip,
|
|
27
|
+
position,
|
|
28
|
+
color,
|
|
29
|
+
open = false,
|
|
30
|
+
useShadow,
|
|
31
|
+
class: className = '',
|
|
32
|
+
...rest
|
|
33
|
+
} = props;
|
|
34
|
+
|
|
35
|
+
const classes = ['tooltip'];
|
|
36
|
+
if (position) classes.push(`tooltip-${position}`);
|
|
37
|
+
if (color) classes.push(`tooltip-${color}`);
|
|
38
|
+
if (open) classes.push('tooltip-open');
|
|
39
|
+
if (className) classes.push(className);
|
|
40
|
+
|
|
41
|
+
const tooltipEl = div({
|
|
42
|
+
class: classes.join(' '),
|
|
43
|
+
'data-tip': tip,
|
|
44
|
+
...rest
|
|
45
|
+
}, ...children);
|
|
46
|
+
|
|
47
|
+
// Check if we should use shadow DOM
|
|
48
|
+
let usesShadow = false;
|
|
49
|
+
if (LVX.shouldUseShadow) {
|
|
50
|
+
usesShadow = LVX.shouldUseShadow(useShadow);
|
|
51
|
+
} else {
|
|
52
|
+
usesShadow = useShadow === true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (usesShadow) {
|
|
56
|
+
const adoptedStyleSheets = LVX.getAdoptedStyleSheets ? LVX.getAdoptedStyleSheets() : [];
|
|
57
|
+
|
|
58
|
+
const themeValue = LVX.themeSignal ? () => LVX.themeSignal.value : 'light';
|
|
59
|
+
|
|
60
|
+
return div({ class: 'contents' },
|
|
61
|
+
shadowDOM({ mode: 'open', adoptedStyleSheets },
|
|
62
|
+
div({ 'data-theme': themeValue },
|
|
63
|
+
tooltipEl
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return tooltipEl;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
window.Lightview.tags.Tooltip = Tooltip;
|
|
73
|
+
|
|
74
|
+
export default Tooltip;
|