squiffy-runtime 6.0.1 → 7.0.0-beta.2
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 +2 -0
- package/dist/assets.test.d.ts +1 -0
- package/dist/events.d.ts +4 -0
- package/dist/pluginManager.d.ts +2 -1
- package/dist/preview-host.d.ts +30 -0
- package/dist/preview-host.js +89 -0
- package/dist/preview-host.js.map +7 -0
- package/dist/preview-host.test.d.ts +1 -0
- package/dist/preview-html.d.ts +2 -0
- package/dist/preview-html.js +2 -0
- package/dist/preview-protocol.d.ts +57 -0
- package/dist/preview.d.ts +14 -0
- package/dist/preview.main.d.ts +1 -0
- package/dist/preview.test.d.ts +1 -0
- package/dist/squiffy.page.css +120 -0
- package/dist/squiffy.preview.html +477 -0
- package/dist/squiffy.runtime.css +76 -20
- package/dist/squiffy.runtime.global.js +62 -57
- package/dist/squiffy.runtime.global.js.map +1 -1
- package/dist/squiffy.runtime.js +3146 -3069
- package/dist/squiffy.runtime.js.map +1 -1
- package/dist/types.d.ts +12 -1
- package/dist/types.plugins.d.ts +1 -0
- package/package.json +22 -11
- package/src/assets.test.ts +227 -0
- package/src/assets.ts +92 -0
- package/src/events.ts +1 -0
- package/src/pluginManager.ts +5 -1
- package/src/plugins/animate.ts +6 -5
- package/src/preview-host.test.ts +92 -0
- package/src/preview-host.ts +138 -0
- package/src/preview-protocol.ts +63 -0
- package/src/preview.main.ts +33 -0
- package/src/preview.test.ts +181 -0
- package/src/preview.ts +171 -0
- package/src/squiffy.page.css +120 -0
- package/src/squiffy.runtime.css +76 -20
- package/src/squiffy.runtime.ts +25 -6
- package/src/types.plugins.ts +4 -0
- package/src/types.ts +17 -1
- package/vite.config.ts +3 -4
- package/vite.preview.config.ts +76 -0
package/dist/squiffy.runtime.css
CHANGED
|
@@ -1,15 +1,49 @@
|
|
|
1
|
-
/* Core Squiffy Runtime Styles */
|
|
1
|
+
/* Core Squiffy Runtime Styles. See https://squiffystory.com/styling/ for how to customise these. */
|
|
2
|
+
|
|
3
|
+
/* Colours. Each has a light and a dark value, and light-dark() picks one from the page's
|
|
4
|
+
color-scheme. This file doesn't set color-scheme itself, so a story embedded in a page stays
|
|
5
|
+
light unless the page opts in to dark mode. The exported story's page (squiffy.page.css) sets
|
|
6
|
+
"color-scheme: light dark", so it follows the reader's system setting. */
|
|
7
|
+
:root
|
|
8
|
+
{
|
|
9
|
+
--squiffy-text: light-dark(#1f2328, #e4e4e7);
|
|
10
|
+
--squiffy-background: light-dark(#ffffff, #18181b);
|
|
11
|
+
/* Secondary text: the Restart button, and links waiting for valid input */
|
|
12
|
+
--squiffy-muted: light-dark(#6b6f76, #9a9ca3);
|
|
13
|
+
/* The lines between sections */
|
|
14
|
+
--squiffy-border: light-dark(#e2e2e6, #34343a);
|
|
15
|
+
--squiffy-link: light-dark(#1d5fd6, #7aa7ff);
|
|
16
|
+
--squiffy-link-hover: light-dark(#0f3f99, #b0cbff);
|
|
17
|
+
--squiffy-error: light-dark(#c62828, #ff7b72);
|
|
18
|
+
--squiffy-success: light-dark(#2e7d32, #6cc070);
|
|
19
|
+
}
|
|
2
20
|
|
|
3
21
|
/* Link styles */
|
|
4
22
|
a.squiffy-link
|
|
5
23
|
{
|
|
24
|
+
color: var(--squiffy-link);
|
|
6
25
|
text-decoration: underline;
|
|
7
|
-
text-decoration-color:
|
|
8
|
-
|
|
26
|
+
text-decoration-color: currentColor;
|
|
27
|
+
text-decoration-thickness: from-font;
|
|
28
|
+
text-underline-offset: 0.15em;
|
|
9
29
|
cursor: pointer;
|
|
10
30
|
transition: color 0.4s ease-in-out, text-decoration-color 0.4s ease-in-out;
|
|
11
31
|
}
|
|
12
32
|
|
|
33
|
+
a.squiffy-link:hover
|
|
34
|
+
{
|
|
35
|
+
color: var(--squiffy-link-hover);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
a.squiffy-link:focus-visible,
|
|
39
|
+
button.squiffy-header-button:focus-visible,
|
|
40
|
+
.squiffy-continue:focus-visible
|
|
41
|
+
{
|
|
42
|
+
outline: 2px solid var(--squiffy-link);
|
|
43
|
+
outline-offset: 2px;
|
|
44
|
+
border-radius: 2px;
|
|
45
|
+
}
|
|
46
|
+
|
|
13
47
|
/* Rotate/sequence links - visually distinct as they update in-place rather than advancing the story */
|
|
14
48
|
a.squiffy-link[data-handler="rotate"],
|
|
15
49
|
a.squiffy-link[data-handler="sequence"] {
|
|
@@ -33,10 +67,9 @@ a.squiffy-link.validation-disabled
|
|
|
33
67
|
{
|
|
34
68
|
text-decoration: inherit;
|
|
35
69
|
text-decoration-color: transparent;
|
|
36
|
-
color:
|
|
70
|
+
color: var(--squiffy-muted) !important;
|
|
37
71
|
cursor: not-allowed;
|
|
38
72
|
pointer-events: none;
|
|
39
|
-
opacity: 0.6;
|
|
40
73
|
}
|
|
41
74
|
|
|
42
75
|
/* Invalid input field states */
|
|
@@ -44,8 +77,8 @@ input.squiffy-invalid,
|
|
|
44
77
|
textarea.squiffy-invalid,
|
|
45
78
|
select.squiffy-invalid
|
|
46
79
|
{
|
|
47
|
-
border-color:
|
|
48
|
-
box-shadow: 0 0 0 0.2rem
|
|
80
|
+
border-color: var(--squiffy-error) !important;
|
|
81
|
+
box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--squiffy-error) 25%, transparent);
|
|
49
82
|
}
|
|
50
83
|
|
|
51
84
|
/* Valid input field states (optional, provides positive feedback) */
|
|
@@ -53,7 +86,7 @@ input:not([disabled]):valid,
|
|
|
53
86
|
textarea:not([disabled]):valid,
|
|
54
87
|
select:not([disabled]):valid
|
|
55
88
|
{
|
|
56
|
-
border-color:
|
|
89
|
+
border-color: var(--squiffy-success);
|
|
57
90
|
}
|
|
58
91
|
|
|
59
92
|
/* Focus state for invalid inputs */
|
|
@@ -62,19 +95,29 @@ textarea.squiffy-invalid:focus,
|
|
|
62
95
|
select.squiffy-invalid:focus
|
|
63
96
|
{
|
|
64
97
|
outline: none;
|
|
65
|
-
border-color:
|
|
66
|
-
box-shadow: 0 0 0 0.2rem
|
|
98
|
+
border-color: var(--squiffy-error) !important;
|
|
99
|
+
box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--squiffy-error) 50%, transparent);
|
|
67
100
|
}
|
|
68
101
|
|
|
69
|
-
/* Header button styles */
|
|
102
|
+
/* Header button styles: the Restart button */
|
|
70
103
|
button.squiffy-header-button
|
|
71
104
|
{
|
|
72
|
-
|
|
73
|
-
color: Blue;
|
|
105
|
+
color: var(--squiffy-muted);
|
|
74
106
|
cursor: pointer;
|
|
75
107
|
background: none;
|
|
76
108
|
border: none;
|
|
77
|
-
|
|
109
|
+
padding: 0.25em 0;
|
|
110
|
+
font: inherit;
|
|
111
|
+
text-decoration: underline;
|
|
112
|
+
text-decoration-color: transparent;
|
|
113
|
+
text-underline-offset: 0.15em;
|
|
114
|
+
transition: color 0.2s ease-in-out, text-decoration-color 0.2s ease-in-out;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
button.squiffy-header-button:hover
|
|
118
|
+
{
|
|
119
|
+
color: var(--squiffy-text);
|
|
120
|
+
text-decoration-color: currentColor;
|
|
78
121
|
}
|
|
79
122
|
|
|
80
123
|
/* Output block spacing */
|
|
@@ -83,7 +126,7 @@ div.squiffy-output-passage:not(:last-child),
|
|
|
83
126
|
div.squiffy-output-section:not(:last-child)
|
|
84
127
|
{
|
|
85
128
|
margin-bottom: 1em;
|
|
86
|
-
border-bottom: 1px solid
|
|
129
|
+
border-bottom: 1px solid var(--squiffy-border);
|
|
87
130
|
}
|
|
88
131
|
|
|
89
132
|
/* Fade animations */
|
|
@@ -99,9 +142,11 @@ div.squiffy-output-section:not(:last-child)
|
|
|
99
142
|
|
|
100
143
|
/* Continue animation - click to proceed */
|
|
101
144
|
.squiffy-continue {
|
|
145
|
+
color: var(--squiffy-link);
|
|
102
146
|
text-decoration: underline;
|
|
103
|
-
text-decoration-color:
|
|
104
|
-
|
|
147
|
+
text-decoration-color: currentColor;
|
|
148
|
+
text-decoration-thickness: from-font;
|
|
149
|
+
text-underline-offset: 0.15em;
|
|
105
150
|
cursor: pointer;
|
|
106
151
|
}
|
|
107
152
|
|
|
@@ -121,8 +166,8 @@ div.squiffy-output-section:not(:last-child)
|
|
|
121
166
|
}
|
|
122
167
|
|
|
123
168
|
@keyframes squiffy-glow {
|
|
124
|
-
0%, 100% { text-shadow: 0 0 4px
|
|
125
|
-
50% { text-shadow: 0 0 12px
|
|
169
|
+
0%, 100% { text-shadow: 0 0 4px color-mix(in srgb, currentColor 50%, transparent); }
|
|
170
|
+
50% { text-shadow: 0 0 12px color-mix(in srgb, currentColor 80%, transparent), 0 0 20px color-mix(in srgb, currentColor 40%, transparent); }
|
|
126
171
|
}
|
|
127
172
|
|
|
128
173
|
/* Style: bounce - subtle vertical bounce */
|
|
@@ -139,5 +184,16 @@ div.squiffy-output-section:not(:last-child)
|
|
|
139
184
|
/* Style: wave - character spans need special handling for underline */
|
|
140
185
|
.squiffy-continue-wave {
|
|
141
186
|
text-decoration: none;
|
|
142
|
-
border-bottom: 1px solid
|
|
187
|
+
border-bottom: 1px solid currentColor;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* Respect the reader's reduced-motion setting */
|
|
191
|
+
@media (prefers-reduced-motion: reduce)
|
|
192
|
+
{
|
|
193
|
+
.squiffy-continue-pulse,
|
|
194
|
+
.squiffy-continue-glow,
|
|
195
|
+
.squiffy-continue-bounce
|
|
196
|
+
{
|
|
197
|
+
animation: none;
|
|
198
|
+
}
|
|
143
199
|
}
|