@allyhub/sdk 0.2.0 → 0.4.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/dist/free.d.ts +2 -2
- package/dist/index.d.ts +2 -9
- package/dist/index.js +1 -1
- package/dist/module.d.ts +2 -3
- package/dist/module.js +1 -1
- package/dist/parts.d.ts +2 -2
- package/dist/piece.d.ts +7 -32
- package/dist/piece.js +1 -1
- package/dist/props.d.ts +53 -10
- package/dist/slides.d.ts +8 -0
- package/dist/slides.js +2 -0
- package/docs/README.md +1 -1
- package/docs/batches.md +2 -2
- package/docs/defaults.md +106 -3
- package/docs/docs.md +1 -1
- package/docs/layers.md +1 -1
- package/docs/modeling.md +6 -6
- package/docs/project.md +7 -6
- package/docs/scenery.md +1 -1
- package/docs/sheets.md +1 -1
- package/docs/slides.md +182 -80
- package/node_modules/@allyhub-next/audio/package.json +1 -1
- package/node_modules/@allyhub-next/formats/dist/data/script.d.ts +22 -0
- package/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +1494 -0
- package/node_modules/@allyhub-next/formats/dist/data/slides.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/index.d.ts +2 -0
- package/node_modules/@allyhub-next/formats/dist/index.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/items.d.ts +26 -0
- package/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/layout.d.ts +2 -0
- package/node_modules/@allyhub-next/formats/dist/layout.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/note-shape.d.ts +39 -0
- package/node_modules/@allyhub-next/formats/dist/note-shape.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.d.ts +418 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
- package/node_modules/@allyhub-next/formats/package.json +1 -1
- package/node_modules/@allyhub-next/protocol/dist/app.d.ts +1 -62
- package/node_modules/@allyhub-next/protocol/dist/app.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +17 -17
- package/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +1 -5
- package/node_modules/@allyhub-next/protocol/dist/cli.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +13 -26
- package/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/index.d.ts +1 -0
- package/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/notes.d.ts +163 -0
- package/node_modules/@allyhub-next/protocol/dist/notes.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +4 -2
- package/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/runtimes.d.ts +3 -0
- package/node_modules/@allyhub-next/protocol/dist/runtimes.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +38 -0
- package/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
- package/node_modules/@allyhub-next/protocol/package.json +1 -1
- package/node_modules/@allyhub-next/runtimes/dist/errors.d.ts +5 -1
- package/node_modules/@allyhub-next/runtimes/dist/index.d.ts +1 -0
- package/node_modules/@allyhub-next/runtimes/dist/index.js +1 -1
- package/node_modules/@allyhub-next/runtimes/dist/node-program.d.ts +3 -0
- package/node_modules/@allyhub-next/runtimes/dist/node-program.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/packages.d.ts +65 -0
- package/node_modules/@allyhub-next/runtimes/dist/packages.js +4 -0
- package/node_modules/@allyhub-next/runtimes/dist/runtimes.js +2 -2
- package/node_modules/@allyhub-next/runtimes/dist/unpack.d.ts +7 -0
- package/node_modules/@allyhub-next/runtimes/dist/unpack.js +1 -1
- package/node_modules/@allyhub-next/runtimes/package.json +5 -1
- package/node_modules/@allyhub-next/runtimes/pins/docx/package-lock.json +67 -0
- package/node_modules/@allyhub-next/runtimes/pins/docx/package.json +9 -0
- package/node_modules/@allyhub-next/runtimes/pins/exceljs/package-lock.json +2533 -0
- package/node_modules/@allyhub-next/runtimes/pins/exceljs/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/gltf-tools/package-lock.json +753 -0
- package/node_modules/@allyhub-next/runtimes/pins/gltf-tools/package.json +14 -0
- package/node_modules/@allyhub-next/runtimes/pins/manifold-3d/package-lock.json +950 -0
- package/node_modules/@allyhub-next/runtimes/pins/manifold-3d/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/onnxruntime-node/package-lock.json +227 -0
- package/node_modules/@allyhub-next/runtimes/pins/onnxruntime-node/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/sherpa-onnx-node/package-lock.json +105 -0
- package/node_modules/@allyhub-next/runtimes/pins/sherpa-onnx-node/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/tesseract.js/package-lock.json +128 -0
- package/node_modules/@allyhub-next/runtimes/pins/tesseract.js/package.json +9 -0
- package/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +5 -24
- package/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/node_modules/@allyhub-next/slides-core/LICENSE +241 -0
- package/node_modules/@allyhub-next/slides-core/dist/animation.d.ts +129 -0
- package/node_modules/@allyhub-next/slides-core/dist/animation.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/api.d.ts +649 -0
- package/node_modules/@allyhub-next/slides-core/dist/api.js +4 -0
- package/node_modules/@allyhub-next/slides-core/dist/capabilities.d.ts +18 -0
- package/node_modules/@allyhub-next/slides-core/dist/capabilities.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +165 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-api.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-file.d.ts +11 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-file.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart.d.ts +184 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/check.d.ts +7 -0
- package/node_modules/@allyhub-next/slides-core/dist/check.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +146 -0
- package/node_modules/@allyhub-next/slides-core/dist/enums.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/file.d.ts +109 -0
- package/node_modules/@allyhub-next/slides-core/dist/file.js +4 -0
- package/node_modules/@allyhub-next/slides-core/dist/index.d.ts +21 -0
- package/node_modules/@allyhub-next/slides-core/dist/index.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/measure.d.ts +34 -0
- package/node_modules/@allyhub-next/slides-core/dist/measure.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/model.d.ts +278 -0
- package/node_modules/@allyhub-next/slides-core/dist/model.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/office.d.ts +58 -0
- package/node_modules/@allyhub-next/slides-core/dist/office.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/path.d.ts +6 -0
- package/node_modules/@allyhub-next/slides-core/dist/path.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/placeholders.d.ts +7 -0
- package/node_modules/@allyhub-next/slides-core/dist/placeholders.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +181 -0
- package/node_modules/@allyhub-next/slides-core/dist/resolve.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/script.d.ts +43 -0
- package/node_modules/@allyhub-next/slides-core/dist/script.js +3 -0
- package/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +63 -0
- package/node_modules/@allyhub-next/slides-core/dist/stage.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/strict.d.ts +23 -0
- package/node_modules/@allyhub-next/slides-core/dist/strict.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/theme.d.ts +72 -0
- package/node_modules/@allyhub-next/slides-core/dist/theme.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/units.d.ts +35 -0
- package/node_modules/@allyhub-next/slides-core/dist/units.js +2 -0
- package/node_modules/@allyhub-next/slides-core/package.json +14 -0
- package/node_modules/@allyhub-next/video-core/dist/export.d.ts +6 -5
- package/node_modules/@allyhub-next/video-core/dist/export.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/fact.d.ts +173 -4
- package/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/formats.d.ts +6 -13
- package/node_modules/@allyhub-next/video-core/dist/formats.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/index.d.ts +0 -1
- package/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/measure.d.ts +83 -0
- package/node_modules/@allyhub-next/video-core/dist/piece.d.ts +8 -9
- package/node_modules/@allyhub-next/video-core/dist/piece.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/problem.d.ts +9 -1
- package/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/schema.d.ts +0 -2
- package/node_modules/@allyhub-next/video-core/dist/script-edit.d.ts +4 -0
- package/node_modules/@allyhub-next/video-core/dist/script.d.ts +8 -0
- package/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +34 -1
- package/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/package.json +15 -8
- package/node_modules/@allyhub-next/video-core/dist/slides.d.ts +0 -37
- package/node_modules/@allyhub-next/video-core/dist/slides.js +0 -2
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export declare const MSO_THEME_COLOR: {
|
|
2
|
+
readonly DARK_1: "dk1";
|
|
3
|
+
readonly LIGHT_1: "lt1";
|
|
4
|
+
readonly DARK_2: "dk2";
|
|
5
|
+
readonly LIGHT_2: "lt2";
|
|
6
|
+
readonly ACCENT_1: "accent1";
|
|
7
|
+
readonly ACCENT_2: "accent2";
|
|
8
|
+
readonly ACCENT_3: "accent3";
|
|
9
|
+
readonly ACCENT_4: "accent4";
|
|
10
|
+
readonly ACCENT_5: "accent5";
|
|
11
|
+
readonly ACCENT_6: "accent6";
|
|
12
|
+
readonly HYPERLINK: "hlink";
|
|
13
|
+
readonly FOLLOWED_HYPERLINK: "folHlink";
|
|
14
|
+
readonly TEXT_1: "dk1";
|
|
15
|
+
readonly BACKGROUND_1: "lt1";
|
|
16
|
+
readonly TEXT_2: "dk2";
|
|
17
|
+
readonly BACKGROUND_2: "lt2";
|
|
18
|
+
};
|
|
19
|
+
export declare const PP_ALIGN: {
|
|
20
|
+
readonly LEFT: "l";
|
|
21
|
+
readonly CENTER: "ctr";
|
|
22
|
+
readonly RIGHT: "r";
|
|
23
|
+
readonly JUSTIFY: "just";
|
|
24
|
+
};
|
|
25
|
+
/** A text frame's vertical anchor (`a:bodyPr/@anchor`). */
|
|
26
|
+
export declare const MSO_ANCHOR: {
|
|
27
|
+
readonly TOP: "t";
|
|
28
|
+
readonly MIDDLE: "ctr";
|
|
29
|
+
readonly BOTTOM: "b";
|
|
30
|
+
};
|
|
31
|
+
export type Anchor = (typeof MSO_ANCHOR)[keyof typeof MSO_ANCHOR];
|
|
32
|
+
/** How a text frame fits its text (`a:normAutofit`, `a:spAutoFit`, none). */
|
|
33
|
+
export declare const MSO_AUTO_SIZE: {
|
|
34
|
+
readonly NONE: "none";
|
|
35
|
+
readonly SHAPE_TO_FIT_TEXT: "shape";
|
|
36
|
+
readonly TEXT_TO_FIT_SHAPE: "text";
|
|
37
|
+
};
|
|
38
|
+
export type AutoSize = (typeof MSO_AUTO_SIZE)[keyof typeof MSO_AUTO_SIZE];
|
|
39
|
+
/** A placeholder's type (`p:ph/@type`). */
|
|
40
|
+
export declare const PP_PLACEHOLDER: {
|
|
41
|
+
readonly TITLE: "title";
|
|
42
|
+
readonly CENTER_TITLE: "ctrTitle";
|
|
43
|
+
readonly SUBTITLE: "subTitle";
|
|
44
|
+
readonly BODY: "body";
|
|
45
|
+
readonly PICTURE: "pic";
|
|
46
|
+
readonly MEDIA_CLIP: "media";
|
|
47
|
+
readonly OBJECT: "obj";
|
|
48
|
+
readonly DATE: "dt";
|
|
49
|
+
readonly FOOTER: "ftr";
|
|
50
|
+
readonly SLIDE_NUMBER: "sldNum";
|
|
51
|
+
};
|
|
52
|
+
export type PlaceholderType = (typeof PP_PLACEHOLDER)[keyof typeof PP_PLACEHOLDER];
|
|
53
|
+
/** An autoshape's preset geometry (`a:prstGeom/@prst`). */
|
|
54
|
+
export declare const MSO_SHAPE: {
|
|
55
|
+
readonly RECTANGLE: "rect";
|
|
56
|
+
readonly ROUNDED_RECTANGLE: "roundRect";
|
|
57
|
+
readonly OVAL: "ellipse";
|
|
58
|
+
readonly ISOSCELES_TRIANGLE: "triangle";
|
|
59
|
+
readonly RIGHT_ARROW: "rightArrow";
|
|
60
|
+
};
|
|
61
|
+
/** A connector's kind (`add_connector`). */
|
|
62
|
+
export declare const MSO_CONNECTOR: {
|
|
63
|
+
readonly STRAIGHT: "line";
|
|
64
|
+
};
|
|
65
|
+
/** A line's dashes (`line.dash_style`). */
|
|
66
|
+
export declare const MSO_LINE: {
|
|
67
|
+
readonly SOLID: "solid";
|
|
68
|
+
readonly SQUARE_DOT: "sysDash";
|
|
69
|
+
readonly ROUND_DOT: "sysDot";
|
|
70
|
+
readonly DASH: "dash";
|
|
71
|
+
readonly DASH_DOT: "dashDot";
|
|
72
|
+
readonly DASH_DOT_DOT: "lgDashDotDot";
|
|
73
|
+
readonly LONG_DASH: "lgDash";
|
|
74
|
+
readonly LONG_DASH_DOT: "lgDashDot";
|
|
75
|
+
};
|
|
76
|
+
/** What a line's end has (`line.begin_arrow`, `line.end_arrow`): PowerPoint's arrow types; python-pptx has no such enumeration. */
|
|
77
|
+
export declare const MSO_ARROWHEAD: {
|
|
78
|
+
readonly NONE: "none";
|
|
79
|
+
readonly TRIANGLE: "triangle";
|
|
80
|
+
readonly OPEN: "arrow";
|
|
81
|
+
readonly STEALTH: "stealth";
|
|
82
|
+
readonly DIAMOND: "diamond";
|
|
83
|
+
readonly OVAL: "oval";
|
|
84
|
+
};
|
|
85
|
+
/** What a shape is (`shape.shape_type`). `COMPONENT` is AllyHub's: a shape drawn by code. */
|
|
86
|
+
export declare const MSO_SHAPE_TYPE: {
|
|
87
|
+
readonly AUTO_SHAPE: "autoshape";
|
|
88
|
+
readonly FREEFORM: "freeform";
|
|
89
|
+
readonly GROUP: "group";
|
|
90
|
+
readonly LINE: "line";
|
|
91
|
+
readonly TABLE: "table";
|
|
92
|
+
readonly CHART: "chart";
|
|
93
|
+
readonly MEDIA: "movie";
|
|
94
|
+
readonly PICTURE: "picture";
|
|
95
|
+
readonly PLACEHOLDER: "placeholder";
|
|
96
|
+
readonly TEXT_BOX: "textbox";
|
|
97
|
+
readonly COMPONENT: "component";
|
|
98
|
+
};
|
|
99
|
+
export type ShapeType = (typeof MSO_SHAPE_TYPE)[keyof typeof MSO_SHAPE_TYPE];
|
|
100
|
+
/** A chart's kind (python-pptx's XL_CHART_TYPE). */
|
|
101
|
+
export declare const XL_CHART_TYPE: {
|
|
102
|
+
readonly COLUMN_CLUSTERED: "column-clustered";
|
|
103
|
+
readonly COLUMN_STACKED: "column-stacked";
|
|
104
|
+
readonly COLUMN_STACKED_100: "column-stacked-100";
|
|
105
|
+
readonly BAR_CLUSTERED: "bar-clustered";
|
|
106
|
+
readonly BAR_STACKED: "bar-stacked";
|
|
107
|
+
readonly BAR_STACKED_100: "bar-stacked-100";
|
|
108
|
+
readonly LINE: "line";
|
|
109
|
+
readonly LINE_MARKERS: "line-markers";
|
|
110
|
+
readonly AREA: "area";
|
|
111
|
+
readonly AREA_STACKED: "area-stacked";
|
|
112
|
+
readonly AREA_STACKED_100: "area-stacked-100";
|
|
113
|
+
readonly PIE: "pie";
|
|
114
|
+
readonly DOUGHNUT: "doughnut";
|
|
115
|
+
};
|
|
116
|
+
/** Where a chart's legend is. */
|
|
117
|
+
export declare const XL_LEGEND_POSITION: {
|
|
118
|
+
readonly BOTTOM: "bottom";
|
|
119
|
+
readonly TOP: "top";
|
|
120
|
+
readonly LEFT: "left";
|
|
121
|
+
readonly RIGHT: "right";
|
|
122
|
+
};
|
|
123
|
+
/** Where a data label sits. */
|
|
124
|
+
export declare const XL_LABEL_POSITION: {
|
|
125
|
+
readonly ABOVE: "t";
|
|
126
|
+
readonly BELOW: "b";
|
|
127
|
+
readonly BEST_FIT: "bestFit";
|
|
128
|
+
readonly CENTER: "ctr";
|
|
129
|
+
readonly INSIDE_BASE: "inBase";
|
|
130
|
+
readonly INSIDE_END: "inEnd";
|
|
131
|
+
readonly LEFT: "l";
|
|
132
|
+
readonly OUTSIDE_END: "outEnd";
|
|
133
|
+
readonly RIGHT: "r";
|
|
134
|
+
};
|
|
135
|
+
/** A fill's kind (`fill.type`). */
|
|
136
|
+
export declare const MSO_FILL: {
|
|
137
|
+
readonly SOLID: "solid";
|
|
138
|
+
readonly BACKGROUND: "background";
|
|
139
|
+
};
|
|
140
|
+
export type FillType = (typeof MSO_FILL)[keyof typeof MSO_FILL];
|
|
141
|
+
/** The theme's fonts as a run names them (`+mj-lt`, `+mn-lt`). */
|
|
142
|
+
export declare const THEME_FONT: {
|
|
143
|
+
readonly MAJOR: "+mj-lt";
|
|
144
|
+
readonly MINOR: "+mn-lt";
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{strictEnum as E}from"./strict.js";export const MSO_THEME_COLOR=E("MSO_THEME_COLOR",{DARK_1:"dk1",LIGHT_1:"lt1",DARK_2:"dk2",LIGHT_2:"lt2",ACCENT_1:"accent1",ACCENT_2:"accent2",ACCENT_3:"accent3",ACCENT_4:"accent4",ACCENT_5:"accent5",ACCENT_6:"accent6",HYPERLINK:"hlink",FOLLOWED_HYPERLINK:"folHlink",TEXT_1:"dk1",BACKGROUND_1:"lt1",TEXT_2:"dk2",BACKGROUND_2:"lt2"}),PP_ALIGN=E("PP_ALIGN",{LEFT:"l",CENTER:"ctr",RIGHT:"r",JUSTIFY:"just"}),MSO_ANCHOR=E("MSO_ANCHOR",{TOP:"t",MIDDLE:"ctr",BOTTOM:"b"}),MSO_AUTO_SIZE=E("MSO_AUTO_SIZE",{NONE:"none",SHAPE_TO_FIT_TEXT:"shape",TEXT_TO_FIT_SHAPE:"text"}),PP_PLACEHOLDER=E("PP_PLACEHOLDER",{TITLE:"title",CENTER_TITLE:"ctrTitle",SUBTITLE:"subTitle",BODY:"body",PICTURE:"pic",MEDIA_CLIP:"media",OBJECT:"obj",DATE:"dt",FOOTER:"ftr",SLIDE_NUMBER:"sldNum"}),MSO_SHAPE=E("MSO_SHAPE",{RECTANGLE:"rect",ROUNDED_RECTANGLE:"roundRect",OVAL:"ellipse",ISOSCELES_TRIANGLE:"triangle",RIGHT_ARROW:"rightArrow"}),MSO_CONNECTOR=E("MSO_CONNECTOR",{STRAIGHT:"line"}),MSO_LINE=E("MSO_LINE",{SOLID:"solid",SQUARE_DOT:"sysDash",ROUND_DOT:"sysDot",DASH:"dash",DASH_DOT:"dashDot",DASH_DOT_DOT:"lgDashDotDot",LONG_DASH:"lgDash",LONG_DASH_DOT:"lgDashDot"}),MSO_ARROWHEAD=E("MSO_ARROWHEAD",{NONE:"none",TRIANGLE:"triangle",OPEN:"arrow",STEALTH:"stealth",DIAMOND:"diamond",OVAL:"oval"}),MSO_SHAPE_TYPE=E("MSO_SHAPE_TYPE",{AUTO_SHAPE:"autoshape",FREEFORM:"freeform",GROUP:"group",LINE:"line",TABLE:"table",CHART:"chart",MEDIA:"movie",PICTURE:"picture",PLACEHOLDER:"placeholder",TEXT_BOX:"textbox",COMPONENT:"component"}),XL_CHART_TYPE=E("XL_CHART_TYPE",{COLUMN_CLUSTERED:"column-clustered",COLUMN_STACKED:"column-stacked",COLUMN_STACKED_100:"column-stacked-100",BAR_CLUSTERED:"bar-clustered",BAR_STACKED:"bar-stacked",BAR_STACKED_100:"bar-stacked-100",LINE:"line",LINE_MARKERS:"line-markers",AREA:"area",AREA_STACKED:"area-stacked",AREA_STACKED_100:"area-stacked-100",PIE:"pie",DOUGHNUT:"doughnut"}),XL_LEGEND_POSITION=E("XL_LEGEND_POSITION",{BOTTOM:"bottom",TOP:"top",LEFT:"left",RIGHT:"right"}),XL_LABEL_POSITION=E("XL_LABEL_POSITION",{ABOVE:"t",BELOW:"b",BEST_FIT:"bestFit",CENTER:"ctr",INSIDE_BASE:"inBase",INSIDE_END:"inEnd",LEFT:"l",OUTSIDE_END:"outEnd",RIGHT:"r"}),MSO_FILL=E("MSO_FILL",{SOLID:"solid",BACKGROUND:"background"}),THEME_FONT=E("THEME_FONT",{MAJOR:"+mj-lt",MINOR:"+mn-lt"});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type AnimationFile, type ShapeFile, type TransitionFile, type SlideFile, type SlidesFile } from "@allyhub-next/formats";
|
|
2
|
+
export interface FileProblem {
|
|
3
|
+
/** Where in the file, as `slides.2.shapes.Title.frame`. */
|
|
4
|
+
path: string;
|
|
5
|
+
line?: number;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
/** slides.yaml's text read: its slides, or nothing when it is not the format, what is wrong, and the line of any path. */
|
|
9
|
+
export declare function readSlidesFile(text: string): {
|
|
10
|
+
file?: SlidesFile;
|
|
11
|
+
problems: FileProblem[];
|
|
12
|
+
lineOf: (path: string) => number | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type SlidesEdit =
|
|
15
|
+
/** A slide put after another, or first (null). */
|
|
16
|
+
{
|
|
17
|
+
op: "move";
|
|
18
|
+
slide: string;
|
|
19
|
+
after: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** A slide put after another (null: first; undefined: last). */
|
|
22
|
+
| {
|
|
23
|
+
op: "add";
|
|
24
|
+
slide: SlideFile;
|
|
25
|
+
after?: string | null;
|
|
26
|
+
} | {
|
|
27
|
+
op: "duplicate";
|
|
28
|
+
slide: string;
|
|
29
|
+
id: string;
|
|
30
|
+
} | {
|
|
31
|
+
op: "remove";
|
|
32
|
+
slide: string;
|
|
33
|
+
} | {
|
|
34
|
+
op: "layout";
|
|
35
|
+
slide: string;
|
|
36
|
+
layout: string;
|
|
37
|
+
}
|
|
38
|
+
/** Hidden (a block: those of its slides), or shown (false). */
|
|
39
|
+
| {
|
|
40
|
+
op: "hidden";
|
|
41
|
+
slide: string;
|
|
42
|
+
hidden: boolean | string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Fields of a shape set (undefined takes one away); the entry is made
|
|
46
|
+
* when there is none. A key may go into a field (`text.size`), so two
|
|
47
|
+
* hands' changes to one field's parts both stand.
|
|
48
|
+
*/
|
|
49
|
+
| {
|
|
50
|
+
op: "shape";
|
|
51
|
+
slide: string;
|
|
52
|
+
shape: string;
|
|
53
|
+
set: {
|
|
54
|
+
[K in keyof ShapeFile]?: ShapeFile[K] | undefined;
|
|
55
|
+
} & Record<`${"text" | "props" | "crop"}.${string}`, unknown>;
|
|
56
|
+
} | {
|
|
57
|
+
op: "unplace";
|
|
58
|
+
slide: string;
|
|
59
|
+
shape: string;
|
|
60
|
+
}
|
|
61
|
+
/** A shape's changes taken away: it is its layout's again. */
|
|
62
|
+
| {
|
|
63
|
+
op: "reset";
|
|
64
|
+
slide: string;
|
|
65
|
+
shape?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Its Animation Pane, whole; none takes it away. */
|
|
68
|
+
| {
|
|
69
|
+
op: "animations";
|
|
70
|
+
slide: string;
|
|
71
|
+
animations: AnimationFile[];
|
|
72
|
+
}
|
|
73
|
+
/** How it comes on; none takes it away. */
|
|
74
|
+
| {
|
|
75
|
+
op: "transition";
|
|
76
|
+
slide: string;
|
|
77
|
+
transition?: TransitionFile;
|
|
78
|
+
};
|
|
79
|
+
/** slides.yaml's text after an edit. */
|
|
80
|
+
export declare function editSlidesFile(text: string | undefined, edit: SlidesEdit): string;
|
|
81
|
+
/** An id or a name no slide or shape has yet, from a stem: `cover`, `cover-2`… */
|
|
82
|
+
export declare function freeName(taken: Iterable<string>, stem: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* What `b` changes of `a`, as edits: slides removed, added and moved (a
|
|
85
|
+
* slide is moved only when it leaves the order the two share), then each
|
|
86
|
+
* slide's own changes. Made over `a` they make `b`; made over a file
|
|
87
|
+
* another hand changed from `a`, they are `b`'s changes kept.
|
|
88
|
+
*/
|
|
89
|
+
export declare function slidesEdits(a: SlidesFile, b: SlidesFile): SlidesEdit[];
|
|
90
|
+
/** Where a person's change met another hand's: the person's stands. */
|
|
91
|
+
export interface SlidesConflict {
|
|
92
|
+
slide: string;
|
|
93
|
+
shape?: string;
|
|
94
|
+
/** The field both changed (`frame`, `text.size`, `layout`); absent when the other hand removed what the person changed. */
|
|
95
|
+
field?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A person's slides.yaml (`mine`, what the editor holds, made from
|
|
99
|
+
* `base`) merged into the file as another hand left it (`theirs`): the
|
|
100
|
+
* person's changes made over theirs, so what the other hand changed
|
|
101
|
+
* elsewhere stands, and where both changed one value the person's does,
|
|
102
|
+
* said in `conflicts`. Undefined when theirs is not a slides.yaml a merge
|
|
103
|
+
* can read: the person mends it, or the other hand does.
|
|
104
|
+
*/
|
|
105
|
+
export declare function mergeSlides(base: string, mine: SlidesFile, theirs: string): {
|
|
106
|
+
text: string;
|
|
107
|
+
conflicts: SlidesConflict[];
|
|
108
|
+
} | undefined;
|
|
109
|
+
//# sourceMappingURL=file.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{readDataFile as x}from"@allyhub-next/formats";import{isMap as u,isSeq as O,LineCounter as w,parseDocument as N}from"yaml";export function readSlidesFile(t){const e=new w,n=N(t,{lineCounter:e}),o=l=>{const s=l===""?[]:l.split(".");for(let a=s.length;a>=0;a--){const r=n.getIn(s.slice(0,a).map(i=>/^\d+$/u.test(i)?Number(i):i),!0)?.range?.[0];if(r!==void 0)return e.linePos(r).line}};if(n.errors.length>0)return{problems:n.errors.map(l=>({path:"",line:e.linePos(l.pos[0]).line,message:`slides.yaml is not YAML: ${l.message.split(`
|
|
3
|
+
`)[0]??""}`})),lineOf:o};const c=x("slides",n.toJS()??{});return c.ok?{file:c.value,problems:[],lineOf:o}:{problems:c.problems.map(l=>{const s=o(l.path);return{path:l.path,...s===void 0?{}:{line:s},message:l.message}}),lineOf:o}}const A=`slides: []
|
|
4
|
+
`;function M(t){let e=t.get("slides",!0);if(O(e)||(u(t.contents)?t.set("slides",t.createNode([])):t.contents=t.createNode({slides:[]}),e=t.get("slides",!0)),!O(e))throw new Error("slides.yaml has no slides list.");return e}const b=(t,e)=>t.findIndex(n=>u(n)&&n.get("id")===e),E=["frame","text","fill","line","z","crop"];export function editSlidesFile(t,e){const n=N(t===void 0||t.trim()===""?A:t);if(n.errors.length>0)throw new Error("slides.yaml is not YAML: it is mended by hand first.");const o=M(n),c=r=>{if(r===null)return 0;const i=r===void 0?-1:b(o.items,r);return i<0?o.items.length:i+1};if(e.op==="add")return b(o.items,e.slide.id)>=0||(o.items.splice(c(e.after),0,n.createNode(e.slide)),o.flow===!0&&(o.flow=!1)),n.toString();const l=b(o.items,e.slide),s=o.items[l];if(l<0||!u(s))return t??A;const a=r=>{let i=s.get("shapes",!0);return!u(i)&&r&&(s.set("shapes",n.createNode({})),i=s.get("shapes",!0)),u(i)?i:void 0},f=()=>{const r=a(!1);if(r){for(const i of[...r.items])u(i.value)&&i.value.items.length===0&&r.delete(i.key);r.items.length===0&&s.delete("shapes")}};switch(e.op){case"move":{if(e.after===e.slide)break;o.items.splice(l,1),o.items.splice(c(e.after),0,s);break}case"duplicate":{const r=s.clone();r.set("id",e.id),o.items.splice(l+1,0,r);break}case"remove":o.items.splice(l,1);break;case"layout":s.set("layout",e.layout);break;case"hidden":e.hidden===!1||Array.isArray(e.hidden)&&e.hidden.length===0?s.delete("hidden"):s.set("hidden",n.createNode(e.hidden));break;case"shape":{const r=a(!0);if(!r)break;let i=r.get(e.shape,!0);if(u(i)||(r.set(e.shape,n.createNode({})),i=r.get(e.shape,!0)),!u(i))break;for(const[d,p]of Object.entries(e.set)){const m=d.split(".");if(p===void 0){i.deleteIn(m);const h=m.length>1?i.getIn(m.slice(0,-1),!0):void 0;u(h)&&h.items.length===0&&i.deleteIn(m.slice(0,-1))}else i.setIn(m,n.createNode(p))}f();break}case"unplace":{a(!1)?.delete(e.shape),f();break}case"animations":e.animations.length===0?s.delete("animations"):s.set("animations",n.createNode(e.animations));break;case"transition":e.transition===void 0?s.delete("transition"):s.set("transition",n.createNode(e.transition));break;case"reset":{const r=a(!1);if(!r)break;for(const i of r.items){const d=String(u(i.key)?"":i.key.value??i.key);if(e.shape!==void 0&&d!==e.shape)continue;const p=i.value;if(!(!u(p)||["textbox","picture","movie","geometry","component"].some(h=>p.has(h))))for(const h of E)p.delete(h)}f();break}}return n.toString()}export function freeName(t,e){const n=new Set(t),o=e.replace(/[^A-Za-z0-9_-]+/gu,"-").replace(/^-+|-+$/gu,"")||"slide";if(!n.has(o))return o;for(let c=2;;c++){const l=`${o}-${String(c)}`;if(!n.has(l))return l}}const $=new Set(["text","props","crop"]),y=t=>Array.isArray(t)?t.map(y):t!==null&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[n])=>e<n?-1:e>n?1:0).map(([e,n])=>[e,y(n)])):t,k=(t,e)=>JSON.stringify(y(t))===JSON.stringify(y(e));function j(t){const e=new Map;for(const[n,o]of Object.entries(t??{}))if($.has(n)&&typeof o=="object"&&!Array.isArray(o))for(const[c,l]of Object.entries(o))e.set(`${n}.${c}`,l);else e.set(n,o);return e}function I(t,e){const n=t.length,o=e.length,c=Array.from({length:n+1},()=>new Array(o+1).fill(0));for(let s=n-1;s>=0;s--)for(let a=o-1;a>=0;a--){const f=c[s],r=c[s+1];!f||!r||(f[a]=t[s]===e[a]?(r[a+1]??0)+1:Math.max(r[a]??0,f[a+1]??0))}const l=new Set;for(let s=0,a=0;s<n&&a<o;)t[s]===e[a]?(l.add(t[s]??""),s++,a++):(c[s+1]?.[a]??0)>=(c[s]?.[a+1]??0)?s++:a++;return l}function J(t,e){const n=[],o=e.id;e.layout!==void 0&&e.layout!==t.layout&&n.push({op:"layout",slide:o,layout:e.layout}),k(t.hidden,e.hidden)||n.push({op:"hidden",slide:o,hidden:e.hidden??!1}),k(t.animations??[],e.animations??[])||n.push({op:"animations",slide:o,animations:e.animations??[]}),k(t.transition,e.transition)||n.push({op:"transition",slide:o,...e.transition?{transition:e.transition}:{}});const c=t.shapes??{},l=e.shapes??{};for(const s of Object.keys(c))s in l||n.push({op:"unplace",slide:o,shape:s});for(const[s,a]of Object.entries(l)){const f=j(c[s]),r=j(a),i={};for(const d of new Set([...f.keys(),...r.keys()]))k(f.get(d),r.get(d))||(i[d]=r.get(d));Object.keys(i).length>0&&n.push({op:"shape",slide:o,shape:s,set:i})}return n}export function slidesEdits(t,e){const n=[],o=new Map(t.slides.map(s=>[s.id,s])),c=new Set(e.slides.map(s=>s.id));for(const s of t.slides)c.has(s.id)||n.push({op:"remove",slide:s.id});const l=I(t.slides.map(s=>s.id).filter(s=>c.has(s)),e.slides.map(s=>s.id).filter(s=>o.has(s)));return e.slides.forEach((s,a)=>{const f=a===0?null:e.slides[a-1]?.id??null,r=o.get(s.id);if(!r||r.generate!==s.generate){r&&n.push({op:"remove",slide:s.id}),n.push({op:"add",slide:s,after:f});return}l.has(s.id)||n.push({op:"move",slide:s.id,after:f}),n.push(...J(r,s))}),n}const g=(t,e,n)=>JSON.stringify([t,e,n]);function v(t){const e=new Map;switch(t.op){case"layout":e.set(g(t.slide,"","layout"),t.layout);break;case"hidden":e.set(g(t.slide,"","hidden"),t.hidden);break;case"animations":e.set(g(t.slide,"","animations"),t.animations);break;case"transition":e.set(g(t.slide,"","transition"),t.transition);break;case"shape":for(const[n,o]of Object.entries(t.set))e.set(g(t.slide,t.shape,n),o);break;case"unplace":e.set(g(t.slide,t.shape,""),void 0);break;case"remove":e.set(g(t.slide,"",""),void 0);break;default:break}return e}export function mergeSlides(t,e,n){const o=readSlidesFile(t).file??{slides:[]},c=readSlidesFile(n).file;if(!c)return;const l=slidesEdits(o,e);let s=n;for(const i of l)s=editSlidesFile(s,i);const a=new Map;for(const i of slidesEdits(o,c))for(const[d,p]of v(i))a.set(d,p);const f=new Set(o.slides.map(i=>i.id).filter(i=>!c.slides.some(d=>d.id===i))),r=[];for(const i of l){if("slide"in i&&typeof i.slide=="string"&&f.has(i.slide)&&i.op!=="remove"){r.push({slide:i.slide});continue}for(const[d,p]of v(i)){if(!a.has(d)||k(a.get(d),p))continue;const[m="",h="",S=""]=JSON.parse(d);r.push({slide:m,...h===""?{}:{shape:h},...S===""?{}:{field:S}})}}return{text:s,conflicts:r}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from "./units.js";
|
|
2
|
+
export * from "./enums.js";
|
|
3
|
+
export * from "./strict.js";
|
|
4
|
+
export * from "./animation.js";
|
|
5
|
+
export * from "./chart.js";
|
|
6
|
+
export * from "./chart-api.js";
|
|
7
|
+
export { chartOfFile } from "./chart-file.js";
|
|
8
|
+
export * from "./office.js";
|
|
9
|
+
export * from "./path.js";
|
|
10
|
+
export * from "./placeholders.js";
|
|
11
|
+
export * from "./theme.js";
|
|
12
|
+
export * from "./model.js";
|
|
13
|
+
export * from "./api.js";
|
|
14
|
+
export * from "./resolve.js";
|
|
15
|
+
export * from "./file.js";
|
|
16
|
+
export * from "./script.js";
|
|
17
|
+
export * from "./stage.js";
|
|
18
|
+
export * from "./check.js";
|
|
19
|
+
export * from "./capabilities.js";
|
|
20
|
+
export * from "./measure.js";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
export*from"./units.js";export*from"./enums.js";export*from"./strict.js";export*from"./animation.js";export*from"./chart.js";export*from"./chart-api.js";export{chartOfFile}from"./chart-file.js";export*from"./office.js";export*from"./path.js";export*from"./placeholders.js";export*from"./theme.js";export*from"./model.js";export*from"./api.js";export*from"./resolve.js";export*from"./file.js";export*from"./script.js";export*from"./stage.js";export*from"./check.js";export*from"./capabilities.js";export*from"./measure.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type DeckLayout, type DeckShapeLayout, type Fact, type FactPlace } from "@allyhub-next/video-core";
|
|
2
|
+
export interface DeckFactOptions {
|
|
3
|
+
/** near-alignment: lines this many points apart or fewer, and more than `aligned`, are reported. */
|
|
4
|
+
within: number;
|
|
5
|
+
/** near-alignment: lines this close, in points, are in line. */
|
|
6
|
+
aligned: number;
|
|
7
|
+
/** placement-drift: frames further apart than this, in points, are different places. */
|
|
8
|
+
drift: number;
|
|
9
|
+
/** read-size: a room's screen width and its farthest seat, metres; without it, no room is measured. */
|
|
10
|
+
room?: {
|
|
11
|
+
screen: number;
|
|
12
|
+
distance: number;
|
|
13
|
+
};
|
|
14
|
+
/** read-size: the phone a slide is fitted on, in points, upright. */
|
|
15
|
+
phone: [number, number];
|
|
16
|
+
/** Pixels a box may reach past a line before it is past it (antialiasing). */
|
|
17
|
+
slack: number;
|
|
18
|
+
/** deck-fonts: the fonts every PowerPoint, Keynote and Google Slides has. */
|
|
19
|
+
standard?: readonly string[];
|
|
20
|
+
/** Only shapes of these levels are measured; every level unless given. */
|
|
21
|
+
levels?: readonly DeckShapeLayout["level"][];
|
|
22
|
+
/** Shapes by name left out of every fact, `*` for any letters; none unless given. */
|
|
23
|
+
except?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export declare const DECK_FACT_DEFAULTS: DeckFactOptions;
|
|
26
|
+
/**
|
|
27
|
+
* The facts of a deck as drawn, each placed at its slide (`part`, its
|
|
28
|
+
* still's `t`), a deck's own (type-in-use, placement-drift) at none.
|
|
29
|
+
*/
|
|
30
|
+
export declare function deckFacts(layout: DeckLayout, frame: {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
}, place: FactPlace, given?: Partial<DeckFactOptions>): Fact[];
|
|
34
|
+
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{READ_DEFAULTS as G,fact as u,phoneScale as J}from"@allyhub-next/video-core";import{STANDARD_FONTS as K}from"./theme.js";export const DECK_FACT_DEFAULTS={within:8,aligned:.5,drift:1,phone:G.phone,slack:1};const z=e=>e[0]+e[2],k=e=>e[1]+e[3],E=e=>Math.max(0,e[2])*Math.max(0,e[3]),M=(e,o=2)=>{const p=10**o;return Math.round(e*p)/p};function O(e,o,p){const y=[],n=(m,l)=>{l>p&&y.push({side:m,px:Math.round(l)})};return n("left",o[0]-e[0]),n("top",o[1]-e[1]),n("right",z(e)-z(o)),n("bottom",k(e)-k(o)),y}const R=(e,o)=>{const p=Math.max(e[0],o[0]),y=Math.max(e[1],o[1]);return[p,y,Math.min(z(e),z(o))-p,Math.min(k(e),k(o))-y]},Q=(e,o,p)=>e[0]>=o[0]-p&&e[1]>=o[1]-p&&z(e)<=z(o)+p&&k(e)<=k(o)+p,D={left:e=>e[0],right:z,"centre-x":e=>e[0]+e[2]/2,top:e=>e[1],bottom:k,"centre-y":e=>e[1]+e[3]/2},P=e=>e.opaque||!e.text?.glyphs?e.box:e.text.glyphs,V=new Set(Object.keys(D)),W=new Set(["left","right","top","bottom"]);function C(e){if(e.opaque)return V;if(!e.text?.glyphs)return W;const o=e.text.align??"l";return new Set([o==="ctr"?"centre-x":o==="r"?"right":"left"])}const X=(e,o)=>o.some(p=>new RegExp(`^${p.split("*").map(y=>y.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join(".*")}$`,"su").test(e)),Y=e=>e.box[2]>0||e.box[3]>0;export function deckFacts(e,o,p,y={}){const n={...DECK_FACT_DEFAULTS,...y},m=t=>M(t/e.pxPerPt),l=[],F=[0,0,o.width,o.height],L=new Map,N=new Map,H=new Map;for(const t of e.slides){const i={...p,part:t.slide,t:t.t},w=N.get(t.slide)??{at:i,total:t.steps??1,measured:0,shapes:new Map};N.set(t.slide,w),w.measured++;for(const c of t.shapes){if(c.level!=="slide")continue;const s=w.shapes.get(c.name)??{hidden:0,by:[]};c.hidden===!0&&s.hidden++,w.shapes.set(c.name,s)}const x=t.shapes.filter(c=>Y(c)&&c.hidden!==!0&&(n.levels===void 0||n.levels.includes(c.level))&&!X(c.name,n.except??[]));let A=0,q=0,I=0;for(const[c,s]of x.entries()){s.chart&&l.push(u("chart-data",i,{shape:s.name,...s.chart}));const f=(s.rows??[]).flatMap((a,d)=>a.drawn>a.set+n.slack?[{row:d,set:m(a.set),drawn:m(a.drawn)}]:[]);f.length>0&&l.push(u("table-grown",i,{shape:s.name,set:m(s.frame[3]),drawn:m(s.box[3]),rows:f}));const h=s.text;if(h?.glyphs){I++,A+=h.words,q+=h.lines.length;const a=O(h.glyphs,s.box,n.slack);a.length>0&&l.push(u("text-overflow",i,{shape:s.name,text:h.text,box:s.box,glyphs:h.glyphs,edges:a,lines:h.lines.length,past:h.lines.filter(r=>O(r,s.box,n.slack).length>0).length,...h.scale===void 0?{}:{scale:h.scale}}));for(const r of h.type){const g=`${String(r.size)}/${String(r.weight)}`,b=L.get(g)??{size:r.size,weight:r.weight,slides:new Set,shapes:new Set};b.slides.add(t.slide),b.shapes.add(`${t.slide}/${s.name}`),L.set(g,b)}const d=h.type.reduce((r,g)=>r===void 0||g.size<r.size?g:r,void 0);if(d){const r=n.room,g=d.xHeight===void 0?"em":"x",b=r&&(d.xHeight??d.size)*(r.screen*1e3/(o.width/e.pxPerPt));l.push(u("read-size",i,{shape:s.name,text:h.text,size:d.size,...d.xHeight===void 0?{}:{xHeight:d.xHeight},...r&&b!==void 0?{screen:{by:g,mm:M(b,1),arcmin:M(Math.atan(b/1e3/r.distance)*180*60/Math.PI,1)}}:{},phone:M(d.size*e.pxPerPt*J([o.width,o.height],n.phone),1),options:{...r?{room:{...r}}:{},phone:[...n.phone]}}))}}const $=O(s.box,F,n.slack);if($.length>0){const a=E(s.box);l.push(u("shape-off-slide",i,{shape:s.name,box:s.box,edges:$,share:a>0?M(1-E(R(s.box,F))/a):1}))}if(s.picture){const[a,d]=s.picture.shown;if(a>0&&d>0){const r=Math.max(s.box[2]/a,s.box[3]/d),g=b=>b/e.pxPerPt/72;l.push(u("picture-resolution",i,{shape:s.name,source:s.picture.source,shown:s.picture.shown,box:s.box,scale:M(r),ppi:Math.round(Math.min(a/g(s.box[2]),d/g(s.box[3]))),stretch:M(s.box[2]/a/(s.box[3]/d)-1)}))}}const S=x.slice(c+1).find(a=>a.opaque&&Q(s.box,a.box,n.slack)),v=w.shapes.get(s.name);if(v?v.by.push(S?.name):S&&l.push(u("shape-hidden",i,{shape:s.name,by:S.name})),s.level==="slide"){const a=`${t.layout}\0${s.name}`,d=H.get(a)??new Map,r=[m(s.frame[0]),m(s.frame[1]),m(s.frame[2]),m(s.frame[3])],g=[...d.values()].find(b=>b.frame.every((U,B)=>Math.abs(U-(r[B]??0))<=n.drift));g?g.slides.includes(t.slide)||g.slides.push(t.slide):d.set(r.join(","),{frame:r,slides:[t.slide]}),H.set(a,d)}}for(let c=0;c<x.length;c++)for(let s=c+1;s<x.length;s++){const f=x[c],h=x[s];if(!f||!h)continue;const $=f.level==="slide"||h.level==="slide",S=R(P(f),P(h));if($&&f.level==="slide"&&h.level==="slide"&&S[2]>n.slack&&S[3]>n.slack){const v=E(S);l.push(u("shape-overlap",i,{a:f.name,b:h.name,area:Math.round(v),share:M(v/Math.max(1,Math.min(E(P(f)),E(P(h)))))}))}if($)for(const[v,a]of Object.entries(D)){if(!C(f).has(v)||!C(h).has(v))continue;const d=Math.abs(m(a(P(f)))-m(a(P(h))));d>n.aligned&&d<=n.within&&l.push(u("near-alignment",i,{a:f.name,b:h.name,line:v,gap:M(d),options:{within:n.within,aligned:n.aligned}}))}}for(const c of x)if(!(c.level!=="slide"||!c.opaque))for(const s of["centre-x","centre-y"]){const f=Math.abs(m(D[s](c.box))-m(D[s](F)));f>n.aligned&&f<=n.within&&l.push(u("near-alignment",i,{a:c.name,b:"slide",line:s,gap:M(f),options:{within:n.within,aligned:n.aligned}}))}l.push(u("words-on-slide",i,{words:A,lines:q,texts:I}))}for(const[t,i]of H){if(i.size<2)continue;const[w="",x=""]=t.split("\0");l.push(u("placement-drift",p,{layout:w,shape:x,places:[...i.values()],options:{drift:n.drift}}))}if(e.fonts&&e.fonts.length>0){const t=new Set(y.standard??K);l.push(u("deck-fonts",p,{fonts:e.fonts.map(i=>({...i,standard:t.has(i.name)})),options:{standard:[...t]}}))}const T=[...L.values()].map(t=>({size:t.size,weight:t.weight,slides:t.slides.size,shapes:t.shapes.size})).sort((t,i)=>t.size-i.size||t.weight-i.weight),_=T[0];_&&l.push(u("type-in-use",p,{type:T,smallest:_.size}));for(const t of N.values())for(const[i,w]of t.shapes){const[x]=w.by;x!==void 0&&w.by.every(A=>A!==void 0)&&l.push(u("shape-hidden",t.at,{shape:i,by:x})),t.measured>=t.total&&w.hidden===t.measured&&l.push(u("shape-hidden",t.at,{shape:i,never:!0}))}const j=new Set;return l.filter(t=>{const i=JSON.stringify([t.kind,t.part,t.data]);return j.has(i)?!1:(j.add(i),!0)})}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import type { AnimationFile, LineDash, TransitionFile, LineEnd, ShapeGeometry, TextAlign, ThemeColor } from "@allyhub-next/formats";
|
|
2
|
+
import type { ChartDef } from "./chart.js";
|
|
3
|
+
import type { Anchor, AutoSize, PlaceholderType } from "./enums.js";
|
|
4
|
+
import type { ThemeInput } from "./theme.js";
|
|
5
|
+
import type { Length } from "./units.js";
|
|
6
|
+
export interface Frame {
|
|
7
|
+
left: Length;
|
|
8
|
+
top: Length;
|
|
9
|
+
width: Length;
|
|
10
|
+
height: Length;
|
|
11
|
+
}
|
|
12
|
+
/** A colour: the theme's, or `#RRGGBB`. */
|
|
13
|
+
export type Color = ThemeColor | {
|
|
14
|
+
rgb: string;
|
|
15
|
+
};
|
|
16
|
+
/** Character properties (`a:rPr`, `a:defRPr`): what python-pptx's `Font` holds. */
|
|
17
|
+
export interface FontDef {
|
|
18
|
+
/** A typeface, or the theme's (`+mj-lt`, `+mn-lt`). */
|
|
19
|
+
name?: string;
|
|
20
|
+
size?: Length;
|
|
21
|
+
bold?: boolean;
|
|
22
|
+
italic?: boolean;
|
|
23
|
+
underline?: boolean;
|
|
24
|
+
color?: ThemeColor;
|
|
25
|
+
/** A colour that is not the theme's, `#RRGGBB`. */
|
|
26
|
+
rgb?: string;
|
|
27
|
+
/** Space added between letters (negative tightens), EMU (`a:rPr` spc). */
|
|
28
|
+
spacing?: Length;
|
|
29
|
+
}
|
|
30
|
+
export interface RunDef {
|
|
31
|
+
/** Its text; `\v` is a line break in the paragraph (`a:br`). */
|
|
32
|
+
text: string;
|
|
33
|
+
font?: FontDef;
|
|
34
|
+
/** The script's `` `code` ``: its font is the theme's code font. */
|
|
35
|
+
code?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Line spacing (`a:lnSpc`): a multiple of the line (`a:spcPct`) or a fixed height (`a:spcPts`). */
|
|
38
|
+
export type LineSpacing = {
|
|
39
|
+
lines: number;
|
|
40
|
+
} | {
|
|
41
|
+
fixed: Length;
|
|
42
|
+
};
|
|
43
|
+
/** A paragraph's properties (`a:pPr`), and a list style's level (`a:lvlNpPr`). */
|
|
44
|
+
export interface ParagraphFormatDef {
|
|
45
|
+
alignment?: TextAlign;
|
|
46
|
+
line_spacing?: LineSpacing;
|
|
47
|
+
space_before?: Length;
|
|
48
|
+
space_after?: Length;
|
|
49
|
+
/** Its bullet character (`a:buChar`); null: none (`a:buNone`). */
|
|
50
|
+
bullet?: string | null;
|
|
51
|
+
/** The bullet's typeface (`a:buFont`). */
|
|
52
|
+
bullet_font?: string;
|
|
53
|
+
/** Where its lines start (`@marL`), and its first line from there (`@indent`, negative for a hanging bullet). */
|
|
54
|
+
margin_left?: Length;
|
|
55
|
+
indent?: Length;
|
|
56
|
+
/** Its runs' default character properties (`a:defRPr`). */
|
|
57
|
+
font?: FontDef;
|
|
58
|
+
}
|
|
59
|
+
export interface ParagraphDef extends ParagraphFormatDef {
|
|
60
|
+
runs: RunDef[];
|
|
61
|
+
/** Its indent level, 0 to 8 (`@lvl`). */
|
|
62
|
+
level: number;
|
|
63
|
+
}
|
|
64
|
+
/** The nine levels of a list style (`a:lstStyle`, a master's `p:titleStyle`…), level 0 first. */
|
|
65
|
+
export type LevelsDef = ParagraphFormatDef[];
|
|
66
|
+
/** A text frame (`p:txBody`): its body properties, its list style and its paragraphs. */
|
|
67
|
+
export interface TextFrameDef {
|
|
68
|
+
paragraphs: ParagraphDef[];
|
|
69
|
+
/** Its list style, nine levels: a placeholder's for the text a slide gives it. */
|
|
70
|
+
levels: LevelsDef;
|
|
71
|
+
vertical_anchor?: Anchor;
|
|
72
|
+
auto_size?: AutoSize;
|
|
73
|
+
word_wrap?: boolean;
|
|
74
|
+
margin_left?: Length;
|
|
75
|
+
margin_top?: Length;
|
|
76
|
+
margin_right?: Length;
|
|
77
|
+
margin_bottom?: Length;
|
|
78
|
+
}
|
|
79
|
+
export type ShapeKind = "placeholder" | "textbox" | "picture" | "movie" | "autoshape" | "table" | "chart" | "component";
|
|
80
|
+
/** A table cell's edge (`a:lnL`, `a:lnR`, `a:lnT`, `a:lnB`). */
|
|
81
|
+
export interface CellBorder {
|
|
82
|
+
color: Color;
|
|
83
|
+
width: Length;
|
|
84
|
+
}
|
|
85
|
+
/** A table's cell (`a:tc`). */
|
|
86
|
+
export interface TableCellDef {
|
|
87
|
+
text: TextFrameDef;
|
|
88
|
+
fill?: Color | null;
|
|
89
|
+
borders?: Partial<Record<"left" | "right" | "top" | "bottom", CellBorder>>;
|
|
90
|
+
/** Columns and rows it takes, merged (`@gridSpan`, `@rowSpan`). */
|
|
91
|
+
span_width?: number;
|
|
92
|
+
span_height?: number;
|
|
93
|
+
/** Another cell's, merged over it (`@hMerge`, `@vMerge`). */
|
|
94
|
+
spanned?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/** A table (`a:tbl`). What PowerPoint's style would paint is the deck's own: a table here has no style, so its look is its cells'. */
|
|
97
|
+
export interface TableDef {
|
|
98
|
+
columns: Length[];
|
|
99
|
+
rows: {
|
|
100
|
+
height: Length;
|
|
101
|
+
cells: TableCellDef[];
|
|
102
|
+
}[];
|
|
103
|
+
/** What its first row and so on are, for those who read it by them (`a:tblPr`); they paint nothing. */
|
|
104
|
+
first_row?: boolean;
|
|
105
|
+
first_col?: boolean;
|
|
106
|
+
last_row?: boolean;
|
|
107
|
+
last_col?: boolean;
|
|
108
|
+
horz_banding?: boolean;
|
|
109
|
+
vert_banding?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/** A step of a freeform's outline, in its path's units. */
|
|
112
|
+
export type PathStep = {
|
|
113
|
+
op: "move";
|
|
114
|
+
x: number;
|
|
115
|
+
y: number;
|
|
116
|
+
} | {
|
|
117
|
+
op: "line";
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
} | {
|
|
121
|
+
op: "curve";
|
|
122
|
+
x1: number;
|
|
123
|
+
y1: number;
|
|
124
|
+
x2: number;
|
|
125
|
+
y2: number;
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
} | {
|
|
129
|
+
op: "close";
|
|
130
|
+
};
|
|
131
|
+
/** A freeform's outline: steps in a box of `w` × `h` units, stretched to the shape's frame (`a:path`). */
|
|
132
|
+
export interface FreeformPath {
|
|
133
|
+
w: number;
|
|
134
|
+
h: number;
|
|
135
|
+
steps: PathStep[];
|
|
136
|
+
}
|
|
137
|
+
/** A shape as a master, a layout or a generator's code makes it. */
|
|
138
|
+
export interface ShapeDef {
|
|
139
|
+
name: string;
|
|
140
|
+
kind: ShapeKind;
|
|
141
|
+
/** Its frame; a layout's placeholder without one takes its master's (`a:xfrm` left out). */
|
|
142
|
+
frame?: Frame;
|
|
143
|
+
/** A connector's ends: it runs from its frame's top left to its bottom right, unless flipped. */
|
|
144
|
+
flip?: {
|
|
145
|
+
h?: boolean;
|
|
146
|
+
v?: boolean;
|
|
147
|
+
};
|
|
148
|
+
/** Degrees clockwise about its centre, 0 up to 360 (`a:xfrm` rot). */
|
|
149
|
+
rotation?: number;
|
|
150
|
+
placeholder?: {
|
|
151
|
+
type: PlaceholderType;
|
|
152
|
+
idx: number;
|
|
153
|
+
};
|
|
154
|
+
text?: TextFrameDef;
|
|
155
|
+
fill?: Color | null;
|
|
156
|
+
line?: Color | null;
|
|
157
|
+
line_width?: Length;
|
|
158
|
+
line_dash?: LineDash;
|
|
159
|
+
/** What the end of its line where it starts has (`a:headEnd`), and where it ends (`a:tailEnd`). */
|
|
160
|
+
line_begin?: LineEnd;
|
|
161
|
+
line_end?: LineEnd;
|
|
162
|
+
geometry?: ShapeGeometry;
|
|
163
|
+
/** A freeform's outline (`a:custGeom`), in place of a geometry. */
|
|
164
|
+
path?: FreeformPath;
|
|
165
|
+
/** A table (`p:graphicFrame`). */
|
|
166
|
+
table?: TableDef;
|
|
167
|
+
/** A chart (`p:graphicFrame`). */
|
|
168
|
+
chart?: ChartDef;
|
|
169
|
+
/** The group it is in (`p:grpSp`), by a name the group's shapes share; a group is a file's, and drawn as its shapes. */
|
|
170
|
+
group?: string;
|
|
171
|
+
/** Its geometry's adjustments (`a:avLst`), as python-pptx's: a rounded rectangle's corner, a share of its shorter side. */
|
|
172
|
+
adjustments?: number[];
|
|
173
|
+
/** A picture or a movie: a path, and the folder of the module that named it (a project path). */
|
|
174
|
+
media?: {
|
|
175
|
+
path: string;
|
|
176
|
+
base: string;
|
|
177
|
+
poster?: number;
|
|
178
|
+
};
|
|
179
|
+
component?: {
|
|
180
|
+
name: string;
|
|
181
|
+
props: Record<string, unknown>;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export interface LayoutDef {
|
|
185
|
+
name: string;
|
|
186
|
+
master: string;
|
|
187
|
+
background?: Color | undefined;
|
|
188
|
+
/** False: its master's shapes are not drawn on its slides (`@showMasterSp`, PowerPoint's Hide Background Graphics). */
|
|
189
|
+
display_master_shapes?: boolean;
|
|
190
|
+
/** Its placeholders and its own shapes, back to front. */
|
|
191
|
+
shapes: ShapeDef[];
|
|
192
|
+
}
|
|
193
|
+
/** A master's text styles (`p:txStyles`): its titles', its other placeholders', and other text's. */
|
|
194
|
+
export interface TextStylesDef {
|
|
195
|
+
title: LevelsDef;
|
|
196
|
+
body: LevelsDef;
|
|
197
|
+
other: LevelsDef;
|
|
198
|
+
}
|
|
199
|
+
export interface MasterDef {
|
|
200
|
+
name: string;
|
|
201
|
+
background: Color;
|
|
202
|
+
text_styles: TextStylesDef;
|
|
203
|
+
/** Its placeholders (the default frame and style of each type) and the shapes every slide shows, back to front. */
|
|
204
|
+
shapes: ShapeDef[];
|
|
205
|
+
layouts: LayoutDef[];
|
|
206
|
+
}
|
|
207
|
+
/** A prop a component exposes to a person, as data (the SDK's text(), number()…). */
|
|
208
|
+
export interface PropSpec {
|
|
209
|
+
type: string;
|
|
210
|
+
optional?: boolean;
|
|
211
|
+
of?: PropSpec;
|
|
212
|
+
fields?: Readonly<Record<string, PropSpec>>;
|
|
213
|
+
kind?: string;
|
|
214
|
+
}
|
|
215
|
+
/** A component: a shape drawn by code (layers of the layer contract) in its frame. */
|
|
216
|
+
export interface ComponentDef {
|
|
217
|
+
name: string;
|
|
218
|
+
props: Readonly<Record<string, PropSpec>>;
|
|
219
|
+
/** The layers it draws, laid out in its frame's pixels (the video's layer contract). */
|
|
220
|
+
layers: (props: Record<string, unknown>, ctx: ComponentContext) => unknown[];
|
|
221
|
+
}
|
|
222
|
+
/** What a component's layers function is given. */
|
|
223
|
+
export interface ComponentContext {
|
|
224
|
+
/** Its frame's pixels as the stage draws it. */
|
|
225
|
+
width: number;
|
|
226
|
+
height: number;
|
|
227
|
+
/** The slide it is on. */
|
|
228
|
+
slide: string;
|
|
229
|
+
}
|
|
230
|
+
/** A slide a generator makes. */
|
|
231
|
+
export interface GeneratedSlideDef {
|
|
232
|
+
/** Its id in the block: the slide is `<block>/<id>`. */
|
|
233
|
+
id: string;
|
|
234
|
+
layout: string;
|
|
235
|
+
/** Its layout's placeholders it moved or styled, by idx, and the shapes it adds. */
|
|
236
|
+
shapes: ShapeDef[];
|
|
237
|
+
/** Text set on a layout's placeholder, by its idx. */
|
|
238
|
+
text: Record<number, ParagraphDef[]>;
|
|
239
|
+
/** Its Animation Pane, in order. */
|
|
240
|
+
animations?: AnimationFile[];
|
|
241
|
+
/** How it comes on from the slide before. */
|
|
242
|
+
transition?: TransitionFile;
|
|
243
|
+
notes?: string;
|
|
244
|
+
}
|
|
245
|
+
export interface GeneratorContext {
|
|
246
|
+
/** A data file (CSV rows, YAML, JSON) from the deck's folder. */
|
|
247
|
+
data: (path: string) => unknown;
|
|
248
|
+
}
|
|
249
|
+
export interface GeneratorDef {
|
|
250
|
+
name: string;
|
|
251
|
+
make: (ctx: GeneratorContext) => GeneratedSlideDef[];
|
|
252
|
+
}
|
|
253
|
+
/** A deck's definition: what slides.ts makes. */
|
|
254
|
+
export interface DeckDef {
|
|
255
|
+
slide_width: Length;
|
|
256
|
+
slide_height: Length;
|
|
257
|
+
theme?: ThemeInput;
|
|
258
|
+
masters: MasterDef[];
|
|
259
|
+
components: Record<string, ComponentDef>;
|
|
260
|
+
generators: Record<string, GeneratorDef>;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* A deck as its stage drew it, in one language: what its PowerPoint file
|
|
264
|
+
* is written from. Its masters and layouts as code made them, its slides
|
|
265
|
+
* resolved (`ResolvedSlide`, resolve.ts), its theme as resolved.
|
|
266
|
+
*/
|
|
267
|
+
export interface DrawnDeck<Slide = unknown, DeckTheme = unknown> {
|
|
268
|
+
width: Length;
|
|
269
|
+
height: Length;
|
|
270
|
+
theme: DeckTheme;
|
|
271
|
+
masters: MasterDef[];
|
|
272
|
+
slides: Slide[];
|
|
273
|
+
/** The share autofit shrank a text to, by `<slide>/<shape>`. */
|
|
274
|
+
fitted: Record<string, number>;
|
|
275
|
+
/** The deck's language, its combo's. */
|
|
276
|
+
lang?: string;
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=model.d.ts.map
|