@industry-theme/github-panels 0.1.59 → 0.1.60

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.
@@ -1 +1 @@
1
- {"version":3,"file":"GitHubRepositoryCard.d.ts","sourceRoot":"","sources":["../../../src/components/shared/GitHubRepositoryCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAarD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,6BAA6B;IAC7B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACrD,kEAAkE;IAClE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA2WpE,CAAC"}
1
+ {"version":3,"file":"GitHubRepositoryCard.d.ts","sourceRoot":"","sources":["../../../src/components/shared/GitHubRepositoryCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAcrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,6BAA6B;IAC7B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACrD,kEAAkE;IAClE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAuYpE,CAAC"}
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
4
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
5
  import * as React2 from "react";
3
6
  import React2__default, { createContext, useContext, forwardRef, createElement, useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect, useImperativeHandle } from "react";
@@ -1477,6 +1480,101 @@ const RepositoryAvatar = ({
1477
1480
  }
1478
1481
  );
1479
1482
  };
1483
+ createContext(null);
1484
+ class PanelErrorBoundary extends React2__default.Component {
1485
+ constructor(props) {
1486
+ super(props);
1487
+ __publicField(this, "reset", () => {
1488
+ this.setState({ error: null });
1489
+ });
1490
+ this.state = { error: null };
1491
+ }
1492
+ static getDerivedStateFromError(error) {
1493
+ return { error };
1494
+ }
1495
+ componentDidCatch(error, errorInfo) {
1496
+ console.error("Panel error:", error, errorInfo);
1497
+ }
1498
+ render() {
1499
+ if (this.state.error) {
1500
+ const Fallback = this.props.fallback;
1501
+ return /* @__PURE__ */ jsx(Fallback, {
1502
+ error: this.state.error,
1503
+ reset: this.reset
1504
+ });
1505
+ }
1506
+ return this.props.children;
1507
+ }
1508
+ }
1509
+ var PANEL_DATA_MIME_TYPE = "application/x-panel-data";
1510
+ function createDragPreview(content2, options) {
1511
+ const preview = document.createElement("div");
1512
+ preview.style.cssText = `
1513
+ position: absolute;
1514
+ top: -1000px;
1515
+ left: -1000px;
1516
+ padding: 8px 12px;
1517
+ background: ${"#3b82f6"};
1518
+ color: ${"white"};
1519
+ border-radius: 6px;
1520
+ font-size: 12px;
1521
+ box-shadow: 0 2px 8px rgba(0,0,0,0.2);
1522
+ display: flex;
1523
+ align-items: center;
1524
+ gap: 8px;
1525
+ white-space: nowrap;
1526
+ `;
1527
+ const text2 = document.createElement("span");
1528
+ text2.textContent = content2;
1529
+ preview.appendChild(text2);
1530
+ return preview;
1531
+ }
1532
+ function useDraggable(config) {
1533
+ const [isDragging, setIsDragging] = useState(false);
1534
+ const handleDragStart = useCallback((e) => {
1535
+ var _a;
1536
+ setIsDragging(true);
1537
+ e.dataTransfer.setData("text/plain", config.primaryData);
1538
+ const panelData = {
1539
+ sourcePanel: config.sourcePanel || "unknown",
1540
+ dataType: config.dataType,
1541
+ primaryData: config.primaryData,
1542
+ metadata: config.metadata,
1543
+ suggestedActions: config.suggestedActions,
1544
+ version: "1.0"
1545
+ };
1546
+ e.dataTransfer.setData(PANEL_DATA_MIME_TYPE, JSON.stringify(panelData));
1547
+ e.dataTransfer.effectAllowed = "copy";
1548
+ if (e.currentTarget instanceof HTMLElement) {
1549
+ e.currentTarget.style.opacity = "0.5";
1550
+ }
1551
+ if (config.dragPreview) {
1552
+ if (config.dragPreview instanceof HTMLElement) {
1553
+ e.dataTransfer.setDragImage(config.dragPreview, 0, 0);
1554
+ } else {
1555
+ const preview = createDragPreview(config.dragPreview);
1556
+ document.body.appendChild(preview);
1557
+ e.dataTransfer.setDragImage(preview, 0, 0);
1558
+ setTimeout(() => document.body.removeChild(preview), 0);
1559
+ }
1560
+ }
1561
+ (_a = config.onDragStart) == null ? void 0 : _a.call(config, e);
1562
+ }, [config]);
1563
+ const handleDragEnd = useCallback((e) => {
1564
+ var _a;
1565
+ setIsDragging(false);
1566
+ if (e.currentTarget instanceof HTMLElement) {
1567
+ e.currentTarget.style.opacity = "1";
1568
+ }
1569
+ (_a = config.onDragEnd) == null ? void 0 : _a.call(config, e);
1570
+ }, [config]);
1571
+ return {
1572
+ draggable: true,
1573
+ onDragStart: handleDragStart,
1574
+ onDragEnd: handleDragEnd,
1575
+ isDragging
1576
+ };
1577
+ }
1480
1578
  const GitHubRepositoryCard = ({
1481
1579
  repository,
1482
1580
  localRepo,
@@ -1492,6 +1590,23 @@ const GitHubRepositoryCard = ({
1492
1590
  const { theme: theme2 } = useTheme();
1493
1591
  const [isHovered, setIsHovered] = useState(false);
1494
1592
  const isCloned = Boolean(localRepo);
1593
+ const { isDragging, ...dragProps } = useDraggable({
1594
+ dataType: "repository-github",
1595
+ primaryData: repository.full_name,
1596
+ metadata: {
1597
+ name: repository.name,
1598
+ owner: repository.owner.login,
1599
+ description: repository.description,
1600
+ language: repository.language,
1601
+ stars: repository.stargazers_count,
1602
+ isPrivate: repository.private,
1603
+ htmlUrl: repository.html_url,
1604
+ cloneUrl: repository.clone_url
1605
+ },
1606
+ suggestedActions: ["add-to-collection"],
1607
+ sourcePanel: "github-repositories",
1608
+ dragPreview: repository.full_name
1609
+ });
1495
1610
  const handleClone = useCallback(
1496
1611
  (e) => {
1497
1612
  e.stopPropagation();
@@ -1549,6 +1664,7 @@ const GitHubRepositoryCard = ({
1549
1664
  onClick: handleClick,
1550
1665
  onMouseEnter: () => setIsHovered(true),
1551
1666
  onMouseLeave: () => setIsHovered(false),
1667
+ ...isInCollection ? {} : dragProps,
1552
1668
  style: {
1553
1669
  display: "flex",
1554
1670
  alignItems: "flex-start",
@@ -1557,8 +1673,9 @@ const GitHubRepositoryCard = ({
1557
1673
  borderRadius: "8px",
1558
1674
  backgroundColor: isSelected ? `${theme2.colors.primary}15` : isHovered ? theme2.colors.backgroundTertiary : "transparent",
1559
1675
  border: `1px solid ${isSelected ? theme2.colors.primary : "transparent"}`,
1560
- cursor: onSelect ? "pointer" : "default",
1561
- transition: "background-color 0.15s, border-color 0.15s"
1676
+ cursor: isInCollection ? "not-allowed" : isDragging ? "grabbing" : onSelect ? "grab" : "default",
1677
+ opacity: isDragging ? 0.5 : isInCollection ? 0.7 : 1,
1678
+ transition: "background-color 0.15s, border-color 0.15s, opacity 0.15s"
1562
1679
  },
1563
1680
  children: [
1564
1681
  /* @__PURE__ */ jsx(