@functionalcms/svelte-components 2.39.0 → 2.40.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.
@@ -37,55 +37,7 @@ const buttonCss = mergedClasses("hamburger-handle", noBorder, cssClasses.buttonC
37
37
  </Drawer>
38
38
 
39
39
  <style>
40
- :global(.hamburger-handle) {
41
- background: var(--functional-menu-background) !important;
42
- }
43
40
  :global(#hamburger-menu) {
44
41
  z-index: 10001;
45
42
  }
46
- :global(#hamburger-menu > .dialog-content) {
47
- background: var(--functional-menu-background) !important;
48
- }
49
- :global(.no-border) {
50
- border: none !important;
51
- }
52
- ul {
53
- list-style: none;
54
- background-color: white;
55
- }
56
- :global(#menu-id) {
57
- color: var(--functional-menu-item-color);
58
- }
59
- a {
60
- display: block;
61
- font-weight: bold;
62
- color: var(--functional-menu-item-color);
63
- margin: var(--functional-menu-item-margin);
64
- padding: var(--functional-menu-item-padding);
65
- background: var(--functional-menu-item-background);
66
- border-top: var(--functional-menu-item-border-top);
67
- border-right: var(--functional-menu-item-border-right);
68
- border-bottom: var(--functional-menu-item-border-bottom);
69
- border-left: var(--functional-menu-item-border-left);
70
- }
71
- a:hover {
72
- color: var(--functional-menu-item-hover-color);
73
- margin: var(--functional-menu-item-hover-margin);
74
- padding: var(--functional-menu-item-hover-padding);
75
- background: var(--functional-menu-item-hover-background);
76
- border-top: var(--functional-menu-item-hover-border-top);
77
- border-right: var(--functional-menu-item-hover-border-right);
78
- border-bottom: var(--functional-menu-item-hover-border-bottom);
79
- border-left: var(--functional-menu-item-hover-border-left);
80
- }
81
- li[aria-current='true'] a {
82
- color: var(--functional-menu-item-selected-color);
83
- margin: var(--functional-menu-item-selected-margin);
84
- padding: var(--functional-menu-item-selected-padding);
85
- background: var(--functional-menu-item-selected-background);
86
- border-top: var(--functional-menu-item-selected-border-top);
87
- border-right: var(--functional-menu-item-selected-border-right);
88
- border-bottom: var(--functional-menu-item-selected-border-bottom);
89
- border-left: var(--functional-menu-item-selected-border-left);
90
- }
91
43
  </style>
@@ -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;
@@ -9,6 +9,7 @@ export class HeaderNavigationItem {
9
9
  path;
10
10
  action;
11
11
  visiblity = Visiblity.Always;
12
+ subItems = [];
12
13
  }
13
14
  export function selectVisible(pages, visiblity) {
14
15
  return pages.filter((page) => page?.visiblity === Visiblity.Always ||
@@ -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}
25
+
26
+ {#if pageItem.subItems?.length > 0}
27
+ <slot name="subItems" subpages={pageItem.subItems} />
28
+ {/if}
26
29
  </a>
27
- <!-- </Link> -->
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>
@@ -14,7 +14,11 @@ declare const __propDef: {
14
14
  events: {
15
15
  [evt: string]: CustomEvent<any>;
16
16
  };
17
- slots: {};
17
+ slots: {
18
+ subItems: {
19
+ subpages: HeaderNavigationItem[] | undefined;
20
+ };
21
+ };
18
22
  exports?: {} | undefined;
19
23
  bindings?: string | undefined;
20
24
  };
@@ -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 {};
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export { default as Link } from './components/Link.svelte';
15
15
  export { default as Gallery } from './components/presentation/Gallery.svelte';
16
16
  export { default as Carusel } from './components/presentation/Carusel.svelte';
17
17
  export { CaruseleItem } from './components/presentation/Carusele.js';
18
+ export { default as ImageCompare } from './components/presentation/ImageCompare.svelte';
18
19
  export { default as BlogDescription } from './components/blog/BlogDescription.svelte';
19
20
  export { default as BlogTitle } from './components/blog/BlogTitle.svelte';
20
21
  export type { BlogPost } from './components/blog/BlogPost.js';
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export { default as Link } from './components/Link.svelte';
15
15
  export { default as Gallery } from './components/presentation/Gallery.svelte';
16
16
  export { default as Carusel } from './components/presentation/Carusel.svelte';
17
17
  export { CaruseleItem } from './components/presentation/Carusele.js';
18
+ export { default as ImageCompare } from './components/presentation/ImageCompare.svelte';
18
19
  export { default as BlogDescription } from './components/blog/BlogDescription.svelte';
19
20
  export { default as BlogTitle } from './components/blog/BlogTitle.svelte';
20
21
  export { importPost, listAllPosts } from './components/blog/blog.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "2.39.0",
3
+ "version": "2.40.2",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [