@a3s-lab/office 0.37.5 → 0.38.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.
@@ -0,0 +1,53 @@
1
+ import { type WorkDocumentOpenTypeFeaturePatch, type WorkDocumentOpenTypeFeatures, type WorkDocumentOpenTypeLigatures, type WorkDocumentOpenTypeNumberForm, type WorkDocumentOpenTypeNumberSpacing } from '../work-document-opentype';
2
+ interface DocumentFontDialogOpenTypeValue<T> {
3
+ mixed: boolean;
4
+ value: T | null;
5
+ }
6
+ export interface DocumentFontDialogOpenTypeSource {
7
+ openTypeLigatures: DocumentFontDialogOpenTypeValue<WorkDocumentOpenTypeLigatures>;
8
+ openTypeNumberForm: DocumentFontDialogOpenTypeValue<WorkDocumentOpenTypeNumberForm>;
9
+ openTypeNumberSpacing: DocumentFontDialogOpenTypeValue<WorkDocumentOpenTypeNumberSpacing>;
10
+ openTypeStylisticSets: DocumentFontDialogOpenTypeValue<readonly number[]>;
11
+ openTypeContextualAlternates: DocumentFontDialogOpenTypeValue<boolean>;
12
+ }
13
+ export type DocumentOpenTypeLigaturesMode = 'inherit' | 'mixed' | WorkDocumentOpenTypeLigatures;
14
+ export type DocumentOpenTypeNumberFormMode = 'inherit' | 'mixed' | WorkDocumentOpenTypeNumberForm;
15
+ export type DocumentOpenTypeNumberSpacingMode = 'inherit' | 'mixed' | WorkDocumentOpenTypeNumberSpacing;
16
+ export type DocumentOpenTypeStylisticSetsMode = 'inherit' | 'mixed' | 'multiple' | 'none' | `set-${number}`;
17
+ export type DocumentOpenTypeContextualAlternatesMode = 'disabled' | 'enabled' | 'inherit' | 'mixed';
18
+ export interface DocumentFontDialogOpenTypeDraft {
19
+ openTypeLigatures: DocumentOpenTypeLigaturesMode;
20
+ openTypeNumberForm: DocumentOpenTypeNumberFormMode;
21
+ openTypeNumberSpacing: DocumentOpenTypeNumberSpacingMode;
22
+ openTypeStylisticSets: DocumentOpenTypeStylisticSetsMode;
23
+ openTypeContextualAlternates: DocumentOpenTypeContextualAlternatesMode;
24
+ }
25
+ export interface DocumentFontDialogOpenTypePatch {
26
+ openTypeLigatures?: WorkDocumentOpenTypeLigatures | null;
27
+ openTypeNumberForm?: WorkDocumentOpenTypeNumberForm | null;
28
+ openTypeNumberSpacing?: WorkDocumentOpenTypeNumberSpacing | null;
29
+ openTypeStylisticSets?: readonly number[] | null;
30
+ openTypeContextualAlternates?: boolean | null;
31
+ }
32
+ export interface DocumentFontDialogOpenTypeTouched {
33
+ openTypeLigatures: boolean;
34
+ openTypeNumberForm: boolean;
35
+ openTypeNumberSpacing: boolean;
36
+ openTypeStylisticSets: boolean;
37
+ openTypeContextualAlternates: boolean;
38
+ }
39
+ export interface DocumentFontDialogOpenTypeValueMaps {
40
+ ligatures: Map<string, WorkDocumentOpenTypeLigatures | null>;
41
+ numberForm: Map<string, WorkDocumentOpenTypeNumberForm | null>;
42
+ numberSpacing: Map<string, WorkDocumentOpenTypeNumberSpacing | null>;
43
+ stylisticSets: Map<string, readonly number[] | null>;
44
+ contextualAlternates: Map<string, boolean | null>;
45
+ }
46
+ export declare function createDocumentFontDialogOpenTypeValueMaps(): DocumentFontDialogOpenTypeValueMaps;
47
+ export declare function addDocumentFontDialogOpenTypeValues(values: DocumentFontDialogOpenTypeValueMaps, serialized: unknown): void;
48
+ export declare function selectedDocumentFontDialogOpenTypeSource(values: DocumentFontDialogOpenTypeValueMaps): DocumentFontDialogOpenTypeSource;
49
+ export declare function createDocumentFontDialogOpenTypeDraft(source: DocumentFontDialogOpenTypeSource): DocumentFontDialogOpenTypeDraft;
50
+ export declare function appendDocumentFontDialogOpenTypePatch(patch: DocumentFontDialogOpenTypePatch, source: DocumentFontDialogOpenTypeSource, draft: DocumentFontDialogOpenTypeDraft, touched: DocumentFontDialogOpenTypeTouched): void;
51
+ export declare function documentFontDialogOpenTypeFeaturePatch(patch: DocumentFontDialogOpenTypePatch): WorkDocumentOpenTypeFeaturePatch;
52
+ export declare function documentFontDialogOpenTypePreviewFeatures(source: DocumentFontDialogOpenTypeSource, draft: DocumentFontDialogOpenTypeDraft): WorkDocumentOpenTypeFeatures | null;
53
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { Editor } from '@tiptap/core';
2
2
  import { type WorkDocumentScriptFontPatch } from '../work-document-script-fonts';
