slice-machine-ui 1.22.2 → 1.22.3-alpha.chore-introduce-css-modules.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/.depcheckrc +4 -1
- package/.eslintignore +1 -0
- 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/QLcban0JdGEoFu6NgapR9/_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/18539003-7b2711e6c51d6fac.js +97 -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/286-ed90373e9a469944.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/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-3bb7f58b43c87166.js +430 -0
- package/out/_next/static/chunks/pages/changelog-68d115a14f1423d7.js +1 -0
- package/out/_next/static/chunks/pages/{changes-52c9d917808d1461.js → changes-1cf9e7888029f113.js} +1 -1
- 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]-73dd999915509965.js +1 -0
- package/out/_next/static/chunks/pages/slices-7b09cb5130c63bb3.js +1 -0
- package/out/_next/static/css/37153180c3b0dd66.css +1 -0
- package/out/_next/static/css/538ecf581b0e7c11.css +1 -0
- package/out/_next/static/css/{5da5d3cd7a87c3cf.css → 72465cc1225f28a2.css} +1 -1
- package/out/_next/static/css/{77abb01eee0e43a7.css → b22c0750c14cc089.css} +1 -1
- package/out/_next/static/css/f8eb526e10bc2441.css +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 +21 -11
- 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/Kbd/Kbd.module.css +10 -0
- package/src/components/Kbd/Kbd.module.css.d.ts +5 -0
- package/src/components/Kbd/Kbd.tsx +1 -1
- 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/stylelint.config.js +17 -0
- 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/3vLhj_JZ10e4rwC2sTZNQ/_buildManifest.js +0 -1
- package/out/_next/static/chunks/18539003-4460ccbfe3109578.js +0 -97
- package/out/_next/static/chunks/482-49264466566eac99.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-fe1af089657fb0cc.js +0 -1
- package/out/_next/static/chunks/958-3d829456f4f5632c.js +0 -1
- package/out/_next/static/chunks/pages/_app-f88a66f6532a8e87.js +0 -458
- package/out/_next/static/chunks/pages/changelog-4d0f2f1222e403fe.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/out/_next/static/css/1bbf650dfd37ce69.css +0 -1
- package/out/_next/static/css/7d650bca12dc4061.css +0 -1
- package/out/_next/static/css/cb33580e45d01b59.css +0 -1
- package/postcss.config.js +0 -2
- package/src/components/Kbd/Kbd.css.ts +0 -16
- 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/{3vLhj_JZ10e4rwC2sTZNQ → QLcban0JdGEoFu6NgapR9}/_ssgManifest.js +0 -0
|
@@ -1,79 +1,22 @@
|
|
|
1
1
|
import { useEffect, useCallback } from "react";
|
|
2
2
|
import * as Sentry from "@sentry/nextjs";
|
|
3
|
-
import { useSelector } from "react-redux";
|
|
4
3
|
import useSwr from "swr";
|
|
5
4
|
|
|
6
|
-
import { hasLocal } from "@lib/models/common/ModelData";
|
|
7
5
|
import useSliceMachineActions from "@src/modules/useSliceMachineActions";
|
|
8
|
-
import { isSelectedSliceTouched } from "@src/modules/selectedSlice/selectors";
|
|
9
|
-
import { isSelectedCustomTypeTouched } from "@src/modules/selectedCustomType";
|
|
10
|
-
import { SliceMachineStoreType } from "@src/redux/type";
|
|
11
6
|
import ServerState from "@lib/models/server/ServerState";
|
|
12
7
|
import { getState } from "@src/apiClient";
|
|
13
8
|
|
|
14
9
|
const useServerState = () => {
|
|
15
|
-
const { refreshState
|
|
16
|
-
useSliceMachineActions();
|
|
10
|
+
const { refreshState } = useSliceMachineActions();
|
|
17
11
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
12
|
const handleRefreshState = useCallback(refreshState, []);
|
|
19
13
|
const { data: serverState } = useSwr<ServerState>("getState", async () => {
|
|
20
14
|
return await getState();
|
|
21
15
|
});
|
|
22
16
|
|
|
23
|
-
// Whether or not current slice or custom type builder is touched, and its related server state.
|
|
24
|
-
const {
|
|
25
|
-
selectedSlice,
|
|
26
|
-
sliceIsTouched,
|
|
27
|
-
selectedCustomType,
|
|
28
|
-
customTypeIsTouched,
|
|
29
|
-
} = useSelector((store: SliceMachineStoreType) => ({
|
|
30
|
-
selectedSlice: store.selectedSlice,
|
|
31
|
-
sliceIsTouched: isSelectedSliceTouched(
|
|
32
|
-
store,
|
|
33
|
-
store.selectedSlice?.from ?? "",
|
|
34
|
-
store.selectedSlice?.model.id ?? "",
|
|
35
|
-
),
|
|
36
|
-
selectedCustomType: Boolean(store.selectedCustomType?.initialModel.id)
|
|
37
|
-
? store.availableCustomTypes[
|
|
38
|
-
store.selectedCustomType?.initialModel.id ?? ""
|
|
39
|
-
]
|
|
40
|
-
: null,
|
|
41
|
-
customTypeIsTouched: isSelectedCustomTypeTouched(store),
|
|
42
|
-
}));
|
|
43
|
-
|
|
44
17
|
useEffect(() => {
|
|
45
18
|
let canceled = false;
|
|
46
19
|
if (serverState && !canceled) {
|
|
47
|
-
// If slice builder is untouched, update from server state.
|
|
48
|
-
if (selectedSlice && !sliceIsTouched) {
|
|
49
|
-
const serverSlice = serverState.libraries
|
|
50
|
-
.find((l) => l.name === selectedSlice?.from)
|
|
51
|
-
?.components.find((c) => c.model.id === selectedSlice?.model.id);
|
|
52
|
-
|
|
53
|
-
if (serverSlice) {
|
|
54
|
-
initSliceStore(serverSlice);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// If custom type builder is untouched, update from server state.
|
|
59
|
-
if (
|
|
60
|
-
selectedCustomType &&
|
|
61
|
-
hasLocal(selectedCustomType) &&
|
|
62
|
-
!customTypeIsTouched
|
|
63
|
-
) {
|
|
64
|
-
const serverCustomType = serverState.customTypes.find(
|
|
65
|
-
(customType) => customType.id === selectedCustomType.local.id,
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
if (serverCustomType) {
|
|
69
|
-
const remoteCustomType = serverState.remoteCustomTypes.find(
|
|
70
|
-
(customType) => customType.id === selectedCustomType.local.id,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
initCustomTypeStore(serverCustomType, remoteCustomType);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
20
|
handleRefreshState(serverState);
|
|
78
21
|
|
|
79
22
|
Sentry.setUser({ id: serverState.env.shortId });
|
|
@@ -11,7 +11,7 @@ import { refreshStateCreator } from "@src/modules/environment";
|
|
|
11
11
|
import { call, fork, put, takeLatest } from "redux-saga/effects";
|
|
12
12
|
import { withLoader } from "@src/modules/loading";
|
|
13
13
|
import { LoadingKeysEnum } from "@src/modules/loading/types";
|
|
14
|
-
import {
|
|
14
|
+
import { updateCustomType } from "@src/apiClient";
|
|
15
15
|
import { modalCloseCreator } from "@src/modules/modal";
|
|
16
16
|
import { push } from "connected-next-router";
|
|
17
17
|
import { createCustomType } from "@src/features/customTypes/customTypesTable/createCustomType";
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
normalizeFrontendCustomType,
|
|
22
22
|
normalizeFrontendCustomTypes,
|
|
23
23
|
} from "@lib/models/common/normalizers/customType";
|
|
24
|
-
import { saveCustomTypeCreator } from "../selectedCustomType/actions";
|
|
25
24
|
import { omit } from "lodash";
|
|
26
25
|
import { deleteSliceCreator } from "../slices";
|
|
27
26
|
import { filterSliceFromCustomType } from "@lib/utils/shared/customTypes";
|
|
@@ -37,6 +36,12 @@ import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMess
|
|
|
37
36
|
import { CustomTypes } from "@lib/models/common/CustomType";
|
|
38
37
|
import { ToastMessageWithPath } from "@components/ToasterContainer";
|
|
39
38
|
|
|
39
|
+
export const saveCustomTypeCreator = createAsyncAction(
|
|
40
|
+
"CUSTOM_TYPE/SAVE.REQUEST",
|
|
41
|
+
"CUSTOM_TYPE/SAVE.RESPONSE",
|
|
42
|
+
"CUSTOM_TYPE/SAVE.FAILURE",
|
|
43
|
+
)<undefined, { customType: CustomTypeSM }>();
|
|
44
|
+
|
|
40
45
|
// Action Creators
|
|
41
46
|
export const createCustomTypeCreator = createAsyncAction(
|
|
42
47
|
"CUSTOM_TYPES/CREATE.REQUEST",
|
|
@@ -240,7 +245,7 @@ export function* createCustomTypeSaga({
|
|
|
240
245
|
payload.format,
|
|
241
246
|
),
|
|
242
247
|
);
|
|
243
|
-
yield call(
|
|
248
|
+
yield call(updateCustomType, CustomTypes.fromSM(newCustomType));
|
|
244
249
|
yield put(createCustomTypeCreator.success({ newCustomType }));
|
|
245
250
|
yield put(modalCloseCreator());
|
|
246
251
|
yield put(
|
|
@@ -32,7 +32,6 @@ import { updateSliceMock } from "../slices";
|
|
|
32
32
|
|
|
33
33
|
import { modalOpenCreator } from "../modal";
|
|
34
34
|
import { ModalKeysEnum } from "../modal/types";
|
|
35
|
-
import { updateSelectedSliceMocks } from "../selectedSlice/actions";
|
|
36
35
|
|
|
37
36
|
export const initialState: SimulatorStoreType = {
|
|
38
37
|
setupSteps: null,
|
|
@@ -266,7 +265,6 @@ export function* saveSliceMockSaga({
|
|
|
266
265
|
);
|
|
267
266
|
yield put(updateSliceMock(payload));
|
|
268
267
|
|
|
269
|
-
yield put(updateSelectedSliceMocks({ mocks: payload.mocks }));
|
|
270
268
|
yield put(saveSliceMockCreator.success());
|
|
271
269
|
} catch (error) {
|
|
272
270
|
yield put(
|
|
@@ -25,13 +25,10 @@ import { modalCloseCreator } from "@src/modules/modal";
|
|
|
25
25
|
import { refreshStateCreator } from "@src/modules/environment";
|
|
26
26
|
import { SliceMachineStoreType } from "@src/redux/type";
|
|
27
27
|
import { openToasterCreator, ToasterType } from "@src/modules/toaster";
|
|
28
|
-
import {
|
|
29
|
-
updateAndSaveSliceCreator,
|
|
30
|
-
updateSliceCreator,
|
|
31
|
-
} from "../selectedSlice/actions";
|
|
32
|
-
import { generateSliceCustomScreenshotCreator } from "../screenshots/actions";
|
|
33
|
-
import { selectSliceById } from "../selectedSlice/selectors";
|
|
34
28
|
import { SlicesStoreType } from "./types";
|
|
29
|
+
import { ComponentUI, ScreenshotUI } from "@lib/models/common/ComponentUI";
|
|
30
|
+
import { selectSliceById } from "./selector";
|
|
31
|
+
import { ScreenshotGenerationMethod } from "@lib/models/common/Screenshots";
|
|
35
32
|
|
|
36
33
|
// Action Creators
|
|
37
34
|
export const createSlice = createAction("SLICES/CREATE_SLICE")<{
|
|
@@ -70,6 +67,35 @@ export const deleteSliceCreator = createAsyncAction(
|
|
|
70
67
|
libName: string;
|
|
71
68
|
}
|
|
72
69
|
>();
|
|
70
|
+
|
|
71
|
+
export const updateSliceCreator = createAsyncAction(
|
|
72
|
+
"SLICE/UPDATE.REQUEST",
|
|
73
|
+
"SLICE/UPDATE.RESPONSE",
|
|
74
|
+
"SLICE/UPDATE.FAILURE",
|
|
75
|
+
)<
|
|
76
|
+
{
|
|
77
|
+
component: ComponentUI;
|
|
78
|
+
setSliceBuilderState: () => void;
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
component: ComponentUI;
|
|
82
|
+
}
|
|
83
|
+
>();
|
|
84
|
+
|
|
85
|
+
export const generateSliceCustomScreenshotCreator = createAsyncAction(
|
|
86
|
+
"SLICE/GENERATE_CUSTOM_SCREENSHOT.REQUEST",
|
|
87
|
+
"SLICE/GENERATE_CUSTOM_SCREENSHOT.RESPONSE",
|
|
88
|
+
"SLICE/GENERATE_CUSTOM_SCREENSHOT.FAILURE",
|
|
89
|
+
)<
|
|
90
|
+
{
|
|
91
|
+
variationId: string;
|
|
92
|
+
component: ComponentUI;
|
|
93
|
+
file: Blob;
|
|
94
|
+
method: ScreenshotGenerationMethod;
|
|
95
|
+
},
|
|
96
|
+
{ variationId: string; screenshot: ScreenshotUI; component: ComponentUI }
|
|
97
|
+
>();
|
|
98
|
+
|
|
73
99
|
export const updateSliceMock =
|
|
74
100
|
createAction("SLICE/UPDATE_MOCK")<SaveSliceMockRequest>();
|
|
75
101
|
|
|
@@ -79,7 +105,6 @@ type SlicesActions =
|
|
|
79
105
|
| ActionType<typeof renameSliceCreator>
|
|
80
106
|
| ActionType<typeof deleteSliceCreator>
|
|
81
107
|
| ActionType<typeof updateSliceCreator>
|
|
82
|
-
| ActionType<typeof updateAndSaveSliceCreator>
|
|
83
108
|
| ActionType<typeof generateSliceCustomScreenshotCreator>
|
|
84
109
|
| ActionType<typeof updateSliceMock>;
|
|
85
110
|
|
|
@@ -161,24 +186,6 @@ export const slicesReducer: Reducer<SlicesStoreType | null, SlicesActions> = (
|
|
|
161
186
|
|
|
162
187
|
return { ...state, libraries: newLibraries };
|
|
163
188
|
}
|
|
164
|
-
case getType(updateAndSaveSliceCreator): {
|
|
165
|
-
const { component: newComponent } = action.payload;
|
|
166
|
-
return {
|
|
167
|
-
...state,
|
|
168
|
-
libraries: state.libraries.map((library) =>
|
|
169
|
-
library.name === newComponent.from
|
|
170
|
-
? {
|
|
171
|
-
...library,
|
|
172
|
-
components: library.components.map((component) =>
|
|
173
|
-
component.model.id === newComponent.model.id
|
|
174
|
-
? newComponent
|
|
175
|
-
: component,
|
|
176
|
-
),
|
|
177
|
-
}
|
|
178
|
-
: library,
|
|
179
|
-
),
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
189
|
case getType(generateSliceCustomScreenshotCreator.success): {
|
|
183
190
|
const { component, screenshot, variationId } = action.payload;
|
|
184
191
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SliceMachineStoreType } from "@src/redux/type";
|
|
2
|
+
|
|
3
|
+
import { getLibraries } from "./index";
|
|
4
|
+
|
|
5
|
+
export const selectSliceById = (
|
|
6
|
+
store: SliceMachineStoreType,
|
|
7
|
+
libraryName: string,
|
|
8
|
+
sliceId: string,
|
|
9
|
+
) => {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
11
|
+
const libraries = getLibraries(store) || [];
|
|
12
|
+
|
|
13
|
+
const library = libraries.find((library) => library.name === libraryName);
|
|
14
|
+
const slice = library?.components.find((c) => c.model.id === sliceId);
|
|
15
|
+
|
|
16
|
+
return slice;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const selectCurrentSlice = (
|
|
20
|
+
store: SliceMachineStoreType,
|
|
21
|
+
lib: string,
|
|
22
|
+
sliceName: string,
|
|
23
|
+
) => {
|
|
24
|
+
const library = getLibraries(store)?.find(
|
|
25
|
+
(l) => l.name.replace(/\//g, "--") === lib,
|
|
26
|
+
);
|
|
27
|
+
const slice = library?.components.find((c) => c.model.name === sliceName);
|
|
28
|
+
|
|
29
|
+
return slice;
|
|
30
|
+
};
|
|
@@ -21,59 +21,23 @@ import {
|
|
|
21
21
|
createCustomTypeCreator,
|
|
22
22
|
deleteCustomTypeCreator,
|
|
23
23
|
renameAvailableCustomType,
|
|
24
|
-
} from "./availableCustomTypes";
|
|
25
|
-
import { createSlice, deleteSliceCreator, renameSliceCreator } from "./slices";
|
|
26
|
-
import { UserContextStoreType, UserReviewType } from "./userContext/types";
|
|
27
|
-
import { GenericToastTypes, openToasterCreator } from "./toaster";
|
|
28
|
-
import {
|
|
29
|
-
initCustomTypeStoreCreator,
|
|
30
|
-
createTabCreator,
|
|
31
|
-
deleteTabCreator,
|
|
32
|
-
updateTabCreator,
|
|
33
|
-
addFieldCreator,
|
|
34
|
-
deleteFieldCreator,
|
|
35
|
-
reorderFieldCreator,
|
|
36
|
-
replaceFieldCreator,
|
|
37
|
-
deleteSharedSliceCreator,
|
|
38
|
-
createSliceZoneCreator,
|
|
39
|
-
deleteSliceZoneCreator,
|
|
40
24
|
saveCustomTypeCreator,
|
|
41
|
-
|
|
42
|
-
deleteFieldIntoGroupCreator,
|
|
43
|
-
reorderFieldIntoGroupCreator,
|
|
44
|
-
replaceFieldIntoGroupCreator,
|
|
45
|
-
cleanupCustomTypeStoreCreator,
|
|
46
|
-
renameSelectedCustomTypeLabel,
|
|
47
|
-
} from "./selectedCustomType";
|
|
48
|
-
import type { SliceBuilderState } from "@builders/SliceBuilder";
|
|
49
|
-
import {
|
|
50
|
-
CustomTypeSM,
|
|
51
|
-
CustomTypes,
|
|
52
|
-
TabField,
|
|
53
|
-
} from "@lib/models/common/CustomType";
|
|
54
|
-
import {
|
|
55
|
-
CustomType,
|
|
56
|
-
NestableWidget,
|
|
57
|
-
} from "@prismicio/types-internal/lib/customtypes";
|
|
25
|
+
} from "./availableCustomTypes";
|
|
58
26
|
import {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
removeSliceWidgetCreator,
|
|
64
|
-
reorderSliceWidgetCreator,
|
|
65
|
-
replaceSliceWidgetCreator,
|
|
66
|
-
updateAndSaveSliceCreator,
|
|
27
|
+
createSlice,
|
|
28
|
+
deleteSliceCreator,
|
|
29
|
+
generateSliceCustomScreenshotCreator,
|
|
30
|
+
renameSliceCreator,
|
|
67
31
|
updateSliceCreator,
|
|
68
|
-
|
|
69
|
-
} from "./
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
32
|
+
} from "./slices";
|
|
33
|
+
import { UserContextStoreType, UserReviewType } from "./userContext/types";
|
|
34
|
+
import { GenericToastTypes, openToasterCreator } from "./toaster";
|
|
35
|
+
import { CustomTypes } from "@lib/models/common/CustomType";
|
|
36
|
+
import { CustomType } from "@prismicio/types-internal/lib/customtypes";
|
|
37
|
+
import { ComponentUI, ScreenshotUI } from "../../lib/models/common/ComponentUI";
|
|
72
38
|
import { ChangesPushSagaPayload, changesPushCreator } from "./pushChangesSaga";
|
|
73
|
-
import type { ScreenshotGenerationMethod } from "@lib/models/common/Screenshots";
|
|
74
39
|
import { saveSliceMockCreator } from "./simulator";
|
|
75
40
|
import { SaveSliceMockRequest } from "@src/apiClient";
|
|
76
|
-
import { VariationSM, WidgetsArea } from "@lib/models/common/Slice";
|
|
77
41
|
import { CustomTypeFormat } from "@slicemachine/manager";
|
|
78
42
|
import { LibraryUI } from "@lib/models/common/LibraryUI";
|
|
79
43
|
|
|
@@ -163,15 +127,6 @@ const useSliceMachineActions = () => {
|
|
|
163
127
|
createCustomTypeCreator.request({ id, label, repeatable, format }),
|
|
164
128
|
);
|
|
165
129
|
|
|
166
|
-
// Custom type module
|
|
167
|
-
const initCustomTypeStore = (
|
|
168
|
-
model: CustomTypeSM,
|
|
169
|
-
remoteModel: CustomTypeSM | undefined,
|
|
170
|
-
) => dispatch(initCustomTypeStoreCreator({ model, remoteModel }));
|
|
171
|
-
const cleanupCustomTypeStore = () =>
|
|
172
|
-
dispatch(cleanupCustomTypeStoreCreator());
|
|
173
|
-
const saveCustomType = () => dispatch(saveCustomTypeCreator.request());
|
|
174
|
-
|
|
175
130
|
/**
|
|
176
131
|
* Success actions = sync store state from external actions. If its name
|
|
177
132
|
* contains "Creator", it means it is still used in a saga and that `.request`
|
|
@@ -200,207 +155,29 @@ const useSliceMachineActions = () => {
|
|
|
200
155
|
|
|
201
156
|
/** End of sucess actions */
|
|
202
157
|
|
|
203
|
-
const createCustomTypeTab = (tabId: string) =>
|
|
204
|
-
dispatch(createTabCreator({ tabId }));
|
|
205
|
-
const deleteCustomTypeTab = (tabId: string) =>
|
|
206
|
-
dispatch(deleteTabCreator({ tabId }));
|
|
207
|
-
const updateCustomTypeTab = (tabId: string, newTabId: string) =>
|
|
208
|
-
dispatch(updateTabCreator({ tabId, newTabId }));
|
|
209
|
-
const addCustomTypeField = (
|
|
210
|
-
tabId: string,
|
|
211
|
-
fieldId: string,
|
|
212
|
-
field: TabField,
|
|
213
|
-
) => dispatch(addFieldCreator({ tabId, fieldId, field }));
|
|
214
|
-
const deleteCustomTypeField = (tabId: string, fieldId: string) =>
|
|
215
|
-
dispatch(deleteFieldCreator({ tabId, fieldId }));
|
|
216
|
-
const reorderCustomTypeField = (tabId: string, start: number, end: number) =>
|
|
217
|
-
dispatch(reorderFieldCreator({ tabId, start, end }));
|
|
218
|
-
const renameSelectedCustomType = (newLabel: string) =>
|
|
219
|
-
dispatch(renameSelectedCustomTypeLabel({ newLabel }));
|
|
220
|
-
const replaceCustomTypeField = (
|
|
221
|
-
tabId: string,
|
|
222
|
-
previousFieldId: string,
|
|
223
|
-
newFieldId: string,
|
|
224
|
-
value: TabField,
|
|
225
|
-
) =>
|
|
226
|
-
dispatch(
|
|
227
|
-
replaceFieldCreator({ tabId, previousFieldId, newFieldId, value }),
|
|
228
|
-
);
|
|
229
|
-
const createSliceZone = (tabId: string) =>
|
|
230
|
-
dispatch(createSliceZoneCreator({ tabId }));
|
|
231
|
-
const deleteSliceZone = (tabId: string) =>
|
|
232
|
-
dispatch(deleteSliceZoneCreator({ tabId }));
|
|
233
|
-
const deleteCustomTypeSharedSlice = (tabId: string, sliceId: string) =>
|
|
234
|
-
dispatch(deleteSharedSliceCreator({ tabId, sliceId }));
|
|
235
|
-
const addFieldIntoGroup = (
|
|
236
|
-
tabId: string,
|
|
237
|
-
groupId: string,
|
|
238
|
-
fieldId: string,
|
|
239
|
-
field: NestableWidget,
|
|
240
|
-
) => dispatch(addFieldIntoGroupCreator({ tabId, groupId, fieldId, field }));
|
|
241
|
-
const deleteFieldIntoGroup = (
|
|
242
|
-
tabId: string,
|
|
243
|
-
groupId: string,
|
|
244
|
-
fieldId: string,
|
|
245
|
-
) => dispatch(deleteFieldIntoGroupCreator({ tabId, groupId, fieldId }));
|
|
246
|
-
const reorderFieldIntoGroup = (
|
|
247
|
-
tabId: string,
|
|
248
|
-
groupId: string,
|
|
249
|
-
start: number,
|
|
250
|
-
end: number,
|
|
251
|
-
) => dispatch(reorderFieldIntoGroupCreator({ tabId, groupId, start, end }));
|
|
252
|
-
const replaceFieldIntoGroup = (
|
|
253
|
-
tabId: string,
|
|
254
|
-
groupId: string,
|
|
255
|
-
previousFieldId: string,
|
|
256
|
-
newFieldId: string,
|
|
257
|
-
value: NestableWidget,
|
|
258
|
-
) =>
|
|
259
|
-
dispatch(
|
|
260
|
-
replaceFieldIntoGroupCreator({
|
|
261
|
-
tabId,
|
|
262
|
-
groupId,
|
|
263
|
-
previousFieldId,
|
|
264
|
-
newFieldId,
|
|
265
|
-
value,
|
|
266
|
-
}),
|
|
267
|
-
);
|
|
268
|
-
|
|
269
158
|
// Slice module
|
|
270
|
-
const
|
|
271
|
-
dispatch(initSliceStoreCreator(component));
|
|
272
|
-
|
|
273
|
-
const addSliceWidget = (
|
|
274
|
-
variationId: string,
|
|
275
|
-
widgetsArea: WidgetsArea,
|
|
276
|
-
key: string,
|
|
277
|
-
value: NestableWidget,
|
|
278
|
-
) => {
|
|
279
|
-
dispatch(addSliceWidgetCreator({ variationId, widgetsArea, key, value }));
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
const replaceSliceWidget = (
|
|
283
|
-
variationId: string,
|
|
284
|
-
widgetsArea: WidgetsArea,
|
|
285
|
-
previousKey: string,
|
|
286
|
-
newKey: string,
|
|
287
|
-
value: NestableWidget,
|
|
288
|
-
) => {
|
|
289
|
-
dispatch(
|
|
290
|
-
replaceSliceWidgetCreator({
|
|
291
|
-
variationId,
|
|
292
|
-
widgetsArea,
|
|
293
|
-
previousKey,
|
|
294
|
-
newKey,
|
|
295
|
-
value,
|
|
296
|
-
}),
|
|
297
|
-
);
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const reorderSliceWidget = (
|
|
301
|
-
variationId: string,
|
|
302
|
-
widgetsArea: WidgetsArea,
|
|
303
|
-
start: number,
|
|
304
|
-
end: number | undefined,
|
|
305
|
-
) => {
|
|
306
|
-
dispatch(
|
|
307
|
-
reorderSliceWidgetCreator({
|
|
308
|
-
variationId,
|
|
309
|
-
widgetsArea,
|
|
310
|
-
start,
|
|
311
|
-
end,
|
|
312
|
-
}),
|
|
313
|
-
);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
const removeSliceWidget = (
|
|
317
|
-
variationId: string,
|
|
318
|
-
widgetsArea: WidgetsArea,
|
|
319
|
-
key: string,
|
|
320
|
-
) => {
|
|
321
|
-
dispatch(
|
|
322
|
-
removeSliceWidgetCreator({
|
|
323
|
-
variationId,
|
|
324
|
-
widgetsArea,
|
|
325
|
-
key,
|
|
326
|
-
}),
|
|
327
|
-
);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
const deleteSliceWidgetMock = (
|
|
331
|
-
variationId: string,
|
|
332
|
-
widgetArea: WidgetsArea,
|
|
333
|
-
newKey: string,
|
|
334
|
-
) => {
|
|
335
|
-
dispatch(
|
|
336
|
-
deleteSliceWidgetMockCreator({
|
|
337
|
-
variationId,
|
|
338
|
-
widgetArea,
|
|
339
|
-
newKey,
|
|
340
|
-
}),
|
|
341
|
-
);
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
const updateSliceWidgetMock = (
|
|
345
|
-
variationId: string,
|
|
346
|
-
widgetArea: WidgetsArea,
|
|
347
|
-
previousKey: string,
|
|
348
|
-
newKey: string,
|
|
349
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
350
|
-
mockValue: any,
|
|
351
|
-
) => {
|
|
159
|
+
const saveSliceSuccess = (component: ComponentUI) => {
|
|
352
160
|
dispatch(
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
widgetArea,
|
|
356
|
-
previousKey,
|
|
357
|
-
newKey,
|
|
358
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
359
|
-
mockValue,
|
|
161
|
+
updateSliceCreator.success({
|
|
162
|
+
component,
|
|
360
163
|
}),
|
|
361
164
|
);
|
|
362
165
|
};
|
|
363
166
|
|
|
364
|
-
const
|
|
167
|
+
const saveSliceCustomScreenshotSuccess = (
|
|
365
168
|
variationId: string,
|
|
169
|
+
screenshot: ScreenshotUI,
|
|
366
170
|
component: ComponentUI,
|
|
367
|
-
file: Blob,
|
|
368
|
-
method: ScreenshotGenerationMethod,
|
|
369
171
|
) => {
|
|
370
172
|
dispatch(
|
|
371
|
-
generateSliceCustomScreenshotCreator.
|
|
173
|
+
generateSliceCustomScreenshotCreator.success({
|
|
372
174
|
variationId,
|
|
175
|
+
screenshot,
|
|
373
176
|
component,
|
|
374
|
-
file,
|
|
375
|
-
method,
|
|
376
|
-
}),
|
|
377
|
-
);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
const updateSlice = (
|
|
381
|
-
component: ComponentUI,
|
|
382
|
-
setSliceBuilderState: (sliceBuilderState: SliceBuilderState) => void,
|
|
383
|
-
) => {
|
|
384
|
-
dispatch(
|
|
385
|
-
updateSliceCreator.request({
|
|
386
|
-
component,
|
|
387
|
-
setSliceBuilderState,
|
|
388
177
|
}),
|
|
389
178
|
);
|
|
390
179
|
};
|
|
391
180
|
|
|
392
|
-
const updateAndSaveSlice = (component: ComponentUI) => {
|
|
393
|
-
dispatch(updateAndSaveSliceCreator({ component }));
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
const copyVariationSlice = (
|
|
397
|
-
key: string,
|
|
398
|
-
name: string,
|
|
399
|
-
copied: VariationSM,
|
|
400
|
-
) => {
|
|
401
|
-
dispatch(copyVariationSliceCreator({ key, name, copied }));
|
|
402
|
-
};
|
|
403
|
-
|
|
404
181
|
const createSliceSuccess = (libraries: readonly LibraryUI[]) =>
|
|
405
182
|
dispatch(createSlice({ libraries }));
|
|
406
183
|
|
|
@@ -472,38 +249,11 @@ const useSliceMachineActions = () => {
|
|
|
472
249
|
stopLoadingReview,
|
|
473
250
|
startLoadingReview,
|
|
474
251
|
createCustomType,
|
|
475
|
-
renameSelectedCustomType,
|
|
476
252
|
deleteCustomTypeSuccess,
|
|
477
253
|
renameAvailableCustomTypeSuccess,
|
|
478
|
-
initCustomTypeStore,
|
|
479
|
-
cleanupCustomTypeStore,
|
|
480
|
-
saveCustomType,
|
|
481
254
|
saveCustomTypeSuccess,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
deleteCustomTypeTab,
|
|
485
|
-
addCustomTypeField,
|
|
486
|
-
deleteCustomTypeField,
|
|
487
|
-
reorderCustomTypeField,
|
|
488
|
-
replaceCustomTypeField,
|
|
489
|
-
createSliceZone,
|
|
490
|
-
deleteSliceZone,
|
|
491
|
-
deleteCustomTypeSharedSlice,
|
|
492
|
-
addFieldIntoGroup,
|
|
493
|
-
deleteFieldIntoGroup,
|
|
494
|
-
reorderFieldIntoGroup,
|
|
495
|
-
replaceFieldIntoGroup,
|
|
496
|
-
initSliceStore,
|
|
497
|
-
addSliceWidget,
|
|
498
|
-
replaceSliceWidget,
|
|
499
|
-
reorderSliceWidget,
|
|
500
|
-
removeSliceWidget,
|
|
501
|
-
updateSliceWidgetMock,
|
|
502
|
-
deleteSliceWidgetMock,
|
|
503
|
-
generateSliceCustomScreenshot,
|
|
504
|
-
updateSlice,
|
|
505
|
-
updateAndSaveSlice,
|
|
506
|
-
copyVariationSlice,
|
|
255
|
+
saveSliceSuccess,
|
|
256
|
+
saveSliceCustomScreenshotSuccess,
|
|
507
257
|
createSliceSuccess,
|
|
508
258
|
renameSlice,
|
|
509
259
|
deleteSlice,
|
package/src/redux/reducer.ts
CHANGED
|
@@ -10,10 +10,8 @@ import { userContextReducer } from "@src/modules/userContext";
|
|
|
10
10
|
import { environmentReducer } from "@src/modules/environment";
|
|
11
11
|
import { simulatorReducer } from "@src/modules/simulator";
|
|
12
12
|
import { availableCustomTypesReducer } from "@src/modules/availableCustomTypes";
|
|
13
|
-
import { selectedCustomTypeReducer } from "@src/modules/selectedCustomType";
|
|
14
13
|
import { slicesReducer } from "@src/modules/slices";
|
|
15
14
|
import { routerReducer } from "connected-next-router";
|
|
16
|
-
import { selectedSliceReducer } from "@src/modules/selectedSlice/reducer";
|
|
17
15
|
import { pushChangesReducer } from "@src/modules/pushChangesSaga";
|
|
18
16
|
|
|
19
17
|
/** Creates the main reducer */
|
|
@@ -25,9 +23,7 @@ const createReducer = (): Reducer =>
|
|
|
25
23
|
environment: environmentReducer,
|
|
26
24
|
simulator: simulatorReducer,
|
|
27
25
|
availableCustomTypes: availableCustomTypesReducer,
|
|
28
|
-
selectedCustomType: selectedCustomTypeReducer,
|
|
29
26
|
slices: slicesReducer,
|
|
30
|
-
selectedSlice: selectedSliceReducer,
|
|
31
27
|
router: routerReducer,
|
|
32
28
|
pushChanges: pushChangesReducer,
|
|
33
29
|
});
|
package/src/redux/saga.ts
CHANGED
|
@@ -2,11 +2,8 @@ import { fork } from "redux-saga/effects";
|
|
|
2
2
|
|
|
3
3
|
import { watchSimulatorSagas } from "@src/modules/simulator";
|
|
4
4
|
import { watchAvailableCustomTypesSagas } from "@src/modules/availableCustomTypes";
|
|
5
|
-
import { watchSelectedCustomTypeSagas } from "@src/modules/selectedCustomType";
|
|
6
|
-
import { selectedSliceSagas } from "@src/modules/selectedSlice/sagas";
|
|
7
5
|
import { watchSliceSagas } from "@src/modules/slices";
|
|
8
6
|
import { watchToasterSagas } from "@src/modules/toaster";
|
|
9
|
-
import { screenshotsSagas } from "@src/modules/screenshots/sagas";
|
|
10
7
|
import { watchChangesPushSagas } from "@src/modules/pushChangesSaga";
|
|
11
8
|
import { watchChangelogSagas } from "@src/modules/environment";
|
|
12
9
|
|
|
@@ -16,9 +13,6 @@ export default function* rootSaga() {
|
|
|
16
13
|
yield fork(watchAvailableCustomTypesSagas);
|
|
17
14
|
yield fork(watchSliceSagas);
|
|
18
15
|
yield fork(watchToasterSagas);
|
|
19
|
-
yield fork(watchSelectedCustomTypeSagas);
|
|
20
|
-
yield fork(screenshotsSagas);
|
|
21
|
-
yield fork(selectedSliceSagas);
|
|
22
16
|
yield fork(watchChangesPushSagas);
|
|
23
17
|
yield fork(watchChangelogSagas);
|
|
24
18
|
}
|
package/src/redux/type.ts
CHANGED
|
@@ -4,10 +4,8 @@ import { UserContextStoreType } from "@src/modules/userContext/types";
|
|
|
4
4
|
import { EnvironmentStoreType } from "@src/modules/environment/types";
|
|
5
5
|
import { SimulatorStoreType } from "@src/modules/simulator/types";
|
|
6
6
|
import { AvailableCustomTypesStoreType } from "@src/modules/availableCustomTypes/types";
|
|
7
|
-
import { SelectedCustomTypeStoreType } from "@src/modules/selectedCustomType/types";
|
|
8
7
|
import { SlicesStoreType } from "@src/modules/slices/types";
|
|
9
8
|
import { RouterState } from "connected-next-router/types";
|
|
10
|
-
import { SelectedSliceStoreType } from "@src/modules/selectedSlice/types";
|
|
11
9
|
import { PushChangesStoreType } from "@src/modules/pushChangesSaga";
|
|
12
10
|
|
|
13
11
|
export type SliceMachineStoreType = {
|
|
@@ -17,9 +15,7 @@ export type SliceMachineStoreType = {
|
|
|
17
15
|
environment: EnvironmentStoreType;
|
|
18
16
|
simulator: SimulatorStoreType;
|
|
19
17
|
availableCustomTypes: AvailableCustomTypesStoreType;
|
|
20
|
-
selectedCustomType: SelectedCustomTypeStoreType;
|
|
21
18
|
slices: SlicesStoreType;
|
|
22
|
-
selectedSlice: SelectedSliceStoreType;
|
|
23
19
|
router: RouterState;
|
|
24
20
|
pushChanges: PushChangesStoreType;
|
|
25
21
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
2
|
+
const { cssTheme } = require("@prismicio/editor-ui");
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
defaultSeverity: "warning",
|
|
6
|
+
reportNeedlessDisables: true,
|
|
7
|
+
reportInvalidScopeDisables: true,
|
|
8
|
+
reportDescriptionlessDisables: true,
|
|
9
|
+
rules: {
|
|
10
|
+
"declaration-property-value-allowed-list": cssTheme,
|
|
11
|
+
},
|
|
12
|
+
extends: [
|
|
13
|
+
"stylelint-config-recommended",
|
|
14
|
+
"stylelint-config-css-modules",
|
|
15
|
+
"stylelint-config-prettier",
|
|
16
|
+
],
|
|
17
|
+
};
|