lism-css 0.10.5 → 0.12.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 (182) hide show
  1. package/README.ja.md +5 -5
  2. package/README.md +7 -7
  3. package/config/defaults/props.ts +16 -26
  4. package/config/defaults/states.ts +0 -28
  5. package/config/defaults/tokens.ts +2 -2
  6. package/dist/components/{atomic/Media → Media}/Media.d.ts +2 -2
  7. package/dist/components/{atomic/Media → Media}/index.js +1 -1
  8. package/dist/components/atomic/Icon/getProps.d.ts +1 -1
  9. package/dist/components/atomic/Icon/index.d.ts +1 -1
  10. package/dist/components/index.d.ts +18 -18
  11. package/dist/components/index.js +62 -62
  12. package/dist/components/{Box → layout/Box}/Box.d.ts +2 -2
  13. package/dist/components/{Box → layout/Box}/index.js +1 -1
  14. package/dist/components/{Center → layout/Center}/Center.d.ts +2 -2
  15. package/dist/components/{Center → layout/Center}/index.js +1 -1
  16. package/dist/components/{Cluster → layout/Cluster}/Cluster.d.ts +2 -2
  17. package/dist/components/{Cluster → layout/Cluster}/index.js +1 -1
  18. package/dist/components/{Columns → layout/Columns}/Columns.d.ts +2 -2
  19. package/dist/components/{Columns → layout/Columns}/index.js +1 -1
  20. package/dist/components/{Flex → layout/Flex}/Flex.d.ts +2 -2
  21. package/dist/components/{Flex → layout/Flex}/index.js +1 -1
  22. package/dist/components/{Flow → layout/Flow}/Flow.d.ts +2 -2
  23. package/dist/components/{Flow → layout/Flow}/index.js +1 -1
  24. package/dist/components/{FluidCols → layout/FluidCols}/FluidCols.d.ts +2 -2
  25. package/dist/components/{FluidCols → layout/FluidCols}/index.js +1 -1
  26. package/dist/components/{Frame → layout/Frame}/Frame.d.ts +2 -2
  27. package/dist/components/{Frame → layout/Frame}/index.js +1 -1
  28. package/dist/components/{Grid → layout/Grid}/Grid.d.ts +2 -2
  29. package/dist/components/{Grid → layout/Grid}/index.js +1 -1
  30. package/dist/components/{SideMain → layout/SideMain}/SideMain.d.ts +2 -2
  31. package/dist/components/{SideMain → layout/SideMain}/index.js +1 -1
  32. package/dist/components/{Stack → layout/Stack}/Stack.d.ts +2 -2
  33. package/dist/components/{Stack → layout/Stack}/index.js +1 -1
  34. package/dist/components/{SwitchCols → layout/SwitchCols}/SwitchCols.d.ts +2 -2
  35. package/dist/components/{SwitchCols → layout/SwitchCols}/index.js +1 -1
  36. package/dist/components/layout/TileGrid/TileGrid.d.ts +4 -0
  37. package/dist/components/layout/TileGrid/index.d.ts +1 -0
  38. package/dist/components/layout/TileGrid/index.js +8 -0
  39. package/dist/components/{Container → state/Container}/Container.d.ts +1 -1
  40. package/dist/components/{Container → state/Container}/index.js +1 -1
  41. package/dist/components/{Layer → state/Layer}/Layer.d.ts +1 -1
  42. package/dist/components/{Layer → state/Layer}/index.js +1 -1
  43. package/dist/components/{LinkBox → state/LinkBox}/LinkBox.d.ts +1 -1
  44. package/dist/components/{LinkBox → state/LinkBox}/index.js +1 -1
  45. package/dist/components/{Wrapper → state/Wrapper}/Wrapper.d.ts +1 -1
  46. package/dist/components/{Wrapper → state/Wrapper}/index.js +1 -1
  47. package/dist/config/default-config.d.ts +26 -73
  48. package/dist/config/defaults/props.d.ts +24 -58
  49. package/dist/config/defaults/props.js +16 -26
  50. package/dist/config/defaults/states.d.ts +0 -13
  51. package/dist/config/defaults/states.js +3 -23
  52. package/dist/config/defaults/tokens.d.ts +2 -2
  53. package/dist/config/defaults/tokens.js +2 -2
  54. package/dist/config/index.d.ts +52 -146
  55. package/dist/css/base.css +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/layout.css +1 -1
  59. package/dist/css/props.css +1 -1
  60. package/dist/css/utility.css +1 -1
  61. package/dist/lib/getLayoutProps.js +12 -15
  62. package/dist/lib/getLismProps.d.ts +3 -2
  63. package/dist/lib/getLismProps.js +91 -89
  64. package/dist/lib/helper/mergeSet.d.ts +5 -0
  65. package/dist/lib/helper/mergeSet.js +14 -0
  66. package/dist/lib/helper/mergeSet.test.d.ts +1 -0
  67. package/dist/lib/types/LayoutProps.d.ts +4 -1
  68. package/dist/lib/types/StateProps.d.ts +5 -3
  69. package/package.json +1 -1
  70. package/packages/astro/{Decorator → atomic/Decorator}/Decorator.astro +1 -1
  71. package/packages/astro/{Divider → atomic/Divider}/Divider.astro +2 -2
  72. package/packages/astro/{Icon → atomic/Icon}/Icon.astro +1 -1
  73. package/packages/astro/{Spacer → atomic/Spacer}/Spacer.astro +2 -2
  74. package/packages/astro/index.ts +26 -22
  75. package/packages/astro/{Box → layout/Box}/Box.astro +2 -2
  76. package/packages/astro/{Center → layout/Center}/Center.astro +2 -2
  77. package/packages/astro/{Cluster → layout/Cluster}/Cluster.astro +2 -2
  78. package/packages/astro/{Columns → layout/Columns}/Columns.astro +2 -2
  79. package/packages/astro/{Flex → layout/Flex}/Flex.astro +2 -2
  80. package/packages/astro/{Flow → layout/Flow}/Flow.astro +2 -2
  81. package/packages/astro/{FluidCols → layout/FluidCols}/FluidCols.astro +2 -2
  82. package/packages/astro/{Frame → layout/Frame}/Frame.astro +2 -2
  83. package/packages/astro/{Grid → layout/Grid}/Grid.astro +2 -2
  84. package/packages/astro/{SideMain → layout/SideMain}/SideMain.astro +2 -2
  85. package/packages/astro/{Stack → layout/Stack}/Stack.astro +2 -2
  86. package/packages/astro/{SwitchCols → layout/SwitchCols}/SwitchCols.astro +2 -2
  87. package/packages/astro/layout/TileGrid/TileGrid.astro +11 -0
  88. package/packages/astro/layout/TileGrid/index.ts +1 -0
  89. package/packages/astro/{Container → state/Container}/Container.astro +2 -2
  90. package/packages/astro/{Layer → state/Layer}/Layer.astro +2 -2
  91. package/packages/astro/{LinkBox → state/LinkBox}/LinkBox.astro +2 -2
  92. package/packages/astro/{Wrapper → state/Wrapper}/Wrapper.astro +2 -2
  93. package/src/scss/_auto_output.scss +1 -1
  94. package/src/scss/_prop-config.scss +24 -30
  95. package/src/scss/_with_layer.scss +4 -4
  96. package/src/scss/base/_html.scss +9 -9
  97. package/src/scss/base/tokens/_shadow.scss +5 -8
  98. package/src/scss/base/tokens/_tokens.scss +5 -10
  99. package/src/scss/modules/layout/_grid.scss +0 -5
  100. package/src/scss/modules/layout/_tileGrid.scss +4 -0
  101. package/src/scss/modules/layout/index.scss +1 -0
  102. package/src/scss/props/index.scss +1 -1
  103. package/src/scss/utility/_cbox.scss +3 -3
  104. package/src/scss/utility/_clipText.scss +1 -0
  105. package/src/scss/utility/_hidden.scss +2 -2
  106. package/src/scss/utility/_trimHL.scss +4 -1
  107. package/config/helper/getSvgUrl.ts +0 -26
  108. package/dist/components/HTML/HTML.d.ts +0 -26
  109. package/dist/components/HTML/index.d.ts +0 -14
  110. package/dist/components/HTML/index.js +0 -5
  111. package/dist/components/HTML/index2.js +0 -45
  112. package/dist/config/helper/getSvgUrl.d.ts +0 -5
  113. package/dist/config/helper/getSvgUrl.js +0 -4
  114. package/packages/astro/HTML/_index_memo.js +0 -29
  115. package/packages/astro/HTML/a.astro +0 -10
  116. package/packages/astro/HTML/button.astro +0 -10
  117. package/packages/astro/HTML/div.astro +0 -10
  118. package/packages/astro/HTML/h.astro +0 -13
  119. package/packages/astro/HTML/img.astro +0 -10
  120. package/packages/astro/HTML/index.ts +0 -12
  121. package/packages/astro/HTML/li.astro +0 -10
  122. package/packages/astro/HTML/ol.astro +0 -10
  123. package/packages/astro/HTML/p.astro +0 -10
  124. package/packages/astro/HTML/span.astro +0 -10
  125. package/packages/astro/HTML/ul.astro +0 -10
  126. /package/dist/components/{atomic/Media → Media}/Media.stories.d.ts +0 -0
  127. /package/dist/components/{atomic/Media → Media}/index.d.ts +0 -0
  128. /package/dist/components/{Box → layout/Box}/Box.stories.d.ts +0 -0
  129. /package/dist/components/{Box → layout/Box}/index.d.ts +0 -0
  130. /package/dist/components/{Center → layout/Center}/Center.stories.d.ts +0 -0
  131. /package/dist/components/{Center → layout/Center}/index.d.ts +0 -0
  132. /package/dist/components/{Cluster → layout/Cluster}/Cluster.stories.d.ts +0 -0
  133. /package/dist/components/{Cluster → layout/Cluster}/index.d.ts +0 -0
  134. /package/dist/components/{Columns → layout/Columns}/Columns.stories.d.ts +0 -0
  135. /package/dist/components/{Columns → layout/Columns}/index.d.ts +0 -0
  136. /package/dist/components/{Flex → layout/Flex}/Flex.stories.d.ts +0 -0
  137. /package/dist/components/{Flex → layout/Flex}/index.d.ts +0 -0
  138. /package/dist/components/{Flow → layout/Flow}/Flow.stories.d.ts +0 -0
  139. /package/dist/components/{Flow → layout/Flow}/index.d.ts +0 -0
  140. /package/dist/components/{FluidCols → layout/FluidCols}/FluidCols.stories.d.ts +0 -0
  141. /package/dist/components/{FluidCols → layout/FluidCols}/index.d.ts +0 -0
  142. /package/dist/components/{Frame → layout/Frame}/Frame.stories.d.ts +0 -0
  143. /package/dist/components/{Frame → layout/Frame}/index.d.ts +0 -0
  144. /package/dist/components/{Grid → layout/Grid}/Grid.stories.d.ts +0 -0
  145. /package/dist/components/{Grid → layout/Grid}/index.d.ts +0 -0
  146. /package/dist/components/{SideMain → layout/SideMain}/SideMain.stories.d.ts +0 -0
  147. /package/dist/components/{SideMain → layout/SideMain}/index.d.ts +0 -0
  148. /package/dist/components/{Stack → layout/Stack}/Stack.stories.d.ts +0 -0
  149. /package/dist/components/{Stack → layout/Stack}/index.d.ts +0 -0
  150. /package/dist/components/{SwitchCols → layout/SwitchCols}/SwitchCols.stories.d.ts +0 -0
  151. /package/dist/components/{SwitchCols → layout/SwitchCols}/index.d.ts +0 -0
  152. /package/dist/components/{Container → state/Container}/Container.stories.d.ts +0 -0
  153. /package/dist/components/{Container → state/Container}/index.d.ts +0 -0
  154. /package/dist/components/{Layer → state/Layer}/Layer.stories.d.ts +0 -0
  155. /package/dist/components/{Layer → state/Layer}/Layer.test.d.ts +0 -0
  156. /package/dist/components/{Layer → state/Layer}/index.d.ts +0 -0
  157. /package/dist/components/{LinkBox → state/LinkBox}/LinkBox.stories.d.ts +0 -0
  158. /package/dist/components/{LinkBox → state/LinkBox}/index.d.ts +0 -0
  159. /package/dist/components/{LinkBox → state/LinkBox}/script.d.ts +0 -0
  160. /package/dist/components/{Wrapper → state/Wrapper}/Wrapper.stories.d.ts +0 -0
  161. /package/dist/components/{Wrapper → state/Wrapper}/index.d.ts +0 -0
  162. /package/packages/astro/{Decorator → atomic/Decorator}/index.ts +0 -0
  163. /package/packages/astro/{Divider → atomic/Divider}/index.ts +0 -0
  164. /package/packages/astro/{Icon → atomic/Icon}/SVG.astro +0 -0
  165. /package/packages/astro/{Icon → atomic/Icon}/index.ts +0 -0
  166. /package/packages/astro/{Spacer → atomic/Spacer}/index.ts +0 -0
  167. /package/packages/astro/{Box → layout/Box}/index.ts +0 -0
  168. /package/packages/astro/{Center → layout/Center}/index.ts +0 -0
  169. /package/packages/astro/{Cluster → layout/Cluster}/index.ts +0 -0
  170. /package/packages/astro/{Columns → layout/Columns}/index.ts +0 -0
  171. /package/packages/astro/{Flex → layout/Flex}/index.ts +0 -0
  172. /package/packages/astro/{Flow → layout/Flow}/index.ts +0 -0
  173. /package/packages/astro/{FluidCols → layout/FluidCols}/index.ts +0 -0
  174. /package/packages/astro/{Frame → layout/Frame}/index.ts +0 -0
  175. /package/packages/astro/{Grid → layout/Grid}/index.ts +0 -0
  176. /package/packages/astro/{SideMain → layout/SideMain}/index.ts +0 -0
  177. /package/packages/astro/{Stack → layout/Stack}/index.ts +0 -0
  178. /package/packages/astro/{SwitchCols → layout/SwitchCols}/index.ts +0 -0
  179. /package/packages/astro/{Container → state/Container}/index.ts +0 -0
  180. /package/packages/astro/{Layer → state/Layer}/index.ts +0 -0
  181. /package/packages/astro/{LinkBox → state/LinkBox}/index.ts +0 -0
  182. /package/packages/astro/{Wrapper → state/Wrapper}/index.ts +0 -0
