@industry-theme/github-panels 0.1.41 → 0.1.42
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/components/GitHubProjectCard.d.ts.map +1 -1
- package/dist/components/shared/GitHubRepositoryCard.d.ts.map +1 -1
- package/dist/panels/GitHubSearchPanel.d.ts +6 -0
- package/dist/panels/GitHubSearchPanel.d.ts.map +1 -1
- package/dist/panels.bundle.js +37 -13
- package/dist/panels.bundle.js.map +1 -1
- package/dist/types/github.d.ts +28 -2
- package/dist/types/github.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubProjectCard.d.ts","sourceRoot":"","sources":["../../src/components/GitHubProjectCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,gDAAgD;IAChD,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACzD;AA4CD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"GitHubProjectCard.d.ts","sourceRoot":"","sources":["../../src/components/GitHubProjectCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD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U,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,
|
|
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"}
|
|
@@ -8,6 +8,12 @@ import type { PanelComponentProps } from '../types';
|
|
|
8
8
|
* - Shows stars, forks, language
|
|
9
9
|
* - Emits repository:preview events when a repo is clicked
|
|
10
10
|
* - Supports "Add to Collection" when in a collection context
|
|
11
|
+
*
|
|
12
|
+
* Required actions:
|
|
13
|
+
* - searchRepositories: (query, options?) => Promise<GitHubSearchResult>
|
|
14
|
+
*
|
|
15
|
+
* Optional actions:
|
|
16
|
+
* - addToCollection: (repo) => Promise<void>
|
|
11
17
|
*/
|
|
12
18
|
export declare const GitHubSearchPanel: React.FC<PanelComponentProps>;
|
|
13
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubSearchPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitHubSearchPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAIjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"GitHubSearchPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitHubSearchPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAIjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA+WpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAE3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;CAQrC,CAAC"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -739,7 +739,7 @@ const GitHubProjectCard = ({
|
|
|
739
739
|
] }),
|
|
740
740
|
repository.license && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
741
741
|
/* @__PURE__ */ jsx(Scale, { size: 12 }),
|
|
742
|
-
/* @__PURE__ */ jsx("span", { children: repository.license })
|
|
742
|
+
/* @__PURE__ */ jsx("span", { children: typeof repository.license === "string" ? repository.license : repository.license.spdx_id || repository.license.name })
|
|
743
743
|
] })
|
|
744
744
|
]
|
|
745
745
|
}
|
|
@@ -1526,7 +1526,7 @@ const GitHubRepositoryCard = ({
|
|
|
1526
1526
|
] }),
|
|
1527
1527
|
repository.license && /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1528
1528
|
/* @__PURE__ */ jsx(Scale, { size: 12 }),
|
|
1529
|
-
repository.license
|
|
1529
|
+
typeof repository.license === "string" ? repository.license : repository.license.spdx_id || repository.license.name
|
|
1530
1530
|
] }),
|
|
1531
1531
|
(repository.pushed_at || repository.updated_at) && /* @__PURE__ */ jsxs("span", { children: [
|
|
1532
1532
|
"Updated ",
|
|
@@ -1735,10 +1735,13 @@ const GitHubSearchPanelContent = ({ context, actions, events }) => {
|
|
|
1735
1735
|
return new Set(collectionRepos.map((r2) => r2.full_name));
|
|
1736
1736
|
}, [collectionRepos]);
|
|
1737
1737
|
const panelActions = actions;
|
|
1738
|
+
const searchAvailable = Boolean(panelActions.searchRepositories);
|
|
1738
1739
|
useEffect(() => {
|
|
1739
1740
|
var _a2;
|
|
1740
|
-
(
|
|
1741
|
-
|
|
1741
|
+
if (searchAvailable) {
|
|
1742
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
1743
|
+
}
|
|
1744
|
+
}, [searchAvailable]);
|
|
1742
1745
|
const performSearch = useCallback(async (query) => {
|
|
1743
1746
|
if (!query.trim()) {
|
|
1744
1747
|
setResults([]);
|
|
@@ -1746,17 +1749,14 @@ const GitHubSearchPanelContent = ({ context, actions, events }) => {
|
|
|
1746
1749
|
setError(null);
|
|
1747
1750
|
return;
|
|
1748
1751
|
}
|
|
1752
|
+
if (!panelActions.searchRepositories) {
|
|
1753
|
+
setError("Search is not available");
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1749
1756
|
setIsLoading(true);
|
|
1750
1757
|
setError(null);
|
|
1751
1758
|
try {
|
|
1752
|
-
const
|
|
1753
|
-
`/api/github/search?q=${encodeURIComponent(query)}&per_page=30`
|
|
1754
|
-
);
|
|
1755
|
-
if (!response.ok) {
|
|
1756
|
-
const errorData = await response.json().catch(() => ({}));
|
|
1757
|
-
throw new Error(errorData.error || "Search failed");
|
|
1758
|
-
}
|
|
1759
|
-
const data = await response.json();
|
|
1759
|
+
const data = await panelActions.searchRepositories(query, { perPage: 30 });
|
|
1760
1760
|
setResults(data.items || []);
|
|
1761
1761
|
setTotalCount(data.total_count || 0);
|
|
1762
1762
|
} catch (err) {
|
|
@@ -1766,7 +1766,7 @@ const GitHubSearchPanelContent = ({ context, actions, events }) => {
|
|
|
1766
1766
|
} finally {
|
|
1767
1767
|
setIsLoading(false);
|
|
1768
1768
|
}
|
|
1769
|
-
}, []);
|
|
1769
|
+
}, [panelActions]);
|
|
1770
1770
|
const handleSearchChange = (e) => {
|
|
1771
1771
|
const query = e.target.value;
|
|
1772
1772
|
setSearchQuery(query);
|
|
@@ -1814,6 +1814,30 @@ const GitHubSearchPanelContent = ({ context, actions, events }) => {
|
|
|
1814
1814
|
if (num >= 1e3) return `${(num / 1e3).toFixed(1)}K`;
|
|
1815
1815
|
return num.toString();
|
|
1816
1816
|
};
|
|
1817
|
+
if (!searchAvailable) {
|
|
1818
|
+
return /* @__PURE__ */ jsxs(
|
|
1819
|
+
"div",
|
|
1820
|
+
{
|
|
1821
|
+
style: {
|
|
1822
|
+
height: "100%",
|
|
1823
|
+
display: "flex",
|
|
1824
|
+
flexDirection: "column",
|
|
1825
|
+
alignItems: "center",
|
|
1826
|
+
justifyContent: "center",
|
|
1827
|
+
backgroundColor: theme2.colors.background,
|
|
1828
|
+
color: theme2.colors.textSecondary,
|
|
1829
|
+
fontFamily: theme2.fonts.body,
|
|
1830
|
+
padding: "32px",
|
|
1831
|
+
textAlign: "center"
|
|
1832
|
+
},
|
|
1833
|
+
children: [
|
|
1834
|
+
/* @__PURE__ */ jsx(CircleAlert, { size: 48, style: { marginBottom: 16, opacity: 0.5 } }),
|
|
1835
|
+
/* @__PURE__ */ jsx("p", { style: { margin: 0, fontSize: `${theme2.fontSizes[2]}px` }, children: "Search is not available" }),
|
|
1836
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "8px 0 0", fontSize: `${theme2.fontSizes[1]}px` }, children: "The host application must provide a searchRepositories action" })
|
|
1837
|
+
]
|
|
1838
|
+
}
|
|
1839
|
+
);
|
|
1840
|
+
}
|
|
1817
1841
|
return /* @__PURE__ */ jsxs(
|
|
1818
1842
|
"div",
|
|
1819
1843
|
{
|