@cocreate/events 1.13.8 → 1.14.0

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,16 @@
1
+ # [1.14.0](https://github.com/CoCreate-app/CoCreate-events/compare/v1.13.8...v1.14.0) (2023-11-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * favicon.ico path ([d4dd07c](https://github.com/CoCreate-app/CoCreate-events/commit/d4dd07c2532b9bb2c69f50770165a0daa73ce2cb))
7
+ * update dependencies to the lates versions ([bca4417](https://github.com/CoCreate-app/CoCreate-events/commit/bca44178630f52bced0864850228da8310630958))
8
+
9
+
10
+ ### Features
11
+
12
+ * trigger prefix event on target elements ([f8a96df](https://github.com/CoCreate-app/CoCreate-events/commit/f8a96dff58771fc2cd91653cb9281443b54c1599))
13
+
1
14
  ## [1.13.8](https://github.com/CoCreate-app/CoCreate-events/compare/v1.13.7...v1.13.8) (2023-10-25)
2
15
 
3
16
 
package/demo/click.html CHANGED
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
 
13
13
  <!-- Custom CSS -->
14
14
  <style type="text/css">
package/demo/index.html CHANGED
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
 
13
13
  <!-- Custom CSS -->
14
14
  <style type="text/css">
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
 
13
13
  <!-- Custom CSS -->
14
14
  <style type="text/css">
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <!-- Custom CSS -->
13
13
  <style type="text/css">
14
14
  .test {
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/events",
3
- "version": "1.13.8",
3
+ "version": "1.14.0",
4
4
  "description": "A simple events component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "events",
@@ -58,9 +58,9 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/actions": "^1.12.0",
62
- "@cocreate/element-prototype": "^1.11.7",
63
- "@cocreate/observer": "^1.11.6",
64
- "@cocreate/utils": "^1.26.1"
61
+ "@cocreate/actions": "^1.12.1",
62
+ "@cocreate/element-prototype": "^1.11.8",
63
+ "@cocreate/observer": "^1.11.7",
64
+ "@cocreate/utils": "^1.26.2"
65
65
  }
66
66
  }
package/src/index.js CHANGED
@@ -20,12 +20,11 @@
20
20
  // you must obtain a commercial license from CoCreate LLC.
21
21
  // For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
22
22
 
23
- import { queryElements } from '@cocreate/utils';
23
+ import { queryElements, checkMediaQueries } from '@cocreate/utils';
24
24
  import action from '@cocreate/actions';
25
25
  import observer from '@cocreate/observer';
26
26
  import '@cocreate/element-prototype';
27
27
 
28
-
29
28
  const CoCreateEvents = {
30
29
 
31
30
  init: function (prefix, events) {
@@ -237,7 +236,11 @@ const CoCreateEvents = {
237
236
  if (!values || values.length == 0)
238
237
  return;
239
238
 
240
- let targetAttribute = element.getAttribute(`${prefix}-attribute`) || 'class';
239
+ let targetAttribute = element.getAttribute(`${prefix}-attribute`);
240
+ // targetAttribute = checkMediaQueries(targetAttribute)
241
+ // if (targetAttribute === false)
242
+ // return
243
+
241
244
  let targetText = element.getAttribute(`${prefix}-text`);
242
245
  let targetHtml = element.getAttribute(`${prefix}-html`);
243
246
  let targetKey = element.getAttribute(`${prefix}-key`);
@@ -253,6 +256,10 @@ const CoCreateEvents = {
253
256
 
254
257
  groupValues = groupValues.map(x => x.trim());
255
258
  let groupAttribute = el.getAttribute(`${prefix}-attribute`) || 'class';
259
+ // groupAttribute = checkMediaQueries(groupAttribute)
260
+ // if (!groupAttribute)
261
+ // return
262
+
256
263
  let groupKey = el.getAttribute(`${prefix}-key`)
257
264
 
258
265
  // el.removeAttribute(prefix)
@@ -270,8 +277,12 @@ const CoCreateEvents = {
270
277
  if (targetElements === false)
271
278
  targetElements = [element]
272
279
 
273
- for (let i = 0; i < targetElements.length; i++)
274
- this.setValue(prefix, targetElements[i], targetAttribute, values, targetKey)
280
+ for (let i = 0; i < targetElements.length; i++) {
281
+ if (!targetAttribute && targetAttribute !== '' && ['click', 'focus', 'blur'].includes(prefix)) {
282
+ targetElements[i][prefix]()
283
+ } else
284
+ this.setValue(prefix, targetElements[i], targetAttribute, values, targetKey)
285
+ }
275
286
 
276
287
  document.dispatchEvent(new CustomEvent(`${prefix}End`, {
277
288
  detail: {}