index.ts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * A docking layout kit: a split tree of tabbed panes with invertible operations,
  3. * and the React components that render and drive it.
  4. *
  5. * Two layers, and the boundary between them is the point of the package. The
  6. * engine (`applyOp`, `Sequencer`, `DockController`) is pure TypeScript with no
  7. * React, no DOM, and no host concepts; replaying a recorded sequence over the
  8. * same initial state reproduces the same tree, because every operation carries
  9. * the ids it creates. The components render a layout snapshot and report settled
  10. * intents — one per gesture, never a drag frame — so the embedder's sequence
  11. * stays the single source of truth.
  12. *
  13. * Nothing host-specific lives here: rendered strings arrive as `DockLabels`, tab
  14. * bodies as a `TabRenderer`, and a tab's `kind` is an opaque string this kit
  15. * never interprets.
  16. *
  17. * @module
  18. */
  19. // Model and operations.
  20. export type {
  21. ApplyResult, DockMode, DockZone, FloatRect, LayoutNode, LayoutOp, LayoutState, NodeId,
  22. PaneAttachment, PaneHost, PaneId, PaneNode, SplitAxis, SplitDirection, SplitId,
  23. SplitNode, TabId, TabRecord,
  24. } from './contract/types.ts'
  25. export { applyOp, replay } from './engine/operations.ts'
  26. export {
  27. canStepBack, canStepForward, EMPTY_HISTORY, isFocusOp, record, recordedOps,
  28. Sequencer, stepBack, stepForward,
  29. } from './engine/sequence.ts'
  30. export type { History, HistoryEntry, HistoryStep } from './engine/sequence.ts'
  31. export {
  32. dockPaneIds, findParent, findTabPane, getNode, getPane, getSplit, getTab, topRightPaneId,
  33. } from './engine/tree.ts'
  34. // Interaction limits and geometry.
  35. export {
  36. canSplit, clampSizes, DOCK_EDGE_FRACTION, DOCK_ZONES, dockPaneCount,
  37. FLOAT_DEFAULT_SIZE, FLOAT_MIN_SIZE, MAX_DOCK_PANES, MIN_PANE_FRACTION, zoneAt, zoneSplit,
  38. } from './engine/constraints.ts'
  39. export {
  40. containsPoint, dividerSizes, DRAG_THRESHOLD, floatRectAt, halvesFit, insertionIndex,
  41. movedRect, passedThreshold, resizedRect, SPLIT_MINIMUMS, zoneInRect,
  42. } from './engine/geometry.ts'
  43. export type { DropTarget, HalvesFit, PaneMeasure, Rect, Size, SplitMinimums } from './engine/geometry.ts'
  44. // Intent planning: the shared decisions, as pure functions.
  45. export {
  46. activeDockPaneId, findContentTab, findPaneContentTab, planAddTab, planDropTab, planDuplicateTab, planFloatTab,
  47. planOpenContent, planPlaceTab, planResizeSplit, planSetExpanded, planSetMode,
  48. planSettle, planSplitPane, planUnfloatPane,
  49. } from './engine/planner.ts'
  50. export type { Mint, OpenContentInput, PlannedTab } from './engine/planner.ts'
  51. // The intent layer's stateful embedding, and its seeds.
  52. export { DockController } from './engine/controller.ts'
  53. export type { DockControllerOptions, DockSnapshot } from './engine/controller.ts'
  54. export { createIdMinter, createInitialState } from './engine/initial.ts'
  55. export type { IdMinter, TabFactory } from './engine/initial.ts'
  56. // Outward contracts.
  57. export type { DockIntents, DockLabels, TabMenuExtras, TabRenderer } from './contract/adapter.ts'
  58. // React surface.
  59. export { DockSurface } from './components/DockSurface.tsx'
  60. export type { DockSurfaceProps } from './components/DockSurface.tsx'
  61. export { FloatLayer } from './components/FloatLayer.tsx'
  62. export type { FloatLayerProps } from './components/FloatLayer.tsx'