@hkdigital/lib-sveltekit 0.1.45 → 0.1.46
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/README.md
CHANGED
@@ -11,6 +11,10 @@ It contains common code and components that we use to create our projects.
|
|
11
11
|
This package is incomplete and not fully tested.
|
12
12
|
Do not use in production environments yet.
|
13
13
|
|
14
|
+
### TODO
|
15
|
+
|
16
|
+
Add information about Skeleton, theming and imagetools
|
17
|
+
|
14
18
|
## A note about tailwindcss
|
15
19
|
|
16
20
|
Components in this package use [tailwindcss](https://tailwindcss.com/).
|
@@ -46,7 +50,7 @@ We use a wildcard to upgrade all installed `node_modules` in the scope `@hkdigit
|
|
46
50
|
You can also add this command to your project. To do so, add the lines to the bottom of the `scripts` section of your `package.json`.
|
47
51
|
|
48
52
|
```bash
|
49
|
-
"upgrade:
|
53
|
+
"upgrade:hk": "ncu --dep dev,optional,peer,prod '@hkdigital/*' -u && pnpm install",
|
50
54
|
"upgrade:all": "ncu -u && pnpm install"
|
51
55
|
```
|
52
56
|
|
@@ -83,7 +87,7 @@ export default {
|
|
83
87
|
'./src/**/*.{html,js,svelte,ts}',
|
84
88
|
```
|
85
89
|
|
86
|
-
## Building the
|
90
|
+
## Building the library
|
87
91
|
|
88
92
|
To build your library:
|
89
93
|
|
@@ -91,6 +95,8 @@ To build your library:
|
|
91
95
|
npm run package
|
92
96
|
```
|
93
97
|
|
98
|
+
## Building the showcase app
|
99
|
+
|
94
100
|
To create a production version of your showcase app:
|
95
101
|
|
96
102
|
```bash
|
@@ -68,6 +68,6 @@ export class PresenterState {
|
|
68
68
|
export type Slide = import("./typedef").Slide;
|
69
69
|
export type Transition = import("./typedef").Transition;
|
70
70
|
export type Layer = import("./typedef").Layer;
|
71
|
-
export type PresenterRef = import("./typedef").
|
72
|
-
export type LoadController = import("./typedef").
|
71
|
+
export type PresenterRef = import("./typedef").PresenterRef;
|
72
|
+
export type LoadController = import("./typedef").LoadController;
|
73
73
|
import { HkPromise } from '../../classes/promise/index.js';
|
@@ -21,11 +21,11 @@ import { STAGE_BEFORE, STAGE_SHOW } from './constants.js';
|
|
21
21
|
*/
|
22
22
|
|
23
23
|
/**
|
24
|
-
* @typedef {import("./typedef").
|
24
|
+
* @typedef {import("./typedef").PresenterRef} PresenterRef
|
25
25
|
*/
|
26
26
|
|
27
27
|
/**
|
28
|
-
* @typedef {import("./typedef").
|
28
|
+
* @typedef {import("./typedef").LoadController} LoadController
|
29
29
|
*/
|
30
30
|
|
31
31
|
const Z_BACK = 0;
|
@@ -589,7 +589,7 @@ export class PresenterState {
|
|
589
589
|
this.onBeforeListeners.delete(key);
|
590
590
|
};
|
591
591
|
},
|
592
|
-
|
592
|
+
onShow: (callback) => {
|
593
593
|
const key = Symbol();
|
594
594
|
this.onShowListeners.set(key, callback);
|
595
595
|
|
@@ -25,10 +25,6 @@ export type FadeOutTransition = {
|
|
25
25
|
duration?: number;
|
26
26
|
timing?: string;
|
27
27
|
};
|
28
|
-
export type ListenerParams = {
|
29
|
-
stage: string;
|
30
|
-
slideName: string;
|
31
|
-
};
|
32
28
|
export type LoadController = {
|
33
29
|
/**
|
34
30
|
* - Function to call when loading is complete
|
@@ -39,6 +35,12 @@ export type LoadController = {
|
|
39
35
|
*/
|
40
36
|
cancel: () => void;
|
41
37
|
};
|
38
|
+
export type ListenerParams = {
|
39
|
+
stage: string;
|
40
|
+
slideName: string;
|
41
|
+
};
|
42
|
+
export type ListenerCallback = (params: ListenerParams) => () => void;
|
43
|
+
export type UnregisterFn = () => void;
|
42
44
|
export type PresenterRef = {
|
43
45
|
/**
|
44
46
|
* - Navigate to a slide by name
|
@@ -48,7 +50,14 @@ export type PresenterRef = {
|
|
48
50
|
* - Get the current slide name
|
49
51
|
*/
|
50
52
|
getCurrentSlideName: () => string;
|
51
|
-
|
53
|
+
/**
|
54
|
+
* Register listener that is called when a slide enters state 'before'
|
55
|
+
*/
|
56
|
+
onBefore: (callback: ListenerCallback) => UnregisterFn;
|
57
|
+
/**
|
58
|
+
* Register listener that is called when a slide enters state 'show'
|
59
|
+
*/
|
60
|
+
onShow: (callback: ListenerCallback) => UnregisterFn;
|
52
61
|
};
|
53
62
|
export type Transition = CssTransition | FadeInTransition | FadeOutTransition;
|
54
63
|
export type SlideData = {
|
@@ -32,6 +32,12 @@
|
|
32
32
|
* }} FadeOutTransition
|
33
33
|
*/
|
34
34
|
|
35
|
+
/**
|
36
|
+
* @typedef {Object} LoadController
|
37
|
+
* @property {() => void} loaded - Function to call when loading is complete
|
38
|
+
* @property {() => void} cancel - Function to return to the previous slide
|
39
|
+
*/
|
40
|
+
|
35
41
|
/**
|
36
42
|
* @typedef {{
|
37
43
|
* stage: string,
|
@@ -40,16 +46,21 @@
|
|
40
46
|
*/
|
41
47
|
|
42
48
|
/**
|
43
|
-
* @typedef {
|
44
|
-
|
45
|
-
|
49
|
+
* @typedef {( params: ListenerParams) => () => void } ListenerCallback
|
50
|
+
*/
|
51
|
+
|
52
|
+
/**
|
53
|
+
* @typedef {() => void } UnregisterFn
|
46
54
|
*/
|
47
55
|
|
48
56
|
/**
|
49
57
|
* @typedef {Object} PresenterRef
|
50
58
|
* @property {(name: string) => void} gotoSlide - Navigate to a slide by name
|
51
59
|
* @property {() => string} getCurrentSlideName - Get the current slide name
|
52
|
-
* @property {(callback)=>
|
60
|
+
* @property {( callback: ListenerCallback ) => UnregisterFn} onBefore
|
61
|
+
* Register listener that is called when a slide enters state 'before'
|
62
|
+
* @property {( callback: ListenerCallback ) => UnregisterFn} onShow
|
63
|
+
* Register listener that is called when a slide enters state 'show'
|
53
64
|
*/
|
54
65
|
|
55
66
|
/**
|