@vincentt-xr/sdk 2.0.0-alpha.16 → 2.0.0-alpha.18

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 (78) hide show
  1. package/GROUNDING.md +224 -1
  2. package/components.json +144 -0
  3. package/dist/{CanonicalHeadFrame-vn-jM9fG.js → CanonicalHeadFrame-CQe2YX9a.js} +3 -3
  4. package/dist/{DebuggerUI-DDpU-nBF.js → DebuggerUI-CKYrYmod.js} +1 -1
  5. package/dist/{FaceRetouch-D2xH5OpW.js → FaceRetouch-l7y4oZBu.js} +4 -4
  6. package/dist/Scenes-BX0bR1j4.js +44 -0
  7. package/dist/Scenes-Dtt8UGE8.cjs +1 -0
  8. package/dist/{TextLabel-DPJBtkUS.cjs → TextLabel-C-AibH5A.cjs} +1 -1
  9. package/dist/{TextLabel--skGFws8.js → TextLabel-fEF1o3wE.js} +1 -1
  10. package/dist/audio/AudioPlayer.d.ts +2 -1
  11. package/dist/{bodyMaskMaterial-C3aXItLo.js → bodyMaskMaterial-BOdSJUEM.js} +1 -1
  12. package/dist/{cache-C85JjyZA.js → cache-Mu-VO_6E.js} +2 -2
  13. package/dist/components/Button/index.d.ts +23 -0
  14. package/dist/components/Button/safeLink.d.ts +6 -0
  15. package/dist/components/HtmlRegion/index.d.ts +8 -0
  16. package/dist/components/Model/index.d.ts +16 -0
  17. package/dist/components/Object3D/index.d.ts +13 -0
  18. package/dist/components/ScreenImage/types.d.ts +2 -2
  19. package/dist/components/ScreenText/types.d.ts +2 -1
  20. package/dist/components/ThemeProvider/index.d.ts +24 -0
  21. package/dist/components/index.d.ts +4 -0
  22. package/dist/{contexts-B5GODwuV.js → contexts-Cl-4dUOI.js} +2 -2
  23. package/dist/debug-ui/media-source.js +1 -1
  24. package/dist/debug-ui.cjs +1 -1
  25. package/dist/debug-ui.js +11 -11
  26. package/dist/{drawNormalizedCrop-BLfB484W.js → drawNormalizedCrop-D606u5-F.js} +5 -5
  27. package/dist/editor-defs/definitions.d.ts +2 -0
  28. package/dist/editor-defs/index.d.ts +3 -0
  29. package/dist/editor-defs/types.d.ts +54 -0
  30. package/dist/editor-sample/sample.d.ts +15 -0
  31. package/dist/editor-scenes.cjs +1 -0
  32. package/dist/editor-scenes.js +59 -0
  33. package/dist/entries/core.d.ts +12 -0
  34. package/dist/entries/editor-scenes.d.ts +8 -0
  35. package/dist/face-effects.js +17 -17
  36. package/dist/{getFaceInfo-D_tCSQC7.js → getFaceInfo-Mt44zlej.js} +1 -1
  37. package/dist/{index-B9DdHE4u.js → index-B0EYdofX.js} +1 -1
  38. package/dist/{index-jkUdoklh.cjs → index-B5X4N2tc.cjs} +3 -3
  39. package/dist/{index-CTqQJj5p.js → index-BDxJWWyy.js} +85 -85
  40. package/dist/{index-nRQNXOVk.cjs → index-BkjRuUdW.cjs} +1 -1
  41. package/dist/{index-DlP4xxaT.js → index-Bn72laBn.js} +4 -4
  42. package/dist/{index-D10O6vqR.js → index-CbBCl2ZU.js} +2 -2
  43. package/dist/{index-CNt8esFO.js → index-CicO_Tnw.js} +1 -1
  44. package/dist/{index-YI3Yidg_.js → index-D5NbXaCn.js} +5 -5
  45. package/dist/{index-DJkmBF-0.js → index-DN_eHnag.js} +203 -197
  46. package/dist/instructions.cjs +1 -1
  47. package/dist/instructions.js +8 -8
  48. package/dist/{internal-TD4QhIry.js → internal-BoFDq5hC.js} +3 -3
  49. package/dist/internal.js +2 -2
  50. package/dist/{landmarks-vLy5QKt6.js → landmarks-C3LvDhMt.js} +1 -1
  51. package/dist/low-level.js +17 -17
  52. package/dist/main.cjs +1 -1
  53. package/dist/main.js +932 -746
  54. package/dist/particles.js +5 -5
  55. package/dist/product.js +2 -2
  56. package/dist/{providers-DmJlgrDD.js → providers-Bxt_MfPK.js} +3 -3
  57. package/dist/{renderGroups-BcQYy_J2.js → renderGroups-uYPzUa66.js} +1 -1
  58. package/dist/{renderPasses-DIPTIU_x.js → renderPasses-C0wu5Cwg.js} +4 -4
  59. package/dist/scene-object.cjs +1 -1
  60. package/dist/scene-object.js +2 -2
  61. package/dist/scenes/Scenes.d.ts +44 -0
  62. package/dist/scenes/edit.d.ts +37 -0
  63. package/dist/{segmentation-CZs5aVvY.js → segmentation-DccvYBBO.js} +9 -9
  64. package/dist/{selectors-K5JKCWxw.js → selectors-J06V0eDb.js} +1 -1
  65. package/dist/{session-DHBNTyJJ.js → session-CYiWfcvz.js} +1 -1
  66. package/dist/tracking.js +25 -25
  67. package/dist/{trigger-BwZ81ENx.js → trigger-CQviD4xp.js} +155 -155
  68. package/dist/{useBodies-BMKHXAOL.js → useBodies-DOuwRuew.js} +2 -2
  69. package/dist/{useEditOverrides-DpPTA6BW.js → useEditOverrides-BBkK8cN2.js} +1 -0
  70. package/dist/useEditOverrides-CgapHJzA.cjs +1 -0
  71. package/dist/{useFaceInfo-BNVdnprN.js → useFaceInfo-XUGYTdfN.js} +4 -4
  72. package/dist/{useFaceResultReader-B15wn6RB.js → useFaceResultReader-D8wXbF1L.js} +1 -1
  73. package/dist/{useIrisTracking-CYm-KDIZ.js → useIrisTracking-B0uLWgNE.js} +10 -10
  74. package/dist/{useXRCapabilities-ClWlG5_Y.js → useXRCapabilities-DPUOvpdf.js} +1 -1
  75. package/dist/utils/useEditOverrides.d.ts +1 -0
  76. package/package.json +11 -2
  77. package/settings.json +2 -1
  78. package/dist/useEditOverrides-C8Kzr6M7.cjs +0 -1
package/GROUNDING.md CHANGED
@@ -10,7 +10,7 @@ or spelunk `node_modules` for the API.
10
10
  The API is split into task-domain entry points. Import each symbol from the door
11
11
  this reference shows for it; the imports here are literal.
12
12
 
13
- - `@vincentt-xr/sdk` — **core**: providers, scene, screen-space layout, runtime renderers (`Transform3D`, `MeshRenderer`, `SceneObjectRenderer`), `TextLabel`, `Panel`, `SpriteAnimation`, `VideoBackground`, `AspectRatioContainer`, capture/share (`useFrameCapture`, `useMediaRecorder`, `dataURLtoFile`), audio, capability detection (`useXRCapabilities`, `detectXRCapabilities`, `resolveTrackerSupport`), camera permission (`CameraPermissionGate`, `useCameraPermission`), adaptive quality (`useXRQuality`, `XRQualityController`), persistent tracking config (`useXRTrackingConfig`), asset lifecycle (`useXRAsset`, `XRAssetCache`, `defineTextureAsset` / `defineGltfAsset` / `defineVideoAsset`).
13
+ - `@vincentt-xr/sdk` — **core**: providers, scene, `Scenes` / `Scene` (screens the editor can jump between), screen-space layout, runtime renderers (`Transform3D`, `MeshRenderer`, `SceneObjectRenderer`), `TextLabel`, `Panel`, `SpriteAnimation`, `VideoBackground`, `AspectRatioContainer`, capture/share (`useFrameCapture`, `useMediaRecorder`, `dataURLtoFile`), audio, capability detection (`useXRCapabilities`, `detectXRCapabilities`, `resolveTrackerSupport`), camera permission (`CameraPermissionGate`, `useCameraPermission`), adaptive quality (`useXRQuality`, `XRQualityController`), persistent tracking config (`useXRTrackingConfig`), asset lifecycle (`useXRAsset`, `XRAssetCache`, `defineTextureAsset` / `defineGltfAsset` / `defineVideoAsset`).
14
14
  - `@vincentt-xr/sdk/scene-object` — **public authoring state**: scene-object/component types, factories, selectors, and immutable store operations.
