zss-engine 0.2.34 → 0.2.36

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.
@@ -14,8 +14,14 @@ const applyCssValue = (value, cssProp) => {
14
14
  return value;
15
15
  };
16
16
  exports.applyCssValue = applyCssValue;
17
- const camelToKebabCase = (property) => property
18
- .replace(/([A-Z])([0-9])/g, '$1-$2')
19
- .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
20
- .toLowerCase();
17
+ const camelToKebabCase = (property) => {
18
+ if (/^(ms|Moz|Webkit)/.test(property)) {
19
+ property = '-' + property;
20
+ }
21
+ return (property
22
+ .replace(/([A-Z]+)([0-9]+)/g, '$1$2')
23
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
24
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
25
+ .toLowerCase());
26
+ };
21
27
  exports.camelToKebabCase = camelToKebabCase;
@@ -10,7 +10,13 @@ export const applyCssValue = (value, cssProp) => {
10
10
  }
11
11
  return value;
12
12
  };
13
- export const camelToKebabCase = (property) => property
14
- .replace(/([A-Z])([0-9])/g, '$1-$2')
15
- .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
16
- .toLowerCase();
13
+ export const camelToKebabCase = (property) => {
14
+ if (/^(ms|Moz|Webkit)/.test(property)) {
15
+ property = '-' + property;
16
+ }
17
+ return (property
18
+ .replace(/([A-Z]+)([0-9]+)/g, '$1$2')
19
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
20
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
21
+ .toLowerCase());
22
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zss-engine",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "description": "Zero-runtime StyleSheet Engine",
5
5
  "keywords": [
6
6
  "zero-runtime",
package/types/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type { CSSProperties } from './types/common/css-properties';
2
2
  export type { CreateStyleType, ReturnType, CreateStyle } from './types/main/create';
3
3
  export type { CSSHTML, CreateKeyframes } from './types/main/global';
4
- export type { CreateVars, CreateTheme, CamelToKebabCase } from './types/main/vars';
4
+ export type { CreateVars, CreateTheme } from './types/main/vars';
5
5
  export { isServer, isDevelopment, isDevAndTest } from './utils/helper.js';
6
6
  export { genBase36Hash } from './utils/hash.js';
7
7
  export { transpiler } from './utils/transpiler.js';
@@ -5,9 +5,4 @@ export type CSSVariableProperty = {
5
5
  };
6
6
  export type CreateVars = Record<string, string | number>;
7
7
  export type CreateTheme = Record<string, Record<string, string | number>>;
8
- type IsUppercase<S extends string> = S extends Uppercase<S> ? (S extends Lowercase<S> ? false : true) : false;
9
- type IsDigit<S extends string> = S extends `${number}` ? true : false;
10
- type CamelToKebab<S extends string, PrevType = 'start'> = S extends `${infer First}${infer Rest}` ? IsUppercase<First> extends true ? PrevType extends 'upper' | 'start' ? `${Lowercase<First>}${CamelToKebab<Rest, 'upper'>}` : `-${Lowercase<First>}${CamelToKebab<Rest, 'upper'>}` : IsDigit<First> extends true ? PrevType extends 'digit' | 'lower' ? `${First}${CamelToKebab<Rest, 'digit'>}` : `-${First}${CamelToKebab<Rest, 'digit'>}` : `${First}${CamelToKebab<Rest, 'lower'>}` : S;
11
- type RemoveLeadingHyphen<S extends string> = S extends `-${infer Rest}` ? Rest : S;
12
- export type CamelToKebabCase<S extends string> = RemoveLeadingHyphen<CamelToKebab<S>>;
13
8
  export {};