/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Model } from "#models/index.js"; import { FieldSemantics } from "./FieldSemantics.js"; import { Semantics } from "./Semantics.js"; /** * Matter semantic metadata attached to a class via decorators. * * We use decorators to allow for definition of model elements in the context of a specific type. * * Currently there are JavaScript/TypeScript limitations to be aware of when decorating type definitions: * * * Decorators may only be applied to JavaScript classes. So if you want to define an interface without * implementation, you must implement as a class and use as an interface. That's why this is "class" metadata. * * * Decorators may not affect the TypeScript type of an object. This means that you must define both the Matter type * (e.g. {@link uint32}) and TypeScript type (e.g. `number`). */ export declare class ClassSemantics extends Semantics { #private; /** * The model that represents the semantics for this class. * * This may be {@link localModel} or {@link prototypeBaseModel} */ get semanticModel(): Model> | undefined; /** * Get the class constructor */ get new(): ClassSemantics.Constructor | undefined; /** * Assign the constructor for the class. */ set new(fn: ClassSemantics.Constructor); /** * The class {@link Model} inherited from {@link new}'s prototype chain, if any. */ get prototypeBaseModel(): Model | undefined; /** * Obtain a {@link FieldSemantics} for the named field. */ fieldFor(name: string | symbol): FieldSemantics; /** * Add logical fields for unrecognized members of an object. * * This extends the model with untyped fields for properties that are not otherwise typed. */ defineUnknownMembers(instance: unknown): void; /** * Obtain the {@link ClassSemantics} for {@link source}. */ static of(source: ClassSemantics.Source): ClassSemantics; /** * Determine {@link new} has semantic decoration. */ static hasOwnSemantics(source: ClassSemantics.Constructor): boolean; /** * Access the {@link ClassSemantics} of {@link new} if it is defined. */ static maybeOf(source: ClassSemantics.Constructor): ClassSemantics | undefined; finalize(): void; protected integrateModel(model: Model): Model>; protected createModel(type?: Model.ConcreteType): Model>; get owner(): this; } export declare namespace ClassSemantics { /** * A standard constructor with an optional decoration extension point. */ interface Constructor extends NewableFunction { /** * If present, invoked for custom decoration after installing constructor. */ [extend]?: (semantics: ClassSemantics) => void; } /** * An object for which you may obtain {@link ClassSemantics}. */ type Source = Constructor | DecoratorContext | ClassSemantics; const extend: unique symbol; } //# sourceMappingURL=ClassSemantics.d.ts.map