@salty-css/core 0.1.0-alpha.32 → 0.1.0-alpha.34
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/{class-name-generator-B0WkxoIg.js → class-name-generator-B-D7IL8N.js} +2 -3
- package/{class-name-generator-BEOEMEKX.cjs → class-name-generator-BRDOJe3J.cjs} +6 -7
- package/compiler/salty-compiler.cjs +26 -15
- package/compiler/salty-compiler.js +18 -8
- package/css/index.cjs +0 -3
- package/css/index.d.ts +0 -1
- package/css/index.js +0 -3
- package/css/keyframes.cjs +2 -2
- package/css/keyframes.js +2 -2
- package/factories/index.cjs +4 -5
- package/factories/index.js +1 -2
- package/generators/index.cjs +3 -3
- package/generators/index.js +3 -3
- package/instances/classname-instance.cjs +1 -1
- package/instances/classname-instance.js +1 -1
- package/package.json +1 -9
- package/{parse-styles-lOMGe_c5.cjs → parse-styles-BWm11azy.cjs} +4 -4
- package/{parse-styles-BBJ3PWyV.js → parse-styles-w1u1BniY.js} +1 -1
- package/parsers/index.cjs +5 -6
- package/parsers/index.js +3 -4
- package/runtime/index.cjs +16 -3
- package/runtime/index.d.ts +7 -0
- package/runtime/index.js +16 -3
- package/{to-hash-DAN2LcHK.js → to-hash-DSoCPs8D.js} +8 -0
- package/{to-hash-C05Y906F.cjs → to-hash-DT2ImSPA.cjs} +8 -0
- package/util/index.cjs +3 -4
- package/util/index.js +1 -2
- package/cache/resolve-dynamic-config-cache.cjs +0 -24
- package/cache/resolve-dynamic-config-cache.d.ts +0 -1
- package/cache/resolve-dynamic-config-cache.js +0 -24
- package/css/dynamic-styles.cjs +0 -15
- package/css/dynamic-styles.d.ts +0 -10
- package/css/dynamic-styles.js +0 -15
- package/dash-case-DIwKaYgE.cjs +0 -9
- package/dash-case-DblXvymC.js +0 -10
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { p as parseAndJoinStyles, b as parseTemplateCallSite } from "./parse-styles-
|
|
5
|
-
import { d as dashCase } from "./
|
|
6
|
-
import { t as toHash } from "./to-hash-DAN2LcHK.js";
|
|
4
|
+
import { p as parseAndJoinStyles, b as parseTemplateCallSite } from "./parse-styles-w1u1BniY.js";
|
|
5
|
+
import { t as toHash, d as dashCase } from "./to-hash-DSoCPs8D.js";
|
|
7
6
|
class StylesGenerator {
|
|
8
7
|
constructor(params) {
|
|
9
8
|
__publicField(this, "buildContext", {});
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
const parseStyles = require("./parse-styles-
|
|
6
|
-
const
|
|
7
|
-
const toHash = require("./to-hash-C05Y906F.cjs");
|
|
5
|
+
const parseStyles = require("./parse-styles-BWm11azy.cjs");
|
|
6
|
+
const toHash = require("./to-hash-DT2ImSPA.cjs");
|
|
8
7
|
class StylesGenerator {
|
|
9
8
|
constructor(params) {
|
|
10
9
|
__publicField(this, "buildContext", {});
|
|
@@ -35,7 +34,7 @@ class StylesGenerator {
|
|
|
35
34
|
get cssFileName() {
|
|
36
35
|
const { callerName } = this.buildContext;
|
|
37
36
|
if (callerName) {
|
|
38
|
-
const dasherized =
|
|
37
|
+
const dasherized = toHash.dashCase(callerName);
|
|
39
38
|
return `cl_${dasherized}-${this.hash}.css`;
|
|
40
39
|
}
|
|
41
40
|
return `${this.hash}.css`;
|
|
@@ -58,12 +57,12 @@ class StylesGenerator {
|
|
|
58
57
|
const cumulative = [];
|
|
59
58
|
for (const part of path) {
|
|
60
59
|
cumulative.push(part);
|
|
61
|
-
const baseClassName =
|
|
60
|
+
const baseClassName = toHash.dashCase(`${key}-${cumulative.join(".")}`);
|
|
62
61
|
acc.push("t_" + toHash.toHash(baseClassName, 4));
|
|
63
62
|
for (const [axis, axisValue] of Object.entries(variants)) {
|
|
64
63
|
if (axisValue === false || axisValue === void 0) continue;
|
|
65
|
-
const valueSuffix = axisValue === true ? "" : `-${
|
|
66
|
-
const variantClassName = `${baseClassName}-${
|
|
64
|
+
const valueSuffix = axisValue === true ? "" : `-${toHash.dashCase(String(axisValue))}`;
|
|
65
|
+
const variantClassName = `${baseClassName}-${toHash.dashCase(axis)}${valueSuffix}`;
|
|
67
66
|
acc.push("tv_" + toHash.toHash(variantClassName, 4));
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -10,15 +10,15 @@ const promises = require("fs/promises");
|
|
|
10
10
|
const fs = require("fs");
|
|
11
11
|
const child_process = require("child_process");
|
|
12
12
|
const compiler_helpers = require("./helpers.cjs");
|
|
13
|
-
const
|
|
14
|
-
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
13
|
+
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
15
14
|
const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
|
|
16
15
|
const module$1 = require("module");
|
|
17
|
-
const parseStyles = require("../parse-styles-
|
|
16
|
+
const parseStyles = require("../parse-styles-BWm11azy.cjs");
|
|
18
17
|
const css_merge = require("../css/merge.cjs");
|
|
18
|
+
const compiler_getFiles = require("./get-files.cjs");
|
|
19
19
|
const parsers_index = require("../parsers/index.cjs");
|
|
20
|
-
const moduleType = require("../util/module-type");
|
|
21
20
|
const console = require("console");
|
|
21
|
+
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
22
22
|
function _interopNamespaceDefault(e) {
|
|
23
23
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
24
24
|
if (e) {
|
|
@@ -92,6 +92,20 @@ const resolveImport = (spec, sourceFile, destDir, options = {}) => {
|
|
|
92
92
|
copyAsset(absolute, destPath);
|
|
93
93
|
return { rule: buildRule(`../imports/${fileName}`, opts) };
|
|
94
94
|
};
|
|
95
|
+
const readPackageJsonModule = async (dirname) => {
|
|
96
|
+
const packageJsonContent = await compiler_getFiles.getPackageJson(dirname);
|
|
97
|
+
if (!packageJsonContent) return void 0;
|
|
98
|
+
return packageJsonContent.type;
|
|
99
|
+
};
|
|
100
|
+
let cachedModuleType;
|
|
101
|
+
const detectCurrentModuleType = async (dirname) => {
|
|
102
|
+
if (cachedModuleType) return cachedModuleType;
|
|
103
|
+
const packageJsonModule = await readPackageJsonModule(dirname);
|
|
104
|
+
if (packageJsonModule === "module") cachedModuleType = "esm";
|
|
105
|
+
else if (packageJsonModule === "commonjs") cachedModuleType = "cjs";
|
|
106
|
+
else if ((typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("compiler/salty-compiler.cjs", document.baseURI).href).endsWith(".cjs")) cachedModuleType = "cjs";
|
|
107
|
+
return cachedModuleType || "esm";
|
|
108
|
+
};
|
|
95
109
|
function dotCase(str) {
|
|
96
110
|
if (!str) return "";
|
|
97
111
|
if (typeof str !== "string") return dotCase(String(str));
|
|
@@ -207,7 +221,7 @@ class SaltyCompiler {
|
|
|
207
221
|
const destDir = await this.getDestDir();
|
|
208
222
|
const coreConfigPath = path.join(this.projectRootDir, (rcProject == null ? void 0 : rcProject.configDir) || "", "salty.config.ts");
|
|
209
223
|
const coreConfigDest = path.join(destDir, "salty.config.js");
|
|
210
|
-
const moduleType
|
|
224
|
+
const moduleType = await detectCurrentModuleType(this.projectRootDir);
|
|
211
225
|
const externalModules = this.getExternalModules(coreConfigPath);
|
|
212
226
|
await esbuild__namespace.build({
|
|
213
227
|
entryPoints: [coreConfigPath],
|
|
@@ -215,7 +229,7 @@ class SaltyCompiler {
|
|
|
215
229
|
treeShaking: true,
|
|
216
230
|
bundle: true,
|
|
217
231
|
outfile: coreConfigDest,
|
|
218
|
-
format: moduleType
|
|
232
|
+
format: moduleType,
|
|
219
233
|
external: externalModules
|
|
220
234
|
});
|
|
221
235
|
const { config } = await this.importFile(coreConfigDest);
|
|
@@ -377,7 +391,7 @@ ${currentFile}`;
|
|
|
377
391
|
const cssContent2 = localCssFile.map((file) => `@import url('./${file}');`).join("\n");
|
|
378
392
|
const hashName = toHash.toHash(src, 6);
|
|
379
393
|
const parsedPath = path.parse(src);
|
|
380
|
-
const dasherized =
|
|
394
|
+
const dasherized = toHash.dashCase(parsedPath.name);
|
|
381
395
|
const cssFile2 = path.join(destDir, `css/f_${dasherized}-${hashName}.css`);
|
|
382
396
|
fs.writeFileSync(cssFile2, cssContent2 || `/* Empty file */`);
|
|
383
397
|
});
|
|
@@ -475,10 +489,10 @@ ${css}
|
|
|
475
489
|
if (typeof value2 === "function") return await parseVariable(await value2());
|
|
476
490
|
if (typeof value2 === "object") return await parseVariables(value2, [...path2, key]);
|
|
477
491
|
const dottedKey = dotCase(key);
|
|
478
|
-
const dashedKey =
|
|
492
|
+
const dashedKey = toHash.dashCase(key);
|
|
479
493
|
const tsName = [...path2, dottedKey].join(".");
|
|
480
494
|
variableTokens.add(`"${tsName}"`);
|
|
481
|
-
const cssName = [...path2.map(
|
|
495
|
+
const cssName = [...path2.map(toHash.dashCase), dashedKey].join("-");
|
|
482
496
|
const result = parseStyles.parseVariableTokens(value2);
|
|
483
497
|
if (!result) return `--${cssName}: ${value2};`;
|
|
484
498
|
return `--${cssName}: ${result.transformed};`;
|
|
@@ -632,9 +646,6 @@ ${css}
|
|
|
632
646
|
fs.writeFileSync(tsTokensPath, tsTokensTypes);
|
|
633
647
|
const configCachePath = path.join(destDir, "cache/config-cache.json");
|
|
634
648
|
fs.writeFileSync(configCachePath, JSON.stringify(configCacheContent, null, 2));
|
|
635
|
-
const corePackageRoot = compiler_helpers.getCorePackageRoot();
|
|
636
|
-
const configCacheSecondaryPath = path.join(corePackageRoot, "cache/config-cache.json");
|
|
637
|
-
fs.writeFileSync(configCacheSecondaryPath, JSON.stringify(configCacheContent, null, 2));
|
|
638
649
|
});
|
|
639
650
|
__publicField(this, "compileSaltyFile", async (sourceFilePath, outputDirectory) => {
|
|
640
651
|
const hashedName = toHash.toHash(sourceFilePath);
|
|
@@ -649,7 +660,7 @@ ${css}
|
|
|
649
660
|
const rcProject = await this.getRCProjectConfig(this.projectRootDir);
|
|
650
661
|
const coreConfigPath = path.join(this.projectRootDir, (rcProject == null ? void 0 : rcProject.configDir) || "", "salty.config.ts");
|
|
651
662
|
const externalModules = this.getExternalModules(coreConfigPath);
|
|
652
|
-
const moduleType
|
|
663
|
+
const moduleType = await detectCurrentModuleType(this.projectRootDir);
|
|
653
664
|
await esbuild__namespace.build({
|
|
654
665
|
stdin: {
|
|
655
666
|
contents: currentFile,
|
|
@@ -661,7 +672,7 @@ ${css}
|
|
|
661
672
|
treeShaking: true,
|
|
662
673
|
bundle: true,
|
|
663
674
|
outfile: outputFilePath,
|
|
664
|
-
format: moduleType
|
|
675
|
+
format: moduleType,
|
|
665
676
|
target: ["node20"],
|
|
666
677
|
keepNames: true,
|
|
667
678
|
external: externalModules,
|
|
@@ -763,7 +774,7 @@ ${newContent}
|
|
|
763
774
|
const cssContent = cssFiles.flat().map((file2) => `@import url('./${file2}');`).join("\n");
|
|
764
775
|
const hashName = toHash.toHash(file, 6);
|
|
765
776
|
const parsedPath = path.parse(file);
|
|
766
|
-
const dasherized =
|
|
777
|
+
const dasherized = toHash.dashCase(parsedPath.name);
|
|
767
778
|
const cssFile = path.join(destDir, `css/f_${dasherized}-${hashName}.css`);
|
|
768
779
|
fs.writeFileSync(cssFile, cssContent || `/* Empty file */`);
|
|
769
780
|
}
|
|
@@ -7,15 +7,14 @@ import { createLogger, transports, format } from "winston";
|
|
|
7
7
|
import { readFile } from "fs/promises";
|
|
8
8
|
import { existsSync, mkdirSync, copyFileSync, readFileSync, statSync, readdirSync, writeFileSync } from "fs";
|
|
9
9
|
import { execSync } from "child_process";
|
|
10
|
-
import { isSaltyFile, resolveExportValue,
|
|
11
|
-
import { d as dashCase } from "../
|
|
12
|
-
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
10
|
+
import { isSaltyFile, resolveExportValue, saltyFileExtensions } from "./helpers.js";
|
|
11
|
+
import { t as toHash, d as dashCase } from "../to-hash-DSoCPs8D.js";
|
|
13
12
|
import { d as defineTemplates } from "../define-templates-CVhhgPnd.js";
|
|
14
13
|
import { createRequire } from "module";
|
|
15
|
-
import { p as parseAndJoinStyles, c as parseVariableTokens } from "../parse-styles-
|
|
14
|
+
import { p as parseAndJoinStyles, c as parseVariableTokens } from "../parse-styles-w1u1BniY.js";
|
|
16
15
|
import { mergeObjects, mergeFactories } from "../css/merge.js";
|
|
16
|
+
import { getPackageJson } from "./get-files.js";
|
|
17
17
|
import { parseTemplates, getTemplateTypes, getTemplateVariantMaps } from "../parsers/index.js";
|
|
18
|
-
import { detectCurrentModuleType } from "../util/module-type";
|
|
19
18
|
import console from "console";
|
|
20
19
|
const logger = createLogger({
|
|
21
20
|
level: "debug",
|
|
@@ -73,6 +72,20 @@ const resolveImport = (spec, sourceFile, destDir, options = {}) => {
|
|
|
73
72
|
copyAsset(absolute, destPath);
|
|
74
73
|
return { rule: buildRule(`../imports/${fileName}`, opts) };
|
|
75
74
|
};
|
|
75
|
+
const readPackageJsonModule = async (dirname2) => {
|
|
76
|
+
const packageJsonContent = await getPackageJson(dirname2);
|
|
77
|
+
if (!packageJsonContent) return void 0;
|
|
78
|
+
return packageJsonContent.type;
|
|
79
|
+
};
|
|
80
|
+
let cachedModuleType;
|
|
81
|
+
const detectCurrentModuleType = async (dirname2) => {
|
|
82
|
+
if (cachedModuleType) return cachedModuleType;
|
|
83
|
+
const packageJsonModule = await readPackageJsonModule(dirname2);
|
|
84
|
+
if (packageJsonModule === "module") cachedModuleType = "esm";
|
|
85
|
+
else if (packageJsonModule === "commonjs") cachedModuleType = "cjs";
|
|
86
|
+
else if (import.meta.url.endsWith(".cjs")) cachedModuleType = "cjs";
|
|
87
|
+
return cachedModuleType || "esm";
|
|
88
|
+
};
|
|
76
89
|
function dotCase(str) {
|
|
77
90
|
if (!str) return "";
|
|
78
91
|
if (typeof str !== "string") return dotCase(String(str));
|
|
@@ -613,9 +626,6 @@ ${css}
|
|
|
613
626
|
writeFileSync(tsTokensPath, tsTokensTypes);
|
|
614
627
|
const configCachePath = join(destDir, "cache/config-cache.json");
|
|
615
628
|
writeFileSync(configCachePath, JSON.stringify(configCacheContent, null, 2));
|
|
616
|
-
const corePackageRoot = getCorePackageRoot();
|
|
617
|
-
const configCacheSecondaryPath = join(corePackageRoot, "cache/config-cache.json");
|
|
618
|
-
writeFileSync(configCacheSecondaryPath, JSON.stringify(configCacheContent, null, 2));
|
|
619
629
|
});
|
|
620
630
|
__publicField(this, "compileSaltyFile", async (sourceFilePath, outputDirectory) => {
|
|
621
631
|
const hashedName = toHash(sourceFilePath);
|
package/css/index.cjs
CHANGED
|
@@ -4,12 +4,9 @@ const css_keyframes = require("./keyframes.cjs");
|
|
|
4
4
|
const css_media = require("./media.cjs");
|
|
5
5
|
const css_token = require("./token.cjs");
|
|
6
6
|
const css_merge = require("./merge.cjs");
|
|
7
|
-
const css_dynamicStyles = require("./dynamic-styles.cjs");
|
|
8
7
|
exports.keyframes = css_keyframes.keyframes;
|
|
9
8
|
exports.MediaQueryFactory = css_media.MediaQueryFactory;
|
|
10
9
|
exports.media = css_media.media;
|
|
11
10
|
exports.token = css_token.token;
|
|
12
11
|
exports.mergeFactories = css_merge.mergeFactories;
|
|
13
12
|
exports.mergeObjects = css_merge.mergeObjects;
|
|
14
|
-
exports.getDynamicStylesClassName = css_dynamicStyles.getDynamicStylesClassName;
|
|
15
|
-
exports.getDynamicStylesCss = css_dynamicStyles.getDynamicStylesCss;
|
package/css/index.d.ts
CHANGED
package/css/index.js
CHANGED
|
@@ -2,11 +2,8 @@ import { keyframes } from "./keyframes.js";
|
|
|
2
2
|
import { MediaQueryFactory, media } from "./media.js";
|
|
3
3
|
import { token } from "./token.js";
|
|
4
4
|
import { mergeFactories, mergeObjects } from "./merge.js";
|
|
5
|
-
import { getDynamicStylesClassName, getDynamicStylesCss } from "./dynamic-styles.js";
|
|
6
5
|
export {
|
|
7
6
|
MediaQueryFactory,
|
|
8
|
-
getDynamicStylesClassName,
|
|
9
|
-
getDynamicStylesCss,
|
|
10
7
|
keyframes,
|
|
11
8
|
media,
|
|
12
9
|
mergeFactories,
|
package/css/keyframes.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-
|
|
4
|
-
const toHash = require("../to-hash-
|
|
3
|
+
const parseStyles = require("../parse-styles-BWm11azy.cjs");
|
|
4
|
+
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
5
5
|
const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
|
|
6
6
|
const modifyKeyframes = async (params = {}) => {
|
|
7
7
|
const animationName = _name || toHash.toHash(keyframes2);
|
package/css/keyframes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as parseAndJoinStyles } from "../parse-styles-
|
|
2
|
-
import { t as toHash } from "../to-hash-
|
|
1
|
+
import { p as parseAndJoinStyles } from "../parse-styles-w1u1BniY.js";
|
|
2
|
+
import { t as toHash } from "../to-hash-DSoCPs8D.js";
|
|
3
3
|
const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
|
|
4
4
|
const modifyKeyframes = async (params = {}) => {
|
|
5
5
|
const animationName = _name || toHash(keyframes2);
|
package/factories/index.cjs
CHANGED
|
@@ -3,8 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
-
const
|
|
7
|
-
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
6
|
+
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
8
7
|
const css_media = require("../css/media.cjs");
|
|
9
8
|
const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
|
|
10
9
|
const FONT_FORMAT_BY_EXTENSION = {
|
|
@@ -35,11 +34,11 @@ const normalizeVariable = (variable) => {
|
|
|
35
34
|
const trimmed = variable.trim();
|
|
36
35
|
const stripped = trimmed.replace(/^--/, "");
|
|
37
36
|
if (!stripped) throw new Error(`defineFont: invalid \`variable\` value "${variable}".`);
|
|
38
|
-
return `--${
|
|
37
|
+
return `--${toHash.dashCase(stripped)}`;
|
|
39
38
|
};
|
|
40
39
|
const deriveVariable = (options) => {
|
|
41
40
|
const hashSource = [options.name, options.fallback, "variants" in options ? options.variants : void 0, "import" in options ? options.import : void 0];
|
|
42
|
-
return `--font-${
|
|
41
|
+
return `--font-${toHash.dashCase(options.name)}-${toHash.toHash(hashSource, 6)}`;
|
|
43
42
|
};
|
|
44
43
|
const quoteFamily = (name) => {
|
|
45
44
|
if (/^["'].*["']$/.test(name)) return name;
|
|
@@ -90,7 +89,7 @@ class FontFactory {
|
|
|
90
89
|
}
|
|
91
90
|
this.variable = _options.variable ? normalizeVariable(_options.variable) : deriveVariable(_options);
|
|
92
91
|
this.fontFamily = buildFontFamilyValue(_options.name, _options.fallback);
|
|
93
|
-
this.className = `font-${
|
|
92
|
+
this.className = `font-${toHash.dashCase(_options.name)}`;
|
|
94
93
|
}
|
|
95
94
|
get isDefineFont() {
|
|
96
95
|
return true;
|
package/factories/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { d as dashCase } from "../
|
|
5
|
-
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
4
|
+
import { d as dashCase, t as toHash } from "../to-hash-DSoCPs8D.js";
|
|
6
5
|
import { media } from "../css/media.js";
|
|
7
6
|
import { T, a, d } from "../define-templates-CVhhgPnd.js";
|
|
8
7
|
const FONT_FORMAT_BY_EXTENSION = {
|
package/generators/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const classNameGenerator = require("../class-name-generator-
|
|
4
|
-
const
|
|
3
|
+
const classNameGenerator = require("../class-name-generator-BRDOJe3J.cjs");
|
|
4
|
+
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
5
5
|
class StyledGenerator extends classNameGenerator.StylesGenerator {
|
|
6
6
|
constructor(tagName, _params) {
|
|
7
7
|
super(_params);
|
|
@@ -35,7 +35,7 @@ class StyledGenerator extends classNameGenerator.StylesGenerator {
|
|
|
35
35
|
if (matches) {
|
|
36
36
|
matches.forEach((match) => {
|
|
37
37
|
const value = match.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1");
|
|
38
|
-
const dashed =
|
|
38
|
+
const dashed = toHash.dashCase(value);
|
|
39
39
|
if (value) propValueKeys.add(dashed);
|
|
40
40
|
});
|
|
41
41
|
}
|
package/generators/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as StylesGenerator } from "../class-name-generator-
|
|
2
|
-
import { C } from "../class-name-generator-
|
|
3
|
-
import { d as dashCase } from "../
|
|
1
|
+
import { S as StylesGenerator } from "../class-name-generator-B-D7IL8N.js";
|
|
2
|
+
import { C } from "../class-name-generator-B-D7IL8N.js";
|
|
3
|
+
import { d as dashCase } from "../to-hash-DSoCPs8D.js";
|
|
4
4
|
class StyledGenerator extends StylesGenerator {
|
|
5
5
|
constructor(tagName, _params) {
|
|
6
6
|
super(_params);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const classNameGenerator = require("../class-name-generator-
|
|
3
|
+
const classNameGenerator = require("../class-name-generator-BRDOJe3J.cjs");
|
|
4
4
|
const classNameInstance = (params) => {
|
|
5
5
|
const generator = new classNameGenerator.ClassNameGenerator(params);
|
|
6
6
|
const createClass = (classNameStr) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ClassNameGenerator } from "../class-name-generator-
|
|
1
|
+
import { C as ClassNameGenerator } from "../class-name-generator-B-D7IL8N.js";
|
|
2
2
|
const classNameInstance = (params) => {
|
|
3
3
|
const generator = new ClassNameGenerator(params);
|
|
4
4
|
const createClass = (classNameStr) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salty-css/core",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.34",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -87,10 +87,6 @@
|
|
|
87
87
|
"import": "./css/merge.js",
|
|
88
88
|
"require": "./css/merge.cjs"
|
|
89
89
|
},
|
|
90
|
-
"./css/dynamic-styles": {
|
|
91
|
-
"import": "./css/dynamic-styles.js",
|
|
92
|
-
"require": "./css/dynamic-styles.cjs"
|
|
93
|
-
},
|
|
94
90
|
"./helpers": {
|
|
95
91
|
"import": "./helpers/index.js",
|
|
96
92
|
"require": "./helpers/index.cjs"
|
|
@@ -119,10 +115,6 @@
|
|
|
119
115
|
"import": "./server/index.js",
|
|
120
116
|
"require": "./server/index.cjs"
|
|
121
117
|
},
|
|
122
|
-
"./cache/resolve-dynamic-config-cache": {
|
|
123
|
-
"import": "./cache/resolve-dynamic-config-cache.js",
|
|
124
|
-
"require": "./cache/resolve-dynamic-config-cache.cjs"
|
|
125
|
-
},
|
|
126
118
|
"./instances/classname-instance": {
|
|
127
119
|
"import": "./instances/classname-instance.js",
|
|
128
120
|
"require": "./instances/classname-instance.cjs"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const toHash = require("./to-hash-DT2ImSPA.cjs");
|
|
3
3
|
const viewportClamp = require("./viewport-clamp-CEmzmcSj.cjs");
|
|
4
4
|
const parseValueModifiers = (modifiers) => (value) => {
|
|
5
5
|
if (typeof value !== "string") return void 0;
|
|
@@ -21,7 +21,7 @@ const parseValueTokens = (tokenNames) => (value) => {
|
|
|
21
21
|
const hasToken = /\{[^{}]+\}/g.test(value);
|
|
22
22
|
if (!hasToken) return void 0;
|
|
23
23
|
const transformed = value.replace(/\{([^{}]+)\}/g, (...args) => {
|
|
24
|
-
const variable =
|
|
24
|
+
const variable = toHash.dashCase(args[1].trim().replaceAll(".", "-"));
|
|
25
25
|
if (tokenNames && !tokenNames.includes(variable)) console.warn(`Token ${variable} might not exist`);
|
|
26
26
|
if (variable.startsWith("-")) return `-${variable}`;
|
|
27
27
|
return `var(--${variable})`;
|
|
@@ -84,8 +84,8 @@ const isVendorPrefixed = (key) => {
|
|
|
84
84
|
};
|
|
85
85
|
const propertyNameCheck = (key) => {
|
|
86
86
|
if (key.startsWith("-")) return key;
|
|
87
|
-
if (isVendorPrefixed(key)) return `-${
|
|
88
|
-
return
|
|
87
|
+
if (isVendorPrefixed(key)) return `-${toHash.dashCase(key)}`;
|
|
88
|
+
return toHash.dashCase(key);
|
|
89
89
|
};
|
|
90
90
|
const reportParserIssue = (strict, message) => {
|
|
91
91
|
if (strict === true) throw new Error(`[salty-css] ${message}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as dashCase } from "./
|
|
1
|
+
import { d as dashCase } from "./to-hash-DSoCPs8D.js";
|
|
2
2
|
import { d as defineViewportClamp } from "./viewport-clamp-K553uXu3.js";
|
|
3
3
|
const parseValueModifiers = (modifiers) => (value) => {
|
|
4
4
|
if (typeof value !== "string") return void 0;
|
package/parsers/index.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-
|
|
4
|
-
const
|
|
5
|
-
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
3
|
+
const parseStyles = require("../parse-styles-BWm11azy.cjs");
|
|
4
|
+
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
6
5
|
const RICH_META_KEYS = /* @__PURE__ */ new Set(["base", "variants", "defaultVariants", "compoundVariants", "anyOfVariants"]);
|
|
7
6
|
const isChildEntry = (key, value) => {
|
|
8
7
|
if (RICH_META_KEYS.has(key)) return false;
|
|
@@ -13,7 +12,7 @@ const parseTemplates = async (obj, path = []) => {
|
|
|
13
12
|
const classes = [];
|
|
14
13
|
if (parseStyles.isRichTemplateNode(obj)) {
|
|
15
14
|
const rich = obj;
|
|
16
|
-
const baseClassName = path.map((p) =>
|
|
15
|
+
const baseClassName = path.map((p) => toHash.dashCase(String(p))).join("-");
|
|
17
16
|
if (rich.base) {
|
|
18
17
|
const hashClass = "t_" + toHash.toHash(baseClassName, 4);
|
|
19
18
|
const result = await parseStyles.parseAndJoinStyles(rich.base, `.${baseClassName}, .${hashClass}`);
|
|
@@ -24,7 +23,7 @@ const parseTemplates = async (obj, path = []) => {
|
|
|
24
23
|
if (!valueMap || typeof valueMap !== "object") continue;
|
|
25
24
|
for (const [value, styles] of Object.entries(valueMap)) {
|
|
26
25
|
if (!styles || typeof styles !== "object") continue;
|
|
27
|
-
const variantClassName = `${baseClassName}-${
|
|
26
|
+
const variantClassName = `${baseClassName}-${toHash.dashCase(axis)}-${toHash.dashCase(value)}`;
|
|
28
27
|
const variantHashClass = "tv_" + toHash.toHash(variantClassName, 4);
|
|
29
28
|
const result = await parseStyles.parseAndJoinStyles(styles, `.${variantClassName}, .${variantHashClass}`);
|
|
30
29
|
classes.push(result);
|
|
@@ -50,7 +49,7 @@ const parseTemplates = async (obj, path = []) => {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
if (Object.keys(levelStyles).length) {
|
|
53
|
-
const className = path.map((p) =>
|
|
52
|
+
const className = path.map((p) => toHash.dashCase(String(p))).join("-");
|
|
54
53
|
const hashClass = "t_" + toHash.toHash(className, 4);
|
|
55
54
|
const result = await parseStyles.parseAndJoinStyles(levelStyles, `.${className}, .${hashClass}`);
|
|
56
55
|
classes.push(result);
|
package/parsers/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { i as isRichTemplateNode, p as parseAndJoinStyles } from "../parse-styles-
|
|
2
|
-
import { a, d, e, c, r } from "../parse-styles-
|
|
3
|
-
import { d as dashCase } from "../
|
|
4
|
-
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
1
|
+
import { i as isRichTemplateNode, p as parseAndJoinStyles } from "../parse-styles-w1u1BniY.js";
|
|
2
|
+
import { a, d, e, c, r } from "../parse-styles-w1u1BniY.js";
|
|
3
|
+
import { d as dashCase, t as toHash } from "../to-hash-DSoCPs8D.js";
|
|
5
4
|
const RICH_META_KEYS = /* @__PURE__ */ new Set(["base", "variants", "defaultVariants", "compoundVariants", "anyOfVariants"]);
|
|
6
5
|
const isChildEntry = (key, value) => {
|
|
7
6
|
if (RICH_META_KEYS.has(key)) return false;
|
package/runtime/index.cjs
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-
|
|
3
|
+
const parseStyles = require("../parse-styles-BWm11azy.cjs");
|
|
4
|
+
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
4
5
|
const defineRuntime = (config) => {
|
|
5
|
-
const
|
|
6
|
+
const className = (styles) => toHash.toHash(styles);
|
|
7
|
+
const css = async (styles, scope) => {
|
|
6
8
|
const parsed = await parseStyles.parseStyles(styles, scope, config);
|
|
7
9
|
return parsed.join("\n");
|
|
8
10
|
};
|
|
9
|
-
|
|
11
|
+
const resolve = async (styles, scope) => {
|
|
12
|
+
const _className = className(styles);
|
|
13
|
+
const _css = await css(styles, scope || `.${_className}`);
|
|
14
|
+
return { className: _className, css: _css };
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
className,
|
|
18
|
+
css,
|
|
19
|
+
resolve,
|
|
20
|
+
/** @deprecated Use `css` instead. Kept as an alias for backward compatibility with the standalone `getDynamicStylesCss` helper. */
|
|
21
|
+
getDynamicStylesCss: css
|
|
22
|
+
};
|
|
10
23
|
};
|
|
11
24
|
exports.defineRuntime = defineRuntime;
|
package/runtime/index.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import { CachedConfig, SaltyConfig } from '../config';
|
|
|
2
2
|
import { BaseStyles } from '../types';
|
|
3
3
|
type Config = Partial<SaltyConfig & CachedConfig>;
|
|
4
4
|
export declare const defineRuntime: (config: Config) => {
|
|
5
|
+
className: (styles: BaseStyles) => string;
|
|
6
|
+
css: (styles: BaseStyles, scope?: string) => Promise<string>;
|
|
7
|
+
resolve: (styles: BaseStyles, scope?: string) => Promise<{
|
|
8
|
+
className: string;
|
|
9
|
+
css: string;
|
|
10
|
+
}>;
|
|
11
|
+
/** @deprecated Use `css` instead. Kept as an alias for backward compatibility with the standalone `getDynamicStylesCss` helper. */
|
|
5
12
|
getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
|
|
6
13
|
};
|
|
7
14
|
export {};
|
package/runtime/index.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import { a as parseStyles } from "../parse-styles-
|
|
1
|
+
import { a as parseStyles } from "../parse-styles-w1u1BniY.js";
|
|
2
|
+
import { t as toHash } from "../to-hash-DSoCPs8D.js";
|
|
2
3
|
const defineRuntime = (config) => {
|
|
3
|
-
const
|
|
4
|
+
const className = (styles) => toHash(styles);
|
|
5
|
+
const css = async (styles, scope) => {
|
|
4
6
|
const parsed = await parseStyles(styles, scope, config);
|
|
5
7
|
return parsed.join("\n");
|
|
6
8
|
};
|
|
7
|
-
|
|
9
|
+
const resolve = async (styles, scope) => {
|
|
10
|
+
const _className = className(styles);
|
|
11
|
+
const _css = await css(styles, scope || `.${_className}`);
|
|
12
|
+
return { className: _className, css: _css };
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
className,
|
|
16
|
+
css,
|
|
17
|
+
resolve,
|
|
18
|
+
/** @deprecated Use `css` instead. Kept as an alias for backward compatibility with the standalone `getDynamicStylesCss` helper. */
|
|
19
|
+
getDynamicStylesCss: css
|
|
20
|
+
};
|
|
8
21
|
};
|
|
9
22
|
export {
|
|
10
23
|
defineRuntime
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
function dashCase(str) {
|
|
2
|
+
if (!str) return "";
|
|
3
|
+
if (typeof str !== "string") return dashCase(String(str));
|
|
4
|
+
return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
|
|
5
|
+
return (i > 0 ? "-" : "") + s.toLowerCase();
|
|
6
|
+
});
|
|
7
|
+
}
|
|
1
8
|
const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
2
9
|
const toAlphabeticName = (code, length) => {
|
|
3
10
|
let name = "";
|
|
@@ -21,5 +28,6 @@ const toHash = (value, length = 5) => {
|
|
|
21
28
|
return toAlphabeticName(numericHash, length);
|
|
22
29
|
};
|
|
23
30
|
export {
|
|
31
|
+
dashCase as d,
|
|
24
32
|
toHash as t
|
|
25
33
|
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
function dashCase(str) {
|
|
3
|
+
if (!str) return "";
|
|
4
|
+
if (typeof str !== "string") return dashCase(String(str));
|
|
5
|
+
return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
|
|
6
|
+
return (i > 0 ? "-" : "") + s.toLowerCase();
|
|
7
|
+
});
|
|
8
|
+
}
|
|
2
9
|
const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
3
10
|
const toAlphabeticName = (code, length) => {
|
|
4
11
|
let name = "";
|
|
@@ -21,4 +28,5 @@ const toHash = (value, length = 5) => {
|
|
|
21
28
|
const numericHash = toPhash(5381, JSON.stringify(value)) >>> 0;
|
|
22
29
|
return toAlphabeticName(numericHash, length);
|
|
23
30
|
};
|
|
31
|
+
exports.dashCase = dashCase;
|
|
24
32
|
exports.toHash = toHash;
|
package/util/index.cjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const toHash = require("../to-hash-DT2ImSPA.cjs");
|
|
4
4
|
const pascalCase = require("../pascal-case-By_l58S-.cjs");
|
|
5
|
-
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
6
5
|
function camelCase(str) {
|
|
7
6
|
if (!str) return "";
|
|
8
7
|
if (typeof str !== "string") return camelCase(String(str));
|
|
9
8
|
return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
10
9
|
}
|
|
11
|
-
exports.dashCase =
|
|
12
|
-
exports.pascalCase = pascalCase.pascalCase;
|
|
10
|
+
exports.dashCase = toHash.dashCase;
|
|
13
11
|
exports.toHash = toHash.toHash;
|
|
12
|
+
exports.pascalCase = pascalCase.pascalCase;
|
|
14
13
|
exports.camelCase = camelCase;
|
package/util/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { d } from "../
|
|
1
|
+
import { d, t } from "../to-hash-DSoCPs8D.js";
|
|
2
2
|
import { p } from "../pascal-case-F3Usi5Wf.js";
|
|
3
|
-
import { t } from "../to-hash-DAN2LcHK.js";
|
|
4
3
|
function camelCase(str) {
|
|
5
4
|
if (!str) return "";
|
|
6
5
|
if (typeof str !== "string") return camelCase(String(str));
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const promises = require("fs/promises");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const resolveDynamicConfigCache = async () => {
|
|
6
|
-
const currentDir = process.cwd();
|
|
7
|
-
const filename = "config-cache.json";
|
|
8
|
-
const patterns = ["", "saltygen", "src", "src/saltygen", "cache", "src/cache", "saltygen/cache", "src/saltygen/cache"];
|
|
9
|
-
let contents = "";
|
|
10
|
-
for (const pattern of patterns) {
|
|
11
|
-
const potentialPath = path.join(currentDir, pattern, filename);
|
|
12
|
-
try {
|
|
13
|
-
contents = await promises.readFile(potentialPath, "utf8");
|
|
14
|
-
break;
|
|
15
|
-
} catch {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (!contents) {
|
|
19
|
-
console.warn(`Could not find config cache file (${filename}) in any of the expected locations.`);
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
return JSON.parse(contents);
|
|
23
|
-
};
|
|
24
|
-
exports.resolveDynamicConfigCache = resolveDynamicConfigCache;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const resolveDynamicConfigCache: () => Promise<any>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { readFile } from "fs/promises";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
const resolveDynamicConfigCache = async () => {
|
|
4
|
-
const currentDir = process.cwd();
|
|
5
|
-
const filename = "config-cache.json";
|
|
6
|
-
const patterns = ["", "saltygen", "src", "src/saltygen", "cache", "src/cache", "saltygen/cache", "src/saltygen/cache"];
|
|
7
|
-
let contents = "";
|
|
8
|
-
for (const pattern of patterns) {
|
|
9
|
-
const potentialPath = join(currentDir, pattern, filename);
|
|
10
|
-
try {
|
|
11
|
-
contents = await readFile(potentialPath, "utf8");
|
|
12
|
-
break;
|
|
13
|
-
} catch {
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (!contents) {
|
|
17
|
-
console.warn(`Could not find config cache file (${filename}) in any of the expected locations.`);
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
return JSON.parse(contents);
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
resolveDynamicConfigCache
|
|
24
|
-
};
|
package/css/dynamic-styles.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-lOMGe_c5.cjs");
|
|
4
|
-
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
5
|
-
const cache_resolveDynamicConfigCache = require("../cache/resolve-dynamic-config-cache.cjs");
|
|
6
|
-
const getDynamicStylesClassName = (styles) => {
|
|
7
|
-
return toHash.toHash(styles);
|
|
8
|
-
};
|
|
9
|
-
const getDynamicStylesCss = async (styles, scope) => {
|
|
10
|
-
const config = await cache_resolveDynamicConfigCache.resolveDynamicConfigCache();
|
|
11
|
-
const parsed = await parseStyles.parseStyles(styles, scope, config);
|
|
12
|
-
return parsed.join("\n");
|
|
13
|
-
};
|
|
14
|
-
exports.getDynamicStylesClassName = getDynamicStylesClassName;
|
|
15
|
-
exports.getDynamicStylesCss = getDynamicStylesCss;
|
package/css/dynamic-styles.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseStyles } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Create a hash of the dynamic styles that then can be used as scope.
|
|
4
|
-
*/
|
|
5
|
-
export declare const getDynamicStylesClassName: (styles: BaseStyles) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Add any dynamic styles to your app with a custom scope.
|
|
8
|
-
* Note: this works only with server components.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
|
package/css/dynamic-styles.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { a as parseStyles } from "../parse-styles-BBJ3PWyV.js";
|
|
2
|
-
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
3
|
-
import { resolveDynamicConfigCache } from "../cache/resolve-dynamic-config-cache.js";
|
|
4
|
-
const getDynamicStylesClassName = (styles) => {
|
|
5
|
-
return toHash(styles);
|
|
6
|
-
};
|
|
7
|
-
const getDynamicStylesCss = async (styles, scope) => {
|
|
8
|
-
const config = await resolveDynamicConfigCache();
|
|
9
|
-
const parsed = await parseStyles(styles, scope, config);
|
|
10
|
-
return parsed.join("\n");
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
getDynamicStylesClassName,
|
|
14
|
-
getDynamicStylesCss
|
|
15
|
-
};
|
package/dash-case-DIwKaYgE.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function dashCase(str) {
|
|
3
|
-
if (!str) return "";
|
|
4
|
-
if (typeof str !== "string") return dashCase(String(str));
|
|
5
|
-
return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
|
|
6
|
-
return (i > 0 ? "-" : "") + s.toLowerCase();
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
exports.dashCase = dashCase;
|
package/dash-case-DblXvymC.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
function dashCase(str) {
|
|
2
|
-
if (!str) return "";
|
|
3
|
-
if (typeof str !== "string") return dashCase(String(str));
|
|
4
|
-
return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
|
|
5
|
-
return (i > 0 ? "-" : "") + s.toLowerCase();
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
dashCase as d
|
|
10
|
-
};
|