musae 0.1.26 → 0.1.28
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/button.mjs +3 -3
- package/dist/components/button/types.d.ts +7 -0
- package/dist/components/icon/icon.mjs +1 -0
- package/dist/components/icon/icons/image/bedtime.d.ts +3 -0
- package/dist/components/icon/icons/image/bedtime.mjs +10 -0
- package/dist/components/icon/icons/image/wb-sunny.d.ts +3 -0
- package/dist/components/icon/icons/image/wb-sunny.mjs +10 -0
- package/dist/components/icon/icons/index.d.ts +3 -1
- package/dist/components/icon/icons/index.mjs +2 -0
- package/dist/components/layout/hooks.d.ts +2 -2
- package/dist/components/layout/hooks.mjs +1 -1
- package/dist/components/layout/layout.mjs +37 -13
- package/dist/components/layout/sider.mjs +1 -1
- package/dist/components/menu/group.mjs +5 -2
- package/dist/components/pagination/item.mjs +1 -1
- package/dist/components/table/hooks.d.ts +2 -2
- package/dist/components/theme/hooks.d.ts +2 -2
- package/dist/components/theme/hooks.mjs +156 -109
- package/dist/components/theme/tokens.stylex.d.ts +1 -0
- package/dist/components/theme/tokens.stylex.mjs +1 -0
- package/dist/components/theme/types.d.ts +13 -1
- package/dist/node_modules/@stylexjs/stylex/lib/es/stylex.mjs +122 -1
- package/dist/stylex.css +12 -3
- package/dist/utils/colors.d.ts +9 -4
- package/dist/utils/colors.mjs +39 -33
- package/package.json +4 -2
|
@@ -40,8 +40,8 @@ const styles = {
|
|
|
40
40
|
paddingBlock: null,
|
|
41
41
|
paddingTop: null,
|
|
42
42
|
paddingBottom: null,
|
|
43
|
-
minHeight: "musae-
|
|
44
|
-
minWidth: "musae-
|
|
43
|
+
minHeight: "musae-jbwyga",
|
|
44
|
+
minWidth: "musae-dsbmi5",
|
|
45
45
|
$$css: true
|
|
46
46
|
},
|
|
47
47
|
medium: {
|
|
@@ -279,7 +279,7 @@ const Button = forwardRef(({
|
|
|
279
279
|
},
|
|
280
280
|
onPointerEnter: onPointerEnter,
|
|
281
281
|
onPointerLeave: onPointerLeave
|
|
282
|
-
}, props$1.prefix, children, ripple && React.createElement(Ripple, {
|
|
282
|
+
}, props$1.prefix, children, props$1.suffix, ripple && React.createElement(Ripple, {
|
|
283
283
|
ripples: ripples,
|
|
284
284
|
onClear: clear
|
|
285
285
|
}));
|
|
@@ -54,6 +54,13 @@ export interface ButtonProps extends Partial<Pick<ButtonHTMLAttributes<HTMLButto
|
|
|
54
54
|
* icon or prefix signal
|
|
55
55
|
*/
|
|
56
56
|
prefix?: ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* @description
|
|
59
|
+
* suffix react node
|
|
60
|
+
* @template
|
|
61
|
+
* icon or suffix signal
|
|
62
|
+
*/
|
|
63
|
+
suffix?: ReactNode;
|
|
57
64
|
/**
|
|
58
65
|
* @description
|
|
59
66
|
* if false, without a ripple
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withIcon } from '../../hoc.mjs';
|
|
3
|
+
|
|
4
|
+
const Bedtime = withIcon(({ size }) => {
|
|
5
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none" },
|
|
6
|
+
React.createElement("path", { d: "M9.93998 4.48488C8.30998 12.0249 13.69 16.8949 17.6 18.2849C16.21 19.3749 14.48 19.9949 12.67 19.9949C8.25998 19.9949 4.66998 16.4049 4.66998 11.9949C4.66998 8.54488 6.86998 5.59488 9.93998 4.48488ZM12.66 2.00488C7.06998 2.00488 2.66998 6.53488 2.66998 11.9949C2.66998 17.5149 7.14998 21.9949 12.67 21.9949C16.38 21.9949 19.6 19.9749 21.33 16.9749C13.82 16.7249 9.23998 8.54488 13.01 2.00488H12.66Z", fill: "currentcolor" })));
|
|
7
|
+
});
|
|
8
|
+
var Bedtime$1 = Bedtime;
|
|
9
|
+
|
|
10
|
+
export { Bedtime$1 as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withIcon } from '../../hoc.mjs';
|
|
3
|
+
|
|
4
|
+
const Bedtime = withIcon(({ size }) => {
|
|
5
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none" },
|
|
6
|
+
React.createElement("path", { d: "M6.76 5.3398L4.96 3.5498L3.55 4.9598L5.34 6.7498L6.76 5.3398ZM1 10.9998H4V12.9998H1V10.9998ZM11 1.0498H13V3.9998H11V1.0498ZM19.04 3.5448L20.448 4.9518L18.658 6.7418L17.251 5.3338L19.04 3.5448ZM17.24 18.6598L19.03 20.4598L20.44 19.0498L18.64 17.2598L17.24 18.6598ZM20 10.9998H23V12.9998H20V10.9998ZM12 5.9998C8.69 5.9998 6 8.6898 6 11.9998C6 15.3098 8.69 17.9998 12 17.9998C15.31 17.9998 18 15.3098 18 11.9998C18 8.6898 15.31 5.9998 12 5.9998ZM12 15.9998C9.79 15.9998 8 14.2098 8 11.9998C8 9.7898 9.79 7.9998 12 7.9998C14.21 7.9998 16 9.7898 16 11.9998C16 14.2098 14.21 15.9998 12 15.9998ZM11 19.9998H13V22.9498H11V19.9998ZM3.55 19.0398L4.96 20.4498L6.75 18.6498L5.34 17.2398L3.55 19.0398Z", fill: "currentcolor" })));
|
|
7
|
+
});
|
|
8
|
+
var Bedtime$1 = Bedtime;
|
|
9
|
+
|
|
10
|
+
export { Bedtime$1 as default };
|
|
@@ -15,9 +15,11 @@ import KeyboardArrowLeft from "./hardware/keyboard-arrow-left";
|
|
|
15
15
|
import KeyboardArrowRight from "./hardware/keyboard-arrow-right";
|
|
16
16
|
import KeyboardArrowUp from "./hardware/keyboard-arrow-up";
|
|
17
17
|
import KeyboardArrowDown from "./hardware/keyboard-arrow-down";
|
|
18
|
+
import Bedtime from "./image/bedtime";
|
|
19
|
+
import WbSunny from "./image/wb-sunny";
|
|
18
20
|
import Github from "./mocks/github";
|
|
19
21
|
/**
|
|
20
22
|
* @description
|
|
21
23
|
* icon presets
|
|
22
24
|
*/
|
|
23
|
-
export { KeyboardDoubleArrowLeft, KeyboardDoubleArrowRight, KeyboardArrowLeft, KeyboardArrowRight, KeyboardArrowUp, KeyboardArrowDown, SwapHoriz, Visibility, VisibilityOff, CheckCircle, CheckCircleOutline, Done, ErrorOutline, Cancel, Clear, MoreHoriz, Close, Github, };
|
|
25
|
+
export { KeyboardDoubleArrowLeft, KeyboardDoubleArrowRight, KeyboardArrowLeft, KeyboardArrowRight, KeyboardArrowUp, KeyboardArrowDown, SwapHoriz, Visibility, VisibilityOff, CheckCircle, CheckCircleOutline, Done, ErrorOutline, Cancel, Clear, MoreHoriz, Close, Github, Bedtime, WbSunny, };
|
|
@@ -15,4 +15,6 @@ export { default as KeyboardArrowLeft } from './hardware/keyboard-arrow-left.mjs
|
|
|
15
15
|
export { default as KeyboardArrowRight } from './hardware/keyboard-arrow-right.mjs';
|
|
16
16
|
export { default as KeyboardArrowUp } from './hardware/keyboard-arrow-up.mjs';
|
|
17
17
|
export { default as KeyboardArrowDown } from './hardware/keyboard-arrow-down.mjs';
|
|
18
|
+
export { default as Bedtime } from './image/bedtime.mjs';
|
|
19
|
+
export { default as WbSunny } from './image/wb-sunny.mjs';
|
|
18
20
|
export { default as Github } from './mocks/github.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { ComponentProps } from "../../types/element";
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ComponentProps } from "../../types/element";
|
|
3
3
|
export declare enum ChildToken {
|
|
4
4
|
Header = "header",
|
|
5
5
|
Sider = "sider",
|
|
@@ -34,7 +34,7 @@ const useChildren = ([children]) => {
|
|
|
34
34
|
prev[0].set(ChildToken.Footer, current);
|
|
35
35
|
break;
|
|
36
36
|
case Main:
|
|
37
|
-
prev[0].set(ChildToken.
|
|
37
|
+
prev[0].set(ChildToken.Main, current);
|
|
38
38
|
prev[1] = {
|
|
39
39
|
className: current.props.className,
|
|
40
40
|
style: current.props.style,
|
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Grid } from '../grid/index.mjs';
|
|
3
3
|
import { useChildren, ChildToken } from './hooks.mjs';
|
|
4
|
+
import _stylex from '../../node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
5
|
+
import { useTheme } from '../theme/hooks.mjs';
|
|
6
|
+
import { ColorToken } from '../../utils/colors.mjs';
|
|
7
|
+
import clsx from 'clsx';
|
|
4
8
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const styles = {
|
|
10
|
+
layout: props => [{
|
|
11
|
+
backgroundColor: "musae-q1mx2j",
|
|
12
|
+
color: "musae-19dipnz",
|
|
13
|
+
$$css: true
|
|
14
|
+
}, {
|
|
15
|
+
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
16
|
+
"--color": props.color != null ? props.color : "initial"
|
|
17
|
+
}]
|
|
18
|
+
};
|
|
19
|
+
const Layout = props => {
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const {
|
|
22
|
+
children,
|
|
23
|
+
mainProps
|
|
24
|
+
} = useChildren([props.children]);
|
|
25
|
+
const sider = children.get(ChildToken.Sider);
|
|
26
|
+
const hasSider = !!sider;
|
|
27
|
+
const styled = _stylex.props(styles.layout({
|
|
28
|
+
backgroundColor: theme.colors[ColorToken.SurfaceContainerLowest],
|
|
29
|
+
color: theme.colors[ColorToken.OnSurface]
|
|
30
|
+
}));
|
|
31
|
+
return React.createElement("div", {
|
|
32
|
+
className: clsx(styled.className),
|
|
33
|
+
style: styled.style
|
|
34
|
+
}, children.get(ChildToken.Header), hasSider ? React.createElement(Grid.Row, {
|
|
35
|
+
as: "main"
|
|
36
|
+
}, sider, React.createElement(Grid.Col, {
|
|
37
|
+
...mainProps,
|
|
38
|
+
span: 19
|
|
39
|
+
}, children.get(ChildToken.Main), children.get(ChildToken.Footer))) : React.createElement("main", {
|
|
40
|
+
...mainProps
|
|
41
|
+
}, children.get(ChildToken.Main), children.get(ChildToken.Footer)));
|
|
18
42
|
};
|
|
19
43
|
var _Layout = Layout;
|
|
20
44
|
|
|
@@ -37,12 +37,14 @@ const styles = {
|
|
|
37
37
|
listStylePosition: null,
|
|
38
38
|
listStyleType: null,
|
|
39
39
|
backgroundColor: "musae-q1mx2j",
|
|
40
|
+
color: "musae-19dipnz",
|
|
40
41
|
overflow: "musae-ysyzu8",
|
|
41
42
|
overflowX: null,
|
|
42
43
|
overflowY: null,
|
|
43
44
|
$$css: true
|
|
44
45
|
}, {
|
|
45
|
-
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial"
|
|
46
|
+
"--backgroundColor": props.backgroundColor != null ? props.backgroundColor : "initial",
|
|
47
|
+
"--color": props.color != null ? props.color : "initial"
|
|
46
48
|
}],
|
|
47
49
|
hidden: {
|
|
48
50
|
display: "musae-1s85apg",
|
|
@@ -133,7 +135,8 @@ const Group = forwardRef(({
|
|
|
133
135
|
});
|
|
134
136
|
const styled = {
|
|
135
137
|
group: props(styles.group.default({
|
|
136
|
-
backgroundColor: theme.colors[ColorToken.
|
|
138
|
+
backgroundColor: theme.colors[ColorToken.SurfaceContainerLowest],
|
|
139
|
+
color: theme.colors[ColorToken.OnSurface]
|
|
137
140
|
}), !expanded && styles.group.hidden, props$1.styles),
|
|
138
141
|
submenu: [styles.submenu[mode]]
|
|
139
142
|
};
|
|
@@ -3,7 +3,7 @@ import { ContextValue, TableProps } from "./types";
|
|
|
3
3
|
* @description
|
|
4
4
|
* use columns
|
|
5
5
|
*/
|
|
6
|
-
export declare const useColumns: <T>([columns]: [
|
|
6
|
+
export declare const useColumns: <T>([columns]: [TableProps<T>["columns"]]) => import("@tanstack/react-table").ColumnDef<T, any>[];
|
|
7
7
|
/**
|
|
8
8
|
* @author murukal
|
|
9
9
|
* @description
|
|
@@ -16,6 +16,6 @@ export declare const useTable: <T>() => ContextValue<T>;
|
|
|
16
16
|
* for context value
|
|
17
17
|
*/
|
|
18
18
|
export declare const useContextValue: <T>({ table: _table, bordered, }: {
|
|
19
|
-
table:
|
|
19
|
+
table: ContextValue<T>["table"];
|
|
20
20
|
bordered: boolean;
|
|
21
21
|
}) => ContextValue<unknown>;
|
|
@@ -19,6 +19,6 @@ export declare const useTheme: () => ContextValue;
|
|
|
19
19
|
* @description
|
|
20
20
|
* context value
|
|
21
21
|
*/
|
|
22
|
-
export declare const useContextValue: (
|
|
23
|
-
theme?: Theme;
|
|
22
|
+
export declare const useContextValue: ({ theme }: {
|
|
23
|
+
theme?: Theme | undefined;
|
|
24
24
|
}) => ContextValue;
|
|
@@ -1,105 +1,108 @@
|
|
|
1
|
-
import { createContext, useContext, useMemo } from 'react';
|
|
1
|
+
import { createContext, useContext, useState, useCallback, useMemo } from 'react';
|
|
2
2
|
import { toColors } from '../../utils/colors.mjs';
|
|
3
3
|
import deepmerge from 'deepmerge';
|
|
4
|
+
import { useDefault, useMounted, useEvent, isFunction } from '@aiszlab/relax';
|
|
4
5
|
|
|
5
6
|
const PALETTE = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
7
|
+
primary: {
|
|
8
|
+
"0": "#000",
|
|
9
|
+
"10": "#21005D",
|
|
10
|
+
"20": "#381E72",
|
|
11
|
+
"30": "#4F378B",
|
|
12
|
+
"40": "#6750A4",
|
|
13
|
+
"50": "#7F67BE",
|
|
14
|
+
"60": "#9A82DB",
|
|
15
|
+
"70": "#B69DF8",
|
|
16
|
+
"80": "#D0BCFF",
|
|
17
|
+
"90": "#EADDFF",
|
|
18
|
+
"95": "#F6EDFF",
|
|
19
|
+
"99": "#FFFBFE",
|
|
20
|
+
"100": "#FFF"
|
|
21
|
+
},
|
|
22
|
+
secondary: {
|
|
23
|
+
"0": "#000",
|
|
24
|
+
"10": "#1D192B",
|
|
25
|
+
"20": "#332D41",
|
|
26
|
+
"30": "#4A4458",
|
|
27
|
+
"40": "#625B71",
|
|
28
|
+
"50": "#7A7289",
|
|
29
|
+
"60": "#958DA5",
|
|
30
|
+
"70": "#B0A7C0",
|
|
31
|
+
"80": "#CCC2DC",
|
|
32
|
+
"90": "#E8DEF8",
|
|
33
|
+
"95": "#F6EDFF",
|
|
34
|
+
"99": "#FFFBFE",
|
|
35
|
+
"100": "#FFF"
|
|
36
|
+
},
|
|
37
|
+
tertiary: {
|
|
38
|
+
"0": "#000",
|
|
39
|
+
"10": "#31111D",
|
|
40
|
+
"20": "#492532",
|
|
41
|
+
"30": "#633B48",
|
|
42
|
+
"40": "#7D5260",
|
|
43
|
+
"50": "#986977",
|
|
44
|
+
"60": "#B58392",
|
|
45
|
+
"70": "#D29DAC",
|
|
46
|
+
"80": "#EFB8C8",
|
|
47
|
+
"90": "#FFD8E4",
|
|
48
|
+
"95": "#FFECF1",
|
|
49
|
+
"99": "#FFFBFA",
|
|
50
|
+
"100": "#FFF"
|
|
51
|
+
},
|
|
52
|
+
error: {
|
|
53
|
+
"0": "#000",
|
|
54
|
+
"10": "#410E0B",
|
|
55
|
+
"20": "#601410",
|
|
56
|
+
"30": "#8C1D18",
|
|
57
|
+
"40": "#B3261E",
|
|
58
|
+
"50": "#DC362E",
|
|
59
|
+
"60": "#E46962",
|
|
60
|
+
"70": "#EC928E",
|
|
61
|
+
"80": "#F2B8B5",
|
|
62
|
+
"90": "#F9DEDC",
|
|
63
|
+
"95": "#FCEEEE",
|
|
64
|
+
"99": "#FFFBF9",
|
|
65
|
+
"100": "#FFF"
|
|
66
|
+
},
|
|
67
|
+
neutral: {
|
|
68
|
+
"0": "#000",
|
|
69
|
+
"10": "#1D1B20",
|
|
70
|
+
"20": "#48464C",
|
|
71
|
+
"30": "#48464C",
|
|
72
|
+
"40": "#605D64",
|
|
73
|
+
"50": "#79767D",
|
|
74
|
+
"60": "#938F96",
|
|
75
|
+
"70": "#AEA9B1",
|
|
76
|
+
"80": "#CAC5CD",
|
|
77
|
+
"90": "#E6E0E9",
|
|
78
|
+
"95": "#F5EFF7",
|
|
79
|
+
"99": "#FFFBFE",
|
|
80
|
+
"100": "#FFF"
|
|
81
|
+
},
|
|
82
|
+
neutralVariant: {
|
|
83
|
+
"0": "#000",
|
|
84
|
+
"10": "#1D1A22",
|
|
85
|
+
"20": "#322F37",
|
|
86
|
+
"30": "#49454F",
|
|
87
|
+
"40": "#605D66",
|
|
88
|
+
"50": "#79747E",
|
|
89
|
+
"60": "#938F99",
|
|
90
|
+
"70": "#AEA9B4",
|
|
91
|
+
"80": "#CAC4D0",
|
|
92
|
+
"90": "#E7E0EC",
|
|
93
|
+
"95": "#F5EEFA",
|
|
94
|
+
"99": "#FFFBFE",
|
|
95
|
+
"100": "#FFF"
|
|
96
|
+
}
|
|
96
97
|
};
|
|
97
98
|
/**
|
|
98
99
|
* @description
|
|
99
100
|
* theme context
|
|
100
101
|
*/
|
|
101
102
|
const Context = createContext({
|
|
102
|
-
|
|
103
|
+
colors: toColors(PALETTE, "light"),
|
|
104
|
+
mode: "light",
|
|
105
|
+
toggle: () => void 0
|
|
103
106
|
});
|
|
104
107
|
/**
|
|
105
108
|
* @author murukal
|
|
@@ -111,28 +114,72 @@ const Context = createContext({
|
|
|
111
114
|
* set the preset theme for musae ui component
|
|
112
115
|
*/
|
|
113
116
|
const useTheme = () => {
|
|
114
|
-
|
|
117
|
+
return useContext(Context);
|
|
115
118
|
};
|
|
116
119
|
/**
|
|
117
120
|
* @description
|
|
118
121
|
* context value
|
|
119
122
|
*/
|
|
120
|
-
const useContextValue = (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
123
|
+
const useContextValue = ({
|
|
124
|
+
theme
|
|
125
|
+
}) => {
|
|
126
|
+
const [mode, setMode] = useState("light");
|
|
127
|
+
const isDark = mode === "dark";
|
|
128
|
+
const modeToggler = useCallback(() => {
|
|
129
|
+
setMode(_mode => _mode === "light" ? "dark" : "light");
|
|
130
|
+
}, []);
|
|
131
|
+
const _theme = useMemo(() => {
|
|
132
|
+
return deepmerge(theme ?? {}, {
|
|
133
|
+
palette: PALETTE
|
|
134
|
+
});
|
|
135
|
+
}, [theme]);
|
|
136
|
+
const styled = useDefault(() => ({
|
|
137
|
+
default: ({
|
|
138
|
+
class: "musae-ynce87 musae-15342hd musae-goest1 musae-1sgbmat"
|
|
139
|
+
}.class ).split(" "),
|
|
140
|
+
light: ({
|
|
141
|
+
class: "musae-1oc29kk musae-8b1qih"
|
|
142
|
+
}.class ).split(" "),
|
|
143
|
+
dark: ({
|
|
144
|
+
class: "musae-8dcoj0 musae-1g3ure4"
|
|
145
|
+
}.class ).split(" ")
|
|
146
|
+
}));
|
|
147
|
+
useMounted(() => {
|
|
148
|
+
document.documentElement.classList.add(...styled.default);
|
|
149
|
+
document.documentElement.classList.add(...styled[mode]);
|
|
150
|
+
});
|
|
151
|
+
/// dark, light mode switch
|
|
152
|
+
const themeToggler = useEvent(event => {
|
|
153
|
+
if (!(event && isFunction(document.startViewTransition))) {
|
|
154
|
+
modeToggler();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const x = event.clientX;
|
|
158
|
+
const y = event.clientY;
|
|
159
|
+
const radius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y));
|
|
160
|
+
const animation = document.startViewTransition(() => {
|
|
161
|
+
document.documentElement.classList.remove(...(isDark ? styled.dark : styled.light));
|
|
162
|
+
document.documentElement.classList.add(...(isDark ? styled.light : styled.dark));
|
|
163
|
+
});
|
|
164
|
+
animation.ready.then(() => {
|
|
165
|
+
modeToggler();
|
|
166
|
+
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${radius}px at ${x}px ${y}px)`];
|
|
167
|
+
document.documentElement.animate({
|
|
168
|
+
clipPath: isDark ? [...clipPath].reverse() : clipPath
|
|
169
|
+
}, {
|
|
170
|
+
duration: 500,
|
|
171
|
+
easing: "ease-in",
|
|
172
|
+
pseudoElement: isDark ? "::view-transition-old(root)" : "::view-transition-new(root)"
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
return useMemo(() => {
|
|
177
|
+
return {
|
|
178
|
+
colors: toColors(_theme.palette, mode),
|
|
179
|
+
mode,
|
|
180
|
+
toggle: themeToggler
|
|
181
|
+
};
|
|
182
|
+
}, [_theme, mode, themeToggler]);
|
|
136
183
|
};
|
|
137
184
|
|
|
138
185
|
export { Context, useContextValue, useTheme };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { MouseEvent, ReactNode } from "react";
|
|
2
2
|
import type { toColors } from "../../utils/colors";
|
|
3
3
|
export type Theme = {
|
|
4
4
|
palette: Palette;
|
|
@@ -48,5 +48,17 @@ export interface ContextValue {
|
|
|
48
48
|
* colors
|
|
49
49
|
*/
|
|
50
50
|
colors: ReturnType<typeof toColors>;
|
|
51
|
+
/**
|
|
52
|
+
* @description
|
|
53
|
+
* theme mode
|
|
54
|
+
* in musae, use light or dark
|
|
55
|
+
* @example light
|
|
56
|
+
*/
|
|
57
|
+
mode: "light" | "dark";
|
|
58
|
+
/**
|
|
59
|
+
* @description
|
|
60
|
+
* toggle theme mode, if dark, change to light
|
|
61
|
+
*/
|
|
62
|
+
toggle: (event: MouseEvent) => void;
|
|
51
63
|
}
|
|
52
64
|
export {};
|
|
@@ -148,6 +148,12 @@ function createStyleq(options) {
|
|
|
148
148
|
var styleq = createStyleq();
|
|
149
149
|
styleq_2 = styleq$1.styleq = styleq;
|
|
150
150
|
styleq.factory = createStyleq;
|
|
151
|
+
var errorForFn = function errorForFn(name) {
|
|
152
|
+
return new Error("'stylex.".concat(name, "' should never be called at runtime. It should be compiled away by '@stylexjs/babel-plugin'"));
|
|
153
|
+
};
|
|
154
|
+
var errorForType = function errorForType(key) {
|
|
155
|
+
return errorForFn("types.".concat(key));
|
|
156
|
+
};
|
|
151
157
|
function props() {
|
|
152
158
|
var options = this;
|
|
153
159
|
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -169,6 +175,121 @@ function props() {
|
|
|
169
175
|
}
|
|
170
176
|
return result;
|
|
171
177
|
}
|
|
178
|
+
function attrs() {
|
|
179
|
+
var _props = props.apply(void 0, arguments),
|
|
180
|
+
className = _props.className,
|
|
181
|
+
style = _props.style;
|
|
182
|
+
var result = {};
|
|
183
|
+
if (className != null && className !== '') {
|
|
184
|
+
result["class"] = className;
|
|
185
|
+
}
|
|
186
|
+
if (style != null && Object.keys(style).length > 0) {
|
|
187
|
+
result.style = Object.keys(style).map(function (key) {
|
|
188
|
+
return "".concat(key, ":").concat(style[key], ";");
|
|
189
|
+
}).join('');
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
193
|
+
function stylexCreate(styles) {
|
|
194
|
+
if (__implementations.create != null) {
|
|
195
|
+
var _create = __implementations.create;
|
|
196
|
+
return _create(styles);
|
|
197
|
+
}
|
|
198
|
+
throw errorForFn('create');
|
|
199
|
+
}
|
|
200
|
+
function stylexDefineVars(styles) {
|
|
201
|
+
if (__implementations.defineVars) {
|
|
202
|
+
return __implementations.defineVars(styles);
|
|
203
|
+
}
|
|
204
|
+
throw errorForFn('defineVars');
|
|
205
|
+
}
|
|
206
|
+
var stylexCreateTheme = function stylexCreateTheme(baseTokens, overrides) {
|
|
207
|
+
if (__implementations.createTheme) {
|
|
208
|
+
return __implementations.createTheme(baseTokens, overrides);
|
|
209
|
+
}
|
|
210
|
+
throw errorForFn('createTheme');
|
|
211
|
+
};
|
|
212
|
+
var stylexInclude = function stylexInclude(styles) {
|
|
213
|
+
if (__implementations.include) {
|
|
214
|
+
return __implementations.include(styles);
|
|
215
|
+
}
|
|
216
|
+
throw errorForFn('include');
|
|
217
|
+
};
|
|
218
|
+
var create = stylexCreate;
|
|
219
|
+
var defineVars = stylexDefineVars;
|
|
220
|
+
var createTheme = stylexCreateTheme;
|
|
221
|
+
var include = stylexInclude;
|
|
222
|
+
var types = {
|
|
223
|
+
angle: function angle(_v) {
|
|
224
|
+
throw errorForType('angle');
|
|
225
|
+
},
|
|
226
|
+
color: function color(_v) {
|
|
227
|
+
throw errorForType('color');
|
|
228
|
+
},
|
|
229
|
+
url: function url(_v) {
|
|
230
|
+
throw errorForType('url');
|
|
231
|
+
},
|
|
232
|
+
image: function image(_v) {
|
|
233
|
+
throw errorForType('image');
|
|
234
|
+
},
|
|
235
|
+
integer: function integer(_v) {
|
|
236
|
+
throw errorForType('integer');
|
|
237
|
+
},
|
|
238
|
+
lengthPercentage: function lengthPercentage(_v) {
|
|
239
|
+
throw errorForType('lengthPercentage');
|
|
240
|
+
},
|
|
241
|
+
length: function length(_v) {
|
|
242
|
+
throw errorForType('length');
|
|
243
|
+
},
|
|
244
|
+
percentage: function percentage(_v) {
|
|
245
|
+
throw errorForType('percentage');
|
|
246
|
+
},
|
|
247
|
+
number: function number(_v) {
|
|
248
|
+
throw errorForType('number');
|
|
249
|
+
},
|
|
250
|
+
resolution: function resolution(_v) {
|
|
251
|
+
throw errorForType('resolution');
|
|
252
|
+
},
|
|
253
|
+
time: function time(_v) {
|
|
254
|
+
throw errorForType('time');
|
|
255
|
+
},
|
|
256
|
+
transformFunction: function transformFunction(_v) {
|
|
257
|
+
throw errorForType('transformFunction');
|
|
258
|
+
},
|
|
259
|
+
transformList: function transformList(_v) {
|
|
260
|
+
throw errorForType('transformList');
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
var keyframes = function keyframes(_keyframes) {
|
|
264
|
+
if (__implementations.keyframes) {
|
|
265
|
+
return __implementations.keyframes(_keyframes);
|
|
266
|
+
}
|
|
267
|
+
throw errorForFn('keyframes');
|
|
268
|
+
};
|
|
269
|
+
var firstThatWorks = function firstThatWorks() {
|
|
270
|
+
if (__implementations.firstThatWorks) {
|
|
271
|
+
return __implementations.firstThatWorks.apply(__implementations, arguments);
|
|
272
|
+
}
|
|
273
|
+
throw errorForFn('firstThatWorks');
|
|
274
|
+
};
|
|
275
|
+
function _stylex() {
|
|
276
|
+
for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
277
|
+
styles[_key2] = arguments[_key2];
|
|
278
|
+
}
|
|
279
|
+
var _styleq_3 = styleq_2(styles),
|
|
280
|
+
_styleq_4 = _slicedToArray(_styleq_3, 1),
|
|
281
|
+
className = _styleq_4[0];
|
|
282
|
+
return className;
|
|
283
|
+
}
|
|
284
|
+
_stylex.props = props;
|
|
285
|
+
_stylex.attrs = attrs;
|
|
286
|
+
_stylex.create = create;
|
|
287
|
+
_stylex.defineVars = defineVars;
|
|
288
|
+
_stylex.createTheme = createTheme;
|
|
289
|
+
_stylex.include = include;
|
|
290
|
+
_stylex.keyframes = keyframes;
|
|
291
|
+
_stylex.firstThatWorks = firstThatWorks;
|
|
292
|
+
_stylex.types = types;
|
|
172
293
|
var __implementations = {};
|
|
173
294
|
|
|
174
|
-
export { props };
|
|
295
|
+
export { attrs, create, createTheme, _stylex as default, defineVars, firstThatWorks, include, keyframes, props, types };
|
package/dist/stylex.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
:root{--musae-1aj7t22:0px;--musae-1ax7z96:1px;--musae-1l9c3uf:4px;--musae-cx2xv5:8px;--musae-rlgvtq:16px;--musae-1qsoxbc:24px;--musae-16n5srz:32px;--musae-wll1cf:40px;--musae-cftog7:48px;--musae-laggmb:64px;--musae-1rrllem:calc(Infinity * 1px);--musae-1qj6wod:100%;--musae-1yg5bqe:auto;}
|
|
1
|
+
:root{--musae-1aj7t22:0px;--musae-1ax7z96:1px;--musae-1l9c3uf:4px;--musae-cx2xv5:8px;--musae-rlgvtq:16px;--musae-1qsoxbc:24px;--musae-16n5srz:32px;--musae-wll1cf:40px;--musae-cftog7:48px;--musae-laggmb:64px;--musae-xrqq76:96px;--musae-1rrllem:calc(Infinity * 1px);--musae-1qj6wod:100%;--musae-1yg5bqe:auto;}
|
|
2
2
|
:root{--musae-1odcd6w:0px;--musae-bbiwro:0.1px;--musae-1x9q6du:0.15px;--musae-1fsxyg9:0.25px;--musae-2s74kj:0.4px;--musae-1ry795:0.5px;}
|
|
3
3
|
:root{--musae-1wblvyz:0px;--musae-1h5s2h0:2px;--musae-qk2ac7:4px;--musae-h30iw9:6px;--musae-vk5id6:8px;--musae-1ncxh3n:12px;--musae-oohzsl:16px;--musae-1tzp6vk:24px;--musae-15cw4i4:32px;--musae-1n7xs5j:48px;--musae-68a8pz:auto;}
|
|
4
4
|
:root{--musae-gmufu8:none;--musae-15zostt:0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);--musae-1trg6py:0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);--musae-4poz8g:0px 1px 3px 0px rgba(0, 0, 0, 0.30), 0px 4px 8px 3px rgba(0, 0, 0, 0.15);--musae-1vq77kn:0px 2px 3px 0px rgba(0, 0, 0, 0.30), 0px 6px 10px 4px rgba(0, 0, 0, 0.15);--musae-1yt3x0a:0px 4px 4px 0px rgba(0, 0, 0, 0.30), 0px 8px 12px 6px rgba(0, 0, 0, 0.15);}
|
|
@@ -164,6 +164,7 @@ html[dir='rtl'] .musae-1yc453h:not(#\#):not(#\#):not(#\#){text-align:right}
|
|
|
164
164
|
.musae-1g0ag68:not(#\#):not(#\#):not(#\#){transform-origin:center}
|
|
165
165
|
.musae-umwmo6:not(#\#):not(#\#):not(#\#){transform:translateX(100%)}
|
|
166
166
|
.musae-1v0jg1i:not(#\#):not(#\#):not(#\#){transform:var(--transform,revert)}
|
|
167
|
+
.musae-1uuroth:not(#\#):not(#\#):not(#\#){vertical-align:text-bottom}
|
|
167
168
|
.musae-lshs6z:not(#\#):not(#\#):not(#\#){visibility:hidden}
|
|
168
169
|
.musae-uxw1ft:not(#\#):not(#\#):not(#\#){white-space:nowrap}
|
|
169
170
|
.musae-1aaibe2:not(#\#):not(#\#):not(#\#){will-change:background-color,border,color}
|
|
@@ -225,15 +226,15 @@ html[dir='rtl'] .musae-1yc453h:not(#\#):not(#\#):not(#\#){text-align:right}
|
|
|
225
226
|
.musae-yzno7u:not(#\#):not(#\#):not(#\#):not(#\#){max-width:960px}
|
|
226
227
|
.musae-kfv0gj:not(#\#):not(#\#):not(#\#):not(#\#){max-width:var(--musae-1qj6wod)}
|
|
227
228
|
.musae-u0aao5:not(#\#):not(#\#):not(#\#):not(#\#){min-height:36px}
|
|
228
|
-
.musae-
|
|
229
|
+
.musae-jbwyga:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--musae-1qsoxbc)}
|
|
229
230
|
.musae-1infgec:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--musae-cftog7)}
|
|
230
231
|
.musae-1oxjezn:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--musae-wll1cf)}
|
|
231
232
|
.musae-euugli:not(#\#):not(#\#):not(#\#):not(#\#){min-width:0}
|
|
232
233
|
.musae-1jzhcrs:not(#\#):not(#\#):not(#\#):not(#\#){min-width:200px}
|
|
233
234
|
.musae-15cq3s0:not(#\#):not(#\#):not(#\#):not(#\#){min-width:480px}
|
|
234
235
|
.musae-13to73x:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--minWidth,revert)}
|
|
235
|
-
.musae-1a7a393:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-16n5srz)}
|
|
236
236
|
.musae-yumy05:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-1aj7t22)}
|
|
237
|
+
.musae-dsbmi5:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-1qsoxbc)}
|
|
237
238
|
.musae-ba7gwn:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-cftog7)}
|
|
238
239
|
.musae-kw4qbi:not(#\#):not(#\#):not(#\#):not(#\#){min-width:var(--musae-wll1cf)}
|
|
239
240
|
.musae-6ikm8r:not(#\#):not(#\#):not(#\#):not(#\#){overflow-x:hidden}
|
|
@@ -276,6 +277,8 @@ html[dir='rtl'] .musae-1yc453h:not(#\#):not(#\#):not(#\#){text-align:right}
|
|
|
276
277
|
.musae-vpkyr8:not(:last-of-type):not(#\#):not(#\#):not(#\#):not(#\#)::after{width:var(--musae-1ax7z96)}
|
|
277
278
|
.musae-cu8lob:first-child:not(#\#):not(#\#):not(#\#):not(#\#){margin-top:var(--musae-qk2ac7)}
|
|
278
279
|
.musae-r8ctv5:hover:not(#\#):not(#\#):not(#\#):not(#\#){overflow-y:auto}
|
|
280
|
+
.musae-ynce87:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-old(root){animation:none}
|
|
281
|
+
.musae-goest1:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-new(root){animation:none}
|
|
279
282
|
.musae-8hkgfc:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{margin:var(--musae-1h5s2h0)}
|
|
280
283
|
.musae-123gkgz:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{border-color:var(--1il6zln,revert)}
|
|
281
284
|
.musae-3yd8hb:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{border-color:var(--joftei,revert)}
|
|
@@ -309,13 +312,19 @@ html[dir='rtl'] .musae-1yc453h:not(#\#):not(#\#):not(#\#){text-align:right}
|
|
|
309
312
|
.musae-1gkks1t:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{inset-inline-end:50%}
|
|
310
313
|
.musae-1682cnc:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{inset-inline-start:0}
|
|
311
314
|
.musae-fbisj7:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{inset-inline-start:50%}
|
|
315
|
+
.musae-15342hd:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-old(root){mix-blend-mode:normal}
|
|
316
|
+
.musae-1sgbmat:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-new(root){mix-blend-mode:normal}
|
|
312
317
|
.musae-1hmns74:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{position:absolute}
|
|
313
318
|
.musae-1j6awrg:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{position:absolute}
|
|
314
319
|
.musae-w2k1ea:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{transform:translate(150%,-150%) rotate(45deg)}
|
|
315
320
|
.musae-oivrgx:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{translate:20px}
|
|
316
321
|
.musae-170pinb:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{visibility:visible}
|
|
317
322
|
.musae-11srvyv:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{visibility:visible}
|
|
323
|
+
.musae-8b1qih:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-new(root){z-index:1}
|
|
324
|
+
.musae-8dcoj0:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-old(root){z-index:1}
|
|
318
325
|
.musae-12maryy:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{z-index:1}
|
|
326
|
+
.musae-1oc29kk:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-old(root){z-index:999}
|
|
327
|
+
.musae-1g3ure4:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::view-transition-new(root){z-index:999}
|
|
319
328
|
.musae-1p9jk5k:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{border-left-width:var(--musae-1aj7t22)}
|
|
320
329
|
.musae-1wsn0xg:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{height:100%}
|
|
321
330
|
.musae-xt7thn:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{height:12px}
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Palette } from "../components/theme/types";
|
|
1
|
+
import type { ContextValue, Palette } from "../components/theme/types";
|
|
2
2
|
/**
|
|
3
3
|
* @description
|
|
4
4
|
* theme token
|
|
@@ -36,9 +36,9 @@ export declare enum ColorToken {
|
|
|
36
36
|
OnSurface = "on-surface",
|
|
37
37
|
OnSurfaceVariant = "on-surface-variant",
|
|
38
38
|
SurfaceDim = "surface-dim",
|
|
39
|
-
SurfaceContainer = "surface-container",
|
|
40
|
-
SurfaceContainerLow = "surface-container-low",
|
|
41
39
|
SurfaceContainerLowest = "surface-container-lowest",
|
|
40
|
+
SurfaceContainerLow = "surface-container-low",
|
|
41
|
+
SurfaceContainer = "surface-container",
|
|
42
42
|
SurfaceContainerHigh = "surface-container-high",
|
|
43
43
|
SurfaceContainerHighest = "surface-container-highest",
|
|
44
44
|
InverseSurface = "inverse-surface",
|
|
@@ -52,5 +52,10 @@ export declare enum ColorToken {
|
|
|
52
52
|
/**
|
|
53
53
|
* @description
|
|
54
54
|
* convert palette to colors
|
|
55
|
+
*
|
|
56
|
+
* you will always be confused, there are to many color roles
|
|
57
|
+
* how do i use them
|
|
58
|
+
*
|
|
59
|
+
* here, musae provide some easy usage
|
|
55
60
|
*/
|
|
56
|
-
export declare const toColors: (palette: Palette) => Record<ColorToken, string>;
|
|
61
|
+
export declare const toColors: (palette: Palette, mode: ContextValue["mode"]) => Record<ColorToken, string>;
|
package/dist/utils/colors.mjs
CHANGED
|
@@ -36,9 +36,9 @@ var ColorToken;
|
|
|
36
36
|
ColorToken["OnSurface"] = "on-surface";
|
|
37
37
|
ColorToken["OnSurfaceVariant"] = "on-surface-variant";
|
|
38
38
|
ColorToken["SurfaceDim"] = "surface-dim";
|
|
39
|
-
ColorToken["SurfaceContainer"] = "surface-container";
|
|
40
|
-
ColorToken["SurfaceContainerLow"] = "surface-container-low";
|
|
41
39
|
ColorToken["SurfaceContainerLowest"] = "surface-container-lowest";
|
|
40
|
+
ColorToken["SurfaceContainerLow"] = "surface-container-low";
|
|
41
|
+
ColorToken["SurfaceContainer"] = "surface-container";
|
|
42
42
|
ColorToken["SurfaceContainerHigh"] = "surface-container-high";
|
|
43
43
|
ColorToken["SurfaceContainerHighest"] = "surface-container-highest";
|
|
44
44
|
ColorToken["InverseSurface"] = "inverse-surface";
|
|
@@ -52,51 +52,57 @@ var ColorToken;
|
|
|
52
52
|
/**
|
|
53
53
|
* @description
|
|
54
54
|
* convert palette to colors
|
|
55
|
+
*
|
|
56
|
+
* you will always be confused, there are to many color roles
|
|
57
|
+
* how do i use them
|
|
58
|
+
*
|
|
59
|
+
* here, musae provide some easy usage
|
|
55
60
|
*/
|
|
56
|
-
const toColors = (palette) => {
|
|
61
|
+
const toColors = (palette, mode) => {
|
|
62
|
+
const isLight = mode === "light";
|
|
57
63
|
return {
|
|
58
|
-
[ColorToken.Primary]: palette.primary[40],
|
|
59
|
-
[ColorToken.OnPrimary]: palette.primary[100],
|
|
60
|
-
[ColorToken.PrimaryContainer]: palette.primary[90],
|
|
61
|
-
[ColorToken.OnPrimaryContainer]: palette.primary[10],
|
|
64
|
+
[ColorToken.Primary]: isLight ? palette.primary[40] : palette.primary[80],
|
|
65
|
+
[ColorToken.OnPrimary]: isLight ? palette.primary[100] : palette.primary[20],
|
|
66
|
+
[ColorToken.PrimaryContainer]: isLight ? palette.primary[90] : palette.primary[30],
|
|
67
|
+
[ColorToken.OnPrimaryContainer]: isLight ? palette.primary[10] : palette.primary[90],
|
|
62
68
|
[ColorToken.PrimaryFixed]: palette.primary[90],
|
|
63
69
|
[ColorToken.PrimaryFixedDim]: palette.primary[80],
|
|
64
70
|
[ColorToken.OnPrimaryFixed]: palette.primary[10],
|
|
65
71
|
[ColorToken.OnPrimaryFixedVariant]: palette.primary[30],
|
|
66
|
-
[ColorToken.Secondary]: palette.secondary[40],
|
|
67
|
-
[ColorToken.OnSecondary]: palette.secondary[100],
|
|
68
|
-
[ColorToken.SecondaryContainer]: palette.secondary[90],
|
|
69
|
-
[ColorToken.OnSecondaryContainer]: palette.secondary[10],
|
|
72
|
+
[ColorToken.Secondary]: isLight ? palette.secondary[40] : palette.secondary[80],
|
|
73
|
+
[ColorToken.OnSecondary]: isLight ? palette.secondary[100] : palette.secondary[20],
|
|
74
|
+
[ColorToken.SecondaryContainer]: isLight ? palette.secondary[90] : palette.secondary[30],
|
|
75
|
+
[ColorToken.OnSecondaryContainer]: isLight ? palette.secondary[10] : palette.secondary[90],
|
|
70
76
|
[ColorToken.SecondaryFixed]: palette.secondary[90],
|
|
71
77
|
[ColorToken.SecondaryFixedDim]: palette.secondary[80],
|
|
72
78
|
[ColorToken.OnSecondaryFixed]: palette.secondary[10],
|
|
73
79
|
[ColorToken.OnSecondaryFixedVariant]: palette.secondary[30],
|
|
74
|
-
[ColorToken.Tertiary]: palette.tertiary[40],
|
|
75
|
-
[ColorToken.OnTertiary]: palette.tertiary[100],
|
|
76
|
-
[ColorToken.TertiaryContainer]: palette.tertiary[90],
|
|
77
|
-
[ColorToken.OnTertiaryContainer]: palette.tertiary[10],
|
|
80
|
+
[ColorToken.Tertiary]: isLight ? palette.tertiary[40] : palette.tertiary[80],
|
|
81
|
+
[ColorToken.OnTertiary]: isLight ? palette.tertiary[100] : palette.tertiary[20],
|
|
82
|
+
[ColorToken.TertiaryContainer]: isLight ? palette.tertiary[90] : palette.tertiary[30],
|
|
83
|
+
[ColorToken.OnTertiaryContainer]: isLight ? palette.tertiary[10] : palette.tertiary[90],
|
|
78
84
|
[ColorToken.TertiaryFixed]: palette.tertiary[90],
|
|
79
85
|
[ColorToken.TertiaryFixedDim]: palette.tertiary[80],
|
|
80
86
|
[ColorToken.OnTertiaryFixed]: palette.tertiary[10],
|
|
81
87
|
[ColorToken.OnTertiaryFixedVariant]: palette.tertiary[30],
|
|
82
|
-
[ColorToken.Error]: palette.error[40],
|
|
83
|
-
[ColorToken.OnError]: palette.error[100],
|
|
84
|
-
[ColorToken.ErrorContainer]: palette.error[90],
|
|
85
|
-
[ColorToken.OnErrorContainer]: palette.error[10],
|
|
86
|
-
[ColorToken.Surface]:
|
|
87
|
-
[ColorToken.
|
|
88
|
-
[ColorToken.
|
|
89
|
-
[ColorToken.
|
|
90
|
-
[ColorToken.
|
|
91
|
-
[ColorToken.
|
|
92
|
-
[ColorToken.
|
|
93
|
-
[ColorToken.
|
|
94
|
-
[ColorToken.OnSurfaceVariant]: palette.neutralVariant[30],
|
|
95
|
-
[ColorToken.InverseSurface]: palette.neutral[20],
|
|
96
|
-
[ColorToken.InverseOnSurface]: palette.neutral[95],
|
|
97
|
-
[ColorToken.InversePrimary]: palette.primary[80],
|
|
98
|
-
[ColorToken.Outline]: palette.neutralVariant[50],
|
|
99
|
-
[ColorToken.OutlineVariant]: palette.neutralVariant[80],
|
|
88
|
+
[ColorToken.Error]: isLight ? palette.error[40] : palette.error[80],
|
|
89
|
+
[ColorToken.OnError]: isLight ? palette.error[100] : palette.error[20],
|
|
90
|
+
[ColorToken.ErrorContainer]: isLight ? palette.error[90] : palette.error[30],
|
|
91
|
+
[ColorToken.OnErrorContainer]: isLight ? palette.error[10] : palette.error[90],
|
|
92
|
+
[ColorToken.Surface]: isLight ? palette.neutral[99] : palette.neutral[10],
|
|
93
|
+
[ColorToken.SurfaceDim]: isLight ? palette.neutral[90] : palette.neutral[10],
|
|
94
|
+
[ColorToken.SurfaceContainerLowest]: isLight ? palette.neutral[100] : palette.neutral[0],
|
|
95
|
+
[ColorToken.SurfaceContainerLow]: isLight ? palette.neutral[95] : palette.neutral[10],
|
|
96
|
+
[ColorToken.SurfaceContainer]: isLight ? palette.neutral[95] : palette.neutral[10],
|
|
97
|
+
[ColorToken.SurfaceContainerHigh]: isLight ? palette.neutral[95] : palette.neutral[10],
|
|
98
|
+
[ColorToken.SurfaceContainerHighest]: isLight ? palette.neutral[90] : palette.neutral[20],
|
|
99
|
+
[ColorToken.OnSurface]: isLight ? palette.neutral[10] : palette.neutral[90],
|
|
100
|
+
[ColorToken.OnSurfaceVariant]: isLight ? palette.neutralVariant[30] : palette.neutralVariant[80],
|
|
101
|
+
[ColorToken.InverseSurface]: isLight ? palette.neutral[20] : palette.neutral[90],
|
|
102
|
+
[ColorToken.InverseOnSurface]: isLight ? palette.neutral[95] : palette.neutral[20],
|
|
103
|
+
[ColorToken.InversePrimary]: isLight ? palette.primary[80] : palette.primary[40],
|
|
104
|
+
[ColorToken.Outline]: isLight ? palette.neutralVariant[50] : palette.neutralVariant[60],
|
|
105
|
+
[ColorToken.OutlineVariant]: isLight ? palette.neutralVariant[80] : palette.neutralVariant[30],
|
|
100
106
|
[ColorToken.Shadow]: palette.neutral[0],
|
|
101
107
|
[ColorToken.Scrim]: palette.neutral[0],
|
|
102
108
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musae",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "musae-ui",
|
|
5
5
|
"author": "tutu@fantufantu.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
43
43
|
"@stylexjs/rollup-plugin": "^0.5.1",
|
|
44
44
|
"@stylexjs/stylex": "^0.5.1",
|
|
45
|
+
"@types/dom-view-transitions": "^1.0.4",
|
|
45
46
|
"@types/react": "^18",
|
|
46
47
|
"@types/react-dom": "^18",
|
|
47
48
|
"eslint": "^8.56.0",
|
|
@@ -66,5 +67,6 @@
|
|
|
66
67
|
"extends": [
|
|
67
68
|
"react-app"
|
|
68
69
|
]
|
|
69
|
-
}
|
|
70
|
+
},
|
|
71
|
+
"homepage": "https://aisz.dev/"
|
|
70
72
|
}
|