lism-css 0.9.4 → 0.10.1

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 (182) hide show
  1. package/README.md +5 -5
  2. package/bin/__build-css.cjs +54 -54
  3. package/bin/build-config.js +120 -120
  4. package/bin/build-css.js +52 -52
  5. package/bin/cli.mjs +33 -33
  6. package/config/__prop_list.js +42 -42
  7. package/config/__props.scss +20 -20
  8. package/config/default-config.ts +3 -3
  9. package/config/defaults/props.ts +326 -326
  10. package/config/defaults/states.ts +38 -38
  11. package/config/defaults/tokens.ts +25 -25
  12. package/config/helper/getSvgUrl.ts +16 -16
  13. package/config/helper/minifyHtml.ts +11 -11
  14. package/config/helper.test.ts +231 -231
  15. package/config/helper.ts +43 -49
  16. package/config/index.ts +4 -4
  17. package/config/tsconfig.json +16 -16
  18. package/dist/components/Dummy/Dummy.d.ts +6 -9
  19. package/dist/components/Dummy/index.js +5 -10
  20. package/dist/components/Group/Group.d.ts +3 -0
  21. package/dist/components/Group/index.d.ts +1 -0
  22. package/dist/components/Group/index.js +8 -0
  23. package/dist/components/HTML/HTML.d.ts +10 -0
  24. package/dist/components/Heading/Heading.d.ts +7 -0
  25. package/dist/components/Heading/index.d.ts +1 -0
  26. package/dist/components/Heading/index.js +9 -0
  27. package/dist/components/Inline/Inline.d.ts +3 -0
  28. package/dist/components/Inline/index.d.ts +1 -0
  29. package/dist/components/Inline/index.js +8 -0
  30. package/dist/components/Layer/Layer.d.ts +1 -2
  31. package/dist/components/Layer/index.js +3 -4
  32. package/dist/components/Link/Link.d.ts +2 -0
  33. package/dist/components/Link/index.d.ts +1 -0
  34. package/dist/components/Link/index.js +8 -0
  35. package/dist/components/LinkBox/LinkBox.d.ts +3 -2
  36. package/dist/components/LinkBox/index.js +5 -5
  37. package/dist/components/Lism/Lism.d.ts +7 -8
  38. package/dist/components/List/List.d.ts +3 -0
  39. package/dist/components/List/ListItem.d.ts +3 -0
  40. package/dist/components/List/ListItem.js +8 -0
  41. package/dist/components/List/index.d.ts +2 -0
  42. package/dist/components/List/index.js +8 -0
  43. package/dist/components/Text/Text.d.ts +3 -0
  44. package/dist/components/Text/index.d.ts +1 -0
  45. package/dist/components/Text/index.js +8 -0
  46. package/dist/components/atomic/Decorator/getProps.d.ts +1 -3
  47. package/dist/components/atomic/Decorator/getProps.js +10 -10
  48. package/dist/components/atomic/Icon/getProps.d.ts +1 -2
  49. package/dist/components/atomic/Icon/getProps.js +35 -34
  50. package/dist/components/atomic/Media/Media.d.ts +1 -4
  51. package/dist/components/atomic/Media/Media.stories.d.ts +1 -2
  52. package/dist/components/atomic/Media/index.js +4 -5
  53. package/dist/components/index.d.ts +8 -1
  54. package/dist/components/index.js +50 -36
  55. package/dist/config/helper.d.ts +1 -1
  56. package/dist/css/main.css +1 -1
  57. package/dist/css/main_no_layer.css +1 -1
  58. package/dist/css/modules/atomic.css +1 -1
  59. package/dist/css/modules/layout.css +1 -1
  60. package/dist/lib/getLismProps.d.ts +3 -2
  61. package/dist/lib/getMaybeCssVar.js +15 -10
  62. package/package.json +2 -1
  63. package/packages/astro/Box/Box.astro +6 -4
  64. package/packages/astro/Center/Center.astro +6 -3
  65. package/packages/astro/Cluster/Cluster.astro +6 -3
  66. package/packages/astro/Columns/Columns.astro +6 -3
  67. package/packages/astro/Container/Container.astro +7 -5
  68. package/packages/astro/Decorator/Decorator.astro +8 -5
  69. package/packages/astro/Divider/Divider.astro +5 -4
  70. package/packages/astro/Dummy/Dummy.astro +9 -12
  71. package/packages/astro/Flex/Flex.astro +6 -3
  72. package/packages/astro/Flow/Flow.astro +7 -3
  73. package/packages/astro/FluidCols/FluidCols.astro +7 -3
  74. package/packages/astro/Frame/Frame.astro +6 -3
  75. package/packages/astro/Grid/Grid.astro +6 -3
  76. package/packages/astro/Group/Group.astro +11 -0
  77. package/packages/astro/Group/index.ts +1 -0
  78. package/packages/astro/HTML/_index_memo.js +7 -7
  79. package/packages/astro/HTML/a.astro +5 -4
  80. package/packages/astro/HTML/button.astro +5 -4
  81. package/packages/astro/HTML/div.astro +5 -4
  82. package/packages/astro/HTML/h.astro +5 -4
  83. package/packages/astro/HTML/img.astro +5 -4
  84. package/packages/astro/HTML/li.astro +5 -4
  85. package/packages/astro/HTML/ol.astro +5 -4
  86. package/packages/astro/HTML/p.astro +5 -4
  87. package/packages/astro/HTML/span.astro +5 -4
  88. package/packages/astro/HTML/ul.astro +5 -4
  89. package/packages/astro/Heading/Heading.astro +13 -0
  90. package/packages/astro/Heading/index.ts +1 -0
  91. package/packages/astro/Icon/Icon.astro +13 -10
  92. package/packages/astro/Icon/SVG.astro +16 -16
  93. package/packages/astro/Inline/Inline.astro +11 -0
  94. package/packages/astro/Inline/index.ts +1 -0
  95. package/packages/astro/Layer/Layer.astro +6 -6
  96. package/packages/astro/Link/Link.astro +10 -0
  97. package/packages/astro/Link/index.ts +1 -0
  98. package/packages/astro/LinkBox/LinkBox.astro +9 -9
  99. package/packages/astro/Lism/Lism.astro +5 -7
  100. package/packages/astro/List/List.astro +11 -0
  101. package/packages/astro/List/ListItem.astro +11 -0
  102. package/packages/astro/List/index.ts +2 -0
  103. package/packages/astro/Media/Media.astro +6 -9
  104. package/packages/astro/SideMain/SideMain.astro +7 -3
  105. package/packages/astro/Spacer/Spacer.astro +6 -4
  106. package/packages/astro/Stack/Stack.astro +6 -3
  107. package/packages/astro/SwitchCols/SwitchCols.astro +7 -3
  108. package/packages/astro/Text/Text.astro +11 -0
  109. package/packages/astro/Text/index.ts +1 -0
  110. package/packages/astro/Wrapper/Wrapper.astro +8 -5
  111. package/packages/astro/env.d.ts +3 -3
  112. package/packages/astro/index.ts +9 -0
  113. package/packages/astro/tsconfig.json +10 -10
  114. package/packages/astro/types.ts +10 -42
  115. package/src/scss/__memo/_lh-auto-all.scss +12 -12
  116. package/src/scss/__memo/_lh-auto-h.scss +17 -17
  117. package/src/scss/__memo/_lh-manual.scss +27 -27
  118. package/src/scss/_auto_output.scss +174 -174
  119. package/src/scss/_mixin.scss +32 -32
  120. package/src/scss/_prop-config.scss +850 -850
  121. package/src/scss/_query.scss +26 -26
  122. package/src/scss/_setting.scss +6 -6
  123. package/src/scss/_with_layer.scss +13 -13
  124. package/src/scss/base/_html.scss +47 -47
  125. package/src/scss/base/set/_bp.scss +8 -8
  126. package/src/scss/base/set/_cqUnit.scss +22 -22
  127. package/src/scss/base/set/_gutter.scss +1 -1
  128. package/src/scss/base/set/_hov.scss +10 -10
  129. package/src/scss/base/set/_innerRs.scss +1 -1
  130. package/src/scss/base/set/_plain.scss +15 -15
  131. package/src/scss/base/set/_transition.scss +2 -2
  132. package/src/scss/base/tokens/_property.scss +3 -3
  133. package/src/scss/base/tokens/_shadow.scss +12 -12
  134. package/src/scss/base/tokens/_tokens.scss +77 -77
  135. package/src/scss/base/tokens/_typography.scss +69 -69
  136. package/src/scss/main_no_layer.scss +1 -1
  137. package/src/scss/modules/atomic/_divider.scss +4 -4
  138. package/src/scss/modules/atomic/_icon.scss +4 -4
  139. package/src/scss/modules/atomic/_spacer.scss +2 -2
  140. package/src/scss/modules/atomic/index.scss +0 -1
  141. package/src/scss/modules/layout/_center.scss +3 -3
  142. package/src/scss/modules/layout/_cluster.scss +3 -3
  143. package/src/scss/modules/layout/_columns.scss +3 -3
  144. package/src/scss/modules/layout/_flex.scss +4 -4
  145. package/src/scss/modules/layout/_flow.scss +16 -16
  146. package/src/scss/modules/layout/_fluidCols.scss +4 -4
  147. package/src/scss/modules/layout/_frame.scss +8 -8
  148. package/src/scss/modules/layout/_grid.scss +9 -9
  149. package/src/scss/modules/layout/_sideMain.scss +12 -12
  150. package/src/scss/modules/layout/_stack.scss +2 -2
  151. package/src/scss/modules/layout/_switchCols.scss +5 -5
  152. package/src/scss/modules/state/_container.scss +4 -4
  153. package/src/scss/modules/state/_layer.scss +3 -3
  154. package/src/scss/modules/state/_linkbox.scss +9 -9
  155. package/src/scss/modules/state/_vertical.scss +3 -3
  156. package/src/scss/modules/state/_wrapper.scss +8 -8
  157. package/src/scss/props/_border.scss +18 -18
  158. package/src/scss/props/_hover.scss +26 -26
  159. package/src/scss/props/_lh.scss +6 -6
  160. package/src/scss/props/_size.scss +7 -7
  161. package/src/scss/reset.scss +137 -137
  162. package/src/scss/utility/_cbox.scss +10 -10
  163. package/src/scss/utility/_clipText.scss +2 -2
  164. package/src/scss/utility/_hidden.scss +9 -9
  165. package/src/scss/utility/_itemDivider.scss +7 -7
  166. package/src/scss/utility/_linkExpand.scss +9 -9
  167. package/src/scss/utility/_snap.scss +5 -5
  168. package/src/scss/utility/_trimHL.scss +11 -11
  169. package/dist/components/Dummy/getContent.d.ts +0 -12
  170. package/dist/components/Dummy/getContent.js +0 -9
  171. package/dist/components/Dummy/texts.d.ts +0 -22
  172. package/dist/components/Dummy/texts.js +0 -39
  173. package/dist/components/Layer/getProps.d.ts +0 -5
  174. package/dist/components/atomic/Media/getProps.d.ts +0 -9
  175. package/dist/components/atomic/Media/getProps.js +0 -8
  176. package/dist/components/getFilterProps.d.ts +0 -10
  177. package/dist/components/getFilterProps.js +0 -23
  178. package/dist/components/getFilterProps.test.d.ts +0 -1
  179. package/dist/components/setMaybeTransformStyles.d.ts +0 -12
  180. package/dist/components/setMaybeTransformStyles.js +0 -7
  181. package/dist/components/setMaybeTransformStyles.test.d.ts +0 -1
  182. package/src/scss/modules/atomic/_media.scss +0 -3
