lism-css 0.21.0 → 0.22.1
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/bin/cli.mjs +2 -2
- package/dist/components/atomic/Icon/presets.d.ts +28 -12
- package/dist/components/atomic/Icon/presets.js +38 -33
- package/dist/components/layout/AutoColumns/AutoColumns.stories.d.ts +1 -1
- 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/reset.css +1 -1
- package/dist/css/trait.css +1 -1
- package/dist/css/utility.css +1 -1
- package/dist/lib/getLayoutProps.d.ts +1 -1
- package/dist/lib/getLayoutProps.js +2 -2
- package/dist/lib/getLismProps.js +21 -20
- package/dist/lib/types/LayoutProps.d.ts +1 -1
- package/dist/lib/types/TraitProps.d.ts +1 -1
- package/package.json +32 -6
- package/src/scss/base/_html.scss +6 -20
- package/src/scss/base/set/_bleed.scss +1 -1
- package/src/scss/base/tokens/_tokens.scss +3 -3
- package/src/scss/primitives/layout/_autoColumns.scss +1 -1
- package/src/scss/props/_size.scss +2 -2
- package/src/scss/reset.scss +0 -3
- package/src/scss/trait/has/_gutter.scss +2 -1
- package/src/scss/trait/is/_container.scss +1 -1
- package/src/scss/utility/_divide.scss +2 -2
- package/config/__prop_list.js +0 -44
- package/config/__props.scss +0 -25
- package/config/default-config.ts +0 -9
- package/config/defaults/__props-memo.js +0 -45
- package/config/defaults/props.ts +0 -361
- package/config/defaults/tokens.ts +0 -27
- package/config/defaults/traits.ts +0 -13
- package/config/helper/minifyHtml.ts +0 -22
- package/config/helper.test.ts +0 -238
- package/config/helper.ts +0 -73
- package/config/index.ts +0 -36
- package/config/tsconfig.json +0 -18
package/config/helper.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
type PlainObject = Record<string, unknown>;
|
|
2
|
-
|
|
3
|
-
function isObj(value: unknown): value is PlainObject {
|
|
4
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
type DeepMergeResult<T, U> = T extends PlainObject
|
|
8
|
-
? U extends PlainObject
|
|
9
|
-
? {
|
|
10
|
-
[K in keyof T | keyof U]: K extends keyof U ? (K extends keyof T ? DeepMergeResult<T[K], U[K]> : U[K]) : K extends keyof T ? T[K] : never;
|
|
11
|
-
}
|
|
12
|
-
: T
|
|
13
|
-
: U extends PlainObject
|
|
14
|
-
? U
|
|
15
|
-
: T;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 深いマージを行う関数
|
|
19
|
-
* @param origin - マージ先となる元オブジェクト
|
|
20
|
-
* @param source - マージするソース(このデータに更新される)
|
|
21
|
-
* @returns マージされたオブジェクト
|
|
22
|
-
*/
|
|
23
|
-
export function objDeepMerge<T extends Record<string, unknown>, U extends Record<string, unknown>>(origin: T, source: U): DeepMergeResult<T, U> {
|
|
24
|
-
const result = { ...origin } as Record<string, unknown>;
|
|
25
|
-
|
|
26
|
-
for (const key in source) {
|
|
27
|
-
if (Object.hasOwn(source, key)) {
|
|
28
|
-
const originValue = result[key];
|
|
29
|
-
const sourceValue = (source as Record<string, unknown>)[key];
|
|
30
|
-
|
|
31
|
-
if (!originValue) {
|
|
32
|
-
// origin側に存在しない新たなキーの場合はそのまま追加する
|
|
33
|
-
result[key] = sourceValue;
|
|
34
|
-
} else if (isObj(sourceValue) && isObj(originValue)) {
|
|
35
|
-
// どちらもオブジェクトの場合は再帰的にマージ
|
|
36
|
-
result[key] = objDeepMerge(originValue, sourceValue);
|
|
37
|
-
} else {
|
|
38
|
-
// どちらかのデータがobjectではない場合、そのまま上書き
|
|
39
|
-
result[key] = sourceValue;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return result as DeepMergeResult<T, U>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
type DeepArrayToSet<T> = T extends unknown[] ? Set<T[number]> : T extends PlainObject ? { [K in keyof T]: DeepArrayToSet<T[K]> } : T;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* オブジェクト内の配列を再帰的にSetに変換する関数
|
|
51
|
-
* @param obj - 変換対象のオブジェクト
|
|
52
|
-
* @returns 変換されたオブジェクト
|
|
53
|
-
*/
|
|
54
|
-
export function arrayConvertToSet<T>(obj: T): DeepArrayToSet<T> {
|
|
55
|
-
// 配列の場合はSetに変換
|
|
56
|
-
if (Array.isArray(obj)) {
|
|
57
|
-
return new Set(obj) as DeepArrayToSet<T>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// オブジェクトの場合は再帰的に処理
|
|
61
|
-
if (isObj(obj)) {
|
|
62
|
-
const result: Record<string, unknown> = {};
|
|
63
|
-
for (const key in obj) {
|
|
64
|
-
if (Object.hasOwn(obj, key)) {
|
|
65
|
-
result[key] = arrayConvertToSet(obj[key]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return result as DeepArrayToSet<T>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// その他の値はそのまま返す
|
|
72
|
-
return obj as DeepArrayToSet<T>;
|
|
73
|
-
}
|
package/config/index.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import defaultConfig from './default-config';
|
|
2
|
-
import userConfig from 'lism-css/config.js'; // ユーザーが上書きできる
|
|
3
|
-
import { objDeepMerge, arrayConvertToSet } from './helper';
|
|
4
|
-
|
|
5
|
-
interface Window {
|
|
6
|
-
_LISM_CSS_CONFIG_: Partial<typeof defaultConfig>;
|
|
7
|
-
}
|
|
8
|
-
declare const window: Window;
|
|
9
|
-
|
|
10
|
-
// ビルド時の設定をマージ
|
|
11
|
-
let mergedConfig = objDeepMerge(defaultConfig, userConfig);
|
|
12
|
-
|
|
13
|
-
// ブラウザ環境で window._LISM_CSS_CONFIG_ があればランタイムでマージ
|
|
14
|
-
if (typeof window !== 'undefined' && window._LISM_CSS_CONFIG_) {
|
|
15
|
-
mergedConfig = objDeepMerge(mergedConfig, window._LISM_CSS_CONFIG_);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const CONFIG = mergedConfig;
|
|
19
|
-
|
|
20
|
-
const { tokens, props, traits } = CONFIG;
|
|
21
|
-
|
|
22
|
-
const tokensWithColor = {
|
|
23
|
-
color: [...tokens.c.values, ...tokens.palette.values],
|
|
24
|
-
...tokens,
|
|
25
|
-
} as const;
|
|
26
|
-
|
|
27
|
-
// 配列を Set化.
|
|
28
|
-
export const TOKENS = arrayConvertToSet(structuredClone(tokensWithColor));
|
|
29
|
-
export const PROPS = arrayConvertToSet(structuredClone(props));
|
|
30
|
-
|
|
31
|
-
// TRAITS は objDeepMerge の型推論により literal types が保持される
|
|
32
|
-
export const TRAITS = traits;
|
|
33
|
-
|
|
34
|
-
// ブレイクポイント
|
|
35
|
-
export const BREAK_POINTS = ['sm', 'md', 'lg', 'xl'] as const;
|
|
36
|
-
export const BREAK_POINTS_ALL = ['base', ...BREAK_POINTS] as const;
|
package/config/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"declarationMap": false,
|
|
6
|
-
"declarationDir": "../dist/config",
|
|
7
|
-
"emitDeclarationOnly": true,
|
|
8
|
-
"outDir": "../dist/config",
|
|
9
|
-
"rootDir": ".",
|
|
10
|
-
"composite": false,
|
|
11
|
-
"baseUrl": "..",
|
|
12
|
-
"paths": {
|
|
13
|
-
"lism-css/config.js": ["./config.js"]
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"include": ["./**/*.ts"],
|
|
17
|
-
"exclude": ["**/*.test.ts"]
|
|
18
|
-
}
|