add config and types

feat/devtool
dominikg 4 months ago
parent 7ef2e6684d
commit f5a23ead99

@ -45,6 +45,8 @@ await createBundle({
[`${pkg.name}/store`]: `${dir}/src/store/public.d.ts`,
[`${pkg.name}/transition`]: `${dir}/src/transition/public.d.ts`,
[`${pkg.name}/events`]: `${dir}/src/events/public.d.ts`,
[`${pkg.name}/devtool`]: `${dir}/src/devtool/public.d.ts`,
// TODO remove in Svelte 6
[`${pkg.name}/types/compiler/preprocess`]: `${dir}/src/compiler/preprocess/legacy-public.d.ts`,
[`${pkg.name}/types/compiler/interfaces`]: `${dir}/src/compiler/types/legacy-interfaces.d.ts`

@ -0,0 +1,24 @@
/**
* devtools config
* @type {import('./public.d.ts').Config}
*/
const config = {};
/**
* @param {Partial<import('./public.d.ts').Config>} options
*/
export function configure(options){
// TODO deep merge?
for(const [key,value] of options){
config[key]=value;
}
}
/**
*
* @return {import('./public.d.ts').Config}
*/
export function getConfig(){
// TODO clone to avoid direct manipulation
return config;
}

@ -1 +1,2 @@
export {default as DevTool} from './DevTool.svelte'
export * from './configure.js'

@ -0,0 +1,5 @@
export * from './index.js'
export interface Config {
position: 'top'|'bottom'
}
Loading…
Cancel
Save