lism-css 0.9.3 → 0.10.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.
Files changed (240) 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/Box/Box.stories.d.ts +7 -0
  19. package/dist/components/Center/Center.stories.d.ts +8 -0
  20. package/dist/components/Cluster/Cluster.stories.d.ts +7 -0
  21. package/dist/components/Columns/Columns.stories.d.ts +8 -0
  22. package/dist/components/Container/Container.stories.d.ts +8 -0
  23. package/dist/components/Dummy/Dummy.d.ts +6 -9
  24. package/dist/components/Dummy/index.js +5 -10
  25. package/dist/components/Flex/Flex.stories.d.ts +9 -0
  26. package/dist/components/Flow/Flow.stories.d.ts +9 -0
  27. package/dist/components/FluidCols/FluidCols.stories.d.ts +7 -0
  28. package/dist/components/Frame/Frame.stories.d.ts +7 -0
  29. package/dist/components/Grid/Grid.stories.d.ts +8 -0
  30. package/dist/components/Group/Group.d.ts +3 -0
  31. package/dist/components/Group/index.d.ts +1 -0
  32. package/dist/components/Group/index.js +8 -0
  33. package/dist/components/HTML/HTML.d.ts +10 -0
  34. package/dist/components/Heading/Heading.d.ts +7 -0
  35. package/dist/components/Heading/index.d.ts +1 -0
  36. package/dist/components/Heading/index.js +9 -0
  37. package/dist/components/Inline/Inline.d.ts +3 -0
  38. package/dist/components/Inline/index.d.ts +1 -0
  39. package/dist/components/Inline/index.js +8 -0
  40. package/dist/components/Layer/Layer.d.ts +1 -2
  41. package/dist/components/Layer/Layer.stories.d.ts +8 -0
  42. package/dist/components/Layer/index.js +3 -4
  43. package/dist/components/Link/Link.d.ts +2 -0
  44. package/dist/components/Link/index.d.ts +1 -0
  45. package/dist/components/Link/index.js +8 -0
  46. package/dist/components/LinkBox/LinkBox.d.ts +3 -2
  47. package/dist/components/LinkBox/LinkBox.stories.d.ts +7 -0
  48. package/dist/components/LinkBox/index.js +5 -5
  49. package/dist/components/Lism/Lism.d.ts +10 -8
  50. package/dist/components/Lism/Lism.stories.d.ts +1 -650
  51. package/dist/components/List/List.d.ts +3 -0
  52. package/dist/components/List/ListItem.d.ts +3 -0
  53. package/dist/components/List/ListItem.js +8 -0
  54. package/dist/components/List/index.d.ts +2 -0
  55. package/dist/components/List/index.js +8 -0
  56. package/dist/components/SideMain/SideMain.stories.d.ts +9 -0
  57. package/dist/components/Stack/Stack.stories.d.ts +8 -0
  58. package/dist/components/SwitchCols/SwitchCols.stories.d.ts +9 -0
  59. package/dist/components/Text/Text.d.ts +3 -0
  60. package/dist/components/Text/index.d.ts +1 -0
  61. package/dist/components/Text/index.js +8 -0
  62. package/dist/components/Wrapper/Wrapper.stories.d.ts +10 -0
  63. package/dist/components/atomic/Decorator/Decorator.stories.d.ts +10 -0
  64. package/dist/components/atomic/Decorator/getProps.d.ts +5 -8
  65. package/dist/components/atomic/Decorator/getProps.js +10 -10
  66. package/dist/components/atomic/Divider/Divider.stories.d.ts +8 -0
  67. package/dist/components/atomic/Divider/getProps.d.ts +2 -2
  68. package/dist/components/atomic/Icon/Icon.d.ts +6 -2
  69. package/dist/components/atomic/Icon/Icon.stories.d.ts +15 -0
  70. package/dist/components/atomic/Icon/getProps.d.ts +11 -8
  71. package/dist/components/atomic/Icon/getProps.js +35 -34
  72. package/dist/components/atomic/Icon/index.d.ts +1 -0
  73. package/dist/components/atomic/Media/Media.d.ts +3 -2
  74. package/dist/components/atomic/Media/Media.stories.d.ts +8 -0
  75. package/dist/components/atomic/Media/index.js +4 -5
  76. package/dist/components/atomic/Spacer/Spacer.stories.d.ts +9 -0
  77. package/dist/components/atomic/Spacer/getProps.d.ts +2 -2
  78. package/dist/components/index.d.ts +8 -1
  79. package/dist/components/index.js +50 -36
  80. package/dist/config/helper.d.ts +1 -1
  81. package/dist/css/base.css +1 -1
  82. package/dist/css/main.css +1 -1
  83. package/dist/css/main_no_layer.css +1 -1
  84. package/dist/css/modules/atomic.css +1 -1
  85. package/dist/css/modules/layout.css +1 -1
  86. package/dist/lib/getLayoutProps.d.ts +4 -3
  87. package/dist/lib/getLismProps.d.ts +13 -11
  88. package/dist/lib/getLismProps.js +69 -73
  89. package/dist/lib/getMaybeCssVar.js +15 -10
  90. package/dist/lib/getMaybeTokenValue.d.ts +2 -2
  91. package/dist/lib/types/LayoutProps.d.ts +26 -26
  92. package/dist/lib/types.d.ts +2 -2
  93. package/package.json +17 -10
  94. package/packages/astro/Box/Box.astro +6 -5
  95. package/packages/astro/Center/Center.astro +7 -1
  96. package/packages/astro/Cluster/Cluster.astro +7 -1
  97. package/packages/astro/Columns/Columns.astro +7 -1
  98. package/packages/astro/Container/Container.astro +7 -3
  99. package/packages/astro/Decorator/Decorator.astro +10 -8
  100. package/packages/astro/Divider/Divider.astro +6 -6
  101. package/packages/astro/Dummy/Dummy.astro +9 -8
  102. package/packages/astro/Flex/Flex.astro +7 -1
  103. package/packages/astro/Flow/Flow.astro +8 -1
  104. package/packages/astro/FluidCols/FluidCols.astro +8 -1
  105. package/packages/astro/Frame/Frame.astro +7 -1
  106. package/packages/astro/Grid/Grid.astro +7 -1
  107. package/packages/astro/Group/Group.astro +11 -0
  108. package/packages/astro/Group/index.ts +1 -0
  109. package/packages/astro/HTML/_index_memo.js +7 -7
  110. package/packages/astro/HTML/a.astro +6 -1
  111. package/packages/astro/HTML/button.astro +6 -1
  112. package/packages/astro/HTML/div.astro +6 -1
  113. package/packages/astro/HTML/h.astro +7 -0
  114. package/packages/astro/HTML/img.astro +6 -1
  115. package/packages/astro/HTML/li.astro +6 -1
  116. package/packages/astro/HTML/ol.astro +6 -1
  117. package/packages/astro/HTML/p.astro +6 -1
  118. package/packages/astro/HTML/span.astro +6 -1
  119. package/packages/astro/HTML/ul.astro +6 -1
  120. package/packages/astro/Heading/Heading.astro +13 -0
  121. package/packages/astro/Heading/index.ts +1 -0
  122. package/packages/astro/Icon/Icon.astro +15 -17
  123. package/packages/astro/Icon/SVG.astro +16 -16
  124. package/packages/astro/Inline/Inline.astro +11 -0
  125. package/packages/astro/Inline/index.ts +1 -0
  126. package/packages/astro/Layer/Layer.astro +7 -4
  127. package/packages/astro/Link/Link.astro +10 -0
  128. package/packages/astro/Link/index.ts +1 -0
  129. package/packages/astro/LinkBox/LinkBox.astro +9 -8
  130. package/packages/astro/Lism/Lism.astro +6 -9
  131. package/packages/astro/List/List.astro +11 -0
  132. package/packages/astro/List/ListItem.astro +11 -0
  133. package/packages/astro/List/index.ts +2 -0
  134. package/packages/astro/Media/Media.astro +9 -8
  135. package/packages/astro/SideMain/SideMain.astro +8 -1
  136. package/packages/astro/Spacer/Spacer.astro +7 -6
  137. package/packages/astro/Stack/Stack.astro +7 -1
  138. package/packages/astro/SwitchCols/SwitchCols.astro +8 -1
  139. package/packages/astro/Text/Text.astro +11 -0
  140. package/packages/astro/Text/index.ts +1 -0
  141. package/packages/astro/Wrapper/Wrapper.astro +9 -1
  142. package/packages/astro/env.d.ts +10 -0
  143. package/packages/astro/{index.js → index.ts} +9 -0
  144. package/packages/astro/tsconfig.json +12 -0
  145. package/packages/astro/types.ts +19 -0
  146. package/src/scss/__memo/_lh-auto-all.scss +12 -12
  147. package/src/scss/__memo/_lh-auto-h.scss +17 -17
  148. package/src/scss/__memo/_lh-manual.scss +27 -27
  149. package/src/scss/_auto_output.scss +174 -174
  150. package/src/scss/_mixin.scss +32 -32
  151. package/src/scss/_prop-config.scss +850 -850
  152. package/src/scss/_query.scss +26 -26
  153. package/src/scss/_setting.scss +6 -6
  154. package/src/scss/_with_layer.scss +13 -13
  155. package/src/scss/base/_html.scss +47 -47
  156. package/src/scss/base/set/_bp.scss +8 -8
  157. package/src/scss/base/set/_cqUnit.scss +22 -22
  158. package/src/scss/base/set/_gutter.scss +1 -1
  159. package/src/scss/base/set/_hov.scss +10 -10
  160. package/src/scss/base/set/_innerRs.scss +1 -1
  161. package/src/scss/base/set/_plain.scss +15 -15
  162. package/src/scss/base/set/_transition.scss +2 -2
  163. package/src/scss/base/tokens/_property.scss +3 -3
  164. package/src/scss/base/tokens/_shadow.scss +12 -11
  165. package/src/scss/base/tokens/_tokens.scss +77 -77
  166. package/src/scss/base/tokens/_typography.scss +69 -69
  167. package/src/scss/main_no_layer.scss +1 -1
  168. package/src/scss/modules/atomic/_divider.scss +4 -4
  169. package/src/scss/modules/atomic/_icon.scss +4 -4
  170. package/src/scss/modules/atomic/_spacer.scss +2 -2
  171. package/src/scss/modules/atomic/index.scss +0 -1
  172. package/src/scss/modules/layout/_center.scss +3 -3
  173. package/src/scss/modules/layout/_cluster.scss +3 -3
  174. package/src/scss/modules/layout/_columns.scss +3 -3
  175. package/src/scss/modules/layout/_flex.scss +4 -4
  176. package/src/scss/modules/layout/_flow.scss +16 -16
  177. package/src/scss/modules/layout/_fluidCols.scss +4 -4
  178. package/src/scss/modules/layout/_frame.scss +8 -8
  179. package/src/scss/modules/layout/_grid.scss +9 -9
  180. package/src/scss/modules/layout/_sideMain.scss +12 -12
  181. package/src/scss/modules/layout/_stack.scss +2 -2
  182. package/src/scss/modules/layout/_switchCols.scss +5 -5
  183. package/src/scss/modules/state/_container.scss +4 -4
  184. package/src/scss/modules/state/_layer.scss +3 -3
  185. package/src/scss/modules/state/_linkbox.scss +9 -9
  186. package/src/scss/modules/state/_vertical.scss +3 -3
  187. package/src/scss/modules/state/_wrapper.scss +8 -8
  188. package/src/scss/props/_border.scss +18 -18
  189. package/src/scss/props/_hover.scss +26 -26
  190. package/src/scss/props/_lh.scss +6 -6
  191. package/src/scss/props/_size.scss +7 -7
  192. package/src/scss/reset.scss +137 -137
  193. package/src/scss/utility/_cbox.scss +10 -10
  194. package/src/scss/utility/_clipText.scss +2 -2
  195. package/src/scss/utility/_hidden.scss +9 -9
  196. package/src/scss/utility/_itemDivider.scss +7 -7
  197. package/src/scss/utility/_linkExpand.scss +9 -9
  198. package/src/scss/utility/_snap.scss +5 -5
  199. package/src/scss/utility/_trimHL.scss +11 -11
  200. package/dist/components/Dummy/getContent.d.ts +0 -13
  201. package/dist/components/Dummy/getContent.js +0 -10
  202. package/dist/components/Dummy/texts.d.ts +0 -22
  203. package/dist/components/Dummy/texts.js +0 -39
  204. package/dist/components/Layer/getProps.d.ts +0 -5
  205. package/dist/components/atomic/Media/getProps.d.ts +0 -9
  206. package/dist/components/atomic/Media/getProps.js +0 -8
  207. package/dist/components/getFilterProps.d.ts +0 -10
  208. package/dist/components/getFilterProps.js +0 -23
  209. package/dist/components/getFilterProps.test.d.ts +0 -1
  210. package/dist/components/setMaybeTransformStyles.d.ts +0 -12
  211. package/dist/components/setMaybeTransformStyles.js +0 -7
  212. package/dist/components/setMaybeTransformStyles.test.d.ts +0 -1
  213. package/packages/astro/OverlayLink/OverlayLink.astro +0 -10
  214. package/packages/astro/OverlayLink/index.js +0 -1
  215. package/packages/astro/helper.js +0 -6
  216. package/src/scss/modules/atomic/_media.scss +0 -3
  217. /package/packages/astro/Box/{index.js → index.ts} +0 -0
  218. /package/packages/astro/Center/{index.js → index.ts} +0 -0
  219. /package/packages/astro/Cluster/{index.js → index.ts} +0 -0
  220. /package/packages/astro/Columns/{index.js → index.ts} +0 -0
  221. /package/packages/astro/Container/{index.js → index.ts} +0 -0
  222. /package/packages/astro/Decorator/{index.js → index.ts} +0 -0
  223. /package/packages/astro/Divider/{index.js → index.ts} +0 -0
  224. /package/packages/astro/Dummy/{index.js → index.ts} +0 -0
  225. /package/packages/astro/Flex/{index.js → index.ts} +0 -0
  226. /package/packages/astro/Flow/{index.js → index.ts} +0 -0
  227. /package/packages/astro/FluidCols/{index.js → index.ts} +0 -0
  228. /package/packages/astro/Frame/{index.js → index.ts} +0 -0
  229. /package/packages/astro/Grid/{index.js → index.ts} +0 -0
  230. /package/packages/astro/HTML/{index.js → index.ts} +0 -0
  231. /package/packages/astro/Icon/{index.js → index.ts} +0 -0
  232. /package/packages/astro/Layer/{index.js → index.ts} +0 -0
  233. /package/packages/astro/LinkBox/{index.js → index.ts} +0 -0
  234. /package/packages/astro/Lism/{index.js → index.ts} +0 -0
  235. /package/packages/astro/Media/{index.js → index.ts} +0 -0
  236. /package/packages/astro/SideMain/{index.js → index.ts} +0 -0
  237. /package/packages/astro/Spacer/{index.js → index.ts} +0 -0
  238. /package/packages/astro/Stack/{index.js → index.ts} +0 -0
  239. /package/packages/astro/SwitchCols/{index.js → index.ts} +0 -0
  240. /package/packages/astro/Wrapper/{index.js → index.ts} +0 -0
