Skip to content

Commit e60bba5

Browse files
committed
feat: migrate from experimental decorators to TC39 Stage 3 decorators
1 parent 74c5d70 commit e60bba5

60 files changed

Lines changed: 25282 additions & 25277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/dev/core/src/BakedVertexAnimation/bakedVertexAnimationManager.ts

Lines changed: 207 additions & 207 deletions
Large diffs are not rendered by default.

packages/dev/core/src/Decorators/nodeDecorator.ts

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,50 @@ export function editableInPropertyPage(
107107
groupName: string = "PROPERTIES",
108108
options?: IEditablePropertyOption
109109
) {
110-
return (target: any, propertyKey: string) => {
111-
let propStore: IPropertyDescriptionForEdition[] = target._propStore;
112-
if (!propStore) {
110+
return (_value: unknown, context: { name: string | symbol; metadata: DecoratorMetadataObject }) => {
111+
const meta = context.metadata;
112+
let propStore: IPropertyDescriptionForEdition[];
113+
if (Object.hasOwn(meta, __bjsPropStoreKey)) {
114+
propStore = meta[__bjsPropStoreKey] as IPropertyDescriptionForEdition[];
115+
} else {
113116
propStore = [];
114-
target._propStore = propStore;
117+
meta[__bjsPropStoreKey] = propStore;
115118
}
116119
propStore.push({
117-
propertyName: propertyKey,
120+
propertyName: String(context.name),
118121
displayName: displayName,
119122
type: propertyType,
120123
groupName: groupName,
121124
options: options ?? {},
122-
className: target.getClassName(),
125+
className: "",
123126
});
124127
};
125128
}
129+
130+
/** @internal */
131+
export const __bjsPropStoreKey = "__bjs_prop_store__";
132+
133+
/**
134+
* Gets the editable properties for a given target using TC39 decorator metadata.
135+
* Walks the metadata prototype chain to include properties from parent classes.
136+
* @param target - the target object (instance or constructor)
137+
* @returns array of property descriptions
138+
*/
139+
export function getEditableProperties(target: any): IPropertyDescriptionForEdition[] {
140+
const ctor = typeof target === "function" ? target : target?.constructor;
141+
const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata];
142+
if (!metadata) {
143+
return [];
144+
}
145+
146+
const result: IPropertyDescriptionForEdition[] = [];
147+
let currentMeta: any = metadata;
148+
while (currentMeta) {
149+
if (Object.hasOwn(currentMeta, __bjsPropStoreKey)) {
150+
const store = currentMeta[__bjsPropStoreKey] as IPropertyDescriptionForEdition[];
151+
result.push(...store);
152+
}
153+
currentMeta = Object.getPrototypeOf(currentMeta);
154+
}
155+
return result;
156+
}

0 commit comments

Comments
 (0)