shadcn-studio-extension-cli 0.1.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.
@@ -0,0 +1,112 @@
1
+ import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
+ function g() {
3
+ return /* @__PURE__ */ c(
4
+ "svg",
5
+ {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ viewBox: "0 0 960 960",
8
+ fill: "currentColor",
9
+ stroke: "currentColor",
10
+ children: [
11
+ /* @__PURE__ */ a("title", { children: "Angular Logo" }),
12
+ /* @__PURE__ */ c("g", { children: [
13
+ /* @__PURE__ */ a("polygon", { points: "562.6,109.8 804.1,629.5 829.2,233.1 " }),
14
+ /* @__PURE__ */ a("polygon", { points: "624.9,655.9 334.3,655.9 297.2,745.8 479.6,849.8 662,745.8 " }),
15
+ /* @__PURE__ */ a("polygon", { points: "384.1,539.3 575.2,539.3 479.6,307 " }),
16
+ /* @__PURE__ */ a("polygon", { points: "396.6,109.8 130,233.1 155.1,629.5 " })
17
+ ] })
18
+ ]
19
+ }
20
+ );
21
+ }
22
+ function f() {
23
+ const n = document.getElementById(
24
+ "user-app-iframe"
25
+ );
26
+ return n ? n.contentWindow : null;
27
+ }
28
+ function d(n) {
29
+ const e = {};
30
+ for (const t of Object.getOwnPropertyNames(n))
31
+ e[t] = n[t];
32
+ return e;
33
+ }
34
+ function h(n) {
35
+ const e = d(n);
36
+ return u(e, n);
37
+ }
38
+ function w(n) {
39
+ return u(n.ownProperties, null);
40
+ }
41
+ function u(n, e) {
42
+ const t = f();
43
+ if (!t || !t.ng || !t.ng.getComponent)
44
+ return [];
45
+ const o = [];
46
+ let r = e;
47
+ const s = 3;
48
+ if (r)
49
+ for (; r && o.length < s; ) {
50
+ try {
51
+ const l = t.ng.getComponent(r);
52
+ if (l) {
53
+ let i = l.constructor.name;
54
+ i.startsWith("_") && (i = i.substring(1)), i && i !== "Object" && (o.some((p) => p.name === i) || o.push({ name: i }));
55
+ }
56
+ } catch {
57
+ }
58
+ if (r.parentElement && r.parentElement !== document.body)
59
+ r = r.parentElement;
60
+ else
61
+ break;
62
+ }
63
+ return o;
64
+ }
65
+ function m(n) {
66
+ if (!n)
67
+ return { annotation: null };
68
+ const e = h(n);
69
+ return e.length > 0 && e[0] ? {
70
+ annotation: `${e[0].name}`
71
+ } : { annotation: null };
72
+ }
73
+ function y(n) {
74
+ if (!n || n.length === 0)
75
+ return null;
76
+ const e = n.map(
77
+ (t) => w(t)
78
+ );
79
+ return e.some((t) => t.length > 0) ? `This is additional information on the elements that the user selected. Use this information to find the correct element in the codebase.
80
+
81
+ ${e.map((o, r) => {
82
+ const s = o.length === 0 ? "No Angular component detected for this element" : `Angular component tree (from closest to farthest, ${o.length} closest element${o.length > 1 ? "s" : ""}): ${o.map((l) => `{name: ${l.name}}`).join(" child of ")}`;
83
+ return `
84
+ <element index="${r + 1}">
85
+ ${s}
86
+ </element>
87
+ `;
88
+ }).join("")}
89
+ ` : null;
90
+ }
91
+ const A = {
92
+ displayName: "Angular",
93
+ description: "This plugin adds additional information and metadata for apps using Angular as a UI framework",
94
+ iconSvg: /* @__PURE__ */ a(g, {}),
95
+ pluginName: "angular",
96
+ onContextElementHover: m,
97
+ onContextElementSelect: m,
98
+ onPromptSend: (n) => {
99
+ const e = y(n.metadata.selectedElements);
100
+ return e ? {
101
+ contextSnippets: [
102
+ {
103
+ promptContextName: "elements-angular-component-info",
104
+ content: e
105
+ }
106
+ ]
107
+ } : { contextSnippets: [] };
108
+ }
109
+ };
110
+ export {
111
+ A as default
112
+ };
@@ -0,0 +1,88 @@
1
+ import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
+ function u() {
3
+ return /* @__PURE__ */ l(
4
+ "svg",
5
+ {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ viewBox: "-11.5 -10.23174 23 20.46348",
8
+ children: [
9
+ /* @__PURE__ */ a("title", { children: "React Logo" }),
10
+ /* @__PURE__ */ a("circle", { cx: "0", cy: "0", r: "2.05", fill: "currentColor" }),
11
+ /* @__PURE__ */ l("g", { stroke: "currentColor", strokeWidth: "1", fill: "none", children: [
12
+ /* @__PURE__ */ a("ellipse", { rx: "11", ry: "4.2" }),
13
+ /* @__PURE__ */ a("ellipse", { rx: "11", ry: "4.2", transform: "rotate(60)" }),
14
+ /* @__PURE__ */ a("ellipse", { rx: "11", ry: "4.2", transform: "rotate(120)" })
15
+ ] })
16
+ ]
17
+ }
18
+ );
19
+ }
20
+ const d = 0, f = 1, g = 5;
21
+ function h(o) {
22
+ return p(o.ownProperties);
23
+ }
24
+ function p(o) {
25
+ if (!o)
26
+ return null;
27
+ const e = [], r = 3, s = Object.keys(o).find(
28
+ (n) => n.startsWith("__reactFiber$") || n.startsWith("__reactInternalInstance$")
29
+ );
30
+ if (!s)
31
+ return null;
32
+ let t = o[s];
33
+ if (!t)
34
+ return null;
35
+ for (; t && e.length < r; ) {
36
+ let n = null;
37
+ if (t.tag === f || t.tag === d) {
38
+ const i = t.type;
39
+ i && (n = { name: i.displayName || i.name || t._debugOwner?.name || // Check direct name on fiber
40
+ "AnonymousComponent", type: "regular" });
41
+ } else t.tag === g && t._debugOwner && t._debugOwner.env?.toLowerCase().includes("server") && (n = { name: t._debugOwner.name, type: "rsc" });
42
+ n && (e.some(
43
+ (c) => c.name === n.name && c.type === n.type
44
+ ) || e.push(n)), t = t.return;
45
+ }
46
+ return e.length > 0 ? e : null;
47
+ }
48
+ function m(o) {
49
+ const e = p(o);
50
+ return e?.[0] ? {
51
+ annotation: `${e[0].name}${e[0].type === "rsc" ? " (RSC)" : ""}`
52
+ } : { annotation: null };
53
+ }
54
+ function y(o) {
55
+ const e = o.map(
56
+ (r) => h(r)
57
+ );
58
+ return e.some((r) => r && r.length > 0) ? `This is additional information on the elements that the user selected. Use this information to find the correct element in the codebase.
59
+
60
+ ${e.map((s, t) => `
61
+ <element index="${t + 1}">
62
+ ${s.length === 0 ? "No React component as parent detected" : `React component tree (from closest to farthest, 3 closest elements): ${s.map((n) => `{name: ${n.name}, type: ${n.type}}`).join(" child of ")}`}
63
+ </element>
64
+ `)}
65
+ ` : null;
66
+ }
67
+ const C = {
68
+ displayName: "React",
69
+ description: "This plugin adds additional information and metadata for apps using React as a UI framework",
70
+ iconSvg: /* @__PURE__ */ a(u, {}),
71
+ pluginName: "react",
72
+ onContextElementHover: m,
73
+ onContextElementSelect: m,
74
+ onPromptSend: (o) => {
75
+ const e = y(o.metadata.selectedElements);
76
+ return e ? {
77
+ contextSnippets: [
78
+ {
79
+ promptContextName: "elements-react-component-info",
80
+ content: e
81
+ }
82
+ ]
83
+ } : { contextSnippets: [] };
84
+ }
85
+ };
86
+ export {
87
+ C as default
88
+ };
@@ -0,0 +1,117 @@
1
+ import { jsxs as _, jsx as m } from "react/jsx-runtime";
2
+ function y() {
3
+ return /* @__PURE__ */ _(
4
+ "svg",
5
+ {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ viewBox: "0 0 261.76 226.69",
8
+ fill: "currentColor",
9
+ children: [
10
+ /* @__PURE__ */ m("title", { children: "Vue Logo" }),
11
+ /* @__PURE__ */ _(
12
+ "g",
13
+ {
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ transform: "matrix(1.3333 0 0 -1.3333 -76.311 313.34)",
16
+ children: [
17
+ /* @__PURE__ */ m("g", { transform: "translate(178.06 235.01)", fillOpacity: "0.5", children: /* @__PURE__ */ m("path", { d: "m0 0-22.669-39.264-22.669 39.264h-75.491l98.16-170.02 98.16 170.02z" }) }),
18
+ /* @__PURE__ */ m("g", { transform: "translate(178.06 235.01)", "fill-opacity": "1", children: /* @__PURE__ */ m("path", { d: "m0 0-22.669-39.264-22.669 39.264h-36.227l58.896-102.01 58.896 102.01z" }) })
19
+ ]
20
+ }
21
+ )
22
+ ]
23
+ }
24
+ );
25
+ }
26
+ let f = !1;
27
+ function g(n) {
28
+ const o = {};
29
+ for (const e of Object.getOwnPropertyNames(n))
30
+ o[e] = n[e];
31
+ return o;
32
+ }
33
+ function w(n) {
34
+ const o = g(n);
35
+ return h(n, o);
36
+ }
37
+ function $(n) {
38
+ return h(null, n.ownProperties);
39
+ }
40
+ function h(n, o) {
41
+ if (!o && !n)
42
+ return null;
43
+ const e = [], l = 3, s = o || g(n), p = s.__vueParentComponent;
44
+ if (p?.type?.__name) {
45
+ const t = p.type.__name;
46
+ e.some((r) => r.name === t) || e.push({ name: t, type: "regular" });
47
+ }
48
+ let u = [];
49
+ s.__vms__ && Array.isArray(s.__vms__) ? u = s.__vms__ : s.__vue__ && (u = [s.__vue__]);
50
+ for (const t of u) {
51
+ if (!t || !t.$options) continue;
52
+ let r = t.$options.name || t.$options.__file || t.$options._componentTag || "AnonymousComponent";
53
+ r && typeof r == "string" && r.includes("/") && (r = (String(r).split("/").pop() || "").replace(/\.vue$/, "")), e.some((c) => c.name === r) || e.push({ name: r, type: "regular" });
54
+ }
55
+ if (n && e.length < l) {
56
+ let t = n.parentElement;
57
+ for (; t && e.length < l; ) {
58
+ const r = t.__vueParentComponent;
59
+ if (r?.type?.__name) {
60
+ const a = r.type.__name;
61
+ e.some((i) => i.name === a) || e.push({ name: a, type: "regular" });
62
+ }
63
+ let c = [];
64
+ t.__vms__ && Array.isArray(t.__vms__) ? c = t.__vms__ : t.__vue__ && (c = [t.__vue__]);
65
+ for (const a of c) {
66
+ if (!a || !a.$options) continue;
67
+ let i = a.$options.name || a.$options.__file || a.$options._componentTag || "AnonymousComponent";
68
+ i && typeof i == "string" && i.includes("/") && (i = (String(i).split("/").pop() || "").replace(/\.vue$/, "")), e.some((v) => v.name === i) || e.push({ name: i, type: "regular" });
69
+ }
70
+ t = t.parentElement;
71
+ }
72
+ }
73
+ return e.length === 0 && !f && (console.warn(
74
+ "[stagewise/vue] No Vue installation detected on the selected element. Make sure you are running in development mode and Vue is available."
75
+ ), f = !0), e.length > 0 ? e : null;
76
+ }
77
+ function d(n) {
78
+ const o = w(n);
79
+ return o?.[0] ? {
80
+ annotation: `${o[0].name}`
81
+ } : { annotation: null };
82
+ }
83
+ function C(n) {
84
+ const o = n.map(
85
+ (e) => $(e)
86
+ );
87
+ return o.some((e) => e && e.length > 0) ? `This is additional information on the elements that the user selected. Use this information to find the correct element in the codebase.
88
+
89
+ ${o.map((l, s) => `
90
+ <element index="${s + 1}">
91
+ ${l.length === 0 ? "No Vue component as parent detected" : `Vue component tree (from closest to farthest, 3 closest elements): ${l.map((p) => `{name: ${p.name}, type: ${p.type}}`).join(" child of ")}`}
92
+ </element>
93
+ `)}
94
+ ` : null;
95
+ }
96
+ const V = {
97
+ displayName: "Vue",
98
+ description: "This plugin adds additional information and metadata for apps using Vue as an UI framework",
99
+ iconSvg: /* @__PURE__ */ m(y, {}),
100
+ pluginName: "vue",
101
+ onContextElementHover: d,
102
+ onContextElementSelect: d,
103
+ onPromptSend: (n) => {
104
+ const o = C(n.metadata.selectedElements);
105
+ return o ? {
106
+ contextSnippets: [
107
+ {
108
+ promptContextName: "elements-vue-component-info",
109
+ content: o
110
+ }
111
+ ]
112
+ } : { contextSnippets: [] };
113
+ }
114
+ };
115
+ export {
116
+ V as default
117
+ };
@@ -0,0 +1,28 @@
1
+ {
2
+ "_index-DZzSFjno.js": {
3
+ "file": "index-DZzSFjno.js",
4
+ "name": "index"
5
+ },
6
+ "src/index.ts": {
7
+ "file": "index.js",
8
+ "name": "index",
9
+ "src": "src/index.ts",
10
+ "isEntry": true,
11
+ "imports": [
12
+ "_index-DZzSFjno.js"
13
+ ]
14
+ },
15
+ "src/plugin-sdk/index.tsx": {
16
+ "file": "plugin-sdk.js",
17
+ "name": "plugin-sdk",
18
+ "src": "src/plugin-sdk/index.tsx",
19
+ "isEntry": true,
20
+ "imports": [
21
+ "_index-DZzSFjno.js"
22
+ ]
23
+ },
24
+ "style.css": {
25
+ "file": "toolbar.css",
26
+ "src": "style.css"
27
+ }
28
+ }