@@ -1,15 +1,16 @@
1
1
  ---
2
- import type { LismProps } from '../../types';
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
3
4
  import { Lism } from '../Lism';
4
- // import getProps from '../../../dist/components/LinkBox/getProps';
5
5
 
6
- interface Props extends LismProps {}
7
- const props = Astro.props || {};
6
+ type Props<Tag extends HTMLTag = 'a'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
+
8
+ const { as, exProps, ...props } = Astro.props;
8
9
 
9
10
  const hasHref = !!props.href;
10
- const tag = hasHref ? 'a' : 'div';
11
+ // LinkBoxは基本的にリンク要素(aタグ)として機能するため、
12
+ // hrefがないかつ、aタグとしてレンダリングする場合はdivタグに置き換える
13
+ const tag: HTMLTag = !hasHref && (as ?? 'a') === 'a' ? 'div' : (as ?? 'a');
11
14
  ---
12
15
 
13
- <Lism isLinkBox as={tag} {...props}>
14
- <slot />
15
- </Lism>
16
+ <Lism isLinkBox as={tag} {...props} {...exProps}><slot /></Lism>
@@ -1,14 +1,11 @@
1
1
  ---
2
- import type { LismProps } from '../../types';
3
- import getLismProps from '../../../dist/lib/getLismProps';
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
4
+ import getLismProps from 'lism-css/lib/getLismProps';
4
5
 
