import { CollabTimestamp, CollabTimestampSet } from '../collab/primitives'; import { Property, PropertySet } from './property'; /** * A set of values corresponding to a set of properties. * @public * @see PropertySet */ export declare class ValueSet { #private; rootElement: { [key: string]: unknown; }; propertySet: PropertySet; displayedProperties: Property[]; hiddenProperties: Property[]; constructor(propertySet: PropertySet, rootElement: unknown); /** * Gets the value of the root element attribute under the given keys. * If given an array of keys, the value is found under repeated lookups to enable obtaining nested values. * @public * @param rootAttribute A key or array of keys to look up in the root element. * @returns The value if it could be found, `undefined` if nothing could be found. */ getRootElementValue(rootAttribute: string[] | string | null): unknown; /** * Sets the value of the root element's attribute under the given keys. * If given an array of keys, the value is found under repeated lookups to enable setting nested values. * If the root element has a function `updateInView()`, it is called upon successful setting of the value. * If the root element's attribute doesn't exist, it does nothing. * @private * @param rootAttribute A key or array of keys to look up in the root element. * @param value The value to set the root element's attribute to. */ setRootElementValue(rootAttribute: string[] | string | null, value: unknown): void; /** * Obtains the value under the given key. * @private * @param key A key. * @returns The value under the given key. */ getValue(key: string): any; /** * Obtains all the values in the set. * @private * @returns An object containing all the values in the set. */ getValues(): { [key: string]: unknown; }; /** * Returns the values for all keys present in the given object, including keys in sub-objects. * @private * @param values An object containing all values for keys present in the given object. */ getValuesForKeys(keys: { [key: string]: unknown; }): { [key: string]: unknown; }; /** * Obtains all CollabTimestamps in the set, including those corresponding to nested keys. * @private * @returns An object containing all the CollabTimestamps in the set. */ getTimestamps(): CollabTimestampSet; /** * Checks if the value under the key is not empty. * @private * @param key A key. * @returns `true` if the value under the key is empty, `false` otherwise. */ hasValue(key: string): boolean; /** * Checks if the value under the key is not empty or the default value. * @private * @param key A key. * @returns `true` if the value under the key is not empty or the default value, `false` otherwise. */ hasSetValue(key: string): boolean; /** * Checks if any of the values in the set are not empty or the default value. * @private * @returns `true` if any of the values in the set are not empty or the default value, `false` otherwise. */ hasAnySetValue(): boolean; /** * Sets the value under the given key. * @private * @param key A key. * @param value A value. */ setValue(key: string, value: unknown): void; /** * Resets all values and then set them to the given values. * @private * @param values An object containing all values to set the values to. */ setValues(values: { [key: string]: unknown; }): void; /** * Resets all timestamps and then set them to the given timestamps. * @private * @param values An object containing all the CollabTimestamps in the set. */ setTimestamps(timestamps: CollabTimestampSet): void; /** * Writes the given values over the value set's existing values without resetting the existing values. * @private * @param values An object containing all values to set the values to. */ overwriteValues(values: { [key: string]: unknown; }): void; /** * Variant of `overwriteValues` that applies last-writer-wins to each key, updating timestamps if appropriate. * @private * @param values An object containing all values to set the values to. */ overwriteValuesLww(values: { [key: string]: unknown; }, timestamp: CollabTimestamp): void; /** * Sets all the values of this set to the defaults. * If this set has a root element and any of its properties have root attributes, the root element's attributes are also set to the property's default value if one is provided. * @private */ resetValues(): void; /** * Gets the ValueSet under the given key when there are nested ValueSets. * @private * @param key A key. * @returns A ValueSet. */ getSubValueSet(key: string): ValueSet; /** * Moves the given property to the list of displayed properties. * @private * @param property A property. */ displayProperty(property: Property): void; /** * Moves the given property to the list of hidden properties. * @private * @param property A property. */ hideProperty(property: Property): void; }