@cocreate/element-prototype 1.29.0 → 1.29.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,27 @@
1
+ ## [1.29.2](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.29.1...v1.29.2) (2025-05-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update [@cocreate](https://github.com/cocreate) dependencies ([c805ddc](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/c805ddc969cbb391c4f1388f7a884e680532bfd8))
7
+
8
+ ## [1.29.1](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.29.0...v1.29.1) (2025-04-30)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * $relativePath ([c8293d1](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/c8293d1435b63c2f76de551b3c1ff0d562bd20dc))
14
+ * added css-loader ([240afa0](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/240afa09f391b124f50f440dbc9e61aff1b9af55))
15
+ * export ([47db21a](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/47db21afcf19e0c4eb5cad50cdcc7b7050d8002a))
16
+ * **getValue.js:** resolve attribute handling issues and enhance value processing ([d7fd518](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/d7fd518280c7100096cc240b0741a2d7e3432e07))
17
+ * handling of tagName switch case ([3521dd2](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/3521dd28bfb437b3b2ccd941050436b29dffa1e4))
18
+ * renamed from utility to operators.js ([60e1599](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/60e15990419097befb9fb69e93ffaed193aab65d))
19
+ * revert to previous version ([e91c567](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/e91c567b5ecd24ad69138cfc4b3f320bea0538ae))
20
+ * typo remove value = from getAttribute as its a set only method ([c3042db](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/c3042db5aab9950fc70076d8d799586c7d4d8c78))
21
+ * update query attributes ([a3f71d3](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/a3f71d376cba9747429fffc2c2092f270f9a0cd6))
22
+ * updated cocreate modules versions ([9047924](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/90479242b2f3b3779bffc95e3d274e5281b32474))
23
+ * webpack.config and devdependencies ([7240cdf](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/7240cdf0802609140f7b2d4a8309debab03f234e))
24
+
1
25
  # [1.29.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.28.1...v1.29.0) (2025-04-11)
2
26
 
3
27
 
package/docs/index.html CHANGED
@@ -1,234 +1,234 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <title>CoCreate-element-prototype Documentation | CoCreateJS</title>
8
- <link
9
- rel="icon"
10
- type="image/png"
11
- sizes="32x32"
12
- href="https://cocreate.app/images/favicon.ico" />
13
- <meta
14
- name="description"
15
- content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
16
- <meta
17
- name="keywords"
18
- content="helper classes, utility classes, css framework, css library, inline style classes" />
19
- <meta name="robots" content="index,follow" />
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <title>CoCreate-element-prototype Documentation | CoCreateJS</title>
8
+ <link
9
+ rel="icon"
10
+ type="image/png"
11
+ sizes="32x32"
12
+ href="https://cocreate.app/images/favicon.ico" />
13
+ <meta
14
+ name="description"
15
+ content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
16
+ <meta
17
+ name="keywords"
18
+ content="helper classes, utility classes, css framework, css library, inline style classes" />
19
+ <meta name="robots" content="index,follow" />
20
20
 
21
- <!-- CoCreate CSS CDN -->
21
+ <!-- CoCreate CSS CDN -->
22
22
 
23
- <link rel="manifest" href="/manifest.webmanifest" />
24
- </head>
23
+ <link rel="manifest" href="/manifest.webmanifest" />
24
+ </head>
25
25
 
