@expofp/debug 3.4.4 → 3.4.5
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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Switch } from '@radix-ui/themes';
|
|
3
3
|
import { SettingsItem } from './settings-item.js';
|
|
4
4
|
export const BooleanEditor = (props) => {
|
|
5
|
-
return (_jsx(SettingsItem, { label: props.label, children: _jsx(
|
|
5
|
+
return (_jsx(SettingsItem, { label: props.label, children: _jsx(Switch, { checked: props.value, onCheckedChange: (checked) => props.onChange(checked) }) }));
|
|
6
6
|
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Select } from '@radix-ui/themes';
|
|
3
3
|
import { SettingsItem } from './settings-item.js';
|
|
4
|
+
// Radix Select reserves "" for "no selection", so map empty values to a sentinel.
|
|
5
|
+
const EMPTY_SENTINEL = '__EMPTY__';
|
|
6
|
+
const encode = (s) => (s === '' ? EMPTY_SENTINEL : s);
|
|
7
|
+
const decode = (s) => (s === EMPTY_SENTINEL ? '' : s);
|
|
4
8
|
export function EnumEditor(props) {
|
|
5
9
|
const stringMode = props.context.values.every((v) => typeof v === 'string');
|
|
6
10
|
const stringify = stringMode ? (v) => v : (v) => JSON.stringify(v);
|
|
7
11
|
const parse = stringMode ? (v) => v : (v) => JSON.parse(v);
|
|
8
|
-
const value = stringify(props.value);
|
|
12
|
+
const value = encode(stringify(props.value));
|
|
9
13
|
const values = props.context.values.map((v) => ({
|
|
10
|
-
value: stringify(v),
|
|
14
|
+
value: encode(stringify(v)),
|
|
11
15
|
label: stringify(v),
|
|
12
16
|
}));
|
|
13
|
-
return (_jsx(SettingsItem, { label: props.label, children: _jsxs(Select.Root, { value: value, onValueChange: (
|
|
14
|
-
props.onChange(parse(
|
|
17
|
+
return (_jsx(SettingsItem, { label: props.label, children: _jsxs(Select.Root, { value: value, onValueChange: (encoded) => {
|
|
18
|
+
props.onChange(parse(decode(encoded)));
|
|
15
19
|
}, children: [_jsx(Select.Trigger, {}), _jsx(Select.Content, { children: values.map((v) => (_jsx(Select.Item, { value: v.value, children: v.label }, v.value))) })] }) }));
|
|
16
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Flex, Heading, Separator } from '@radix-ui/themes';
|
|
3
3
|
export const SettingsItem = ({ label, children }) => {
|
|
4
|
-
return (_jsxs(_Fragment, { children: [_jsxs(
|
|
4
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { align: "center", justify: "between", gap: "4", wrap: "wrap", children: [_jsx(Heading, { size: "4", children: label }), _jsx(Flex, { align: "center", justify: "end", gap: "2", flexGrow: "1", children: children })] }), _jsx(Separator, { size: "4", my: "20px" })] }));
|
|
5
5
|
};
|
|
@@ -4,7 +4,7 @@ import { AlertDialog, Box, Button, Callout, Flex } from '@radix-ui/themes';
|
|
|
4
4
|
import { resetAllSettings } from '../settings/reset-all-settings.js';
|
|
5
5
|
import { SettingsList } from './settings-list.js';
|
|
6
6
|
export const SettingsTab = () => {
|
|
7
|
-
return (_jsxs(Box, { pt: "20px", children: [_jsx(Box, { mb: "20px", children: _jsxs(Callout.Root, { children: [_jsx(Callout.Icon, { children: _jsx(InfoCircledIcon, {}) }), _jsx(Callout.Text, { children: "These settings will persist across page reloads in your browser." })] }) }), _jsx(SettingsList, {}), _jsxs(Flex, { gap: "3", mt: "40px", justify: "center", children: [_jsx(Button, { onClick: () => {
|
|
7
|
+
return (_jsxs(Box, { pt: "20px", children: [_jsx(Box, { mb: "20px", children: _jsxs(Callout.Root, { children: [_jsx(Callout.Icon, { children: _jsx(InfoCircledIcon, {}) }), _jsx(Callout.Text, { children: "These settings will persist across page reloads in your browser." })] }) }), _jsx(SettingsList, {}), _jsxs(Flex, { gap: "3", mt: "40px", justify: "center", wrap: "wrap", children: [_jsx(Button, { onClick: () => {
|
|
8
8
|
window.location.reload();
|
|
9
9
|
}, children: "Reload with the applied changes" }), _jsxs(AlertDialog.Root, { children: [_jsx(AlertDialog.Trigger, { children: _jsx(Button, { color: "red", children: "Reset all and reload" }) }), _jsxs(AlertDialog.Content, { maxWidth: "450px", children: [_jsx(AlertDialog.Title, { children: "Reset all and reload" }), _jsx(AlertDialog.Description, { size: "2", children: "This will reset all settings, disable debug mode, and reload the page." }), _jsxs(Flex, { gap: "3", mt: "4", justify: "end", children: [_jsx(AlertDialog.Cancel, { children: _jsx(Button, { variant: "soft", color: "gray", children: "Cancel" }) }), _jsx(AlertDialog.Action, { children: _jsx(Button, { variant: "solid", color: "red", onClick: () => {
|
|
10
10
|
resetAllSettings();
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { TextField } from '@radix-ui/themes';
|
|
3
3
|
import { SettingsItem } from './settings-item.js';
|
|
4
4
|
export const StringEditor = (props) => {
|
|
5
|
-
return (_jsx(SettingsItem, { label: props.label, children: _jsx(TextField.Root, { placeholder: props.context?.placeholder, value: props.value, onChange: (e) => props.onChange(e.target.value), style: { minWidth: 220 } }) }));
|
|
5
|
+
return (_jsx(SettingsItem, { label: props.label, children: _jsx(TextField.Root, { placeholder: props.context?.placeholder, value: props.value, onChange: (e) => props.onChange(e.target.value), style: { flexGrow: 1, minWidth: 220 } }) }));
|
|
6
6
|
};
|
|
7
7
|
StringEditor.displayName = 'StringEditor';
|