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
10 changes: 5 additions & 5 deletions packages/@stylexjs/babel-plugin/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ declare function processStylexRules(
config?:
| boolean
| {
useLayers?: boolean,
enableLTRRTLComments?: boolean,
legacyDisableLayers?: boolean,
}
useLayers?: boolean;
enableLTRRTLComments?: boolean;
legacyDisableLayers?: boolean;
},
): string;
export type StyleXTransformObj = Readonly<{
(): PluginObj;
withOptions: typeof stylexPluginWithOptions;
processStylexRules: typeof processStylexRules;
}>;
declare const $$EXPORT_DEFAULT_DECLARATION$$: StyleXTransformObj;
export = $$EXPORT_DEFAULT_DECLARATION$$;
export default $$EXPORT_DEFAULT_DECLARATION$$;
60 changes: 60 additions & 0 deletions packages/@stylexjs/babel-plugin/src/shared/common-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

export type TRawValue = number | string | ReadonlyArray<number | string>;
export type TStyleValue = null | TRawValue;
export type TNestableStyleValue = TStyleValue | PrimitiveRawStyles;
export type RawStyles = Readonly<{ [$$Key$$: string]: TNestableStyleValue }>;
export type PrimitiveRawStyles = Readonly<{
[$$Key$$: string]: TNestableStyleValue;
}>;
export type InjectableStyle = {
readonly priority: number;
readonly ltr: string;
readonly rtl: null | string;
};
export type InjectableConstStyle = {
readonly priority: number;
readonly ltr: string;
readonly rtl: null | string;
readonly constKey: string;
readonly constVal: string | number;
};
export type StyleRule = [string, string, InjectableStyle];
export type CompiledStyles = Readonly<{
[$$Key$$: string]:
| null
| string
| Readonly<{ [$$Key$$: string]: null | string }>;
}>;
export type FlatCompiledStyles = Readonly<
{ [$$Key$$: string]: string | null } & { $$css: true | string }
>;
export type StyleXOptions = Readonly<{
classNamePrefix: string;
debug: null | undefined | boolean;
definedStylexCSSVariables?: { [key: string]: unknown };
dev: boolean;
enableDebugClassNames?: null | undefined | boolean;
enableDebugDataProp?: null | undefined | boolean;
enableDevClassNames?: null | undefined | boolean;
enableFontSizePxToRem?: null | undefined | boolean;
enableMediaQueryOrder?: null | undefined | boolean;
enableLegacyValueFlipping?: null | undefined | boolean;
enableLogicalStylesPolyfill?: null | undefined | boolean;
enableLTRRTLComments?: null | undefined | boolean;
enableMinifiedKeys?: null | undefined | boolean;
styleResolution:
| 'application-order'
| 'property-specificity'
| 'legacy-expand-shorthands';
test: boolean;
}>;
export type MutableCompiledNamespaces = { [key: string]: FlatCompiledStyles };
export type CompiledNamespaces = Readonly<MutableCompiledNamespaces>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

import type { InjectableStyle, StyleXOptions } from './common-types';
declare function styleXCreateTheme(
themeVars: {
readonly __varGroupHash__: string;
readonly [$$Key$$: string]: string;
},
variables: {
readonly [$$Key$$: string]:
| string
| { default: string; readonly [$$Key$$: string]: string };
},
options?: StyleXOptions,
): [
{ $$css: true } & { readonly [$$Key$$: string]: string },
{ [$$Key$$: string]: InjectableStyle },
];
export default styleXCreateTheme;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/

import type { InjectableStyle, StyleXOptions } from './common-types';
import type { VarsConfig } from './stylex-vars-utils';
type VarsKeysWithStringValues<Vars extends VarsConfig> = Readonly<{
[$$Key$$ in keyof Vars]: string;
}>;
type VarsObject<Vars extends VarsConfig> = Readonly<
Omit<VarsKeysWithStringValues<Vars>, keyof { __varGroupHash__: string }> & {
__varGroupHash__: string;
}
>;
declare function styleXDefineVars<Vars extends VarsConfig>(
variables: Vars,
options: Readonly<
Omit<Partial<StyleXOptions>, keyof { exportId: string }> & {
exportId: string;
}
>,
): [VarsObject<Vars>, { [$$Key$$: string]: InjectableStyle }];
export default styleXDefineVars;