@jsfkit/types 1.5.0 → 2.0.0-rc1

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 (2) hide show
  1. package/dist/index.d.ts +805 -17
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -149,7 +149,7 @@ type DefinedName = {
149
149
  * A formula expression, a reference, or value. Whatever the value is will be evaluated by a
150
150
  * spreadsheet engine as if it were an expression.
151
151
  */
152
- value?: string;
152
+ value: string;
153
153
  /**
154
154
  * An optional worksheet name that defines the scope for this name. When this field is absent,
155
155
  * the defined name should be considered to be scoped to the workbook.
@@ -161,6 +161,30 @@ type DefinedName = {
161
161
  comment?: string;
162
162
  };
163
163
 
164
+ /**
165
+ * A defined name in an external workbook.
166
+ *
167
+ * @see {@link DefinedName}
168
+ * @group Workbooks
169
+ */
170
+ type ExternalDefinedName = {
171
+ /**
172
+ * A case-sensitive name. Names must start with a letter or `_`, and may only be made up of
173
+ * letters as well as `\`, `_`, `.`, or `?`. Names must be a valid A1 or R1C1 reference.
174
+ */
175
+ name: string;
176
+ /**
177
+ * A formula expression, a reference, or value. Whatever the value is will be evaluated by a
178
+ * spreadsheet engine as if it were an expression.
179
+ */
180
+ value?: string;
181
+ /**
182
+ * An optional worksheet name that defines the scope for this name. When this field is absent,
183
+ * the defined name should be considered to be scoped to the workbook.
184
+ */
185
+ scope?: string;
186
+ };
187
+
164
188
  /**
165
189
  * A simple container sheet for cell values within an external workbook.
166
190
  *
@@ -201,7 +225,7 @@ type External = {
201
225
  */
202
226
  sheets: ExternalWorksheet[];
203
227
  /** Relevant defined names from an external workbook. */
204
- names: DefinedName[];
228
+ names: ExternalDefinedName[];
205
229
  /**
206
230
  * Indicates that the path to the external workbook file is unknown or missing.
207
231
  * In XLSX, this corresponds to the xlPathMissing relationship type.
@@ -236,7 +260,7 @@ type GridSize = {
236
260
  /** A 1-based inclusive end index. */
237
261
  end: integer;
238
262
  /** The size of the grid item in pixels. */
239
- size: PixelValue;
263
+ size?: PixelValue;
240
264
  /** An index to a style in the workbook styles. */
241
265
  s?: integer;
242
266
  };
@@ -258,6 +282,509 @@ type Note = {
258
282
  text: string;
259
283
  };
260
284
 
