@yuhuanowo/yunui 0.2.14 → 0.2.16

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/styles/yunui.css CHANGED
@@ -33,7 +33,13 @@
33
33
  --color-destructive-foreground: #ffffff;
34
34
 
35
35
  --color-muted: var(--bg-elevated);
36
- --color-muted-foreground: var(--text-muted);
36
+ /* Consumer-facing "muted" text (shadcn convention: readable secondary text —
37
+ descriptions, captions, section labels). Maps to --text-tertiary, NOT the
38
+ dimmest --text-muted: in dark, --text-muted (#52525b) is only 2.57:1 and
39
+ washes out. --text-tertiary (#71717a) reads at ~4:1 while staying muted.
40
+ YunUI's own components still use --text-muted directly where a fainter hint
41
+ is wanted; this only affects the `text-muted-foreground` bridge class. */
42
+ --color-muted-foreground: var(--text-tertiary);
37
43
 
38
44
  --color-accent: var(--accent);
39
45
  --color-accent-foreground: #ffffff;
@@ -469,13 +475,15 @@ summary {
469
475
  background: transparent;
470
476
  }
471
477
 
478
+ /* Token-based thumb, not rgba(0,0,0,…): a black-alpha thumb is invisible on
479
+ dark/true-black backgrounds. */
472
480
  ::-webkit-scrollbar-thumb {
473
- background: rgba(0, 0, 0, 0.1);
481
+ background: var(--border-default);
474
482
  border-radius: 3px;
475
483
  }
476
484
 
477
485
  ::-webkit-scrollbar-thumb:hover {
478
- background: rgba(0, 0, 0, 0.18);
486
+ background: var(--border-strong);
479
487
  }
480
488
 
481
489
  /* =====================================================
@@ -628,7 +636,9 @@ summary {
628
636
  font-weight: 600;
629
637
  letter-spacing: 0.04em;
630
638
  text-transform: uppercase;
631
- color: var(--text-muted);
639
+ /* --text-tertiary, not --text-muted: uppercase section/stat labels must stay
640
+ legible. In dark, --text-muted (#52525b) is only 2.57:1 and washes out. */
641
+ color: var(--text-tertiary);
632
642
  }
633
643
 
634
644
  .font-mono {
@@ -1017,6 +1027,19 @@ select.input option,
1017
1027
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
1018
1028
  }
1019
1029
 
1030
+ /* iOS Safari auto-zooms the page when focusing a form field whose font-size is
1031
+ < 16px (our inputs use text-sm = 14px). On touch devices only, floor text
1032
+ fields at 16px so the page doesn't jump on focus. Desktop keeps the 14px look.
1033
+ The stacked :not() attribute selectors out-specify the `text-sm` utility, so
1034
+ no !important is needed; non-text controls are excluded. */
1035
+ @media (hover: none) and (pointer: coarse) {
1036
+ input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
1037
+ textarea,
1038
+ select {
1039
+ font-size: 16px;
1040
+ }
1041
+ }
1042
+
1020
1043
  .input-glass {
1021
1044
  background: var(--bg-glass);
1022
1045
  backdrop-filter: blur(8px);
@@ -1128,6 +1151,16 @@ select.input option,
1128
1151
  border-color: color-mix(in srgb, var(--info) 30%, transparent);
1129
1152
  }
1130
1153
 
1154
+ /* Accent tone — neutral/brand emphasis (e.g. GitHub "important" callouts). Uses
1155
+ the accent-subtle fill so it stays legible in every theme, unlike a 10% mix of
1156
+ the near-black / near-white --accent. Pairs with the text-accent utility. */
1157
+ .bg-accent-soft {
1158
+ background-color: var(--accent-subtle);
1159
+ }
1160
+ .border-accent-soft {
1161
+ border-color: color-mix(in srgb, var(--accent) 25%, transparent);
1162
+ }
1163
+
1131
1164
  .badge-neutral {
1132
1165
  background: var(--bg-glass-hover);
1133
1166
  color: var(--text-secondary);
@@ -1652,6 +1685,56 @@ select.input option,
1652
1685
  opacity: 1;
1653
1686
  }
