@expofp/debug 3.11.12 → 3.12.1
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/debug-keys.d.ts +9 -0
- package/dist/lib/debug-keys.js +8 -0
- package/dist/lib/init-debug.js +13 -0
- package/dist/lib/settings/adopt-global-settings.d.ts +4 -13
- package/dist/lib/settings/adopt-global-settings.js +4 -35
- package/dist/lib/settings/index.d.ts +1 -0
- package/dist/lib/settings/index.js +1 -0
- package/dist/lib/settings/register-enum-setting.js +5 -0
- package/dist/lib/settings/register-setting.js +19 -5
- package/dist/lib/settings/register-settings.d.ts +40 -0
- package/dist/lib/settings/register-settings.js +101 -0
- package/dist/lib/settings/reset-all-settings.js +2 -2
- package/dist/lib/settings/setting-registry.d.ts +6 -3
- package/dist/lib/settings/setting-registry.js +2 -2
- package/dist/lib/ui/optional-boolean-editor.d.ts +4 -0
- package/dist/lib/ui/optional-boolean-editor.js +8 -0
- package/dist/lib/ui/optional-enum-editor.d.ts +5 -0
- package/dist/lib/ui/optional-enum-editor.js +12 -0
- package/dist/lib/ui/optional-string-editor.d.ts +6 -0
- package/dist/lib/ui/optional-string-editor.js +8 -0
- package/dist/lib/ui/render-debug-ui.js +3 -2
- package/dist/lib/ui/settings-list.js +4 -2
- package/package.json +3 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage keys of the debug package's own settings. Both are
|
|
3
|
+
* `LocalStorageConfigSchema` fields (`efp-` + field name), so the debug panel
|
|
4
|
+
* and the config's localStorage layer read the same values — but the debug
|
|
5
|
+
* package needs them before any config exists, hence the literals here.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEBUG_PATTERN_KEY = "efp-debugPattern";
|
|
8
|
+
export declare const SHOW_DEBUG_BUTTON_KEY = "efp-showDebugButton";
|
|
9
|
+
//# sourceMappingURL=debug-keys.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage keys of the debug package's own settings. Both are
|
|
3
|
+
* `LocalStorageConfigSchema` fields (`efp-` + field name), so the debug panel
|
|
4
|
+
* and the config's localStorage layer read the same values — but the debug
|
|
5
|
+
* package needs them before any config exists, hence the literals here.
|
|
6
|
+
*/
|
|
7
|
+
export const DEBUG_PATTERN_KEY = 'efp-debugPattern';
|
|
8
|
+
export const SHOW_DEBUG_BUTTON_KEY = 'efp-showDebugButton';
|
package/dist/lib/init-debug.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import { safeLocalStorage } from '@expofp/utils';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
import { DEBUG_PATTERN_KEY } from './debug-keys.js';
|
|
1
4
|
import { appendLog } from './log-store.js';
|
|
2
5
|
const hasDom = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
6
|
+
if (hasDom) {
|
|
7
|
+
// The debug library self-initializes from its own `debug` localStorage key;
|
|
8
|
+
// apply the SDK's persisted pattern (the panel's `efp-debugPattern` setting,
|
|
9
|
+
// also the config's localStorage layer) on top, before the first loggers
|
|
10
|
+
// fire. Guarded read: this runs at module-eval, where a cookie-blocked
|
|
11
|
+
// cross-origin iframe throwing SecurityError would kill the whole SDK.
|
|
12
|
+
const pattern = safeLocalStorage()?.getItem(DEBUG_PATTERN_KEY);
|
|
13
|
+
if (pattern)
|
|
14
|
+
debug.enable(pattern);
|
|
15
|
+
}
|
|
3
16
|
if (hasDom && typeof console !== 'undefined') {
|
|
4
17
|
const wrap = (level, original) => (...args) => {
|
|
5
18
|
appendLog({ level, args, ts: Date.now() });
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} | {
|
|
5
|
-
type: 'string';
|
|
6
|
-
default?: string;
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
} | {
|
|
9
|
-
type: 'enum';
|
|
10
|
-
values: readonly string[];
|
|
11
|
-
default: string;
|
|
12
|
-
};
|
|
13
|
-
export type EfpDebugUi = Record<string, GlobalSettingSchema>;
|
|
1
|
+
import { type SettingDescriptor } from './register-settings.js';
|
|
2
|
+
export type GlobalSettingSchema = SettingDescriptor;
|
|
3
|
+
export type EfpDebugUi = Record<string, SettingDescriptor>;
|
|
14
4
|
declare global {
|
|
15
5
|
interface Window {
|
|
16
6
|
efpDebugUi?: EfpDebugUi;
|
|
17
7
|
}
|
|
18
8
|
}
|
|
9
|
+
/** Declare the host page's `window.efpDebugUi` settings (see {@link registerSettings}). */
|
|
19
10
|
export declare function adoptGlobalSettings(): void;
|
|
20
11
|
//# sourceMappingURL=adopt-global-settings.d.ts.map
|
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { registerStringSetting } from './register-string-setting.js';
|
|
4
|
-
const adopted = new Set();
|
|
1
|
+
import { registerSettings } from './register-settings.js';
|
|
2
|
+
/** Declare the host page's `window.efpDebugUi` settings (see {@link registerSettings}). */
|
|
5
3
|
export function adoptGlobalSettings() {
|
|
6
|
-
if (typeof window === 'undefined')
|
|
4
|
+
if (typeof window === 'undefined' || !window.efpDebugUi)
|
|
7
5
|
return;
|
|
8
|
-
|
|
9
|
-
if (!settings)
|
|
10
|
-
return;
|
|
11
|
-
for (const [key, schema] of Object.entries(settings)) {
|
|
12
|
-
if (adopted.has(key))
|
|
13
|
-
continue;
|
|
14
|
-
adopted.add(key);
|
|
15
|
-
switch (schema.type) {
|
|
16
|
-
case 'boolean':
|
|
17
|
-
registerBooleanSetting({
|
|
18
|
-
key,
|
|
19
|
-
default: schema.default,
|
|
20
|
-
});
|
|
21
|
-
break;
|
|
22
|
-
case 'string':
|
|
23
|
-
registerStringSetting({
|
|
24
|
-
key,
|
|
25
|
-
default: schema.default,
|
|
26
|
-
placeholder: schema.placeholder,
|
|
27
|
-
});
|
|
28
|
-
break;
|
|
29
|
-
case 'enum':
|
|
30
|
-
registerEnumSetting({
|
|
31
|
-
key,
|
|
32
|
-
values: schema.values,
|
|
33
|
-
default: schema.default,
|
|
34
|
-
});
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
6
|
+
registerSettings(window.efpDebugUi);
|
|
38
7
|
}
|
|
@@ -2,6 +2,7 @@ export * from './adopt-global-settings.js';
|
|
|
2
2
|
export * from './register-boolean-setting.js';
|
|
3
3
|
export * from './register-enum-setting.js';
|
|
4
4
|
export * from './register-setting.js';
|
|
5
|
+
export * from './register-settings.js';
|
|
5
6
|
export * from './register-string-setting.js';
|
|
6
7
|
export * from './reset-all-settings.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,5 +2,6 @@ export * from './adopt-global-settings.js';
|
|
|
2
2
|
export * from './register-boolean-setting.js';
|
|
3
3
|
export * from './register-enum-setting.js';
|
|
4
4
|
export * from './register-setting.js';
|
|
5
|
+
export * from './register-settings.js';
|
|
5
6
|
export * from './register-string-setting.js';
|
|
6
7
|
export * from './reset-all-settings.js';
|
|
@@ -4,11 +4,16 @@ export function registerEnumSetting(options) {
|
|
|
4
4
|
const EnumEditorLazy = React.lazy(() => import('../ui/enum-editor.js').then((mod) => ({
|
|
5
5
|
default: mod.EnumEditor,
|
|
6
6
|
})));
|
|
7
|
+
// Strings are stored as-is — the plain-scalar format of @expofp/config's
|
|
8
|
+
// localStorage codec; non-string values fall back to JSON.
|
|
9
|
+
const serialize = (v) => (typeof v === 'string' ? v : JSON.stringify(v));
|
|
7
10
|
return registerSetting({
|
|
8
11
|
key: options.key,
|
|
9
12
|
default: options.default,
|
|
10
13
|
Editor: EnumEditorLazy,
|
|
11
14
|
context: { values: options.values },
|
|
12
15
|
onChange: options.onChange,
|
|
16
|
+
serialize,
|
|
17
|
+
deserialize: (raw) => options.values.find((v) => serialize(v) === raw) ?? options.default,
|
|
13
18
|
});
|
|
14
19
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import debug from 'debug';
|
|
2
3
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
+
import { registry } from './setting-registry.js';
|
|
5
|
+
const log = debug('efp:debug');
|
|
4
6
|
const LOCAL_STORAGE_EVENT = 'efp-local-storage';
|
|
5
7
|
export function registerSetting(options) {
|
|
6
8
|
const { key, default: defaultValue, Editor, context, onChange, serialize = JSON.stringify, deserialize = (raw) => JSON.parse(raw), } = options;
|
|
9
|
+
const existing = registry.get(key);
|
|
10
|
+
if (existing) {
|
|
11
|
+
log('registerSetting', 'duplicate key, keeping the first registration:', key);
|
|
12
|
+
return existing.setting;
|
|
13
|
+
}
|
|
7
14
|
const get = () => {
|
|
8
15
|
const raw = localStorage.getItem(key);
|
|
9
16
|
if (raw === null)
|
|
@@ -16,7 +23,14 @@ export function registerSetting(options) {
|
|
|
16
23
|
}
|
|
17
24
|
};
|
|
18
25
|
const set = (value) => {
|
|
19
|
-
|
|
26
|
+
if (value === undefined) {
|
|
27
|
+
// An optional setting explicitly unset — the key's absence means "no
|
|
28
|
+
// opinion" (for config-backed settings, the lower config layers win).
|
|
29
|
+
localStorage.removeItem(key);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
localStorage.setItem(key, serialize(value));
|
|
33
|
+
}
|
|
20
34
|
onChange?.(value);
|
|
21
35
|
emitLocalStorageChange(key);
|
|
22
36
|
};
|
|
@@ -25,7 +39,6 @@ export function registerSetting(options) {
|
|
|
25
39
|
onChange?.(defaultValue);
|
|
26
40
|
emitLocalStorageChange(key);
|
|
27
41
|
};
|
|
28
|
-
resets.push(reset);
|
|
29
42
|
function useLocalStorageState() {
|
|
30
43
|
const [state, setState] = useState(get());
|
|
31
44
|
useEffect(() => {
|
|
@@ -53,13 +66,14 @@ export function registerSetting(options) {
|
|
|
53
66
|
return _jsx(Editor, { label: key, value: state, context: context, onChange: setState });
|
|
54
67
|
};
|
|
55
68
|
EditorImpl.displayName = `DebugSetting(${key})`;
|
|
56
|
-
|
|
57
|
-
return {
|
|
69
|
+
const setting = {
|
|
58
70
|
get,
|
|
59
71
|
set,
|
|
60
72
|
reset,
|
|
61
73
|
useState: useLocalStorageState,
|
|
62
74
|
};
|
|
75
|
+
registry.set(key, { key, Editor: EditorImpl, setting, reset });
|
|
76
|
+
return setting;
|
|
63
77
|
}
|
|
64
78
|
function emitLocalStorageChange(key) {
|
|
65
79
|
window.dispatchEvent(new CustomEvent(LOCAL_STORAGE_EVENT, { detail: { key } }));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A declarative debug setting — plain data, so descriptors can come from
|
|
3
|
+
* anywhere: the host page's `window.efpDebugUi`, or `@expofp/config`'s
|
|
4
|
+
* `toDebugSettings(...)` (one descriptor per `LocalStorageConfigSchema` field,
|
|
5
|
+
* under the storage key the config's localStorage layer reads).
|
|
6
|
+
*
|
|
7
|
+
* An `optional` setting treats the key's absence as an explicit "default"
|
|
8
|
+
* state: editors render it, picking it removes the key — for config-backed
|
|
9
|
+
* settings that hands the decision back to the lower config layers. Values are
|
|
10
|
+
* stored as plain scalar strings, matching `@expofp/config`'s localStorage
|
|
11
|
+
* codec.
|
|
12
|
+
*/
|
|
13
|
+
export type SettingDescriptor = {
|
|
14
|
+
type: 'boolean';
|
|
15
|
+
optional?: boolean;
|
|
16
|
+
default?: boolean;
|
|
17
|
+
onChange?: (value: boolean | undefined) => void;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'string';
|
|
20
|
+
optional?: boolean;
|
|
21
|
+
default?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
onChange?: (value: string | undefined) => void;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'enum';
|
|
26
|
+
values: readonly string[];
|
|
27
|
+
optional?: boolean;
|
|
28
|
+
default?: string;
|
|
29
|
+
onChange?: (value: string | undefined) => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Declare settings for the debug panel. Descriptors are materialized into
|
|
33
|
+
* editors when the panel renders; per key, the first declaration wins — and a
|
|
34
|
+
* key registered imperatively (`registerSetting` and friends) by then keeps
|
|
35
|
+
* that richer registration.
|
|
36
|
+
*/
|
|
37
|
+
export declare function registerSettings(settings: Record<string, SettingDescriptor>): void;
|
|
38
|
+
/** Materialize declared descriptors into setting editors (idempotent). */
|
|
39
|
+
export declare function materializeSettings(): void;
|
|
40
|
+
//# sourceMappingURL=register-settings.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { registerBooleanSetting } from './register-boolean-setting.js';
|
|
3
|
+
import { registerEnumSetting } from './register-enum-setting.js';
|
|
4
|
+
import { registerSetting } from './register-setting.js';
|
|
5
|
+
import { registerStringSetting } from './register-string-setting.js';
|
|
6
|
+
import { registry } from './setting-registry.js';
|
|
7
|
+
const pending = new Map();
|
|
8
|
+
/**
|
|
9
|
+
* Declare settings for the debug panel. Descriptors are materialized into
|
|
10
|
+
* editors when the panel renders; per key, the first declaration wins — and a
|
|
11
|
+
* key registered imperatively (`registerSetting` and friends) by then keeps
|
|
12
|
+
* that richer registration.
|
|
13
|
+
*/
|
|
14
|
+
export function registerSettings(settings) {
|
|
15
|
+
for (const [key, descriptor] of Object.entries(settings)) {
|
|
16
|
+
if (!pending.has(key))
|
|
17
|
+
pending.set(key, descriptor);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Materialize declared descriptors into setting editors (idempotent). */
|
|
21
|
+
export function materializeSettings() {
|
|
22
|
+
for (const [key, descriptor] of pending) {
|
|
23
|
+
if (!registry.has(key))
|
|
24
|
+
register(key, descriptor);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const OptionalBooleanEditorLazy = React.lazy(() => import('../ui/optional-boolean-editor.js').then((mod) => ({
|
|
28
|
+
default: mod.OptionalBooleanEditor,
|
|
29
|
+
})));
|
|
30
|
+
const OptionalStringEditorLazy = React.lazy(() => import('../ui/optional-string-editor.js').then((mod) => ({
|
|
31
|
+
default: mod.OptionalStringEditor,
|
|
32
|
+
})));
|
|
33
|
+
const OptionalEnumEditorLazy = React.lazy(() => import('../ui/optional-enum-editor.js').then((mod) => ({
|
|
34
|
+
default: mod.OptionalEnumEditor,
|
|
35
|
+
})));
|
|
36
|
+
function register(key, descriptor) {
|
|
37
|
+
switch (descriptor.type) {
|
|
38
|
+
case 'boolean':
|
|
39
|
+
if (descriptor.optional) {
|
|
40
|
+
registerSetting({
|
|
41
|
+
key,
|
|
42
|
+
default: undefined,
|
|
43
|
+
Editor: OptionalBooleanEditorLazy,
|
|
44
|
+
onChange: descriptor.onChange,
|
|
45
|
+
serialize: String,
|
|
46
|
+
// mirrors @expofp/config's localStorage codec coercion
|
|
47
|
+
deserialize: (raw) => /^(1|true|yes|on)$/i.test(raw),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
registerBooleanSetting({
|
|
52
|
+
key,
|
|
53
|
+
default: descriptor.default,
|
|
54
|
+
onChange: descriptor.onChange,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
case 'string':
|
|
59
|
+
if (descriptor.optional) {
|
|
60
|
+
registerSetting({
|
|
61
|
+
key,
|
|
62
|
+
default: undefined,
|
|
63
|
+
Editor: OptionalStringEditorLazy,
|
|
64
|
+
context: { placeholder: descriptor.placeholder },
|
|
65
|
+
onChange: descriptor.onChange,
|
|
66
|
+
serialize: (value) => value, // set() never serializes undefined
|
|
67
|
+
deserialize: (raw) => raw,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
registerStringSetting({
|
|
72
|
+
key,
|
|
73
|
+
default: descriptor.default,
|
|
74
|
+
placeholder: descriptor.placeholder,
|
|
75
|
+
onChange: descriptor.onChange,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
case 'enum':
|
|
80
|
+
if (descriptor.optional) {
|
|
81
|
+
registerSetting({
|
|
82
|
+
key,
|
|
83
|
+
default: undefined,
|
|
84
|
+
Editor: OptionalEnumEditorLazy,
|
|
85
|
+
context: { values: descriptor.values },
|
|
86
|
+
onChange: descriptor.onChange,
|
|
87
|
+
serialize: (value) => value, // set() never serializes undefined
|
|
88
|
+
deserialize: (raw) => raw,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
registerEnumSetting({
|
|
93
|
+
key,
|
|
94
|
+
values: descriptor.values,
|
|
95
|
+
default: descriptor.default ?? descriptor.values[0],
|
|
96
|
+
onChange: descriptor.onChange,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface RegisteredSetting {
|
|
3
3
|
key: string;
|
|
4
4
|
Editor: FC;
|
|
5
|
+
/** The `DebugSetting<T>` handle `registerSetting` returned for this key. */
|
|
6
|
+
setting: unknown;
|
|
7
|
+
reset: () => void;
|
|
5
8
|
}
|
|
6
|
-
|
|
7
|
-
export declare const
|
|
9
|
+
/** Every registered setting by storage key — the first registration wins. */
|
|
10
|
+
export declare const registry: Map<string, RegisteredSetting>;
|
|
8
11
|
//# sourceMappingURL=setting-registry.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export const
|
|
1
|
+
/** Every registered setting by storage key — the first registration wins. */
|
|
2
|
+
export const registry = new Map();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type EditorProps } from '../settings/editor-props.js';
|
|
2
|
+
/** Tri-state boolean: `default` (key absent — lower config layers decide) / on / off. */
|
|
3
|
+
export declare const OptionalBooleanEditor: React.FC<EditorProps<boolean | undefined>>;
|
|
4
|
+
//# sourceMappingURL=optional-boolean-editor.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { OptionalEnumEditor } from './optional-enum-editor.js';
|
|
3
|
+
const VALUES = ['on', 'off'];
|
|
4
|
+
/** Tri-state boolean: `default` (key absent — lower config layers decide) / on / off. */
|
|
5
|
+
export const OptionalBooleanEditor = (props) => {
|
|
6
|
+
return (_jsx(OptionalEnumEditor, { label: props.label, context: { values: VALUES }, value: props.value === undefined ? undefined : props.value ? 'on' : 'off', onChange: (value) => props.onChange(value === undefined ? undefined : value === 'on') }));
|
|
7
|
+
};
|
|
8
|
+
OptionalBooleanEditor.displayName = 'OptionalBooleanEditor';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select } from '@radix-ui/themes';
|
|
3
|
+
import { SettingsItem } from './settings-item.js';
|
|
4
|
+
// `undefined` (key absent — the lower config layers decide) rides through the
|
|
5
|
+
// Select as a sentinel, so a literal value spelled "default" stays representable.
|
|
6
|
+
const DEFAULT_SENTINEL = '__DEFAULT__';
|
|
7
|
+
export const OptionalEnumEditor = (props) => {
|
|
8
|
+
return (_jsx(SettingsItem, { label: props.label, children: _jsxs(Select.Root, { value: props.value ?? DEFAULT_SENTINEL, onValueChange: (selected) => {
|
|
9
|
+
props.onChange(selected === DEFAULT_SENTINEL ? undefined : selected);
|
|
10
|
+
}, children: [_jsx(Select.Trigger, {}), _jsxs(Select.Content, { children: [_jsx(Select.Item, { value: DEFAULT_SENTINEL, children: "default" }), props.context.values.map((value) => (_jsx(Select.Item, { value: value, children: value }, value)))] })] }) }));
|
|
11
|
+
};
|
|
12
|
+
OptionalEnumEditor.displayName = 'OptionalEnumEditor';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type EditorProps } from '../settings/editor-props.js';
|
|
2
|
+
/** A string setting where an empty input unsets the key (lower config layers decide). */
|
|
3
|
+
export declare const OptionalStringEditor: React.FC<EditorProps<string | undefined, {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
}>>;
|
|
6
|
+
//# sourceMappingURL=optional-string-editor.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TextField } from '@radix-ui/themes';
|
|
3
|
+
import { SettingsItem } from './settings-item.js';
|
|
4
|
+
/** A string setting where an empty input unsets the key (lower config layers decide). */
|
|
5
|
+
export const OptionalStringEditor = (props) => {
|
|
6
|
+
return (_jsx(SettingsItem, { label: props.label, children: _jsx(TextField.Root, { placeholder: props.context?.placeholder ?? 'default', value: props.value ?? '', onChange: (e) => props.onChange(e.target.value === '' ? undefined : e.target.value), style: { flexGrow: 1, minWidth: 220 } }) }));
|
|
7
|
+
};
|
|
8
|
+
OptionalStringEditor.displayName = 'OptionalStringEditor';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import debug from 'debug';
|
|
3
|
+
import { DEBUG_PATTERN_KEY, SHOW_DEBUG_BUTTON_KEY } from '../debug-keys.js';
|
|
3
4
|
import { registerBooleanSetting, registerStringSetting } from '../settings/index.js';
|
|
4
5
|
import { addDebugSecretListener } from '../utils/add-debug-secret-listener.js';
|
|
5
6
|
let rendered = false;
|
|
@@ -9,10 +10,10 @@ export function renderDebugUi() {
|
|
|
9
10
|
}
|
|
10
11
|
rendered = true;
|
|
11
12
|
const showDebugButtonSetting = registerBooleanSetting({
|
|
12
|
-
key:
|
|
13
|
+
key: SHOW_DEBUG_BUTTON_KEY,
|
|
13
14
|
});
|
|
14
15
|
registerStringSetting({
|
|
15
|
-
key:
|
|
16
|
+
key: DEBUG_PATTERN_KEY,
|
|
16
17
|
placeholder: 'e.g. efp:*',
|
|
17
18
|
onChange: (value) => {
|
|
18
19
|
if (value)
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Skeleton } from '@radix-ui/themes';
|
|
3
3
|
import { Suspense } from 'react';
|
|
4
4
|
import { adoptGlobalSettings } from '../settings/adopt-global-settings.js';
|
|
5
|
-
import {
|
|
5
|
+
import { materializeSettings } from '../settings/register-settings.js';
|
|
6
|
+
import { registry } from '../settings/setting-registry.js';
|
|
6
7
|
export const SettingsList = () => {
|
|
7
8
|
adoptGlobalSettings();
|
|
8
|
-
|
|
9
|
+
materializeSettings();
|
|
10
|
+
return [...registry.values()]
|
|
9
11
|
.sort((a, b) => a.key.localeCompare(b.key))
|
|
10
12
|
.map(({ key, Editor }) => (_jsx(Suspense, { fallback: _jsx(Skeleton, { height: "60px" }), children: _jsx(Editor, {}) }, key)));
|
|
11
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expofp/debug",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ExpoFP SDK internal: debug utilities",
|
|
6
6
|
"homepage": "https://developer.expofp.com/",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"@radix-ui/react-icons": "^1.3.2",
|
|
30
30
|
"@radix-ui/themes": "^3.2.1",
|
|
31
31
|
"debug": "^4.4.3",
|
|
32
|
-
"tslib": "^2.3.0"
|
|
32
|
+
"tslib": "^2.3.0",
|
|
33
|
+
"@expofp/utils": "3.12.1"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@types/react": "^19.2.17",
|