babylon.quarks-editor 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +31 -4
  3. package/dist/core/assetTree.d.ts +5 -0
  4. package/dist/core/assets.d.ts +7 -0
  5. package/dist/core/assets.js +11 -7
  6. package/dist/core/binding.d.ts +9 -0
  7. package/dist/core/binding.js +8 -0
  8. package/dist/core/collision.d.ts +4 -0
  9. package/dist/core/collision.js +4 -0
  10. package/dist/core/colors.d.ts +16 -0
  11. package/dist/core/colors.js +8 -0
  12. package/dist/core/defaultEffect.d.ts +3 -2
  13. package/dist/core/defaultEffect.js +1 -1
  14. package/dist/core/editorSession.d.ts +229 -0
  15. package/dist/core/editorSession.js +983 -0
  16. package/dist/core/effectTree.d.ts +5 -0
  17. package/dist/core/galleryPlayback.js +2 -1
  18. package/dist/core/history.d.ts +6 -0
  19. package/dist/core/history.js +4 -0
  20. package/dist/core/indexedDbProjectStore.d.ts +13 -0
  21. package/dist/core/indexedDbProjectStore.js +13 -0
  22. package/dist/core/material.d.ts +12 -2
  23. package/dist/core/playback.d.ts +6 -0
  24. package/dist/core/projectStore.d.ts +26 -0
  25. package/dist/core/projectStore.js +1 -0
  26. package/dist/core/sceneEntries.d.ts +3 -0
  27. package/dist/core/scrub.d.ts +1 -1
  28. package/dist/core/scrub.js +2 -2
  29. package/dist/core/shapes.d.ts +24 -0
  30. package/dist/core/shapes.js +5 -0
  31. package/dist/core/systems.d.ts +2 -0
  32. package/dist/core/systems.js +3 -1
  33. package/dist/core/timeline.d.ts +23 -3
  34. package/dist/core/values.d.ts +21 -4
  35. package/dist/core/values.js +5 -0
  36. package/dist/index.d.ts +5 -1
  37. package/dist/react/AssetsPanel.d.ts +7 -0
  38. package/dist/react/ChoiceDialog.d.ts +7 -0
  39. package/dist/react/ContextMenu.d.ts +10 -1
  40. package/dist/react/EditorWorkspace.d.ts +7 -0
  41. package/dist/react/EditorWorkspace.js +6 -3
  42. package/dist/react/EffectEditor.d.ts +8 -2
  43. package/dist/react/EffectEditorHost.d.ts +32 -28
  44. package/dist/react/EffectEditorHost.js +241 -1665
  45. package/dist/react/EffectTreeView.d.ts +3 -0
  46. package/dist/react/MessageDialog.d.ts +5 -0
  47. package/dist/react/ModuleSection.d.ts +10 -0
  48. package/dist/react/ModuleSection.js +4 -1
  49. package/dist/react/ProjectsPage.d.ts +6 -0
  50. package/dist/react/ProjectsPage.js +27 -11
  51. package/dist/react/PromptDialog.d.ts +7 -0
  52. package/dist/react/ScenePanel.d.ts +7 -0
  53. package/dist/react/ScenePanel.js +7 -5
  54. package/dist/react/TextureSelect.d.ts +5 -5
  55. package/dist/react/TimelinePanel.d.ts +13 -0
  56. package/dist/react/TimelinePanel.js +10 -6
  57. package/dist/react/TimelineTrackRow.d.ts +10 -0
  58. package/dist/react/TransportBar.d.ts +9 -0
  59. package/dist/react/ValueField.d.ts +32 -5
  60. package/dist/react/ValueField.js +20 -9
  61. package/dist/react/behaviorModules.d.ts +16 -5
  62. package/dist/react/behaviorModules.js +16 -1
  63. package/dist/react/fields.d.ts +8 -0
  64. package/dist/react/fields.js +3 -0
  65. package/dist/react/host/BottomDocks.d.ts +36 -0
  66. package/dist/react/host/BottomDocks.js +63 -0
  67. package/dist/react/host/HostDialogs.d.ts +50 -0
  68. package/dist/react/host/HostDialogs.js +113 -0
  69. package/dist/react/host/InspectorSidebar.d.ts +32 -0
  70. package/dist/react/host/InspectorSidebar.js +59 -0
  71. package/dist/react/host/SceneSidebar.d.ts +53 -0
  72. package/dist/react/host/SceneSidebar.js +62 -0
  73. package/dist/react/host/ViewportPane.d.ts +56 -0
  74. package/dist/react/host/ViewportPane.js +91 -0
  75. package/dist/react/host/hostHooks.d.ts +44 -0
  76. package/dist/react/host/hostHooks.js +164 -0
  77. package/dist/react/host/hostStyles.d.ts +21 -0
  78. package/dist/react/host/hostStyles.js +57 -0
  79. package/dist/react/index.d.ts +3 -1
  80. package/dist/react/modules.d.ts +17 -6
  81. package/dist/react/modules.js +38 -20
  82. package/dist/react/theme.d.ts +15 -0
  83. package/dist/react/theme.js +15 -0
  84. package/dist/session.d.ts +9 -0
  85. package/dist/session.js +8 -0
  86. package/package.json +17 -11
  87. package/src/core/assetTree.ts +14 -1
  88. package/src/core/assets.ts +25 -10
  89. package/src/core/binding.ts +9 -0
  90. package/src/core/collision.ts +4 -0
  91. package/src/core/colors.ts +21 -1
  92. package/src/core/defaultEffect.ts +4 -3
  93. package/src/core/editorSession.ts +1299 -0
  94. package/src/core/effectTree.ts +5 -0
  95. package/src/core/galleryPlayback.ts +2 -1
  96. package/src/core/history.ts +6 -0
  97. package/src/core/indexedDbProjectStore.ts +13 -0
  98. package/src/core/loadEffect.ts +1 -1
  99. package/src/core/material.ts +14 -4
  100. package/src/core/playback.ts +6 -0
  101. package/src/core/projectStore.ts +26 -0
  102. package/src/core/sceneEntries.ts +3 -0
  103. package/src/core/scrub.ts +2 -2
  104. package/src/core/shapes.ts +28 -1
  105. package/src/core/systems.ts +9 -2
  106. package/src/core/timeline.ts +40 -15
  107. package/src/core/values.ts +20 -4
  108. package/src/index.ts +5 -1
  109. package/src/react/AssetsPanel.tsx +7 -0
  110. package/src/react/ChoiceDialog.tsx +7 -0
  111. package/src/react/ContextMenu.tsx +10 -1
  112. package/src/react/EditorWorkspace.tsx +11 -5
  113. package/src/react/EffectEditor.tsx +7 -1
  114. package/src/react/EffectEditorHost.tsx +406 -2340
  115. package/src/react/EffectTreeView.tsx +3 -0
  116. package/src/react/MessageDialog.tsx +5 -0
  117. package/src/react/ModuleSection.tsx +11 -0
  118. package/src/react/ProjectsPage.tsx +38 -11
  119. package/src/react/PromptDialog.tsx +7 -0
  120. package/src/react/ScenePanel.tsx +14 -5
  121. package/src/react/TextureSelect.tsx +6 -6
  122. package/src/react/TimelinePanel.tsx +23 -6
  123. package/src/react/TimelineTrackRow.tsx +10 -0
  124. package/src/react/TransportBar.tsx +9 -0
  125. package/src/react/ValueField.tsx +58 -14
  126. package/src/react/behaviorModules.tsx +34 -32
  127. package/src/react/fields.tsx +12 -1
  128. package/src/react/host/BottomDocks.tsx +178 -0
  129. package/src/react/host/HostDialogs.tsx +228 -0
  130. package/src/react/host/InspectorSidebar.tsx +147 -0
  131. package/src/react/host/SceneSidebar.tsx +227 -0
  132. package/src/react/host/ViewportPane.tsx +300 -0
  133. package/src/react/host/hostHooks.ts +198 -0
  134. package/src/react/host/hostStyles.ts +65 -0
  135. package/src/react/index.ts +3 -1
  136. package/src/react/modules.tsx +70 -44
  137. package/src/react/theme.ts +15 -0
  138. package/src/session.ts +17 -0
