@arronqzy/react-view 1.0.13 → 1.0.15

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.
Files changed (29) hide show
  1. package/dist/styles.css +96 -4
  2. package/package.json +11 -10
  3. package/src/panel/ReactViewOnlinePreview.tsx +31 -2
  4. package/src/panel/ReactViewPanel.tsx +186 -124
  5. package/src/panel/ai/applyAssistantAction.ts +1 -0
  6. package/src/panel/components/BusyOverlay.tsx +25 -0
  7. package/src/panel/components/ElementsLayer.tsx +110 -68
  8. package/src/panel/components/MaterialSidebar.tsx +15 -0
  9. package/src/panel/components/MoveableLayer.tsx +8 -0
  10. package/src/panel/components/PanelCanvas.tsx +3 -0
  11. package/src/panel/components/PanelConfigSidebar.tsx +140 -91
  12. package/src/panel/components/SelectLayer.tsx +5 -0
  13. package/src/panel/components/WorkspaceConfigSidebar.tsx +1 -0
  14. package/src/panel/components/WorkspaceProjectNav.tsx +27 -4
  15. package/src/panel/components/config/PanelConfigScene3dSection.tsx +874 -0
  16. package/src/panel/components/scope-config/ScopeTemplateAutocompleteHost.tsx +1 -2
  17. package/src/panel/components/table/PanelConfigTableSection.tsx +82 -50
  18. package/src/panel/components/table/TableNodeContent.tsx +40 -15
  19. package/src/panel/hooks/usePanelElements.ts +13 -1
  20. package/src/panel/hooks/useWorkspaceProjects.ts +133 -66
  21. package/src/panel/library/workspace-project-cache.ts +8 -2
  22. package/src/panel/library/workspace-project-db.ts +29 -11
  23. package/src/panel/library/workspace-snapshot.ts +21 -4
  24. package/src/panel/scope/view-scope-store.ts +8 -0
  25. package/src/panel/types.ts +4 -3
  26. package/src/panel/utils/async-work.ts +178 -0
  27. package/src/panel/utils/gridPlacement.ts +29 -0
  28. package/src/panel/utils/panelElementDefaults.ts +37 -1
  29. package/src/panel/utils/scope-autocomplete.ts +0 -114
package/dist/styles.css CHANGED
@@ -629,6 +629,10 @@ video {
629
629
  bottom: 0px;
630
630
  }
631
631
 
632
+ .bottom-1\.5 {
633
+ bottom: 0.375rem;
634
+ }
635
+
632
636
  .bottom-\[var\(--rv-ruler-size\)\] {
633
637
  bottom: var(--rv-ruler-size);
634
638
  }
@@ -1002,6 +1006,10 @@ video {
1002
1006
  min-height: 140px;
1003
1007
  }
1004
1008
 
1009
+ .min-h-\[64px\] {
1010
+ min-height: 64px;
1011
+ }
1012
+
1005
1013
  .min-h-\[68px\] {
1006
1014
  min-height: 68px;
1007
1015
  }
@@ -1178,6 +1186,10 @@ video {
1178
1186
  max-width: 32rem;
1179
1187
  }
1180
1188
 
1189
+ .max-w-sm {
1190
+ max-width: 24rem;
1191
+ }
1192
+
1181
1193
  .max-w-xs {
1182
1194
  max-width: 20rem;
1183
1195
  }
@@ -1238,6 +1250,16 @@ video {
1238
1250
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
1239
1251
  }
1240
1252
 
1253
+ @keyframes spin {
1254
+ to {
1255
+ transform: rotate(360deg);
1256
+ }
1257
+ }
1258
+
1259
+ .animate-spin {
1260
+ animation: spin 1s linear infinite;
1261
+ }
1262
+
1241
1263
  .cursor-crosshair {
1242
1264
  cursor: crosshair;
1243
1265
  }
@@ -1623,6 +1645,11 @@ video {
1623
1645
  border-color: hsl(var(--foreground) / 0.8);
1624
1646
  }
1625
1647
 
1648
+ .border-gray-300 {
1649
+ --tw-border-opacity: 1;
1650
+ border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
1651
+ }
1652
+
1626
1653
  .border-primary\/25 {
1627
1654
  border-color: hsl(var(--primary) / 0.25);
1628
1655
  }
