@dxos/react-ui-canvas 0.8.4-main.ead640a → 0.8.4-main.f466a3d56e
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +1131 -388
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1131 -388
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Canvas/Canvas.d.ts +2 -2
- package/dist/types/src/components/Canvas/Canvas.stories.d.ts.map +1 -1
- package/dist/types/src/components/CellGrid/CellGrid.d.ts +21 -0
- package/dist/types/src/components/CellGrid/CellGrid.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/CellGrid.stories.d.ts +21 -0
- package/dist/types/src/components/CellGrid/CellGrid.stories.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/headers/Ruler.d.ts +15 -0
- package/dist/types/src/components/CellGrid/headers/Ruler.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/headers/TrackHeader.d.ts +19 -0
- package/dist/types/src/components/CellGrid/headers/TrackHeader.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/headers/index.d.ts +3 -0
- package/dist/types/src/components/CellGrid/headers/index.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/index.d.ts +6 -0
- package/dist/types/src/components/CellGrid/index.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/input/index.d.ts +3 -0
- package/dist/types/src/components/CellGrid/input/index.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/input/pointer.d.ts +29 -0
- package/dist/types/src/components/CellGrid/input/pointer.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/input/wheel.d.ts +14 -0
- package/dist/types/src/components/CellGrid/input/wheel.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/render/index.d.ts +3 -0
- package/dist/types/src/components/CellGrid/render/index.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/render/overlay-layer.d.ts +21 -0
- package/dist/types/src/components/CellGrid/render/overlay-layer.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/render/static-layer.d.ts +36 -0
- package/dist/types/src/components/CellGrid/render/static-layer.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/state/atoms.d.ts +23 -0
- package/dist/types/src/components/CellGrid/state/atoms.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/state/index.d.ts +4 -0
- package/dist/types/src/components/CellGrid/state/index.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/state/types.d.ts +39 -0
- package/dist/types/src/components/CellGrid/state/types.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/state/viewport.d.ts +52 -0
- package/dist/types/src/components/CellGrid/state/viewport.d.ts.map +1 -0
- package/dist/types/src/components/CellGrid/state/viewport.test.d.ts +2 -0
- package/dist/types/src/components/CellGrid/state/viewport.test.d.ts.map +1 -0
- package/dist/types/src/components/FPS.d.ts.map +1 -1
- package/dist/types/src/components/Grid/Grid.d.ts +2 -2
- package/dist/types/src/components/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/components/Grid/Grid.stories.d.ts +1 -1
- package/dist/types/src/components/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/projection.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrag.d.ts +6 -0
- package/dist/types/src/hooks/useDrag.d.ts.map +1 -0
- package/dist/types/src/hooks/useWheel.d.ts.map +1 -1
- package/dist/types/src/util/svg.d.ts +1 -1
- package/dist/types/src/util/svg.d.ts.map +1 -1
- package/dist/types/src/util/svg.stories.d.ts.map +1 -1
- package/dist/types/src/util/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -26
- package/src/components/Canvas/Canvas.stories.tsx +6 -6
- package/src/components/Canvas/Canvas.tsx +4 -4
- package/src/components/CellGrid/CellGrid.stories.tsx +238 -0
- package/src/components/CellGrid/CellGrid.tsx +266 -0
- package/src/components/CellGrid/headers/Ruler.tsx +71 -0
- package/src/components/CellGrid/headers/TrackHeader.tsx +58 -0
- package/src/components/CellGrid/headers/index.ts +6 -0
- package/src/components/CellGrid/index.ts +9 -0
- package/src/components/CellGrid/input/index.ts +6 -0
- package/src/components/CellGrid/input/pointer.ts +208 -0
- package/src/components/CellGrid/input/wheel.ts +68 -0
- package/src/components/CellGrid/render/index.ts +6 -0
- package/src/components/CellGrid/render/overlay-layer.ts +66 -0
- package/src/components/CellGrid/render/static-layer.ts +112 -0
- package/src/components/CellGrid/state/atoms.ts +43 -0
- package/src/components/CellGrid/state/index.ts +7 -0
- package/src/components/CellGrid/state/types.ts +40 -0
- package/src/components/CellGrid/state/viewport.test.ts +50 -0
- package/src/components/CellGrid/state/viewport.ts +94 -0
- package/src/components/FPS.tsx +2 -2
- package/src/components/Grid/Grid.stories.tsx +2 -3
- package/src/components/Grid/Grid.tsx +13 -15
- package/src/components/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDrag.tsx +96 -0
- package/src/hooks/useWheel.tsx +0 -28
- package/src/util/svg.stories.tsx +2 -2
- package/src/util/svg.tsx +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/Canvas/Canvas.tsx", "../../../src/hooks/projection.tsx", "../../../src/hooks/useCanvasContext.tsx", "../../../src/hooks/useWheel.tsx", "../../../src/util/svg.tsx", "../../../src/util/util.ts", "../../../src/components/FPS.tsx", "../../../src/components/Grid/Grid.tsx", "../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, {\n type CSSProperties,\n type HTMLAttributes,\n type PropsWithChildren,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { CanvasContext, ProjectionMapper, type ProjectionState, defaultOrigin } from '../../hooks';\n\nexport interface CanvasController {\n setProjection(projection: ProjectionState): Promise<void>;\n}\n\nexport type CanvasProps = ThemedClassName<PropsWithChildren<Partial<ProjectionState> & HTMLAttributes<HTMLDivElement>>>;\n\n/**\n * Root canvas component.\n * Manages CSS projection.\n */\nexport const Canvas = forwardRef<CanvasController, CanvasProps>(\n ({ children, classNames, scale: _scale = 1, offset: _offset = defaultOrigin, ...props }, forwardedRef) => {\n // Size.\n const { ref, width = 0, height = 0 } = useResizeDetector();\n\n // Ready when initially resized.\n const [ready, setReady] = useState(false);\n\n // Projection.\n const [{ scale, offset }, setProjection] = useState<ProjectionState>({ scale: _scale, offset: _offset });\n useEffect(() => {\n if (width && height && offset === defaultOrigin) {\n setProjection({ scale, offset: { x: width / 2, y: height / 2 } });\n }\n }, [width, height, scale, offset]);\n\n // Projection mapper.\n const projection = useMemo(() => new ProjectionMapper(), []);\n useEffect(() => {\n projection.update({ width, height }, scale, offset);\n if (offset !== defaultOrigin) {\n setReady(true);\n }\n }, [projection, scale, offset, width, height]);\n\n // CSS transforms.\n const styles = useMemo<CSSProperties>(() => {\n return {\n // NOTE: Order is important.\n transform: `translate(${offset.x}px, ${offset.y}px) scale(${scale})`,\n visibility: width && height ? 'visible' : 'hidden',\n };\n }, [scale, offset]);\n\n // Controller.\n useImperativeHandle(forwardedRef, () => {\n return {\n setProjection: async (projection: ProjectionState) => {\n setProjection(projection);\n },\n };\n }, [ref]);\n\n return (\n <CanvasContext.Provider\n value={{ root: ref.current, ready, width, height, scale, offset, styles, projection, setProjection }}\n >\n <div role='none' {...props} className={mx('absolute inset-0 overflow-hidden', classNames)} ref={ref}>\n {ready ? children : null}\n </div>\n </CanvasContext.Provider>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { easeSinOut, interpolate, interpolateObject, transition } from 'd3';\nimport {\n type Matrix,\n applyToPoints,\n compose,\n identity,\n inverse,\n scale as scaleMatrix,\n translate as translateMatrix,\n} from 'transformation-matrix';\n\nimport { type Dimension, type Point } from '../types';\n\nexport const defaultOrigin: Point = { x: 0, y: 0 };\n\n// TODO(burdon): Rotation also?\nexport type ProjectionState = {\n scale: number;\n offset: Point;\n};\n\n/**\n * Maps between screen and model coordinates.\n */\nexport interface Projection {\n get bounds(): Dimension;\n get scale(): number;\n get offset(): Point;\n\n /**\n * Maps the model space to the screen offset (from the top-left of the element).\n */\n toScreen(points: Point[]): Point[];\n\n /**\n * Maps the pointer coordinate (from the top-left of the element) to the model space.\n */\n toModel(points: Point[]): Point[];\n}\n\nexport class ProjectionMapper implements Projection {\n private _bounds: Dimension = { width: 0, height: 0 };\n private _scale: number = 1;\n private _offset: Point = defaultOrigin;\n private _toScreen: Matrix = identity();\n private _toModel: Matrix = identity();\n\n constructor(bounds?: Dimension, scale?: number, offset?: Point) {\n if (bounds && scale && offset) {\n this.update(bounds, scale, offset);\n }\n }\n\n update(bounds: Dimension, scale: number, offset: Point): this {\n this._bounds = bounds;\n this._scale = scale;\n this._offset = offset;\n this._toScreen = compose(\n // NOTE: Order is important.\n translateMatrix(this._offset.x, this._offset.y),\n scaleMatrix(this._scale),\n // TODO(burdon): Flip.\n // flipX(),\n );\n this._toModel = inverse(this._toScreen);\n return this;\n }\n\n get bounds() {\n return this._bounds;\n }\n\n get scale() {\n return this._scale;\n }\n\n get offset() {\n return this._offset;\n }\n\n toScreen(points: Point[]): Point[] {\n return applyToPoints(this._toScreen, points);\n }\n\n toModel(points: Point[]): Point[] {\n return applyToPoints(this._toModel, points);\n }\n}\n\n/**\n * Maintain position while zooming.\n */\nexport const getZoomTransform = ({\n scale,\n offset,\n pos,\n newScale,\n}: ProjectionState & { pos: Point; newScale: number }): ProjectionState => {\n return {\n scale: newScale,\n offset: {\n x: pos.x - (pos.x - offset.x) * (newScale / scale),\n y: pos.y - (pos.y - offset.y) * (newScale / scale),\n },\n };\n};\n\n/**\n * Zoom while keeping the specified position in place.\n */\n// TODO(burdon): Convert to object.\nexport const zoomInPlace = (\n setTransform: (state: ProjectionState) => void,\n pos: Point,\n offset: Point,\n current: number,\n next: number,\n delay = 200,\n) => {\n const is = interpolate(current, next);\n transition()\n .ease(easeSinOut)\n .duration(delay)\n .tween('zoom', () => (t) => {\n const newScale = is(t);\n setTransform(getZoomTransform({ scale: current, newScale, offset, pos }));\n });\n};\n\nconst noop = () => {};\n\n/**\n * Zoom to new scale and position.\n */\n// TODO(burdon): Convert to object.\nexport const zoomTo = (\n setTransform: (state: ProjectionState) => void,\n current: ProjectionState,\n next: ProjectionState,\n delay = 200,\n cb = noop,\n) => {\n const is = interpolateObject({ scale: current.scale, ...current.offset }, { scale: next.scale, ...next.offset });\n transition()\n .ease(easeSinOut)\n .duration(delay)\n .tween('zoom', () => (t) => {\n const { scale, x, y } = is(t);\n setTransform({ scale, offset: { x, y } });\n })\n .on('end', cb);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type CSSProperties, type Dispatch, type SetStateAction, createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type Projection, type ProjectionState } from './projection';\n\nexport type CanvasContext = ProjectionState & {\n root: HTMLDivElement;\n ready: boolean;\n width: number;\n height: number;\n styles: CSSProperties;\n projection: Projection;\n setProjection: Dispatch<SetStateAction<ProjectionState>>;\n};\n\n/**\n * @internal\n */\n// TODO(burdon): Use radix?\nexport const CanvasContext = createContext<CanvasContext | null>(null);\n\nexport const useCanvasContext = (): CanvasContext => {\n return useContext(CanvasContext) ?? raise(new Error('Missing CanvasContext'));\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { bindAll } from 'bind-event-listener';\nimport { useEffect } from 'react';\n\nimport { getRelativePoint } from '../util';\n\nimport { getZoomTransform } from './projection';\nimport { useCanvasContext } from './useCanvasContext';\n\nexport type WheelOptions = {\n zoom?: boolean;\n};\n\nconst defaultOptions: WheelOptions = {\n zoom: true,\n};\n\n/**\n * Handle wheel events to update the transform state (zoom and offset).\n */\nexport const useWheel = (options: WheelOptions = defaultOptions) => {\n const { root, setProjection } = useCanvasContext();\n useEffect(() => {\n if (!root) {\n return;\n }\n\n return bindAll(root, [\n {\n type: 'wheel',\n options: { capture: true, passive: false },\n listener: (ev: WheelEvent) => {\n const zooming = isWheelZooming(ev);\n if (!hasFocus(root) && !zooming) {\n return;\n }\n\n ev.preventDefault();\n if (zooming && !options.zoom) {\n return;\n }\n\n // Zoom or pan.\n if (ev.ctrlKey) {\n if (!root) {\n return;\n }\n\n // Keep centered while zooming.\n setProjection(({ scale, offset }) => {\n const pos = getRelativePoint(root, ev);\n const scaleSensitivity = 0.01;\n const newScale = scale * Math.exp(-ev.deltaY * scaleSensitivity);\n return getZoomTransform({ scale, offset, newScale, pos });\n });\n } else {\n setProjection(({ scale, offset: { x, y } }) => {\n return {\n scale,\n offset: {\n x: x - ev.deltaX,\n y: y - ev.deltaY,\n },\n };\n });\n }\n },\n },\n ]);\n }, [root]);\n};\n\nconst isWheelZooming = (ev: WheelEvent): boolean => {\n // Check for ctrl/cmd key + wheel action.\n if (ev.ctrlKey || ev.metaKey) {\n // Some browsers use deltaY, others deltaZ for zoom.\n return Math.abs(ev.deltaY) > 0 || Math.abs(ev.deltaZ) > 0;\n }\n\n return false;\n};\n\nconst hasFocus = (element: HTMLElement): boolean => {\n const activeElement = document.activeElement;\n if (!activeElement) {\n return false;\n }\n\n // Handle shadow DOM.\n let shadowActive = activeElement;\n while (shadowActive?.shadowRoot?.activeElement) {\n shadowActive = shadowActive.shadowRoot.activeElement;\n }\n\n // Check if element or any parent has focus.\n let current: HTMLElement | null = element;\n while (current) {\n if (current === activeElement || current === shadowActive) {\n return true;\n }\n current = current.parentElement;\n }\n\n return false;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type PropsWithChildren, type SVGProps } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { type Dimension, type Point } from '../types';\n\n// Refs\n// - https://airbnb.io/visx/gallery\n// - https://github.com/tldraw/tldraw/blob/main/packages/editor/src/lib/primitives/Vec.ts\n\nexport const createPath = (points: Point[], join = false) => {\n return ['M', points.map(({ x, y }) => `${x},${y}`).join(' L '), join ? 'Z' : ''].join(' ');\n};\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths\n * NOTE: Leave space around shape for line width.\n */\nexport const Markers = ({ id = 'dx-marker', classNames }: ThemedClassName<{ id?: string }>) => {\n return (\n <>\n <Arrow id={`${id}-arrow-start`} dir='start' classNames={classNames} />\n <Arrow id={`${id}-arrow-end`} dir='end' classNames={classNames} />\n <Arrow id={`${id}-triangle-start`} dir='start' closed classNames={classNames} />\n <Arrow id={`${id}-triangle-end`} dir='end' closed classNames={classNames} />\n <Marker id={`${id}-circle`} pos={{ x: 8, y: 8 }} size={{ width: 16, height: 16 }}>\n <circle cx={8} cy={8} r={5} stroke={'context-stroke'} className={mx(classNames)} />\n </Marker>\n </>\n );\n};\n\nexport type MarkerProps = SVGProps<SVGMarkerElement> &\n PropsWithChildren<\n ThemedClassName<{\n id: string;\n pos: Point;\n size: Dimension;\n fill?: boolean;\n }>\n >;\n\n/**\n * https://www.w3.org/TR/SVG2/painting.html#Markers\n */\nexport const Marker = ({\n id,\n className,\n children,\n pos: { x: refX, y: refY },\n size: { width: markerWidth, height: markerHeight },\n fill,\n ...rest\n}: MarkerProps) => (\n <marker\n id={id}\n className={className}\n {...{\n refX,\n refY,\n markerWidth,\n markerHeight,\n markerUnits: 'strokeWidth',\n orient: 'auto',\n ...rest,\n }}\n >\n {children}\n </marker>\n);\n\nexport const Arrow = ({\n classNames,\n id,\n size = 16,\n dir = 'end',\n closed = false,\n}: ThemedClassName<{ id: string; size?: number; dir?: 'start' | 'end'; closed?: boolean }>) => (\n <Marker\n id={id}\n size={{ width: size, height: size }}\n pos={dir === 'end' ? { x: size, y: size / 2 } : { x: 0, y: size / 2 }}\n >\n <path\n fill={closed ? undefined : 'none'}\n stroke={'context-stroke'}\n className={mx(classNames)}\n d={createPath(\n dir === 'end'\n ? [\n { x: 1, y: 1 },\n { x: size, y: size / 2 },\n { x: 1, y: size - 1 },\n ]\n : [\n { x: size - 1, y: 1 },\n { x: 0, y: size / 2 },\n { x: size - 1, y: size - 1 },\n ],\n closed,\n )}\n />\n </Marker>\n);\n\nexport const GridPattern = ({\n classNames,\n id,\n size,\n offset,\n}: ThemedClassName<{ id: string; size: number; offset: Point }>) => (\n <pattern\n id={id}\n x={(size / 2 + offset.x) % size}\n y={(size / 2 + offset.y) % size}\n width={size}\n height={size}\n patternUnits='userSpaceOnUse'\n >\n {/* TODO(burdon): vars. */}\n <g className={mx(classNames)}>\n <line x1={0} y1={size / 2} x2={size} y2={size / 2} />\n <line x1={size / 2} y1={0} x2={size / 2} y2={size} />\n </g>\n </pattern>\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nlet logged = false;\n\n/**\n * Get the relative point of the cursor.\n * NOTE: ev.offset returns the position relative to the target.\n */\nexport const getRelativePoint = (el: HTMLElement, ev: MouseEvent) => {\n const rect = el.getBoundingClientRect();\n return { x: ev.clientX - rect.x, y: ev.clientY - rect.top };\n};\n\n/**\n *\n */\n// TODO(burdon): Factor out.\nexport const testId = <ID = string>(id: ID, inspect = false) => {\n if (inspect) {\n if (!logged) {\n // eslint-disable-next-line no-console\n console.log('Open storybook in expanded window;\\nthen run INSPECT()');\n logged = true;\n }\n\n (window as any).INSPECT = () => {\n const el = document.querySelector(`[data-test-id=\"${id}\"]`);\n (window as any).inspect(el);\n // eslint-disable-next-line no-console\n console.log(el);\n };\n }\n\n return { [DATA_TEST_ID]: id };\n};\n\nexport const inspectElement = (el: Element) => {\n (window as any).INSPECT = () => {\n (window as any).inspect(el);\n (window as any).element = el;\n // eslint-disable-next-line no-console\n console.log('Open storybook in expanded window;\\nthen run INSPECT()');\n // eslint-disable-next-line no-console\n console.log(el);\n };\n};\n\nexport const DATA_TEST_ID = 'data-test-id';\n", "//\n// Copyright 2024 DXOS.org\n// Adapted from: https://github.com/smplrspace/react-fps-stats\n//\n\nimport React, { useEffect, useReducer, useRef } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nexport type FPSProps = ThemedClassName<{\n width?: number;\n height?: number;\n bar?: string;\n}>;\n\ntype State = {\n max: number;\n len: number;\n fps: number[];\n frames: number;\n prevTime: number;\n};\n\nconst SEC = 1_000;\n\nexport const FPS = ({ classNames, width = 60, height = 30, bar = 'bg-cyan-500' }: FPSProps) => {\n const [{ fps, max, len }, dispatch] = useReducer(\n (state: State) => {\n const currentTime = Date.now();\n if (currentTime > state.prevTime + SEC) {\n const nextFPS = [\n ...new Array(Math.floor((currentTime - state.prevTime - SEC) / SEC)).fill(0),\n Math.max(1, Math.round((state.frames * SEC) / (currentTime - state.prevTime))),\n ];\n return {\n max: Math.max(state.max, ...nextFPS),\n len: Math.min(state.len + nextFPS.length, width),\n fps: [...state.fps, ...nextFPS].slice(-width),\n frames: 1,\n prevTime: currentTime,\n };\n } else {\n return { ...state, frames: state.frames + 1 };\n }\n },\n {\n max: 0,\n len: 0,\n fps: [],\n frames: 0,\n prevTime: Date.now(),\n },\n );\n\n const requestRef = useRef<number | null>(null);\n const tick = () => {\n dispatch();\n requestRef.current = requestAnimationFrame(tick);\n };\n\n useEffect(() => {\n requestRef.current = requestAnimationFrame(tick);\n return () => {\n if (requestRef.current) {\n cancelAnimationFrame(requestRef.current);\n }\n };\n }, []);\n\n return (\n <div\n style={{ width: width + 6 }}\n className={mx(\n 'relative flex flex-col p-0.5',\n 'bg-baseSurface text-xs text-subdued font-thin pointer-events-none border border-separator',\n classNames,\n )}\n >\n <div>{fps[len - 1]} FPS</div>\n <div className='w-full relative' style={{ height }}>\n {fps.map((frame, i) => (\n <div\n key={`fps-${i}`}\n className={bar}\n style={{\n position: 'absolute',\n bottom: 0,\n right: `${len - 1 - i}px`,\n height: `${(height * frame) / max}px`,\n width: 1,\n }}\n />\n ))}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { forwardRef, useId, useMemo } from 'react';\n\nimport { type ThemedClassName, useForwardedRef } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { useCanvasContext } from '../../hooks';\nimport { type Point } from '../../types';\nimport { GridPattern, testId } from '../../util';\n\nconst gridRatios = [1 / 4, 1, 4, 16];\n\nconst defaultGridSize = 16;\nconst defaultOffset: Point = { x: 0, y: 0 };\n\nconst createId = (parent: string, grid: number) => `dx-canvas-grid-${parent}-${grid}`;\n\nexport type GridProps = ThemedClassName<{\n size?: number;\n scale?: number;\n offset?: Point;\n showAxes?: boolean;\n}>;\n\nexport const GridComponent = forwardRef<SVGSVGElement, GridProps>(\n (\n { size: gridSize = defaultGridSize, scale = 1, offset = defaultOffset, showAxes = true, classNames },\n forwardedRef,\n ) => {\n const svgRef = useForwardedRef(forwardedRef);\n const instanceId = useId();\n const grids = useMemo(\n () =>\n gridRatios\n .map((ratio) => ({ id: ratio, size: ratio * gridSize * scale }))\n .filter(({ size }) => size >= gridSize && size <= 256),\n [gridSize, scale],\n );\n\n const { width = 0, height = 0 } = svgRef.current?.getBoundingClientRect() ?? {};\n\n return (\n <svg\n {...testId('dx-canvas-grid')}\n ref={svgRef}\n className={mx(\n 'absolute inset-0 w-full h-full pointer-events-none touch-none select-none',\n 'stroke-neutral-500',\n classNames,\n )}\n >\n {/* NOTE: The pattern is offset so that the middle of the pattern aligns with the grid. */}\n <defs>\n {grids.map(({ id, size }) => (\n <GridPattern key={id} id={createId(instanceId, id)} offset={offset} size={size} />\n ))}\n </defs>\n {showAxes && (\n <>\n <line x1={0} y1={offset.y} x2={width} y2={offset.y} className='stroke-neutral-500 opacity-40' />\n <line x1={offset.x} y1={0} x2={offset.x} y2={height} className='stroke-neutral-500 opacity-40' />\n </>\n )}\n <g>\n {grids.map(({ id }, i) => (\n <rect\n key={id}\n opacity={0.1 + i * 0.05}\n fill={`url(#${createId(instanceId, id)})`}\n width='100%'\n height='100%'\n />\n ))}\n </g>\n </svg>\n );\n },\n);\n\n// TODO(burdon): Use id of parent canvas.\nexport const Grid = (props: GridProps) => {\n const { scale, offset } = useCanvasContext();\n return <GridComponent {...props} scale={scale} offset={offset} />;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nexport const Point = Schema.Struct({ x: Schema.Number, y: Schema.Number });\nexport const Dimension = Schema.Struct({ width: Schema.Number, height: Schema.Number });\nexport const Rect = Schema.extend(Point, Dimension);\n\nexport type Point = Schema.Schema.Type<typeof Point>;\nexport type Dimension = Schema.Schema.Type<typeof Dimension>;\nexport type Rect = Schema.Schema.Type<typeof Rect>;\n"],
|
|
5
|
-
"mappings": ";;AAIA,OAAOA,UAILC,YACAC,aAAAA,YACAC,qBACAC,SACAC,gBACK;AACP,SAASC,yBAAyB;AAGlC,SAASC,MAAAA,WAAU;;;ACbnB,SAASC,YAAYC,aAAaC,mBAAmBC,kBAAkB;AACvE,SAEEC,eACAC,SACAC,UACAC,SACAC,SAASC,aACTC,aAAaC,uBACR;;;;;;;;;;;;;;AAIA,IAAMC,gBAAuB;EAAEC,GAAG;EAAGC,GAAG;AAAE;AA2B1C,IAAMC,mBAAN,MAAMA;EAaXC,OAAOC,QAAmBC,OAAeC,QAAqB;AAC5D,SAAKC,UAAUH;AACf,SAAKI,SAASH;AACd,SAAKI,UAAUH;AACf,SAAKI,YAAYC;;MAEfC,gBAAgB,KAAKH,QAAQT,GAAG,KAAKS,QAAQR,CAAC;MAC9CY,YAAY,KAAKL,MAAM;IAAA;AAIzB,SAAKM,WAAWC,QAAQ,KAAKL,SAAS;AACtC,WAAO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EhB,MAAME,IAAI,CAAC,EAAEE,IAAIf,KAAI,MACpB,gBAAAqB,OAAA,cAACO,aAAAA;MAAYC,KAAKd;MAAIA,IAAIpB,SAASc,YAAYM,EAAAA;MAAKZ;MAAgBH;UAGvEI,YACC,gBAAAiB,OAAA,cAAAA,OAAA,UAAA,MACE,gBAAAA,OAAA,cAACS,QAAAA;MAAKC,IAAI;MAAGC,IAAI7B,OAAOT;MAAGuC,IAAIhB;MAAOiB,IAAI/B,OAAOT;MAAG+B,WAAU;QAC9D,gBAAAJ,OAAA,cAACS,QAAAA;MAAKC,IAAI5B,OAAOV;MAAGuC,IAAI;MAAGC,IAAI9B,OAAOV;MAAGyC,IAAIhB;MAAQO,WAAU;SAGnE,gBAAAJ,OAAA,cAACc,KAAAA,MACExB,MAAME,IAAI,CAAC,EAAEE,GAAE,GAAIqB,MAClB,gBAAAf,OAAA,cAACgB,QAAAA;MACCR,KAAKd;MACLuB,SAAS,MAAMF,IAAI;MACnBG,MAAM,QAAQ5C,SAASc,YAAYM,EAAAA,CAAAA;MACnCE,OAAM;MACNC,QAAO;;;;;AAMnB,CAAA;AAIK,IAAMsB,OAAO,CAACC,UAAAA;;;AACnB,UAAM,EAAEvC,OAAOC,OAAM,IAAKuC,iBAAAA;AAC1B,WAAO,gBAAArB,OAAA,cAACvB,eAAAA;MAAe,GAAG2C;MAAOvC;MAAcC;;;;;AACjD;;;AClFA,YAAYwC,YAAY;AAEjB,IAAMC,QAAeC,cAAO;EAAEC,GAAUC;EAAQC,GAAUD;AAAO,CAAA;AACjE,IAAME,YAAmBJ,cAAO;EAAEK,OAAcH;EAAQI,QAAeJ;AAAO,CAAA;AAC9E,IAAMK,OAAcC,cAAOT,OAAOK,SAAAA;",
|
|
6
|
-
"names": ["React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useState", "useResizeDetector", "mx", "easeSinOut", "interpolate", "interpolateObject", "transition", "applyToPoints", "compose", "identity", "inverse", "scale", "scaleMatrix", "translate", "translateMatrix", "defaultOrigin", "x", "y", "ProjectionMapper", "
|
|
3
|
+
"sources": ["../../../src/components/Canvas/Canvas.tsx", "../../../src/hooks/projection.tsx", "../../../src/hooks/useCanvasContext.tsx", "../../../src/hooks/useDrag.tsx", "../../../src/hooks/useWheel.tsx", "../../../src/util/svg.tsx", "../../../src/util/util.ts", "../../../src/components/CellGrid/CellGrid.tsx", "../../../src/components/CellGrid/headers/Ruler.tsx", "../../../src/components/CellGrid/state/viewport.ts", "../../../src/components/CellGrid/headers/TrackHeader.tsx", "../../../src/components/CellGrid/input/pointer.ts", "../../../src/components/CellGrid/input/wheel.ts", "../../../src/components/CellGrid/render/overlay-layer.ts", "../../../src/components/CellGrid/render/static-layer.ts", "../../../src/components/CellGrid/state/atoms.ts", "../../../src/components/FPS.tsx", "../../../src/components/Grid/Grid.tsx", "../../../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, {\n type CSSProperties,\n type HTMLAttributes,\n type PropsWithChildren,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { CanvasContext, ProjectionMapper, type ProjectionState, defaultOrigin } from '../../hooks';\n\nexport interface CanvasController {\n setProjection(projection: ProjectionState): Promise<void>;\n}\n\nexport type CanvasProps = ThemedClassName<PropsWithChildren<Partial<ProjectionState> & HTMLAttributes<HTMLDivElement>>>;\n\n/**\n * Root canvas component.\n * Manages CSS projection.\n */\nexport const Canvas = forwardRef<CanvasController, CanvasProps>(\n ({ children, classNames, scale: scaleProp = 1, offset: offsetProp = defaultOrigin, ...props }, forwardedRef) => {\n // Size.\n const { ref, width = 0, height = 0 } = useResizeDetector();\n\n // Ready when initially resized.\n const [ready, setReady] = useState(false);\n\n // Projection.\n const [{ scale, offset }, setProjection] = useState<ProjectionState>({ scale: scaleProp, offset: offsetProp });\n useEffect(() => {\n if (width && height && offset === defaultOrigin) {\n setProjection({ scale, offset: { x: width / 2, y: height / 2 } });\n }\n }, [width, height, scale, offset]);\n\n // Projection mapper.\n const projection = useMemo(() => new ProjectionMapper(), []);\n useEffect(() => {\n projection.update({ width, height }, scale, offset);\n if (offset !== defaultOrigin) {\n setReady(true);\n }\n }, [projection, scale, offset, width, height]);\n\n // CSS transforms.\n const styles = useMemo<CSSProperties>(() => {\n return {\n // NOTE: Order is important.\n transform: `translate(${offset.x}px, ${offset.y}px) scale(${scale})`,\n visibility: width && height ? 'visible' : 'hidden',\n };\n }, [scale, offset]);\n\n // Controller.\n useImperativeHandle(forwardedRef, () => {\n return {\n setProjection: async (projection: ProjectionState) => {\n setProjection(projection);\n },\n };\n }, [ref]);\n\n return (\n <CanvasContext.Provider\n value={{ root: ref.current, ready, width, height, scale, offset, styles, projection, setProjection }}\n >\n <div {...props} className={mx('absolute inset-0 overflow-hidden', classNames)} ref={ref}>\n {ready ? children : null}\n </div>\n </CanvasContext.Provider>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { easeSinOut, interpolate, interpolateObject, transition } from 'd3';\nimport {\n type Matrix,\n applyToPoints,\n compose,\n identity,\n inverse,\n scale as scaleMatrix,\n translate as translateMatrix,\n} from 'transformation-matrix';\n\nimport { type Dimension, type Point } from '../types';\n\nexport const defaultOrigin: Point = { x: 0, y: 0 };\n\n// TODO(burdon): Rotation also?\nexport type ProjectionState = {\n scale: number;\n offset: Point;\n};\n\n/**\n * Maps between screen and model coordinates.\n */\nexport interface Projection {\n get bounds(): Dimension;\n get scale(): number;\n get offset(): Point;\n\n /**\n * Maps the model space to the screen offset (from the top-left of the element).\n */\n toScreen(points: Point[]): Point[];\n\n /**\n * Maps the pointer coordinate (from the top-left of the element) to the model space.\n */\n toModel(points: Point[]): Point[];\n}\n\nexport class ProjectionMapper implements Projection {\n private _bounds: Dimension = { width: 0, height: 0 };\n private _scale: number = 1;\n private _offset: Point = defaultOrigin;\n private _toScreen: Matrix = identity();\n private _toModel: Matrix = identity();\n\n constructor(bounds?: Dimension, scale?: number, offset?: Point) {\n if (bounds && scale && offset) {\n this.update(bounds, scale, offset);\n }\n }\n\n update(bounds: Dimension, scale: number, offset: Point): this {\n this._bounds = bounds;\n this._scale = scale;\n this._offset = offset;\n this._toScreen = compose(\n // NOTE: Order is important.\n translateMatrix(this._offset.x, this._offset.y),\n scaleMatrix(this._scale),\n // TODO(burdon): Flip.\n // flipX(),\n );\n this._toModel = inverse(this._toScreen);\n return this;\n }\n\n get bounds() {\n return this._bounds;\n }\n\n get scale() {\n return this._scale;\n }\n\n get offset() {\n return this._offset;\n }\n\n toScreen(points: Point[]): Point[] {\n return applyToPoints(this._toScreen, points);\n }\n\n toModel(points: Point[]): Point[] {\n return applyToPoints(this._toModel, points);\n }\n}\n\n/**\n * Maintain position while zooming.\n */\nexport const getZoomTransform = ({\n scale,\n offset,\n pos,\n newScale,\n}: ProjectionState & { pos: Point; newScale: number }): ProjectionState => {\n return {\n scale: newScale,\n offset: {\n x: pos.x - (pos.x - offset.x) * (newScale / scale),\n y: pos.y - (pos.y - offset.y) * (newScale / scale),\n },\n };\n};\n\n/**\n * Zoom while keeping the specified position in place.\n */\n// TODO(burdon): Convert to object.\nexport const zoomInPlace = (\n setTransform: (state: ProjectionState) => void,\n pos: Point,\n offset: Point,\n current: number,\n next: number,\n delay = 200,\n) => {\n const is = interpolate(current, next);\n transition()\n .ease(easeSinOut)\n .duration(delay)\n .tween('zoom', () => (t) => {\n const newScale = is(t);\n setTransform(getZoomTransform({ scale: current, newScale, offset, pos }));\n });\n};\n\nconst noop = () => {};\n\n/**\n * Zoom to new scale and position.\n */\n// TODO(burdon): Convert to object.\nexport const zoomTo = (\n setTransform: (state: ProjectionState) => void,\n current: ProjectionState,\n next: ProjectionState,\n delay = 200,\n cb = noop,\n) => {\n const is = interpolateObject({ scale: current.scale, ...current.offset }, { scale: next.scale, ...next.offset });\n transition()\n .ease(easeSinOut)\n .duration(delay)\n .tween('zoom', () => (t) => {\n const { scale, x, y } = is(t);\n setTransform({ scale, offset: { x, y } });\n })\n .on('end', cb);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type CSSProperties, type Dispatch, type SetStateAction, createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type Projection, type ProjectionState } from './projection';\n\nexport type CanvasContext = ProjectionState & {\n root: HTMLDivElement;\n ready: boolean;\n width: number;\n height: number;\n styles: CSSProperties;\n projection: Projection;\n setProjection: Dispatch<SetStateAction<ProjectionState>>;\n};\n\n/**\n * @internal\n */\n// TODO(burdon): Use radix?\nexport const CanvasContext = createContext<CanvasContext | null>(null);\n\nexport const useCanvasContext = (): CanvasContext => {\n return useContext(CanvasContext) ?? raise(new Error('Missing CanvasContext'));\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { bind } from 'bind-event-listener';\nimport { useEffect, useRef } from 'react';\n\nimport { useCanvasContext } from './useCanvasContext';\n\nexport type DragOptions = {\n // TODO(burdon): Add constraints?\n};\n\n/**\n * Handle drag events to update the transform state (offset).\n */\nexport const useDrag = (_options: DragOptions = {}) => {\n const { root, setProjection } = useCanvasContext();\n\n // Track drag state.\n const state = useRef<{\n panning: boolean;\n x: number;\n y: number;\n }>({ panning: false, x: 0, y: 0 });\n\n useEffect(() => {\n if (!root) {\n return;\n }\n\n // TODO(burdon): Use d3-drag?\n return bind(root, {\n type: 'pointerdown',\n listener: (ev: PointerEvent) => {\n // Only left click.\n if (ev.button !== 0) {\n return;\n }\n\n if (ev.defaultPrevented) {\n return;\n }\n\n if (ev.target !== root || ev.shiftKey) {\n return;\n }\n\n // Check if clicking on an interactive element?\n // For now, assume if it bubbled to root, it's fair game unless prevented.\n\n ev.preventDefault(); // Prevent text selection.\n root.setPointerCapture(ev.pointerId);\n state.current = { panning: true, x: ev.clientX, y: ev.clientY };\n\n const moveUnbind = bind(root, {\n type: 'pointermove',\n listener: (ev: PointerEvent) => {\n if (!state.current.panning) {\n return;\n }\n\n // Calculate delta.\n const dx = ev.clientX - state.current.x;\n const dy = ev.clientY - state.current.y;\n\n state.current.x = ev.clientX;\n state.current.y = ev.clientY;\n\n setProjection((prev) => ({\n ...prev,\n offset: {\n x: prev.offset.x + dx,\n y: prev.offset.y + dy,\n },\n }));\n },\n });\n\n const upUnbind = bind(root, {\n type: 'pointerup',\n listener: (ev: PointerEvent) => {\n state.current.panning = false;\n root.releasePointerCapture(ev.pointerId);\n moveUnbind();\n upUnbind();\n // Clean up lostpointercapture as well?\n },\n });\n\n // Handle cancellation/lost capture just in case?\n // Using setPointerCapture usually handles this well on the element.\n },\n });\n }, [root]);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { bindAll } from 'bind-event-listener';\nimport { useEffect } from 'react';\n\nimport { getRelativePoint } from '../util';\nimport { getZoomTransform } from './projection';\nimport { useCanvasContext } from './useCanvasContext';\n\nexport type WheelOptions = {\n zoom?: boolean;\n};\n\nconst defaultOptions: WheelOptions = {\n zoom: true,\n};\n\n/**\n * Handle wheel events to update the transform state (zoom and offset).\n */\nexport const useWheel = (options: WheelOptions = defaultOptions) => {\n const { root, setProjection } = useCanvasContext();\n useEffect(() => {\n if (!root) {\n return;\n }\n\n return bindAll(root, [\n {\n type: 'wheel',\n options: { capture: true, passive: false },\n listener: (ev: WheelEvent) => {\n const zooming = isWheelZooming(ev);\n\n ev.preventDefault();\n if (zooming && !options.zoom) {\n return;\n }\n\n // Zoom or pan.\n if (ev.ctrlKey) {\n if (!root) {\n return;\n }\n\n // Keep centered while zooming.\n setProjection(({ scale, offset }) => {\n const pos = getRelativePoint(root, ev);\n const scaleSensitivity = 0.01;\n const newScale = scale * Math.exp(-ev.deltaY * scaleSensitivity);\n return getZoomTransform({ scale, offset, newScale, pos });\n });\n } else {\n setProjection(({ scale, offset: { x, y } }) => {\n return {\n scale,\n offset: {\n x: x - ev.deltaX,\n y: y - ev.deltaY,\n },\n };\n });\n }\n },\n },\n ]);\n }, [root]);\n};\n\nconst isWheelZooming = (ev: WheelEvent): boolean => {\n // Check for ctrl/cmd key + wheel action.\n if (ev.ctrlKey || ev.metaKey) {\n // Some browsers use deltaY, others deltaZ for zoom.\n return Math.abs(ev.deltaY) > 0 || Math.abs(ev.deltaZ) > 0;\n }\n\n return false;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type PropsWithChildren, type SVGProps } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { type Dimension, type Point } from '../types';\n\n// Refs\n// - https://airbnb.io/visx/gallery\n// - https://github.com/tldraw/tldraw/blob/main/packages/editor/src/lib/primitives/Vec.ts\n\nexport const createPath = (points: Point[], join = false) => {\n return ['M', points.map(({ x, y }) => `${x},${y}`).join(' L '), join ? 'Z' : ''].join(' ');\n};\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths\n * NOTE: Leave space around shape for line width.\n */\nexport const Markers = ({ id = 'dx-marker', classNames }: ThemedClassName<{ id?: string }>) => {\n return (\n <>\n <Arrow id={`${id}-arrow-start`} dir='start' classNames={classNames} />\n <Arrow id={`${id}-arrow-end`} dir='end' classNames={classNames} />\n <Arrow id={`${id}-triangle-start`} dir='start' closed classNames={classNames} />\n <Arrow id={`${id}-triangle-end`} dir='end' closed classNames={classNames} />\n <Marker id={`${id}-circle`} pos={{ x: 8, y: 8 }} size={{ width: 16, height: 16 }}>\n <circle cx={8} cy={8} r={5} stroke={'context-stroke'} className={mx(classNames)} />\n </Marker>\n </>\n );\n};\n\nexport type MarkerProps = SVGProps<SVGMarkerElement> &\n PropsWithChildren<\n ThemedClassName<{\n id: string;\n pos: Point;\n size: Dimension;\n fill?: boolean;\n }>\n >;\n\n/**\n * https://www.w3.org/TR/SVG2/painting.html#Markers\n */\nexport const Marker = ({\n id,\n className,\n children,\n pos: { x: refX, y: refY },\n size: { width: markerWidth, height: markerHeight },\n fill,\n ...rest\n}: MarkerProps) => (\n <marker\n id={id}\n className={className}\n {...{\n refX,\n refY,\n markerWidth,\n markerHeight,\n markerUnits: 'strokeWidth',\n orient: 'auto',\n ...rest,\n }}\n >\n {children}\n </marker>\n);\n\nexport const Arrow = ({\n classNames,\n id,\n size = 16,\n dir = 'end',\n closed = false,\n}: ThemedClassName<{ id: string; size?: number; dir?: 'start' | 'end'; closed?: boolean }>) => (\n <Marker\n id={id}\n size={{ width: size, height: size }}\n pos={dir === 'end' ? { x: size, y: size / 2 } : { x: 0, y: size / 2 }}\n >\n <path\n fill={closed ? undefined : 'none'}\n stroke={'context-stroke'}\n className={mx(classNames)}\n d={createPath(\n dir === 'end'\n ? [\n { x: 1, y: 1 },\n { x: size, y: size / 2 },\n { x: 1, y: size - 1 },\n ]\n : [\n { x: size - 1, y: 1 },\n { x: 0, y: size / 2 },\n { x: size - 1, y: size - 1 },\n ],\n closed,\n )}\n />\n </Marker>\n);\n\nexport const GridPattern = ({\n classNames,\n id,\n size,\n offset,\n}: ThemedClassName<{ id: string; size: number; offset: Point }>) => (\n <pattern\n id={id}\n x={(size / 2 + offset.x) % size}\n y={(size / 2 + offset.y) % size}\n width={size}\n height={size}\n patternUnits='userSpaceOnUse'\n >\n {/* TODO(burdon): vars. */}\n <g className={mx(classNames)}>\n <line x1={0} y1={size / 2} x2={size} y2={size / 2} />\n <line x1={size / 2} y1={0} x2={size / 2} y2={size} />\n </g>\n </pattern>\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nlet logged = false;\n\n/**\n * Get the relative point of the cursor.\n * NOTE: ev.offset returns the position relative to the target.\n */\nexport const getRelativePoint = (el: HTMLElement, ev: MouseEvent) => {\n const rect = el.getBoundingClientRect();\n return { x: ev.clientX - rect.x, y: ev.clientY - rect.top };\n};\n\n/**\n *\n */\n// TODO(burdon): Factor out.\nexport const testId = <ID = string>(id: ID, inspect = false) => {\n if (inspect) {\n if (!logged) {\n // eslint-disable-next-line no-console\n console.log('Open storybook in expanded window;\\nthen run INSPECT()');\n logged = true;\n }\n\n (window as any).INSPECT = () => {\n const el = document.querySelector(`[data-test-id=\"${id}\"]`);\n (window as any).inspect(el);\n // eslint-disable-next-line no-console\n console.log(el);\n };\n }\n\n return { [DATA_TEST_ID]: id };\n};\n\nexport const inspectElement = (el: Element) => {\n (window as any).INSPECT = () => {\n (window as any).inspect(el);\n (window as any).element = el;\n // eslint-disable-next-line no-console\n console.log('Open storybook in expanded window;\\nthen run INSPECT()');\n // eslint-disable-next-line no-console\n console.log(el);\n };\n};\n\nexport const DATA_TEST_ID = 'data-test-id';\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport React, { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport type { ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { Ruler, TrackHeader } from './headers';\nimport { attachPointerHandlers, attachWheelHandlers, type PointerHandlers } from './input';\nimport { drawCells, drawOverlay, type OverlayStyle, type RenderCell, type StaticLayerStyle } from './render';\nimport type { CellGridAtoms } from './state/atoms';\nimport type { Cell, Headers, Row } from './state/types';\n\nexport type CellGridProps<T = unknown> = ThemedClassName<\n PointerHandlers & {\n atoms: CellGridAtoms<T>;\n rows: ReadonlyArray<Row>;\n renderCell: RenderCell<T>;\n headers?: Partial<Headers> | false;\n staticStyle?: Partial<StaticLayerStyle>;\n overlayStyle?: Partial<OverlayStyle>;\n }\n>;\n\nconst defaultHeaders: Headers = { left: 80, top: 24 };\n\nconst defaultStaticStyle: StaticLayerStyle = {\n gridLine: 'rgba(128,128,128,0.25)',\n rowBand: 'rgba(128,128,128,0.06)',\n};\n\nconst defaultOverlayStyle: OverlayStyle = {\n playhead: 'rgb(220, 38, 38)',\n selectionFill: 'rgba(59, 130, 246, 0.15)',\n selectionStroke: 'rgb(59, 130, 246)',\n};\n\nconst setupCanvas = (canvas: HTMLCanvasElement, width: number, height: number): CanvasRenderingContext2D | null => {\n const dpr = window.devicePixelRatio || 1;\n canvas.width = Math.max(1, Math.floor(width * dpr));\n canvas.height = Math.max(1, Math.floor(height * dpr));\n canvas.style.width = `${width}px`;\n canvas.style.height = `${height}px`;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return null;\n }\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n return ctx;\n};\n\n/**\n * Canvas-based 2D grid where cells contain pluggable shapes. Suitable for music sequencers,\n * time-series data viz, and similar workloads at ~1k visible cells per viewport.\n */\nexport const CellGrid = <T,>({\n atoms,\n rows,\n renderCell,\n headers: headersProp,\n staticStyle: staticStyleProp,\n overlayStyle: overlayStyleProp,\n classNames,\n onCellToggle,\n onSelectionCommit,\n}: CellGridProps<T>) => {\n const registry = useContext(RegistryContext);\n\n const headers = useMemo<Headers>(() => {\n if (headersProp === false) {\n return { left: 0, top: 0 };\n }\n return { ...defaultHeaders, ...(headersProp ?? {}) };\n }, [headersProp]);\n\n const staticStyle = useMemo<StaticLayerStyle>(\n () => ({ ...defaultStaticStyle, ...(staticStyleProp ?? {}) }),\n [staticStyleProp],\n );\n const overlayStyle = useMemo<OverlayStyle>(\n () => ({ ...defaultOverlayStyle, ...(overlayStyleProp ?? {}) }),\n [overlayStyleProp],\n );\n\n const { ref: containerRef, width = 0, height = 0 } = useResizeDetector<HTMLDivElement>();\n const staticCanvasRef = useRef<HTMLCanvasElement>(null);\n const overlayCanvasRef = useRef<HTMLCanvasElement>(null);\n const overlayInputRef = useRef<HTMLDivElement>(null);\n\n const [staticCtx, setStaticCtx] = useState<CanvasRenderingContext2D | null>(null);\n const [overlayCtx, setOverlayCtx] = useState<CanvasRenderingContext2D | null>(null);\n\n // Track header rerenders for the React-side ruler/track-header.\n const [viewportState, setViewportState] = useState(() => registry.get(atoms.viewport));\n\n // Resize canvases on container resize.\n useEffect(() => {\n if (!width || !height) {\n return;\n }\n if (staticCanvasRef.current) {\n const ctx = setupCanvas(staticCanvasRef.current, width, height);\n setStaticCtx(ctx);\n }\n if (overlayCanvasRef.current) {\n const ctx = setupCanvas(overlayCanvasRef.current, width, height);\n setOverlayCtx(ctx);\n }\n }, [width, height]);\n\n // Mirror viewport into React state so headers re-render on scroll/zoom.\n useEffect(() => registry.subscribe(atoms.viewport, (next) => setViewportState(next)), [registry, atoms.viewport]);\n\n // Static-layer redraw on (cells, viewport, rows, headers, style, size) change.\n useEffect(() => {\n if (!staticCtx || !width || !height) {\n return;\n }\n let raf: number | null = null;\n const schedule = () => {\n if (raf !== null) {\n return;\n }\n raf = requestAnimationFrame(() => {\n raf = null;\n drawCells({\n ctx: staticCtx,\n size: { width, height },\n viewport: registry.get(atoms.viewport),\n headers,\n rows,\n cells: registry.get(atoms.cells),\n renderCell,\n style: staticStyle,\n });\n });\n };\n schedule();\n const unsubCells = registry.subscribe(atoms.cells, schedule);\n const unsubViewport = registry.subscribe(atoms.viewport, schedule);\n return () => {\n if (raf !== null) {\n cancelAnimationFrame(raf);\n }\n unsubCells();\n unsubViewport();\n };\n }, [staticCtx, width, height, registry, atoms.cells, atoms.viewport, headers, rows, renderCell, staticStyle]);\n\n // Overlay rAF loop while playhead or active selection drag.\n useEffect(() => {\n if (!overlayCtx || !width || !height) {\n return;\n }\n let raf: number | null = null;\n let stopped = false;\n\n const paint = () => {\n drawOverlay({\n ctx: overlayCtx,\n size: { width, height },\n viewport: registry.get(atoms.viewport),\n headers,\n selection: registry.get(atoms.selection),\n playhead: registry.get(atoms.playhead),\n style: overlayStyle,\n });\n };\n\n const isAnimating = () => registry.get(atoms.playhead) !== null;\n\n const loop = () => {\n if (stopped) {\n return;\n }\n paint();\n if (isAnimating()) {\n raf = requestAnimationFrame(loop);\n } else {\n raf = null;\n }\n };\n\n const kick = () => {\n paint();\n if (raf === null && isAnimating()) {\n raf = requestAnimationFrame(loop);\n }\n };\n\n kick();\n const unsubSelection = registry.subscribe(atoms.selection, () => paint());\n const unsubPlayhead = registry.subscribe(atoms.playhead, kick);\n const unsubViewport = registry.subscribe(atoms.viewport, () => paint());\n\n return () => {\n stopped = true;\n if (raf !== null) {\n cancelAnimationFrame(raf);\n }\n unsubSelection();\n unsubPlayhead();\n unsubViewport();\n };\n }, [overlayCtx, width, height, registry, atoms.selection, atoms.playhead, atoms.viewport, headers, overlayStyle]);\n\n // Input wiring. Keep the callbacks in a ref so the listener attachment is stable\n // across consumer re-renders — otherwise an in-progress drag is torn down when\n // the parent's onCellToggle identity changes (e.g. after the very mutation we\n // just triggered), and subsequent pointermove events see drag === null.\n const callbacksRef = useRef<PointerHandlers>({ onCellToggle, onSelectionCommit });\n callbacksRef.current = { onCellToggle, onSelectionCommit };\n useEffect(() => {\n const element = overlayInputRef.current;\n if (!element) {\n return;\n }\n const detachPointer = attachPointerHandlers(element, {\n registry,\n atoms,\n headers,\n handlers: {\n onCellToggle: (coord, mode) => callbacksRef.current.onCellToggle?.(coord, mode),\n onSelectionCommit: (range) => callbacksRef.current.onSelectionCommit?.(range),\n },\n });\n const detachWheel = attachWheelHandlers(element, { registry, atoms, headers });\n return () => {\n detachPointer();\n detachWheel();\n };\n }, [registry, atoms, headers]);\n\n return (\n <div ref={containerRef} className={mx('relative w-full h-full overflow-hidden bg-baseSurface', classNames)}>\n {/*\n Canvases are nudged up + left 1 CSS pixel so the gridlines (drawn at the TOP\n and LEFT edges of each cell) sit on top of the frozen header dividers — the\n TrackHeader's right border and bottom-row box-shadow, which both render 1px\n inside the box. Without this offset the canvas gridlines land 1px down/right\n of the header dividers and the columns read as misaligned.\n */}\n <canvas ref={staticCanvasRef} className='absolute inset-0 pointer-events-none' style={{ top: -1, left: -1 }} />\n <canvas ref={overlayCanvasRef} className='absolute inset-0 pointer-events-none' style={{ top: -1, left: -1 }} />\n <div\n ref={overlayInputRef}\n className='absolute inset-0 touch-none'\n style={{ paddingLeft: headers.left, paddingTop: headers.top }}\n />\n {headers.top > 0 && <Ruler viewport={viewportState} headers={headers} width={width} />}\n {headers.left > 0 && <TrackHeader viewport={viewportState} headers={headers} rows={rows} height={height} />}\n {headers.top > 0 && headers.left > 0 && (\n <div\n className='absolute top-0 left-0 border-b border-r border-neutral-200 dark:border-neutral-700 bg-baseSurface'\n style={{ width: headers.left, height: headers.top }}\n />\n )}\n </div>\n );\n};\n\nexport type { Cell };\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useMemo } from 'react';\n\nimport { mx } from '@dxos/ui-theme';\n\nimport type { Headers, Viewport } from '../state/types';\nimport { cellWidth } from '../state/viewport';\n\nexport type RulerProps = {\n viewport: Viewport;\n headers: Headers;\n width: number;\n /** Number of columns to label between major ticks. */\n majorEvery?: number;\n classNames?: string;\n};\n\n/**\n * Frozen top ruler. Ticks reflect the current viewport scroll and zoom.\n */\nexport const Ruler = ({ viewport, headers, width, majorEvery = 4, classNames }: RulerProps) => {\n // Clamp to >= 1 — a zero or negative `majorEvery` makes `col % majorEvery`\n // NaN / always-zero and breaks major-tick detection.\n const safeMajorEvery = Math.max(1, Math.floor(majorEvery));\n const ticks = useMemo(() => {\n const w = cellWidth(viewport);\n if (w < 1 || width <= headers.left) {\n return [];\n }\n const innerWidth = width - headers.left;\n const startCol = Math.floor(viewport.scrollX / w);\n const endCol = Math.ceil((viewport.scrollX + innerWidth) / w);\n const result: Array<{ col: number; x: number; major: boolean }> = [];\n for (let col = startCol; col <= endCol; col++) {\n result.push({\n col,\n x: headers.left + col * w - viewport.scrollX,\n major: col % safeMajorEvery === 0,\n });\n }\n return result;\n }, [viewport, headers.left, width, safeMajorEvery]);\n\n return (\n <div\n className={mx(\n 'absolute top-0 left-0 right-0 border-b border-neutral-200 dark:border-neutral-700 bg-baseSurface select-none overflow-hidden',\n classNames,\n )}\n style={{ height: headers.top }}\n >\n {ticks.map(({ col, x, major }) => (\n <div\n key={col}\n className={mx(\n 'absolute top-0 bottom-0 text-[10px] text-neutral-500 dark:text-neutral-400',\n major\n ? 'border-l border-neutral-400 dark:border-neutral-500'\n : 'border-l border-neutral-200 dark:border-neutral-700',\n )}\n style={{ transform: `translateX(${x}px)` }}\n >\n {major ? <span className='absolute left-1 top-0'>{col}</span> : null}\n </div>\n ))}\n </div>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport type { Cell, CellCoord, Headers, Viewport } from './types';\n\nexport const cellKey = (col: number, row: number): string => `${col},${row}`;\n\nexport const cellWidth = (viewport: Viewport): number => viewport.baseCellWidth * viewport.zoomX;\n\n/**\n * Convert a cell's world coordinates to screen-space pixel rectangle (relative to canvas origin).\n */\nexport const worldToScreen = (\n viewport: Viewport,\n headers: Headers,\n coord: { col: number; row: number; length?: number },\n): { x: number; y: number; w: number; h: number } => {\n const w = cellWidth(viewport);\n return {\n x: headers.left + coord.col * w - viewport.scrollX,\n y: headers.top + coord.row * viewport.cellHeight - viewport.scrollY,\n w: (coord.length ?? 1) * w,\n h: viewport.cellHeight,\n };\n};\n\n/**\n * Convert screen-space pixels (relative to canvas origin) to fractional cell coordinates.\n */\nexport const screenToWorld = (\n viewport: Viewport,\n headers: Headers,\n point: { x: number; y: number },\n): { col: number; row: number } => {\n const w = cellWidth(viewport);\n return {\n col: (point.x - headers.left + viewport.scrollX) / w,\n row: (point.y - headers.top + viewport.scrollY) / viewport.cellHeight,\n };\n};\n\nexport const hitTestCell = (\n viewport: Viewport,\n headers: Headers,\n point: { x: number; y: number },\n): CellCoord | null => {\n if (point.x < headers.left || point.y < headers.top) {\n return null;\n }\n const { col, row } = screenToWorld(viewport, headers, point);\n if (col < 0 || row < 0) {\n return null;\n }\n return { col: Math.floor(col), row: Math.floor(row) };\n};\n\n/**\n * Compute the inclusive range of cell coordinates intersecting the visible content rect.\n */\nexport const visibleCellRange = (\n viewport: Viewport,\n headers: Headers,\n size: { width: number; height: number },\n): { minCol: number; maxCol: number; minRow: number; maxRow: number } => {\n const w = cellWidth(viewport);\n const innerW = Math.max(0, size.width - headers.left);\n const innerH = Math.max(0, size.height - headers.top);\n const minCol = Math.max(0, Math.floor(viewport.scrollX / w));\n const maxCol = Math.floor((viewport.scrollX + innerW) / w);\n const minRow = Math.max(0, Math.floor(viewport.scrollY / viewport.cellHeight));\n const maxRow = Math.floor((viewport.scrollY + innerH) / viewport.cellHeight);\n return { minCol, maxCol, minRow, maxRow };\n};\n\n/**\n * Iterate sparse cell map, yielding only cells whose horizontal extent intersects visible cols and whose row is visible.\n */\nexport const visibleCells = function* <T>(\n cells: ReadonlyMap<string, Cell<T>>,\n range: { minCol: number; maxCol: number; minRow: number; maxRow: number },\n): Generator<Cell<T>> {\n for (const cell of cells.values()) {\n if (cell.row < range.minRow || cell.row > range.maxRow) {\n continue;\n }\n const start = cell.col;\n const end = cell.col + cell.length - 1;\n if (end < range.minCol || start > range.maxCol) {\n continue;\n }\n yield cell;\n }\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React from 'react';\n\nimport { mx } from '@dxos/ui-theme';\n\nimport type { Headers, Row, Viewport } from '../state/types';\n\nexport type TrackHeaderProps = {\n viewport: Viewport;\n headers: Headers;\n rows: ReadonlyArray<Row>;\n height: number;\n classNames?: string;\n};\n\n/**\n * Frozen left column listing row labels. Translates vertically in sync with viewport scroll.\n *\n * Row dividers and alternating shading intentionally MATCH the canvas — opaque borders\n * and opaque alternating fills make the labels look out of phase with the cell area\n * even when the y-positions align. We mirror the canvas's transparent-overlay model\n * here so the frozen column reads as a direct continuation of the grid.\n */\nexport const TrackHeader = ({ viewport, headers, rows, height, classNames }: TrackHeaderProps) => {\n return (\n <div\n className={mx(\n 'absolute left-0 border-r border-neutral-200 dark:border-neutral-700 select-none overflow-hidden',\n classNames,\n )}\n style={{ top: headers.top, width: headers.left, height: Math.max(0, height - headers.top) }}\n >\n <div style={{ transform: `translateY(${-viewport.scrollY}px)` }}>\n {rows.map((row, index) => (\n <div\n key={row.id}\n className='flex items-center px-2 text-xs text-neutral-700 dark:text-neutral-300'\n style={{\n height: viewport.cellHeight,\n // Match the canvas's row-band: a translucent gray overlay on odd rows,\n // transparent on even rows. The container's overall background bleeds\n // through, so the labels stay legible in both themes.\n backgroundColor: index % 2 === 0 ? 'transparent' : 'rgba(128, 128, 128, 0.08)',\n // Match the canvas gridline color (rgba(128, 128, 128, 0.25)). Use a\n // half-pixel inset to keep crisp single-pixel rendering on retina.\n boxShadow: 'inset 0 -1px 0 rgba(128, 128, 128, 0.25)',\n }}\n >\n {row.label ?? row.id}\n </div>\n ))}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport type { Registry } from '@effect-atom/atom-react';\n\nimport type { CellGridAtoms } from '../state/atoms';\nimport type { Cell, CellCoord, Headers, SelectionRange, Tool } from '../state/types';\nimport { cellKey, hitTestCell } from '../state/viewport';\n\n/**\n * 'set' / 'unset' are idempotent — the receiver must add or remove the cell\n * regardless of current state. 'toggle' flips it. Drag operations always pick\n * a fixed mode (set or unset) based on the cell under the initial pointerdown\n * so the user paints a uniform stroke instead of flipping each cell.\n */\nexport type ToggleMode = 'set' | 'unset' | 'toggle';\n\nexport type PointerHandlers = {\n onCellToggle?: (coord: CellCoord, mode: ToggleMode) => void;\n onSelectionCommit?: (range: SelectionRange) => void;\n};\n\ntype DragState =\n | { kind: 'toggle'; mode: 'set' | 'unset'; touched: Set<string> }\n | { kind: 'select'; origin: CellCoord }\n | { kind: 'pan'; lastX: number; lastY: number };\n\nexport type PointerControllerOptions<T> = {\n registry: Registry.Registry;\n atoms: CellGridAtoms<T>;\n headers: Headers;\n handlers: PointerHandlers;\n};\n\n/**\n * Attach pointer handlers to an element. Returns an unsubscribe.\n */\nexport const attachPointerHandlers = <T>(\n element: HTMLElement,\n { registry, atoms, headers, handlers }: PointerControllerOptions<T>,\n): (() => void) => {\n let drag: DragState | null = null;\n\n const local = (event: PointerEvent) => {\n const rect = element.getBoundingClientRect();\n return { x: event.clientX - rect.left, y: event.clientY - rect.top };\n };\n\n // setPointerCapture throws for synthetic / untrusted PointerEvents (e.g. those\n // dispatched by tests). Capture is a best-effort UX nicety — never let it abort\n // the click path.\n const tryCapture = (pointerId: number) => {\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // Ignore — drag tracking still works without capture.\n }\n };\n\n const onPointerDown = (event: PointerEvent) => {\n // Middle-mouse or space-held pan: pan tool regardless of `tool` atom.\n if (event.button === 1 || (event.button === 0 && event.altKey)) {\n drag = { kind: 'pan', lastX: event.clientX, lastY: event.clientY };\n tryCapture(event.pointerId);\n event.preventDefault();\n return;\n }\n\n if (event.button !== 0) {\n return;\n }\n\n const viewport = registry.get(atoms.viewport);\n const point = local(event);\n const coord = hitTestCell(viewport, headers, point);\n if (!coord) {\n return;\n }\n\n const tool = registry.get(atoms.tool) as Tool;\n tryCapture(event.pointerId);\n\n switch (tool) {\n case 'toggle':\n case 'resize': {\n // Inspect the cells atom under the pointer to decide whether the gesture\n // is a paint (set) or an erase (unset). Subsequent drag movements apply the\n // same operation idempotently to every cell the cursor crosses.\n const cells = registry.get(atoms.cells) as ReadonlyMap<string, unknown>;\n const key = cellKey(coord.col, coord.row);\n const mode: 'set' | 'unset' = cells.has(key) ? 'unset' : 'set';\n handlers.onCellToggle?.(coord, mode);\n drag = { kind: 'toggle', mode, touched: new Set([key]) };\n break;\n }\n case 'select': {\n drag = { kind: 'select', origin: coord };\n registry.set(atoms.selection, {\n range: { col0: coord.col, row0: coord.row, col1: coord.col, row1: coord.row },\n });\n break;\n }\n }\n };\n\n const onPointerMove = (event: PointerEvent) => {\n if (!drag) {\n return;\n }\n if (drag.kind === 'pan') {\n const dx = event.clientX - drag.lastX;\n const dy = event.clientY - drag.lastY;\n drag.lastX = event.clientX;\n drag.lastY = event.clientY;\n registry.update(atoms.viewport, (current) => ({\n ...current,\n scrollX: Math.max(0, current.scrollX - dx),\n scrollY: Math.max(0, current.scrollY - dy),\n }));\n return;\n }\n\n const viewport = registry.get(atoms.viewport);\n const coord = hitTestCell(viewport, headers, local(event));\n if (!coord) {\n return;\n }\n\n if (drag.kind === 'toggle') {\n // Apply the drag's chosen mode to every cell the cursor enters, across rows,\n // de-duplicating per cell so we don't fire the same coord twice.\n const key = cellKey(coord.col, coord.row);\n if (!drag.touched.has(key)) {\n drag.touched.add(key);\n handlers.onCellToggle?.(coord, drag.mode);\n }\n } else if (drag.kind === 'select') {\n registry.set(atoms.selection, {\n range: { col0: drag.origin.col, row0: drag.origin.row, col1: coord.col, row1: coord.row },\n });\n }\n };\n\n const releaseCapture = (event: PointerEvent) => {\n if (element.hasPointerCapture(event.pointerId)) {\n element.releasePointerCapture(event.pointerId);\n }\n };\n\n const onPointerUp = (event: PointerEvent) => {\n if (!drag) {\n return;\n }\n if (drag.kind === 'select') {\n const range = registry.get(atoms.selection).range;\n if (range) {\n handlers.onSelectionCommit?.(range);\n }\n }\n drag = null;\n releaseCapture(event);\n };\n\n // pointercancel signals an interrupted gesture (system gesture, palm rejection,\n // capture lost). Per the Pointer Events spec this should clean up local state\n // ONLY and not be treated as a successful completion — so we never commit a\n // selection from cancel.\n const onPointerCancel = (event: PointerEvent) => {\n drag = null;\n releaseCapture(event);\n };\n\n element.addEventListener('pointerdown', onPointerDown);\n element.addEventListener('pointermove', onPointerMove);\n element.addEventListener('pointerup', onPointerUp);\n element.addEventListener('pointercancel', onPointerCancel);\n\n return () => {\n element.removeEventListener('pointerdown', onPointerDown);\n element.removeEventListener('pointermove', onPointerMove);\n element.removeEventListener('pointerup', onPointerUp);\n element.removeEventListener('pointercancel', onPointerCancel);\n };\n};\n\n/**\n * Utility for consumers: toggle, set, or unset membership of a cell in the cells atom.\n */\nexport const toggleCell = <T>(\n registry: Registry.Registry,\n atoms: CellGridAtoms<T>,\n coord: CellCoord,\n factory: (coord: CellCoord) => Cell<T>,\n mode: ToggleMode = 'toggle',\n): void => {\n registry.update(atoms.cells, (current) => {\n const next = new Map(current);\n const key = cellKey(coord.col, coord.row);\n const exists = next.has(key);\n if (mode === 'set' || (mode === 'toggle' && !exists)) {\n next.set(key, factory(coord));\n } else if (mode === 'unset' || (mode === 'toggle' && exists)) {\n next.delete(key);\n }\n return next;\n });\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport type { Registry } from '@effect-atom/atom-react';\n\nimport type { CellGridAtoms } from '../state/atoms';\nimport type { Headers } from '../state/types';\nimport { cellWidth } from '../state/viewport';\n\nconst MIN_ZOOM = 0.25;\nconst MAX_ZOOM = 8;\n\nexport type WheelControllerOptions<T> = {\n registry: Registry.Registry;\n atoms: CellGridAtoms<T>;\n headers: Headers;\n};\n\n/**\n * Attach wheel handlers. Vertical wheel scrolls y; shift+wheel scrolls x;\n * cmd/ctrl+wheel zooms x around the cursor.\n */\nexport const attachWheelHandlers = <T>(\n element: HTMLElement,\n { registry, atoms, headers }: WheelControllerOptions<T>,\n): (() => void) => {\n const onWheel = (event: WheelEvent) => {\n if (event.ctrlKey || event.metaKey) {\n event.preventDefault();\n // Zoom around cursor x.\n const rect = element.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const factor = Math.exp(-event.deltaY / 200);\n registry.update(atoms.viewport, (current) => {\n const nextZoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, current.zoomX * factor));\n if (nextZoom === current.zoomX) {\n return current;\n }\n const w = cellWidth(current);\n const worldX = (x - headers.left + current.scrollX) / w;\n const nextW = current.baseCellWidth * nextZoom;\n const nextScrollX = Math.max(0, worldX * nextW - (x - headers.left));\n return { ...current, zoomX: nextZoom, scrollX: nextScrollX };\n });\n return;\n }\n\n const dx = event.shiftKey ? event.deltaY : event.deltaX;\n const dy = event.shiftKey ? 0 : event.deltaY;\n const current = registry.get(atoms.viewport);\n const nextScrollX = Math.max(0, current.scrollX + dx);\n const nextScrollY = Math.max(0, current.scrollY + dy);\n\n // Only consume the wheel event if we're actually scrolling within the grid.\n // When the user wheels up at the top (scrollY === 0 && dy < 0) or wheels left\n // at the left edge, let the event bubble to the parent so the page or\n // enclosing container can scroll instead of swallowing the gesture.\n if (nextScrollX === current.scrollX && nextScrollY === current.scrollY) {\n return;\n }\n event.preventDefault();\n registry.set(atoms.viewport, { ...current, scrollX: nextScrollX, scrollY: nextScrollY });\n };\n\n element.addEventListener('wheel', onWheel, { passive: false });\n return () => element.removeEventListener('wheel', onWheel);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport type { Headers, Selection, Viewport } from '../state/types';\nimport { cellWidth, worldToScreen } from '../state/viewport';\n\nexport type OverlayStyle = {\n playhead: string;\n selectionFill: string;\n selectionStroke: string;\n};\n\nexport type DrawOverlayOptions = {\n ctx: CanvasRenderingContext2D;\n size: { width: number; height: number };\n viewport: Viewport;\n headers: Headers;\n selection: Selection;\n /** Playhead position in world units (col + fraction), or null when not playing. */\n playhead: number | null;\n style: OverlayStyle;\n};\n\nexport const drawOverlay = ({ ctx, size, viewport, headers, selection, playhead, style }: DrawOverlayOptions): void => {\n ctx.clearRect(0, 0, size.width, size.height);\n\n ctx.save();\n ctx.beginPath();\n ctx.rect(headers.left, headers.top, size.width - headers.left, size.height - headers.top);\n ctx.clip();\n\n // Selection rectangle.\n if (selection.range) {\n const { col0, row0, col1, row1 } = selection.range;\n const minCol = Math.min(col0, col1);\n const maxCol = Math.max(col0, col1);\n const minRow = Math.min(row0, row1);\n const maxRow = Math.max(row0, row1);\n const tl = worldToScreen(viewport, headers, { col: minCol, row: minRow });\n const br = worldToScreen(viewport, headers, { col: maxCol + 1, row: maxRow + 1 });\n ctx.fillStyle = style.selectionFill;\n ctx.fillRect(tl.x, tl.y, br.x - tl.x, br.y - tl.y);\n ctx.strokeStyle = style.selectionStroke;\n ctx.setLineDash([4, 3]);\n ctx.lineWidth = 1;\n ctx.strokeRect(tl.x + 0.5, tl.y + 0.5, br.x - tl.x - 1, br.y - tl.y - 1);\n ctx.setLineDash([]);\n }\n\n // Playhead.\n if (playhead !== null) {\n const w = cellWidth(viewport);\n const x = headers.left + playhead * w - viewport.scrollX;\n if (x >= headers.left && x <= size.width) {\n ctx.strokeStyle = style.playhead;\n ctx.lineWidth = 2;\n ctx.beginPath();\n ctx.moveTo(x, headers.top);\n ctx.lineTo(x, size.height);\n ctx.stroke();\n }\n }\n\n ctx.restore();\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport type { Cell, Headers, Row, Viewport } from '../state/types';\nimport { cellWidth, visibleCellRange, visibleCells, worldToScreen } from '../state/viewport';\n\nexport type RenderCellArgs<T> = {\n ctx: CanvasRenderingContext2D;\n x: number;\n y: number;\n w: number;\n h: number;\n cell: Cell<T>;\n};\n\nexport type RenderCell<T = unknown> = (args: RenderCellArgs<T>) => void;\n\nexport type StaticLayerStyle = {\n /** Grid line color, e.g. 'rgba(0,0,0,0.08)'. */\n gridLine: string;\n /** Row band fill (alternating), e.g. 'rgba(0,0,0,0.02)'. */\n rowBand?: string;\n background?: string;\n};\n\nexport type DrawCellsOptions<T> = {\n ctx: CanvasRenderingContext2D;\n size: { width: number; height: number };\n viewport: Viewport;\n headers: Headers;\n rows: ReadonlyArray<Row>;\n cells: ReadonlyMap<string, Cell<T>>;\n renderCell: RenderCell<T>;\n style: StaticLayerStyle;\n};\n\n/**\n * Paint the static layer: background, gridlines, alternating row bands, and cells.\n * Pure with respect to its inputs (writes only to the supplied ctx).\n */\nexport const drawCells = <T>({\n ctx,\n size,\n viewport,\n headers,\n rows,\n cells,\n renderCell,\n style,\n}: DrawCellsOptions<T>): void => {\n ctx.clearRect(0, 0, size.width, size.height);\n\n if (style.background) {\n ctx.fillStyle = style.background;\n ctx.fillRect(0, 0, size.width, size.height);\n }\n\n const range = visibleCellRange(viewport, headers, size);\n const w = cellWidth(viewport);\n const h = viewport.cellHeight;\n\n // Row bands. Paint odd rows so the stripe pattern matches the TrackHeader's\n // label backgrounds (which darken odd row indices) — keeps the frozen left\n // column and the cell area visually in lockstep.\n if (style.rowBand) {\n ctx.fillStyle = style.rowBand;\n for (let row = range.minRow; row <= Math.min(range.maxRow, rows.length - 1); row++) {\n if (row % 2 === 0) {\n continue;\n }\n const y = headers.top + row * h - viewport.scrollY;\n ctx.fillRect(headers.left, y, size.width - headers.left, h);\n }\n }\n\n // Gridlines.\n ctx.strokeStyle = style.gridLine;\n ctx.lineWidth = 1;\n ctx.beginPath();\n for (let col = range.minCol; col <= range.maxCol + 1; col++) {\n const x = Math.floor(headers.left + col * w - viewport.scrollX) + 0.5;\n if (x < headers.left) {\n continue;\n }\n ctx.moveTo(x, headers.top);\n ctx.lineTo(x, size.height);\n }\n for (let row = range.minRow; row <= Math.min(range.maxRow + 1, rows.length); row++) {\n const y = Math.floor(headers.top + row * h - viewport.scrollY) + 0.5;\n if (y < headers.top) {\n continue;\n }\n ctx.moveTo(headers.left, y);\n ctx.lineTo(size.width, y);\n }\n ctx.stroke();\n\n // Cells.\n ctx.save();\n ctx.beginPath();\n ctx.rect(headers.left, headers.top, size.width - headers.left, size.height - headers.top);\n ctx.clip();\n for (const cell of visibleCells(cells, range)) {\n if (cell.row >= rows.length) {\n continue;\n }\n const rect = worldToScreen(viewport, headers, cell);\n renderCell({ ctx, ...rect, cell });\n }\n ctx.restore();\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\n\nimport type { Cell, Selection, Tool, Viewport } from './types';\n\nexport type CellGridAtoms<T = unknown> = {\n cells: Atom.Writable<ReadonlyMap<string, Cell<T>>>;\n viewport: Atom.Writable<Viewport>;\n selection: Atom.Writable<Selection>;\n playhead: Atom.Writable<number | null>;\n tool: Atom.Writable<Tool>;\n};\n\nexport type CellGridAtomsOptions = {\n cellWidth?: number;\n cellHeight?: number;\n};\n\nexport const defaultViewport = (options: CellGridAtomsOptions = {}): Viewport => ({\n scrollX: 0,\n scrollY: 0,\n baseCellWidth: options.cellWidth ?? 24,\n cellHeight: options.cellHeight ?? 24,\n zoomX: 1,\n});\n\n/**\n * Create a fresh set of atoms backing a CellGrid instance. Consumers may pass any of these as props\n * or substitute their own (e.g., a cells atom backed by ECHO).\n *\n * Atoms are marked keepAlive so they preserve state across transient unsubscribe windows (e.g. React\n * Strict Mode mount-unmount-remount). Consumers are responsible for the atoms' lifetime.\n */\nexport const createCellGridAtoms = <T = unknown>(options: CellGridAtomsOptions = {}): CellGridAtoms<T> => ({\n cells: Atom.keepAlive(Atom.make<ReadonlyMap<string, Cell<T>>>(new Map())),\n viewport: Atom.keepAlive(Atom.make<Viewport>(defaultViewport(options))),\n selection: Atom.keepAlive(Atom.make<Selection>({ range: null })),\n playhead: Atom.keepAlive(Atom.make<number | null>(null)),\n tool: Atom.keepAlive(Atom.make<Tool>('toggle')),\n});\n", "//\n// Copyright 2024 DXOS.org\n// Adapted from: https://github.com/smplrspace/react-fps-stats\n//\n\nimport React, { useEffect, useReducer, useRef } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nexport type FPSProps = ThemedClassName<{\n width?: number;\n height?: number;\n bar?: string;\n}>;\n\ntype State = {\n max: number;\n len: number;\n fps: number[];\n frames: number;\n prevTime: number;\n};\n\nconst SEC = 1_000;\n\nexport const FPS = ({ classNames, width = 60, height = 30, bar = 'bg-cyan-500' }: FPSProps) => {\n const [{ fps, max, len }, dispatch] = useReducer(\n (state: State) => {\n const currentTime = Date.now();\n if (currentTime > state.prevTime + SEC) {\n const nextFPS = [\n ...new Array(Math.floor((currentTime - state.prevTime - SEC) / SEC)).fill(0),\n Math.max(1, Math.round((state.frames * SEC) / (currentTime - state.prevTime))),\n ];\n return {\n max: Math.max(state.max, ...nextFPS),\n len: Math.min(state.len + nextFPS.length, width),\n fps: [...state.fps, ...nextFPS].slice(-width),\n frames: 1,\n prevTime: currentTime,\n };\n } else {\n return { ...state, frames: state.frames + 1 };\n }\n },\n {\n max: 0,\n len: 0,\n fps: [],\n frames: 0,\n prevTime: Date.now(),\n },\n );\n\n const requestRef = useRef<number | null>(null);\n const tick = () => {\n dispatch();\n requestRef.current = requestAnimationFrame(tick);\n };\n\n useEffect(() => {\n requestRef.current = requestAnimationFrame(tick);\n return () => {\n if (requestRef.current) {\n cancelAnimationFrame(requestRef.current);\n }\n };\n }, []);\n\n return (\n <div\n style={{ width: width + 6 }}\n className={mx(\n 'relative flex flex-col p-0.5',\n 'bg-base-surface text-xs text-subdued font-thin pointer-events-none border border-separator',\n classNames,\n )}\n >\n <div>{fps[len - 1]} FPS</div>\n <div className='w-full relative' style={{ height }}>\n {fps.map((frame, i) => (\n <div\n key={`fps-${i}`}\n className={bar}\n style={{\n position: 'absolute',\n bottom: 0,\n right: `${len - 1 - i}px`,\n height: `${(height * frame) / max}px`,\n width: 1,\n }}\n />\n ))}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { forwardRef, useId, useMemo } from 'react';\n\nimport { type ThemedClassName, useForwardedRef } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { useCanvasContext } from '../../hooks';\nimport { type Point } from '../../types';\nimport { GridPattern, testId } from '../../util';\n\nconst gridRatios = [1 / 4, 1, 4, 16];\n\nconst defaultGridSize = 16;\nconst defaultOffset: Point = { x: 0, y: 0 };\n\nconst createId = (parent: string, grid: number) => `dx-canvas-grid-${parent}-${grid}`;\n\n// TODO(burdon): Click to drag.\n\nexport type GridProps = ThemedClassName<{\n size?: number;\n scale?: number;\n offset?: Point;\n showAxes?: boolean;\n}>;\n\n// TODO(burdon): Use id of parent canvas.\nexport const Grid = (props: GridProps) => {\n const { scale, offset } = useCanvasContext();\n return <GridComponent {...props} scale={scale} offset={offset} />;\n};\n\nexport const GridComponent = forwardRef<SVGSVGElement, GridProps>(\n (\n { size: gridSize = defaultGridSize, scale = 1, offset = defaultOffset, showAxes = true, classNames },\n forwardedRef,\n ) => {\n const svgRef = useForwardedRef(forwardedRef);\n const { width = 0, height = 0 } = svgRef.current?.getBoundingClientRect() ?? {};\n\n const instanceId = useId();\n const grids = useMemo(\n () =>\n gridRatios\n .map((ratio) => ({ id: ratio, size: ratio * gridSize * scale }))\n .filter(({ size }) => size >= gridSize && size <= 128),\n [gridSize, scale],\n );\n\n return (\n <svg\n {...testId('dx-canvas-grid')}\n ref={svgRef}\n className={mx('dx-fullscreen pointer-events-none touch-none select-none', 'stroke-neutral-500', classNames)}\n >\n {/* NOTE: The pattern is offset so that the middle of the pattern aligns with the grid. */}\n <defs>\n {grids.map(({ id, size }) => (\n <GridPattern key={id} id={createId(instanceId, id)} offset={offset} size={size} />\n ))}\n </defs>\n {showAxes && (\n <>\n <line x1={0} y1={offset.y} x2={width} y2={offset.y} className='stroke-neutral-500 opacity-40' />\n <line x1={offset.x} y1={0} x2={offset.x} y2={height} className='stroke-neutral-500 opacity-40' />\n </>\n )}\n <g>\n {grids.map(({ id }, i) => (\n <rect\n key={id}\n opacity={0.1 + i * 0.05}\n fill={`url(#${createId(instanceId, id)})`}\n width='100%'\n height='100%'\n />\n ))}\n </g>\n </svg>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nexport const Point = Schema.Struct({ x: Schema.Number, y: Schema.Number });\nexport const Dimension = Schema.Struct({ width: Schema.Number, height: Schema.Number });\nexport const Rect = Schema.extend(Point, Dimension);\n\nexport type Point = Schema.Schema.Type<typeof Point>;\nexport type Dimension = Schema.Schema.Type<typeof Dimension>;\nexport type Rect = Schema.Schema.Type<typeof Rect>;\n"],
|
|
5
|
+
"mappings": ";AAIA,OAAOA,UAILC,YACAC,aAAAA,YACAC,qBACAC,SACAC,gBACK;AACP,SAASC,yBAAyB;AAGlC,SAASC,MAAAA,WAAU;;;ACbnB,SAASC,YAAYC,aAAaC,mBAAmBC,kBAAkB;AACvE,SAEEC,eACAC,SACAC,UACAC,SACAC,SAASC,aACTC,aAAaC,uBACR;AAIA,IAAMC,gBAAuB;EAAEC,GAAG;EAAGC,GAAG;AAAE;AA2B1C,IAAMC,mBAAN,MAAMA;EACHC,UAAqB;IAAEC,OAAO;IAAGC,QAAQ;EAAE;EAC3CC,SAAiB;EACjBC,UAAiBR;EACjBS,YAAoBf,SAAAA;EACpBgB,WAAmBhB,SAAAA;EAE3B,YAAYiB,QAAoBf,OAAgBgB,QAAgB;AAC9D,QAAID,UAAUf,S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AAcC,cAAOT,OAAOK,SAAAA;",
|
|
6
|
+
"names": ["React", "forwardRef", "useEffect", "useImperativeHandle", "useMemo", "useState", "useResizeDetector", "mx", "easeSinOut", "interpolate", "interpolateObject", "transition", "applyToPoints", "compose", "identity", "inverse", "scale", "scaleMatrix", "translate", "translateMatrix", "defaultOrigin", "x", "y", "ProjectionMapper", "_bounds", "width", "height", "_scale", "_offset", "_toScreen", "_toModel", "bounds", "offset", "update", "toScreen", "points", "toModel", "getZoomTransform", "pos", "newScale", "zoomInPlace", "setTransform", "current", "next", "delay", "is", "ease", "duration", "tween", "t", "noop", "zoomTo", "cb", "on", "createContext", "useContext", "raise", "CanvasContext", "useCanvasContext", "Error", "bind", "useEffect", "useRef", "useDrag", "_options", "root", "setProjection", "useCanvasContext", "state", "useRef", "panning", "x", "y", "useEffect", "bind", "type", "listener", "ev", "button", "defaultPrevented", "target", "shiftKey", "preventDefault", "setPointerCapture", "pointerId", "current", "clientX", "clientY", "moveUnbind", "dx", "dy", "prev", "offset", "upUnbind", "releasePointerCapture", "bindAll", "useEffect", "React", "mx", "createPath", "points", "join", "map", "x", "y", "Markers", "id", "classNames", "Arrow", "dir", "closed", "Marker", "pos", "size", "width", "height", "circle", "cx", "cy", "r", "stroke", "className", "children", "refX", "refY", "markerWidth", "markerHeight", "fill", "rest", "marker", "markerUnits", "orient", "path", "undefined", "d", "GridPattern", "offset", "pattern", "patternUnits", "g", "line", "x1", "y1", "x2", "y2", "logged", "getRelativePoint", "el", "ev", "rect", "getBoundingClientRect", "x", "clientX", "y", "clientY", "top", "testId", "id", "inspect", "console", "log", "window", "INSPECT", "document", "querySelector", "DATA_TEST_ID", "inspectElement", "element", "defaultOptions", "zoom", "useWheel", "options", "root", "setProjection", "useCanvasContext", "useEffect", "bindAll", "type", "capture", "passive", "listener", "ev", "zooming", "isWheelZooming", "preventDefault", "ctrlKey", "scale", "offset", "pos", "getRelativePoint", "scaleSensitivity", "newScale", "Math", "exp", "deltaY", "getZoomTransform", "x", "y", "deltaX", "metaKey", "abs", "deltaZ", "Canvas", "forwardRef", "children", "classNames", "scale", "scaleProp", "offset", "offsetProp", "defaultOrigin", "props", "forwardedRef", "ref", "width", "height", "useResizeDetector", "ready", "setReady", "useState", "setProjection", "useEffect", "x", "y", "projection", "useMemo", "ProjectionMapper", "update", "styles", "transform", "visibility", "useImperativeHandle", "React", "CanvasContext", "Provider", "value", "root", "current", "div", "className", "mx", "RegistryContext", "React", "useContext", "useEffect", "useMemo", "useRef", "useState", "useResizeDetector", "mx", "React", "useMemo", "mx", "cellKey", "col", "row", "cellWidth", "viewport", "baseCellWidth", "zoomX", "worldToScreen", "headers", "coord", "w", "x", "left", "scrollX", "y", "top", "cellHeight", "scrollY", "length", "h", "screenToWorld", "point", "hitTestCell", "Math", "floor", "visibleCellRange", "size", "innerW", "max", "width", "innerH", "height", "minCol", "maxCol", "minRow", "maxRow", "visibleCells", "cells", "range", "cell", "values", "start", "end", "Ruler", "viewport", "headers", "width", "majorEvery", "classNames", "safeMajorEvery", "Math", "max", "floor", "ticks", "useMemo", "w", "cellWidth", "left", "innerWidth", "startCol", "scrollX", "endCol", "ceil", "result", "col", "push", "x", "major", "React", "div", "className", "mx", "style", "height", "top", "map", "key", "transform", "span", "React", "mx", "TrackHeader", "viewport", "headers", "rows", "height", "classNames", "div", "className", "style", "top", "width", "left", "Math", "max", "transform", "scrollY", "map", "row", "index", "key", "id", "cellHeight", "backgroundColor", "boxShadow", "label", "attachPointerHandlers", "element", "registry", "atoms", "headers", "handlers", "drag", "local", "event", "rect", "getBoundingClientRect", "x", "clientX", "left", "y", "clientY", "top", "tryCapture", "pointerId", "setPointerCapture", "onPointerDown", "button", "altKey", "kind", "lastX", "lastY", "preventDefault", "viewport", "get", "point", "coord", "hitTestCell", "tool", "cells", "key", "cellKey", "col", "row", "mode", "has", "onCellToggle", "touched", "Set", "origin", "set", "selection", "range", "col0", "row0", "col1", "row1", "onPointerMove", "dx", "dy", "update", "current", "scrollX", "Math", "max", "scrollY", "add", "releaseCapture", "hasPointerCapture", "releasePointerCapture", "onPointerUp", "onSelectionCommit", "onPointerCancel", "addEventListener", "removeEventListener", "toggleCell", "factory", "next", "Map", "exists", "delete", "MIN_ZOOM", "MAX_ZOOM", "attachWheelHandlers", "element", "registry", "atoms", "headers", "onWheel", "event", "ctrlKey", "metaKey", "preventDefault", "rect", "getBoundingClientRect", "x", "clientX", "left", "factor", "Math", "exp", "deltaY", "update", "viewport", "current", "nextZoom", "max", "min", "zoomX", "w", "cellWidth", "worldX", "scrollX", "nextW", "baseCellWidth", "nextScrollX", "dx", "shiftKey", "deltaX", "dy", "get", "nextScrollY", "scrollY", "set", "addEventListener", "passive", "removeEventListener", "drawOverlay", "ctx", "size", "viewport", "headers", "selection", "playhead", "style", "clearRect", "width", "height", "save", "beginPath", "rect", "left", "top", "clip", "range", "col0", "row0", "col1", "row1", "minCol", "Math", "min", "maxCol", "max", "minRow", "maxRow", "tl", "worldToScreen", "col", "row", "br", "fillStyle", "selectionFill", "fillRect", "x", "y", "strokeStyle", "selectionStroke", "setLineDash", "lineWidth", "strokeRect", "w", "cellWidth", "scrollX", "moveTo", "lineTo", "stroke", "restore", "drawCells", "ctx", "size", "viewport", "headers", "rows", "cells", "renderCell", "style", "clearRect", "width", "height", "background", "fillStyle", "fillRect", "range", "visibleCellRange", "w", "cellWidth", "h", "cellHeight", "rowBand", "row", "minRow", "Math", "min", "maxRow", "length", "y", "top", "scrollY", "left", "strokeStyle", "gridLine", "lineWidth", "beginPath", "col", "minCol", "maxCol", "x", "floor", "scrollX", "moveTo", "lineTo", "stroke", "save", "rect", "clip", "cell", "visibleCells", "worldToScreen", "restore", "defaultHeaders", "left", "top", "defaultStaticStyle", "gridLine", "rowBand", "defaultOverlayStyle", "playhead", "selectionFill", "selectionStroke", "setupCanvas", "canvas", "width", "height", "dpr", "window", "devicePixelRatio", "Math", "max", "floor", "style", "ctx", "getContext", "setTransform", "CellGrid", "atoms", "rows", "renderCell", "headers", "headersProp", "staticStyle", "staticStyleProp", "overlayStyle", "overlayStyleProp", "classNames", "onCellToggle", "onSelectionCommit", "registry", "useContext", "RegistryContext", "useMemo", "ref", "containerRef", "useResizeDetector", "staticCanvasRef", "useRef", "overlayCanvasRef", "overlayInputRef", "staticCtx", "setStaticCtx", "useState", "overlayCtx", "setOverlayCtx", "viewportState", "setViewportState", "get", "viewport", "useEffect", "current", "subscribe", "next", "raf", "schedule", "requestAnimationFrame", "drawCells", "size", "cells", "unsubCells", "unsubViewport", "cancelAnimationFrame", "stopped", "paint", "drawOverlay", "selection", "isAnimating", "loop", "kick", "unsubSelection", "unsubPlayhead", "callbacksRef", "element", "detachPointer", "attachPointerHandlers", "handlers", "coord", "mode", "range", "detachWheel", "attachWheelHandlers", "React", "div", "className", "mx", "paddingLeft", "paddingTop", "Ruler", "TrackHeader", "Atom", "defaultViewport", "options", "scrollX", "scrollY", "baseCellWidth", "cellWidth", "cellHeight", "zoomX", "createCellGridAtoms", "cells", "keepAlive", "make", "Map", "viewport", "selection", "range", "playhead", "tool", "React", "useEffect", "useReducer", "useRef", "mx", "SEC", "FPS", "classNames", "width", "height", "bar", "fps", "max", "len", "dispatch", "state", "currentTime", "Date", "now", "prevTime", "nextFPS", "Array", "Math", "floor", "fill", "round", "frames", "min", "length", "slice", "requestRef", "tick", "current", "requestAnimationFrame", "cancelAnimationFrame", "div", "style", "className", "map", "frame", "i", "key", "position", "bottom", "right", "React", "forwardRef", "useId", "useMemo", "useForwardedRef", "mx", "gridRatios", "defaultGridSize", "defaultOffset", "x", "y", "createId", "parent", "grid", "Grid", "props", "scale", "offset", "useCanvasContext", "React", "GridComponent", "forwardRef", "size", "gridSize", "showAxes", "classNames", "forwardedRef", "svgRef", "useForwardedRef", "width", "height", "current", "getBoundingClientRect", "instanceId", "useId", "grids", "useMemo", "map", "ratio", "id", "filter", "svg", "testId", "ref", "className", "mx", "defs", "GridPattern", "key", "line", "x1", "y1", "x2", "y2", "g", "i", "rect", "opacity", "fill", "Schema", "Point", "Struct", "x", "Number", "y", "Dimension", "width", "height", "Rect", "extend"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/hooks/projection.tsx":{"bytes":12183,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"transformation-matrix","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/useCanvasContext.tsx":{"bytes":2093,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/util/svg.tsx":{"bytes":13293,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/util/util.ts":{"bytes":4725,"imports":[],"format":"esm"},"src/util/index.ts":{"bytes":526,"imports":[{"path":"src/util/svg.tsx","kind":"import-statement","original":"./svg"},{"path":"src/util/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/hooks/useWheel.tsx":{"bytes":10133,"imports":[{"path":"bind-event-listener","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/util/index.ts","kind":"import-statement","original":"../util"},{"path":"src/hooks/projection.tsx","kind":"import-statement","original":"./projection"},{"path":"src/hooks/useCanvasContext.tsx","kind":"import-statement","original":"./useCanvasContext"}],"format":"esm"},"src/hooks/index.ts":{"bytes":662,"imports":[{"path":"src/hooks/projection.tsx","kind":"import-statement","original":"./projection"},{"path":"src/hooks/useCanvasContext.tsx","kind":"import-statement","original":"./useCanvasContext"},{"path":"src/hooks/useWheel.tsx","kind":"import-statement","original":"./useWheel"}],"format":"esm"},"src/components/Canvas/Canvas.tsx":{"bytes":9573,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"src/components/Canvas/index.ts":{"bytes":470,"imports":[{"path":"src/components/Canvas/Canvas.tsx","kind":"import-statement","original":"./Canvas"}],"format":"esm"},"src/components/FPS.tsx":{"bytes":9370,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/Grid/Grid.tsx":{"bytes":9761,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"src/hooks/index.ts","kind":"import-statement","original":"../../hooks"},{"path":"src/util/index.ts","kind":"import-statement","original":"../../util"}],"format":"esm"},"src/components/Grid/index.ts":{"bytes":462,"imports":[{"path":"src/components/Grid/Grid.tsx","kind":"import-statement","original":"./Grid"}],"format":"esm"},"src/components/index.ts":{"bytes":618,"imports":[{"path":"src/components/Canvas/index.ts","kind":"import-statement","original":"./Canvas"},{"path":"src/components/FPS.tsx","kind":"import-statement","original":"./FPS"},{"path":"src/components/Grid/index.ts","kind":"import-statement","original":"./Grid"}],"format":"esm"},"src/types.ts":{"bytes":1697,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":702,"imports":[{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":35742},"dist/lib/browser/index.mjs":{"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"transformation-matrix","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"bind-event-listener","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["Arrow","Canvas","CanvasContext","DATA_TEST_ID","Dimension","FPS","Grid","GridComponent","GridPattern","Marker","Markers","Point","ProjectionMapper","Rect","createPath","defaultOrigin","getRelativePoint","getZoomTransform","inspectElement","testId","useCanvasContext","useWheel","zoomInPlace","zoomTo"],"entryPoint":"src/index.ts","inputs":{"src/components/Canvas/Canvas.tsx":{"bytesInOutput":2301},"src/hooks/projection.tsx":{"bytesInOutput":2592},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useCanvasContext.tsx":{"bytesInOutput":260},"src/hooks/useWheel.tsx":{"bytesInOutput":2116},"src/util/svg.tsx":{"bytesInOutput":3523},"src/util/index.ts":{"bytesInOutput":0},"src/util/util.ts":{"bytesInOutput":800},"src/components/Canvas/index.ts":{"bytesInOutput":0},"src/components/index.ts":{"bytesInOutput":0},"src/components/FPS.tsx":{"bytesInOutput":2360},"src/components/Grid/Grid.tsx":{"bytesInOutput":2507},"src/components/Grid/index.ts":{"bytesInOutput":0},"src/index.ts":{"bytesInOutput":0},"src/types.ts":{"bytesInOutput":240}},"bytes":17381}}}
|
|
1
|
+
{"inputs":{"src/hooks/projection.tsx":{"bytes":11613,"imports":[{"path":"d3","kind":"import-statement","external":true},{"path":"transformation-matrix","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/useCanvasContext.tsx":{"bytes":1997,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/useDrag.tsx":{"bytes":8949,"imports":[{"path":"bind-event-listener","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/hooks/useCanvasContext.tsx","kind":"import-statement","original":"./useCanvasContext"}],"format":"esm"},"src/util/svg.tsx":{"bytes":12224,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/util/util.ts":{"bytes":4639,"imports":[],"format":"esm"},"src/util/index.ts":{"bytes":443,"imports":[{"path":"src/util/svg.tsx","kind":"import-statement","original":"./svg"},{"path":"src/util/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/hooks/useWheel.tsx":{"bytes":7766,"imports":[{"path":"bind-event-listener","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/util/index.ts","kind":"import-statement","original":"../util"},{"path":"src/hooks/projection.tsx","kind":"import-statement","original":"./projection"},{"path":"src/hooks/useCanvasContext.tsx","kind":"import-statement","original":"./useCanvasContext"}],"format":"esm"},"src/hooks/index.ts":{"bytes":665,"imports":[{"path":"src/hooks/projection.tsx","kind":"import-statement","original":"./projection"},{"path":"src/hooks/useCanvasContext.tsx","kind":"import-statement","original":"./useCanvasContext"},{"path":"src/hooks/useDrag.tsx","kind":"import-statement","original":"./useDrag"},{"path":"src/hooks/useWheel.tsx","kind":"import-statement","original":"./useWheel"}],"format":"esm"},"src/components/Canvas/Canvas.tsx":{"bytes":8909,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"src/components/Canvas/index.ts":{"bytes":370,"imports":[{"path":"src/components/Canvas/Canvas.tsx","kind":"import-statement","original":"./Canvas"}],"format":"esm"},"src/components/CellGrid/state/viewport.ts":{"bytes":10093,"imports":[],"format":"esm"},"src/components/CellGrid/headers/Ruler.tsx":{"bytes":7272,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/components/CellGrid/state/viewport.ts","kind":"import-statement","original":"../state/viewport"}],"format":"esm"},"src/components/CellGrid/headers/TrackHeader.tsx":{"bytes":6346,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/CellGrid/headers/index.ts":{"bytes":468,"imports":[{"path":"src/components/CellGrid/headers/Ruler.tsx","kind":"import-statement","original":"./Ruler"},{"path":"src/components/CellGrid/headers/TrackHeader.tsx","kind":"import-statement","original":"./TrackHeader"}],"format":"esm"},"src/components/CellGrid/input/pointer.ts":{"bytes":22329,"imports":[{"path":"src/components/CellGrid/state/viewport.ts","kind":"import-statement","original":"../state/viewport"}],"format":"esm"},"src/components/CellGrid/input/wheel.ts":{"bytes":8667,"imports":[{"path":"src/components/CellGrid/state/viewport.ts","kind":"import-statement","original":"../state/viewport"}],"format":"esm"},"src/components/CellGrid/input/index.ts":{"bytes":456,"imports":[{"path":"src/components/CellGrid/input/pointer.ts","kind":"import-statement","original":"./pointer"},{"path":"src/components/CellGrid/input/wheel.ts","kind":"import-statement","original":"./wheel"}],"format":"esm"},"src/components/CellGrid/render/overlay-layer.ts":{"bytes":7572,"imports":[{"path":"src/components/CellGrid/state/viewport.ts","kind":"import-statement","original":"../state/viewport"}],"format":"esm"},"src/components/CellGrid/render/static-layer.ts":{"bytes":10313,"imports":[{"path":"src/components/CellGrid/state/viewport.ts","kind":"import-statement","original":"../state/viewport"}],"format":"esm"},"src/components/CellGrid/render/index.ts":{"bytes":489,"imports":[{"path":"src/components/CellGrid/render/overlay-layer.ts","kind":"import-statement","original":"./overlay-layer"},{"path":"src/components/CellGrid/render/static-layer.ts","kind":"import-statement","original":"./static-layer"}],"format":"esm"},"src/components/CellGrid/CellGrid.tsx":{"bytes":30497,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/components/CellGrid/headers/index.ts","kind":"import-statement","original":"./headers"},{"path":"src/components/CellGrid/input/index.ts","kind":"import-statement","original":"./input"},{"path":"src/components/CellGrid/render/index.ts","kind":"import-statement","original":"./render"}],"format":"esm"},"src/components/CellGrid/state/atoms.ts":{"bytes":4299,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true}],"format":"esm"},"src/components/CellGrid/state/types.ts":{"bytes":1336,"imports":[],"format":"esm"},"src/components/CellGrid/state/index.ts":{"bytes":538,"imports":[{"path":"src/components/CellGrid/state/atoms.ts","kind":"import-statement","original":"./atoms"},{"path":"src/components/CellGrid/state/types.ts","kind":"import-statement","original":"./types"},{"path":"src/components/CellGrid/state/viewport.ts","kind":"import-statement","original":"./viewport"}],"format":"esm"},"src/components/CellGrid/index.ts":{"bytes":707,"imports":[{"path":"src/components/CellGrid/CellGrid.tsx","kind":"import-statement","original":"./CellGrid"},{"path":"src/components/CellGrid/headers/index.ts","kind":"import-statement","original":"./headers"},{"path":"src/components/CellGrid/input/index.ts","kind":"import-statement","original":"./input"},{"path":"src/components/CellGrid/render/index.ts","kind":"import-statement","original":"./render"},{"path":"src/components/CellGrid/state/index.ts","kind":"import-statement","original":"./state"}],"format":"esm"},"src/components/FPS.tsx":{"bytes":8820,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/Grid/Grid.tsx":{"bytes":9149,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/hooks/index.ts","kind":"import-statement","original":"../../hooks"},{"path":"src/util/index.ts","kind":"import-statement","original":"../../util"}],"format":"esm"},"src/components/Grid/index.ts":{"bytes":368,"imports":[{"path":"src/components/Grid/Grid.tsx","kind":"import-statement","original":"./Grid"}],"format":"esm"},"src/components/index.ts":{"bytes":613,"imports":[{"path":"src/components/Canvas/index.ts","kind":"import-statement","original":"./Canvas"},{"path":"src/components/CellGrid/index.ts","kind":"import-statement","original":"./CellGrid"},{"path":"src/components/FPS.tsx","kind":"import-statement","original":"./FPS"},{"path":"src/components/Grid/index.ts","kind":"import-statement","original":"./Grid"}],"format":"esm"},"src/types.ts":{"bytes":1615,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":620,"imports":[{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/util/index.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93552},"dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"d3","kind":"import-statement","external":true},{"path":"transformation-matrix","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"bind-event-listener","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"bind-event-listener","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["Arrow","Canvas","CanvasContext","CellGrid","DATA_TEST_ID","Dimension","FPS","Grid","GridComponent","GridPattern","Marker","Markers","Point","ProjectionMapper","Rect","Ruler","TrackHeader","attachPointerHandlers","attachWheelHandlers","cellKey","cellWidth","createCellGridAtoms","createPath","defaultOrigin","defaultViewport","drawCells","drawOverlay","getRelativePoint","getZoomTransform","hitTestCell","inspectElement","screenToWorld","testId","toggleCell","useCanvasContext","useDrag","useWheel","visibleCellRange","visibleCells","worldToScreen","zoomInPlace","zoomTo"],"entryPoint":"src/index.ts","inputs":{"src/components/Canvas/Canvas.tsx":{"bytesInOutput":1982},"src/hooks/projection.tsx":{"bytesInOutput":2203},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useCanvasContext.tsx":{"bytesInOutput":260},"src/hooks/useDrag.tsx":{"bytesInOutput":1670},"src/hooks/useWheel.tsx":{"bytesInOutput":1585},"src/util/svg.tsx":{"bytesInOutput":2730},"src/util/index.ts":{"bytesInOutput":0},"src/util/util.ts":{"bytesInOutput":800},"src/components/Canvas/index.ts":{"bytesInOutput":0},"src/components/index.ts":{"bytesInOutput":0},"src/components/CellGrid/CellGrid.tsx":{"bytesInOutput":7250},"src/components/CellGrid/headers/Ruler.tsx":{"bytesInOutput":1605},"src/components/CellGrid/state/viewport.ts":{"bytesInOutput":1850},"src/components/CellGrid/headers/index.ts":{"bytesInOutput":0},"src/components/CellGrid/headers/TrackHeader.tsx":{"bytesInOutput":1353},"src/components/CellGrid/input/pointer.ts":{"bytesInOutput":4331},"src/components/CellGrid/input/index.ts":{"bytesInOutput":0},"src/components/CellGrid/input/wheel.ts":{"bytesInOutput":1628},"src/components/CellGrid/render/overlay-layer.ts":{"bytesInOutput":1414},"src/components/CellGrid/render/index.ts":{"bytesInOutput":0},"src/components/CellGrid/render/static-layer.ts":{"bytesInOutput":1734},"src/components/CellGrid/index.ts":{"bytesInOutput":0},"src/components/CellGrid/state/atoms.ts":{"bytesInOutput":547},"src/components/CellGrid/state/index.ts":{"bytesInOutput":0},"src/components/FPS.tsx":{"bytesInOutput":2082},"src/components/Grid/Grid.tsx":{"bytesInOutput":2164},"src/components/Grid/index.ts":{"bytesInOutput":0},"src/index.ts":{"bytesInOutput":0},"src/types.ts":{"bytesInOutput":240}},"bytes":38930}}}
|