@kanaries/graphic-walker 0.2.19 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -1 +1 @@
1
- import "./index.css";
1
+ import './index.css';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanaries/graphic-walker",
3
- "version": "0.2.19",
3
+ "version": "0.3.0",
4
4
  "scripts": {
5
5
  "dev:front_end": "vite --host",
6
6
  "dev": "npm run dev:front_end",
@@ -70,8 +70,8 @@
70
70
  "vite": "^4.1.1"
71
71
  },
72
72
  "peerDependencies": {
73
- "react": "^17.0.2",
74
- "react-dom": "^17.0.2",
73
+ "react": ">=17.0.0 <19.0.0",
74
+ "react-dom": ">=17.0.0 <19.0.0",
75
75
  "styled-components": "^5.3.6"
76
76
  }
77
77
  }
package/src/main.tsx CHANGED
@@ -1,17 +1,39 @@
1
- import React from "react";
2
- import ReactDOM from "react-dom";
3
- import { GraphicWalker } from "./index";
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { GraphicWalker } from './index';
4
4
 
5
- import { inject } from "@vercel/analytics";
6
- import "./index.css";
5
+ import { inject } from '@vercel/analytics';
6
+ import './index.css';
7
7
 
8
8
  if (!import.meta.env.DEV) {
9
9
  inject();
10
10
  }
11
11
 
12
- ReactDOM.render(
13
- <React.StrictMode>
14
- <GraphicWalker themeKey="g2" />
15
- </React.StrictMode>,
16
- document.getElementById("root")
17
- );
12
+ // Example: Detect if Concurrent Mode is available
13
+ const isConcurrentModeAvailable = 'createRoot' in ReactDOM;
14
+ console.log(isConcurrentModeAvailable)
15
+
16
+ // Use the new ReactDOM.createRoot API if available, otherwise fall back to the old ReactDOM.render API
17
+ if (isConcurrentModeAvailable) {
18
+ // @ts-ignore
19
+ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
20
+ root.render(
21
+ <React.StrictMode>
22
+ <GraphicWalker themeKey="g2" />
23
+ </React.StrictMode>
24
+ );
25
+ } else {
26
+ ReactDOM.render(
27
+ <React.StrictMode>
28
+ <GraphicWalker themeKey="g2" />
29
+ </React.StrictMode>,
30
+ document.getElementById('root') as HTMLElement
31
+ );
32
+ }
33
+
34
+ // ReactDOM.render(
35
+ // <React.StrictMode>
36
+ // <GraphicWalker themeKey="g2" />
37
+ // </React.StrictMode>,
38
+ // document.getElementById("root")
39
+ // );
@@ -130,6 +130,7 @@ export class VisSpecWithHistory {
130
130
 
131
131
  public clone () {
132
132
  const nextVSWH = new VisSpecWithHistory(this.frame);
133
+ nextVSWH.snapshots = this.snapshots.slice().map(s => ({ ...s }));
133
134
  nextVSWH.cursor = this.cursor;
134
135
  return nextVSWH;
135
136
  }