@@ -1,16 +1,23 @@
1
1
  import React, {useEffect} from 'react';
2
2
  import {buttonStyle, theme} from './theme.js';
3
3
 
4
+ /** One button of a {@link ChoiceDialog}. */
4
5
  export interface ChoiceDialogAction {
6
+ /** The button's text. */
5
7
  label: string;
8
+ /** Runs when the button is pressed. */
6
9
  onSelect: () => void;
7
10
  /** Accent button — also what Enter picks. */
8
11
  primary?: boolean;
12
+ /** Shows the button in red, for a destructive choice. */
9
13
  danger?: boolean;
10
14
  }
11
15
 
16
+ /** Props of {@link ChoiceDialog}. */
12
17
  export interface ChoiceDialogProps {
18
+ /** The question. */
13
19
  title: string;
20
+ /** What the choice means. */
14
21
  message: React.ReactNode;
15
22
  /** Shown left to right; put the cancel action first. */
16
23
  actions: ChoiceDialogAction[];
@@ -2,18 +2,27 @@ import React, {useEffect, useLayoutEffect, useRef, useState} from 'react';
2
2
  import {createPortal} from 'react-dom';
3
3
  import {theme} from './theme.js';
4
4
 
5
+ /** One entry of a {@link ContextMenu}. */
5
6
  export interface ContextMenuItem {
7
+ /** The entry's text. */
6
8
  label: string;
9
+ /** Runs when the entry is picked; the menu closes first. */
7
10
  onSelect: () => void;
11
+ /** Shows the entry in red, for a destructive action. */
8
12
  danger?: boolean;
13
+ /** Shows the entry greyed out and unpickable. */
9
14
  disabled?: boolean;
10
15
  }
11
16
 
17
+ /** Props of {@link ContextMenu}. */
12
18
  export interface ContextMenuProps {
13
- /** Client coordinates of the right-click. */
19
+ /** Client X of the right-click. */
14
20
  x: number;
21
+ /** Client Y of the right-click. */
15
22
  y: number;
23
+ /** The entries, top to bottom. */
16
24
  items: ContextMenuItem[];
25
+ /** Closes the menu: the host stops rendering it. */
17
26
  onClose: () => void;
18
27
  }
19
28
 
@@ -6,6 +6,7 @@ import {EffectEditorHost, type EffectEditorHostProps} from './EffectEditorHost.j
6
6
  import {ProjectsPage} from './ProjectsPage.js';
7
7
  import {theme} from './theme.js';
8
8
 
9
+ /** Props of {@link EditorWorkspace}: the editor's, plus where projects live. */
9
10
  export interface EditorWorkspaceProps extends Omit<EffectEditorHostProps, 'project' | 'onExitProject' | 'effectJson'> {
10
11
  /** Where projects are kept; defaults to the browser's IndexedDB. */
11
12
  store?: ProjectStore;
@@ -23,10 +24,7 @@ export function EditorWorkspace(props: EditorWorkspaceProps): React.ReactElement
23
24
  const [resolving, setResolving] = useState(Boolean(projectId));
24
25
 
25
26
  useEffect(() => {
26
- if (!projectId) {
27
- setResolving(false);
28
- return;
29
- }
27
+ if (!projectId) return;
30
28
  let cancelled = false;
31
29
  void store.getProject(projectId).then((meta) => {
32
30
  if (cancelled) return;
@@ -87,7 +85,15 @@ export function EditorWorkspace(props: EditorWorkspaceProps): React.ReactElement
87
85
 
88
86
  /** Imperative entry point, like QuarksEffectEditor.Show, for the project-based workspace. */
89
87
  export const QuarksEditorWorkspace = {
90
- Show(options: EditorWorkspaceProps & {hostElement: HTMLElement}): {dispose: () => void} {
88
+ /**
89
+ * Mounts an {@link EditorWorkspace} into `hostElement`.
90
+ *
91
+ * @returns A handle whose `dispose()` unmounts it.
92
+ */
93
+ Show(options: EditorWorkspaceProps & {hostElement: HTMLElement}): {
94
+ /** Unmounts the workspace. */
95
+ dispose: () => void;
96
+ } {
91
97
  const {hostElement, ...props} = options;
92
98
  const root = createRoot(hostElement);
93
99
  root.render(<EditorWorkspace {...props} />);
@@ -1,3 +1,4 @@
1
+ import type {Texture} from '@babylonjs/core/Materials/Textures/texture.js';
1
2
  import type {TransformNode} from '@babylonjs/core/Meshes/transformNode.js';
2
3
  import type {ParticleSystem} from 'babylon.quarks';
3
4
  import React, {useEffect, useSyncExternalStore} from 'react';
@@ -37,17 +38,22 @@ import {ObjectModule} from './ObjectModule.js';
37
38
  import {SubEmittersModule} from './SubEmittersModule.js';
38
39
  import {theme} from './theme.js';
39
40
 
41
+ /** Props of {@link EffectEditor}. */
40
42
  export interface EffectEditorProps {
43
+ /** The effect the modules edit. */
41
44
  binding: EffectBinding;
42
45
  /** Currently selected system, lifted up so the timeline panel and this module stack agree. */
43
46
  selectedSystem: ParticleSystem;
47
+ /** The node the Object module edits the transform of. */
44
48
  gizmoTargetNode: TransformNode;
49
+ /** The Object module's title for that node. */
45
50
  gizmoTargetLabel: string;
46
51
  /** Texture presets offered in the Renderer module (host supplies the loader). */
47
52
  textureOptions?: TextureOption[];
48
53
  /** Mesh presets offered for the Mesh render mode (host supplies the geometry buffers). */
49
54
  geometryOptions?: GeometryOption[];
50
- resolveTexture?: (url: string) => unknown;
55
+ /** Host texture loader for picked URLs; a plain `Texture` is made without it. */
56
+ resolveTexture?: (url: string) => Texture | null | undefined;
51
57
  /** Host loader for "Load from file…" in the Mesh render mode (e.g. a GLB importer). */
52
58
  resolveGeometry?: (file: File) => Promise<GeometryData>;
53
59
  }