@pollinations/ui 0.1.0-alpha.41 → 0.1.0-alpha.42
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 +5 -1
- package/dist/app-user-menu/sdk.d.ts +4 -2
- package/dist/app-user-menu/sdk.js +14 -13
- package/dist/app-user-menu/sdk.js.map +1 -1
- package/dist/auth/index.js +8 -8
- package/dist/auth/sdk.js +97 -8
- package/dist/auth/sdk.js.map +1 -1
- package/dist/{chunk-KLAOGE6Y.js → chunk-3UGI5F4I.js} +2 -2
- package/dist/{chunk-FZXMS7HJ.js → chunk-4Z7Q5IHS.js} +2 -2
- package/dist/{chunk-R3RMENGN.js → chunk-64ALJH5X.js} +3 -3
- package/dist/{chunk-WVDV47XQ.js → chunk-DEXJV7HO.js} +30 -2
- package/dist/chunk-DEXJV7HO.js.map +1 -0
- package/dist/{chunk-EHOK3XKM.js → chunk-FC3UE7XG.js} +25 -2
- package/dist/chunk-FC3UE7XG.js.map +1 -0
- package/dist/{chunk-OWQ2HDQB.js → chunk-ISOKPVX3.js} +2 -2
- package/dist/{chunk-MU7JQOTF.js → chunk-KLXFVVPE.js} +4 -4
- package/dist/{chunk-LAZ5O2ZK.js → chunk-O4GD4NTS.js} +2 -2
- package/dist/{chunk-MS2GGEMU.js → chunk-OHA5F7YF.js} +5 -5
- package/dist/{chunk-QPNEXTZ5.js → chunk-QH75CTQB.js} +2 -2
- package/dist/{chunk-WV4XTYMU.js → chunk-SVBJIRQY.js} +2 -2
- package/dist/{chunk-KTGSOTNW.js → chunk-WVBUY7NR.js} +4 -4
- package/dist/{chunk-B7T42IY2.js → chunk-ZBA2L5L4.js} +2 -2
- package/dist/connect.js +14 -14
- package/dist/connect.js.map +1 -1
- package/dist/gen/index.js +11 -26
- package/dist/gen/index.js.map +1 -1
- package/dist/{index-BR4r9rhQ.d.ts → index-uotEq_CF.d.ts} +7 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.d.ts +64 -10
- package/dist/index.js +1718 -973
- package/dist/index.js.map +1 -1
- package/dist/markdown.js +6 -6
- package/dist/styles.css +1 -1
- package/dist/wallet/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-DFYLQTCM.js +0 -107
- package/dist/chunk-DFYLQTCM.js.map +0 -1
- package/dist/chunk-EHOK3XKM.js.map +0 -1
- package/dist/chunk-WVDV47XQ.js.map +0 -1
- /package/dist/{chunk-KLAOGE6Y.js.map → chunk-3UGI5F4I.js.map} +0 -0
- /package/dist/{chunk-FZXMS7HJ.js.map → chunk-4Z7Q5IHS.js.map} +0 -0
- /package/dist/{chunk-R3RMENGN.js.map → chunk-64ALJH5X.js.map} +0 -0
- /package/dist/{chunk-OWQ2HDQB.js.map → chunk-ISOKPVX3.js.map} +0 -0
- /package/dist/{chunk-MU7JQOTF.js.map → chunk-KLXFVVPE.js.map} +0 -0
- /package/dist/{chunk-LAZ5O2ZK.js.map → chunk-O4GD4NTS.js.map} +0 -0
- /package/dist/{chunk-MS2GGEMU.js.map → chunk-OHA5F7YF.js.map} +0 -0
- /package/dist/{chunk-QPNEXTZ5.js.map → chunk-QH75CTQB.js.map} +0 -0
- /package/dist/{chunk-WV4XTYMU.js.map → chunk-SVBJIRQY.js.map} +0 -0
- /package/dist/{chunk-KTGSOTNW.js.map → chunk-WVBUY7NR.js.map} +0 -0
- /package/dist/{chunk-B7T42IY2.js.map → chunk-ZBA2L5L4.js.map} +0 -0
package/dist/gen/index.js
CHANGED
|
@@ -1,43 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
-
TabButton
|
|
3
|
-
|
|
2
|
+
TabButton,
|
|
3
|
+
getModalityKey,
|
|
4
|
+
modalityBgVar,
|
|
5
|
+
modalityColorVar,
|
|
6
|
+
modalityTextColor
|
|
7
|
+
} from "../chunk-FC3UE7XG.js";
|
|
4
8
|
import {
|
|
5
9
|
ScrollArea
|
|
6
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-O4GD4NTS.js";
|
|
7
11
|
import {
|
|
8
12
|
ChevronIcon,
|
|
9
13
|
Dropdown
|
|
10
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-4Z7Q5IHS.js";
|
|
11
15
|
import {
|
|
12
16
|
Chip
|
|
13
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-ISOKPVX3.js";
|
|
14
18
|
import {
|
|
15
19
|
Button
|
|
16
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-3UGI5F4I.js";
|
|
17
21
|
import {
|
|
18
22
|
CardIcon,
|
|
19
23
|
SproutIcon,
|
|
20
24
|
cn
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
|
|
23
|
-
// src/modules/gen/themes.ts
|
|
24
|
-
var MODALITIES = [
|
|
25
|
-
"text",
|
|
26
|
-
"image",
|
|
27
|
-
"video",
|
|
28
|
-
"audio",
|
|
29
|
-
"realtime",
|
|
30
|
-
"embedding"
|
|
31
|
-
];
|
|
32
|
-
function getModalityKey(category) {
|
|
33
|
-
const lower = category.toLowerCase();
|
|
34
|
-
if (lower === "images") return "image";
|
|
35
|
-
if (lower === "embeddings") return "embedding";
|
|
36
|
-
return MODALITIES.includes(lower) ? lower : null;
|
|
37
|
-
}
|
|
38
|
-
var modalityColorVar = (key) => `var(--polli-color-modality-${key})`;
|
|
39
|
-
var modalityBgVar = (key) => `var(--polli-color-modality-${key}-bg)`;
|
|
40
|
-
var modalityTextColor = (key) => `color-mix(in oklab, ${modalityColorVar(key)} 60%, var(--polli-color-text-strong))`;
|
|
25
|
+
} from "../chunk-DEXJV7HO.js";
|
|
41
26
|
|
|
42
27
|
// src/modules/gen/ModalityChip.tsx
|
|
43
28
|
import { jsx } from "react/jsx-runtime";
|
package/dist/gen/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/gen/themes.ts","../../src/modules/gen/ModalityChip.tsx","../../src/modules/gen/ModalityDot.tsx","../../src/modules/gen/ModalityTab.tsx","../../src/modules/gen/ModelAccessIcon.tsx","../../src/modules/gen/ModelSelector.tsx"],"sourcesContent":["/** Pollinations model-modality colors. Single-accent model: modality is NOT a\n * page theme — each modality is a fixed color from the `--polli-color-modality-*`\n * tokens, applied as a dot/badge via inline style (the key is dynamic, so a CSS\n * var beats a Tailwind class). The token VALUES live in styles/tokens.css. */\nimport type { ModelCategory } from \"@pollinations/sdk\";\n\n/** The canonical modality keys (match the `--polli-color-modality-*` tokens). */\ntype ModalityKey = ModelCategory;\n\nconst MODALITIES: readonly ModelCategory[] = [\n \"text\",\n \"image\",\n \"video\",\n \"audio\",\n \"realtime\",\n \"embedding\",\n];\n\n/** Map an untrusted category string to its modality key; null if unknown. */\nexport function getModalityKey(category: string): ModalityKey | null {\n const lower = category.toLowerCase();\n if (lower === \"images\") return \"image\";\n if (lower === \"embeddings\") return \"embedding\";\n return MODALITIES.includes(lower as ModelCategory)\n ? (lower as ModelCategory)\n : null;\n}\n\n/** CSS var for a modality's solid color (dot / border / icon). */\nexport const modalityColorVar = (key: ModalityKey): string =>\n `var(--polli-color-modality-${key})`;\n\n/** CSS var for a modality's faint chip background. */\nexport const modalityBgVar = (key: ModalityKey): string =>\n `var(--polli-color-modality-${key}-bg)`;\n\n/** A modality's text color, mixed toward the strong text so it stays readable on its background. */\nexport const modalityTextColor = (key: ModalityKey): string =>\n `color-mix(in oklab, ${modalityColorVar(key)} 60%, var(--polli-color-text-strong))`;\n","import type { ReactNode } from \"react\";\nimport { Chip } from \"../../primitives/Chip.tsx\";\nimport { getModalityKey, modalityBgVar, modalityTextColor } from \"./themes.ts\";\n\n/**\n * A `Chip` colored as a model modality: faint modality background + a readable\n * modality-tinted label. The single-accent way to say \"this is the <text/image/…>\n * modality\" without theming the surrounding chrome.\n *\n * Colors come only from the `--polli-color-modality-*` tokens (via the helpers);\n * the label is blended toward `text-strong` so it stays readable on the faint\n * background in both light and dark. Unknown category → a plain neutral chip.\n */\nexport function ModalityChip({\n modality,\n size = \"sm\",\n className,\n children,\n}: {\n modality: string;\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n children: ReactNode;\n}) {\n const key = getModalityKey(modality);\n if (!key) {\n return (\n <Chip intent=\"neutral\" size={size} className={className}>\n {children}\n </Chip>\n );\n }\n return (\n <Chip\n size={size}\n className={className}\n style={{\n backgroundColor: modalityBgVar(key),\n color: modalityTextColor(key),\n }}\n >\n {children}\n </Chip>\n );\n}\n","import { cn } from \"../../lib/cn.ts\";\nimport { getModalityKey, modalityColorVar } from \"./themes.ts\";\n\n/**\n * A small solid dot in a modality's fixed color. The single-accent way to mark\n * a model's modality (text/image/video/audio/realtime/embedding) without\n * theming the whole control. Renders nothing for an unknown category.\n */\nexport function ModalityDot({\n modality,\n className,\n}: {\n modality: string;\n className?: string;\n}) {\n const key = getModalityKey(modality);\n if (!key) return null;\n return (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"polli:inline-block polli:size-2 polli:shrink-0 polli:rounded-full\",\n className,\n )}\n style={{ backgroundColor: modalityColorVar(key) }}\n />\n );\n}\n","import type { ModelCategory } from \"@pollinations/sdk\";\nimport type {\n ComponentPropsWithoutRef,\n ComponentType,\n CSSProperties,\n ReactNode,\n} from \"react\";\nimport { cn } from \"../../lib/cn.ts\";\nimport type { IconProps } from \"../../primitives/icons/types.ts\";\nimport { TabButton } from \"../../primitives/TabButton.tsx\";\nimport { modalityTextColor } from \"./themes.ts\";\n\ntype ModalityTabOwnProps = {\n active: boolean;\n onClick: () => void;\n children: ReactNode;\n size?: \"sm\" | \"md\" | \"lg\";\n disabled?: boolean;\n className?: string;\n /** Leading icon, drawn before the label. */\n icon?: ComponentType<IconProps>;\n /** Tints the icon of an idle, unhovered tab in this modality's colour. */\n modality?: ModelCategory;\n};\n\n/**\n * A model-filter tab. Borderless — it renders the app's `soft` TabButton, so\n * it uses exactly the same tokens as the dashboard tabs: selected is\n * `bg-active` (the resting button fill, no hover), idle is the quiet\n * `bg-subtle`, and hover darkens to `bg-hover` like any button. With\n * `modality`, only an idle tab's icon carries the modality colour; selection\n * and hover stay monochrome, so amber remains the only selection signal.\n *\n * Rest props (including a runtime-injected ref) pass through to the button —\n * required when the tab is a popover trigger, where the positioner's anchor\n * ref arrives via asChild and a closed prop set would silently drop it.\n */\nexport function ModalityTab({\n active,\n onClick,\n children,\n size = \"md\",\n disabled = false,\n className,\n icon: Icon,\n modality,\n ...rest\n}: ModalityTabOwnProps &\n Omit<ComponentPropsWithoutRef<\"button\">, keyof ModalityTabOwnProps>) {\n const tint = modality && !active ? modalityTextColor(modality) : undefined;\n\n return (\n <TabButton\n {...rest}\n active={active}\n onClick={onClick}\n size={size}\n disabled={disabled}\n className={cn(tint && \"polli:group\", className)}\n icon={\n Icon &&\n (tint ? (\n <Icon\n className=\"polli:text-(--polli-tab-icon) polli:group-hover:text-current\"\n style={{ \"--polli-tab-icon\": tint } as CSSProperties}\n />\n ) : (\n <Icon />\n ))\n }\n >\n {children}\n </TabButton>\n );\n}\n","import { CardIcon, SproutIcon } from \"../../primitives/icons/index.tsx\";\n\nexport type ModelAccessIconProps = {\n paidOnly?: boolean;\n className?: string;\n};\n\n/** Compact model-access marker shared by every model picker. */\nexport function ModelAccessIcon({\n paidOnly = false,\n className = \"polli:h-3.5 polli:w-3.5\",\n}: ModelAccessIconProps) {\n const label = paidOnly\n ? \"Uses paid balance only\"\n : \"Works with any balance\";\n const Icon = paidOnly ? CardIcon : SproutIcon;\n\n return (\n <span\n role=\"img\"\n aria-label={label}\n title={label}\n className=\"polli:inline-flex polli:shrink-0\"\n >\n <Icon className={className} />\n </span>\n );\n}\n","import type { ModelCategory, ModelInfo } from \"@pollinations/sdk\";\nimport { Button } from \"../../primitives/Button.tsx\";\nimport { ChevronIcon } from \"../../primitives/ChevronIcon.tsx\";\nimport { Dropdown } from \"../../primitives/Dropdown.tsx\";\nimport { ScrollArea } from \"../../primitives/ScrollArea.tsx\";\nimport { TabButton } from \"../../primitives/TabButton.tsx\";\nimport { ModelAccessIcon } from \"./ModelAccessIcon.tsx\";\n\nexport type ModelSelectorCategory = ModelCategory;\n\ntype ModelSelectorProps = {\n models: readonly ModelInfo[];\n category: ModelSelectorCategory;\n value: string;\n isLoading?: boolean;\n onChange: (modelId: string) => void;\n};\n\nconst CATEGORY_LABELS: Record<ModelSelectorCategory, string> = {\n image: \"Image\",\n video: \"Video\",\n text: \"Text\",\n decision: \"Decision\",\n audio: \"Audio\",\n \"3d\": \"3D\",\n embedding: \"Embeddings\",\n realtime: \"Realtime\",\n};\n\n/** Human-readable label for a model category, e.g. \"embedding\" -> \"Embeddings\". */\nexport function categoryLabel(category: ModelSelectorCategory): string {\n return CATEGORY_LABELS[category];\n}\n\nfunction modelId(model: ModelInfo): string {\n return model.id ?? model.name;\n}\n\nexport function ModelSelector({\n models,\n category,\n value,\n isLoading = false,\n onChange,\n}: ModelSelectorProps) {\n const filteredModels = models\n .filter((model) => model.category === category)\n .sort((a, b) => modelId(a).localeCompare(modelId(b)));\n const currentModel = models.find((model) => modelId(model) === value);\n const modelLabel = currentModel\n ? (currentModel.title ?? currentModel.name)\n : \"Select\";\n const accessibleLabel = currentModel\n ? `${CATEGORY_LABELS[category]} model: ${modelLabel}`\n : `Select ${CATEGORY_LABELS[category].toLowerCase()} model`;\n\n return (\n <Dropdown\n align=\"start\"\n className=\"polli:w-[min(24rem,calc(100vw-2rem))] polli:p-2\"\n trigger={(open) => (\n <Button\n type=\"button\"\n aria-label={accessibleLabel}\n className=\"polli:min-w-64 polli:max-w-full polli:self-start polli:justify-between polli:gap-2\"\n >\n <span className=\"polli:flex polli:min-w-0 polli:items-center polli:gap-2\">\n <span className=\"polli:truncate\">{modelLabel}</span>\n {currentModel && (\n <ModelAccessIcon\n paidOnly={currentModel.paid_only}\n />\n )}\n </span>\n <ChevronIcon expanded={open} />\n </Button>\n )}\n >\n {(close) =>\n isLoading ? (\n <p className=\"polli:m-0 polli:px-2 polli:py-2 polli:text-sm polli:text-theme-text-soft\">\n Loading models...\n </p>\n ) : (\n <ScrollArea className=\"polli:max-h-80 polli:pr-2\">\n <div className=\"polli:flex polli:flex-col polli:gap-1\">\n {filteredModels.map((model) => {\n const id = modelId(model);\n const isActive = value === id;\n return (\n <TabButton\n key={id}\n active={isActive}\n size=\"sm\"\n variant=\"ghost\"\n className=\"polli:w-full polli:justify-start polli:text-left\"\n onClick={() => {\n onChange(id);\n close();\n }}\n >\n <span className=\"polli:flex polli:min-w-0 polli:flex-col polli:gap-0.5\">\n <span className=\"polli:flex polli:min-w-0 polli:items-center polli:gap-2\">\n <span className=\"polli:truncate\">\n {model.title ?? model.name}\n </span>\n <ModelAccessIcon\n paidOnly={model.paid_only}\n />\n </span>\n {model.description && (\n <span className=\"polli:truncate polli:text-xs polli:font-normal polli:text-theme-text-muted\">\n {model.description}\n </span>\n )}\n </span>\n </TabButton>\n );\n })}\n </div>\n </ScrollArea>\n )\n }\n </Dropdown>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,aAAuC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAGO,SAAS,eAAe,UAAsC;AACjE,QAAM,QAAQ,SAAS,YAAY;AACnC,MAAI,UAAU,SAAU,QAAO;AAC/B,MAAI,UAAU,aAAc,QAAO;AACnC,SAAO,WAAW,SAAS,KAAsB,IAC1C,QACD;AACV;AAGO,IAAM,mBAAmB,CAAC,QAC7B,8BAA8B,GAAG;AAG9B,IAAM,gBAAgB,CAAC,QAC1B,8BAA8B,GAAG;AAG9B,IAAM,oBAAoB,CAAC,QAC9B,uBAAuB,iBAAiB,GAAG,CAAC;;;ACXpC;AAdL,SAAS,aAAa;AAAA,EACzB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AACJ,GAKG;AACC,QAAM,MAAM,eAAe,QAAQ;AACnC,MAAI,CAAC,KAAK;AACN,WACI,oBAAC,QAAK,QAAO,WAAU,MAAY,WAC9B,UACL;AAAA,EAER;AACA,S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AA;AAAA,kBACG,UAAU,aAAa;AAAA;AAAA,cAC3B;AAAA,eAER;AAAA,YACA,gBAAAA,KAAC,eAAY,UAAU,MAAM;AAAA;AAAA;AAAA,MACjC;AAAA,MAGH,WAAC,UACE,YACI,gBAAAA,KAAC,OAAE,WAAU,4EAA2E,+BAExF,IAEA,gBAAAA,KAAC,cAAW,WAAU,6BAClB,0BAAAA,KAAC,SAAI,WAAU,yCACV,yBAAe,IAAI,CAAC,UAAU;AAC3B,cAAM,KAAK,QAAQ,KAAK;AACxB,cAAM,WAAW,UAAU;AAC3B,eACI,gBAAAA;AAAA,UAAC;AAAA;AAAA,YAEG,QAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,SAAS,MAAM;AACX,uBAAS,EAAE;AACX,oBAAM;AAAA,YACV;AAAA,YAEA,+BAAC,UAAK,WAAU,yDACZ;AAAA,mCAAC,UAAK,WAAU,2DACZ;AAAA,gCAAAA,KAAC,UAAK,WAAU,kBACX,gBAAM,SAAS,MAAM,MAC1B;AAAA,gBACA,gBAAAA;AAAA,kBAAC;AAAA;AAAA,oBACG,UAAU,MAAM;AAAA;AAAA,gBACpB;AAAA,iBACJ;AAAA,cACC,MAAM,eACH,gBAAAA,KAAC,UAAK,WAAU,8EACX,gBAAM,aACX;AAAA,eAER;AAAA;AAAA,UAxBK;AAAA,QAyBT;AAAA,MAER,CAAC,GACL,GACJ;AAAA;AAAA,EAGZ;AAER;","names":["jsx","jsx","jsx","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../../src/modules/gen/ModalityChip.tsx","../../src/modules/gen/ModalityDot.tsx","../../src/modules/gen/ModalityTab.tsx","../../src/modules/gen/ModelAccessIcon.tsx","../../src/modules/gen/ModelSelector.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Chip } from \"../../primitives/Chip.tsx\";\nimport { getModalityKey, modalityBgVar, modalityTextColor } from \"./themes.ts\";\n\n/**\n * A `Chip` colored as a model modality: faint modality background + a readable\n * modality-tinted label. The single-accent way to say \"this is the <text/image/…>\n * modality\" without theming the surrounding chrome.\n *\n * Colors come only from the `--polli-color-modality-*` tokens (via the helpers);\n * the label is blended toward `text-strong` so it stays readable on the faint\n * background in both light and dark. Unknown category → a plain neutral chip.\n */\nexport function ModalityChip({\n modality,\n size = \"sm\",\n className,\n children,\n}: {\n modality: string;\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n children: ReactNode;\n}) {\n const key = getModalityKey(modality);\n if (!key) {\n return (\n <Chip intent=\"neutral\" size={size} className={className}>\n {children}\n </Chip>\n );\n }\n return (\n <Chip\n size={size}\n className={className}\n style={{\n backgroundColor: modalityBgVar(key),\n color: modalityTextColor(key),\n }}\n >\n {children}\n </Chip>\n );\n}\n","import { cn } from \"../../lib/cn.ts\";\nimport { getModalityKey, modalityColorVar } from \"./themes.ts\";\n\n/**\n * A small solid dot in a modality's fixed color. The single-accent way to mark\n * a model's modality (text/image/video/audio/realtime/embedding) without\n * theming the whole control. Renders nothing for an unknown category.\n */\nexport function ModalityDot({\n modality,\n className,\n}: {\n modality: string;\n className?: string;\n}) {\n const key = getModalityKey(modality);\n if (!key) return null;\n return (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"polli:inline-block polli:size-2 polli:shrink-0 polli:rounded-full\",\n className,\n )}\n style={{ backgroundColor: modalityColorVar(key) }}\n />\n );\n}\n","import type { ModelCategory } from \"@pollinations/sdk\";\nimport type {\n ComponentPropsWithoutRef,\n ComponentType,\n CSSProperties,\n ReactNode,\n} from \"react\";\nimport { cn } from \"../../lib/cn.ts\";\nimport type { IconProps } from \"../../primitives/icons/types.ts\";\nimport { TabButton } from \"../../primitives/TabButton.tsx\";\nimport { modalityTextColor } from \"./themes.ts\";\n\ntype ModalityTabOwnProps = {\n active: boolean;\n onClick: () => void;\n children: ReactNode;\n size?: \"sm\" | \"md\" | \"lg\";\n disabled?: boolean;\n className?: string;\n /** Leading icon, drawn before the label. */\n icon?: ComponentType<IconProps>;\n /** Tints the icon of an idle, unhovered tab in this modality's colour. */\n modality?: ModelCategory;\n};\n\n/**\n * A model-filter tab. Borderless — it renders the app's `soft` TabButton, so\n * it uses exactly the same tokens as the dashboard tabs: selected is\n * `bg-active` (the resting button fill, no hover), idle is the quiet\n * `bg-subtle`, and hover darkens to `bg-hover` like any button. With\n * `modality`, only an idle tab's icon carries the modality colour; selection\n * and hover stay monochrome, so amber remains the only selection signal.\n *\n * Rest props (including a runtime-injected ref) pass through to the button —\n * required when the tab is a popover trigger, where the positioner's anchor\n * ref arrives via asChild and a closed prop set would silently drop it.\n */\nexport function ModalityTab({\n active,\n onClick,\n children,\n size = \"md\",\n disabled = false,\n className,\n icon: Icon,\n modality,\n ...rest\n}: ModalityTabOwnProps &\n Omit<ComponentPropsWithoutRef<\"button\">, keyof ModalityTabOwnProps>) {\n const tint = modality && !active ? modalityTextColor(modality) : undefined;\n\n return (\n <TabButton\n {...rest}\n active={active}\n onClick={onClick}\n size={size}\n disabled={disabled}\n className={cn(tint && \"polli:group\", className)}\n icon={\n Icon &&\n (tint ? (\n <Icon\n className=\"polli:text-(--polli-tab-icon) polli:group-hover:text-current\"\n style={{ \"--polli-tab-icon\": tint } as CSSProperties}\n />\n ) : (\n <Icon />\n ))\n }\n >\n {children}\n </TabButton>\n );\n}\n","import { CardIcon, SproutIcon } from \"../../primitives/icons/index.tsx\";\n\nexport type ModelAccessIconProps = {\n paidOnly?: boolean;\n className?: string;\n};\n\n/** Compact model-access marker shared by every model picker. */\nexport function ModelAccessIcon({\n paidOnly = false,\n className = \"polli:h-3.5 polli:w-3.5\",\n}: ModelAccessIconProps) {\n const label = paidOnly\n ? \"Uses paid balance only\"\n : \"Works with any balance\";\n const Icon = paidOnly ? CardIcon : SproutIcon;\n\n return (\n <span\n role=\"img\"\n aria-label={label}\n title={label}\n className=\"polli:inline-flex polli:shrink-0\"\n >\n <Icon className={className} />\n </span>\n );\n}\n","import type { ModelCategory, ModelInfo } from \"@pollinations/sdk\";\nimport { Button } from \"../../primitives/Button.tsx\";\nimport { ChevronIcon } from \"../../primitives/ChevronIcon.tsx\";\nimport { Dropdown } from \"../../primitives/Dropdown.tsx\";\nimport { ScrollArea } from \"../../primitives/ScrollArea.tsx\";\nimport { TabButton } from \"../../primitives/TabButton.tsx\";\nimport { ModelAccessIcon } from \"./ModelAccessIcon.tsx\";\n\nexport type ModelSelectorCategory = ModelCategory;\n\ntype ModelSelectorProps = {\n models: readonly ModelInfo[];\n category: ModelSelectorCategory;\n value: string;\n isLoading?: boolean;\n onChange: (modelId: string) => void;\n};\n\nconst CATEGORY_LABELS: Record<ModelSelectorCategory, string> = {\n image: \"Image\",\n video: \"Video\",\n text: \"Text\",\n decision: \"Decision\",\n audio: \"Audio\",\n \"3d\": \"3D\",\n embedding: \"Embeddings\",\n realtime: \"Realtime\",\n};\n\n/** Human-readable label for a model category, e.g. \"embedding\" -> \"Embeddings\". */\nexport function categoryLabel(category: ModelSelectorCategory): string {\n return CATEGORY_LABELS[category];\n}\n\nfunction modelId(model: ModelInfo): string {\n return model.id ?? model.name;\n}\n\nexport function ModelSelector({\n models,\n category,\n value,\n isLoading = false,\n onChange,\n}: ModelSelectorProps) {\n const filteredModels = models\n .filter((model) => model.category === category)\n .sort((a, b) => modelId(a).localeCompare(modelId(b)));\n const currentModel = models.find((model) => modelId(model) === value);\n const modelLabel = currentModel\n ? (currentModel.title ?? currentModel.name)\n : \"Select\";\n const accessibleLabel = currentModel\n ? `${CATEGORY_LABELS[category]} model: ${modelLabel}`\n : `Select ${CATEGORY_LABELS[category].toLowerCase()} model`;\n\n return (\n <Dropdown\n align=\"start\"\n className=\"polli:w-[min(24rem,calc(100vw-2rem))] polli:p-2\"\n trigger={(open) => (\n <Button\n type=\"button\"\n aria-label={accessibleLabel}\n className=\"polli:min-w-64 polli:max-w-full polli:self-start polli:justify-between polli:gap-2\"\n >\n <span className=\"polli:flex polli:min-w-0 polli:items-center polli:gap-2\">\n <span className=\"polli:truncate\">{modelLabel}</span>\n {currentModel && (\n <ModelAccessIcon\n paidOnly={currentModel.paid_only}\n />\n )}\n </span>\n <ChevronIcon expanded={open} />\n </Button>\n )}\n >\n {(close) =>\n isLoading ? (\n <p className=\"polli:m-0 polli:px-2 polli:py-2 polli:text-sm polli:text-theme-text-soft\">\n Loading models...\n </p>\n ) : (\n <ScrollArea className=\"polli:max-h-80 polli:pr-2\">\n <div className=\"polli:flex polli:flex-col polli:gap-1\">\n {filteredModels.map((model) => {\n const id = modelId(model);\n const isActive = value === id;\n return (\n <TabButton\n key={id}\n active={isActive}\n size=\"sm\"\n variant=\"ghost\"\n className=\"polli:w-full polli:justify-start polli:text-left\"\n onClick={() => {\n onChange(id);\n close();\n }}\n >\n <span className=\"polli:flex polli:min-w-0 polli:flex-col polli:gap-0.5\">\n <span className=\"polli:flex polli:min-w-0 polli:items-center polli:gap-2\">\n <span className=\"polli:truncate\">\n {model.title ?? model.name}\n </span>\n <ModelAccessIcon\n paidOnly={model.paid_only}\n />\n </span>\n {model.description && (\n <span className=\"polli:truncate polli:text-xs polli:font-normal polli:text-theme-text-muted\">\n {model.description}\n </span>\n )}\n </span>\n </TabButton>\n );\n })}\n </div>\n </ScrollArea>\n )\n }\n </Dropdown>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BY;AAdL,SAAS,aAAa;AAAA,EACzB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AACJ,GAKG;AACC,QAAM,MAAM,eAAe,QAAQ;AACnC,MAAI,CAAC,KAAK;AACN,WACI,oBAAC,QAAK,QAAO,WAAU,MAAY,WAC9B,UACL;AAAA,EAER;AACA,SACI;AAAA,IAAC;AAAA;AAAA,MACG;AAAA,MACA;AAAA,MACA,OAAO;AAAA,QACH,iBAAiB,cAAc,GAAG;AAAA,QAClC,OAAO,kBAAkB,GAAG;AAAA,MAChC;AAAA,MAEC;AAAA;AAAA,EACL;AAER;;;AC1BQ,gBAAAA,YAAA;AAVD,SAAS,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A,KAAC,cAAW,WAAU,6BAClB,0BAAAA,KAAC,SAAI,WAAU,yCACV,yBAAe,IAAI,CAAC,UAAU;AAC3B,cAAM,KAAK,QAAQ,KAAK;AACxB,cAAM,WAAW,UAAU;AAC3B,eACI,gBAAAA;AAAA,UAAC;AAAA;AAAA,YAEG,QAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,SAAS,MAAM;AACX,uBAAS,EAAE;AACX,oBAAM;AAAA,YACV;AAAA,YAEA,+BAAC,UAAK,WAAU,yDACZ;AAAA,mCAAC,UAAK,WAAU,2DACZ;AAAA,gCAAAA,KAAC,UAAK,WAAU,kBACX,gBAAM,SAAS,MAAM,MAC1B;AAAA,gBACA,gBAAAA;AAAA,kBAAC;AAAA;AAAA,oBACG,UAAU,MAAM;AAAA;AAAA,gBACpB;AAAA,iBACJ;AAAA,cACC,MAAM,eACH,gBAAAA,KAAC,UAAK,WAAU,8EACX,gBAAM,aACX;AAAA,eAER;AAAA;AAAA,UAxBK;AAAA,QAyBT;AAAA,MAER,CAAC,GACL,GACJ;AAAA;AAAA,EAGZ;AAER;","names":["jsx","jsx","jsx","jsx"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as IconProps } from './types-CCy9JNu9.js';
|
|
3
3
|
|
|
4
|
+
type TileModality = "image" | "video" | "audio" | "mixed";
|
|
5
|
+
|
|
4
6
|
declare function AppIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
5
7
|
declare function AccountIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
6
8
|
declare function ArrowRightIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
@@ -31,6 +33,10 @@ declare function SparklesIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
|
31
33
|
declare function GitHubIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
32
34
|
/** Multicolor Google "G" brand asset; it keeps its colors instead of currentColor. */
|
|
33
35
|
declare function GoogleIcon({ className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
/** File-picker glyphs share a plus mark, distinct from the capture controls. */
|
|
37
|
+
declare function MediaFileIcon({ modality, ...props }: IconProps & {
|
|
38
|
+
modality: TileModality;
|
|
39
|
+
}): react_jsx_runtime.JSX.Element;
|
|
34
40
|
declare function ImageIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
35
41
|
declare function CubeIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
36
42
|
declare function AudioIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
@@ -87,4 +93,4 @@ declare function RefreshIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
|
87
93
|
declare function PulseIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
88
94
|
declare function ShieldCheckIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
89
95
|
|
|
90
|
-
export {
|
|
96
|
+
export { PlayIcon as $, AccountIcon as A, BeakerIcon as B, CardIcon as C, DiscordIcon as D, EarningsIcon as E, GraduationCapIcon as F, GitHubIcon as G, InstagramIcon as H, ImageIcon as I, IssueClosedIcon as J, KeyIcon as K, LayersIcon as L, LinkedInIcon as M, LockIcon as N, LogInIcon as O, LogOutIcon as P, MailIcon as Q, McpIcon as R, MediaFileIcon as S, type TileModality as T, MegaphoneIcon as U, MenuIcon as V, MicIcon as W, MoonIcon as X, NewspaperIcon as Y, PauseIcon as Z, PencilIcon as _, AppIcon as a, PlusIcon as a0, PowerIcon as a1, PulseIcon as a2, ReasoningIcon as a3, ReceiptIcon as a4, RefreshIcon as a5, RobotIcon as a6, RocketIcon as a7, SearchIcon as a8, ShieldCheckIcon as a9, SignOutIcon as aa, SparkleIcon as ab, SparklesIcon as ac, SpeakerIcon as ad, SproutIcon as ae, StarIcon as af, SunIcon as ag, TargetIcon as ah, TerminalIcon as ai, TokensIcon as aj, ToolIcon as ak, TrashIcon as al, TrendUpIcon as am, UsageIcon as an, VideoIcon as ao, WalletIcon as ap, WarningIcon as aq, XIcon as ar, XSocialIcon as as, ArrowLeftIcon as b, ArrowRightIcon as c, AudioIcon as d, BookIcon as e, BotIcon as f, BugIcon as g, ChatIcon as h, CheckIcon as i, ClipboardIcon as j, ClockIcon as k, CloudUploadIcon as l, CodeIcon as m, CubeIcon as n, DatabaseIcon as o, DownloadIcon as p, ExpandIcon as q, ExternalLinkIcon as r, EyeIcon as s, EyeOffIcon as t, GenApiIcon as u, GitBranchIcon as v, GitMergeIcon as w, GitPullRequestIcon as x, GlobeIcon as y, GoogleIcon as z };
|