@@ -1,19 +1,20 @@
1
1
  import { STATES as b, PROPS as g } from "../config/index.js";
2
- import E from "./getLayoutProps.js";
3
- import C from "./isPresetValue.js";
4
- import V from "./isTokenValue.js";
5
- import U from "./getUtilKey.js";
2
+ import p from "./getLayoutProps.js";
3
+ import U from "./isPresetValue.js";
4
+ import E from "./isTokenValue.js";
5
+ import C from "./getUtilKey.js";
6
6
  import S from "./getMaybeCssVar.js";
7
- import _ from "./getBpData.js";
8
- import A from "./helper/atts.js";
9
- import x from "./helper/isEmptyObj.js";
7
+ import V from "./getBpData.js";
8
+ import x from "./helper/atts.js";
9
+ import _ from "./helper/isEmptyObj.js";
10
10
  import O from "./helper/filterEmptyObj.js";
11
+ import w from "./helper/mergeSet.js";
11
12
  import j from "./helper/splitWithComma.js";
12
- const z = (a) => {
13
- const s = g[a];
14
- return s && s?.token || "";
13
+ const A = (f) => {
14
+ const i = g[f];
15
+ return i && i?.token || "";
15
16
  };
16
- class w {
17
+ class z {
17
18
  // propList = {};
18
19
  className = "";
19
20
  uClasses = [];
@@ -21,101 +22,102 @@ class w {
21
22
  styles = {};
22
23
  attrs = {};
23
24
  _propConfig;
24
- constructor(s) {
25
- const { forwardedRef: t, class: i, className: e, lismClass: l, variant: r, style: f = {}, _propConfig: o = {}, ...u } = s;
26
- this.styles = { ...f }, this._propConfig = { ...o };
27
- let h = l || "";
25
+ constructor(i) {
26
+ const { forwardedRef: t, class: s, className: e, lismClass: l, variant: r, style: o = {}, _propConfig: m = {}, ...u } = i;
27
+ this.styles = { ...o }, this._propConfig = { ...m };
28
+ let a = l || "";
28
29
  if (r && l) {
29
- const y = l.split(" "), n = y[0], m = `${n}--${r}`;
30
- h = [n, m, ...y.slice(1)].join(" ");
30
+ const d = l.split(" "), n = d[0], y = `${n}--${r}`;
31
+ a = [n, y, ...d.slice(1)].join(" ");
31
32
  }
32
- x(u) || (this.attrs = { ...u }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = A(e || i, h, this.lismState, this.uClasses);
33
+ _(u) || (this.attrs = { ...u }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = x(e || s, a, this.lismState, this.uClasses);
33
34
  }
34
- analyzeState(s, t) {
35
- const { className: i, preset: e, presetClass: l, customVar: r, tokenKey: f, setStyles: o } = s;
36
- t === !0 ? this.lismState.push(i) : e && C(e, t) ? this.lismState.push(`${i} ${l}:${String(t)}`) : t && (this.lismState.push(i), f && r ? this.addStyle(r, S(t, f)) : o && typeof t == "string" && this.addStyles(o(t)));
35
+ analyzeState(i, t) {
36
+ const { className: s, preset: e, presetClass: l, customVar: r, tokenKey: o } = i;
37
+ t === !0 ? this.lismState.push(s) : e && U(e, t) ? this.lismState.push(`${s} ${l}:${String(t)}`) : t && (this.lismState.push(s), o && r && this.addStyle(r, S(t, o)));
37
38
  }
38
39
  // prop解析
39
40
  analyzeProps() {
41
+ const i = this.extractProp("set"), t = this.extractProp("unset");
40
42
  Object.keys(this.attrs).forEach((s) => {
41
43
  if (Object.hasOwn(b, s)) {
42
- const t = this.extractProp(s), i = b[s];
43
- typeof i == "string" ? t && this.lismState.push(i) : this.analyzeState(i, t);
44
+ const e = this.extractProp(s), l = b[s];
45
+ typeof l == "string" ? e && this.lismState.push(l) : this.analyzeState(l, e);
44
46
  } else if (Object.hasOwn(g, s)) {
45
- const t = this.attrs[s];
46
- delete this.attrs[s], this.analyzeLismProp(s, t);
47
+ const e = this.attrs[s];
48
+ delete this.attrs[s], this.analyzeLismProp(s, e);
47
49
  } else if (s === "hov") {
48
- const t = this.extractProp(s);
49
- this.setHovProps(t);
50
+ const e = this.extractProp(s);
51
+ this.setHovProps(e);
50
52
  } else if (s === "css") {
51
- const t = this.extractProp("css");
52
- this.addStyles(t);
53
+ const e = this.extractProp("css");
54
+ this.addStyles(e);
53
55
  }
54
- });
56
+ }), w(void 0, i, t).forEach((s) => this.lismState.push(`set--${s}`));
55
57
  }
56
58
  // Lism Prop 解析
57
- analyzeLismProp(s, t) {
59
+ analyzeLismProp(i, t) {
58
60
  if (t == null) return;
59
- let i = g[s] || null;
60
- if (i === null) return;
61
- this._propConfig?.[s] && (i = Object.assign({}, i, this._propConfig[s]));
62
- const { base: e, ...l } = _(t);
63
- this.setAttrs(s, e, i), Object.keys(l).forEach((r) => {
64
- i && this.setAttrs(s, l[r], i, r);
61
+ let s = g[i] || null;
62
+ if (s === null) return;
63
+ this._propConfig?.[i] && (s = Object.assign({}, s, this._propConfig[i]));
64
+ const { base: e, ...l } = V(t);
65
+ this.setAttrs(i, e, s), Object.keys(l).forEach((r) => {
66
+ s && this.setAttrs(i, l[r], s, r);
65
67
  });
66
68
  }
67
- addUtil(s) {
68
- this.uClasses.push(s);
69
+ addUtil(i) {
70
+ this.uClasses.push(i);
69
71
  }
70
- addUtils(s) {
71
- this.uClasses.push(...s);
72
+ addUtils(i) {
73
+ this.uClasses.push(...i);
72
74
  }
73
75
  // addState(state) {
74
76
  // this.stateClasses.push(state);
75
77
  // }
76
- addStyle(s, t) {
77
- this.styles[s] = t;
78
+ addStyle(i, t) {
79
+ this.styles[i] = t;
78
80
  }
79
- addStyles(s) {
80
- this.styles = { ...this.styles, ...s };
81
+ addStyles(i) {
82
+ this.styles = { ...this.styles, ...i };
81
83
  }
82
- addAttrs(s) {
83
- this.addStyles(s.styles || {}), this.addUtils(s.utils || []);
84
+ addAttrs(i) {
85
+ this.addStyles(i.styles || {}), this.addUtils(i.utils || []);
84
86
  }
85
- extractProp(s) {
86
- const t = this.attrs[s];
87
- return this.attrs[s] === void 0 ? null : (delete this.attrs[s], t);
87
+ extractProp(i) {
88
+ const t = this.attrs[i];
89
+ return this.attrs[i] === void 0 ? null : (delete this.attrs[i], t);
88
90
  }
89
- extractProps(s) {
91
+ extractProps(i) {
90
92
  const t = {};
91
- return s.forEach((i) => {
92
- this.attrs[i] !== void 0 && (t[i] = this.attrs[i], delete this.attrs[i]);
93
+ return i.forEach((s) => {
94
+ this.attrs[s] !== void 0 && (t[s] = this.attrs[s], delete this.attrs[s]);
93
95
  }), t;
94
96
  }
95
97
  // utilクラスを追加するか、styleにセットするかの分岐処理 @base
96
98
  // 値が null, undefined, '', false の時はスキップ
97
- setAttrs(s, t, i = {}, e = "") {
99
+ setAttrs(i, t, s = {}, e = "") {
98
100
  if (t == null || t === "" || t === !1) return;
99
- let l = `--${s}`, r = `-${String(i.utilKey || s)}`;
100
- if (e && (l = `--${s}_${e}`, r += `_${e}`), typeof t == "string" && t.startsWith(":")) {
101
+ let l = `--${i}`, r = `-${String(s.utilKey || i)}`;
102
+ if (e && (l = `--${i}_${e}`, r += `_${e}`), typeof t == "string" && t.startsWith(":")) {
101
103
  this.addUtil(`${r}:${t.replace(":", "")}`);
102
104
  return;
103
105
  }
104
106
  if (!e) {
105
- const { presets: m, tokenClass: k, utils: $, shorthands: P } = i;
106
- if (m && C(m, t)) {
107
- const d = typeof t == "string" || typeof t == "number" ? String(t) : "";
108
- d && this.addUtil(`${r}:${d}`);
107
+ const { presets: y, tokenClass: k, utils: $, shorthands: P } = s;
108
+ if (y && U(y, t)) {
109
+ const c = typeof t == "string" || typeof t == "number" ? String(t) : "";
110
+ c && this.addUtil(`${r}:${c}`);
109
111
  return;
110
112
  }
111
- if (k && i.token && V(i.token, t)) {
112
- const d = typeof t == "string" || typeof t == "number" ? String(t) : "";
113
- d && this.addUtil(`${r}:${d}`);
113
+ if (k && s.token && E(s.token, t)) {
114
+ const c = typeof t == "string" || typeof t == "number" ? String(t) : "";
115
+ c && this.addUtil(`${r}:${c}`);
114
116
  return;
115
117
  }
116
- let c = "";
117
- if ($ && typeof t == "string" && (c = U($, t)), !c && P && typeof t == "string" && (c = U(P, t, !0)), c) {
118
- this.addUtil(`${r}:${c}`);
118
+ let h = "";
119
+ if ($ && typeof t == "string" && (h = C($, t)), !h && P && typeof t == "string" && (h = C(P, t, !0)), h) {
120
+ this.addUtil(`${r}:${h}`);
119
121
  return;
120
122
  }
121
123
  }
@@ -123,14 +125,14 @@ class w {
123
125
  this.addUtil(r);
124
126
  return;
125
127
  }
126
- const { prop: f, isVar: o, alwaysVar: u, token: h, bp: y } = i;
128
+ const { prop: o, isVar: m, alwaysVar: u, token: a, bp: d } = s;
127
129
  let n;
128
- if (h && (typeof t == "string" || typeof t == "number") ? n = S(t, h) : typeof t == "string" || typeof t == "number" ? n = t : n = JSON.stringify(t), !e) {
129
- if (o) {
130
- this.addStyle(`--${s}`, n);
130
+ if (a && (typeof t == "string" || typeof t == "number") ? n = S(t, a) : typeof t == "string" || typeof t == "number" ? n = t : n = JSON.stringify(t), !e) {
131
+ if (m) {
132
+ this.addStyle(`--${i}`, n);
131
133
  return;
132
- } else if (!y && !u) {
133
- this.addStyle(f, n);
134
+ } else if (!d && !u) {
135
+ this.addStyle(o, n);
134
136
  return;
135
137
  }
136
138
  }
@@ -149,40 +151,40 @@ class w {
149
151
  // this.addStyle(`--pass_${propName}`, value);
150
152
  // });
151
153
  // }
152
- setHovProps(s) {
153
- s && (s === "-" || s === !0 ? this.addUtil("-hov") : typeof s == "string" ? j(s).forEach((t) => {
154
+ setHovProps(i) {
155
+ i && (i === "-" || i === !0 ? this.addUtil("-hov") : typeof i == "string" ? j(i).forEach((t) => {
154
156
  this.addUtil(`-hov:${t}`);
155
- }) : typeof s == "object" && Object.keys(s).forEach((t) => {
156
- const i = s[t];
157
- if (!(i == null || i === "" || i === !1)) {
158
- if (i === "-" || i === !0)
157
+ }) : typeof i == "object" && Object.keys(i).forEach((t) => {
158
+ const s = i[t];
159
+ if (!(s == null || s === "" || s === !1)) {
160
+ if (s === "-" || s === !0)
159
161
  this.addUtil(`-hov:${t}`);
160
162
  else if (t === "class")
161
- j(i).forEach((e) => {
163
+ j(s).forEach((e) => {
162
164
  this.addUtil(`-hov:${e}`);
163
165
  });
164
- else if (typeof i == "string" || typeof i == "number") {
165
- const e = S(i, z(t));
166
+ else if (typeof s == "string" || typeof s == "number") {
167
+ const e = S(s, A(t));
166
168
  this.addUtil(`-hov:${t}`), this.addStyle(`--hov-${t}`, e);
167
169
  }
168
170
  }
169
171
  }));
170
172
  }
171
173
  }
172
- function G(a) {
173
- if (Object.keys(a).length === 0)
174
+ function Q(f) {
175
+ if (Object.keys(f).length === 0)
174
176
  return {};
175
- const { layout: s, ...t } = a, i = new w(E(s, t));
177
+ const { layout: i, ...t } = f, s = new z(p(i, t));
176
178
  return {
177
179
  ...O({
178
- className: i.className,
179
- style: O(i.styles)
180
+ className: s.className,
181
+ style: O(s.styles)
180
182
  }),
181
- ...i.attrs
183
+ ...s.attrs
182
184
  // data-* などHTMLの標準属性はそのまま渡す
183
185
  };
184
186
  }
185
187
  export {
186
- w as LismPropsData,
187
- G as default
188
+ z as LismPropsData,
189
+ Q as default
188
190
  };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * base / set / unset を合成し、最終的な set 値の配列を返す。
3
+ * unset に含まれる値は base + set から除外される。
4
+ */
5
+ export default function mergeSet(base: unknown, set: unknown, unset: unknown): string[];
@@ -0,0 +1,14 @@
1
+ function r(t) {
2
+ return t ? Array.isArray(t) ? t.flatMap((e) => r(e)) : typeof t == "string" ? t.split(/[,\s]+/).map((e) => e.trim()).filter(Boolean) : [] : [];
3
+ }
4
+ function u(t, e, f) {
5
+ const n = [.../* @__PURE__ */ new Set([...r(t), ...r(e)])];
6
+ if (n.length === 0) return [];
7
+ const i = r(f);
8
+ if (i.length === 0) return n;
9
+ const s = new Set(i);
10
+ return n.filter((o) => !s.has(o));
11
+ }
12
+ export {
13
+ u as default
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -26,6 +26,9 @@ export interface StackProps {
26
26
  export interface ColumnsProps {
27
27
  layout: 'columns';
28
28
  }
29
+ export interface TileGridProps {
30
+ layout: 'tileGrid';
31
+ }
29
32
  export interface FlowLayoutProps {
30
33
  layout: 'flow';
31
34
  flow?: CssValue;
@@ -43,7 +46,7 @@ export interface SwitchColsProps {
43
46
  layout: 'switchCols';
44
47
  breakSize?: CssValue;
45
48
  }
46
- export type LayoutSpecificProps = NoLayoutProps | BoxProps | CenterProps | ClusterProps | ColumnsProps | FlexProps | FlowLayoutProps | FluidColsProps | FrameProps | GridLayoutProps | StackProps | SideMainProps | SwitchColsProps;
49
+ export type LayoutSpecificProps = NoLayoutProps | BoxProps | CenterProps | ClusterProps | ColumnsProps | FlexProps | FlowLayoutProps | FluidColsProps | FrameProps | GridLayoutProps | StackProps | SideMainProps | SwitchColsProps | TileGridProps;
47
50
  export type LayoutType = Exclude<LayoutSpecificProps, NoLayoutProps>['layout'];
48
51
  export interface LayoutProps {
49
52
  layout?: LayoutType;
@@ -14,9 +14,7 @@ type PresetElement<T> = T extends {
14
14
  */
15
15
  type ExtractStateValue<T> = T extends string ? boolean : T extends {
16
16
  preset: readonly unknown[];
17
- } ? WithArbitraryString<PresetElement<T>> | boolean : T extends {
18
- setStyles: unknown;
19
- } ? string : never;
17
+ } ? WithArbitraryString<PresetElement<T>> | boolean : never;
20
18
  /**
21
19
  * config/index.ts の STATES から自動生成される State Props の型
22
20
  * config/index.ts の STATES に新しいステートを追加すると自動的に反映される
@@ -24,4 +22,8 @@ type ExtractStateValue<T> = T extends string ? boolean : T extends {
24
22
  export type StateProps = {
25
23
  [K in keyof StatesConfig]?: ExtractStateValue<StatesConfig[K]>;
26
24
  };
25
+ /** set / unset prop で使われるプリセット値(エディタ補完用) */
26
+ type SetPreset = 'gutter' | 'shadow' | 'hov' | 'transition' | 'mask' | 'plain' | 'innerRs' | 'bp';
27
+ /** set / unset prop の値の型: プリセット値がサジェストされつつ、任意の文字列も受け付ける */
28
+ export type SetPropValue = WithArbitraryString<SetPreset> | WithArbitraryString<SetPreset>[];
27
29
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-css",
3
- "version": "0.10.5",
3
+ "version": "0.12.0",
4
4
  "description": "Lism CSS is a layout-first CSS framework for websites.",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
3
  import type { DecoratorProps } from 'lism-css/react/atomic/Decorator/getProps';
4
- import { Lism } from '../Lism';
4
+ import { Lism } from '../../Lism';
5
5
  import getProps from 'lism-css/react/atomic/Decorator/getProps';
6
6
 
7
7
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> &
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismBaseProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismBaseProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
  import { getDividerProps } from 'lism-css/react/atomic/Divider/getProps';
6
6
 
7
7
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
@@ -2,7 +2,7 @@
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
3
  import type { ElementType } from 'react';
4
4
  import type { IconProps, IconOwnProps } from 'lism-css/react/atomic/Icon/getProps';
5
- import type { AstroLismBaseProps } from '../types';
5
+ import type { AstroLismBaseProps } from '../../types';
6
6
  import getLismProps from 'lism-css/lib/getLismProps';
7
7
  import getProps from 'lism-css/react/atomic/Icon/getProps';
8
8
  import SVG from './SVG.astro';
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismBaseProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismBaseProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
  import getProps from 'lism-css/react/atomic/Spacer/getProps';
6
6
 
7
7
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  export * from './Lism';
6
- export { default as HTML } from './HTML';
7
6
  /** @deprecated DummyText / DummyImage (@lism-css/ui) を使用してください */
8
7
  export * from './Dummy';
9
8
 
@@ -14,26 +13,31 @@ export * from './Group';
14
13
  export * from './Heading';
15
14
  export * from './Link';
16
15
  export * from './List';
17
- export * from './Box';
18
- export * from './Flow';
19
- export * from './Flex';
20
- export * from './Cluster';
21
- export * from './Stack';
22
- export * from './Grid';
23
- export * from './FluidCols';
24
- export * from './SwitchCols';
25
- export * from './Columns';
26
- export * from './Center';
27
- export * from './SideMain';
28
- export * from './Frame';
16
+ export * from './Media';
29
17
 
30
- export * from './Container';
31
- export * from './Wrapper';
32
- export * from './Layer';
33
- export * from './LinkBox';
18
+ // layout (l--)
19
+ export * from './layout/Box';
20
+ export * from './layout/Center';
21
+ export * from './layout/Cluster';
22
+ export * from './layout/Columns';
23
+ export * from './layout/Flex';
24
+ export * from './layout/Flow';
25
+ export * from './layout/FluidCols';
26
+ export * from './layout/Frame';
27
+ export * from './layout/Grid';
28
+ export * from './layout/SideMain';
29
+ export * from './layout/Stack';
30
+ export * from './layout/SwitchCols';
31
+ export * from './layout/TileGrid';
34
32
 
35
- export * from './Decorator';
36
- export * from './Divider';
37
- export * from './Icon';
38
- export * from './Media';
39
- export * from './Spacer';
33
+ // state (is--)
34
+ export * from './state/Container';
35
+ export * from './state/Layer';
36
+ export * from './state/LinkBox';
37
+ export * from './state/Wrapper';
38
+
39
+ // atomic (a--)
40
+ export * from './atomic/Decorator';
41
+ export * from './atomic/Divider';
42
+ export * from './atomic/Icon';
43
+ export * from './atomic/Spacer';
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
4
  import type { FlowLayoutProps } from 'lism-css/lib/types/LayoutProps';
5
- import { Lism } from '../Lism';
5
+ import { Lism } from '../../Lism';
6
6
 
7
7
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<FlowLayoutProps, 'layout'>;
8
8
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
4
  import type { FluidColsProps } from 'lism-css/lib/types/LayoutProps';
5
- import { Lism } from '../Lism';
5
+ import { Lism } from '../../Lism';
6
6
 
7
7
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<FluidColsProps, 'layout'>;
8
8
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
4
  import type { SideMainProps } from 'lism-css/lib/types/LayoutProps';
5
- import { Lism } from '../Lism';
5
+ import { Lism } from '../../Lism';
6
6
 
7
7
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<SideMainProps, 'layout'>;
8
8
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
7
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../types';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
4
  import type { SwitchColsProps } from 'lism-css/lib/types/LayoutProps';
5
- import { Lism } from '../Lism';
5
+ import { Lism } from '../../Lism';
6
6
 
7
7
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<SwitchColsProps, 'layout'>;
8
8
 
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types';
3
+ import type { AstroLismFixedLayoutProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
+
6
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
+
8
+ const props = Astro.props;
9
+ ---
10
+
11
+ <Lism layout="tileGrid" {...props}><slot /></Lism>
@@ -0,0 +1 @@
1
+ export { default as TileGrid } from './TileGrid.astro';
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismBaseProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismBaseProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> &
7
7
  AstroLismBaseProps & {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismBaseProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismBaseProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismBaseProps } from '../types';
4
- import { Lism } from '../Lism';
3
+ import type { AstroLismBaseProps } from '../../types';
4
+ import { Lism } from '../../Lism';
5
5
 
6
6
  type Props<Tag extends HTMLTag = 'a'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
7
7