@libraz/formulon 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1170,6 +1170,9 @@ export interface FontRecord {
1170
1170
  hasCharset: boolean;
1171
1171
  /** OOXML charset codepage id (e.g. 128 = Shift_JIS). */
1172
1172
  charset: number;
1173
+ /** `<scheme>` theme link: 0=absent, 1=major, 2=minor. Meaningful only on
1174
+ * a workbook that carries a theme part. */
1175
+ scheme: number;
1173
1176
  /** AARRGGBB literal RGB or compatibility fallback; not a resolved
1174
1177
  * theme/indexed/auto render colour. */
1175
1178
  colorArgb: number;
@@ -1252,6 +1255,37 @@ export interface CellXf {
1252
1255
  xfId?: number;
1253
1256
  }
1254
1257
 
1258
+ /** One `<rPh>` block: `text` reads the half-open span `[sb, eb)` of the
1259
+ * cell's surface text, measured in UTF-16 code units. */
1260
+ export interface PhoneticRun {
1261
+ sb: number;
1262
+ eb: number;
1263
+ text: string;
1264
+ }
1265
+
1266
+ /** Return type of `Workbook.getCellPhoneticRuns(sheet, row, col)`. */
1267
+ export interface PhoneticRunsResult {
1268
+ status: Status;
1269
+ runs: PhoneticRun[];
1270
+ }
1271
+
1272
+ /** How a cell's phonetic guide renders (OOXML `<phoneticPr>`). `fontId`
1273
+ * indexes the workbook's font table for the ruby text; `type` is the kana
1274
+ * form (0 half-width katakana, 1 full-width katakana, 2 hiragana, 3 no
1275
+ * conversion) and `alignment` how the kana is distributed (0 no control,
1276
+ * 1 left, 2 center, 3 distributed). The all-zero triple is what Excel
1277
+ * infers for a guide written with no `<phoneticPr>` element. */
1278
+ export interface PhoneticProperties {
1279
+ fontId: number;
1280
+ type: number;
1281
+ alignment: number;
1282
+ }
1283
+
1284
+ /** Return type of `Workbook.getCellPhoneticProperties(sheet, row, col)`. */
1285
+ export interface PhoneticPropertiesResult extends PhoneticProperties {
1286
+ status: Status;
1287
+ }
1288
+
1255
1289
  /** Return type of `Workbook.getFont(fontIndex)`. */
1256
1290
  export interface FontResult extends FontRecord {
1257
1291
  status: Status;
@@ -1610,6 +1644,17 @@ export interface Workbook {
1610
1644
  setText(sheet: number, row: number, col: number, text: string): Status;
1611
1645
  /** Stores (or, when empty, clears) the cell's OOXML phonetic guide (`<rPh>`). */
1612
1646
  setCellPhonetic(sheet: number, row: number, col: number, phonetic: string): Status;
1647
+ /** Stores (or, when empty, clears) the cell's phonetic guide as one `<rPh>`
1648
+ * block per run. Unlike `setCellPhonetic`, which annotates the whole cell,
1649
+ * this keeps the span each reading covers. The runs must be an ordered
1650
+ * partition: each needs `sb <= eb` and must start at or after the previous
1651
+ * run's `eb`. */
1652
+ setCellPhoneticRuns(sheet: number, row: number, col: number, runs: PhoneticRun[]): Status;
1653
+ /** Stores how the cell's guide renders. Independent of
1654
+ * `setCellPhoneticRuns` in both directions, and only observable on a cell
1655
+ * that has runs; every value setter clears both, so call it after the
1656
+ * cell's text. */
1657
+ setCellPhoneticProperties(sheet: number, row: number, col: number, properties: PhoneticProperties): Status;
1613
1658
  setBlank(sheet: number, row: number, col: number): Status;
1614
1659
  setFormula(sheet: number, row: number, col: number, formula: string): Status;
1615
1660
 
@@ -1654,6 +1699,12 @@ export interface Workbook {
1654
1699
  getLambdaText(sheet: number, row: number, col: number): LambdaTextResult;
1655
1700
  /** Returns the cell's OOXML phonetic guide (`<rPh>`), or an empty string. */
1656
1701
  getCellPhonetic(sheet: number, row: number, col: number): StringResult;
1702
+ /** Returns the cell's `<rPh>` blocks with their spans. `getCellPhonetic`
1703
+ * returns the same readings concatenated, without the spans. */
1704
+ getCellPhoneticRuns(sheet: number, row: number, col: number): PhoneticRunsResult;
1705
+ /** Returns how the cell's guide renders. A cell with no annotation
1706
+ * reports the all-zero triple. */
1707
+ getCellPhoneticProperties(sheet: number, row: number, col: number): PhoneticPropertiesResult;
1657
1708
 
1658
1709
  /** Recalculates all dirty cells serially on the caller thread.
1659
1710
  *
@@ -2157,6 +2208,16 @@ export interface Workbook {
2157
2208
  /** Adds a font (deduplicating against existing entries) and returns
2158
2209
  * the resolved index. */
2159
2210
  addFont(record: FontRecord): AddStyleResult;
2211
+ /** Overwrites the font at `fontIndex` in place. Every `<xf>` naming that
2212
+ * index restyles at once, so this is a bulk change rather than a local
2213
+ * edit; `addFont` is the way to introduce a new appearance. The index
2214
+ * must already exist -- the table does not auto-grow. */
2215
+ setFont(fontIndex: number, record: FontRecord): Status;
2216
+ /** Declares the workbook's default font: font 0, the record an unstyled
2217
+ * cell resolves to. A new workbook seeds it with Excel's Calibri 11 and
2218
+ * `addFont` can only append beside it, so this is the way to change what
2219
+ * a never-styled cell is saved as. Read it back with `getFont(0)`. */
2220
+ setDefaultFont(record: FontRecord): Status;
2160
2221
  /** Adds a fill (deduplicating against existing entries). */
2161
2222
  addFill(record: FillRecord): AddStyleResult;
2162
2223
  /** Adds a border (deduplicating against existing entries). */
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libraz/formulon",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Excel 365 calculation engine -- WASM binding",
5
5
  "license": "Apache-2.0",
6
6
  "author": "libraz",