5
- // Propsの定義
6
- interface Props extends LismProps {}
6
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
7
 
8
- const { as, exProps, ...props } = Astro.props || {};
9
- const JSX = as || 'div';
8
+ const { as: Tag = 'div', exProps, ...props } = Astro.props;
10
9
  ---
11
10
 
12
- <JSX {...getLismProps(props)} {...exProps}>
13
- <slot />
14
- </JSX>
11
+ <Tag {...getLismProps(props)} {...exProps}><slot /></Tag>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
4
+ import Lism from '../Lism/Lism.astro';
5
+
6
+ type Props<Tag extends HTMLTag = 'ul'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
+
8
+ const { as: Tag = 'ul', ...props } = Astro.props;
9
+ ---
10
+
11
+ <Lism as={Tag} {...props}><slot /></Lism>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
4
+ import Lism from '../Lism/Lism.astro';
5
+
6
+ type Props<Tag extends HTMLTag = 'li'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
+
8
+ const { as: Tag = 'li', ...props } = Astro.props;
9
+ ---
10
+
11
+ <Lism as={Tag} {...props}><slot /></Lism>
@@ -0,0 +1,2 @@
1
+ export { default as List } from './List.astro';
2
+ export { default as ListItem } from './ListItem.astro';
@@ -1,16 +1,17 @@
1
1
  ---
