@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.
@@ -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 interface EfpDebugGlobal {
17
- settings?: Record<string, GlobalSettingSchema>;
18
- }
13
+ export type EfpDebugUi = Record<string, GlobalSettingSchema>;
19
14
  declare global {
20
15
  interface Window {
21
- efpDebug?: EfpDebugGlobal;
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.efpDebug?.settings;
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
  });
@@ -1,7 +1,6 @@
1
1
  import { type DebugSetting } from './register-setting.js';
2
2
  export interface RegisterBooleanSettingOptions {
3
3
  key: string;
4
- label?: string;
5
4
  default?: boolean;
6
5
  onChange?: (value: boolean) => void;
7
6
  }
@@ -6,7 +6,6 @@ export function registerBooleanSetting(options) {
6
6
  })));
7
7
  return registerSetting({
8
8
  key: options.key,
9
- label: options.label,
10
9
  default: options.default ?? false,
11
10
  Editor: BooleanEditorLazy,
12
11
  onChange: options.onChange,
@@ -1,7 +1,6 @@
1
1
  import { type DebugSetting } from './register-setting.js';
2
2
  export interface RegisterEnumSettingOptions<T> {
3
3
  key: string;
4
- label?: string;
5
4
  values: readonly T[];
6
5
  default: T;
7
6
  onChange?: (value: T) => void;
@@ -6,7 +6,6 @@ export function registerEnumSetting(options) {
6
6
  })));
7
7
  return registerSetting({
8
8
  key: options.key,
9
- label: options.label,
10
9
  default: options.default,
11
10
  Editor: EnumEditorLazy,
12
11
  context: { values: options.values },
@@ -7,7 +7,6 @@ export interface DebugSetting<T> {
7
7
  }
8
8
  export interface RegisterSettingOptions<T, K = void> {
9
9
  key: string;
10
- label?: string;
11
10
  default: T;
12
11
  Editor: React.FC<EditorProps<T, K>>;
13
12
  context?: K;
@@ -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: label, value: state, context: context, onChange: setState });
53
+ return _jsx(Editor, { label: key, value: state, context: context, onChange: setState });
55
54
  };
56
- EditorImpl.displayName = `DebugSetting(${label})`;
55
+ EditorImpl.displayName = `DebugSetting(${key})`;
57
56
  editors.push(EditorImpl);
58
57
  return {
59
58
  get,
@@ -1,7 +1,6 @@
1
1
  import { type DebugSetting } from './register-setting.js';
2
2
  export interface RegisterStringSettingOptions {
3
3
  key: string;
4
- label?: string;
5
4
  default?: string;
6
5
  placeholder?: string;
7
6
  onChange?: (value: string) => void;
@@ -6,7 +6,6 @@ export function registerStringSetting(options) {
6
6
  })));
7
7
  return registerSetting({
8
8
  key: options.key,
9
- label: options.label,
10
9
  default: options.default ?? '',
11
10
  Editor: StringEditorLazy,
12
11
  context: { placeholder: options.placeholder },
@@ -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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/debug",
3
- "version": "3.1.15",
3
+ "version": "3.2.0",
4
4
  "type": "module",
5
5
  "description": "ExpoFP SDK internal: debug utilities",
6
6
  "homepage": "https://developer.expofp.com/",