lism-css 0.8.2 → 0.8.4

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 (152) hide show
  1. package/bin/script-build-css.js +1 -1
  2. package/config/default-config.ts +9 -0
  3. package/config/defaults/{props.js → props.ts} +4 -4
  4. package/config/defaults/{states.js → states.ts} +2 -2
  5. package/config/defaults/{tokens.js → tokens.ts} +1 -1
  6. package/config/helper/{getSvgUrl.js → getSvgUrl.ts} +1 -3
  7. package/config/helper/{minifyHtml.js → minifyHtml.ts} +1 -1
  8. package/config/helper.test.ts +238 -0
  9. package/config/helper.ts +79 -0
  10. package/config/{index.js → index.ts} +17 -4
  11. package/config/tsconfig.json +18 -0
  12. package/config.d.ts +2 -0
  13. package/config.js +1 -1
  14. package/dist/components/Box/Box.d.ts +4 -1
  15. package/dist/components/Box/index.d.ts +1 -1
  16. package/dist/components/Center/Center.d.ts +4 -1
  17. package/dist/components/Center/index.d.ts +1 -1
  18. package/dist/components/Cluster/Cluster.d.ts +4 -1
  19. package/dist/components/Cluster/index.js +2 -2
  20. package/dist/components/Columns/Columns.d.ts +4 -1
  21. package/dist/components/Container/Container.d.ts +6 -4
  22. package/dist/components/Dummy/Dummy.d.ts +10 -8
  23. package/dist/components/Dummy/getContent.d.ts +13 -7
  24. package/dist/components/Dummy/getContent.js +7 -6
  25. package/dist/components/Dummy/index.js +8 -7
  26. package/dist/components/Flex/Flex.d.ts +4 -1
  27. package/dist/components/Flow/Flow.d.ts +4 -1
  28. package/dist/components/Flow/index.d.ts +1 -1
  29. package/dist/components/FluidCols/FluidCols.d.ts +4 -1
  30. package/dist/components/Frame/Frame.d.ts +4 -1
  31. package/dist/components/Grid/Grid.d.ts +4 -1
  32. package/dist/components/HTML/HTML.d.ts +16 -13
  33. package/dist/components/HTML/index.d.ts +13 -13
  34. package/dist/components/HTML/index.js +3 -3
  35. package/dist/components/HTML/index2.js +30 -29
  36. package/dist/components/Layer/Layer.d.ts +6 -1
  37. package/dist/components/Layer/Layer.test.d.ts +1 -0
  38. package/dist/components/Layer/getProps.d.ts +5 -1
  39. package/dist/components/LinkBox/LinkBox.d.ts +4 -4
  40. package/dist/components/Lism/Lism.d.ts +28 -7
  41. package/dist/components/Lism/Lism.stories.d.ts +667 -0
  42. package/dist/components/Lism/Lism.test.d.ts +1 -0
  43. package/dist/components/Lism/index.d.ts +1 -3
  44. package/dist/components/Lism/index.js +3 -3
  45. package/dist/components/SideMain/SideMain.d.ts +4 -1
  46. package/dist/components/Stack/Stack.d.ts +4 -1
  47. package/dist/components/SwitchCols/SwitchCols.d.ts +4 -1
  48. package/dist/components/Wrapper/Wrapper.d.ts +6 -4
  49. package/dist/components/atomic/Decorator/Decorator.d.ts +2 -1
  50. package/dist/components/atomic/Decorator/getProps.d.ts +10 -12
  51. package/dist/components/atomic/Decorator/getProps.js +10 -9
  52. package/dist/components/atomic/Divider/Divider.d.ts +2 -1
  53. package/dist/components/atomic/Divider/getProps.d.ts +2 -7
  54. package/dist/components/atomic/Divider/getProps.js +8 -7
  55. package/dist/components/atomic/Icon/Icon.d.ts +4 -3
  56. package/dist/components/atomic/Icon/SVG.d.ts +8 -9
  57. package/dist/components/atomic/Icon/getProps.d.ts +21 -12
  58. package/dist/components/atomic/Icon/getProps.js +31 -25
  59. package/dist/components/atomic/Icon/index.js +9 -8
  60. package/dist/components/atomic/Icon/presets.d.ts +2 -26
  61. package/dist/components/atomic/Icon/presets.js +10 -14
  62. package/dist/components/atomic/Media/Media.d.ts +2 -1
  63. package/dist/components/atomic/Media/getProps.d.ts +9 -1
  64. package/dist/components/atomic/Media/getProps.js +5 -6
  65. package/dist/components/atomic/Media/index.js +3 -3
  66. package/dist/components/atomic/Spacer/Spacer.d.ts +2 -1
  67. package/dist/components/atomic/Spacer/getProps.d.ts +2 -7
  68. package/dist/components/atomic/Spacer/getProps.js +8 -2
  69. package/dist/components/getFilterProps.d.ts +10 -1
  70. package/dist/components/getFilterProps.js +15 -5
  71. package/dist/components/getFilterProps.test.d.ts +1 -0
  72. package/dist/components/index.js +44 -48
  73. package/dist/components/setMaybeTransformStyles.d.ts +12 -1
  74. package/dist/components/setMaybeTransformStyles.js +4 -4
  75. package/dist/components/setMaybeTransformStyles.test.d.ts +1 -0
  76. package/dist/config/default-config.d.ts +838 -0
  77. package/dist/config/defaults/props.d.ts +797 -0
  78. package/dist/config/defaults/states.d.ts +29 -0
  79. package/dist/config/defaults/tokens.d.ts +28 -0
  80. package/dist/config/helper/getSvgUrl.d.ts +5 -0
  81. package/dist/config/helper/minifyHtml.d.ts +5 -0
  82. package/dist/config/helper.d.ts +21 -0
  83. package/dist/config/helper.js +14 -18
  84. package/dist/config/index.d.ts +1675 -0
  85. package/dist/config/index.js +15 -11
  86. package/dist/css/base/set.css +1 -1
  87. package/dist/css/base.css +1 -1
  88. package/dist/css/main.css +1 -1
  89. package/dist/css/main_no_layer.css +1 -1
  90. package/dist/css/modules/state.css +1 -1
  91. package/dist/css/reset.css +1 -1
  92. package/dist/lib/LismPropsData.test.d.ts +1 -0
  93. package/dist/lib/getBpData.d.ts +9 -1
  94. package/dist/lib/getBpData.js +16 -10
  95. package/dist/lib/getBpData.test.d.ts +1 -0
  96. package/dist/lib/getLayoutProps.d.ts +22 -1
  97. package/dist/lib/getLayoutProps.js +19 -19
  98. package/dist/lib/getLayoutProps.test.d.ts +1 -0
  99. package/dist/lib/getLismProps.d.ts +77 -2
  100. package/dist/lib/getLismProps.js +122 -107
  101. package/dist/lib/getLismProps.test.d.ts +1 -0
  102. package/dist/lib/getMaybeCssVar.d.ts +5 -3
  103. package/dist/lib/getMaybeCssVar.js +15 -15
  104. package/dist/lib/getMaybeCssVar.test.d.ts +1 -0
  105. package/dist/lib/getMaybeTokenValue.d.ts +10 -1
  106. package/dist/lib/getMaybeTokenValue.js +21 -21
  107. package/dist/lib/getMaybeTokenValue.test.d.ts +1 -0
  108. package/dist/lib/getUtilKey.d.ts +7 -1
  109. package/dist/lib/getUtilKey.js +6 -6
  110. package/dist/lib/getUtilKey.test.d.ts +1 -0
  111. package/dist/lib/helper/atts.d.ts +6 -3
  112. package/dist/lib/helper/atts.test.d.ts +1 -0
  113. package/dist/lib/helper/filterEmptyObj.d.ts +20 -1
  114. package/dist/lib/helper/filterEmptyObj.js +6 -5
  115. package/dist/lib/helper/filterEmptyObj.test.d.ts +1 -0
  116. package/dist/lib/helper/hasSomeKeys.d.ts +1 -1
  117. package/dist/lib/helper/isNumStr.d.ts +4 -1
  118. package/dist/lib/helper/isNumStr.test.d.ts +1 -0
  119. package/dist/lib/helper/objMap.d.ts +8 -1
  120. package/dist/lib/helper/objMap.test.d.ts +1 -0
  121. package/dist/lib/helper/splitWithComma.d.ts +1 -1
  122. package/dist/lib/helper/splitWithComma.test.d.ts +1 -0
  123. package/dist/lib/isPresetValue.d.ts +3 -1
  124. package/dist/lib/isPresetValue.js +10 -3
  125. package/dist/lib/isPresetValue.test.d.ts +1 -0
  126. package/dist/lib/isTokenValue.d.ts +1 -1
  127. package/dist/lib/isTokenValue.js +24 -7
  128. package/dist/lib/isTokenValue.test.d.ts +1 -0
  129. package/dist/lib/types/LayoutProps.d.ts +50 -0
  130. package/dist/lib/types/PropValueTypes.d.ts +83 -0
  131. package/dist/lib/types/PropValueTypes.spec-d.d.ts +1 -0
  132. package/dist/lib/types/ResponsiveProps.d.ts +50 -0
  133. package/dist/lib/types/ResponsiveProps.spec-d.d.ts +1 -0
  134. package/dist/lib/types/StateProps.d.ts +27 -0
  135. package/dist/lib/types/StateProps.spec-d.d.ts +1 -0
  136. package/dist/lib/types/utils.d.ts +79 -0
  137. package/dist/lib/types/utils.spec-d.d.ts +1 -0
  138. package/dist/lib/types.d.ts +2 -0
  139. package/package.json +30 -11
  140. package/src/scss/_auto_output.scss +2 -1
  141. package/src/scss/_with_layer.scss +1 -0
  142. package/src/scss/base/_base.scss +2 -13
  143. package/src/scss/base/_tokens.scss +3 -3
  144. package/src/scss/base/set/_plain.scss +1 -0
  145. package/src/scss/modules/state/_linkbox.scss +1 -0
  146. package/src/scss/reset.scss +1 -1
  147. package/config/default-config.js +0 -9
  148. package/config/helper.js +0 -67
  149. package/dist/components/Lism/Link.d.ts +0 -1
  150. package/dist/components/Lism/Link.js +0 -8
  151. package/dist/components/Lism/Text.d.ts +0 -1
  152. package/dist/components/Lism/Text.js +0 -8
