@arronqzy/react-view 1.0.28 → 1.0.30
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/package.json +7 -7
- package/src/panel/ReactViewPanel.tsx +52 -8
- package/src/panel/components/ElementsLayer.tsx +178 -106
- package/src/panel/components/MoveableLayer.tsx +40 -3
- package/src/panel/components/PanelConfigSidebar.tsx +32 -0
- package/src/panel/constants/messages.ts +2 -0
- package/src/panel/hooks/usePanelElements.ts +24 -13
- package/src/panel/hooks/useWorkspaceProjects.ts +84 -49
- package/src/panel/library/workspace-project-db.ts +163 -16
- package/src/panel/library/workspace-storage-error.ts +60 -0
- package/src/panel/utils/canvas-interaction-busy.ts +36 -0
- package/src/panel/utils/materializePanelElements.ts +97 -0
- package/src/panel/utils/panelStateIO.ts +22 -2
|
@@ -137,6 +137,26 @@ export function computePanelSceneBounds(elements: PanelElement[]): PanelSceneBou
|
|
|
137
137
|
|
|
138
138
|
export const PREVIEW_LAYOUT_EVENT = "arronqzy-preview-layout";
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
let previewLayoutRaf = 0;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Notify chart/preview hosts that layout changed.
|
|
144
|
+
* Default path is rAF-coalesced (safe during Moveable resize).
|
|
145
|
+
* Pass `{ flush: true }` after resize ends so charts catch the final size.
|
|
146
|
+
*/
|
|
147
|
+
export function notifyPreviewLayoutChanged(options?: { flush?: boolean }) {
|
|
148
|
+
if (typeof window === "undefined") return;
|
|
149
|
+
if (options?.flush) {
|
|
150
|
+
if (previewLayoutRaf) {
|
|
151
|
+
window.cancelAnimationFrame(previewLayoutRaf);
|
|
152
|
+
previewLayoutRaf = 0;
|
|
153
|
+
}
|
|
154
|
+
window.dispatchEvent(new Event(PREVIEW_LAYOUT_EVENT));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (previewLayoutRaf) return;
|
|
158
|
+
previewLayoutRaf = window.requestAnimationFrame(() => {
|
|
159
|
+
previewLayoutRaf = 0;
|
|
160
|
+
window.dispatchEvent(new Event(PREVIEW_LAYOUT_EVENT));
|
|
161
|
+
});
|
|
142
162
|
}
|