lism-css 0.13.1 → 0.15.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 +2 -2
- package/README.md +4 -3
- package/bin/build-config.js +1 -4
- package/bin/cli.mjs +13 -3
- package/config/defaults/props.ts +19 -21
- package/config/defaults/tokens.ts +2 -2
- package/config/defaults/traits.ts +4 -1
- package/dist/components/Dummy/Dummy.d.ts +1 -1
- package/dist/components/Lism/Lism.d.ts +2 -1
- package/dist/components/Lism/Lism.stories.d.ts +1 -2
- package/dist/components/atomic/Decorator/Decorator.d.ts +0 -2
- package/dist/components/atomic/Icon/getProps.d.ts +1 -1
- package/dist/components/atomic/Icon/getProps.js +37 -37
- package/dist/components/index.d.ts +1 -1
- package/dist/config/default-config.d.ts +18 -21
- package/dist/config/defaults/props.d.ts +17 -21
- package/dist/config/defaults/props.js +17 -21
- 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 -1
- package/dist/config/defaults/traits.js +6 -3
- package/dist/config/index.d.ts +36 -42
- 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/getAtomicProps.d.ts +0 -3
- package/dist/lib/getAtomicProps.js +16 -18
- package/dist/lib/getLayoutProps.d.ts +0 -1
- package/dist/lib/getLismProps.d.ts +5 -8
- package/dist/lib/getLismProps.js +69 -87
- package/dist/lib/getMaybeTokenValue.js +20 -20
- package/dist/lib/types/AtomicProps.d.ts +0 -2
- package/dist/lib/types/TraitProps.d.ts +2 -2
- package/package.json +1 -1
- package/packages/astro/Dummy/Dummy.astro +1 -1
- package/packages/astro/index.ts +4 -1
- package/packages/astro/layout/Flex/Flex.astro +3 -2
- package/packages/astro/layout/Flow/Flow.astro +2 -2
- package/packages/astro/types.ts +3 -0
- package/src/scss/_auto_output.scss +12 -11
- package/src/scss/_prop-config.scss +14 -17
- 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/_bp.scss +2 -2
- 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 +3 -5
- package/src/scss/base/tokens/_shadow.scss +18 -12
- package/src/scss/base/tokens/_tokens.scss +7 -19
- package/src/scss/main_no_layer.scss +4 -1
- package/src/scss/primitives/layout/_fluidCols.scss +1 -1
- package/src/scss/primitives/layout/_sideMain.scss +1 -1
- package/src/scss/props/_hover.scss +27 -16
- package/src/scss/props/_size.scss +1 -1
- package/src/scss/{primitives/trait → trait}/_boxLink.scss +1 -1
- package/src/scss/{primitives/trait → trait}/_container.scss +2 -2
- package/src/scss/{base/set/_gutter.scss → trait/_hasGutter.scss} +1 -1
- package/src/scss/trait/_hasMask.scss +6 -0
- package/src/scss/trait/_hasSnap.scss +11 -0
- package/src/scss/trait/_hasTransition.scss +8 -0
- package/src/scss/{primitives/trait → trait}/index.scss +7 -2
- package/src/scss/utility/index.scss +0 -1
- package/dist/css/primitives/trait.css +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/_vertical.scss +0 -9
- package/src/scss/utility/_snap.scss +0 -8
- /package/src/scss/{primitives/trait → trait}/_coverLink.scss +0 -0
- /package/src/scss/{primitives/trait → trait}/_layer.scss +0 -0
- /package/src/scss/{primitives/trait → trait}/_wrapper.scss +0 -0
package/dist/lib/getLismProps.js
CHANGED
|
@@ -1,70 +1,53 @@
|
|
|
1
|
-
import { TRAITS 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
|
-
import
|
|
10
|
+
import _ from "./helper/isEmptyObj.js";
|
|
11
11
|
import S from "./helper/filterEmptyObj.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const s =
|
|
12
|
+
import b from "./helper/mergeSet.js";
|
|
13
|
+
import z from "./helper/splitWithComma.js";
|
|
14
|
+
const L = (n) => {
|
|
15
|
+
const s = c[n];
|
|
16
16
|
return s && s?.token || "";
|
|
17
17
|
};
|
|
18
|
-
function z(o, s) {
|
|
19
|
-
if (!o) return "";
|
|
20
|
-
if (!s) return o;
|
|
21
|
-
const t = o.split(" ")[0];
|
|
22
|
-
return `${o} ${t}--${s}`;
|
|
23
|
-
}
|
|
24
18
|
class T {
|
|
25
19
|
// 最終出力 className
|
|
26
20
|
className = "";
|
|
27
|
-
// 出力順のためのクラスバケット: [lismClass] [primitiveClass] [uClasses]
|
|
28
|
-
// - lismClass : c--* 基底クラス(variant BEM 展開の対象)
|
|
29
|
-
// - primitiveClass : a--* / l--* / is--* の primitive クラス(getAtomicProps → getLayoutProps → analyzeTrait の順で push)
|
|
30
|
-
// - uClasses : set--* → u--* → -property の順で push される utility クラス
|
|
31
|
-
lismClass = "";
|
|
32
21
|
primitiveClass = [];
|
|
22
|
+
setClasses = [];
|
|
23
|
+
traitClasses = [];
|
|
33
24
|
uClasses = [];
|
|
25
|
+
propClasses = [];
|
|
34
26
|
styles = {};
|
|
35
27
|
attrs = {};
|
|
36
28
|
_propConfig;
|
|
37
29
|
constructor(s) {
|
|
38
|
-
const {
|
|
39
|
-
|
|
40
|
-
class: i,
|
|
41
|
-
className: e,
|
|
42
|
-
lismClass: l,
|
|
43
|
-
primitiveClass: r,
|
|
44
|
-
variant: n,
|
|
45
|
-
style: c = {},
|
|
46
|
-
_propConfig: d = {},
|
|
47
|
-
...a
|
|
48
|
-
} = s;
|
|
49
|
-
this.styles = { ...c }, this._propConfig = { ...d }, this.lismClass = z(l, n), r && r.length && (this.primitiveClass = [...r]), L(a) || (this.attrs = { ...a }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = this.buildClassName(e, i);
|
|
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);
|
|
50
32
|
}
|
|
51
33
|
// 最終クラス文字列の組み立て(出力順の唯一の確定地点)
|
|
52
|
-
// 出力順: [
|
|
34
|
+
// 出力順: [className&class] [primitiveClass] [setClasses] [traitClasses] [uClasses] [propClasses]
|
|
35
|
+
// className と class が両方来た場合は両方マージする(atts 内で重複は除去される)。
|
|
53
36
|
buildClassName(s, t) {
|
|
54
|
-
return A(s
|
|
37
|
+
return A(s, t, this.primitiveClass, this.setClasses, this.traitClasses, this.uClasses, this.propClasses);
|
|
55
38
|
}
|
|
56
39
|
analyzeTrait(s, t) {
|
|
57
|
-
const { className: i, preset: e, presetClass:
|
|
58
|
-
t === !0 ? this.
|
|
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)));
|
|
59
42
|
}
|
|
60
43
|
// prop解析
|
|
61
44
|
analyzeProps() {
|
|
62
45
|
const s = this.extractProp("set"), t = this.extractProp("util");
|
|
63
|
-
|
|
64
|
-
if (Object.hasOwn(
|
|
65
|
-
const e = this.extractProp(i),
|
|
66
|
-
typeof
|
|
67
|
-
} else if (Object.hasOwn(
|
|
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)) {
|
|
68
51
|
const e = this.attrs[i];
|
|
69
52
|
delete this.attrs[i], this.analyzeLismProp(i, e);
|
|
70
53
|
} else if (i === "hov") {
|
|
@@ -79,23 +62,26 @@ class T {
|
|
|
79
62
|
// Lism Prop 解析
|
|
80
63
|
analyzeLismProp(s, t) {
|
|
81
64
|
if (t == null) return;
|
|
82
|
-
let i =
|
|
65
|
+
let i = c[s] || null;
|
|
83
66
|
if (i === null) return;
|
|
84
67
|
this._propConfig?.[s] && (i = Object.assign({}, i, this._propConfig[s]));
|
|
85
|
-
const { base: e, ...
|
|
86
|
-
this.setAttrs(s, e, i), Object.keys(
|
|
87
|
-
i && this.setAttrs(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);
|
|
88
71
|
});
|
|
89
72
|
}
|
|
73
|
+
addSet(s) {
|
|
74
|
+
this.setClasses.push(`set--${s}`);
|
|
75
|
+
}
|
|
90
76
|
addUtil(s) {
|
|
91
77
|
this.uClasses.push(s);
|
|
92
78
|
}
|
|
93
79
|
addUtils(s) {
|
|
94
80
|
this.uClasses.push(...s);
|
|
95
81
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
addProp(s) {
|
|
83
|
+
this.propClasses.push(s);
|
|
84
|
+
}
|
|
99
85
|
addStyle(s, t) {
|
|
100
86
|
this.styles[s] = t;
|
|
101
87
|
}
|
|
@@ -115,49 +101,49 @@ class T {
|
|
|
115
101
|
this.attrs[i] !== void 0 && (t[i] = this.attrs[i], delete this.attrs[i]);
|
|
116
102
|
}), t;
|
|
117
103
|
}
|
|
118
|
-
//
|
|
104
|
+
// propertyクラスを追加するか、styleにセットするかの分岐処理 @base
|
|
119
105
|
// 値が null, undefined, '', false の時はスキップ
|
|
120
106
|
setAttrs(s, t, i = {}, e = "") {
|
|
121
107
|
if (t == null || t === "" || t === !1) return;
|
|
122
|
-
let
|
|
123
|
-
if (e && (
|
|
124
|
-
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(":", "")}`);
|
|
125
111
|
return;
|
|
126
112
|
}
|
|
127
113
|
if (!e) {
|
|
128
|
-
const { presets:
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
114
|
+
const { presets: m, tokenClass: j, utils: p, shorthands: P } = i;
|
|
115
|
+
if (m && g(m, t)) {
|
|
116
|
+
const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
117
|
+
h && this.addProp(`${r}:${h}`);
|
|
132
118
|
return;
|
|
133
119
|
}
|
|
134
120
|
if (j && i.token && x(i.token, t)) {
|
|
135
|
-
const
|
|
136
|
-
|
|
121
|
+
const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
122
|
+
h && this.addProp(`${r}:${h}`);
|
|
137
123
|
return;
|
|
138
124
|
}
|
|
139
|
-
let
|
|
140
|
-
if (
|
|
141
|
-
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}`);
|
|
142
128
|
return;
|
|
143
129
|
}
|
|
144
130
|
}
|
|
145
|
-
if (t === !0
|
|
146
|
-
this.
|
|
131
|
+
if (t === !0) {
|
|
132
|
+
this.addProp(r);
|
|
147
133
|
return;
|
|
148
134
|
}
|
|
149
|
-
const { prop:
|
|
150
|
-
let
|
|
151
|
-
if (
|
|
152
|
-
if (
|
|
153
|
-
this.addStyle(`--${s}`,
|
|
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);
|
|
154
140
|
return;
|
|
155
|
-
} else if (!k && !
|
|
156
|
-
this.addStyle(
|
|
141
|
+
} else if (!k && !O) {
|
|
142
|
+
this.addStyle(a, l);
|
|
157
143
|
return;
|
|
158
144
|
}
|
|
159
145
|
}
|
|
160
|
-
this.
|
|
146
|
+
this.addProp(r), this.addStyle(o, l);
|
|
161
147
|
}
|
|
162
148
|
// setPassProps(passVars) {
|
|
163
149
|
// let dataList = [];
|
|
@@ -173,29 +159,25 @@ class T {
|
|
|
173
159
|
// });
|
|
174
160
|
// }
|
|
175
161
|
setHovProps(s) {
|
|
176
|
-
s && (s ===
|
|
177
|
-
this.
|
|
162
|
+
s && (s === !0 ? this.addProp("-hov") : typeof s == "string" ? z(s).forEach((t) => {
|
|
163
|
+
this.addProp(`-hov:${t}`);
|
|
178
164
|
}) : typeof s == "object" && Object.keys(s).forEach((t) => {
|
|
179
165
|
const i = s[t];
|
|
180
166
|
if (!(i == null || i === "" || i === !1)) {
|
|
181
|
-
if (i ===
|
|
182
|
-
this.
|
|
183
|
-
else if (t === "class")
|
|
184
|
-
O(i).forEach((e) => {
|
|
185
|
-
this.addUtil(`-hov:${e}`);
|
|
186
|
-
});
|
|
167
|
+
if (i === !0)
|
|
168
|
+
this.addProp(`-hov:${t}`);
|
|
187
169
|
else if (typeof i == "string" || typeof i == "number") {
|
|
188
|
-
const e =
|
|
189
|
-
this.
|
|
170
|
+
const e = d(i, L(t));
|
|
171
|
+
this.addProp(`-hov:-${t}`), this.addStyle(`--hov-${t}`, e);
|
|
190
172
|
}
|
|
191
173
|
}
|
|
192
174
|
}));
|
|
193
175
|
}
|
|
194
176
|
}
|
|
195
|
-
function
|
|
196
|
-
if (Object.keys(
|
|
177
|
+
function Y(n) {
|
|
178
|
+
if (Object.keys(n).length === 0)
|
|
197
179
|
return {};
|
|
198
|
-
const { atomic: s, layout: t, ...i } =
|
|
180
|
+
const { atomic: s, layout: t, ...i } = n, e = E(s, i), o = V(t, e), r = new T(o);
|
|
199
181
|
return {
|
|
200
182
|
...S({
|
|
201
183
|
className: r.className,
|
|
@@ -207,5 +189,5 @@ function Z(o) {
|
|
|
207
189
|
}
|
|
208
190
|
export {
|
|
209
191
|
T as LismPropsData,
|
|
210
|
-
|
|
192
|
+
Y as default
|
|
211
193
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
function a(
|
|
2
|
-
if (
|
|
3
|
-
let
|
|
4
|
-
return
|
|
1
|
+
function a(i, r, f) {
|
|
2
|
+
if (i === "color") {
|
|
3
|
+
let n = a("c", r, f);
|
|
4
|
+
return n === String(r) && (n = a("palette", r, f)), n;
|
|
5
5
|
}
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
if (
|
|
11
|
-
return
|
|
12
|
-
} else if (Array.isArray(
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
15
|
-
} else if ("pre" in
|
|
16
|
-
const { pre:
|
|
17
|
-
if (s instanceof Set && s.has(
|
|
18
|
-
return `var(${
|
|
19
|
-
if (Array.isArray(s) && s.includes(
|
|
20
|
-
return `var(${
|
|
6
|
+
const e = f[i];
|
|
7
|
+
if (!e) return String(r);
|
|
8
|
+
const t = typeof r == "number" ? `${r}` : r;
|
|
9
|
+
if (e instanceof Set) {
|
|
10
|
+
if (e.has(t))
|
|
11
|
+
return `var(--${i}--${t})`;
|
|
12
|
+
} else if (Array.isArray(e)) {
|
|
13
|
+
if (e.includes(t))
|
|
14
|
+
return `var(--${i}--${t})`;
|
|
15
|
+
} else if ("pre" in e || "values" in e) {
|
|
16
|
+
const { pre: n = "", values: s = [] } = e;
|
|
17
|
+
if (s instanceof Set && s.has(t))
|
|
18
|
+
return `var(${n}${t})`;
|
|
19
|
+
if (Array.isArray(s) && s.includes(t))
|
|
20
|
+
return `var(${n}${t})`;
|
|
21
21
|
}
|
|
22
|
-
return String(
|
|
22
|
+
return String(r);
|
|
23
23
|
}
|
|
24
24
|
export {
|
|
25
25
|
a as default
|
|
@@ -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' | 'trimChildren' | 'srOnly' | 'clipText' | 'collapseGrid'
|
|
37
|
+
type UtilPreset = 'cbox' | 'trim' | 'trimChildren' | 'srOnly' | 'clipText' | 'collapseGrid';
|
|
38
38
|
/**
|
|
39
39
|
* util prop の値の型。既知の `u--` クラス名がサジェストされつつ、任意の文字列も受け付ける。
|
|
40
40
|
*
|
package/package.json
CHANGED
package/packages/astro/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export * from './Lism';
|
|
6
|
-
/** @deprecated DummyText
|
|
6
|
+
/** @deprecated DummyText (@lism-css/ui) を使用してください */
|
|
7
7
|
export * from './Dummy';
|
|
8
8
|
|
|
9
9
|
// semantic wrappers
|
|
@@ -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,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/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,9 @@ $props: (
|
|
|
114
113
|
prop: 'opacity',
|
|
115
114
|
utilities: (
|
|
116
115
|
'0': '0',
|
|
117
|
-
'-10': 'var(--o
|
|
118
|
-
'-20': 'var(--o
|
|
119
|
-
'-30': 'var(--o
|
|
116
|
+
'-10': 'var(--o---10)',
|
|
117
|
+
'-20': 'var(--o---20)',
|
|
118
|
+
'-30': 'var(--o---30)',
|
|
120
119
|
),
|
|
121
120
|
),
|
|
122
121
|
'v': (
|
|
@@ -317,7 +316,6 @@ $props: (
|
|
|
317
316
|
),
|
|
318
317
|
bp: 1,
|
|
319
318
|
alwaysVar: 1,
|
|
320
|
-
overwriteBaseVar: 1,
|
|
321
319
|
),
|
|
322
320
|
'bxsh': (
|
|
323
321
|
prop: 'box-shadow',
|
|
@@ -327,9 +325,9 @@ $props: (
|
|
|
327
325
|
'20': 'var(--bxsh--20)',
|
|
328
326
|
'30': 'var(--bxsh--30)',
|
|
329
327
|
'40': 'var(--bxsh--40)',
|
|
328
|
+
'50': 'var(--bxsh--50)',
|
|
330
329
|
),
|
|
331
330
|
bp: 1,
|
|
332
|
-
alwaysVar: 1,
|
|
333
331
|
),
|
|
334
332
|
'pos': (
|
|
335
333
|
prop: 'position',
|
|
@@ -405,7 +403,6 @@ $props: (
|
|
|
405
403
|
),
|
|
406
404
|
bp: 1,
|
|
407
405
|
alwaysVar: 1,
|
|
408
|
-
overwriteBaseVar: 1,
|
|
409
406
|
),
|
|
410
407
|
'px': (
|
|
411
408
|
prop: 'padding-inline',
|
|
@@ -423,7 +420,6 @@ $props: (
|
|
|
423
420
|
'80': 'var(--s80)',
|
|
424
421
|
),
|
|
425
422
|
bp: 1,
|
|
426
|
-
alwaysVar: 1,
|
|
427
423
|
),
|
|
428
424
|
'py': (
|
|
429
425
|
prop: 'padding-block',
|
|
@@ -441,7 +437,6 @@ $props: (
|
|
|
441
437
|
'80': 'var(--s80)',
|
|
442
438
|
),
|
|
443
439
|
bp: 1,
|
|
444
|
-
alwaysVar: 1,
|
|
445
440
|
),
|
|
446
441
|
'px-s': (
|
|
447
442
|
prop: 'padding-inline-start',
|
|
@@ -493,7 +488,6 @@ $props: (
|
|
|
493
488
|
),
|
|
494
489
|
bp: 1,
|
|
495
490
|
alwaysVar: 1,
|
|
496
|
-
overwriteBaseVar: 1,
|
|
497
491
|
),
|
|
498
492
|
'mx': (
|
|
499
493
|
prop: 'margin-inline',
|
|
@@ -512,7 +506,6 @@ $props: (
|
|
|
512
506
|
'auto': 'auto',
|
|
513
507
|
),
|
|
514
508
|
bp: 1,
|
|
515
|
-
alwaysVar: 1,
|
|
516
509
|
),
|
|
517
510
|
'my': (
|
|
518
511
|
prop: 'margin-block',
|
|
@@ -531,7 +524,6 @@ $props: (
|
|
|
531
524
|
'auto': 'auto',
|
|
532
525
|
),
|
|
533
526
|
bp: 1,
|
|
534
|
-
alwaysVar: 1,
|
|
535
527
|
),
|
|
536
528
|
'mx-s': (
|
|
537
529
|
prop: 'margin-inline-start',
|
|
@@ -609,8 +601,6 @@ $props: (
|
|
|
609
601
|
),
|
|
610
602
|
),
|
|
611
603
|
bp: 1,
|
|
612
|
-
alwaysVar: 1,
|
|
613
|
-
overwriteBaseVar: 1,
|
|
614
604
|
),
|
|
615
605
|
'cg': (
|
|
616
606
|
prop: 'column-gap',
|
|
@@ -818,13 +808,13 @@ $props: (
|
|
|
818
808
|
'-1': '-1',
|
|
819
809
|
),
|
|
820
810
|
),
|
|
821
|
-
'
|
|
811
|
+
'ovw': (
|
|
822
812
|
prop: 'overflow-wrap',
|
|
823
813
|
utilities: (
|
|
824
814
|
'anywhere': 'anywhere',
|
|
825
815
|
),
|
|
826
816
|
),
|
|
827
|
-
'
|
|
817
|
+
'whs': (
|
|
828
818
|
prop: 'white-space',
|
|
829
819
|
utilities: (
|
|
830
820
|
'nowrap': 'nowrap',
|
|
@@ -843,10 +833,17 @@ $props: (
|
|
|
843
833
|
'both': 'both',
|
|
844
834
|
),
|
|
845
835
|
),
|
|
846
|
-
'
|
|
836
|
+
'iso': (
|
|
847
837
|
prop: 'isolation',
|
|
848
838
|
utilities: (
|
|
849
839
|
'isolate': 'isolate',
|
|
850
840
|
),
|
|
851
841
|
),
|
|
842
|
+
'wm': (
|
|
843
|
+
prop: 'writing-mode',
|
|
844
|
+
utilities: (
|
|
845
|
+
'vertical-rl': 'vertical-rl',
|
|
846
|
+
),
|
|
847
|
+
bp: 1,
|
|
848
|
+
),
|
|
852
849
|
);
|
|
@@ -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
|
}
|
package/src/scss/base/_html.scss
CHANGED
|
@@ -95,9 +95,9 @@ hr {
|
|
|
95
95
|
/* --------------------------------------------------
|
|
96
96
|
list
|
|
97
97
|
-------------------------------------------------- */
|
|
98
|
-
// class
|
|
99
|
-
|
|
100
|
-
:is(ul, ol):where([class
|
|
98
|
+
// classを持たないリスト要素はブラウザ標準のスタイルを復活させる。
|
|
99
|
+
// Property Class だけの ul/ol など、明示的に戻したい場合は `.set--revert` を付与する(base/set/_revert.scss)。
|
|
100
|
+
:is(ul, ol):where(:not([class])) {
|
|
101
101
|
list-style: revert;
|
|
102
102
|
padding-inline-start: var(--list-px-s, var(--s30));
|
|
103
103
|
}
|
|
@@ -148,7 +148,7 @@ select,
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
:disabled {
|
|
151
|
-
opacity: var(--o
|
|
151
|
+
opacity: var(--o---20);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/* --------------------------------------------------
|