@dxos/react-ui-canvas 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +5 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +5 -5
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Grid/Grid.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/src/components/Canvas/Canvas.stories.tsx +5 -5
- package/src/components/Canvas/Canvas.tsx +2 -2
- package/src/components/FPS.tsx +2 -2
- package/src/components/Grid/Grid.stories.tsx +2 -2
- package/src/components/Grid/Grid.tsx +1 -5
- package/src/util/svg.stories.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bcb3aa67d6",
|
|
4
4
|
"description": "A canvas component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -33,30 +33,30 @@
|
|
|
33
33
|
"d3": "^7.9.0",
|
|
34
34
|
"react-resize-detector": "^11.0.1",
|
|
35
35
|
"transformation-matrix": "^2.16.1",
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/util": "0.8.4-main.
|
|
36
|
+
"@dxos/invariant": "0.8.4-main.bcb3aa67d6",
|
|
37
|
+
"@dxos/log": "0.8.4-main.bcb3aa67d6",
|
|
38
|
+
"@dxos/debug": "0.8.4-main.bcb3aa67d6",
|
|
39
|
+
"@dxos/util": "0.8.4-main.bcb3aa67d6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/d3": "^7.4.3",
|
|
43
43
|
"@types/react": "~19.2.7",
|
|
44
44
|
"@types/react-dom": "~19.2.3",
|
|
45
|
-
"effect": "3.
|
|
45
|
+
"effect": "3.20.0",
|
|
46
46
|
"react": "~19.2.3",
|
|
47
47
|
"react-dom": "~19.2.3",
|
|
48
|
-
"vite": "7.1.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
52
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
48
|
+
"vite": "^7.1.11",
|
|
49
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
50
|
+
"@dxos/random": "0.8.4-main.bcb3aa67d6",
|
|
51
|
+
"@dxos/storybook-utils": "0.8.4-main.bcb3aa67d6",
|
|
52
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"effect": "3.
|
|
55
|
+
"effect": "3.20.0",
|
|
56
56
|
"react": "~19.2.3",
|
|
57
57
|
"react-dom": "~19.2.3",
|
|
58
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
59
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
58
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
59
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
9
9
|
|
|
10
10
|
import { useCanvasContext, useDrag, useWheel } from '../../hooks';
|
|
11
11
|
import { type Point } from '../../types';
|
|
@@ -32,14 +32,14 @@ const DefaultStory = (props: GridProps) => {
|
|
|
32
32
|
|
|
33
33
|
const TwoCanvases = (props: GridProps) => {
|
|
34
34
|
return (
|
|
35
|
-
<div className='grid grid-cols-2 gap-2
|
|
36
|
-
<div className='
|
|
35
|
+
<div className='grid grid-cols-2 gap-2 h-full w-full'>
|
|
36
|
+
<div className='h-full relative'>
|
|
37
37
|
<Canvas>
|
|
38
38
|
<Grid {...props} />
|
|
39
39
|
<Content />
|
|
40
40
|
</Canvas>
|
|
41
41
|
</div>
|
|
42
|
-
<div className='
|
|
42
|
+
<div className='h-full relative'>
|
|
43
43
|
<Canvas>
|
|
44
44
|
<Grid {...props} />
|
|
45
45
|
<Content />
|
|
@@ -92,7 +92,7 @@ const meta = {
|
|
|
92
92
|
title: 'ui/react-ui-canvas/Canvas',
|
|
93
93
|
component: Grid,
|
|
94
94
|
render: DefaultStory,
|
|
95
|
-
decorators: [withTheme],
|
|
95
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
96
96
|
parameters: {
|
|
97
97
|
layout: 'fullscreen',
|
|
98
98
|
},
|
|
@@ -30,7 +30,7 @@ export type CanvasProps = ThemedClassName<PropsWithChildren<Partial<ProjectionSt
|
|
|
30
30
|
* Manages CSS projection.
|
|
31
31
|
*/
|
|
32
32
|
export const Canvas = forwardRef<CanvasController, CanvasProps>(
|
|
33
|
-
({ children, classNames, scale:
|
|
33
|
+
({ children, classNames, scale: scaleProp = 1, offset: offsetProp = defaultOrigin, ...props }, forwardedRef) => {
|
|
34
34
|
// Size.
|
|
35
35
|
const { ref, width = 0, height = 0 } = useResizeDetector();
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ export const Canvas = forwardRef<CanvasController, CanvasProps>(
|
|
|
38
38
|
const [ready, setReady] = useState(false);
|
|
39
39
|
|
|
40
40
|
// Projection.
|
|
41
|
-
const [{ scale, offset }, setProjection] = useState<ProjectionState>({ scale:
|
|
41
|
+
const [{ scale, offset }, setProjection] = useState<ProjectionState>({ scale: scaleProp, offset: offsetProp });
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
if (width && height && offset === defaultOrigin) {
|
|
44
44
|
setProjection({ scale, offset: { x: width / 2, y: height / 2 } });
|
package/src/components/FPS.tsx
CHANGED
|
@@ -73,12 +73,12 @@ export const FPS = ({ classNames, width = 60, height = 30, bar = 'bg-cyan-500' }
|
|
|
73
73
|
style={{ width: width + 6 }}
|
|
74
74
|
className={mx(
|
|
75
75
|
'relative flex flex-col p-0.5',
|
|
76
|
-
'bg-
|
|
76
|
+
'bg-base-surface text-xs text-subdued font-thin pointer-events-none border border-separator',
|
|
77
77
|
classNames,
|
|
78
78
|
)}
|
|
79
79
|
>
|
|
80
80
|
<div>{fps[len - 1]} FPS</div>
|
|
81
|
-
<div className='
|
|
81
|
+
<div className='w-full relative' style={{ height }}>
|
|
82
82
|
{fps.map((frame, i) => (
|
|
83
83
|
<div
|
|
84
84
|
key={`fps-${i}`}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
9
9
|
|
|
10
10
|
import { type ProjectionState } from '../../hooks';
|
|
11
11
|
|
|
@@ -26,7 +26,7 @@ const meta = {
|
|
|
26
26
|
title: 'ui/react-ui-canvas/Grid',
|
|
27
27
|
component: GridComponent,
|
|
28
28
|
render: DefaultStory,
|
|
29
|
-
decorators: [withTheme],
|
|
29
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
30
30
|
parameters: {
|
|
31
31
|
layout: 'fullscreen',
|
|
32
32
|
},
|
|
@@ -54,11 +54,7 @@ export const GridComponent = forwardRef<SVGSVGElement, GridProps>(
|
|
|
54
54
|
<svg
|
|
55
55
|
{...testId('dx-canvas-grid')}
|
|
56
56
|
ref={svgRef}
|
|
57
|
-
className={mx(
|
|
58
|
-
'absolute inset-0 is-full bs-full pointer-events-none touch-none select-none',
|
|
59
|
-
'stroke-neutral-500',
|
|
60
|
-
classNames,
|
|
61
|
-
)}
|
|
57
|
+
className={mx('dx-fullscreen pointer-events-none touch-none select-none', 'stroke-neutral-500', classNames)}
|
|
62
58
|
>
|
|
63
59
|
{/* NOTE: The pattern is offset so that the middle of the pattern aligns with the grid. */}
|
|
64
60
|
<defs>
|
package/src/util/svg.stories.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { Arrow, createPath } from './svg';
|
|
|
11
11
|
import { testId } from './util';
|
|
12
12
|
|
|
13
13
|
const DefaultStory = () => (
|
|
14
|
-
<svg className='border border-separator
|
|
14
|
+
<svg className='border border-separator w-[30rem] h-[400px]'>
|
|
15
15
|
<defs>
|
|
16
16
|
<Arrow id='arrow-start' classNames='fill-none stroke-red-500' dir='start' />
|
|
17
17
|
<Arrow id='arrow-end' classNames='fill-none stroke-red-500' dir='end' />
|
|
@@ -32,7 +32,7 @@ const DefaultStory = () => (
|
|
|
32
32
|
const meta = {
|
|
33
33
|
title: 'ui/react-ui-canvas/svg',
|
|
34
34
|
render: DefaultStory,
|
|
35
|
-
decorators: [withTheme],
|
|
35
|
+
decorators: [withTheme()],
|
|
36
36
|
parameters: {
|
|
37
37
|
layout: 'centered',
|
|
38
38
|
},
|