Skip to content

Commit 0300529

Browse files
committed
Merge branch 'main' into nick/sd-2271-add-non-body-story-targeting-to-the-document-api
2 parents 4f4123a + 529c500 commit 0300529

288 files changed

Lines changed: 13773 additions & 1734 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ tests/visual/ Visual regression tests (Playwright + R2 baselines)
6767
| Visual regression tests | `tests/visual/` (see its CLAUDE.md) |
6868
| Document API contract | `packages/document-api/src/contract/operation-definitions.ts` |
6969
| Adding a doc-api operation | See `packages/document-api/README.md` § "Adding a new operation" |
70+
| Theming (`createTheme()`) | `packages/superdoc/src/core/theme/create-theme.js` |
71+
| CSS variable defaults | `packages/superdoc/src/assets/styles/helpers/variables.css` |
72+
| Preset themes | `packages/superdoc/src/assets/styles/helpers/themes.css` |
73+
| Consumer-facing agent guide | `packages/superdoc/AGENTS.md` (ships with npm package) |
7074

7175
## Style Resolution Boundary
7276

@@ -193,12 +197,15 @@ Pixel-level before/after comparison for documents that failed layout comparison.
193197

194198
## Brand & Design System
195199

196-
Brand guidelines, voice, and design tokens live in `brand/`. Token values are defined in `packages/superdoc/src/assets/styles/tokens.css`.
200+
Brand guidelines, voice, and design tokens live in `brand/`.
201+
Token contract source is `packages/superdoc/src/assets/styles/helpers/variables.css` (`:root` defaults).
202+
Preset theme overrides are defined in `packages/superdoc/src/assets/styles/helpers/themes.css`.
197203

198204
**When creating or modifying UI components:**
199-
- Use `--sd-*` CSS custom properties — never hardcode hex values. See `tokens.css` for all available variables.
200-
- Tokens follow three tiers: primitive (`--sd-color-blue-500`) → semantic (`--sd-action-primary`) → component (`--sd-comment-bg`). Components reference semantic or component-level variables.
201-
- Expose component-specific variables as `--sd-{component}-*` so consumers can customize via CSS.
202-
- Document component CSS variables in `apps/docs/ui-components/` (Mintlify docs).
205+
- Use `--sd-*` CSS custom properties — never hardcode hex values.
206+
- Treat `variables.css` as the canonical token contract; add new tokens there.
207+
- Keep preset themes in `themes.css` (`.sd-theme-*`) and override only the tokens that need theme-specific values.
208+
- Tokens are organized by layers: primitive (`--sd-color-blue-500`) → UI/document tokens (`--sd-ui-*`, `--sd-comments-*`, etc.) → component usage.
209+
- Expose UI component-specific variables as `--sd-ui-{component}-*` so consumers can customize via CSS.
203210

204211
**When writing copy or content:** see `brand/brand-guidelines.md` for voice, tone, and the dual-register pattern (developer vs. leader). Product name is always **SuperDoc** (capital S, capital D).

apps/cli/scripts/export-sdk-contract.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function buildSdkContract() {
9898
if (p.flag && p.flag !== p.name) spec.flag = p.flag;
9999
if (p.required) spec.required = true;
100100
if (p.schema) spec.schema = p.schema;
101+
if (p.description) spec.description = p.description;
101102
if (p.agentVisible === false) spec.agentVisible = false;
102103
return spec;
103104
}),

apps/cli/src/__tests__/conformance/scenarios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2955,7 +2955,7 @@ export const SUCCESS_SCENARIOS = {
29552955
'--destination-json',
29562956
JSON.stringify({ kind: 'documentEnd' }),
29572957
]),
2958-
'doc.tables.split': tableMutationScenario('tables.split', ['--at-row-index', '1']),
2958+
'doc.tables.split': tableMutationScenario('tables.split', ['--row-index', '1']),
29592959
'doc.tables.convertToText': tableMutationScenario('tables.convertToText', ['--delimiter', 'tab']),
29602960
'doc.tables.setLayout': tableMutationScenario('tables.setLayout', ['--alignment', 'center']),
29612961
'doc.tables.insertRow': tableMutationScenario('tables.insertRow', ['--row-index', '0', '--position', 'below']),

apps/cli/src/__tests__/lib/validate-type-spec.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ describe('validateValueAgainstTypeSpec – oneOf const enumeration', () => {
77
const schema: CliTypeSpec = {
88
oneOf: [
99
{ const: 'headerRow' },
10+
{ const: 'lastRow' },
1011
{ const: 'totalRow' },
1112
{ const: 'firstColumn' },
1213
{ const: 'lastColumn' },
@@ -20,16 +21,24 @@ describe('validateValueAgainstTypeSpec – oneOf const enumeration', () => {
2021
expect(() => validateValueAgainstTypeSpec('bandedColumns', schema, 'flag')).not.toThrow();
2122
});
2223

24+
test('accepts lastRow as a valid flag', () => {
25+
expect(() => validateValueAgainstTypeSpec('lastRow', schema, 'flag')).not.toThrow();
26+
});
27+
28+
test('accepts totalRow as a deprecated alias', () => {
29+
expect(() => validateValueAgainstTypeSpec('totalRow', schema, 'flag')).not.toThrow();
30+
});
31+
2332
test('rejects an invalid value and lists all allowed values', () => {
2433
try {
25-
validateValueAgainstTypeSpec('lastRow', schema, 'tables set-style-option:flag');
34+
validateValueAgainstTypeSpec('bogusFlag', schema, 'tables set-style-option:flag');
2635
throw new Error('Expected CliError to be thrown');
2736
} catch (error) {
2837
expect(error).toBeInstanceOf(CliError);
2938
const cliError = error as CliError;
3039
expect(cliError.code).toBe('VALIDATION_ERROR');
3140
expect(cliError.message).toBe(
32-
'tables set-style-option:flag must be one of: headerRow, totalRow, firstColumn, lastColumn, bandedRows, bandedColumns.',
41+
'tables set-style-option:flag must be one of: headerRow, lastRow, totalRow, firstColumn, lastColumn, bandedRows, bandedColumns.',
3342
);
3443
}
3544
});
@@ -41,7 +50,7 @@ describe('validateValueAgainstTypeSpec – oneOf const enumeration', () => {
4150
} catch (error) {
4251
const cliError = error as CliError;
4352
const details = cliError.details as { errors: string[] };
44-
expect(details.errors).toBeArrayOfSize(6);
53+
expect(details.errors).toBeArrayOfSize(7);
4554
}
4655
});
4756
});

0 commit comments

Comments
 (0)