@getspot/spot-widget-vue 0.0.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,14 @@
1
+
2
+ > @getspot/spot-widget-vue@0.0.0 build /builds/getspot/spot-widget/packages/vue
3
+ > vite build
4
+
5
+ The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
6
+ vite v5.4.18 building for production...
7
+ transforming...
8
+ ✓ 2 modules transformed.
9
+ No name was provided for external module "@getspot/spot-widget" in "output.globals" – guessing "SpotWidget".
10
+ rendering chunks...
11
+ computing gzip size...
12
+ dist/vue-spot-widget.umd.js 0.80 kB │ gzip: 0.49 kB
13
+ dist/vue-spot-widget.es.js 0.80 kB │ gzip: 0.48 kB
14
+ ✓ built in 147ms
@@ -0,0 +1,37 @@
1
+ import s from "@getspot/spot-widget";
2
+ import { createElementBlock as c, openBlock as i } from "vue";
3
+ const p = (t, e) => {
4
+ const o = t.__vccOpts || t;
5
+ for (const [r, n] of e)
6
+ o[r] = n;
7
+ return o;
8
+ }, a = {
9
+ name: "VueSpotWidget",
10
+ props: {
11
+ options: {
12
+ type: Object,
13
+ default: () => ({})
14
+ }
15
+ },
16
+ mounted() {
17
+ try {
18
+ this.widget = new s({
19
+ ...this.options,
20
+ location: this.$refs.container
21
+ });
22
+ } catch (t) {
23
+ this.$emit("error", t);
24
+ }
25
+ },
26
+ beforeUnmount() {
27
+ var t, e;
28
+ (e = (t = this.widget) == null ? void 0 : t.destroy) == null || e.call(t);
29
+ }
30
+ }, d = { ref: "container" };
31
+ function f(t, e, o, r, n, _) {
32
+ return i(), c("div", d, null, 512);
33
+ }
34
+ const l = /* @__PURE__ */ p(a, [["render", f]]);
35
+ export {
36
+ l as default
37
+ };
@@ -0,0 +1 @@
1
+ (function(t,o){typeof exports=="object"&&typeof module<"u"?module.exports=o(require("@getspot/spot-widget"),require("vue")):typeof define=="function"&&define.amd?define(["@getspot/spot-widget","vue"],o):(t=typeof globalThis<"u"?globalThis:t||self,t.VueSpotWidget=o(t.SpotWidget,t.Vue))})(this,function(t,o){"use strict";const d=(e,n)=>{const i=e.__vccOpts||e;for(const[s,r]of n)i[s]=r;return i},p={name:"VueSpotWidget",props:{options:{type:Object,default:()=>({})}},mounted(){try{this.widget=new t({...this.options,location:this.$refs.container})}catch(e){this.$emit("error",e)}},beforeUnmount(){var e,n;(n=(e=this.widget)==null?void 0:e.destroy)==null||n.call(e)}},c={ref:"container"};function u(e,n,i,s,r,_){return o.openBlock(),o.createElementBlock("div",c,null,512)}return d(p,[["render",u]])});
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@getspot/spot-widget-vue",
3
+ "version": "0.0.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "dependencies": {
10
+ "@getspot/spot-widget": "0.0.0"
11
+ },
12
+ "peerDependencies": {
13
+ "vue": "^3.0.0"
14
+ },
15
+ "devDependencies": {
16
+ "vite": "^5.0.0",
17
+ "@vitejs/plugin-vue": "^5.0.0"
18
+ },
19
+ "scripts": {
20
+ "build": "vite build"
21
+ }
22
+ }
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div ref="container" />
3
+ </template>
4
+
5
+ <script>
6
+ import SpotWidget from "@getspot/spot-widget";
7
+
8
+ export default {
9
+ name: "VueSpotWidget",
10
+ props: {
11
+ options: {
12
+ type: Object,
13
+ default: () => ({}),
14
+ },
15
+ },
16
+ mounted() {
17
+ try {
18
+ this.widget = new SpotWidget({
19
+ ...this.options,
20
+ location: this.$refs.container,
21
+ });
22
+ } catch (err) {
23
+ this.$emit("error", err);
24
+ }
25
+ },
26
+ beforeUnmount() {
27
+ this.widget?.destroy?.();
28
+ },
29
+ };
30
+ </script>
package/vite.config.js ADDED
@@ -0,0 +1,24 @@
1
+ import { defineConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
3
+ import path from "path";
4
+
5
+ export default defineConfig({
6
+ plugins: [vue()],
7
+ build: {
8
+ outDir: "dist",
9
+ lib: {
10
+ entry: path.resolve(__dirname, "src/VueSpotWidget.vue"),
11
+ name: "VueSpotWidget",
12
+ fileName: (format) => `vue-spot-widget.${format}.js`,
13
+ formats: ["umd", "es"],
14
+ },
15
+ rollupOptions: {
16
+ external: ["vue", "@getspot/spot-widget"],
17
+ output: {
18
+ globals: {
19
+ vue: "Vue",
20
+ },
21
+ },
22
+ },
23
+ },
24
+ });