@carbonenginejs/runtime 0.1.0-alpha.1 → 0.1.0-alpha.2
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/global/schema/CjsSchema.js +20 -2
- package/dist/global/schema/CjsSchema.js.map +1 -1
- package/dist/global/schema/hydration.js +14 -0
- package/dist/global/schema/hydration.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +17 -5
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +12 -3
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/docs/resource/formats/webgpu/reference/wgsl-compatibility.md +54 -85
- package/docs/trinityal/reference/classes/dropped.md +11 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultValueForCarbonField, coerceCarbonMathInto, coerceCarbonTypedArrayInto, normalizeCarbonValue, exportCarbonValue } from './types/carbonTypes.js';
|
|
1
|
+
import { defaultValueForCarbonField, coerceCarbonMathInto, coerceCarbonTypedArrayInto, cloneCarbonValue, normalizeCarbonValue, exportCarbonValue } from './types/carbonTypes.js';
|
|
2
2
|
import { composeNotifyDecorator } from '../compose/notify.js';
|
|
3
3
|
import { cast, composeInterfaceDecorator } from '../compose/interface.js';
|
|
4
4
|
import { createValuesTransport, composeValuesDecorator } from '../compose/values.js';
|
|
@@ -372,7 +372,18 @@ class CjsSchema {
|
|
|
372
372
|
static #statelessTransport = createValuesTransport({
|
|
373
373
|
GetFields: Constructor => getEffectiveFields(Constructor),
|
|
374
374
|
Export: (value, field, options) => exportCarbonValue(value, field.type),
|
|
375
|
-
|
|
375
|
+
// A live instance of a registered class is ALIASED, never copied - the
|
|
376
|
+
// rule the model path applies through its brand (CjsModel.js, the
|
|
377
|
+
// isModelInstance early return). A class off the base carries no brand,
|
|
378
|
+
// so without this a reference field would receive a plain-object copy
|
|
379
|
+
// and shared identity across the graph would silently split.
|
|
380
|
+
Import: (value, field) => {
|
|
381
|
+
if (isLiveSchemaInstance(value)) return value;
|
|
382
|
+
if (Array.isArray(value) && value.some(isLiveSchemaInstance)) {
|
|
383
|
+
return value.map(item => isLiveSchemaInstance(item) ? item : cloneCarbonValue(item));
|
|
384
|
+
}
|
|
385
|
+
return normalizeCarbonValue(value, field.type);
|
|
386
|
+
},
|
|
376
387
|
CoerceInto: (current, incoming, field) => coerceCarbonMathInto(current, incoming, field.type) ?? coerceCarbonTypedArrayInto(current, incoming, field.type),
|
|
377
388
|
IsEquivalent: (a, b) => a === b
|
|
378
389
|
});
|
|
@@ -1213,6 +1224,13 @@ function defineHiddenInheritedFields(Constructor, fieldNames) {
|
|
|
1213
1224
|
schema.hiddenInherited.add(fieldName);
|
|
1214
1225
|
}
|
|
1215
1226
|
}
|
|
1227
|
+
|
|
1228
|
+
// A live instance of a registered class, from this copy or a sibling one -
|
|
1229
|
+
// getClassName reads the cross-copy stamp. Plain bags, arrays, typed arrays
|
|
1230
|
+
// and the reader's `{ _sourceClassName }` carriers all answer false.
|
|
1231
|
+
function isLiveSchemaInstance(value) {
|
|
1232
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && !ArrayBuffer.isView(value) && CjsSchema.getClassName(value.constructor) !== null;
|
|
1233
|
+
}
|
|
1216
1234
|
function getEffectiveFields(Constructor) {
|
|
1217
1235
|
const ordered = [];
|
|
1218
1236
|
const byName = new Map();
|