@asymmetric-effort/specifyjs 0.2.142 → 0.2.145

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.
@@ -0,0 +1,60 @@
1
+ import type { SpecNode } from 'specifyjs';
2
+ export interface DragPayload<T = unknown> {
3
+ /** MIME-like type identifier (e.g., "application/project-card", "text/plain") */
4
+ type: string;
5
+ /** The dragged data */
6
+ data: T;
7
+ /** Source app ID */
8
+ sourceAppId: string;
9
+ /** Optional visual preview element */
10
+ preview?: unknown;
11
+ }
12
+ export interface DropZone {
13
+ /** Types this zone accepts */
14
+ acceptTypes: string[];
15
+ /** Called when a compatible drag enters the zone */
16
+ onDragEnter?: (payload: DragPayload) => void;
17
+ /** Called when drag leaves the zone */
18
+ onDragLeave?: () => void;
19
+ /** Called when a compatible payload is dropped */
20
+ onDrop: (payload: DragPayload) => void;
21
+ }
22
+ export interface DragDropContextValue {
23
+ /** Start dragging a payload */
24
+ startDrag(payload: DragPayload): void;
25
+ /** Cancel the current drag operation */
26
+ cancelDrag(): void;
27
+ /** Register a drop zone. Returns cleanup function. */
28
+ registerDropZone(zoneId: string, zone: DropZone): () => void;
29
+ /** Current drag state (null if no drag in progress) */
30
+ currentDrag: DragPayload | null;
31
+ /** Whether a drag is in progress */
32
+ isDragging: boolean;
33
+ }
34
+ export interface DragDropProviderProps {
35
+ children?: unknown;
36
+ }
37
+ export declare function DragDropProvider(props: DragDropProviderProps): SpecNode;
38
+ /**
39
+ * Access the drag-drop context.
40
+ */
41
+ export declare function useDragDrop(): DragDropContextValue;
42
+ /**
43
+ * Make an element draggable with a typed payload.
44
+ * Returns event handlers and state to attach to the draggable element.
45
+ */
46
+ export declare function useDraggable<T>(type: string, data: T): {
47
+ onMouseDown: (e: Event) => void;
48
+ isDragging: boolean;
49
+ };
50
+ /**
51
+ * Make an element a drop zone that accepts specific drag types.
52
+ * Returns state about the current drag interaction.
53
+ */
54
+ export declare function useDropZone(config: DropZone & {
55
+ zoneId?: string;
56
+ }): {
57
+ isOver: boolean;
58
+ canDrop: boolean;
59
+ zoneId: string;
60
+ };
@@ -0,0 +1,2 @@
1
+ export { DragDropProvider, useDragDrop, useDraggable, useDropZone, } from './DragDrop';
2
+ export type { DragPayload, DropZone, DragDropContextValue, DragDropProviderProps, } from './DragDrop';
@@ -0,0 +1,43 @@
1
+ import type { SpecNode } from 'specifyjs';
2
+ export interface AppMessage<T = unknown> {
3
+ /** Channel name (e.g., "clipboard", "data-update", "file-open") */
4
+ channel: string;
5
+ /** Sender app ID */
6
+ from: string;
7
+ /** Optional target app ID (null = broadcast) */
8
+ to?: string | null;
9
+ /** Message payload */
10
+ payload: T;
11
+ /** Timestamp */
12
+ timestamp: number;
13
+ }
14
+ export interface MessageBusContextValue {
15
+ /** Publish a message to a channel */
16
+ publish<T>(channel: string, payload: T, to?: string): void;
17
+ /** Subscribe to a channel. Returns unsubscribe function. */
18
+ subscribe<T>(channel: string, handler: (message: AppMessage<T>) => void): () => void;
19
+ /** Subscribe to all messages (for debugging/logging) */
20
+ subscribeAll(handler: (message: AppMessage) => void): () => void;
21
+ }
22
+ export interface MessageBusProviderProps {
23
+ children?: unknown;
24
+ }
25
+ export interface AppContextValue {
26
+ appId: string;
27
+ }
28
+ export interface AppContextProviderProps {
29
+ appId: string;
30
+ children?: unknown;
31
+ }
32
+ export declare function AppContextProvider(props: AppContextProviderProps): SpecNode;
33
+ export declare function useAppId(): string;
34
+ export declare function MessageBusProvider(props: MessageBusProviderProps): SpecNode;
35
+ /**
36
+ * Access the message bus context. Wraps publish and subscribe to
37
+ * automatically inject the current app's ID.
38
+ */
39
+ export declare function useMessageBus(): MessageBusContextValue;
40
+ /**
41
+ * Convenience hook for subscribing to a channel with auto-cleanup.
42
+ */
43
+ export declare function useChannel<T>(channel: string, handler: (message: AppMessage<T>) => void): void;
@@ -0,0 +1,2 @@
1
+ export { MessageBusProvider, useMessageBus, useChannel, AppContextProvider, useAppId, } from './MessageBus';
2
+ export type { AppMessage, MessageBusContextValue, MessageBusProviderProps, AppContextValue, AppContextProviderProps, } from './MessageBus';
@@ -2,3 +2,7 @@ export { UnityDesktop } from './UnityDesktop';
2
2
  export type { UnityDesktopProps, UnityDesktopApp, UnityDesktopUser, ToastNotification } from './UnityDesktop';
