Skip to content

Commit 2eecbd9

Browse files
authored
Merge branch 'master' into issue-314-content-set-bug
2 parents d329ca2 + cd9bc72 commit 2eecbd9

File tree

32 files changed

+483
-100
lines changed

32 files changed

+483
-100
lines changed

elements/pfe-accordion/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"className": "PfeAccordion",
55
"elementName": "pfe-accordion"
66
},
7-
"version": "1.0.0-prerelease.8",
7+
"version": "1.0.0-prerelease.9",
88
"publishConfig": {
99
"access": "public"
1010
},
@@ -24,8 +24,8 @@
2424
},
2525
"license": "MIT",
2626
"dependencies": {
27-
"@patternfly/pfe-sass": "^1.0.0-prerelease.8",
28-
"@patternfly/pfelement": "^1.0.0-prerelease.8"
27+
"@patternfly/pfe-sass": "^1.0.0-prerelease.9",
28+
"@patternfly/pfelement": "^1.0.0-prerelease.9"
2929
},
3030
"generator-pfelement-version": "0.5.5",
3131
"gitHead": "dfa74e0495c556ebdd1edb61c6d406621d1b6421"

elements/pfe-autocomplete/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"className": "PfeAutocomplete",
55
"elementName": "pfe-autocomplete"
66
},
7-
"version": "1.0.0-prerelease.8",
7+
"version": "1.0.0-prerelease.9",
88
"description": "Autocomplete element for PFElements",
99
"repository": {
1010
"type": "git",
@@ -24,8 +24,8 @@
2424
},
2525
"license": "MIT",
2626
"dependencies": {
27-
"@patternfly/pfe-sass": "^1.0.0-prerelease.8",
28-
"@patternfly/pfelement": "^1.0.0-prerelease.8"
27+
"@patternfly/pfe-sass": "^1.0.0-prerelease.9",
28+
"@patternfly/pfelement": "^1.0.0-prerelease.9"
2929
},
3030
"generator-pfelement-version": "0.5.5"
3131
}

elements/pfe-avatar/djb-hash.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2018 Red Hat, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
/**
25+
* djb2 string hashing function.
26+
*
27+
* @see http://www.cse.yorku.ca/~oz/hash.html
28+
* @param {String} str the string to hash.
29+
* @return {Number} a positive integer
30+
*/
31+
32+
function hash(str) {
33+
let hash = 5381;
34+
let i = str.length;
35+
36+
while (i) {
37+
hash = (hash * 33) ^ str.charCodeAt(--i);
38+
}
39+
40+
return hash >>> 0;
41+
}
42+
43+
export { hash };

elements/pfe-avatar/hslrgb.js

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
* Copyright 2018 Red Hat, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
function h2rgb(v1, v2, vH) {
25+
if (vH < 0) vH += 1;
26+
if (vH > 1) vH -= 1;
27+
if (6 * vH < 1) return v1 + (v2 - v1) * 6 * vH;
28+
if (2 * vH < 1) return v2;
29+
if (3 * vH < 2) return v1 + (v2 - v1) * (2 / 3 - vH) * 6;
30+
return v1;
31+
}
32+
33+
/**
34+
* Convert an HSL color to RGB.
35+
*
36+
* @param {Number} H the hue component
37+
* @param {Number} S the saturation component
38+
* @param {Number} L the luminance component
39+
* @return {Array} [R, G, B]
40+
*
41+
* @see https://www.easyrgb.com/en/math.php
42+
*/
43+
export function hsl2rgb(_H, _S, _L) {
44+
let R, G, B;
45+
46+
const H = Math.max(0, Math.min(1, _H));
47+
const S = Math.max(0, Math.min(1, _S));
48+
const L = Math.max(0, Math.min(1, _L));
49+
50+
if (S == 0) {
51+
R = L * 255;
52+
G = L * 255;
53+
B = L * 255;
54+
} else {
55+
let a, b;
56+
57+
if (L < 0.5) {
58+
b = L * (1 + S);
59+
} else {
60+
b = L + S - S * L;
61+
}
62+
63+
a = 2 * L - b;
64+
65+
R = 255 * h2rgb(a, b, H + 1 / 3);
66+
G = 255 * h2rgb(a, b, H);
67+
B = 255 * h2rgb(a, b, H - 1 / 3);
68+
}
69+
70+
return [R, G, B];
71+
}
72+
73+
/**
74+
* Convert an RGBcolor to HSL .
75+
*
76+
* @param {Number} R the red component
77+
* @param {Number} G the green component
78+
* @param {Number} B the blue component
79+
* @return {Array} [H, S, L]
80+
*
81+
* @see https://www.easyrgb.com/en/math.php
82+
*/
83+
export function rgb2hsl(_R, _G, _B) {
84+
let H, S, L;
85+
86+
const R = Math.max(0, Math.min(255, _R));
87+
const G = Math.max(0, Math.min(255, _G));
88+
const B = Math.max(0, Math.min(255, _B));
89+
90+
const r = R / 255;
91+
const g = G / 255;
92+
const b = B / 255;
93+
94+
const var_min = Math.min(Math.min(r, g), b);
95+
const var_max = Math.max(Math.max(r, g), b);
96+
const del_max = var_max - var_min;
97+
98+
L = (var_max + var_min) / 2;
99+
100+
if (del_max === 0) {
101+
H = 0;
102+
S = 0;
103+
} else {
104+
if (L < 0.5) {
105+
S = del_max / (var_max + var_min);
106+
} else {
107+
S = del_max / (2 - var_max - var_min);
108+
}
109+
110+
const del_r = ((var_max - r) / 6 + del_max / 2) / del_max;
111+
const del_g = ((var_max - g) / 6 + del_max / 2) / del_max;
112+
const del_b = ((var_max - b) / 6 + del_max / 2) / del_max;
113+
114+
if (r == var_max) {
115+
H = del_b - del_g;
116+
} else if (g == var_max) {
117+
H = 1 / 3 + del_r - del_b;
118+
} else if (b == var_max) {
119+
H = 2 / 3 + del_g - del_r;
120+
}
121+
122+
if (H < 0) {
123+
H += 1;
124+
} else if (H > 1) {
125+
H -= 1;
126+
}
127+
}
128+
129+
return [H, S, L];
130+
}

elements/pfe-avatar/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"className": "PfeAvatar",
55
"elementName": "pfe-avatar"
66
},
7-
"version": "1.0.0-prerelease.7",
7+
"version": "1.0.0-prerelease.9",
88
"description": "Avatar element for PFElements",
99
"repository": {
1010
"type": "git",
@@ -24,8 +24,8 @@
2424
},
2525
"license": "MIT",
2626
"dependencies": {
27-
"@patternfly/pfe-sass": "1.0.0-prerelease.8",
28-
"@patternfly/pfelement": "1.0.0-prerelease.8"
27+
"@patternfly/pfe-sass": "^1.0.0-prerelease.9",
28+
"@patternfly/pfelement": "^1.0.0-prerelease.9"
2929
},
3030
"generator-pfelement-version": "0.6.8"
3131
}

elements/pfe-avatar/pfe-avatar.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

elements/pfe-avatar/pfe-avatar.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)