lism-css 0.14.0 → 0.16.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.
- package/README.ja.md +6 -6
- package/README.md +8 -7
- package/bin/build-config.js +1 -4
- package/bin/cli.mjs +13 -3
- package/config/defaults/props.ts +11 -14
- package/config/defaults/tokens.ts +2 -2
- package/config/defaults/traits.ts +4 -0
- package/dist/components/Lism/Lism.d.ts +2 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +57 -54
- package/dist/components/layout/AutoColumns/AutoColumns.d.ts +4 -0
- package/dist/components/layout/{FluidCols/FluidCols.stories.d.ts → AutoColumns/AutoColumns.stories.d.ts} +3 -3
- package/dist/components/layout/AutoColumns/index.d.ts +3 -0
- package/dist/components/layout/AutoColumns/index.js +8 -0
- package/dist/components/layout/SwitchColumns/SwitchColumns.d.ts +4 -0
- package/dist/components/layout/{SwitchCols/SwitchCols.stories.d.ts → SwitchColumns/SwitchColumns.stories.d.ts} +3 -3
- package/dist/components/layout/SwitchColumns/index.d.ts +3 -0
- package/dist/components/layout/SwitchColumns/index.js +8 -0
- package/dist/components/layout/WithSide/WithSide.d.ts +4 -0
- package/dist/components/layout/{SideMain/SideMain.stories.d.ts → WithSide/WithSide.stories.d.ts} +3 -3
- package/dist/components/layout/WithSide/index.d.ts +3 -0
- package/dist/components/layout/WithSide/index.js +8 -0
- package/dist/config/default-config.d.ts +6 -13
- package/dist/config/defaults/props.d.ts +5 -14
- package/dist/config/defaults/props.js +7 -12
- package/dist/config/defaults/tokens.d.ts +2 -2
- package/dist/config/defaults/tokens.js +2 -2
- package/dist/config/defaults/traits.d.ts +4 -0
- package/dist/config/defaults/traits.js +5 -1
- package/dist/config/index.d.ts +12 -26
- package/dist/css/base/set.css +1 -1
- package/dist/css/base.css +1 -1
- package/dist/css/main.css +1 -1
- package/dist/css/main_no_layer.css +1 -1
- package/dist/css/primitives/layout.css +1 -1
- package/dist/css/props.css +1 -1
- package/dist/css/trait.css +1 -0
- package/dist/css/utility.css +1 -1
- package/dist/lib/getLayoutProps.js +25 -25
- package/dist/lib/getLismProps.d.ts +5 -5
- package/dist/lib/getLismProps.js +101 -102
- package/dist/lib/types/LayoutProps.d.ts +7 -7
- package/dist/lib/types/TraitProps.d.ts +2 -2
- package/package.json +1 -1
- package/packages/astro/index.ts +6 -3
- package/packages/astro/layout/{FluidCols/FluidCols.astro → AutoColumns/AutoColumns.astro} +3 -3
- package/packages/astro/layout/AutoColumns/index.ts +4 -0
- package/packages/astro/layout/Flex/Flex.astro +3 -2
- package/packages/astro/layout/Flow/Flow.astro +2 -2
- package/packages/astro/layout/{SwitchCols/SwitchCols.astro → SwitchColumns/SwitchColumns.astro} +3 -3
- package/packages/astro/layout/SwitchColumns/index.ts +4 -0
- package/packages/astro/layout/{SideMain/SideMain.astro → WithSide/WithSide.astro} +3 -3
- package/packages/astro/layout/WithSide/index.ts +4 -0
- package/packages/astro/types.ts +3 -0
- package/src/scss/_auto_output.scss +12 -11
- package/src/scss/_prop-config.scss +5 -14
- package/src/scss/_with_layer.scss +8 -4
- package/src/scss/base/_html.scss +4 -4
- package/src/scss/base/set/{_innerRs.scss → _bdrsInner.scss} +1 -1
- package/src/scss/base/set/_hov.scss +4 -4
- package/src/scss/base/set/_revert.scss +6 -0
- package/src/scss/base/set/index.scss +2 -4
- package/src/scss/base/tokens/_shadow.scss +18 -12
- package/src/scss/base/tokens/_tokens.scss +7 -16
- package/src/scss/main_no_layer.scss +4 -1
- package/src/scss/primitives/layout/{_fluidCols.scss → _autoColumns.scss} +1 -1
- package/src/scss/primitives/layout/_flow.scss +1 -2
- package/src/scss/primitives/layout/{_switchCols.scss → _switchColumns.scss} +2 -2
- package/src/scss/primitives/layout/{_sideMain.scss → _withSide.scss} +1 -1
- package/src/scss/primitives/layout/index.scss +3 -3
- package/src/scss/props/_hover.scss +28 -17
- package/src/scss/props/_size.scss +1 -1
- package/src/scss/{base/set → trait/has}/_gutter.scss +1 -1
- package/src/scss/trait/has/_mask.scss +6 -0
- package/src/scss/trait/has/_snap.scss +11 -0
- package/src/scss/trait/has/_transition.scss +8 -0
- package/src/scss/trait/index.scss +12 -0
- package/src/scss/{primitives/trait → trait/is}/_container.scss +2 -2
- package/src/scss/utility/{_itemDivider.scss → _divide.scss} +10 -2
- package/src/scss/utility/_trimHL.scss +3 -29
- package/src/scss/utility/index.scss +1 -2
- package/dist/components/layout/FluidCols/FluidCols.d.ts +0 -4
- package/dist/components/layout/FluidCols/index.d.ts +0 -1
- package/dist/components/layout/FluidCols/index.js +0 -8
- package/dist/components/layout/SideMain/SideMain.d.ts +0 -4
- package/dist/components/layout/SideMain/index.d.ts +0 -1
- package/dist/components/layout/SideMain/index.js +0 -8
- package/dist/components/layout/SwitchCols/SwitchCols.d.ts +0 -4
- package/dist/components/layout/SwitchCols/index.d.ts +0 -1
- package/dist/components/layout/SwitchCols/index.js +0 -8
- package/dist/css/primitives/trait.css +0 -1
- package/packages/astro/layout/FluidCols/index.ts +0 -1
- package/packages/astro/layout/SideMain/index.ts +0 -1
- package/packages/astro/layout/SwitchCols/index.ts +0 -1
- package/src/scss/base/set/_mask.scss +0 -6
- package/src/scss/base/set/_transition.scss +0 -11
- package/src/scss/primitives/trait/index.scss +0 -6
- package/src/scss/utility/_snap.scss +0 -8
- /package/src/scss/{primitives/trait → trait/is}/_boxLink.scss +0 -0
- /package/src/scss/{primitives/trait → trait/is}/_coverLink.scss +0 -0
- /package/src/scss/{primitives/trait → trait/is}/_layer.scss +0 -0
- /package/src/scss/{primitives/trait → trait/is}/_wrapper.scss +0 -0
package/dist/lib/getLismProps.js
CHANGED
|
@@ -1,146 +1,149 @@
|
|
|
1
|
-
import { TRAITS as C, PROPS as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { TRAITS as C, PROPS as c } from "../config/index.js";
|
|
2
|
+
import V from "./getLayoutProps.js";
|
|
3
|
+
import E from "./getAtomicProps.js";
|
|
4
|
+
import g from "./isPresetValue.js";
|
|
5
5
|
import x from "./isTokenValue.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import $ from "./getUtilKey.js";
|
|
7
|
+
import d from "./getMaybeCssVar.js";
|
|
8
8
|
import w from "./getBpData.js";
|
|
9
9
|
import A from "./helper/atts.js";
|
|
10
10
|
import _ from "./helper/isEmptyObj.js";
|
|
11
|
-
import
|
|
11
|
+
import S from "./helper/filterEmptyObj.js";
|
|
12
12
|
import b from "./helper/mergeSet.js";
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
return
|
|
13
|
+
import z from "./helper/splitWithComma.js";
|
|
14
|
+
const L = (n) => {
|
|
15
|
+
const s = c[n];
|
|
16
|
+
return s && s?.token || "";
|
|
17
17
|
};
|
|
18
|
-
class
|
|
18
|
+
class T {
|
|
19
19
|
// 最終出力 className
|
|
20
20
|
className = "";
|
|
21
|
-
// 出力順のためのクラスバケット: [primitiveClass] [uClasses]
|
|
22
|
-
// - primitiveClass : a--* / l--* / is--* の primitive クラス(getAtomicProps → getLayoutProps → analyzeTrait の順で push)
|
|
23
|
-
// - uClasses : set--* → u--* → -property の順で push される utility クラス
|
|
24
21
|
primitiveClass = [];
|
|
22
|
+
setClasses = [];
|
|
23
|
+
traitClasses = [];
|
|
25
24
|
uClasses = [];
|
|
25
|
+
propClasses = [];
|
|
26
26
|
styles = {};
|
|
27
27
|
attrs = {};
|
|
28
28
|
_propConfig;
|
|
29
|
-
constructor(
|
|
30
|
-
const { forwardedRef: t, class:
|
|
31
|
-
this.styles = { ...r }, this._propConfig = { ...
|
|
29
|
+
constructor(s) {
|
|
30
|
+
const { forwardedRef: t, class: i, className: e, primitiveClass: o, style: r = {}, _propConfig: a = {}, ...u } = s;
|
|
31
|
+
this.styles = { ...r }, this._propConfig = { ...a }, o && o.length && (this.primitiveClass = [...o]), _(u) || (this.attrs = { ...u }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = this.buildClassName(e, i);
|
|
32
32
|
}
|
|
33
33
|
// 最終クラス文字列の組み立て(出力順の唯一の確定地点)
|
|
34
|
-
// 出力順: [className&class] [primitiveClass] [uClasses]
|
|
34
|
+
// 出力順: [className&class] [primitiveClass] [setClasses] [traitClasses] [uClasses] [propClasses]
|
|
35
35
|
// className と class が両方来た場合は両方マージする(atts 内で重複は除去される)。
|
|
36
|
-
buildClassName(
|
|
37
|
-
return A(
|
|
36
|
+
buildClassName(s, t) {
|
|
37
|
+
return A(s, t, this.primitiveClass, this.setClasses, this.traitClasses, this.uClasses, this.propClasses);
|
|
38
38
|
}
|
|
39
|
-
analyzeTrait(
|
|
40
|
-
const { className:
|
|
41
|
-
t === !0 ? this.
|
|
39
|
+
analyzeTrait(s, t) {
|
|
40
|
+
const { className: i, preset: e, presetClass: o, customVar: r, tokenKey: a } = s;
|
|
41
|
+
t === !0 ? this.traitClasses.push(i) : e && g(e, t) ? this.traitClasses.push(`${i} ${o}:${String(t)}`) : t && (this.traitClasses.push(i), a && r && this.addStyle(r, d(t, a)));
|
|
42
42
|
}
|
|
43
43
|
// prop解析
|
|
44
44
|
analyzeProps() {
|
|
45
|
-
const
|
|
46
|
-
b(void 0,
|
|
47
|
-
if (Object.hasOwn(C,
|
|
48
|
-
const e = this.extractProp(
|
|
49
|
-
typeof
|
|
50
|
-
} else if (Object.hasOwn(
|
|
51
|
-
const e = this.attrs[
|
|
52
|
-
delete this.attrs[
|
|
53
|
-
} else if (
|
|
54
|
-
const e = this.extractProp(
|
|
45
|
+
const s = this.extractProp("set"), t = this.extractProp("util");
|
|
46
|
+
b(void 0, s).forEach((i) => this.addSet(i)), b(void 0, t).forEach((i) => this.addUtil(`u--${i}`)), Object.keys(this.attrs).forEach((i) => {
|
|
47
|
+
if (Object.hasOwn(C, i)) {
|
|
48
|
+
const e = this.extractProp(i), o = C[i];
|
|
49
|
+
typeof o == "string" ? e && this.traitClasses.push(o) : this.analyzeTrait(o, e);
|
|
50
|
+
} else if (Object.hasOwn(c, i)) {
|
|
51
|
+
const e = this.attrs[i];
|
|
52
|
+
delete this.attrs[i], this.analyzeLismProp(i, e);
|
|
53
|
+
} else if (i === "hov") {
|
|
54
|
+
const e = this.extractProp(i);
|
|
55
55
|
this.setHovProps(e);
|
|
56
|
-
} else if (
|
|
56
|
+
} else if (i === "css") {
|
|
57
57
|
const e = this.extractProp("css");
|
|
58
58
|
this.addStyles(e);
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
// Lism Prop 解析
|
|
63
|
-
analyzeLismProp(
|
|
63
|
+
analyzeLismProp(s, t) {
|
|
64
64
|
if (t == null) return;
|
|
65
|
-
let
|
|
66
|
-
if (
|
|
67
|
-
this._propConfig?.[
|
|
68
|
-
const { base: e, ...
|
|
69
|
-
this.setAttrs(
|
|
70
|
-
|
|
65
|
+
let i = c[s] || null;
|
|
66
|
+
if (i === null) return;
|
|
67
|
+
this._propConfig?.[s] && (i = Object.assign({}, i, this._propConfig[s]));
|
|
68
|
+
const { base: e, ...o } = w(t);
|
|
69
|
+
this.setAttrs(s, e, i), Object.keys(o).forEach((r) => {
|
|
70
|
+
i && this.setAttrs(s, o[r], i, r);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
this.
|
|
73
|
+
addSet(s) {
|
|
74
|
+
this.setClasses.push(`set--${s}`);
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
this.uClasses.push(
|
|
76
|
+
addUtil(s) {
|
|
77
|
+
this.uClasses.push(s);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.
|
|
79
|
+
addUtils(s) {
|
|
80
|
+
this.uClasses.push(...s);
|
|
81
|
+
}
|
|
82
|
+
addProp(s) {
|
|
83
|
+
this.propClasses.push(s);
|
|
84
|
+
}
|
|
85
|
+
addStyle(s, t) {
|
|
86
|
+
this.styles[s] = t;
|
|
84
87
|
}
|
|
85
|
-
addStyles(
|
|
86
|
-
this.styles = { ...this.styles, ...
|
|
88
|
+
addStyles(s) {
|
|
89
|
+
this.styles = { ...this.styles, ...s };
|
|
87
90
|
}
|
|
88
|
-
addAttrs(
|
|
89
|
-
this.addStyles(
|
|
91
|
+
addAttrs(s) {
|
|
92
|
+
this.addStyles(s.styles || {}), this.addUtils(s.utils || []);
|
|
90
93
|
}
|
|
91
|
-
extractProp(
|
|
92
|
-
const t = this.attrs[
|
|
93
|
-
return this.attrs[
|
|
94
|
+
extractProp(s) {
|
|
95
|
+
const t = this.attrs[s];
|
|
96
|
+
return this.attrs[s] === void 0 ? null : (delete this.attrs[s], t);
|
|
94
97
|
}
|
|
95
|
-
extractProps(
|
|
98
|
+
extractProps(s) {
|
|
96
99
|
const t = {};
|
|
97
|
-
return
|
|
98
|
-
this.attrs[
|
|
100
|
+
return s.forEach((i) => {
|
|
101
|
+
this.attrs[i] !== void 0 && (t[i] = this.attrs[i], delete this.attrs[i]);
|
|
99
102
|
}), t;
|
|
100
103
|
}
|
|
101
|
-
//
|
|
104
|
+
// propertyクラスを追加するか、styleにセットするかの分岐処理 @base
|
|
102
105
|
// 値が null, undefined, '', false の時はスキップ
|
|
103
|
-
setAttrs(
|
|
106
|
+
setAttrs(s, t, i = {}, e = "") {
|
|
104
107
|
if (t == null || t === "" || t === !1) return;
|
|
105
|
-
let
|
|
106
|
-
if (e && (
|
|
107
|
-
this.
|
|
108
|
+
let o = `--${s}`, r = `-${String(i.utilKey || s)}`;
|
|
109
|
+
if (e && (o = `--${s}_${e}`, r += `_${e}`), typeof t == "string" && t.startsWith(":")) {
|
|
110
|
+
this.addProp(`${r}:${t.replace(":", "")}`);
|
|
108
111
|
return;
|
|
109
112
|
}
|
|
110
113
|
if (!e) {
|
|
111
|
-
const { presets: m, tokenClass: j, utils:
|
|
112
|
-
if (m &&
|
|
114
|
+
const { presets: m, tokenClass: j, utils: p, shorthands: P } = i;
|
|
115
|
+
if (m && g(m, t)) {
|
|
113
116
|
const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
114
|
-
h && this.
|
|
117
|
+
h && this.addProp(`${r}:${h}`);
|
|
115
118
|
return;
|
|
116
119
|
}
|
|
117
|
-
if (j &&
|
|
120
|
+
if (j && i.token && x(i.token, t)) {
|
|
118
121
|
const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
119
|
-
h && this.
|
|
122
|
+
h && this.addProp(`${r}:${h}`);
|
|
120
123
|
return;
|
|
121
124
|
}
|
|
122
|
-
let
|
|
123
|
-
if (
|
|
124
|
-
this.
|
|
125
|
+
let f = "";
|
|
126
|
+
if (p && typeof t == "string" && (f = $(p, t)), !f && P && typeof t == "string" && (f = $(P, t, !0)), f) {
|
|
127
|
+
this.addProp(`${r}:${f}`);
|
|
125
128
|
return;
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
|
-
if (t === !0
|
|
129
|
-
this.
|
|
131
|
+
if (t === !0) {
|
|
132
|
+
this.addProp(r);
|
|
130
133
|
return;
|
|
131
134
|
}
|
|
132
|
-
const { prop:
|
|
133
|
-
let
|
|
134
|
-
if (y && (typeof t == "string" || typeof t == "number") ?
|
|
135
|
-
if (
|
|
136
|
-
this.addStyle(`--${
|
|
135
|
+
const { prop: a, isVar: u, alwaysVar: O, token: y, bp: k } = i;
|
|
136
|
+
let l;
|
|
137
|
+
if (y && (typeof t == "string" || typeof t == "number") ? l = d(t, y) : typeof t == "string" || typeof t == "number" ? l = t : l = JSON.stringify(t), !e) {
|
|
138
|
+
if (u) {
|
|
139
|
+
this.addStyle(`--${s}`, l);
|
|
137
140
|
return;
|
|
138
141
|
} else if (!k && !O) {
|
|
139
|
-
this.addStyle(
|
|
142
|
+
this.addStyle(a, l);
|
|
140
143
|
return;
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
|
-
this.
|
|
146
|
+
this.addProp(r), this.addStyle(o, l);
|
|
144
147
|
}
|
|
145
148
|
// setPassProps(passVars) {
|
|
146
149
|
// let dataList = [];
|
|
@@ -155,21 +158,17 @@ class L {
|
|
|
155
158
|
// this.addStyle(`--pass_${propName}`, value);
|
|
156
159
|
// });
|
|
157
160
|
// }
|
|
158
|
-
setHovProps(
|
|
159
|
-
|
|
160
|
-
this.
|
|
161
|
-
}) : typeof
|
|
162
|
-
const
|
|
163
|
-
if (!(
|
|
164
|
-
if (
|
|
165
|
-
this.
|
|
166
|
-
else if (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
});
|
|
170
|
-
else if (typeof s == "string" || typeof s == "number") {
|
|
171
|
-
const e = u(s, z(t));
|
|
172
|
-
this.addUtil(`-hov:${t}`), this.addStyle(`--hov-${t}`, e);
|
|
161
|
+
setHovProps(s) {
|
|
162
|
+
s && (s === !0 ? this.addProp("-hov") : typeof s == "string" ? z(s).forEach((t) => {
|
|
163
|
+
this.addProp(`-hov:${t}`);
|
|
164
|
+
}) : typeof s == "object" && Object.keys(s).forEach((t) => {
|
|
165
|
+
const i = s[t];
|
|
166
|
+
if (!(i == null || i === "" || i === !1)) {
|
|
167
|
+
if (i === !0)
|
|
168
|
+
this.addProp(`-hov:${t}`);
|
|
169
|
+
else if (typeof i == "string" || typeof i == "number") {
|
|
170
|
+
const e = d(i, L(t));
|
|
171
|
+
this.addProp(`-hov:-${t}`), this.addStyle(`--hov-${t}`, e);
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
}));
|
|
@@ -178,17 +177,17 @@ class L {
|
|
|
178
177
|
function Y(n) {
|
|
179
178
|
if (Object.keys(n).length === 0)
|
|
180
179
|
return {};
|
|
181
|
-
const { atomic:
|
|
180
|
+
const { atomic: s, layout: t, ...i } = n, e = E(s, i), o = V(t, e), r = new T(o);
|
|
182
181
|
return {
|
|
183
|
-
...
|
|
182
|
+
...S({
|
|
184
183
|
className: r.className,
|
|
185
|
-
style:
|
|
184
|
+
style: S(r.styles)
|
|
186
185
|
}),
|
|
187
186
|
...r.attrs
|
|
188
187
|
// data-* などHTMLの標準属性はそのまま渡す
|
|
189
188
|
};
|
|
190
189
|
}
|
|
191
190
|
export {
|
|
192
|
-
|
|
191
|
+
T as LismPropsData,
|
|
193
192
|
Y as default
|
|
194
193
|
};
|
|
@@ -33,20 +33,20 @@ export interface FlowLayoutProps {
|
|
|
33
33
|
layout: 'flow';
|
|
34
34
|
flow?: CssValue;
|
|
35
35
|
}
|
|
36
|
-
export interface
|
|
37
|
-
layout: '
|
|
36
|
+
export interface AutoColumnsProps {
|
|
37
|
+
layout: 'autoColumns';
|
|
38
38
|
autoFill?: boolean;
|
|
39
39
|
}
|
|
40
|
-
export interface
|
|
41
|
-
layout: '
|
|
40
|
+
export interface WithSideProps {
|
|
41
|
+
layout: 'withSide';
|
|
42
42
|
sideW?: CssValue;
|
|
43
43
|
mainW?: CssValue;
|
|
44
44
|
}
|
|
45
|
-
export interface
|
|
46
|
-
layout: '
|
|
45
|
+
export interface SwitchColumnsProps {
|
|
46
|
+
layout: 'switchColumns';
|
|
47
47
|
breakSize?: CssValue;
|
|
48
48
|
}
|
|
49
|
-
export type LayoutSpecificProps = NoLayoutProps | BoxProps | CenterProps | ClusterProps | ColumnsProps | FlexProps | FlowLayoutProps |
|
|
49
|
+
export type LayoutSpecificProps = NoLayoutProps | BoxProps | CenterProps | ClusterProps | ColumnsProps | FlexProps | FlowLayoutProps | AutoColumnsProps | FrameProps | GridLayoutProps | StackProps | WithSideProps | SwitchColumnsProps | TileGridProps;
|
|
50
50
|
export type LayoutType = Exclude<LayoutSpecificProps, NoLayoutProps>['layout'];
|
|
51
51
|
export interface LayoutProps {
|
|
52
52
|
layout?: LayoutType;
|
|
@@ -23,7 +23,7 @@ export type TraitProps = {
|
|
|
23
23
|
[K in keyof TraitsConfig]?: ExtractTraitValue<TraitsConfig[K]>;
|
|
24
24
|
};
|
|
25
25
|
/** set prop で使われるプリセット値(エディタ補完用) */
|
|
26
|
-
type SetPreset = '
|
|
26
|
+
type SetPreset = 'plain' | 'revert' | 'var:hov' | 'var:bxsh' | 'var:bdrsInner';
|
|
27
27
|
/**
|
|
28
28
|
* set prop の値の型。プリセット値がサジェストされつつ、任意の文字列も受け付ける。
|
|
29
29
|
*
|
|
@@ -34,7 +34,7 @@ type SetPreset = 'gutter' | 'shadow' | 'hov' | 'transition' | 'mask' | 'plain' |
|
|
|
34
34
|
*/
|
|
35
35
|
export type SetPropValue = WithArbitraryString<SetPreset> | WithArbitraryString<SetPreset>[];
|
|
36
36
|
/** util prop で使われるプリセット値(既知の `u--` クラス名・エディタ補完用) */
|
|
37
|
-
type UtilPreset = 'cbox' | 'trim' | '
|
|
37
|
+
type UtilPreset = 'cbox' | 'trim' | 'trimAll' | 'srOnly' | 'clipText' | 'divide' | 'cells';
|
|
38
38
|
/**
|
|
39
39
|
* util prop の値の型。既知の `u--` クラス名がサジェストされつつ、任意の文字列も受け付ける。
|
|
40
40
|
*
|
package/package.json
CHANGED
package/packages/astro/index.ts
CHANGED
|
@@ -22,12 +22,12 @@ export * from './layout/Cluster';
|
|
|
22
22
|
export * from './layout/Columns';
|
|
23
23
|
export * from './layout/Flex';
|
|
24
24
|
export * from './layout/Flow';
|
|
25
|
-
export * from './layout/
|
|
25
|
+
export * from './layout/AutoColumns';
|
|
26
26
|
export * from './layout/Frame';
|
|
27
27
|
export * from './layout/Grid';
|
|
28
|
-
export * from './layout/
|
|
28
|
+
export * from './layout/WithSide';
|
|
29
29
|
export * from './layout/Stack';
|
|
30
|
-
export * from './layout/
|
|
30
|
+
export * from './layout/SwitchColumns';
|
|
31
31
|
export * from './layout/TileGrid';
|
|
32
32
|
|
|
33
33
|
// state (is--)
|
|
@@ -41,3 +41,6 @@ export * from './atomic/Decorator';
|
|
|
41
41
|
export * from './atomic/Divider';
|
|
42
42
|
export * from './atomic/Icon';
|
|
43
43
|
export * from './atomic/Spacer';
|
|
44
|
+
|
|
45
|
+
// Type exports for Astro components
|
|
46
|
+
export type { AstroLismBaseProps, AstroLismFixedLayoutProps, AstroLayoutProps } from './types';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLTag, Polymorphic } from 'astro/types';
|
|
3
3
|
import type { AstroLismFixedLayoutProps } from '../../types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AutoColumnsProps } from 'lism-css/lib/types/LayoutProps';
|
|
5
5
|
import { Lism } from '../../Lism';
|
|
6
6
|
|
|
7
|
-
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<
|
|
7
|
+
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<AutoColumnsProps, 'layout'>;
|
|
8
8
|
|
|
9
9
|
const props = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
<Lism layout="
|
|
12
|
+
<Lism layout="autoColumns" {...props}><slot /></Lism>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLTag, Polymorphic } from 'astro/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AstroLayoutProps } from '../../types';
|
|
4
|
+
import type { FlexProps } from 'lism-css/lib/types/LayoutProps';
|
|
4
5
|
import { Lism } from '../../Lism';
|
|
5
6
|
|
|
6
|
-
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> &
|
|
7
|
+
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLayoutProps<FlexProps>;
|
|
7
8
|
|
|
8
9
|
const props = Astro.props;
|
|
9
10
|
---
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLTag, Polymorphic } from 'astro/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AstroLayoutProps } from '../../types';
|
|
4
4
|
import type { FlowLayoutProps } from 'lism-css/lib/types/LayoutProps';
|
|
5
5
|
import { Lism } from '../../Lism';
|
|
6
6
|
|
|
7
|
-
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> &
|
|
7
|
+
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLayoutProps<FlowLayoutProps>;
|
|
8
8
|
|
|
9
9
|
const props = Astro.props;
|
|
10
10
|
---
|
package/packages/astro/layout/{SwitchCols/SwitchCols.astro → SwitchColumns/SwitchColumns.astro}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLTag, Polymorphic } from 'astro/types';
|
|
3
3
|
import type { AstroLismFixedLayoutProps } from '../../types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SwitchColumnsProps } from 'lism-css/lib/types/LayoutProps';
|
|
5
5
|
import { Lism } from '../../Lism';
|
|
6
6
|
|
|
7
|
-
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<
|
|
7
|
+
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<SwitchColumnsProps, 'layout'>;
|
|
8
8
|
|
|
9
9
|
const props = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
<Lism layout="
|
|
12
|
+
<Lism layout="switchColumns" {...props}><slot /></Lism>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLTag, Polymorphic } from 'astro/types';
|
|
3
3
|
import type { AstroLismFixedLayoutProps } from '../../types';
|
|
4
|
-
import type {
|
|
4
|
+
import type { WithSideProps } from 'lism-css/lib/types/LayoutProps';
|
|
5
5
|
import { Lism } from '../../Lism';
|
|
6
6
|
|
|
7
|
-
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<
|
|
7
|
+
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<WithSideProps, 'layout'>;
|
|
8
8
|
|
|
9
9
|
const props = Astro.props;
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
<Lism layout="
|
|
12
|
+
<Lism layout="withSide" {...props}><slot /></Lism>
|
package/packages/astro/types.ts
CHANGED
|
@@ -17,3 +17,6 @@ export type AstroLismBaseProps = LismProps &
|
|
|
17
17
|
export type AstroLismFixedLayoutProps = Omit<LismProps, 'layout'> & {
|
|
18
18
|
exProps?: Record<string, unknown>;
|
|
19
19
|
};
|
|
20
|
+
|
|
21
|
+
/** レイアウトコンポーネント向けベース型(React の LayoutComponentProps<T, L> に対応) */
|
|
22
|
+
export type AstroLayoutProps<L = object> = AstroLismFixedLayoutProps & Omit<L, 'layout'>;
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
@use './query' as query;
|
|
7
7
|
@use './setting' as setting;
|
|
8
8
|
|
|
9
|
-
/*
|
|
9
|
+
/*
|
|
10
10
|
base_type:
|
|
11
11
|
0 → なし(ユーティリティクラス以外は普通のインラインスタイルのみ)
|
|
12
12
|
1 → .-d{display: var(--d)} (メリット:importantなしでbp対応できる)
|
|
13
|
-
2 → .-p, [class*='-p\:'] {padding: var(--p);} の形式で、
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
2 → alwaysVar 対象。 .-p, [class*='-p\:'] {padding: var(--p);} の形式で、
|
|
14
|
+
ユーティリティクラスは --p をセットする形になる(state 変数として扱う)。
|
|
15
|
+
BPクラスも .-p_$bp { padding: var(--p); --p: var(--p_$bp) !important; } を出力し、
|
|
16
|
+
--p が常に現在値を参照できるようになる。
|
|
17
|
+
デメリット: *= は処理負荷が高い。
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
// マップから値を取得し、nullの場合はデフォルト値を返す
|
|
@@ -218,7 +218,7 @@ $bp_outputs: (
|
|
|
218
218
|
$prop_data: map.get(setting.$props, $key);
|
|
219
219
|
$prop_name: map.get($prop_data, prop);
|
|
220
220
|
$isVar: map_get_with_default($prop_data, isVar, 0);
|
|
221
|
-
$
|
|
221
|
+
$alwaysVar: map_get_with_default($prop_data, alwaysVar, 0);
|
|
222
222
|
$important: map_get_with_default($prop_data, important, setting.$default_important);
|
|
223
223
|
|
|
224
224
|
@if $isVar == 1 {
|
|
@@ -226,11 +226,12 @@ $bp_outputs: (
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
.-#{$key}_#{$bp} {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
@if $overwriteBaseVar == 1 {
|
|
229
|
+
@if $alwaysVar == 1 {
|
|
230
|
+
// state 変数扱い: --prop を単一情報源にし、--prop を上書きして property は var(--prop) を読む
|
|
231
|
+
#{$prop_name}: var(--#{$key}) #{get_important_str($important)};
|
|
233
232
|
--#{$key}: var(--#{$key}_#{$bp}) !important;
|
|
233
|
+
} @else {
|
|
234
|
+
#{$prop_name}: var(--#{$key}_#{$bp}) #{get_important_str($important)};
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
237
|
}
|
|
@@ -22,7 +22,6 @@ $props: (
|
|
|
22
22
|
'2xs': 'var(--fz--2xs)',
|
|
23
23
|
),
|
|
24
24
|
bp: 1,
|
|
25
|
-
alwaysVar: 1,
|
|
26
25
|
),
|
|
27
26
|
'fw': (
|
|
28
27
|
prop: 'font-weight',
|
|
@@ -114,9 +113,10 @@ $props: (
|
|
|
114
113
|
prop: 'opacity',
|
|
115
114
|
utilities: (
|
|
116
115
|
'0': '0',
|
|
117
|
-
'
|
|
118
|
-
'
|
|
119
|
-
'
|
|
116
|
+
'mp': 'var(--o--mp)',
|
|
117
|
+
'p': 'var(--o--p)',
|
|
118
|
+
'pp': 'var(--o--pp)',
|
|
119
|
+
'ppp': 'var(--o--ppp)',
|
|
120
120
|
),
|
|
121
121
|
),
|
|
122
122
|
'v': (
|
|
@@ -317,7 +317,6 @@ $props: (
|
|
|
317
317
|
),
|
|
318
318
|
bp: 1,
|
|
319
319
|
alwaysVar: 1,
|
|
320
|
-
overwriteBaseVar: 1,
|
|
321
320
|
),
|
|
322
321
|
'bxsh': (
|
|
323
322
|
prop: 'box-shadow',
|
|
@@ -327,9 +326,9 @@ $props: (
|
|
|
327
326
|
'20': 'var(--bxsh--20)',
|
|
328
327
|
'30': 'var(--bxsh--30)',
|
|
329
328
|
'40': 'var(--bxsh--40)',
|
|
329
|
+
'50': 'var(--bxsh--50)',
|
|
330
330
|
),
|
|
331
331
|
bp: 1,
|
|
332
|
-
alwaysVar: 1,
|
|
333
332
|
),
|
|
334
333
|
'pos': (
|
|
335
334
|
prop: 'position',
|
|
@@ -405,7 +404,6 @@ $props: (
|
|
|
405
404
|
),
|
|
406
405
|
bp: 1,
|
|
407
406
|
alwaysVar: 1,
|
|
408
|
-
overwriteBaseVar: 1,
|
|
409
407
|
),
|
|
410
408
|
'px': (
|
|
411
409
|
prop: 'padding-inline',
|
|
@@ -423,7 +421,6 @@ $props: (
|
|
|
423
421
|
'80': 'var(--s80)',
|
|
424
422
|
),
|
|
425
423
|
bp: 1,
|
|
426
|
-
alwaysVar: 1,
|
|
427
424
|
),
|
|
428
425
|
'py': (
|
|
429
426
|
prop: 'padding-block',
|
|
@@ -441,7 +438,6 @@ $props: (
|
|
|
441
438
|
'80': 'var(--s80)',
|
|
442
439
|
),
|
|
443
440
|
bp: 1,
|
|
444
|
-
alwaysVar: 1,
|
|
445
441
|
),
|
|
446
442
|
'px-s': (
|
|
447
443
|
prop: 'padding-inline-start',
|
|
@@ -493,7 +489,6 @@ $props: (
|
|
|
493
489
|
),
|
|
494
490
|
bp: 1,
|
|
495
491
|
alwaysVar: 1,
|
|
496
|
-
overwriteBaseVar: 1,
|
|
497
492
|
),
|
|
498
493
|
'mx': (
|
|
499
494
|
prop: 'margin-inline',
|
|
@@ -512,7 +507,6 @@ $props: (
|
|
|
512
507
|
'auto': 'auto',
|
|
513
508
|
),
|
|
514
509
|
bp: 1,
|
|
515
|
-
alwaysVar: 1,
|
|
516
510
|
),
|
|
517
511
|
'my': (
|
|
518
512
|
prop: 'margin-block',
|
|
@@ -531,7 +525,6 @@ $props: (
|
|
|
531
525
|
'auto': 'auto',
|
|
532
526
|
),
|
|
533
527
|
bp: 1,
|
|
534
|
-
alwaysVar: 1,
|
|
535
528
|
),
|
|
536
529
|
'mx-s': (
|
|
537
530
|
prop: 'margin-inline-start',
|
|
@@ -609,8 +602,6 @@ $props: (
|
|
|
609
602
|
),
|
|
610
603
|
),
|
|
611
604
|
bp: 1,
|
|
612
|
-
alwaysVar: 1,
|
|
613
|
-
overwriteBaseVar: 1,
|
|
614
605
|
),
|
|
615
606
|
'cg': (
|
|
616
607
|
prop: 'column-gap',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@use 'sass:meta';
|
|
5
5
|
|
|
6
6
|
// レイヤー順序を明示的に宣言(詳細度: 上ほど弱い)
|
|
7
|
-
@layer lism-base, lism-primitive, lism-component, lism-custom, lism-utility;
|
|
7
|
+
@layer lism-base, lism-trait, lism-primitive, lism-component, lism-custom, lism-utility;
|
|
8
8
|
|
|
9
9
|
@layer lism-base {
|
|
10
10
|
// resetは中でも layer定義済み。 lism-base.reset となる
|
|
@@ -13,10 +13,14 @@
|
|
|
13
13
|
@include meta.load-css('base');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
// ユーザーが明示的に宣言する trait クラス(is--* / has--*)用レイヤー。
|
|
17
|
+
// primitive より弱い位置に配置し、is--boxLink の display: block 等の
|
|
18
|
+
// 初期化的な宣言がレイアウトプリミティブ(l--stack の display: flex 等)に負けるようにする。
|
|
19
|
+
@layer lism-trait {
|
|
20
|
+
@include meta.load-css('trait');
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
@layer lism-primitive {
|
|
17
|
-
@layer trait {
|
|
18
|
-
@include meta.load-css('primitives/trait');
|
|
19
|
-
}
|
|
20
24
|
@layer layout {
|
|
21
25
|
@include meta.load-css('primitives/layout');
|
|
22
26
|
}
|