@hkdigital/lib-sveltekit 0.1.19 → 0.1.21

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 (48) hide show
  1. package/dist/components/layout/index.d.ts +0 -4
  2. package/dist/components/layout/index.js +0 -10
  3. package/dist/components/rows/panel-grid-row/PanelGridRow.svelte.d.ts +2 -2
  4. package/dist/components/rows/panel-row-2/PanelRow2.svelte.d.ts +2 -2
  5. package/dist/themes/hkdev/theme-ext.js +1 -1
  6. package/dist/widgets/button-group/ButtonGroup.svelte +62 -0
  7. package/dist/widgets/button-group/ButtonGroup.svelte.d.ts +41 -0
  8. package/dist/{components/layout → widgets}/game-box/GameBox.svelte +1 -1
  9. package/dist/widgets/index.d.ts +9 -0
  10. package/dist/widgets/index.js +18 -0
  11. package/dist/widgets/presenter/ImageSlide.svelte +13 -0
  12. package/dist/widgets/presenter/ImageSlide.svelte.d.ts +6 -0
  13. package/dist/widgets/presenter/Presenter.state.svelte.d.ts +100 -0
  14. package/dist/widgets/presenter/Presenter.state.svelte.js +553 -0
  15. package/dist/widgets/presenter/Presenter.svelte +125 -0
  16. package/dist/widgets/presenter/Presenter.svelte.d.ts +20 -0
  17. package/dist/widgets/presenter/constants.d.ts +3 -0
  18. package/dist/widgets/presenter/constants.js +4 -0
  19. package/dist/widgets/presenter/index.d.ts +6 -0
  20. package/dist/widgets/presenter/index.js +15 -0
  21. package/dist/widgets/presenter/typedef.d.ts +58 -0
  22. package/dist/widgets/presenter/typedef.js +75 -0
  23. package/dist/widgets/presenter/util.d.ts +56 -0
  24. package/dist/widgets/presenter/util.js +188 -0
  25. package/dist/{components/layout → widgets}/virtual-viewport/VirtualViewport.svelte +1 -1
  26. package/package.json +1 -1
  27. package/dist/components/widgets/scale-control/ScaleControl.svelte +0 -0
  28. package/dist/components/widgets/scale-control/ScaleControl.svelte.d.ts +0 -26
  29. package/dist/components/widgets/scale-control/index.d.ts +0 -1
  30. package/dist/components/widgets/scale-control/index.js +0 -1
  31. /package/dist/{components/widgets → widgets}/compare-left-right/CompareLeftRight.svelte +0 -0
  32. /package/dist/{components/widgets → widgets}/compare-left-right/CompareLeftRight.svelte.d.ts +0 -0
  33. /package/dist/{components/widgets → widgets}/compare-left-right/index.d.ts +0 -0
  34. /package/dist/{components/widgets → widgets}/compare-left-right/index.js +0 -0
  35. /package/dist/{components/layout → widgets}/game-box/GameBox.svelte.d.ts +0 -0
  36. /package/dist/{components/layout → widgets}/game-box/gamebox.util.d.ts +0 -0
  37. /package/dist/{components/layout → widgets}/game-box/gamebox.util.js +0 -0
  38. /package/dist/{components/layout → widgets/hk-app-layout}/HkAppLayout.state.svelte.d.ts +0 -0
  39. /package/dist/{components/layout → widgets/hk-app-layout}/HkAppLayout.state.svelte.js +0 -0
  40. /package/dist/{components/layout → widgets/hk-app-layout}/HkAppLayout.svelte +0 -0
  41. /package/dist/{components/layout → widgets/hk-app-layout}/HkAppLayout.svelte.d.ts +0 -0
  42. /package/dist/{components/image → widgets/image-box}/ImageBox.svelte +0 -0
  43. /package/dist/{components/image → widgets/image-box}/ImageBox.svelte.d.ts +0 -0
  44. /package/dist/{components/image → widgets/image-box}/index.d.ts +0 -0
  45. /package/dist/{components/image → widgets/image-box}/index.js +0 -0
  46. /package/dist/{components/image → widgets/image-box}/typedef.d.ts +0 -0
  47. /package/dist/{components/image → widgets/image-box}/typedef.js +0 -0
  48. /package/dist/{components/layout → widgets}/virtual-viewport/VirtualViewport.svelte.d.ts +0 -0
