zss-engine 0.2.61 → 0.2.63

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.
@@ -6,7 +6,37 @@ const isDocumentDefined = typeof document !== 'undefined';
6
6
  exports.isServer = !isWindowDefined || !isDocumentDefined;
7
7
  exports.isDevelopment = process.env.NODE_ENV === 'development';
8
8
  exports.isTestingDevelopment = process.env.NODE_ENV === 'test' || exports.isDevelopment;
9
- const exception = ['line-height', 'font-weight', 'opacity', 'scale', 'z-index', 'column-count', 'order', 'orphans', 'widows'];
9
+ const exception = [
10
+ 'animation-iteration-count',
11
+ 'column-count',
12
+ 'columns',
13
+ 'fill-opacity',
14
+ 'flex',
15
+ 'flex-grow',
16
+ 'flex-shrink',
17
+ 'flood-opacity',
18
+ 'font-size-adjust',
19
+ 'font-weight',
20
+ 'grid-column',
21
+ 'grid-column-end',
22
+ 'grid-column-start',
23
+ 'grid-row',
24
+ 'grid-row-end',
25
+ 'grid-row-start',
26
+ 'initial-letter',
27
+ 'line-height',
28
+ 'opacity',
29
+ 'order',
30
+ 'orphans',
31
+ 'scale',
32
+ 'shape-image-threshold',
33
+ 'stop-opacity',
34
+ 'stroke-opacity',
35
+ 'tab-size',
36
+ 'widows',
37
+ 'z-index',
38
+ 'zoom',
39
+ ];
10
40
  const applyCssValue = (value, cssProp) => {
11
41
  if (typeof value === 'number') {
12
42
  return exception.includes(cssProp) ? value.toString() : value + 'px';
@@ -13,7 +13,7 @@ function splitAtomicAndNested(obj, flat, nonFlat) {
13
13
  const innerNonFlat = {};
14
14
  splitAtomicAndNested(value, innerFlat, innerNonFlat);
15
15
  if (Object.keys(innerFlat).length)
16
- nonFlat[property] = innerFlat;
16
+ flat[property] = innerFlat;
17
17
  if (Object.keys(innerNonFlat).length)
18
18
  nonFlat[property] = innerNonFlat;
19
19
  }
@@ -34,7 +34,10 @@ function processAtomicProps(flatProps, atomicHashes, allStyleSheets, parentAtRul
34
34
  const CSSProp = (0, index_js_1.camelToKebabCase)(property);
35
35
  const normalizedValue = (0, index_js_1.applyCssValue)(value, CSSProp);
36
36
  const singlePropObj = { [property]: normalizedValue };
37
- const atomicHash = (0, index_js_1.genBase36Hash)(singlePropObj, 1, 8);
37
+ const hashInput = parentAtRule ? { [parentAtRule]: singlePropObj } : singlePropObj;
38
+ const atomicHash = (0, index_js_1.genBase36Hash)(hashInput, 1, 8);
39
+ if (atomicHashes.has(atomicHash))
40
+ return;
38
41
  atomicHashes.add(atomicHash);
39
42
  let styleSheet = (0, index_js_1.transpileAtomic)(property, value, atomicHash);
40
43
  if (parentAtRule) {
@@ -3,7 +3,37 @@ const isDocumentDefined = typeof document !== 'undefined';
3
3
  export const isServer = !isWindowDefined || !isDocumentDefined;
4
4
  export const isDevelopment = process.env.NODE_ENV === 'development';
5
5
  export const isTestingDevelopment = process.env.NODE_ENV === 'test' || isDevelopment;
6
- const exception = ['line-height', 'font-weight', 'opacity', 'scale', 'z-index', 'column-count', 'order', 'orphans', 'widows'];
6
+ const exception = [
7
+ 'animation-iteration-count',
8
+ 'column-count',
9
+ 'columns',
10
+ 'fill-opacity',
11
+ 'flex',
12
+ 'flex-grow',
13
+ 'flex-shrink',
14
+ 'flood-opacity',
15
+ 'font-size-adjust',
16
+ 'font-weight',
17
+ 'grid-column',
18
+ 'grid-column-end',
19
+ 'grid-column-start',
20
+ 'grid-row',
21
+ 'grid-row-end',
22
+ 'grid-row-start',
23
+ 'initial-letter',
24
+ 'line-height',
25
+ 'opacity',
26
+ 'order',
27
+ 'orphans',
28
+ 'scale',
29
+ 'shape-image-threshold',
30
+ 'stop-opacity',
31
+ 'stroke-opacity',
32
+ 'tab-size',
33
+ 'widows',
34
+ 'z-index',
35
+ 'zoom',
36
+ ];
7
37
  export const applyCssValue = (value, cssProp) => {
8
38
  if (typeof value === 'number') {
9
39
  return exception.includes(cssProp) ? value.toString() : value + 'px';
@@ -9,7 +9,7 @@ function splitAtomicAndNested(obj, flat, nonFlat) {
9
9
  const innerNonFlat = {};
10
10
  splitAtomicAndNested(value, innerFlat, innerNonFlat);
11
11
  if (Object.keys(innerFlat).length)
12
- nonFlat[property] = innerFlat;
12
+ flat[property] = innerFlat;
13
13
  if (Object.keys(innerNonFlat).length)
14
14
  nonFlat[property] = innerNonFlat;
15
15
  }
@@ -30,7 +30,10 @@ function processAtomicProps(flatProps, atomicHashes, allStyleSheets, parentAtRul
30
30
  const CSSProp = camelToKebabCase(property);
31
31
  const normalizedValue = applyCssValue(value, CSSProp);
32
32
  const singlePropObj = { [property]: normalizedValue };
33
- const atomicHash = genBase36Hash(singlePropObj, 1, 8);
33
+ const hashInput = parentAtRule ? { [parentAtRule]: singlePropObj } : singlePropObj;
34
+ const atomicHash = genBase36Hash(hashInput, 1, 8);
35
+ if (atomicHashes.has(atomicHash))
36
+ return;
34
37
  atomicHashes.add(atomicHash);
35
38
  let styleSheet = transpileAtomic(property, value, atomicHash);
36
39
  if (parentAtRule) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zss-engine",
3
- "version": "0.2.61",
3
+ "version": "0.2.63",
4
4
  "description": "Zero-runtime StyleSheet Engine",
5
5
  "keywords": [
6
6
  "zero-runtime",