15
15
  - `@vincentt-xr/sdk/tracking` — **trackers**: face/hand/gesture/body/holistic/segmentation, `TrackingAnchor`, `GestureTrigger`, full-body pose / move triggers (`BodyTrigger`, `useBodyTrigger`), the bare `FaceMesh`, `useFaceResults`, gestures, iris, device calibration (`useXRCalibration`), multi-subject policy (`selectSubject`, `useFaceInfo({ subject })`), the hand rig and hand try-on (`HandRig`, `HandOccluder`, `HandAttachment`, `WristAttachment`, `ForearmOccluder`, `HandTattoo`, `HandNails`), touch objects (`HandTouch`, `Touchable`), the SDK-hosted hand, glove and body models (`sdkModelAsset`), the body avatar (`BodyRig`), body occlusion and attachments (`BodyOccluder`, `BodyAttachment`), the body's depth for shaders (`useBodyDepthTexture`), 3D body poses (`BodyPose`) and up to two people with stable ids (`useBodyIds`, `useBodySubject`, `bodyId` / `subject` on every body feature).
16
16
  - `@vincentt-xr/sdk/instructions` — **instructions**: prompts that ask for a hand gesture, face expression or body pose with a 3D hint and your copy (`HandInstruction`, `FaceInstruction`, `BodyInstruction`), the generic `Instruction` layout, the detector hooks (`useHandGesture`, `useFaceExpression`, `useBodyPose`, `useInstructionHold`), the vocabularies + `define*` helpers + pure classifiers, and the hint kit (`useGhostModel`, `HintStage`, `sampleHintLoop`, blends, ghost materials).
@@ -251,6 +251,49 @@ the component's own props object, before destructuring.
251
251
 
252
252
  ---
253
253
 
254
+ ## Scenes and editable shape
255
+
256
+ ### `<Scenes>` / `<Scene>` — screens the editor can jump between (core)
257
+
258
+ ```tsx
259
+ import { Scene, Scenes } from "@vincentt-xr/sdk";
260
+
261
+ const [scene, setScene] = useState("start");
262
+
263
+ <Scenes current={scene}>
264
+ <Scene id="start" label="Start">
265
+ <StartScreen onPlay={() => setScene("game")} />
266
+ </Scene>
267
+ <Scene id="game" label="Game">
268
+ <GameScreen />
269
+ </Scene>
270
+ <Scene id="result" label="Result">
271
+ <ResultScreen />
272
+ </Scene>
273
+ </Scenes>;
274
+ ```
275
+
276
+ - `Scenes` renders the one child `Scene` whose `id` equals `current`, and nothing when none matches. Only `Scene` children count (through fragments); anything else inside `Scenes` is ignored.
277
+ - Flow is the app's own state. `Scenes` holds no state and has no transition API; change `current` to move.
278
+ - Use `Scenes` once in the 3D tree (inside `<Canvas>`) and once in the HTML tree, each with the same ids. A scene present in only one tree is fine.
279
+ - `id` is the name code and comments refer to. Give it lowercase letters, digits, `-` or `_` (1 to 64). It is not editable in the editor and never changes when a creator renames a scene.
280
+ - `label` is the name shown in the editor's scene list; the editor edits only `label`.
281
+ - A published app renders exactly the switch above. The editor's own build swaps in a `Scenes` that can show a chosen scene and catches a scene that throws; app code never imports it (`@vincentt-xr/sdk/editor-scenes` is not for app authors) and must not read `__VCT_EDIT_OVERRIDES__`.
282
+
283
+ ### Editable shape — how to write a project the visual editor can edit
284
+
285
+ The editor reads source, so the shape of the code decides what a creator can change.
286
+
287
+ - **Settings live in the schema file.** Put every number, string, colour and list a creator may tune in `src/settings.ts` (a zod schema plus the `settings` values), and read it from there. Never hard-code a count, duration, label or colour in a component.
288
+ - **Each scene renders on its own.** A `Scene` must render with no earlier scene having run, using the sample values from `settings`. The editor opens any scene directly; a scene that needs state from another one fails to open.
289
+ - **Spawned objects are a component in `.map()`.** Render each kind as `settings.fruits.map((f) => <FallingFruit key={f.name} {...f} />)` and declare the list's varieties in the schema with `.meta({ varietiesOf: "FallingFruit" })`.
290
+ - **Theme goes in one schema group.** Put app-wide colours and fonts in one object marked `.meta({ kind: "theme" })` (for example `theme: z.object({ brand: z.string().meta({ kind: "colour" }), headingFont: z.enum(["Inter", "Georgia"]) }).meta({ kind: "theme" })`) and wrap the app in `<ThemeProvider theme={settings.theme}>` (`import { ThemeProvider } from "@vincentt-xr/sdk"`). Each value becomes a `--vincentt-*` CSS variable (`brand` -> `--vincentt-brand`, `headingFont` -> `--vincentt-heading-font`); read it with `var(--vincentt-brand)`. Only colours, lengths and font lists are accepted. The editor lists the group as "Theme" with no per-use count.
291
+ - **Style with Tailwind classes** in a literal `className`. No CSS files and no inline `style` for anything a creator would change.
292
+ - **Plain file paths.** Import with relative or plain paths; no glob imports, no computed dynamic `import()`.
293
+ - **Check your work.** Run `vincentt editor --check` and fix everything it lists that you can, until what remains is code only.
294
+
295
+ ---
296
+
254
297
  ## Screen-space layout (the primary tool)
255
298
 
256
299
  Most Vincentt projects use screen-space UI: decorative frames, prompts, badges, controls — overlaid on the live camera feed. This is more common than world-space landmark attachment.
@@ -8766,3 +8809,183 @@ const player = useRef<AudioPlayerHandle>(null);
8766
8809
 
8767
8810
  // From a user gesture: player.current?.play(), .pause(), or .stop().
