lism-css 0.5.0 → 0.5.2
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/build-config.js +2 -1
- package/config/index.js +9 -1
- package/dist/components/Dummy/index.js +8 -8
- package/dist/components/getLayoutProps.js +2 -2
- package/dist/config/index.js +9 -7
- package/dist/lib/getMaybeTokenValue.js +18 -18
- package/package.json +1 -1
- package/packages/astro/Dummy/Dummy.astro +1 -1
- package/src/scss/_prop-config.scss +1 -1
package/bin/build-config.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
|
-
|
|
4
|
+
// CLI実行時にsrcからとると見つかれないので dist からとる
|
|
5
|
+
import getMaybeTokenValue from '../dist/lib/getMaybeTokenValue.js';
|
|
5
6
|
|
|
6
7
|
// ES modules用の__dirname取得
|
|
7
8
|
const __filename = fileURLToPath(import.meta.url);
|
package/config/index.js
CHANGED
|
@@ -2,7 +2,15 @@ import defaultConfig from './default-config.js';
|
|
|
2
2
|
import userConfig from 'lism-css/config.js'; // ユーザーが上書きできる
|
|
3
3
|
import { objDeepMerge, arrayConvertToSet } from './helper.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// ビルド時の設定をマージ
|
|
6
|
+
let mergedConfig = objDeepMerge(defaultConfig, userConfig);
|
|
7
|
+
|
|
8
|
+
// ブラウザ環境で window._LISM_CSS_CONFIG_ があればランタイムでマージ
|
|
9
|
+
if (typeof window !== 'undefined' && window._LISM_CSS_CONFIG_) {
|
|
10
|
+
mergedConfig = objDeepMerge(mergedConfig, window._LISM_CSS_CONFIG_);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const CONFIG = mergedConfig;
|
|
6
14
|
|
|
7
15
|
const { tokens, props, states } = CONFIG;
|
|
8
16
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import u from "./getContent.js";
|
|
3
|
+
import e from "../Lism/index.js";
|
|
4
|
+
function h({ tag: t = "p", pre: r = "", length: i = "m", lang: o = "en", offset: s = 0, ...m }) {
|
|
5
5
|
if (t === "img")
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
const c =
|
|
8
|
-
return /* @__PURE__ */
|
|
6
|
+
return /* @__PURE__ */ n(e, { tag: "img", src: "https://cdn.lism-css.com/dummy-image.jpg", width: "600", height: "400", alt: "", ...m });
|
|
7
|
+
const c = u({ tag: t, pre: r, lang: o, length: i, offset: s });
|
|
8
|
+
return /* @__PURE__ */ n(e, { tag: t, ...m, dangerouslySetInnerHTML: { __html: c } });
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
h as default
|
|
12
12
|
};
|
|
@@ -14,13 +14,13 @@ function u({ _propConfig: e = {}, ...i }) {
|
|
|
14
14
|
return e.gta = { isVar: 1 }, e.gtc = { isVar: 1 }, e.gtr = { isVar: 1 }, i._propConfig = e, i;
|
|
15
15
|
}
|
|
16
16
|
function l({ sideW: e, mainW: i, style: r = {}, ...t }) {
|
|
17
|
-
return e != null && (r["--sideW"] = s("sz"
|
|
17
|
+
return e != null && (r["--sideW"] = s(e, "sz")), i != null && (r["--mainW"] = s(i, "sz")), t.style = r, t;
|
|
18
18
|
}
|
|
19
19
|
function m({ colSize: e, autoType: i, style: r = {}, ...t }) {
|
|
20
20
|
return e && (r["--colSize"] = e), i && (r["--autoType"] = i), t.style = r, t;
|
|
21
21
|
}
|
|
22
22
|
function a({ flow: e, style: i = {}, ...r }) {
|
|
23
|
-
return f("flow", e) ? r.lismClass = n(r.lismClass, `-flow:${e}`) : e && (i["--flow"] = s("space"
|
|
23
|
+
return f("flow", e) ? r.lismClass = n(r.lismClass, `-flow:${e}`) : e && (i["--flow"] = s(e, "space")), r.style = i, r;
|
|
24
24
|
}
|
|
25
25
|
export {
|
|
26
26
|
d as default
|
package/dist/config/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import n from "./default-config.js";
|
|
2
2
|
import r from "lism-css/config.js";
|
|
3
|
-
import { arrayConvertToSet as
|
|
4
|
-
|
|
3
|
+
import { arrayConvertToSet as t, objDeepMerge as e } from "./helper.js";
|
|
4
|
+
let o = e(n, r);
|
|
5
|
+
typeof window < "u" && window._LISM_CSS_CONFIG_ && (o = e(o, window._LISM_CSS_CONFIG_));
|
|
6
|
+
const s = o, { tokens: S, props: i, states: C } = s, _ = t(structuredClone(S)), c = t(structuredClone(i)), p = C, u = ["sm", "md", "lg", "xl"];
|
|
5
7
|
export {
|
|
6
|
-
|
|
8
|
+
u as BREAK_POINTS,
|
|
7
9
|
s as CONFIG,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
c as PROPS,
|
|
11
|
+
p as STATES,
|
|
12
|
+
_ as TOKENS
|
|
11
13
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
function c(
|
|
2
|
-
if (typeof
|
|
3
|
-
if (
|
|
4
|
-
let
|
|
5
|
-
return
|
|
1
|
+
function c(s, r, n) {
|
|
2
|
+
if (typeof s != "string") return r;
|
|
3
|
+
if (s === "color") {
|
|
4
|
+
let i = c("c", r, n);
|
|
5
|
+
return i === r && (i = c("palette", r, n)), i;
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
9
|
-
if (typeof r == "number" && (r = `${r}`),
|
|
10
|
-
if (
|
|
11
|
-
return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${
|
|
12
|
-
} else if (Array.isArray(
|
|
13
|
-
if (
|
|
14
|
-
return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${
|
|
15
|
-
} else if (typeof
|
|
16
|
-
const { pre:
|
|
17
|
-
if (
|
|
18
|
-
return `var(${
|
|
7
|
+
const t = n[s];
|
|
8
|
+
if (!t) return r;
|
|
9
|
+
if (typeof r == "number" && (r = `${r}`), t instanceof Set) {
|
|
10
|
+
if (t.has(r))
|
|
11
|
+
return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${s}--${r})`;
|
|
12
|
+
} else if (Array.isArray(t)) {
|
|
13
|
+
if (t.includes(r))
|
|
14
|
+
return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${s}--${r})`;
|
|
15
|
+
} else if (typeof t == "object") {
|
|
16
|
+
const { pre: i = "", values: f = [] } = t || {};
|
|
17
|
+
if (f instanceof Set && f.has(r))
|
|
18
|
+
return `var(${i}${r})`;
|
|
19
19
|
if (Array.isArray(f) && f.includes(r))
|
|
20
|
-
return `var(${
|
|
20
|
+
return `var(${i}${r})`;
|
|
21
21
|
}
|
|
22
22
|
return r;
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -9,5 +9,5 @@ const { tag = 'p', pre = '', length = 'm', lang = 'en', offset = 0, ...props } =
|
|
|
9
9
|
const content = getContent({ tag, pre, lang, length, offset });
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
{tag === 'img' && <Lism tag='img' src='https://
|
|
12
|
+
{tag === 'img' && <Lism tag='img' src='https://cdn.lism-css.com/dummy-image.jpg' width='600' height='400' alt='' {...props} />}
|
|
13
13
|
{tag !== 'img' && <Lism tag={tag} {...props} set:html={content} />}
|