1654
1687
 
1688
+ /* Radix-driven states — let the SAME .dropdown-item drive @radix-ui Select /
1689
+ DropdownMenu rows (keyboard `data-highlighted`, selected `data-state=checked`),
1690
+ so hand-rolled and Radix dropdowns share one look. Hand-rolled lists can also
1691
+ set `data-highlighted` for keyboard highlight and `.active` for the selection. */
1692
+ .dropdown-item[data-highlighted] {
1693
+ color: var(--text-primary);
1694
+ background: rgba(0, 0, 0, 0.03);
1695
+ outline: none;
1696
+ }
1697
+
1698
+ .dropdown-item[data-highlighted]::before {
1699
+ transform: translateY(-50%) translateX(0);
1700
+ opacity: 0.3;
1701
+ }
1702
+
1703
+ .dropdown-item[data-state="checked"] {
1704
+ color: var(--text-primary);
1705
+ font-weight: 500;
1706
+ }
1707
+
1708
+ .dropdown-item[data-state="checked"]::before {
1709
+ transform: translateY(-50%) translateX(0);
1710
+ opacity: 1;
1711
+ height: 18px;
1712
+ }
1713
+
1714
+ .dark .dropdown-item[data-highlighted],
1715
+ .true-black .dropdown-item[data-highlighted] {
1716
+ background: var(--accent-subtle);
1717
+ color: var(--text-primary);
1718
+ }
1719
+
1720
+ .dark .dropdown-item[data-highlighted]::before,
1721
+ .true-black .dropdown-item[data-highlighted]::before {
1722
+ background: var(--text-primary);
1723
+ opacity: 0.4;
1724
+ }
1725
+
1726
+ .dark .dropdown-item[data-state="checked"],
1727
+ .true-black .dropdown-item[data-state="checked"] {
1728
+ color: var(--text-primary);
1729
+ font-weight: 600;
1730
+ }
1731
+
1732
+ .dark .dropdown-item[data-state="checked"]::before,
1733
+ .true-black .dropdown-item[data-state="checked"]::before {
1734
+ background: var(--text-primary);
1735
+ opacity: 1;
1736
+ }
1737
+
1655
1738
  /* Input dark mode fixes */
1656
1739
  .dark .input:focus,
1657
1740
  .true-black .input:focus {
@@ -2560,6 +2643,45 @@ html {
2560
2643
  }
2561
2644
  }
2562
2645
 