3
3
  export { UnityApp } from './UnityApp';
4
4
  export type { UnityAppProps } from './UnityApp';
5
+ export { MessageBusProvider, useMessageBus, useChannel, AppContextProvider, useAppId, } from '../../../layout/app-message-bus/src/index';
6
+ export type { AppMessage, MessageBusContextValue, AppContextValue, } from '../../../layout/app-message-bus/src/index';
7
+ export { DragDropProvider, useDragDrop, useDraggable, useDropZone, } from '../../../layout/app-drag-drop/src/index';
8
+ export type { DragPayload, DropZone, DragDropContextValue, } from '../../../layout/app-drag-drop/src/index';
@@ -0,0 +1,33 @@
1
+ import type { ProjectCard } from './types';
2
+ import type { BoardState } from './types';
3
+ import type { BoardAction } from './BoardState';
4
+ export interface BoardProps {
5
+ state: BoardState;
6
+ dispatch: (action: BoardAction) => void;
7
+ searchQuery: string;
8
+ gridEnabled: boolean;
9
+ selectedCardId: string | null;
10
+ onSelectCard: (cardId: string | null) => void;
11
+ colorFilter?: string | null;
12
+ }
13
+ export declare function snapToGrid(pos: {
14
+ x: number;
15
+ y: number;
16
+ }, gridSize: number): {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ export declare function screenToCanvas(screenX: number, screenY: number, viewport: {
21
+ panX: number;
22
+ panY: number;
23
+ zoom: number;
24
+ }): {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ export declare function computeFitAll(cards: ProjectCard[], containerWidth: number, containerHeight: number, padding?: number): {
29
+ panX: number;
30
+ panY: number;
31
+ zoom: number;
32
+ };
33
+ export declare function Board(props: BoardProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -0,0 +1,76 @@
1
+ import type { BoardState, BoardStorage, ProjectCard, CardConnection } from './types';
2
+ export type BoardAction = {
3
+ type: 'ADD_CARD';
4
+ card: ProjectCard;
5
+ } | {
6
+ type: 'REMOVE_CARD';
7
+ cardId: string;
8
+ } | {
9
+ type: 'MOVE_CARD';
10
+ cardId: string;
11
+ position: {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ } | {
16
+ type: 'RESIZE_CARD';
17
+ cardId: string;
18
+ size: {
19
+ width: number;
20
+ height: number;
21
+ };
22
+ } | {
23
+ type: 'UPDATE_CARD';
24
+ cardId: string;
25
+ updates: Partial<ProjectCard>;
26
+ } | {
27
+ type: 'DUPLICATE_CARD';
28
+ cardId: string;
29
+ newId: string;
30
+ offset?: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ } | {
35
+ type: 'ADD_CONNECTION';
36
+ connection: CardConnection;
37
+ } | {
38
+ type: 'REMOVE_CONNECTION';
39
+ connectionId: string;
40
+ } | {
41
+ type: 'PAN';
42
+ panX: number;
43
+ panY: number;
44
+ } | {
45
+ type: 'ZOOM';
46
+ zoom: number;
47
+ } | {
48
+ type: 'SET_BOARD';
49
+ state: BoardState;
50
+ };
51
+ export interface HistoryState {
52
+ past: BoardState[];
53
+ present: BoardState;
54
+ future: BoardState[];
55
+ }
56
+ export declare const DEFAULT_BOARD_STATE: BoardState;
57
+ export declare function boardReducer(state: BoardState, action: BoardAction): BoardState;
58
+ type HistoryAction = {
59
+ type: 'UNDO';
60
+ } | {
61
+ type: 'REDO';
62
+ } | {
63
+ type: 'BOARD_ACTION';
64
+ action: BoardAction;
65
+ };
66
+ export declare function historyReducer(state: HistoryState, action: HistoryAction): HistoryState;
67
+ export interface UseBoardStateResult {
68
+ state: BoardState;
69
+ dispatch: (action: BoardAction) => void;
70
+ undo: () => void;
71
+ redo: () => void;
72
+ canUndo: boolean;
73
+ canRedo: boolean;
74
+ }
75
+ export declare function useBoardState(storage?: BoardStorage, boardId?: string): UseBoardStateResult;
76
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { ProjectCard } from './types';
2
+ export interface CardProps {
3
+ card: ProjectCard;
4
+ selected: boolean;
5
+ onSelect: (cardId: string) => void;
6
+ onMove: (cardId: string, position: {
7
+ x: number;
8
+ y: number;
9
+ }) => void;
10
+ onResize: (cardId: string, size: {
11
+ width: number;
12
+ height: number;
13
+ }) => void;
14
+ onDelete: (cardId: string) => void;
15
+ onDoubleClick: (cardId: string) => void;
16
+ onDragStart?: (cardId: string, e: Event) => void;
17
+ onDuplicate?: (cardId: string) => void;
18
+ onChangeColor?: (cardId: string, color: string) => void;
19
+ onChangePriority?: (cardId: string, priority: 'low' | 'medium' | 'high' | 'critical') => void;
20
+ onAnchorDragStart?: (cardId: string, anchor: string, x: number, y: number) => void;
21
+ }
22
+ export declare function Card(props: CardProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -0,0 +1,10 @@
1
+ import type { ProjectCard } from './types';
2
+ export interface CardEditorProps {
3
+ card: ProjectCard;
4
+ onSave: (cardId: string, updates: {
5
+ title: string;
6
+ description: string;
7
+ }) => void;
8
+ onClose: () => void;
9
+ }
10
+ export declare function CardEditor(props: CardEditorProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -0,0 +1,11 @@
1
+ import type { ProjectCard, CardConnection } from './types';
2
+ export interface ConnectionsOverlayProps {
3
+ connections: CardConnection[];
4
+ cards: ProjectCard[];
5
+ selectedConnectionId: string | null;
6
+ onSelectConnection: (connectionId: string | null) => void;
7
+ onDeleteConnection: (connectionId: string) => void;
8
+ canvasWidth: number;
9
+ canvasHeight: number;
10
+ }
11
+ export declare function ConnectionsOverlay(props: ConnectionsOverlayProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -0,0 +1,7 @@
1
+ import type { ProjectCard } from './types';
2
+ export interface InterAppWrapperProps {
3
+ cards: ProjectCard[];
4
+ onCardDropped: (title: string, description: string) => void;
5
+ children: unknown;
6
+ }
7
+ export declare function InterAppWrapper(props: InterAppWrapperProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * LocalStorage.ts -- localStorage persistence implementation for BoardStorage.
3
+ */
4
+ import type { BoardState, BoardStorage } from './types';
5
+ export declare class LocalBoardStorage implements BoardStorage {
6
+ load(boardId: string): Promise<BoardState>;
7
+ save(boardId: string, state: BoardState): Promise<void>;
8
+ }
@@ -0,0 +1,16 @@
1
+ export declare const CARD_COLORS: string[];
2
+ export interface ToolbarProps {
3
+ zoom: number;
4
+ gridEnabled: boolean;
5
+ selectedColor: string;
6
+ colorFilter?: string | null;
7
+ onNewCard: () => void;
8
+ onZoomIn: () => void;
9
+ onZoomOut: () => void;
10
+ onZoomReset: () => void;
11
+ onColorSelect: (color: string) => void;
12
+ onColorFilter?: (color: string | null) => void;
13
+ onGridToggle: () => void;
14
+ onSearch: (query: string) => void;
15
+ }
16
+ export declare function BoardToolbar(props: ToolbarProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -0,0 +1,14 @@
1
+ export type { ProjectCard, CardConnection, BoardState, BoardStorage } from './types';
2
+ export { useBoardState, boardReducer, historyReducer, DEFAULT_BOARD_STATE } from './BoardState';
3
+ export type { BoardAction, HistoryState, UseBoardStateResult } from './BoardState';
4
+ export { LocalBoardStorage } from './LocalStorage';
5
+ export { Card } from './Card';
6
+ export { CardEditor } from './CardEditor';
7
+ export { ConnectionsOverlay } from './Connection';
8
+ export { BoardToolbar, CARD_COLORS } from './Toolbar';
9
+ export { Board, snapToGrid, screenToCanvas, computeFitAll } from './Board';
10
+ export { InterAppWrapper } from './InterApp';
11
+ export interface ProjectManagerAppProps {
12
+ boardId?: string;
13
+ }
14
+ export declare function ProjectManagerApp(props: ProjectManagerAppProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * types.ts -- Interfaces for the Whiteboard Project Manager.
3
+ */
4
+ export interface ProjectCard {
5
+ id: string;
6
+ title: string;
7
+ description: string;
8
+ color: string;
9
+ position: {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ size: {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ tags?: string[];
18
+ priority?: 'low' | 'medium' | 'high' | 'critical';
19
+ assignee?: string;
20
+ createdAt: number;
21
+ updatedAt: number;
22
+ }
23
+ export interface CardConnection {
24
+ id: string;
25
+ fromCardId: string;
26
+ toCardId: string;
27
+ label?: string;
28
+ style?: 'solid' | 'dashed' | 'dotted';
29
+ }
30
+ export interface BoardState {
31
+ cards: ProjectCard[];
32
+ connections: CardConnection[];
33
+ viewport: {
34
+ panX: number;
35
+ panY: number;
36
+ zoom: number;
37
+ };
38
+ }
39
+ export interface BoardStorage {
40
+ load(boardId: string): Promise<BoardState>;
41
+ save(boardId: string, state: BoardState): Promise<void>;
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asymmetric-effort/specifyjs",
3
- "version": "0.2.142",
3
+ "version": "0.2.145",
4
4
  "description": "A declarative TypeScript UI framework built for performance and simplicity",
5
5
  "publishConfig": {
6
6
  "access": "public"