@office-open/core 0.10.11 → 0.10.13

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 (62) hide show
  1. package/README.md +10 -9
  2. package/dist/chart/index.d.mts +1 -1
  3. package/dist/chart/index.mjs +1 -1
  4. package/dist/{chart-DwE8FCFk.mjs → chart-DOO1st0K.mjs} +3 -1
  5. package/dist/chart-DOO1st0K.mjs.map +1 -0
  6. package/dist/converters-C_Y2QX1w.mjs +1789 -0
  7. package/dist/converters-C_Y2QX1w.mjs.map +1 -0
  8. package/dist/data-type-CZMKVaaT.d.mts +10 -0
  9. package/dist/data-type-CZMKVaaT.d.mts.map +1 -0
  10. package/dist/descriptor/index.d.mts +2 -2
  11. package/dist/descriptor/index.mjs +2 -2
  12. package/dist/{descriptor-DAER86Rt.mjs → descriptor-BjNkn5jo.mjs} +3 -33
  13. package/dist/descriptor-BjNkn5jo.mjs.map +1 -0
  14. package/dist/drawingml/index.d.mts +2 -2
  15. package/dist/drawingml/index.mjs +2 -2
  16. package/dist/{src-zBJYrHrv.mjs → drawingml-sj1J3lb0.mjs} +22 -3728
  17. package/dist/drawingml-sj1J3lb0.mjs.map +1 -0
  18. package/dist/index-BVK2dv6C.d.mts +63 -0
  19. package/dist/index-BVK2dv6C.d.mts.map +1 -0
  20. package/dist/index-BfHfKuKy.d.mts +275 -0
  21. package/dist/index-BfHfKuKy.d.mts.map +1 -0
  22. package/dist/index-CE53SwpZ.d.mts +1463 -0
  23. package/dist/index-CE53SwpZ.d.mts.map +1 -0
  24. package/dist/{index-3STznXzZ.d.mts → index-D6VE-MnJ.d.mts} +3 -15
  25. package/dist/index-D6VE-MnJ.d.mts.map +1 -0
  26. package/dist/{index-CN0YjNSx.d.mts → index-DDyd2ErZ.d.mts} +3 -15
  27. package/dist/index-DDyd2ErZ.d.mts.map +1 -0
  28. package/dist/{index-CsQP7Cl4.d.mts → index-DlPA26cw.d.mts} +2 -47
  29. package/dist/index-DlPA26cw.d.mts.map +1 -0
  30. package/dist/index-k8WKLXnA.d.mts +150 -0
  31. package/dist/index-k8WKLXnA.d.mts.map +1 -0
  32. package/dist/index.d.mts +650 -8
  33. package/dist/index.d.mts.map +1 -0
  34. package/dist/index.mjs +1271 -7
  35. package/dist/index.mjs.map +1 -0
  36. package/dist/output-D_G_JR_8.d.mts +24 -0
  37. package/dist/output-D_G_JR_8.d.mts.map +1 -0
  38. package/dist/patch/index.d.mts +2 -2
  39. package/dist/patch/index.mjs +1 -1
  40. package/dist/{patch-DEPPafeB.mjs → patch-BmRfghOo.mjs} +67 -86
  41. package/dist/patch-BmRfghOo.mjs.map +1 -0
  42. package/dist/smartart/index.d.mts +1 -1
  43. package/dist/smartart/index.mjs +1 -1
  44. package/dist/{smartart-DCY-Vdv7.mjs → smartart-B7ukZ-Tw.mjs} +5 -3
  45. package/dist/smartart-B7ukZ-Tw.mjs.map +1 -0
  46. package/dist/theme/index.d.mts +1 -1
  47. package/dist/theme-CiNzdl-9.mjs +2 -0
  48. package/dist/theme-CiNzdl-9.mjs.map +1 -0
  49. package/dist/util/index.d.mts +4 -0
  50. package/dist/util/index.mjs +3 -0
  51. package/dist/util-Tq9PSjK0.mjs +1113 -0
  52. package/dist/util-Tq9PSjK0.mjs.map +1 -0
  53. package/dist/values-8di32lIe.d.mts +56 -0
  54. package/dist/values-8di32lIe.d.mts.map +1 -0
  55. package/package.json +7 -6
  56. package/dist/index-CHGFwCCQ.d.mts +0 -266
  57. package/dist/index-CpNwAcem.d.mts +0 -169
  58. package/dist/index-DdXU1_sq.d.mts +0 -5029
  59. package/dist/util/values.d.mts +0 -2
  60. package/dist/util/values.mjs +0 -2
  61. package/dist/values-CVIZcTRw.mjs +0 -371
  62. package/dist/values-DQfI1FSg.d.mts +0 -426
