@asymmetric-effort/specifyjs 0.2.143 → 0.2.145

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.
@@ -15,6 +15,7 @@ import {
15
15
  useEffect,
16
16
  useId,
17
17
  useMemo,
18
+ useReducer,
18
19
  useRef,
19
20
  useState
20
21
  } from "./esm/chunks/chunk-4V37N6QN.js";
@@ -16452,6 +16453,1797 @@ function TradingDashboard(props) {
16452
16453
  );
16453
16454
  }
16454
16455
 
16456
+ // ../demos/project-manager/src/Toolbar.ts
16457
+ var CARD_COLORS = [
16458
+ "#fef9c3",
16459
+ // yellow
16460
+ "#fecaca",
16461
+ // red
16462
+ "#fed7aa",
16463
+ // orange
16464
+ "#bbf7d0",
16465
+ // green
16466
+ "#bfdbfe",
16467
+ // blue
16468
+ "#ddd6fe",
16469
+ // purple
16470
+ "#fbcfe8",
16471
+ // pink
16472
+ "#e5e7eb"
16473
+ // gray
16474
+ ];
16475
+ function BoardToolbar(props) {
16476
+ const {
16477
+ zoom,
16478
+ gridEnabled,
16479
+ selectedColor,
16480
+ colorFilter,
16481
+ onNewCard,
16482
+ onZoomIn,
16483
+ onZoomOut,
16484
+ onZoomReset,
16485
+ onColorSelect,
16486
+ onColorFilter,
16487
+ onGridToggle,
16488
+ onSearch
16489
+ } = props;
16490
+ const [searchText, setSearchText] = useState("");
16491
+ const handleSearchInput = useCallback((e) => {
16492
+ const value = e.target.value;
16493
+ setSearchText(value);
16494
+ onSearch(value);
16495
+ }, [onSearch]);
16496
+ const toolbarStyle = {
16497
+ display: "flex",
16498
+ alignItems: "center",
16499
+ gap: "8px",
16500
+ padding: "6px 12px",
16501
+ backgroundColor: "rgba(255,255,255,0.95)",
16502
+ borderBottom: "1px solid #e2e8f0",
16503
+ fontSize: "12px",
16504
+ flexShrink: "0",
16505
+ flexWrap: "wrap"
16506
+ };
16507
+ const btnStyle = {
16508
+ padding: "4px 10px",
16509
+ border: "1px solid #d1d5db",
16510
+ borderRadius: "4px",
16511
+ backgroundColor: "#ffffff",
16512
+ cursor: "pointer",
16513
+ fontSize: "12px",
16514
+ color: "#374151",
16515
+ lineHeight: "1.4"
16516
+ };
16517
+ const activeBtnStyle = {
16518
+ ...btnStyle,
16519
+ backgroundColor: "#3b82f6",
16520
+ color: "#ffffff",
16521
+ borderColor: "#3b82f6"
16522
+ };
16523
+ const zoomText = {
16524
+ fontSize: "12px",
16525
+ color: "#64748b",
16526
+ minWidth: "40px",
16527
+ textAlign: "center",
16528
+ cursor: "pointer"
16529
+ };
16530
+ const separatorStyle = {
16531
+ width: "1px",
16532
+ height: "20px",
16533
+ backgroundColor: "#e2e8f0",
16534
+ margin: "0 4px"
16535
+ };
16536
+ const inputStyle = {
16537
+ padding: "4px 8px",
16538
+ border: "1px solid #d1d5db",
16539
+ borderRadius: "4px",
16540
+ fontSize: "12px",
16541
+ width: "120px",
16542
+ outline: "none"
16543
+ };
16544
+ const swatches = CARD_COLORS.map((color) => {
16545
+ const isActive = color === selectedColor;
16546
+ const isFiltered = color === colorFilter;
16547
+ const handleSwatchClick = () => {
16548
+ if (isActive && onColorFilter) {
16549
+ onColorFilter(isFiltered ? null : color);
16550
+ } else {
16551
+ onColorSelect(color);
16552
+ }
16553
+ };
16554
+ let borderStyle = "1px solid rgba(0,0,0,0.15)";
16555
+ if (isFiltered) {
16556
+ borderStyle = "3px solid #ef4444";
16557
+ } else if (isActive) {
16558
+ borderStyle = "2px solid #3b82f6";
16559
+ }
16560
+ return createElement("button", {
16561
+ key: color,
16562
+ style: {
16563
+ width: "18px",
16564
+ height: "18px",
16565
+ borderRadius: "50%",
16566
+ backgroundColor: color,
16567
+ border: borderStyle,
16568
+ cursor: "pointer",
16569
+ padding: "0",
16570
+ flexShrink: "0",
16571
+ opacity: isFiltered ? "1" : colorFilter ? "0.5" : "1"
16572
+ },
16573
+ onClick: handleSwatchClick,
16574
+ "aria-label": isFiltered ? `Clear color filter ${color}` : `Select color ${color}`,
16575
+ "data-testid": `color-swatch-${color}`
16576
+ });
16577
+ });
16578
+ return createElement(
16579
+ "div",
16580
+ {
16581
+ className: "board-toolbar",
16582
+ style: toolbarStyle,
16583
+ role: "toolbar",
16584
+ "aria-label": "Board toolbar",
16585
+ "data-testid": "board-toolbar"
16586
+ },
16587
+ // New card button
16588
+ createElement("button", {
16589
+ style: btnStyle,
16590
+ onClick: onNewCard,
16591
+ "data-testid": "btn-new-card",
16592
+ "aria-label": "New card"
16593
+ }, "+ New Card"),
16594
+ createElement("div", { style: separatorStyle }),
16595
+ // Zoom controls
16596
+ createElement("button", {
16597
+ style: btnStyle,
16598
+ onClick: onZoomOut,
16599
+ "data-testid": "btn-zoom-out",
16600
+ "aria-label": "Zoom out"
16601
+ }, "-"),
16602
+ createElement("span", {
16603
+ style: zoomText,
16604
+ onClick: onZoomReset,
16605
+ "data-testid": "zoom-level",
16606
+ role: "status",
16607
+ "aria-label": `Zoom ${Math.round(zoom * 100)}%`
16608
+ }, `${Math.round(zoom * 100)}%`),
16609
+ createElement("button", {
16610
+ style: btnStyle,
16611
+ onClick: onZoomIn,
16612
+ "data-testid": "btn-zoom-in",
16613
+ "aria-label": "Zoom in"
16614
+ }, "+"),
16615
+ createElement("div", { style: separatorStyle }),
16616
+ ...swatches,
16617
+ createElement("div", { style: separatorStyle }),
16618
+ // Grid toggle
16619
+ createElement("button", {
16620
+ style: gridEnabled ? activeBtnStyle : btnStyle,
16621
+ onClick: onGridToggle,
16622
+ "data-testid": "btn-grid-toggle",
16623
+ "aria-label": gridEnabled ? "Disable grid snapping" : "Enable grid snapping",
16624
+ "aria-pressed": String(gridEnabled)
16625
+ }, "Grid"),
16626
+ createElement("div", { style: separatorStyle }),
16627
+ // Search
16628
+ createElement("input", {
16629
+ type: "text",
16630
+ placeholder: "Search cards...",
16631
+ value: searchText,
16632
+ onInput: handleSearchInput,
16633
+ style: inputStyle,
16634
+ "data-testid": "search-input",
16635
+ "aria-label": "Search cards"
16636
+ })
16637
+ );
16638
+ }
16639
+
16640
+ // ../demos/project-manager/src/Card.ts
16641
+ var PRIORITY_COLORS = {
16642
+ low: "#22c55e",
16643
+ medium: "#f59e0b",
16644
+ high: "#f97316",
16645
+ critical: "#ef4444"
16646
+ };
16647
+ var CONTEXT_MENU_COLORS = CARD_COLORS;
16648
+ var PRIORITY_OPTIONS = [
16649
+ { label: "Low", value: "low" },
16650
+ { label: "Medium", value: "medium" },
16651
+ { label: "High", value: "high" },
16652
+ { label: "Critical", value: "critical" }
16653
+ ];
16654
+ function Card2(props) {
16655
+ const {
16656
+ card,
16657
+ selected,
16658
+ onSelect,
16659
+ onMove,
16660
+ onResize,
16661
+ onDelete,
16662
+ onDoubleClick,
16663
+ onDragStart,
16664
+ onDuplicate,
16665
+ onChangeColor,
16666
+ onChangePriority,
16667
+ onAnchorDragStart
16668
+ } = props;
16669
+ const [hovered, setHovered] = useState(false);
16670
+ const [contextMenu, setContextMenu] = useState(null);
16671
+ const [colorSubmenuOpen, setColorSubmenuOpen] = useState(false);
16672
+ const [prioritySubmenuOpen, setPrioritySubmenuOpen] = useState(false);
16673
+ const dragStartRef = useRef(null);
16674
+ const resizeStartRef = useRef(null);
16675
+ const cardRef = useRef(null);
16676
+ const contextMenuRef = useRef(null);
16677
+ const priorityColor = card.priority ? PRIORITY_COLORS[card.priority] || "#94a3b8" : "transparent";
16678
+ const handleContextMenu = useCallback((e) => {
16679
+ const me = e;
16680
+ me.preventDefault();
16681
+ me.stopPropagation();
16682
+ setContextMenu({ x: me.clientX, y: me.clientY });
16683
+ setColorSubmenuOpen(false);
16684
+ setPrioritySubmenuOpen(false);
16685
+ }, []);
16686
+ const closeContextMenu = useCallback(() => {
16687
+ setContextMenu(null);
16688
+ setColorSubmenuOpen(false);
16689
+ setPrioritySubmenuOpen(false);
16690
+ }, []);
16691
+ useEffect(() => {
16692
+ if (!contextMenu) return;
16693
+ const handleClick = () => {
16694
+ closeContextMenu();
16695
+ };
16696
+ const timer = setTimeout(() => {
16697
+ document.addEventListener("click", handleClick);
16698
+ document.addEventListener("contextmenu", handleClick);
16699
+ }, 0);
16700
+ return () => {
16701
+ clearTimeout(timer);
16702
+ document.removeEventListener("click", handleClick);
16703
+ document.removeEventListener("contextmenu", handleClick);
16704
+ };
16705
+ }, [contextMenu, closeContextMenu]);
16706
+ const handleDuplicateClick = useCallback((e) => {
16707
+ e.stopPropagation();
16708
+ closeContextMenu();
16709
+ if (onDuplicate) onDuplicate(card.id);
16710
+ }, [card.id, onDuplicate, closeContextMenu]);
16711
+ const handleContextDeleteClick = useCallback((e) => {
16712
+ e.stopPropagation();
16713
+ closeContextMenu();
16714
+ onDelete(card.id);
16715
+ }, [card.id, onDelete, closeContextMenu]);
16716
+ const handleColorMenuEnter = useCallback(() => {
16717
+ setColorSubmenuOpen(true);
16718
+ setPrioritySubmenuOpen(false);
16719
+ }, []);
16720
+ const handlePriorityMenuEnter = useCallback(() => {
16721
+ setPrioritySubmenuOpen(true);
16722
+ setColorSubmenuOpen(false);
16723
+ }, []);
16724
+ const handleColorSelect = useCallback((color) => {
16725
+ closeContextMenu();
16726
+ if (onChangeColor) onChangeColor(card.id, color);
16727
+ }, [card.id, onChangeColor, closeContextMenu]);
16728
+ const handlePrioritySelect = useCallback((priority) => {
16729
+ closeContextMenu();
16730
+ if (onChangePriority) onChangePriority(card.id, priority);
16731
+ }, [card.id, onChangePriority, closeContextMenu]);
16732
+ const handleAnchorMouseDown = useCallback((anchor, e) => {
16733
+ const me = e;
16734
+ me.preventDefault();
16735
+ me.stopPropagation();
16736
+ if (onAnchorDragStart) {
16737
+ const cx = card.position.x + card.size.width / 2;
16738
+ const cy = card.position.y + card.size.height / 2;
16739
+ let ax = cx;
16740
+ let ay = cy;
16741
+ if (anchor === "top") {
16742
+ ax = cx;
16743
+ ay = card.position.y;
16744
+ } else if (anchor === "bottom") {
16745
+ ax = cx;
16746
+ ay = card.position.y + card.size.height;
16747
+ } else if (anchor === "left") {
16748
+ ax = card.position.x;
16749
+ ay = cy;
16750
+ } else if (anchor === "right") {
16751
+ ax = card.position.x + card.size.width;
16752
+ ay = cy;
16753
+ }
16754
+ onAnchorDragStart(card.id, anchor, ax, ay);
16755
+ }
16756
+ }, [card.id, card.position, card.size, onAnchorDragStart]);
16757
+ const handleMouseDown = useCallback((e) => {
16758
+ const me = e;
16759
+ const target = me.target;
16760
+ if (target.dataset && (target.dataset.role === "delete" || target.dataset.role === "resize" || target.dataset.role === "anchor")) return;
16761
+ me.preventDefault();
16762
+ me.stopPropagation();
16763
+ onSelect(card.id);
16764
+ dragStartRef.current = {
16765
+ x: me.clientX,
16766
+ y: me.clientY,
16767
+ cardX: card.position.x,
16768
+ cardY: card.position.y
16769
+ };
16770
+ const handleMouseMove = (ev) => {
16771
+ const mev = ev;
16772
+ if (!dragStartRef.current) return;
16773
+ const dx = mev.clientX - dragStartRef.current.x;
16774
+ const dy = mev.clientY - dragStartRef.current.y;
16775
+ onMove(card.id, {
16776
+ x: dragStartRef.current.cardX + dx,
16777
+ y: dragStartRef.current.cardY + dy
16778
+ });
16779
+ };
16780
+ const handleMouseUp = () => {
16781
+ dragStartRef.current = null;
16782
+ document.removeEventListener("mousemove", handleMouseMove);
16783
+ document.removeEventListener("mouseup", handleMouseUp);
16784
+ };
16785
+ document.addEventListener("mousemove", handleMouseMove);
16786
+ document.addEventListener("mouseup", handleMouseUp);
16787
+ if (onDragStart) {
16788
+ onDragStart(card.id, e);
16789
+ }
16790
+ }, [card.id, card.position.x, card.position.y, onSelect, onMove, onDragStart]);
16791
+ const handleResizeMouseDown = useCallback((e) => {
16792
+ const me = e;
16793
+ me.preventDefault();
16794
+ me.stopPropagation();
16795
+ resizeStartRef.current = {
16796
+ x: me.clientX,
16797
+ y: me.clientY,
16798
+ w: card.size.width,
16799
+ h: card.size.height
16800
+ };
16801
+ const handleMouseMove = (ev) => {
16802
+ const mev = ev;
16803
+ if (!resizeStartRef.current) return;
16804
+ const dx = mev.clientX - resizeStartRef.current.x;
16805
+ const dy = mev.clientY - resizeStartRef.current.y;
16806
+ const newW = Math.max(120, resizeStartRef.current.w + dx);
16807
+ const newH = Math.max(80, resizeStartRef.current.h + dy);
16808
+ onResize(card.id, { width: newW, height: newH });
16809
+ };
16810
+ const handleMouseUp = () => {
16811
+ resizeStartRef.current = null;
16812
+ document.removeEventListener("mousemove", handleMouseMove);
16813
+ document.removeEventListener("mouseup", handleMouseUp);
16814
+ };
16815
+ document.addEventListener("mousemove", handleMouseMove);
16816
+ document.addEventListener("mouseup", handleMouseUp);
16817
+ }, [card.id, card.size.width, card.size.height, onResize]);
16818
+ const handleDoubleClick = useCallback((e) => {
16819
+ e.preventDefault();
16820
+ e.stopPropagation();
16821
+ onDoubleClick(card.id);
16822
+ }, [card.id, onDoubleClick]);
16823
+ const handleDeleteClick = useCallback((e) => {
16824
+ e.preventDefault();
16825
+ e.stopPropagation();
16826
+ onDelete(card.id);
16827
+ }, [card.id, onDelete]);
16828
+ const cardStyle = {
16829
+ position: "absolute",
16830
+ left: `${card.position.x}px`,
16831
+ top: `${card.position.y}px`,
16832
+ width: `${card.size.width}px`,
16833
+ height: `${card.size.height}px`,
16834
+ backgroundColor: card.color || "#fef9c3",
16835
+ borderRadius: "6px",
16836
+ borderLeft: `4px solid ${priorityColor}`,
16837
+ boxShadow: selected ? "0 0 0 2px #3b82f6, 0 4px 12px rgba(0,0,0,0.15)" : "0 2px 8px rgba(0,0,0,0.1)",
16838
+ cursor: "grab",
16839
+ userSelect: "none",
16840
+ overflow: "hidden",
16841
+ display: "flex",
16842
+ flexDirection: "column",
16843
+ padding: "8px 10px",
16844
+ boxSizing: "border-box",
16845
+ transition: "box-shadow 150ms ease"
16846
+ };
16847
+ const titleStyle = {
16848
+ fontWeight: "600",
16849
+ fontSize: "14px",
16850
+ color: "#1a1a1a",
16851
+ marginBottom: "4px",
16852
+ lineHeight: "1.3",
16853
+ overflow: "hidden",
16854
+ textOverflow: "ellipsis",
16855
+ whiteSpace: "nowrap"
16856
+ };
16857
+ const descStyle = {
16858
+ fontSize: "12px",
16859
+ color: "#555555",
16860
+ lineHeight: "1.4",
16861
+ overflow: "hidden",
16862
+ flex: "1"
16863
+ };
16864
+ const deleteStyle = {
16865
+ position: "absolute",
16866
+ top: "4px",
16867
+ right: "4px",
16868
+ width: "18px",
16869
+ height: "18px",
16870
+ borderRadius: "50%",
16871
+ backgroundColor: "rgba(0,0,0,0.15)",
16872
+ color: "#333",
16873
+ fontSize: "12px",
16874
+ lineHeight: "18px",
16875
+ textAlign: "center",
16876
+ cursor: "pointer",
16877
+ display: hovered ? "block" : "none",
16878
+ border: "none",
16879
+ padding: "0"
16880
+ };
16881
+ const resizeStyle = {
16882
+ position: "absolute",
16883
+ bottom: "0",
16884
+ right: "0",
16885
+ width: "12px",
16886
+ height: "12px",
16887
+ cursor: "nwse-resize",
16888
+ opacity: "0.4",
16889
+ background: "linear-gradient(135deg, transparent 50%, #666 50%)"
16890
+ };
16891
+ const tagsEl = card.tags && card.tags.length > 0 ? createElement(
16892
+ "div",
16893
+ {
16894
+ style: {
16895
+ display: "flex",
16896
+ gap: "4px",
16897
+ flexWrap: "wrap",
16898
+ marginTop: "4px"
16899
+ }
16900
+ },
16901
+ ...card.tags.map(
16902
+ (tag, i) => createElement("span", {
16903
+ key: String(i),
16904
+ style: {
16905
+ fontSize: "10px",
16906
+ padding: "1px 4px",
16907
+ borderRadius: "3px",
16908
+ backgroundColor: "rgba(0,0,0,0.08)",
16909
+ color: "#444"
16910
+ }
16911
+ }, tag)
16912
+ )
16913
+ ) : null;
16914
+ const anchorBaseStyle = {
16915
+ position: "absolute",
16916
+ width: "10px",
16917
+ height: "10px",
16918
+ borderRadius: "50%",
16919
+ backgroundColor: "#3b82f6",
16920
+ border: "2px solid #ffffff",
16921
+ cursor: "crosshair",
16922
+ display: hovered ? "block" : "none",
16923
+ zIndex: "10",
16924
+ boxSizing: "border-box"
16925
+ };
16926
+ const anchorTop = { ...anchorBaseStyle, top: "-5px", left: "50%", transform: "translateX(-50%)" };
16927
+ const anchorRight = { ...anchorBaseStyle, top: "50%", right: "-5px", transform: "translateY(-50%)" };
16928
+ const anchorBottom = { ...anchorBaseStyle, bottom: "-5px", left: "50%", transform: "translateX(-50%)" };
16929
+ const anchorLeft = { ...anchorBaseStyle, top: "50%", left: "-5px", transform: "translateY(-50%)" };
16930
+ const contextMenuStyle = {
16931
+ position: "fixed",
16932
+ left: contextMenu ? `${contextMenu.x}px` : "0",
16933
+ top: contextMenu ? `${contextMenu.y}px` : "0",
16934
+ backgroundColor: "#ffffff",
16935
+ border: "1px solid #d1d5db",
16936
+ borderRadius: "6px",
16937
+ boxShadow: "0 4px 16px rgba(0,0,0,0.15)",
16938
+ padding: "4px 0",
16939
+ zIndex: "10000",
16940
+ minWidth: "160px",
16941
+ fontSize: "13px",
16942
+ color: "#1a1a1a"
16943
+ };
16944
+ const menuItemStyle = {
16945
+ padding: "6px 12px",
16946
+ cursor: "pointer",
16947
+ display: "flex",
16948
+ alignItems: "center",
16949
+ justifyContent: "space-between",
16950
+ whiteSpace: "nowrap"
16951
+ };
16952
+ const submenuContainerStyle = {
16953
+ position: "absolute",
16954
+ left: "100%",
16955
+ top: "0",
16956
+ backgroundColor: "#ffffff",
16957
+ border: "1px solid #d1d5db",
16958
+ borderRadius: "6px",
16959
+ boxShadow: "0 4px 16px rgba(0,0,0,0.15)",
16960
+ padding: "4px 0",
16961
+ minWidth: "120px"
16962
+ };
16963
+ const contextMenuEl = contextMenu ? createElement(
16964
+ "div",
16965
+ {
16966
+ ref: contextMenuRef,
16967
+ className: "card-context-menu",
16968
+ style: contextMenuStyle,
16969
+ "data-testid": `context-menu-${card.id}`,
16970
+ role: "menu",
16971
+ "aria-label": "Card context menu"
16972
+ },
16973
+ // Duplicate
16974
+ createElement("div", {
16975
+ style: menuItemStyle,
16976
+ onClick: handleDuplicateClick,
16977
+ role: "menuitem",
16978
+ "data-testid": `context-menu-duplicate-${card.id}`
16979
+ }, "Duplicate"),
16980
+ // Delete
16981
+ createElement("div", {
16982
+ style: menuItemStyle,
16983
+ onClick: handleContextDeleteClick,
16984
+ role: "menuitem",
16985
+ "data-testid": `context-menu-delete-${card.id}`
16986
+ }, "Delete"),
16987
+ // Change Color submenu
16988
+ createElement(
16989
+ "div",
16990
+ {
16991
+ style: { ...menuItemStyle, position: "relative" },
16992
+ onMouseEnter: handleColorMenuEnter,
16993
+ role: "menuitem",
16994
+ "aria-haspopup": "true",
16995
+ "data-testid": `context-menu-color-${card.id}`
16996
+ },
16997
+ "Change Color",
16998
+ createElement("span", { style: { marginLeft: "8px" } }, "\u25B6"),
16999
+ colorSubmenuOpen ? createElement(
17000
+ "div",
17001
+ {
17002
+ style: submenuContainerStyle,
17003
+ role: "menu",
17004
+ "data-testid": `context-submenu-color-${card.id}`
17005
+ },
17006
+ ...CONTEXT_MENU_COLORS.map(
17007
+ (color) => createElement(
17008
+ "div",
17009
+ {
17010
+ key: color,
17011
+ style: {
17012
+ ...menuItemStyle,
17013
+ gap: "8px"
17014
+ },
17015
+ onClick: (e) => {
17016
+ e.stopPropagation();
17017
+ handleColorSelect(color);
17018
+ },
17019
+ role: "menuitem",
17020
+ "data-testid": `context-color-${color}`
17021
+ },
17022
+ createElement("span", {
17023
+ style: {
17024
+ width: "14px",
17025
+ height: "14px",
17026
+ borderRadius: "50%",
17027
+ backgroundColor: color,
17028
+ border: "1px solid rgba(0,0,0,0.15)",
17029
+ display: "inline-block",
17030
+ flexShrink: "0"
17031
+ }
17032
+ }),
17033
+ color === card.color ? "\u2713" : ""
17034
+ )
17035
+ )
17036
+ ) : null
17037
+ ),
17038
+ // Set Priority submenu
17039
+ createElement(
17040
+ "div",
17041
+ {
17042
+ style: { ...menuItemStyle, position: "relative" },
17043
+ onMouseEnter: handlePriorityMenuEnter,
17044
+ role: "menuitem",
17045
+ "aria-haspopup": "true",
17046
+ "data-testid": `context-menu-priority-${card.id}`
17047
+ },
17048
+ "Set Priority",
17049
+ createElement("span", { style: { marginLeft: "8px" } }, "\u25B6"),
17050
+ prioritySubmenuOpen ? createElement(
17051
+ "div",
17052
+ {
17053
+ style: submenuContainerStyle,
17054
+ role: "menu",
17055
+ "data-testid": `context-submenu-priority-${card.id}`
17056
+ },
17057
+ ...PRIORITY_OPTIONS.map(
17058
+ (opt) => createElement(
17059
+ "div",
17060
+ {
17061
+ key: opt.value,
17062
+ style: {
17063
+ ...menuItemStyle,
17064
+ gap: "8px"
17065
+ },
17066
+ onClick: (e) => {
17067
+ e.stopPropagation();
17068
+ handlePrioritySelect(opt.value);
17069
+ },
17070
+ role: "menuitem",
17071
+ "data-testid": `context-priority-${opt.value}`
17072
+ },
17073
+ createElement("span", {
17074
+ style: {
17075
+ width: "8px",
17076
+ height: "8px",
17077
+ borderRadius: "50%",
17078
+ backgroundColor: PRIORITY_COLORS[opt.value] || "#94a3b8",
17079
+ display: "inline-block",
17080
+ flexShrink: "0"
17081
+ }
17082
+ }),
17083
+ opt.label,
17084
+ opt.value === card.priority ? " \u2713" : ""
17085
+ )
17086
+ )
17087
+ ) : null
17088
+ )
17089
+ ) : null;
17090
+ return createElement(
17091
+ "div",
17092
+ {
17093
+ ref: cardRef,
17094
+ className: "board-card",
17095
+ style: cardStyle,
17096
+ onMouseDown: handleMouseDown,
17097
+ onDblClick: handleDoubleClick,
17098
+ onContextMenu: handleContextMenu,
17099
+ onMouseEnter: () => setHovered(true),
17100
+ onMouseLeave: () => setHovered(false),
17101
+ "data-card-id": card.id,
17102
+ "data-testid": `card-${card.id}`,
17103
+ role: "button",
17104
+ "aria-label": `Card: ${card.title}`,
17105
+ tabIndex: 0
17106
+ },
17107
+ createElement("div", { style: titleStyle }, card.title || "Untitled"),
17108
+ createElement("div", { style: descStyle }, card.description || ""),
17109
+ tagsEl,
17110
+ createElement("button", {
17111
+ style: deleteStyle,
17112
+ "data-role": "delete",
17113
+ "data-testid": `card-delete-${card.id}`,
17114
+ onClick: handleDeleteClick,
17115
+ "aria-label": `Delete ${card.title}`,
17116
+ tabIndex: -1
17117
+ }, "\xD7"),
17118
+ createElement("div", {
17119
+ style: resizeStyle,
17120
+ "data-role": "resize",
17121
+ onMouseDown: handleResizeMouseDown,
17122
+ "aria-label": "Resize card"
17123
+ }),
17124
+ // Anchor circles for connection creation
17125
+ createElement("div", {
17126
+ style: anchorTop,
17127
+ "data-role": "anchor",
17128
+ "data-anchor": "top",
17129
+ "data-testid": `anchor-top-${card.id}`,
17130
+ onMouseDown: (e) => handleAnchorMouseDown("top", e),
17131
+ "aria-label": "Connection anchor top"
17132
+ }),
17133
+ createElement("div", {
17134
+ style: anchorRight,
17135
+ "data-role": "anchor",
17136
+ "data-anchor": "right",
17137
+ "data-testid": `anchor-right-${card.id}`,
17138
+ onMouseDown: (e) => handleAnchorMouseDown("right", e),
17139
+ "aria-label": "Connection anchor right"
17140
+ }),
17141
+ createElement("div", {
17142
+ style: anchorBottom,
17143
+ "data-role": "anchor",
17144
+ "data-anchor": "bottom",
17145
+ "data-testid": `anchor-bottom-${card.id}`,
17146
+ onMouseDown: (e) => handleAnchorMouseDown("bottom", e),
17147
+ "aria-label": "Connection anchor bottom"
17148
+ }),
17149
+ createElement("div", {
17150
+ style: anchorLeft,
17151
+ "data-role": "anchor",
17152
+ "data-anchor": "left",
17153
+ "data-testid": `anchor-left-${card.id}`,
17154
+ onMouseDown: (e) => handleAnchorMouseDown("left", e),
17155
+ "aria-label": "Connection anchor left"
17156
+ }),
17157
+ contextMenuEl
17158
+ );
17159
+ }
17160
+
17161
+ // ../demos/project-manager/src/CardEditor.ts
17162
+ function CardEditor(props) {
17163
+ const { card, onSave, onClose } = props;
17164
+ const [title, setTitle] = useState(card.title);
17165
+ const [description, setDescription] = useState(card.description);
17166
+ const titleRef = useRef(null);
17167
+ const overlayRef = useRef(null);
17168
+ useEffect(() => {
17169
+ if (titleRef.current) {
17170
+ titleRef.current.focus();
17171
+ titleRef.current.select();
17172
+ }
17173
+ }, []);
17174
+ const save = useCallback(() => {
17175
+ onSave(card.id, { title, description });
17176
+ onClose();
17177
+ }, [card.id, title, description, onSave, onClose]);
17178
+ const handleKeyDown = useCallback((e) => {
17179
+ const ke = e;
17180
+ if (ke.key === "Escape") {
17181
+ save();
17182
+ }
17183
+ }, [save]);
17184
+ const handleOverlayClick = useCallback((e) => {
17185
+ const me = e;
17186
+ if (me.target === overlayRef.current) {
17187
+ save();
17188
+ }
17189
+ }, [save]);
17190
+ const handleTitleChange = useCallback((e) => {
17191
+ setTitle(e.target.value);
17192
+ }, []);
17193
+ const handleDescChange = useCallback((e) => {
17194
+ setDescription(e.target.value);
17195
+ }, []);
17196
+ const handleTitleKeyDown = useCallback((e) => {
17197
+ const ke = e;
17198
+ if (ke.key === "Tab") {
17199
+ ke.preventDefault();
17200
+ const textarea = ke.target.parentElement?.querySelector("textarea");
17201
+ if (textarea) textarea.focus();
17202
+ }
17203
+ if (ke.key === "Escape") {
17204
+ save();
17205
+ }
17206
+ }, [save]);
17207
+ const overlayStyle = {
17208
+ position: "absolute",
17209
+ inset: "0",
17210
+ backgroundColor: "rgba(0,0,0,0.3)",
17211
+ display: "flex",
17212
+ alignItems: "center",
17213
+ justifyContent: "center",
17214
+ zIndex: "100"
17215
+ };
17216
+ const editorStyle = {
17217
+ backgroundColor: card.color || "#fef9c3",
17218
+ borderRadius: "8px",
17219
+ padding: "16px",
17220
+ width: `${Math.max(card.size.width, 200)}px`,
17221
+ boxShadow: "0 8px 24px rgba(0,0,0,0.2)",
17222
+ display: "flex",
17223
+ flexDirection: "column",
17224
+ gap: "8px"
17225
+ };
17226
+ const inputStyle = {
17227
+ border: "1px solid rgba(0,0,0,0.15)",
17228
+ borderRadius: "4px",
17229
+ padding: "6px 8px",
17230
+ fontSize: "14px",
17231
+ fontWeight: "600",
17232
+ backgroundColor: "rgba(255,255,255,0.7)",
17233
+ color: "#1a1a1a",
17234
+ outline: "none",
17235
+ width: "100%",
17236
+ boxSizing: "border-box"
17237
+ };
17238
+ const textareaStyle = {
17239
+ border: "1px solid rgba(0,0,0,0.15)",
17240
+ borderRadius: "4px",
17241
+ padding: "6px 8px",
17242
+ fontSize: "12px",
17243
+ backgroundColor: "rgba(255,255,255,0.7)",
17244
+ color: "#333",
17245
+ outline: "none",
17246
+ resize: "vertical",
17247
+ minHeight: "60px",
17248
+ width: "100%",
17249
+ boxSizing: "border-box",
17250
+ fontFamily: "inherit"
17251
+ };
17252
+ const btnStyle = {
17253
+ padding: "6px 14px",
17254
+ border: "none",
17255
+ borderRadius: "4px",
17256
+ backgroundColor: "#3b82f6",
17257
+ color: "#ffffff",
17258
+ cursor: "pointer",
17259
+ fontSize: "12px",
17260
+ fontWeight: "600",
17261
+ alignSelf: "flex-end"
17262
+ };
17263
+ return createElement(
17264
+ "div",
17265
+ {
17266
+ ref: overlayRef,
17267
+ className: "card-editor-overlay",
17268
+ style: overlayStyle,
17269
+ onClick: handleOverlayClick,
17270
+ onKeyDown: handleKeyDown,
17271
+ "data-testid": "card-editor-overlay"
17272
+ },
17273
+ createElement(
17274
+ "div",
17275
+ {
17276
+ style: editorStyle,
17277
+ "data-testid": "card-editor",
17278
+ role: "dialog",
17279
+ "aria-label": `Edit card: ${card.title}`
17280
+ },
17281
+ createElement("input", {
17282
+ ref: titleRef,
17283
+ type: "text",
17284
+ value: title,
17285
+ onInput: handleTitleChange,
17286
+ onKeyDown: handleTitleKeyDown,
17287
+ style: inputStyle,
17288
+ placeholder: "Card title",
17289
+ "data-testid": "card-editor-title",
17290
+ "aria-label": "Card title"
17291
+ }),
17292
+ createElement("textarea", {
17293
+ value: description,
17294
+ onInput: handleDescChange,
17295
+ onKeyDown: handleKeyDown,
17296
+ style: textareaStyle,
17297
+ placeholder: "Description...",
17298
+ "data-testid": "card-editor-description",
17299
+ "aria-label": "Card description"
17300
+ }),
17301
+ createElement("button", {
17302
+ style: btnStyle,
17303
+ onClick: save,
17304
+ "data-testid": "card-editor-save"
17305
+ }, "Done")
17306
+ )
17307
+ );
17308
+ }
17309
+
17310
+ // ../demos/project-manager/src/Connection.ts
17311
+ function getCardCenter(card) {
17312
+ return {
17313
+ x: card.position.x + card.size.width / 2,
17314
+ y: card.position.y + card.size.height / 2
17315
+ };
17316
+ }
17317
+ function getStrokeDasharray(style) {
17318
+ switch (style) {
17319
+ case "dashed":
17320
+ return "8,4";
17321
+ case "dotted":
17322
+ return "2,4";
17323
+ default:
17324
+ return "none";
17325
+ }
17326
+ }
17327
+ function ConnectionsOverlay(props) {
17328
+ const { connections, cards, selectedConnectionId, onSelectConnection, canvasWidth, canvasHeight } = props;
17329
+ const cardMap = /* @__PURE__ */ new Map();
17330
+ for (let i = 0; i < cards.length; i++) {
17331
+ cardMap.set(cards[i].id, cards[i]);
17332
+ }
17333
+ const handleLineClick = useCallback((connectionId) => {
17334
+ onSelectConnection(connectionId);
17335
+ }, [onSelectConnection]);
17336
+ const lineElements = [];
17337
+ for (let i = 0; i < connections.length; i++) {
17338
+ const conn = connections[i];
17339
+ const fromCard = cardMap.get(conn.fromCardId);
17340
+ const toCard = cardMap.get(conn.toCardId);
17341
+ if (!fromCard || !toCard) continue;
17342
+ const from = getCardCenter(fromCard);
17343
+ const to = getCardCenter(toCard);
17344
+ const isSelected = conn.id === selectedConnectionId;
17345
+ const strokeColor = isSelected ? "#3b82f6" : "#94a3b8";
17346
+ const dashArray = getStrokeDasharray(conn.style);
17347
+ lineElements.push(
17348
+ createElement("line", {
17349
+ key: `hit-${conn.id}`,
17350
+ x1: String(from.x),
17351
+ y1: String(from.y),
17352
+ x2: String(to.x),
17353
+ y2: String(to.y),
17354
+ stroke: "transparent",
17355
+ "stroke-width": "12",
17356
+ style: { cursor: "pointer" },
17357
+ onClick: () => handleLineClick(conn.id),
17358
+ "data-testid": `connection-hit-${conn.id}`
17359
+ })
17360
+ );
17361
+ lineElements.push(
17362
+ createElement("line", {
17363
+ key: conn.id,
17364
+ x1: String(from.x),
17365
+ y1: String(from.y),
17366
+ x2: String(to.x),
17367
+ y2: String(to.y),
17368
+ stroke: strokeColor,
17369
+ "stroke-width": isSelected ? "3" : "2",
17370
+ "stroke-dasharray": dashArray,
17371
+ "pointer-events": "none",
17372
+ "data-testid": `connection-${conn.id}`
17373
+ })
17374
+ );
17375
+ if (conn.label) {
17376
+ const midX = (from.x + to.x) / 2;
17377
+ const midY = (from.y + to.y) / 2;
17378
+ lineElements.push(
17379
+ createElement("text", {
17380
+ key: `label-${conn.id}`,
17381
+ x: String(midX),
17382
+ y: String(midY - 6),
17383
+ "text-anchor": "middle",
17384
+ fill: "#64748b",
17385
+ "font-size": "11",
17386
+ "pointer-events": "none"
17387
+ }, conn.label)
17388
+ );
17389
+ }
17390
+ }
17391
+ const svgStyle = {
17392
+ position: "absolute",
17393
+ top: "0",
17394
+ left: "0",
17395
+ width: "100%",
17396
+ height: "100%",
17397
+ pointerEvents: "none",
17398
+ overflow: "visible"
17399
+ };
17400
+ return createElement(
17401
+ "svg",
17402
+ {
17403
+ style: svgStyle,
17404
+ width: String(canvasWidth),
17405
+ height: String(canvasHeight),
17406
+ className: "connections-overlay",
17407
+ "data-testid": "connections-overlay",
17408
+ role: "img",
17409
+ "aria-label": "Card connections"
17410
+ },
17411
+ createElement("g", { style: { pointerEvents: "auto" } }, ...lineElements)
17412
+ );
17413
+ }
17414
+
17415
+ // ../demos/project-manager/src/Board.ts
17416
+ var GRID_SIZE = 20;
17417
+ var CANVAS_SIZE = 5e3;
17418
+ function screenToCanvas(screenX, screenY, viewport) {
17419
+ return {
17420
+ x: (screenX - viewport.panX) / viewport.zoom,
17421
+ y: (screenY - viewport.panY) / viewport.zoom
17422
+ };
17423
+ }
17424
+ function computeFitAll(cards, containerWidth, containerHeight, padding) {
17425
+ const pad3 = padding ?? 40;
17426
+ if (cards.length === 0) {
17427
+ return { panX: 0, panY: 0, zoom: 1 };
17428
+ }
17429
+ let minX = Infinity;
17430
+ let minY = Infinity;
17431
+ let maxX = -Infinity;
17432
+ let maxY = -Infinity;
17433
+ for (let i = 0; i < cards.length; i++) {
17434
+ const c = cards[i];
17435
+ if (c.position.x < minX) minX = c.position.x;
17436
+ if (c.position.y < minY) minY = c.position.y;
17437
+ const right = c.position.x + c.size.width;
17438
+ const bottom = c.position.y + c.size.height;
17439
+ if (right > maxX) maxX = right;
17440
+ if (bottom > maxY) maxY = bottom;
17441
+ }
17442
+ const contentW = maxX - minX + pad3 * 2;
17443
+ const contentH = maxY - minY + pad3 * 2;
17444
+ const zoomX = containerWidth / contentW;
17445
+ const zoomY = containerHeight / contentH;
17446
+ const zoom = Math.max(0.25, Math.min(4, Math.min(zoomX, zoomY)));
17447
+ const panX = -minX * zoom + (containerWidth - (maxX - minX) * zoom) / 2;
17448
+ const panY = -minY * zoom + (containerHeight - (maxY - minY) * zoom) / 2;
17449
+ return { panX, panY, zoom };
17450
+ }
17451
+ var connIdCounter = 0;
17452
+ function generateConnectionId() {
17453
+ connIdCounter++;
17454
+ return `conn-${Date.now()}-${connIdCounter}`;
17455
+ }
17456
+ function Board(props) {
17457
+ const { state, dispatch, searchQuery, gridEnabled, selectedCardId, onSelectCard, colorFilter } = props;
17458
+ const { cards, connections, viewport } = state;
17459
+ const [editingCardId, setEditingCardId] = useState(null);
17460
+ const [selectedConnectionId, setSelectedConnectionId] = useState(null);
17461
+ const containerRef = useRef(null);
17462
+ const isPanningRef = useRef(false);
17463
+ const panStartRef = useRef(null);
17464
+ const [connectionDrag, setConnectionDrag] = useState(null);
17465
+ const connectionDragRef = useRef(connectionDrag);
17466
+ connectionDragRef.current = connectionDrag;
17467
+ const handleCanvasMouseDown = useCallback((e) => {
17468
+ const me = e;
17469
+ const target = me.target;
17470
+ if (target.closest(".board-card")) return;
17471
+ const isMiddle = me.button === 1;
17472
+ const isShiftLeft = me.button === 0 && me.shiftKey;
17473
+ if (isMiddle || isShiftLeft) {
17474
+ me.preventDefault();
17475
+ isPanningRef.current = true;
17476
+ panStartRef.current = {
17477
+ x: me.clientX,
17478
+ y: me.clientY,
17479
+ panX: viewport.panX,
17480
+ panY: viewport.panY
17481
+ };
17482
+ } else if (me.button === 0) {
17483
+ onSelectCard(null);
17484
+ setSelectedConnectionId(null);
17485
+ }
17486
+ }, [viewport.panX, viewport.panY, onSelectCard]);
17487
+ useEffect(() => {
17488
+ const handleMouseMove = (e) => {
17489
+ if (!isPanningRef.current || !panStartRef.current) return;
17490
+ const me = e;
17491
+ const dx = me.clientX - panStartRef.current.x;
17492
+ const dy = me.clientY - panStartRef.current.y;
17493
+ dispatch({
17494
+ type: "PAN",
17495
+ panX: panStartRef.current.panX + dx,
17496
+ panY: panStartRef.current.panY + dy
17497
+ });
17498
+ };
17499
+ const handleMouseUp = () => {
17500
+ isPanningRef.current = false;
17501
+ panStartRef.current = null;
17502
+ };
17503
+ document.addEventListener("mousemove", handleMouseMove);
17504
+ document.addEventListener("mouseup", handleMouseUp);
17505
+ return () => {
17506
+ document.removeEventListener("mousemove", handleMouseMove);
17507
+ document.removeEventListener("mouseup", handleMouseUp);
17508
+ };
17509
+ }, [dispatch]);
17510
+ const handleWheel = useCallback((e) => {
17511
+ const we = e;
17512
+ if (!we.ctrlKey) return;
17513
+ we.preventDefault();
17514
+ const delta = we.deltaY > 0 ? -0.1 : 0.1;
17515
+ dispatch({ type: "ZOOM", zoom: viewport.zoom + delta });
17516
+ }, [viewport.zoom, dispatch]);
17517
+ useEffect(() => {
17518
+ const handleKeyDown = (e) => {
17519
+ const ke = e;
17520
+ if (ke.key === "Delete" || ke.key === "Backspace") {
17521
+ if (selectedConnectionId) {
17522
+ dispatch({ type: "REMOVE_CONNECTION", connectionId: selectedConnectionId });
17523
+ setSelectedConnectionId(null);
17524
+ } else if (selectedCardId) {
17525
+ dispatch({ type: "REMOVE_CARD", cardId: selectedCardId });
17526
+ onSelectCard(null);
17527
+ }
17528
+ }
17529
+ };
17530
+ document.addEventListener("keydown", handleKeyDown);
17531
+ return () => document.removeEventListener("keydown", handleKeyDown);
17532
+ }, [selectedConnectionId, selectedCardId, dispatch, onSelectCard]);
17533
+ const handleSelectCard = useCallback((cardId) => {
17534
+ onSelectCard(cardId);
17535
+ setSelectedConnectionId(null);
17536
+ }, [onSelectCard]);
17537
+ const handleMoveCard = useCallback((cardId, position) => {
17538
+ let pos = position;
17539
+ if (gridEnabled) {
17540
+ pos = {
17541
+ x: Math.round(position.x / GRID_SIZE) * GRID_SIZE,
17542
+ y: Math.round(position.y / GRID_SIZE) * GRID_SIZE
17543
+ };
17544
+ }
17545
+ dispatch({ type: "MOVE_CARD", cardId, position: pos });
17546
+ }, [dispatch, gridEnabled]);
17547
+ const handleResizeCard = useCallback((cardId, size) => {
17548
+ dispatch({ type: "RESIZE_CARD", cardId, size });
17549
+ }, [dispatch]);
17550
+ const handleDeleteCard = useCallback((cardId) => {
17551
+ dispatch({ type: "REMOVE_CARD", cardId });
17552
+ if (selectedCardId === cardId) onSelectCard(null);
17553
+ }, [dispatch, selectedCardId, onSelectCard]);
17554
+ const handleDoubleClickCard = useCallback((cardId) => {
17555
+ setEditingCardId(cardId);
17556
+ }, []);
17557
+ const handleEditorSave = useCallback((cardId, updates) => {
17558
+ dispatch({ type: "UPDATE_CARD", cardId, updates });
17559
+ }, [dispatch]);
17560
+ const handleEditorClose = useCallback(() => {
17561
+ setEditingCardId(null);
17562
+ }, []);
17563
+ const handleSelectConnection = useCallback((connectionId) => {
17564
+ setSelectedConnectionId(connectionId);
17565
+ onSelectCard(null);
17566
+ }, [onSelectCard]);
17567
+ const handleDeleteConnection = useCallback((connectionId) => {
17568
+ dispatch({ type: "REMOVE_CONNECTION", connectionId });
17569
+ setSelectedConnectionId(null);
17570
+ }, [dispatch]);
17571
+ const handleDuplicateCard = useCallback((cardId) => {
17572
+ const newId = `card-${Date.now()}-dup`;
17573
+ dispatch({ type: "DUPLICATE_CARD", cardId, newId });
17574
+ }, [dispatch]);
17575
+ const handleChangeColor = useCallback((cardId, color) => {
17576
+ dispatch({ type: "UPDATE_CARD", cardId, updates: { color } });
17577
+ }, [dispatch]);
17578
+ const handleChangePriority = useCallback((cardId, priority) => {
17579
+ dispatch({ type: "UPDATE_CARD", cardId, updates: { priority } });
17580
+ }, [dispatch]);
17581
+ const handleAnchorDragStart = useCallback((cardId, anchor, ax, ay) => {
17582
+ setConnectionDrag({
17583
+ fromCardId: cardId,
17584
+ fromAnchor: anchor,
17585
+ fromX: ax,
17586
+ fromY: ay,
17587
+ toX: ax,
17588
+ toY: ay
17589
+ });
17590
+ }, []);
17591
+ useEffect(() => {
17592
+ if (!connectionDragRef.current) return;
17593
+ const handleMouseMove = (e) => {
17594
+ const me = e;
17595
+ if (!connectionDragRef.current) return;
17596
+ const canvasPos = screenToCanvas(me.clientX, me.clientY, viewport);
17597
+ setConnectionDrag((prev) => prev ? {
17598
+ ...prev,
17599
+ toX: canvasPos.x,
17600
+ toY: canvasPos.y
17601
+ } : null);
17602
+ };
17603
+ const handleMouseUp = (e) => {
17604
+ const me = e;
17605
+ if (!connectionDragRef.current) return;
17606
+ const drag = connectionDragRef.current;
17607
+ const target = me.target;
17608
+ const anchorEl = target.closest ? target.closest("[data-anchor]") : null;
17609
+ const cardEl = target.closest ? target.closest("[data-card-id]") : null;
17610
+ if (anchorEl && cardEl) {
17611
+ const targetCardId = cardEl.getAttribute("data-card-id");
17612
+ if (targetCardId && targetCardId !== drag.fromCardId) {
17613
+ dispatch({
17614
+ type: "ADD_CONNECTION",
17615
+ connection: {
17616
+ id: generateConnectionId(),
17617
+ fromCardId: drag.fromCardId,
17618
+ toCardId: targetCardId
17619
+ }
17620
+ });
17621
+ }
17622
+ }
17623
+ setConnectionDrag(null);
17624
+ };
17625
+ document.addEventListener("mousemove", handleMouseMove);
17626
+ document.addEventListener("mouseup", handleMouseUp);
17627
+ return () => {
17628
+ document.removeEventListener("mousemove", handleMouseMove);
17629
+ document.removeEventListener("mouseup", handleMouseUp);
17630
+ };
17631
+ }, [connectionDrag, viewport, dispatch]);
17632
+ const lowerSearch = searchQuery.toLowerCase();
17633
+ const filteredCards = lowerSearch ? cards.filter((c) => c.title.toLowerCase().includes(lowerSearch)) : cards;
17634
+ const dimmedCardIds = /* @__PURE__ */ new Set();
17635
+ if (lowerSearch) {
17636
+ for (let i = 0; i < cards.length; i++) {
17637
+ if (!cards[i].title.toLowerCase().includes(lowerSearch)) {
17638
+ dimmedCardIds.add(cards[i].id);
17639
+ }
17640
+ }
17641
+ }
17642
+ if (colorFilter) {
17643
+ for (let i = 0; i < cards.length; i++) {
17644
+ if (cards[i].color !== colorFilter) {
17645
+ dimmedCardIds.add(cards[i].id);
17646
+ }
17647
+ }
17648
+ }
17649
+ const containerStyle3 = {
17650
+ flex: "1",
17651
+ overflow: "hidden",
17652
+ position: "relative",
17653
+ backgroundColor: "#f8fafc",
17654
+ cursor: isPanningRef.current ? "grabbing" : "default",
17655
+ backgroundImage: "radial-gradient(circle, #d1d5db 1px, transparent 1px)",
17656
+ backgroundSize: `${GRID_SIZE}px ${GRID_SIZE}px`
17657
+ };
17658
+ const transformStyle = {
17659
+ transform: `translate(${viewport.panX}px, ${viewport.panY}px) scale(${viewport.zoom})`,
17660
+ transformOrigin: "0 0",
17661
+ position: "relative",
17662
+ width: `${CANVAS_SIZE}px`,
17663
+ height: `${CANVAS_SIZE}px`
17664
+ };
17665
+ const cardElements = cards.map((card) => {
17666
+ const isDimmed = dimmedCardIds.has(card.id);
17667
+ const cardEl = createElement(Card2, {
17668
+ key: card.id,
17669
+ card,
17670
+ selected: card.id === selectedCardId,
17671
+ onSelect: handleSelectCard,
17672
+ onMove: handleMoveCard,
17673
+ onResize: handleResizeCard,
17674
+ onDelete: handleDeleteCard,
17675
+ onDoubleClick: handleDoubleClickCard,
17676
+ onDuplicate: handleDuplicateCard,
17677
+ onChangeColor: handleChangeColor,
17678
+ onChangePriority: handleChangePriority,
17679
+ onAnchorDragStart: handleAnchorDragStart
17680
+ });
17681
+ if (isDimmed) {
17682
+ return createElement("div", {
17683
+ key: `dim-${card.id}`,
17684
+ style: { opacity: "0.3" }
17685
+ }, cardEl);
17686
+ }
17687
+ return cardEl;
17688
+ });
17689
+ const editingCard = editingCardId ? cards.find((c) => c.id === editingCardId) : null;
17690
+ const editorEl = editingCard ? createElement(CardEditor, {
17691
+ card: editingCard,
17692
+ onSave: handleEditorSave,
17693
+ onClose: handleEditorClose
17694
+ }) : null;
17695
+ const connectionDragLine = connectionDrag ? createElement(
17696
+ "svg",
17697
+ {
17698
+ style: {
17699
+ position: "absolute",
17700
+ top: "0",
17701
+ left: "0",
17702
+ width: "100%",
17703
+ height: "100%",
17704
+ pointerEvents: "none",
17705
+ overflow: "visible",
17706
+ zIndex: "5"
17707
+ },
17708
+ width: String(CANVAS_SIZE),
17709
+ height: String(CANVAS_SIZE),
17710
+ "data-testid": "connection-drag-line"
17711
+ },
17712
+ createElement("line", {
17713
+ x1: String(connectionDrag.fromX),
17714
+ y1: String(connectionDrag.fromY),
17715
+ x2: String(connectionDrag.toX),
17716
+ y2: String(connectionDrag.toY),
17717
+ stroke: "#3b82f6",
17718
+ "stroke-width": "2",
17719
+ "stroke-dasharray": "6,4",
17720
+ "pointer-events": "none"
17721
+ })
17722
+ ) : null;
17723
+ return createElement(
17724
+ "div",
17725
+ {
17726
+ ref: containerRef,
17727
+ className: "board-canvas",
17728
+ style: containerStyle3,
17729
+ onMouseDown: handleCanvasMouseDown,
17730
+ onWheel: handleWheel,
17731
+ "data-testid": "board-canvas",
17732
+ role: "application",
17733
+ "aria-label": "Project board canvas",
17734
+ tabIndex: 0
17735
+ },
17736
+ createElement(
17737
+ "div",
17738
+ {
17739
+ className: "board-canvas__inner",
17740
+ style: transformStyle,
17741
+ "data-testid": "board-canvas-inner"
17742
+ },
17743
+ createElement(ConnectionsOverlay, {
17744
+ connections,
17745
+ cards,
17746
+ selectedConnectionId,
17747
+ onSelectConnection: handleSelectConnection,
17748
+ onDeleteConnection: handleDeleteConnection,
17749
+ canvasWidth: CANVAS_SIZE,
17750
+ canvasHeight: CANVAS_SIZE
17751
+ }),
17752
+ connectionDragLine,
17753
+ ...cardElements
17754
+ ),
17755
+ editorEl
17756
+ );
17757
+ }
17758
+
17759
+ // ../demos/project-manager/src/BoardState.ts
17760
+ var MAX_HISTORY = 50;
17761
+ var DEFAULT_BOARD_STATE = {
17762
+ cards: [],
17763
+ connections: [],
17764
+ viewport: { panX: 0, panY: 0, zoom: 1 }
17765
+ };
17766
+ function boardReducer(state, action) {
17767
+ switch (action.type) {
17768
+ case "ADD_CARD":
17769
+ return {
17770
+ ...state,
17771
+ cards: [...state.cards, action.card]
17772
+ };
17773
+ case "REMOVE_CARD":
17774
+ return {
17775
+ ...state,
17776
+ cards: state.cards.filter((c) => c.id !== action.cardId),
17777
+ connections: state.connections.filter(
17778
+ (conn) => conn.fromCardId !== action.cardId && conn.toCardId !== action.cardId
17779
+ )
17780
+ };
17781
+ case "MOVE_CARD":
17782
+ return {
17783
+ ...state,
17784
+ cards: state.cards.map(
17785
+ (c) => c.id === action.cardId ? { ...c, position: action.position, updatedAt: Date.now() } : c
17786
+ )
17787
+ };
17788
+ case "RESIZE_CARD":
17789
+ return {
17790
+ ...state,
17791
+ cards: state.cards.map(
17792
+ (c) => c.id === action.cardId ? { ...c, size: action.size, updatedAt: Date.now() } : c
17793
+ )
17794
+ };
17795
+ case "UPDATE_CARD":
17796
+ return {
17797
+ ...state,
17798
+ cards: state.cards.map(
17799
+ (c) => c.id === action.cardId ? { ...c, ...action.updates, updatedAt: Date.now() } : c
17800
+ )
17801
+ };
17802
+ case "DUPLICATE_CARD": {
17803
+ const source = state.cards.find((c) => c.id === action.cardId);
17804
+ if (!source) return state;
17805
+ const offset = action.offset || { x: 20, y: 20 };
17806
+ const duplicate = {
17807
+ ...source,
17808
+ id: action.newId,
17809
+ position: {
17810
+ x: source.position.x + offset.x,
17811
+ y: source.position.y + offset.y
17812
+ },
17813
+ createdAt: Date.now(),
17814
+ updatedAt: Date.now()
17815
+ };
17816
+ return {
17817
+ ...state,
17818
+ cards: [...state.cards, duplicate]
17819
+ };
17820
+ }
17821
+ case "ADD_CONNECTION":
17822
+ return {
17823
+ ...state,
17824
+ connections: [...state.connections, action.connection]
17825
+ };
17826
+ case "REMOVE_CONNECTION":
17827
+ return {
17828
+ ...state,
17829
+ connections: state.connections.filter(
17830
+ (conn) => conn.id !== action.connectionId
17831
+ )
17832
+ };
17833
+ case "PAN":
17834
+ return {
17835
+ ...state,
17836
+ viewport: { ...state.viewport, panX: action.panX, panY: action.panY }
17837
+ };
17838
+ case "ZOOM": {
17839
+ const clamped = Math.max(0.25, Math.min(4, action.zoom));
17840
+ return {
17841
+ ...state,
17842
+ viewport: { ...state.viewport, zoom: clamped }
17843
+ };
17844
+ }
17845
+ case "SET_BOARD":
17846
+ return action.state;
17847
+ default:
17848
+ return state;
17849
+ }
17850
+ }
17851
+ function isViewportOnly(action) {
17852
+ return action.type === "PAN" || action.type === "ZOOM";
17853
+ }
17854
+ function historyReducer(state, action) {
17855
+ switch (action.type) {
17856
+ case "UNDO": {
17857
+ if (state.past.length === 0) return state;
17858
+ const previous = state.past[state.past.length - 1];
17859
+ const newPast = state.past.slice(0, state.past.length - 1);
17860
+ return {
17861
+ past: newPast,
17862
+ present: previous,
17863
+ future: [state.present, ...state.future]
17864
+ };
17865
+ }
17866
+ case "REDO": {
17867
+ if (state.future.length === 0) return state;
17868
+ const next = state.future[0];
17869
+ const newFuture = state.future.slice(1);
17870
+ return {
17871
+ past: [...state.past, state.present],
17872
+ present: next,
17873
+ future: newFuture
17874
+ };
17875
+ }
17876
+ case "BOARD_ACTION": {
17877
+ const newPresent = boardReducer(state.present, action.action);
17878
+ if (newPresent === state.present) return state;
17879
+ if (isViewportOnly(action.action)) {
17880
+ return { ...state, present: newPresent };
17881
+ }
17882
+ if (action.action.type === "SET_BOARD") {
17883
+ return { past: [], present: newPresent, future: [] };
17884
+ }
17885
+ const newPast = [...state.past, state.present];
17886
+ if (newPast.length > MAX_HISTORY) {
17887
+ newPast.splice(0, newPast.length - MAX_HISTORY);
17888
+ }
17889
+ return {
17890
+ past: newPast,
17891
+ present: newPresent,
17892
+ future: []
17893
+ };
17894
+ }
17895
+ default:
17896
+ return state;
17897
+ }
17898
+ }
17899
+ function useBoardState(storage2, boardId) {
17900
+ const initialHistory = {
17901
+ past: [],
17902
+ present: DEFAULT_BOARD_STATE,
17903
+ future: []
17904
+ };
17905
+ const [history, historyDispatch] = useReducer(historyReducer, initialHistory);
17906
+ const dispatch = useCallback((action) => {
17907
+ historyDispatch({ type: "BOARD_ACTION", action });
17908
+ }, [historyDispatch]);
17909
+ const undo = useCallback(() => {
17910
+ historyDispatch({ type: "UNDO" });
17911
+ }, [historyDispatch]);
17912
+ const redo = useCallback(() => {
17913
+ historyDispatch({ type: "REDO" });
17914
+ }, [historyDispatch]);
17915
+ const loadedRef = useRef(false);
17916
+ useEffect(() => {
17917
+ if (storage2 && boardId && !loadedRef.current) {
17918
+ loadedRef.current = true;
17919
+ storage2.load(boardId).then((loaded) => {
17920
+ dispatch({ type: "SET_BOARD", state: loaded });
17921
+ }).catch(() => {
17922
+ });
17923
+ }
17924
+ }, [storage2, boardId, dispatch]);
17925
+ const saveTimerRef = useRef(null);
17926
+ const stateRef = useRef(history.present);
17927
+ stateRef.current = history.present;
17928
+ useEffect(() => {
17929
+ if (!storage2 || !boardId) return;
17930
+ if (saveTimerRef.current !== null) {
17931
+ clearTimeout(saveTimerRef.current);
17932
+ }
17933
+ saveTimerRef.current = setTimeout(() => {
17934
+ storage2.save(boardId, stateRef.current).catch(() => {
17935
+ });
17936
+ saveTimerRef.current = null;
17937
+ }, 500);
17938
+ return () => {
17939
+ if (saveTimerRef.current !== null) {
17940
+ clearTimeout(saveTimerRef.current);
17941
+ }
17942
+ };
17943
+ }, [storage2, boardId, history.present]);
17944
+ return {
17945
+ state: history.present,
17946
+ dispatch,
17947
+ undo,
17948
+ redo,
17949
+ canUndo: history.past.length > 0,
17950
+ canRedo: history.future.length > 0
17951
+ };
17952
+ }
17953
+
17954
+ // ../demos/project-manager/src/LocalStorage.ts
17955
+ var DEFAULT_STATE = {
17956
+ cards: [],
17957
+ connections: [],
17958
+ viewport: { panX: 0, panY: 0, zoom: 1 }
17959
+ };
17960
+ var LocalBoardStorage = class {
17961
+ async load(boardId) {
17962
+ try {
17963
+ const raw = localStorage.getItem("board:" + boardId);
17964
+ if (!raw) return DEFAULT_STATE;
17965
+ const parsed = JSON.parse(raw);
17966
+ return parsed;
17967
+ } catch {
17968
+ return DEFAULT_STATE;
17969
+ }
17970
+ }
17971
+ async save(boardId, state) {
17972
+ try {
17973
+ localStorage.setItem("board:" + boardId, JSON.stringify(state));
17974
+ } catch {
17975
+ }
17976
+ }
17977
+ };
17978
+
17979
+ // ../demos/project-manager/src/InterApp.ts
17980
+ function InterAppWrapper(props) {
17981
+ const { cards, onCardDropped, children } = props;
17982
+ const messageBus = useMessageBus();
17983
+ const prevCardsRef = useRef([]);
17984
+ useEffect(() => {
17985
+ const prevCards = prevCardsRef.current;
17986
+ const prevIds = new Set(prevCards.map((c) => c.id));
17987
+ const currIds = new Set(cards.map((c) => c.id));
17988
+ for (const card of cards) {
17989
+ if (!prevIds.has(card.id)) {
17990
+ messageBus.publish("project-board", { event: "card-created", card });
17991
+ }
17992
+ }
17993
+ for (const card of prevCards) {
17994
+ if (!currIds.has(card.id)) {
17995
+ messageBus.publish("project-board", { event: "card-deleted", cardId: card.id });
17996
+ }
17997
+ }
17998
+ for (const card of cards) {
17999
+ if (prevIds.has(card.id)) {
18000
+ const prev = prevCards.find((c) => c.id === card.id);
18001
+ if (prev && prev.updatedAt !== card.updatedAt) {
18002
+ messageBus.publish("project-board", { event: "card-updated", card });
18003
+ }
18004
+ }
18005
+ }
18006
+ prevCardsRef.current = cards;
18007
+ }, [cards, messageBus]);
18008
+ const handleDrop = useCallback(
18009
+ (payload) => {
18010
+ if (payload.type === "text/plain" && typeof payload.data === "string") {
18011
+ onCardDropped(payload.data, "");
18012
+ } else if (payload.type === "application/json") {
18013
+ const data = payload.data;
18014
+ onCardDropped(
18015
+ String(data.title || "Dropped Item"),
18016
+ String(data.description || "")
18017
+ );
18018
+ }
18019
+ },
18020
+ [onCardDropped]
18021
+ );
18022
+ const { isOver } = useDropZone({
18023
+ acceptTypes: ["text/plain", "application/json", "application/project-card"],
18024
+ onDrop: handleDrop
18025
+ });
18026
+ const style = {
18027
+ width: "100%",
18028
+ height: "100%",
18029
+ ...isOver ? { outline: "2px dashed #3b82f6", outlineOffset: "-2px" } : {}
18030
+ };
18031
+ return createElement("div", {
18032
+ style,
18033
+ "data-dropzone-id": "project-board-dropzone"
18034
+ }, children);
18035
+ }
18036
+
18037
+ // ../demos/project-manager/src/index.ts
18038
+ var cardIdCounter = 0;
18039
+ function generateCardId() {
18040
+ cardIdCounter++;
18041
+ return `card-${Date.now()}-${cardIdCounter}`;
18042
+ }
18043
+ var storage = new LocalBoardStorage();
18044
+ var SAMPLE_CARDS = [
18045
+ { id: "sample-1", title: "Auth API", description: "Design the auth flow", color: "#3b82f6", position: { x: 50, y: 50 }, size: { width: 180, height: 120 }, priority: "high", createdAt: Date.now(), updatedAt: Date.now() },
18046
+ { id: "sample-2", title: "Dashboard", description: "Build the main dashboard", color: "#22c55e", position: { x: 300, y: 80 }, size: { width: 180, height: 120 }, priority: "medium", createdAt: Date.now(), updatedAt: Date.now() },
18047
+ { id: "sample-3", title: "Deploy", description: "Set up CI pipeline", color: "#f59e0b", position: { x: 150, y: 250 }, size: { width: 180, height: 120 }, priority: "low", createdAt: Date.now(), updatedAt: Date.now() },
18048
+ { id: "sample-4", title: "Docs", description: "Write API reference", color: "#a855f7", position: { x: 400, y: 280 }, size: { width: 180, height: 120 }, priority: "medium", createdAt: Date.now(), updatedAt: Date.now() }
18049
+ ];
18050
+ var SAMPLE_BOARD = {
18051
+ cards: SAMPLE_CARDS,
18052
+ connections: [
18053
+ { id: "sample-conn-1", fromCardId: "sample-1", toCardId: "sample-2" }
18054
+ ],
18055
+ viewport: { panX: 0, panY: 0, zoom: 1 }
18056
+ };
18057
+ function isBoardEmpty(state) {
18058
+ return state.cards.length === 0 && state.connections.length === 0;
18059
+ }
18060
+ function ProjectManagerApp(props) {
18061
+ const boardId = props.boardId || "default";
18062
+ const { state, dispatch, undo, redo, canUndo, canRedo } = useBoardState(storage, boardId);
18063
+ const [selectedColor, setSelectedColor] = useState(CARD_COLORS[0]);
18064
+ const [gridEnabled, setGridEnabled] = useState(false);
18065
+ const [searchQuery, setSearchQuery] = useState("");
18066
+ const [selectedCardId, setSelectedCardId] = useState(null);
18067
+ const [colorFilter, setColorFilter] = useState(null);
18068
+ const sampleLoadedRef = useRef(false);
18069
+ useEffect(() => {
18070
+ if (!sampleLoadedRef.current && isBoardEmpty(state)) {
18071
+ sampleLoadedRef.current = true;
18072
+ dispatch({ type: "SET_BOARD", state: SAMPLE_BOARD });
18073
+ } else if (state.cards.length > 0) {
18074
+ sampleLoadedRef.current = true;
18075
+ }
18076
+ }, [state, dispatch]);
18077
+ const handleNewCard = useCallback(() => {
18078
+ const cx = (-state.viewport.panX + 300) / state.viewport.zoom;
18079
+ const cy = (-state.viewport.panY + 200) / state.viewport.zoom;
18080
+ const newCard = {
18081
+ id: generateCardId(),
18082
+ title: "New Card",
18083
+ description: "",
18084
+ color: selectedColor,
18085
+ position: { x: Math.round(cx), y: Math.round(cy) },
18086
+ size: { width: 180, height: 120 },
18087
+ priority: "medium",
18088
+ createdAt: Date.now(),
18089
+ updatedAt: Date.now()
18090
+ };
18091
+ dispatch({ type: "ADD_CARD", card: newCard });
18092
+ }, [state.viewport, selectedColor, dispatch]);
18093
+ const handleZoomIn = useCallback(() => {
18094
+ dispatch({ type: "ZOOM", zoom: state.viewport.zoom + 0.1 });
18095
+ }, [state.viewport.zoom, dispatch]);
18096
+ const handleZoomOut = useCallback(() => {
18097
+ dispatch({ type: "ZOOM", zoom: state.viewport.zoom - 0.1 });
18098
+ }, [state.viewport.zoom, dispatch]);
18099
+ const handleZoomReset = useCallback(() => {
18100
+ dispatch({ type: "ZOOM", zoom: 1 });
18101
+ }, [dispatch]);
18102
+ const handleGridToggle = useCallback(() => {
18103
+ setGridEnabled((prev) => !prev);
18104
+ }, []);
18105
+ const handleSearch = useCallback((query) => {
18106
+ setSearchQuery(query);
18107
+ }, []);
18108
+ const handleSelectCard = useCallback((cardId) => {
18109
+ setSelectedCardId(cardId);
18110
+ }, []);
18111
+ const handleColorFilter = useCallback((color) => {
18112
+ setColorFilter(color);
18113
+ }, []);
18114
+ const handleNewBoard = useCallback(() => {
18115
+ dispatch({ type: "SET_BOARD", state: DEFAULT_BOARD_STATE });
18116
+ setSelectedCardId(null);
18117
+ }, [dispatch]);
18118
+ const handleExportJSON = useCallback(() => {
18119
+ const json = JSON.stringify(state, null, 2);
18120
+ const blob = new Blob([json], { type: "application/json" });
18121
+ const url = URL.createObjectURL(blob);
18122
+ const a = document.createElement("a");
18123
+ a.href = url;
18124
+ a.download = `board-${boardId}.json`;
18125
+ a.style.display = "none";
18126
+ document.body.appendChild(a);
18127
+ a.click();
18128
+ document.body.removeChild(a);
18129
+ URL.revokeObjectURL(url);
18130
+ }, [state, boardId]);
18131
+ const handleDeleteSelected = useCallback(() => {
18132
+ if (selectedCardId) {
18133
+ dispatch({ type: "REMOVE_CARD", cardId: selectedCardId });
18134
+ setSelectedCardId(null);
18135
+ }
18136
+ }, [selectedCardId, dispatch]);
18137
+ const handleFitAll = useCallback(() => {
18138
+ if (state.cards.length === 0) return;
18139
+ const containerWidth = 800;
18140
+ const containerHeight = 600;
18141
+ const fit = computeFitAll(state.cards, containerWidth, containerHeight);
18142
+ dispatch({ type: "PAN", panX: fit.panX, panY: fit.panY });
18143
+ dispatch({ type: "ZOOM", zoom: fit.zoom });
18144
+ }, [state.cards, dispatch]);
18145
+ useEffect(() => {
18146
+ const _menuBar = {
18147
+ menus: [
18148
+ { label: "File", items: [
18149
+ { label: "New Board", onClick: handleNewBoard },
18150
+ { label: "Export JSON", onClick: handleExportJSON },
18151
+ { divider: true }
18152
+ ] },
18153
+ { label: "Edit", items: [
18154
+ { label: "Undo", shortcut: "Ctrl+Z", onClick: undo, disabled: !canUndo },
18155
+ { label: "Redo", shortcut: "Ctrl+Y", onClick: redo, disabled: !canRedo },
18156
+ { divider: true },
18157
+ { label: "Delete Selected", onClick: handleDeleteSelected }
18158
+ ] },
18159
+ { label: "View", items: [
18160
+ { label: "Zoom In", onClick: handleZoomIn },
18161
+ { label: "Zoom Out", onClick: handleZoomOut },
18162
+ { label: "Fit All", onClick: handleFitAll },
18163
+ { divider: true },
18164
+ { label: "Toggle Grid", onClick: handleGridToggle }
18165
+ ] }
18166
+ ]
18167
+ };
18168
+ }, [handleNewBoard, handleExportJSON, undo, redo, canUndo, canRedo, handleDeleteSelected, handleZoomIn, handleZoomOut, handleFitAll, handleGridToggle]);
18169
+ useEffect(() => {
18170
+ const handleKeyDown = (e) => {
18171
+ const ke = e;
18172
+ if (ke.ctrlKey && ke.key === "z") {
18173
+ ke.preventDefault();
18174
+ undo();
18175
+ } else if (ke.ctrlKey && ke.key === "y") {
18176
+ ke.preventDefault();
18177
+ redo();
18178
+ }
18179
+ };
18180
+ document.addEventListener("keydown", handleKeyDown);
18181
+ return () => document.removeEventListener("keydown", handleKeyDown);
18182
+ }, [undo, redo]);
18183
+ const containerStyle3 = {
18184
+ display: "flex",
18185
+ flexDirection: "column",
18186
+ width: "100%",
18187
+ height: "100%",
18188
+ backgroundColor: "#f8fafc",
18189
+ overflow: "hidden"
18190
+ };
18191
+ const handleCardDropped = useCallback((title, description) => {
18192
+ const cx = (-state.viewport.panX + 300) / state.viewport.zoom;
18193
+ const cy = (-state.viewport.panY + 200) / state.viewport.zoom;
18194
+ const newCard = {
18195
+ id: generateCardId(),
18196
+ title,
18197
+ description,
18198
+ color: selectedColor,
18199
+ position: { x: Math.round(cx), y: Math.round(cy) },
18200
+ size: { width: 180, height: 120 },
18201
+ priority: "medium",
18202
+ createdAt: Date.now(),
18203
+ updatedAt: Date.now()
18204
+ };
18205
+ dispatch({ type: "ADD_CARD", card: newCard });
18206
+ }, [state.viewport, selectedColor, dispatch]);
18207
+ return createElement(
18208
+ "div",
18209
+ {
18210
+ className: "project-manager-app",
18211
+ style: containerStyle3,
18212
+ "data-testid": "project-manager-app"
18213
+ },
18214
+ createElement(BoardToolbar, {
18215
+ zoom: state.viewport.zoom,
18216
+ gridEnabled,
18217
+ selectedColor,
18218
+ colorFilter,
18219
+ onNewCard: handleNewCard,
18220
+ onZoomIn: handleZoomIn,
18221
+ onZoomOut: handleZoomOut,
18222
+ onZoomReset: handleZoomReset,
18223
+ onColorSelect: setSelectedColor,
18224
+ onColorFilter: handleColorFilter,
18225
+ onGridToggle: handleGridToggle,
18226
+ onSearch: handleSearch
18227
+ }),
18228
+ createElement(
18229
+ InterAppWrapper,
18230
+ {
18231
+ cards: state.cards,
18232
+ onCardDropped: handleCardDropped
18233
+ },
18234
+ createElement(Board, {
18235
+ state,
18236
+ dispatch,
18237
+ searchQuery,
18238
+ gridEnabled,
18239
+ selectedCardId,
18240
+ onSelectCard: handleSelectCard,
18241
+ colorFilter
18242
+ })
18243
+ )
18244
+ );
18245
+ }
18246
+
16455
18247
  // ../components/page/unity-desktop/src/UnityDesktop.ts
16456
18248
  var PANEL_HEIGHT = 28;
16457
18249
  var TOAST_TIMEOUT = 5e3;
@@ -16653,6 +18445,8 @@ function getMockContent(title) {
16653
18445
  return createElement(IDE, null);
16654
18446
  case "Trading":
16655
18447
  return createElement(TradingDashboard, null);
18448
+ case "Project Board":
18449
+ return createElement(ProjectManagerApp, null);
16656
18450
  default:
16657
18451
  return createElement(
16658
18452
  "div",