@tanstack/devtools 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk/CEHNENNI.js +251 -0
- package/dist/{esm/core.js → dev.js} +10 -12
- package/dist/devtools/DJF65R3Y.js +1674 -0
- package/dist/devtools/ITBBRMTQ.js +1966 -0
- package/dist/index.d.ts +168 -0
- package/dist/index.js +76 -0
- package/dist/server.js +44 -0
- package/package.json +21 -12
- package/src/core.tsx +3 -0
- package/dist/esm/components/content-panel.d.ts +0 -6
- package/dist/esm/components/content-panel.js +0 -32
- package/dist/esm/components/content-panel.js.map +0 -1
- package/dist/esm/components/main-panel.d.ts +0 -6
- package/dist/esm/components/main-panel.js +0 -42
- package/dist/esm/components/main-panel.js.map +0 -1
- package/dist/esm/components/tab-content.d.ts +0 -2
- package/dist/esm/components/tab-content.js +0 -23
- package/dist/esm/components/tab-content.js.map +0 -1
- package/dist/esm/components/tabs.d.ts +0 -5
- package/dist/esm/components/tabs.js +0 -75
- package/dist/esm/components/tabs.js.map +0 -1
- package/dist/esm/components/trigger.d.ts +0 -5
- package/dist/esm/components/trigger.js +0 -31
- package/dist/esm/components/trigger.js.map +0 -1
- package/dist/esm/constants.d.ts +0 -2
- package/dist/esm/constants.js +0 -7
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/context/devtools-context.d.ts +0 -62
- package/dist/esm/context/devtools-context.js +0 -77
- package/dist/esm/context/devtools-context.js.map +0 -1
- package/dist/esm/context/devtools-store.d.ts +0 -59
- package/dist/esm/context/devtools-store.js +0 -29
- package/dist/esm/context/devtools-store.js.map +0 -1
- package/dist/esm/context/draw-context.d.ts +0 -13
- package/dist/esm/context/draw-context.js +0 -55
- package/dist/esm/context/draw-context.js.map +0 -1
- package/dist/esm/context/pip-context.d.ts +0 -14
- package/dist/esm/context/pip-context.js +0 -117
- package/dist/esm/context/pip-context.js.map +0 -1
- package/dist/esm/context/use-devtools-context.d.ts +0 -40
- package/dist/esm/context/use-devtools-context.js +0 -96
- package/dist/esm/context/use-devtools-context.js.map +0 -1
- package/dist/esm/core.d.ts +0 -39
- package/dist/esm/core.js.map +0 -1
- package/dist/esm/devtools.d.ts +0 -1
- package/dist/esm/devtools.js +0 -200
- package/dist/esm/devtools.js.map +0 -1
- package/dist/esm/hooks/use-disable-tabbing.d.ts +0 -6
- package/dist/esm/hooks/use-disable-tabbing.js +0 -23
- package/dist/esm/hooks/use-disable-tabbing.js.map +0 -1
- package/dist/esm/hooks/use-head-changes.d.ts +0 -39
- package/dist/esm/hooks/use-head-changes.js +0 -65
- package/dist/esm/hooks/use-head-changes.js.map +0 -1
- package/dist/esm/index.d.ts +0 -4
- package/dist/esm/index.js +0 -8
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/styles/tokens.d.ts +0 -298
- package/dist/esm/styles/tokens.js +0 -63
- package/dist/esm/styles/tokens.js.map +0 -1
- package/dist/esm/styles/use-styles.d.ts +0 -42
- package/dist/esm/styles/use-styles.js +0 -422
- package/dist/esm/styles/use-styles.js.map +0 -1
- package/dist/esm/tabs/index.d.ts +0 -17
- package/dist/esm/tabs/index.js +0 -25
- package/dist/esm/tabs/index.js.map +0 -1
- package/dist/esm/tabs/plugins-tab.d.ts +0 -1
- package/dist/esm/tabs/plugins-tab.js +0 -88
- package/dist/esm/tabs/plugins-tab.js.map +0 -1
- package/dist/esm/tabs/seo-tab.d.ts +0 -1
- package/dist/esm/tabs/seo-tab.js +0 -296
- package/dist/esm/tabs/seo-tab.js.map +0 -1
- package/dist/esm/tabs/settings-tab.d.ts +0 -1
- package/dist/esm/tabs/settings-tab.js +0 -308
- package/dist/esm/tabs/settings-tab.js.map +0 -1
- package/dist/esm/utils/sanitize.d.ts +0 -3
- package/dist/esm/utils/sanitize.js +0 -31
- package/dist/esm/utils/sanitize.js.map +0 -1
- package/dist/esm/utils/storage.d.ts +0 -5
- package/dist/esm/utils/storage.js +0 -19
- package/dist/esm/utils/storage.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["export const PLUGIN_CONTAINER_ID = 'plugin-container'\nexport const PLUGIN_TITLE_CONTAINER_ID = 'plugin-title-container'\n"],"names":[],"mappings":"AAAO,MAAM,sBAAsB;AAC5B,MAAM,4BAA4B;"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { DevtoolsStore } from './devtools-store.js';
|
|
2
|
-
import { JSX, Setter } from 'solid-js';
|
|
3
|
-
export interface TanStackDevtoolsPlugin {
|
|
4
|
-
/**
|
|
5
|
-
* Name to be displayed in the devtools UI.
|
|
6
|
-
* If a string, it will be used as the plugin name.
|
|
7
|
-
* If a function, it will be called with the mount element.
|
|
8
|
-
*
|
|
9
|
-
* Example:
|
|
10
|
-
* ```ts
|
|
11
|
-
* {
|
|
12
|
-
* // If a string, it will be used as the plugin name
|
|
13
|
-
* name: "Your Plugin",
|
|
14
|
-
* render: () => {}
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
* or
|
|
18
|
-
*
|
|
19
|
-
* ```ts
|
|
20
|
-
* {
|
|
21
|
-
* // If a function, it will be called with the mount element
|
|
22
|
-
* name: (el) => {
|
|
23
|
-
* el.innerText = "Your Plugin Name"
|
|
24
|
-
* // Your name logic here
|
|
25
|
-
* },
|
|
26
|
-
* render: () => {}
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
name: string | ((el: HTMLHeadingElement, theme: DevtoolsStore['settings']['theme']) => void);
|
|
31
|
-
/**
|
|
32
|
-
* Unique identifier for the plugin.
|
|
33
|
-
* If not provided, it will be generated based on the name.
|
|
34
|
-
*/
|
|
35
|
-
id?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Render the plugin UI by using the provided element. This function will be called
|
|
38
|
-
* when the plugin tab is clicked and expected to be mounted.
|
|
39
|
-
* @param el The mount element for the plugin.
|
|
40
|
-
* @returns void
|
|
41
|
-
*
|
|
42
|
-
* Example:
|
|
43
|
-
* ```ts
|
|
44
|
-
* render: (el) => {
|
|
45
|
-
* el.innerHTML = "<h1>Your Plugin</h1>"
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
render: (el: HTMLDivElement, theme: DevtoolsStore['settings']['theme']) => void;
|
|
50
|
-
}
|
|
51
|
-
export declare const DevtoolsContext: import('solid-js').Context<{
|
|
52
|
-
store: DevtoolsStore;
|
|
53
|
-
setStore: Setter<DevtoolsStore>;
|
|
54
|
-
} | undefined>;
|
|
55
|
-
interface ContextProps {
|
|
56
|
-
children: JSX.Element;
|
|
57
|
-
plugins?: Array<TanStackDevtoolsPlugin>;
|
|
58
|
-
config?: TanStackDevtoolsConfig;
|
|
59
|
-
}
|
|
60
|
-
export type TanStackDevtoolsConfig = DevtoolsStore['settings'];
|
|
61
|
-
export declare const DevtoolsProvider: (props: ContextProps) => JSX.Element;
|
|
62
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "solid-js/web";
|
|
2
|
-
import { createContext } from "solid-js";
|
|
3
|
-
import { createStore } from "solid-js/store";
|
|
4
|
-
import { tryParseJson } from "../utils/sanitize.js";
|
|
5
|
-
import { getStorageItem, setStorageItem, TANSTACK_DEVTOOLS_SETTINGS, TANSTACK_DEVTOOLS_STATE } from "../utils/storage.js";
|
|
6
|
-
import { initialState } from "./devtools-store.js";
|
|
7
|
-
const DevtoolsContext = createContext();
|
|
8
|
-
const getSettings = () => {
|
|
9
|
-
const settingsString = getStorageItem(TANSTACK_DEVTOOLS_SETTINGS);
|
|
10
|
-
const settings = tryParseJson(settingsString);
|
|
11
|
-
return {
|
|
12
|
-
...settings
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const generatePluginId = (plugin, index) => {
|
|
16
|
-
if (plugin.id) {
|
|
17
|
-
return plugin.id;
|
|
18
|
-
}
|
|
19
|
-
if (typeof plugin.name === "string") {
|
|
20
|
-
return `${plugin.name.toLowerCase().replace(" ", "-")}-${index}`;
|
|
21
|
-
}
|
|
22
|
-
return index.toString();
|
|
23
|
-
};
|
|
24
|
-
const getExistingStateFromStorage = (config, plugins) => {
|
|
25
|
-
const existingState = getStorageItem(TANSTACK_DEVTOOLS_STATE);
|
|
26
|
-
const settings = getSettings();
|
|
27
|
-
const state = {
|
|
28
|
-
...initialState,
|
|
29
|
-
plugins: plugins?.map((plugin, i) => {
|
|
30
|
-
const id = generatePluginId(plugin, i);
|
|
31
|
-
return {
|
|
32
|
-
...plugin,
|
|
33
|
-
id
|
|
34
|
-
};
|
|
35
|
-
}) || [],
|
|
36
|
-
state: {
|
|
37
|
-
...initialState.state,
|
|
38
|
-
...existingState ? JSON.parse(existingState) : {}
|
|
39
|
-
},
|
|
40
|
-
settings: {
|
|
41
|
-
...initialState.settings,
|
|
42
|
-
...config,
|
|
43
|
-
...settings
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return state;
|
|
47
|
-
};
|
|
48
|
-
const DevtoolsProvider = (props) => {
|
|
49
|
-
const [store, setStore] = createStore(getExistingStateFromStorage(props.config, props.plugins));
|
|
50
|
-
const value = {
|
|
51
|
-
store,
|
|
52
|
-
setStore: (updater) => {
|
|
53
|
-
const newState = updater(store);
|
|
54
|
-
const {
|
|
55
|
-
settings,
|
|
56
|
-
state: internalState
|
|
57
|
-
} = newState;
|
|
58
|
-
setStorageItem(TANSTACK_DEVTOOLS_SETTINGS, JSON.stringify(settings));
|
|
59
|
-
setStorageItem(TANSTACK_DEVTOOLS_STATE, JSON.stringify(internalState));
|
|
60
|
-
setStore((prev) => ({
|
|
61
|
-
...prev,
|
|
62
|
-
...newState
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
return createComponent(DevtoolsContext.Provider, {
|
|
67
|
-
value,
|
|
68
|
-
get children() {
|
|
69
|
-
return props.children;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
DevtoolsContext,
|
|
75
|
-
DevtoolsProvider
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=devtools-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-context.js","sources":["../../../src/context/devtools-context.tsx"],"sourcesContent":["import { createContext } from 'solid-js'\nimport { createStore } from 'solid-js/store'\nimport { tryParseJson } from '../utils/sanitize'\nimport {\n TANSTACK_DEVTOOLS_SETTINGS,\n TANSTACK_DEVTOOLS_STATE,\n getStorageItem,\n setStorageItem,\n} from '../utils/storage'\nimport { initialState } from './devtools-store'\nimport type { DevtoolsStore } from './devtools-store'\nimport type { JSX, Setter } from 'solid-js'\n\nexport interface TanStackDevtoolsPlugin {\n /**\n * Name to be displayed in the devtools UI.\n * If a string, it will be used as the plugin name.\n * If a function, it will be called with the mount element.\n *\n * Example:\n * ```ts\n * {\n * // If a string, it will be used as the plugin name\n * name: \"Your Plugin\",\n * render: () => {}\n * }\n * ```\n * or\n *\n * ```ts\n * {\n * // If a function, it will be called with the mount element\n * name: (el) => {\n * el.innerText = \"Your Plugin Name\"\n * // Your name logic here\n * },\n * render: () => {}\n * }\n * ```\n */\n name:\n | string\n | ((\n el: HTMLHeadingElement,\n theme: DevtoolsStore['settings']['theme'],\n ) => void)\n /**\n * Unique identifier for the plugin.\n * If not provided, it will be generated based on the name.\n */\n id?: string\n /**\n * Render the plugin UI by using the provided element. This function will be called\n * when the plugin tab is clicked and expected to be mounted.\n * @param el The mount element for the plugin.\n * @returns void\n *\n * Example:\n * ```ts\n * render: (el) => {\n * el.innerHTML = \"<h1>Your Plugin</h1>\"\n * }\n * ```\n */\n render: (\n el: HTMLDivElement,\n theme: DevtoolsStore['settings']['theme'],\n ) => void\n}\nexport const DevtoolsContext = createContext<{\n store: DevtoolsStore\n setStore: Setter<DevtoolsStore>\n}>()\n\ninterface ContextProps {\n children: JSX.Element\n plugins?: Array<TanStackDevtoolsPlugin>\n config?: TanStackDevtoolsConfig\n}\n\nconst getSettings = () => {\n const settingsString = getStorageItem(TANSTACK_DEVTOOLS_SETTINGS)\n const settings = tryParseJson<DevtoolsStore['settings']>(settingsString)\n return {\n ...settings,\n }\n}\n\nconst generatePluginId = (plugin: TanStackDevtoolsPlugin, index: number) => {\n // if set by user, return the plugin id\n if (plugin.id) {\n return plugin.id\n }\n if (typeof plugin.name === 'string') {\n // if name is a string, use it to generate an id\n return `${plugin.name.toLowerCase().replace(' ', '-')}-${index}`\n }\n // Name is JSX? return the index as a string\n return index.toString()\n}\n\nconst getExistingStateFromStorage = (\n config?: TanStackDevtoolsConfig,\n plugins?: Array<TanStackDevtoolsPlugin>,\n) => {\n const existingState = getStorageItem(TANSTACK_DEVTOOLS_STATE)\n const settings = getSettings()\n\n const state: DevtoolsStore = {\n ...initialState,\n plugins:\n plugins?.map((plugin, i) => {\n const id = generatePluginId(plugin, i)\n return {\n ...plugin,\n id,\n }\n }) || [],\n state: {\n ...initialState.state,\n ...(existingState ? JSON.parse(existingState) : {}),\n },\n settings: {\n ...initialState.settings,\n ...config,\n ...settings,\n },\n }\n return state\n}\n\nexport type TanStackDevtoolsConfig = DevtoolsStore['settings']\n\nexport const DevtoolsProvider = (props: ContextProps) => {\n const [store, setStore] = createStore(\n getExistingStateFromStorage(props.config, props.plugins),\n )\n\n const value = {\n store,\n setStore: (\n updater: (prev: DevtoolsStore) => DevtoolsStore | Partial<DevtoolsStore>,\n ) => {\n const newState = updater(store)\n const { settings, state: internalState } = newState\n // Store user settings for dev tools into local storage\n setStorageItem(TANSTACK_DEVTOOLS_SETTINGS, JSON.stringify(settings))\n // Store general state into local storage\n setStorageItem(TANSTACK_DEVTOOLS_STATE, JSON.stringify(internalState))\n setStore((prev) => ({\n ...prev,\n ...newState,\n }))\n },\n }\n\n return (\n <DevtoolsContext.Provider value={value}>\n {props.children}\n </DevtoolsContext.Provider>\n )\n}\n"],"names":["DevtoolsContext","createContext","getSettings","settingsString","getStorageItem","TANSTACK_DEVTOOLS_SETTINGS","settings","tryParseJson","generatePluginId","plugin","index","id","name","toLowerCase","replace","toString","getExistingStateFromStorage","config","plugins","existingState","TANSTACK_DEVTOOLS_STATE","state","initialState","map","i","JSON","parse","DevtoolsProvider","props","store","setStore","createStore","value","updater","newState","internalState","setStorageItem","stringify","prev","_$createComponent","Provider","children"],"mappings":";;;;;;AAqEO,MAAMA,kBAAkBC,cAAAA;AAW/B,MAAMC,cAAcA,MAAM;AACxB,QAAMC,iBAAiBC,eAAeC,0BAA0B;AAChE,QAAMC,WAAWC,aAAwCJ,cAAc;AACvE,SAAO;AAAA,IACL,GAAGG;AAAAA,EAAAA;AAEP;AAEA,MAAME,mBAAmBA,CAACC,QAAgCC,UAAkB;AAE1E,MAAID,OAAOE,IAAI;AACb,WAAOF,OAAOE;AAAAA,EAChB;AACA,MAAI,OAAOF,OAAOG,SAAS,UAAU;AAEnC,WAAO,GAAGH,OAAOG,KAAKC,YAAAA,EAAcC,QAAQ,KAAK,GAAG,CAAC,IAAIJ,KAAK;AAAA,EAChE;AAEA,SAAOA,MAAMK,SAAAA;AACf;AAEA,MAAMC,8BAA8BA,CAClCC,QACAC,YACG;AACH,QAAMC,gBAAgBf,eAAegB,uBAAuB;AAC5D,QAAMd,WAAWJ,YAAAA;AAEjB,QAAMmB,QAAuB;AAAA,IAC3B,GAAGC;AAAAA,IACHJ,SACEA,SAASK,IAAI,CAACd,QAAQe,MAAM;AAC1B,YAAMb,KAAKH,iBAAiBC,QAAQe,CAAC;AACrC,aAAO;AAAA,QACL,GAAGf;AAAAA,QACHE;AAAAA,MAAAA;AAAAA,IAEJ,CAAC,KAAK,CAAA;AAAA,IACRU,OAAO;AAAA,MACL,GAAGC,aAAaD;AAAAA,MAChB,GAAIF,gBAAgBM,KAAKC,MAAMP,aAAa,IAAI,CAAA;AAAA,IAAC;AAAA,IAEnDb,UAAU;AAAA,MACR,GAAGgB,aAAahB;AAAAA,MAChB,GAAGW;AAAAA,MACH,GAAGX;AAAAA,IAAAA;AAAAA,EACL;AAEF,SAAOe;AACT;AAIO,MAAMM,mBAAmBA,CAACC,UAAwB;AACvD,QAAM,CAACC,OAAOC,QAAQ,IAAIC,YACxBf,4BAA4BY,MAAMX,QAAQW,MAAMV,OAAO,CACzD;AAEA,QAAMc,QAAQ;AAAA,IACZH;AAAAA,IACAC,UAAUA,CACRG,YACG;AACH,YAAMC,WAAWD,QAAQJ,KAAK;AAC9B,YAAM;AAAA,QAAEvB;AAAAA,QAAUe,OAAOc;AAAAA,MAAAA,IAAkBD;AAE3CE,qBAAe/B,4BAA4BoB,KAAKY,UAAU/B,QAAQ,CAAC;AAEnE8B,qBAAehB,yBAAyBK,KAAKY,UAAUF,aAAa,CAAC;AACrEL,eAAUQ,CAAAA,UAAU;AAAA,QAClB,GAAGA;AAAAA,QACH,GAAGJ;AAAAA,MAAAA,EACH;AAAA,IACJ;AAAA,EAAA;AAGF,SAAAK,gBACGvC,gBAAgBwC,UAAQ;AAAA,IAACR;AAAAA,IAAY,IAAAS,WAAA;AAAA,aACnCb,MAAMa;AAAAA,IAAQ;AAAA,EAAA,CAAA;AAGrB;"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { TabName } from '../tabs.js';
|
|
2
|
-
import { TanStackDevtoolsPlugin } from './devtools-context.js';
|
|
3
|
-
type ModifierKey = 'Alt' | 'Control' | 'Meta' | 'Shift';
|
|
4
|
-
type KeyboardKey = ModifierKey | (string & {});
|
|
5
|
-
export declare const keyboardModifiers: Array<ModifierKey>;
|
|
6
|
-
type TriggerPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'middle-left' | 'middle-right';
|
|
7
|
-
export type DevtoolsStore = {
|
|
8
|
-
settings: {
|
|
9
|
-
/**
|
|
10
|
-
* Whether the dev tools should be open by default
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
defaultOpen: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Whether the dev tools trigger should be hidden until the user hovers over it
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
hideUntilHover: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The position of the trigger button
|
|
21
|
-
* @default "bottom-right"
|
|
22
|
-
*/
|
|
23
|
-
position: TriggerPosition;
|
|
24
|
-
/**
|
|
25
|
-
* The location of the panel once it is open
|
|
26
|
-
* @default "bottom"
|
|
27
|
-
*/
|
|
28
|
-
panelLocation: 'top' | 'bottom';
|
|
29
|
-
/**
|
|
30
|
-
* The hotkey to open the dev tools
|
|
31
|
-
* @default "shift+a"
|
|
32
|
-
*/
|
|
33
|
-
openHotkey: Array<KeyboardKey>;
|
|
34
|
-
/**
|
|
35
|
-
* Whether to require the URL flag to open the dev tools
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
requireUrlFlag: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* The URL flag to open the dev tools, used in conjunction with requireUrlFlag (if set to true)
|
|
41
|
-
* @default "tanstack-devtools"
|
|
42
|
-
*/
|
|
43
|
-
urlFlag: string;
|
|
44
|
-
/**
|
|
45
|
-
* The theme of the dev tools
|
|
46
|
-
* @default "dark"
|
|
47
|
-
*/
|
|
48
|
-
theme: 'light' | 'dark';
|
|
49
|
-
};
|
|
50
|
-
state: {
|
|
51
|
-
activeTab: TabName;
|
|
52
|
-
height: number;
|
|
53
|
-
activePlugin?: string | undefined;
|
|
54
|
-
persistOpen: boolean;
|
|
55
|
-
};
|
|
56
|
-
plugins?: Array<TanStackDevtoolsPlugin>;
|
|
57
|
-
};
|
|
58
|
-
export declare const initialState: DevtoolsStore;
|
|
59
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const keyboardModifiers = [
|
|
2
|
-
"Alt",
|
|
3
|
-
"Control",
|
|
4
|
-
"Meta",
|
|
5
|
-
"Shift"
|
|
6
|
-
];
|
|
7
|
-
const initialState = {
|
|
8
|
-
settings: {
|
|
9
|
-
defaultOpen: false,
|
|
10
|
-
hideUntilHover: false,
|
|
11
|
-
position: "bottom-right",
|
|
12
|
-
panelLocation: "bottom",
|
|
13
|
-
openHotkey: ["Shift", "A"],
|
|
14
|
-
requireUrlFlag: false,
|
|
15
|
-
urlFlag: "tanstack-devtools",
|
|
16
|
-
theme: typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
|
|
17
|
-
},
|
|
18
|
-
state: {
|
|
19
|
-
activeTab: "plugins",
|
|
20
|
-
height: 400,
|
|
21
|
-
activePlugin: void 0,
|
|
22
|
-
persistOpen: false
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
initialState,
|
|
27
|
-
keyboardModifiers
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=devtools-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-store.js","sources":["../../../src/context/devtools-store.ts"],"sourcesContent":["import type { TabName } from '../tabs'\nimport type { TanStackDevtoolsPlugin } from './devtools-context'\n\ntype ModifierKey = 'Alt' | 'Control' | 'Meta' | 'Shift'\ntype KeyboardKey = ModifierKey | (string & {})\nexport const keyboardModifiers: Array<ModifierKey> = [\n 'Alt',\n 'Control',\n 'Meta',\n 'Shift',\n]\n\ntype TriggerPosition =\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'middle-left'\n | 'middle-right'\n\nexport type DevtoolsStore = {\n settings: {\n /**\n * Whether the dev tools should be open by default\n * @default false\n */\n defaultOpen: boolean\n /**\n * Whether the dev tools trigger should be hidden until the user hovers over it\n * @default false\n */\n hideUntilHover: boolean\n /**\n * The position of the trigger button\n * @default \"bottom-right\"\n */\n position: TriggerPosition\n\n /**\n * The location of the panel once it is open\n * @default \"bottom\"\n */\n panelLocation: 'top' | 'bottom'\n /**\n * The hotkey to open the dev tools\n * @default \"shift+a\"\n */\n openHotkey: Array<KeyboardKey>\n /**\n * Whether to require the URL flag to open the dev tools\n * @default false\n */\n requireUrlFlag: boolean\n /**\n * The URL flag to open the dev tools, used in conjunction with requireUrlFlag (if set to true)\n * @default \"tanstack-devtools\"\n */\n urlFlag: string\n /**\n * The theme of the dev tools\n * @default \"dark\"\n */\n theme: 'light' | 'dark'\n }\n state: {\n activeTab: TabName\n height: number\n activePlugin?: string | undefined\n persistOpen: boolean\n }\n plugins?: Array<TanStackDevtoolsPlugin>\n}\n\nexport const initialState: DevtoolsStore = {\n settings: {\n defaultOpen: false,\n hideUntilHover: false,\n position: 'bottom-right',\n panelLocation: 'bottom',\n openHotkey: ['Shift', 'A'],\n requireUrlFlag: false,\n urlFlag: 'tanstack-devtools',\n theme:\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light',\n },\n state: {\n activeTab: 'plugins',\n height: 400,\n activePlugin: undefined,\n persistOpen: false,\n },\n}\n"],"names":[],"mappings":"AAKO,MAAM,oBAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA+DO,MAAM,eAA8B;AAAA,EACzC,UAAU;AAAA,IACR,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,eAAe;AAAA,IACf,YAAY,CAAC,SAAS,GAAG;AAAA,IACzB,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,OACE,OAAO,WAAW,eAClB,OAAO,WAAW,8BAA8B,EAAE,UAC9C,SACA;AAAA,EAAA;AAAA,EAER,OAAO;AAAA,IACL,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,aAAa;AAAA,EAAA;AAEjB;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ParentComponent } from 'solid-js';
|
|
2
|
-
export declare const DrawClientProvider: ParentComponent<{
|
|
3
|
-
animationMs: number;
|
|
4
|
-
}>;
|
|
5
|
-
export declare function useDrawContext(): {
|
|
6
|
-
expanded: import('solid-js').Accessor<boolean>;
|
|
7
|
-
setForceExpand: import('solid-js').Setter<boolean>;
|
|
8
|
-
hoverUtils: {
|
|
9
|
-
enter: () => void;
|
|
10
|
-
leave: () => void;
|
|
11
|
-
};
|
|
12
|
-
animationMs: number;
|
|
13
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "solid-js/web";
|
|
2
|
-
import { createContext, useContext, createSignal, createMemo, onCleanup } from "solid-js";
|
|
3
|
-
const useDraw = (props) => {
|
|
4
|
-
const [activeHover, setActiveHover] = createSignal(false);
|
|
5
|
-
const [forceExpand, setForceExpand] = createSignal(false);
|
|
6
|
-
const expanded = createMemo(() => activeHover() || forceExpand());
|
|
7
|
-
let hoverTimeout = null;
|
|
8
|
-
onCleanup(() => {
|
|
9
|
-
if (hoverTimeout) clearTimeout(hoverTimeout);
|
|
10
|
-
});
|
|
11
|
-
const hoverUtils = {
|
|
12
|
-
enter: () => {
|
|
13
|
-
if (hoverTimeout) {
|
|
14
|
-
clearTimeout(hoverTimeout);
|
|
15
|
-
hoverTimeout = null;
|
|
16
|
-
}
|
|
17
|
-
setActiveHover(true);
|
|
18
|
-
},
|
|
19
|
-
leave: () => {
|
|
20
|
-
hoverTimeout = setTimeout(() => {
|
|
21
|
-
setActiveHover(false);
|
|
22
|
-
}, props.animationMs);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
return {
|
|
26
|
-
expanded,
|
|
27
|
-
setForceExpand,
|
|
28
|
-
hoverUtils,
|
|
29
|
-
animationMs: props.animationMs
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
const DrawContext = createContext(void 0);
|
|
33
|
-
const DrawClientProvider = (props) => {
|
|
34
|
-
const value = useDraw({
|
|
35
|
-
animationMs: props.animationMs
|
|
36
|
-
});
|
|
37
|
-
return createComponent(DrawContext.Provider, {
|
|
38
|
-
value,
|
|
39
|
-
get children() {
|
|
40
|
-
return props.children;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
function useDrawContext() {
|
|
45
|
-
const context = useContext(DrawContext);
|
|
46
|
-
if (context === void 0) {
|
|
47
|
-
throw new Error(`useDrawContext must be used within a DrawClientProvider`);
|
|
48
|
-
}
|
|
49
|
-
return context;
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
DrawClientProvider,
|
|
53
|
-
useDrawContext
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=draw-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"draw-context.js","sources":["../../../src/context/draw-context.tsx"],"sourcesContent":["import {\n createContext,\n createMemo,\n createSignal,\n onCleanup,\n useContext,\n} from 'solid-js'\nimport type { ParentComponent } from 'solid-js'\n\nconst useDraw = (props: { animationMs: number }) => {\n const [activeHover, setActiveHover] = createSignal<boolean>(false)\n const [forceExpand, setForceExpand] = createSignal<boolean>(false)\n\n const expanded = createMemo(() => activeHover() || forceExpand())\n\n let hoverTimeout: ReturnType<typeof setTimeout> | null = null\n onCleanup(() => {\n if (hoverTimeout) clearTimeout(hoverTimeout)\n })\n\n const hoverUtils = {\n enter: () => {\n if (hoverTimeout) {\n clearTimeout(hoverTimeout)\n hoverTimeout = null\n }\n setActiveHover(true)\n },\n\n leave: () => {\n hoverTimeout = setTimeout(() => {\n setActiveHover(false)\n }, props.animationMs)\n },\n }\n\n return {\n expanded,\n setForceExpand,\n hoverUtils,\n animationMs: props.animationMs,\n }\n}\n\ntype ContextType = ReturnType<typeof useDraw>\n\nconst DrawContext = createContext<ContextType | undefined>(undefined)\n\nexport const DrawClientProvider: ParentComponent<{\n animationMs: number\n}> = (props) => {\n const value = useDraw({ animationMs: props.animationMs })\n\n return (\n <DrawContext.Provider value={value}>{props.children}</DrawContext.Provider>\n )\n}\n\nexport function useDrawContext() {\n const context = useContext(DrawContext)\n\n if (context === undefined) {\n throw new Error(`useDrawContext must be used within a DrawClientProvider`)\n }\n\n return context\n}\n"],"names":["useDraw","props","activeHover","setActiveHover","createSignal","forceExpand","setForceExpand","expanded","createMemo","hoverTimeout","onCleanup","hoverUtils","enter","clearTimeout","leave","setTimeout","animationMs","DrawContext","createContext","undefined","DrawClientProvider","value","_$createComponent","Provider","children","useDrawContext","context","useContext","Error"],"mappings":";;AASA,MAAMA,UAAUA,CAACC,UAAmC;AAClD,QAAM,CAACC,aAAaC,cAAc,IAAIC,aAAsB,KAAK;AACjE,QAAM,CAACC,aAAaC,cAAc,IAAIF,aAAsB,KAAK;AAEjE,QAAMG,WAAWC,WAAW,MAAMN,YAAAA,KAAiBG,aAAa;AAEhE,MAAII,eAAqD;AACzDC,YAAU,MAAM;AACd,QAAID,2BAA2BA,YAAY;AAAA,EAC7C,CAAC;AAED,QAAME,aAAa;AAAA,IACjBC,OAAOA,MAAM;AACX,UAAIH,cAAc;AAChBI,qBAAaJ,YAAY;AACzBA,uBAAe;AAAA,MACjB;AACAN,qBAAe,IAAI;AAAA,IACrB;AAAA,IAEAW,OAAOA,MAAM;AACXL,qBAAeM,WAAW,MAAM;AAC9BZ,uBAAe,KAAK;AAAA,MACtB,GAAGF,MAAMe,WAAW;AAAA,IACtB;AAAA,EAAA;AAGF,SAAO;AAAA,IACLT;AAAAA,IACAD;AAAAA,IACAK;AAAAA,IACAK,aAAaf,MAAMe;AAAAA,EAAAA;AAEvB;AAIA,MAAMC,cAAcC,cAAuCC,MAAS;AAE7D,MAAMC,qBAEPnB,CAAAA,UAAU;AACd,QAAMoB,QAAQrB,QAAQ;AAAA,IAAEgB,aAAaf,MAAMe;AAAAA,EAAAA,CAAa;AAExD,SAAAM,gBACGL,YAAYM,UAAQ;AAAA,IAACF;AAAAA,IAAY,IAAAG,WAAA;AAAA,aAAGvB,MAAMuB;AAAAA,IAAQ;AAAA,EAAA,CAAA;AAEvD;AAEO,SAASC,iBAAiB;AAC/B,QAAMC,UAAUC,WAAWV,WAAW;AAEtC,MAAIS,YAAYP,QAAW;AACzB,UAAM,IAAIS,MAAM,yDAAyD;AAAA,EAC3E;AAEA,SAAOF;AACT;"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Accessor, JSX } from 'solid-js';
|
|
2
|
-
interface PiPProviderProps {
|
|
3
|
-
children: JSX.Element;
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
}
|
|
6
|
-
type PiPContextType = {
|
|
7
|
-
pipWindow: Window | null;
|
|
8
|
-
requestPipWindow: (settings: string) => void;
|
|
9
|
-
closePipWindow: () => void;
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
};
|
|
12
|
-
export declare const PiPProvider: (props: PiPProviderProps) => JSX.Element;
|
|
13
|
-
export declare const usePiPWindow: () => Accessor<PiPContextType>;
|
|
14
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { createComponent, delegateEvents } from "solid-js/web";
|
|
2
|
-
import { createMemo, useContext, createContext, createSignal, createEffect, onCleanup } from "solid-js";
|
|
3
|
-
const PiPContext = createContext(void 0);
|
|
4
|
-
const PiPProvider = (props) => {
|
|
5
|
-
const [pipWindow, setPipWindow] = createSignal(null);
|
|
6
|
-
const closePipWindow = () => {
|
|
7
|
-
const w = pipWindow();
|
|
8
|
-
if (w != null) {
|
|
9
|
-
w.close();
|
|
10
|
-
setPipWindow(null);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const requestPipWindow = (settings) => {
|
|
14
|
-
if (pipWindow() != null) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const pip = window.open("", "TSDT-Devtools-Panel", `${settings},popup`);
|
|
18
|
-
if (!pip) {
|
|
19
|
-
throw new Error("Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.");
|
|
20
|
-
}
|
|
21
|
-
const meta = typeof import.meta !== "undefined" ? import.meta : null;
|
|
22
|
-
meta?.hot?.on("vite:beforeUpdate", () => {
|
|
23
|
-
localStorage.setItem("pip_open", "false");
|
|
24
|
-
closePipWindow();
|
|
25
|
-
});
|
|
26
|
-
window.addEventListener("beforeunload", () => {
|
|
27
|
-
localStorage.setItem("pip_open", "false");
|
|
28
|
-
closePipWindow();
|
|
29
|
-
});
|
|
30
|
-
pip.document.head.innerHTML = "";
|
|
31
|
-
pip.document.body.innerHTML = "";
|
|
32
|
-
pip.document.title = "TanStack Devtools";
|
|
33
|
-
pip.document.body.style.margin = "0";
|
|
34
|
-
pip.addEventListener("pagehide", () => {
|
|
35
|
-
localStorage.setItem("pip_open", "false");
|
|
36
|
-
closePipWindow();
|
|
37
|
-
});
|
|
38
|
-
[...document.styleSheets].forEach((styleSheet) => {
|
|
39
|
-
try {
|
|
40
|
-
const cssRules = [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
|
|
41
|
-
const style = document.createElement("style");
|
|
42
|
-
const style_node = styleSheet.ownerNode;
|
|
43
|
-
let style_id = "";
|
|
44
|
-
if (style_node && "id" in style_node) {
|
|
45
|
-
style_id = style_node.id;
|
|
46
|
-
}
|
|
47
|
-
if (style_id) {
|
|
48
|
-
style.setAttribute("id", style_id);
|
|
49
|
-
}
|
|
50
|
-
style.textContent = cssRules;
|
|
51
|
-
pip.document.head.appendChild(style);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
const link = document.createElement("link");
|
|
54
|
-
if (styleSheet.href == null) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
link.rel = "stylesheet";
|
|
58
|
-
link.type = styleSheet.type;
|
|
59
|
-
link.media = styleSheet.media.toString();
|
|
60
|
-
link.href = styleSheet.href;
|
|
61
|
-
pip.document.head.appendChild(link);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
delegateEvents(["focusin", "focusout", "pointermove", "keydown", "pointerdown", "pointerup", "click", "mousedown", "input"], pip.document);
|
|
65
|
-
setPipWindow(pip);
|
|
66
|
-
};
|
|
67
|
-
createEffect(() => {
|
|
68
|
-
const gooberStyles = document.querySelector("#_goober");
|
|
69
|
-
const w = pipWindow();
|
|
70
|
-
if (gooberStyles && w) {
|
|
71
|
-
const observer = new MutationObserver(() => {
|
|
72
|
-
const pip_style = w.document.querySelector("#_goober");
|
|
73
|
-
if (pip_style) {
|
|
74
|
-
pip_style.textContent = gooberStyles.textContent;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
observer.observe(gooberStyles, {
|
|
78
|
-
childList: true,
|
|
79
|
-
// observe direct children
|
|
80
|
-
subtree: true,
|
|
81
|
-
// and lower descendants too
|
|
82
|
-
characterDataOldValue: true
|
|
83
|
-
// pass old data to callback
|
|
84
|
-
});
|
|
85
|
-
onCleanup(() => {
|
|
86
|
-
observer.disconnect();
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
const value = createMemo(() => ({
|
|
91
|
-
pipWindow: pipWindow(),
|
|
92
|
-
requestPipWindow,
|
|
93
|
-
closePipWindow,
|
|
94
|
-
disabled: props.disabled ?? false
|
|
95
|
-
}));
|
|
96
|
-
return createComponent(PiPContext.Provider, {
|
|
97
|
-
value,
|
|
98
|
-
get children() {
|
|
99
|
-
return props.children;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
const usePiPWindow = () => {
|
|
104
|
-
const context = createMemo(() => {
|
|
105
|
-
const ctx = useContext(PiPContext);
|
|
106
|
-
if (!ctx) {
|
|
107
|
-
throw new Error("usePiPWindow must be used within a PiPProvider");
|
|
108
|
-
}
|
|
109
|
-
return ctx();
|
|
110
|
-
});
|
|
111
|
-
return context;
|
|
112
|
-
};
|
|
113
|
-
export {
|
|
114
|
-
PiPProvider,
|
|
115
|
-
usePiPWindow
|
|
116
|
-
};
|
|
117
|
-
//# sourceMappingURL=pip-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pip-context.js","sources":["../../../src/context/pip-context.tsx"],"sourcesContent":["import {\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n useContext,\n} from 'solid-js'\nimport { delegateEvents } from 'solid-js/web'\nimport type { Accessor, JSX } from 'solid-js'\n\ninterface PiPProviderProps {\n children: JSX.Element\n // localStore: StorageObject<string>\n // setLocalStore: StorageSetter<string, unknown>\n disabled?: boolean\n}\n\ntype PiPContextType = {\n pipWindow: Window | null\n requestPipWindow: (settings: string) => void\n closePipWindow: () => void\n disabled: boolean\n}\n\nconst PiPContext = createContext<Accessor<PiPContextType> | undefined>(\n undefined,\n)\n\nexport const PiPProvider = (props: PiPProviderProps) => {\n // Expose pipWindow that is currently active\n const [pipWindow, setPipWindow] = createSignal<Window | null>(null)\n\n // Close pipWindow programmatically\n const closePipWindow = () => {\n const w = pipWindow()\n if (w != null) {\n w.close()\n setPipWindow(null)\n }\n }\n\n // Open new pipWindow\n const requestPipWindow = (settings: string) => {\n // We don't want to allow multiple requests.\n if (pipWindow() != null) {\n return\n }\n\n const pip = window.open('', 'TSDT-Devtools-Panel', `${settings},popup`)\n\n if (!pip) {\n throw new Error(\n 'Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.',\n )\n }\n\n const meta = typeof import.meta !== 'undefined' ? import.meta : null\n\n meta?.hot?.on('vite:beforeUpdate', () => {\n localStorage.setItem('pip_open', 'false')\n closePipWindow()\n })\n window.addEventListener('beforeunload', () => {\n localStorage.setItem('pip_open', 'false')\n closePipWindow()\n })\n // Remove existing styles\n pip.document.head.innerHTML = ''\n // Remove existing body\n pip.document.body.innerHTML = ''\n\n pip.document.title = 'TanStack Devtools'\n pip.document.body.style.margin = '0'\n\n // Detect when window is closed by user\n pip.addEventListener('pagehide', () => {\n localStorage.setItem('pip_open', 'false')\n closePipWindow()\n })\n\n // It is important to copy all parent window styles. Otherwise, there would be no CSS available at all\n // https://developer.chrome.com/docs/web-platform/document-picture-in-picture/#copy-style-sheets-to-the-picture-in-picture-window\n ;[...document.styleSheets].forEach((styleSheet) => {\n try {\n const cssRules = [...styleSheet.cssRules]\n .map((rule) => rule.cssText)\n .join('')\n const style = document.createElement('style')\n const style_node = styleSheet.ownerNode\n let style_id = ''\n\n if (style_node && 'id' in style_node) {\n style_id = style_node.id\n }\n\n if (style_id) {\n style.setAttribute('id', style_id)\n }\n style.textContent = cssRules\n pip.document.head.appendChild(style)\n } catch (e) {\n const link = document.createElement('link')\n if (styleSheet.href == null) {\n return\n }\n\n link.rel = 'stylesheet'\n link.type = styleSheet.type\n link.media = styleSheet.media.toString()\n link.href = styleSheet.href\n pip.document.head.appendChild(link)\n }\n })\n delegateEvents(\n [\n 'focusin',\n 'focusout',\n 'pointermove',\n 'keydown',\n 'pointerdown',\n 'pointerup',\n 'click',\n 'mousedown',\n 'input',\n ],\n pip.document,\n )\n\n setPipWindow(pip)\n }\n\n createEffect(() => {\n // Setup mutation observer for goober styles with id `_goober\n const gooberStyles = document.querySelector('#_goober')\n const w = pipWindow()\n if (gooberStyles && w) {\n const observer = new MutationObserver(() => {\n const pip_style = w.document.querySelector('#_goober')\n if (pip_style) {\n pip_style.textContent = gooberStyles.textContent\n }\n })\n observer.observe(gooberStyles, {\n childList: true, // observe direct children\n subtree: true, // and lower descendants too\n characterDataOldValue: true, // pass old data to callback\n })\n onCleanup(() => {\n observer.disconnect()\n })\n }\n })\n\n const value = createMemo(() => ({\n pipWindow: pipWindow(),\n requestPipWindow,\n closePipWindow,\n disabled: props.disabled ?? false,\n }))\n\n return (\n <PiPContext.Provider value={value}>{props.children}</PiPContext.Provider>\n )\n}\n\nexport const usePiPWindow = () => {\n const context = createMemo(() => {\n const ctx = useContext(PiPContext)\n if (!ctx) {\n throw new Error('usePiPWindow must be used within a PiPProvider')\n }\n return ctx()\n })\n return context\n}\n"],"names":["PiPContext","createContext","undefined","PiPProvider","props","pipWindow","setPipWindow","createSignal","closePipWindow","w","close","requestPipWindow","settings","pip","window","open","Error","meta","import","hot","on","localStorage","setItem","addEventListener","document","head","innerHTML","body","title","style","margin","styleSheets","forEach","styleSheet","cssRules","map","rule","cssText","join","createElement","style_node","ownerNode","style_id","id","setAttribute","textContent","appendChild","e","link","href","rel","type","media","toString","delegateEvents","createEffect","gooberStyles","querySelector","observer","MutationObserver","pip_style","observe","childList","subtree","characterDataOldValue","onCleanup","disconnect","value","createMemo","disabled","_$createComponent","Provider","children","usePiPWindow","context","ctx","useContext"],"mappings":"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"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { DevtoolsStore } from './devtools-store.js';
|
|
2
|
-
export declare function useTheme(): {
|
|
3
|
-
theme: import('solid-js').Accessor<"light" | "dark">;
|
|
4
|
-
setTheme: (theme: DevtoolsStore["settings"]["theme"]) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const usePlugins: () => {
|
|
7
|
-
plugins: import('solid-js').Accessor<import('./devtools-context.jsx').TanStackDevtoolsPlugin[] | undefined>;
|
|
8
|
-
setActivePlugin: (pluginId: string) => void;
|
|
9
|
-
activePlugin: import('solid-js').Accessor<string | undefined>;
|
|
10
|
-
};
|
|
11
|
-
export declare const useDevtoolsState: () => {
|
|
12
|
-
state: import('solid-js').Accessor<{
|
|
13
|
-
activeTab: import('../tabs/index.jsx').TabName;
|
|
14
|
-
height: number;
|
|
15
|
-
activePlugin?: string | undefined;
|
|
16
|
-
persistOpen: boolean;
|
|
17
|
-
}>;
|
|
18
|
-
setState: (newState: Partial<DevtoolsStore["state"]>) => void;
|
|
19
|
-
};
|
|
20
|
-
export declare const useDevtoolsSettings: () => {
|
|
21
|
-
setSettings: (newSettings: Partial<DevtoolsStore["settings"]>) => void;
|
|
22
|
-
settings: import('solid-js').Accessor<{
|
|
23
|
-
defaultOpen: boolean;
|
|
24
|
-
hideUntilHover: boolean;
|
|
25
|
-
position: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "middle-left" | "middle-right";
|
|
26
|
-
panelLocation: "top" | "bottom";
|
|
27
|
-
openHotkey: Array<(string & {}) | ("Alt" | "Control" | "Meta" | "Shift")>;
|
|
28
|
-
requireUrlFlag: boolean;
|
|
29
|
-
urlFlag: string;
|
|
30
|
-
theme: "light" | "dark";
|
|
31
|
-
}>;
|
|
32
|
-
};
|
|
33
|
-
export declare const usePersistOpen: () => {
|
|
34
|
-
persistOpen: import('solid-js').Accessor<boolean>;
|
|
35
|
-
setPersistOpen: (value: boolean) => void;
|
|
36
|
-
};
|
|
37
|
-
export declare const useHeight: () => {
|
|
38
|
-
height: import('solid-js').Accessor<number>;
|
|
39
|
-
setHeight: (newHeight: number) => void;
|
|
40
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { createMemo, useContext, createEffect } from "solid-js";
|
|
2
|
-
import { DevtoolsContext } from "./devtools-context.js";
|
|
3
|
-
import { useDrawContext } from "./draw-context.js";
|
|
4
|
-
const useDevtoolsContext = () => {
|
|
5
|
-
const context = useContext(DevtoolsContext);
|
|
6
|
-
if (context === void 0) {
|
|
7
|
-
throw new Error(
|
|
8
|
-
"useDevtoolsShellContext must be used within a ShellContextProvider"
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
return context;
|
|
12
|
-
};
|
|
13
|
-
function useTheme() {
|
|
14
|
-
const { settings, setSettings } = useDevtoolsSettings();
|
|
15
|
-
const theme = createMemo(() => settings().theme);
|
|
16
|
-
return {
|
|
17
|
-
theme,
|
|
18
|
-
setTheme: (theme2) => setSettings({ theme: theme2 })
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const usePlugins = () => {
|
|
22
|
-
const { store, setStore } = useDevtoolsContext();
|
|
23
|
-
const { setForceExpand } = useDrawContext();
|
|
24
|
-
const plugins = createMemo(() => store.plugins);
|
|
25
|
-
const activePlugin = createMemo(() => store.state.activePlugin);
|
|
26
|
-
createEffect(() => {
|
|
27
|
-
if (activePlugin() == null) {
|
|
28
|
-
setForceExpand(false);
|
|
29
|
-
} else {
|
|
30
|
-
setForceExpand(true);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const setActivePlugin = (pluginId) => {
|
|
34
|
-
setStore((prev) => ({
|
|
35
|
-
...prev,
|
|
36
|
-
state: {
|
|
37
|
-
...prev.state,
|
|
38
|
-
activePlugin: pluginId
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
};
|
|
42
|
-
return { plugins, setActivePlugin, activePlugin };
|
|
43
|
-
};
|
|
44
|
-
const useDevtoolsState = () => {
|
|
45
|
-
const { store, setStore } = useDevtoolsContext();
|
|
46
|
-
const state = createMemo(() => store.state);
|
|
47
|
-
const setState = (newState) => {
|
|
48
|
-
setStore((prev) => ({
|
|
49
|
-
...prev,
|
|
50
|
-
state: {
|
|
51
|
-
...prev.state,
|
|
52
|
-
...newState
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
55
|
-
};
|
|
56
|
-
return { state, setState };
|
|
57
|
-
};
|
|
58
|
-
const useDevtoolsSettings = () => {
|
|
59
|
-
const { store, setStore } = useDevtoolsContext();
|
|
60
|
-
const settings = createMemo(() => store.settings);
|
|
61
|
-
const setSettings = (newSettings) => {
|
|
62
|
-
setStore((prev) => ({
|
|
63
|
-
...prev,
|
|
64
|
-
settings: {
|
|
65
|
-
...prev.settings,
|
|
66
|
-
...newSettings
|
|
67
|
-
}
|
|
68
|
-
}));
|
|
69
|
-
};
|
|
70
|
-
return { setSettings, settings };
|
|
71
|
-
};
|
|
72
|
-
const usePersistOpen = () => {
|
|
73
|
-
const { state, setState } = useDevtoolsState();
|
|
74
|
-
const persistOpen = createMemo(() => state().persistOpen);
|
|
75
|
-
const setPersistOpen = (value) => {
|
|
76
|
-
setState({ persistOpen: value });
|
|
77
|
-
};
|
|
78
|
-
return { persistOpen, setPersistOpen };
|
|
79
|
-
};
|
|
80
|
-
const useHeight = () => {
|
|
81
|
-
const { state, setState } = useDevtoolsState();
|
|
82
|
-
const height = createMemo(() => state().height);
|
|
83
|
-
const setHeight = (newHeight) => {
|
|
84
|
-
setState({ height: newHeight });
|
|
85
|
-
};
|
|
86
|
-
return { height, setHeight };
|
|
87
|
-
};
|
|
88
|
-
export {
|
|
89
|
-
useDevtoolsSettings,
|
|
90
|
-
useDevtoolsState,
|
|
91
|
-
useHeight,
|
|
92
|
-
usePersistOpen,
|
|
93
|
-
usePlugins,
|
|
94
|
-
useTheme
|
|
95
|
-
};
|
|
96
|
-
//# sourceMappingURL=use-devtools-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-devtools-context.js","sources":["../../../src/context/use-devtools-context.ts"],"sourcesContent":["import { createEffect, createMemo, useContext } from 'solid-js'\nimport { DevtoolsContext } from './devtools-context.jsx'\nimport { useDrawContext } from './draw-context.jsx'\n\nimport type { DevtoolsStore } from './devtools-store.js'\n\n/**\n * Returns an object containing the current state and setState function of the ShellContext.\n * Throws an error if used outside of a ShellContextProvider.\n */\nconst useDevtoolsContext = () => {\n const context = useContext(DevtoolsContext)\n if (context === undefined) {\n throw new Error(\n 'useDevtoolsShellContext must be used within a ShellContextProvider',\n )\n }\n return context\n}\n\nexport function useTheme() {\n const { settings, setSettings } = useDevtoolsSettings()\n const theme = createMemo(() => settings().theme)\n return {\n theme,\n setTheme: (theme: DevtoolsStore['settings']['theme']) =>\n setSettings({ theme }),\n }\n}\n\nexport const usePlugins = () => {\n const { store, setStore } = useDevtoolsContext()\n const { setForceExpand } = useDrawContext()\n\n const plugins = createMemo(() => store.plugins)\n const activePlugin = createMemo(() => store.state.activePlugin)\n\n createEffect(() => {\n if (activePlugin() == null) {\n setForceExpand(false)\n } else {\n setForceExpand(true)\n }\n })\n\n const setActivePlugin = (pluginId: string) => {\n setStore((prev) => ({\n ...prev,\n state: {\n ...prev.state,\n activePlugin: pluginId,\n },\n }))\n }\n\n return { plugins, setActivePlugin, activePlugin }\n}\n\nexport const useDevtoolsState = () => {\n const { store, setStore } = useDevtoolsContext()\n const state = createMemo(() => store.state)\n const setState = (newState: Partial<DevtoolsStore['state']>) => {\n setStore((prev) => ({\n ...prev,\n state: {\n ...prev.state,\n ...newState,\n },\n }))\n }\n return { state, setState }\n}\n\nexport const useDevtoolsSettings = () => {\n const { store, setStore } = useDevtoolsContext()\n\n const settings = createMemo(() => store.settings)\n\n const setSettings = (newSettings: Partial<DevtoolsStore['settings']>) => {\n setStore((prev) => ({\n ...prev,\n settings: {\n ...prev.settings,\n ...newSettings,\n },\n }))\n }\n\n return { setSettings, settings }\n}\n\nexport const usePersistOpen = () => {\n const { state, setState } = useDevtoolsState()\n\n const persistOpen = createMemo(() => state().persistOpen)\n\n const setPersistOpen = (value: boolean) => {\n setState({ persistOpen: value })\n }\n\n return { persistOpen, setPersistOpen }\n}\n\nexport const useHeight = () => {\n const { state, setState } = useDevtoolsState()\n\n const height = createMemo(() => state().height)\n\n const setHeight = (newHeight: number) => {\n setState({ height: newHeight })\n }\n\n return { height, setHeight }\n}\n"],"names":["theme"],"mappings":";;;AAUA,MAAM,qBAAqB,MAAM;AAC/B,QAAM,UAAU,WAAW,eAAe;AAC1C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;AAEO,SAAS,WAAW;AACzB,QAAM,EAAE,UAAU,YAAA,IAAgB,oBAAA;AAClC,QAAM,QAAQ,WAAW,MAAM,SAAA,EAAW,KAAK;AAC/C,SAAO;AAAA,IACL;AAAA,IACA,UAAU,CAACA,WACT,YAAY,EAAE,OAAAA,QAAO;AAAA,EAAA;AAE3B;AAEO,MAAM,aAAa,MAAM;AAC9B,QAAM,EAAE,OAAO,SAAA,IAAa,mBAAA;AAC5B,QAAM,EAAE,eAAA,IAAmB,eAAA;AAE3B,QAAM,UAAU,WAAW,MAAM,MAAM,OAAO;AAC9C,QAAM,eAAe,WAAW,MAAM,MAAM,MAAM,YAAY;AAE9D,eAAa,MAAM;AACjB,QAAI,aAAA,KAAkB,MAAM;AAC1B,qBAAe,KAAK;AAAA,IACtB,OAAO;AACL,qBAAe,IAAI;AAAA,IACrB;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,CAAC,aAAqB;AAC5C,aAAS,CAAC,UAAU;AAAA,MAClB,GAAG;AAAA,MACH,OAAO;AAAA,QACL,GAAG,KAAK;AAAA,QACR,cAAc;AAAA,MAAA;AAAA,IAChB,EACA;AAAA,EACJ;AAEA,SAAO,EAAE,SAAS,iBAAiB,aAAA;AACrC;AAEO,MAAM,mBAAmB,MAAM;AACpC,QAAM,EAAE,OAAO,SAAA,IAAa,mBAAA;AAC5B,QAAM,QAAQ,WAAW,MAAM,MAAM,KAAK;AAC1C,QAAM,WAAW,CAAC,aAA8C;AAC9D,aAAS,CAAC,UAAU;AAAA,MAClB,GAAG;AAAA,MACH,OAAO;AAAA,QACL,GAAG,KAAK;AAAA,QACR,GAAG;AAAA,MAAA;AAAA,IACL,EACA;AAAA,EACJ;AACA,SAAO,EAAE,OAAO,SAAA;AAClB;AAEO,MAAM,sBAAsB,MAAM;AACvC,QAAM,EAAE,OAAO,SAAA,IAAa,mBAAA;AAE5B,QAAM,WAAW,WAAW,MAAM,MAAM,QAAQ;AAEhD,QAAM,cAAc,CAAC,gBAAoD;AACvE,aAAS,CAAC,UAAU;AAAA,MAClB,GAAG;AAAA,MACH,UAAU;AAAA,QACR,GAAG,KAAK;AAAA,QACR,GAAG;AAAA,MAAA;AAAA,IACL,EACA;AAAA,EACJ;AAEA,SAAO,EAAE,aAAa,SAAA;AACxB;AAEO,MAAM,iBAAiB,MAAM;AAClC,QAAM,EAAE,OAAO,SAAA,IAAa,iBAAA;AAE5B,QAAM,cAAc,WAAW,MAAM,MAAA,EAAQ,WAAW;AAExD,QAAM,iBAAiB,CAAC,UAAmB;AACzC,aAAS,EAAE,aAAa,OAAO;AAAA,EACjC;AAEA,SAAO,EAAE,aAAa,eAAA;AACxB;AAEO,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,OAAO,SAAA,IAAa,iBAAA;AAE5B,QAAM,SAAS,WAAW,MAAM,MAAA,EAAQ,MAAM;AAE9C,QAAM,YAAY,CAAC,cAAsB;AACvC,aAAS,EAAE,QAAQ,WAAW;AAAA,EAChC;AAEA,SAAO,EAAE,QAAQ,UAAA;AACnB;"}
|