@sheetxl/io-xlsx 0.8.0-beta.7 → 0.8.0-beta.9

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.
Files changed (68) hide show
  1. package/browser/cjs/B0Ugu_crqQYpdfQz.cjs +1 -0
  2. package/browser/cjs/{CDs8etXnw0kbBKKv.cjs → BHM3_D9PsNURVAVy.cjs} +1 -1
  3. package/browser/cjs/BHWdwAQ322YA8JAZ.cjs +6 -0
  4. package/browser/cjs/CeuX8p1aBuKTuagi.cjs +2 -0
  5. package/browser/cjs/DSM4q1dhVVXvsgby.cjs +30 -0
  6. package/browser/cjs/DiAHwNv2I8RHE9GY.cjs +1 -0
  7. package/browser/cjs/index.cjs +1 -1
  8. package/browser/cjs/wrpXlaSBGEicQf6_.cjs +6 -0
  9. package/browser/esm/{BsNoW41d6hdpxTTS.mjs → Bu64BYvRAlVftMr1.mjs} +4 -4
  10. package/browser/esm/{CX3yVwe-BnhCk4FY.mjs → C-2KaUyV4gs-sDTZ.mjs} +2 -2
  11. package/browser/esm/{DUi-V-E_AJwTIqlO.mjs → CRrTMRdN_IcSA_pm.mjs} +2 -2
  12. package/browser/esm/{CjKioy-GzeSf08f8.mjs → CWt4fDYEbj2hvsl_.mjs} +820 -800
  13. package/browser/esm/{dsVZVtt5w_yLb967.mjs → Ccnxz-y2WBEgfvvh.mjs} +2606 -1408
  14. package/browser/esm/{B4eKxNwxJjHLN126.mjs → CxtFawTfwRTCC4Xr.mjs} +1 -1
  15. package/browser/esm/{CGXxwkCRWLc0gcRQ.mjs → D-epcZSoKLbsAIaC.mjs} +2 -2
  16. package/browser/esm/DsSIg46AR7IFBN5N.mjs +2298 -0
  17. package/browser/esm/{cJxidonaVNZHAXiZ.mjs → Dx64JMAGwNNDBkC1.mjs} +1555 -1159
  18. package/browser/esm/Sv4twwEJDb9dZ91h.mjs +149 -0
  19. package/browser/esm/index.mjs +2 -2
  20. package/node/esm/{CMq7eF1vxibUumqT.mjs → BCr4lCI6qQXXN0K1.mjs} +2 -2
  21. package/node/esm/BPn5XBizKkwaUqXB.mjs +4285 -0
  22. package/node/esm/{BRQYaMYO4UfhjJHw.mjs → BVV11IlqF6Lmlv8D.mjs} +53 -69
  23. package/node/esm/{s_yVG0m9KB14YKeN.mjs → BiJEEgltJzx94zIR.mjs} +930 -909
  24. package/node/esm/{C51yFT2l-6il_xXO.mjs → BsTMtvwpQoPNv95M.mjs} +1 -1
  25. package/node/esm/{DLBm8l0jyL2fVlxg.mjs → CBtj0-a4l2qux2hA.mjs} +2 -2
  26. package/node/esm/CkmZuMvRTpva7eQu.mjs +5074 -0
  27. package/node/esm/index.mjs +4 -4
  28. package/node/esm/j0RE2usgdljRw_gr.mjs +2345 -0
  29. package/package.json +3 -3
  30. package/types/src/AutoFilterRules.d.ts +83 -10
  31. package/types/src/OOXMLExtensions.d.ts +6 -0
  32. package/types/src/reader/dom/CustGeomUtils.d.ts +7 -0
  33. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +13 -0
  34. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +7 -1
  35. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  36. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +23 -1
  37. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +9 -0
  38. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +20 -1
  39. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
  40. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +8 -0
  41. package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
  42. package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
  43. package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
  44. package/types/src/reader/domVisitors/index.d.ts +4 -2
  45. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +1 -1
  46. package/types/src/utils/DrawingMLText.d.ts +39 -0
  47. package/types/src/utils/FormControls.d.ts +97 -0
  48. package/types/src/writer/builder/Emitter.d.ts +5 -0
  49. package/types/src/writer/builder/PackageBuilder.d.ts +2 -0
  50. package/types/src/writer/builder/Types.d.ts +10 -0
  51. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  52. package/types/src/writer/utils/DrawMLUtils.d.ts +39 -2
  53. package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
  54. package/types/src/writer/utils/TextUtils.d.ts +21 -2
  55. package/browser/cjs/17tMBnuyu4YIxixh.cjs +0 -1
  56. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  57. package/browser/cjs/BxU-OlZIQViQl7gX.cjs +0 -1
  58. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  59. package/browser/cjs/CycnxkfuKrDdwoJN.cjs +0 -5
  60. package/browser/cjs/DHKWtqZ0vQfXrbq1.cjs +0 -2
  61. package/browser/cjs/MqKQ_B5qRARrRbO4.cjs +0 -24
  62. package/browser/esm/9n64lXAgZUe3aThr.mjs +0 -159
  63. package/browser/esm/BvAptAMpZVyBCx6-.mjs +0 -2402
  64. package/browser/esm/DwcLXqv8-6Tl1zLO.mjs +0 -24
  65. package/node/esm/BlbtH3EvAf3K4foF.mjs +0 -2450
  66. package/node/esm/DhSPOg9wN0kD87Tb.mjs +0 -3051
  67. package/node/esm/KeV-N47eTyh5YE70.mjs +0 -4642
  68. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/io-xlsx",
3
3
  "description": "SheetXL - Import/Export from/to Excel",
4
- "version": "0.8.0-beta.7",
4
+ "version": "0.8.0-beta.9",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -45,8 +45,8 @@
45
45
  "utilities"
46
46
  ],
