@likable-hair/svelte 0.0.1 → 0.0.4

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.
Files changed (41) hide show
  1. package/common/Card.svelte +45 -0
  2. package/common/Card.svelte.d.ts +24 -0
  3. package/common/IntersectionObserver.svelte +58 -0
  4. package/common/IntersectionObserver.svelte.d.ts +39 -0
  5. package/common/materialDesign.css +1 -0
  6. package/common/tailwind.css +3 -0
  7. package/dates/Calendar.svelte +4 -0
  8. package/dates/Calendar.svelte.d.ts +15 -0
  9. package/dates/utils.d.ts +11 -0
  10. package/dates/utils.js +59 -0
  11. package/enums/elevation.enum.d.ts +7 -0
  12. package/enums/elevation.enum.js +8 -0
  13. package/enums/index.d.ts +1 -0
  14. package/enums/index.js +1 -0
  15. package/forms/Textfield.svelte +177 -0
  16. package/forms/Textfield.svelte.d.ts +29 -0
  17. package/loaders/Skeleton.svelte +78 -0
  18. package/loaders/Skeleton.svelte.d.ts +28 -0
  19. package/loaders/sectionType.d.ts +4 -0
  20. package/loaders/sectionType.js +5 -0
  21. package/media/Carousel.svelte +67 -0
  22. package/media/Carousel.svelte.d.ts +21 -0
  23. package/media/Icon.svelte +21 -0
  24. package/media/Icon.svelte.d.ts +18 -0
  25. package/media/Image.svelte +161 -0
  26. package/media/Image.svelte.d.ts +31 -0
  27. package/media/ImageGrid.svelte +51 -0
  28. package/media/ImageGrid.svelte.d.ts +29 -0
  29. package/navigation/HeaderMenu.svelte +43 -0
  30. package/navigation/HeaderMenu.svelte.d.ts +18 -0
  31. package/navigation/Navigator.svelte +76 -0
  32. package/navigation/Navigator.svelte.d.ts +14 -0
  33. package/package.json +29 -4
  34. package/shop/ProductCard.svelte +58 -0
  35. package/shop/ProductCard.svelte.d.ts +25 -0
  36. package/shop/ProductsGrid.svelte +59 -0
  37. package/shop/ProductsGrid.svelte.d.ts +42 -0
  38. package/timeline/ScrollTimeLine.svelte +193 -0
  39. package/timeline/ScrollTimeLine.svelte.d.ts +15 -0
  40. package/HelloWorld.svelte +0 -1
  41. package/HelloWorld.svelte.d.ts +0 -19