285
+ /**
286
+ * Automatic colour choice. The application decides on what exact colour to use. Typically this
287
+ * means black for text, white for background.
288
+ *
289
+ * @group Colors
290
+ */
291
+ type AutoColor = {
292
+ type: 'auto';
293
+ };
294
+
295
+ /**
296
+ * Represents a single transformation that can be applied to a colour.
297
+ *
298
+ * Most transforms have a `type` that specifies the kind of transformation, and a `value` that
299
+ * provides the necessary parameter for that transformation. The exact meaning and valid range of
300
+ * `value` depends on the `type` of transform. The exception are a handful of whole-colour
301
+ * transformations that affect the entire colour; they have `type` but no `value.`
302
+ *
303
+ * The supported transform types include:
304
+ *
305
+ * - Tint and shade: blend the colour towards white (tint) or black (shade) by a specified
306
+ * percentage.
307
+ * - Alpha: adjust the opacity of the colour using various methods (absolute value, multiplicative,
308
+ * or additive).
309
+ * - Hue, saturation, and luminance: rotate a colour attribute of the colour by a specified amount
310
+ * (absolute, multiplicative, or additive).
311
+ * - Per-channel RGB adjustments: modify individual red, green, or blue channels (absolute,
312
+ * multiplicative, or additive).
313
+ * - Whole-colour operations: apply transformations that affect the entire colour (complement,
314
+ * invert, grayscale, gamma adjustments).
315
+ *
316
+ * @group Colors
317
+ */
318
+ type ColorTransform = {
319
+ /**
320
+ * Produces a lighter version of the input colour. A 10% tint is 10% of the input colour
321
+ * combined with 90% white. */
322
+ type: 'tint';
323
+ /**
324
+ * Percentage (clamped to 0-100).
325
+ * @min 0
326
+ * @max 100
327
+ */
328
+ value: number;
329
+ } | {
330
+ /**
331
+ * Produces a darker version of the input colour. A 10% shade is 10% of the input colour
332
+ * combined with 90% black.
333
+ */
334
+ type: 'shade';
335
+ /**
336
+ * Percentage (clamped to 0-100).
337
+ * @min 0
338
+ * @max 100
339
+ */
340
+ value: number;
341
+ } | {
342
+ /** Alters the input colour to have the specified opacity, but with its colour unchanged. */
343
+ type: 'alpha';
344
+ /**
345
+ * Percentage (clamped to 0-100).
346
+ * @min 0
347
+ * @max 100
348
+ */
349
+ value: number;
350
+ } | {
351
+ /**
352
+ * Produces a more or less opaque version of the input colour. An alpha modulate never increases
353
+ * the alpha beyond 100%. A 200% alpha modulate makes an input colour twice as opaque as before.
354
+ * A 50% alpha modulate makes an input colour half as opaque as before.
355
+ */
356
+ type: 'alphaMod';
357
+ /**
358
+ * Positive percentage.
359
+ * @min 0
360
+ */
361
+ value: number;
362
+ } | {
363
+ /**
364
+ * Produces a more or less opaque version of the input colour.
365
+ *
366
+ * Increases or decreases the input alpha percentage by the specified percentage offset. A 10%
367
+ * alpha offset increases a 50% opacity to 60%. A -10% alpha offset decreases a 50% opacity to
368
+ * 40%. The transformed alpha values are limited to a range of 0 to 100%. A 10% alpha offset
369
+ * increase to a 100% opaque object still results in 100% opacity.
370
+ */
371
+ type: 'alphaOff';
372
+ /**
373
+ * Percentage (clamped to -100 to 100).
374
+ * @min -100
375
+ * @max 100
376
+ */
377
+ value: number;
378
+ } | {
379
+ /**
380
+ * Alters the input colour so it has the specified hue, but with its saturation and luminance
381
+ * unchanged.
382
+ */
383
+ type: 'hue';
384
+ /**
385
+ * Degrees (clamped to 0-360).
386
+ * @min 0
387
+ * @max 360
388
+ */
389
+ value: number;
390
+ } | {
391
+ /**
392
+ * Modulates the input colour's hue by the given percentage. A 50% hue modulate decreases the
393
+ * angular hue value by half. A 200% hue modulate doubles the angular hue value.
394
+ */
395
+ type: 'hueMod';
396
+ /**
397
+ * Positive percentage.
398
+ * @min 0
399
+ */
400
+ value: number;
401
+ } | {
402
+ /**
403
+ * Produces the input colour with its hue shifted, but with its saturation and luminance
404
+ * unchanged.
405
+ */
406
+ type: 'hueOff';
407
+ /** Degrees. */
408
+ value: number;
409
+ } | {
410
+ /**
411
+ * Alters the input colour so it has the specified saturation, but with its hue and luminance
412
+ * unchanged.
413
+ */
414
+ type: 'sat';
415
+ /** Unbounded percentage. */
416
+ value: number;
417
+ } | {
418
+ /**
419
+ * Modulates the input colour's saturation by the given percentage.
420
+ *
421
+ * A 50% saturation modulate reduces the saturation by half. A 200% saturation modulate doubles
422
+ * the saturation.
423
+ */
424
+ type: 'satMod';
425
+ /** Unbounded percentage. */
426
+ value: number;
427
+ } | {
428
+ /**
429
+ * Produces the input colour with its saturation shifted, but with its hue and luminance
430
+ * unchanged. A 10% offset to 20% saturation yields 30% saturation.
431
+ */
432
+ type: 'satOff';
433
+ /** Unbounded percentage. */
434
+ value: number;
435
+ } | {
436
+ /**
437
+ * Alters the input colour so it has the specified luminance, but with its hue and saturation
438
+ * unchanged.
439
+ */
440
+ type: 'lum';
441
+ /** Unbounded percentage. */
442
+ value: number;
443
+ } | {
444
+ /**
445
+ * Alters the input colour's luminance modulated by the given percentage.
446
+ *
447
+ * A 50% luminance modulate reduces the luminance by half. A 200% luminance modulate doubles the
448
+ * luminance.
449
+ */
450
+ type: 'lumMod';
451
+ /** Unbounded percentage. */
452
+ value: number;
453
+ } | {
454
+ /**
455
+ * Produces the input colour with its luminance shifted, but with its hue and saturation
456
+ * unchanged.
457
+ */
458
+ type: 'lumOff';
459
+ /** Unbounded percentage. */
460
+ value: number;
461
+ } | {
462
+ /**
463
+ * Produces the input colour with the specified red component. The green and blue colour
464
+ * components unchanged.
465
+ */
466
+ type: 'red';
467
+ /** Unbounded percentage. */
468
+ value: number;
469
+ } | {
470
+ /**
471
+ * Alters the input colour so its red component is modulated by the given percentage. A 50% red
472
+ * modulate reduces the red component by half. A 200% red modulate doubles the red component.
473
+ */
474
+ type: 'redMod';
475
+ /** Unbounded percentage. */
476
+ value: number;
477
+ } | {
478
+ /**
479
+ * Alters the input colour so its red component is shifted. Its green and blue colour components
480
+ * unchanged.
481
+ */
482
+ type: 'redOff';
483
+ /** Unbounded percentage. */
484
+ value: number;
485
+ } | {
486
+ /**
487
+ * Provides the input colour with the specified green component. Its red and blue colour
488
+ * components unchanged.
489
+ */
490
+ type: 'green';
491
+ /** Unbounded percentage. */
492
+ value: number;
493
+ } | {
494
+ /**
495
+ * Modulates the input colour's green component by the given percentage.
496
+ *
497
+ * A 50% green modulate reduces the green component by half. A 200% green modulate doubles the
498
+ * green component.
499
+ */
500
+ type: 'greenMod';
501
+ /** Unbounded percentage. */
502
+ value: number;
503
+ } | {
504
+ /**
505
+ * Alters the input colour so its green component is shifted. Its red and blue colour components
506
+ * unchanged.
507
+ */
508
+ type: 'greenOff';
509
+ /** Unbounded percentage. */
510
+ value: number;
511
+ } | {
512
+ /**
513
+ * Provides the input colour with the specified blue component. Its red and green colour
514
+ * components unchanged.
515
+ */
516
+ type: 'blue';
517
+ /** Unbounded percentage. */
518
+ value: number;
519
+ } | {
520
+ /**
521
+ * Modulates the input colour's blue component by the given percentage.
522
+ *
523
+ * A 50% blue modulate reduces the blue component by half. A 200% blue modulate doubles the blue
524
+ * component.
525
+ */
526
+ type: 'blueMod';
527
+ /** Unbounded percentage. */
528
+ value: number;
529
+ } | {
530
+ /**
531
+ * Alters the input colour so its blue component is shifted, but with its red and green colour
532
+ * components unchanged.
533
+ */
534
+ type: 'blueOff';
535
+ /** Unbounded percentage. */
536
+ value: number;
537
+ } | {
538
+ /**
539
+ * Specifies that the colour rendered should be the complement of the input colour with the
540
+ * complement being defined as such.
541
+ */
542
+ type: 'comp';
543
+ } | {
544
+ /**
545
+ * Specifies the inverse of the input colour. For example, the inverse of red (1, 0, 0) is cyan
546
+ * (0, 1, 1 ).
547
+ */
548
+ type: 'inv';
549
+ } | {
550
+ /**
551
+ * Specifies a grey scale of the input colour, taking into relative intensities of the red,
552
+ * green, and blue primaries.
553
+ */
554
+ type: 'gray';
555
+ } | {
556
+ /**
557
+ * Specifies that the output colour rendered by the generating application should be the sRGB
558
+ * gamma shift of the input colour.
559
+ */
560
+ type: 'gamma';
561
+ } | {
562
+ /**
563
+ * Specifies that the output colour rendered by the generating application should be the inverse
564
+ * sRGB gamma shift of the input colour.
565
+ */
566
+ type: 'invGamma';
567
+ };
568
+
569
+ /**
570
+ * Hue / saturation / lightness.
571
+ *
572
+ * Hue, saturation and lightness follow CSS Color Level 4 conventions, but using the range (0-100)
573
+ * rather than (0-1).
574
+ *
575
+ * @group Colors
576
+ */
577
+ type HslColor = {
578
+ type: 'hsl';
579
+ /**
580
+ * Degrees (0-360). Must be positive.
581
+ * @min 0
582
+ * @max 360
583
+ */
584
+ hue: number;
585
+ /** Percentage. */
586
+ saturation: number;
587
+ /** Percentage. */
588
+ lightness: number;
589
+ };
590
+
591
+ /**
592
+ * A legacy colour indexing scheme, still occasionally required for backwards compatibility.
593
+ *
594
+ * An enumerated set of RGB colours values that correspond to a zero-based index.
595
+ *
596
+ * The table below lists the mapping from indexed colour value to RGB value. Note that indexes 8-15
597
+ * are copies of indexes 0-7. All colours are fully opaque.
598
+ *
599
+ * | Index | RGB hex colour |
600
+ * |------:|------------------:|
601
+ * | 0 | #000000 |
602
+ * | 1 | #FFFFFF |
603
+ * | 2 | #FF0000 |
604
+ * | 3 | #00FF00 |
605
+ * | 4 | #0000FF |
606
+ * | 5 | #FFFF00 |
607
+ * | 6 | #FF00FF |
608
+ * | 7 | #00FFFF |
609
+ * | 8 | #000000 |
610
+ * | 9 | #FFFFFF |
611
+ * | 10 | #FF0000 |
612
+ * | 11 | #00FF00 |
613
+ * | 12 | #0000FF |
614
+ * | 13 | #FFFF00 |
615
+ * | 14 | #FF00FF |
616
+ * | 15 | #00FFFF |
617
+ * | 16 | #800000 |
618
+ * | 17 | #008000 |
619
+ * | 18 | #000080 |
620
+ * | 19 | #808000 |
621
+ * | 20 | #800080 |
622
+ * | 21 | #008080 |
623
+ * | 22 | #C0C0C0 |
624
+ * | 23 | #808080 |
625
+ * | 24 | #9999FF |
626
+ * | 25 | #993366 |
627
+ * | 26 | #FFFFCC |
628
+ * | 27 | #CCFFFF |
629
+ * | 28 | #660066 |
630
+ * | 29 | #FF8080 |
631
+ * | 30 | #0066CC |
632
+ * | 31 | #CCCCFF |
633
+ * | 32 | #000080 |
634
+ * | 33 | #FF00FF |
635
+ * | 34 | #FFFF00 |
636
+ * | 35 | #00FFFF |
637
+ * | 36 | #800080 |
638
+ * | 37 | #800000 |
639
+ * | 38 | #008080 |
640
+ * | 39 | #0000FF |
641
+ * | 40 | #00CCFF |
642
+ * | 41 | #CCFFFF |
643
+ * | 42 | #CCFFCC |
644
+ * | 43 | #FFFF99 |
645
+ * | 44 | #99CCFF |
646
+ * | 45 | #FF99CC |
647
+ * | 46 | #CC99FF |
648
+ * | 47 | #FFCC99 |
649
+ * | 48 | #3366FF |
650
+ * | 49 | #33CCCC |
651
+ * | 50 | #99CC00 |
652
+ * | 51 | #FFCC00 |
653
+ * | 52 | #FF9900 |
654
+ * | 53 | #FF6600 |
655
+ * | 54 | #666699 |
656
+ * | 55 | #969696 |
657
+ * | 56 | #003366 |
658
+ * | 57 | #339966 |
659
+ * | 58 | #003300 |
660
+ * | 59 | #333300 |
661
+ * | 60 | #993300 |
662
+ * | 61 | #993366 |
663
+ * | 62 | #333399 |
664
+ * | 63 | #333333 |
665
+ * | 64 | System foreground |
666
+ * | 65 | System background |
667
+ *
668
+ * @group Colors
669
+ */
670
+ type IndexedColor = {
671
+ type: 'indexed';
672
+ value: number;
673
+ };
674
+
675
+ /**
676
+ * A named colour from a predefined collection of colours.
677
+ *
678
+ * The preset colours are analogous to the extended colour keywords from CSS Colors Level 3,
679
+ * but using camel casing and abbreviated forms (e.g. `dkMagenta` vs `darkmagenta`).
680
+ *
681
+ * @group Colors
682
+ */
683
+ type PresetColor = {
684
+ type: 'preset';
685
+ /** Preset name, e.g. "aliceBlue", "coral". */
686
+ value: 'aliceBlue' | 'antiqueWhite' | 'aqua' | 'aquamarine' | 'azure' | 'beige' | 'bisque' | 'black' | 'blanchedAlmond' | 'blue' | 'blueViolet' | 'brown' | 'burlyWood' | 'cadetBlue' | 'chartreuse' | 'chocolate' | 'coral' | 'cornflowerBlue' | 'cornsilk' | 'crimson' | 'cyan' | 'dkBlue' | 'dkCyan' | 'dkGoldenrod' | 'dkGray' | 'dkGreen' | 'dkKhaki' | 'dkMagenta' | 'dkOliveGreen' | 'dkOrange' | 'dkOrchid' | 'dkRed' | 'dkSalmon' | 'dkSeaGreen' | 'dkSlateBlue' | 'dkSlateGray' | 'dkTurquoise' | 'dkViolet' | 'deepPink' | 'deepSkyBlue' | 'dimGray' | 'dodgerBlue' | 'firebrick' | 'floralWhite' | 'forestGreen' | 'fuchsia' | 'gainsboro' | 'ghostWhite' | 'gold' | 'goldenrod' | 'gray' | 'green' | 'greenYellow' | 'honeydew' | 'hotPink' | 'indianRed' | 'indigo' | 'ivory' | 'khaki' | 'lavender' | 'lavenderBlush' | 'lawnGreen' | 'lemonChiffon' | 'ltBlue' | 'ltCoral' | 'ltCyan' | 'ltGoldenrodYellow' | 'ltGray' | 'ltGreen' | 'ltPink' | 'ltSalmon' | 'ltSeaGreen' | 'ltSkyBlue' | 'ltSlateGray' | 'ltSteelBlue' | 'ltYellow' | 'lime' | 'limeGreen' | 'linen' | 'magenta' | 'maroon' | 'medAquamarine' | 'medBlue' | 'medOrchid' | 'medPurple' | 'medSeaGreen' | 'medSlateBlue' | 'medSpringGreen' | 'medTurquoise' | 'medVioletRed' | 'midnightBlue' | 'mintCream' | 'mistyRose' | 'moccasin' | 'navajoWhite' | 'navy' | 'oldLace' | 'olive' | 'oliveDrab' | 'orange' | 'orangeRed' | 'orchid' | 'paleGoldenrod' | 'paleGreen' | 'paleTurquoise' | 'paleVioletRed' | 'papayaWhip' | 'peachPuff' | 'peru' | 'pink' | 'plum' | 'powderBlue' | 'purple' | 'red' | 'rosyBrown' | 'royalBlue' | 'saddleBrown' | 'salmon' | 'sandyBrown' | 'seaGreen' | 'seaShell' | 'sienna' | 'silver' | 'skyBlue' | 'slateBlue' | 'slateGray' | 'snow' | 'springGreen' | 'steelBlue' | 'tan' | 'teal' | 'thistle' | 'tomato' | 'turquoise' | 'violet' | 'wheat' | 'white' | 'whiteSmoke' | 'yellow' | 'yellowGreen';
687
+ };
688
+
689
+ /**
690
+ * A colour in Microsoft's scRGB colour space.
691
+ *
692
+ * Equivalent to CSS `srgb-linear` colour space.
693
+ *
694
+ * @group Colors
695
+ */
696
+ type ScRgbColor = {
697
+ type: 'scrgb';
698
+ /** Red value as a percentage. Can be outside the range 0-100. */
699
+ red: number;
700
+ /** Green value as a percentage. Can be outside the range 0-100. */
701
+ green: number;
702
+ /** Blue value as a percentage. Can be outside the range 0-100. */
703
+ blue: number;
704
+ };
705
+
706
+ /**
707
+ * Standard sRGB colour space.
708
+ *
709
+ * @group Colors
710
+ */
711
+ type SrgbColor = {
712
+ type: 'srgb';
713
+ /**
714
+ * CSS-style hex, e.g. `FF0000`. Always six digits, always uppercase. No alpha channel.
715
+ * @pattern ^[A-F0-9]{6}$
716
+ */
717
+ value: string;
718
+ };
719
+
720
+ /**
721
+ * OS-defined system colour (e.g. window text, highlight).
722
+ *
723
+ * The value must be one of the pre-defined values. The colour matching each of these values should
724
+ * match the closest analogous colour in the OS in use.
725
+ *
726
+ * @group Colors
727
+ */
728
+ type SystemColor = {
729
+ type: 'system';
730
+ /** System colour name. */
731
+ value: 'scrollBar' | 'background' | 'activeCaption' | 'inactiveCaption' | 'menu' | 'window' | 'windowFrame' | 'menuText' | 'windowText' | 'captionText' | 'activeBorder' | 'inactiveBorder' | 'appWorkspace' | 'highlight' | 'highlightText' | 'btnFace' | 'btnShadow' | 'grayText' | 'btnText' | 'inactiveCaptionText' | 'btnHighlight' | '3dDkShadow' | '3dLight' | 'infoText' | 'infoBk' | 'hotLight' | 'gradientActiveCaption' | 'gradientInactiveCaption' | 'menuHighlight' | 'menuBar';
732
+ };
733
+
734
+ /** Reference to a theme colour. */
735
+ /**
736
+ * Reference to a theme colour.
737
+ *
738
+ * A theme colour is defined in the workbook's theme. Theme colours are used to ensure a consistent
739
+ * palette across a workbook.
740
+ *
741
+ * @group Colors
742
+ */
743
+ type SchemeColor = {
744
+ type: 'theme';
745
+ /**
746
+ * Theme colour name.
747
+ *
748
+ * Must be one of a limited set of values. The actual colour that matches the name is defined
749
+ * elsewhere in the theme.
750
+ */
751
+ value: 'bg1' | 'tx1' | 'bg2' | 'tx2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink' | 'phClr' | 'dk1' | 'lt1' | 'dk2' | 'lt2';
752
+ };
753
+
754
+ /**
755
+ * A colour, which can be used is various parts of a workbook. The base colour can be transformed
756
+ * using a list of colour transformations.
757
+ *
758
+ * The base colour must be defined using one of the following colour models:
759
+ *
760
+ * - {@link SrgbColor}: Standard sRGB colour space, defined by a CSS-style hex string (e.g.
761
+ * `FF0000`).
762
+ * - {@link ScRgbColor}: A colour in Microsoft's scRGB colour space, defined by red, green, and blue
763
+ * values as percentages.
764
+ * - {@link HslColor}: A colour in HSL colour space, defined by hue, saturation, and lightness
765
+ * values.
766
+ * - {@link SystemColor}: An OS-defined system colour (e.g. window text, highlight), defined using
767
+ * one of an enumerated set of values.
768
+ * - {@link SchemeColor}: A reference to a theme colour.
769
+ * - {@link PresetColor}: A preset colour, similar to CSS's defined colours.
770
+ * - {@link AutoColor}: Colour choice left to the application.
771
+ * - {@link IndexedColor}: A legacy colour indexing scheme.
772
+ *
773
+ * @group Colors
774
+ */
775
+ type Color = (SrgbColor | ScRgbColor | HslColor | SystemColor | SchemeColor | PresetColor | AutoColor | IndexedColor) & {
776
+ /**
777
+ * Optional list of colour transformations to apply to the base colour.
778
+ *
779
+ * The transformations must be applied in order, and each transformation must be applied to the
780
+ * result of the previous one. There can be multiple transformations of the same type.
781
+ *
782
+ * The transformations are defined by {@link ColorTransform}, which includes operations such as
783
+ * tinting, shading, and saturation adjustments.
784
+ */
785
+ transforms?: ColorTransform[];
786
+ };
787
+
261
788
  /**
262
789
  * Base type for text runs that annotate ranges within threaded comment text.
263
790
  *
@@ -646,15 +1173,6 @@ type BlipFill = {
646
1173
  */
