@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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SheetSide } from "@allyhub-next/formats";
|
|
2
|
+
import type { CellLook, Table } from "./workbook.js";
|
|
3
|
+
/** A line of a part: Excel's border style and colour. */
|
|
4
|
+
export interface TableLine {
|
|
5
|
+
style: SheetSide["style"];
|
|
6
|
+
color: string;
|
|
7
|
+
}
|
|
8
|
+
/** One part of a table style: a fill, a font's weight and colour, its lines. */
|
|
9
|
+
export interface TablePart {
|
|
10
|
+
bold?: boolean;
|
|
11
|
+
color?: string;
|
|
12
|
+
fill?: string;
|
|
13
|
+
/** Its outer sides, and `horizontal` and `vertical`, the lines inside it. */
|
|
14
|
+
border?: Partial<Record<"left" | "right" | "top" | "bottom" | "horizontal" | "vertical", TableLine>>;
|
|
15
|
+
}
|
|
16
|
+
export interface TableStyle {
|
|
17
|
+
whole?: TablePart;
|
|
18
|
+
header?: TablePart;
|
|
19
|
+
stripe?: TablePart;
|
|
20
|
+
stripe2?: TablePart;
|
|
21
|
+
}
|
|
22
|
+
/** A table's style unless it names one, as Excel's new table. */
|
|
23
|
+
export declare const DEFAULT_TABLE_STYLE = "TableStyleMedium2";
|
|
24
|
+
/** The style a table is drawn in; undefined for `none` or a name Excel has not. */
|
|
25
|
+
export declare const tableStyleOf: (table: Table) => TableStyle | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The look a table's style gives a cell of it, under the cell's own.
|
|
28
|
+
* `band` is which stripe the row is, counted over the rows that show
|
|
29
|
+
* (0 the first); undefined for the header.
|
|
30
|
+
*/
|
|
31
|
+
export declare function tableStyleLook(style: TableStyle, table: Table, row: number, col: number, band: number | undefined): CellLook;
|
|
32
|
+
//# sourceMappingURL=table-style.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{TABLE_STYLES as S}from"./table-styles.js";export const DEFAULT_TABLE_STYLE="TableStyleMedium2",tableStyleOf=e=>e.spec.style==="none"?void 0:S[e.spec.style??DEFAULT_TABLE_STYLE];export function tableStyleLook(e,m,d,u,b){const{area:n}=m,t={},i={},r=(o,p)=>{if(!o)return;o.bold!==void 0&&(t.bold=o.bold),o.color!==void 0&&(t.color=o.color),o.fill!==void 0&&(t.fill=o.fill);const c=o.border;if(!c)return;const l=(s,L)=>{const h=p[s]?c[s]:c[L];h&&(i[s]=h)};l("left","vertical"),l("right","vertical"),l("top","horizontal"),l("bottom","horizontal")},f={left:u===n.left,right:u===n.right};return r(e.whole,{...f,top:d===n.top,bottom:d===n.bottom}),b===void 0?r(e.header,{...f,top:!0,bottom:!0}):r(b%2===0?e.stripe:e.stripe2,{...f,top:!0,bottom:!0}),Object.keys(i).length>0&&(t.border=i),t}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
export const TABLE_STYLES={TableStyleDark1:{whole:{color:"#FFFFFF",fill:"#737373"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#404040"}},TableStyleDark2:{whole:{color:"#FFFFFF",fill:"#4472C4"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#2F5597"}},TableStyleDark3:{whole:{color:"#FFFFFF",fill:"#ED7D31"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#C55A11"}},TableStyleDark4:{whole:{color:"#FFFFFF",fill:"#A5A5A5"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#7C7C7C"}},TableStyleDark5:{whole:{color:"#FFFFFF",fill:"#FFC000"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#BF9000"}},TableStyleDark6:{whole:{color:"#FFFFFF",fill:"#5B9BD5"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#2E75B6"}},TableStyleDark7:{whole:{color:"#FFFFFF",fill:"#70AD47"},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#FFFFFF"}}},stripe:{fill:"#548235"}},TableStyleDark8:{whole:{fill:"#D9D9D9"},header:{color:"#FFFFFF",fill:"#000000"},stripe:{fill:"#A6A6A6"}},TableStyleDark9:{whole:{fill:"#DAE3F3"},header:{color:"#FFFFFF",fill:"#ED7D31"},stripe:{fill:"#B4C7E7"}},TableStyleDark10:{whole:{fill:"#EDEDED"},header:{color:"#FFFFFF",fill:"#FFC000"},stripe:{fill:"#DBDBDB"}},TableStyleDark11:{whole:{fill:"#DEEBF7"},header:{color:"#FFFFFF",fill:"#70AD47"},stripe:{fill:"#BDD7EE"}},TableStyleLight1:{whole:{color:"#000000",border:{top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"thin",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleLight2:{whole:{color:"#2F5597",border:{top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#2F5597",border:{bottom:{style:"thin",color:"#4472C4"}}},stripe:{fill:"#DAE3F3"}},TableStyleLight3:{whole:{color:"#C55A11",border:{top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#C55A11",border:{bottom:{style:"thin",color:"#ED7D31"}}},stripe:{fill:"#FBE5D6"}},TableStyleLight4:{whole:{color:"#7C7C7C",border:{top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#7C7C7C",border:{bottom:{style:"thin",color:"#A5A5A5"}}},stripe:{fill:"#EDEDED"}},TableStyleLight5:{whole:{color:"#BF9000",border:{top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#BF9000",border:{bottom:{style:"thin",color:"#FFC000"}}},stripe:{fill:"#FFF2CC"}},TableStyleLight6:{whole:{color:"#2E75B6",border:{top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#2E75B6",border:{bottom:{style:"thin",color:"#5B9BD5"}}},stripe:{fill:"#DEEBF7"}},TableStyleLight7:{whole:{color:"#548235",border:{top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#548235",border:{bottom:{style:"thin",color:"#70AD47"}}},stripe:{fill:"#E2F0D9"}},TableStyleLight8:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000"},stripe:{border:{top:{style:"thin",color:"#000000"}}},stripe2:{border:{top:{style:"thin",color:"#000000"}}}},TableStyleLight9:{whole:{color:"#000000",border:{left:{style:"thin",color:"#4472C4"},right:{style:"thin",color:"#4472C4"},top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},stripe:{border:{top:{style:"thin",color:"#4472C4"}}},stripe2:{border:{top:{style:"thin",color:"#4472C4"}}}},TableStyleLight10:{whole:{color:"#000000",border:{left:{style:"thin",color:"#ED7D31"},right:{style:"thin",color:"#ED7D31"},top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},stripe:{border:{top:{style:"thin",color:"#ED7D31"}}},stripe2:{border:{top:{style:"thin",color:"#ED7D31"}}}},TableStyleLight11:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A5A5A5"},right:{style:"thin",color:"#A5A5A5"},top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},stripe:{border:{top:{style:"thin",color:"#A5A5A5"}}},stripe2:{border:{top:{style:"thin",color:"#A5A5A5"}}}},TableStyleLight12:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFC000"},right:{style:"thin",color:"#FFC000"},top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},stripe:{border:{top:{style:"thin",color:"#FFC000"}}},stripe2:{border:{top:{style:"thin",color:"#FFC000"}}}},TableStyleLight13:{whole:{color:"#000000",border:{left:{style:"thin",color:"#5B9BD5"},right:{style:"thin",color:"#5B9BD5"},top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},stripe:{border:{top:{style:"thin",color:"#5B9BD5"}}},stripe2:{border:{top:{style:"thin",color:"#5B9BD5"}}}},TableStyleLight14:{whole:{color:"#000000",border:{left:{style:"thin",color:"#70AD47"},right:{style:"thin",color:"#70AD47"},top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},stripe:{border:{top:{style:"thin",color:"#70AD47"}}},stripe2:{border:{top:{style:"thin",color:"#70AD47"}}}},TableStyleLight15:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleLight16:{whole:{color:"#000000",border:{left:{style:"thin",color:"#4472C4"},right:{style:"thin",color:"#4472C4"},top:{style:"thin",color:"#4472C4"},bottom:{style:"thin",color:"#4472C4"},horizontal:{style:"thin",color:"#4472C4"},vertical:{style:"thin",color:"#4472C4"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#4472C4"}}},stripe:{fill:"#DAE3F3"}},TableStyleLight17:{whole:{color:"#000000",border:{left:{style:"thin",color:"#ED7D31"},right:{style:"thin",color:"#ED7D31"},top:{style:"thin",color:"#ED7D31"},bottom:{style:"thin",color:"#ED7D31"},horizontal:{style:"thin",color:"#ED7D31"},vertical:{style:"thin",color:"#ED7D31"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#ED7D31"}}},stripe:{fill:"#FBE5D6"}},TableStyleLight18:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A5A5A5"},right:{style:"thin",color:"#A5A5A5"},top:{style:"thin",color:"#A5A5A5"},bottom:{style:"thin",color:"#A5A5A5"},horizontal:{style:"thin",color:"#A5A5A5"},vertical:{style:"thin",color:"#A5A5A5"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#A5A5A5"}}},stripe:{fill:"#EDEDED"}},TableStyleLight19:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFC000"},right:{style:"thin",color:"#FFC000"},top:{style:"thin",color:"#FFC000"},bottom:{style:"thin",color:"#FFC000"},horizontal:{style:"thin",color:"#FFC000"},vertical:{style:"thin",color:"#FFC000"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#FFC000"}}},stripe:{fill:"#FFF2CC"}},TableStyleLight20:{whole:{color:"#000000",border:{left:{style:"thin",color:"#5B9BD5"},right:{style:"thin",color:"#5B9BD5"},top:{style:"thin",color:"#5B9BD5"},bottom:{style:"thin",color:"#5B9BD5"},horizontal:{style:"thin",color:"#5B9BD5"},vertical:{style:"thin",color:"#5B9BD5"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#5B9BD5"}}},stripe:{fill:"#DEEBF7"}},TableStyleLight21:{whole:{color:"#000000",border:{left:{style:"thin",color:"#70AD47"},right:{style:"thin",color:"#70AD47"},top:{style:"thin",color:"#70AD47"},bottom:{style:"thin",color:"#70AD47"},horizontal:{style:"thin",color:"#70AD47"},vertical:{style:"thin",color:"#70AD47"}}},header:{bold:!0,color:"#000000",border:{bottom:{style:"medium",color:"#70AD47"}}},stripe:{fill:"#E2F0D9"}},TableStyleMedium1:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000"},stripe:{fill:"#D9D9D9"}},TableStyleMedium2:{whole:{color:"#000000",border:{left:{style:"thin",color:"#8FAADC"},right:{style:"thin",color:"#8FAADC"},top:{style:"thin",color:"#8FAADC"},bottom:{style:"thin",color:"#8FAADC"},horizontal:{style:"thin",color:"#8FAADC"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4"},stripe:{fill:"#DAE3F3"}},TableStyleMedium3:{whole:{color:"#000000",border:{left:{style:"thin",color:"#F4B183"},right:{style:"thin",color:"#F4B183"},top:{style:"thin",color:"#F4B183"},bottom:{style:"thin",color:"#F4B183"},horizontal:{style:"thin",color:"#F4B183"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31"},stripe:{fill:"#FBE5D6"}},TableStyleMedium4:{whole:{color:"#000000",border:{left:{style:"thin",color:"#C9C9C9"},right:{style:"thin",color:"#C9C9C9"},top:{style:"thin",color:"#C9C9C9"},bottom:{style:"thin",color:"#C9C9C9"},horizontal:{style:"thin",color:"#C9C9C9"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5"},stripe:{fill:"#EDEDED"}},TableStyleMedium5:{whole:{color:"#000000",border:{left:{style:"thin",color:"#FFD966"},right:{style:"thin",color:"#FFD966"},top:{style:"thin",color:"#FFD966"},bottom:{style:"thin",color:"#FFD966"},horizontal:{style:"thin",color:"#FFD966"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000"},stripe:{fill:"#FFF2CC"}},TableStyleMedium6:{whole:{color:"#000000",border:{left:{style:"thin",color:"#9DC3E6"},right:{style:"thin",color:"#9DC3E6"},top:{style:"thin",color:"#9DC3E6"},bottom:{style:"thin",color:"#9DC3E6"},horizontal:{style:"thin",color:"#9DC3E6"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5"},stripe:{fill:"#DEEBF7"}},TableStyleMedium7:{whole:{color:"#000000",border:{left:{style:"thin",color:"#A9D18E"},right:{style:"thin",color:"#A9D18E"},top:{style:"thin",color:"#A9D18E"},bottom:{style:"thin",color:"#A9D18E"},horizontal:{style:"thin",color:"#A9D18E"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47"},stripe:{fill:"#E2F0D9"}},TableStyleMedium8:{whole:{color:"#000000",fill:"#D9D9D9",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#A6A6A6"}},TableStyleMedium9:{whole:{color:"#000000",fill:"#DAE3F3",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#B4C7E7"}},TableStyleMedium10:{whole:{color:"#000000",fill:"#FBE5D6",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#F8CBAD"}},TableStyleMedium11:{whole:{color:"#000000",fill:"#EDEDED",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#DBDBDB"}},TableStyleMedium12:{whole:{color:"#000000",fill:"#FFF2CC",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#FFE699"}},TableStyleMedium13:{whole:{color:"#000000",fill:"#DEEBF7",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#BDD7EE"}},TableStyleMedium14:{whole:{color:"#000000",fill:"#E2F0D9",border:{horizontal:{style:"thin",color:"#FFFFFF"},vertical:{style:"thin",color:"#FFFFFF"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47",border:{bottom:{style:"thick",color:"#FFFFFF"}}},stripe:{fill:"#C5E0B4"}},TableStyleMedium15:{whole:{color:"#000000",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#000000",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium16:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#4472C4",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium17:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#ED7D31",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium18:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#A5A5A5",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium19:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#FFC000",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium20:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#5B9BD5",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium21:{whole:{color:"#000000",border:{top:{style:"medium",color:"#000000"},bottom:{style:"medium",color:"#000000"}}},header:{bold:!0,color:"#FFFFFF",fill:"#70AD47",border:{bottom:{style:"medium",color:"#000000"}}},stripe:{fill:"#D9D9D9"}},TableStyleMedium22:{whole:{color:"#000000",fill:"#D9D9D9",border:{left:{style:"thin",color:"#000000"},right:{style:"thin",color:"#000000"},top:{style:"thin",color:"#000000"},bottom:{style:"thin",color:"#000000"},horizontal:{style:"thin",color:"#000000"},vertical:{style:"thin",color:"#000000"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#A6A6A6"}},TableStyleMedium23:{whole:{color:"#000000",fill:"#DAE3F3",border:{left:{style:"thin",color:"#8FAADC"},right:{style:"thin",color:"#8FAADC"},top:{style:"thin",color:"#8FAADC"},bottom:{style:"thin",color:"#8FAADC"},horizontal:{style:"thin",color:"#8FAADC"},vertical:{style:"thin",color:"#8FAADC"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#B4C7E7"}},TableStyleMedium24:{whole:{color:"#000000",fill:"#FBE5D6",border:{left:{style:"thin",color:"#F4B183"},right:{style:"thin",color:"#F4B183"},top:{style:"thin",color:"#F4B183"},bottom:{style:"thin",color:"#F4B183"},horizontal:{style:"thin",color:"#F4B183"},vertical:{style:"thin",color:"#F4B183"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#F8CBAD"}},TableStyleMedium25:{whole:{color:"#000000",fill:"#EDEDED",border:{left:{style:"thin",color:"#C9C9C9"},right:{style:"thin",color:"#C9C9C9"},top:{style:"thin",color:"#C9C9C9"},bottom:{style:"thin",color:"#C9C9C9"},horizontal:{style:"thin",color:"#C9C9C9"},vertical:{style:"thin",color:"#C9C9C9"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#DBDBDB"}},TableStyleMedium26:{whole:{color:"#000000",fill:"#FFF2CC",border:{left:{style:"thin",color:"#FFD966"},right:{style:"thin",color:"#FFD966"},top:{style:"thin",color:"#FFD966"},bottom:{style:"thin",color:"#FFD966"},horizontal:{style:"thin",color:"#FFD966"},vertical:{style:"thin",color:"#FFD966"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#FFE699"}},TableStyleMedium27:{whole:{color:"#000000",fill:"#DEEBF7",border:{left:{style:"thin",color:"#9DC3E6"},right:{style:"thin",color:"#9DC3E6"},top:{style:"thin",color:"#9DC3E6"},bottom:{style:"thin",color:"#9DC3E6"},horizontal:{style:"thin",color:"#9DC3E6"},vertical:{style:"thin",color:"#9DC3E6"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#BDD7EE"}},TableStyleMedium28:{whole:{color:"#000000",fill:"#E2F0D9",border:{left:{style:"thin",color:"#A9D18E"},right:{style:"thin",color:"#A9D18E"},top:{style:"thin",color:"#A9D18E"},bottom:{style:"thin",color:"#A9D18E"},horizontal:{style:"thin",color:"#A9D18E"},vertical:{style:"thin",color:"#A9D18E"}}},header:{bold:!0,color:"#000000"},stripe:{fill:"#C5E0B4"}}};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
export class CellError{static all=new Map;code;constructor(t){this.code=t}static of(t){let n=CellError.all.get(t);return n||(n=new CellError(t),CellError.all.set(t,n)),n}toString(){return this.code}toJSON(){return this.code}}export const ERR={NULL:CellError.of("#NULL!"),DIV0:CellError.of("#DIV/0!"),VALUE:CellError.of("#VALUE!"),REF:CellError.of("#REF!"),NAME:CellError.of("#NAME?"),NUM:CellError.of("#NUM!"),NA:CellError.of("#N/A"),SPILL:CellError.of("#SPILL!"),CALC:CellError.of("#CALC!"),CYCLE:CellError.of("#CYCLE!")};const
|
|
2
|
+
export class CellError{static all=new Map;code;constructor(t){this.code=t}static of(t){let n=CellError.all.get(t);return n||(n=new CellError(t),CellError.all.set(t,n)),n}toString(){return this.code}toJSON(){return this.code}}export const ERR={NULL:CellError.of("#NULL!"),DIV0:CellError.of("#DIV/0!"),VALUE:CellError.of("#VALUE!"),REF:CellError.of("#REF!"),NAME:CellError.of("#NAME?"),NUM:CellError.of("#NUM!"),NA:CellError.of("#N/A"),SPILL:CellError.of("#SPILL!"),CALC:CellError.of("#CALC!"),CYCLE:CellError.of("#CYCLE!")};const $=["#NULL!","#DIV/0!","#VALUE!","#REF!","#NAME?","#NUM!","#N/A","#GETTING_DATA","#SPILL!","#CALC!","#CYCLE!"];export function errorOf(e){const t=e.toUpperCase(),n=$.find(r=>r===t);return n===void 0?void 0:CellError.of(n)}export class Matrix{rows;cols;data;constructor(t,n,r){this.rows=t,this.cols=n,this.data=r}at(t,n){return this.data[t*this.cols+n]??null}}const i=864e5,p=25569;function y(e){const t=e+p;return t<61?t-1:t}function M(e){const t=Math.floor(e);if(t!==60)return(t<60?t+1:t)-p}export function serialOf(e,t,n){const r=new Date(Date.UTC(2e3,t-1,1));return r.setUTCFullYear(r.getUTCFullYear()-2e3+e),y(Math.floor(r.getTime()/i))+n-1}export function dateOf(e){const t=M(e);if(t===void 0)return{year:1900,month:2,day:29};if(Math.floor(e)===0)return{year:1900,month:1,day:0};const n=new Date(t*i);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate()}}export function serialOfDate(e){const t=e.getTime(),n=Math.floor(t/i);return y(n)+(t-n*i)/i}export function dateOfSerial(e){const t=M(e);if(t===void 0)return;const n=e-Math.floor(e);return new Date(t*i+Math.round(n*i))}const a=(e,t=2)=>String(e).padStart(t,"0");export function isoOfSerial(e){const{year:t,month:n,day:r}=dateOf(e),s=`${a(t,4)}-${a(n)}-${a(r)}`,o=Math.round((e-Math.floor(e))*86400);if(o===0)return s;const u=o%60;return`${s}T${a(Math.floor(o/3600))}:${a(Math.floor(o/60)%60)}${u===0?"":`:${a(u)}`}`}export function numberText(e){if(e===0)return"0";const t=Number(e.toPrecision(15)),n=Math.floor(Math.log10(Math.abs(t)));if(n>=15||n<-10){const[s="",o="0"]=t.toExponential().split("e"),u=Number(o);return`${s}E${u<0?"-":"+"}${a(Math.abs(u))}`}const r=String(t);return r.includes("e")?t.toFixed(Math.min(20,Math.abs(n)+15)).replace(/0+$/u,""):r}const N=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/u,E=/^[+-]?\d{1,3}(?:,\d{3})+(?:\.\d+)?$/u,L=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/u,b=e=>/^[+-]?\d+$/u.test(e)&&e.replace(/^[+-]?0*/u,"").length>15;function A(e){const t=L.exec(e);if(!t)return;const[n,r,s]=[Number(t[1]),Number(t[2]),Number(t[3])],o=serialOf(n,r,s),u=dateOf(o);if(u.month!==r||u.day!==s)return;if(t[4]===void 0)return{value:o,format:"yyyy-mm-dd"};const[f,d,m]=[Number(t[4]),Number(t[5]),Number(t[6]??0)];if(f>23||d>59||m>59)return;const c=t[7];let h=0;if(c!==void 0&&c!=="Z"){const l=c.replace(":","");h=(l.startsWith("-")?1:-1)*(Number(l.slice(1,3))*60+Number(l.slice(3,5)))/1440}return{value:o+(f*3600+d*60+m)/86400+h,format:t[6]===void 0?"yyyy-mm-dd hh:mm":"yyyy-mm-dd hh:mm:ss"}}function U(e){const t=/^(\d{1,4}):([0-5]?\d)(?::([0-5]?\d))?(?:\s*([AaPp])[Mm]?)?$/u.exec(e)??/^(\d{1,2})()()\s*([AaPp])[Mm]?$/u.exec(e);if(!t)return;const n=Number(t[1]),r=t[2]===void 0||t[2]===""?0:Number(t[2]),s=t[3]===void 0||t[3]===""?0:Number(t[3]),o=t[4]?.toUpperCase();if(o!==void 0)return n<1||n>12?void 0:{value:((n%12+(o==="P"?12:0))*3600+r*60+s)/86400,format:t[3]?"h:mm:ss AM/PM":"h:mm AM/PM"};const u=(n*3600+r*60+s)/86400;return n>=24?{value:u,format:"[h]:mm:ss"}:{value:u,format:t[3]?"h:mm:ss":"h:mm"}}export function readTyped(e){if(e==="")return{value:null};if(e.startsWith("'"))return{value:e.slice(1)};if(e.length>1&&e.startsWith("="))return{value:null,formula:e};const t=e.trim();if(t==="")return{value:e};const n=t.toUpperCase();if(n==="TRUE")return{value:!0};if(n==="FALSE")return{value:!1};if(N.test(t))return b(t)?{value:e}:{value:Number(t)};if(t.endsWith("%")){const d=t.slice(0,-1).trim();if(N.test(d))return{value:Number(d)/100,format:d.includes(".")?"0.00%":"0%"}}if(E.test(t))return{value:Number(t.replaceAll(",","")),format:t.includes(".")?"#,##0.00":"#,##0"};const r=/^([+-]?)\$(\d[\d,]*(?:\.\d+)?)$/u.exec(t),s=r?.[2]?.replaceAll(",","");if(r&&s!==void 0)return{value:+`${r[1]??""}${s}`,format:t.includes(".")?"$#,##0.00":"$#,##0"};const o=A(t);if(o)return o;const u=U(t);if(u)return u;const f=errorOf(t);return f?{value:f}:{value:e}}export function writeTyped(e){if(e===null)return"";if(typeof e=="number"){const n=String(e);return b(n)?e.toExponential():n}if(typeof e=="boolean")return e?"TRUE":"FALSE";if(e instanceof CellError)return e.code;const t=readTyped(e);return t.value===e&&t.formula===void 0?e:`'${e}`}
|
|
@@ -157,6 +157,8 @@ export declare class Worksheet {
|
|
|
157
157
|
readonly filters: Filter[];
|
|
158
158
|
/** Its charts, the last on top. */
|
|
159
159
|
readonly charts: Chart[];
|
|
160
|
+
/** Names that hold on this sheet alone, over the workbook's, in lower case. */
|
|
161
|
+
readonly names: Map<string, DefinedName>;
|
|
160
162
|
freeze: Place | undefined;
|
|
161
163
|
/** sheet.ts makes it: what is on it is not changed by hand. */
|
|
162
164
|
generated: boolean;
|
|
@@ -246,6 +248,10 @@ export interface DefinedName {
|
|
|
246
248
|
value?: Scalar;
|
|
247
249
|
formula?: SharedFormula;
|
|
248
250
|
source: Source;
|
|
251
|
+
/** The sheet it holds on alone; absent: the workbook. */
|
|
252
|
+
sheet?: Worksheet;
|
|
253
|
+
/** Excel's Name Manager does not list it. */
|
|
254
|
+
hidden?: boolean;
|
|
249
255
|
}
|
|
250
256
|
export interface Check {
|
|
251
257
|
name: string;
|
|
@@ -269,7 +275,10 @@ export declare class Workbook {
|
|
|
269
275
|
respec(file: SheetFile): void;
|
|
270
276
|
sheet(name: string): Worksheet | undefined;
|
|
271
277
|
table(name: string): Table | undefined;
|
|
272
|
-
name
|
|
278
|
+
/** A defined name as a formula on `sheet` reads it: the sheet's own first, then the workbook's. */
|
|
279
|
+
name(name: string, sheet?: Worksheet): DefinedName | undefined;
|
|
280
|
+
/** Every definition of a name: the workbook's and each sheet's own. */
|
|
281
|
+
definitions(name: string): DefinedName[];
|
|
273
282
|
get tables(): Table[];
|
|
274
283
|
addSheet(sheet: Worksheet): void;
|
|
275
284
|
addTable(table: Table): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{SHEET_CODE as C,SHEET_SEPARATOR as P}from"@allyhub-next/formats";import{MAX_ROWS as B,cellName as H,columnIndex as j,columnLetter as z,contains as y,overlaps as v,rangeName as U,readAddress as x,readArea as $,readAreas as _}from"./address.js";import{readCsv as R}from"./csv.js";import{ENTRY as E,readSheetFile as D}from"./file.js";import{withGenerated as O}from"./generated.js";import{moveFormula as G}from"./formula/move.js";import{parseFormula as X}from"./formula/parse.js";import{printFormula as Y}from"./formula/print.js";import{readTyped as A}from"./values.js";export class SharedFormula{node;error;analysis;text;row;col;source;constructor(e,t,s,n){this.text=e,this.row=t,this.col=s,this.source=n;const i=X(e);i.ok?this.node=i.node:this.error=i.error}}export class FormulaCell{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,s,n){this.shared=e,this.sheet=t,this.row=s,this.col=n}get moved(){const{node:e,row:t,col:s}=this.shared;if(!e)throw new Error(`${this.shared.text} does not parse.`);return G(e,this.row-t,this.col-s)}get text(){const{node:e,text:t,row:s,col:n}=this.shared;return!e||s===this.row&&n===this.col?t:Y(this.moved)}}class Z{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,s){let n=this.columns[t];n||(n=[],this.columns[t]=n,this.firsts[t]=e,this.lasts[t]=e),n[e]instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??1)-1),s instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??0)+1),n[e]=s,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,s){const n=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=n;i++){const r=this.columns[i];if(!r)continue;const l=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=l;o++)if(r[o]!==void 0&&!(o===t&&i===s))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}}export class Table{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,s,n,i){this.name=e,this.sheet=t,this.at=s,this.file=n,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){const e=this.area;return{...e,top:e.top+1}}column(e){const t=e.toLowerCase();return this.columns.find(s=>s.name.toLowerCase()===t)}}export const placeKey=(a,e)=>a*16384+e;function T(a,e){a.bottom=Math.max(a.bottom,e.bottom),a.right=Math.max(a.right,e.right);for(let t=e.left;t<=e.right;t++){const s=a.columns.get(t);a.columns.set(t,[Math.min(s?.[0]??e.top,e.top),Math.max(s?.[1]??e.bottom,e.bottom)])}}export class Worksheet{tables=[];blocks=[];merges=[];formulas=new Set;implied=new Map;keys=new Map;fills=[];blanks=new Set;conditions=[];validations=[];filters=[];charts=[];freeze;generated=!1;grid=new Z;expanded=!1;lowest=-1;ghosts=new Map;spills=new Set;stopped=new Set;reach;lookAreas;name;index;spec;constructor(e,t,s){this.name=e,this.index=t,this.spec=s}respec(e){const t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((s,n)=>{const i=W(s,n,[],()=>{});i&&this.charts.push(i)}))}put(e,t,s){s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}replace(e,t,s){this.expand();const n=this.grid.get(e,t);n instanceof FormulaCell&&this.formulas.delete(n),s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){const t=this.fills[e];if(!t)continue;const{area:s,shared:n,value:i,format:r}=t;for(let l=s.top;l<=s.bottom;l++)for(let o=s.left;o<=s.right;o++)this.grid.get(l,o)===void 0&&(this.blanks.has(placeKey(l,o))||(n?this.put(l,o,new FormulaCell(n,this,l,o)):i!=null&&(this.put(l,o,i),r!==void 0&&this.implied.set(placeKey(l,o),r))))}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(placeKey(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(n=>n.spill!==void 0&&v(n.spill,e));const s=new Set;for(let n=e.top;n<=e.bottom;n++)for(let i=e.left;i<=e.right;i++){const r=this.ghosts.get(placeKey(n,i));r&&s.add(r)}return[...s]}blockedBy(e){if(this.stopped.size===0)return[];const t=[];for(const s of this.stopped)s.blocked&&v(s.blocked,e)&&t.push(s);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)(s!==e.row||n!==e.col)&&this.ghosts.set(placeKey(s,n),e);this.reach&&T(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){const t=e.spill;if(t)for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)this.ghosts.get(placeKey(s,n))===e&&this.ghosts.delete(placeKey(s,n));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(const e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;const e={columns:new Map,bottom:-1,right:-1};for(const{spill:t}of this.spills)t&&T(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,s){this.expand();const n=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,n),Math.min(s,i)];const[r,l]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(n,r)),Math.min(s,Math.max(i,l))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){const e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(s=>y(s.area,e,t))}blockAt(e,t){return this.blocks.find(s=>y(s.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;const e=[];for(const s of this.spec.format??[]){const n=$(s.range);n&&e.push({area:n,entry:s})}const t=[];for(const[s,n]of Object.entries(this.spec.cells??{})){if(!s.includes(":")||n===null||typeof n!="object")continue;const i=$(s);i&&t.push({area:i,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){const{formats:e,ranges:t}=this.looks();return[...e,...t.filter(s=>Object.keys(s.entry).some(n=>F.has(n)))]}lookAt(e,t){const s={},n=c=>{if(c)for(const[b,w]of Object.entries(c))F.has(b)&&w!==void 0&&(s[b]=b==="border"?{...s.border,...w}:w)},i=this.implied.get(placeKey(e,t));i!==void 0&&(s.format=i);const r=this.ghosts.size===0?void 0:this.spillAt(e,t),l=r&&this.lookAt(r.row,r.col).format;l!==void 0&&(s.format=l),this.spec.columns&&n(this.spec.columns[z(t)]),this.spec.rows&&n(this.spec.rows[String(e+1)]);const o=this.tableAt(e,t);o&&e>o.at.row&&n(o.columns[t-o.at.col]?.spec);const{formats:f,ranges:h}=this.looks();for(const c of f)y(c.area,e,t)&&n(c.entry);for(const c of h)y(c.area,e,t)&&n(c.entry);const m=this.keys.get(placeKey(e,t)),g=m===void 0?void 0:this.spec.cells?.[m];if(g!==null&&typeof g=="object"&&n(g),s.border){const c=Object.entries(s.border).filter(([,b])=>b?.style!=="none");c.length===0?delete s.border:s.border=Object.fromEntries(c)}return s}mergeAt(e,t){return this.merges.find(s=>y(s,e,t))}validationAt(e,t){return this.validations.find(s=>s.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(s=>e===s.area.top&&t>=s.area.left&&t<=s.area.right)}filterAt(e,t){return this.filters.find(s=>y(s.area,e,t))}filesAt(e,t){const s=this.tableAt(e,t);if(s&&e>s.at.row){const n=s.columns[t-s.at.col]?.spec?.files;if(n!==void 0)return n}return s?.at.row===e?void 0:this.spec.columns?.[z(t)]?.files}}export const filesSeparator=a=>(typeof a=="object"?a.separator:void 0)??P;export function filesIn(a,e){const t=filesSeparator(e);return a.split(t.trim()===""?t:t.trim()).map(s=>s.trim()).filter(s=>s!=="")}const F=new Set(["bold","italic","underline","strike","font","size","color","fill","align","valign","wrap","shrink","indent","rotation","border","format"]);export class Workbook{title;sheets=[];names=new Map;checks=[];bySheet=new Map;byTable=new Map;file;generated;ordinary=[];constructor(e,t){this.file=e,this.title=e.title,this.generated=t}respec(e){this.file=O(e,this.generated).file,this.title=e.title,this.sheets.forEach(t=>{const s=e.sheets.find(n=>n.name===t.name);s&&t.respec(s)})}sheet(e){return this.bySheet.get(e.toLowerCase())}table(e){return this.byTable.get(e.toLowerCase())}name(e){return this.names.get(e.toLowerCase())}get tables(){return[...this.byTable.values()]}addSheet(e){this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,s){if(e.generated)return{file:C};const n=this.sheets.indexOf(e),i=e.tableAt(t,s);if(i){const o=i.columns[s-i.at.col],f=t-i.at.row-1,h=o?.csv!==void 0&&(i.records[f]?.[o.csv]??"")!=="";return f>=0&&o?.formula&&!h?o.formula.source:{file:i.file,line:f<0?1:i.lines[f]??1}}const r=e.blockAt(t,s);if(r)return{file:r.file,line:r.lines[t-r.area.top]??1};const l=e.keys.get(placeKey(t,s));if(l!==void 0)return{file:E,path:["sheets",n,"cells",l]};for(const o of Object.keys(e.spec.cells??{})){if(!o.includes(":"))continue;const f=$(o);if(f&&y(f,t,s))return{file:E,path:["sheets",n,"cells",o]}}}}export const MAX_FILL_CELLS=5e6;const q=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;export function validName(a){return q.test(a)&&x(a)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(a)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(a)&&!/^[Cc]\d*$/u.test(a)}const M="made",k=a=>a[0]===M?C:E;class N{problems=[];wb;read_;lineOf;own;madeNames;constructor(e,t,s,n,i){this.wb=e,this.read_=t,this.lineOf=s,this.own=n,this.madeNames=i}yaml(e,t){const s=this.lineOf(e);this.problems.push({file:k(e),...s===void 0?{}:{line:s},message:t})}sheetPath(e){return e<this.own?["sheets",e]:[M,"sheets",e-this.own]}read(){const{file:e}=this.wb;e.sheets.forEach((t,s)=>{const n=this.sheetPath(s);if(this.wb.sheet(t.name)){this.yaml([...n,"name"],`two sheets are named ${t.name}`);return}(/[\\/?*[\]:]/u.test(t.name)||t.name.length>31)&&this.yaml([...n,"name"],`${t.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);const i=new Worksheet(t.name,this.wb.sheets.length,t);i.generated=s>=this.own,this.wb.addSheet(i)}),this.names();for(const[t,s]of e.sheets.entries()){const n=this.wb.sheets[t];n?.spec===s&&this.sheet(n,this.sheetPath(t))}e.checks?.forEach((t,s)=>{const n={file:E,path:["checks",s,"formula"]};this.wb.checks.push({name:t.name,formula:new SharedFormula(t.formula,0,0,n),source:n})})}names(){for(const[e,t]of Object.entries(this.wb.file.names??{})){const s=this.madeNames.has(e)?[M,"names",e]:["names",e];if(!validName(e)){this.yaml(s,`${e} cannot be a name`);continue}const n={file:k(s),path:s},i=typeof t=="string"&&t.startsWith("=")?{name:e,formula:new SharedFormula(t,0,0,n),source:n}:{name:e,value:typeof t=="string"?A(t).value:t,source:n};this.wb.names.set(e.toLowerCase(),i)}}sheet(e,t){const{spec:s}=e;if(s.freeze!==void 0){const n=x(s.freeze);n?e.freeze=n:this.yaml([...t,"freeze"],`${s.freeze} is not a cell`)}s.tables?.forEach((n,i)=>{this.table(e,n,[...t,"tables",i])});for(const[n,i]of e.tables.entries())for(const r of e.tables.slice(n+1))v(i.area,r.area)&&this.problems.push({file:E,message:`tables ${i.name} and ${r.name} overlap on ${e.name}`});s.blocks?.forEach((n,i)=>{this.block(e,n.at,n.rows,[...t,"blocks",i])}),this.cells(e,s.cells??{},[...t,"cells"]),s.merges?.forEach((n,i)=>{const r=$(n);r?e.merges.push(r):this.yaml([...t,"merges",i],`${n} is not a range`)}),s.format?.forEach((n,i)=>{$(n.range)||this.yaml([...t,"format",i,"range"],`${n.range} is not a range`)}),s.conditional?.forEach((n,i)=>{this.condition(e,n,[...t,"conditional",i])}),s.validations?.forEach((n,i)=>{this.validation(e,n,[...t,"validations",i])}),this.filters(e,t),s.charts?.forEach((n,i)=>{this.chart(e,n,i,[...t,"charts",i])});for(const n of Object.keys(s.columns??{}))j(n)===void 0&&this.yaml([...t,"columns",n],`${n} is not a column`);for(const n of Object.keys(s.rows??{}))(!/^[1-9]\d*$/u.test(n)||Number(n)>B)&&this.yaml([...t,"rows",n],`${n} is not a row`)}chart(e,t,s,n){const i=W(t,s,n,(r,l)=>{this.yaml(r,l)});i&&e.charts.push(i)}bound(e,t,s){if(!(typeof e!="string"||!e.startsWith("=")||e.length<2))return new SharedFormula(e,t?.top??0,t?.left??0,{file:k(s),path:s})}condition(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const[i]=n,r=[],l=(o,f)=>{const h=this.bound(o,i,f);h&&r.push(h)};if(t.type==="expression"){const o=t.formula.startsWith("=")?t.formula:`=${t.formula}`;l(o,[...s,"formula"])}if(t.type==="cellIs"&&t.formula.forEach((o,f)=>{l(o,[...s,"formula",f])}),t.type==="dataBar")for(const o of["min","max"])l(t[o]?.value,[...s,o,"value"]);(t.type==="colorScale"||t.type==="iconSet")&&t.stops?.forEach((o,f)=>{l(o.value,[...s,"stops",f,"value"])}),e.conditions.push({spec:t,areas:n,formulas:r})}validation(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const i=(t.formula??[]).map((o,f)=>this.bound(o,n[0],[...s,"formula",f])),r=t.formula?.length??0,l=t.type!=="list"&&t.type!=="custom"&&(t.operator===void 0||t.operator==="between"||t.operator==="notBetween");!(t.type==="list"&&t.values!==void 0)&&r<(l?2:1)&&this.yaml(s,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:n,formulas:i})}filters(e,t){const{spec:s}=e;if(s.filter){const n=[...t,"filter"],i=$(s.filter.range);if(!i)this.yaml([...n,"range"],`${s.filter.range} is not a range`);else{const r=new Map;for(const[o,f]of Object.entries(s.filter.columns??{})){const h=j(o);h===void 0||h<i.left||h>i.right?this.yaml([...n,"columns",o],`${o} is not a column of ${s.filter.range}`):r.set(h,f)}const l=e.tables.find(o=>v(o.area,i));l&&this.yaml(n,`a filter over table ${l.name}: a table has its own`),e.filters.push({area:i,columns:r})}}e.tables.forEach((n,i)=>{const{filter:r}=n.spec;if(r===!1)return;const l=new Map;for(const[o,f]of Object.entries(r?.columns??{})){const h=n.column(o);h?l.set(n.at.col+h.index,f):this.yaml([...t,"tables",i,"filter","columns",o],`table ${n.name} has no column ${o}`)}e.filters.push({area:n.area,table:n,columns:l})})}csv(e,t,s){const n=this.read_(e);return n||this.yaml(t,`${s}: ${e} is not there`),n}overlapping(e,t){const s=e.tables.find(i=>v(i.area,t));if(s)return`table ${s.name}`;const n=e.blocks.find(i=>v(i.area,t));return n?`the block of ${n.file}`:void 0}typed(e,t,s,n,i){if(n.formula!==void 0){const r=new SharedFormula(n.formula,t,s,i);e.put(t,s,new FormulaCell(r,e,t,s));return}n.value!==null&&(e.put(t,s,n.value),n.format!==void 0&&e.implied.set(placeKey(t,s),n.format))}table(e,t,s){const n=x(t.at);if(!n){this.yaml([...s,"at"],`${t.at} is not a cell`);return}if(!validName(t.name)){this.yaml([...s,"name"],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...s,"name"],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...s,"name"],`${t.name} is a defined name and a table's`);const i=new Table(t.name,e,n,t.rows,t),r=this.csv(t.rows,[...s,"rows"],`table ${t.name}`),l=r?.rows??[],o=r?.lines??[],f=l[0],h=o[0]??1,m=new Set,g=f?.length===0?[""]:f??[];g.forEach((u,d)=>{const p=u.trim();p===""&&this.problems.push({file:t.rows,line:h,message:`column ${String(d+1)} has no name`}),m.has(p.toLowerCase())&&this.problems.push({file:t.rows,line:h,message:`two columns are named ${p}`}),m.add(p.toLowerCase()),i.columns.push({name:p,index:i.columns.length,csv:d})});for(const[u,d]of Object.entries(t.columns??{})){const p=i.column(u),S=p??{name:u,index:i.columns.length};p||(d.formula===void 0&&this.yaml([...s,"columns",u],`table ${t.name} has no column ${u}`),i.columns.push(S)),S.spec=d}const c=g.length;for(let u=1;u<l.length;u++){const d=l[u];if(!d||d.length===0)continue;const p=o[u]??u+1;i.places.push(u),i.records.push(d),i.lines.push(p),d.length>c&&this.problems.push({file:t.rows,line:p,message:`this row has ${String(d.length)} fields and the header ${String(c)}`})}i.rows=i.records.length;const b=this.overlapping(e,i.area);b&&this.yaml(s,`table ${t.name} overlaps ${b} on ${e.name}`),this.wb.addTable(i),this.tableKey(i,s);const w=n.row+1;i.columns.forEach(u=>{const d=n.col+u.index;e.put(n.row,d,u.name);const p=u.spec?.formula;p!==void 0&&(u.formula=new SharedFormula(p,w,d,{file:k(s),path:[...s,"columns",u.name,"formula"]}),i.rows>0&&e.fills.push({area:{top:w,left:d,bottom:w+i.rows-1,right:d},shared:u.formula})),u.csv!==void 0&&i.records.forEach((S,L)=>{this.typed(e,w+L,d,A(S[u.csv??0]??""),{file:t.rows,line:i.lines[L]??1})})})}tableKey(e,t){const{key:s}=e.spec;if(s===void 0)return;const n=e.column(s);if(n?.csv===void 0){this.yaml([...t,"key"],`table ${e.name} has no column ${s} in ${e.file}`);return}const i=new Set;e.records.forEach((r,l)=>{const o=r[n.csv??0]??"",f=e.lines[l]??1;o===""?this.problems.push({file:e.file,line:f,message:`this row has no ${s}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:f,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,s,n){const i=x(t);if(!i){this.yaml([...n,"at"],`${t} is not a cell`);return}const r=this.csv(s,[...n,"rows"],"a block");if(!r)return;const l=r.rows,o=l.map((g,c)=>r.lines[c]??c+1),f=l.reduce((g,c)=>Math.max(g,c.length),1),h={top:i.row,left:i.col,bottom:i.row+Math.max(l.length,1)-1,right:i.col+f-1},m=this.overlapping(e,h);m&&this.yaml(n,`the block of ${s} overlaps ${m} on ${e.name}`),e.blocks.push({area:h,file:s,lines:o}),l.forEach((g,c)=>{g.forEach((b,w)=>{this.typed(e,i.row+c,i.col+w,A(b),{file:s,line:o[c]??c+1})})})}cells(e,t,s){const n=[];for(const[i,r]of Object.entries(t)){const l=[...s,i],o=$(i);if(!o){this.yaml(l,`${i} is not a cell or a range`);continue}const f=this.overlapping(e,o);if(f&&this.yaml(l,`${i} overlaps ${f}`),i.includes(":")){const h=(o.bottom-o.top+1)*(o.right-o.left+1);h>MAX_FILL_CELLS?this.yaml(l,`${i} is ${String(h)} cells`):this.fill(e,o,r,l)}else n.push([i,r,{row:o.top,col:o.left}])}for(const[i,r,l]of n){const o=[...s,i],f=K(r),h=placeKey(l.row,l.col);e.keys.set(h,i),f.value===null&&f.formula===void 0&&e.blanks.add(h),this.typed(e,l.row,l.col,f,{file:k(o),path:o});const m=r!==null&&typeof r=="object"?r.name:void 0;m!==void 0&&this.cellName(e,l,m,o)}}cellName(e,t,s,n){if(!validName(s)){this.yaml(n,`${s} cannot be a name`);return}if(this.wb.name(s)){this.yaml(n,`two places are named ${s}`);return}const i={file:k(n),path:n},r=H(t).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2"),l=`='${e.name.replaceAll("'","''")}'!${r}`;this.wb.names.set(s.toLowerCase(),{name:s,formula:new SharedFormula(l,0,0,i),source:i})}fill(e,t,s,n){const i=K(s),r={file:k(n),path:n};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new SharedFormula(i.formula,t.top,t.left,r)})}}function W(a,e,t,s){const n=x(a.at);if(!n){s([...t,"at"],`${a.at} is not a cell`);return}const i=(o,f)=>{const h=new SharedFormula(chartFormula(o),0,0,{file:k(f),path:f});return h.node&&!I(h.node)&&s(f,`${o} is not a range or a table's column`),h},r=(o,f)=>o?.startsWith("=")===!0?i(o,f):void 0,l=r(a.title,[...t,"title"]);return{spec:a,at:n,index:e,...a.categories===void 0?{}:{categories:i(a.categories,[...t,"categories"])},...l?{title:l}:{},series:a.series.map((o,f)=>{const h=[...t,"series",f],m=r(o.name,[...h,"name"]);return{values:i(o.values,[...h,"values"]),...o.x===void 0?{}:{x:i(o.x,[...h,"x"])},...m?{name:m}:{}}})}}export const chartFormula=a=>a.startsWith("=")?a:`=${a}`;function I(a){switch(a.kind){case"error":case"ref":case"structured":case"name":return!0;case"paren":case"postfix":return I(a.arg);case"binary":return a.op===":"||a.op===",";default:return!1}}function K(a){if(a===null)return{value:null};if(typeof a=="string")return A(a);if(typeof a!="object")return{value:a};if(a.formula!==void 0)return{value:null,formula:a.formula.startsWith("=")?a.formula:`=${a.formula}`};const{value:e}=a;return typeof e=="string"?A(e):{value:e??null}}export function readWorkbook(a){const e=D(a.text),t=l=>l[0]===M?void 0:e.lineOf(l);if(!e.file)return{problems:e.problems,lineOf:t};const s=O(e.file,a.generated),n=new Workbook(s.file,a.generated);n.ordinary=s.ordinary;const i=[],r=new N(n,l=>{const o=a.generated?.csv[l]??a.read(l);if(o===void 0)return;const f=R(o);for(const h of f.problems)i.push({file:l,line:h.line,message:h.message});return{rows:f.records.map(h=>h.end===h.start?[]:h.fields),lines:f.records.map(h=>h.line)}},t,s.own,s.names);return r.read(),{workbook:n,problems:[...i,...r.problems],lineOf:t}}export function workbookOf(a){const e=O(a.file,a.generated),t=new Workbook(e.file,a.generated);return t.ordinary=e.ordinary,new N(t,s=>{const n=a.generated?.csv[s];if(n!==void 0)return{rows:R(n).records.map(r=>r.end===r.start?[]:r.fields),lines:[]};const i=a.rows(s);return i&&{rows:i,lines:[]}},()=>{},e.own,e.names).read(),t}export{U as rangeName};
|
|
2
|
+
import{SHEET_CODE as C,SHEET_SEPARATOR as P}from"@allyhub-next/formats";import{MAX_ROWS as B,cellName as H,columnIndex as z,columnLetter as j,contains as y,overlaps as v,rangeName as U,readAddress as x,readArea as $,readAreas as _}from"./address.js";import{readCsv as R}from"./csv.js";import{ENTRY as E,readSheetFile as D}from"./file.js";import{withGenerated as O}from"./generated.js";import{moveFormula as G}from"./formula/move.js";import{parseFormula as X}from"./formula/parse.js";import{printFormula as Y}from"./formula/print.js";import{readTyped as S}from"./values.js";export class SharedFormula{node;error;analysis;text;row;col;source;constructor(e,t,s,n){this.text=e,this.row=t,this.col=s,this.source=n;const i=X(e);i.ok?this.node=i.node:this.error=i.error}}export class FormulaCell{value=null;array;spill;blocked;state=1;mark=0;shared;sheet;row;col;constructor(e,t,s,n){this.shared=e,this.sheet=t,this.row=s,this.col=n}get moved(){const{node:e,row:t,col:s}=this.shared;if(!e)throw new Error(`${this.shared.text} does not parse.`);return G(e,this.row-t,this.col-s)}get text(){const{node:e,text:t,row:s,col:n}=this.shared;return!e||s===this.row&&n===this.col?t:Y(this.moved)}}class Z{columns=[];firsts=[];lasts=[];formulas=[];get(e,t){return this.columns[t]?.[e]}set(e,t,s){let n=this.columns[t];n||(n=[],this.columns[t]=n,this.firsts[t]=e,this.lasts[t]=e),n[e]instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??1)-1),s instanceof FormulaCell&&(this.formulas[t]=(this.formulas[t]??0)+1),n[e]=s,e<(this.firsts[t]??e)&&(this.firsts[t]=e),e>(this.lasts[t]??e)&&(this.lasts[t]=e)}get width(){return this.columns.length}holds(e,t,s){const n=Math.min(e.right,this.columns.length-1);for(let i=e.left;i<=n;i++){const a=this.columns[i];if(!a)continue;const r=Math.min(e.bottom,this.last(i));for(let o=Math.max(e.top,this.first(i));o<=r;o++)if(a[o]!==void 0&&!(o===t&&i===s))return!0}return!1}first(e){return this.firsts[e]??1/0}last(e){return this.lasts[e]??-1}hasFormulas(e){return(this.formulas[e]??0)>0}}export class Table{columns=[];rows=0;lines=[];places=[];records=[];name;sheet;at;file;spec;constructor(e,t,s,n,i){this.name=e,this.sheet=t,this.at=s,this.file=n,this.spec=i}get area(){return{top:this.at.row,left:this.at.col,bottom:this.at.row+this.rows,right:this.at.col+Math.max(this.columns.length,1)-1}}get data(){const e=this.area;return{...e,top:e.top+1}}column(e){const t=e.toLowerCase();return this.columns.find(s=>s.name.toLowerCase()===t)}}export const placeKey=(l,e)=>l*16384+e;function T(l,e){l.bottom=Math.max(l.bottom,e.bottom),l.right=Math.max(l.right,e.right);for(let t=e.left;t<=e.right;t++){const s=l.columns.get(t);l.columns.set(t,[Math.min(s?.[0]??e.top,e.top),Math.max(s?.[1]??e.bottom,e.bottom)])}}export class Worksheet{tables=[];blocks=[];merges=[];formulas=new Set;implied=new Map;keys=new Map;fills=[];blanks=new Set;conditions=[];validations=[];filters=[];charts=[];names=new Map;freeze;generated=!1;grid=new Z;expanded=!1;lowest=-1;ghosts=new Map;spills=new Set;stopped=new Set;reach;lookAreas;name;index;spec;constructor(e,t,s){this.name=e,this.index=t,this.spec=s}respec(e){const t=e.charts!==this.spec.charts;this.spec=e,this.lookAreas=void 0,t&&(this.charts.length=0,e.charts?.forEach((s,n)=>{const i=W(s,n,[],()=>{});i&&this.charts.push(i)}))}put(e,t,s){s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}replace(e,t,s){this.expand();const n=this.grid.get(e,t);n instanceof FormulaCell&&this.formulas.delete(n),s instanceof FormulaCell&&this.formulas.add(s),this.grid.set(e,t,s),e>this.lowest&&(this.lowest=e)}expand(){if(!this.expanded){this.expanded=!0;for(let e=this.fills.length-1;e>=0;e--){const t=this.fills[e];if(!t)continue;const{area:s,shared:n,value:i,format:a}=t;for(let r=s.top;r<=s.bottom;r++)for(let o=s.left;o<=s.right;o++)this.grid.get(r,o)===void 0&&(this.blanks.has(placeKey(r,o))||(n?this.put(r,o,new FormulaCell(n,this,r,o)):i!=null&&(this.put(r,o,i),a!==void 0&&this.implied.set(placeKey(r,o),a))))}}}at(e,t){return this.expand(),this.grid.get(e,t)}spillAt(e,t){return this.ghosts.size===0?void 0:this.ghosts.get(placeKey(e,t))}holds(e,t){return this.expand(),this.grid.holds(e,t.row,t.col)}spillsIn(e){if(this.spills.size===0)return[];if((e.bottom-e.top+1)*(e.right-e.left+1)>=this.spills.size)return[...this.spills].filter(n=>n.spill!==void 0&&v(n.spill,e));const s=new Set;for(let n=e.top;n<=e.bottom;n++)for(let i=e.left;i<=e.right;i++){const a=this.ghosts.get(placeKey(n,i));a&&s.add(a)}return[...s]}blockedBy(e){if(this.stopped.size===0)return[];const t=[];for(const s of this.stopped)s.blocked&&v(s.blocked,e)&&t.push(s);return t}placeSpill(e,t){e.spill=t,this.spills.add(e);for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)(s!==e.row||n!==e.col)&&this.ghosts.set(placeKey(s,n),e);this.reach&&T(this.reach,t)}blockSpill(e,t){e.blocked=t,this.stopped.add(e)}clearSpill(e){const t=e.spill;if(t)for(let s=t.top;s<=t.bottom;s++)for(let n=t.left;n<=t.right;n++)this.ghosts.get(placeKey(s,n))===e&&this.ghosts.delete(placeKey(s,n));e.spill=void 0,e.blocked=void 0,this.spills.delete(e),this.stopped.delete(e)}clearSpills(){for(const e of[...this.spills,...this.stopped])e.spill=void 0,e.blocked=void 0;this.spills.clear(),this.stopped.clear(),this.ghosts.clear(),this.reach=void 0}tighten(){this.reach=void 0}spillReach(){if(this.reach)return this.reach;const e={columns:new Map,bottom:-1,right:-1};for(const{spill:t}of this.spills)t&&T(e,t);return this.reach=e,e}hasFormulas(e){return this.expand(),this.grid.hasFormulas(e)}span(e,t,s){this.expand();const n=this.grid.first(e),i=this.grid.last(e);if(this.spills.size===0)return[Math.max(t,n),Math.min(s,i)];const[a,r]=this.spillReach().columns.get(e)??[1/0,-1];return[Math.max(t,Math.min(n,a)),Math.min(s,Math.max(i,r))]}get columnsUsed(){return this.expand(),this.spills.size===0?this.grid.width:Math.max(this.grid.width,this.spillReach().right+1)}get lastRow(){return this.expand(),this.spills.size===0?this.lowest:Math.max(this.lowest,this.spillReach().bottom)}get used(){const e=this.lastRow,t=this.columnsUsed-1;return e<0||t<0?void 0:{top:0,left:0,bottom:e,right:t}}tableAt(e,t){return this.tables.find(s=>y(s.area,e,t))}blockAt(e,t){return this.blocks.find(s=>y(s.area,e,t))}looks(){if(this.lookAreas)return this.lookAreas;const e=[];for(const s of this.spec.format??[]){const n=$(s.range);n&&e.push({area:n,entry:s})}const t=[];for(const[s,n]of Object.entries(this.spec.cells??{})){if(!s.includes(":")||n===null||typeof n!="object")continue;const i=$(s);i&&t.push({area:i,entry:n})}return this.lookAreas={formats:e,ranges:t},this.lookAreas}styledAreas(){const{formats:e,ranges:t}=this.looks();return[...e,...t.filter(s=>Object.keys(s.entry).some(n=>F.has(n)))]}lookAt(e,t){const s={},n=c=>{if(c)for(const[b,w]of Object.entries(c))F.has(b)&&w!==void 0&&(s[b]=b==="border"?{...s.border,...w}:w)},i=this.implied.get(placeKey(e,t));i!==void 0&&(s.format=i);const a=this.ghosts.size===0?void 0:this.spillAt(e,t),r=a&&this.lookAt(a.row,a.col).format;r!==void 0&&(s.format=r),this.spec.columns&&n(this.spec.columns[j(t)]),this.spec.rows&&n(this.spec.rows[String(e+1)]);const o=this.tableAt(e,t);o&&e>o.at.row&&n(o.columns[t-o.at.col]?.spec);const{formats:f,ranges:h}=this.looks();for(const c of f)y(c.area,e,t)&&n(c.entry);for(const c of h)y(c.area,e,t)&&n(c.entry);const d=this.keys.get(placeKey(e,t)),g=d===void 0?void 0:this.spec.cells?.[d];if(g!==null&&typeof g=="object"&&n(g),s.border){const c=Object.entries(s.border).filter(([,b])=>b?.style!=="none");c.length===0?delete s.border:s.border=Object.fromEntries(c)}return s}mergeAt(e,t){return this.merges.find(s=>y(s,e,t))}validationAt(e,t){return this.validations.find(s=>s.areas.some(n=>y(n,e,t)))}filterHeadAt(e,t){return this.filters.find(s=>e===s.area.top&&t>=s.area.left&&t<=s.area.right)}filterAt(e,t){return this.filters.find(s=>y(s.area,e,t))}filesAt(e,t){const s=this.tableAt(e,t);if(s&&e>s.at.row){const n=s.columns[t-s.at.col]?.spec?.files;if(n!==void 0)return n}return s?.at.row===e?void 0:this.spec.columns?.[j(t)]?.files}}export const filesSeparator=l=>(typeof l=="object"?l.separator:void 0)??P;export function filesIn(l,e){const t=filesSeparator(e);return l.split(t.trim()===""?t:t.trim()).map(s=>s.trim()).filter(s=>s!=="")}const F=new Set(["bold","italic","underline","strike","font","size","color","fill","align","valign","wrap","shrink","indent","rotation","border","format"]);export class Workbook{title;sheets=[];names=new Map;checks=[];bySheet=new Map;byTable=new Map;file;generated;ordinary=[];constructor(e,t){this.file=e,this.title=e.title,this.generated=t}respec(e){this.file=O(e,this.generated).file,this.title=e.title,this.sheets.forEach(t=>{const s=e.sheets.find(n=>n.name===t.name);s&&t.respec(s)})}sheet(e){return this.bySheet.get(e.toLowerCase())}table(e){return this.byTable.get(e.toLowerCase())}name(e,t){const s=e.toLowerCase();return(t?.names.size?t.names.get(s):void 0)??this.names.get(s)}definitions(e){const t=e.toLowerCase(),s=[],n=this.names.get(t);n&&s.push(n);for(const i of this.sheets){const a=i.names.get(t);a&&s.push(a)}return s}get tables(){return[...this.byTable.values()]}addSheet(e){this.sheets.push(e),this.bySheet.set(e.name.toLowerCase(),e)}addTable(e){e.sheet.tables.push(e),this.byTable.set(e.name.toLowerCase(),e)}sourceOf(e,t,s){if(e.generated)return{file:C};const n=this.sheets.indexOf(e),i=e.tableAt(t,s);if(i){const o=i.columns[s-i.at.col],f=t-i.at.row-1,h=o?.csv!==void 0&&(i.records[f]?.[o.csv]??"")!=="";return f>=0&&o?.formula&&!h?o.formula.source:{file:i.file,line:f<0?1:i.lines[f]??1}}const a=e.blockAt(t,s);if(a)return{file:a.file,line:a.lines[t-a.area.top]??1};const r=e.keys.get(placeKey(t,s));if(r!==void 0)return{file:E,path:["sheets",n,"cells",r]};for(const o of Object.keys(e.spec.cells??{})){if(!o.includes(":"))continue;const f=$(o);if(f&&y(f,t,s))return{file:E,path:["sheets",n,"cells",o]}}}}export const MAX_FILL_CELLS=5e6;const q=/^[\p{L}_\\][\p{L}\p{N}_.\\?]*$/u;export function validName(l){return q.test(l)&&x(l)===void 0&&!/^(?:TRUE|FALSE)$/iu.test(l)&&!/^[Rr](?:\d+)?(?:[Cc]\d*)?$/u.test(l)&&!/^[Cc]\d*$/u.test(l)}const M="made",k=l=>l[0]===M?C:E;class N{problems=[];wb;read_;lineOf;own;madeNames;constructor(e,t,s,n,i){this.wb=e,this.read_=t,this.lineOf=s,this.own=n,this.madeNames=i}yaml(e,t){const s=this.lineOf(e);this.problems.push({file:k(e),...s===void 0?{}:{line:s},message:t})}sheetPath(e){return e<this.own?["sheets",e]:[M,"sheets",e-this.own]}read(){const{file:e}=this.wb;e.sheets.forEach((t,s)=>{const n=this.sheetPath(s);if(this.wb.sheet(t.name)){this.yaml([...n,"name"],`two sheets are named ${t.name}`);return}(/[\\/?*[\]:]/u.test(t.name)||t.name.length>31)&&this.yaml([...n,"name"],`${t.name} cannot be a sheet's name: at most 31 characters, none of \\ / ? * [ ] :`);const i=new Worksheet(t.name,this.wb.sheets.length,t);i.generated=s>=this.own,this.wb.addSheet(i)}),this.names();for(const[t,s]of e.sheets.entries()){const n=this.wb.sheets[t];n?.spec===s&&this.sheet(n,this.sheetPath(t))}e.checks?.forEach((t,s)=>{const n={file:E,path:["checks",s,"formula"]};this.wb.checks.push({name:t.name,formula:new SharedFormula(t.formula,0,0,n),source:n})})}names(){const{file:e}=this.wb;this.namesOf(e.names,e.hidden_names,t=>this.madeNames.has(t)?[M,"names",t]:["names",t],this.wb.names,void 0),e.sheets.forEach((t,s)=>{const n=this.wb.sheets[s];n?.spec===t&&this.namesOf(t.names,t.hidden_names,i=>[...this.sheetPath(s),"names",i],n.names,n)})}namesOf(e,t,s,n,i){const a=new Set(t?.map(r=>r.toLowerCase()));for(const[r,o]of Object.entries(e??{})){const f=s(r);if(!validName(r)){this.yaml(f,`${r} cannot be a name`);continue}const h={file:k(f),path:f},d=typeof o=="string"&&o.startsWith("=")?{name:r,formula:new SharedFormula(o,0,0,h),source:h}:{name:r,value:typeof o=="string"?S(o).value:o,source:h};i&&(d.sheet=i),a.has(r.toLowerCase())&&(d.hidden=!0),n.set(r.toLowerCase(),d)}}sheet(e,t){const{spec:s}=e;if(s.freeze!==void 0){const n=x(s.freeze);n?e.freeze=n:this.yaml([...t,"freeze"],`${s.freeze} is not a cell`)}s.tables?.forEach((n,i)=>{this.table(e,n,[...t,"tables",i])});for(const[n,i]of e.tables.entries())for(const a of e.tables.slice(n+1))v(i.area,a.area)&&this.problems.push({file:E,message:`tables ${i.name} and ${a.name} overlap on ${e.name}`});s.blocks?.forEach((n,i)=>{this.block(e,n.at,n.rows,[...t,"blocks",i])}),this.cells(e,s.cells??{},[...t,"cells"]),s.merges?.forEach((n,i)=>{const a=$(n);a?e.merges.push(a):this.yaml([...t,"merges",i],`${n} is not a range`)}),s.format?.forEach((n,i)=>{$(n.range)||this.yaml([...t,"format",i,"range"],`${n.range} is not a range`)}),s.conditional?.forEach((n,i)=>{this.condition(e,n,[...t,"conditional",i])}),s.validations?.forEach((n,i)=>{this.validation(e,n,[...t,"validations",i])}),this.filters(e,t),s.charts?.forEach((n,i)=>{this.chart(e,n,i,[...t,"charts",i])});for(const n of Object.keys(s.columns??{}))z(n)===void 0&&this.yaml([...t,"columns",n],`${n} is not a column`);for(const n of Object.keys(s.rows??{}))(!/^[1-9]\d*$/u.test(n)||Number(n)>B)&&this.yaml([...t,"rows",n],`${n} is not a row`)}chart(e,t,s,n){const i=W(t,s,n,(a,r)=>{this.yaml(a,r)});i&&e.charts.push(i)}bound(e,t,s){if(!(typeof e!="string"||!e.startsWith("=")||e.length<2))return new SharedFormula(e,t?.top??0,t?.left??0,{file:k(s),path:s})}condition(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const[i]=n,a=[],r=(o,f)=>{const h=this.bound(o,i,f);h&&a.push(h)};if(t.type==="expression"){const o=t.formula.startsWith("=")?t.formula:`=${t.formula}`;r(o,[...s,"formula"])}if(t.type==="cellIs"&&t.formula.forEach((o,f)=>{r(o,[...s,"formula",f])}),t.type==="dataBar")for(const o of["min","max"])r(t[o]?.value,[...s,o,"value"]);(t.type==="colorScale"||t.type==="iconSet")&&t.stops?.forEach((o,f)=>{r(o.value,[...s,"stops",f,"value"])}),e.conditions.push({spec:t,areas:n,formulas:a})}validation(e,t,s){const n=_(t.range);if(!n){this.yaml([...s,"range"],`${t.range} is not a range`);return}const i=(t.formula??[]).map((o,f)=>this.bound(o,n[0],[...s,"formula",f])),a=t.formula?.length??0,r=t.type!=="list"&&t.type!=="custom"&&(t.operator===void 0||t.operator==="between"||t.operator==="notBetween");!(t.type==="list"&&t.values!==void 0)&&a<(r?2:1)&&this.yaml(s,`a ${t.type} validation needs its bounds`),e.validations.push({spec:t,areas:n,formulas:i})}filters(e,t){const{spec:s}=e;if(s.filter){const n=[...t,"filter"],i=$(s.filter.range);if(!i)this.yaml([...n,"range"],`${s.filter.range} is not a range`);else{const a=new Map;for(const[o,f]of Object.entries(s.filter.columns??{})){const h=z(o);h===void 0||h<i.left||h>i.right?this.yaml([...n,"columns",o],`${o} is not a column of ${s.filter.range}`):a.set(h,f)}const r=e.tables.find(o=>v(o.area,i));r&&this.yaml(n,`a filter over table ${r.name}: a table has its own`),e.filters.push({area:i,columns:a})}}e.tables.forEach((n,i)=>{const{filter:a}=n.spec;if(a===!1)return;const r=new Map;for(const[o,f]of Object.entries(a?.columns??{})){const h=n.column(o);h?r.set(n.at.col+h.index,f):this.yaml([...t,"tables",i,"filter","columns",o],`table ${n.name} has no column ${o}`)}e.filters.push({area:n.area,table:n,columns:r})})}csv(e,t,s){const n=this.read_(e);return n||this.yaml(t,`${s}: ${e} is not there`),n}overlapping(e,t){const s=e.tables.find(i=>v(i.area,t));if(s)return`table ${s.name}`;const n=e.blocks.find(i=>v(i.area,t));return n?`the block of ${n.file}`:void 0}typed(e,t,s,n,i){if(n.formula!==void 0){const a=new SharedFormula(n.formula,t,s,i);e.put(t,s,new FormulaCell(a,e,t,s));return}n.value!==null&&(e.put(t,s,n.value),n.format!==void 0&&e.implied.set(placeKey(t,s),n.format))}table(e,t,s){const n=x(t.at);if(!n){this.yaml([...s,"at"],`${t.at} is not a cell`);return}if(!validName(t.name)){this.yaml([...s,"name"],`${t.name} cannot be a table's name`);return}if(this.wb.table(t.name)){this.yaml([...s,"name"],`two tables are named ${t.name}`);return}this.wb.name(t.name)&&this.yaml([...s,"name"],`${t.name} is a defined name and a table's`);const i=new Table(t.name,e,n,t.rows,t),a=this.csv(t.rows,[...s,"rows"],`table ${t.name}`),r=a?.rows??[],o=a?.lines??[],f=r[0],h=o[0]??1,d=new Set,g=f?.length===0?[""]:f??[];g.forEach((u,m)=>{const p=u.trim();p===""&&this.problems.push({file:t.rows,line:h,message:`column ${String(m+1)} has no name`}),d.has(p.toLowerCase())&&this.problems.push({file:t.rows,line:h,message:`two columns are named ${p}`}),d.add(p.toLowerCase()),i.columns.push({name:p,index:i.columns.length,csv:m})});for(const[u,m]of Object.entries(t.columns??{})){const p=i.column(u),A=p??{name:u,index:i.columns.length};p||(m.formula===void 0&&this.yaml([...s,"columns",u],`table ${t.name} has no column ${u}`),i.columns.push(A)),A.spec=m}const c=g.length;for(let u=1;u<r.length;u++){const m=r[u];if(!m||m.length===0)continue;const p=o[u]??u+1;i.places.push(u),i.records.push(m),i.lines.push(p),m.length>c&&this.problems.push({file:t.rows,line:p,message:`this row has ${String(m.length)} fields and the header ${String(c)}`})}i.rows=i.records.length;const b=this.overlapping(e,i.area);b&&this.yaml(s,`table ${t.name} overlaps ${b} on ${e.name}`),this.wb.addTable(i),this.tableKey(i,s);const w=n.row+1;i.columns.forEach(u=>{const m=n.col+u.index;e.put(n.row,m,u.name);const p=u.spec?.formula;p!==void 0&&(u.formula=new SharedFormula(p,w,m,{file:k(s),path:[...s,"columns",u.name,"formula"]}),i.rows>0&&e.fills.push({area:{top:w,left:m,bottom:w+i.rows-1,right:m},shared:u.formula})),u.csv!==void 0&&i.records.forEach((A,L)=>{this.typed(e,w+L,m,S(A[u.csv??0]??""),{file:t.rows,line:i.lines[L]??1})})})}tableKey(e,t){const{key:s}=e.spec;if(s===void 0)return;const n=e.column(s);if(n?.csv===void 0){this.yaml([...t,"key"],`table ${e.name} has no column ${s} in ${e.file}`);return}const i=new Set;e.records.forEach((a,r)=>{const o=a[n.csv??0]??"",f=e.lines[r]??1;o===""?this.problems.push({file:e.file,line:f,message:`this row has no ${s}, table ${e.name}'s key`}):i.has(o)&&this.problems.push({file:e.file,line:f,message:`two rows have the key ${o}`}),i.add(o)})}block(e,t,s,n){const i=x(t);if(!i){this.yaml([...n,"at"],`${t} is not a cell`);return}const a=this.csv(s,[...n,"rows"],"a block");if(!a)return;const r=a.rows,o=r.map((g,c)=>a.lines[c]??c+1),f=r.reduce((g,c)=>Math.max(g,c.length),1),h={top:i.row,left:i.col,bottom:i.row+Math.max(r.length,1)-1,right:i.col+f-1},d=this.overlapping(e,h);d&&this.yaml(n,`the block of ${s} overlaps ${d} on ${e.name}`),e.blocks.push({area:h,file:s,lines:o}),r.forEach((g,c)=>{g.forEach((b,w)=>{this.typed(e,i.row+c,i.col+w,S(b),{file:s,line:o[c]??c+1})})})}cells(e,t,s){const n=[];for(const[i,a]of Object.entries(t)){const r=[...s,i],o=$(i);if(!o){this.yaml(r,`${i} is not a cell or a range`);continue}const f=this.overlapping(e,o);if(f&&this.yaml(r,`${i} overlaps ${f}`),i.includes(":")){const h=(o.bottom-o.top+1)*(o.right-o.left+1);h>MAX_FILL_CELLS?this.yaml(r,`${i} is ${String(h)} cells`):this.fill(e,o,a,r)}else n.push([i,a,{row:o.top,col:o.left}])}for(const[i,a,r]of n){const o=[...s,i],f=K(a),h=placeKey(r.row,r.col);e.keys.set(h,i),f.value===null&&f.formula===void 0&&e.blanks.add(h),this.typed(e,r.row,r.col,f,{file:k(o),path:o});const d=a!==null&&typeof a=="object"?a.name:void 0;d!==void 0&&this.cellName(e,r,d,o)}}cellName(e,t,s,n){if(!validName(s)){this.yaml(n,`${s} cannot be a name`);return}if(this.wb.name(s)){this.yaml(n,`two places are named ${s}`);return}const i={file:k(n),path:n},a=H(t).replace(/^([A-Z]+)(\d+)$/u,"$$$1$$$2"),r=`='${e.name.replaceAll("'","''")}'!${a}`;this.wb.names.set(s.toLowerCase(),{name:s,formula:new SharedFormula(r,0,0,i),source:i})}fill(e,t,s,n){const i=K(s),a={file:k(n),path:n};e.fills.push(i.formula===void 0?{area:t,value:i.value,...i.format===void 0?{}:{format:i.format}}:{area:t,shared:new SharedFormula(i.formula,t.top,t.left,a)})}}function W(l,e,t,s){const n=x(l.at);if(!n){s([...t,"at"],`${l.at} is not a cell`);return}const i=(o,f)=>{const h=new SharedFormula(chartFormula(o),0,0,{file:k(f),path:f});return h.node&&!I(h.node)&&s(f,`${o} is not a range or a table's column`),h},a=(o,f)=>o?.startsWith("=")===!0?i(o,f):void 0,r=a(l.title,[...t,"title"]);return{spec:l,at:n,index:e,...l.categories===void 0?{}:{categories:i(l.categories,[...t,"categories"])},...r?{title:r}:{},series:l.series.map((o,f)=>{const h=[...t,"series",f],d=a(o.name,[...h,"name"]);return{values:i(o.values,[...h,"values"]),...o.x===void 0?{}:{x:i(o.x,[...h,"x"])},...d?{name:d}:{}}})}}export const chartFormula=l=>l.startsWith("=")?l:`=${l}`;function I(l){switch(l.kind){case"error":case"ref":case"structured":case"name":return!0;case"paren":case"postfix":return I(l.arg);case"binary":return l.op===":"||l.op===",";default:return!1}}function K(l){if(l===null)return{value:null};if(typeof l=="string")return S(l);if(typeof l!="object")return{value:l};if(l.formula!==void 0)return{value:null,formula:l.formula.startsWith("=")?l.formula:`=${l.formula}`};const{value:e}=l;return typeof e=="string"?S(e):{value:e??null}}export function readWorkbook(l){const e=D(l.text),t=r=>r[0]===M?void 0:e.lineOf(r);if(!e.file)return{problems:e.problems,lineOf:t};const s=O(e.file,l.generated),n=new Workbook(s.file,l.generated);n.ordinary=s.ordinary;const i=[],a=new N(n,r=>{const o=l.generated?.csv[r]??l.read(r);if(o===void 0)return;const f=R(o);for(const h of f.problems)i.push({file:r,line:h.line,message:h.message});return{rows:f.records.map(h=>h.end===h.start?[]:h.fields),lines:f.records.map(h=>h.line)}},t,s.own,s.names);return a.read(),{workbook:n,problems:[...i,...a.problems],lineOf:t}}export function workbookOf(l){const e=O(l.file,l.generated),t=new Workbook(e.file,l.generated);return t.ordinary=e.ordinary,new N(t,s=>{const n=l.generated?.csv[s];if(n!==void 0)return{rows:R(n).records.map(a=>a.end===a.start?[]:a.fields),lines:[]};const i=l.rows(s);return i&&{rows:i,lines:[]}},()=>{},e.own,e.names).read(),t}export{U as rangeName};
|
|
@@ -10,9 +10,13 @@ export interface DrawnPicture {
|
|
|
10
10
|
col: number;
|
|
11
11
|
/** How far into its cell, px. */
|
|
12
12
|
x: number;
|
|
13
|
+
/** Down it: a picture over the cells; one in a cell has none, and its row grows to hold it. */
|
|
14
|
+
y?: number;
|
|
13
15
|
width: number;
|
|
14
16
|
height: number;
|
|
15
17
|
name: string;
|
|
18
|
+
/** Its file's path from the sheet's folder, kept as its description so a reader finds it again. */
|
|
19
|
+
path: string;
|
|
16
20
|
file: string;
|
|
17
21
|
bytes: Uint8Array;
|
|
18
22
|
}
|
|
@@ -34,9 +38,16 @@ export interface Anchored {
|
|
|
34
38
|
width: number;
|
|
35
39
|
height: number;
|
|
36
40
|
}
|
|
37
|
-
/**
|
|
41
|
+
/** A picture of a drawing: its image by relationship, and what it is called. */
|
|
42
|
+
export interface AnchoredPicture extends Anchored {
|
|
43
|
+
name?: string;
|
|
44
|
+
/** Its description: the path of the file it was, when this writer wrote it. */
|
|
45
|
+
descr?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Each chart and picture of a drawing where it sits, sizes in pixels, and how many other things it holds. */
|
|
38
48
|
export declare function chartAnchors(root: Tag | undefined, columnWidth: (col: number) => number, rowHeight: (row: number) => number): {
|
|
39
49
|
anchors: Anchored[];
|
|
50
|
+
pictures: AnchoredPicture[];
|
|
40
51
|
others: number;
|
|
41
52
|
};
|
|
42
53
|
//# sourceMappingURL=charts.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{CHART_DEFAULTS as Q,chartSpaceXml as ce}from"@allyhub-next/chart";import{columnLetter as Y}from"../address.js";import{Reference as Z,Union as ae}from"../calc/types.js";import{chartDef as fe,chartSize as de}from"../chart.js";import{sheetPrefix as le}from"../formula/print.js";import{HEAD as ue,attr as
|
|
2
|
+
import{CHART_DEFAULTS as Q,chartSpaceXml as ce}from"@allyhub-next/chart";import{columnLetter as Y}from"../address.js";import{Reference as Z,Union as ae}from"../calc/types.js";import{chartDef as fe,chartSize as de}from"../chart.js";import{sheetPrefix as le}from"../formula/print.js";import{HEAD as ue,attr as y,el as s,flag as ee,numberAttr as M,tag as r,tags as R,textOf as O}from"./xml.js";const he="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",me="http://schemas.openxmlformats.org/drawingml/2006/main",te="http://schemas.openxmlformats.org/drawingml/2006/chart",re="http://schemas.openxmlformats.org/officeDocument/2006/relationships",g=9525,xe=(e,t)=>`${le(e.sheet.name)}$${Y(e.left)}$${String(e.top+1)}${e.single?"":`:$${Y(e.right)}$${String(t+1)}`}`;function _(e,t,n){if(!n?.node)return;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0}),i=a=>xe(a,Math.min(a.bottom,Math.max(a.top,a.sheet.lastRow)));if(o instanceof Z)return i(o);if(o instanceof ae)return`(${o.parts.map(i).join(",")})`}function pe(e,t,n){if(!n?.node)return!1;const o=e.eval(n.node,{sheet:t,row:0,col:0,dr:0,dc:0});return o instanceof Z&&typeof e.value(o.sheet,o.top,o.left)=="number"}export function chartPart(e,t,n){const o=fe(e,t,n),i={name:l=>_(e,t,n.series[l]?.name),categories:_(e,t,n.categories),numeric:pe(e,t,n.categories),values:l=>_(e,t,n.series[l]?.values)??"",x:l=>_(e,t,n.series[l]?.x??n.categories)},a=_(e,t,n.title);return ce(o,{refs:i,...a===void 0?{}:{titleRef:a}})}const ge=(e,t,n)=>s("xdr:oneCellAnchor",{},s("xdr:from",{},`<xdr:col>${String(e.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round(e.x*g))}</xdr:colOff>`,`<xdr:row>${String(e.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((e.y??0)*g))}</xdr:rowOff>`),s("xdr:ext",{cx:Math.round(e.width*g),cy:Math.round(e.height*g)}),s("xdr:pic",{},s("xdr:nvPicPr",{},s("xdr:cNvPr",{id:t,name:e.name,descr:e.path}),s("xdr:cNvPicPr",{},s("a:picLocks",{noChangeAspect:!0}))),s("xdr:blipFill",{},s("a:blip",{"xmlns:r":re,"r:embed":`rId${String(n)}`}),s("a:stretch",{},s("a:fillRect"))),s("xdr:spPr",{},s("a:xfrm",{},s("a:off",{x:0,y:0}),s("a:ext",{cx:Math.round(e.width*g),cy:Math.round(e.height*g)})),s("a:prstGeom",{prst:"rect"},s("a:avLst")))),s("xdr:clientData"));export function drawingPart(e,t=[]){const n=(o,i)=>{const{width:a,height:l}=de(o.spec);return s("xdr:oneCellAnchor",{},s("xdr:from",{},`<xdr:col>${String(o.at.col)}</xdr:col>`,`<xdr:colOff>${String(Math.round((o.spec.x??0)*g))}</xdr:colOff>`,`<xdr:row>${String(o.at.row)}</xdr:row>`,`<xdr:rowOff>${String(Math.round((o.spec.y??0)*g))}</xdr:rowOff>`),s("xdr:ext",{cx:Math.round(a*g),cy:Math.round(l*g)}),s("xdr:graphicFrame",{macro:""},s("xdr:nvGraphicFramePr",{},s("xdr:cNvPr",{id:i+2,name:`Chart ${String(i+1)}`}),s("xdr:cNvGraphicFramePr")),s("xdr:xfrm",{},s("a:off",{x:0,y:0}),s("a:ext",{cx:0,cy:0})),s("a:graphic",{},s("a:graphicData",{uri:te},s("c:chart",{"xmlns:c":te,"xmlns:r":re,"r:id":`rId${String(i+1)}`})))),s("xdr:clientData"))};return ue+s("xdr:wsDr",{"xmlns:xdr":he,"xmlns:a":me},...e.map(n),...t.map((o,i)=>ge(o,e.length+i+2,e.length+i+1)))}function I(e){if(Array.isArray(e))return e.map(I).join("");if(typeof e!="object"||e===null)return"";const t=e,n=[];for(const[o,i]of Object.entries(t))o==="t"?n.push(O(i)):typeof i=="object"&&n.push(I(i));return n.join("")}const V=e=>{const t=r(e?.solidFill),n=y(r(t?.srgbClr),"val");return n!==void 0?`#${n.toUpperCase()}`:we[y(r(t?.schemeClr),"val")??""]},we={accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47"},$=(e,t)=>y(r(e?.[t]),"val"),A=(e,t)=>M(r(e?.[t]),"val"),F=(e,t)=>ee(r(e?.[t]),"val");function ne(e){if(!e)return;const t=r(e.tx),n=r(t?.strRef);if(n)return`=${O(n.f)}`;const o=I(t?.rich);return o===""?void 0:o}function oe(e){if(!e)return;const t=r(e.scaling),n=r(e.numFmt),o=y(n,"formatCode"),i={},a=ne(r(e.title));a!==void 0&&(i.title=a);const l=A(t,"min"),x=A(t,"max"),u=A(e,"majorUnit");return l!==void 0&&(i.min=l),x!==void 0&&(i.max=x),u!==void 0&&u>0&&(i.major=u),F(e,"delete")===!0&&(i.visible=!1),$(t,"orientation")==="maxMin"&&(i.reverse=!0),o!==void 0&&o!=="General"&&ee(n,"sourceLinked")!==!0&&(i.format=o),i}const j=e=>{const t=r(e?.numRef)??r(e?.strRef),n=t?O(t.f):"";return n===""?void 0:n};function be(e,t){const n=j(r(e[t?"yVal":"val"]));if(n===void 0)return"its numbers are written in the chart";const o={values:n},i=r(e.tx),a=j(i);if(a!==void 0)o.name=`=${a}`;else{const d=O(i?.v);d!==""&&(o.name=d)}const l=r(e.spPr),x=r(l?.ln),u=r(e.marker),w=t||u!==void 0,c=V(l)??(w?V(x)??V(r(u?.spPr)):void 0);c!==void 0&&(o.color=c);const f=M(x,"w");if(w&&f!==void 0&&x?.noFill===void 0){const d=Number((f/12700).toFixed(2));d!==Q.lineWidth&&(o.line_width=d)}F(e,"smooth")===!0&&(o.smooth=!0);const m=A(u,"size");m!==void 0&&m!==Q.marker&&(o.marker_size=m);const v=t?j(r(e.xVal)):void 0;v!==void 0&&(o.x=v);const b=t?void 0:j(r(e.cat));return{series:o,...b===void 0?{}:{categories:b}}}function ve(e){const t=$(e,"barDir")==="bar"?"bar":"column",n=$(e,"grouping");return n==="stacked"?`${t}-stacked`:n==="percentStacked"?`${t}-stacked-100`:`${t}-clustered`}function ye(e){const t=$(e,"grouping");return t==="stacked"?"area-stacked":t==="percentStacked"?"area-stacked-100":"area"}export function readChart(e){const t=r(e?.chartSpace),n=r(t?.chart),o=r(n?.plotArea);if(!n||!o)return"it has no plot";const i=Object.entries(o).filter(([h])=>h.endsWith("Chart")),[a]=i;if(!a)return"it has no plot";if(i.length>1||Array.isArray(a[1])&&a[1].length>1)return"it combines several kinds of chart";const[l,x]=a,u=r(x);if(!u)return"it has no plot";const w=R(u.ser),c=l==="scatterChart",f=[];let m;for(const h of w){const P=be(h,c);if(typeof P=="string")return P;f.push(P.series),m??=P.categories}if(f.length===0)return"it has no series";const v=h=>r(r(h.spPr)?.ln)?.noFill!==void 0,b=h=>$(r(h.marker),"symbol")==="none",d=(()=>{switch(l){case"barChart":return ve(u);case"lineChart":return w.every(b)?"line":"line-markers";case"areaChart":return ye(u);case"pieChart":return"pie";case"doughnutChart":return"doughnut";case"scatterChart":return w.every(v)?"scatter":w.some(h=>F(h,"smooth")===!0)?"scatter-smooth":"scatter-lines";default:return}})();if(!d)return`a sheet has no ${l.replace(/Chart$/u,"")} chart`;const S=ne(r(n.title)),k=r(n.legend),C=$(k,"legendPos"),D=r(u.dLbls),p=h=>F(D,h)===!0,se=p("showVal")||p("showPercent")||p("showCatName")||p("showSerName"),H=$(D,"dLblPos"),z=A(u,"gapWidth"),W=A(u,"overlap"),E=A(u,"holeSize"),X=F(u,"varyColors"),B=d==="pie"||d==="doughnut",N={value:R(o.valAx).find((h,P,ie)=>c?P===ie.length-1:!0),category:c?R(o.valAx)[0]:r(o.catAx)??r(o.dateAx)},G=oe(N.value),T=oe(N.category);G&&N.value?.majorGridlines===void 0&&(G.gridlines=!1),T&&N.category?.majorGridlines!==void 0&&(T.gridlines=!0);const U=M(r(r(r(r(t?.txPr)?.p)?.pPr)?.defRPr),"sz"),q=h=>h&&Object.keys(h).length>0?h:void 0,J=q(G),K=q(T);return{type:d,at:"A1",...S===void 0?{}:{title:S},...m===void 0?{}:{categories:m},series:B?f.slice(0,1):f,...k?{legend:C==="b"?"bottom":C==="t"?"top":C==="l"?"left":"right"}:{},...se?{labels:{...p("showVal")?{value:!0}:{},...p("showPercent")?{percentage:!0}:{},...p("showCatName")?{category:!0}:{},...p("showSerName")?{series:!0}:{},...H===void 0?{}:{position:H}}}:{},...z===void 0||z===150?{}:{gap_width:z},...W===void 0||d.includes("stacked")?{}:{overlap:W},...E===void 0||E===50?{}:{hole_size:E},...X===!0&&l==="barChart"?{vary_by_categories:!0}:{},...X===!1&&B?{vary_by_categories:!1}:{},...J?{value_axis:J}:{},...K?{category_axis:K}:{},...U===void 0||U===900?{}:{size:U/100}}}const L=e=>Math.round(e/g);export function chartAnchors(e,t,n){const o=r(e?.wsDr),i=[],a=[];let l=0;const x=c=>({col:Number(O(c?.col)),row:Number(O(c?.row)),colOff:L(Number(O(c?.colOff))),rowOff:L(Number(O(c?.rowOff)))}),u=c=>y(r(r(r(r(c.graphicFrame)?.graphic)?.graphicData)?.chart),"id"),w=(c,f,m,v)=>{const b={at:{row:f.row,col:f.col},...f.colOff>0?{x:f.colOff}:{},...f.rowOff>0?{y:f.rowOff}:{},width:m,height:v},d=r(c.pic),S=y(r(r(d?.blipFill)?.blip),"embed");if(d&&S!==void 0){const C=r(r(d.nvPicPr)?.cNvPr),D=y(C,"name"),p=y(C,"descr");a.push({id:S,...b,...D===void 0?{}:{name:D},...p===void 0?{}:{descr:p}});return}const k=u(c);if(k===void 0){l+=1;return}i.push({id:k,...b})};for(const c of R(o?.oneCellAnchor)){const f=r(c.ext);w(c,x(r(c.from)),L(M(f,"cx")??0),L(M(f,"cy")??0))}for(const c of R(o?.twoCellAnchor)){const f=x(r(c.from)),m=x(r(c.to));let v=m.colOff-f.colOff;for(let d=f.col;d<m.col;d++)v+=t(d);let b=m.rowOff-f.rowOff;for(let d=f.row;d<m.row;d++)b+=n(d);w(c,f,v,b)}return{anchors:i,pictures:a,others:l}}
|
|
@@ -4,8 +4,12 @@ import type { Node, Parsed } from "../formula/ast.js";
|
|
|
4
4
|
* is expected. `isRangeName` says whether a name stands for several cells.
|
|
5
5
|
*/
|
|
6
6
|
export declare function needsArray(node: Node, isRangeName?: (name: string) => boolean): boolean;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A formula with the narrowing an ordinary <f> does written out with @:
|
|
9
|
+
* wherever one value is expected, its whole body too. `isRangeName` says
|
|
10
|
+
* whether a defined name stands for several cells.
|
|
11
|
+
*/
|
|
12
|
+
export declare function narrowed(n: Node, isRangeName?: (name: string) => boolean): Node;
|
|
9
13
|
export interface FileFormulaContext {
|
|
10
14
|
/** The table the formula is in: the name a bare [@x] leaves out. */
|
|
11
15
|
table?: string | undefined;
|
|
@@ -16,6 +20,12 @@ export interface FileFormulaContext {
|
|
|
16
20
|
}
|
|
17
21
|
/** A formula's text as a file stores it: no =. */
|
|
18
22
|
export declare const fileFormula: (node: Node, c: FileFormulaContext) => string;
|
|
19
|
-
/**
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A formula as a file stores it, parsed. `array`: it is an array formula,
|
|
25
|
+
* so nothing narrows. `isRangeName` says whether a defined name stands for
|
|
26
|
+
* several cells.
|
|
27
|
+
*/
|
|
28
|
+
export declare function readFileFormula(text: string, array: boolean, isRangeName?: (name: string) => boolean): Parsed;
|
|
29
|
+
/** Whether a defined name's text, as a file stores it, is several cells. */
|
|
30
|
+
export declare function isRangeText(text: string): boolean;
|
|
21
31
|
//# sourceMappingURL=formula.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{parseFormula as
|
|
2
|
+
import{parseFormula as p}from"../formula/parse.js";import{printFormula as w}from"../formula/print.js";import{FUNCTIONS as S}from"../calc/functions/index.js";import{fileName as k,plainName as O}from"./functions.js";function c(r){switch(r.kind){case"ref":return r.col2!==void 0||r.row2!==void 0;case"structured":return!r.thisRow||r.columns.length>1;case"paren":return c(r.arg);case"binary":return r.op===":"||r.op===",";default:return!1}}const l=new Set(["+","-","*","/","^","&","=","<>","<","<=",">",">="]),y=new Set(`BYCOL BYROW CHOOSECOLS CHOOSEROWS DROP EXPAND FILTER HSTACK MAKEARRAY MAP
|
|
3
3
|
RANDARRAY SCAN SEQUENCE SORT SORTBY TAKE TEXTSPLIT TOCOL TOROW UNIQUE VSTACK
|
|
4
|
-
WRAPCOLS WRAPROWS`.split(/\s+/u)),
|
|
4
|
+
WRAPCOLS WRAPROWS`.split(/\s+/u)),d=new Set(["IF","IFERROR","IFNA"]),R=r=>S.get(r)?.kind==="scalar";export function needsArray(r,t=()=>!1){const a=e=>c(e)||e.kind==="array"||e.kind==="name"&&t(e.name)||e.kind==="paren"&&a(e.arg);if(r.kind!=="array"&&a(r))return!0;const s=e=>{switch(e.kind){case"unary":return e.op==="@"?!1:a(e.arg)||s(e.arg);case"postfix":return e.op==="%"?a(e.arg)||s(e.arg):!1;case"paren":return s(e.arg);case"binary":return l.has(e.op)&&(a(e.left)||a(e.right))?!0:s(e.left)||s(e.right);case"call":return e.name==="LET"||e.name==="LAMBDA"||y.has(e.name)||R(e.name)&&e.args.some(a)||d.has(e.name)&&e.args[0]&&a(e.args[0])?!0:e.args.some(s);case"invoke":return s(e.callee)||e.args.some(s);default:return!1}};return s(r)}export function narrowed(r,t=()=>!1){const a=e=>e.kind!=="array"&&(c(e)||e.kind==="name"&&t(e.name))?{kind:"unary",op:"@",arg:e}:s(e),s=e=>{switch(e.kind){case"unary":return e.op==="@"?e:{...e,arg:a(e.arg)};case"postfix":return e.op==="%"?{...e,arg:a(e.arg)}:e;case"paren":return{...e,arg:s(e.arg)};case"binary":return l.has(e.op)?{...e,left:a(e.left),right:a(e.right)}:e;case"call":{if(R(e.name))return{...e,args:e.args.map(a)};const[n,...u]=e.args;return d.has(e.name)&&n?{...e,args:[a(n),...u]}:e}default:return e}};return a(r)}const A=(r,t)=>({kind:"call",name:r,written:r,args:t});function E(r,t){return{...r,...r.table===void 0&&t!==void 0?{table:t}:{},sections:r.thisRow?["#This Row"]:r.sections,thisRow:!1}}function g(r,t,a,s){const e=(n,u=!1)=>g(n,t,a,u&&s);switch(r.kind){case"name":{const n=r.name.toLowerCase();return a.has(n)?{...r,name:`_xlpm.${r.name}`}:t.isTable(r.name)?{...r,name:`${r.name}[]`}:r}case"structured":return E(r,t.table);case"unary":return r.op==="@"?s?e(r.arg,!0):A("_xlfn.SINGLE",[e(r.arg)]):{...r,arg:e(r.arg,!0)};case"postfix":return r.op==="#"?A("_xlfn.ANCHORARRAY",[e(r.arg)]):{...r,arg:e(r.arg,!0)};case"paren":return{...r,arg:e(r.arg,!0)};case"binary":return{...r,left:e(r.left,l.has(r.op)),right:e(r.right,l.has(r.op))};case"call":{const n=k(r.name);if(r.name==="LET"||r.name==="LAMBDA"){const u=new Set(a),m=r.args.length-1,h=r.args.map((i,f)=>(r.name==="LAMBDA"||f%2===0)&&f<m&&i.kind==="name"?(u.add(i.name.toLowerCase()),{...i,name:`_xlpm.${i.name}`}):g(i,t,u,!1));return{...r,written:n,args:h}}return{...r,written:n,args:r.args.map(u=>e(u))}}case"invoke":return{...r,callee:e(r.callee),args:r.args.map(n=>e(n))};case"array":return{...r,rows:r.rows.map(n=>n.map(u=>e(u)))};default:return r}}export const fileFormula=(r,t)=>w(g(r,t,new Set,!t.array)).slice(1);function o(r){switch(r.kind){case"name":return r.name.toLowerCase().startsWith("_xlpm.")?{...r,name:r.name.slice(6)}:r;case"structured":return r;case"unary":case"postfix":case"paren":return{...r,arg:o(r.arg)};case"binary":return{...r,left:o(r.left),right:o(r.right)};case"call":{const a=O(r.written).toUpperCase(),s=r.args.map(o),[e]=s;return a==="ANCHORARRAY"&&e&&s.length===1?{kind:"postfix",op:"#",arg:e}:a==="SINGLE"&&e&&s.length===1?{kind:"unary",op:"@",arg:e}:{...r,name:a,written:a,args:s}}case"invoke":return{...r,callee:o(r.callee),args:r.args.map(o)};case"array":return{...r,rows:r.rows.map(t=>t.map(o))};default:return r}}export function readFileFormula(r,t,a){const s=p(`=${r}`);if(!s.ok)return s;const e=o(s.node);return{ok:!0,node:t?e:narrowed(e,a)}}export function isRangeText(r){const t=p(`=${r}`);return t.ok&&c(o(t.node))}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [MS-XLSX] 2.2.2.1 Functions, "future functions", as Microsoft publishes
|
|
3
|
+
* them (learn.microsoft.com/openspecs/office_standards/ms-xlsx/5d1b6d44,
|
|
4
|
+
* revised 2024-04-16), every entry as its table writes it. Its formula
|
|
5
|
+
* grammar sets ECMA.CEILING, ISO.CEILING, NETWORKDAYS.INTL, WORKDAY.INTL
|
|
6
|
+
* and the FORECAST functions outside the `_xlfn.` group by a misplaced
|
|
7
|
+
* parenthesis; Excel, LibreOffice and the table's own FORECAST entries
|
|
8
|
+
* store all of them with it, so every entry here has it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PUBLISHED_FUTURE_FUNCTIONS = "_xlfn._xlws.FILTER _xlfn._xlws.PY\n_xlfn._xlws.SORT _xlfn.ACOT _xlfn.ACOTH _xlfn.AGGREGATE _xlfn.ARABIC _xlfn.BASE\n_xlfn.BETA.DIST _xlfn.BETA.INV _xlfn.BINOM.DIST _xlfn.BINOM.DIST.RANGE\n_xlfn.BINOM.INV _xlfn.BITAND _xlfn.BITLSHIFT _xlfn.BITOR _xlfn.BITRSHIFT\n_xlfn.BITXOR _xlfn.BYCOL _xlfn.BYROW _xlfn.CEILING.MATH _xlfn.CEILING.PRECISE\n_xlfn.CHISQ.DIST _xlfn.CHISQ.DIST.RT _xlfn.CHISQ.INV _xlfn.CHISQ.INV.RT\n_xlfn.CHISQ.TEST _xlfn.CHOOSECOLS _xlfn.CHOOSEROWS _xlfn.COMBINA _xlfn.CONCAT\n_xlfn.CONFIDENCE.NORM _xlfn.CONFIDENCE.T _xlfn.COT _xlfn.COTH\n_xlfn.COVARIANCE.P _xlfn.COVARIANCE.S _xlfn.CSC _xlfn.CSCH _xlfn.DAYS\n_xlfn.DECIMAL _xlfn.DROP ECMA.CEILING _xlfn.ERF.PRECISE _xlfn.ERFC.PRECISE\n_xlfn.EXPAND _xlfn.EXPON.DIST _xlfn.F.DIST _xlfn.F.DIST.RT _xlfn.F.INV\n_xlfn.F.INV.RT _xlfn.F.TEST _xlfn.FIELDVALUE _xlfn.FILTERXML _xlfn.FLOOR.MATH\n_xlfn.FLOOR.PRECISE _xlfn.FORECAST.ETS _xlfn.FORECAST.ETS.CONFINT\n_xlfn.FORECAST.ETS.SEASONALITY _xlfn.FORECAST.ETS.STAT _xlfn.FORECAST.LINEAR\n_xlfn.FORMULATEXT _xlfn.GAMMA _xlfn.GAMMA.DIST _xlfn.GAMMA.INV\n_xlfn.GAMMALN.PRECISE _xlfn.GAUSS _xlfn.HSTACK _xlfn.HYPGEOM.DIST _xlfn.IFNA\n_xlfn.IFS _xlfn.IMCOSH _xlfn.IMCOT _xlfn.IMCSC _xlfn.IMCSCH _xlfn.IMSEC\n_xlfn.IMSECH _xlfn.IMSINH _xlfn.IMTAN _xlfn.ISFORMULA ISO.CEILING\n_xlfn.ISOMITTED _xlfn.ISOWEEKNUM _xlfn.LAMBDA _xlfn.LET _xlfn.LOGNORM.DIST\n_xlfn.LOGNORM.INV _xlfn.MAKEARRAY _xlfn.MAP _xlfn.MAXIFS _xlfn.MINIFS\n_xlfn.MODE.MULT _xlfn.MODE.SNGL _xlfn.MUNIT _xlfn.NEGBINOM.DIST\nNETWORKDAYS.INTL _xlfn.NORM.DIST _xlfn.NORM.INV _xlfn.NORM.S.DIST\n_xlfn.NORM.S.INV _xlfn.NUMBERVALUE _xlfn.PDURATION _xlfn.PERCENTILE.EXC\n_xlfn.PERCENTILE.INC _xlfn.PERCENTRANK.EXC _xlfn.PERCENTRANK.INC\n_xlfn.PERMUTATIONA _xlfn.PHI _xlfn.POISSON.DIST _xlfn.PQSOURCE\n_xlfn.PYTHON_STR _xlfn.PYTHON_TYPE _xlfn.PYTHON_TYPENAME _xlfn.QUARTILE.EXC\n_xlfn.QUARTILE.INC _xlfn.QUERYSTRING _xlfn.RANDARRAY _xlfn.RANK.AVG\n_xlfn.RANK.EQ _xlfn.REDUCE _xlfn.RRI _xlfn.SCAN _xlfn.SEC _xlfn.SECH\n_xlfn.SEQUENCE _xlfn.SHEET _xlfn.SHEETS _xlfn.SKEW.P _xlfn.SORTBY\n_xlfn.STDEV.P _xlfn.STDEV.S _xlfn.SWITCH _xlfn.T.DIST _xlfn.T.DIST.2T\n_xlfn.T.DIST.RT _xlfn.T.INV _xlfn.T.INV.2T _xlfn.T.TEST _xlfn.TAKE\n_xlfn.TEXTAFTER _xlfn.TEXTBEFORE _xlfn.TEXTJOIN _xlfn.TEXTSPLIT _xlfn.TOCOL\n_xlfn.TOROW _xlfn.UNICHAR _xlfn.UNICODE _xlfn.UNIQUE _xlfn.VAR.P _xlfn.VAR.S\n_xlfn.VSTACK _xlfn.WEBSERVICE _xlfn.WEIBULL.DIST WORKDAY.INTL _xlfn.WRAPCOLS\n_xlfn.WRAPROWS _xlfn.XLOOKUP _xlfn.XOR _xlfn.Z.TEST";
|
|
1
11
|
/** A function's name as a file stores it. */
|
|
2
12
|
export declare function fileName(name: string): string;
|
|
3
13
|
/** A name as a formula writes it, whatever prefix a file stored it under. */
|
|
4
|
-
export declare
|
|
14
|
+
export declare function plainName(name: string): string;
|
|
5
15
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
export const PUBLISHED_FUTURE_FUNCTIONS=`_xlfn._xlws.FILTER _xlfn._xlws.PY
|
|
3
|
+
_xlfn._xlws.SORT _xlfn.ACOT _xlfn.ACOTH _xlfn.AGGREGATE _xlfn.ARABIC _xlfn.BASE
|
|
4
|
+
_xlfn.BETA.DIST _xlfn.BETA.INV _xlfn.BINOM.DIST _xlfn.BINOM.DIST.RANGE
|
|
5
|
+
_xlfn.BINOM.INV _xlfn.BITAND _xlfn.BITLSHIFT _xlfn.BITOR _xlfn.BITRSHIFT
|
|
6
|
+
_xlfn.BITXOR _xlfn.BYCOL _xlfn.BYROW _xlfn.CEILING.MATH _xlfn.CEILING.PRECISE
|
|
7
|
+
_xlfn.CHISQ.DIST _xlfn.CHISQ.DIST.RT _xlfn.CHISQ.INV _xlfn.CHISQ.INV.RT
|
|
8
|
+
_xlfn.CHISQ.TEST _xlfn.CHOOSECOLS _xlfn.CHOOSEROWS _xlfn.COMBINA _xlfn.CONCAT
|
|
9
|
+
_xlfn.CONFIDENCE.NORM _xlfn.CONFIDENCE.T _xlfn.COT _xlfn.COTH
|
|
10
|
+
_xlfn.COVARIANCE.P _xlfn.COVARIANCE.S _xlfn.CSC _xlfn.CSCH _xlfn.DAYS
|
|
11
|
+
_xlfn.DECIMAL _xlfn.DROP ECMA.CEILING _xlfn.ERF.PRECISE _xlfn.ERFC.PRECISE
|
|
12
|
+
_xlfn.EXPAND _xlfn.EXPON.DIST _xlfn.F.DIST _xlfn.F.DIST.RT _xlfn.F.INV
|
|
13
|
+
_xlfn.F.INV.RT _xlfn.F.TEST _xlfn.FIELDVALUE _xlfn.FILTERXML _xlfn.FLOOR.MATH
|
|
14
|
+
_xlfn.FLOOR.PRECISE _xlfn.FORECAST.ETS _xlfn.FORECAST.ETS.CONFINT
|
|
15
|
+
_xlfn.FORECAST.ETS.SEASONALITY _xlfn.FORECAST.ETS.STAT _xlfn.FORECAST.LINEAR
|
|
16
|
+
_xlfn.FORMULATEXT _xlfn.GAMMA _xlfn.GAMMA.DIST _xlfn.GAMMA.INV
|
|
17
|
+
_xlfn.GAMMALN.PRECISE _xlfn.GAUSS _xlfn.HSTACK _xlfn.HYPGEOM.DIST _xlfn.IFNA
|
|
18
|
+
_xlfn.IFS _xlfn.IMCOSH _xlfn.IMCOT _xlfn.IMCSC _xlfn.IMCSCH _xlfn.IMSEC
|
|
19
|
+
_xlfn.IMSECH _xlfn.IMSINH _xlfn.IMTAN _xlfn.ISFORMULA ISO.CEILING
|
|
20
|
+
_xlfn.ISOMITTED _xlfn.ISOWEEKNUM _xlfn.LAMBDA _xlfn.LET _xlfn.LOGNORM.DIST
|
|
21
|
+
_xlfn.LOGNORM.INV _xlfn.MAKEARRAY _xlfn.MAP _xlfn.MAXIFS _xlfn.MINIFS
|
|
22
|
+
_xlfn.MODE.MULT _xlfn.MODE.SNGL _xlfn.MUNIT _xlfn.NEGBINOM.DIST
|
|
23
|
+
NETWORKDAYS.INTL _xlfn.NORM.DIST _xlfn.NORM.INV _xlfn.NORM.S.DIST
|
|
24
|
+
_xlfn.NORM.S.INV _xlfn.NUMBERVALUE _xlfn.PDURATION _xlfn.PERCENTILE.EXC
|
|
25
|
+
_xlfn.PERCENTILE.INC _xlfn.PERCENTRANK.EXC _xlfn.PERCENTRANK.INC
|
|
26
|
+
_xlfn.PERMUTATIONA _xlfn.PHI _xlfn.POISSON.DIST _xlfn.PQSOURCE
|
|
27
|
+
_xlfn.PYTHON_STR _xlfn.PYTHON_TYPE _xlfn.PYTHON_TYPENAME _xlfn.QUARTILE.EXC
|
|
28
|
+
_xlfn.QUARTILE.INC _xlfn.QUERYSTRING _xlfn.RANDARRAY _xlfn.RANK.AVG
|
|
29
|
+
_xlfn.RANK.EQ _xlfn.REDUCE _xlfn.RRI _xlfn.SCAN _xlfn.SEC _xlfn.SECH
|
|
30
|
+
_xlfn.SEQUENCE _xlfn.SHEET _xlfn.SHEETS _xlfn.SKEW.P _xlfn.SORTBY
|
|
31
|
+
_xlfn.STDEV.P _xlfn.STDEV.S _xlfn.SWITCH _xlfn.T.DIST _xlfn.T.DIST.2T
|
|
32
|
+
_xlfn.T.DIST.RT _xlfn.T.INV _xlfn.T.INV.2T _xlfn.T.TEST _xlfn.TAKE
|
|
33
|
+
_xlfn.TEXTAFTER _xlfn.TEXTBEFORE _xlfn.TEXTJOIN _xlfn.TEXTSPLIT _xlfn.TOCOL
|
|
34
|
+
_xlfn.TOROW _xlfn.UNICHAR _xlfn.UNICODE _xlfn.UNIQUE _xlfn.VAR.P _xlfn.VAR.S
|
|
35
|
+
_xlfn.VSTACK _xlfn.WEBSERVICE _xlfn.WEIBULL.DIST WORKDAY.INTL _xlfn.WRAPCOLS
|
|
36
|
+
_xlfn.WRAPROWS _xlfn.XLOOKUP _xlfn.XOR _xlfn.Z.TEST`;const x=`ENCODEURL ARRAYTOTEXT VALUETOTEXT IMAGE REGEXTEST
|
|
37
|
+
REGEXEXTRACT REGEXREPLACE GROUPBY PIVOTBY PERCENTOF TRIMRANGE`,_=new Map;for(const n of PUBLISHED_FUTURE_FUNCTIONS.split(/\s+/u)){const l=plainName(n);_.set(l,n.startsWith("_xlfn._xlws.")?n:`_xlfn.${l}`)}for(const n of x.split(/\s+/u))_.set(n,`_xlfn.${n}`);export function fileName(n){return _.get(n)??n}export function plainName(n){return n.replace(/^(?:_xlfn\.|_xlws\.|_xludf\.)+/iu,"")}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ZipLimits } from "@allyhub-next/formats";
|
|
1
2
|
import type { SheetProblem } from "../file.js";
|
|
2
3
|
import { type Scalar } from "../values.js";
|
|
3
4
|
/** How far apart two numbers may be, as a share of the larger, and be the same. */
|
|
@@ -23,6 +24,8 @@ export interface Compared {
|
|
|
23
24
|
export interface ImportedXlsx {
|
|
24
25
|
/** Paths from the sheet's folder, sheet.yaml first, and their text. */
|
|
25
26
|
files: Map<string, string>;
|
|
27
|
+
/** Pictures, from the sheet's folder: what `pictures` and `files` columns name. */
|
|
28
|
+
assets: Map<string, Uint8Array>;
|
|
26
29
|
/** What was not carried over, a line each. */
|
|
27
30
|
lost: string[];
|
|
28
31
|
/** What is wrong with the workbook as it now is. */
|
|
@@ -32,10 +35,12 @@ export interface ImportedXlsx {
|
|
|
32
35
|
tables: number;
|
|
33
36
|
}
|
|
34
37
|
export interface ImportOptions {
|
|
35
|
-
/** The workbook's title. */
|
|
38
|
+
/** The workbook's title, when the file has none of its own. */
|
|
36
39
|
name: string;
|
|
37
40
|
/** See COMPARE_TOLERANCE. */
|
|
38
41
|
tolerance?: number;
|
|
42
|
+
/** What the file may unzip to; ZIP_LIMITS unless it says. */
|
|
43
|
+
zip?: Partial<ZipLimits>;
|
|
39
44
|
}
|
|
40
45
|
/** Whether a value the engine gives is what a file cached. */
|
|
41
46
|
export declare function sameValue(a: Scalar, b: Scalar, tolerance: number): boolean;
|