@slicemachine/adapter-next 0.0.2 → 0.0.4
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/SliceSimulator.cjs +14 -41
- package/dist/SliceSimulator.cjs.map +1 -1
- package/dist/SliceSimulator.d.ts +2 -2
- package/dist/SliceSimulator.js +11 -36
- package/dist/SliceSimulator.js.map +1 -1
- package/dist/_virtual/_commonjsHelpers.cjs +5 -0
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +5 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/ponyfill.es2018.cjs +5 -0
- package/dist/_virtual/ponyfill.es2018.cjs.map +1 -0
- package/dist/_virtual/ponyfill.es2018.js +5 -0
- package/dist/_virtual/ponyfill.es2018.js.map +1 -0
- package/dist/constants.cjs +5 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/hooks/customType-asset-delete.cjs +3 -5
- package/dist/hooks/customType-asset-delete.cjs.map +1 -1
- package/dist/hooks/customType-asset-delete.js.map +1 -1
- package/dist/hooks/customType-asset-read.cjs +3 -5
- package/dist/hooks/customType-asset-read.cjs.map +1 -1
- package/dist/hooks/customType-asset-read.js.map +1 -1
- package/dist/hooks/customType-asset-update.cjs +4 -6
- package/dist/hooks/customType-asset-update.cjs.map +1 -1
- package/dist/hooks/customType-asset-update.js.map +1 -1
- package/dist/hooks/customType-create.cjs +4 -6
- package/dist/hooks/customType-create.cjs.map +1 -1
- package/dist/hooks/customType-create.js.map +1 -1
- package/dist/hooks/customType-delete.cjs +3 -5
- package/dist/hooks/customType-delete.cjs.map +1 -1
- package/dist/hooks/customType-delete.js.map +1 -1
- package/dist/hooks/customType-read.cjs +1 -1
- package/dist/hooks/customType-read.cjs.map +1 -1
- package/dist/hooks/customType-read.js.map +1 -1
- package/dist/hooks/customType-rename.cjs +6 -0
- package/dist/hooks/customType-rename.cjs.map +1 -0
- package/dist/hooks/customType-rename.d.ts +1 -0
- package/dist/hooks/customType-rename.js +6 -0
- package/dist/hooks/customType-rename.js.map +1 -0
- package/dist/hooks/customType-update.cjs +1 -1
- package/dist/hooks/customType-update.cjs.map +1 -1
- package/dist/hooks/customType-update.js.map +1 -1
- package/dist/hooks/customTypeLibrary-read.cjs +16 -10
- package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
- package/dist/hooks/customTypeLibrary-read.js +12 -4
- package/dist/hooks/customTypeLibrary-read.js.map +1 -1
- package/dist/hooks/slice-asset-delete.cjs +3 -5
- package/dist/hooks/slice-asset-delete.cjs.map +1 -1
- package/dist/hooks/slice-asset-delete.js.map +1 -1
- package/dist/hooks/slice-asset-read.cjs +3 -5
- package/dist/hooks/slice-asset-read.cjs.map +1 -1
- package/dist/hooks/slice-asset-read.js.map +1 -1
- package/dist/hooks/slice-asset-update.cjs +4 -6
- package/dist/hooks/slice-asset-update.cjs.map +1 -1
- package/dist/hooks/slice-asset-update.js.map +1 -1
- package/dist/hooks/slice-create.cjs +18 -30
- package/dist/hooks/slice-create.cjs.map +1 -1
- package/dist/hooks/slice-create.js +14 -24
- package/dist/hooks/slice-create.js.map +1 -1
- package/dist/hooks/slice-delete.cjs +6 -18
- package/dist/hooks/slice-delete.cjs.map +1 -1
- package/dist/hooks/slice-delete.js +3 -13
- package/dist/hooks/slice-delete.js.map +1 -1
- package/dist/hooks/slice-read.cjs +41 -7
- package/dist/hooks/slice-read.cjs.map +1 -1
- package/dist/hooks/slice-read.js +22 -6
- package/dist/hooks/slice-read.js.map +1 -1
- package/dist/hooks/slice-rename.cjs +43 -0
- package/dist/hooks/slice-rename.cjs.map +1 -0
- package/dist/hooks/slice-rename.d.ts +3 -0
- package/dist/hooks/slice-rename.js +26 -0
- package/dist/hooks/slice-rename.js.map +1 -0
- package/dist/hooks/slice-update.cjs +7 -34
- package/dist/hooks/slice-update.cjs.map +1 -1
- package/dist/hooks/slice-update.js +6 -13
- package/dist/hooks/slice-update.js.map +1 -1
- package/dist/hooks/sliceLibrary-read.cjs +16 -20
- package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
- package/dist/hooks/sliceLibrary-read.js +12 -13
- package/dist/hooks/sliceLibrary-read.js.map +1 -1
- package/dist/hooks/sliceSimulator-setup-read.cjs +31 -94
- package/dist/hooks/sliceSimulator-setup-read.cjs.map +1 -1
- package/dist/hooks/sliceSimulator-setup-read.js +31 -75
- package/dist/hooks/sliceSimulator-setup-read.js.map +1 -1
- package/dist/hooks/snippet-read.cjs +33 -18
- package/dist/hooks/snippet-read.cjs.map +1 -1
- package/dist/hooks/snippet-read.js +30 -13
- package/dist/hooks/snippet-read.js.map +1 -1
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/getJSOrTSXFileExtension.cjs +1 -1
- package/dist/lib/getJSOrTSXFileExtension.cjs.map +1 -1
- package/dist/lib/getJSOrTSXFileExtension.js.map +1 -1
- package/dist/lib/isSharedSliceModel.cjs +25 -0
- package/dist/lib/isSharedSliceModel.cjs.map +1 -0
- package/dist/lib/isSharedSliceModel.d.ts +2 -0
- package/dist/lib/isSharedSliceModel.js +8 -0
- package/dist/lib/isSharedSliceModel.js.map +1 -0
- package/dist/lib/pascalCase.cjs +1 -1
- package/dist/lib/pascalCase.cjs.map +1 -1
- package/dist/lib/pascalCase.js.map +1 -1
- package/dist/lib/readJSONFile.cjs +3 -5
- package/dist/lib/readJSONFile.cjs.map +1 -1
- package/dist/lib/readJSONFile.js.map +1 -1
- package/dist/lib/rejectIfNecessary.cjs +1 -1
- package/dist/lib/rejectIfNecessary.cjs.map +1 -1
- package/dist/lib/rejectIfNecessary.js.map +1 -1
- package/dist/lib/updateSliceModelFile.cjs +31 -0
- package/dist/lib/updateSliceModelFile.cjs.map +1 -0
- package/dist/lib/updateSliceModelFile.d.ts +9 -0
- package/dist/lib/updateSliceModelFile.js +14 -0
- package/dist/lib/updateSliceModelFile.js.map +1 -0
- package/dist/lib/upsertGlobalContentTypes.cjs +8 -6
- package/dist/lib/upsertGlobalContentTypes.cjs.map +1 -1
- package/dist/lib/upsertGlobalContentTypes.d.ts +1 -1
- package/dist/lib/upsertGlobalContentTypes.js +4 -0
- package/dist/lib/upsertGlobalContentTypes.js.map +1 -1
- package/dist/lib/upsertSliceLibraryIndexFile.cjs +48 -0
- package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -0
- package/dist/lib/upsertSliceLibraryIndexFile.d.ts +7 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js +31 -0
- package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -0
- package/dist/node_modules/data-uri-to-buffer/dist/index.cjs +41 -0
- package/dist/node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -0
- package/dist/node_modules/data-uri-to-buffer/dist/index.js +41 -0
- package/dist/node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
- package/dist/node_modules/fetch-blob/file.cjs +55 -0
- package/dist/node_modules/fetch-blob/file.cjs.map +1 -0
- package/dist/node_modules/fetch-blob/file.js +55 -0
- package/dist/node_modules/fetch-blob/file.js.map +1 -0
- package/dist/node_modules/fetch-blob/index.cjs +176 -0
- package/dist/node_modules/fetch-blob/index.cjs.map +1 -0
- package/dist/node_modules/fetch-blob/index.js +176 -0
- package/dist/node_modules/fetch-blob/index.js.map +1 -0
- package/dist/node_modules/fetch-blob/streams.cjs +43 -0
- package/dist/node_modules/fetch-blob/streams.cjs.map +1 -0
- package/dist/node_modules/fetch-blob/streams.js +42 -0
- package/dist/node_modules/fetch-blob/streams.js.map +1 -0
- package/dist/node_modules/formdata-polyfill/esm.min.cjs +115 -0
- package/dist/node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
- package/dist/node_modules/formdata-polyfill/esm.min.js +115 -0
- package/dist/node_modules/formdata-polyfill/esm.min.js.map +1 -0
- package/dist/node_modules/node-domexception/index.cjs +10 -0
- package/dist/node_modules/node-domexception/index.cjs.map +1 -0
- package/dist/node_modules/node-domexception/index.js +9 -0
- package/dist/node_modules/node-domexception/index.js.map +1 -0
- package/dist/node_modules/node-fetch/src/body.cjs +237 -0
- package/dist/node_modules/node-fetch/src/body.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/body.js +237 -0
- package/dist/node_modules/node-fetch/src/body.js.map +1 -0
- package/dist/node_modules/node-fetch/src/errors/abort-error.cjs +10 -0
- package/dist/node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/errors/abort-error.js +10 -0
- package/dist/node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
- package/dist/node_modules/node-fetch/src/errors/base.cjs +17 -0
- package/dist/node_modules/node-fetch/src/errors/base.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/errors/base.js +17 -0
- package/dist/node_modules/node-fetch/src/errors/base.js.map +1 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs +14 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js +14 -0
- package/dist/node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
- package/dist/node_modules/node-fetch/src/headers.cjs +173 -0
- package/dist/node_modules/node-fetch/src/headers.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/headers.js +173 -0
- package/dist/node_modules/node-fetch/src/headers.js.map +1 -0
- package/dist/node_modules/node-fetch/src/index.cjs +292 -0
- package/dist/node_modules/node-fetch/src/index.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/index.js +298 -0
- package/dist/node_modules/node-fetch/src/index.js.map +1 -0
- package/dist/node_modules/node-fetch/src/request.cjs +193 -0
- package/dist/node_modules/node-fetch/src/request.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/request.js +193 -0
- package/dist/node_modules/node-fetch/src/request.js.map +1 -0
- package/dist/node_modules/node-fetch/src/response.cjs +110 -0
- package/dist/node_modules/node-fetch/src/response.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/response.js +110 -0
- package/dist/node_modules/node-fetch/src/response.js.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/get-search.cjs +12 -0
- package/dist/node_modules/node-fetch/src/utils/get-search.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/get-search.js +12 -0
- package/dist/node_modules/node-fetch/src/utils/get-search.js.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/is-redirect.cjs +8 -0
- package/dist/node_modules/node-fetch/src/utils/is-redirect.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/is-redirect.js +8 -0
- package/dist/node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/is.cjs +28 -0
- package/dist/node_modules/node-fetch/src/utils/is.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/is.js +28 -0
- package/dist/node_modules/node-fetch/src/utils/is.js.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs +350 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js +350 -0
- package/dist/node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/referrer.cjs +149 -0
- package/dist/node_modules/node-fetch/src/utils/referrer.cjs.map +1 -0
- package/dist/node_modules/node-fetch/src/utils/referrer.js +149 -0
- package/dist/node_modules/node-fetch/src/utils/referrer.js.map +1 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +3599 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +3599 -0
- package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
- package/dist/package.json.cjs +5 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/{package.js → package.json.js} +1 -1
- package/dist/package.json.js.map +1 -0
- package/dist/plugin.cjs +6 -2
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +5 -1
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +32 -15
- package/src/constants.ts +5 -0
- package/src/hooks/customType-rename.ts +3 -0
- package/src/hooks/customTypeLibrary-read.ts +13 -4
- package/src/hooks/slice-create.ts +14 -32
- package/src/hooks/slice-delete.ts +3 -21
- package/src/hooks/slice-read.ts +37 -11
- package/src/hooks/slice-rename.ts +44 -0
- package/src/hooks/slice-update.ts +7 -31
- package/src/hooks/sliceLibrary-read.ts +13 -23
- package/src/hooks/sliceSimulator-setup-read.ts +37 -76
- package/src/hooks/snippet-read.ts +42 -22
- package/src/index.ts +0 -6
- package/src/lib/isSharedSliceModel.ts +14 -0
- package/src/lib/updateSliceModelFile.ts +32 -0
- package/src/lib/upsertGlobalContentTypes.ts +3 -0
- package/src/lib/{buildSliceLibraryIndexFileContents.ts → upsertSliceLibraryIndexFile.ts} +19 -9
- package/src/plugin.ts +4 -0
- package/dist/lib/buildSliceLibraryIndexFileContents.cjs +0 -23
- package/dist/lib/buildSliceLibraryIndexFileContents.cjs.map +0 -1
- package/dist/lib/buildSliceLibraryIndexFileContents.d.ts +0 -10
- package/dist/lib/buildSliceLibraryIndexFileContents.js +0 -23
- package/dist/lib/buildSliceLibraryIndexFileContents.js.map +0 -1
- package/dist/package.cjs +0 -5
- package/dist/package.cjs.map +0 -1
- package/dist/package.js.map +0 -1
package/dist/SliceSimulator.cjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const sliceSimulatorCore = require("@prismicio/slice-simulator-core");
|
|
6
|
-
function
|
|
7
|
-
if (e && e.__esModule)
|
|
8
|
-
return e;
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
9
7
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
10
8
|
if (e) {
|
|
11
9
|
for (const k in e) {
|
|
@@ -21,15 +19,9 @@ function _interopNamespace(e) {
|
|
|
21
19
|
n.default = e;
|
|
22
20
|
return Object.freeze(n);
|
|
23
21
|
}
|
|
24
|
-
const React__namespace = /* @__PURE__ */
|
|
22
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
25
23
|
const coreManager = new sliceSimulatorCore.CoreManager();
|
|
26
|
-
const SliceSimulator = ({
|
|
27
|
-
sliceZone: SliceZoneComp,
|
|
28
|
-
state,
|
|
29
|
-
background,
|
|
30
|
-
zIndex,
|
|
31
|
-
className
|
|
32
|
-
}) => {
|
|
24
|
+
const SliceSimulator = ({ sliceZone: SliceZoneComp, state, background, zIndex, className }) => {
|
|
33
25
|
const defaultProps = sliceSimulatorCore.getDefaultProps();
|
|
34
26
|
const [managedState, setManagedState] = React__namespace.useState(() => sliceSimulatorCore.getDefaultManagedState());
|
|
35
27
|
const [slices, setSlices] = React__namespace.useState(() => sliceSimulatorCore.getDefaultSlices());
|
|
@@ -59,35 +51,16 @@ const SliceSimulator = ({
|
|
|
59
51
|
didMount.current = true;
|
|
60
52
|
}
|
|
61
53
|
}, [state]);
|
|
62
|
-
return jsxRuntime.jsx("div", {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
background: typeof background === "undefined" ? defaultProps.background : background != null ? background : void 0
|
|
73
|
-
},
|
|
74
|
-
children: message ? jsxRuntime.jsx("article", {
|
|
75
|
-
dangerouslySetInnerHTML: {
|
|
76
|
-
__html: message
|
|
77
|
-
}
|
|
78
|
-
}) : slices.length ? jsxRuntime.jsx("div", {
|
|
79
|
-
id: "root",
|
|
80
|
-
className: sliceSimulatorCore.simulatorRootClass,
|
|
81
|
-
style: managedState.status !== sliceSimulatorCore.StateManagerStatus.Loaded ? {
|
|
82
|
-
display: "none"
|
|
83
|
-
} : void 0,
|
|
84
|
-
onClickCapture: sliceSimulatorCore.onClickHandler,
|
|
85
|
-
onSubmitCapture: sliceSimulatorCore.disableEventHandler,
|
|
86
|
-
children: jsxRuntime.jsx(SliceZoneComp, {
|
|
87
|
-
slices
|
|
88
|
-
})
|
|
89
|
-
}) : null
|
|
90
|
-
});
|
|
54
|
+
return jsxRuntime.jsx("div", { className: [sliceSimulatorCore.simulatorClass, className].filter(Boolean).join(" "), style: {
|
|
55
|
+
zIndex: typeof zIndex === "undefined" ? defaultProps.zIndex : zIndex ?? void 0,
|
|
56
|
+
position: "fixed",
|
|
57
|
+
top: 0,
|
|
58
|
+
left: 0,
|
|
59
|
+
width: "100%",
|
|
60
|
+
height: "100vh",
|
|
61
|
+
overflow: "auto",
|
|
62
|
+
background: typeof background === "undefined" ? defaultProps.background : background ?? void 0
|
|
63
|
+
}, children: message ? jsxRuntime.jsx("article", { dangerouslySetInnerHTML: { __html: message } }) : slices.length ? jsxRuntime.jsx("div", { id: "root", className: sliceSimulatorCore.simulatorRootClass, style: managedState.status !== sliceSimulatorCore.StateManagerStatus.Loaded ? { display: "none" } : void 0, onClickCapture: sliceSimulatorCore.onClickHandler, onSubmitCapture: sliceSimulatorCore.disableEventHandler, children: jsxRuntime.jsx(SliceZoneComp, { slices }) }) : null });
|
|
91
64
|
};
|
|
92
65
|
exports.SliceSimulator = SliceSimulator;
|
|
93
66
|
//# sourceMappingURL=SliceSimulator.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulator.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"SliceSimulator.cjs","sources":["../../src/SliceSimulator.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n\tCoreManager,\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n\tStateManagerEventType,\n\tStateManagerStatus,\n\tdisableEventHandler,\n\tgetDefaultManagedState,\n\tgetDefaultMessage,\n\tgetDefaultProps,\n\tgetDefaultSlices,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/slice-simulator-core\";\n\nconst coreManager = new CoreManager();\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"];\n};\n\nexport type SliceSimulatorProps = {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t *\n\t * ```tsx\n\t * import { SliceSimulator } from \"@slicemachine/adapter-next\";\n\t * import { SliceZone } from \"@prismicio/react\";\n\t *\n\t * import { components } from \"../slices\";\n\t * import state from \"../.slicemachine/libraries-state.json\";\n\t *\n\t * <SliceSimulator\n\t * \tsliceZone={({ slices }) => (\n\t * \t\t<SliceZone slices={slices} components={components} />\n\t * \t)}\n\t * \tstate={state}\n\t * />;\n\t * ```\n\t */\n\tsliceZone: (props: SliceSimulatorSliceZoneProps) => JSX.Element;\n\tclassName?: string;\n} & BaseSliceSimulatorProps;\n\nexport const SliceSimulator = ({\n\tsliceZone: SliceZoneComp,\n\tstate,\n\tbackground,\n\tzIndex,\n\tclassName,\n}: SliceSimulatorProps): JSX.Element => {\n\tconst defaultProps = getDefaultProps();\n\n\tconst [managedState, setManagedState] = React.useState(() =>\n\t\tgetDefaultManagedState(),\n\t);\n\tconst [slices, setSlices] = React.useState(() => getDefaultSlices());\n\tconst [message, setMessage] = React.useState(() => getDefaultMessage());\n\n\tReact.useEffect(() => {\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.ManagedState,\n\t\t\t(_managedState) => {\n\t\t\t\tsetManagedState(_managedState);\n\t\t\t},\n\t\t\t\"simulator-managed-state\",\n\t\t);\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message);\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tcoreManager.init(state);\n\n\t\treturn () => {\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.ManagedState,\n\t\t\t\t\"simulator-managed-state\",\n\t\t\t);\n\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.Slices,\n\t\t\t\t\"simulator-slices\",\n\t\t\t);\n\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.Message,\n\t\t\t\t\"simulator-message\",\n\t\t\t);\n\t\t};\n\t}, []);\n\n\t// Update state on HMR\n\tconst didMount = React.useRef(false);\n\tReact.useEffect(() => {\n\t\tif (didMount.current) {\n\t\t\tcoreManager.stateManager.reload(state);\n\t\t} else {\n\t\t\tdidMount.current = true;\n\t\t}\n\t}, [state]);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[simulatorClass, className].filter(Boolean).join(\" \")}\n\t\t\tstyle={{\n\t\t\t\tzIndex:\n\t\t\t\t\ttypeof zIndex === \"undefined\"\n\t\t\t\t\t\t? defaultProps.zIndex\n\t\t\t\t\t\t: zIndex ?? undefined,\n\t\t\t\tposition: \"fixed\",\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: \"100%\",\n\t\t\t\theight: \"100vh\",\n\t\t\t\toverflow: \"auto\",\n\t\t\t\tbackground:\n\t\t\t\t\ttypeof background === \"undefined\"\n\t\t\t\t\t\t? defaultProps.background\n\t\t\t\t\t\t: background ?? undefined,\n\t\t\t}}\n\t\t>\n\t\t\t{message ? (\n\t\t\t\t<article dangerouslySetInnerHTML={{ __html: message }} />\n\t\t\t) : slices.length ? (\n\t\t\t\t<div\n\t\t\t\t\tid=\"root\"\n\t\t\t\t\tclassName={simulatorRootClass}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tmanagedState.status !== StateManagerStatus.Loaded\n\t\t\t\t\t\t\t? { display: \"none\" }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tonClickCapture={onClickHandler as unknown as React.MouseEventHandler}\n\t\t\t\t\tonSubmitCapture={\n\t\t\t\t\t\tdisableEventHandler as unknown as React.FormEventHandler\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<SliceZoneComp slices={slices} />\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n};\n"],"names":["CoreManager","getDefaultProps","React","getDefaultManagedState","getDefaultSlices","getDefaultMessage","StateManagerEventType","_jsx","simulatorClass","simulatorRootClass","StateManagerStatus","onClickHandler","disableEventHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,cAAc,IAAIA,mBAAAA;AA+BX,MAAA,iBAAiB,CAAC,EAC9B,WAAW,eACX,OACA,YACA,QACA,gBACsC;AACtC,QAAM,eAAeC,mBAAAA;AAEf,QAAA,CAAC,cAAc,eAAe,IAAIC,iBAAM,SAAS,MACtDC,2CAAwB;AAEnB,QAAA,CAAC,QAAQ,SAAS,IAAID,iBAAM,SAAS,MAAME,qCAAkB;AAC7D,QAAA,CAAC,SAAS,UAAU,IAAIF,iBAAM,SAAS,MAAMG,sCAAmB;AAEtEH,mBAAM,UAAU,MAAK;AACpB,gBAAY,aAAa,GACxBI,mBAAsB,sBAAA,cACtB,CAAC,kBAAiB;AACjB,sBAAgB,aAAa;AAAA,OAE9B,yBAAyB;AAE1B,gBAAY,aAAa,GACxBA,mBAAsB,sBAAA,QACtB,CAAC,YAAW;AACX,gBAAU,OAAO;AAAA,OAElB,kBAAkB;AAEnB,gBAAY,aAAa,GACxBA,mBAAsB,sBAAA,SACtB,CAAC,aAAY;AACZ,iBAAW,QAAQ;AAAA,OAEpB,mBAAmB;AAGpB,gBAAY,KAAK,KAAK;AAEtB,WAAO,MAAK;AACX,kBAAY,aAAa,IACxBA,mBAAsB,sBAAA,cACtB,yBAAyB;AAG1B,kBAAY,aAAa,IACxBA,mBAAsB,sBAAA,QACtB,kBAAkB;AAGnB,kBAAY,aAAa,IACxBA,mBAAsB,sBAAA,SACtB,mBAAmB;AAAA,IAAA;AAAA,EAGtB,GAAG,CAAE,CAAA;AAGC,QAAA,WAAWJ,iBAAM,OAAO,KAAK;AACnCA,mBAAM,UAAU,MAAK;AACpB,QAAI,SAAS,SAAS;AACT,kBAAA,aAAa,OAAO,KAAK;AAAA,IAAA,OAC/B;AACN,eAAS,UAAU;AAAA,IACnB;AAAA,EAAA,GACC,CAAC,KAAK,CAAC;AAEV,SACCK,wBACC,WAAW,CAACC,mBAAAA,gBAAgB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAC/D,OAAO;AAAA,IACN,QACC,OAAO,WAAW,cACf,aAAa,SACb,UAAU;AAAA,IACd,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YACC,OAAO,eAAe,cACnB,aAAa,aACb,cAAc;AAAA,EAAA,GAClB,UAEA,UACAD,eAAA,WAAA,EAAS,yBAAyB,EAAE,QAAQ,UAAa,CAAA,IACtD,OAAO,SACVA,WAAA,IAAA,OAAA,EACC,IAAG,QACH,WAAWE,mBACX,oBAAA,OACC,aAAa,WAAWC,mBAAA,mBAAmB,SACxC,EAAE,SAAS,WACX,QAEJ,gBAAgBC,mCAChB,iBACCC,mBAAAA,qBAAwD,UAGzDL,WAAA,IAAC,iBAAc,OAAA,CAAc,EACxB,CAAA,IACH,KAAA,CACC;AAER;;"}
|
package/dist/SliceSimulator.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SliceSimulatorProps as BaseSliceSimulatorProps, SliceSimulatorState } from "@prismicio/slice-simulator-core";
|
|
2
|
-
export
|
|
2
|
+
export type SliceSimulatorSliceZoneProps = {
|
|
3
3
|
slices: SliceSimulatorState["slices"];
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type SliceSimulatorProps = {
|
|
6
6
|
/**
|
|
7
7
|
* React component to render simulated Slices.
|
|
8
8
|
*
|
package/dist/SliceSimulator.js
CHANGED
|
@@ -2,13 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { CoreManager, getDefaultProps, getDefaultManagedState, getDefaultSlices, getDefaultMessage, StateManagerEventType, simulatorClass, simulatorRootClass, StateManagerStatus, onClickHandler, disableEventHandler } from "@prismicio/slice-simulator-core";
|
|
4
4
|
const coreManager = new CoreManager();
|
|
5
|
-
const SliceSimulator = ({
|
|
6
|
-
sliceZone: SliceZoneComp,
|
|
7
|
-
state,
|
|
8
|
-
background,
|
|
9
|
-
zIndex,
|
|
10
|
-
className
|
|
11
|
-
}) => {
|
|
5
|
+
const SliceSimulator = ({ sliceZone: SliceZoneComp, state, background, zIndex, className }) => {
|
|
12
6
|
const defaultProps = getDefaultProps();
|
|
13
7
|
const [managedState, setManagedState] = React.useState(() => getDefaultManagedState());
|
|
14
8
|
const [slices, setSlices] = React.useState(() => getDefaultSlices());
|
|
@@ -38,35 +32,16 @@ const SliceSimulator = ({
|
|
|
38
32
|
didMount.current = true;
|
|
39
33
|
}
|
|
40
34
|
}, [state]);
|
|
41
|
-
return jsx("div", {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
background: typeof background === "undefined" ? defaultProps.background : background != null ? background : void 0
|
|
52
|
-
},
|
|
53
|
-
children: message ? jsx("article", {
|
|
54
|
-
dangerouslySetInnerHTML: {
|
|
55
|
-
__html: message
|
|
56
|
-
}
|
|
57
|
-
}) : slices.length ? jsx("div", {
|
|
58
|
-
id: "root",
|
|
59
|
-
className: simulatorRootClass,
|
|
60
|
-
style: managedState.status !== StateManagerStatus.Loaded ? {
|
|
61
|
-
display: "none"
|
|
62
|
-
} : void 0,
|
|
63
|
-
onClickCapture: onClickHandler,
|
|
64
|
-
onSubmitCapture: disableEventHandler,
|
|
65
|
-
children: jsx(SliceZoneComp, {
|
|
66
|
-
slices
|
|
67
|
-
})
|
|
68
|
-
}) : null
|
|
69
|
-
});
|
|
35
|
+
return jsx("div", { className: [simulatorClass, className].filter(Boolean).join(" "), style: {
|
|
36
|
+
zIndex: typeof zIndex === "undefined" ? defaultProps.zIndex : zIndex ?? void 0,
|
|
37
|
+
position: "fixed",
|
|
38
|
+
top: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
width: "100%",
|
|
41
|
+
height: "100vh",
|
|
42
|
+
overflow: "auto",
|
|
43
|
+
background: typeof background === "undefined" ? defaultProps.background : background ?? void 0
|
|
44
|
+
}, children: message ? jsx("article", { dangerouslySetInnerHTML: { __html: message } }) : slices.length ? jsx("div", { id: "root", className: simulatorRootClass, style: managedState.status !== StateManagerStatus.Loaded ? { display: "none" } : void 0, onClickCapture: onClickHandler, onSubmitCapture: disableEventHandler, children: jsx(SliceZoneComp, { slices }) }) : null });
|
|
70
45
|
};
|
|
71
46
|
export {
|
|
72
47
|
SliceSimulator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulator.js","sources":["
|
|
1
|
+
{"version":3,"file":"SliceSimulator.js","sources":["../../src/SliceSimulator.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n\tCoreManager,\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n\tStateManagerEventType,\n\tStateManagerStatus,\n\tdisableEventHandler,\n\tgetDefaultManagedState,\n\tgetDefaultMessage,\n\tgetDefaultProps,\n\tgetDefaultSlices,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/slice-simulator-core\";\n\nconst coreManager = new CoreManager();\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"];\n};\n\nexport type SliceSimulatorProps = {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t *\n\t * ```tsx\n\t * import { SliceSimulator } from \"@slicemachine/adapter-next\";\n\t * import { SliceZone } from \"@prismicio/react\";\n\t *\n\t * import { components } from \"../slices\";\n\t * import state from \"../.slicemachine/libraries-state.json\";\n\t *\n\t * <SliceSimulator\n\t * \tsliceZone={({ slices }) => (\n\t * \t\t<SliceZone slices={slices} components={components} />\n\t * \t)}\n\t * \tstate={state}\n\t * />;\n\t * ```\n\t */\n\tsliceZone: (props: SliceSimulatorSliceZoneProps) => JSX.Element;\n\tclassName?: string;\n} & BaseSliceSimulatorProps;\n\nexport const SliceSimulator = ({\n\tsliceZone: SliceZoneComp,\n\tstate,\n\tbackground,\n\tzIndex,\n\tclassName,\n}: SliceSimulatorProps): JSX.Element => {\n\tconst defaultProps = getDefaultProps();\n\n\tconst [managedState, setManagedState] = React.useState(() =>\n\t\tgetDefaultManagedState(),\n\t);\n\tconst [slices, setSlices] = React.useState(() => getDefaultSlices());\n\tconst [message, setMessage] = React.useState(() => getDefaultMessage());\n\n\tReact.useEffect(() => {\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.ManagedState,\n\t\t\t(_managedState) => {\n\t\t\t\tsetManagedState(_managedState);\n\t\t\t},\n\t\t\t\"simulator-managed-state\",\n\t\t);\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tcoreManager.stateManager.on(\n\t\t\tStateManagerEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message);\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tcoreManager.init(state);\n\n\t\treturn () => {\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.ManagedState,\n\t\t\t\t\"simulator-managed-state\",\n\t\t\t);\n\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.Slices,\n\t\t\t\t\"simulator-slices\",\n\t\t\t);\n\n\t\t\tcoreManager.stateManager.off(\n\t\t\t\tStateManagerEventType.Message,\n\t\t\t\t\"simulator-message\",\n\t\t\t);\n\t\t};\n\t}, []);\n\n\t// Update state on HMR\n\tconst didMount = React.useRef(false);\n\tReact.useEffect(() => {\n\t\tif (didMount.current) {\n\t\t\tcoreManager.stateManager.reload(state);\n\t\t} else {\n\t\t\tdidMount.current = true;\n\t\t}\n\t}, [state]);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[simulatorClass, className].filter(Boolean).join(\" \")}\n\t\t\tstyle={{\n\t\t\t\tzIndex:\n\t\t\t\t\ttypeof zIndex === \"undefined\"\n\t\t\t\t\t\t? defaultProps.zIndex\n\t\t\t\t\t\t: zIndex ?? undefined,\n\t\t\t\tposition: \"fixed\",\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: \"100%\",\n\t\t\t\theight: \"100vh\",\n\t\t\t\toverflow: \"auto\",\n\t\t\t\tbackground:\n\t\t\t\t\ttypeof background === \"undefined\"\n\t\t\t\t\t\t? defaultProps.background\n\t\t\t\t\t\t: background ?? undefined,\n\t\t\t}}\n\t\t>\n\t\t\t{message ? (\n\t\t\t\t<article dangerouslySetInnerHTML={{ __html: message }} />\n\t\t\t) : slices.length ? (\n\t\t\t\t<div\n\t\t\t\t\tid=\"root\"\n\t\t\t\t\tclassName={simulatorRootClass}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tmanagedState.status !== StateManagerStatus.Loaded\n\t\t\t\t\t\t\t? { display: \"none\" }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tonClickCapture={onClickHandler as unknown as React.MouseEventHandler}\n\t\t\t\t\tonSubmitCapture={\n\t\t\t\t\t\tdisableEventHandler as unknown as React.FormEventHandler\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<SliceZoneComp slices={slices} />\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n};\n"],"names":["_jsx"],"mappings":";;;AAiBA,MAAM,cAAc,IAAI;AA+BX,MAAA,iBAAiB,CAAC,EAC9B,WAAW,eACX,OACA,YACA,QACA,gBACsC;AACtC,QAAM,eAAe;AAEf,QAAA,CAAC,cAAc,eAAe,IAAI,MAAM,SAAS,MACtD,wBAAwB;AAEnB,QAAA,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAS,MAAM,kBAAkB;AAC7D,QAAA,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,MAAM,mBAAmB;AAEtE,QAAM,UAAU,MAAK;AACpB,gBAAY,aAAa,GACxB,sBAAsB,cACtB,CAAC,kBAAiB;AACjB,sBAAgB,aAAa;AAAA,OAE9B,yBAAyB;AAE1B,gBAAY,aAAa,GACxB,sBAAsB,QACtB,CAAC,YAAW;AACX,gBAAU,OAAO;AAAA,OAElB,kBAAkB;AAEnB,gBAAY,aAAa,GACxB,sBAAsB,SACtB,CAAC,aAAY;AACZ,iBAAW,QAAQ;AAAA,OAEpB,mBAAmB;AAGpB,gBAAY,KAAK,KAAK;AAEtB,WAAO,MAAK;AACX,kBAAY,aAAa,IACxB,sBAAsB,cACtB,yBAAyB;AAG1B,kBAAY,aAAa,IACxB,sBAAsB,QACtB,kBAAkB;AAGnB,kBAAY,aAAa,IACxB,sBAAsB,SACtB,mBAAmB;AAAA,IAAA;AAAA,EAGtB,GAAG,CAAE,CAAA;AAGC,QAAA,WAAW,MAAM,OAAO,KAAK;AACnC,QAAM,UAAU,MAAK;AACpB,QAAI,SAAS,SAAS;AACT,kBAAA,aAAa,OAAO,KAAK;AAAA,IAAA,OAC/B;AACN,eAAS,UAAU;AAAA,IACnB;AAAA,EAAA,GACC,CAAC,KAAK,CAAC;AAEV,SACCA,aACC,WAAW,CAAC,gBAAgB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAC/D,OAAO;AAAA,IACN,QACC,OAAO,WAAW,cACf,aAAa,SACb,UAAU;AAAA,IACd,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YACC,OAAO,eAAe,cACnB,aAAa,aACb,cAAc;AAAA,EAAA,GAClB,UAEA,UACAA,IAAA,WAAA,EAAS,yBAAyB,EAAE,QAAQ,UAAa,CAAA,IACtD,OAAO,SACVA,IAAA,OAAA,EACC,IAAG,QACH,WAAW,oBACX,OACC,aAAa,WAAW,mBAAmB,SACxC,EAAE,SAAS,WACX,QAEJ,gBAAgB,gBAChB,iBACC,qBAAwD,UAGzDA,IAAC,iBAAc,OAAA,CAAc,EACxB,CAAA,IACH,KAAA,CACC;AAER;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
4
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
5
|
+
//# sourceMappingURL=_commonjsHelpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2
|
+
export {
|
|
3
|
+
commonjsGlobal
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=_commonjsHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ponyfill.es2018.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ponyfill.es2018.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const NON_EDITABLE_FILE_BANNER = "// Code generated by Slice Machine. DO NOT EDIT.";
|
|
4
|
+
exports.NON_EDITABLE_FILE_BANNER = NON_EDITABLE_FILE_BANNER;
|
|
5
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../src/constants.ts"],"sourcesContent":["/**\n * Banner text added to files that should not be edited by users.\n */\nexport const NON_EDITABLE_FILE_BANNER =\n\t\"// Code generated by Slice Machine. DO NOT EDIT.\";\n"],"names":[],"mappings":";;AAGO,MAAM,2BACZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["/**\n * Banner text added to files that should not be edited by users.\n */\nexport const NON_EDITABLE_FILE_BANNER =\n\t\"// Code generated by Slice Machine. DO NOT EDIT.\";\n"],"names":[],"mappings":"AAGO,MAAM,2BACZ;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
-
function
|
|
5
|
-
if (e && e.__esModule)
|
|
6
|
-
return e;
|
|
4
|
+
function _interopNamespaceDefault(e) {
|
|
7
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
6
|
if (e) {
|
|
9
7
|
for (const k in e) {
|
|
@@ -19,7 +17,7 @@ function _interopNamespace(e) {
|
|
|
19
17
|
n.default = e;
|
|
20
18
|
return Object.freeze(n);
|
|
21
19
|
}
|
|
22
|
-
const fs__namespace = /* @__PURE__ */
|
|
20
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
23
21
|
const customTypeAssetDelete = async (data, context) => {
|
|
24
22
|
const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.assetID);
|
|
25
23
|
await fs__namespace.rm(filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-delete.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"customType-asset-delete.cjs","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tawait fs.rm(filePath);\n};\n"],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGP,QAAAA,cAAG,GAAG,QAAQ;AACrB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-delete.js","sources":["
|
|
1
|
+
{"version":3,"file":"customType-asset-delete.js","sources":["../../../src/hooks/customType-asset-delete.ts"],"sourcesContent":["import type { CustomTypeAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetDelete: CustomTypeAssetDeleteHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tawait fs.rm(filePath);\n};\n"],"names":[],"mappings":";AAKa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGP,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
|
-
function
|
|
5
|
-
if (e && e.__esModule)
|
|
6
|
-
return e;
|
|
4
|
+
function _interopNamespaceDefault(e) {
|
|
7
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
6
|
if (e) {
|
|
9
7
|
for (const k in e) {
|
|
@@ -19,7 +17,7 @@ function _interopNamespace(e) {
|
|
|
19
17
|
n.default = e;
|
|
20
18
|
return Object.freeze(n);
|
|
21
19
|
}
|
|
22
|
-
const fs__namespace = /* @__PURE__ */
|
|
20
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
23
21
|
const customTypeAssetRead = async (data, context) => {
|
|
24
22
|
const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.assetID);
|
|
25
23
|
const assetData = await fs__namespace.readFile(filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-read.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"customType-asset-read.cjs","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":["fs"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKa,MAAA,sBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGb,QAAM,YAAY,MAAMA,cAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-read.js","sources":["
|
|
1
|
+
{"version":3,"file":"customType-asset-read.js","sources":["../../../src/hooks/customType-asset-read.ts"],"sourcesContent":["import type { CustomTypeAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetRead: CustomTypeAssetReadHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.assetID,\n\t);\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":[],"mappings":";AAKa,MAAA,sBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,OAAO;AAGb,QAAM,YAAY,MAAM,GAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
4
|
const path = require("node:path");
|
|
5
|
-
function
|
|
6
|
-
if (e && e.__esModule)
|
|
7
|
-
return e;
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
8
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
7
|
if (e) {
|
|
10
8
|
for (const k in e) {
|
|
@@ -20,8 +18,8 @@ function _interopNamespace(e) {
|
|
|
20
18
|
n.default = e;
|
|
21
19
|
return Object.freeze(n);
|
|
22
20
|
}
|
|
23
|
-
const fs__namespace = /* @__PURE__ */
|
|
24
|
-
const path__namespace = /* @__PURE__ */
|
|
21
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
22
|
+
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
25
23
|
const customTypeAssetUpdate = async (data, context) => {
|
|
26
24
|
const filePath = context.helpers.joinPathFromRoot("customtypes", data.customTypeID, data.asset.id);
|
|
27
25
|
await fs__namespace.mkdir(path__namespace.dirname(filePath), { recursive: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-update.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"customType-asset-update.cjs","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.asset.id,\n\t);\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":["fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,MAAM,EAAE;AAGR,QAAAA,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAMD,cAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-asset-update.js","sources":["
|
|
1
|
+
{"version":3,"file":"customType-asset-update.js","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = context.helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.customTypeID,\n\t\tdata.asset.id,\n\t);\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":[],"mappings":";;AAMa,MAAA,wBAET,OAAO,MAAM,YAAW;AACrB,QAAA,WAAW,QAAQ,QAAQ,iBAChC,eACA,KAAK,cACL,KAAK,MAAM,EAAE;AAGR,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
4
|
const path = require("node:path");
|
|
5
5
|
const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
|
|
6
|
-
function
|
|
7
|
-
if (e && e.__esModule)
|
|
8
|
-
return e;
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
9
7
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
10
8
|
if (e) {
|
|
11
9
|
for (const k in e) {
|
|
@@ -21,8 +19,8 @@ function _interopNamespace(e) {
|
|
|
21
19
|
n.default = e;
|
|
22
20
|
return Object.freeze(n);
|
|
23
21
|
}
|
|
24
|
-
const fs__namespace = /* @__PURE__ */
|
|
25
|
-
const path__namespace = /* @__PURE__ */
|
|
22
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
23
|
+
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
26
24
|
const createModelFile = async ({ dir, data, helpers, options }) => {
|
|
27
25
|
const filePath = path__namespace.join(dir, "index.json");
|
|
28
26
|
let contents = JSON.stringify(data.model);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-create.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"customType-create.cjs","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["path","fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAWA,gBAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAMA,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-create.js","sources":["
|
|
1
|
+
{"version":3,"file":"customType-create.js","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;AAiBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAW,KAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAM,yBAAyB,OAAO;AACvC;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const fs = require("node:fs/promises");
|
|
4
4
|
const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
|
|
5
|
-
function
|
|
6
|
-
if (e && e.__esModule)
|
|
7
|
-
return e;
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
8
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
7
|
if (e) {
|
|
10
8
|
for (const k in e) {
|
|
@@ -20,7 +18,7 @@ function _interopNamespace(e) {
|
|
|
20
18
|
n.default = e;
|
|
21
19
|
return Object.freeze(n);
|
|
22
20
|
}
|
|
23
|
-
const fs__namespace = /* @__PURE__ */
|
|
21
|
+
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
24
22
|
const customTypeDelete = async (data, context) => {
|
|
25
23
|
const dir = context.helpers.joinPathFromRoot("customtypes", data.model.id);
|
|
26
24
|
await fs__namespace.rm(dir, { recursive: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-delete.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"customType-delete.cjs","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAMA,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-delete.js","sources":["
|
|
1
|
+
{"version":3,"file":"customType-delete.js","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = context.helpers.joinPathFromRoot(\"customtypes\", data.model.id);\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,QAAQ,QAAQ,iBAAiB,eAAe,KAAK,MAAM,EAAE;AAEzE,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAM,yBAAyB,OAAO;AACvC;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const readJSONFile = require("../lib/readJSONFile.cjs");
|
|
4
4
|
const customTypeRead = async (data, { helpers }) => {
|
|
5
5
|
const filePath = helpers.joinPathFromRoot("customtypes", data.id, "index.json");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-read.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"customType-read.cjs","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.id,\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":["readJSONFile"],"mappings":";;;AAOO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACH,QAAM,WAAW,QAAQ,iBACxB,eACA,KAAK,IACL,YAAY;AAGP,QAAA,QAAQ,MAAMA,0BAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-read.js","sources":["
|
|
1
|
+
{"version":3,"file":"customType-read.js","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = helpers.joinPathFromRoot(\n\t\t\"customtypes\",\n\t\tdata.id,\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<prismicT.CustomTypeModel>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":[],"mappings":";AAOO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACH,QAAM,WAAW,QAAQ,iBACxB,eACA,KAAK,IACL,YAAY;AAGP,QAAA,QAAQ,MAAM,aAAuC,QAAQ;AAE5D,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const customTypeCreate = require("./customType-create.cjs");
|
|
4
|
+
const customTypeRename = customTypeCreate.customTypeCreate;
|
|
5
|
+
exports.customTypeRename = customTypeRename;
|
|
6
|
+
//# sourceMappingURL=customType-rename.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-rename.cjs","sources":["../../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const customTypeRename: import("@slicemachine/plugin-kit").CustomTypeCreateHook<import("..").PluginOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType-rename.js","sources":["../../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const customTypeCreate = require("./customType-create.cjs");
|
|
4
4
|
const customTypeUpdate = customTypeCreate.customTypeCreate;
|
|
5
5
|
exports.customTypeUpdate = customTypeUpdate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-update.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"customType-update.cjs","sources":["../../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType-update.js","sources":["
|
|
1
|
+
{"version":3,"file":"customType-update.js","sources":["../../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
|