2
- import getLismProps from '../../../dist/lib/getLismProps';
3
- import getMediaProps from '../../../dist/components/atomic/Media/getProps';
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
4
+ import getLismProps from 'lism-css/lib/getLismProps';
4
5
  import { Image } from 'astro:assets';
5
6
 
6
- const { as, exProps, ...props } = Astro.props || {};
7
+ type Props<Tag extends HTMLTag = 'img'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
8
 
8
- let JSX = as || 'img';
9
+ const { as, exProps, ...props } = Astro.props;
10
+
11
+ let JSX: any = as || 'img';
9
12
  if (JSX === 'AstroImage') {
10
- JSX = Image;
13
+ JSX = Image;
11
14
  }
12
15
  ---
13
16
 
14
- <JSX {...getLismProps(getMediaProps(props))} {...exProps}>
15
- <slot />
16
- </JSX>
17
+ <JSX {...getLismProps(props)} {...exProps}><slot /></JSX>
@@ -1,5 +1,12 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismFixedLayoutProps } from '../types';
4
+ import type { SideMainProps } from 'lism-css/lib/types/LayoutProps';
2
5
  import { Lism } from '../Lism';
6
+
7
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<SideMainProps, 'layout'>;
8
+
9
+ const props = Astro.props;
3
10
  ---
