mirror of https://github.com/sveltejs/svelte
parent
a274b10456
commit
fc5427dbb1
@ -1,8 +1,8 @@
|
||||
import {mountUI} from './runtime.svelte.js';
|
||||
import { mountUI } from './runtime.svelte.js';
|
||||
import { configureSvelte } from './configure.svelte.js';
|
||||
import { svelte_inspector } from './tools/inspector/index.js';
|
||||
import { svelte_config } from './tools/config/index.js';
|
||||
export * from './configure.svelte.js';
|
||||
|
||||
|
||||
configureSvelte({tools:[svelte_inspector]});
|
||||
configureSvelte({ tools: [svelte_inspector, svelte_config] });
|
||||
mountUI();
|
||||
|
@ -1,20 +1,20 @@
|
||||
import ToolBar from './ToolBar.svelte';
|
||||
import { mount } from 'svelte';
|
||||
import {getConfig} from './configure.svelte.js';
|
||||
import { mount, unmount } from 'svelte';
|
||||
import { getConfig } from './configure.svelte.js';
|
||||
|
||||
export function mountUI() {
|
||||
if(typeof window !== 'undefined') {
|
||||
if (typeof window !== 'undefined') {
|
||||
const id = 'svelte-toolbar-host';
|
||||
if (document.getElementById(id) != null) {
|
||||
console.debug('svelte-toolbar-host already exists, skipping');
|
||||
return
|
||||
return;
|
||||
}
|
||||
const props = $state({config: getConfig()})
|
||||
const props = $state({ config: getConfig() });
|
||||
|
||||
const el = document.createElement('div');
|
||||
el.setAttribute('id', id);
|
||||
// appending to documentElement adds it outside of body
|
||||
document.documentElement.appendChild(el);
|
||||
mount(ToolBar, { target: el,props });
|
||||
mount(ToolBar, { target: el, props });
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
<div>
|
||||
<label for="position"
|
||||
>Position
|
||||
|
||||
<select id="position">
|
||||
<option value="top-left">top left</option>
|
||||
<option value="top-left">top right</option>
|
||||
<option value="top-left">bottom right</option>
|
||||
<option value="top-left">bottom left</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="position"
|
||||
>Position
|
||||
|
||||
<select id="position">
|
||||
<option value="top-left">top left</option>
|
||||
<option value="top-left">top right</option>
|
||||
<option value="top-left">bottom right</option>
|
||||
<option value="top-left">bottom left</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="position"
|
||||
>Position
|
||||
|
||||
<select id="position">
|
||||
<option value="top-left">top left</option>
|
||||
<option value="top-left">top right</option>
|
||||
<option value="top-left">bottom right</option>
|
||||
<option value="top-left">bottom left</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="position"
|
||||
>Position
|
||||
|
||||
<select id="position">
|
||||
<option value="top-left">top left</option>
|
||||
<option value="top-left">top right</option>
|
||||
<option value="top-left">bottom right</option>
|
||||
<option value="top-left">bottom left</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
import Config from './Config.svelte'
|
||||
|
||||
const icon = `
|
||||
<svg fill="#000000" height="200px" width="200px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 612.004 612.004" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M593.676,241.87h-48.719c-5.643-21.066-13.982-41.029-24.649-59.482l34.459-34.459c7.158-7.154,7.158-18.755,0-25.912 l-64.783-64.783c-7.154-7.156-18.757-7.156-25.909,0l-34.461,34.461c-18.453-10.667-38.414-19.005-59.482-24.647V18.325 c0-10.121-8.201-18.324-18.324-18.324h-91.616c-10.123,0-18.324,8.203-18.324,18.324V67.05c-21.068,5.64-41.027,13.98-59.48,24.647 l-34.459-34.459c-7.158-7.158-18.755-7.158-25.912,0l-64.785,64.781c-7.158,7.156-7.158,18.755,0,25.913l34.461,34.461 C81.03,200.845,72.69,220.804,67.051,241.87H18.326C8.205,241.87,0,250.073,0,260.193v91.618c0,10.121,8.205,18.324,18.326,18.324 h48.725c5.64,21.066,13.98,41.027,24.645,59.478l-34.461,34.461c-7.158,7.154-7.158,18.757,0,25.911l64.781,64.783 c7.16,7.158,18.759,7.158,25.916,0l34.459-34.459c18.451,10.665,38.412,19.005,59.48,24.645v48.727 c0,10.119,8.201,18.324,18.324,18.324h91.616c10.123,0,18.324-8.205,18.324-18.324v-48.727c21.068-5.64,41.029-13.98,59.482-24.647 l34.461,34.459c7.154,7.158,18.755,7.158,25.913,0l64.781-64.781c7.158-7.158,7.158-18.759,0-25.913l-34.459-34.459 c10.667-18.453,19.007-38.414,24.649-59.479h48.721c10.123,0,18.324-8.203,18.324-18.324v-91.618 C612,250.073,603.799,241.87,593.676,241.87z M306.002,397.619c-50.601,0-91.616-41.021-91.616-91.616 c0-50.597,41.017-91.616,91.616-91.616s91.616,41.019,91.616,91.616C397.616,356.598,356.601,397.619,306.002,397.619z"></path> </g> </g></svg>
|
||||
`;
|
||||
|
||||
/** @return {import('../../public.d.ts').ResolvedConfig.tools[0]} */
|
||||
export function svelte_config() {
|
||||
/** @type {Record<string, any>} */
|
||||
|
||||
return {
|
||||
name: 'config',
|
||||
icon,
|
||||
keyCombo: 'ctrl-c',
|
||||
component: Config,
|
||||
activate: () => {
|
||||
console.log("activate config")
|
||||
},
|
||||
deactivate: () => {
|
||||
console.log("de-activate config")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue