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/README.ja.md
CHANGED
|
@@ -19,7 +19,7 @@ React / Astro 向けのコンポーネントも提供しており、propsを通
|
|
|
19
19
|
- **軽量** - CSS バンドル全体で約 30 KB(gzip 圧縮時 約 8 KB)と、軽量です。
|
|
20
20
|
- **ゼロビルドフレームワーク** — CSS ファイルを読み込むだけで、プレーン HTML でも動作します。ビルドツール、プリプロセッサ、設定は不要。CDN または npm で利用可能。
|
|
21
21
|
- **レイアウト優先のプリミティブアーキテクチャ** — レイアウトプリミティブ(`l--flex`、`l--stack`、`l--grid`、`l--columns`、`l--center`、`l--sideMain` など)で、カスタム CSS を書かずに一般的なレイアウトパターンを組み立てられます。
|
|
22
|
-
- **CSS レイヤー構造** — `@layer`(lism-base → lism-primitive → lism-component → lism-custom → lism-utility)を使用した明確な詳細度管理。`lism-
|
|
22
|
+
- **CSS レイヤー構造** — `@layer`(lism-base → lism-trait → lism-primitive → lism-component → lism-custom → lism-utility)を使用した明確な詳細度管理。`lism-trait` は `is--` / `has--` の Trait クラス用レイヤー、`lism-primitive` の内部は `layout` / `atomic` のサブレイヤーに分かれています。`lism-component` は BEM 構造の `c--` コンポーネント用レイヤー、`lism-custom` はユーザー独自プレフィックスのクラス用レイヤーです。詳細度の衝突を最小限に抑えます。
|
|
23
23
|
- **デザイントークン** — カラー、スペーシング、フォントサイズ、シャドウ、ボーダー半径を CSS カスタムプロパティで管理。変数を上書きするだけで簡単にカスタマイズできます。
|
|
24
24
|
- **柔軟なプロップクラス** — `-{prop}:{value}` の命名規則(例: `-p:20`、`-bgc:base-2`、`-fz:l`)で CSS プロパティをユーティリティクラスにマッピングし、素早く読みやすいスタイリングを実現します。
|
|
25
25
|
- **レスポンシブシステム** — ブレークポイント固有のクラスと CSS 変数(例: `-p_sm`、`-p_md`)にデフォルトでコンテナクエリを採用し、親要素ベースのレスポンシブデザインを実現。メディアクエリへの切り替えも可能。
|
|
@@ -183,7 +183,7 @@ Lism CSS は一貫したデザインのための CSS カスタムプロパティ
|
|
|
183
183
|
- **スペーシング:** `--s5`, `--s10`, `--s15`, `--s20`, `--s30`, `--s40` … `--s80`(rem 値にマッピング)
|
|
184
184
|
- **フォントサイズ:** `--fz--2xs` 〜 `--fz--5xl`
|
|
185
185
|
- **ボーダー半径:** `--bdrs--10`(0.25rem)〜 `--bdrs--99`(99rem)
|
|
186
|
-
- **シャドウ:** `--bxsh--10` 〜 `--bxsh--
|
|
186
|
+
- **シャドウ:** `--bxsh--10` 〜 `--bxsh--50`(シャドウカラー設定可能)
|
|
187
187
|
- **コンテナサイズ:** `--sz--xs`(32rem)〜 `--sz--xl`(1600px)
|
|
188
188
|
|
|
189
189
|
## UI コンポーネント
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ No build step or configuration is required. Simply load the CSS file via CDN or
|
|
|
18
18
|
- **Lightweight** — The entire CSS bundle is approximately 30 KB (~8 KB gzipped).
|
|
19
19
|
- **Zero-Build Framework** — Works with plain HTML by simply loading a CSS file. No build tool, preprocessor, or configuration needed. Available via CDN or npm.
|
|
20
20
|
- **Layout-First Primitive Architecture** — Pre-built layout primitives (`l--flex`, `l--stack`, `l--grid`, `l--columns`, `l--center`, `l--sideMain`, etc.) let you compose common layout patterns without writing custom CSS.
|
|
21
|
-
- **CSS Layer Structure** — Uses `@layer` (lism-base → lism-primitive → lism-component → lism-custom → lism-utility) for clear specificity management. `lism-
|
|
21
|
+
- **CSS Layer Structure** — Uses `@layer` (lism-base → lism-trait → lism-primitive → lism-component → lism-custom → lism-utility) for clear specificity management. `lism-trait` is the layer for `is--` / `has--` trait classes. `lism-primitive` contains `layout` / `atomic` sub-layers. `lism-component` is the layer for BEM-structured `c--` components. `lism-custom` is the layer for user-defined classes with custom prefixes. Minimizes specificity conflicts.
|
|
22
22
|
- **Design Tokens** — Colors, spacing, font sizes, shadows, and border radii are managed as CSS custom properties. Easy to customize by overriding variables.
|
|
23
23
|
- **Flexible Property Classes** — A `-{prop}:{value}` naming convention (e.g., `-p:20`, `-bgc:base-2`, `-fz:l`) maps CSS properties to utility classes for quick, readable styling.
|
|
24
24
|
- **Responsive System** — Breakpoint-specific classes and CSS variables (e.g., `-p_sm`, `-p_md`) use container queries by default for parent-based responsive design. Switchable to media queries.
|
|
@@ -147,7 +147,8 @@ Lism CSS uses a structured naming convention for CSS classes:
|
|
|
147
147
|
| Type | Pattern | Examples |
|
|
148
148
|
|------|---------|----------|
|
|
149
149
|
| Layout Primitive | `l--{name}` | `l--flex`, `l--grid`, `l--stack`, `l--center`, `l--columns`, `l--sideMain` |
|
|
150
|
-
| Trait
|
|
150
|
+
| Trait Class (role) | `is--{name}` | `is--wrapper`, `is--container`, `is--layer`, `is--boxLink` |
|
|
151
|
+
| Trait Class (feature) | `has--{name}` | `has--transition`, `has--gutter`, `has--snap` |
|
|
151
152
|
| Property Class | `-{prop}:{value}` | `-p:20`, `-m:auto`, `-bgc:base-2`, `-fz:l`, `-ta:center` |
|
|
152
153
|
| Breakpoint | `-{prop}_{bp}` | `-p_sm`, `-g_md`, `-fz_lg` |
|
|
153
154
|
| Utility Class | `u--{name}` | `u--cbox` |
|
|
@@ -182,7 +183,7 @@ Lism CSS provides CSS custom properties for consistent design:
|
|
|
182
183
|
- **Spacing:** `--s5`, `--s10`, `--s15`, `--s20`, `--s30`, `--s40` … `--s80` (mapped to rem values)
|
|
183
184
|
- **Font Sizes:** `--fz--2xs` through `--fz--5xl`
|
|
184
185
|
- **Border Radius:** `--bdrs--10` (0.25rem) through `--bdrs--99` (99rem)
|
|
185
|
-
- **Shadows:** `--bxsh--10` through `--bxsh--
|
|
186
|
+
- **Shadows:** `--bxsh--10` through `--bxsh--50` with configurable shadow colors
|
|
186
187
|
- **Container Sizes:** `--sz--xs` (32rem) through `--sz--xl` (1600px)
|
|
187
188
|
|
|
188
189
|
## UI Components
|
package/bin/build-config.js
CHANGED
|
@@ -51,7 +51,7 @@ function generateUtilities(propConfig, TOKENS) {
|
|
|
51
51
|
* @returns {string} SCSS形式の文字列
|
|
52
52
|
*/
|
|
53
53
|
function generatePropScss(propKey, propConfig, TOKENS) {
|
|
54
|
-
const { prop = '', bp, isVar, alwaysVar,
|
|
54
|
+
const { prop = '', bp, isVar, alwaysVar, important } = propConfig;
|
|
55
55
|
|
|
56
56
|
// styleが定義されている場合はそれを使用、なければpropKeyをそのまま使用
|
|
57
57
|
const utilities = generateUtilities(propConfig, TOKENS);
|
|
@@ -114,9 +114,6 @@ function generatePropScss(propKey, propConfig, TOKENS) {
|
|
|
114
114
|
if (alwaysVar !== undefined) {
|
|
115
115
|
scss += ` alwaysVar: ${alwaysVar},\n`;
|
|
116
116
|
}
|
|
117
|
-
if (overwriteBaseVar !== undefined) {
|
|
118
|
-
scss += ` overwriteBaseVar: ${overwriteBaseVar},\n`;
|
|
119
|
-
}
|
|
120
117
|
if (important !== undefined) {
|
|
121
118
|
scss += ` important: ${important},\n`;
|
|
122
119
|
}
|
package/bin/cli.mjs
CHANGED
|
@@ -17,7 +17,17 @@ console.log('🤖 projectRoot:', projectRoot);
|
|
|
17
17
|
|
|
18
18
|
// 設定ファイルのパス
|
|
19
19
|
const defaultConfigPath = path.resolve(__dirname, '../config/default-config.js');
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
// ユーザー設定ファイルを検索(優先順: .js → .mjs)
|
|
22
|
+
const CONFIG_SEARCH = ['lism.config.js', 'lism.config.mjs'];
|
|
23
|
+
function findUserConfigPath() {
|
|
24
|
+
for (const name of CONFIG_SEARCH) {
|
|
25
|
+
const abs = path.resolve(projectRoot, name);
|
|
26
|
+
if (fs.existsSync(abs)) return abs;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const userConfigPath = findUserConfigPath();
|
|
21
31
|
|
|
22
32
|
// コマンドライン引数の先頭をサブコマンドとして解釈(デフォルトは build-config)
|
|
23
33
|
const args = process.argv.slice(2);
|
|
@@ -30,9 +40,9 @@ async function main() {
|
|
|
30
40
|
const defaultConfigModule = await import(pathToFileURL(defaultConfigPath).href);
|
|
31
41
|
const defaultConfig = defaultConfigModule?.default || {};
|
|
32
42
|
|
|
33
|
-
// user の lism.config.js は存在する時のみ読み込む
|
|
43
|
+
// user の lism.config.{js,mjs} は存在する時のみ読み込む
|
|
34
44
|
let userConfig = {};
|
|
35
|
-
if (
|
|
45
|
+
if (userConfigPath) {
|
|
36
46
|
const userConfigModule = await import(pathToFileURL(userConfigPath).href);
|
|
37
47
|
userConfig = userConfigModule?.default || {};
|
|
38
48
|
|
package/config/defaults/props.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* isVar: 1 → クラス出力はせずstyle属性での変数出力のみ (--bdw, --keycolor など)
|
|
3
3
|
* bp: 0 → Prop-valユーティリティクラス化されなければ、style属性で出力するだけ。
|
|
4
4
|
* bp: 1 → .-prop と --prop の セットがベースにあり、.-prop_bp と .--prop_bp で ブレイクポイント指定できる。
|
|
5
|
-
* .-prop{
|
|
5
|
+
* .-prop{property:var(--prop)} が基本で、ユーティリティクラスは .-prop:val{property:value} となる。
|
|
6
6
|
*
|
|
7
7
|
* ↓コンポーネント処理で使用される
|
|
8
8
|
* tokenClass: 1 → 対応するトークン値がそのまま全てユーティリティクラス化されるもの。
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
* shorthands: → コンポーネント側で短く書くための設定
|
|
11
11
|
*
|
|
12
12
|
* ↓SCSS出力で使用される
|
|
13
|
-
* alwaysVar: 1 → .-prop,[class*=-prop:] {
|
|
14
|
-
*
|
|
13
|
+
* alwaysVar: 1 → state変数扱い。 .-prop,[class*=-prop:] {property:var(--prop)} の base 出力となり、
|
|
14
|
+
* ユーティリティクラスは --prop をセットする形になる。
|
|
15
|
+
* 加えて BPクラスも .-prop_$bp { property: var(--prop); --prop: var(--prop_$bp) !important; } を出力し、
|
|
16
|
+
* 常に --prop が当該要素の現在値になるよう上書きされる(consumer が --prop を参照できる)。
|
|
15
17
|
* important: 1 → !important を付けて最終的に出力する
|
|
16
18
|
*/
|
|
17
19
|
|
|
@@ -21,7 +23,7 @@ const PLACE_SHORTHANDS = { s: 'start', e: 'end', c: 'center', fs: 'flex-start',
|
|
|
21
23
|
|
|
22
24
|
export default {
|
|
23
25
|
f: { prop: 'font', presets: ['inherit'] },
|
|
24
|
-
fz: { prop: 'fontSize', token: 'fz', tokenClass: 1, bp: 1
|
|
26
|
+
fz: { prop: 'fontSize', token: 'fz', tokenClass: 1, bp: 1 },
|
|
25
27
|
fw: {
|
|
26
28
|
prop: 'fontWeight',
|
|
27
29
|
token: 'fw',
|
|
@@ -83,15 +85,15 @@ export default {
|
|
|
83
85
|
prop: 'maxInlineSize',
|
|
84
86
|
token: 'sz',
|
|
85
87
|
tokenClass: 1,
|
|
88
|
+
presets: ['full'],
|
|
86
89
|
exUtility: {
|
|
87
|
-
min: '',
|
|
88
90
|
full: '',
|
|
89
91
|
container: '',
|
|
90
92
|
},
|
|
91
93
|
},
|
|
92
|
-
|
|
93
|
-
'min-
|
|
94
|
-
'max-
|
|
94
|
+
bsz: { prop: 'blockSize', token: 'sz' },
|
|
95
|
+
'min-bsz': { prop: 'minBlockSize', token: 'sz' },
|
|
96
|
+
'max-bsz': { prop: 'maxBlockSize', token: 'sz' },
|
|
95
97
|
|
|
96
98
|
// bg
|
|
97
99
|
bg: { prop: 'background', bp: 1 },
|
|
@@ -153,7 +155,6 @@ export default {
|
|
|
153
155
|
tokenClass: 1,
|
|
154
156
|
bp: 1,
|
|
155
157
|
alwaysVar: 1,
|
|
156
|
-
overwriteBaseVar: 1,
|
|
157
158
|
},
|
|
158
159
|
'bdrs-tl': { prop: 'borderTopLeftRadius', token: 'bdrs' },
|
|
159
160
|
'bdrs-tr': { prop: 'borderTopRightRadius', token: 'bdrs' },
|
|
@@ -164,7 +165,7 @@ export default {
|
|
|
164
165
|
'bdrs-es': { prop: 'borderEndStartRadius', token: 'bdrs' },
|
|
165
166
|
'bdrs-ee': { prop: 'borderEndEndRadius', token: 'bdrs' },
|
|
166
167
|
|
|
167
|
-
bxsh: { prop: 'boxShadow', utils: { 0: 'none' }, token: 'bxsh', tokenClass: 1, bp: 1
|
|
168
|
+
bxsh: { prop: 'boxShadow', utils: { 0: 'none' }, token: 'bxsh', tokenClass: 1, bp: 1 },
|
|
168
169
|
|
|
169
170
|
// position
|
|
170
171
|
pos: {
|
|
@@ -191,11 +192,10 @@ export default {
|
|
|
191
192
|
token: 'space',
|
|
192
193
|
tokenClass: 1,
|
|
193
194
|
alwaysVar: 1,
|
|
194
|
-
overwriteBaseVar: 1,
|
|
195
195
|
bp: 1,
|
|
196
196
|
},
|
|
197
|
-
px: { prop: 'paddingInline', presets: ['0'], token: 'space', tokenClass: 1,
|
|
198
|
-
py: { prop: 'paddingBlock', presets: ['0'], token: 'space', tokenClass: 1,
|
|
197
|
+
px: { prop: 'paddingInline', presets: ['0'], token: 'space', tokenClass: 1, bp: 1 },
|
|
198
|
+
py: { prop: 'paddingBlock', presets: ['0'], token: 'space', tokenClass: 1, bp: 1 },
|
|
199
199
|
'px-s': { prop: 'paddingInlineStart', token: 'space', bp: 1 },
|
|
200
200
|
'px-e': { prop: 'paddingInlineEnd', token: 'space', bp: 1 },
|
|
201
201
|
'py-s': { prop: 'paddingBlockStart', token: 'space', bp: 1 },
|
|
@@ -210,11 +210,10 @@ export default {
|
|
|
210
210
|
token: 'space',
|
|
211
211
|
tokenClass: 1,
|
|
212
212
|
alwaysVar: 1,
|
|
213
|
-
overwriteBaseVar: 1,
|
|
214
213
|
bp: 1,
|
|
215
214
|
},
|
|
216
|
-
mx: { prop: 'marginInline', presets: ['auto', '0'], token: 'space', tokenClass: 1,
|
|
217
|
-
my: { prop: 'marginBlock', presets: ['auto', '0'], token: 'space', tokenClass: 1,
|
|
215
|
+
mx: { prop: 'marginInline', presets: ['auto', '0'], token: 'space', tokenClass: 1, bp: 1 },
|
|
216
|
+
my: { prop: 'marginBlock', presets: ['auto', '0'], token: 'space', tokenClass: 1, bp: 1 },
|
|
218
217
|
'mx-s': { prop: 'marginInlineStart', presets: ['auto'], token: 'space', bp: 1 },
|
|
219
218
|
'mx-e': { prop: 'marginInlineEnd', presets: ['auto'], token: 'space', bp: 1 },
|
|
220
219
|
'my-s': { prop: 'marginBlockStart', token: 'space', bp: 1, presets: ['auto', '0'], tokenClass: 1 },
|
|
@@ -230,8 +229,6 @@ export default {
|
|
|
230
229
|
exUtility: { inherit: { gap: 'inherit' } },
|
|
231
230
|
token: 'space',
|
|
232
231
|
tokenClass: 1,
|
|
233
|
-
alwaysVar: 1,
|
|
234
|
-
overwriteBaseVar: 1,
|
|
235
232
|
bp: 1,
|
|
236
233
|
},
|
|
237
234
|
cg: { prop: 'columnGap', token: 'space', bp: 1 },
|
|
@@ -353,10 +350,11 @@ export default {
|
|
|
353
350
|
// },
|
|
354
351
|
|
|
355
352
|
// others
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
ovw: { prop: 'overflowWrap', presets: ['anywhere'] },
|
|
354
|
+
whs: { prop: 'whiteSpace', presets: ['nowrap'] },
|
|
358
355
|
// wordbreak: { prop: 'wordBreak', utils: { keep: 'keep-all', all: 'break-all' } },
|
|
359
356
|
float: { prop: 'float', presets: ['left', 'right'] },
|
|
360
357
|
clear: { prop: 'clear', presets: ['both'] },
|
|
361
|
-
|
|
358
|
+
iso: { prop: 'isolation', presets: ['isolate'] },
|
|
359
|
+
wm: { prop: 'writingMode', presets: ['vertical-rl'], bp: 1 },
|
|
362
360
|
} as const;
|
|
@@ -7,8 +7,8 @@ export default {
|
|
|
7
7
|
fw: ['light', 'normal', 'bold'],
|
|
8
8
|
o: ['-10', '-20', '-30'],
|
|
9
9
|
bdrs: ['10', '20', '30', '40', '99', 'inner'],
|
|
10
|
-
bxsh: ['10', '20', '30', '40'],
|
|
11
|
-
sz: ['xs', 's', 'm', 'l', 'xl', '
|
|
10
|
+
bxsh: ['10', '20', '30', '40', '50'],
|
|
11
|
+
sz: ['xs', 's', 'm', 'l', 'xl', 'container'],
|
|
12
12
|
ar: ['og'],
|
|
13
13
|
space: {
|
|
14
14
|
pre: '--s',
|
|
@@ -12,5 +12,8 @@ export default {
|
|
|
12
12
|
isCoverLink: 'is--coverLink',
|
|
13
13
|
isSide: 'is--side',
|
|
14
14
|
isSkipFlow: 'is--skipFlow',
|
|
15
|
-
|
|
15
|
+
hasTransition: 'has--transition',
|
|
16
|
+
hasGutter: 'has--gutter',
|
|
17
|
+
hasSnap: 'has--snap',
|
|
18
|
+
hasMask: 'has--mask',
|
|
16
19
|
} as const;
|
|
@@ -3,9 +3,10 @@ import { LismProps } from '../../lib/getLismProps';
|
|
|
3
3
|
import { LayoutSpecificProps } from '../../lib/types/LayoutProps';
|
|
4
4
|
type ReactStyleWithCustomProps = CSSProperties & Record<`--${string}`, string | number | undefined>;
|
|
5
5
|
/** 要素固有の HTML Props + 共通オプション */
|
|
6
|
-
type LismElementProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'style'> & {
|
|
6
|
+
type LismElementProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'style' | 'className'> & {
|
|
7
7
|
as?: T;
|
|
8
8
|
children?: ReactNode;
|
|
9
|
+
className?: string;
|
|
9
10
|
exProps?: Record<string, unknown>;
|
|
10
11
|
/** React では camelCase のみ有効(kebab-case は実行時に無視される) */
|
|
11
12
|
style?: ReactStyleWithCustomProps;
|
|
@@ -10,8 +10,7 @@ export default meta;
|
|
|
10
10
|
type Story = StoryObj<typeof meta>;
|
|
11
11
|
export declare const Default: Story;
|
|
12
12
|
export declare const AsParagraph: Story;
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const WithVariant: Story;
|
|
13
|
+
export declare const WithClassName: Story;
|
|
15
14
|
export declare const WithLayout: Story;
|
|
16
15
|
export declare const ResponsiveArray: Story;
|
|
17
16
|
export declare const ResponsiveObject: Story;
|
|
@@ -2,8 +2,6 @@ import { LismComponentProps } from '../../Lism/Lism';
|
|
|
2
2
|
import { CssValue } from '../../../lib/types/LayoutProps';
|
|
3
3
|
export interface DecoratorOwnProps {
|
|
4
4
|
size?: CssValue;
|
|
5
|
-
clipPath?: string;
|
|
6
|
-
boxSizing?: string;
|
|
7
5
|
}
|
|
8
6
|
export type DecoratorProps = LismComponentProps & DecoratorOwnProps;
|
|
9
7
|
export default function Decorator(props: DecoratorProps): import("react").JSX.Element;
|
|
@@ -15,7 +15,7 @@ export interface IconOwnProps {
|
|
|
15
15
|
exProps?: Record<string, unknown>;
|
|
16
16
|
}
|
|
17
17
|
export type IconProps = LismProps & IconOwnProps;
|
|
18
|
-
export default function getProps({
|
|
18
|
+
export default function getProps({ as, icon, label, exProps, ..._props }: IconProps): {
|
|
19
19
|
Component: ElementType | "_SVG_";
|
|
20
20
|
lismProps: {
|
|
21
21
|
[key: string]: unknown;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
5
|
-
const [,
|
|
6
|
-
let
|
|
7
|
-
for (; (
|
|
8
|
-
const [,
|
|
9
|
-
if (
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const [
|
|
13
|
-
|
|
14
|
-
}), c
|
|
1
|
+
import _ from "./presets.js";
|
|
2
|
+
function p(m) {
|
|
3
|
+
const s = {}, n = m.match(/<svg([^>]*?)>([\s\S]*?)<\/svg>/i);
|
|
4
|
+
if (n) {
|
|
5
|
+
const [, t, u] = n, a = /([\w-]+)=["']([^"']*)["']/g;
|
|
6
|
+
let r;
|
|
7
|
+
for (; (r = a.exec(t)) !== null; ) {
|
|
8
|
+
const [, c, o] = r;
|
|
9
|
+
if (c === "style") {
|
|
10
|
+
const e = {};
|
|
11
|
+
o.split(";").forEach((f) => {
|
|
12
|
+
const [i, l] = f.split(":").map((g) => g.trim());
|
|
13
|
+
i && l && (e[i] = l);
|
|
14
|
+
}), s[c] = e;
|
|
15
15
|
} else
|
|
16
|
-
c
|
|
16
|
+
s[c] = o;
|
|
17
17
|
}
|
|
18
|
-
return { svgProps:
|
|
18
|
+
return { svgProps: s, svgContent: u };
|
|
19
19
|
}
|
|
20
20
|
return {};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let a =
|
|
22
|
+
function d({ as: m, icon: s, label: n, exProps: t = {}, ...u }) {
|
|
23
|
+
let a = m || "span", r = "";
|
|
24
24
|
const {
|
|
25
|
-
style:
|
|
25
|
+
style: c = {},
|
|
26
26
|
className: o = "",
|
|
27
|
-
...
|
|
27
|
+
...e
|
|
28
28
|
} = u;
|
|
29
|
-
let
|
|
30
|
-
if (
|
|
29
|
+
let f = c, i = o;
|
|
30
|
+
if (e.viewBox) {
|
|
31
31
|
a = "svg";
|
|
32
|
-
const l =
|
|
33
|
-
l && delete
|
|
34
|
-
} else if (
|
|
32
|
+
const l = e.size;
|
|
33
|
+
l && delete e.size, e.width || (t.width = l || "1em"), e.height || (t.height = l || "1em");
|
|
34
|
+
} else if (e.src)
|
|
35
35
|
a = "img";
|
|
36
|
-
else if (
|
|
37
|
-
if (typeof
|
|
38
|
-
if (
|
|
36
|
+
else if (s)
|
|
37
|
+
if (typeof s == "string")
|
|
38
|
+
if (s.startsWith("<svg")) {
|
|
39
39
|
a = "_SVG_";
|
|
40
|
-
const { svgProps: l = {}, svgContent:
|
|
41
|
-
|
|
40
|
+
const { svgProps: l = {}, svgContent: g = "" } = p(s), { class: v, style: h, ...y } = l;
|
|
41
|
+
v && (i = i ? `${i} ${v}` : v), f = { ...f, ...h }, t = { ...t, ...y, fill: "currentColor" }, r = g;
|
|
42
42
|
} else {
|
|
43
|
-
const l =
|
|
43
|
+
const l = _[s] || null;
|
|
44
44
|
l != null && (a = "_SVG_", t = { ...t, ...l });
|
|
45
45
|
}
|
|
46
|
-
else if (typeof
|
|
47
|
-
const { as: l, ...
|
|
48
|
-
a = l, t = { ...t, ...
|
|
46
|
+
else if (typeof s == "object" && s.as) {
|
|
47
|
+
const { as: l, ...g } = s;
|
|
48
|
+
a = l, t = { ...t, ...g };
|
|
49
49
|
} else
|
|
50
|
-
a =
|
|
51
|
-
return
|
|
50
|
+
a = s;
|
|
51
|
+
return n ? (t["aria-label"] = n, t.role = "img") : t["aria-hidden"] = "true", e.atomic = "icon", i && (e.className = i), e.style = { ...f }, { Component: a, lismProps: e, exProps: t, content: r };
|
|
52
52
|
}
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
d as default
|
|
55
55
|
};
|
|
@@ -8,8 +8,8 @@ declare const _default: {
|
|
|
8
8
|
readonly fw: readonly ["light", "normal", "bold"];
|
|
9
9
|
readonly o: readonly ["-10", "-20", "-30"];
|
|
10
10
|
readonly bdrs: readonly ["10", "20", "30", "40", "99", "inner"];
|
|
11
|
-
readonly bxsh: readonly ["10", "20", "30", "40"];
|
|
12
|
-
readonly sz: readonly ["xs", "s", "m", "l", "xl", "
|
|
11
|
+
readonly bxsh: readonly ["10", "20", "30", "40", "50"];
|
|
12
|
+
readonly sz: readonly ["xs", "s", "m", "l", "xl", "container"];
|
|
13
13
|
readonly ar: readonly ["og"];
|
|
14
14
|
readonly space: {
|
|
15
15
|
readonly pre: "--s";
|
|
@@ -36,7 +36,6 @@ declare const _default: {
|
|
|
36
36
|
readonly token: "fz";
|
|
37
37
|
readonly tokenClass: 1;
|
|
38
38
|
readonly bp: 1;
|
|
39
|
-
readonly alwaysVar: 1;
|
|
40
39
|
};
|
|
41
40
|
readonly fw: {
|
|
42
41
|
readonly prop: "fontWeight";
|
|
@@ -181,21 +180,21 @@ declare const _default: {
|
|
|
181
180
|
readonly prop: "maxInlineSize";
|
|
182
181
|
readonly token: "sz";
|
|
183
182
|
readonly tokenClass: 1;
|
|
183
|
+
readonly presets: readonly ["full"];
|
|
184
184
|
readonly exUtility: {
|
|
185
|
-
readonly min: "";
|
|
186
185
|
readonly full: "";
|
|
187
186
|
readonly container: "";
|
|
188
187
|
};
|
|
189
188
|
};
|
|
190
|
-
readonly
|
|
189
|
+
readonly bsz: {
|
|
191
190
|
readonly prop: "blockSize";
|
|
192
191
|
readonly token: "sz";
|
|
193
192
|
};
|
|
194
|
-
readonly 'min-
|
|
193
|
+
readonly 'min-bsz': {
|
|
195
194
|
readonly prop: "minBlockSize";
|
|
196
195
|
readonly token: "sz";
|
|
197
196
|
};
|
|
198
|
-
readonly 'max-
|
|
197
|
+
readonly 'max-bsz': {
|
|
199
198
|
readonly prop: "maxBlockSize";
|
|
200
199
|
readonly token: "sz";
|
|
201
200
|
};
|
|
@@ -301,7 +300,6 @@ declare const _default: {
|
|
|
301
300
|
readonly tokenClass: 1;
|
|
302
301
|
readonly bp: 1;
|
|
303
302
|
readonly alwaysVar: 1;
|
|
304
|
-
readonly overwriteBaseVar: 1;
|
|
305
303
|
};
|
|
306
304
|
readonly 'bdrs-tl': {
|
|
307
305
|
readonly prop: "borderTopLeftRadius";
|
|
@@ -343,7 +341,6 @@ declare const _default: {
|
|
|
343
341
|
readonly token: "bxsh";
|
|
344
342
|
readonly tokenClass: 1;
|
|
345
343
|
readonly bp: 1;
|
|
346
|
-
readonly alwaysVar: 1;
|
|
347
344
|
};
|
|
348
345
|
readonly pos: {
|
|
349
346
|
readonly prop: "position";
|
|
@@ -422,7 +419,6 @@ declare const _default: {
|
|
|
422
419
|
readonly token: "space";
|
|
423
420
|
readonly tokenClass: 1;
|
|
424
421
|
readonly alwaysVar: 1;
|
|
425
|
-
readonly overwriteBaseVar: 1;
|
|
426
422
|
readonly bp: 1;
|
|
427
423
|
};
|
|
428
424
|
readonly px: {
|
|
@@ -430,7 +426,6 @@ declare const _default: {
|
|
|
430
426
|
readonly presets: readonly ["0"];
|
|
431
427
|
readonly token: "space";
|
|
432
428
|
readonly tokenClass: 1;
|
|
433
|
-
readonly alwaysVar: 1;
|
|
434
429
|
readonly bp: 1;
|
|
435
430
|
};
|
|
436
431
|
readonly py: {
|
|
@@ -438,7 +433,6 @@ declare const _default: {
|
|
|
438
433
|
readonly presets: readonly ["0"];
|
|
439
434
|
readonly token: "space";
|
|
440
435
|
readonly tokenClass: 1;
|
|
441
|
-
readonly alwaysVar: 1;
|
|
442
436
|
readonly bp: 1;
|
|
443
437
|
};
|
|
444
438
|
readonly 'px-s': {
|
|
@@ -487,7 +481,6 @@ declare const _default: {
|
|
|
487
481
|
readonly token: "space";
|
|
488
482
|
readonly tokenClass: 1;
|
|
489
483
|
readonly alwaysVar: 1;
|
|
490
|
-
readonly overwriteBaseVar: 1;
|
|
491
484
|
readonly bp: 1;
|
|
492
485
|
};
|
|
493
486
|
readonly mx: {
|
|
@@ -495,7 +488,6 @@ declare const _default: {
|
|
|
495
488
|
readonly presets: readonly ["auto", "0"];
|
|
496
489
|
readonly token: "space";
|
|
497
490
|
readonly tokenClass: 1;
|
|
498
|
-
readonly alwaysVar: 1;
|
|
499
491
|
readonly bp: 1;
|
|
500
492
|
};
|
|
501
493
|
readonly my: {
|
|
@@ -503,7 +495,6 @@ declare const _default: {
|
|
|
503
495
|
readonly presets: readonly ["auto", "0"];
|
|
504
496
|
readonly token: "space";
|
|
505
497
|
readonly tokenClass: 1;
|
|
506
|
-
readonly alwaysVar: 1;
|
|
507
498
|
readonly bp: 1;
|
|
508
499
|
};
|
|
509
500
|
readonly 'mx-s': {
|
|
@@ -561,8 +552,6 @@ declare const _default: {
|
|
|
561
552
|
};
|
|
562
553
|
readonly token: "space";
|
|
563
554
|
readonly tokenClass: 1;
|
|
564
|
-
readonly alwaysVar: 1;
|
|
565
|
-
readonly overwriteBaseVar: 1;
|
|
566
555
|
readonly bp: 1;
|
|
567
556
|
};
|
|
568
557
|
readonly cg: {
|
|
@@ -767,11 +756,11 @@ declare const _default: {
|
|
|
767
756
|
readonly prop: "order";
|
|
768
757
|
readonly presets: readonly ["0", "-1", "1"];
|
|
769
758
|
};
|
|
770
|
-
readonly
|
|
759
|
+
readonly ovw: {
|
|
771
760
|
readonly prop: "overflowWrap";
|
|
772
761
|
readonly presets: readonly ["anywhere"];
|
|
773
762
|
};
|
|
774
|
-
readonly
|
|
763
|
+
readonly whs: {
|
|
775
764
|
readonly prop: "whiteSpace";
|
|
776
765
|
readonly presets: readonly ["nowrap"];
|
|
777
766
|
};
|
|
@@ -783,10 +772,15 @@ declare const _default: {
|
|
|
783
772
|
readonly prop: "clear";
|
|
784
773
|
readonly presets: readonly ["both"];
|
|
785
774
|
};
|
|
786
|
-
readonly
|
|
775
|
+
readonly iso: {
|
|
787
776
|
readonly prop: "isolation";
|
|
788
777
|
readonly presets: readonly ["isolate"];
|
|
789
778
|
};
|
|
779
|
+
readonly wm: {
|
|
780
|
+
readonly prop: "writingMode";
|
|
781
|
+
readonly presets: readonly ["vertical-rl"];
|
|
782
|
+
readonly bp: 1;
|
|
783
|
+
};
|
|
790
784
|
};
|
|
791
785
|
readonly traits: {
|
|
792
786
|
readonly isContainer: "is--container";
|
|
@@ -802,7 +796,10 @@ declare const _default: {
|
|
|
802
796
|
readonly isCoverLink: "is--coverLink";
|
|
803
797
|
readonly isSide: "is--side";
|
|
804
798
|
readonly isSkipFlow: "is--skipFlow";
|
|
805
|
-
readonly
|
|
799
|
+
readonly hasTransition: "has--transition";
|
|
800
|
+
readonly hasGutter: "has--gutter";
|
|
801
|
+
readonly hasSnap: "has--snap";
|
|
802
|
+
readonly hasMask: "has--mask";
|
|
806
803
|
};
|
|
807
804
|
};
|
|
808
805
|
export default _default;
|