@dxos/react-ui-canvas 0.8.4-main.fd6878d → 0.8.4-main.fffef41
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 +4 -4
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +4 -4
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Canvas/Canvas.stories.d.ts +12 -4
- package/dist/types/src/components/Canvas/Canvas.stories.d.ts.map +1 -1
- package/dist/types/src/components/Grid/Grid.stories.d.ts +19 -4
- package/dist/types/src/components/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/svg.stories.d.ts +12 -4
- package/dist/types/src/util/svg.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/components/Canvas/Canvas.stories.tsx +11 -10
- package/src/components/FPS.tsx +2 -2
- package/src/components/Grid/Grid.stories.tsx +9 -8
- package/src/components/Grid/Grid.tsx +1 -1
- package/src/types.ts +1 -1
- package/src/util/svg.stories.tsx +8 -8
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.fffef41",
|
|
4
4
|
"description": "A canvas component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -25,36 +25,36 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@preact-signals/safe-react": "^0.9.0",
|
|
28
|
-
"@preact/signals-core": "^1.
|
|
28
|
+
"@preact/signals-core": "^1.12.1",
|
|
29
29
|
"@radix-ui/react-context": "1.1.1",
|
|
30
30
|
"bind-event-listener": "^3.0.0",
|
|
31
31
|
"d3": "^7.9.0",
|
|
32
32
|
"react-resize-detector": "^11.0.1",
|
|
33
33
|
"transformation-matrix": "^2.16.1",
|
|
34
|
-
"@dxos/debug": "0.8.4-main.
|
|
35
|
-
"@dxos/invariant": "0.8.4-main.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
34
|
+
"@dxos/debug": "0.8.4-main.fffef41",
|
|
35
|
+
"@dxos/invariant": "0.8.4-main.fffef41",
|
|
36
|
+
"@dxos/util": "0.8.4-main.fffef41",
|
|
37
|
+
"@dxos/log": "0.8.4-main.fffef41"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/d3": "^7.4.3",
|
|
41
|
-
"@types/react": "~
|
|
42
|
-
"@types/react-dom": "~
|
|
43
|
-
"effect": "3.
|
|
44
|
-
"react": "~
|
|
45
|
-
"react-dom": "~
|
|
46
|
-
"vite": "
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
41
|
+
"@types/react": "~19.2.2",
|
|
42
|
+
"@types/react-dom": "~19.2.2",
|
|
43
|
+
"effect": "3.18.3",
|
|
44
|
+
"react": "~19.2.0",
|
|
45
|
+
"react-dom": "~19.2.0",
|
|
46
|
+
"vite": "7.1.9",
|
|
47
|
+
"@dxos/random": "0.8.4-main.fffef41",
|
|
48
|
+
"@dxos/react-ui-theme": "0.8.4-main.fffef41",
|
|
49
|
+
"@dxos/react-ui": "0.8.4-main.fffef41",
|
|
50
|
+
"@dxos/storybook-utils": "0.8.4-main.fffef41"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"effect": "3.13.3",
|
|
54
|
-
"react": "
|
|
55
|
-
"react-dom": "
|
|
56
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
57
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
54
|
+
"react": "^19.0.0",
|
|
55
|
+
"react-dom": "^19.0.0",
|
|
56
|
+
"@dxos/react-ui": "0.8.4-main.fffef41",
|
|
57
|
+
"@dxos/react-ui-theme": "0.8.4-main.fffef41"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
|
-
import {
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { useCanvasContext, useWheel } from '../../hooks';
|
|
13
11
|
import { type Point } from '../../types';
|
|
@@ -34,14 +32,14 @@ const DefaultStory = (props: GridProps) => {
|
|
|
34
32
|
|
|
35
33
|
const TwoCanvases = (props: GridProps) => {
|
|
36
34
|
return (
|
|
37
|
-
<div className='grid grid-cols-2 gap-2
|
|
38
|
-
<div className='
|
|
35
|
+
<div className='grid grid-cols-2 gap-2 is-full bs-full'>
|
|
36
|
+
<div className='bs-full relative'>
|
|
39
37
|
<Canvas>
|
|
40
38
|
<Grid {...props} />
|
|
41
39
|
<Content />
|
|
42
40
|
</Canvas>
|
|
43
41
|
</div>
|
|
44
|
-
<div className='
|
|
42
|
+
<div className='bs-full relative'>
|
|
45
43
|
<Canvas>
|
|
46
44
|
<Grid {...props} />
|
|
47
45
|
<Content />
|
|
@@ -89,16 +87,19 @@ const Item = (p: Point) => {
|
|
|
89
87
|
);
|
|
90
88
|
};
|
|
91
89
|
|
|
92
|
-
const meta
|
|
90
|
+
const meta = {
|
|
93
91
|
title: 'ui/react-ui-canvas/Canvas',
|
|
94
92
|
component: Grid,
|
|
95
93
|
render: DefaultStory,
|
|
96
|
-
decorators: [withTheme
|
|
97
|
-
|
|
94
|
+
decorators: [withTheme],
|
|
95
|
+
parameters: {
|
|
96
|
+
layout: 'fullscreen',
|
|
97
|
+
},
|
|
98
|
+
} satisfies Meta<typeof Grid>;
|
|
98
99
|
|
|
99
100
|
export default meta;
|
|
100
101
|
|
|
101
|
-
type Story = StoryObj<
|
|
102
|
+
type Story = StoryObj<typeof meta>;
|
|
102
103
|
|
|
103
104
|
export const Default: Story = {
|
|
104
105
|
args: { size: 16 },
|
package/src/components/FPS.tsx
CHANGED
|
@@ -53,7 +53,7 @@ export const FPS = ({ classNames, width = 60, height = 30, bar = 'bg-cyan-500' }
|
|
|
53
53
|
},
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
const requestRef = useRef<number>();
|
|
56
|
+
const requestRef = useRef<number | null>(null);
|
|
57
57
|
const tick = () => {
|
|
58
58
|
dispatch();
|
|
59
59
|
requestRef.current = requestAnimationFrame(tick);
|
|
@@ -78,7 +78,7 @@ export const FPS = ({ classNames, width = 60, height = 30, bar = 'bg-cyan-500' }
|
|
|
78
78
|
)}
|
|
79
79
|
>
|
|
80
80
|
<div>{fps[len - 1]} FPS</div>
|
|
81
|
-
<div className='
|
|
81
|
+
<div className='is-full relative' style={{ height }}>
|
|
82
82
|
{fps.map((frame, i) => (
|
|
83
83
|
<div
|
|
84
84
|
key={`fps-${i}`}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useRef, useState } from 'react';
|
|
9
7
|
|
|
10
|
-
import {
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { type ProjectionState } from '../../hooks';
|
|
13
11
|
|
|
@@ -24,16 +22,19 @@ const DefaultStory = (props: GridProps) => {
|
|
|
24
22
|
);
|
|
25
23
|
};
|
|
26
24
|
|
|
27
|
-
const meta
|
|
25
|
+
const meta = {
|
|
28
26
|
title: 'ui/react-ui-canvas/Grid',
|
|
29
27
|
component: GridComponent,
|
|
30
28
|
render: DefaultStory,
|
|
31
|
-
decorators: [withTheme
|
|
32
|
-
|
|
29
|
+
decorators: [withTheme],
|
|
30
|
+
parameters: {
|
|
31
|
+
layout: 'fullscreen',
|
|
32
|
+
},
|
|
33
|
+
} satisfies Meta<typeof GridComponent>;
|
|
33
34
|
|
|
34
35
|
export default meta;
|
|
35
36
|
|
|
36
|
-
type Story = StoryObj<
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
37
38
|
|
|
38
39
|
export const Default: Story = {
|
|
39
40
|
args: {
|
|
@@ -47,7 +47,7 @@ export const GridComponent = forwardRef<SVGSVGElement, GridProps>(
|
|
|
47
47
|
{...testId('dx-canvas-grid')}
|
|
48
48
|
ref={svgRef}
|
|
49
49
|
className={mx(
|
|
50
|
-
'absolute inset-0
|
|
50
|
+
'absolute inset-0 is-full bs-full pointer-events-none touch-none select-none',
|
|
51
51
|
'stroke-neutral-500',
|
|
52
52
|
classNames,
|
|
53
53
|
)}
|
package/src/types.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
export const Point = Schema.Struct({ x: Schema.Number, y: Schema.Number });
|
|
8
8
|
export const Dimension = Schema.Struct({ width: Schema.Number, height: Schema.Number });
|
package/src/util/svg.stories.tsx
CHANGED
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import type { Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
|
-
import { withTheme } from '@dxos/
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { Arrow, createPath } from './svg';
|
|
13
11
|
import { testId } from './util';
|
|
14
12
|
|
|
15
13
|
const DefaultStory = () => (
|
|
16
|
-
<svg className='border border-neutral-500
|
|
14
|
+
<svg className='border border-neutral-500 is-[30rem] bs-[400px]'>
|
|
17
15
|
<defs>
|
|
18
16
|
<Arrow id='arrow-start' classNames='fill-none stroke-red-500' dir='start' />
|
|
19
17
|
<Arrow id='arrow-end' classNames='fill-none stroke-red-500' dir='end' />
|
|
@@ -31,15 +29,17 @@ const DefaultStory = () => (
|
|
|
31
29
|
</svg>
|
|
32
30
|
);
|
|
33
31
|
|
|
34
|
-
const meta
|
|
32
|
+
const meta = {
|
|
35
33
|
title: 'ui/react-ui-canvas/svg',
|
|
36
34
|
render: DefaultStory,
|
|
37
35
|
decorators: [withTheme],
|
|
38
36
|
parameters: {
|
|
39
37
|
layout: 'centered',
|
|
40
38
|
},
|
|
41
|
-
};
|
|
39
|
+
} satisfies Meta;
|
|
42
40
|
|
|
43
41
|
export default meta;
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
type Story = StoryObj<typeof meta>;
|
|
44
|
+
|
|
45
|
+
export const Default: Story = {};
|