presenter 0.5.4 → 0.6.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.
Files changed (164) hide show
  1. package/README.md +0 -54
  2. package/dist/eslint.config.d.mts +2 -0
  3. package/dist/export.js +1 -0
  4. package/dist/jest.config.d.ts +0 -2
  5. package/dist/presenter.js +1 -1
  6. package/dist/src/constructors/Grid.d.ts +21 -0
  7. package/dist/src/export/image-renderer/ImageRenderer.d.ts +9 -0
  8. package/dist/src/export/image-renderer/types/ImageRendererProps.d.ts +26 -0
  9. package/dist/src/export/image-renderer/types/ImageRendererState.d.ts +8 -0
  10. package/dist/src/export/index.d.ts +2 -24
  11. package/dist/src/export/pdf-renderer/PDFRenderer.d.ts +10 -0
  12. package/dist/src/export/pdf-renderer/types/PDFRendererProps.d.ts +8 -0
  13. package/dist/src/export/pdf-renderer/types/PDFRendererState.d.ts +5 -0
  14. package/dist/src/export/utils/createCanvasElement.d.ts +3 -0
  15. package/dist/src/export/utils/createPath2D.d.ts +2 -0
  16. package/dist/src/export/utils/loadPresentationImages.d.ts +2 -0
  17. package/dist/src/index.d.ts +43 -25
  18. package/dist/src/navigator/openNavigator.d.ts +8 -0
  19. package/dist/src/objects/Arrow.d.ts +18 -0
  20. package/dist/src/objects/Circle.d.ts +16 -0
  21. package/dist/src/objects/Group.d.ts +17 -0
  22. package/dist/src/objects/Image.d.ts +15 -0
  23. package/dist/src/objects/Line.d.ts +15 -0
  24. package/dist/src/objects/Mask.d.ts +15 -0
  25. package/dist/src/objects/Path.d.ts +19 -0
  26. package/dist/src/objects/Polygon.d.ts +13 -0
  27. package/dist/src/objects/Rectangle.d.ts +18 -0
  28. package/dist/src/objects/Text.d.ts +25 -0
  29. package/dist/src/renderer/browser-canvas/BrowserCanvasRenderer.d.ts +12 -0
  30. package/dist/src/renderer/browser-canvas/objects/renderArrow.d.ts +3 -0
  31. package/dist/src/renderer/browser-canvas/objects/renderCircle.d.ts +3 -0
  32. package/dist/src/renderer/browser-canvas/objects/renderGroup.d.ts +3 -0
  33. package/dist/src/renderer/browser-canvas/objects/renderImage.d.ts +3 -0
  34. package/dist/src/renderer/browser-canvas/objects/renderLine.d.ts +3 -0
  35. package/dist/src/renderer/browser-canvas/objects/renderMask.d.ts +3 -0
  36. package/dist/src/renderer/browser-canvas/objects/renderPath.d.ts +3 -0
  37. package/dist/src/renderer/browser-canvas/objects/renderPolygon.d.ts +3 -0
  38. package/dist/src/renderer/browser-canvas/objects/renderRectangle.d.ts +3 -0
  39. package/dist/src/renderer/browser-canvas/objects/renderText.d.ts +3 -0
  40. package/dist/src/renderer/browser-canvas/types/BrowserCanvasObjectRenderer.d.ts +13 -0
  41. package/dist/src/renderer/browser-canvas/types/BrowserCanvasRendererProps.d.ts +9 -0
  42. package/dist/src/renderer/browser-canvas/types/BrowserCanvasRendererState.d.ts +16 -0
  43. package/dist/src/renderer/browser-canvas/types/UnifiedCanvasContext.d.ts +18 -0
  44. package/dist/src/renderer/browser-canvas/types/UnifiedImage.d.ts +18 -0
  45. package/dist/src/renderer/browser-canvas/types/UnifiedPath2D.d.ts +18 -0
  46. package/dist/src/renderer/browser-canvas/utils/clearCanvas.d.ts +2 -0
  47. package/dist/src/renderer/browser-canvas/utils/createCanvasElement.d.ts +2 -0
  48. package/dist/src/renderer/browser-canvas/utils/createPath2D.d.ts +2 -0
  49. package/dist/src/renderer/browser-canvas/utils/defaultObjectRenderers.d.ts +10 -0
  50. package/dist/src/renderer/browser-canvas/utils/drawStroke.d.ts +15 -0
  51. package/dist/src/renderer/browser-canvas/utils/fillPath.d.ts +11 -0
  52. package/dist/src/renderer/browser-canvas/utils/getPathFromPoints.d.ts +4 -0
  53. package/dist/src/renderer/browser-canvas/utils/getSizeFromTextMetrics.d.ts +2 -0
  54. package/dist/src/renderer/browser-canvas/utils/loadPresentationImages.d.ts +2 -0
  55. package/dist/src/renderer/browser-canvas/utils/text/getTextUnitMeasurements.d.ts +5 -0
  56. package/dist/src/renderer/browser-canvas/utils/text/setContextWithTextStyle.d.ts +3 -0
  57. package/dist/src/types/Alignment.d.ts +7 -0
  58. package/dist/src/types/Anchor.d.ts +13 -0
  59. package/dist/src/types/Animate.d.ts +18 -0
  60. package/dist/src/types/AnimationType.d.ts +9 -0
  61. package/dist/src/types/BaseUnitSlideAnimation.d.ts +7 -0
  62. package/dist/src/types/BoundingBox.d.ts +10 -0
  63. package/dist/src/types/Color.d.ts +23 -0
  64. package/dist/src/types/Easing.d.ts +10 -0
  65. package/dist/src/types/EasingFunction.d.ts +2 -0
  66. package/dist/src/types/FontStyle.d.ts +8 -0
  67. package/dist/src/types/FontWeight.d.ts +13 -0
  68. package/dist/src/types/Interpolator.d.ts +7 -0
  69. package/dist/src/types/ObjectType.d.ts +14 -0
  70. package/dist/src/types/PathWithLength.d.ts +5 -0
  71. package/dist/src/types/Pause.d.ts +7 -0
  72. package/dist/src/types/Position.d.ts +6 -0
  73. package/dist/src/types/Presentation.d.ts +17 -0
  74. package/dist/src/types/Resources.d.ts +5 -0
  75. package/dist/src/types/ShortcutState.d.ts +13 -0
  76. package/dist/src/types/Size.d.ts +6 -0
  77. package/dist/src/types/Slide.d.ts +12 -0
  78. package/dist/src/types/SlideAnimation.d.ts +6 -0
  79. package/dist/src/types/SlideObject.d.ts +5 -0
  80. package/dist/src/types/TextContent.d.ts +2 -0
  81. package/dist/src/types/TextStyle.d.ts +12 -0
  82. package/dist/src/types/TextUnit.d.ts +6 -0
  83. package/dist/src/types/Update.d.ts +9 -0
  84. package/dist/src/utils/animate/getSlideAnimationDuration.d.ts +2 -0
  85. package/dist/src/utils/animate/updateObjectStateWithAnimation.d.ts +13 -0
  86. package/dist/src/utils/color/Opaque.d.ts +2 -0
  87. package/dist/src/utils/color/Transparent.d.ts +2 -0
  88. package/dist/src/utils/color/getAlphaForColor.d.ts +6 -0
  89. package/dist/src/utils/color/getHexStringForColor.d.ts +2 -0
  90. package/dist/src/utils/color/getRgbStringForColor.d.ts +2 -0
  91. package/dist/src/utils/core/assertNever.d.ts +1 -0
  92. package/dist/src/utils/interpolate/defaultInterpolators.d.ts +2 -0
  93. package/dist/src/utils/interpolate/getSmoothPathInterpolator.d.ts +2 -0
  94. package/dist/src/utils/interpolate/interpolate.d.ts +3 -0
  95. package/dist/src/utils/interpolate/interpolateColor.d.ts +3 -0
  96. package/dist/src/utils/interpolate/interpolateFallback.d.ts +3 -0
  97. package/dist/src/utils/interpolate/interpolateNumber.d.ts +2 -0
  98. package/dist/src/utils/layout/getBoundingBox.d.ts +5 -0
  99. package/dist/src/utils/layout/getSizingFunctions.d.ts +10 -0
  100. package/dist/src/utils/objects/arrow/getArrowPoints.d.ts +9 -0
  101. package/dist/src/utils/objects/circle/getCirclePath.d.ts +4 -0
  102. package/dist/src/utils/objects/line/getLinePath.d.ts +4 -0
  103. package/dist/src/utils/objects/polygon/getPolygonPath.d.ts +4 -0
  104. package/dist/src/utils/objects/rectangle/getRectanglePath.d.ts +4 -0
  105. package/dist/src/utils/objects/rectangle/getRoundedRectanglePath.d.ts +5 -0
  106. package/dist/src/utils/objects/text/getTextContentLength.d.ts +2 -0
  107. package/dist/src/utils/objects/text/getTextStyleFromText.d.ts +3 -0
  108. package/dist/src/utils/objects/text/getTextUnitsFromTextContent.d.ts +3 -0
  109. package/dist/src/utils/presentation/createPresentationContainer.d.ts +2 -0
  110. package/dist/src/utils/presentation/getObjectChildren.d.ts +5 -0
  111. package/dist/src/utils/presentation/getObjectState.d.ts +12 -0
  112. package/dist/src/utils/presentation/getPresentationShortcuts.d.ts +3 -0
  113. package/dist/src/utils/presentation/isFullBodyPresentation.d.ts +1 -0
  114. package/dist/src/utils/presentation/setupKeyEventListeners.d.ts +10 -0
  115. package/dist/src/utils/size/getCombinedSizes2D.d.ts +7 -0
  116. package/dist/src/utils/slide/getKeySlideBuildIndices.d.ts +5 -0
  117. package/dist/src/utils/storage/StorageState.d.ts +5 -0
  118. package/dist/src/utils/storage/loadPresentationState.d.ts +3 -0
  119. package/dist/src/utils/storage/storageConsts.d.ts +1 -0
  120. package/dist/src/utils/storage/storePresentationState.d.ts +2 -0
  121. package/package.json +21 -26
  122. package/dist/354.js +0 -2
  123. package/dist/354.js.LICENSE.txt +0 -20
  124. package/dist/418.js +0 -2
  125. package/dist/418.js.LICENSE.txt +0 -1
  126. package/dist/661.js +0 -1
  127. package/dist/presenter-code.js +0 -1
  128. package/dist/presenter-export.js +0 -2
  129. package/dist/presenter-export.js.LICENSE.txt +0 -313
  130. package/dist/presenter-morph.js +0 -1
  131. package/dist/src/code/codeBlock.d.ts +0 -108
  132. package/dist/src/code/index.d.ts +0 -1
  133. package/dist/src/export/util.d.ts +0 -4
  134. package/dist/src/library/bullets.d.ts +0 -15
  135. package/dist/src/library/mainTitle.d.ts +0 -4
  136. package/dist/src/library/slideTitle.d.ts +0 -4
  137. package/dist/src/morph/index.d.ts +0 -34
  138. package/dist/src/objects/arrow.d.ts +0 -62
  139. package/dist/src/objects/circle.d.ts +0 -24
  140. package/dist/src/objects/grid.d.ts +0 -17
  141. package/dist/src/objects/group.d.ts +0 -29
  142. package/dist/src/objects/iframe.d.ts +0 -16
  143. package/dist/src/objects/image.d.ts +0 -20
  144. package/dist/src/objects/line.d.ts +0 -21
  145. package/dist/src/objects/mask.d.ts +0 -13
  146. package/dist/src/objects/paragraph.d.ts +0 -21
  147. package/dist/src/objects/path.d.ts +0 -29
  148. package/dist/src/objects/polygon.d.ts +0 -13
  149. package/dist/src/objects/rectangle.d.ts +0 -26
  150. package/dist/src/objects/screenCapture.d.ts +0 -17
  151. package/dist/src/objects/text.d.ts +0 -67
  152. package/dist/src/objects/vectorGraphic.d.ts +0 -48
  153. package/dist/src/presentation/object.d.ts +0 -132
  154. package/dist/src/presentation/presentation.d.ts +0 -153
  155. package/dist/src/presentation/presentation.test.d.ts +0 -1
  156. package/dist/src/presentation/slide.d.ts +0 -43
  157. package/dist/src/presentation/storage.d.ts +0 -9
  158. package/dist/src/util/animation.d.ts +0 -60
  159. package/dist/src/util/easing.d.ts +0 -12
  160. package/dist/src/util/easing.test.d.ts +0 -1
  161. package/dist/src/util/position.d.ts +0 -11
  162. package/dist/src/util/richText.d.ts +0 -19
  163. package/dist/webpack.config.d.ts +0 -70
  164. /package/dist/src/{objects/text.test.d.ts → utils/size/getCombinedSizes2D.test.d.ts} +0 -0
