|
@@ -0,0 +1,44 @@
|
|
1
|
+<template id="card-fill">
|
|
2
|
+ <style id="style">
|
|
3
|
+ :host {flex: 1;}
|
|
4
|
+ </style>
|
|
5
|
+
|
|
6
|
+</template>
|
|
7
|
+
|
|
8
|
+<script>
|
|
9
|
+ (function(window, document) {
|
|
10
|
+ var elemName = 'card-fill';
|
|
11
|
+ var mainDoc = document;
|
|
12
|
+ var importDoc = document.currentScript.ownerDocument;
|
|
13
|
+
|
|
14
|
+ var proto = Object.create(HTMLElement.prototype);
|
|
15
|
+ Object.defineProperty(proto, "size", {
|
|
16
|
+ get: function() {
|
|
17
|
+ return "";
|
|
18
|
+ },
|
|
19
|
+ set: function (value) {
|
|
20
|
+ this.setAttribute('size', value);
|
|
21
|
+
|
|
22
|
+ var root = this.shadowRoot;
|
|
23
|
+ var style = root.getElementById("style");
|
|
24
|
+ style.innerHTML = ":host{flex:"+value+"}"
|
|
25
|
+ }
|
|
26
|
+ });
|
|
27
|
+ proto.createdCallback = function () {
|
|
28
|
+ var template = importDoc.getElementById(elemName);
|
|
29
|
+ var clone = mainDoc.importNode(template.content, true);
|
|
30
|
+ var root = this.createShadowRoot();
|
|
31
|
+ root.appendChild(clone);
|
|
32
|
+
|
|
33
|
+ this.size = this.getAttribute('size') || "1";
|
|
34
|
+ }
|
|
35
|
+ proto.attributeChangedCallback = function (name, oldValue, newValue) {
|
|
36
|
+ switch (name) {
|
|
37
|
+ case "size": this.size = newValue;
|
|
38
|
+ }
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ mainDoc.registerElement(elemName, { prototype: proto });
|
|
42
|
+
|
|
43
|
+ })(window, document);
|
|
44
|
+</script>
|