@bangerpage/core 0.2.1 → 0.2.3

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.
@@ -0,0 +1,29 @@
1
+ export type PresenterAccount = {
2
+ state: "logged_in";
3
+ username: string;
4
+ displayName?: string;
5
+ avatarUrl?: string;
6
+ } | {
7
+ state: "logged_out" | "invalid" | "unavailable";
8
+ };
9
+ export type PresenterDeck = {
10
+ state: "none";
11
+ } | {
12
+ state: "published";
13
+ visibility: "public" | "unlisted";
14
+ version?: number;
15
+ url?: string;
16
+ } | {
17
+ state: "unpublished" | "missing" | "unverified";
18
+ url?: string;
19
+ };
20
+ export interface PresenterStatus {
21
+ account: PresenterAccount;
22
+ deck: PresenterDeck;
23
+ }
24
+ /** Reads the `/__banger/status` response without trusting it; null when it is not a status this runtime knows. */
25
+ export declare function parsePresenterStatus(data: unknown): PresenterStatus | null;
26
+ export declare function initialsOf(account: {
27
+ username: string;
28
+ displayName?: string;
29
+ }): string;
@@ -1,4 +1,5 @@
1
1
  import { type TemplateResult } from "lit";
2
+ import { type PresenterStatus } from "./presenter-status.js";
2
3
  import type { BangState } from "./state.js";
3
4
  /** Keeps the audience window and the presenter window on the same state. Received states are never re-sent. */
4
5
  export declare class PresenterSync {
@@ -19,8 +20,10 @@ export interface PresenterView {
19
20
  notes: string;
20
21
  language?: string;
21
22
  elapsedMs: number;
23
+ status?: PresenterStatus;
22
24
  onPrev: () => void;
23
25
  onNext: () => void;
26
+ onResetTimer: () => void;
24
27
  }
25
28
  export declare function formatElapsed(ms: number): string;
26
29
  export declare function renderPresenter(view: PresenterView): TemplateResult;
package/dist/root.d.ts CHANGED
@@ -52,6 +52,10 @@ export declare class BangRoot extends BangElement {
52
52
  * `map` is experimental: its look and behaviour may change in any release. Use `slides` unless the author asks for a map.
53
53
  */
54
54
  format: "slides" | "map";
55
+ /**
56
+ * How the camera moves between stops. `smooth` (the default) eases in and out over 0.4 to 0.8 seconds and pulls back on a long move. `swift` is a quick move of 0.18 to 0.28 seconds that starts fast and settles, and never pulls back. `none` jumps straight to the next stop and also stops the fade of revealed steps and of the focus spotlight. It applies to the whole deck and cannot be set per stop. Write it only when the author asks for a faster or a motionless deck. A viewer whose system asks for reduced motion always gets `none`, and export, snap, check, PDF and the presenter window never animate, whatever the value.
57
+ */
58
+ motion: "smooth" | "swift" | "none";
55
59
  /**
56
60
  * The languages of the deck as BCP 47 tags separated by spaces, for example `ja en`; the first is the author's language.
57
61
  * An element inside a frame (and a `bang-notes`) with a `lang` of one of them shows only while that language is selected;
@@ -67,6 +71,7 @@ export declare class BangRoot extends BangElement {
67
71
  private statusText;
68
72
  private helpOpen;
69
73
  private elapsedMs;
74
+ private presenterStatus;
70
75
  private mode;
71
76
  private path;
72
77
  private notes;
@@ -91,6 +96,8 @@ export declare class BangRoot extends BangElement {
91
96
  private clockTimer;
92
97
  private startedAt;
93
98
  private motionQuery;
99
+ /** Duration tokens this element set to 0s, with the inline value the author had before ("" for none). */
100
+ private zeroedDurations;
94
101
  private themeKey;
95
102
  private themeVars;
96
103
  private themeWarnings;
@@ -114,6 +121,9 @@ export declare class BangRoot extends BangElement {
114
121
  private readonly onHashChange;
115
122
  private readonly onMotionChange;
116
123
  connectedCallback(): void;
124
+ /** Asks the preview server who is logged in to banger.page. Anywhere else (a published deck, a static host) the request fails and nothing is shown. */
125
+ private loadPresenterStatus;
126
+ private resetTimer;
117
127
  private initLanguage;
118
128
  /** The deck's languages from the `languages` attribute; empty for a deck without them. */
119
129
  getLanguages(): string[];
@@ -136,6 +146,14 @@ export declare class BangRoot extends BangElement {
136
146
  /** Publishes each frame tone's colours as --bang-frame-<tone>-<token>; bang-frame[tone] maps them onto its own --bang-color-*. */
137
147
  private applyFrameTones;
138
148
  private applyMotionPreference;
149
+ /**
150
+ * Sets a duration token to 0s on the host, and later removes only the 0s this set, so a value the author wrote
151
+ * inline on bang-root survives (it is overridden only while the motion is off).
152
+ */
153
+ private zeroDuration;
154
+ /** The `motion` attribute as written; an unknown value counts as `smooth` (render() warns about it). */
155
+ private authoredMotion;
156
+ private effectiveMotion;
139
157
  private onResize;
140
158
  private get stageNow();
141
159
  private get isMap();