@usecsv/vuejs 1.0.1 → 1.0.2
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.2](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.0.1...v1.0.2) (2022-02-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* typo ([a09307d](https://github.com/layercodedev/usecsv-vuejs-plugin/commit/a09307d09ec88c6cac0dbf92274e68e82b8677b9))
|
|
7
|
+
|
|
1
8
|
## [1.0.1](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.0.0...v1.0.1) (2022-02-14)
|
|
2
9
|
|
|
3
10
|
|
package/dist/UseCSVButton.esm.js
CHANGED
|
@@ -600,7 +600,7 @@ var script = /*#__PURE__*/Vue.extend({
|
|
|
600
600
|
},
|
|
601
601
|
|
|
602
602
|
methods: {
|
|
603
|
-
|
|
603
|
+
openModal() {
|
|
604
604
|
useCsvPlugin({
|
|
605
605
|
importerKey: this.importerKey,
|
|
606
606
|
user: this.importerKey,
|
|
@@ -758,14 +758,14 @@ var __vue_render__ = function () {
|
|
|
758
758
|
return _c('div', {
|
|
759
759
|
staticClass: "usecsv"
|
|
760
760
|
}, [_vm.hasScopedSlot() ? _c('div', [_vm._t("default", null, {
|
|
761
|
-
"
|
|
761
|
+
"openModal": _vm.openModal
|
|
762
762
|
})], 2) : _c('div', [_c('button', {
|
|
763
763
|
attrs: {
|
|
764
764
|
"type": "button",
|
|
765
765
|
"id": "usecsv-button"
|
|
766
766
|
},
|
|
767
767
|
on: {
|
|
768
|
-
"click": _vm.
|
|
768
|
+
"click": _vm.openModal
|
|
769
769
|
}
|
|
770
770
|
}, [_vm._t("default", function () {
|
|
771
771
|
return [_vm._v(" open usecsv ")];
|
|
@@ -777,8 +777,8 @@ var __vue_staticRenderFns__ = [];
|
|
|
777
777
|
|
|
778
778
|
const __vue_inject_styles__ = function (inject) {
|
|
779
779
|
if (!inject) return;
|
|
780
|
-
inject("data-v-
|
|
781
|
-
source: "#usecsv-button[data-v-
|
|
780
|
+
inject("data-v-33b17e68_0", {
|
|
781
|
+
source: "#usecsv-button[data-v-33b17e68]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
|
|
782
782
|
map: undefined,
|
|
783
783
|
media: undefined
|
|
784
784
|
});
|
|
@@ -786,7 +786,7 @@ const __vue_inject_styles__ = function (inject) {
|
|
|
786
786
|
/* scoped */
|
|
787
787
|
|
|
788
788
|
|
|
789
|
-
const __vue_scope_id__ = "data-v-
|
|
789
|
+
const __vue_scope_id__ = "data-v-33b17e68";
|
|
790
790
|
/* module identifier */
|
|
791
791
|
|
|
792
792
|
const __vue_module_identifier__ = undefined;
|
package/dist/UseCSVButton.min.js
CHANGED
|
@@ -3,4 +3,4 @@ var UseCSVButton=function(e){"use strict";function t(e){return e&&"object"==type
|
|
|
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
|
|
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 b=()=>++y,S=(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=b(),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=S(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),b=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:b,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:{openModal: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 A="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function M(e){return(e,t)=>function(e,t){const n=A?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 k=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,{openModal:e.openModal})],2):n("div",[n("button",{attrs:{type:"button",id:"usecsv-button"},on:{click:e.openModal}},[e._t("default",(function(){return[e._v(" open usecsv ")]}))],2)])])},staticRenderFns:[]},(function(e){e&&e("data-v-33b17e68_0",{source:"#usecsv-button[data-v-33b17e68]{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-33b17e68",false,undefined,!1,M,void 0,void 0),j=function(){var e=k;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);
|
package/dist/UseCSVButton.ssr.js
CHANGED
|
@@ -652,7 +652,7 @@ var useCsvPlugin = function (_a) {
|
|
|
652
652
|
};
|
|
653
653
|
},
|
|
654
654
|
methods: {
|
|
655
|
-
|
|
655
|
+
openModal: function openModal() {
|
|
656
656
|
useCsvPlugin({
|
|
657
657
|
importerKey: this.importerKey,
|
|
658
658
|
user: this.importerKey,
|
|
@@ -790,9 +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-
|
|
794
|
-
"
|
|
795
|
-
})], 2) : _vm._ssrNode("<div data-v-
|
|
793
|
+
}, [_vm.hasScopedSlot() ? _vm._ssrNode("<div data-v-33b17e68>", "</div>", [_vm._t("default", null, {
|
|
794
|
+
"openModal": _vm.openModal
|
|
795
|
+
})], 2) : _vm._ssrNode("<div data-v-33b17e68>", "</div>", [_vm._ssrNode("<button type=\"button\" id=\"usecsv-button\" data-v-33b17e68>", "</button>", [_vm._t("default", function () {
|
|
796
796
|
return [_vm._v(" open usecsv ")];
|
|
797
797
|
})], 2)])]);
|
|
798
798
|
};
|
|
@@ -802,8 +802,8 @@ var __vue_staticRenderFns__ = [];
|
|
|
802
802
|
|
|
803
803
|
var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
|
|
804
804
|
if (!inject) return;
|
|
805
|
-
inject("data-v-
|
|
806
|
-
source: "#usecsv-button[data-v-
|
|
805
|
+
inject("data-v-33b17e68_0", {
|
|
806
|
+
source: "#usecsv-button[data-v-33b17e68]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
|
|
807
807
|
map: undefined,
|
|
808
808
|
media: undefined
|
|
809
809
|
});
|
|
@@ -811,10 +811,10 @@ var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
|
|
|
811
811
|
/* scoped */
|
|
812
812
|
|
|
813
813
|
|
|
814
|
-
var __vue_scope_id__ = "data-v-
|
|
814
|
+
var __vue_scope_id__ = "data-v-33b17e68";
|
|
815
815
|
/* module identifier */
|
|
816
816
|
|
|
817
|
-
var __vue_module_identifier__ = "data-v-
|
|
817
|
+
var __vue_module_identifier__ = "data-v-33b17e68";
|
|
818
818
|
/* functional template */
|
|
819
819
|
|
|
820
820
|
var __vue_is_functional_template__ = false;
|
package/package.json
CHANGED
package/src/UseCSVButton.vue
CHANGED
|
@@ -11,7 +11,7 @@ interface IUsecsv {
|
|
|
11
11
|
metadata: Record<string, string | number> | undefined;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{
|
|
14
|
+
export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{openModal:()=>void,hasScopedSlot:()=>boolean},any,IUsecsv>({
|
|
15
15
|
name: "usecsv-button", // vue component name
|
|
16
16
|
data() {
|
|
17
17
|
return {
|
|
@@ -19,7 +19,7 @@ export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{onclick:()=>void,hasS
|
|
|
19
19
|
};
|
|
20
20
|
},
|
|
21
21
|
methods: {
|
|
22
|
-
|
|
22
|
+
openModal(): void {
|
|
23
23
|
useCsvPlugin({
|
|
24
24
|
importerKey: this.importerKey,
|
|
25
25
|
user: this.importerKey,
|
|
@@ -40,10 +40,10 @@ 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 :
|
|
43
|
+
<slot :openModal="openModal"/>
|
|
44
44
|
</div>
|
|
45
45
|
<div v-else>
|
|
46
|
-
<button type="button" id="usecsv-button" @click="
|
|
46
|
+
<button type="button" id="usecsv-button" @click="openModal">
|
|
47
47
|
<slot> open usecsv </slot>
|
|
48
48
|
</button>
|
|
49
49
|
</div>
|