@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,553 @@
1
+ import { defineStateContext } from '../../util/svelte/state-context/index.js';
2
+
3
+ import { findFirst } from '../../util/array/index.js';
4
+
5
+ import { untrack } from 'svelte';
6
+
7
+ import { HkPromise } from '../../classes/promise/index.js';
8
+
9
+ /* ----------------------------------------------------------------- typedefs */
10
+
11
+ /**
12
+ * @typedef {import("./typedef").Slide} Slide
13
+ */
14
+
15
+ /**
16
+ * @typedef {import("./typedef").Transition} Transition
17
+ */
18
+
19
+ /**
20
+ * @typedef {import("./typedef").Layer} Layer
21
+ */
22
+
23
+ /**
24
+ * @typedef {Object} LoadController
25
+ * @property {() => void} loaded - Function to call when loading is complete
26
+ * @property {() => void} cancel - Function to return to the previous slide
27
+ */
28
+
29
+ /**
30
+ * @typedef {Object} PresenterRef
31
+ * @property {(name: string) => void} gotoSlide - Navigate to a slide by name
32
+ * @property {() => string} getCurrentSlideName - Get the current slide name
33
+ */
34
+
35
+ /* -------------------------------------------------------------- Constants */
36
+
37
+ const Z_BACK = 0;
38
+ const Z_FRONT = 10;
39
+
40
+ const LABEL_A = 'A';
41
+ const LABEL_B = 'B';
42
+
43
+ /* ------------------------------------------------------- Define state class */
44
+
45
+ export class PresenterState {
46
+ /** @type {Slide[]} */
47
+ slides = $state.raw([]);
48
+
49
+ /** @type {Layer} */
50
+ layerA = $state.raw({ z: Z_BACK, visible: false, stageIdle: true });
51
+
52
+ /** @type {Layer} */
53
+ layerB = $state.raw({ z: Z_FRONT, visible: false, stageIdle: true });
54
+
55
+ /** @type {Slide|null} */
56
+ slideA = $state.raw(null);
57
+
58
+ /** @type {Slide|null} */
59
+ slideB = $state.raw(null);
60
+
61
+ /** @type {string} */
62
+ currentLayerLabel = $state(LABEL_B);
63
+
64
+ /** @type {string} */
65
+ nextLayerLabel = $state(LABEL_A);
66
+
67
+ /** @type {HkPromise[]} */
68
+ transitionPromises = $state.raw([]);
69
+
70
+ /** @type {boolean} */
71
+ isSlideLoading = $state(false);
72
+
73
+ /** @type {boolean} */
74
+ controllerRequested = $state(false);
75
+
76
+ /** @type {number} Loading timeout in milliseconds (0 = disabled) */
77
+ loadingTimeout = $state(1000);
78
+
79
+ /** @type {boolean} */
80
+ busy = $derived.by(() => {
81
+ const { layerA, layerB } = this;
82
+ const layerAStable =
83
+ layerA.stageShow || layerA.stageAfter || layerA.stageIdle;
84
+ const layerBStable =
85
+ layerB.stageShow || layerB.stageAfter || layerB.stageIdle;
86
+
87
+ return !(layerAStable && layerBStable);
88
+ });
89
+
90
+ /** @type {string} */
91
+ currentSlideName = $derived.by(() => {
92
+ const currentSlide = this.#getSlide(this.currentLayerLabel);
93
+ return currentSlide?.name || '';
94
+ });
95
+
96
+ /**
97
+ * Initialize the presenter state and set up reactivity
98
+ */
99
+ constructor() {
100
+ this.#setupStageTransitions();
101
+ this.#setupTransitionTracking();
102
+ this.#setupLoadingTransitions();
103
+ }
104
+
105
+ /**
106
+ * Returns a simplified presenter reference with essential methods
107
+ * for slide components to use
108
+ *
109
+ * @returns {PresenterRef} A reference object with presenter methods
110
+ */
111
+ getPresenterRef() {
112
+ return {
113
+ gotoSlide: (name) => this.gotoSlide(name),
114
+ getCurrentSlideName: () => this.currentSlideName
115
+ };
116
+ }
117
+
118
+ /**
119
+ * Set up reactivity for stage transitions between the before/after states
120
+ * This handles the animation timing for both layers
121
+ */
122
+ #setupStageTransitions() {
123
+ // Handle layer A stage transitions
124
+ $effect(() => {
125
+ if (this.layerA.stageBeforeIn || this.layerA.stageBeforeOut) {
126
+ this.layerA = this.#processStageTransition(this.layerA);
127
+ }
128
+ });
129
+
130
+ // Handle layer B stage transitions
131
+ $effect(() => {
132
+ if (this.layerB.stageBeforeIn || this.layerB.stageBeforeOut) {
133
+ this.layerB = this.#processStageTransition(this.layerB);
134
+ }
135
+ });
136
+ }
137
+
138
+ /**
139
+ * Process a single stage transition for a layer
140
+ *
141
+ * @param {Layer} layer - The layer to process
142
+ * @returns {Layer} - The updated layer with new stage
143
+ */
144
+ #processStageTransition(layer) {
145
+ const updatedLayer = { ...layer };
146
+
147
+ if (updatedLayer.stageBeforeIn) {
148
+ delete updatedLayer.stageBeforeIn;
149
+ updatedLayer.stageIn = true;
150
+ } else if (updatedLayer.stageBeforeOut) {
151
+ delete updatedLayer.stageBeforeOut;
152
+ updatedLayer.stageOut = true;
153
+ }
154
+
155
+ return updatedLayer;
156
+ }
157
+
158
+ /**
159
+ * Set up reactivity for tracking transition promises
160
+ * This handles the completion of animations and layer swapping
161
+ */
162
+ #setupTransitionTracking() {
163
+ $effect(() => {
164
+ const promises = this.transitionPromises;
165
+
166
+ if (promises.length > 0) {
167
+ const nextSlide = this.#getSlide(this.nextLayerLabel);
168
+
169
+ if (!nextSlide) {
170
+ return;
171
+ }
172
+
173
+ untrack(() => {
174
+ this.#executeTransition(promises);
175
+ });
176
+ }
177
+ });
178
+ }
179
+
180
+ /**
181
+ * Set up reactivity to start transitions after component loading is complete
182
+ */
183
+ #setupLoadingTransitions() {
184
+ $effect(() => {
185
+ // Only start transitions when loading is complete and we have a next slide
186
+ if (!this.isSlideLoading && this.#getSlide(this.nextLayerLabel)) {
187
+ const currentSlide = this.#getSlide(this.currentLayerLabel);
188
+ const nextSlide = this.#getSlide(this.nextLayerLabel);
189
+
190
+ // Prepare the next layer for its entrance transition
191
+ this.#updateLayer(this.nextLayerLabel, {
192
+ z: Z_FRONT,
193
+ visible: true,
194
+ stageBeforeIn: true,
195
+ transitions: nextSlide?.intro ?? []
196
+ });
197
+
198
+ // Prepare the current layer for its exit transition
199
+ this.#updateLayer(this.currentLayerLabel, {
200
+ z: Z_BACK,
201
+ visible: true,
202
+ stageBeforeOut: true,
203
+ transitions: currentSlide?.outro ?? []
204
+ });
205
+
206
+ // Start transitions
207
+ this.#applyTransitions();
208
+ }
209
+ });
210
+ }
211
+
212
+ /**
213
+ * Execute the transition by waiting for all promises and then
214
+ * completing the transition
215
+ *
216
+ * @param {HkPromise[]} promises - Array of transition promises to wait for
217
+ */
218
+ async #executeTransition(promises) {
219
+ try {
220
+ await Promise.allSettled(promises);
221
+
222
+ untrack(() => {
223
+ this.#completeTransition();
224
+ });
225
+ } catch (error) {
226
+ console.log('transition promises cancelled', error);
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Complete the transition by updating layers and swapping them
232
+ */
233
+ #completeTransition() {
234
+ // Hide current layer and set stage to AFTER
235
+ this.#updateLayer(this.currentLayerLabel, {
236
+ z: Z_BACK,
237
+ visible: false,
238
+ stageAfter: true
239
+ });
240
+
241
+ // Set next layer stage to SHOW
242
+ this.#updateLayer(this.nextLayerLabel, {
243
+ z: Z_FRONT,
244
+ visible: true,
245
+ stageShow: true
246
+ });
247
+
248
+ // Remove slide from current layer
249
+ this.#updateSlide(this.currentLayerLabel, null);
250
+
251
+ // Swap current and next layer labels
252
+ this.#swapLayers();
253
+ }
254
+
255
+ /**
256
+ * Swap the current and next layer labels
257
+ */
258
+ #swapLayers() {
259
+ if (this.currentLayerLabel === LABEL_A) {
260
+ this.currentLayerLabel = LABEL_B;
261
+ this.nextLayerLabel = LABEL_A;
262
+ } else {
263
+ this.currentLayerLabel = LABEL_A;
264
+ this.nextLayerLabel = LABEL_B;
265
+ }
266
+ }
267
+
268
+ /**
269
+ * Mark the slide as loaded, which triggers transitions to begin
270
+ */
271
+ finishSlideLoading() {
272
+ this.isSlideLoading = false;
273
+ }
274
+
275
+ /**
276
+ * Returns a controller object for managing manual loading
277
+ * Components can use this to signal when they're done loading
278
+ * or to cancel and go back to the previous slide
279
+ *
280
+ * @returns {LoadController} Object with loaded() and cancel() methods
281
+ */
282
+ getLoadingController() {
283
+ // Mark that the controller was requested
284
+ this.controllerRequested = true;
285
+
286
+ return {
287
+ /**
288
+ * Call when component has finished loading
289
+ */
290
+ loaded: () => {
291
+ this.finishSlideLoading();
292
+ },
293
+
294
+ /**
295
+ * Call to cancel loading and return to previous slide
296
+ */
297
+ cancel: () => {
298
+ // Return to previous slide if available
299
+ const currentSlideName = this.currentSlideName;
300
+ if (currentSlideName) {
301
+ this.gotoSlide(currentSlideName);
302
+ } else if (this.slides.length > 0) {
303
+ // Fallback to first slide if no current slide
304
+ this.gotoSlide(this.slides[0].name);
305
+ }
306
+ }
307
+ };
308
+ }
309
+
310
+ /**
311
+ * Configure the presentation
312
+ *
313
+ * @param {object} _
314
+ * @param {boolean} [_.autostart=false] - Whether to start automatically
315
+ * @param {string} [_.startSlide] - Name of the slide to start with
316
+ * @param {Slide[]} [_.slides] - Array of slides for the presentation
317
+ */
318
+ configure({ slides, autostart = true, startSlide }) {
319
+ untrack(() => {
320
+ if (slides) {
321
+ // Only update slides if provided
322
+ this.slides = slides;
323
+ }
324
+
325
+ if ((autostart || startSlide) && this.slides?.length) {
326
+ if (startSlide) {
327
+ this.gotoSlide(startSlide);
328
+ } else {
329
+ this.#gotoSlide(this.slides[0]);
330
+ }
331
+ }
332
+ });
333
+ }
334
+
335
+ /**
336
+ * Configure the presentation slides
337
+ *
338
+ * @param {Slide[]} slides - Array of slides for the presentation
339
+ */
340
+ configureSlides(slides) {
341
+ this.slides = slides ?? [];
342
+ }
343
+
344
+ /**
345
+ * Transition to another slide by name
346
+ *
347
+ * @param {string} name - Name of the slide to transition to
348
+ */
349
+ async gotoSlide(name) {
350
+ untrack(() => {
351
+ const slide = findFirst(this.slides, { name });
352
+
353
+ if (!slide) {
354
+ console.log('available slides', this.slides);
355
+ throw new Error(`Slide [${name}] has not been defined`);
356
+ }
357
+
358
+ this.#gotoSlide(slide);
359
+ });
360
+ }
361
+
362
+ /**
363
+ * Internal method to transition to another slide
364
+ *
365
+ * @param {Slide} slide - The slide to transition to
366
+ */
367
+ async #gotoSlide(slide) {
368
+ if (this.busy) {
369
+ throw new Error('Transition in progress');
370
+ }
371
+
372
+ // Reset controller requested flag
373
+ this.controllerRequested = false;
374
+
375
+ // Set loading state to true before starting transition
376
+ this.isSlideLoading = true;
377
+
378
+ // Add controller function to slide props if it has a component
379
+ if (slide.data?.component) {
380
+ // Get a presenter reference to pass to the slide
381
+ const presenterRef = this.getPresenterRef();
382
+
383
+ // Create a copy of the slide to avoid mutating the original
384
+ const slideWithExtras = {
385
+ ...slide,
386
+ data: {
387
+ ...slide.data,
388
+ props: {
389
+ ...(slide.data.props || {}),
390
+ getLoadingController: () => this.getLoadingController(),
391
+ presenter: presenterRef // Add presenter reference to props
392
+ }
393
+ }
394
+ };
395
+
396
+ // Add next slide to next layer with controller and presenter included
397
+ this.#updateSlide(this.nextLayerLabel, slideWithExtras);
398
+
399
+ // If a timeout is configured, automatically finish loading after delay
400
+ if (this.loadingTimeout > 0) {
401
+ setTimeout(() => {
402
+ // Only auto-finish if the controller wasn't requested
403
+ if (!this.controllerRequested && this.isSlideLoading) {
404
+ // console.debug(
405
+ // `Slide '${slide.name}' didn't request loading controller, auto-finishing.`
406
+ // );
407
+ this.finishSlideLoading();
408
+ }
409
+ }, this.loadingTimeout);
410
+ }
411
+ } else {
412
+ // No component, so just use the slide as is
413
+ this.#updateSlide(this.nextLayerLabel, slide);
414
+ // No component to load, so finish loading immediately
415
+ this.finishSlideLoading();
416
+ }
417
+
418
+ // Make next layer visible, move to front
419
+ this.#updateLayer(this.nextLayerLabel, {
420
+ z: Z_FRONT,
421
+ visible: true
422
+ });
423
+ }
424
+
425
+ /**
426
+ * Apply transitions between current and next slide
427
+ */
428
+ #applyTransitions() {
429
+ // Cancel existing transitions
430
+ let transitionPromises = this.transitionPromises;
431
+
432
+ for (const current of transitionPromises) {
433
+ current.tryCancel();
434
+ }
435
+
436
+ // Start new transitions
437
+ transitionPromises = [];
438
+
439
+ const currentSlide = this.#getSlide(this.currentLayerLabel);
440
+ const nextSlide = this.#getSlide(this.nextLayerLabel);
441
+
442
+ // Apply transitions `out` from currentslide
443
+ const transitionsOut = currentSlide?.outro;
444
+
445
+ if (transitionsOut) {
446
+ for (const transition of transitionsOut) {
447
+ const promise = this.#applyTransition(transition);
448
+ transitionPromises.push(promise);
449
+ }
450
+ }
451
+
452
+ // Apply transitions `in` from next slide
453
+ const transitionsIn = nextSlide?.intro;
454
+
455
+ if (transitionsIn) {
456
+ for (const transition of transitionsIn) {
457
+ const promise = this.#applyTransition(transition);
458
+ transitionPromises.push(promise);
459
+ }
460
+ }
461
+
462
+ this.transitionPromises = transitionPromises;
463
+ }
464
+
465
+ /**
466
+ * Apply a transition and return a transition promise
467
+ *
468
+ * @param {Transition} transition - The transition to apply
469
+ * @returns {HkPromise} Promise that resolves when transition completes
470
+ */
471
+ #applyTransition(transition) {
472
+ const delay = (transition.delay ?? 0) + (transition.duration ?? 0);
473
+
474
+ if (0 === delay) {
475
+ const promise = new HkPromise(() => {});
476
+ promise.resolve(true);
477
+ return promise;
478
+ }
479
+
480
+ let promise = new HkPromise((/** @type {function} */ resolve) => {
481
+ if (delay) {
482
+ setTimeout(() => {
483
+ resolve(true);
484
+ }, delay);
485
+ }
486
+ });
487
+
488
+ return promise;
489
+ }
490
+
491
+ /**
492
+ * Get slide by layer label
493
+ *
494
+ * @param {string} label - Layer label (A or B)
495
+ * @returns {Slide|null} The slide for the specified layer or null
496
+ */
497
+ #getSlide(label) {
498
+ if (label === LABEL_A) {
499
+ return this.slideA;
500
+ }
501
+
502
+ if (label === LABEL_B) {
503
+ return this.slideB;
504
+ }
505
+
506
+ return null;
507
+ }
508
+
509
+ /**
510
+ * Update layer by label
511
+ *
512
+ * @param {string} label - Layer label (A or B)
513
+ * @param {Layer} data - Layer data to update
514
+ */
515
+ #updateLayer(label, data) {
516
+ if (label === LABEL_A) {
517
+ this.layerA = data;
518
+ return;
519
+ }
520
+
521
+ if (label === LABEL_B) {
522
+ this.layerB = data;
523
+ return;
524
+ }
525
+
526
+ throw new Error(`Missing layer [${label}]`);
527
+ }
528
+
529
+ /**
530
+ * Update slide by label
531
+ *
532
+ * @param {string} label - Layer label (A or B)
533
+ * @param {Slide|null} data - Slide data to update or null to clear
534
+ */
535
+ #updateSlide(label, data) {
536
+ if (label === LABEL_A) {
537
+ this.slideA = data;
538
+ return;
539
+ }
540
+
541
+ if (label === LABEL_B) {
542
+ this.slideB = data;
543
+ return;
544
+ }
545
+
546
+ throw new Error(`Missing slide [${label}]`);
547
+ }
548
+ }
549
+
550
+ /* -------------------------------------- Export create & get state functions */
551
+
552
+ export const [createOrGetState, createState, getState] =
553
+ defineStateContext(PresenterState);
@@ -0,0 +1,125 @@
1
+ <script>
2
+ /* ---------------------------------------------------------------- Imports */
3
+
4
+ import { GridLayers } from '../../components/layout/index.js';
5
+
6
+ import { createOrGetPresenterState } from './index.js';
7
+ import { cssBefore, cssDuring } from './util.js';
8
+
9
+ /* ------------------------------------------------------------------ Props */
10
+
11
+ /**
12
+ * @typedef {import("./typedef.js").Slide} Slide
13
+ */
14
+
15
+ /**
16
+ * @typedef {import("./typedef.js").Layer} Layer
17
+ */
18
+
19
+ /**
20
+ * @type {{
21
+ * classes?: string,
22
+ * slides?: import("./typedef.js").Slide[],
23
+ * autostart?: boolean,
24
+ * startSlide?: string,
25
+ * instanceKey?: Symbol | string,
26
+ * layoutSnippet: import('svelte').Snippet<[Slide|null, Layer]>
27
+ * }}
28
+ */
29
+ let {
30
+ // > Style
31
+ classes,
32
+
33
+ // > Functional
34
+ slides,
35
+ autostart = false,
36
+ startSlide,
37
+
38
+ // State
39
+ instanceKey,
40
+
41
+ // Snippets
42
+ layoutSnippet
43
+ } = $props();
44
+
45
+ /* ------------------------------------------------------------------ State */
46
+
47
+ const presenter = createOrGetPresenterState(instanceKey);
48
+
49
+ $effect.pre(() => {
50
+ // Configure presenter with slides if provided
51
+ presenter.configure({ slides, autostart, startSlide });
52
+ });
53
+
54
+ let classesA = $state('');
55
+ let classesB = $state('');
56
+
57
+ let stylesA = $state('');
58
+ let stylesB = $state('');
59
+
60
+ //> Apply stage classes and styles
61
+
62
+ $effect(() => {
63
+ // > layerA
64
+
65
+ const { stageBeforeIn, stageIn, stageBeforeOut, stageOut, transitions } =
66
+ presenter.layerA;
67
+
68
+ if (transitions && transitions.length) {
69
+ if (stageBeforeIn || stageBeforeOut) {
70
+ ({ style: stylesA, classes: classesA } = cssBefore(transitions));
71
+ } else if (stageIn || stageOut) {
72
+ setTimeout(() => {
73
+ ({ style: stylesA, classes: classesA } = cssDuring(transitions));
74
+ });
75
+ }
76
+ } else {
77
+ stylesA = '';
78
+ classesA = '';
79
+ }
80
+ });
81
+
82
+ $effect(() => {
83
+ // > layerB
84
+
85
+ const { stageBeforeIn, stageIn, stageBeforeOut, stageOut, transitions } =
86
+ presenter.layerB;
87
+
88
+ if (transitions) {
89
+ if (stageBeforeIn || stageBeforeOut) {
90
+ ({ style: stylesB, classes: classesB } = cssBefore(transitions));
91
+ } else if (stageIn || stageOut) {
92
+ setTimeout(() => {
93
+ ({ style: stylesB, classes: classesB } = cssDuring(transitions));
94
+ });
95
+ }
96
+ } else {
97
+ stylesB = '';
98
+ classesB = '';
99
+ }
100
+ });
101
+ </script>
102
+
103
+ <GridLayers data-component="presenter" {classes}>
104
+ <div
105
+ style:z-index={presenter.layerA.z}
106
+ style:visibility={presenter.layerA.visible ? 'visible' : 'hidden'}
107
+ inert={presenter.busy}
108
+ class="justify-self-stretch self-stretch overflow-hidden"
109
+ >
110
+ <div class={classesA} style={stylesA}>
111
+ {@render layoutSnippet(presenter.slideA, presenter.layerA)}
112
+ </div>
113
+ </div>
114
+
115
+ <div
116
+ style:z-index={presenter.layerB.z}
117
+ style:visibility={presenter.layerB.visible ? 'visible' : 'hidden'}
118
+ inert={presenter.busy}
119
+ class="justify-self-stretch self-stretch overflow-hidden"
120
+ >
121
+ <div class={classesB} style={stylesB}>
122
+ {@render layoutSnippet(presenter.slideB, presenter.layerB)}
123
+ </div>
124
+ </div>
125
+ </GridLayers>
@@ -0,0 +1,20 @@
1
+ export default Presenter;
2
+ type Presenter = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<{
5
+ classes?: string;
6
+ slides?: Slide[];
7
+ autostart?: boolean;
8
+ startSlide?: string;
9
+ instanceKey?: string | Symbol;
10
+ layoutSnippet: Snippet<[Slide, Layer]>;
11
+ }>): void;
12
+ };
13
+ declare const Presenter: import("svelte").Component<{
14
+ classes?: string;
15
+ slides?: import("./typedef.js").Slide[];
16
+ autostart?: boolean;
17
+ startSlide?: string;
18
+ instanceKey?: Symbol | string;
19
+ layoutSnippet: import("svelte").Snippet<[import("./typedef.js").Slide | null, import("./typedef.js").Layer]>;
20
+ }, {}, "">;
@@ -0,0 +1,3 @@
1
+ export const TRANSITION_CSS: "css";
2
+ export const FADE_IN: "fade-in";
3
+ export const FADE_OUT: "fade-out";
@@ -0,0 +1,4 @@
1
+ export const TRANSITION_CSS = 'css';
2
+
3
+ export const FADE_IN = 'fade-in';
4
+ export const FADE_OUT = 'fade-out';
@@ -0,0 +1,6 @@
1
+ export { default as Presenter } from "./Presenter.svelte";
2
+ export { default as ImageSlide } from "./ImageSlide.svelte";
3
+ export * from "./typedef.js";
4
+ export * from "./constants.js";
5
+ export * from "./util.js";
6
+ export { PresenterState, createOrGetState as createOrGetPresenterState, createState as createPresenterState, getState as getPresenterState } from "./Presenter.state.svelte.js";