3
+ import { type WorkDocumentOpenTypeFeaturePatch } from '../work-document-opentype';
3
4
  export interface DocumentFontFamilySource {
4
5
  mixed: boolean;
5
6
  value: string | null;
@@ -16,3 +17,7 @@ export declare function applyDocumentScriptFontPatch(editor: Editor, selection:
16
17
  from: number;
17
18
  to: number;
18
19
  }, scalarPatch: Readonly<Record<string, boolean | number | string | null>>, scriptFontPatch: WorkDocumentScriptFontPatch): boolean;
20
+ export declare function applyDocumentTextStylePatch(editor: Editor, selection: {
21
+ from: number;
22
+ to: number;
23
+ }, scalarPatch: Readonly<Record<string, boolean | number | string | null>>, scriptFontPatch: WorkDocumentScriptFontPatch, openTypePatch: WorkDocumentOpenTypeFeaturePatch): boolean;
@@ -1,5 +1,6 @@
1
1
  import { Node } from '@tiptap/core';
2
2
  import { type WorkDocumentEmphasisMark } from './work-document-emphasis';
3
+ import { type WorkDocumentOpenTypeLigatures, type WorkDocumentOpenTypeNumberForm, type WorkDocumentOpenTypeNumberSpacing } from './work-document-opentype';
3
4
  export type WorkDocumentEquationDisplay = 'inline' | 'block';
4
5
  export type WorkDocumentEquationJustification = 'left' | 'right' | 'center' | 'centerGroup';
5
6
  export type WorkDocumentEquationBarPosition = 'top' | 'bottom';
@@ -159,9 +160,9 @@ export interface WorkDocumentEquationWordProperties3D {
159
160
  extrusionColor?: WorkDocumentEquationWordEffectColor;
160
161
  contourColor?: WorkDocumentEquationWordEffectColor;
161
162
  }
162
- export type WorkDocumentEquationWordLigatures = 'none' | 'standard' | 'contextual' | 'historical' | 'discretional' | 'standardContextual' | 'standardHistorical' | 'contextualHistorical' | 'standardDiscretional' | 'contextualDiscretional' | 'historicalDiscretional' | 'standardContextualHistorical' | 'standardContextualDiscretional' | 'standardHistoricalDiscretional' | 'contextualHistoricalDiscretional' | 'all';
163
- export type WorkDocumentEquationWordNumberForm = 'default' | 'lining' | 'oldStyle';
164
- export type WorkDocumentEquationWordNumberSpacing = 'default' | 'proportional' | 'tabular';
163
+ export type WorkDocumentEquationWordLigatures = WorkDocumentOpenTypeLigatures;
164
+ export type WorkDocumentEquationWordNumberForm = WorkDocumentOpenTypeNumberForm;
165
+ export type WorkDocumentEquationWordNumberSpacing = WorkDocumentOpenTypeNumberSpacing;
165
166
  export interface WorkDocumentEquationWordLineDash {
166
167
  preset?: WorkDocumentEquationWordPresetLineDash;
167
168
  }
@@ -7,6 +7,7 @@ import { type WorkDocumentStrikeFormatting } from './work-document-strike';
7
7
  import { type WorkDocumentScriptFontSlot, type WorkDocumentScriptFonts } from './work-document-script-fonts';
8
8
  import { type WorkDocumentHighlight } from './work-document-highlight';
9
9
  import { type WorkDocumentProofingLanguages } from './work-document-proofing';
10
+ import { type WorkDocumentOpenTypeFeatures } from './work-document-opentype';
10
11
  export declare const DOCUMENT_CHARACTER_FORMAT_MARKS: readonly ["bold", "italic", "underline", "strike", "subscript", "superscript", "textStyle", "highlight"];