26
- <body>
27
- <div array="" object="" key="" id="cocreate-element-prototype">
28
- <div
29
- class="display:flex flex-wrap:wrap justify-content:space-between margin:10px">
30
- <div class="display:flex align-items:center">
31
- <h2>CoCreate-element-prototype</h2>
32
- </div>
33
- <div
34
- class="display:flex align-items:center font-size:20px"
35
- share-height="600"
36
- share-width="500"
37
- share-media="https://via.placeholder.com/300/09f/fff.png">
38
- <a
39
- href="https://github.com/CoCreate-app/CoCreate-element-prototype"
40
- target="_blank"
41
- class="margin-right:15px"
42
- ><i src="/assets/svg/github.svg"></i
43
- ></a>
44
- <a
45
- class="margin-right:15px share"
46
- share-network="twitter"
47
- title="Share on twitter"
48
- ><i src="/assets/svg/twitter.svg"></i
49
- ></a>
50
- <a
51
- class="margin-right:15px share"
52
- share-network="facebook"
53
- title="Share on Facebook"
54
- ><i src="/assets/svg/facebook.svg"></i
55
- ></a>
56
- <a
57
- class="margin-right:15px share"
58
- share-network="instagram"
59
- title="Share on instagram"
60
- ><i src="/assets/svg/instagram.svg"></i
61
- ></a>
62
- <a
63
- class="margin-right:15px share"
64
- share-network="share"
65
- title="Share on share"
66
- ><i src="/assets/svg/share-alt.svg"></i
67
- ></a>
68
- </div>
69
- </div>
70
- <h1 class="max-width:500px margin:20px_10px">
71
- A simple HTML5, CSS and pure javascript component. Easy
72
- configuration using data-attributes and highly styleable.
73
- </h1>
74
- <div
75
- id="element-prototype-section"
76
- class="display:flex flex-wrap:wrap">
77
- <div class="flex-grow:1 width:300px padding:20px_10px">
78
- <h2
79
- class="border-bottom:1px_solid_lightgrey padding:5px_0px">
80
- Install
81
- </h2>
82
- <pre
83
- class="margin-top:15px"><code class="language-javascript">npm install cocreate-element-prototype</code></pre>
84
- <p class="padding:10px_0px">Or you can use cdn link:</p>
85
- <pre><code class="language-javascript">https://cdn.cocreate.app/js/CoCreate-element-prototype.min.js</code></pre>
26
+ <body>
27
+ <div array="" object="" key="" id="cocreate-element-prototype">
28
+ <div
29
+ class="display:flex flex-wrap:wrap justify-content:space-between margin:10px">
30
+ <div class="display:flex align-items:center">
31
+ <h2>CoCreate-element-prototype</h2>
32
+ </div>
33
+ <div
34
+ class="display:flex align-items:center font-size:20px"
35
+ share-height="600"
36
+ share-width="500"
37
+ share-media="https://via.placeholder.com/300/09f/fff.png">
38
+ <a
39
+ href="https://github.com/CoCreate-app/CoCreate-element-prototype"
40
+ target="_blank"
41
+ class="margin-right:15px"
42
+ ><i src="/assets/svg/github.svg"></i
43
+ ></a>
44
+ <a
45
+ class="margin-right:15px share"
46
+ share-network="twitter"
47
+ title="Share on twitter"
48
+ ><i src="/assets/svg/twitter.svg"></i
49
+ ></a>
50
+ <a
51
+ class="margin-right:15px share"
52
+ share-network="facebook"
53
+ title="Share on Facebook"
54
+ ><i src="/assets/svg/facebook.svg"></i
55
+ ></a>
56
+ <a
57
+ class="margin-right:15px share"
58
+ share-network="instagram"
59
+ title="Share on instagram"
60
+ ><i src="/assets/svg/instagram.svg"></i
61
+ ></a>
62
+ <a
63
+ class="margin-right:15px share"
64
+ share-network="share"
65
+ title="Share on share"
66
+ ><i src="/assets/svg/share-alt.svg"></i
67
+ ></a>
68
+ </div>
69
+ </div>
70
+ <h1 class="max-width:500px margin:20px_10px">
71
+ A simple HTML5, CSS and pure javascript component. Easy
72
+ configuration using data-attributes and highly styleable.
73
+ </h1>
74
+ <div
75
+ id="element-prototype-section"
76
+ class="display:flex flex-wrap:wrap">
77
+ <div class="flex-grow:1 width:300px padding:20px_10px">
78
+ <h2
79
+ class="border-bottom:1px_solid_lightgrey padding:5px_0px">
80
+ Install
81
+ </h2>
82
+ <pre
83
+ class="margin-top:15px"><code class="language-javascript">npm install cocreate-element-prototype</code></pre>
84
+ <p class="padding:10px_0px">Or you can use cdn link:</p>
85
+ <pre><code class="language-javascript">https://cdn.cocreate.app/js/CoCreate-element-prototype.min.js</code></pre>
86
86
 