@@ -1,51 +1,19 @@
1
1
  /**
2
2
  * Astro 用の Lism Props 型
3
3
  *
4
- * Astro テンプレートではコンポーネント呼び出し時にジェネリクスを渡せないため、
5
- * React の ElementType に依存せず、as を任意の文字列で受け取る。
6
- * astroHTML.JSX の HTML 属性型を union し、as で要素を切り替えた際の
7
- * 要素固有属性(href, src 等)も受け入れられるようにする。
8
- *
9
4
  * @see https://github.com/withastro/roadmap/discussions/601
10
5
  * @see https://github.com/withastro/roadmap/discussions/398
11
6
  */
12
- import type { HTMLTag } from 'astro/types';
13
7
  import type { LismProps } from 'lism-css/lib/getLismProps';
14
- import type { LayoutType, CssValue } from 'lism-css/lib/types/LayoutProps';
15
-
16
- type AstroHTMLAttributesRaw = astroHTML.JSX.HTMLAttributes &
17
- astroHTML.JSX.AnchorHTMLAttributes &
18
- astroHTML.JSX.ImgHTMLAttributes &
19
- astroHTML.JSX.ButtonHTMLAttributes &
20
- astroHTML.JSX.FormHTMLAttributes &
21
- astroHTML.JSX.InputHTMLAttributes &
22
- astroHTML.JSX.SelectHTMLAttributes &
23
- astroHTML.JSX.TextareaHTMLAttributes;
24
-
25
- /** LismProps と同名のキーを除外し、Lism 側の型を優先させる */
26
- type AstroHTMLAttributes = Omit<AstroHTMLAttributesRaw, keyof LismProps | keyof AstroLayoutProps>;
8
+ import type { LayoutSpecificProps } from 'lism-css/lib/types/LayoutProps';
27
9
 
