@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.
Files changed (65) hide show
  1. package/README.md +25 -16
  2. package/dist/{Button-DMJ2K6Gr.d.ts → Button-BvLF_Km2.d.cts} +4 -4
  3. package/dist/{Button-CNzpisJf.d.cts → Button-DQAZzvyQ.d.ts} +4 -4
  4. package/dist/{Chip-BS8ronOu.d.ts → Chip-C5impfYd.d.ts} +2 -2
  5. package/dist/{Chip-DyqWrq0r.d.cts → Chip-SM52sUbZ.d.cts} +2 -2
  6. package/dist/app.css +1 -1
  7. package/dist/auth/index.cjs +78 -71
  8. package/dist/auth/index.cjs.map +1 -1
  9. package/dist/auth/index.d.cts +1 -2
  10. package/dist/auth/index.d.ts +1 -2
  11. package/dist/auth/index.js +78 -71
  12. package/dist/auth/index.js.map +1 -1
  13. package/dist/auth/sdk.cjs +7 -6
  14. package/dist/auth/sdk.cjs.map +1 -1
  15. package/dist/auth/sdk.d.cts +2 -2
  16. package/dist/auth/sdk.d.ts +2 -2
  17. package/dist/auth/sdk.js +7 -6
  18. package/dist/auth/sdk.js.map +1 -1
  19. package/dist/compositions/app-user.cjs +497 -0
  20. package/dist/compositions/app-user.cjs.map +1 -0
  21. package/dist/compositions/app-user.d.cts +18 -0
  22. package/dist/compositions/app-user.d.ts +18 -0
  23. package/dist/compositions/app-user.js +469 -0
  24. package/dist/compositions/app-user.js.map +1 -0
  25. package/dist/index.cjs +1151 -312
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +146 -13
  28. package/dist/index.d.ts +146 -13
  29. package/dist/index.js +1109 -295
  30. package/dist/index.js.map +1 -1
  31. package/dist/modality/index.cjs +27 -56
  32. package/dist/modality/index.cjs.map +1 -1
  33. package/dist/modality/index.d.cts +13 -32
  34. package/dist/modality/index.d.ts +13 -32
  35. package/dist/modality/index.js +27 -55
  36. package/dist/modality/index.js.map +1 -1
  37. package/dist/models/index.cjs +508 -0
  38. package/dist/models/index.cjs.map +1 -0
  39. package/dist/models/index.d.cts +22 -0
  40. package/dist/models/index.d.ts +22 -0
  41. package/dist/models/index.js +486 -0
  42. package/dist/models/index.js.map +1 -0
  43. package/dist/styles.css +1 -1
  44. package/dist/theme-VMRlhqST.d.cts +9 -0
  45. package/dist/theme-VMRlhqST.d.ts +9 -0
  46. package/dist/wallet/index.cjs +17 -5
  47. package/dist/wallet/index.cjs.map +1 -1
  48. package/dist/wallet/index.d.cts +2 -2
  49. package/dist/wallet/index.d.ts +2 -2
  50. package/dist/wallet/index.js +17 -5
  51. package/dist/wallet/index.js.map +1 -1
  52. package/dist/wallet/sdk.cjs +6 -3
  53. package/dist/wallet/sdk.cjs.map +1 -1
  54. package/dist/wallet/sdk.js +6 -3
  55. package/dist/wallet/sdk.js.map +1 -1
  56. package/package.json +17 -10
  57. package/dist/showcase/index.cjs +0 -2851
  58. package/dist/showcase/index.cjs.map +0 -1
  59. package/dist/showcase/index.d.cts +0 -19
  60. package/dist/showcase/index.d.ts +0 -19
  61. package/dist/showcase/index.js +0 -2839
  62. package/dist/showcase/index.js.map +0 -1
  63. package/dist/theme-DfHMjWB7.d.cts +0 -16
  64. package/dist/theme-DfHMjWB7.d.ts +0 -16
  65. package/dist/wallet.css +0 -73
@@ -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
- filled: "polli:bg-blue-200 polli:text-blue-900",
32
- hover: "polli:hover:bg-blue-100 polli:hover:text-blue-900",
33
- text: "polli:text-blue-800"
33
+ theme: "blue",
34
+ filled,
35
+ hover,
36
+ text
34
37
  },
35
38
  image: {
36
- filled: "polli:bg-pink-200 polli:text-pink-900",
37
- hover: "polli:hover:bg-pink-100 polli:hover:text-pink-900",
38
- text: "polli:text-pink-800"
39
+ theme: "pink",
40
+ filled,
41
+ hover,
42
+ text
39
43
  },