@@ -1,169 +0,0 @@
1
- import { Element } from "@office-open/xml";
2
-
3
- //#region src/descriptor/context.d.ts
4
- /** Context passed during stringify (write path). */
5
- interface WriteContext {
6
- /** Register a relationship and return its rId. */
7
- addRelationship(type: string, target: string, mode?: string): string;
8
- /** Add a media file and return its reference. */
9
- addMedia(data: Uint8Array, type: string): string;
10
- }
11
- /** Context passed during parse (parse path). */
12
- interface ReadContext {
13
- /** Resolve a relationship rId to its target path. */
14
- resolveRelationship(rId: string): string | undefined;
15
- /** Get a parsed XML part by path. */
16
- getPart(path: string): Element | undefined;
17
- /** Get raw binary data (images, media, etc.) by path. */
18
- getRaw(path: string): Uint8Array | undefined;
19
- }
20
- //#endregion
21
- //#region src/descriptor/types.d.ts
22
- /**
23
- * Custom descriptor — hand-written stringify/parse for an OOXML part.
24
- *
25
- * `TInput` is the stringify input (the options shape callers build); `TOutput`
26
- * is the parse output (the shape parse produces). They default to the same
27
- * type, so the common case — a descriptor whose stringify and parse share one
28
- * options shape — is written as `CustomDescriptor<T>` unchanged. Only
29
- * descriptors whose parse yields a genuinely different shape (e.g. an
30
- * accumulator-based stringify vs. a structured parse result) pass a third
31
- * argument, which lets parse return its real type instead of lying via `as`.
32
- *
33
- * `Ctx` stays the second parameter to preserve the existing
34
- * `CustomDescriptor<T, BodyContext>` call sites that customize the write
35
- * context; `TOutput` is third so it never collides with that two-arg form.
36
- */
37
- interface CustomDescriptor<TInput, Ctx = WriteContext, TOutput = TInput> {
38
- kind: "custom";
39
- stringify(value: TInput, ctx: Ctx): string | undefined;
40
- parse(el: Element, ctx: ReadContext): TOutput;
41
- }
42
- /** Alias for "any descriptor" — retained for call-site readability. */
43
- type Descriptor<TInput, Ctx = WriteContext, TOutput = TInput> = CustomDescriptor<TInput, Ctx, TOutput>;
44
- //#endregion
45
- //#region src/descriptor/runtime.d.ts
46
- /**
47
- * Serialize an Options object to an XML string using its descriptor.
48
- * Returns `undefined` when an optional element should be omitted.
49
- */
50
- declare function stringify$1<TInput, Ctx = WriteContext, TOutput = TInput>(desc: CustomDescriptor<TInput, Ctx, TOutput>, value: TInput, ctx: Ctx): string | undefined;
51
- /** Parse an XML Element into an Options object using its descriptor. */
52
- declare function parse$1<TInput, TOutput = TInput, Ctx = WriteContext>(desc: CustomDescriptor<TInput, Ctx, TOutput>, el: Element, ctx: ReadContext): TOutput;
53
- //#endregion
54
- //#region src/descriptor/helpers.d.ts
55
- /**
56
- * OOXML-specific encode/decode helpers for descriptors.
57
- *
58
- * XML traversal helpers (findChild, etc.) are in @office-open/xml utils.
59
- * This file only contains OOXML value encoding/decoding.
60
- *
61
- * @module
62
- */
63
- /** Encode boolean for CT_OnOff: true → omit val, false → "0". */
64
- declare const boolEncode: (v: boolean | undefined) => string | undefined;
65
- /** Decode CT_OnOff: absent or "true"/"1" → true, "0"/"false" → false. */
66
- declare const boolDecode: (raw: string) => boolean;
67
- /** Create an enum encoder from a JS↔XML mapping. */
68
- declare const enumEncode: (map: Record<string, string>) => (v: string | undefined) => string | undefined;
69
- /** Create an enum decoder from a JS↔XML mapping (inverted). */
70
- declare const enumDecode: (map: Record<string, string>) => (raw: string) => string;
71
- //#endregion
72
- //#region src/descriptor/field-spec.d.ts
73
- /**
74
- * Declarative field-consistency spec for descriptors.
75
- *
76
- * The `CustomDescriptor<T>` closure carries no field metadata, so the three
77
- * places that must agree — the Options interface, the stringify body, and the
78
- * parse body — drift silently (reflection dropping 9/14 props, styles
79
- * round-trip loss, core-properties 8-interface/10-write/8-parse inflation).
80
- *
81
- * Each entry declares the three field sets in a single semantic dimension
82
- * (Options field names, not XML tags), so {@link diffTagSets} can surface the
83
- * asymmetries directly:
84
- * - F1 write-loss — declared on the interface but never written
85
- * - F2 write-only — written but absent from the interface (inflation)
86
- * - F3 parse-loss — written but never restored on parse (round-trip loss)
87
- * - F5 parse-only — restored but never written
88
- *
89
- * @module
90
- */
91
- interface DescriptorFieldSpec {
92
- /** Stable identifier, matched to the descriptor under test. */
93
- id: string;
94
- /** Options interface name (documentation / assertion messages). */
95
- optionsInterface: string;
96
- /** Fields declared on the Options interface — the contract. */
97
- interfaceFields: readonly string[];
98
- /** Fields the stringify path actually emits; may carry inflation not on the interface. */
99
- writeFields: readonly string[];
100
- /** Fields the parse path actually restores. */
101
- parseFields: readonly string[];
102
- /** Expected child order when the XSD mandates sequence; omitted when order-independent. */
103
- order?: readonly string[];
104
- /** Sample exercising the interface fields, for F4 round-trip deep-equality. */
105
- sampleOptions: unknown;
106
- /**
107
- * Interface fields excluded from the contract comparison — input-side sugar
108
- * (thematicBreak→border, rightTabStop→tabStops) and control flags
109
- * (includeIfEmpty) that map field→XML but XML→a different field, breaking the
110
- * 1:1 round-trip assumption. The interface-drift test asserts
111
- * `interfaceFields === (live interface fields − excludeFields)`.
112
- */
113
- excludeFields?: readonly string[];
114
- notes?: string;
115
- }
116
- /**
117
- * Curated high-value targets — each maps to a known historical drift.
118
- * `settings` is intentionally absent: its round-trip is rawXml-based (byte
119
- * passthrough), so field-level diff would mislabel every field as F2.
120
- */
121
- declare const FIELD_SPECS: readonly DescriptorFieldSpec[];
122
- declare function findFieldSpec(id: string): DescriptorFieldSpec | undefined;
123
- //#endregion
124
- //#region src/descriptor/field-consistency.d.ts
125
- interface FieldConsistencyReport {
126
- /** F1 — declared on the interface but never written (write-loss). */
127
- f1WriteLoss: readonly string[];
128
- /** F2 — written but absent from the interface (write-only inflation). */
129
- f2WriteOnly: readonly string[];
130
- /** F3 — written but never restored on parse (round-trip loss). */
131
- f3ParseLoss: readonly string[];
132
- /** F5 — restored on parse but never written (parse-only). */
133
- f5ParseOnly: readonly string[];
134
- }
135
- /** Diff the interface / write / parse field sets declared on a spec. */
136
- declare function diffTagSets(spec: DescriptorFieldSpec): FieldConsistencyReport;
137
- interface RoundTripResult {
138
- /** Present in the sample, absent after round-trip. */
139
- lost: readonly string[];
140
- /** Absent from the sample, present after round-trip. */
141
- gained: readonly string[];
142
- /** Present on both sides with differing values. */
143
- mutated: readonly string[];
144
- }
145
- /**
146
- * Run a stringify→parse cycle over a sample and diff the result field set.
147
- * Returns the F4 round-trip drift. The caller supplies the descriptor's own
148
- * stringify/parse (a `CustomDescriptor` pair or a function pair).
149
- */
150
- declare function roundTripFields<T extends object, WC = unknown, RC = unknown>(stringifyFn: (opts: T, ctx: WC) => string | undefined, parseFn: (el: Element, ctx: RC) => T, sample: T, writeCtx: WC, readCtx: RC): RoundTripResult;
151
- interface OrderViolation {
152
- /** Position of the offending child within its parent. */
153
- index: number;
154
- /** Local name of the child element (namespace prefix stripped). */
155
- tag: string;
156
- /** Why the child violates the expected sequence. */
157
- reason: "unexpected" | "out-of-order";
158
- }
159
- /**
160
- * Verify the child element order of a stringified container against an XSD
161
- * sequence — the F6 check. Namespace prefixes are normalized, so `expected`
162
- * entries may be qualified (`w:pStyle`) or local (`pStyle`); both match a
163
- * `<w:pStyle>` child. Elements absent from `expected` are flagged "unexpected";
164
- * a child whose expected position precedes the previous child's is
165
- * "out-of-order".
166
- */
167
- declare function checkOrder(xml: string, expected: readonly string[]): readonly OrderViolation[];
168
- //#endregion
169
- export { Descriptor as _, diffTagSets as a, FIELD_SPECS as c, boolEncode as d, enumDecode as f, CustomDescriptor as g, stringify$1 as h, checkOrder as i, findFieldSpec as l, parse$1 as m, OrderViolation as n, roundTripFields as o, enumEncode as p, RoundTripResult as r, DescriptorFieldSpec as s, FieldConsistencyReport as t, boolDecode as u, ReadContext as v, WriteContext as y };