4
11
 
5
- <Lism layout='sideMain' {...Astro.props}><slot /></Lism>
12
+ <Lism layout="sideMain" {...props}><slot /></Lism>
@@ -1,11 +1,12 @@
1
1
  ---
2
- import type { LismProps } from '../../types';
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
3
4
  import { Lism } from '../Lism';
4
- import getProps from '../../../dist/components/atomic/Spacer/getProps';
5
+ import getProps from 'lism-css/react/atomic/Spacer/getProps';
5
6
 
6
- // Propsの定義
7
- interface Props extends LismProps {}
8
- const props = Astro.props || {};
7
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
8
+
9
+ const { as: Tag = 'div', exProps, ...props } = Astro.props;
9
10
  ---
10
11
 
11
- <Lism {...getProps(props)} />
12
+ <Lism as={Tag} {...getProps(props)} {...exProps} />
@@ -1,5 +1,11 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismFixedLayoutProps } from '../types';
2
4
  import { Lism } from '../Lism';
5
+
6
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
+
8
+ const props = Astro.props;
3
9
  ---
4
10
 
5
- <Lism layout='stack' {...Astro.props}><slot /></Lism>
11
+ <Lism layout="stack" {...props}><slot /></Lism>
@@ -1,5 +1,12 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismFixedLayoutProps } from '../types';
4
+ import type { SwitchColsProps } from 'lism-css/lib/types/LayoutProps';
2
5
  import { Lism } from '../Lism';