@@ -0,0 +1,45 @@
1
+ <script >import { Elevation } from '../enums/elevation.enum';
2
+ export let rounded = true, outlined = false, elevation = Elevation.md;
3
+ $: cssVariables = Object.entries({}).filter(([key]) => key.startsWith('--'))
4
+ .reduce((css, [key, value]) => {
5
+ return `${css}${key}: ${value};`;
6
+ }, '');
7
+ import '$lib/common/tailwind.css';
8
+ </script>
9
+
10
+ <style>
11
+ .card-container {
12
+ height: var(--height, fit-content);
13
+ width: var(--width, fit-content);
14
+ max-height: var(--max-height);
15
+ max-width: var(--max-width);
16
+ min-height: var(--min-height);
17
+ min-width: var(--min-width);
18
+ padding: var(--padding, 5px);
19
+ background-color: var(--background-color, rgb(252, 252, 252));
20
+ color: var(--color);
21
+ border-color: var(--border-color);
22
+ }
23
+ </style>
24
+
25
+ <div
26
+ class="card-container flex flex-col rounded-md shadow-lg"
27
+ style={cssVariables}
28
+ class:shadow-sm={!outlined && elevation == Elevation.sm}
29
+ class:shadow-md={!outlined && elevation == Elevation.md}
30
+ class:shadow-lg={!outlined && elevation == Elevation.lg}
31
+ class:shadow-xl={!outlined && elevation == Elevation.xl}
32
+ class:shadow-2xl={!outlined && elevation == Elevation.xxl}
33
+ class:border-solid={outlined}
34
+ class:rounded-md={rounded}
35
+ >
36
+ <div class="header flex-none">
37
+ <slot name="header"></slot>
38
+ </div>
39
+ <div class="body shrink overflow-y-auto">
40
+ <slot></slot>
41
+ </div>
42
+ <div class="footer flex-none">
43
+ <slot name="footer"></slot>
44
+ </div>
45
+ </div>
@@ -0,0 +1,24 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import { Elevation } from '../enums/elevation.enum';
3
+ import '$lib/common/tailwind.css';
4
+ declare const __propDef: {
5
+ props: {
6
+ rounded?: boolean;
7
+ outlined?: boolean;
8
+ elevation?: Elevation;
9
+ };
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {
14
+ header: {};
15
+ default: {};
16
+ footer: {};
17
+ };
18
+ };
19
+ export declare type CardProps = typeof __propDef.props;
20
+ export declare type CardEvents = typeof __propDef.events;
21
+ export declare type CardSlots = typeof __propDef.slots;
22
+ export default class Card extends SvelteComponentTyped<CardProps, CardEvents, CardSlots> {
23
+ }
24
+ export {};
@@ -0,0 +1,58 @@
1
+ <script>
2
+ import { onMount } from 'svelte';
3
+
4
+ export let once = false;
5
+ export let top = 0;
6
+ export let bottom = 0;
7
+ export let left = 0;
8
+ export let right = 0;
9
+
10
+ let intersecting = false;
11
+ let container;
12
+
13
+ onMount(() => {
14
+ if (typeof IntersectionObserver !== 'undefined') {
15
+ const rootMargin = `${bottom}px ${left}px ${top}px ${right}px`;
16
+
17
+ const observer = new IntersectionObserver(entries => {
18
+ intersecting = entries[0].isIntersecting;
19
+ if (intersecting && once) {
20
+ observer.unobserve(container);
21
+ }
22
+ }, {
23
+ rootMargin
24
+ });
25
+
26
+ observer.observe(container);
27
+ return () => observer.unobserve(container);
28
+ }
29
+
30
+ function handler() {
31
+ const bcr = container.getBoundingClientRect();
32
+ intersecting = (
33
+ (bcr.bottom + bottom) > 0 &&
34
+ (bcr.right + right) > 0 &&
35
+ (bcr.top - top) < window.innerHeight &&
36
+ (bcr.left - left) < window.innerWidth
37
+ );
38
+
39
+ if (intersecting && once) {
40
+ window.removeEventListener('scroll', handler);
41
+ }
42
+ }
43
+
44
+ window.addEventListener('scroll', handler);
45
+ return () => window.removeEventListener('scroll', handler);
46
+ });
47
+ </script>
48
+
49
+ <style>
50
+ div {
51
+ width: 100%;
52
+ height: 100%;
53
+ }
54
+ </style>
55
+
56
+ <div bind:this={container}>
57
+ <slot {intersecting}></slot>
58
+ </div>
@@ -0,0 +1,39 @@
1
+ /** @typedef {typeof __propDef.props} IntersectionObserverProps */
2
+ /** @typedef {typeof __propDef.events} IntersectionObserverEvents */
3
+ /** @typedef {typeof __propDef.slots} IntersectionObserverSlots */
4
+ export default class IntersectionObserver extends SvelteComponentTyped<{
5
+ once?: boolean;
6
+ top?: number;
7
+ bottom?: number;
8
+ left?: number;
9
+ right?: number;
10
+ }, {
11
+ [evt: string]: CustomEvent<any>;
12
+ }, {
13
+ default: {
14
+ intersecting: boolean;
15
+ };
16
+ }> {
17
+ }
18
+ export type IntersectionObserverProps = typeof __propDef.props;
19
+ export type IntersectionObserverEvents = typeof __propDef.events;
20
+ export type IntersectionObserverSlots = typeof __propDef.slots;
21
+ import { SvelteComponentTyped } from "svelte";
22
+ declare const __propDef: {
23
+ props: {
24
+ once?: boolean;
25
+ top?: number;
26
+ bottom?: number;
27
+ left?: number;
28
+ right?: number;
29
+ };
30
+ events: {
31
+ [evt: string]: CustomEvent<any>;
32
+ };
33
+ slots: {
34
+ default: {
35
+ intersecting: boolean;
36
+ };
37
+ };
38
+ };
39
+ export {};
@@ -0,0 +1 @@
1
+ @import url("https://cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.min.css");
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,4 @@
1
+ <script >import './utils';
2
+ import '$lib/common/tailwind.css';
3
+ </script>
4
+
@@ -0,0 +1,15 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import '$lib/common/tailwind.css';
3
+ declare const __propDef: {
4
+ props: {};
5
+ events: {
6
+ [evt: string]: CustomEvent<any>;
7
+ };
8
+ slots: {};
9
+ };
10
+ export declare type CalendarProps = typeof __propDef.props;
11
+ export declare type CalendarEvents = typeof __propDef.events;
12
+ export declare type CalendarSlots = typeof __propDef.slots;
13
+ export default class Calendar extends SvelteComponentTyped<CalendarProps, CalendarEvents, CalendarSlots> {
14
+ }
15
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare const monthNames: string[];
2
+ export declare const monthDays: number[];
3
+ export declare const isLeapYear: (year: number) => boolean;
4
+ export declare const getEmptyRows: () => any[];
5
+ export declare const getMonthDays: (index: number, year: number) => number;
6
+ export declare const getMonthName: (index: number) => string;
7
+ export declare type MonthStats = {
8
+ name: string;
9
+ days: number;
10
+ };
11
+ export declare const getDateRows: (monthIndex: number, year: number) => number[];
package/dates/utils.js ADDED
@@ -0,0 +1,59 @@
1
+ export const monthNames = [
2
+ "January",
3
+ "February",
4
+ "March",
5
+ "April",
6
+ "May",
7
+ "June",
8
+ "July",
9
+ "August",
10
+ "September",
11
+ "October",
12
+ "November",
13
+ "December"
14
+ ];
15
+ export const monthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
16
+ export const isLeapYear = year => year % 4 === 0;
17
+ export const getEmptyRows = () => {
18
+ return Array.from({ length: 42 }).map(() => []);
19
+ };
20
+ export const getMonthDays = (index, year) => {
21
+ return index !== 1 ? monthDays[index] : isLeapYear(year) ? 29 : 28;
22
+ };
23
+ export const getMonthName = index => monthNames[index];
24
+ const getMonthStats = (monthIndex, year) => {
25
+ const today = new Date(year, monthIndex, 1);
26
+ const index = today.getMonth();
27
+ return {
28
+ name: index[index],
29
+ days: getMonthDays(index, year)
30
+ };
31
+ };
32
+ export const getDateRows = (monthIndex, year) => {
33
+ const { days } = getMonthStats(monthIndex, year);
34
+ const { days: daysOfPreviousMonth } = getMonthStats(monthIndex - 1, year);
35
+ const rows = getEmptyRows();
36
+ let startIndex = new Date(year, monthIndex, 1).getDay();
37
+ if (startIndex === 0)
38
+ startIndex = 6;
39
+ else
40
+ startIndex -= 1;
41
+ let lastIndex = new Date(year, monthIndex + 1, 0).getDay();
42
+ if (lastIndex === 0)
43
+ lastIndex = 6;
44
+ else
45
+ lastIndex -= 1;
46
+ Array.from({ length: days }).forEach((_, i) => {
47
+ const index = startIndex + i;
48
+ rows[index] = i + 1;
49
+ });
50
+ Array.from({ length: startIndex }).forEach((_, i) => {
51
+ rows[i] = (daysOfPreviousMonth - startIndex) + i + 1;
52
+ });
53
+ if (lastIndex !== 6) {
54
+ Array.from({ length: (6 - lastIndex) }).forEach((_, i) => {
55
+ rows[startIndex + days + i] = i + 1;
56
+ });
57
+ }
58
+ return rows.filter(el => !Array.isArray(el));
59
+ };
@@ -0,0 +1,7 @@
1
+ export declare enum Elevation {
2
+ sm = "sm",
3
+ md = "md",
4
+ lg = "lg",
5
+ xl = "xl",
6
+ xxl = "xxl"
7
+ }
@@ -0,0 +1,8 @@
1
+ export var Elevation;
2
+ (function (Elevation) {
3
+ Elevation["sm"] = "sm";
4
+ Elevation["md"] = "md";
5
+ Elevation["lg"] = "lg";
6
+ Elevation["xl"] = "xl";
7
+ Elevation["xxl"] = "xxl";
8
+ })(Elevation || (Elevation = {}));
@@ -0,0 +1 @@
1
+ export { Elevation } from './elevation.enum';
package/enums/index.js ADDED
@@ -0,0 +1 @@
1
+ export { Elevation } from './elevation.enum';
@@ -0,0 +1,177 @@
1
+ <script >export let label = "", placeholder = "", color = "", value = "", variant = 'outlined';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { onMount } from 'svelte';
4
+ let inputId = uuidv4(), focused = false, legendWidth = 0, labelElement = undefined;
5
+ onMount(() => {
6
+ if (!!labelElement) {
7
+ legendWidth = (labelElement.offsetWidth * 0.8) + 8;
8
+ }
9
+ });
10
+ function handleFocus() {
11
+ focused = true;
12
+ }
13
+ function handleBlur() {
14
+ focused = false;
15
+ }
16
+ $: if (!!labelElement) {
17
+ legendWidth = !value && !focused ? 0 : (labelElement.offsetWidth * 0.8) + 8;
18
+ }
19
+ $: cssVariables = Object.entries({
20
+ '--theme-color': color,
21
+ '--legend-width': legendWidth + 'px'
22
+ }).filter(([key]) => key.startsWith('--'))
23
+ .reduce((css, [key, value]) => {
24
+ return `${css}${key}: ${value};`;
25
+ }, '');
26
+ import '$lib/common/tailwind.css';
27
+ </script>
28
+
29
+ <style>
30
+ .input-container {
31
+ margin-top: 15px;
32
+ height: 50px;
33
+ position: relative;
34
+ width: var(--width, 100%);
35
+ --final-color: var(--theme-color, --border-color, rgb(88, 88, 88));
36
+ }
37
+
38
+ /* outlined input */
39
+
40
+ .input-outlined {
41
+ border: 0px solid;
42
+ box-sizing: border-box;
43
+ color: var(--color, black);
44
+ font-size: 18px;
45
+ height: 100%;
46
+ outline: 0;
47
+ padding: 4px 0px 0;
48
+ width: 100%;
49
+ transition: all 0.3s;
50
+ }
51
+
52
+ .fieldset-outlined {
53
+ border-radius: var(--border-radius, 5px);
54
+ border: 1px solid rgb(122, 122, 122);
55
+ padding-left: 4px;
56
+ }
57
+
58
+ .focused .fieldset-outlined {
59
+ border: 1px solid var(--final-color);
60
+ color: var(--final-color);
61
+ }
62
+
63
+ .legend-outlined {
64
+ width: var(--legend-width);
65
+ padding: 0px;
66
+ transition: width 0.3s, color 0.1s;
67
+ }
68
+
69
+ .label-outlined {
70
+ position: relative;
71
+ top: 13px;
72
+ left: 4px;
73
+ display: inline-block;
74
+ transition: all 0.3s;
75
+ transform-origin: top left;
76
+ transform: scale(1);
77
+ z-index: 2;
78
+ }
79
+
80
+ .texted .label-outlined {
81
+ top: -13px;
82
+ left: 4px;
83
+ transform: scale(.8);
84
+ }
85
+
86
+ /* boxed input */
87
+
88
+ .fieldset-boxed {
89
+ border: 2px solid var(--final-color);
90
+ padding: 5px;
91
+ }
92
+
93
+ .input-boxed {
94
+ border: 0px solid;
95
+ box-sizing: border-box;
96
+ font-size: 18px;
97
+ height: 100%;
98
+ outline: 0;
99
+ padding: 4px 0px 0;
100
+ width: 100%;
101
+ transition: all 0.3s;
102
+ position: relative;
103
+ }
104
+
105
+ .input-boxed::placeholder {
106
+ color: var(--final-color);
107
+ opacity: 60%;
108
+ }
109
+
110
+ </style>
111
+
112
+
113
+ <div
114
+ class="input-container"
115
+ style={cssVariables}
116
+ class:focused={focused}
117
+ class:texted={focused || !!value}
118
+ >
119
+ <fieldset
120
+ aria-hidden="true"
121
+ class="fieldset"
122
+ class:fieldset-outlined={variant == 'outlined'}
123
+ class:fieldset-boxed={variant == 'boxed'}
124
+ >
125
+ {#if variant == 'outlined'}
126
+ <legend class="legend-outlined"></legend>
127
+ <label
128
+ for={inputId}
129
+ class="label-outlined"
130
+ bind:this={labelElement}
131
+ >{label}</label>
132
+ <div class="flex content-center relative bottom-3 ml-2 mr-2">
133
+ <div>
134
+ <slot name="prepend-inner"></slot>
135
+ </div>
136
+ <input
137
+ id={inputId}
138
+ class="input-outlined"
139
+ type="text"
140
+ placeholder={placeholder}
141
+ bind:value={value}
142
+ on:change
143
+ on:input
144
+ on:focus={handleFocus}
145
+ on:focus
146
+ on:blur={handleBlur}
147
+ on:blur
148
+ />
149
+ <div>
150
+ <slot name="append-inner"></slot>
151
+ </div>
152
+ </div>
153
+ {:else if variant == 'boxed'}
154
+ <div class="flex">
155
+ <div>
156
+ <slot name="prepend-inner"></slot>
157
+ </div>
158
+ <input
159
+ id={inputId}
160
+ class="input-boxed"
161
+ type="text"
162
+ placeholder={placeholder || label}
163
+ bind:value={value}
164
+ on:change
165
+ on:input
166
+ on:focus={handleFocus}
167
+ on:focus
168
+ on:blur={handleBlur}
169
+ on:blur
170
+ />
171
+ <div>
172
+ <slot name="append-inner"></slot>
173
+ </div>
174
+ </div>
175
+ {/if}
176
+ </fieldset>
177
+ </div>
@@ -0,0 +1,29 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import '$lib/common/tailwind.css';
3
+ declare const __propDef: {
4
+ props: {
5
+ label?: string;
6
+ placeholder?: string;
7
+ color?: string;
8
+ value?: string;
9
+ variant?: "outlined" | "boxed";
10
+ };
11
+ events: {
12
+ change: Event;
13
+ input: Event;
14
+ focus: FocusEvent;
15
+ blur: FocusEvent;
16
+ } & {
17
+ [evt: string]: CustomEvent<any>;
18
+ };
19
+ slots: {
20
+ 'prepend-inner': {};
21
+ 'append-inner': {};
22
+ };
23
+ };
24
+ export declare type TextfieldProps = typeof __propDef.props;
25
+ export declare type TextfieldEvents = typeof __propDef.events;
26
+ export declare type TextfieldSlots = typeof __propDef.slots;
27
+ export default class Textfield extends SvelteComponentTyped<TextfieldProps, TextfieldEvents, TextfieldSlots> {
28
+ }
29
+ export {};
@@ -0,0 +1,78 @@
1
+ <script >export let sections = [], maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, padding = '10px', width = undefined, height = undefined, dark = false;
2
+ $: cssVariables = Object.entries({
3
+ '--max-width': maxWidth,
4
+ '--max-height': maxHeight,
5
+ '--min-width': minWidth,
6
+ '--min-height': minHeight,
7
+ '--width': width,
8
+ '--height': height,
9
+ '--padding': padding,
10
+ '--card-background': dark ? '#000000' : '#fff',
11
+ '--element-background': dark ? '#1a1a1a' : '#eee',
12
+ '--animation-color': dark ? '#000000e6' : '#ffffffe6',
13
+ }).filter(([key]) => key.startsWith('--'))
14
+ .reduce((css, [key, value]) => {
15
+ return `${css}${key}: ${value};`;
16
+ }, '');
17
+ </script>
18
+
19
+ <div class="card" style={cssVariables}>
20
+ {#each sections as section}
21
+ {#if section.type == 'image'}
22
+ <div
23
+ class="skeleton-image"
24
+ style="height: {section.height}"
25
+ ></div>
26
+ {/if}
27
+ {/each}
28
+ </div>
29
+
30
+ <style>
31
+ .skeleton-image {
32
+ background: var(--element-background);
33
+ margin-bottom: 10px;
34
+ border-radius: 5px;
35
+ overflow: hidden;
36
+ width: 100%;
37
+ }
38
+
39
+ .card {
40
+ background: var(--card-background);
41
+ position: relative;
42
+ padding: var(--padding);
43
+ border-radius: 5px;
44
+ box-shadow: 0 10px 100px rgba(0, 0, 0, 0.1);
45
+ width: calc(var(--width) - (var(--padding) * 2));
46
+ height: calc(var(--height) - (var(--padding) * 2));
47
+ max-width: calc(var(--max-width) - (var(--padding) * 2));
48
+ max-height: calc(var(--max-height) - (var(--padding) * 2));
49
+ min-width: calc(var(--min-width) - (var(--padding) * 2));
50
+ min-height: calc(var(--min-height) - (var(--padding) * 2));
51
+ overflow: hidden;
52
+ }
53
+
54
+ @keyframes loading {
55
+ 0% {
56
+ transform: skewX(-10deg) translateX(-100%);
57
+ }
58
+ 100% {
59
+ transform: skewX(-10deg) translateX(200%);
60
+ }
61
+ }
62
+
63
+ .card::before {
64
+ content: '';
65
+ position: absolute;
66
+ background: linear-gradient(
67
+ 90deg,
68
+ transparent,
69
+ var(--animation-color),
70
+ transparent
71
+ );
72
+ width: 50%;
73
+ height: 100%;
74
+ top: 0;
75
+ left: 0;
76
+ animation: loading 1s infinite;
77
+ }
78
+ </style>
@@ -0,0 +1,28 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { SectionType } from './sectionType';
3
+ declare const __propDef: {
4
+ props: {
5
+ sections?: {
6
+ type: SectionType;
7
+ height?: string;
8
+ }[];
9
+ maxWidth?: string;
10
+ maxHeight?: string;
11
+ minWidth?: string;
12
+ minHeight?: string;
13
+ padding?: string;
14
+ width?: string;
15
+ height?: string;
16
+ dark?: boolean;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export declare type SkeletonProps = typeof __propDef.props;
24
+ export declare type SkeletonEvents = typeof __propDef.events;
25
+ export declare type SkeletonSlots = typeof __propDef.slots;
26
+ export default class Skeleton extends SvelteComponentTyped<SkeletonProps, SkeletonEvents, SkeletonSlots> {
27
+ }
28
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare enum SectionType {
2
+ Text = "text",
3
+ Image = "image"
4
+ }
@@ -0,0 +1,5 @@
1
+ export var SectionType;
2
+ (function (SectionType) {
3
+ SectionType["Text"] = "text";
4
+ SectionType["Image"] = "image";
5
+ })(SectionType || (SectionType = {}));
@@ -0,0 +1,67 @@
1
+ <script >import { onMount } from 'svelte';
2
+ export let images = [];
3
+ let container, width = '0px', height = '0px';
4
+ onMount(() => {
5
+ calculateWidthAndHeight();
6
+ });
7
+ function calculateWidthAndHeight() {
8
+ width = container.offsetWidth + 'px';
9
+ height = container.offsetHeight + 'px';
10
+ }
11
+ $: cssVariables = Object.entries({}).filter(([key]) => key.startsWith('--'))
12
+ .reduce((css, [key, value]) => {
13
+ return `${css}${key}: ${value};`;
14
+ }, '');
15
+ import '$lib/common/tailwind.css';
16
+ import Image from './Image.svelte';
17
+ </script>
18
+
19
+ <svelte:window
20
+ on:resize={calculateWidthAndHeight}
21
+ ></svelte:window>
22
+
23
+
24
+ <div
25
+ style={cssVariables}
26
+ bind:this={container}
27
+ class="container flex flex-nowrap"
28
+ >
29
+ {#each images as image}
30
+ <div class="image-container">
31
+ <Image
32
+ src={image.url}
33
+ title={image.title}
34
+ description={image.description}
35
+ disableHover={true}
36
+ showSkeletonLoader={false}
37
+ minWidth={width}
38
+ width={width}
39
+ height={height}
40
+ imageContain={true}
41
+ imageCover={false}
42
+ />
43
+ </div>
44
+ {/each}
45
+ </div>
46
+
47
+ <style>
48
+ .container {
49
+ height: var(--height);
50
+ width: var(--width);
51
+ max-height: var(--max-height);
52
+ max-width: var(--max-width);
53
+ min-height: var(--min-height);
54
+ min-width: var(--min-width);
55
+ overflow-x: scroll;
56
+ scroll-snap-type: x mandatory;
57
+ -ms-overflow-style: none; /* Internet Explorer 10+ */
58
+ scrollbar-width: none; /* Firefox */
59
+ }
60
+
61
+ .container::-webkit-scrollbar {
62
+ display: none; /* Safari and Chrome */
63
+ }
64
+ .image-container {
65
+ scroll-snap-align: start;
66
+ }
67
+ </style>