87
- <h2
88
- class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
89
- Usage
90
- </h2>
91
- <p class="padding:10px_0px">
92
- element-prototype usage content
93
- </p>
94
- <pre><code class="language-html">&lt;div&gt;&lt;/div&gt;</code></pre>
87
+ <h2
88
+ class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
89
+ Usage
90
+ </h2>
91
+ <p class="padding:10px_0px">
92
+ element-prototype usage content
93
+ </p>
94
+ <pre><code class="language-html">&lt;div&gt;&lt;/div&gt;</code></pre>
95
95
 
96
- <h2
97
- class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
98
- Reference
99
- </h2>
100
- <p class="padding:10px_0px">
101
- This is element-prototype reference content
102
- </p>
103
- <pre><code class="language-javascript">&lt;div&gt;&lt;/div&gt;</code></pre>
104
- <p class="padding:10px_0px">
105
- This is element-prototype reference content
106
- </p>
96
+ <h2
97
+ class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
98
+ Reference
99
+ </h2>
100
+ <p class="padding:10px_0px">
101
+ This is element-prototype reference content
102
+ </p>
103
+ <pre><code class="language-javascript">&lt;div&gt;&lt;/div&gt;</code></pre>
104
+ <p class="padding:10px_0px">
105
+ This is element-prototype reference content
106
+ </p>
107
107
 
108
- <h2
109
- class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
110
- Attributes
111
- </h2>
112
- <ul class="list-style-type:none">
113
- <li
114
- class="padding:15px_0px border-bottom:1px_solid_lightgrey">
115
- <h4>
116
- <span>element-prototype</span>
117
- <span class="cocreate-badge success"
118
- >string</span
119
- >
120
- <span class="cocreate-badge warning"
121
- >optional</span
122
- >
123
- </h4>
124
- <p>element-prototype-attribute</p>
125
- </li>
126
- <li
127
- class="padding:15px_0px border-bottom:1px_solid_lightgrey">
128
- <h4>
129
- <span>element-prototype</span>
130
- <span class="cocreate-badge success"
131
- >string</span
132
- >
133
- <span class="cocreate-badge warning"
134
- >optional</span
135
- >
136
- </h4>
137
- <p>element-prototype-attribute</p>
138
- </li>
139
- </ul>
140
- </div>
108
+ <h2
109
+ class="border-bottom:1px_solid_lightgrey margin-top:20px padding:5px_0px">
110
+ Attributes
111
+ </h2>
112
+ <ul class="list-style-type:none">
113
+ <li
114
+ class="padding:15px_0px border-bottom:1px_solid_lightgrey">
115
+ <h4>
116
+ <span>element-prototype</span>
117
+ <span class="cocreate-badge success"
118
+ >string</span
119
+ >
120
+ <span class="cocreate-badge warning"
121
+ >optional</span
122
+ >
123
+ </h4>
124
+ <p>element-prototype-attribute</p>
125
+ </li>
126
+ <li
127
+ class="padding:15px_0px border-bottom:1px_solid_lightgrey">
128
+ <h4>
129
+ <span>element-prototype</span>
130
+ <span class="cocreate-badge success"
131
+ >string</span
132
+ >
133
+ <span class="cocreate-badge warning"
134
+ >optional</span
135
+ >
136
+ </h4>
137
+ <p>element-prototype-attribute</p>
138
+ </li>
139
+ </ul>
140
+ </div>
141
141
 
