@seed-design/css 1.2.15 → 1.2.17

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/theming/index.cjs CHANGED
@@ -1,5 +1,32 @@
1
1
  const { DefaultColorModeValue, isValidColorMode } = require("./mode.cjs");
2
2
 
3
+ // Never write a comment inside the template literal below. It is emitted
4
+ // verbatim into an inline <script>, so a comment there is string content rather
5
+ // than source: the bundler minifying this module cannot reach it, and whether
6
+ // the host's HTML pipeline minifies an injected inline script is out of this
7
+ // package's hands. Every such comment ships on every page load. The rationale
8
+ // for what the snippet does lives here instead.
9
+ //
10
+ // `--seed-static-font-scale`, written outside the `fontScaling` gate: Android
11
+ // WebView multiplies every computed font-size and line-height by
12
+ // Configuration.fontScale whether or not the app opted in, so the `*-static`
13
+ // tokens have to divide it back out either way. The option picks whether SEED
14
+ // *follows* the user's scale, not whether the WebView applies one. iOS needs
15
+ // nothing here, because its scaling arrives through `-apple-system-body`
16
+ // inheritance, which the gate does control, and a literal px is never inflated.
17
+ // The measured scale stays uncapped because it is a divisor: the tokens cancel
18
+ // textZoom only by dividing by exactly what the WebView multiplied back in,
19
+ // whatever cap the native app chose.
20
+ //
21
+ // `data-seed-font-multiplier`, written on both platforms inside the gate: it
22
+ // reports how much SEED grew the text, not how large a step the user picked.
23
+ // On iOS the measurement is normalized to the web 16px baseline and then
24
+ // clamped to the cap iOS actually applies, the 1.35 that globalCss sets as
25
+ // `--seed-font-size-limit-max`; the Dynamic Type accessibility steps reach 3.1
26
+ // and would otherwise overstate it. On Android the token clamp bounds the same
27
+ // value to [`--seed-font-size-limit-min`, `--seed-font-size-limit-max`], so
28
+ // past the cap it stays deliberately below the raw scale measured above.
29
+
3
30
  function generateThemingScript({ mode = DefaultColorModeValue, fontScaling = false }) {
4
31
  if (!isValidColorMode(mode)) {
5
32
  throw new Error(`Invalid color mode: ${mode}`);
@@ -42,6 +69,15 @@ function generateThemingScript({ mode = DefaultColorModeValue, fontScaling = fal
42
69
  }
43
70
  } catch (e) {}
44
71
 
72
+ var seedAndroidFontScale = 1;
73
+ try {
74
+ if (document.documentElement.dataset.seedPlatform === 'android') {
75
+ var rootSize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);
76
+ seedAndroidFontScale = rootSize > 0 ? rootSize / 16 : 1;
77
+ document.documentElement.style.setProperty('--seed-static-font-scale', seedAndroidFontScale.toString());
78
+ }
79
+ } catch (e) {}
80
+
45
81
  try {
46
82
  if (${fontScaling}) {
47
83
  var platform = document.documentElement.dataset.seedPlatform;
@@ -56,8 +92,9 @@ function generateThemingScript({ mode = DefaultColorModeValue, fontScaling = fal
56
92
  document.body.appendChild(tempEl);
57
93
  var size = parseFloat(window.getComputedStyle(tempEl).fontSize);
58
94
  document.body.removeChild(tempEl);
59
- var mult = Math.max(0.8, Math.min(1.35, (size / 16) * 0.9412));
60
- document.documentElement.dataset.seedFontMultiplier = parseFloat(mult.toFixed(2)).toString();
95
+ var raw = size > 0 ? (size / 16) * 0.9412 : 1;
96
+ var scale = Math.max(0.8, Math.min(1.35, raw));
97
+ document.documentElement.dataset.seedFontMultiplier = parseFloat(scale.toFixed(2)).toString();
61
98
  } catch (e) {}
62
99
  }
63
100
 
@@ -67,9 +104,8 @@ function generateThemingScript({ mode = DefaultColorModeValue, fontScaling = fal
67
104
  applyIOSFontScaling();
68
105
  }
69
106
  } else if (platform === 'android') {
70
- var fontSize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);
71
- var scale = Math.max(0.8, Math.min(1.5, fontSize / 16));
72
- document.documentElement.dataset.seedFontMultiplier = parseFloat(scale.toFixed(2)).toString();
107
+ var applied = Math.max(0.8, Math.min(1.5, seedAndroidFontScale));
108
+ document.documentElement.dataset.seedFontMultiplier = parseFloat(applied.toFixed(2)).toString();
73
109
  document.documentElement.dataset.seedFontScaling = 'enabled';
74
110
  }
75
111
  }
package/theming/index.mjs CHANGED
@@ -1,5 +1,32 @@
1
1
  import { DefaultColorModeValue, isValidColorMode } from "./mode.mjs";
2
2
 
3
+ // Never write a comment inside the template literal below. It is emitted
4
+ // verbatim into an inline <script>, so a comment there is string content rather
5
+ // than source: the bundler minifying this module cannot reach it, and whether
6
+ // the host's HTML pipeline minifies an injected inline script is out of this
7
+ // package's hands. Every such comment ships on every page load. The rationale
8
+ // for what the snippet does lives here instead.
9
+ //
10
+ // `--seed-static-font-scale`, written outside the `fontScaling` gate: Android
11
+ // WebView multiplies every computed font-size and line-height by
12
+ // Configuration.fontScale whether or not the app opted in, so the `*-static`
13
+ // tokens have to divide it back out either way. The option picks whether SEED
14
+ // *follows* the user's scale, not whether the WebView applies one. iOS needs
15
+ // nothing here, because its scaling arrives through `-apple-system-body`
16
+ // inheritance, which the gate does control, and a literal px is never inflated.
17
+ // The measured scale stays uncapped because it is a divisor: the tokens cancel
18
+ // textZoom only by dividing by exactly what the WebView multiplied back in,
19
+ // whatever cap the native app chose.
20
+ //
21
+ // `data-seed-font-multiplier`, written on both platforms inside the gate: it
22
+ // reports how much SEED grew the text, not how large a step the user picked.
23
+ // On iOS the measurement is normalized to the web 16px baseline and then
24
+ // clamped to the cap iOS actually applies, the 1.35 that globalCss sets as
25
+ // `--seed-font-size-limit-max`; the Dynamic Type accessibility steps reach 3.1
26
+ // and would otherwise overstate it. On Android the token clamp bounds the same
27
+ // value to [`--seed-font-size-limit-min`, `--seed-font-size-limit-max`], so
28
+ // past the cap it stays deliberately below the raw scale measured above.
29
+
3
30
  export const generateThemingScript = ({ mode = DefaultColorModeValue, fontScaling = false }) => {
4
31
  if (!isValidColorMode(mode)) {
5
32
  throw new Error(`Invalid color mode: ${mode}`);
@@ -42,6 +69,15 @@ export const generateThemingScript = ({ mode = DefaultColorModeValue, fontScalin
42
69
  }
43
70
  } catch (e) {}
44
71
 
72
+ var seedAndroidFontScale = 1;
73
+ try {
74
+ if (document.documentElement.dataset.seedPlatform === 'android') {
75
+ var rootSize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);
76
+ seedAndroidFontScale = rootSize > 0 ? rootSize / 16 : 1;
77
+ document.documentElement.style.setProperty('--seed-static-font-scale', seedAndroidFontScale.toString());
78
+ }
79
+ } catch (e) {}
80
+
45
81
  try {
46
82
  if (${fontScaling}) {
47
83
  var platform = document.documentElement.dataset.seedPlatform;
@@ -56,8 +92,9 @@ export const generateThemingScript = ({ mode = DefaultColorModeValue, fontScalin
56
92
  document.body.appendChild(tempEl);
57
93
  var size = parseFloat(window.getComputedStyle(tempEl).fontSize);
58
94
  document.body.removeChild(tempEl);
59
- var mult = Math.max(0.8, Math.min(1.35, (size / 16) * 0.9412));
60
- document.documentElement.dataset.seedFontMultiplier = parseFloat(mult.toFixed(2)).toString();
95
+ var raw = size > 0 ? (size / 16) * 0.9412 : 1;
96
+ var scale = Math.max(0.8, Math.min(1.35, raw));
97
+ document.documentElement.dataset.seedFontMultiplier = parseFloat(scale.toFixed(2)).toString();
61
98
  } catch (e) {}
62
99
  }
63
100
 
@@ -67,9 +104,8 @@ export const generateThemingScript = ({ mode = DefaultColorModeValue, fontScalin
67
104
  applyIOSFontScaling();
68
105
  }
69
106
  } else if (platform === 'android') {
70
- var fontSize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);
71
- var scale = Math.max(0.8, Math.min(1.5, fontSize / 16));
72
- document.documentElement.dataset.seedFontMultiplier = parseFloat(scale.toFixed(2)).toString();
107
+ var applied = Math.max(0.8, Math.min(1.5, seedAndroidFontScale));
108
+ document.documentElement.dataset.seedFontMultiplier = parseFloat(applied.toFixed(2)).toString();
73
109
  document.documentElement.dataset.seedFontScaling = 'enabled';
74
110
  }
75
111
  }
@@ -29,7 +29,7 @@ export declare const layerBasement = "var(--seed-color-bg-layer-basement)";
29
29
  export declare const layerDefault = "var(--seed-color-bg-layer-default)";
30
30
  /** basement 바로 위에 놓이는 기본 표면입니다. 대부분의 스크린 콘텐츠(List, TextField 등)가 이 레이어 위에서 표현됩니다. (pressed) */
31
31
  export declare const layerDefaultPressed = "var(--seed-color-bg-layer-default-pressed)";
32
- /** @deprecated `@seed-design/css@1.3.0`에서 제거될 예정입니다. */
32
+ /** @deprecated `@seed-design/css@2.0.0`에서 제거될 예정입니다. */
33
33
  export declare const layerFill = "var(--seed-color-bg-layer-fill)";
34
34
  /** 화면의 모든 콘텐츠 위를 덮으며(floating) 나타나는 임시 레이어입니다. 사용자의 상호작용을 필요로 하는 모달(Modal)성 요소들이 여기에 속합니다. */
35
35
  export declare const layerFloating = "var(--seed-color-bg-layer-floating)";
@@ -26,7 +26,7 @@ export declare const vars: {
26
26
  "strokeFalse": {},
27
27
  /**
28
28
  * 모서리를 둥글게 처리합니다.
29
- @deprecated `rounded` 옵션은 @seed-design/react@1.3.0에서 제거될 예정입니다. `borderRadius="r2"`를 사용하세요.
29
+ @deprecated `rounded` 옵션은 @seed-design/react@2.0.0에서 제거될 예정입니다. `borderRadius="r2"`를 사용하세요.
30
30
  Reason: 모서리 스타일은 `borderRadius` prop으로 통일합니다.
31
31
 
32
32
  */
@@ -40,7 +40,7 @@ Reason: 모서리 스타일은 `borderRadius` prop으로 통일합니다.
40
40
  },
41
41
  /**
42
42
  * 모서리를 둥글게 처리하지 않습니다.
43
- @deprecated `rounded` 옵션은 @seed-design/react@1.3.0에서 제거될 예정입니다. `borderRadius="r2"`를 사용하세요.
43
+ @deprecated `rounded` 옵션은 @seed-design/react@2.0.0에서 제거될 예정입니다. `borderRadius="r2"`를 사용하세요.
44
44
  Reason: 모서리 스타일은 `borderRadius` prop으로 통일합니다.
45
45
 
46
46
  */
@@ -1,9 +1,9 @@
1
1
  /** 스크롤이 가능하도록 그라디언트로 특정 영역을 덮는 요소로 사용해요.
2
- @deprecated `@seed-design/css@1.3.0`에서 제거될 예정입니다.
2
+ @deprecated `@seed-design/css@2.0.0`에서 제거될 예정입니다.
3
3
  */
4
4
  export declare const fadeLayerFloating = "var(--seed-gradient-fade-layer-floating)";
5
5
  /** 스크롤이 가능하도록 그라디언트로 특정 영역을 덮는 요소로 사용해요.
6
- @deprecated `@seed-design/css@1.3.0`에서 제거될 예정입니다.
6
+ @deprecated `@seed-design/css@2.0.0`에서 제거될 예정입니다.
7
7
  */
8
8
  export declare const fadeLayerDefault = "var(--seed-gradient-fade-layer-default)";
9
9
  /** 반짝이는 것처럼 느껴지는 배경에 쓰이는 ai 컬러입니다. */