8768
8811
  ```
8812
+
8813
+ <!-- editable-components:start (generated by pnpm components:generate) -->
8814
+
8815
+ ## Editable components
8816
+
8817
+ The editor lists only the components below, imported by name from the package shown. Text, images,
8818
+ sounds and models a person may change go in these components, as literal values
8819
+ (`text="Hello"`, not `text={copy}`).
8820
+
8821
+ Props on every component here: `name` (a literal string; the label the editor shows) and
8822
+ `locked` (literal `true` keeps the part out of the editor; anything else counts as locked).
8823
+ Neither changes how the app renders. Status, error, timer and debug text stays plain code.
8824
+
8825
+ ### Declared settings
8826
+
8827
+ Declare editable values in `src/settings.ts` with `import * as z from "zod/mini"`, e.g.
8828
+ `z.string().check(z.minLength(1), z.maxLength(80), z.meta({ label: "Title" }))`.
8829
+ Classic `zod` also parses but costs about 87 KB gzip at first visit; use `zod/mini`.
8830
+
8831
+ ### Self-check
8832
+
8833
+ After editing, run `vincentt editor --check --json` and fix every item it reports, then run it
8834
+ again until it reports none. Each item has a `code`, a `component`, a `file` and a `line`.
8835
+
8836
+ | Code | Meaning | Fix |
8837
+ | --------------------------------- | --------------------------------------------- | -------------------------------------------------------- |
8838
+ | `unnamed` | The part has no `name` | Add a literal `name="..."` |
8839
+ | `from_code.computed` | A value is built by an expression | Write the value as a literal |
8840
+ | `from_code.constant` | A value is read from a constant | Write the value in the prop |
8841
+ | `from_code.imported` | A value is imported from another file | Write the value in the prop |
8842
+ | `from_code.conditional` | A value depends on a condition | Use one literal; keep the condition around the component |
8843
+ | `from_code.spread_after` | A later `{...props}` can override the prop | Move the literal after the spread |
8844
+ | `not_recognized.namespace_import` | `import * as` was used | Use a named import |
8845
+ | `not_recognized.reexported` | Imported through a project file | Import from the package itself |
8846
+ | `not_recognized.wrapped` | A project wrapper stands in for the component | Use the component directly |
8847
+ | `not_recognized.sdk_missing` | The SDK is not a declared dependency | Add `@vincentt-xr/sdk` and install |
8848
+ | `not_recognized.sdk_too_old` | The installed SDK has no components list | Update `@vincentt-xr/sdk` |
8849
+
8850
+ ### `<AudioPlayer>` - Sound
8851
+
8852
+ Import: `import { AudioPlayer } from "@vincentt-xr/sdk"`.
8853
+ Headless sound. Edit `src`, `volume` (0 to 100) and `playMode` (once, loop or infinite); it draws nothing.
8854
+
8855
+ | Prop | Label | Control |
8856
+ | ---------- | ------ | -------------------------------- |
8857
+ | `src` | Sound | file, accepts audio |
8858
+ | `volume` | Volume | number, 0..100, % |
8859
+ | `playMode` | Loop | choice, once or loop or infinite |
8860
+
8861
+ Insert:
8862
+
8863
+ ```tsx
8864
+ <AudioPlayer src="/audio/sound.mp3" />
8865
+ ```
8866
+
8867
+ ### `<Button>` - Button
8868
+
8869
+ Import: `import { Button } from "@vincentt-xr/sdk"`.
8870
+ A page button. Edit `label`; give it a `link` (https, http or mailto) to open, or write `onTap` code. A button with neither is listed as Not wired yet.
8871
+
8872
+ | Prop | Label | Control |
8873
+ | --------- | ----------- | ----------------------- |
8874
+ | `label` | Label | shortText, max 40 chars |
8875
+ | `link` | Link | link, max 2048 chars |
8876
+ | `onTap` | When tapped | code |
8877
+ | `color` | Colour | colour |
8878
+ | `visible` | Show | switch |
8879
+
8880
+ Insert:
8881
+
8882
+ ```tsx
8883
+ <Button label="Button" />
8884
+ ```
8885
+
8886
+ ### `<HtmlRegion>` - Text block
8887
+
8888
+ Import: `import { HtmlRegion } from "@vincentt-xr/sdk"`.
8889
+ A block of page markup (p, h1-h6, span, lists, links). The editor lists its text pieces; `name` and `locked` are editor-only and change nothing in the published app. Pass `className` for styling.
8890
+
8891
+ | Prop | Label | Control |
8892
+ | ---- | ----- | ------- |
8893
+
8894
+ Insert:
8895
+
8896
+ ```tsx
8897
+ <HtmlRegion />
8898
+ ```
8899
+
8900
+ ### `<Model>` - Model
8901
+
8902
+ Import: `import { Model } from "@vincentt-xr/sdk"`.
8903
+ A 3D model. Edit the `src` prop; a literal project path or library URL shows in the editor. Move it with `position={{ x, y, z }}`, `rotation={{ x, y, z }}` (degrees) and `scale={{ x, y, z }}` written as literal numbers; the editor drags those.
8904
+ Placement: position3.
8905
+
8906
+ | Prop | Label | Control |
8907
+ | ----- | ----- | ------------------- |
8908
+ | `src` | Model | file, accepts model |
8909
+
8910
+ Insert:
8911
+
8912
+ ```tsx
8913
+ <Model />
8914
+ ```
8915
+
8916
+ ### `<Object3D>` - 3D object
8917
+
8918
+ Import: `import { Object3D } from "@vincentt-xr/sdk"`.
8919
+ Wraps react-three-fiber children. `colour` and `texture` apply to every child mesh material, `size` scales uniformly, `visible` shows or hides. The editor lists only the props present in the tag; position, rotation and scale stay in code.
8920
+
8921
+ | Prop | Label | Control |
8922
+ | --------- | ------- | ------------------- |
8923
+ | `colour` | Colour | colour |
8924
+ | `texture` | Texture | file, accepts image |
8925
+ | `size` | Size | number, 0.. |
8926
+ | `visible` | Show | switch |
8927
+
8928
+ Insert:
8929
+
8930
+ ```tsx
8931
+ <Object3D />
8932
+ ```
8933
+
8934
+ ### `<Scene>` - Scene
8935
+
8936
+ Import: `import { Scene } from "@vincentt-xr/sdk"`.
8937
+ A screen the editor can jump to, inside <Scenes current>. `sample`, `overlay`, `open` and `over` are literals the editor reads; they change nothing in the published app. Read sample values with `useSceneSample(key, real)`.
8938
+
8939
+ | Prop | Label | Control |
8940
+ | --------- | ------------------------ | ----------------------- |
8941
+ | `label` | Scene name | shortText, max 60 chars |
8942
+ | `sample` | Sample values | code |
8943
+ | `overlay` | Opens over another scene | switch |
8944
+ | `open` | Open | switch |
8945
+ | `over` | Over scene | shortText, max 64 chars |
8946
+
8947
+ Insert:
8948
+
8949
+ ```tsx
8950
+ <Scene id="scene" label="Blank scene" />
8951
+ ```
8952
+
8953
+ ### `<ScreenImage>` - Image
8954
+
8955
+ Import: `import { ScreenImage } from "@vincentt-xr/sdk"`.
8956
+ Screen-space image. Edit the `src` prop; a literal project path or library URL shows in the editor.
8957
+ Placement: transform.
8958
+
8959
+ | Prop | Label | Control |
8960
+ | ----- | ----- | ------------------- |
8961
+ | `src` | Image | file, accepts image |
8962
+
8963
+ Insert:
8964
+
8965
+ ```tsx
8966
+ <ScreenImage transform={{ position: { x: 0, y: 0 }, size: { width: 300, height: 300 } }} />
8967
+ ```
8968
+
8969
+ ### `<ScreenText>` - Text
8970
+
8971
+ Import: `import { ScreenText } from "@vincentt-xr/sdk"`.
8972
+ Screen-space text. Edit the `text` prop; a literal string shows in the editor.
8973
+ Placement: screenTransform.
8974
+
8975
+ | Prop | Label | Control |
8976
+ | ----------- | ----------- | ------------------------------- |
8977
+ | `text` | Text | longText, max 500 chars |
8978
+ | `color` | Text colour | colour |
8979
+ | `fontSize` | Font size | number, 1.., px |
8980
+ | `textAlign` | Text align | choice, left or center or right |
8981
+
8982
+ Insert:
8983
+
8984
+ ```tsx
8985
+ <ScreenText
8986
+ text="Your text"
8987
+ screenTransform={{ position: { x: 0, y: 0 }, size: { width: 600, height: 120 } }}
8988
+ />
8989
+ ```
8990
+
8991
+ <!-- editable-components:end -->
@@ -0,0 +1,144 @@
1
+ {
2
+ "schema": "vincentt.components/1",
3
+ "package": "@vincentt-xr/sdk",
4
+ "version": "2.0.0-alpha.18",
5
+ "components": {
6
+ "AudioPlayer": {
7
+ "kind": "sound",
8
+ "label": "Sound",
9
+ "tree": "3d",
10
+ "from": "@vincentt-xr/sdk",
11
+ "nameFrom": "file",
12
+ "props": {
13
+ "src": { "control": "file", "label": "Sound", "accept": "audio" },
14
+ "volume": {
15
+ "control": "number",
16
+ "label": "Volume",
17
+ "showWhenAbsent": true,
18
+ "min": 0,
19
+ "max": 100,
20
+ "step": 1,
21
+ "unit": "%"
22
+ },
23
+ "playMode": {
24
+ "control": "choice",
25
+ "label": "Loop",
26
+ "showWhenAbsent": true,
27
+ "options": ["once", "loop", "infinite"]
28
+ }
29
+ },
30
+ "insert": { "jsx": "<AudioPlayer src=\"/audio/sound.mp3\" />", "asset": "audio" }
31
+ },
32
+ "Button": {
33
+ "kind": "button",
34
+ "label": "Button",
35
+ "tree": "html",
36
+ "from": "@vincentt-xr/sdk",
37
+ "nameFrom": "label",
38
+ "props": {
39
+ "label": { "control": "shortText", "label": "Label", "maxLength": 40 },
40
+ "link": { "control": "link", "label": "Link", "maxLength": 2048 },
41
+ "onTap": { "control": "code", "label": "When tapped" },
42
+ "color": { "control": "colour", "label": "Colour", "group": "Style" },
43
+ "visible": { "control": "switch", "label": "Show", "showWhenAbsent": true }
44
+ },
45
+ "insert": { "jsx": "<Button label=\"Button\" />" }
46
+ },
47
+ "HtmlRegion": {
48
+ "kind": "region",
49
+ "label": "Text block",
50
+ "tree": "html",
51
+ "from": "@vincentt-xr/sdk",
52
+ "nameFrom": "fixed",
53
+ "props": {},
54
+ "insert": { "jsx": "<HtmlRegion />" }
55
+ },
56
+ "Model": {
57
+ "kind": "model",
58
+ "label": "Model",
59
+ "tree": "3d",
60
+ "from": "@vincentt-xr/sdk",
61
+ "nameFrom": "file",
62
+ "place": "position3",
63
+ "props": { "src": { "control": "file", "label": "Model", "accept": "model" } },
64
+ "insert": { "jsx": "<Model />", "asset": "model" }
65
+ },
66
+ "Object3D": {
67
+ "kind": "object3d",
68
+ "label": "3D object",
69
+ "tree": "3d",
70
+ "from": "@vincentt-xr/sdk",
71
+ "nameFrom": "fixed",
72
+ "exposeByPresence": true,
73
+ "props": {
74
+ "colour": { "control": "colour", "label": "Colour" },
75
+ "texture": { "control": "file", "label": "Texture", "accept": "image" },
76
+ "size": { "control": "number", "label": "Size", "min": 0, "step": 0.1 },
77
+ "visible": { "control": "switch", "label": "Show" }
78
+ },
79
+ "insert": { "jsx": "<Object3D />" }
80
+ },
81
+ "Scene": {
82
+ "kind": "scene",
83
+ "label": "Scene",
84
+ "tree": "both",
85
+ "from": "@vincentt-xr/sdk",
86
+ "nameFrom": "label",
87
+ "props": {
88
+ "label": { "control": "shortText", "label": "Scene name", "maxLength": 60 },
89
+ "sample": { "control": "code", "label": "Sample values", "group": "Preview" },
90
+ "overlay": { "control": "switch", "label": "Opens over another scene", "group": "Preview" },
91
+ "open": { "control": "switch", "label": "Open", "group": "Preview" },
92
+ "over": {
93
+ "control": "shortText",
94
+ "label": "Over scene",
95
+ "group": "Preview",
96
+ "maxLength": 64
97
+ }
98
+ },
99
+ "insert": { "jsx": "<Scene id=\"scene\" label=\"Blank scene\" />" }
100
+ },
101
+ "ScreenImage": {
102
+ "kind": "image",
103
+ "label": "Image",
104
+ "tree": "3d",
105
+ "from": "@vincentt-xr/sdk",
106
+ "nameFrom": "file",
107
+ "place": "transform",
108
+ "props": { "src": { "control": "file", "label": "Image", "accept": "image" } },
109
+ "insert": {
110
+ "jsx": "<ScreenImage transform={{ position: { x: 0, y: 0 }, size: { width: 300, height: 300 } }} />",
111
+ "asset": "image"
112
+ }
113
+ },
114
+ "ScreenText": {
115
+ "kind": "text",
116
+ "label": "Text",
117
+ "tree": "3d",
118
+ "from": "@vincentt-xr/sdk",
119
+ "nameFrom": "text",
120
+ "place": "screenTransform",
121
+ "props": {
122
+ "text": { "control": "longText", "label": "Text", "maxLength": 500 },
123
+ "color": { "control": "colour", "label": "Text colour", "group": "Style" },
124
+ "fontSize": {
125
+ "control": "number",
126
+ "label": "Font size",
127
+ "group": "Style",
128
+ "min": 1,
129
+ "step": 1,
130
+ "unit": "px"
131
+ },
132
+ "textAlign": {
133
+ "control": "choice",
134
+ "label": "Text align",
135
+ "group": "Style",
136
+ "options": ["left", "center", "right"]
137
+ }
138
+ },
139
+ "insert": {
140
+ "jsx": "<ScreenText text=\"Your text\" screenTransform={{ position: { x: 0, y: 0 }, size: { width: 600, height: 120 } }} />"
141
+ }
142
+ }
143
+ }
144
+ }
@@ -2,9 +2,9 @@ import { jsx as _ } from "react/jsx-runtime";
2
2
  import { useCallback as H, useRef as S, createContext as g } from "react";
3
3
  import { useThree as h } from "@react-three/fiber";
4
4
  import * as l from "three";
5
- import { j as w, n as d } from "./index-CTqQJj5p.js";
6
- import { u as P } from "./index-D10O6vqR.js";
7
- import { b as y } from "./selectors-K5JKCWxw.js";
5
+ import { j as w, n as d } from "./index-BDxJWWyy.js";
6
+ import { u as P } from "./index-CbBCl2ZU.js";
7
+ import { b as y } from "./selectors-J06V0eDb.js";
8
8
  import { s as M } from "./similarityFit-Bbz-R8AY.js";
9
9
  import { L as k, u as v } from "./useLandmarkPoseFit-Bmb3h6Mw.js";
10
10
  const Y = /* @__PURE__ */ Float32Array.from([
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as n, Fragment as u } from "react/jsx-runtime";
2
2
  import { useState as k, useEffect as w } from "react";
3
3
  import { createPortal as R } from "react-dom";
4
- import { f as i } from "./internal-TD4QhIry.js";
4
+ import { f as i } from "./internal-BoFDq5hC.js";
5
5
  const v = {
6
6
  position: "fixed",
7
7
  top: "10px",
@@ -1,12 +1,12 @@
1
- import { F as v, a as q, b as B, c as N, d as J, e as d, f as R } from "./renderPasses-DIPTIU_x.js";
1
+ import { F as v, a as q, b as B, c as N, d as J, e as d, f as R } from "./renderPasses-C0wu5Cwg.js";
2
2
  import * as S from "three";
3
3
  import { jsx as _, jsxs as ge } from "react/jsx-runtime";
4
4
  import { useMemo as M, useEffect as Q } from "react";
5
- import { j as fe } from "./index-CTqQJj5p.js";
6
- import { u as be } from "./landmarks-vLy5QKt6.js";
5
+ import { j as fe } from "./index-BDxJWWyy.js";
6
+ import { u as be } from "./landmarks-C3LvDhMt.js";
7
7
  import { F as ve, r as Se, a as ye } from "./renderState-CJNmj5jz.js";
8
8
  import { useThree as ke, useFrame as xe } from "@react-three/fiber";
9
- import { c as Ee } from "./selectors-K5JKCWxw.js";
9
+ import { c as Ee } from "./selectors-J06V0eDb.js";
10
10
  import { f as Me } from "./FaceSurface-DmP9AEeC.js";
11
11
  import { c as Re, d as we } from "./landmarkMask-DHivVjJm.js";
12
12
  const ht = [
@@ -0,0 +1,44 @@
1
+ import { jsx as s, Fragment as c } from "react/jsx-runtime";
2
+ import { createContext as u, useContext as p, Children as a, isValidElement as f, Fragment as l } from "react";
3
+ const m = u(null);
4
+ function g(t) {
5
+ if (!(typeof t != "object" || t === null || Array.isArray(t)))
6
+ return t;
7
+ }
8
+ function d(t, n) {
9
+ const e = p(m);
10
+ return e === null || !e.direct ? n : Object.prototype.hasOwnProperty.call(e.values, t) ? e.values[t] : n;
11
+ }
12
+ function x(t, n) {
13
+ return d(t, n);
14
+ }
15
+ const o = "vctScene";
16
+ function y({ children: t }) {
17
+ return /* @__PURE__ */ s(c, { children: t });
18
+ }
19
+ y[o] = !0;
20
+ function i(t) {
21
+ const n = [];
22
+ for (const e of a.toArray(t)) {
23
+ if (!f(e)) continue;
24
+ if (e.type === l) {
25
+ n.push(...i(e.props.children));
26
+ continue;
27
+ }
28
+ const r = e.type;
29
+ typeof r == "string" || r[o] !== !0 || typeof e.props.id == "string" && n.push({ id: e.props.id, element: e });
30
+ }
31
+ return n;
32
+ }
33
+ function C({ current: t, children: n }) {
34
+ const e = i(n).find((r) => r.id === t);
35
+ return e ? e.element : null;
36
+ }
37
+ export {
38
+ m as S,
39
+ y as a,
40
+ C as b,
41
+ g as r,
42
+ i as s,
43
+ x as u
44
+ };
@@ -0,0 +1 @@
1
+ "use strict";const i=require("react/jsx-runtime"),r=require("react"),s=r.createContext(null);function l(e){if(!(typeof e!="object"||e===null||Array.isArray(e)))return e}function f(e,t){const n=r.useContext(s);return n===null||!n.direct?t:Object.prototype.hasOwnProperty.call(n.values,e)?n.values[e]:t}function a(e,t){return f(e,t)}const u="vctScene";function p({children:e}){return i.jsx(i.Fragment,{children:e})}p[u]=!0;function o(e){const t=[];for(const n of r.Children.toArray(e)){if(!r.isValidElement(n))continue;if(n.type===r.Fragment){t.push(...o(n.props.children));continue}const c=n.type;typeof c=="string"||c[u]!==!0||typeof n.props.id=="string"&&t.push({id:n.props.id,element:n})}return t}function S({current:e,children:t}){const n=o(t).find(c=>c.id===e);return n?n.element:null}exports.SampleContext=s;exports.Scene=p;exports.Scenes=S;exports.readSample=l;exports.sceneEntries=o;exports.useSceneSample=a;
@@ -1,2 +1,2 @@
1
- "use strict";const H=require("react/jsx-runtime"),x=require("react"),ve=require("@react-three/fiber"),Me=require("./context-hA0Rb2Xa.cjs"),Te=require("./useEditOverrides-C8Kzr6M7.cjs"),xe=require("three");function Oe(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Ce=Oe(xe),Le=({children:t,depth:e=0})=>{const{camera:n,size:r}=ve.useThree(),a=x.useMemo(()=>{if(!n.isPerspectiveCamera)return{width:10,height:10};const i=n,l=Math.abs(i.position.z-e),f=i.fov*Math.PI/180,s=2*Math.tan(f/2)*l;return{width:s*(r.width/r.height),height:s}},[n,r,e]);return H.jsx(Me.ScreenSpaceContext.Provider,{value:a,children:H.jsx("group",{position:[0,0,e],children:t})})},de=x.forwardRef(({texture:t,name:e,overlay:n,opacity:r,position:a,rotation:i,scale:l,visible:f,renderOrder:s},h)=>H.jsxs("mesh",{ref:h,name:e,position:a,rotation:i,scale:l,visible:f,renderOrder:s,children:[H.jsx("planeGeometry",{args:[1,1]}),H.jsx("meshBasicMaterial",{map:t,transparent:!0,opacity:r,depthTest:!n,depthWrite:!n})]}));de.displayName="TextLabelMesh";const Fe={color:"#ffffff",strokeWidth:0,strokeOpacity:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowOpacity:1,fontWeight:"bold",fontStyle:"normal",fontFamily:"Arial, sans-serif",fontSize:48,textAlign:"center",verticalAlign:"center",minFontSize:12,letterSpacing:0,lineSpacing:.3,bgColor:"rgba(20,40,110,0.88)",bgFillMode:"solid",bgOpacity:1,bgFit:"full",bgTextureFit:"cover",bgTextureFlipX:!1,bgTextureFlipY:!1,borderWidth:0,borderRadius:24,padding:32,aspect:2.5,resolution:512,opacity:1,underline:!1,strikethrough:!1,bendPreset:"arc",bendStrength:0},ue=t=>{x.useEffect(()=>()=>{t==null||t.dispose()},[t])};function We(t,e,n){return n==="left"?e:n==="right"?t-e:t/2}function Ye(t,e,n,r,a){return a==="top"?e+n/2:a==="bottom"?t-e-r+n/2:t/2-(r-n)/2}function ke(t,e,n,r){return r==="full"||n==="left"?0:n==="right"?t-e:(t-e)/2}function be(t,e,n,r){return`${t} ${e} ${n}px ${r}`}function R(t,e){const n=Math.max(0,Math.min(e,1));return t*n*.08}function me(t,e){const n=Math.max(0,Math.min(e,1));return t*(1.2+n*.6)}function Se(t,e){"letterSpacing"in t&&(t.letterSpacing=`${e}px`)}function ye(t){"letterSpacing"in t&&(t.letterSpacing="0px")}function p(t,e,n){Se(t,n);const r=t.measureText(e).width;return ye(t),r}function J(t,e,n,r){return Math.max(1,Math.floor((t-e*2)/me(n,r)))}function Pe(t,e,n,r,a){return e.length<=r&&e.every(i=>p(t,i,a)<=n)}function V(t,e,n,r,a,i,l,f){t.font=be(r,a,i,l);const s=e.split(" "),h=[];let o="";for(const d of s){const c=o?`${o} ${d}`:d;p(t,c,f)>n&&o?(h.push(o),o=d):o=c}return o&&h.push(o),h}function fe(t,e,n,r,a,i,l,f){const h=e.split(/\r?\n/).flatMap(o=>o.trim().length===0?[""]:V(t,o,n,r,a,i,l,f));return h.length>0?h:[e]}function we(t,e,n,r,a){const i=r?"...":"";let l=e.trimEnd();for(;l.length>0&&p(t,`${l}${i}`,a)>n;)l=l.slice(0,-1).trimEnd();return`${l}${i}`}function K(t,e,n,r,a){return e.map((i,l)=>{if(p(t,i,a)<=n)return i;const f=l===e.length-1;return we(t,i,n,r==="ellipsis"&&f,a)})}function he(t,e,n,r,a,i){if(e.length<=n)return K(t,e,r,a?"ellipsis":"clip",i);const l=e.slice(0,n),f=l[n-1];return l[n-1]=we(t,f,r,a,i),K(t,l,r,a?"ellipsis":"clip",i)}function He(t){const{ctx:e,text:n,explicitLines:r,maxWidth:a,maxHeight:i,padding:l,fontStyle:f,fontWeight:s,fontSize:h,fontFamily:o,letterSpacing:d,lineSpacing:c,overflow:u,resizeToFit:S,minFontSize:g}=t;let b=h,m=R(b,d),y=r??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c);const C=S===!0||u==="shrink";for(;C&&!Pe(e,y,a,v,m)&&b>g&&(b=Math.max(g,b-4),m=R(b,d),y=r??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c),b!==g););return u==="ellipsis"?y=he(e,y,v,a,!0,m):u==="clamp"||u==="shrink"?y=he(e,y,v,a,!1,m):u!=="clip"&&(y=K(e,y,a,void 0,m)),{fontSize:b,lines:y}}function Xe(t){const{ctx:e,text:n,maxWidth:r,maxHeight:a,padding:i,fontStyle:l,fontWeight:f,fontSize:s,fontFamily:h,letterSpacing:o,lineSpacing:d}=t;let c=s,u=V(e,n,r,l,f,c,h,R(c,o));const S=J(a,i,c,d);return u.length>S&&(c=Math.max(12,Math.round(c*.75)),u=V(e,n,r,l,f,c,h,R(c,o))),{fontSize:c,lines:u}}function Q(t,e){return typeof OffscreenCanvas<"u"?new OffscreenCanvas(t,e):(()=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n})()}function pe(t,e){const n=e.width-e.padding*2,a=Array.isArray(e.lines)||e.text.includes(`
1
+ "use strict";const H=require("react/jsx-runtime"),x=require("react"),ve=require("@react-three/fiber"),Me=require("./context-hA0Rb2Xa.cjs"),Te=require("./useEditOverrides-CgapHJzA.cjs"),xe=require("three");function Oe(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Ce=Oe(xe),Le=({children:t,depth:e=0})=>{const{camera:n,size:r}=ve.useThree(),a=x.useMemo(()=>{if(!n.isPerspectiveCamera)return{width:10,height:10};const i=n,l=Math.abs(i.position.z-e),f=i.fov*Math.PI/180,s=2*Math.tan(f/2)*l;return{width:s*(r.width/r.height),height:s}},[n,r,e]);return H.jsx(Me.ScreenSpaceContext.Provider,{value:a,children:H.jsx("group",{position:[0,0,e],children:t})})},de=x.forwardRef(({texture:t,name:e,overlay:n,opacity:r,position:a,rotation:i,scale:l,visible:f,renderOrder:s},h)=>H.jsxs("mesh",{ref:h,name:e,position:a,rotation:i,scale:l,visible:f,renderOrder:s,children:[H.jsx("planeGeometry",{args:[1,1]}),H.jsx("meshBasicMaterial",{map:t,transparent:!0,opacity:r,depthTest:!n,depthWrite:!n})]}));de.displayName="TextLabelMesh";const Fe={color:"#ffffff",strokeWidth:0,strokeOpacity:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowOpacity:1,fontWeight:"bold",fontStyle:"normal",fontFamily:"Arial, sans-serif",fontSize:48,textAlign:"center",verticalAlign:"center",minFontSize:12,letterSpacing:0,lineSpacing:.3,bgColor:"rgba(20,40,110,0.88)",bgFillMode:"solid",bgOpacity:1,bgFit:"full",bgTextureFit:"cover",bgTextureFlipX:!1,bgTextureFlipY:!1,borderWidth:0,borderRadius:24,padding:32,aspect:2.5,resolution:512,opacity:1,underline:!1,strikethrough:!1,bendPreset:"arc",bendStrength:0},ue=t=>{x.useEffect(()=>()=>{t==null||t.dispose()},[t])};function We(t,e,n){return n==="left"?e:n==="right"?t-e:t/2}function Ye(t,e,n,r,a){return a==="top"?e+n/2:a==="bottom"?t-e-r+n/2:t/2-(r-n)/2}function ke(t,e,n,r){return r==="full"||n==="left"?0:n==="right"?t-e:(t-e)/2}function be(t,e,n,r){return`${t} ${e} ${n}px ${r}`}function R(t,e){const n=Math.max(0,Math.min(e,1));return t*n*.08}function me(t,e){const n=Math.max(0,Math.min(e,1));return t*(1.2+n*.6)}function Se(t,e){"letterSpacing"in t&&(t.letterSpacing=`${e}px`)}function ye(t){"letterSpacing"in t&&(t.letterSpacing="0px")}function p(t,e,n){Se(t,n);const r=t.measureText(e).width;return ye(t),r}function J(t,e,n,r){return Math.max(1,Math.floor((t-e*2)/me(n,r)))}function Pe(t,e,n,r,a){return e.length<=r&&e.every(i=>p(t,i,a)<=n)}function V(t,e,n,r,a,i,l,f){t.font=be(r,a,i,l);const s=e.split(" "),h=[];let o="";for(const d of s){const c=o?`${o} ${d}`:d;p(t,c,f)>n&&o?(h.push(o),o=d):o=c}return o&&h.push(o),h}function fe(t,e,n,r,a,i,l,f){const h=e.split(/\r?\n/).flatMap(o=>o.trim().length===0?[""]:V(t,o,n,r,a,i,l,f));return h.length>0?h:[e]}function we(t,e,n,r,a){const i=r?"...":"";let l=e.trimEnd();for(;l.length>0&&p(t,`${l}${i}`,a)>n;)l=l.slice(0,-1).trimEnd();return`${l}${i}`}function K(t,e,n,r,a){return e.map((i,l)=>{if(p(t,i,a)<=n)return i;const f=l===e.length-1;return we(t,i,n,r==="ellipsis"&&f,a)})}function he(t,e,n,r,a,i){if(e.length<=n)return K(t,e,r,a?"ellipsis":"clip",i);const l=e.slice(0,n),f=l[n-1];return l[n-1]=we(t,f,r,a,i),K(t,l,r,a?"ellipsis":"clip",i)}function He(t){const{ctx:e,text:n,explicitLines:r,maxWidth:a,maxHeight:i,padding:l,fontStyle:f,fontWeight:s,fontSize:h,fontFamily:o,letterSpacing:d,lineSpacing:c,overflow:u,resizeToFit:S,minFontSize:g}=t;let b=h,m=R(b,d),y=r??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c);const C=S===!0||u==="shrink";for(;C&&!Pe(e,y,a,v,m)&&b>g&&(b=Math.max(g,b-4),m=R(b,d),y=r??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c),b!==g););return u==="ellipsis"?y=he(e,y,v,a,!0,m):u==="clamp"||u==="shrink"?y=he(e,y,v,a,!1,m):u!=="clip"&&(y=K(e,y,a,void 0,m)),{fontSize:b,lines:y}}function Xe(t){const{ctx:e,text:n,maxWidth:r,maxHeight:a,padding:i,fontStyle:l,fontWeight:f,fontSize:s,fontFamily:h,letterSpacing:o,lineSpacing:d}=t;let c=s,u=V(e,n,r,l,f,c,h,R(c,o));const S=J(a,i,c,d);return u.length>S&&(c=Math.max(12,Math.round(c*.75)),u=V(e,n,r,l,f,c,h,R(c,o))),{fontSize:c,lines:u}}function Q(t,e){return typeof OffscreenCanvas<"u"?new OffscreenCanvas(t,e):(()=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n})()}function pe(t,e){const n=e.width-e.padding*2,a=Array.isArray(e.lines)||e.text.includes(`
2
2
  `)||e.overflow!==void 0||e.resizeToFit!==void 0?He({ctx:t,text:e.text,explicitLines:e.lines,maxWidth:n,maxHeight:e.height,padding:e.padding,fontStyle:e.fontStyle,fontWeight:e.fontWeight,fontSize:e.fontSize,fontFamily:e.fontFamily,overflow:e.overflow,resizeToFit:e.resizeToFit,minFontSize:e.minFontSize,letterSpacing:e.letterSpacing,lineSpacing:e.lineSpacing}):Xe({ctx:t,text:e.text,maxWidth:n,maxHeight:e.height,padding:e.padding,fontStyle:e.fontStyle,fontWeight:e.fontWeight,fontSize:e.fontSize,fontFamily:e.fontFamily,letterSpacing:e.letterSpacing,lineSpacing:e.lineSpacing}),i=a.fontSize,l=a.lines;t.font=be(e.fontStyle,e.fontWeight,i,e.fontFamily);const f=R(i,e.letterSpacing),s=me(i,e.lineSpacing),h=Math.max(i,i+(l.length-1)*s),o=Ye(e.height,e.padding,i,h,e.verticalAlign),d=l.map(c=>p(t,c,f));return{fontSize:i,resolvedLines:l,letterSpacingPx:f,lineHeight:s,startY:o,textBlockWidth:Math.min(e.width,Math.max(0,Math.max(...d,0))+e.padding*2),textBlockHeight:Math.min(e.height,h+e.padding*2),textX:We(e.width,e.padding,e.textAlign)}}function Ae(t,e,n,r,a,i){t.beginPath(),t.moveTo(e+i,n),t.lineTo(e+r-i,n),t.quadraticCurveTo(e+r,n,e+r,n+i),t.lineTo(e+r,n+a-i),t.quadraticCurveTo(e+r,n+a,e+r-i,n+a),t.lineTo(e+i,n+a),t.quadraticCurveTo(e,n+a,e,n+a-i),t.lineTo(e,n+i),t.quadraticCurveTo(e,n,e+i,n),t.closePath()}function ce(t,e,n){return typeof t!="number"||Number.isNaN(t)||t<=0?e:Math.min(t,n)}function Be(t,e){const n=ke(e.canvasWidth,e.panelWidth,e.textAlign,e.bgFit),r=(e.canvasHeight-e.panelHeight)/2,a=Math.min(e.borderRadius,Math.min(e.panelWidth,e.panelHeight)/2);Ae(t,n,r,e.panelWidth,e.panelHeight,a),ze(t,{panelX:n,panelY:r,panelWidth:e.panelWidth,panelHeight:e.panelHeight,bgColor:e.bgColor,bgFillMode:e.bgFillMode,bgOpacity:e.bgOpacity,bgGradientStops:e.bgGradientStops,bgTextureImage:e.bgTextureImage,bgTextureFit:e.bgTextureFit,bgTextureFlipX:e.bgTextureFlipX,bgTextureFlipY:e.bgTextureFlipY}),e.borderColor&&e.borderWidth>0&&(t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,t.stroke())}function ze(t,e){if(t.save(),t.globalAlpha=Math.max(0,Math.min(e.bgOpacity,1)),e.bgFillMode==="gradient"&&e.bgGradientStops&&e.bgGradientStops.length>1){const n=t.createLinearGradient(e.panelX,e.panelY,e.panelX+e.panelWidth,e.panelY+e.panelHeight);[...e.bgGradientStops].sort((r,a)=>r.position-a.position).forEach(r=>n.addColorStop(Math.max(0,Math.min(r.position,1)),r.color)),t.fillStyle=n,t.fill(),t.restore();return}if(e.bgTextureImage){t.clip(),Re(t,{image:e.bgTextureImage,x:e.panelX,y:e.panelY,width:e.panelWidth,height:e.panelHeight,fit:e.bgTextureFit,flipX:e.bgTextureFlipX,flipY:e.bgTextureFlipY}),t.restore();return}t.fillStyle=e.bgColor,t.fill(),t.restore()}function Re(t,e){const{image:n,x:r,y:a,width:i,height:l,fit:f,flipX:s,flipY:h}=e,o="naturalWidth"in n?n.naturalWidth:"videoWidth"in n?n.videoWidth:n.width,d="naturalHeight"in n?n.naturalHeight:"videoHeight"in n?n.videoHeight:n.height;let c=i,u=l,S=r,g=a;if(f!=="stretch"&&o>0&&d>0){const b=f==="cover"?Math.max(i/o,l/d):Math.min(i/o,l/d);c=o*b,u=d*b,S=r+(i-c)/2,g=a+(l-u)/2}t.save(),(s||h)&&(t.translate(s?r+i:0,h?a+l:0),t.scale(s?-1:1,h?-1:1),S=s?-(S-r)-c+r:S,g=h?-(g-a)-u+a:g),t.drawImage(n,S,g,c,u),t.restore()}function Ie(t,e,n,r,a,i){const l=a/72,f=Math.abs(l),s=1-Math.min(1,Math.abs(e)),h=Math.min(1,Math.abs(e)),o=r<=1?.5:n/(r-1),d=Math.sin(o*Math.PI*2-Math.PI/2),c=Math.sin(o*Math.PI*2.7-Math.PI/2)*(.65+o*.35),u=a*e*e,S=2*a*e/i,g={xOffset:0,yOffset:0,rotation:0,scaleX:1,scaleY:1};switch(t){case"arc":return{...g,yOffset:u,rotation:Math.atan(S)};case"arc-lower":return{...g,yOffset:u*.55,scaleY:Math.max(.2,1+l*e*e*.45)};case"arc-upper":return{...g,yOffset:-u*.55,scaleY:Math.max(.2,1-l*e*e*.45)};case"arch":return{...g,yOffset:u};case"bulge":return{...g,scaleY:Math.max(.2,1+l*s*.75)};case"shell-lower":return{...g,yOffset:a*.45*o*s,scaleY:Math.max(.2,1+l*o*s)};case"shell-upper":return{...g,yOffset:-a*.45*(1-o)*s,scaleY:Math.max(.2,1+l*(1-o)*s)};case"flag":return{...g,yOffset:a*.65*c,rotation:Math.atan(a/Math.max(i,1)*Math.cos(o*Math.PI*2.7)*1.6)};case"wave":return{...g,yOffset:a*.6*d,rotation:Math.atan(a/Math.max(i,1)*Math.cos(o*Math.PI*2)*1.4)};case"fish":return{...g,scaleX:Math.max(.25,1-f*h*.55),scaleY:Math.max(.2,1+l*s)};case"rise":return{...g,yOffset:a*e};case"fisheye":return{...g,yOffset:a*.18*e*s,scaleX:Math.max(.25,1+l*s*.7),scaleY:Math.max(.2,1+l*s*.7)};case"inflate":return{...g,scaleX:Math.max(.25,1+l*s*.6),scaleY:Math.max(.2,1+l*s*.6)};case"squeeze":return{...g,scaleY:Math.max(.2,1-l*s*.8)};case"twist":return{...g,yOffset:a*e,rotation:l*e*.45,scaleY:Math.max(.2,1+l*e*.25)};default:return g}}function X(t,e,n,r,a,i,l="arc",f=0){if(f!==0){Ee(t,e,n,r,a,i,l,f);return}Se(t,a),i==="fill"?t.fillText(e,n,r):t.strokeText(e,n,r),ye(t)}function Ee(t,e,n,r,a,i,l,f){const s=Array.from(e);if(s.length===0)return;const h=s.map(m=>t.measureText(m).width),o=h.reduce((m,y)=>m+y,0)+a*Math.max(0,s.length-1),d=t.textAlign,c=d==="right"?n-o:d==="center"?n-o/2:n,S=Math.max(-100,Math.min(f,100))/100*72,g=Math.max(o/2,1);let b=c;for(let m=0;m<s.length;m++){const y=s[m],v=h[m],C=b+v/2,W=(C-c-o/2)/g,O=Ie(l,W,m,s.length,S,g);t.save(),t.translate(C+O.xOffset,r+O.yOffset),t.rotate(O.rotation),t.scale(O.scaleX,O.scaleY),t.textAlign="center",i==="fill"?t.fillText(y,0,0):t.strokeText(y,0,0),t.restore(),b+=v+a}}function ge(t,e,n,r,a,i,l,f,s){const h=p(t,e,f),o=a==="center"?n-h/2:a==="right"?n-h:n,d=s==="underline"?l*.42:-l*.08,c=r+d;t.save(),t.strokeStyle=i,t.lineWidth=Math.max(2,l*.06),t.lineCap="round",t.beginPath(),t.moveTo(o,c),t.lineTo(o+h,c),t.stroke(),t.restore()}function De(t,e){for(let n=0;n<e.lines.length;n++){const r=e.lines[n],a=e.startY+n*e.lineHeight;for(const i of e.shadowLayers)t.save(),t.shadowColor=i.color,t.shadowBlur=i.blur,t.shadowOffsetX=i.offsetX??0,t.shadowOffsetY=i.offsetY??0,t.globalAlpha=i.opacity??1,t.fillStyle=e.color,X(t,r,e.textX,a,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength),t.restore();for(const i of e.strokeLayers)t.save(),t.lineJoin="round",t.miterLimit=2,t.lineWidth=i.width,t.strokeStyle=i.color,t.globalAlpha=i.opacity??1,X(t,r,e.textX,a,e.letterSpacingPx,"stroke",e.bendPreset,e.bendStrength),t.restore();t.save(),t.fillStyle=e.color,t.globalAlpha=1,X(t,r,e.textX,a,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength),t.restore(),e.underline&&ge(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"underline"),e.strikethrough&&ge(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"strikethrough")}}function $e(t,e){const n=Math.max(0,Math.min(e.intensity,1));if(n<=0)return;const r=Math.max(0,Math.min(e.range,1)),a=r*72,i=Math.max(-.5,Math.min(e.horizontalAngle,.5))*80,l=Math.max(-.5,Math.min(e.verticalAngle,.5))*80;for(let f=0;f<e.lines.length;f++){const s=e.startY+f*e.lineHeight;t.save(),t.globalAlpha=n,t.shadowColor=e.color,t.shadowBlur=a,t.shadowOffsetX=i,t.shadowOffsetY=l,e.style==="contoured"?(t.lineJoin="round",t.miterLimit=2,t.lineWidth=Math.max(2,r*42),t.strokeStyle=e.color,X(t,e.lines[f],e.textX,s,e.letterSpacingPx,"stroke",e.bendPreset,e.bendStrength)):(t.fillStyle=e.color,X(t,e.lines[f],e.textX,s,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength)),t.restore()}}function je(t,e){const n=Q(e.width,e.height),r=n.getContext("2d");r.clearRect(0,0,e.width,e.height),r.font=e.font,r.fillStyle="#ffffff",r.textAlign=e.textAlign,r.textBaseline="middle";for(let l=0;l<e.lines.length;l++)X(r,e.lines[l],e.textX,e.startY+l*e.lineHeight,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength);const a=Q(e.width,e.height),i=a.getContext("2d");i.clearRect(0,0,e.width,e.height),i.save(),i.globalAlpha=e.opacity,i.filter=e.blur>0?`blur(${e.blur}px)`:"none",i.drawImage(n,e.offsetX,e.offsetY),i.restore(),i.globalCompositeOperation="destination-in",i.drawImage(n,0,0),i.globalCompositeOperation="source-in",i.globalAlpha=e.opacity,i.fillStyle=e.color,i.fillRect(0,0,e.width,e.height),t.drawImage(a,0,0)}function qe(t){const{width:e,height:n,color:r,strokeLayers:a,strokeColor:i,strokeWidth:l,strokeOpacity:f,shadowLayers:s,innerShadow:h,glow:o,shadowColor:d,shadowBlur:c,shadowOffsetX:u,shadowOffsetY:S,shadowOpacity:g,textAlign:b,bgFillMode:m,bgOpacity:y,bgFit:v,bgAutoSize:C,bgWidth:W,bgHeight:O,bgGradientStops:L,bgTextureImage:F,bgTextureFit:I,bgTextureFlipX:E,bgTextureFlipY:D,underline:$,strikethrough:j,bendPreset:Y,bendStrength:k}=t;let{fontSize:A,bgColor:B}=t;const q=[...a??[],...i&&l>0?[{color:i,width:l,opacity:f}]:[]].filter(T=>T.width>0),G=[...s??[],...d&&(c>0||u!==0||S!==0)?[{color:d,blur:c,offsetX:u,offsetY:S,opacity:g}]:[]].filter(T=>T.blur>0||(T.offsetX??0)!==0||(T.offsetY??0)!==0);let P;const z=Q(e,n),M=z.getContext("2d");M.clearRect(0,0,e,n),M.fillStyle=r,M.textAlign=b,M.textBaseline="middle";const w=pe(M,t);if(A=w.fontSize,B!=="transparent"){const T=C===!0,_=ce(T?void 0:W,v==="text"||T?w.textBlockWidth:e,e),N=ce(T?void 0:O,v==="text"||T?w.textBlockHeight:n,n);Be(M,{canvasWidth:e,canvasHeight:n,textAlign:b,bgFit:v,panelWidth:_,panelHeight:N,bgColor:B,bgFillMode:m,bgOpacity:y,bgGradientStops:L,bgTextureImage:F,bgTextureFit:I,bgTextureFlipX:E,bgTextureFlipY:D,borderColor:t.borderColor,borderWidth:t.borderWidth,borderRadius:t.borderRadius})}return o&&$e(M,{lines:w.resolvedLines,textX:w.textX,startY:w.startY,lineHeight:w.lineHeight,letterSpacingPx:w.letterSpacingPx,bendPreset:Y,bendStrength:k,color:o.color,style:o.style,intensity:o.intensity??.5,range:o.range??.5,horizontalAngle:o.horizontalAngle??0,verticalAngle:o.verticalAngle??0}),De(M,{lines:w.resolvedLines,textX:w.textX,startY:w.startY,lineHeight:w.lineHeight,textAlign:b,color:r,fontSize:A,letterSpacingPx:w.letterSpacingPx,bendPreset:Y,bendStrength:k,shadowLayers:G,strokeLayers:q,underline:$,strikethrough:j}),h&&je(M,{width:e,height:n,font:M.font,lines:w.resolvedLines,textX:w.textX,startY:w.startY,lineHeight:w.lineHeight,letterSpacingPx:w.letterSpacingPx,bendPreset:Y,bendStrength:k,textAlign:b,color:h.color,opacity:h.opacity??1,blur:h.blur,offsetX:h.offsetX??0,offsetY:h.offsetY??0}),P=new Ce.CanvasTexture(z),P.needsUpdate=!0,P}function Ge(t,e){const{lines:n,color:r,strokeLayers:a,outlineEnabled:i,strokeColor:l,strokeWidth:f,strokeOpacity:s,shadowLayers:h,shadowEnabled:o,innerShadow:d,glow:c,shadowColor:u,shadowBlur:S,shadowOffsetX:g,shadowOffsetY:b,shadowOpacity:m,fontWeight:y,fontStyle:v,fontFamily:C,fontSize:W,textAlign:O,verticalAlign:L,overflow:F,resizeToFit:I,minFontSize:E,letterSpacing:D,lineSpacing:$,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:A,bgWidth:B,bgHeight:q,bgGradientStops:G,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:M,borderColor:w,borderWidth:T,borderRadius:_,padding:N,aspect:Z,resolution:U,underline:ee,strikethrough:te,bendPreset:ne,bendStrength:re}=t,ie=x.useMemo(()=>i===!1?[]:a,[i,a]),ae=x.useMemo(()=>o===!1?[]:h,[o,h]),le=void 0,oe=x.useMemo(()=>({text:e.text,lines:n,color:r,strokeLayers:ie,strokeColor:i===!1?void 0:l,strokeWidth:i===!1?0:f,strokeOpacity:s,shadowLayers:ae,innerShadow:d,glow:c,shadowColor:o===!1?void 0:u,shadowBlur:o===!1?0:S,shadowOffsetX:o===!1?0:g,shadowOffsetY:o===!1?0:b,shadowOpacity:m,fontWeight:y,fontStyle:v,fontFamily:C,fontSize:W,textAlign:O,verticalAlign:L,overflow:F,resizeToFit:I,minFontSize:E,letterSpacing:D,lineSpacing:$,bgColor:e.bgColor,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:A,bgWidth:B,bgHeight:q,bgGradientStops:G,bgTextureImage:le,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:M,borderColor:w,borderWidth:T,borderRadius:_,padding:N,height:U,width:Math.round(U*Math.max(Z,.1)),underline:ee,strikethrough:te,bendPreset:ne,bendStrength:re}),[e.text,e.bgColor,n,r,ie,i,l,f,s,ae,d,c,o,u,S,g,b,m,y,v,C,W,O,L,F,I,E,D,$,j,Y,k,A,B,q,G,le,P,z,M,w,T,_,N,Z,U,ee,te,ne,re]),se=x.useMemo(()=>qe(oe),[oe]);return ue(se),se}const _e=["color"];function Ne(t){const e=Te.useEditOverrides(t,_e),n={...Fe,...e},{text:r,bgColor:a,opacity:i,name:l,overlay:f=!0,position:s,rotation:h,scale:o,visible:d,renderOrder:c}=n,[u,S]=x.useState(null),[g,b]=x.useState(null),m=x.useRef(r);m.current!==r&&(m.current=r,u!==null&&S(null));const y=x.useRef(a);y.current!==a&&(y.current=a,g!==null&&b(null));const v=x.useRef(null),O=Ge(n,{text:u??r,bgColor:g??a});return x.useEffect(()=>{const L=v.current;if(L)return L.userData.setText=F=>S(F),L.userData.setBgColor=F=>b(F),()=>{delete L.userData.setText,delete L.userData.setBgColor}},[]),H.jsx(de,{ref:v,name:l,texture:O,overlay:f,opacity:i,position:s,rotation:h,scale:o,visible:d,renderOrder:c})}exports.ScreenSpaceUI=Le;exports.TextLabel=Ne;exports.useOwnedTexture=ue;
