@expofp/debug 3.1.15 → 3.2.0
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/lib/settings/adopt-global-settings.d.ts +2 -7
- package/dist/lib/settings/adopt-global-settings.js +1 -4
- package/dist/lib/settings/register-boolean-setting.d.ts +0 -1
- package/dist/lib/settings/register-boolean-setting.js +0 -1
- package/dist/lib/settings/register-enum-setting.d.ts +0 -1
- package/dist/lib/settings/register-enum-setting.js +0 -1
- package/dist/lib/settings/register-setting.d.ts +0 -1
- package/dist/lib/settings/register-setting.js +2 -3
- package/dist/lib/settings/register-string-setting.d.ts +0 -1
- package/dist/lib/settings/register-string-setting.js +0 -1
- package/dist/lib/ui/render-debug-ui.js +0 -2
- package/package.json +1 -1
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
export type GlobalSettingSchema = {
|
|
2
2
|
type: 'boolean';
|
|
3
|
-
label?: string;
|
|
4
3
|
default?: boolean;
|
|
5
4
|
} | {
|
|
6
5
|
type: 'string';
|
|
7
|
-
label?: string;
|
|
8
6
|
default?: string;
|
|
9
7
|
placeholder?: string;
|
|
10
8
|
} | {
|
|
11
9
|
type: 'enum';
|
|
12
|
-
label?: string;
|
|
13
10
|
values: readonly string[];
|
|
14
11
|
default: string;
|
|
15
12
|
};
|
|
16
|
-
export
|
|
17
|
-
settings?: Record<string, GlobalSettingSchema>;
|
|
18
|
-
}
|
|
13
|
+
export type EfpDebugUi = Record<string, GlobalSettingSchema>;
|
|
19
14
|
declare global {
|
|
20
15
|
interface Window {
|
|
21
|
-
|
|
16
|
+
efpDebugUi?: EfpDebugUi;
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
19
|
export declare function adoptGlobalSettings(): void;
|
|
@@ -5,7 +5,7 @@ const adopted = new Set();
|
|
|
5
5
|
export function adoptGlobalSettings() {
|
|
6
6
|
if (typeof window === 'undefined')
|
|
7
7
|
return;
|
|
8
|
-
const settings = window.
|
|
8
|
+
const settings = window.efpDebugUi;
|
|
9
9
|
if (!settings)
|
|
10
10
|
return;
|
|
11
11
|
for (const [key, schema] of Object.entries(settings)) {
|
|
@@ -16,14 +16,12 @@ export function adoptGlobalSettings() {
|
|
|
16
16
|
case 'boolean':
|
|
17
17
|
registerBooleanSetting({
|
|
18
18
|
key,
|
|
19
|
-
label: schema.label,
|
|
20
19
|
default: schema.default,
|
|
21
20
|
});
|
|
22
21
|
break;
|
|
23
22
|
case 'string':
|
|
24
23
|
registerStringSetting({
|
|
25
24
|
key,
|
|
26
|
-
label: schema.label,
|
|
27
25
|
default: schema.default,
|
|
28
26
|
placeholder: schema.placeholder,
|
|
29
27
|
});
|
|
@@ -31,7 +29,6 @@ export function adoptGlobalSettings() {
|
|
|
31
29
|
case 'enum':
|
|
32
30
|
registerEnumSetting({
|
|
33
31
|
key,
|
|
34
|
-
label: schema.label,
|
|
35
32
|
values: schema.values,
|
|
36
33
|
default: schema.default,
|
|
37
34
|
});
|
|
@@ -4,7 +4,6 @@ import { editors, resets } from './setting-registry.js';
|
|
|
4
4
|
const LOCAL_STORAGE_EVENT = 'efp-local-storage';
|
|
5
5
|
export function registerSetting(options) {
|
|
6
6
|
const { key, default: defaultValue, Editor, context, onChange, serialize = JSON.stringify, deserialize = (raw) => JSON.parse(raw), } = options;
|
|
7
|
-
const label = options.label ?? key;
|
|
8
7
|
const get = () => {
|
|
9
8
|
const raw = localStorage.getItem(key);
|
|
10
9
|
if (raw === null)
|
|
@@ -51,9 +50,9 @@ export function registerSetting(options) {
|
|
|
51
50
|
}
|
|
52
51
|
const EditorImpl = () => {
|
|
53
52
|
const [state, setState] = useLocalStorageState();
|
|
54
|
-
return _jsx(Editor, { label:
|
|
53
|
+
return _jsx(Editor, { label: key, value: state, context: context, onChange: setState });
|
|
55
54
|
};
|
|
56
|
-
EditorImpl.displayName = `DebugSetting(${
|
|
55
|
+
EditorImpl.displayName = `DebugSetting(${key})`;
|
|
57
56
|
editors.push(EditorImpl);
|
|
58
57
|
return {
|
|
59
58
|
get,
|
|
@@ -10,11 +10,9 @@ export function renderDebugUi() {
|
|
|
10
10
|
rendered = true;
|
|
11
11
|
const showDebugButtonSetting = registerBooleanSetting({
|
|
12
12
|
key: 'efp:show-debug-button',
|
|
13
|
-
label: 'Show Debug Button Overlay',
|
|
14
13
|
});
|
|
15
14
|
registerStringSetting({
|
|
16
15
|
key: 'debug',
|
|
17
|
-
label: 'Debug namespaces',
|
|
18
16
|
placeholder: 'e.g. efp:*',
|
|
19
17
|
onChange: (value) => {
|
|
20
18
|
if (value)
|