lism-css 0.10.1 → 0.10.3

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.
Files changed (48) hide show
  1. package/README.ja.md +260 -0
  2. package/README.md +202 -17
  3. package/config/defaults/props.ts +6 -1
  4. package/config/defaults/tokens.ts +1 -1
  5. package/dist/components/Group/Group.d.ts +2 -1
  6. package/dist/components/Group/Group.stories.d.ts +7 -0
  7. package/dist/components/Heading/Heading.stories.d.ts +7 -0
  8. package/dist/components/Inline/Inline.d.ts +2 -1
  9. package/dist/components/Inline/Inline.stories.d.ts +9 -0
  10. package/dist/components/List/List.d.ts +2 -1
  11. package/dist/components/List/List.stories.d.ts +9 -0
  12. package/dist/components/List/ListItem.d.ts +2 -1
  13. package/dist/components/Text/Text.d.ts +2 -1
  14. package/dist/components/Text/Text.stories.d.ts +6 -0
  15. package/dist/components/atomic/Media/Media.d.ts +2 -1
  16. package/dist/components/atomic/Media/Media.stories.d.ts +3 -0
  17. package/dist/components/atomic/Media/index.js +5 -5
  18. package/dist/config/default-config.d.ts +2 -1
  19. package/dist/config/defaults/props.d.ts +1 -0
  20. package/dist/config/defaults/props.js +6 -1
  21. package/dist/config/defaults/tokens.d.ts +1 -1
  22. package/dist/config/defaults/tokens.js +1 -1
  23. package/dist/config/index.d.ts +4 -2
  24. package/dist/css/base/set.css +1 -1
  25. package/dist/css/base.css +1 -1
  26. package/dist/css/main.css +1 -1
  27. package/dist/css/main_no_layer.css +1 -1
  28. package/dist/css/props.css +1 -1
  29. package/dist/lib/types/allowedTags.d.ts +6 -0
  30. package/package.json +1 -1
  31. package/packages/astro/Group/Group.astro +3 -2
  32. package/packages/astro/Inline/Inline.astro +3 -2
  33. package/packages/astro/List/List.astro +3 -2
  34. package/packages/astro/List/ListItem.astro +3 -2
  35. package/packages/astro/Media/Media.astro +11 -6
  36. package/packages/astro/Text/Text.astro +3 -2
  37. package/packages/astro/types/MediaPolymorphic.ts +51 -0
  38. package/src/scss/_prop-config.scss +9 -3
  39. package/src/scss/_setting.scss +0 -1
  40. package/src/scss/base/_html.scss +61 -65
  41. package/src/scss/base/index.scss +1 -1
  42. package/src/scss/base/set/_bp.scss +4 -1
  43. package/src/scss/base/set/_cqUnit.scss +8 -12
  44. package/src/scss/base/tokens/_shadow.scss +4 -4
  45. package/src/scss/base/tokens/_tokens.scss +46 -49
  46. package/src/scss/base/tokens/_typography.scss +46 -67
  47. package/src/scss/reset.scss +34 -43
  48. package/src/scss/base/tokens/_property.scss +0 -21
@@ -1,9 +1,10 @@
1
1
  ---
2
- import type { HTMLTag, Polymorphic } from 'astro/types';
2
+ import type { Polymorphic } from 'astro/types';
3
3
  import type { AstroLismBaseProps } from '../types';
4
+ import type { TextAllowedTag } from 'lism-css/lib/types/allowedTags';
4
5
  import Lism from '../Lism/Lism.astro';
5
6
 
6
- type Props<Tag extends HTMLTag = 'p'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
+ type Props<Tag extends TextAllowedTag = 'p'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
8
 
8
9
  const { as: Tag = 'p', ...props } = Astro.props;
9
10
  ---
