southpaw 0.2.7
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/README.md +51 -0
- package/api/client.ts +83 -0
- package/api/helpers/fs.ts +98 -0
- package/api/helpers/stream.ts +6 -0
- package/api/index.ts +50 -0
- package/api/server.ts +566 -0
- package/constants/fonts.ts +1583 -0
- package/constants/icons.ts +2124 -0
- package/constants/langs.ts +2592 -0
- package/constants/ssr-loading.tsx +17 -0
- package/contexts/dev.tsx +124 -0
- package/hooks/useDebounceCb.ts +21 -0
- package/modules/app.tsx +102 -0
- package/modules/behaviors.ts +161 -0
- package/modules/component.tsx +483 -0
- package/modules/config/index.ts +8 -0
- package/modules/database.ts +25 -0
- package/modules/document.tsx +23 -0
- package/modules/error.tsx +16 -0
- package/modules/page/autozoom.tsx +92 -0
- package/modules/page/browser.tsx +166 -0
- package/modules/page/index.tsx +327 -0
- package/modules/page/insert-modal.tsx +225 -0
- package/modules/page/inspect/index.tsx +237 -0
- package/modules/page/inspect/wrapper.tsx +88 -0
- package/modules/page/knobs/action.tsx +58 -0
- package/modules/page/knobs/color.tsx +78 -0
- package/modules/page/knobs/helpers.ts +71 -0
- package/modules/page/knobs/icon.tsx +85 -0
- package/modules/page/knobs/linker.tsx +188 -0
- package/modules/page/knobs/list-json.tsx +149 -0
- package/modules/page/knobs/list-text.tsx +129 -0
- package/modules/page/knobs/number.tsx +84 -0
- package/modules/page/knobs/segmented.tsx +81 -0
- package/modules/page/knobs/select.tsx +89 -0
- package/modules/page/knobs/size.tsx +106 -0
- package/modules/page/knobs/switch.tsx +75 -0
- package/modules/page/knobs/text.tsx +93 -0
- package/modules/page/left-tabs.tsx +36 -0
- package/modules/page/right-tabs.tsx +31 -0
- package/modules/page/seo.tsx +69 -0
- package/modules/page/tree.tsx +860 -0
- package/modules/state.ts +787 -0
- package/modules/store.ts +37 -0
- package/modules/theme.ts +105 -0
- package/modules/translations.ts +15 -0
- package/package.json +68 -0
- package/scripts/bin.js +607 -0
- package/scripts/test.js +145 -0
- package/themes/base.tsx +8962 -0
- package/themes/index.ts +4 -0
- package/themes/m2.ts +39 -0
- package/themes/newspaper.ts +39 -0
- package/types/api.ts +57 -0
- package/types/fiber_node.ts +69 -0
- package/types/react_element.ts +14 -0
- package/ui/accordion.tsx +70 -0
- package/ui/actionicon.tsx +41 -0
- package/ui/affix.tsx +14 -0
- package/ui/alert.tsx +37 -0
- package/ui/anchor.tsx +52 -0
- package/ui/arrow.tsx +116 -0
- package/ui/aspectratio.tsx +21 -0
- package/ui/autocomplete.tsx +34 -0
- package/ui/avatar.tsx +36 -0
- package/ui/backgroundimage.tsx +16 -0
- package/ui/badge.tsx +28 -0
- package/ui/blockquote.tsx +15 -0
- package/ui/blocks/faq.tsx +145 -0
- package/ui/blocks/features.tsx +167 -0
- package/ui/blocks/footer.tsx +182 -0
- package/ui/blocks/herobanner.tsx +391 -0
- package/ui/blocks/index.ts +44 -0
- package/ui/blocks/leftnav.tsx +141 -0
- package/ui/blocks/pricing.tsx +210 -0
- package/ui/blocks/testimonials.tsx +149 -0
- package/ui/blocks/uidocs.tsx +1429 -0
- package/ui/box.tsx +27 -0
- package/ui/breadcrumbs.tsx +33 -0
- package/ui/burger.tsx +23 -0
- package/ui/button.tsx +85 -0
- package/ui/card.tsx +28 -0
- package/ui/center.tsx +26 -0
- package/ui/checkbox.tsx +35 -0
- package/ui/chip.tsx +32 -0
- package/ui/closebutton.tsx +15 -0
- package/ui/code.tsx +104 -0
- package/ui/collapse.tsx +16 -0
- package/ui/colorinput.tsx +32 -0
- package/ui/colorpicker.tsx +26 -0
- package/ui/colorswatch.tsx +17 -0
- package/ui/combobox.tsx +80 -0
- package/ui/container.tsx +27 -0
- package/ui/dialog.tsx +15 -0
- package/ui/divider.tsx +58 -0
- package/ui/drawer.tsx +28 -0
- package/ui/fieldset.tsx +15 -0
- package/ui/filebutton.tsx +23 -0
- package/ui/fileinput.tsx +36 -0
- package/ui/flex.tsx +139 -0
- package/ui/focustrap.tsx +15 -0
- package/ui/form.tsx +26 -0
- package/ui/grid.tsx +69 -0
- package/ui/highlight.tsx +15 -0
- package/ui/hoverable.tsx +66 -0
- package/ui/hovercard.tsx +45 -0
- package/ui/icon.tsx +76 -0
- package/ui/image.tsx +32 -0
- package/ui/index.ts +1355 -0
- package/ui/indicator.tsx +42 -0
- package/ui/infobox.tsx +200 -0
- package/ui/input.tsx +18 -0
- package/ui/inviewport.tsx +23 -0
- package/ui/jsoninput.tsx +35 -0
- package/ui/kbd.tsx +20 -0
- package/ui/list.tsx +33 -0
- package/ui/loader.tsx +26 -0
- package/ui/loadingoverlay.tsx +22 -0
- package/ui/mark.tsx +15 -0
- package/ui/menu.tsx +89 -0
- package/ui/modal.tsx +27 -0
- package/ui/multiselect.tsx +42 -0
- package/ui/nativeselect.tsx +17 -0
- package/ui/navlink.tsx +40 -0
- package/ui/notification.tsx +25 -0
- package/ui/numberformatter.tsx +15 -0
- package/ui/numberinput.tsx +37 -0
- package/ui/overlay.tsx +15 -0
- package/ui/pagination.tsx +21 -0
- package/ui/paper.tsx +33 -0
- package/ui/passwordinput.tsx +36 -0
- package/ui/pill.tsx +17 -0
- package/ui/pillsinput.tsx +37 -0
- package/ui/pininput.tsx +30 -0
- package/ui/popover.tsx +43 -0
- package/ui/portal.tsx +15 -0
- package/ui/progress.tsx +49 -0
- package/ui/props.ts +91 -0
- package/ui/propsDef.ts +38 -0
- package/ui/radio.tsx +30 -0
- package/ui/rating.tsx +25 -0
- package/ui/ringprogress.tsx +17 -0
- package/ui/scrollarea.tsx +27 -0
- package/ui/segmentedcontrol.tsx +38 -0
- package/ui/select.tsx +43 -0
- package/ui/simplegrid.tsx +23 -0
- package/ui/skeleton.tsx +15 -0
- package/ui/slider.tsx +31 -0
- package/ui/space.tsx +19 -0
- package/ui/spoiler.tsx +23 -0
- package/ui/stepper.tsx +63 -0
- package/ui/switch.tsx +29 -0
- package/ui/table.tsx +93 -0
- package/ui/tabs.tsx +80 -0
- package/ui/tagsinput.tsx +19 -0
- package/ui/terminal.tsx +44 -0
- package/ui/text.tsx +168 -0
- package/ui/textarea.tsx +36 -0
- package/ui/textinput.tsx +34 -0
- package/ui/timeline.tsx +30 -0
- package/ui/title.tsx +42 -0
- package/ui/tooltip.tsx +32 -0
- package/ui/transition.tsx +21 -0
- package/ui/tree.tsx +42 -0
- package/ui/typographystylesprovider.tsx +20 -0
- package/ui/unstyledbutton.tsx +18 -0
- package/ui/video.tsx +16 -0
- package/ui/visuallyhidden.tsx +15 -0
- package/utils/index.ts +76 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ComboboxData, Select, SelectProps } from "@mantine/core";
|
|
2
|
+
import { FC, useEffect, useState } from "react";
|
|
3
|
+
import { TNode } from "southpaw/contexts/dev";
|
|
4
|
+
import { useDebounceCb } from "southpaw/hooks/useDebounceCb";
|
|
5
|
+
import { isRawPropGet, KNOB_DEBOUNCE, refreshProp } from "./helpers";
|
|
6
|
+
import { Linker } from "./linker";
|
|
7
|
+
|
|
8
|
+
export const KnobSelect: FC<{
|
|
9
|
+
gettersData: ComboboxData;
|
|
10
|
+
node: TNode;
|
|
11
|
+
rawProps: Record<string, string>;
|
|
12
|
+
ready: boolean;
|
|
13
|
+
propName: string;
|
|
14
|
+
label: string;
|
|
15
|
+
options: ComboboxData;
|
|
16
|
+
renderOption?: SelectProps["renderOption"];
|
|
17
|
+
}> = ({
|
|
18
|
+
gettersData,
|
|
19
|
+
node,
|
|
20
|
+
rawProps,
|
|
21
|
+
ready,
|
|
22
|
+
propName,
|
|
23
|
+
label,
|
|
24
|
+
renderOption,
|
|
25
|
+
options,
|
|
26
|
+
}) => {
|
|
27
|
+
const [value, setValue] = useState<string>();
|
|
28
|
+
const [rawGetter, setRawGetter] = useState<{
|
|
29
|
+
type: "get" | "trans";
|
|
30
|
+
storeName: string;
|
|
31
|
+
key: string;
|
|
32
|
+
}>();
|
|
33
|
+
|
|
34
|
+
const props = node.nodeProps || {};
|
|
35
|
+
const rawGetterStr = JSON.stringify(rawGetter);
|
|
36
|
+
|
|
37
|
+
const refreshFile = useDebounceCb(
|
|
38
|
+
async (value: unknown) => {
|
|
39
|
+
await refreshProp(value ? `"${value}"` : undefined, node, propName);
|
|
40
|
+
},
|
|
41
|
+
KNOB_DEBOUNCE,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const getter = isRawPropGet(rawProps[propName]);
|
|
46
|
+
if (getter) {
|
|
47
|
+
setRawGetter(getter);
|
|
48
|
+
} else {
|
|
49
|
+
setRawGetter(undefined);
|
|
50
|
+
}
|
|
51
|
+
}, [rawProps[propName]]);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!ready) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
setValue(props[propName]);
|
|
58
|
+
}, [ready, props[propName]]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Linker
|
|
62
|
+
gettersData={gettersData}
|
|
63
|
+
node={node}
|
|
64
|
+
propName={propName}
|
|
65
|
+
rawGetter={rawGetter}
|
|
66
|
+
setRawGetter={setRawGetter}
|
|
67
|
+
value={value}
|
|
68
|
+
label={label}
|
|
69
|
+
>
|
|
70
|
+
<Select
|
|
71
|
+
flex={1}
|
|
72
|
+
disabled={Boolean(rawGetterStr)}
|
|
73
|
+
data={[
|
|
74
|
+
{
|
|
75
|
+
label: "Select a value",
|
|
76
|
+
value: "",
|
|
77
|
+
},
|
|
78
|
+
...options,
|
|
79
|
+
]}
|
|
80
|
+
renderOption={renderOption}
|
|
81
|
+
value={value || ""}
|
|
82
|
+
onChange={(value) => {
|
|
83
|
+
setValue(value || undefined);
|
|
84
|
+
refreshFile(value || undefined);
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
</Linker>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ComboboxData, Select, SelectProps } from "@mantine/core";
|
|
2
|
+
import { FC, useEffect, useState } from "react";
|
|
3
|
+
import { TNode } from "southpaw/contexts/dev";
|
|
4
|
+
import { useDebounceCb } from "southpaw/hooks/useDebounceCb";
|
|
5
|
+
import { isRawPropGet, KNOB_DEBOUNCE, refreshProp } from "./helpers";
|
|
6
|
+
import { Linker } from "./linker";
|
|
7
|
+
|
|
8
|
+
export const KnobSize: FC<{
|
|
9
|
+
gettersData: ComboboxData;
|
|
10
|
+
node: TNode;
|
|
11
|
+
rawProps: Record<string, string>;
|
|
12
|
+
ready: boolean;
|
|
13
|
+
propName: string;
|
|
14
|
+
label: string;
|
|
15
|
+
renderOption?: SelectProps["renderOption"];
|
|
16
|
+
}> = ({
|
|
17
|
+
gettersData,
|
|
18
|
+
node,
|
|
19
|
+
rawProps,
|
|
20
|
+
ready,
|
|
21
|
+
propName,
|
|
22
|
+
label,
|
|
23
|
+
renderOption,
|
|
24
|
+
}) => {
|
|
25
|
+
const [value, setValue] = useState<string>();
|
|
26
|
+
const [rawGetter, setRawGetter] = useState<{
|
|
27
|
+
type: "get" | "trans";
|
|
28
|
+
storeName: string;
|
|
29
|
+
key: string;
|
|
30
|
+
}>();
|
|
31
|
+
|
|
32
|
+
const props = node.nodeProps || {};
|
|
33
|
+
const rawGetterStr = JSON.stringify(rawGetter);
|
|
34
|
+
|
|
35
|
+
const refreshFile = useDebounceCb(
|
|
36
|
+
async (value: unknown) => {
|
|
37
|
+
await refreshProp(value ? `"${value}"` : undefined, node, propName);
|
|
38
|
+
},
|
|
39
|
+
KNOB_DEBOUNCE
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const getter = isRawPropGet(rawProps[propName]);
|
|
44
|
+
if (getter) {
|
|
45
|
+
setRawGetter(getter);
|
|
46
|
+
} else {
|
|
47
|
+
setRawGetter(undefined);
|
|
48
|
+
}
|
|
49
|
+
}, [rawProps[propName]]);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!ready) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
setValue(props[propName]);
|
|
56
|
+
}, [ready, props[propName]]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Linker
|
|
60
|
+
gettersData={gettersData}
|
|
61
|
+
node={node}
|
|
62
|
+
propName={propName}
|
|
63
|
+
rawGetter={rawGetter}
|
|
64
|
+
setRawGetter={setRawGetter}
|
|
65
|
+
value={value}
|
|
66
|
+
label={label}
|
|
67
|
+
>
|
|
68
|
+
<Select
|
|
69
|
+
flex={1}
|
|
70
|
+
disabled={Boolean(rawGetterStr)}
|
|
71
|
+
data={[
|
|
72
|
+
{
|
|
73
|
+
label: "Select a value",
|
|
74
|
+
value: "",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: "Xs",
|
|
78
|
+
value: "xs",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: "Sm",
|
|
82
|
+
value: "sm",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "Md",
|
|
86
|
+
value: "md",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "Lg",
|
|
90
|
+
value: "lg",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "Xl",
|
|
94
|
+
value: "xl",
|
|
95
|
+
},
|
|
96
|
+
]}
|
|
97
|
+
renderOption={renderOption}
|
|
98
|
+
value={value || ""}
|
|
99
|
+
onChange={(value) => {
|
|
100
|
+
setValue(value || undefined);
|
|
101
|
+
refreshFile(value || undefined);
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
</Linker>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ComboboxData, Switch } from "@mantine/core";
|
|
2
|
+
import { FC, useEffect, useState } from "react";
|
|
3
|
+
import { TNode } from "southpaw/contexts/dev";
|
|
4
|
+
import { useDebounceCb } from "southpaw/hooks/useDebounceCb";
|
|
5
|
+
import { isRawPropGet, KNOB_DEBOUNCE, refreshProp } from "./helpers";
|
|
6
|
+
import { Linker } from "./linker";
|
|
7
|
+
|
|
8
|
+
export const KnobSwitch: FC<{
|
|
9
|
+
gettersData: ComboboxData;
|
|
10
|
+
node: TNode;
|
|
11
|
+
rawProps: Record<string, string>;
|
|
12
|
+
ready: boolean;
|
|
13
|
+
propName: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}> = ({ gettersData, node, rawProps, ready, propName, label }) => {
|
|
16
|
+
const [value, setValue] = useState<boolean>(false);
|
|
17
|
+
const [rawGetter, setRawGetter] = useState<{
|
|
18
|
+
type: "get" | "trans";
|
|
19
|
+
storeName: string;
|
|
20
|
+
key: string;
|
|
21
|
+
}>();
|
|
22
|
+
|
|
23
|
+
const props = node.nodeProps || {};
|
|
24
|
+
const rawGetterStr = JSON.stringify(rawGetter);
|
|
25
|
+
|
|
26
|
+
const refreshFile = useDebounceCb(
|
|
27
|
+
async (value: unknown) => {
|
|
28
|
+
await refreshProp(
|
|
29
|
+
typeof value === "undefined" ? undefined : `{${value}}`,
|
|
30
|
+
node,
|
|
31
|
+
propName
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
KNOB_DEBOUNCE
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const getter = isRawPropGet(rawProps[propName]);
|
|
39
|
+
if (getter) {
|
|
40
|
+
setRawGetter(getter);
|
|
41
|
+
} else {
|
|
42
|
+
setRawGetter(undefined);
|
|
43
|
+
}
|
|
44
|
+
}, [rawProps[propName]]);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!ready) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
setValue(Boolean(props[propName]));
|
|
51
|
+
}, [ready, props[propName]]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Linker
|
|
55
|
+
gettersData={gettersData}
|
|
56
|
+
node={node}
|
|
57
|
+
propName={propName}
|
|
58
|
+
rawGetter={rawGetter}
|
|
59
|
+
setRawGetter={setRawGetter}
|
|
60
|
+
value={value}
|
|
61
|
+
label={label}
|
|
62
|
+
>
|
|
63
|
+
<Switch
|
|
64
|
+
flex={1}
|
|
65
|
+
disabled={Boolean(rawGetterStr)}
|
|
66
|
+
checked={value}
|
|
67
|
+
onChange={(event) => {
|
|
68
|
+
const checked = event.target.checked;
|
|
69
|
+
setValue(checked);
|
|
70
|
+
refreshFile(checked);
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
</Linker>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ComboboxData, Textarea, TextInput } from "@mantine/core";
|
|
2
|
+
import { FC, useEffect, useState } from "react";
|
|
3
|
+
import { TNode } from "southpaw/contexts/dev";
|
|
4
|
+
import { useDebounceCb } from "southpaw/hooks/useDebounceCb";
|
|
5
|
+
import { isRawPropGet, KNOB_DEBOUNCE, refreshProp } from "./helpers";
|
|
6
|
+
import { Linker } from "./linker";
|
|
7
|
+
|
|
8
|
+
export const KnobText: FC<{
|
|
9
|
+
gettersData: ComboboxData;
|
|
10
|
+
node: TNode;
|
|
11
|
+
rawProps: Record<string, string>;
|
|
12
|
+
ready: boolean;
|
|
13
|
+
propName: string;
|
|
14
|
+
label: string;
|
|
15
|
+
multiline?: boolean;
|
|
16
|
+
}> = ({
|
|
17
|
+
gettersData,
|
|
18
|
+
node,
|
|
19
|
+
rawProps,
|
|
20
|
+
ready,
|
|
21
|
+
propName,
|
|
22
|
+
label,
|
|
23
|
+
multiline = false,
|
|
24
|
+
}) => {
|
|
25
|
+
const [value, setValue] = useState<string>("");
|
|
26
|
+
const [rawGetter, setRawGetter] = useState<{
|
|
27
|
+
type: "get" | "trans";
|
|
28
|
+
storeName: string;
|
|
29
|
+
key: string;
|
|
30
|
+
}>();
|
|
31
|
+
|
|
32
|
+
const props = node.nodeProps || {};
|
|
33
|
+
const rawGetterStr = JSON.stringify(rawGetter);
|
|
34
|
+
|
|
35
|
+
const refreshFile = useDebounceCb(
|
|
36
|
+
async (value: unknown) => {
|
|
37
|
+
await refreshProp(`"${value}"`, node, propName);
|
|
38
|
+
},
|
|
39
|
+
KNOB_DEBOUNCE
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const getter = isRawPropGet(rawProps[propName]);
|
|
44
|
+
if (getter) {
|
|
45
|
+
setRawGetter(getter);
|
|
46
|
+
} else {
|
|
47
|
+
setRawGetter(undefined);
|
|
48
|
+
}
|
|
49
|
+
}, [rawProps[propName]]);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!ready) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
setValue(props[propName]);
|
|
56
|
+
}, [ready, props[propName]]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Linker
|
|
60
|
+
gettersData={gettersData}
|
|
61
|
+
node={node}
|
|
62
|
+
propName={propName}
|
|
63
|
+
rawGetter={rawGetter}
|
|
64
|
+
setRawGetter={setRawGetter}
|
|
65
|
+
value={value}
|
|
66
|
+
label={label}
|
|
67
|
+
>
|
|
68
|
+
{multiline ? (
|
|
69
|
+
<Textarea
|
|
70
|
+
flex={1}
|
|
71
|
+
disabled={Boolean(rawGetterStr)}
|
|
72
|
+
value={value}
|
|
73
|
+
onChange={(event) => {
|
|
74
|
+
const value = event.target.value;
|
|
75
|
+
setValue(value);
|
|
76
|
+
refreshFile(value);
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
) : (
|
|
80
|
+
<TextInput
|
|
81
|
+
flex={1}
|
|
82
|
+
disabled={Boolean(rawGetterStr)}
|
|
83
|
+
value={value}
|
|
84
|
+
onChange={(event) => {
|
|
85
|
+
const value = event.target.value;
|
|
86
|
+
setValue(value);
|
|
87
|
+
refreshFile(value);
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
</Linker>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Tabs } from "@mantine/core";
|
|
2
|
+
import { IconListTree, IconSeo } from "@tabler/icons-react";
|
|
3
|
+
import { TabPageSeo } from "./seo";
|
|
4
|
+
import { TabPageTree } from "./tree";
|
|
5
|
+
import { PageBehaviors, PageParams } from ".";
|
|
6
|
+
import { ReactElementType } from "southpaw/types/react_element";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
params: PageParams;
|
|
10
|
+
jsx: ReactElementType;
|
|
11
|
+
pageBehaviors: PageBehaviors;
|
|
12
|
+
};
|
|
13
|
+
export const PageLeftTabs = ({ params, jsx }: Props) => {
|
|
14
|
+
return (
|
|
15
|
+
<Tabs
|
|
16
|
+
allowTabDeactivation
|
|
17
|
+
keepMounted={false}
|
|
18
|
+
bg="var(--mantine-color-body)"
|
|
19
|
+
orientation="vertical"
|
|
20
|
+
style={{
|
|
21
|
+
borderRight: "1px solid var(--mantine-color-gray-3)",
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
<Tabs.List>
|
|
25
|
+
<Tabs.Tab value="seo">
|
|
26
|
+
<IconSeo title="Seo" size={25} />
|
|
27
|
+
</Tabs.Tab>
|
|
28
|
+
<Tabs.Tab value="tree">
|
|
29
|
+
<IconListTree title="Tree" size={25} />
|
|
30
|
+
</Tabs.Tab>
|
|
31
|
+
</Tabs.List>
|
|
32
|
+
<TabPageSeo params={params} jsx={jsx} />
|
|
33
|
+
<TabPageTree jsx={jsx} />
|
|
34
|
+
</Tabs>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Tabs } from "@mantine/core";
|
|
2
|
+
import { IconPointer } from "@tabler/icons-react";
|
|
3
|
+
import { TabPageInspect } from "./inspect";
|
|
4
|
+
import { PageBehaviors, PageParams } from ".";
|
|
5
|
+
import { ReactElementType } from "southpaw/types/react_element";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
params: PageParams;
|
|
9
|
+
jsx: ReactElementType;
|
|
10
|
+
pageBehaviors: PageBehaviors;
|
|
11
|
+
};
|
|
12
|
+
export const PageRightTabs = ({ pageBehaviors }: Props) => {
|
|
13
|
+
return (
|
|
14
|
+
<Tabs
|
|
15
|
+
allowTabDeactivation
|
|
16
|
+
placement="right"
|
|
17
|
+
orientation="vertical"
|
|
18
|
+
bg="var(--mantine-color-body)"
|
|
19
|
+
style={{
|
|
20
|
+
borderLeft: "1px solid var(--mantine-color-gray-3)",
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
<Tabs.List>
|
|
24
|
+
<Tabs.Tab value="inspect">
|
|
25
|
+
<IconPointer title="Inspect" size={25} />
|
|
26
|
+
</Tabs.Tab>
|
|
27
|
+
</Tabs.List>
|
|
28
|
+
<TabPageInspect behaviors={pageBehaviors} />
|
|
29
|
+
</Tabs>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Button, Flex, ScrollArea, Tabs, TextInput } from "@mantine/core";
|
|
2
|
+
import { FETCH } from "../../api/client";
|
|
3
|
+
import { PageParams } from ".";
|
|
4
|
+
import { FC } from "react";
|
|
5
|
+
import { ReactElementType } from "../../types/react_element";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
params: PageParams;
|
|
9
|
+
jsx: ReactElementType;
|
|
10
|
+
};
|
|
11
|
+
export const TabPageSeo: FC<Props> = ({ params, jsx }) => {
|
|
12
|
+
return (
|
|
13
|
+
<Tabs.Panel value="seo" p="sm" w={340}>
|
|
14
|
+
<ScrollArea h="100%">
|
|
15
|
+
<Flex
|
|
16
|
+
w={300}
|
|
17
|
+
onSubmit={(event) => {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
const formEls = (event.currentTarget as unknown as HTMLFormElement)
|
|
20
|
+
.elements;
|
|
21
|
+
const title = (formEls.namedItem("seo-title") as HTMLInputElement)
|
|
22
|
+
.value;
|
|
23
|
+
const description = (
|
|
24
|
+
formEls.namedItem("seo-description") as HTMLInputElement
|
|
25
|
+
).value;
|
|
26
|
+
const source = jsx._source
|
|
27
|
+
? jsx._source
|
|
28
|
+
: {
|
|
29
|
+
fileName: "src/pages/index.tsx",
|
|
30
|
+
lineNumber: 1,
|
|
31
|
+
columnNumber: 1,
|
|
32
|
+
};
|
|
33
|
+
FETCH.page.writeSEO({
|
|
34
|
+
seo: {
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
},
|
|
38
|
+
source,
|
|
39
|
+
});
|
|
40
|
+
}}
|
|
41
|
+
component="form"
|
|
42
|
+
direction="column"
|
|
43
|
+
gap="sm"
|
|
44
|
+
p="sm"
|
|
45
|
+
>
|
|
46
|
+
<TextInput
|
|
47
|
+
id="seo-title"
|
|
48
|
+
label="Title"
|
|
49
|
+
color="dark"
|
|
50
|
+
type="text"
|
|
51
|
+
defaultValue={params.seo.title}
|
|
52
|
+
autoComplete="off"
|
|
53
|
+
/>
|
|
54
|
+
<TextInput
|
|
55
|
+
id="seo-description"
|
|
56
|
+
label="Description"
|
|
57
|
+
color="dark"
|
|
58
|
+
type="text"
|
|
59
|
+
defaultValue={params.seo.description}
|
|
60
|
+
autoComplete="off"
|
|
61
|
+
/>
|
|
62
|
+
<Button color="dark" hidden type="submit">
|
|
63
|
+
Apply
|
|
64
|
+
</Button>
|
|
65
|
+
</Flex>
|
|
66
|
+
</ScrollArea>
|
|
67
|
+
</Tabs.Panel>
|
|
68
|
+
);
|
|
69
|
+
};
|