@stagewise-plugins/vue
Version:
> [!CAUTION] > This package is deprecated. > > There thus will be no further support or assistance with this version. > > Follow the guide in [the stagewise documentation](https://stagewise.io) to upgrade.
9 lines (6 loc) • 4.55 kB
JavaScript
'use client'
const plugin = {
mainPlugin: "import { jsxs as d, jsx as l } from \"react/jsx-runtime\";\nfunction $() {\n return /* @__PURE__ */ d(\n \"svg\",\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 261.76 226.69\",\n fill: \"currentColor\",\n children: [\n /* @__PURE__ */ l(\"title\", { children: \"Vue Logo\" }),\n /* @__PURE__ */ d(\n \"g\",\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n transform: \"matrix(1.3333 0 0 -1.3333 -76.311 313.34)\",\n children: [\n /* @__PURE__ */ l(\"g\", { transform: \"translate(178.06 235.01)\", fillOpacity: \"0.5\", children: /* @__PURE__ */ l(\"path\", { d: \"m0 0-22.669-39.264-22.669 39.264h-75.491l98.16-170.02 98.16 170.02z\" }) }),\n /* @__PURE__ */ l(\"g\", { transform: \"translate(178.06 235.01)\", \"fill-opacity\": \"1\", children: /* @__PURE__ */ l(\"path\", { d: \"m0 0-22.669-39.264-22.669 39.264h-36.227l58.896-102.01 58.896 102.01z\" }) })\n ]\n }\n )\n ]\n }\n );\n}\nlet g = !1;\nfunction v(n) {\n const t = {};\n for (const e of Object.getOwnPropertyNames(n))\n t[e] = n[e];\n return t;\n}\nfunction x(n) {\n const t = v(n);\n return y(n, t);\n}\nfunction V(n) {\n return y(null, n.ownProperties);\n}\nfunction y(n, t) {\n var _, f;\n if (!t && !n)\n return null;\n const e = [], p = 3, i = t || v(n), m = i.__vueParentComponent;\n if ((_ = m == null ? void 0 : m.type) != null && _.__name) {\n const o = m.type.__name;\n e.some((r) => r.name === o) || e.push({ name: o, type: \"regular\" });\n }\n let c = [];\n i.__vms__ && Array.isArray(i.__vms__) ? c = i.__vms__ : i.__vue__ && (c = [i.__vue__]);\n for (const o of c) {\n if (!o || !o.$options) continue;\n let r = o.$options.name || o.$options.__file || o.$options._componentTag || \"AnonymousComponent\";\n r && typeof r == \"string\" && r.includes(\"/\") && (r = (String(r).split(\"/\").pop() || \"\").replace(/\\.vue$/, \"\")), e.some((u) => u.name === r) || e.push({ name: r, type: \"regular\" });\n }\n if (n && e.length < p) {\n let o = n.parentElement;\n for (; o && e.length < p; ) {\n const r = o.__vueParentComponent;\n if ((f = r == null ? void 0 : r.type) != null && f.__name) {\n const a = r.type.__name;\n e.some((s) => s.name === a) || e.push({ name: a, type: \"regular\" });\n }\n let u = [];\n o.__vms__ && Array.isArray(o.__vms__) ? u = o.__vms__ : o.__vue__ && (u = [o.__vue__]);\n for (const a of u) {\n if (!a || !a.$options) continue;\n let s = a.$options.name || a.$options.__file || a.$options._componentTag || \"AnonymousComponent\";\n s && typeof s == \"string\" && s.includes(\"/\") && (s = (String(s).split(\"/\").pop() || \"\").replace(/\\.vue$/, \"\")), e.some((w) => w.name === s) || e.push({ name: s, type: \"regular\" });\n }\n o = o.parentElement;\n }\n }\n return e.length === 0 && !g && (console.warn(\n \"[stagewise/vue] No Vue installation detected on the selected element. Make sure you are running in development mode and Vue is available.\"\n ), g = !0), e.length > 0 ? e : null;\n}\nfunction h(n) {\n const t = x(n);\n return t != null && t[0] ? {\n annotation: `${t[0].name}`\n } : { annotation: null };\n}\nfunction C(n) {\n const t = n.map(\n (e) => V(e)\n );\n return t.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.\n\n ${t.map((p, i) => `\n<element index=\"${i + 1}\">\n ${p.length === 0 ? \"No Vue component as parent detected\" : `Vue component tree (from closest to farthest, 3 closest elements): ${p.map((m) => `{name: ${m.name}, type: ${m.type}}`).join(\" child of \")}`}\n</element>\n `)}\n ` : null;\n}\nconst P = {\n displayName: \"Vue\",\n description: \"This plugin adds additional information and metadata for apps using Vue as an UI framework\",\n iconSvg: /* @__PURE__ */ l($, {}),\n pluginName: \"vue\",\n onContextElementHover: h,\n onContextElementSelect: h,\n onPromptSend: (n) => {\n const t = C(n.metadata.selectedElements);\n return t ? {\n contextSnippets: [\n {\n promptContextName: \"elements-vue-component-info\",\n content: t\n }\n ]\n } : { contextSnippets: [] };\n }\n};\nexport {\n P as default\n};\n",
loader: true
}
export default plugin;