@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.
Files changed (104) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +23 -23
  3. package/README.md +69 -69
  4. package/THIRD-PARTY-NOTICES.md +64 -64
  5. package/docs/README.md +74 -73
  6. package/docs/architecture.md +101 -101
  7. package/docs/concepts/foundation-consolidation.md +85 -85
  8. package/docs/concepts/model-lifecycle.md +111 -0
  9. package/docs/const-kb.md +85 -87
  10. package/docs/core-types/DECORATOR-TODOS.md +25 -25
  11. package/docs/core-types/README.md +229 -168
  12. package/docs/reference/api.md +105 -102
  13. package/docs/reference/classes/README.md +135 -135
  14. package/package.json +139 -139
  15. package/src/arrays.js +5 -5
  16. package/src/audio/audioFormats.js +34 -34
  17. package/src/audio/index.js +1 -1
  18. package/src/box3.js +331 -331
  19. package/src/bytes.js +56 -56
  20. package/src/compression.js +56 -56
  21. package/src/constants/index.js +7 -7
  22. package/src/constants/trinity.js +13 -13
  23. package/src/constants.js +15 -15
  24. package/src/curve.js +79 -79
  25. package/src/d3d/dxgiFormats.js +46 -46
  26. package/src/d3d/index.js +2 -2
  27. package/src/d3d/primitiveTopology.js +11 -11
  28. package/src/document/CjsCarbonDocument.js +212 -212
  29. package/src/document/CjsClassRegistry.js +373 -373
  30. package/src/document/CjsDocumentDehydrator.js +142 -142
  31. package/src/document/CjsDocumentHydrator.js +156 -156
  32. package/src/document/CjsStructRegistry.js +348 -348
  33. package/src/document/hydrationAdapter.js +129 -129
  34. package/src/document/index.js +6 -6
  35. package/src/errors/CjsError.js +286 -286
  36. package/src/errors/index.js +5 -5
  37. package/src/geometry/box.js +22 -22
  38. package/src/geometry/cylinder.js +22 -22
  39. package/src/geometry/helpers/earcut.js +1 -1
  40. package/src/geometry/helpers/misc.js +3 -3
  41. package/src/geometry/index.js +8 -8
  42. package/src/geometry/json.js +67 -67
  43. package/src/geometry/lathe.js +44 -44
  44. package/src/geometry/plane.js +14 -14
  45. package/src/geometry/shape.js +4 -4
  46. package/src/geometry/sphere.js +24 -24
  47. package/src/geometry/torus.js +14 -14
  48. package/src/graphics/colorSpaces.js +22 -22
  49. package/src/graphics/index.js +4 -4
  50. package/src/graphics/pixelFormats.js +158 -158
  51. package/src/graphics/textureDimensions.js +22 -22
  52. package/src/graphics/trinityEnums.js +87 -87
  53. package/src/index.js +62 -62
  54. package/src/is.js +108 -46
  55. package/src/json.js +23 -23
  56. package/src/lifecycle/CjsLifecycleState.js +77 -77
  57. package/src/lifecycle/index.js +1 -1
  58. package/src/lne3.js +70 -70
  59. package/src/lookup.js +48 -48
  60. package/src/mat3.js +51 -51
  61. package/src/mat4.js +699 -699
  62. package/src/math/index.js +25 -25
  63. package/src/math/scalar.js +63 -63
  64. package/src/media/index.js +1 -1
  65. package/src/media/mediaTypes.js +50 -50
  66. package/src/mesh.js +424 -424
  67. package/src/model/CjsEventEmitter.js +333 -333
  68. package/src/model/CjsModel.js +1589 -1544
  69. package/src/model/CjsModelState.js +72 -72
  70. package/src/model/index.js +4 -4
  71. package/src/model/sourceRecordUtils.js +54 -54
  72. package/src/noise.js +310 -310
  73. package/src/num.js +827 -827
  74. package/src/object.js +39 -39
  75. package/src/path.js +53 -53
  76. package/src/pln.js +125 -125
  77. package/src/pool.js +9 -9
  78. package/src/quat.js +144 -144
  79. package/src/ray3.js +188 -188
  80. package/src/renderContext/formats.js +145 -145
  81. package/src/renderContext/index.js +5 -5
  82. package/src/renderContext/presentation.js +125 -125
  83. package/src/renderContext/resources.js +27 -27
  84. package/src/renderContext/upscaling.js +22 -22
  85. package/src/renderContext/window.js +20 -20
  86. package/src/runtime/CjsRuntimeState.js +50 -50
  87. package/src/schema/CjsSchema.js +555 -318
  88. package/src/schema/index.js +4 -4
  89. package/src/shader/index.js +1 -1
  90. package/src/shader/shaderStages.js +37 -37
  91. package/src/sph3.js +181 -181
  92. package/src/tangent.js +288 -288
  93. package/src/text.js +40 -40
  94. package/src/tri3.js +98 -98
  95. package/src/types/carbonTypes.js +635 -635
  96. package/src/types/index.js +2 -2
  97. package/src/utils.js +58 -58
  98. package/src/validation.js +46 -46
  99. package/src/vec2.js +229 -229
  100. package/src/vec3.js +1188 -1172
  101. package/src/vec4.js +347 -347
  102. package/src/vertex.js +108 -108
  103. package/src/webgpu/index.js +1 -1
  104. package/src/webgpu/textureFormats.js +121 -121
