@allshift/ui 0.4.0 → 0.5.1

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/dist/index.d.cts CHANGED
@@ -263,6 +263,113 @@ interface PageTransitionProps {
263
263
  */
264
264
  declare function PageTransition({ children, className }: PageTransitionProps): react.JSX.Element;
265
265
 
266
+ declare const GAP = 20;
267
+ declare const DEFAULT_H = 420;
268
+ declare const MIN_W = 240;
269
+ declare const MIN_H = 200;
270
+ type BlockWidth = "sm" | "md" | "lg" | "xl";
271
+ declare const WIDTH_SPAN: Record<BlockWidth, number>;
272
+ type ResolveBlock = (key: string) => {
273
+ defaultWidth?: BlockWidth;
274
+ } | null | undefined;
275
+ interface CanvasBlock {
276
+ id: string;
277
+ key: string;
278
+ context?: unknown;
279
+ locked?: boolean;
280
+ x: number;
281
+ y: number;
282
+ w: number;
283
+ h: number;
284
+ z: number;
285
+ placed?: boolean;
286
+ width?: BlockWidth;
287
+ }
288
+ interface SavedBlock {
289
+ key: string;
290
+ width?: BlockWidth;
291
+ x?: number;
292
+ y?: number;
293
+ w?: number;
294
+ h?: number;
295
+ }
296
+ type SnapLayout = "full" | "left" | "right" | "top" | "bottom" | "tl" | "tr" | "bl" | "br";
297
+ type SnapBox = {
298
+ left: number;
299
+ top: number;
300
+ width: number;
301
+ height: number;
302
+ };
303
+ type SnapPreview = {
304
+ rect: SnapBox;
305
+ locked: SnapBox[];
306
+ others: SnapBox[];
307
+ blocked: boolean;
308
+ };
309
+ type SnapGhost = {
310
+ target: {
311
+ x: number;
312
+ y: number;
313
+ w: number;
314
+ h: number;
315
+ };
316
+ others: {
317
+ x: number;
318
+ y: number;
319
+ w: number;
320
+ h: number;
321
+ }[];
322
+ } | null;
323
+ interface CanvasApi {
324
+ blocks: CanvasBlock[];
325
+ addBlock: (key: string, context?: unknown, width?: BlockWidth, append?: boolean) => void;
326
+ removeBlock: (id: string) => void;
327
+ resizeBlock: (id: string, width: BlockWidth) => void;
328
+ snapTo: (id: string, layout: SnapLayout) => void;
329
+ snapPreview: (id: string, layout: SnapLayout) => SnapPreview;
330
+ previewSnap: (id: string, layout: SnapLayout) => void;
331
+ clearSnapPreview: () => void;
332
+ snapGhost: SnapGhost;
333
+ moveTo: (id: string, x: number, y: number) => void;
334
+ sizeTo: (id: string, w: number, h: number) => void;
335
+ setRect: (id: string, r: {
336
+ x: number;
337
+ y: number;
338
+ w: number;
339
+ h: number;
340
+ }) => void;
341
+ resizeRow: (id: string, x: number, w: number, h: number, origin: {
342
+ id: string;
343
+ x: number;
344
+ y: number;
345
+ w: number;
346
+ h: number;
347
+ }[]) => void;
348
+ bringToFront: (id: string) => void;
349
+ resolveCollisions: (id: string) => void;
350
+ toggleLock: (id: string) => void;
351
+ clear: (keepKey?: string) => void;
352
+ interacting: boolean;
353
+ setInteracting: (v: boolean) => void;
354
+ activeId: string | null;
355
+ setActiveId: (id: string | null) => void;
356
+ boardWidth: number;
357
+ }
358
+ declare function useCanvas(): CanvasApi;
359
+ declare function tallH(boardH: number): number;
360
+ declare function CanvasProvider({ children, resolveBlock, initialKeys, initialLayout, addKey, persist, savedSession, }: {
361
+ children: ReactNode;
362
+ resolveBlock: ResolveBlock;
363
+ initialKeys?: string[];
364
+ initialLayout?: SavedBlock[];
365
+ addKey?: string | null;
366
+ persist?: boolean;
367
+ savedSession?: {
368
+ blocks?: SavedBlock[];
369
+ savedDay?: string | null;
370
+ };
371
+ }): react.JSX.Element;
372
+
266
373
  type ShiftBarState = 'idle' | 'wake' | 'listening' | 'thinking' | 'speaking' | 'error';
267
374
  interface HeyShiftConfig {
268
375
  wakeWord?: string;
@@ -292,4 +399,4 @@ interface ShiftBarProps {
292
399
  }
293
400
  declare function ShiftBar({ state, dots, size, className }: ShiftBarProps): react.JSX.Element;
294
401
 
295
- export { ACCENT_RGB, type Accent, CanvasLauncher, type CanvasLauncherProps, CanvasTransition, type CanvasTransitionProps, type GenPhase, GenerativeView, type GenerativeViewProps, type HeyShiftConfig, type HeyShiftReturn, HolographicShine, type HolographicShineProps, type LauncherGroup, type LauncherItem, LiveCard, type LiveCardProps, LiveStat, type LiveStatProps, PageTransition, type PageTransitionProps, ScrollGenerateCard, type ScrollGenerateCardProps, ShiftBar, type ShiftBarProps, type ShiftBarState, ShiftCard, type ShiftCardProps, TiltCard, type TiltCardProps, type UseGenerateOptions, useGenerate, useHeyShift };
402
+ export { ACCENT_RGB, type Accent, type BlockWidth, type CanvasBlock, CanvasLauncher, type CanvasLauncherProps, CanvasProvider, CanvasTransition, type CanvasTransitionProps, DEFAULT_H, GAP, type GenPhase, GenerativeView, type GenerativeViewProps, type HeyShiftConfig, type HeyShiftReturn, HolographicShine, type HolographicShineProps, type LauncherGroup, type LauncherItem, LiveCard, type LiveCardProps, LiveStat, type LiveStatProps, MIN_H, MIN_W, PageTransition, type PageTransitionProps, type ResolveBlock, type SavedBlock, ScrollGenerateCard, type ScrollGenerateCardProps, ShiftBar, type ShiftBarProps, type ShiftBarState, ShiftCard, type ShiftCardProps, type SnapBox, type SnapGhost, type SnapLayout, type SnapPreview, TiltCard, type TiltCardProps, type UseGenerateOptions, WIDTH_SPAN, tallH, useCanvas, useGenerate, useHeyShift };
package/dist/index.d.ts CHANGED
@@ -263,6 +263,113 @@ interface PageTransitionProps {
263
263
  */
264
264
  declare function PageTransition({ children, className }: PageTransitionProps): react.JSX.Element;
265
265
 
266
+ declare const GAP = 20;
267
+ declare const DEFAULT_H = 420;
268
+ declare const MIN_W = 240;
269
+ declare const MIN_H = 200;
270
+ type BlockWidth = "sm" | "md" | "lg" | "xl";
271
+ declare const WIDTH_SPAN: Record<BlockWidth, number>;
272
+ type ResolveBlock = (key: string) => {
273
+ defaultWidth?: BlockWidth;
274
+ } | null | undefined;
275
+ interface CanvasBlock {
276
+ id: string;
277
+ key: string;
278
+ context?: unknown;
279
+ locked?: boolean;
280
+ x: number;
281
+ y: number;
282
+ w: number;
283
+ h: number;
284
+ z: number;
285
+ placed?: boolean;
286
+ width?: BlockWidth;
287
+ }
288
+ interface SavedBlock {
289
+ key: string;
290
+ width?: BlockWidth;
291
+ x?: number;
292
+ y?: number;
293
+ w?: number;
294
+ h?: number;
295
+ }
296
+ type SnapLayout = "full" | "left" | "right" | "top" | "bottom" | "tl" | "tr" | "bl" | "br";
297
+ type SnapBox = {
298
+ left: number;
299
+ top: number;
300
+ width: number;
301
+ height: number;
302
+ };
303
+ type SnapPreview = {
304
+ rect: SnapBox;
305
+ locked: SnapBox[];
306
+ others: SnapBox[];
307
+ blocked: boolean;
308
+ };
309
+ type SnapGhost = {
310
+ target: {
311
+ x: number;
312
+ y: number;
313
+ w: number;
314
+ h: number;
315
+ };
316
+ others: {
317
+ x: number;
318
+ y: number;
319
+ w: number;
320
+ h: number;
321
+ }[];
322
+ } | null;
323
+ interface CanvasApi {
324
+ blocks: CanvasBlock[];
325
+ addBlock: (key: string, context?: unknown, width?: BlockWidth, append?: boolean) => void;
326
+ removeBlock: (id: string) => void;
327
+ resizeBlock: (id: string, width: BlockWidth) => void;
328
+ snapTo: (id: string, layout: SnapLayout) => void;
329
+ snapPreview: (id: string, layout: SnapLayout) => SnapPreview;
330
+ previewSnap: (id: string, layout: SnapLayout) => void;
331
+ clearSnapPreview: () => void;
332
+ snapGhost: SnapGhost;
333
+ moveTo: (id: string, x: number, y: number) => void;
334
+ sizeTo: (id: string, w: number, h: number) => void;
335
+ setRect: (id: string, r: {
336
+ x: number;
337
+ y: number;
338
+ w: number;
339
+ h: number;
340
+ }) => void;
341
+ resizeRow: (id: string, x: number, w: number, h: number, origin: {
342
+ id: string;
343
+ x: number;
344
+ y: number;
345
+ w: number;
346
+ h: number;
347
+ }[]) => void;
348
+ bringToFront: (id: string) => void;
349
+ resolveCollisions: (id: string) => void;
350
+ toggleLock: (id: string) => void;
351
+ clear: (keepKey?: string) => void;
352
+ interacting: boolean;
353
+ setInteracting: (v: boolean) => void;
354
+ activeId: string | null;
355
+ setActiveId: (id: string | null) => void;
356
+ boardWidth: number;
357
+ }
358
+ declare function useCanvas(): CanvasApi;
359
+ declare function tallH(boardH: number): number;
360
+ declare function CanvasProvider({ children, resolveBlock, initialKeys, initialLayout, addKey, persist, savedSession, }: {
361
+ children: ReactNode;
362
+ resolveBlock: ResolveBlock;
363
+ initialKeys?: string[];
364
+ initialLayout?: SavedBlock[];
365
+ addKey?: string | null;
366
+ persist?: boolean;
367
+ savedSession?: {
368
+ blocks?: SavedBlock[];
369
+ savedDay?: string | null;
370
+ };
371
+ }): react.JSX.Element;
372
+
266
373
  type ShiftBarState = 'idle' | 'wake' | 'listening' | 'thinking' | 'speaking' | 'error';
267
374
  interface HeyShiftConfig {
268
375
  wakeWord?: string;
@@ -292,4 +399,4 @@ interface ShiftBarProps {
292
399
  }
293
400
  declare function ShiftBar({ state, dots, size, className }: ShiftBarProps): react.JSX.Element;
294
401
 
295
- export { ACCENT_RGB, type Accent, CanvasLauncher, type CanvasLauncherProps, CanvasTransition, type CanvasTransitionProps, type GenPhase, GenerativeView, type GenerativeViewProps, type HeyShiftConfig, type HeyShiftReturn, HolographicShine, type HolographicShineProps, type LauncherGroup, type LauncherItem, LiveCard, type LiveCardProps, LiveStat, type LiveStatProps, PageTransition, type PageTransitionProps, ScrollGenerateCard, type ScrollGenerateCardProps, ShiftBar, type ShiftBarProps, type ShiftBarState, ShiftCard, type ShiftCardProps, TiltCard, type TiltCardProps, type UseGenerateOptions, useGenerate, useHeyShift };
402
+ export { ACCENT_RGB, type Accent, type BlockWidth, type CanvasBlock, CanvasLauncher, type CanvasLauncherProps, CanvasProvider, CanvasTransition, type CanvasTransitionProps, DEFAULT_H, GAP, type GenPhase, GenerativeView, type GenerativeViewProps, type HeyShiftConfig, type HeyShiftReturn, HolographicShine, type HolographicShineProps, type LauncherGroup, type LauncherItem, LiveCard, type LiveCardProps, LiveStat, type LiveStatProps, MIN_H, MIN_W, PageTransition, type PageTransitionProps, type ResolveBlock, type SavedBlock, ScrollGenerateCard, type ScrollGenerateCardProps, ShiftBar, type ShiftBarProps, type ShiftBarState, ShiftCard, type ShiftCardProps, type SnapBox, type SnapGhost, type SnapLayout, type SnapPreview, TiltCard, type TiltCardProps, type UseGenerateOptions, WIDTH_SPAN, tallH, useCanvas, useGenerate, useHeyShift };