142
- <div
143
- class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px border-bottom:1px_solid_lightgrey">
144
- <!-- SandBox -->
145
- <h2
146
- class="border-bottom:1px_solid_lightgrey padding:5px_0px">
147
- Demo
148
- </h2>
149
- <div
150
- class="position:sticky top:0 padding:10px_0px height:100vh">
151
- <!-- SandBox -->
152
- <div
153
- class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
154
- id="playground">
155
- <div
156
- id="demo-code"
157
- resizable
158
- class="position:relative height:50%">
159
- <textarea
160
- type="code"
161
- lang="html"
162
- array="demos"
163
- object=""
164
- key="demo"
165
- save="false"
166
- id="demo"
167
- class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
168
- <div
169
- resize="bottom"
170
- class="background:lightgrey"></div>
171
- </div>
142
+ <div
143
+ class="flex-grow:1 width:300px padding:0px_10px margin:20px_0px border-bottom:1px_solid_lightgrey">
144
+ <!-- SandBox -->
145
+ <h2
146
+ class="border-bottom:1px_solid_lightgrey padding:5px_0px">
147
+ Demo
148
+ </h2>
149
+ <div
150
+ class="position:sticky top:0 padding:10px_0px height:100vh">
151
+ <!-- SandBox -->
152
+ <div
153
+ class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
154
+ id="playground">
155
+ <div
156
+ id="demo-code"
157
+ resizable
158
+ class="position:relative height:50%">
159
+ <textarea
160
+ type="code"
161
+ lang="html"
162
+ array="demos"
163
+ object=""
164
+ key="demo"
165
+ save="false"
166
+ id="demo"
167
+ class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
168
+ <div
169
+ resize="bottom"
170
+ class="background:lightgrey"></div>
171
+ </div>
172
172
 
173
- <div
174
- id="demo-preview"
175
- class="position:relative overflow:auto background-color:white">
176
- <div class="demopreview padding:20px"></div>
177
- </div>
173
+ <div
174
+ id="demo-preview"
175
+ class="position:relative overflow:auto background-color:white">
176
+ <div class="demopreview padding:20px"></div>
177
+ </div>
178
178
 
179
- <div
180
- class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
181
- <a
182
- class="margin-right:10px"
183
- id="eye"
184
- show="#eye-slash"
185
- hide="#eye, #demo-preview"
186
- toggle="code-height"
187
- toggle-selector="#demo-code"
188
- ><i
189
- class="height:18px"
190
- src="/assets/svg/eye.svg"></i
191
- ></a>
192
- <a
193
- class="margin-right:10px"
194
- hidden
195
- id="eye-slash"
196
- show="#eye, #demo-preview"
197
- hide="#eye-slash"
198
- toggle="code-height"
199
- toggle-selector="#demo-code"
200
- ><i src="/assets/svg/eye-slash.svg"></i
201
- ></a>
202
- <a
203
- class="margin-right:10px"
204
- id="code"
205
- show="#code-slash"
206
- hide="#code, #demo-code"
207
- ><i src="/assets/svg/code.svg"></i
208
- ></a>
209
- <a
210
- class="margin-right:10px"
211
- hidden
212
- id="code-slash"
213
- show="#code, #demo-code"
214
- hide="#code-slash"
215
- ><i
216
- class="height:18px"
217
- src="/assets/svg/code.svg"></i
218
- ></a>
219
- <a
220
- class="margin-right:5px"
221
- fullscreen
222
- fullscreen-selector="#playground"></a>
223
- </div>
224
- </div>
225
- <!-- End SandBox -->
226
- </div>
227
- </div>
228
- </div>
229
- </div>
179
+ <div
180
+ class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
181
+ <a
182
+ class="margin-right:10px"
183
+ id="eye"
184
+ show="#eye-slash"
185
+ hide="#eye, #demo-preview"
186
+ toggle="code-height"
187
+ toggle-query="#demo-code"
188
+ ><i
189
+ class="height:18px"
190
+ src="/assets/svg/eye.svg"></i
191
+ ></a>
192
+ <a
193
+ class="margin-right:10px"
194
+ hidden
195
+ id="eye-slash"
196
+ show="#eye, #demo-preview"
197
+ hide="#eye-slash"
198
+ toggle="code-height"
199
+ toggle-query="#demo-code"
200
+ ><i src="/assets/svg/eye-slash.svg"></i
201
+ ></a>
202
+ <a
203
+ class="margin-right:10px"
204
+ id="code"
205
+ show="#code-slash"
206
+ hide="#code, #demo-code"
207
+ ><i src="/assets/svg/code.svg"></i
208
+ ></a>
209
+ <a
210
+ class="margin-right:10px"
211
+ hidden
212
+ id="code-slash"
213
+ show="#code, #demo-code"
214
+ hide="#code-slash"
215
+ ><i
216
+ class="height:18px"
217
+ src="/assets/svg/code.svg"></i
218
+ ></a>
219
+ <a
220
+ class="margin-right:5px"
221
+ fullscreen
222
+ fullscreen-query="#playground"></a>
223
+ </div>
224
+ </div>
225
+ <!-- End SandBox -->
226
+ </div>
227
+ </div>
228
+ </div>
229
+ </div>
230
230
 
