@taskctrl/canvas-timeline 0.5.0 → 0.7.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.
@@ -5,3 +5,10 @@ import type { LayoutEngine } from './LayoutEngine';
5
5
  export declare function hitTest(canvasX: number, canvasY: number, view: ViewState, tree: IntervalTree<Item>, layout: LayoutEngine, groups: Group[]): Item | null;
6
6
  export declare function hitTestGroup(canvasY: number, view: ViewState, groups: Group[]): Group | null;
7
7
  export declare function detectEdge(canvasX: number, item: Item, view: ViewState, threshold?: number): 'left' | 'right' | 'body';
8
+ /**
9
+ * Resolve the effective `canResize` for an item: a per-item `item.canResize`
10
+ * wins when present, otherwise the timeline-wide `globalCanResize` applies.
11
+ * Uses `??` (not `||`) so an explicit per-item `false` disables resize rather
12
+ * than falling through to the global value.
13
+ */
14
+ export declare function resolveCanResize(item: Item, globalCanResize: false | 'left' | 'right' | 'both'): false | 'left' | 'right' | 'both';
@@ -13,8 +13,9 @@ export interface DateHeaderProps {
13
13
  /** Minimum cell width in pixels. Header auto-hides when cells are narrower. Set to 0 to disable. */
14
14
  minCellWidth?: number;
15
15
  onZoomToInterval?: (start: number, end: number) => void;
16
+ timezone?: string;
16
17
  }
17
- export declare function DateHeader({ unit, visibleTimeStart, visibleTimeEnd, canvasWidth, theme, height, className, labelFormat, onIntervalClick, minCellWidth, onZoomToInterval, }: DateHeaderProps): import("react/jsx-runtime").JSX.Element | null;
18
+ export declare function DateHeader({ unit, visibleTimeStart, visibleTimeEnd, canvasWidth, theme, height, className, labelFormat, onIntervalClick, minCellWidth, onZoomToInterval, timezone, }: DateHeaderProps): import("react/jsx-runtime").JSX.Element | null;
18
19
  export declare namespace DateHeader {
19
20
  var displayName: string;
20
21
  }
@@ -11,8 +11,9 @@ export interface TimelineHeadersProps {
11
11
  canvasWidth?: number;
12
12
  sidebarWidth?: number;
13
13
  onZoomToInterval?: (start: number, end: number) => void;
14
+ timezone?: string;
14
15
  }
15
- export declare function TimelineHeaders({ children, theme, className, classNames: _classNames, style, visibleTimeStart, visibleTimeEnd, canvasWidth, sidebarWidth, onZoomToInterval }: TimelineHeadersProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function TimelineHeaders({ children, theme, className, classNames: _classNames, style, visibleTimeStart, visibleTimeEnd, canvasWidth, sidebarWidth, onZoomToInterval, timezone }: TimelineHeadersProps): import("react/jsx-runtime").JSX.Element;
16
17
  export declare namespace TimelineHeaders {
17
18
  var displayName: string;
18
19
  }
package/dist/types.d.ts CHANGED
@@ -14,6 +14,9 @@ export interface Item {
14
14
  end_time: number;
15
15
  parentId?: number;
16
16
  type?: string;
17
+ /** Per-item override of the timeline-wide `canResize` prop. When set, this
18
+ * wins for this item; when omitted, the global `canResize` applies. */
19
+ canResize?: false | 'left' | 'right' | 'both';
17
20
  [key: string]: unknown;
18
21
  }
19
22
  export interface ItemBounds {
@@ -151,6 +154,14 @@ export interface CanvasTimelineProps {
151
154
  onReady?: (api: CanvasTimelineRef) => void;
152
155
  /** Dev-only: show a version + build-time badge in the top-left corner.
153
156
  * Wire to your app's dev flag, e.g. `devBadge={import.meta.env.DEV}`. */
157
+ /** Maximum visible height for the timeline body. Accepts a number (px) or
158
+ * a CSS string like `'calc(100vh - 98px)'`. When set, the canvas and sidebar
159
+ * are clipped and internally scrollable via wheel, drag, or touch. */
160
+ maxHeight?: number | string;
161
+ /** IANA timezone string (e.g. "America/New_York", "UTC").
162
+ * When set, grid lines, headers, and day styling render in this timezone.
163
+ * Defaults to the browser's local timezone. */
164
+ timezone?: string;
154
165
  devBadge?: boolean;
155
166
  children?: React.ReactNode;
156
167
  }
@@ -0,0 +1,2 @@
1
+ import dayjs from 'dayjs';
2
+ export declare function toDayjs(ts: number, timezone?: string): dayjs.Dayjs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskctrl/canvas-timeline",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "High-performance canvas-based timeline component for React",
5
5
  "scripts": {
6
6
  "build": "rimraf ./dist && tsc && vite build",