@expofp/debug 3.3.8 → 3.4.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/init-debug.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { appendLog } from './log-store.js';
|
|
2
|
-
|
|
2
|
+
const hasDom = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
3
|
+
if (hasDom && typeof console !== 'undefined') {
|
|
3
4
|
const wrap = (level, original) => (...args) => {
|
|
4
5
|
appendLog({ level, args, ts: Date.now() });
|
|
5
6
|
original(...args);
|
|
@@ -15,7 +16,7 @@ if (typeof console !== 'undefined') {
|
|
|
15
16
|
console.warn = wrap('warn', originalWarn);
|
|
16
17
|
console.error = wrap('error', originalError);
|
|
17
18
|
}
|
|
18
|
-
if (
|
|
19
|
+
if (hasDom) {
|
|
19
20
|
import('./ui/index.js')
|
|
20
21
|
.then(({ renderDebugUi }) => {
|
|
21
22
|
renderDebugUi();
|
|
@@ -53,7 +53,7 @@ export function registerSetting(options) {
|
|
|
53
53
|
return _jsx(Editor, { label: key, value: state, context: context, onChange: setState });
|
|
54
54
|
};
|
|
55
55
|
EditorImpl.displayName = `DebugSetting(${key})`;
|
|
56
|
-
editors.push(EditorImpl);
|
|
56
|
+
editors.push({ key, Editor: EditorImpl });
|
|
57
57
|
return {
|
|
58
58
|
get,
|
|
59
59
|
set,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface RegisteredEditor {
|
|
3
|
+
key: string;
|
|
4
|
+
Editor: FC;
|
|
5
|
+
}
|
|
6
|
+
export declare const editors: RegisteredEditor[];
|
|
3
7
|
export declare const resets: (() => void)[];
|
|
4
8
|
//# sourceMappingURL=setting-registry.d.ts.map
|
package/dist/lib/ui/debug-ui.js
CHANGED
|
@@ -5,25 +5,25 @@ import { SideButton } from './side-button.js';
|
|
|
5
5
|
const LazyDebugOverlay = lazy(async () => ({
|
|
6
6
|
default: (await import('./debug-overlay.js')).DebugOverlay,
|
|
7
7
|
}));
|
|
8
|
-
|
|
8
|
+
const DEFAULT_HOST_SELECTOR = '[data-efp-floorplan-defaults]';
|
|
9
9
|
export const DebugUi = (props) => {
|
|
10
10
|
const [isOpen, setIsOpen] = useState(props.open);
|
|
11
11
|
const [debugButtonEnabled, setDebugButtonEnabled] = props.useDebugButtonState();
|
|
12
|
-
|
|
12
|
+
const selector = props.hostSelector ?? DEFAULT_HOST_SELECTOR;
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
return addDebugSecretListener(() => {
|
|
15
15
|
setDebugButtonEnabled(true);
|
|
16
16
|
setIsOpen(true);
|
|
17
17
|
});
|
|
18
18
|
}, []);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
// set visibility of efp floorplan to none when debug ui is open
|
|
20
|
+
// otherwise, z-index issues occur
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const efpFloorplan = document.querySelector(selector);
|
|
23
|
+
if (efpFloorplan) {
|
|
24
|
+
efpFloorplan.style.visibility = isOpen ? 'hidden' : 'visible';
|
|
25
|
+
}
|
|
26
|
+
}, [isOpen, selector]);
|
|
27
27
|
if (isOpen) {
|
|
28
28
|
return (_jsx(Suspense, { fallback: null, children: _jsx(LazyDebugOverlay, { onClose: () => {
|
|
29
29
|
setIsOpen(false);
|
|
@@ -5,5 +5,7 @@ import { adoptGlobalSettings } from '../settings/adopt-global-settings.js';
|
|
|
5
5
|
import { editors } from '../settings/setting-registry.js';
|
|
6
6
|
export const SettingsList = () => {
|
|
7
7
|
adoptGlobalSettings();
|
|
8
|
-
return editors
|
|
8
|
+
return [...editors]
|
|
9
|
+
.sort((a, b) => a.key.localeCompare(b.key))
|
|
10
|
+
.map(({ key, Editor }) => (_jsx(Suspense, { fallback: _jsx(Skeleton, { height: "60px" }), children: _jsx(Editor, {}) }, key)));
|
|
9
11
|
};
|