@@ -0,0 +1,51 @@
1
+ import type { HTMLAttributes } from 'astro/types';
2
+ import type { LocalImageProps, RemoteImageProps } from 'astro:assets';
3
+ import type { ImageOutputFormat } from 'astro';
4
+ import type { MediaAllowedTag } from 'lism-css/lib/types/allowedTags';
5
+
6
+ // Astro の OmitIndexSignature を再現(インデックスシグネチャを除去して型を具体化する)
7
+ // Astro の Polymorphic 内の OmitIndexSignature は単一オブジェクト型に適用されるため非分配版で問題ないが、
8
+ // ここでは ImageProps = LocalImageProps | RemoteImageProps という union に適用されるため、
9
+ // T extends unknown で union の各メンバーに個別適用させる必要がある(distributive conditional type)
10
+ // これにより inferSize (RemoteImageProps のみ) など片方にしかない props も正しく型解決される
11
+ //
12
+ // 非分配: F<{ [k: string]: any; a: 1 } | { [k: string]: any; a: 1; b: 2 }> → keyof で共通キーだけ残る → { a: 1 }
13
+ // 分配: F<{ [k: string]: any; a: 1 } | { [k: string]: any; a: 1; b: 2 }> → { a: 1 } | { a: 1; b: 2 }
14
+ type OmitIndexSignature<T> = T extends unknown
15
+ ? {
16
+ // object extends Record<K, unknown> で「任意の object がキー K を持つか」を判定
17
+ // インデックスシグネチャ由来のキー(string, number 等)→ true → never で除外
18
+ // 具体的なリテラルキー("src", "alt" 等)→ false → K を保持
19
+ [K in keyof T as object extends Record<K, unknown> ? never : K]: T[K];
20
+ }
21
+ : never;
22
+
23
+ // union の各メンバーに個別に Omit を適用するヘルパー(OmitIndexSignature と同じ理由)
24
+ // Omit<{ a: 1 } | { a: 1; b: 2 }, never> → { a: 1 }(b が消える)
25
+ // DistributiveOmit<{ a: 1 } | { a: 1; b: 2 }, never> → { a: 1 } | { a: 1; b: 2 }(b が残る)
26
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
27
+
28
+ // Astro <Image /> / <Picture /> の props
29
+ type ImageProps = LocalImageProps | RemoteImageProps;
30
+
31
+ // Astro <Picture /> 固有の追加 props
32
+ type PictureExtraProps = {
33
+ formats?: ImageOutputFormat[];
34
+ fallbackFormat?: ImageOutputFormat;
35
+ pictureAttributes?: HTMLAttributes<'picture'>;
36
+ };
37
+
38
+ // Polymorphic が除外する Astro 固有属性のキー(class:list は Polymorphic の挙動に合わせて残す)
39
+ type AstroBuiltinAttributeKeys = keyof Omit<astroHTML.JSX.AstroBuiltinAttributes, 'class:list'>;
40
+
41
+ // img / picture エントリを Astro コンポーネントの props で拡張した DefinedIntrinsicElements
42
+ type MediaIntrinsicElements = Omit<astroHTML.JSX.DefinedIntrinsicElements, 'img' | 'picture'> & {
43
+ img: ImageProps;
44
+ picture: ImageProps & PictureExtraProps;
45
+ };
46
+
47
+ type MediaPolymorphicAttributes<P extends { as: MediaAllowedTag }> = Omit<P, 'as'> & {
48
+ as?: P['as'];
49
+ } & DistributiveOmit<OmitIndexSignature<MediaIntrinsicElements[P['as']]>, AstroBuiltinAttributeKeys>;
50
+
51
+ export type MediaPolymorphic<P extends { as: MediaAllowedTag }> = MediaPolymorphicAttributes<Omit<P, 'as'> & { as: NonNullable<P['as']> }>;
@@ -27,12 +27,18 @@ $props: (
27
27
  'fw': (
28
28
  prop: 'font-weight',
29
29
  utilities: (
30
- 'thin': 'var(--fw--thin)',
30
+ '100': '100',
31
+ '200': '200',
32
+ '300': '300',
33
+ '400': '400',
34
+ '500': '500',
35
+ '600': '600',
36
+ '700': '700',
37
+ '800': '800',
38
+ '900': '900',
31
39
  'light': 'var(--fw--light)',
32
40
  'normal': 'var(--fw--normal)',
33
- 'medium': 'var(--fw--medium)',
34
41
  'bold': 'var(--fw--bold)',
35
- 'black': 'var(--fw--black)',
36
42
  ),
37
43
  ),
38
44
  'ff': (
@@ -5,7 +5,6 @@
5
5
  $default_important: 0 !default;
6
6
  $is_container_query: 1 !default;
7
7
  $common_support_bp: 'md' !default;
8
- $fzmol: 8 !default; // 7 ~ に対応.
9
8
 
10
9
  $breakpoints: () !default;
11
10
  $breakpoints: map.merge(
@@ -1,6 +1,6 @@
1
- /* ----------------------------------------
2
- body
3
- ---------------------------------------- */
1
+ /* --------------------------------------------------
2
+ body
3
+ -------------------------------------------------- */
4
4
  body {
5
5
  --hl: var(--hl--base);
6
6
  font-size: var(--fz--base);
@@ -11,19 +11,19 @@ body {
11
11
  text-underline-offset: var(--under-offset, 0.125em);
12
12
  }
13
13
 
14
- /* ----------------------------------------
15
- line-height
16
- ---------------------------------------- */
14
+ /* --------------------------------------------------
15
+ line-height
16
+ -------------------------------------------------- */
17
17
  * {
18
18
  line-height: calc(1em + var(--hl) * 2);
19
19
  }
20
20
 
21
- /* ----------------------------------------
22
- Heading
23
- ---------------------------------------- */
21
+ /* --------------------------------------------------
22
+ Heading
23
+ -------------------------------------------------- */
24
24
  :is(h1, h2, h3, h4, h5, h6) {
25
- font-family: var(--heading-ff, inherit);
26
- font-weight: var(--heading-fw, bolder);
25
+ font-family: var(--headings-ff, inherit);
26
+ font-weight: var(--headings-fw, var(--fw--bold));
27
27
  }
28
28
  h1 {
29
29
  font-size: var(--fz--3xl);
@@ -42,19 +42,9 @@ h6 {
42
42
  font-size: var(--fz--m);
43
43
  }
44
44
 
45
- /* ----------------------------------------
46
- list
47
- ---------------------------------------- */
48
- // classを持たない、もしくは Prop Classしかない(≒ Prop Class で始まる) リスト要素はブラウザ標準のスタイルを復活させる。
49
- :is(ul, ol):where(:not([class])),
50
- :is(ul, ol):where([class^='-']) {
51
- list-style: revert;
52
- padding-inline-start: var(--s30);
53
- }
54
-
55
- /* ----------------------------------------
56
- texts
57
- ---------------------------------------- */
45
+ /* --------------------------------------------------
46
+ texts
47
+ -------------------------------------------------- */
58
48
  a {
59
49
  color: var(--link-c, var(--link));
60
50
  text-decoration: var(--link-td, underline);
@@ -74,8 +64,8 @@ strong {
74
64
 
75
65
  sup,
76
66
  sub {
67
+ --hl: var(--hl--xs);
77
68
  font-size: 80%;
78
- line-height: 1.2;
79
69
  }
80
70
 
81
71
  legend,
@@ -91,13 +81,6 @@ samp {
91
81
  font-family: var(--ff--mono);
92
82
  }
93
83
 
94
- dt {
95
- font-weight: var(--fw--bold);
96
- }
97
- dd + dt {
98
- margin-block-start: var(--s15);
99
- }
100
-
101
84
  blockquote {
102
85
  background-color: var(--base-2);
103
86
  padding: var(--s30);
@@ -109,55 +92,68 @@ hr {
109
92
  border-block-start: 1px solid var(--divider);
110
93
  }
111
94
 
112
- // figure {
113
- // display: grid;
114
- // gap: var(--s5);
115
- // place-items: center;
116
- // }
95
+ /* --------------------------------------------------
96
+ list
97
+ -------------------------------------------------- */
98
+ // classを持たない、もしくは Prop Classしかない(≒ Prop Class で始まる) リスト要素はブラウザ標準のスタイルを復活させる。
99
+ :is(ul, ol):where(:not([class])),
100
+ :is(ul, ol):where([class^='-']) {
101
+ list-style: revert;
102
+ padding-inline-start: var(--s30);
103
+ }
104
+
105
+ dt {
106
+ font-weight: var(--fw--bold);
107
+ }
108
+ dd + dt {
109
+ margin-block-start: var(--s20);
110
+ }
117
111
 
118
- /* ----------------------------------------
119
- table
120
- ---------------------------------------- */
121
- // table {
122
- // --hl: var(--hl--s);
123
- // }
124
- th {
125
- color: var(--th--c, inherit);
126
- background-color: var(--th--bgc, transparent);
112
+ /* --------------------------------------------------
113
+ table
114
+ -------------------------------------------------- */
115
+ table {
116
+ --td-c: inherit;
117
+ --td-bgc: transparent;
118
+ --td-p: var(--s5) var(--s10);
119
+ --td-min-sz: initial;
120
+ }
121
+ td {
122
+ color: var(--td-c);
123
+ background-color: var(--td-bgc);
124
+ padding: var(--td-p);
125
+ min-inline-size: var(--td-min-sz);
127
126
  }
128
- td,
129
127
  th {
130
- padding: var(--cell-p, var(--s5) var(--s10));
131
- min-inline-size: var(--cell-min-w, initial);
128
+ // デフォルト: tdと同じスタイル
129
+ color: var(--th-c, var(--td-c));
130
+ background-color: var(--th-bgc, var(--td-bgc));
131
+ padding: var(--th-p, var(--td-p));
132
+ min-inline-size: var(--th-min-sz, var(--td-min-sz));
132
133
  }
133
134
 
134
- /* ----------------------------------------
135
- Form fields
136
- ---------------------------------------- */
135
+ /* --------------------------------------------------
136
+ Form fields
137
+ -------------------------------------------------- */
137
138
  input,
138
139
  button,
139
140
  textarea,
140
141
  select,
141
142
  ::file-selector-button {
142
- padding: var(--s5) var(--s10);
143
-
144
- // 最低限揃えておく
145
- background-color: var(--base);
146
- border: solid 1px var(--divider);
147
- border-radius: var(--bdrs--10);
148
- }
149
-
150
- button {
151
- background-color: var(--base-2);
143
+ // フォーム系コントロールの最低限の見た目(テーマ差し替えは --controls-*)
144
+ background-color: var(--controls-bgc, var(--base-2));
145
+ border: solid 1px var(--controls-bdc, var(--divider));
146
+ padding: var(--controls-p, var(--s5) var(--s10));
147
+ border-radius: var(--controls-bdrs, var(--bdrs--10));
152
148
  }
153
149
 
154
150
  :disabled {
155
151
  opacity: var(--o--n20);
156
152
  }
157
153
 
158
- /* ----------------------------------------
159
- フォーカス要素
160
- ---------------------------------------- */
154
+ /* --------------------------------------------------
155
+ フォーカス要素
156
+ -------------------------------------------------- */
161
157
  :focus-visible {
162
158
  outline-offset: var(--focus-offset, 0px);
163
159
  }
@@ -1,4 +1,3 @@
1
- @forward './tokens/property';
2
1
  @forward './tokens/tokens';
3
2
  @forward './tokens/typography';
4
3
  @forward './tokens/shadow';
@@ -6,4 +5,5 @@
6
5
  // 各html要素のベーススタイル
7
6
  @forward './html';
8
7
 
8
+ // setクラス
9
9
  @forward './set/index';
@@ -1,6 +1,9 @@
1
1
  @use '../../query' as query;
2
2
 
3
- /* 特定のブレイクポイント以上でのみスタイルを適用させるためのハック変数. @see: .is--vertical */
3
+ /*
4
+ * 特定のブレイクポイント以上でのみスタイルを適用させるためのハック変数を定義する
5
+ * 👀: .is--vertical
6
+ */
4
7
  :root {
5
8
  --_is_sm: unset;
6
9
  --_is_md: unset;
@@ -1,23 +1,19 @@
1
- /* ------------------------------------------------------------
2
- cqUnit: コンテナクエリ単位の再セット
3
- ------------------------------------------------------------ */
1
+ /* --------------------------------------------------
2
+ cqUnit: コンテナクエリ単位でのトークン再セット
3
+ -------------------------------------------------- */
4
4
  .set--cqUnit {
5
5
  --REM: var(--REM--cq);
6
- font-size: var(--REM--cq);
6
+ font-size: var(--REM);
7
7
 
8
- --fz--base: var(--REM);
9
-
10
- // ハーフレディング単位
11
- --hl-unit: calc(var(--REM) * 0.125); /* ≒ 2px */
12
-
13
- // --- ハーフレディング ---
8
+ // ハーフレディングの再計算
9
+ --hl-unit: calc(var(--REM) * 0.125);
14
10
  --hl--xs: var(--hl-unit);
15
11
  --hl--s: calc(var(--hl-unit) * 2);
16
12
  --hl--base: calc(var(--hl-unit) * 3);
17
13
  --hl--l: calc(var(--hl-unit) * 4);
18
14
 
19
- // --- スペーシング ---
20
- --s-unit: calc(var(--REM) * 0.5); /* ≒ 8px */
15
+ // スペーシングの再計算
16
+ --s-unit: calc(var(--REM) * 0.5);
21
17
  --s5: calc(0.5 * var(--s-unit));
22
18
  --s10: var(--s-unit);
23
19
  --s15: calc(1.5 * var(--s-unit));
@@ -1,7 +1,7 @@
1
- /* ------------------------------------------------------------
2
- shadow
3
- Memo: :root だけで変数をセットしてしまうと--shc がその時点で固定されるので、再セットできる set--shadow クラスを用意。
4
- ------------------------------------------------------------ */
1
+ /* --------------------------------------------------
2
+ shadow
3
+ Memo: `:root` だけで変数をセットしてしまうと --shc がその時点で固定されるので、再セットできる set--shadow クラスを用意している。
4
+ -------------------------------------------------- */
5
5
  :root,
6
6
  .set--shadow {
7
7
  --sh--5: var(--sh-inset) var(--shsz--5) var(--shc);
@@ -1,7 +1,18 @@
1
+ /* --------------------------------------------------
2
+ containerサイズ保持変数
3
+ Memo: @property が使える環境であればコンテナのさらに親要素の幅を参照できるので、containerを1段階飛び出せる。
4
+ cqi を算出値で保持するために登録済みカスタムプロパティとして定義
5
+ -------------------------------------------------- */
6
+ @property --sz--container {
7
+ syntax: '<length-percentage>';
8
+ initial-value: 100cqi;
9
+ inherits: true;
10
+ }
11
+
1
12
  :root {
2
- /* ------------------------------------------------------------
3
- コンテンツサイズ
4
- ------------------------------------------------------------ */
13
+ /**
14
+ * Content size
15
+ */
5
16
  --sz--xl: 1600px; // 80*20
6
17
  --sz--l: 1280px; // 80*16
7
18
  --sz--m: 56rem; // 読みやすいのが50文字程度。
@@ -9,27 +20,19 @@
9
20
  --sz--xs: 32rem;
10
21
  --sz--min: 18rem; // 最低限維持したいコンテンツサイズの標準値。 sideMain等 で使用
11
22
 
12
- /* --------------------------------------------
13
- カラーパレット
14
- 1) 赤を基準として 明度L・彩度C を決める。
15
- 2) 各色は 色相H を固定セット。 L,C は色によって微調整。
16
- * -------------------------------------------- */
23
+ /**
24
+ * カラーパレット
25
+ * 1. 赤を基準として 明度L・彩度C を決める。
26
+ * 2. 各色は 色相H を固定セット。 L,C は色によって微調整。
27
+ */
17
28
  --black: #000;
18
29
  --white: #fff;
19
- // --gray: hsl(210 16% 40%);
20
- // --red: hsl(4 72% 50%);
21
- // --orange: hsl(26 80% 48%);
22
- // --yellow: hsl(48 80% 48%);
23
- // --green: hsl(132 76% 42%);
24
- // --blue: hsl(204 74% 50%);
25
- // --purple: hsl(260 72% 50%);
26
- // --pink: hsl(320 72% 50%);
27
30
 
28
- /* 基準の明度と彩度(red)*/
31
+ // 基準の明度と彩度(red)
29
32
  --L: 60%;
30
33
  --C: 0.22;
31
34
 
32
- /* カラートークン(OKLCH) */
35
+ // パレットトークン
33
36
  --red: oklch(var(--L) var(--C) 20);
34
37
  --orange: oklch(calc(var(--L) + 4%) calc(var(--C) - 0.01) 52);
35
38
  --yellow: oklch(calc(var(--L) + 12%) calc(var(--C) - 0.025) 84);
@@ -39,39 +42,36 @@
39
42
  --pink: oklch(calc(var(--L) + 2%) calc(var(--C) + 0.02) 348);
40
43
  --gray: oklch(calc(var(--L) - 4%) 0.04 256);
41
44
 
42
- // --------------------
43
- // キーワードカラー
44
- // --------------------
45
-
46
- // Main Color
45
+ /**
46
+ * セマンティックカラー
47
+ */
47
48
  --brand: #1e5f8c;
48
49
  --accent: #d94a6a;
49
- // --accent-2: #000;
50
- // --accent-3: #000;
51
50
 
52
- // base
51
+ // base (background)
53
52
  --base: hsl(224 4% 99%);
54
53
  --base-2: hsl(224 8% 95%);
55
54
 
56
- // text
55
+ // text (contents)
57
56
  --text: hsl(224 4% 8%);
58
57
  --text-2: hsl(224 6% 32%);
58
+
59
+ // link
59
60
  --link: oklch(50% 0.3 240); //hsl(224, 90%, 48%);
60
61
 
62
+ // divider (border)
61
63
  --divider: hsl(224 8% 88%);
62
64
 
63
- /* ------------------------------------------------------------
64
- opacity
65
- ------------------------------------------------------------ */
66
- // 質感で表現
65
+ /**
66
+ * opacity
67
+ */
67
68
  --o--n10: 0.75;
68
69
  --o--n20: 0.5;
69
70
  --o--n30: 0.25;
70
71
 
71
- /* ------------------------------------------------------------
72
- radius
73
- ------------------------------------------------------------ */
74
- // 等比
72
+ /**
73
+ * border-radius
74
+ */
75
75
  --bdrs--5: 2px;
76
76
  --bdrs--10: 0.25rem; // ≒ 4px
77
77
  --bdrs--20: 0.5rem; // ≒ 8px
@@ -80,9 +80,9 @@
80
80
  --bdrs--50: 2rem; // ≒ 32px
81
81
  --bdrs--99: 99rem;
82
82
 
83
- /* ------------------------------------------------------------
84
- shadow color, shadow inset, shadow size
85
- ------------------------------------------------------------ */
83
+ /**
84
+ * shadow color, shadow inset, shadow size
85
+ */
86
86
  --sh-inset: ; // for inset
87
87
  --shc: hsl(220 4% 8% / 5%);
88
88
 
@@ -94,17 +94,14 @@
94
94
  --shsz--40: 3px 13px 26px;
95
95
  --shsz--50: 5px 21px 42px;
96
96
 
97
- /* ------------------------------------------------------------
98
- aspect-ratio
99
- ------------------------------------------------------------ */
97
+ /**
98
+ * aspect-ratio
99
+ */
100
100
  --ar--og: 1.91/1;
101
101
 
102
- /* ------------------------------------------------------------
103
- State Module用の初期値
104
- ------------------------------------------------------------ */
105
- // サイトコンテンツの左右につける余白
106
- --gutter-size: var(--s30);
107
-
108
- // 縦書きモード
109
- --vertical-mode: vertical-rl;
102
+ /**
103
+ * State Module用の初期値
104
+ */
105
+ --gutter-size: var(--s30); // サイトコンテンツの左右につける余白
106
+ --vertical-mode: vertical-rl; // 縦書きモード
110
107
  }
@@ -1,104 +1,83 @@
1
- @use '../../_setting' as setting;
2
- @use 'sass:math';
3
-
4
- // フォントサイズ計算用の関数
5
- @function fz-calc($offset) {
6
- $fzmol: setting.$fzmol;
7
- $fz: math.div($fzmol, ($fzmol - $offset));
8
- @return math.div(math.round($fz * 1000), 1000);
9
- }
10
-
11
- /* ------------------------------------------------------------
12
- タイポグラフィ
13
- ------------------------------------------------------------ */
14
- /* ハーフレディング */
1
+ /* --------------------------------------------------
2
+ ハーフレディング管理変数
3
+ -------------------------------------------------- */
15
4
  @property --hl {
16
5
  syntax: '<length>';
17
6
  inherits: true;
18
7
  initial-value: 0.25rem;
19
8
  }
20
9
 
10
+ /* --------------------------------------------------
11
+ typography・spacing トークンの定義
12
+ -------------------------------------------------- */
21
13
  :root {
14
+ /**
15
+ * font-size
16
+ */
22
17
  --REM: clamp(0.95rem, 0.915rem + 0.15vw, 1.05rem); /* 変動幅: 360px ~ 1400px */
23
18
  --REM--cq: clamp(0.95rem, 0.9rem + 0.22vw, 1.05rem); /* 変動幅: 360px ~ 1440px */
24
19
 
25
20
  // font-size: 倍音列でのスケーリング。単位は em
26
- --fz--5xl: #{fz-calc(6)}em;
27
- --fz--4xl: #{fz-calc(5)}em;
28
- --fz--3xl: #{fz-calc(4)}em;
29
- --fz--2xl: #{fz-calc(3)}em;
30
- --fz--xl: #{fz-calc(2)}em;
31
- --fz--l: #{fz-calc(1)}em;
21
+ --fz--base: var(--REM);
22
+ --fz-mol: 8; // 倍音列の分母(7~ に対応)
23
+ --fz--5xl: calc(1em * var(--fz-mol) / (var(--fz-mol) - 6));
24
+ --fz--4xl: calc(1em * var(--fz-mol) / (var(--fz-mol) - 5));
25
+ --fz--3xl: calc(1em * var(--fz-mol) / (var(--fz-mol) - 4));
26
+ --fz--2xl: calc(1em * var(--fz-mol) / (var(--fz-mol) - 3));
27
+ --fz--xl: calc(1em * var(--fz-mol) / (var(--fz-mol) - 2));
28
+ --fz--l: calc(1em * var(--fz-mol) / (var(--fz-mol) - 1));
32
29
  --fz--m: 1em;
33
- --fz--s: #{fz-calc(-1)}em;
34
- --fz--xs: #{fz-calc(-2)}em;
35
- --fz--2xs: #{fz-calc(-3)}em;
30
+ --fz--s: calc(1em * var(--fz-mol) / (var(--fz-mol) + 1));
31
+ --fz--xs: calc(1em * var(--fz-mol) / (var(--fz-mol) + 2));
32
+ --fz--2xs: calc(1em * var(--fz-mol) / (var(--fz-mol) + 3));
36
33
 
37
- // ------------------------------
38
- // font-family
39
- // ------------------------------
40
- // system-ui は 游ゴシックが適用されてしまう。-apple-system: safari, firefox用 / 'BlinkMacSystemFont': Chrome用
34
+ /**
35
+ * font-family
36
+ * Memo: system-ui は 游ゴシックが適用されてしまう。
37
+ */
38
+ // Base font: -apple-system: safari&firefox / 'BlinkMacSystemFont': Chrome / 'Hiragino Sans': Mac / 'Segoe UI Emoji': Windows用
41
39
  --ff--base: -apple-system, 'BlinkMacSystemFont', 'Hiragino Sans', sans-serif, 'Segoe UI Emoji';
42
- --ff--accent: 'Garamond', 'Baskerville', 'Times New Roman', serif;
43
40
 
44
- // Mac: SFMono Menlo Monaco / Win: Consolas / Linux 'Liberation Mono'
41
+ // Mono font: SFMono, Menlo: Mac / Consolas: Win / Liberation Mono: Linux
45
42
  --ff--mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
46
43
 
47
- // ------------------------------
48
- // font-weight
49
- // ------------------------------
50
- --fw--thin: 100;
44
+ // Accent font: This is just one example.
45
+ --ff--accent: 'Garamond', 'Baskerville', 'Times New Roman', serif;
46
+
47
+ /**
48
+ * font-weight
49
+ */
51
50
  --fw--light: 300;
52
51
  --fw--normal: 400;
53
- --fw--medium: 500;
54
- --fw--bold: 700;
55
- --fw--black: 900;
52
+ --fw--bold: 600;
56
53
 
57
- // ------------------------------
58
- // letter-spacing
59
- // ------------------------------
54
+ /**
55
+ * letter-spacing
56
+ */
60
57
  --lts--base: normal;
61
58
  --lts--s: -0.05em;
62
59
  --lts--l: 0.05em;
63
60
  // --lts--xl: 0.125em;
64
61
 
65
- // remに相当する単位
66
- // --REM: var(--fz--base);
67
- }
68
-
69
- /* ------------------------------------------------------------
70
- Spacing
71
- フィボナッチ数列 0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,
72
- ------------------------------------------------------------ */
73
- :root {
74
- --fz--base: var(--REM);
75
-
76
- // ハーフレディング単位
77
- --hl-unit: calc(var(--REM) * 0.125); /* ≒ 2px */
62
+ /**
63
+ * ハーフレディング: unit の倍数で構成する
64
+ */
65
+ --hl-unit: calc(var(--REM) * 0.125); /* 計算単位 ≒ 2px */
78
66
 
79
- // --- ハーフレディング ---
80
- // unit の倍数で構成する
81
67
  --hl--xs: var(--hl-unit);
82
68
  --hl--s: calc(var(--hl-unit) * 2);
83
69
  --hl--base: calc(var(--hl-unit) * 3);
84
70
  --hl--l: calc(var(--hl-unit) * 4);
85
71
  // --hl--xl: calc(var(--hl-unit) * 5);
86
72
 
87
- // --- スペーシング ---
88
-
89
- /*
90
- ```
91
- --s: 5 10 15 20 30 40 50 ..
92
- 4: 4 8 12 20 32 52 84 136 220
93
- 8: 4 8 12 16 24 40 64 104 168 272 440
94
- ```
95
- */
73
+ /**
74
+ * スペーシング: フィボナッチ数列をベースにする
75
+ */
76
+ --s-unit: calc(var(--REM) * 0.5); // ≒ 8px
96
77
 
97
- /* スペーシング単位 8 フィボナッチ*/
98
- --s-unit: calc(var(--REM) * 0.5); /* ≒ 8px */
99
- --s5: calc(0.5 * var(--s-unit)); /* 例外 */
78
+ --s5: calc(0.5 * var(--s-unit)); // 例外
100
79
  --s10: var(--s-unit);
101
- --s15: calc(1.5 * var(--s-unit)); /* 例外 */
80
+ --s15: calc(1.5 * var(--s-unit)); // 例外
102
81
  --s20: calc(2 * var(--s-unit));
103
82
  --s30: calc(3 * var(--s-unit));
104
83
  --s40: calc(5 * var(--s-unit));