647
1174
  type DmlAngle = number;
648
1175
 
649
- /**
650
- * A hex-encoded RGB or RGBA value that conforms to the CSS4 color specification (e.g. `"#3cb371"`).
651
- *
652
- * @see {@link https://www.w3.org/TR/css-color-4/#hex-notation | CSS hexadecimal notation spec}
653
- * @pattern ^#([a-fA-F0-9]{3,4}|([a-fA-F0-9][a-fA-F0-9]){3,4})$
654
- * @group Workbooks
655
- */
656
- type Color = `#${string}`;
657
-
658
1176
  /**
659
1177
  * Gradient color stop.
660
1178
  *
@@ -1782,6 +2300,24 @@ type Style = {
1782
2300
  * @default "Calibri"
1783
2301
  */
1784
2302
  fontFamily?: string;
2303
+ /**
2304
+ * Identifies the font scheme, if any, to which this style's font belongs.
2305
+ *
2306
+ * When set, the {@link Style.fontFamily} property is ignored and the font is instead resolved by
2307
+ * the workbook theme. `"major"` maps to the theme's heading font and `"minor"` to the body font.
2308
+ * The actual typeface is determined by the theme's {@link ThemeFontCollection} at render time.
2309
+ *
2310
+ * When the theme changes, an application is expected to update the fonts associated with a scheme
2311
+ * automatically.
2312
+ *
2313
+ * It is an error to set this when a workbook has no theme.
2314
+ *
2315
+ * @see {@link Workbook.theme}
2316
+ * @see {@link Theme.fontScheme}
2317
+ * @see {@link ThemeFontScheme}
2318
+ * @see {@link ThemeFontCollection}
2319
+ */
2320
+ fontScheme?: 'major' | 'minor';
1785
2321
  /**
1786
2322
  * The font size in pixels.
1787
2323
  *
@@ -1896,8 +2432,12 @@ type Style = {
1896
2432
  /**
1897
2433
  * The degrees to which the cell text should be rotated. Values range from 0 to 180, and 255 to
1898
2434
  * indicate vertical text. The origin of the rotation is the first letter of the text.
2435
+ *
2436
+ * @min 0
2437
+ * @max 255
2438
+ * @defaultValue 0
1899
2439
  */
