zss-engine 0.2.48 → 0.2.49

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/dist/cjs/index.js CHANGED
@@ -1,18 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getServerCSS = exports.injectServerCSS = exports.injectClientGlobalCSS = exports.injectClientCSS = exports.camelToKebabCase = exports.build = exports.transpiler = exports.genBase36Hash = exports.isTestingDevelopment = exports.isDevelopment = exports.isServer = void 0;
3
+ exports.getServerCSS = exports.injectServerCSS = exports.injectClientGlobalCSS = exports.injectClientCSS = exports.applyCssValue = exports.camelToKebabCase = exports.build = exports.transpileAtomic = exports.transpile = exports.genBase36Hash = exports.isTestingDevelopment = exports.isDevelopment = exports.isServer = void 0;
4
4
  var helper_js_1 = require("./utils/helper.js");
5
5
  Object.defineProperty(exports, "isServer", { enumerable: true, get: function () { return helper_js_1.isServer; } });
6
6
  Object.defineProperty(exports, "isDevelopment", { enumerable: true, get: function () { return helper_js_1.isDevelopment; } });
7
7
  Object.defineProperty(exports, "isTestingDevelopment", { enumerable: true, get: function () { return helper_js_1.isTestingDevelopment; } });
8
8
  var hash_js_1 = require("./utils/hash.js");
9
9
  Object.defineProperty(exports, "genBase36Hash", { enumerable: true, get: function () { return hash_js_1.genBase36Hash; } });
10
- var transpiler_js_1 = require("./utils/transpiler.js");
11
- Object.defineProperty(exports, "transpiler", { enumerable: true, get: function () { return transpiler_js_1.transpiler; } });
10
+ var transpile_js_1 = require("./utils/transpile.js");
11
+ Object.defineProperty(exports, "transpile", { enumerable: true, get: function () { return transpile_js_1.transpile; } });
12
+ var transpile_atomic_js_1 = require("./utils/transpile-atomic.js");
13
+ Object.defineProperty(exports, "transpileAtomic", { enumerable: true, get: function () { return transpile_atomic_js_1.transpileAtomic; } });
12
14
  var build_js_1 = require("./utils/build.js");
13
15
  Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_js_1.build; } });
14
16
  var helper_js_2 = require("./utils/helper.js");
15
17
  Object.defineProperty(exports, "camelToKebabCase", { enumerable: true, get: function () { return helper_js_2.camelToKebabCase; } });
18
+ Object.defineProperty(exports, "applyCssValue", { enumerable: true, get: function () { return helper_js_2.applyCssValue; } });
16
19
  var inject_client_css_js_1 = require("./utils/inject-client-css.js");
17
20
  Object.defineProperty(exports, "injectClientCSS", { enumerable: true, get: function () { return inject_client_css_js_1.injectClientCSS; } });
