@galacean/engine-core 0.0.0-experimental-2.0-migrate.3 → 0.0.0-experimental-2.0-migrate.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -131,6 +131,12 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
131
131
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
132
132
  };
133
133
 
134
+ function _type_of(obj) {
135
+ "@swc/helpers - typeof";
136
+
137
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
138
+ }
139
+
134
140
  /**
135
141
  * How a field is cloned when a clone decorator overrides the built-in default for its type.
136
142
  */ var CloneMode = /*#__PURE__*/ function(CloneMode) {
@@ -144,24 +150,30 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
144
150
  return CloneMode;
145
151
  }({});
146
152
 
147
- /**
148
- * Property decorator — deep clone this field's whole subtree, overriding the value type's default
149
- * clone mode (field-level decorators have the highest priority). The deep intent carries into the
150
- * field's members; engine-bound members keep their defaults (assets share, entity refs remap).
151
- * A decorator is an explicit intent: if the decorated value itself can't be deep cloned (an
152
- * entity reference, an asset, or a function), cloning throws rather than silently falling back.
153
- */ function deepClone(target, propertyKey) {
154
- CloneManager._registerFieldMode(target, propertyKey, CloneMode.Deep);
153
+ function _isStage3DecoratorContext(value) {
154
+ return !!value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && "kind" in value && "addInitializer" in value;
155
155
  }
156
- /**
157
- * Property decorator — assign (share the reference) this field, overriding the value type's default clone mode.
158
- */ function assignmentClone(target, propertyKey) {
159
- CloneManager._registerFieldMode(target, propertyKey, CloneMode.Assignment);
156
+ function _registerDecoratorFieldMode(targetOrValue, propertyKeyOrContext, mode) {
157
+ if (_isStage3DecoratorContext(propertyKeyOrContext)) {
158
+ // Clone traversal only observes own enumerable fields. A Stage-3 method or
159
+ // accessor decorator therefore has no clone-mode effect, matching the
160
+ // legacy behavior without trying to infer an instance target.
161
+ if (propertyKeyOrContext.kind !== "field") return;
162
+ propertyKeyOrContext.addInitializer(function() {
163
+ CloneManager._registerFieldMode(this, propertyKeyOrContext.name, mode);
164
+ });
165
+ return;
166
+ }
167
+ CloneManager._registerFieldMode(targetOrValue, propertyKeyOrContext, mode);
160
168
  }
161
- /**
162
- * Property decorator — ignore this field when cloning; keep the clone's own constructor-built value.
163
- */ function ignoreClone(target, propertyKey) {
164
- CloneManager._registerFieldMode(target, propertyKey, CloneMode.Ignore);
169
+ function deepClone(targetOrValue, propertyKeyOrContext) {
170
+ _registerDecoratorFieldMode(targetOrValue, propertyKeyOrContext, CloneMode.Deep);
171
+ }
172
+ function assignmentClone(targetOrValue, propertyKeyOrContext) {
173
+ _registerDecoratorFieldMode(targetOrValue, propertyKeyOrContext, CloneMode.Assignment);
174
+ }
175
+ function ignoreClone(targetOrValue, propertyKeyOrContext) {
176
+ _registerDecoratorFieldMode(targetOrValue, propertyKeyOrContext, CloneMode.Ignore);
165
177
  }
166
178
  /**
167
179
  * @internal
@@ -6319,12 +6331,6 @@ __decorate([
6319
6331
  return SpriteMaskLayer;
6320
6332
  }({});
6321
6333
 
6322
- function _type_of(obj) {
6323
- "@swc/helpers - typeof";
6324
-
6325
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
6326
- }
6327
-
6328
6334
  function _array_like_to_array(arr, len) {
6329
6335
  if (len == null || len > arr.length) len = arr.length;
6330
6336