1900
- textRotation?: boolean;
2440
+ textRotation?: integer;
1901
2441
  /**
1902
2442
  * Formatting directions for rendering the cell's value to text.
1903
2443
  */
@@ -2034,6 +2574,206 @@ type Table = {
2034
2574
  style?: TableStyle;
2035
2575
  };
2036
2576
 
2577
+ /**
2578
+ * A custom colour, used to add extra colours to a theme.
2579
+ *
2580
+ * @group Themes
2581
+ */
2582
+ type ThemeCustomColor = {
2583
+ name?: string;
2584
+ color: Color;
2585
+ };
2586
+
2587
+ /**
2588
+ * Canonical theme colour palette.
2589
+ *
2590
+ * Consists of twelve colours that come together to form the colour scheme for a theme.
2591
+ *
2592
+ * @group Themes
2593
+ */
2594
+ type ThemeColorScheme = {
2595
+ /** Colour scheme name. */
2596
+ name: string;
2597
+ /** The "light 1" colour. */
2598
+ lt1: Color;
2599
+ /** The "dark 1" colour. */
2600
+ dk1: Color;
2601
+ /** The "light 2" colour. */
2602
+ lt2: Color;
2603
+ /** The "dark 2" colour. */
2604
+ dk2: Color;
2605
+ /** Accent 1 colour. */
2606
+ accent1: Color;
2607
+ /** Accent 2 colour. */
2608
+ accent2: Color;
2609
+ /** Accent 3 colour. */
2610
+ accent3: Color;
2611
+ /** Accent 4 colour. */
2612
+ accent4: Color;
2613
+ /** Accent 5 colour. */
2614
+ accent5: Color;
2615
+ /** Accent 6 colour. */
2616
+ accent6: Color;
2617
+ /** Unvisited hyperlink colour. */
2618
+ hlink: Color;
2619
+ /** Visited hyperlink colour. */
2620
+ folHlink: Color;
2621
+ };
2622
+
2623
+ /**
2624
+ * Script-specific supplemental font.
2625
+ *
2626
+ * @group Themes
2627
+ */
2628
+ type ThemeSupplementalFont = {
2629
+ /**
2630
+ * ISO 15924 script code (e.g. `Egyp`, `Arab`).
2631
+ *
2632
+ * @see {@link https://en.wikipedia.org/wiki/ISO_15924}
2633
+ */
2634
+ script: string;
2635
+ /** Font face to use for this script. */
2636
+ typeface: string;
2637
+ };
2638
+
2639
+ /**
2640
+ * A font definition.
2641
+ *
2642
+ * @group Themes
2643
+ */
2644
+ type ThemeTextFont = {
2645
+ /**
2646
+ * Typeface name, e.g. `"Calibri"`.
2647
+ *
2648
+ * Specifies the name of the font to be used. If this font isn't available, font substitution
2649
+ * should be used in order to select an alternate font.
2650
+ */
2651
+ typeface: string;
2652
+ /**
2653
+ * PANOSE 1.0 classification as hex. Used to guide selection of a similar alternate font if the
2654
+ * chosen font is unavailable.
2655
+ *
2656
+ * @see {@link https://en.wikipedia.org/wiki/PANOSE}
2657
+ */
2658
+ panose?: string;
2659
+ /**
2660
+ * Charset byte value.
2661
+ *
2662
+ * Specifies the character set supported by the font. Used in font substitution logic to locate an
2663
+ * appropriate substitute font when this font isn't available.
2664
+ *
2665
+ * | Value | Description |
2666
+ * |-----------------|-------------------------------------------------------------|
2667
+ * | 0 | ANSI character set (IANA name `iso-8859-1`) |
2668
+ * | 1 | Default character set |
2669
+ * | 2 | Symbol character set |
2670
+ * | 77 | Mac character set (IANA name `macintosh`) |
2671
+ * | 128 | Shift JIS character set (IANA name `shift_jis`) |
2672
+ * | 129 | Hangul character set (IANA name `ks_c_5601-1987`) |
2673
+ * | 130 | Johab character set (IANA name `KS C-5601-1992`) |
2674
+ * | 134 | GB-2312 character set (IANA name `GBK`) |
2675
+ * | 136 | Chinese Big Five character set (IANA name `Big5`) |
2676
+ * | 161 | Greek character set (IANA name `windows-1253`) |
2677
+ * | 162 | Turkish character set (IANA name `iso-8859-9`) |
2678
+ * | 163 | Vietnamese character set (IANA name `windows-1258`) |
2679
+ * | 177 | Hebrew character set (IANA name `windows-1255`) |
2680
+ * | 178 | Arabic character set (IANA name `windows-1256`) |
2681
+ * | 186 | Baltic character set (IANA name `windows-1257`) |
2682
+ * | 204 | Russian character set (IANA name `windows-1251`) |
2683
+ * | 222 | Thai character set (IANA name `windows-874`) |
2684
+ * | 238 | Eastern European character set (IANA name `windows-1250`) |
2685
+ * | 255 | Specifies an OEM character set not defined by ISO/IEC 29500 |
2686
+ * | Any other value | Application-defined, can be ignored |
2687
+ */
2688
+ charset?: number;
2689
+ /**
2690
+ * Specifies the font pitch.
2691
+ *
2692
+ * | Value | Description |
2693
+ * |------:|-----------------------------------------|
2694
+ * | 0 | Default pitch + unknown font family |
2695
+ * | 1 | Fixed pitch + unknown font family |
2696
+ * | 2 | Variable pitch + unknown font family |
2697
+ * | 16 | Default pitch + roman font family |
2698
+ * | 17 | Fixed pitch + roman font family |
2699
+ * | 18 | Variable pitch + roman font family |
2700
+ * | 32 | Default pitch + Swiss font family |
2701
+ * | 33 | Fixed pitch + Swiss font family |
2702
+ * | 34 | Variable pitch + Swiss font family |
2703
+ * | 48 | Default pitch + modern font family |
2704
+ * | 49 | Fixed pitch + modern font family |
2705
+ * | 50 | Variable pitch + modern font family |
2706
+ * | 64 | Default pitch + script font family |
2707
+ * | 65 | Fixed pitch + script font family |
2708
+ * | 66 | Variable pitch + script font family |
2709
+ * | 80 | Default pitch + decorative font family |
2710
+ * | 81 | Fixed pitch + decorative font family |
2711
+ * | 82 | Variable pitch + decorative font family |
2712
+ */
2713
+ pitchFamily?: number;
2714
+ };
2715
+
2716
+ /**
2717
+ * A font collection from the theme.
2718
+ *
2719
+ * A font collection consists of a font definition for Latin, East Asian, and complex script. On top
2720
+ * of these, a font collection can also define a font for use in a specific language or languages.
2721
+ *
2722
+ * @group Themes
2723
+ */
2724
+ type ThemeFontCollection = {
2725
+ /** Latin script defaults. */
2726
+ latin: ThemeTextFont;
2727
+ /** East Asian script defaults. */
2728
+ eastAsian?: ThemeTextFont;
2729
+ /** Complex script defaults. */
2730
+ complexScript?: ThemeTextFont;
2731
+ /**
2732
+ * Additional fonts used for language-specific fonts in themes. For example, one can specify a
2733
+ * font that gets used only within the Japanese language context.
2734
+ */
2735
+ supplemental?: ThemeSupplementalFont[];
2736
+ };
2737
+
2738
+ /**
2739
+ * Theme font pair (major and minor font).
2740
+ *
2741
+ * @group Themes
2742
+ */
2743
+ type ThemeFontScheme = {
2744
+ /** Name of the font scheme. */
2745
+ name: string;
2746
+ /** Major theme font. */
2747
+ major: ThemeFontCollection;
2748
+ /** Minor theme font. */
2749
+ minor: ThemeFontCollection;
2750
+ };
2751
+
2752
+ /**
2753
+ * Workbook theme.
2754
+ *
2755
+ * This covers colours and fonts, but does not include fill styles, background fill styles, line
2756
+ * styles, and effect styles. This is left for a future date.
2757
+ *
2758
+ * @group Themes
2759
+ */
2760
+ type Theme = {
2761
+ /**
2762
+ * Theme name.
2763
+ *
2764
+ * @default ""
2765
+ */
2766
+ name?: string;
2767
+ /** Theme colour palette. */
2768
+ colorScheme: ThemeColorScheme;
2769
+ /** Theme major/minor font choice. */
2770
+ fontScheme: ThemeFontScheme;
2771
+ /**
2772
+ * Custom colour palettes.
2773
+ */
2774
+ customColors?: ThemeCustomColor[];
2775
+ };
2776
+
2037
2777
  /**
2038
2778
  * The axis a pivot field can be placed on.
2039
2779
  *
@@ -3741,6 +4481,8 @@ type WorksheetView = {
3741
4481
  * layout has its own scale.
3742
4482
  */