47
47
  "dependencies": {
48
- "@sheetxl/sdk": "^0.8.0-beta.7",
49
- "@sheetxl/utils": "^0.8.0-beta.7",
48
+ "@sheetxl/sdk": "^0.8.0-beta.9",
49
+ "@sheetxl/utils": "^0.8.0-beta.9",
50
50
  "@xmldom/xmldom": "^0.9.10",
51
51
  "@zip.js/zip.js": "^2.8.34",
52
52
  "web-streams-polyfill": "^4.3.0",
@@ -1,4 +1,15 @@
1
1
  import { ICondition } from '@sheetxl/sdk';
2
+ /**
3
+ * The `dynamicFilter/@type` values that are a period (ST_DynamicFilterType less the two averages
4
+ * and `null`). The SDK's `last7Days` is not among them.
5
+ */
6
+ export declare const DYNAMIC_FILTER_PERIODS: ReadonlySet<string>;
7
+ /**
8
+ * The condition a `dynamicFilter/@type` means: `aboveAverage` / `belowAverage` are the Average
9
+ * operator, everything else a TimePeriod of that name. The element's `val` / `maxVal` are Excel's
10
+ * cache of its last evaluation, never read.
11
+ */
12
+ export declare function dynamicFilterToJSON(type: string | null | undefined): ICondition.JSON;
2
13
  /**
3
14
  * The border between OOXML's `customFilter` and the SDK's condition.
4
15
  *
@@ -13,10 +24,22 @@ import { ICondition } from '@sheetxl/sdk';
13
24
  * are one table, and a mapping whose halves drift apart is the bug the round-trip corpus exists to
14
25
  * catch.
15
26
  *
16
- * Not handled here, deliberately: the wildcards Excel packs into `@val` for its text filters
17
- * (`val="abc*"` under `equal` is "begins with abc"). Those need `*`/`?`/`~` escaping settled in
18
- * both directions before `startsWith`/`contains`/`endsWith` can be inferred, and a half-done
19
- * inference would turn a literal asterisk into a pattern.
27
+ * Excel has no text operators here. Its text filters are `equal` / `notEqual` over a pattern packed
28
+ * into `@val`: `abc*` begins with, `*abc` ends with, `*abc*` contains, and `~` before `*`, `?` or
29
+ * `~` makes that character literal. The three shapes map onto the SDK's text operators; any other
30
+ * pattern (`a*b`, `a?c`) has no operator and is carried under its OOXML spelling, inert, so a resave
31
+ * writes it back as it arrived.
32
+ *
33
+ * A wildcard-free `equal` is Excel's values list with one item: it compares the text a cell shows
34
+ * (P1, P5), and Excel itself stores it as `<filters><filter val>` on save. It reads as a one-item
35
+ * `InSet { byDisplay: true }`, and `notEqual` as its negation; the SDK's `EqualTo` is value
36
+ * equality and never comes from here (DESIGN-FILTER §3.2). Excel's `<>` criterion is `notEqual`
37
+ * against one space (P7) and reads as `not(blank)`, display-shaped, since a string of spaces is
38
+ * blank to it (§3.3).
39
+ *
40
+ * Value equality has no `customFilter` spelling. A value `EqualTo` on a number goes out as Excel's
41
+ * own value test, `<customFilters and="1">` of `greaterThanOrEqual` and `lessThanOrEqual` with
42
+ * the same operand, which Excel evaluates live; {@link foldComparisonPair} reads it back.
20
43
  */
21
44
  /** A `customFilter` in OOXML's own shape. Reader input, writer output — never persisted. */
22
45
  export interface OOXMLCustomFilter {
@@ -33,18 +56,38 @@ export declare const FilterOperator: {
33
56
  readonly LessThanOrEqual: "lessThanOrEqual";
34
57
  };
35
58
  export type FilterOperator = typeof FilterOperator[keyof typeof FilterOperator];
36
- /** Whether a condition operator is one this border can spell as a `customFilter`. */
37
- export declare function isComparison(operator: unknown): boolean;
38
59
  /**
39
- * `@val` ↦ condition param.
60
+ * Whether a condition can be spelled as one `customFilter`: a comparison or a text operator, plain
61
+ * or under `not`, or an OOXML spelling carried from a file.
62
+ */
63
+ export declare function isCustomFilter(condition: ICondition.JSON | undefined | null): boolean;
64
+ /**
65
+ * The one string of an `InSet` that is Excel's `equal` criterion: by displayed text, one item,
66
+ * no date groups and no blanks entry. `null` for any other list.
67
+ */
68
+ export declare function displayListItem(condition: ICondition.JSON | undefined | null): string | null;
69
+ /**
70
+ * Text as a pattern that matches only itself: `~` goes before each `*`, `?` and `~`.
71
+ */
72
+ export declare function escapeWildcards(text: string): string;
73
+ /**
74
+ * `@val` ↦ the param of an ordering comparison.
40
75
  *
41
76
  * @remarks
42
77
  * `@val` is an attribute, so it always arrives as text, but a numeric spelling means the number:
43
- * `equalTo` compares text to text and never coerces, so a numeric column filtered on `val="2"`
44
- * would match nothing at all. This is the same reading the `'=2'` comparison shorthand takes.
78
+ * `greaterThan` orders values, and text never orders against a number. `equal` and `notEqual` are
79
+ * not read through here — they are a one-item values list, whose item is text.
45
80
  */
46
81
  export declare function valToParam(val: string | null | undefined): string | number | undefined;
47
- /** The inverse of {@link valToParam}. */
82
+ /**
83
+ * A param or a values-list item as the text an attribute holds.
84
+ *
85
+ * @remarks
86
+ * A typed value is written as `String(value)`, which is the text it shows only under `General`. A
87
+ * value list (`InSet` without `byDisplay`) written this way reopens as a display list and keeps a
88
+ * number under `0.00` only if it shows as `1.5`; the writer warns. (PLAN-FILTER Phase 4 spells a
89
+ * value list as the texts the value shows in its column.)
90
+ */
48
91
  export declare function paramToVal(param: unknown): string | undefined;
49
92
  /**
50
93
  * Reads a `customFilter` as a condition.
@@ -52,6 +95,21 @@ export declare function paramToVal(param: unknown): string | undefined;
52
95
  * @returns The condition, or `null` when the element carries nothing to compare against.
53
96
  */
54
97
  export declare function toCondition(filter: OOXMLCustomFilter, warn?: (message: string) => void): ICondition.JSON | null;
98
+ /**
99
+ * The value test Excel can spell: `and(>= x, <= x)` is `EqualTo x`, and `or(< x, > x)` is
100
+ * `not(EqualTo x)`, for one number `x`. Anything else is returned as it came.
101
+ */
102
+ export declare function foldComparisonPair(condition: ICondition.JSON): ICondition.JSON;
103
+ /**
104
+ * The inverse of {@link foldComparisonPair}: a value `EqualTo` on a number as the two
105
+ * `customFilter` elements of its `customFilters`, with the `and` the pair needs.
106
+ *
107
+ * @returns `null` when the condition is not a value equality on a number, plain or negated.
108
+ */
109
+ export declare function toComparisonPair(condition: ICondition.JSON | undefined | null): {
110
+ and: boolean;
111
+ filters: [OOXMLCustomFilter, OOXMLCustomFilter];
112
+ } | null;
55
113
  /**
56
114
  * The inverse of {@link toCondition}.
57
115
  *
@@ -59,4 +117,19 @@ export declare function toCondition(filter: OOXMLCustomFilter, warn?: (message:
59
117
  * skips it rather than writing an element Excel would reject.
60
118
  */
61
119
  export declare function fromCondition(condition: ICondition.JSON | undefined | null, warn?: (message: string) => void): OOXMLCustomFilter | null;
120
+ /**
121
+ * The values-list item a condition is written as, when Excel writes it that way.
122
+ *
123
+ * @remarks
124
+ * Excel keeps `customFilter` for a pattern and for an ordering comparison. A plain "equals" has
125
+ * neither, and its file holds `<filters><filter val="…"/></filters>`: the text itself, with no
126
+ * escapes, since a values-list item is never a pattern.
127
+ *
128
+ * A number is not written this way: a value `EqualTo` on a number is {@link toComparisonPair},
129
+ * since `<filter val>` would compare the text a cell shows.
130
+ *
131
+ * @returns The item's text (`''` for "equals nothing", which is the blanks entry), or `null` when
132
+ * the condition is not a plain `equalTo` over text or a boolean.
133
+ */
134
+ export declare function toFilterItem(condition: ICondition.JSON | undefined | null): string | null;
62
135
  //# sourceMappingURL=AutoFilterRules.d.ts.map
@@ -37,6 +37,12 @@ export declare const EXT_URI_CF_RULE_ID = "{B025F937-C7B1-47D3-B67F-A62EFF666E3E
37
37
  export declare const EXT_URI_SLICER_LIST = "{A8765BA9-456A-4dab-B4F3-ACF838C121DE}";
38
38
  /** `x15:slicerList` on the worksheet (slicers on data-model tables). */
39
39
  export declare const EXT_URI_SLICER_LIST_X15 = "{3A4CF648-6AED-40f4-86FF-DC5316D8AED3}";
40
+ /**
41
+ * `xlrd2:filterColumn` on an autoFilter's `filterColumn` — a date-group filter as VBA/COM writes
42
+ * it. Excel's own dropdown writes the same groups in the main namespace; this is read, never
43
+ * written.
44
+ */
45
+ export declare const EXT_URI_FILTER_COLUMN = "{1AD28BCE-077C-4C59-8B6E-1921CE8616D4}";
40
46
  /**
41
47
  * Ext uris the reader recognizes but does not read, with the feature name for the warning
42
48
  * (design §2.2 / plan Phase 5: skipped ext content warns, it never disappears silently).
@@ -0,0 +1,7 @@
1
+ import { IGeometry } from '@sheetxl/sdk';
2
+ /**
3
+ * The definition a `custGeom` element states. Lists the file leaves empty are left out of the
4
+ * JSON; a text rectangle is kept as the four edge tokens it names.
5
+ */
6
+ export declare const readCustGeom: (elemCustGeom: Element) => IGeometry.Def;
7
+ //# sourceMappingURL=CustGeomUtils.d.ts.map
@@ -12,12 +12,25 @@ export declare class AutoFilterVisitor implements Visitor {
12
12
  processColorFilter(context: ExecutionContext, elem: Element): ICondition.JSON;
13
13
  processCustomFilter(context: ExecutionContext, elem: Element): ICondition.JSON | null;
14
14
  processCustomFilters(context: ExecutionContext, elem: Element): ICondition.JSON;
15
+ /**
16
+ * `dynamicFilter` is Excel's Average (`aboveAverage` / `belowAverage`) or a TimePeriod.
17
+ *
18
+ * @remarks
19
+ * `val` and `maxVal` are Excel's cache of the last evaluation (the average; a period's start
20
+ * and exclusive end), not an anchor and not a deviation count. Excel honors `type` alone and
21
+ * rewrites them on save (`probe-filter-dynamic`), so they are dropped here.
22
+ */
15
23
  processDynamicFilter(context: ExecutionContext, elem: Element): ICondition.JSON;
16
24
  processDateGroupItem(context: ExecutionContext, elem: Element): ICondition.DateGroupItem;
17
25
  processFilterItem(context: ExecutionContext, elem: Element): Scalar | undefined;
18
26
  processFilters(context: ExecutionContext, elem: Element): ICondition.JSON;
19
27
  processIcon(context: ExecutionContext, elem: Element): ICondition.JSON;
20
28
  processTop10(context: ExecutionContext, elem: Element): ICondition.JSON;
29
+ /**
30
+ * A date group applied through VBA/COM is written only as `xlrd2:filterColumn` inside the
31
+ * column's own extLst, with nothing in the main namespace.
32
+ */
33
+ processFilterColumnExt(context: ExecutionContext, extLst: Element): ICondition.JSON | undefined;
21
34
  processFilterCriteria(context: ExecutionContext, elem: Element): ICondition.JSON | undefined;
22
35
  processFilterColumn(context: ExecutionContext, elem: Element, jsonTable: ITable.JSON): ICondition.JSON | null | undefined;
23
36
  processFilterColumns(context: ExecutionContext, elem: Element, conditions: ICondition.JSON[], jsonTable: ITable.JSON): ICondition.JSON[] | undefined;
@@ -24,7 +24,13 @@ export declare class ColorContainerVisitor implements Visitor {
24
24
  getFill(context: ExecutionContext, shPropsElement: Element): any;
25
25
  processGradFill(context: ExecutionContext, gradFillElement: Element): IFill.GradientJSON;
26
26
  getRect(fillToRectElement: Element): any;
27
- processImageFill(_context: ExecutionContext, imageFillElement: Element): IFill.ImageJSON;
27
+ /**
28
+ * A `blipFill`: the image as a workbook resource (the blip's embed or link relationship), the
29
+ * part of it used, and whether it is stretched or tiled.
30
+ */
31
+ processImageFill(context: ExecutionContext, imageFillElement: Element): IFill.ImageJSON;
32
+ /** A relative rectangle's insets (`l`/`t`/`r`/`b`, thousandths of a percent) as percentages; `{}` when none. */
33
+ getRectInsets(elem: Element): IFill.RectInsets;
28
34
  processPatternFill(context: ExecutionContext, pattFill: Element): IFill.PatternJSON;
29
35
  processAdjColor(context: ExecutionContext, fillElement: Element): string | null;
30
36
  processScrgbClrElement(context: ExecutionContext, elem: Element): string;
@@ -1,6 +1,7 @@
1
1
  import { IMovable } from '@sheetxl/sdk';
2
2
  import { Visitor, ExecutionContext } from '../dom';
3
3
  import { DrawingSpVisitor } from './DrawingSpVisitor';
4
+ /** A `cxnSp`: a connector, read as a shape whose `type` is `connector`. */
4
5
  export declare class DrawingCxnSpVisitor extends DrawingSpVisitor implements Visitor {
5
6
  visit(context: ExecutionContext, elem: Element, json: IMovable.JSON): any;
6
7
  }
@@ -1,10 +1,32 @@
1
- import { IMovable } from '@sheetxl/sdk';
1
+ import { IMovable, IShape } from '@sheetxl/sdk';
2
2
  import { Visitor, ExecutionContext } from '../dom';
3
3
  export declare class DrawingElementVisitor implements Visitor {
4
4
  visit(context: ExecutionContext, elem: Element, json: IMovable.JSON): IMovable.JSON | undefined;
5
+ /** A `cNvPr`'s title and hyperlinks onto the JSON that will hold the content's identity. */
6
+ protected readNonVisualDetails(context: ExecutionContext, elemCNvPr: Element, target: IShape.JSON): void;
5
7
  /**
6
8
  * Sets the content of a movable, and gives it the name and description read from its `cNvPr`.
7
9
  */
8
10
  protected setContent(json: IMovable.JSON, content: IMovable.ContentJSON<any>): void;
11
+ /** Whether the JSON a drawing element is read into is a group's content, i.e. the element is a member. */
12
+ protected isGroupContent(json: unknown): json is IShape.JSON & {
13
+ children: IShape.JSON[];
14
+ };
15
+ /**
16
+ * A group member's own JSON: its kind and what its `cNvPr` says. The walker fills in the rest
17
+ * (`spPr`, `txBody`) as it descends; the member is not captured, the group's markup holds it.
18
+ */
19
+ protected readChildHeader(context: ExecutionContext, elem: Element, type: IShape.Type): IShape.JSON;
20
+ /**
21
+ * A shape's `style` element — its references into the theme's format scheme — onto the content
22
+ * JSON. Excel's own shapes state their fill and line this way and nothing in `spPr`. A reference
23
+ * equal to Excel's default for the kind of shape is left out; `content.type` must already say
24
+ * what kind it is.
25
+ */
26
+ protected readStyleRefs(context: ExecutionContext, elem: Element, content: IShape.JSON): void;
27
+ /** A locks element's flags (`spLocks`, `cxnSpLocks`, `grpSpLocks`, `picLocks`) by the file's own names. */
28
+ protected readLocks(elemLocks: Element | null): Record<string, boolean> | undefined;
29
+ /** The element's original `cNvPr` id, kept so a replayed fragment's id can be made unique on write. */
30
+ protected readSourceId(context: ExecutionContext, elem: Element): number | undefined;
9
31
  }
10
32
  //# sourceMappingURL=DrawingElementVisitor.d.ts.map
@@ -1,6 +1,15 @@
1
1
  import { IMovable } from '@sheetxl/sdk';
2
2
  import { Visitor, ExecutionContext } from '../dom';
3
3
  import { DrawingSpVisitor } from './DrawingSpVisitor';
4
+ /**
5
+ * A `grpSp`: a group, read as a shape whose `type` is `group` with its members in `children`.
6
+ *
7
+ * @remarks
8
+ * The group's frame is its `grpSpPr/xfrm`: `bounds` is where it sits (`off`/`ext`) and
9
+ * `childBounds` is the space its members' own bounds are stated in (`chOff`/`chExt`), both in
10
+ * pixels. Members are read by the walker as it descends — each `sp`/`cxnSp`/`grpSp`/`pic` under
11
+ * the group adds itself to `children` in document order, which is z-order.
12
+ */
4
13
  export declare class DrawingGrpSpVisitor extends DrawingSpVisitor implements Visitor {
5
14
  visit(context: ExecutionContext, elem: Element, json: IMovable.JSON): any;
6
15
  }
@@ -1,7 +1,26 @@
1
- import { IMovable } from '@sheetxl/sdk';
1
+ import { IMovable, IShape } from '@sheetxl/sdk';
2
2
  import { Visitor, ExecutionContext } from '../dom';
3
3
  import { DrawingElementVisitor } from './DrawingElementVisitor';
4
+ /**
5
+ * A `pic`: the picture content of a movable, or a member of a group.
6
+ *
7
+ * @remarks
8
+ * A member is read into the group's `children` as an `IShape.PictureMemberJSON`: its image as an
9
+ * image fill, its locks by the file's names, and — by the `spPr` visitor the walker runs over its
10
+ * children — its bounds in the group's child space.
11
+ */
4
12
  export declare class DrawingPicVisitor extends DrawingElementVisitor implements Visitor {
13
+ private readonly _fills;
5
14
  visit(context: ExecutionContext, elem: Element, jsonHandle: IMovable.JSON): IMovable.JSON | undefined;
15
+ /**
16
+ * What a group member states beyond its header: the `pic` attributes, its locks by name and its
17
+ * `blipFill` as an image fill.
18
+ */
19
+ protected readPictureDetails(context: ExecutionContext, elem: Element, member: IShape.PictureMemberJSON): void;
20
+ /**
21
+ * The resource a `blipFill`'s image is read to: `undefined` when the element has no `blip`,
22
+ * `null` when the blip names no relationship (warned once), else what the relationship resolves to.
23
+ */
24
+ protected readImageResource(context: ExecutionContext, elem: Element): number | null | undefined;
6
25
  }
7
26
  //# sourceMappingURL=DrawingPicVisitor.d.ts.map
@@ -1,7 +1,26 @@
1
- import { IMovable } from '@sheetxl/sdk';
1
+ import { IMovable, IShape } from '@sheetxl/sdk';
2
2
  import { Visitor, ExecutionContext } from '../dom';
3
3
  import { DrawingElementVisitor } from './DrawingElementVisitor';
4
+ /**
5
+ * An `sp`: the shape content of a movable, or a member of a group.
6
+ *
7
+ * @remarks
8
+ * What the element itself states — its kind, attributes, non-visual properties, style references
9
+ * — is read here; its properties and text are read into the same content JSON by the `spPr` and
10
+ * `txBody` visitors the walker runs over its children. A member of a group is read the same way
11
+ * into the group's `children`.
12
+ */
4
13
  export declare class DrawingSpVisitor extends DrawingElementVisitor implements Visitor {
5
14
  visit(context: ExecutionContext, elem: Element, json: IMovable.JSON): any;
15
+ protected visitShape(context: ExecutionContext, elem: Element, json: IMovable.JSON, type: 'sp' | 'cxnSp' | 'grpSp', locksPath: string): any;
16
+ /**
17
+ * The VML shape a form control's hidden twin names, by its `spid` (`_x0000_s1025` is 1025).
18
+ */
19
+ protected readTwinOf(context: ExecutionContext, elem: Element): number | undefined;
20
+ /**
21
+ * What the element itself and its non-visual properties say beyond the name: the macro and
22
+ * text link, the text-box flag, the edit locks by name, and a connector's glued ends.
23
+ */
24
+ protected readShapeDetails(context: ExecutionContext, elem: Element, type: 'sp' | 'cxnSp' | 'grpSp', locksPath: string, content: IShape.JSON): void;
6
25
  }
7
26
  //# sourceMappingURL=DrawingSpVisitor.d.ts.map
@@ -1,5 +1,13 @@
1
+ import { IMovable } from '@sheetxl/sdk';
1
2
  import { Visitor, ExecutionContext } from '../dom';
2
3
  export declare class DrawingVisitor implements Visitor {
3
4
  visit(context: ExecutionContext, elemParent: Element, jsonParent: any): any;
5
+ /**
6
+ * A top-level shape's or group's `xfrm/@rot` is read onto its content with the rest of its
7
+ * `xfrm`; the rotation is the movable's frame's, so it moves there. A group member keeps its own.
8
+ */
9
+ afterVisit(_context: ExecutionContext, _elemParent: Element, jsonDrawing: {
10
+ movables?: Partial<IMovable.JSON>[];
11
+ }): void;
4
12
  }
5
13
  //# sourceMappingURL=DrawingVisitor.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Visitor, ExecutionContext } from '../dom';
2
+ /**
3
+ * A `ctrlProp` part (`<formControlPr>`): what kind of form control a `<control>` is and what it
4
+ * holds, read onto `formControl` as the content type and that kind's fields.
5
+ */
6
+ export declare class FormControlPrVisitor implements Visitor {
7
+ visit(context: ExecutionContext, elem: Element, jsonParent: any): any;
8
+ }
9
+ //# sourceMappingURL=FormControlPrVisitor.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { IText, ITextFrame } from '@sheetxl/sdk';
2
+ import { ExecutionContext } from '../dom/ExecutionContext';
3
+ import { TextPropertiesVisitor } from './TextPropertiesVisitor';
4
+ /** The plain text of a paragraph: its runs concatenated, a line break as `\n`. */
5
+ export declare const paragraphText: (paragraph: IText.ParagraphJSON) => string;
6
+ /**
7
+ * The plain text of a text body: paragraphs joined by a newline, blank ones trimmed from the ends.
8
+ * The same rule `IShape.getTextFrame().getText()` applies, so the reader can decide what a body says.
9
+ */
10
+ export declare const textBodyText: (text: ITextFrame.JSON) => string;
11
+ /**
12
+ * DrawingML's defaults where SheetXL's differ ({@link ShapeStyleUtils.TEXT_DEFAULTS}): what a file
13
+ * that leaves these out means. The reader states them, so the shape keeps what the file meant.
14
+ */
15
+ export declare const DRAWINGML_TEXT_DEFAULTS: Readonly<{
16
+ readonly verticalOverflow: "visible";
17
+ readonly horizontalOverflow: "visible";
18
+ readonly size: 18;
19
+ }>;
20
+ /**
21
+ * A shape's `txBody`, read paragraph by paragraph into {@link ITextFrame.JSON}.
22
+ *
23
+ * @remarks
24
+ * Elements are matched by local name, so other producers' prefixes read the same as Excel's.
25
+ * A `br` is a run of `\n`; a field (`fld`) reads as its text; any other `t` — an equation's
26
+ * `m:t` included — reads as a run of its own. The run and paragraph formatting the chart text
27
+ * reader models (size, weight, color, font…) is read the same way onto each run and paragraph.
28
+ */
29
+ export declare class ShapeTextVisitor extends TextPropertiesVisitor {
30
+ visit(context: ExecutionContext, elem: Element, jsonParent: any): any;
31
+ /**
32
+ * Reads a `txBody`. With no context the text and layout are read but no run formatting,
33
+ * colors or list style.
34
+ */
35
+ readTextBody(context: ExecutionContext | null, body: Element): ITextFrame.JSON;
36
+ readParagraph(context: ExecutionContext | null, p: Element): IText.ParagraphJSON;
37
+ /** A `pPr`, `defPPr` or `lvlNpPr`: how a paragraph is laid out. Colors and the default run need a context. */
38
+ readParagraphProperties(context: ExecutionContext | null, pPr: Element): IText.ParagraphPropertiesJSON;
39
+ /** A `lstStyle`: the default and per-level paragraph properties, or nothing when it states none. */
40
+ readListStyle(context: ExecutionContext, lstStyle: Element): ITextFrame.ListStyleJSON | undefined;
41
+ }
42
+ /** A `bodyPr`'s attributes and autofit/warp children. Rotation is read separately. */
43
+ export declare const readBodyProperties: (bodyPr: Element) => ITextFrame.BodyJSON;
44
+ //# sourceMappingURL=ShapeTextVisitor.d.ts.map
@@ -1,5 +1,15 @@
1
- import { ExecutionContext } from '../dom';
1
+ import { IHyperlink, IText } from '@sheetxl/sdk';
2
+ import { ExecutionContext } from '../dom/ExecutionContext';
2
3
  import { ColorContainerVisitor } from './ColorContainerVisitor';
4
+ /** The four font slots of a run and the JSON key each reads into. */
5
+ export declare const TEXT_FONTS: readonly [element: string, key: 'font' | 'eastAsianFont' | 'complexScriptFont' | 'symbolFont'][];
6
+ /**
7
+ * A `latin`/`ea`/`cs`/`sym`/`buFont` element as a font: a theme font (`+mn-lt`, `+mj-ea`) by
8
+ * its role, otherwise the family, with the PANOSE classification kept as stated.
9
+ */
10
+ export declare const readFont: (elem: Element) => IText.FontJSON | undefined;
11
+ /** A `hlinkClick`/`hlinkHover`: its address as the relationship resolves it, and what it shows. */
12
+ export declare const readHyperlink: (context: ExecutionContext, elem: Element) => Exclude<IHyperlink.JSON, string>;
3
13
  export declare class TextPropertiesVisitor extends ColorContainerVisitor {
4
14
  protected _jsonKey: string;
5
15
  constructor(jsonKey?: string);
@@ -7,5 +17,7 @@ export declare class TextPropertiesVisitor extends ColorContainerVisitor {
7
17
  visit(context: ExecutionContext, elemParent: Element, jsonParent: any): any;
8
18
  parseTextElement(context: ExecutionContext, elemParent: Element, jsonText: any, defaultRun: boolean): void;
9
19
  parseTextProperties(context: ExecutionContext, elem: Element, jsonText: any): void;
20
+ /** A `hlinkClick`/`hlinkHover`: its resolved address and what it shows. */
21
+ readHyperlink(context: ExecutionContext, elem: Element): Exclude<IHyperlink.JSON, string>;
10
22
  }
11
23
  //# sourceMappingURL=TextPropertiesVisitor.d.ts.map
@@ -13,6 +13,7 @@ import { DataPointVisitor } from './DataPointVisitor';
13
13
  import { MarkerVisitor } from './MarkerVisitor';
14
14
  import { AxisVisitor } from './AxisVisitor';
15
15
  import { TextPropertiesVisitor } from './TextPropertiesVisitor';
16
+ import { ShapeTextVisitor } from './ShapeTextVisitor';
16
17
  import { LegendEntryVisitor } from './LegendEntryVisitor';
17
18
  import { LegendVisitor } from './LegendVisitor';
18
19
  import { NegativeShapeVisitor } from './NegativeShapeVisitor';
@@ -22,7 +23,6 @@ import { ThemeVisitor } from './ThemeVisitor';
22
23
  import { ClrSchemeVisitor } from './ClrSchemeVisitor';
23
24
  import { FontSchemeVisitor } from './FontSchemeVisitor';
24
25
  import { FmtSchemeVisitor } from './FmtSchemeVisitor';
25
- import { HyperlinkVisitor } from './HyperlinkVisitor';
26
26
  import { AutoFilterVisitor } from './AutoFilterVisitor';
27
27
  import { SortStateVisitor } from './SortStateVisitor';
28
28
  import { SheetStyleVisitor } from './SheetStyleVisitor';
@@ -32,6 +32,7 @@ import { TableX14Visitor } from './TableX14Visitor';
32
32
  import { ExternalLinkVisitor } from './ExternalLinkVisitor';
33
33
  import { SlicerCacheDefinitionVisitor } from './SlicerCacheDefinitionVisitor';
34
34
  import { SlicersVisitor } from './SlicersVisitor';
35
+ import { FormControlPrVisitor } from './FormControlPrVisitor';
35
36
  import { DrawingVisitor } from './DrawingVisitor';
36
37
  import { DrawingAnchorVisitor } from './DrawingAnchorVisitor';
37
38
  import { DrawingGraphicFrameVisitor } from './DrawingGraphicFrameVisitor';
@@ -63,6 +64,7 @@ export declare const BuiltInVisitors: {
63
64
  MarkerVisitor: typeof MarkerVisitor;
64
65
  AxisVisitor: typeof AxisVisitor;
65
66
  TextPropertiesVisitor: typeof TextPropertiesVisitor;
67
+ ShapeTextVisitor: typeof ShapeTextVisitor;
66
68
  LegendEntryVisitor: typeof LegendEntryVisitor;
67
69
  LegendVisitor: typeof LegendVisitor;
68
70
  NegativeShapeVisitor: typeof NegativeShapeVisitor;
@@ -72,7 +74,6 @@ export declare const BuiltInVisitors: {
72
74
  ClrSchemeVisitor: typeof ClrSchemeVisitor;
73
75
  FontSchemeVisitor: typeof FontSchemeVisitor;
74
76
  FmtSchemeVisitor: typeof FmtSchemeVisitor;
75
- HyperlinkVisitor: typeof HyperlinkVisitor;
76
77
  AutoFilterVisitor: typeof AutoFilterVisitor;
77
78
  SortStateVisitor: typeof SortStateVisitor;
78
79
  SheetStyleVisitor: typeof SheetStyleVisitor;
@@ -82,6 +83,7 @@ export declare const BuiltInVisitors: {
82
83
  ExternalLinkVisitor: typeof ExternalLinkVisitor;
83
84
  SlicerCacheDefinitionVisitor: typeof SlicerCacheDefinitionVisitor;
84
85
  SlicersVisitor: typeof SlicersVisitor;
86
+ FormControlPrVisitor: typeof FormControlPrVisitor;
85
87
  DrawingVisitor: typeof DrawingVisitor;
86
88
  DrawingAnchorVisitor: typeof DrawingAnchorVisitor;
87
89
  DrawingGraphicFrameVisitor: typeof DrawingGraphicFrameVisitor;
@@ -6,7 +6,7 @@ import { OnWarning } from '../Warning';
6
6
  * dialect (`XlsxFormulaDialect`), for condition formulas. Set before any sheet streams.
7
7
  */
8
8
  export declare const PARAM_FORMULA_DIALECT = "formulaDialect";
9
- export declare const createWorksheetSaxVisitor: (sheet: ISheet.JSON, getRef: (relId: string, as?: "resource" | "legacyDrawing" | "part") => any, // TODO - this should be a context like DOM.
9
+ export declare const createWorksheetSaxVisitor: (sheet: ISheet.JSON, getRef: (relId: string, as?: "resource" | "legacyDrawing" | "part" | "formControl") => any, // TODO - this should be a context like DOM.
10
10
  addSharedString: (str: string) => number, mapDxfs?: Map<number, any>, onEnd?: () => void, onWarning?: OnWarning, onProgress?: (amount: number, total?: number) => void, paramMap?: Map<string, any>) => SaxParser.EventHandler;
11
11
  export declare class RowAttributeType {
12
12
  static Collapsed: number;
@@ -0,0 +1,39 @@
1
+ import { IFont, IShape, IText, ITextFrame } from '@sheetxl/sdk';
2
+ /**
3
+ * DrawingML's vocabulary for drawing text and shapes against SheetXL's: the attribute values a
4
+ * file states (`algn="ctr"`, `u="sng"`, `vert="eaVert"`) and the model values they read to.
5
+ *
6
+ * @remarks
7
+ * Every reader and writer of a `txBody`, a `cNvPr` or a drawing element goes through these
8
+ * tables, so a shape's text and a chart's title agree on what `center` is. A value neither side
9
+ * knows passes through unchanged: the file still reads back as written.
10
+ */
11
+ interface Vocabulary<M extends string> {
12
+ /** The model value for an attribute value. */
13
+ read(value: string): M;
14
+ /** The attribute value for a model value; `undefined` stays `undefined`. */
15
+ write(value: M | undefined): string | undefined;
16
+ }
17
+ /** The drawing element each kind of shape is written as, and reads from. */
18
+ export declare const SHAPE_TYPES: Readonly<Record<string, IShape.Type>>;
19
+ /** `pPr/@algn`. */
20
+ export declare const paragraphAlignment: Vocabulary<IText.ParagraphAlignment>;
21
+ /** `pPr/@fontAlgn`. */
22
+ export declare const fontAlignment: Vocabulary<IText.FontAlignment>;
23
+ /** `bodyPr/@anchor`. */
24
+ export declare const anchor: Vocabulary<ITextFrame.VerticalAlignment>;
25
+ /** `rPr/@u`. */
26
+ export declare const underline: Vocabulary<IText.UnderlineStyle>;
27
+ /** `rPr/@strike`. */
28
+ export declare const strike: Vocabulary<IText.StrikeStyle>;
29
+ /** `bodyPr/@vert`. */
30
+ export declare const writingMode: Vocabulary<ITextFrame.WritingMode>;
31
+ /** `bodyPr/@vertOverflow` and `@horzOverflow`. */
32
+ export declare const overflow: Vocabulary<ITextFrame.Overflow>;
33
+ /** `tab/@algn`. */
34
+ export declare const tabAlignment: Vocabulary<ITextFrame.TabStopAlignment>;
35
+ /** `latin/@charset` and its kin: a signed byte in the file, the `0-255` `LOGFONT` value in the model. */
36
+ export declare const readCharset: (value: string) => IFont.Charset | undefined;
37
+ export declare const writeCharset: (value: IFont.Charset | undefined) => string | undefined;
38
+ export {};
39
+ //# sourceMappingURL=DrawingMLText.d.ts.map
@@ -0,0 +1,97 @@
1
+ import { IFormControl, ICaptioned, ISheet, ITextFrame } from '@sheetxl/sdk';
2
+ /**
3
+ * A form control as Excel stores it, in and out of the model's form-control content types.
4
+ *
5
+ * @remarks
6
+ * Excel writes one control three times: a `ctrlProp` part (`<formControlPr>`) says what it is
7
+ * and what it holds; a shape in the sheet's VML draws it for Excel 2007; and a hidden `<xdr:sp>`
8
+ * in the drawing part — the *twin*, joined to the control by `a14:compatExt/@spid` — carries the
9
+ * caption and its font for Excel 2010 and later. The model holds one content per control, typed
10
+ * by kind ({@link IFormControl.Type}), and this module turns it into, and out of, the first and
11
+ * the third. The VML shape is still replayed as it was read (`withControlAnchors`), with the
12
+ * cells of its anchor rewritten from the movable.
13
+ */
14
+ /** The x14 namespace the `ctrlProp` part declares. */
15
+ export declare const NS_FORM_CONTROL = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
16
+ /** The content type of a `ctrlProp` part. */
17
+ export declare const CONTENT_TYPE_CTRL_PROP = "application/vnd.ms-excel.controlproperties+xml";
18
+ /** The relationship a `<control>` uses for its `ctrlProp` part. */
19
+ export declare const RELATIONSHIP_TYPE_CTRL_PROP = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp";
20
+ /** The content types that are form controls, and so are written as Excel's `<controls>`. */
21
+ export declare const FORM_CONTROL_TYPES: ReadonlySet<string>;
22
+ /** Whether a movable's content is a form control. */
23
+ export declare const isFormControlType: (type: string | undefined) => boolean;
24
+ /**
25
+ * Reads a `<formControlPr>`, as its attributes, its list items and its `extLst` markup, into a
26
+ * content type and that kind's fields.
27
+ */
28
+ export declare function readFormControlPr(attributes: Record<string, string>, items: readonly string[], extLst: string | undefined): {
29
+ type: string;
30
+ json: IFormControl.JSON;
31
+ };
32
+ /**
33
+ * Writes a control's fields as a `ctrlProp` part.
34
+ */
35
+ export declare function writeFormControlPr(type: string, control: IFormControl.JSON): string;
36
+ /**
37
+ * Lifts the `<controlPr>` attributes the model names out of the attribute bag.
38
+ */
39
+ export declare function liftControlPr(props: Record<string, string>, control: IFormControl.JSON): void;
40
+ /**
41
+ * The `<controlPr>` attributes, the lifted ones restored.
42
+ */
43
+ export declare function controlPrAttributes(control: IFormControl.JSON): Record<string, string | undefined>;
44
+ /**
45
+ * What a hidden twin's shape JSON carries until `absorbControlTwins` takes it: the VML shape id
46
+ * of the control it draws for.
47
+ */
48
+ export interface ControlTwinMarks {
49
+ twinOf?: number;
50
+ }
51
+ /** What the drawing's hidden twin says about a control. */
52
+ export interface ControlTwin {
53
+ caption?: string;
54
+ font?: ICaptioned.Font;
55
+ }
56
+ /**
57
+ * Reads the caption and its font off a twin's text: the caption is the text, the font is the
58
+ * first run's.
59
+ */
60
+ export declare function readControlTwin(text: ITextFrame.JSON | undefined): ControlTwin;
61
+ /**
62
+ * Joins each drawing twin to the control it draws for, and takes it off the sheet.
63
+ *
64
+ * @remarks
65
+ * The twin is read as a hidden shape of its own (`DrawingSpVisitor`, which marks it with
66
+ * {@link ControlTwinMarks}); here it becomes the control's caption and font, and is written back
67
+ * from those (`controlTwinShape`). A twin whose control was not read stays the hidden shape it was.
68
+ */
69
+ export declare function absorbControlTwins(sheet: ISheet.JSON): void;
70
+ /**
71
+ * The hidden `<xdr:sp>` the drawing part carries for a control, written from the model.
72
+ *
73
+ * @remarks
74
+ * Hidden, so the drawing layer never shows it; its `cNvPr/@id` is the shape id, as Excel's own
75
+ * is. The caption's font is restated as Excel restates it: size, weight and style on the run,
76
+ * the color as a solid fill, the family as `latin`.
77
+ */
78
+ export declare function controlTwinShape(type: string, json: IFormControl.JSON, name: string | undefined): string;
79
+ /** The attributes an `mc:AlternateContent` around a twin's anchor declares. */
80
+ export declare const TWIN_ALTERNATE_CONTENT_ATTRIBUTES: {
81
+ 'xmlns:mc': string;
82
+ };
83
+ /** The attributes the `mc:Choice` inside it declares. */
84
+ export declare const TWIN_CHOICE_ATTRIBUTES: {
85
+ 'xmlns:a14': string;
86
+ Requires: string;
87
+ };
88
+ /** The shape id a VML shape names, or `null`. */
89
+ export declare function vmlShapeId(shape: string): number | null;
90
+ /** Whether a VML shape draws a form control (and not a note or a picture). */
91
+ export declare function isVmlControlShape(shape: string): boolean;
92
+ /**
93
+ * The VML part with every control shape visited: `update` answers the shape to keep, or `null`
94
+ * to drop it. Shapes that draw something else are left as they are.
95
+ */
96
+ export declare function mapVmlControlShapes(xml: string, update: (shape: string, shapeId: number | null) => string | null): string;
97
+ //# sourceMappingURL=FormControls.d.ts.map