Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/compiler/compiler.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ export interface CompilerOptions {
/**
* A `react-native-css` StyleSheet
*/
export type ReactNativeCssStyleSheet = ReactNativeCssStyleSheet_V2;

export interface ReactNativeCssStyleSheet_V2 {
export interface ReactNativeCssStyleSheet {
/** Feature flags */
f?: FeatureFlagRecord;
/** rem */
r?: number;
/** StyleRuleSets */
s?: (readonly [string, StyleRuleSet])[];
/** KeyFrames */
k?: Animation_V2[];
k?: Animation[];
/** Root Variables */
vr?: RootVariables;
/** Universal Variables */
Expand Down Expand Up @@ -158,11 +156,11 @@ export type InlineVariable = {
[key: string]: unknown | undefined;
};

/****************************** Animations V2 ******************************/
/****************************** Animations ******************************/

export type Animation_V2 = [string, AnimationKeyframes_V2[]];
export type AnimationRecord = Record<string, AnimationKeyframes_V2[]>;
export type AnimationKeyframes_V2 = [string | number, StyleDeclaration[]];
export type Animation = [string, AnimationKeyframes[]];
export type AnimationRecord = Record<string, AnimationKeyframes[]>;
export type AnimationKeyframes = [string | number, StyleDeclaration[]];

/****************************** Conditions ******************************/

Expand Down Expand Up @@ -257,7 +255,7 @@ export type LoggerOptions = {
export interface CompilerCollection extends CompilerOptions {
features: FeatureFlagRecord;
rules: Map<string, StyleRule[]>;
keyframes: Map<string, AnimationKeyframes_V2[]>;
keyframes: Map<string, AnimationKeyframes[]>;
darkMode?: string | null;
rootVariables: VariableRecord;
universalVariables: VariableRecord;
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/stylesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
specificityCompareFn,
} from "../runtime/utils";
import type {
AnimationKeyframes_V2,
AnimationKeyframes,
AnimationRecord,
CompilerOptions,
ContainerQuery,
Expand Down Expand Up @@ -39,7 +39,7 @@ const extraRules = new WeakMap<StyleRule, Partial<StyleRule>[]>();
const keywords = new Set(["unset"]);

export class StylesheetBuilder {
animationFrames?: AnimationKeyframes_V2[];
animationFrames?: AnimationKeyframes[];
animationDeclarations: StyleDeclaration[] = [];

stylesheet: ReactNativeCssStyleSheet = {};
Expand Down
4 changes: 2 additions & 2 deletions src/metro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import connect from "connect";
import debug from "debug";
import type { MetroConfig } from "metro-config";

import type { CompilerOptions, ReactNativeCssStyleSheet_V2 } from "../compiler";
import type { CompilerOptions, ReactNativeCssStyleSheet } from "../compiler";
import { compile } from "../compiler/compiler";
import { getNativeInjectionCode, getWebInjectionCode } from "./injection-code";
import { nativeResolver, webResolver } from "./resolver";
Expand Down Expand Up @@ -97,7 +97,7 @@ export function withReactNativeCSS<

const nativeCSSFiles = new Map<
string,
[string, ReactNativeCssStyleSheet_V2]
[string, ReactNativeCssStyleSheet]
>();
const webCSSFiles = new Set<string>();

Expand Down
6 changes: 3 additions & 3 deletions src/style-collection/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {
Animation_V2,
Animation,
ReactNativeCssStyleSheet,
StyleRuleSet,
} from "react-native-css/compiler";
Expand All @@ -17,7 +17,7 @@ export { rootVariables, universalVariables };

interface StyleCollectionType {
styles: ReturnType<typeof family<string, Observable<StyleRuleSet>>>;
keyframes: ReturnType<typeof family<string, Observable<Animation_V2[1]>>>;
keyframes: ReturnType<typeof family<string, Observable<Animation[1]>>>;
inject: (options: ReactNativeCssStyleSheet) => void;
}

Expand All @@ -29,7 +29,7 @@ globalThis.__react_native_css_style_collection ??= {
styles: family<string, Observable<StyleRuleSet>>(() => {
return observable([], isDeepEqual);
}),
keyframes: family<string, Observable<Animation_V2[1]>>(() => {
keyframes: family<string, Observable<Animation[1]>>(() => {
return observable([], isDeepEqual);
}),
inject: function (options: ReactNativeCssStyleSheet) {
Expand Down
Loading