@functionalcms/svelte-components 2.39.0 → 2.40.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/dist/components/menu/Menu.d.ts +1 -0
- package/dist/components/menu/Menu.js +1 -0
- package/dist/components/menu/NavigationItems.svelte +4 -44
- package/dist/components/menu/NavigationItems.svelte.d.ts +5 -1
- package/dist/components/presentation/ImageCompare.svelte +178 -0
- package/dist/components/presentation/ImageCompare.svelte.d.ts +47 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ export declare class HeaderNavigationItem {
|
|
|
9
9
|
path?: string | undefined;
|
|
10
10
|
action?: ClickAction | undefined;
|
|
11
11
|
visiblity: Visiblity;
|
|
12
|
+
subItems?: HeaderNavigationItem[];
|
|
12
13
|
}
|
|
13
14
|
export declare function selectVisible(pages: Array<any>, visiblity: Visiblity): any[];
|
|
14
15
|
export declare function isSelected(includeSubpagesForSelect: boolean, page: any, item: HeaderNavigationItem): any;
|
|
@@ -20,56 +20,16 @@ const linkCss = mergedClasses(cssClasses.link);
|
|
|
20
20
|
role="presentation"
|
|
21
21
|
>
|
|
22
22
|
<span class="screenreader-only">Navigate to {pageItem.name}</span>
|
|
23
|
-
<!-- <Link href={pageItem.path} role="menuItem"> -->
|
|
24
23
|
<a href={pageItem.path} role="menuItem">
|
|
25
24
|
{pageItem.name}
|
|
26
25
|
</a>
|
|
27
|
-
|
|
26
|
+
|
|
27
|
+
{#if pageItem.subItems?.length > 0}
|
|
28
|
+
<slot name="mobile" pages={pageItem.subItems} />
|
|
29
|
+
{/if}
|
|
28
30
|
</li>
|
|
29
31
|
{/each}
|
|
30
32
|
</ul>
|
|
31
33
|
|
|
32
34
|
<style>
|
|
33
|
-
/* ul {
|
|
34
|
-
background: var(--functional-menu-background);
|
|
35
|
-
margin: var(--functional-menu-margin);
|
|
36
|
-
padding: var(--functional-menu-padding);
|
|
37
|
-
}
|
|
38
|
-
li {
|
|
39
|
-
}
|
|
40
|
-
a {
|
|
41
|
-
color: var(--functional-menu-item-color);
|
|
42
|
-
margin: var(--functional-menu-item-margin);
|
|
43
|
-
padding: var(--functional-menu-item-padding);
|
|
44
|
-
background: var(--functional-menu-item-background);
|
|
45
|
-
border-top: var(--functional-menu-item-border-top);
|
|
46
|
-
border-right: var(--functional-menu-item-border-right);
|
|
47
|
-
border-bottom: var(--functional-menu-item-border-bottom);
|
|
48
|
-
border-left: var(--functional-menu-item-border-left);
|
|
49
|
-
border-radius: var(--functional-menu-item-radius, var(--functional-radius));
|
|
50
|
-
text-decoration: none;
|
|
51
|
-
display: block;
|
|
52
|
-
}
|
|
53
|
-
a:hover {
|
|
54
|
-
color: var(--functional-menu-item-hover-color);
|
|
55
|
-
margin: var(--functional-menu-item-hover-margin);
|
|
56
|
-
padding: var(--functional-menu-item-hover-padding);
|
|
57
|
-
background: var(--functional-menu-item-hover-background);
|
|
58
|
-
border-top: var(--functional-menu-item-hover-border-top);
|
|
59
|
-
border-right: var(--functional-menu-item-hover-border-right);
|
|
60
|
-
border-bottom: var(--functional-menu-item-hover-border-bottom);
|
|
61
|
-
border-left: var(--functional-menu-item-hover-border-left);
|
|
62
|
-
border-radius: var(--functional-menu-item-hover-radius, var(--functional-radius));
|
|
63
|
-
}
|
|
64
|
-
li[aria-current='true'] a {
|
|
65
|
-
color: var(--functional-menu-item-selected-color);
|
|
66
|
-
margin: var(--functional-menu-item-selected-margin);
|
|
67
|
-
padding: var(--functional-menu-item-selected-padding);
|
|
68
|
-
background: var(--functional-menu-item-selected-background);
|
|
69
|
-
border-top: var(--functional-menu-item-selected-border-top);
|
|
70
|
-
border-right: var(--functional-menu-item-selected-border-right);
|
|
71
|
-
border-bottom: var(--functional-menu-item-selected-border-bottom);
|
|
72
|
-
border-left: var(--functional-menu-item-selected-border-left);
|
|
73
|
-
border-radius: var(--functional-menu-item-selected-radius, var(--functional-radius));
|
|
74
|
-
} */
|
|
75
35
|
</style>
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
let hideOnSlide = true,
|
|
3
|
+
imgOffset = null,
|
|
4
|
+
sliding = false,
|
|
5
|
+
contain = false,
|
|
6
|
+
overlay = true,
|
|
7
|
+
offset = 0.5,
|
|
8
|
+
before = "",
|
|
9
|
+
after = "",
|
|
10
|
+
lazyLoad = false,
|
|
11
|
+
img;
|
|
12
|
+
|
|
13
|
+
function resize(e) {
|
|
14
|
+
imgOffset = (
|
|
15
|
+
e.type === "load" ? e.target : img
|
|
16
|
+
).getBoundingClientRect();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function move(e) {
|
|
20
|
+
if (sliding && imgOffset) {
|
|
21
|
+
let x = (e.touches ? e.touches[0].pageX : e.pageX) - imgOffset.left;
|
|
22
|
+
x = x < 0 ? 0 : x > w ? w : x;
|
|
23
|
+
offset = x / w;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function start(e) {
|
|
28
|
+
sliding = true;
|
|
29
|
+
move(e);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function end() {
|
|
33
|
+
sliding = false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
$: w = imgOffset && imgOffset.width;
|
|
37
|
+
$: h = imgOffset && imgOffset.height;
|
|
38
|
+
$: x = w * offset;
|
|
39
|
+
$: opacity = hideOnSlide && sliding ? 0 : 1;
|
|
40
|
+
$: style = contain
|
|
41
|
+
? `width:100%;height:100%;`
|
|
42
|
+
: `width:${w}px;height:${h}px;`;
|
|
43
|
+
$: imageLoading = lazyLoad ? "lazy" : "eager";
|
|
44
|
+
|
|
45
|
+
export { before, after, offset, overlay, contain, lazyLoad, hideOnSlide };
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<svelte:window
|
|
49
|
+
on:touchmove={move}
|
|
50
|
+
on:touchend={end}
|
|
51
|
+
on:mousemove={move}
|
|
52
|
+
on:mouseup={end}
|
|
53
|
+
on:resize={resize}
|
|
54
|
+
/>
|
|
55
|
+
|
|
56
|
+
<div class="container" {style} on:touchstart={start} on:mousedown={start} role="img" aria-roledescription="image slider">
|
|
57
|
+
<img
|
|
58
|
+
bind:this={img}
|
|
59
|
+
loading={imageLoading}
|
|
60
|
+
src={after}
|
|
61
|
+
alt="after"
|
|
62
|
+
on:mousedown|preventDefault
|
|
63
|
+
on:load={resize}
|
|
64
|
+
{style}
|
|
65
|
+
/>
|
|
66
|
+
<img
|
|
67
|
+
loading={imageLoading}
|
|
68
|
+
src={before}
|
|
69
|
+
alt="before"
|
|
70
|
+
on:mousedown|preventDefault
|
|
71
|
+
style="{style}clip:rect(0, {x}px, {h}px, 0);"
|
|
72
|
+
/>
|
|
73
|
+
{#if overlay}
|
|
74
|
+
<div class="overlay" style="opacity:{opacity}"></div>
|
|
75
|
+
{/if}
|
|
76
|
+
<div class="before-label" style="opacity:{opacity}">
|
|
77
|
+
<slot name="before"></slot>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="after-label" style="opacity:{opacity}">
|
|
80
|
+
<slot name="after"></slot>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="handle" style="left: calc({offset * 100}% - 20px)">
|
|
83
|
+
<div class="arrow-left"></div>
|
|
84
|
+
<div class="arrow-right"></div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<style>
|
|
89
|
+
.container {
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
position: relative;
|
|
92
|
+
box-sizing: content-box;
|
|
93
|
+
}
|
|
94
|
+
.container img {
|
|
95
|
+
top: 0;
|
|
96
|
+
left: 0;
|
|
97
|
+
z-index: 20;
|
|
98
|
+
display: block;
|
|
99
|
+
max-width: 100%;
|
|
100
|
+
user-select: none;
|
|
101
|
+
object-fit: cover;
|
|
102
|
+
position: absolute;
|
|
103
|
+
}
|
|
104
|
+
.overlay {
|
|
105
|
+
top: 0;
|
|
106
|
+
opacity: 0;
|
|
107
|
+
z-index: 25;
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 100%;
|
|
110
|
+
position: absolute;
|
|
111
|
+
transition: opacity 0.5s;
|
|
112
|
+
background: rgba(0, 0, 0, 0.5);
|
|
113
|
+
}
|
|
114
|
+
.before-label,
|
|
115
|
+
.after-label {
|
|
116
|
+
top: 0;
|
|
117
|
+
bottom: 0;
|
|
118
|
+
z-index: 25;
|
|
119
|
+
user-select: none;
|
|
120
|
+
position: absolute;
|
|
121
|
+
}
|
|
122
|
+
.before-label {
|
|
123
|
+
left: 0;
|
|
124
|
+
}
|
|
125
|
+
.after-label {
|
|
126
|
+
right: 0;
|
|
127
|
+
}
|
|
128
|
+
.container:hover > .overlay {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
.handle {
|
|
132
|
+
z-index: 30;
|
|
133
|
+
width: 40px;
|
|
134
|
+
height: 40px;
|
|
135
|
+
cursor: move;
|
|
136
|
+
background: none;
|
|
137
|
+
margin-top: -4px;
|
|
138
|
+
margin-left: -4px;
|
|
139
|
+
user-select: none;
|
|
140
|
+
position: absolute;
|
|
141
|
+
border-radius: 50px;
|
|
142
|
+
top: calc(50% - 20px);
|
|
143
|
+
border: 4px solid white;
|
|
144
|
+
}
|
|
145
|
+
.handle:before,
|
|
146
|
+
.handle:after {
|
|
147
|
+
content: "";
|
|
148
|
+
height: 9999px;
|
|
149
|
+
position: absolute;
|
|
150
|
+
left: calc(50% - 2px);
|
|
151
|
+
border: 2px solid white;
|
|
152
|
+
}
|
|
153
|
+
.handle:before {
|
|
154
|
+
top: 40px;
|
|
155
|
+
}
|
|
156
|
+
.handle:after {
|
|
157
|
+
bottom: 40px;
|
|
158
|
+
}
|
|
159
|
+
.arrow-right,
|
|
160
|
+
.arrow-left {
|
|
161
|
+
width: 0;
|
|
162
|
+
height: 0;
|
|
163
|
+
user-select: none;
|
|
164
|
+
position: relative;
|
|
165
|
+
border-top: 10px solid transparent;
|
|
166
|
+
border-bottom: 10px solid transparent;
|
|
167
|
+
}
|
|
168
|
+
.arrow-right {
|
|
169
|
+
left: 23px;
|
|
170
|
+
bottom: 10px;
|
|
171
|
+
border-left: 10px solid white;
|
|
172
|
+
}
|
|
173
|
+
.arrow-left {
|
|
174
|
+
left: 7px;
|
|
175
|
+
top: 10px;
|
|
176
|
+
border-right: 10px solid white;
|
|
177
|
+
}
|
|
178
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} ImageCompareProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} ImageCompareEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} ImageCompareSlots */
|
|
4
|
+
export default class ImageCompare extends SvelteComponent<{
|
|
5
|
+
before?: string | undefined;
|
|
6
|
+
after?: string | undefined;
|
|
7
|
+
offset?: number | undefined;
|
|
8
|
+
overlay?: boolean | undefined;
|
|
9
|
+
contain?: boolean | undefined;
|
|
10
|
+
lazyLoad?: boolean | undefined;
|
|
11
|
+
hideOnSlide?: boolean | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
mousedown: MouseEvent;
|
|
14
|
+
} & {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {
|
|
17
|
+
before: {};
|
|
18
|
+
after: {};
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
export type ImageCompareProps = typeof __propDef.props;
|
|
22
|
+
export type ImageCompareEvents = typeof __propDef.events;
|
|
23
|
+
export type ImageCompareSlots = typeof __propDef.slots;
|
|
24
|
+
import { SvelteComponent } from "svelte";
|
|
25
|
+
declare const __propDef: {
|
|
26
|
+
props: {
|
|
27
|
+
before?: string | undefined;
|
|
28
|
+
after?: string | undefined;
|
|
29
|
+
offset?: number | undefined;
|
|
30
|
+
overlay?: boolean | undefined;
|
|
31
|
+
contain?: boolean | undefined;
|
|
32
|
+
lazyLoad?: boolean | undefined;
|
|
33
|
+
hideOnSlide?: boolean | undefined;
|
|
34
|
+
};
|
|
35
|
+
events: {
|
|
36
|
+
mousedown: MouseEvent;
|
|
37
|
+
} & {
|
|
38
|
+
[evt: string]: CustomEvent<any>;
|
|
39
|
+
};
|
|
40
|
+
slots: {
|
|
41
|
+
before: {};
|
|
42
|
+
after: {};
|
|
43
|
+
};
|
|
44
|
+
exports?: undefined;
|
|
45
|
+
bindings?: undefined;
|
|
46
|
+
};
|
|
47
|
+
export {};
|