2646
+ /* =====================================================
2647
+ THEME EFFECTS — token-driven, so they restyle automatically with the active
2648
+ brand/accent palette (and any YUNUI_THEME_PRESETS combo). Drive a whole hero
2649
+ or CTA off the current theme with one class.
2650
+ ===================================================== */
2651
+
2652
+ /* Diagonal brand → accent gradient fill. */
2653
+ .bg-brand-gradient {
2654
+ background-image: linear-gradient(135deg, var(--brand-solid-strong), var(--accent-solid-strong));
2655
+ }
2656
+
2657
+ /* Same gradient, clipped to text — for headlines that pick up the theme. */
2658
+ .text-brand-gradient {
2659
+ background-image: linear-gradient(120deg, var(--brand-solid-strong), var(--accent-solid-strong));
2660
+ -webkit-background-clip: text;
2661
+ background-clip: text;
2662
+ color: transparent;
2663
+ }
2664
+
2665
+ /* Soft brand glow (a hairline ring + diffuse shadow), tuned via alpha tokens. */
2666
+ .glow-brand {
2667
+ box-shadow: 0 0 0 1px var(--brand-alpha-weak), 0 10px 34px -8px var(--brand-alpha-medium);
2668
+ }
2669
+ .glow-accent {
2670
+ box-shadow: 0 0 0 1px var(--accent-alpha-weak), 0 10px 34px -8px var(--accent-alpha-medium);
2671
+ }
2672
+
2673
+ /* Slowly drifting brand→accent sheen for hero surfaces (pauses on reduced-motion). */
2674
+ .bg-brand-sheen {
2675
+ background-image: linear-gradient(110deg, var(--brand-solid-strong), var(--accent-solid-strong), var(--brand-solid-strong));
2676
+ background-size: 200% 100%;
2677
+ animation: yunui-sheen 6s linear infinite;
2678
+ }
2679
+ @keyframes yunui-sheen {
2680
+ to {
2681
+ background-position: -200% 0;
2682
+ }
2683
+ }
2684
+
2563
2685
  /* Reduced-motion reset — when the user asks for less motion, neutralize all
2564
2686
  animations/transitions (skeleton shimmer, marquee, shimmer buttons, pulses,
2565
2687
  typing cursors, particles, framer-motion, Radix data-state animations…).
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/cn.ts","../src/primitives/theme-toggle.tsx"],"names":[],"mappings":";;;;;;;;AAOO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACQO,SAAS,WAAA,CAAY,EAAE,OAAA,GAAU,MAAA,EAAQ,QAAQ,OAAA,EAAS,SAAA,GAAY,IAAG,EAAqB;AACjG,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAS,GAAI,QAAA,EAAS;AACrC,EAAA,MAAM,CAAA,GAAI,QAAA,EAAS,CAAE,IAAA,CAAK,cAAc,CAAA;AACxC,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAU,eAAS,KAAK,CAAA;AAClD,EAAA,MAAM,CAAC,MAAA,EA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EAAA,EAAK,SAAA,EAAU,qFAAA,EAAsF,CAAA;AAAA,8BACrG,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAW,QAAA,EAAA,CAAA,CAAE,QAAQ,CAAA,EAAE;AAAA;AAAA;AAAA,KAC3C;AAAA,IAIH,0BACG,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,CAAA,SAAA,EAAY,UAAU,MAAA,GAAS,QAAA,GAAW,SAAS,CAAA,qLAAA,CAAA,EAC/D,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAU,OACV,QAAA,EAAA,MAAA,CAAO,GAAA,CAAI,CAAC,SAAA,qBACT,IAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QAEG,SAAS,MAAM;AACX,UAAA,QAAA,CAAS,UAAU,KAAK,CAAA;AACxB,UAAA,SAAA,CAAU,KAAK,CAAA;AAAA,QACnB,CAAA;AAAA,QACA,WAAW,CAAA,+BAAA,EACP,KAAA,KAAU,SAAA,CAAU,KAAA,GAAQ,WAAW,EAC3C,CAAA,CAAA;AAAA,QAEC,QAAA,EAAA;AAAA,UAAA,SAAA,CAAU,IAAA;AAAA,0BACX,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,QAAA,EAAU,oBAAU,KAAA,EAAM;AAAA;AAAA,OAAA;AAAA,MAVrC,SAAA,CAAU;AAAA,KAYtB,GACL,CAAA,EACJ;AAAA,GAAA,EAER,CAAA;AAER","file":"chunk-GHO4RCDR.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind-aware conflict resolution.\n * `cn(\"px-4\", \"px-8\")` → `\"px-8\"`.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { Moon, Sun, Monitor, Droplet } from \"lucide-react\"\nimport { useTheme } from \"next-themes\"\nimport { useYunUI } from \"../adapters/context\"\n\ninterface ThemeToggleProps {\n /** Visual variant: `icon` (default, icon-only) or `pill`. */\n variant?: \"icon\" | \"pill\";\n /** Dropdown alignment: `left` or `right` (default). */\n align?: \"left\" | \"right\";\n /** Additional className */\n className?: string;\n}\n\n/** Theme switcher dropdown (light / dark / true-black / system) backed by next-themes. */\nexport function ThemeToggle({ variant = \"icon\", align = \"right\", className = \"\" }: ThemeToggleProps) {\n const { theme, setTheme } = useTheme()\n const t = useYunUI().useT(\"common.theme\")\n const [mounted, setMounted] = React.useState(false)\n const [isOpen, setIsOpen] = React.useState(false)\n const containerRef = React.useRef<HTMLDivElement>(null)\n\n React.useEffect(() => {\n setMounted(true)\n }, [])\n\n // Close on outside click\n React.useEffect(() => {\n const handleClickOutside = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setIsOpen(false)\n }\n }\n document.addEventListener(\"mousedown\", handleClickOutside)\n return () => document.removeEventListener(\"mousedown\", handleClickOutside)\n }, [])\n\n const themes = [\n { value: \"light\", label: t(\"light\"), icon: <Sun size={14} /> },\n { value: \"dark\", label: t(\"zincDark\"), icon: <Moon size={14} /> },\n { value: \"true-black\", label: t(\"trueBlack\"), icon: <Droplet size={14} fill=\"currentColor\" /> },\n { value: \"system\", label: t(\"system\"), icon: <Monitor size={14} /> },\n ]\n\n if (!mounted) {\n return (\n <div className={className}>\n {variant === \"pill\" ? (\n <div className=\"h-8 w-16 rounded-full bg-(--bg-elevated) border border-(--border-hairline)\" />\n ) : (\n <div className=\"w-9 h-9 rounded-lg\" />\n )}\n </div>\n )\n }\n\n return (\n <div ref={containerRef} className={`relative ${className}`}>\n {/* Trigger */}\n {variant === \"pill\" ? (\n <button\n onClick={() => setIsOpen(!isOpen)}\n className=\"flex items-center gap-1.5 h-9 px-3 rounded-full text-sm font-medium transition-all bg-(--bg-elevated) hover:bg-(--bg-elevated)/80 border border-(--border-hairline) text-(--text-secondary) hover:text-(--text-primary) outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n aria-label={t(\"toggle\")}\n >\n <Sun size={14} className=\"rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0\" />\n <Moon size={14} className=\"absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n </button>\n ) : (\n <button\n onClick={() => setIsOpen(!isOpen)}\n className=\"w-9 h-9 rounded-lg flex items-center justify-center hover:bg-foreground/5 transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n aria-label={t(\"toggle\")}\n >\n <Sun className=\"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0 absolute\" />\n <Moon className=\"h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n <span className=\"sr-only\">{t(\"toggle\")}</span>\n </button>\n )}\n\n {/* Dropdown */}\n {isOpen && (\n <div className={`absolute ${align === \"left\" ? \"left-0\" : \"right-0\"} top-full mt-2 z-50 rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 animate-in fade-in-0 zoom-in-95 duration-200`}>\n <div className=\"p-1\">\n {themes.map((themeItem) => (\n <button\n key={themeItem.value}\n onClick={() => {\n setTheme(themeItem.value)\n setIsOpen(false)\n }}\n className={`dropdown-item w-full text-left ${\n theme === themeItem.value ? \"active\" : \"\"\n }`}\n >\n {themeItem.icon}\n <span className=\"flex-1\">{themeItem.label}</span>\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/adapters/context.tsx"],"names":[],"mappings":";;;;AA8DA,IAAM,WAAA,GAAwC,CAAC,EAAE,IAAA,EAAM,QAAA,EAAU,GAAG,IAAA,EAAK,qBACvE,GAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAa,GAAG,MAChB,QAAA,EACH,CAAA;AAGF,IAA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CAAA,OAAA;AAAA,IAClB,OAAO,EAAE,GAAG,gBAAA,EAAkB,GAAG,QAAA,EAAS,CAAA;AAAA,IAC1C,CAAC,QAAQ;AAAA,GACX;AACA,EAAA,uBAAO,GAAA,CAAC,YAAA,CAAa,QAAA,EAAb,EAAsB,OAAe,QAAA,EAAS,CAAA;AACxD;AAEO,SAAS,QAAA,GAA0B;AACxC,EAAA,OAAa,iBAAW,YAAY,CAAA;AACtC","file":"chunk-U2LNRVMI.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Adapter layer — lets framework-coupled primitives (routing, images, i18n)\n * run in any host app. Consumers inject their framework's implementations via\n * <YunUIProvider>; without it, zero-dependency defaults are used.\n */\n\nexport interface YunUILinkProps\n extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> {\n href: string;\n children?: React.ReactNode;\n}\n\nexport interface YunUIImageProps {\n src: string;\n alt: string;\n width?: number;\n height?: number;\n className?: string;\n style?: React.CSSProperties;\n /** Honored by next/image; ignored by the default <img>. */\n unoptimized?: boolean;\n /** Fired when the image fails to load (used for icon fallbacks). */\n onError?: () => void;\n}\n\nexport interface YunUIRouter {\n push: (href: string) => void;\n replace: (href: string) => void;\n back: () => void;\n}\n\nexport type TranslateFn = (key: string, vars?: Record<string, unknown>) => string;\nexport type TranslateFactory = (namespace?: string) => TranslateFn;\n\nexport interface YunUIAdapters {\n Link: React.ComponentType<YunUILinkProps>;\n Image: React.ComponentType<YunUIImageProps>;\n useRouter: () => YunUIRouter;\n useT: TranslateFactory;\n /**\n * Base URL/path under which the AI provider/model icon assets are served.\n * The library resolves icons to `<iconBasePath>/providers/*.png` and\n * `<iconBasePath>/models/*.png`.\n *\n * Defaults to the **bundled** icon set served via jsDelivr\n * (`https://cdn.jsdelivr.net/npm/@yuhuanowo/yunui@0.2/icons`), so provider/\n * model icons work with zero setup. To self-host — and to extend with your own\n * icons — copy the package's `icons/` (or this repo's `site/public/icons`)\n * into your app and point this at it (`/icons`, `/assets/icons`, a CDN, …).\n *\n * next/image consumers: either self-host, or allow `cdn.jsdelivr.net` in\n * `images.remotePatterns`.\n */\n iconBasePath: string;\n}\n\n// ---- defaults -------------------------------------------------------------\n\nconst DefaultLink: React.FC<YunUILinkProps> = ({ href, children, ...rest }) => (\n <a href={href} {...rest}>\n {children}\n </a>\n);\n\nconst DefaultImage: React.FC<YunUIImageProps> = ({\n src,\n alt,\n width,\n height,\n className,\n style,\n onError,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n unoptimized: _unoptimized,\n}) => (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={src}\n alt={alt}\n width={width}\n height={height}\n className={className}\n style={style}\n onError={onError}\n />\n);\n\nfunction defaultUseRouter(): YunUIRouter {\n return {\n push: (href) => {\n if (typeof window !== \"undefined\") window.location.href = href;\n },\n replace: (href) => {\n if (typeof window !== \"undefined\") window.location.replace(href);\n },\n back: () => {\n if (typeof window !== \"undefined\") window.history.back();\n },\n };\n}\n\n/** Identity translator: returns the key. Consumers inject real i18n. */\nconst defaultUseT: TranslateFactory = () => (key) => key;\n\nexport const DEFAULT_ADAPTERS: YunUIAdapters = {\n Link: DefaultLink,\n Image: DefaultImage,\n useRouter: defaultUseRouter,\n useT: defaultUseT,\n // Bundled icons via jsDelivr — zero-setup default. Override to self-host/extend.\n // Pinned to the 0.2.x line (jsDelivr resolves @0.2 to the latest 0.2.x); bump\n // this when the major/minor moves (see CLAUDE.md versioning policy).\n iconBasePath: \"https://cdn.jsdelivr.net/npm/@yuhuanowo/yunui@0.2/icons\",\n};\n\n// ---- context --------------------------------------------------------------\n\nexport const YunUIContext = React.createContext<YunUIAdapters>(DEFAULT_ADAPTERS);\n\nexport interface YunUIProviderProps {\n /** Partial overrides; unspecified adapters fall back to defaults. */\n adapters?: Partial<YunUIAdapters>;\n children: React.ReactNode;\n}\n\nexport function YunUIProvider({ adapters, children }: YunUIProviderProps) {\n const value = React.useMemo<YunUIAdapters>(\n () => ({ ...DEFAULT_ADAPTERS, ...adapters }),\n [adapters]\n );\n return <YunUIContext.Provider value={value}>{children}</YunUIContext.Provider>;\n}\n\nexport function useYunUI(): YunUIAdapters {\n return React.useContext(YunUIContext);\n}\n"]}