Skip to content

@web-engine-dev/resources


@web-engine-dev/resources / ResourceFieldDescriptor

Interface: ResourceFieldDescriptor

Describes one serializable field of a scene resource.

This is the core metadata unit: it tells the serializer how to delta-encode/decode the field, and tells the editor how to render it.

Remarks

All properties are readonly to prevent accidental mutation of schema definitions at runtime. Schema objects should be defined once (typically at module load time) and treated as immutable configuration.

Properties

assetType?

readonly optional assetType: string

Asset type filter for 'asset-ref' fields (e.g. 'texture', 'mesh').


category?

readonly optional category: string

Logical category for grouping fields in the editor UI.


default

readonly default: unknown

The default value for this field.

Used by delta-encoding: fields matching their default are omitted from the serialized output. Must be a JSON-serializable value. Array and object defaults are deep-cloned when constructing default objects.


label?

readonly optional label: string

Display label for the editor. Falls back to the field key if omitted.


max?

readonly optional max: number

Maximum value (for 'number' fields).


min?

readonly optional min: number

Minimum value (for 'number' fields).


options?

readonly optional options: readonly object[]

Option entries for 'enum' fields.

Each entry is a { value, label } pair where value is the serialized string and label is the display text (or i18n key).


order?

readonly optional order: number

Display order within the category.

Lower numbers appear first. Fields without an explicit order are sorted after those with one, in definition order.


step?

readonly optional step: number

Step increment (for 'number' and 'slider' fields).


tooltip?

readonly optional tooltip: string

Tooltip shown on hover in the editor.


type

readonly type: ResourceFieldType

The serializable type of this field.


visibleWhen?

readonly optional visibleWhen: FieldVisibilityPredicate

Conditional visibility predicate.


widget?

readonly optional widget: string

Explicit editor widget override (e.g. 'slider', 'color-picker').

Proprietary software. All rights reserved.