@cocreate/events 1.8.4 → 1.9.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 +17 -0
- package/demo/click.html +1 -1
- package/demo/index.html +6 -5
- package/demo/selected.html +1 -1
- package/docs/index.html +1 -1
- package/package.json +1 -1
- package/src/index.js +14 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# [1.9.0](https://github.com/CoCreate-app/CoCreate-events/compare/v1.8.4...v1.9.0) (2023-04-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fullscreen target updated to fullscreen fullscreen-target ([a6c2acb](https://github.com/CoCreate-app/CoCreate-events/commit/a6c2acb8870ba52e916939a4d6cb7e0fddc5249b))
|
|
7
|
+
* package-lock.json and pnpm-lock.yaml added to .gitignore ([b93d0c3](https://github.com/CoCreate-app/CoCreate-events/commit/b93d0c3cb06498be033c4117b2501e17e3556840))
|
|
8
|
+
* removed toogle fullscreen icons. now using css content ([c3fff41](https://github.com/CoCreate-app/CoCreate-events/commit/c3fff41dfdfcd67f876b66a29abf41fca3e8d59e))
|
|
9
|
+
* typo originalHTML to originalHtml ([3ac8d14](https://github.com/CoCreate-app/CoCreate-events/commit/3ac8d143b7d5fbcb4985844414d0fbb18e4f7f79))
|
|
10
|
+
* typo originalHTML to originalHtml ([fa694cb](https://github.com/CoCreate-app/CoCreate-events/commit/fa694cb50e63b92c8e60895e1c1c632ebdab9f3f))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* localStorage attributes ([e2f5089](https://github.com/CoCreate-app/CoCreate-events/commit/e2f5089975428f96bf155f58e3581502122562f8))
|
|
16
|
+
* observer -key attributes ([7b5c218](https://github.com/CoCreate-app/CoCreate-events/commit/7b5c218756249f6017b1bf03c39fb6ba8d5fa87b))
|
|
17
|
+
|
|
1
18
|
## [1.8.4](https://github.com/CoCreate-app/CoCreate-events/compare/v1.8.3...v1.8.4) (2023-04-24)
|
|
2
19
|
|
|
3
20
|
|
package/demo/click.html
CHANGED
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
|
|
66
66
|
<!-- <script src="../dist/CoCreate-events.js"></script> -->
|
|
67
67
|
<script src="https://cdn.cocreate.app/latest/CoCreate.min.js" ></script>
|
|
68
|
-
<!-- <script src="https://cdn.cocreate.app/1.50.
|
|
68
|
+
<!-- <script src="https://cdn.cocreate.app/1.50.6/CoCreate.min.js" ></script> -->
|
|
69
69
|
</body>
|
|
70
70
|
</html>
|
package/demo/index.html
CHANGED
|
@@ -63,9 +63,11 @@
|
|
|
63
63
|
other content
|
|
64
64
|
</div>
|
|
65
65
|
<!-- defining key example -->
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
<div click-target="#testing" click-value="hello, bye" click-key="ty"> click here</div>
|
|
67
|
+
<div id="testing" class="{{ty}}">
|
|
68
|
+
<span class="{{ty}}"><b a="{{ty}}">other content {{ty}}</b></span>
|
|
69
|
+
<span class="{{ty}}"><b a="{{ty}}">other content {{ty}}</b></span>
|
|
70
|
+
</div>
|
|
69
71
|
|
|
70
72
|
<!-- defining key example -->
|
|
71
73
|
<div >
|
|
@@ -81,8 +83,7 @@
|
|
|
81
83
|
<input placeholder="Search all attributes" input-value input-key="keyname" input-target="#keyname">
|
|
82
84
|
|
|
83
85
|
<!--<script src="../dist/CoCreate-events.js"></script>-->
|
|
84
|
-
|
|
85
|
-
<!-- <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script> -->
|
|
86
|
+
<script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
|
|
86
87
|
|
|
87
88
|
</body>
|
|
88
89
|
</html>
|
package/demo/selected.html
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</div>
|
|
50
50
|
|
|
51
51
|
<!-- <script src="../dist/CoCreate-selected.js"></script> -->
|
|
52
|
-
<script src="https://cdn.cocreate.app/1.50.
|
|
52
|
+
<script src="https://cdn.cocreate.app/1.50.6/CoCreate.min.js"></script>
|
|
53
53
|
<!-- <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script> -->
|
|
54
54
|
</body>
|
|
55
55
|
</html>
|
package/docs/index.html
CHANGED
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
<a class="margin-right:10px" hidden id="eye-slash" show="#eye, #demo-preview" hide="#eye-slash" events="code-height" events-target="#demo-code"><i class="fas fa-eye-slash"></i></a>
|
|
144
144
|
<a class="margin-right:10px" id="code" show="#code-slash" hide="#code, #demo-code"><i class="fa fa-code"></i></a>
|
|
145
145
|
<a class="margin-right:10px" hidden id="code-slash" show="#code, #demo-code" hide="#code-slash"><i class="fas fa-code"></i></a>
|
|
146
|
-
<a class="margin-right:5px" fullscreen target="#playground"
|
|
146
|
+
<a class="margin-right:5px" fullscreen fullscreen-target="#playground"></a>
|
|
147
147
|
</div>
|
|
148
148
|
|
|
149
149
|
</div>
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const CoCreateEvents = {
|
|
|
20
20
|
this.initPrefix('selected', ['click']);
|
|
21
21
|
this.initPrefix('onload', ['onload']);
|
|
22
22
|
this.initPrefix('observe', ['observer']);
|
|
23
|
+
this.initPrefix('localstorage', ['onload', 'observer']);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
let customEventEls = document.querySelectorAll('[event-name]')
|
|
@@ -56,7 +57,7 @@ const CoCreateEvents = {
|
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
let selector = `[${prefix}], [${prefix}-value], [${prefix}-target], [${prefix}-closest], [${prefix}-parent], [${prefix}-next], [${prefix}-previous]`
|
|
60
|
+
let selector = `[${prefix}], [${prefix}-key], [${prefix}-value], [${prefix}-target], [${prefix}-closest], [${prefix}-parent], [${prefix}-next], [${prefix}-previous]`
|
|
60
61
|
|
|
61
62
|
observer.init({
|
|
62
63
|
name: 'CoCreateEventattributes',
|
|
@@ -72,7 +73,7 @@ const CoCreateEvents = {
|
|
|
72
73
|
observer.init({
|
|
73
74
|
name: 'observerAttributes',
|
|
74
75
|
observe: ['attributes'],
|
|
75
|
-
attributeName: [`${prefix}-target`, `${prefix}-closest`, `${prefix}-parent`, `${prefix}-next`, `${prefix}-previous`],
|
|
76
|
+
attributeName: [`${prefix}-key`, `${prefix}-value`, `${prefix}-target`, `${prefix}-closest`, `${prefix}-parent`, `${prefix}-next`, `${prefix}-previous`],
|
|
76
77
|
callback: function(mutation) {
|
|
77
78
|
// remove previous observer
|
|
78
79
|
self.initElements([mutation.target], prefix, events)
|
|
@@ -158,7 +159,7 @@ const CoCreateEvents = {
|
|
|
158
159
|
// return;
|
|
159
160
|
self.__updateElements(target, prefix);
|
|
160
161
|
|
|
161
|
-
let selector = `[${prefix}], [${prefix}-value], [${prefix}-target], [${prefix}-closest], [${prefix}-parent], [${prefix}-next], [${prefix}-previous]`
|
|
162
|
+
let selector = `[${prefix}], [${prefix}-key], [${prefix}-value], [${prefix}-target], [${prefix}-closest], [${prefix}-parent], [${prefix}-next], [${prefix}-previous]`
|
|
162
163
|
|
|
163
164
|
let parentElement = target.parentElement;
|
|
164
165
|
if (parentElement) {
|
|
@@ -185,7 +186,15 @@ const CoCreateEvents = {
|
|
|
185
186
|
const self = this;
|
|
186
187
|
// ToDo: support empty value when prefix-attribute defined, add and remove the attribute
|
|
187
188
|
|
|
188
|
-
let values
|
|
189
|
+
let values
|
|
190
|
+
if (prefix === 'localstorage') {
|
|
191
|
+
let key = element.getAttribute('localstorage-get')
|
|
192
|
+
if (key)
|
|
193
|
+
values = localStorage.getItem(key)
|
|
194
|
+
else
|
|
195
|
+
return
|
|
196
|
+
} else
|
|
197
|
+
values = element.getAttribute(`${prefix}-value`) || element.getAttribute(prefix);
|
|
189
198
|
if (values)
|
|
190
199
|
values = values.split(',');
|
|
191
200
|
else {
|
|
@@ -451,7 +460,7 @@ function replaceKey(prefix, element, key, values) {
|
|
|
451
460
|
else
|
|
452
461
|
element.htmlKeys[key] = value;
|
|
453
462
|
|
|
454
|
-
let newHTML = element.
|
|
463
|
+
let newHTML = element.originalHtml
|
|
455
464
|
if (newHTML) {
|
|
456
465
|
for (let elementKey of Object.keys(element.htmlKeys)) {
|
|
457
466
|
const htmlKeyRegex = new RegExp(elementKey, "g");
|