@proximus/lavender-image 1.0.0-alpha.13 → 1.0.0-alpha.14
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/dist/index.js +79 -59
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PxElement as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
import { PxElement as n, noBorderRadiusValues as u, borderRadiusValues as l } from "@proximus/lavender-common";
|
|
2
|
+
const p = 'img{display:inline-block;vertical-align:middle;max-width:100%;height:auto;border-style:none}.border-radius-main,.border-radius-main img{border-radius:var(--px-radius-main)}.border-radius-pill,.border-radius-pill img{border-radius:var(--px-radius-pill)}.no-border-radius-top,.no-border-radius-top img{border-top-left-radius:var(--px-radius-none);border-top-right-radius:var(--px-radius-none)}.no-border-radius-right,.no-border-radius-right img{border-top-right-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-bottom,.no-border-radius-bottom img{border-bottom-left-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-left,.no-border-radius-left img{border-top-left-radius:var(--px-radius-none);border-bottom-left-radius:var(--px-radius-none)}.no-border-radius-all,.no-border-radius-all img{border-radius:var(--px-radius-none)}@media only screen and (max-width: 767px){:host([hide-for="mobile"]),:host([show-for="tablet"]),:host([show-for="laptop"]),.hide-for-mobile,.show-for-tablet,.show-for-laptop{display:none}.no-border-radius-top--mobile,.no-border-radius-top--mobile img{border-top-left-radius:var(--px-radius-none);border-top-right-radius:var(--px-radius-none)}.no-border-radius-right--mobile,.no-border-radius-right--mobile img{border-top-right-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-bottom--mobile,.no-border-radius-bottom--mobile img{border-bottom-left-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-left--mobile,.no-border-radius-left--mobile img{border-top-left-radius:var(--px-radius-none);border-bottom-left-radius:var(--px-radius-none)}.no-border-radius-all--mobile,.no-border-radius-all--mobile img{border-radius:var(--px-radius-none)}}@media only screen and (min-width: 768px) and (max-width: 1024px){:host([hide-for="tablet"]),:host([show-for="mobile"]),:host([show-for="laptop"]),.hide-for-tablet,.show-for-mobile,.show-for-laptop{display:none}.no-border-radius-top--tablet,.no-border-radius-top--tablet img{border-top-left-radius:var(--px-radius-none);border-top-right-radius:var(--px-radius-none)}.no-border-radius-right--tablet,.no-border-radius-right--tablet img{border-top-right-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-bottom--tablet,.no-border-radius-bottom--tablet img{border-bottom-left-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-left--tablet,.no-border-radius-left--tablet img{border-top-left-radius:var(--px-radius-none);border-bottom-left-radius:var(--px-radius-none)}.no-border-radius-all--tablet,.no-border-radius-all--tablet img{border-radius:var(--px-radius-none)}}@media only screen and (min-width: 1025px){:host([hide-for="laptop"]),:host([show-for="mobile"]),:host([show-for="tablet"]),.hide-for-laptop,.show-for-mobile,.show-for-tablet{display:none}.no-border-radius-top--laptop,.no-border-radius-top--laptop img{border-top-left-radius:var(--px-radius-none);border-top-right-radius:var(--px-radius-none)}.no-border-radius-right--laptop,.no-border-radius-right--laptop img{border-top-right-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-bottom--laptop,.no-border-radius-bottom--laptop img{border-bottom-left-radius:var(--px-radius-none);border-bottom-right-radius:var(--px-radius-none)}.no-border-radius-left--laptop,.no-border-radius-left--laptop img{border-top-left-radius:var(--px-radius-none);border-bottom-left-radius:var(--px-radius-none)}.no-border-radius-all--laptop,.no-border-radius-all--laptop img{border-radius:var(--px-radius-none)}}', s = new CSSStyleSheet();
|
|
3
|
+
s.replaceSync(p);
|
|
4
|
+
const h = ["", "mobile", "tablet", "laptop"];
|
|
5
|
+
class m extends n {
|
|
6
6
|
constructor() {
|
|
7
|
-
super(
|
|
7
|
+
super(s);
|
|
8
8
|
}
|
|
9
9
|
static get observedAttributes() {
|
|
10
10
|
return [
|
|
@@ -13,11 +13,70 @@ class p extends s {
|
|
|
13
13
|
"show-for",
|
|
14
14
|
"border-radius",
|
|
15
15
|
"no-border-radius",
|
|
16
|
-
"no-border-radius
|
|
17
|
-
"no-border-radius
|
|
18
|
-
"no-border-radius
|
|
16
|
+
"no-border-radius--mobile",
|
|
17
|
+
"no-border-radius--tablet",
|
|
18
|
+
"no-border-radius--laptop"
|
|
19
19
|
];
|
|
20
20
|
}
|
|
21
|
+
attributeChangedCallback(r, t, o) {
|
|
22
|
+
if (t !== o)
|
|
23
|
+
switch (r) {
|
|
24
|
+
case "hide-for":
|
|
25
|
+
case "show-for":
|
|
26
|
+
this.updateAttribute(r, t, o, h);
|
|
27
|
+
break;
|
|
28
|
+
case "border-radius":
|
|
29
|
+
this.updateAttribute(
|
|
30
|
+
r,
|
|
31
|
+
t,
|
|
32
|
+
o,
|
|
33
|
+
l
|
|
34
|
+
);
|
|
35
|
+
break;
|
|
36
|
+
case "no-border-radius":
|
|
37
|
+
case "no-border-radius--mobile":
|
|
38
|
+
case "no-border-radius--tablet":
|
|
39
|
+
case "no-border-radius--laptop":
|
|
40
|
+
this.updateAttribute(
|
|
41
|
+
r,
|
|
42
|
+
t,
|
|
43
|
+
o,
|
|
44
|
+
u
|
|
45
|
+
);
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
super.attributeChangedCallback(r, t, o);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
updateAttribute(r, t, o, b) {
|
|
53
|
+
if (!this.checkName(b, o))
|
|
54
|
+
console.error(
|
|
55
|
+
`${o} is not an allowed ${r} value for ${this.$el}`
|
|
56
|
+
);
|
|
57
|
+
else {
|
|
58
|
+
const e = this.splitAttrNameFromBreakpoint(r), a = e.breakpoint;
|
|
59
|
+
t !== null && t !== "" && this.$el.classList.toggle(
|
|
60
|
+
`${e.attrName}-${t}${a}`
|
|
61
|
+
), o !== null && o !== "" && this.$el.classList.toggle(
|
|
62
|
+
`${e.attrName}-${o}${a}`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
splitAttrNameFromBreakpoint(r) {
|
|
67
|
+
let t = "";
|
|
68
|
+
if (["--mobile", "--tablet", "--laptop"].some(
|
|
69
|
+
(o) => r.includes(o)
|
|
70
|
+
)) {
|
|
71
|
+
const o = r.split("--");
|
|
72
|
+
r = o[0], t = `--${o[1]}`;
|
|
73
|
+
}
|
|
74
|
+
return { attrName: r, breakpoint: t };
|
|
75
|
+
}
|
|
76
|
+
checkName(r, t) {
|
|
77
|
+
return r.includes(t);
|
|
78
|
+
}
|
|
79
|
+
//get & set
|
|
21
80
|
get hidefor() {
|
|
22
81
|
return this.getAttribute("hide-for");
|
|
23
82
|
}
|
|
@@ -43,73 +102,34 @@ class p extends s {
|
|
|
43
102
|
this.setAttribute("no-border-radius", r);
|
|
44
103
|
}
|
|
45
104
|
get noBorderRadiusMobile() {
|
|
46
|
-
return this.getAttribute("no-border-radius
|
|
105
|
+
return this.getAttribute("no-border-radius--mobile");
|
|
47
106
|
}
|
|
48
107
|
set noBorderRadiusMobile(r) {
|
|
49
|
-
this.setAttribute("no-border-radius
|
|
108
|
+
this.setAttribute("no-border-radius--mobile", r);
|
|
50
109
|
}
|
|
51
110
|
get noBorderRadiusTablet() {
|
|
52
|
-
return this.getAttribute("no-border-radius
|
|
111
|
+
return this.getAttribute("no-border-radius--tablet");
|
|
53
112
|
}
|
|
54
113
|
set noBorderRadiusTablet(r) {
|
|
55
|
-
this.setAttribute("no-border-radius
|
|
114
|
+
this.setAttribute("no-border-radius--tablet", r);
|
|
56
115
|
}
|
|
57
116
|
get noBorderRadiusLaptop() {
|
|
58
|
-
return this.getAttribute("no-border-radius
|
|
117
|
+
return this.getAttribute("no-border-radius--laptop");
|
|
59
118
|
}
|
|
60
119
|
set noBorderRadiusLaptop(r) {
|
|
61
|
-
this.setAttribute("no-border-radius
|
|
62
|
-
}
|
|
63
|
-
attributeChangedCallback(r, o, t) {
|
|
64
|
-
if (o !== t)
|
|
65
|
-
switch (r) {
|
|
66
|
-
case "hide-for":
|
|
67
|
-
case "show-for":
|
|
68
|
-
this.updateAttribute(r, o, t, l);
|
|
69
|
-
break;
|
|
70
|
-
case "border-radius":
|
|
71
|
-
this.updateAttribute(
|
|
72
|
-
r,
|
|
73
|
-
o,
|
|
74
|
-
t,
|
|
75
|
-
n
|
|
76
|
-
);
|
|
77
|
-
break;
|
|
78
|
-
case "no-border-radius":
|
|
79
|
-
case "no-border-radius-mobile":
|
|
80
|
-
case "no-border-radius-tablet":
|
|
81
|
-
case "no-border-radius-laptop":
|
|
82
|
-
this.updateAttribute(
|
|
83
|
-
r,
|
|
84
|
-
o,
|
|
85
|
-
t,
|
|
86
|
-
b
|
|
87
|
-
);
|
|
88
|
-
break;
|
|
89
|
-
default:
|
|
90
|
-
super.attributeChangedCallback(r, o, t);
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
updateAttribute(r, o, t, a) {
|
|
95
|
-
this.checkName(a, t) ? (o !== null && o !== "" && this.$el.classList.toggle(`${r}-${o}`), t !== null && t !== "" && this.$el.classList.toggle(`${r}-${t}`)) : console.error(
|
|
96
|
-
`${t} is not an allowed ${r} value for ${this.$el}`
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
checkName(r, o) {
|
|
100
|
-
return r.includes(o);
|
|
120
|
+
this.setAttribute("no-border-radius--laptop", r);
|
|
101
121
|
}
|
|
102
122
|
}
|
|
103
|
-
const
|
|
123
|
+
const d = class d extends m {
|
|
104
124
|
constructor() {
|
|
105
125
|
super();
|
|
106
126
|
const r = document.createElement(this.nativeName);
|
|
107
127
|
this.shadowRoot.appendChild(r);
|
|
108
128
|
}
|
|
109
129
|
};
|
|
110
|
-
|
|
111
|
-
let
|
|
112
|
-
customElements.define("px-img",
|
|
130
|
+
d.nativeName = "img";
|
|
131
|
+
let i = d;
|
|
132
|
+
customElements.define("px-img", i);
|
|
113
133
|
export {
|
|
114
|
-
|
|
134
|
+
i as Image
|
|
115
135
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-image",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.14",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "452f4a8461e1cd53b5e3395e10e8b7724f0627d7",
|
|
28
28
|
"lerna": {
|
|
29
29
|
"command": {
|
|
30
30
|
"publish": {
|