shadcn-studio-extension-cli 0.1.11 → 0.2.1

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,6 +1,6 @@
1
1
  {
2
- "_index-CcQR8qhj.js": {
3
- "file": "index-CcQR8qhj.js",
2
+ "_index-B0k7lxog.js": {
3
+ "file": "index-B0k7lxog.js",
4
4
  "name": "index"
5
5
  },
6
6
  "src/index.ts": {
@@ -9,7 +9,7 @@
9
9
  "src": "src/index.ts",
10
10
  "isEntry": true,
11
11
  "imports": [
12
- "_index-CcQR8qhj.js"
12
+ "_index-B0k7lxog.js"
13
13
  ]
14
14
  },
15
15
  "src/plugin-sdk/index.tsx": {
@@ -18,7 +18,7 @@
18
18
  "src": "src/plugin-sdk/index.tsx",
19
19
  "isEntry": true,
20
20
  "imports": [
21
- "_index-CcQR8qhj.js"
21
+ "_index-B0k7lxog.js"
22
22
  ]
23
23
  },
24
24
  "style.css": {
@@ -3038,7 +3038,7 @@ var baseSelectedElementSchema = external_exports.object({
3038
3038
  installationCommand: external_exports.string().describe("The installation command for the theme.")
3039
3039
  }), promptActionSchema = external_exports.enum(["copy", "send", "both"]).describe(
3040
3040
  "Action to take when triggering the prompt: copy to clipboard only, send to IDE only, or both"
3041
- ), CliVersionSchema = external_exports.enum(["v3", "v2"]).describe("The version of the Shadcn CLI used."), userMessageMetadataSchema = external_exports.object({
3041
+ ), userMessageMetadataSchema = external_exports.object({
3042
3042
  currentUrl: external_exports.string().max(1024).url().nullable(),
3043
3043
  currentTitle: external_exports.string().max(256).nullable(),
3044
3044
  currentZoomLevel: external_exports.number(),
@@ -3055,8 +3055,7 @@ var baseSelectedElementSchema = external_exports.object({
3055
3055
  selectedThemes: external_exports.array(selectedThemeSchema).max(20).describe("Selected themes"),
3056
3056
  selectedDocs: external_exports.array(selectedDocSchema).max(20).describe("Selected documentation items"),
3057
3057
  selectedBlocks: external_exports.array(selectedBlockSchema).max(20).describe("Selected code blocks"),
3058
- promptAction: promptActionSchema.optional().default("send").describe("Action to take when triggering the prompt"),
3059
- cliVersion: CliVersionSchema.default("v3").describe("The version of the Shadcn CLI used.")
3058
+ promptAction: promptActionSchema.optional().default("send").describe("Action to take when triggering the prompt")
3060
3059
  }), userMessageContentItemSchema = external_exports.discriminatedUnion("type", [
3061
3060
  external_exports.object({
3062
3061
  type: external_exports.literal("text"),
@@ -8303,20 +8302,20 @@ const generateId = (length = 16) => Math.random().toString(36).substring(2, leng
8303
8302
  console.warn("Failed to get license data:", error);
8304
8303
  }
8305
8304
  return { email: null, licenseKey: null };
8306
- }, getSelectedBlockInfo = (block, cliVersion) => {
8307
- const { email, licenseKey } = getLicenseDataFromStorage(), blockInstallationCmd = cliVersion === "v3" ? `npx shadcn@latest add @ss-blocks/${block.name}` : `npx shadcn@latest add "https://shadcnstudio.com/r/blocks/${block.name}.json?email=${email}&license_key=${licenseKey}"`;
8305
+ }, getSelectedBlockInfo = (block) => {
8306
+ const blockInstallationCmd = `npx shadcn@latest add @ss-blocks/${block.name}`;
8308
8307
  return {
8309
8308
  name: block.name,
8310
8309
  description: block.description,
8311
8310
  installationCommand: blockInstallationCmd
8312
8311
  };
8313
- }, getSelectedThemeInfo = (theme, cliVersion) => {
8314
- const { email, licenseKey } = getLicenseDataFromStorage(), themeInstallCommand = cliVersion === "v3" ? `npx shadcn@latest add @ss-themes/${theme.name}` : `npx shadcn@latest add "https://shadcnstudio.com/r/themes/${theme.name}.json?email=${email}&license_key=${licenseKey}"`;
8312
+ }, getSelectedThemeInfo = (theme) => {
8313
+ const { email, licenseKey } = getLicenseDataFromStorage(), themeInstallCommand = theme.type === "user" ? email && licenseKey ? `npx shadcn@latest apply "https://shadcnstudio.com/r/themes/${theme.name}.json?email=${email}&license_key=${licenseKey}"` : `npx shadcn@latest apply "https://shadcnstudio.com/r/themes/${theme.name}.json"` : `npx shadcn@latest apply "https://shadcnstudio.com/r/themes/${theme.name}.json"`;
8315
8314
  return {
8316
8315
  name: theme.name,
8317
8316
  installationCommand: themeInstallCommand
8318
8317
  };
8319
- }, collectUserMessageMetadata = (selectedElements, selectedDocs = [], selectedBlocks = [], selectedThemes = [], promptAction = "both", cliVersion = "v3") => {
8318
+ }, collectUserMessageMetadata = (selectedElements, selectedDocs = [], selectedBlocks = [], selectedThemes = [], promptAction = "both") => {
8320
8319
  const iframeWindow = getIFrameWindow();
8321
8320
  return {
8322
8321
  currentUrl: truncateString(iframeWindow == null ? void 0 : iframeWindow.location.href, 1024),
@@ -8330,7 +8329,6 @@ const generateId = (length = 16) => Math.random().toString(36).substring(2, leng
8330
8329
  selectedBlocks,
8331
8330
  selectedThemes,
8332
8331
  promptAction,
8333
- cliVersion,
8334
8332
  viewportResolution: {
8335
8333
  width: iframeWindow == null ? void 0 : iframeWindow.innerWidth,
8336
8334
  height: iframeWindow == null ? void 0 : iframeWindow.innerHeight
@@ -8345,8 +8343,7 @@ function loadStateFromStorage() {
8345
8343
  return {
8346
8344
  minimized: parsed.minimized,
8347
8345
  theme: parsed.theme,
8348
- promptAction: parsed.promptAction,
8349
- cliVersion: parsed.cliVersion
8346
+ promptAction: parsed.promptAction
8350
8347
  };
8351
8348
  } catch (error) {
8352
8349
  return console.error("Failed to load state from storage:", error), {};
@@ -8372,7 +8369,6 @@ function AppStateProvider({ children }) {
8372
8369
  minimized: storedState.minimized ?? !1,
8373
8370
  theme: storedState.theme ?? "system",
8374
8371
  promptAction: storedState.promptAction ?? "send",
8375
- cliVersion: storedState.cliVersion ?? "v3",
8376
8372
  requestMainAppBlock: () => 0,
8377
8373
  // These will be replaced by the actual implementations
8378
8374
  requestMainAppUnblock: () => 0,
@@ -8391,8 +8387,6 @@ function AppStateProvider({ children }) {
8391
8387
  setTheme: () => {
8392
8388
  },
8393
8389
  setPromptAction: () => {
8394
- },
8395
- setCliVersion: () => {
8396
8390
  }
8397
8391
  };
8398
8392
  });
@@ -8468,8 +8462,6 @@ function AppStateProvider({ children }) {
8468
8462
  setState((prev) => ({ ...prev, theme }));
8469
8463
  }, []), setPromptAction = useCallback((promptAction) => {
8470
8464
  setState((prev) => ({ ...prev, promptAction }));
8471
- }, []), setCliVersion = useCallback((cliVersion) => {
8472
- setState((prev) => ({ ...prev, cliVersion }));
8473
8465
  }, []), value = {
8474
8466
  requestMainAppBlock,
8475
8467
  requestMainAppUnblock,
@@ -8485,9 +8477,7 @@ function AppStateProvider({ children }) {
8485
8477
  theme: state.theme,
8486
8478
  setTheme,
8487
8479
  promptAction: state.promptAction,
8488
- setPromptAction,
8489
- cliVersion: state.cliVersion,
8490
- setCliVersion
8480
+ setPromptAction
8491
8481
  };
8492
8482
  return /* @__PURE__ */ jsx(AppContext.Provider, { value, children });
8493
8483
  }
@@ -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-CcQR8qhj.js";
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, cliVersion } = useAppState(), startPromptCreation = useCallback(() => {
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, cliVersion))
146
+ selectedBlocks.map((block) => getSelectedBlockInfo(block))
147
147
  ), selectedThemesInfo = selectedThemes.map(
148
- (theme) => getSelectedThemeInfo(theme, cliVersion)
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(),
@@ -7129,7 +7128,7 @@ const performLocalSearch = (blocks, query) => {
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)
@@ -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 : (console.warn(
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) {
@@ -8062,10 +8064,13 @@ const fetchGenericThemesFromAPI = async () => {
8062
8064
  console.error("Failed to fetch plan variant:", error2);
8063
8065
  }
8064
8066
  }, fetchUserThemesFromAPI = async () => {
8065
- const { email, licenseKey } = getLicenseDataFromStorage(), fetchThemesUrl = `https://shadcnstudio.com/api/user-themes?email=${email}&license_key=${licenseKey}&is_extension=true`;
8067
+ const { email, licenseKey } = getLicenseDataFromStorage(), fetchThemesUrl = `https://shadcnstudio.com/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 : (console.warn(
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-CcQR8qhj.js";
2
- import { B, x, z, D, y } from "index-CcQR8qhj.js";
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
@@ -2,7 +2,7 @@
2
2
  "name": "shadcn-studio-extension-cli",
3
3
  "module": "src/index.ts",
4
4
  "type": "module",
5
- "version": "0.1.11",
5
+ "version": "0.2.1",
6
6
  "description": "Shadcn/Studio Extension CLI",
7
7
  "author": "stagewise GmbH",
8
8
  "license": "AGPL-3.0-only",