@tanishqkancharla/maui 0.0.1 → 0.0.2
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/components/Button.js +0 -2
- package/dist/components/CodeBlock.d.ts +4 -0
- package/dist/components/CodeBlock.js +58 -0
- package/dist/components/Icons.d.ts +2 -0
- package/dist/components/Icons.js +4 -0
- package/dist/maui.d.ts +6 -6
- package/dist/maui.js +6 -7
- package/dist/tokens/motion.d.ts +5 -0
- package/dist/tokens/motion.js +7 -3
- package/dist/tokens/prose.d.ts +10 -0
- package/dist/tokens/prose.js +126 -0
- package/dist/tokens/sizing.d.ts +11 -0
- package/dist/tokens/sizing.js +21 -1
- package/dist/utils/mauiShikiTheme.d.ts +87 -0
- package/dist/utils/mauiShikiTheme.js +174 -0
- package/dist/utils/shiki.d.ts +7 -0
- package/dist/utils/shiki.js +69 -0
- package/package.json +32 -5
- package/skills/maui/SKILL.md +87 -0
- package/src/apps/AiChat/AiChat.tsx +418 -0
- package/src/components/Button.tsx +0 -2
- package/src/components/CodeBlock.tsx +2 -0
- package/src/components/Icons.tsx +31 -0
- package/src/css-modules.d.ts +2 -0
- package/src/index.html +40 -5
- package/src/maui.ts +25 -8
- package/src/pages/AiChatPage.tsx +26 -0
- package/src/pages/AssistantMessagePage.tsx +98 -0
- package/src/pages/BackgroundColorTokenPage.tsx +5 -2
- package/src/pages/BordersTokenPage.tsx +16 -2
- package/src/pages/EditorPage.tsx +32 -0
- package/src/pages/FlexTokenPage.tsx +14 -1
- package/src/pages/IconsPage.tsx +137 -30
- package/src/pages/Maui.tsx +37 -9
- package/src/pages/MotionTokenPage.tsx +2 -2
- package/src/pages/SizingTokenPage.tsx +68 -25
- package/src/pages/TextTokenPage.tsx +23 -4
- package/src/patterns/AssistantMessage.tsx +220 -0
- package/src/patterns/Editor.tsx +183 -0
- package/src/public/apple-touch-icon.png +0 -0
- package/src/public/favicon-dark.png +0 -0
- package/src/public/favicon-light.png +0 -0
- package/src/public/favicon.svg +13 -0
- package/src/public/og-dark.png +0 -0
- package/src/public/og-light.png +0 -0
- package/src/public/og.html +471 -0
- package/src/public/og.png +0 -0
- package/src/tokens/motion.ts +8 -3
- package/src/tokens/prose.ts +130 -0
- package/src/tokens/sizing.ts +29 -1
- package/src/utils/rehypeInlineCodeAnimate.ts +40 -0
- package/src/utils/shiki.ts +28 -4
- package/dist/patterns/Loader.d.ts +0 -9
- package/dist/patterns/Loader.js +0 -100
- package/dist/patterns/Sidebar.d.ts +0 -19
- package/dist/patterns/Sidebar.js +0 -96
- package/dist/patterns/Tree.d.ts +0 -32
- package/dist/patterns/Tree.js +0 -173
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { style, useStyles } from "purse-styles";
|
|
4
|
+
import { highlightCode, isSupportedCodeLang } from "../utils/shiki";
|
|
5
|
+
import { backgroundColor } from "../tokens/background";
|
|
6
|
+
import { colors } from "../tokens/colors";
|
|
7
|
+
import { shadow } from "../tokens/shadow";
|
|
8
|
+
import { monospace, text } from "../tokens/text";
|
|
9
|
+
import { useTheme } from "../theme/ThemeContext";
|
|
10
|
+
const codeBlockClass = style(text("xs", 400, "highContrast"), monospace, shadow.subtle, {
|
|
11
|
+
backgroundColor: backgroundColor.app,
|
|
12
|
+
borderRadius: "6px",
|
|
13
|
+
color: colors.gray[12],
|
|
14
|
+
lineHeight: 1.6,
|
|
15
|
+
margin: 0,
|
|
16
|
+
overflowX: "auto",
|
|
17
|
+
padding: "12px",
|
|
18
|
+
"& .shiki": {
|
|
19
|
+
backgroundColor: "transparent !important",
|
|
20
|
+
},
|
|
21
|
+
"& .shiki code": {
|
|
22
|
+
font: "inherit",
|
|
23
|
+
fontSize: "inherit",
|
|
24
|
+
lineHeight: "inherit",
|
|
25
|
+
tabSize: "inherit",
|
|
26
|
+
},
|
|
27
|
+
'& .shiki span[style*="font-weight"]': {
|
|
28
|
+
fontWeight: "500 !important",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
const codeClass = style({
|
|
32
|
+
font: "inherit",
|
|
33
|
+
});
|
|
34
|
+
export function CodeBlock(props) {
|
|
35
|
+
const className = useStyles(codeBlockClass);
|
|
36
|
+
const codeClassName = useStyles(codeClass);
|
|
37
|
+
const [html, setHtml] = useState(null);
|
|
38
|
+
const { resolvedTheme } = useTheme();
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!isSupportedCodeLang(props.lang)) {
|
|
41
|
+
setHtml(null);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let cancelled = false;
|
|
45
|
+
highlightCode(props.children, props.lang, resolvedTheme).then((result) => {
|
|
46
|
+
if (!cancelled) {
|
|
47
|
+
setHtml(result);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return () => {
|
|
51
|
+
cancelled = true;
|
|
52
|
+
};
|
|
53
|
+
}, [props.children, props.lang, resolvedTheme]);
|
|
54
|
+
if (!html) {
|
|
55
|
+
return (_jsx("pre", { className: className, children: _jsx("code", { className: codeClassName, children: props.children }) }));
|
|
56
|
+
}
|
|
57
|
+
return (_jsx("div", { className: `maui-code-block ${className}`, dangerouslySetInnerHTML: { __html: html } }));
|
|
58
|
+
}
|
|
@@ -5,6 +5,7 @@ declare function Plus(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
|
5
5
|
declare function Minus(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
6
6
|
declare function DotsHorizontal(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
7
7
|
declare function ArrowDown(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
8
|
+
declare function ArrowUp(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
8
9
|
declare function Star(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
9
10
|
declare function Archive(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
10
11
|
declare function Trash(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
@@ -18,6 +19,7 @@ export declare const Icons: {
|
|
|
18
19
|
Minus: typeof Minus;
|
|
19
20
|
DotsHorizontal: typeof DotsHorizontal;
|
|
20
21
|
ArrowDown: typeof ArrowDown;
|
|
22
|
+
ArrowUp: typeof ArrowUp;
|
|
21
23
|
Star: typeof Star;
|
|
22
24
|
Archive: typeof Archive;
|
|
23
25
|
Trash: typeof Trash;
|
package/dist/components/Icons.js
CHANGED
|
@@ -18,6 +18,9 @@ function DotsHorizontal(props) {
|
|
|
18
18
|
function ArrowDown(props) {
|
|
19
19
|
return (_jsxs("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M17.25 13.75L12 19.25L6.75 13.75" }), _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12 18.25V4.75" })] }));
|
|
20
20
|
}
|
|
21
|
+
function ArrowUp(props) {
|
|
22
|
+
return (_jsxs("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M17.25 10.25L12 4.75L6.75 10.25" }), _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M12 19.25V5.75" })] }));
|
|
23
|
+
}
|
|
21
24
|
function Star(props) {
|
|
22
25
|
return (_jsx("svg", { focusable: "false", "aria-hidden": "true", role: "img", width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props, children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.8, d: "M12 4.75L14.16 9.13L19 9.83L15.5 13.24L16.33 18.06L12 15.78L7.67 18.06L8.5 13.24L5 9.83L9.84 9.13L12 4.75Z" }) }));
|
|
23
26
|
}
|
|
@@ -43,6 +46,7 @@ export const Icons = {
|
|
|
43
46
|
Minus,
|
|
44
47
|
DotsHorizontal,
|
|
45
48
|
ArrowDown,
|
|
49
|
+
ArrowUp,
|
|
46
50
|
Star,
|
|
47
51
|
Archive,
|
|
48
52
|
Trash,
|
package/dist/maui.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export { spacing, type Space } from "./tokens/spacing";
|
|
|
12
12
|
export { flex, flexItem, grid, gridItem } from "./tokens/layout";
|
|
13
13
|
export { text, monospace, baseTextStyle, fontFamily, type TextSize, type TextWeight, type TextColor, } from "./tokens/text";
|
|
14
14
|
export { avatar } from "./tokens/avatar";
|
|
15
|
-
export { motion } from "./tokens/motion";
|
|
16
|
-
export { sizingTokens as sizing } from "./tokens/sizing";
|
|
17
|
-
export { prose, proseRhythm, type ProseSize } from "./tokens/prose";
|
|
15
|
+
export { motion, motionDurationMs, motionEasing, motionStreamDurationMs, } from "./tokens/motion";
|
|
16
|
+
export { icon, iconSizeValues, sizingTokens as sizing, type IconSize, } from "./tokens/sizing";
|
|
17
|
+
export { prose, proseRhythm, proseHtml, proseStreamingMarkers, type ProseSize, } from "./tokens/prose";
|
|
18
18
|
export { visuallyHidden } from "./tokens/visuallyHidden";
|
|
19
19
|
export { Avatar } from "./components/Avatar";
|
|
20
20
|
export { Badge } from "./components/Badge";
|
|
@@ -37,6 +37,6 @@ export { MenuTrigger, Menu, MenuItem, type MenuTriggerProps, type MenuProps, typ
|
|
|
37
37
|
export { FuzzyString } from "./components/FuzzyString";
|
|
38
38
|
export { Flex, Padding, Gap, Spacer, Divider } from "./components/Utils";
|
|
39
39
|
export { H1, H2, H3, H4, P, Label, labelText, Blockquote, Ul, Ol, Li, Link, } from "./components/Typography";
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
40
|
+
export { CodeBlock } from "./components/CodeBlock";
|
|
41
|
+
export { CollectionPopover, type CollectionPopoverProps, } from "./components/CollectionPopover";
|
|
42
|
+
export { navigationItem } from "./components/navigationItem";
|
package/dist/maui.js
CHANGED
|
@@ -14,9 +14,9 @@ export { spacing } from "./tokens/spacing";
|
|
|
14
14
|
export { flex, flexItem, grid, gridItem } from "./tokens/layout";
|
|
15
15
|
export { text, monospace, baseTextStyle, fontFamily, } from "./tokens/text";
|
|
16
16
|
export { avatar } from "./tokens/avatar";
|
|
17
|
-
export { motion } from "./tokens/motion";
|
|
18
|
-
export { sizingTokens as sizing } from "./tokens/sizing";
|
|
19
|
-
export { prose, proseRhythm } from "./tokens/prose";
|
|
17
|
+
export { motion, motionDurationMs, motionEasing, motionStreamDurationMs, } from "./tokens/motion";
|
|
18
|
+
export { icon, iconSizeValues, sizingTokens as sizing, } from "./tokens/sizing";
|
|
19
|
+
export { prose, proseRhythm, proseHtml, proseStreamingMarkers, } from "./tokens/prose";
|
|
20
20
|
export { visuallyHidden } from "./tokens/visuallyHidden";
|
|
21
21
|
// Components
|
|
22
22
|
export { Avatar } from "./components/Avatar";
|
|
@@ -40,7 +40,6 @@ export { MenuTrigger, Menu, MenuItem, } from "./components/Menu";
|
|
|
40
40
|
export { FuzzyString } from "./components/FuzzyString";
|
|
41
41
|
export { Flex, Padding, Gap, Spacer, Divider } from "./components/Utils";
|
|
42
42
|
export { H1, H2, H3, H4, P, Label, labelText, Blockquote, Ul, Ol, Li, Link, } from "./components/Typography";
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
export { Loader } from "./patterns/Loader";
|
|
43
|
+
export { CodeBlock } from "./components/CodeBlock";
|
|
44
|
+
export { CollectionPopover, } from "./components/CollectionPopover";
|
|
45
|
+
export { navigationItem } from "./components/navigationItem";
|
package/dist/tokens/motion.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/** Maui standard interactive transition timing. */
|
|
2
|
+
export declare const motionDurationMs = 80;
|
|
3
|
+
/** Entrance duration for streaming token reveals (Streamdown word fade). */
|
|
4
|
+
export declare const motionStreamDurationMs = 80;
|
|
5
|
+
export declare const motionEasing = "ease-in-out";
|
|
1
6
|
export declare const motion: {
|
|
2
7
|
readonly standard: (...args: string[]) => import("purse-styles").StyleElement;
|
|
3
8
|
};
|
package/dist/tokens/motion.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { style } from "purse-styles";
|
|
2
2
|
import { memoize } from "../utils/memoize";
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
/** Maui standard interactive transition timing. */
|
|
4
|
+
export const motionDurationMs = 80;
|
|
5
|
+
/** Entrance duration for streaming token reveals (Streamdown word fade). */
|
|
6
|
+
export const motionStreamDurationMs = 80;
|
|
7
|
+
export const motionEasing = "ease-in-out";
|
|
8
|
+
const standardDuration = `${motionDurationMs}ms`;
|
|
5
9
|
export const motion = {
|
|
6
10
|
standard: memoize((...properties) => style({
|
|
7
11
|
transition: properties
|
|
8
|
-
.map((property) => `${property} ${standardDuration} ${
|
|
12
|
+
.map((property) => `${property} ${standardDuration} ${motionEasing}`)
|
|
9
13
|
.join(", "),
|
|
10
14
|
})),
|
|
11
15
|
};
|
package/dist/tokens/prose.d.ts
CHANGED
|
@@ -28,3 +28,13 @@ export declare const prose: (size: ProseSize) => {
|
|
|
28
28
|
* becomes the larger break before it.
|
|
29
29
|
*/
|
|
30
30
|
export declare const proseRhythm: (size: ProseSize) => import("purse-styles").StyleElement;
|
|
31
|
+
/**
|
|
32
|
+
* Element styles + vertical rhythm for HTML rendered outside React typography
|
|
33
|
+
* components (TipTap's ProseMirror tree, Streamdown markdown output).
|
|
34
|
+
*
|
|
35
|
+
* Uses a flex column + `gap` stack so spacing doesn't depend on fragile
|
|
36
|
+
* adjacent-sibling matching across Streamdown's memoized blocks.
|
|
37
|
+
*/
|
|
38
|
+
export declare const proseHtml: (size: ProseSize) => import("purse-styles").StyleElement;
|
|
39
|
+
/** Fade list markers in with Streamdown word animation while streaming. */
|
|
40
|
+
export declare const proseStreamingMarkers: import("purse-styles").StyleElement;
|
package/dist/tokens/prose.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { style } from "purse-styles";
|
|
2
2
|
import { memoize } from "../utils/memoize";
|
|
3
3
|
import { colors } from "./colors";
|
|
4
|
+
import { motionEasing, motionStreamDurationMs } from "./motion";
|
|
4
5
|
import { fontFamily } from "./text";
|
|
5
6
|
const metrics = {
|
|
6
7
|
sm: {
|
|
@@ -115,3 +116,128 @@ export const proseRhythm = memoize((size) => {
|
|
|
115
116
|
[`& > ${notHeading} + h4`]: { marginTop: px(m.h4.marginTop) },
|
|
116
117
|
});
|
|
117
118
|
});
|
|
119
|
+
/**
|
|
120
|
+
* Element styles + vertical rhythm for HTML rendered outside React typography
|
|
121
|
+
* components (TipTap's ProseMirror tree, Streamdown markdown output).
|
|
122
|
+
*
|
|
123
|
+
* Uses a flex column + `gap` stack so spacing doesn't depend on fragile
|
|
124
|
+
* adjacent-sibling matching across Streamdown's memoized blocks.
|
|
125
|
+
*/
|
|
126
|
+
export const proseHtml = memoize((size) => {
|
|
127
|
+
const m = metrics[size];
|
|
128
|
+
return style({
|
|
129
|
+
display: "flex",
|
|
130
|
+
flexDirection: "column",
|
|
131
|
+
gap: px(m.blockGap),
|
|
132
|
+
"& p": {
|
|
133
|
+
...block(m.paragraph),
|
|
134
|
+
fontWeight: 400,
|
|
135
|
+
color: bodyColor,
|
|
136
|
+
margin: 0,
|
|
137
|
+
},
|
|
138
|
+
"& h1": {
|
|
139
|
+
...block(m.h1),
|
|
140
|
+
fontWeight: 700,
|
|
141
|
+
color: headingColor,
|
|
142
|
+
margin: 0,
|
|
143
|
+
},
|
|
144
|
+
"& h2": {
|
|
145
|
+
...block(m.h2),
|
|
146
|
+
fontWeight: 700,
|
|
147
|
+
color: headingColor,
|
|
148
|
+
margin: 0,
|
|
149
|
+
},
|
|
150
|
+
"& h3": {
|
|
151
|
+
...block(m.h3),
|
|
152
|
+
fontWeight: 600,
|
|
153
|
+
color: headingColor,
|
|
154
|
+
margin: 0,
|
|
155
|
+
},
|
|
156
|
+
"& h4": {
|
|
157
|
+
...block(m.h4),
|
|
158
|
+
fontWeight: 600,
|
|
159
|
+
color: headingColor,
|
|
160
|
+
margin: 0,
|
|
161
|
+
},
|
|
162
|
+
"& a": {
|
|
163
|
+
fontWeight: 500,
|
|
164
|
+
color: headingColor,
|
|
165
|
+
textDecoration: "underline",
|
|
166
|
+
},
|
|
167
|
+
"& blockquote": {
|
|
168
|
+
...block(m.paragraph),
|
|
169
|
+
fontWeight: 500,
|
|
170
|
+
fontStyle: "italic",
|
|
171
|
+
color: quoteColor,
|
|
172
|
+
borderLeft: `2px solid ${colors.accent[10]}`,
|
|
173
|
+
paddingLeft: "12px",
|
|
174
|
+
margin: 0,
|
|
175
|
+
},
|
|
176
|
+
"& ul, & ol": {
|
|
177
|
+
...block(m.paragraph),
|
|
178
|
+
fontWeight: 400,
|
|
179
|
+
color: bodyColor,
|
|
180
|
+
paddingInlineStart: px(m.listPadding),
|
|
181
|
+
margin: 0,
|
|
182
|
+
listStyleType: "none",
|
|
183
|
+
},
|
|
184
|
+
"& ol": {
|
|
185
|
+
counterReset: "maui-ol",
|
|
186
|
+
},
|
|
187
|
+
"& ul > li, & ol > li": {
|
|
188
|
+
position: "relative",
|
|
189
|
+
},
|
|
190
|
+
"& ul > li::before": {
|
|
191
|
+
content: '"•"',
|
|
192
|
+
position: "absolute",
|
|
193
|
+
left: px(-m.listPadding),
|
|
194
|
+
width: px(m.listPadding),
|
|
195
|
+
color: colors.gray[11],
|
|
196
|
+
textAlign: "center",
|
|
197
|
+
},
|
|
198
|
+
"& ol > li": {
|
|
199
|
+
counterIncrement: "maui-ol",
|
|
200
|
+
},
|
|
201
|
+
"& ol > li::before": {
|
|
202
|
+
content: 'counter(maui-ol) "."',
|
|
203
|
+
position: "absolute",
|
|
204
|
+
left: px(-m.listPadding),
|
|
205
|
+
width: px(m.listPadding),
|
|
206
|
+
color: colors.gray[11],
|
|
207
|
+
textAlign: "right",
|
|
208
|
+
paddingRight: "0.4em",
|
|
209
|
+
boxSizing: "border-box",
|
|
210
|
+
},
|
|
211
|
+
"& ul > li + li, & ol > li + li": {
|
|
212
|
+
marginTop: px(m.listItemGap),
|
|
213
|
+
},
|
|
214
|
+
"& li > ul, & li > ol": {
|
|
215
|
+
marginTop: px(m.listNestedGap),
|
|
216
|
+
},
|
|
217
|
+
"& strong": { fontWeight: 600 },
|
|
218
|
+
"& em": { fontStyle: "italic" },
|
|
219
|
+
"& code": {
|
|
220
|
+
fontFamily: 'ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',
|
|
221
|
+
fontSize: "0.875em",
|
|
222
|
+
},
|
|
223
|
+
"& pre, & .maui-code-block": {
|
|
224
|
+
margin: 0,
|
|
225
|
+
overflowX: "auto",
|
|
226
|
+
minWidth: 0,
|
|
227
|
+
},
|
|
228
|
+
"& hr": {
|
|
229
|
+
border: "none",
|
|
230
|
+
borderTop: `1px solid ${colors.gray[6]}`,
|
|
231
|
+
margin: 0,
|
|
232
|
+
},
|
|
233
|
+
"& table": {
|
|
234
|
+
margin: 0,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
/** Fade list markers in with Streamdown word animation while streaming. */
|
|
239
|
+
export const proseStreamingMarkers = style({
|
|
240
|
+
"& li::before": {
|
|
241
|
+
animation: `sd-fadeIn ${motionStreamDurationMs}ms ${motionEasing} both`,
|
|
242
|
+
},
|
|
243
|
+
});
|
package/dist/tokens/sizing.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
import type { TextSize } from "./text";
|
|
2
|
+
/** Same t-shirt scale as `text(...)`. */
|
|
3
|
+
export type IconSize = TextSize;
|
|
4
|
+
/**
|
|
5
|
+
* Icon box sizes paired with text sizes. Values sit slightly above the
|
|
6
|
+
* matching font-size so stroke icons balance optically next to type.
|
|
7
|
+
* Intrinsic SVG artwork is 24×24 (`xl`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const iconSizeValues: Record<IconSize, string>;
|
|
10
|
+
export declare const icon: (size: TextSize) => import("purse-styles").StyleElement;
|
|
1
11
|
export declare const sizingTokens: {
|
|
12
|
+
/** @deprecated Prefer `icon("sm")` — kept as the default inline icon size. */
|
|
2
13
|
readonly icon: import("purse-styles").StyleElement;
|
|
3
14
|
readonly fullWidth: import("purse-styles").StyleElement;
|
|
4
15
|
readonly contentWidth: import("purse-styles").StyleElement;
|
package/dist/tokens/sizing.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { style } from "purse-styles";
|
|
2
|
+
import { memoize } from "../utils/memoize";
|
|
3
|
+
/**
|
|
4
|
+
* Icon box sizes paired with text sizes. Values sit slightly above the
|
|
5
|
+
* matching font-size so stroke icons balance optically next to type.
|
|
6
|
+
* Intrinsic SVG artwork is 24×24 (`xl`).
|
|
7
|
+
*/
|
|
8
|
+
export const iconSizeValues = {
|
|
9
|
+
"2xs": "12px",
|
|
10
|
+
xs: "14px",
|
|
11
|
+
sm: "16px",
|
|
12
|
+
md: "18px",
|
|
13
|
+
lg: "20px",
|
|
14
|
+
xl: "24px",
|
|
15
|
+
};
|
|
16
|
+
export const icon = memoize((size) => style({
|
|
17
|
+
width: iconSizeValues[size],
|
|
18
|
+
height: iconSizeValues[size],
|
|
19
|
+
flexShrink: 0,
|
|
20
|
+
}));
|
|
2
21
|
export const sizingTokens = {
|
|
3
|
-
|
|
22
|
+
/** @deprecated Prefer `icon("sm")` — kept as the default inline icon size. */
|
|
23
|
+
icon: icon("sm"),
|
|
4
24
|
fullWidth: style({ width: "100%" }),
|
|
5
25
|
contentWidth: style({ maxWidth: "72ch" }),
|
|
6
26
|
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ThemeRegistration } from "shiki";
|
|
2
|
+
export declare const mauiThemeTokens: {
|
|
3
|
+
readonly dark: readonly [{
|
|
4
|
+
readonly role: "Foreground";
|
|
5
|
+
readonly sublime: "fgBase";
|
|
6
|
+
readonly color: string;
|
|
7
|
+
}, {
|
|
8
|
+
readonly role: "Comment";
|
|
9
|
+
readonly sublime: "comment";
|
|
10
|
+
readonly color: string;
|
|
11
|
+
}, {
|
|
12
|
+
readonly role: "Keyword";
|
|
13
|
+
readonly sublime: "keyword";
|
|
14
|
+
readonly color: string;
|
|
15
|
+
}, {
|
|
16
|
+
readonly role: "Operator";
|
|
17
|
+
readonly sublime: "keyword.operator";
|
|
18
|
+
readonly color: string;
|
|
19
|
+
}, {
|
|
20
|
+
readonly role: "Type";
|
|
21
|
+
readonly sublime: "entity.name.type";
|
|
22
|
+
readonly color: string;
|
|
23
|
+
}, {
|
|
24
|
+
readonly role: "Type reference";
|
|
25
|
+
readonly sublime: "support.type";
|
|
26
|
+
readonly color: string;
|
|
27
|
+
}, {
|
|
28
|
+
readonly role: "String / constant";
|
|
29
|
+
readonly sublime: "string, constant";
|
|
30
|
+
readonly color: string;
|
|
31
|
+
}, {
|
|
32
|
+
readonly role: "Function";
|
|
33
|
+
readonly sublime: "entity.name.function";
|
|
34
|
+
readonly color: string;
|
|
35
|
+
}, {
|
|
36
|
+
readonly role: "Punctuation";
|
|
37
|
+
readonly sublime: "punctuation";
|
|
38
|
+
readonly color: string;
|
|
39
|
+
}, {
|
|
40
|
+
readonly role: "Bracket / accent";
|
|
41
|
+
readonly sublime: "brackets";
|
|
42
|
+
readonly color: string;
|
|
43
|
+
}];
|
|
44
|
+
readonly light: readonly [{
|
|
45
|
+
readonly role: "Foreground";
|
|
46
|
+
readonly sublime: "fgBase";
|
|
47
|
+
readonly color: string;
|
|
48
|
+
}, {
|
|
49
|
+
readonly role: "Comment";
|
|
50
|
+
readonly sublime: "comment";
|
|
51
|
+
readonly color: string;
|
|
52
|
+
}, {
|
|
53
|
+
readonly role: "Keyword";
|
|
54
|
+
readonly sublime: "keyword";
|
|
55
|
+
readonly color: string;
|
|
56
|
+
}, {
|
|
57
|
+
readonly role: "Operator";
|
|
58
|
+
readonly sublime: "keyword.operator";
|
|
59
|
+
readonly color: string;
|
|
60
|
+
}, {
|
|
61
|
+
readonly role: "Type";
|
|
62
|
+
readonly sublime: "entity.name.type";
|
|
63
|
+
readonly color: string;
|
|
64
|
+
}, {
|
|
65
|
+
readonly role: "Type reference";
|
|
66
|
+
readonly sublime: "support.type";
|
|
67
|
+
readonly color: string;
|
|
68
|
+
}, {
|
|
69
|
+
readonly role: "String / constant";
|
|
70
|
+
readonly sublime: "string, constant";
|
|
71
|
+
readonly color: string;
|
|
72
|
+
}, {
|
|
73
|
+
readonly role: "Function";
|
|
74
|
+
readonly sublime: "entity.name.function";
|
|
75
|
+
readonly color: string;
|
|
76
|
+
}, {
|
|
77
|
+
readonly role: "Punctuation";
|
|
78
|
+
readonly sublime: "punctuation";
|
|
79
|
+
readonly color: string;
|
|
80
|
+
}, {
|
|
81
|
+
readonly role: "Bracket / accent";
|
|
82
|
+
readonly sublime: "brackets";
|
|
83
|
+
readonly color: string;
|
|
84
|
+
}];
|
|
85
|
+
};
|
|
86
|
+
export declare const mauiShikiThemeDark: ThemeRegistration;
|
|
87
|
+
export declare const mauiShikiThemeLight: ThemeRegistration;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Adapted from rsms/sublime-theme (rsms-dark), remapped to Maui gray + accent.
|
|
2
|
+
const darkColors = {
|
|
3
|
+
foreground: "#eeeeee", // --gray-12
|
|
4
|
+
foregroundMuted: "#b4b4b4", // --gray-11
|
|
5
|
+
unimportant: "#6e6e6e", // --gray-9
|
|
6
|
+
comment: "#6e6e6e",
|
|
7
|
+
keyword: "#8b8fd8", // desaturated accent
|
|
8
|
+
operator: "#d9a066", // rsms orange, softened
|
|
9
|
+
type: "#ecebe8",
|
|
10
|
+
typeRef: "#e8c9a0", // rsms typeRef, warm
|
|
11
|
+
string: "#6fbf9a", // rsms dataBase green
|
|
12
|
+
stringBright: "#8fd9b8",
|
|
13
|
+
function: "#ecebe8",
|
|
14
|
+
meta: "#8a9f94",
|
|
15
|
+
accent: "#a8a6f0", // --accent-color / brackets
|
|
16
|
+
invalid: "#e85d4f",
|
|
17
|
+
};
|
|
18
|
+
const lightColors = {
|
|
19
|
+
foreground: "#202020",
|
|
20
|
+
foregroundMuted: "#646464",
|
|
21
|
+
unimportant: "#838383",
|
|
22
|
+
comment: "#646464",
|
|
23
|
+
keyword: "#3e63dd",
|
|
24
|
+
operator: "#a15c00",
|
|
25
|
+
type: "#272962",
|
|
26
|
+
typeRef: "#8a4b08",
|
|
27
|
+
string: "#18794e",
|
|
28
|
+
stringBright: "#147d64",
|
|
29
|
+
function: "#202020",
|
|
30
|
+
meta: "#66736d",
|
|
31
|
+
accent: "#3e63dd",
|
|
32
|
+
invalid: "#ce2c31",
|
|
33
|
+
};
|
|
34
|
+
function createThemeTokens(colors) {
|
|
35
|
+
return [
|
|
36
|
+
{ role: "Foreground", sublime: "fgBase", color: colors.foreground },
|
|
37
|
+
{ role: "Comment", sublime: "comment", color: colors.comment },
|
|
38
|
+
{ role: "Keyword", sublime: "keyword", color: colors.keyword },
|
|
39
|
+
{ role: "Operator", sublime: "keyword.operator", color: colors.operator },
|
|
40
|
+
{ role: "Type", sublime: "entity.name.type", color: colors.type },
|
|
41
|
+
{ role: "Type reference", sublime: "support.type", color: colors.typeRef },
|
|
42
|
+
{
|
|
43
|
+
role: "String / constant",
|
|
44
|
+
sublime: "string, constant",
|
|
45
|
+
color: colors.string,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
role: "Function",
|
|
49
|
+
sublime: "entity.name.function",
|
|
50
|
+
color: colors.function,
|
|
51
|
+
},
|
|
52
|
+
{ role: "Punctuation", sublime: "punctuation", color: colors.unimportant },
|
|
53
|
+
{ role: "Bracket / accent", sublime: "brackets", color: colors.accent },
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
export const mauiThemeTokens = {
|
|
57
|
+
dark: createThemeTokens(darkColors),
|
|
58
|
+
light: createThemeTokens(lightColors),
|
|
59
|
+
};
|
|
60
|
+
function createMauiShikiTheme(name, type, colors) {
|
|
61
|
+
return {
|
|
62
|
+
name,
|
|
63
|
+
type,
|
|
64
|
+
colors: {
|
|
65
|
+
"editor.background": "#00000000",
|
|
66
|
+
"editor.foreground": colors.foreground,
|
|
67
|
+
},
|
|
68
|
+
tokenColors: [
|
|
69
|
+
{
|
|
70
|
+
settings: {
|
|
71
|
+
foreground: colors.foreground,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
scope: ["comment", "punctuation.definition.comment"],
|
|
76
|
+
settings: { foreground: colors.comment, fontStyle: "italic" },
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
scope: ["meta.keyword", "meta.annotation"],
|
|
80
|
+
settings: { foreground: colors.meta },
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
scope: [
|
|
84
|
+
"punctuation.separator",
|
|
85
|
+
"punctuation.terminator",
|
|
86
|
+
"punctuation.accessor",
|
|
87
|
+
"punctuation.section",
|
|
88
|
+
"keyword.operator.type.annotation",
|
|
89
|
+
],
|
|
90
|
+
settings: { foreground: colors.unimportant },
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
scope: [
|
|
94
|
+
"entity.name.type",
|
|
95
|
+
"entity.name.class",
|
|
96
|
+
"entity.name.struct",
|
|
97
|
+
"entity.name.enum",
|
|
98
|
+
"meta.type.declaration entity.name.type",
|
|
99
|
+
],
|
|
100
|
+
settings: { foreground: colors.type, fontStyle: "bold" },
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
scope: [
|
|
104
|
+
"support.type",
|
|
105
|
+
"meta.type.annotation entity.name.type",
|
|
106
|
+
"entity.other.inherited-class",
|
|
107
|
+
],
|
|
108
|
+
settings: { foreground: colors.typeRef },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
scope: [
|
|
112
|
+
"keyword",
|
|
113
|
+
"storage",
|
|
114
|
+
"storage.type.keyword",
|
|
115
|
+
"keyword.operator.new",
|
|
116
|
+
"keyword.operator.delete",
|
|
117
|
+
],
|
|
118
|
+
settings: { foreground: colors.keyword },
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
scope: ["keyword.operator"],
|
|
122
|
+
settings: { foreground: colors.operator },
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
scope: ["entity.name.function", "support.function"],
|
|
126
|
+
settings: { foreground: colors.function, fontStyle: "bold" },
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
scope: [
|
|
130
|
+
"string",
|
|
131
|
+
"constant",
|
|
132
|
+
"string punctuation.definition",
|
|
133
|
+
"constant punctuation.definition",
|
|
134
|
+
"constant.numeric",
|
|
135
|
+
],
|
|
136
|
+
settings: { foreground: colors.string },
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
scope: ["string constant"],
|
|
140
|
+
settings: { foreground: colors.stringBright },
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
scope: ["string variable", "variable", "variable.other"],
|
|
144
|
+
settings: { foreground: colors.foregroundMuted },
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
scope: ["meta.tag"],
|
|
148
|
+
settings: { foreground: colors.unimportant },
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
scope: ["meta.tag entity.name"],
|
|
152
|
+
settings: { foreground: colors.typeRef },
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
scope: ["meta.tag entity", "meta.tag.attributes"],
|
|
156
|
+
settings: { foreground: colors.foregroundMuted },
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
scope: ["entity.other.attribute-name"],
|
|
160
|
+
settings: { foreground: colors.typeRef },
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
scope: ["punctuation.definition.tag"],
|
|
164
|
+
settings: { foreground: colors.unimportant },
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
scope: ["invalid.illegal"],
|
|
168
|
+
settings: { foreground: colors.foreground, background: colors.invalid },
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export const mauiShikiThemeDark = createMauiShikiTheme("maui-dark", "dark", darkColors);
|
|
174
|
+
export const mauiShikiThemeLight = createMauiShikiTheme("maui-light", "light", lightColors);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResolvedTheme } from "../theme/ThemeContext";
|
|
2
|
+
/** Canonical Shiki language ids loaded into the highlighter. */
|
|
3
|
+
export declare const supportedCodeLangs: readonly ["typescript", "javascript", "tsx", "css", "json", "bash"];
|
|
4
|
+
export type SupportedCodeLang = (typeof supportedCodeLangs)[number];
|
|
5
|
+
export declare function resolveCodeLang(lang: string): SupportedCodeLang | null;
|
|
6
|
+
export declare function isSupportedCodeLang(lang: string): boolean;
|
|
7
|
+
export declare function highlightCode(code: string, lang: string, theme: ResolvedTheme): Promise<string>;
|