cherry-styled-components 0.2.21 → 0.2.23
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/dist/avatar-dropzone.js +7 -7
- package/dist/avatar.js +3 -3
- package/dist/button.js +3 -3
- package/dist/callout.js +4 -3
- package/dist/chat-launcher.js +3 -3
- package/dist/chat-message.js +3 -3
- package/dist/chat-sources.js +4 -4
- package/dist/dropzone.js +13 -13
- package/dist/icon-button.js +5 -5
- package/dist/index.js +3 -3
- package/dist/prose.js +3 -4
- package/dist/styled-components/client-theme-provider.js +3 -3
- package/dist/styled-components/theme-provider.js +3 -3
- package/dist/theme-toggle.js +5 -5
- package/dist/toast.js +3 -3
- package/dist/utils/global.js +2 -1
- package/dist/utils/mixins.d.ts +35 -3
- package/dist/utils/mixins.js +43 -6
- package/dist/utils/theme.d.ts +54 -1
- package/package.json +1 -1
package/dist/avatar-dropzone.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { alpha, resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, darkPrimaryTintRule, primaryTintColor, resetButton } from "./utils/mixins.js";
|
|
4
4
|
import { Icon, renderIcon } from "./icon.js";
|
|
5
5
|
import { matchesAccept } from "./dropzone.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -115,7 +115,7 @@ function LocalAvatarDropzone({ $size, $icon = User, $maxBytes, "aria-label": ari
|
|
|
115
115
|
var AvatarDropzone = /*#__PURE__*/ forwardRef(LocalAvatarDropzone);
|
|
116
116
|
var StyledAvatarDropzoneWrapper = styled.span.withConfig({
|
|
117
117
|
displayName: "avatar-dropzone__StyledAvatarDropzoneWrapper",
|
|
118
|
-
componentId: "sc-
|
|
118
|
+
componentId: "sc-c05e8173-0"
|
|
119
119
|
})([
|
|
120
120
|
`position:relative;display:inline-flex;width:`,
|
|
121
121
|
`px;height:`,
|
|
@@ -123,7 +123,7 @@ var StyledAvatarDropzoneWrapper = styled.span.withConfig({
|
|
|
123
123
|
], ({ $size }) => avatarSizes[$size ?? "default"].box, ({ $size }) => avatarSizes[$size ?? "default"].box);
|
|
124
124
|
var StyledAvatarDropzone = styled.button.withConfig({
|
|
125
125
|
displayName: "avatar-dropzone__StyledAvatarDropzone",
|
|
126
|
-
componentId: "sc-
|
|
126
|
+
componentId: "sc-c05e8173-1"
|
|
127
127
|
})([
|
|
128
128
|
``,
|
|
129
129
|
`;font-family:inherit;display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:50%;overflow:hidden;border:2px `,
|
|
@@ -142,12 +142,12 @@ var StyledAvatarDropzone = styled.button.withConfig({
|
|
|
142
142
|
], resetButton, ({ $hasImage }) => $hasImage ? "solid" : "dashed", ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayDark, ({ $size }) => avatarSizes[$size ?? "default"].icon, ({ $size }) => avatarSizes[$size ?? "default"].icon, ({ theme }) => theme.colors.primary, ({ theme, $dragOver }) => $dragOver && css([
|
|
143
143
|
`border-color:`,
|
|
144
144
|
`;background:`,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
], theme.colors.primary,
|
|
145
|
+
`;`,
|
|
146
|
+
``
|
|
147
|
+
], theme.colors.primary, primaryTintColor(theme, "drop"), darkPrimaryTintRule(theme, "drop")), ({ theme }) => theme.colors.primary, ({ theme }) => primaryTintColor(theme, "hover"), ({ theme }) => theme.colors.primary, ({ theme }) => theme.colors.primaryLight);
|
|
148
148
|
var StyledAvatarRemove = styled.button.withConfig({
|
|
149
149
|
displayName: "avatar-dropzone__StyledAvatarRemove",
|
|
150
|
-
componentId: "sc-
|
|
150
|
+
componentId: "sc-c05e8173-2"
|
|
151
151
|
})([
|
|
152
152
|
``,
|
|
153
153
|
`;position:absolute;top:0;right:0;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;color:#ffffff;background:`,
|
package/dist/avatar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { darkFilledTextRule, filledTextColor } from "./utils/mixins.js";
|
|
3
|
+
import { darkFilledTextRule, filledTextColor, primaryFillColor } from "./utils/mixins.js";
|
|
4
4
|
import { renderIcon } from "./icon.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { forwardRef } from "react";
|
|
@@ -22,7 +22,7 @@ var avatarSizes = {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
var avatarColors = {
|
|
25
|
-
primary: (theme) => theme
|
|
25
|
+
primary: (theme) => primaryFillColor(theme),
|
|
26
26
|
secondary: (theme) => theme.colors.secondary,
|
|
27
27
|
tertiary: (theme) => theme.colors.tertiary,
|
|
28
28
|
gray: (theme) => theme.colors.grayDark
|
|
@@ -32,7 +32,7 @@ function toInitials(name) {
|
|
|
32
32
|
}
|
|
33
33
|
var StyledAvatar = styled.span.withConfig({
|
|
34
34
|
displayName: "avatar__StyledAvatar",
|
|
35
|
-
componentId: "sc-
|
|
35
|
+
componentId: "sc-616c0fb2-0"
|
|
36
36
|
})([``, `;`], ({ theme, $size = "default", $color = "primary" }) => {
|
|
37
37
|
const { box } = avatarSizes[$size];
|
|
38
38
|
const fill = $color === "primary" ? "primary" : "other";
|
package/dist/button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { darkFilledTextRule, filledTextColor, formElementHeightStyles, resetButton, shade, tint } from "./utils/mixins.js";
|
|
3
|
+
import { darkFilledTextRule, filledTextColor, formElementHeightStyles, primaryFillColor, primaryFillHoverColor, resetButton, shade, tint } from "./utils/mixins.js";
|
|
4
4
|
import { jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
import styled, { css } from "styled-components";
|
|
@@ -29,7 +29,7 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
29
29
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
30
30
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
31
31
|
`;}`
|
|
32
|
-
], $outline ? theme.colors.primary : filledTextColor(theme, "primary"), !$outline && darkFilledTextRule(theme, "primary"), $outline ? "transparent" : theme
|
|
32
|
+
], $outline ? theme.colors.primary : filledTextColor(theme, "primary"), !$outline && darkFilledTextRule(theme, "primary"), $outline ? "transparent" : primaryFillColor(theme), $outline ? theme.colors.primary : primaryFillColor(theme), theme.colors.primary, $outline ? "transparent" : primaryFillHoverColor(theme), $outline ? theme.colors.primaryDark : primaryFillHoverColor(theme), $outline && `color: ${theme.colors.primaryDark}`, theme.colors.primaryLight, theme.colors.primaryLight), !disabled && $variant === "secondary" && css([
|
|
33
33
|
`color:`,
|
|
34
34
|
`;`,
|
|
35
35
|
` background:`,
|
|
@@ -80,7 +80,7 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
80
80
|
`, $fullWidth && `width: 100%;`);
|
|
81
81
|
var StyledButton = styled.button.withConfig({
|
|
82
82
|
displayName: "button__StyledButton",
|
|
83
|
-
componentId: "sc-
|
|
83
|
+
componentId: "sc-577b793f-0"
|
|
84
84
|
})([``, ``], ({ theme, $variant, $error, $size, $outline, $fullWidth, disabled }) => buttonStyles(theme, $variant, $size, $outline, $fullWidth, $error, disabled));
|
|
85
85
|
function LocalButton({ $variant = "primary", ...props }, ref) {
|
|
86
86
|
return /*#__PURE__*/ jsxs(StyledButton, {
|
package/dist/callout.js
CHANGED
|
@@ -84,7 +84,7 @@ var tintStyles = (tint) => css([
|
|
|
84
84
|
], tint.border, tint.background, tint.text);
|
|
85
85
|
var StyledCallout = styled.div.withConfig({
|
|
86
86
|
displayName: "callout__StyledCallout",
|
|
87
|
-
componentId: "sc-
|
|
87
|
+
componentId: "sc-18dbabb6-0"
|
|
88
88
|
})([
|
|
89
89
|
`background:`,
|
|
90
90
|
`;border:solid 1px `,
|
|
@@ -96,9 +96,10 @@ var StyledCallout = styled.div.withConfig({
|
|
|
96
96
|
], ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayDark, ({ theme }) => styledSmall(theme), ({ $type, theme }) => $type && css([
|
|
97
97
|
``,
|
|
98
98
|
`;`,
|
|
99
|
-
`;:root.dark &{`,
|
|
99
|
+
`;:root.dark &,:root [data-theme="dark"] &{`,
|
|
100
|
+
`;}:root [data-theme="light"] &{`,
|
|
100
101
|
`;}`
|
|
101
|
-
], tintStyles(calloutTints[$type].light), theme.isDark && tintStyles(calloutTints[$type].dark), tintStyles(calloutTints[$type].dark)));
|
|
102
|
+
], tintStyles(calloutTints[$type].light), theme.isDark && tintStyles(calloutTints[$type].dark), tintStyles(calloutTints[$type].dark), tintStyles(calloutTints[$type].light)));
|
|
102
103
|
function LocalCallout({ children, $type, $icon, $hideIcon, ...props }, ref) {
|
|
103
104
|
const icon = $icon ?? ($type ? calloutIcons[$type] : void 0);
|
|
104
105
|
return /*#__PURE__*/ jsxs(StyledCallout, {
|
package/dist/chat-launcher.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { alpha, interactiveStyles } from "./utils/mixins.js";
|
|
3
|
+
import { accentColor, alpha, interactiveStyles } from "./utils/mixins.js";
|
|
4
4
|
import { Icon } from "./icon.js";
|
|
5
5
|
import { ChatContext } from "./chat-provider.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -22,7 +22,7 @@ var pulseGlow = keyframes([`0%,100%{opacity:0.5;filter:blur(16px);}50%{opacity:1
|
|
|
22
22
|
var conicStops = (colors) => [...colors, colors[0]].join(", ");
|
|
23
23
|
var StyledChatLauncher = styled.button.withConfig({
|
|
24
24
|
displayName: "chat-launcher__StyledChatLauncher",
|
|
25
|
-
componentId: "sc-
|
|
25
|
+
componentId: "sc-cfea1742-0"
|
|
26
26
|
})([
|
|
27
27
|
``,
|
|
28
28
|
`;appearance:none;outline:none;cursor:pointer;box-sizing:border-box;height:30px;background:`,
|
|
@@ -33,7 +33,7 @@ var StyledChatLauncher = styled.button.withConfig({
|
|
|
33
33
|
`;border-radius:`,
|
|
34
34
|
`;}& svg{width:16px;height:16px;color:inherit;}`,
|
|
35
35
|
``
|
|
36
|
-
], interactiveStyles, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme
|
|
36
|
+
], interactiveStyles, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => accentColor(theme), ({ theme }) => theme.spacing.radius.xs, ({ theme }) => theme.colors.light, ({ theme }) => theme.spacing.radius.xs, ({ $glow, $glowColors = GLOW_COLORS, $isActive, theme }) => $glow && css([
|
|
37
37
|
`position:relative;isolation:isolate;&::before,&::after,& .chat-launcher-ring{content:"";position:absolute;background:conic-gradient( from var(--cherry-gradient-angle),`,
|
|
38
38
|
` );opacity:0;transition:opacity 0.3s ease;animation:`,
|
|
39
39
|
` 3s linear infinite;z-index:-1;pointer-events:none;}&::before{inset:-1px;border-radius:calc(`,
|
package/dist/chat-message.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { mq } from "./utils/theme.js";
|
|
4
|
-
import { darkFilledTextRule, filledTextColor } from "./utils/mixins.js";
|
|
4
|
+
import { darkFilledTextRule, filledTextColor, primaryFillColor } from "./utils/mixins.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
import styled, { css } from "styled-components";
|
|
@@ -19,7 +19,7 @@ import styled, { css } from "styled-components";
|
|
|
19
19
|
], theme.fontSizes.text.xs, theme.lineHeights.text.xs, mq("lg"), theme.fontSizes.small.lg, theme.lineHeights.small.lg);
|
|
20
20
|
var StyledChatMessage = styled.div.withConfig({
|
|
21
21
|
displayName: "chat-message__StyledChatMessage",
|
|
22
|
-
componentId: "sc-
|
|
22
|
+
componentId: "sc-7327cbb7-0"
|
|
23
23
|
})([
|
|
24
24
|
`display:flex;align-items:flex-end;gap:10px;width:100%;& .chat-message-avatar{flex-shrink:0;display:flex;align-items:center;height:calc( `,
|
|
25
25
|
` * `,
|
|
@@ -36,7 +36,7 @@ var StyledChatMessage = styled.div.withConfig({
|
|
|
36
36
|
`;color:`,
|
|
37
37
|
`;`,
|
|
38
38
|
`;padding:9px 14px;border-radius:16px 16px 4px 16px;margin-left:auto;width:fit-content;max-width:min(560px,88%);font-weight:500;white-space:pre-wrap;overflow-wrap:anywhere;}`
|
|
39
|
-
], theme
|
|
39
|
+
], primaryFillColor(theme), filledTextColor(theme, "primary"), darkFilledTextRule(theme, "primary")) : css([`& .chat-message-content{color:`, `;width:100%;}& .chat-message-avatar{position:sticky;bottom:0;}`], theme.colors.dark));
|
|
40
40
|
function LocalChatMessage({ children, $role = "assistant", $avatar, ...props }, ref) {
|
|
41
41
|
return /*#__PURE__*/ jsxs(StyledChatMessage, {
|
|
42
42
|
$role,
|
package/dist/chat-sources.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { alpha, interactiveStyles } from "./utils/mixins.js";
|
|
3
|
+
import { accentColor, alpha, interactiveStyles } from "./utils/mixins.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
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-
|
|
10
|
+
componentId: "sc-1650021a-0"
|
|
11
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-
|
|
14
|
+
componentId: "sc-1650021a-1"
|
|
15
15
|
})([
|
|
16
16
|
`position:relative;text-decoration:none;font-size:`,
|
|
17
17
|
`;line-height:1;color:`,
|
|
@@ -20,7 +20,7 @@ var StyledChatSource = styled.a.withConfig({
|
|
|
20
20
|
`;`,
|
|
21
21
|
`;& svg{width:14px;height:14px;flex-shrink:0;}&:hover{color:`,
|
|
22
22
|
`;}`
|
|
23
|
-
], ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.colors.primary, ({ theme }) => alpha(theme.colors.primaryLight, 10), ({ theme }) => theme.spacing.radius.xs, interactiveStyles, ({ theme }) => theme
|
|
23
|
+
], ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.colors.primary, ({ theme }) => alpha(theme.colors.primaryLight, 10), ({ theme }) => theme.spacing.radius.xs, interactiveStyles, ({ theme }) => accentColor(theme));
|
|
24
24
|
function LocalChatSources({ children, ...props }, ref) {
|
|
25
25
|
return /*#__PURE__*/ jsx(StyledChatSources, {
|
|
26
26
|
...props,
|
package/dist/dropzone.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { mq } from "./utils/theme.js";
|
|
4
|
-
import { alpha, resetButton } from "./utils/mixins.js";
|
|
4
|
+
import { alpha, darkPrimaryTintRule, primaryTintColor, resetButton } from "./utils/mixins.js";
|
|
5
5
|
import { Icon, renderIcon } from "./icon.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
@@ -155,11 +155,11 @@ function LocalDropzone({ $prompt = "Drag & drop files here", $browse, $hint, $ic
|
|
|
155
155
|
var Dropzone = /*#__PURE__*/ forwardRef(LocalDropzone);
|
|
156
156
|
var StyledDropzoneWrapper = styled.div.withConfig({
|
|
157
157
|
displayName: "dropzone__StyledDropzoneWrapper",
|
|
158
|
-
componentId: "sc-
|
|
158
|
+
componentId: "sc-6ed03d1-0"
|
|
159
159
|
})([`display:flex;flex-direction:column;gap:12px;width:100%;`]);
|
|
160
160
|
var StyledDropzone = styled.button.withConfig({
|
|
161
161
|
displayName: "dropzone__StyledDropzone",
|
|
162
|
-
componentId: "sc-
|
|
162
|
+
componentId: "sc-6ed03d1-1"
|
|
163
163
|
})([
|
|
164
164
|
``,
|
|
165
165
|
`;font-family:inherit;display:flex;flex-direction:`,
|
|
@@ -179,12 +179,12 @@ var StyledDropzone = styled.button.withConfig({
|
|
|
179
179
|
], resetButton, ({ $inline }) => $inline ? "row" : "column", ({ $inline }) => $inline ? "10px" : "8px", ({ $inline }) => $inline ? "10px 14px" : "24px 20px", ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme, $inline }) => $inline ? "transparent" : theme.colors.light, ({ theme }) => theme.colors.grayDark, ({ $inline }) => $inline ? "left" : "center", ({ theme, $dragOver }) => $dragOver && css([
|
|
180
180
|
`border-color:`,
|
|
181
181
|
`;background:`,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
], theme.colors.primary,
|
|
182
|
+
`;`,
|
|
183
|
+
``
|
|
184
|
+
], theme.colors.primary, primaryTintColor(theme, "drop"), darkPrimaryTintRule(theme, "drop")), ({ theme }) => theme.colors.primary, ({ theme }) => primaryTintColor(theme, "hover"), ({ theme }) => theme.colors.primary, ({ theme }) => theme.colors.primaryLight);
|
|
185
185
|
var StyledDropIcon = styled.span.withConfig({
|
|
186
186
|
displayName: "dropzone__StyledDropIcon",
|
|
187
|
-
componentId: "sc-
|
|
187
|
+
componentId: "sc-6ed03d1-2"
|
|
188
188
|
})([
|
|
189
189
|
`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:`,
|
|
190
190
|
`;height:`,
|
|
@@ -198,7 +198,7 @@ var StyledDropIcon = styled.span.withConfig({
|
|
|
198
198
|
], ({ $inline }) => $inline ? "32px" : "44px", ({ $inline }) => $inline ? "32px" : "44px", ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.primary, ({ $inline }) => $inline ? "18px" : "22px", ({ $inline }) => $inline ? "18px" : "22px");
|
|
199
199
|
var StyledDropPrompt = styled.span.withConfig({
|
|
200
200
|
displayName: "dropzone__StyledDropPrompt",
|
|
201
|
-
componentId: "sc-
|
|
201
|
+
componentId: "sc-6ed03d1-3"
|
|
202
202
|
})([
|
|
203
203
|
`display:flex;flex-direction:`,
|
|
204
204
|
`;flex-wrap:wrap;align-items:baseline;gap:`,
|
|
@@ -210,7 +210,7 @@ var StyledDropPrompt = styled.span.withConfig({
|
|
|
210
210
|
], ({ $inline }) => $inline ? "row" : "column", ({ $inline }) => $inline ? "0 6px" : "2px", ({ theme }) => theme.fontSizes.text.xs, ({ theme }) => theme.lineHeights.text.xs, ({ theme }) => theme.colors.dark, ({ theme }) => theme.colors.grayDark);
|
|
211
211
|
var StyledDropHint = styled.span.withConfig({
|
|
212
212
|
displayName: "dropzone__StyledDropHint",
|
|
213
|
-
componentId: "sc-
|
|
213
|
+
componentId: "sc-6ed03d1-4"
|
|
214
214
|
})([
|
|
215
215
|
`font-family:inherit;font-size:`,
|
|
216
216
|
`;line-height:`,
|
|
@@ -220,11 +220,11 @@ var StyledDropHint = styled.span.withConfig({
|
|
|
220
220
|
], ({ theme }) => theme.fontSizes.small.xs, ({ theme }) => theme.lineHeights.small.xs, ({ theme }) => theme.colors.gray, ({ $inline }) => $inline && css([`margin-left:auto;`]));
|
|
221
221
|
var StyledThumbs = styled.div.withConfig({
|
|
222
222
|
displayName: "dropzone__StyledThumbs",
|
|
223
|
-
componentId: "sc-
|
|
223
|
+
componentId: "sc-6ed03d1-5"
|
|
224
224
|
})([`display:grid;grid-template-columns:repeat(auto-fill,72px);gap:10px;`, `{grid-template-columns:repeat(auto-fill,84px);}`], mq("sm"));
|
|
225
225
|
var StyledThumb = styled.div.withConfig({
|
|
226
226
|
displayName: "dropzone__StyledThumb",
|
|
227
|
-
componentId: "sc-
|
|
227
|
+
componentId: "sc-6ed03d1-6"
|
|
228
228
|
})([
|
|
229
229
|
`position:relative;width:72px;height:72px;border-radius:`,
|
|
230
230
|
`;overflow:hidden;border:solid 1px `,
|
|
@@ -234,7 +234,7 @@ var StyledThumb = styled.div.withConfig({
|
|
|
234
234
|
], ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.light, mq("sm"));
|
|
235
235
|
var StyledThumbFile = styled.span.withConfig({
|
|
236
236
|
displayName: "dropzone__StyledThumbFile",
|
|
237
|
-
componentId: "sc-
|
|
237
|
+
componentId: "sc-6ed03d1-7"
|
|
238
238
|
})([
|
|
239
239
|
`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;height:100%;padding:6px;color:`,
|
|
240
240
|
`;& svg{width:20px;height:20px;color:`,
|
|
@@ -242,7 +242,7 @@ var StyledThumbFile = styled.span.withConfig({
|
|
|
242
242
|
], ({ theme }) => theme.colors.grayDark, ({ theme }) => theme.colors.primary);
|
|
243
243
|
var StyledThumbRemove = styled.button.withConfig({
|
|
244
244
|
displayName: "dropzone__StyledThumbRemove",
|
|
245
|
-
componentId: "sc-
|
|
245
|
+
componentId: "sc-6ed03d1-8"
|
|
246
246
|
})([
|
|
247
247
|
``,
|
|
248
248
|
`;position:absolute;top:4px;right:4px;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;color:#ffffff;background:`,
|
package/dist/icon-button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import {
|
|
3
|
+
import { darkPrimaryTintRule, primaryTintColor, resetButton, shade, tint } from "./utils/mixins.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
import styled, { css } from "styled-components";
|
|
@@ -57,9 +57,9 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
57
57
|
`border-color:`,
|
|
58
58
|
`;background:`,
|
|
59
59
|
`;color:`,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
], theme.colors.primary,
|
|
60
|
+
`;`,
|
|
61
|
+
``
|
|
62
|
+
], theme.colors.primary, primaryTintColor(theme, "active"), theme.colors.primary, darkPrimaryTintRule(theme, "active")), disabled && css([
|
|
63
63
|
`cursor:not-allowed;background:`,
|
|
64
64
|
`;border-color:`,
|
|
65
65
|
`;color:`,
|
|
@@ -68,7 +68,7 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
68
68
|
};
|
|
69
69
|
var StyledIconButton = styled.button.withConfig({
|
|
70
70
|
displayName: "icon-button__StyledIconButton",
|
|
71
|
-
componentId: "sc-
|
|
71
|
+
componentId: "sc-4a741989-0"
|
|
72
72
|
})([``, ``], ({ theme, $size, $error, disabled, $active }) => iconButtonStyles(theme, $size, $error, disabled, $active));
|
|
73
73
|
function LocalIconButton({ ...props }, ref) {
|
|
74
74
|
return /*#__PURE__*/ jsx(StyledIconButton, {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GlobalStyles } from "./utils/global.js";
|
|
2
1
|
import { breakpoints, colors, colorsDark, fontSizes, fonts, lineHeights, mq, shadows, shadowsDark, spacing, theme, themeDark } from "./utils/theme.js";
|
|
3
|
-
import { alpha, darkFilledTextRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint } from "./utils/mixins.js";
|
|
2
|
+
import { accentColor, alpha, darkFilledTextRule, darkPrimaryTintRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, linkColor, primaryFillColor, primaryFillHoverColor, primaryTintColor, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint } from "./utils/mixins.js";
|
|
3
|
+
import { GlobalStyles } from "./utils/global.js";
|
|
4
4
|
import { createTypographyStyle, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText } from "./utils/typography.js";
|
|
5
5
|
import { useLockBodyScroll } from "./utils/use-lock-body-scroll.js";
|
|
6
6
|
import { useBelowBreakpoint, useMediaQuery } from "./utils/use-media-query.js";
|
|
@@ -44,4 +44,4 @@ import { Textarea } from "./textarea.js";
|
|
|
44
44
|
import { ThemeToggle } from "./theme-toggle.js";
|
|
45
45
|
import { StyledNotificationItem, StyledNotifications, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, useToastNotifications } from "./toast.js";
|
|
46
46
|
import { Toggle } from "./toggle.js";
|
|
47
|
-
export { Accordion, Avatar, AvatarDropzone, Box, Button, Callout, ChatContext, ChatInput, ChatLauncher, ChatMessage, ChatMessageList, ChatPanel, ChatProvider, ChatSource, ChatSources, ChatTyping, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Prose, Range, Select, Space, Spinner, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, alpha, breakpoints, buttonStyles, chatTextStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, darkFilledTextRule, errorInteractiveStyles, filledTextColor, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, matchesAccept, mq, proseStyles, renderIcon, resetButton, resetInput, resolveShowcaseCommand, resolveTheme, shade, shadows, shadowsDark, showcaseCommands, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, thinScrollbar, tint, useBelowBreakpoint, useChat, useLockBodyScroll, useMediaQuery, useModalLayer, useOnClickOutside, useToastNotifications };
|
|
47
|
+
export { Accordion, Avatar, AvatarDropzone, Box, Button, Callout, ChatContext, ChatInput, ChatLauncher, ChatMessage, ChatMessageList, ChatPanel, ChatProvider, ChatSource, ChatSources, ChatTyping, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Prose, Range, Select, Space, Spinner, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, accentColor, alpha, breakpoints, buttonStyles, chatTextStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, darkFilledTextRule, darkPrimaryTintRule, errorInteractiveStyles, filledTextColor, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, linkColor, matchesAccept, mq, primaryFillColor, primaryFillHoverColor, primaryTintColor, proseStyles, renderIcon, resetButton, resetInput, resolveShowcaseCommand, resolveTheme, shade, shadows, shadowsDark, showcaseCommands, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, thinScrollbar, tint, useBelowBreakpoint, useChat, useLockBodyScroll, useMediaQuery, useModalLayer, useOnClickOutside, useToastNotifications };
|
package/dist/prose.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { alpha, thinScrollbar } from "./utils/mixins.js";
|
|
3
|
+
import { accentColor, alpha, thinScrollbar } from "./utils/mixins.js";
|
|
4
4
|
import { styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledSmall, styledText } from "./utils/typography.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
import styled, { css } from "styled-components";
|
|
8
8
|
//#region src/lib/prose.tsx
|
|
9
|
-
var accent = (theme) => theme.isDark ? theme.colors.primaryLight : theme.colors.primaryDark;
|
|
10
9
|
/**
|
|
11
10
|
* Styles for rendered markdown: links, lists, tables, code, media and
|
|
12
11
|
* headings. Exported so it can be applied to an element that is already
|
|
@@ -58,11 +57,11 @@ var accent = (theme) => theme.isDark ? theme.colors.primaryLight : theme.colors.
|
|
|
58
57
|
`;`,
|
|
59
58
|
`;}}& img,& video,& iframe{max-width:100%;border-radius:`,
|
|
60
59
|
`;margin:10px 0;display:block;}`
|
|
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,
|
|
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, accentColor(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);
|
|
62
61
|
};
|
|
63
62
|
var StyledProse = styled.div.withConfig({
|
|
64
63
|
displayName: "prose__StyledProse",
|
|
65
|
-
componentId: "sc-
|
|
64
|
+
componentId: "sc-eed03297-0"
|
|
66
65
|
})([``, `;`], ({ theme, $compact }) => proseStyles(theme, $compact));
|
|
67
66
|
function LocalProse({ children, ...props }, ref) {
|
|
68
67
|
return /*#__PURE__*/ jsx(StyledProse, {
|
|
@@ -59,7 +59,7 @@ function resolveColor(value) {
|
|
|
59
59
|
persistTheme(cookieValue);
|
|
60
60
|
}
|
|
61
61
|
const wantDark = cookieValue === "dark";
|
|
62
|
-
if (initialTheme.isDark !== wantDark) {
|
|
62
|
+
if (Boolean(initialTheme.isDark) !== wantDark) {
|
|
63
63
|
setOverrideTheme(wantDark ? themeDark : theme);
|
|
64
64
|
setReconciled(true);
|
|
65
65
|
return;
|
|
@@ -73,7 +73,7 @@ function resolveColor(value) {
|
|
|
73
73
|
}, [overrideTheme]);
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
if (!reconciled) return;
|
|
76
|
-
document.documentElement.classList.toggle("dark", effectiveTheme.isDark);
|
|
76
|
+
document.documentElement.classList.toggle("dark", Boolean(effectiveTheme.isDark));
|
|
77
77
|
}, [effectiveTheme.isDark, reconciled]);
|
|
78
78
|
useEffect(() => {
|
|
79
79
|
if (!$themeColor) return;
|
|
@@ -99,7 +99,7 @@ function resolveColor(value) {
|
|
|
99
99
|
if (!themeDark) return;
|
|
100
100
|
setTheme(effectiveTheme.isDark ? theme : themeDark);
|
|
101
101
|
};
|
|
102
|
-
const GlobalStylesComponent = $globalStyles ? GlobalStyles(effectiveTheme) : null;
|
|
102
|
+
const GlobalStylesComponent = useMemo(() => $globalStyles ? GlobalStyles(effectiveTheme) : null, [$globalStyles, effectiveTheme]);
|
|
103
103
|
return /*#__PURE__*/ jsx(ThemeProvider, {
|
|
104
104
|
theme: effectiveTheme,
|
|
105
105
|
children: /*#__PURE__*/ jsxs(ThemeContext.Provider, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { GlobalStyles } from "../utils/global.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { createContext, useEffect, useState } from "react";
|
|
5
|
+
import { createContext, useEffect, useMemo, useState } from "react";
|
|
6
6
|
import { ThemeProvider } from "styled-components";
|
|
7
7
|
//#region src/lib/styled-components/theme-provider.tsx
|
|
8
8
|
var ThemeContext = /*#__PURE__*/ createContext({
|
|
@@ -26,9 +26,9 @@ function CherryThemeProvider({ children, theme, themeDark }) {
|
|
|
26
26
|
const next = currentTheme.isDark ? theme : themeDark;
|
|
27
27
|
setTheme(next);
|
|
28
28
|
localStorage.theme = next.isDark ? "dark" : "light";
|
|
29
|
-
document.documentElement.classList.toggle("dark", next.isDark);
|
|
29
|
+
document.documentElement.classList.toggle("dark", Boolean(next.isDark));
|
|
30
30
|
};
|
|
31
|
-
const GlobalStylesComponent = GlobalStyles(currentTheme);
|
|
31
|
+
const GlobalStylesComponent = useMemo(() => GlobalStyles(currentTheme), [currentTheme]);
|
|
32
32
|
return /*#__PURE__*/ jsx(ThemeProvider, {
|
|
33
33
|
theme: currentTheme,
|
|
34
34
|
children: /*#__PURE__*/ jsxs(ThemeContext.Provider, {
|
package/dist/theme-toggle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { alpha, interactiveStyles, resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { accentColor, alpha, interactiveStyles, resetButton } from "./utils/mixins.js";
|
|
4
4
|
import { ThemeContext } from "./styled-components/theme-provider.js";
|
|
5
5
|
import { Icon } from "./icon.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -10,7 +10,7 @@ import { MoonStar, Sun } from "lucide-react";
|
|
|
10
10
|
//#region src/lib/theme-toggle.tsx
|
|
11
11
|
var StyledThemeToggle = styled.button.withConfig({
|
|
12
12
|
displayName: "theme-toggle__StyledThemeToggle",
|
|
13
|
-
componentId: "sc-
|
|
13
|
+
componentId: "sc-9b39d035-0"
|
|
14
14
|
})([
|
|
15
15
|
``,
|
|
16
16
|
` `,
|
|
@@ -21,9 +21,9 @@ var StyledThemeToggle = styled.button.withConfig({
|
|
|
21
21
|
`}:root.dark &::after{transform:translateX(26px);}`,
|
|
22
22
|
` & svg{width:16px;height:16px;object-fit:contain;transition:all 0.3s ease;position:relative;z-index:2;}& svg[stroke]{stroke:`,
|
|
23
23
|
`;}&:hover svg[stroke]{stroke:`,
|
|
24
|
-
`;}
|
|
25
|
-
|
|
26
|
-
], resetButton, interactiveStyles, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => alpha(theme.colors.primaryLight, 20), ({ theme }) => theme.isDark && css([`transform:translateX(26px);`]), ({ $hidden }) => $hidden && css([`display:none;`]), ({ theme }) => theme.colors.primary, ({ theme }) => theme
|
|
24
|
+
`;}`,
|
|
25
|
+
``
|
|
26
|
+
], resetButton, interactiveStyles, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => alpha(theme.colors.primaryLight, 20), ({ theme }) => theme.isDark && css([`transform:translateX(26px);`]), ({ $hidden }) => $hidden && css([`display:none;`]), ({ theme }) => theme.colors.primary, ({ theme }) => accentColor(theme), ({ theme }) => !theme.colors.accent && css([`:root.dark &:hover svg[stroke]{stroke:`, `;}`], theme.colors.primaryLight));
|
|
27
27
|
function LocalThemeToggle({ onClick, $shortcut = false, ...props }, ref) {
|
|
28
28
|
const { toggleTheme } = useContext(ThemeContext);
|
|
29
29
|
useEffect(() => {
|
package/dist/toast.js
CHANGED
|
@@ -53,11 +53,11 @@ function ToastNotificationsProvider({ children }) {
|
|
|
53
53
|
}
|
|
54
54
|
var StyledNotifications = styled.ul.withConfig({
|
|
55
55
|
displayName: "toast__StyledNotifications",
|
|
56
|
-
componentId: "sc-
|
|
56
|
+
componentId: "sc-43455f54-0"
|
|
57
57
|
})([`position:fixed;z-index:99999;margin:0;padding:0;list-style:none;left:20px;right:20px;pointer-events:none;`, ``], ({ $bottom }) => $bottom ? css([`bottom:20px;`]) : css([`top:20px;`]));
|
|
58
58
|
var StyledNotificationItem = styled.li.withConfig({
|
|
59
59
|
displayName: "toast__StyledNotificationItem",
|
|
60
|
-
componentId: "sc-
|
|
60
|
+
componentId: "sc-43455f54-1"
|
|
61
61
|
})([
|
|
62
62
|
`display:grid;grid-template-rows:0fr;justify-items:center;margin:0;padding:0;opacity:0;pointer-events:none;transform:translateY(`,
|
|
63
63
|
`);transition:opacity 0.2s ease,transform 0.2s ease,grid-template-rows 0.25s ease 0.15s,margin 0.25s ease 0.15s;`,
|
|
@@ -73,7 +73,7 @@ var StyledNotificationItem = styled.li.withConfig({
|
|
|
73
73
|
`;}}& .message{flex:1;min-width:0;line-height:1.5;overflow-wrap:anywhere;}& .close-button{flex-shrink:0;}}`,
|
|
74
74
|
` `,
|
|
75
75
|
``
|
|
76
|
-
], ({ $bottom }) => $bottom ? "20px" : "-20px", ({ $align }) => $align === "right" && css([`justify-items:end;`]), ({ $align }) => $align === "left" && css([`justify-items:start;`]), ({ theme }) => theme.spacing.radius.xl, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.isDark ? theme.shadows.sm : theme.shadows.xs, ({ theme }) => theme.colors.dark, ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.lineHeights.small.lg, ({ theme, $color }) => theme.colors[$color], ({ $visible, $bottom }) => $visible && css([`opacity:1;transform:translateY(0);grid-template-rows:1fr;transition:grid-template-rows 0.25s ease,margin 0.25s ease,opacity 0.2s ease 0.15s,transform 0.2s ease 0.15s;& .item{pointer-events:auto;}`, ``], $bottom ? css([`margin-top:10px;`]) : css([`margin-bottom:10px;`])), ({ $static }) => $static && css([`position:relative;z-index:10;`]));
|
|
76
|
+
], ({ $bottom }) => $bottom ? "20px" : "-20px", ({ $align }) => $align === "right" && css([`justify-items:end;`]), ({ $align }) => $align === "left" && css([`justify-items:start;`]), ({ theme }) => theme.spacing.radius.xl, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.shadows.toast ?? (theme.isDark ? theme.shadows.sm : theme.shadows.xs), ({ theme }) => theme.colors.dark, ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.lineHeights.small.lg, ({ theme, $color }) => theme.colors[$color], ({ $visible, $bottom }) => $visible && css([`opacity:1;transform:translateY(0);grid-template-rows:1fr;transition:grid-template-rows 0.25s ease,margin 0.25s ease,opacity 0.2s ease 0.15s,transform 0.2s ease 0.15s;& .item{pointer-events:auto;}`, ``], $bottom ? css([`margin-top:10px;`]) : css([`margin-bottom:10px;`])), ({ $static }) => $static && css([`position:relative;z-index:10;`]));
|
|
77
77
|
function ToastNotifications({ $align = "center", $bottom }) {
|
|
78
78
|
const { notifications } = useToastNotifications();
|
|
79
79
|
return /*#__PURE__*/ jsx(StyledNotifications, {
|
package/dist/utils/global.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
+
import { linkColor } from "./mixins.js";
|
|
3
4
|
import { createGlobalStyle } from "styled-components";
|
|
4
5
|
//#region src/lib/utils/global.tsx
|
|
5
6
|
var GlobalStyles = (theme) => createGlobalStyle([
|
|
@@ -8,6 +9,6 @@ var GlobalStyles = (theme) => createGlobalStyle([
|
|
|
8
9
|
`;}a{color:`,
|
|
9
10
|
`;}ol,ul{list-style:none;margin:0;padding:0;}figure{margin:0;}fieldset{appearance:none;border:none;}button,input,a,img,svg,svg *{transition:all 0.3s ease;}strong,b{font-weight:700;}hr{margin:20px 0;border:none;border-bottom:1px solid `,
|
|
10
11
|
`;}`
|
|
11
|
-
], theme.colors.light, theme.colors.dark, theme
|
|
12
|
+
], theme.colors.light, theme.colors.dark, linkColor(theme), theme.colors.grayLight);
|
|
12
13
|
//#endregion
|
|
13
14
|
export { GlobalStyles };
|
package/dist/utils/mixins.d.ts
CHANGED
|
@@ -9,12 +9,43 @@ export declare const alpha: (color: string, percent: number) => string;
|
|
|
9
9
|
export declare const shade: (color: string, percent: number) => string;
|
|
10
10
|
/** Lightens a color by mixing it toward white. See `alpha` for why it is CSS. */
|
|
11
11
|
export declare const tint: (color: string, percent: number) => string;
|
|
12
|
+
/** The solid primary fill: the theme's `primaryFill`, else `primary`. */
|
|
13
|
+
export declare const primaryFillColor: (theme: Theme) => string;
|
|
14
|
+
/** The solid primary fill on hover: a shade of `primaryFill`, else `primaryDark`. */
|
|
15
|
+
export declare const primaryFillHoverColor: (theme: Theme) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Hover and emphasis text on a surface: the theme's `accent` when it sets
|
|
18
|
+
* one, else the end of the primary ramp that contrasts with the mode,
|
|
19
|
+
* `primaryDark` in light mode and `primaryLight` in dark mode.
|
|
20
|
+
*/
|
|
21
|
+
export declare const accentColor: (theme: Theme) => string;
|
|
22
|
+
/**
|
|
23
|
+
* The link color: the theme's `link` when it sets one, else `primary` in
|
|
24
|
+
* light mode and `dark` in dark mode.
|
|
25
|
+
*/
|
|
26
|
+
export declare const linkColor: (theme: Theme) => string;
|
|
27
|
+
/** Which primary tint a surface takes: hovered, dragged over, or active. */
|
|
28
|
+
export type PrimaryTintKind = "hover" | "drop" | "active";
|
|
29
|
+
/**
|
|
30
|
+
* A primary tint behind a surface: the theme's `primaryTintHover`,
|
|
31
|
+
* `primaryTintDrop` or `primaryTintActive` when it sets one, else `primary`
|
|
32
|
+
* faded to the mode's amount.
|
|
33
|
+
*/
|
|
34
|
+
export declare const primaryTintColor: (theme: Theme, kind: PrimaryTintKind) => string;
|
|
35
|
+
/**
|
|
36
|
+
* The dark-mode tint restated as a rule scoped to a `dark` class on <html>,
|
|
37
|
+
* for apps that resolve the mode in CSS before hydration can swap the theme
|
|
38
|
+
* object. Empty when the theme sets the token: a token already follows the
|
|
39
|
+
* mode, and the rule would override it inside a light-mode island.
|
|
40
|
+
*/
|
|
41
|
+
export declare const darkPrimaryTintRule: (theme: Theme, kind: PrimaryTintKind) => string;
|
|
12
42
|
/** Which fill a label sits on, so a theme's `onPrimary` can answer for its own. */
|
|
13
43
|
export type FilledTextFill = "primary" | "other";
|
|
14
44
|
/**
|
|
15
45
|
* Text color for a label sitting on a brand-colored fill: the theme's
|
|
16
|
-
* `onPrimary` on a primary fill when it sets one, else the
|
|
17
|
-
* contrasting end, `light` in light mode and
|
|
46
|
+
* `onPrimary` on a primary fill when it sets one, else the theme's
|
|
47
|
+
* `onFilled`, else the palette's contrasting end, `light` in light mode and
|
|
48
|
+
* `dark` in dark mode.
|
|
18
49
|
*/
|
|
19
50
|
export declare const filledTextColor: (theme: Theme, fill?: FilledTextFill) => string;
|
|
20
51
|
/**
|
|
@@ -23,7 +54,8 @@ export declare const filledTextColor: (theme: Theme, fill?: FilledTextFill) => s
|
|
|
23
54
|
* theme object. Additive: with an already-dark theme object both paths resolve
|
|
24
55
|
* to the same color. A dark theme object's `onPrimary` answers for a primary
|
|
25
56
|
* fill; a light one under the class cannot know the dark value, so it keeps
|
|
26
|
-
* the palette's `dark`.
|
|
57
|
+
* the palette's `dark`. Empty when the theme sets `onFilled`: its tokens
|
|
58
|
+
* already follow the mode. Interpolate alongside `filledTextColor`.
|
|
27
59
|
*/
|
|
28
60
|
export declare const darkFilledTextRule: (theme: Theme, fill?: FilledTextFill) => string;
|
|
29
61
|
/**
|
package/dist/utils/mixins.js
CHANGED
|
@@ -10,19 +10,56 @@ import { css } from "styled-components";
|
|
|
10
10
|
*/ var alpha = (color, percent) => `color-mix(in srgb, ${color} ${percent}%, transparent)`;
|
|
11
11
|
/** Darkens a color by mixing it toward black. See `alpha` for why it is CSS. */ var shade = (color, percent) => `color-mix(in srgb, ${color} ${100 - percent}%, black)`;
|
|
12
12
|
/** Lightens a color by mixing it toward white. See `alpha` for why it is CSS. */ var tint = (color, percent) => `color-mix(in srgb, ${color} ${100 - percent}%, white)`;
|
|
13
|
+
/** The solid primary fill: the theme's `primaryFill`, else `primary`. */ var primaryFillColor = (theme) => theme.colors.primaryFill ?? theme.colors.primary;
|
|
14
|
+
/** The solid primary fill on hover: a shade of `primaryFill`, else `primaryDark`. */ var primaryFillHoverColor = (theme) => theme.colors.primaryFill ? shade(theme.colors.primaryFill, 10) : theme.colors.primaryDark;
|
|
15
|
+
/**
|
|
16
|
+
* Hover and emphasis text on a surface: the theme's `accent` when it sets
|
|
17
|
+
* one, else the end of the primary ramp that contrasts with the mode,
|
|
18
|
+
* `primaryDark` in light mode and `primaryLight` in dark mode.
|
|
19
|
+
*/ var accentColor = (theme) => theme.colors.accent ?? (theme.isDark ? theme.colors.primaryLight : theme.colors.primaryDark);
|
|
20
|
+
/**
|
|
21
|
+
* The link color: the theme's `link` when it sets one, else `primary` in
|
|
22
|
+
* light mode and `dark` in dark mode.
|
|
23
|
+
*/ var linkColor = (theme) => theme.colors.link ?? (theme.isDark ? theme.colors.dark : theme.colors.primary);
|
|
24
|
+
var primaryTintTokens = {
|
|
25
|
+
hover: "primaryTintHover",
|
|
26
|
+
drop: "primaryTintDrop",
|
|
27
|
+
active: "primaryTintActive"
|
|
28
|
+
};
|
|
29
|
+
/** The fallback amounts of `primary`, in percent: [light mode, dark mode]. */ var primaryTintAmounts = {
|
|
30
|
+
hover: [4, 10],
|
|
31
|
+
drop: [5, 12],
|
|
32
|
+
active: [10, 18]
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A primary tint behind a surface: the theme's `primaryTintHover`,
|
|
36
|
+
* `primaryTintDrop` or `primaryTintActive` when it sets one, else `primary`
|
|
37
|
+
* faded to the mode's amount.
|
|
38
|
+
*/ var primaryTintColor = (theme, kind) => {
|
|
39
|
+
const [light, dark] = primaryTintAmounts[kind];
|
|
40
|
+
return theme.colors[primaryTintTokens[kind]] ?? alpha(theme.colors.primary, theme.isDark ? dark : light);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The dark-mode tint restated as a rule scoped to a `dark` class on <html>,
|
|
44
|
+
* for apps that resolve the mode in CSS before hydration can swap the theme
|
|
45
|
+
* object. Empty when the theme sets the token: a token already follows the
|
|
46
|
+
* mode, and the rule would override it inside a light-mode island.
|
|
47
|
+
*/ var darkPrimaryTintRule = (theme, kind) => theme.colors[primaryTintTokens[kind]] ? "" : `:root.dark & { background: ${alpha(theme.colors.primary, primaryTintAmounts[kind][1])}; }`;
|
|
13
48
|
/**
|
|
14
49
|
* Text color for a label sitting on a brand-colored fill: the theme's
|
|
15
|
-
* `onPrimary` on a primary fill when it sets one, else the
|
|
16
|
-
* contrasting end, `light` in light mode and
|
|
17
|
-
|
|
50
|
+
* `onPrimary` on a primary fill when it sets one, else the theme's
|
|
51
|
+
* `onFilled`, else the palette's contrasting end, `light` in light mode and
|
|
52
|
+
* `dark` in dark mode.
|
|
53
|
+
*/ var filledTextColor = (theme, fill = "other") => fill === "primary" && theme.colors.onPrimary ? theme.colors.onPrimary : theme.colors.onFilled ?? (theme.isDark ? theme.colors.dark : theme.colors.light);
|
|
18
54
|
/**
|
|
19
55
|
* The same choice restated as a rule scoped to a `dark` class on <html>, which
|
|
20
56
|
* is what apps resolving the mode in CSS key off before hydration can swap the
|
|
21
57
|
* theme object. Additive: with an already-dark theme object both paths resolve
|
|
22
58
|
* to the same color. A dark theme object's `onPrimary` answers for a primary
|
|
23
59
|
* fill; a light one under the class cannot know the dark value, so it keeps
|
|
24
|
-
* the palette's `dark`.
|
|
25
|
-
|
|
60
|
+
* the palette's `dark`. Empty when the theme sets `onFilled`: its tokens
|
|
61
|
+
* already follow the mode. Interpolate alongside `filledTextColor`.
|
|
62
|
+
*/ var darkFilledTextRule = (theme, fill = "other") => theme.colors.onFilled ? "" : `:root.dark & { color: ${fill === "primary" && theme.isDark && theme.colors.onPrimary ? theme.colors.onPrimary : theme.colors.dark}; }`;
|
|
26
63
|
/**
|
|
27
64
|
* Slim, theme-aware scrollbar for internal scroll areas (chat transcripts, code
|
|
28
65
|
* blocks, tables) so the chunky native bar doesn't stand out, especially in
|
|
@@ -108,4 +145,4 @@ var generateDirectionStyles = (size, direction) => css([
|
|
|
108
145
|
`;}`
|
|
109
146
|
], mq(size), direction && `${direction}`);
|
|
110
147
|
//#endregion
|
|
111
|
-
export { alpha, darkFilledTextRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint };
|
|
148
|
+
export { accentColor, alpha, darkFilledTextRule, darkPrimaryTintRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, linkColor, primaryFillColor, primaryFillHoverColor, primaryTintColor, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint };
|
package/dist/utils/theme.d.ts
CHANGED
|
@@ -65,6 +65,48 @@ export interface Colors<TString = string> {
|
|
|
65
65
|
* contrasting end, as `filledTextColor` describes.
|
|
66
66
|
*/
|
|
67
67
|
onPrimary?: TString;
|
|
68
|
+
/**
|
|
69
|
+
* Optional fill for the solid primary surfaces (the primary button, the
|
|
70
|
+
* sent chat bubble, the primary avatar), whose label is `onPrimary`. Set it
|
|
71
|
+
* when the theme's `primary` is too bright to carry a label but still right
|
|
72
|
+
* for accents (links, rings, outlines): the fills take this deeper shade
|
|
73
|
+
* and the accents keep `primary`. Without it the fills use `primary`.
|
|
74
|
+
*/
|
|
75
|
+
primaryFill?: TString;
|
|
76
|
+
/**
|
|
77
|
+
* Hover and emphasis text on a surface (Prose links on hover, the
|
|
78
|
+
* ChatSources and ChatLauncher text, the ThemeToggle glyph on hover).
|
|
79
|
+
* Without it: `primaryDark` in light mode, `primaryLight` in dark mode.
|
|
80
|
+
*/
|
|
81
|
+
accent?: TString;
|
|
82
|
+
/**
|
|
83
|
+
* The color of links in `GlobalStyles`. Without it: `primary` in light
|
|
84
|
+
* mode, `dark` in dark mode.
|
|
85
|
+
*/
|
|
86
|
+
link?: TString;
|
|
87
|
+
/**
|
|
88
|
+
* The label on a filled control that is not primary (a secondary,
|
|
89
|
+
* tertiary or error Button, a colored Avatar), and on a primary fill when
|
|
90
|
+
* the theme sets no `onPrimary`. Without it: `light` in light mode,
|
|
91
|
+
* `dark` in dark mode.
|
|
92
|
+
*/
|
|
93
|
+
onFilled?: TString;
|
|
94
|
+
/**
|
|
95
|
+
* The primary tint behind a hovered Dropzone or AvatarDropzone. Without
|
|
96
|
+
* it: `primary` at 4% in light mode, 10% in dark mode.
|
|
97
|
+
*/
|
|
98
|
+
primaryTintHover?: TString;
|
|
99
|
+
/**
|
|
100
|
+
* The primary tint behind a Dropzone or AvatarDropzone while a file is
|
|
101
|
+
* dragged over it. Without it: `primary` at 5% in light mode, 12% in dark
|
|
102
|
+
* mode.
|
|
103
|
+
*/
|
|
104
|
+
primaryTintDrop?: TString;
|
|
105
|
+
/**
|
|
106
|
+
* The primary tint behind an active (`$active`) IconButton. Without it:
|
|
107
|
+
* `primary` at 10% in light mode, 18% in dark mode.
|
|
108
|
+
*/
|
|
109
|
+
primaryTintActive?: TString;
|
|
68
110
|
}
|
|
69
111
|
export interface Shadows<TString = string> {
|
|
70
112
|
xs: TString;
|
|
@@ -72,6 +114,11 @@ export interface Shadows<TString = string> {
|
|
|
72
114
|
md: TString;
|
|
73
115
|
lg: TString;
|
|
74
116
|
xl: TString;
|
|
117
|
+
/**
|
|
118
|
+
* Optional: the Toast's shadow. Without it: `xs` in light mode, `sm` in
|
|
119
|
+
* dark mode (see the mode tokens on `Colors`).
|
|
120
|
+
*/
|
|
121
|
+
toast?: TString;
|
|
75
122
|
}
|
|
76
123
|
export interface Fonts<TString = string> {
|
|
77
124
|
head: TString;
|
|
@@ -250,5 +297,11 @@ export interface Theme {
|
|
|
250
297
|
fonts: Fonts;
|
|
251
298
|
fontSizes: FontSizes;
|
|
252
299
|
lineHeights: LineHeights;
|
|
253
|
-
|
|
300
|
+
/**
|
|
301
|
+
* Whether this theme object holds the dark palette. Optional: a theme
|
|
302
|
+
* whose colors are CSS variables serves both modes and leaves it out,
|
|
303
|
+
* setting the mode tokens (`colors.accent`, `colors.onFilled`, ...)
|
|
304
|
+
* instead. Absent reads as light.
|
|
305
|
+
*/
|
|
306
|
+
isDark?: boolean;
|
|
254
307
|
}
|
package/package.json
CHANGED