@haklex/rich-style-token 0.58.0 → 0.59.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.
package/dist/chrome.d.ts CHANGED
@@ -33,6 +33,11 @@ export declare const chromeHeight: {
33
33
  readonly md: "28px";
34
34
  readonly lg: "32px";
35
35
  };
36
+ export declare const chromeWidth: {
37
+ readonly sm: "280px";
38
+ readonly md: "320px";
39
+ readonly lg: "400px";
40
+ };
36
41
  export declare const focusRing: string;
37
42
  export declare const chromeMotion: {
38
43
  readonly popupIn: "120ms ease-out";
@@ -1 +1 @@
1
- {"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../src/chrome.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;CAMb,CAAC;AAEX,eAAO,MAAM,YAAY;;;;CAAgD,CAAC;AAE1E,eAAO,MAAM,YAAY;;;;CAAkD,CAAC;AAE5E,eAAO,MAAM,SAAS,QAAwE,CAAC;AAE/F,eAAO,MAAM,YAAY;;;;;CAKf,CAAC"}
1
+ {"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../src/chrome.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;CAMb,CAAC;AAEX,eAAO,MAAM,YAAY;;;;CAAgD,CAAC;AAE1E,eAAO,MAAM,YAAY;;;;CAAkD,CAAC;AAE5E,eAAO,MAAM,WAAW;;;;CAAqD,CAAC;AAE9E,eAAO,MAAM,SAAS,QAAwE,CAAC;AAE/F,eAAO,MAAM,YAAY;;;;;CAKf,CAAC"}
package/dist/styles.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { chromeTypography, contentTypography } from './baseline';
2
- export { chromeHeight, chromeMotion, chromeRadius, chromeText, focusRing } from './chrome';
2
+ export { chromeHeight, chromeMotion, chromeRadius, chromeText, chromeWidth, focusRing, } from './chrome';
3
3
  export { type ThemeTokens } from './create-theme-style';
4
4
  export { createThemeStyle } from './create-theme-style';
5
5
  export { inDarkScheme } from './scheme';
6
+ export { iconTone, type TextLevel, textLevel, toneDown } from './text-level';
6
7
  export { articleLayout, chatLayout, commentLayout, darkColors, fonts, lightArticleColors, lightCommentColors, noteLayout, } from './themes';
7
8
  export { articleTheme, chatTheme, commentTheme, noteTheme, vars } from './vars.css';
8
9
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC"}
package/dist/styles.mjs CHANGED
@@ -58,6 +58,11 @@ var chromeHeight = {
58
58
  md: "28px",
59
59
  lg: "32px"
60
60
  };
61
+ var chromeWidth = {
62
+ sm: "280px",
63
+ md: "320px",
64
+ lg: "400px"
65
+ };
61
66
  var focusRing = `0 0 0 1px ${vars.color.accent}, 0 0 0 3px ${vars.color.accentLight}`;
62
67
  var chromeMotion = {
63
68
  popupIn: "120ms ease-out",
@@ -71,4 +76,46 @@ function inDarkScheme(selectors) {
71
76
  return selectors.split(",").map((selector) => selector.trim()).flatMap((selector) => [`[data-theme='dark'] ${selector}:not([data-theme='dark'] [data-theme='light'] *)`, `[data-theme='light'] [data-theme='dark'] ${selector}`]).join(", ");
72
77
  }
73
78
  //#endregion
74
- export { articleLayout, articleTheme, chatLayout, chatTheme, chromeHeight, chromeMotion, chromeRadius, chromeText, chromeTypography, commentLayout, commentTheme, contentTypography, createThemeStyle, darkColors, focusRing, fonts, inDarkScheme, lightArticleColors, lightCommentColors, noteLayout, noteTheme, vars };
79
+ //#region src/text-level.ts
80
+ /**
81
+ * Neutral text emphasis as a single scale: level 1 is the faintest, level 4 the
82
+ * strongest. Components color text by level instead of reaching for
83
+ * `textSecondary` / `textTertiary` by hand, so a nested element can derive its
84
+ * own tone from its owner's level.
85
+ *
86
+ * Only neutrals have an authored ladder. A colored label (accent, caution, a
87
+ * consumer's own hue) has no such scale — and it should not need one: derive
88
+ * its quieter step from the color itself with {@link toneDown}.
89
+ */
90
+ var textLevel = {
91
+ 1: vars.color.textQuaternary,
92
+ 2: vars.color.textTertiary,
93
+ 3: vars.color.textSecondary,
94
+ 4: vars.color.text
95
+ };
96
+ /**
97
+ * The color an icon takes when it sits next to a label at `level`: one step
98
+ * quieter, clamped at 1. Icons never carry the label's own level.
99
+ */
100
+ function iconTone(level) {
101
+ return textLevel[Math.max(level - 1, 1)];
102
+ }
103
+ /**
104
+ * One quieter step for a label color that has no ladder: `accent`, `alertTone`,
105
+ * or anything a consumer passes at runtime.
106
+ *
107
+ * Implemented as an alpha step of the *same* color rather than a second token,
108
+ * so it holds for every hue, in both schemes, on any surface — and it keeps
109
+ * tracking the label if that color is overridden. `color-mix` interpolates in
110
+ * premultiplied sRGB, so mixing with `transparent` yields the exact color at
111
+ * the given alpha instead of a washed-out blend.
112
+ *
113
+ * Solid fills (an inverted label on an accent ground) keep the icon at the
114
+ * label's own color: a translucent glyph would let the fill through and read
115
+ * as a third color rather than a quieter step.
116
+ */
117
+ function toneDown(color, strength = 86) {
118
+ return `color-mix(in srgb, ${color} ${strength}%, transparent)`;
119
+ }
120
+ //#endregion
121
+ export { articleLayout, articleTheme, chatLayout, chatTheme, chromeHeight, chromeMotion, chromeRadius, chromeText, chromeTypography, chromeWidth, commentLayout, commentTheme, contentTypography, createThemeStyle, darkColors, focusRing, fonts, iconTone, inDarkScheme, lightArticleColors, lightCommentColors, noteLayout, noteTheme, textLevel, toneDown, vars };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Neutral text emphasis as a single scale: level 1 is the faintest, level 4 the
3
+ * strongest. Components color text by level instead of reaching for
4
+ * `textSecondary` / `textTertiary` by hand, so a nested element can derive its
5
+ * own tone from its owner's level.
6
+ *
7
+ * Only neutrals have an authored ladder. A colored label (accent, caution, a
8
+ * consumer's own hue) has no such scale — and it should not need one: derive
9
+ * its quieter step from the color itself with {@link toneDown}.
10
+ */
11
+ export declare const textLevel: {
12
+ readonly 1: `var(--${string})`;
13
+ readonly 2: `var(--${string})`;
14
+ readonly 3: `var(--${string})`;
15
+ readonly 4: `var(--${string})`;
16
+ };
17
+ export type TextLevel = keyof typeof textLevel;
18
+ /**
19
+ * The color an icon takes when it sits next to a label at `level`: one step
20
+ * quieter, clamped at 1. Icons never carry the label's own level.
21
+ */
22
+ export declare function iconTone(level: TextLevel): string;
23
+ /**
24
+ * One quieter step for a label color that has no ladder: `accent`, `alertTone`,
25
+ * or anything a consumer passes at runtime.
26
+ *
27
+ * Implemented as an alpha step of the *same* color rather than a second token,
28
+ * so it holds for every hue, in both schemes, on any surface — and it keeps
29
+ * tracking the label if that color is overridden. `color-mix` interpolates in
30
+ * premultiplied sRGB, so mixing with `transparent` yields the exact color at
31
+ * the given alpha instead of a washed-out blend.
32
+ *
33
+ * Solid fills (an inverted label on an accent ground) keep the icon at the
34
+ * label's own color: a translucent glyph would let the fill through and read
35
+ * as a third color rather than a quieter step.
36
+ */
37
+ export declare function toneDown(color: string, strength?: number): string;
38
+ //# sourceMappingURL=text-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-level.d.ts","sourceRoot":"","sources":["../src/text-level.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,SAAS,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEjD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAK,GAAG,MAAM,CAE7D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-style-token",
3
- "version": "0.58.0",
3
+ "version": "0.59.0",
4
4
  "description": "Style tokens and CSS variables for haklex rich editor",
5
5
  "repository": {
6
6
  "type": "git",