simplestyle-js 5.3.2 → 5.3.4

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.
@@ -43,7 +43,7 @@ function formatCSSRuleName(rule) {
43
43
  return rule.replaceAll(/([A-Z])/g, (p1)=>`-${p1.toLowerCase()}`);
44
44
  }
45
45
  function formatCSSRules(cssRules) {
46
- return Object.entries(cssRules).reduce((prev, [cssProp, cssVal])=>`${prev}${formatCSSRuleName(cssProp)}:${String(cssVal)}${typeof cssVal === 'number' ? 'px' : ''};`, '');
46
+ return Object.entries(cssRules).reduce((prev, [cssProp, cssVal])=>`${prev}${formatCSSRuleName(cssProp)}:${String(cssVal)};`, '');
47
47
  }
48
48
  function execCreateStyles(ruleId, rules, options, parentSelector, noGenerateClassName = false) {
49
49
  const out = {};
@@ -1,5 +1,5 @@
1
1
  import type { SimpleStyleRegistry } from './simpleStyleRegistry.js';
2
- import type { ImportStringType, Properties, SimpleStyleRules } from './types.js';
2
+ import type { ImportStringType, Nullish, Properties, SimpleStyleRules } from './types.js';
3
3
  export type CreateStylesOptions = Partial<{
4
4
  /**
5
5
  * If true, automatically renders generated styles
@@ -10,12 +10,12 @@ export type CreateStylesOptions = Partial<{
10
10
  * If set, along with flush: true,
11
11
  * will render the injected <style /> after this element
12
12
  */
13
- insertAfter?: HTMLElement;
13
+ insertAfter?: Nullish<HTMLElement>;
14
14
  /**
15
15
  * If set, along with flush: true,
16
16
  * will render the injects <style /> before this element
17
17
  */
18
- insertBefore?: HTMLElement;
18
+ insertBefore?: Nullish<HTMLElement>;
19
19
  /**
20
20
  * if set, will automatically prevent any styles from
21
21
  * being flushed to the DOM or inserted at all.
@@ -23,7 +23,7 @@ export type CreateStylesOptions = Partial<{
23
23
  * and it will be up to you to determine how they should
24
24
  * be flushed.
25
25
  */
26
- registry?: SimpleStyleRegistry;
26
+ registry?: Nullish<SimpleStyleRegistry>;
27
27
  }>;
28
28
  export declare function imports(ruleId: string, rulesFnc: () => ImportStringType[], options?: CreateStylesOptions): void;
29
29
  export declare function rawStyles<T extends SimpleStyleRules>(ruleId: string, rulesFnc: () => T, options?: Partial<CreateStylesOptions>): string;
@@ -1,4 +1,5 @@
1
1
  import type { Properties } from 'csstype';
2
+ export type Nullish<T> = T | null | undefined;
2
3
  export type SimpleStyleRules = {
3
4
  [key: string]: Properties | SimpleStyleRules;
4
5
  };
@@ -1,5 +1,5 @@
1
1
  import type { SimpleStyleRegistry } from './simpleStyleRegistry.js';
2
- import type { ImportStringType, Properties, SimpleStyleRules } from './types.js';
2
+ import type { ImportStringType, Nullish, Properties, SimpleStyleRules } from './types.js';
3
3
  export type CreateStylesOptions = Partial<{
4
4
  /**
5
5
  * If true, automatically renders generated styles
@@ -10,12 +10,12 @@ export type CreateStylesOptions = Partial<{
10
10
  * If set, along with flush: true,
11
11
  * will render the injected <style /> after this element
12
12
  */
13
- insertAfter?: HTMLElement;
13
+ insertAfter?: Nullish<HTMLElement>;
14
14
  /**
15
15
  * If set, along with flush: true,
16
16
  * will render the injects <style /> before this element
17
17
  */
18
- insertBefore?: HTMLElement;
18
+ insertBefore?: Nullish<HTMLElement>;
19
19
  /**
20
20
  * if set, will automatically prevent any styles from
21
21
  * being flushed to the DOM or inserted at all.
@@ -23,7 +23,7 @@ export type CreateStylesOptions = Partial<{
23
23
  * and it will be up to you to determine how they should
24
24
  * be flushed.
25
25
  */
26
- registry?: SimpleStyleRegistry;
26
+ registry?: Nullish<SimpleStyleRegistry>;
27
27
  }>;
28
28
  export declare function imports(ruleId: string, rulesFnc: () => ImportStringType[], options?: CreateStylesOptions): void;
29
29
  export declare function rawStyles<T extends SimpleStyleRules>(ruleId: string, rulesFnc: () => T, options?: Partial<CreateStylesOptions>): string;
@@ -11,7 +11,7 @@ function formatCSSRuleName(rule) {
11
11
  return rule.replaceAll(/([A-Z])/g, (p1)=>`-${p1.toLowerCase()}`);
12
12
  }
13
13
  function formatCSSRules(cssRules) {
14
- return Object.entries(cssRules).reduce((prev, [cssProp, cssVal])=>`${prev}${formatCSSRuleName(cssProp)}:${String(cssVal)}${typeof cssVal === 'number' ? 'px' : ''};`, '');
14
+ return Object.entries(cssRules).reduce((prev, [cssProp, cssVal])=>`${prev}${formatCSSRuleName(cssProp)}:${String(cssVal)};`, '');
15
15
  }
16
16
  function execCreateStyles(ruleId, rules, options, parentSelector, noGenerateClassName = false) {
17
17
  const out = {};
@@ -1,4 +1,5 @@
1
1
  import type { Properties } from 'csstype';
2
+ export type Nullish<T> = T | null | undefined;
2
3
  export type SimpleStyleRules = {
3
4
  [key: string]: Properties | SimpleStyleRules;
4
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplestyle-js",
3
- "version": "5.3.2",
3
+ "version": "5.3.4",
4
4
  "description": "An incredibly straightforward and simple CSS-in-JS solution with zero runtime dependencies, and out-of-the-box TypeScript support",
5
5
  "type": "module",
6
6
  "repository": {