40
44
  video: {
41
- filled: "polli:bg-teal-200 polli:text-teal-900",
42
- hover: "polli:hover:bg-teal-100 polli:hover:text-teal-900",
43
- text: "polli:text-teal-800"
45
+ theme: "teal",
46
+ filled,
47
+ hover,
48
+ text
44
49
  },
45
50
  audio: {
46
- filled: "polli:bg-violet-200 polli:text-violet-900",
47
- hover: "polli:hover:bg-violet-100 polli:hover:text-violet-900",
48
- text: "polli:text-violet-800"
51
+ theme: "violet",
52
+ filled,
53
+ hover,
54
+ text
49
55
  },
50
56
  realtime: {
51
- filled: "polli:bg-green-200 polli:text-green-900",
52
- hover: "polli:hover:bg-green-100 polli:hover:text-green-900",
53
- text: "polli:text-green-800"
57
+ theme: "green",
58
+ filled,
59
+ hover,
60
+ text
54
61
  },
55
62
  embedding: {
56
- filled: "polli:bg-amber-200 polli:text-amber-900",
57
- hover: "polli:hover:bg-amber-100 polli:hover:text-amber-900",
58
- text: "polli:text-amber-800"
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","../../src/lib/cn.ts","../../src/modules/modality/ModalityButton.tsx"],"sourcesContent":["export {\n getModalityColors,\n type Modality,\n type ModalityColorSet,\n} from \"./colors.ts\";\nexport { ModalityButton, type ModalityButtonProps } from \"./ModalityButton.tsx\";\n","/**\n * Single source of truth for modality colors.\n *\n * Each modality (text/image/video/audio/realtime/embedding) gets one\n * page-theme hue, applied at the soft `-200/-900/-400` chip recipe.\n * Used in two places:\n * 1. The model-selection buttons in the API key creation flow.\n * 2. The static modality chips on the OAuth authorize screen.\n *\n * Interactive selection (model-picker) renders as `rounded-full` pills\n * aligned to the canonical Button. Static display (authorize summary)\n * renders as `rounded-lg` chips. Page-theme hues only — no rogue\n * indigo/rose.\n */\nexport type Modality =\n | \"text\"\n | \"image\"\n | \"video\"\n | \"audio\"\n | \"realtime\"\n | \"embedding\";\n\nexport type ModalityColorSet = {\n /** Selected/filled state: `bg + text + border` classes. */\n filled: string;\n /** Hover hint shown on the unselected button (subtle tint). */\n hover: string;\n /** Heading text colour for the category label. */\n text: string;\n};\n\n// No borders — chips and buttons in this system are borderless.\nexport const MODALITY_COLORS: Record<Modality, ModalityColorSet> = {\n text: {\n filled: \"polli:bg-blue-200 polli:text-blue-900\",\n hover: \"polli:hover:bg-blue-100 polli:hover:text-blue-900\",\n text: \"polli:text-blue-800\",\n },\n image: {\n filled: \"polli:bg-pink-200 polli:text-pink-900\",\n hover: \"polli:hover:bg-pink-100 polli:hover:text-pink-900\",\n text: \"polli:text-pink-800\",\n },\n video: {\n filled: \"polli:bg-teal-200 polli:text-teal-900\",\n hover: \"polli:hover:bg-teal-100 polli:hover:text-teal-900\",\n text: \"polli:text-teal-800\",\n },\n audio: {\n filled: \"polli:bg-violet-200 polli:text-violet-900\",\n hover: \"polli:hover:bg-violet-100 polli:hover:text-violet-900\",\n text: \"polli:text-violet-800\",\n },\n realtime: {\n filled: \"polli:bg-green-200 polli:text-green-900\",\n hover: \"polli:hover:bg-green-100 polli:hover:text-green-900\",\n text: \"polli:text-green-800\",\n },\n embedding: {\n filled: \"polli:bg-amber-200 polli:text-amber-900\",\n hover: \"polli:hover:bg-amber-100 polli:hover:text-amber-900\",\n text: \"polli:text-amber-800\",\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","import { clsx } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({ prefix: \"polli\" });\n\n/** Internal class merge for polli:-prefixed package primitive classes. */\nexport function cn(...inputs: (string | undefined | null | false)[]) {\n return twMerge(clsx(...inputs));\n}\n","import type { FC, ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn.ts\";\nimport { getModalityColors } from \"./colors.ts\";\n\nexport type ModalityButtonProps = {\n /** Modality key or category string (\"Text\", \"Images\", etc). */\n category?: string;\n /** Filled (modality hue) when true, muted gray when false. */\n selected?: boolean;\n onClick?: () => void;\n disabled?: boolean;\n children: ReactNode;\n};\n\n/**\n * Rounded-full pill button colored by modality. Single source of truth\n * for every interactive modality affordance — model picker, design\n * showcase, etc. Shape and recipe live here; consumers only supply\n * content + state.\n */\nexport const ModalityButton: FC<ModalityButtonProps> = ({\n category,\n selected = true,\n onClick,\n disabled,\n children,\n}) => {\n const colors = getModalityColors(category ?? \"\");\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-pressed={selected}\n className={cn(\n \"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\",\n selected\n ? (colors?.filled ??\n \"polli:bg-gray-200 polli:text-gray-900\")\n : \"polli:bg-gray-100 polli:text-gray-600\",\n !disabled && !selected && colors?.hover,\n disabled\n ? \"polli:cursor-not-allowed polli:opacity-50\"\n : \"polli:cursor-pointer\",\n )}\n >\n {children}\n </button>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgCO,IAAM,kBAAsD;AAAA,EAC/D,MAAM;AAAA,IACF,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACH,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACH,QAA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/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 { FC, ReactNode } from 'react';
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) gets one
7
- * page-theme hue, applied at the soft `-200/-900/-400` chip recipe.
8
- * Used in two places:
9
- * 1. The model-selection buttons in the API key creation flow.
10
- * 2. The static modality chips on the OAuth authorize screen.
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
- /** Selected/filled state: `bg + text + border` classes. */
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 (subtle tint). */
19
+ /** Hover hint shown on the unselected button using the active theme. */
22
20
  hover: string;
