@cocreate/events 1.13.7 → 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 +20 -0
- package/demo/click.html +3 -3
- package/demo/index.html +3 -3
- package/demo/observer.html +39 -0
- package/demo/selected.html +3 -3
- package/demo/set-value.html +3 -3
- package/package.json +5 -5
- package/src/index.js +16 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
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
|
+
|
|
14
|
+
## [1.13.8](https://github.com/CoCreate-app/CoCreate-events/compare/v1.13.7...v1.13.8) (2023-10-25)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* bump dependencies ([bee4795](https://github.com/CoCreate-app/CoCreate-events/commit/bee4795595054791a183c60fb29e148da9ec94c7))
|
|
20
|
+
|
|
1
21
|
## [1.13.7](https://github.com/CoCreate-app/CoCreate-events/compare/v1.13.6...v1.13.7) (2023-10-17)
|
|
2
22
|
|
|
3
23
|
|
package/demo/click.html
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<!-- CoCreate Favicon -->
|
|
7
7
|
<link
|
|
8
8
|
rel="icon"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
type="image/png"
|
|
10
|
+
sizes="32x32"
|
|
11
|
+
href="../assets/favicon.ico" />
|
|
12
12
|
|
|
13
13
|
<!-- Custom CSS -->
|
|
14
14
|
<style type="text/css">
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Observer Events | CoCreateJS</title>
|
|
5
|
+
|
|
6
|
+
<!-- CoCreate Favicon -->
|
|
7
|
+
<link
|
|
8
|
+
rel="icon"
|
|
9
|
+
type="image/png"
|
|
10
|
+
sizes="32x32"
|
|
11
|
+
href="../assets/favicon.ico" />
|
|
12
|
+
|
|
13
|
+
<!-- Custom CSS -->
|
|
14
|
+
<style type="text/css">
|
|
15
|
+
.test {
|
|
16
|
+
background: red;
|
|
17
|
+
}
|
|
18
|
+
.new {
|
|
19
|
+
background: yellow;
|
|
20
|
+
}
|
|
21
|
+
.active {
|
|
22
|
+
background-color: blue;
|
|
23
|
+
}
|
|
24
|
+
.hidden {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div click-parent click-value="active">click here</div>
|
|
32
|
+
<div observe-parent observe-attribute="class" observe-value="active">
|
|
33
|
+
testing this new value
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<!--<script src="../dist/CoCreate-events.js"></script>-->
|
|
37
|
+
<script src="https://CoCreate.app/dist/CoCreate.js"></script>
|
|
38
|
+
</body>
|
|
39
|
+
</html>
|
package/demo/selected.html
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<!-- CoCreate Favicon -->
|
|
7
7
|
<link
|
|
8
8
|
rel="icon"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 {
|
package/demo/set-value.html
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<!-- CoCreate Favicon -->
|
|
7
7
|
<link
|
|
8
8
|
rel="icon"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.
|
|
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.
|
|
62
|
-
"@cocreate/element-prototype": "^1.11.
|
|
63
|
-
"@cocreate/observer": "^1.11.
|
|
64
|
-
"@cocreate/utils": "^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`)
|
|
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
|
-
|
|
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: {}
|