cherry-styled-components 0.2.13 → 0.2.15

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.
@@ -21,14 +21,14 @@ var pulseGlow = keyframes([`0%,100%{opacity:0.5;filter:blur(16px);}50%{opacity:1
21
21
  var conicStops = (colors) => [...colors, colors[0]].join(", ");
22
22
  var StyledChatLauncher = styled.button.withConfig({
23
23
  displayName: "chat-launcher__StyledChatLauncher",
24
- componentId: "sc-2dd3d5f9-0"
24
+ componentId: "sc-64539cc0-0"
25
25
  })([
26
26
  ``,
27
- `;appearance:none;outline:none;cursor:pointer;background:`,
27
+ `;appearance:none;outline:none;cursor:pointer;box-sizing:border-box;height:30px;background:`,
28
28
  `;border:solid 1px `,
29
29
  `;color:`,
30
30
  `;border-radius:`,
31
- `;padding:0;font-size:12px;font-family:inherit;font-weight:600;& .chat-launcher-inner{padding:6px 8px;display:flex;align-items:center;gap:6px;background:`,
31
+ `;padding:0;font-size:12px;font-family:inherit;font-weight:600;& .chat-launcher-inner{padding:0 8px;height:100%;display:flex;align-items:center;gap:6px;background:`,
32
32
  `;border-radius:`,
33
33
  `;}& svg{width:16px;height:16px;color:inherit;}`,
34
34
  ``
@@ -3,6 +3,7 @@
3
3
  import { resolveShowcaseCommand } from "./chat-showcase.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
6
+ import { flushSync } from "react-dom";
6
7
  //#region src/lib/chat-provider.tsx
7
8
  var ChatContext = /*#__PURE__*/ createContext({
8
9
  isOpen: false,
@@ -82,7 +83,8 @@ function ChatProvider({ children, onSend, greeting, historyLimit = 20, shortcut
82
83
  openerRef.current = returnFocusTo?.isConnected === true ? returnFocusTo : pendingOpener?.isConnected === true ? pendingOpener : activeElement instanceof HTMLElement && activeElement !== document.body ? activeElement : null;
83
84
  }
84
85
  isOpenRef.current = true;
85
- setIsOpen(true);
86
+ flushSync(() => setIsOpen(true));
87
+ inputRef.current?.focus();
86
88
  if (focusTimeoutRef.current) clearTimeout(focusTimeoutRef.current);
87
89
  focusTimeoutRef.current = setTimeout(() => {
88
90
  focusTimeoutRef.current = null;
@@ -7,11 +7,11 @@ import styled from "styled-components";
7
7
  //#region src/lib/chat-sources.tsx
8
8
  var StyledChatSources = styled.div.withConfig({
9
9
  displayName: "chat-sources__StyledChatSources",
10
- componentId: "sc-7fa69b52-0"
11
- })([`display:flex;gap:16px;flex-wrap:wrap;`]);
10
+ componentId: "sc-f28b3c84-0"
11
+ })([`display:flex;gap:16px;flex-wrap:wrap;&:not(:first-child){margin-top:10px;}`]);
12
12
  var StyledChatSource = styled.a.withConfig({
13
13
  displayName: "chat-sources__StyledChatSource",
14
- componentId: "sc-7fa69b52-1"
14
+ componentId: "sc-f28b3c84-1"
15
15
  })([
16
16
  `position:relative;text-decoration:none;font-size:`,
17
17
  `;line-height:1;color:`,
package/dist/prose.js CHANGED
@@ -42,7 +42,8 @@ var accent = (theme) => theme.isDark ? theme.colors.primaryLight : theme.colors.
42
42
  `;padding:2px 4px;border-radius:`,
43
43
  `;font-family:`,
44
44
  `;white-space:pre;}& pre,& .hljs{margin:10px 0;overflow-x:auto;`,
45
- `;}& .code-wrapper pre{margin:0;}& blockquote{margin:`,
45
+ `;}& .code-wrapper{margin:`,
46
+ ` 0;}& .code-wrapper pre{margin:0;}& blockquote{margin:`,
46
47
  ` 0;padding:0 0 0 16px;border-left:solid 2px `,
47
48
  `;color:`,
48
49
  `;}& hr{margin:`,
@@ -57,11 +58,11 @@ var accent = (theme) => theme.isDark ? theme.colors.primaryLight : theme.colors.
57
58
  `;`,
58
59
  `;}}& img,& video,& iframe{max-width:100%;border-radius:`,
59
60
  `;margin:10px 0;display:block;}`
60
- ], theme.colors.dark, styledText(theme), block, styledText(theme), block, theme.colors.dark, ($compact ? styledH3 : styledH1)(theme), ($compact ? styledH4 : styledH2)(theme), ($compact ? styledH5 : styledH3)(theme), ($compact ? styledH6 : styledH4)(theme), ($compact ? styledH6 : styledH5)(theme), styledH6(theme), theme.colors.primary, accent(theme), theme.colors.primary, theme.spacing.radius.xs, theme.colors.primary, theme.colors.primaryLight, block, styledText(theme), theme.colors.primary, styledText(theme), theme.colors.primary, alpha(theme.colors.primaryLight, 20), theme.colors.dark, theme.spacing.radius.xs, theme.fonts.mono, thinScrollbar, block, theme.colors.grayLight, theme.colors.grayDark, block, theme.colors.grayLight, block, thinScrollbar, theme.colors.grayLight, styledSmall(theme), theme.colors.dark, theme.colors.grayLight, theme.colors.grayDark, styledSmall(theme), theme.spacing.radius.lg);
61
+ ], theme.colors.dark, styledText(theme), block, styledText(theme), block, theme.colors.dark, ($compact ? styledH3 : styledH1)(theme), ($compact ? styledH4 : styledH2)(theme), ($compact ? styledH5 : styledH3)(theme), ($compact ? styledH6 : styledH4)(theme), ($compact ? styledH6 : styledH5)(theme), styledH6(theme), theme.colors.primary, accent(theme), theme.colors.primary, theme.spacing.radius.xs, theme.colors.primary, theme.colors.primaryLight, block, styledText(theme), theme.colors.primary, styledText(theme), theme.colors.primary, alpha(theme.colors.primaryLight, 20), theme.colors.dark, theme.spacing.radius.xs, theme.fonts.mono, thinScrollbar, block, block, theme.colors.grayLight, theme.colors.grayDark, block, theme.colors.grayLight, block, thinScrollbar, theme.colors.grayLight, styledSmall(theme), theme.colors.dark, theme.colors.grayLight, theme.colors.grayDark, styledSmall(theme), theme.spacing.radius.lg);
61
62
  };
62
63
  var StyledProse = styled.div.withConfig({
63
64
  displayName: "prose__StyledProse",
64
- componentId: "sc-91bd953a-0"
65
+ componentId: "sc-c60056db-0"
65
66
  })([``, `;`], ({ theme, $compact }) => proseStyles(theme, $compact));
66
67
  function LocalProse({ children, ...props }, ref) {
67
68
  return /*#__PURE__*/ jsx(StyledProse, {
@@ -3,13 +3,21 @@ import { Theme } from '../utils';
3
3
  * Blocking script for the document <head>. On a first visit from a browser
4
4
  * that doesn't send Sec-CH-Prefers-Color-Scheme (Safari, Firefox), it seeds
5
5
  * the `theme` cookie from the OS preference and, when dark, hides the body
6
- * behind a `#__theme-init` style so the light server render never flashes.
7
- * ClientThemeProvider removes that style once the corrected theme has
8
- * committed on the client. Pass your dark theme's page background so the
9
- * brief pre-hydration frame matches it.
6
+ * behind a `#__theme-init` style so the light server render never flashes,
7
+ * and rewrites `<meta name="theme-color">` to `darkThemeColor` so the browser
8
+ * chrome (Safari tab bar, Android toolbar) doesn't hold the light tint until
9
+ * hydration — the server had no cookie to resolve, and the provider's own
10
+ * meta sync runs too late by definition. The meta rewrite mirrors
11
+ * ClientThemeProvider's sync (single canonical tag, media-scoped ones
12
+ * removed), which takes over from here after hydration.
13
+ * ClientThemeProvider removes the `#__theme-init` style once the corrected
14
+ * theme has committed on the client. Pass your dark theme's page background
15
+ * so the brief pre-hydration frame matches it; pass `darkThemeColor` when
16
+ * your provider uses a non-default `$themeColor` (e.g. "primary") so the
17
+ * pre-hydration tint matches that token's dark value instead.
10
18
  */
