/** * 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. * * * * Shared transform for stylex.unstable_defineConstsNested(). * Thin wrapper: flatten nested input → delegate to styleXDefineConsts → unflatten JS output. * No CSS is emitted (consts are compile-time constants). * * Uses flattenNestedConstsConfig (not flattenNestedVarsConfig) because consts * don't support conditional @-rule values. An object like * { default: '#00FF00', hovered: '#0000FF' } represents component states, * not CSS conditions — so both become separate flat keys. * * Example: * Input: { spacing: { sm: '4px', lg: '16px' } } * Step 1: flattenNestedConstsConfig → { 'spacing.sm': '4px', 'spacing.lg': '16px' } * Step 2: styleXDefineConsts → { 'spacing.sm': '4px', 'spacing.lg': '16px' } (values preserved) * Step 3: unflattenObject → { spacing: { sm: '4px', lg: '16px' } } */ import type { InjectableConstStyle, StyleXOptions } from './common-types'; import type { NestedConstsValue } from './stylex-nested-utils'; import type { Unflattened } from './stylex-nested-utils'; declare function styleXDefineConstsNested( nestedConstants: { readonly [$$Key$$: string]: NestedConstsValue }, options: Readonly< Omit, keyof { exportId: string }> & { exportId: string; } >, ): [ { [$$Key$$: string]: Unflattened }, { [$$Key$$: string]: InjectableConstStyle }, ]; export default styleXDefineConstsNested;