@pollinations/ui 0.0.1 → 0.1.0-alpha.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/README.md +25 -16
- package/dist/{Button-DMJ2K6Gr.d.ts → Button-BvLF_Km2.d.cts} +4 -4
- package/dist/{Button-CNzpisJf.d.cts → Button-DQAZzvyQ.d.ts} +4 -4
- package/dist/{Chip-BS8ronOu.d.ts → Chip-C5impfYd.d.ts} +2 -2
- package/dist/{Chip-DyqWrq0r.d.cts → Chip-SM52sUbZ.d.cts} +2 -2
- package/dist/app.css +1 -1
- package/dist/auth/index.cjs +78 -71
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +1 -2
- package/dist/auth/index.d.ts +1 -2
- package/dist/auth/index.js +78 -71
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/sdk.cjs +7 -6
- package/dist/auth/sdk.cjs.map +1 -1
- package/dist/auth/sdk.d.cts +2 -2
- package/dist/auth/sdk.d.ts +2 -2
- package/dist/auth/sdk.js +7 -6
- package/dist/auth/sdk.js.map +1 -1
- package/dist/compositions/app-user.cjs +497 -0
- package/dist/compositions/app-user.cjs.map +1 -0
- package/dist/compositions/app-user.d.cts +18 -0
- package/dist/compositions/app-user.d.ts +18 -0
- package/dist/compositions/app-user.js +469 -0
- package/dist/compositions/app-user.js.map +1 -0
- package/dist/index.cjs +1151 -312
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +146 -13
- package/dist/index.d.ts +146 -13
- package/dist/index.js +1109 -295
- package/dist/index.js.map +1 -1
- package/dist/modality/index.cjs +27 -56
- package/dist/modality/index.cjs.map +1 -1
- package/dist/modality/index.d.cts +13 -32
- package/dist/modality/index.d.ts +13 -32
- package/dist/modality/index.js +27 -55
- package/dist/modality/index.js.map +1 -1
- package/dist/models/index.cjs +508 -0
- package/dist/models/index.cjs.map +1 -0
- package/dist/models/index.d.cts +22 -0
- package/dist/models/index.d.ts +22 -0
- package/dist/models/index.js +486 -0
- package/dist/models/index.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme-VMRlhqST.d.cts +9 -0
- package/dist/theme-VMRlhqST.d.ts +9 -0
- package/dist/wallet/index.cjs +17 -5
- package/dist/wallet/index.cjs.map +1 -1
- package/dist/wallet/index.d.cts +2 -2
- package/dist/wallet/index.d.ts +2 -2
- package/dist/wallet/index.js +17 -5
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/sdk.cjs +6 -3
- package/dist/wallet/sdk.cjs.map +1 -1
- package/dist/wallet/sdk.js +6 -3
- package/dist/wallet/sdk.js.map +1 -1
- package/package.json +17 -10
- package/dist/showcase/index.cjs +0 -2851
- package/dist/showcase/index.cjs.map +0 -1
- package/dist/showcase/index.d.cts +0 -19
- package/dist/showcase/index.d.ts +0 -19
- package/dist/showcase/index.js +0 -2839
- package/dist/showcase/index.js.map +0 -1
- package/dist/theme-DfHMjWB7.d.cts +0 -16
- package/dist/theme-DfHMjWB7.d.ts +0 -16
- package/dist/wallet.css +0 -73
package/dist/modality/index.cjs
CHANGED
|
@@ -20,42 +20,50 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/modules/modality/index.ts
|
|
21
21
|
var modality_exports = {};
|
|
22
22
|
__export(modality_exports, {
|
|
23
|
-
ModalityButton: () => ModalityButton,
|
|
24
23
|
getModalityColors: () => getModalityColors
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(modality_exports);
|
|
27
26
|
|
|
28
27
|
// src/modules/modality/colors.ts
|
|
28
|
+
var filled = "polli:bg-theme-bg-active polli:text-theme-text-strong";
|
|
29
|
+
var hover = "polli:hover:bg-theme-bg-subtle polli:hover:text-theme-text-strong";
|
|
30
|
+
var text = "polli:text-theme-text-strong";
|
|
29
31
|
var MODALITY_COLORS = {
|
|
30
32
|
text: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
theme: "blue",
|
|
34
|
+
filled,
|
|
35
|
+
hover,
|
|
36
|
+
text
|
|
34
37
|
},
|
|
35
38
|
image: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
theme: "pink",
|
|
40
|
+
filled,
|
|
41
|
+
hover,
|
|
42
|
+
text
|
|
39
43
|
},
|
|
40
44
|
video: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
theme: "teal",
|
|
46
|
+
filled,
|
|
47
|
+
hover,
|
|
48
|
+
text
|
|
44
49
|
},
|
|
45
50
|
audio: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
theme: "violet",
|
|
52
|
+
filled,
|
|
53
|
+
hover,
|
|
54
|
+
text
|
|
49
55
|
},
|
|
50
56
|
realtime: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
theme: "green",
|
|
58
|
+
filled,
|
|
59
|
+
hover,
|
|
60
|
+
text
|
|
54
61
|
},
|
|
55
62
|
embedding: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
theme: "amber",
|
|
64
|
+
filled,
|
|
65
|
+
hover,
|
|
66
|
+
text
|
|
59
67
|
}
|
|
60
68
|
};
|
|
61
69
|
function normalize(category) {
|
|
@@ -71,45 +79,8 @@ function getModalityColors(category) {
|
|
|
71
79
|
const key = normalize(category);
|
|
72
80
|
return key ? MODALITY_COLORS[key] : null;
|
|
73
81
|
}
|
|
74
|
-
|
|
75
|
-
// src/lib/cn.ts
|
|
76
|
-
var import_clsx = require("clsx");
|
|
77
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
78
|
-
var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({ prefix: "polli" });
|
|
79
|
-
function cn(...inputs) {
|
|
80
|
-
return twMerge((0, import_clsx.clsx)(...inputs));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// src/modules/modality/ModalityButton.tsx
|
|
84
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
85
|
-
var ModalityButton = ({
|
|
86
|
-
category,
|
|
87
|
-
selected = true,
|
|
88
|
-
onClick,
|
|
89
|
-
disabled,
|
|
90
|
-
children
|
|
91
|
-
}) => {
|
|
92
|
-
const colors = getModalityColors(category ?? "");
|
|
93
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
-
"button",
|
|
95
|
-
{
|
|
96
|
-
type: "button",
|
|
97
|
-
onClick,
|
|
98
|
-
disabled,
|
|
99
|
-
"aria-pressed": selected,
|
|
100
|
-
className: cn(
|
|
101
|
-
"polli:inline-flex polli:shrink-0 polli:items-center polli:gap-1 polli:rounded-full polli:px-3 polli:py-1 polli:text-left polli:text-sm polli:font-medium polli:leading-normal polli:transition-colors",
|
|
102
|
-
selected ? colors?.filled ?? "polli:bg-gray-200 polli:text-gray-900" : "polli:bg-gray-100 polli:text-gray-600",
|
|
103
|
-
!disabled && !selected && colors?.hover,
|
|
104
|
-
disabled ? "polli:cursor-not-allowed polli:opacity-50" : "polli:cursor-pointer"
|
|
105
|
-
),
|
|
106
|
-
children
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
83
|
0 && (module.exports = {
|
|
112
|
-
ModalityButton,
|
|
113
84
|
getModalityColors
|
|
114
85
|
});
|
|
115
86
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/modality/index.ts","../../src/modules/modality/colors.ts"
|
|
1
|
+
{"version":3,"sources":["../../src/modules/modality/index.ts","../../src/modules/modality/colors.ts"],"sourcesContent":["export {\n getModalityColors,\n type Modality,\n type ModalityColorSet,\n} from \"./colors.ts\";\n","/**\n * Single source of truth for modality colors.\n *\n * Each modality (text/image/video/audio/realtime/embedding) maps to one\n * package theme. Class recipes are token-based, so callers should pass the\n * returned `theme` to the primitive or set `data-theme` on an ancestor.\n * Used by apps to compose model-selection buttons and static modality chips.\n * This module only owns modality color data; primitives own shape and behavior.\n */\nimport type { ThemeName } from \"../../theme.ts\";\n\nexport type Modality =\n | \"text\"\n | \"image\"\n | \"video\"\n | \"audio\"\n | \"realtime\"\n | \"embedding\";\n\nexport type ModalityColorSet = {\n /** Matching package theme for surfaces/chips that should inherit this hue. */\n theme: ThemeName;\n /** Selected/filled state using the active theme tokens. */\n filled: string;\n /** Hover hint shown on the unselected button using the active theme. */\n hover: string;\n /** Heading text colour using the active theme. */\n text: string;\n};\n\nconst filled = \"polli:bg-theme-bg-active polli:text-theme-text-strong\";\nconst hover =\n \"polli:hover:bg-theme-bg-subtle polli:hover:text-theme-text-strong\";\nconst text = \"polli:text-theme-text-strong\";\n\n// No borders — chips and buttons in this system are borderless.\nexport const MODALITY_COLORS: Record<Modality, ModalityColorSet> = {\n text: {\n theme: \"blue\",\n filled,\n hover,\n text,\n },\n image: {\n theme: \"pink\",\n filled,\n hover,\n text,\n },\n video: {\n theme: \"teal\",\n filled,\n hover,\n text,\n },\n audio: {\n theme: \"violet\",\n filled,\n hover,\n text,\n },\n realtime: {\n theme: \"green\",\n filled,\n hover,\n text,\n },\n embedding: {\n theme: \"amber\",\n filled,\n hover,\n text,\n },\n};\n\n/** Map any human-typed category string to the canonical `Modality` key. */\nfunction normalize(category: string): Modality | null {\n const lower = category.toLowerCase();\n if (lower === \"images\") return \"image\";\n if (lower === \"embeddings\") return \"embedding\";\n if (\n lower === \"text\" ||\n lower === \"image\" ||\n lower === \"video\" ||\n lower === \"audio\" ||\n lower === \"realtime\" ||\n lower === \"embedding\"\n ) {\n return lower;\n }\n return null;\n}\n\nexport function getModalityColors(category: string): ModalityColorSet | null {\n const key = normalize(category);\n return key ? MODALITY_COLORS[key] : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC8BA,IAAM,SAAS;AACf,IAAM,QACF;AACJ,IAAM,OAAO;AAGN,IAAM,kBAAsD;AAAA,EAC/D,MAAM;AAAA,IACF,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,OAAO;AAAA,IACH,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,OAAO;AAAA,IACH,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,OAAO;AAAA,IACH,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,UAAU;AAAA,IACN,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,WAAW;AAAA,IACP,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AAGA,SAAS,UAAU,UAAmC;AAClD,QAAM,QAAQ,SAAS,YAAY;AACnC,MAAI,UAAU,SAAU,QAAO;AAC/B,MAAI,UAAU,aAAc,QAAO;AACnC,MACI,UAAU,UACV,UAAU,WACV,UAAU,WACV,UAAU,WACV,UAAU,cACV,UAAU,aACZ;AACE,WAAO;AAAA,EACX;AACA,SAAO;AACX;AAEO,SAAS,kBAAkB,UAA2C;AACzE,QAAM,MAAM,UAAU,QAAQ;AAC9B,SAAO,MAAM,gBAAgB,GAAG,IAAI;AACxC;","names":[]}
|
|
@@ -1,45 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as ThemeName } from '../theme-VMRlhqST.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Single source of truth for modality colors.
|
|
5
5
|
*
|
|
6
|
-
* Each modality (text/image/video/audio/realtime/embedding)
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Interactive selection (model-picker) renders as `rounded-full` pills
|
|
13
|
-
* aligned to the canonical Button. Static display (authorize summary)
|
|
14
|
-
* renders as `rounded-lg` chips. Page-theme hues only — no rogue
|
|
15
|
-
* indigo/rose.
|
|
6
|
+
* Each modality (text/image/video/audio/realtime/embedding) maps to one
|
|
7
|
+
* package theme. Class recipes are token-based, so callers should pass the
|
|
8
|
+
* returned `theme` to the primitive or set `data-theme` on an ancestor.
|
|
9
|
+
* Used by apps to compose model-selection buttons and static modality chips.
|
|
10
|
+
* This module only owns modality color data; primitives own shape and behavior.
|
|
16
11
|
*/
|
|
12
|
+
|
|
17
13
|
type Modality = "text" | "image" | "video" | "audio" | "realtime" | "embedding";
|
|
18
14
|
type ModalityColorSet = {
|
|
19
|
-
/**
|
|
15
|
+
/** Matching package theme for surfaces/chips that should inherit this hue. */
|
|
16
|
+
theme: ThemeName;
|
|
17
|
+
/** Selected/filled state using the active theme tokens. */
|
|
20
18
|
filled: string;
|
|
21
|
-
/** Hover hint shown on the unselected button
|
|
19
|
+
/** Hover hint shown on the unselected button using the active theme. */
|
|
22
20
|
hover: string;
|
|
23
|
-
/** Heading text colour
|
|
21
|
+
/** Heading text colour using the active theme. */
|
|
24
22
|
text: string;
|
|
25
23
|
};
|
|
26
24
|
declare function getModalityColors(category: string): ModalityColorSet | null;
|
|
27
25
|
|
|
28
|
-
type
|
|
29
|
-
/** Modality key or category string ("Text", "Images", etc). */
|
|
30
|
-
category?: string;
|
|
31
|
-
/** Filled (modality hue) when true, muted gray when false. */
|
|
32
|
-
selected?: boolean;
|
|
33
|
-
onClick?: () => void;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
children: ReactNode;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Rounded-full pill button colored by modality. Single source of truth
|
|
39
|
-
* for every interactive modality affordance — model picker, design
|
|
40
|
-
* showcase, etc. Shape and recipe live here; consumers only supply
|
|
41
|
-
* content + state.
|
|
42
|
-
*/
|
|
43
|
-
declare const ModalityButton: FC<ModalityButtonProps>;
|
|
44
|
-
|
|
45
|
-
export { type Modality, ModalityButton, type ModalityButtonProps, type ModalityColorSet, getModalityColors };
|
|
26
|
+
export { type Modality, type ModalityColorSet, getModalityColors };
|
package/dist/modality/index.d.ts
CHANGED
|
@@ -1,45 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as ThemeName } from '../theme-VMRlhqST.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Single source of truth for modality colors.
|
|
5
5
|
*
|
|
6
|
-
* Each modality (text/image/video/audio/realtime/embedding)
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Interactive selection (model-picker) renders as `rounded-full` pills
|
|
13
|
-
* aligned to the canonical Button. Static display (authorize summary)
|
|
14
|
-
* renders as `rounded-lg` chips. Page-theme hues only — no rogue
|
|
15
|
-
* indigo/rose.
|
|
6
|
+
* Each modality (text/image/video/audio/realtime/embedding) maps to one
|
|
7
|
+
* package theme. Class recipes are token-based, so callers should pass the
|
|
8
|
+
* returned `theme` to the primitive or set `data-theme` on an ancestor.
|
|
9
|
+
* Used by apps to compose model-selection buttons and static modality chips.
|
|
10
|
+
* This module only owns modality color data; primitives own shape and behavior.
|
|
16
11
|
*/
|
|
12
|
+
|
|
17
13
|
type Modality = "text" | "image" | "video" | "audio" | "realtime" | "embedding";
|
|
18
14
|
type ModalityColorSet = {
|
|
19
|
-
/**
|
|
15
|
+
/** Matching package theme for surfaces/chips that should inherit this hue. */
|
|
16
|
+
theme: ThemeName;
|
|
17
|
+
/** Selected/filled state using the active theme tokens. */
|
|
20
18
|
filled: string;
|
|
21
|
-
/** Hover hint shown on the unselected button
|
|
19
|
+
/** Hover hint shown on the unselected button using the active theme. */
|
|
22
20
|
hover: string;
|
|
23
|
-
/** Heading text colour
|
|
21
|
+
/** Heading text colour using the active theme. */
|
|
24
22
|
text: string;
|
|
25
23
|
};
|
|
26
24
|
declare function getModalityColors(category: string): ModalityColorSet | null;
|
|
27
25
|
|
|
28
|
-
type
|
|
29
|
-
/** Modality key or category string ("Text", "Images", etc). */
|
|
30
|
-
category?: string;
|
|
31
|
-
/** Filled (modality hue) when true, muted gray when false. */
|
|
32
|
-
selected?: boolean;
|
|
33
|
-
onClick?: () => void;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
children: ReactNode;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Rounded-full pill button colored by modality. Single source of truth
|
|
39
|
-
* for every interactive modality affordance — model picker, design
|
|
40
|
-
* showcase, etc. Shape and recipe live here; consumers only supply
|
|
41
|
-
* content + state.
|
|
42
|
-
*/
|
|
43
|
-
declare const ModalityButton: FC<ModalityButtonProps>;
|
|
44
|
-
|
|
45
|
-
export { type Modality, ModalityButton, type ModalityButtonProps, type ModalityColorSet, getModalityColors };
|
|
26
|
+
export { type Modality, type ModalityColorSet, getModalityColors };
|
package/dist/modality/index.js
CHANGED
|
@@ -1,34 +1,43 @@
|
|
|
1
1
|
// src/modules/modality/colors.ts
|
|
2
|
+
var filled = "polli:bg-theme-bg-active polli:text-theme-text-strong";
|
|
3
|
+
var hover = "polli:hover:bg-theme-bg-subtle polli:hover:text-theme-text-strong";
|
|
4
|
+
var text = "polli:text-theme-text-strong";
|
|
2
5
|
var MODALITY_COLORS = {
|
|
3
6
|
text: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
theme: "blue",
|
|
8
|
+
filled,
|
|
9
|
+
hover,
|
|
10
|
+
text
|
|
7
11
|
},
|
|
8
12
|
image: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
theme: "pink",
|
|
14
|
+
filled,
|
|
15
|
+
hover,
|
|
16
|
+
text
|
|
12
17
|
},
|
|
13
18
|
video: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
theme: "teal",
|
|
20
|
+
filled,
|
|
21
|
+
hover,
|
|
22
|
+
text
|
|
17
23
|
},
|
|
18
24
|
audio: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
theme: "violet",
|
|
26
|
+
filled,
|
|
27
|
+
hover,
|
|
28
|
+
text
|
|
22
29
|
},
|
|
23
30
|
realtime: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
theme: "green",
|
|
32
|
+
filled,
|
|
33
|
+
hover,
|
|
34
|
+
text
|
|
27
35
|
},
|
|
28
36
|
embedding: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
theme: "amber",
|
|
38
|
+
filled,
|
|
39
|
+
hover,
|
|
40
|
+
text
|
|
32
41
|
}
|
|
33
42
|
};
|
|
34
43
|
function normalize(category) {
|
|
@@ -44,44 +53,7 @@ function getModalityColors(category) {
|
|
|
44
53
|
const key = normalize(category);
|
|
45
54
|
return key ? MODALITY_COLORS[key] : null;
|
|
46
55
|
}
|
|
47
|
-
|
|
48
|
-
// src/lib/cn.ts
|
|
49
|
-
import { clsx } from "clsx";
|
|
50
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
51
|
-
var twMerge = extendTailwindMerge({ prefix: "polli" });
|
|
52
|
-
function cn(...inputs) {
|
|
53
|
-
return twMerge(clsx(...inputs));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// src/modules/modality/ModalityButton.tsx
|
|
57
|
-
import { jsx } from "react/jsx-runtime";
|
|
58
|
-
var ModalityButton = ({
|
|
59
|
-
category,
|
|
60
|
-
selected = true,
|
|
61
|
-
onClick,
|
|
62
|
-
disabled,
|
|
63
|
-
children
|
|
64
|
-
}) => {
|
|
65
|
-
const colors = getModalityColors(category ?? "");
|
|
66
|
-
return /* @__PURE__ */ jsx(
|
|
67
|
-
"button",
|
|
68
|
-
{
|
|
69
|
-
type: "button",
|
|
70
|
-
onClick,
|
|
71
|
-
disabled,
|
|
72
|
-
"aria-pressed": selected,
|
|
73
|
-
className: cn(
|
|
74
|
-
"polli:inline-flex polli:shrink-0 polli:items-center polli:gap-1 polli:rounded-full polli:px-3 polli:py-1 polli:text-left polli:text-sm polli:font-medium polli:leading-normal polli:transition-colors",
|
|
75
|
-
selected ? colors?.filled ?? "polli:bg-gray-200 polli:text-gray-900" : "polli:bg-gray-100 polli:text-gray-600",
|
|
76
|
-
!disabled && !selected && colors?.hover,
|
|
77
|
-
disabled ? "polli:cursor-not-allowed polli:opacity-50" : "polli:cursor-pointer"
|
|
78
|
-
),
|
|
79
|
-
children
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
56
|
export {
|
|
84
|
-
ModalityButton,
|
|
85
57
|
getModalityColors
|
|
86
58
|
};
|
|
87
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/modality/colors.ts"
|
|
1
|
+
{"version":3,"sources":["../../src/modules/modality/colors.ts"],"sourcesContent":["/**\n * Single source of truth for modality colors.\n *\n * Each modality (text/image/video/audio/realtime/embedding) maps to one\n * package theme. Class recipes are token-based, so callers should pass the\n * returned `theme` to the primitive or set `data-theme` on an ancestor.\n * Used by apps to compose model-selection buttons and static modality chips.\n * This module only owns modality color data; primitives own shape and behavior.\n */\nimport type { ThemeName } from \"../../theme.ts\";\n\nexport type Modality =\n | \"text\"\n | \"image\"\n | \"video\"\n | \"audio\"\n | \"realtime\"\n | \"embedding\";\n\nexport type ModalityColorSet = {\n /** Matching package theme for surfaces/chips that should inherit this hue. */\n theme: ThemeName;\n /** Selected/filled state using the active theme tokens. */\n filled: string;\n /** Hover hint shown on the unselected button using the active theme. */\n hover: string;\n /** Heading text colour using the active theme. */\n text: string;\n};\n\nconst filled = \"polli:bg-theme-bg-active polli:text-theme-text-strong\";\nconst hover =\n \"polli:hover:bg-theme-bg-subtle polli:hover:text-theme-text-strong\";\nconst text = \"polli:text-theme-text-strong\";\n\n// No borders — chips and buttons in this system are borderless.\nexport const MODALITY_COLORS: Record<Modality, ModalityColorSet> = {\n text: {\n theme: \"blue\",\n filled,\n hover,\n text,\n },\n image: {\n theme: \"pink\",\n filled,\n hover,\n text,\n },\n video: {\n theme: \"teal\",\n filled,\n hover,\n text,\n },\n audio: {\n theme: \"violet\",\n filled,\n hover,\n text,\n },\n realtime: {\n theme: \"green\",\n filled,\n hover,\n text,\n },\n embedding: {\n theme: \"amber\",\n filled,\n hover,\n text,\n },\n};\n\n/** Map any human-typed category string to the canonical `Modality` key. */\nfunction normalize(category: string): Modality | null {\n const lower = category.toLowerCase();\n if (lower === \"images\") return \"image\";\n if (lower === \"embeddings\") return \"embedding\";\n if (\n lower === \"text\" ||\n lower === \"image\" ||\n lower === \"video\" ||\n lower === \"audio\" ||\n lower === \"realtime\" ||\n lower === \"embedding\"\n ) {\n return lower;\n }\n return null;\n}\n\nexport function getModalityColors(category: string): ModalityColorSet | null {\n const key = normalize(category);\n return key ? MODALITY_COLORS[key] : null;\n}\n"],"mappings":";AA8BA,IAAM,SAAS;AACf,IAAM,QACF;AACJ,IAAM,OAAO;AAGN,IAAM,kBAAsD;AAAA,EAC/D,MAAM;AAAA,IACF,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,OAAO;AAAA,IACH,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,OAAO;AAAA,IACH,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,OAAO;AAAA,IACH,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,UAAU;AAAA,IACN,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,WAAW;AAAA,IACP,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AAGA,SAAS,UAAU,UAAmC;AAClD,QAAM,QAAQ,SAAS,YAAY;AACnC,MAAI,UAAU,SAAU,QAAO;AAC/B,MAAI,UAAU,aAAc,QAAO;AACnC,MACI,UAAU,UACV,UAAU,WACV,UAAU,WACV,UAAU,WACV,UAAU,cACV,UAAU,aACZ;AACE,WAAO;AAAA,EACX;AACA,SAAO;AACX;AAEO,SAAS,kBAAkB,UAA2C;AACzE,QAAM,MAAM,UAAU,QAAQ;AAC9B,SAAO,MAAM,gBAAgB,GAAG,IAAI;AACxC;","names":[]}
|