11
- export declare function createThemeInitScript(darkBackground?: string): string;
12
- /** createThemeInitScript() with the default dark background (#000). */
19
+ export declare function createThemeInitScript(darkBackground?: string, darkThemeColor?: string): string;
20
+ /** createThemeInitScript() with the default dark background and theme-color (#000). */
13
21
  export declare const themeInitScript: string;
14
22
  /**
15
23
  * Resolves a `theme` cookie value ("light" | "dark") to a theme object.
@@ -3,14 +3,22 @@
3
3
  * Blocking script for the document <head>. On a first visit from a browser
4
4
  * that doesn't send Sec-CH-Prefers-Color-Scheme (Safari, Firefox), it seeds
5
5
  * the `theme` cookie from the OS preference and, when dark, hides the body
6
- * behind a `#__theme-init` style so the light server render never flashes.
7
- * ClientThemeProvider removes that style once the corrected theme has
8
- * committed on the client. Pass your dark theme's page background so the
9
- * brief pre-hydration frame matches it.
10
- */ function createThemeInitScript(darkBackground = "#000") {
11
- return `(function(){try{var c=document.cookie.split(";").find(function(s){return s.trim().startsWith("theme=")});if(!c){var d=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches;document.cookie="theme="+(d?"dark":"light")+";path=/;max-age=31536000;SameSite=Lax";if(d){var s=document.createElement("style");s.id="__theme-init";s.textContent="html{background:${darkBackground}!important;color-scheme:dark}body{visibility:hidden}";document.head.appendChild(s)}}}catch(e){}})();`;
6
+ * behind a `#__theme-init` style so the light server render never flashes,
7
+ * and rewrites `<meta name="theme-color">` to `darkThemeColor` so the browser
8
+ * chrome (Safari tab bar, Android toolbar) doesn't hold the light tint until
9
+ * hydration — the server had no cookie to resolve, and the provider's own
10
+ * meta sync runs too late by definition. The meta rewrite mirrors
11
+ * ClientThemeProvider's sync (single canonical tag, media-scoped ones
12
+ * removed), which takes over from here after hydration.
13
+ * ClientThemeProvider removes the `#__theme-init` style once the corrected
14
+ * theme has committed on the client. Pass your dark theme's page background
15
+ * so the brief pre-hydration frame matches it; pass `darkThemeColor` when
16
+ * your provider uses a non-default `$themeColor` (e.g. "primary") so the
17
+ * pre-hydration tint matches that token's dark value instead.
18
+ */ function createThemeInitScript(darkBackground = "#000", darkThemeColor = darkBackground) {
19
+ return `(function(){try{var c=document.cookie.split(";").find(function(s){return s.trim().startsWith("theme=")});if(!c){var d=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches;document.cookie="theme="+(d?"dark":"light")+";path=/;max-age=31536000;SameSite=Lax";if(d){var s=document.createElement("style");s.id="__theme-init";s.textContent="html{background:${darkBackground}!important;color-scheme:dark}body{visibility:hidden}";document.head.appendChild(s);var m=document.querySelector('meta[name="theme-color"]');if(!m){m=document.createElement("meta");m.name="theme-color";document.head.appendChild(m)}m.removeAttribute("media");m.content="${darkThemeColor}";document.querySelectorAll('meta[name="theme-color"][media]').forEach(function(n){n.remove()})}}}catch(e){}})();`;
12
20
  }
