@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.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { EntityId, ComponentType, TagType, ResourceType } from '@jamesyong42/reactive-ecs';
|
|
2
|
-
export { ComponentInit, ComponentType, EntityId, ResourceType, TagType, Unsubscribe } from '@jamesyong42/reactive-ecs';
|
|
3
|
-
import { L as LayoutEngine, f as GridConfig, g as SelectionConfig, B as Breakpoint } from './SelectionRenderer-CeWSNZT8.js';
|
|
4
|
-
export { A as AABB, h as Active, i as Archetype, j as ArchetypeRegistry, k as BreakpointConfigResource, l as CSSCursor, m as CameraResource, n as Children, o as Command, p as CommandBuffer, q as Container, r as CursorHint, s as CursorHintData, t as CursorResource, u as CursorResourceData, D as DEFAULT_GRID_CONFIG, v as DEFAULT_SELECTION_CONFIG, w as DomWidget, x as DomWidgetProps, y as Draggable, z as EntityBounds, H as EqualSpacingIndicator, I as FrameChanges, F as FrameSample, J as HandleSet, K as HandleSetData, M as Hitbox, O as InteractionRole, Q as InteractionRoleData, T as InteractionRoleType, U as LayoutEngineConfig, V as Locked, W as Modifiers, X as MoveCommand, N as NavigationFrame, Y as NavigationStackResource, Z as Parent, _ as PointerDirective, b as ProfilerStats, $ as R3FWidget, a as R3FWidgetProps, a0 as Rect, a1 as Resizable, a2 as ResizeCommand, a3 as ResizeHandlePos, R as ResolvedWidget, a4 as Selectable, a5 as Selected, a6 as SelectionBounds, a7 as SetComponentCommand, a8 as SnapGuide, a9 as SnapResult, aa as SpawnOptions, ab as StandardSchemaV1, ac as Transform2D, ad as Vec2, ae as ViewportResource, af as Visible, ag as VisibleEntity, ah as Widget, ai as WidgetBreakpoint, aj as WidgetData, ak as WidgetDef, al as WidgetRegistry, am as WidgetResolverProvider, an as WidgetSurface, ao as WorldBounds, ap as ZIndex, aq as ZoomConfigResource, ar as clamp, as as createArchetypeRegistry, at as createLayoutEngine, au as createWidgetRegistry, av as intersectsAABB, aw as isR3FWidget, ax as pointInAABB, ay as screenToWorld, az as useContainerRef, aA as useLayoutEngine, aB as useWidgetResolver, aC as worldBoundsToAABB, aD as worldToScreen } from './SelectionRenderer-CeWSNZT8.js';
|
|
5
|
-
import react__default, { ReactNode } from 'react';
|
|
6
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
-
import 'three';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Reactively reads an ECS component from an entity.
|
|
11
|
-
* Returns undefined if the entity doesn't have the component. Re-renders when the component changes.
|
|
12
|
-
*/
|
|
13
|
-
declare function useComponent<T>(entity: EntityId, type: ComponentType<T>): T | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Reactively checks whether an entity has a tag.
|
|
16
|
-
* Re-renders when the tag is added or removed.
|
|
17
|
-
*/
|
|
18
|
-
declare function useTag(entity: EntityId, type: TagType): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Reactively reads an ECS resource (singleton data).
|
|
21
|
-
* Re-renders when any field of the resource changes (shallow comparison).
|
|
22
|
-
*/
|
|
23
|
-
declare function useResource<T>(type: ResourceType<T>): T;
|
|
24
|
-
/**
|
|
25
|
-
* Returns entity IDs matching all specified component/tag types.
|
|
26
|
-
* Re-renders when the result set changes.
|
|
27
|
-
*/
|
|
28
|
-
declare function useQuery(...types: (ComponentType | TagType)[]): EntityId[];
|
|
29
|
-
/**
|
|
30
|
-
* Returns all entity IDs that have the specified tag.
|
|
31
|
-
* Re-renders when entities are tagged or untagged.
|
|
32
|
-
*/
|
|
33
|
-
declare function useTaggedEntities(type: TagType): EntityId[];
|
|
34
|
-
/**
|
|
35
|
-
* Returns the current camera state {x, y, zoom}.
|
|
36
|
-
* Shorthand for useResource(CameraResource).
|
|
37
|
-
*/
|
|
38
|
-
declare function useCamera(): {
|
|
39
|
-
x: number;
|
|
40
|
-
y: number;
|
|
41
|
-
zoom: number;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** Imperative handle exposed via `ref` on InfiniteCanvas for programmatic control. */
|
|
45
|
-
interface InfiniteCanvasHandle {
|
|
46
|
-
/** Moves the camera to the specified world coordinates. */
|
|
47
|
-
panTo(worldX: number, worldY: number): void;
|
|
48
|
-
/** Sets the zoom level directly. */
|
|
49
|
-
zoomTo(zoom: number): void;
|
|
50
|
-
/** Adjusts camera to fit all entities in the viewport. */
|
|
51
|
-
zoomToFit(padding?: number): void;
|
|
52
|
-
/** Undoes the last command or command group. */
|
|
53
|
-
undo(): void;
|
|
54
|
-
/** Redoes the last undone command. */
|
|
55
|
-
redo(): void;
|
|
56
|
-
/** Returns the underlying LayoutEngine instance. */
|
|
57
|
-
getEngine(): LayoutEngine;
|
|
58
|
-
}
|
|
59
|
-
/** Props for the InfiniteCanvas component. */
|
|
60
|
-
interface InfiniteCanvasProps {
|
|
61
|
-
/**
|
|
62
|
-
* The LayoutEngine instance powering this canvas. Create with `createLayoutEngine()`.
|
|
63
|
-
* Widgets and archetypes must be registered on the engine — via config or
|
|
64
|
-
* `engine.registerWidget` / `engine.registerArchetype`.
|
|
65
|
-
*/
|
|
66
|
-
engine: LayoutEngine;
|
|
67
|
-
/** Grid configuration. Pass `false` to disable the grid entirely. */
|
|
68
|
-
grid?: Partial<GridConfig> | false;
|
|
69
|
-
/** Selection highlight style configuration. */
|
|
70
|
-
selection?: Partial<SelectionConfig>;
|
|
71
|
-
/** Called when the set of selected entities changes. */
|
|
72
|
-
onSelectionChange?: (entityIds: EntityId[]) => void;
|
|
73
|
-
/** Called when the camera (pan/zoom) changes. */
|
|
74
|
-
onCameraChange?: (camera: {
|
|
75
|
-
x: number;
|
|
76
|
-
y: number;
|
|
77
|
-
zoom: number;
|
|
78
|
-
}) => void;
|
|
79
|
-
/** Called when navigation depth changes (entering/exiting containers). */
|
|
80
|
-
onNavigationChange?: (depth: number, containerId: EntityId | null) => void;
|
|
81
|
-
/** CSS class name applied to the root container div. */
|
|
82
|
-
className?: string;
|
|
83
|
-
/** Inline styles applied to the root container div. */
|
|
84
|
-
style?: react__default.CSSProperties;
|
|
85
|
-
/** Overlay children (toolbars, panels) rendered on top of the canvas. */
|
|
86
|
-
children?: react__default.ReactNode;
|
|
87
|
-
}
|
|
88
|
-
declare const InfiniteCanvas: react__default.ForwardRefExoticComponent<InfiniteCanvasProps & react__default.RefAttributes<InfiniteCanvasHandle>>;
|
|
89
|
-
|
|
90
|
-
interface WidgetProviderProps {
|
|
91
|
-
engine: LayoutEngine;
|
|
92
|
-
children?: ReactNode;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Bridges the engine's widget registry to React context so WidgetSlot /
|
|
96
|
-
* WebGLWidgetLayer can resolve components by type.
|
|
97
|
-
*/
|
|
98
|
-
declare function WidgetProvider({ engine, children }: WidgetProviderProps): react_jsx_runtime.JSX.Element;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Returns the custom data attached to a widget entity.
|
|
102
|
-
* Use the generic parameter for type safety: `useWidgetData<MyData>(entityId)`. Re-renders when data changes.
|
|
103
|
-
*/
|
|
104
|
-
declare function useWidgetData<T = Record<string, unknown>>(entityId: EntityId): T;
|
|
105
|
-
/**
|
|
106
|
-
* Returns the current responsive breakpoint for a widget based on its screen-space size.
|
|
107
|
-
* Re-renders when the breakpoint changes.
|
|
108
|
-
*/
|
|
109
|
-
declare function useBreakpoint(entityId: EntityId): Breakpoint;
|
|
110
|
-
/**
|
|
111
|
-
* Returns child entity IDs of a container entity.
|
|
112
|
-
* Re-renders when children are added or removed.
|
|
113
|
-
*/
|
|
114
|
-
declare function useChildren(entityId: EntityId): EntityId[];
|
|
115
|
-
/**
|
|
116
|
-
* Returns whether the entity is currently selected.
|
|
117
|
-
* Re-renders when the entity's selection state changes.
|
|
118
|
-
*/
|
|
119
|
-
declare function useIsSelected(entityId: EntityId): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Returns a function to update the widget's custom data.
|
|
122
|
-
* Merges the patch into existing data via shallow spread.
|
|
123
|
-
*/
|
|
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 };
|