import type { SDTFEngineSerializedMetadata, SDTFEngineSerializedState } from '../SDTFEngineSerializedState.js'; import { TreeNodeDescription, TreeNodeExtensions } from '../../definitions/internals/designTokenTree.js'; import { PickSpecifyDesignToken, SpecifyDesignToken, SpecifyDesignTokenFormat, SpecifyDesignTokenGroupProperties, SpecifyDesignTokenTypeName } from '../../definitions/index.js'; import { GetJSONTokenValueOptions, TokenState } from './TokenState.js'; import { GroupState } from './GroupState.js'; import { CollectionState } from './CollectionState.js'; import { SDTFQuery } from '../query/index.js'; import { SpecifyDesignTokenCollectionProperties } from '../../definitions/internals/designTokenCollection.js'; import { AliasReference, AliasReferenceSet, ResolvableAliasReference, ResolvedStatefulAliasReference, StatefulAliasReference, UnresolvableAliasReference, UnresolvableStatefulAliasReference } from './AliasReferenceSet.js'; import { SpecifyDesignTokenValueWithMode } from '../../definitions/internals/designTokenSignature.js'; import { JSONObject } from '../../utils/JSONDefinitions.js'; import { TreeNodesState } from './TreeNodesState.js'; import { ViewsState } from './ViewsState.js'; import { TreePath } from './path/TreePath.js'; export type SDTFNodeState = TokenState | GroupState | CollectionState; export type ViewSelectorOptions = { withView?: string | null; }; export type TreeStateParams = { globalState: TreeNodesState; aliasReferences: AliasReferenceSet; viewsState: ViewsState; activeViewName: string | null; }; export declare class TreeState { #private; private readonly global; private readonly aliasReferences; private current; constructor({ globalState, aliasReferences, viewsState, activeViewName }: TreeStateParams); reset(): void; refreshViews(): void; listViews(): { name: string; query: SDTFQuery; isActive: boolean; }[]; getActiveView(): import("./ViewState.js").SerializedView | null; registerView(name: string, query: SDTFQuery, shouldSetActive?: boolean): void; updateView(name: string, query: SDTFQuery, shouldSetActive?: boolean): void; setActiveView(name: string | null): void; deleteView(name: string): boolean; deleteAllViews(): void; disableViews(): void; withViewNodesState(viewName: string | null | undefined, fn: (nodes: TreeNodesState) => T): T; addAliasReference(candidate: AliasReference): void; updateAliasReference(at: AliasReference['from'], candidate: AliasReference): void; upsertAliasReference(candidate: AliasReference): void; getAliasReference(from: AliasReference['from']): AliasReference | undefined; getAllAliasReferences(): AliasReference[]; getAliasReferencesTo : O extends { isResolvable: false; } ? Array : Array>(to: { treePath: AliasReference['to']['treePath']; mode?: AliasReference['to']['mode']; }, options?: O): R; getAliasReferencesFrom : O extends { isResolvable: false; } ? Array : Array>(from: { treePath: AliasReference['from']['treePath']; valuePath?: AliasReference['from']['valuePath']; mode?: AliasReference['from']['mode']; }, options?: O): R; getDeepAliasReferencesFrom(from: { treePath: AliasReference['from']['treePath']; valuePath: AliasReference['from']['valuePath']; mode: AliasReference['from']['mode']; }): AliasReference | undefined; getAliasReferenceOrParentFrom(from: { treePath: AliasReference['from']['treePath']; valuePath: AliasReference['from']['valuePath']; mode: AliasReference['from']['mode']; }): AliasReference | undefined; /** * Retrieve the target coordinates from a starting point. * E.g, if you want the value of a dimension, it'll tell you where is the JSON value. * It'll be either on a number token, or the value of a dimension token. */ getDeepAliasReferenceAndPathInfoFrom(from: { treePath: AliasReference['from']['treePath']; valuePath: AliasReference['from']['valuePath']; mode: AliasReference['from']['mode']; }): { aliasRef: { from: { mode: string | null; valuePath: import("./path/ValuePath.js").ValuePath; treePath: TreePath; }; to: { treePath: TreePath; mode: string | null; }; isResolvable: true; } | { from: { mode: string | null; valuePath: import("./path/ValuePath.js").ValuePath; treePath: TreePath; }; to: { treePath: TreePath; mode: string | null; }; isResolvable: false; reason: string; }; toValuePath: import("./path/ValuePath.js").ValuePath; traversedPath: import("./path/ValuePath.js").ValuePath; } | undefined; deleteAliasReferencesFrom(from: { treePath: AliasReference['from']['treePath']; valuePath?: AliasReference['from']['valuePath']; mode: AliasReference['from']['mode']; }): void; getStatefulAliasReference(from: AliasReference['from']): StatefulAliasReference; getStatefulAliasReferencesTo : O extends { isResolvable: false; } ? Array : Array>(to: { treePath: AliasReference['to']['treePath']; mode?: AliasReference['to']['mode']; }, options?: O): R; getStatefulAliasReferencesFrom : O extends { isResolvable: false; } ? Array : Array>(from: { treePath: AliasReference['from']['treePath']; valuePath?: AliasReference['from']['valuePath']; mode?: AliasReference['from']['mode']; }, options?: O): R; deleteOneAliasReference(from: AliasReference['from']): void; isAvailablePath(path: TreePath): boolean; isExistingParentPath(path: TreePath): boolean; updateChildrenPaths(parentPath: TreePath, replacer: string): void; addCollection(path: TreePath, collectionProperties: SpecifyDesignTokenCollectionProperties): void; renameCollection(path: TreePath, newName: string): void; updateCollectionDescription(path: TreePath, newDescription: TreeNodeDescription): void; updateCollectionExtensions(path: TreePath, newExtensions: TreeNodeExtensions): void; renameCollectionMode(path: TreePath, fromMode: string, toMode: string): void; deleteCollectionMode(path: TreePath, mode: string): void; deleteCollection(path: TreePath): void; moveCollection(atPath: TreePath, toPath: TreePath): void; truncateCollection(path: TreePath): void; addGroup(path: TreePath, groupProperties: SpecifyDesignTokenGroupProperties): void; renameGroup(path: TreePath, newName: string): void; updateGroupDescription(path: TreePath, newDescription: TreeNodeDescription): void; updateGroupExtensions(path: TreePath, newExtensions: TreeNodeExtensions): void; deleteGroup(path: TreePath): void; moveGroup(atPath: TreePath, toPath: TreePath): void; truncateGroup(path: TreePath): void; addToken(path: TreePath, rawToken: SpecifyDesignToken): void; renameToken(path: TreePath, newName: string): void; updateTokenDescription(path: TreePath, newDescription: TreeNodeDescription): void; updateTokenExtensions(path: TreePath, newExtensions: TreeNodeExtensions): void; updateTokenValue(path: TreePath, newValue: PickSpecifyDesignToken['$value']): void; resolveTokenValueAliases(path: TreePath): void; updateTokenModeValue(path: TreePath, mode: string, newValue: SpecifyDesignTokenValueWithMode['$value'], string, false>): void; renameTokenMode(path: TreePath, fromMode: string, toMode: string): void; createTokenModeValue(path: TreePath, mode: string, value: PickSpecifyDesignToken['$value']): void; deleteTokenModeValue(path: TreePath, mode: string): void; deleteToken(path: TreePath): void; moveToken(fromPath: TreePath, toPath: TreePath): void; renameNode(path: TreePath, newName: string): void; getTokenState(path: TreePath | string, options?: ViewSelectorOptions): TokenState | undefined; getGroupState(path: TreePath | string, options?: ViewSelectorOptions): GroupState | undefined; getCollectionState(path: TreePath | string, options?: ViewSelectorOptions): CollectionState | undefined; getNearestCollectionState(path: TreePath | string, options?: ViewSelectorOptions): CollectionState | undefined; getAllTokenStates(options?: ViewSelectorOptions): TokenState<"string" | "number" | "boolean" | "object" | "null" | "array" | "integerNumber" | "zeroToOneNumber" | "arcDegreeNumber" | "rgbColorNumber" | "positiveNumber" | "positiveIntegerNumber" | "percentageNumber" | "hexadecimalColorString" | "bitmap" | "bitmaps" | "bitmapFormat" | "blur" | "border" | "borderStyle" | "borderStyleLineCap" | "breakpoint" | "color" | "cubicBezier" | "dimension" | "dimensionUnit" | "duration" | "durationUnit" | "font" | "fontFamily" | "fontFeature" | "fontFeatures" | "fontFormat" | "fontStyle" | "fontWeight" | "gradient" | "gradients" | "opacity" | "radius" | "radii" | "shadow" | "shadows" | "shadowType" | "spacing" | "spacings" | "stepsTimingFunction" | "textAlignHorizontal" | "textAlignVertical" | "textDecoration" | "textStyle" | "textTransform" | "transition" | "vector" | "vectors" | "vectorFormat" | "zIndex", unknown, string>[]; getAllGroupStates(options?: ViewSelectorOptions): GroupState[]; getAllCollectionStates(options?: ViewSelectorOptions): CollectionState[]; getAllNodeStates(options?: ViewSelectorOptions): Array; getTokenChildrenOf(path: TreePath, depth?: number, options?: ViewSelectorOptions): TokenState<"string" | "number" | "boolean" | "object" | "null" | "array" | "integerNumber" | "zeroToOneNumber" | "arcDegreeNumber" | "rgbColorNumber" | "positiveNumber" | "positiveIntegerNumber" | "percentageNumber" | "hexadecimalColorString" | "bitmap" | "bitmaps" | "bitmapFormat" | "blur" | "border" | "borderStyle" | "borderStyleLineCap" | "breakpoint" | "color" | "cubicBezier" | "dimension" | "dimensionUnit" | "duration" | "durationUnit" | "font" | "fontFamily" | "fontFeature" | "fontFeatures" | "fontFormat" | "fontStyle" | "fontWeight" | "gradient" | "gradients" | "opacity" | "radius" | "radii" | "shadow" | "shadows" | "shadowType" | "spacing" | "spacings" | "stepsTimingFunction" | "textAlignHorizontal" | "textAlignVertical" | "textDecoration" | "textStyle" | "textTransform" | "transition" | "vector" | "vectors" | "vectorFormat" | "zIndex", unknown, string>[]; getGroupChildrenOf(path: TreePath, depth?: number, options?: ViewSelectorOptions): GroupState[]; getCollectionChildrenOf(path: TreePath, depth?: number, options?: ViewSelectorOptions): CollectionState[]; getChildrenOf(path: TreePath, depth?: number, options?: ViewSelectorOptions): Array; getParentsOf(path: TreePath, depth?: number, options?: ViewSelectorOptions): Array; getGroupChildren(options?: ViewSelectorOptions): GroupState[]; getTokenChildren(options?: ViewSelectorOptions): TokenState<"string" | "number" | "boolean" | "object" | "null" | "array" | "integerNumber" | "zeroToOneNumber" | "arcDegreeNumber" | "rgbColorNumber" | "positiveNumber" | "positiveIntegerNumber" | "percentageNumber" | "hexadecimalColorString" | "bitmap" | "bitmaps" | "bitmapFormat" | "blur" | "border" | "borderStyle" | "borderStyleLineCap" | "breakpoint" | "color" | "cubicBezier" | "dimension" | "dimensionUnit" | "duration" | "durationUnit" | "font" | "fontFamily" | "fontFeature" | "fontFeatures" | "fontFormat" | "fontStyle" | "fontWeight" | "gradient" | "gradients" | "opacity" | "radius" | "radii" | "shadow" | "shadows" | "shadowType" | "spacing" | "spacings" | "stepsTimingFunction" | "textAlignHorizontal" | "textAlignVertical" | "textDecoration" | "textStyle" | "textTransform" | "transition" | "vector" | "vectors" | "vectorFormat" | "zIndex", unknown, string>[]; getCollectionChildren(options?: ViewSelectorOptions): CollectionState[]; clone(): TreeState; populateJSONChildrenOf(path: TreePath, accumulator: JSONObject, renderOptions?: GetJSONTokenValueOptions): void; renderJSONTree(renderOptions?: GetJSONTokenValueOptions): SpecifyDesignTokenFormat; exportMetadata(): SDTFEngineSerializedMetadata; exportAll(): SDTFEngineSerializedState; toJSON(): SpecifyDesignTokenFormat; }