@css-hooks/core 1.8.0 → 1.8.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/cjs/index.js CHANGED
@@ -208,27 +208,27 @@ function buildHooksSystem(stringify = genericStringify) {
208
208
  }
209
209
  else if (sort) {
210
210
  delete properties[key];
211
- Object.assign(properties, { [key]: value });
211
+ properties[key] =
212
+ value;
212
213
  }
213
214
  }
214
215
  return properties;
215
216
  }
216
- function css(...properties) {
217
- const styles = [{}].concat(JSON.parse(JSON.stringify(properties)));
217
+ function css(...styles) {
218
218
  do {
219
219
  const current = styles[0];
220
220
  const next = styles[1] || {};
221
- if (options === null || options === void 0 ? void 0 : options.sort) {
222
- for (const k in next) {
221
+ for (const k in next) {
222
+ if (options === null || options === void 0 ? void 0 : options.sort) {
223
223
  if (k in current) {
224
224
  delete current[k];
225
225
  }
226
226
  }
227
+ current[k] = next[k];
227
228
  }
228
- styles[0] = cssImpl(Object.assign(current, next));
229
229
  styles.splice(1, 1);
230
230
  } while (styles[1]);
231
- return styles[0];
231
+ return cssImpl(styles[0]);
232
232
  }
233
233
  return [`*{${hooks.init}}${hooks.rule}`, css];
234
234
  };
package/esm/index.js CHANGED
@@ -204,27 +204,27 @@ export function buildHooksSystem(stringify = genericStringify) {
204
204
  }
205
205
  else if (sort) {
206
206
  delete properties[key];
207
- Object.assign(properties, { [key]: value });
207
+ properties[key] =
208
+ value;
208
209
  }
209
210
  }
210
211
  return properties;
211
212
  }
212
- function css(...properties) {
213
- const styles = [{}].concat(JSON.parse(JSON.stringify(properties)));
213
+ function css(...styles) {
214
214
  do {
215
215
  const current = styles[0];
216
216
  const next = styles[1] || {};
217
- if (options === null || options === void 0 ? void 0 : options.sort) {
218
- for (const k in next) {
217
+ for (const k in next) {
218
+ if (options === null || options === void 0 ? void 0 : options.sort) {
219
219
  if (k in current) {
220
220
  delete current[k];
221
221
  }
222
222
  }
223
+ current[k] = next[k];
223
224
  }
224
- styles[0] = cssImpl(Object.assign(current, next));
225
225
  styles.splice(1, 1);
226
226
  } while (styles[1]);
227
- return styles[0];
227
+ return cssImpl(styles[0]);
228
228
  }
229
229
  return [`*{${hooks.init}}${hooks.rule}`, css];
230
230
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@css-hooks/core",
3
3
  "description": "CSS Hooks core library",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "author": "Nick Saunders",
6
6
  "devDependencies": {
7
7
  "@tsconfig/strictest": "^2.0.1",
package/types/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export declare function buildHooksSystem<Properties = Record<string, unknown>>(s
20
20
  fallback?: "unset" | "revert-layer";
21
21
  /** @experimental */
22
22
  sort?: boolean;
23
- }) | undefined) => [string, (properties_0: WithHooks<HookProperties, Properties>, ...properties_1: (WithHooks<HookProperties, Properties> | undefined)[]) => Properties];
23
+ }) | undefined) => [string, (styles_0: WithHooks<HookProperties, Properties>, ...styles_1: (WithHooks<HookProperties, Properties> | undefined)[]) => Properties];
24
24
  /**
25
25
  * A list of hooks offered as a "sensible default" to solve the most common use cases.
26
26
  *