shadcn-studio-extension-cli 0.1.11 → 0.2.0
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/THIRD_PARTY_LICENSES.txt +1 -1
- package/dist/build-meta.json +6 -6
- package/dist/index.cjs +3 -7
- package/dist/index.cjs.map +3 -3
- package/dist/toolbar-app/.vite/manifest.json +4 -4
- package/dist/toolbar-app/{index-DZzSFjno.js → index-B0k7lxog.js} +13 -22
- package/dist/toolbar-app/{index-ChCX2CjU.js → index-BEof4Zuj.js} +13 -12
- package/dist/toolbar-app/{index-BZHOXnId.js → index-BWhYIR3j.js} +5 -4
- package/dist/toolbar-app/index-BZPb_m5H.js +15301 -0
- package/dist/toolbar-app/index-CcQR8qhj.js +2 -2
- package/dist/toolbar-app/index-CkT0X5qN.js +8918 -0
- package/dist/toolbar-app/{index-pswOz6KO.js → index-DSOLAkGe.js} +29 -24
- package/dist/toolbar-app/{index-rW3Giydl.js → index-DVhsFHfB.js} +6 -5
- package/dist/toolbar-app/{index-hjBNHl28.js → index-DfTwb8mq.js} +5 -5
- package/dist/toolbar-app/{index-BsmHzFJI.js → index-KEJk4WhW.js} +24 -9
- package/dist/toolbar-app/index-qh9EWxJX.js +8918 -0
- package/dist/toolbar-app/index.js +18 -56
- package/dist/toolbar-app/plugin-sdk.js +2 -2
- package/package.json +1 -1
- package/dist/toolbar-app/index-C5kLbmuE.js +0 -8917
- package/dist/toolbar-app/index-CK3aj61v.js +0 -8916
- package/dist/toolbar-app/index-COSu8H98.js +0 -8918
- package/dist/toolbar-app/index-CPzOXT0l.js +0 -8884
- package/dist/toolbar-app/index-CQOfGa9p.js +0 -8916
- package/dist/toolbar-app/index-CZ2quOq0.js +0 -8917
- package/dist/toolbar-app/index-CoMQvcfw.js +0 -8880
- package/dist/toolbar-app/index-CtdhG9I0.js +0 -8905
- package/dist/toolbar-app/index-DJ16UPrG.js +0 -8912
- package/dist/toolbar-app/index-DKAggkAP.js +0 -8880
- package/dist/toolbar-app/index-D_JMEWJE.js +0 -8892
- package/dist/toolbar-app/index-LNolXi86.js +0 -8901
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import React__default, { createContext, useState, useEffect, useContext, useCallback, useMemo, useRef, forwardRef, createElement, useLayoutEffect, Fragment as Fragment$1, isValidElement, cloneElement, useId as useId$1, useReducer, useSyncExternalStore, createRef, useImperativeHandle, StrictMode } from "react";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
|
-
import { A as AgentStateType, u as useAgents, a as useAppState, b as usePlugins, c as useAgentMessaging, d as usePanels, g as getSelectedElementInfo, e as getSelectedDocInfo, f as getSelectedBlockInfo, h as getSelectedThemeInfo, i as collectUserMessageMetadata, j as generateId, C as ConfigProvider, k as AgentProvider, l as AgentAvailabilityProvider, m as AgentMessagingProvider, P as PanelsProvider, n as PluginProvider, H as HotkeyActions, o as hotkeyActionDefinitions, p as getIFrameWindow, q as cn, r as getElementAtPoint, s as getXPathForElement, B as Button, t as glassyBoxClassName, v as AgentAvailabilityError, w as useAgentAvailability, x as Panel, y as PanelHeader, z as PanelContent, D as PanelFooter, E as cva, F as getLicenseDataFromStorage, G as Glassy, I as AppStateProvider } from "index-
|
|
5
|
+
import { A as AgentStateType, u as useAgents, a as useAppState, b as usePlugins, c as useAgentMessaging, d as usePanels, g as getSelectedElementInfo, e as getSelectedDocInfo, f as getSelectedBlockInfo, h as getSelectedThemeInfo, i as collectUserMessageMetadata, j as generateId, C as ConfigProvider, k as AgentProvider, l as AgentAvailabilityProvider, m as AgentMessagingProvider, P as PanelsProvider, n as PluginProvider, H as HotkeyActions, o as hotkeyActionDefinitions, p as getIFrameWindow, q as cn, r as getElementAtPoint, s as getXPathForElement, B as Button, t as glassyBoxClassName, v as AgentAvailabilityError, w as useAgentAvailability, x as Panel, y as PanelHeader, z as PanelContent, D as PanelFooter, E as cva, F as getLicenseDataFromStorage, G as Glassy, I as AppStateProvider } from "index-B0k7lxog.js";
|
|
6
6
|
import * as ReactDOM from "react-dom";
|
|
7
7
|
import { createPortal, flushSync } from "react-dom";
|
|
8
8
|
import config from "@stagewise/toolbar/config";
|
|
@@ -68,7 +68,7 @@ const useAgentState = () => useContext(agentStateContext), ChatContext = createC
|
|
|
68
68
|
},
|
|
69
69
|
isSending: !1
|
|
70
70
|
}), ChatStateProvider = ({ children }) => {
|
|
71
|
-
const [chatInput, setChatInput] = useState(""), [isPromptCreationMode, setIsPromptCreationMode] = useState(!1), [isSending, setIsSending] = useState(!1), [domContextElements, setDomContextElements] = useState([]), [selectedDocs, setSelectedDocs] = useState([]), [selectedBlocks, setSelectedBlocks] = useState([]), [selectedThemes, setSelectedThemes] = useState([]), { minimized } = useAppState(), { plugins } = usePlugins(), { sendMessage: sendAgentMessage } = useAgentMessaging(), { isChatOpen } = usePanels(), agentState = useAgentState(), { promptAction
|
|
71
|
+
const [chatInput, setChatInput] = useState(""), [isPromptCreationMode, setIsPromptCreationMode] = useState(!1), [isSending, setIsSending] = useState(!1), [domContextElements, setDomContextElements] = useState([]), [selectedDocs, setSelectedDocs] = useState([]), [selectedBlocks, setSelectedBlocks] = useState([]), [selectedThemes, setSelectedThemes] = useState([]), { minimized } = useAppState(), { plugins } = usePlugins(), { sendMessage: sendAgentMessage } = useAgentMessaging(), { isChatOpen } = usePanels(), agentState = useAgentState(), { promptAction } = useAppState(), startPromptCreation = useCallback(() => {
|
|
72
72
|
setIsPromptCreationMode(!0), plugins.forEach((plugin) => {
|
|
73
73
|
var _a;
|
|
74
74
|
(_a = plugin.onPromptingStart) == null || _a.call(plugin);
|
|
@@ -143,16 +143,15 @@ const useAgentState = () => useContext(agentStateContext), ChatContext = createC
|
|
|
143
143
|
), selectedDocsInfo = selectedDocs.map(
|
|
144
144
|
(doc) => getSelectedDocInfo(doc)
|
|
145
145
|
), selectedBlocksInfo = await Promise.all(
|
|
146
|
-
selectedBlocks.map((block) => getSelectedBlockInfo(block
|
|
146
|
+
selectedBlocks.map((block) => getSelectedBlockInfo(block))
|
|
147
147
|
), selectedThemesInfo = selectedThemes.map(
|
|
148
|
-
(theme) => getSelectedThemeInfo(theme
|
|
148
|
+
(theme) => getSelectedThemeInfo(theme)
|
|
149
149
|
), metadata = collectUserMessageMetadata(
|
|
150
150
|
selectedElementsInfo,
|
|
151
151
|
selectedDocsInfo,
|
|
152
152
|
selectedBlocksInfo,
|
|
153
153
|
selectedThemesInfo,
|
|
154
|
-
promptAction
|
|
155
|
-
cliVersion
|
|
154
|
+
promptAction
|
|
156
155
|
), baseUserMessage = {
|
|
157
156
|
id: generateId(),
|
|
158
157
|
createdAt: /* @__PURE__ */ new Date(),
|
|
@@ -7122,14 +7121,14 @@ const performLocalSearch = (blocks, query) => {
|
|
|
7122
7121
|
var _a;
|
|
7123
7122
|
return ((_a = block.meta) == null ? void 0 : _a.isBasic) === !1;
|
|
7124
7123
|
}), checkPlan$1 = async (licenseKey, email) => {
|
|
7125
|
-
const fetchPlanUrl = `
|
|
7124
|
+
const fetchPlanUrl = `http://localhost:3000/api/ide-extension/plan-variant?email=${email}&license_key=${licenseKey}`;
|
|
7126
7125
|
try {
|
|
7127
7126
|
return (await (await fetch(fetchPlanUrl, { method: "GET" })).json()).plan_variant;
|
|
7128
7127
|
} catch (error2) {
|
|
7129
7128
|
console.error("Failed to fetch plan variant:", error2);
|
|
7130
7129
|
}
|
|
7131
7130
|
}, fetchBlocksFromAPI = async (isValidated, licenseKey, email) => {
|
|
7132
|
-
const fetchBlocksUrl = "https://shadcnstudio.com/r/blocks/registry.json?is_extension=true";
|
|
7131
|
+
const fetchBlocksUrl = "https://shadcnstudio.com/r/blocks/radix-vega/registry.json?is_extension=true";
|
|
7133
7132
|
try {
|
|
7134
7133
|
const response = await fetch(fetchBlocksUrl, { method: "GET" });
|
|
7135
7134
|
if (!response.ok)
|
|
@@ -7258,7 +7257,7 @@ function useLicenseKey() {
|
|
|
7258
7257
|
return { isValid: !1, message: "Invalid license key" };
|
|
7259
7258
|
if (!email || typeof email != "string" || !email.includes("@"))
|
|
7260
7259
|
return { isValid: !1, message: "Invalid email" };
|
|
7261
|
-
const trimmedLicenseKey = licensekey.trim(), validateUrl = `
|
|
7260
|
+
const trimmedLicenseKey = licensekey.trim(), validateUrl = `http://localhost:3000/api/ide-extension/validate-user?email=${email.trim()}&license_key=${trimmedLicenseKey}`, response = await fetch(validateUrl, {
|
|
7262
7261
|
method: "GET",
|
|
7263
7262
|
headers: {
|
|
7264
7263
|
"Content-Type": "application/json"
|
|
@@ -8045,7 +8044,10 @@ const fetchGenericThemesFromAPI = async () => {
|
|
|
8045
8044
|
const fetchThemesUrl = "https://shadcnstudio.com/r/themes/registry.json?is_extension=true";
|
|
8046
8045
|
try {
|
|
8047
8046
|
const response = await fetch(fetchThemesUrl, { method: "GET" });
|
|
8048
|
-
return response.ok ? (await response.json()).items
|
|
8047
|
+
return response.ok ? (await response.json()).items.map((theme) => ({
|
|
8048
|
+
...theme,
|
|
8049
|
+
type: "generic"
|
|
8050
|
+
})) : (console.warn(
|
|
8049
8051
|
`Failed to fetch themes: ${response.status} ${response.statusText}`
|
|
8050
8052
|
), []);
|
|
8051
8053
|
} catch (error2) {
|
|
@@ -8055,17 +8057,20 @@ const fetchGenericThemesFromAPI = async () => {
|
|
|
8055
8057
|
const { email, licenseKey } = getLicenseDataFromStorage();
|
|
8056
8058
|
if (!email || !licenseKey)
|
|
8057
8059
|
return "basic";
|
|
8058
|
-
const fetchPlanUrl = `
|
|
8060
|
+
const fetchPlanUrl = `http://localhost:3000/api/ide-extension/plan-variant?email=${email}&license_key=${licenseKey}`;
|
|
8059
8061
|
try {
|
|
8060
8062
|
return (await (await fetch(fetchPlanUrl, { method: "GET" })).json()).plan_variant;
|
|
8061
8063
|
} catch (error2) {
|
|
8062
8064
|
console.error("Failed to fetch plan variant:", error2);
|
|
8063
8065
|
}
|
|
8064
8066
|
}, fetchUserThemesFromAPI = async () => {
|
|
8065
|
-
const { email, licenseKey } = getLicenseDataFromStorage(), fetchThemesUrl = `
|
|
8067
|
+
const { email, licenseKey } = getLicenseDataFromStorage(), fetchThemesUrl = `http://localhost:3000/api/ide-extension/user-themes?email=${email}&license_key=${licenseKey}&is_extension=true`;
|
|
8066
8068
|
try {
|
|
8067
8069
|
const response = await fetch(fetchThemesUrl, { method: "GET" });
|
|
8068
|
-
return response.ok ? (await response.json()).themes
|
|
8070
|
+
return response.ok ? (await response.json()).themes.map((theme) => ({
|
|
8071
|
+
...theme,
|
|
8072
|
+
type: "user"
|
|
8073
|
+
})) : (console.warn(
|
|
8069
8074
|
`Failed to fetch themes: ${response.status} ${response.statusText}`
|
|
8070
8075
|
), []);
|
|
8071
8076
|
} catch (error2) {
|
|
@@ -10940,47 +10945,6 @@ function PromptActionSelector() {
|
|
|
10940
10945
|
] })
|
|
10941
10946
|
] }) });
|
|
10942
10947
|
}
|
|
10943
|
-
function ShadcnCliVersionSelector() {
|
|
10944
|
-
const { cliVersion, setCliVersion } = useAppState();
|
|
10945
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10946
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
10947
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium text-foreground text-sm", children: "Shadcn CLI version" }),
|
|
10948
|
-
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-xs", children: "Set your preferred shadcn CLI version." })
|
|
10949
|
-
] }),
|
|
10950
|
-
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
10951
|
-
/* @__PURE__ */ jsx(DropdownMenuButton, { children: /* @__PURE__ */ jsxs(
|
|
10952
|
-
Button,
|
|
10953
|
-
{
|
|
10954
|
-
size: "sm",
|
|
10955
|
-
variant: "ghost",
|
|
10956
|
-
className: "flex items-center gap-2 rounded-md text-xs",
|
|
10957
|
-
children: [
|
|
10958
|
-
cliVersion === "v2" && "v2",
|
|
10959
|
-
cliVersion === "v3" && "v3"
|
|
10960
|
-
]
|
|
10961
|
-
}
|
|
10962
|
-
) }),
|
|
10963
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { children: [
|
|
10964
|
-
/* @__PURE__ */ jsx(
|
|
10965
|
-
DropdownMenuButtonItem,
|
|
10966
|
-
{
|
|
10967
|
-
onClick: () => setCliVersion("v2"),
|
|
10968
|
-
className: "flex items-center gap-2",
|
|
10969
|
-
children: "v2"
|
|
10970
|
-
}
|
|
10971
|
-
),
|
|
10972
|
-
/* @__PURE__ */ jsx(
|
|
10973
|
-
DropdownMenuButtonItem,
|
|
10974
|
-
{
|
|
10975
|
-
onClick: () => setCliVersion("v3"),
|
|
10976
|
-
className: "flex items-center gap-2",
|
|
10977
|
-
children: "v3"
|
|
10978
|
-
}
|
|
10979
|
-
)
|
|
10980
|
-
] })
|
|
10981
|
-
] })
|
|
10982
|
-
] }) });
|
|
10983
|
-
}
|
|
10984
10948
|
function SettingsPanel() {
|
|
10985
10949
|
const { closeSettings } = usePanels();
|
|
10986
10950
|
return /* @__PURE__ */ jsxs(Panel, { children: [
|
|
@@ -11010,8 +10974,6 @@ function SettingsPanel() {
|
|
|
11010
10974
|
/* @__PURE__ */ jsx("hr", { className: "-mx-4 text-zinc-500/15 dark:text-zinc-500/30" }),
|
|
11011
10975
|
/* @__PURE__ */ jsx(CompactThemeToggle, {}),
|
|
11012
10976
|
/* @__PURE__ */ jsx("hr", { className: "-mx-4 text-zinc-500/15 dark:text-zinc-500/30" }),
|
|
11013
|
-
/* @__PURE__ */ jsx(ShadcnCliVersionSelector, {}),
|
|
11014
|
-
/* @__PURE__ */ jsx("hr", { className: "-mx-4 text-zinc-500/15 dark:text-zinc-500/30" }),
|
|
11015
10977
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
11016
10978
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11017
10979
|
/* @__PURE__ */ jsx("div", { className: "font-medium text-foreground text-sm", children: "Toggle chat" }),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as cn, E as cva, b as usePlugins } from "index-
|
|
2
|
-
import { B, x, z, D, y } from "index-
|
|
1
|
+
import { q as cn, E as cva, b as usePlugins } from "index-B0k7lxog.js";
|
|
2
|
+
import { B, x, z, D, y } from "index-B0k7lxog.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
const badgeVariants = cva("rounded-md p-2", {
|
|
5
5
|
variants: {
|
package/package.json
CHANGED