23
- /** Heading text colour for the category label. */
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 ModalityButtonProps = {
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 };
@@ -1,45 +1,26 @@
1
- import { FC, ReactNode } from 'react';
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) gets one
7
- * page-theme hue, applied at the soft `-200/-900/-400` chip recipe.
8
- * Used in two places:
9
- * 1. The model-selection buttons in the API key creation flow.
10
- * 2. The static modality chips on the OAuth authorize screen.
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
- /** Selected/filled state: `bg + text + border` classes. */
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 (subtle tint). */
19
+ /** Hover hint shown on the unselected button using the active theme. */
22
20
  hover: string;
23
- /** Heading text colour for the category label. */
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 ModalityButtonProps = {
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 };
@@ -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
- filled: "polli:bg-blue-200 polli:text-blue-900",
5
- hover: "polli:hover:bg-blue-100 polli:hover:text-blue-900",
6
- text: "polli:text-blue-800"
7
+ theme: "blue",
8
+ filled,
9
+ hover,
10
+ text
7
11
  },
8
12
  image: {
9
- filled: "polli:bg-pink-200 polli:text-pink-900",
10
- hover: "polli:hover:bg-pink-100 polli:hover:text-pink-900",
11
- text: "polli:text-pink-800"
13
+ theme: "pink",
14
+ filled,
15
+ hover,
16
+ text
12
17
  },
13
18
  video: {
14
- filled: "polli:bg-teal-200 polli:text-teal-900",
15
- hover: "polli:hover:bg-teal-100 polli:hover:text-teal-900",
16
- text: "polli:text-teal-800"
19
+ theme: "teal",
20
+ filled,
21
+ hover,
22
+ text
17
23
  },
18
24
  audio: {
19
- filled: "polli:bg-violet-200 polli:text-violet-900",
20
- hover: "polli:hover:bg-violet-100 polli:hover:text-violet-900",
21
- text: "polli:text-violet-800"
25
+ theme: "violet",
26
+ filled,
27
+ hover,
28
+ text
22
29
  },
23
30
  realtime: {
24
- filled: "polli:bg-green-200 polli:text-green-900",
25
- hover: "polli:hover:bg-green-100 polli:hover:text-green-900",
26
- text: "polli:text-green-800"
31
+ theme: "green",
32
+ filled,
33
+ hover,
34
+ text
27
35
  },
