@usecsv/vuejs 1.0.0 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.0.1](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.0.0...v1.0.1) (2022-02-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * rename component to UseCSVButton ([fe32bf6](https://github.com/layercodedev/usecsv-vuejs-plugin/commit/fe32bf678a14b08112370f907088c93433fcde59))
7
+
1
8
  # 1.0.0 (2022-02-14)
2
9
 
3
10
 
@@ -591,7 +591,7 @@ var useCsvPlugin = function (_a) {
591
591
  };
592
592
 
593
593
  var script = /*#__PURE__*/Vue.extend({
594
- name: "use-csv",
594
+ name: "usecsv-button",
595
595
 
596
596
  data() {
597
597
  return {
@@ -757,9 +757,7 @@ var __vue_render__ = function () {
757
757
 
758
758
  return _c('div', {
759
759
  staticClass: "usecsv"
760
- }, [_vm.hasScopedSlot() ? _c('div', [_vm._t("default", function () {
761
- return [_vm._v(" open usecsv ")];
762
- }, {
760
+ }, [_vm.hasScopedSlot() ? _c('div', [_vm._t("default", null, {
763
761
  "onclick": _vm.onclick
764
762
  })], 2) : _c('div', [_c('button', {
765
763
  attrs: {
@@ -779,8 +777,8 @@ var __vue_staticRenderFns__ = [];
779
777
 
780
778
  const __vue_inject_styles__ = function (inject) {
781
779
  if (!inject) return;
782
- inject("data-v-d2ea7b16_0", {
783
- source: "#usecsv-button[data-v-d2ea7b16]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
780
+ inject("data-v-4a1a9ae2_0", {
781
+ source: "#usecsv-button[data-v-4a1a9ae2]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
784
782
  map: undefined,
785
783
  media: undefined
786
784
  });
@@ -788,7 +786,7 @@ const __vue_inject_styles__ = function (inject) {
788
786
  /* scoped */
789
787
 
790
788
 
791
- const __vue_scope_id__ = "data-v-d2ea7b16";
789
+ const __vue_scope_id__ = "data-v-4a1a9ae2";
792
790
  /* module identifier */
793
791
 
794
792
  const __vue_module_identifier__ = undefined;
@@ -815,7 +813,7 @@ var entry_esm = /*#__PURE__*/(() => {
815
813
  const installable = component; // Attach install function executed by Vue.use()
816
814
 
817
815
  installable.install = Vue => {
818
- Vue.component('use-csv', installable);
816
+ Vue.component('usecsv-button', installable);
819
817
  };
820
818
 
821
819
  return installable;
@@ -1,6 +1,6 @@
1
- var Usecsv=function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,r,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}
1
+ var UseCSVButton=function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,r,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}
2
2
  /*!
3
3
  * @usecsv/js v0.1.0
4
4
  * (c) layercode
5
5
  * Released under the MIT License.
6
- */()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var i=[],s=[];function a(e,t){if(t=t||{},void 0===e)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,o=!0===t.prepend?"prepend":"append",r=void 0!==t.container?t.container:document.querySelector("head"),a=i.indexOf(r);return-1===a&&(a=i.push(r)-1,s[a]={}),void 0!==s[a]&&void 0!==s[a][o]?n=s[a][o]:(n=s[a][o]=function(){var e=document.createElement("style");return e.setAttribute("type","text/css"),e}(),"prepend"===o?r.insertBefore(n,r.childNodes[0]):r.appendChild(n)),65279===e.charCodeAt(0)&&(e=e.substr(1,e.length)),n.styleSheet?n.styleSheet.cssText+=e:n.textContent+=e,n}var c,d,l,u,f,m=a;a.insertCss=m,function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(c||(c={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(d||(d={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(l||(l={})),function(e){e.DataCloneError="DataCloneError"}(u||(u={})),function(e){e.Message="message"}(f||(f={}));const p={"http:":"80","https:":"443"},h=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,v=["file:","data:"];const g=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});let y=0;var S=()=>++y,b=(e,t,n,o,r)=>{const{localName:i,local:s,remote:a,originForSending:u,originForReceiving:m}=t;let p=!1;r(`${i}: Connecting call sender`);const h=e=>(...t)=>{let n;r(`${i}: Sending ${e}() call`);try{a.closed&&(n=!0)}catch(e){n=!0}if(n&&o(),p){const t=new Error(`Unable to send ${e}() call due to destroyed connection`);throw t.code=l.ConnectionDestroyed,t}return new Promise(((n,o)=>{const l=S(),p=t=>{if(t.source!==a||t.data.penpal!==c.Reply||t.data.id!==l)return;if(t.origin!==m)return void r(`${i} received message from origin ${t.origin} which did not match expected origin ${m}`);const u=t.data;r(`${i}: Received ${e}() reply`),s.removeEventListener(f.Message,p);let h=u.returnValue;u.returnValueIsError&&(h=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(h)),(u.resolution===d.Fulfilled?n:o)(h)};s.addEventListener(f.Message,p);const h={penpal:c.Call,id:l,methodName:e,args:t};a.postMessage(h,u)}))};return n.reduce(((e,t)=>(e[t]=h(t),e)),e),()=>{p=!0}},C=(e,t,n,o,r)=>{const{destroy:i,onDestroy:s}=o;let a,l;const m={};return o=>{if(o.origin!==t)return void r(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${t}`);r("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:n,originForReceiving:t};a&&a(),a=((e,t,n)=>{const{localName:o,local:r,remote:i,originForSending:s,originForReceiving:a}=e;let l=!1;const m=e=>{if(e.source!==i||e.data.penpal!==c.Call)return;if(e.origin!==a)return void n(`${o} received message from origin ${e.origin} which did not match expected origin ${a}`);const r=e.data,{methodName:f,args:m,id:p}=r;n(`${o}: Received ${f}() call`);const h=e=>t=>{if(n(`${o}: Sending ${f}() reply`),l)return void n(`${o}: Unable to send ${f}() reply due to destroyed connection`);const r={penpal:c.Reply,id:p,resolution:e,returnValue:t};e===d.Rejected&&t instanceof Error&&(r.returnValue=g(t),r.returnValueIsError=!0);try{i.postMessage(r,s)}catch(e){if(e.name===u.DataCloneError){const t={penpal:c.Reply,id:p,resolution:d.Rejected,returnValue:g(e),returnValueIsError:!0};i.postMessage(t,s)}throw e}};new Promise((e=>e(t[f].apply(t,m)))).then(h(d.Fulfilled),h(d.Rejected))};return r.addEventListener(f.Message,m),()=>{l=!0,r.removeEventListener(f.Message,m)}})(p,e,r),s(a),l&&l.forEach((e=>{delete m[e]})),l=o.data.methodNames;const h=b(m,p,l,i,r);return s(h),m}};var $=e=>{let{iframe:t,methods:n={},childOrigin:o,timeout:r,debug:i=!1}=e;const s=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),a=((e,t)=>{const n=[];let o=!1;return{destroy(r){o||(o=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(r)})))},onDestroy(e){o?e():n.push(e)}}})("Parent",s),{onDestroy:d,destroy:u}=a;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=l.NoIframeSrc,e}})(t),o=(e=>{if(e&&v.find((t=>e.startsWith(t))))return"null";const t=document.location,n=h.exec(e);let o,r,i;return n?(o=n[1]?n[1]:t.protocol,r=n[2],i=n[4]):(o=t.protocol,r=t.hostname,i=t.port),`${o}//${r}${i&&i!==p[o]?`:${i}`:""}`})(t.src));const m="null"===o?"*":o,g=((e,t,n,o)=>r=>{if(r.origin!==n)return void e(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${n}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const i={penpal:c.SynAck,methodNames:Object.keys(t)};r.source.postMessage(i,o)})(s,n,o,m),y=C(n,o,m,a,s),S=new Promise(((e,n)=>{const o=((e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=l.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}})(r,u),i=n=>{if(n.source===t.contentWindow&&n.data)if(n.data.penpal!==c.Syn)if(n.data.penpal!==c.Ack);else{const t=y(n);t&&(o(),e(t))}else g(n)};window.addEventListener(f.Message,i),s("Parent: Awaiting handshake"),((e,t)=>{const{destroy:n,onDestroy:o}=t,r=setInterval((()=>{e.isConnected||(clearInterval(r),n())}),6e4);o((()=>{clearInterval(r)}))})(t,a),d((e=>{window.removeEventListener(f.Message,i),e&&n(e)}))}));return{promise:S,destroy(){u()}}},w=["interactive","complete"],E=function(e,t){return new Promise((function(n){e&&"function"!=typeof e&&(t=e,e=null),t=t||window.document;var o=function(){return n(void(e&&setTimeout(e)))};-1!==w.indexOf(t.readyState)?o():t.addEventListener("DOMContentLoaded",o)}))};E.resume=function(e){return function(t){return E(e).then((function(){return t}))}};var _=function(e){var t=e.importerKey,n=e.user,o=e.metadata,r="usecsv-".concat(Math.round(1e8*Math.random()));return E().then((function(){var e=function(e){var t;m("\n .usecsv_container {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 100000;\n }\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n"),document.body.insertAdjacentHTML("beforeend","<div id=".concat(e,' class="usecsv_container loading">\n</div>'));var n=document.createElement("iframe");return n.setAttribute("src","https://app.usecsv.com/importer"),null===(t=document.getElementById(e))||void 0===t||t.appendChild(n),n}(r),i=$({iframe:e,methods:{closeIframe:function(){var e;null===(e=document.getElementById(r))||void 0===e||e.remove()}}});return i.promise.then((function(e){var i;null===(i=document.getElementById(r))||void 0===i||i.classList.remove("loading"),e.setParams&&e.setParams({importerKey:t,user:n,metadata:o})})),i}))},R=n.default.extend({name:"use-csv",data:function(){return{hasSlot:!!this.$slots.default}},methods:{onclick:function(){_({importerKey:this.importerKey,user:this.importerKey,metadata:this.metadata})},hasScopedSlot:function(){return console.log(this.$scopedSlots.default&&this.$scopedSlots.default.name),"normalized"===(this.$scopedSlots.default&&this.$scopedSlots.default.name)}}});function x(e,t,n,o,r,i,s,a,c,d){"boolean"!=typeof s&&(c=a,a=s,s=!1);const l="function"==typeof n?n.options:n;let u;if(e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,r&&(l.functional=!0)),o&&(l._scopeId=o),i?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),u)if(l.functional){const e=l.render;l.render=function(t,n){return u.call(n),e(t,n)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,u):[u]}return n}const k="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function A(e){return(e,t)=>function(e,t){const n=k?t.media||"default":e,o=I[n]||(I[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);let n=t.source;if(t.map&&(n+="\n/*# sourceURL="+t.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===N&&(N=document.head||document.getElementsByTagName("head")[0]),N.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(n),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{const e=o.ids.size-1,t=document.createTextNode(n),r=o.element.childNodes;r[e]&&o.element.removeChild(r[e]),r.length?o.element.insertBefore(t,r[e]):o.element.appendChild(t)}}}(e,t)}let N;const I={};var M=x({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"usecsv"},[e.hasScopedSlot()?n("div",[e._t("default",(function(){return[e._v(" open usecsv ")]}),{onclick:e.onclick})],2):n("div",[n("button",{attrs:{type:"button",id:"usecsv-button"},on:{click:e.onclick}},[e._t("default",(function(){return[e._v(" open usecsv ")]}))],2)])])},staticRenderFns:[]},(function(e){e&&e("data-v-d2ea7b16_0",{source:"#usecsv-button[data-v-d2ea7b16]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",map:void 0,media:void 0})}),R,"data-v-d2ea7b16",false,undefined,!1,A,void 0,void 0),j=function(){var e=M;return e.install=function(t){t.component("use-csv",e)},e}(),T=Object.freeze({__proto__:null,default:j});return Object.entries(T).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];"default"!==n&&(j[n]=r)})),j}(Vue);
6
+ */()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var i=[],s=[];function a(e,t){if(t=t||{},void 0===e)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,o=!0===t.prepend?"prepend":"append",r=void 0!==t.container?t.container:document.querySelector("head"),a=i.indexOf(r);return-1===a&&(a=i.push(r)-1,s[a]={}),void 0!==s[a]&&void 0!==s[a][o]?n=s[a][o]:(n=s[a][o]=function(){var e=document.createElement("style");return e.setAttribute("type","text/css"),e}(),"prepend"===o?r.insertBefore(n,r.childNodes[0]):r.appendChild(n)),65279===e.charCodeAt(0)&&(e=e.substr(1,e.length)),n.styleSheet?n.styleSheet.cssText+=e:n.textContent+=e,n}var c,d,l,u,f,m=a;a.insertCss=m,function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(c||(c={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(d||(d={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(l||(l={})),function(e){e.DataCloneError="DataCloneError"}(u||(u={})),function(e){e.Message="message"}(f||(f={}));const p={"http:":"80","https:":"443"},h=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,v=["file:","data:"];const g=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});let y=0;var S=()=>++y,b=(e,t,n,o,r)=>{const{localName:i,local:s,remote:a,originForSending:u,originForReceiving:m}=t;let p=!1;r(`${i}: Connecting call sender`);const h=e=>(...t)=>{let n;r(`${i}: Sending ${e}() call`);try{a.closed&&(n=!0)}catch(e){n=!0}if(n&&o(),p){const t=new Error(`Unable to send ${e}() call due to destroyed connection`);throw t.code=l.ConnectionDestroyed,t}return new Promise(((n,o)=>{const l=S(),p=t=>{if(t.source!==a||t.data.penpal!==c.Reply||t.data.id!==l)return;if(t.origin!==m)return void r(`${i} received message from origin ${t.origin} which did not match expected origin ${m}`);const u=t.data;r(`${i}: Received ${e}() reply`),s.removeEventListener(f.Message,p);let h=u.returnValue;u.returnValueIsError&&(h=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(h)),(u.resolution===d.Fulfilled?n:o)(h)};s.addEventListener(f.Message,p);const h={penpal:c.Call,id:l,methodName:e,args:t};a.postMessage(h,u)}))};return n.reduce(((e,t)=>(e[t]=h(t),e)),e),()=>{p=!0}},C=(e,t,n,o,r)=>{const{destroy:i,onDestroy:s}=o;let a,l;const m={};return o=>{if(o.origin!==t)return void r(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${t}`);r("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:n,originForReceiving:t};a&&a(),a=((e,t,n)=>{const{localName:o,local:r,remote:i,originForSending:s,originForReceiving:a}=e;let l=!1;const m=e=>{if(e.source!==i||e.data.penpal!==c.Call)return;if(e.origin!==a)return void n(`${o} received message from origin ${e.origin} which did not match expected origin ${a}`);const r=e.data,{methodName:f,args:m,id:p}=r;n(`${o}: Received ${f}() call`);const h=e=>t=>{if(n(`${o}: Sending ${f}() reply`),l)return void n(`${o}: Unable to send ${f}() reply due to destroyed connection`);const r={penpal:c.Reply,id:p,resolution:e,returnValue:t};e===d.Rejected&&t instanceof Error&&(r.returnValue=g(t),r.returnValueIsError=!0);try{i.postMessage(r,s)}catch(e){if(e.name===u.DataCloneError){const t={penpal:c.Reply,id:p,resolution:d.Rejected,returnValue:g(e),returnValueIsError:!0};i.postMessage(t,s)}throw e}};new Promise((e=>e(t[f].apply(t,m)))).then(h(d.Fulfilled),h(d.Rejected))};return r.addEventListener(f.Message,m),()=>{l=!0,r.removeEventListener(f.Message,m)}})(p,e,r),s(a),l&&l.forEach((e=>{delete m[e]})),l=o.data.methodNames;const h=b(m,p,l,i,r);return s(h),m}};var $=e=>{let{iframe:t,methods:n={},childOrigin:o,timeout:r,debug:i=!1}=e;const s=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),a=((e,t)=>{const n=[];let o=!1;return{destroy(r){o||(o=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(r)})))},onDestroy(e){o?e():n.push(e)}}})("Parent",s),{onDestroy:d,destroy:u}=a;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=l.NoIframeSrc,e}})(t),o=(e=>{if(e&&v.find((t=>e.startsWith(t))))return"null";const t=document.location,n=h.exec(e);let o,r,i;return n?(o=n[1]?n[1]:t.protocol,r=n[2],i=n[4]):(o=t.protocol,r=t.hostname,i=t.port),`${o}//${r}${i&&i!==p[o]?`:${i}`:""}`})(t.src));const m="null"===o?"*":o,g=((e,t,n,o)=>r=>{if(r.origin!==n)return void e(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${n}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const i={penpal:c.SynAck,methodNames:Object.keys(t)};r.source.postMessage(i,o)})(s,n,o,m),y=C(n,o,m,a,s),S=new Promise(((e,n)=>{const o=((e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=l.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}})(r,u),i=n=>{if(n.source===t.contentWindow&&n.data)if(n.data.penpal!==c.Syn)if(n.data.penpal!==c.Ack);else{const t=y(n);t&&(o(),e(t))}else g(n)};window.addEventListener(f.Message,i),s("Parent: Awaiting handshake"),((e,t)=>{const{destroy:n,onDestroy:o}=t,r=setInterval((()=>{e.isConnected||(clearInterval(r),n())}),6e4);o((()=>{clearInterval(r)}))})(t,a),d((e=>{window.removeEventListener(f.Message,i),e&&n(e)}))}));return{promise:S,destroy(){u()}}},w=["interactive","complete"],E=function(e,t){return new Promise((function(n){e&&"function"!=typeof e&&(t=e,e=null),t=t||window.document;var o=function(){return n(void(e&&setTimeout(e)))};-1!==w.indexOf(t.readyState)?o():t.addEventListener("DOMContentLoaded",o)}))};E.resume=function(e){return function(t){return E(e).then((function(){return t}))}};var _=function(e){var t=e.importerKey,n=e.user,o=e.metadata,r="usecsv-".concat(Math.round(1e8*Math.random()));return E().then((function(){var e=function(e){var t;m("\n .usecsv_container {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 100000;\n }\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n"),document.body.insertAdjacentHTML("beforeend","<div id=".concat(e,' class="usecsv_container loading">\n</div>'));var n=document.createElement("iframe");return n.setAttribute("src","https://app.usecsv.com/importer"),null===(t=document.getElementById(e))||void 0===t||t.appendChild(n),n}(r),i=$({iframe:e,methods:{closeIframe:function(){var e;null===(e=document.getElementById(r))||void 0===e||e.remove()}}});return i.promise.then((function(e){var i;null===(i=document.getElementById(r))||void 0===i||i.classList.remove("loading"),e.setParams&&e.setParams({importerKey:t,user:n,metadata:o})})),i}))},R=n.default.extend({name:"usecsv-button",data:function(){return{hasSlot:!!this.$slots.default}},methods:{onclick:function(){_({importerKey:this.importerKey,user:this.importerKey,metadata:this.metadata})},hasScopedSlot:function(){return console.log(this.$scopedSlots.default&&this.$scopedSlots.default.name),"normalized"===(this.$scopedSlots.default&&this.$scopedSlots.default.name)}}});function x(e,t,n,o,r,i,s,a,c,d){"boolean"!=typeof s&&(c=a,a=s,s=!1);const l="function"==typeof n?n.options:n;let u;if(e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,r&&(l.functional=!0)),o&&(l._scopeId=o),i?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),u)if(l.functional){const e=l.render;l.render=function(t,n){return u.call(n),e(t,n)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,u):[u]}return n}const k="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function A(e){return(e,t)=>function(e,t){const n=k?t.media||"default":e,o=I[n]||(I[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);let n=t.source;if(t.map&&(n+="\n/*# sourceURL="+t.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===N&&(N=document.head||document.getElementsByTagName("head")[0]),N.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(n),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{const e=o.ids.size-1,t=document.createTextNode(n),r=o.element.childNodes;r[e]&&o.element.removeChild(r[e]),r.length?o.element.insertBefore(t,r[e]):o.element.appendChild(t)}}}(e,t)}let N;const I={};var M=x({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"usecsv"},[e.hasScopedSlot()?n("div",[e._t("default",null,{onclick:e.onclick})],2):n("div",[n("button",{attrs:{type:"button",id:"usecsv-button"},on:{click:e.onclick}},[e._t("default",(function(){return[e._v(" open usecsv ")]}))],2)])])},staticRenderFns:[]},(function(e){e&&e("data-v-4a1a9ae2_0",{source:"#usecsv-button[data-v-4a1a9ae2]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",map:void 0,media:void 0})}),R,"data-v-4a1a9ae2",false,undefined,!1,A,void 0,void 0),j=function(){var e=M;return e.install=function(t){t.component("usecsv-button",e)},e}(),T=Object.freeze({__proto__:null,default:j});return Object.entries(T).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];"default"!==n&&(j[n]=r)})),j}(Vue);
@@ -644,7 +644,7 @@ var useCsvPlugin = function (_a) {
644
644
  return iframeConnection;
645
645
  });
646
646
  };var script = /*#__PURE__*/Vue__default["default"].extend({
647
- name: "use-csv",
647
+ name: "usecsv-button",
648
648
  // vue component name
649
649
  data: function data() {
650
650
  return {
@@ -790,11 +790,9 @@ var __vue_render__ = function __vue_render__() {
790
790
 
791
791
  return _c('div', {
792
792
  staticClass: "usecsv"
793
- }, [_vm.hasScopedSlot() ? _vm._ssrNode("<div data-v-d2ea7b16>", "</div>", [_vm._t("default", function () {
794
- return [_vm._v(" open usecsv ")];
795
- }, {
793
+ }, [_vm.hasScopedSlot() ? _vm._ssrNode("<div data-v-4a1a9ae2>", "</div>", [_vm._t("default", null, {
796
794
  "onclick": _vm.onclick
797
- })], 2) : _vm._ssrNode("<div data-v-d2ea7b16>", "</div>", [_vm._ssrNode("<button type=\"button\" id=\"usecsv-button\" data-v-d2ea7b16>", "</button>", [_vm._t("default", function () {
795
+ })], 2) : _vm._ssrNode("<div data-v-4a1a9ae2>", "</div>", [_vm._ssrNode("<button type=\"button\" id=\"usecsv-button\" data-v-4a1a9ae2>", "</button>", [_vm._t("default", function () {
798
796
  return [_vm._v(" open usecsv ")];
799
797
  })], 2)])]);
800
798
  };
@@ -804,8 +802,8 @@ var __vue_staticRenderFns__ = [];
804
802
 
805
803
  var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
806
804
  if (!inject) return;
807
- inject("data-v-d2ea7b16_0", {
808
- source: "#usecsv-button[data-v-d2ea7b16]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
805
+ inject("data-v-4a1a9ae2_0", {
806
+ source: "#usecsv-button[data-v-4a1a9ae2]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
809
807
  map: undefined,
810
808
  media: undefined
811
809
  });
@@ -813,10 +811,10 @@ var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
813
811
  /* scoped */
814
812
 
815
813
 
816
- var __vue_scope_id__ = "data-v-d2ea7b16";
814
+ var __vue_scope_id__ = "data-v-4a1a9ae2";
817
815
  /* module identifier */
818
816
 
819
- var __vue_module_identifier__ = "data-v-d2ea7b16";
817
+ var __vue_module_identifier__ = "data-v-4a1a9ae2";
820
818
  /* functional template */
821
819
 
822
820
  var __vue_is_functional_template__ = false;
@@ -837,7 +835,7 @@ var component = /*#__PURE__*/(function () {
837
835
  var installable = component$1; // Attach install function executed by Vue.use()
838
836
 
839
837
  installable.install = function (Vue) {
840
- Vue.component('use-csv', installable);
838
+ Vue.component('usecsv-button', installable);
841
839
  };
842
840
 
843
841
  return installable;
@@ -1,5 +1,5 @@
1
1
  import { PluginObject } from 'vue';
2
- import component from "./usecsv.vue";
2
+ import component from "./UseCSVButton.vue";
3
3
  declare type InstallableComponent = typeof component & PluginObject<any>;
4
4
  declare const _default: InstallableComponent;
5
5
  export default _default;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@usecsv/vuejs",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
- "main": "dist/usecsv.ssr.js",
6
- "browser": "dist/usecsv.esm.js",
7
- "module": "dist/usecsv.esm.js",
8
- "unpkg": "dist/usecsv.min.js",
5
+ "main": "dist/UseCSVButton.ssr.js",
6
+ "browser": "dist/UseCSVButton.esm.js",
7
+ "module": "dist/UseCSVButton.esm.js",
8
+ "unpkg": "dist/UseCSVButton.min.js",
9
9
  "types": "dist/types/src/entry.esm.d.ts",
10
10
  "files": [
11
11
  "dist/*",
@@ -12,7 +12,7 @@ interface IUsecsv {
12
12
  }
13
13
 
14
14
  export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{onclick:()=>void,hasScopedSlot:()=>boolean},any,IUsecsv>({
15
- name: "use-csv", // vue component name
15
+ name: "usecsv-button", // vue component name
16
16
  data() {
17
17
  return {
18
18
  hasSlot: !!this.$slots.default,
@@ -40,7 +40,7 @@ export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{onclick:()=>void,hasS
40
40
  <template>
41
41
  <div class="usecsv">
42
42
  <div v-if="hasScopedSlot()">
43
- <slot :onclick="onclick"> open usecsv </slot>
43
+ <slot :onclick="onclick"/>
44
44
  </div>
45
45
  <div v-else>
46
46
  <button type="button" id="usecsv-button" @click="onclick">