@bangerpage/core 0.2.2 → 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.
- package/README.md +1 -1
- package/custom-elements.json +208 -0
- package/dist/camera.d.ts +10 -2
- package/dist/index.js +105 -49
- package/dist/index.js.map +4 -4
- package/dist/presenter-status.d.ts +29 -0
- package/dist/presenter.d.ts +3 -0
- package/dist/root.d.ts +18 -0
- package/dist/standalone.js +116 -60
- package/dist/standalone.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ The runtime for [Banger](https://github.com/bangerpage/banger): presentations wr
|
|
|
5
5
|
Load it from a CDN with the exact version, then write the deck with `bang-*` elements:
|
|
6
6
|
|
|
7
7
|
```html
|
|
8
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@bangerpage/core@0.2.
|
|
8
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@bangerpage/core@0.2.3/dist/index.js"></script>
|
|
9
9
|
<bang-root theme="light">
|
|
10
10
|
<bang-frame id="intro" at="0,0"><bang-title>Hello</bang-title></bang-frame>
|
|
11
11
|
<bang-path>
|
package/custom-elements.json
CHANGED
|
@@ -713,6 +713,24 @@
|
|
|
713
713
|
],
|
|
714
714
|
"description": "Cubic ease-in-out."
|
|
715
715
|
},
|
|
716
|
+
{
|
|
717
|
+
"kind": "function",
|
|
718
|
+
"name": "easeOut",
|
|
719
|
+
"return": {
|
|
720
|
+
"type": {
|
|
721
|
+
"text": "number"
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
"parameters": [
|
|
725
|
+
{
|
|
726
|
+
"name": "t",
|
|
727
|
+
"type": {
|
|
728
|
+
"text": "number"
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
],
|
|
732
|
+
"description": "Quartic ease-out: fast at the start, settling at the end."
|
|
733
|
+
},
|
|
716
734
|
{
|
|
717
735
|
"kind": "function",
|
|
718
736
|
"name": "pullBackFor",
|
|
@@ -775,6 +793,13 @@
|
|
|
775
793
|
"type": {
|
|
776
794
|
"text": "Size"
|
|
777
795
|
}
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"name": "opts",
|
|
799
|
+
"optional": true,
|
|
800
|
+
"type": {
|
|
801
|
+
"text": "TweenOptions"
|
|
802
|
+
}
|
|
778
803
|
}
|
|
779
804
|
]
|
|
780
805
|
},
|
|
@@ -833,6 +858,13 @@
|
|
|
833
858
|
"type": {
|
|
834
859
|
"text": "Size"
|
|
835
860
|
}
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"name": "opts",
|
|
864
|
+
"optional": true,
|
|
865
|
+
"type": {
|
|
866
|
+
"text": "TweenOptions"
|
|
867
|
+
}
|
|
836
868
|
}
|
|
837
869
|
],
|
|
838
870
|
"description": "Starts a new tween from the current pose so an interrupted move does not jump."
|
|
@@ -1047,6 +1079,14 @@
|
|
|
1047
1079
|
"module": "src/camera.ts"
|
|
1048
1080
|
}
|
|
1049
1081
|
},
|
|
1082
|
+
{
|
|
1083
|
+
"kind": "js",
|
|
1084
|
+
"name": "easeOut",
|
|
1085
|
+
"declaration": {
|
|
1086
|
+
"name": "easeOut",
|
|
1087
|
+
"module": "src/camera.ts"
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1050
1090
|
{
|
|
1051
1091
|
"kind": "js",
|
|
1052
1092
|
"name": "pullBackFor",
|
|
@@ -2506,6 +2546,65 @@
|
|
|
2506
2546
|
}
|
|
2507
2547
|
]
|
|
2508
2548
|
},
|
|
2549
|
+
{
|
|
2550
|
+
"kind": "javascript-module",
|
|
2551
|
+
"path": "src/presenter-status.ts",
|
|
2552
|
+
"declarations": [
|
|
2553
|
+
{
|
|
2554
|
+
"kind": "function",
|
|
2555
|
+
"name": "parsePresenterStatus",
|
|
2556
|
+
"return": {
|
|
2557
|
+
"type": {
|
|
2558
|
+
"text": "PresenterStatus | null"
|
|
2559
|
+
}
|
|
2560
|
+
},
|
|
2561
|
+
"parameters": [
|
|
2562
|
+
{
|
|
2563
|
+
"name": "data",
|
|
2564
|
+
"type": {
|
|
2565
|
+
"text": "unknown"
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
],
|
|
2569
|
+
"description": "Reads the `/__banger/status` response without trusting it; null when it is not a status this runtime knows."
|
|
2570
|
+
},
|
|
2571
|
+
{
|
|
2572
|
+
"kind": "function",
|
|
2573
|
+
"name": "initialsOf",
|
|
2574
|
+
"return": {
|
|
2575
|
+
"type": {
|
|
2576
|
+
"text": "string"
|
|
2577
|
+
}
|
|
2578
|
+
},
|
|
2579
|
+
"parameters": [
|
|
2580
|
+
{
|
|
2581
|
+
"name": "account",
|
|
2582
|
+
"type": {
|
|
2583
|
+
"text": "{ username: string; displayName?: string }"
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
]
|
|
2587
|
+
}
|
|
2588
|
+
],
|
|
2589
|
+
"exports": [
|
|
2590
|
+
{
|
|
2591
|
+
"kind": "js",
|
|
2592
|
+
"name": "parsePresenterStatus",
|
|
2593
|
+
"declaration": {
|
|
2594
|
+
"name": "parsePresenterStatus",
|
|
2595
|
+
"module": "src/presenter-status.ts"
|
|
2596
|
+
}
|
|
2597
|
+
},
|
|
2598
|
+
{
|
|
2599
|
+
"kind": "js",
|
|
2600
|
+
"name": "initialsOf",
|
|
2601
|
+
"declaration": {
|
|
2602
|
+
"name": "initialsOf",
|
|
2603
|
+
"module": "src/presenter-status.ts"
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
]
|
|
2607
|
+
},
|
|
2509
2608
|
{
|
|
2510
2609
|
"kind": "javascript-module",
|
|
2511
2610
|
"path": "src/presenter.ts",
|
|
@@ -2882,6 +2981,17 @@
|
|
|
2882
2981
|
"attribute": "format",
|
|
2883
2982
|
"reflects": true
|
|
2884
2983
|
},
|
|
2984
|
+
{
|
|
2985
|
+
"kind": "field",
|
|
2986
|
+
"name": "motion",
|
|
2987
|
+
"type": {
|
|
2988
|
+
"text": "\"smooth\" | \"swift\" | \"none\""
|
|
2989
|
+
},
|
|
2990
|
+
"default": "\"smooth\"",
|
|
2991
|
+
"description": "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.",
|
|
2992
|
+
"attribute": "motion",
|
|
2993
|
+
"reflects": true
|
|
2994
|
+
},
|
|
2885
2995
|
{
|
|
2886
2996
|
"kind": "field",
|
|
2887
2997
|
"name": "languages",
|
|
@@ -2952,6 +3062,14 @@
|
|
|
2952
3062
|
"privacy": "private",
|
|
2953
3063
|
"default": "0"
|
|
2954
3064
|
},
|
|
3065
|
+
{
|
|
3066
|
+
"kind": "field",
|
|
3067
|
+
"name": "presenterStatus",
|
|
3068
|
+
"type": {
|
|
3069
|
+
"text": "PresenterStatus | undefined"
|
|
3070
|
+
},
|
|
3071
|
+
"privacy": "private"
|
|
3072
|
+
},
|
|
2955
3073
|
{
|
|
2956
3074
|
"kind": "field",
|
|
2957
3075
|
"name": "mode",
|
|
@@ -3161,6 +3279,13 @@
|
|
|
3161
3279
|
"privacy": "private",
|
|
3162
3280
|
"default": "null"
|
|
3163
3281
|
},
|
|
3282
|
+
{
|
|
3283
|
+
"kind": "field",
|
|
3284
|
+
"name": "zeroedDurations",
|
|
3285
|
+
"privacy": "private",
|
|
3286
|
+
"default": "new Map<string, string>()",
|
|
3287
|
+
"description": "Duration tokens this element set to 0s, with the inline value the author had before (\"\" for none)."
|
|
3288
|
+
},
|
|
3164
3289
|
{
|
|
3165
3290
|
"kind": "field",
|
|
3166
3291
|
"name": "themeKey",
|
|
@@ -3273,6 +3398,27 @@
|
|
|
3273
3398
|
"privacy": "private",
|
|
3274
3399
|
"readonly": true
|
|
3275
3400
|
},
|
|
3401
|
+
{
|
|
3402
|
+
"kind": "method",
|
|
3403
|
+
"name": "loadPresenterStatus",
|
|
3404
|
+
"privacy": "private",
|
|
3405
|
+
"return": {
|
|
3406
|
+
"type": {
|
|
3407
|
+
"text": "Promise<void>"
|
|
3408
|
+
}
|
|
3409
|
+
},
|
|
3410
|
+
"description": "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."
|
|
3411
|
+
},
|
|
3412
|
+
{
|
|
3413
|
+
"kind": "method",
|
|
3414
|
+
"name": "resetTimer",
|
|
3415
|
+
"privacy": "private",
|
|
3416
|
+
"return": {
|
|
3417
|
+
"type": {
|
|
3418
|
+
"text": "void"
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
},
|
|
3276
3422
|
{
|
|
3277
3423
|
"kind": "method",
|
|
3278
3424
|
"name": "initLanguage",
|
|
@@ -3404,6 +3550,52 @@
|
|
|
3404
3550
|
}
|
|
3405
3551
|
}
|
|
3406
3552
|
},
|
|
3553
|
+
{
|
|
3554
|
+
"kind": "method",
|
|
3555
|
+
"name": "zeroDuration",
|
|
3556
|
+
"privacy": "private",
|
|
3557
|
+
"return": {
|
|
3558
|
+
"type": {
|
|
3559
|
+
"text": "void"
|
|
3560
|
+
}
|
|
3561
|
+
},
|
|
3562
|
+
"parameters": [
|
|
3563
|
+
{
|
|
3564
|
+
"name": "name",
|
|
3565
|
+
"type": {
|
|
3566
|
+
"text": "string"
|
|
3567
|
+
}
|
|
3568
|
+
},
|
|
3569
|
+
{
|
|
3570
|
+
"name": "zero",
|
|
3571
|
+
"type": {
|
|
3572
|
+
"text": "boolean"
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
],
|
|
3576
|
+
"description": "Sets a duration token to 0s on the host, and later removes only the 0s this set, so a value the author wrote\ninline on bang-root survives (it is overridden only while the motion is off)."
|
|
3577
|
+
},
|
|
3578
|
+
{
|
|
3579
|
+
"kind": "method",
|
|
3580
|
+
"name": "authoredMotion",
|
|
3581
|
+
"privacy": "private",
|
|
3582
|
+
"return": {
|
|
3583
|
+
"type": {
|
|
3584
|
+
"text": "CameraMotion | \"none\""
|
|
3585
|
+
}
|
|
3586
|
+
},
|
|
3587
|
+
"description": "The `motion` attribute as written; an unknown value counts as `smooth` (render() warns about it)."
|
|
3588
|
+
},
|
|
3589
|
+
{
|
|
3590
|
+
"kind": "method",
|
|
3591
|
+
"name": "effectiveMotion",
|
|
3592
|
+
"privacy": "private",
|
|
3593
|
+
"return": {
|
|
3594
|
+
"type": {
|
|
3595
|
+
"text": "CameraMotion | \"none\""
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
},
|
|
3407
3599
|
{
|
|
3408
3600
|
"kind": "method",
|
|
3409
3601
|
"name": "onResize",
|
|
@@ -3689,6 +3881,13 @@
|
|
|
3689
3881
|
"type": {
|
|
3690
3882
|
"text": "boolean"
|
|
3691
3883
|
}
|
|
3884
|
+
},
|
|
3885
|
+
{
|
|
3886
|
+
"name": "opts",
|
|
3887
|
+
"optional": true,
|
|
3888
|
+
"type": {
|
|
3889
|
+
"text": "Omit<TweenOptions, \"motion\">"
|
|
3890
|
+
}
|
|
3692
3891
|
}
|
|
3693
3892
|
]
|
|
3694
3893
|
},
|
|
@@ -3947,6 +4146,15 @@
|
|
|
3947
4146
|
"description": "How the canvas is presented. `slides` (the default) is frames side by side. `map` draws the canvas as a map: a\nground with contour lines under the frames, roads for each frame's `link`, wider gaps, and fog over every frame the\ntalk has not reached yet. Export pages show what is around the stop instead of masking it.\n`map` is experimental: its look and behaviour may change in any release. Use `slides` unless the author asks for a map.",
|
|
3948
4147
|
"fieldName": "format"
|
|
3949
4148
|
},
|
|
4149
|
+
{
|
|
4150
|
+
"name": "motion",
|
|
4151
|
+
"type": {
|
|
4152
|
+
"text": "\"smooth\" | \"swift\" | \"none\""
|
|
4153
|
+
},
|
|
4154
|
+
"default": "\"smooth\"",
|
|
4155
|
+
"description": "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.",
|
|
4156
|
+
"fieldName": "motion"
|
|
4157
|
+
},
|
|
3950
4158
|
{
|
|
3951
4159
|
"name": "languages",
|
|
3952
4160
|
"type": {
|
package/dist/camera.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export interface CameraTween {
|
|
|
22
22
|
duration: number;
|
|
23
23
|
/** How far (in log zoom) the move pulls back at its midpoint, beyond the straight zoom change. 0 or less. */
|
|
24
24
|
pullBack: number;
|
|
25
|
+
/** `swift` makes `sample` use ease-out. Left off for `smooth`. */
|
|
26
|
+
curve?: CameraMotion;
|
|
27
|
+
}
|
|
28
|
+
export type CameraMotion = "smooth" | "swift";
|
|
29
|
+
export interface TweenOptions {
|
|
30
|
+
motion?: CameraMotion;
|
|
25
31
|
}
|
|
26
32
|
export declare const FRAME_WIDTH = 1920;
|
|
27
33
|
export declare const FRAME_HEIGHT = 1080;
|
|
@@ -51,15 +57,17 @@ export declare function stageSize(viewport: Size): Size;
|
|
|
51
57
|
export declare function durationFor(from: CameraPose, to: CameraPose, stage: Size): number;
|
|
52
58
|
/** Cubic ease-in-out. */
|
|
53
59
|
export declare function ease(t: number): number;
|
|
60
|
+
/** Quartic ease-out: fast at the start, settling at the end. */
|
|
61
|
+
export declare function easeOut(t: number): number;
|
|
54
62
|
/**
|
|
55
63
|
* For a far move, how much to zoom out beyond the straight change so the midpoint shows both ends. A move whose distance
|
|
56
64
|
* is under `PULL_BACK_DISTANCE` views gets 0, so moves between neighbours stay a plain pan.
|
|
57
65
|
*/
|
|
58
66
|
export declare function pullBackFor(from: CameraPose, to: CameraPose, stage: Size): number;
|
|
59
|
-
export declare function startTween(from: CameraPose, to: CameraPose, now: number, stage: Size): CameraTween;
|
|
67
|
+
export declare function startTween(from: CameraPose, to: CameraPose, now: number, stage: Size, opts?: TweenOptions): CameraTween;
|
|
60
68
|
export declare function sample(tween: CameraTween, now: number): CameraPose;
|
|
61
69
|
/** Starts a new tween from the current pose so an interrupted move does not jump. */
|
|
62
|
-
export declare function retarget(current: CameraPose, to: CameraPose, now: number, stage: Size): CameraTween;
|
|
70
|
+
export declare function retarget(current: CameraPose, to: CameraPose, now: number, stage: Size, opts?: TweenOptions): CameraTween;
|
|
63
71
|
/** The margin (stage px) around the box the target rect occupies at `pose.zoom`, centered in the stage. */
|
|
64
72
|
export declare function clipFor(rect: Rect, pose: CameraPose, stage: Size): {
|
|
65
73
|
top: number;
|