@@ -1,139 +1,144 @@
1
- var k = Object.defineProperty;
2
- var E = (r, t, s) => t in r ? k(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
3
- var f = (r, t, s) => E(r, typeof t != "symbol" ? t + "" : t, s);
4
- import { STATES as U, PROPS as S } from "../config/index.js";
1
+ var V = Object.defineProperty;
2
+ var _ = (l, s, t) => s in l ? V(l, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[s] = t;
3
+ var a = (l, s, t) => _(l, typeof s != "symbol" ? s + "" : s, t);
4
+ import { STATES as C, PROPS as $ } from "../config/index.js";
5
5
  import A from "./getLayoutProps.js";
6
- import g from "./isPresetValue.js";
7
- import V from "./isTokenValue.js";
6
+ import U from "./isPresetValue.js";
7
+ import x from "./isTokenValue.js";
8
8
  import O from "./getUtilKey.js";
9
- import $ from "./getMaybeCssVar.js";
10
- import _ from "./getBpData.js";
11
- import x from "./helper/atts.js";
12
- import z from "./helper/isEmptyObj.js";
13
- import b from "./helper/filterEmptyObj.js";
14
- import j from "./helper/splitWithComma.js";
15
- const w = (r) => {
16
- const t = S[r];
17
- return t && (t == null ? void 0 : t.token) || "";
9
+ import g from "./getMaybeCssVar.js";
10
+ import z from "./getBpData.js";
11
+ import w from "./helper/atts.js";
12
+ import L from "./helper/isEmptyObj.js";
13
+ import j from "./helper/filterEmptyObj.js";
14
+ import k from "./helper/splitWithComma.js";
15
+ const T = (l) => {
16
+ const s = $[l];
17
+ return s && (s == null ? void 0 : s.token) || "";
18
18
  };
19
- class L {
20
- constructor(t) {
19
+ class H {
20
+ constructor(s) {
21
21
  // propList = {};
22
- f(this, "className", "");
23
- f(this, "uClasses", []);
24
- f(this, "lismState", []);
25
- f(this, "styles", {});
26
- f(this, "attrs", {});
27
- const { forwardedRef: s, class: i, className: l, lismClass: a, variant: e, style: h = {}, _propConfig: n = {}, ...c } = t;
28
- this.styles = { ...h }, this._propConfig = { ...n };
29
- let o = a || "";
30
- if (e && a) {
31
- const y = a.split(" "), d = y[0], m = `${d}--${e}`;
32
- o = [d, m, ...y.slice(1)].join(" ");
22
+ a(this, "className", "");
23
+ a(this, "uClasses", []);
24
+ a(this, "lismState", []);
25
+ a(this, "styles", {});
26
+ a(this, "attrs", {});
27
+ a(this, "_propConfig");
28
+ const { forwardedRef: t, class: i, className: e, lismClass: n, variant: r, style: f = {}, _propConfig: h = {}, ...y } = s;
29
+ this.styles = { ...f }, this._propConfig = { ...h };
30
+ let c = n || "";
31
+ if (r && n) {
32
+ const m = n.split(" "), o = m[0], S = `${o}--${r}`;
33
+ c = [o, S, ...m.slice(1)].join(" ");
33
34
  }
34
- z(c) || (this.attrs = { ...c }, this.analyzeProps()), s && (this.attrs.ref = s), this.className = x(l || i, o, this.lismState, this.uClasses);
35
+ L(y) || (this.attrs = { ...y }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = w(e || i, c, this.lismState, this.uClasses);
35
36
  }
36
- analyzeState(t, s) {
37
- const { className: i, preset: l, presetClass: a, customVar: e, tokenKey: h, setStyles: n } = t;
38
- 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, h)) : n && this.addStyles(n(s)));
37
+ analyzeState(s, t) {
38
+ const { className: i, preset: e, presetClass: n, customVar: r, tokenKey: f, setStyles: h } = s;
39
+ t === !0 ? this.lismState.push(i) : e && U(e, t) ? this.lismState.push(`${i} ${n}:${String(t)}`) : t && (this.lismState.push(i), f && r ? this.addStyle(r, g(t, f)) : h && typeof t == "string" && this.addStyles(h(t)));
39
40
  }
40
41
  // prop解析
41
42
  analyzeProps() {
42
- Object.keys(this.attrs).forEach((t) => {
43
- if (Object.hasOwn(U, t)) {
44
- const s = this.extractProp(t), i = U[t];
45
- typeof i == "string" ? s && this.lismState.push(i) : this.analyzeState(i, s);
46
- } else if (Object.hasOwn(S, t)) {
47
- const s = this.attrs[t];
48
- delete this.attrs[t], this.analyzeLismProp(t, s);
49
- } else if (t === "hov") {
50
- const s = this.extractProp(t);
51
- this.setHovProps(s);
52
- } else if (t === "css") {
53
- const s = this.extractProp("css");
54
- this.addStyles(s);
43
+ Object.keys(this.attrs).forEach((s) => {
44
+ if (Object.hasOwn(C, s)) {
45
+ const t = this.extractProp(s), i = C[s];
46
+ typeof i == "string" ? t && this.lismState.push(i) : this.analyzeState(i, t);
47
+ } else if (Object.hasOwn($, s)) {
48
+ const t = this.attrs[s];
49
+ delete this.attrs[s], this.analyzeLismProp(s, t);
50
+ } else if (s === "hov") {
51
+ const t = this.extractProp(s);
52
+ this.setHovProps(t);
53
+ } else if (s === "css") {
54
+ const t = this.extractProp("css");
55
+ this.addStyles(t);
55
56
  }
56
57
  });
57
58
  }
58
59
  // Lism Prop 解析
59
- analyzeLismProp(t, s) {
60
- if (s == null) return;
61
- let i = S[t] || null;
60
+ analyzeLismProp(s, t) {
61
+ var r;
62
+ if (t == null) return;
63
+ let i = $[s] || null;
62
64
  if (i === null) return;
63
- this._propConfig[t] && (i = Object.assign({}, i, this._propConfig[t]));
64
- const { base: l, ...a } = _(s);
65
- this.setAttrs(t, l, i), Object.keys(a).forEach((e) => {
66
- this.setAttrs(t, a[e], i, e);
65
+ (r = this._propConfig) != null && r[s] && (i = Object.assign({}, i, this._propConfig[s]));
66
+ const { base: e, ...n } = z(t);
67
+ this.setAttrs(s, e, i), Object.keys(n).forEach((f) => {
68
+ i && this.setAttrs(s, n[f], i, f);
67
69
  });
68
70
  }
69
- addUtil(t) {
70
- this.uClasses.push(t);
71
+ addUtil(s) {
72
+ this.uClasses.push(s);
71
73
  }
72
- addUtils(t) {
73
- this.uClasses.push(...t);
74
+ addUtils(s) {
75
+ this.uClasses.push(...s);
74
76
  }
75
77
  // addState(state) {
76
78
  // this.stateClasses.push(state);
77
79
  // }
78
- addStyle(t, s) {
79
- this.styles[t] = s;
80
+ addStyle(s, t) {
81
+ this.styles[s] = t;
80
82
  }
81
- addStyles(t) {
82
- this.styles = { ...this.styles, ...t };
83
+ addStyles(s) {
84
+ this.styles = { ...this.styles, ...s };
83
85
  }
84
- addAttrs(t) {
85
- this.addStyles(t.styles || {}), this.addUtils(t.utils || []);
86
+ addAttrs(s) {
87
+ this.addStyles(s.styles || {}), this.addUtils(s.utils || []);
86
88
  }
87
- extractProp(t) {
88
- let s = this.attrs[t];
89
- return this.attrs[t] === void 0 ? null : (delete this.attrs[t], s);
89
+ extractProp(s) {
90
+ const t = this.attrs[s];
91
+ return this.attrs[s] === void 0 ? null : (delete this.attrs[s], t);
90
92
  }
91
- extractProps(t) {
92
- const s = {};
93
- return t.forEach((i) => {
94
- this.attrs[i] !== void 0 && (s[i] = this.attrs[i], delete this.attrs[i]);
95
- }), s;
93
+ extractProps(s) {
94
+ const t = {};
95
+ return s.forEach((i) => {
96
+ this.attrs[i] !== void 0 && (t[i] = this.attrs[i], delete this.attrs[i]);
97
+ }), t;
96
98
  }
97
99
  // utilクラスを追加するか、styleにセットするかの分岐処理 @base
98
100
  // 値が null, undefined, '', false の時はスキップ
99
- setAttrs(t, s, i = {}, l = "") {
100
- if (s == null || s === "" || s === !1) return;
101
- let a = `--${t}`, e = `-${i.utilKey || t}`;
102
- if (l && (a = `--${t}_${l}`, e += `_${l}`), typeof s == "string" && s.startsWith(":")) {
103
- this.addUtil(`${e}:${s.replace(":", "")}`);
101
+ setAttrs(s, t, i = {}, e = "") {
102
+ if (t == null || t === "" || t === !1) return;
103
+ let n = `--${s}`, r = `-${String(i.utilKey || s)}`;
104
+ if (e && (n = `--${s}_${e}`, r += `_${e}`), typeof t == "string" && t.startsWith(":")) {
105
+ this.addUtil(`${r}:${t.replace(":", "")}`);
104
106
  return;
105
107
  }
106
- if (!l) {
107
- const { presets: d, tokenClass: m, utils: P, shorthands: C } = i;
108
- if (d && g(d, s)) {
109
- this.addUtil(`${e}:${s}`);
108
+ if (!e) {
109
+ const { presets: S, tokenClass: E, utils: P, shorthands: b } = i;
110
+ if (S && U(S, t)) {
111
+ const u = typeof t == "string" || typeof t == "number" ? String(t) : "";
112
+ u && this.addUtil(`${r}:${u}`);
110
113
  return;
111
114
  }
112
- if (m && V(i.token, s)) {
113
- this.addUtil(`${e}:${s}`);
115
+ if (E && i.token && x(i.token, t)) {
116
+ const u = typeof t == "string" || typeof t == "number" ? String(t) : "";
117
+ u && this.addUtil(`${r}:${u}`);
114
118
  return;
115
119
  }
116
- let u = "";
117
- if (P && (u = O(P, s)), !u && C && (u = O(C, s, !0)), u) {
118
- this.addUtil(`${e}:${u}`);
120
+ let d = "";
121
+ if (P && typeof t == "string" && (d = O(P, t)), !d && b && typeof t == "string" && (d = O(b, t, !0)), d) {
122
+ this.addUtil(`${r}:${d}`);
119
123
  return;
120
124
  }
121
125
  }
122
- if (s === !0 || s === "-") {
123
- this.addUtil(e);
126
+ if (t === !0 || t === "-") {
127
+ this.addUtil(r);
124
128
  return;
125
129
  }
126
- let { prop: h, isVar: n, alwaysVar: c, token: o, bp: y } = i;
127
- if (o && (s = $(s, o)), !l) {
128
- if (n) {
129
- this.addStyle(`--${t}`, s);
130
+ const { prop: f, isVar: h, alwaysVar: y, token: c, bp: m } = i;
131
+ let o;
132
+ if (c && (typeof t == "string" || typeof t == "number") ? o = g(t, c) : typeof t == "string" || typeof t == "number" ? o = t : o = JSON.stringify(t), !e) {
133
+ if (h) {
134
+ this.addStyle(`--${s}`, o);
130
135
  return;
131
- } else if (!y && !c) {
132
- this.addStyle(h, s);
136
+ } else if (!m && !y) {
137
+ this.addStyle(f, o);
133
138
  return;
134
139
  }
135
140
  }
136
- this.addUtil(e), this.addStyle(a, s);
141
+ this.addUtil(r), this.addStyle(n, o);
137
142
  }
138
143
  // setPassProps(passVars) {
139
144
  // let dataList = [];
@@ -148,29 +153,39 @@ class L {
148
153
  // this.addStyle(`--pass_${propName}`, value);
149
154
  // });
150
155
  // }
151
- setHovProps(t) {
152
- t && (t === "-" || t === !0 ? this.addUtil("-hov") : typeof t == "string" ? j(t).forEach((s) => {
153
- this.addUtil(`-hov:${s}`);
154
- }) : typeof t == "object" && Object.keys(t).forEach((s) => {
155
- let i = t[s];
156
- i == null || i === "" || i === !1 || (i === "-" || i === !0 ? this.addUtil(`-hov:${s}`) : s === "class" ? j(i).forEach((l) => {
157
- this.addUtil(`-hov:${l}`);
158
- }) : (i = $(i, w(s)), this.addUtil(`-hov:${s}`), this.addStyle(`--hov-${s}`, i)));
156
+ setHovProps(s) {
157
+ s && (s === "-" || s === !0 ? this.addUtil("-hov") : typeof s == "string" ? k(s).forEach((t) => {
158
+ this.addUtil(`-hov:${t}`);
159
+ }) : typeof s == "object" && Object.keys(s).forEach((t) => {
160
+ const i = s[t];
161
+ if (!(i == null || i === "" || i === !1)) {
162
+ if (i === "-" || i === !0)
163
+ this.addUtil(`-hov:${t}`);
164
+ else if (t === "class")
165
+ k(i).forEach((e) => {
166
+ this.addUtil(`-hov:${e}`);
167
+ });
168
+ else if (typeof i == "string" || typeof i == "number") {
169
+ const e = g(i, T(t));
170
+ this.addUtil(`-hov:${t}`), this.addStyle(`--hov-${t}`, e);
171
+ }
172
+ }
159
173
  }));
160
174
  }
161
175
  }
162
- function X(r) {
163
- if (r.length === 0)
176
+ function Y(l) {
177
+ if (Object.keys(l).length === 0)
164
178
  return {};
165
- const { layout: t, ...s } = r, i = new L(A(t, s));
166
- return b({
179
+ const { layout: s, ...t } = l, i = new H(A(s, t));
180
+ return j({
167
181
  className: i.className,
168
- style: b(i.styles),
182
+ style: j(i.styles),
169
183
  //filterEmptyObj(styles), // filterEmptyObj は最後にかける
170
184
  ...i.attrs
171
185
  // 処理されずに残っているprops
172
186
  });
173
187
  }
174
188
  export {
175
- X as default
189
+ H as LismPropsData,
190
+ Y as default
176
191
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,5 @@
1
- export default function getMaybeCssVar(value: any, tokenKey: any): any;
2
- export function getMaybeSpaceVar(value: any): any;
3
- export function getMaybeColorVar(value: any): any;
1
+ type CssValue = string | number;
2
+ export default function getMaybeCssVar(value: CssValue, tokenKey: string | null | undefined | false): string;
3
+ export declare function getMaybeSpaceVar(value: CssValue): string;
4
+ export declare function getMaybeColorVar(value: CssValue): string;
5
+ export {};
@@ -1,34 +1,34 @@
1
- import { TOKENS as t } from "../config/index.js";
1
+ import { TOKENS as o } from "../config/index.js";
2
2
  import f from "./helper/isNumStr.js";
3
3
  import n from "./getMaybeTokenValue.js";
4
- function b(r, o) {
5
- if (!o) return r;
6
- switch (o) {
4
+ function b(r, t) {
5
+ if (!t) return String(r);
6
+ switch (t) {
7
7
  case "space":
8
8
  return s(r);
9
9
  case "color":
10
10
  return p(r);
11
11
  case "bxsh":
12
- return r === "0" || r === 0 ? "none" : n(o, r, t);
12
+ return r === "0" || r === 0 ? "none" : n(t, r, o);
13
13
  default:
14
- return n(o, r, t);
14
+ return n(t, r, o);
15
15
  }
16
16
  }
17
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;
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(" ") : String(r);
19
19
  }
20
20
  function p(r) {
21
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)`;
22
+ const t = r.split(":");
23
+ if (t.length === 3) {
24
+ const [i, c, e] = t;
25
+ return `color-mix(in srgb, ${n("color", i, o)} ${e}, ${n("color", c, o)})`;
26
+ } else if (t.length === 2) {
27
+ const [i, c] = t;
28
+ return `color-mix(in srgb, ${n("color", i, o)} ${c}, transparent)`;
29
29
  }
30
30
  }
31
- return n("color", r, t);
31
+ return n("color", r, o);
32
32
  }
33
33
  export {
34
34
  b as default,
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,13 @@
1
+ type TokenValue = string | number;
2
+ type TokenConfigValues = Set<string> | string[] | readonly string[];
3
+ type TokenConfigValuesObj = {
4
+ pre?: string;
5
+ values?: TokenConfigValues;
6
+ };
7
+ type TokenConfigProp = TokenConfigValues | TokenConfigValuesObj;
8
+ type TokensConfig = Record<string, TokenConfigProp>;
1
9
  /**
2
10
  * Note: コンポーネント使用時だけでなく、CSSビルド時にも呼び出される。そのため、TOKENSを引数で受け取る必要がある。
3
11
  */
4
- export default function getMaybeTokenValue(tokenKey: any, value: any, TOKENS: any): any;
12
+ export default function getMaybeTokenValue(tokenKey: string, value: TokenValue, TOKENS: TokensConfig): string;
13
+ export {};
@@ -1,26 +1,26 @@
1
- function c(s, r, n) {
2
- if (typeof s != "string") return r;
3
- if (s === "color") {
4
- let i = c("c", r, n);
5
- return i === r && (i = c("palette", r, n)), i;
1
+ function a(n, t, f) {
2
+ if (n === "color") {
3
+ let e = a("c", t, f);
4
+ return e === String(t) && (e = a("palette", t, f)), e;
6
5
  }
7
- const t = n[s];
8
- if (!t) return r;
9
- if (typeof r == "number" && (r = `${r}`), t instanceof Set) {
10
- if (t.has(r))
11
- return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${s}--${r})`;
12
- } else if (Array.isArray(t)) {
13
- if (t.includes(r))
14
- return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${s}--${r})`;
15
- } else if (typeof t == "object") {
16
- const { pre: i = "", values: f = [] } = t || {};
17
- if (f instanceof Set && f.has(r))
18
- return `var(${i}${r})`;
19
- if (Array.isArray(f) && f.includes(r))
20
- return `var(${i}${r})`;
6
+ const i = f[n];
7
+ if (!i) return String(t);
8
+ let r = typeof t == "number" ? `${t}` : t;
9
+ if (i instanceof Set) {
10
+ if (i.has(r))
11
+ return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${n}--${r})`;
12
+ } else if (Array.isArray(i)) {
13
+ if (i.includes(r))
14
+ return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${n}--${r})`;
15
+ } else if ("pre" in i || "values" in i) {
16
+ const { pre: e = "", values: s = [] } = i;
17
+ if (s instanceof Set && s.has(r))
18
+ return `var(${e}${r})`;
19
+ if (Array.isArray(s) && s.includes(r))
20
+ return `var(${e}${r})`;
21
21
  }
22
- return r;
22
+ return String(t);
23
23
  }
24
24
  export {
25
- c as default
25
+ a as default
26
26
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,7 @@
1
- export default function getUtilKey(utils: any, value: any, isShorthand?: boolean): any;
1
+ /**
2
+ * ユーティリティ化できるキーワードのチェック。
3
+ *
4
+ * utils: クラス自体が省略名を使って用意される { val: value } → -prop:val{property: value}
5
+ * shorthand: クラスはpresetsで出力されてて、コンポーネント側でただ呼び出すための省略名リスト {val: value} → -prop:value{property: value}
6
+ */
7
+ export default function getUtilKey(utils: Record<string, unknown> | undefined, value: string, isShorthand?: boolean): string;
@@ -1,11 +1,11 @@
1
- function o(e, r, f = !1) {
1
+ function o(e, r, n = !1) {
2
2
  if (e == null || typeof e != "object") return "";
3
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;
4
+ return n ? String(e[r]) : r;
5
+ if (n) return "";
6
+ for (const [t, f] of Object.entries(e))
7
+ if (f === r)
8
+ return t;
9
9
  return "";
10
10
  }
11
11
  export {
@@ -0,0 +1 @@
1
+ export {};
@@ -1,11 +1,14 @@
1
+ type Primitive = string | number | boolean | null | undefined;
2
+ type AttsValue = Primitive | AttsValue[] | Set<string | number> | Record<string, Primitive>;
1
3
  /**
2
4
  * 配列と文字列だけを受け取るようにしたclassnamesやclsxの代替関数。
3
5
  * 従来の使い方でObjectを渡したいようなケースが出てきた時は、以下のように書き換えて使える。
4
- * joinAtts({'foo': isFoo, 'bar': isBar });
6
+ * atts({'foo': isFoo, 'bar': isBar });
5
7
  * ↓
6
- * joinAtts(isFoo && 'foo', isBar && 'bar');
8
+ * atts(isFoo && 'foo', isBar && 'bar');
7
9
  *
8
10
  * arguments&whileループとの差はなかった(結果が誤差の範囲 or その時によって反転する)
9
11
  * flat()やfilter()を使うとシンプルになるが、処理速度が数倍になる。
10
12
  */
11
- export default function atts(...args: any[]): string;
13
+ export default function atts(...args: AttsValue[]): string;
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,20 @@
1
- export default function filterEmptyObj(obj: any): any;
1
+ /**
2
+ * オブジェクトから空の値を持つプロパティを除外した新しいオブジェクトを返す(非破壊的)
3
+ *
4
+ * 以下の値を持つプロパティが除外されます:
5
+ * - 空文字列 ('')
6
+ * - null
7
+ * - undefined
8
+ * - 空のオブジェクト ({})
9
+ * - 空の配列 ([])
10
+ *
11
+ * 注意:0、false などの falsy な値は保持されます
12
+ *
13
+ * @param {Object} obj - フィルタリング対象のオブジェクト
14
+ * @returns {Object} 空の値を除外した新しいオブジェクト
15
+ *
16
+ * @example
17
+ * filterEmptyObj({ a: 'foo', b: '', c: null, d: 0 })
18
+ * // => { a: 'foo', d: 0 }
19
+ */
20
+ export default function filterEmptyObj(obj: Record<string, unknown>): Record<string, unknown>;
@@ -1,9 +1,10 @@
1
- import f from "./isEmptyObj.js";
2
- function n(e) {
3
- for (const t in e)
4
- (e[t] === "" || e[t] === null || e[t] === void 0 || typeof e[t] == "object" && f(e[t])) && delete e[t];
1
+ import i from "./isEmptyObj.js";
2
+ function r(t) {
3
+ const e = {};
4
+ for (const n in t)
5
+ t[n] === "" || t[n] === null || t[n] === void 0 || typeof t[n] == "object" && i(t[n]) || (e[n] = t[n]);
5
6
  return e;
6
7
  }
7
8
  export {
8
- n as default
9
+ r as default
9
10
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * object が keys のいずれかをキーとして持っているか。
3
3
  */
4
- export default function hasSomeKeys(object: object, keys: (string | number)[]): boolean;
4
+ export default function hasSomeKeys(object: object, keys: readonly (string | number)[] | (string | number)[]): boolean;
@@ -1 +1,4 @@
1
- export default function isNumStr(val: any): boolean;
1
+ /**
2
+ * '0', '10', など、数値を示す文字列かどうかを判定する
3
+ */
4
+ export default function isNumStr(val: unknown): val is `${number}`;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,8 @@
1
- export default function objMap(obj: any, callback: any): any;
1
+ /**
2
+ * Objectの各値に関数を通して返す。PHP の array_map 的な.
3
+ *
4
+ * 1. Object.keys() で keyの配列を取得
5
+ * 2. forEach() で その key に対する値に処理を加える。
6
+ * 3. 処理が加わったオブジェクトを返す
7
+ */
8
+ export default function objMap<T extends Record<string, unknown>, U>(obj: T, callback: (value: T[keyof T]) => U): Record<keyof T, U>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export default function splitWithComma(str: any): any[];
1
+ export default function splitWithComma(str: string | string[]): string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,3 @@
1
- export default function isPresetValue(presets: any, value: any): boolean;
1
+ type PresetValue = Set<string> | string[] | readonly string[];
2
+ export default function isPresetValue(presets: PresetValue, value: unknown): boolean;
3
+ export {};
@@ -1,6 +1,13 @@
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;
1
+ function t(e, r) {
2
+ let n;
3
+ if (typeof r == "number")
4
+ n = `${r}`;
5
+ else if (typeof r == "string")
6
+ n = r;
7
+ else
8
+ return !1;
9
+ return e instanceof Set ? e.has(n) : Array.isArray(e) ? e.includes(n) : !1;
3
10
  }
4
11
  export {
5
- f as default
12
+ t as default
6
13
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export default function isTokenValue(tokenKey: any, value: any): any;
1
+ export default function isTokenValue(tokenKey: string, value: unknown): boolean;