18
21
  var inject_client_global_css_js_1 = require("./utils/inject-client-global-css.js");
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transpileAtomic = transpileAtomic;
4
+ const helper_1 = require("./helper");
5
+ function transpileAtomic(property, value, hash) {
6
+ if (typeof value === 'string' || typeof value === 'number') {
7
+ const CSSProp = (0, helper_1.camelToKebabCase)(property);
8
+ const applyValue = (0, helper_1.applyCssValue)(value, CSSProp);
9
+ const atomicRule = `.${hash} { ${CSSProp}: ${applyValue}; }`;
10
+ if (property.startsWith('@media') || property.startsWith('@container')) {
11
+ return `${property} {\n ${atomicRule}\n}\n`;
12
+ }
13
+ return `${atomicRule}\n`;
14
+ }
15
+ return '';
16
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transpiler = transpiler;
3
+ exports.transpile = transpile;
4
4
  const helper_js_1 = require("./helper.js");
5
5
  const createKeyframes = (property, content) => {
6
6
  let keyframesRules = `${property} {\n`;
@@ -24,7 +24,7 @@ const createKeyframes = (property, content) => {
24
24
  keyframesRules += `}\n`;
25
25
  return keyframesRules;
26
26
  };
27
- function transpiler(object, base36Hash, core) {
27
+ function transpile(object, base36Hash, core) {
28
28
  let styleSheet = '';
29
29
  const mediaQueries = [];
30
30
  const classNameType = (property) => {
@@ -47,9 +47,6 @@ function transpiler(object, base36Hash, core) {
47
47
  const value = properties[property];
48
48
  if (typeof value === 'string' || typeof value === 'number') {
49
49
  let CSSProp = (0, helper_js_1.camelToKebabCase)(property);
50
- if (property.startsWith('ms')) {
51
- CSSProp = `-${CSSProp}`;
52
- }
53
50
  const applyValue = (0, helper_js_1.applyCssValue)(value, CSSProp);
54
51
  cssRule += ` ${CSSProp}: ${applyValue};\n`;
55
52
  }
package/dist/esm/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  export { isServer, isDevelopment, isTestingDevelopment } from './utils/helper.js';
2
2
  export { genBase36Hash } from './utils/hash.js';
3
- export { transpiler } from './utils/transpiler.js';
3
+ export { transpile } from './utils/transpile.js';
4
+ export { transpileAtomic } from './utils/transpile-atomic.js';
4
5
  export { build } from './utils/build.js';
5
- export { camelToKebabCase } from './utils/helper.js';
6
+ export { camelToKebabCase, applyCssValue } from './utils/helper.js';
6
7
  export { injectClientCSS } from './utils/inject-client-css.js';
7
8
  export { injectClientGlobalCSS } from './utils/inject-client-global-css.js';
8
9
  export { injectServerCSS, getServerCSS } from './utils/inject-server-css.js';
@@ -0,0 +1,14 @@
1
+ import { applyCssValue, camelToKebabCase } from './helper';
2
+ function transpileAtomic(property, value, hash) {
3
+ if (typeof value === 'string' || typeof value === 'number') {
4
+ const CSSProp = camelToKebabCase(property);
5
+ const applyValue = applyCssValue(value, CSSProp);
6
+ const atomicRule = `.${hash} { ${CSSProp}: ${applyValue}; }`;
7
+ if (property.startsWith('@media') || property.startsWith('@container')) {
8
+ return `${property} {\n ${atomicRule}\n}\n`;
9
+ }
10
+ return `${atomicRule}\n`;
11
+ }
12
+ return '';
13
+ }
14
+ export { transpileAtomic };
@@ -21,7 +21,7 @@ const createKeyframes = (property, content) => {
21
21
  keyframesRules += `}\n`;
22
22
  return keyframesRules;
23
23
  };
24
- export function transpiler(object, base36Hash, core) {
24
+ export function transpile(object, base36Hash, core) {
25
25
  let styleSheet = '';
26
26
  const mediaQueries = [];
27
27
  const classNameType = (property) => {
@@ -44,9 +44,6 @@ export function transpiler(object, base36Hash, core) {
44
44
  const value = properties[property];
45
45
  if (typeof value === 'string' || typeof value === 'number') {
46
46
  let CSSProp = camelToKebabCase(property);
47
- if (property.startsWith('ms')) {
48
- CSSProp = `-${CSSProp}`;
49
- }
50
47
  const applyValue = applyCssValue(value, CSSProp);
51
48
  cssRule += ` ${CSSProp}: ${applyValue};\n`;
52
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zss-engine",
3
- "version": "0.2.48",
3
+ "version": "0.2.49",
4
4
  "description": "Zero-runtime StyleSheet Engine",
5
5
  "keywords": [
6
6
  "zero-runtime",
package/types/index.d.ts CHANGED
@@ -5,9 +5,10 @@ export type { CreateValues, CreateTheme, ReturnVariableType, RxVariableSet, Retu
5
5
  export type { Join } from './types/main/join';
6
6
  export { isServer, isDevelopment, isTestingDevelopment } from './utils/helper.js';
7
7
  export { genBase36Hash } from './utils/hash.js';
8
- export { transpiler } from './utils/transpiler.js';
8
+ export { transpile } from './utils/transpile.js';
9
+ export { transpileAtomic } from './utils/transpile-atomic.js';
9
10
  export { build } from './utils/build.js';
10
- export { camelToKebabCase } from './utils/helper.js';
11
+ export { camelToKebabCase, applyCssValue } from './utils/helper.js';
11
12
  export { injectClientCSS } from './utils/inject-client-css.js';
12
13
  export { injectClientGlobalCSS } from './utils/inject-client-global-css.js';
13
14
  export { injectServerCSS, getServerCSS } from './utils/inject-server-css.js';
@@ -0,0 +1,2 @@
1
+ declare function transpileAtomic(property: string, value: string | number, hash: string): string;
2
+ export { transpileAtomic };
@@ -0,0 +1,4 @@
1
+ import type { CSSHTML } from '../index.js';
2
+ export declare function transpile(object: CSSHTML, base36Hash?: string, core?: string): {
3
+ styleSheet: string;
4
+ };
@@ -1,4 +0,0 @@
1
- import type { CSSHTML } from '../index.js';
2
- export declare function transpiler(object: CSSHTML, base36Hash?: string, core?: string): {
3
- styleSheet: string;
4
- };