28
- /**
29
- * React では LayoutSpecificProps(判別可能ユニオン・12メンバー)を使用しているが、
30
- * Astro ではいまとのところジェネリクスを用いていないので AstroHTMLAttributes(8つの HTML 属性型の intersection)が
31
- * 常に全体に交差されるため、12パターン × 巨大な型で TS2590 が発生する。
32
- * React では ComponentPropsWithoutRef<T> の T が具体的な1要素に確定するため問題にならない。
33
- * Astro 用にはフラットな型を使用して回避する。
34
- *
35
- * NOTE: 将来的に Astro の Polymorphic 型を導入すれば、as の値から具体的な1要素に
36
- * 確定できるため、AstroHTMLAttributesRaw の巨大な intersection が不要になり、
37
- * LayoutSpecificProps も直接使用できる可能性がある。
38
- */
39
- interface AstroLayoutProps {
40
- layout?: LayoutType;
41
- flow?: CssValue;
42
- autoFill?: boolean;
43
- sideW?: CssValue;
44
- mainW?: CssValue;
45
- breakSize?: CssValue;
46
- }
10
+ /** Polymorphic 型と組み合わせて使う共通ベース型 */
11
+ export type AstroLismBaseProps = LismProps &
12
+ LayoutSpecificProps & {
13
+ exProps?: Record<string, unknown>;
14
+ };
47
15
 
