presenter 0.2.4 → 0.3.1
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/dist/jest.config.d.ts +13 -0
- package/dist/presenter-code.js +1 -0
- package/dist/presenter-export.js +1 -0
- package/dist/presenter-morph.js +1 -0
- package/dist/presenter.js +1 -1
- package/dist/src/code/codeBlock.d.ts +83 -0
- package/dist/src/code/index.d.ts +1 -0
- package/dist/src/export/index.d.ts +22 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/morph/index.d.ts +34 -0
- package/dist/src/objects/arrow.d.ts +23 -6
- package/dist/src/objects/circle.d.ts +12 -0
- package/dist/src/objects/grid.d.ts +17 -0
- package/dist/src/objects/group.d.ts +4 -0
- package/dist/src/objects/image.d.ts +2 -0
- package/dist/src/objects/line.d.ts +6 -0
- package/dist/src/objects/text.d.ts +20 -0
- package/dist/src/objects/text.test.d.ts +1 -0
- package/dist/src/objects/vectorGraphic.d.ts +28 -0
- package/dist/src/presentation/object.d.ts +20 -11
- package/dist/src/presentation/presentation.d.ts +29 -1
- package/dist/src/presentation/presentation.test.d.ts +1 -0
- package/dist/src/presentation/slide.d.ts +19 -4
- package/dist/src/util/animation.d.ts +22 -0
- package/dist/src/util/easing.d.ts +12 -0
- package/dist/src/util/easing.test.d.ts +1 -0
- package/dist/webpack.config.d.ts +51 -3
- package/package.json +38 -8
- package/dist/dist/presenter.d.ts +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Group, GroupProps } from "../objects/group";
|
|
2
|
+
import { Rectangle, RectangleProps } from "../objects/rectangle";
|
|
3
|
+
import { Text, TextContent, TextProps } from "../objects/text";
|
|
4
|
+
import { Anchor } from "../presentation/object";
|
|
5
|
+
import { Presentation } from "../presentation/presentation";
|
|
6
|
+
import { BuildFunction } from "../util/animation";
|
|
7
|
+
import { Position } from "../util/position";
|
|
8
|
+
/**
|
|
9
|
+
* Region for syntax highlighting.
|
|
10
|
+
*
|
|
11
|
+
* The `presenter-syntax-highlight` script can be used to generate a list of
|
|
12
|
+
* highlight regions for each line of code. This allows code to be
|
|
13
|
+
* syntax-highlighted on the slide.
|
|
14
|
+
*/
|
|
15
|
+
export interface CodeHighlightRegion {
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
color: string;
|
|
19
|
+
bold: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface CodeBlockProps {
|
|
22
|
+
code: string;
|
|
23
|
+
highlights: CodeHighlightRegion[][] | null;
|
|
24
|
+
length: number | null;
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
fontSize: number;
|
|
27
|
+
textColor: string;
|
|
28
|
+
backgroundColor: string | null;
|
|
29
|
+
backgroundRounding: number;
|
|
30
|
+
padding: number;
|
|
31
|
+
lineHeight: number;
|
|
32
|
+
characterWidth: number;
|
|
33
|
+
focusColor: string;
|
|
34
|
+
focusOpacity: number;
|
|
35
|
+
focusRounding: number;
|
|
36
|
+
focusLineStart: number;
|
|
37
|
+
focusLineEnd: number;
|
|
38
|
+
focusColStart: number;
|
|
39
|
+
focusColEnd: number;
|
|
40
|
+
focusPaddingX: number;
|
|
41
|
+
focusOffsetX: number;
|
|
42
|
+
focusPaddingY: number;
|
|
43
|
+
focusOffsetY: number;
|
|
44
|
+
position: Position;
|
|
45
|
+
anchor: Anchor;
|
|
46
|
+
}
|
|
47
|
+
export declare class CodeBlock extends Group {
|
|
48
|
+
codeBlockProps: CodeBlockProps;
|
|
49
|
+
background: Rectangle;
|
|
50
|
+
focus: Rectangle;
|
|
51
|
+
text: Text;
|
|
52
|
+
constructor(props?: Partial<CodeBlockProps>);
|
|
53
|
+
/**
|
|
54
|
+
* Animation of code block. Since a code block is made up of multiple
|
|
55
|
+
* elements (background, focus, text), we animate each element separately.
|
|
56
|
+
*/
|
|
57
|
+
animate(props: Partial<CodeBlockProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
|
|
58
|
+
/**
|
|
59
|
+
* Given properties for the entire code block, compute properties for individual text elements.
|
|
60
|
+
*/
|
|
61
|
+
static getComponentProps(props: CodeBlockProps): {
|
|
62
|
+
group: Partial<GroupProps>;
|
|
63
|
+
background: Partial<RectangleProps>;
|
|
64
|
+
focus: Partial<RectangleProps>;
|
|
65
|
+
text: Partial<TextProps>;
|
|
66
|
+
};
|
|
67
|
+
static buildTextContent(code: string, highlights: CodeHighlightRegion[][] | null): TextContent;
|
|
68
|
+
/**
|
|
69
|
+
* Given text properties, calculates the character width and line height for the font at that size.
|
|
70
|
+
* Can be pre-computed, then be used as input to a new CodeBlock.
|
|
71
|
+
*
|
|
72
|
+
* Sample usage in a presentation to determine text properties:
|
|
73
|
+
*
|
|
74
|
+
* console.log(CodeBlock.computePropsForText(presentation, {
|
|
75
|
+
* fontFamily: "Menlo",
|
|
76
|
+
* fontSize: 130,
|
|
77
|
+
* }));
|
|
78
|
+
*/
|
|
79
|
+
static computePropsForText(presentation: Presentation, textProps: Partial<TextProps>): {
|
|
80
|
+
lineHeight: number;
|
|
81
|
+
characterWidth: number;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./codeBlock";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Presentation } from "../presentation/presentation";
|
|
2
|
+
/**
|
|
3
|
+
* Renders the SVG content of a single slide of a presentation to a PNG image.
|
|
4
|
+
*/
|
|
5
|
+
export declare function renderCurrentSlide(presentation: Presentation, filename: string): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Renders the SVG content of all slides in a presentation as PNG images.
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderPresentationAsImages(presentation: Presentation): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Renders whole slide container (background, additional element canvas, svg)
|
|
12
|
+
* and sends to a server endpoint.
|
|
13
|
+
*
|
|
14
|
+
* When rendering all componenst of the slide container, the server endpoint
|
|
15
|
+
* is requried to perform additional image compositing to generate the
|
|
16
|
+
* render.
|
|
17
|
+
*/
|
|
18
|
+
export declare function exportCurrentSlideContainer(presentation: Presentation, filename: string, serverEndpoint: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Exports the whole slide content of all slides and sends to a server endpoint.
|
|
21
|
+
*/
|
|
22
|
+
export declare function exportAllSlides(presentation: Presentation, serverEndpoint: string): Promise<void>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from "./presentation/presentation";
|
|
|
2
2
|
export * from "./presentation/slide";
|
|
3
3
|
export * from "./presentation/object";
|
|
4
4
|
export * from "./objects/arrow";
|
|
5
|
+
export * from "./objects/circle";
|
|
6
|
+
export * from "./objects/grid";
|
|
5
7
|
export * from "./objects/group";
|
|
6
8
|
export * from "./objects/image";
|
|
7
9
|
export * from "./objects/line";
|
|
@@ -11,5 +13,6 @@ export * from "./objects/text";
|
|
|
11
13
|
export * from "./objects/rectangle";
|
|
12
14
|
export * from "./objects/vectorGraphic";
|
|
13
15
|
export * from "./util/animation";
|
|
16
|
+
export * from "./util/easing";
|
|
14
17
|
export * from "./util/position";
|
|
15
18
|
export * from "./util/richText";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BuildFunction } from "../util/animation";
|
|
2
|
+
export interface MorphParams {
|
|
3
|
+
duration: number;
|
|
4
|
+
/**
|
|
5
|
+
* For smooth morph, we can define a maximum size for segments to use in
|
|
6
|
+
* interpolated animation. Lower values result in smoother animations, but
|
|
7
|
+
* are potentially less performant.
|
|
8
|
+
*
|
|
9
|
+
* Default is 10.
|
|
10
|
+
*/
|
|
11
|
+
maxSegmentLength: number;
|
|
12
|
+
/**
|
|
13
|
+
* For simple morph, easing is meant to be a string.
|
|
14
|
+
* For smooth morph, easing is meant to be a function over [0, 1].
|
|
15
|
+
*/
|
|
16
|
+
easing: string | ((value: number) => number);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generates an animation that morphs one path into another, given a path
|
|
20
|
+
* interpolation function that computes intermediate path values.
|
|
21
|
+
*/
|
|
22
|
+
export declare function morphPath(sourceElement: Element | (() => Element), targetPath: string, pathInterpolator: (source: string, target: string) => (t: number) => string, morphParams: Partial<MorphParams>): BuildFunction;
|
|
23
|
+
/**
|
|
24
|
+
* Smoothly morphs one path into another. Attempts to intelligently
|
|
25
|
+
* interpolate between shapes smoothly, even if shapes don't correspond to
|
|
26
|
+
* each other closely or don't have the same number of points.
|
|
27
|
+
*/
|
|
28
|
+
export declare function morphPathSmooth(sourceElement: Element | (() => Element), targetPath: string, morphParams?: Partial<MorphParams>): BuildFunction;
|
|
29
|
+
/**
|
|
30
|
+
* Simply morphs one path into another. Points are translated directly, and
|
|
31
|
+
* both paths must have the same number of points for the animation to look
|
|
32
|
+
* correct. Works best if two paths correspond to each other closely.
|
|
33
|
+
*/
|
|
34
|
+
export declare function morphPathSimple(sourceElement: Element | (() => Element), targetPath: string, morphParams?: Partial<MorphParams>): BuildFunction;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectProps, SlideObject } from "../presentation/object";
|
|
2
|
-
import {
|
|
2
|
+
import { BuildFunction } from "../util/animation";
|
|
3
3
|
import { Position } from "../util/position";
|
|
4
4
|
import { Line } from "./line";
|
|
5
5
|
import { Polygon } from "./polygon";
|
|
@@ -9,6 +9,24 @@ export interface ArrowProps extends ObjectProps {
|
|
|
9
9
|
color: string;
|
|
10
10
|
width: number;
|
|
11
11
|
arrowSize: number;
|
|
12
|
+
/**
|
|
13
|
+
* Property describing whether the arrow has been fully drawn.
|
|
14
|
+
* If an arrow hasn't been drawn, it can be animated to draw in.
|
|
15
|
+
*/
|
|
16
|
+
drawn: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The start and end points can have "padding".
|
|
19
|
+
* This is equivalent to adding (x, y) values to the start and end points.
|
|
20
|
+
*
|
|
21
|
+
* This can be useful when drawing an arrow from an object at a particular
|
|
22
|
+
* location. The arrow's start/end point can match the object's, with some
|
|
23
|
+
* added padding so that the arrow doesn't overlap the object.
|
|
24
|
+
*
|
|
25
|
+
* It can also be useful if multiple arrows start or end at the same place,
|
|
26
|
+
* and you want to adjust their endpoints slightly to avoid overlap.
|
|
27
|
+
*/
|
|
28
|
+
padStart: Partial<Position>;
|
|
29
|
+
padEnd: Partial<Position>;
|
|
12
30
|
}
|
|
13
31
|
export declare class Arrow extends SlideObject<ArrowProps> {
|
|
14
32
|
line: Line | null;
|
|
@@ -21,16 +39,15 @@ export declare class Arrow extends SlideObject<ArrowProps> {
|
|
|
21
39
|
calculateShapes(props: ArrowProps): {
|
|
22
40
|
line: {
|
|
23
41
|
start: Position;
|
|
24
|
-
end:
|
|
25
|
-
x: number;
|
|
26
|
-
y: number;
|
|
27
|
-
};
|
|
42
|
+
end: Position;
|
|
28
43
|
};
|
|
29
44
|
arrowhead: Position[];
|
|
30
45
|
};
|
|
31
46
|
children(): Node[];
|
|
47
|
+
animate(props: Partial<ArrowProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
|
|
48
|
+
draw(animationParams?: anime.AnimeParams): BuildFunction;
|
|
32
49
|
/**
|
|
33
50
|
* Returns animations for changes in arrowhead.
|
|
34
51
|
*/
|
|
35
|
-
|
|
52
|
+
animateArrow(arrowProps: Partial<ArrowProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
|
|
36
53
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ObjectProps, SlideObject } from "../presentation/object";
|
|
2
|
+
export interface CircleProps extends ObjectProps {
|
|
3
|
+
fill: string;
|
|
4
|
+
radius: number;
|
|
5
|
+
borderWidth: number;
|
|
6
|
+
borderColor: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class Circle extends SlideObject<CircleProps> {
|
|
9
|
+
constructor(props?: Partial<CircleProps>);
|
|
10
|
+
tagName(): string;
|
|
11
|
+
attributes(): Partial<Record<string, string>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A grid of identical or similar objects.
|
|
3
|
+
*/
|
|
4
|
+
import { SlideObject } from "../presentation/object";
|
|
5
|
+
import { Position } from "../util/position";
|
|
6
|
+
import { Group, GroupProps } from "./group";
|
|
7
|
+
export interface GridProps extends Omit<GroupProps, "objects"> {
|
|
8
|
+
origin: Position;
|
|
9
|
+
spacing: Partial<Position>;
|
|
10
|
+
rows: number;
|
|
11
|
+
cols: number;
|
|
12
|
+
objects: (row: number, col: number) => SlideObject<any> | null;
|
|
13
|
+
}
|
|
14
|
+
export declare class Grid extends Group {
|
|
15
|
+
objects: (SlideObject<any> | null)[][];
|
|
16
|
+
constructor(props: Partial<GridProps>);
|
|
17
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ObjectProps, SlideObject } from "../presentation/object";
|
|
2
|
+
import { Position } from "../util/position";
|
|
2
3
|
export interface GroupProps extends ObjectProps {
|
|
3
4
|
/**
|
|
4
5
|
* A positioned group places the group's anchor at a particular coordinate.
|
|
@@ -6,6 +7,9 @@ export interface GroupProps extends ObjectProps {
|
|
|
6
7
|
*/
|
|
7
8
|
positioned: boolean;
|
|
8
9
|
objects: SlideObject<any>[];
|
|
10
|
+
rotation: number;
|
|
11
|
+
rotationOrigin: Position;
|
|
12
|
+
scale: number;
|
|
9
13
|
}
|
|
10
14
|
export declare class Group extends SlideObject<GroupProps> {
|
|
11
15
|
constructor(objects: SlideObject<any>[], props?: Partial<GroupProps>, positioned?: boolean | null);
|
|
@@ -3,9 +3,11 @@ export interface ImageProps extends ObjectProps {
|
|
|
3
3
|
href: string;
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
6
|
+
rounding: number;
|
|
6
7
|
}
|
|
7
8
|
export declare class Image extends SlideObject<ImageProps> {
|
|
8
9
|
constructor(href: string, props?: Partial<ImageProps>);
|
|
9
10
|
tagName(): string;
|
|
10
11
|
attributes(): Partial<Record<string, string>>;
|
|
12
|
+
styles(): Partial<Record<string, string>>;
|
|
11
13
|
}
|
|
@@ -5,6 +5,12 @@ export interface LineProps extends ObjectProps {
|
|
|
5
5
|
end: Position;
|
|
6
6
|
color: string;
|
|
7
7
|
width: number;
|
|
8
|
+
linecap: "butt" | "round" | "square" | null;
|
|
9
|
+
/**
|
|
10
|
+
* Property describing whether the line has been fully drawn.
|
|
11
|
+
* If a line hasn't been drawn, it can be animated to draw in.
|
|
12
|
+
*/
|
|
13
|
+
drawn: boolean;
|
|
8
14
|
}
|
|
9
15
|
export declare class Line extends SlideObject<LineProps> {
|
|
10
16
|
constructor(props?: Partial<LineProps>);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ObjectProps, SlideObject } from "../presentation/object";
|
|
2
|
+
import { BuildFunction } from "../util/animation";
|
|
2
3
|
import { RichTextSpan } from "../util/richText";
|
|
3
4
|
export type TextContent = string | (string | RichTextSpan[])[];
|
|
4
5
|
export interface TextProps extends ObjectProps {
|
|
@@ -10,8 +11,10 @@ export interface TextProps extends ObjectProps {
|
|
|
10
11
|
color: string;
|
|
11
12
|
dominantBaseline: string;
|
|
12
13
|
textDecoration: string;
|
|
14
|
+
length: number | null;
|
|
13
15
|
align: "left" | "center" | "right";
|
|
14
16
|
lineSpacing: string;
|
|
17
|
+
ligatures: string | null;
|
|
15
18
|
}
|
|
16
19
|
export declare class Text extends SlideObject<TextProps> {
|
|
17
20
|
constructor(content: TextContent, props?: Partial<TextProps>);
|
|
@@ -26,4 +29,21 @@ export declare class Text extends SlideObject<TextProps> {
|
|
|
26
29
|
styles(): Partial<Record<string, string>>;
|
|
27
30
|
children(): Node[];
|
|
28
31
|
requiresChildrenUpdate(props: Partial<TextProps>): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the number of characters in the total text content.
|
|
34
|
+
*/
|
|
35
|
+
contentLength(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the children of a text node, up to a particular content length.
|
|
38
|
+
*/
|
|
39
|
+
childrenWithContentLength(length: number | null): Node[];
|
|
40
|
+
regenerateChildren(): void;
|
|
41
|
+
animate(props: Partial<TextProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a write-on animation for changing the characters.
|
|
44
|
+
*
|
|
45
|
+
* Writing on text requires a different approach than other text animations
|
|
46
|
+
* since the children of the element need to be replaced.
|
|
47
|
+
*/
|
|
48
|
+
writeOn(length?: number | null, duration?: number, animate?: boolean): BuildFunction;
|
|
29
49
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
import { ObjectProps, SlideObject } from "../presentation/object";
|
|
2
|
+
import { AnimationProps, BuildFunction } from "../util/animation";
|
|
2
3
|
export interface VectorGraphicProps extends ObjectProps {
|
|
3
4
|
svg: string;
|
|
4
5
|
width: number;
|
|
5
6
|
height: number;
|
|
6
7
|
}
|
|
8
|
+
interface DrawOnProps {
|
|
9
|
+
color: string;
|
|
10
|
+
strokeWidth: number;
|
|
11
|
+
fill: boolean;
|
|
12
|
+
fillColor: string | null;
|
|
13
|
+
drawDuration: number;
|
|
14
|
+
fillDuration: number;
|
|
15
|
+
easing: string;
|
|
16
|
+
}
|
|
7
17
|
export declare class VectorGraphic extends SlideObject<VectorGraphicProps> {
|
|
8
18
|
parsedChildren: Node[];
|
|
19
|
+
/**
|
|
20
|
+
* Returns an SVG node given string content.
|
|
21
|
+
*/
|
|
22
|
+
static svgNode(content: string): SVGElement;
|
|
9
23
|
constructor(svg: string, props?: Partial<VectorGraphicProps>);
|
|
10
24
|
tagName(): string;
|
|
11
25
|
createElement(): SVGElement;
|
|
12
26
|
attributes(): Partial<Record<string, string>>;
|
|
13
27
|
children(): Node[];
|
|
28
|
+
/**
|
|
29
|
+
* Perform animation on a particular path of the graphic.
|
|
30
|
+
* Requires specifying `attributes` or `styles` for path animation props.
|
|
31
|
+
*/
|
|
32
|
+
animatePath(selector: string, props: Partial<AnimationProps>, duration?: number, animate?: boolean): BuildFunction;
|
|
33
|
+
/**
|
|
34
|
+
* Sets path animation properties without animating.
|
|
35
|
+
*/
|
|
36
|
+
setPath(selector: string, props: Partial<AnimationProps>): BuildFunction;
|
|
37
|
+
/**
|
|
38
|
+
* Animates the drawing on of a particular path.
|
|
39
|
+
*/
|
|
40
|
+
drawOn(selector: string, props: Partial<DrawOnProps>): BuildFunction;
|
|
14
41
|
}
|
|
42
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BoundingBox, Position } from "../util/position";
|
|
2
2
|
import { Presentation } from "./presentation";
|
|
3
|
-
import {
|
|
3
|
+
import { BuildFunction } from "../util/animation";
|
|
4
|
+
export type Anchor = "topleft" | "top" | "topright" | "left" | "center" | "right" | "bottomleft" | "bottom" | "bottomright";
|
|
4
5
|
export interface ObjectProps {
|
|
5
6
|
position: Position | null;
|
|
6
7
|
opacity?: number;
|
|
7
|
-
anchor:
|
|
8
|
+
anchor: Anchor;
|
|
8
9
|
}
|
|
9
10
|
export declare class SlideObject<Props extends ObjectProps> {
|
|
10
11
|
/**
|
|
@@ -82,26 +83,34 @@ export declare class SlideObject<Props extends ObjectProps> {
|
|
|
82
83
|
* Returns an animation to perform.
|
|
83
84
|
* @param props Properties of object to change.
|
|
84
85
|
* @param animationParams Animation behavior parameters.
|
|
85
|
-
* @returns Animation
|
|
86
|
+
* @returns Animation build function.
|
|
86
87
|
*/
|
|
87
|
-
|
|
88
|
+
animate(props: Partial<Props>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
|
|
88
89
|
/**
|
|
89
90
|
* Returns an update animation that skips the animation and just performs the change.
|
|
90
91
|
* @param props Properties of object to change.
|
|
91
92
|
*/
|
|
92
|
-
|
|
93
|
+
set(props: Partial<Props>, delay?: number | null): BuildFunction;
|
|
93
94
|
/**
|
|
94
|
-
*
|
|
95
|
+
* Animates a movement of the object.
|
|
95
96
|
*/
|
|
96
|
-
|
|
97
|
+
move(position: Position, animationParams?: anime.AnimeParams): BuildFunction;
|
|
97
98
|
/**
|
|
98
|
-
*
|
|
99
|
+
* Animates fading an object into view.
|
|
99
100
|
*/
|
|
100
|
-
|
|
101
|
+
fadeIn(animationParams?: anime.AnimeParams): BuildFunction;
|
|
101
102
|
/**
|
|
102
|
-
* Animates
|
|
103
|
+
* Animates fading an object out of view.
|
|
103
104
|
*/
|
|
104
|
-
|
|
105
|
+
fadeOut(animationParams?: anime.AnimeParams): BuildFunction;
|
|
106
|
+
/**
|
|
107
|
+
* Sets an objects opacity to 1.
|
|
108
|
+
*/
|
|
109
|
+
show(): BuildFunction;
|
|
110
|
+
/**
|
|
111
|
+
* Sets an objects opacity to 0.
|
|
112
|
+
*/
|
|
113
|
+
hide(): BuildFunction;
|
|
105
114
|
/**
|
|
106
115
|
* Allow for x and y values to be interpreted as percentages of total width/height.
|
|
107
116
|
*/
|
|
@@ -38,6 +38,18 @@ export declare class Presentation {
|
|
|
38
38
|
* Shadow SVG element, not displayed and used for calculating sizes.
|
|
39
39
|
*/
|
|
40
40
|
shadow: SVGSVGElement | null;
|
|
41
|
+
/**
|
|
42
|
+
* Background SVG element, used for rendering background color.
|
|
43
|
+
*/
|
|
44
|
+
background: SVGSVGElement | null;
|
|
45
|
+
/**
|
|
46
|
+
* Additional element container for elements that aren't part of the SVG.
|
|
47
|
+
*/
|
|
48
|
+
additionalElementContainer: HTMLElement | null;
|
|
49
|
+
/**
|
|
50
|
+
* Element that allows navigation between different slides.
|
|
51
|
+
*/
|
|
52
|
+
navigatorContainer: HTMLElement | null;
|
|
41
53
|
/**
|
|
42
54
|
* Presentation settings.
|
|
43
55
|
*/
|
|
@@ -54,6 +66,20 @@ export declare class Presentation {
|
|
|
54
66
|
* Presentation state.
|
|
55
67
|
*/
|
|
56
68
|
presentationState: PresentationState;
|
|
69
|
+
/**
|
|
70
|
+
* Keyboard shortcut access to jump to particular slides.
|
|
71
|
+
*/
|
|
72
|
+
shortcuts: Record<string, {
|
|
73
|
+
slideIndex: number;
|
|
74
|
+
animationIndex: number;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Current text command that the presenter has entered into presentation.
|
|
78
|
+
*/
|
|
79
|
+
textCommand: {
|
|
80
|
+
active: boolean;
|
|
81
|
+
command: string;
|
|
82
|
+
};
|
|
57
83
|
/**
|
|
58
84
|
*
|
|
59
85
|
* @param title Title of the presentation.
|
|
@@ -64,6 +90,8 @@ export declare class Presentation {
|
|
|
64
90
|
* Sets up keyboard commands for the presentation.
|
|
65
91
|
*/
|
|
66
92
|
setupKeyboardCommands(): void;
|
|
93
|
+
handleKeyboardEvent(event: KeyboardEvent): void;
|
|
94
|
+
resetTextCommand(): void;
|
|
67
95
|
/**
|
|
68
96
|
* Updates the size of the parent SVG element.
|
|
69
97
|
*
|
|
@@ -75,7 +103,7 @@ export declare class Presentation {
|
|
|
75
103
|
* Returns true if we were able to successfully advance.
|
|
76
104
|
* @param includeIntermediateBuilds Determines whether to progress through builds.
|
|
77
105
|
*/
|
|
78
|
-
next(includeIntermediateBuilds: boolean): boolean
|
|
106
|
+
next(includeIntermediateBuilds: boolean): Promise<boolean>;
|
|
79
107
|
/**
|
|
80
108
|
* Goes back to the previous slide.
|
|
81
109
|
* @param includeIntermediateBuilds Determines whether to progress through builds.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildFunctionSequence } from "../util/animation";
|
|
2
2
|
import { SlideObject } from "./object";
|
|
3
3
|
import { Presentation } from "./presentation";
|
|
4
4
|
export interface SlideProps {
|
|
5
|
+
/**
|
|
6
|
+
* An optional title for the slide, shown in navigation bar.
|
|
7
|
+
*/
|
|
8
|
+
title: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Additional HTML element to show behind SVG content.
|
|
11
|
+
*/
|
|
12
|
+
additionalElement: HTMLElement | (() => HTMLElement) | null;
|
|
13
|
+
/**
|
|
14
|
+
* A shortcut allows a keyboard shortcut to link directly to a slide.
|
|
15
|
+
* Represented as either just a string (the shortcut),
|
|
16
|
+
* or a string and number (shortcut and animation index).
|
|
17
|
+
*/
|
|
18
|
+
shortcuts: (string | [string, number])[];
|
|
5
19
|
}
|
|
6
20
|
export declare class Slide {
|
|
7
21
|
objects: SlideObject<any>[];
|
|
8
|
-
animations:
|
|
22
|
+
animations: BuildFunctionSequence;
|
|
9
23
|
animationIndex: number;
|
|
10
24
|
/**
|
|
11
25
|
* Property for use during development/debugging only.
|
|
@@ -20,9 +34,10 @@ export declare class Slide {
|
|
|
20
34
|
* otherwise it can be an animationIndex in [0, animations.length].
|
|
21
35
|
*/
|
|
22
36
|
keyBuilds: "first" | "last" | "all" | "none" | number[] | null;
|
|
23
|
-
|
|
37
|
+
props: SlideProps;
|
|
38
|
+
constructor(objects: SlideObject<any>[], animations?: BuildFunctionSequence, props?: Partial<SlideProps>);
|
|
24
39
|
render(presentation: Presentation, animationIndex?: number): void;
|
|
25
|
-
nextAnimation(
|
|
40
|
+
nextAnimation(): Promise<boolean>;
|
|
26
41
|
/**
|
|
27
42
|
* Returns the build indices that are meant to be exported.
|
|
28
43
|
*/
|
|
@@ -17,6 +17,12 @@ export interface AnimationProps {
|
|
|
17
17
|
* Delay, in milliseconds.
|
|
18
18
|
*/
|
|
19
19
|
delay?: number;
|
|
20
|
+
/**
|
|
21
|
+
* An animation can also specify custom functions that can be called to
|
|
22
|
+
* perform an animation or update to the end state of the animation.
|
|
23
|
+
*/
|
|
24
|
+
animateCallback?: () => void;
|
|
25
|
+
updateCallback?: () => void;
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Function that performs an animation on an element.
|
|
@@ -26,6 +32,13 @@ export type Animator = (props: AnimationProps | AnimationProps[]) => Promise<voi
|
|
|
26
32
|
* Function that possibly applies a sequence of animations.
|
|
27
33
|
*/
|
|
28
34
|
export type BuildFunction = (animate: Animator) => void;
|
|
35
|
+
/**
|
|
36
|
+
* A build function sequence is a sequence, where each element is a build
|
|
37
|
+
* function or a list of build functions to be performed on the same build.
|
|
38
|
+
*
|
|
39
|
+
* In a list of build functions, a number in place of a build function represents a delay.
|
|
40
|
+
*/
|
|
41
|
+
export type BuildFunctionSequence = (BuildFunction | (BuildFunction | number)[])[];
|
|
29
42
|
/**
|
|
30
43
|
* Perform an animation on an element.
|
|
31
44
|
* @param props Animation properties.
|
|
@@ -36,3 +49,12 @@ export declare const performAnimation: Animator;
|
|
|
36
49
|
* @param props Animation properties.
|
|
37
50
|
*/
|
|
38
51
|
export declare const skipAnimation: Animator;
|
|
52
|
+
/**
|
|
53
|
+
* When performing animations on non-DOM elements, e.g. variables in the state
|
|
54
|
+
* of a Three.js scene, we need a unchanging reference to state that may get
|
|
55
|
+
* replaced. That state can hold any type.
|
|
56
|
+
*/
|
|
57
|
+
export interface StateContainer<T> {
|
|
58
|
+
state: T;
|
|
59
|
+
}
|
|
60
|
+
export declare function animateStateChange<T>(state: StateContainer<T>, finalState: Partial<T>, duration?: number): BuildFunction;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clamps a value to a given range.
|
|
3
|
+
*/
|
|
4
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Maps a [0, 1] value linearly onto [0, 1].
|
|
7
|
+
*/
|
|
8
|
+
export declare function easeLinear(value: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Maps a [0, 1] value onto [0, 1] via a smoothstep cubic easing function.
|
|
11
|
+
*/
|
|
12
|
+
export declare function easeCubic(value: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/webpack.config.d.ts
CHANGED
|
@@ -1,9 +1,57 @@
|
|
|
1
1
|
export let mode: string;
|
|
2
|
-
export
|
|
2
|
+
export namespace entry {
|
|
3
|
+
export namespace presenter {
|
|
4
|
+
let _import: string;
|
|
5
|
+
export { _import as import };
|
|
6
|
+
export let filename: string;
|
|
7
|
+
export namespace library {
|
|
8
|
+
let name: string;
|
|
9
|
+
let type: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export namespace _export {
|
|
13
|
+
let _import_1: string;
|
|
14
|
+
export { _import_1 as import };
|
|
15
|
+
let filename_1: string;
|
|
16
|
+
export { filename_1 as filename };
|
|
17
|
+
export namespace library_1 {
|
|
18
|
+
let name_1: string;
|
|
19
|
+
export { name_1 as name };
|
|
20
|
+
let type_1: string;
|
|
21
|
+
export { type_1 as type };
|
|
22
|
+
}
|
|
23
|
+
export { library_1 as library };
|
|
24
|
+
}
|
|
25
|
+
export { _export as export };
|
|
26
|
+
export namespace morph {
|
|
27
|
+
let _import_2: string;
|
|
28
|
+
export { _import_2 as import };
|
|
29
|
+
let filename_2: string;
|
|
30
|
+
export { filename_2 as filename };
|
|
31
|
+
export namespace library_2 {
|
|
32
|
+
let name_2: string;
|
|
33
|
+
export { name_2 as name };
|
|
34
|
+
let type_2: string;
|
|
35
|
+
export { type_2 as type };
|
|
36
|
+
}
|
|
37
|
+
export { library_2 as library };
|
|
38
|
+
}
|
|
39
|
+
export namespace code {
|
|
40
|
+
let _import_3: string;
|
|
41
|
+
export { _import_3 as import };
|
|
42
|
+
let filename_3: string;
|
|
43
|
+
export { filename_3 as filename };
|
|
44
|
+
export namespace library_3 {
|
|
45
|
+
let name_3: string;
|
|
46
|
+
export { name_3 as name };
|
|
47
|
+
let type_3: string;
|
|
48
|
+
export { type_3 as type };
|
|
49
|
+
}
|
|
50
|
+
export { library_3 as library };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
3
53
|
export namespace output {
|
|
4
|
-
let filename: string;
|
|
5
54
|
let path: string;
|
|
6
|
-
let library: string;
|
|
7
55
|
let libraryTarget: string;
|
|
8
56
|
let globalObject: string;
|
|
9
57
|
}
|