slice-machine-ui 1.22.3-beta.1 → 1.22.3-beta.2
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/components/DeleteVariationModal/index.tsx +12 -11
- package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +2 -5
- package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +9 -5
- package/components/Forms/RenameVariationModal/RenameVariationModal.tsx +12 -11
- package/components/ItemHeader/index.tsx +1 -0
- package/components/ListItem/index.tsx +5 -2
- package/components/ScreenshotChangesModal/VariationDropZone.tsx +31 -9
- package/components/ScreenshotChangesModal/index.tsx +3 -0
- package/components/ScreenshotChangesModal/useCustomScreenshot.tsx +5 -5
- package/components/Simulator/index.tsx +9 -3
- package/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +12 -20
- package/lib/builders/CustomTypeBuilder/TabModal/update.tsx +3 -1
- package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +119 -52
- package/lib/builders/CustomTypeBuilder/index.tsx +39 -42
- package/lib/builders/SliceBuilder/FieldZones/index.tsx +81 -56
- package/lib/builders/SliceBuilder/Sidebar/AddVariationModal.tsx +24 -16
- package/lib/builders/SliceBuilder/Sidebar/index.tsx +44 -46
- package/lib/builders/SliceBuilder/SimulatorButton/index.tsx +4 -28
- package/lib/builders/SliceBuilder/index.tsx +10 -96
- package/lib/builders/common/Zone/Card/components/Hints/CodeBlock.tsx +5 -1
- package/lib/builders/common/Zone/Card/components/NewField.tsx +16 -15
- package/lib/builders/common/Zone/Card/index.jsx +2 -0
- package/lib/builders/common/Zone/index.jsx +3 -1
- package/lib/models/common/ComponentUI.ts +0 -14
- package/lib/models/common/CustomType/sliceZone.ts +0 -29
- package/lib/models/common/CustomType/tab.ts +10 -142
- package/lib/models/common/widgets/Group/ListItem/index.jsx +61 -23
- package/out/404.html +1 -1
- package/out/_next/static/2SXh8a0HZLb2Awmhh2xob/_buildManifest.js +1 -0
- package/out/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js +1 -0
- package/out/_next/static/chunks/183-4feb6bb3eddbc768.js +1 -0
- package/out/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js +1 -0
- package/out/_next/static/chunks/25-8fedd33ad9b6de5b.js +1 -0
- package/out/_next/static/chunks/318-541db69860d31138.js +1 -0
- package/out/_next/static/chunks/{505-3f1cf09a086dcba8.js → 376-0ed5822f8afcaa7c.js} +3 -3
- package/out/_next/static/chunks/4c744e84-e3161d754618373f.js +1 -0
- package/out/_next/static/chunks/50-cfc2514205b86001.js +1 -0
- package/out/_next/static/chunks/543-f8766685f7f451e2.js +1 -0
- package/out/_next/static/chunks/59b4e022-7a3b5554b806349f.js +1 -0
- package/out/_next/static/chunks/696-b12edad30a3617e5.js +31 -0
- package/out/_next/static/chunks/727-15cf3f2fea9a37e5.js +1 -0
- package/out/_next/static/chunks/731-501990ebe6a71b32.js +1 -0
- package/out/_next/static/chunks/787-727e3aef5d2a10a8.js +1 -0
- package/out/_next/static/chunks/904-ccd8ca3368ce29fc.js +1 -0
- package/out/_next/static/chunks/{918-38d08f1e885b222d.js → 918-5bb55fb464e34768.js} +1 -1
- package/out/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js +1 -0
- package/out/_next/static/chunks/pages/_app-49f29218569a926a.js +428 -0
- package/out/_next/static/chunks/pages/changelog-68d115a14f1423d7.js +1 -0
- package/out/_next/static/chunks/pages/changes-6f62ae7b6243a1c7.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-3a37eb3373bb8823.js → [customTypeId]-3f862ad6111a1fc0.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-2f5664d9492b13fb.js → custom-types-94b8f8dbf7727412.js} +1 -1
- package/out/_next/static/chunks/pages/{index-d8e3a2c0d712904f.js → index-64cfb8b0948ba8ef.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-733f3890c0466a05.js → [pageTypeId]-d1ffca11c42f2603.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-897ca93c114a1435.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e89e2e6f772a3454.js +1 -0
- package/out/_next/static/chunks/pages/slices-9628f8aa54968d6a.js +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/pages/slices/[lib]/[sliceName]/[variation]/index.tsx +25 -11
- package/pages/slices/[lib]/[sliceName]/[variation]/simulator.tsx +12 -9
- package/src/apiClient.ts +7 -6
- package/src/components/CodeBlock/CodeBlock.tsx +1 -0
- package/src/components/Window/Window.tsx +7 -1
- package/src/domain/__tests__/customType.test.ts +785 -0
- package/src/domain/customType.ts +519 -6
- package/src/domain/slice.ts +166 -1
- package/src/features/autoSave/AutoSaveStatusIndicator.tsx +43 -0
- package/src/features/autoSave/useAutoSave.tsx +177 -0
- package/src/features/customTypes/EditDropdown.tsx +3 -0
- package/src/features/customTypes/actions/convertCustomToPageType.ts +2 -4
- package/src/features/customTypes/customTypesBuilder/CustomTypeProvider.tsx +90 -0
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +46 -79
- package/src/features/customTypes/customTypesMessages.ts +4 -0
- package/src/features/slices/actions/addSlicesToSliceZone.ts +2 -7
- package/src/features/slices/actions/uploadSliceScreenshot.ts +45 -0
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +5 -5
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +4 -10
- package/src/features/slices/sliceBuilder/SliceBuilderProvider.tsx +110 -0
- package/src/features/slices/sliceBuilder/actions/deleteVariation.ts +8 -24
- package/src/features/slices/sliceBuilder/actions/renameVariation.ts +8 -24
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +1 -0
- package/src/hooks/useCurrentSlice.tsx +4 -16
- package/src/hooks/useScreenshotChangesModal.ts +1 -0
- package/src/hooks/useServerState.ts +1 -58
- package/src/modules/availableCustomTypes/index.ts +8 -3
- package/src/modules/simulator/index.ts +0 -2
- package/src/modules/slices/index.ts +32 -25
- package/src/modules/slices/selector.ts +30 -0
- package/src/modules/useSliceMachineActions.ts +20 -270
- package/src/redux/reducer.ts +0 -4
- package/src/redux/saga.ts +0 -6
- package/src/redux/type.ts +0 -4
- package/test/src/modules/availableCustomTypes/index.test.ts +8 -10
- package/test/src/modules/simulator.test.ts +0 -2
- package/lib/models/common/CustomType/group.ts +0 -80
- package/lib/models/common/Variation.ts +0 -100
- package/out/_next/static/ZrWICkLApT4ZATA_akn-2/_buildManifest.js +0 -1
- package/out/_next/static/chunks/482-34cee2a2071c235f.js +0 -1
- package/out/_next/static/chunks/550-c80fd46fb64d1eef.js +0 -1
- package/out/_next/static/chunks/80-7b8a97d0122ff74a.js +0 -1
- package/out/_next/static/chunks/840-163f8a1040e6820d.js +0 -1
- package/out/_next/static/chunks/904-519dbf0f7e8c6243.js +0 -1
- package/out/_next/static/chunks/958-8aca174b80cb0c35.js +0 -1
- package/out/_next/static/chunks/pages/_app-132564608e9a9502.js +0 -458
- package/out/_next/static/chunks/pages/changelog-4d0f2f1222e403fe.js +0 -1
- package/out/_next/static/chunks/pages/changes-52c9d917808d1461.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-7b17cb59d0db03b5.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ef11594ce026b650.js +0 -1
- package/out/_next/static/chunks/pages/slices-884a936a9a062a65.js +0 -1
- package/src/domain/__tests__/CustomTypeModel.test.ts +0 -247
- package/src/layouts/WithSlice.tsx +0 -26
- package/src/modules/screenshots/actions.ts +0 -21
- package/src/modules/screenshots/sagas.ts +0 -70
- package/src/modules/selectedCustomType/actions.ts +0 -147
- package/src/modules/selectedCustomType/index.ts +0 -11
- package/src/modules/selectedCustomType/reducer.ts +0 -287
- package/src/modules/selectedCustomType/sagas.ts +0 -72
- package/src/modules/selectedCustomType/selectors.ts +0 -33
- package/src/modules/selectedCustomType/stateHelpers.ts +0 -42
- package/src/modules/selectedCustomType/types.ts +0 -9
- package/src/modules/selectedSlice/actions.ts +0 -106
- package/src/modules/selectedSlice/reducer.ts +0 -175
- package/src/modules/selectedSlice/sagas.ts +0 -72
- package/src/modules/selectedSlice/selectors.ts +0 -55
- package/src/modules/selectedSlice/types.ts +0 -3
- package/src/modules/toaster/utils.tsx +0 -23
- package/test/lib/models/common/CustomType/sliceZone.test.ts +0 -49
- package/test/pages/custom-types.test.tsx +0 -625
- package/test/src/modules/selectedCustomType/__fixtures__/model.json +0 -119
- package/test/src/modules/selectedCustomType/reducer.test.ts +0 -322
- package/test/src/modules/selectedCustomType/sagas.test.ts +0 -89
- package/test/src/modules/selectedCustomType/selectors.test.ts +0 -54
- package/test/src/modules/selectedSlice/__fixtures__/mocks.json +0 -171
- package/test/src/modules/selectedSlice/__fixtures__/model.json +0 -35
- package/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts +0 -72
- package/test/src/modules/selectedSlice/__testutils__/getSelectedSliceDummyData.ts +0 -30
- package/test/src/modules/selectedSlice/reducer.test.ts +0 -170
- package/test/src/modules/selectedSlice/sagas.test.ts +0 -82
- package/test/src/modules/toaster/utils.test.ts +0 -50
- /package/out/_next/static/{ZrWICkLApT4ZATA_akn-2 → 2SXh8a0HZLb2Awmhh2xob}/_ssgManifest.js +0 -0
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import Head from "next/head";
|
|
2
|
-
import
|
|
3
|
-
import useCurrentSlice from "@src/hooks/useCurrentSlice";
|
|
4
|
-
import { createComponentWithSlice } from "@src/layouts/WithSlice";
|
|
2
|
+
import { useRouter } from "next/router";
|
|
5
3
|
|
|
6
|
-
|
|
4
|
+
import SliceBuilder from "@lib/builders/SliceBuilder";
|
|
5
|
+
import { SliceBuilderProvider } from "@src/features/slices/sliceBuilder/SliceBuilderProvider";
|
|
6
|
+
import useCurrentSlice from "@src/hooks/useCurrentSlice";
|
|
7
7
|
|
|
8
8
|
export default function SlicePage() {
|
|
9
|
-
const
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const { slice: initialSlice, variation: defaultVariation } =
|
|
11
|
+
useCurrentSlice();
|
|
12
|
+
|
|
13
|
+
if (initialSlice === undefined || defaultVariation === undefined) {
|
|
14
|
+
void router.replace("/");
|
|
15
|
+
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
10
18
|
|
|
11
19
|
return (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
<SliceBuilderProvider initialSlice={initialSlice}>
|
|
21
|
+
{({ slice }) => {
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<Head>
|
|
25
|
+
<title>{slice.model.name} - Slice Machine</title>
|
|
26
|
+
</Head>
|
|
27
|
+
<SliceBuilder />
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}}
|
|
31
|
+
</SliceBuilderProvider>
|
|
18
32
|
);
|
|
19
33
|
}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import Head from "next/head";
|
|
2
|
+
import { useRouter } from "next/router";
|
|
3
|
+
|
|
2
4
|
import Simulator from "@components/Simulator";
|
|
3
5
|
import useCurrentSlice from "@src/hooks/useCurrentSlice";
|
|
4
|
-
import { createComponentWithSlice } from "@src/layouts/WithSlice";
|
|
5
|
-
|
|
6
|
-
const SimulatorWithSlice = createComponentWithSlice(Simulator);
|
|
7
6
|
|
|
8
7
|
export default function SimulatorPage() {
|
|
9
|
-
const
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
const { slice, variation } = useCurrentSlice();
|
|
10
|
+
|
|
11
|
+
if (slice === undefined || variation === undefined) {
|
|
12
|
+
void router.replace("/");
|
|
13
|
+
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
10
16
|
|
|
11
17
|
return (
|
|
12
18
|
<>
|
|
13
19
|
<Head>
|
|
14
|
-
<title>
|
|
15
|
-
{slice ? `Simulator: ${slice.model.name}` : "Simulator"} - Slice
|
|
16
|
-
Machine
|
|
17
|
-
</title>
|
|
20
|
+
<title>{`Simulator: ${slice.model.name} - Slice Machine`}</title>
|
|
18
21
|
</Head>
|
|
19
|
-
<
|
|
22
|
+
<Simulator slice={slice} variation={variation} />
|
|
20
23
|
</>
|
|
21
24
|
);
|
|
22
25
|
}
|
package/src/apiClient.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { CustomType } from "@prismicio/types-internal/lib/customtypes";
|
|
2
|
+
import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
|
|
3
|
+
|
|
1
4
|
import { SimulatorCheckResponse } from "@models/common/Simulator";
|
|
2
5
|
import { SliceMachineManagerClient } from "@slicemachine/manager/client";
|
|
3
6
|
import {
|
|
@@ -6,8 +9,7 @@ import {
|
|
|
6
9
|
type VariationSM,
|
|
7
10
|
Variations,
|
|
8
11
|
} from "@lib/models/common/Slice";
|
|
9
|
-
import { CustomTypes
|
|
10
|
-
|
|
12
|
+
import { CustomTypes } from "@lib/models/common/CustomType";
|
|
11
13
|
import { CheckAuthStatusResponse } from "@models/common/Auth";
|
|
12
14
|
import ServerState from "@models/server/ServerState";
|
|
13
15
|
import { CustomScreenshotRequest } from "@lib/models/common/Screenshots";
|
|
@@ -15,7 +17,6 @@ import { ComponentUI } from "@lib/models/common/ComponentUI";
|
|
|
15
17
|
import { PackageChangelog } from "@lib/models/common/versions";
|
|
16
18
|
|
|
17
19
|
import { managerClient } from "./managerClient";
|
|
18
|
-
import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
|
|
19
20
|
|
|
20
21
|
/** State Routes * */
|
|
21
22
|
|
|
@@ -70,11 +71,11 @@ export const getState = async (): Promise<ServerState> => {
|
|
|
70
71
|
|
|
71
72
|
/** Custom Type Routes * */
|
|
72
73
|
|
|
73
|
-
export const
|
|
74
|
-
customType:
|
|
74
|
+
export const updateCustomType = async (
|
|
75
|
+
customType: CustomType,
|
|
75
76
|
): ReturnType<SliceMachineManagerClient["customTypes"]["updateCustomType"]> => {
|
|
76
77
|
return await managerClient.customTypes.updateCustomType({
|
|
77
|
-
model:
|
|
78
|
+
model: customType,
|
|
78
79
|
});
|
|
79
80
|
};
|
|
80
81
|
|
|
@@ -59,10 +59,12 @@ type WindowTabsTriggerProps = Pick<
|
|
|
59
59
|
export const WindowTabsTrigger: FC<WindowTabsTriggerProps> = ({
|
|
60
60
|
children,
|
|
61
61
|
menu,
|
|
62
|
+
value,
|
|
62
63
|
...otherProps
|
|
63
64
|
}) => (
|
|
64
65
|
<Tabs.Trigger
|
|
65
66
|
{...otherProps}
|
|
67
|
+
aria-label={value}
|
|
66
68
|
asChild
|
|
67
69
|
onMouseDown={(event) => {
|
|
68
70
|
const target = event.target as HTMLElement;
|
|
@@ -81,6 +83,7 @@ export const WindowTabsTrigger: FC<WindowTabsTriggerProps> = ({
|
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
}}
|
|
86
|
+
value={value}
|
|
84
87
|
>
|
|
85
88
|
<div className={styles.tabsTrigger}>
|
|
86
89
|
<Text
|
|
@@ -96,7 +99,10 @@ export const WindowTabsTrigger: FC<WindowTabsTriggerProps> = ({
|
|
|
96
99
|
<div className={styles.tabsTriggerMenu}>
|
|
97
100
|
<DropdownMenu>
|
|
98
101
|
<DropdownMenuTrigger>
|
|
99
|
-
<IconButton
|
|
102
|
+
<IconButton
|
|
103
|
+
icon="moreVert"
|
|
104
|
+
hiddenLabel={`tab-${value}-menu-button`}
|
|
105
|
+
/>
|
|
100
106
|
</DropdownMenuTrigger>
|
|
101
107
|
<DropdownMenuContent align="start">{menu}</DropdownMenuContent>
|
|
102
108
|
</DropdownMenu>
|