@mangtre/ui 0.1.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/LICENSE +26 -0
- package/dist/MangThemeProvider-BqdGKBP2.d.ts +34 -0
- package/dist/Money-Dw3GnUvX.d.ts +27 -0
- package/dist/actions.d.ts +31 -0
- package/dist/actions.js +13 -0
- package/dist/ai.d.ts +58 -0
- package/dist/ai.js +13 -0
- package/dist/analytics.d.ts +40 -0
- package/dist/analytics.js +15 -0
- package/dist/app.d.ts +24 -0
- package/dist/app.js +9 -0
- package/dist/catalog.d.ts +76 -0
- package/dist/catalog.js +1210 -0
- package/dist/charts.d.ts +89 -0
- package/dist/charts.js +34 -0
- package/dist/chunk-3AL4SUFD.js +301 -0
- package/dist/chunk-4XNSYKQE.js +142 -0
- package/dist/chunk-5Z4VLQKH.js +43 -0
- package/dist/chunk-7P2EQZYD.js +59 -0
- package/dist/chunk-7WHNIEDV.js +120 -0
- package/dist/chunk-ASZKHSMG.js +82 -0
- package/dist/chunk-BCBN2EGH.js +216 -0
- package/dist/chunk-BLYAFV45.js +320 -0
- package/dist/chunk-DLKEXWPA.js +90 -0
- package/dist/chunk-DTASXPTB.js +70 -0
- package/dist/chunk-FZRXVRC7.js +63 -0
- package/dist/chunk-ID233AGM.js +108 -0
- package/dist/chunk-IVYXOKMO.js +74 -0
- package/dist/chunk-IX3DYETF.js +61 -0
- package/dist/chunk-JJB4PJC3.js +166 -0
- package/dist/chunk-K5Q3RCV6.js +119 -0
- package/dist/chunk-LNRUPJDF.js +161 -0
- package/dist/chunk-LZORNMBL.js +0 -0
- package/dist/chunk-OBPXCUVF.js +282 -0
- package/dist/chunk-OJX2EIMB.js +145 -0
- package/dist/chunk-PPOYMKV3.js +170 -0
- package/dist/chunk-PQGUWJG4.js +47 -0
- package/dist/chunk-RE7OWRA4.js +187 -0
- package/dist/chunk-SJF3CHAW.js +108 -0
- package/dist/chunk-UF6ANDJZ.js +112 -0
- package/dist/chunk-VGC5DMOM.js +107 -0
- package/dist/chunk-VP56Z4BS.js +0 -0
- package/dist/chunk-VRD66FIA.js +77 -0
- package/dist/chunk-X7T2DJLU.js +113 -0
- package/dist/chunk-XPV3OOLU.js +147 -0
- package/dist/chunk-YN5O6YL6.js +69 -0
- package/dist/chunk-Z4ANGBPC.js +94 -0
- package/dist/creator.d.ts +55 -0
- package/dist/creator.js +20 -0
- package/dist/data-room.d.ts +50 -0
- package/dist/data-room.js +17 -0
- package/dist/editor.d.ts +32 -0
- package/dist/editor.js +14 -0
- package/dist/feedback.d.ts +48 -0
- package/dist/feedback.js +16 -0
- package/dist/forms.d.ts +91 -0
- package/dist/forms.js +26 -0
- package/dist/handoff.d.ts +37 -0
- package/dist/handoff.js +13 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +338 -0
- package/dist/layout.d.ts +57 -0
- package/dist/layout.js +22 -0
- package/dist/learning.d.ts +46 -0
- package/dist/learning.js +15 -0
- package/dist/media.d.ts +48 -0
- package/dist/media.js +16 -0
- package/dist/monetization.d.ts +30 -0
- package/dist/monetization.js +14 -0
- package/dist/money.d.ts +45 -0
- package/dist/money.js +28 -0
- package/dist/navigation.d.ts +36 -0
- package/dist/navigation.js +14 -0
- package/dist/overlay.d.ts +72 -0
- package/dist/overlay.js +20 -0
- package/dist/platform.d.ts +94 -0
- package/dist/platform.js +42 -0
- package/dist/primitives.d.ts +83 -0
- package/dist/primitives.js +22 -0
- package/dist/privacy.d.ts +28 -0
- package/dist/privacy.js +15 -0
- package/dist/sandbox.d.ts +40 -0
- package/dist/sandbox.js +15 -0
- package/dist/settings.d.ts +29 -0
- package/dist/settings.js +13 -0
- package/dist/surface.d.ts +33 -0
- package/dist/surface.js +16 -0
- package/dist/theme.css +63 -0
- package/dist/theme.d.ts +64 -0
- package/dist/theme.js +27 -0
- package/dist/tokens.css +119 -0
- package/dist/tokens.d.ts +128 -0
- package/dist/tokens.js +8 -0
- package/package.json +151 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cx,
|
|
3
|
+
useKitStyles,
|
|
4
|
+
useScope
|
|
5
|
+
} from "./chunk-3AL4SUFD.js";
|
|
6
|
+
import {
|
|
7
|
+
tokens
|
|
8
|
+
} from "./chunk-PPOYMKV3.js";
|
|
9
|
+
|
|
10
|
+
// src/primitives/Stack.tsx
|
|
11
|
+
import { createElement } from "react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
var gapToRem = (g) => g == null ? void 0 : tokens.space[g];
|
|
14
|
+
function Box({ as = "div", className, style, children }) {
|
|
15
|
+
return createElement(as, { className, style }, children);
|
|
16
|
+
}
|
|
17
|
+
function Stack({
|
|
18
|
+
as = "div",
|
|
19
|
+
direction = "column",
|
|
20
|
+
gap = 4,
|
|
21
|
+
align,
|
|
22
|
+
justify,
|
|
23
|
+
wrap,
|
|
24
|
+
className,
|
|
25
|
+
style,
|
|
26
|
+
children
|
|
27
|
+
}) {
|
|
28
|
+
const flexStyle = {
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: direction,
|
|
31
|
+
gap: gapToRem(gap),
|
|
32
|
+
alignItems: align,
|
|
33
|
+
justifyContent: justify,
|
|
34
|
+
flexWrap: wrap ? "wrap" : void 0,
|
|
35
|
+
...style
|
|
36
|
+
};
|
|
37
|
+
return createElement(as, { className, style: flexStyle }, children);
|
|
38
|
+
}
|
|
39
|
+
function HStack(props) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Stack, { ...props, direction: "row", align: props.align ?? "center" });
|
|
41
|
+
}
|
|
42
|
+
function VStack(props) {
|
|
43
|
+
return /* @__PURE__ */ jsx(Stack, { ...props, direction: "column" });
|
|
44
|
+
}
|
|
45
|
+
function Spacer({ size }) {
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
style: size == null ? { flex: 1 } : { flex: "none", width: gapToRem(size), height: gapToRem(size) }
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/primitives/Text.tsx
|
|
55
|
+
import { createElement as createElement2 } from "react";
|
|
56
|
+
function Text({
|
|
57
|
+
as = "p",
|
|
58
|
+
size = "base",
|
|
59
|
+
tone = "default",
|
|
60
|
+
weight,
|
|
61
|
+
theme,
|
|
62
|
+
className,
|
|
63
|
+
style,
|
|
64
|
+
children
|
|
65
|
+
}) {
|
|
66
|
+
useKitStyles();
|
|
67
|
+
const scope = useScope(theme);
|
|
68
|
+
const css = {
|
|
69
|
+
fontSize: tokens.fontSize[size],
|
|
70
|
+
fontWeight: weight ? tokens.fontWeight[weight] : void 0,
|
|
71
|
+
...style
|
|
72
|
+
};
|
|
73
|
+
return createElement2(
|
|
74
|
+
as,
|
|
75
|
+
{
|
|
76
|
+
...scope,
|
|
77
|
+
className: cx(scope.className, "mang-text", className),
|
|
78
|
+
"data-tone": tone,
|
|
79
|
+
style: css
|
|
80
|
+
},
|
|
81
|
+
children
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
var DEFAULT_SIZE = {
|
|
85
|
+
1: "3xl",
|
|
86
|
+
2: "2xl",
|
|
87
|
+
3: "xl",
|
|
88
|
+
4: "lg",
|
|
89
|
+
5: "base",
|
|
90
|
+
6: "sm"
|
|
91
|
+
};
|
|
92
|
+
function Heading({ level = 2, size, theme, className, style, children }) {
|
|
93
|
+
useKitStyles();
|
|
94
|
+
const scope = useScope(theme);
|
|
95
|
+
const css = { fontSize: tokens.fontSize[size ?? DEFAULT_SIZE[level]], ...style };
|
|
96
|
+
return createElement2(
|
|
97
|
+
`h${level}`,
|
|
98
|
+
{ ...scope, className: cx(scope.className, "mang-heading", className), style: css },
|
|
99
|
+
children
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/primitives/Divider.tsx
|
|
104
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
105
|
+
function Divider({ theme, className, style }) {
|
|
106
|
+
useKitStyles();
|
|
107
|
+
const scope = useScope(theme);
|
|
108
|
+
return /* @__PURE__ */ jsx2("hr", { ...scope, className: cx(scope.className, "mang-divider", className), style });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
Box,
|
|
113
|
+
Stack,
|
|
114
|
+
HStack,
|
|
115
|
+
VStack,
|
|
116
|
+
Spacer,
|
|
117
|
+
Text,
|
|
118
|
+
Heading,
|
|
119
|
+
Divider
|
|
120
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VndText
|
|
3
|
+
} from "./chunk-IX3DYETF.js";
|
|
4
|
+
import {
|
|
5
|
+
Badge
|
|
6
|
+
} from "./chunk-FZRXVRC7.js";
|
|
7
|
+
import {
|
|
8
|
+
cx,
|
|
9
|
+
useAreaStyles,
|
|
10
|
+
useScope
|
|
11
|
+
} from "./chunk-3AL4SUFD.js";
|
|
12
|
+
import {
|
|
13
|
+
tokens
|
|
14
|
+
} from "./chunk-PPOYMKV3.js";
|
|
15
|
+
|
|
16
|
+
// src/monetization/Monetization.tsx
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var STYLE_ID = "mang-ui-monetization";
|
|
19
|
+
var { fontSize, fontWeight, radius, font } = tokens;
|
|
20
|
+
var CSS = (
|
|
21
|
+
/* css */
|
|
22
|
+
`
|
|
23
|
+
.mang-soon { display: grid; gap: 0.4rem; padding: 1.1rem 1.2rem; border: 1px dashed var(--m-line-strong); border-radius: ${radius.lg}; background: var(--m-sunken); color: var(--m-text-muted); }
|
|
24
|
+
.mang-soon-title { font-family: "${font.heading}", system-ui, sans-serif; font-weight: ${fontWeight.bold}; color: var(--m-text-strong); font-size: ${fontSize.base}; }
|
|
25
|
+
.mang-ledger { width: 100%; border-collapse: collapse; font-size: ${fontSize.sm}; opacity: 0.85; }
|
|
26
|
+
.mang-ledger th, .mang-ledger td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--m-line); }
|
|
27
|
+
.mang-ledger th { color: var(--m-text-muted); font-size: ${fontSize.xs}; text-transform: uppercase; letter-spacing: 0.06em; }
|
|
28
|
+
.mang-ledger td { color: var(--m-text); font-variant-numeric: tabular-nums; }
|
|
29
|
+
`
|
|
30
|
+
);
|
|
31
|
+
function ComingSoonMonetizationCard({
|
|
32
|
+
title,
|
|
33
|
+
children,
|
|
34
|
+
locale = "vi",
|
|
35
|
+
theme,
|
|
36
|
+
className
|
|
37
|
+
}) {
|
|
38
|
+
useAreaStyles(STYLE_ID, CSS);
|
|
39
|
+
const scope = useScope(theme);
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", { ...scope, className: cx(scope.className, "mang-soon", className), children: [
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "mang-soon-title", children: title ?? (locale === "vi" ? "Ki\u1EBFm ti\u1EC1n \u2014 s\u1EAFp c\xF3" : "Monetization \u2014 coming later") }),
|
|
42
|
+
/* @__PURE__ */ jsx("span", { children: children ?? (locale === "vi" ? "Chia s\u1EBB doanh thu cho ng\u01B0\u1EDDi t\u1EA1o s\u1EBD m\u1EDF sau khi c\xF3 t\xEDn hi\u1EC7u creator." : "Creator rev-share opens once there's a creator signal.") })
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
function PayoutStatusBadge({
|
|
46
|
+
status,
|
|
47
|
+
locale = "vi",
|
|
48
|
+
theme,
|
|
49
|
+
className
|
|
50
|
+
}) {
|
|
51
|
+
const meta = {
|
|
52
|
+
none: { tone: "neutral", vi: "Ch\u01B0a c\xF3", en: "None" },
|
|
53
|
+
pending: { tone: "warning", vi: "\u0110ang ch\u1EDD", en: "Pending" },
|
|
54
|
+
paid: { tone: "success", vi: "\u0110\xE3 chi", en: "Paid" }
|
|
55
|
+
}[status];
|
|
56
|
+
return /* @__PURE__ */ jsx(Badge, { tone: meta.tone, theme, className, children: locale === "vi" ? meta.vi : meta.en });
|
|
57
|
+
}
|
|
58
|
+
function EarningsLedgerTable({
|
|
59
|
+
rows,
|
|
60
|
+
locale = "vi",
|
|
61
|
+
theme,
|
|
62
|
+
className
|
|
63
|
+
}) {
|
|
64
|
+
useAreaStyles(STYLE_ID, CSS);
|
|
65
|
+
const scope = useScope(theme);
|
|
66
|
+
return /* @__PURE__ */ jsxs("table", { ...scope, className: cx(scope.className, "mang-ledger", className), children: [
|
|
67
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
68
|
+
/* @__PURE__ */ jsx("th", { children: locale === "vi" ? "K\u1EF3" : "Period" }),
|
|
69
|
+
/* @__PURE__ */ jsx("th", { children: locale === "vi" ? "S\u1ED1 ti\u1EC1n" : "Amount" })
|
|
70
|
+
] }) }),
|
|
71
|
+
/* @__PURE__ */ jsx("tbody", { children: rows.map((r) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
72
|
+
/* @__PURE__ */ jsx("td", { children: r.period }),
|
|
73
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(VndText, { amount: r.amount, theme }) })
|
|
74
|
+
] }, r.period)) })
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
ComingSoonMonetizationCard,
|
|
80
|
+
PayoutStatusBadge,
|
|
81
|
+
EarningsLedgerTable
|
|
82
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button
|
|
3
|
+
} from "./chunk-YN5O6YL6.js";
|
|
4
|
+
import {
|
|
5
|
+
cx,
|
|
6
|
+
mountScopedStyle,
|
|
7
|
+
useAreaStyles,
|
|
8
|
+
useScope
|
|
9
|
+
} from "./chunk-3AL4SUFD.js";
|
|
10
|
+
import {
|
|
11
|
+
tokens
|
|
12
|
+
} from "./chunk-PPOYMKV3.js";
|
|
13
|
+
|
|
14
|
+
// src/PowerPicker.tsx
|
|
15
|
+
import { useEffect, useId } from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var STYLE_ID = "mang-powerpicker";
|
|
18
|
+
var LABEL = { vi: "N\u0103ng l\u1EF1c AI", en: "AI power" };
|
|
19
|
+
var { color, semantic, font, fontSize, fontWeight, radius, motion } = tokens;
|
|
20
|
+
var head = `"${font.heading}", system-ui, sans-serif`;
|
|
21
|
+
var DARK_VARS = (
|
|
22
|
+
/* css */
|
|
23
|
+
`
|
|
24
|
+
--pp-zone-bg: linear-gradient(180deg, color-mix(in oklab, ${color.mangGreen} 22%, ${color.dark}), ${color.dark} 78%);
|
|
25
|
+
--pp-border: color-mix(in oklab, ${color.mangGreen} 50%, ${color.dark});
|
|
26
|
+
--pp-title: ${color.shoot};
|
|
27
|
+
--pp-chip-bg: color-mix(in oklab, ${color.shoot} 12%, ${color.dark});
|
|
28
|
+
--pp-chip-border: color-mix(in oklab, ${color.shoot} 32%, ${color.dark});
|
|
29
|
+
--pp-chip-text: ${color.paper};
|
|
30
|
+
--pp-glow: color-mix(in oklab, ${color.mangGreen} 60%, transparent);
|
|
31
|
+
--pp-sheen: color-mix(in oklab, #fff 26%, transparent);
|
|
32
|
+
`
|
|
33
|
+
);
|
|
34
|
+
var CSS = (
|
|
35
|
+
/* css */
|
|
36
|
+
`
|
|
37
|
+
.mang-pp {
|
|
38
|
+
/* light theme (default) */
|
|
39
|
+
--pp-zone-bg: linear-gradient(180deg, color-mix(in oklab, ${color.shoot} 26%, ${semantic.surface.base}), ${semantic.surface.base} 72%);
|
|
40
|
+
--pp-border: color-mix(in oklab, ${color.mangGreen} 30%, ${semantic.line.default});
|
|
41
|
+
--pp-title: ${color.bamboo};
|
|
42
|
+
--pp-chip-bg: ${semantic.surface.base};
|
|
43
|
+
--pp-chip-border: ${semantic.line.strong};
|
|
44
|
+
--pp-chip-text: ${semantic.content.strong};
|
|
45
|
+
--pp-glow: color-mix(in oklab, ${color.mangGreen} 42%, transparent);
|
|
46
|
+
--pp-sheen: color-mix(in oklab, #fff 72%, transparent);
|
|
47
|
+
|
|
48
|
+
position: relative; overflow: hidden; isolation: isolate; display: grid; gap: 0.7rem; margin: 0; padding: 1rem 1.05rem 1.1rem; min-width: 0; border: 1.5px solid var(--pp-border); border-radius: ${radius.lg}; background: var(--pp-zone-bg);
|
|
49
|
+
}
|
|
50
|
+
.mang-pp[data-theme="dark"] {${DARK_VARS}}
|
|
51
|
+
@media (prefers-color-scheme: dark) { .mang-pp[data-theme="auto"] {${DARK_VARS}} }
|
|
52
|
+
|
|
53
|
+
/* drifting aurora glow */
|
|
54
|
+
.mang-pp::before { content: ""; position: absolute; z-index: -1; top: -70%; left: -25%; width: 75%; height: 240%; background: radial-gradient(closest-side, var(--pp-glow), transparent); filter: blur(26px); opacity: 0.55; animation: mang-pp-drift 9s ${motion.ease.standard} infinite alternate; }
|
|
55
|
+
/* periodic light sheen sweeping across */
|
|
56
|
+
.mang-pp::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(115deg, transparent 35%, var(--pp-sheen) 49%, transparent 63%); transform: translateX(-130%); animation: mang-pp-sheen 5s ease-in-out infinite; }
|
|
57
|
+
@keyframes mang-pp-drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(55%, 14%) scale(1.15); } }
|
|
58
|
+
@keyframes mang-pp-sheen { 0% { transform: translateX(-130%); } 60%, 100% { transform: translateX(130%); } }
|
|
59
|
+
|
|
60
|
+
.mang-pp-legend { padding: 0; display: inline-flex; align-items: center; gap: 0.45rem; font-family: ${head}; font-weight: ${fontWeight.bold}; font-size: ${fontSize.base}; letter-spacing: 0.01em; color: var(--pp-title); }
|
|
61
|
+
.mang-pp-spark { display: inline-block; font-size: 1.05rem; animation: mang-pp-twinkle 1.9s ${motion.ease.standard} infinite; }
|
|
62
|
+
@keyframes mang-pp-twinkle { 0%, 100% { opacity: 1; transform: scale(1) rotate(0); } 50% { opacity: 0.5; transform: scale(1.3) rotate(14deg); } }
|
|
63
|
+
|
|
64
|
+
.mang-pp-list { display: flex; flex-wrap: wrap; gap: 0.55rem; }
|
|
65
|
+
.mang-pp-chip { appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.62rem 1.05rem; border-radius: ${radius.full}; border: 2px solid var(--pp-chip-border); background: var(--pp-chip-bg); color: var(--pp-chip-text); font-family: ${head}; font-weight: ${fontWeight.bold}; font-size: ${fontSize.sm}; line-height: 1; transition: transform ${motion.duration.fast} ${motion.ease.standard}, background ${motion.duration.fast} ${motion.ease.standard}, border-color ${motion.duration.fast} ${motion.ease.standard}, box-shadow ${motion.duration.fast} ${motion.ease.standard}; }
|
|
66
|
+
.mang-pp-chip:hover:not(:disabled) { border-color: ${color.mangGreen}; transform: translateY(-1px); }
|
|
67
|
+
.mang-pp-chip:active:not(:disabled) { transform: translateY(0) scale(0.98); }
|
|
68
|
+
.mang-pp-chip[aria-pressed="true"] { background: ${color.mangGreen}; border-color: ${color.mangGreen}; color: ${semantic.content.onAccent}; box-shadow: 0 10px 22px -10px ${color.mangGreen}; }
|
|
69
|
+
.mang-pp-chip:focus-visible { outline: 3px solid color-mix(in oklab, ${color.mangGreen} 45%, transparent); outline-offset: 2px; }
|
|
70
|
+
.mang-pp-chip:disabled { opacity: 0.55; cursor: not-allowed; }
|
|
71
|
+
.mang-pp-icon { font-size: 1.05rem; line-height: 1; }
|
|
72
|
+
@media (prefers-reduced-motion: reduce) {
|
|
73
|
+
.mang-pp::before, .mang-pp-spark { animation: none; }
|
|
74
|
+
.mang-pp::after { display: none; }
|
|
75
|
+
.mang-pp-chip { transition: none; }
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
);
|
|
79
|
+
function PowerPicker({
|
|
80
|
+
powers,
|
|
81
|
+
value,
|
|
82
|
+
onChange,
|
|
83
|
+
locale,
|
|
84
|
+
disabled,
|
|
85
|
+
theme = "light"
|
|
86
|
+
}) {
|
|
87
|
+
useEffect(() => mountScopedStyle(STYLE_ID, CSS), []);
|
|
88
|
+
const titleId = useId();
|
|
89
|
+
if (powers.length < 2) return null;
|
|
90
|
+
return (
|
|
91
|
+
// A <div role="group"> + aria-labelledby (not <fieldset>/<legend>): the native legend renders
|
|
92
|
+
// ON the top border and notches the zone's rounded outline. This keeps the clean zone + label.
|
|
93
|
+
// biome-ignore lint/a11y/useSemanticElements: fieldset's legend breaks the zone border outline
|
|
94
|
+
/* @__PURE__ */ jsxs("div", { className: "mang-pp", "data-theme": theme, role: "group", "aria-labelledby": titleId, children: [
|
|
95
|
+
/* @__PURE__ */ jsxs("span", { className: "mang-pp-legend", id: titleId, children: [
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "mang-pp-spark", "aria-hidden": "true", children: "\u2728" }),
|
|
97
|
+
LABEL[locale]
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsx("div", { className: "mang-pp-list", children: powers.map((p) => /* @__PURE__ */ jsxs(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
"aria-pressed": value === p.capability,
|
|
104
|
+
className: "mang-pp-chip",
|
|
105
|
+
onClick: () => onChange(p.capability),
|
|
106
|
+
disabled,
|
|
107
|
+
title: p.description[locale],
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", { className: "mang-pp-icon", "aria-hidden": "true", children: p.icon }),
|
|
110
|
+
p.label[locale]
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
p.capability
|
|
114
|
+
)) })
|
|
115
|
+
] })
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// src/ai/Cards.tsx
|
|
120
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
121
|
+
var STYLE_ID2 = "mang-ui-ai-cards";
|
|
122
|
+
var { fontSize: fontSize2, fontWeight: fontWeight2, radius: radius2, font: font2 } = tokens;
|
|
123
|
+
var CSS2 = (
|
|
124
|
+
/* css */
|
|
125
|
+
`
|
|
126
|
+
.mang-aicard { display: grid; gap: 0.6rem; padding: 1rem 1.1rem; border-radius: ${radius2.lg}; border: 1px solid var(--m-line); background: var(--m-surface); color: var(--m-text); }
|
|
127
|
+
.mang-aicard-head { display: flex; align-items: center; gap: 0.5rem; }
|
|
128
|
+
.mang-aicard-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: none; background: var(--m-text-muted); }
|
|
129
|
+
.mang-aicard-dot[data-ready="true"] { background: var(--m-success); box-shadow: 0 0 0 3px var(--m-success-soft); }
|
|
130
|
+
.mang-aicard-title { font-family: "${font2.heading}", system-ui, sans-serif; font-weight: ${fontWeight2.bold}; font-size: ${fontSize2.base}; color: var(--m-text-strong); }
|
|
131
|
+
.mang-aicard-note { font-size: ${fontSize2.sm}; color: var(--m-text-muted); }
|
|
132
|
+
.mang-aicard-models { display: grid; gap: 0.4rem; }
|
|
133
|
+
.mang-aicard-model { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0.7rem; border: 1.5px solid var(--m-line); border-radius: ${radius2.md}; background: var(--m-sunken); }
|
|
134
|
+
.mang-aicard-model-name { font-weight: ${fontWeight2.semibold}; font-size: ${fontSize2.sm}; }
|
|
135
|
+
.mang-aicard-model-meta { font-size: ${fontSize2.xs}; color: var(--m-text-muted); }
|
|
136
|
+
.mang-aicard-privacy { display: inline-flex; align-items: center; gap: 0.35rem; font-size: ${fontSize2.xs}; color: var(--m-success); font-weight: ${fontWeight2.semibold}; }
|
|
137
|
+
`
|
|
138
|
+
);
|
|
139
|
+
var T = {
|
|
140
|
+
ready: { vi: "AI \u0111\xE3 s\u1EB5n s\xE0ng", en: "AI is ready" },
|
|
141
|
+
notReady: { vi: "AI ch\u01B0a s\u1EB5n s\xE0ng", en: "AI not ready" },
|
|
142
|
+
privacy: {
|
|
143
|
+
vi: "Ch\u1EA1y tr\xEAn m\xE1y b\u1EA1n \u2014 d\u1EEF li\u1EC7u kh\xF4ng r\u1EDDi thi\u1EBFt b\u1ECB",
|
|
144
|
+
en: "Runs on your device \u2014 nothing leaves it"
|
|
145
|
+
},
|
|
146
|
+
install: { vi: "C\xE0i \u0111\u1EB7t", en: "Install" },
|
|
147
|
+
download: { vi: "T\u1EA3i", en: "Download" }
|
|
148
|
+
};
|
|
149
|
+
function AiStatusCard({
|
|
150
|
+
ready,
|
|
151
|
+
detail,
|
|
152
|
+
locale = "vi",
|
|
153
|
+
theme,
|
|
154
|
+
className
|
|
155
|
+
}) {
|
|
156
|
+
useAreaStyles(STYLE_ID2, CSS2);
|
|
157
|
+
const scope = useScope(theme);
|
|
158
|
+
return /* @__PURE__ */ jsxs2("div", { ...scope, className: cx(scope.className, "mang-aicard", className), children: [
|
|
159
|
+
/* @__PURE__ */ jsxs2("div", { className: "mang-aicard-head", children: [
|
|
160
|
+
/* @__PURE__ */ jsx2(
|
|
161
|
+
"span",
|
|
162
|
+
{
|
|
163
|
+
className: "mang-aicard-dot",
|
|
164
|
+
"data-ready": ready ? "true" : void 0,
|
|
165
|
+
"aria-hidden": "true"
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
/* @__PURE__ */ jsx2("span", { className: "mang-aicard-title", children: ready ? T.ready[locale] : T.notReady[locale] })
|
|
169
|
+
] }),
|
|
170
|
+
detail != null && /* @__PURE__ */ jsx2("span", { className: "mang-aicard-note", children: detail }),
|
|
171
|
+
/* @__PURE__ */ jsxs2("span", { className: "mang-aicard-privacy", children: [
|
|
172
|
+
"\u{1F512} ",
|
|
173
|
+
T.privacy[locale]
|
|
174
|
+
] })
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
function AiSetupCard({
|
|
178
|
+
title,
|
|
179
|
+
description,
|
|
180
|
+
models = [],
|
|
181
|
+
onInstall,
|
|
182
|
+
onPull,
|
|
183
|
+
progress,
|
|
184
|
+
locale = "vi",
|
|
185
|
+
theme,
|
|
186
|
+
className
|
|
187
|
+
}) {
|
|
188
|
+
useAreaStyles(STYLE_ID2, CSS2);
|
|
189
|
+
const scope = useScope(theme);
|
|
190
|
+
return /* @__PURE__ */ jsxs2("div", { ...scope, className: cx(scope.className, "mang-aicard", className), children: [
|
|
191
|
+
/* @__PURE__ */ jsx2("div", { className: "mang-aicard-head", children: /* @__PURE__ */ jsx2("span", { className: "mang-aicard-title", children: title ?? (locale === "vi" ? "B\u1EADt AI c\u1EE5c b\u1ED9" : "Set up local AI") }) }),
|
|
192
|
+
description != null && /* @__PURE__ */ jsx2("span", { className: "mang-aicard-note", children: description }),
|
|
193
|
+
onInstall && /* @__PURE__ */ jsx2(Button, { variant: "secondary", size: "sm", theme, onClick: onInstall, children: T.install[locale] }),
|
|
194
|
+
models.length > 0 && /* @__PURE__ */ jsx2("div", { className: "mang-aicard-models", children: models.map((m) => /* @__PURE__ */ jsxs2("div", { className: "mang-aicard-model", children: [
|
|
195
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
196
|
+
/* @__PURE__ */ jsx2("span", { className: "mang-aicard-model-name", children: m.name }),
|
|
197
|
+
m.meta && /* @__PURE__ */ jsxs2("span", { className: "mang-aicard-model-meta", children: [
|
|
198
|
+
" \xB7 ",
|
|
199
|
+
m.meta
|
|
200
|
+
] })
|
|
201
|
+
] }),
|
|
202
|
+
onPull && /* @__PURE__ */ jsx2(Button, { size: "sm", theme, onClick: () => onPull(m.id), children: T.download[locale] })
|
|
203
|
+
] }, m.id)) }),
|
|
204
|
+
progress,
|
|
205
|
+
/* @__PURE__ */ jsxs2("span", { className: "mang-aicard-privacy", children: [
|
|
206
|
+
"\u{1F512} ",
|
|
207
|
+
T.privacy[locale]
|
|
208
|
+
] })
|
|
209
|
+
] });
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export {
|
|
213
|
+
PowerPicker,
|
|
214
|
+
AiStatusCard,
|
|
215
|
+
AiSetupCard
|
|
216
|
+
};
|