@fluid-topics/ft-file-drop 0.3.38 → 0.3.39

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.
@@ -499,4 +499,4 @@ const Q=Symbol.for(""),V=t=>{if((null==t?void 0:t.r)===Q)return null==t?void 0:t
499
499
  </div>
500
500
  <slot></slot>
501
501
  </div>
502
- `}onDragEnter(t){this.dragging=!0,t.preventDefault()}onDragOver(t){t.preventDefault()}onDragLeave(t){this.dragging=!1,t.preventDefault()}async onDrop(t){if(t.preventDefault(),t.dataTransfer&&t.dataTransfer.files){let i=t.dataTransfer.files[0];!function(t,i,e){if(0==t.length)return!0;let o=t.replace(/\*/g,".*").replace(/,/g,"|").replace(/\./g,"\\."),n=new RegExp(o),r=i.includes(".")?"."+i.split(".").pop():void 0;return!(!r||!n.test(r))||n.test(e)}(this.accept,i.name,i.type)?(this.fileError=!0,setTimeout((()=>{this.dragging=!1,this.fileError=!1}),2e3)):(this.dragging=!1,this.dispatchEvent(new Zi(i)))}}}Wi.elementDefinitions={"ft-chip":Di},Wi.styles=Fi,Ri([o.property()],Wi.prototype,"dropHint",void 0),Ri([o.property()],Wi.prototype,"accept",void 0),Ri([o.property()],Wi.prototype,"fileTypeError",void 0),Ri([o.property({type:Boolean})],Wi.prototype,"visible",void 0),Ri([o.state()],Wi.prototype,"dragging",void 0),Ri([o.state()],Wi.prototype,"fileError",void 0),i.customElement("ft-file-drop")(Wi),t.FileDropEvent=Zi,t.FtFileDrop=Wi,t.FtFileDropCssVariables=Ti,t.styles=Fi,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
502
+ `}onDragEnter(t){this.dragging=!0,t.preventDefault()}onDragOver(t){t.preventDefault()}onDragLeave(t){this.dragging=!1,t.preventDefault()}async onDrop(t){if(t.preventDefault(),t.dataTransfer&&t.dataTransfer.files){let i=t.dataTransfer.files[0];!function(t,i,e){if(0==t.length)return!0;let o=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"|"),n=new RegExp(o),r=i.includes(".")?"."+i.split(".").pop():void 0;return!(!r||!n.test(r))||n.test(e)}(this.accept,i.name,i.type)?(this.fileError=!0,setTimeout((()=>{this.dragging=!1,this.fileError=!1}),2e3)):(this.dragging=!1,this.dispatchEvent(new Zi(i)))}}}Wi.elementDefinitions={"ft-chip":Di},Wi.styles=Fi,Ri([o.property()],Wi.prototype,"dropHint",void 0),Ri([o.property()],Wi.prototype,"accept",void 0),Ri([o.property()],Wi.prototype,"fileTypeError",void 0),Ri([o.property({type:Boolean})],Wi.prototype,"visible",void 0),Ri([o.state()],Wi.prototype,"dragging",void 0),Ri([o.state()],Wi.prototype,"fileError",void 0),i.customElement("ft-file-drop")(Wi),t.FileDropEvent=Zi,t.FtFileDrop=Wi,t.FtFileDropCssVariables=Ti,t.styles=Fi,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
@@ -611,4 +611,4 @@ class se extends St{constructor(t){if(super(t),this.it=Z,t.type!==$t)throw Error
611
611
  </div>
612
612
  <slot></slot>
613
613
  </div>
614
- `}onDragEnter(t){this.dragging=!0,t.preventDefault()}onDragOver(t){t.preventDefault()}onDragLeave(t){this.dragging=!1,t.preventDefault()}async onDrop(t){if(t.preventDefault(),t.dataTransfer&&t.dataTransfer.files){let i=t.dataTransfer.files[0];!function(t,i,e){if(0==t.length)return!0;let o=t.replace(/\*/g,".*").replace(/,/g,"|").replace(/\./g,"\\."),n=new RegExp(o),r=i.includes(".")?"."+i.split(".").pop():void 0;return!(!r||!n.test(r))||n.test(e)}(this.accept,i.name,i.type)?(this.fileError=!0,setTimeout((()=>{this.dragging=!1,this.fileError=!1}),2e3)):(this.dragging=!1,this.dispatchEvent(new Ee(i)))}}}Re.elementDefinitions={"ft-chip":Se},Re.styles=Ce,Ne([o()],Re.prototype,"dropHint",void 0),Ne([o()],Re.prototype,"accept",void 0),Ne([o()],Re.prototype,"fileTypeError",void 0),Ne([o({type:Boolean})],Re.prototype,"visible",void 0),Ne([n()],Re.prototype,"dragging",void 0),Ne([n()],Re.prototype,"fileError",void 0),a("ft-file-drop")(Re),t.FileDropEvent=Ee,t.FtFileDrop=Re,t.FtFileDropCssVariables=ke,t.styles=Ce,Object.defineProperty(t,"i",{value:!0})}({});
614
+ `}onDragEnter(t){this.dragging=!0,t.preventDefault()}onDragOver(t){t.preventDefault()}onDragLeave(t){this.dragging=!1,t.preventDefault()}async onDrop(t){if(t.preventDefault(),t.dataTransfer&&t.dataTransfer.files){let i=t.dataTransfer.files[0];!function(t,i,e){if(0==t.length)return!0;let o=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"|"),n=new RegExp(o),r=i.includes(".")?"."+i.split(".").pop():void 0;return!(!r||!n.test(r))||n.test(e)}(this.accept,i.name,i.type)?(this.fileError=!0,setTimeout((()=>{this.dragging=!1,this.fileError=!1}),2e3)):(this.dragging=!1,this.dispatchEvent(new Ee(i)))}}}Re.elementDefinitions={"ft-chip":Se},Re.styles=Ce,Ne([o()],Re.prototype,"dropHint",void 0),Ne([o()],Re.prototype,"accept",void 0),Ne([o()],Re.prototype,"fileTypeError",void 0),Ne([o({type:Boolean})],Re.prototype,"visible",void 0),Ne([n()],Re.prototype,"dragging",void 0),Ne([n()],Re.prototype,"fileError",void 0),a("ft-file-drop")(Re),t.FileDropEvent=Ee,t.FtFileDrop=Re,t.FtFileDropCssVariables=ke,t.styles=Ce,Object.defineProperty(t,"i",{value:!0})}({});
@@ -2,9 +2,9 @@ export function matchAccept(accept, filename, filetype) {
2
2
  if (accept.length == 0) {
3
3
  return true;
4
4
  }
5
- let pattern = accept.replace(/\*/g, ".*")
6
- .replace(/,/g, "|")
7
- .replace(/\./g, "\\.");
5
+ let pattern = accept.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
6
+ .replace(/\*/g, ".*")
7
+ .replace(/,/g, "|");
8
8
  let regex = new RegExp(pattern);
9
9
  let extension = filename.includes(".") ? "." + filename.split(".").pop() : undefined;
10
10
  if (extension && regex.test(extension)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-file-drop",
3
- "version": "0.3.38",
3
+ "version": "0.3.39",
4
4
  "description": "Container that accepts dropping files",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,9 +19,9 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-chip": "0.3.38",
23
- "@fluid-topics/ft-wc-utils": "0.3.38",
22
+ "@fluid-topics/ft-chip": "0.3.39",
23
+ "@fluid-topics/ft-wc-utils": "0.3.39",
24
24
  "lit": "2.2.8"
25
25
  },
26
- "gitHead": "04e0c0711dd482783b45a7bcd0770743ff2ec673"
26
+ "gitHead": "fce2eb423e7c2b107a892f3b986ab601fc4be7fc"
27
27
  }