6
+
7
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<SwitchColsProps, 'layout'>;
8
+
9
+ const props = Astro.props;
3
10
  ---
4
11
 
5
- <Lism layout='switchCols' {...Astro.props}><slot /></Lism>
12
+ <Lism layout="switchCols" {...props}><slot /></Lism>
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
4
+ import Lism from '../Lism/Lism.astro';
5
+
6
+ type Props<Tag extends HTMLTag = 'p'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
+
8
+ const { as: Tag = 'p', ...props } = Astro.props;
9
+ ---
10
+
11
+ <Lism as={Tag} {...props}><slot /></Lism>
@@ -0,0 +1 @@
1
+ export { default as Text } from './Text.astro';
@@ -1,7 +1,15 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismBaseProps } from '../types';
4
+ import type { LismProps } from 'lism-css/lib/getLismProps';
2
5
  import { Lism } from '../Lism';
3
6
 
4
- const { contentSize = true, ...props } = Astro.props || {};
7
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> &
8
+ AstroLismBaseProps & {
9
+ contentSize?: LismProps['isWrapper'];
10
+ };
11
+
12
+ const { contentSize = true, ...props } = Astro.props;
5
13
  ---
6
14
 
7
15
  <Lism isWrapper={contentSize} {...props}><slot /></Lism>
@@ -0,0 +1,10 @@
1
+ /// <reference types="astro/client" />
2
+
3
+ declare module '*.astro' {
4
+ const component: (props: Record<string, unknown>) => unknown;
5
+ export default component;
6
+ }
7
+
8
+ declare module 'astro:assets' {
9
+ export const Image: typeof import('astro/components/Image.astro').default;
10
+ }
@@ -4,7 +4,16 @@
4
4
 
5
5
  export * from './Lism';
6
6
  export { default as HTML } from './HTML';
7
+ /** @deprecated DummyText / DummyImage (@lism-css/ui) を使用してください */
7
8
  export * from './Dummy';
9
+
10
+ // semantic wrappers
11
+ export * from './Text';
12
+ export * from './Inline';
13
+ export * from './Group';
14
+ export * from './Heading';
15
+ export * from './Link';
16
+ export * from './List';
8
17
  export * from './Box';
9
18
  export * from './Flow';
10
19
  export * from './Flex';
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "astro/tsconfigs/strict",
3
+ "compilerOptions": {
4
+ "allowJs": true,
5
+ "checkJs": false,
6
+ "moduleResolution": "bundler",
7
+ "esModuleInterop": true,
8
+ "resolveJsonModule": true,
9
+ "skipLibCheck": true
10
+ },
11
+ "include": ["./**/*.astro", "./**/*.ts"]
12
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Astro 用の Lism Props 型
3
+ *
4
+ * @see https://github.com/withastro/roadmap/discussions/601
5
+ * @see https://github.com/withastro/roadmap/discussions/398
6
+ */
7
+ import type { LismProps } from 'lism-css/lib/getLismProps';
8
+ import type { LayoutSpecificProps } from 'lism-css/lib/types/LayoutProps';
9
+
10
+ /** Polymorphic 型と組み合わせて使う共通ベース型 */
11
+ export type AstroLismBaseProps = LismProps &
12
+ LayoutSpecificProps & {
13
+ exProps?: Record<string, unknown>;
14
+ };
15
+
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
  }