File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
packages/svelte/src/toolbar Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ const config = {
1212export function configure ( options ) {
1313 for ( const [ key , value ] of options ) {
1414 if ( key === 'tools' ) {
15- for ( const tool of /** @type {import('./public.d.ts').Tool[] }*/ value ) {
15+ for ( let tool of /** @type {import('./public.d.ts').Config.tools[0][] }*/ value ) {
16+ if ( typeof tool === 'function' ) {
17+ tool = tool ( ) ;
18+ }
1619 const existing = config . tools . find ( ( t ) => t . name === tool . name ) ;
1720 if ( existing ) {
1821 for ( const [ k , v ] of tool ) {
Original file line number Diff line number Diff line change @@ -8,7 +8,9 @@ export interface Tool {
88 keyCombo ?: string ;
99 disabled ?: boolean ;
1010}
11+ type ToolFn = ( ) => Tool
12+
1113export interface Config {
1214 position ?: 'top' | 'bottom' ;
13- tools ?: Tool [ ] ;
15+ tools ?: ( Tool | ToolFn ) [ ] ;
1416}
You can’t perform that action at this time.
0 commit comments