allyhub 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/commands/render.js +1 -1
- package/dist/commands/sheet.js +7 -7
- package/dist/commands/slides.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
- package/dist/node_modules/@allyhub-next/browser/package.json +1 -1
- package/dist/node_modules/@allyhub-next/build/package.json +1 -1
- package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
- package/dist/node_modules/@allyhub-next/check/package.json +1 -1
- package/dist/node_modules/@allyhub-next/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub-next/components/package.json +1 -1
- package/dist/node_modules/@allyhub-next/dev-server/dist/exports.js +1 -1
- package/dist/node_modules/@allyhub-next/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub-next/doc/package.json +1 -1
- package/dist/node_modules/@allyhub-next/export/dist/export.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/export/dist/export.js +4 -4
- package/dist/node_modules/@allyhub-next/export/dist/names.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/export/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/measure/package.json +1 -1
- package/dist/node_modules/@allyhub-next/media/package.json +1 -1
- package/dist/node_modules/@allyhub-next/model/package.json +1 -1
- package/dist/node_modules/@allyhub-next/project/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/registry/package.json +1 -1
- package/dist/node_modules/@allyhub-next/render/dist/exports.d.ts +2 -11
- package/dist/node_modules/@allyhub-next/render/dist/exports.js +2 -2
- package/dist/node_modules/@allyhub-next/render/dist/page.d.ts +1 -9
- package/dist/node_modules/@allyhub-next/render/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub-next/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub-next/scenery-host/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/site/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/slides-pptx/dist/charts.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.d.ts +6 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.d.ts +11 -0
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.d.ts +10 -4
- package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub-next/stage/dist/graphics.js +1 -1
- package/dist/node_modules/@allyhub-next/stage/package.json +1 -1
- package/dist/node_modules/@allyhub-next/stage-page/dist/page.js +19 -19
- package/dist/node_modules/@allyhub-next/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/editor-web/assets/dist-BW2s9FMO.js +4 -0
- package/editor-web/assets/{dist-CuW84oPe.js → dist-C-6JmebI.js} +22 -22
- package/editor-web/assets/dist-CCYMLMKN.js +6 -0
- package/editor-web/assets/dist-CHzurjMx.js +33 -0
- package/editor-web/assets/{dist-Yi3sy7Ea.js → dist-DF7H1dxw.js} +1 -1
- package/editor-web/assets/dist-Da5AUSKX.js +2 -0
- package/editor-web/assets/index-CovQYWvD.js +69 -0
- package/editor-web/assets/minus-BrvjaJyO.js +1 -0
- package/editor-web/assets/react-DV5fPdiH.js +101 -0
- package/editor-web/assets/{textarea-CvxipnGW.js → textarea-B0vCGdZI.js} +2 -2
- package/editor-web/assets/{trash-2-Bq1Dt8XG.js → trash-2-B0dvc1cZ.js} +1 -1
- package/editor-web/assets/{undo-2-Djhvu4xt.js → undo-2-A1EPubPO.js} +1 -1
- package/editor-web/index.html +2 -2
- package/package.json +2 -2
- package/editor-web/assets/dist-Cg2PdedY.js +0 -6
- package/editor-web/assets/dist-CxAS_vp7.js +0 -2
- package/editor-web/assets/dist-DCVaj9i1.js +0 -4
- package/editor-web/assets/dist-DGVUuVPB.js +0 -33
- package/editor-web/assets/index-pwRfZ2Jv.js +0 -69
- package/editor-web/assets/minus-BizJdinJ.js +0 -1
- package/editor-web/assets/react-D54s6gwK.js +0 -101
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{MSO_CONNECTOR as k,MSO_SHAPE as $,MSO_SHAPE_TYPE as F,PP_PLACEHOLDER as
|
|
2
|
+
import{MSO_CONNECTOR as k,MSO_SHAPE as $,MSO_SHAPE_TYPE as F,PP_PLACEHOLDER as T}from"./enums.js";import{Chart as L}from"./chart-api.js";import{AUTOSHAPE_STYLE as c,SHADOW_DEFAULTS as O,CONNECTOR_STYLE as M,FOOTER_IDX as N,OFFICE_TEXT_STYLES as z,TEXT_INSETS as _,TEXTBOX_FRAME as C}from"./office.js";import{masterPlaceholder as v}from"./placeholders.js";import{strict as o}from"./strict.js";import{EMU_PER_PT as j,SLIDE_SIZES as S}from"./units.js";class D extends Error{constructor(t){super(`${t} (allyhub slides capabilities lists what the API holds).`),this.name="Unsupported"}}const g=i=>{throw new D(i)},G=/^#?[0-9a-f]{6}$/iu,A=i=>{if(!G.test(i))throw new Error(`rgb ${i} is not RRGGBB.`);return`#${i.replace("#","").toUpperCase()}`};export const RGBColor=Object.assign((i,t,e)=>{for(const s of[i,t,e])if(!Number.isInteger(s)||s<0||s>255)throw new Error(`RGBColor(${String(i)}, ${String(t)}, ${String(e)}): each is 0 to 255.`);return`#${[i,t,e].map(s=>s.toString(16).padStart(2,"0")).join("").toUpperCase()}`},{from_string:i=>A(i)});export class ColorFormat{read;write;constructor(t,e){return this.read=t,this.write=e,o(this,"ColorFormat")}get theme_color(){const t=this.read();return typeof t=="string"?t:void 0}set theme_color(t){this.write(t)}get rgb(){const t=this.read();return typeof t=="object"?t.rgb:void 0}set rgb(t){this.write(t===void 0?void 0:{rgb:A(t)})}}export class Font{def;constructor(t){return this.def=t,o(this,"Font")}_set(t,e){e===void 0?Reflect.deleteProperty(this.def,t):this.def[t]=e}get strike(){return this.def.strike}set strike(t){this._set("strike",t)}get baseline(){return this.def.baseline}set baseline(t){this._set("baseline",t)}get highlight(){return this.def.highlight}set highlight(t){this._set("highlight",t)}get name(){return this.def.name}set name(t){this._set("name",t)}get size(){return this.def.size}set size(t){this._set("size",t)}get bold(){return this.def.bold}set bold(t){this._set("bold",t)}get italic(){return this.def.italic}set italic(t){this._set("italic",t)}get underline(){return this.def.underline}set underline(t){this._set("underline",t)}get spacing(){return this.def.spacing}set spacing(t){this._set("spacing",t)}get color(){return new ColorFormat(()=>this.def.rgb!==void 0?{rgb:this.def.rgb}:this.def.color,t=>{delete this.def.color,delete this.def.rgb,typeof t=="string"?this.def.color=t:t&&(this.def.rgb=t.rgb)})}}export class Hyperlink{def;constructor(t){return this.def=t,o(this,"_Hyperlink")}get address(){return this.def.font?.link}set address(t){this.def.font??={},t===void 0?Reflect.deleteProperty(this.def.font,"link"):this.def.font.link=t}}export class Run{def;constructor(t){return this.def=t,o(this,"_Run")}get text(){return this.def.text}set text(t){this.def.text=t}get font(){return this.def.font??={},new Font(this.def.font)}get hyperlink(){return new Hyperlink(this.def)}}const I=i=>{if(!Number.isFinite(i)||i<=0)throw new Error(`line_spacing ${String(i)} is not over 0.`);return Number.isInteger(i)&&i>=j?{fixed:i}:{lines:i}},B=i=>i===void 0?void 0:"lines"in i?i.lines:i.fixed,P=i=>i.split(/\n|\v/u).flatMap((t,e)=>[...e>0?[{text:"\v"}]:[],...t===""?[]:[{text:t}]]);class R{_set(t,e){e===void 0?Reflect.deleteProperty(this.fmt,t):this.fmt[t]=e}get alignment(){return this.fmt.alignment}set alignment(t){this._set("alignment",t)}get line_spacing(){return B(this.fmt.line_spacing)}set line_spacing(t){this._set("line_spacing",t===void 0?void 0:I(t))}get space_before(){return this.fmt.space_before}set space_before(t){this._set("space_before",t)}get space_after(){return this.fmt.space_after}set space_after(t){this._set("space_after",t)}get font(){return this.fmt.font??={},new Font(this.fmt.font)}}export class Paragraph extends R{fmt;constructor(t){return super(),this.fmt=t,o(this,"_Paragraph")}get text(){return this.fmt.runs.map(t=>t.text).join("")}set text(t){this.fmt.runs=P(t)}get runs(){return this.fmt.runs.filter(t=>t.text!=="\v").map(t=>new Run(t))}add_run(){const t={text:""};return this.fmt.runs.push(t),new Run(t)}add_line_break(){this.fmt.runs.push({text:"\v"})}clear(){return this.fmt.runs=[],this}get level(){return this.fmt.level}set level(t){if(!Number.isInteger(t)||t<0||t>8)throw new Error(`level ${String(t)} is not 0 to 8.`);this.fmt.level=t}}export class ListLevel extends R{fmt;constructor(t){return super(),this.fmt=t,o(this,"ListLevel")}get numbered(){return this.fmt.numbered}set numbered(t){this._set("numbered",t)}get bullet(){return this.fmt.bullet}set bullet(t){this._set("bullet",t)}get bullet_font(){return this.fmt.bullet_font}set bullet_font(t){this._set("bullet_font",t)}get margin_left(){return this.fmt.margin_left}set margin_left(t){this._set("margin_left",t)}get indent(){return this.fmt.indent}set indent(t){this._set("indent",t)}}const y=i=>Object.freeze(i.map(t=>new ListLevel(t))),U=()=>Array.from({length:9},()=>({})),x=()=>({paragraphs:[],levels:U()});export class TextFrame{def;constructor(t){return this.def=t,o(this,"TextFrame")}_set(t,e){e===void 0?Reflect.deleteProperty(this.def,t):this.def[t]=e}get text(){return this.def.paragraphs.map(t=>t.runs.map(e=>e.text).join("")).join(`
|
|
3
3
|
`)}set text(t){this.def.paragraphs=t.split(`
|
|
4
|
-
`).map(e=>({runs:A(e),level:0}))}get paragraphs(){return this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0}),this.def.paragraphs.map(t=>new Paragraph(t))}add_paragraph(){this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0});const t={runs:[],level:0};return this.def.paragraphs.push(t),new Paragraph(t)}clear(){const t=this.def.paragraphs[0];this.def.paragraphs=t?[{...t,runs:[]}]:[]}fit_text(t,e=18,s,r){this.def.auto_size="text",this.def.word_wrap=!0;for(const n of this.def.paragraphs)for(const h of n.runs)h.font={...h.font,size:Math.trunc(e*v),...t===void 0?{}:{name:t},...s===void 0?{}:{bold:s},...r===void 0?{}:{italic:r}}}get list_style(){return y(this.def.levels)}get vertical_anchor(){return this.def.vertical_anchor}set vertical_anchor(t){this._set("vertical_anchor",t)}get auto_size(){return this.def.auto_size}set auto_size(t){this._set("auto_size",t)}get word_wrap(){return this.def.word_wrap}set word_wrap(t){this._set("word_wrap",t)}get margin_left(){return this.def.margin_left??_.left}set margin_left(t){this.def.margin_left=t}get margin_top(){return this.def.margin_top??_.top}set margin_top(t){this.def.margin_top=t}get margin_right(){return this.def.margin_right??_.right}set margin_right(t){this.def.margin_right=t}get margin_bottom(){return this.def.margin_bottom??_.bottom}set margin_bottom(t){this.def.margin_bottom=t}}export class FillFormat{read;write;start;constructor(t,e,s="lt1"){return this.read=t,this.write=e,this.start=s,a(this,"FillFormat")}solid(){const t=this.read();t==null&&this.write(this.start)}background(){this.write(null)}get type(){const t=this.read();return t===void 0?void 0:t===null?"background":"solid"}get fore_color(){const t=this.read();if(t==null)throw new TypeError("This fill is not solid, so it has no fore_color: call fill.solid() first.");return new ColorFormat(()=>this.read()??void 0,e=>{this.write(e??this.start)})}}export class LineFormat{def;constructor(t){return this.def=t,a(this,"LineFormat")}get color(){return new ColorFormat(()=>this.def.line??void 0,t=>{this.def.line=t??null})}get fill(){return new FillFormat(()=>this.def.line,t=>{this.def.line=t},"dk1")}get width(){return this.def.line_width??0}set width(t){this.def.line_width=t}get dash_style(){return this.def.line_dash??null}set dash_style(t){t===null?delete this.def.line_dash:this.def.line_dash=t}get begin_arrow(){return this.def.line_begin??"none"}set begin_arrow(t){this.def.line_begin=t}get end_arrow(){return this.def.line_end??"none"}set end_arrow(t){this.def.line_end=t}}export class Background{holder;constructor(t){return this.holder=t,a(this,"_Background")}get fill(){return new FillFormat(()=>this.holder.background,t=>{this.holder.background=t??"lt1"})}}export const ADJUSTMENT_DEFAULTS={roundRect:[.16667]};export class Adjustments{def;constructor(t){return this.def=t,a(this,"Adjustments",{index:e=>this._values()[e],setIndex:(e,s)=>{this._set(e,Number(s))}})}_values(){return this.def.adjustments??[...ADJUSTMENT_DEFAULTS[this.def.geometry??"rect"]??[]]}get length(){return this._values().length}_set(t,e){const s=this._values();if(t<0||t>=s.length)throw new RangeError(`adjustments[${String(t)}]: ${this.def.geometry??"this shape"} has ${String(s.length)}.`);if(!Number.isFinite(e))throw new Error(`adjustments[${String(t)}] = ${String(e)} is not a number.`);s[t]=e,this.def.adjustments=s}}const U={left:0,top:0,width:0,height:0};export class Shape{def;inherit;constructor(t,e=()=>{}){return this.def=t,this.inherit=e,a(this,"Shape")}get _def(){return this.def}_frame(){return this.def.frame??this.inherit()??U}_own(){return this.def.frame??={...this._frame()},this.def.frame}get name(){return this.def.name}set name(t){this.def.name=t}get shape_type(){return this.def.path?"freeform":this.def.geometry==="line"?"line":this.def.kind}get is_placeholder(){return this.def.kind==="placeholder"}get has_table(){return this.def.table!==void 0}get has_chart(){return this.def.chart!==void 0}get chart(){if(!this.def.chart)throw new Error(`${this.def.name} is not a chart.`);return new R(this.def.chart)}get table(){if(!this.def.table)throw new Error(`${this.def.name} is not a table.`);return new Table(this.def.table)}get placeholder_format(){if(!this.def.placeholder)throw new Error(`${this.def.name} is not a placeholder.`);return{...this.def.placeholder}}get left(){return this._frame().left}set left(t){this._own().left=t}get top(){return this._frame().top}set top(t){this._own().top=t}get width(){return this._frame().width}set width(t){this._own().width=t}get height(){return this._frame().height}set height(t){this._own().height=t}get rotation(){return this.def.rotation??0}set rotation(t){if(!Number.isFinite(t))throw new Error(`${this.def.name}: rotation is a number of degrees.`);const e=(Math.trunc(t*6e4)%216e5+216e5)%216e5/6e4;e===0?Reflect.deleteProperty(this.def,"rotation"):this.def.rotation=e}get has_text_frame(){return this.def.text!==void 0}get text_frame(){if(!this.def.text)throw new Error(`${this.def.name} (a ${this.shape_type}) has no text frame: has_text_frame is false.`);return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t})}get line(){return new LineFormat(this.def)}get adjustments(){return new Adjustments(this.def)}}const H=i=>typeof i=="number"&&Number.isFinite(i),p=(i,t,e,s,{line:r=!1}={})=>{for(const[n,h]of Object.entries({left:i,top:t,width:e,height:s}))if(!H(h))throw new Error(`${n} ${String(h)} is not a length (Emu, Inches, Pt, Cm, Mm).`);if(r?e<0||s<0:e<=0||s<=0)throw new Error("A shape's width and height are over 0.");return{left:Math.trunc(i),top:Math.trunc(t),width:Math.trunc(e),height:Math.trunc(s)}},X=new Set(Object.values($));export class FreeformBuilder{steps;sx;sy;make;constructor(t,e,s){return this.steps=[{op:"move",x:t[0],y:t[1]}],[this.sx,this.sy]=typeof e=="number"?[e,e]:e,this.make=s,a(this,"FreeformBuilder")}add_line_segments(t,e=!0){for(const[s,r]of t)this.steps.push({op:"line",x:s,y:r});return e&&this.steps.push({op:"close"}),this}add_curve_segment(t,e,s,r,n,h){return this.steps.push({op:"curve",x1:t,y1:e,x2:s,y2:r,x:n,y:h}),this}move_to(t,e){return this.steps.push({op:"move",x:t,y:e}),this}convert_to_shape(t=0,e=0){this.steps.length<2&&m("convert_to_shape(): a freeform needs a segment.");const s=this.steps.flatMap(o=>o.op==="close"?[]:o.op==="curve"?[[o.x1,o.y1],[o.x2,o.y2],[o.x,o.y]]:[[o.x,o.y]]),r=s.map(o=>o[0]),n=s.map(o=>o[1]),h=Math.min(...r),d=Math.min(...n),l=Math.max(...r)-h,f=Math.max(...n)-d,u=(o,g)=>({x:o-h,y:g-d});return this.make({w:l,h:f,steps:this.steps.map(o=>{if(o.op==="close")return o;if(o.op!=="curve")return{op:o.op,...u(o.x,o.y)};const g=u(o.x1,o.y1),b=u(o.x2,o.y2);return{op:"curve",x1:g.x,y1:g.y,x2:b.x,y2:b.y,...u(o.x,o.y)}})},p(Math.round(h*this.sx)+t,Math.round(d*this.sy)+e,Math.round(l*this.sx),Math.round(f*this.sy)))}}export class GroupShape{list;_name;make;constructor(t,e,s){return this.list=t,this._name=e,this.make=s,a(this,"GroupShape")}members(){return this.list.filter(t=>t.group===this._name)}box(){const t=this.members().flatMap(r=>r.frame?[r.frame]:[]),e=Math.min(...t.map(r=>r.left)),s=Math.min(...t.map(r=>r.top));return{left:t.length>0?e:0,top:t.length>0?s:0,right:Math.max(0,...t.map(r=>r.left+r.width)),bottom:Math.max(0,...t.map(r=>r.top+r.height))}}get shapes(){return this.make(this._name)}get shape_type(){return F.GROUP}get name(){return this._name}set name(t){for(const e of this.members())e.group=t;this._name=t}get left(){return this.box().left}set left(t){const e=t-this.box().left;for(const s of this.members())s.frame&&(s.frame.left+=e)}get top(){return this.box().top}set top(t){const e=t-this.box().top;for(const s of this.members())s.frame&&(s.frame.top+=e)}get width(){const t=this.box();return t.right-t.left}get height(){const t=this.box();return t.bottom-t.top}}export class Cell{def;table;row;col;constructor(t,e,s,r){return this.def=t,this.table=e,this.row=s,this.col=r,a(this,"_Cell")}get text_frame(){return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t})}get borders(){return this.def.borders??{}}set borders(t){this.def.borders=t}get margin_left(){return this.def.text.margin_left??_.left}set margin_left(t){this.def.text.margin_left=t}get margin_right(){return this.def.text.margin_right??_.right}set margin_right(t){this.def.text.margin_right=t}get margin_top(){return this.def.text.margin_top??_.top}set margin_top(t){this.def.text.margin_top=t}get margin_bottom(){return this.def.text.margin_bottom??_.bottom}set margin_bottom(t){this.def.text.margin_bottom=t}get vertical_anchor(){return this.def.text.vertical_anchor}set vertical_anchor(t){t===void 0?delete this.def.text.vertical_anchor:this.def.text.vertical_anchor=t}get is_merge_origin(){return(this.def.span_width??1)>1||(this.def.span_height??1)>1}get is_spanned(){return this.def.spanned===!0}get span_width(){return this.def.span_width??1}get span_height(){return this.def.span_height??1}merge(t){const e=[this.row,t.row].sort((l,f)=>l-f),s=[this.col,t.col].sort((l,f)=>l-f),[r=0,n=0]=e,[h=0,d=0]=s;for(let l=r;l<=n;l++)for(let f=h;f<=d;f++){const u=this.table.rows[l]?.cells[f];u&&(l===r&&f===h?(d>h&&(u.span_width=d-h+1),n>r&&(u.span_height=n-r+1)):u.spanned=!0)}}split(){const t=this.span_width,e=this.span_height;delete this.def.span_width,delete this.def.span_height;for(let s=this.row;s<this.row+e;s++)for(let r=this.col;r<this.col+t;r++){const n=this.table.rows[s]?.cells[r];n&&delete n.spanned}}}export class Column{def;at;constructor(t,e){return this.def=t,this.at=e,a(this,"_Column")}get width(){return this.def.columns[this.at]??0}set width(t){this.def.columns[this.at]=t}}export class Row{def;at;constructor(t,e){return this.def=t,this.at=e,a(this,"_Row")}get row(){const t=this.def.rows[this.at];if(!t)throw new Error(`The table has no row ${String(this.at)}.`);return t}get height(){return this.row.height}set height(t){this.row.height=t}}export class Table{def;constructor(t){return this.def=t,a(this,"Table")}cell(t,e){const s=this.def.rows[t]?.cells[e];if(!s)throw new Error(`cell(): the table has ${String(this.def.rows.length)} rows and ${String(this.def.columns.length)} columns.`);return new Cell(s,this.def,t,e)}*iter_cells(){for(let t=0;t<this.def.rows.length;t++)for(let e=0;e<this.def.columns.length;e++)yield this.cell(t,e)}get columns(){return this.def.columns.map((t,e)=>new Column(this.def,e))}get rows(){return this.def.rows.map((t,e)=>new Row(this.def,e))}flag(t){return this.def[t]===!0}get first_row(){return this.flag("first_row")}set first_row(t){this.def.first_row=t}get first_col(){return this.flag("first_col")}set first_col(t){this.def.first_col=t}get last_row(){return this.flag("last_row")}set last_row(t){this.def.last_row=t}get last_col(){return this.flag("last_col")}set last_col(t){this.def.last_col=t}get horz_banding(){return this.flag("horz_banding")}set horz_banding(t){this.def.horz_banding=t}get vert_banding(){return this.flag("vert_banding")}set vert_banding(t){this.def.vert_banding=t}}function J(i,t,e=[]){const s=new Set([...i,...e].map(n=>n.name));let r=1;for(;s.has(`${t}-${String(r)}`);)r++;return`${t}-${String(r)}`}export class ShapeCollection{list;base;components;inherit;group;under;constructor(t,e,s,r=()=>{},n=()=>[],h){return this.list=t,this.base=e,this.components=s,this.inherit=r,this.under=n,this.group=h,a(this,"SlideShapes",{index:d=>this._at(d)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}_at(t){const e=this.list[t];return e?this._wrap(e):void 0}*[Symbol.iterator](){for(const t of this.list)yield this._wrap(t)}get length(){return this.list.length}get(t){const e=this.list.find(s=>s.name===t);return e?this._wrap(e):void 0}get title(){const t=this.list.find(e=>e.placeholder?.type==="title"||e.placeholder?.type==="ctrTitle");return t?this._wrap(t):void 0}get placeholders(){return new Placeholders(this.list,this.inherit)}_add(t,e){const s={name:J(this.list,t,this.under()),...e,...this.group===void 0?{}:{group:this.group}};return this.list.push(s),this._wrap(s)}add_textbox(t,e,s,r){return this._add("textbox",{kind:"textbox",frame:p(t,e,s,r),text:{...x(),...z}})}add_picture(t,e,s,r,n){return(r===void 0||n===void 0)&&m("add_picture() takes a width and a height here: a picture's own size is not read while a deck's code runs"),this._add("picture",{kind:"picture",frame:p(e,s,r??0,n??0),media:{path:t,base:this.base}})}add_movie(t,e,s,r,n,h={}){return this._add("movie",{kind:"movie",frame:p(e,s,r,n),media:{path:t,base:this.base,...h.poster_frame_time===void 0?{}:{poster:h.poster_frame_time}}})}add_shape(t,e,s,r,n){X.has(t)||m(`add_shape(): ${t} is not one of MSO_SHAPE's ${Object.keys($).join(", ")}`);const h=x();return h.vertical_anchor=c.vertical_anchor,h.paragraphs=[{runs:[],level:0,alignment:c.alignment}],this._add("shape",{kind:"autoshape",frame:p(e,s,r,n),geometry:t,fill:c.fill,line:c.line,line_width:c.line_width,text:h})}add_table(t,e,s,r,n,h){(t<1||e<1)&&m("add_table(): a table has at least a row and a column.");const d=Math.floor(n/e),l=Math.floor(h/t);return this._add("table",{kind:"table",frame:p(s,r,n,h),table:{columns:Array.from({length:e},()=>d),rows:Array.from({length:t},()=>({height:l,cells:Array.from({length:e},()=>({text:x()}))}))}})}add_chart(t,e,s,r,n,h){return this._add("chart",{kind:"chart",frame:p(e,s,r,n),chart:{type:t,categories:[...h.categories],series:h._series()}})}add_group_shape(){this.group!==void 0&&m("add_group_shape(): a group here holds shapes, not another group.");let t=1;for(;this.list.some(e=>e.group===`group-${String(t)}`);)t++;return new GroupShape(this.list,`group-${String(t)}`,e=>new ShapeCollection(this.list,this.base,this.components,this.inherit,this.under,e))}build_freeform(t=0,e=0,s=1){return new FreeformBuilder([t,e],s,(r,n)=>{const h=x();return h.vertical_anchor=c.vertical_anchor,h.paragraphs=[{runs:[],level:0,alignment:c.alignment}],this._add("freeform",{kind:"autoshape",frame:n,path:r,fill:c.fill,line:c.line,line_width:c.line_width,text:h})})}add_connector(t,e,s,r,n){t!==k.STRAIGHT&&m(`add_connector(): ${t} is not one of MSO_CONNECTOR's ${Object.keys(k).join(", ")}`);const h=p(Math.min(e,r),Math.min(s,n),Math.abs(r-e),Math.abs(n-s),{line:!0}),d=r<e,l=n<s;return this._add("connector",{kind:"autoshape",frame:h,geometry:"line",...d||l?{flip:{...d?{h:d}:{},...l?{v:l}:{}}}:{},line:O.line,line_width:O.line_width})}add_component(t,e,s,r,n,h={}){if(!Object.hasOwn(this.components(),t))throw new Error(`add_component(): the presentation has no component ${t}; add it with prs.components.add("${t}", { … }) first.`);return this._add(t,{kind:"component",frame:p(e,s,r,n),component:{name:t,props:h}})}}export const NAME_OF_TYPE={title:"title",ctrTitle:"title",subTitle:"subtitle",body:"body",pic:"picture",media:"media",obj:"content",dt:"date",ftr:"footer",sldNum:"slide-number"};export class Placeholders{list;inherit;constructor(t,e=()=>{}){return this.list=t,this.inherit=e,a(this,"placeholders",{index:s=>this.get(s)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}*[Symbol.iterator](){for(const t of this.list)t.kind==="placeholder"&&(yield this._wrap(t))}get length(){return this.list.filter(t=>t.kind==="placeholder").length}get(t){const e=this.list.find(s=>s.kind==="placeholder"&&(typeof t=="number"?s.placeholder?.idx===t:s.name===t||s.placeholder?.type===t));return e?this._wrap(e):void 0}add(t,e,s,r,n,h={}){const d=typeof e=="object"?e:h,l=typeof e=="object"?void 0:e;Object.values(M).includes(t)||m(`placeholders.add(): ${t} is not one of PP_PLACEHOLDER's ${Object.keys(M).join(", ")}`);const f=this.list.filter(w=>w.kind==="placeholder"),u=new Set(f.map(w=>w.placeholder?.idx));let o=t==="title"||t==="ctrTitle"?0:L[t]??1;for(;u.has(o)&&o!==0;)o++;if(u.has(o))throw new Error("A layout has one title placeholder (idx 0).");const g=d.name??NAME_OF_TYPE[t];if(this.list.some(w=>w.name===g))throw new Error(`Two shapes are ${g}: give the placeholder a name ({ name }).`);const b=[l,s,r,n].filter(w=>w!==void 0);if(b.length!==0&&b.length!==4)throw new Error("placeholders.add(type, left, top, width, height): give all four, or none to take the master's frame.");const E={name:g,kind:"placeholder",placeholder:{type:t,idx:o},...b.length===4?{frame:p(l??0,s??0,r??0,n??0)}:{},text:x()};return this.list.push(E),this._wrap(E)}}export class SlideLayout{def;master;ctx;constructor(t,e,s){return this.def=t,this.master=e,this.ctx=s,a(this,"SlideLayout")}get _def(){return this.def}inherit=t=>t.placeholder?T(this.master._def,t.placeholder.type)?.frame:void 0;get name(){return this.def.name}get slide_master(){return this.master}get display_master_shapes(){return this.def.display_master_shapes??!0}set display_master_shapes(t){t?delete this.def.display_master_shapes:this.def.display_master_shapes=!1}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes,this.inherit)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components,this.inherit,()=>this.master._def.shapes)}}export class SlideLayouts{list;make;constructor(t,e){return this.list=t,this.make=e,a(this,"SlideLayouts",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}get_by_name(t,e){return this.list.find(s=>s.name===t)??e}index(t){const e=this.list.indexOf(t);if(e<0)throw new Error(`${t.name} is not among these layouts.`);return e}add(t,e){if(!this.make)throw new Error("A layout is added to a master: master.slide_layouts.add(name).");const s=this.make(t);return e?.(s),s}}export class TextStyles{def;constructor(t){return this.def=t,a(this,"text_styles")}get title_style(){return y(this.def.title)}get body_style(){return y(this.def.body)}get other_style(){return y(this.def.other)}}export class SlideMaster{def;layouts=[];ctx;allLayouts;constructor(t,e,s){return this.def=t,this.ctx=e,this.allLayouts=s,a(this,"SlideMaster")}get _def(){return this.def}get name(){return this.def.name}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components)}get text_styles(){return new TextStyles(this.def.text_styles)}get slide_layouts(){return new SlideLayouts(this.layouts,t=>{if(this.allLayouts.some(r=>r.name===t))throw new Error(`Two layouts are "${t}": a layout's name is unique in the deck, as slides.yaml names it.`);const e={name:t,master:this.def.name,shapes:[]};this.def.layouts.push(e);const s=new SlideLayout(e,this,this.ctx);return this.layouts.push(s),this.allLayouts.push(s),s})}}export class SlideMasters{list;make;constructor(t,e){return this.list=t,this.make=e,a(this,"SlideMasters",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}index(t){return this.list.indexOf(t)}add(t,e){const s=this.make(t);return e?.(s),s}}export class GeneratedSlide{own;def;layout;constructor(t,e,s){this.def=t,this.layout=e,this.own=e._def.shapes.filter(n=>n.kind==="placeholder").map(n=>({name:n.name,kind:"placeholder",...n.placeholder?{placeholder:{...n.placeholder}}:{},text:x()}));const r=n=>{const h=e._def.shapes.find(d=>d.kind==="placeholder"&&d.placeholder?.idx===n.placeholder?.idx);return h?h.frame??(h.placeholder?T(e.slide_master._def,h.placeholder.type)?.frame:void 0):void 0};return this._shapes=new ShapeCollection(this.own,s.base,s.components,r,()=>[...e.slide_master._def.shapes,...e._def.shapes]),this._placeholders=new Placeholders(this.own,r),a(this,"Slide")}_shapes;_placeholders;get shapes(){return this._shapes}get placeholders(){return this._placeholders}get slide_id(){return this.def.id}get slide_layout(){return this.layout}get has_notes_slide(){return this.def.notes!==void 0}get notes_slide(){const t=this.def;return{notes_text_frame:{get text(){return t.notes??""},set text(e){t.notes=e}}}}get transition(){return this.def.transition}set transition(t){t===void 0?delete this.def.transition:this.def.transition=t}get animations(){return new Animations(this.def.animations??=[])}_done(){const t={},e=[];for(const s of this.own)s.kind==="placeholder"&&s.placeholder?(s.text?.paragraphs.some(r=>r.runs.length>0)&&(t[s.placeholder.idx]=s.text.paragraphs),s.frame&&e.push({...s,text:x()})):e.push(s);return{...this.def,shapes:e,text:t}}}export class Animations{list;constructor(t){return this.list=t,a(this,"Animations")}add(t,e,s={}){this.list.push({shape:typeof t=="string"?t:t.name,effect:e,...s})}get length(){return this.list.length}}class Y{gen;constructor(t){return this.gen=t,a(this,"slides")}add_slide(t,e){return this.gen._add(t,e)}}export class Generator{list=[];prs;ctx;constructor(t,e){return this.prs=t,this.ctx=e,a(this,"Generator")}data(t){return this.ctx.data(t)}get slides(){return new Y(this)}_add(t,e){const s=typeof t=="string"?this.prs._layout(t):t;if(!s)throw new Error(`add_slide(): the presentation has no layout ${typeof t=="string"?t:t.name}.`);if(!/^[A-Za-z0-9_-]+$/u.test(e))throw new Error(`add_slide(): ${e} is not an id of letters, digits, _ and -.`);if(this.list.some(n=>n.slide_id===e))throw new Error(`add_slide(): two slides are ${e}.`);const r=new GeneratedSlide({id:e,layout:s.name,shapes:[],text:{}},s,this.prs._ctx);return this.list.push(r),r}_made(){return this.list.map(t=>t._done())}}const Z=()=>JSON.parse(JSON.stringify(N));export class Presentation{masters=[];layouts=[];def;_ctx;constructor(t,e){return this.def={slide_width:t[0],slide_height:t[1],masters:[],components:{},generators:{}},this._ctx={base:e,components:()=>this.def.components},a(this,"Presentation")}get _def(){return this.def}get slide_width(){return this.def.slide_width}set slide_width(t){this.def.slide_width=t}get slide_height(){return this.def.slide_height}set slide_height(t){this.def.slide_height=t}get slide_masters(){return new SlideMasters(this.masters,t=>{if(this.masters.some(r=>r.name===t))throw new Error(`Two masters are "${t}".`);const e={name:t,background:"lt1",text_styles:Z(),shapes:[],layouts:[]};this.def.masters.push(e);const s=new SlideMaster(e,this._ctx,this.layouts);return this.masters.push(s),s})}get slide_master(){const t=this.masters[0];if(!t)throw new Error("The presentation has no master yet: prs.slide_masters.add(name) makes one.");return t}get slide_layouts(){const t=this.masters[0];return t?t.slide_layouts:new SlideLayouts([])}get slides(){return m("A deck's slides are slides.yaml's, in order, each on a layout, and their words the script's; slides made from data are a generator's (prs.generators.add)")}save(){return m("A deck is not saved by its code: allyhub render writes its PDF, pictures and PPTX")}get theme(){return this.def.theme??={},this.def.theme}set theme(t){this.def.theme=t}get components(){return a({add:(t,e)=>{if(Object.hasOwn(this.def.components,t))throw new Error(`Two components are "${t}".`);if(typeof e.layers!="function")throw new Error(`Component ${t} draws with its layers function.`);this.def.components[t]={name:t,props:e.props??{},layers:e.layers}}},"components")}get generators(){return a({add:(t,e)=>{if(Object.hasOwn(this.def.generators,t))throw new Error(`Two generators are "${t}".`);this.def.generators[t]={name:t,make:s=>{const r=new Generator(this,s);return e(r),r._made()}}}},"generators")}_layout(t){return this.layouts.find(e=>e.name===t)}}export const DECK_BRAND="__allyhubDeck";export function isDeck(i){return typeof i=="object"&&i!==null&&DECK_BRAND in i}export const presentationFor=i=>(t,e)=>{const[s,r]=typeof t=="function"?[{},t]:[t,e];if(typeof r!="function")throw new Error("An item's slides.ts exports one deck: export default presentation({ size }, (prs) => { … masters, layouts, components … }); its slides are slides.yaml.");if(typeof s.size=="string"&&!Object.hasOwn(S,s.size))throw new Error(`presentation(): size ${s.size} is not one of ${Object.keys(S).join(", ")}, or { width, height } in EMU.`);return{[DECK_BRAND]:!0,kind:"slides",options:s,build:r,written:{file:i}}};export function evaluateDeck(i){const t=i.options.size??"16:9",e=typeof t=="string"?S[t]:[t.width,t.height],s=i.written.file.split("/").slice(0,-1).join("/"),r=new Presentation(e,s);return i.options.theme&&(r.theme=JSON.parse(JSON.stringify(i.options.theme))),i.build(r),r._def}
|
|
4
|
+
`).map(e=>({runs:P(e),level:0}))}get paragraphs(){return this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0}),this.def.paragraphs.map(t=>new Paragraph(t))}add_paragraph(){this.def.paragraphs.length===0&&this.def.paragraphs.push({runs:[],level:0});const t={runs:[],level:0};return this.def.paragraphs.push(t),new Paragraph(t)}clear(){const t=this.def.paragraphs[0];this.def.paragraphs=t?[{...t,runs:[]}]:[]}fit_text(t,e=18,s,r){this.def.auto_size="text",this.def.word_wrap=!0;for(const n of this.def.paragraphs)for(const h of n.runs)h.font={...h.font,size:Math.trunc(e*j),...t===void 0?{}:{name:t},...s===void 0?{}:{bold:s},...r===void 0?{}:{italic:r}}}get list_style(){return y(this.def.levels)}get vertical_anchor(){return this.def.vertical_anchor}set vertical_anchor(t){this._set("vertical_anchor",t)}get auto_size(){return this.def.auto_size}set auto_size(t){this._set("auto_size",t)}get word_wrap(){return this.def.word_wrap}set word_wrap(t){this._set("word_wrap",t)}get margin_left(){return this.def.margin_left??_.left}set margin_left(t){this.def.margin_left=t}get margin_top(){return this.def.margin_top??_.top}set margin_top(t){this.def.margin_top=t}get margin_right(){return this.def.margin_right??_.right}set margin_right(t){this.def.margin_right=t}get margin_bottom(){return this.def.margin_bottom??_.bottom}set margin_bottom(t){this.def.margin_bottom=t}}export class FillFormat{read;write;start;shape;constructor(t,e,s="lt1",r){return this.read=t,this.write=e,this.start=s,this.shape=r,o(this,"FillFormat")}solid(){const t=this.read();this.shape&&Reflect.deleteProperty(this.shape,"gradient"),t==null&&this.write(this.start)}background(){this.shape&&Reflect.deleteProperty(this.shape,"gradient"),this.write(null)}_shape(t){if(!this.shape)throw new TypeError(`Only a shape's fill has ${t}.`);return this.shape}gradient(){this._shape("a gradient").gradient??={angle:90,stops:[{at:0,color:"accent1"},{at:1,color:"accent2"}]}}get gradient_angle(){return this._gradient().angle}set gradient_angle(t){this._gradient().angle=t}get gradient_stops(){return this._gradient().stops}set gradient_stops(t){if(t.length<2)throw new Error("A gradient has two stops at least.");this._gradient().stops=t.map(e=>({...e}))}_gradient(){const{gradient:t}=this._shape("a gradient");if(!t)throw new TypeError("This fill is no gradient: call fill.gradient() first.");return t}get transparency(){return this._shape("a transparency").fill_transparency??0}set transparency(t){if(!(t>=0&&t<=1))throw new Error(`A transparency is a share, 0 to 1, not ${String(t)}.`);this._shape("a transparency").fill_transparency=t}get type(){if(this.shape?.gradient)return"gradient";const t=this.read();return t===void 0?void 0:t===null?"background":"solid"}get fore_color(){const t=this.read();if(t==null)throw new TypeError("This fill is not solid, so it has no fore_color: call fill.solid() first.");return new ColorFormat(()=>this.read()??void 0,e=>{this.write(e??this.start)})}}export class ShadowFormat{def;constructor(t){return this.def=t,o(this,"ShadowFormat")}_shadow(){return this.def.shadow??={...O},this.def.shadow}get inherit(){return this.def.shadow===void 0}set inherit(t){t?Reflect.deleteProperty(this.def,"shadow"):this._shadow()}get blur_radius(){return this._shadow().blur}set blur_radius(t){this._shadow().blur=t}get distance(){return this._shadow().distance}set distance(t){this._shadow().distance=t}get angle(){return this._shadow().angle}set angle(t){this._shadow().angle=t}get transparency(){return this._shadow().transparency}set transparency(t){this._shadow().transparency=t}get color(){const t=this._shadow();return new ColorFormat(()=>t.color,e=>{t.color=e??O.color})}}export class LineFormat{def;constructor(t){return this.def=t,o(this,"LineFormat")}get color(){return new ColorFormat(()=>this.def.line??void 0,t=>{this.def.line=t??null})}get fill(){return new FillFormat(()=>this.def.line,t=>{this.def.line=t},"dk1")}get width(){return this.def.line_width??0}set width(t){this.def.line_width=t}get dash_style(){return this.def.line_dash??null}set dash_style(t){t===null?delete this.def.line_dash:this.def.line_dash=t}get begin_arrow(){return this.def.line_begin??"none"}set begin_arrow(t){this.def.line_begin=t}get end_arrow(){return this.def.line_end??"none"}set end_arrow(t){this.def.line_end=t}}export class Background{holder;constructor(t){return this.holder=t,o(this,"_Background")}get fill(){return new FillFormat(()=>this.holder.background,t=>{this.holder.background=t??"lt1"})}}export const ADJUSTMENT_DEFAULTS={roundRect:[.16667]};export class Adjustments{def;constructor(t){return this.def=t,o(this,"Adjustments",{index:e=>this._values()[e],setIndex:(e,s)=>{this._set(e,Number(s))}})}_values(){return this.def.adjustments??[...ADJUSTMENT_DEFAULTS[this.def.geometry??"rect"]??[]]}get length(){return this._values().length}_set(t,e){const s=this._values();if(t<0||t>=s.length)throw new RangeError(`adjustments[${String(t)}]: ${this.def.geometry??"this shape"} has ${String(s.length)}.`);if(!Number.isFinite(e))throw new Error(`adjustments[${String(t)}] = ${String(e)} is not a number.`);s[t]=e,this.def.adjustments=s}}const H={left:0,top:0,width:0,height:0};export class Shape{def;inherit;constructor(t,e=()=>{}){return this.def=t,this.inherit=e,o(this,"Shape")}get _def(){return this.def}_frame(){return this.def.frame??this.inherit()??H}_own(){return this.def.frame??={...this._frame()},this.def.frame}get name(){return this.def.name}set name(t){this.def.name=t}get shape_type(){return this.def.path?"freeform":this.def.geometry==="line"?"line":this.def.kind}get is_placeholder(){return this.def.kind==="placeholder"}get has_table(){return this.def.table!==void 0}get has_chart(){return this.def.chart!==void 0}get chart(){if(!this.def.chart)throw new Error(`${this.def.name} is not a chart.`);return new L(this.def.chart)}get table(){if(!this.def.table)throw new Error(`${this.def.name} is not a table.`);return new Table(this.def.table)}get placeholder_format(){if(!this.def.placeholder)throw new Error(`${this.def.name} is not a placeholder.`);return{...this.def.placeholder}}get left(){return this._frame().left}set left(t){this._own().left=t}get top(){return this._frame().top}set top(t){this._own().top=t}get width(){return this._frame().width}set width(t){this._own().width=t}get height(){return this._frame().height}set height(t){this._own().height=t}get rotation(){return this.def.rotation??0}set rotation(t){if(!Number.isFinite(t))throw new Error(`${this.def.name}: rotation is a number of degrees.`);const e=(Math.trunc(t*6e4)%216e5+216e5)%216e5/6e4;e===0?Reflect.deleteProperty(this.def,"rotation"):this.def.rotation=e}get has_text_frame(){return this.def.text!==void 0}get text_frame(){if(!this.def.text)throw new Error(`${this.def.name} (a ${this.shape_type}) has no text frame: has_text_frame is false.`);return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t},"lt1",this.def)}get line(){return new LineFormat(this.def)}get shadow(){return new ShadowFormat(this.def)}get adjustments(){return new Adjustments(this.def)}}const X=i=>typeof i=="number"&&Number.isFinite(i),p=(i,t,e,s,{line:r=!1}={})=>{for(const[n,h]of Object.entries({left:i,top:t,width:e,height:s}))if(!X(h))throw new Error(`${n} ${String(h)} is not a length (Emu, Inches, Pt, Cm, Mm).`);if(r?e<0||s<0:e<=0||s<=0)throw new Error("A shape's width and height are over 0.");return{left:Math.trunc(i),top:Math.trunc(t),width:Math.trunc(e),height:Math.trunc(s)}},J=new Set(Object.values($));export class FreeformBuilder{steps;sx;sy;make;constructor(t,e,s){return this.steps=[{op:"move",x:t[0],y:t[1]}],[this.sx,this.sy]=typeof e=="number"?[e,e]:e,this.make=s,o(this,"FreeformBuilder")}add_line_segments(t,e=!0){for(const[s,r]of t)this.steps.push({op:"line",x:s,y:r});return e&&this.steps.push({op:"close"}),this}add_curve_segment(t,e,s,r,n,h){return this.steps.push({op:"curve",x1:t,y1:e,x2:s,y2:r,x:n,y:h}),this}move_to(t,e){return this.steps.push({op:"move",x:t,y:e}),this}convert_to_shape(t=0,e=0){this.steps.length<2&&g("convert_to_shape(): a freeform needs a segment.");const s=this.steps.flatMap(a=>a.op==="close"?[]:a.op==="curve"?[[a.x1,a.y1],[a.x2,a.y2],[a.x,a.y]]:[[a.x,a.y]]),r=s.map(a=>a[0]),n=s.map(a=>a[1]),h=Math.min(...r),d=Math.min(...n),l=Math.max(...r)-h,f=Math.max(...n)-d,u=(a,m)=>({x:a-h,y:m-d});return this.make({w:l,h:f,steps:this.steps.map(a=>{if(a.op==="close")return a;if(a.op!=="curve")return{op:a.op,...u(a.x,a.y)};const m=u(a.x1,a.y1),b=u(a.x2,a.y2);return{op:"curve",x1:m.x,y1:m.y,x2:b.x,y2:b.y,...u(a.x,a.y)}})},p(Math.round(h*this.sx)+t,Math.round(d*this.sy)+e,Math.round(l*this.sx),Math.round(f*this.sy)))}}export class GroupShape{list;_name;make;constructor(t,e,s){return this.list=t,this._name=e,this.make=s,o(this,"GroupShape")}members(){return this.list.filter(t=>t.group===this._name)}box(){const t=this.members().flatMap(r=>r.frame?[r.frame]:[]),e=Math.min(...t.map(r=>r.left)),s=Math.min(...t.map(r=>r.top));return{left:t.length>0?e:0,top:t.length>0?s:0,right:Math.max(0,...t.map(r=>r.left+r.width)),bottom:Math.max(0,...t.map(r=>r.top+r.height))}}get shapes(){return this.make(this._name)}get shape_type(){return F.GROUP}get name(){return this._name}set name(t){for(const e of this.members())e.group=t;this._name=t}get left(){return this.box().left}set left(t){const e=t-this.box().left;for(const s of this.members())s.frame&&(s.frame.left+=e)}get top(){return this.box().top}set top(t){const e=t-this.box().top;for(const s of this.members())s.frame&&(s.frame.top+=e)}get width(){const t=this.box();return t.right-t.left}get height(){const t=this.box();return t.bottom-t.top}}export class Cell{def;table;row;col;constructor(t,e,s,r){return this.def=t,this.table=e,this.row=s,this.col=r,o(this,"_Cell")}get text_frame(){return new TextFrame(this.def.text)}get text(){return this.text_frame.text}set text(t){this.text_frame.text=t}get fill(){return new FillFormat(()=>this.def.fill,t=>{this.def.fill=t})}get borders(){return this.def.borders??{}}set borders(t){this.def.borders=t}get margin_left(){return this.def.text.margin_left??_.left}set margin_left(t){this.def.text.margin_left=t}get margin_right(){return this.def.text.margin_right??_.right}set margin_right(t){this.def.text.margin_right=t}get margin_top(){return this.def.text.margin_top??_.top}set margin_top(t){this.def.text.margin_top=t}get margin_bottom(){return this.def.text.margin_bottom??_.bottom}set margin_bottom(t){this.def.text.margin_bottom=t}get vertical_anchor(){return this.def.text.vertical_anchor}set vertical_anchor(t){t===void 0?delete this.def.text.vertical_anchor:this.def.text.vertical_anchor=t}get is_merge_origin(){return(this.def.span_width??1)>1||(this.def.span_height??1)>1}get is_spanned(){return this.def.spanned===!0}get span_width(){return this.def.span_width??1}get span_height(){return this.def.span_height??1}merge(t){const e=[this.row,t.row].sort((l,f)=>l-f),s=[this.col,t.col].sort((l,f)=>l-f),[r=0,n=0]=e,[h=0,d=0]=s;for(let l=r;l<=n;l++)for(let f=h;f<=d;f++){const u=this.table.rows[l]?.cells[f];u&&(l===r&&f===h?(d>h&&(u.span_width=d-h+1),n>r&&(u.span_height=n-r+1)):u.spanned=!0)}}split(){const t=this.span_width,e=this.span_height;delete this.def.span_width,delete this.def.span_height;for(let s=this.row;s<this.row+e;s++)for(let r=this.col;r<this.col+t;r++){const n=this.table.rows[s]?.cells[r];n&&delete n.spanned}}}export class Column{def;at;constructor(t,e){return this.def=t,this.at=e,o(this,"_Column")}get width(){return this.def.columns[this.at]??0}set width(t){this.def.columns[this.at]=t}}export class Row{def;at;constructor(t,e){return this.def=t,this.at=e,o(this,"_Row")}get row(){const t=this.def.rows[this.at];if(!t)throw new Error(`The table has no row ${String(this.at)}.`);return t}get height(){return this.row.height}set height(t){this.row.height=t}}export class Table{def;constructor(t){return this.def=t,o(this,"Table")}cell(t,e){const s=this.def.rows[t]?.cells[e];if(!s)throw new Error(`cell(): the table has ${String(this.def.rows.length)} rows and ${String(this.def.columns.length)} columns.`);return new Cell(s,this.def,t,e)}*iter_cells(){for(let t=0;t<this.def.rows.length;t++)for(let e=0;e<this.def.columns.length;e++)yield this.cell(t,e)}get columns(){return this.def.columns.map((t,e)=>new Column(this.def,e))}get rows(){return this.def.rows.map((t,e)=>new Row(this.def,e))}flag(t){return this.def[t]===!0}get first_row(){return this.flag("first_row")}set first_row(t){this.def.first_row=t}get first_col(){return this.flag("first_col")}set first_col(t){this.def.first_col=t}get last_row(){return this.flag("last_row")}set last_row(t){this.def.last_row=t}get last_col(){return this.flag("last_col")}set last_col(t){this.def.last_col=t}get horz_banding(){return this.flag("horz_banding")}set horz_banding(t){this.def.horz_banding=t}get vert_banding(){return this.flag("vert_banding")}set vert_banding(t){this.def.vert_banding=t}}function Y(i,t,e=[]){const s=new Set([...i,...e].map(n=>n.name));let r=1;for(;s.has(`${t}-${String(r)}`);)r++;return`${t}-${String(r)}`}export class ShapeCollection{list;base;components;inherit;group;under;constructor(t,e,s,r=()=>{},n=()=>[],h){return this.list=t,this.base=e,this.components=s,this.inherit=r,this.under=n,this.group=h,o(this,"SlideShapes",{index:d=>this._at(d)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}_at(t){const e=this.list[t];return e?this._wrap(e):void 0}*[Symbol.iterator](){for(const t of this.list)yield this._wrap(t)}get length(){return this.list.length}get(t){const e=this.list.find(s=>s.name===t);return e?this._wrap(e):void 0}get title(){const t=this.list.find(e=>e.placeholder?.type==="title"||e.placeholder?.type==="ctrTitle");return t?this._wrap(t):void 0}get placeholders(){return new Placeholders(this.list,this.inherit)}_add(t,e){const s={name:Y(this.list,t,this.under()),...e,...this.group===void 0?{}:{group:this.group}};return this.list.push(s),this._wrap(s)}add_textbox(t,e,s,r){return this._add("textbox",{kind:"textbox",frame:p(t,e,s,r),text:{...x(),...C}})}add_picture(t,e,s,r,n){return(r===void 0||n===void 0)&&g("add_picture() takes a width and a height here: a picture's own size is not read while a deck's code runs"),this._add("picture",{kind:"picture",frame:p(e,s,r??0,n??0),media:{path:t,base:this.base}})}add_movie(t,e,s,r,n,h={}){return this._add("movie",{kind:"movie",frame:p(e,s,r,n),media:{path:t,base:this.base,...h.poster_frame_time===void 0?{}:{poster:h.poster_frame_time}}})}add_shape(t,e,s,r,n){J.has(t)||g(`add_shape(): ${t} is not one of MSO_SHAPE's ${Object.keys($).join(", ")}`);const h=x();return h.vertical_anchor=c.vertical_anchor,h.paragraphs=[{runs:[],level:0,alignment:c.alignment}],this._add("shape",{kind:"autoshape",frame:p(e,s,r,n),geometry:t,fill:c.fill,line:c.line,line_width:c.line_width,text:h})}add_table(t,e,s,r,n,h){(t<1||e<1)&&g("add_table(): a table has at least a row and a column.");const d=Math.floor(n/e),l=Math.floor(h/t);return this._add("table",{kind:"table",frame:p(s,r,n,h),table:{columns:Array.from({length:e},()=>d),rows:Array.from({length:t},()=>({height:l,cells:Array.from({length:e},()=>({text:x()}))}))}})}add_chart(t,e,s,r,n,h){return this._add("chart",{kind:"chart",frame:p(e,s,r,n),chart:{type:t,categories:[...h.categories],series:h._series()}})}add_group_shape(){this.group!==void 0&&g("add_group_shape(): a group here holds shapes, not another group.");let t=1;for(;this.list.some(e=>e.group===`group-${String(t)}`);)t++;return new GroupShape(this.list,`group-${String(t)}`,e=>new ShapeCollection(this.list,this.base,this.components,this.inherit,this.under,e))}build_freeform(t=0,e=0,s=1){return new FreeformBuilder([t,e],s,(r,n)=>{const h=x();return h.vertical_anchor=c.vertical_anchor,h.paragraphs=[{runs:[],level:0,alignment:c.alignment}],this._add("freeform",{kind:"autoshape",frame:n,path:r,fill:c.fill,line:c.line,line_width:c.line_width,text:h})})}add_connector(t,e,s,r,n){t!==k.STRAIGHT&&g(`add_connector(): ${t} is not one of MSO_CONNECTOR's ${Object.keys(k).join(", ")}`);const h=p(Math.min(e,r),Math.min(s,n),Math.abs(r-e),Math.abs(n-s),{line:!0}),d=r<e,l=n<s;return this._add("connector",{kind:"autoshape",frame:h,geometry:"line",...d||l?{flip:{...d?{h:d}:{},...l?{v:l}:{}}}:{},line:M.line,line_width:M.line_width})}add_component(t,e,s,r,n,h={}){if(!Object.hasOwn(this.components(),t))throw new Error(`add_component(): the presentation has no component ${t}; add it with prs.components.add("${t}", { … }) first.`);return this._add(t,{kind:"component",frame:p(e,s,r,n),component:{name:t,props:h}})}}export const NAME_OF_TYPE={title:"title",ctrTitle:"title",subTitle:"subtitle",body:"body",pic:"picture",media:"media",obj:"content",dt:"date",ftr:"footer",sldNum:"slide-number"};export class Placeholders{list;inherit;constructor(t,e=()=>{}){return this.list=t,this.inherit=e,o(this,"placeholders",{index:s=>this.get(s)})}_wrap(t){return new Shape(t,()=>this.inherit(t))}*[Symbol.iterator](){for(const t of this.list)t.kind==="placeholder"&&(yield this._wrap(t))}get length(){return this.list.filter(t=>t.kind==="placeholder").length}get(t){const e=this.list.find(s=>s.kind==="placeholder"&&(typeof t=="number"?s.placeholder?.idx===t:s.name===t||s.placeholder?.type===t));return e?this._wrap(e):void 0}add(t,e,s,r,n,h={}){const d=typeof e=="object"?e:h,l=typeof e=="object"?void 0:e;Object.values(T).includes(t)||g(`placeholders.add(): ${t} is not one of PP_PLACEHOLDER's ${Object.keys(T).join(", ")}`);const f=this.list.filter(w=>w.kind==="placeholder"),u=new Set(f.map(w=>w.placeholder?.idx));let a=t==="title"||t==="ctrTitle"?0:N[t]??1;for(;u.has(a)&&a!==0;)a++;if(u.has(a))throw new Error("A layout has one title placeholder (idx 0).");const m=d.name??NAME_OF_TYPE[t];if(this.list.some(w=>w.name===m))throw new Error(`Two shapes are ${m}: give the placeholder a name ({ name }).`);const b=[l,s,r,n].filter(w=>w!==void 0);if(b.length!==0&&b.length!==4)throw new Error("placeholders.add(type, left, top, width, height): give all four, or none to take the master's frame.");const E={name:m,kind:"placeholder",placeholder:{type:t,idx:a},...b.length===4?{frame:p(l??0,s??0,r??0,n??0)}:{},text:x()};return this.list.push(E),this._wrap(E)}}export class SlideLayout{def;master;ctx;constructor(t,e,s){return this.def=t,this.master=e,this.ctx=s,o(this,"SlideLayout")}get _def(){return this.def}inherit=t=>t.placeholder?v(this.master._def,t.placeholder.type)?.frame:void 0;get name(){return this.def.name}get slide_master(){return this.master}get display_master_shapes(){return this.def.display_master_shapes??!0}set display_master_shapes(t){t?delete this.def.display_master_shapes:this.def.display_master_shapes=!1}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes,this.inherit)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components,this.inherit,()=>this.master._def.shapes)}}export class SlideLayouts{list;make;constructor(t,e){return this.list=t,this.make=e,o(this,"SlideLayouts",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}get_by_name(t,e){return this.list.find(s=>s.name===t)??e}index(t){const e=this.list.indexOf(t);if(e<0)throw new Error(`${t.name} is not among these layouts.`);return e}add(t,e){if(!this.make)throw new Error("A layout is added to a master: master.slide_layouts.add(name).");const s=this.make(t);return e?.(s),s}}export class TextStyles{def;constructor(t){return this.def=t,o(this,"text_styles")}get title_style(){return y(this.def.title)}get body_style(){return y(this.def.body)}get other_style(){return y(this.def.other)}}export class SlideMaster{def;layouts=[];ctx;allLayouts;constructor(t,e,s){return this.def=t,this.ctx=e,this.allLayouts=s,o(this,"SlideMaster")}get _def(){return this.def}get name(){return this.def.name}get background(){return new Background(this.def)}get placeholders(){return new Placeholders(this.def.shapes)}get shapes(){return new ShapeCollection(this.def.shapes,this.ctx.base,this.ctx.components)}get text_styles(){return new TextStyles(this.def.text_styles)}get slide_layouts(){return new SlideLayouts(this.layouts,t=>{if(this.allLayouts.some(r=>r.name===t))throw new Error(`Two layouts are "${t}": a layout's name is unique in the deck, as slides.yaml names it.`);const e={name:t,master:this.def.name,shapes:[]};this.def.layouts.push(e);const s=new SlideLayout(e,this,this.ctx);return this.layouts.push(s),this.allLayouts.push(s),s})}}export class SlideMasters{list;make;constructor(t,e){return this.list=t,this.make=e,o(this,"SlideMasters",{index:s=>this.list[s]})}*[Symbol.iterator](){yield*this.list}get length(){return this.list.length}index(t){return this.list.indexOf(t)}add(t,e){const s=this.make(t);return e?.(s),s}}export class GeneratedSlide{own;def;layout;constructor(t,e,s){this.def=t,this.layout=e,this.own=e._def.shapes.filter(n=>n.kind==="placeholder").map(n=>({name:n.name,kind:"placeholder",...n.placeholder?{placeholder:{...n.placeholder}}:{},text:x()}));const r=n=>{const h=e._def.shapes.find(d=>d.kind==="placeholder"&&d.placeholder?.idx===n.placeholder?.idx);return h?h.frame??(h.placeholder?v(e.slide_master._def,h.placeholder.type)?.frame:void 0):void 0};return this._shapes=new ShapeCollection(this.own,s.base,s.components,r,()=>[...e.slide_master._def.shapes,...e._def.shapes]),this._placeholders=new Placeholders(this.own,r),o(this,"Slide")}_shapes;_placeholders;get shapes(){return this._shapes}get placeholders(){return this._placeholders}get slide_id(){return this.def.id}get slide_layout(){return this.layout}get has_notes_slide(){return this.def.notes!==void 0}get notes_slide(){const t=this.def;return{notes_text_frame:{get text(){return t.notes??""},set text(e){t.notes=e}}}}get transition(){return this.def.transition}set transition(t){t===void 0?delete this.def.transition:this.def.transition=t}get animations(){return new Animations(this.def.animations??=[])}_done(){const t={},e=[];for(const s of this.own)s.kind==="placeholder"&&s.placeholder?(s.text?.paragraphs.some(r=>r.runs.length>0)&&(t[s.placeholder.idx]=s.text.paragraphs),s.frame&&e.push({...s,text:x()})):e.push(s);return{...this.def,shapes:e,text:t}}}export class Animations{list;constructor(t){return this.list=t,o(this,"Animations")}add(t,e,s={}){this.list.push({shape:typeof t=="string"?t:t.name,effect:e,...s})}get length(){return this.list.length}}class Z{gen;constructor(t){return this.gen=t,o(this,"slides")}add_slide(t,e){return this.gen._add(t,e)}}export class Generator{list=[];prs;ctx;constructor(t,e){return this.prs=t,this.ctx=e,o(this,"Generator")}data(t){return this.ctx.data(t)}get slides(){return new Z(this)}_add(t,e){const s=typeof t=="string"?this.prs._layout(t):t;if(!s)throw new Error(`add_slide(): the presentation has no layout ${typeof t=="string"?t:t.name}.`);if(!/^[A-Za-z0-9_-]+$/u.test(e))throw new Error(`add_slide(): ${e} is not an id of letters, digits, _ and -.`);if(this.list.some(n=>n.slide_id===e))throw new Error(`add_slide(): two slides are ${e}.`);const r=new GeneratedSlide({id:e,layout:s.name,shapes:[],text:{}},s,this.prs._ctx);return this.list.push(r),r}_made(){return this.list.map(t=>t._done())}}const q=()=>JSON.parse(JSON.stringify(z));export class Presentation{masters=[];layouts=[];def;_ctx;constructor(t,e){return this.def={slide_width:t[0],slide_height:t[1],masters:[],components:{},generators:{}},this._ctx={base:e,components:()=>this.def.components},o(this,"Presentation")}get _def(){return this.def}get slide_width(){return this.def.slide_width}set slide_width(t){this.def.slide_width=t}get slide_height(){return this.def.slide_height}set slide_height(t){this.def.slide_height=t}get slide_masters(){return new SlideMasters(this.masters,t=>{if(this.masters.some(r=>r.name===t))throw new Error(`Two masters are "${t}".`);const e={name:t,background:"lt1",text_styles:q(),shapes:[],layouts:[]};this.def.masters.push(e);const s=new SlideMaster(e,this._ctx,this.layouts);return this.masters.push(s),s})}get slide_master(){const t=this.masters[0];if(!t)throw new Error("The presentation has no master yet: prs.slide_masters.add(name) makes one.");return t}get slide_layouts(){const t=this.masters[0];return t?t.slide_layouts:new SlideLayouts([])}get slides(){return g("A deck's slides are slides.yaml's, in order, each on a layout, and their words the script's; slides made from data are a generator's (prs.generators.add)")}save(){return g("A deck is not saved by its code: allyhub render writes its PDF, pictures and PPTX")}get theme(){return this.def.theme??={},this.def.theme}set theme(t){this.def.theme=t}get components(){return o({add:(t,e)=>{if(Object.hasOwn(this.def.components,t))throw new Error(`Two components are "${t}".`);if(typeof e.layers!="function")throw new Error(`Component ${t} draws with its layers function.`);this.def.components[t]={name:t,props:e.props??{},layers:e.layers}}},"components")}get generators(){return o({add:(t,e)=>{if(Object.hasOwn(this.def.generators,t))throw new Error(`Two generators are "${t}".`);this.def.generators[t]={name:t,make:s=>{const r=new Generator(this,s);return e(r),r._made()}}}},"generators")}_layout(t){return this.layouts.find(e=>e.name===t)}}export const DECK_BRAND="__allyhubDeck";export function isDeck(i){return typeof i=="object"&&i!==null&&DECK_BRAND in i}export const presentationFor=i=>(t,e)=>{const[s,r]=typeof t=="function"?[{},t]:[t,e];if(typeof r!="function")throw new Error("An item's slides.ts exports one deck: export default presentation({ size }, (prs) => { … masters, layouts, components … }); its slides are slides.yaml.");if(typeof s.size=="string"&&!Object.hasOwn(S,s.size))throw new Error(`presentation(): size ${s.size} is not one of ${Object.keys(S).join(", ")}, or { width, height } in EMU.`);return{[DECK_BRAND]:!0,kind:"slides",options:s,build:r,written:{file:i}}};export function evaluateDeck(i){const t=i.options.size??"16:9",e=typeof t=="string"?S[t]:[t.width,t.height],s=i.written.file.split("/").slice(0,-1).join("/"),r=new Presentation(e,s);return i.options.theme&&(r.theme=JSON.parse(JSON.stringify(i.options.theme))),i.build(r),r._def}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{Animations as
|
|
2
|
+
import{Animations as l,Background as d,Cell as p,ColorFormat as h,Column as m,FillFormat as y,Font as c,FreeformBuilder as u,GeneratedSlide as _,Generator as f,GroupShape as g,Hyperlink as b,LineFormat as w,ListLevel as S,ShadowFormat as L,Paragraph as O,Placeholders as P,Presentation as A,Row as E,Run as C,Shape as x,ShapeCollection as T,SlideLayout as R,SlideLayouts as k,SlideMaster as M,SlideMasters as F,Table as v,TextFrame as I,TextStyles as H}from"./api.js";import{CategoryChartData as B,Chart as D,XyChartData as G,XySeriesData as N,ChartAxis as j,ChartLegend as X,ChartPlot as W,ChartSeries as z,DataLabels as U}from"./chart-api.js";import{MSO_ANCHOR as Y,MSO_ARROWHEAD as Z,MSO_AUTO_SIZE as K,MSO_CONNECTOR as q,MSO_FILL as J,MSO_LINE as Q,MSO_SHAPE as V,MSO_SHAPE_TYPE as $,MSO_THEME_COLOR as ee,PP_ALIGN as te,PP_PLACEHOLDER as ae,THEME_FONT as oe,XL_CHART_TYPE as se,XL_LABEL_POSITION as re,XL_LEGEND_POSITION as ie}from"./enums.js";import{publicNames as s}from"./strict.js";const a={Presentation:{theme:"The theme's colours (dk1…folHlink) and fonts (major, minor), over the project's look.",components:"components.add(name, { props, layers }): a shape drawn by code, by the layer contract.",generators:"generators.add(name, (g) => { g.data(path); g.slides.add_slide(layout, id) … }): slides made from data, placed in slides.yaml as one block."},SlideMasters:{add:"add(name): a master, with Office's text styles and no placeholders yet."},_Cell:{borders:"Its edges: { left, right, top, bottom }, each { color, width } (a:lnL…)."},LineFormat:{begin_arrow:"What the end of the line where it starts has (MSO_ARROWHEAD): PowerPoint's Begin Arrow type (a:headEnd).",end_arrow:"What the end of the line where it ends has (MSO_ARROWHEAD): PowerPoint's End Arrow type (a:tailEnd)."},FillFormat:{transparency:"How much of the fill shows through, a share: PowerPoint's Transparency (a:alpha).",gradient_stops:"Its stops, [{ at, color, transparency }], `at` and `transparency` shares; python-pptx's stops can only be read and changed in place."},ShadowFormat:{blur_radius:"How far the shadow blurs, a Length (a:outerShdw blurRad).",distance:"How far it falls from the shape, a Length (dist).",angle:"The way it falls, degrees clockwise from the right (dir).",transparency:"How much shows through it, a share (a:alpha).",color:"Its colour, a ColorFormat."},FreeformBuilder:{add_curve_segment:"add_curve_segment(x1, y1, x2, y2, x, y): a cubic Bézier segment by its two control points (a:cubicBezTo)."},Font:{strike:"A line through it (@strike).",baseline:"Raised or lowered, a share of its size: superscript 0.3, subscript -0.25 (@baseline).",highlight:"The colour behind it, #RRGGBB as RGBColor gives one (a:highlight).",spacing:"Space added between letters, a Length, negative to tighten (PowerPoint's Character Spacing, a:rPr spc)."},SlideMaster:{text_styles:"Its text styles (p:txStyles): title_style, body_style, other_style, nine ListLevels each, Office's to start with."},SlideLayouts:{add:"add(name): a layout on this master."},SlideLayout:{display_master_shapes:"Whether its master's shapes are drawn on its slides, true unless set: PowerPoint's Hide Background Graphics (@showMasterSp)."},placeholders:{add:"add(PP_PLACEHOLDER.X, left?, top?, width?, height?, { name }): a placeholder on a master or a layout; a layout's without a frame takes its master's of its base type."},SlideShapes:{add_component:"add_component(name, left, top, width, height, props): a component of the presentation in a frame.",get:"get(name): a shape by its name."},TextFrame:{list_style:"Its list style (a:lstStyle): nine ListLevels, level 0 first, what its paragraphs take where they set nothing."},ListLevel:{"*":"A level of a list style: alignment, line_spacing, space_before, space_after, font, bullet (a character, or null for none), bullet_font, numbered (a:buAutoNum: arabicPeriod, alphaLcPeriod…), margin_left, indent."},text_styles:{"*":"title_style, body_style, other_style: a master's text styles, nine ListLevels each."},Animations:{"*":"A generated slide's Animation Pane: add(shape, effect, { start, direction, duration, delay, paragraph, path }), in order."},Slide:{animations:"Its Animation Pane, which python-pptx has no API for.",transition:"How it comes on from the slide before: { type, direction, duration }, which python-pptx has no API for."},Generator:{"*":"What a generator's function is given: data(path), and slides.add_slide(layout, id)."}},ne={Presentation:{slides:"A deck's slides are slides.yaml's, their words the script's; slides from data are a generator's.",save:"A deck is not saved by its code: allyhub render writes its files."}},le={Presentation:A.prototype,SlideMasters:F.prototype,SlideMaster:M.prototype,SlideLayouts:k.prototype,SlideLayout:R.prototype,Slide:_.prototype,placeholders:P.prototype,SlideShapes:T.prototype,Shape:x.prototype,TextFrame:I.prototype,_Paragraph:O.prototype,_Run:C.prototype,_Hyperlink:b.prototype,Font:c.prototype,ColorFormat:h.prototype,FillFormat:y.prototype,LineFormat:w.prototype,ShadowFormat:L.prototype,FreeformBuilder:u.prototype,GroupShape:g.prototype,Table:v.prototype,CategoryChartData:B.prototype,XyChartData:G.prototype,XySeriesData:N.prototype,Chart:D.prototype,Plot:W.prototype,Series:z.prototype,DataLabels:U.prototype,Legend:X.prototype,Axis:j.prototype,_Cell:p.prototype,_Column:m.prototype,_Row:E.prototype,_Background:d.prototype},de={Animations:l.prototype,ListLevel:S.prototype,text_styles:H.prototype,Generator:f.prototype},pe=()=>{const e={};for(const[t,r]of Object.entries(le)){const i=a[t]??{},n=ne[t]??{};e[t]=s(r).filter(o=>!Object.hasOwn(i,o)&&!Object.hasOwn(n,o))}return e};export const CAPABILITIES={reference:{library:"python-pptx",version:"1.0.2",docs:"https://python-pptx.readthedocs.io/"},holds:pe(),enums:Object.fromEntries(Object.entries({MSO_THEME_COLOR:ee,PP_ALIGN:te,MSO_ANCHOR:Y,MSO_AUTO_SIZE:K,PP_PLACEHOLDER:ae,MSO_SHAPE:V,MSO_CONNECTOR:q,MSO_SHAPE_TYPE:$,MSO_FILL:J,MSO_LINE:Q,XL_CHART_TYPE:se,XL_LABEL_POSITION:re,XL_LEGEND_POSITION:ie,MSO_ARROWHEAD:Z,THEME_FONT:oe}).map(([e,t])=>[e,Object.keys(t)])),units:["Emu","Inches","Pt","Cm","Mm","Centipoints","RGBColor"],differs:["The entry is export default presentation({ size, theme }, (prs) => { … }), not Presentation(path): a deck is made by its code, never opened from a template. Its masters and layouts are made with the additions below; its slides are slides.yaml's.","A name python-pptx has that is not held throws where it is used, naming what the class holds; python-pptx's x[i] is held where it indexes (slide_masters[0], slide_layouts[0], placeholders[idx], shapes[0]), and len(x) is x.length.","Lengths are numbers of EMU, made by python-pptx's functions (Inches(1), Pt(12)): no .inches or .pt on them; divide by 914400 or 12700.",`An enumeration's members are PresentationML's values (MSO_THEME_COLOR.ACCENT_1 is "accent1", PP_ALIGN.CENTER "ctr"), not integers; TEXT_1 and BACKGROUND_1 are dk1 and lt1, a master's standard colour map. MSO_SHAPE_TYPE.COMPONENT is a component's.`,`A colour's rgb is "#RRGGBB": RGBColor(r, g, b) and RGBColor.from_string("RRGGBB") make one.`,"line_spacing is a number of lines, or a Length of Pt(1) and over for a fixed height (python-pptx tells them apart by type).","add_picture() takes both width and height: a picture's own size is not read while a deck's code runs.","add_movie(movie_file, left, top, width, height, { poster_frame_time }) takes a video file, its poster a moment of it in seconds, not poster_frame_image.","A shape's name is its kind and a number (textbox-1, shape-2), and a placeholder's its type's (title, body, subtitle): slides.yaml and the script name shapes by name.","fit_text() sets the frame to shrink its text when it is drawn (MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE) from max_size: it reads no font file.","Font.underline is a single underline or none.","A chart holds column, bar, line, area, pie, doughnut and XY scatter types; it has no 3D, no bubble, no radar and no second axis. slides.yaml's chart can read its numbers from a project file: data, categories and series name it and its columns.","A table has no style, where python-pptx's starts with Medium Style 2: its look is its cells' (fill, borders, text), and first_row and the like say what its rows are and paint nothing. add_table returns its shape, whose .table is the table.","A group is its shapes: they are listed with the shapes the group is among, drawn as they are, and a group holds no group; its box is theirs, so left and top move them and width and height only read.","A presentation is 16:9 (12192000 × 6858000) and its theme Office 2013–2022's over the project's look; python-pptx's template is 4:3 with Office 2007's.","prs.slide_layouts and prs.slide_master are the first master's, as python-pptx's; a generator's add_slide also takes a layout of any master by name."],adds:{...a,...Object.fromEntries(Object.entries(de).map(([e,t])=>[e,{...a[e]??{},names:s(t).join(", ")}]))}};
|
|
@@ -18,6 +18,29 @@ export declare class CategoryChartData {
|
|
|
18
18
|
/** The series as a chart holds them. */
|
|
19
19
|
_series(): ChartSeriesDef[];
|
|
20
20
|
}
|
|
21
|
+
/** python-pptx's `XySeriesData`: a series of an XY chart, a point at a time. */
|
|
22
|
+
export declare class XySeriesData {
|
|
23
|
+
readonly points: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}[];
|
|
27
|
+
readonly name: string;
|
|
28
|
+
constructor(name: string);
|
|
29
|
+
add_data_point(x: number, y: number): void;
|
|
30
|
+
}
|
|
31
|
+
/** python-pptx's `XyChartData`: what an XY scatter chart shows. */
|
|
32
|
+
export declare class XyChartData {
|
|
33
|
+
number_format: string;
|
|
34
|
+
private readonly list;
|
|
35
|
+
constructor(options?: {
|
|
36
|
+
number_format?: string;
|
|
37
|
+
});
|
|
38
|
+
add_series(name: string): XySeriesData;
|
|
39
|
+
/** The chart's data: an XY chart has no categories. */
|
|
40
|
+
get categories(): string[];
|
|
41
|
+
/** The series as a chart holds them. */
|
|
42
|
+
_series(): ChartSeriesDef[];
|
|
43
|
+
}
|
|
21
44
|
/** A chart's text, or its labels' (`font`). */
|
|
22
45
|
export declare class ChartFont {
|
|
23
46
|
private readonly read;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{ColorFormat as
|
|
2
|
+
import{ColorFormat as o,FillFormat as h}from"./api.js";import{accentOf as f,isRound as l}from"@allyhub-next/chart";import{strict as r}from"./strict.js";import{Pt as n}from"./units.js";export class CategoryChartData{number_format;names=[];list=[];constructor(e={}){return this.number_format=e.number_format??"General",r(this,"CategoryChartData")}get categories(){return this.names}set categories(e){this.names=e.map(String)}add_category(e){this.names.push(String(e))}add_series(e,t=[],i){this.list.push({name:e,values:t.map(a=>a??null),...i===void 0?{}:{number_format:i}})}_series(){return this.list.map(e=>({...e,values:[...e.values],number_format:e.number_format??this.number_format}))}}export class XySeriesData{points=[];name;constructor(e){return this.name=e,r(this,"XySeriesData")}add_data_point(e,t){this.points.push({x:e,y:t})}}export class XyChartData{number_format;list=[];constructor(e={}){return this.number_format=e.number_format??"General",r(this,"XyChartData")}add_series(e){const t=new XySeriesData(e);return this.list.push(t),t}get categories(){return[]}_series(){return this.list.map(e=>({name:e.name,values:e.points.map(t=>t.y),x:e.points.map(t=>t.x),number_format:this.number_format}))}}const u=s=>s===void 0?void 0:s/n(1);export class ChartFont{read;write;constructor(e,t){return this.read=e,this.write=t,r(this,"ChartFont")}get size(){const e=this.read().size;return e===void 0?void 0:n(e)}set size(e){const t=this.read(),i=u(e);this.write({...t.color===void 0?{}:{color:t.color},...i===void 0?{}:{size:i}})}get color(){return new o(()=>this.read().color,e=>{const{size:t}=this.read();this.write({...t===void 0?{}:{size:t},...e===void 0?{}:{color:e}})})}}export class ChartLine{read;write;constructor(e,t){return this.read=e,this.write=t,r(this,"ChartLine")}get color(){return new o(this.read,this.write)}}export class ChartSeries{def;at;constructor(e,t){return this.def=e,this.at=t,r(this,"ChartSeries")}get name(){return this.def.name}get values(){return this.def.values}get marker(){const e=this.def;return{get size(){return e.marker_size},set size(t){t===void 0?delete e.marker_size:e.marker_size=t}}}get smooth(){return this.def.smooth===!0}set smooth(e){this.def.smooth=e}get format(){const e=this.def;return{line:{get width(){return e.line_width===void 0?void 0:n(e.line_width)},set width(t){t===void 0?delete e.line_width:e.line_width=t/n(1)}},fill:new h(()=>this.def.color??f(this.at),t=>{t!==null&&(this.def.color=t)})}}}export class DataLabels{def;constructor(e){return this.def=e,r(this,"DataLabels")}get show_value(){return this.def.show_value??!1}set show_value(e){this.def.show_value=e}get show_percentage(){return this.def.show_percentage??!1}set show_percentage(e){this.def.show_percentage=e}get show_category_name(){return this.def.show_category_name??!1}set show_category_name(e){this.def.show_category_name=e}get show_series_name(){return this.def.show_series_name??!1}set show_series_name(e){this.def.show_series_name=e}get number_format(){return this.def.number_format??"General"}set number_format(e){this.def.number_format=e}get position(){return this.def.position}set position(e){e===void 0?delete this.def.position:this.def.position=e}get font(){return new ChartFont(()=>({...this.def.size===void 0?{}:{size:this.def.size},...this.def.color===void 0?{}:{color:this.def.color}}),e=>{delete this.def.size,delete this.def.color,Object.assign(this.def,e)})}}export class ChartPlot{def;constructor(e){return this.def=e,r(this,"ChartPlot")}get categories(){return this.def.categories}get series(){return this.def.series.map((e,t)=>new ChartSeries(e,t))}get has_data_labels(){return this.def.labels!==void 0}set has_data_labels(e){e?this.def.labels??={show_value:!0}:delete this.def.labels}get data_labels(){return this.def.labels??={show_value:!0},new DataLabels(this.def.labels)}get gap_width(){return this.def.gap_width??150}set gap_width(e){this.def.gap_width=e}get overlap(){return this.def.overlap??0}set overlap(e){this.def.overlap=e}get vary_by_categories(){return this.def.vary_by_categories??l(this.def.type)}set vary_by_categories(e){this.def.vary_by_categories=e}}export class ChartLegend{def;constructor(e){return this.def=e,r(this,"ChartLegend")}get position(){return this.def.legend??"right"}set position(e){this.def.legend=e}}export class ChartAxis{def;constructor(e){return this.def=e,r(this,"ChartAxis")}get minimum_scale(){return this.def.minimum_scale}set minimum_scale(e){e===void 0?delete this.def.minimum_scale:this.def.minimum_scale=e}get maximum_scale(){return this.def.maximum_scale}set maximum_scale(e){e===void 0?delete this.def.maximum_scale:this.def.maximum_scale=e}get major_unit(){return this.def.major_unit}set major_unit(e){e===void 0?delete this.def.major_unit:this.def.major_unit=e}get has_major_gridlines(){return this.def.has_major_gridlines??!0}set has_major_gridlines(e){this.def.has_major_gridlines=e}get visible(){return this.def.visible??!0}set visible(e){this.def.visible=e}get reverse_order(){return this.def.reverse_order??!1}set reverse_order(e){this.def.reverse_order=e}get tick_labels(){const e=this.def;return{get number_format(){return e.number_format??"General"},set number_format(t){e.number_format=t}}}get major_gridlines(){return{format:{line:new ChartLine(()=>this.def.gridline_color,e=>{e===void 0?delete this.def.gridline_color:this.def.gridline_color=e})}}}get format(){return{line:new ChartLine(()=>this.def.line_color,e=>{e===void 0?delete this.def.line_color:this.def.line_color=e})}}}export class Chart{def;constructor(e){return this.def=e,r(this,"Chart")}get chart_type(){return this.def.type}get has_legend(){return this.def.legend!==void 0}set has_legend(e){e?this.def.legend??="right":delete this.def.legend}get legend(){return new ChartLegend(this.def)}get has_title(){return this.def.title!==void 0}set has_title(e){e?this.def.title??="":delete this.def.title}get chart_title(){const e=this.def;return{font:{get size(){return e.title_size===void 0?void 0:n(e.title_size)},set size(t){t===void 0?delete e.title_size:e.title_size=t/n(1)}},text_frame:{get text(){return e.title??""},set text(t){e.title=t}}}}get font(){return new ChartFont(()=>({...this.def.font_size===void 0?{}:{size:this.def.font_size},...this.def.font_color===void 0?{}:{color:this.def.font_color}}),e=>{delete this.def.font_size,delete this.def.font_color,e.size!==void 0&&(this.def.font_size=e.size),e.color!==void 0&&(this.def.font_color=e.color)})}get plots(){return[new ChartPlot(this.def)]}get series(){return this.def.series.map((e,t)=>new ChartSeries(e,t))}get value_axis(){return this.def.value_axis??={},new ChartAxis(this.def.value_axis)}get category_axis(){return this.def.category_axis??={},new ChartAxis(this.def.category_axis)}replace_data(e){const t=this.def.series;this.def.categories=[...e.categories],this.def.series=e._series().map((i,a)=>{const d=t[a]?.color;return d===void 0?i:{...i,color:d}})}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{labelPositionsOf as
|
|
2
|
+
import{isScatter as j,labelPositionsOf as v}from"@allyhub-next/chart";import{colorOfFile as u,joinPath as O}from"./resolve.js";const w=e=>e&&{...e.min===void 0?{}:{minimum_scale:e.min},...e.max===void 0?{}:{maximum_scale:e.max},...e.major===void 0?{}:{major_unit:e.major},...e.gridlines===void 0?{}:{has_major_gridlines:e.gridlines},...e.visible===void 0?{}:{visible:e.visible},...e.format===void 0?{}:{number_format:e.format},...e.reverse===void 0?{}:{reverse_order:e.reverse},...e.gridline_color===void 0?{}:{gridline_color:u(e.gridline_color)},...e.line_color===void 0?{}:{line_color:u(e.line_color)}},S=e=>{if(!(e===void 0||e===!1))return e===!0?{show_value:!0}:{...e.value===void 0?{}:{show_value:e.value},...e.percentage===void 0?{}:{show_percentage:e.percentage},...e.category===void 0?{}:{show_category_name:e.category},...e.series===void 0?{}:{show_series_name:e.series},...e.format===void 0?{}:{number_format:e.format},...e.position===void 0?{}:{position:e.position},...e.size===void 0?{}:{size:e.size},...e.color===void 0?{}:{color:u(e.color)}}};function $(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e==null)return null;if(typeof e!="string")return;const i=e.trim();if(i==="")return null;const s=Number(i);return Number.isFinite(s)?s:void 0}export function chartOfFile(e,i){const s=S(e.labels),l=j(e.type);let a,c;const g=r=>({...r.color===void 0?{}:{color:u(r.color)},...r.format===void 0?{}:{number_format:r.format},...r.smooth===void 0?{}:{smooth:r.smooth},...r.line_width===void 0?{}:{line_width:r.line_width},...r.marker_size===void 0?{}:{marker_size:r.marker_size}});if(e.data!==void 0){let r;try{r=i.rows(e.data)}catch(t){i.problem(`${e.data} cannot be read: ${t instanceof Error?t.message:String(t)}`);return}if(!Array.isArray(r)||r.length===0){i.problem(`${e.data} holds no rows.`);return}const n=r,d=e.categories;if(typeof d!="string"){i.problem("with data, categories names its column.");return}const h=Object.keys(n[0]??{}),b=[d,...e.series.map(t=>typeof t=="string"?t:t.name)].filter(t=>!h.includes(t));if(b.length>0){i.problem(`${e.data} has no column ${b.join(", ")} (it has ${h.join(", ")}).`);return}a=n.map(t=>{const o=t[d];return typeof o=="string"||typeof o=="number"?String(o):""}),c=e.series.map(t=>{const o=typeof t=="string"?t:t.name,x=n.map((m,z)=>{const y=$(m[o]);return y===void 0?(i.problem(`${String(e.data)} row ${String(z+1)}: ${JSON.stringify(m[o])} in ${o} is not a number.`),null):y});return{name:o,values:x,...l?{x:n.map(m=>$(m[d])??null)}:{},...typeof t=="string"?{}:g(t)}})}else{if(typeof e.categories=="string"){i.problem("categories names a column, and there is no data to read.");return}if(e.categories===void 0&&!l){i.problem(`a ${e.type} chart has categories.`);return}a=e.categories??[];const r=[];for(const n of e.series){if(typeof n=="string"||!n.values){const d=typeof n=="string"?n:n.name;i.problem(`series ${d} has no values, and there is no data to read.`);return}if(l){if(n.x?.length!==n.values.length){i.problem(`series ${n.name} has an x for each of its values.`);return}}else n.values.length!==a.length&&i.problem(`series ${n.name} has ${String(n.values.length)} values for ${String(a.length)} categories.`);r.push({name:n.name,values:n.values,...l&&n.x?{x:n.x}:{},...g(n)})}c=r}const f=s?.position;f!==void 0&&!v(e.type).includes(f)&&i.problem(`a ${e.type} chart has no label position ${f}, which PowerPoint would repair (it has ${v(e.type).join(", ")||"none"}).`);const p=w(e.value_axis),_=w(e.category_axis);return{type:e.type,categories:a,series:c,...i.title===void 0?{}:{title:i.title},...e.legend===void 0?{}:{legend:e.legend},...s?{labels:s}:{},...e.gap_width===void 0?{}:{gap_width:e.gap_width},...e.overlap===void 0?{}:{overlap:e.overlap},...e.vary_by_categories===void 0?{}:{vary_by_categories:e.vary_by_categories},...e.hole_size===void 0?{}:{hole_size:e.hole_size},...p?{value_axis:p}:{},..._?{category_axis:_}:{},...e.size===void 0?{}:{font_size:e.size},...e.title_size===void 0?{}:{title_size:e.title_size},...e.color===void 0?{}:{font_color:u(e.color)},...e.data===void 0?{}:{source:O(i.base,e.data)}}}
|
|
@@ -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"]>;
|