clapton 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/clapton/javascripts/dist/client.js +2 -0
- data/lib/clapton/javascripts/dist/components-for-test.js +6 -1
- data/lib/clapton/javascripts/dist/components.js +6 -1
- data/lib/clapton/javascripts/src/client.ts +2 -0
- data/lib/clapton/javascripts/src/components/component.ts +5 -1
- data/lib/clapton/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eef5820604c561e4e740eb50620f88cfc0b9466517ad9e3f5da364a1d923356d
|
4
|
+
data.tar.gz: a1ce6f1bbc737affe77cdf3cb8370722c6fb169c6b4b386bb17fa53ed3799f47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b36f22c1f26313d9aabe6e67844df736302c92b4f42805b09be40dca60b3ddab9c8a7b40a70dbab3c55ee7baa9ec508820342d4f4e296b16ca053721cff598ad
|
7
|
+
data.tar.gz: dd95168998ca12d46b7eb164698f918b6a8f0575e7a8be435a2943054a4a0407209758a834514719c11f496424ec29a1bcb4701a0d05ceb625e35b07d468789b
|
data/README.md
CHANGED
@@ -349,6 +349,18 @@ module ApplicationCable
|
|
349
349
|
end
|
350
350
|
```
|
351
351
|
|
352
|
+
### Events
|
353
|
+
|
354
|
+
#### clapton:render
|
355
|
+
|
356
|
+
The `clapton:render` event is a custom event that is triggered when the component is rendered.
|
357
|
+
|
358
|
+
```javascript
|
359
|
+
document.addEventListener("clapton:render", () => {
|
360
|
+
console.log("clapton:render");
|
361
|
+
});
|
362
|
+
```
|
363
|
+
|
352
364
|
### Testing
|
353
365
|
|
354
366
|
#### RSpec
|
@@ -521,7 +521,12 @@ var Clapton = (function (exports) {
|
|
521
521
|
}
|
522
522
|
get renderWrapper() {
|
523
523
|
const root = this.render;
|
524
|
-
|
524
|
+
if (root.attributes) {
|
525
|
+
root.attributes = { ...root.attributes, data: { ...root.attributes.data, component: this.constructor.name, state: JSON.stringify(this._state), id: this.id, errors: this._errors } };
|
526
|
+
}
|
527
|
+
else {
|
528
|
+
root.attributes = { data: { component: this.constructor.name, state: JSON.stringify(this._state), id: this.id, errors: this._errors } };
|
529
|
+
}
|
525
530
|
return root.renderWrapper;
|
526
531
|
}
|
527
532
|
}
|
@@ -473,7 +473,12 @@ class Component {
|
|
473
473
|
}
|
474
474
|
get renderWrapper() {
|
475
475
|
const root = this.render;
|
476
|
-
|
476
|
+
if (root.attributes) {
|
477
|
+
root.attributes = { ...root.attributes, data: { ...root.attributes.data, component: this.constructor.name, state: JSON.stringify(this._state), id: this.id, errors: this._errors } };
|
478
|
+
}
|
479
|
+
else {
|
480
|
+
root.attributes = { data: { component: this.constructor.name, state: JSON.stringify(this._state), id: this.id, errors: this._errors } };
|
481
|
+
}
|
477
482
|
return root.renderWrapper;
|
478
483
|
}
|
479
484
|
}
|
@@ -20,7 +20,11 @@ export class Component {
|
|
20
20
|
|
21
21
|
get renderWrapper(): string {
|
22
22
|
const root = this.render;
|
23
|
-
|
23
|
+
if (root.attributes) {
|
24
|
+
root.attributes = { ...root.attributes, data: { ...root.attributes.data, component: this.constructor.name, state: JSON.stringify(this._state), id: this.id, errors: this._errors } };
|
25
|
+
} else {
|
26
|
+
root.attributes = { data: { component: this.constructor.name, state: JSON.stringify(this._state), id: this.id, errors: this._errors } };
|
27
|
+
}
|
24
28
|
return root.renderWrapper;
|
25
29
|
}
|
26
30
|
}
|
data/lib/clapton/version.rb
CHANGED