@@ -2,7 +2,7 @@ import { jsx as z, jsxs as Te } from "react/jsx-runtime";
2
2
  import { useMemo as B, forwardRef as xe, useEffect as be, useState as he, useRef as J } from "react";
3
3
  import { useThree as Ce } from "@react-three/fiber";
4
4
  import { b as Fe } from "./context-DTxSQvp4.js";
5
- import { u as Le } from "./useEditOverrides-DpPTA6BW.js";
5
+ import { u as Le } from "./useEditOverrides-BBkK8cN2.js";
6
6
  import * as We from "three";
7
7
  const et = ({ children: t, depth: e = 0 }) => {
8
8
  const { camera: n, size: i } = Ce(), a = B(() => {
@@ -1,3 +1,4 @@
1
+ import { KnownComponentProps } from '../editor-defs/types';
1
2
  export type AudioPlayMode = "once" | "loop" | "infinite";
2
3
  export interface AudioPlayerHandle {
3
4
  play: () => Promise<void>;
@@ -5,7 +6,7 @@ export interface AudioPlayerHandle {
5
6
  stop: () => void;
6
7
  readonly current: HTMLAudioElement | null;
7
8
  }
8
- export interface AudioPlayerProps {
9
+ export interface AudioPlayerProps extends KnownComponentProps {
9
10
  /** @tweak asset accept=audio */
10
11
  src: string;
11
12
  playMode?: AudioPlayMode;
@@ -1,5 +1,5 @@
1
1
  import * as p from "three";
2
- import { B as e, X as S } from "./index-CTqQJj5p.js";
2
+ import { B as e, X as S } from "./index-BDxJWWyy.js";
3
3
  const b = [
4
4
  [e.leftShoulder, e.rightShoulder],
5
5
  [e.leftHip, e.rightHip],
@@ -2,8 +2,8 @@ var w = Object.defineProperty;
2
2
  var m = (n, e, s) => e in n ? w(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s;
3
3
  var a = (n, e, s) => m(n, typeof e != "symbol" ? e + "" : e, s);
4
4
  import { useMemo as g, useCallback as f } from "react";
5
- import { u as v, r as p, a as S, l as A, b as k, E } from "./index-CTqQJj5p.js";
6
- import { u as B, a as _ } from "./selectors-K5JKCWxw.js";
5
+ import { u as v, r as p, a as S, l as A, b as k, E } from "./index-BDxJWWyy.js";
6
+ import { u as B, a as _ } from "./selectors-J06V0eDb.js";
7
7
  const X = (n) => {
8
8
  const { session: e } = v(), s = B(), i = _(), o = JSON.stringify(n ?? null), t = g(
9
9
  () => n ? p(n) : i ?? p(),
@@ -0,0 +1,23 @@
1
+ import { MouseEvent, ReactNode } from 'react';
2
+ import { KnownComponentProps } from '../../editor-defs/types';
3
+ export { safeLink } from './safeLink';
4
+ export type ButtonProps = KnownComponentProps & {
5
+ /** Button text. */
6
+ label?: string;
7
+ /** Where a tap goes: https, http, mailto, "#section" or "/path". Anything else is ignored. */
8
+ link?: string;
9
+ /** Code that runs on a tap. The editor shows it read-only; a button with neither this nor `link` reads "Not wired yet". */
10
+ onTap?: (event: MouseEvent<HTMLElement>) => void;
11
+ /** Background colour (CSS colour). Defaults to the theme's `--vincentt-button`. */
12
+ color?: string;
13
+ /** `false` hides it. Default `true`. */
14
+ visible?: boolean;
15
+ className?: string;
16
+ children?: ReactNode;
17
+ };
18
+ /**
19
+ * A page button (DOM, outside the canvas). A valid `link` makes it an anchor that opens the link;
20
+ * `onTap` runs on a tap either way. With neither it is a plain button that does nothing, which the
21
+ * editor lists as "Not wired yet".
22
+ */
23
+ export declare function Button({ label, link, onTap, color, visible, className, children, name: _name, locked: _locked, }: ButtonProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The editor's Link grammar: https, http, mailto, an in-page "#x" or a site path. The editor
3
+ * refuses anything else on write; this stops code, a hand edit or a stale file from putting a
4
+ * script URL on a published page.
5
+ */
6
+ export declare function safeLink(link: unknown): string | undefined;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { KnownComponentProps } from '../../editor-defs/types';
3
+ export type HtmlRegionProps = KnownComponentProps & {
4
+ className?: string;
5
+ /** Markup only. The editor lists its text pieces. */
6
+ children?: ReactNode;
7
+ };
8
+ export declare function HtmlRegion({ className, children, name: _name, locked: _locked, }: HtmlRegionProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { KnownComponentProps } from '../../editor-defs/types';
2
+ import { MeshRendererSettings } from '../MeshRenderer';
3
+ import { Transform3DVector } from '../Transform3D';
4
+ export type ModelProps = KnownComponentProps & {
5
+ /** GLTF/GLB project path or library URL. */
6
+ src?: string;
7
+ /** An axis left out keeps its default, so the editor may write one axis at a time. */
8
+ position?: Partial<Transform3DVector>;
9
+ /** Degrees. */
10
+ rotation?: Partial<Transform3DVector>;
11
+ scale?: Partial<Transform3DVector>;
12
+ visible?: boolean;
13
+ /** MeshRenderer settings other than the model file; code only. */
14
+ material?: Partial<MeshRendererSettings["material"]>;
15
+ };
16
+ export declare function Model({ src, position, rotation, scale, visible, material, name: _name, locked: _locked, }: ModelProps): import("react/jsx-runtime").JSX.Element;