@getflip/swirl-components 0.241.3 → 0.242.0
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/components.json +1 -1
- package/dist/cjs/swirl-image-grid.cjs.entry.js +17 -2
- package/dist/cjs/swirl-toolbar.cjs.entry.js +1 -1
- package/dist/collection/components/swirl-image-grid/swirl-image-grid.css +2 -1
- package/dist/collection/components/swirl-image-grid/swirl-image-grid.js +16 -1
- package/dist/collection/components/swirl-image-grid/swirl-image-grid.stories.js +3 -3
- package/dist/collection/components/swirl-toolbar/swirl-toolbar.js +2 -2
- package/dist/collection/components/swirl-toolbar/swirl-toolbar.spec.js +1 -1
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-image-grid.js +17 -2
- package/dist/components/swirl-toolbar.js +1 -1
- package/dist/esm/swirl-image-grid.entry.js +17 -2
- package/dist/esm/swirl-toolbar.entry.js +1 -1
- package/dist/swirl-components/{p-dfe7bad4.entry.js → p-0a15eb59.entry.js} +1 -1
- package/dist/swirl-components/p-34ee62e3.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-image-grid/swirl-image-grid.d.ts +1 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-42c66087.entry.js +0 -1
package/components.json
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-2ab5d772.js');
|
|
6
6
|
const index$1 = require('./index-9f94303c.js');
|
|
7
7
|
|
|
8
|
-
const swirlImageGridCss = ":host{display:block}:host *{box-sizing:border-box}.image-grid{display:grid;overflow:hidden;width:100%;min-height:0;border-radius:var(--s-border-radius-sm);gap:var(--s-space-2)}.image-grid--item-count-1{grid-template-columns:100%;grid-template-rows:100%}.image-grid--item-count-2{grid-template-columns:repeat(2, calc(50% - var(--s-space-2) / 2))}.image-grid--item-count-3{grid-template-columns:calc(100% / 3 * 2 - var(--space-2) / 2)
|
|
8
|
+
const swirlImageGridCss = ":host{display:block}:host *{box-sizing:border-box}.image-grid{display:grid;overflow:hidden;width:100%;min-height:0;border-radius:var(--s-border-radius-sm);gap:var(--s-space-2)}.image-grid--item-count-1{grid-template-columns:100%;grid-template-rows:100%}.image-grid--item-count-2{grid-template-columns:repeat(2, calc(50% - var(--s-space-2) / 2))}.image-grid--item-count-3{grid-template-columns:calc(100% / 3 * 2) calc(\n 100% / 3 - var(--s-space-2) / 2\n );grid-template-rows:calc(50% - var(--s-space-2) / 2)}.image-grid--item-count-3 ::slotted(*:nth-child(1)){grid-column-start:1;grid-row-start:1;grid-row-end:3}.image-grid--item-count-3 ::slotted(*:nth-child(3)){grid-column-start:2}.image-grid--item-count-4{grid-template-columns:repeat(2, calc(50% - var(--s-space-2) / 2));grid-template-rows:repeat(2, calc(50% - var(--s-space-2) / 2))}";
|
|
9
9
|
const SwirlImageGridStyle0 = swirlImageGridCss;
|
|
10
10
|
|
|
11
11
|
const SwirlImageGrid = class {
|
|
@@ -17,6 +17,20 @@ const SwirlImageGrid = class {
|
|
|
17
17
|
this.items[3].overlay = `+${this.items.length - 4}`;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
+
this.caculateAspectRatio = () => {
|
|
21
|
+
switch (this.items.length) {
|
|
22
|
+
case 1:
|
|
23
|
+
return this.aspectRatio;
|
|
24
|
+
case 2:
|
|
25
|
+
return "2/1";
|
|
26
|
+
case 3:
|
|
27
|
+
return "3/2";
|
|
28
|
+
case 4:
|
|
29
|
+
return "1";
|
|
30
|
+
default:
|
|
31
|
+
return "1";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
20
34
|
this.aspectRatio = "1/1";
|
|
21
35
|
this.label = undefined;
|
|
22
36
|
this.items = [];
|
|
@@ -26,7 +40,8 @@ const SwirlImageGrid = class {
|
|
|
26
40
|
}
|
|
27
41
|
render() {
|
|
28
42
|
const className = index$1.classnames("image-grid", `image-grid--item-count-${Math.min(4, this.items.length)}`);
|
|
29
|
-
|
|
43
|
+
const aspectRatio = this.caculateAspectRatio();
|
|
44
|
+
return (index.h(index.Host, { key: '95a2b995672ed04da173df7e6c4463044e78014d' }, index.h("div", { key: '44fb98feabe360972f20a5ad7f7db30b826ebe47', "aria-label": this.label, class: className, role: "list", style: { aspectRatio: aspectRatio } }, index.h("slot", { key: 'e6a71271c34969eb7addc50f21c2081084f9aab3', onSlotchange: this.updateItems }))));
|
|
30
45
|
}
|
|
31
46
|
get el() { return index.getElement(this); }
|
|
32
47
|
};
|
|
@@ -75,7 +75,7 @@ const SwirlToolbar = class {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
render() {
|
|
78
|
-
return (index.h(index.Host, { key: 'b99b48ca99a102b317587c27deabd8fcd2ef4862' }, index.h("swirl-stack", { key: '
|
|
78
|
+
return (index.h(index.Host, { key: 'b99b48ca99a102b317587c27deabd8fcd2ef4862' }, index.h("swirl-stack", { key: '5f37a4b04ae86acc12e7c923466d1ccafe80dc61', align: "center", "aria-label": this.label, "aria-orientation": this.orientation, role: "toolbar", onKeyDown: this.onKeyDown, orientation: this.orientation, spacing: "8", wrap: true }, index.h("slot", { key: '468bbff3894acf369feda7a56db6b432445e71f6' }))));
|
|
79
79
|
}
|
|
80
80
|
get el() { return index.getElement(this); }
|
|
81
81
|
};
|
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.image-grid--item-count-3 {
|
|
28
|
-
grid-template-columns: calc(100% / 3 * 2
|
|
28
|
+
grid-template-columns: calc(100% / 3 * 2) calc(
|
|
29
29
|
100% / 3 - var(--s-space-2) / 2
|
|
30
30
|
);
|
|
31
|
+
grid-template-rows: calc(50% - var(--s-space-2) / 2);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
.image-grid--item-count-3 ::slotted(*:nth-child(1)) {
|
|
@@ -8,6 +8,20 @@ export class SwirlImageGrid {
|
|
|
8
8
|
this.items[3].overlay = `+${this.items.length - 4}`;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
this.caculateAspectRatio = () => {
|
|
12
|
+
switch (this.items.length) {
|
|
13
|
+
case 1:
|
|
14
|
+
return this.aspectRatio;
|
|
15
|
+
case 2:
|
|
16
|
+
return "2/1";
|
|
17
|
+
case 3:
|
|
18
|
+
return "3/2";
|
|
19
|
+
case 4:
|
|
20
|
+
return "1";
|
|
21
|
+
default:
|
|
22
|
+
return "1";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
11
25
|
this.aspectRatio = "1/1";
|
|
12
26
|
this.label = undefined;
|
|
13
27
|
this.items = [];
|
|
@@ -17,7 +31,8 @@ export class SwirlImageGrid {
|
|
|
17
31
|
}
|
|
18
32
|
render() {
|
|
19
33
|
const className = classnames("image-grid", `image-grid--item-count-${Math.min(4, this.items.length)}`);
|
|
20
|
-
|
|
34
|
+
const aspectRatio = this.caculateAspectRatio();
|
|
35
|
+
return (h(Host, { key: '95a2b995672ed04da173df7e6c4463044e78014d' }, h("div", { key: '44fb98feabe360972f20a5ad7f7db30b826ebe47', "aria-label": this.label, class: className, role: "list", style: { aspectRatio: aspectRatio } }, h("slot", { key: 'e6a71271c34969eb7addc50f21c2081084f9aab3', onSlotchange: this.updateItems }))));
|
|
21
36
|
}
|
|
22
37
|
static get is() { return "swirl-image-grid"; }
|
|
23
38
|
static get encapsulation() { return "shadow"; }
|
|
@@ -19,8 +19,8 @@ export const SwirlImageGrid = Template.bind({});
|
|
|
19
19
|
SwirlImageGrid.args = {
|
|
20
20
|
aspectRatio: "16 / 9",
|
|
21
21
|
slot: `
|
|
22
|
-
<swirl-image-grid-item alt="Cute dog in a blanket" interactive src="/sample.jpg"></swirl-image-grid-item>
|
|
23
|
-
<swirl-image-grid-item alt="Cute dog in a blanket" interactive src="/sample-2.jpg"></swirl-image-grid-item>
|
|
24
|
-
<swirl-image-grid-item alt="Blinking cat" interactive src="/sample.gif" show-gif-controls></swirl-image-grid-item>
|
|
22
|
+
<swirl-image-grid-item alt="Cute dog in a blanket" interactive loading="intersecting" src="/sample.jpg"></swirl-image-grid-item>
|
|
23
|
+
<swirl-image-grid-item alt="Cute dog in a blanket" interactive loading="intersecting" src="/sample-2.jpg"></swirl-image-grid-item>
|
|
24
|
+
<swirl-image-grid-item alt="Blinking cat" interactive loading="intersecting" src="/sample.gif" show-gif-controls></swirl-image-grid-item>
|
|
25
25
|
`,
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { getActiveElement } from "../../utils";
|
|
3
3
|
export class SwirlToolbar {
|
|
4
4
|
constructor() {
|
|
@@ -66,7 +66,7 @@ export class SwirlToolbar {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
|
-
return (h(Host, { key: 'b99b48ca99a102b317587c27deabd8fcd2ef4862' }, h("swirl-stack", { key: '
|
|
69
|
+
return (h(Host, { key: 'b99b48ca99a102b317587c27deabd8fcd2ef4862' }, h("swirl-stack", { key: '5f37a4b04ae86acc12e7c923466d1ccafe80dc61', align: "center", "aria-label": this.label, "aria-orientation": this.orientation, role: "toolbar", onKeyDown: this.onKeyDown, orientation: this.orientation, spacing: "8", wrap: true }, h("slot", { key: '468bbff3894acf369feda7a56db6b432445e71f6' }))));
|
|
70
70
|
}
|
|
71
71
|
static get is() { return "swirl-toolbar"; }
|
|
72
72
|
static get encapsulation() { return "shadow"; }
|
|
@@ -15,7 +15,7 @@ describe("swirl-toolbar", () => {
|
|
|
15
15
|
expect(page.root).toEqualHtml(`
|
|
16
16
|
<swirl-toolbar>
|
|
17
17
|
<mock:shadow-root>
|
|
18
|
-
<swirl-stack align="center" aria-orientation="horizontal" orientation="horizontal" role="toolbar" spacing="8">
|
|
18
|
+
<swirl-stack align="center" aria-orientation="horizontal" orientation="horizontal" role="toolbar" spacing="8" wrap="">
|
|
19
19
|
<slot></slot>
|
|
20
20
|
</swirl-stack>
|
|
21
21
|
</mock:shadow-root>
|