@cocreate/file 1.19.2 → 1.19.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [1.19.3](https://github.com/CoCreate-app/CoCreate-file/compare/v1.19.2...v1.19.3) (2025-04-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fire action end event on elememt instead of document ([3e78905](https://github.com/CoCreate-app/CoCreate-file/commit/3e789054e65e87c4f988d2041dfe8687684ebff5))
7
+ * update observer observe param to type and and attributeName to attributeFilter ([524a05e](https://github.com/CoCreate-app/CoCreate-file/commit/524a05e0080c4473f28fc9e5bd1414479e313eb7))
8
+
1
9
  ## [1.19.2](https://github.com/CoCreate-app/CoCreate-file/compare/v1.19.1...v1.19.2) (2025-01-18)
2
10
 
3
11
 
package/demo/index.html CHANGED
@@ -1,81 +1,81 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
- <head>
4
- <title>file | CoCreateJS</title>
3
+ <head>
4
+ <title>file | CoCreateJS</title>
5
5
 
6
- <!-- CoCreate Favicon -->
7
- <link
8
- rel="icon"
9
- type="image/png"
10
- sizes="32x32"
11
- href="../assets/favicon.ico" />
12
- <link rel="manifest" href="/manifest.webmanifest" />
13
- </head>
14
- <body>
15
- <form>
16
- <input type="file" import />
17
- <button actions="import">import</button>
18
- </form>
6
+ <!-- CoCreate Favicon -->
7
+ <link
8
+ rel="icon"
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
+ <link rel="manifest" href="/manifest.webmanifest" />
13
+ </head>
14
+ <body>
15
+ <form>
16
+ <input type="file" import />
17
+ <button actions="import">import</button>
18
+ </form>
19
19
 
20
- <form>
21
- <input type="file" path="/assets/test" />
22
- <button actions="upload">upload</button>
23
- </form>
20
+ <form>
21
+ <input type="file" path="/assets/test" />
22
+ <button actions="upload">upload</button>
23
+ </form>
24
24
 
25
- <form>
26
- <input type="file" multiple />
27
- <button actions="upload">upload</button>
28
- </form>
25
+ <form>
26
+ <input type="file" multiple />
27
+ <button actions="upload">upload</button>
28
+ </form>
29
29
 
30
- <form>
31
- <input type="file" directory />
32
- <button actions="upload">upload</button>
33
- </form>
30
+ <form>
31
+ <input type="file" directory />
32
+ <button actions="upload">upload</button>
33
+ </form>
34
34
 
35
- <div
36
- type="file"
37
- array="test"
38
- object=""
39
- key="image"
40
- accept="image/*"
41
- placeholder="Upload Image or Video Thumbnail"
42
- class="floating-label min-height:40px active"
43
- render-selector="[template]"
44
- active>
45
- <div template>
46
- <img src="{{image.src}}" alt="image" width="100%" />
47
- </div>
48
- </div>
35
+ <div
36
+ type="file"
37
+ array="test"
38
+ object=""
39
+ key="image"
40
+ accept="image/*"
41
+ placeholder="Upload Image or Video Thumbnail"
42
+ class="floating-label min-height:40px active"
43
+ render-selector="[template]"
44
+ active>
45
+ <div template>
46
+ <img src="{{image.src}}" alt="image" width="100%" />
47
+ </div>
48
+ </div>
49
49
 
50
- <form>
51
- <input
52
- type="file"
53
- directory
54
- realtime="false"
55
- render-selector="document; [template]" />
50
+ <form>
51
+ <input
52
+ type="file"
53
+ directory
54
+ realtime="false"
55
+ render-document="[template]" />
56
56
 
57
- <button actions="saveLocally">saveLocally</button>
58
- </form>
57
+ <button actions="saveLocally">saveLocally</button>
58
+ </form>
59
59
 
60
- <div template file_id="{{id}}">
61
- <button actions="createFile" value="tesing.js">createFile</button>
62
- <button actions="deleteFile">deleteFile</button>
63
- <button actions="createDirectory">createDirectory</button>
64
- <button actions="deleteDirectory">deleteDirectory</button>
60
+ <div template file_id="{{id}}">
61
+ <button actions="createFile" value="tesing.js">createFile</button>
62
+ <button actions="deleteFile">deleteFile</button>
63
+ <button actions="createDirectory">createDirectory</button>
64
+ <button actions="deleteDirectory">deleteDirectory</button>
65
65
 
66
- <input file="name" value="{{name}}" />
67
- <input file="directory" value="{{directory}}" />
68
- <input file="content-type" value="{{content-type}}" />
69
- <textarea file="src" value-type="string">{{src}}</textarea>
70
- <div>id: {{id}}</div>
71
- </div>
66
+ <input file="name" value="{{name}}" />
67
+ <input file="directory" value="{{directory}}" />
68
+ <input file="content-type" value="{{content-type}}" />
69
+ <textarea file="src" value-type="string">{{src}}</textarea>
70
+ <div>id: {{id}}</div>
71
+ </div>
72
72
 
73
- <form>
74
- <button actions="export" array="files">export</button>
75
- </form>
73
+ <form>
74
+ <button actions="export" array="files">export</button>
75
+ </form>
76
76
 
77
- <!-- <script src="../dist/CoCreate-file.js"></script> -->
78
- <script src="../../../CoCreateJS/dist/CoCreate.js"></script>
79
- <!-- <script src="https://CoCreate.app/dist/CoCreate.js"></script> -->
80
- </body>
77
+ <!-- <script src="../dist/CoCreate-file.js"></script> -->
78
+ <script src="../../../CoCreateJS/dist/CoCreate.js"></script>
79
+ <!-- <script src="https://CoCreate.app/dist/CoCreate.js"></script> -->
80
+ </body>
81
81
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/file",
3
- "version": "1.19.2",
3
+ "version": "1.19.3",
4
4
  "description": "A versatile, configurable headless file uploader supporting local and server operations. Accessible via a JavaScript API and HTML5 attributes, it provides seamless file reading, writing, and uploading with fallbacks to the standard HTML5 file input API. Ideal for developers needing robust file management in headless environments.",
5
5
  "keywords": [
6
6
  "file-uploader",
package/src/client.js CHANGED
@@ -859,7 +859,7 @@ async function importURL(action) {
859
859
  queriedElement.setValue(data.file);
860
860
  }
861
861
 
862
- document.dispatchEvent(
862
+ action.element.dispatchEvent(
863
863
  new CustomEvent(action.name, {
864
864
  detail: {}
865
865
  })
@@ -895,7 +895,7 @@ async function fileRenderAction(action) {
895
895
  create(file, "directory", name);
896
896
  } else if (action.name === "deleteDirectory") Delete(file);
897
897
 
898
- document.dispatchEvent(
898
+ action.element.dispatchEvent(
899
899
  new CustomEvent(action.name, {
900
900
  detail: {}
901
901
  })
@@ -968,15 +968,15 @@ async function Delete(file) {
968
968
 
969
969
  Observer.init({
970
970
  name: "CoCreateFileAddedNodes",
971
- observe: ["addedNodes"],
971
+ types: ["addedNodes"],
972
972
  selector: '[type="file"]',
973
973
  callback: (mutation) => init(mutation.target)
974
974
  });
975
975
 
976
976
  Observer.init({
977
977
  name: "CoCreateFileAttributes",
978
- observe: ["attributes"],
979
- attributeName: ["type"],
978
+ types: ["attributes"],
979
+ attributeFilter: ["type"],
980
980
  selector: '[type="file"]',
981
981
  callback: (mutation) => init(mutation.target)
982
982
  });
@@ -1009,7 +1009,7 @@ Actions.init([
1009
1009
  // Something...
1010
1010
  }
1011
1011
 
1012
- document.dispatchEvent(
1012
+ action.element.dispatchEvent(
1013
1013
  new CustomEvent(action.name, {
1014
1014
  detail: {}
1015
1015
  })