13
- /** createThemeInitScript() with the default dark background (#000). */ var themeInitScript = createThemeInitScript();
21
+ /** createThemeInitScript() with the default dark background and theme-color (#000). */ var themeInitScript = createThemeInitScript();
14
22
  /**
15
23
  * Resolves a `theme` cookie value ("light" | "dark") to a theme object.
16
24
  * Meant for server code: read the cookie, resolve, pass the result to
package/dist/toast.d.ts CHANGED
@@ -26,30 +26,23 @@ interface ToastNotificationsProviderProps {
26
26
  children: React.ReactNode;
27
27
  }
28
28
  declare function ToastNotificationsProvider({ children, }: ToastNotificationsProviderProps): React.JSX.Element;
29
- export declare const StyledNotifications: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "theme" | "$align" | "$bottom"> & {
29
+ export declare const StyledNotifications: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "style"> & {
30
+ style?: import('styled-components/dist/types').CSSPropertiesWithVars | React.CSSProperties | undefined;
31
+ }, {
30
32
  theme: Theme;
31
33
  $align?: ToastAlign;
32
34
  $bottom?: boolean;
33
- }, never> & Partial<Pick<import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "theme" | "$align" | "$bottom"> & {
34
- theme: Theme;
35
- $align?: ToastAlign;
36
- $bottom?: boolean;
37
- }, never>>> & string;
38
- export declare const StyledNotificationItem: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "theme" | "$color" | "$align" | "$bottom" | "$visible" | "$static"> & {
39
- theme: Theme;
40
- $color: ToastColor;
41
- $visible: boolean;
42
- $static: boolean;
43
- $align?: ToastAlign;
44
- $bottom?: boolean;
45
- }, never> & Partial<Pick<import('styled-components').FastOmit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "theme" | "$color" | "$align" | "$bottom" | "$visible" | "$static"> & {
35
+ }>> & string;
36
+ export declare const StyledNotificationItem: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "style"> & {
37
+ style?: import('styled-components/dist/types').CSSPropertiesWithVars | React.CSSProperties | undefined;
38
+ }, {
46
39
  theme: Theme;
47
40
  $color: ToastColor;
48
41
  $visible: boolean;
49
42
  $static: boolean;
50
43
  $align?: ToastAlign;
51
44
  $bottom?: boolean;
52
- }, never>>> & string;
45
+ }>> & string;
53
46
  export interface ToastNotificationsProps {
54
47
  $align?: ToastAlign;
55
48
  $bottom?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cherry-styled-components",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Cherry is a design system for the modern web. Designed in Figma, built in React using Typescript.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "homepage": "https://cherry.al",
21
21
  "repository": "https://github.com/cherry-design-system/styled-components",
22
22
  "license": "MIT",
23
- "packageManager": "pnpm@11.19.0",
23
+ "packageManager": "pnpm@11.20.0",
24
24
  "engines": {
25
25
  "node": ">=18.0.0"
26
26
  },
@@ -61,14 +61,14 @@
61
61
  "@vitejs/plugin-react-swc": "^4.3.3",
62
62
  "eslint-plugin-react-hooks": "^7.1.1",
63
63
  "eslint-plugin-react-refresh": "^0.5.3",
64
- "next": "^16.2.12",
64
+ "next": "^16.3.0",
65
65
  "playwright-core": "^1.62.1",
66
66
  "prettier": "^3.9.6",
67
67
  "react": "^19.2.8",
68
68
  "react-dom": "^19.2.8",
69
69
  "rollup-plugin-preserve-directives": "^0.4.0",
70
70
  "sharp": "^0.35.3",
71
- "styled-components": "^6.4.4",
71
+ "styled-components": "^6.5.0",
72
72
  "typescript": "^7.0.2",
73
73
  "vite": "^8.2.0",
74
74
  "vite-plugin-dts": "^5.0.3"