refactor: rename devtool to toolbar

feat/devtool
dominikg 4 months ago
parent a294bbc53e
commit 71b03fc1c5

@ -102,9 +102,9 @@
"types": "./types/index.d.ts",
"default": "./src/events/index.js"
},
"./devtool": {
"./toolbar": {
"types": "./types/index.d.ts",
"default": "./src/devtool/index.js"
"default": "./src/toolbar/index.js"
}
},
"imports": {

@ -59,7 +59,7 @@ for (const key in pkg.exports) {
if (key === './internal/disclose-version') continue;
if (key === './internal/flags/legacy') continue;
if (key === './internal/flags/tracing') continue;
if (key === './devtool') continue;
if (key === './toolbar') continue;
for (const type of ['browser', 'default']) {
if (!pkg.exports[key][type]) continue;

@ -45,7 +45,7 @@ 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`,
[`${pkg.name}/toolbar`]: `${dir}/src/toolbar/public.d.ts`,
// TODO remove in Svelte 6
[`${pkg.name}/types/compiler/preprocess`]: `${dir}/src/compiler/preprocess/legacy-public.d.ts`,

@ -1,9 +0,0 @@
// i'm here so type generation doesn't get mad
// TODO generate this file during type generation
export default DevTool;
type DevTool = {
$on?(type: string, callback: (e: any) => void): () => void;
$set?(props: $$ComponentProps): void;
};
declare const DevTool: import("svelte").Component<$$ComponentProps, {}, "">;

@ -1,7 +1,7 @@
<script>
let props = $props()
</script>
<h1>devtools</h1>
<h1>toolbar</h1>
<pre>
{JSON.stringify(props,null,2)}
</pre>

@ -0,0 +1 @@
// TODO figure out generating type for this

@ -1,5 +1,5 @@
/**
* devtools config
* toolbar config
* @type {import('./public.d.ts').Config}
*/
const config = {};

@ -1,3 +1,3 @@
export {default as DevTool} from './DevTool.svelte'
export {default as ToolBar} from './ToolBar.svelte'
export * from './configure.js'
export {mountUI as default} from './runtime.js'

@ -1,9 +1,9 @@
import DevTool from './DevTool.svelte';
import ToolBar from './ToolBar.svelte';
import { mount } from 'svelte';
function create_devtool_host() {
const id = 'svelte-devtool-host';
function create_toolbar_host() {
const id = 'svelte-toolbar-host';
if (document.getElementById(id) != null) {
console.debug('svelte-devtool-host already exists, skipping');
console.debug('svelte-toolbar-host already exists, skipping');
return;
}
const el = document.createElement('div');
@ -14,7 +14,7 @@ function create_devtool_host() {
}
export function mountUI(){
if(typeof window !== 'undefined') {
mount(DevTool, { target: create_devtool_host() });
mount(ToolBar, { target: create_toolbar_host() });
}
}

@ -2548,13 +2548,14 @@ declare module 'svelte/events' {
export {};
}
declare module 'svelte/devtool' {
declare module 'svelte/toolbar' {
export interface Config {
position: 'top'|'bottom'
}
export function configure(options: Partial<Config>): void;
export function getConfig(): Config;
export function mountUI(): void;
export {};
}

Loading…
Cancel
Save