48
- export interface AstroLismProps extends LismProps, AstroLayoutProps, AstroHTMLAttributes {
49
- as?: HTMLTag;
50
- exProps?: Record<string, unknown>;
51
- }
16
+ /** layout が固定されたレイアウトコンポーネント向けベース型 */
17
+ export type AstroLismFixedLayoutProps = Omit<LismProps, 'layout'> & {
18
+ exProps?: Record<string, unknown>;
19
+ };
@@ -4,15 +4,15 @@
4
4
  → 下限・上限を超える値がセットされている時、その値を継承できない。
5
5
  */
6
6
  :root {
7
- --lh-min: 1.3em;
8
- --lh-max: 1.9em;
7
+ --lh-min: 1.3em;
8
+ --lh-max: 1.9em;
9
9
  }
10
10
  // ---------------------------------------------------------------------
11
11
 
12
12
  // 全要素で --fz, --lh を受け取れるように
13
13
  :where(body *) {
14
- font-size: var(--fz, inherit);
15
- line-height: var(--lh, inherit);
14
+ font-size: var(--fz, inherit);
15
+ line-height: var(--lh, inherit);
16
16
  }
17
17
 
18
18
  // [style*="--fz:"]{
@@ -23,15 +23,15 @@
23
23
  *:not([style*="font-size"]),
24
24
  [style*="--fz:"], // --fzでフォントサイズ指定されているもの
25
25
  [class*="-fz\:"], {
26
- --slope: 0.35; // 自動計算用の傾き
27
- --base: calc(var(--lh, var(--root--lh)) * 1em); // 計算ように単位をつけておく
26
+ --slope: 0.35; // 自動計算用の傾き
27
+ --base: calc(var(--lh, var(--root--lh)) * 1em); // 計算ように単位をつけておく
28
28
 
29
- // 上限値を var(--base) にすることで、フォントサイズが大きい場合にのみ計算を適用することも可能
30
- line-height: clamp(
31
- min(var(--lh-min), var(--base)),
32
- calc((var(--slope) * 1em) + var(--base) - (var(--slope) * var(--fz, 1em))),
33
- max(var(--lh-max), var(--base))
34
- );
29
+ // 上限値を var(--base) にすることで、フォントサイズが大きい場合にのみ計算を適用することも可能
30
+ line-height: clamp(
31
+ min(var(--lh-min), var(--base)),
32
+ calc((var(--slope) * 1em) + var(--base) - (var(--slope) * var(--fz, 1em))),
33
+ max(var(--lh-max), var(--base))
34
+ );
35
35
  }
36
36
 
37
37
  // .-fz:などに対して--lh指定されてあった場合に上書きできる位置で
@@ -2,20 +2,20 @@
2
2
  * タイポグラフィ
3
3
  */
4
4
  :root {
5
- --lh-min: 1.3em;
6
- --lh-max: 1.9em;
5
+ --lh-min: 1.3em;
6
+ --lh-max: 1.9em;
7
7
  }
8
8
 
9
9
  // ---------------------------------------------------------------------
10
10
  body {
11
- --fz: 1em; // 計算用に --fz の単位をem化しておく
12
- --lh: var(--root--lh); // 任意の値
11
+ --fz: 1em; // 計算用に --fz の単位をem化しておく
12
+ --lh: var(--root--lh); // 任意の値
13
13
  }
14
14
 
15
15
  // :where(body *),
16
16
  :where(:is(h1, h2, h3, h4, h5, h6, p)) {
17
- font-size: var(--fz, inherit);
18
- line-height: var(--lh, inherit);
17
+ font-size: var(--fz, inherit);
18
+ line-height: var(--lh, inherit);
19
19
  }
20
20
 
21
21
  // [style*="--fz:"]{
