@haklex/rich-style-token 0.0.24 → 0.0.26

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/README.md CHANGED
@@ -77,7 +77,7 @@ export type { ThemeTokens } from './create-theme-style'
77
77
 
78
78
  // 主题配置
79
79
  export { articleLayout, commentLayout, noteLayout } from './themes'
80
- export { serifFonts, sharedFonts } from './themes'
80
+ export { fonts } from './themes'
81
81
  export { darkColors, lightArticleColors, lightCommentColors } from './themes'
82
82
 
83
83
  // Portal 主题
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { ThemeTokens } from './create-theme-style';
2
2
  export { createThemeStyle } from './create-theme-style';
3
3
  export { PortalThemeProvider, PortalThemeWrapper, usePortalTheme, } from './portal-theme';
4
- export { articleLayout, commentLayout, darkColors, lightArticleColors, lightCommentColors, noteLayout, serifFonts, sharedFonts, } from './themes';
4
+ export { articleLayout, commentLayout, darkColors, fonts, lightArticleColors, lightCommentColors, noteLayout, } from './themes';
5
5
  export { vars } from './vars.css';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { createContext, useMemo, use } from "react";
3
- var vars = { color: { text: "var(--rc-text)", textSecondary: "var(--rc-text-secondary)", bg: "var(--rc-bg)", bgSecondary: "var(--rc-bg-secondary)", border: "var(--rc-border)", accent: "var(--rc-accent)", accentLight: "var(--rc-accent-light)", link: "var(--rc-link)", codeText: "var(--rc-code-text)", codeBg: "var(--rc-code-bg)", quoteBorder: "var(--rc-quote-border)", quoteBg: "var(--rc-quote-bg)", alertInfo: "var(--rc-alert-info)", alertWarning: "var(--rc-alert-warning)", alertTip: "var(--rc-alert-tip)", alertCaution: "var(--rc-alert-caution)", alertImportant: "var(--rc-alert-important)" }, spacing: { xs: "var(--rc-space-xs)", sm: "var(--rc-space-sm)", md: "var(--rc-space-md)", lg: "var(--rc-space-lg)", xl: "var(--rc-space-xl)" }, typography: { fontFamily: "var(--rc-font-family)", fontMono: "var(--rc-font-mono)", fontSize2xs: "var(--rc-font-size-2xs)", fontSizeXs: "var(--rc-font-size-xs)", fontSizeSm: "var(--rc-font-size-sm)", fontSizeMd: "var(--rc-font-size-md)", fontSizeLg: "var(--rc-font-size-lg)", fontSizeBase: "var(--rc-font-size-base)", fontSizeSmall: "var(--rc-font-size-small)", lineHeight: "var(--rc-line-height)", lineHeightTight: "var(--rc-line-height-tight)" }, borderRadius: { sm: "var(--rc-radius-sm)", md: "var(--rc-radius-md)", lg: "var(--rc-radius-lg)" }, layout: { maxWidth: "var(--rc-max-width)" } };
3
+ var vars = { color: { text: "var(--rc-text)", textSecondary: "var(--rc-text-secondary)", bg: "var(--rc-bg)", bgSecondary: "var(--rc-bg-secondary)", border: "var(--rc-border)", accent: "var(--rc-accent)", accentLight: "var(--rc-accent-light)", link: "var(--rc-link)", codeText: "var(--rc-code-text)", codeBg: "var(--rc-code-bg)", quoteBorder: "var(--rc-quote-border)", quoteBg: "var(--rc-quote-bg)", alertInfo: "var(--rc-alert-info)", alertWarning: "var(--rc-alert-warning)", alertTip: "var(--rc-alert-tip)", alertCaution: "var(--rc-alert-caution)", alertImportant: "var(--rc-alert-important)" }, spacing: { xs: "var(--rc-space-xs)", sm: "var(--rc-space-sm)", md: "var(--rc-space-md)", lg: "var(--rc-space-lg)", xl: "var(--rc-space-xl)" }, typography: { fontFamily: "var(--rc-font-family)", fontFamilySerif: "var(--rc-font-family-serif)", fontMono: "var(--rc-font-mono)", fontSize2xs: "var(--rc-font-size-2xs)", fontSizeXs: "var(--rc-font-size-xs)", fontSizeSm: "var(--rc-font-size-sm)", fontSizeMd: "var(--rc-font-size-md)", fontSizeLg: "var(--rc-font-size-lg)", fontSizeBase: "var(--rc-font-size-base)", fontSizeSmall: "var(--rc-font-size-small)", lineHeight: "var(--rc-line-height)", lineHeightTight: "var(--rc-line-height-tight)" }, borderRadius: { sm: "var(--rc-radius-sm)", md: "var(--rc-radius-md)", lg: "var(--rc-radius-lg)" }, layout: { maxWidth: "var(--rc-max-width)" } };
4
4
  function extractVarName(cssVarRef) {
5
5
  const match = cssVarRef.match(/^var\((.+)\)$/);
6
6
  return match ? match[1] : cssVarRef;
@@ -44,101 +44,97 @@ function PortalThemeWrapper({ children }) {
44
44
  if (!className) return children;
45
45
  return /* @__PURE__ */ jsx("div", { style: { display: "contents" }, className, children });
46
46
  }
47
- const sharedFonts = {
48
- fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
47
+ const fonts = {
48
+ fontFamily: '"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji',
49
+ fontFamilySerif: '"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif',
49
50
  fontMono: '"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace'
50
51
  };
51
- const serifFonts = {
52
- fontFamily: '"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif',
53
- fontMono: sharedFonts.fontMono
54
- };
55
52
  const lightArticleColors = {
56
- text: "#1a1a1a",
57
- textSecondary: "#6b7280",
53
+ text: "#000",
54
+ textSecondary: "#5f6e78",
58
55
  bg: "#ffffff",
59
- bgSecondary: "#f9fafb",
60
- border: "#e5e7eb",
61
- accent: "#33A6B8",
62
- accentLight: "#33A6B833",
63
- link: "#33A6B8",
64
- codeText: "#e83e8c",
65
- codeBg: "#f3f4f6",
66
- quoteBorder: "#33A6B8",
67
- quoteBg: "#f0f9fb",
68
- alertInfo: "#3b82f6",
69
- alertWarning: "#f59e0b",
70
- alertTip: "#22c55e",
71
- alertCaution: "#ef4444",
72
- alertImportant: "#a855f7"
56
+ bgSecondary: "#fafafa",
57
+ border: "#ebedee",
58
+ accent: "#2563eb",
59
+ accentLight: "#2563eb20",
60
+ link: "#2563eb",
61
+ codeText: "#374047",
62
+ codeBg: "#f8f9f9",
63
+ quoteBorder: "#2563eb",
64
+ quoteBg: "#eff6ff",
65
+ alertInfo: "#006bb7",
66
+ alertWarning: "#cc5500",
67
+ alertTip: "#11cc00",
68
+ alertCaution: "#cc0011",
69
+ alertImportant: "#5500cc"
73
70
  };
74
71
  const lightCommentColors = {
75
72
  ...lightArticleColors,
76
- quoteBorder: "#9ca3af",
77
- quoteBg: "#f9fafb"
73
+ quoteBorder: "#acb4b9",
74
+ quoteBg: "#f8f9f9"
78
75
  };
79
76
  const darkColors = {
80
- text: "#e5e5e5",
81
- textSecondary: "#a3a3a3",
82
- bg: "#171717",
83
- bgSecondary: "#262626",
84
- border: "#404040",
85
- accent: "#F596AA",
86
- accentLight: "#F596AA33",
87
- link: "#F596AA",
88
- codeText: "#f472b6",
89
- codeBg: "#262626",
90
- quoteBorder: "#F596AA",
91
- quoteBg: "#262626",
92
- alertInfo: "#60a5fa",
93
- alertWarning: "#fbbf24",
94
- alertTip: "#4ade80",
95
- alertCaution: "#f87171",
96
- alertImportant: "#c084fc"
77
+ text: "#fff",
78
+ textSecondary: "#97a1a7",
79
+ bg: "#000",
80
+ bgSecondary: "#171717",
81
+ border: "#374047",
82
+ accent: "#60a5fa",
83
+ accentLight: "#60a5fa20",
84
+ link: "#60a5fa",
85
+ codeText: "#dee1e3",
86
+ codeBg: "#374047",
87
+ quoteBorder: "#60a5fa",
88
+ quoteBg: "#1e3a5f",
89
+ alertInfo: "#7db9e5",
90
+ alertWarning: "#da864a",
91
+ alertTip: "#54da48",
92
+ alertCaution: "#e16973",
93
+ alertImportant: "#9966e0"
94
+ };
95
+ const sharedSpacing = {
96
+ xs: "4px",
97
+ sm: "8px",
98
+ md: "16px",
99
+ lg: "24px",
100
+ xl: "32px"
101
+ };
102
+ const sharedBorderRadius = { sm: "4px", md: "8px", lg: "12px" };
103
+ const baseTypography = {
104
+ fontFamilySerif: fonts.fontFamilySerif,
105
+ fontMono: fonts.fontMono,
106
+ fontSize2xs: "0.625em",
107
+ fontSizeXs: "0.75em",
108
+ fontSizeSm: "0.8125em",
109
+ fontSizeMd: "0.875em",
110
+ fontSizeLg: "1.25em",
111
+ fontSizeBase: "16px",
112
+ fontSizeSmall: "14px",
113
+ lineHeight: "1.7",
114
+ lineHeightTight: "1.4"
97
115
  };
98
116
  const articleLayout = {
99
117
  layout: { maxWidth: "700px" },
100
- spacing: { xs: "4px", sm: "8px", md: "16px", lg: "24px", xl: "32px" },
101
- typography: {
102
- ...sharedFonts,
103
- fontSize2xs: "0.625em",
104
- fontSizeXs: "0.75em",
105
- fontSizeSm: "0.8125em",
106
- fontSizeMd: "0.875em",
107
- fontSizeLg: "1.25em",
108
- fontSizeBase: "16px",
109
- fontSizeSmall: "14px",
110
- lineHeight: "1.7",
111
- lineHeightTight: "1.4"
112
- },
113
- borderRadius: { sm: "4px", md: "8px", lg: "12px" }
118
+ spacing: sharedSpacing,
119
+ typography: { ...baseTypography, fontFamily: fonts.fontFamily },
120
+ borderRadius: sharedBorderRadius
114
121
  };
115
122
  const noteLayout = {
116
123
  layout: { maxWidth: "700px" },
117
- spacing: articleLayout.spacing,
124
+ spacing: sharedSpacing,
118
125
  typography: {
119
- ...serifFonts,
120
- fontSize2xs: "0.625em",
121
- fontSizeXs: "0.75em",
122
- fontSizeSm: "0.8125em",
123
- fontSizeMd: "0.875em",
124
- fontSizeLg: "1.25em",
125
- fontSizeBase: "16px",
126
- fontSizeSmall: "14px",
127
- lineHeight: "1.8",
128
- lineHeightTight: "1.4"
126
+ ...baseTypography,
127
+ fontFamily: fonts.fontFamilySerif,
128
+ lineHeight: "1.8"
129
129
  },
130
- borderRadius: articleLayout.borderRadius
130
+ borderRadius: sharedBorderRadius
131
131
  };
132
132
  const commentLayout = {
133
133
  layout: { maxWidth: "none" },
134
134
  spacing: { xs: "2px", sm: "4px", md: "10px", lg: "16px", xl: "20px" },
135
135
  typography: {
136
- ...sharedFonts,
137
- fontSize2xs: "0.625em",
138
- fontSizeXs: "0.75em",
139
- fontSizeSm: "0.8125em",
140
- fontSizeMd: "0.875em",
141
- fontSizeLg: "1.25em",
136
+ ...baseTypography,
137
+ fontFamily: fonts.fontFamily,
142
138
  fontSizeBase: "14px",
143
139
  fontSizeSmall: "12px",
144
140
  lineHeight: "1.5",
@@ -153,11 +149,10 @@ export {
153
149
  commentLayout,
154
150
  createThemeStyle,
155
151
  darkColors,
152
+ fonts,
156
153
  lightArticleColors,
157
154
  lightCommentColors,
158
155
  noteLayout,
159
- serifFonts,
160
- sharedFonts,
161
156
  usePortalTheme,
162
157
  vars
163
158
  };
package/dist/themes.d.ts CHANGED
@@ -1,9 +1,6 @@
1
- export declare const sharedFonts: {
2
- fontFamily: string;
3
- fontMono: string;
4
- };
5
- export declare const serifFonts: {
1
+ export declare const fonts: {
6
2
  fontFamily: string;
3
+ fontFamilySerif: string;
7
4
  fontMono: string;
8
5
  };
9
6
  export declare const lightArticleColors: {
@@ -75,6 +72,9 @@ export declare const articleLayout: {
75
72
  xl: string;
76
73
  };
77
74
  typography: {
75
+ fontFamily: string;
76
+ fontFamilySerif: string;
77
+ fontMono: string;
78
78
  fontSize2xs: string;
79
79
  fontSizeXs: string;
80
80
  fontSizeSm: string;
@@ -84,8 +84,6 @@ export declare const articleLayout: {
84
84
  fontSizeSmall: string;
85
85
  lineHeight: string;
86
86
  lineHeightTight: string;
87
- fontFamily: string;
88
- fontMono: string;
89
87
  };
90
88
  borderRadius: {
91
89
  sm: string;
@@ -105,6 +103,10 @@ export declare const noteLayout: {
105
103
  xl: string;
106
104
  };
107
105
  typography: {
106
+ fontFamily: string;
107
+ lineHeight: string;
108
+ fontFamilySerif: string;
109
+ fontMono: string;
108
110
  fontSize2xs: string;
109
111
  fontSizeXs: string;
110
112
  fontSizeSm: string;
@@ -112,10 +114,7 @@ export declare const noteLayout: {
112
114
  fontSizeLg: string;
113
115
  fontSizeBase: string;
114
116
  fontSizeSmall: string;
115
- lineHeight: string;
116
117
  lineHeightTight: string;
117
- fontFamily: string;
118
- fontMono: string;
119
118
  };
120
119
  borderRadius: {
121
120
  sm: string;
@@ -135,17 +134,18 @@ export declare const commentLayout: {
135
134
  xl: string;
136
135
  };
137
136
  typography: {
138
- fontSize2xs: string;
139
- fontSizeXs: string;
140
- fontSizeSm: string;
141
- fontSizeMd: string;
142
- fontSizeLg: string;
137
+ fontFamily: string;
143
138
  fontSizeBase: string;
144
139
  fontSizeSmall: string;
145
140
  lineHeight: string;
146
141
  lineHeightTight: string;
147
- fontFamily: string;
142
+ fontFamilySerif: string;
148
143
  fontMono: string;
144
+ fontSize2xs: string;
145
+ fontSizeXs: string;
146
+ fontSizeSm: string;
147
+ fontSizeMd: string;
148
+ fontSizeLg: string;
149
149
  };
150
150
  borderRadius: {
151
151
  sm: string;
@@ -1 +1 @@
1
- {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../src/themes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;CAKvB,CAAA;AAED,eAAO,MAAM,UAAU;;;CAItB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;CAkB9B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;CAI9B,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;CAkBtB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBzB,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBtB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBzB,CAAA"}
1
+ {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../src/themes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;;;;CAOjB,CAAA;AAGD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;CAkB9B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;CAI9B,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;CAkBtB,CAAA;AAyBD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKzB,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAStB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYzB,CAAA"}
@@ -27,6 +27,7 @@ export declare const vars: {
27
27
  };
28
28
  typography: {
29
29
  fontFamily: `var(--${string})`;
30
+ fontFamilySerif: `var(--${string})`;
30
31
  fontMono: `var(--${string})`;
31
32
  fontSize2xs: `var(--${string})`;
32
33
  fontSizeXs: `var(--${string})`;
@@ -1 +1 @@
1
- {"version":3,"file":"vars.css.d.ts","sourceRoot":"","sources":["../src/vars.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDf,CAAA"}
1
+ {"version":3,"file":"vars.css.d.ts","sourceRoot":"","sources":["../src/vars.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDf,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-style-token",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "Style tokens and CSS variables for haklex rich editor",
5
5
  "license": "MIT",
6
6
  "type": "module",