@functionalcms/svelte-components 5.4.4 → 5.5.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.
@@ -1,180 +1,180 @@
1
- <script lang="ts">
2
- import { type Snippet } from "svelte";
3
-
4
- interface Props {
5
- imageLeftSrc: string;
6
- imageLeftAlt: string;
7
- imageRightSrc: string;
8
- imageRightAlt: string;
9
- slidertLabel: Snippet;
10
- }
11
-
12
- let {
13
- imageLeftSrc = "",
14
- imageLeftAlt = "",
15
- imageRightSrc = "",
16
- imageRightAlt = "",
17
- slidertLabel,
18
- }: Partial<Props> = $props();
19
-
20
- let sliderPosition: number = $state(50);
21
- let animationFrame: number | null = $state(null);
22
-
23
- function handleInput(e: Event) {
24
- if (animationFrame) cancelAnimationFrame(animationFrame);
25
-
26
- animationFrame = requestAnimationFrame(() => {
27
- sliderPosition = (e.target as HTMLInputElement).valueAsNumber;
28
- });
29
- }
30
-
31
- function handleClick(e: Event) {
32
- (e.target as HTMLInputElement).focus();
33
- }
34
- </script>
35
-
36
- <div
37
- class="svelte-compare-image-container"
38
- style="--slider-position: {sliderPosition}%;"
39
- >
40
- <img src={imageLeftSrc} alt={imageLeftAlt} class="left-img" />
41
- <img src={imageRightSrc} alt={imageRightAlt} class="right-img" />
42
-
43
- <label>
44
- <input
45
- type="range"
46
- min="0"
47
- max="100"
48
- value={sliderPosition}
49
- oninput={handleInput}
50
- onchange={handleInput}
51
- onclick={handleClick}
52
- />
53
- </label>
54
- </div>
55
-
56
- <style>
57
- .svelte-compare-image-container {
58
- box-sizing: border-box;
59
- position: relative;
60
- overflow: hidden;
61
- }
62
-
63
- .svelte-compare-image-container:focus-within {
64
- outline: auto 4px rgba(59, 153, 252, 0.7);
65
- outline: auto 4px Highlight;
66
- outline: auto 4px -moz-mac-focusring;
67
- outline: auto 4px -webkit-focus-ring-color;
68
- }
69
-
70
- img {
71
- display: block;
72
- height: auto;
73
- width: 100%;
74
- margin: 0;
75
- }
76
-
77
- .left-img {
78
- clip-path: polygon(
79
- 0 0,
80
- var(--slider-position) 0,
81
- var(--slider-position) 100%,
82
- 0 100%
83
- );
84
- }
85
-
86
- .right-img {
87
- position: absolute;
88
- top: 0;
89
- clip-path: polygon(
90
- var(--slider-position) 0,
91
- 100% 0,
92
- 100% 100%,
93
- var(--slider-position) 100%
94
- );
95
- }
96
-
97
- label {
98
- position: absolute;
99
- display: flex;
100
- align-items: stretch;
101
- top: 0;
102
- left: 0;
103
- bottom: 0;
104
- right: 0;
105
- background: transparent;
106
- }
107
-
108
- label::before {
109
- content: "";
110
- position: absolute;
111
- top: 0;
112
- bottom: 0;
113
- left: calc(var(--slider-position) - var(--slider-width, 0.125rem) / 2);
114
- width: var(--slider-width, 0.125rem);
115
- background: var(--slider-color, #ffffff);
116
- pointer-events: none;
117
- }
118
-
119
- input[type="range"] {
120
- position: relative;
121
- cursor: col-resize;
122
- margin: 0 calc(var(--handle-size, 2.5rem) / -2);
123
- width: calc(100% + var(--handle-size, 2.5rem));
124
- padding: 0;
125
- border-radius: 0;
126
- appearance: none;
127
- -webkit-appearance: none;
128
- background: none;
129
- border: none;
130
- }
131
-
132
- input[type="range"]::-moz-range-thumb {
133
- display: flex;
134
- justify-content: center;
135
- align-items: center;
136
- background-color: var(--handle-background-color, rgba(0, 0, 0, 0.6));
137
- background-image: var(
138
- --handle-background-image,
139
- url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 12H21M3 12L7 8M3 12L7 16M21 12L17 16M21 12L17 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>')
140
- );
141
- background-size: 80%;
142
- background-position: center center;
143
- background-repeat: no-repeat;
144
- border: var(--handle-border-width, 0.125rem) solid
145
- var(--slider-color, #ffffff);
146
- border-radius: 100%;
147
- box-shadow:
148
- 0 3px 1px -2px rgba(0, 0, 0, 0.2),
149
- 0 2px 2px 0 rgba(0, 0, 0, 0.14),
150
- 0 1px 5px 0 rgba(0, 0, 0, 0.12);
151
- color: var(--slider-color, #ffffff);
152
- width: var(--handle-size, 2.5rem);
153
- height: var(--handle-size, 2.5rem);
154
- }
155
-
156
- input[type="range"]::-webkit-slider-thumb {
157
- -webkit-appearance: none;
158
- display: flex;
159
- justify-content: center;
160
- align-items: center;
161
- background-color: var(--handle-background-color, rgba(0, 0, 0, 0.6));
162
- background-image: var(
163
- --handle-background-image,
164
- url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 12H21M3 12L7 8M3 12L7 16M21 12L17 16M21 12L17 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>')
165
- );
166
- background-size: 80%;
167
- background-position: center center;
168
- background-repeat: no-repeat;
169
- border: var(--handle-border-width, 0.125rem) solid
170
- var(--slider-color, #ffffff);
171
- border-radius: 100%;
172
- box-shadow:
173
- 0 3px 1px -2px rgba(0, 0, 0, 0.2),
174
- 0 2px 2px 0 rgba(0, 0, 0, 0.14),
175
- 0 1px 5px 0 rgba(0, 0, 0, 0.12);
176
- color: var(--slider-color, #ffffff);
177
- width: var(--handle-size, 2.5rem);
178
- height: var(--handle-size, 2.5rem);
179
- }
180
- </style>
1
+ <script lang="ts">
2
+ import { type Snippet } from "svelte";
3
+
4
+ interface Props {
5
+ imageLeftSrc: string;
6
+ imageLeftAlt: string;
7
+ imageRightSrc: string;
8
+ imageRightAlt: string;
9
+ slidertLabel: Snippet;
10
+ }
11
+
12
+ let {
13
+ imageLeftSrc = "",
14
+ imageLeftAlt = "",
15
+ imageRightSrc = "",
16
+ imageRightAlt = "",
17
+ slidertLabel,
18
+ }: Partial<Props> = $props();
19
+
20
+ let sliderPosition: number = $state(50);
21
+ let animationFrame: number | null = $state(null);
22
+
23
+ function handleInput(e: Event) {
24
+ if (animationFrame) cancelAnimationFrame(animationFrame);
25
+
26
+ animationFrame = requestAnimationFrame(() => {
27
+ sliderPosition = (e.target as HTMLInputElement).valueAsNumber;
28
+ });
29
+ }
30
+
31
+ function handleClick(e: Event) {
32
+ (e.target as HTMLInputElement).focus();
33
+ }
34
+ </script>
35
+
36
+ <div
37
+ class="svelte-compare-image-container"
38
+ style="--slider-position: {sliderPosition}%;"
39
+ >
40
+ <img src={imageLeftSrc} alt={imageLeftAlt} class="left-img" />
41
+ <img src={imageRightSrc} alt={imageRightAlt} class="right-img" />
42
+
43
+ <label>
44
+ <input
45
+ type="range"
46
+ min="0"
47
+ max="100"
48
+ value={sliderPosition}
49
+ oninput={handleInput}
50
+ onchange={handleInput}
51
+ onclick={handleClick}
52
+ />
53
+ </label>
54
+ </div>
55
+
56
+ <style>
57
+ .svelte-compare-image-container {
58
+ box-sizing: border-box;
59
+ position: relative;
60
+ overflow: hidden;
61
+ }
62
+
63
+ .svelte-compare-image-container:focus-within {
64
+ outline: auto 4px rgba(59, 153, 252, 0.7);
65
+ outline: auto 4px Highlight;
66
+ outline: auto 4px -moz-mac-focusring;
67
+ outline: auto 4px -webkit-focus-ring-color;
68
+ }
69
+
70
+ img {
71
+ display: block;
72
+ height: auto;
73
+ width: 100%;
74
+ margin: 0;
75
+ }
76
+
77
+ .left-img {
78
+ clip-path: polygon(
79
+ 0 0,
80
+ var(--slider-position) 0,
81
+ var(--slider-position) 100%,
82
+ 0 100%
83
+ );
84
+ }
85
+
86
+ .right-img {
87
+ position: absolute;
88
+ top: 0;
89
+ clip-path: polygon(
90
+ var(--slider-position) 0,
91
+ 100% 0,
92
+ 100% 100%,
93
+ var(--slider-position) 100%
94
+ );
95
+ }
96
+
97
+ label {
98
+ position: absolute;
99
+ display: flex;
100
+ align-items: stretch;
101
+ top: 0;
102
+ left: 0;
103
+ bottom: 0;
104
+ right: 0;
105
+ background: transparent;
106
+ }
107
+
108
+ label::before {
109
+ content: "";
110
+ position: absolute;
111
+ top: 0;
112
+ bottom: 0;
113
+ left: calc(var(--slider-position) - var(--slider-width, 0.125rem) / 2);
114
+ width: var(--slider-width, 0.125rem);
115
+ background: var(--slider-color, #ffffff);
116
+ pointer-events: none;
117
+ }
118
+
119
+ input[type="range"] {
120
+ position: relative;
121
+ cursor: col-resize;
122
+ margin: 0 calc(var(--handle-size, 2.5rem) / -2);
123
+ width: calc(100% + var(--handle-size, 2.5rem));
124
+ padding: 0;
125
+ border-radius: 0;
126
+ appearance: none;
127
+ -webkit-appearance: none;
128
+ background: none;
129
+ border: none;
130
+ }
131
+
132
+ input[type="range"]::-moz-range-thumb {
133
+ display: flex;
134
+ justify-content: center;
135
+ align-items: center;
136
+ background-color: var(--handle-background-color, rgba(0, 0, 0, 0.6));
137
+ background-image: var(
138
+ --handle-background-image,
139
+ url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 12H21M3 12L7 8M3 12L7 16M21 12L17 16M21 12L17 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>')
140
+ );
141
+ background-size: 80%;
142
+ background-position: center center;
143
+ background-repeat: no-repeat;
144
+ border: var(--handle-border-width, 0.125rem) solid
145
+ var(--slider-color, #ffffff);
146
+ border-radius: 100%;
147
+ box-shadow:
148
+ 0 3px 1px -2px rgba(0, 0, 0, 0.2),
149
+ 0 2px 2px 0 rgba(0, 0, 0, 0.14),
150
+ 0 1px 5px 0 rgba(0, 0, 0, 0.12);
151
+ color: var(--slider-color, #ffffff);
152
+ width: var(--handle-size, 2.5rem);
153
+ height: var(--handle-size, 2.5rem);
154
+ }
155
+
156
+ input[type="range"]::-webkit-slider-thumb {
157
+ -webkit-appearance: none;
158
+ display: flex;
159
+ justify-content: center;
160
+ align-items: center;
161
+ background-color: var(--handle-background-color, rgba(0, 0, 0, 0.6));
162
+ background-image: var(
163
+ --handle-background-image,
164
+ url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 12H21M3 12L7 8M3 12L7 16M21 12L17 16M21 12L17 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>')
165
+ );
166
+ background-size: 80%;
167
+ background-position: center center;
168
+ background-repeat: no-repeat;
169
+ border: var(--handle-border-width, 0.125rem) solid
170
+ var(--slider-color, #ffffff);
171
+ border-radius: 100%;
172
+ box-shadow:
173
+ 0 3px 1px -2px rgba(0, 0, 0, 0.2),
174
+ 0 2px 2px 0 rgba(0, 0, 0, 0.14),
175
+ 0 1px 5px 0 rgba(0, 0, 0, 0.12);
176
+ color: var(--slider-color, #ffffff);
177
+ width: var(--handle-size, 2.5rem);
178
+ height: var(--handle-size, 2.5rem);
179
+ }
180
+ </style>
@@ -1,37 +1,37 @@
1
- <script lang="ts">
2
- interface Props {
3
- companyName: string;
4
- logoUrl: string;
5
- css: string;
6
- }
7
-
8
- let {
9
- companyName,
10
- logoUrl,
11
- css = 'logo'
12
- }: Partial<Props> = $props();
13
-
14
- </script>
15
-
16
- <a href="/" class={css}>
17
- <img src={logoUrl} alt={companyName} loading="lazy" />
18
- </a>
19
-
20
- <style>
21
- a {
22
- display: var(--logo-display, 'inline-block');
23
- margin: var(--mobile-logo-margin);
24
- padding: var(--mobile-logo-padding);
25
- }
26
- a img {
27
- width: 100%;
28
- width: var(--logo-width, 200px);
29
- }
30
-
31
- @media (min-width: 960px) {
32
- a img {
33
- margin: var(--logo-margin);
34
- padding: var(--logo-padding);
35
- }
36
- }
37
- </style>
1
+ <script lang="ts">
2
+ interface Props {
3
+ companyName: string;
4
+ logoUrl: string;
5
+ css: string;
6
+ }
7
+
8
+ let {
9
+ companyName,
10
+ logoUrl,
11
+ css = 'logo'
12
+ }: Partial<Props> = $props();
13
+
14
+ </script>
15
+
16
+ <a href="/" class={css}>
17
+ <img src={logoUrl} alt={companyName} loading="lazy" />
18
+ </a>
19
+
20
+ <style>
21
+ a {
22
+ display: var(--logo-display, 'inline-block');
23
+ margin: var(--mobile-logo-margin);
24
+ padding: var(--mobile-logo-padding);
25
+ }
26
+ a img {
27
+ width: 100%;
28
+ width: var(--logo-width, 200px);
29
+ }
30
+
31
+ @media (min-width: 960px) {
32
+ a img {
33
+ margin: var(--logo-margin);
34
+ padding: var(--logo-padding);
35
+ }
36
+ }
37
+ </style>
@@ -1,17 +1,17 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
-
4
- interface Props {
5
- children: Snippet;
6
- class: string;
7
- }
8
-
9
- let {
10
- children,
11
- class: css = '',
12
- }: Partial<Props> = $props();
13
- </script>
14
-
15
- <div class={css}>
16
- {@render children?.()}
17
- </div>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ children: Snippet;
6
+ class: string;
7
+ }
8
+
9
+ let {
10
+ children,
11
+ class: css = '',
12
+ }: Partial<Props> = $props();
13
+ </script>
14
+
15
+ <div class={css}>
16
+ {@render children?.()}
17
+ </div>
@@ -1,17 +1,17 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
-
4
- interface Props {
5
- children: Snippet;
6
- class: string;
7
- }
8
-
9
- let {
10
- children,
11
- class: css = '',
12
- }: Partial<Props> = $props();
13
- </script>
14
-
15
- <div class="well m-auto p-1 {css}">
16
- {@render children?.()}
17
- </div>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ children: Snippet;
6
+ class: string;
7
+ }
8
+
9
+ let {
10
+ children,
11
+ class: css = '',
12
+ }: Partial<Props> = $props();
13
+ </script>
14
+
15
+ <div class="well m-auto p-1 {css}">
16
+ {@render children?.()}
17
+ </div>
@@ -5,7 +5,7 @@ export { machineAuthenticationHandle } from './server-side/auth/machine_authenti
5
5
  export { userAuthenticationProvider } from './server-side/auth/userAuthenticationProvider.js';
6
6
  export { hookSequence } from './server-side/functionalSequence.js';
7
7
  export { sessionStorageHandler } from './server-side/handlers/sessionStorageHandler.js';
8
- export { getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAuthService, getFileService, } from './server-side/getServices.js';
8
+ export { getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAuthService, getFileService, getUsersService } from './server-side/getServices.js';
9
9
  export type { RedirectResponse } from './server-side/auth/RedirectResponse.js';
10
10
  export { isHuman } from './components/form/AntiBot.js';
11
11
  export { paraglideHandler } from './server-side/handlers/paraglideHandler.js';
@@ -5,7 +5,7 @@ export { machineAuthenticationHandle } from './server-side/auth/machine_authenti
5
5
  export { userAuthenticationProvider } from './server-side/auth/userAuthenticationProvider.js';
6
6
  export { hookSequence } from './server-side/functionalSequence.js';
7
7
  export { sessionStorageHandler } from './server-side/handlers/sessionStorageHandler.js';
8
- export { getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAuthService, getFileService, } from './server-side/getServices.js';
8
+ export { getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAuthService, getFileService, getUsersService } from './server-side/getServices.js';
9
9
  export { isHuman } from './components/form/AntiBot.js';
10
10
  export { paraglideHandler } from './server-side/handlers/paraglideHandler.js';
11
11
  export { redirectPipelineHandler } from './server-side/handlers/redirectPipelineHandler.js';
@@ -1,4 +1,4 @@
1
- import { CommunicationService, DataService, TemplateService, WebsitesService, AuthService, FilesService } from "@functionalcms/services";
1
+ import { CommunicationService, DataService, TemplateService, WebsitesService, AuthService, FilesService, UsersService } from "@functionalcms/services";
2
2
  import type { Locals } from "./types.js";
3
3
  export declare const getDataService: (locals: Locals, endpoint: string) => DataService;
4
4
  export declare const getCommunicationService: (locals: Locals, endpoint: string) => CommunicationService;
@@ -6,3 +6,4 @@ export declare const getWebsiteService: (locals: Locals, endpoint: string) => We
6
6
  export declare const getTemplateService: (locals: Locals, endpoint: string) => TemplateService;
7
7
  export declare const getAuthService: (locals: Locals, endpoint: string) => AuthService;
8
8
  export declare const getFileService: (locals: Locals, endpoint: string) => FilesService;
9
+ export declare const getUsersService: (locals: Locals, endpoint: string) => UsersService;
@@ -1,4 +1,4 @@
1
- import { CommunicationService, DataService, TemplateService, WebsitesService, AuthService, FilesService, } from "@functionalcms/services";
1
+ import { CommunicationService, DataService, TemplateService, WebsitesService, AuthService, FilesService, UsersService, } from "@functionalcms/services";
2
2
  const getAccessToken = (locals) => locals.token;
3
3
  export const getDataService = (locals, endpoint) => {
4
4
  const accessToken = getAccessToken(locals);
@@ -30,3 +30,8 @@ export const getFileService = (locals, endpoint) => {
30
30
  const service = new FilesService(accessToken, endpoint);
31
31
  return service;
32
32
  };
33
+ export const getUsersService = (locals, endpoint) => {
34
+ const accessToken = getAccessToken(locals);
35
+ const service = new UsersService(accessToken, endpoint);
36
+ return service;
37
+ };