@@ -0,0 +1,15 @@
1
+ export { default as Presenter } from './Presenter.svelte';
2
+ export { default as ImageSlide } from './ImageSlide.svelte';
3
+
4
+ export {
5
+ PresenterState,
6
+ createOrGetState as createOrGetPresenterState,
7
+ createState as createPresenterState,
8
+ getState as getPresenterState
9
+ } from './Presenter.state.svelte.js';
10
+
11
+ export * from './typedef.js';
12
+ export * from './constants.js';
13
+
14
+ // @ts-ignore
15
+ export * from './util.js';
@@ -0,0 +1,58 @@
1
+ declare const _default: {};
2
+ export default _default;
3
+ export type CssTransition = {
4
+ type: ("css");
5
+ property: string;
6
+ from: string;
7
+ to: string;
8
+ delay?: number;
9
+ duration?: number;
10
+ timing?: string;
11
+ };
12
+ export type FadeInTransition = {
13
+ type: ("fade-in");
14
+ from?: string;
15
+ to?: string;
16
+ delay?: number;
17
+ duration?: number;
18
+ timing?: string;
19
+ };
20
+ export type FadeOutTransition = {
21
+ type: ("fade-out");
22
+ from?: string;
23
+ to?: string;
24
+ delay?: number;
25
+ duration?: number;
26
+ timing?: string;
27
+ };
28
+ export type Transition = CssTransition | FadeInTransition | FadeOutTransition;
29
+ export type SlideData = {
30
+ [attrs: string]: any;
31
+ };
32
+ export type SlideLayerLayout = {
33
+ [attrs: string]: any;
34
+ };
35
+ export type SlideLayer = {
36
+ data?: SlideData;
37
+ layout?: SlideLayerLayout;
38
+ };
39
+ export type Slide = {
40
+ name: string;
41
+ data?: SlideData;
42
+ layers?: SlideLayer[];
43
+ intro?: Transition[];
44
+ outro?: Transition[];
45
+ duration?: number;
46
+ };
47
+ export type Layer = {
48
+ z: number;
49
+ visible: boolean;
50
+ stageIdle?: boolean;
51
+ stageBeforeIn?: boolean;
52
+ stageIn?: boolean;
53
+ stageShow?: boolean;
54
+ stageBeforeOut?: boolean;
55
+ stageOut?: boolean;
56
+ stageAfter?: boolean;
57
+ transitions?: Transition[];
58
+ };
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @typedef {{
3
+ * type: (import('./constants').TRANSITION_CSS),
4
+ * property: string,
5
+ * from: string,
6
+ * to: string,
7
+ * delay?: number
8
+ * duration?: number
9
+ * timing?: string
10
+ * }} CssTransition
11
+ */
12
+
13
+ /**
14
+ * @typedef {{
15
+ * type: (import('./constants').FADE_IN),
16
+ * from?: string,
17
+ * to?: string,
18
+ * delay?: number
19
+ * duration?: number
20
+ * timing?: string
21
+ * }} FadeInTransition
22
+ */
23
+
24
+ /**
25
+ * @typedef {{
26
+ * type: (import('./constants').FADE_OUT),
27
+ * from?: string,
28
+ * to?: string,
29
+ * delay?: number
30
+ * duration?: number
31
+ * timing?: string
32
+ * }} FadeOutTransition
33
+ */
34
+
35
+ /**
36
+ * @typedef {CssTransition|FadeInTransition|FadeOutTransition} Transition
37
+ */
38
+
39
+ /**
40
+ * @typedef {{[attrs: string]: *}} SlideData
41
+ */
42
+
43
+ /**
44
+ * @typedef {{[attrs: string]: *}} SlideLayerLayout
45
+ */
46
+
47
+ /**
48
+ * @typedef {{data?:SlideData, layout?:SlideLayerLayout}} SlideLayer
49
+ */
50
+
51
+ /**
52
+ * @typedef {object} Slide
53
+ * @property {string} name
54
+ * @property {SlideData} [data]
55
+ * @property {SlideLayer[]} [layers]
56
+ * @property {Transition[]} [intro]
57
+ * @property {Transition[]} [outro]
58
+ * @property {number} [duration]
59
+ */
60
+
61
+ /**
62
+ * @typedef {object} Layer
63
+ * @property {number} z
64
+ * @property {boolean} visible
65
+ * @property {boolean} [stageIdle]
66
+ * @property {boolean} [stageBeforeIn]
67
+ * @property {boolean} [stageIn]
68
+ * @property {boolean} [stageShow]
69
+ * @property {boolean} [stageBeforeOut]
70
+ * @property {boolean} [stageOut]
71
+ * @property {boolean} [stageAfter]
72
+ * @property {Transition[]} [transitions]
73
+ */
74
+
75
+ export default {};
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @typedef {import("./typedef").Transition} Transition
3
+ */
4
+ /** ----------------------------------------------------------------- Exports */
5
+ /** ----------------------------------- Generate CSS for lists of transitions */
6
+ /**
7
+ * Generates style and class names to be used before the transitions
8
+ * become active
9
+ *
10
+ * @param {Transition[]} transitions
11
+ *
12
+ * @returns {{style: string, classes: string}}
13
+ */
14
+ export function cssBefore(transitions: Transition[]): {
15
+ style: string;
16
+ classes: string;
17
+ };
18
+ /**
19
+ * Generates style and class names to be used when the transitions are active
20
+ *
21
+ * @param {Transition[]} transitions
22
+ *
23
+ * @returns {{style: string, classes: string}}
24
+ */
25
+ export function cssDuring(transitions: Transition[]): {
26
+ style: string;
27
+ classes: string;
28
+ };
29
+ /** ------------------------------------- Generate CSS for single transitions */
30
+ /**
31
+ * Generates style and class names for specified transition for
32
+ * the stage 'stageBeforeIn'
33
+ *
34
+ * @param {Transition} transition
35
+ *
36
+ * @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
37
+ */
38
+ export function transitionCssBefore(transition: Transition): {
39
+ propertyStyle: string;
40
+ transitionStyle: string;
41
+ classes: string;
42
+ };
43
+ /**
44
+ * Generates style and class names for specified transition for
45
+ * the stage 'stageIn'
46
+ *
47
+ * @param {Transition} transition
48
+ *
49
+ * @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
50
+ */
51
+ export function transitionCssDuring(transition: Transition): {
52
+ propertyStyle: string;
53
+ transitionStyle: string;
54
+ classes: string;
55
+ };
56
+ export type Transition = import("./typedef").Transition;
@@ -0,0 +1,188 @@
1
+ import * as expect from '../../util/expect/index.js';
2
+
3
+ import { pushNotEmpty } from '../../util/array/index.js';
4
+
5
+ import { TRANSITION_CSS, FADE_IN, FADE_OUT } from './constants.js';
6
+
7
+ /**
8
+ * @typedef {import("./typedef").Transition} Transition
9
+ */
10
+
11
+ /** ----------------------------------------------------------------- Exports */
12
+
13
+ /** ----------------------------------- Generate CSS for lists of transitions */
14
+
15
+ /**
16
+ * Generates style and class names to be used before the transitions
17
+ * become active
18
+ *
19
+ * @param {Transition[]} transitions
20
+ *
21
+ * @returns {{style: string, classes: string}}
22
+ */
23
+ export function cssBefore(transitions) {
24
+ expect.objectArray(transitions);
25
+
26
+ /** @type {string[]} */ let propertyStyleArr = [];
27
+ /** @type {string[]} */ let transitionStyleArr = [];
28
+ /** @type {string[]} */ let classesArr = [];
29
+
30
+ for (const transition of transitions) {
31
+ const { propertyStyle, transitionStyle, classes } =
32
+ transitionCssBefore(transition);
33
+
34
+ pushNotEmpty(propertyStyleArr, propertyStyle);
35
+ pushNotEmpty(transitionStyleArr, transitionStyle);
36
+ pushNotEmpty(classesArr, classes);
37
+ }
38
+
39
+ let style = propertyStyleArr.join(';');
40
+
41
+ if (transitionStyleArr.length) {
42
+ style += `;transition: ${transitionStyleArr.join(',')}`;
43
+ }
44
+
45
+ // console.log('cssBefore', transitions, style);
46
+
47
+ return { style, classes: classesArr.join() };
48
+ }
49
+
50
+ /**
51
+ * Generates style and class names to be used when the transitions are active
52
+ *
53
+ * @param {Transition[]} transitions
54
+ *
55
+ * @returns {{style: string, classes: string}}
56
+ */
57
+ export function cssDuring(transitions) {
58
+ expect.objectArray(transitions);
59
+
60
+ /** @type {string[]} */ let propertyStyleArr = [];
61
+ /** @type {string[]} */ let transitionStyleArr = [];
62
+ /** @type {string[]} */ let classesArr = [];
63
+
64
+ for (const transition of transitions) {
65
+ const { propertyStyle, transitionStyle, classes } =
66
+ transitionCssDuring(transition);
67
+
68
+ pushNotEmpty(propertyStyleArr, propertyStyle);
69
+ pushNotEmpty(transitionStyleArr, transitionStyle);
70
+ pushNotEmpty(classesArr, classes);
71
+ } // end for
72
+
73
+ let style = propertyStyleArr.join(';');
74
+
75
+ if (transitionStyleArr.length) {
76
+ style += `;transition: ${transitionStyleArr.join(',')}`;
77
+ }
78
+
79
+ return { style, classes: classesArr.join() };
80
+ }
81
+
82
+ /** ------------------------------------- Generate CSS for single transitions */
83
+
84
+ /**
85
+ * Generates style and class names for specified transition for
86
+ * the stage 'stageBeforeIn'
87
+ *
88
+ * @param {Transition} transition
89
+ *
90
+ * @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
91
+ */
92
+ export function transitionCssBefore(transition) {
93
+ expect.objectNoArray(transition);
94
+
95
+ let {
96
+ type,
97
+ // @ts-ignore
98
+ property,
99
+ from
100
+ } = transition;
101
+
102
+ let propertyStyle = '';
103
+ let transitionStyle = '';
104
+ let classes = '';
105
+
106
+ switch (type) {
107
+ case FADE_IN:
108
+ type = TRANSITION_CSS;
109
+ property = 'opacity';
110
+ from = from ?? '0';
111
+ break;
112
+
113
+ case FADE_OUT:
114
+ type = TRANSITION_CSS;
115
+ property = 'opacity';
116
+ from = from ?? '1';
117
+ break;
118
+ }
119
+
120
+ if (!type || TRANSITION_CSS === type) {
121
+ expect.notEmptyString(property);
122
+ expect.string(from);
123
+
124
+ propertyStyle = `${property}: ${from}`;
125
+ } else {
126
+ throw new Error(`Unknown transition type [${type}]`);
127
+ }
128
+
129
+ // console.log('transitionCssBefore', { propertyStyle, transitionStyle });
130
+
131
+ return { propertyStyle, transitionStyle, classes };
132
+ }
133
+
134
+ /**
135
+ * Generates style and class names for specified transition for
136
+ * the stage 'stageIn'
137
+ *
138
+ * @param {Transition} transition
139
+ *
140
+ * @returns {{propertyStyle: string, transitionStyle: string, classes: string}}
141
+ */
142
+ export function transitionCssDuring(transition) {
143
+ expect.objectNoArray(transition);
144
+
145
+ let {
146
+ type,
147
+ // @ts-ignore
148
+ property,
149
+ to,
150
+ delay = 0,
151
+ duration = 1000,
152
+ timing = 'ease'
153
+ } = transition;
154
+
155
+ let propertyStyle;
156
+ let transitionStyle;
157
+ let classes = '';
158
+
159
+ switch (type) {
160
+ case FADE_IN:
161
+ type = TRANSITION_CSS;
162
+ property = 'opacity';
163
+ to = to ?? '1';
164
+ break;
165
+
166
+ case FADE_OUT:
167
+ type = TRANSITION_CSS;
168
+ property = 'opacity';
169
+ to = to ?? '0';
170
+ break;
171
+ }
172
+
173
+ if (!type || TRANSITION_CSS === type) {
174
+ expect.notEmptyString(property);
175
+ expect.string(to);
176
+
177
+ propertyStyle = `${property}: ${to}`;
178
+
179
+ /* property name | duration | easing function | delay */
180
+ transitionStyle = `${property} ${duration}ms ${timing} ${delay}ms`;
181
+ } else {
182
+ throw new Error(`Unknown transition type [${type}]`);
183
+ }
184
+
185
+ // console.log('transitionCssDuring', { propertyStyle, transitionStyle });
186
+
187
+ return { propertyStyle, transitionStyle, classes };
188
+ }
@@ -5,7 +5,7 @@
5
5
  getRootCssDesignHeight,
6
6
  getClampParams,
7
7
  clamp
8
- } from '../../../util/design-system/index.js';
8
+ } from '../../util/design-system/index.js';
9
9
 
10
10
  /**
11
11
  * Virtual viewport component that creates a container with its own scaling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
@@ -1,26 +0,0 @@
1
- export default ScaleControl;
2
- type ScaleControl = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string;
8
- };
9
- declare const ScaleControl: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
- $$bindings?: Bindings;
17
- } & Exports;
18
- (internal: unknown, props: {
19
- $$events?: Events;
20
- $$slots?: Slots;
21
- }): Exports & {
22
- $set?: any;
23
- $on?: any;
24
- };
25
- z_$$bindings?: Bindings;
26
- }
@@ -1 +0,0 @@
1
- export { default as ScaleControl } from "./ScaleControl.svelte";
@@ -1 +0,0 @@
1
- export { default as ScaleControl } from './ScaleControl.svelte';