@@ -30,21 +30,21 @@ body {
30
30
  [style*="--fz:"], // --fzでフォントサイズ指定されているもの
31
31
  :where(:is(h1, h2, h3, h4, h5, h6, p)):not([style*="font-size"]),
32
32
  [class*="-fz\:"] {
33
- --slope: 0.35; // 自動計算用の傾き
34
- --base: calc(var(--lh) * 1em); // 計算ように単位をつけておく
35
-
36
- // 上限値を var(--base) にすることで、フォントサイズが大きい場合にのみ計算を適用することも可能
37
- line-height: clamp(
38
- min(var(--lh-min), var(--base)),
39
- calc((var(--slope) * 1em) + var(--base) - (var(--slope) * var(--fz))),
40
- max(var(--lh-max), var(--base))
41
- );
42
- font-size: var(--fz);
33
+ --slope: 0.35; // 自動計算用の傾き
34
+ --base: calc(var(--lh) * 1em); // 計算ように単位をつけておく
35
+
36
+ // 上限値を var(--base) にすることで、フォントサイズが大きい場合にのみ計算を適用することも可能
37
+ line-height: clamp(
38
+ min(var(--lh-min), var(--base)),
39
+ calc((var(--slope) * 1em) + var(--base) - (var(--slope) * var(--fz))),
40
+ max(var(--lh-max), var(--base))
41
+ );
42
+ font-size: var(--fz);
43
43
  }
44
44
 
45
45
  // --lh指定されている要素自身はその値で上書き。→ .-lh: 使ってもらう?
46
46
  [style*='--lh:'] {
47
- line-height: var(--lh);
47
+ line-height: var(--lh);
48
48
  }
49
49
 
50
50
  // ---------------------------------------------------------------------
@@ -1,36 +1,36 @@
1
1
  :root {
2
- // 各fzサイズ用のline-height
3
- --ls--6L--lh: 1.2;
4
- --ls--5L--lh: 1.4;
5
- --ls--4L--lh: 1.4;
6
- --ls--3L--lh: 1.5;
7
- --ls--2L--lh: 1.6;
8
- --ls--L--lh: 1.6;
2
+ // 各fzサイズ用のline-height
3
+ --ls--6L--lh: 1.2;
4
+ --ls--5L--lh: 1.4;
5
+ --ls--4L--lh: 1.4;
6
+ --ls--3L--lh: 1.5;
7
+ --ls--2L--lh: 1.6;
8
+ --ls--L--lh: 1.6;
9
9
 
10
- // 1,
11
- // 1.25, 5XL
12
- // 1.4 4XL
13
- // 1.5, 2XL, 3XL,
14
- // 1.6, L XL
15
- // 1.75 base
16
- // 2,
17
- // 2.5
10
+ // 1,
11
+ // 1.25, 5XL
12
+ // 1.4 4XL
13
+ // 1.5, 2XL, 3XL,
14
+ // 1.6, L XL
15
+ // 1.75 base
16
+ // 2,
17
+ // 2.5
18
18
 
19
- // 1, xs sm md, lg xl
20
- // 1, 1.25, 1.5. 1.75, 2, 2.5
19
+ // 1, xs sm md, lg xl
20
+ // 1, 1.25, 1.5. 1.75, 2, 2.5
21
21
  }
22
22
 
23
23
  h1 {
24
- --lh: var(--ls--4L--lh);
24
+ --lh: var(--ls--4L--lh);
25
25
  }
26
26
  h2 {
27
- --lh: var(--ls--3L--lh);
27
+ --lh: var(--ls--3L--lh);
28
28
  }
29
29
  h3 {
30
- --lh: var(--ls--2L--lh);
30
+ --lh: var(--ls--2L--lh);
31
31
  }
32
32
  h4 {
33
- --lh: var(--ls--L--lh);
33
+ --lh: var(--ls--L--lh);
34
34
  }
35
35
  // h5 {}
36
36
  // h6 {}
@@ -39,20 +39,20 @@ h4 {
39
39
  // .-fz\:s {}
40
40
  // .-fz\:m {}
41
41
  .-fz\:l {
42
- --lh: var(--ls--L--lh);
42
+ --lh: var(--ls--L--lh);
43
43
  }
44
44
  .-fz\:xl {
45
- --lh: var(--ls--2L--lh);
45
+ --lh: var(--ls--2L--lh);
46
46
  }
47
47
  .-fz\:2xl {
48
- --lh: var(--ls--3L--lh);
48
+ --lh: var(--ls--3L--lh);
49
49
  }
50
50
  .-fz\:3xl {
51
- --lh: var(--ls--4L--lh);
51
+ --lh: var(--ls--4L--lh);
52
52
  }
53
53
  .-fz\:4xl {
54
- --lh: var(--ls--5L--lh);
54
+ --lh: var(--ls--5L--lh);
55
55
  }
56
56
  .-fz\:5xl {
57
- --lh: var(--ls--6L--lh);
57
+ --lh: var(--ls--6L--lh);
58
58
  }
@@ -19,58 +19,58 @@ base_type:
19
19
 
20
20
  // マップから値を取得し、nullの場合はデフォルト値を返す
21
21
  @function map_get_with_default($map, $key, $default) {
22
- $value: map.get($map, $key);
23
- @if $value {
24
- @return $value;
25
- } @else {
26
- @return $default;
27
- }
22
+ $value: map.get($map, $key);
23
+ @if $value {
24
+ @return $value;
25
+ } @else {
26
+ @return $default;
27
+ }
28
28
  }
29
29
 
30
30
  @function get_important_str($is_important) {
31
- @if $is_important == 1 {
32
- @return ' !important';
33
- }
34
- @return '';
31
+ @if $is_important == 1 {
32
+ @return ' !important';
33
+ }
34
+ @return '';
35
35
  }
36
36
 
37
37
  // 各プロパティのユーティリティクラス
38
38
  @mixin echoUtilities($key, $prop, $utilities, $base_type, $important) {
39
- @each $ukey, $value in $utilities {
40
- $selector: '';
41
-
42
- // ,で複数指定
43
- // $has_comma: string.index($ukey, ',');
44
- // @if $has_comma {
45
- // $ukeys: string.split($ukey, ',');
46
-
47
- // @for $i from 1 through list.length($ukeys) {
48
- // $val_key: list.nth($ukeys, $i);
49
- // $_selector: '.-#{$key}\\:#{$val_key}';
50
- // @if $i == 1 {
51
- // $selector: $_selector;
52
- // } @else {
53
- // $selector: $selector + ',' + $_selector;
54
- // }
55
- // }
56
- // } @else {
57
- $selector: '.-#{$key}\\:#{$ukey}';
58
- // }
59
-
60
- // valueが(prop:val)で詳細に明示されている場合
61
- @if (meta.type-of($value) == map) {
62
- // マップ形式の場合は何もしない(将来の拡張用)
63
- } @else if $base_type == 2 {
64
- // important は [class*=] についてるので不要
65
- #{$selector} {
66
- --#{$key}: #{$value};
67
- }
68
- } @else {
69
- #{$selector} {
70
- #{$prop}: #{$value} #{get_important_str($important)};
71
- }
72
- }
73
- }
39
+ @each $ukey, $value in $utilities {
40
+ $selector: '';
41
+
42
+ // ,で複数指定
43
+ // $has_comma: string.index($ukey, ',');
44
+ // @if $has_comma {
45
+ // $ukeys: string.split($ukey, ',');
46
+
47
+ // @for $i from 1 through list.length($ukeys) {
48
+ // $val_key: list.nth($ukeys, $i);
49
+ // $_selector: '.-#{$key}\\:#{$val_key}';
50
+ // @if $i == 1 {
51
+ // $selector: $_selector;
52
+ // } @else {
53
+ // $selector: $selector + ',' + $_selector;
54
+ // }
55
+ // }
56
+ // } @else {
57
+ $selector: '.-#{$key}\\:#{$ukey}';
58
+ // }
59
+
60
+ // valueが(prop:val)で詳細に明示されている場合
61
+ @if (meta.type-of($value) == map) {
62
+ // マップ形式の場合は何もしない(将来の拡張用)
63
+ } @else if $base_type == 2 {
64
+ // important は [class*=] についてるので不要
65
+ #{$selector} {
66
+ --#{$key}: #{$value};
67
+ }
68
+ } @else {
69
+ #{$selector} {
70
+ #{$prop}: #{$value} #{get_important_str($important)};
71
+ }
72
+ }
73
+ }
74
74
  }