@@ -1668,6 +1695,10 @@ video {
1668
1695
  border-color: rgb(124 58 237 / var(--tw-border-opacity, 1));
1669
1696
  }
1670
1697
 
1698
+ .border-white\/30 {
1699
+ border-color: rgb(255 255 255 / 0.3);
1700
+ }
1701
+
1671
1702
  .border-white\/5 {
1672
1703
  border-color: rgb(255 255 255 / 0.05);
1673
1704
  }
@@ -1680,10 +1711,20 @@ video {
1680
1711
  border-left-color: hsl(var(--primary) / 0.85);
1681
1712
  }
1682
1713
 
1714
+ .border-t-gray-700 {
1715
+ --tw-border-opacity: 1;
1716
+ border-top-color: rgb(55 65 81 / var(--tw-border-opacity, 1));
1717
+ }
1718
+
1683
1719
  .border-t-transparent {
1684
1720
  border-top-color: transparent;
1685
1721
  }
1686
1722
 
1723
+ .border-t-white {
1724
+ --tw-border-opacity: 1;
1725
+ border-top-color: rgb(255 255 255 / var(--tw-border-opacity, 1));
1726
+ }
1727
+
1687
1728
  .bg-\[\#0c1220\] {
1688
1729
  --tw-bg-opacity: 1;
1689
1730
  background-color: rgb(12 18 32 / var(--tw-bg-opacity, 1));
@@ -1744,6 +1785,10 @@ video {
1744
1785
  background-color: hsl(var(--background) / 0.95);
1745
1786
  }
1746
1787
 
1788
+ .bg-black\/45 {
1789
+ background-color: rgb(0 0 0 / 0.45);
1790
+ }
1791
+
1747
1792
  .bg-black\/55 {
1748
1793
  background-color: rgb(0 0 0 / 0.55);
1749
1794
  }
@@ -1845,10 +1890,6 @@ video {
1845
1890
  background-color: hsl(var(--primary) / 0.15);
1846
1891
  }
1847
1892
 
1848
- .bg-primary\/20 {
1849
- background-color: hsl(var(--primary) / 0.2);
1850
- }
1851
-
1852
1893
  .bg-primary\/35 {
1853
1894
  background-color: hsl(var(--primary) / 0.35);
1854
1895
  }
@@ -1901,6 +1942,11 @@ video {
1901
1942
  background-color: rgb(14 165 233 / 0.15);
1902
1943
  }
1903
1944
 
1945
+ .bg-sky-600 {
1946
+ --tw-bg-opacity: 1;
1947
+ background-color: rgb(2 132 199 / var(--tw-bg-opacity, 1));
1948
+ }
1949
+
1904
1950
  .bg-transparent {
1905
1951
  background-color: transparent;
1906
1952
  }
@@ -2150,6 +2196,15 @@ video {
2150
2196
  padding-bottom: 1.75rem;
2151
2197
  }
2152
2198
 
2199
+ .py-px {
2200
+ padding-top: 1px;
2201
+ padding-bottom: 1px;
2202
+ }
2203
+
2204
+ .pb-1 {
2205
+ padding-bottom: 0.25rem;
2206
+ }
2207
+
2153
2208
  .pb-1\.5 {
2154
2209
  padding-bottom: 0.375rem;
2155
2210
  }
@@ -2266,6 +2321,10 @@ video {
2266
2321
  font-size: 20px;
2267
2322
  }
2268
2323
 
2324
+ .text-\[9px\] {
2325
+ font-size: 9px;
2326
+ }
2327
+
2269
2328
  .text-sm {
2270
2329
  font-size: 0.875rem;
2271
2330
  line-height: 1.25rem;
@@ -2420,11 +2479,20 @@ video {
2420
2479
  color: rgb(125 211 252 / var(--tw-text-opacity, 1));
2421
2480
  }
2422
2481
 
2482
+ .text-sky-600 {
2483
+ --tw-text-opacity: 1;
2484
+ color: rgb(2 132 199 / var(--tw-text-opacity, 1));
2485
+ }
2486
+
2423
2487
  .text-sky-700 {
2424
2488
  --tw-text-opacity: 1;
2425
2489
  color: rgb(3 105 161 / var(--tw-text-opacity, 1));
2426
2490
  }
2427
2491
 
2492
+ .text-sky-800\/90 {
2493
+ color: rgb(7 89 133 / 0.9);
2494
+ }
2495
+
2428
2496
  .text-slate-300 {
2429
2497
  --tw-text-opacity: 1;
2430
2498
  color: rgb(203 213 225 / var(--tw-text-opacity, 1));
@@ -2478,6 +2546,10 @@ video {
2478
2546
  opacity: 0.45;
2479
2547
  }
2480
2548
 
2549
+ .opacity-50 {
2550
+ opacity: 0.5;
2551
+ }
2552
+
2481
2553
  .opacity-60 {
2482
2554
  opacity: 0.6;
2483
2555
  }
@@ -2563,6 +2635,10 @@ video {
2563
2635
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
2564
2636
  }
2565
2637
 
2638
+ .ring-inset {
2639
+ --tw-ring-inset: inset;
2640
+ }
2641
+
2566
2642
  .ring-blue-500\/90 {
2567
2643
  --tw-ring-color: rgb(59 130 246 / 0.9);
2568
2644
  }
@@ -2579,6 +2655,10 @@ video {
2579
2655
  --tw-ring-color: hsl(var(--primary) / 0.2);
2580
2656
  }
2581
2657
 
2658
+ .ring-primary\/40 {
2659
+ --tw-ring-color: hsl(var(--primary) / 0.4);
2660
+ }
2661
+
2582
2662
  .ring-primary\/45 {
2583
2663
  --tw-ring-color: hsl(var(--primary) / 0.45);
2584
2664
  }
@@ -2587,6 +2667,10 @@ video {
2587
2667
  --tw-ring-color: hsl(var(--primary) / 0.5);
2588
2668
  }
2589
2669
 
2670
+ .ring-sky-400\/50 {
2671
+ --tw-ring-color: rgb(56 189 248 / 0.5);
2672
+ }
2673
+
2590
2674
  .ring-offset-0 {
2591
2675
  --tw-ring-offset-width: 0px;
2592
2676
  }
@@ -2779,6 +2863,10 @@ video {
2779
2863
  color: hsl(var(--muted-foreground));
2780
2864
  }
2781
2865
 
2866
+ .last\:border-b-0:last-child {
2867
+ border-bottom-width: 0px;
2868
+ }
2869
+
2782
2870
  .focus-within\:border-sky-500\/40:focus-within {
2783
2871
  border-color: rgb(14 165 233 / 0.4);
2784
2872
  }
@@ -2827,6 +2915,10 @@ video {
2827
2915
  background-color: hsl(var(--muted) / 0.35);
2828
2916
  }
2829
2917
 
2918
+ .hover\:bg-muted\/70:hover {
2919
+ background-color: hsl(var(--muted) / 0.7);
2920
+ }
2921
+
2830
2922
  .hover\:bg-primary\/90:hover {
2831
2923
  background-color: hsl(var(--primary) / 0.9);
2832
2924
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arronqzy/react-view",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "files": [
5
5
  "src",
6
6
  "dist",
@@ -30,13 +30,14 @@
30
30
  "@codemirror/lang-json": "^6.0.1",
31
31
  "@codemirror/theme-one-dark": "^6.1.2",
32
32
  "@codemirror/view": "^6.36.2",
33
- "@arronqzy/ui": "1.0.5",
34
- "@arronqzy/react-blueprint": "1.0.7",
35
- "@arronqzy/view-table": "0.1.3",
36
- "@arronqzy/rx-store": "1.0.4",
37
- "@arronqzy/webllm-assistant": "0.1.7",
38
- "@arronqzy/blueprint-dsl": "1.0.6",
39
- "@arronqzy/i18n": "0.1.5"
33
+ "@arronqzy/ui": "1.0.6",
34
+ "@arronqzy/blueprint-dsl": "1.0.8",
35
+ "@arronqzy/i18n": "0.1.7",
36
+ "@arronqzy/react-blueprint": "1.0.9",
37
+ "@arronqzy/view-scene3d": "0.1.2",
38
+ "@arronqzy/rx-store": "1.0.5",
39
+ "@arronqzy/view-table": "0.1.5",
40
+ "@arronqzy/webllm-assistant": "0.1.9"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@types/react": "^19.0.1",
@@ -45,8 +46,8 @@
45
46
  "eslint": "^8.57.0",
46
47
  "typescript": "^5.5.4",
47
48
  "@arronqzy/eslint-config": "0.0.0",
48
- "@arronqzy/typescript-config": "1.0.0",
49
- "@arronqzy/tailwind": "1.0.2"
49
+ "@arronqzy/tailwind": "1.0.2",
50
+ "@arronqzy/typescript-config": "1.0.0"
50
51
  },
51
52
  "scripts": {
52
53
  "lint": "eslint \"src/**/*.{ts,tsx}\"",
@@ -7,8 +7,11 @@ import {
7
7
  listBlueprintLibrary,
8
8
  useBlueprintPageLifecycle,
9
9
  type BlueprintLibraryListItem,
10
+ resolveRunnableNodeType,
11
+ resolveViewElementIds,
10
12
  } from "@arronqzy/react-blueprint";
11
13
  import type { LibraryBlueprintResolver, PageLifecyclePhase } from "@arronqzy/blueprint-dsl";
14
+ import { collectArmedViewEventBindings, EVENT_NODE_TYPE, LIFECYCLE_NODE_TYPE } from "@arronqzy/blueprint-dsl";
12
15
  import type { State } from "@arronqzy/rx-store";
13
16
  import { ElementsLayer } from "./components/ElementsLayer";
14
17
  import type { TableCellActionHandler } from "./components/table/TableNodeContent";
@@ -248,7 +251,7 @@ export function ReactViewOnlinePreview({
248
251
  const lifecycleReady =
249
252
  !!panelState && layerElements.length > 0 && layoutReady;
250
253
 
251
- const { triggerBlueprintNode } = useBlueprintPageLifecycle({
254
+ const { triggerBlueprintNode, emitViewEvent, firedLifecyclePhases } = useBlueprintPageLifecycle({
252
255
  graph: blueprintGraph,
253
256
  active: true,
254
257
  enabled: lifecycleReady,
@@ -275,6 +278,29 @@ export function ReactViewOnlinePreview({
275
278
  },
276
279
  [triggerBlueprintNode]
277
280
  );
281
+ const boundViewEventTypes = useMemo(
282
+ () =>
283
+ collectArmedViewEventBindings(
284
+ blueprintGraph.document.nodes.map((node) => ({
285
+ id: node.id,
286
+ nodeType: resolveRunnableNodeType(node),
287
+ lifecyclePhase: node.lifecyclePhase,
288
+ viewElementIds: resolveViewElementIds(node),
289
+ eventConfig: node.eventConfig,
290
+ })),
291
+ blueprintGraph.document.edges,
292
+ EVENT_NODE_TYPE,
293
+ LIFECYCLE_NODE_TYPE,
294
+ firedLifecyclePhases
295
+ ),
296
+ [blueprintGraph.document.nodes, blueprintGraph.document.edges, firedLifecyclePhases]
297
+ );
298
+ const onViewUiEvent = useCallback(
299
+ (payload: Parameters<typeof emitViewEvent>[0]) => {
300
+ void emitViewEvent(payload);
301
+ },
302
+ [emitViewEvent]
303
+ );
278
304
  if (loadError) {
279
305
  return (
280
306
  <div className="flex min-h-[100vh] w-full items-center justify-center bg-white px-6 text-center text-sm text-gray-600">
@@ -285,7 +311,8 @@ export function ReactViewOnlinePreview({
285
311
 
286
312
  if (!panelState) {
287
313
  return (
288
- <div className="flex min-h-[100vh] w-full items-center justify-center bg-white text-sm text-gray-600">
314
+ <div className="flex min-h-[100vh] w-full flex-col items-center justify-center gap-3 bg-white text-sm text-gray-600">
315
+ <div className="h-9 w-9 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700" />
289
316
  {t("panel.workspace.previewLoading")}
290
317
  </div>
291
318
  );
@@ -342,6 +369,8 @@ export function ReactViewOnlinePreview({
342
369
  previewMode
343
370
  previewLayoutKey={layoutRevision}
344
371
  onTableCellAction={onTableCellAction}
372
+ boundViewEventTypes={boundViewEventTypes}
373
+ onViewUiEvent={onViewUiEvent}
345
374
  />
346
375
  </div>
347
376
  </div>