@plumeria/core 0.21.5 → 0.22.1

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/index.js CHANGED
@@ -8,8 +8,29 @@ function create(object) {
8
8
  const flat = {};
9
9
  const nonFlat = {};
10
10
  (0, zss_engine.splitAtomicAndNested)(styleObj, flat, nonFlat);
11
+ const props$1 = Object.keys(flat);
12
+ const finalFlat = {};
13
+ for (let i = 0; i < props$1.length; i++) {
14
+ const prop = props$1[i];
15
+ const kebab = (0, zss_engine.camelToKebabCase)(prop);
16
+ const isShorthand = !!zss_engine.SHORTHAND_PROPERTIES[kebab];
17
+ if (isShorthand) finalFlat[prop] = flat[prop];
18
+ else {
19
+ let isOverridden = false;
20
+ const shorthands = zss_engine.LONG_TO_SHORT[kebab] || [];
21
+ for (let j = i + 1; j < props$1.length; j++) {
22
+ const futureProp = props$1[j];
23
+ const futureKebab = (0, zss_engine.camelToKebabCase)(futureProp);
24
+ if (shorthands.includes(futureKebab)) {
25
+ isOverridden = true;
26
+ break;
27
+ }
28
+ }
29
+ if (!isOverridden) finalFlat[prop] = flat[prop];
30
+ }
31
+ }
11
32
  const records = [];
12
- Object.entries(flat).forEach(([prop, value]) => {
33
+ Object.entries(finalFlat).forEach(([prop, value]) => {
13
34
  const hashes = new Set();
14
35
  const sheets = new Set();
15
36
  (0, zss_engine.processAtomicProps)({ [prop]: value }, hashes, sheets);
@@ -144,21 +165,21 @@ function global(object) {
144
165
 
145
166
  const keyframes = (object) => {
146
167
  const hash = (0, zss_engine.genBase36Hash)(object, 1, 8);
147
- const animationName = `kf-${hash}`;
148
- global({ [`@keyframes ${animationName}`]: object });
149
- return animationName;
168
+ const ident = `kf-${hash}`;
169
+ global({ [`@keyframes ${ident}`]: object });
170
+ return ident;
150
171
  };
151
172
 
152
173
  const viewTransition = (object) => {
153
174
  const hash = (0, zss_engine.genBase36Hash)(object, 1, 8);
154
- const transitionId = `vt-${hash}`;
175
+ const ident = `vt-${hash}`;
155
176
  global({
156
- [`::view-transition-group(${transitionId})`]: object.group,
157
- [`::view-transition-image-pair(${transitionId})`]: object.imagePair,
158
- [`::view-transition-old(${transitionId})`]: object.old,
159
- [`::view-transition-new(${transitionId})`]: object.new
177
+ [`::view-transition-group(${ident})`]: object.group,
178
+ [`::view-transition-image-pair(${ident})`]: object.imagePair,
179
+ [`::view-transition-old(${ident})`]: object.old,
180
+ [`::view-transition-new(${ident})`]: object.new
160
181
  });
161
- return transitionId;
182
+ return ident;
162
183
  };
163
184
 
164
185
  const defineTokens = (object) => {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { globalPromise_1, globalPromise_2, initPromise_1, initPromise_2, resolvePromise_1, resolvePromise_2 } from "./css.mjs";
2
- import { camelToKebabCase, genBase36Hash, injectClientCSS, injectClientGlobalCSS, injectClientQuery, isHashInStyleSheets, isServer, isTestingDevelopment, processAtomicProps, splitAtomicAndNested, transpile } from "zss-engine";
2
+ import { LONG_TO_SHORT, SHORTHAND_PROPERTIES, camelToKebabCase, genBase36Hash, injectClientCSS, injectClientGlobalCSS, injectClientQuery, isHashInStyleSheets, isServer, isTestingDevelopment, processAtomicProps, splitAtomicAndNested, transpile } from "zss-engine";
3
3
 
4
4
  const styleAtomMap = new WeakMap();
5
5
  function create(object) {
@@ -8,8 +8,29 @@ function create(object) {
8
8
  const flat = {};
9
9
  const nonFlat = {};
10
10
  splitAtomicAndNested(styleObj, flat, nonFlat);
11
+ const props$1 = Object.keys(flat);
12
+ const finalFlat = {};
13
+ for (let i = 0; i < props$1.length; i++) {
14
+ const prop = props$1[i];
15
+ const kebab = camelToKebabCase(prop);
16
+ const isShorthand = !!SHORTHAND_PROPERTIES[kebab];
17
+ if (isShorthand) finalFlat[prop] = flat[prop];
18
+ else {
19
+ let isOverridden = false;
20
+ const shorthands = LONG_TO_SHORT[kebab] || [];
21
+ for (let j = i + 1; j < props$1.length; j++) {
22
+ const futureProp = props$1[j];
23
+ const futureKebab = camelToKebabCase(futureProp);
24
+ if (shorthands.includes(futureKebab)) {
25
+ isOverridden = true;
26
+ break;
27
+ }
28
+ }
29
+ if (!isOverridden) finalFlat[prop] = flat[prop];
30
+ }
31
+ }
11
32
  const records = [];
12
- Object.entries(flat).forEach(([prop, value]) => {
33
+ Object.entries(finalFlat).forEach(([prop, value]) => {
13
34
  const hashes = new Set();
14
35
  const sheets = new Set();
15
36
  processAtomicProps({ [prop]: value }, hashes, sheets);
@@ -144,21 +165,21 @@ function global(object) {
144
165
 
145
166
  const keyframes = (object) => {
146
167
  const hash = genBase36Hash(object, 1, 8);
147
- const animationName = `kf-${hash}`;
148
- global({ [`@keyframes ${animationName}`]: object });
149
- return animationName;
168
+ const ident = `kf-${hash}`;
169
+ global({ [`@keyframes ${ident}`]: object });
170
+ return ident;
150
171
  };
151
172
 
152
173
  const viewTransition = (object) => {
153
174
  const hash = genBase36Hash(object, 1, 8);
154
- const transitionId = `vt-${hash}`;
175
+ const ident = `vt-${hash}`;
155
176
  global({
156
- [`::view-transition-group(${transitionId})`]: object.group,
157
- [`::view-transition-image-pair(${transitionId})`]: object.imagePair,
158
- [`::view-transition-old(${transitionId})`]: object.old,
159
- [`::view-transition-new(${transitionId})`]: object.new
177
+ [`::view-transition-group(${ident})`]: object.group,
178
+ [`::view-transition-image-pair(${ident})`]: object.imagePair,
179
+ [`::view-transition-old(${ident})`]: object.old,
180
+ [`::view-transition-new(${ident})`]: object.new
160
181
  });
161
- return transitionId;
182
+ return ident;
162
183
  };
163
184
 
164
185
  const defineTokens = (object) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "0.21.5",
3
+ "version": "0.22.1",
4
4
  "description": "The atomic on-demand CSS-in-JS.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "stylesheet.css"
46
46
  ],
47
47
  "dependencies": {
48
- "zss-engine": "0.2.90"
48
+ "zss-engine": "0.2.94"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"