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
2 changes: 2 additions & 0 deletions packages/superdoc/scripts/audit-declarations.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ const RELOCATION_GUARD_PACKAGES = [
'@superdoc/contracts',
'@superdoc/dom-contract',
'@superdoc/layout-bridge',
'@superdoc/layout-engine',
'@superdoc/painter-dom',
'@superdoc/pm-adapter',
'@superdoc/common/list-marker-utils',
];

// Specifiers that may appear as bare imports in published d.ts files even
Expand Down
47 changes: 47 additions & 0 deletions packages/superdoc/scripts/ensure-types.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,41 @@ if (handwrittenCopiedSuperEditor > 0) {
console.log(`[ensure-types] ✓ Copied ${handwrittenCopiedSuperEditor} hand-written .d.ts files from super-editor/src`);
}

// SD-2893: emit declarations for the shared/common subpaths reachable from the
// public surface. Adding shared/ to vite-plugin-dts's `include` would shift the
// common-ancestor of all source files to the repo root and reorganise the
// entire dist tree, so we run tsc directly for just the files we relocate.
// Today: list-marker-utils plus its sibling layout-constants. Add new entries
// here in lockstep with `RELOCATION_RULES` below.
const SHARED_COMMON_DTS_TARGETS = ['list-marker-utils.ts', 'layout-constants.ts'];
{
const { spawnSync: _spawnSync } = require('node:child_process');
const tscBin = path.join(repoRoot, 'node_modules', '.bin', 'tsc');
const sharedCommonDistDir = path.join(distRoot, 'shared/common');
fs.mkdirSync(sharedCommonDistDir, { recursive: true });
const sources = SHARED_COMMON_DTS_TARGETS.map((f) => path.join(repoRoot, 'shared/common', f));
const tscResult = _spawnSync(
tscBin,
[
'--declaration',
'--emitDeclarationOnly',
'--skipLibCheck',
'--target', 'ES2022',
'--module', 'ESNext',
'--moduleResolution', 'bundler',
'--outDir', sharedCommonDistDir,
'--rootDir', path.join(repoRoot, 'shared/common'),
...sources,
],
{ stdio: 'inherit' },
);
if (tscResult.status !== 0) {
console.error('[ensure-types] tsc failed emitting shared/common declarations');
process.exit(1);
}
console.log(`[ensure-types] ✓ Emitted ${SHARED_COMMON_DTS_TARGETS.length} shared/common declarations`);
}

const requiredEntryPoints = [
'superdoc/src/index.d.ts',
'superdoc/src/super-editor.d.ts',
Expand Down Expand Up @@ -219,6 +254,7 @@ const RELOCATION_RULES = [
{ pkg: '@superdoc/contracts', distEntry: 'layout-engine/contracts/src/index.d.ts', matchSubpaths: true },
{ pkg: '@superdoc/dom-contract', distEntry: 'layout-engine/dom-contract/src/index.d.ts', matchSubpaths: true },
{ pkg: '@superdoc/layout-bridge', distEntry: 'layout-engine/layout-bridge/src/index.d.ts', matchSubpaths: true },
{ pkg: '@superdoc/layout-engine', distEntry: 'layout-engine/layout-engine/src/index.d.ts', matchSubpaths: true },
{ pkg: '@superdoc/painter-dom', distEntry: 'layout-engine/painters/dom/src/index.d.ts', matchSubpaths: true },
{
pkg: '@superdoc/pm-adapter/converter-context.js',
Expand All @@ -230,6 +266,15 @@ const RELOCATION_RULES = [
distEntry: 'layout-engine/pm-adapter/src/sections/types.d.ts',
matchSubpaths: false,
},
// SD-2893: list-marker-utils is the only @superdoc/common subpath publicly
// reachable today (via painter-dom). Relocate just this file so the bare
// @superdoc/common shim does not capture it; the parent @superdoc/common
// package and other subpaths stay shimmed until separately drained.
{
pkg: '@superdoc/common/list-marker-utils',
distEntry: 'shared/common/list-marker-utils.d.ts',
matchSubpaths: false,
},
];

// Guard packages that must never fall back to `_internal-shims.d.ts`.
Expand All @@ -241,8 +286,10 @@ const RELOCATION_GUARD_PACKAGES = [
'@superdoc/contracts',
'@superdoc/dom-contract',
'@superdoc/layout-bridge',
'@superdoc/layout-engine',
'@superdoc/painter-dom',
'@superdoc/pm-adapter',
'@superdoc/common/list-marker-utils',
];

function isRelocatedSpecifier(mod) {
Expand Down
17 changes: 0 additions & 17 deletions packages/superdoc/src/composables/useUiFontFamily.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@ export const DEFAULT_UI_FONT_FAMILY = 'Arial, Helvetica, sans-serif';
*
* @returns {{ uiFontFamily: import('vue').ComputedRef<string> }} An object containing:
* - uiFontFamily: A computed reference to the UI font-family string
*
* @example
* // In a Vue component
* import { useUiFontFamily } from '@superdoc/composables/useUiFontFamily.js';
*
* export default {
* setup() {
* const { uiFontFamily } = useUiFontFamily();
*
* // Use in template or computed styles
* return { uiFontFamily };
* }
* }
*
* @example
* // In a template
* <CommentsDropdown :content-style="{ fontFamily: uiFontFamily }" />
*/
export function useUiFontFamily() {
const instance = getCurrentInstance();
Expand Down
1 change: 1 addition & 0 deletions packages/superdoc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"../layout-engine/contracts/src",
"../layout-engine/dom-contract/src",
"../layout-engine/layout-bridge/src",
"../layout-engine/layout-engine/src",
"../layout-engine/painters/dom/src",
"../layout-engine/pm-adapter/src/converter-context.ts",
"../layout-engine/pm-adapter/src/sections/types.ts"
Expand Down
1 change: 1 addition & 0 deletions packages/superdoc/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export default defineConfig(({ mode, command }) => {
'../layout-engine/contracts/src/**/*',
'../layout-engine/dom-contract/src/**/*',
'../layout-engine/layout-bridge/src/**/*',
'../layout-engine/layout-engine/src/**/*',
'../layout-engine/painters/dom/src/**/*',
// SD-2893: pm-adapter is included file-by-file (not via `src/**/*`)
// because the full barrel pulls in @superdoc/style-engine and other
Expand Down
Loading