@cocreate/element-prototype 1.21.0 → 1.22.1
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 +15 -0
- package/package.json +1 -1
- package/src/getAttribute.js +4 -0
- package/src/getValue.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.22.1](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.22.0...v1.22.1) (2024-03-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* getAttribute type ([17545c2](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/17545c2c9ebb8766c455bce40a7e386f4fd94c47))
|
|
7
|
+
* handling of valueType text ([6e6663d](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/6e6663db99938fee08178b5e8f136434632884e6))
|
|
8
|
+
|
|
9
|
+
# [1.22.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.21.0...v1.22.0) (2024-02-20)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* $innerWidth and $innerHeight operators ([c731aab](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/c731aab6aa26f8b3abe1b67624a5b98a6eae5aa9))
|
|
15
|
+
|
|
1
16
|
# [1.21.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.20.1...v1.21.0) (2024-02-13)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/element-prototype",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.1",
|
|
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",
|
package/src/getAttribute.js
CHANGED
|
@@ -13,6 +13,10 @@ Element.prototype.getAttribute = function (name) {
|
|
|
13
13
|
value = localStorage.getItem('clientId')
|
|
14
14
|
else if (value === '$session_id')
|
|
15
15
|
value = localStorage.getItem('session_id')
|
|
16
|
+
else if (value === '$innerWidth')
|
|
17
|
+
value = window.innerWidth
|
|
18
|
+
else if (value === '$innerHeight')
|
|
19
|
+
value = window.innerHeight
|
|
16
20
|
else if (typeof value === 'string') {
|
|
17
21
|
if (value.startsWith('$search')) {
|
|
18
22
|
const searchParams = new URLSearchParams(window.location.search);
|
package/src/getValue.js
CHANGED
|
@@ -79,7 +79,7 @@ const getValue = (element) => {
|
|
|
79
79
|
optionValue = prefix + optionValue + suffix;
|
|
80
80
|
value.push(optionValue);
|
|
81
81
|
}
|
|
82
|
-
} else if (["time", "date", "datetime", "datetime-local"].includes(element.type)) {
|
|
82
|
+
} else if (["time", "date", "datetime", "datetime-local"].includes(element.getAttribute('type'))) {
|
|
83
83
|
if (value === '$now')
|
|
84
84
|
value = new Date()
|
|
85
85
|
else if (value)
|
|
@@ -124,6 +124,8 @@ const getValue = (element) => {
|
|
|
124
124
|
value = element.srcdoc;
|
|
125
125
|
} else if (element.hasAttribute('value')) {
|
|
126
126
|
value = element.getAttribute('value');
|
|
127
|
+
} else if (valueType === 'text') {
|
|
128
|
+
value = element.innerText;
|
|
127
129
|
} else {
|
|
128
130
|
value = element.innerHTML;
|
|
129
131
|
}
|