@carbonenginejs/runtime-utils 0.1.1 → 0.1.3
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/LICENSE +21 -21
- package/NOTICE +23 -23
- package/README.md +69 -69
- package/THIRD-PARTY-NOTICES.md +64 -64
- package/docs/README.md +74 -73
- package/docs/architecture.md +101 -101
- package/docs/concepts/foundation-consolidation.md +85 -85
- package/docs/concepts/model-lifecycle.md +111 -0
- package/docs/const-kb.md +85 -87
- package/docs/core-types/DECORATOR-TODOS.md +25 -25
- package/docs/core-types/README.md +229 -168
- package/docs/reference/api.md +105 -102
- package/docs/reference/classes/README.md +135 -135
- package/package.json +139 -139
- package/src/arrays.js +5 -5
- package/src/audio/audioFormats.js +34 -34
- package/src/audio/index.js +1 -1
- package/src/box3.js +331 -331
- package/src/bytes.js +56 -56
- package/src/compression.js +56 -56
- package/src/constants/index.js +7 -7
- package/src/constants/trinity.js +13 -13
- package/src/constants.js +15 -15
- package/src/curve.js +79 -79
- package/src/d3d/dxgiFormats.js +46 -46
- package/src/d3d/index.js +2 -2
- package/src/d3d/primitiveTopology.js +11 -11
- package/src/document/CjsCarbonDocument.js +212 -212
- package/src/document/CjsClassRegistry.js +373 -373
- package/src/document/CjsDocumentDehydrator.js +142 -142
- package/src/document/CjsDocumentHydrator.js +156 -156
- package/src/document/CjsStructRegistry.js +348 -348
- package/src/document/hydrationAdapter.js +129 -129
- package/src/document/index.js +6 -6
- package/src/errors/CjsError.js +286 -286
- package/src/errors/index.js +5 -5
- package/src/geometry/box.js +22 -22
- package/src/geometry/cylinder.js +22 -22
- package/src/geometry/helpers/earcut.js +1 -1
- package/src/geometry/helpers/misc.js +3 -3
- package/src/geometry/index.js +8 -8
- package/src/geometry/json.js +67 -67
- package/src/geometry/lathe.js +44 -44
- package/src/geometry/plane.js +14 -14
- package/src/geometry/shape.js +4 -4
- package/src/geometry/sphere.js +24 -24
- package/src/geometry/torus.js +14 -14
- package/src/graphics/colorSpaces.js +22 -22
- package/src/graphics/index.js +4 -4
- package/src/graphics/pixelFormats.js +158 -158
- package/src/graphics/textureDimensions.js +22 -22
- package/src/graphics/trinityEnums.js +87 -87
- package/src/index.js +62 -62
- package/src/is.js +108 -46
- package/src/json.js +23 -23
- package/src/lifecycle/CjsLifecycleState.js +77 -77
- package/src/lifecycle/index.js +1 -1
- package/src/lne3.js +70 -70
- package/src/lookup.js +48 -48
- package/src/mat3.js +51 -51
- package/src/mat4.js +699 -699
- package/src/math/index.js +25 -25
- package/src/math/scalar.js +63 -63
- package/src/media/index.js +1 -1
- package/src/media/mediaTypes.js +50 -50
- package/src/mesh.js +424 -424
- package/src/model/CjsEventEmitter.js +333 -333
- package/src/model/CjsModel.js +1589 -1544
- package/src/model/CjsModelState.js +72 -72
- package/src/model/index.js +4 -4
- package/src/model/sourceRecordUtils.js +54 -54
- package/src/noise.js +310 -310
- package/src/num.js +827 -827
- package/src/object.js +39 -39
- package/src/path.js +53 -53
- package/src/pln.js +125 -125
- package/src/pool.js +9 -9
- package/src/quat.js +144 -144
- package/src/ray3.js +188 -188
- package/src/renderContext/formats.js +145 -145
- package/src/renderContext/index.js +5 -5
- package/src/renderContext/presentation.js +125 -125
- package/src/renderContext/resources.js +27 -27
- package/src/renderContext/upscaling.js +22 -22
- package/src/renderContext/window.js +20 -20
- package/src/runtime/CjsRuntimeState.js +50 -50
- package/src/schema/CjsSchema.js +555 -318
- package/src/schema/index.js +4 -4
- package/src/shader/index.js +1 -1
- package/src/shader/shaderStages.js +37 -37
- package/src/sph3.js +181 -181
- package/src/tangent.js +288 -288
- package/src/text.js +40 -40
- package/src/tri3.js +98 -98
- package/src/types/carbonTypes.js +635 -635
- package/src/types/index.js +2 -2
- package/src/utils.js +58 -58
- package/src/validation.js +46 -46
- package/src/vec2.js +229 -229
- package/src/vec3.js +1188 -1172
- package/src/vec4.js +347 -347
- package/src/vertex.js +108 -108
- package/src/webgpu/index.js +1 -1
- package/src/webgpu/textureFormats.js +121 -121
|
@@ -1,203 +1,264 @@
|
|
|
1
|
-
# @carbonenginejs/runtime-utils
|
|
2
|
-
|
|
3
|
-
Status: Evolving
|
|
4
|
-
Scope: `@carbonenginejs/runtime-utils` Carbon type and model families
|
|
5
|
-
Audience: Runtime authors and integrators
|
|
6
|
-
Summary: Explains Carbon type descriptors, schemas, models, lifecycle state, documents, and hydration.
|
|
7
|
-
|
|
8
|
-
Shared CarbonEngineJS type, schema, document, hydration, and runtime model
|
|
9
|
-
helpers.
|
|
10
|
-
|
|
11
|
-
This package is the common contract for packages that read, write, or generate
|
|
12
|
-
CarbonEngineJS data. Format packages can stop at plain JSON or a neutral
|
|
13
|
-
`CjsCarbonDocument`; runtime packages can opt into registered classes and
|
|
14
|
-
`CjsModel` when they want live objects.
|
|
15
|
-
|
|
16
|
-
## Install
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
npm install @carbonenginejs/runtime-utils
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## What It Owns
|
|
23
|
-
|
|
24
|
-
- `document`: neutral `CjsCarbonDocument`, class/struct registries, hydration,
|
|
25
|
-
and dehydration.
|
|
26
|
-
- `hydration`: adapter seam for construction, value application, and finalize
|
|
27
|
-
behavior.
|
|
28
|
-
- `schema`: decorators, class/field/method metadata, the direct
|
|
29
|
-
name-to-constructor map, enum registration, Carbon-method provenance, and
|
|
30
|
-
component metadata helpers.
|
|
31
|
-
- `types`: Carbon type descriptors, defaults, coercion, cloning, and export
|
|
32
|
-
helpers.
|
|
33
|
-
- `model`: `CjsModel`, `CjsEventEmitter`, model dirty state, traversal helpers,
|
|
34
|
-
and source-record utilities.
|
|
35
|
-
|
|
36
|
-
Generated enums and generated class catalogs should live in schema or generated
|
|
37
|
-
runtime packages, not in this foundational package.
|
|
38
|
-
|
|
39
|
-
## Hydration Contract
|
|
40
|
-
|
|
41
|
-
`runtime-utils` does not impose a runtime lifecycle on callers. The hydrator only
|
|
42
|
-
guarantees ordering:
|
|
43
|
-
|
|
44
|
-
1. `construct`
|
|
45
|
-
2. `applyValues`
|
|
46
|
-
3. `finalize`
|
|
47
|
-
|
|
48
|
-
The default behavior is intentionally minimal: construction through
|
|
49
|
-
`CjsSchema.GetConstructor(name)`, `Object.assign` for values, and no finalize
|
|
50
|
-
step. Callers opt into stricter population rules by supplying an adapter.
|
|
51
|
-
|
|
52
|
-
Use `createLifecycleAdapter()` when your runtime classes follow a
|
|
53
|
-
`SetValues`-style contract. `Initialize` is optional; disable it explicitly
|
|
54
|
-
when a project only wants `SetValues`.
|
|
55
|
-
|
|
56
|
-
## Usage
|
|
57
|
-
|
|
58
|
-
### Hydrate a neutral document into runtime classes
|
|
59
|
-
|
|
60
|
-
```js
|
|
61
|
-
import {
|
|
62
|
-
CjsCarbonDocument,
|
|
63
|
-
CjsClassRegistry,
|
|
64
|
-
CjsDocumentHydrator
|
|
65
|
-
} from "@carbonenginejs/runtime-utils/document";
|
|
66
|
-
import { createLifecycleAdapter } from "@carbonenginejs/runtime-utils/hydration";
|
|
67
|
-
import { CjsModel } from "@carbonenginejs/runtime-utils/model";
|
|
68
|
-
import { CjsSchema } from "@carbonenginejs/runtime-utils/schema";
|
|
69
|
-
|
|
70
|
-
class DemoNode extends CjsModel
|
|
71
|
-
{
|
|
72
|
-
position = [0, 0, 0];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
CjsSchema.define(DemoNode, {
|
|
76
|
-
className: "DemoNode",
|
|
77
|
-
alias: "LegacyDemoNode",
|
|
78
|
-
fields: [{
|
|
79
|
-
name: "position",
|
|
80
|
-
type: { kind: "vec3" },
|
|
81
|
-
io: {
|
|
82
|
-
read: true,
|
|
83
|
-
write: true,
|
|
84
|
-
persist: true,
|
|
85
|
-
notify: true
|
|
86
|
-
}
|
|
87
|
-
}]
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const document = CjsCarbonDocument.create({
|
|
91
|
-
format: "example",
|
|
92
|
-
roots: [{ ref: { $ref: 1 } }],
|
|
93
|
-
nodes: [{
|
|
94
|
-
id: 1,
|
|
95
|
-
kind: "DemoNode",
|
|
96
|
-
fields: { position: [1, 2, 3] }
|
|
97
|
-
}]
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const registry = CjsClassRegistry.fromMaps({
|
|
101
|
-
constructors: { DemoNode }
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const adapter = createLifecycleAdapter({ initialize: false });
|
|
105
|
-
const { root } = CjsDocumentHydrator.hydrate(document, { registry, adapter });
|
|
106
|
-
```
|
|
107
|
-
|
|
1
|
+
# @carbonenginejs/runtime-utils
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-utils` Carbon type and model families
|
|
5
|
+
Audience: Runtime authors and integrators
|
|
6
|
+
Summary: Explains Carbon type descriptors, schemas, models, lifecycle state, documents, and hydration.
|
|
7
|
+
|
|
8
|
+
Shared CarbonEngineJS type, schema, document, hydration, and runtime model
|
|
9
|
+
helpers.
|
|
10
|
+
|
|
11
|
+
This package is the common contract for packages that read, write, or generate
|
|
12
|
+
CarbonEngineJS data. Format packages can stop at plain JSON or a neutral
|
|
13
|
+
`CjsCarbonDocument`; runtime packages can opt into registered classes and
|
|
14
|
+
`CjsModel` when they want live objects.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install @carbonenginejs/runtime-utils
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What It Owns
|
|
23
|
+
|
|
24
|
+
- `document`: neutral `CjsCarbonDocument`, class/struct registries, hydration,
|
|
25
|
+
and dehydration.
|
|
26
|
+
- `hydration`: adapter seam for construction, value application, and finalize
|
|
27
|
+
behavior.
|
|
28
|
+
- `schema`: decorators, class/field/method metadata, the direct
|
|
29
|
+
name-to-constructor map, enum registration, Carbon-method provenance, and
|
|
30
|
+
component metadata helpers.
|
|
31
|
+
- `types`: Carbon type descriptors, defaults, coercion, cloning, and export
|
|
32
|
+
helpers.
|
|
33
|
+
- `model`: `CjsModel`, `CjsEventEmitter`, model dirty state, traversal helpers,
|
|
34
|
+
and source-record utilities.
|
|
35
|
+
|
|
36
|
+
Generated enums and generated class catalogs should live in schema or generated
|
|
37
|
+
runtime packages, not in this foundational package.
|
|
38
|
+
|
|
39
|
+
## Hydration Contract
|
|
40
|
+
|
|
41
|
+
`runtime-utils` does not impose a runtime lifecycle on callers. The hydrator only
|
|
42
|
+
guarantees ordering:
|
|
43
|
+
|
|
44
|
+
1. `construct`
|
|
45
|
+
2. `applyValues`
|
|
46
|
+
3. `finalize`
|
|
47
|
+
|
|
48
|
+
The default behavior is intentionally minimal: construction through
|
|
49
|
+
`CjsSchema.GetConstructor(name)`, `Object.assign` for values, and no finalize
|
|
50
|
+
step. Callers opt into stricter population rules by supplying an adapter.
|
|
51
|
+
|
|
52
|
+
Use `createLifecycleAdapter()` when your runtime classes follow a
|
|
53
|
+
`SetValues`-style contract. `Initialize` is optional; disable it explicitly
|
|
54
|
+
when a project only wants `SetValues`.
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
### Hydrate a neutral document into runtime classes
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
import {
|
|
62
|
+
CjsCarbonDocument,
|
|
63
|
+
CjsClassRegistry,
|
|
64
|
+
CjsDocumentHydrator
|
|
65
|
+
} from "@carbonenginejs/runtime-utils/document";
|
|
66
|
+
import { createLifecycleAdapter } from "@carbonenginejs/runtime-utils/hydration";
|
|
67
|
+
import { CjsModel } from "@carbonenginejs/runtime-utils/model";
|
|
68
|
+
import { CjsSchema } from "@carbonenginejs/runtime-utils/schema";
|
|
69
|
+
|
|
70
|
+
class DemoNode extends CjsModel
|
|
71
|
+
{
|
|
72
|
+
position = [0, 0, 0];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
CjsSchema.define(DemoNode, {
|
|
76
|
+
className: "DemoNode",
|
|
77
|
+
alias: "LegacyDemoNode",
|
|
78
|
+
fields: [{
|
|
79
|
+
name: "position",
|
|
80
|
+
type: { kind: "vec3" },
|
|
81
|
+
io: {
|
|
82
|
+
read: true,
|
|
83
|
+
write: true,
|
|
84
|
+
persist: true,
|
|
85
|
+
notify: true
|
|
86
|
+
}
|
|
87
|
+
}]
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const document = CjsCarbonDocument.create({
|
|
91
|
+
format: "example",
|
|
92
|
+
roots: [{ ref: { $ref: 1 } }],
|
|
93
|
+
nodes: [{
|
|
94
|
+
id: 1,
|
|
95
|
+
kind: "DemoNode",
|
|
96
|
+
fields: { position: [1, 2, 3] }
|
|
97
|
+
}]
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const registry = CjsClassRegistry.fromMaps({
|
|
101
|
+
constructors: { DemoNode }
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const adapter = createLifecycleAdapter({ initialize: false });
|
|
105
|
+
const { root } = CjsDocumentHydrator.hydrate(document, { registry, adapter });
|
|
106
|
+
```
|
|
107
|
+
|
|
108
108
|
`CjsSchema` stores constructors in one direct name-to-constructor map.
|
|
109
109
|
`CjsSchema.define` registers the explicit `className` and each alias as keys;
|
|
110
110
|
manual code can use `CjsSchema.SetConstructor(name, Constructor)`. A supplied
|
|
111
111
|
scoped registry replaces the default constructor lookup and must implement
|
|
112
112
|
`GetConstructor(name)`.
|
|
113
113
|
|
|
114
|
-
###
|
|
114
|
+
### Decorators and imperative schema registration
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
The decorator namespaces and imperative methods write the same metadata.
|
|
117
|
+
Generated code and other tools may register a complete class with
|
|
118
|
+
`CjsSchema.define`, then add individual entries with `defineField`,
|
|
119
|
+
`defineMethod`, or `defineEnum`. They may instead apply the public decorators
|
|
120
|
+
through `decorateField` and `decorateMethod`; those helpers do not require
|
|
121
|
+
decorator syntax.
|
|
119
122
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
`defineEnum(values, definition)` registers a stable enum name and optional
|
|
124
|
+
member, source, family, and line metadata. Registration works for frozen enum
|
|
125
|
+
objects through the schema registry; extensible objects also receive the
|
|
126
|
+
exported `CJS_ENUM_NAME` symbol. A field decorated with `CjsSchema.enum(values)`
|
|
127
|
+
or an enum name resolves that registered identity lazily.
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
`type.rawStruct("NativeType")`; it records the canonical `rawStruct`
|
|
127
|
-
descriptor and keeps plain object values non-constructing.
|
|
129
|
+
Jessica metadata is editor-facing presentation metadata:
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
- `jessica.group(name)` groups a field in a compatible editor;
|
|
132
|
+
- `jessica.hidden` asks an editor not to present the field;
|
|
133
|
+
- `jessica.readOnly` asks an editor not to offer writes; and
|
|
134
|
+
- `jessica.widget(name)` suggests one editor control.
|
|
130
135
|
|
|
136
|
+
These declarations do not change runtime persistence, validation, or mutation.
|
|
137
|
+
In particular, `jessica.hidden` is not `schema.hideInherited`, and
|
|
138
|
+
`jessica.readOnly` does not block `SetValues`. A runtime restriction must be
|
|
139
|
+
implemented by the owning runtime contract rather than inferred from Jessica
|
|
140
|
+
metadata.
|
|
141
|
+
|
|
142
|
+
### Model references, value structs, and raw inline values
|
|
143
|
+
|
|
144
|
+
Use `type.model("ClassName")` for reference-shaped fields that hydrate through
|
|
145
|
+
the registered `CjsModel` constructor map. Legacy `type.objectRef` remains
|
|
146
|
+
supported while runtime packages migrate.
|
|
147
|
+
|
|
148
|
+
Use `type.struct("ClassName")` for a registered model with value semantics. If
|
|
149
|
+
the owner constructor installs a struct instance, `SetValues` populates that
|
|
150
|
+
instance in place instead of storing the incoming model by reference. This
|
|
151
|
+
keeps constructor-owned identity and mutable math buffers stable.
|
|
152
|
+
|
|
153
|
+
Opaque native payloads must not trigger model construction. Use
|
|
154
|
+
`type.rawStruct("NativeType")`; it records the canonical `rawStruct`
|
|
155
|
+
descriptor and keeps plain object values non-constructing.
|
|
156
|
+
|
|
157
|
+
### Work with schema-backed runtime models directly
|
|
158
|
+
|
|
131
159
|
```js
|
|
132
160
|
const node = DemoNode.from({ position: [1, 2, 3] });
|
|
133
161
|
|
|
134
162
|
node.OnEvent("modified", (_target, payload) => {
|
|
135
|
-
console.log(
|
|
163
|
+
console.log(payload.source);
|
|
136
164
|
});
|
|
137
165
|
|
|
138
|
-
node.SetValues({ position: [4, 5, 6] });
|
|
166
|
+
const changed = node.SetValues({ position: [4, 5, 6] });
|
|
167
|
+
console.log([...changed]);
|
|
139
168
|
node.Merge([{ position: [7, 8, 9] }, { position: [10, 11, 12] }]);
|
|
140
|
-
|
|
141
|
-
const copy = new DemoNode();
|
|
142
|
-
CjsModel.copy(copy, node, { markDirty: false });
|
|
143
|
-
const plain = node.GetValues();
|
|
144
|
-
```
|
|
145
|
-
|
|
169
|
+
|
|
170
|
+
const copy = new DemoNode();
|
|
171
|
+
CjsModel.copy(copy, node, { markDirty: false });
|
|
172
|
+
const plain = node.GetValues();
|
|
173
|
+
```
|
|
174
|
+
|
|
146
175
|
`CjsModel` is evented, tracks dirty/update state explicitly, and uses schema
|
|
147
176
|
metadata as its field contract. Every model class requires an explicit, stable
|
|
148
177
|
`CjsSchema` `className`; runtime type identity never falls back to
|
|
149
178
|
`Constructor.name`, which is not stable under minification.
|
|
150
179
|
|
|
151
|
-
|
|
152
|
-
|
|
180
|
+
The ordinary settled `modified` event contains `{ source }`. The changed field
|
|
181
|
+
names are returned by `SetValues`. A `properties` event field is reserved for
|
|
182
|
+
the direct `markDirty: false` notification path.
|
|
183
|
+
|
|
184
|
+
`Merge`/`merge` accept an ordered array of raw value bags or model instances,
|
|
185
|
+
deep-merge them, and apply the final bag through one `CjsModel.set` update cycle.
|
|
153
186
|
They return the same changed-set, boolean, or `false` result as `SetValues`.
|
|
154
187
|
`Copy`/`copy` instead require an instantiated
|
|
155
188
|
`CjsModel` source and forward the supplied `SetValues` options.
|
|
156
189
|
|
|
157
|
-
###
|
|
190
|
+
### Enum-backed fields
|
|
158
191
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
`schema.hideInherited()` decorator to remove named inherited fields from only
|
|
162
|
-
that class's schema surface:
|
|
192
|
+
Enum metadata resolves lazily from the concrete model constructor's PascalCase
|
|
193
|
+
static. Normal inherited-static lookup is supported.
|
|
163
194
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
Hides pass to descendants and may be extended by another
|
|
181
|
-
`schema.hideInherited()` decorator. There is deliberately no unhide operation.
|
|
182
|
-
Naming a field that the parent schema does not expose throws during class
|
|
183
|
-
registration.
|
|
195
|
+
Imports accept:
|
|
196
|
+
|
|
197
|
+
- declared member names;
|
|
198
|
+
- declared numeric values; and
|
|
199
|
+
- identity tuples.
|
|
200
|
+
|
|
201
|
+
The importer prevalidates the complete update before mutating the target.
|
|
202
|
+
Exports select one of:
|
|
203
|
+
|
|
204
|
+
- `enumFormat: "values"` for numeric values;
|
|
205
|
+
- `enumFormat: "names"` for member names; or
|
|
206
|
+
- `enumFormat: "identity"` for identity tuples.
|
|
207
|
+
|
|
208
|
+
When multiple names share one numeric value, name export uses the first
|
|
209
|
+
declared key. Schema export includes resolved enum identity and members.
|
|
184
210
|
|
|
211
|
+
A missing or unresolved enum static passes through without enum validation;
|
|
212
|
+
strict missing-static enforcement is not provided by this version.
|
|
213
|
+
|
|
214
|
+
### Hide inherited schema fields
|
|
215
|
+
|
|
216
|
+
Carbon Blue surfaces are defined per class, so a real JavaScript subclass may
|
|
217
|
+
persist fewer fields than its parent. Use the class-level
|
|
218
|
+
`schema.hideInherited()` decorator to remove named inherited fields from only
|
|
219
|
+
that class's schema surface:
|
|
220
|
+
|
|
221
|
+
```js
|
|
222
|
+
import { schema, type } from "@carbonenginejs/runtime-utils/schema";
|
|
223
|
+
|
|
224
|
+
@type.define({ className: "ExampleBucket", family: "example" })
|
|
225
|
+
@schema.hideInherited(["distribution", "descriptor", "offset"])
|
|
226
|
+
export class ExampleBucket extends ExamplePlacement
|
|
227
|
+
{
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Hidden fields are omitted from schema introspection, `GetValues`, document
|
|
232
|
+
dehydration, and every export option. `SetValues` and document hydration
|
|
233
|
+
silently ignore them, matching `SetValues`' existing unknown-field behavior.
|
|
234
|
+
The JavaScript properties, accessors, inheritance, and `instanceof` behavior
|
|
235
|
+
are unchanged.
|
|
236
|
+
|
|
237
|
+
Hides pass to descendants and may be extended by another
|
|
238
|
+
`schema.hideInherited()` decorator. There is deliberately no unhide operation.
|
|
239
|
+
Naming a field that the parent schema does not expose throws during class
|
|
240
|
+
registration.
|
|
241
|
+
|
|
185
242
|
Each model owns one non-enumerable `__state` object. Model-owned
|
|
186
|
-
`__state.dirty`
|
|
187
|
-
`__state.rebuild` is
|
|
243
|
+
`__state.dirty` is the generic settle marker; `__state.flags` contains
|
|
244
|
+
consumer-cleared lazy invalidations; `__state.rebuild` is a separate
|
|
245
|
+
consumer-cleared `Set` of deferred work; and
|
|
188
246
|
`__state.updating` plus `__state.suppressEvents` coordinate update processing.
|
|
189
|
-
The event emitter adds `__state.events` only while listeners exist. A lifecycle
|
|
190
|
-
manager may install `__state.lifecycle` with `initializeLifecycleState()`;
|
|
247
|
+
The event emitter adds `__state.events` only while listeners exist. A lifecycle
|
|
248
|
+
manager may install `__state.lifecycle` with `initializeLifecycleState()`;
|
|
191
249
|
without it, the object remains ordinarily alive and unmanaged. Dirty
|
|
192
250
|
consumption and clearing do not modify rebuild or lifecycle state.
|
|
193
251
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
import {
|
|
201
|
-
import {
|
|
202
|
-
import {
|
|
203
|
-
|
|
252
|
+
See [Model lifecycle](../concepts/model-lifecycle.md) for settlement,
|
|
253
|
+
initialization, traversal, resource, and optional lifecycle-state details.
|
|
254
|
+
|
|
255
|
+
## Subpaths
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
import { CjsCarbonDocument, CjsDocumentHydrator } from "@carbonenginejs/runtime-utils/document";
|
|
259
|
+
import { createLifecycleAdapter } from "@carbonenginejs/runtime-utils/hydration";
|
|
260
|
+
import { CjsLifecycleState } from "@carbonenginejs/runtime-utils/lifecycle";
|
|
261
|
+
import { CjsSchema, type, io, jessica, carbon, components } from "@carbonenginejs/runtime-utils/schema";
|
|
262
|
+
import { CjsModel, CjsEventEmitter, CjsModelState } from "@carbonenginejs/runtime-utils/model";
|
|
263
|
+
import { CARBON_TYPE, normalizeCarbonValue } from "@carbonenginejs/runtime-utils/types";
|
|
264
|
+
```
|