@stylexjs/stylex 0.17.2 → 0.17.3

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.
@@ -7,10 +7,12 @@
7
7
  *
8
8
  */
9
9
 
10
- declare function inject(
11
- cssText: string,
12
- priority: number,
13
- constKey?: string,
14
- constVal?: string | number,
15
- ): string;
10
+ type InjectArgs = Readonly<{
11
+ ltr: string;
12
+ rtl?: null | undefined | string;
13
+ priority: number;
14
+ constKey?: string;
15
+ constVal?: string | number;
16
+ }>;
17
+ declare function inject(args: InjectArgs): string;
16
18
  export default inject;
package/lib/cjs/inject.js CHANGED
@@ -314,7 +314,13 @@ function updateDependentRules(constKey) {
314
314
  sheet.update(oldText, newText, priority);
315
315
  });
316
316
  }
317
- function inject(cssText, priority, constKey, constVal) {
317
+ function inject(args) {
318
+ const {
319
+ ltr: cssText,
320
+ priority,
321
+ constKey,
322
+ constVal
323
+ } = args;
318
324
  if (constKey !== undefined && constVal !== undefined) {
319
325
  const hadPreviousValue = constants[constKey] !== undefined;
320
326
  const valueChanged = hadPreviousValue && constants[constKey] !== constVal;
@@ -7,9 +7,12 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function inject(
11
- cssText: string,
10
+ type InjectArgs = $ReadOnly<{
11
+ ltr: string,
12
+ rtl?: ?string,
12
13
  priority: number,
13
14
  constKey?: string,
14
15
  constVal?: string | number,
15
- ): string;
16
+ }>;
17
+
18
+ declare export default function inject(args: InjectArgs): string;
@@ -86,7 +86,8 @@ export type NestedCSSPropTypes = Partial<
86
86
  }>
87
87
  >;
88
88
 
89
- type UserAuthoredStyles = CSSPropertiesWithExtras | { [key: string]: unknown };
89
+ type NotUndefined = {} | null;
90
+ type UserAuthoredStyles = CSSPropertiesWithExtras | { [key: string]: NotUndefined };
90
91
  export type StyleXSingleStyle = false | (null | undefined | NestedCSSPropTypes);
91
92
  // NOTE: `XStyle` has been deprecated in favor of `StaticStyles` and `StyleXStyles`.
92
93
 
@@ -7,10 +7,12 @@
7
7
  *
8
8
  */
9
9
 
10
- declare function inject(
11
- cssText: string,
12
- priority: number,
13
- constKey?: string,
14
- constVal?: string | number,
15
- ): string;
10
+ type InjectArgs = Readonly<{
11
+ ltr: string;
12
+ rtl?: null | undefined | string;
13
+ priority: number;
14
+ constKey?: string;
15
+ constVal?: string | number;
16
+ }>;
17
+ declare function inject(args: InjectArgs): string;
16
18
  export default inject;
@@ -7,9 +7,12 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function inject(
11
- cssText: string,
10
+ type InjectArgs = $ReadOnly<{
11
+ ltr: string,
12
+ rtl?: ?string,
12
13
  priority: number,
13
14
  constKey?: string,
14
15
  constVal?: string | number,
15
- ): string;
16
+ }>;
17
+
18
+ declare export default function inject(args: InjectArgs): string;
package/lib/es/inject.mjs CHANGED
@@ -312,7 +312,13 @@ function updateDependentRules(constKey) {
312
312
  sheet.update(oldText, newText, priority);
313
313
  });
314
314
  }
315
- function inject(cssText, priority, constKey, constVal) {
315
+ function inject(args) {
316
+ const {
317
+ ltr: cssText,
318
+ priority,
319
+ constKey,
320
+ constVal
321
+ } = args;
316
322
  if (constKey !== undefined && constVal !== undefined) {
317
323
  const hadPreviousValue = constants[constKey] !== undefined;
318
324
  const valueChanged = hadPreviousValue && constants[constKey] !== constVal;
@@ -86,7 +86,8 @@ export type NestedCSSPropTypes = Partial<
86
86
  }>
87
87
  >;
88
88
 
89
- type UserAuthoredStyles = CSSPropertiesWithExtras | { [key: string]: unknown };
89
+ type NotUndefined = {} | null;
90
+ type UserAuthoredStyles = CSSPropertiesWithExtras | { [key: string]: NotUndefined };
90
91
  export type StyleXSingleStyle = false | (null | undefined | NestedCSSPropTypes);
91
92
  // NOTE: `XStyle` has been deprecated in favor of `StaticStyles` and `StyleXStyles`.
92
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/stylex",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "A library for defining styles for optimized user interfaces.",
5
5
  "main": "./lib/cjs/stylex.js",
6
6
  "module": "./lib/es/stylex.mjs",
@@ -61,7 +61,7 @@
61
61
  "cross-env": "^10.1.0",
62
62
  "rimraf": "^6.1.2",
63
63
  "rollup": "^4.24.0",
64
- "scripts": "0.17.2"
64
+ "scripts": "0.17.3"
65
65
  },
66
66
  "files": [
67
67
  "lib/*"