skydancer 2.12.0 → 2.13.0
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/CHANGELOG.md +11 -0
- package/README.md +2 -0
- package/package.json +1 -1
- package/skydancer.d.ts +6 -0
- package/skydancer.js +30 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ Embeds point at `@2`, which follows the newest `v2.x.x` tag, so everything
|
|
|
4
4
|
below reaches an existing embed as soon as it is tagged. This is the place to
|
|
5
5
|
look when a dancer starts looking different.
|
|
6
6
|
|
|
7
|
+
## v2.13.0 — 2026-11-23
|
|
8
|
+
|
|
9
|
+
- `link-label` and `poke-label` say the two bits of wording a reader meets
|
|
10
|
+
rather than sees. They were English only, which on a page in another
|
|
11
|
+
language was the only English a screen reader hit.
|
|
12
|
+
- **Fixed:** a negative `girth` asked the canvas for a negative radius and
|
|
13
|
+
threw on every frame, leaving nothing on screen; an enormous one left
|
|
14
|
+
nothing on screen either. Numbers that have a sensible range are held to
|
|
15
|
+
it now, since a dancer's settings can arrive from a page's templating or
|
|
16
|
+
a shared link rather than from someone watching the result.
|
|
17
|
+
|
|
7
18
|
## v2.12.0 — 2026-11-20
|
|
8
19
|
|
|
9
20
|
- Pushing a version tag publishes to npm, with provenance, instead of it
|
package/README.md
CHANGED
|
@@ -56,6 +56,8 @@ The widget is 400px tall by default and crops to the dancer: its width follows i
|
|
|
56
56
|
| `speed` | `1` | animation speed |
|
|
57
57
|
| `wildness` | `1` | how much it flails |
|
|
58
58
|
| `wind` | `1` | wind strength; `0` is calm. Scales the gusts, the pointer, and the page scrolling past |
|
|
59
|
+
| `link-label` | none | what the link is called when the sign says nothing; English `Find out more` otherwise |
|
|
60
|
+
| `poke-label` | none | what the poke button is called; English `Poke the dancer` otherwise |
|
|
59
61
|
| `hours` | none | when it is worth dancing, as `9-17`; `22-6` runs through midnight. Outside them the air is out and the dancer lies flat |
|
|
60
62
|
| `face` | `happy` | `happy`, `surprised`, `cool`, `wink`, `joy`, `sleepy` or `angry` |
|
|
61
63
|
| `pattern` | `none` | markings on the body: `none`, `rings` or `spiral` |
|
package/package.json
CHANGED
package/skydancer.d.ts
CHANGED
|
@@ -79,6 +79,12 @@ export interface SkyDancerAttributes {
|
|
|
79
79
|
sign?: string;
|
|
80
80
|
/** The balloon's shape. Default `drawn`. */
|
|
81
81
|
bubble?: SkyDancerBubble;
|
|
82
|
+
/** What the link is called when the sign says nothing. English `Find out
|
|
83
|
+
* more` when unset. */
|
|
84
|
+
'link-label'?: string;
|
|
85
|
+
/** What the poke button is called. English `Poke the dancer` when
|
|
86
|
+
* unset. */
|
|
87
|
+
'poke-label'?: string;
|
|
82
88
|
/** When it is worth dancing, as `9-17`; `22-6` runs through midnight.
|
|
83
89
|
* Outside them the air is out and it lies flat. Read from the reader's own
|
|
84
90
|
* clock. Empty means always. */
|
package/skydancer.js
CHANGED
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
sign: '', // words in a speech bubble by the dancer; empty for none
|
|
35
35
|
bubble: 'drawn', // drawn | box | burst
|
|
36
36
|
hours: '', // when it is worth dancing, as `9-17`; empty for always
|
|
37
|
+
// The two bits of wording a reader meets rather than sees. They are in
|
|
38
|
+
// English because something has to be; a page in another language can
|
|
39
|
+
// say them its own way.
|
|
40
|
+
linkLabel: '', // what the link is called when the sign says nothing
|
|
41
|
+
pokeLabel: '', // what the poke button is called
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
const OFF = ['false', '0', 'no', 'off'];
|
|
@@ -52,6 +57,20 @@
|
|
|
52
57
|
return from < to ? h >= from && h < to : h >= from || h < to;
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
// What a number may be, when being outside it is worse than useless. A
|
|
61
|
+
// dancer's settings can arrive from a page's own templating or from a
|
|
62
|
+
// shared link, so they are not always written by someone watching the
|
|
63
|
+
// result: a negative girth asked the canvas for a negative radius and threw
|
|
64
|
+
// on every frame, and a girth of 100000 left nothing on screen at all.
|
|
65
|
+
// Outside these a dancer is still a dancer, just a silly one.
|
|
66
|
+
const LIMITS = {
|
|
67
|
+
girth: [1, 400],
|
|
68
|
+
armLength: [0, 3],
|
|
69
|
+
speed: [0, 20],
|
|
70
|
+
wildness: [0, 10],
|
|
71
|
+
wind: [0, 10],
|
|
72
|
+
};
|
|
73
|
+
|
|
55
74
|
const attrName = key => key.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`);
|
|
56
75
|
const KEYS = Object.keys(DEFAULTS);
|
|
57
76
|
|
|
@@ -61,7 +80,9 @@
|
|
|
61
80
|
if (typeof DEFAULTS[key] === 'number') {
|
|
62
81
|
// Number, not parseFloat: height="500px" should fall back, not mean 500x the canvas
|
|
63
82
|
const n = value.trim() === '' ? NaN : Number(value);
|
|
64
|
-
|
|
83
|
+
if (!Number.isFinite(n)) return DEFAULTS[key];
|
|
84
|
+
const bounds = LIMITS[key];
|
|
85
|
+
return bounds ? Math.min(bounds[1], Math.max(bounds[0], n)) : n;
|
|
65
86
|
}
|
|
66
87
|
return value;
|
|
67
88
|
}
|
|
@@ -530,7 +551,7 @@
|
|
|
530
551
|
let labelled = null;
|
|
531
552
|
|
|
532
553
|
function labelLink(sign) {
|
|
533
|
-
const label = sign || 'Find out more';
|
|
554
|
+
const label = sign || cfg.linkLabel.trim() || 'Find out more';
|
|
534
555
|
if (!aimed || label === labelled) return;
|
|
535
556
|
labelled = label;
|
|
536
557
|
leadsTo.textContent = label;
|
|
@@ -607,13 +628,17 @@
|
|
|
607
628
|
// merely wiggled has nothing to report to a reader who cannot see it -- so
|
|
608
629
|
// it stays out of the page's tab order rather than costing a stop per
|
|
609
630
|
// embed for a flourish. A held pose swallows a poke, so it offers none.
|
|
610
|
-
let offering = null;
|
|
631
|
+
let offering = null, offeredAs = null;
|
|
611
632
|
function offerPoke() {
|
|
612
633
|
const worth = phrasesOf(cfg.shout).length > 0 && !held();
|
|
613
|
-
|
|
634
|
+
const label = cfg.pokeLabel.trim() || 'Poke the dancer';
|
|
635
|
+
// the wording is watched as well as the offer, or renaming the button
|
|
636
|
+
// while it is already showing would not reach it
|
|
637
|
+
if (worth === offering && label === offeredAs) return;
|
|
614
638
|
offering = worth;
|
|
639
|
+
offeredAs = label;
|
|
615
640
|
pokeButton.hidden = !worth;
|
|
616
|
-
if (worth) pokeButton.textContent =
|
|
641
|
+
if (worth) pokeButton.textContent = label;
|
|
617
642
|
}
|
|
618
643
|
|
|
619
644
|
// A page can theme the dancer in CSS rather than in attributes, which is
|