lism-css 0.18.0 → 0.21.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/config/defaults/props.ts +41 -40
- package/config/defaults/tokens.ts +1 -1
- package/config/defaults/traits.ts +1 -7
- package/dist/components/state/Wrapper/Wrapper.d.ts +2 -4
- package/dist/components/state/Wrapper/index.js +5 -5
- package/dist/config/default-config.d.ts +47 -45
- package/dist/config/defaults/props.d.ts +45 -37
- package/dist/config/defaults/props.js +42 -41
- package/dist/config/defaults/tokens.d.ts +1 -1
- package/dist/config/defaults/tokens.js +1 -1
- package/dist/config/defaults/traits.d.ts +1 -7
- package/dist/config/defaults/traits.js +1 -7
- package/dist/config/index.d.ts +95 -91
- 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 -1
- package/dist/lib/getLismProps.d.ts +2 -9
- package/dist/lib/getLismProps.js +98 -95
- package/dist/lib/types/PropValueTypes.d.ts +14 -10
- package/dist/lib/types/TraitProps.d.ts +10 -11
- package/dist/lib/types/allowedTags.d.ts +1 -1
- package/dist/lib/warnUnsupportedBp.d.ts +10 -0
- package/dist/lib/warnUnsupportedBp.js +20 -0
- package/package.json +1 -1
- package/packages/astro/state/Wrapper/Wrapper.astro +2 -8
- package/src/scss/_prop-config.scss +30 -66
- package/src/scss/base/_html.scss +7 -2
- package/src/scss/base/set/_bdrsInner.scss +1 -1
- package/src/scss/base/set/_bleed.scss +3 -0
- package/src/scss/base/set/_hov.scss +4 -4
- package/src/scss/base/set/_revert.scss +1 -1
- package/src/scss/base/set/index.scss +1 -0
- package/src/scss/base/tokens/_shadow.scss +2 -2
- package/src/scss/base/tokens/_space.scss +3 -3
- package/src/scss/base/tokens/_tokens.scss +15 -1
- package/src/scss/primitives/layout/_flow.scss +0 -4
- package/src/scss/props/_border.scss +4 -4
- package/src/scss/props/_hover.scss +4 -7
- package/src/scss/trait/is/_wrapper.scss +1 -8
package/dist/lib/getLismProps.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { TRAITS as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import _ from "./helper/
|
|
1
|
+
import { TRAITS as P, PROPS as d } from "../config/index.js";
|
|
2
|
+
import j from "./getLayoutProps.js";
|
|
3
|
+
import k from "./getAtomicProps.js";
|
|
4
|
+
import E from "./isPresetValue.js";
|
|
5
|
+
import w from "./isTokenValue.js";
|
|
6
|
+
import g from "./getUtilKey.js";
|
|
7
|
+
import C from "./getMaybeCssVar.js";
|
|
8
|
+
import x from "./getBpData.js";
|
|
9
|
+
import z from "./warnUnsupportedBp.js";
|
|
10
|
+
import _ from "./helper/atts.js";
|
|
11
|
+
import A from "./helper/isEmptyObj.js";
|
|
11
12
|
import S from "./helper/filterEmptyObj.js";
|
|
12
13
|
import b from "./helper/mergeSet.js";
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
return
|
|
14
|
+
import U from "./helper/splitWithComma.js";
|
|
15
|
+
const W = (n) => {
|
|
16
|
+
const t = d[n];
|
|
17
|
+
return t && t?.token || "";
|
|
17
18
|
};
|
|
18
|
-
class
|
|
19
|
+
class L {
|
|
19
20
|
// 最終出力 className
|
|
20
21
|
className = "";
|
|
21
22
|
primitiveClass = [];
|
|
@@ -26,28 +27,25 @@ class T {
|
|
|
26
27
|
styles = {};
|
|
27
28
|
attrs = {};
|
|
28
29
|
_propConfig;
|
|
29
|
-
constructor(
|
|
30
|
-
const { forwardedRef:
|
|
31
|
-
this.styles = { ...r }, this._propConfig = { ...
|
|
30
|
+
constructor(t) {
|
|
31
|
+
const { forwardedRef: s, class: i, className: e, primitiveClass: o, style: r = {}, _propConfig: u = {}, ...h } = t;
|
|
32
|
+
this.styles = { ...r }, this._propConfig = { ...u }, o && o.length && (this.primitiveClass = [...o]), A(h) || (this.attrs = { ...h }, this.analyzeProps()), s && (this.attrs.ref = s), this.className = this.buildClassName(e, i);
|
|
32
33
|
}
|
|
33
34
|
// 最終クラス文字列の組み立て(出力順の唯一の確定地点)
|
|
34
35
|
// 出力順: [className&class] [primitiveClass] [setClasses] [traitClasses] [uClasses] [propClasses]
|
|
35
36
|
// className と class が両方来た場合は両方マージする(atts 内で重複は除去される)。
|
|
36
|
-
buildClassName(
|
|
37
|
-
return
|
|
38
|
-
}
|
|
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)));
|
|
37
|
+
buildClassName(t, s) {
|
|
38
|
+
return _(t, s, this.primitiveClass, this.setClasses, this.traitClasses, this.uClasses, this.propClasses);
|
|
42
39
|
}
|
|
43
40
|
// prop解析
|
|
44
41
|
analyzeProps() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
this.normalizeIsWrapper();
|
|
43
|
+
const t = this.extractProp("set"), s = this.extractProp("util");
|
|
44
|
+
b(void 0, t).forEach((i) => this.addSet(i)), b(void 0, s).forEach((i) => this.addUtil(`u--${i}`)), Object.keys(this.attrs).forEach((i) => {
|
|
45
|
+
if (Object.hasOwn(P, i)) {
|
|
46
|
+
const e = this.extractProp(i), o = P[i];
|
|
47
|
+
e && this.traitClasses.push(o);
|
|
48
|
+
} else if (Object.hasOwn(d, i)) {
|
|
51
49
|
const e = this.attrs[i];
|
|
52
50
|
delete this.attrs[i], this.analyzeLismProp(i, e);
|
|
53
51
|
} else if (i === "hov") {
|
|
@@ -59,91 +57,96 @@ class T {
|
|
|
59
57
|
}
|
|
60
58
|
});
|
|
61
59
|
}
|
|
60
|
+
// isWrapper="s" 形式のサイズ指定は contentSize Prop に寄せる。
|
|
61
|
+
normalizeIsWrapper() {
|
|
62
|
+
const t = this.attrs.isWrapper;
|
|
63
|
+
t == null || t === !1 || t === "" || t !== !0 && (this.attrs.contentSize === void 0 && (this.attrs.contentSize = t), this.attrs.isWrapper = !0);
|
|
64
|
+
}
|
|
62
65
|
// Lism Prop 解析
|
|
63
|
-
analyzeLismProp(
|
|
64
|
-
if (
|
|
65
|
-
let i =
|
|
66
|
+
analyzeLismProp(t, s) {
|
|
67
|
+
if (s == null) return;
|
|
68
|
+
let i = d[t] || null;
|
|
66
69
|
if (i === null) return;
|
|
67
|
-
this._propConfig?.[
|
|
68
|
-
const { base: e, ...o } =
|
|
69
|
-
this.setAttrs(
|
|
70
|
-
i && this.setAttrs(
|
|
70
|
+
this._propConfig?.[t] && (i = Object.assign({}, i, this._propConfig[t]));
|
|
71
|
+
const { base: e, ...o } = x(s);
|
|
72
|
+
process.env.NODE_ENV !== "production" && !i.bp && Object.keys(o).length > 0 && z(t), this.setAttrs(t, e, i), Object.keys(o).forEach((r) => {
|
|
73
|
+
i && this.setAttrs(t, o[r], i, r);
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
|
-
addSet(
|
|
74
|
-
this.setClasses.push(`set--${
|
|
76
|
+
addSet(t) {
|
|
77
|
+
this.setClasses.push(`set--${t}`);
|
|
75
78
|
}
|
|
76
|
-
addUtil(
|
|
77
|
-
this.uClasses.push(
|
|
79
|
+
addUtil(t) {
|
|
80
|
+
this.uClasses.push(t);
|
|
78
81
|
}
|
|
79
|
-
addUtils(
|
|
80
|
-
this.uClasses.push(...
|
|
82
|
+
addUtils(t) {
|
|
83
|
+
this.uClasses.push(...t);
|
|
81
84
|
}
|
|
82
|
-
addProp(
|
|
83
|
-
this.propClasses.push(
|
|
85
|
+
addProp(t) {
|
|
86
|
+
this.propClasses.push(t);
|
|
84
87
|
}
|
|
85
|
-
addStyle(
|
|
86
|
-
this.styles[
|
|
88
|
+
addStyle(t, s) {
|
|
89
|
+
this.styles[t] = s;
|
|
87
90
|
}
|
|
88
|
-
addStyles(
|
|
89
|
-
this.styles = { ...this.styles, ...
|
|
91
|
+
addStyles(t) {
|
|
92
|
+
this.styles = { ...this.styles, ...t };
|
|
90
93
|
}
|
|
91
|
-
addAttrs(
|
|
92
|
-
this.addStyles(
|
|
94
|
+
addAttrs(t) {
|
|
95
|
+
this.addStyles(t.styles || {}), this.addUtils(t.utils || []);
|
|
93
96
|
}
|
|
94
|
-
extractProp(
|
|
95
|
-
const
|
|
96
|
-
return this.attrs[
|
|
97
|
+
extractProp(t) {
|
|
98
|
+
const s = this.attrs[t];
|
|
99
|
+
return this.attrs[t] === void 0 ? null : (delete this.attrs[t], s);
|
|
97
100
|
}
|
|
98
|
-
extractProps(
|
|
99
|
-
const
|
|
100
|
-
return
|
|
101
|
-
this.attrs[i] !== void 0 && (
|
|
102
|
-
}),
|
|
101
|
+
extractProps(t) {
|
|
102
|
+
const s = {};
|
|
103
|
+
return t.forEach((i) => {
|
|
104
|
+
this.attrs[i] !== void 0 && (s[i] = this.attrs[i], delete this.attrs[i]);
|
|
105
|
+
}), s;
|
|
103
106
|
}
|
|
104
107
|
// propertyクラスを追加するか、styleにセットするかの分岐処理 @base
|
|
105
108
|
// 値が null, undefined, '', false の時はスキップ
|
|
106
|
-
setAttrs(
|
|
107
|
-
if (
|
|
108
|
-
let o = `--${
|
|
109
|
-
if (e && (o = `--${
|
|
110
|
-
this.addProp(`${r}:${
|
|
109
|
+
setAttrs(t, s, i = {}, e = "") {
|
|
110
|
+
if (s == null || s === "" || s === !1) return;
|
|
111
|
+
let o = `--${t}`, r = `-${String(i.utilKey || t)}`;
|
|
112
|
+
if (e && (o = `--${t}_${e}`, r += `_${e}`), typeof s == "string" && s.startsWith(":")) {
|
|
113
|
+
this.addProp(`${r}:${s.replace(":", "")}`);
|
|
111
114
|
return;
|
|
112
115
|
}
|
|
113
116
|
if (!e) {
|
|
114
|
-
const { presets:
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
|
|
117
|
+
const { presets: p, tokenClass: V, utils: y, shorthands: m } = i;
|
|
118
|
+
if (p && E(p, s)) {
|
|
119
|
+
const f = typeof s == "string" || typeof s == "number" ? String(s) : "";
|
|
120
|
+
f && this.addProp(`${r}:${f}`);
|
|
118
121
|
return;
|
|
119
122
|
}
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
+
if (V && i.token && w(i.token, s)) {
|
|
124
|
+
const f = typeof s == "string" || typeof s == "number" ? String(s) : "";
|
|
125
|
+
f && this.addProp(`${r}:${f}`);
|
|
123
126
|
return;
|
|
124
127
|
}
|
|
125
|
-
let
|
|
126
|
-
if (
|
|
127
|
-
this.addProp(`${r}:${
|
|
128
|
+
let l = "";
|
|
129
|
+
if (y && typeof s == "string" && (l = g(y, s)), !l && m && typeof s == "string" && (l = g(m, s, !0)), l) {
|
|
130
|
+
this.addProp(`${r}:${l}`);
|
|
128
131
|
return;
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
|
-
if (
|
|
134
|
+
if (s === !0) {
|
|
132
135
|
this.addProp(r);
|
|
133
136
|
return;
|
|
134
137
|
}
|
|
135
|
-
const { prop:
|
|
136
|
-
let
|
|
137
|
-
if (
|
|
138
|
-
if (
|
|
139
|
-
this.addStyle(`--${
|
|
138
|
+
const { prop: u, isVar: h, alwaysVar: $, token: c, bp: O } = i;
|
|
139
|
+
let a;
|
|
140
|
+
if (c && (typeof s == "string" || typeof s == "number") ? a = C(s, c) : typeof s == "string" || typeof s == "number" ? a = s : a = JSON.stringify(s), !e) {
|
|
141
|
+
if (h) {
|
|
142
|
+
this.addStyle(`--${t}`, a);
|
|
140
143
|
return;
|
|
141
|
-
} else if (!
|
|
142
|
-
this.addStyle(
|
|
144
|
+
} else if (!O && !$) {
|
|
145
|
+
this.addStyle(u, a);
|
|
143
146
|
return;
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
|
-
this.addProp(r), this.addStyle(o,
|
|
149
|
+
this.addProp(r), this.addStyle(o, a);
|
|
147
150
|
}
|
|
148
151
|
// setPassProps(passVars) {
|
|
149
152
|
// let dataList = [];
|
|
@@ -158,26 +161,26 @@ class T {
|
|
|
158
161
|
// this.addStyle(`--pass_${propName}`, value);
|
|
159
162
|
// });
|
|
160
163
|
// }
|
|
161
|
-
setHovProps(
|
|
162
|
-
|
|
163
|
-
this.addProp(`-hov:${
|
|
164
|
-
}) : typeof
|
|
165
|
-
const i = s
|
|
164
|
+
setHovProps(t) {
|
|
165
|
+
t && (t === !0 ? this.addProp("-hov") : typeof t == "string" ? U(t).forEach((s) => {
|
|
166
|
+
this.addProp(`-hov:${s}`);
|
|
167
|
+
}) : typeof t == "object" && Object.keys(t).forEach((s) => {
|
|
168
|
+
const i = t[s];
|
|
166
169
|
if (!(i == null || i === "" || i === !1)) {
|
|
167
170
|
if (i === !0)
|
|
168
|
-
this.addProp(`-hov:${
|
|
171
|
+
this.addProp(`-hov:${s}`);
|
|
169
172
|
else if (typeof i == "string" || typeof i == "number") {
|
|
170
|
-
const e =
|
|
171
|
-
this.addProp(`-hov:-${
|
|
173
|
+
const e = C(i, W(s));
|
|
174
|
+
this.addProp(`-hov:-${s}`), this.addStyle(`--hov-${s}`, e);
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
177
|
}));
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
|
-
function
|
|
180
|
+
function D(n) {
|
|
178
181
|
if (Object.keys(n).length === 0)
|
|
179
182
|
return {};
|
|
180
|
-
const { atomic:
|
|
183
|
+
const { atomic: t, layout: s, ...i } = n, e = k(t, i), o = j(s, e), r = new L(o);
|
|
181
184
|
return {
|
|
182
185
|
...S({
|
|
183
186
|
className: r.className,
|
|
@@ -188,6 +191,6 @@ function Y(n) {
|
|
|
188
191
|
};
|
|
189
192
|
}
|
|
190
193
|
export {
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
L as LismPropsData,
|
|
195
|
+
D as default
|
|
193
196
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TOKENS, PROPS } from '../../../config/index';
|
|
1
|
+
import { TOKENS, PROPS, BREAK_POINTS } from '../../../config/index';
|
|
2
2
|
import { WithArbitraryString, ArrayElement, ExtractArrayValues, ExtractObjectKeys, ExtractPropertyValue } from './utils';
|
|
3
3
|
import { MakeResponsive } from './ResponsiveProps';
|
|
4
4
|
type PropsConfig = typeof PROPS;
|
|
@@ -33,43 +33,47 @@ type ExtractPropValues<T> = ExtractArrayValues<T, 'presets'> | ExtractObjectKeys
|
|
|
33
33
|
* - ない場合: string | number(フォールバック)
|
|
34
34
|
*/
|
|
35
35
|
type PropValueType<T> = ExtractPropValues<T> extends never ? string | number | boolean : WithArbitraryString<ExtractPropValues<T>> | number | boolean | null;
|
|
36
|
+
/** bp で指定できるブレークポイント名('lg' など個別指定用) */
|
|
37
|
+
type BreakpointName = (typeof BREAK_POINTS)[number];
|
|
36
38
|
/**
|
|
37
|
-
* bp
|
|
38
|
-
*
|
|
39
|
+
* bp プロパティでレスポンシブ(配列・オブジェクト形式)が有効かを判定
|
|
40
|
+
* - bp 未設定 / bp: 0 → false
|
|
41
|
+
* - bp: 1 → 全 BP からユーティリティクラス生成
|
|
42
|
+
* - bp: 'lg' 等 → 指定 BP 以降のみ(配列形式の型は bp: 1 と同様に許可)
|
|
39
43
|
*/
|
|
40
|
-
type HasBreakpointSupport<T> = [ExtractPropertyValue<T, 'bp'>] extends [never] ? false : ExtractPropertyValue<T, 'bp'> extends 1 ? true : false;
|
|
44
|
+
type HasBreakpointSupport<T> = [ExtractPropertyValue<T, 'bp'>] extends [never] ? false : ExtractPropertyValue<T, 'bp'> extends 0 ? false : ExtractPropertyValue<T, 'bp'> extends 1 | BreakpointName ? true : false;
|
|
41
45
|
type AllPropKeys = keyof PropsConfig;
|
|
42
46
|
/**
|
|
43
|
-
* bp
|
|
47
|
+
* bp が有効(1 またはブレークポイント名)なプロパティのキーを抽出
|
|
44
48
|
*/
|
|
45
49
|
type PropsWithBreakpoint = {
|
|
46
50
|
[K in AllPropKeys]: HasBreakpointSupport<PropsConfig[K]> extends true ? K : never;
|
|
47
51
|
}[AllPropKeys];
|
|
48
52
|
/**
|
|
49
|
-
* bp
|
|
53
|
+
* bp が無効なプロパティのキーを抽出
|
|
50
54
|
*/
|
|
51
55
|
type PropsWithoutBreakpoint = Exclude<AllPropKeys, PropsWithBreakpoint>;
|
|
52
56
|
/**
|
|
53
|
-
* bp
|
|
57
|
+
* bp が有効なプロパティの型(レスポンシブ対応あり)
|
|
54
58
|
*/
|
|
55
59
|
export type ResponsivePropValueTypes = {
|
|
56
60
|
[K in PropsWithBreakpoint]?: PropValueType<PropsConfig[K]>;
|
|
57
61
|
};
|
|
58
62
|
/**
|
|
59
|
-
* bp
|
|
63
|
+
* bp が無効なプロパティの型(レスポンシブ対応なし)
|
|
60
64
|
*/
|
|
61
65
|
export type NonResponsivePropValueTypes = {
|
|
62
66
|
[K in PropsWithoutBreakpoint]?: PropValueType<PropsConfig[K]>;
|
|
63
67
|
};
|
|
64
68
|
/**
|
|
65
69
|
* PROPS 設定から生成される Props 型(レスポンシブ対応含む)
|
|
66
|
-
* - bp
|
|
70
|
+
* - bp が有効なプロパティ: レスポンシブ対応(配列・オブジェクト形式可)
|
|
67
71
|
* - bp なしのプロパティ: 単一値のみ
|
|
68
72
|
* - presets/utils/token なしのプロパティ: string | number(フォールバック)
|
|
69
73
|
*
|
|
70
74
|
* @example
|
|
71
75
|
* ```ts
|
|
72
|
-
* // bp
|
|
76
|
+
* // bp が有効なプロパティ(fz など)
|
|
73
77
|
* fz?: 'root' | 'base' | ... | ['root', 'base'] | { base: 'root', md: 'base' }
|
|
74
78
|
*
|
|
75
79
|
* // bp なしのプロパティ(fw など)
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import { TRAITS } from '../../../config/index';
|
|
2
|
-
import {
|
|
2
|
+
import { PropValueTypes } from './PropValueTypes';
|
|
3
|
+
import { WithArbitraryString } from './utils';
|
|
3
4
|
/**
|
|
4
5
|
* config/index.ts から TRAITS の型を取得
|
|
5
6
|
* objDeepMerge の DeepMergeResult 型により literal types が保持される
|
|
6
7
|
*/
|
|
7
8
|
type TraitsConfig = typeof TRAITS;
|
|
8
|
-
/** preset を持つ Trait の値の型を抽出 */
|
|
9
|
-
type PresetElement<T> = T extends {
|
|
10
|
-
preset: readonly unknown[];
|
|
11
|
-
} ? ArrayElement<T['preset']> : never;
|
|
12
9
|
/**
|
|
13
10
|
* Trait 設定から Props の値の型を抽出するユーティリティ型
|
|
14
11
|
*/
|
|
15
|
-
type ExtractTraitValue<T> = T extends string ? boolean :
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
type ExtractTraitValue<T> = T extends string ? boolean : never;
|
|
13
|
+
type GeneratedTraitProps = {
|
|
14
|
+
[K in keyof TraitsConfig]?: ExtractTraitValue<TraitsConfig[K]>;
|
|
15
|
+
};
|
|
16
|
+
type ContentSizeStringValue = Extract<NonNullable<PropValueTypes['contentSize']>, string>;
|
|
18
17
|
/**
|
|
19
18
|
* config/index.ts の TRAITS から自動生成される Trait Props の型
|
|
20
19
|
* config/index.ts の TRAITS に新しいトレイトを追加すると自動的に反映される
|
|
21
20
|
*/
|
|
22
|
-
export type TraitProps = {
|
|
23
|
-
|
|
21
|
+
export type TraitProps = Omit<GeneratedTraitProps, 'isWrapper'> & {
|
|
22
|
+
isWrapper?: boolean | ContentSizeStringValue;
|
|
24
23
|
};
|
|
25
24
|
/** set prop で使われるプリセット値(エディタ補完用) */
|
|
26
|
-
type SetPreset = 'plain' | 'revert' | '
|
|
25
|
+
type SetPreset = 'plain' | 'revert' | 'hov' | 'bxsh' | 'bdrsInner' | 'bleed' | 's';
|
|
27
26
|
/**
|
|
28
27
|
* set prop の値の型。プリセット値がサジェストされつつ、任意の文字列も受け付ける。
|
|
29
28
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type GroupAllowedTag = 'div' | 'section' | 'article' | 'figure' | 'nav' | 'aside' | 'header' | 'footer' | 'main' | 'fieldset' | 'hgroup';
|
|
2
2
|
export type TextAllowedTag = 'p' | 'div' | 'blockquote' | 'address' | 'figcaption' | 'pre';
|
|
3
|
-
export type InlineAllowedTag = 'span' | 'em' | 'strong' | 'small' | 'code' | 'time' | 'i' | 'b' | 'mark' | 'abbr' | 'cite' | 'kbd';
|
|
3
|
+
export type InlineAllowedTag = 'span' | 'em' | 'strong' | 'small' | 'code' | 'time' | 'i' | 'b' | 'mark' | 'abbr' | 'cite' | 'kbd' | 'label';
|
|
4
4
|
export type ListAllowedTag = 'ul' | 'ol' | 'dl';
|
|
5
5
|
export type ListItemAllowedTag = 'li' | 'dt' | 'dd';
|
|
6
6
|
export type MediaAllowedTag = 'img' | 'video' | 'iframe' | 'picture';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bp デフォルト非対応のプロパティに BP 指定(配列 / { sm, md, ... })が渡された時に、
|
|
3
|
+
* 開発環境でのみ警告を出す。呼び出し側で dev 判定・BP 指定有無の判定を済ませてから呼ぶ。
|
|
4
|
+
*
|
|
5
|
+
* 判定基準は JS ランタイムの propConfig.bp(config/defaults/props.ts)。
|
|
6
|
+
* SCSS の $props 上書きは CSS 出力だけを変え JS には届かないため、SCSS で BP を
|
|
7
|
+
* 再有効化済みのケースは誤検知になる。そのため抑制フラグは設けず、警告文に
|
|
8
|
+
* 「SCSS でカスタマイズ済みなら無視して OK」の注記を添える方針とする。
|
|
9
|
+
*/
|
|
10
|
+
export default function warnUnsupportedBp(propName: string): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const o = {
|
|
2
|
+
pl: "ps",
|
|
3
|
+
pr: "pe",
|
|
4
|
+
pt: "pbs",
|
|
5
|
+
pb: "pbe",
|
|
6
|
+
ml: "ms",
|
|
7
|
+
mr: "me",
|
|
8
|
+
mt: "mbs",
|
|
9
|
+
mb: "mbe"
|
|
10
|
+
}, n = /* @__PURE__ */ new Set();
|
|
11
|
+
function i(s) {
|
|
12
|
+
if (n.has(s)) return;
|
|
13
|
+
n.add(s);
|
|
14
|
+
const e = o[s], t = [`[lism-css] \`${s}\` does not support breakpoint values by default.`];
|
|
15
|
+
e && t.push(` - Use the logical property \`${e}\` instead`), t.push(` - ${e ? "Or e" : "E"}nable it via SCSS $props: \`'${s}': ( bp: 1 )\``), t.push(" Docs: https://lism-css.com/en/docs/customize/"), t.push(" * If you've already customized this via SCSS, you can ignore this warning."), console.warn(t.join(`
|
|
16
|
+
`));
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
i as default
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLTag, Polymorphic } from 'astro/types';
|
|
3
3
|
import type { AstroLismBaseProps } from '../../types';
|
|
4
|
-
import type { LismProps } from 'lism-css/lib/getLismProps';
|
|
5
4
|
import { Lism } from '../../Lism';
|
|
6
5
|
|
|
7
|
-
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> &
|
|
8
|
-
AstroLismBaseProps & {
|
|
9
|
-
contentSize?: LismProps['isWrapper'];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const { contentSize = true, ...props } = Astro.props;
|
|
6
|
+
type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
|
|
13
7
|
---
|
|
14
8
|
|
|
15
|
-
<Lism isWrapper
|
|
9
|
+
<Lism isWrapper {...Astro.props}><slot /></Lism>
|