squiffy-runtime 7.0.0-beta.6 → 7.0.0-beta.8
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/dist/assets.d.ts +1 -0
- package/dist/classes.test.d.ts +1 -0
- package/dist/confirmDialog.d.ts +8 -0
- package/dist/events.d.ts +11 -0
- package/dist/every.d.ts +12 -0
- package/dist/every.test.d.ts +1 -0
- package/dist/paths.d.ts +15 -0
- package/dist/paths.test.d.ts +1 -0
- package/dist/playerSettings.d.ts +17 -0
- package/dist/preview-host.d.ts +2 -0
- package/dist/preview-host.js +10 -0
- package/dist/preview-host.js.map +2 -2
- package/dist/preview-html.js +1 -1
- package/dist/preview-protocol.d.ts +6 -0
- package/dist/settings.test.d.ts +1 -0
- package/dist/settingsDialog.d.ts +17 -0
- package/dist/skill.test.d.ts +1 -0
- package/dist/sound.d.ts +35 -0
- package/dist/sound.test.d.ts +1 -0
- package/dist/squiffy.page.css +14 -3
- package/dist/squiffy.preview.html +680 -82
- package/dist/squiffy.runtime.css +531 -1
- package/dist/squiffy.runtime.d.ts +5 -1
- package/dist/squiffy.runtime.global.js +117 -96
- package/dist/squiffy.runtime.global.js.map +1 -1
- package/dist/squiffy.runtime.js +5728 -4520
- package/dist/squiffy.runtime.js.map +1 -1
- package/dist/state.d.ts +4 -1
- package/dist/style.test.d.ts +1 -0
- package/dist/textProcessor.d.ts +16 -0
- package/dist/transitions.test.d.ts +1 -0
- package/dist/types.d.ts +54 -0
- package/dist/uiLinks.test.d.ts +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.test.d.ts +1 -0
- package/package.json +3 -3
- package/src/__snapshots__/squiffy.runtime.test.ts.snap +10 -10
- package/src/animation.test.ts +44 -0
- package/src/animation.ts +9 -5
- package/src/assets.test.ts +1 -3
- package/src/assets.ts +1 -1
- package/src/classes.test.ts +201 -0
- package/src/confirmDialog.ts +66 -0
- package/src/events.ts +18 -0
- package/src/every.test.ts +25 -0
- package/src/every.ts +94 -0
- package/src/panels.test.ts +24 -0
- package/src/paths.test.ts +66 -0
- package/src/paths.ts +155 -0
- package/src/playerSettings.ts +128 -0
- package/src/plugins/animate.ts +16 -3
- package/src/plugins/live.ts +10 -4
- package/src/plugins/plugins.test.ts +51 -6
- package/src/preview-host.test.ts +22 -0
- package/src/preview-host.ts +15 -0
- package/src/preview-protocol.ts +9 -1
- package/src/preview.test.ts +114 -3
- package/src/preview.ts +97 -3
- package/src/settings.test.ts +233 -0
- package/src/settingsDialog.ts +160 -0
- package/src/skill.test.ts +67 -0
- package/src/sound.test.ts +273 -0
- package/src/sound.ts +207 -0
- package/src/squiffy.page.css +14 -3
- package/src/squiffy.runtime.css +531 -1
- package/src/squiffy.runtime.test.ts +1130 -17
- package/src/squiffy.runtime.ts +600 -38
- package/src/state.ts +45 -10
- package/src/style.test.ts +89 -0
- package/src/textProcessor.ts +484 -35
- package/src/transitions.test.ts +302 -0
- package/src/types.ts +79 -0
- package/src/uiLinks.test.ts +156 -0
- package/src/updater.ts +26 -8
- package/src/utils.test.ts +60 -0
- package/src/utils.ts +44 -14
- package/dist/infixExpressions.d.ts +0 -6
- package/src/infixExpressions.test.ts +0 -379
- package/src/infixExpressions.ts +0 -488
- /package/dist/{infixExpressions.test.d.ts → animation.test.d.ts} +0 -0
|
@@ -29,6 +29,9 @@ export type HostMessage = {
|
|
|
29
29
|
} | {
|
|
30
30
|
type: "theme";
|
|
31
31
|
theme: PreviewTheme;
|
|
32
|
+
} | {
|
|
33
|
+
type: "muted";
|
|
34
|
+
muted: boolean;
|
|
32
35
|
};
|
|
33
36
|
export type PreviewMessage = {
|
|
34
37
|
type: "ready";
|
|
@@ -44,6 +47,9 @@ export type PreviewMessage = {
|
|
|
44
47
|
} | {
|
|
45
48
|
type: "canGoBackChanged";
|
|
46
49
|
canGoBack: boolean;
|
|
50
|
+
} | {
|
|
51
|
+
type: "usesSound";
|
|
52
|
+
usesSound: boolean;
|
|
47
53
|
} | {
|
|
48
54
|
type: "navigated";
|
|
49
55
|
section: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SquiffyApi } from './types.js';
|
|
2
|
+
export declare const SETTINGS_STRINGS: {
|
|
3
|
+
settings: string;
|
|
4
|
+
resetSettings: string;
|
|
5
|
+
close: string;
|
|
6
|
+
};
|
|
7
|
+
export interface SettingsDialogOptions {
|
|
8
|
+
strings?: Partial<Record<string, string>>;
|
|
9
|
+
container?: HTMLElement;
|
|
10
|
+
}
|
|
11
|
+
export interface SettingsDialog {
|
|
12
|
+
element: HTMLDialogElement;
|
|
13
|
+
open: () => void;
|
|
14
|
+
close: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const SETTINGS_ICON = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/></svg>";
|
|
17
|
+
export declare function createSettingsDialog(api: SquiffyApi, options?: SettingsDialogOptions): SettingsDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sound.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type AudioUrlResolver = (path: string) => string;
|
|
2
|
+
export interface SoundOptions {
|
|
3
|
+
resolveUrl: AudioUrlResolver;
|
|
4
|
+
getMusic: () => string | null;
|
|
5
|
+
mutedKey?: string;
|
|
6
|
+
onPlay?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_FADE = 1;
|
|
9
|
+
export declare class Sound {
|
|
10
|
+
private options;
|
|
11
|
+
private music;
|
|
12
|
+
private effects;
|
|
13
|
+
private preloaded;
|
|
14
|
+
private muted;
|
|
15
|
+
private waitingForGesture;
|
|
16
|
+
private disposed;
|
|
17
|
+
constructor(options: SoundOptions);
|
|
18
|
+
preload(files: string[]): void;
|
|
19
|
+
sync(fade?: number): void;
|
|
20
|
+
play(file: string, volume?: number): void;
|
|
21
|
+
stopSounds(): void;
|
|
22
|
+
isMuted(): boolean;
|
|
23
|
+
setMuted(muted: boolean): void;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
private newAudio;
|
|
26
|
+
private startMusic;
|
|
27
|
+
private playTrack;
|
|
28
|
+
private stopMusic;
|
|
29
|
+
private fade;
|
|
30
|
+
private readonly onGesture;
|
|
31
|
+
private waitForGesture;
|
|
32
|
+
private removeGestureListeners;
|
|
33
|
+
private readMuted;
|
|
34
|
+
private writeMuted;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/squiffy.page.css
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
{
|
|
5
5
|
/* The width of the story text */
|
|
6
6
|
--squiffy-max-width: 42rem;
|
|
7
|
-
/* The story's font. Charter,
|
|
8
|
-
--squiffy-font-family: Charter, "Bitstream Charter",
|
|
7
|
+
/* The story's font. Charter, or Georgia if the reader doesn't have it */
|
|
8
|
+
--squiffy-font-family: Charter, "Bitstream Charter", Georgia, serif;
|
|
9
9
|
/* The size of the story text. The header's buttons are smaller, and don't change with it */
|
|
10
10
|
--squiffy-font-size: 1.125rem;
|
|
11
11
|
/* The space between lines of text */
|
|
@@ -90,6 +90,14 @@ button#squiffy-theme[data-next="light"] .squiffy-icon-dark
|
|
|
90
90
|
display: none;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/* The mute button (#444), for a story with music or sounds. It shows a speaker, crossed out
|
|
94
|
+
when the story is muted. */
|
|
95
|
+
button#squiffy-mute.squiffy-muted .squiffy-icon-sound,
|
|
96
|
+
button#squiffy-mute:not(.squiffy-muted) .squiffy-icon-muted
|
|
97
|
+
{
|
|
98
|
+
display: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
/* With a side panel (squiffy.json's "panels"), the page is wider, with the panel to the right of
|
|
94
102
|
the story. It stays in view as the story scrolls, under the header. On a narrower screen, it's a
|
|
95
103
|
button in the header instead. */
|
|
@@ -109,7 +117,10 @@ button#squiffy-theme[data-next="light"] .squiffy-icon-dark
|
|
|
109
117
|
grid-column: 1 / -1;
|
|
110
118
|
}
|
|
111
119
|
|
|
112
|
-
|
|
120
|
+
/* :where() takes the container's id out of the selector's specificity, so a story's own
|
|
121
|
+
aside.squiffy-panels-side { ... } rule, which comes after this, changes the border and the
|
|
122
|
+
padding too */
|
|
123
|
+
:where(div#squiffy-container.squiffy-has-side) > aside.squiffy-panels-side
|
|
113
124
|
{
|
|
114
125
|
position: sticky;
|
|
115
126
|
top: 3.5rem;
|