@slicemachine/adapter-next 0.0.3 → 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.
Files changed (210) hide show
  1. package/dist/SliceSimulator.cjs +14 -41
  2. package/dist/SliceSimulator.cjs.map +1 -1
  3. package/dist/SliceSimulator.js +11 -36
  4. package/dist/SliceSimulator.js.map +1 -1
  5. package/dist/_virtual/_commonjsHelpers.cjs +5 -0
  6. package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
  7. package/dist/_virtual/_commonjsHelpers.js +5 -0
  8. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  9. package/dist/_virtual/ponyfill.es2018.cjs +5 -0
  10. package/dist/_virtual/ponyfill.es2018.cjs.map +1 -0
  11. package/dist/_virtual/ponyfill.es2018.js +5 -0
  12. package/dist/_virtual/ponyfill.es2018.js.map +1 -0
  13. package/dist/constants.cjs +5 -0
  14. package/dist/constants.cjs.map +1 -0
  15. package/dist/constants.d.ts +4 -0
  16. package/dist/constants.js +5 -0
  17. package/dist/constants.js.map +1 -0
  18. package/dist/hooks/customType-asset-delete.cjs +3 -5
  19. package/dist/hooks/customType-asset-delete.cjs.map +1 -1
  20. package/dist/hooks/customType-asset-delete.js.map +1 -1
  21. package/dist/hooks/customType-asset-read.cjs +3 -5
  22. package/dist/hooks/customType-asset-read.cjs.map +1 -1
  23. package/dist/hooks/customType-asset-read.js.map +1 -1
  24. package/dist/hooks/customType-asset-update.cjs +4 -6
  25. package/dist/hooks/customType-asset-update.cjs.map +1 -1
  26. package/dist/hooks/customType-asset-update.js.map +1 -1
  27. package/dist/hooks/customType-create.cjs +4 -6
  28. package/dist/hooks/customType-create.cjs.map +1 -1
  29. package/dist/hooks/customType-create.js.map +1 -1
  30. package/dist/hooks/customType-delete.cjs +3 -5
  31. package/dist/hooks/customType-delete.cjs.map +1 -1
  32. package/dist/hooks/customType-delete.js.map +1 -1
  33. package/dist/hooks/customType-read.cjs +1 -1
  34. package/dist/hooks/customType-read.cjs.map +1 -1
  35. package/dist/hooks/customType-read.js.map +1 -1
  36. package/dist/hooks/customType-rename.cjs +1 -1
  37. package/dist/hooks/customType-rename.cjs.map +1 -1
  38. package/dist/hooks/customType-rename.js.map +1 -1
  39. package/dist/hooks/customType-update.cjs +1 -1
  40. package/dist/hooks/customType-update.cjs.map +1 -1
  41. package/dist/hooks/customType-update.js.map +1 -1
  42. package/dist/hooks/customTypeLibrary-read.cjs +4 -6
  43. package/dist/hooks/customTypeLibrary-read.cjs.map +1 -1
  44. package/dist/hooks/customTypeLibrary-read.js.map +1 -1
  45. package/dist/hooks/slice-asset-delete.cjs +3 -5
  46. package/dist/hooks/slice-asset-delete.cjs.map +1 -1
  47. package/dist/hooks/slice-asset-delete.js.map +1 -1
  48. package/dist/hooks/slice-asset-read.cjs +3 -5
  49. package/dist/hooks/slice-asset-read.cjs.map +1 -1
  50. package/dist/hooks/slice-asset-read.js.map +1 -1
  51. package/dist/hooks/slice-asset-update.cjs +4 -6
  52. package/dist/hooks/slice-asset-update.cjs.map +1 -1
  53. package/dist/hooks/slice-asset-update.js.map +1 -1
  54. package/dist/hooks/slice-create.cjs +7 -9
  55. package/dist/hooks/slice-create.cjs.map +1 -1
  56. package/dist/hooks/slice-create.js +3 -3
  57. package/dist/hooks/slice-create.js.map +1 -1
  58. package/dist/hooks/slice-delete.cjs +3 -5
  59. package/dist/hooks/slice-delete.cjs.map +1 -1
  60. package/dist/hooks/slice-delete.js.map +1 -1
  61. package/dist/hooks/slice-read.cjs +4 -6
  62. package/dist/hooks/slice-read.cjs.map +1 -1
  63. package/dist/hooks/slice-read.js.map +1 -1
  64. package/dist/hooks/slice-rename.cjs +3 -5
  65. package/dist/hooks/slice-rename.cjs.map +1 -1
  66. package/dist/hooks/slice-rename.js.map +1 -1
  67. package/dist/hooks/slice-update.cjs +1 -1
  68. package/dist/hooks/slice-update.cjs.map +1 -1
  69. package/dist/hooks/slice-update.js.map +1 -1
  70. package/dist/hooks/sliceLibrary-read.cjs +4 -6
  71. package/dist/hooks/sliceLibrary-read.cjs.map +1 -1
  72. package/dist/hooks/sliceLibrary-read.js.map +1 -1
  73. package/dist/hooks/sliceSimulator-setup-read.cjs +31 -94
  74. package/dist/hooks/sliceSimulator-setup-read.cjs.map +1 -1
  75. package/dist/hooks/sliceSimulator-setup-read.js +31 -75
  76. package/dist/hooks/sliceSimulator-setup-read.js.map +1 -1
  77. package/dist/hooks/snippet-read.cjs +33 -18
  78. package/dist/hooks/snippet-read.cjs.map +1 -1
  79. package/dist/hooks/snippet-read.js +30 -13
  80. package/dist/hooks/snippet-read.js.map +1 -1
  81. package/dist/index.cjs +0 -2
  82. package/dist/index.cjs.map +1 -1
  83. package/dist/index.d.ts +0 -2
  84. package/dist/index.js +0 -2
  85. package/dist/index.js.map +1 -1
  86. package/dist/lib/getJSOrTSXFileExtension.cjs +1 -1
  87. package/dist/lib/getJSOrTSXFileExtension.cjs.map +1 -1
  88. package/dist/lib/getJSOrTSXFileExtension.js.map +1 -1
  89. package/dist/lib/isSharedSliceModel.cjs +3 -5
  90. package/dist/lib/isSharedSliceModel.cjs.map +1 -1
  91. package/dist/lib/isSharedSliceModel.js.map +1 -1
  92. package/dist/lib/pascalCase.cjs +1 -1
  93. package/dist/lib/pascalCase.cjs.map +1 -1
  94. package/dist/lib/pascalCase.js.map +1 -1
  95. package/dist/lib/readJSONFile.cjs +3 -5
  96. package/dist/lib/readJSONFile.cjs.map +1 -1
  97. package/dist/lib/readJSONFile.js.map +1 -1
  98. package/dist/lib/rejectIfNecessary.cjs +1 -1
  99. package/dist/lib/rejectIfNecessary.cjs.map +1 -1
  100. package/dist/lib/rejectIfNecessary.js.map +1 -1
  101. package/dist/lib/updateSliceModelFile.cjs +3 -5
  102. package/dist/lib/updateSliceModelFile.cjs.map +1 -1
  103. package/dist/lib/updateSliceModelFile.js.map +1 -1
  104. package/dist/lib/upsertGlobalContentTypes.cjs +8 -6
  105. package/dist/lib/upsertGlobalContentTypes.cjs.map +1 -1
  106. package/dist/lib/upsertGlobalContentTypes.js +4 -0
  107. package/dist/lib/upsertGlobalContentTypes.js.map +1 -1
  108. package/dist/lib/upsertSliceLibraryIndexFile.cjs +9 -8
  109. package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
  110. package/dist/lib/upsertSliceLibraryIndexFile.js +6 -3
  111. package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
  112. package/dist/node_modules/data-uri-to-buffer/dist/index.cjs +41 -0
  113. package/dist/node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -0
  114. package/dist/node_modules/data-uri-to-buffer/dist/index.js +41 -0
  115. package/dist/node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
  116. package/dist/node_modules/fetch-blob/file.cjs +55 -0
  117. package/dist/node_modules/fetch-blob/file.cjs.map +1 -0
  118. package/dist/node_modules/fetch-blob/file.js +55 -0
  119. package/dist/node_modules/fetch-blob/file.js.map +1 -0
  120. package/dist/node_modules/fetch-blob/index.cjs +176 -0
  121. package/dist/node_modules/fetch-blob/index.cjs.map +1 -0
  122. package/dist/node_modules/fetch-blob/index.js +176 -0
  123. package/dist/node_modules/fetch-blob/index.js.map +1 -0
  124. package/dist/node_modules/fetch-blob/streams.cjs +43 -0
  125. package/dist/node_modules/fetch-blob/streams.cjs.map +1 -0
  126. package/dist/node_modules/fetch-blob/streams.js +42 -0
  127. package/dist/node_modules/fetch-blob/streams.js.map +1 -0
  128. package/dist/node_modules/formdata-polyfill/esm.min.cjs +115 -0
  129. package/dist/node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
  130. package/dist/node_modules/formdata-polyfill/esm.min.js +115 -0
  131. package/dist/node_modules/formdata-polyfill/esm.min.js.map +1 -0
  132. package/dist/node_modules/node-domexception/index.cjs +10 -0
  133. package/dist/node_modules/node-domexception/index.cjs.map +1 -0
  134. package/dist/node_modules/node-domexception/index.js +9 -0
  135. package/dist/node_modules/node-domexception/index.js.map +1 -0
  136. package/dist/node_modules/node-fetch/src/body.cjs +237 -0
  137. package/dist/node_modules/node-fetch/src/body.cjs.map +1 -0
  138. package/dist/node_modules/node-fetch/src/body.js +237 -0
  139. package/dist/node_modules/node-fetch/src/body.js.map +1 -0
  140. package/dist/node_modules/node-fetch/src/errors/abort-error.cjs +10 -0
  141. package/dist/node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -0
  142. package/dist/node_modules/node-fetch/src/errors/abort-error.js +10 -0
  143. package/dist/node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
  144. package/dist/node_modules/node-fetch/src/errors/base.cjs +17 -0
  145. package/dist/node_modules/node-fetch/src/errors/base.cjs.map +1 -0
  146. package/dist/node_modules/node-fetch/src/errors/base.js +17 -0
  147. package/dist/node_modules/node-fetch/src/errors/base.js.map +1 -0
  148. package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs +14 -0
  149. package/dist/node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -0
  150. package/dist/node_modules/node-fetch/src/errors/fetch-error.js +14 -0
  151. package/dist/node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
  152. package/dist/node_modules/node-fetch/src/headers.cjs +173 -0
  153. package/dist/node_modules/node-fetch/src/headers.cjs.map +1 -0
  154. package/dist/node_modules/node-fetch/src/headers.js +173 -0
  155. package/dist/node_modules/node-fetch/src/headers.js.map +1 -0
  156. package/dist/node_modules/node-fetch/src/index.cjs +292 -0
  157. package/dist/node_modules/node-fetch/src/index.cjs.map +1 -0
  158. package/dist/node_modules/node-fetch/src/index.js +298 -0
  159. package/dist/node_modules/node-fetch/src/index.js.map +1 -0
  160. package/dist/node_modules/node-fetch/src/request.cjs +193 -0
  161. package/dist/node_modules/node-fetch/src/request.cjs.map +1 -0
  162. package/dist/node_modules/node-fetch/src/request.js +193 -0
  163. package/dist/node_modules/node-fetch/src/request.js.map +1 -0
  164. package/dist/node_modules/node-fetch/src/response.cjs +110 -0
  165. package/dist/node_modules/node-fetch/src/response.cjs.map +1 -0
  166. package/dist/node_modules/node-fetch/src/response.js +110 -0
  167. package/dist/node_modules/node-fetch/src/response.js.map +1 -0
  168. package/dist/node_modules/node-fetch/src/utils/get-search.cjs +12 -0
  169. package/dist/node_modules/node-fetch/src/utils/get-search.cjs.map +1 -0
  170. package/dist/node_modules/node-fetch/src/utils/get-search.js +12 -0
  171. package/dist/node_modules/node-fetch/src/utils/get-search.js.map +1 -0
  172. package/dist/node_modules/node-fetch/src/utils/is-redirect.cjs +8 -0
  173. package/dist/node_modules/node-fetch/src/utils/is-redirect.cjs.map +1 -0
  174. package/dist/node_modules/node-fetch/src/utils/is-redirect.js +8 -0
  175. package/dist/node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
  176. package/dist/node_modules/node-fetch/src/utils/is.cjs +28 -0
  177. package/dist/node_modules/node-fetch/src/utils/is.cjs.map +1 -0
  178. package/dist/node_modules/node-fetch/src/utils/is.js +28 -0
  179. package/dist/node_modules/node-fetch/src/utils/is.js.map +1 -0
  180. package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs +350 -0
  181. package/dist/node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -0
  182. package/dist/node_modules/node-fetch/src/utils/multipart-parser.js +350 -0
  183. package/dist/node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
  184. package/dist/node_modules/node-fetch/src/utils/referrer.cjs +149 -0
  185. package/dist/node_modules/node-fetch/src/utils/referrer.cjs.map +1 -0
  186. package/dist/node_modules/node-fetch/src/utils/referrer.js +149 -0
  187. package/dist/node_modules/node-fetch/src/utils/referrer.js.map +1 -0
  188. package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +3599 -0
  189. package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
  190. package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +3599 -0
  191. package/dist/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
  192. package/dist/package.json.cjs +5 -0
  193. package/dist/package.json.cjs.map +1 -0
  194. package/dist/{package.js → package.json.js} +1 -1
  195. package/dist/package.json.js.map +1 -0
  196. package/dist/plugin.cjs +2 -2
  197. package/dist/plugin.cjs.map +1 -1
  198. package/dist/plugin.js +1 -1
  199. package/dist/plugin.js.map +1 -1
  200. package/package.json +28 -13
  201. package/src/constants.ts +5 -0
  202. package/src/hooks/slice-create.ts +3 -3
  203. package/src/hooks/sliceSimulator-setup-read.ts +37 -76
  204. package/src/hooks/snippet-read.ts +42 -22
  205. package/src/index.ts +0 -6
  206. package/src/lib/upsertGlobalContentTypes.ts +3 -0
  207. package/src/lib/upsertSliceLibraryIndexFile.ts +11 -6
  208. package/dist/package.cjs +0 -5
  209. package/dist/package.cjs.map +0 -1
  210. package/dist/package.js.map +0 -1
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
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 _interopNamespace(e) {
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__ */ _interopNamespace(React);
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
- className: [sliceSimulatorCore.simulatorClass, className].filter(Boolean).join(" "),
64
- style: {
65
- zIndex: typeof zIndex === "undefined" ? defaultProps.zIndex : zIndex != null ? zIndex : void 0,
66
- position: "fixed",
67
- top: 0,
68
- left: 0,
69
- width: "100%",
70
- height: "100vh",
71
- overflow: "auto",
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":["../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","CoreManager","SliceSimulator","sliceZone","SliceZoneComp","state","background","zIndex","className","defaultProps","getDefaultProps","managedState","setManagedState","React","useState","getDefaultManagedState","slices","setSlices","getDefaultSlices","message","setMessage","getDefaultMessage","useEffect","stateManager","on","StateManagerEventType","ManagedState","_managedState","Slices","_slices","Message","_message","init","off","didMount","useRef","current","reload","_jsx","simulatorClass","filter","Boolean","join","style","undefined","position","top","left","width","height","overflow","children","dangerouslySetInnerHTML","__html","length","id","simulatorRootClass","status","StateManagerStatus","Loaded","display","onClickCapture","onClickHandler","onSubmitCapture","disableEventHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAMA,cAAc,IAAIC,mBAAAA;AA+BjB,MAAMC,iBAAiB,CAAC;AAAA,EAC9BC,WAAWC;AAAAA,EACXC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAS,MAC6B;AACtC,QAAMC,eAAeC,mBAAAA;AAEf,QAAA,CAACC,cAAcC,eAAe,IAAIC,iBAAMC,SAAS,MACtDC,2CAAwB;AAEnB,QAAA,CAACC,QAAQC,SAAS,IAAIJ,iBAAMC,SAAS,MAAMI,qCAAkB;AAC7D,QAAA,CAACC,SAASC,UAAU,IAAIP,iBAAMC,SAAS,MAAMO,sCAAmB;AAEtER,mBAAMS,UAAU,MAAK;AACpBtB,gBAAYuB,aAAaC,GACxBC,mBAAsBC,sBAAAA,cACrBC,CAAiB,kBAAA;AACjBf,sBAAgBe,aAAa;AAAA,OAE9B,yBAAyB;AAE1B3B,gBAAYuB,aAAaC,GACxBC,mBAAsBG,sBAAAA,QACrBC,CAAW,YAAA;AACXZ,gBAAUY,OAAO;AAAA,OAElB,kBAAkB;AAEnB7B,gBAAYuB,aAAaC,GACxBC,mBAAsBK,sBAAAA,SACrBC,CAAY,aAAA;AACZX,iBAAWW,QAAQ;AAAA,OAEpB,mBAAmB;AAGpB/B,gBAAYgC,KAAK3B,KAAK;AAEtB,WAAO,MAAK;AACXL,kBAAYuB,aAAaU,IACxBR,mBAAsBC,sBAAAA,cACtB,yBAAyB;AAG1B1B,kBAAYuB,aAAaU,IACxBR,mBAAsBG,sBAAAA,QACtB,kBAAkB;AAGnB5B,kBAAYuB,aAAaU,IACxBR,mBAAsBK,sBAAAA,SACtB,mBAAmB;AAAA,IAAA;AAAA,EAGtB,GAAG,CAAE,CAAA;AAGCI,QAAAA,WAAWrB,iBAAMsB,OAAO,KAAK;AACnCtB,mBAAMS,UAAU,MAAK;AACpB,QAAIY,SAASE,SAAS;AACTb,kBAAAA,aAAac,OAAOhC,KAAK;AAAA,IAAA,OAC/B;AACN6B,eAASE,UAAU;AAAA,IACnB;AAAA,EAAA,GACC,CAAC/B,KAAK,CAAC;AAEV,SACCiC,WAAAA;IACC9B,WAAW,CAAC+B,mBAAgB/B,gBAAAA,SAAS,EAAEgC,OAAOC,OAAO,EAAEC,KAAK,GAAG;AAAA,IAC/DC,OAAO;AAAA,MACNpC,QACC,OAAOA,WAAW,cACfE,aAAaF,SACbA,0BAAUqC;AAAAA,MACdC,UAAU;AAAA,MACVC,KAAK;AAAA,MACLC,MAAM;AAAA,MACNC,OAAO;AAAA,MACPC,QAAQ;AAAA,MACRC,UAAU;AAAA,MACV5C,YACC,OAAOA,eAAe,cACnBG,aAAaH,aACbA,kCAAcsC;AAAAA,IAClB;AAAA,IAAAO,UAEAhC,UACAmB,WAAAA,IAAA,WAAA;AAAA,MAASc,yBAAyB;AAAA,QAAEC,QAAQlC;AAAAA;IAAa,CAAA,IACtDH,OAAOsC,SACVhB,WAAAA,IAAA,OAAA;AAAA,MACCiB,IAAG;AAAA,MACH/C,WAAWgD,mBAAAA;AAAAA,MACXb,OACChC,aAAa8C,WAAWC,mBAAAA,mBAAmBC,SACxC;AAAA,QAAEC,SAAS;AAAA,MACXhB,IAAAA;AAAAA,MAEJiB,gBAAgBC,mBAAAA;AAAAA,MAChBC,iBACCC,mBAAAA;AAAAA,MAAwDb,UAGzDb,eAAClC;QAAcY;AAAAA,MAAAA,CAAc;AAAA,IACxB,CAAA,IACH;AAAA,EAAA,CACC;AAER;;"}
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;;"}
@@ -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
- className: [simulatorClass, className].filter(Boolean).join(" "),
43
- style: {
44
- zIndex: typeof zIndex === "undefined" ? defaultProps.zIndex : zIndex != null ? zIndex : void 0,
45
- position: "fixed",
46
- top: 0,
47
- left: 0,
48
- width: "100%",
49
- height: "100vh",
50
- overflow: "auto",
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":["../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","CoreManager","SliceSimulator","sliceZone","SliceZoneComp","state","background","zIndex","className","defaultProps","getDefaultProps","managedState","setManagedState","React","useState","getDefaultManagedState","slices","setSlices","getDefaultSlices","message","setMessage","getDefaultMessage","useEffect","stateManager","on","StateManagerEventType","ManagedState","_managedState","Slices","_slices","Message","_message","init","off","didMount","useRef","current","reload","_jsx","simulatorClass","filter","Boolean","join","style","undefined","position","top","left","width","height","overflow","children","dangerouslySetInnerHTML","__html","length","id","simulatorRootClass","status","StateManagerStatus","Loaded","display","onClickCapture","onClickHandler","onSubmitCapture","disableEventHandler"],"mappings":";;;AAiBA,MAAMA,cAAc,IAAIC;AA+BjB,MAAMC,iBAAiB,CAAC;AAAA,EAC9BC,WAAWC;AAAAA,EACXC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAS,MAC6B;AACtC,QAAMC,eAAeC;AAEf,QAAA,CAACC,cAAcC,eAAe,IAAIC,MAAMC,SAAS,MACtDC,wBAAwB;AAEnB,QAAA,CAACC,QAAQC,SAAS,IAAIJ,MAAMC,SAAS,MAAMI,kBAAkB;AAC7D,QAAA,CAACC,SAASC,UAAU,IAAIP,MAAMC,SAAS,MAAMO,mBAAmB;AAEtER,QAAMS,UAAU,MAAK;AACpBtB,gBAAYuB,aAAaC,GACxBC,sBAAsBC,cACrBC,CAAiB,kBAAA;AACjBf,sBAAgBe,aAAa;AAAA,OAE9B,yBAAyB;AAE1B3B,gBAAYuB,aAAaC,GACxBC,sBAAsBG,QACrBC,CAAW,YAAA;AACXZ,gBAAUY,OAAO;AAAA,OAElB,kBAAkB;AAEnB7B,gBAAYuB,aAAaC,GACxBC,sBAAsBK,SACrBC,CAAY,aAAA;AACZX,iBAAWW,QAAQ;AAAA,OAEpB,mBAAmB;AAGpB/B,gBAAYgC,KAAK3B,KAAK;AAEtB,WAAO,MAAK;AACXL,kBAAYuB,aAAaU,IACxBR,sBAAsBC,cACtB,yBAAyB;AAG1B1B,kBAAYuB,aAAaU,IACxBR,sBAAsBG,QACtB,kBAAkB;AAGnB5B,kBAAYuB,aAAaU,IACxBR,sBAAsBK,SACtB,mBAAmB;AAAA,IAAA;AAAA,EAGtB,GAAG,CAAE,CAAA;AAGCI,QAAAA,WAAWrB,MAAMsB,OAAO,KAAK;AACnCtB,QAAMS,UAAU,MAAK;AACpB,QAAIY,SAASE,SAAS;AACTb,kBAAAA,aAAac,OAAOhC,KAAK;AAAA,IAAA,OAC/B;AACN6B,eAASE,UAAU;AAAA,IACnB;AAAA,EAAA,GACC,CAAC/B,KAAK,CAAC;AAEV,SACCiC;IACC9B,WAAW,CAAC+B,gBAAgB/B,SAAS,EAAEgC,OAAOC,OAAO,EAAEC,KAAK,GAAG;AAAA,IAC/DC,OAAO;AAAA,MACNpC,QACC,OAAOA,WAAW,cACfE,aAAaF,SACbA,0BAAUqC;AAAAA,MACdC,UAAU;AAAA,MACVC,KAAK;AAAA,MACLC,MAAM;AAAA,MACNC,OAAO;AAAA,MACPC,QAAQ;AAAA,MACRC,UAAU;AAAA,MACV5C,YACC,OAAOA,eAAe,cACnBG,aAAaH,aACbA,kCAAcsC;AAAAA,IAClB;AAAA,IAAAO,UAEAhC,UACAmB,IAAA,WAAA;AAAA,MAASc,yBAAyB;AAAA,QAAEC,QAAQlC;AAAAA;IAAa,CAAA,IACtDH,OAAOsC,SACVhB,IAAA,OAAA;AAAA,MACCiB,IAAG;AAAA,MACH/C,WAAWgD;AAAAA,MACXb,OACChC,aAAa8C,WAAWC,mBAAmBC,SACxC;AAAA,QAAEC,SAAS;AAAA,MACXhB,IAAAA;AAAAA,MAEJiB,gBAAgBC;AAAAA,MAChBC,iBACCC;AAAAA,MAAwDb,UAGzDb,IAAClC;QAAcY;AAAAA,MAAAA,CAAc;AAAA,IACxB,CAAA,IACH;AAAA,EAAA,CACC;AAER;"}
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,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var ponyfill_es2018 = { exports: {} };
4
+ exports.ponyfill_es2018 = ponyfill_es2018;
5
+ //# sourceMappingURL=ponyfill.es2018.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ponyfill.es2018.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,5 @@
1
+ var ponyfill_es2018 = { exports: {} };
2
+ export {
3
+ ponyfill_es2018 as p
4
+ };
5
+ //# sourceMappingURL=ponyfill.es2018.js.map
@@ -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,4 @@
1
+ /**
2
+ * Banner text added to files that should not be edited by users.
3
+ */
4
+ export declare const NON_EDITABLE_FILE_BANNER = "// Code generated by Slice Machine. DO NOT EDIT.";
@@ -0,0 +1,5 @@
1
+ const NON_EDITABLE_FILE_BANNER = "// Code generated by Slice Machine. DO NOT EDIT.";
2
+ export {
3
+ NON_EDITABLE_FILE_BANNER
4
+ };
5
+ //# sourceMappingURL=constants.js.map
@@ -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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
- function _interopNamespace(e) {
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__ */ _interopNamespace(fs);
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":["../../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
+ {"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":["../../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
+ {"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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const fs = require("node:fs/promises");
4
- function _interopNamespace(e) {
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__ */ _interopNamespace(fs);
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":["../../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
+ {"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":["../../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
+ {"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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
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 _interopNamespace(e) {
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__ */ _interopNamespace(fs);
24
- const path__namespace = /* @__PURE__ */ _interopNamespace(path);
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":["../../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
+ {"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":["../../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
+ {"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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
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 _interopNamespace(e) {
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__ */ _interopNamespace(fs);
25
- const path__namespace = /* @__PURE__ */ _interopNamespace(path);
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":["../../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
+ {"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":["../../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
+ {"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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
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 _interopNamespace(e) {
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__ */ _interopNamespace(fs);
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":["../../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
+ {"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":["../../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
+ {"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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
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":["../../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
+ {"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":["../../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;"}
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;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const customTypeCreate = require("./customType-create.cjs");
4
4
  const customTypeRename = customTypeCreate.customTypeCreate;
5
5
  exports.customTypeRename = customTypeRename;
@@ -1 +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;;"}
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;;"}
@@ -1 +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
+ {"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.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
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":["../../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
+ {"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":["../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
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;"}
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
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 readJSONFile = require("../lib/readJSONFile.cjs");
6
- function _interopNamespace(e) {
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__ */ _interopNamespace(fs);
25
- const path__namespace = /* @__PURE__ */ _interopNamespace(path);
22
+ const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
23
+ const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
26
24
  const isCustomTypeModel = (input) => {
27
25
  return typeof input === "object" && input !== null && "json" in input;
28
26
  };