75
75
 
76
76
  /*
@@ -82,74 +82,74 @@ base_type:
82
82
  */
83
83
  $bp_support_list: (); // list
84
84
  @each $key, $data in setting.$props {
85
- $prop: map_get_with_default($data, prop, ''); // 対応するCSSプロパティ名
86
- $bp_support: map_get_with_default($data, bp, 0);
87
- $isVar: map_get_with_default($data, isVar, 0);
88
- $alwaysVar: map_get_with_default($data, alwaysVar, 0);
89
- $important: map_get_with_default($data, important, setting.$default_important);
90
-
91
- @if $prop == '' {
92
- @continue;
93
- }
94
-
95
- // 基本的なbaseセレクタタイプ: 基本は0, BPサポートオンなら 1.
96
- $base_type: 0;
97
-
98
- // Memo: == 1 ではないのは、'sm' や 'md' などの指定も入ってくる可能性があるから
99
- @if $bp_support != 0 {
100
- $base_type: 1;
101
- }
102
-
103
- @if $alwaysVar == 1 {
104
- $base_type: 2;
105
- }
106
-
107
- // isVar が 1 なら base_type は 0
108
- @if $isVar == 1 {
109
- $base_type: 0;
110
- }
111
-
112
- @if $base_type == 2 {
113
- .-#{$key},
114
- [class*='-#{$key}:'] {
115
- #{$prop}: var(--#{$key}) #{get_important_str($important)};
116
- }
117
- } @else if $base_type == 1 {
118
- .-#{$key} {
119
- #{$prop}: var(--#{$key}) #{get_important_str($important)};
120
- }
121
- }
122
-
123
- // utilityクラスのリストを $data から取得
124
- $utilities: map.get($data, utilities);
125
- $exUtilities: map.get($data, exUtility);
126
-
127
- // ユーティリティクラスのリストが取得できていれば出力
128
- @if $utilities {
129
- @include echoUtilities($key, $prop, $utilities, $base_type, $important);
130
- }
131
-
132
- // exUtilityが存在する場合の処理
133
- @if $exUtilities {
134
- @each $exKey, $exValue in $exUtilities {
135
- // 文字列の場合はそのまま展開
136
- @if (meta.type-of($exValue) == map) {
137
- .-#{$key}\:#{$exKey} {
138
- @each $_p, $_v in $exValue {
139
- #{$_p}: #{$_v} #{get_important_str($important)};
140
- }
141
- }
142
- }
143
- }
144
- }
145
-
146
- // BPクラスを出力するプロパティのリストを作成
147
-
148
- // $bp_support が 1 または 文字列('sm','md','lg'などかどうか)
149
- // Memo: 文字列がくるのは、ユーザーカスタマイズでプロパティ個別にサポートするブレイクポイントを変更したい時。
150
- @if $bp_support == 1 or meta.type-of($bp_support) == string {
151
- $bp_support_list: list.append($bp_support_list, $key);
152
- }
85
+ $prop: map_get_with_default($data, prop, ''); // 対応するCSSプロパティ名
86
+ $bp_support: map_get_with_default($data, bp, 0);
87
+ $isVar: map_get_with_default($data, isVar, 0);
88
+ $alwaysVar: map_get_with_default($data, alwaysVar, 0);
89
+ $important: map_get_with_default($data, important, setting.$default_important);
90
+
91
+ @if $prop == '' {
92
+ @continue;
93
+ }
94
+
95
+ // 基本的なbaseセレクタタイプ: 基本は0, BPサポートオンなら 1.
96
+ $base_type: 0;
97
+
98
+ // Memo: == 1 ではないのは、'sm' や 'md' などの指定も入ってくる可能性があるから
99
+ @if $bp_support != 0 {
100
+ $base_type: 1;
101
+ }
102
+
103
+ @if $alwaysVar == 1 {
104
+ $base_type: 2;
105
+ }
106
+
107
+ // isVar が 1 なら base_type は 0
108
+ @if $isVar == 1 {
109
+ $base_type: 0;
110
+ }
111
+
112
+ @if $base_type == 2 {
113
+ .-#{$key},
114
+ [class*='-#{$key}:'] {
115
+ #{$prop}: var(--#{$key}) #{get_important_str($important)};
116
+ }
117
+ } @else if $base_type == 1 {
118
+ .-#{$key} {
119
+ #{$prop}: var(--#{$key}) #{get_important_str($important)};
120
+ }
121
+ }
122
+
123
+ // utilityクラスのリストを $data から取得
124
+ $utilities: map.get($data, utilities);
125
+ $exUtilities: map.get($data, exUtility);
126
+
127
+ // ユーティリティクラスのリストが取得できていれば出力
128
+ @if $utilities {
129
+ @include echoUtilities($key, $prop, $utilities, $base_type, $important);
130
+ }
131
+
132
+ // exUtilityが存在する場合の処理
133
+ @if $exUtilities {
134
+ @each $exKey, $exValue in $exUtilities {
135
+ // 文字列の場合はそのまま展開
136
+ @if (meta.type-of($exValue) == map) {
137
+ .-#{$key}\:#{$exKey} {
138
+ @each $_p, $_v in $exValue {
139
+ #{$_p}: #{$_v} #{get_important_str($important)};
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ // BPクラスを出力するプロパティのリストを作成
147
+
148
+ // $bp_support が 1 または 文字列('sm','md','lg'などかどうか)
149
+ // Memo: 文字列がくるのは、ユーザーカスタマイズでプロパティ個別にサポートするブレイクポイントを変更したい時。
150
+ @if $bp_support == 1 or meta.type-of($bp_support) == string {
151
+ $bp_support_list: list.append($bp_support_list, $key);
152
+ }
153
153
  }
154
154
  // @debug $bp_support_list;
155
155
 
@@ -161,49 +161,49 @@ $bp_support_list: (); // list
161
161
  // setting.$breakpoints のキーだけを抽出したリストを取得
162
162
  $bp_names: map.keys(setting.$breakpoints);
163
163
  $bp_outputs: (
164
- 'sm': [],
165
- 'md': [],
166
- 'lg': [],
167
- 'xl': [],
164
+ 'sm': [],
165
+ 'md': [],
166
+ 'lg': [],
167
+ 'xl': [],
168
168
  );
169
169
  /* __stylelint-disable */
170
170
  // BPサポートしてるプロパティのリストをループ
171
171
  @each $key in $bp_support_list {
172
- $prop_data: map.get(setting.$props, $key);
173
- $prop_bp_data: map.get($prop_data, bp);
174
- $support_bp: setting.$common_support_bp;
175
-
176
- @if (meta.type-of($prop_bp_data) == string) {
177
- // サポートするブレイクポイントの上書き指定があればそれをセット
178
- $support_bp: $prop_bp_data;
179
- }
180
- // @else if ($prop_bp_data == 0) {
181
- // // 0 が渡されれば、BPサポートを無効にする
182
- // $output_bps: 0;
183
- // }
184
-
185
- $flag: true;
186
- $i: 1;
187
- @while $flag {
188
- $bp: list.nth($bp_names, $i);
189
-
190
- // mapから現在のリストを取得→リスト追加→更新されたリストを再びマージ
191
- $_bp_list: map.get($bp_outputs, $bp);
192
- $_bp_list: list.join($_bp_list, $key);
193
- $bp_outputs: map.merge(
194
- $bp_outputs,
195
- (
196
- $bp: $_bp_list,
197
- )
198
- );
199
-
200
- // サポートするBPまで辿り着いたら終了
201
- @if $bp == $support_bp or $i == list.length($bp_names) {
202
- $flag: false;
203
- }
204
-
205
- $i: $i + 1;
206
- }
172
+ $prop_data: map.get(setting.$props, $key);
173
+ $prop_bp_data: map.get($prop_data, bp);
174
+ $support_bp: setting.$common_support_bp;
175
+
176
+ @if (meta.type-of($prop_bp_data) == string) {
177
+ // サポートするブレイクポイントの上書き指定があればそれをセット
178
+ $support_bp: $prop_bp_data;
179
+ }
180
+ // @else if ($prop_bp_data == 0) {
181
+ // // 0 が渡されれば、BPサポートを無効にする
182
+ // $output_bps: 0;
183
+ // }
184
+
185
+ $flag: true;
186
+ $i: 1;
187
+ @while $flag {
188
+ $bp: list.nth($bp_names, $i);
189
+
190
+ // mapから現在のリストを取得→リスト追加→更新されたリストを再びマージ
191
+ $_bp_list: map.get($bp_outputs, $bp);
192
+ $_bp_list: list.join($_bp_list, $key);
193
+ $bp_outputs: map.merge(
194
+ $bp_outputs,
195
+ (
196
+ $bp: $_bp_list,
197
+ )
198
+ );
199
+
200
+ // サポートするBPまで辿り着いたら終了
201
+ @if $bp == $support_bp or $i == list.length($bp_names) {
202
+ $flag: false;
203
+ }
204
+
205
+ $i: $i + 1;
206
+ }
207
207
  }
208
208
  // @debug $bp_outputs;
209
209
 
@@ -213,26 +213,26 @@ $bp_outputs: (
213
213
  ( @containerの出力数を少なくするために出力は最後にまとめている。)
214
214
  */
215
215
  @each $bp, $data in $bp_outputs {
216
- @include query.bp-up($bp) {
217
- @each $key in $data {
218
- $prop_data: map.get(setting.$props, $key);
219
- $prop_name: map.get($prop_data, prop);
220
- $isVar: map_get_with_default($prop_data, isVar, 0);
221
- $overwriteBaseVar: map_get_with_default($prop_data, overwriteBaseVar, 0);
222
- $important: map_get_with_default($prop_data, important, setting.$default_important);
223
-
224
- @if $isVar == 1 {
225
- $important: 1;
226
- }
227
-
228
- .-#{$key}_#{$bp} {
229
- #{$prop_name}: var(--#{$key}_#{$bp}) #{get_important_str($important)};
230
-
231
- // 常に --prop でそのBPの値を取得できるように
232
- @if $overwriteBaseVar == 1 {
233
- --#{$key}: var(--#{$key}_#{$bp}) !important;
234
- }
235
- }
236
- }
237
- }
216
+ @include query.bp-up($bp) {
217
+ @each $key in $data {
218
+ $prop_data: map.get(setting.$props, $key);
219
+ $prop_name: map.get($prop_data, prop);
220
+ $isVar: map_get_with_default($prop_data, isVar, 0);
221
+ $overwriteBaseVar: map_get_with_default($prop_data, overwriteBaseVar, 0);
222
+ $important: map_get_with_default($prop_data, important, setting.$default_important);
223
+
224
+ @if $isVar == 1 {
225
+ $important: 1;
226
+ }
227
+
228
+ .-#{$key}_#{$bp} {
229
+ #{$prop_name}: var(--#{$key}_#{$bp}) #{get_important_str($important)};
230
+
231
+ // 常に --prop でそのBPの値を取得できるように
232
+ @if $overwriteBaseVar == 1 {
233
+ --#{$key}: var(--#{$key}_#{$bp}) !important;
234
+ }
235
+ }
236
+ }
237
+ }
238
238
  }