package/docs/const-kb.md CHANGED
@@ -1,99 +1,97 @@
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
-
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
12
  This package provides stable constants that can be shared by:
13
13
 
14
14
  - `runtime-resource/formats/*` readers when emitting GPU-free semantic
15
- payloads.
16
- - maintained standalone shader-format packages.
15
+ payloads, including the DXBC, HLSL, WebGL, and WebGPU subpaths.
17
16
  - `runtime-resource` when interpreting payloads and resource intent.
18
17
  - `engine-*` packages when mapping payloads to backend APIs.
19
- - tools and tests that need canonical media, graphics, audio, shader, D3D, or
20
- backend names.
21
-
22
- ## Boundaries
23
-
24
- `runtime-utils` owns:
25
-
26
- - canonical string tokens, such as pixel formats and color spaces.
27
- - small helpers for normalization and classification.
28
- - numeric mirrors of external enums where useful, such as DXGI/D3D values.
29
- - mapping tables between shared constants and backend constants.
30
-
31
- The constant families do not own:
32
-
33
- - resource lifecycle, cache, source reads, or loader dispatch.
34
- - format parsing or byte decoding.
35
- - format-container internals such as DDS header offsets, FOURCC parsing,
36
- PNG chunk handling, WAV chunk layouts, or MP4 box parsing.
37
- - class hydration or runtime object population, which are separate
38
- runtime-utils families.
39
- - WebGPU/WebGL resource creation.
40
-
41
- ## Dependency Rule
42
-
43
- `runtime-utils` should stay dependency-light and pure JavaScript.
44
-
45
- Preferred direction:
46
-
18
+ - tools and tests that need canonical media, graphics, audio, shader, D3D, or
19
+ backend names.
20
+
21
+ ## Boundaries
22
+
23
+ `runtime-utils` owns:
24
+
25
+ - canonical string tokens, such as pixel formats and color spaces.
26
+ - small helpers for normalization and classification.
27
+ - numeric mirrors of external enums where useful, such as DXGI/D3D values.
28
+ - mapping tables between shared constants and backend constants.
29
+
30
+ The constant families do not own:
31
+
32
+ - resource lifecycle, cache, source reads, or loader dispatch.
33
+ - format parsing or byte decoding.
34
+ - format-container internals such as DDS header offsets, FOURCC parsing,
35
+ PNG chunk handling, WAV chunk layouts, or MP4 box parsing.
36
+ - class hydration or runtime object population, which are separate
37
+ runtime-utils families.
38
+ - WebGPU/WebGL resource creation.
39
+
40
+ ## Dependency Rule
41
+
42
+ `runtime-utils` should stay dependency-light and pure JavaScript.
43
+
44
+ Preferred direction:
45
+
47
46
  ```text
48
47
  runtime-resource/formats/* may emit matching strings, imports runtime-utils
49
- shader format-* may emit matching strings, import runtime-utils
50
48
  runtime-resource may import/re-export runtime-utils
51
49
  engine-* imports runtime-utils for backend mapping
52
50
  runtime-utils imports no runtime-resource or engine packages
53
51
  ```
