@senlinz/import-export 0.0.1-beta.1 → 0.0.1-beta.3

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.
@@ -1,3 +1,2 @@
1
- export{g as getAssetPath,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-cc3c4ea3.js";function t(s,t,e){return(s||"")+(t?` ${t}`:"")+(e?` ${e}`:"")}export{t as format};
2
-
1
+ export{g as getAssetPath,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-4789c9c3.js";
3
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ const e="hydrated",n=!1,t=!1,l=!0,o=!1;var r=Object.defineProperty,s=new WeakMap,i=e=>s.get(e),c=(e,n)=>n in e,u=(e,n)=>(0,console.error)(e,n),a=new Map,f="undefined"!=typeof window?window:{},d=f.document||{head:{}},p=f.HTMLElement||class{},m={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,n,t,l)=>e.addEventListener(n,t,l),rel:(e,n,t,l)=>e.removeEventListener(n,t,l),ce:(e,n)=>new CustomEvent(e,n)},h=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),y=!1,v=[],$=[],b=(e,n)=>t=>{e.push(t),y||(y=!0,n&&4&m.t?S(g):m.raf(g))},w=e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(e){u(e)}e.length=0},g=()=>{w(v),w($),(y=v.length>0)&&m.raf(g)},S=e=>{return Promise.resolve(n).then(e);var n},k=b($,!0),j=e=>{const n=new URL(e,m.l);return n.origin!==f.location.origin?n.href:n.pathname},E=e=>m.l=e,O={},x=e=>"object"===(e=typeof e)||"function"===e;((e,n)=>{for(var t in n)r(e,t,{get:n[t],enumerable:!0})})({},{err:()=>M,map:()=>P,ok:()=>C,unwrap:()=>_,unwrapErr:()=>D});var C=e=>({isOk:!0,isErr:!1,value:e}),M=e=>({isOk:!1,isErr:!0,value:e});function P(e,n){if(e.isOk){const t=n(e.value);return t instanceof Promise?t.then((e=>C(e))):C(t)}if(e.isErr){const n=e.value;return M(n)}throw"should never get here"}var A,H,_=e=>{if(e.isOk)return e.value;throw e.value},D=e=>{if(e.isErr)return e.value;throw e.value},F=(e,n,...t)=>{let l=null,o=null,r=!1,s=!1;const i=[],c=n=>{for(let t=0;t<n.length;t++)l=n[t],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((r="function"!=typeof e&&!x(l))&&(l=String(l)),r&&s?i[i.length-1].o+=l:i.push(r?N(null,l):l),s=r)};if(c(t),n&&n.key&&(o=n.key),"function"==typeof e)return e(null===n?{}:n,i,U);const u=N(e,null);return u.i=n,i.length>0&&(u.u=i),u.p=o,u},N=(e,n)=>{const t={t:0,m:e,o:n,h:null,u:null,i:null,p:null};return t},R={},U={forEach:(e,n)=>e.map(L).forEach(n),map:(e,n)=>e.map(L).map(n).map(W)},L=e=>({vattrs:e.i,vchildren:e.u,vkey:e.p,vname:e.v,vtag:e.m,vtext:e.o}),W=e=>{if("function"==typeof e.vtag){const n={...e.vattrs};return e.vkey&&(n.key=e.vkey),e.vname&&(n.name=e.vname),F(e.vtag,n,...e.vchildren||[])}const n=N(e.vtag,e.vtext);return n.i=e.vattrs,n.u=e.vchildren,n.p=e.vkey,n.v=e.vname,n},q=(e,n,t)=>{const l=e;return{emit:e=>V(l,n,{bubbles:!!(4&t),composed:!!(2&t),cancelable:!!(1&t),detail:e})}},V=(e,n,t)=>{const l=m.ce(n,t);return e.dispatchEvent(l),l},z=new WeakMap,B=e=>{const n=e.$,t=e.$hostElement$,l=n.t,o=(n.S,()=>{}),r=((e,n)=>{var t;const l=G(n),o=a.get(l);if(e=11===e.nodeType?e:d,o)if("string"==typeof o){e=e.head||e;let r,s=z.get(e);if(s||z.set(e,s=new Set),!s.has(l)){{r=d.createElement("style"),r.innerHTML=o;const l=null!=(t=m.k)?t:function(){var e,n,t;return null!=(t=null==(n=null==(e=d.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?t:void 0}();if(null!=l&&r.setAttribute("nonce",l),!(1&n.t))if("HEAD"===e.nodeName){const n=e.querySelectorAll("link[rel=preconnect]"),t=n.length>0?n[n.length-1].nextSibling:document.querySelector("style");e.insertBefore(r,t)}else"host"in e?e.prepend(r):e.append(r);1&n.t&&"HEAD"!==e.nodeName&&e.insertBefore(r,null)}4&n.t&&(r.innerHTML+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),s&&s.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(t.shadowRoot?t.shadowRoot:t.getRootNode(),n);10&l&&2&l&&(t["s-sc"]=r,t.classList.add(r+"-h")),o()},G=(e,n)=>"sc-"+e.S,I=(e,n,t,l,o,r)=>{if(t!==l){let s=c(e,n),i=n.toLowerCase();if("key"===n);else if("ref"===n)l&&l(e);else if(e.__lookupSetter__(n)||"o"!==n[0]||"n"!==n[1]){const i=x(l);if((s||i&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[n]=l;else{const o=null==l?"":l;"list"===n?s=!1:null!=t&&e[n]==o||("function"==typeof e.__lookupSetter__(n)?e[n]=o:e.setAttribute(n,o))}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(n)||e.removeAttribute(n):(!s||4&r||o)&&!i&&(l=!0===l?"":l,e.setAttribute(n,l))}else if(n="-"===n[2]?n.slice(3):c(f,i)?i.slice(2):i[2]+n.slice(3),t||l){const o=n.endsWith(J);n=n.replace(K,""),t&&m.rel(e,n,t,o),l&&m.ael(e,n,l,o)}}},J="Capture",K=new RegExp(J+"$"),Q=(e,n,t)=>{const l=11===n.h.nodeType&&n.h.host?n.h.host:n.h,o=e&&e.i||O,r=n.i||O;for(const e of T(Object.keys(o)))e in r||I(l,e,o[e],void 0,t,n.t);for(const e of T(Object.keys(r)))I(l,e,o[e],r[e],t,n.t)};function T(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var X=!1,Y=!1,Z=(e,l,o,r)=>{const s=l.u[o];let i,c,u=0;if(null!==s.o)i=s.h=d.createTextNode(s.o);else{i=s.h=d.createElement(!X&&t&&2&s.t?"slot-fb":s.m),Q(null,s,Y);if(!!i.getRootNode().querySelector("body")&&n&&null!=A&&i["s-si"]!==A&&i.classList.add(i["s-si"]=A),s.u)for(u=0;u<s.u.length;++u)c=Z(e,s,u),c&&i.appendChild(c)}return i["s-hn"]=H,i},ee=(e,n,t,l,o,r)=>{let s,i=e;for(i.shadowRoot&&i.tagName===H&&(i=i.shadowRoot);o<=r;++o)l[o]&&(s=Z(null,t,o),s&&(l[o].h=s,re(i,s,n)))},ne=(e,n,t)=>{for(let l=n;l<=t;++l){const n=e[l];if(n){const e=n.h;oe(n),e&&e.remove()}}},te=(e,n,t=!1)=>e.m===n.m&&(!!t||e.p===n.p),le=(e,n,t=!1)=>{const o=n.h=e.h,r=e.u,s=n.u,i=n.o;null===i?(Q(e,n,Y),null!==r&&null!==s?((e,n,t,l,o=!1)=>{let r,s,i=0,c=0,u=0,a=0,f=n.length-1,d=n[0],p=n[f],m=l.length-1,h=l[0],y=l[m];for(;i<=f&&c<=m;)if(null==d)d=n[++i];else if(null==p)p=n[--f];else if(null==h)h=l[++c];else if(null==y)y=l[--m];else if(te(d,h,o))le(d,h,o),d=n[++i],h=l[++c];else if(te(p,y,o))le(p,y,o),p=n[--f],y=l[--m];else if(te(d,y,o))le(d,y,o),re(e,d.h,p.h.nextSibling),d=n[++i],y=l[--m];else if(te(p,h,o))le(p,h,o),re(e,p.h,d.h),p=n[--f],h=l[++c];else{for(u=-1,a=i;a<=f;++a)if(n[a]&&null!==n[a].p&&n[a].p===h.p){u=a;break}u>=0?(s=n[u],s.m!==h.m?r=Z(n&&n[c],t,u):(le(s,h,o),n[u]=void 0,r=s.h),h=l[++c]):(r=Z(n&&n[c],t,c),h=l[++c]),r&&re(d.h.parentNode,r,d.h)}i>f?ee(e,null==l[m+1]?null:l[m+1].h,t,l,c,m):c>m&&ne(n,i,f)})(o,r,n,s,t):null!==s?(null!==e.o&&(o.textContent=""),ee(o,null,n,s,0,s.length-1)):!t&&l&&null!==r&&ne(r,0,r.length-1)):e.o!==i&&(o.data=i)},oe=e=>{e.i&&e.i.ref&&e.i.ref(null),e.u&&e.u.map(oe)},re=(e,n,t)=>null==e?void 0:e.insertBefore(n,t),se=(e,n,t=!1)=>{const l=e.$hostElement$,o=e.$,r=e.j||N(null,null),s=(i=n)&&i.m===R?n:F(null,null,n);var i;if(H=l.tagName,t&&s.i)for(const e of Object.keys(s.i))l.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(s.i[e]=l[e]);s.m=null,s.t|=4,e.j=s,s.h=r.h=l.shadowRoot||l,A=l["s-sc"],X=!!(1&o.t),le(r,s,t)},ie=(e,n)=>{n&&!e.O&&n["s-p"]&&n["s-p"].push(new Promise((n=>e.O=n)))},ce=(e,n)=>{if(e.t|=16,4&e.t)return void(e.t|=512);ie(e,e.C);return k((()=>ue(e,n)))},ue=(e,n)=>{const t=e.$hostElement$,l=(e.$.S,()=>{}),o=t;if(!o)throw new Error(`Can't render component <${t.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return l(),ae(undefined,(()=>de(e,o,n)))},ae=(e,n)=>fe(e)?e.then(n).catch((e=>{console.error(e),n()})):n(),fe=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,de=async(e,n,t)=>{var l;const o=e.$hostElement$,r=(e.$.S,()=>{}),s=o["s-rc"];t&&B(e);const i=(e.$.S,()=>{});pe(e,n,o,t),s&&(s.map((e=>e())),o["s-rc"]=void 0),i(),r();{const n=null!=(l=o["s-p"])?l:[],t=()=>me(e);0===n.length?t():(Promise.all(n).then(t),e.t|=4,n.length=0)}},pe=(e,n,t,l)=>{try{n=n.render(),e.t&=-17,e.t|=2,se(e,n,l)}catch(n){u(n,e.$hostElement$)}return null},me=e=>{e.$.S;const n=e.$hostElement$,t=()=>{},l=n,o=e.C;64&e.t?t():(e.t|=64,ve(n),ye(l,"componentDidLoad"),t(),e.M(n),o||he()),e.O&&(e.O(),e.O=void 0),512&e.t&&S((()=>ce(e,!1))),e.t&=-517},he=e=>{ve(d.documentElement),S((()=>V(f,"appload",{detail:{namespace:"imexport-table"}})))},ye=(e,n,t)=>{if(e&&e[n])try{return e[n](t)}catch(e){u(e)}},ve=n=>{var t;return n.classList.add(null!=(t=e)?t:"hydrated")},$e=(e,n,t,l)=>{const o=i(e),r=o.P.get(n),s=o.t;var c;null==(c=t)||x(c),t=c;const u=Number.isNaN(r)&&Number.isNaN(t);t!==r&&!u&&(o.P.set(n,t),2==(18&s)&&ce(o,!1))},be=(e,n,t)=>{var l;const r=e.prototype;if(n.A||o){Object.entries(null!=(l=n.A)?l:{}).map((([e,[n]])=>{(31&n||32&n)&&Object.defineProperty(r,e,{get(){return n=e,i(this).P.get(n);var n},set(n){$e(this,e,n)},configurable:!0,enumerable:!0})}))}return e},we=async(e,n,t,l)=>{let o;if(!(32&n.t)){n.t|=32;{o=e.constructor;const t=e.localName;customElements.whenDefined(t).then((()=>n.t|=128))}if(o&&o.style){let e;"string"==typeof o.style&&(e=o.style);const n=G(t);if(!a.has(n)){const l=(t.S,()=>{});((e,n,t)=>{let l=a.get(e);h&&t?(l=l||new CSSStyleSheet,"string"==typeof l?l=n:l.replaceSync(n)):l=n,a.set(e,l)})(n,e,!!(1&t.t)),l()}}}const r=n.C,s=()=>ce(n,!0);r&&r["s-rc"]?r["s-rc"].push(s):s()},ge=(e,n)=>{const t={t:n[0],S:n[1]};return t.A=n[2],Object.assign(e.prototype,{__registerHost(){((e,n)=>{const t={t:0,$hostElement$:e,$:n,P:new Map};t.H=new Promise((e=>t.M=e)),e["s-p"]=[],e["s-rc"]=[],s.set(e,t)})(this,t)},connectedCallback(){i(this),(e=>{if(!(1&m.t)){const n=i(e),t=n.$,l=(t.S,()=>{});if(1&n.t)(null==n?void 0:n._)||(null==n?void 0:n.H)&&n.H.then((()=>{}));else{n.t|=1;{let t=e;for(;t=t.parentNode||t.host;)if(t["s-p"]){ie(n,n.C=t);break}}t.A&&Object.entries(t.A).map((([n,[t]])=>{if(31&t&&e.hasOwnProperty(n)){const t=e[n];delete e[n],e[n]=t}})),we(e,n,t)}l()}})(this)},disconnectedCallback(){(async e=>{1&m.t||i(e)})(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw new Error(`Unable to re-use existing shadow root for ${t.S}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else this.attachShadow({mode:"open"})}}),e.is=t.S,be(e,t)},Se=(e,n)=>n,ke=e=>m.k=e,je=e=>Object.assign(m,e);export{Se as F,p as H,ke as a,je as b,q as c,j as g,F as h,ge as p,E as s};
2
+ //# sourceMappingURL=p-4789c9c3.js.map
@@ -1,28 +1,20 @@
1
1
  import { EventEmitter } from 'stream';
2
+ import { type ExcelDefinition } from '../../types';
2
3
  export declare class ImexportTableComponent {
3
- info: {
4
- name: string;
5
- sheetName: string;
6
- columns: {
7
- key: string;
8
- name: string;
9
- }[];
10
- };
4
+ info: ExcelDefinition;
11
5
  imported: EventEmitter<any>;
12
- importExcel(options?: {
6
+ importExcel<T>(options?: {
13
7
  buffer?: Uint8Array;
14
8
  }): Promise<void>;
15
9
  exportExcelTemplate(): Promise<void>;
16
10
  epxortExcel(data: any[]): Promise<void>;
11
+ componentDidLoad(): void;
17
12
  fileInput: HTMLInputElement;
18
13
  linkInput: HTMLAnchorElement;
19
- componentWillLoad(): Promise<void>;
20
14
  private setDownloadLink;
21
15
  private download;
22
16
  private exportTemplateHandler;
23
17
  private getInfo;
24
- private getItems;
25
18
  private onFileChange;
26
- private importBufferData;
27
19
  render(): any;
28
20
  }
@@ -5,16 +5,14 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
+ import { ExcelDefinition } from "./types";
9
+ export { ExcelDefinition } from "./types";
8
10
  export namespace Components {
9
11
  interface ImexportTable {
10
12
  "epxortExcel": (data: any[]) => Promise<void>;
11
13
  "exportExcelTemplate": () => Promise<void>;
12
- "importExcel": (options?: { buffer?: Uint8Array; }) => Promise<void>;
13
- "info": {
14
- name: string,
15
- sheetName: string,
16
- columns: { key: string, name: string }[]
17
- };
14
+ "importExcel": <T>(options?: { buffer?: Uint8Array; }) => Promise<void>;
15
+ "info": ExcelDefinition;
18
16
  }
19
17
  }
20
18
  export interface ImexportTableCustomEvent<T> extends CustomEvent<T> {
@@ -45,11 +43,7 @@ declare global {
45
43
  }
46
44
  declare namespace LocalJSX {
47
45
  interface ImexportTable {
48
- "info"?: {
49
- name: string,
50
- sheetName: string,
51
- columns: { key: string, name: string }[]
52
- };
46
+ "info"?: ExcelDefinition;
53
47
  "onImported"?: (event: ImexportTableCustomEvent<any>) => void;
54
48
  }
55
49
  interface IntrinsicElements {
@@ -1,11 +1,2 @@
1
- /**
2
- * @fileoverview entry point for your component library
3
- *
4
- * This is the entry point for your component library. Use this file to export utilities,
5
- * constants or data structure that accompany your components.
6
- *
7
- * DO NOT use this file to export your components. Instead, use the recommended approaches
8
- * to consume components of this package as outlined in the `README.md`.
9
- */
10
- export { format } from './utils/utils';
1
+ export {} from './utils/utils';
11
2
  export type * from './components.d.ts';
@@ -0,0 +1,12 @@
1
+ interface ExcelDefinition {
2
+ name: string,
3
+ sheetName: string,
4
+ columns: ExcelColumnDefinition[]
5
+ }
6
+
7
+ interface ExcelColumnDefinition {
8
+ key: string,
9
+ name: string
10
+ }
11
+
12
+ export { ExcelDefinition, ExcelColumnDefinition }
@@ -1 +1,6 @@
1
- export declare function format(first?: string, middle?: string, last?: string): string;
1
+ import { ExcelInfo } from '@senlinz/import-export-wasm';
2
+ declare function initializeWasm(): Promise<void>;
3
+ declare function fromExcel<T>(info: ExcelInfo, buffer: Uint8Array): Promise<T[]>;
4
+ declare function toExcel<T>(info: ExcelInfo, data: T[]): Promise<Uint8Array>;
5
+ declare function createExcel(info: ExcelInfo): Promise<Uint8Array>;
6
+ export { fromExcel, toExcel, createExcel, initializeWasm };
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@senlinz/import-export",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.3",
4
4
  "description": "Stencil Component for import/export excel files.",
5
5
  "module": "dist/components/index.js",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "files": [
8
- "dist/"
8
+ "dist/**/*.js",
9
+ "dist/**/*.d.ts",
10
+ "README.md"
9
11
  ],
10
12
  "exports": {
11
13
  "./components": {
@@ -34,7 +36,7 @@
34
36
  },
35
37
  "dependencies": {
36
38
  "fflate": "^0.8.2",
37
- "@senlinz/import-export-wasm": "0.0.1-beta.1"
39
+ "@senlinz/import-export-wasm": "0.0.1-beta.3"
38
40
  },
39
41
  "keywords": [
40
42
  "stencil",
package/README.md DELETED
@@ -1,2 +0,0 @@
1
- # @senlinz/import-export
2
- Web component for @senlinz/import-export-wasm