11
12
  export type DocumentCharacterFormatMarkName = (typeof DOCUMENT_CHARACTER_FORMAT_MARKS)[number];
12
13
  export interface DocumentCharacterFormatMark {
@@ -50,4 +51,5 @@ export declare function importedDocumentCharacterFormatting(formatting: {
50
51
  themeFill?: string;
51
52
  highlight?: WorkDocumentHighlight;
52
53
  textCase?: WorkDocumentTextCase;
54
+ openTypeFeatures?: WorkDocumentOpenTypeFeatures;
53
55
  }): string;
@@ -0,0 +1,39 @@
1
+ export declare const DOCUMENT_OPEN_TYPE_ATTRIBUTE = "data-office-opentype-features";
2
+ export declare const DOCUMENT_OPEN_TYPE_LIGATURES: readonly ["none", "standard", "contextual", "historical", "discretional", "standardContextual", "standardHistorical", "contextualHistorical", "standardDiscretional", "contextualDiscretional", "historicalDiscretional", "standardContextualHistorical", "standardContextualDiscretional", "standardHistoricalDiscretional", "contextualHistoricalDiscretional", "all"];
3
+ export type WorkDocumentOpenTypeLigatures = (typeof DOCUMENT_OPEN_TYPE_LIGATURES)[number];
4
+ export declare const DOCUMENT_OPEN_TYPE_NUMBER_FORMS: readonly ["default", "lining", "oldStyle"];
5
+ export type WorkDocumentOpenTypeNumberForm = (typeof DOCUMENT_OPEN_TYPE_NUMBER_FORMS)[number];
6
+ export declare const DOCUMENT_OPEN_TYPE_NUMBER_SPACINGS: readonly ["default", "proportional", "tabular"];
7
+ export type WorkDocumentOpenTypeNumberSpacing = (typeof DOCUMENT_OPEN_TYPE_NUMBER_SPACINGS)[number];
8
+ export interface WorkDocumentOpenTypeFeatures {
9
+ ligatures?: WorkDocumentOpenTypeLigatures;
10
+ numberForm?: WorkDocumentOpenTypeNumberForm;
11
+ numberSpacing?: WorkDocumentOpenTypeNumberSpacing;
12
+ stylisticSets?: number[];
13
+ contextualAlternates?: boolean;
14
+ }
15
+ export interface WorkDocumentOpenTypeFeaturePatch {
16
+ ligatures?: WorkDocumentOpenTypeLigatures | null;
17
+ numberForm?: WorkDocumentOpenTypeNumberForm | null;
18
+ numberSpacing?: WorkDocumentOpenTypeNumberSpacing | null;
19
+ stylisticSets?: readonly number[] | null;
20
+ contextualAlternates?: boolean | null;
21
+ }
22
+ export interface WorkDocumentOpenTypeCssProperties {
23
+ fontFeatureSettings?: string;
24
+ fontVariantLigatures?: string;
25
+ fontVariantNumeric?: string;
26
+ }
27
+ export declare function normalizeDocumentOpenTypeLigatures(value: unknown): WorkDocumentOpenTypeLigatures | null;
28
+ export declare function normalizeDocumentOpenTypeNumberForm(value: unknown): WorkDocumentOpenTypeNumberForm | null;
29
+ export declare function normalizeDocumentOpenTypeNumberSpacing(value: unknown): WorkDocumentOpenTypeNumberSpacing | null;
30
+ export declare function normalizeDocumentOpenTypeStylisticSets(value: unknown): number[] | null;
31
+ export declare function normalizeDocumentOpenTypeFeatures(value: unknown): WorkDocumentOpenTypeFeatures | null;
32
+ export declare function serializeDocumentOpenTypeFeatures(value: unknown): string | null;
33
+ export declare function parseDocumentOpenTypeFeatures(value: unknown): WorkDocumentOpenTypeFeatures | null;
34
+ export declare function documentOpenTypeFeaturesFromElement(element: HTMLElement): WorkDocumentOpenTypeFeatures | null;
35
+ export declare function documentOpenTypeDomAttributes(value: unknown): Record<string, string>;
36
+ export declare function documentOpenTypeCss(value: unknown): string;
37
+ export declare function documentOpenTypeCssProperties(value: unknown): WorkDocumentOpenTypeCssProperties;
38
+ export declare function isDocumentOpenTypeFeaturePatch(value: unknown): value is WorkDocumentOpenTypeFeaturePatch;
39
+ export declare function patchDocumentOpenTypeFeatures(source: unknown, patch: WorkDocumentOpenTypeFeaturePatch): WorkDocumentOpenTypeFeatures | null;
@@ -17,6 +17,7 @@ declare module '@tiptap/extension-text-style' {
17
17
  runShading?: string | null;
18
18
  proofingLanguages?: string | null;
19
19
  noProof?: boolean | null;
20
+ openTypeFeatures?: string | null;
20
21
  kerningThresholdHalfPoints?: number | null;
21
22
  scriptFonts?: string | null;
22
23
  scriptFontSlot?: WorkDocumentScriptFontSlot | null;
@@ -0,0 +1,3 @@
1
+ import { type OoxmlPackage } from './work-ooxml-package';
2
+ import type { WorkCompatibilityIssue } from './work-types';
3
+ export declare function diagnoseDocxOpenTypeTypography(archive: OoxmlPackage, document: Document): Promise<WorkCompatibilityIssue[]>;
@@ -0,0 +1,19 @@
1
+ import { type WorkDocumentOpenTypeFeatures } from './work-document-opentype';
2
+ export interface DocxOpenTypePatch {
3
+ marker: string;
4
+ style?: string;
5
+ features: WorkDocumentOpenTypeFeatures;
6
+ }
7
+ export declare class DocxOpenTypePatchCollector {
8
+ readonly patches: DocxOpenTypePatch[];
9
+ private nextMarker;
10
+ private readonly occupied;
11
+ private readonly patchesByMarker;
12
+ private readonly markersByFeaturesAndStyle;
13
+ constructor(source: string);
14
+ marker(value: unknown, inheritedStyle?: string): string;
15
+ lookup(marker: string | undefined): DocxOpenTypePatch | undefined;
16
+ private originalStyle;
17
+ }
18
+ export declare function patchDocxOpenTypeFeatures(buffer: ArrayBuffer, patches: readonly DocxOpenTypePatch[]): Promise<ArrayBuffer>;
19
+ export declare function appendDocxOpenTypeProperties(document: Document, properties: Element, source: unknown): void;
@@ -0,0 +1,8 @@
1
+ import { type WorkDocumentOpenTypeFeatures } from './work-document-opentype';
2
+ export interface ResolvedDocxOpenTypeFeatures {
3
+ features: WorkDocumentOpenTypeFeatures | null;
4
+ invalidCount: number;
5
+ spoofedCount: number;
6
+ }
7
+ export declare const DOCX_WORD_2010_NAMESPACE = "http://schemas.microsoft.com/office/word/2010/wordml";
8
+ export declare function resolveDocxOpenTypeFeatures(propertySources: readonly Element[]): ResolvedDocxOpenTypeFeatures;
@@ -11,6 +11,7 @@ import { type DocumentRunBorder } from './work-document-run-border';
11
11
  import { type DocumentRunShading } from './work-document-run-shading';
12
12
  import { type WorkDocumentHighlight } from './work-document-highlight';
13
13
  import { type WorkDocumentProofingLanguages } from './work-document-proofing';
14
+ import { type WorkDocumentOpenTypeFeatures } from './work-document-opentype';
14
15
  export interface ImportedDocxRunFormatting {
15
16
  bold?: boolean;
16
17
  italic?: boolean;
@@ -44,6 +45,7 @@ export interface ImportedDocxRunFormatting {
44
45
  runShading?: DocumentRunShading;
45
46
  proofingLanguages?: WorkDocumentProofingLanguages;
46
47
  noProof?: boolean;
48
+ openTypeFeatures?: WorkDocumentOpenTypeFeatures;
47
49
  }
48
50
  export interface ImportedDocxRunFormattingMarker {
49
51
  startMarker: string;
Binary file
package/dist/styles.css CHANGED
@@ -9791,7 +9791,7 @@ button.work-office-collaboration-participant:hover .work-office-collaboration-lo
9791
9791
  display: grid;
9792
9792
  }
9793
9793
 
9794
- .work-document-font-dialog-run-border, .work-document-font-dialog-run-shading {
9794
+ .work-document-font-dialog-run-border, .work-document-font-dialog-run-shading, .work-document-font-dialog-opentype {
9795
9795
  border: 1px solid color-mix(in srgb, var(--a3s-line) 78%, transparent);
9796
9796
  background: var(--a3s-panel-soft);
9797
9797
  border-radius: 8px;
@@ -9808,7 +9808,11 @@ button.work-office-collaboration-participant:hover .work-office-collaboration-lo
9808
9808
  grid-template-columns: repeat(4, minmax(0, 1fr));
9809
9809
  }
9810
9810
 
9811
- .work-document-font-dialog-run-border > legend, .work-document-font-dialog-run-shading > legend {
9811
+ .work-document-font-dialog-opentype {
9812
+ grid-template-columns: repeat(3, minmax(0, 1fr));
9813
+ }
9814
+
9815
+ .work-document-font-dialog-run-border > legend, .work-document-font-dialog-run-shading > legend, .work-document-font-dialog-opentype > legend {
9812
9816
  color: var(--a3s-muted);
9813
9817
  padding: 0 4px;
9814
9818
  font-size: 11px;
@@ -9892,7 +9896,7 @@ button.work-office-collaboration-participant:hover .work-office-collaboration-lo
9892
9896
  grid-template-columns: repeat(2, minmax(0, 1fr));
9893
9897
  }
9894
9898
 
9895
- .work-document-font-dialog-run-border, .work-document-font-dialog-run-shading {
9899
+ .work-document-font-dialog-run-border, .work-document-font-dialog-run-shading, .work-document-font-dialog-opentype {
9896
9900
  grid-template-columns: minmax(0, 1fr);
9897
9901
  }
9898
9902
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a3s-lab/office",
3
- "version": "0.37.5",
3
+ "version": "0.38.1",
4
4
  "description": "Open-source collaborative browser editors for documents, Markdown, spreadsheets, presentations, and PDFs.",
5
5
  "keywords": [
6
6
  "office",
@@ -88,6 +88,7 @@
88
88
  "playground:typecheck": "tsc --noEmit -p playground/tsconfig.json",
89
89
  "playground:ime:webkit": "playwright test --config playwright.ime.config.ts",
90
90
  "playground:visual": "playwright test --config playwright.config.ts",
91
+ "playground:visual:docs-changelog": "playwright test visual-tests/docs-changelog.functional.spec.ts --config playwright.config.ts",
91
92
  "playground:visual:document-emphasis": "playwright test visual-tests/document-emphasis.functional.spec.ts --config playwright.config.ts",
92
93
  "playground:visual:document-index": "playwright test visual-tests/document-index.functional.spec.ts --config playwright.config.ts",
93
94
  "playground:visual:document-comparison": "playwright test visual-tests/document-comparison.functional.spec.ts --config playwright.config.ts",
@@ -101,6 +102,7 @@
101
102
  "playground:visual:document-character-position": "playwright test visual-tests/document-character-position.functional.spec.ts --config playwright.config.ts",
102
103
  "playground:visual:document-character-spacing": "playwright test visual-tests/document-character-spacing.functional.spec.ts --config playwright.config.ts",
103
104
  "playground:visual:document-script-fonts": "playwright test visual-tests/document-script-fonts.functional.spec.ts --config playwright.config.ts",
105
+ "playground:visual:document-opentype": "playwright test visual-tests/document-opentype.functional.spec.ts --config playwright.config.ts",
104
106
  "playground:visual:document-strike": "playwright test visual-tests/document-strike.functional.spec.ts --config playwright.config.ts",
105
107
  "playground:visual:spreadsheet-data-validation": "playwright test visual-tests/spreadsheet-data-validation.functional.spec.ts --config playwright.config.ts",
106
108
  "playground:visual:spreadsheet-date-time": "playwright test visual-tests/spreadsheet-date-time.functional.spec.ts --config playwright.config.ts",
@@ -267,6 +269,8 @@
267
269
  "test:e2e:writer-character-spacing:check": "a3s-test check tests/e2e/word-character-spacing.acl --json",
268
270
  "test:e2e:writer-script-fonts": "A3S_TEST_SUITE=tests/e2e/word-script-fonts.acl bash scripts/run-a3s-test-web-gate.sh",
269
271
  "test:e2e:writer-script-fonts:check": "a3s-test check tests/e2e/word-script-fonts.acl --json",
272
+ "test:e2e:writer-opentype": "A3S_TEST_SUITE=tests/e2e/word-opentype-typography.acl bash scripts/run-a3s-test-web-gate.sh",
273
+ "test:e2e:writer-opentype:check": "a3s-test check tests/e2e/word-opentype-typography.acl --json",
270
274
  "test:e2e:writer-strike": "A3S_TEST_SUITE=tests/e2e/word-strike-styles.acl bash scripts/run-a3s-test-web-gate.sh",
271
275
  "test:e2e:writer-strike:check": "a3s-test check tests/e2e/word-strike-styles.acl --json",
272
276
  "test:e2e:writer-layout": "a3s-test run tests/e2e/word-insert-page-layout.acl --json",