@cocreate/events 1.8.3 → 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.
@@ -8,7 +8,11 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
10
  - name: Checkout
11
- uses: actions/checkout@v2
11
+ uses: actions/checkout@v3
12
+ - name: setup nodejs
13
+ uses: actions/setup-node@v3
14
+ with:
15
+ node-version: 16
12
16
  - name: Jaid/action-sync-node-meta
13
17
  uses: jaid/action-sync-node-meta@v1.4.0
14
18
  with:
@@ -19,6 +23,10 @@ jobs:
19
23
  steps:
20
24
  - name: Checkout
21
25
  uses: actions/checkout@v3
26
+ - name: setup nodejs
27
+ uses: actions/setup-node@v3
28
+ with:
29
+ node-version: 16
22
30
  - name: Semantic Release
23
31
  uses: cycjimmy/semantic-release-action@v3
24
32
  id: semantic
@@ -77,7 +85,11 @@ jobs:
77
85
  runs-on: ubuntu-latest
78
86
  steps:
79
87
  - name: Checkout
80
- uses: actions/checkout@v2
88
+ uses: actions/checkout@v3
89
+ - name: setup nodejs
90
+ uses: actions/setup-node@v3
91
+ with:
92
+ node-version: 16
81
93
 
82
94
  - name: update documentation
83
95
  uses: CoCreate-app/CoCreate-docs@master
package/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
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
+
18
+ ## [1.8.4](https://github.com/CoCreate-app/CoCreate-events/compare/v1.8.3...v1.8.4) (2023-04-24)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * updated worrkflows to v3 and node version 16 ([8d52380](https://github.com/CoCreate-app/CoCreate-events/commit/8d52380cf7ecf091d17aa0f4007306b5d851ceaa))
24
+
1
25
  ## [1.8.3](https://github.com/CoCreate-app/CoCreate-events/compare/v1.8.2...v1.8.3) (2023-04-24)
2
26
 
3
27
 
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.5/CoCreate.min.js" ></script> -->
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
- <!-- <div click-target="#testing" click-value="hello, bye" click-key="ty">
67
- <span id="testing" class="{{ty}}">other content</span>
68
- </div> -->
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
- <script src="https://cdn.cocreate.app/1.50.5/CoCreate.min.js"></script>
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>
@@ -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.5/CoCreate.min.js"></script>
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"><i class="fas fa-expand"></i></a>
146
+ <a class="margin-right:5px" fullscreen fullscreen-target="#playground"></a>
147
147
  </div>
148
148
 
149
149
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/events",
3
- "version": "1.8.3",
3
+ "version": "1.9.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",
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 = element.getAttribute(`${prefix}-value`) || element.getAttribute(prefix);
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.originalHTML
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");