Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apps/cli/scripts/export-sdk-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ const INTENT_NAMES = {
'doc.lists.canContinuePrevious': 'can_continue_previous_list',
'doc.lists.setLevelRestart': 'set_list_level_restart',
'doc.lists.convertToText': 'convert_list_to_text',
'doc.lists.applyTemplate': 'apply_list_template',
'doc.lists.applyPreset': 'apply_list_preset',
'doc.lists.captureTemplate': 'capture_list_template',
'doc.lists.setLevelNumbering': 'set_list_level_numbering',
'doc.lists.setLevelBullet': 'set_list_level_bullet',
'doc.lists.setLevelPictureBullet': 'set_list_level_picture_bullet',
'doc.lists.setLevelAlignment': 'set_list_level_alignment',
'doc.lists.setLevelIndents': 'set_list_level_indents',
'doc.lists.setLevelTrailingCharacter': 'set_list_level_trailing_character',
'doc.lists.setLevelMarkerFont': 'set_list_level_marker_font',
'doc.lists.clearLevelOverrides': 'clear_list_level_overrides',
'doc.comments.create': 'create_comment',
'doc.comments.patch': 'patch_comment',
'doc.comments.delete': 'delete_comment',
Expand Down
186 changes: 186 additions & 0 deletions apps/cli/src/__tests__/conformance/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,189 @@ export const SUCCESS_SCENARIOS = {
],
};
},
'doc.lists.applyTemplate': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-apply-template-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-apply-template');
const target = await harness.firstListItemAddress(docPath, stateDir);
const template = {
version: 1,
levels: [{ level: 0, numFmt: 'decimal', lvlText: '%1.' }],
};
return {
stateDir,
args: [
'lists',
'apply-template',
docPath,
'--input-json',
JSON.stringify({ target, template }),
'--out',
harness.createOutputPath('doc-lists-apply-template-output'),
],
};
},
'doc.lists.applyPreset': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-apply-preset-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-apply-preset');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'apply-preset',
docPath,
'--input-json',
JSON.stringify({ target, preset: 'decimal' }),
'--out',
harness.createOutputPath('doc-lists-apply-preset-output'),
],
};
},
'doc.lists.captureTemplate': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-capture-template-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-capture-template');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: ['lists', 'capture-template', docPath, '--input-json', JSON.stringify({ target })],
};
},
'doc.lists.setLevelNumbering': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-set-level-numbering-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-set-level-numbering');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'set-level-numbering',
docPath,
'--input-json',
JSON.stringify({ target, level: 0, numFmt: 'decimal', lvlText: '%1.' }),
'--out',
harness.createOutputPath('doc-lists-set-level-numbering-output'),
],
};
},
'doc.lists.setLevelBullet': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-set-level-bullet-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-set-level-bullet');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'set-level-bullet',
docPath,
'--input-json',
JSON.stringify({ target, level: 0, markerText: '\u2022' }),
'--out',
harness.createOutputPath('doc-lists-set-level-bullet-output'),
],
};
},
'doc.lists.setLevelPictureBullet': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-set-level-picture-bullet-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-set-level-picture-bullet');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'set-level-picture-bullet',
docPath,
'--input-json',
JSON.stringify({ target, level: 0, pictureBulletId: 0 }),
'--out',
harness.createOutputPath('doc-lists-set-level-picture-bullet-output'),
],
};
},
'doc.lists.setLevelAlignment': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-set-level-alignment-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-set-level-alignment');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'set-level-alignment',
docPath,
'--input-json',
JSON.stringify({ target, level: 0, alignment: 'center' }),
'--out',
harness.createOutputPath('doc-lists-set-level-alignment-output'),
],
};
},
'doc.lists.setLevelIndents': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-set-level-indents-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-set-level-indents');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'set-level-indents',
docPath,
'--input-json',
JSON.stringify({ target, level: 0, left: 1440, hanging: 720 }),
'--out',
harness.createOutputPath('doc-lists-set-level-indents-output'),
],
};
},
'doc.lists.setLevelTrailingCharacter': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-set-level-trailing-character-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-set-level-trailing-character');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'set-level-trailing-character',
docPath,
'--input-json',
JSON.stringify({ target, level: 0, trailingCharacter: 'tab' }),
'--out',
harness.createOutputPath('doc-lists-set-level-trailing-character-output'),
],
};
},
'doc.lists.setLevelMarkerFont': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-set-level-marker-font-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-set-level-marker-font');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'set-level-marker-font',
docPath,
'--input-json',
JSON.stringify({ target, level: 0, fontFamily: 'Arial' }),
'--out',
harness.createOutputPath('doc-lists-set-level-marker-font-output'),
],
};
},
'doc.lists.clearLevelOverrides': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-lists-clear-level-overrides-success');
const docPath = await harness.copyListFixtureDoc('doc-lists-clear-level-overrides');
const target = await harness.firstListItemAddress(docPath, stateDir);
return {
stateDir,
args: [
'lists',
'clear-level-overrides',
docPath,
'--input-json',
JSON.stringify({ target, level: 0 }),
'--out',
harness.createOutputPath('doc-lists-clear-level-overrides-output'),
],
};
},
'doc.insert': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
const stateDir = await harness.createStateDir('doc-insert-success');
const docPath = await harness.copyFixtureDoc('doc-insert');
Expand Down Expand Up @@ -2327,6 +2510,9 @@ const RUNTIME_CONFORMANCE_SKIP = new Set<CliOperationId>([
// which the CLI test harness fixture does not populate.
'doc.tables.setDefaultStyle',
'doc.tables.clearDefaultStyle',
// clearLevelOverrides requires an instance-level override to exist on the fixture list,
// which the generic list fixture does not have.
'doc.lists.clearLevelOverrides',
]);

