@fluid-topics/ft-snap-scroll 0.3.12 → 0.3.13

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.
@@ -0,0 +1,8 @@
1
+ export declare const FtSnapScrollCssVariables: {
2
+ buttonsColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
3
+ buttonsZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
4
+ gap: import("@fluid-topics/ft-wc-utils").FtCssVariable;
5
+ colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
6
+ };
7
+ export declare const styles: import("lit").CSSResult;
8
+ //# sourceMappingURL=ft-snap-scroll.css.d.ts.map
@@ -0,0 +1,137 @@
1
+ import { css } from "lit";
2
+ import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
3
+ import { FtButtonCssVariables } from "@fluid-topics/ft-button/build/ft-button.css";
4
+ export const FtSnapScrollCssVariables = {
5
+ buttonsColor: FtCssVariableFactory.extend("--ft-snap-scroll-buttons-color", designSystemVariables.colorPrimary),
6
+ buttonsZIndex: FtCssVariableFactory.create("--ft-snap-scroll-buttons-z-index", "COLOR", "1"),
7
+ gap: FtCssVariableFactory.create("--ft-snap-scroll-gap", "SIZE", "0"),
8
+ colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
9
+ };
10
+ //language=css
11
+ export const styles = css `
12
+ .ft-snap-scroll {
13
+ box-sizing: border-box;
14
+ position: relative;
15
+ display: flex;
16
+
17
+ --ft-snap-scroll-transparent-color: transparent;
18
+ }
19
+
20
+ .ft-snap-scroll.ft-snap-scroll--safari-fix {
21
+ /* Safari handles "transparent" as rgba(0,0,0,0) so it's ugly in linear-gradiant with default --ft-color-surface */
22
+ /* this value should be overridden with --ft-color-surface with alpha set to 0 when needed */
23
+ --ft-snap-scroll-transparent-color: rgba(255, 255, 255, 0);
24
+ }
25
+
26
+ .ft-snap-scroll,
27
+ .ft-snap-scroll--content {
28
+ overflow: hidden;
29
+ }
30
+
31
+ .ft-snap-scroll--limit-size,
32
+ .ft-snap-scroll--limit-size .ft-snap-scroll--content {
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+
37
+ .ft-snap-scroll--content {
38
+ flex-grow: 1;
39
+ flex-shrink: 1;
40
+ box-sizing: border-box;
41
+ scroll-snap-align: start;
42
+ display: flex;
43
+ flex-wrap: nowrap;
44
+ align-items: flex-start;
45
+ justify-content: flex-start;
46
+ gap: ${FtSnapScrollCssVariables.gap};
47
+ }
48
+
49
+ .ft-snap-scroll--hide-scrollbar .ft-snap-scroll--content::-webkit-scrollbar {
50
+ display: none;
51
+ }
52
+
53
+ .ft-snap-scroll--hide-scrollbar .ft-snap-scroll--content {
54
+ -ms-overflow-style: none;
55
+ scrollbar-width: none;
56
+ }
57
+
58
+ .ft-snap-scroll--content::slotted(*) {
59
+ flex-shrink: 0;
60
+ flex-grow: 1;
61
+ max-height: 100%;
62
+ max-width: 100%;
63
+ }
64
+
65
+ .ft-snap-scroll--horizontal,
66
+ .ft-snap-scroll--horizontal .ft-snap-scroll--content {
67
+ width: 100%;
68
+ }
69
+
70
+ .ft-snap-scroll--vertical,
71
+ .ft-snap-scroll--vertical .ft-snap-scroll--content {
72
+ height: 100%;
73
+ }
74
+
75
+ .ft-snap-scroll--horizontal .ft-snap-scroll--content {
76
+ flex-direction: row;
77
+ overflow-x: auto;
78
+ }
79
+
80
+ .ft-snap-scroll--vertical .ft-snap-scroll--content {
81
+ flex-direction: column;
82
+ overflow-y: auto;
83
+ }
84
+
85
+ .ft-snap-scroll--previous,
86
+ .ft-snap-scroll--next {
87
+ position: absolute;
88
+ display: flex;
89
+ z-index: ${FtSnapScrollCssVariables.buttonsZIndex};
90
+ opacity: 1;
91
+ transition: background-color .5s ease-in-out, opacity .5s ease-in-out, z-index .5s ease-in-out;
92
+ ${setVariable(FtButtonCssVariables.backgroundColor, "transparent")};
93
+ ${setVariable(FtButtonCssVariables.color, FtSnapScrollCssVariables.buttonsColor)};
94
+ }
95
+
96
+ .ft-snap-scroll--previous[hidden],
97
+ .ft-snap-scroll--next[hidden] {
98
+ z-index: -1;
99
+ opacity: 0;
100
+ }
101
+
102
+ .ft-snap-scroll--horizontal .ft-snap-scroll--previous {
103
+ top: 0;
104
+ left: -1px;
105
+ bottom: 0;
106
+ background: linear-gradient(to right, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
107
+ }
108
+
109
+ .ft-snap-scroll--vertical .ft-snap-scroll--previous {
110
+ top: -1px;
111
+ left: 0;
112
+ right: 0;
113
+ background: linear-gradient(to bottom, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
114
+ }
115
+
116
+ .ft-snap-scroll--horizontal .ft-snap-scroll--next {
117
+ top: 0;
118
+ right: -1px;
119
+ bottom: 0;
120
+ background: linear-gradient(to left, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
121
+ }
122
+
123
+ .ft-snap-scroll--vertical .ft-snap-scroll--next {
124
+ left: 0;
125
+ right: 0;
126
+ bottom: -1px;
127
+ background: linear-gradient(to top, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
128
+ }
129
+
130
+ .ft-snap-scroll--horizontal .ft-snap-scroll--previous:hover,
131
+ .ft-snap-scroll--horizontal .ft-snap-scroll--next:hover,
132
+ .ft-snap-scroll--vertical .ft-snap-scroll--previous:hover,
133
+ .ft-snap-scroll--vertical .ft-snap-scroll--next:hover {
134
+ background-color: ${FtSnapScrollCssVariables.colorSurface};
135
+ }
136
+ `;
137
+ //# sourceMappingURL=ft-snap-scroll.css.js.map
@@ -1,17 +1,6 @@
1
1
  import { PropertyValues } from "lit";
