lism-css 0.3.5 → 0.5.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 (244) hide show
  1. package/README.md +2 -2
  2. package/bin/build-config.js +157 -0
  3. package/bin/build-css.cjs +92 -0
  4. package/bin/build-css.js +90 -0
  5. package/bin/cli.mjs +69 -0
  6. package/bin/script-build-css.js +6 -0
  7. package/config/__prop_list.js +44 -0
  8. package/config/__props.scss +25 -0
  9. package/config/default-config.js +9 -0
  10. package/config/defaults/__props-memo.js +45 -0
  11. package/config/defaults/props.js +370 -0
  12. package/config/defaults/states.js +42 -0
  13. package/config/defaults/tokens.js +26 -0
  14. package/config/helper/getSvgUrl.js +28 -0
  15. package/config/helper/minifyHtml.js +22 -0
  16. package/config/helper.js +67 -0
  17. package/config/index.js +15 -0
  18. package/config.js +2 -0
  19. package/dist/components/Accordion/AccIcon.js +1 -1
  20. package/dist/components/Accordion/getProps.js +15 -17
  21. package/dist/components/Accordion/index.js +4 -4
  22. package/dist/components/Accordion/index2.js +28 -23
  23. package/dist/components/Accordion/setAccordion.js +11 -11
  24. package/dist/components/Box/index.js +5 -6
  25. package/dist/components/Center/index.js +2 -2
  26. package/dist/components/Cluster/index.js +8 -0
  27. package/dist/components/Columns/index.js +5 -6
  28. package/dist/components/Container/index.js +3 -3
  29. package/dist/components/Dummy/index.js +9 -14
  30. package/dist/components/Dummy/texts.js +6 -6
  31. package/dist/components/Flex/index.js +5 -6
  32. package/dist/components/Flow/index.js +8 -0
  33. package/dist/components/Frame/index.js +5 -6
  34. package/dist/components/Grid/index.js +5 -6
  35. package/dist/components/HTML/index.js +5 -0
  36. package/dist/components/HTML/index2.js +44 -0
  37. package/dist/components/Layer/index.js +5 -5
  38. package/dist/components/LinkBox/index.js +6 -6
  39. package/dist/components/Lism/Link.js +5 -5
  40. package/dist/components/Lism/Text.js +4 -4
  41. package/dist/components/Lism/index.js +5 -4
  42. package/dist/components/Modal/Body.js +5 -5
  43. package/dist/components/Modal/CloseBtn.js +13 -0
  44. package/dist/components/Modal/Inner.js +5 -5
  45. package/dist/components/Modal/OpenBtn.js +9 -0
  46. package/dist/components/Modal/getProps.js +12 -13
  47. package/dist/components/Modal/index.js +4 -5
  48. package/dist/components/Modal/index2.js +12 -12
  49. package/dist/components/Stack/index.js +5 -5
  50. package/dist/components/Tabs/Tab.js +7 -9
  51. package/dist/components/Tabs/TabList.js +4 -4
  52. package/dist/components/Tabs/TabPanel.js +6 -7
  53. package/dist/components/Tabs/getProps.js +1 -8
  54. package/dist/components/Tabs/index2.js +14 -23
  55. package/dist/components/WithSide/index.js +4 -5
  56. package/dist/components/atomic/Decorator/getProps.js +13 -0
  57. package/dist/components/{Decorator → atomic/Decorator}/index.js +1 -1
  58. package/dist/components/atomic/Divider/getProps.js +10 -0
  59. package/dist/components/atomic/Divider/index.js +9 -0
  60. package/dist/components/atomic/Icon/getProps.js +59 -0
  61. package/dist/components/{Icon → atomic/Icon}/index.js +1 -1
  62. package/dist/components/atomic/Media/getProps.js +9 -0
  63. package/dist/components/atomic/Media/index.js +9 -0
  64. package/dist/components/atomic/Spacer/getProps.js +21 -0
  65. package/dist/components/atomic/Spacer/index.js +9 -0
  66. package/dist/components/getFilterProps.js +8 -18
  67. package/dist/components/getLayoutProps.js +27 -0
  68. package/dist/config/default-config.js +11 -0
  69. package/dist/config/defaults/props.js +342 -0
  70. package/dist/config/defaults/states.js +36 -0
  71. package/dist/config/defaults/tokens.js +29 -0
  72. package/dist/config/helper/getSvgUrl.js +4 -0
  73. package/dist/config/helper.js +31 -0
  74. package/dist/config/index.js +11 -0
  75. package/dist/index.js +50 -50
  76. package/dist/lib/getBpData.js +1 -1
  77. package/dist/lib/getLismProps.js +109 -177
  78. package/dist/lib/getMaybeCssVar.js +30 -54
  79. package/dist/lib/getMaybeTokenValue.js +26 -0
  80. package/dist/lib/getUtilKey.js +13 -0
  81. package/dist/lib/isPresetValue.js +3 -3
  82. package/dist/lib/isTokenValue.js +6 -5
  83. package/package.json +16 -3
  84. package/packages/astro/Accordion/AccBody.astro +5 -6
  85. package/packages/astro/Accordion/AccHeader.astro +4 -4
  86. package/packages/astro/Accordion/AccHeaderLabel.astro +12 -0
  87. package/packages/astro/Accordion/AccIcon.astro +1 -1
  88. package/packages/astro/Accordion/AccLabel.astro +1 -1
  89. package/packages/astro/Accordion/Accordion.astro +1 -1
  90. package/packages/astro/Accordion/index.js +2 -1
  91. package/packages/astro/Box/Box.astro +2 -3
  92. package/packages/astro/Center/Center.astro +2 -8
  93. package/packages/astro/Cluster/Cluster.astro +5 -0
  94. package/packages/astro/Cluster/index.js +1 -0
  95. package/packages/astro/Columns/Columns.astro +2 -8
  96. package/packages/astro/Container/Container.astro +3 -4
  97. package/packages/astro/Decorator/Decorator.astro +2 -2
  98. package/packages/astro/Divider/Divider.astro +3 -3
  99. package/packages/astro/Dummy/Dummy.astro +3 -2
  100. package/packages/astro/Flex/Flex.astro +1 -10
  101. package/packages/astro/Flex/index.js +0 -1
  102. package/packages/astro/Flow/Flow.astro +5 -0
  103. package/packages/astro/Flow/index.js +1 -0
  104. package/packages/astro/Frame/Frame.astro +1 -8
  105. package/packages/astro/Grid/Grid.astro +1 -9
  106. package/packages/astro/Grid/index.js +0 -1
  107. package/packages/astro/HTML/a.astro +5 -0
  108. package/packages/astro/HTML/button.astro +5 -0
  109. package/packages/astro/HTML/div.astro +5 -0
  110. package/packages/astro/HTML/h.astro +6 -0
  111. package/packages/astro/HTML/img.astro +5 -0
  112. package/packages/astro/HTML/index.js +12 -0
  113. package/packages/astro/HTML/li.astro +5 -0
  114. package/packages/astro/HTML/ol.astro +5 -0
  115. package/packages/astro/HTML/p.astro +5 -0
  116. package/packages/astro/HTML/span.astro +5 -0
  117. package/packages/astro/HTML/ul.astro +5 -0
  118. package/packages/astro/Icon/Icon.astro +3 -5
  119. package/packages/astro/Layer/Layer.astro +3 -10
  120. package/packages/astro/LinkBox/LinkBox.astro +4 -5
  121. package/packages/astro/Lism/Link.astro +2 -2
  122. package/packages/astro/Lism/Lism.astro +4 -3
  123. package/packages/astro/Lism/Text.astro +2 -2
  124. package/packages/astro/Lism/index.js +0 -1
  125. package/packages/astro/{Lism → Media}/Media.astro +1 -9
  126. package/packages/astro/Media/index.js +1 -0
  127. package/packages/astro/Modal/Body.astro +4 -5
  128. package/packages/astro/Modal/CloseBtn.astro +24 -0
  129. package/packages/astro/Modal/Inner.astro +4 -4
  130. package/packages/astro/Modal/Modal.astro +4 -5
  131. package/packages/astro/Modal/OpenBtn.astro +14 -0
  132. package/packages/astro/Modal/index.js +3 -4
  133. package/packages/astro/OverlayLink/OverlayLink.astro +1 -1
  134. package/packages/astro/Spacer/Spacer.astro +3 -3
  135. package/packages/astro/Stack/Stack.astro +2 -4
  136. package/packages/astro/Tabs/Tab.astro +2 -11
  137. package/packages/astro/Tabs/TabList.astro +4 -4
  138. package/packages/astro/Tabs/TabPanel.astro +1 -1
  139. package/packages/astro/Tabs/Tabs.astro +6 -10
  140. package/packages/astro/Test/Test.astro +1 -1
  141. package/packages/astro/Test/TestItem.astro +1 -1
  142. package/packages/astro/WithSide/WithSide.astro +1 -8
  143. package/packages/astro/index.js +6 -2
  144. package/packages/types/index.d.ts +22 -26
  145. package/src/scss/{_props.scss → __props copy.scss } +146 -169
  146. package/src/scss/__props.scss +786 -0
  147. package/src/scss/_auto_output.scss +102 -76
  148. package/src/scss/_prop-config.scss +862 -0
  149. package/src/scss/_setting.scss +2 -3
  150. package/src/scss/_with_layer.scss +19 -14
  151. package/src/scss/base/_dom.scss +35 -26
  152. package/src/scss/base/_property.scss +4 -16
  153. package/src/scss/base/_tokens.scss +105 -116
  154. package/src/scss/base/index.scss +18 -42
  155. package/src/scss/base/set/_hover.scss +13 -0
  156. package/src/scss/base/set/_innerRs.scss +3 -0
  157. package/src/scss/base/set/_mask.scss +6 -0
  158. package/src/scss/base/set/_plain.scss +14 -0
  159. package/src/scss/base/set/_shadow.scss +27 -0
  160. package/src/scss/base/set/_snap.scss +8 -0
  161. package/src/scss/base/set/_transition.scss +20 -0
  162. package/src/scss/main.scss +0 -1
  163. package/src/scss/main_no_layer.scss +6 -14
  164. package/src/scss/modules/atomic/_divider.scss +6 -0
  165. package/src/scss/{layout → modules/atomic}/_icon.scss +3 -9
  166. package/src/scss/modules/atomic/_media.scss +3 -0
  167. package/src/scss/{layout → modules/atomic}/_spacer.scss +1 -1
  168. package/src/scss/modules/atomic/index.scss +6 -0
  169. package/src/scss/{dynamic → modules/dynamic}/_accordion.scss +24 -24
  170. package/src/scss/modules/dynamic/_modal.scss +33 -0
  171. package/src/scss/{dynamic → modules/dynamic}/_tabs.scss +4 -5
  172. package/src/scss/{layout/_flex.scss → modules/layout/_cluster.scss} +1 -4
  173. package/src/scss/modules/layout/_columns.scss +9 -0
  174. package/src/scss/modules/layout/_flex.scss +3 -0
  175. package/src/scss/modules/layout/_flow.scss +46 -0
  176. package/src/scss/{layout → modules/layout}/_frame.scss +1 -1
  177. package/src/scss/modules/layout/_grid.scss +35 -0
  178. package/src/scss/{layout → modules/layout}/_withSide.scss +3 -3
  179. package/src/scss/{layout → modules/layout}/index.scss +4 -6
  180. package/src/scss/modules/state/_container.scss +37 -0
  181. package/src/scss/{state → modules/state}/_linkbox.scss +1 -1
  182. package/src/scss/modules/state/index.scss +5 -0
  183. package/src/scss/props/_border.scss +25 -40
  184. package/src/scss/props/_hover.scss +12 -23
  185. package/src/scss/props/_size.scss +17 -0
  186. package/src/scss/props/index.scss +1 -2
  187. package/src/scss/reset.scss +1 -1
  188. package/src/scss/utility/_cbox.scss +5 -4
  189. package/src/scss/utility/_hidden.scss +14 -0
  190. package/src/scss/utility/_itemDivider.scss +11 -0
  191. package/src/scss/utility/_linkExpand.scss +10 -0
  192. package/src/scss/utility/_trimHL.scss +29 -13
  193. package/src/scss/utility/index.scss +3 -45
  194. package/dist/components/Box/getProps.js +0 -7
  195. package/dist/components/Columns/getProps.js +0 -6
  196. package/dist/components/Decorator/getProps.js +0 -17
  197. package/dist/components/Divider/getProps.js +0 -11
  198. package/dist/components/Divider/index.js +0 -9
  199. package/dist/components/Flex/Cluster.js +0 -8
  200. package/dist/components/Flex/FlexItem.js +0 -8
  201. package/dist/components/Flex/getProps.js +0 -13
  202. package/dist/components/Frame/getProps.js +0 -7
  203. package/dist/components/Grid/GridItem.js +0 -9
  204. package/dist/components/Grid/getProps.js +0 -28
  205. package/dist/components/Icon/getProps.js +0 -60
  206. package/dist/components/Layer/getProps.js +0 -9
  207. package/dist/components/Lism/Media.js +0 -9
  208. package/dist/components/Modal/CloseIconBtn.js +0 -19
  209. package/dist/components/Modal/Footer.js +0 -9
  210. package/dist/components/Modal/Header.js +0 -9
  211. package/dist/components/Spacer/getProps.js +0 -21
  212. package/dist/components/Spacer/index.js +0 -9
  213. package/dist/components/WithSide/getProps.js +0 -14
  214. package/dist/components/getInsetProps.js +0 -8
  215. package/dist/components/getMediaProps.js +0 -7
  216. package/dist/components/getTransformProps.js +0 -8
  217. package/dist/config/prop_list.js +0 -386
  218. package/dist/config/tokens.js +0 -43
  219. package/dist/config.js +0 -9
  220. package/dist/lib/getMaybeUtilValue.js +0 -6
  221. package/packages/astro/Flex/Cluster.astro +0 -11
  222. package/packages/astro/Grid/GridItem.astro +0 -14
  223. package/packages/astro/Modal/CloseIconBtn.astro +0 -24
  224. package/packages/astro/Modal/Footer.astro +0 -14
  225. package/packages/astro/Modal/Header.astro +0 -14
  226. package/src/scss/dynamic/_modal.scss +0 -30
  227. package/src/scss/layout/_columns.scss +0 -13
  228. package/src/scss/layout/_divider.scss +0 -3
  229. package/src/scss/layout/_grid.scss +0 -9
  230. package/src/scss/props/__memo.scss +0 -15
  231. package/src/scss/props/_color.scss +0 -7
  232. package/src/scss/props/_transition.scss +0 -20
  233. package/src/scss/state/_container.scss +0 -34
  234. package/src/scss/state/_flow.scss +0 -45
  235. package/src/scss/state/_size.scss +0 -22
  236. package/src/scss/state/index.scss +0 -12
  237. /package/dist/components/{Icon → atomic/Icon}/SVG.js +0 -0
  238. /package/dist/components/{Icon → atomic/Icon}/presets.js +0 -0
  239. /package/packages/astro/{helper/index.js → helper.js} +0 -0
  240. /package/src/scss/{dynamic → modules/dynamic}/index.scss +0 -0
  241. /package/src/scss/{layout → modules/layout}/_center.scss +0 -0
  242. /package/src/scss/{layout → modules/layout}/_stack.scss +0 -0
  243. /package/src/scss/{state → modules/state}/_gutter.scss +0 -0
  244. /package/src/scss/{state → modules/state}/_layer.scss +0 -0
