@carbonenginejs/runtime-utils 0.1.0
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 -0
- package/NOTICE +23 -0
- package/README.md +56 -0
- package/THIRD-PARTY-NOTICES.md +38 -0
- package/docs/README.md +81 -0
- package/docs/architecture.md +101 -0
- package/docs/concepts/foundation-consolidation.md +86 -0
- package/docs/const-kb.md +92 -0
- package/docs/core-types/DECORATOR-TODOS.md +25 -0
- package/docs/core-types/README.md +203 -0
- package/docs/reference/api.md +70 -0
- package/docs/reference/classes/README.md +115 -0
- package/package.json +132 -0
- package/src/arrays.js +5 -0
- package/src/audio/audioFormats.js +34 -0
- package/src/audio/index.js +1 -0
- package/src/box3.js +1385 -0
- package/src/bytes.js +56 -0
- package/src/compression.js +56 -0
- package/src/constants/index.js +6 -0
- package/src/constants.js +15 -0
- package/src/curve.js +419 -0
- package/src/d3d/dxgiFormats.js +46 -0
- package/src/d3d/index.js +2 -0
- package/src/d3d/primitiveTopology.js +11 -0
- package/src/document/CjsCarbonDocument.js +212 -0
- package/src/document/CjsClassRegistry.js +373 -0
- package/src/document/CjsDocumentDehydrator.js +142 -0
- package/src/document/CjsDocumentHydrator.js +156 -0
- package/src/document/CjsStructRegistry.js +348 -0
- package/src/document/hydrationAdapter.js +129 -0
- package/src/document/index.js +6 -0
- package/src/geometry/box.js +137 -0
- package/src/geometry/cylinder.js +244 -0
- package/src/geometry/helpers/LICENSE +15 -0
- package/src/geometry/helpers/earcut.js +766 -0
- package/src/geometry/helpers/misc.js +103 -0
- package/src/geometry/index.js +8 -0
- package/src/geometry/json.js +165 -0
- package/src/geometry/lathe.js +172 -0
- package/src/geometry/octahedron.js +0 -0
- package/src/geometry/plane.js +81 -0
- package/src/geometry/shape.js +95 -0
- package/src/geometry/sphere.js +123 -0
- package/src/geometry/torus.js +96 -0
- package/src/graphics/colorSpaces.js +22 -0
- package/src/graphics/index.js +4 -0
- package/src/graphics/pixelFormats.js +158 -0
- package/src/graphics/textureDimensions.js +22 -0
- package/src/graphics/trinityEnums.js +87 -0
- package/src/index.js +58 -0
- package/src/is.js +524 -0
- package/src/json.js +23 -0
- package/src/lifecycle/CjsLifecycleState.js +77 -0
- package/src/lifecycle/index.js +1 -0
- package/src/lne3.js +497 -0
- package/src/lookup.js +48 -0
- package/src/mat3.js +131 -0
- package/src/mat4.js +699 -0
- package/src/math/index.js +25 -0
- package/src/math/scalar.js +63 -0
- package/src/media/index.js +1 -0
- package/src/media/mediaTypes.js +50 -0
- package/src/mesh.js +394 -0
- package/src/model/CjsEventEmitter.js +333 -0
- package/src/model/CjsModel.js +1544 -0
- package/src/model/CjsModelState.js +72 -0
- package/src/model/index.js +4 -0
- package/src/model/sourceRecordUtils.js +54 -0
- package/src/noise.js +310 -0
- package/src/num.js +827 -0
- package/src/path.js +21 -0
- package/src/pln.js +762 -0
- package/src/pool.js +160 -0
- package/src/quat.js +144 -0
- package/src/ray3.js +1085 -0
- package/src/renderContext/formats.js +145 -0
- package/src/renderContext/index.js +5 -0
- package/src/renderContext/presentation.js +125 -0
- package/src/renderContext/resources.js +27 -0
- package/src/renderContext/upscaling.js +22 -0
- package/src/renderContext/window.js +20 -0
- package/src/runtime/CjsRuntimeState.js +50 -0
- package/src/schema/CjsSchema.js +1009 -0
- package/src/schema/index.js +17 -0
- package/src/shader/index.js +1 -0
- package/src/shader/shaderStages.js +37 -0
- package/src/sph3.js +754 -0
- package/src/tangent.js +288 -0
- package/src/text.js +40 -0
- package/src/tri3.js +650 -0
- package/src/types/carbonTypes.js +635 -0
- package/src/types/index.js +2 -0
- package/src/utils.js +58 -0
- package/src/validation.js +46 -0
- package/src/vec2.js +229 -0
- package/src/vec3.js +1172 -0
- package/src/vec4.js +347 -0
- package/src/vertex.js +108 -0
- package/src/webgpu/index.js +1 -0
- package/src/webgpu/textureFormats.js +121 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cppctamber / CarbonEngineJS contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
carbonenginejs/runtime-utils
|
|
2
|
+
============================
|
|
3
|
+
|
|
4
|
+
A browser-safe foundation package for CarbonEngineJS projects. It contains
|
|
5
|
+
neutral utilities; shared constant vocabularies; Carbon type, schema, model,
|
|
6
|
+
document, and lifecycle primitives; and standalone math containers originally
|
|
7
|
+
extracted from ccpwgl's `src/global/math` library.
|
|
8
|
+
|
|
9
|
+
CarbonEngine and Fenris Creations (CCP Games) are named here for provenance,
|
|
10
|
+
interoperability, and target-ecosystem context. This package contains no
|
|
11
|
+
CarbonEngine or Fenris Creations (CCP Games) source files, tooling, proprietary
|
|
12
|
+
documentation, shader source, or assets.
|
|
13
|
+
|
|
14
|
+
Packed tangent-frame behavior is based on observed Fenris Creations
|
|
15
|
+
(CCP Games) EVE/Carbon shader behavior and generated test vectors, not copied
|
|
16
|
+
shader source.
|
|
17
|
+
|
|
18
|
+
This package is not affiliated with or endorsed by CCP Games.
|
|
19
|
+
|
|
20
|
+
CarbonEngineJS-facing code is copyright cppctamber / CarbonEngineJS
|
|
21
|
+
contributors.
|
|
22
|
+
|
|
23
|
+
Repository license: MIT. See LICENSE and THIRD-PARTY-NOTICES.md.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @carbonenginejs/runtime-utils
|
|
2
|
+
|
|
3
|
+
Browser-safe foundations shared across CarbonEngineJS packages.
|
|
4
|
+
|
|
5
|
+
The package owns:
|
|
6
|
+
|
|
7
|
+
- neutral arrays, bytes, compression, JSON, lookup, paths, text, predicates,
|
|
8
|
+
and validation;
|
|
9
|
+
- scalar, vector, quaternion, matrix, geometry, mesh, tangent, curve, and
|
|
10
|
+
noise math;
|
|
11
|
+
- shared media, graphics, render-context, audio, shader, D3D, and WebGPU
|
|
12
|
+
constants;
|
|
13
|
+
- Carbon type descriptors, schema metadata, models, lifecycle state,
|
|
14
|
+
documents, hydration, and dehydration.
|
|
15
|
+
|
|
16
|
+
Browser clients remain in `@carbonenginejs/tools-browser`; Node automation
|
|
17
|
+
remains in `@carbonenginejs/tools-core`.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install @carbonenginejs/runtime-utils
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
Prefer direct subpaths so unrelated families are not initialized:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { normalizePath } from "@carbonenginejs/runtime-utils/path";
|
|
31
|
+
import { cross, normalize } from "@carbonenginejs/runtime-utils/vec3";
|
|
32
|
+
import { PixelFormat } from "@carbonenginejs/runtime-utils/graphics";
|
|
33
|
+
import { CjsSchema } from "@carbonenginejs/runtime-utils/schema";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Former core-math and runtime-const subpaths remain top-level, so migration is
|
|
37
|
+
a package-name replacement. Carbon type and model primitives are available
|
|
38
|
+
from `/types`, `/schema`, `/model`, `/document`, `/hydration`, and
|
|
39
|
+
`/lifecycle`.
|
|
40
|
+
|
|
41
|
+
The root export is intentionally limited to common neutral utilities, math,
|
|
42
|
+
and non-conflicting constants. Import Carbon type/model/document families from
|
|
43
|
+
their direct subpaths.
|
|
44
|
+
|
|
45
|
+
## Documentation
|
|
46
|
+
|
|
47
|
+
- [Package documentation](docs/README.md)
|
|
48
|
+
- [Architecture and admission rules](docs/architecture.md)
|
|
49
|
+
- [API reference](docs/reference/api.md)
|
|
50
|
+
- [Foundation consolidation](docs/concepts/foundation-consolidation.md)
|
|
51
|
+
- [Constant vocabulary notes](docs/const-kb.md)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT. See [LICENSE](LICENSE), [NOTICE](NOTICE), and
|
|
56
|
+
[THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
## gl-matrix
|
|
4
|
+
|
|
5
|
+
This package depends on `gl-matrix` and extends its vector, quaternion, and
|
|
6
|
+
matrix containers with CarbonEngineJS helpers.
|
|
7
|
+
|
|
8
|
+
- Project: <https://github.com/toji/gl-matrix>
|
|
9
|
+
- License: MIT
|
|
10
|
+
|
|
11
|
+
## ccpwgl math extraction
|
|
12
|
+
|
|
13
|
+
Most container modules in `src` were extracted from ccpwgl's
|
|
14
|
+
`src/global/math` library and converted to standalone ESM with package-local
|
|
15
|
+
imports. The code remains MIT-licensed under the CarbonEngineJS/ccpwgl project
|
|
16
|
+
license.
|
|
17
|
+
|
|
18
|
+
## Mapbox earcut helper
|
|
19
|
+
|
|
20
|
+
`src/geometry/helpers/earcut.js` is an embedded copy of an Earcut-style
|
|
21
|
+
triangulation helper from the ccpwgl math tree.
|
|
22
|
+
|
|
23
|
+
- Copyright: 2016, Mapbox
|
|
24
|
+
- License: ISC
|
|
25
|
+
- Local license copy: `src/geometry/helpers/LICENSE`
|
|
26
|
+
|
|
27
|
+
## Three.js-derived geometry notes
|
|
28
|
+
|
|
29
|
+
Some geometry helpers in the extracted ccpwgl math tree are marked as converted
|
|
30
|
+
from Three.js-style algorithms. These are retained as source comments and should
|
|
31
|
+
be reviewed before expanding the public geometry surface.
|
|
32
|
+
|
|
33
|
+
## Fenris Creations / CCP Games tangent behavior
|
|
34
|
+
|
|
35
|
+
`src/tangent.js` implements CarbonEngineJS/GR2 packed tangent-frame behavior
|
|
36
|
+
derived from observed EVE/Carbon shader behavior and generated test vectors.
|
|
37
|
+
No Fenris Creations (CCP Games) shader source, tools, or assets are included.
|
|
38
|
+
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Runtime utilities documentation
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-utils`
|
|
5
|
+
Audience: Runtime authors, integrators, and maintainers
|
|
6
|
+
Summary: Explains the consolidated shared runtime foundation and its public families.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
`@carbonenginejs/runtime-utils` is the bottom shared layer of the
|
|
11
|
+
CarbonEngineJS runtime dependency graph. It owns browser-safe primitives that
|
|
12
|
+
are useful across runtime libraries and do not depend on another
|
|
13
|
+
CarbonEngineJS package.
|
|
14
|
+
|
|
15
|
+
The package is deliberately strict about what enters this layer so it can
|
|
16
|
+
remain stable and low-changing after the Carbon-to-JavaScript conversion.
|
|
17
|
+
|
|
18
|
+
## Use this package when
|
|
19
|
+
|
|
20
|
+
Use `runtime-utils` when code:
|
|
21
|
+
|
|
22
|
+
- is a general runtime primitive used by more than one package;
|
|
23
|
+
- has stable behavior that can be described without domain policy;
|
|
24
|
+
- is safe in browsers and does not import Node built-ins;
|
|
25
|
+
- can remain independent of every other CarbonEngineJS package.
|
|
26
|
+
|
|
27
|
+
Do not use it merely as a convenient home for code without an owner.
|
|
28
|
+
Browser-facing demos, clients, inspectors, and usable application helpers
|
|
29
|
+
belong in `@carbonenginejs/tools-browser`.
|
|
30
|
+
|
|
31
|
+
## Where it fits
|
|
32
|
+
|
|
33
|
+
The package has no organization dependencies. It uses `gl-matrix` for the math
|
|
34
|
+
families; its subpaths remain side-effect-free and independently importable.
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
runtime libraries tools-browser
|
|
38
|
+
\ /
|
|
39
|
+
\ /
|
|
40
|
+
v v
|
|
41
|
+
runtime-utils
|
|
42
|
+
|
|
|
43
|
+
v
|
|
44
|
+
Web-standard platform APIs
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Runtime packages and `tools-browser` consume this foundation directly. Math,
|
|
48
|
+
constant, type, schema, model, document, hydration, and lifecycle ownership is
|
|
49
|
+
consolidated here.
|
|
50
|
+
|
|
51
|
+
## Start here
|
|
52
|
+
|
|
53
|
+
Use the root export when a library consumes several utility families:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import {
|
|
57
|
+
encodeJson,
|
|
58
|
+
isPlainObject,
|
|
59
|
+
normalizePath
|
|
60
|
+
} from "@carbonenginejs/runtime-utils";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Use a public subpath when a consumer needs one focused family:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import { asUint8Array } from "@carbonenginejs/runtime-utils/bytes";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Documentation map
|
|
70
|
+
|
|
71
|
+
- [Architecture and admission rules](architecture.md) defines dependency
|
|
72
|
+
direction, ownership, and the test for adding code.
|
|
73
|
+
- [Current API reference](reference/api.md) lists the implemented subpaths and
|
|
74
|
+
exports.
|
|
75
|
+
- [Class reference](reference/classes/README.md) catalogs maintained Carbon
|
|
76
|
+
foundation classes.
|
|
77
|
+
- [Foundation consolidation](concepts/foundation-consolidation.md) records the
|
|
78
|
+
implemented ownership move and remaining release/retirement work.
|
|
79
|
+
|
|
80
|
+
The Carbon type/model/document guide is retained under
|
|
81
|
+
[core-types/README.md](core-types/README.md) with updated package paths.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Runtime utilities architecture
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-utils`
|
|
5
|
+
Audience: Runtime authors and maintainers
|
|
6
|
+
Summary: Defines the package dependency boundary, ownership rules, and stability expectations.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
`runtime-utils` supplies the lowest reusable layer for CarbonEngineJS runtime
|
|
11
|
+
libraries. Consumers can use it without introducing a dependency on another
|
|
12
|
+
organization package or pulling browser and Node tool behavior into the
|
|
13
|
+
runtime graph.
|
|
14
|
+
|
|
15
|
+
## Dependency contract
|
|
16
|
+
|
|
17
|
+
Organization-dependency-free means:
|
|
18
|
+
|
|
19
|
+
- published source must not import another `@carbonenginejs/*` package;
|
|
20
|
+
- public subpaths must remain safe to import independently;
|
|
21
|
+
- published source must not import Node built-ins or reference Node-only
|
|
22
|
+
globals;
|
|
23
|
+
- module evaluation must not perform environment-specific work.
|
|
24
|
+
|
|
25
|
+
It does not mean that all third-party dependencies are prohibited. A focused,
|
|
26
|
+
browser-safe dependency such as `gl-matrix` is acceptable when it supplies a
|
|
27
|
+
foundation primitive, preserves independent subpaths, and does not introduce
|
|
28
|
+
organization dependency cycles.
|
|
29
|
+
|
|
30
|
+
## Dependency direction
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
runtime-* packages tools-browser
|
|
34
|
+
\ /
|
|
35
|
+
\ /
|
|
36
|
+
v v
|
|
37
|
+
runtime-utils
|
|
38
|
+
|
|
|
39
|
+
v
|
|
40
|
+
third-party or Web-standard primitives
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Dependencies point toward `runtime-utils`; `runtime-utils` never reaches back
|
|
44
|
+
into a runtime, engine, format, browser tool, or Node tool package.
|
|
45
|
+
|
|
46
|
+
## Admission rules
|
|
47
|
+
|
|
48
|
+
Code belongs in `runtime-utils` only when all of these are true:
|
|
49
|
+
|
|
50
|
+
1. More than one runtime-facing package needs the same primitive or contract.
|
|
51
|
+
2. The behavior is useful without application, rendering, resource, or domain
|
|
52
|
+
policy.
|
|
53
|
+
3. The implementation can satisfy the dependency contract above.
|
|
54
|
+
4. Its public semantics are stable enough for broad reuse.
|
|
55
|
+
5. Owning it here reduces duplicated foundation behavior rather than merely
|
|
56
|
+
shortening an import.
|
|
57
|
+
|
|
58
|
+
Once the Carbon-to-JavaScript conversion and foundation consolidation finish,
|
|
59
|
+
new responsibilities should be uncommon. Additions require a demonstrated
|
|
60
|
+
cross-package need and a clear subpath owner.
|
|
61
|
+
|
|
62
|
+
## Current ownership
|
|
63
|
+
|
|
64
|
+
The implemented package currently owns:
|
|
65
|
+
|
|
66
|
+
- neutral array, byte, text, JSON, lookup, and path mechanics;
|
|
67
|
+
- shared `isSomething` predicates and small validation assertions;
|
|
68
|
+
- browser-standard gzip decompression helpers;
|
|
69
|
+
- scalar, vector, quaternion, matrix, geometry, mesh, tangent, noise, and curve
|
|
70
|
+
math;
|
|
71
|
+
- shared media, graphics, render-context, audio, shader, D3D, and WebGPU
|
|
72
|
+
constants; and
|
|
73
|
+
- Carbon type descriptors, schema metadata, models, lifecycle state,
|
|
74
|
+
documents, hydration, and dehydration.
|
|
75
|
+
|
|
76
|
+
The [API reference](reference/api.md) is the exact current inventory.
|
|
77
|
+
|
|
78
|
+
## Ownership elsewhere
|
|
79
|
+
|
|
80
|
+
- Browser-facing demos, clients, remote readers, inspectors, integration
|
|
81
|
+
helpers, and usable reference implementations belong in
|
|
82
|
+
`@carbonenginejs/tools-browser`.
|
|
83
|
+
- Node filesystems, caches, credentials, servers, command-line interfaces, and
|
|
84
|
+
build orchestration belong in `@carbonenginejs/tools-core`.
|
|
85
|
+
- Runtime graph objects and domain readers belong in their owning
|
|
86
|
+
`runtime-*` package.
|
|
87
|
+
- Backend objects and realization policy belong in `engine-*` packages.
|
|
88
|
+
- Generated schemas, enums, and domain libraries remain generated artifacts
|
|
89
|
+
owned by their producer and consuming domain.
|
|
90
|
+
|
|
91
|
+
## Consolidated foundation boundary
|
|
92
|
+
|
|
93
|
+
The former math, constant, and Carbon type-system foundations now live under
|
|
94
|
+
coherent `runtime-utils` subpaths. Former math and constant family suffixes
|
|
95
|
+
remain available at the top level for mechanical migration, while `/math/*`
|
|
96
|
+
and `/const/*` aliases group the same implementations.
|
|
97
|
+
|
|
98
|
+
The root intentionally excludes type/model/document barrels so importing a
|
|
99
|
+
neutral utility does not initialize registry and model families. See
|
|
100
|
+
[Foundation consolidation](concepts/foundation-consolidation.md) for the
|
|
101
|
+
layout and migration status.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Runtime foundation consolidation
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-utils` foundation boundary
|
|
5
|
+
Audience: Runtime authors, integrators, and maintainers
|
|
6
|
+
Summary: Records the consolidated math, constant, and type-system ownership and migration contract.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
The approved organization direction is to make `runtime-utils` the single
|
|
11
|
+
stable, browser-safe foundation commonly consumed by CarbonEngineJS runtime
|
|
12
|
+
libraries.
|
|
13
|
+
|
|
14
|
+
The surviving repository now contains the former utility, math, constant, and
|
|
15
|
+
Carbon type-system implementations. Their inherited test suites run together,
|
|
16
|
+
and every advertised package subpath is independently importable.
|
|
17
|
+
|
|
18
|
+
## Current ownership
|
|
19
|
+
|
|
20
|
+
`@carbonenginejs/runtime-utils` is the sole current source owner for neutral
|
|
21
|
+
mechanics, math, shared constants, Carbon types, schema metadata, registries,
|
|
22
|
+
models, documents, lifecycle, hydration, and dehydration.
|
|
23
|
+
|
|
24
|
+
## Implemented layout
|
|
25
|
+
|
|
26
|
+
The families move intact enough to preserve useful imports:
|
|
27
|
+
|
|
28
|
+
| Moved family | `runtime-utils` family |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Math | Existing top-level suffixes such as `./vec3`, plus `./math` and matching `./math/*` aliases |
|
|
31
|
+
| Constants | Existing family suffixes such as `./graphics`, plus `./const` and matching `./const/*` aliases |
|
|
32
|
+
| Carbon types/models | `./types`, `./schema`, `./model`, `./document`, `./hydration`, and `./lifecycle` |
|
|
33
|
+
|
|
34
|
+
The root export may expose common mechanics and family namespaces. It must not
|
|
35
|
+
introduce ambiguous duplicate names or require eager evaluation of every math,
|
|
36
|
+
constant, schema, model, and document module.
|
|
37
|
+
|
|
38
|
+
The package depends on `gl-matrix`. That is compatible with the boundary
|
|
39
|
+
because `runtime-utils` prohibits organization dependencies, not focused
|
|
40
|
+
browser-safe third-party foundations.
|
|
41
|
+
|
|
42
|
+
## Shared predicates
|
|
43
|
+
|
|
44
|
+
There is one curated `runtime-utils/is` surface:
|
|
45
|
+
|
|
46
|
+
- predicates return literal booleans;
|
|
47
|
+
- generally useful structural checks belong here;
|
|
48
|
+
- vector and matrix checks join only with explicit math semantics;
|
|
49
|
+
- domain checks remain with their domain package;
|
|
50
|
+
- browser-specific checks remain in `tools-browser`;
|
|
51
|
+
- established core predicate behavior wins wherever old names overlap.
|
|
52
|
+
|
|
53
|
+
The goal is a useful shared predicate library, not a reduced compatibility
|
|
54
|
+
snapshot.
|
|
55
|
+
|
|
56
|
+
## Migration status
|
|
57
|
+
|
|
58
|
+
Completed locally:
|
|
59
|
+
|
|
60
|
+
1. current contracts and baselines were inventoried;
|
|
61
|
+
2. unique utility APIs and the math, constant, and type/model families were
|
|
62
|
+
assembled in the surviving Git history;
|
|
63
|
+
3. inherited contract suites and independent-subpath imports pass;
|
|
64
|
+
4. generator output was updated before consumer source;
|
|
65
|
+
5. active authored consumers and generated npm output were migrated.
|
|
66
|
+
|
|
67
|
+
Remaining release work is to publish the consolidated package, refresh
|
|
68
|
+
registry-resolved locks, verify clean installs, and retire the old package
|
|
69
|
+
names after the active-reference audit reaches zero.
|
|
70
|
+
|
|
71
|
+
No compatibility package is required by default. One should exist only for a
|
|
72
|
+
verified external consumer that cannot migrate during the coordinated release.
|
|
73
|
+
|
|
74
|
+
## Stability target
|
|
75
|
+
|
|
76
|
+
After consolidation, `runtime-utils` should change infrequently. New
|
|
77
|
+
responsibilities need a demonstrated cross-runtime use case, browser-safe
|
|
78
|
+
semantics, no CarbonEngineJS dependencies, and a coherent public subpath.
|
|
79
|
+
|
|
80
|
+
The result is a runtime foundation, not a general utility dumping ground.
|
|
81
|
+
|
|
82
|
+
## Related documentation
|
|
83
|
+
|
|
84
|
+
- [Package documentation](../README.md)
|
|
85
|
+
- [Architecture and admission rules](../architecture.md)
|
|
86
|
+
- [Current API reference](../reference/api.md)
|
package/docs/const-kb.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Runtime Const Knowledge Base
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-utils` constant families
|
|
5
|
+
Audience: Runtime authors and maintainers
|
|
6
|
+
Summary: Defines ownership and dependency rules for shared constant vocabularies.
|
|
7
|
+
|
|
8
|
+
`runtime-utils` owns shared vocabulary and numeric constants for CarbonEngineJS.
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
This package provides stable constants that can be shared by:
|
|
13
|
+
|
|
14
|
+
- `format-*` packages when emitting GPU-free semantic payloads.
|
|
15
|
+
- `runtime-resource` when interpreting payloads and resource intent.
|
|
16
|
+
- `engine-*` packages when mapping payloads to backend APIs.
|
|
17
|
+
- tools and tests that need canonical media, graphics, audio, shader, D3D, or
|
|
18
|
+
backend names.
|
|
19
|
+
|
|
20
|
+
## Boundaries
|
|
21
|
+
|
|
22
|
+
`runtime-utils` owns:
|
|
23
|
+
|
|
24
|
+
- canonical string tokens, such as pixel formats and color spaces.
|
|
25
|
+
- small helpers for normalization and classification.
|
|
26
|
+
- numeric mirrors of external enums where useful, such as DXGI/D3D values.
|
|
27
|
+
- mapping tables between shared constants and backend constants.
|
|
28
|
+
|
|
29
|
+
`runtime-utils` does not own:
|
|
30
|
+
|
|
31
|
+
- resource lifecycle, cache, source reads, or loader dispatch.
|
|
32
|
+
- format parsing or byte decoding.
|
|
33
|
+
- format-container internals such as DDS header offsets, FOURCC parsing,
|
|
34
|
+
PNG chunk handling, WAV chunk layouts, or MP4 box parsing.
|
|
35
|
+
- class hydration or runtime object population.
|
|
36
|
+
- WebGPU/WebGL resource creation.
|
|
37
|
+
|
|
38
|
+
## Dependency Rule
|
|
39
|
+
|
|
40
|
+
`runtime-utils` should stay dependency-light and pure JavaScript.
|
|
41
|
+
|
|
42
|
+
Preferred direction:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
format-* may emit matching strings, optionally import runtime-utils
|
|
46
|
+
runtime-resource may import/re-export runtime-utils
|
|
47
|
+
engine-* imports runtime-utils for backend mapping
|
|
48
|
+
runtime-utils imports no runtime-resource or engine packages
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Format packages are allowed to remain standalone by emitting plain strings that
|
|
52
|
+
match this package's constants.
|
|
53
|
+
|
|
54
|
+
## Initial Domains
|
|
55
|
+
|
|
56
|
+
- media and payload types
|
|
57
|
+
- graphics pixel formats, color spaces, texture dimensions
|
|
58
|
+
- audio sample formats and channel layouts
|
|
59
|
+
- shader stages and shader models
|
|
60
|
+
- D3D/DXGI enum mirrors
|
|
61
|
+
- WebGPU mapping helpers
|
|
62
|
+
|
|
63
|
+
## Format-Specific Constants
|
|
64
|
+
|
|
65
|
+
Container-specific constants live with their format package.
|
|
66
|
+
|
|
67
|
+
Examples:
|
|
68
|
+
|
|
69
|
+
- DDS magic numbers, header offsets, pixel format flags, caps bits, FOURCC
|
|
70
|
+
values, and DX10 header parsing belong to `format-dds`.
|
|
71
|
+
- PNG chunk names and filter ids belong to `format-png`.
|
|
72
|
+
- WAV RIFF chunk ids belong to `format-wav`.
|
|
73
|
+
|
|
74
|
+
`runtime-utils` may still expose general constants that those formats reference,
|
|
75
|
+
such as canonical `PixelFormat` strings or generic `DxgiFormat` numeric enum
|
|
76
|
+
values. The parser-specific interpretation remains in the format package.
|
|
77
|
+
|
|
78
|
+
## Payload Example
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
{
|
|
82
|
+
payloadType: "texture",
|
|
83
|
+
sourceFormat: "dds",
|
|
84
|
+
pixelFormat: "bc7-rgba-unorm",
|
|
85
|
+
colorSpace: "srgb",
|
|
86
|
+
dimension: "2d",
|
|
87
|
+
isCompressed: true
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The payload is still GPU-free. Engine packages decide whether and how to create
|
|
92
|
+
backend resources from it.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Runtime-utils decorator TODOs
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-utils/schema`
|
|
5
|
+
Audience: Schema authors and maintainers
|
|
6
|
+
Summary: Records reviewed decorator gaps that remain outside the current schema contract.
|
|
7
|
+
|
|
8
|
+
## Confirmed status
|
|
9
|
+
|
|
10
|
+
No missing decorator primitive is currently confirmed. `@type`, `@io`,
|
|
11
|
+
`@schema`, `@carbon`, and `@impl` provide the required metadata surface, and
|
|
12
|
+
`CjsModel.SetValues` adds declared `@io.flag`/`@io.rebuild` consequences at
|
|
13
|
+
write time.
|
|
14
|
+
|
|
15
|
+
## TODO
|
|
16
|
+
|
|
17
|
+
- [ ] Decide how a concrete Blue class declares an inherited Carbon method
|
|
18
|
+
without adding a forwarding wrapper. `CjsSchema.decorateMethod` can already
|
|
19
|
+
register the inherited implementation on an exact constructor; add a new
|
|
20
|
+
declarative form only if the package-wide checker requires one.
|
|
21
|
+
- [ ] Keep tests proving that `@io.flag` and `@io.rebuild` tokens are added by
|
|
22
|
+
changed-field writes and are never cleared by generic settle logic.
|
|
23
|
+
- [ ] Do not add proposed semantic aliases such as `type.position` or
|
|
24
|
+
`type.worldTransform` as part of missing-decorator cleanup; those remain a
|
|
25
|
+
separate API decision.
|