2
2
  import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
3
- export interface FtSnapScrollProperties {
4
- hideScrollbar: boolean;
5
- controls: boolean;
6
- horizontal: boolean;
7
- limitSize: boolean;
8
- }
9
- export declare const FtSnapScrollCssVariables: {
10
- buttonsColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
11
- buttonsZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
12
- gap: import("@fluid-topics/ft-wc-utils").FtCssVariable;
13
- colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
14
- };
3
+ import { FtSnapScrollProperties } from "./ft-snap-scroll.properties";
15
4
  export declare class CurrentElementChange extends CustomEvent<{
16
5
  index: number;
17
6
  element: HTMLElement;
@@ -4,17 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { css, html } from "lit";
7
+ import { html } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
- import { Debouncer, designSystemVariables, FtCssVariableFactory, FtLitElement, isSafari, setVariable } from "@fluid-topics/ft-wc-utils";
10
- import { FtButton, FtButtonCssVariables } from "@fluid-topics/ft-button";
9
+ import { Debouncer, FtLitElement, isSafari } from "@fluid-topics/ft-wc-utils";
10
+ import { FtButton } from "@fluid-topics/ft-button";
11
11
  import { classMap } from "lit/directives/class-map.js";
12
- export const FtSnapScrollCssVariables = {
13
- buttonsColor: FtCssVariableFactory.extend("--ft-snap-scroll-buttons-color", designSystemVariables.colorPrimary),
14
- buttonsZIndex: FtCssVariableFactory.create("--ft-snap-scroll-buttons-z-index", "COLOR", "1"),
15
- gap: FtCssVariableFactory.create("--ft-snap-scroll-gap", "SIZE", "0"),
16
- colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
17
- };
12
+ import { styles } from "./ft-snap-scroll.css";
18
13
  export class CurrentElementChange extends CustomEvent {
19
14
  constructor(index, element) {
20
15
  super("current-element-change", { detail: { index, element } });
@@ -214,133 +209,7 @@ export class FtSnapScroll extends FtLitElement {
214
209
  FtSnapScroll.elementDefinitions = {
215
210
  "ft-button": FtButton,
216
211
  };
217
- // language=CSS
218
- FtSnapScroll.styles = css `
219
- .ft-snap-scroll {
220
- box-sizing: border-box;
221
- position: relative;
222
- display: flex;
223
-
224
- --ft-snap-scroll-transparent-color: transparent;
225
- }
226
-
227
- .ft-snap-scroll.ft-snap-scroll--safari-fix {
228
- /* Safari handles "transparent" as rgba(0,0,0,0) so it's ugly in linear-gradiant with default --ft-color-surface */
229
- /* this value should be overridden with --ft-color-surface with alpha set to 0 when needed */
230
- --ft-snap-scroll-transparent-color: rgba(255, 255, 255, 0);
231
- }
232
-
233
- .ft-snap-scroll,
234
- .ft-snap-scroll--content {
235
- overflow: hidden;
236
- }
237
-
238
- .ft-snap-scroll--limit-size,
239
- .ft-snap-scroll--limit-size .ft-snap-scroll--content {
240
- width: 100%;
241
- height: 100%;
242
- }
243
-
244
- .ft-snap-scroll--content {
245
- flex-grow: 1;
246
- flex-shrink: 1;
247
- box-sizing: border-box;
248
- scroll-snap-align: start;
249
- display: flex;
250
- flex-wrap: nowrap;
251
- align-items: flex-start;
252
- justify-content: flex-start;
253
- gap: ${FtSnapScrollCssVariables.gap};
254
- }
255
-
256
- .ft-snap-scroll--hide-scrollbar .ft-snap-scroll--content::-webkit-scrollbar {
257
- display: none;
258
- }
259
-
260
- .ft-snap-scroll--hide-scrollbar .ft-snap-scroll--content {
261
- -ms-overflow-style: none;
262
- scrollbar-width: none;
263
- }
264
-
265
- .ft-snap-scroll--content::slotted(*) {
266
- flex-shrink: 0;
267
- flex-grow: 1;
268
- max-height: 100%;
269
- max-width: 100%;
270
- }
271
-
272
- .ft-snap-scroll--horizontal,
273
- .ft-snap-scroll--horizontal .ft-snap-scroll--content {
274
- width: 100%;
275
- }
276
-
277
- .ft-snap-scroll--vertical,
278
- .ft-snap-scroll--vertical .ft-snap-scroll--content {
279
- height: 100%;
280
- }
281
-
282
- .ft-snap-scroll--horizontal .ft-snap-scroll--content {
283
- flex-direction: row;
284
- overflow-x: auto;
285
- }
286
-
287
- .ft-snap-scroll--vertical .ft-snap-scroll--content {
288
- flex-direction: column;
289
- overflow-y: auto;
290
- }
291
-
292
- .ft-snap-scroll--previous,
293
- .ft-snap-scroll--next {
294
- position: absolute;
295
- display: flex;
296
- z-index: ${FtSnapScrollCssVariables.buttonsZIndex};
297
- opacity: 1;
298
- transition: background-color .5s ease-in-out, opacity .5s ease-in-out, z-index .5s ease-in-out;
299
- ${setVariable(FtButtonCssVariables.backgroundColor, "transparent")};
300
- ${setVariable(FtButtonCssVariables.color, FtSnapScrollCssVariables.buttonsColor)};
301
- }
302
-
303
- .ft-snap-scroll--previous[hidden],
304
- .ft-snap-scroll--next[hidden] {
305
- z-index: -1;
306
- opacity: 0;
307
- }
308
-
309
- .ft-snap-scroll--horizontal .ft-snap-scroll--previous {
310
- top: 0;
311
- left: -1px;
312
- bottom: 0;
313
- background: linear-gradient(to right, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
314
- }
315
-
316
- .ft-snap-scroll--vertical .ft-snap-scroll--previous {
317
- top: -1px;
318
- left: 0;
319
- right: 0;
320
- background: linear-gradient(to bottom, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
321
- }
322
-
323
- .ft-snap-scroll--horizontal .ft-snap-scroll--next {
324
- top: 0;
325
- right: -1px;
326
- bottom: 0;
327
- background: linear-gradient(to left, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
328
- }
329
-
330
- .ft-snap-scroll--vertical .ft-snap-scroll--next {
331
- left: 0;
332
- right: 0;
333
- bottom: -1px;
334
- background: linear-gradient(to top, ${FtSnapScrollCssVariables.colorSurface} 50%, var(--ft-snap-scroll-transparent-color));
335
- }
336
-
337
- .ft-snap-scroll--horizontal .ft-snap-scroll--previous:hover,
338
- .ft-snap-scroll--horizontal .ft-snap-scroll--next:hover,
339
- .ft-snap-scroll--vertical .ft-snap-scroll--previous:hover,
340
- .ft-snap-scroll--vertical .ft-snap-scroll--next:hover {
341
- background-color: ${FtSnapScrollCssVariables.colorSurface};
342
- }
343
- `;
212
+ FtSnapScroll.styles = styles;
344
213
  __decorate([
345
214
  property({ type: Boolean })
346
215
  ], FtSnapScroll.prototype, "horizontal", void 0);