react-native-css 3.0.0-nightly.75f8b74 → 3.0.0-nightly.fa5e95b
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/commonjs/compiler/atRules.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +25 -14
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +40 -11
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +3 -3
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +87 -29
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/jest/index.js +16 -5
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/poison.pill.js +4 -1
- package/dist/commonjs/poison.pill.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/container-query.js +21 -21
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +8 -8
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +17 -17
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +9 -9
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +1 -0
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +15 -6
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/calculate-props.js +53 -48
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/index.js +12 -12
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/units.js +6 -3
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/module/compiler/atRules.js +1 -1
- package/dist/module/compiler/attributes.test.js +1 -1
- package/dist/module/compiler/attributes.test.js.map +1 -1
- package/dist/module/compiler/compiler.js +25 -14
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/declarations.js +39 -11
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +3 -3
- package/dist/module/compiler/inheritance.test.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +87 -29
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/jest/index.js +16 -4
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/poison.pill.js +4 -1
- package/dist/module/poison.pill.js.map +1 -1
- package/dist/module/runtime/native/conditions/container-query.js +21 -21
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +8 -8
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +17 -17
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +9 -9
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +1 -0
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +15 -6
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/styles/calculate-props.js +53 -48
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/module/runtime/native/styles/index.js +12 -12
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/units.js +6 -3
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +5 -4
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +2 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +16 -2
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +8 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +4 -4
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +5 -4
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +2 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +16 -2
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +8 -1
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +4 -4
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/compiler/atRules.ts +1 -1
- package/src/compiler/attributes.test.ts +1 -1
- package/src/compiler/compiler.ts +29 -24
- package/src/compiler/compiler.types.ts +7 -5
- package/src/compiler/declarations.ts +59 -13
- package/src/compiler/inheritance.test.ts +3 -3
- package/src/compiler/stylesheet.ts +113 -32
- package/src/jest/index.ts +19 -4
- package/src/poison.pill.ts +5 -1
- package/src/runtime/native/conditions/container-query.ts +22 -22
- package/src/runtime/native/conditions/guards.ts +1 -2
- package/src/runtime/native/conditions/index.ts +9 -9
- package/src/runtime/native/conditions/media-query.ts +18 -20
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +9 -9
- package/src/runtime/native/react/useNativeCss.ts +3 -0
- package/src/runtime/native/reactivity.ts +22 -13
- package/src/runtime/native/styles/calculate-props.ts +59 -49
- package/src/runtime/native/styles/index.ts +12 -12
- package/src/runtime/native/styles/units.ts +7 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StyleRule } from "../../../compiler";
|
|
2
2
|
import type { Props } from "../../runtime.types";
|
|
3
|
-
import { type ContainerContextValue, type
|
|
3
|
+
import { type ContainerContextValue, type Getter } from "../reactivity";
|
|
4
4
|
import type { RenderGuard } from "./guards";
|
|
5
|
-
export declare function testRule(rule: StyleRule,
|
|
5
|
+
export declare function testRule(rule: StyleRule, get: Getter, props: Props, guards: RenderGuard[], containerContext: ContainerContextValue): boolean;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/conditions/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,QAAQ,CACtB,IAAI,EAAE,SAAS,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/conditions/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,QAAQ,CACtB,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,WAAW,EAAE,EACrB,gBAAgB,EAAE,qBAAqB,WAmBxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MediaCondition } from "../../../compiler";
|
|
2
|
-
import { type
|
|
3
|
-
export declare function testMediaQuery(mediaQueries: MediaCondition[],
|
|
2
|
+
import { type Getter } from "../reactivity";
|
|
3
|
+
export declare function testMediaQuery(mediaQueries: MediaCondition[], get: Getter): boolean;
|
|
4
4
|
//# sourceMappingURL=media-query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-query.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/conditions/media-query.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAEjE,wBAAgB,cAAc,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"media-query.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/conditions/media-query.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAEjE,wBAAgB,cAAc,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,WAEzE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Getter as WeakKey } from "../reactivity";
|
|
2
2
|
type Handler = (event: unknown) => void;
|
|
3
3
|
export type InteractionType = "onLayout" | "onHoverIn" | "onHoverOut" | "onPress" | "onPressIn" | "onPressOut" | "onFocus" | "onBlur";
|
|
4
|
-
export declare function getInteractionHandler(
|
|
4
|
+
export declare function getInteractionHandler(weakKey: WeakKey, type: InteractionType, handler?: Handler): (event: any) => void;
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=interaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/react/interaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/react/interaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,MAAM,IAAI,OAAO,EACvB,MAAM,eAAe,CAAC;AAOvB,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAExC,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,SAAS,GACT,WAAW,GACX,YAAY,GACZ,SAAS,GACT,QAAQ,CAAC;AAab,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,eAAe,EACrB,OAAO,UAAwB,WA7BL,GAAG,KAAK,IAAI,CA4EvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentType } from "react";
|
|
2
2
|
import type { StyledConfiguration } from "../../runtime.types";
|
|
3
3
|
import { type RenderGuard } from "../conditions/guards";
|
|
4
|
-
import { type ContainerContextValue, type Effect, type VariableContextValue } from "../reactivity";
|
|
4
|
+
import { type ContainerContextValue, type Effect, type Getter, type VariableContextValue } from "../reactivity";
|
|
5
5
|
import { stylesFamily } from "../styles";
|
|
6
6
|
export type Config = {
|
|
7
7
|
source: string;
|
|
@@ -13,6 +13,7 @@ export type ComponentState = {
|
|
|
13
13
|
configs: Config[];
|
|
14
14
|
/** Reactive tracking */
|
|
15
15
|
ruleEffect: Effect;
|
|
16
|
+
ruleEffectGetter: Getter;
|
|
16
17
|
styleEffect: Effect;
|
|
17
18
|
/** The components props */
|
|
18
19
|
currentProps?: Record<string, any> | undefined | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNativeCss.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/react/useNativeCss.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAkB,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzD,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MA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|
1
1
|
import { type ColorSchemeName, type LayoutRectangle } from "react-native";
|
|
2
|
-
import type {
|
|
2
|
+
import type { StyleDescriptor, VariableValue } from "../../compiler";
|
|
3
3
|
export type Effect = {
|
|
4
4
|
observers: Set<Effect>;
|
|
5
5
|
run(): void;
|
|
@@ -33,11 +33,11 @@ export type VariableContextValue = Record<string, StyleDescriptor> & {
|
|
|
33
33
|
[VAR_SYMBOL]: true;
|
|
34
34
|
};
|
|
35
35
|
export declare const VariableContext: import("react").Context<VariableContextValue>;
|
|
36
|
-
export declare const rootVariables: ((key: string, args: void) => Observable<StyleDescriptor,
|
|
36
|
+
export declare const rootVariables: ((key: string, args: void) => Observable<StyleDescriptor, VariableValue[]>) & {
|
|
37
37
|
delete(key: string): boolean;
|
|
38
38
|
clear(): void;
|
|
39
39
|
};
|
|
40
|
-
export declare const universalVariables: ((key: string, args: void) => Observable<StyleDescriptor,
|
|
40
|
+
export declare const universalVariables: ((key: string, args: void) => Observable<StyleDescriptor, VariableValue[]>) & {
|
|
41
41
|
delete(key: string): boolean;
|
|
42
42
|
clear(): void;
|
|
43
43
|
};
|
|
@@ -54,7 +54,7 @@ export declare const vh: Observable<number, number>;
|
|
|
54
54
|
/** Color Scheme **************************************************************/
|
|
55
55
|
export declare const colorScheme: Observable<ColorSchemeName, ColorSchemeName>;
|
|
56
56
|
/** Containers ****************************************************************/
|
|
57
|
-
export type ContainerContextValue = Record<string,
|
|
57
|
+
export type ContainerContextValue = Record<string, WeakKey>;
|
|
58
58
|
export declare const ContainerContext: import("react").Context<ContainerContextValue>;
|
|
59
59
|
export declare const containerLayoutFamily: WeakFamilyFn<WeakKey, void, Observable<LayoutRectangle, LayoutRectangle>>;
|
|
60
60
|
export declare const containerWidthFamily: WeakFamilyFn<WeakKey, void, Observable<number, number>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactivity.d.ts","sourceRoot":"","sources":["../../../../../../src/runtime/native/reactivity.ts"],"names":[],"mappings":"AAEA,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B,CAAC;AAClD,eAAO,MAAM,kBAAkB;;;CAAuB,CAAC;AAEvD,gFAAgF;AAEhF,eAAO,MAAM,GAAG,4BAAiB,CAAC;AAElC,gFAAgF;AAEhF,eAAO,MAAM,WAAW,2DAAsC,CAAC;AAC/D,eAAO,MAAM,YAAY,2DAA+C,CAAC;AACzE,eAAO,MAAM,WAAW,2DAA+C,CAAC;AAExE,gFAAgF;AAEhF,eAAO,MAAM,UAAU,kFAAuC,CAAC;AAC/D,eAAO,MAAM,EAAE,4BAEd,CAAC;AACF,eAAO,MAAM,EAAE,4BAEd,CAAC;AAEF,gFAAgF;AAEhF,eAAO,MAAM,WAAW,8CAEvB,CAAC;AAGF,gFAAgF;AAEhF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5D,eAAO,MAAM,gBAAgB,gDAA2C,CAAC;AAEzE,eAAO,MAAM,qBAAqB,2EAOhC,CAAC;AAEH,eAAO,MAAM,oBAAoB,yDAI/B,CAAC;AAEH,eAAO,MAAM,qBAAqB,yDAIhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-props.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/styles/calculate-props.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,SAAS,EACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAGvB,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,SAAS,GAAG,cAAc,GAAG,oBAAoB,CAAC,EAAE,EAC5D,MAAM,GAAE,WAAW,EAAO,EAC1B,kBAAkB,GAAE,oBAEnB,EACD,eAAe,GAAE,cAEhB;;;;EA6DF;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,gBAAgB,EAAE,EAChC,eAAe,EAAE,cAAc,EAC/B,kBAAkB,EAAE,oBAAoB,EACxC,aAAa,GAAE,CAAC,MAAM,IAAI,CAAC,EAAO,EAClC,MAAM,GAAE,WAAW,EAAO,EAC1B,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAChC,cAAc,sBAAS,
|
|
1
|
+
{"version":3,"file":"calculate-props.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/styles/calculate-props.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,SAAS,EACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAGvB,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,SAAS,GAAG,cAAc,GAAG,oBAAoB,CAAC,EAAE,EAC5D,MAAM,GAAE,WAAW,EAAO,EAC1B,kBAAkB,GAAE,oBAEnB,EACD,eAAe,GAAE,cAEhB;;;;EA6DF;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,gBAAgB,EAAE,EAChC,eAAe,EAAE,cAAc,EAC/B,kBAAkB,EAAE,oBAAoB,EACxC,aAAa,GAAE,CAAC,MAAM,IAAI,CAAC,EAAO,EAClC,MAAM,GAAE,WAAW,EAAO,EAC1B,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAChC,cAAc,sBAAS,QA+ExB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/styles/units.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtime/native/styles/units.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,eAAO,MAAM,EAAE,EAAE,qBAkBhB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,qBAQhB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,qBAQhB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,qBAQjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-css",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.fa5e95b",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"./jest": {
|
|
42
42
|
"source": "./src/jest/index.ts",
|
|
43
|
-
"react-native": "./src/jest/index.
|
|
43
|
+
"react-native": "./src/jest/index.ts",
|
|
44
44
|
"import": {
|
|
45
45
|
"types": "./dist/typescript/module/src/jest/index.d.ts",
|
|
46
46
|
"default": "./dist/module/jest/index.js"
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"prepare": "bob build",
|
|
105
105
|
"prepublishOnly": "bob build",
|
|
106
106
|
"release": "release-it --config ./.config/release-it.config.ts",
|
|
107
|
-
"release:nightly": "release-it --config ./.config/release-it.config.ts 3.0.0-nightly.\"$(git rev-parse --short HEAD)\" --npm.tag=beta",
|
|
107
|
+
"release:nightly": "release-it --config ./.config/release-it.nightly.config.ts 3.0.0-nightly.\"$(git rev-parse --short HEAD)\" --npm.tag=beta",
|
|
108
108
|
"start": "yarn example start",
|
|
109
109
|
"start:build": "yarn build && yarn example build",
|
|
110
110
|
"start:debug": "yarn build && yarn example debug",
|
package/src/compiler/atRules.ts
CHANGED
|
@@ -132,7 +132,7 @@ function propAtRuleBlock(
|
|
|
132
132
|
mapping[toRNProperty(fromToken.value.value)] = to.flatMap((item, index) => {
|
|
133
133
|
switch (item.value.type) {
|
|
134
134
|
case "delim":
|
|
135
|
-
return index === 0 && item.value.value === "
|
|
135
|
+
return index === 0 && item.value.value === "*" ? ["*"] : [];
|
|
136
136
|
case "ident":
|
|
137
137
|
return [toRNProperty(item.value.value)];
|
|
138
138
|
default:
|
package/src/compiler/compiler.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
import { inspect } from "node:util";
|
|
3
|
+
|
|
2
4
|
import { debug } from "debug";
|
|
3
5
|
import {
|
|
4
6
|
transform as lightningcss,
|
|
@@ -12,11 +14,7 @@ import {
|
|
|
12
14
|
} from "lightningcss";
|
|
13
15
|
|
|
14
16
|
import { maybeMutateReactNativeOptions, parsePropAtRule } from "./atRules";
|
|
15
|
-
import type {
|
|
16
|
-
CompilerOptions,
|
|
17
|
-
ContainerQuery,
|
|
18
|
-
ReactNativeCssStyleSheet,
|
|
19
|
-
} from "./compiler.types";
|
|
17
|
+
import type { CompilerOptions, ContainerQuery } from "./compiler.types";
|
|
20
18
|
import { parseContainerCondition } from "./container-query";
|
|
21
19
|
import { parseDeclaration } from "./declarations";
|
|
22
20
|
import { extractKeyFrames } from "./keyframes";
|
|
@@ -33,11 +31,11 @@ const defaultLogger = debug("react-native-css:compiler");
|
|
|
33
31
|
* @param options - Compiler options
|
|
34
32
|
* @returns A `ReactNativeCssStyleSheet` that can be passed to `StyleSheet.register` or used with a custom runtime
|
|
35
33
|
*/
|
|
36
|
-
export function compile(
|
|
37
|
-
code: Buffer | string,
|
|
38
|
-
options: CompilerOptions = {},
|
|
39
|
-
): ReactNativeCssStyleSheet {
|
|
34
|
+
export function compile(code: Buffer | string, options: CompilerOptions = {}) {
|
|
40
35
|
const { logger = defaultLogger } = options;
|
|
36
|
+
const isLoggerEnabled =
|
|
37
|
+
"enabled" in logger ? logger.enabled : Boolean(logger);
|
|
38
|
+
|
|
41
39
|
const features = Object.assign({}, options.features);
|
|
42
40
|
|
|
43
41
|
if (options.selectorPrefix && options.selectorPrefix.startsWith(".")) {
|
|
@@ -67,8 +65,12 @@ export function compile(
|
|
|
67
65
|
maybeMutateReactNativeOptions(rule, builder);
|
|
68
66
|
},
|
|
69
67
|
StyleSheetExit(sheet) {
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
if (isLoggerEnabled) {
|
|
69
|
+
logger(`Found ${sheet.rules.length} rules to process`);
|
|
70
|
+
logger(
|
|
71
|
+
inspect(sheet.rules, { depth: null, colors: true, compact: false }),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
72
74
|
|
|
73
75
|
for (const rule of sheet.rules) {
|
|
74
76
|
// Extract the style declarations and animations from the current rule
|
|
@@ -108,7 +110,10 @@ export function compile(
|
|
|
108
110
|
visitor,
|
|
109
111
|
});
|
|
110
112
|
|
|
111
|
-
return
|
|
113
|
+
return {
|
|
114
|
+
stylesheet: () => builder.getNativeStyleSheet(),
|
|
115
|
+
warnings: () => builder.getWarnings(),
|
|
116
|
+
};
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
/**
|
|
@@ -137,16 +142,16 @@ function extractRule(rule: Rule, builder: StylesheetBuilder) {
|
|
|
137
142
|
|
|
138
143
|
const declarationBlock = value.declarations;
|
|
139
144
|
if (declarationBlock) {
|
|
140
|
-
if (declarationBlock.declarations) {
|
|
141
|
-
builder.
|
|
145
|
+
if (declarationBlock.declarations?.length) {
|
|
146
|
+
builder.newNestedRule();
|
|
142
147
|
for (const declaration of declarationBlock.declarations) {
|
|
143
148
|
parseDeclaration(declaration, builder);
|
|
144
149
|
}
|
|
145
150
|
builder.applyRuleToSelectors();
|
|
146
151
|
}
|
|
147
152
|
|
|
148
|
-
if (declarationBlock.importantDeclarations) {
|
|
149
|
-
builder.
|
|
153
|
+
if (declarationBlock.importantDeclarations?.length) {
|
|
154
|
+
builder.newNestedRule({ important: true });
|
|
150
155
|
for (const declaration of declarationBlock.importantDeclarations) {
|
|
151
156
|
parseDeclaration(declaration, builder);
|
|
152
157
|
}
|
|
@@ -283,17 +288,17 @@ function extractContainer(
|
|
|
283
288
|
builder = builder.fork("container");
|
|
284
289
|
|
|
285
290
|
// Iterate over all rules inside the containerRule and extract their styles using the updated CompilerCollection
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
};
|
|
291
|
+
const query: ContainerQuery = {
|
|
292
|
+
m: parseContainerCondition(containerRule.condition, builder),
|
|
293
|
+
};
|
|
290
294
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
295
|
+
if (containerRule.name) {
|
|
296
|
+
query.n = containerRule.name;
|
|
297
|
+
}
|
|
294
298
|
|
|
295
|
-
|
|
299
|
+
builder.addContainerQuery(query);
|
|
296
300
|
|
|
301
|
+
for (const rule of containerRule.rules) {
|
|
297
302
|
extractRule(rule, builder);
|
|
298
303
|
}
|
|
299
304
|
}
|
|
@@ -35,9 +35,9 @@ export interface ReactNativeCssStyleSheet_V2 {
|
|
|
35
35
|
/** KeyFrames */
|
|
36
36
|
k?: Animation_V2[];
|
|
37
37
|
/** Root Variables */
|
|
38
|
-
vr?:
|
|
38
|
+
vr?: RootVariables;
|
|
39
39
|
/** Universal Variables */
|
|
40
|
-
vu?:
|
|
40
|
+
vu?: RootVariables;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/******************************** Styles ********************************/
|
|
@@ -147,10 +147,12 @@ export type StyleFunction =
|
|
|
147
147
|
/****************************** Variables *******************************/
|
|
148
148
|
|
|
149
149
|
export type VariableDescriptor = [string, StyleDescriptor];
|
|
150
|
-
export type VariableRecord = Record<string,
|
|
151
|
-
export type
|
|
150
|
+
export type VariableRecord = Record<string, VariableValue[]>;
|
|
151
|
+
export type VariableValue =
|
|
152
152
|
| [StyleDescriptor]
|
|
153
|
-
| [StyleDescriptor,
|
|
153
|
+
| [StyleDescriptor, MediaCondition[]];
|
|
154
|
+
|
|
155
|
+
export type RootVariables = [string, VariableValue[]][];
|
|
154
156
|
|
|
155
157
|
export type InlineVariable = {
|
|
156
158
|
[VAR_SYMBOL]: "inline";
|
|
@@ -116,7 +116,7 @@ const parsers: {
|
|
|
116
116
|
"border-inline-start": parseBorderInlineStart,
|
|
117
117
|
"border-inline-start-color": parseColorDeclaration,
|
|
118
118
|
"border-inline-start-width": parseBorderSideWidthDeclaration,
|
|
119
|
-
"border-inline-width":
|
|
119
|
+
"border-inline-width": parseBorderInlineWidth,
|
|
120
120
|
"border-left": parseBorderSide,
|
|
121
121
|
"border-left-color": parseColorDeclaration,
|
|
122
122
|
"border-left-width": parseBorderSideWidthDeclaration,
|
|
@@ -270,6 +270,7 @@ function parseWithParser(declaration: Declaration, builder: StylesheetBuilder) {
|
|
|
270
270
|
|
|
271
271
|
builder.descriptorProperty = declaration.property;
|
|
272
272
|
|
|
273
|
+
builder.setWarningProperty(declaration.property);
|
|
273
274
|
const value = parser(declaration, builder, declaration.property);
|
|
274
275
|
|
|
275
276
|
if (value !== undefined) {
|
|
@@ -475,6 +476,20 @@ function parseBorderInlineEnd(
|
|
|
475
476
|
);
|
|
476
477
|
}
|
|
477
478
|
|
|
479
|
+
export function parseBorderInlineWidth(
|
|
480
|
+
declaration: DeclarationType<"border-inline-width">,
|
|
481
|
+
builder: StylesheetBuilder,
|
|
482
|
+
) {
|
|
483
|
+
builder.addDescriptor(
|
|
484
|
+
"border-left-width",
|
|
485
|
+
parseBorderSideWidth(declaration.value.start, builder),
|
|
486
|
+
);
|
|
487
|
+
builder.addDescriptor(
|
|
488
|
+
"border-right-width",
|
|
489
|
+
parseBorderSideWidth(declaration.value.end, builder),
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
|
|
478
493
|
function parseFlexFlow(
|
|
479
494
|
{ value }: DeclarationType<"flex-flow">,
|
|
480
495
|
builder: StylesheetBuilder,
|
|
@@ -743,7 +758,17 @@ function parseLetterSpacing(
|
|
|
743
758
|
if (value.type === "normal") {
|
|
744
759
|
return;
|
|
745
760
|
}
|
|
746
|
-
|
|
761
|
+
const descriptor = parseLength(value.value, builder);
|
|
762
|
+
|
|
763
|
+
if (
|
|
764
|
+
Array.isArray(descriptor) &&
|
|
765
|
+
descriptor[1] === "em" &&
|
|
766
|
+
typeof descriptor[2] === "number"
|
|
767
|
+
) {
|
|
768
|
+
return descriptor[2];
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
return descriptor;
|
|
747
772
|
}
|
|
748
773
|
|
|
749
774
|
function parseTextDecoration(
|
|
@@ -803,6 +828,8 @@ export function parseDeclarationUnparsed(
|
|
|
803
828
|
return;
|
|
804
829
|
}
|
|
805
830
|
|
|
831
|
+
builder.setWarningProperty(property);
|
|
832
|
+
|
|
806
833
|
/**
|
|
807
834
|
* React Native doesn't support all the logical properties
|
|
808
835
|
*/
|
|
@@ -858,6 +885,13 @@ export function parseDeclarationCustom(
|
|
|
858
885
|
property.startsWith("--") ||
|
|
859
886
|
property.startsWith("-rn-")
|
|
860
887
|
) {
|
|
888
|
+
builder.setWarningProperty(property);
|
|
889
|
+
builder.addDescriptor(
|
|
890
|
+
property,
|
|
891
|
+
parseUnparsed(declaration.value.value, builder, allowAuto.has(property)),
|
|
892
|
+
);
|
|
893
|
+
} else if (property === "-webkit-line-clamp") {
|
|
894
|
+
builder.addMapping({ [property]: ["numberOfLines"] });
|
|
861
895
|
builder.addDescriptor(
|
|
862
896
|
property,
|
|
863
897
|
parseUnparsed(declaration.value.value, builder, allowAuto.has(property)),
|
|
@@ -1031,7 +1065,7 @@ export function parseUnparsed(
|
|
|
1031
1065
|
builder,
|
|
1032
1066
|
);
|
|
1033
1067
|
default: {
|
|
1034
|
-
builder.addWarning("
|
|
1068
|
+
builder.addWarning("value", `${tokenOrValue.value.name}()`);
|
|
1035
1069
|
return;
|
|
1036
1070
|
}
|
|
1037
1071
|
}
|
|
@@ -1152,23 +1186,30 @@ export function parseLength(
|
|
|
1152
1186
|
const { inlineRem = 14 } = builder.getOptions();
|
|
1153
1187
|
|
|
1154
1188
|
if (typeof length === "number") {
|
|
1155
|
-
return length;
|
|
1189
|
+
return round(length);
|
|
1156
1190
|
}
|
|
1157
1191
|
|
|
1158
1192
|
if ("unit" in length) {
|
|
1159
1193
|
switch (length.unit) {
|
|
1160
|
-
case "px":
|
|
1161
|
-
|
|
1194
|
+
case "px": {
|
|
1195
|
+
if (length.value === Infinity) {
|
|
1196
|
+
return 9999;
|
|
1197
|
+
} else if (length.value === -Infinity) {
|
|
1198
|
+
return -9999;
|
|
1199
|
+
} else {
|
|
1200
|
+
return round(length.value);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1162
1203
|
case "rem":
|
|
1163
1204
|
if (typeof inlineRem === "number") {
|
|
1164
1205
|
return length.value * inlineRem;
|
|
1165
1206
|
} else {
|
|
1166
|
-
return [{}, "rem", length.value];
|
|
1207
|
+
return [{}, "rem", round(length.value)];
|
|
1167
1208
|
}
|
|
1168
1209
|
case "vw":
|
|
1169
1210
|
case "vh":
|
|
1170
1211
|
case "em":
|
|
1171
|
-
return [{}, length.unit, length.value, 1];
|
|
1212
|
+
return [{}, length.unit, round(length.value), 1];
|
|
1172
1213
|
case "in":
|
|
1173
1214
|
case "cm":
|
|
1174
1215
|
case "mm":
|
|
@@ -1251,7 +1292,7 @@ export function parseAngle(angle: Angle | number, builder: StylesheetBuilder) {
|
|
|
1251
1292
|
case "rad":
|
|
1252
1293
|
return `${angle.value}${angle.type}`;
|
|
1253
1294
|
default:
|
|
1254
|
-
builder.addWarning("value", angle.value);
|
|
1295
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
1255
1296
|
return undefined;
|
|
1256
1297
|
}
|
|
1257
1298
|
}
|
|
@@ -1879,7 +1920,7 @@ export function parseBorderBlockColor(
|
|
|
1879
1920
|
}
|
|
1880
1921
|
|
|
1881
1922
|
export function parseBorderBlockWidth(
|
|
1882
|
-
declaration: DeclarationType<"border-block-width"
|
|
1923
|
+
declaration: DeclarationType<"border-block-width">,
|
|
1883
1924
|
builder: StylesheetBuilder,
|
|
1884
1925
|
) {
|
|
1885
1926
|
builder.addDescriptor(
|
|
@@ -1959,7 +2000,8 @@ export function parseLineHeight(
|
|
|
1959
2000
|
case "percentage":
|
|
1960
2001
|
case "calc":
|
|
1961
2002
|
builder.addWarning(
|
|
1962
|
-
"
|
|
2003
|
+
"style",
|
|
2004
|
+
"line-height",
|
|
1963
2005
|
typeof length.value === "number"
|
|
1964
2006
|
? length.value
|
|
1965
2007
|
: JSON.stringify(length.value),
|
|
@@ -2222,7 +2264,11 @@ export function parseDimension(
|
|
|
2222
2264
|
): StyleDescriptor {
|
|
2223
2265
|
switch (unit) {
|
|
2224
2266
|
case "px":
|
|
2225
|
-
|
|
2267
|
+
if (value === Infinity) {
|
|
2268
|
+
return 9999;
|
|
2269
|
+
} else {
|
|
2270
|
+
return value;
|
|
2271
|
+
}
|
|
2226
2272
|
case "%":
|
|
2227
2273
|
return `${value}%`;
|
|
2228
2274
|
case "rnh":
|
|
@@ -2262,7 +2308,7 @@ export function parseSVGPaint(
|
|
|
2262
2308
|
}
|
|
2263
2309
|
|
|
2264
2310
|
export function round(number: number) {
|
|
2265
|
-
return Math.round((number + Number.EPSILON) *
|
|
2311
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
2266
2312
|
}
|
|
2267
2313
|
|
|
2268
2314
|
export function parseDimensionPercentageFor_LengthValue(
|
|
@@ -6,7 +6,7 @@ test("nested classes", () => {
|
|
|
6
6
|
color: red;
|
|
7
7
|
}`);
|
|
8
8
|
|
|
9
|
-
expect(compiled).toStrictEqual({
|
|
9
|
+
expect(compiled.stylesheet()).toStrictEqual({
|
|
10
10
|
s: [
|
|
11
11
|
[
|
|
12
12
|
"my-class",
|
|
@@ -38,7 +38,7 @@ test("multiple tiers classes", () => {
|
|
|
38
38
|
color: red;
|
|
39
39
|
}`);
|
|
40
40
|
|
|
41
|
-
expect(compiled).toStrictEqual({
|
|
41
|
+
expect(compiled.stylesheet()).toStrictEqual({
|
|
42
42
|
s: [
|
|
43
43
|
[
|
|
44
44
|
"one",
|
|
@@ -79,7 +79,7 @@ test("tiers with multiple classes", () => {
|
|
|
79
79
|
color: red;
|
|
80
80
|
}`);
|
|
81
81
|
|
|
82
|
-
expect(compiled).toStrictEqual({
|
|
82
|
+
expect(compiled.stylesheet()).toStrictEqual({
|
|
83
83
|
s: [
|
|
84
84
|
[
|
|
85
85
|
"one",
|