@@ -1,103 +1,68 @@
1
- var _ = Object.defineProperty;
2
- var w = (o, t, s) => t in o ? _(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
3
- var y = (o, t, s) => w(o, typeof t != "symbol" ? t + "" : t, s);
4
- import C, { CONTEXT_PROPS as E } from "../config/prop_list.js";
5
- import z from "./isPresetValue.js";
6
- import g from "./isTokenValue.js";
7
- import x from "./getMaybeUtilValue.js";
8
- import u from "./getMaybeCssVar.js";
9
- import k from "./getBpData.js";
10
- import U from "./helper/atts.js";
11
- import A from "./helper/isEmptyObj.js";
12
- import O from "./helper/filterEmptyObj.js";
13
- import S from "./helper/splitWithComma.js";
14
- const j = (o) => {
15
- const t = C[o];
16
- if (!t) return null;
17
- const { converter: s } = t;
18
- return s || null;
19
- }, V = Object.keys(C), B = Object.keys(E);
20
- class K {
1
+ var E = Object.defineProperty;
2
+ var A = (r, t, s) => t in r ? E(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
3
+ var d = (r, t, s) => A(r, typeof t != "symbol" ? t + "" : t, s);
4
+ import { STATES as U, PROPS as P } from "../config/index.js";
5
+ import g from "./isPresetValue.js";
6
+ import V from "./isTokenValue.js";
7
+ import O from "./getUtilKey.js";
8
+ import S from "./getMaybeCssVar.js";
9
+ import _ from "./getBpData.js";
10
+ import b from "./helper/atts.js";
11
+ import x from "./helper/isEmptyObj.js";
12
+ import j from "./helper/filterEmptyObj.js";
13
+ import k from "./helper/splitWithComma.js";
14
+ const z = (r) => {
15
+ const t = P[r];
16
+ return t && (t == null ? void 0 : t.token) || "";
17
+ };
18
+ class w {
21
19
  constructor(t) {
22
20
  // propList = {};
23
- y(this, "className", "");
24
- y(this, "uClasses", []);
25
- // props解析処理で追加される
26
- y(this, "attrs", {});
27
- y(this, "styles", {});
28
- const {
29
- forwardedRef: s,
30
- class: i,
31
- className: e,
32
- lismClass: l,
33
- lismState: r = [],
34
- variant: f,
35
- passVars: c,
36
- // lismVar,
37
- style: n = {},
38
- _propConfig: h = {},
39
- // hasBd,
40
- ...d
41
- } = t;
42
- this.lismClass = l || "", this.lismState = structuredClone(r), this.styles = structuredClone(n), this._propConfig = structuredClone(h);
43
- let a = this.getStateProps(d);
44
- if (f && l) {
45
- const $ = l.split(" "), b = $[0], m = f.split(",").map((P) => P.trim()).filter(Boolean).map((P) => `${b}-${P}`);
46
- this.lismClass = [b, ...m, ...$.slice(1)].join(" ");
21
+ d(this, "className", "");
22
+ d(this, "uClasses", []);
23
+ d(this, "lismState", []);
24
+ d(this, "styles", {});
25
+ d(this, "attrs", {});
26
+ const { forwardedRef: s, class: i, className: l, lismClass: a, layout: e, variant: h, style: f = {}, _propConfig: m = {}, ...o } = t;
27
+ this.styles = { ...f }, this._propConfig = { ...m };
28
+ let n = a || "";
29
+ if (h && a) {
30
+ const u = a.split(" "), y = u[0], $ = `${y}--${h}`;
31
+ n = [y, $, ...u.slice(1)].join(" ");
47
32
  }
48
- this.className = U(this.lismClass, this.lismState, i, e), A(a) || (this.attrs = a, this.analyzeProps(a)), s && (this.attrs.ref = s), c != null && typeof c == "object" && this.setPassProps(c);
33
+ typeof e == "string" && e && (n = b(n, `l--${e}`)), x(o) || (this.attrs = { ...o }, this.analyzeProps()), s && (this.attrs.ref = s), this.className = b(l || i, n, this.lismState, this.uClasses);
49
34
  }
50
- // 特定の条件下で受け取るpropの処理
51
- setContextProps(t, s) {
52
- const i = E[t];
53
- i && Object.keys(s).forEach((e) => {
54
- const l = i[e];
55
- if (l) {
56
- const r = s[e];
57
- this.analyzeProp(e, r, l);
58
- } else t === "css" && this.addStyle(e, s[e]);
59
- });
35
+ analyzeState(t, s) {
36
+ const { className: i, preset: l, presetClass: a, customVar: e, tokenKey: h, setStyles: f } = t;
37
+ s === !0 ? this.lismState.push(i) : l && g(l, s) ? this.lismState.push(`${i} ${a}:${s}`) : s && (this.lismState.push(i), h ? this.addStyle(e, S(s, h)) : f && this.addStyles(f(s)));
60
38
  }
61
39
  // prop解析
62
- analyzeProps(t) {
63
- Object.keys(t).forEach((i) => {
64
- if (i === "hov") {
65
- const r = this.extractProp(i);
66
- this.setHoverProps(r);
67
- return;
68
- }
69
- if (i === "bd") {
70
- const r = this.extractProp(i);
71
- this.setBdProps(r);
72
- return;
73
- }
74
- if (V.includes(i)) {
75
- const r = this.attrs[i];
76
- delete this.attrs[i], this.analyzeProp(i, r);
77
- return;
78
- }
79
- if (B.includes(i)) {
80
- const r = this.attrs[i];
81
- delete this.attrs[i], this.setContextProps(i, r);
82
- return;
40
+ analyzeProps() {
41
+ Object.keys(this.attrs).forEach((t) => {
42
+ if (Object.hasOwn(U, t)) {
43
+ const s = this.extractProp(t), i = U[t];
44
+ typeof i == "string" ? s && this.lismState.push(i) : this.analyzeState(i, s);
45
+ } else if (Object.hasOwn(P, t)) {
46
+ const s = this.attrs[t];
47
+ delete this.attrs[t], this.analyzeLismProp(t, s);
48
+ } else if (t === "hov") {
49
+ const s = this.extractProp(t);
50
+ this.setHovProps(s);
51
+ } else if (t === "css") {
52
+ const s = this.extractProp("css");
53
+ this.addStyles(s);
83
54
  }
84
55
  });
85
56
  }
86
- // prop解析
87
- analyzeProp(t, s, i) {
88
- if (s == null || (i = i || C[t] || null, i === null)) return;
57
+ // Lism Prop 解析
58
+ analyzeLismProp(t, s) {
59
+ if (s == null) return;
60
+ let i = P[t] || null;
61
+ if (i === null) return;
89
62
  this._propConfig[t] && (i = Object.assign({}, i, this._propConfig[t]));
90
- const { name: e, objProcessor: l, ...r } = i, { base: f, ...c } = k(s);
91
- if (s = f, s != null && typeof s == "object") {
92
- if (!l) return;
93
- Object.keys(s).forEach((n) => {
94
- const { prop: h, context: d } = l(n);
95
- d ? this.setContextProps(t, { [h]: s[n] }) : this.analyzeProp(h, s[n]);
96
- });
97
- } else
98
- this.setAttrs(e || t, s, r);
99
- Object.keys(c).forEach((n) => {
100
- this.setAttrs(e || t, c[n], r, n);
63
+ const { base: l, ...a } = _(s);
64
+ this.setAttrs(t, l, i), Object.keys(a).forEach((e) => {
65
+ this.setAttrs(t, a[e], i, e);
101
66
  });
102
67
  }
103
68
  addUtil(t) {
@@ -130,114 +95,81 @@ class K {
130
95
  }
131
96
  // utilクラスを追加するか、styleにセットするかの分岐処理 @base
132
97
  // 値が null, undefined, '', false の時はスキップ
133
- setAttrs(t, s, i = {}, e) {
98
+ setAttrs(t, s, i = {}, l = "") {
134
99
  if (s == null || s === "" || s === !1) return;
135
- let l = `--${t}`, r = `-${i.utilKey || t}`;
136
- if (e && (l = `--${t}_${e}`, r += `_${e}`), typeof s == "string" && s.startsWith("u:")) {
137
- this.addUtil(`${r}:${s.replace("u:", "")}`);
100
+ let a = `--${t}`, e = `-${i.utilKey || t}`;
101
+ if (l && (a = `--${t}_${l}`, e += `_${l}`), typeof s == "string" && s.startsWith(":")) {
102
+ this.addUtil(`${e}:${s.replace(":", "")}`);
138
103
  return;
139
104
  }
140
- if (!e) {
141
- let { presets: h, utils: d } = i;
142
- if (h && (h === 1 && (h = t), z(h, s))) {
143
- this.addUtil(`${r}:${s}`);
105
+ if (!l) {
106
+ const { presets: u, tokenClass: y, utils: $, shorthands: C } = i;
107
+ if (u && g(u, s)) {
108
+ this.addUtil(`${e}:${s}`);
109
+ return;
110
+ }
111
+ if (y && V(i.token, s)) {
112
+ this.addUtil(`${e}:${s}`);
144
113
  return;
145
114
  }
146
- if (d) {
147
- d === 1 && (d = t);
148
- const a = x(d, s);
149
- if (a) {
150
- this.addUtil(`${r}:${a}`);
151
- return;
152
- }
115
+ let c = "";
116
+ if ($ && (c = O($, s)), !c && C && (c = O(C, s, !0)), c) {
117
+ this.addUtil(`${e}:${c}`);
118
+ return;
153
119
  }
154
120
  }
155
- let { style: f, isVar: c, converter: n } = i;
156
121
  if (s === !0 || s === "-") {
157
- this.addUtil(r);
158
- return;
159
- }
160
- if ((t === "bgc" || t === "c" || t === "bdc") && typeof s == "string" && s.endsWith("%")) {
161
- this.setMixColor(t, s);
162
- return;
163
- }
164
- if (n && (s = u(s, n, t)), c && (f = `--${t}`), !e && f) {
165
- this.addStyle(f, s);
122
+ this.addUtil(e);
166
123
  return;
167
124
  }
168
- this.addUtil(r), this.addStyle(l, s);
169
- }
170
- setMixColor(t, s) {
171
- const i = s.split(":");
172
- if (i.length === 3) {
173
- const [e, l, r] = i;
174
- this.addStyle(`--_${t}1`, u(e, "color", t)), this.addStyle(`--_${t}2`, u(l, "color", t)), this.addStyle(`--_mixpct-${t}`, r);
175
- } else if (i.length === 2) {
176
- const [e, l] = i;
177
- this.addStyle(`--_${t}1`, u(e, "color", t)), this.addStyle(`--_mixpct-${t}`, l);
125
+ let { prop: h, isVar: f, alwaysVar: m, token: o, bp: n } = i;
126
+ if (o && (s = S(s, o)), !l) {
127
+ if (f) {
128
+ this.addStyle(`--${t}`, s);
129
+ return;
130
+ } else if (!n && !m) {
131
+ this.addStyle(h, s);
132
+ return;
133
+ }
178
134
  }
179
- this.addUtil(`-${t}:mix`);
180
- }
181
- setPassProps(t) {
182
- Object.keys(t).forEach((s) => {
183
- let i = t[s];
184
- if (i === null) return;
185
- const e = j(s);
186
- e && (i = u(i, e, s)), this.addStyle(`--pass_${s}`, i);
187
- });
188
- }
189
- setHoverProps(t) {
190
- t && (t === "-" || t === !0 ? this.addUtil("-hov") : typeof t == "string" ? S(t).forEach((s) => {
135
+ this.addUtil(e), this.addStyle(a, s);
136
+ }
137
+ // setPassProps(passVars) {
138
+ // let dataList = [];
139
+ // Object.keys(passVars).forEach((propName) => {
140
+ // // プロバイダーリストに追加
141
+ // dataList.push(propName);
142
+ // // 渡す値
143
+ // let value = passVars[propName];
144
+ // if (null === value) return;
145
+ // // トークン値であれば変換
146
+ // value = getMaybeCssVar(value, getTokenKey(propName));
147
+ // this.addStyle(`--pass_${propName}`, value);
148
+ // });
149
+ // }
150
+ setHovProps(t) {
151
+ t && (t === "-" || t === !0 ? this.addUtil("-hov") : typeof t == "string" ? k(t).forEach((s) => {
191
152
  this.addUtil(`-hov:${s}`);
192
153
  }) : typeof t == "object" && Object.keys(t).forEach((s) => {
193
154
  let i = t[s];
194
- if (!(i == null || i === "" || i === !1))
195
- if (i === "-" || i === !0)
196
- this.addUtil(`-hov:${s}`);
197
- else if (s === "class")
198
- S(i).forEach((e) => {
199
- this.addUtil(`-hov:${e}`);
200
- });
201
- else {
202
- const e = j(s);
203
- e && (i = u(i, e, s)), this.addUtil(`-hov:${s}`), this.addStyle(`--hov-${s}`, i);
204
- }
155
+ i == null || i === "" || i === !1 || (i === "-" || i === !0 ? this.addUtil(`-hov:${s}`) : s === "class" ? k(i).forEach((l) => {
156
+ this.addUtil(`-hov:${l}`);
157
+ }) : (i = S(i, z(s)), this.addUtil(`-hov:${s}`), this.addStyle(`--hov-${s}`, i)));
205
158
  }));
206
159
  }
207
- setBdProps(t) {
208
- if (t) {
209
- if (typeof t == "string" && t.includes(",") && !t.includes("(")) {
210
- S(t).forEach((s) => {
211
- const i = x("bd", s) || s;
212
- i && this.addUtil(`-bd:${i}`);
213
- });
214
- return;
215
- }
216
- this.analyzeProp("bd", t);
217
- }
218
- }
219
- getStateProps({ skipState: t, isOverwide: s, isFullwide: i, isWide: e, isFlow: l, isContainer: r, hasGutter: f, isLayer: c, isLinkBox: n, ...h }) {
220
- return t || (r && this.setContainerData(r), l && this.setFlowData(l), s && this.lismState.push("is--overwide"), i && this.lismState.push("is--fullwide"), e && this.lismState.push("is--wide"), f && this.lismState.push("has--gutter")), c && this.lismState.push("is--layer"), n && this.lismState.push("is--linkBox"), h;
221
- }
222
- setContainerData(t) {
223
- t === !0 ? this.lismState.push("is--container") : t && (g("contentSize", t) ? this.lismState.push(`is--container -container:${t}`) : (this.lismState.push("is--container"), this.addStyle("--contentSize", u(t, "size"))));
224
- }
225
- setFlowData(t) {
226
- t === !0 ? this.lismState.push("is--flow") : t && (g("flow", t) ? this.lismState.push(`is--flow -flow:${t}`) : (this.lismState.push("is--flow"), this.addStyle("--flowM", u(t, "space"))));
227
- }
228
160
  }
229
- function I(o, t = {}) {
230
- if (o = Object.assign(t, o), o.length === 0)
161
+ function J(r) {
162
+ if (r.length === 0)
231
163
  return {};
232
- const s = new K(o);
233
- return O({
234
- className: U(s.className, s.uClasses),
235
- style: O(s.styles),
164
+ const t = new w(r);
165
+ return j({
166
+ className: t.className,
167
+ style: j(t.styles),
236
168
  //filterEmptyObj(styles), // filterEmptyObj は最後にかける
237
- ...s.attrs
169
+ ...t.attrs
238
170
  // 処理されずに残っているprops
239
171
  });
240
172
  }
241
173
  export {
242
- I as default
174
+ J as default
243
175
  };
@@ -1,61 +1,37 @@
1
- import o from "./helper/isNumStr.js";
2
- import n from "./isTokenValue.js";
3
- function m(r, t, i = "") {
4
- if (typeof t == "function")
5
- return t(r);
6
- if (typeof t == "string")
7
- switch (t) {
8
- case "space":
9
- return e(r);
10
- case "color":
11
- return f(r);
12
- case "size":
13
- return c(r);
14
- case "bdrs":
15
- return p(r);
16
- case "bxsh":
17
- return b(r);
18
- // case 'opacity':
19
- // return getMaybeOpacityVar(value);
20
- case "fz":
21
- return y(r);
22
- // case 'filter':
23
- // return getMaybeFilterVar(value);
24
- default:
25
- return r;
26
- }
27
- else if (t === 1 && n(i, r))
28
- return `var(--${i}--${r})`;
29
- return r;
30
- }
31
- function e(r, t) {
32
- return r === 0 || r === "0" ? "0" : typeof r == "number" || o(r) ? `var(--s${r})` : typeof r == "string" && r.includes(" ") && !r.includes("calc(") && !r.includes("var(") && !r.includes(",") ? r.split(" ").map((s) => e(s)).join(" ") : r;
33
- }
34
- function f(r, t) {
35
- if (typeof r == "string" && r.endsWith("%")) {
36
- const [i, s] = r.split(":");
37
- return `color-mix(in srgb, ${f(i)} ${s}, transparent)`;
1
+ import { TOKENS as t } from "../config/index.js";
2
+ import f from "./helper/isNumStr.js";
3
+ import n from "./getMaybeTokenValue.js";
4
+ function b(r, o) {
5
+ if (!o) return r;
6
+ switch (o) {
7
+ case "space":
8
+ return s(r);
9
+ case "color":
10
+ return p(r);
11
+ case "bxsh":
12
+ return r === "0" || r === 0 ? "none" : n(o, r, t);
13
+ default:
14
+ return n(o, r, t);
38
15
  }
39
- return n("color", r) ? `var(--c-${r})` : n("palette", r) ? `var(--${r})` : r;
40
16
  }
41
- function c(r) {
42
- return n("contentSize", r) ? `var(--size-${r})` : r;
17
+ function s(r) {
18
+ return r === 0 || r === "0" ? "0" : typeof r == "number" || f(r) ? `var(--s${r})` : typeof r == "string" && r.includes(" ") && !r.includes("calc(") && !r.includes("var(") && !r.includes(",") ? r.split(" ").map((i) => s(i)).join(" ") : r;
43
19
  }
44
20
  function p(r) {
45
- return n("bdrs", r) ? "var(--bdrs-" + r + ")" : r;
46
- }
47
- function b(r) {
48
- return n("bxsh", r) ? (r = r + "", r = r.replace("-", "i"), r === "0" ? "none" : "var(--bxsh-" + r + ")") : r;
49
- }
50
- function y(r) {
51
- return n("fz", r) ? "var(--fz-" + r + ")" : r;
21
+ if (typeof r == "string" && r.endsWith("%")) {
22
+ const o = r.split(":");
23
+ if (o.length === 3) {
24
+ const [i, c, e] = o;
25
+ return `color-mix(in srgb, ${n("color", i, t)} ${e}, ${n("color", c, t)})`;
26
+ } else if (o.length === 2) {
27
+ const [i, c] = o;
28
+ return `color-mix(in srgb, ${n("color", i, t)} ${c}, transparent)`;
29
+ }
30
+ }
31
+ return n("color", r, t);
52
32
  }
53
33
  export {
54
- m as default,
55
- f as getMaybeColorVar,
56
- y as getMaybeFzVar,
57
- p as getMaybeRadiusVar,
58
- b as getMaybeShadowVar,
59
- c as getMaybeSizeVar,
60
- e as getMaybeSpaceVar
34
+ b as default,
35
+ p as getMaybeColorVar,
36
+ s as getMaybeSpaceVar
61
37
  };
@@ -0,0 +1,26 @@
1
+ function c(t, r, n) {
2
+ if (typeof t != "string") return r;
3
+ if (t === "color") {
4
+ let s = c("c", r, n);
5
+ return s === r && (s = c("palette", r, n)), s;
6
+ }
7
+ const i = n[t];
8
+ if (!i) return r;
9
+ if (typeof r == "number" && (r = `${r}`), i instanceof Set) {
10
+ if (i.has(r))
11
+ return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${t}--${r})`;
12
+ } else if (Array.isArray(i)) {
13
+ if (i.includes(r))
14
+ return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${t}--${r})`;
15
+ } else if (typeof i == "object") {
16
+ const { pre: s = "", values: f = [] } = i || {};
17
+ if ((t === "palette" || t === "c") && console.log(":::color:::::", r, f), f instanceof Set && f.has(r))
18
+ return `var(${s}${r})`;
19
+ if (Array.isArray(f) && f.includes(r))
20
+ return `var(${s}${r})`;
21
+ }
22
+ return r;
23
+ }
24
+ export {
25
+ c as default
26
+ };
@@ -0,0 +1,13 @@
1
+ function o(e, r, f = !1) {
2
+ if (e == null || typeof e != "object") return "";
3
+ if (r in e)
4
+ return f ? e[r] : r;
5
+ if (f) return "";
6
+ for (const [n, t] of Object.entries(e))
7
+ if (t === r)
8
+ return n;
9
+ return "";
10
+ }
11
+ export {
12
+ o as default
13
+ };
@@ -1,6 +1,6 @@
1
- function e(r, n) {
2
- return Array.isArray(r) ? typeof n == "number" ? r.includes(`${n}`) : r.includes(n) : !1;
1
+ function f(n, r) {
2
+ return typeof r == "number" && (r = `${r}`), n instanceof Set ? n.has(r) : Array.isArray(n) ? n.includes(r) : !1;
3
3
  }
4
4
  export {
5
- e as default
5
+ f as default
6
6
  };
@@ -1,8 +1,9 @@
1
- import t from "../config/tokens.js";
2
- function i(n, r) {
3
- if (typeof n != "string") return !1;
4
- const e = t[n];
5
- return Array.isArray(e) ? typeof r == "number" ? e.includes(`${r}`) : e.includes(r) : !1;
1
+ import { TOKENS as s } from "../config/index.js";
2
+ function i(t, e) {
3
+ if (typeof t != "string") return !1;
4
+ typeof e == "number" && (e = `${e}`);
5
+ const r = s[t];
6
+ return r instanceof Set ? r.has(e) : Array.isArray(r) ? r.includes(e) : typeof r == "object" ? (r.values || /* @__PURE__ */ new Set()).has(e) : !1;
6
7
  }
7
8
  export {
8
9
  i as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-css",
3
- "version": "0.3.5",
3
+ "version": "0.5.0",
4
4
  "description": "A layout-first CSS framework for websites.",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -16,13 +16,20 @@
16
16
  "dev": "vite",
17
17
  "build": "vite build && pnpm build:css",
18
18
  "build:vite": "vite build",
19
- "build:css": "node scss-builder.cjs",
19
+ "build:css": "node bin/script-build-css.js",
20
20
  "lint": "pnpm lint:style",
21
21
  "lint:style": "stylelint '**/*.{css,scss}'",
22
22
  "preview": "vite preview"
23
23
  },
24
+ "bin": {
25
+ "lism-css": "./bin/cli.mjs"
26
+ },
24
27
  "files": [
25
28
  "dist",
29
+ "config",
30
+ "config.js",
31
+ "vite-plugin.js",
32
+ "bin",
26
33
  "packages",
27
34
  "src/scss"
28
35
  ],
@@ -31,7 +38,12 @@
31
38
  "types": "./packages/types/index.d.ts",
32
39
  "exports": {
33
40
  ".": "./dist/index.js",
34
- "./*": "./dist/*",
41
+ "./config.js": "./config.js",
42
+ "./config": "./config/index.js",
43
+ "./default-config": "./config/default-config.js",
44
+ "./vite-plugin": "./vite-plugin.mjs",
45
+ "./lib/*": "./dist/lib/*",
46
+ "./components/*": "./dist/components/*",
35
47
  "./react": {
36
48
  "import": "./dist/index.js",
37
49
  "types": "./packages/types/index.d.ts"
@@ -43,6 +55,7 @@
43
55
  "types": "./packages/types/index.d.ts"
44
56
  },
45
57
  "./astro/*": "./packages/astro/*",
58
+ "./types": "./packages/types/index.d.ts",
46
59
  "./scss/*": "./src/scss/*",
47
60
  "./*.css": "./dist/css/*.css"
48
61
  },
@@ -1,15 +1,14 @@
1
1
  ---
2
- import type { LismProps } from '../types';
2
+ import type { LismProps } from '../../types';
3
3
  import { Lism } from '../Lism';
4
- import { Grid } from '../Grid';
5
4
  import { defaultProps } from '../../../dist/components/Accordion/getProps';
6
5
 
7
6
  interface Props extends LismProps {}
8
- const { isFlow, innerProps, ...props } = Astro.props || {};
7
+ const { flow, innerProps, ...props } = Astro.props || {};
9
8
  ---
10
9
 
11
- <Grid {...defaultProps.body} {...props}>
12
- <Lism isFlow={isFlow} {...defaultProps.inner} {...innerProps}>
10
+ <Lism {...defaultProps.body} {...props}>
11
+ <Lism layout='flow' flow={flow} {...defaultProps.inner} {...innerProps}>
13
12
  <slot />
14
13
  </Lism>
15
- </Grid>
14
+ </Lism>
@@ -1,6 +1,6 @@
1
1
  ---
2
- import type { LismProps } from '../types';
3
- import { Flex } from '../Flex';
2
+ import type { LismProps } from '../../types';
3
+ import { Lism } from '../Lism';
4
4
  import { defaultProps } from '../../../dist/components/Accordion/getProps';
5
5
 
6
6
  interface Props extends LismProps {}
@@ -8,6 +8,6 @@ interface Props extends LismProps {}
8
8
  const props = Astro.props || {};
9
9
  ---
10
10
 
11
- <Flex tag='summary' {...defaultProps.header} {...props}>
11
+ <Lism tag='summary' {...defaultProps.header} {...props}>
12
12
  <slot />
13
- </Flex>
13
+ </Lism>
@@ -0,0 +1,12 @@
1
+ ---
2
+ import AccHeader from './AccHeader.astro';
3
+ import AccLabel from './AccLabel.astro';
4
+ import AccIcon from './AccIcon.astro';
5
+ ---
6
+
7
+ <AccHeader {...Astro.props || {}}>
8
+ <AccLabel>
9
+ <slot />
10
+ </AccLabel>
11
+ <AccIcon />
12
+ </AccHeader>
@@ -1,5 +1,5 @@
1
1
  ---
2
- import type { LismProps } from '../types';
2
+ import type { LismProps } from '../../types';
3
3
  import { Lism } from '../Lism';
4
4
  import { Icon } from '../Icon';
5
5
  import { getAccIconProps } from '../../../dist/components/Accordion/getProps';
@@ -1,5 +1,5 @@
1
1
  ---
2
- import type { LismProps } from '../types';
2
+ import type { LismProps } from '../../types';
3
3
  import { Lism } from '../Lism';
4
4
  import { defaultProps } from '../../../dist/components/Accordion/getProps';
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- import type { LismProps } from '../types';
2
+ import type { LismProps } from '../../types';
3
3
  import getLismProps from '../../../dist/lib/getLismProps';
4
4
  import { getAccProps } from '../../../dist/components/Accordion/getProps';
5
5
 
@@ -3,5 +3,6 @@ import Header from './AccHeader.astro';
3
3
  import Label from './AccLabel.astro';
4
4
  import Icon from './AccIcon.astro';
5
5
  import Body from './AccBody.astro';
6
+ import HeaderLabel from './AccHeaderLabel.astro';
6
7
 
7
- export default { Root, Header, Body, Icon, Label };
8
+ export default { Root, Header, HeaderLabel, Body, Icon, Label };
@@ -1,11 +1,10 @@
1
1
  ---
2
- import type { LismProps } from '../types';
2
+ import type { LismProps } from '../../types';
3
3
  import { Lism } from '../Lism';
4
- import getProps from '../../../dist/components/Box/getProps';
5
4
 
6
5
  // Propsの定義
7
6
  interface Props extends LismProps {}
8
7
  const props = Astro.props || {};
9
8
  ---
10
9
 
11
- <Lism {...getProps(props)}><slot /></Lism>
10
+ <Lism layout='box' {...props}><slot /></Lism>