54
52
 
55
- Maintained shader format packages may remain standalone while emitting plain
56
- strings that match this package's constants.
57
-
58
- ## Initial Domains
59
-
60
- - media and payload types
61
- - graphics pixel formats, color spaces, texture dimensions
62
- - audio sample formats and channel layouts
63
- - shader stages and shader models
64
- - D3D/DXGI enum mirrors
65
- - WebGPU mapping helpers
66
-
67
- ## Format-Specific Constants
68
-
69
- Container-specific constants live with their maintained reader.
70
-
71
- Examples:
72
-
73
- - DDS magic numbers, header offsets, pixel format flags, caps bits, FOURCC
74
- values, and DX10 header parsing belong to
75
- `@carbonenginejs/runtime-resource/formats/dds`.
76
- - PNG chunk names and filter ids belong to
77
- `@carbonenginejs/runtime-resource/formats/png`.
78
- - WAV RIFF chunk ids belong to
79
- `@carbonenginejs/runtime-resource/formats/wav`.
80
-
81
- `runtime-utils` may still expose general constants that those formats reference,
82
- such as canonical `PixelFormat` strings or generic `DxgiFormat` numeric enum
83
- values. Parser-specific interpretation remains in the maintained reader.
84
-
85
- ## Payload Example
86
-
87
- ```js
88
- {
89
- payloadType: "texture",
90
- sourceFormat: "dds",
91
- pixelFormat: "bc7-rgba-unorm",
92
- colorSpace: "srgb",
93
- dimension: "2d",
94
- isCompressed: true
95
- }
96
- ```
97
-
98
- The payload is still GPU-free. Engine packages decide whether and how to create
99
- backend resources from it.
53
+ Shader formats are maintained as runtime-resource subpaths. Retired standalone
54
+ format package names are provenance labels, not current dependency owners.
55
+
56
+ ## Initial Domains
57
+
58
+ - media and payload types
59
+ - graphics pixel formats, color spaces, texture dimensions
60
+ - audio sample formats and channel layouts
61
+ - shader stages and shader models
62
+ - D3D/DXGI enum mirrors
63
+ - WebGPU mapping helpers
64
+
65
+ ## Format-Specific Constants
66
+
67
+ Container-specific constants live with their maintained reader.
68
+
69
+ Examples:
70
+
71
+ - DDS magic numbers, header offsets, pixel format flags, caps bits, FOURCC
72
+ values, and DX10 header parsing belong to
73
+ `@carbonenginejs/runtime-resource/formats/dds`.
74
+ - PNG chunk names and filter ids belong to
75
+ `@carbonenginejs/runtime-resource/formats/png`.
76
+ - WAV RIFF chunk ids belong to
77
+ `@carbonenginejs/runtime-resource/formats/wav`.
78
+
79
+ `runtime-utils` may still expose general constants that those formats reference,
80
+ such as canonical `PixelFormat` strings or generic `DxgiFormat` numeric enum
81
+ values. Parser-specific interpretation remains in the maintained reader.
82
+
83
+ ## Payload Example
84
+
85
+ ```js
86
+ {
87
+ payloadType: "texture",
88
+ sourceFormat: "dds",
89
+ pixelFormat: "bc7-rgba-unorm",
90
+ colorSpace: "srgb",
91
+ dimension: "2d",
92
+ isCompressed: true
93
+ }
94
+ ```
95
+
96
+ The payload is still GPU-free. Engine packages decide whether and how to create
97
+ backend resources from it.
@@ -1,25 +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
- ## Open work
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.
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
+ ## Open work
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.