231
- <!--CoCreateJS-->
232
- <script src="https://CoCreate.app/dist/CoCreate.js"></script>
233
- </body>
231
+ <!--CoCreateJS-->
232
+ <script src="https://CoCreate.app/dist/CoCreate.js"></script>
233
+ </body>
234
234
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/element-prototype",
3
- "version": "1.29.0",
3
+ "version": "1.29.2",
4
4
  "description": "A simple element-prototype component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "element-prototype",
@@ -45,19 +45,15 @@
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "devDependencies": {
48
- "@babel/core": "^7.9.6",
49
- "@babel/preset-env": "^7.9.6",
50
- "babel-loader": "^8.1.0",
51
- "clean-webpack-plugin": "^3.0.0",
52
- "file-loader": "^6.2.0",
48
+ "css-loader": "^5.1.3",
49
+ "esbuild": "^0.25.2",
50
+ "esbuild-loader": "^4.3.0",
53
51
  "mini-css-extract-plugin": "^1.5.0",
54
- "style-loader": "^3.3.1",
55
- "terser-webpack-plugin": "^5.1.1",
56
52
  "webpack": "^5.24.4",
57
53
  "webpack-cli": "^4.5.0",
58
54
  "webpack-log": "^3.0.1"
59
55
  },
60
56
  "dependencies": {
61
- "@cocreate/utils": "1.37.3"
57
+ "@cocreate/utils": "^1.39.0"
62
58
  }
63
59
  }
@@ -1,14 +1,22 @@
1
- import { processOperators } from "./utility";
1
+ import { processOperators } from "./operators";
2
2
 
3
3
  // Store a reference to the original getAttribute function
4
4
  const originalGetAttribute = Element.prototype.getAttribute;
5
+
6
+ // Map to store attribute details
5
7
  const attributes = new Map();
6
8
 
9
+ // Add an event listener for storage events to update attributes
7
10
  window.addEventListener("storage", updateAttributes);
11
+ // Custom event to update attributes
8
12
  window.addEventListener("updateAttributes", function (e) {
9
13
  updateAttributes(e.detail);
10
14
  });
11
15
 
16
+ /**
17
+ * Function to update attributes based on specific storage keys
18
+ * @param {Object} e - The event object containing key and newValue
19
+ */
12
20
  function updateAttributes(e) {
13
21
  const keys = ["organization_id", "user_id", "clientId", "session_id"];
14
22
  if (keys.includes(e.key)) {
@@ -19,8 +27,24 @@ function updateAttributes(e) {
19
27
  }
20
28
  }
21
29
 
22
- // Override the getAttribute function
30
+ /**
31
+ * Custom getAttribute function that processes the attribute value
32
+ * @param {Element} element - The element from which to get the attribute
33
+ * @param {string} name - The attribute name
34
+ * @returns {string} - The processed attribute value
35
+ */
36
+ function getAttribute(element, name) {
37
+ if (!(element instanceof Element)) {
38
+ throw new Error("First argument must be an Element");
39
+ }
40
+ let value = originalGetAttribute.call(element, name);
41
+ return processOperators(element, value);
42
+ }
43
+
44
+ // Override the getAttribute method on Element prototype
23
45
  Element.prototype.getAttribute = function (name) {
24
- let value = originalGetAttribute.call(this, name);
25
- return processOperators(this, value);
46
+ return getAttribute(this, name); // Use the custom getAttribute function
26
47
  };
48
+
49
+ // Export the custom getAttribute function
50
+ export { getAttribute };