@alegendstale/holly-components 2.0.1 → 2.0.2
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/components/absolute-container/absolute-container.js +1 -1
- package/dist/components/bottom-sheet/bottom-sheet.js +2 -2
- package/dist/components/responsive-svg/responsive-svg.d.ts +2 -2
- package/dist/components/responsive-svg/responsive-svg.d.ts.map +1 -1
- package/dist/components/responsive-svg/responsive-svg.js +14 -10
- package/dist/components/responsive-svg/responsive-svg.stories.d.ts.map +1 -1
- package/dist/components/responsive-svg/responsive-svg.stories.js +5 -3
- package/dist/components/responsive-svg/responsive-svg.styles.js +2 -2
- package/package.json +2 -2
|
@@ -86,7 +86,7 @@ let BottomSheet = class BottomSheet extends LitElement {
|
|
|
86
86
|
>
|
|
87
87
|
<button
|
|
88
88
|
id="handle"
|
|
89
|
-
part="
|
|
89
|
+
part="__handle"
|
|
90
90
|
@pointerdown=${this.pointerDown}
|
|
91
91
|
@pointermove=${this.pointerMove}
|
|
92
92
|
@pointerup=${this.pointerUp}
|
|
@@ -100,7 +100,7 @@ let BottomSheet = class BottomSheet extends LitElement {
|
|
|
100
100
|
|
|
101
101
|
<div
|
|
102
102
|
id='content'
|
|
103
|
-
part="
|
|
103
|
+
part="__content"
|
|
104
104
|
tabindex='0'
|
|
105
105
|
@touchstart=${this.touchDown}
|
|
106
106
|
@touchend=${this.touchUp}
|
|
@@ -17,8 +17,8 @@ export type CombinedAlignSpacing = `${PreserveAspectRatioAlign} ${PreserveAspect
|
|
|
17
17
|
*
|
|
18
18
|
* @cssprop {<length> (em)} --svg-width - Controls the width of the SVG. (Expects em value)
|
|
19
19
|
* @cssprop {<length> (em)} --svg-height - Controls the height of the SVG. (Expects em value)
|
|
20
|
-
* @cssprop {<length> (em)} --svg-
|
|
21
|
-
* @cssprop {<length> (em)} --svg-
|
|
20
|
+
* @cssprop {<length> (em)} --svg-width-fallback - Set by the component as a fallback in case --svg-width is not defined.
|
|
21
|
+
* @cssprop {<length> (em)} --svg-height-fallback - Set by the component as a fallback in case --svg-height is not defined.
|
|
22
22
|
* @cssprop {number} --scale - Controls the scale of the SVG when sized relative to font-size.
|
|
23
23
|
*
|
|
24
24
|
* @csspart __svg - Styles the SVG element.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsive-svg.d.ts","sourceRoot":"","sources":["../../../src/components/responsive-svg/responsive-svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,cAAc,
|
|
1
|
+
{"version":3,"file":"responsive-svg.d.ts","sourceRoot":"","sources":["../../../src/components/responsive-svg/responsive-svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,cAAc,EAAkB,MAAM,KAAK,CAAC;AAQvE,KAAK,OAAO,GAAG;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,+BAA+B,+HAKlC,CAAC;AAEX,eAAO,MAAM,iCAAiC,4BAA6B,CAAC;AAE5E,eAAO,MAAM,0BAA0B,+eAG7B,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,OAAO,+BAA+B,CAAC,MAAM,CAAC,CAAC;AACtF,MAAM,MAAM,0BAA0B,GAAG,OAAO,iCAAiC,CAAC,MAAM,CAAC,CAAC;AAC1F,MAAM,MAAM,mBAAmB,GAAG,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAC5E,MAAM,MAAM,oBAAoB,GAAG,GAAG,wBAAwB,IAAI,0BAA0B,EAAE,CAAC;AAQ/F;;;;;;;;;;;GAWG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC5C,MAAM,CAAC,MAAM,4BAAY;IAEzB,kDAAkD;IAElD,OAAO,EAAE,OAAO,CAAS;IAEzB,yCAAyC;IAEzC,SAAS,EAAE,OAAO,CAAS;IAE3B,gBAAgB;IAChB,OAAO,CAAC,IAAI,CAAC,CAAiC;IAC9C;;;;OAIG;IACH,IACI,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,EASnD;IACD,IAAI,GAAG,IAVM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,CAYnD;IAED,gBAAgB;IAChB,OAAO,CAAC,oBAAoB,CAAkC;IAC9D;;;;OAIG;IACH,IACI,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,EAE3D;IACD,IAAI,mBAAmB,IAHM,mBAAmB,GAAG,SAAS,CAW3D;IAED,+CAA+C;IAC/C,SAAS,CAAC,OAAO,EAAE,OAAO,CAAuC;IAGjE,SAAS,CAAC,UAAU;IAIpB,iBAAiB,IAAI,IAAI;IAkBzB,MAAM;IAwCN,6DAA6D;IAC7D,OAAO,CAAC,gBAAgB;IAaxB;;;;OAIG;IACI,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,GAAG,IAAI;CAMtD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD"}
|
|
@@ -31,8 +31,8 @@ function isPreserveAspectRatio(value) {
|
|
|
31
31
|
*
|
|
32
32
|
* @cssprop {<length> (em)} --svg-width - Controls the width of the SVG. (Expects em value)
|
|
33
33
|
* @cssprop {<length> (em)} --svg-height - Controls the height of the SVG. (Expects em value)
|
|
34
|
-
* @cssprop {<length> (em)} --svg-
|
|
35
|
-
* @cssprop {<length> (em)} --svg-
|
|
34
|
+
* @cssprop {<length> (em)} --svg-width-fallback - Set by the component as a fallback in case --svg-width is not defined.
|
|
35
|
+
* @cssprop {<length> (em)} --svg-height-fallback - Set by the component as a fallback in case --svg-height is not defined.
|
|
36
36
|
* @cssprop {number} --scale - Controls the scale of the SVG when sized relative to font-size.
|
|
37
37
|
*
|
|
38
38
|
* @csspart __svg - Styles the SVG element.
|
|
@@ -92,19 +92,20 @@ let ResponsiveSvg = class ResponsiveSvg extends LitElement {
|
|
|
92
92
|
super.connectedCallback();
|
|
93
93
|
if (this.svg instanceof SVGElement) {
|
|
94
94
|
const _viewBox = this.getViewBoxSize(this.svg);
|
|
95
|
-
const _width =
|
|
96
|
-
const _height =
|
|
97
|
-
this.viewBox = _viewBox ?? { x: 0, y: 0, width: _width || 0, height: _height || 0 };
|
|
95
|
+
const _width = this.svg.getAttribute('width');
|
|
96
|
+
const _height = this.svg.getAttribute('height');
|
|
97
|
+
this.viewBox = _viewBox ?? { x: 0, y: 0, width: Number(_width) || 0, height: Number(_height) || 0 };
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const _width = this.style.getPropertyValue('--svg-width');
|
|
101
|
+
const _height = this.style.getPropertyValue('--svg-height');
|
|
102
|
+
this.viewBox = { x: 0, y: 0, width: parseFloat(_width) || 0, height: parseFloat(_height) || 0 };
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
render() {
|
|
101
106
|
const viewBox = this.viewBox;
|
|
102
107
|
const preserveAspectRatio = this.preserveAspectRatio;
|
|
103
108
|
const svgClasses = this.svgClasses();
|
|
104
|
-
const styles = {
|
|
105
|
-
'--svg-auto-width': `${viewBox.width}em`,
|
|
106
|
-
'--svg-auto-height': `${viewBox.height}em`,
|
|
107
|
-
};
|
|
108
109
|
// Check if svg exists, otherwise early return
|
|
109
110
|
if (typeof this.svg === 'string')
|
|
110
111
|
return html `<p style="font-size: initial;">⚠️ SVG Error</p>`;
|
|
@@ -125,7 +126,10 @@ let ResponsiveSvg = class ResponsiveSvg extends LitElement {
|
|
|
125
126
|
<svg
|
|
126
127
|
part="__svg"
|
|
127
128
|
class=${classMap(svgClasses)}
|
|
128
|
-
style=${styleMap(
|
|
129
|
+
style=${styleMap({
|
|
130
|
+
'--svg-width-fallback': `${viewBox.width}em`,
|
|
131
|
+
'--svg-height-fallback': `${viewBox.height}em`,
|
|
132
|
+
})}
|
|
129
133
|
viewBox="${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}"
|
|
130
134
|
preserveAspectRatio=${preserveAspectRatio}
|
|
131
135
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsive-svg.stories.d.ts","sourceRoot":"","sources":["../../../src/components/responsive-svg/responsive-svg.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAMhD,OAAO,EAAE,mBAAmB,EAA8B,MAAM,qBAAqB,CAAC;AAkEtF,QAAA,MAAM,IAAI,EAAE,IAKX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,MAAM,MAAM,KAAK,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAC7C,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAA;CACjB,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AA0B7B,eAAO,MAAM,GAAG,EAAE,KAWjB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"responsive-svg.stories.d.ts","sourceRoot":"","sources":["../../../src/components/responsive-svg/responsive-svg.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAMhD,OAAO,EAAE,mBAAmB,EAA8B,MAAM,qBAAqB,CAAC;AAkEtF,QAAA,MAAM,IAAI,EAAE,IAKX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,MAAM,MAAM,KAAK,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAC7C,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAA;CACjB,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AA0B7B,eAAO,MAAM,GAAG,EAAE,KAWjB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAY7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAU5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAoBzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAU/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KASnC,CAAC"}
|
|
@@ -63,8 +63,8 @@ const argTypes = {
|
|
|
63
63
|
defaultValue: { summary: '1' },
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
|
-
'--svg-
|
|
67
|
-
'--svg-
|
|
66
|
+
'--svg-height-fallback': { control: false },
|
|
67
|
+
'--svg-width-fallback': { control: false },
|
|
68
68
|
__svg: { control: false },
|
|
69
69
|
__path: { control: false },
|
|
70
70
|
};
|
|
@@ -117,7 +117,9 @@ export const TemplateResult2 = {
|
|
|
117
117
|
fill: 'black',
|
|
118
118
|
autofit: false,
|
|
119
119
|
svgColors: false,
|
|
120
|
-
svg: svg `<path
|
|
120
|
+
svg: svg `<path d="M 30 50 h 60 a 1 1 0 0 1 0 20 h -60 a 1 1 0 0 1 0 -40 h 30 v 70"/>`,
|
|
121
|
+
"--svg-height": '120em',
|
|
122
|
+
"--svg-width": '120em'
|
|
121
123
|
}
|
|
122
124
|
};
|
|
123
125
|
export const ServicesBottom = {
|
|
@@ -25,8 +25,8 @@ export default css `
|
|
|
25
25
|
/* Remove extra vertical space in inline element reserved for character descenders */
|
|
26
26
|
vertical-align: top;
|
|
27
27
|
|
|
28
|
-
width: calc(var(--svg-width, var(--svg-
|
|
29
|
-
height: calc(var(--svg-height, var(--svg-
|
|
28
|
+
width: calc(var(--svg-width, var(--svg-width-fallback)) / 100 * var(--scale));
|
|
29
|
+
height: calc(var(--svg-height, var(--svg-height-fallback)) / 100 * var(--scale));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
:host(:not([svgColors])) svg {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"name": "@alegendstale/holly-components",
|
|
5
5
|
"description": "Reusable UI components created using lit",
|
|
6
6
|
"type": "module",
|
|
@@ -101,4 +101,4 @@
|
|
|
101
101
|
"@vitest/coverage-v8": "^4.0.15"
|
|
102
102
|
},
|
|
103
103
|
"customElements": "custom-elements.json"
|
|
104
|
-
}
|
|
104
|
+
}
|