@salty-css/core 0.0.1-alpha.335 → 0.0.1-alpha.336
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-7NA8gtKo.cjs → class-name-generator-B_LEduWe.cjs} +5 -4
- package/{class-name-generator-D7IidIMe.js → class-name-generator-i5iaicjF.js} +3 -2
- package/compiler/as-class.cjs +8 -7
- package/compiler/as-class.js +3 -2
- package/css/keyframes.cjs +2 -2
- package/css/keyframes.js +2 -2
- package/dash-case-DIwKaYgE.cjs +9 -0
- package/dash-case-DblXvymC.js +10 -0
- 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 +5 -1
- package/{parse-styles-gRr_iCy7.cjs → parse-styles-DDx7UpaY.cjs} +4 -4
- package/{parse-styles-CS97_e4S.js → parse-styles-DQoke7UP.js} +4 -4
- package/parsers/index.cjs +4 -3
- package/parsers/index.js +7 -6
- package/runtime/index.cjs +11 -0
- package/runtime/index.d.ts +5 -0
- package/runtime/index.js +11 -0
- package/{to-hash-DT2ImSPA.cjs → to-hash-C05Y906F.cjs} +0 -8
- package/{to-hash-DSoCPs8D.js → to-hash-DAN2LcHK.js} +0 -8
- package/util/index.cjs +4 -3
- package/util/index.js +2 -1
|
@@ -2,8 +2,9 @@
|
|
|
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
|
|
5
|
+
const parseStyles = require("./parse-styles-DDx7UpaY.cjs");
|
|
6
|
+
const dashCase = require("./dash-case-DIwKaYgE.cjs");
|
|
7
|
+
const toHash = require("./to-hash-C05Y906F.cjs");
|
|
7
8
|
class StylesGenerator {
|
|
8
9
|
constructor(params) {
|
|
9
10
|
__publicField(this, "buildContext", {});
|
|
@@ -34,7 +35,7 @@ class StylesGenerator {
|
|
|
34
35
|
get cssFileName() {
|
|
35
36
|
const { callerName } = this.buildContext;
|
|
36
37
|
if (callerName) {
|
|
37
|
-
const dasherized =
|
|
38
|
+
const dasherized = dashCase.dashCase(callerName);
|
|
38
39
|
return `cl_${dasherized}-${this.hash}.css`;
|
|
39
40
|
}
|
|
40
41
|
return `${this.hash}.css`;
|
|
@@ -50,7 +51,7 @@ class StylesGenerator {
|
|
|
50
51
|
if (!(config == null ? void 0 : config.templates) || !this.params.base || this.priority > 0) return [];
|
|
51
52
|
const templateKeys = Object.keys(config.templates);
|
|
52
53
|
return Object.entries(this.params.base).reduce((acc, [key, value]) => {
|
|
53
|
-
if (templateKeys.includes(key)) acc.push("t_" + toHash.toHash(
|
|
54
|
+
if (templateKeys.includes(key)) acc.push("t_" + toHash.toHash(dashCase.dashCase(`${key}-${value}`), 4));
|
|
54
55
|
return acc;
|
|
55
56
|
}, []);
|
|
56
57
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
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 } from "./parse-styles-
|
|
5
|
-
import {
|
|
4
|
+
import { p as parseAndJoinStyles } from "./parse-styles-DQoke7UP.js";
|
|
5
|
+
import { d as dashCase } from "./dash-case-DblXvymC.js";
|
|
6
|
+
import { t as toHash } from "./to-hash-DAN2LcHK.js";
|
|
6
7
|
class StylesGenerator {
|
|
7
8
|
constructor(params) {
|
|
8
9
|
__publicField(this, "buildContext", {});
|
package/compiler/as-class.cjs
CHANGED
|
@@ -11,8 +11,9 @@ const fs = require("fs");
|
|
|
11
11
|
const child_process = require("child_process");
|
|
12
12
|
const compiler_helpers = require("./helpers.cjs");
|
|
13
13
|
const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const dashCase = require("../dash-case-DIwKaYgE.cjs");
|
|
15
|
+
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
16
|
+
const parseStyles = require("../parse-styles-DDx7UpaY.cjs");
|
|
16
17
|
const css_merge = require("../css/merge.cjs");
|
|
17
18
|
const compiler_getFiles = require("./get-files.cjs");
|
|
18
19
|
const parsers_index = require("../parsers/index.cjs");
|
|
@@ -342,7 +343,7 @@ ${currentFile}`;
|
|
|
342
343
|
const cssContent2 = localCssFile.map((file) => `@import url('./${file}');`).join("\n");
|
|
343
344
|
const hashName = toHash.toHash(src, 6);
|
|
344
345
|
const parsedPath = path.parse(src);
|
|
345
|
-
const dasherized =
|
|
346
|
+
const dasherized = dashCase.dashCase(parsedPath.name);
|
|
346
347
|
const cssFile2 = path.join(destDir, `css/f_${dasherized}-${hashName}.css`);
|
|
347
348
|
fs.writeFileSync(cssFile2, cssContent2 || `/* Empty file */`);
|
|
348
349
|
});
|
|
@@ -433,10 +434,10 @@ ${css}
|
|
|
433
434
|
if (typeof value2 === "function") return await parseVariable(await value2());
|
|
434
435
|
if (typeof value2 === "object") return await parseVariables(value2, [...path2, key]);
|
|
435
436
|
const dottedKey = dotCase(key);
|
|
436
|
-
const dashedKey =
|
|
437
|
+
const dashedKey = dashCase.dashCase(key);
|
|
437
438
|
const tsName = [...path2, dottedKey].join(".");
|
|
438
439
|
variableTokens.add(`"${tsName}"`);
|
|
439
|
-
const cssName = [...path2.map(
|
|
440
|
+
const cssName = [...path2.map(dashCase.dashCase), dashedKey].join("-");
|
|
440
441
|
const result = parseStyles.parseVariableTokens(value2);
|
|
441
442
|
if (!result) return `--${cssName}: ${value2};`;
|
|
442
443
|
return `--${cssName}: ${result.transformed};`;
|
|
@@ -621,7 +622,7 @@ ${css}
|
|
|
621
622
|
if (config.importStrategy === "component") {
|
|
622
623
|
const fileHash = toHash.toHash(file, 6);
|
|
623
624
|
const parsed = path.parse(file);
|
|
624
|
-
const dasherized =
|
|
625
|
+
const dasherized = dashCase.dashCase(parsed.name);
|
|
625
626
|
const cssFileName = `f_${dasherized}-${fileHash}.css`;
|
|
626
627
|
current = `import '../../saltygen/css/${cssFileName}';
|
|
627
628
|
${current}`;
|
|
@@ -709,7 +710,7 @@ ${newContent}
|
|
|
709
710
|
const cssContent = cssFiles.flat().map((file2) => `@import url('./${file2}');`).join("\n");
|
|
710
711
|
const hashName = toHash.toHash(file, 6);
|
|
711
712
|
const parsedPath = path.parse(file);
|
|
712
|
-
const dasherized =
|
|
713
|
+
const dasherized = dashCase.dashCase(parsedPath.name);
|
|
713
714
|
const cssFile = path.join(destDir, `css/f_${dasherized}-${hashName}.css`);
|
|
714
715
|
fs.writeFileSync(cssFile, cssContent || `/* Empty file */`);
|
|
715
716
|
}
|
package/compiler/as-class.js
CHANGED
|
@@ -9,8 +9,9 @@ import { readFileSync, existsSync, mkdirSync, statSync, readdirSync, writeFileSy
|
|
|
9
9
|
import { execSync } from "child_process";
|
|
10
10
|
import { isSaltyFile, resolveExportValue, getCorePackageRoot, saltyFileExtensions } from "./helpers.js";
|
|
11
11
|
import { d as defineTemplates } from "../define-templates-CVhhgPnd.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { d as dashCase } from "../dash-case-DblXvymC.js";
|
|
13
|
+
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
14
|
+
import { p as parseAndJoinStyles, b as parseVariableTokens } from "../parse-styles-DQoke7UP.js";
|
|
14
15
|
import { mergeObjects, mergeFactories } from "../css/merge.js";
|
|
15
16
|
import { getPackageJson } from "./get-files.js";
|
|
16
17
|
import { parseTemplates, getTemplateTypes } from "../parsers/index.js";
|
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-DDx7UpaY.cjs");
|
|
4
|
+
const toHash = require("../to-hash-C05Y906F.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-DQoke7UP.js";
|
|
2
|
+
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
3
3
|
const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
|
|
4
4
|
const modifyKeyframes = async (params = {}) => {
|
|
5
5
|
const animationName = _name || toHash(keyframes2);
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +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
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
dashCase as d
|
|
10
|
+
};
|
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-B_LEduWe.cjs");
|
|
4
|
+
const dashCase = require("../dash-case-DIwKaYgE.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 = dashCase.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-i5iaicjF.js";
|
|
2
|
+
import { C } from "../class-name-generator-i5iaicjF.js";
|
|
3
|
+
import { d as dashCase } from "../dash-case-DblXvymC.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-B_LEduWe.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-i5iaicjF.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.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.336",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -122,6 +122,10 @@
|
|
|
122
122
|
"./instances/classname-instance": {
|
|
123
123
|
"import": "./instances/classname-instance.js",
|
|
124
124
|
"require": "./instances/classname-instance.cjs"
|
|
125
|
+
},
|
|
126
|
+
"./runtime": {
|
|
127
|
+
"import": "./runtime/index.js",
|
|
128
|
+
"require": "./runtime/index.cjs"
|
|
125
129
|
}
|
|
126
130
|
},
|
|
127
131
|
"bin": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const dashCase = require("./dash-case-DIwKaYgE.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 = dashCase.dashCase(args[1].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})`;
|
|
@@ -77,8 +77,8 @@ const addUnit = (key, value, config) => {
|
|
|
77
77
|
const vendorPrefixes = ["Webkit", "Moz", "ms", "O"];
|
|
78
78
|
const propertyNameCheck = (key) => {
|
|
79
79
|
if (key.startsWith("-")) return key;
|
|
80
|
-
if (vendorPrefixes.some((prefix) => key.startsWith(prefix))) return `-${
|
|
81
|
-
return
|
|
80
|
+
if (vendorPrefixes.some((prefix) => key.startsWith(prefix))) return `-${dashCase.dashCase(key)}`;
|
|
81
|
+
return dashCase.dashCase(key);
|
|
82
82
|
};
|
|
83
83
|
const parseStyles = async (styles, currentScope = "", config, omitTemplates = false) => {
|
|
84
84
|
if (!styles) throw new Error("No styles provided to parseStyles function!");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as dashCase } from "./
|
|
1
|
+
import { d as dashCase } from "./dash-case-DblXvymC.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;
|
|
@@ -224,9 +224,9 @@ const parseAndJoinStyles = async (styles, currentClass, config, omitTemplates =
|
|
|
224
224
|
return css.join("\n");
|
|
225
225
|
};
|
|
226
226
|
export {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
parseStyles as a,
|
|
228
|
+
parseVariableTokens as b,
|
|
229
|
+
parseValueModifiers as c,
|
|
230
230
|
parseValueTokens as d,
|
|
231
231
|
parseAndJoinStyles as p
|
|
232
232
|
};
|
package/parsers/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseStyles = require("../parse-styles-
|
|
4
|
-
const
|
|
3
|
+
const parseStyles = require("../parse-styles-DDx7UpaY.cjs");
|
|
4
|
+
const dashCase = require("../dash-case-DIwKaYgE.cjs");
|
|
5
|
+
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
5
6
|
const parseTemplates = async (obj, path = []) => {
|
|
6
7
|
if (!obj) return "";
|
|
7
8
|
const classes = [];
|
|
@@ -17,7 +18,7 @@ const parseTemplates = async (obj, path = []) => {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
if (Object.keys(levelStyles).length) {
|
|
20
|
-
const className = path.map(
|
|
21
|
+
const className = path.map(dashCase.dashCase).join("-");
|
|
21
22
|
const hashClass = "t_" + toHash.toHash(className, 4);
|
|
22
23
|
const result = await parseStyles.parseAndJoinStyles(levelStyles, `.${className}, .${hashClass}`);
|
|
23
24
|
classes.push(result);
|
package/parsers/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { p as parseAndJoinStyles } from "../parse-styles-
|
|
2
|
-
import {
|
|
3
|
-
import { d as dashCase
|
|
1
|
+
import { p as parseAndJoinStyles } from "../parse-styles-DQoke7UP.js";
|
|
2
|
+
import { a, c, d, b } from "../parse-styles-DQoke7UP.js";
|
|
3
|
+
import { d as dashCase } from "../dash-case-DblXvymC.js";
|
|
4
|
+
import { t as toHash } from "../to-hash-DAN2LcHK.js";
|
|
4
5
|
const parseTemplates = async (obj, path = []) => {
|
|
5
6
|
if (!obj) return "";
|
|
6
7
|
const classes = [];
|
|
@@ -50,9 +51,9 @@ export {
|
|
|
50
51
|
getTemplateTokens,
|
|
51
52
|
getTemplateTypes,
|
|
52
53
|
parseAndJoinStyles,
|
|
53
|
-
|
|
54
|
+
a as parseStyles,
|
|
54
55
|
parseTemplates,
|
|
55
|
-
|
|
56
|
+
c as parseValueModifiers,
|
|
56
57
|
d as parseValueTokens,
|
|
57
|
-
|
|
58
|
+
b as parseVariableTokens
|
|
58
59
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const parseStyles = require("../parse-styles-DDx7UpaY.cjs");
|
|
4
|
+
const defineRuntime = (config) => {
|
|
5
|
+
const getDynamicStylesCss = async (styles, scope) => {
|
|
6
|
+
const parsed = await parseStyles.parseStyles(styles, scope, config);
|
|
7
|
+
return parsed.join("\n");
|
|
8
|
+
};
|
|
9
|
+
return { getDynamicStylesCss };
|
|
10
|
+
};
|
|
11
|
+
exports.defineRuntime = defineRuntime;
|
package/runtime/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { a as parseStyles } from "../parse-styles-DQoke7UP.js";
|
|
2
|
+
const defineRuntime = (config) => {
|
|
3
|
+
const getDynamicStylesCss = async (styles, scope) => {
|
|
4
|
+
const parsed = await parseStyles(styles, scope, config);
|
|
5
|
+
return parsed.join("\n");
|
|
6
|
+
};
|
|
7
|
+
return { getDynamicStylesCss };
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
defineRuntime
|
|
11
|
+
};
|
|
@@ -1,11 +1,4 @@
|
|
|
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
|
-
}
|
|
9
2
|
const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
10
3
|
const toAlphabeticName = (code, length) => {
|
|
11
4
|
let name = "";
|
|
@@ -28,5 +21,4 @@ const toHash = (value, length = 5) => {
|
|
|
28
21
|
const numericHash = toPhash(5381, JSON.stringify(value)) >>> 0;
|
|
29
22
|
return toAlphabeticName(numericHash, length);
|
|
30
23
|
};
|
|
31
|
-
exports.dashCase = dashCase;
|
|
32
24
|
exports.toHash = toHash;
|
|
@@ -1,10 +1,3 @@
|
|
|
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
1
|
const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
9
2
|
const toAlphabeticName = (code, length) => {
|
|
10
3
|
let name = "";
|
|
@@ -28,6 +21,5 @@ const toHash = (value, length = 5) => {
|
|
|
28
21
|
return toAlphabeticName(numericHash, length);
|
|
29
22
|
};
|
|
30
23
|
export {
|
|
31
|
-
dashCase as d,
|
|
32
24
|
toHash as t
|
|
33
25
|
};
|
package/util/index.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const dashCase = require("../dash-case-DIwKaYgE.cjs");
|
|
4
4
|
const pascalCase = require("../pascal-case-By_l58S-.cjs");
|
|
5
|
+
const toHash = require("../to-hash-C05Y906F.cjs");
|
|
5
6
|
function camelCase(str) {
|
|
6
7
|
if (!str) return "";
|
|
7
8
|
if (typeof str !== "string") return camelCase(String(str));
|
|
8
9
|
return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
9
10
|
}
|
|
10
|
-
exports.dashCase =
|
|
11
|
-
exports.toHash = toHash.toHash;
|
|
11
|
+
exports.dashCase = dashCase.dashCase;
|
|
12
12
|
exports.pascalCase = pascalCase.pascalCase;
|
|
13
|
+
exports.toHash = toHash.toHash;
|
|
13
14
|
exports.camelCase = camelCase;
|
package/util/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { d
|
|
1
|
+
import { d } from "../dash-case-DblXvymC.js";
|
|
2
2
|
import { p } from "../pascal-case-F3Usi5Wf.js";
|
|
3
|
+
import { t } from "../to-hash-DAN2LcHK.js";
|
|
3
4
|
function camelCase(str) {
|
|
4
5
|
if (!str) return "";
|
|
5
6
|
if (typeof str !== "string") return camelCase(String(str));
|