28
36
  embedding: {
29
- filled: "polli:bg-amber-200 polli:text-amber-900",
30
- hover: "polli:hover:bg-amber-100 polli:hover:text-amber-900",
31
- text: "polli:text-amber-800"
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","../../src/lib/cn.ts","../../src/modules/modality/ModalityButton.tsx"],"sourcesContent":["/**\n * Single source of truth for modality colors.\n *\n * Each modality (text/image/video/audio/realtime/embedding) gets one\n * page-theme hue, applied at the soft `-200/-900/-400` chip recipe.\n * Used in two places:\n * 1. The model-selection buttons in the API key creation flow.\n * 2. The static modality chips on the OAuth authorize screen.\n *\n * Interactive selection (model-picker) renders as `rounded-full` pills\n * aligned to the canonical Button. Static display (authorize summary)\n * renders as `rounded-lg` chips. Page-theme hues only — no rogue\n * indigo/rose.\n */\nexport type Modality =\n | \"text\"\n | \"image\"\n | \"video\"\n | \"audio\"\n | \"realtime\"\n | \"embedding\";\n\nexport type ModalityColorSet = {\n /** Selected/filled state: `bg + text + border` classes. */\n filled: string;\n /** Hover hint shown on the unselected button (subtle tint). */\n hover: string;\n /** Heading text colour for the category label. */\n text: string;\n};\n\n// No borders — chips and buttons in this system are borderless.\nexport const MODALITY_COLORS: Record<Modality, ModalityColorSet> = {\n text: {\n filled: \"polli:bg-blue-200 polli:text-blue-900\",\n hover: \"polli:hover:bg-blue-100 polli:hover:text-blue-900\",\n text: \"polli:text-blue-800\",\n },\n image: {\n filled: \"polli:bg-pink-200 polli:text-pink-900\",\n hover: \"polli:hover:bg-pink-100 polli:hover:text-pink-900\",\n text: \"polli:text-pink-800\",\n },\n video: {\n filled: \"polli:bg-teal-200 polli:text-teal-900\",\n hover: \"polli:hover:bg-teal-100 polli:hover:text-teal-900\",\n text: \"polli:text-teal-800\",\n },\n audio: {\n filled: \"polli:bg-violet-200 polli:text-violet-900\",\n hover: \"polli:hover:bg-violet-100 polli:hover:text-violet-900\",\n text: \"polli:text-violet-800\",\n },\n realtime: {\n filled: \"polli:bg-green-200 polli:text-green-900\",\n hover: \"polli:hover:bg-green-100 polli:hover:text-green-900\",\n text: \"polli:text-green-800\",\n },\n embedding: {\n filled: \"polli:bg-amber-200 polli:text-amber-900\",\n hover: \"polli:hover:bg-amber-100 polli:hover:text-amber-900\",\n text: \"polli:text-amber-800\",\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","import { clsx } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({ prefix: \"polli\" });\n\n/** Internal class merge for polli:-prefixed package primitive classes. */\nexport function cn(...inputs: (string | undefined | null | false)[]) {\n return twMerge(clsx(...inputs));\n}\n","import type { FC, ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn.ts\";\nimport { getModalityColors } from \"./colors.ts\";\n\nexport type ModalityButtonProps = {\n /** Modality key or category string (\"Text\", \"Images\", etc). */\n category?: string;\n /** Filled (modality hue) when true, muted gray when false. */\n selected?: boolean;\n onClick?: () => void;\n disabled?: boolean;\n children: ReactNode;\n};\n\n/**\n * Rounded-full pill button colored by modality. Single source of truth\n * for every interactive modality affordance — model picker, design\n * showcase, etc. Shape and recipe live here; consumers only supply\n * content + state.\n */\nexport const ModalityButton: FC<ModalityButtonProps> = ({\n category,\n selected = true,\n onClick,\n disabled,\n children,\n}) => {\n const colors = getModalityColors(category ?? \"\");\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-pressed={selected}\n className={cn(\n \"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\",\n selected\n ? (colors?.filled ??\n \"polli:bg-gray-200 polli:text-gray-900\")\n : \"polli:bg-gray-100 polli:text-gray-600\",\n !disabled && !selected && colors?.hover,\n disabled\n ? \"polli:cursor-not-allowed polli:opacity-50\"\n : \"polli:cursor-pointer\",\n )}\n >\n {children}\n </button>\n );\n};\n"],"mappings":";AAgCO,IAAM,kBAAsD;AAAA,EAC/D,MAAM;AAAA,IACF,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACH,QAAQ;AAAA,IACR,OAAO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;AAAA,MAEC;AAAA;AAAA,EACL;AAER;","names":[]}
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":[]}