export const OPERATION_SCENARIOS = (Object.keys(SUCCESS_SCENARIOS) as CliOperationId[]).map((operationId) => {
Expand Down
44 changes: 44 additions & 0 deletions apps/cli/src/cli/operation-hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ export const SUCCESS_VERB: Record<CliExposedOperationId, string> = {
'lists.continuePrevious': 'continued previous list',
'lists.canContinuePrevious': 'checked continue feasibility',
'lists.setLevelRestart': 'set level restart',
'lists.applyTemplate': 'applied list template',
'lists.applyPreset': 'applied list preset',
'lists.captureTemplate': 'captured list template',
'lists.setLevelNumbering': 'set level numbering',
'lists.setLevelBullet': 'set level bullet',
'lists.setLevelPictureBullet': 'set level picture bullet',
'lists.setLevelAlignment': 'set level alignment',
'lists.setLevelIndents': 'set level indents',
'lists.setLevelTrailingCharacter': 'set level trailing character',
'lists.setLevelMarkerFont': 'set level marker font',
'lists.clearLevelOverrides': 'cleared level overrides',
'lists.convertToText': 'converted list to text',
'comments.create': 'created comment',
'comments.patch': 'patched comment',
Expand Down Expand Up @@ -256,6 +267,17 @@ export const OUTPUT_FORMAT: Record<CliExposedOperationId, OutputFormat> = {
'lists.continuePrevious': 'listsMutationResult',
'lists.canContinuePrevious': 'plain',
'lists.setLevelRestart': 'listsMutationResult',
'lists.applyTemplate': 'listsMutationResult',
'lists.applyPreset': 'listsMutationResult',
'lists.captureTemplate': 'plain',
'lists.setLevelNumbering': 'listsMutationResult',
'lists.setLevelBullet': 'listsMutationResult',
'lists.setLevelPictureBullet': 'listsMutationResult',
'lists.setLevelAlignment': 'listsMutationResult',
'lists.setLevelIndents': 'listsMutationResult',
'lists.setLevelTrailingCharacter': 'listsMutationResult',
'lists.setLevelMarkerFont': 'listsMutationResult',
'lists.clearLevelOverrides': 'listsMutationResult',
'lists.convertToText': 'listsMutationResult',
'comments.create': 'commentReceipt',
'comments.patch': 'commentReceipt',
Expand Down Expand Up @@ -391,6 +413,17 @@ export const RESPONSE_ENVELOPE_KEY: Record<CliExposedOperationId, string | null>
'lists.continuePrevious': 'result',
'lists.canContinuePrevious': 'result',
'lists.setLevelRestart': 'result',
'lists.applyTemplate': 'result',
'lists.applyPreset': 'result',
'lists.captureTemplate': 'result',
'lists.setLevelNumbering': 'result',
'lists.setLevelBullet': 'result',
'lists.setLevelPictureBullet': 'result',
'lists.setLevelAlignment': 'result',
'lists.setLevelIndents': 'result',
'lists.setLevelTrailingCharacter': 'result',
'lists.setLevelMarkerFont': 'result',
'lists.clearLevelOverrides': 'result',
'lists.convertToText': 'result',
'comments.create': 'receipt',
'comments.patch': 'receipt',
Expand Down Expand Up @@ -555,6 +588,17 @@ export const OPERATION_FAMILY: Record<CliExposedOperationId, OperationFamily> =
'lists.continuePrevious': 'lists',
'lists.canContinuePrevious': 'lists',
'lists.setLevelRestart': 'lists',
'lists.applyTemplate': 'lists',
'lists.applyPreset': 'lists',
'lists.captureTemplate': 'lists',
'lists.setLevelNumbering': 'lists',
'lists.setLevelBullet': 'lists',
'lists.setLevelPictureBullet': 'lists',
'lists.setLevelAlignment': 'lists',
'lists.setLevelIndents': 'lists',
'lists.setLevelTrailingCharacter': 'lists',
'lists.setLevelMarkerFont': 'lists',
'lists.clearLevelOverrides': 'lists',
'lists.convertToText': 'lists',
'comments.create': 'comments',
'comments.patch': 'comments',
Expand Down
11 changes: 11 additions & 0 deletions apps/cli/src/cli/operation-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ const EXTRA_CLI_PARAMS: Partial<Record<string, CliOperationParamSpec[]>> = {
...LIST_TARGET_FLAT_PARAMS,
],
'doc.lists.setLevelRestart': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.applyTemplate': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.applyPreset': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.captureTemplate': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.setLevelNumbering': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.setLevelBullet': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.setLevelPictureBullet': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.setLevelAlignment': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.setLevelIndents': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.setLevelTrailingCharacter': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.setLevelMarkerFont': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.clearLevelOverrides': [{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' }],
'doc.lists.convertToText': [
{ name: 'input', kind: 'jsonFlag', flag: 'input-json', type: 'json' },
...LIST_TARGET_FLAT_PARAMS,
Expand Down
11 changes: 11 additions & 0 deletions apps/cli/src/lib/invoke-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ const WRAPPED_INPUT_KEY: Partial<Record<CliExposedOperationId, string>> = {
'lists.continuePrevious': 'input',
'lists.canContinuePrevious': 'input',
'lists.setLevelRestart': 'input',
'lists.applyTemplate': 'input',
'lists.applyPreset': 'input',
'lists.captureTemplate': 'input',
'lists.setLevelNumbering': 'input',
'lists.setLevelBullet': 'input',
'lists.setLevelPictureBullet': 'input',
'lists.setLevelAlignment': 'input',
'lists.setLevelIndents': 'input',
'lists.setLevelTrailingCharacter': 'input',
'lists.setLevelMarkerFont': 'input',
'lists.clearLevelOverrides': 'input',
'lists.convertToText': 'input',
'create.paragraph': 'input',
'create.heading': 'input',
Expand Down
14 changes: 13 additions & 1 deletion apps/docs/document-api/available-operations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Use the tables below to see what operations are available and where each one is
| Format | 44 | 1 | 45 | [Reference](/document-api/reference/format/index) |
| History | 3 | 0 | 3 | [Reference](/document-api/reference/history/index) |
| Images | 13 | 0 | 13 | [Reference](/document-api/reference/images/index) |
| Lists | 17 | 0 | 17 | [Reference](/document-api/reference/lists/index) |
| Lists | 28 | 1 | 29 | [Reference](/document-api/reference/lists/index) |
| Mutations | 2 | 0 | 2 | [Reference](/document-api/reference/mutations/index) |
| Paragraph Formatting | 17 | 0 | 17 | [Reference](/document-api/reference/format/paragraph/index) |
| Paragraph Styles | 2 | 0 | 2 | [Reference](/document-api/reference/styles/paragraph/index) |
Expand Down Expand Up @@ -136,6 +136,18 @@ Use the tables below to see what operations are available and where each one is
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.canContinuePrevious(...)</code></span> | [`lists.canContinuePrevious`](/document-api/reference/lists/can-continue-previous) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelRestart(...)</code></span> | [`lists.setLevelRestart`](/document-api/reference/lists/set-level-restart) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.convertToText(...)</code></span> | [`lists.convertToText`](/document-api/reference/lists/convert-to-text) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.applyTemplate(...)</code></span> | [`lists.applyTemplate`](/document-api/reference/lists/apply-template) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.applyPreset(...)</code></span> | [`lists.applyPreset`](/document-api/reference/lists/apply-preset) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.captureTemplate(...)</code></span> | [`lists.captureTemplate`](/document-api/reference/lists/capture-template) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelNumbering(...)</code></span> | [`lists.setLevelNumbering`](/document-api/reference/lists/set-level-numbering) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelBullet(...)</code></span> | [`lists.setLevelBullet`](/document-api/reference/lists/set-level-bullet) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelPictureBullet(...)</code></span> | [`lists.setLevelPictureBullet`](/document-api/reference/lists/set-level-picture-bullet) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelAlignment(...)</code></span> | [`lists.setLevelAlignment`](/document-api/reference/lists/set-level-alignment) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelIndents(...)</code></span> | [`lists.setLevelIndents`](/document-api/reference/lists/set-level-indents) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelTrailingCharacter(...)</code></span> | [`lists.setLevelTrailingCharacter`](/document-api/reference/lists/set-level-trailing-character) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setLevelMarkerFont(...)</code></span> | [`lists.setLevelMarkerFont`](/document-api/reference/lists/set-level-marker-font) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.clearLevelOverrides(...)</code></span> | [`lists.clearLevelOverrides`](/document-api/reference/lists/clear-level-overrides) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.lists.setType(...)</code></span> | [`lists.applyPreset`](/document-api/reference/lists/apply-preset) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.mutations.preview(...)</code></span> | [`mutations.preview`](/document-api/reference/mutations/preview) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.mutations.apply(...)</code></span> | [`mutations.apply`](/document-api/reference/mutations/apply) |
| <span style={{ whiteSpace: 'nowrap', wordBreak: 'normal', overflowWrap: 'normal' }}><code>editor.doc.format.paragraph.resetDirectFormatting(...)</code></span> | [`format.paragraph.resetDirectFormatting`](/document-api/reference/format/paragraph/reset-direct-formatting) |
Expand Down
Loading
Loading