@jamesyong42/infinite-canvas 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -9
- package/dist/SelectionRenderer-CR2PBQwx.d.cts +105 -0
- package/dist/SelectionRenderer-CR2PBQwx.d.cts.map +1 -0
- package/dist/SelectionRenderer-DlsBstAq.d.mts +105 -0
- package/dist/SelectionRenderer-DlsBstAq.d.mts.map +1 -0
- package/dist/WebGLWidgetLayer-BBMuwzHq.cjs +3560 -0
- package/dist/WebGLWidgetLayer-BBMuwzHq.cjs.map +1 -0
- package/dist/WebGLWidgetLayer-C3p1tnpm.mjs +3375 -0
- package/dist/WebGLWidgetLayer-C3p1tnpm.mjs.map +1 -0
- package/dist/advanced.cjs +110 -165
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.d.cts +58 -40
- package/dist/advanced.d.cts.map +1 -0
- package/dist/advanced.d.mts +99 -0
- package/dist/advanced.d.mts.map +1 -0
- package/dist/advanced.mjs +105 -0
- package/dist/advanced.mjs.map +1 -0
- package/dist/devtools.cjs +654 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +23 -0
- package/dist/devtools.d.cts.map +1 -0
- package/dist/devtools.d.mts +23 -0
- package/dist/devtools.d.mts.map +1 -0
- package/dist/devtools.mjs +652 -0
- package/dist/devtools.mjs.map +1 -0
- package/dist/engine-BfbvWXSk.d.mts +982 -0
- package/dist/engine-BfbvWXSk.d.mts.map +1 -0
- package/dist/engine-CCjuFMC-.d.cts +982 -0
- package/dist/engine-CCjuFMC-.d.cts.map +1 -0
- package/dist/hooks-BwY7rRHg.mjs +425 -0
- package/dist/hooks-BwY7rRHg.mjs.map +1 -0
- package/dist/hooks-DHShH86C.cjs +707 -0
- package/dist/hooks-DHShH86C.cjs.map +1 -0
- package/dist/index.cjs +909 -803
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +199 -67
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +258 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +855 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +47 -15
- package/dist/SelectionRenderer-CeWSNZT8.d.cts +0 -891
- package/dist/SelectionRenderer-CeWSNZT8.d.ts +0 -891
- package/dist/advanced.d.ts +0 -81
- package/dist/advanced.js +0 -124
- package/dist/advanced.js.map +0 -1
- package/dist/chunk-VSHXWTJH.cjs +0 -3228
- package/dist/chunk-VSHXWTJH.cjs.map +0 -1
- package/dist/chunk-Z6JQQOWL.js +0 -3142
- package/dist/chunk-Z6JQQOWL.js.map +0 -1
- package/dist/index.d.ts +0 -126
- package/dist/index.js +0 -602
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,126 +1,258 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import 'three';
|
|
1
|
+
import { $ as Active, A as NavigationFrame, At as CommandBuffer, B as WidgetSurface, Ct as Visible, D as CardPresetsResource, Dt as WorldBounds, E as CameraResource, Et as WidgetData, F as DomWidgetProps, Ft as ArchetypeRegistry, G as FrameTimeStats, H as isR3FWidget, I as R3FWidget, It as SpawnOptions, J as R3FSample, L as R3FWidgetProps, Lt as createArchetypeRegistry, M as ViewportResource, Mt as ResizeCommand, N as ZoomConfigResource, Nt as SetComponentCommand, O as CursorResource, Ot as ZIndex, P as DomWidget, Pt as Archetype, Q as WebGLStats, R as Widget$1, S as SnapResult, St as Transform2D, T as BreakpointConfigResource, Tt as WidgetBreakpoint, U as StandardSchemaV1, V as createWidgetRegistry, W as EcsStats, X as TickSample, Y as R3FStats, Z as WebGLPass, _ as worldBoundsToAABB, _t as Resizable, a as PointerDirective, at as CursorHint, b as EqualSpacingIndicator, bt as Selected, c as createLayoutEngine, ct as Dragging, d as Rect, dt as Hitbox, et as CSSCursor, f as Vec2, ft as InteractionRole, g as screenToWorld, gt as Parent, h as pointInAABB, ht as Locked, i as Modifiers, it as Container, j as NavigationStackResource, jt as MoveCommand, k as CursorResourceData, kt as Command, lt as HandleSet, m as intersectsAABB, mt as InteractionRoleType, n as LayoutEngine, nt as CardPreset, ot as CursorHintData, p as clamp, pt as InteractionRoleData, q as ProfilerStats, r as LayoutEngineConfig, rt as Children, s as VisibleEntity, st as Draggable, t as FrameChanges, tt as Card, u as AABB, ut as HandleSetData, v as worldToScreen, vt as ResizeHandlePos, w as Breakpoint, wt as Widget, x as SnapGuide, xt as SelectionFrame, y as EntityBounds, yt as Selectable, z as WidgetRegistry } from "./engine-CCjuFMC-.cjs";
|
|
2
|
+
import { a as DEFAULT_GRID_CONFIG, d as WidgetResolverProvider, f as useContainerRef, m as useWidgetResolver, n as SelectionBounds, o as GridConfig, p as useLayoutEngine, r as SelectionConfig, t as DEFAULT_SELECTION_CONFIG, u as ResolvedWidget } from "./SelectionRenderer-CR2PBQwx.cjs";
|
|
3
|
+
import { ComponentInit, ComponentType, ComponentType as ComponentType$1, EntityId, EntityId as EntityId$1, ResourceType, ResourceType as ResourceType$1, TagType, TagType as TagType$1, Unsubscribe } from "@jamesyong42/reactive-ecs";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import React, { ReactNode } from "react";
|
|
6
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
7
|
|
|
8
|
+
//#region src/react/card.d.ts
|
|
9
|
+
/** Props accepted by `<CardFrame>`. */
|
|
10
|
+
interface CardFrameProps {
|
|
11
|
+
entityId: EntityId$1;
|
|
12
|
+
children?: React$1.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Merged into the frame div's style (wins over defaults). */
|
|
15
|
+
style?: React$1.CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Visual chrome for an iOS-style card: rounded corners, hairline ring,
|
|
19
|
+
* soft drop shadow, and a subtle lift (scale + stronger shadow) while
|
|
20
|
+
* the entity carries the `Dragging` tag.
|
|
21
|
+
*
|
|
22
|
+
* Uses CSS transitions — no animation library dependency.
|
|
23
|
+
*/
|
|
24
|
+
declare function CardFrame({
|
|
25
|
+
entityId,
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
style
|
|
29
|
+
}: CardFrameProps): _$react_jsx_runtime0.JSX.Element;
|
|
30
|
+
/** Options passed to `createCardWidget`. */
|
|
31
|
+
interface CreateCardWidgetOptions<T> {
|
|
32
|
+
/** Unique widget type id. Doubles as the archetype id. */
|
|
33
|
+
type: string;
|
|
34
|
+
/** Which iOS preset the card sits at. Fixed for the widget's lifetime (change via `engine.set(id, Card, { preset })`). */
|
|
35
|
+
size: CardPreset;
|
|
36
|
+
/** Standard Schema v1-compatible validator for the widget's data. */
|
|
37
|
+
schema: StandardSchemaV1<any, T>;
|
|
38
|
+
/** Default data for new instances; merged with user-supplied data at spawn. */
|
|
39
|
+
defaultData: T;
|
|
40
|
+
/** The card's rendered content. Receives entityId + typed data. */
|
|
41
|
+
render: React$1.ComponentType<{
|
|
42
|
+
entityId: EntityId$1;
|
|
43
|
+
data: T;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns a paired widget + archetype for an iOS-style card. Register both
|
|
48
|
+
* with `createLayoutEngine({ widgets: [card.widget], archetypes: [card.archetype] })`
|
|
49
|
+
* (or via `engine.registerWidget` / `engine.registerArchetype`) and spawn with
|
|
50
|
+
* `engine.spawn('your-card-type', { at, data })`.
|
|
51
|
+
*
|
|
52
|
+
* The produced widget is non-resizable (Selectable + Draggable only), wrapped
|
|
53
|
+
* in `<CardFrame>`, and spawns with a `Card` component so `cardSystem` enforces
|
|
54
|
+
* the preset size each tick.
|
|
55
|
+
*/
|
|
56
|
+
declare function createCardWidget<T>(opts: CreateCardWidgetOptions<T>): {
|
|
57
|
+
widget: DomWidget<T>;
|
|
58
|
+
archetype: Archetype;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/react/geometry-card.d.ts
|
|
62
|
+
/** Background options for a geometry card widget. */
|
|
63
|
+
type GeometryCardBackground = 'card' | 'transparent' | {
|
|
64
|
+
/** Hex color for the card back (e.g. '#1C1C1E' dark, '#F2F2F7' light). */color: string; /** PBR roughness. Default 0.55. */
|
|
65
|
+
roughness?: number; /** PBR metalness. Default 0. */
|
|
66
|
+
metalness?: number;
|
|
67
|
+
};
|
|
68
|
+
/** Props passed to the user's geometry component. */
|
|
69
|
+
interface GeometryCardRenderProps<T> {
|
|
70
|
+
entityId: EntityId$1;
|
|
71
|
+
data: T;
|
|
72
|
+
/** Widget width in world units. */
|
|
73
|
+
width: number;
|
|
74
|
+
/** Widget height in world units. */
|
|
75
|
+
height: number;
|
|
76
|
+
}
|
|
77
|
+
/** Options for `createGeometryCardWidget`. */
|
|
78
|
+
interface CreateGeometryCardWidgetOptions<T> {
|
|
79
|
+
/** Unique widget type id. Doubles as the archetype id. */
|
|
80
|
+
type: string;
|
|
81
|
+
/** iOS card preset size. */
|
|
82
|
+
size: CardPreset;
|
|
83
|
+
/** Standard Schema v1-compatible validator for the widget's data. */
|
|
84
|
+
schema: StandardSchemaV1<any, T>;
|
|
85
|
+
/** Default data for new instances. */
|
|
86
|
+
defaultData: T;
|
|
87
|
+
/**
|
|
88
|
+
* `'card'` (default) renders a dark iOS-style card back behind the geometry.
|
|
89
|
+
* `'transparent'` skips the card so the geometry floats over the canvas.
|
|
90
|
+
* Object form customises the back's color and PBR parameters.
|
|
91
|
+
*/
|
|
92
|
+
background?: GeometryCardBackground;
|
|
93
|
+
/** The 3D content rendered in local space (origin at centre). */
|
|
94
|
+
geometry: React$1.ComponentType<GeometryCardRenderProps<T>>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns a paired R3F widget + archetype for a card-shaped 3D widget.
|
|
98
|
+
* Behaves like {@link createCardWidget} — fixed preset size, non-resizable,
|
|
99
|
+
* no engine-drawn selection frame, and lifts on drag (scale + z) — but
|
|
100
|
+
* renders a three.js scene instead of DOM content.
|
|
101
|
+
*
|
|
102
|
+
* Lighting: this helper adds no lights. Declare your own in the `geometry`
|
|
103
|
+
* component (typically a local `pointLight` scoped with `distance`).
|
|
104
|
+
*/
|
|
105
|
+
declare function createGeometryCardWidget<T>(opts: CreateGeometryCardWidgetOptions<T>): {
|
|
106
|
+
widget: R3FWidget<T>;
|
|
107
|
+
archetype: Archetype;
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/react/hooks.d.ts
|
|
9
111
|
/**
|
|
10
112
|
* Reactively reads an ECS component from an entity.
|
|
11
113
|
* Returns undefined if the entity doesn't have the component. Re-renders when the component changes.
|
|
12
114
|
*/
|
|
13
|
-
declare function useComponent<T>(entity: EntityId, type: ComponentType<T>): T | undefined;
|
|
115
|
+
declare function useComponent<T>(entity: EntityId$1, type: ComponentType$1<T>): T | undefined;
|
|
14
116
|
/**
|
|
15
117
|
* Reactively checks whether an entity has a tag.
|
|
16
118
|
* Re-renders when the tag is added or removed.
|
|
17
119
|
*/
|
|
18
|
-
declare function useTag(entity: EntityId, type: TagType): boolean;
|
|
120
|
+
declare function useTag(entity: EntityId$1, type: TagType$1): boolean;
|
|
19
121
|
/**
|
|
20
122
|
* Reactively reads an ECS resource (singleton data).
|
|
21
123
|
* Re-renders when any field of the resource changes (shallow comparison).
|
|
22
124
|
*/
|
|
23
|
-
declare function useResource<T>(type: ResourceType<T>): T;
|
|
125
|
+
declare function useResource<T>(type: ResourceType$1<T>): T;
|
|
24
126
|
/**
|
|
25
127
|
* Returns entity IDs matching all specified component/tag types.
|
|
26
128
|
* Re-renders when the result set changes.
|
|
27
129
|
*/
|
|
28
|
-
declare function useQuery(...types: (ComponentType | TagType)[]): EntityId[];
|
|
130
|
+
declare function useQuery(...types: (ComponentType$1 | TagType$1)[]): EntityId$1[];
|
|
29
131
|
/**
|
|
30
132
|
* Returns all entity IDs that have the specified tag.
|
|
31
133
|
* Re-renders when entities are tagged or untagged.
|
|
32
134
|
*/
|
|
33
|
-
declare function useTaggedEntities(type: TagType): EntityId[];
|
|
135
|
+
declare function useTaggedEntities(type: TagType$1): EntityId$1[];
|
|
34
136
|
/**
|
|
35
137
|
* Returns the current camera state {x, y, zoom}.
|
|
36
138
|
* Shorthand for useResource(CameraResource).
|
|
37
139
|
*/
|
|
38
140
|
declare function useCamera(): {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
141
|
+
x: number;
|
|
142
|
+
y: number;
|
|
143
|
+
zoom: number;
|
|
42
144
|
};
|
|
43
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Reactively returns the IDs of every live entity in the world.
|
|
147
|
+
* Updates on entity create and destroy.
|
|
148
|
+
*/
|
|
149
|
+
declare function useAllEntities(): EntityId$1[];
|
|
150
|
+
/**
|
|
151
|
+
* Reactively returns the ComponentTypes currently attached to an entity.
|
|
152
|
+
* Polls per frame (engine only ticks when dirty), but never re-renders unless the set changes.
|
|
153
|
+
*/
|
|
154
|
+
declare function useEntityComponents(entity: EntityId$1): ComponentType$1[];
|
|
155
|
+
/**
|
|
156
|
+
* Reactively returns the TagTypes currently attached to an entity.
|
|
157
|
+
*/
|
|
158
|
+
declare function useEntityTags(entity: EntityId$1): TagType$1[];
|
|
159
|
+
/**
|
|
160
|
+
* Reactively returns every ComponentType the world has observed.
|
|
161
|
+
* Grows over time as new component types are first used.
|
|
162
|
+
*/
|
|
163
|
+
declare function useRegisteredComponents(): ComponentType$1[];
|
|
164
|
+
/**
|
|
165
|
+
* Reactively returns every TagType the world has observed.
|
|
166
|
+
*/
|
|
167
|
+
declare function useRegisteredTags(): TagType$1[];
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/react/InfiniteCanvas.d.ts
|
|
44
170
|
/** Imperative handle exposed via `ref` on InfiniteCanvas for programmatic control. */
|
|
45
171
|
interface InfiniteCanvasHandle {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
172
|
+
/** Moves the camera to the specified world coordinates. */
|
|
173
|
+
panTo(worldX: number, worldY: number): void;
|
|
174
|
+
/** Sets the zoom level directly. */
|
|
175
|
+
zoomTo(zoom: number): void;
|
|
176
|
+
/** Adjusts camera to fit all entities in the viewport. */
|
|
177
|
+
zoomToFit(padding?: number): void;
|
|
178
|
+
/** Undoes the last command or command group. */
|
|
179
|
+
undo(): void;
|
|
180
|
+
/** Redoes the last undone command. */
|
|
181
|
+
redo(): void;
|
|
182
|
+
/** Returns the underlying LayoutEngine instance. */
|
|
183
|
+
getEngine(): LayoutEngine;
|
|
58
184
|
}
|
|
59
185
|
/** Props for the InfiniteCanvas component. */
|
|
60
186
|
interface InfiniteCanvasProps {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
187
|
+
/**
|
|
188
|
+
* The LayoutEngine instance powering this canvas. Create with `createLayoutEngine()`.
|
|
189
|
+
* Widgets and archetypes must be registered on the engine — via config or
|
|
190
|
+
* `engine.registerWidget` / `engine.registerArchetype`.
|
|
191
|
+
*/
|
|
192
|
+
engine: LayoutEngine;
|
|
193
|
+
/** Grid configuration. Pass `false` to disable the grid entirely. */
|
|
194
|
+
grid?: Partial<GridConfig> | false;
|
|
195
|
+
/** Selection highlight style configuration. */
|
|
196
|
+
selection?: Partial<SelectionConfig>;
|
|
197
|
+
/** Called when the set of selected entities changes. */
|
|
198
|
+
onSelectionChange?: (entityIds: EntityId$1[]) => void;
|
|
199
|
+
/** Called when the camera (pan/zoom) changes. */
|
|
200
|
+
onCameraChange?: (camera: {
|
|
201
|
+
x: number;
|
|
202
|
+
y: number;
|
|
203
|
+
zoom: number;
|
|
204
|
+
}) => void;
|
|
205
|
+
/** Called when navigation depth changes (entering/exiting containers). */
|
|
206
|
+
onNavigationChange?: (depth: number, containerId: EntityId$1 | null) => void;
|
|
207
|
+
/** CSS class name applied to the root container div. */
|
|
208
|
+
className?: string;
|
|
209
|
+
/** Inline styles applied to the root container div. */
|
|
210
|
+
style?: React.CSSProperties;
|
|
211
|
+
/** Overlay children (toolbars, panels) rendered on top of the canvas. */
|
|
212
|
+
children?: React.ReactNode;
|
|
87
213
|
}
|
|
88
|
-
declare const InfiniteCanvas:
|
|
89
|
-
|
|
214
|
+
declare const InfiniteCanvas: React.ForwardRefExoticComponent<InfiniteCanvasProps & React.RefAttributes<InfiniteCanvasHandle>>;
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/react/WidgetProvider.d.ts
|
|
90
217
|
interface WidgetProviderProps {
|
|
91
|
-
|
|
92
|
-
|
|
218
|
+
engine: LayoutEngine;
|
|
219
|
+
children?: ReactNode;
|
|
93
220
|
}
|
|
94
221
|
/**
|
|
95
222
|
* Bridges the engine's widget registry to React context so WidgetSlot /
|
|
96
223
|
* WebGLWidgetLayer can resolve components by type.
|
|
97
224
|
*/
|
|
98
|
-
declare function WidgetProvider({
|
|
99
|
-
|
|
225
|
+
declare function WidgetProvider({
|
|
226
|
+
engine,
|
|
227
|
+
children
|
|
228
|
+
}: WidgetProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/react/widget-hooks.d.ts
|
|
100
231
|
/**
|
|
101
232
|
* Returns the custom data attached to a widget entity.
|
|
102
233
|
* Use the generic parameter for type safety: `useWidgetData<MyData>(entityId)`. Re-renders when data changes.
|
|
103
234
|
*/
|
|
104
|
-
declare function useWidgetData<T = Record<string, unknown>>(entityId: EntityId): T;
|
|
235
|
+
declare function useWidgetData<T = Record<string, unknown>>(entityId: EntityId$1): T;
|
|
105
236
|
/**
|
|
106
237
|
* Returns the current responsive breakpoint for a widget based on its screen-space size.
|
|
107
238
|
* Re-renders when the breakpoint changes.
|
|
108
239
|
*/
|
|
109
|
-
declare function useBreakpoint(entityId: EntityId): Breakpoint;
|
|
240
|
+
declare function useBreakpoint(entityId: EntityId$1): Breakpoint;
|
|
110
241
|
/**
|
|
111
242
|
* Returns child entity IDs of a container entity.
|
|
112
243
|
* Re-renders when children are added or removed.
|
|
113
244
|
*/
|
|
114
|
-
declare function useChildren(entityId: EntityId): EntityId[];
|
|
245
|
+
declare function useChildren(entityId: EntityId$1): EntityId$1[];
|
|
115
246
|
/**
|
|
116
247
|
* Returns whether the entity is currently selected.
|
|
117
248
|
* Re-renders when the entity's selection state changes.
|
|
118
249
|
*/
|
|
119
|
-
declare function useIsSelected(entityId: EntityId): boolean;
|
|
250
|
+
declare function useIsSelected(entityId: EntityId$1): boolean;
|
|
120
251
|
/**
|
|
121
252
|
* Returns a function to update the widget's custom data.
|
|
122
253
|
* Merges the patch into existing data via shallow spread.
|
|
123
254
|
*/
|
|
124
|
-
declare function useUpdateWidget(entityId: EntityId): (patch: Record<string, unknown>) => void;
|
|
125
|
-
|
|
126
|
-
export { Breakpoint, GridConfig, InfiniteCanvas, type InfiniteCanvasHandle, LayoutEngine, SelectionConfig, WidgetProvider, useBreakpoint, useCamera, useChildren, useComponent, useIsSelected, useQuery, useResource, useTag, useTaggedEntities, useUpdateWidget, useWidgetData };
|
|
255
|
+
declare function useUpdateWidget(entityId: EntityId$1): (patch: Record<string, unknown>) => void;
|
|
256
|
+
//#endregion
|
|
257
|
+
export { type AABB, Active, type Archetype, type ArchetypeRegistry, type Breakpoint, BreakpointConfigResource, type CSSCursor, CameraResource, Card, CardFrame, type CardFrameProps, type CardPreset, CardPresetsResource, Children, type Command, CommandBuffer, type ComponentInit, type ComponentType, Container, type CreateCardWidgetOptions, type CreateGeometryCardWidgetOptions, CursorHint, type CursorHintData, CursorResource, type CursorResourceData, DEFAULT_GRID_CONFIG, DEFAULT_SELECTION_CONFIG, type DomWidget, type DomWidgetProps, Draggable, Dragging, type EcsStats, type EntityBounds, type EntityId, type EqualSpacingIndicator, type FrameChanges, type FrameTimeStats, type GeometryCardBackground, type GeometryCardRenderProps, type GridConfig, HandleSet, type HandleSetData, Hitbox, InfiniteCanvas, type InfiniteCanvasHandle, InteractionRole, type InteractionRoleData, type InteractionRoleType, type LayoutEngine, type LayoutEngineConfig, Locked, type Modifiers, MoveCommand, type NavigationFrame, NavigationStackResource, Parent, type PointerDirective, type ProfilerStats, type R3FSample, type R3FStats, type R3FWidget, type R3FWidgetProps, type Rect, Resizable, ResizeCommand, type ResizeHandlePos, type ResolvedWidget, type ResourceType, Selectable, Selected, type SelectionBounds, type SelectionConfig, SelectionFrame, SetComponentCommand, type SnapGuide, type SnapResult, type SpawnOptions, type StandardSchemaV1, type TagType, type TickSample, Transform2D, type Unsubscribe, type Vec2, ViewportResource, Visible, type VisibleEntity, type WebGLPass, type WebGLStats, Widget, WidgetBreakpoint, WidgetData, type Widget$1 as WidgetDef, WidgetProvider, type WidgetRegistry, WidgetResolverProvider, type WidgetSurface, WorldBounds, ZIndex, ZoomConfigResource, clamp, createArchetypeRegistry, createCardWidget, createGeometryCardWidget, createLayoutEngine, createWidgetRegistry, intersectsAABB, isR3FWidget, pointInAABB, screenToWorld, useAllEntities, useBreakpoint, useCamera, useChildren, useComponent, useContainerRef, useEntityComponents, useEntityTags, useIsSelected, useLayoutEngine, useQuery, useRegisteredComponents, useRegisteredTags, useResource, useTag, useTaggedEntities, useUpdateWidget, useWidgetData, useWidgetResolver, worldBoundsToAABB, worldToScreen };
|
|
258
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/react/card.tsx","../src/react/geometry-card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,UAAA;EHhBmC;EGkBnE,cAAA,IAAkB,MAAA;IAAU,CAAA;IAAW,CAAA;IAAW,IAAA;EAAA;EHlBb;EGoBrC,kBAAA,IAAsB,KAAA,UAAe,WAAA,EAAa,UAAA;EHpBH;EGsB/C,SAAA;EHtB0D;EGwB1D,KAAA,GAAQ,KAAA,CAAM,aAAA;EHxBqD;EG0BnE,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA;AAAA,cAGL,cAAA,EAAc,KAAA,CAAA,yBAAA,CAAA,mBAAA,GAAA,KAAA,CAAA,aAAA,CAAA,oBAAA;;;UC5DjB,mBAAA;EACT,MAAA,EAAQ,YAAA;EACR,QAAA,GAAW,SAAA;AAAA;;;AJcZ;;iBIPgB,cAAA,CAAA;EAAiB,MAAA;EAAQ;AAAA,GAAY,mBAAA,GAAmB,oBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBCLxD,aAAA,KAAkB,MAAA,kBAAA,CAAyB,QAAA,EAAU,UAAA,GAAW,CAAA;;ALYhF;;;iBKHgB,aAAA,CAAc,QAAA,EAAU,UAAA,GAAW,UAAA;;;;;iBASnC,WAAA,CAAY,QAAA,EAAU,UAAA,GAAW,UAAA;;;;;iBASjC,aAAA,CAAc,QAAA,EAAU,UAAA;;;;;iBAQxB,eAAA,CAAgB,QAAA,EAAU,UAAA,IAAY,KAAA,EAAO,MAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { $ as Active, A as NavigationFrame, At as CommandBuffer, B as WidgetSurface, Ct as Visible, D as CardPresetsResource, Dt as WorldBounds, E as CameraResource, Et as WidgetData, F as DomWidgetProps, Ft as ArchetypeRegistry, G as FrameTimeStats, H as isR3FWidget, I as R3FWidget, It as SpawnOptions, J as R3FSample, L as R3FWidgetProps, Lt as createArchetypeRegistry, M as ViewportResource, Mt as ResizeCommand, N as ZoomConfigResource, Nt as SetComponentCommand, O as CursorResource, Ot as ZIndex, P as DomWidget, Pt as Archetype, Q as WebGLStats, R as Widget$1, S as SnapResult, St as Transform2D, T as BreakpointConfigResource, Tt as WidgetBreakpoint, U as StandardSchemaV1, V as createWidgetRegistry, W as EcsStats, X as TickSample, Y as R3FStats, Z as WebGLPass, _ as worldBoundsToAABB, _t as Resizable, a as PointerDirective, at as CursorHint, b as EqualSpacingIndicator, bt as Selected, c as createLayoutEngine, ct as Dragging, d as Rect, dt as Hitbox, et as CSSCursor, f as Vec2, ft as InteractionRole, g as screenToWorld, gt as Parent, h as pointInAABB, ht as Locked, i as Modifiers, it as Container, j as NavigationStackResource, jt as MoveCommand, k as CursorResourceData, kt as Command, lt as HandleSet, m as intersectsAABB, mt as InteractionRoleType, n as LayoutEngine, nt as CardPreset, ot as CursorHintData, p as clamp, pt as InteractionRoleData, q as ProfilerStats, r as LayoutEngineConfig, rt as Children, s as VisibleEntity, st as Draggable, t as FrameChanges, tt as Card, u as AABB, ut as HandleSetData, v as worldToScreen, vt as ResizeHandlePos, w as Breakpoint, wt as Widget, x as SnapGuide, xt as SelectionFrame, y as EntityBounds, yt as Selectable, z as WidgetRegistry } from "./engine-BfbvWXSk.mjs";
|
|
2
|
+
import { a as DEFAULT_GRID_CONFIG, d as WidgetResolverProvider, f as useContainerRef, m as useWidgetResolver, n as SelectionBounds, o as GridConfig, p as useLayoutEngine, r as SelectionConfig, t as DEFAULT_SELECTION_CONFIG, u as ResolvedWidget } from "./SelectionRenderer-DlsBstAq.mjs";
|
|
3
|
+
import { ComponentInit, ComponentType, ComponentType as ComponentType$1, EntityId, EntityId as EntityId$1, ResourceType, ResourceType as ResourceType$1, TagType, TagType as TagType$1, Unsubscribe } from "@jamesyong42/reactive-ecs";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import React, { ReactNode } from "react";
|
|
6
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react/card.d.ts
|
|
9
|
+
/** Props accepted by `<CardFrame>`. */
|
|
10
|
+
interface CardFrameProps {
|
|
11
|
+
entityId: EntityId$1;
|
|
12
|
+
children?: React$1.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Merged into the frame div's style (wins over defaults). */
|
|
15
|
+
style?: React$1.CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Visual chrome for an iOS-style card: rounded corners, hairline ring,
|
|
19
|
+
* soft drop shadow, and a subtle lift (scale + stronger shadow) while
|
|
20
|
+
* the entity carries the `Dragging` tag.
|
|
21
|
+
*
|
|
22
|
+
* Uses CSS transitions — no animation library dependency.
|
|
23
|
+
*/
|
|
24
|
+
declare function CardFrame({
|
|
25
|
+
entityId,
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
style
|
|
29
|
+
}: CardFrameProps): _$react_jsx_runtime0.JSX.Element;
|
|
30
|
+
/** Options passed to `createCardWidget`. */
|
|
31
|
+
interface CreateCardWidgetOptions<T> {
|
|
32
|
+
/** Unique widget type id. Doubles as the archetype id. */
|
|
33
|
+
type: string;
|
|
34
|
+
/** Which iOS preset the card sits at. Fixed for the widget's lifetime (change via `engine.set(id, Card, { preset })`). */
|
|
35
|
+
size: CardPreset;
|
|
36
|
+
/** Standard Schema v1-compatible validator for the widget's data. */
|
|
37
|
+
schema: StandardSchemaV1<any, T>;
|
|
38
|
+
/** Default data for new instances; merged with user-supplied data at spawn. */
|
|
39
|
+
defaultData: T;
|
|
40
|
+
/** The card's rendered content. Receives entityId + typed data. */
|
|
41
|
+
render: React$1.ComponentType<{
|
|
42
|
+
entityId: EntityId$1;
|
|
43
|
+
data: T;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns a paired widget + archetype for an iOS-style card. Register both
|
|
48
|
+
* with `createLayoutEngine({ widgets: [card.widget], archetypes: [card.archetype] })`
|
|
49
|
+
* (or via `engine.registerWidget` / `engine.registerArchetype`) and spawn with
|
|
50
|
+
* `engine.spawn('your-card-type', { at, data })`.
|
|
51
|
+
*
|
|
52
|
+
* The produced widget is non-resizable (Selectable + Draggable only), wrapped
|
|
53
|
+
* in `<CardFrame>`, and spawns with a `Card` component so `cardSystem` enforces
|
|
54
|
+
* the preset size each tick.
|
|
55
|
+
*/
|
|
56
|
+
declare function createCardWidget<T>(opts: CreateCardWidgetOptions<T>): {
|
|
57
|
+
widget: DomWidget<T>;
|
|
58
|
+
archetype: Archetype;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/react/geometry-card.d.ts
|
|
62
|
+
/** Background options for a geometry card widget. */
|
|
63
|
+
type GeometryCardBackground = 'card' | 'transparent' | {
|
|
64
|
+
/** Hex color for the card back (e.g. '#1C1C1E' dark, '#F2F2F7' light). */color: string; /** PBR roughness. Default 0.55. */
|
|
65
|
+
roughness?: number; /** PBR metalness. Default 0. */
|
|
66
|
+
metalness?: number;
|
|
67
|
+
};
|
|
68
|
+
/** Props passed to the user's geometry component. */
|
|
69
|
+
interface GeometryCardRenderProps<T> {
|
|
70
|
+
entityId: EntityId$1;
|
|
71
|
+
data: T;
|
|
72
|
+
/** Widget width in world units. */
|
|
73
|
+
width: number;
|
|
74
|
+
/** Widget height in world units. */
|
|
75
|
+
height: number;
|
|
76
|
+
}
|
|
77
|
+
/** Options for `createGeometryCardWidget`. */
|
|
78
|
+
interface CreateGeometryCardWidgetOptions<T> {
|
|
79
|
+
/** Unique widget type id. Doubles as the archetype id. */
|
|
80
|
+
type: string;
|
|
81
|
+
/** iOS card preset size. */
|
|
82
|
+
size: CardPreset;
|
|
83
|
+
/** Standard Schema v1-compatible validator for the widget's data. */
|
|
84
|
+
schema: StandardSchemaV1<any, T>;
|
|
85
|
+
/** Default data for new instances. */
|
|
86
|
+
defaultData: T;
|
|
87
|
+
/**
|
|
88
|
+
* `'card'` (default) renders a dark iOS-style card back behind the geometry.
|
|
89
|
+
* `'transparent'` skips the card so the geometry floats over the canvas.
|
|
90
|
+
* Object form customises the back's color and PBR parameters.
|
|
91
|
+
*/
|
|
92
|
+
background?: GeometryCardBackground;
|
|
93
|
+
/** The 3D content rendered in local space (origin at centre). */
|
|
94
|
+
geometry: React$1.ComponentType<GeometryCardRenderProps<T>>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns a paired R3F widget + archetype for a card-shaped 3D widget.
|
|
98
|
+
* Behaves like {@link createCardWidget} — fixed preset size, non-resizable,
|
|
99
|
+
* no engine-drawn selection frame, and lifts on drag (scale + z) — but
|
|
100
|
+
* renders a three.js scene instead of DOM content.
|
|
101
|
+
*
|
|
102
|
+
* Lighting: this helper adds no lights. Declare your own in the `geometry`
|
|
103
|
+
* component (typically a local `pointLight` scoped with `distance`).
|
|
104
|
+
*/
|
|
105
|
+
declare function createGeometryCardWidget<T>(opts: CreateGeometryCardWidgetOptions<T>): {
|
|
106
|
+
widget: R3FWidget<T>;
|
|
107
|
+
archetype: Archetype;
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/react/hooks.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Reactively reads an ECS component from an entity.
|
|
113
|
+
* Returns undefined if the entity doesn't have the component. Re-renders when the component changes.
|
|
114
|
+
*/
|
|
115
|
+
declare function useComponent<T>(entity: EntityId$1, type: ComponentType$1<T>): T | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Reactively checks whether an entity has a tag.
|
|
118
|
+
* Re-renders when the tag is added or removed.
|
|
119
|
+
*/
|
|
120
|
+
declare function useTag(entity: EntityId$1, type: TagType$1): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Reactively reads an ECS resource (singleton data).
|
|
123
|
+
* Re-renders when any field of the resource changes (shallow comparison).
|
|
124
|
+
*/
|
|
125
|
+
declare function useResource<T>(type: ResourceType$1<T>): T;
|
|
126
|
+
/**
|
|
127
|
+
* Returns entity IDs matching all specified component/tag types.
|
|
128
|
+
* Re-renders when the result set changes.
|
|
129
|
+
*/
|
|
130
|
+
declare function useQuery(...types: (ComponentType$1 | TagType$1)[]): EntityId$1[];
|
|
131
|
+
/**
|
|
132
|
+
* Returns all entity IDs that have the specified tag.
|
|
133
|
+
* Re-renders when entities are tagged or untagged.
|
|
134
|
+
*/
|
|
135
|
+
declare function useTaggedEntities(type: TagType$1): EntityId$1[];
|
|
136
|
+
/**
|
|
137
|
+
* Returns the current camera state {x, y, zoom}.
|
|
138
|
+
* Shorthand for useResource(CameraResource).
|
|
139
|
+
*/
|
|
140
|
+
declare function useCamera(): {
|
|
141
|
+
x: number;
|
|
142
|
+
y: number;
|
|
143
|
+
zoom: number;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Reactively returns the IDs of every live entity in the world.
|
|
147
|
+
* Updates on entity create and destroy.
|
|
148
|
+
*/
|
|
149
|
+
declare function useAllEntities(): EntityId$1[];
|
|
150
|
+
/**
|
|
151
|
+
* Reactively returns the ComponentTypes currently attached to an entity.
|
|
152
|
+
* Polls per frame (engine only ticks when dirty), but never re-renders unless the set changes.
|
|
153
|
+
*/
|
|
154
|
+
declare function useEntityComponents(entity: EntityId$1): ComponentType$1[];
|
|
155
|
+
/**
|
|
156
|
+
* Reactively returns the TagTypes currently attached to an entity.
|
|
157
|
+
*/
|
|
158
|
+
declare function useEntityTags(entity: EntityId$1): TagType$1[];
|
|
159
|
+
/**
|
|
160
|
+
* Reactively returns every ComponentType the world has observed.
|
|
161
|
+
* Grows over time as new component types are first used.
|
|
162
|
+
*/
|
|
163
|
+
declare function useRegisteredComponents(): ComponentType$1[];
|
|
164
|
+
/**
|
|
165
|
+
* Reactively returns every TagType the world has observed.
|
|
166
|
+
*/
|
|
167
|
+
declare function useRegisteredTags(): TagType$1[];
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/react/InfiniteCanvas.d.ts
|
|
170
|
+
/** Imperative handle exposed via `ref` on InfiniteCanvas for programmatic control. */
|
|
171
|
+
interface InfiniteCanvasHandle {
|
|
172
|
+
/** Moves the camera to the specified world coordinates. */
|
|
173
|
+
panTo(worldX: number, worldY: number): void;
|
|
174
|
+
/** Sets the zoom level directly. */
|
|
175
|
+
zoomTo(zoom: number): void;
|
|
176
|
+
/** Adjusts camera to fit all entities in the viewport. */
|
|
177
|
+
zoomToFit(padding?: number): void;
|
|
178
|
+
/** Undoes the last command or command group. */
|
|
179
|
+
undo(): void;
|
|
180
|
+
/** Redoes the last undone command. */
|
|
181
|
+
redo(): void;
|
|
182
|
+
/** Returns the underlying LayoutEngine instance. */
|
|
183
|
+
getEngine(): LayoutEngine;
|
|
184
|
+
}
|
|
185
|
+
/** Props for the InfiniteCanvas component. */
|
|
186
|
+
interface InfiniteCanvasProps {
|
|
187
|
+
/**
|
|
188
|
+
* The LayoutEngine instance powering this canvas. Create with `createLayoutEngine()`.
|
|
189
|
+
* Widgets and archetypes must be registered on the engine — via config or
|
|
190
|
+
* `engine.registerWidget` / `engine.registerArchetype`.
|
|
191
|
+
*/
|
|
192
|
+
engine: LayoutEngine;
|
|
193
|
+
/** Grid configuration. Pass `false` to disable the grid entirely. */
|
|
194
|
+
grid?: Partial<GridConfig> | false;
|
|
195
|
+
/** Selection highlight style configuration. */
|
|
196
|
+
selection?: Partial<SelectionConfig>;
|
|
197
|
+
/** Called when the set of selected entities changes. */
|
|
198
|
+
onSelectionChange?: (entityIds: EntityId$1[]) => void;
|
|
199
|
+
/** Called when the camera (pan/zoom) changes. */
|
|
200
|
+
onCameraChange?: (camera: {
|
|
201
|
+
x: number;
|
|
202
|
+
y: number;
|
|
203
|
+
zoom: number;
|
|
204
|
+
}) => void;
|
|
205
|
+
/** Called when navigation depth changes (entering/exiting containers). */
|
|
206
|
+
onNavigationChange?: (depth: number, containerId: EntityId$1 | null) => void;
|
|
207
|
+
/** CSS class name applied to the root container div. */
|
|
208
|
+
className?: string;
|
|
209
|
+
/** Inline styles applied to the root container div. */
|
|
210
|
+
style?: React.CSSProperties;
|
|
211
|
+
/** Overlay children (toolbars, panels) rendered on top of the canvas. */
|
|
212
|
+
children?: React.ReactNode;
|
|
213
|
+
}
|
|
214
|
+
declare const InfiniteCanvas: React.ForwardRefExoticComponent<InfiniteCanvasProps & React.RefAttributes<InfiniteCanvasHandle>>;
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/react/WidgetProvider.d.ts
|
|
217
|
+
interface WidgetProviderProps {
|
|
218
|
+
engine: LayoutEngine;
|
|
219
|
+
children?: ReactNode;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Bridges the engine's widget registry to React context so WidgetSlot /
|
|
223
|
+
* WebGLWidgetLayer can resolve components by type.
|
|
224
|
+
*/
|
|
225
|
+
declare function WidgetProvider({
|
|
226
|
+
engine,
|
|
227
|
+
children
|
|
228
|
+
}: WidgetProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/react/widget-hooks.d.ts
|
|
231
|
+
/**
|
|
232
|
+
* Returns the custom data attached to a widget entity.
|
|
233
|
+
* Use the generic parameter for type safety: `useWidgetData<MyData>(entityId)`. Re-renders when data changes.
|
|
234
|
+
*/
|
|
235
|
+
declare function useWidgetData<T = Record<string, unknown>>(entityId: EntityId$1): T;
|
|
236
|
+
/**
|
|
237
|
+
* Returns the current responsive breakpoint for a widget based on its screen-space size.
|
|
238
|
+
* Re-renders when the breakpoint changes.
|
|
239
|
+
*/
|
|
240
|
+
declare function useBreakpoint(entityId: EntityId$1): Breakpoint;
|
|
241
|
+
/**
|
|
242
|
+
* Returns child entity IDs of a container entity.
|
|
243
|
+
* Re-renders when children are added or removed.
|
|
244
|
+
*/
|
|
245
|
+
declare function useChildren(entityId: EntityId$1): EntityId$1[];
|
|
246
|
+
/**
|
|
247
|
+
* Returns whether the entity is currently selected.
|
|
248
|
+
* Re-renders when the entity's selection state changes.
|
|
249
|
+
*/
|
|
250
|
+
declare function useIsSelected(entityId: EntityId$1): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Returns a function to update the widget's custom data.
|
|
253
|
+
* Merges the patch into existing data via shallow spread.
|
|
254
|
+
*/
|
|
255
|
+
declare function useUpdateWidget(entityId: EntityId$1): (patch: Record<string, unknown>) => void;
|
|
256
|
+
//#endregion
|
|
257
|
+
export { type AABB, Active, type Archetype, type ArchetypeRegistry, type Breakpoint, BreakpointConfigResource, type CSSCursor, CameraResource, Card, CardFrame, type CardFrameProps, type CardPreset, CardPresetsResource, Children, type Command, CommandBuffer, type ComponentInit, type ComponentType, Container, type CreateCardWidgetOptions, type CreateGeometryCardWidgetOptions, CursorHint, type CursorHintData, CursorResource, type CursorResourceData, DEFAULT_GRID_CONFIG, DEFAULT_SELECTION_CONFIG, type DomWidget, type DomWidgetProps, Draggable, Dragging, type EcsStats, type EntityBounds, type EntityId, type EqualSpacingIndicator, type FrameChanges, type FrameTimeStats, type GeometryCardBackground, type GeometryCardRenderProps, type GridConfig, HandleSet, type HandleSetData, Hitbox, InfiniteCanvas, type InfiniteCanvasHandle, InteractionRole, type InteractionRoleData, type InteractionRoleType, type LayoutEngine, type LayoutEngineConfig, Locked, type Modifiers, MoveCommand, type NavigationFrame, NavigationStackResource, Parent, type PointerDirective, type ProfilerStats, type R3FSample, type R3FStats, type R3FWidget, type R3FWidgetProps, type Rect, Resizable, ResizeCommand, type ResizeHandlePos, type ResolvedWidget, type ResourceType, Selectable, Selected, type SelectionBounds, type SelectionConfig, SelectionFrame, SetComponentCommand, type SnapGuide, type SnapResult, type SpawnOptions, type StandardSchemaV1, type TagType, type TickSample, Transform2D, type Unsubscribe, type Vec2, ViewportResource, Visible, type VisibleEntity, type WebGLPass, type WebGLStats, Widget, WidgetBreakpoint, WidgetData, type Widget$1 as WidgetDef, WidgetProvider, type WidgetRegistry, WidgetResolverProvider, type WidgetSurface, WorldBounds, ZIndex, ZoomConfigResource, clamp, createArchetypeRegistry, createCardWidget, createGeometryCardWidget, createLayoutEngine, createWidgetRegistry, intersectsAABB, isR3FWidget, pointInAABB, screenToWorld, useAllEntities, useBreakpoint, useCamera, useChildren, useComponent, useContainerRef, useEntityComponents, useEntityTags, useIsSelected, useLayoutEngine, useQuery, useRegisteredComponents, useRegisteredTags, useResource, useTag, useTaggedEntities, useUpdateWidget, useWidgetData, useWidgetResolver, worldBoundsToAABB, worldToScreen };
|
|
258
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/react/card.tsx","../src/react/geometry-card.tsx","../src/react/hooks.ts","../src/react/InfiniteCanvas.tsx","../src/react/WidgetProvider.tsx","../src/react/widget-hooks.ts"],"mappings":";;;;;;;;;UAuBiB,cAAA;EAChB,QAAA,EAAU,UAAA;EACV,QAAA,GAAW,OAAA,CAAM,SAAA;EACjB,SAAA;EAFU;EAIV,KAAA,GAAQ,OAAA,CAAM,aAAA;AAAA;;;;;;;;iBAUC,SAAA,CAAA;EAAY,QAAA;EAAU,QAAA;EAAU,SAAA;EAAW;AAAA,GAAS,cAAA,GAAc,oBAAA,CAAA,GAAA,CAAA,OAAA;;UA2BjE,uBAAA;EArCF;EAuCd,IAAA;EAvC2B;EAyC3B,IAAA,EAAM,UAAA;EA/BkB;EAkCxB,MAAA,EAAQ,gBAAA,MAAsB,CAAA;EAlCH;EAoC3B,WAAA,EAAa,CAAA;EApCkC;EAsC/C,MAAA,EAAQ,OAAA,CAAM,aAAA;IAAgB,QAAA,EAAU,UAAA;IAAU,IAAA,EAAM,CAAA;EAAA;AAAA;;;;;;;;;;;iBAazC,gBAAA,GAAA,CAAoB,IAAA,EAAM,uBAAA,CAAwB,CAAA;EACjE,MAAA,EAAQ,SAAA,CAAU,CAAA;EAClB,SAAA,EAAW,SAAA;AAAA;;;;KClBA,sBAAA;EDlDK,0ECuDd,KAAA;EAEA,SAAA,WDvDS;ECyDT,SAAA;AAAA;;UAIc,uBAAA;EAChB,QAAA,EAAU,UAAA;EACV,IAAA,EAAM,CAAA;ED/DK;ECiEX,KAAA;EDhEA;ECkEA,MAAA;AAAA;;UAIgB,+BAAA;EDpEW;ECsE3B,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