@@ -1,62 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { BuildFunction } from "../util/animation";
3
- import { Position } from "../util/position";
4
- import { Line } from "./line";
5
- import { Path } from "./path";
6
- import { Polygon } from "./polygon";
7
- export interface ArrowProps extends ObjectProps {
8
- start: Position;
9
- end: Position;
10
- color: string;
11
- width: number;
12
- arrowSize: number;
13
- filledHead: boolean;
14
- doubledHead: boolean;
15
- growFromCenter: boolean;
16
- /**
17
- * Property describing whether the arrow has been fully drawn.
18
- * If an arrow hasn't been drawn, it can be animated to draw in.
19
- */
20
- drawn: boolean;
21
- /**
22
- * The start and end points can have "padding".
23
- * This is equivalent to adding (x, y) values to the start and end points.
24
- *
25
- * This can be useful when drawing an arrow from an object at a particular
26
- * location. The arrow's start/end point can match the object's, with some
27
- * added padding so that the arrow doesn't overlap the object.
28
- *
29
- * It can also be useful if multiple arrows start or end at the same place,
30
- * and you want to adjust their endpoints slightly to avoid overlap.
31
- */
32
- padStart: Partial<Position>;
33
- padEnd: Partial<Position>;
34
- }
35
- export declare class Arrow extends SlideObject<ArrowProps> {
36
- line: Line | null;
37
- arrowhead: Polygon | Path | null;
38
- doubledArrowhead: Polygon | Path | null;
39
- constructor(props?: Partial<ArrowProps>);
40
- tagName(): string;
41
- /**
42
- * Computes coordinates for the line and arrowhead of the arrow.
43
- */
44
- calculateShapes(props: ArrowProps): {
45
- line: {
46
- start: Position;
47
- end: {
48
- x: number;
49
- y: number;
50
- };
51
- };
52
- arrowhead: Position[];
53
- doubledArrowhead: Position[];
54
- };
55
- children(): Node[];
56
- animate(props: Partial<ArrowProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
57
- draw(animationParams?: anime.AnimeParams): BuildFunction;
58
- /**
59
- * Returns animations for changes in arrowhead.
60
- */
61
- animateArrow(arrowProps: Partial<ArrowProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
62
- }
@@ -1,24 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { BuildFunction } from "../util/animation";
3
- export interface CircleProps extends ObjectProps {
4
- fill: string;
5
- radius: number;
6
- borderWidth: number;
7
- borderColor: string;
8
- drawn: boolean;
9
- }
10
- interface PathDrawOnProps {
11
- drawDuration: number;
12
- fillDuration: number;
13
- easing: string;
14
- }
15
- export declare class Circle extends SlideObject<CircleProps> {
16
- constructor(props?: Partial<CircleProps>);
17
- tagName(): string;
18
- attributes(): Partial<Record<string, string>>;
19
- animate(props: Partial<CircleProps>, animationParams?: anime.AnimeParams & {
20
- fillDuration?: number;
21
- }, delay?: number | null, animate?: boolean): BuildFunction;
22
- drawOn(props?: Partial<PathDrawOnProps>): BuildFunction;
23
- }
24
- export {};
@@ -1,17 +0,0 @@
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,29 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { Position } from "../util/position";
3
- export interface GroupProps extends ObjectProps {
4
- /**
5
- * A positioned group places the group's anchor at a particular coordinate.
6
- * A non-positioned group uses the position as an offset for its children.
7
- */
8
- positioned: boolean;
9
- objects: SlideObject<any>[];
10
- rotation: number;
11
- rotationOrigin: Position;
12
- transformOrigin: Position | string | null;
13
- scale: number;
14
- skewX: number;
15
- skewY: number;
16
- }
17
- export declare class Group extends SlideObject<GroupProps> {
18
- constructor(objects: SlideObject<any>[], props?: Partial<GroupProps>, positioned?: boolean | null);
19
- tagName(): string;
20
- attributes(): Partial<Record<string, string>>;
21
- additionalAttributes(): Partial<Record<string, string>>;
22
- /**
23
- * Returns the element to be used for computing the bounding box of the group.
24
- * Allows overriding so that sometimes we can use custom rules for determining
25
- * a group's bounding box.
26
- */
27
- sizingElement(): SVGGraphicsElement;
28
- children(): Node[];
29
- }
@@ -1,16 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- export interface IFrameProps extends ObjectProps {
3
- url: string;
4
- width: number;
5
- height: number;
6
- backgroundColor: string;
7
- pointerEvents: string;
8
- scale: number;
9
- }
10
- export declare class IFrame extends SlideObject<IFrameProps> {
11
- constructor(props?: Partial<IFrameProps>);
12
- tagName(): string;
13
- attributes(): Partial<Record<string, string>>;
14
- styles(): Partial<Record<string, string>>;
15
- children(): Node[];
16
- }
@@ -1,20 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- export interface ImageProps extends ObjectProps {
3
- href: string;
4
- width: number;
5
- height: number;
6
- rounding: number;
7
- }
8
- export declare class Image extends SlideObject<ImageProps> {
9
- constructor(href: string, props?: Partial<ImageProps>);
10
- tagName(): string;
11
- attributes(): Partial<Record<string, string>>;
12
- styles(): Partial<Record<string, string>>;
13
- /**
14
- * By default, browsers might not fetch an image until the image element is
15
- * added to the DOM. Pre-fetching them when the image object is created
16
- * means the image will be fetched before the slide is rendered, so there's
17
- * no delay between the slide appearing and the image loading.
18
- */
19
- static prefetch(href: string): void;
20
- }
@@ -1,21 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { BuildFunction } from "../util/animation";
3
- import { Position } from "../util/position";
4
- export interface LineProps extends ObjectProps {
5
- start: Position;
6
- end: Position;
7
- color: string;
8
- width: number;
9
- linecap: "butt" | "round" | "square" | null;
10
- /**
11
- * Property describing whether the line has been fully drawn.
12
- * If a line hasn't been drawn, it can be animated to draw in.
13
- */
14
- drawn: boolean;
15
- }
16
- export declare class Line extends SlideObject<LineProps> {
17
- constructor(props?: Partial<LineProps>);
18
- tagName(): string;
19
- attributes(): Partial<Record<string, string>>;
20
- animate(props: Partial<LineProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
21
- }
@@ -1,13 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- export interface MaskProps extends ObjectProps {
3
- id: string;
4
- objects: SlideObject<any>[];
5
- }
6
- export declare class Mask extends SlideObject<MaskProps> {
7
- id: string;
8
- static maskIndex: number;
9
- constructor(objects: SlideObject<any>[], props?: Partial<MaskProps>);
10
- tagName(): string;
11
- attributes(): Partial<Record<string, string>>;
12
- children(): Node[];
13
- }
@@ -1,21 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- export interface ParagraphProps extends ObjectProps {
3
- content: string | string[];
4
- width: number;
5
- height: number;
6
- fontStyle: string;
7
- fontWeight: string | number;
8
- fontSize: number;
9
- fontFamily: string;
10
- color: string;
11
- align: "left" | "center" | "right";
12
- lineHeight: number | string | null;
13
- }
14
- export declare class Paragraph extends SlideObject<ParagraphProps> {
15
- constructor(content: string | string[], props?: Partial<ParagraphProps>);
16
- tagName(): string;
17
- attributes(): Partial<Record<string, string>>;
18
- children(): Node[];
19
- additionalAttributes(): Partial<Record<string, string>>;
20
- requiresChildrenUpdate(props: Partial<ParagraphProps>): boolean;
21
- }
@@ -1,29 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { BuildFunction } from "../util/animation";
3
- import { Position } from "../util/position";
4
- export interface PathProps extends ObjectProps {
5
- points: Position[];
6
- color: string;
7
- fill: string;
8
- width: number;
9
- linecap: "butt" | "round" | "square" | null;
10
- drawn: boolean;
11
- }
12
- interface PathDrawOnProps {
13
- drawDuration: number;
14
- fillDuration: number;
15
- easing: string;
16
- }
17
- export declare class Path extends SlideObject<PathProps> {
18
- constructor(props?: Partial<PathProps>);
19
- tagName(): string;
20
- attributes(): Partial<Record<string, string>>;
21
- animate(props: Partial<PathProps>, animationParams?: anime.AnimeParams & {
22
- fillDuration?: number;
23
- }, delay?: number | null, animate?: boolean): BuildFunction;
24
- /**
25
- * Animates drawing of SVG path.
26
- */
27
- drawOn(props?: Partial<PathDrawOnProps>): BuildFunction;
28
- }
29
- export {};
@@ -1,13 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { Position } from "../util/position";
3
- export interface PolygonProps extends ObjectProps {
4
- points: Position[];
5
- fill: string;
6
- borderWidth: number;
7
- borderColor: string;
8
- }
9
- export declare class Polygon extends SlideObject<PolygonProps> {
10
- constructor(points: Position[], props?: Partial<PolygonProps>);
11
- tagName(): string;
12
- attributes(): Partial<Record<string, string>>;
13
- }
@@ -1,26 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { BuildFunction } from "../util/animation";
3
- export interface RectangleProps extends ObjectProps {
4
- fill: string;
5
- width: number;
6
- height: number;
7
- rounding: number;
8
- borderWidth: number;
9
- borderColor: string;
10
- drawn: boolean;
11
- }
12
- interface PathDrawOnProps {
13
- drawDuration: number;
14
- fillDuration: number;
15
- easing: string;
16
- }
17
- export declare class Rectangle extends SlideObject<RectangleProps> {
18
- constructor(props?: Partial<RectangleProps>);
19
- tagName(): string;
20
- attributes(): Partial<Record<string, string>>;
21
- animate(props: Partial<RectangleProps>, animationParams?: anime.AnimeParams & {
22
- fillDuration?: number;
23
- }, delay?: number | null, animate?: boolean): BuildFunction;
24
- drawOn(props?: Partial<PathDrawOnProps>): BuildFunction;
25
- }
26
- export {};
@@ -1,17 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- export interface ScreenCaptureProps extends ObjectProps {
3
- width: string | number | null;
4
- height: string | number | null;
5
- scale: number;
6
- align: "left" | "center" | "right";
7
- }
8
- export declare class ScreenCapture extends SlideObject<ScreenCaptureProps> {
9
- videoElement: HTMLVideoElement | null;
10
- constructor(props?: Partial<ScreenCaptureProps>);
11
- tagName(): string;
12
- attributes(): Partial<Record<string, string>>;
13
- styles(): {
14
- "text-align": "left" | "center" | "right";
15
- };
16
- children(): HTMLVideoElement[];
17
- }
@@ -1,67 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { BuildFunction } from "../util/animation";
3
- import { RichTextSpan } from "../util/richText";
4
- export type TextContent = string | (string | RichTextSpan[])[];
5
- export interface TextProps extends ObjectProps {
6
- content: TextContent;
7
- fontStyle: string;
8
- fontWeight: string | number;
9
- fontSize: number;
10
- fontFamily: string;
11
- color: string;
12
- dominantBaseline: string;
13
- textDecoration: string;
14
- smallCaps: boolean;
15
- baselineHeight: number;
16
- length: number | null;
17
- align: "left" | "center" | "right";
18
- lineSpacing: string;
19
- ligatures: string | null;
20
- }
21
- export declare class Text extends SlideObject<TextProps> {
22
- constructor(content: TextContent, props?: Partial<TextProps>);
23
- isRichText(): boolean;
24
- tagName(): string;
25
- attributes(): Partial<Record<string, string>>;
26
- /**
27
- * Text elements return position as additional attributes since computing text
28
- * size and position requires other properties to be set first.
29
- */
30
- additionalAttributes(): Partial<Record<string, string>>;
31
- styles(): Partial<Record<string, string>>;
32
- children(): Node[];
33
- requiresChildrenUpdate(props: Partial<TextProps>): boolean;
34
- /**
35
- * Returns the number of characters in the total text content.
36
- * Optional argument: `throughLine` to return number of characters
37
- * through the end of that line, assuming multi-line content.
38
- * Defaults to `null`, which considers the full text.
39
- */
40
- contentLength(throughLine?: number | null): number;
41
- /**
42
- * Returns the children of a text node, up to a particular content length.
43
- */
44
- childrenWithContentLength(length: number | null): Node[];
45
- regenerateChildren(): void;
46
- animate(props: Partial<TextProps>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
47
- /**
48
- * Returns a write-on animation for changing the characters.
49
- *
50
- * Writing on text requires a different approach than other text animations
51
- * since the children of the element need to be replaced.
52
- */
53
- writeOn(length?: number | null, duration?: number, animate?: boolean): BuildFunction;
54
- /**
55
- * Sets position attributes of text and re-generates any children.
56
- *
57
- * This is because re-generating children alone won't change the position
58
- * attributes, which menas the text might be mis-aligned.
59
- */
60
- generateChildrenAndReposition(): void;
61
- /**
62
- * Animates the content of a text element via an
63
- * interpolation function that returns the text content
64
- * for a given progress amount.
65
- */
66
- animateContent(computeContent: (proportion: number) => TextContent, duration?: number): BuildFunction;
67
- }
@@ -1,48 +0,0 @@
1
- import { ObjectProps, SlideObject } from "../presentation/object";
2
- import { AnimationProps, BuildFunction } from "../util/animation";
3
- export interface VectorGraphicProps extends ObjectProps {
4
- svg: string;
5
- width: number;
6
- height: number;
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
- pathLength: number | null;
17
- /**
18
- * Controls whether there should still be a stroke present at end of animation.
19
- * If `endWithoutStroke` is true, the stroke width fades out to 0 at the end.
20
- */
21
- endWithoutStroke: boolean;
22
- }
23
- export declare class VectorGraphic extends SlideObject<VectorGraphicProps> {
24
- parsedChildren: Node[];
25
- /**
26
- * Returns an SVG node given string content.
27
- */
28
- static svgNode(content: string): SVGElement;
29
- constructor(svg: string, props?: Partial<VectorGraphicProps>);
30
- tagName(): string;
31
- createElement(): SVGElement;
32
- attributes(): Partial<Record<string, string>>;
33
- children(): Node[];
34
- /**
35
- * Perform animation on a particular path of the graphic.
36
- * Requires specifying `attributes` or `styles` for path animation props.
37
- */
38
- animatePath(selector: string, props: Partial<AnimationProps>, duration?: number, animate?: boolean): BuildFunction;
39
- /**
40
- * Sets path animation properties without animating.
41
- */
42
- setPath(selector: string, props: Partial<AnimationProps>): BuildFunction;
43
- /**
44
- * Animates the drawing on of a particular path.
45
- */
46
- drawOn(selector: string, props?: Partial<DrawOnProps>): BuildFunction;
47
- }
48
- export {};
@@ -1,132 +0,0 @@
1
- import { BoundingBox, Position } from "../util/position";
2
- import { Presentation } from "./presentation";
3
- import { BuildFunction } from "../util/animation";
4
- export type Anchor = "topleft" | "top" | "topright" | "left" | "center" | "right" | "bottomleft" | "bottom" | "bottomright";
5
- export interface ObjectProps {
6
- position: Position | null;
7
- opacity?: number;
8
- anchor: Anchor;
9
- mask?: string;
10
- }
11
- export declare class SlideObject<Props extends ObjectProps> {
12
- /**
13
- * Starting values for each property.
14
- */
15
- initialProps: Props;
16
- /**
17
- * Current values for each property.
18
- */
19
- props: Props;
20
- _presentation: Presentation | null;
21
- _element: SVGElement | null;
22
- _children: Node[];
23
- /**
24
- * Initializes a new object to include on a slide.
25
- * @param props Object properties.
26
- */
27
- constructor(props: Partial<Props>);
28
- /**
29
- * Returns the tag name of the element.
30
- * @returns Tag name.
31
- */
32
- tagName(): string;
33
- /**
34
- * Returns the DOM attributes that should be set for the element.
35
- * @returns Object with attribute names and values.
36
- */
37
- attributes(): Partial<Record<string, string>>;
38
- /**
39
- * Returns additional DOM attributes to be set for the element.
40
- * Some attributes can't be computed until after an element's other properties are set:
41
- * e.g. text position depends on content and font size.
42
- * Additional attributes are computed after all other attributes, styles, and children.
43
- * @returns Object with attribute names and values.
44
- */
45
- additionalAttributes(): Partial<Record<string, string>>;
46
- /**
47
- * Returns the styles that should be set for the element.
48
- * @returns Object with style names and values.
49
- */
50
- styles(): Partial<Record<string, string>>;
51
- /**
52
- * Returns the children that should be rendered for the object.
53
- * @returns Array of SVG elements.
54
- */
55
- children(): Node[];
56
- /**
57
- * Given a set of prop updates, checks if the children of the object need to be updated.
58
- * @param props Properties to update.
59
- * @returns Boolean indicating whether children need to be updated.
60
- */
61
- requiresChildrenUpdate(props: Partial<Props>): boolean;
62
- /**
63
- * Given a particular initial bounding box, returns the DOM position attributes that should be set for the element.
64
- * @param bbox Bounding box.
65
- * @returns Object with attribute names and values.
66
- */
67
- positionAttributes(bbox: BoundingBox): any;
68
- /**
69
- * Re-generates the SVG element for the object.
70
- * @param presentation Presentation object.
71
- * @returns SVG element.
72
- */
73
- generate(presentation: Presentation): SVGElement;
74
- /**
75
- * Creates a new HTML element for the object.
76
- */
77
- createElement(): SVGElement;
78
- /**
79
- * Returns the element for the object.
80
- * @returns SVG element.
81
- */
82
- element(): SVGElement;
83
- /**
84
- * Returns an animation to perform.
85
- * @param props Properties of object to change.
86
- * @param animationParams Animation behavior parameters.
87
- * @returns Animation build function.
88
- */
89
- animate(props: Partial<Props>, animationParams?: anime.AnimeParams, delay?: number | null, animate?: boolean): BuildFunction;
90
- /**
91
- * Returns an update animation that skips the animation and just performs the change.
92
- * @param props Properties of object to change.
93
- */
94
- set(props: Partial<Props>, delay?: number | null): BuildFunction;
95
- /**
96
- * Animates a movement of the object.
97
- */
98
- move(position: Position, animationParams?: anime.AnimeParams): BuildFunction;
99
- /**
100
- * Animates fading an object into view.
101
- */
102
- fadeIn(animationParams?: anime.AnimeParams): BuildFunction;
103
- /**
104
- * Animates fading an object out of view.
105
- */
106
- fadeOut(animationParams?: anime.AnimeParams): BuildFunction;
107
- /**
108
- * Sets an objects opacity to 1.
109
- */
110
- show(): BuildFunction;
111
- /**
112
- * Sets an objects opacity to 0.
113
- */
114
- hide(): BuildFunction;
115
- /**
116
- * Allow for x and y values to be interpreted as percentages of total width/height.
117
- */
118
- positionInPresentation(position: Position): Position;
119
- /**
120
- * Adjusts a bounding box to be anchored given the object's vertical and horizontal anchor settings.
121
- * @param bbox Bounding box to anchor.
122
- * @returns Anchored bounding box.
123
- */
124
- anchorBoundingBox(bbox: BoundingBox): BoundingBox;
125
- /**
126
- * Computes a bounding box for a given element given its rendered size and defined position.
127
- * @param element Element for which to compute size.
128
- * @param children Custom children to use when computing bounding box.
129
- * @returns
130
- */
131
- computeRenderedBoundingBox(element: SVGGraphicsElement, children?: Node[] | null): BoundingBox;
132
- }