@allyhub/sdk 0.5.0 → 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.
- package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
- package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +179 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +303 -11
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +135 -3
- package/dist/node_modules/@allyhub-next/formats/dist/zip.d.ts +17 -0
- package/dist/node_modules/@allyhub-next/formats/dist/zip.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/package.json +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/api/capabilities.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/api/index.d.ts +1 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/index.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/api/page.d.ts +83 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/page.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.d.ts +40 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +64 -7
- package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +23 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-file.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +20 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +37 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.d.ts +5 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +7 -2
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/dist/sheets.d.ts +1 -1
- package/dist/sheets.js +1 -1
- package/docs/defaults.md +23 -0
- package/docs/sheets.md +25 -0
- package/docs/slides.md +4 -4
- package/package.json +1 -1
|
@@ -57,6 +57,22 @@ export declare const MSO_SHAPE: {
|
|
|
57
57
|
readonly OVAL: "ellipse";
|
|
58
58
|
readonly ISOSCELES_TRIANGLE: "triangle";
|
|
59
59
|
readonly RIGHT_ARROW: "rightArrow";
|
|
60
|
+
readonly LEFT_ARROW: "leftArrow";
|
|
61
|
+
readonly UP_ARROW: "upArrow";
|
|
62
|
+
readonly DOWN_ARROW: "downArrow";
|
|
63
|
+
readonly LEFT_RIGHT_ARROW: "leftRightArrow";
|
|
64
|
+
readonly DIAMOND: "diamond";
|
|
65
|
+
readonly PARALLELOGRAM: "parallelogram";
|
|
66
|
+
readonly TRAPEZOID: "trapezoid";
|
|
67
|
+
readonly REGULAR_PENTAGON: "pentagon";
|
|
68
|
+
readonly HEXAGON: "hexagon";
|
|
69
|
+
readonly OCTAGON: "octagon";
|
|
70
|
+
readonly CHEVRON: "chevron";
|
|
71
|
+
readonly PENTAGON: "homePlate";
|
|
72
|
+
readonly CROSS: "plus";
|
|
73
|
+
readonly STAR_4_POINT: "star4";
|
|
74
|
+
readonly STAR_5_POINT: "star5";
|
|
75
|
+
readonly RECTANGULAR_CALLOUT: "wedgeRectCallout";
|
|
60
76
|
};
|
|
61
77
|
/** A connector's kind (`add_connector`). */
|
|
62
78
|
export declare const MSO_CONNECTOR: {
|
|
@@ -112,6 +128,9 @@ export declare const XL_CHART_TYPE: {
|
|
|
112
128
|
readonly AREA_STACKED_100: "area-stacked-100";
|
|
113
129
|
readonly PIE: "pie";
|
|
114
130
|
readonly DOUGHNUT: "doughnut";
|
|
131
|
+
readonly XY_SCATTER: "scatter";
|
|
132
|
+
readonly XY_SCATTER_LINES: "scatter-lines";
|
|
133
|
+
readonly XY_SCATTER_SMOOTH: "scatter-smooth";
|
|
115
134
|
};
|
|
116
135
|
/** Where a chart's legend is. */
|
|
117
136
|
export declare const XL_LEGEND_POSITION: {
|
|
@@ -136,6 +155,7 @@ export declare const XL_LABEL_POSITION: {
|
|
|
136
155
|
export declare const MSO_FILL: {
|
|
137
156
|
readonly SOLID: "solid";
|
|
138
157
|
readonly BACKGROUND: "background";
|
|
158
|
+
readonly GRADIENT: "gradient";
|
|
139
159
|
};
|
|
140
160
|
export type FillType = (typeof MSO_FILL)[keyof typeof MSO_FILL];
|
|
141
161
|
/** The theme's fonts as a run names them (`+mj-lt`, `+mn-lt`). */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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"});
|
|
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",LEFT_ARROW:"leftArrow",UP_ARROW:"upArrow",DOWN_ARROW:"downArrow",LEFT_RIGHT_ARROW:"leftRightArrow",DIAMOND:"diamond",PARALLELOGRAM:"parallelogram",TRAPEZOID:"trapezoid",REGULAR_PENTAGON:"pentagon",HEXAGON:"hexagon",OCTAGON:"octagon",CHEVRON:"chevron",PENTAGON:"homePlate",CROSS:"plus",STAR_4_POINT:"star4",STAR_5_POINT:"star5",RECTANGULAR_CALLOUT:"wedgeRectCallout"}),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",XY_SCATTER:"scatter",XY_SCATTER_LINES:"scatter-lines",XY_SCATTER_SMOOTH:"scatter-smooth"}),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",GRADIENT:"gradient"}),THEME_FONT=E("THEME_FONT",{MAJOR:"+mj-lt",MINOR:"+mn-lt"});
|
|
@@ -7,6 +7,7 @@ export * from "./chart-api.js";
|
|
|
7
7
|
export { chartOfFile } from "./chart-file.js";
|
|
8
8
|
export * from "./office.js";
|
|
9
9
|
export * from "./path.js";
|
|
10
|
+
export * from "./preset.js";
|
|
10
11
|
export * from "./placeholders.js";
|
|
11
12
|
export * from "./theme.js";
|
|
12
13
|
export * from "./model.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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"@allyhub-next/chart";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";
|
|
2
|
+
export*from"./units.js";export*from"./enums.js";export*from"./strict.js";export*from"./animation.js";export*from"@allyhub-next/chart";export*from"./chart-api.js";export{chartOfFile}from"./chart-file.js";export*from"./office.js";export*from"./path.js";export*from"./preset.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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnimationFile, LineDash, TransitionFile, LineEnd, ShapeGeometry, TextAlign, ThemeColor } from "@allyhub-next/formats";
|
|
1
|
+
import type { AnimationFile, LineDash, Numbering, TransitionFile, LineEnd, ShapeGeometry, TextAlign, ThemeColor } from "@allyhub-next/formats";
|
|
2
2
|
import type { ChartDef, Color } from "@allyhub-next/chart";
|
|
3
3
|
import type { Anchor, AutoSize, PlaceholderType } from "./enums.js";
|
|
4
4
|
import type { ThemeInput } from "./theme.js";
|
|
@@ -23,6 +23,14 @@ export interface FontDef {
|
|
|
23
23
|
rgb?: string;
|
|
24
24
|
/** Space added between letters (negative tightens), EMU (`a:rPr` spc). */
|
|
25
25
|
spacing?: Length;
|
|
26
|
+
/** A line through it (`@strike`). */
|
|
27
|
+
strike?: boolean;
|
|
28
|
+
/** Raised (above 0) or lowered, a share of its size: superscript 0.3, subscript -0.25 (`@baseline`). */
|
|
29
|
+
baseline?: number;
|
|
30
|
+
/** The colour behind it, `#RRGGBB` (`a:highlight`). */
|
|
31
|
+
highlight?: string;
|
|
32
|
+
/** The address it opens (`a:hlinkClick`): drawn in the theme's link colour, underlined. */
|
|
33
|
+
link?: string;
|
|
26
34
|
}
|
|
27
35
|
export interface RunDef {
|
|
28
36
|
/** Its text; `\v` is a line break in the paragraph (`a:br`). */
|
|
@@ -30,6 +38,8 @@ export interface RunDef {
|
|
|
30
38
|
font?: FontDef;
|
|
31
39
|
/** The script's `` `code` ``: its font is the theme's code font. */
|
|
32
40
|
code?: boolean;
|
|
41
|
+
/** Its text is the slide's number, which PowerPoint keeps up to date (`a:fld`). */
|
|
42
|
+
field?: "slidenum";
|
|
33
43
|
}
|
|
34
44
|
/** Line spacing (`a:lnSpc`): a multiple of the line (`a:spcPct`) or a fixed height (`a:spcPts`). */
|
|
35
45
|
export type LineSpacing = {
|
|
@@ -47,6 +57,8 @@ export interface ParagraphFormatDef {
|
|
|
47
57
|
bullet?: string | null;
|
|
48
58
|
/** The bullet's typeface (`a:buFont`). */
|
|
49
59
|
bullet_font?: string;
|
|
60
|
+
/** Counted in place of a bullet (`a:buAutoNum`). */
|
|
61
|
+
numbered?: Numbering;
|
|
50
62
|
/** Where its lines start (`@marL`), and its first line from there (`@indent`, negative for a hanging bullet). */
|
|
51
63
|
margin_left?: Length;
|
|
52
64
|
indent?: Length;
|
|
@@ -131,6 +143,25 @@ export interface FreeformPath {
|
|
|
131
143
|
h: number;
|
|
132
144
|
steps: PathStep[];
|
|
133
145
|
}
|
|
146
|
+
/** A gradient fill (`a:gradFill`), `at` and `transparency` shares. */
|
|
147
|
+
export interface GradientDef {
|
|
148
|
+
/** Degrees clockwise from left to right. */
|
|
149
|
+
angle: number;
|
|
150
|
+
stops: {
|
|
151
|
+
at: number;
|
|
152
|
+
color: Color;
|
|
153
|
+
transparency?: number;
|
|
154
|
+
}[];
|
|
155
|
+
}
|
|
156
|
+
/** A shadow outside a shape (`a:outerShdw`). */
|
|
157
|
+
export interface ShadowDef {
|
|
158
|
+
color: Color;
|
|
159
|
+
blur: Length;
|
|
160
|
+
distance: Length;
|
|
161
|
+
/** Degrees clockwise from the right. */
|
|
162
|
+
angle: number;
|
|
163
|
+
transparency: number;
|
|
164
|
+
}
|
|
134
165
|
/** A shape as a master, a layout or a generator's code makes it. */
|
|
135
166
|
export interface ShapeDef {
|
|
136
167
|
name: string;
|
|
@@ -150,6 +181,11 @@ export interface ShapeDef {
|
|
|
150
181
|
};
|
|
151
182
|
text?: TextFrameDef;
|
|
152
183
|
fill?: Color | null;
|
|
184
|
+
/** How much of its fill shows through, a share (`a:alpha`). */
|
|
185
|
+
fill_transparency?: number;
|
|
186
|
+
/** A gradient in place of its fill. */
|
|
187
|
+
gradient?: GradientDef;
|
|
188
|
+
shadow?: ShadowDef;
|
|
153
189
|
line?: Color | null;
|
|
154
190
|
line_width?: Length;
|
|
155
191
|
line_dash?: LineDash;
|
|
@@ -55,4 +55,14 @@ export declare const CONNECTOR_STYLE: {
|
|
|
55
55
|
readonly line: "accent1";
|
|
56
56
|
readonly line_width: number;
|
|
57
57
|
};
|
|
58
|
+
/** A shadow where it says nothing, as PowerPoint's Offset preset: lengths in EMU, the colour black. */
|
|
59
|
+
export declare const SHADOW_DEFAULTS: {
|
|
60
|
+
readonly color: {
|
|
61
|
+
readonly rgb: "#000000";
|
|
62
|
+
};
|
|
63
|
+
readonly blur: number;
|
|
64
|
+
readonly distance: number;
|
|
65
|
+
readonly angle: 45;
|
|
66
|
+
readonly transparency: 0.6;
|
|
67
|
+
};
|
|
58
68
|
//# sourceMappingURL=office.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{Emu as n,Inches as o,Pt as e}from"./units.js";const
|
|
2
|
+
import{Emu as n,Inches as o,Pt as e}from"./units.js";const i=9,r=t=>Array.from({length:i},(l,c)=>t(c));export const OFFICE_TEXT_STYLES={title:r(()=>({alignment:"l",line_spacing:{lines:.9},space_before:0,bullet:null,font:{name:"+mj-lt",size:e(44),color:"dk1"}})),body:r(t=>({alignment:"l",line_spacing:{lines:.9},space_before:t===0?e(10):e(5),bullet:"•",bullet_font:"Arial",margin_left:n(228600+t*457200),indent:n(-228600),font:{name:"+mn-lt",size:e([28,24,20][t]??18),color:"dk1"}})),other:r(t=>({alignment:"l",margin_left:n(t*457200),font:{name:"+mn-lt",size:e(18),color:"dk1"}}))},TEXT_FALLBACK={alignment:"l",line_spacing:{lines:1},space_before:0,space_after:0,indent:0,font:{name:"+mn-lt",size:e(18),color:"dk1"}},TEXT_INSETS={left:o(.1),top:o(.05),right:o(.1),bottom:o(.05)},styleKindOf=t=>t===void 0||t==="dt"||t==="ftr"||t==="sldNum"?"other":t==="title"||t==="ctrTitle"?"title":"body";export function placeholderFrame(t){const l=t==="dt"||t==="ftr"||t==="sldNum";return{vertical_anchor:t==="title"||t==="ctrTitle"||l?"ctr":"t",auto_size:l?"none":"text",word_wrap:!0}}export const FOOTER_IDX={dt:10,ftr:11,sldNum:12},TEXTBOX_FRAME={word_wrap:!1,auto_size:"shape"},DRAWN_TEXTBOX_FRAME={word_wrap:!0,auto_size:"shape"},AUTOSHAPE_STYLE={fill:"accent1",line:"accent1",line_width:n(6350),font_color:"lt1",vertical_anchor:"ctr",alignment:"ctr"},CONNECTOR_STYLE={line:"accent1",line_width:n(12700)},SHADOW_DEFAULTS={color:{rgb:"#000000"},blur:e(4),distance:e(3),angle:45,transparency:.6};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ShapeGeometry } from "@allyhub-next/formats";
|
|
2
|
+
import type { FreeformPath } from "./model.js";
|
|
3
|
+
/** A preset's outline in a frame of `w` × `h`; none for those drawn another way (a rectangle, a rounded one, an ellipse, a line). */
|
|
4
|
+
export declare function presetPath(geometry: ShapeGeometry | undefined, w: number, h: number): FreeformPath | undefined;
|
|
5
|
+
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
const p=(n,t,o)=>({w:n,h:t,steps:[...o.map(([r,e],a)=>({op:a===0?"move":"line",x:r,y:e})),{op:"close"}]});function i(n,t,o,r,e,a){return Array.from({length:n*2},(g,c)=>{const l=-Math.PI/2+c*Math.PI/n,u=c%2===0?1:t;return[o+e*u*Math.cos(l),r+a*u*Math.sin(l)]})}const d={triangle:(n,t)=>[[n/2,0],[n,t],[0,t]],rightArrow:(n,t,o)=>[[0,t/4],[n-o/2,t/4],[n-o/2,0],[n,t/2],[n-o/2,t],[n-o/2,t*3/4],[0,t*3/4]],leftArrow:(n,t,o)=>[[n,t/4],[o/2,t/4],[o/2,0],[0,t/2],[o/2,t],[o/2,t*3/4],[n,t*3/4]],upArrow:(n,t,o)=>[[n/4,t],[n/4,o/2],[0,o/2],[n/2,0],[n,o/2],[n*3/4,o/2],[n*3/4,t]],downArrow:(n,t,o)=>[[n/4,0],[n/4,t-o/2],[0,t-o/2],[n/2,t],[n,t-o/2],[n*3/4,t-o/2],[n*3/4,0]],leftRightArrow:(n,t,o)=>[[0,t/2],[o/2,0],[o/2,t/4],[n-o/2,t/4],[n-o/2,0],[n,t/2],[n-o/2,t],[n-o/2,t*3/4],[o/2,t*3/4],[o/2,t]],diamond:(n,t)=>[[n/2,0],[n,t/2],[n/2,t],[0,t/2]],parallelogram:(n,t,o)=>[[o/4,0],[n,0],[n-o/4,t],[0,t]],trapezoid:(n,t,o)=>[[o/4,0],[n-o/4,0],[n,t],[0,t]],pentagon:(n,t)=>[[n/2,0],[n,t*.382],[n*.809,t],[n*.191,t],[0,t*.382]],hexagon:(n,t,o)=>[[0,t/2],[o/4,0],[n-o/4,0],[n,t/2],[n-o/4,t],[o/4,t]],octagon:(n,t,o)=>{const r=o*.29289;return[[r,0],[n-r,0],[n,r],[n,t-r],[n-r,t],[r,t],[0,t-r],[0,r]]},chevron:(n,t,o)=>[[0,0],[n-o/2,0],[n,t/2],[n-o/2,t],[0,t],[o/2,t/2]],homePlate:(n,t,o)=>[[0,0],[n-o/2,0],[n,t/2],[n-o/2,t],[0,t]],plus:(n,t,o)=>{const r=o/4;return[[r,0],[n-r,0],[n-r,r],[n,r],[n,t-r],[n-r,t-r],[n-r,t],[r,t],[r,t-r],[0,t-r],[0,r],[r,r]]},star4:(n,t)=>i(4,.25,n/2,t/2,n/2,t/2),star5:(n,t)=>i(5,.38196,n/2,t*.55279,n*.52573,t*.55279),wedgeRectCallout:(n,t)=>[[0,0],[n,0],[n,t],[n*5/12,t],[n*.29167,t*1.125],[n/6,t],[0,t]]};export function presetPath(n,t,o){const r=n===void 0?void 0:d[n];return r?p(t,o,r(t,o,Math.min(t,o))):void 0}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ShapeFile, SlidesFile, TextAlign } from "@allyhub-next/formats";
|
|
1
|
+
import type { ShapeFile, SlidesFile, Numbering, TextAlign } from "@allyhub-next/formats";
|
|
2
2
|
import type { ChartDef } from "@allyhub-next/chart";
|
|
3
3
|
import type { Anchor, AutoSize, PlaceholderType } from "./enums.js";
|
|
4
|
-
import type { Color, DeckDef, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, ShapeDef, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
|
|
4
|
+
import type { Color, DeckDef, FontDef, Frame, LevelsDef, LineSpacing, MasterDef, ParagraphDef, GradientDef, ShadowDef, ShapeDef, ShapeKind, TableCellDef, TableDef, TextFrameDef } from "./model.js";
|
|
5
5
|
import { type ResolvedAnimation, type ResolvedTransition } from "./animation.js";
|
|
6
6
|
import { type Theme } from "./theme.js";
|
|
7
7
|
import { type Length } from "./units.js";
|
|
@@ -22,6 +22,8 @@ export interface LevelStyle {
|
|
|
22
22
|
char: string;
|
|
23
23
|
font?: string;
|
|
24
24
|
};
|
|
25
|
+
/** Counted in place of a bullet. */
|
|
26
|
+
numbered?: Numbering;
|
|
25
27
|
margin_left: Length;
|
|
26
28
|
indent: Length;
|
|
27
29
|
}
|
|
@@ -66,6 +68,9 @@ export interface ResolvedShape {
|
|
|
66
68
|
};
|
|
67
69
|
text?: ResolvedText;
|
|
68
70
|
fill?: Color | null;
|
|
71
|
+
fill_transparency?: number;
|
|
72
|
+
gradient?: GradientDef;
|
|
73
|
+
shadow?: ShadowDef;
|
|
69
74
|
line?: Color | null;
|
|
70
75
|
line_width?: Length;
|
|
71
76
|
line_dash?: NonNullable<ShapeDef["line_dash"]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readMarks as le,markRuns as de}from"@allyhub-next/video-core";import{chartOfFile as se}from"./chart-file.js";import{AUTOSHAPE_STYLE as j,CONNECTOR_STYLE as V,DRAWN_TEXTBOX_FRAME as Z,TEXT_FALLBACK as q,TEXT_INSETS as N,placeholderFrame as fe,styleKindOf as pe}from"./office.js";import{resolveAnimation as ue,resolveTransition as J}from"./animation.js";import{pathSteps as ce}from"./path.js";import{masterPlaceholder as he}from"./placeholders.js";import{DECK_FONTS as me,OFFICE_THEME as ge,themeOver as _e}from"./theme.js";import{Pt as A}from"./units.js";export function joinPath(t,o){if(o.startsWith("/"))return o.slice(1);const m=t===""?[]:t.split("/");for(const l of o.split("/"))l===""||l==="."||(l===".."?m.pop():m.push(l));return m.join("/")}const Q={left:0,top:0,width:0,height:0},P=()=>Array.from({length:9},()=>({...q,font:{...q.font},margin_left:0}));export function levelsOver(t,...o){return t.map((m,l)=>{let s={...m,font:{...m.font}};for(const $ of o){const r=$?.[l];r&&(s={...s,...r.alignment===void 0?{}:{alignment:r.alignment},...r.line_spacing===void 0?{}:{line_spacing:r.line_spacing},...r.space_before===void 0?{}:{space_before:r.space_before},...r.space_after===void 0?{}:{space_after:r.space_after},...r.margin_left===void 0?{}:{margin_left:r.margin_left},...r.indent===void 0?{}:{indent:r.indent},font:{...s.font,...r.font}},r.font?.color!==void 0&&delete s.font.rgb,r.font?.rgb!==void 0&&delete s.font.color,r.bullet===null?delete s.bullet:r.bullet!==void 0?s.bullet={char:r.bullet,...r.bullet_font===void 0?{}:{font:r.bullet_font}}:r.bullet_font!==void 0&&s.bullet&&(s.bullet={...s.bullet,font:r.bullet_font}))}return s})}function K(t,...o){const m=o.filter(s=>s!==void 0),l=s=>{for(let $=m.length-1;$>=0;$--){const r=m[$]?.[s];if(r!==void 0)return r}};return{vertical_anchor:l("vertical_anchor")??t.vertical_anchor,auto_size:l("auto_size")??t.auto_size,word_wrap:l("word_wrap")??t.word_wrap,margins:{left:l("margin_left")??N.left,top:l("margin_top")??N.top,right:l("margin_right")??N.right,bottom:l("margin_bottom")??N.bottom}}}const I={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=t=>levelsOver(P(),t.text_styles.other);function B(t,o){return{...K(I,o),levels:levelsOver(P(),t.text_styles.other,o.levels)}}function ye(t,o,...m){return{...K(fe(o),...m),levels:levelsOver(P(),t.text_styles[pe(o)],...m.map(l=>l?.levels))}}const $e=Array.from({length:9},()=>({font:{color:j.font_color}})),ee={vertical_anchor:j.vertical_anchor};function ne(t,o){return{...K(I,o),levels:levelsOver(P(),t.text_styles.other,$e,o.levels)}}const L=t=>{const o={...t};return delete o.paragraphs,o},R=t=>({paragraphs:[],levels:[],...t}),W=t=>t==="none"?null:colorOfFile(t),xe=/<span((?:\s+(?:color|font)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,be=/(color|font)="([^"\n]*)"/gu,D=57344,we=256,te="",ke=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=t=>t.startsWith("#")?{rgb:t.toUpperCase()}:t;function ie(t,o,m=[]){return{...t,rows:t.rows.map((l,s)=>({height:l.height,cells:l.cells.map($=>{const r=m[s];return{...$,text:{paragraphs:$.text.paragraphs,style:H({...B(o,$.text),auto_size:"shape"},r),own:L($.text),empty:!1},...r?{fileText:r}:{}}})}))}}function H(t,o){return o?{...t,levels:t.levels.map(m=>{const l={...m.font,...o.size===void 0?{}:{size:A(o.size)},...o.bold===void 0?{}:{bold:o.bold},...o.italic===void 0?{}:{italic:o.italic},...o.font===void 0?{}:{name:o.font}};if(o.color!==void 0){const s=colorOfFile(o.color);typeof s=="string"?(l.color=s,delete l.rgb):(l.rgb=s.rgb,delete l.color)}return{...m,font:l,...o.align===void 0?{}:{alignment:o.align}}})}:t}function Se(t){const o={};for(const[,m,l=""]of t.matchAll(be))if(m==="font")o.name=l.trim();else{const s=colorOfFile(l);typeof s=="string"?o.color=s:o.rgb=s.rgb}return o}export function paragraphsOfWords(t,o=0,m=me.code){return t===void 0?[]:typeof t=="string"?t.split(/\r?\n/u).map(l=>{const s=[],$=l.replace(xe,(v,T,z)=>(s.push(Se(T)),`${String.fromCharCode(D+s.length-1)}${z}${te}`)),r=le($);let O;const E=de(r.text,r.marks).flatMap(v=>{const T=v.kinds.includes("code"),z={...v.kinds.includes("strong")?{bold:!0}:{},...v.kinds.includes("em")?{italic:!0}:{},...T?{name:m}:{}};return[...v.text.matchAll(ke)].flatMap(U=>{const M=U[0],F=M.charCodeAt(0);if(M===te)return O=void 0,[];if(F>=D&&F<D+we)return O=s[F-D],[];const C={...O,...z};return[{text:M,...Object.keys(C).length>0?{font:C}:{},...T?{code:!0}:{}}]})});return{runs:E.length>0?E:[{text:""}],level:o}}):t.flatMap(l=>paragraphsOfWords(l,Array.isArray(l)?Math.min(o+1,8):o,m))}const oe=t=>({left:A(t.x),top:A(t.y),width:A(t.w),height:A(t.h)}),re=t=>t===void 0?void 0:{left:t.left??0,top:t.top??0,right:t.right??0,bottom:t.bottom??0};export function resolveDeck(t){const{def:o,file:m,words:l,prefix:s,base:$}=t,r=[],O=_e(t.theme??ge,o.theme),E=new Map;for(const e of o.masters)for(const n of e.layouts)E.set(n.name,{layout:n,master:e});const v=[],T=(e,n,f)=>({name:e.name,kind:e.kind,frame:{...e.frame??Q},...e.flip?{flip:{...e.flip}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?ne(f,e.text):B(f,e.text),own:L(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.path?{path:e.path}:{},...e.table?{table:ie(e.table,f)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),z=(e,n)=>{const f=e.placeholder?.type??"body",c=he(n,f),x=e.frame??c?.frame??Q;return{name:e.name,kind:"placeholder",frame:{...x},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:ye(n,f,c?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!c?"layout":"master"},text:{from:"layout"}}}},U=(e,n,f)=>{const c=o.components[e];if(!c){r.push({...f,message:`There is no component ${e} in slides.ts (it has ${Object.keys(o.components).join(", ")||"none"}).`});return}for(const x of Object.keys(n??{}))Object.hasOwn(c.props,x)||r.push({...f,message:`Component ${e} has no prop ${x} a person sets (it has ${Object.keys(c.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}}}},M=(e,n,f,c,x)=>{const b={slide:c,shape:e,path:f};if(!n.frame){r.push({...b,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const S=oe(n.frame),a={frame:{from:"slide",path:`${f}.frame`}},_={name:e,frame:S,level:"slide",...n.fill===void 0?{}:{fill:colorOfFile(n.fill)},...n.line===void 0?{}:{line:W(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.group===void 0?{}:{group:n.group}};if(n.textbox)return{..._,kind:"textbox",text:{paragraphs:paragraphsOfWords(l(`${s}.${c}.${e}`),0,O.fonts.code),style:H(B(x,R(Z)),n.text),own:L(R(Z)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...a,text:{from:"slide",path:`${f}.text`}}};if(n.picture!==void 0){const d=re(n.crop);return{..._,kind:"picture",media:{path:joinPath($,n.picture),...d?{crop:d}:{}},sources:a}}if(n.movie!==void 0)return{..._,kind:"movie",media:{path:joinPath($,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:a};if(n.chart){const d=l(`${s}.${c}.${e}`),h=se(n.chart,{title:typeof d=="string"?d:void 0,base:$,rows:i=>t.data?.(i),problem:i=>{r.push({...b,message:`Chart ${e}: ${i}`})}});return h?{..._,kind:"chart",chart:h,sources:a}:void 0}if(n.table){const d=n.table,h=S.width/d.columns.reduce((g,w)=>g+w,0),i=S.height/d.rows.reduce((g,w)=>g+w.height,0),p=l(`${s}.${c}.${e}`),y=Array.isArray(p)?p:[];return y.length>d.rows.length&&r.push({...b,message:`Table ${e} has ${String(d.rows.length)} rows and its words ${String(y.length)}.`}),{..._,kind:"table",table:ie({columns:d.columns.map(g=>Math.round(g*h)),rows:d.rows.map((g,w)=>{const k=y[w],X=Array.isArray(k)?k:k===void 0?[]:[k];return{height:Math.round(g.height*i),cells:d.columns.map((ve,ae)=>({text:{levels:[],paragraphs:paragraphsOfWords(X[ae],0,O.fonts.code)},...g.fill===void 0?{}:{fill:colorOfFile(g.fill)},...g.line===void 0?{}:{borders:{bottom:{color:colorOfFile(g.line),width:A(1)}}}}))}})},x,d.rows.map(g=>g.text)),sources:a}}const u=n.path&&ce(n.path.d);if(n.path&&!u){r.push({...b,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&u)return{..._,kind:"autoshape",...n.path&&u?{path:{w:n.path.w,h:n.path.h,steps:u}}:n.geometry===void 0?{}:{geometry:n.geometry},...n.geometry==="line"?{line:n.line===void 0?V.line:W(n.line),line_width:n.line_width===void 0?V.line_width:A(n.line_width)}:{fill:n.fill===void 0?j.fill:colorOfFile(n.fill),line:n.line===void 0?j.line:W(n.line),line_width:n.line_width===void 0?j.line_width:A(n.line_width)},...n.text&&n.geometry!=="line"?{fileText:{...n.text}}:{},...n.geometry==="line"?{}:{text:{paragraphs:paragraphsOfWords(l(`${s}.${c}.${e}`)).map(d=>n.text?.align===void 0?{alignment:j.alignment,...d}:d),style:H(ne(x,R(ee)),n.text),own:L(R(ee)),empty:!1}},sources:{...a,fill:{from:"slide",path:`${f}.fill`}}};if(n.component!==void 0){const d=U(n.component,n.props,b);return d?{..._,kind:"component",component:d,sources:a}:void 0}},F=(e,n,f)=>{if(n.frame&&(e.frame=oe(n.frame),e.sources.frame={from:"slide",path:`${f}.frame`}),n.text&&e.text&&(e.text.style=H(e.text.style,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${f}.text`}),n.line!==void 0&&(e.line=W(n.line),e.sources.line={from:"slide",path:`${f}.line`}),n.line_width!==void 0&&(e.line_width=A(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.fill!==void 0&&(e.fill=colorOfFile(n.fill),e.sources.fill={from:"slide",path:`${f}.fill`}),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const c=re(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath($,n.picture??n.movie??""),...c?{crop:c}:{},...n.poster===void 0?{}:{poster:n.poster}},delete e.text}},C=(e,n,f,c,x)=>{const b=E.get(n);if(!b){r.push({slide:e,path:`slides.${String(f)}.layout`,message:`Slide ${e} is on the layout "${n}", which slides.ts does not have (it has ${[...E.keys()].join(", ")||"none"}).`});return}const{layout:S,master:a}=b,_=[...(S.display_master_shapes===!1?[]:a.shapes).filter(d=>d.kind!=="placeholder").map(d=>T(d,"master",a)),...S.shapes.filter(d=>d.kind!=="placeholder").map(d=>T(d,"layout",a))],u=S.shapes.filter(d=>d.kind==="placeholder").map((d,h)=>({shape:z(d,a),order:h}));return{slide:{id:e,layout:S.name,master:a.name,hidden:c,background:S.background??a.background,shapes:_,animations:[],file:{index:f,...x===void 0?{}:{generate:x}}},placed:u,master:a}},G=(e,n,f,c,x,b,S,a,_)=>{const u=new Set(f.map(h=>h.shape.name));let d=f.length;for(const[h,i]of Object.entries(c??{})){const p=b(h);if(p===void 0)continue;const y=`${x}.shapes.${h}`,g=i.textbox!==void 0||i.geometry!==void 0||i.path!==void 0||i.table!==void 0||i.chart!==void 0||i.component!==void 0||(i.picture!==void 0||i.movie!==void 0)&&!u.has(p),w=f.find(X=>X.shape.name===p);if(w&&!g){F(w.shape,i,y),i.z!==void 0&&(w.z=i.z);continue}if(w){r.push({slide:e.id,shape:p,path:y,message:`Slide ${e.id} has a ${w.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!g){r.push({slide:e.id,shape:p,path:y,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...u].join(", ")||"none"}).`});continue}const k=M(p,i,y,e.id,n);k&&(f.push({shape:k,order:d++,...i.z===void 0?{}:{z:i.z}}),u.add(p))}f.sort((h,i)=>(h.z??0)-(i.z??0)||h.order-i.order);for(const h of f){const i=h.shape.text;if(h.shape.kind==="placeholder"&&i){const p=S(h.shape);i.paragraphs=paragraphsOfWords(p,0,O.fonts.code),i.empty=i.paragraphs.length===0||i.paragraphs.every(y=>y.runs.every(g=>g.text===""))}}e.shapes.push(...f.map(h=>h.shape)),a!==void 0&&a.trim()!==""&&(e.notes=a);for(const[h,i]of(_??[]).entries()){const p=b(i.shape);if(p===void 0)continue;const y={slide:e.id,shape:p,path:`${x}.animations.${String(h)}`},g=e.shapes.find(k=>k.name===p&&k.level==="slide");if(!g){r.push({...y,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(k=>k.level==="slide").map(k=>k.name).join(", ")}).`});continue}if(i.paragraph!==void 0&&i.paragraph>=(g.text?.paragraphs.length??0)){r.push({...y,message:`Shape ${p} has no paragraph ${String(i.paragraph)} to animate (it has ${String(g.text?.paragraphs.length??0)}).`});continue}const w=ue({...i,shape:p});w?e.animations.push(w):r.push({...y,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},Y=new Set;return m.slides.forEach((e,n)=>{const f=`slides.${String(n)}`;if(e.layout!==void 0){const a=C(e.id,e.layout,n,e.hidden===!0);if(!a)return;const _=l(`${s}.${e.id}.notes`);e.transition&&(a.slide.transition=J(e.transition)),G(a.slide,a.master,a.placed,e.shapes,f,u=>u,u=>l(`${s}.${e.id}.${u.name}`),typeof _=="string"?_:void 0,e.animations),v.push(a.slide),Y.add(e.id);return}const c=e.generate??"",x=o.generators[c];if(!x){r.push({slide:e.id,path:`${f}.generate`,message:`There is no generator ${c} in slides.ts (it has ${Object.keys(o.generators).join(", ")||"none"}).`});return}let b;try{b=x.make({data:t.data??(()=>{throw new Error("No data here.")})})}catch(a){r.push({slide:e.id,path:`${f}.generate`,message:`Generator ${c} failed: ${a instanceof Error?a.message:String(a)}`});return}const S=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const a of b){const _=`${e.id}/${a.id}`,u=C(_,a.layout,n,S.has(a.id),c);if(!u)continue;for(const i of a.shapes){const p=i.placeholder?u.placed.find(y=>y.shape.placeholder?.idx===i.placeholder?.idx):void 0;if(p)i.frame&&(p.shape.frame={...i.frame}),p.shape.sources.frame={from:"code"};else{const y=T(i,"layout",u.master);u.placed.push({shape:{...y,level:"slide",sources:{frame:{from:"code"}}},order:u.placed.length})}}const d=`${a.id}/`,h=a.transition??(a===b[0]?e.transition:void 0);h&&(u.slide.transition=J(h)),G(u.slide,u.master,u.placed,e.shapes,f,i=>i.startsWith(d)?i.slice(d.length):void 0,i=>{const p=i.placeholder===void 0?void 0:a.text[i.placeholder.idx];return p===void 0?void 0:p.map(y=>y.runs.map(g=>g.text).join(""))},a.notes,[...(a.animations??[]).map(i=>({...i,shape:`${d}${i.shape}`})),...e.animations??[]]);for(const i of u.slide.shapes){const p=i.placeholder===void 0?void 0:a.text[i.placeholder.idx];p&&i.text&&(i.text.paragraphs=p,i.text.empty=!1)}v.push(u.slide),Y.add(_)}for(const a of Object.keys(e.shapes??{})){const[_]=a.split("/");_!==void 0&&!b.some(u=>u.id===_)&&r.push({slide:e.id,path:`${f}.shapes.${a}`,message:`Generator ${c} makes no slide ${_}: ${a} changes nothing.`})}}),{deck:{width:o.slide_width,height:o.slide_height,theme:O,slides:v},problems:r}}
|
|
2
|
+
import{readMarks as fe,markRuns as ce}from"@allyhub-next/video-core";import{chartOfFile as ue}from"./chart-file.js";import{AUTOSHAPE_STYLE as j,SHADOW_DEFAULTS as C,CONNECTOR_STYLE as V,DRAWN_TEXTBOX_FRAME as Z,TEXT_FALLBACK as q,TEXT_INSETS as P,placeholderFrame as pe,styleKindOf as he}from"./office.js";import{resolveAnimation as me,resolveTransition as J}from"./animation.js";import{pathSteps as ge}from"./path.js";import{masterPlaceholder as _e}from"./placeholders.js";import{DECK_FONTS as ye,OFFICE_THEME as be,themeOver as xe}from"./theme.js";import{Pt as v}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const c=i===""?[]:i.split("/");for(const a of t.split("/"))a===""||a==="."||(a===".."?c.pop():c.push(a));return c.join("/")}const Q={left:0,top:0,width:0,height:0},L=()=>Array.from({length:9},()=>({...q,font:{...q.font},margin_left:0}));export function levelsOver(i,...t){return i.map((c,a)=>{let d={...c,font:{...c.font}};for(const y of t){const o=y?.[a];o&&(d={...d,...o.alignment===void 0?{}:{alignment:o.alignment},...o.line_spacing===void 0?{}:{line_spacing:o.line_spacing},...o.space_before===void 0?{}:{space_before:o.space_before},...o.space_after===void 0?{}:{space_after:o.space_after},...o.margin_left===void 0?{}:{margin_left:o.margin_left},...o.indent===void 0?{}:{indent:o.indent},font:{...d.font,...o.font}},o.font?.color!==void 0&&delete d.font.rgb,o.font?.rgb!==void 0&&delete d.font.color,o.numbered!==void 0&&(d.numbered=o.numbered,delete d.bullet),o.bullet===null?(delete d.bullet,delete d.numbered):o.bullet!==void 0?(delete d.numbered,d.bullet={char:o.bullet,...o.bullet_font===void 0?{}:{font:o.bullet_font}}):o.bullet_font!==void 0&&d.bullet&&(d.bullet={...d.bullet,font:o.bullet_font}))}return d})}function B(i,...t){const c=t.filter(d=>d!==void 0),a=d=>{for(let y=c.length-1;y>=0;y--){const o=c[y]?.[d];if(o!==void 0)return o}};return{vertical_anchor:a("vertical_anchor")??i.vertical_anchor,auto_size:a("auto_size")??i.auto_size,word_wrap:a("word_wrap")??i.word_wrap,margins:{left:a("margin_left")??P.left,top:a("margin_top")??P.top,right:a("margin_right")??P.right,bottom:a("margin_bottom")??P.bottom}}}const ee={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(L(),i.text_styles.other);function G(i,t){return{...B(ee,t),levels:levelsOver(L(),i.text_styles.other,t.levels)}}function $e(i,t,...c){return{...B(pe(t),...c),levels:levelsOver(L(),i.text_styles[he(t)],...c.map(a=>a?.levels))}}const we=Array.from({length:9},()=>({font:{color:j.font_color}})),ne={vertical_anchor:j.vertical_anchor};function te(i,t){return{...B(ee,t),levels:levelsOver(L(),i.text_styles.other,we,t.levels)}}const R=i=>{const t={...i};return delete t.paragraphs,t},D=i=>({paragraphs:[],levels:[],...i}),W=i=>i==="none"?null:colorOfFile(i),ke=/<span((?:\s+(?:color|font|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,Se=/(color|font|link|highlight|baseline|strike)="([^"\n]*)"/gu,U=57344,ve=256,ie="",Ae=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>i.startsWith("#")?{rgb:i.toUpperCase()}:i;function oe(i){const{shadow:t,gradient:c}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...c?{gradient:{angle:c.angle??0,stops:c.stops.map(a=>({at:a.at,color:colorOfFile(a.color),...a.transparency===void 0?{}:{transparency:a.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?C.color:colorOfFile(t.color),blur:t.blur===void 0?C.blur:v(t.blur),distance:t.distance===void 0?C.distance:v(t.distance),angle:t.angle??C.angle,transparency:t.transparency??C.transparency}}:{}}}function re(i,t,c=[]){return{...i,rows:i.rows.map((a,d)=>({height:a.height,cells:a.cells.map(y=>{const o=c[d];return{...y,text:{paragraphs:y.text.paragraphs,style:H({...G(t,y.text),auto_size:"shape"},o),own:R(y.text),empty:!1},...o?{fileText:o}:{}}})}))}}function H(i,t){return t?{...i,levels:i.levels.map(c=>{const a={...c.font,...t.size===void 0?{}:{size:v(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.font===void 0?{}:{name:t.font}};if(t.color!==void 0){const o=colorOfFile(t.color);typeof o=="string"?(a.color=o,delete a.rgb):(a.rgb=o.rgb,delete a.color)}const{bullet:d,...y}=c;return t.numbered?{...y,font:a,numbered:t.numbered,...c.margin_left===0?{margin_left:ae,indent:-ae}:{},...t.align===void 0?{}:{alignment:t.align}}:{...y,...d?{bullet:d}:{},font:a,...t.align===void 0?{}:{alignment:t.align}}})}:i}function Oe(i){const t={};for(const[,c,a=""]of i.matchAll(Se))if(c==="font")t.name=a.trim();else if(c==="link")t.link=a.trim();else if(c==="highlight")t.highlight=a.trim().toUpperCase();else if(c==="strike")t.strike=a.trim()!=="false";else if(c==="baseline"){const d=Number(a);Number.isFinite(d)&&(t.baseline=d)}else{const d=colorOfFile(a);typeof d=="string"?t.color=d:t.rgb=d.rgb}return t}const ae=342900;export function paragraphsOfWords(i,t=0,c=ye.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(a=>{const d=[],y=a.replace(ke,(A,T,N)=>(d.push(Oe(T)),`${String.fromCharCode(U+d.length-1)}${N}${ie}`)),o=fe(y);let O;const E=ce(o.text,o.marks).flatMap(A=>{const T=A.kinds.includes("code"),N={...A.kinds.includes("strong")?{bold:!0}:{},...A.kinds.includes("em")?{italic:!0}:{},...T?{name:c}:{}};return[...A.text.matchAll(Ae)].flatMap(X=>{const F=X[0],z=F.charCodeAt(0);if(F===ie)return O=void 0,[];if(z>=U&&z<U+ve)return O=d[z-U],[];const M={...O,...N};return[{text:F,...Object.keys(M).length>0?{font:M}:{},...T?{code:!0}:{}}]})});return{runs:E.length>0?E:[{text:""}],level:t}}):i.flatMap(a=>paragraphsOfWords(a,Array.isArray(a)?Math.min(t+1,8):t,c))}const le=i=>({left:v(i.x),top:v(i.y),width:v(i.w),height:v(i.h)}),de=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{def:t,file:c,words:a,prefix:d,base:y}=i,o=[],O=xe(i.theme??be,t.theme),E=new Map;for(const e of t.masters)for(const n of e.layouts)E.set(n.name,{layout:n,master:e});const A=[],T=(e,n,s)=>({name:e.name,kind:e.kind,frame:{...e.frame??Q},...e.flip?{flip:{...e.flip}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?te(s,e.text):G(s,e.text),own:R(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow?{shadow:e.shadow}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.path?{path:e.path}:{},...e.table?{table:re(e.table,s)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),N=(e,n)=>{const s=e.placeholder?.type??"body",h=_e(n,s),x=e.frame??h?.frame??Q;return{name:e.name,kind:"placeholder",frame:{...x},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:$e(n,s,h?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!h?"layout":"master"},text:{from:"layout"}}}},X=(e,n,s)=>{const h=t.components[e];if(!h){o.push({...s,message:`There is no component ${e} in slides.ts (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const x of Object.keys(n??{}))Object.hasOwn(h.props,x)||o.push({...s,message:`Component ${e} has no prop ${x} a person sets (it has ${Object.keys(h.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}}}},F=(e,n,s,h,x)=>{const $={slide:h,shape:e,path:s};if(!n.frame){o.push({...$,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const S=le(n.frame),l={frame:{from:"slide",path:`${s}.frame`}},_={name:e,frame:S,level:"slide",...n.fill===void 0?{}:{fill:colorOfFile(n.fill)},...oe(n),...n.line===void 0?{}:{line:W(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.group===void 0?{}:{group:n.group}};if(n.textbox)return{..._,kind:"textbox",text:{paragraphs:paragraphsOfWords(a(`${d}.${h}.${e}`),0,O.fonts.code),style:H(G(x,D(Z)),n.text),own:R(D(Z)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...l,text:{from:"slide",path:`${s}.text`}}};if(n.picture!==void 0){const f=de(n.crop);return{..._,kind:"picture",media:{path:joinPath(y,n.picture),...f?{crop:f}:{}},sources:l}}if(n.movie!==void 0)return{..._,kind:"movie",media:{path:joinPath(y,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:l};if(n.chart){const f=a(`${d}.${h}.${e}`),m=ue(n.chart,{title:typeof f=="string"?f:void 0,base:y,rows:r=>i.data?.(r),problem:r=>{o.push({...$,message:`Chart ${e}: ${r}`})}});return m?{..._,kind:"chart",chart:m,sources:l}:void 0}if(n.table){const f=n.table,m=S.width/f.columns.reduce((g,w)=>g+w,0),r=S.height/f.rows.reduce((g,w)=>g+w.height,0),u=a(`${d}.${h}.${e}`),b=Array.isArray(u)?u:[];return b.length>f.rows.length&&o.push({...$,message:`Table ${e} has ${String(f.rows.length)} rows and its words ${String(b.length)}.`}),{..._,kind:"table",table:re({columns:f.columns.map(g=>Math.round(g*m)),rows:f.rows.map((g,w)=>{const k=b[w],K=Array.isArray(k)?k:k===void 0?[]:[k];return{height:Math.round(g.height*r),cells:f.columns.map((Te,se)=>({text:{levels:[],paragraphs:paragraphsOfWords(K[se],0,O.fonts.code)},...g.fill===void 0?{}:{fill:colorOfFile(g.fill)},...g.line===void 0?{}:{borders:{bottom:{color:colorOfFile(g.line),width:v(1)}}}}))}})},x,f.rows.map(g=>g.text)),sources:l}}const p=n.path&&ge(n.path.d);if(n.path&&!p){o.push({...$,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&p)return{..._,kind:"autoshape",...n.path&&p?{path:{w:n.path.w,h:n.path.h,steps:p}}:n.geometry===void 0?{}:{geometry:n.geometry},...n.geometry==="line"?{line:n.line===void 0?V.line:W(n.line),line_width:n.line_width===void 0?V.line_width:v(n.line_width)}:{fill:n.fill===void 0?j.fill:colorOfFile(n.fill),line:n.line===void 0?j.line:W(n.line),line_width:n.line_width===void 0?j.line_width:v(n.line_width)},...n.text&&n.geometry!=="line"?{fileText:{...n.text}}:{},...n.geometry==="line"?{}:{text:{paragraphs:paragraphsOfWords(a(`${d}.${h}.${e}`)).map(f=>n.text?.align===void 0?{alignment:j.alignment,...f}:f),style:H(te(x,D(ne)),n.text),own:R(D(ne)),empty:!1}},sources:{...l,fill:{from:"slide",path:`${s}.fill`}}};if(n.component!==void 0){const f=X(n.component,n.props,$);return f?{..._,kind:"component",component:f,sources:l}:void 0}},z=(e,n,s)=>{if(n.frame&&(e.frame=le(n.frame),e.sources.frame={from:"slide",path:`${s}.frame`}),n.text&&e.text&&(e.text.style=H(e.text.style,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${s}.text`}),n.line!==void 0&&(e.line=W(n.line),e.sources.line={from:"slide",path:`${s}.line`}),n.line_width!==void 0&&(e.line_width=v(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.fill!==void 0&&(e.fill=colorOfFile(n.fill),e.sources.fill={from:"slide",path:`${s}.fill`}),Object.assign(e,oe(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const h=de(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(y,n.picture??n.movie??""),...h?{crop:h}:{},...n.poster===void 0?{}:{poster:n.poster}},delete e.text}},M=(e,n,s,h,x)=>{const $=E.get(n);if(!$){o.push({slide:e,path:`slides.${String(s)}.layout`,message:`Slide ${e} is on the layout "${n}", which slides.ts does not have (it has ${[...E.keys()].join(", ")||"none"}).`});return}const{layout:S,master:l}=$,_=[...(S.display_master_shapes===!1?[]:l.shapes).filter(f=>f.kind!=="placeholder").map(f=>T(f,"master",l)),...S.shapes.filter(f=>f.kind!=="placeholder").map(f=>T(f,"layout",l))],p=S.shapes.filter(f=>f.kind==="placeholder").map((f,m)=>({shape:N(f,l),order:m}));return{slide:{id:e,layout:S.name,master:l.name,hidden:h,background:S.background??l.background,shapes:_,animations:[],file:{index:s,...x===void 0?{}:{generate:x}}},placed:p,master:l}},Y=(e,n,s,h,x,$,S,l,_)=>{const p=new Set(s.map(m=>m.shape.name));let f=s.length;for(const[m,r]of Object.entries(h??{})){const u=$(m);if(u===void 0)continue;const b=`${x}.shapes.${m}`,g=r.textbox!==void 0||r.geometry!==void 0||r.path!==void 0||r.table!==void 0||r.chart!==void 0||r.component!==void 0||(r.picture!==void 0||r.movie!==void 0)&&!p.has(u),w=s.find(K=>K.shape.name===u);if(w&&!g){z(w.shape,r,b),r.z!==void 0&&(w.z=r.z);continue}if(w){o.push({slide:e.id,shape:u,path:b,message:`Slide ${e.id} has a ${w.shape.kind} ${u} already: a shape of its own needs another name.`});continue}if(!g){o.push({slide:e.id,shape:u,path:b,message:`Slide ${e.id} has no shape ${u} to change (its layout's placeholders and its own shapes are ${[...p].join(", ")||"none"}).`});continue}const k=F(u,r,b,e.id,n);k&&(s.push({shape:k,order:f++,...r.z===void 0?{}:{z:r.z}}),p.add(u))}s.sort((m,r)=>(m.z??0)-(r.z??0)||m.order-r.order);for(const m of s){const r=m.shape.text;if(m.shape.kind==="placeholder"&&r){const u=S(m.shape);r.paragraphs=paragraphsOfWords(u,0,O.fonts.code),r.empty=r.paragraphs.length===0||r.paragraphs.every(b=>b.runs.every(g=>g.text===""))}}e.shapes.push(...s.map(m=>m.shape)),l!==void 0&&l.trim()!==""&&(e.notes=l);for(const[m,r]of(_??[]).entries()){const u=$(r.shape);if(u===void 0)continue;const b={slide:e.id,shape:u,path:`${x}.animations.${String(m)}`},g=e.shapes.find(k=>k.name===u&&k.level==="slide");if(!g){o.push({...b,message:`Slide ${e.id} has no shape ${u} to animate (it has ${e.shapes.filter(k=>k.level==="slide").map(k=>k.name).join(", ")}).`});continue}if(r.paragraph!==void 0&&r.paragraph>=(g.text?.paragraphs.length??0)){o.push({...b,message:`Shape ${u} has no paragraph ${String(r.paragraph)} to animate (it has ${String(g.text?.paragraphs.length??0)}).`});continue}const w=me({...r,shape:u});w?e.animations.push(w):o.push({...b,message:`The animation of ${u} needs a path that starts with M and says only M, L and C, absolute.`})}},I=new Set;return c.slides.forEach((e,n)=>{const s=`slides.${String(n)}`;if(e.layout!==void 0){const l=M(e.id,e.layout,n,e.hidden===!0);if(!l)return;const _=a(`${d}.${e.id}.notes`);e.transition&&(l.slide.transition=J(e.transition)),Y(l.slide,l.master,l.placed,e.shapes,s,p=>p,p=>a(`${d}.${e.id}.${p.name}`),typeof _=="string"?_:void 0,e.animations),A.push(l.slide),I.add(e.id);return}const h=e.generate??"",x=t.generators[h];if(!x){o.push({slide:e.id,path:`${s}.generate`,message:`There is no generator ${h} in slides.ts (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}let $;try{$=x.make({data:i.data??(()=>{throw new Error("No data here.")})})}catch(l){o.push({slide:e.id,path:`${s}.generate`,message:`Generator ${h} failed: ${l instanceof Error?l.message:String(l)}`});return}const S=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const l of $){const _=`${e.id}/${l.id}`,p=M(_,l.layout,n,S.has(l.id),h);if(!p)continue;for(const r of l.shapes){const u=r.placeholder?p.placed.find(b=>b.shape.placeholder?.idx===r.placeholder?.idx):void 0;if(u)r.frame&&(u.shape.frame={...r.frame}),u.shape.sources.frame={from:"code"};else{const b=T(r,"layout",p.master);p.placed.push({shape:{...b,level:"slide",sources:{frame:{from:"code"}}},order:p.placed.length})}}const f=`${l.id}/`,m=l.transition??(l===$[0]?e.transition:void 0);m&&(p.slide.transition=J(m)),Y(p.slide,p.master,p.placed,e.shapes,s,r=>r.startsWith(f)?r.slice(f.length):void 0,r=>{const u=r.placeholder===void 0?void 0:l.text[r.placeholder.idx];return u===void 0?void 0:u.map(b=>b.runs.map(g=>g.text).join(""))},l.notes,[...(l.animations??[]).map(r=>({...r,shape:`${f}${r.shape}`})),...e.animations??[]]);for(const r of p.slide.shapes){const u=r.placeholder===void 0?void 0:l.text[r.placeholder.idx];u&&r.text&&(r.text.paragraphs=u,r.text.empty=!1)}A.push(p.slide),I.add(_)}for(const l of Object.keys(e.shapes??{})){const[_]=l.split("/");_!==void 0&&!$.some(p=>p.id===_)&&o.push({slide:e.id,path:`${s}.shapes.${l}`,message:`Generator ${h} makes no slide ${_}: ${l} changes nothing.`})}}),A.forEach((e,n)=>{for(const s of e.shapes)s.placeholder?.type==="sldNum"&&s.text&&(s.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],s.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:O,slides:A},problems:o}}
|
package/dist/sheets.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Alignment, AreaChart, AutoFilter, BLOCK_CELLS, BarChart, Border, CAPABILITIES, Cell, CellIsRule, ChartBase, Color, ColorScaleRule, ColumnDimension, ConditionalFormattingList, DataBarRule, DataLabelList, DataValidation, DataValidationList, DefinedName, DefinedNameDict, DifferentialStyle, DoughnutChart, Font, FormulaRule, GraphicalProperties, IconSetRule, Legend, LineChart, LineProperties, Marker, NumericAxis, PatternFill, PieChart, Reference, RowDimension, Rule, Scaling, ScatterChart, Series, Side, Table, TableList, TextAxis, Workbook, Worksheet, column_index_from_string, coordinate_to_tuple, get_column_letter, load_workbook, range_boundaries, workbook, type AlignmentOptions, type BarChartOptions, type BorderOptions, type CellIsRuleOptions, type CellValue, type SheetCodeBuild, type SheetCodeContext, type ChartData, type ColorScaleRuleOptions, type DataBarRuleOptions, type DataValidationOptions, type DifferentialStyleOptions, type FontOptions, type FormulaRuleOptions, type LoadOptions, type PatternFillOptions, type ReferenceOptions, type RuleOptions, type SeriesOptions, type SideOptions, type TableInput, type TableOptions, } from "@allyhub-next/sheet/api";
|
|
1
|
+
export { Alignment, AreaChart, AutoFilter, BLOCK_CELLS, BarChart, Comment, Image, PageMargins, PageSetup, Border, CAPABILITIES, Cell, CellIsRule, ChartBase, Color, ColorScaleRule, ColumnDimension, ConditionalFormattingList, DataBarRule, DataLabelList, DataValidation, DataValidationList, DefinedName, DefinedNameDict, DifferentialStyle, DoughnutChart, Font, FormulaRule, GraphicalProperties, IconSetRule, Legend, LineChart, LineProperties, Marker, NumericAxis, PatternFill, PieChart, Reference, RowDimension, Rule, Scaling, ScatterChart, Series, Side, Table, TableList, TextAxis, Workbook, Worksheet, column_index_from_string, coordinate_to_tuple, get_column_letter, load_workbook, range_boundaries, workbook, type AlignmentOptions, type BarChartOptions, type BorderOptions, type CellIsRuleOptions, type CellValue, type SheetCodeBuild, type SheetCodeContext, type ChartData, type ColorScaleRuleOptions, type DataBarRuleOptions, type DataValidationOptions, type DifferentialStyleOptions, type FontOptions, type FormulaRuleOptions, type LoadOptions, type PatternFillOptions, type ReferenceOptions, type RuleOptions, type SeriesOptions, type SideOptions, type TableInput, type TableOptions, } from "@allyhub-next/sheet/api";
|
|
2
2
|
//# sourceMappingURL=sheets.d.ts.map
|
package/dist/sheets.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{Alignment,AreaChart,AutoFilter,BLOCK_CELLS,BarChart,Border,CAPABILITIES,Cell,CellIsRule,ChartBase,Color,ColorScaleRule,ColumnDimension,ConditionalFormattingList,DataBarRule,DataLabelList,DataValidation,DataValidationList,DefinedName,DefinedNameDict,DifferentialStyle,DoughnutChart,Font,FormulaRule,GraphicalProperties,IconSetRule,Legend,LineChart,LineProperties,Marker,NumericAxis,PatternFill,PieChart,Reference,RowDimension,Rule,Scaling,ScatterChart,Series,Side,Table,TableList,TextAxis,Workbook,Worksheet,column_index_from_string,coordinate_to_tuple,get_column_letter,load_workbook,range_boundaries,workbook}from"@allyhub-next/sheet/api";
|
|
2
|
+
export{Alignment,AreaChart,AutoFilter,BLOCK_CELLS,BarChart,Comment,Image,PageMargins,PageSetup,Border,CAPABILITIES,Cell,CellIsRule,ChartBase,Color,ColorScaleRule,ColumnDimension,ConditionalFormattingList,DataBarRule,DataLabelList,DataValidation,DataValidationList,DefinedName,DefinedNameDict,DifferentialStyle,DoughnutChart,Font,FormulaRule,GraphicalProperties,IconSetRule,Legend,LineChart,LineProperties,Marker,NumericAxis,PatternFill,PieChart,Reference,RowDimension,Rule,Scaling,ScatterChart,Series,Side,Table,TableList,TextAxis,Workbook,Worksheet,column_index_from_string,coordinate_to_tuple,get_column_letter,load_workbook,range_boundaries,workbook}from"@allyhub-next/sheet/api";
|
package/docs/defaults.md
CHANGED
|
@@ -168,12 +168,35 @@ A line `add_connector` makes, as python-pptx makes it: the theme's second line,
|
|
|
168
168
|
| `line` | `"accent1"` |
|
|
169
169
|
| `line_width` | `12700` |
|
|
170
170
|
|
|
171
|
+
### `SHADOW_DEFAULTS`
|
|
172
|
+
|
|
173
|
+
A shape's shadow where a `shadow` in `slides.yaml` or `shape.shadow` says nothing: `color`, `blur` and `distance` (EMU), `angle` (degrees clockwise from the right), `transparency` (a share).
|
|
174
|
+
|
|
175
|
+
| Key | Value |
|
|
176
|
+
| --- | --- |
|
|
177
|
+
| `color.rgb` | `"#000000"` |
|
|
178
|
+
| `blur` | `50800` |
|
|
179
|
+
| `distance` | `38100` |
|
|
180
|
+
| `angle` | `45` |
|
|
181
|
+
| `transparency` | `0.6` |
|
|
182
|
+
|
|
171
183
|
### `SLIDE_SECONDS`
|
|
172
184
|
|
|
173
185
|
A slide's window on the stage's clock, seconds: a still of it is drawn at its end, when what moves in its components has settled.
|
|
174
186
|
|
|
175
187
|
Value: `4`
|
|
176
188
|
|
|
189
|
+
## Importing
|
|
190
|
+
|
|
191
|
+
### `ZIP_LIMITS`
|
|
192
|
+
|
|
193
|
+
What a `.pptx` or `.xlsx` given to `allyhub slides import` or `allyhub sheet import` may unzip to, by what the file claims, before anything is inflated: its parts, and its bytes, which `--max-unzipped` sets in MB.
|
|
194
|
+
|
|
195
|
+
| Key | Value |
|
|
196
|
+
| --- | --- |
|
|
197
|
+
| `parts` | `10000` |
|
|
198
|
+
| `bytes` | `1610612736` |
|
|
199
|
+
|
|
177
200
|
## Parts and transitions
|
|
178
201
|
|
|
179
202
|
### `PART_DEFAULTS`
|
package/docs/sheets.md
CHANGED
|
@@ -102,6 +102,31 @@ validations:
|
|
|
102
102
|
|
|
103
103
|
They are text, so a formula counts one with a wildcard, `=COUNTIF(D:D,"*vip*")`, or splits them, `=TEXTSPLIT(D2,", ")`. A person ticks them in the cell's dropdown and sees them as chips; a filter's list offers each, and keeps a row that holds any it ticks. In an `.xlsx` the cell keeps its text and the column a list, whose refusal is turned off as Excel's list takes one value: the render says so.
|
|
104
104
|
|
|
105
|
+
### For the file
|
|
106
|
+
|
|
107
|
+
A worksheet holds what Excel prints and shows around its cells. Each goes in the `.xlsx`; the grid and a PDF do not draw them yet.
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
sheets:
|
|
111
|
+
- name: Quote
|
|
112
|
+
print:
|
|
113
|
+
area: A1:G22
|
|
114
|
+
title_rows: "1:2" # and title_cols: A:B, repeated on every page
|
|
115
|
+
orientation: landscape
|
|
116
|
+
paper: a4 # letter, legal, a3, a4, a5
|
|
117
|
+
fit: { width: 1, height: 0 } # one page wide, as tall as it takes
|
|
118
|
+
margins: { left: 0.5, right: 0.5 } # inches
|
|
119
|
+
footer: { right: "Page &P of &N" } # Excel's codes; left, center, right
|
|
120
|
+
links: { B2: "https://example.com", B3: "#Terms!A1" }
|
|
121
|
+
notes: { C4: Agreed with Sam, C5: { text: Check, author: Finance } }
|
|
122
|
+
pictures:
|
|
123
|
+
- { file: files/logo.png, at: B1, x: 4, y: 4, height: 40 } # over the cells; pixels
|
|
124
|
+
rows: { 12: { level: 1 } } # grouped, 1 to 7; columns too
|
|
125
|
+
protect: true # Protect Sheet, with no password
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
In a script: `ws.page_setup.orientation`, `.paperSize`, `.fitToWidth`, `.fitToHeight`, `ws.page_margins.left`, `ws.print_area`, `ws.print_title_rows`, `ws.print_title_cols`, `ws.oddFooter.right.text`, `cell.hyperlink`, `cell.comment = new Comment("Check", "Finance")`, `ws.add_image(new Image("files/logo.png"), "B1")`, `ws.row_dimensions[12].outlineLevel`, `ws.protection.sheet`.
|
|
129
|
+
|
|
105
130
|
### Files in a cell
|
|
106
131
|
|
|
107
132
|
A column with `files` holds files, each named by its path from the sheet's folder:
|
package/docs/slides.md
CHANGED
|
@@ -125,7 +125,7 @@ python-pptx opens these from a template; here code makes them.
|
|
|
125
125
|
| `slides[].hidden` | `true`: left out when presenting and exporting; a block's: a list of its slides' ids |
|
|
126
126
|
| `slides[].shapes` | Its shapes by name: what it changes of its layout's placeholders, and its own |
|
|
127
127
|
|
|
128
|
-
A shape there changes a placeholder of the slide's layout (or a generated shape) with `frame` (`{ x, y, w, h }` in points), `text` (`size` in points, `bold`, `color`, `font`, a family, `align`: `l`, `ctr`, `r`, `just`, on all of its text), `fill`, `line` (its outline: a colour, or `none`), `line_width` in points, `line_dash` (`solid`, `sysDash`, `sysDot`, `dash`, `dashDot`, `lgDash`, `lgDashDot`, `lgDashDotDot`), `line_begin` and `line_end` (`none`, `triangle`, `arrow`, `stealth`, `diamond`, `oval`), `z`; or is the slide's own with one of `textbox: true` (its words are the script's; it wraps and grows to its text), `picture`, `movie` (a file, or a video item's folder), `geometry` (`rect`, `roundRect`, `ellipse`, `triangle`, `rightArrow`, `line`), `path` (a freeform: `{ w, h, d }`, its outline in a box of `w` × `h` units stretched to its frame, `d` in SVG's `M`, `L`, `C` and `Z`, absolute, so a logo or a cursor is a real shape), `table` (`columns`, widths in points, and `rows`, each a `height` with its `fill`, `text` and `line`, a rule at its foot; stretched to its frame, its words the script's, a list of rows, each a list of cells) or `component` (with `props`), and a `frame`. `group`, a name a slide's own shapes share, makes them one group in PowerPoint. A table here has no style of its own, unlike python-pptx's: its look is what its rows and cells say. A picture or a movie put in a picture, media or object placeholder fills it. Colours are the theme's (`accent1`…) or `#RRGGBB`. `z` orders a shape among the slide's shapes and placeholders, so a negative `z` puts one under a placeholder's words. Paths are from the deck's folder.
|
|
128
|
+
A shape there changes a placeholder of the slide's layout (or a generated shape) with `frame` (`{ x, y, w, h }` in points), `text` (`size` in points, `bold`, `color`, `font`, a family, `align`: `l`, `ctr`, `r`, `just`, `numbered`, its paragraphs counted in place of a bullet: `arabicPeriod`, `arabicParenR`, `alphaLcPeriod`, `alphaUcPeriod`, `romanLcPeriod`, `romanUcPeriod`, on all of its text), `fill`, `fill_transparency` (a share that shows through), `gradient` (`angle`, degrees clockwise from left to right, and `stops`, each `at`, a share of the way, `color` and `transparency`), `shadow` (`blur` and `distance` in points, `angle`, `color`, `transparency`), `line` (its outline: a colour, or `none`), `line_width` in points, `line_dash` (`solid`, `sysDash`, `sysDot`, `dash`, `dashDot`, `lgDash`, `lgDashDot`, `lgDashDotDot`), `line_begin` and `line_end` (`none`, `triangle`, `arrow`, `stealth`, `diamond`, `oval`), `z`; or is the slide's own with one of `textbox: true` (its words are the script's; it wraps and grows to its text), `picture`, `movie` (a file, or a video item's folder), `geometry` (`rect`, `roundRect`, `ellipse`, `triangle`, `diamond`, `parallelogram`, `trapezoid`, `pentagon`, `hexagon`, `octagon`, `plus`, `star4`, `star5`, `chevron`, `homePlate`, `rightArrow`, `leftArrow`, `upArrow`, `downArrow`, `leftRightArrow`, `wedgeRectCallout`, `line`), `path` (a freeform: `{ w, h, d }`, its outline in a box of `w` × `h` units stretched to its frame, `d` in SVG's `M`, `L`, `C` and `Z`, absolute, so a logo or a cursor is a real shape), `table` (`columns`, widths in points, and `rows`, each a `height` with its `fill`, `text` and `line`, a rule at its foot; stretched to its frame, its words the script's, a list of rows, each a list of cells) or `component` (with `props`), and a `frame`. `group`, a name a slide's own shapes share, makes them one group in PowerPoint. A table here has no style of its own, unlike python-pptx's: its look is what its rows and cells say. A picture or a movie put in a picture, media or object placeholder fills it. Colours are the theme's (`accent1`…) or `#RRGGBB`. `z` orders a shape among the slide's shapes and placeholders, so a negative `z` puts one under a placeholder's words. Paths are from the deck's folder.
|
|
129
129
|
|
|
130
130
|
A slide's `animations` are PowerPoint's Animation Pane, in order, each on one of the slide's own shapes (`shape`, by name; in a block, `<slide>/<shape>`), or one `paragraph` of its text, from 0:
|
|
131
131
|
|
|
@@ -144,7 +144,7 @@ A video on a slide plays from when its shape comes on, to its end, when presenti
|
|
|
144
144
|
|
|
145
145
|
A slide's `transition` is how it comes on from the slide before: `type` (`fade`, `push`, `wipe`, or `morph`), `direction` for a push or a wipe (`from-right` unless said), `duration` in seconds (0.7 for a fade, 1 for a push or a wipe, 2 for a morph). What is on the slide starts when it is over, and presenting plays it. A morph moves each shape the two slides share by name from the one's place and size to the other's, as PowerPoint's Morph; what only one has fades. So name a shape the same on both slides to carry it across. A PowerPoint file has them as its own, with a fade for a PowerPoint too old for Morph. A generated slide sets `slide.transition`.
|
|
146
146
|
|
|
147
|
-
A shape's `chart` is PowerPoint's own chart, with its numbers in a workbook a person opens with Edit Data. `type` is python-pptx's, in lower case: `column-clustered`, `column-stacked`, `column-stacked-100`, the same three of `bar`, `line`, `line-markers`, `area`, `area-stacked`, `area-stacked-100`, `pie`, `doughnut
|
|
147
|
+
A shape's `chart` is PowerPoint's own chart, with its numbers in a workbook a person opens with Edit Data. `type` is python-pptx's, in lower case: `column-clustered`, `column-stacked`, `column-stacked-100`, the same three of `bar`, `line`, `line-markers`, `area`, `area-stacked`, `area-stacked-100`, `pie`, `doughnut`, and XY's `scatter`, `scatter-lines` and `scatter-smooth`, each series with an `x` beside its `values`, or with `data`, `categories` naming the column across. There is no 3D, bubble, radar or second axis. Its numbers are written in it, or read from a project file, so a slide shows what the sheet says:
|
|
148
148
|
|
|
149
149
|
```yaml
|
|
150
150
|
revenue:
|
|
@@ -171,13 +171,13 @@ Without `data`, `categories` is a list of names and each series has its `values`
|
|
|
171
171
|
| `size`, `title_size`, `color` | 12, 14.4, `dk1` | Its text's points, its title's, and their colour |
|
|
172
172
|
| a series' `color`, `format`, `smooth`, `line_width`, `marker_size` | the accents in turn, `General`, off, 2.25, 5 | |
|
|
173
173
|
|
|
174
|
-
In code, `shapes.add_chart(XL_CHART_TYPE.X, left, top, width, height, chart_data)` makes one from a `CategoryChartData`, as python-pptx's does, with its `.chart`. A scale left automatic is PowerPoint's in the file and drawn here by the same rules, so a number a person changes moves it; set `min`, `max` and `major` to fix it. Where the plot sits is written in the file, so every app puts it where the stage does. `allyhub inspect --kind chart-data` lists each chart's numbers and the file they came from.
|
|
174
|
+
In code, `shapes.add_chart(XL_CHART_TYPE.X, left, top, width, height, chart_data)` makes one from a `CategoryChartData`, or an `XyChartData` (`add_series(name)`, `add_data_point(x, y)`), as python-pptx's does, with its `.chart`. A scale left automatic is PowerPoint's in the file and drawn here by the same rules, so a number a person changes moves it; set `min`, `max` and `major` to fix it. Where the plot sits is written in the file, so every app puts it where the stage does. `allyhub inspect --kind chart-data` lists each chart's numbers and the file they came from.
|
|
175
175
|
|
|
176
176
|
What `slides.yaml` names that the deck does not have (a layout, a generator, a component or its prop, a shape to change or animate, a file) is AK-M011, at its line.
|
|
177
177
|
|
|
178
178
|
## The script
|
|
179
179
|
|
|
180
|
-
A deck's script has a row per slide under `slides`: its `text` by shape name (a placeholder's or a text box's; a list is paragraphs, a list in it a level deeper; `**bold**`, `*italic*`, `` `code` ``, in the theme's `code` font, `<span color="accent1" font="Inter Tight">words</span>`, in a theme colour or `#RRGGBB`, a font of their own, or both, are runs, as in a doc) and its `notes`. A key is `<prefix>.<slide>.<shape>` (the prefix is the deck's id with `/` as `.`), `<prefix>.<slide>.notes`. A placeholder with no words in the script is empty, and an empty placeholder is not drawn.
|
|
180
|
+
A deck's script has a row per slide under `slides`: its `text` by shape name (a placeholder's or a text box's; a list is paragraphs, a list in it a level deeper; `**bold**`, `*italic*`, `` `code` ``, in the theme's `code` font, `<span color="accent1" font="Inter Tight">words</span>`, in a theme colour or `#RRGGBB`, a font of their own, or both, are runs, as in a doc; a span also takes `link="https://…"`, `strike="true"`, `highlight="#FFFF00"` and `baseline="0.3"`, raised or, below 0, lowered, a share of the size. A slide number placeholder writes its own text, a number PowerPoint keeps up to date) and its `notes`. A key is `<prefix>.<slide>.<shape>` (the prefix is the deck's id with `/` as `.`), `<prefix>.<slide>.notes`. A placeholder with no words in the script is empty, and an empty placeholder is not drawn.
|
|
181
181
|
|
|
182
182
|
## What a person changes in the editor
|
|
183
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "What an agent writes videos, decks and workbooks with: video() and slides(), parts with their speech, footage and sounds, defineComponent() and custom() layers, the layout, motion and input helpers, the scenery() layer's options, and openpyxl's API for a sheet. Nothing a host needs.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://allyhub.com",
|