@kanaries/graphic-walker 0.3.8 → 0.3.9
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/assets/transform.worker-90e4f506.js.map +1 -1
- package/dist/assets/{viewQuery.worker-03404216.js.map → viewQuery.worker-95bc9cf6.js.map} +1 -1
- package/dist/graphic-walker.es.js +23500 -20603
- package/dist/graphic-walker.es.js.map +1 -1
- package/dist/graphic-walker.umd.js +145 -121
- package/dist/graphic-walker.umd.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/main.d.ts +1 -1
- package/dist/style.css +1 -0
- package/dist/vanilla.d.ts +3 -0
- package/package.json +2 -1
- package/src/index.tsx +2 -0
- package/src/main.tsx +2 -24
- package/src/vanilla.tsx +31 -0
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,7 @@ import "./empty_sheet.css";
|
|
|
4
4
|
export declare const ShadowDomContext: React.Context<{
|
|
5
5
|
root: ShadowRoot | null;
|
|
6
6
|
}>;
|
|
7
|
+
export type { IGWProps };
|
|
8
|
+
export { embedGraphicWalker } from './vanilla';
|
|
7
9
|
export declare const GraphicWalker: React.FC<IGWProps>;
|
|
8
10
|
export { default as PureRenderer } from './renderer/pureRenderer';
|
package/dist/main.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/dist/style.css
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
html{margin:0;padding:0;background-color:#fff}@media (prefers-color-scheme: dark){html{background-color:#18181b}}body{margin:0;padding:0}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanaries/graphic-walker",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev:front_end": "vite --host",
|
|
6
6
|
"dev": "npm run dev:front_end",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@headlessui/react": "^1.7.12",
|
|
38
38
|
"@heroicons/react": "^2.0.8",
|
|
39
|
+
"@kanaries/graphic-walker": "0.3.9",
|
|
39
40
|
"@kanaries/react-beautiful-dnd": "0.0.1",
|
|
40
41
|
"@kanaries/web-data-loader": "^0.1.7",
|
|
41
42
|
"autoprefixer": "^10.3.5",
|
package/src/index.tsx
CHANGED
|
@@ -12,6 +12,8 @@ import tailwindStyle from "tailwindcss/tailwind.css?inline";
|
|
|
12
12
|
import style from "./index.css?inline";
|
|
13
13
|
|
|
14
14
|
export const ShadowDomContext = createContext<{ root: ShadowRoot | null }>({ root: null });
|
|
15
|
+
export type { IGWProps }
|
|
16
|
+
export { embedGraphicWalker } from './vanilla';
|
|
15
17
|
|
|
16
18
|
export const GraphicWalker: React.FC<IGWProps> = observer((props) => {
|
|
17
19
|
const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);
|
package/src/main.tsx
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import { GraphicWalker } from './index';
|
|
4
|
-
|
|
5
1
|
import { inject } from '@vercel/analytics';
|
|
6
|
-
import './
|
|
2
|
+
import { embedGraphicWalker } from './vanilla';
|
|
7
3
|
|
|
8
4
|
if (!import.meta.env.DEV) {
|
|
9
5
|
inject();
|
|
10
6
|
}
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
const isConcurrentModeAvailable = 'createRoot' in ReactDOM;
|
|
14
|
-
|
|
15
|
-
// Use the new ReactDOM.createRoot API if available, otherwise fall back to the old ReactDOM.render API
|
|
16
|
-
if (isConcurrentModeAvailable) {
|
|
17
|
-
if (import.meta.env.DEV) {
|
|
18
|
-
console.warn('React 18+ detected, remove strict mode if you meet drag and drop issue. more info at https://docs.kanaries.net/graphic-walker/faq/graphic-walker-react-18')
|
|
19
|
-
}
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
22
|
-
root.render(<GraphicWalker themeKey="g2" />);
|
|
23
|
-
} else {
|
|
24
|
-
ReactDOM.render(
|
|
25
|
-
<React.StrictMode>
|
|
26
|
-
<GraphicWalker themeKey="g2" />
|
|
27
|
-
</React.StrictMode>,
|
|
28
|
-
document.getElementById('root') as HTMLElement
|
|
29
|
-
);
|
|
30
|
-
}
|
|
8
|
+
embedGraphicWalker(document.getElementById('root') as HTMLElement)
|
package/src/vanilla.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { GraphicWalker } from './index';
|
|
4
|
+
|
|
5
|
+
import './index.css';
|
|
6
|
+
import { IGWProps } from './App';
|
|
7
|
+
|
|
8
|
+
export function embedGraphicWalker (dom: HTMLElement | null, props: IGWProps | undefined = {}) {
|
|
9
|
+
if (!dom) {
|
|
10
|
+
throw("DOM element not found.")
|
|
11
|
+
}
|
|
12
|
+
// Example: Detect if Concurrent Mode is available
|
|
13
|
+
const isConcurrentModeAvailable = 'createRoot' in ReactDOM;
|
|
14
|
+
|
|
15
|
+
// Use the new ReactDOM.createRoot API if available, otherwise fall back to the old ReactDOM.render API
|
|
16
|
+
if (isConcurrentModeAvailable) {
|
|
17
|
+
if (import.meta.env.DEV) {
|
|
18
|
+
console.warn('React 18+ detected, remove strict mode if you meet drag and drop issue. more info at https://docs.kanaries.net/graphic-walker/faq/graphic-walker-react-18')
|
|
19
|
+
}
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
const root = ReactDOM.createRoot(dom as HTMLElement);
|
|
22
|
+
root.render(<GraphicWalker themeKey="g2" {...props} />);
|
|
23
|
+
} else {
|
|
24
|
+
ReactDOM.render(
|
|
25
|
+
<React.StrictMode>
|
|
26
|
+
<GraphicWalker themeKey="g2" {...props} />
|
|
27
|
+
</React.StrictMode>,
|
|
28
|
+
dom as HTMLElement
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|