@descix/frqtl-node 0.0.0-stage → 0.6.0-p0.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/CLAUDE.md +87 -0
- package/LICENSE.md +664 -0
- package/README.md +84 -2
- package/dist/dist-manifest.json +218 -0
- package/dist/eyes/index.js +109 -0
- package/dist/fat/pkg-node/egpt_wasm.js +1277 -0
- package/dist/fat/pkg-node/egpt_wasm_bg.wasm +0 -0
- package/dist/fat/pkg-node/package.json +12 -0
- package/dist/frqtl/assets/vendor/chroma.mjs +64 -0
- package/dist/frqtl/compat/boot-node.js +34 -0
- package/dist/frqtl/compat/engine.js +127 -0
- package/dist/frqtl/compat/package-root.js +24 -0
- package/dist/frqtl/compat/providers/wasm-engine.js +2499 -0
- package/dist/frqtl/compat/providers/wasm-load-browser.js +134 -0
- package/dist/frqtl/compat/providers/wasm-load-node.js +59 -0
- package/dist/frqtl/compat/renderer/FieldBuilder.js +145 -0
- package/dist/frqtl/compat/renderer/Filters.js +163 -0
- package/dist/frqtl/compat/renderer/RenderFamily.js +84 -0
- package/dist/frqtl/compat/renderer/RenderMesh.js +99 -0
- package/dist/frqtl/compat/renderer/RenderShape.js +154 -0
- package/dist/frqtl/compat/renderer/camera2d-geometry.js +183 -0
- package/dist/frqtl/compat/renderer/captureStill-common.js +258 -0
- package/dist/frqtl/compat/renderer/display-slot.js +96 -0
- package/dist/frqtl/compat/renderer/lo-drawn-center.js +231 -0
- package/dist/frqtl/compat/renderer/orbit-bag.js +216 -0
- package/dist/frqtl/compat/renderer/providers/godrays-layer.js +213 -0
- package/dist/frqtl/compat/renderer/providers/index.js +22 -0
- package/dist/frqtl/compat/renderer/providers/p5-provider.js +861 -0
- package/dist/frqtl/compat/renderer/providers/three-camera-contract.js +160 -0
- package/dist/frqtl/compat/renderer/providers/three-camera-geometry.js +571 -0
- package/dist/frqtl/compat/renderer/providers/three-provider.js +2470 -0
- package/dist/frqtl/compat/renderer/renderCapabilities-common.js +186 -0
- package/dist/frqtl/compat/renderer/renderer-provider-contract.js +238 -0
- package/dist/frqtl/compat/renderer/unprojectStill.js +172 -0
- package/dist/frqtl/compat/vendor.js +196 -0
- package/dist/frqtl/node-entry.js +17 -0
- package/dist/frqtl/objects/FrqtlApp.js +2920 -0
- package/dist/frqtl/objects/ObjectFactory.js +296 -0
- package/dist/frqtl/objects/RecipeContext.js +322 -0
- package/dist/frqtl/objects/collectors/DataCollector.js +116 -0
- package/dist/frqtl/objects/constants/WallBehaviors.js +178 -0
- package/dist/frqtl/objects/geometry/SlabFace.js +258 -0
- package/dist/frqtl/objects/instruments/capture-host.js +453 -0
- package/dist/frqtl/objects/instruments/capture.js +710 -0
- package/dist/frqtl/objects/instruments/hosted-eyes.js +984 -0
- package/dist/frqtl/objects/kinds-entry.js +14 -0
- package/dist/frqtl/objects/kinds.js +190 -0
- package/dist/frqtl/objects/objects/Box.js +273 -0
- package/dist/frqtl/objects/objects/Bullet.js +155 -0
- package/dist/frqtl/objects/objects/CircuitGate.js +380 -0
- package/dist/frqtl/objects/objects/CircuitProbe.js +214 -0
- package/dist/frqtl/objects/objects/DirectedTunnel.js +411 -0
- package/dist/frqtl/objects/objects/EgptFractal.js +164 -0
- package/dist/frqtl/objects/objects/LightSource.js +351 -0
- package/dist/frqtl/objects/objects/QuantumEmitter.js +760 -0
- package/dist/frqtl/objects/objects/Tube.js +471 -0
- package/dist/frqtl/objects/objects/absorbRadiation.js +309 -0
- package/dist/frqtl/objects/objects/actionCompiler.js +1747 -0
- package/dist/frqtl/objects/objects/controlAction.js +89 -0
- package/dist/frqtl/objects/objects/controlBind.js +278 -0
- package/dist/frqtl/objects/objects/directedRedirectProgram.js +120 -0
- package/dist/frqtl/objects/objects/emitterProgram.js +209 -0
- package/dist/frqtl/objects/objects/frqtl-control-slider.js +197 -0
- package/dist/frqtl/objects/objects/frqtl-control-sync.js +272 -0
- package/dist/frqtl/objects/objects/frqtl-control-widgets.js +219 -0
- package/dist/frqtl/objects/objects/frqtl-control-write-queue.js +174 -0
- package/dist/frqtl/objects/objects/makeControlsForObject.js +820 -0
- package/dist/frqtl/objects/objects/makeControlsForRenderSurface.js +161 -0
- package/dist/frqtl/objects/objects/slitLinerScatter.js +261 -0
- package/dist/frqtl/objects/objects/sustainedSource.js +298 -0
- package/dist/frqtl/objects/objects/tagger.js +228 -0
- package/dist/frqtl/objects/schema/engine-scopes.js +468 -0
- package/dist/frqtl/objects/schema/index.js +256 -0
- package/dist/frqtl/objects/schema/scopes.js +457 -0
- package/dist/frqtl/objects/schema/validate-descriptor.js +49 -0
- package/dist/frqtl/objects/schema/valueNormalizer.js +366 -0
- package/dist/frqtl/objects/setup/_collisionMatrixLanes.js +66 -0
- package/dist/frqtl/objects/setup/_setupOptions.js +118 -0
- package/dist/frqtl/objects/setup/_worldInit.js +162 -0
- package/dist/frqtl/objects/setup/setupBlackbodySubstrate.js +242 -0
- package/dist/frqtl/objects/setup/setupCircuitBasic.js +447 -0
- package/dist/frqtl/objects/setup/setupCollisionMatrix.js +188 -0
- package/dist/frqtl/objects/setup/setupConeEmitter3D.js +250 -0
- package/dist/frqtl/objects/setup/setupDoubleSlit.js +326 -0
- package/dist/frqtl/objects/setup/setupDoubleSlit_Laser.js +229 -0
- package/dist/frqtl/objects/setup/setupEmpty.js +59 -0
- package/dist/frqtl/objects/setup/setupFxSmoke.js +209 -0
- package/dist/frqtl/objects/setup/setupG1Race.js +80 -0
- package/dist/frqtl/objects/setup/setupG2Sweep.js +89 -0
- package/dist/frqtl/objects/setup/setupG3Collide.js +177 -0
- package/dist/frqtl/objects/setup/setupLightSourceLab.js +277 -0
- package/dist/frqtl/objects/setup/setupOscillator.js +68 -0
- package/dist/frqtl/objects/setup/setupParticleWalk.js +93 -0
- package/dist/frqtl/objects/setup/setupParticleWalk3D.js +133 -0
- package/dist/frqtl/objects/setup/setupSphereEmitter3D.js +1258 -0
- package/dist/frqtl/objects/setup/setupTraceCircuit.js +239 -0
- package/dist/frqtl/objects/setup/setupTunnelLab.js +240 -0
- package/dist/frqtl/objects/setup/setupTunnelPointExit.js +306 -0
- package/dist/frqtl/objects/setup/setupWaveInterference.js +177 -0
- package/dist/frqtl/objects/v1-replacements.js +29 -0
- package/dist/frqtl/package-core.js +23 -0
- package/dist/frqtl/parts/CameraControls.js +643 -0
- package/dist/frqtl/parts/CameraPath.js +575 -0
- package/dist/frqtl/parts/CollisionActions.js +34 -0
- package/dist/frqtl/parts/CollisionTypes.js +30 -0
- package/dist/frqtl/parts/DetectorWall.js +496 -0
- package/dist/frqtl/parts/FrqtlControlOverlay.js +227 -0
- package/dist/frqtl/parts/FrqtlControlsPanel.js +415 -0
- package/dist/frqtl/parts/FrqtlVision.js +818 -0
- package/dist/frqtl/parts/GraphingDetectorWall.js +489 -0
- package/dist/frqtl/parts/LargeObject.js +405 -0
- package/dist/frqtl/parts/LightColor.js +255 -0
- package/dist/frqtl/parts/LiveChart.js +285 -0
- package/dist/frqtl/parts/LogicGate.js +717 -0
- package/dist/frqtl/parts/OvenBox.js +611 -0
- package/dist/frqtl/parts/PointSource.js +762 -0
- package/dist/frqtl/parts/Rectangle.js +200 -0
- package/dist/frqtl/parts/SlitLightSource.js +234 -0
- package/dist/frqtl/parts/SlitScreen.js +628 -0
- package/dist/frqtl/parts/SphereEmitter.js +946 -0
- package/dist/frqtl/parts/Trace.js +508 -0
- package/dist/frqtl/parts/Tunnel.js +1057 -0
- package/dist/frqtl/parts/Wall.js +1211 -0
- package/dist/frqtl/parts/index.js +33 -0
- package/dist/frqtl/scenes/absorbing-wall-3d.js +33 -0
- package/dist/frqtl/scenes/absorbing-wall.js +32 -0
- package/dist/frqtl/scenes/atomic-model.js +88 -0
- package/dist/frqtl/scenes/big-bang.js +46 -0
- package/dist/frqtl/scenes/blackbody.js +81 -0
- package/dist/frqtl/scenes/circuit-sat.js +127 -0
- package/dist/frqtl/scenes/collision-matrix-3d.js +107 -0
- package/dist/frqtl/scenes/counting-wall-3d.js +36 -0
- package/dist/frqtl/scenes/counting-wall.js +38 -0
- package/dist/frqtl/scenes/double-slit.js +31 -0
- package/dist/frqtl/scenes/dse-one-emitter.js +196 -0
- package/dist/frqtl/scenes/dse-one-slit.js +114 -0
- package/dist/frqtl/scenes/dse-photoelectric.js +70 -0
- package/dist/frqtl/scenes/dse-tunnel-rebuild.js +243 -0
- package/dist/frqtl/scenes/dse-two-emitters.js +196 -0
- package/dist/frqtl/scenes/dse-two-slits.js +132 -0
- package/dist/frqtl/scenes/empty.js +14 -0
- package/dist/frqtl/scenes/laser-buildup.js +49 -0
- package/dist/frqtl/scenes/mirror-3d.js +56 -0
- package/dist/frqtl/scenes/mirror-route.js +140 -0
- package/dist/frqtl/scenes/mirror.js +38 -0
- package/dist/frqtl/scenes/omni-3d.js +27 -0
- package/dist/frqtl/scenes/omni-source.js +22 -0
- package/dist/frqtl/scenes/self-interference.js +39 -0
- package/dist/frqtl/scenes/smoking-gun.js +122 -0
- package/dist/frqtl/scenes/straight-walk.js +22 -0
- package/dist/frqtl/scenes/sun.js +39 -0
- package/dist/frqtl/scenes/two-source.js +37 -0
- package/dist/frqtl/scenes/wave.js +26 -0
- package/dist/shim/bundle/frqnb.js +112 -0
- package/dist/shim/bundle/index.js +121 -0
- package/dist/shim/bundle/indexHtml.js +107 -0
- package/dist/shim/bundle/manifest.js +95 -0
- package/dist/shim/bundle/zip.js +243 -0
- package/dist/shim/bus.js +67 -0
- package/dist/shim/controls/index.js +627 -0
- package/dist/shim/controls/registry.js +274 -0
- package/dist/shim/engine/artifact-shell.js +211 -0
- package/dist/shim/engine/boot-phases.js +44 -0
- package/dist/shim/engine/engine-stack-boot.js +59 -0
- package/dist/shim/engine/router.js +690 -0
- package/dist/shim/experiment-frame/index.js +296 -0
- package/dist/shim/expr/ast-schema.js +369 -0
- package/dist/shim/field-descriptor/index.js +325 -0
- package/dist/shim/frame-data/index.js +224 -0
- package/dist/shim/index.js +67 -0
- package/dist/shim/notebook/canvas-guard.js +82 -0
- package/dist/shim/notebook/catalog.js +35 -0
- package/dist/shim/notebook/format.js +736 -0
- package/dist/shim/notebook/frqtl-setups-importmap.js +81 -0
- package/dist/shim/notebook/kernel.js +671 -0
- package/dist/shim/notebook/knob.js +150 -0
- package/dist/shim/notebook/module-resolver.js +260 -0
- package/dist/shim/notebook/notebook-knobs.js +65 -0
- package/dist/shim/notebook/produced-bindings.js +67 -0
- package/dist/shim/notebook/realm-registry.js +121 -0
- package/dist/shim/notebook/realm-transport.js +73 -0
- package/dist/shim/notebook/setup-builder.js +507 -0
- package/dist/shim/notebook/store.js +159 -0
- package/dist/shim/notebook/vendor-importmap.js +134 -0
- package/dist/shim/notebook/view-builder.js +189 -0
- package/dist/shim/notebook/view-ctx.js +100 -0
- package/dist/shim/notebook/view-handle.js +202 -0
- package/dist/shim/notebook/warmup.js +102 -0
- package/dist/shim/package.json +4 -0
- package/dist/shim/page-params/index.js +213 -0
- package/dist/shim/project/identity.js +112 -0
- package/dist/shim/project/index.js +19 -0
- package/dist/shim/project/link.js +402 -0
- package/dist/shim/project/node-specifier-hook.mjs +35 -0
- package/dist/shim/project/register-node.mjs +17 -0
- package/dist/shim/project/specifiers.js +106 -0
- package/dist/shim/registry/copy-gate.js +110 -0
- package/dist/shim/registry/exhibits.js +455 -0
- package/dist/shim/registry/experiments.js +215 -0
- package/dist/shim/registry/index.js +19 -0
- package/dist/shim/registry/scene-source.js +157 -0
- package/dist/shim/registry/walkthrough.js +804 -0
- package/dist/shim/render/capture-envelope.js +279 -0
- package/dist/shim/render/heat-colormap.js +92 -0
- package/dist/shim/render/render-stages.js +855 -0
- package/dist/shim/render/sun-look.js +33 -0
- package/dist/shim/render-state/apply.js +262 -0
- package/dist/shim/render-state/index.js +74 -0
- package/dist/shim/rpc/index.js +207 -0
- package/dist/shim/runtime/index.js +1023 -0
- package/dist/shim/storage/boot.js +69 -0
- package/dist/shim/storage/index.js +169 -0
- package/dist/shim/storage/local-storage-provider.js +230 -0
- package/dist/shim/storage/make-namespace-store.js +132 -0
- package/dist/shim/storage/modules.js +249 -0
- package/dist/shim/storage/projects.js +150 -0
- package/llms.txt +12 -0
- package/package.json +63 -4
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/* Copyright 2023-2026 by Essam Abadir */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Object-definition schema for EGPT FRQTL VM.
|
|
5
|
+
*
|
|
6
|
+
* Each descriptor declares the EDITABLE properties for a canonical object kind,
|
|
7
|
+
* with types and constraints. This is the single source the IDE reads to render
|
|
8
|
+
* generic inspector/palette/drag-edit controls — no per-object UI code needed.
|
|
9
|
+
*
|
|
10
|
+
* Design rules (enforced by the schema test):
|
|
11
|
+
* 1. Enum constraints REFERENCE the imported CollisionTypes / CollisionActions
|
|
12
|
+
* objects — never re-list values. A copied enum recreates the Rust-only-
|
|
13
|
+
* divergence bug the frozen sets exist to prevent.
|
|
14
|
+
* 2. Field names are 1:1 with constructor params (one vocabulary).
|
|
15
|
+
* 3. engineVisible:true → edit routes through the concurrence path (Phase 4b).
|
|
16
|
+
* engineVisible:false → edit is render-layer-only (Phase 4a).
|
|
17
|
+
* 4. The schema set stays 1:1 with the object set and the frozen enum set.
|
|
18
|
+
* Adding a new editable enum value still requires the JS-reference-first
|
|
19
|
+
* → conformance flow (the engine contract's discipline).
|
|
20
|
+
* 5. Every descriptor has an object-level `description` (what the object does)
|
|
21
|
+
* and every field has a `description` (what the property does / its effect).
|
|
22
|
+
* 6. A composing part stamps `_owner` on what it composed (and nothing else); the declared
|
|
23
|
+
* object is what `ObjectFactory.create` returns and registers (`runner.declared`). A
|
|
24
|
+
* part's sub-objects are never declared. Composite descriptors expose only the
|
|
25
|
+
* composite's own editable props.
|
|
26
|
+
*
|
|
27
|
+
* This file declares WHAT type each field is; its sibling `valueNormalizer.js` states
|
|
28
|
+
* what that declaration MEANS at a write. The sibling's single entry point is re-exported
|
|
29
|
+
* here as `ObjectSchema.normalizeValue(fieldDef, value, kind?)` — the ONE public surface
|
|
30
|
+
* every consumer ferries (the property accessor, the controls factory), so a wrong-typed
|
|
31
|
+
* write throws at the write instead of poisoning a reader far away.
|
|
32
|
+
*
|
|
33
|
+
* Used by: Phase 4 uniform edit API, IDE tools palette, inspector panel.
|
|
34
|
+
* NOT wired to sdk/ — schema lives in lib/ (canonical stack, engine-agnostic).
|
|
35
|
+
* No coupling to lib/components (would violate the acyclic-import rule).
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { CollisionTypes } from '../../parts/CollisionTypes.js';
|
|
39
|
+
import { CollisionActions } from '../../parts/CollisionActions.js';
|
|
40
|
+
import { wallBehaviorV2ValuesMap as _wallBehaviorV2ValuesMap, bounceDirectionValuesMap as _bounceDirectionValuesMap,
|
|
41
|
+
wallHookValuesMap as _wallHookValuesMap } from '../constants/WallBehaviors.js';
|
|
42
|
+
import * as FrameDataSchema from '../../../shim/frame-data/index.js';
|
|
43
|
+
import * as FieldDescriptorSchema from '../../../shim/field-descriptor/index.js';
|
|
44
|
+
import * as ValueNormalizer from './valueNormalizer.js';
|
|
45
|
+
import { SCOPE_DESCRIPTORS, shapeValuesMap } from './scopes.js';
|
|
46
|
+
import { kindOf, registeredKinds, placeableKinds } from '../kinds.js';
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// ── Imports ───────────────────────────────────────────────────────────────
|
|
50
|
+
// CollisionTypes and CollisionActions are imported BY REFERENCE — NEVER re-listed.
|
|
51
|
+
// Copying them would recreate the Rust-only-divergence bug the frozen sets prevent.
|
|
52
|
+
//
|
|
53
|
+
// FrameDataSchema (SECTION_KEYS + normalizeDataBubble) is imported BY REFERENCE from
|
|
54
|
+
// lib/shim/frame-data — NEVER re-list 'detection'/'render'/'ext' keys here.
|
|
55
|
+
// This mirrors the schema-mirror discipline: one owner per key list (§Engineering Culture).
|
|
56
|
+
|
|
57
|
+
// FieldDescriptorSchema (FIELD_TYPES — the shared field-SHAPE vocabulary) is imported
|
|
58
|
+
// BY REFERENCE from lib/shim/field-descriptor — Studio Controls Realignment §7 r2
|
|
59
|
+
// C1: ONE owner for the field-type vocabulary this file's
|
|
60
|
+
// ~200 field declarations and makeControlsForObject.js's TYPE_DISPATCH both consume.
|
|
61
|
+
// This file's own per-kind field ARRAYS stay UNCHANGED (byte-identical) — only the type
|
|
62
|
+
// vocabulary itself is now shared, asserted below (never a hand-copied comment list).
|
|
63
|
+
|
|
64
|
+
// ── Field type vocabulary ─────────────────────────────────────────────────
|
|
65
|
+
//
|
|
66
|
+
// type:'rect' → the positional write tuple, 4 or 6 elements, in the order
|
|
67
|
+
// valueNormalizer.js::RECT_TUPLE owns (all physics pixels).
|
|
68
|
+
// Omitting z/d is back-compat (engine defaults z=0, d=w).
|
|
69
|
+
// See LargeObject rect field below.
|
|
70
|
+
// type:'rgb' → [r, g, b] (0-255 integers)
|
|
71
|
+
// type:'number' → numeric scalar; constraint: { min?, max?, integer? }
|
|
72
|
+
// type:'boolean' → true | false
|
|
73
|
+
// type:'string' → free string
|
|
74
|
+
// type:'enum' → one value from constraint.values object
|
|
75
|
+
// type:'enum-set' → array of zero or more values from constraint.values object
|
|
76
|
+
// type:'rect-array' → array of rect tuples (source_rects for emitters)
|
|
77
|
+
// type:'readonly' → derived/computed: inspectable but not editable
|
|
78
|
+
//
|
|
79
|
+
// Optional per-field key `unit` (Studio Controls Realignment S2, design §2.2):
|
|
80
|
+
// a machine-readable string ('px', 'px/tick', 'ticks', 'px²', …) for fields whose
|
|
81
|
+
// `description` prose already states a unit. NOT populated en masse — only where
|
|
82
|
+
// the description text already says so (mechanical, not invented). Consumed by
|
|
83
|
+
// `makeControlsForObject` (lib/frqtl/objects/objects/makeControlsForObject.js) to
|
|
84
|
+
// append "(unit)" to a generated control's label. Absence means "no declared unit,"
|
|
85
|
+
// never "unitless" — most number fields simply haven't been swept yet.
|
|
86
|
+
|
|
87
|
+
// ── Shape-vocab ferry (R2-3) ─────────────────────────────────────────────
|
|
88
|
+
// The shell SHAPE selector (LargeObject.shellShape) ferries the canonical shape
|
|
89
|
+
// value set from its ONE owner, lib/shim/frame-data (RENDER_INTENT_VALUES
|
|
90
|
+
// ['render.shape']) — the SAME set the render-level "Default Shape" uses — never a
|
|
91
|
+
// hand-listed enum. frame-data is a static import, so the value set is available at
|
|
92
|
+
// descriptor-build.
|
|
93
|
+
|
|
94
|
+
/** The descriptor `name` resolves to: a registered kind's, else a scope row's, else null. */
|
|
95
|
+
function _descriptor(name) {
|
|
96
|
+
var row = kindOf(name);
|
|
97
|
+
if (row) { return row.descriptor; }
|
|
98
|
+
return Object.prototype.hasOwnProperty.call(SCOPE_DESCRIPTORS, name) ? SCOPE_DESCRIPTORS[name] : null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ── Kind descriptors ──────────────────────────────────────────────────────
|
|
102
|
+
//
|
|
103
|
+
// A kind's descriptor, construction defaults and palette entry TRAVEL WITH ITS CLASS: each part
|
|
104
|
+
// module registers them (objects/kinds.js registerKind) when it is imported, and every read below
|
|
105
|
+
// is a registry read. The SCOPE rows (particle, backdrop, Frame, Universe, Dimension) are the
|
|
106
|
+
// schema's own (schema/scopes.js). The palette presents V2 stock only (rows with a `palette`);
|
|
107
|
+
// backdrop is added through the EFFECTS toggle (runner.addBackdrop), never dropped.
|
|
108
|
+
|
|
109
|
+
// ── Normalizer-row exhaustiveness guard (load time) ───────────────────────
|
|
110
|
+
//
|
|
111
|
+
// The normalizer's row keys must be EXACTLY lib/shim/field-descriptor's FIELD_TYPES —
|
|
112
|
+
// the ONE field-type vocabulary. A type added there without a row (or a row for a type
|
|
113
|
+
// that no longer exists) FAILS LOUD at module load, so the two never drift into
|
|
114
|
+
// "validated in one consumer, unvalidated in another". Skipped (not thrown) when the
|
|
115
|
+
// contract module is genuinely unreachable — the same pointer-fallback discipline the
|
|
116
|
+
// two guards above use.
|
|
117
|
+
if (Array.isArray(FieldDescriptorSchema.FIELD_TYPES)) {
|
|
118
|
+
var _rowKeys = ValueNormalizer.TYPES;
|
|
119
|
+
var _vocab = FieldDescriptorSchema.FIELD_TYPES;
|
|
120
|
+
for (var _vi = 0; _vi < _vocab.length; _vi++) {
|
|
121
|
+
if (_rowKeys.indexOf(_vocab[_vi]) === -1) {
|
|
122
|
+
throw new Error('[lib/frqtl/objects/schema] field type "' + _vocab[_vi] +
|
|
123
|
+
'" is declared in lib/shim/field-descriptor\'s FIELD_TYPES but has no ' +
|
|
124
|
+
'row in valueNormalizer.js\'s VALUE_NORMALIZERS — every declared type ' +
|
|
125
|
+
'must state how a written value is normalized/rejected. (FAIL-LOUD.)');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (var _ri = 0; _ri < _rowKeys.length; _ri++) {
|
|
129
|
+
if (_vocab.indexOf(_rowKeys[_ri]) === -1) {
|
|
130
|
+
throw new Error('[lib/frqtl/objects/schema] valueNormalizer.js declares a row ' +
|
|
131
|
+
'for "' + _rowKeys[_ri] + '", which is not a member of lib/shim/' +
|
|
132
|
+
'field-descriptor\'s FIELD_TYPES ([' + _vocab.join(', ') + ']). The type ' +
|
|
133
|
+
'vocabulary has ONE owner. (FAIL-LOUD.)');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var ObjectSchema = {
|
|
139
|
+
/**
|
|
140
|
+
* get(name) → the descriptor: a kind a module registered in THIS realm (objects/kinds.js),
|
|
141
|
+
* else a scope row (schema/scopes.js), else null.
|
|
142
|
+
*/
|
|
143
|
+
get: function (kind) {
|
|
144
|
+
return _descriptor(kind);
|
|
145
|
+
},
|
|
146
|
+
/** kinds() → every name get() answers, once each: the registered kinds, then the scope rows
|
|
147
|
+
* (a kind registered by reference to its scope row — LargeObject — is listed once). */
|
|
148
|
+
kinds: function () {
|
|
149
|
+
var reg = registeredKinds();
|
|
150
|
+
return reg.concat(Object.keys(SCOPE_DESCRIPTORS).filter(function (n) { return reg.indexOf(n) === -1; }));
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* ux(kind) → the normalized STUDIO UX presentation contract for a kind
|
|
154
|
+
* Runs the descriptor's declared `ux:{}` block (or absence)
|
|
155
|
+
* through lib/shim/field-descriptor's normalizeUx, so a caller ALWAYS gets
|
|
156
|
+
* the full bag { resizable, draggable, handles, shellRender }
|
|
157
|
+
* with legacy defaults filled (R6 — no block ⇒ today's behavior). Consumers
|
|
158
|
+
* (STUDIO's overlay + Inspector, a headless game) FERRY this — they never
|
|
159
|
+
* re-derive the vocabulary. Returns the legacy-default bag when the field-
|
|
160
|
+
* descriptor contract is unreachable OR the kind is unknown (never throws
|
|
161
|
+
* on a read — the write-time normalize guard above is the fail-loud gate).
|
|
162
|
+
* @param {string} kind
|
|
163
|
+
* @returns {{resizable:boolean, draggable:object, handles:string[], shellRender:string}}
|
|
164
|
+
*/
|
|
165
|
+
ux: function (kind) {
|
|
166
|
+
var descriptor = _descriptor(kind);
|
|
167
|
+
var raw = descriptor ? descriptor.ux : undefined;
|
|
168
|
+
if (typeof FieldDescriptorSchema.normalizeUx === 'function') {
|
|
169
|
+
return FieldDescriptorSchema.normalizeUx(raw);
|
|
170
|
+
}
|
|
171
|
+
// Field-descriptor unreachable — inline legacy default (mirrors normalizeUx's
|
|
172
|
+
// no-block branch). Never throws on a read.
|
|
173
|
+
return {
|
|
174
|
+
resizable: true,
|
|
175
|
+
draggable: { '2d': true },
|
|
176
|
+
handles: null, // null ⇒ "all zones" for a consumer without the vocab
|
|
177
|
+
shellRender: 'design'
|
|
178
|
+
};
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* Returns the schema-driven palette catalog: an array of PlaceableEntry objects.
|
|
182
|
+
* Each entry: { kind, displayName, description, category, iconHint, defaultProps }.
|
|
183
|
+
* This is the ONLY source a palette component should use — never hardcode kind names in UI.
|
|
184
|
+
*
|
|
185
|
+
* @returns {Array<{kind:string, displayName:string, description:string,
|
|
186
|
+
* category:string, iconHint:string, defaultProps:Object}>}
|
|
187
|
+
*/
|
|
188
|
+
placeableCatalog: function () {
|
|
189
|
+
return placeableKinds().map(function (row) {
|
|
190
|
+
return {
|
|
191
|
+
kind: row.name,
|
|
192
|
+
displayName: row.palette.displayName,
|
|
193
|
+
description: row.descriptor.description,
|
|
194
|
+
category: row.palette.category,
|
|
195
|
+
iconHint: row.palette.iconHint,
|
|
196
|
+
defaultProps: row.defaults
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* defaultPropsFor(kind) → the kind's default construction props, or `{}`.
|
|
202
|
+
*
|
|
203
|
+
* The ONE read path for construction defaults (the `defaults` a kind registers with).
|
|
204
|
+
* ObjectFactory._mergeProps ferries this bag; it does NOT scan
|
|
205
|
+
* placeableCatalog(), because the palette answers "what can be DROPPED in
|
|
206
|
+
* STUDIO" while this answers "what does a kind construct with" — two
|
|
207
|
+
* different questions that used to share one list. A kind retired from the
|
|
208
|
+
* palette keeps constructing identically through a recipe.
|
|
209
|
+
*
|
|
210
|
+
* Returns the live bag by reference (same contract as placeableCatalog()'s
|
|
211
|
+
* entries: callers must not mutate it — _mergeProps copies).
|
|
212
|
+
* @param {string} kind
|
|
213
|
+
* @returns {object}
|
|
214
|
+
*/
|
|
215
|
+
defaultPropsFor: function (kind) {
|
|
216
|
+
var row = kindOf(kind);
|
|
217
|
+
return (row && row.defaults) ? row.defaults : {};
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* The declared-type write gate: `normalizeValue(fieldDef, value, kind?)` returns
|
|
221
|
+
* the value in its declared canonical form or THROWS naming kind/field/expected
|
|
222
|
+
* type (throw-or-apply). Implemented by the sibling `valueNormalizer.js` (the
|
|
223
|
+
* per-type contract table lives there); exposed HERE so there is ONE public
|
|
224
|
+
* entry point, which every consumer — the accessor
|
|
225
|
+
* (FrqtlApp.updateObjectProperty) and the controls factory's read-side
|
|
226
|
+
* validity probe — FERRIES rather than re-implementing per type.
|
|
227
|
+
*/
|
|
228
|
+
normalizeValue: ValueNormalizer.normalizeValue,
|
|
229
|
+
// The ONE world-rect normalizer (valueNormalizer.js::worldRect): `{left,top,w,h}`
|
|
230
|
+
// or the rect tuple → `{w,h,…}`, THROWING on a missing/non-positive dimension.
|
|
231
|
+
worldRect: ValueNormalizer.worldRect,
|
|
232
|
+
// THE rect write-tuple order (valueNormalizer.js::RECT_TUPLE) and its text form — every
|
|
233
|
+
// description below that spells a tuple is BUILT from rectTupleText.
|
|
234
|
+
RECT_TUPLE: ValueNormalizer.RECT_TUPLE,
|
|
235
|
+
rectTupleText: ValueNormalizer.rectTupleText,
|
|
236
|
+
// The field-TYPE vocabulary, FERRIED by reference from its ONE owner
|
|
237
|
+
// (lib/shim/field-descriptor) so a consumer that already holds ObjectSchema can
|
|
238
|
+
// drive a table off it without a second import — never a re-listed copy. Falls
|
|
239
|
+
// back to the normalizer row keys when the contract module is unreachable (the
|
|
240
|
+
// load-time guard above proves the two sets are identical whenever it IS
|
|
241
|
+
// reachable), so a consumer always gets the vocabulary, never undefined.
|
|
242
|
+
FIELD_TYPES: FieldDescriptorSchema.FIELD_TYPES,
|
|
243
|
+
// Exposed by reference so tests can assert identity (not copies).
|
|
244
|
+
CollisionTypes: CollisionTypes,
|
|
245
|
+
CollisionActions: CollisionActions,
|
|
246
|
+
// FrameDataSchema reference — the bubble sub-shape authority (lib/shim/frame-data).
|
|
247
|
+
FrameDataSchema: FrameDataSchema,
|
|
248
|
+
// FieldDescriptorSchema reference — the shared field-shape/type-vocabulary authority
|
|
249
|
+
// (lib/shim/field-descriptor, §7 r2 C1).
|
|
250
|
+
FieldDescriptorSchema: FieldDescriptorSchema
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export {
|
|
254
|
+
ObjectSchema,
|
|
255
|
+
shapeValuesMap
|
|
256
|
+
};
|