@stll/ui 0.47.1 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,7 +13,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
13
13
|
*/
|
|
14
14
|
declare const buttonAccessibleDisabledClass = "cursor-not-allowed opacity-64";
|
|
15
15
|
declare const buttonVariants: (props?: ({
|
|
16
|
-
size?: "
|
|
16
|
+
size?: "default" | "icon" | "row" | "chip" | "icon-lg" | "icon-sm" | "icon-xl" | "icon-xs" | "lg" | "sm" | "xl" | "xs" | null | undefined;
|
|
17
17
|
variant?: "link" | "default" | "destructive" | "destructive-outline" | "destructive-ghost" | "ghost" | "muted" | "outline" | "secondary" | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
type ButtonProps = {
|
|
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
5
5
|
//#region src/components/input-group.d.ts
|
|
6
6
|
declare const InputGroup: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
7
7
|
declare const inputGroupAddonVariants: (props?: ({
|
|
8
|
-
align?: "inline-
|
|
8
|
+
align?: "inline-start" | "block-end" | "block-start" | "inline-end" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
declare const InputGroupAddon: ({ className, align, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) => React$1.JSX.Element;
|
|
11
11
|
declare const InputGroupText: ({ className, ...props }: React$1.ComponentProps<"span">) => React$1.JSX.Element;
|
|
@@ -33,7 +33,7 @@ declare function useSidebarLayout(): SidebarLayout;
|
|
|
33
33
|
* left for the content column. Mobile reports 0: there the sidebar is an
|
|
34
34
|
* overlay sheet and occupies no layout width.
|
|
35
35
|
*/
|
|
36
|
-
declare function useSidebarInlineSize(): 0 |
|
|
36
|
+
declare function useSidebarInlineSize(): 0 | 48 | 256;
|
|
37
37
|
declare const SidebarProvider: ({ defaultOpen, forceCollapsed, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<"div"> & {
|
|
38
38
|
defaultOpen?: boolean;
|
|
39
39
|
forceCollapsed?: boolean;
|
|
@@ -62,14 +62,18 @@ export declare const SEARCH_HIT_DESCENDANT_MARK_CLASS = "[&_mark]:box-decoration
|
|
|
62
62
|
type TextMarkHighlightRuleOptions = {
|
|
63
63
|
/** The registered `CSS.highlights` name. */
|
|
64
64
|
name: string;
|
|
65
|
+
/** Defaults to a fill, the find mark. */
|
|
66
|
+
variant?: TextMarkVariant | undefined;
|
|
65
67
|
tone: TextMarkTone;
|
|
66
|
-
state:
|
|
68
|
+
state: TextMarkState;
|
|
67
69
|
};
|
|
68
70
|
/**
|
|
69
|
-
* A
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* A mark for the CSS Custom Highlight API, for text a surface marks as ranges
|
|
72
|
+
* rather than elements (a find over a reader, verdicts over painted document
|
|
73
|
+
* pages). `::highlight()` takes colours and text decorations but no classes,
|
|
74
|
+
* custom properties, offsets or rings, so the rule restates the variant's
|
|
75
|
+
* line and the state's wash; the active range is told apart by its stronger
|
|
76
|
+
* wash alone.
|
|
73
77
|
*/
|
|
74
|
-
export declare const textMarkHighlightRule: ({ name, tone, state }: TextMarkHighlightRuleOptions) => string;
|
|
78
|
+
export declare const textMarkHighlightRule: ({ name, variant, tone, state }: TextMarkHighlightRuleOptions) => string;
|
|
75
79
|
//#endregion
|
package/dist/review/text-mark.js
CHANGED
|
@@ -58,15 +58,20 @@ const textMarkClass = ({ variant, tone, state = "rest", weight = "inherit" }) =>
|
|
|
58
58
|
*/
|
|
59
59
|
const SEARCH_HIT_DESCENDANT_MARK_CLASS = "[&_mark]:box-decoration-clone [&_mark]:text-foreground [&_mark]:[--text-mark:var(--warning)] [&_mark]:bg-(--text-mark)/30 [&_mark]:dark:bg-(--text-mark)/20 [&_mark]:font-medium";
|
|
60
60
|
/**
|
|
61
|
-
* A
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* A mark for the CSS Custom Highlight API, for text a surface marks as ranges
|
|
62
|
+
* rather than elements (a find over a reader, verdicts over painted document
|
|
63
|
+
* pages). `::highlight()` takes colours and text decorations but no classes,
|
|
64
|
+
* custom properties, offsets or rings, so the rule restates the variant's
|
|
65
|
+
* line and the state's wash; the active range is told apart by its stronger
|
|
66
|
+
* wash alone.
|
|
65
67
|
*/
|
|
66
|
-
const textMarkHighlightRule = ({ name, tone, state }) => {
|
|
68
|
+
const textMarkHighlightRule = ({ name, variant = "fill", tone, state }) => {
|
|
67
69
|
const color = TEXT_MARK_TONE_COLOR[tone];
|
|
68
|
-
const { light, dark } =
|
|
69
|
-
|
|
70
|
+
const { light, dark } = HIGHLIGHT_WASH_PERCENT[variant === "fill" ? "fill" : "line"][state];
|
|
71
|
+
const wash = (percent) => percent === 0 ? "transparent" : `color-mix(in oklab, ${color} ${String(percent)}%, transparent)`;
|
|
72
|
+
const line = HIGHLIGHT_LINE[variant];
|
|
73
|
+
const decoration = line === null ? "" : ` text-decoration-line: ${line.line}; text-decoration-style: ${line.style}; text-decoration-color: ${color}; text-decoration-thickness: 2px;`;
|
|
74
|
+
return [`::highlight(${name}) { background-color: ${wash(light)}; color: inherit;${decoration} }`, `.dark ::highlight(${name}) { background-color: ${wash(dark)}; }`].join("\n");
|
|
70
75
|
};
|
|
71
76
|
const TEXT_MARK_BASE_CLASS = "box-decoration-clone";
|
|
72
77
|
const LINE_CLASS = "text-inherit underline decoration-2 underline-offset-3 decoration-[color:var(--text-mark)]";
|
|
@@ -89,17 +94,6 @@ const TONE_CLASS = {
|
|
|
89
94
|
"option-red": "[--text-mark:var(--option-red)]",
|
|
90
95
|
"option-purple": "[--text-mark:var(--option-purple)]"
|
|
91
96
|
};
|
|
92
|
-
/** The fill's wash, in percent of the hue, for the highlight rule. */
|
|
93
|
-
const FILL_PERCENT = {
|
|
94
|
-
rest: {
|
|
95
|
-
light: 30,
|
|
96
|
-
dark: 20
|
|
97
|
-
},
|
|
98
|
-
active: {
|
|
99
|
-
light: 45,
|
|
100
|
-
dark: 35
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
97
|
const WASH_CLASS = {
|
|
104
98
|
fill: {
|
|
105
99
|
rest: "bg-(--text-mark)/30 dark:bg-(--text-mark)/20",
|
|
@@ -112,6 +106,58 @@ const WASH_CLASS = {
|
|
|
112
106
|
active: "bg-(--text-mark)/30 dark:bg-(--text-mark)/20 ring-1 ring-(--text-mark)"
|
|
113
107
|
}
|
|
114
108
|
};
|
|
109
|
+
/** Each layer's wash in percent of the hue, as `WASH_CLASS` spells it, for
|
|
110
|
+
* the highlight rule. */
|
|
111
|
+
const HIGHLIGHT_WASH_PERCENT = {
|
|
112
|
+
fill: {
|
|
113
|
+
rest: {
|
|
114
|
+
light: 30,
|
|
115
|
+
dark: 20
|
|
116
|
+
},
|
|
117
|
+
matched: {
|
|
118
|
+
light: 30,
|
|
119
|
+
dark: 20
|
|
120
|
+
},
|
|
121
|
+
active: {
|
|
122
|
+
light: 45,
|
|
123
|
+
dark: 35
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
line: {
|
|
127
|
+
rest: {
|
|
128
|
+
light: 0,
|
|
129
|
+
dark: 0
|
|
130
|
+
},
|
|
131
|
+
matched: {
|
|
132
|
+
light: 15,
|
|
133
|
+
dark: 15
|
|
134
|
+
},
|
|
135
|
+
active: {
|
|
136
|
+
light: 30,
|
|
137
|
+
dark: 20
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
/** Each variant's line, as `VARIANT_CLASS` draws it; a fill has none. */
|
|
142
|
+
const HIGHLIGHT_LINE = {
|
|
143
|
+
fill: null,
|
|
144
|
+
underline: {
|
|
145
|
+
line: "underline",
|
|
146
|
+
style: "solid"
|
|
147
|
+
},
|
|
148
|
+
dotted: {
|
|
149
|
+
line: "underline",
|
|
150
|
+
style: "dotted"
|
|
151
|
+
},
|
|
152
|
+
wavy: {
|
|
153
|
+
line: "underline",
|
|
154
|
+
style: "wavy"
|
|
155
|
+
},
|
|
156
|
+
strike: {
|
|
157
|
+
line: "line-through",
|
|
158
|
+
style: "solid"
|
|
159
|
+
}
|
|
160
|
+
};
|
|
115
161
|
const WEIGHT_CLASS = {
|
|
116
162
|
inherit: "",
|
|
117
163
|
medium: "font-medium"
|
package/package.json
CHANGED