@allyhub/sdk 0.5.0 → 0.7.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/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 +248 -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 +1114 -91
- 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 +4 -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 +625 -30
- 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/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 +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 +89 -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 +23 -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 +377 -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/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/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/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 +12 -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 +6 -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 +44 -2
- 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 +121 -44
- 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 +50 -13
- 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/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 +188 -5
- 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 -0
- 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 +38 -4
- package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +27 -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 +26 -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/sheets.d.ts +1 -1
- package/dist/sheets.js +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 +25 -2
- package/docs/layers.md +1 -1
- package/docs/project.md +3 -1
- package/docs/sheets.md +29 -3
- package/docs/slides.md +18 -14
- package/docs/sound.md +1 -1
- package/docs/websites.md +57 -0
- package/package.json +3 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readMarks as le,markRuns as de}from"@allyhub-next/video-core";import{chartOfFile as se}from"./chart-file.js";import{AUTOSHAPE_STYLE as j,CONNECTOR_STYLE as V,DRAWN_TEXTBOX_FRAME as Z,TEXT_FALLBACK as q,TEXT_INSETS as N,placeholderFrame as fe,styleKindOf as pe}from"./office.js";import{resolveAnimation as ue,resolveTransition as J}from"./animation.js";import{pathSteps as ce}from"./path.js";import{masterPlaceholder as he}from"./placeholders.js";import{DECK_FONTS as me,OFFICE_THEME as ge,themeOver as _e}from"./theme.js";import{Pt as A}from"./units.js";export function joinPath(t,o){if(o.startsWith("/"))return o.slice(1);const m=t===""?[]:t.split("/");for(const l of o.split("/"))l===""||l==="."||(l===".."?m.pop():m.push(l));return m.join("/")}const Q={left:0,top:0,width:0,height:0},P=()=>Array.from({length:9},()=>({...q,font:{...q.font},margin_left:0}));export function levelsOver(t,...o){return t.map((m,l)=>{let s={...m,font:{...m.font}};for(const $ of o){const r=$?.[l];r&&(s={...s,...r.alignment===void 0?{}:{alignment:r.alignment},...r.line_spacing===void 0?{}:{line_spacing:r.line_spacing},...r.space_before===void 0?{}:{space_before:r.space_before},...r.space_after===void 0?{}:{space_after:r.space_after},...r.margin_left===void 0?{}:{margin_left:r.margin_left},...r.indent===void 0?{}:{indent:r.indent},font:{...s.font,...r.font}},r.font?.color!==void 0&&delete s.font.rgb,r.font?.rgb!==void 0&&delete s.font.color,r.bullet===null?delete s.bullet:r.bullet!==void 0?s.bullet={char:r.bullet,...r.bullet_font===void 0?{}:{font:r.bullet_font}}:r.bullet_font!==void 0&&s.bullet&&(s.bullet={...s.bullet,font:r.bullet_font}))}return s})}function K(t,...o){const m=o.filter(s=>s!==void 0),l=s=>{for(let $=m.length-1;$>=0;$--){const r=m[$]?.[s];if(r!==void 0)return r}};return{vertical_anchor:l("vertical_anchor")??t.vertical_anchor,auto_size:l("auto_size")??t.auto_size,word_wrap:l("word_wrap")??t.word_wrap,margins:{left:l("margin_left")??N.left,top:l("margin_top")??N.top,right:l("margin_right")??N.right,bottom:l("margin_bottom")??N.bottom}}}const I={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=t=>levelsOver(P(),t.text_styles.other);function B(t,o){return{...K(I,o),levels:levelsOver(P(),t.text_styles.other,o.levels)}}function ye(t,o,...m){return{...K(fe(o),...m),levels:levelsOver(P(),t.text_styles[pe(o)],...m.map(l=>l?.levels))}}const $e=Array.from({length:9},()=>({font:{color:j.font_color}})),ee={vertical_anchor:j.vertical_anchor};function ne(t,o){return{...K(I,o),levels:levelsOver(P(),t.text_styles.other,$e,o.levels)}}const L=t=>{const o={...t};return delete o.paragraphs,o},R=t=>({paragraphs:[],levels:[],...t}),W=t=>t==="none"?null:colorOfFile(t),xe=/<span((?:\s+(?:color|font)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,be=/(color|font)="([^"\n]*)"/gu,D=57344,we=256,te="",ke=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=t=>t.startsWith("#")?{rgb:t.toUpperCase()}:t;function ie(t,o,m=[]){return{...t,rows:t.rows.map((l,s)=>({height:l.height,cells:l.cells.map($=>{const r=m[s];return{...$,text:{paragraphs:$.text.paragraphs,style:H({...B(o,$.text),auto_size:"shape"},r),own:L($.text),empty:!1},...r?{fileText:r}:{}}})}))}}function H(t,o){return o?{...t,levels:t.levels.map(m=>{const l={...m.font,...o.size===void 0?{}:{size:A(o.size)},...o.bold===void 0?{}:{bold:o.bold},...o.italic===void 0?{}:{italic:o.italic},...o.font===void 0?{}:{name:o.font}};if(o.color!==void 0){const s=colorOfFile(o.color);typeof s=="string"?(l.color=s,delete l.rgb):(l.rgb=s.rgb,delete l.color)}return{...m,font:l,...o.align===void 0?{}:{alignment:o.align}}})}:t}function Se(t){const o={};for(const[,m,l=""]of t.matchAll(be))if(m==="font")o.name=l.trim();else{const s=colorOfFile(l);typeof s=="string"?o.color=s:o.rgb=s.rgb}return o}export function paragraphsOfWords(t,o=0,m=me.code){return t===void 0?[]:typeof t=="string"?t.split(/\r?\n/u).map(l=>{const s=[],$=l.replace(xe,(v,T,z)=>(s.push(Se(T)),`${String.fromCharCode(D+s.length-1)}${z}${te}`)),r=le($);let O;const E=de(r.text,r.marks).flatMap(v=>{const T=v.kinds.includes("code"),z={...v.kinds.includes("strong")?{bold:!0}:{},...v.kinds.includes("em")?{italic:!0}:{},...T?{name:m}:{}};return[...v.text.matchAll(ke)].flatMap(U=>{const M=U[0],F=M.charCodeAt(0);if(M===te)return O=void 0,[];if(F>=D&&F<D+we)return O=s[F-D],[];const C={...O,...z};return[{text:M,...Object.keys(C).length>0?{font:C}:{},...T?{code:!0}:{}}]})});return{runs:E.length>0?E:[{text:""}],level:o}}):t.flatMap(l=>paragraphsOfWords(l,Array.isArray(l)?Math.min(o+1,8):o,m))}const oe=t=>({left:A(t.x),top:A(t.y),width:A(t.w),height:A(t.h)}),re=t=>t===void 0?void 0:{left:t.left??0,top:t.top??0,right:t.right??0,bottom:t.bottom??0};export function resolveDeck(t){const{def:o,file:m,words:l,prefix:s,base:$}=t,r=[],O=_e(t.theme??ge,o.theme),E=new Map;for(const e of o.masters)for(const n of e.layouts)E.set(n.name,{layout:n,master:e});const v=[],T=(e,n,f)=>({name:e.name,kind:e.kind,frame:{...e.frame??Q},...e.flip?{flip:{...e.flip}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?ne(f,e.text):B(f,e.text),own:L(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.path?{path:e.path}:{},...e.table?{table:ie(e.table,f)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),z=(e,n)=>{const f=e.placeholder?.type??"body",c=he(n,f),x=e.frame??c?.frame??Q;return{name:e.name,kind:"placeholder",frame:{...x},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:ye(n,f,c?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!c?"layout":"master"},text:{from:"layout"}}}},U=(e,n,f)=>{const c=o.components[e];if(!c){r.push({...f,message:`There is no component ${e} in slides.ts (it has ${Object.keys(o.components).join(", ")||"none"}).`});return}for(const x of Object.keys(n??{}))Object.hasOwn(c.props,x)||r.push({...f,message:`Component ${e} has no prop ${x} a person sets (it has ${Object.keys(c.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}}}},M=(e,n,f,c,x)=>{const b={slide:c,shape:e,path:f};if(!n.frame){r.push({...b,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const S=oe(n.frame),a={frame:{from:"slide",path:`${f}.frame`}},_={name:e,frame:S,level:"slide",...n.fill===void 0?{}:{fill:colorOfFile(n.fill)},...n.line===void 0?{}:{line:W(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.group===void 0?{}:{group:n.group}};if(n.textbox)return{..._,kind:"textbox",text:{paragraphs:paragraphsOfWords(l(`${s}.${c}.${e}`),0,O.fonts.code),style:H(B(x,R(Z)),n.text),own:L(R(Z)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...a,text:{from:"slide",path:`${f}.text`}}};if(n.picture!==void 0){const d=re(n.crop);return{..._,kind:"picture",media:{path:joinPath($,n.picture),...d?{crop:d}:{}},sources:a}}if(n.movie!==void 0)return{..._,kind:"movie",media:{path:joinPath($,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:a};if(n.chart){const d=l(`${s}.${c}.${e}`),h=se(n.chart,{title:typeof d=="string"?d:void 0,base:$,rows:i=>t.data?.(i),problem:i=>{r.push({...b,message:`Chart ${e}: ${i}`})}});return h?{..._,kind:"chart",chart:h,sources:a}:void 0}if(n.table){const d=n.table,h=S.width/d.columns.reduce((g,w)=>g+w,0),i=S.height/d.rows.reduce((g,w)=>g+w.height,0),p=l(`${s}.${c}.${e}`),y=Array.isArray(p)?p:[];return y.length>d.rows.length&&r.push({...b,message:`Table ${e} has ${String(d.rows.length)} rows and its words ${String(y.length)}.`}),{..._,kind:"table",table:ie({columns:d.columns.map(g=>Math.round(g*h)),rows:d.rows.map((g,w)=>{const k=y[w],X=Array.isArray(k)?k:k===void 0?[]:[k];return{height:Math.round(g.height*i),cells:d.columns.map((ve,ae)=>({text:{levels:[],paragraphs:paragraphsOfWords(X[ae],0,O.fonts.code)},...g.fill===void 0?{}:{fill:colorOfFile(g.fill)},...g.line===void 0?{}:{borders:{bottom:{color:colorOfFile(g.line),width:A(1)}}}}))}})},x,d.rows.map(g=>g.text)),sources:a}}const u=n.path&&ce(n.path.d);if(n.path&&!u){r.push({...b,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&u)return{..._,kind:"autoshape",...n.path&&u?{path:{w:n.path.w,h:n.path.h,steps:u}}:n.geometry===void 0?{}:{geometry:n.geometry},...n.geometry==="line"?{line:n.line===void 0?V.line:W(n.line),line_width:n.line_width===void 0?V.line_width:A(n.line_width)}:{fill:n.fill===void 0?j.fill:colorOfFile(n.fill),line:n.line===void 0?j.line:W(n.line),line_width:n.line_width===void 0?j.line_width:A(n.line_width)},...n.text&&n.geometry!=="line"?{fileText:{...n.text}}:{},...n.geometry==="line"?{}:{text:{paragraphs:paragraphsOfWords(l(`${s}.${c}.${e}`)).map(d=>n.text?.align===void 0?{alignment:j.alignment,...d}:d),style:H(ne(x,R(ee)),n.text),own:L(R(ee)),empty:!1}},sources:{...a,fill:{from:"slide",path:`${f}.fill`}}};if(n.component!==void 0){const d=U(n.component,n.props,b);return d?{..._,kind:"component",component:d,sources:a}:void 0}},F=(e,n,f)=>{if(n.frame&&(e.frame=oe(n.frame),e.sources.frame={from:"slide",path:`${f}.frame`}),n.text&&e.text&&(e.text.style=H(e.text.style,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${f}.text`}),n.line!==void 0&&(e.line=W(n.line),e.sources.line={from:"slide",path:`${f}.line`}),n.line_width!==void 0&&(e.line_width=A(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.fill!==void 0&&(e.fill=colorOfFile(n.fill),e.sources.fill={from:"slide",path:`${f}.fill`}),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const c=re(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath($,n.picture??n.movie??""),...c?{crop:c}:{},...n.poster===void 0?{}:{poster:n.poster}},delete e.text}},C=(e,n,f,c,x)=>{const b=E.get(n);if(!b){r.push({slide:e,path:`slides.${String(f)}.layout`,message:`Slide ${e} is on the layout "${n}", which slides.ts does not have (it has ${[...E.keys()].join(", ")||"none"}).`});return}const{layout:S,master:a}=b,_=[...(S.display_master_shapes===!1?[]:a.shapes).filter(d=>d.kind!=="placeholder").map(d=>T(d,"master",a)),...S.shapes.filter(d=>d.kind!=="placeholder").map(d=>T(d,"layout",a))],u=S.shapes.filter(d=>d.kind==="placeholder").map((d,h)=>({shape:z(d,a),order:h}));return{slide:{id:e,layout:S.name,master:a.name,hidden:c,background:S.background??a.background,shapes:_,animations:[],file:{index:f,...x===void 0?{}:{generate:x}}},placed:u,master:a}},G=(e,n,f,c,x,b,S,a,_)=>{const u=new Set(f.map(h=>h.shape.name));let d=f.length;for(const[h,i]of Object.entries(c??{})){const p=b(h);if(p===void 0)continue;const y=`${x}.shapes.${h}`,g=i.textbox!==void 0||i.geometry!==void 0||i.path!==void 0||i.table!==void 0||i.chart!==void 0||i.component!==void 0||(i.picture!==void 0||i.movie!==void 0)&&!u.has(p),w=f.find(X=>X.shape.name===p);if(w&&!g){F(w.shape,i,y),i.z!==void 0&&(w.z=i.z);continue}if(w){r.push({slide:e.id,shape:p,path:y,message:`Slide ${e.id} has a ${w.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!g){r.push({slide:e.id,shape:p,path:y,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...u].join(", ")||"none"}).`});continue}const k=M(p,i,y,e.id,n);k&&(f.push({shape:k,order:d++,...i.z===void 0?{}:{z:i.z}}),u.add(p))}f.sort((h,i)=>(h.z??0)-(i.z??0)||h.order-i.order);for(const h of f){const i=h.shape.text;if(h.shape.kind==="placeholder"&&i){const p=S(h.shape);i.paragraphs=paragraphsOfWords(p,0,O.fonts.code),i.empty=i.paragraphs.length===0||i.paragraphs.every(y=>y.runs.every(g=>g.text===""))}}e.shapes.push(...f.map(h=>h.shape)),a!==void 0&&a.trim()!==""&&(e.notes=a);for(const[h,i]of(_??[]).entries()){const p=b(i.shape);if(p===void 0)continue;const y={slide:e.id,shape:p,path:`${x}.animations.${String(h)}`},g=e.shapes.find(k=>k.name===p&&k.level==="slide");if(!g){r.push({...y,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(k=>k.level==="slide").map(k=>k.name).join(", ")}).`});continue}if(i.paragraph!==void 0&&i.paragraph>=(g.text?.paragraphs.length??0)){r.push({...y,message:`Shape ${p} has no paragraph ${String(i.paragraph)} to animate (it has ${String(g.text?.paragraphs.length??0)}).`});continue}const w=ue({...i,shape:p});w?e.animations.push(w):r.push({...y,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},Y=new Set;return m.slides.forEach((e,n)=>{const f=`slides.${String(n)}`;if(e.layout!==void 0){const a=C(e.id,e.layout,n,e.hidden===!0);if(!a)return;const _=l(`${s}.${e.id}.notes`);e.transition&&(a.slide.transition=J(e.transition)),G(a.slide,a.master,a.placed,e.shapes,f,u=>u,u=>l(`${s}.${e.id}.${u.name}`),typeof _=="string"?_:void 0,e.animations),v.push(a.slide),Y.add(e.id);return}const c=e.generate??"",x=o.generators[c];if(!x){r.push({slide:e.id,path:`${f}.generate`,message:`There is no generator ${c} in slides.ts (it has ${Object.keys(o.generators).join(", ")||"none"}).`});return}let b;try{b=x.make({data:t.data??(()=>{throw new Error("No data here.")})})}catch(a){r.push({slide:e.id,path:`${f}.generate`,message:`Generator ${c} failed: ${a instanceof Error?a.message:String(a)}`});return}const S=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const a of b){const _=`${e.id}/${a.id}`,u=C(_,a.layout,n,S.has(a.id),c);if(!u)continue;for(const i of a.shapes){const p=i.placeholder?u.placed.find(y=>y.shape.placeholder?.idx===i.placeholder?.idx):void 0;if(p)i.frame&&(p.shape.frame={...i.frame}),p.shape.sources.frame={from:"code"};else{const y=T(i,"layout",u.master);u.placed.push({shape:{...y,level:"slide",sources:{frame:{from:"code"}}},order:u.placed.length})}}const d=`${a.id}/`,h=a.transition??(a===b[0]?e.transition:void 0);h&&(u.slide.transition=J(h)),G(u.slide,u.master,u.placed,e.shapes,f,i=>i.startsWith(d)?i.slice(d.length):void 0,i=>{const p=i.placeholder===void 0?void 0:a.text[i.placeholder.idx];return p===void 0?void 0:p.map(y=>y.runs.map(g=>g.text).join(""))},a.notes,[...(a.animations??[]).map(i=>({...i,shape:`${d}${i.shape}`})),...e.animations??[]]);for(const i of u.slide.shapes){const p=i.placeholder===void 0?void 0:a.text[i.placeholder.idx];p&&i.text&&(i.text.paragraphs=p,i.text.empty=!1)}v.push(u.slide),Y.add(_)}for(const a of Object.keys(e.shapes??{})){const[_]=a.split("/");_!==void 0&&!b.some(u=>u.id===_)&&r.push({slide:e.id,path:`${f}.shapes.${a}`,message:`Generator ${c} makes no slide ${_}: ${a} changes nothing.`})}}),{deck:{width:o.slide_width,height:o.slide_height,theme:O,slides:v},problems:r}}
|
|
2
|
+
import{colorOfFile as Q}from"@allyhub-next/formats";import{readMarks as ge,markRuns as _e}from"@allyhub-next/video-core";import{chartOfFile as be}from"./chart-file.js";import{AUTOSHAPE_STYLE as C,SHADOW_DEFAULTS as H,CONNECTOR_STYLE as ee,DRAWN_TEXTBOX_FRAME as ne,TEXT_FALLBACK as te,TEXT_INSETS as W,isConnectorGeometry as ye,placeholderFrame as $e,styleKindOf as xe}from"./office.js";import{resolveAnimation as we,resolveTransition as ie}from"./animation.js";import{pathSteps as ke}from"./path.js";import{masterPlaceholder as ve}from"./placeholders.js";import{DECK_FONTS as Se,OFFICE_THEME as Ae,themeOver as Oe}from"./theme.js";import{Pt as S}from"./units.js";export function joinPath(i,t){if(t.startsWith("/"))return t.slice(1);const u=i===""?[]:i.split("/");for(const o of t.split("/"))o===""||o==="."||(o===".."?u.pop():u.push(o));return u.join("/")}const re={left:0,top:0,width:0,height:0},U=()=>Array.from({length:9},()=>({...te,font:{...te.font},margin_left:0}));export function levelsOver(i,...t){return i.map((u,o)=>{let r={...u,font:{...u.font}};for(const y of t){const l=y?.[o];l&&(r={...r,...l.alignment===void 0?{}:{alignment:l.alignment},...l.line_spacing===void 0?{}:{line_spacing:l.line_spacing},...l.space_before===void 0?{}:{space_before:l.space_before},...l.space_after===void 0?{}:{space_after:l.space_after},...l.margin_left===void 0?{}:{margin_left:l.margin_left},...l.indent===void 0?{}:{indent:l.indent},font:{...r.font,...l.font}},l.numbered!==void 0&&(r.numbered=l.numbered,delete r.bullet),l.bullet===null?(delete r.bullet,delete r.numbered):l.bullet!==void 0?(delete r.numbered,r.bullet={char:l.bullet,...l.bullet_font===void 0?{}:{font:l.bullet_font}}):l.bullet_font!==void 0&&r.bullet&&(r.bullet={...r.bullet,font:l.bullet_font}))}return r})}function I(i,...t){const u=t.filter(r=>r!==void 0),o=r=>{for(let y=u.length-1;y>=0;y--){const l=u[y]?.[r];if(l!==void 0)return l}};return{vertical_anchor:o("vertical_anchor")??i.vertical_anchor,auto_size:o("auto_size")??i.auto_size,word_wrap:o("word_wrap")??i.word_wrap,margins:{left:o("margin_left")??W.left,top:o("margin_top")??W.top,right:o("margin_right")??W.right,bottom:o("margin_bottom")??W.bottom}}}const oe={vertical_anchor:"t",auto_size:"none",word_wrap:!0};export const plainLevels=i=>levelsOver(U(),i.text_styles.other);function V(i,t){return{...I(oe,t),levels:levelsOver(U(),i.text_styles.other,t.levels)}}function Te(i,t,...u){return{...I($e(t),...u),levels:levelsOver(U(),i.text_styles[xe(t)],...u.map(o=>o?.levels))}}const Ee=Array.from({length:9},()=>({font:{color:C.font_color}})),ae={vertical_anchor:C.vertical_anchor};function le(i,t){return{...I(oe,t),levels:levelsOver(U(),i.text_styles.other,Ee,t.levels)}}const X=i=>{const t={...i};return delete t.paragraphs,t},G=i=>({paragraphs:[],levels:[],...i}),z=i=>i==="none"?null:colorOfFile(i),je=/<span((?:\s+(?:color|font|size|bold|italic|underline|link|highlight|baseline|strike)="[^"\n]*")+)\s*>(.*?)<\/span>/gu,Fe=/(color|font|size|bold|italic|underline|link|highlight|baseline|strike)="([^"\n]*)"/gu,K=57344,Ne=256,de="",ze=/[\ue000-\ue100]|[^\ue000-\ue100]+/gu;export const colorOfFile=i=>Q(i)??"dk1";function Z(i){const{shadow:t,gradient:u}=i;return{...i.fill_transparency===void 0?{}:{fill_transparency:i.fill_transparency},...u?{gradient:{angle:u.angle??0,stops:u.stops.map(o=>({at:o.at,color:colorOfFile(o.color),...o.transparency===void 0?{}:{transparency:o.transparency}}))}}:{},...t?{shadow:{color:t.color===void 0?H.color:colorOfFile(t.color),blur:t.blur===void 0?H.blur:S(t.blur),distance:t.distance===void 0?H.distance:S(t.distance),angle:t.angle??H.angle,transparency:t.transparency??H.transparency}}:{}}}function se(i,t,u=[]){return{...i,rows:i.rows.map((o,r)=>({height:o.height,cells:o.cells.map(y=>{const l=u[r];return{...y,text:{paragraphs:y.text.paragraphs,style:B({...V(t,y.text),auto_size:"shape"},l),own:X(y.text),empty:!1},...l?{fileText:l}:{}}})}))}}function B(i,t){return t?{...i,...t.anchor===void 0?{}:{vertical_anchor:t.anchor},levels:i.levels.map(u=>{const o={...u.font,...t.size===void 0?{}:{size:S(t.size)},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline},...t.strike===void 0?{}:{strike:t.strike},...t.font===void 0?{}:{name:t.font}};t.color!==void 0&&(o.color=colorOfFile(t.color));const r={...u,font:o,...t.align===void 0?{}:{alignment:t.align},...t.line_spacing===void 0?{}:{line_spacing:{lines:t.line_spacing}},...t.space_before===void 0?{}:{space_before:S(t.space_before)},...t.space_after===void 0?{}:{space_after:S(t.space_after)}};return t.numbered!==void 0?(r.numbered=t.numbered,delete r.bullet):t.bullet===!1?(delete r.bullet,delete r.numbered):t.bullet!==void 0&&(r.bullet={char:t.bullet},delete r.numbered),(t.numbered!==void 0||t.bullet!==void 0&&t.bullet!==!1)&&u.margin_left===0?{...r,margin_left:fe,indent:-fe}:r})}:i}function Me(i,t){if(!t)return[...i];const u=t.numbered!==void 0||t.bullet!==void 0;return i.map(o=>{const r={...o};return t.align!==void 0&&delete r.alignment,t.line_spacing!==void 0&&delete r.line_spacing,t.space_before!==void 0&&delete r.space_before,t.space_after!==void 0&&delete r.space_after,u&&(delete r.bullet,delete r.bullet_font,delete r.numbered),r})}function Ce(i){const t={};for(const[,u,o=""]of i.matchAll(Fe))if(u==="font")t.name=o.trim();else if(u==="link")t.link=o.trim();else if(u==="highlight")t.highlight=o.trim().toUpperCase();else if(u==="bold")t.bold=o.trim()!=="false";else if(u==="italic")t.italic=o.trim()!=="false";else if(u==="strike")t.strike=o.trim()!=="false";else if(u==="underline")t.underline=o.trim()!=="false";else if(u==="size"){const r=Number(o);Number.isFinite(r)&&r>0&&(t.size=S(r))}else if(u==="baseline"){const r=Number(o);Number.isFinite(r)&&(t.baseline=r)}else{const r=Q(o.trim());r!==void 0&&(t.color=r)}return t}const fe=342900;export function paragraphsOfWords(i,t=0,u=Se.code){return i===void 0?[]:typeof i=="string"?i.split(/\r?\n/u).map(o=>{const r=[],y=o.replace(je,(T,N,P)=>(r.push(Ce(N)),`${String.fromCharCode(K+r.length-1)}${P}${de}`)),l=ge(y);let F;const M=_e(l.text,l.marks).flatMap(T=>{const N=T.kinds.includes("code"),P={...T.kinds.includes("strong")?{bold:!0}:{},...T.kinds.includes("em")?{italic:!0}:{},...N?{name:u}:{}};return[...T.text.matchAll(ze)].flatMap(Y=>{const L=Y[0],R=L.charCodeAt(0);if(L===de)return F=void 0,[];if(R>=K&&R<K+Ne)return F=r[R-K],[];const D={...F,...P};return[{text:L,...Object.keys(D).length>0?{font:D}:{},...N?{code:!0}:{}}]})});return{runs:M.length>0?M:[{text:""}],level:t}}):i.flatMap(o=>paragraphsOfWords(o,Array.isArray(o)?Math.min(t+1,8):t,u))}const ue=i=>({left:S(i.x),top:S(i.y),width:S(i.w),height:S(i.h)}),Pe=new Set(["dt","ftr","sldNum"]),ce=i=>({...i.locked?{locked:!0}:{},...i.rotation===void 0||i.rotation===0?{}:{rotation:i.rotation},...i.flip_h||i.flip_v?{flip:{...i.flip_h?{h:!0}:{},...i.flip_v?{v:!0}:{}}}:{}});function pe(i,t,u){if(!t)return;t.fill!==void 0&&(i.background=colorOfFile(t.fill));const o=t.gradient&&Z({gradient:t.gradient}).gradient;o&&(i.background_gradient=o),t.picture!==void 0&&(i.background_picture=joinPath(u,t.picture))}const he=i=>i===void 0?void 0:{left:i.left??0,top:i.top??0,right:i.right??0,bottom:i.bottom??0};export function resolveDeck(i){const{code:t,file:u,words:o,prefix:r,base:y}=i,l=[],F=Oe(i.theme??Ae,t.theme),M=new Map;for(const e of t.masters)for(const n of e.layouts)M.set(n.name,{layout:n,master:e});const T=[],N=(e,n,a)=>({name:e.name,kind:e.kind,frame:{...e.frame??re},...e.flip?{flip:{...e.flip}}:{},...e.rotation===void 0?{}:{rotation:e.rotation},level:n,...e.text?{text:{paragraphs:e.text.paragraphs,style:e.kind==="autoshape"?le(a,e.text):V(a,e.text),own:X(e.text),empty:!1}}:{},...e.fill===void 0?{}:{fill:e.fill},...e.fill_transparency===void 0?{}:{fill_transparency:e.fill_transparency},...e.gradient?{gradient:e.gradient}:{},...e.shadow?{shadow:e.shadow}:{},...e.line===void 0?{}:{line:e.line},...e.line_width===void 0?{}:{line_width:e.line_width},...e.line_dash===void 0?{}:{line_dash:e.line_dash},...e.line_begin===void 0?{}:{line_begin:e.line_begin},...e.line_end===void 0?{}:{line_end:e.line_end},...e.path?{path:e.path}:{},...e.table?{table:se(e.table,a)}:{},...e.chart?{chart:e.chart}:{},...e.group===void 0?{}:{group:e.group},...e.geometry?{geometry:e.geometry}:{},...e.adjustments?{adjustments:[...e.adjustments]}:{},...e.media?{media:{path:joinPath(e.media.base,e.media.path),...e.media.poster===void 0?{}:{poster:e.media.poster}}}:{},...e.component?{component:{...e.component}}:{},sources:{frame:{from:n}}}),P=(e,n)=>{const a=e.placeholder?.type??"body",g=ve(n,a),_=e.frame??g?.frame??re;return{name:e.name,kind:"placeholder",frame:{..._},level:"slide",...e.placeholder?{placeholder:{...e.placeholder}}:{},text:{paragraphs:[],style:Te(n,a,g?.text,e.text),empty:!0},...e.fill===void 0?{}:{fill:e.fill},...e.line===void 0?{}:{line:e.line},sources:{frame:{from:e.frame||!g?"layout":"master"},text:{from:"layout"}}}},Y=(e,n,a)=>{const g=t.components[e];if(!g){l.push({...a,message:`There is no component ${e} in slides.ts (it has ${Object.keys(t.components).join(", ")||"none"}).`});return}for(const _ of Object.keys(n??{}))Object.hasOwn(g.props,_)||l.push({...a,message:`Component ${e} has no prop ${_} a person sets (it has ${Object.keys(g.props).join(", ")||"none"}).`});return{name:e,props:{...n??{}}}},L=(e,n,a,g,_)=>{const $={slide:g,shape:e,path:a};if(!n.frame){l.push({...$,message:`Shape ${e} is the slide's own: it needs a frame { x, y, w, h } in points.`});return}const w=ue(n.frame),d={frame:{from:"slide",path:`${a}.frame`}},b={name:e,frame:w,level:"slide",...n.fill===void 0?{}:{fill:z(n.fill)},...Z(n),...n.line===void 0?{}:{line:z(n.line)},...n.line_dash===void 0?{}:{line_dash:n.line_dash},...n.line_begin===void 0?{}:{line_begin:n.line_begin},...n.line_end===void 0?{}:{line_end:n.line_end},...n.group===void 0?{}:{group:n.group},...ce(n)};if(n.textbox)return{...b,kind:"textbox",text:{paragraphs:paragraphsOfWords(o(`${r}.${g}.${e}`),0,F.fonts.code),style:B(V(_,G(ne)),n.text),own:X(G(ne)),empty:!1},...n.text?{fileText:{...n.text}}:{},sources:{...d,text:{from:"slide",path:`${a}.text`}}};if(n.picture!==void 0){const s=he(n.crop);return{...b,kind:"picture",media:{path:joinPath(y,n.picture),...s?{crop:s}:{}},sources:{...d,media:{from:"slide",path:`${a}.picture`}}}}if(n.movie!==void 0)return{...b,kind:"movie",media:{path:joinPath(y,n.movie),...n.poster===void 0?{}:{poster:n.poster}},sources:{...d,media:{from:"slide",path:`${a}.movie`}}};if(n.chart){const s=o(`${r}.${g}.${e}`),k=be(n.chart,{title:typeof s=="string"?s:void 0,base:y,rows:m=>i.data?.(m),problem:m=>{l.push({...$,message:`Chart ${e}: ${m}`})}});return k?{...b,kind:"chart",chart:k,sources:d}:void 0}if(n.table){const s=n.table,k=w.width/s.columns.reduce((f,c)=>f+c,0),m=w.height/s.rows.reduce((f,c)=>f+c.height,0),x=o(`${r}.${g}.${e}`),O=Array.isArray(x)?x:[];return O.length>s.rows.length&&l.push({...$,message:`Table ${e} has ${String(s.rows.length)} rows and its words ${String(O.length)}.`}),{...b,kind:"table",table:se({columns:s.columns.map(f=>Math.round(f*k)),rows:s.rows.map((f,c)=>{const p=O[c],v=Array.isArray(p)?p:p===void 0?[]:[p];return{height:Math.round(f.height*m),cells:s.columns.map((E,A)=>({text:{levels:[],paragraphs:paragraphsOfWords(v[A],0,F.fonts.code)},...f.fill===void 0?{}:{fill:colorOfFile(f.fill)},...f.line===void 0?{}:{borders:{bottom:{color:colorOfFile(f.line),width:S(1)}}}}))}})},_,s.rows.map(f=>f.text)),sources:d}}const h=n.path&&ke(n.path.d);if(n.path&&!h){l.push({...$,message:`Shape ${e}'s path starts with M and says only M, L, C and Z, absolute.`});return}if(n.geometry!==void 0||n.path&&h){const s=!n.path&&ye(n.geometry);return{...b,kind:"autoshape",...n.path&&h?{path:{w:n.path.w,h:n.path.h,steps:h}}:n.geometry===void 0?{}:{geometry:n.geometry,...n.adjustments?{adjustments:[...n.adjustments]}:{}},...s?{line:n.line===void 0?ee.line:z(n.line),line_width:n.line_width===void 0?ee.line_width:S(n.line_width)}:{fill:n.fill===void 0?C.fill:z(n.fill),line:n.line===void 0?C.line:z(n.line),line_width:n.line_width===void 0?C.line_width:S(n.line_width)},...n.text&&!s?{fileText:{...n.text}}:{},...s?{}:{text:{paragraphs:paragraphsOfWords(o(`${r}.${g}.${e}`)).map(k=>n.text?.align===void 0?{alignment:C.alignment,...k}:k),style:B(le(_,G(ae)),n.text),own:X(G(ae)),empty:!1}},sources:{...d,fill:{from:"slide",path:`${a}.fill`}}}}if(n.component!==void 0){const s=Y(n.component,n.props,$);return s?{...b,kind:"component",component:s,sources:d}:void 0}},R=(e,n,a)=>{if(n.frame&&(e.frame=ue(n.frame),e.sources.frame={from:"slide",path:`${a}.frame`}),Object.assign(e,ce(n)),n.text&&e.text&&(e.text.style=B(e.text.style,n.text),e.text.paragraphs=Me(e.text.paragraphs,n.text),e.fileText={...n.text},e.sources.text={from:"slide",path:`${a}.text`}),n.line!==void 0&&(e.line=z(n.line),e.sources.line={from:"slide",path:`${a}.line`}),n.line_width!==void 0&&(e.line_width=S(n.line_width)),n.line_dash!==void 0&&(e.line_dash=n.line_dash),n.line_begin!==void 0&&(e.line_begin=n.line_begin),n.line_end!==void 0&&(e.line_end=n.line_end),n.fill!==void 0&&(e.fill=z(n.fill),e.sources.fill={from:"slide",path:`${a}.fill`}),Object.assign(e,Z(n)),(n.picture!==void 0||n.movie!==void 0)&&(e.placeholder?.type==="pic"||e.placeholder?.type==="media"||e.placeholder?.type==="obj")){const g=he(n.crop);e.kind=n.picture!==void 0?"picture":"movie",e.media={path:joinPath(y,n.picture??n.movie??""),...g?{crop:g}:{},...n.poster===void 0?{}:{poster:n.poster}},e.sources.media={from:"slide",path:`${a}.${n.picture!==void 0?"picture":"movie"}`},delete e.text}},D=(e,n,a,g,_)=>{const $=M.get(n);if(!$){l.push({slide:e,path:`slides.${String(a)}.layout`,message:`Slide ${e} is on the layout "${n}", which slides.ts does not have (it has ${[...M.keys()].join(", ")||"none"}).`});return}const{layout:w,master:d}=$,b=[...(w.display_master_shapes===!1?[]:d.shapes).filter(s=>s.kind!=="placeholder").map(s=>N(s,"master",d)),...w.shapes.filter(s=>s.kind!=="placeholder").map(s=>N(s,"layout",d))],h=w.shapes.filter(s=>s.kind==="placeholder").map((s,k)=>({shape:P(s,d),order:k}));return{slide:{id:e,layout:w.name,master:d.name,hidden:g,background:w.background??d.background,shapes:b,animations:[],file:{index:a,..._===void 0?{}:{generate:_}}},placed:h,master:d}},q=(e,n,a,g,_,$,w,d,b,h=()=>{})=>{const s=new Set(a.map(f=>f.shape.name));let k=a.length;for(const[f,c]of Object.entries(g??{})){const p=$(f);if(p===void 0)continue;const v=`${_}.shapes.${f}`,E=c.textbox!==void 0||c.geometry!==void 0||c.path!==void 0||c.table!==void 0||c.chart!==void 0||c.component!==void 0||(c.picture!==void 0||c.movie!==void 0)&&!s.has(p),A=a.find(me=>me.shape.name===p);if(A&&!E){R(A.shape,c,v),A.shown=!0,c.z!==void 0&&(A.z=c.z);continue}if(A){l.push({slide:e.id,shape:p,path:v,message:`Slide ${e.id} has a ${A.shape.kind} ${p} already: a shape of its own needs another name.`});continue}if(!E){l.push({slide:e.id,shape:p,path:v,message:`Slide ${e.id} has no shape ${p} to change (its layout's placeholders and its own shapes are ${[...s].join(", ")||"none"}).`});continue}const j=L(p,c,v,e.id,n);j&&(a.push({shape:j,order:k++,...c.z===void 0?{}:{z:c.z}}),s.add(p))}const m=a.filter(f=>f.shown===!0||!Pe.has(f.shape.placeholder?.type??"")||w(f.shape)!==void 0);a.splice(0,a.length,...m),a.sort((f,c)=>(f.z??0)-(c.z??0)||f.order-c.order);const x=new Map(a.flatMap((f,c)=>f.shape.group===void 0?[]:[[f.shape.group,c]])),O=a.flatMap((f,c)=>{const p=f.shape.group;return p===void 0?[f]:x.get(p)===c?a.filter(v=>v.shape.group===p):[]});a.splice(0,a.length,...O);for(const f of a){const c=h(f.shape);c!==void 0&&(f.shape.alt=c);const p=f.shape.text;if(f.shape.kind==="placeholder"&&p){const v=w(f.shape);p.paragraphs=paragraphsOfWords(v,0,F.fonts.code),p.empty=p.paragraphs.length===0||p.paragraphs.every(E=>E.runs.every(A=>A.text===""))}}e.shapes.push(...a.map(f=>f.shape)),d!==void 0&&d.trim()!==""&&(e.notes=d);for(const[f,c]of(b??[]).entries()){const p=$(c.shape);if(p===void 0)continue;const v={slide:e.id,shape:p,path:`${_}.animations.${String(f)}`},E=e.shapes.find(j=>j.name===p&&j.level==="slide");if(!E){l.push({...v,message:`Slide ${e.id} has no shape ${p} to animate (it has ${e.shapes.filter(j=>j.level==="slide").map(j=>j.name).join(", ")}).`});continue}if(c.paragraph!==void 0&&c.paragraph>=(E.text?.paragraphs.length??0)){l.push({...v,message:`Shape ${p} has no paragraph ${String(c.paragraph)} to animate (it has ${String(E.text?.paragraphs.length??0)}).`});continue}const A=we({...c,shape:p});A?e.animations.push(A):l.push({...v,message:`The animation of ${p} needs a path that starts with M and says only M, L and C, absolute.`})}},J=new Set;return u.slides.forEach((e,n)=>{const a=`slides.${String(n)}`;if(e.layout!==void 0){const d=D(e.id,e.layout,n,e.hidden===!0);if(!d)return;const b=o(`${r}.${e.id}.notes`);e.transition&&(d.slide.transition=ie(e.transition)),e.advance_after!==void 0&&(d.slide.advance=e.advance_after),pe(d.slide,e.background,y),q(d.slide,d.master,d.placed,e.shapes,a,h=>h,h=>o(`${r}.${e.id}.${h.name}`),typeof b=="string"?b:void 0,e.animations,h=>{const s=o(`${r}.${e.id}.alt.${h.name}`);return typeof s=="string"?s:void 0}),T.push(d.slide),J.add(e.id);return}const g=e.generate??"",_=t.generators[g];if(_===void 0){l.push({slide:e.id,path:`${a}.generate`,message:`There is no generator ${g} in slides.ts (it has ${Object.keys(t.generators).join(", ")||"none"}).`});return}if(!Array.isArray(_)){l.push({slide:e.id,path:`${a}.generate`,message:`Generator ${g} threw: ${_.error}`,..._.stack===void 0?{}:{stack:_.stack}});return}const $=_,w=new Set(Array.isArray(e.hidden)?e.hidden:[]);for(const d of $){const b=`${e.id}/${d.id}`,h=D(b,d.layout,n,w.has(d.id),g);if(!h)continue;for(const m of d.shapes){const x=m.placeholder?h.placed.find(O=>O.shape.placeholder?.idx===m.placeholder?.idx):void 0;if(x)m.frame&&(x.shape.frame={...m.frame}),x.shape.sources.frame={from:"code"},x.shown=!0;else{const O=N(m,"layout",h.master);h.placed.push({shape:{...O,level:"slide",sources:{frame:{from:"code"}}},order:h.placed.length})}}const s=`${d.id}/`,k=d.transition??(d===$[0]?e.transition:void 0);pe(h.slide,e.background,y),k&&(h.slide.transition=ie(k)),q(h.slide,h.master,h.placed,e.shapes,a,m=>m.startsWith(s)?m.slice(s.length):void 0,m=>{const x=m.placeholder===void 0?void 0:d.text[m.placeholder.idx];return x===void 0?void 0:x.map(O=>O.runs.map(f=>f.text).join(""))},d.notes,[...(d.animations??[]).map(m=>({...m,shape:`${s}${m.shape}`})),...e.animations??[]]);for(const m of h.slide.shapes){const x=m.placeholder===void 0?void 0:d.text[m.placeholder.idx];x&&m.text&&(m.text.paragraphs=x,m.text.empty=!1)}T.push(h.slide),J.add(b)}for(const d of Object.keys(e.shapes??{})){const[b]=d.split("/");b!==void 0&&!$.some(h=>h.id===b)&&l.push({slide:e.id,path:`${a}.shapes.${d}`,message:`Generator ${g} makes no slide ${b}: ${d} changes nothing.`})}}),T.forEach((e,n)=>{for(const a of e.shapes)a.placeholder?.type==="sldNum"&&a.text&&(a.text.paragraphs=[{level:0,runs:[{text:String(n+1),field:"slidenum"}]}],a.text.empty=!1)}),{deck:{width:t.slide_width,height:t.slide_height,theme:F,slides:T},problems:l}}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type ScriptFile, type ScriptText } from "@allyhub-next/formats";
|
|
2
|
+
import { type Document } from "yaml";
|
|
3
|
+
import type { Words } from "./resolve.js";
|
|
2
4
|
/** A slide's speaker notes: a line, or a plural. */
|
|
3
5
|
type Notes = NonNullable<ScriptFile["slides"][number]["notes"]>;
|
|
4
6
|
export type DeckScriptEdit =
|
|
@@ -8,6 +10,13 @@ export type DeckScriptEdit =
|
|
|
8
10
|
slide: string;
|
|
9
11
|
shape: string;
|
|
10
12
|
words: ScriptText | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** A picture's or a shape's alternative text (`p:cNvPr/@descr`); undefined takes it away. */
|
|
15
|
+
| {
|
|
16
|
+
op: "alt";
|
|
17
|
+
slide: string;
|
|
18
|
+
shape: string;
|
|
19
|
+
alt: string | undefined;
|
|
11
20
|
} | {
|
|
12
21
|
op: "notes";
|
|
13
22
|
slide: string;
|
|
@@ -18,26 +27,19 @@ export type DeckScriptEdit =
|
|
|
18
27
|
op: "remove";
|
|
19
28
|
slide: string;
|
|
20
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* A script's words of a key, as resolveDeck asks them
|
|
32
|
+
* (`<prefix>.<slide>.<shape>`, or `.notes`): what the editor and a
|
|
33
|
+
* snapshot's recorder resolve a deck's slides with.
|
|
34
|
+
*/
|
|
35
|
+
export declare function scriptWords(script: ScriptFile, prefix: string): (key: string) => Words;
|
|
21
36
|
/** A script's text read; undefined when it is not a script. */
|
|
22
37
|
export declare function readScript(text: string): ScriptFile | undefined;
|
|
23
38
|
/** The script's text after an edit. */
|
|
24
39
|
export declare function editDeckScript(text: string | undefined, edit: DeckScriptEdit): string;
|
|
25
|
-
/**
|
|
40
|
+
/** An edit made on the script's parsed document, in place: only the nodes it changes are touched. */
|
|
41
|
+
export declare function editDeckScriptDocument(doc: Document, edit: DeckScriptEdit): void;
|
|
42
|
+
/** What `b` changes of `a`'s slides' words, alternative text and notes, as edits. */
|
|
26
43
|
export declare function deckScriptEdits(a: ScriptFile, b: ScriptFile): DeckScriptEdit[];
|
|
27
|
-
/** Where a person's words met another hand's: the person's stand. */
|
|
28
|
-
export interface DeckScriptConflict {
|
|
29
|
-
slide: string;
|
|
30
|
-
/** The shape whose words both changed; absent for the notes. */
|
|
31
|
-
shape?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* A person's script (`mine`, made from `base`) merged into the script as
|
|
35
|
-
* another hand left it (`theirs`), as mergeSlides merges slides.yaml.
|
|
36
|
-
* Undefined when theirs is not a script.
|
|
37
|
-
*/
|
|
38
|
-
export declare function mergeDeckScript(base: string, mine: ScriptFile, theirs: string): {
|
|
39
|
-
text: string;
|
|
40
|
-
conflicts: DeckScriptConflict[];
|
|
41
|
-
} | undefined;
|
|
42
44
|
export {};
|
|
43
45
|
//# sourceMappingURL=script.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{readDataFile as
|
|
3
|
-
`:
|
|
2
|
+
import{readDataFile as S}from"@allyhub-next/formats";import{isCollection as m,isMap as c,isSeq as w,parseDocument as g}from"yaml";export function scriptWords(s,e){const n=new Map(s.slides.map(r=>[r.id,r]));return r=>{if(!r.startsWith(`${e}.`))return;const f=r.slice(e.length+1),t=f.lastIndexOf(".");if(t<0)return;const o=n.get(f.slice(0,t)),l=f.slice(t+1);return l==="notes"?typeof o?.notes=="string"?o.notes:void 0:o?.text?.[l]}}export function readScript(s){const e=g(s);if(e.errors.length>0)return;const n=S("script",e.toJS()??{});return n.ok?n.value:void 0}function k(s){let e=s.get("slides",!0);if(w(e)||(c(s.contents)?s.set("slides",s.createNode([])):s.contents=s.createNode({slides:[]}),e=s.get("slides",!0)),!w(e))throw new Error("The script has no slides list.");return e.flow===!0&&(e.flow=!1),e}function x(s,e){!m(s)||!m(e)||(e.flow===!0&&(s.flow=!0),s.items.forEach((n,r)=>{x(n,e.items[r])}))}export function editDeckScript(s,e){const n=g(s===void 0||s.trim()===""?`slides: []
|
|
3
|
+
`:s);if(n.errors.length>0)throw new Error("The script is not YAML: it is mended by hand first.");return editDeckScriptDocument(n,e),n.toString()}export function editDeckScriptDocument(s,e){const n=k(s),r=n.items.findIndex(o=>c(o)&&o.get("id")===e.slide);if(e.op==="remove"){r>=0&&n.items.splice(r,1);return}const f=e.op==="text"?e.words===void 0:e.op==="alt"?e.alt===void 0:e.notes===void 0;if(r<0&&f)return;let t=n.items[r];if(c(t)||(n.items.push(s.createNode({id:e.slide})),t=n.items.at(-1)),!!c(t)){if(e.op==="notes")e.notes===void 0?t.delete("notes"):t.set("notes",s.createNode(e.notes));else if(e.op==="alt")if(e.alt===void 0){t.deleteIn(["alt",e.shape]);const o=t.get("alt",!0);c(o)&&o.items.length===0&&t.delete("alt")}else t.setIn(["alt",e.shape],e.alt);else if(e.words===void 0){t.deleteIn(["text",e.shape]);const o=t.get("text",!0);c(o)&&o.items.length===0&&t.delete("text")}else{const o=s.createNode(e.words);x(o,t.getIn(["text",e.shape],!0)),t.setIn(["text",e.shape],o)}t.items.length===1&&n.items.splice(n.items.indexOf(t),1)}}const a=s=>JSON.stringify(s);export function deckScriptEdits(s,e){const n=[],r=new Map(s.slides.map(t=>[t.id,t])),f=new Map(e.slides.map(t=>[t.id,t]));for(const t of r.keys())f.has(t)||n.push({op:"remove",slide:t});for(const[t,o]of f){const l=r.get(t),p=l?.text??{},u=o.text??{};for(const i of new Set([...Object.keys(p),...Object.keys(u)]))a(p[i])!==a(u[i])&&n.push({op:"text",slide:t,shape:i,words:u[i]});const h=l?.alt??{},d=o.alt??{};for(const i of new Set([...Object.keys(h),...Object.keys(d)]))h[i]!==d[i]&&n.push({op:"alt",slide:t,shape:i,alt:d[i]});a(l?.notes)!==a(o.notes)&&n.push({op:"notes",slide:t,notes:o.notes})}return n}
|
|
@@ -1,63 +1,61 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { DeckCode } from "./code.js";
|
|
2
|
+
import type { ResolvedDeck } from "./resolve.js";
|
|
3
|
+
import type { Theme } from "./theme.js";
|
|
4
|
+
/** A component drawn alone, on a transparent page of its frame's size. */
|
|
5
|
+
export interface ComponentAt {
|
|
6
|
+
name: string;
|
|
7
|
+
props: Record<string, unknown>;
|
|
8
|
+
/** Its frame, in the stage's pixels. */
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
/** Seconds since it came on: what moves in it has settled by its slide's still. */
|
|
12
|
+
t: number;
|
|
6
13
|
}
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
/** The editor to a frame. */
|
|
15
|
+
export type DeckHostCommand =
|
|
16
|
+
/** The code host: the deck's code as data (asked any time after the frame is made). */
|
|
9
17
|
{
|
|
10
|
-
type: "deck-
|
|
11
|
-
shape: string;
|
|
12
|
-
frame: Frame | null;
|
|
18
|
+
type: "deck-code";
|
|
13
19
|
}
|
|
14
|
-
/**
|
|
20
|
+
/** A component frame: draw this (asked any time after the frame is made; each draw replaces the last). */
|
|
21
|
+
| ({
|
|
22
|
+
type: "component";
|
|
23
|
+
} & ComponentAt)
|
|
24
|
+
/** The player: the deck as the editor resolved it now, for the same code; media it shows that the stage was not given, by project path. */
|
|
15
25
|
| {
|
|
16
|
-
type: "deck-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
/** The word at the point selected, as a double click does. */
|
|
23
|
-
word?: boolean;
|
|
24
|
-
/** Words typed on arrival, past what it says: the key that started it. */
|
|
25
|
-
text?: string;
|
|
26
|
-
cell?: readonly [row: number, col: number];
|
|
27
|
-
}
|
|
28
|
-
/** Typing goes on though the focus leaves: the editor's bar is about to act on the selected words. */
|
|
29
|
-
| {
|
|
30
|
-
type: "deck-hold";
|
|
31
|
-
}
|
|
32
|
-
/** The selected words made bold or not, or a colour (a theme colour or `#RRGGBB`). */
|
|
33
|
-
| {
|
|
34
|
-
type: "deck-format";
|
|
35
|
-
bold?: boolean;
|
|
36
|
-
italic?: boolean;
|
|
37
|
-
color?: string;
|
|
38
|
-
}
|
|
39
|
-
/** Stop typing. */
|
|
40
|
-
| {
|
|
41
|
-
type: "deck-stop";
|
|
26
|
+
type: "deck-update";
|
|
27
|
+
deck: ResolvedDeck;
|
|
28
|
+
media?: Record<string, {
|
|
29
|
+
url: string;
|
|
30
|
+
duration?: number;
|
|
31
|
+
}>;
|
|
42
32
|
};
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
/** A frame to the editor. */
|
|
34
|
+
export type DeckHostMessage =
|
|
35
|
+
/**
|
|
36
|
+
* The deck's code as data, and the theme under the deck's own that the
|
|
37
|
+
* stage resolves it with (the project's look): resolveDeck's `code` and
|
|
38
|
+
* `theme`. Said once unasked as soon as it is run, and to each ask.
|
|
39
|
+
*/
|
|
45
40
|
{
|
|
46
|
-
type: "deck-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
bold: boolean;
|
|
50
|
-
italic: boolean;
|
|
41
|
+
type: "deck-code";
|
|
42
|
+
code: DeckCode;
|
|
43
|
+
theme: Theme;
|
|
51
44
|
} | {
|
|
52
|
-
type: "
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
type: "component-ready";
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The player drew the update in place: the slides it drew again.
|
|
49
|
+
* `reload`: the slides' timing changed (an animation, a transition, a
|
|
50
|
+
* movie, a slide added or moved), which a player cannot take in place:
|
|
51
|
+
* the editor loads a new stage.
|
|
52
|
+
*/
|
|
53
|
+
| {
|
|
54
|
+
type: "deck-updated";
|
|
55
|
+
redrawn: string[];
|
|
56
|
+
reload?: true;
|
|
57
57
|
} | {
|
|
58
|
-
type: "
|
|
59
|
-
|
|
60
|
-
paragraphs: TypedParagraph[];
|
|
61
|
-
cell?: readonly [row: number, col: number];
|
|
58
|
+
type: "error";
|
|
59
|
+
message: string;
|
|
62
60
|
};
|
|
63
61
|
//# sourceMappingURL=stage.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{closest as e,publicNames as
|
|
2
|
+
import{closest as e,publicNames as o,strict as c,strictEnum as n}from"@allyhub-next/formats";import{held as l}from"./units.js";const r="allyhub slides capabilities lists what of python-pptx the API holds and where it differs.";export{e as closest,o as publicNames};export function strict(t,i,s={}){return c(t,i,r,{value:l,...s})}export function strictEnum(t,i){return n(t,i,r)}
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
export type Length = number;
|
|
2
|
+
/** What python-pptx's `Length` says of itself. */
|
|
3
|
+
export interface LengthUnits {
|
|
4
|
+
readonly emu: number;
|
|
5
|
+
readonly inches: number;
|
|
6
|
+
readonly cm: number;
|
|
7
|
+
readonly mm: number;
|
|
8
|
+
readonly pt: number;
|
|
9
|
+
readonly centipoints: number;
|
|
10
|
+
readonly twips: number;
|
|
11
|
+
}
|
|
12
|
+
/** python-pptx's `Length`: a number of EMU, in other units too. */
|
|
13
|
+
export type LengthValue = Length & LengthUnits;
|
|
14
|
+
/** A number of EMU as python-pptx's Length. */
|
|
15
|
+
export declare function length(emu: number): LengthValue;
|
|
16
|
+
/** A Length, or nothing. */
|
|
17
|
+
export declare const lengthOr: (emu: number | undefined) => LengthValue | undefined;
|
|
18
|
+
/** What the API is given, as it holds it: a Length as its number, a String (`new RGBColor(…)`) as its text; anything else as it is. */
|
|
19
|
+
export declare const held: (v: unknown) => unknown;
|
|
20
|
+
/** python-pptx's length functions as a deck's code has them: each gives a Length. */
|
|
21
|
+
export declare const LENGTH_UNITS: {
|
|
22
|
+
Emu: (n: number) => LengthValue;
|
|
23
|
+
Inches: (n: number) => LengthValue;
|
|
24
|
+
Pt: (n: number) => LengthValue;
|
|
25
|
+
Cm: (n: number) => LengthValue;
|
|
26
|
+
Mm: (n: number) => LengthValue;
|
|
27
|
+
Centipoints: (n: number) => LengthValue;
|
|
28
|
+
};
|
|
2
29
|
export declare const EMU_PER_INCH = 914400;
|
|
3
30
|
export declare const EMU_PER_PT = 12700;
|
|
4
31
|
export declare const EMU_PER_CM = 360000;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export const EMU_PER_INCH=914400,EMU_PER_PT=12700,EMU_PER_CM=36e4,EMU_PER_MM=36e3,EMU_PER_CENTIPOINT=127,Emu=t=>Math.trunc(t),Inches=t=>Math.trunc(t*
|
|
2
|
+
class o extends Number{get emu(){return this.valueOf()}get inches(){return this.valueOf()/EMU_PER_INCH}get cm(){return this.valueOf()/EMU_PER_CM}get mm(){return this.valueOf()/EMU_PER_MM}get pt(){return this.valueOf()/EMU_PER_PT}get centipoints(){return Math.trunc(this.valueOf()/EMU_PER_CENTIPOINT)}get twips(){return Math.trunc(this.valueOf()/(EMU_PER_PT/20))}}const r=new Map;export function length(t){const n=Math.trunc(t);let e=r.get(n);return e||(e=new o(n),r.set(n,e)),e}export const lengthOr=t=>t===void 0?void 0:length(t),held=t=>t instanceof Number||t instanceof String?t.valueOf():t,LENGTH_UNITS={Emu:t=>length(t),Inches:t=>length(t*EMU_PER_INCH),Pt:t=>length(t*EMU_PER_PT),Cm:t=>length(t*EMU_PER_CM),Mm:t=>length(t*EMU_PER_MM),Centipoints:t=>length(t*EMU_PER_CENTIPOINT)},EMU_PER_INCH=914400,EMU_PER_PT=12700,EMU_PER_CM=36e4,EMU_PER_MM=36e3,EMU_PER_CENTIPOINT=127,Emu=t=>Math.trunc(t),Inches=t=>Math.trunc(t*EMU_PER_INCH),Pt=t=>Math.trunc(t*EMU_PER_PT),Cm=t=>Math.trunc(t*EMU_PER_CM),Mm=t=>Math.trunc(t*EMU_PER_MM),Centipoints=t=>Math.trunc(t*EMU_PER_CENTIPOINT),toPt=t=>Math.round(t/EMU_PER_PT*100)/100,SLIDE_SIZES={"16:9":[Emu(12192e3),Emu(6858e3)],"16:10":[Emu(9144e3),Emu(5715e3)],"4:3":[Emu(9144e3),Emu(6858e3)],a4:[Mm(297),Mm(210)],"a4-portrait":[Mm(210),Mm(297)],letter:[Inches(11),Inches(8.5)],"letter-portrait":[Inches(8.5),Inches(11)],"1:1":[Emu(6858e3),Emu(6858e3)],"4:5":[Emu(6858e3),Emu(8572500)],"9:16":[Emu(6858e3),Emu(12192e3)]};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const isRecord: (v: unknown) => v is Record<string, unknown>;
|
|
2
|
+
/** A value's JSON, its keys in order: two values are the same when theirs are. */
|
|
3
|
+
export declare const valueKey: (v: unknown) => string;
|
|
4
|
+
export declare const sameValue: (a: unknown, b: unknown) => boolean;
|
|
5
|
+
/** The pairs of places, `a`'s and `b`'s, where the two hold the same key: a longest common subsequence, in order. */
|
|
6
|
+
export declare function commonPairs(a: readonly string[], b: readonly string[]): [number, number][];
|
|
7
|
+
//# sourceMappingURL=values.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{diffArrays as f}from"diff";export const isRecord=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);const n=e=>Array.isArray(e)?e.map(n):isRecord(e)?Object.fromEntries(Object.entries(e).filter(([,o])=>o!==void 0).sort(([o],[r])=>o<r?-1:o>r?1:0).map(([o,r])=>[o,n(r)])):e;export const valueKey=e=>e===void 0?"":JSON.stringify(n(e)),sameValue=(e,o)=>valueKey(e)===valueKey(o);export function commonPairs(e,o){const r=[];let s=0,c=0;for(const t of f([...e],[...o]))if(t.added)c+=t.count;else if(t.removed)s+=t.count;else for(let i=0;i<t.count;i++)r.push([s++,c++]);return r}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{changesOf as
|
|
3
|
-
${y(
|
|
4
|
-
${
|
|
2
|
+
import{changesOf as K}from"./anchors.js";import{normText as p,joinWords as V,ScriptAlignment as v,WordStream as F}from"./words.js";import{speechWords as D}from"./speech.js";export const CAPTION_CUE_DEFAULTS={maxChars:42,maxCharsCjk:16,minSeconds:.8,maxSeconds:6,gapFrames:2};export function speechLines(c,s,i){return c.parts.flatMap(r=>{const o=r.speech,h=o?i[o.file]?.words:void 0;if(!o||!h?.length)return[];const a=D(h,o);if(a.length===0)return[];const n=s.find(t=>t.key===r.key),e=n?.spoken??V(a);return[{part:r.key,shown:e,spoken:n?.speak??e,words:a}]})}export function shownToSpoken(c,s){const i=(o,h)=>p(o.slice(0,h)).length,r=[[0,0]];for(const o of K(c,s))r.push([i(c,o.at),i(s,o.into)]),r.push([i(c,o.at+o.removed),i(s,o.into+o.inserted)]);return r.push([p(c).length,p(s).length]),o=>{for(let h=1;h<r.length;h++){const[a,n]=r[h-1]??[0,0],[e,t]=r[h]??[0,0];if(o>e&&h<r.length-1)continue;if(e<=a)return o<=a?n:t;const u=Math.max(0,Math.min(1,(o-a)/(e-a)));return n+(t-n)*u}return 0}}const b=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,G=/[。!?!?…]|\.(?=\s|$)/u,J=/[,、;:,;:—]/u,H=/[,、;:。,;:.\s]+$/u,P=(c,s)=>/[.,:;]/u.test(c[s]??"")&&/[0-9A-Za-z]/u.test(c[s+1]??"");export function keptSpans(c,s){const i=[],r=U(c).map(o=>({...o,n:p(o.w)}));for(const o of s){const h=p(o);if(!h)continue;if(b.test(o)){const n=[];Array.from(c).reduce((t,u)=>(p(u)&&n.push(t),t+u.length),0);const e=p(c);for(let t=e.indexOf(h);t>=0;t=e.indexOf(h,t+1)){const u=n[t],g=n[t+h.length-1];u!==void 0&&g!==void 0&&i.push([u,g+1])}continue}const a=o.split(/\s+/u).map(p).filter(Boolean);for(let n=0;n+a.length<=r.length;n++)if(a.every((e,t)=>r[n+t]?.n===e)){const e=r[n],t=r[n+a.length-1];e&&t&&i.push([e.from,t.to])}}return i}const _=(c,s)=>c.some(([i,r])=>s>i&&s<r);export function splitLine(c,s=b.test(c)?CAPTION_CUE_DEFAULTS.maxCharsCjk:CAPTION_CUE_DEFAULTS.maxChars,i=[]){const r=[],o=(a,n)=>{const e=c.slice(a,n),t=e.length-e.trimStart().length,u=e.trim();u&&r.push({text:u,from:a+t,to:a+t+u.length})},h=(a,n,e)=>{const t=c.slice(a,n);if(Array.from(t.trim()).length<=s){o(a,n);return}const g=e===0?G:e===1?J:void 0;if(g){let f=-1;for(let k=1;k<t.length-1;k++)g.test(t[k]??"")&&!P(t,k)&&!_(i,a+k+1)&&(f<0||Math.abs(k-t.length/2)<Math.abs(f-t.length/2))&&(f=k);if(f<0){h(a,n,e+1);return}h(a,a+f+1,e),h(a+f+1,n,e);return}const w=Math.floor(t.length/2),C=f=>f>0&&f<t.length&&!_(i,a+f);let x=-1;if(!b.test(t)){for(let f=w;f>0&&x<0;f--)t[f]===" "&&C(f)&&(x=f);for(let f=w;f<t.length&&x<0;f++)t[f]===" "&&C(f)&&(x=f)}for(let f=0;f<=t.length&&x<0;f++)C(w-f)?x=w-f:C(w+f)&&(x=w+f);if(x<0){o(a,n);return}h(a,a+x,e),h(a+x,n,e)};return h(0,c.length,0),r}export function captionCues(c,s={}){const{lines:i,fps:r}=c,o={...CAPTION_CUE_DEFAULTS,...s},h=[];for(const t of i){if(t.words.length===0)continue;const u=t.words,g=new v(new F(u),[t.spoken]),w=(M,l)=>{const d=u[g.wordAtChar(0,M)];return d?l?d.end:d.start:0};if((g.lines[0]?.length??0)===0)continue;const f=p(t.shown)===p(t.spoken)?M=>M:shownToSpoken(t.shown,t.spoken),k=b.test(t.shown)?o.maxCharsCjk:o.maxChars;for(const M of splitLine(t.shown,k)){const l=Math.round(f(p(t.shown.slice(0,M.from)).length)),d=Math.round(f(p(t.shown.slice(0,M.to)).length)),S=w(l,!1),A=w(Math.max(l,d-1),!0),T=b.test(M.text)?M.text.replace(H,""):M.text.replace(/[,;:]+$/u,"");T&&h.push({start:S,end:Math.max(A,S),text:T,part:t.part})}}const a=1/r,n=t=>Math.round(t*r)/r,e=h.map(t=>({...t,start:n(t.start),end:n(t.end)}));for(let t=0;t<e.length;t++){const u=e[t];if(!u)continue;const g=e[t+1],w=g?g.start-o.gapFrames*a:1/0;u.end=Math.min(Math.max(u.end,u.start+o.minSeconds),u.start+o.maxSeconds,w),u.end<=u.start&&(u.end=u.start+a)}return e}export function subtitleCues(c,s){return s===void 0?captionCues(c):wordCues(c.lines,{...s,fps:c.fps}).map(i=>({start:i.start,end:i.end,text:i.text,part:i.part}))}function U(c){const s=[],i=/\S+/gu;for(let r=i.exec(c);r;r=i.exec(c))s.push({w:r[0],from:r.index,to:r.index+r[0].length});return s}export function wordCues(c,s){const{fps:i}=s,r=[];for(const n of c){if(n.words.length===0)continue;const e=n.words,t=new v(new F(e),[n.spoken]);if((t.lines[0]?.length??0)===0)continue;const g=(l,d)=>{const S=e[t.wordAtChar(0,l)];return S?d?S.end:S.start:0},C=p(n.shown)===p(n.spoken)?l=>l:shownToSpoken(n.shown,n.spoken),x=(l,d)=>{const S=Math.round(C(p(n.shown.slice(0,l)).length)),A=Math.round(C(p(n.shown.slice(0,d)).length));return[g(S,!1),g(Math.max(S,A-1),!0)]},f=b.test(n.shown),k=s.maxChars??(f?16:32),M=keptSpans(n.shown,s.keep??[]);for(const l of splitLine(n.shown,k,M)){const d=(f?[{w:l.text,from:l.from,to:l.to}]:U(n.shown.slice(l.from,l.to)).map(m=>({w:m.w,from:m.from+l.from,to:m.to+l.from}))).filter(m=>p(m.w)!=="");if(d.length===0)continue;const S=s.maxWords&&s.maxWords>0?s.maxWords:d.length,A=Math.ceil(d.length/S),T=Math.ceil(d.length/A),O=[];d.forEach((m,L)=>{const W=d[L-1],j=O.at(-1);j&&W&&_(M,Math.ceil((W.to+m.from)/2))?j.push(m):O.push([m])});const I=[];let $=[];for(const m of O)$.length>0&&$.length+m.length>T&&(I.push($),$=[]),$.push(...m);$.length>0&&I.push($);for(const m of I){const L=m.map(E=>{const[N,B]=x(E.from,E.to);return{text:E.w,start:N,end:Math.max(B,N)}}),W=L[0],j=L.at(-1);if(!W||!j)continue;const z=m.map(E=>E.w).join(f?"":" ").replace(f?H:/[,;:]+$/u,"");r.push({start:W.start,end:j.end,text:z,part:n.part,words:L})}}}const o=n=>Math.round(n*i)/i,h=1/i,a=r.map(n=>({...n,start:o(n.start),end:o(n.end)}));for(let n=0;n<a.length;n++){const e=a[n];if(!e)continue;const t=a[n+1],u=t?.part===e.part;t&&u&&t.start-e.end<(s.close??.4)&&(e.end=t.start),e.end=Math.max(e.end,e.start+Math.min(.5,6*h)),t&&e.end>t.start&&(e.end=t.start),e.end<=e.start&&(e.end=e.start+h)}return a}export function cuesIn(c,s,i){const r=o=>Math.round(o*1e6)/1e6;return c.filter(o=>o.end>s&&o.start<i).map(o=>({start:r(Math.max(o.start,s)-s),end:r(Math.min(o.end,i)-s),text:o.text,words:o.words.map(h=>({text:h.text,start:r(h.start-s),end:r(h.end-s)}))}))}const y=(c,s)=>{const i=Math.round(c*1e3),r=Math.floor(i/36e5),o=Math.floor(i/6e4)%60,h=Math.floor(i/1e3)%60,a=(n,e=2)=>String(n).padStart(e,"0");return`${a(r)}:${a(o)}:${a(h)}${s}${a(i%1e3,3)}`};export function toSrt(c){return c.map((s,i)=>`${String(i+1)}
|
|
3
|
+
${y(s.start,",")} --> ${y(s.end,",")}
|
|
4
|
+
${s.text}
|
|
5
5
|
`).join(`
|
|
6
|
-
`)}export function toVtt(
|
|
6
|
+
`)}export function toVtt(c){return`WEBVTT
|
|
7
7
|
|
|
8
|
-
${
|
|
9
|
-
${
|
|
8
|
+
${c.map(s=>`${y(s.start,".")} --> ${y(s.end,".")}
|
|
9
|
+
${s.text}
|
|
10
10
|
`).join(`
|
|
11
11
|
`)}`}
|
|
@@ -899,7 +899,16 @@ export interface EdgePast {
|
|
|
899
899
|
side: "top" | "bottom" | "left" | "right";
|
|
900
900
|
px: number;
|
|
901
901
|
}
|
|
902
|
-
/**
|
|
902
|
+
/** An edge of a box and how far past a line it is, in points (a deck's). */
|
|
903
|
+
export interface DeckEdge {
|
|
904
|
+
side: "top" | "bottom" | "left" | "right";
|
|
905
|
+
pt: number;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Facts of a deck: what is measured of each slide as drawn (`deckFacts`,
|
|
909
|
+
* @allyhub-next/slides-core). Every length is in points, the unit
|
|
910
|
+
* slides.yaml is written in; a box is [x, y, w, h] from the slide's top left.
|
|
911
|
+
*/
|
|
903
912
|
export interface DeckFactData {
|
|
904
913
|
/** A shape's text past its box, by its lines' glyphs. */
|
|
905
914
|
"text-overflow": {
|
|
@@ -907,18 +916,27 @@ export interface DeckFactData {
|
|
|
907
916
|
text: string;
|
|
908
917
|
box: Box;
|
|
909
918
|
glyphs: Box;
|
|
910
|
-
edges:
|
|
919
|
+
edges: DeckEdge[];
|
|
911
920
|
/** Its lines, and those past the box. */
|
|
912
921
|
lines: number;
|
|
913
922
|
past: number;
|
|
914
923
|
/** The share autofit shrank it to, when it did and it still does not fit. */
|
|
915
924
|
scale?: number;
|
|
916
925
|
};
|
|
926
|
+
/** A shape's text the slide's edge cuts: its glyphs past the slide. */
|
|
927
|
+
"text-off-slide": {
|
|
928
|
+
shape: string;
|
|
929
|
+
text: string;
|
|
930
|
+
glyphs: Box;
|
|
931
|
+
edges: DeckEdge[];
|
|
932
|
+
/** The share of its glyphs' box outside the slide (0–1). */
|
|
933
|
+
share: number;
|
|
934
|
+
};
|
|
917
935
|
/** A shape partly or wholly past the slide's edge. */
|
|
918
936
|
"shape-off-slide": {
|
|
919
937
|
shape: string;
|
|
920
938
|
box: Box;
|
|
921
|
-
edges:
|
|
939
|
+
edges: DeckEdge[];
|
|
922
940
|
/** Its area past the edge, as a share of its own (0–1). */
|
|
923
941
|
share: number;
|
|
924
942
|
};
|
|
@@ -930,18 +948,38 @@ export interface DeckFactData {
|
|
|
930
948
|
"shape-overlap": {
|
|
931
949
|
a: string;
|
|
932
950
|
b: string;
|
|
933
|
-
/**
|
|
951
|
+
/** Square points both cover, and that as a share of the smaller (0–1). */
|
|
934
952
|
area: number;
|
|
935
953
|
share: number;
|
|
936
954
|
};
|
|
937
|
-
/**
|
|
955
|
+
/**
|
|
956
|
+
* Edges or centres of two shapes, or of a shape and the slide, nearly in
|
|
957
|
+
* line and not: where each line is, what it was measured by (a filled
|
|
958
|
+
* shape's or a picture's frame; an unfilled text's glyphs), and the
|
|
959
|
+
* frame's x or y that puts the one to move on the other's line.
|
|
960
|
+
*/
|
|
938
961
|
"near-alignment": {
|
|
939
962
|
a: string;
|
|
940
963
|
/** Another shape, or "slide" for the slide's centre. */
|
|
941
964
|
b: string;
|
|
942
965
|
line: "left" | "right" | "top" | "bottom" | "centre-x" | "centre-y";
|
|
943
|
-
/** How far apart
|
|
966
|
+
/** How far apart. */
|
|
944
967
|
gap: number;
|
|
968
|
+
/** Each one's line. */
|
|
969
|
+
at: {
|
|
970
|
+
a: number;
|
|
971
|
+
b: number;
|
|
972
|
+
};
|
|
973
|
+
by: {
|
|
974
|
+
a: "frame" | "glyphs";
|
|
975
|
+
b: "frame" | "glyphs";
|
|
976
|
+
};
|
|
977
|
+
/** The slide's own shape to move (a, unless a is a master's or a layout's), and its frame's `x` or `y` that aligns it. */
|
|
978
|
+
align: {
|
|
979
|
+
shape: string;
|
|
980
|
+
x?: number;
|
|
981
|
+
y?: number;
|
|
982
|
+
};
|
|
945
983
|
options: {
|
|
946
984
|
within: number;
|
|
947
985
|
aligned: number;
|
|
@@ -951,7 +989,7 @@ export interface DeckFactData {
|
|
|
951
989
|
"placement-drift": {
|
|
952
990
|
layout: string;
|
|
953
991
|
shape: string;
|
|
954
|
-
/** Each place,
|
|
992
|
+
/** Each place, with the slides it is at. */
|
|
955
993
|
places: {
|
|
956
994
|
frame: Box;
|
|
957
995
|
slides: string[];
|
|
@@ -1007,10 +1045,11 @@ export interface DeckFactData {
|
|
|
1007
1045
|
/** A picture drawn larger than its pixels, or stretched. */
|
|
1008
1046
|
"picture-resolution": {
|
|
1009
1047
|
shape: string;
|
|
1048
|
+
/** Its file's pixels, and those of them it shows (its crop taken away). */
|
|
1010
1049
|
source: [number, number];
|
|
1011
1050
|
shown: [number, number];
|
|
1012
1051
|
box: Box;
|
|
1013
|
-
/**
|
|
1052
|
+
/** Pixels of the slide as rendered per source pixel, the larger of the two directions (over 1: enlarged). */
|
|
1014
1053
|
scale: number;
|
|
1015
1054
|
/** Source pixels per inch of the slide, the smaller of the two directions. */
|
|
1016
1055
|
ppi: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{READ_DEFAULTS as
|
|
2
|
+
import{READ_DEFAULTS as d,boxRows as f,contentBox as l,freeBands as c,unionSpans as u,wordsAtOnce as m}from"./measure.js";export const FACT_KINDS={"text-speaker":"Text over the speaker's face box or person matte","text-off-frame":"Text the frame's edges cut: its glyphs outside the frame, in pixels and as a share","text-contrast":"Text against the pixels behind its glyphs: WCAG contrast ratios, the lowest, a low percentile and the median","text-covered":"Text in the area a platform's interface covers","text-overlap":"Text over text of another layer","text-overlap-own":"Text over text of the same layer","text-outside":"Text reaching outside a box it is drawn inside (a background, border or shadow)","text-time":"How long each text shows whole, against its words, and how large it is on a phone, with its lowercase letters' height","words-on-screen":"Words whole on screen at once in each part: the most, and every change","speech-on-screen":"Words a part says that show as text in it, and those that do not","footage-scale":"Footage enlargement: output pixels per source pixel, largest and smallest","free-bands":"Bands of the frame inside the covered edges that the speaker's face box or person matte leaves free","graphics-under-footage":"Graphic layers drawn under footage (listed before it), and how much of the frame the footage covers","flat-frames":"Runs of nearly flat frames unlike the picture around them","still-picture":"Stretches where the picture holds: how long, and how much changed in them","cut-seam":"How things move either side of each join: direction, speed and the change across; things named alike on both sides",flash:"Frames unlike both the frame before and the frame after: a flash, a blank frame, a layer for one frame","music-length":"Music length against video length","join-loudness":"Speech loudness either side of a join, or why it was not measured","matrix-coverage":"Matrix: combos asked for, possible and chosen, per candidate","generated-media":"Generated media (files with a .gen.json record) shown or played, and when","gen-mismatch":"A .gen.json record whose sha256 is not its file's, or that cannot be read",fallback:"Drawn or timed a fallback way: a face track, matte, take or music tempo missing","scenery-contact":"3D scenery: named objects that touch or cross, with the shared area, the crossing's length, how deep at least, the lift that clears them and the shared volume","scenery-support":"3D scenery: what each named object rests on, the gap below or how far it is sunk, its footprint in contact and its centre of mass against the contact","scenery-bake":"3D scenery: whether a scenery layer's scenery was drawn with its bake laid; when not, the scene's digest looked for, whether it was baked before (out of date) or never, and the command that makes it","mesh-health":"3D scenery: named objects whose surface is open, non-manifold, degenerate or crosses itself","camera-clearance":"3D scenery: a scenery layer's camera near a surface, inside an object, or cutting geometry with its near plane","camera-motion":"3D scenery: a scenery layer's camera motion in its own frame: peaks of truck, pedestal, dolly, pan, tilt, roll, zoom, speed, acceleration and jerk, smoothness, the largest step","scenery-screen":"3D scenery: a screen in a scenery layer: when it is on the frame, its share, how much its content is enlarged or shrunk, its angle to the view, how much is hidden in front of it, how blurred with an aperture, where it is drawn and at what scale, its smallest text on the frame as drawn and the speed of each stretch between cues","scenery-screen-fidelity":"3D scenery: a screen drawn in the scenery against its own element drawn flat: the colour difference, the share of pixels that differ, the regions where they differ and the elements in them the scenery's picture is known to draw otherwise","text-overflow":"A deck: a shape's text past its box, by its lines' glyphs: how far, and the lines past it","text-off-slide":"A deck: a shape's text the slide's edge cuts: how far its glyphs reach past it, and the share outside","shape-off-slide":"A deck: a shape partly or wholly past the slide's edge, and the share of it outside","shape-overlap":"A deck: two shapes of a slide over each other (not a master's or a layout's own under another), and by how much","near-alignment":"A deck: edges and centres of two shapes, or of a shape and the slide, nearly in line and not: each line, and the x or y that aligns them","placement-drift":"A deck: a shape of one name at different places on slides of one layout","type-in-use":"A deck: the text sizes and weights it uses, on how many slides each, and the smallest","read-size":"A deck: each text's size on the slide, on a phone, and with --room on a room's screen and at its farthest seat","words-on-slide":"A deck: words, lines and texts on each slide","sheet-error":"A sheet: cells whose value is an error, and whether the error starts there or is read from another","sheet-number":"A sheet: numbers written into a formula, each with what takes it, and how many cells hold the formula","sheet-unlike":"A sheet: a cell between neighbours that read alike, unlike them, and how long a run they make","sheet-exception":"A sheet: cells of a calculated column set apart from its formula","sheet-unused":"A sheet: defined names and typed numbers nothing reads (no formula, chart, rule, check or name)","sheet-invalid":"A sheet: cells that break their data validation","sheet-typed":"A sheet: numbers sheet.ts typed that neither its data nor its code holds, what it computed where a formula should","sheet-ordinary":"A sheet: a sheet sheet.ts makes and sheet.yaml holds too, sheet.yaml's standing","picture-resolution":"A deck: a picture drawn larger than its pixels, its pixels per inch, and how much it is stretched","shape-hidden":"A deck: a shape another covers whole at every build, or an animation that never shows its shape","chart-data":"A chart's numbers: how many, how far they run, and the file they came from","table-grown":"A deck: a table's rows its words made taller than they are set","deck-fonts":"A deck: the fonts its PowerPoint file names, and whether each is one every PowerPoint, Keynote and Google Slides has","cut-in-word":"A part playing a stretch of a video item cut inside one of its words"};export function isFactKind(e){return Object.hasOwn(FACT_KINDS,e)}export function fact(e,a,o){return{kind:e,...a,data:o}}export function factsOf(e,a){return e.filter(o=>o.kind===a)}export function countFacts(e){const a={};for(const o of e)a[o.kind]=(a[o.kind]??0)+1;return a}export function filterFacts(e,a){return e.filter(o=>!(a.kinds?.length&&!a.kinds.includes(o.kind)||a.part!==void 0&&o.part!==a.part||(a.from!==void 0||a.to!==void 0)&&(o.t===void 0||a.from!==void 0&&o.t<a.from-1e-6||a.to!==void 0&&o.t>a.to+1e-6)))}export function freeBandsData(e){const a=l(e.width,e.height,e.safe),o=(r,s)=>{const n=u(s.flat());return{files:r,seen:s.filter(h=>h.length>0).length,rows:n,bands:c(a,n)}},i="missing"in e.face?e.face:{...o(e.face.files,e.face.boxes.map(r=>{const s=r?f(r,a.x):void 0;return s?[s]:[]})),...e.face.speaker===void 0?{}:{speaker:e.face.speaker}},t="missing"in e.person?e.person:o(e.person.files,e.person.rows);return{frame:[e.width,e.height],covered:e.safe,content:a,...e.profile?{profile:e.profile}:{},moments:e.moments,face:i,person:t,bands:c(a,[..."rows"in i?i.rows:[],..."rows"in t?t.rows:[]])}}export function layoutFacts(e,a,o){const i=[];for(const t of e.moments){const r={...a,part:t.part,t:t.t};for(const s of t.overlaps){const n=t.texts[s.a],h=t.texts[s.b];!n||!h||i.push(fact("text-overlap",r,{a:n,b:h,area:s.area,share:s.share}))}for(const s of t.ownOverlaps){const n=t.texts[s.a],h=t.texts[s.b];!n||!h||i.push(fact("text-overlap-own",r,{a:n,b:h,area:s.area,share:s.share}))}for(const s of t.outside){const n=t.texts[s.text];n&&i.push(fact("text-outside",r,{text:n,container:s.container,edges:s.edges}))}for(const s of t.faceOverlaps){const n=t.texts[s.text];!n||!t.face||i.push(fact("text-speaker",r,{text:n,face:{box:t.face,area:s.area,ofText:s.ofText,ofFace:s.ofFace}}))}for(const s of t.offFrame){const n=t.texts[s.text];n&&i.push(fact("text-off-frame",r,{text:n,frame:[e.width,e.height],edges:s.edges,outside:s.outside,share:s.share,glyphs:s.glyphs}))}for(const s of t.safeOverlaps){const n=t.texts[s.text];n&&i.push(fact("text-covered",r,{text:n,frame:[e.width,e.height],covered:e.safe,...o?{profile:o}:{},edges:s.edges}))}}for(const t of e.reading?.texts??[])i.push(fact("text-time",{...a,part:t.part,t:t.first},{text:t.text,words:t.words,chars:t.chars,seconds:t.seconds,spans:t.spans,onScreen:t.onScreen,...t.size?{size:t.size}:{},options:e.reading?.options??d}));for(const t of m(e.reading?.texts??[])){const{part:r,...s}=t;i.push(fact("words-on-screen",{...a,part:r,t:t.from},{...s,options:e.reading?.options??d}))}for(const t of e.footage){const{part:r,...s}=t;i.push(fact("footage-scale",{...a,part:r,t:t.max.t},s))}return i}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export*from"./piece.js";export*from"./timeline.js";export*from"./look.js";export*from"./formats.js";export*from"./placement.js";export*from"./media.js";export*from"./gen.js";export*from"./messages.js";export*from"./script.js";export*from"./anchors.js";export*from"./marks.js";export*from"./script-edit.js";export*from"./edit.js";export*from"./timing.js";export*from"./music.js";export*from"./words.js";export*from"./speech.js";export*from"./edits.js";export*from"./voice.js";export*from"./transcript.js";export*from"./cut-report.js";export*from"./captions.js";export*from"./transition.js";export*from"./motion.js";export*from"./footage-motion.js";export*from"./backdrop.js";export*from"./measure.js";export*from"./seams.js";export*from"./contrast.js";export*from"./matrix.js";export*from"./problem.js";export*from"./fact.js";export*from"./console.js";export*from"./export.js";export*from"./schema.js";export*from"./audio-types.js";export*from"./render-types.js";export*from"./sound-under.js";
|
|
2
|
+
export*from"./piece.js";export*from"./timeline.js";export*from"./source.js";export*from"./look.js";export*from"./formats.js";export*from"./placement.js";export*from"./media.js";export*from"./gen.js";export*from"./messages.js";export*from"./script.js";export*from"./anchors.js";export*from"./marks.js";export*from"./script-edit.js";export*from"./edit.js";export*from"./timing.js";export*from"./music.js";export*from"./words.js";export*from"./speech.js";export*from"./edits.js";export*from"./voice.js";export*from"./transcript.js";export*from"./cut-report.js";export*from"./captions.js";export*from"./transition.js";export*from"./motion.js";export*from"./footage-motion.js";export*from"./backdrop.js";export*from"./measure.js";export*from"./seams.js";export*from"./contrast.js";export*from"./matrix.js";export*from"./problem.js";export*from"./fact.js";export*from"./console.js";export*from"./export.js";export*from"./schema.js";export*from"./audio-types.js";export*from"./render-types.js";export*from"./sound-under.js";
|