@allyhub/sdk 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/define.d.ts +4 -0
- package/dist/define.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/dist/node/index.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/audio/dist/node/index.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/dist/node/master.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/audio/dist/node/master.js +1 -1
- package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
- package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +2 -2
- package/dist/node_modules/@allyhub-next/chart/dist/chart.d.ts +14 -5
- package/dist/node_modules/@allyhub-next/chart/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.d.ts +205 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/script.d.ts +4 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +69 -18
- 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 +847 -116
- package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/data/website.d.ts +20 -0
- package/dist/node_modules/@allyhub-next/formats/dist/data/website.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/media-type.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/formats/dist/media-type.js +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +501 -38
- package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/formats/dist/strict.js +1 -1
- package/dist/node_modules/@allyhub-next/formats/package.json +2 -1
- package/dist/node_modules/@allyhub-next/ooxml/LICENSE +241 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.d.ts +31 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/color.d.ts +33 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/color.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/enums.d.ts +13 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/enums.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ext.d.ts +79 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ext.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.d.ts +132 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.d.ts +4708 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.d.ts +57 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/index.d.ts +10 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/index.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/mce.d.ts +12 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/mce.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/node.d.ts +111 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/node.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ns.d.ts +45 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/ns.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/opc.d.ts +48 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/opc.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/report.d.ts +45 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/report.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/xml.d.ts +28 -0
- package/dist/node_modules/@allyhub-next/ooxml/dist/xml.js +2 -0
- package/dist/node_modules/@allyhub-next/ooxml/package.json +26 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/account.d.ts +338 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/account.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/auth.d.ts +12 -13
- package/dist/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/blobs.d.ts +35 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/blobs.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +101 -32
- package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +79 -5
- package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/files.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/protocol/dist/index.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +21 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/open.d.ts +13 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/open.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/registry.d.ts +73 -59
- package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/routes.d.ts +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/shares.d.ts +115 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/shares.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/sites.d.ts +293 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +396 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +2 -0
- package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +27 -9
- package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/dist/tools.d.ts +53 -14
- package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub-next/protocol/package.json +2 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/download.d.ts +19 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/download.js +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/index.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/runtimes/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/runtimes/dist/lock.js +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/dist/packages.d.ts +19 -2
- package/dist/node_modules/@allyhub-next/runtimes/dist/packages.js +3 -3
- package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -3
- package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +25 -5
- package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +9 -3
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +5 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +60 -13
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +27 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.d.ts +16 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +18 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.d.ts +38 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.d.ts +19 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.d.ts +49 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.d.ts +82 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +6 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +15 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +29 -8
- package/dist/node_modules/@allyhub-next/sheet/dist/export.js +3 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/file.js +2 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +8 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/format.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +52 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/html.js +43 -11
- package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +7 -3
- package/dist/node_modules/@allyhub-next/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/paginate.d.ts +98 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/paginate.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/table-style.d.ts +32 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-style.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.d.ts +3 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/values.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +10 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +10 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +14 -4
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +2 -2
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +11 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +36 -16
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +3 -1
- 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 +42 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.d.ts +23 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +2 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.d.ts +40 -0
- package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +2 -0
- package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +59 -39
- 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 +27 -13
- package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/check.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/code.d.ts +33 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/components.d.ts +31 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/components.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +179 -16
- package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/file.d.ts +43 -21
- package/dist/node_modules/@allyhub-next/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub-next/slides-core/dist/identity.d.ts +17 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/identity.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +5 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/lang.d.ts +6 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/lang.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/merge.d.ts +58 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +2 -4
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +17 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +21 -5
- package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/script.d.ts +18 -16
- package/dist/node_modules/@allyhub-next/slides-core/dist/script.js +2 -2
- package/dist/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +51 -53
- package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/units.d.ts +27 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/units.js +1 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/values.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/slides-core/dist/values.js +2 -0
- package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/captions.js +6 -6
- package/dist/node_modules/@allyhub-next/video-core/dist/fact.d.ts +47 -8
- package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/marks.d.ts +14 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/marks.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/music.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/piece.d.ts +11 -2
- package/dist/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/schema.d.ts +2 -2
- package/dist/node_modules/@allyhub-next/video-core/dist/schema.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/script.d.ts +2 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
- package/dist/node_modules/@allyhub-next/video-core/dist/source.d.ts +7 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/source.js +2 -0
- package/dist/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +10 -33
- package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/dist/slides.d.ts +3 -1
- package/dist/slides.js +1 -1
- package/docs/README.md +1 -0
- package/docs/contract.md +1 -1
- package/docs/defaults.md +2 -2
- package/docs/layers.md +1 -1
- package/docs/project.md +3 -1
- package/docs/sheets.md +7 -6
- package/docs/slides.md +16 -12
- package/docs/sound.md +1 -1
- package/docs/websites.md +57 -0
- package/package.json +3 -1
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.d.ts +0 -5
- package/dist/node_modules/@allyhub-next/slides-core/dist/preset.js +0 -2
package/dist/define.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export interface ComponentDefinition<P extends object> {
|
|
|
53
53
|
mount(el: HTMLElement, props: P, ctx: StageContext): void;
|
|
54
54
|
/** Sets everything that moves from `t` alone: seconds from the part's start. */
|
|
55
55
|
render(el: HTMLElement, t: number, props: P, ctx: StageContext): void;
|
|
56
|
+
/** Lets go of what mount made that the page does not free with `el` (a WebGL context, a worker, a timer): a deck mounts a slide's components when it is shown and unmounts them when it lets the slide go. */
|
|
57
|
+
unmount?(el: HTMLElement, props: P, ctx: StageContext): void;
|
|
56
58
|
}
|
|
57
59
|
/** A component: a function that makes a graphic layer from its props and the layer options. */
|
|
58
60
|
export type Component<P extends object> = ((...opts: Partial<Timed<P>> extends Timed<P> ? [opts?: LayerOptions & Timed<P>] : [opts: LayerOptions & Timed<P>]) => GraphicLayer<P>) & {
|
|
@@ -75,6 +77,8 @@ export interface CustomOptions extends LayerOptions {
|
|
|
75
77
|
mount?(el: HTMLElement, ctx: StageContext): void;
|
|
76
78
|
/** Sets everything that moves from `t` alone: seconds from the part's start. */
|
|
77
79
|
render(el: HTMLElement, t: number, ctx: StageContext): void;
|
|
80
|
+
/** Lets go of what mount made that the page does not free with `el` (a WebGL context, a worker, a timer). */
|
|
81
|
+
unmount?(el: HTMLElement, ctx: StageContext): void;
|
|
78
82
|
}
|
|
79
83
|
/** A graphic layer written directly in the output, for what no component does. */
|
|
80
84
|
export declare function custom(opts: CustomOptions): GraphicLayer;
|
package/dist/define.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{LAYER_BRAND as
|
|
2
|
+
import{LAYER_BRAND as a}from"@allyhub-next/video-core";export const LAYER_OPTIONS=["at","until","dur","z"];export function timeShape(n){const o=e=>{if(e.type==="time")return!0;if(e.type==="list")return o(e.of);if(e.type==="object")return timeShape(e.fields)},t={};for(const[e,r]of Object.entries(n)){const u=r?o(r):void 0;u!==void 0&&(t[e]=u)}return Object.keys(t).length>0?t:void 0}export function splitLayer(n){const{at:o,until:t,dur:e,z:r,...u}=n;return[{...o===void 0?{}:{at:o},...t===void 0?{}:{until:t},...e===void 0?{}:{dur:e},...r===void 0?{}:{z:r}},u]}export function defineComponent(n){const o=[...Object.keys(n.props??{}),...Object.keys(n.defaults??{}),...Object.values(n.examples??{}).flatMap(s=>Object.keys(s))],t=[...new Set(o.filter(s=>LAYER_OPTIONS.includes(s)))];if(t.length>0)throw new Error(`${n.name}: ${t.join(", ")} is a layer option, not a prop name`);const e=timeShape(n.props??{}),r=s=>{const[c,l]=splitLayer(s??{}),d={...n.defaults,...l};return{[a]:"graphic",...c,component:n.name,props:d,...e?{times:e}:{},mount:(i,p,m)=>{n.mount(i,p,m)},render:(i,p,m,f)=>{n.render(i,p,m,f)},unmount:(i,p,m)=>{n.unmount?.(i,p,m)}}},u={name:n.name,label:n.label??n.name,...n.summary===void 0?{}:{summary:n.summary},props:Object.fromEntries(Object.entries(n.props??{}).filter(s=>s[1]!==void 0)),examples:n.examples??{},hidden:n.hidden??!1};return Object.assign(r,{componentName:n.name,info:u})}export function custom(n){const[o]=splitLayer(n);return{[a]:"graphic",...o,component:"custom",props:{},mount:(t,e,r)=>{n.mount?.(t,r)},render:(t,e,r,u)=>{n.render(t,e,u)},unmount:(t,e,r)=>{n.unmount?.(t,r)}}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AudioError, FFMPEG_LOG, ffmpegOf, runFfmpeg, type AudioErrorCode, type FfmpegOptions, } from "./ffmpeg.js";
|
|
2
2
|
export { decodeMono, decodePlan, decodeStereo, denoiseFilter, speechFile, speechFilters, type MixSources, } from "./decode.js";
|
|
3
3
|
export { mixToSamples, voiceTracks, type VoiceTracks } from "./mix.js";
|
|
4
|
-
export { master, type Mastered, type Measured } from "./master.js";
|
|
4
|
+
export { loudestAt, master, type Mastered, type Measured } from "./master.js";
|
|
5
5
|
export { fileLoudness, type FileLoudness } from "./loudness.js";
|
|
6
6
|
export { ebur128Summary, parseEbur128, type LoudnessFrame, type LoudnessSummary, } from "./ebur128.js";
|
|
7
7
|
export { ANALYZE_DEFAULTS, analyzeSound, parseAstats, parseSilences, spanLoudness, type AnalyzeOptions, type Silence, type SoundAnalysis, } from "./measure.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export{AudioError,FFMPEG_LOG,ffmpegOf,runFfmpeg}from"./ffmpeg.js";export{decodeMono,decodePlan,decodeStereo,denoiseFilter,speechFile,speechFilters}from"./decode.js";export{mixToSamples,voiceTracks}from"./mix.js";export{master}from"./master.js";export{fileLoudness}from"./loudness.js";export{ebur128Summary,parseEbur128}from"./ebur128.js";export{ANALYZE_DEFAULTS,analyzeSound,parseAstats,parseSilences,spanLoudness}from"./measure.js";
|
|
2
|
+
export{AudioError,FFMPEG_LOG,ffmpegOf,runFfmpeg}from"./ffmpeg.js";export{decodeMono,decodePlan,decodeStereo,denoiseFilter,speechFile,speechFilters}from"./decode.js";export{mixToSamples,voiceTracks}from"./mix.js";export{loudestAt,master}from"./master.js";export{fileLoudness}from"./loudness.js";export{ebur128Summary,parseEbur128}from"./ebur128.js";export{ANALYZE_DEFAULTS,analyzeSound,parseAstats,parseSilences,spanLoudness}from"./measure.js";
|
|
@@ -19,11 +19,15 @@ export interface Mastered {
|
|
|
19
19
|
* would have made, less the ceiling (0 where it did not touch it).
|
|
20
20
|
*/
|
|
21
21
|
limited?: number;
|
|
22
|
+
/** Seconds into the mix of that peak, when the limiter took something. */
|
|
23
|
+
limitedAt?: number;
|
|
22
24
|
/** What it was asked for. */
|
|
23
25
|
target: MasterTargets;
|
|
24
26
|
/** Rounds of gain, limiting and measuring it took. */
|
|
25
27
|
rounds?: number;
|
|
26
28
|
}
|
|
29
|
+
/** Seconds into an interleaved stereo mix of its loudest sample. */
|
|
30
|
+
export declare function loudestAt(mix: Float32Array): number;
|
|
27
31
|
/**
|
|
28
32
|
* Writes an interleaved stereo mix at 48 kHz mastered to `targets.lufs`
|
|
29
33
|
* (default −14) with its true peak at most `targets.truePeak` dBTP
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{rm as
|
|
2
|
+
import{rm as F,writeFile as P}from"node:fs/promises";import{MASTER_DEFAULTS as v,MASTER_MECHANICS as T}from"../levels.js";import{SAMPLE_RATE as x}from"../plan.js";import{ebur128Summary as _}from"./ebur128.js";import{ffmpegOf as R,runFfmpeg as w}from"./ffmpeg.js";const s=x;export function loudestAt(e){let a=0,r=0;for(let t=0;t<e.length;t++){const u=Math.abs(e[t]??0);u>r&&(r=u,a=t)}return Math.floor(a/2)/s}async function D(e,a,r){const{err:t}=await w(e,["-hide_banner","-nostats",...a,"-af",`${r}${r?",":""}ebur128=peak=true:framelog=quiet`,"-f","null","-"]);return _(t)}const k=e=>({integrated:e.integrated,...e.range===void 0?{}:{range:e.range},...e.truePeak===void 0?{}:{truePeak:e.truePeak}});export async function master(e,a,r,t={...v},u={}){const c=await R(u),m=`${r}.f32`;await P(m,new Uint8Array(e.buffer,e.byteOffset,e.byteLength));try{const g=["-f","f32le","-ar",String(s),"-ac","2","-i",m],$=`aresample=${String(s)}:in_chlayout=stereo:out_chlayout=stereo`,h=`apad=whole_dur=${a.toFixed(6)},atrim=0:${a.toFixed(6)}`,n=await D(c,g,$);if(n.integrated===void 0)return await w(c,["-v","error","-y",...g,"-af",h,"-c:a","pcm_s16le",r]),{target:t};const y=t.truePeak,A=10**(y/20),f=T,M=`aresample=${String(s*f.oversample)},aformat=sample_fmts=dbl:channel_layouts=stereo,alimiter=limit=${A.toFixed(4)}:level=false:attack=${String(f.attack*1e3)}:release=${String(f.release*1e3)},aresample=${String(s)},${h}`,S=async o=>{const{err:E}=await w(c,["-hide_banner","-nostats","-y",...g,"-af",`${$},volume=${o.toFixed(4)}dB:precision=double,${M},ebur128=peak=true:framelog=quiet`,"-c:a","pcm_s16le",r]);return _(E)};let l=t.lufs===!1?0:t.lufs-n.integrated,i=await S(l),p=1;if(t.lufs!==!1)for(;p<f.rounds&&i.integrated!==void 0;){const o=t.lufs-i.integrated;if(Math.abs(o)<=f.tolerance)break;l+=o,i=await S(l),p++}const d=n.truePeak===void 0?void 0:Math.max(0,n.truePeak+l-y),b=o=>Math.round(o*100)/100;return{...i.integrated===void 0?{}:{loudness:k({...i,integrated:i.integrated})},before:k({...n,integrated:n.integrated}),gainDb:b(l),...d===void 0?{}:{limited:b(d)},...d===void 0||d<=0?{}:{limitedAt:b(loudestAt(e))},target:t,rounds:p}}finally{await F(m,{force:!0})}}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{accentOf as j,CHART_DEFAULTS as d,chartDrawing as D,groupingOf as z,hasLines as E,hasMarkers as N,isArea as R,isBar as
|
|
3
|
-
`,
|
|
2
|
+
import{lumOf as X}from"@allyhub-next/ooxml/brightness";import{accentOf as j,CHART_DEFAULTS as d,chartDrawing as D,groupingOf as z,hasLines as E,hasMarkers as N,isArea as R,isBar as C,isHorizontal as T,isLine as k,isRound as h,isScatter as P,labelPositionOf as U,variesOf as w}from"./chart.js";const V="http://schemas.openxmlformats.org/drawingml/2006/chart",B="http://schemas.openxmlformats.org/drawingml/2006/main",W="http://schemas.openxmlformats.org/officeDocument/2006/relationships",H=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
|
+
`,y="2118791784",x="2140495176",Z={"&":"&","<":"<",">":">",'"':"""},q=e=>{const n=e.charCodeAt(0);return n<32&&n!==9&&n!==10&&n!==13||n===65534||n===65535},l=e=>Array.from(e,n=>q(n)?"":Z[n]??n).join("");function r(e,n={},...c){const o=Object.entries(n).filter(([,s])=>s!==void 0).map(([s,i])=>` ${s}="${l(typeof i=="boolean"?i?"1":"0":String(i))}"`).join(""),a=c.join("");return a===""?`<${e}${o}/>`:`<${e}${o}>${a}</${e}>`}const K=e=>{if(typeof e=="string")return r("a:schemeClr",{val:e});if("rgb"in e)return r("a:srgbClr",{val:e.rgb.replace("#","").toUpperCase()});const{lumMod:n,lumOff:c}=X(e.brightness);return r("a:schemeClr",{val:e.theme_color},t("a:lumMod",n),...c===void 0?[]:[t("a:lumOff",c)])},f=e=>e===null?r("a:noFill"):r("a:solidFill",{},K(e)),t=(e,n)=>r(e,{val:typeof n=="boolean"?n?1:0:n}),m=(e,n)=>r("a:ln",n===void 0?{}:{w:Math.round(n*12700)},f(e)),O=(e,n)=>r("c:txPr",{},r("a:bodyPr"),r("a:lstStyle"),r("a:p",{},r("a:pPr",{},r("a:defRPr",e===void 0?{}:{sz:Math.round(e*100)},n===void 0?"":f(n))),r("a:endParaRPr",{lang:"en-US"}))),S=e=>r("c:strCache",{},t("c:ptCount",e.length),...e.map((n,c)=>r("c:pt",{idx:c},`<c:v>${l(n)}</c:v>`))),A=(e,n)=>r("c:numCache",{},`<c:formatCode>${l(e??"General")}</c:formatCode>`,t("c:ptCount",n.length),...n.flatMap((c,o)=>c===null?[]:[r("c:pt",{idx:o},`<c:v>${String(c)}</c:v>`)])),Y=(e,n)=>r("c:tx",{},n===void 0?`<c:v>${l(e.name)}</c:v>`:r("c:strRef",{},`<c:f>${l(n)}</c:f>`,S([e.name]))),J=(e,n)=>n===void 0?"":r("c:xVal",{},r("c:numRef",{},`<c:f>${l(n)}</c:f>`,A("General",e.x??[])));function Q(e,n,c,o){const a=n.color??j(c),s=h(e.type),i=P(e.type),u=k(e.type)||i,g=N(e.type),I=u?r("c:spPr",{},E(e.type)?m(a,n.line_width??d.lineWidth):r("a:ln",{w:19050},f(null))):r("c:spPr",{},f(a),s?m("lt1",1):""),_=o.categories;return r("c:ser",{},t("c:idx",c),t("c:order",c),Y(n,o.name(c)),I,C(e.type)?t("c:invertIfNegative",!1):"",u?r("c:marker",{},t("c:symbol",g?"circle":"none"),g?t("c:size",n.marker_size??d.marker):"",g?r("c:spPr",{},f(a),m(a)):""):"",...w(e)&&!u&&!R(e.type)?e.categories.map((v,p)=>r("c:dPt",{},t("c:idx",p),C(e.type)?t("c:invertIfNegative",!1):"",t("c:bubble3D",!1),r("c:spPr",{},f(j(p)),s?m("lt1",1):""))):[],i?J(n,o.x?.(c)):_===void 0?"":r("c:cat",{},o.numeric===!0?r("c:numRef",{},`<c:f>${l(_)}</c:f>`,A("General",e.categories.map(v=>{const p=Number(v);return v===""||!Number.isFinite(p)?null:p}))):r("c:strRef",{},`<c:f>${l(_)}</c:f>`,S(e.categories))),r(i?"c:yVal":"c:val",{},r("c:numRef",{},`<c:f>${l(o.values(c))}</c:f>`,A(n.number_format,n.values))),u?t("c:smooth",n.smooth===!0||e.type==="scatter-smooth"):"")}function b(e){const n=e.labels;if(!n)return"";const c=n.show_percentage===!0,o=U(e);return r("c:dLbls",{},n.number_format===void 0?"":r("c:numFmt",{formatCode:n.number_format,sourceLinked:0}),n.size===void 0&&n.color===void 0&&!h(e.type)?"":O(n.size,n.color??(h(e.type)?"lt1":void 0)),o===void 0?"":t("c:dLblPos",o),t("c:showLegendKey",!1),t("c:showVal",n.show_value??!c),t("c:showCatName",n.show_category_name===!0),t("c:showSerName",n.show_series_name===!0),t("c:showPercent",c),t("c:showBubbleSize",!1))}function ee(e,n){const c=e.series.map((s,i)=>Q(e,s,i,n)).join(""),o=z(e.type),a=t("c:axId",y)+t("c:axId",x);if(h(e.type)){const s=e.type==="pie";return r(s?"c:pieChart":"c:doughnutChart",{},t("c:varyColors",w(e)),c,b(e),t("c:firstSliceAng",0),s?"":t("c:holeSize",e.hole_size??50))}if(P(e.type))return r("c:scatterChart",{},t("c:scatterStyle","lineMarker"),t("c:varyColors",!1),c,b(e),a);if(C(e.type)){const s=o!=="clustered";return r("c:barChart",{},t("c:barDir",T(e.type)?"bar":"col"),t("c:grouping",o),t("c:varyColors",w(e)),c,b(e),t("c:gapWidth",e.gap_width??150),e.overlap!==void 0||s?t("c:overlap",e.overlap??100):"",a)}return r(k(e.type)?"c:lineChart":"c:areaChart",{},t("c:grouping",o),t("c:varyColors",!1),c,b(e),k(e.type)?t("c:marker",!0):"",a)}const L=e=>r("c:scaling",{},t("c:orientation",e.reverse_order===!0?"maxMin":"minMax"),e.maximum_scale===void 0?"":t("c:max",e.maximum_scale),e.minimum_scale===void 0?"":t("c:min",e.minimum_scale)),F=e=>r("c:spPr",{},m(e.line_color??{rgb:d.axisLine},d.gridWidth)),M=e=>e.has_major_gridlines===!0?r("c:majorGridlines",{},r("c:spPr",{},m(e.gridline_color??{rgb:d.gridline},d.gridWidth))):"",G=(e,n)=>r("c:rich",{},r("a:bodyPr"),r("a:lstStyle"),r("a:p",{},r("a:pPr",{},r("a:defRPr",{sz:n,b:0})),r("a:r",{},r("a:rPr",{lang:"en-US",sz:n,b:0}),`<a:t>${l(e)}</a:t>`))),$=(e,n)=>e===void 0||e===""?"":r("c:title",{},r("c:tx",{},G(e,n)),t("c:overlay",!1));function te(e){if(h(e.type))return"";const n=P(e.type),c=T(e.type),o=e.category_axis??{},a={has_major_gridlines:!0,...e.value_axis},s=z(e.type)==="percentStacked",i=a.number_format??(s?"0%":e.series[0]?.number_format??"General"),u=Math.round((e.font_size??d.fontSize)*100);return(n?r("c:valAx",{},t("c:axId",y),L(o),t("c:delete",o.visible===!1),t("c:axPos","b"),M(o),$(o.title,u),r("c:numFmt",{formatCode:o.number_format??"General",sourceLinked:o.number_format===void 0?1:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),F(o),t("c:crossAx",x),t("c:crosses","autoZero"),t("c:crossBetween","midCat"),o.major_unit===void 0?"":t("c:majorUnit",o.major_unit)):r("c:catAx",{},t("c:axId",y),L(o),t("c:delete",o.visible===!1),t("c:axPos",c?"l":"b"),M(o),$(o.title,u),r("c:numFmt",{formatCode:"General",sourceLinked:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),F(o),t("c:crossAx",x),t("c:crosses","autoZero"),t("c:auto",!0),t("c:lblAlgn","ctr"),t("c:lblOffset",100),t("c:noMultiLvlLbl",!1)))+r("c:valAx",{},t("c:axId",x),L(a),t("c:delete",a.visible===!1),t("c:axPos",c?"b":"l"),M(a),$(a.title,u),r("c:numFmt",{formatCode:i,sourceLinked:a.number_format===void 0&&!s?1:0}),t("c:majorTickMark","none"),t("c:minorTickMark","none"),t("c:tickLblPos","nextTo"),r("c:spPr",{},m(null)),t("c:crossAx",y),t("c:crosses","autoZero"),t("c:crossBetween",R(e.type)||n?"midCat":"between"),a.major_unit===void 0?"":t("c:majorUnit",a.major_unit))}const ne={bottom:"b",top:"t",left:"l",right:"r"};function re(e,n){const c=n.width,o=n.height,{plot:a}=D(e,c,o),s=i=>Number(i.toFixed(5));return r("c:layout",{},r("c:manualLayout",{},t("c:layoutTarget","inner"),t("c:xMode","edge"),t("c:yMode","edge"),t("c:x",s(a.x/c)),t("c:y",s(a.y/o)),t("c:w",s(a.width/c)),t("c:h",s(a.height/o))))}export function chartSpaceXml(e,n){const c=e.title!==void 0&&e.title!==""?e.title:void 0,o=e.font_size??d.fontSize,a=Math.round((e.title_size??o*d.titleScale)*100);return H+r("c:chartSpace",{"xmlns:c":V,"xmlns:a":B,"xmlns:r":W},t("c:date1904",!1),t("c:roundedCorners",!1),r("c:chart",{},c===void 0?"":r("c:title",{},r("c:tx",{},n.titleRef===void 0?G(c,a):r("c:strRef",{},`<c:f>${l(n.titleRef)}</c:f>`,S([c]))),t("c:overlay",!1)),t("c:autoTitleDeleted",c===void 0),r("c:plotArea",{},n.frame?re(e,n.frame):r("c:layout"),ee(e,n.refs),te(e)),e.legend===void 0?"":r("c:legend",{},t("c:legendPos",ne[e.legend]),t("c:overlay",e.legend_overlay===!0)),t("c:plotVisOnly",n.plotVisible??!0),t("c:dispBlanksAs","gap")),O(o,e.font_color??"dk1"),n.tail??"")}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import type { ChartLegendPosition, SheetChartType, ThemeColor } from "@allyhub-next/formats";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { ChartLegendPosition, Color, SheetChartType, ThemeColor } from "@allyhub-next/formats";
|
|
2
|
+
export type { Color };
|
|
3
|
+
/** A theme colour at a brightness: its name alone at 0. */
|
|
4
|
+
export declare const themeColor: (theme_color: ThemeColor, brightness?: number) => Color;
|
|
5
|
+
/** The theme colour a colour is, at any brightness. */
|
|
6
|
+
export declare const themeColorOf: (c: Color) => ThemeColor | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* A colour as it is drawn, against the theme in force: a theme colour's
|
|
9
|
+
* value, lighter or darker by its brightness as PowerPoint makes it, or its
|
|
10
|
+
* own. Every colour drawn or measured comes through here.
|
|
11
|
+
*/
|
|
12
|
+
export declare function colorRgb(c: Color, colors: Readonly<Record<ThemeColor, string>>): string;
|
|
6
13
|
/** The kinds a chart is drawn as: a slide's and a sheet's (which adds scatter). */
|
|
7
14
|
export type ChartKind = SheetChartType;
|
|
8
15
|
/** Where a data label sits (`c:dLblPos`). */
|
|
@@ -60,6 +67,8 @@ export interface ChartDef {
|
|
|
60
67
|
title?: string;
|
|
61
68
|
/** Where its legend is; absent: it has none. */
|
|
62
69
|
legend?: ChartLegendPosition;
|
|
70
|
+
/** Its legend drawn over the plot, the plot not made smaller for it (python-pptx's include_in_layout false, `c:overlay`). */
|
|
71
|
+
legend_overlay?: boolean;
|
|
63
72
|
/** Its data labels; absent: it has none. */
|
|
64
73
|
labels?: ChartLabelsDef;
|
|
65
74
|
/** Between bars' groups, as a share of a bar's width, in %. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{format as Lt,isValidFormat as jt}from"numfmt";export const CHART_DEFAULTS={fontSize:12,titleScale:1.2,gapWidth:150,holeSize:50,margin:6,gridline:"#D9D9D9",axisLine:"#BFBFBF",letter:.55,lineWidth:2.25,gridWidth:.75,marker:5};const bt=["accent1","accent2","accent3","accent4","accent5","accent6"];export const accentOf=t=>bt[t%bt.length]??"accent1",isBar=t=>t.startsWith("column")||t.startsWith("bar"),isHorizontal=t=>t.startsWith("bar"),isLine=t=>t.startsWith("line"),isArea=t=>t.startsWith("area"),isRound=t=>t==="pie"||t==="doughnut",isScatter=t=>t.startsWith("scatter"),hasLines=t=>!isScatter(t)||t!=="scatter",hasMarkers=t=>t==="line-markers"||t==="scatter"||t==="scatter-lines",groupingOf=t=>t.endsWith("-100")?"percentStacked":t.endsWith("-stacked")?"stacked":isBar(t)?"clustered":"standard";export function labelPositionsOf(t){return isArea(t)||t==="doughnut"?[]:t==="pie"?["bestFit","outEnd","inEnd","ctr"]:isLine(t)||isScatter(t)?["t","b","l","r","ctr"]:groupingOf(t)==="clustered"?["outEnd","inEnd","ctr","inBase"]:["inEnd","ctr","inBase"]}export function labelPositionOf(t){const a=labelPositionsOf(t.type),l=t.labels?.position;if(l!==void 0&&a.includes(l))return l;if(a.length!==0)return t.type==="pie"?"ctr":isLine(t.type)||isScatter(t.type)?"t":groupingOf(t.type)==="clustered"?"outEnd":"ctr"}export const variesOf=t=>t.vary_by_categories??isRound(t.type);export function formatValue(t,a="General"){return a==="General"||!jt(a)?String(Number(t.toPrecision(10))):Lt(a,t)}const Ct=[1,2,5,10];export function chartScale(t,a,l,s,e={}){const h=t>0&&(a-t)/a<.16666666666666666?t:Math.min(t,0),i=a<=0&&t<0?0:a,o=e.minimum_scale??h,C=e.maximum_scale??i,_=C>o?C-o:1,F=Math.max(1,Math.floor(l/s)),b=_/F,P=10**Math.floor(Math.log10(b)),B=e.major_unit??(Ct.find(E=>E*P>=b)??10)*P,N=(E,L)=>Number((L(Number((E/B).toFixed(9)))*B).toPrecision(12)),Z=i>0?i+_*.05:i===h?_:i,g=e.maximum_scale??N(Z,Math.ceil),R=h<0?h-_*.05:h,W=e.minimum_scale??N(R,Math.floor),O=[],x=Math.round((g-W)/B);for(let E=0;E<=x;E++)O.push(Number((W+E*B).toPrecision(12)));return{min:W,max:g,major:B,ticks:O}}const it=(t,a)=>{let l=0;for(const s of t)l+=(s.codePointAt(0)??0)>11903?1:CHART_DEFAULTS.letter;return l*a},d=t=>String(Number(t.toFixed(3)));function $t(t){const a=l=>t[Math.max(0,Math.min(t.length-1,l))]??[0,0];return t.map(([l,s],e)=>{if(e===0)return`M${d(l)} ${d(s)}`;const[h,i]=a(e-2),[o,C]=a(e-1),[_,F]=a(e+1),b=`${d(o+(l-h)/6)} ${d(C+(s-i)/6)}`,P=`${d(l-(_-o)/6)} ${d(s-(F-C)/6)}`;return`C${b} ${P} ${d(l)} ${d(s)}`}).join(" ")}const lt=t=>t.map(([a,l],s)=>`${s===0?"M":"L"}${d(a)} ${d(l)}`).join(" ");function Ft(t,a,l,s,e,h){const i=(F,b)=>`${d(t+F*Math.sin(b))} ${d(a-F*Math.cos(b))}`,o=h-e>=Math.PI*2?e+Math.PI*2-1e-4:h,C=o-e>Math.PI?1:0,_=`M${i(l,e)} A${d(l)} ${d(l)} 0 ${String(C)} 1 ${i(l,o)}`;return s<=0?`${_} L${d(t)} ${d(a)} Z`:`${_} L${i(s,o)} A${d(s)} ${d(s)} 0 ${String(C)} 0 ${i(s,e)} Z`}function vt(t,a,l,s){const e=s*1.5;return a!==void 0&&a!==""&&(t.bottom-=e),l!==void 0&&l!==""&&(t.left+=e),{x:t.left-e/2,y:t.bottom+e/2}}function kt(t,a,l,s,e,h,i){s!==void 0&&s!==""&&t.words.push({x:a.x+a.width/2,y:l.y,text:s,size:h,anchor:"middle",color:i}),e!==void 0&&e!==""&&t.words.push({x:l.x,y:a.y+a.height/2,text:e,size:h,anchor:"middle",color:i,rotate:-90})}const ht=(t,a,l,s,e)=>{const h=t.labels;if(!h)return"";const i=isRound(t.type),o=[];return h.show_series_name&&o.push(s.name),h.show_category_name&&o.push(e),(h.show_value??!(h.show_percentage??!1))&&o.push(formatValue(a,h.number_format??s.number_format)),h.show_percentage&&i&&o.push(formatValue(l,h.number_format??"0%")),o.join(", ")};function Bt(t,a,l,s,e){const h=CHART_DEFAULTS,i=t.category_axis??{},o=t.value_axis??{},C=vt(l,i.title,o.title,s),_=t.series.map(c=>c.values.flatMap(($,H)=>{const I=c.x?.[H]??(c.x?null:H+1);return I===null||$===null?[]:[[I,$]]})),F=_.flat().map(c=>c[0]),b=_.flat().map(c=>c[1]),P=c=>c.length>0?Math.min(...c):0,B=c=>c.length>0?Math.max(...c):1,N=o.number_format??t.series[0]?.number_format??"General",Z=i.number_format??"General",g=s*.5,R=chartScale(P(b),B(b),l.bottom-l.top,s*2.4,o),W=o.visible===!1?0:Math.max(0,...R.ticks.map(c=>it(formatValue(c,N),s)))+g,O=i.visible===!1?0:s*1.2+g,x={x:l.left+W,y:l.top,width:l.right-l.left-W,height:l.bottom-l.top-O};a.plot=x,kt(a,x,C,i.title,o.title,s,e);const E=chartScale(P(F),B(F),x.width,s*5,i),L=chartScale(P(b),B(b),x.height,s*2.4,o),z=c=>x.x+(Math.min(E.max,Math.max(E.min,c))-E.min)/(E.max-E.min)*x.width,D=c=>x.y+x.height-(Math.min(L.max,Math.max(L.min,c))-L.min)/(L.max-L.min)*x.height;for(const c of L.ticks){const $=D(c);(o.has_major_gridlines??!0)&&a.grid.push({d:`M${d(x.x)} ${d($)} H${d(x.x+x.width)}`,color:o.gridline_color??{rgb:h.gridline},width:h.gridWidth}),o.visible!==!1&&a.words.push({x:x.x-g,y:$,text:formatValue(c,N),size:s,anchor:"end",color:e})}for(const c of E.ticks){const $=z(c);i.has_major_gridlines===!0&&a.grid.push({d:`M${d($)} ${d(x.y)} V${d(x.y+x.height)}`,color:i.gridline_color??{rgb:h.gridline},width:h.gridWidth}),i.visible!==!1&&a.words.push({x:$,y:x.y+x.height+g+s*.6,text:formatValue(c,Z),size:s,anchor:"middle",color:e})}a.axes.push({d:`M${d(x.x)} ${d(D(Math.max(L.min,Math.min(L.max,0))))} H${d(x.x+x.width)}`,color:i.line_color??{rgb:h.axisLine},width:h.gridWidth}),t.series.forEach((c,$)=>{const H=c.color??accentOf($),I=(_[$]??[]).map(([U,Y])=>[z(U),D(Y)]);if(I.length!==0&&(hasLines(t.type)&&a.lines.push({d:t.type==="scatter-smooth"||c.smooth===!0?$t(I):lt(I),color:H,width:c.line_width??h.lineWidth,series:$}),hasMarkers(t.type)))for(const[U,Y]of I)a.dots.push({x:U,y:Y,r:(c.marker_size??h.marker)/2,color:H})})}export function chartDrawing(t,a,l){const s=CHART_DEFAULTS,e=t.font_size??s.fontSize,h=t.font_color??"dk1",i={grid:[],shapes:[],boxes:[],lines:[],axes:[],dots:[],keys:[],words:[],plot:{x:0,y:0,width:0,height:0}},o={left:s.margin,top:s.margin,right:a-s.margin,bottom:l-s.margin};if(t.title!==void 0&&t.title!==""){const n=t.title_size??e*s.titleScale;i.words.push({x:a/2,y:o.top+n*.7,text:t.title,size:n,anchor:"middle",color:h}),o.top+=n*1.6}const C=isRound(t.type),_=variesOf(t),F=(n,m)=>_?accentOf(m):t.series[n]?.color??accentOf(n);if(t.legend!==void 0){const n=_?t.categories:t.series.map(p=>p.name),m=e*.6,f=e*.4,r=e*1.5,y=n.map(p=>m+f+it(p,e)),S=(p,M,w)=>{i.keys.push({x:M,y:w-m/2,width:m,height:m,color:_?accentOf(p):t.series[p]?.color??accentOf(p),series:_?0:p,category:_?p:0}),i.words.push({x:M+m+f,y:w,text:n[p]??"",size:e,anchor:"start",color:h})};if(t.legend==="top"||t.legend==="bottom"){const p=y.reduce((A,v)=>A+v,0)+e*(n.length-1),M=t.legend==="top"?o.top+r/2:o.bottom-r/2;let w=(a-p)/2;n.forEach((A,v)=>{S(v,w,M),w+=(y[v]??0)+e}),t.legend==="top"?o.top+=r:o.bottom-=r}else{const p=Math.max(0,...y),M=t.legend==="left"?o.left:o.right-p,w=(o.top+o.bottom-r*n.length)/2+r/2;n.forEach((A,v)=>{S(v,M,w+v*r)}),t.legend==="left"?o.left+=p+e:o.right-=p+e}}const b=t.labels,P=b?.size??e,B=b?.color??h,N=(n,m,f,r,y=B)=>{f!==""&&i.words.push({x:n,y:m,text:f,size:P,anchor:r,color:y})};if(C){const n=t.series[0],m=(n?.values??[]).map(w=>Math.max(0,w??0)),f=m.reduce((w,A)=>w+A,0),r=Math.max(0,Math.min(o.right-o.left,o.bottom-o.top)/2),y=(o.left+o.right)/2,S=(o.top+o.bottom)/2,p=t.type==="doughnut"?r*((t.hole_size??s.holeSize)/100):0;i.plot={x:y-r,y:S-r,width:r*2,height:r*2};let M=0;return m.forEach((w,A)=>{const v=f>0?w/f:0,V=M+v*Math.PI*2;if(v>0){i.shapes.push({d:Ft(y,S,r,p,M,V),color:"lt1",width:1,fill:F(0,A),series:0,category:A});const j=(M+V)/2,k=p>0?(r+p)/2:labelPositionOf(t)==="inEnd"?r*.85:r*.6;n&&N(y+k*Math.sin(j),S-k*Math.cos(j),ht(t,w,v,n,t.categories[A]??""),"middle",b?.color??"lt1")}M=V}),i}if(isScatter(t.type))return Bt(t,i,o,e,h),i;const Z=Math.max(1,t.categories.length),g=isHorizontal(t.type),R=groupingOf(t.type),W=R!=="clustered"&&R!=="standard",O=R==="percentStacked",x=t.series.map(n=>t.categories.map((m,f)=>n.values[f]??null)),E=t.categories.map((n,m)=>x.reduce((f,r)=>f+Math.abs(r[m]??0),0)),L=(n,m)=>{const f=x[n]?.[m];if(f==null)return null;const r=E[m]??0;return O?r>0?f/r:0:f};let z=0,D=0;if(t.categories.forEach((n,m)=>{let f=0,r=0;t.series.forEach((y,S)=>{const p=L(S,m)??0;W?p>=0?f+=p:r+=p:(f=Math.max(f,p),r=Math.min(r,p))}),D=Math.max(D,f),z=Math.min(z,r)}),!W){const n=x.flat().filter(m=>m!==null);n.length>0&&Math.min(...n)>0&&(z=Math.min(...n))}O&&(D=1,z=Math.min(z,0));const c=t.value_axis??{},$=t.category_axis??{},H=c.number_format??(O?"0%":t.series[0]?.number_format??"General"),I=g?o.right-o.left:o.bottom-o.top,U=g?e*5:e*2.4,Y=chartScale(z,D,I,U,{...c,...O?{maximum_scale:c.maximum_scale??1}:{}}),Wt=c.visible===!1?[]:Y.ticks.map(n=>formatValue(n,H)),Et=Math.max(0,...Wt.map(n=>it(n,e))),ot=$.visible!==!1,dt=ot?Math.max(0,...t.categories.map(n=>it(n,e))):0,T=e*.5,mt=g?c.title:$.title,ft=g?$.title:c.title,St=vt(o,mt,ft,e),u=g?{x:o.left+(ot?dt+T:0),y:o.top,width:0,height:o.bottom-o.top-(c.visible===!1?0:e*1.2+T)}:{x:o.left+(c.visible===!1?0:Et+T),y:o.top,width:0,height:o.bottom-o.top-(ot?e*1.2+T:0)};u.width=o.right-u.x,i.plot=u,kt(i,u,St,mt,ft,e,h);const G=chartScale(z,D,g?u.width:u.height,U,{...c,...O?{maximum_scale:c.maximum_scale??1}:{}}),ut=n=>(Math.min(G.max,Math.max(G.min,n))-G.min)/(G.max-G.min)*(g?u.width:u.height),q=n=>g?u.x+ut(n):u.y+u.height-ut(n),pt=isArea(t.type),gt=$.reverse_order===!0,xt=g?!gt:gt,at=(g?u.height:u.width)/Z,yt=pt?(g?u.height:u.width)/Math.max(1,Z-1):at,ct=n=>{const m=pt?n*yt:(n+.5)*at,f=g?u.height:u.width,r=xt?f-m:m;return(g?u.y:u.x)+r},Mt=q(Math.max(G.min,Math.min(G.max,0)));for(const n of G.ticks){const m=q(n);(c.has_major_gridlines??!0)&&i.grid.push({d:g?`M${d(m)} ${d(u.y)} V${d(u.y+u.height)}`:`M${d(u.x)} ${d(m)} H${d(u.x+u.width)}`,color:c.gridline_color??{rgb:s.gridline},width:s.gridWidth}),c.visible!==!1&&i.words.push(g?{x:m,y:u.y+u.height+T+e*.6,text:formatValue(n,H),size:e,anchor:"middle",color:h}:{x:u.x-T,y:m,text:formatValue(n,H),size:e,anchor:"end",color:h})}if(i.axes.push({d:g?`M${d(Mt)} ${d(u.y)} V${d(u.y+u.height)}`:`M${d(u.x)} ${d(Mt)} H${d(u.x+u.width)}`,color:$.line_color??{rgb:s.axisLine},width:s.gridWidth}),ot){const n=g?e*1.3:dt+e,m=Math.max(1,Math.ceil(n/Math.max(1,yt)));t.categories.forEach((f,r)=>{if(r%m!==0)return;const y=ct(r);i.words.push(g?{x:u.x-T,y,text:f,size:e,anchor:"end",color:h}:{x:y,y:u.y+u.height+T+e*.6,text:f,size:e,anchor:"middle",color:h})})}if(isBar(t.type)){const n=(t.gap_width??s.gapWidth)/100,m=W?1:t.series.length,f=W?1:(t.overlap??0)/100,r=at/(Math.max(1,m-(m-1)*f)+n),y=r*(1-f),S=r+y*(m-1);t.categories.forEach((p,M)=>{const w=ct(M);let A=0,v=0;t.series.forEach((V,j)=>{const k=L(j,M);if(k===null)return;const nt=W?k>=0?A:v:0,tt=nt+k;W&&(k>=0?A=tt:v=tt);const J=q(nt),K=q(tt),st=(W?w-r/2:w-S/2+j*y)+(g&&xt&&!W?S-r-2*j*y:0),Pt=g?{x:Math.min(J,K),y:st,width:Math.abs(K-J),height:r}:{x:st,y:Math.min(J,K),width:r,height:Math.abs(K-J)};if(i.boxes.push({...Pt,color:F(j,M),series:j,category:M}),!b)return;const wt=ht(t,x[j]?.[M]??0,0,V,t.categories[M]??""),rt=labelPositionOf(t),Q=P*.8,At=k>=0?1:-1,_t=(et,X)=>rt==="ctr"?(et+X)/2:rt==="inBase"?et+(X>et?Q:-Q):rt==="inEnd"?X-(X>et?Q:-Q):X+(X>=et?Q:-Q);g?N(_t(J,K),st+r/2,wt,rt==="outEnd"?At>0?"start":"end":"middle"):N(st+r/2,_t(J,K),wt,"middle")})})}else{const n=t.categories.map(()=>0),m=t.series.map((f,r)=>{const y=[],S=[];return t.categories.forEach((p,M)=>{const w=L(r,M);if(w===null)return;const A=W?n[M]??0:0,v=A+w;W&&(n[M]=v);const V=ct(M),j=k=>g?[q(k),V]:[V,q(k)];if(y.push(j(v)),S.push(j(A)),isLine(t.type)&&b){const k=labelPositionOf(t),[nt,tt]=j(v);N(nt+(k==="r"?P:k==="l"?-P:0),tt+(k==="t"?-P:k==="b"?P:0),ht(t,x[r]?.[M]??0,0,f,t.categories[M]??""),k==="r"?"start":k==="l"?"end":"middle")}}),{series:f,s:r,points:y,base:S}});for(const{series:f,s:r,points:y,base:S}of m){const p=f.color??accentOf(r);if(isArea(t.type)&&y.length>0)i.shapes.push({d:`${lt([...y,...[...S].reverse()])} Z`,color:p,width:0,fill:p,series:r});else if(y.length>0&&(i.lines.push({d:f.smooth===!0?$t(y):lt(y),color:p,width:f.line_width??s.lineWidth,series:r}),hasMarkers(t.type)))for(const[M,w]of y)i.dots.push({x:M,y:w,r:(f.marker_size??s.marker)/2,color:p})}i.shapes.reverse()}return i}
|
|
2
|
+
import{format as Ct,isValidFormat as Lt}from"numfmt";import{brightened as jt}from"@allyhub-next/ooxml/brightness";export const themeColor=(t,s=0)=>s===0?t:{theme_color:t,brightness:s},themeColorOf=t=>typeof t=="string"?t:"theme_color"in t?t.theme_color:void 0;export function colorRgb(t,s){return typeof t=="string"?s[t]:"rgb"in t?t.rgb:jt(s[t.theme_color],t.brightness)}export const CHART_DEFAULTS={fontSize:12,titleScale:1.2,gapWidth:150,holeSize:50,margin:6,gridline:"#D9D9D9",axisLine:"#BFBFBF",letter:.55,lineWidth:2.25,gridWidth:.75,marker:5};const wt=["accent1","accent2","accent3","accent4","accent5","accent6"];export const accentOf=t=>wt[t%wt.length]??"accent1",isBar=t=>t.startsWith("column")||t.startsWith("bar"),isHorizontal=t=>t.startsWith("bar"),isLine=t=>t.startsWith("line"),isArea=t=>t.startsWith("area"),isRound=t=>t==="pie"||t==="doughnut",isScatter=t=>t.startsWith("scatter"),hasLines=t=>!isScatter(t)||t!=="scatter",hasMarkers=t=>t==="line-markers"||t==="scatter"||t==="scatter-lines",groupingOf=t=>t.endsWith("-100")?"percentStacked":t.endsWith("-stacked")?"stacked":isBar(t)?"clustered":"standard";export function labelPositionsOf(t){return isArea(t)||t==="doughnut"?[]:t==="pie"?["bestFit","outEnd","inEnd","ctr"]:isLine(t)||isScatter(t)?["t","b","l","r","ctr"]:groupingOf(t)==="clustered"?["outEnd","inEnd","ctr","inBase"]:["inEnd","ctr","inBase"]}export function labelPositionOf(t){const s=labelPositionsOf(t.type),l=t.labels?.position;if(l!==void 0&&s.includes(l))return l;if(s.length!==0)return t.type==="pie"?"ctr":isLine(t.type)||isScatter(t.type)?"t":groupingOf(t.type)==="clustered"?"outEnd":"ctr"}export const variesOf=t=>t.vary_by_categories??isRound(t.type);export function formatValue(t,s="General"){return s==="General"||!Lt(s)?String(Number(t.toPrecision(10))):Ct(s,t)}const Ft=[1,2,5,10];export function chartScale(t,s,l,r,e={}){const h=t>0&&(s-t)/s<.16666666666666666?t:Math.min(t,0),a=s<=0&&t<0?0:s,o=e.minimum_scale??h,j=e.maximum_scale??a,b=j>o?j-o:1,F=Math.max(1,Math.floor(l/r)),w=b/F,P=10**Math.floor(Math.log10(w)),O=e.major_unit??(Ft.find(E=>E*P>=w)??10)*P,B=(E,C)=>Number((C(Number((E/O).toFixed(9)))*O).toPrecision(12)),Z=a>0?a+b*.05:a===h?b:a,g=e.maximum_scale??B(Z,Math.ceil),R=h<0?h-b*.05:h,W=e.minimum_scale??B(R,Math.floor),N=[],x=Math.round((g-W)/O);for(let E=0;E<=x;E++)N.push(Number((W+E*O).toPrecision(12)));return{min:W,max:g,major:O,ticks:N}}const it=(t,s)=>{let l=0;for(const r of t)l+=(r.codePointAt(0)??0)>11903?1:CHART_DEFAULTS.letter;return l*s},d=t=>String(Number(t.toFixed(3)));function $t(t){const s=l=>t[Math.max(0,Math.min(t.length-1,l))]??[0,0];return t.map(([l,r],e)=>{if(e===0)return`M${d(l)} ${d(r)}`;const[h,a]=s(e-2),[o,j]=s(e-1),[b,F]=s(e+1),w=`${d(o+(l-h)/6)} ${d(j+(r-a)/6)}`,P=`${d(l-(b-o)/6)} ${d(r-(F-j)/6)}`;return`C${w} ${P} ${d(l)} ${d(r)}`}).join(" ")}const lt=t=>t.map(([s,l],r)=>`${r===0?"M":"L"}${d(s)} ${d(l)}`).join(" ");function Ot(t,s,l,r,e,h){const a=(F,w)=>`${d(t+F*Math.sin(w))} ${d(s-F*Math.cos(w))}`,o=h-e>=Math.PI*2?e+Math.PI*2-1e-4:h,j=o-e>Math.PI?1:0,b=`M${a(l,e)} A${d(l)} ${d(l)} 0 ${String(j)} 1 ${a(l,o)}`;return r<=0?`${b} L${d(t)} ${d(s)} Z`:`${b} L${a(r,o)} A${d(r)} ${d(r)} 0 ${String(j)} 0 ${a(r,e)} Z`}function vt(t,s,l,r){const e=r*1.5;return s!==void 0&&s!==""&&(t.bottom-=e),l!==void 0&&l!==""&&(t.left+=e),{x:t.left-e/2,y:t.bottom+e/2}}function kt(t,s,l,r,e,h,a){r!==void 0&&r!==""&&t.words.push({x:s.x+s.width/2,y:l.y,text:r,size:h,anchor:"middle",color:a}),e!==void 0&&e!==""&&t.words.push({x:l.x,y:s.y+s.height/2,text:e,size:h,anchor:"middle",color:a,rotate:-90})}const ht=(t,s,l,r,e)=>{const h=t.labels;if(!h)return"";const a=isRound(t.type),o=[];return h.show_series_name&&o.push(r.name),h.show_category_name&&o.push(e),(h.show_value??!(h.show_percentage??!1))&&o.push(formatValue(s,h.number_format??r.number_format)),h.show_percentage&&a&&o.push(formatValue(l,h.number_format??"0%")),o.join(", ")};function Bt(t,s,l,r,e){const h=CHART_DEFAULTS,a=t.category_axis??{},o=t.value_axis??{},j=vt(l,a.title,o.title,r),b=t.series.map(c=>c.values.flatMap(($,H)=>{const I=c.x?.[H]??(c.x?null:H+1);return I===null||$===null?[]:[[I,$]]})),F=b.flat().map(c=>c[0]),w=b.flat().map(c=>c[1]),P=c=>c.length>0?Math.min(...c):0,O=c=>c.length>0?Math.max(...c):1,B=o.number_format??t.series[0]?.number_format??"General",Z=a.number_format??"General",g=r*.5,R=chartScale(P(w),O(w),l.bottom-l.top,r*2.4,o),W=o.visible===!1?0:Math.max(0,...R.ticks.map(c=>it(formatValue(c,B),r)))+g,N=a.visible===!1?0:r*1.2+g,x={x:l.left+W,y:l.top,width:l.right-l.left-W,height:l.bottom-l.top-N};s.plot=x,kt(s,x,j,a.title,o.title,r,e);const E=chartScale(P(F),O(F),x.width,r*5,a),C=chartScale(P(w),O(w),x.height,r*2.4,o),z=c=>x.x+(Math.min(E.max,Math.max(E.min,c))-E.min)/(E.max-E.min)*x.width,D=c=>x.y+x.height-(Math.min(C.max,Math.max(C.min,c))-C.min)/(C.max-C.min)*x.height;for(const c of C.ticks){const $=D(c);(o.has_major_gridlines??!0)&&s.grid.push({d:`M${d(x.x)} ${d($)} H${d(x.x+x.width)}`,color:o.gridline_color??{rgb:h.gridline},width:h.gridWidth}),o.visible!==!1&&s.words.push({x:x.x-g,y:$,text:formatValue(c,B),size:r,anchor:"end",color:e})}for(const c of E.ticks){const $=z(c);a.has_major_gridlines===!0&&s.grid.push({d:`M${d($)} ${d(x.y)} V${d(x.y+x.height)}`,color:a.gridline_color??{rgb:h.gridline},width:h.gridWidth}),a.visible!==!1&&s.words.push({x:$,y:x.y+x.height+g+r*.6,text:formatValue(c,Z),size:r,anchor:"middle",color:e})}s.axes.push({d:`M${d(x.x)} ${d(D(Math.max(C.min,Math.min(C.max,0))))} H${d(x.x+x.width)}`,color:a.line_color??{rgb:h.axisLine},width:h.gridWidth}),t.series.forEach((c,$)=>{const H=c.color??accentOf($),I=(b[$]??[]).map(([U,Y])=>[z(U),D(Y)]);if(I.length!==0&&(hasLines(t.type)&&s.lines.push({d:t.type==="scatter-smooth"||c.smooth===!0?$t(I):lt(I),color:H,width:c.line_width??h.lineWidth,series:$}),hasMarkers(t.type)))for(const[U,Y]of I)s.dots.push({x:U,y:Y,r:(c.marker_size??h.marker)/2,color:H})})}export function chartDrawing(t,s,l){const r=CHART_DEFAULTS,e=t.font_size??r.fontSize,h=t.font_color??"dk1",a={grid:[],shapes:[],boxes:[],lines:[],axes:[],dots:[],keys:[],words:[],plot:{x:0,y:0,width:0,height:0}},o={left:r.margin,top:r.margin,right:s-r.margin,bottom:l-r.margin};if(t.title!==void 0&&t.title!==""){const n=t.title_size??e*r.titleScale;a.words.push({x:s/2,y:o.top+n*.7,text:t.title,size:n,anchor:"middle",color:h}),o.top+=n*1.6}const j=isRound(t.type),b=variesOf(t),F=(n,m)=>b?accentOf(m):t.series[n]?.color??accentOf(n);if(t.legend!==void 0){const n=b?t.categories:t.series.map(p=>p.name),m=e*.6,f=e*.4,i=e*1.5,y=n.map(p=>m+f+it(p,e)),S=(p,M,_)=>{a.keys.push({x:M,y:_-m/2,width:m,height:m,color:b?accentOf(p):t.series[p]?.color??accentOf(p),series:b?0:p,category:b?p:0}),a.words.push({x:M+m+f,y:_,text:n[p]??"",size:e,anchor:"start",color:h})};if(t.legend==="top"||t.legend==="bottom"){const p=y.reduce((A,v)=>A+v,0)+e*(n.length-1),M=t.legend==="top"?o.top+i/2:o.bottom-i/2;let _=(s-p)/2;n.forEach((A,v)=>{S(v,_,M),_+=(y[v]??0)+e}),t.legend_overlay!==!0&&(t.legend==="top"?o.top+=i:o.bottom-=i)}else{const p=Math.max(0,...y),M=t.legend==="left"?o.left:o.right-p,_=(o.top+o.bottom-i*n.length)/2+i/2;n.forEach((A,v)=>{S(v,M,_+v*i)}),t.legend_overlay!==!0&&(t.legend==="left"?o.left+=p+e:o.right-=p+e)}}const w=t.labels,P=w?.size??e,O=w?.color??h,B=(n,m,f,i,y=O)=>{f!==""&&a.words.push({x:n,y:m,text:f,size:P,anchor:i,color:y})};if(j){const n=t.series[0],m=(n?.values??[]).map(_=>Math.max(0,_??0)),f=m.reduce((_,A)=>_+A,0),i=Math.max(0,Math.min(o.right-o.left,o.bottom-o.top)/2),y=(o.left+o.right)/2,S=(o.top+o.bottom)/2,p=t.type==="doughnut"?i*((t.hole_size??r.holeSize)/100):0;a.plot={x:y-i,y:S-i,width:i*2,height:i*2};let M=0;return m.forEach((_,A)=>{const v=f>0?_/f:0,V=M+v*Math.PI*2;if(v>0){a.shapes.push({d:Ot(y,S,i,p,M,V),color:"lt1",width:1,fill:F(0,A),series:0,category:A});const L=(M+V)/2,k=p>0?(i+p)/2:labelPositionOf(t)==="inEnd"?i*.85:i*.6;n&&B(y+k*Math.sin(L),S-k*Math.cos(L),ht(t,_,v,n,t.categories[A]??""),"middle",w?.color??"lt1")}M=V}),a}if(isScatter(t.type))return Bt(t,a,o,e,h),a;const Z=Math.max(1,t.categories.length),g=isHorizontal(t.type),R=groupingOf(t.type),W=R!=="clustered"&&R!=="standard",N=R==="percentStacked",x=t.series.map(n=>t.categories.map((m,f)=>n.values[f]??null)),E=t.categories.map((n,m)=>x.reduce((f,i)=>f+Math.abs(i[m]??0),0)),C=(n,m)=>{const f=x[n]?.[m];if(f==null)return null;const i=E[m]??0;return N?i>0?f/i:0:f};let z=0,D=0;if(t.categories.forEach((n,m)=>{let f=0,i=0;t.series.forEach((y,S)=>{const p=C(S,m)??0;W?p>=0?f+=p:i+=p:(f=Math.max(f,p),i=Math.min(i,p))}),D=Math.max(D,f),z=Math.min(z,i)}),!W){const n=x.flat().filter(m=>m!==null);n.length>0&&Math.min(...n)>0&&(z=Math.min(...n))}N&&(D=1,z=Math.min(z,0));const c=t.value_axis??{},$=t.category_axis??{},H=c.number_format??(N?"0%":t.series[0]?.number_format??"General"),I=g?o.right-o.left:o.bottom-o.top,U=g?e*5:e*2.4,Y=chartScale(z,D,I,U,{...c,...N?{maximum_scale:c.maximum_scale??1}:{}}),Wt=c.visible===!1?[]:Y.ticks.map(n=>formatValue(n,H)),Et=Math.max(0,...Wt.map(n=>it(n,e))),ot=$.visible!==!1,dt=ot?Math.max(0,...t.categories.map(n=>it(n,e))):0,T=e*.5,mt=g?c.title:$.title,ft=g?$.title:c.title,St=vt(o,mt,ft,e),u=g?{x:o.left+(ot?dt+T:0),y:o.top,width:0,height:o.bottom-o.top-(c.visible===!1?0:e*1.2+T)}:{x:o.left+(c.visible===!1?0:Et+T),y:o.top,width:0,height:o.bottom-o.top-(ot?e*1.2+T:0)};u.width=o.right-u.x,a.plot=u,kt(a,u,St,mt,ft,e,h);const G=chartScale(z,D,g?u.width:u.height,U,{...c,...N?{maximum_scale:c.maximum_scale??1}:{}}),ut=n=>(Math.min(G.max,Math.max(G.min,n))-G.min)/(G.max-G.min)*(g?u.width:u.height),q=n=>g?u.x+ut(n):u.y+u.height-ut(n),pt=isArea(t.type),gt=$.reverse_order===!0,xt=g?!gt:gt,at=(g?u.height:u.width)/Z,yt=pt?(g?u.height:u.width)/Math.max(1,Z-1):at,ct=n=>{const m=pt?n*yt:(n+.5)*at,f=g?u.height:u.width,i=xt?f-m:m;return(g?u.y:u.x)+i},Mt=q(Math.max(G.min,Math.min(G.max,0)));for(const n of G.ticks){const m=q(n);(c.has_major_gridlines??!0)&&a.grid.push({d:g?`M${d(m)} ${d(u.y)} V${d(u.y+u.height)}`:`M${d(u.x)} ${d(m)} H${d(u.x+u.width)}`,color:c.gridline_color??{rgb:r.gridline},width:r.gridWidth}),c.visible!==!1&&a.words.push(g?{x:m,y:u.y+u.height+T+e*.6,text:formatValue(n,H),size:e,anchor:"middle",color:h}:{x:u.x-T,y:m,text:formatValue(n,H),size:e,anchor:"end",color:h})}if(a.axes.push({d:g?`M${d(Mt)} ${d(u.y)} V${d(u.y+u.height)}`:`M${d(u.x)} ${d(Mt)} H${d(u.x+u.width)}`,color:$.line_color??{rgb:r.axisLine},width:r.gridWidth}),ot){const n=g?e*1.3:dt+e,m=Math.max(1,Math.ceil(n/Math.max(1,yt)));t.categories.forEach((f,i)=>{if(i%m!==0)return;const y=ct(i);a.words.push(g?{x:u.x-T,y,text:f,size:e,anchor:"end",color:h}:{x:y,y:u.y+u.height+T+e*.6,text:f,size:e,anchor:"middle",color:h})})}if(isBar(t.type)){const n=(t.gap_width??r.gapWidth)/100,m=W?1:t.series.length,f=W?1:(t.overlap??0)/100,i=at/(Math.max(1,m-(m-1)*f)+n),y=i*(1-f),S=i+y*(m-1);t.categories.forEach((p,M)=>{const _=ct(M);let A=0,v=0;t.series.forEach((V,L)=>{const k=C(L,M);if(k===null)return;const nt=W?k>=0?A:v:0,tt=nt+k;W&&(k>=0?A=tt:v=tt);const J=q(nt),K=q(tt),st=(W?_-i/2:_-S/2+L*y)+(g&&xt&&!W?S-i-2*L*y:0),Pt=g?{x:Math.min(J,K),y:st,width:Math.abs(K-J),height:i}:{x:st,y:Math.min(J,K),width:i,height:Math.abs(K-J)};if(a.boxes.push({...Pt,color:F(L,M),series:L,category:M}),!w)return;const _t=ht(t,x[L]?.[M]??0,0,V,t.categories[M]??""),rt=labelPositionOf(t),Q=P*.8,At=k>=0?1:-1,bt=(et,X)=>rt==="ctr"?(et+X)/2:rt==="inBase"?et+(X>et?Q:-Q):rt==="inEnd"?X-(X>et?Q:-Q):X+(X>=et?Q:-Q);g?B(bt(J,K),st+i/2,_t,rt==="outEnd"?At>0?"start":"end":"middle"):B(st+i/2,bt(J,K),_t,"middle")})})}else{const n=t.categories.map(()=>0),m=t.series.map((f,i)=>{const y=[],S=[];return t.categories.forEach((p,M)=>{const _=C(i,M);if(_===null)return;const A=W?n[M]??0:0,v=A+_;W&&(n[M]=v);const V=ct(M),L=k=>g?[q(k),V]:[V,q(k)];if(y.push(L(v)),S.push(L(A)),isLine(t.type)&&w){const k=labelPositionOf(t),[nt,tt]=L(v);B(nt+(k==="r"?P:k==="l"?-P:0),tt+(k==="t"?-P:k==="b"?P:0),ht(t,x[i]?.[M]??0,0,f,t.categories[M]??""),k==="r"?"start":k==="l"?"end":"middle")}}),{series:f,s:i,points:y,base:S}});for(const{series:f,s:i,points:y,base:S}of m){const p=f.color??accentOf(i);if(isArea(t.type)&&y.length>0)a.shapes.push({d:`${lt([...y,...[...S].reverse()])} Z`,color:p,width:0,fill:p,series:i});else if(y.length>0&&(a.lines.push({d:f.smooth===!0?$t(y):lt(y),color:p,width:f.line_width??r.lineWidth,series:i}),hasMarkers(t.type)))for(const[M,_]of y)a.dots.push({x:M,y:_,r:(f.marker_size??r.marker)/2,color:p})}a.shapes.reverse()}return a}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DeckCodeSchema: z.ZodObject<{
|
|
3
|
+
slide_width: z.ZodNumber;
|
|
4
|
+
slide_height: z.ZodNumber;
|
|
5
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
colors: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
8
|
+
dk1: "dk1";
|
|
9
|
+
lt1: "lt1";
|
|
10
|
+
dk2: "dk2";
|
|
11
|
+
lt2: "lt2";
|
|
12
|
+
accent1: "accent1";
|
|
13
|
+
accent2: "accent2";
|
|
14
|
+
accent3: "accent3";
|
|
15
|
+
accent4: "accent4";
|
|
16
|
+
accent5: "accent5";
|
|
17
|
+
accent6: "accent6";
|
|
18
|
+
hlink: "hlink";
|
|
19
|
+
folHlink: "folHlink";
|
|
20
|
+
}> & z.core.$partial, z.ZodString>>;
|
|
21
|
+
fonts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
masters: z.ZodArray<z.ZodObject<{
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
background: z.ZodUnion<readonly [z.ZodEnum<{
|
|
26
|
+
dk1: "dk1";
|
|
27
|
+
lt1: "lt1";
|
|
28
|
+
dk2: "dk2";
|
|
29
|
+
lt2: "lt2";
|
|
30
|
+
accent1: "accent1";
|
|
31
|
+
accent2: "accent2";
|
|
32
|
+
accent3: "accent3";
|
|
33
|
+
accent4: "accent4";
|
|
34
|
+
accent5: "accent5";
|
|
35
|
+
accent6: "accent6";
|
|
36
|
+
hlink: "hlink";
|
|
37
|
+
folHlink: "folHlink";
|
|
38
|
+
}>, z.ZodObject<{
|
|
39
|
+
theme_color: z.ZodEnum<{
|
|
40
|
+
dk1: "dk1";
|
|
41
|
+
lt1: "lt1";
|
|
42
|
+
dk2: "dk2";
|
|
43
|
+
lt2: "lt2";
|
|
44
|
+
accent1: "accent1";
|
|
45
|
+
accent2: "accent2";
|
|
46
|
+
accent3: "accent3";
|
|
47
|
+
accent4: "accent4";
|
|
48
|
+
accent5: "accent5";
|
|
49
|
+
accent6: "accent6";
|
|
50
|
+
hlink: "hlink";
|
|
51
|
+
folHlink: "folHlink";
|
|
52
|
+
}>;
|
|
53
|
+
brightness: z.ZodNumber;
|
|
54
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
55
|
+
rgb: z.ZodString;
|
|
56
|
+
}, z.core.$strict>]>;
|
|
57
|
+
text_styles: z.ZodObject<{
|
|
58
|
+
title: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
59
|
+
body: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
60
|
+
other: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
shapes: z.ZodArray<z.ZodObject<{
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
kind: z.ZodEnum<{
|
|
65
|
+
picture: "picture";
|
|
66
|
+
textbox: "textbox";
|
|
67
|
+
movie: "movie";
|
|
68
|
+
table: "table";
|
|
69
|
+
chart: "chart";
|
|
70
|
+
component: "component";
|
|
71
|
+
placeholder: "placeholder";
|
|
72
|
+
autoshape: "autoshape";
|
|
73
|
+
}>;
|
|
74
|
+
frame: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
left: z.ZodNumber;
|
|
76
|
+
top: z.ZodNumber;
|
|
77
|
+
width: z.ZodNumber;
|
|
78
|
+
height: z.ZodNumber;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
placeholder: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
type: z.ZodString;
|
|
82
|
+
idx: z.ZodNumber;
|
|
83
|
+
}, z.core.$strict>>;
|
|
84
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
paragraphs: z.ZodArray<z.ZodObject<{
|
|
86
|
+
level: z.ZodNumber;
|
|
87
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
88
|
+
text: z.ZodString;
|
|
89
|
+
}, z.core.$loose>>;
|
|
90
|
+
}, z.core.$loose>>;
|
|
91
|
+
levels: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
92
|
+
}, z.core.$loose>>;
|
|
93
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
path: z.ZodString;
|
|
95
|
+
base: z.ZodString;
|
|
96
|
+
}, z.core.$loose>>;
|
|
97
|
+
component: z.ZodOptional<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
}, z.core.$loose>>;
|
|
102
|
+
layouts: z.ZodArray<z.ZodObject<{
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
master: z.ZodString;
|
|
105
|
+
shapes: z.ZodArray<z.ZodObject<{
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
kind: z.ZodEnum<{
|
|
108
|
+
picture: "picture";
|
|
109
|
+
textbox: "textbox";
|
|
110
|
+
movie: "movie";
|
|
111
|
+
table: "table";
|
|
112
|
+
chart: "chart";
|
|
113
|
+
component: "component";
|
|
114
|
+
placeholder: "placeholder";
|
|
115
|
+
autoshape: "autoshape";
|
|
116
|
+
}>;
|
|
117
|
+
frame: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
left: z.ZodNumber;
|
|
119
|
+
top: z.ZodNumber;
|
|
120
|
+
width: z.ZodNumber;
|
|
121
|
+
height: z.ZodNumber;
|
|
122
|
+
}, z.core.$strict>>;
|
|
123
|
+
placeholder: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
type: z.ZodString;
|
|
125
|
+
idx: z.ZodNumber;
|
|
126
|
+
}, z.core.$strict>>;
|
|
127
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
paragraphs: z.ZodArray<z.ZodObject<{
|
|
129
|
+
level: z.ZodNumber;
|
|
130
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
131
|
+
text: z.ZodString;
|
|
132
|
+
}, z.core.$loose>>;
|
|
133
|
+
}, z.core.$loose>>;
|
|
134
|
+
levels: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
135
|
+
}, z.core.$loose>>;
|
|
136
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
path: z.ZodString;
|
|
138
|
+
base: z.ZodString;
|
|
139
|
+
}, z.core.$loose>>;
|
|
140
|
+
component: z.ZodOptional<z.ZodObject<{
|
|
141
|
+
name: z.ZodString;
|
|
142
|
+
props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
143
|
+
}, z.core.$strict>>;
|
|
144
|
+
}, z.core.$loose>>;
|
|
145
|
+
}, z.core.$loose>>;
|
|
146
|
+
}, z.core.$loose>>;
|
|
147
|
+
components: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
148
|
+
props: z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
generators: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
layout: z.ZodString;
|
|
153
|
+
shapes: z.ZodArray<z.ZodObject<{
|
|
154
|
+
name: z.ZodString;
|
|
155
|
+
kind: z.ZodEnum<{
|
|
156
|
+
picture: "picture";
|
|
157
|
+
textbox: "textbox";
|
|
158
|
+
movie: "movie";
|
|
159
|
+
table: "table";
|
|
160
|
+
chart: "chart";
|
|
161
|
+
component: "component";
|
|
162
|
+
placeholder: "placeholder";
|
|
163
|
+
autoshape: "autoshape";
|
|
164
|
+
}>;
|
|
165
|
+
frame: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
left: z.ZodNumber;
|
|
167
|
+
top: z.ZodNumber;
|
|
168
|
+
width: z.ZodNumber;
|
|
169
|
+
height: z.ZodNumber;
|
|
170
|
+
}, z.core.$strict>>;
|
|
171
|
+
placeholder: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
type: z.ZodString;
|
|
173
|
+
idx: z.ZodNumber;
|
|
174
|
+
}, z.core.$strict>>;
|
|
175
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
paragraphs: z.ZodArray<z.ZodObject<{
|
|
177
|
+
level: z.ZodNumber;
|
|
178
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
179
|
+
text: z.ZodString;
|
|
180
|
+
}, z.core.$loose>>;
|
|
181
|
+
}, z.core.$loose>>;
|
|
182
|
+
levels: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
183
|
+
}, z.core.$loose>>;
|
|
184
|
+
media: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
path: z.ZodString;
|
|
186
|
+
base: z.ZodString;
|
|
187
|
+
}, z.core.$loose>>;
|
|
188
|
+
component: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
name: z.ZodString;
|
|
190
|
+
props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
}, z.core.$loose>>;
|
|
193
|
+
text: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
194
|
+
level: z.ZodNumber;
|
|
195
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
196
|
+
text: z.ZodString;
|
|
197
|
+
}, z.core.$loose>>;
|
|
198
|
+
}, z.core.$loose>>>;
|
|
199
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, z.core.$loose>>, z.ZodObject<{
|
|
201
|
+
error: z.ZodString;
|
|
202
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strict>]>>;
|
|
204
|
+
}, z.core.$strict>;
|
|
205
|
+
//# sourceMappingURL=deck-code.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{z as t}from"zod";import{THEME_COLORS as o}from"./slides.js";const e=t.number(),s=t.union([t.enum(o),t.strictObject({theme_color:t.enum(o),brightness:t.number().min(-1).max(1)}),t.strictObject({rgb:t.string().regex(/^#?[0-9A-Fa-f]{6}$/u)})]),i=t.strictObject({left:e,top:e,width:e,height:e}),c=t.looseObject({text:t.string()}),n=t.looseObject({level:t.number().int().min(0).max(8),runs:t.array(c)}),l=t.looseObject({paragraphs:t.array(n),levels:t.array(t.looseObject({}))}),r=t.looseObject({name:t.string(),kind:t.enum(["placeholder","textbox","picture","movie","autoshape","table","chart","component"]),frame:i.optional(),placeholder:t.strictObject({type:t.string(),idx:t.number().int()}).optional(),text:l.optional(),media:t.looseObject({path:t.string(),base:t.string()}).optional(),component:t.strictObject({name:t.string(),props:t.record(t.string(),t.unknown())}).optional()}),p=t.looseObject({name:t.string(),master:t.string(),shapes:t.array(r)}),m=t.looseObject({name:t.string(),background:s,text_styles:t.strictObject({title:t.array(t.looseObject({})),body:t.array(t.looseObject({})),other:t.array(t.looseObject({}))}),shapes:t.array(r),layouts:t.array(p)}),a=t.lazy(()=>t.looseObject({type:t.string(),optional:t.boolean().optional(),of:a.optional(),fields:t.record(t.string(),a).optional(),kind:t.string().optional()})),g=t.looseObject({id:t.string(),layout:t.string(),shapes:t.array(r),text:t.record(t.string(),t.array(n)),notes:t.string().optional()});export const DeckCodeSchema=t.strictObject({slide_width:e.positive(),slide_height:e.positive(),theme:t.strictObject({name:t.string().optional(),colors:t.partialRecord(t.enum(o),t.string()).optional(),fonts:t.record(t.string(),t.string()).optional()}).optional(),masters:t.array(m),components:t.record(t.string(),t.strictObject({props:t.record(t.string(),a)})),generators:t.record(t.string(),t.union([t.array(g),t.strictObject({error:t.string(),stack:t.string().optional()})]))});
|
|
@@ -18,11 +18,13 @@ export declare const ScriptPartSchema: z.ZodObject<{
|
|
|
18
18
|
}, z.core.$strict>;
|
|
19
19
|
/**
|
|
20
20
|
* A deck's slide in its script: the words of its shapes by their names
|
|
21
|
-
* (a list is a shape's paragraphs) and its speaker
|
|
21
|
+
* (a list is a shape's paragraphs), their alternative text and its speaker
|
|
22
|
+
* notes.
|
|
22
23
|
*/
|
|
23
24
|
export declare const ScriptSlideSchema: z.ZodObject<{
|
|
24
25
|
id: z.ZodString;
|
|
25
26
|
text: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<ScriptText, unknown, z.core.$ZodTypeInternals<ScriptText, unknown>>>>;
|
|
27
|
+
alt: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
28
|
notes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
27
29
|
declarations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
28
30
|
selectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -44,6 +46,7 @@ export declare const ScriptFileSchema: z.ZodObject<{
|
|
|
44
46
|
slides: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
45
47
|
id: z.ZodString;
|
|
46
48
|
text: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<ScriptText, unknown, z.core.$ZodTypeInternals<ScriptText, unknown>>>>;
|
|
49
|
+
alt: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
47
50
|
notes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
48
51
|
declarations: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
52
|
selectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{z as t}from"zod";import{SpokenSchema as d,VariantsSchema as i}from"./messages.js";export const SCRIPT_NAME=/^[A-Za-z0-9_-]+$/u;const
|
|
2
|
+
import{z as t}from"zod";import{SpokenSchema as d,VariantsSchema as i}from"./messages.js";export const SCRIPT_NAME=/^[A-Za-z0-9_-]+$/u;const r=t.string().regex(SCRIPT_NAME,"A name is letters, digits, _ and -.");export const ScriptTextSchema=t.lazy(()=>t.union([t.string(),d,i,t.array(ScriptTextSchema),t.record(r,ScriptTextSchema)])),ScriptPartSchema=t.strictObject({id:r,say:t.union([t.string(),i]).optional(),screen:t.record(r,ScriptTextSchema).optional()}),ScriptSlideSchema=t.strictObject({id:r,text:t.record(r,ScriptTextSchema).optional(),alt:t.record(r,t.string()).optional(),notes:t.union([t.string(),i]).optional()}),ScriptFileSchema=t.strictObject({title:t.string().optional(),text:t.record(r,ScriptTextSchema).optional(),parts:t.array(ScriptPartSchema).default([]),slides:t.array(ScriptSlideSchema).default([])}).superRefine((o,s)=>{const c=new Set;o.parts.forEach((e,a)=>{c.has(e.id)&&s.addIssue({code:"custom",path:["parts",a,"id"],message:`Two parts are "${e.id}".`}),c.add(e.id)});const n=new Set;o.slides.forEach((e,a)=>{n.has(e.id)&&s.addIssue({code:"custom",path:["slides",a,"id"],message:`Two slides are "${e.id}".`}),n.add(e.id)})}),scriptFileFor=(o,s)=>`${o}/script.${s}.yaml`;export function scriptLocale(o){return/(?:^|\/)script\.([A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*)\.yaml$/u.exec(o)?.[1]}
|