3743
4483
  layoutScales?: WorksheetLayoutScales;
4484
+ /** Indicates whether a hairline-grid should be drawn when displaying the worksheet. */
4485
+ showGridLines?: boolean;
3744
4486
  };
3745
4487
 
3746
4488
  /**
@@ -3773,12 +4515,10 @@ type Worksheet = {
3773
4515
  * @see {@link https://exceloffthegrid.com/make-excel-sheets-very-hidden/}
3774
4516
  */
3775
4517
  hidden?: 0 | 1 | 2;
3776
- /** Indicates whether a hairline-grid should be drawn when displaying the sheet. */
3777
- showGridLines?: boolean;
3778
4518
  /** The different display configurations saved for the worksheet. */
3779
4519
  views?: WorksheetView[];
3780
4520
  /** A list of drawings that appear in this worksheet. */
3781
- drawing?: Drawing[];
4521
+ drawings?: Drawing[];
3782
4522
  };
3783
4523
 
3784
4524
  /**
@@ -3867,6 +4607,54 @@ type Workbook = {
3867
4607
  * @see {@link https://www.rfc-editor.org/rfc/rfc2397}
3868
4608
  */
3869
4609
  images?: Record<string, string>;
4610
+ /**
4611
+ * The workbook theme. Specifies the colour scheme and fonts referenced throughout the workbook in
4612
+ * order to create a consistent visual presentation.
4613
+ */
4614
+ theme?: Theme;
4615
+ /**
4616
+ * Optional metadata about this workbook.
4617
+ *
4618
+ * @example
4619
+ * An XLSX file with metadata explicitly marking it as saved by Excel for Macintosh might have
4620
+ * `meta: { app: { name: 'Microsoft Excel', version: '16.0300', variant: 'Macintosh' } }`.
4621
+ *
4622
+ * @example
4623
+ * An XLSX file lacking app metadata but recognized heuristically as being a Google Sheets
4624
+ * export might have `meta: { app: { name: 'Google Sheets', confidence: 0.8 } }`.
4625
+ */
4626
+ meta?: {
4627
+ /**
4628
+ * Information about the application that originated this workbook. Converters should
4629
+ * populate this from file metadata and/or by heuristic detection (in which case they should
4630
+ * set `confidence` to a value less than `1`).
4631
+ */
4632
+ app?: {
4633
+ /**
4634
+ * The plain application name, without platform qualifiers or version suffixes
4635
+ * (e.g. `"Microsoft Excel"`, `"LibreOffice Calc"`).
4636
+ */
4637
+ name?: string;
4638
+ /**
4639
+ * The application version string, if known (e.g. `"16.0300"`).
4640
+ */
4641
+ version?: string;
4642
+ /**
4643
+ * Operating system or other variant of the application (e.g. `"Macintosh"`). Present when
4644
+ * the application name in the source file includes a platform qualifier that was separated
4645
+ * out from {@link name}.
4646
+ */
4647
+ variant?: string;
4648
+ /**
4649
+ * How confident the converter is in the identification. A value of `1` means the app
4650
+ * information came directly from the metadata in the source file. Values less than `1`
4651
+ * indicate heuristic detection, with lower values representing less certainty.
4652
+ *
4653
+ * @defaultValue 1
4654
+ */
4655
+ confidence?: number;
4656
+ };
4657
+ };
3870
4658
  };
3871
4659
 
3872
- export type { AdjustCoordinate, AdjustPoint, AdjustValueHandlePolar, AdjustValueHandleXY, ArcToCommand, BlackWhiteMode, BlipFill, BorderStyle, CalcProps, Cell, CellId, CellOffset, CellRange, CellValueType, CloseCommand, Color, Comment, ConnectionPoint, CubicBezierToCommand, DashStop, DataTable, DefinedName, DmlAngle, Drawing, EmuValue, Extent, External, ExternalWorksheet, Fill, FillPatternStyle, FlipAxis, FontStyleIndex, GeomGuideName, GradientColorStop, GradientLinearFill, GradientPathFill, Graphic, GraphicAnchor, GraphicAnchorAbsolute, GraphicAnchorOneCell, GraphicAnchorTwoCell, GraphicBitmap, GraphicChart, GraphicConnectionShape, GraphicGroup, GraphicShape, GridSize, GroupFill, GuidePoint, HAlign, HyperlinkTextRun, InsetRect, Line, LineAlignment, LineCapType, LineCompoundType, LineEnd, LineEndSize, LineEndType, LineJoinType, LineStyle, LineToCommand, MentionTextRun, MoveToCommand, NoFill, Note, Paragraph, Path, PathCommand, PathFillMode, PathFillType, PatternFill, PatternStyle, Percentage, Person, PivotArea, PivotAreaAxis, PivotAreaReference, PivotAreaType, PivotAutoFilterColumn, PivotCache, PivotCacheBase, PivotCacheConsolidation, PivotCacheConsolidationRangeSet, PivotCacheConsolidationSource, PivotCacheExternal, PivotCacheField, PivotCacheFieldGroup, PivotCacheRangePr, PivotCacheRecord, PivotCacheRecordValue, PivotCacheScenario, PivotCacheSharedItem, PivotCacheSharedItemBool, PivotCacheSharedItemDate, PivotCacheSharedItemErr, PivotCacheSharedItemNil, PivotCacheSharedItemNum, PivotCacheSharedItemStr, PivotCacheSharedItemsMeta, PivotCacheWorksheet, PivotCacheWorksheetSource, PivotCacheWorksheetSourceName, PivotCacheWorksheetSourceRange, PivotCalculatedField, PivotCustomFilterCriterion, PivotCustomFilterOperator, PivotDataField, PivotDataFieldAggregation, PivotField, PivotFieldAxis, PivotFieldItem, PivotFilter, PivotFilterType, PivotGroupBy, PivotItemType, PivotPageField, PivotRowColItem, PivotShowDataAs, PivotSubtotalFunction, PivotTable, PivotTableLocation, PivotTableStyle, PivotTableStyleName, PixelValue, Point, PositiveCoordinate, QuadraticBezierToCommand, RectAlignment, RelativeRect, Shape, ShapeRect, ShapeStyle, SolidFill, Style, Table, TableColumn, TableColumnDataType, TableStyle, TableStyleName, TextAnchoring, TextBody, TextHorzOverflow, TextRun, TextVertOverflow, TextVerticalType, TextWrapping, ThreadedComment, Tile, Underline, VAlign, Workbook, WorkbookView, Worksheet, WorksheetDefaults, WorksheetLayoutScales, WorksheetView, Xfrm, XfrmGroup, integer };
4660
+ export type { AdjustCoordinate, AdjustPoint, AdjustValueHandlePolar, AdjustValueHandleXY, ArcToCommand, AutoColor, BlackWhiteMode, BlipFill, BorderStyle, CalcProps, Cell, CellId, CellOffset, CellRange, CellValueType, CloseCommand, Color, ColorTransform, Comment, ConnectionPoint, CubicBezierToCommand, DashStop, DataTable, DefinedName, DmlAngle, Drawing, EmuValue, Extent, External, ExternalDefinedName, ExternalWorksheet, Fill, FillPatternStyle, FlipAxis, FontStyleIndex, GeomGuideName, GradientColorStop, GradientLinearFill, GradientPathFill, Graphic, GraphicAnchor, GraphicAnchorAbsolute, GraphicAnchorOneCell, GraphicAnchorTwoCell, GraphicBitmap, GraphicChart, GraphicConnectionShape, GraphicGroup, GraphicShape, GridSize, GroupFill, GuidePoint, HAlign, HslColor, HyperlinkTextRun, IndexedColor, InsetRect, Line, LineAlignment, LineCapType, LineCompoundType, LineEnd, LineEndSize, LineEndType, LineJoinType, LineStyle, LineToCommand, MentionTextRun, MoveToCommand, NoFill, Note, Paragraph, Path, PathCommand, PathFillMode, PathFillType, PatternFill, PatternStyle, Percentage, Person, PivotArea, PivotAreaAxis, PivotAreaReference, PivotAreaType, PivotAutoFilterColumn, PivotCache, PivotCacheBase, PivotCacheConsolidation, PivotCacheConsolidationRangeSet, PivotCacheConsolidationSource, PivotCacheExternal, PivotCacheField, PivotCacheFieldGroup, PivotCacheRangePr, PivotCacheRecord, PivotCacheRecordValue, PivotCacheScenario, PivotCacheSharedItem, PivotCacheSharedItemBool, PivotCacheSharedItemDate, PivotCacheSharedItemErr, PivotCacheSharedItemNil, PivotCacheSharedItemNum, PivotCacheSharedItemStr, PivotCacheSharedItemsMeta, PivotCacheWorksheet, PivotCacheWorksheetSource, PivotCacheWorksheetSourceName, PivotCacheWorksheetSourceRange, PivotCalculatedField, PivotCustomFilterCriterion, PivotCustomFilterOperator, PivotDataField, PivotDataFieldAggregation, PivotField, PivotFieldAxis, PivotFieldItem, PivotFilter, PivotFilterType, PivotGroupBy, PivotItemType, PivotPageField, PivotRowColItem, PivotShowDataAs, PivotSubtotalFunction, PivotTable, PivotTableLocation, PivotTableStyle, PivotTableStyleName, PixelValue, Point, PositiveCoordinate, PresetColor, QuadraticBezierToCommand, RectAlignment, RelativeRect, ScRgbColor, SchemeColor, Shape, ShapeRect, ShapeStyle, SolidFill, SrgbColor, Style, SystemColor, Table, TableColumn, TableColumnDataType, TableStyle, TableStyleName, TextAnchoring, TextBody, TextHorzOverflow, TextRun, TextVertOverflow, TextVerticalType, TextWrapping, Theme, ThemeColorScheme, ThemeCustomColor, ThemeFontCollection, ThemeFontScheme, ThemeSupplementalFont, ThemeTextFont, ThreadedComment, Tile, Underline, VAlign, Workbook, WorkbookView, Worksheet, WorksheetDefaults, WorksheetLayoutScales, WorksheetView, Xfrm, XfrmGroup, integer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsfkit/types",
3
- "version": "1.5.0",
3
+ "version": "2.0.0-rc1",
4
4
  "description": "TypeScript types for JSF: a JSON spreadsheet representation",
5
5
  "license": "MIT",
6
6
  "type": "module",