@prismicio/simulator 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export type { SimulatorAPIOptions } from "./SimulatorAPI";
4
4
  export { validateMessage, isRequestMessage, isResponseMessage, isSuccessResponseMessage, isErrorResponseMessage, ResponseError, ConnectionTimeoutError, TooManyConcurrentRequestsError, RequestTimeoutError, NotReadyError, PortNotSetError, ChannelNotSetError, } from "./channel";
5
5
  export type { RequestMessage, ResponseMessage, ErrorResponseMessage, SuccessResponseMessage, AllChannelEmitterOptions, AllChannelReceiverOptions, } from "./channel";
6
6
  export { APIRequestType, ClientRequestType } from "./types";
7
- export type { ActiveSlice, VariationSummary, SliceSummary, LibrarySummary, APITransactions, ClientTransactions, } from "./types";
7
+ export type { ActiveSlice, SliceZoneSize, APITransactions, ClientTransactions, } from "./types";
@@ -1 +1 @@
1
- {"version":3,"file":"State.cjs","sources":["../../../src/kit/State.ts"],"sourcesContent":["import type { SharedSlice, SliceZone } from \"@prismicio/client\";\n\nimport { EventEmitter } from \"../lib/EventEmitter\";\nimport { __PRODUCTION__ } from \"../lib/__PRODUCTION__\";\nimport { throttle } from \"../lib/throttle\";\n\nimport type { ActiveSlice } from \"../types\";\nimport { StateEventType, StateEvents } from \"./types\";\n\nimport { getActiveSliceDOM, getSliceZoneDOM } from \"./domHelpers\";\nimport { getDefaultSlices } from \"./getDefault\";\n\ntype StateConstructorArgs = {\n\tslices?: SliceZone;\n};\n\nexport class State extends EventEmitter<StateEvents> {\n\tprivate _slices: SliceZone;\n\tpublic set slices(slices: SliceZone) {\n\t\tthis._slices = slices;\n\t\t// Clean up message\n\t\tthis.message = \"\";\n\t\t// Dispatch event\n\t\tthis.emit(StateEventType.Slices, slices);\n\t}\n\tpublic get slices(): SliceZone {\n\t\treturn this._slices;\n\t}\n\n\tprivate _activeSlice: ActiveSlice | null;\n\tpublic set activeSlice(activeSlice: ActiveSlice | null) {\n\t\tthis._activeSlice = activeSlice;\n\t\tthis.emit(StateEventType.ActiveSlice, activeSlice);\n\t}\n\tpublic get activeSlice(): ActiveSlice | null {\n\t\treturn this._activeSlice;\n\t}\n\n\tprivate _message: string;\n\tpublic set message(message: string) {\n\t\tthis._message = message;\n\t\tthis.emit(StateEventType.Message, message);\n\t}\n\tpublic get message(): string {\n\t\treturn this._message;\n\t}\n\n\tprivate _mouse: { x: number; y: number };\n\n\tconstructor(args?: StateConstructorArgs) {\n\t\tsuper();\n\n\t\tthis._slices = args?.slices || getDefaultSlices();\n\t\tthis._activeSlice = null;\n\t\tthis._message = \"\";\n\n\t\t// StateManager needs to keep track of mouse position for the active slice\n\t\tthis._mouse = { x: 0, y: 0 };\n\t}\n\n\tasync init(): Promise<void> {\n\t\t// Init listener\n\t\twindow.addEventListener(\"mousemove\", (event) => {\n\t\t\tthis._mouse = { x: event.clientX, y: event.clientY };\n\t\t});\n\t}\n\n\tprivate _setActiveSlice = (): void => {\n\t\t// There can't be an active slice if there's no slices displayed\n\t\tif (this.slices.length === 0) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $sliceZone = getSliceZoneDOM(this.slices.length);\n\n\t\t// SliceZone has not been found, therefore active slice cannot be found\n\t\tif (!$sliceZone) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $activeSlice = getActiveSliceDOM($sliceZone, this._mouse);\n\n\t\t// Active slice has not been found\n\t\tif (!$activeSlice) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeSliceIndex = Array.prototype.indexOf.call(\n\t\t\t$sliceZone.children,\n\t\t\t$activeSlice,\n\t\t);\n\n\t\t// Active slice has been found\n\t\tthis.activeSlice = {\n\t\t\trect: $activeSlice.getBoundingClientRect(),\n\t\t\tsliceID: this.slices[activeSliceIndex].slice_type,\n\t\t\tvariationID: (this.slices[activeSliceIndex] as SharedSlice).variation,\n\t\t\tindex: activeSliceIndex,\n\t\t};\n\t};\n\tsetActiveSlice = throttle(this._setActiveSlice, 16);\n\n\tsetSliceZone(slices: SliceZone): void {\n\t\t// Set slices\n\t\tthis.slices = slices;\n\t}\n}\n"],"names":["EventEmitter","getSliceZoneDOM","getActiveSliceDOM","throttle","getDefaultSlices","StateEventType"],"mappings":";;;;;;;;;;;;;AAgBM,MAAO,cAAcA,aAAAA,aAAyB;AAAA,EAiCnD,YAAY,MAA2B;;AAhC/B;AAYA;AASA;AASA;AAoBA,2CAAkB,MAAW;AAEhC,UAAA,KAAK,OAAO,WAAW,GAAG;AAC7B,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,aAAaC,WAAA,gBAAgB,KAAK,OAAO,MAAM;AAGrD,UAAI,CAAC,YAAY;AAChB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,eAAeC,WAAA,kBAAkB,YAAY,KAAK,MAAM;AAG9D,UAAI,CAAC,cAAc;AAClB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,mBAAmB,MAAM,UAAU,QAAQ,KAChD,WAAW,UACX,YAAY;AAIb,WAAK,cAAc;AAAA,QAClB,MAAM,aAAa,sBAAuB;AAAA,QAC1C,SAAS,KAAK,OAAO,gBAAgB,EAAE;AAAA,QACvC,aAAc,KAAK,OAAO,gBAAgB,EAAkB;AAAA,QAC5D,OAAO;AAAA,MAAA;AAAA;AAGT,0CAAiBC,SAAAA,SAAS,KAAK,iBAAiB,EAAE;AAtD5C,SAAA,WAAU,6BAAM,WAAUC,WAAgB,iBAAA;AAC/C,SAAK,eAAe;AACpB,SAAK,WAAW;AAGhB,SAAK,SAAS,EAAE,GAAG,GAAG,GAAG;EAC1B;AAAA,EAxCA,IAAW,OAAO,QAAiB;AAClC,SAAK,UAAU;AAEf,SAAK,UAAU;AAEV,SAAA,KAAKC,MAAAA,eAAe,QAAQ,MAAM;AAAA,EACxC;AAAA,EACA,IAAW,SAAM;AAChB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,YAAY,aAA+B;AACrD,SAAK,eAAe;AACf,SAAA,KAAKA,MAAAA,eAAe,aAAa,WAAW;AAAA,EAClD;AAAA,EACA,IAAW,cAAW;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,QAAQ,SAAe;AACjC,SAAK,WAAW;AACX,SAAA,KAAKA,MAAAA,eAAe,SAAS,OAAO;AAAA,EAC1C;AAAA,EACA,IAAW,UAAO;AACjB,WAAO,KAAK;AAAA,EACb;AAAA,EAeA,MAAM,OAAI;AAEF,WAAA,iBAAiB,aAAa,CAAC,UAAS;AAC9C,WAAK,SAAS,EAAE,GAAG,MAAM,SAAS,GAAG,MAAM;KAC3C;AAAA,EACF;AAAA,EA2CA,aAAa,QAAiB;AAE7B,SAAK,SAAS;AAAA,EACf;AACA;;"}
1
+ {"version":3,"file":"State.cjs","sources":["../../../src/kit/State.ts"],"sourcesContent":["import type { SharedSlice, SliceZone } from \"@prismicio/client\";\n\nimport { EventEmitter } from \"../lib/EventEmitter\";\nimport { __PRODUCTION__ } from \"../lib/__PRODUCTION__\";\nimport { throttle } from \"../lib/throttle\";\n\nimport type { ActiveSlice } from \"../types\";\nimport { StateEventType, StateEvents } from \"./types\";\n\nimport { getActiveSliceDOM, getSliceZoneDOM } from \"./domHelpers\";\nimport { getDefaultSlices } from \"./getDefault\";\n\ntype StateConstructorArgs = {\n\tslices?: SliceZone;\n};\n\nexport class State extends EventEmitter<StateEvents> {\n\tprivate _slices: SliceZone;\n\tpublic set slices(slices: SliceZone) {\n\t\tthis._slices = slices;\n\t\t// Clean up message\n\t\tthis.message = \"\";\n\t\t// Dispatch event\n\t\tthis.emit(StateEventType.Slices, slices);\n\t}\n\tpublic get slices(): SliceZone {\n\t\treturn this._slices;\n\t}\n\n\tprivate _activeSlice: ActiveSlice | null;\n\tpublic set activeSlice(activeSlice: ActiveSlice | null) {\n\t\tthis._activeSlice = activeSlice;\n\t\tthis.emit(StateEventType.ActiveSlice, activeSlice);\n\t}\n\tpublic get activeSlice(): ActiveSlice | null {\n\t\treturn this._activeSlice;\n\t}\n\n\tprivate _message: string;\n\tpublic set message(message: string) {\n\t\tthis._message = message;\n\t\tthis.emit(StateEventType.Message, message);\n\t}\n\tpublic get message(): string {\n\t\treturn this._message;\n\t}\n\n\tprivate _mouse: { x: number; y: number };\n\n\tconstructor(args?: StateConstructorArgs) {\n\t\tsuper();\n\n\t\tthis._slices = args?.slices || getDefaultSlices();\n\t\tthis._activeSlice = null;\n\t\tthis._message = \"\";\n\n\t\t// StateManager needs to keep track of mouse position for the active slice\n\t\tthis._mouse = { x: 0, y: 0 };\n\t}\n\n\tasync init(): Promise<void> {\n\t\t// Init listener\n\t\twindow.addEventListener(\"mousemove\", (event) => {\n\t\t\tthis._mouse = { x: event.clientX, y: event.clientY };\n\t\t});\n\t}\n\n\tprivate _setActiveSlice = (): void => {\n\t\t// There can't be an active slice if there's no slice displayed\n\t\tif (this.slices.length === 0) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $sliceZone = getSliceZoneDOM(this.slices.length);\n\n\t\t// SliceZone has not been found, therefore active slice cannot be found\n\t\tif (!$sliceZone) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $activeSlice = getActiveSliceDOM($sliceZone, this._mouse);\n\n\t\t// Active slice has not been found\n\t\tif (!$activeSlice) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeSliceIndex = Array.prototype.indexOf.call(\n\t\t\t$sliceZone.children,\n\t\t\t$activeSlice,\n\t\t);\n\n\t\t// Active slice has been found\n\t\tthis.activeSlice = {\n\t\t\trect: $activeSlice.getBoundingClientRect(),\n\t\t\tsliceID: this.slices[activeSliceIndex].slice_type,\n\t\t\tvariationID: (this.slices[activeSliceIndex] as SharedSlice).variation,\n\t\t\tindex: activeSliceIndex,\n\t\t};\n\t};\n\tsetActiveSlice = throttle(this._setActiveSlice, 16);\n\n\tsetSliceZone(slices: SliceZone): void {\n\t\t// Set slices\n\t\tthis.slices = slices;\n\t}\n}\n"],"names":["EventEmitter","getSliceZoneDOM","getActiveSliceDOM","throttle","getDefaultSlices","StateEventType"],"mappings":";;;;;;;;;;;;;AAgBM,MAAO,cAAcA,aAAAA,aAAyB;AAAA,EAiCnD,YAAY,MAA2B;;AAhC/B;AAYA;AASA;AASA;AAoBA,2CAAkB,MAAW;AAEhC,UAAA,KAAK,OAAO,WAAW,GAAG;AAC7B,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,aAAaC,WAAA,gBAAgB,KAAK,OAAO,MAAM;AAGrD,UAAI,CAAC,YAAY;AAChB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,eAAeC,WAAA,kBAAkB,YAAY,KAAK,MAAM;AAG9D,UAAI,CAAC,cAAc;AAClB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,mBAAmB,MAAM,UAAU,QAAQ,KAChD,WAAW,UACX,YAAY;AAIb,WAAK,cAAc;AAAA,QAClB,MAAM,aAAa,sBAAuB;AAAA,QAC1C,SAAS,KAAK,OAAO,gBAAgB,EAAE;AAAA,QACvC,aAAc,KAAK,OAAO,gBAAgB,EAAkB;AAAA,QAC5D,OAAO;AAAA,MAAA;AAAA;AAGT,0CAAiBC,SAAAA,SAAS,KAAK,iBAAiB,EAAE;AAtD5C,SAAA,WAAU,6BAAM,WAAUC,WAAgB,iBAAA;AAC/C,SAAK,eAAe;AACpB,SAAK,WAAW;AAGhB,SAAK,SAAS,EAAE,GAAG,GAAG,GAAG;EAC1B;AAAA,EAxCA,IAAW,OAAO,QAAiB;AAClC,SAAK,UAAU;AAEf,SAAK,UAAU;AAEV,SAAA,KAAKC,MAAAA,eAAe,QAAQ,MAAM;AAAA,EACxC;AAAA,EACA,IAAW,SAAM;AAChB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,YAAY,aAA+B;AACrD,SAAK,eAAe;AACf,SAAA,KAAKA,MAAAA,eAAe,aAAa,WAAW;AAAA,EAClD;AAAA,EACA,IAAW,cAAW;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,QAAQ,SAAe;AACjC,SAAK,WAAW;AACX,SAAA,KAAKA,MAAAA,eAAe,SAAS,OAAO;AAAA,EAC1C;AAAA,EACA,IAAW,UAAO;AACjB,WAAO,KAAK;AAAA,EACb;AAAA,EAeA,MAAM,OAAI;AAEF,WAAA,iBAAiB,aAAa,CAAC,UAAS;AAC9C,WAAK,SAAS,EAAE,GAAG,MAAM,SAAS,GAAG,MAAM;KAC3C;AAAA,EACF;AAAA,EA2CA,aAAa,QAAiB;AAE7B,SAAK,SAAS;AAAA,EACf;AACA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"State.js","sources":["../../../src/kit/State.ts"],"sourcesContent":["import type { SharedSlice, SliceZone } from \"@prismicio/client\";\n\nimport { EventEmitter } from \"../lib/EventEmitter\";\nimport { __PRODUCTION__ } from \"../lib/__PRODUCTION__\";\nimport { throttle } from \"../lib/throttle\";\n\nimport type { ActiveSlice } from \"../types\";\nimport { StateEventType, StateEvents } from \"./types\";\n\nimport { getActiveSliceDOM, getSliceZoneDOM } from \"./domHelpers\";\nimport { getDefaultSlices } from \"./getDefault\";\n\ntype StateConstructorArgs = {\n\tslices?: SliceZone;\n};\n\nexport class State extends EventEmitter<StateEvents> {\n\tprivate _slices: SliceZone;\n\tpublic set slices(slices: SliceZone) {\n\t\tthis._slices = slices;\n\t\t// Clean up message\n\t\tthis.message = \"\";\n\t\t// Dispatch event\n\t\tthis.emit(StateEventType.Slices, slices);\n\t}\n\tpublic get slices(): SliceZone {\n\t\treturn this._slices;\n\t}\n\n\tprivate _activeSlice: ActiveSlice | null;\n\tpublic set activeSlice(activeSlice: ActiveSlice | null) {\n\t\tthis._activeSlice = activeSlice;\n\t\tthis.emit(StateEventType.ActiveSlice, activeSlice);\n\t}\n\tpublic get activeSlice(): ActiveSlice | null {\n\t\treturn this._activeSlice;\n\t}\n\n\tprivate _message: string;\n\tpublic set message(message: string) {\n\t\tthis._message = message;\n\t\tthis.emit(StateEventType.Message, message);\n\t}\n\tpublic get message(): string {\n\t\treturn this._message;\n\t}\n\n\tprivate _mouse: { x: number; y: number };\n\n\tconstructor(args?: StateConstructorArgs) {\n\t\tsuper();\n\n\t\tthis._slices = args?.slices || getDefaultSlices();\n\t\tthis._activeSlice = null;\n\t\tthis._message = \"\";\n\n\t\t// StateManager needs to keep track of mouse position for the active slice\n\t\tthis._mouse = { x: 0, y: 0 };\n\t}\n\n\tasync init(): Promise<void> {\n\t\t// Init listener\n\t\twindow.addEventListener(\"mousemove\", (event) => {\n\t\t\tthis._mouse = { x: event.clientX, y: event.clientY };\n\t\t});\n\t}\n\n\tprivate _setActiveSlice = (): void => {\n\t\t// There can't be an active slice if there's no slices displayed\n\t\tif (this.slices.length === 0) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $sliceZone = getSliceZoneDOM(this.slices.length);\n\n\t\t// SliceZone has not been found, therefore active slice cannot be found\n\t\tif (!$sliceZone) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $activeSlice = getActiveSliceDOM($sliceZone, this._mouse);\n\n\t\t// Active slice has not been found\n\t\tif (!$activeSlice) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeSliceIndex = Array.prototype.indexOf.call(\n\t\t\t$sliceZone.children,\n\t\t\t$activeSlice,\n\t\t);\n\n\t\t// Active slice has been found\n\t\tthis.activeSlice = {\n\t\t\trect: $activeSlice.getBoundingClientRect(),\n\t\t\tsliceID: this.slices[activeSliceIndex].slice_type,\n\t\t\tvariationID: (this.slices[activeSliceIndex] as SharedSlice).variation,\n\t\t\tindex: activeSliceIndex,\n\t\t};\n\t};\n\tsetActiveSlice = throttle(this._setActiveSlice, 16);\n\n\tsetSliceZone(slices: SliceZone): void {\n\t\t// Set slices\n\t\tthis.slices = slices;\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAgBM,MAAO,cAAc,aAAyB;AAAA,EAiCnD,YAAY,MAA2B;;AAhC/B;AAYA;AASA;AASA;AAoBA,2CAAkB,MAAW;AAEhC,UAAA,KAAK,OAAO,WAAW,GAAG;AAC7B,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,aAAa,gBAAgB,KAAK,OAAO,MAAM;AAGrD,UAAI,CAAC,YAAY;AAChB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,eAAe,kBAAkB,YAAY,KAAK,MAAM;AAG9D,UAAI,CAAC,cAAc;AAClB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,mBAAmB,MAAM,UAAU,QAAQ,KAChD,WAAW,UACX,YAAY;AAIb,WAAK,cAAc;AAAA,QAClB,MAAM,aAAa,sBAAuB;AAAA,QAC1C,SAAS,KAAK,OAAO,gBAAgB,EAAE;AAAA,QACvC,aAAc,KAAK,OAAO,gBAAgB,EAAkB;AAAA,QAC5D,OAAO;AAAA,MAAA;AAAA;AAGT,0CAAiB,SAAS,KAAK,iBAAiB,EAAE;AAtD5C,SAAA,WAAU,6BAAM,WAAU,iBAAgB;AAC/C,SAAK,eAAe;AACpB,SAAK,WAAW;AAGhB,SAAK,SAAS,EAAE,GAAG,GAAG,GAAG;EAC1B;AAAA,EAxCA,IAAW,OAAO,QAAiB;AAClC,SAAK,UAAU;AAEf,SAAK,UAAU;AAEV,SAAA,KAAK,eAAe,QAAQ,MAAM;AAAA,EACxC;AAAA,EACA,IAAW,SAAM;AAChB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,YAAY,aAA+B;AACrD,SAAK,eAAe;AACf,SAAA,KAAK,eAAe,aAAa,WAAW;AAAA,EAClD;AAAA,EACA,IAAW,cAAW;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,QAAQ,SAAe;AACjC,SAAK,WAAW;AACX,SAAA,KAAK,eAAe,SAAS,OAAO;AAAA,EAC1C;AAAA,EACA,IAAW,UAAO;AACjB,WAAO,KAAK;AAAA,EACb;AAAA,EAeA,MAAM,OAAI;AAEF,WAAA,iBAAiB,aAAa,CAAC,UAAS;AAC9C,WAAK,SAAS,EAAE,GAAG,MAAM,SAAS,GAAG,MAAM;KAC3C;AAAA,EACF;AAAA,EA2CA,aAAa,QAAiB;AAE7B,SAAK,SAAS;AAAA,EACf;AACA;"}
1
+ {"version":3,"file":"State.js","sources":["../../../src/kit/State.ts"],"sourcesContent":["import type { SharedSlice, SliceZone } from \"@prismicio/client\";\n\nimport { EventEmitter } from \"../lib/EventEmitter\";\nimport { __PRODUCTION__ } from \"../lib/__PRODUCTION__\";\nimport { throttle } from \"../lib/throttle\";\n\nimport type { ActiveSlice } from \"../types\";\nimport { StateEventType, StateEvents } from \"./types\";\n\nimport { getActiveSliceDOM, getSliceZoneDOM } from \"./domHelpers\";\nimport { getDefaultSlices } from \"./getDefault\";\n\ntype StateConstructorArgs = {\n\tslices?: SliceZone;\n};\n\nexport class State extends EventEmitter<StateEvents> {\n\tprivate _slices: SliceZone;\n\tpublic set slices(slices: SliceZone) {\n\t\tthis._slices = slices;\n\t\t// Clean up message\n\t\tthis.message = \"\";\n\t\t// Dispatch event\n\t\tthis.emit(StateEventType.Slices, slices);\n\t}\n\tpublic get slices(): SliceZone {\n\t\treturn this._slices;\n\t}\n\n\tprivate _activeSlice: ActiveSlice | null;\n\tpublic set activeSlice(activeSlice: ActiveSlice | null) {\n\t\tthis._activeSlice = activeSlice;\n\t\tthis.emit(StateEventType.ActiveSlice, activeSlice);\n\t}\n\tpublic get activeSlice(): ActiveSlice | null {\n\t\treturn this._activeSlice;\n\t}\n\n\tprivate _message: string;\n\tpublic set message(message: string) {\n\t\tthis._message = message;\n\t\tthis.emit(StateEventType.Message, message);\n\t}\n\tpublic get message(): string {\n\t\treturn this._message;\n\t}\n\n\tprivate _mouse: { x: number; y: number };\n\n\tconstructor(args?: StateConstructorArgs) {\n\t\tsuper();\n\n\t\tthis._slices = args?.slices || getDefaultSlices();\n\t\tthis._activeSlice = null;\n\t\tthis._message = \"\";\n\n\t\t// StateManager needs to keep track of mouse position for the active slice\n\t\tthis._mouse = { x: 0, y: 0 };\n\t}\n\n\tasync init(): Promise<void> {\n\t\t// Init listener\n\t\twindow.addEventListener(\"mousemove\", (event) => {\n\t\t\tthis._mouse = { x: event.clientX, y: event.clientY };\n\t\t});\n\t}\n\n\tprivate _setActiveSlice = (): void => {\n\t\t// There can't be an active slice if there's no slice displayed\n\t\tif (this.slices.length === 0) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $sliceZone = getSliceZoneDOM(this.slices.length);\n\n\t\t// SliceZone has not been found, therefore active slice cannot be found\n\t\tif (!$sliceZone) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst $activeSlice = getActiveSliceDOM($sliceZone, this._mouse);\n\n\t\t// Active slice has not been found\n\t\tif (!$activeSlice) {\n\t\t\tthis.activeSlice = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeSliceIndex = Array.prototype.indexOf.call(\n\t\t\t$sliceZone.children,\n\t\t\t$activeSlice,\n\t\t);\n\n\t\t// Active slice has been found\n\t\tthis.activeSlice = {\n\t\t\trect: $activeSlice.getBoundingClientRect(),\n\t\t\tsliceID: this.slices[activeSliceIndex].slice_type,\n\t\t\tvariationID: (this.slices[activeSliceIndex] as SharedSlice).variation,\n\t\t\tindex: activeSliceIndex,\n\t\t};\n\t};\n\tsetActiveSlice = throttle(this._setActiveSlice, 16);\n\n\tsetSliceZone(slices: SliceZone): void {\n\t\t// Set slices\n\t\tthis.slices = slices;\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAgBM,MAAO,cAAc,aAAyB;AAAA,EAiCnD,YAAY,MAA2B;;AAhC/B;AAYA;AASA;AASA;AAoBA,2CAAkB,MAAW;AAEhC,UAAA,KAAK,OAAO,WAAW,GAAG;AAC7B,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,aAAa,gBAAgB,KAAK,OAAO,MAAM;AAGrD,UAAI,CAAC,YAAY;AAChB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,eAAe,kBAAkB,YAAY,KAAK,MAAM;AAG9D,UAAI,CAAC,cAAc;AAClB,aAAK,cAAc;AAEnB;AAAA,MACA;AAED,YAAM,mBAAmB,MAAM,UAAU,QAAQ,KAChD,WAAW,UACX,YAAY;AAIb,WAAK,cAAc;AAAA,QAClB,MAAM,aAAa,sBAAuB;AAAA,QAC1C,SAAS,KAAK,OAAO,gBAAgB,EAAE;AAAA,QACvC,aAAc,KAAK,OAAO,gBAAgB,EAAkB;AAAA,QAC5D,OAAO;AAAA,MAAA;AAAA;AAGT,0CAAiB,SAAS,KAAK,iBAAiB,EAAE;AAtD5C,SAAA,WAAU,6BAAM,WAAU,iBAAgB;AAC/C,SAAK,eAAe;AACpB,SAAK,WAAW;AAGhB,SAAK,SAAS,EAAE,GAAG,GAAG,GAAG;EAC1B;AAAA,EAxCA,IAAW,OAAO,QAAiB;AAClC,SAAK,UAAU;AAEf,SAAK,UAAU;AAEV,SAAA,KAAK,eAAe,QAAQ,MAAM;AAAA,EACxC;AAAA,EACA,IAAW,SAAM;AAChB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,YAAY,aAA+B;AACrD,SAAK,eAAe;AACf,SAAA,KAAK,eAAe,aAAa,WAAW;AAAA,EAClD;AAAA,EACA,IAAW,cAAW;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAGA,IAAW,QAAQ,SAAe;AACjC,SAAK,WAAW;AACX,SAAA,KAAK,eAAe,SAAS,OAAO;AAAA,EAC1C;AAAA,EACA,IAAW,UAAO;AACjB,WAAO,KAAK;AAAA,EACb;AAAA,EAeA,MAAM,OAAI;AAEF,WAAA,iBAAiB,aAAa,CAAC,UAAS;AAC9C,WAAK,SAAS,EAAE,GAAG,MAAM,SAAS,GAAG,MAAM;KAC3C;AAAA,EACF;AAAA,EA2CA,aAAa,QAAiB;AAE7B,SAAK,SAAS;AAAA,EACf;AACA;"}
@@ -6,15 +6,15 @@ const header = " _____ ___ _____ _ __ __
6
6
  const footer = "\n\n\n\n\n\n - The Prismic team";
7
7
  const sliceSimulatorAccessedDirectly = div([
8
8
  header,
9
- `You're seeing this page because you're accessing Slice Simulator
9
+ `You're seeing this page because you're accessing Slice simulator
10
10
  directly, e.g:
11
11
 
12
12
  - ${a("http://localhost:3000/slice-simulator")}
13
13
 
14
14
 
15
15
 
16
- Slice Simulator is not meant to be accessed this way, to preview your
17
- slices, head over to Slice Machine UI:
16
+ The Slice simulator can only be accessed through Slice Machine or the
17
+ Page Builder. To preview your Slices, head over to Slice Machine:
18
18
 
19
19
  - ${a("http://localhost:9999")}
20
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"messages.cjs","sources":["../../../src/kit/messages.ts"],"sourcesContent":["const div = (content: string) =>\n\t`<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\n\nconst a = (href: string, label?: string) =>\n\t`<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\n\nconst header =\n\t\" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\n\nconst footer =\n\t\"\\n\\n\\n\\n\\n\\n - The Prismic team\";\n\nexport const sliceSimulatorAccessedDirectly = div(\n\t[\n\t\theader,\n\t\t`You're seeing this page because you're accessing Slice Simulator\\ndirectly, e.g:\\n\\n - ${a(\n\t\t\t\"http://localhost:3000/slice-simulator\",\n\t\t)}\\n\\n\\n\\nSlice Simulator is not meant to be accessed this way, to preview your\\nslices, head over to Slice Machine UI:\\n\\n - ${a(\n\t\t\t\"http://localhost:9999\",\n\t\t)}\\n\\n\\n\\nIf you believe this is an error, please reach out to us:\\n\\n - ${a(\n\t\t\t\"https://github.com/prismicio/slice-machine/issues/new/choose\",\n\t\t)}`,\n\t\tfooter,\n\t].join(\"\"),\n);\n"],"names":[],"mappings":";;AAAA,MAAM,MAAM,CAAC,YACZ,mLAAmL;AAEpL,MAAM,IAAI,CAAC,MAAc,UACxB,YAAY,6CAA6C,SAAS;AAEnE,MAAM,SACL;AAED,MAAM,SACL;AAEM,MAAM,iCAAiC,IAC7C;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA,MAA2F,EAC1F,uCAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACyF,EAChI,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACoD,EAC3E,8DAA8D;AAAA,EAE/D;AACA,EAAC,KAAK,EAAE,CAAC;;"}
1
+ {"version":3,"file":"messages.cjs","sources":["../../../src/kit/messages.ts"],"sourcesContent":["const div = (content: string) =>\n\t`<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\n\nconst a = (href: string, label?: string) =>\n\t`<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\n\nconst header =\n\t\" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\n\nconst footer =\n\t\"\\n\\n\\n\\n\\n\\n - The Prismic team\";\n\nexport const sliceSimulatorAccessedDirectly = div(\n\t[\n\t\theader,\n\t\t`You're seeing this page because you're accessing Slice simulator\\ndirectly, e.g:\\n\\n - ${a(\n\t\t\t\"http://localhost:3000/slice-simulator\",\n\t\t)}\\n\\n\\n\\nThe Slice simulator can only be accessed through Slice Machine or the\\nPage Builder. To preview your Slices, head over to Slice Machine:\\n\\n - ${a(\n\t\t\t\"http://localhost:9999\",\n\t\t)}\\n\\n\\n\\nIf you believe this is an error, please reach out to us:\\n\\n - ${a(\n\t\t\t\"https://github.com/prismicio/slice-machine/issues/new/choose\",\n\t\t)}`,\n\t\tfooter,\n\t].join(\"\"),\n);\n"],"names":[],"mappings":";;AAAA,MAAM,MAAM,CAAC,YACZ,mLAAmL;AAEpL,MAAM,IAAI,CAAC,MAAc,UACxB,YAAY,6CAA6C,SAAS;AAEnE,MAAM,SACL;AAED,MAAM,SACL;AAEM,MAAM,iCAAiC,IAC7C;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA,MAA2F,EAC1F,uCAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACoH,EAC3J,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACoD,EAC3E,8DAA8D;AAAA,EAE/D;AACA,EAAC,KAAK,EAAE,CAAC;;"}
@@ -4,15 +4,15 @@ const header = " _____ ___ _____ _ __ __
4
4
  const footer = "\n\n\n\n\n\n - The Prismic team";
5
5
  const sliceSimulatorAccessedDirectly = div([
6
6
  header,
7
- `You're seeing this page because you're accessing Slice Simulator
7
+ `You're seeing this page because you're accessing Slice simulator
8
8
  directly, e.g:
9
9
 
10
10
  - ${a("http://localhost:3000/slice-simulator")}
11
11
 
12
12
 
13
13
 
14
- Slice Simulator is not meant to be accessed this way, to preview your
15
- slices, head over to Slice Machine UI:
14
+ The Slice simulator can only be accessed through Slice Machine or the
15
+ Page Builder. To preview your Slices, head over to Slice Machine:
16
16
 
17
17
  - ${a("http://localhost:9999")}
18
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sources":["../../../src/kit/messages.ts"],"sourcesContent":["const div = (content: string) =>\n\t`<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\n\nconst a = (href: string, label?: string) =>\n\t`<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\n\nconst header =\n\t\" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\n\nconst footer =\n\t\"\\n\\n\\n\\n\\n\\n - The Prismic team\";\n\nexport const sliceSimulatorAccessedDirectly = div(\n\t[\n\t\theader,\n\t\t`You're seeing this page because you're accessing Slice Simulator\\ndirectly, e.g:\\n\\n - ${a(\n\t\t\t\"http://localhost:3000/slice-simulator\",\n\t\t)}\\n\\n\\n\\nSlice Simulator is not meant to be accessed this way, to preview your\\nslices, head over to Slice Machine UI:\\n\\n - ${a(\n\t\t\t\"http://localhost:9999\",\n\t\t)}\\n\\n\\n\\nIf you believe this is an error, please reach out to us:\\n\\n - ${a(\n\t\t\t\"https://github.com/prismicio/slice-machine/issues/new/choose\",\n\t\t)}`,\n\t\tfooter,\n\t].join(\"\"),\n);\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,CAAC,YACZ,mLAAmL;AAEpL,MAAM,IAAI,CAAC,MAAc,UACxB,YAAY,6CAA6C,SAAS;AAEnE,MAAM,SACL;AAED,MAAM,SACL;AAEM,MAAM,iCAAiC,IAC7C;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA,MAA2F,EAC1F,uCAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACyF,EAChI,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACoD,EAC3E,8DAA8D;AAAA,EAE/D;AACA,EAAC,KAAK,EAAE,CAAC;"}
1
+ {"version":3,"file":"messages.js","sources":["../../../src/kit/messages.ts"],"sourcesContent":["const div = (content: string) =>\n\t`<div style=\"word-spacing: initial; white-space: pre; line-height: initial; font-family: monospace; color: #ffffff; mix-blend-mode: difference; padding: 1rem; font-size: 1rem;\">${content}</div>`;\n\nconst a = (href: string, label?: string) =>\n\t`<a href=\"${href}\" style=\"text-decoration: underline;\">${label || href}<a>`;\n\nconst header =\n\t\" _____ ___ _____ _ __ __ \\n / ___// (_)_______ / ___/(_)___ ___ __ __/ /___ _/ /_____ _____\\n \\\\__ \\\\/ / / ___/ _ \\\\\\\\__ \\\\/ / __ `__ \\\\/ / / / / __ `/ __/ __ \\\\/ ___/\\n ___/ / / / /__/ __/__/ / / / / / / / /_/ / / /_/ / /_/ /_/ / / \\n/____/_/_/\\\\___/\\\\___/____/_/_/ /_/ /_/\\\\__,_/_/\\\\__,_/\\\\__/\\\\____/_/ \\n / /_ __ __ / __ \\\\_____(_)________ ___ (_)____\\n / __ \\\\/ / / / / /_/ / ___/ / ___/ __ `__ \\\\/ / ___/\\n / /_/ / /_/ / / ____/ / / (__ ) / / / / / / /__ \\n /_.___/\\\\__, / /_/ /_/ /_/____/_/ /_/ /_/_/\\\\___/ \\n /____/\\n\\n\";\n\nconst footer =\n\t\"\\n\\n\\n\\n\\n\\n - The Prismic team\";\n\nexport const sliceSimulatorAccessedDirectly = div(\n\t[\n\t\theader,\n\t\t`You're seeing this page because you're accessing Slice simulator\\ndirectly, e.g:\\n\\n - ${a(\n\t\t\t\"http://localhost:3000/slice-simulator\",\n\t\t)}\\n\\n\\n\\nThe Slice simulator can only be accessed through Slice Machine or the\\nPage Builder. To preview your Slices, head over to Slice Machine:\\n\\n - ${a(\n\t\t\t\"http://localhost:9999\",\n\t\t)}\\n\\n\\n\\nIf you believe this is an error, please reach out to us:\\n\\n - ${a(\n\t\t\t\"https://github.com/prismicio/slice-machine/issues/new/choose\",\n\t\t)}`,\n\t\tfooter,\n\t].join(\"\"),\n);\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,CAAC,YACZ,mLAAmL;AAEpL,MAAM,IAAI,CAAC,MAAc,UACxB,YAAY,6CAA6C,SAAS;AAEnE,MAAM,SACL;AAED,MAAM,SACL;AAEM,MAAM,iCAAiC,IAC7C;AAAA,EACC;AAAA,EACA;AAAA;AAAA;AAAA,MAA2F,EAC1F,uCAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACoH,EAC3J,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACoD,EAC3E,8DAA8D;AAAA,EAE/D;AACA,EAAC,KAAK,EAAE,CAAC;"}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SimulatorManager = require("./SimulatorManager.cjs");
4
- const State = require("./State.cjs");
5
- const getDefault = require("./getDefault.cjs");
6
- const domHelpers = require("./domHelpers.cjs");
7
- const eventHandlers = require("./eventHandlers.cjs");
8
- const messages = require("./messages.cjs");
9
- const types = require("./types.cjs");
3
+ const SimulatorManager = require("./kit/SimulatorManager.cjs");
4
+ const State = require("./kit/State.cjs");
5
+ const getDefault = require("./kit/getDefault.cjs");
6
+ const domHelpers = require("./kit/domHelpers.cjs");
7
+ const eventHandlers = require("./kit/eventHandlers.cjs");
8
+ const messages = require("./kit/messages.cjs");
9
+ const types = require("./kit/types.cjs");
10
10
  exports.SimulatorManager = SimulatorManager.SimulatorManager;
11
11
  exports.State = State.State;
12
12
  exports.getDefaultMessage = getDefault.getDefaultMessage;
@@ -23,4 +23,4 @@ Object.defineProperty(exports, "StateEventType", {
23
23
  enumerable: true,
24
24
  get: () => types.StateEventType
25
25
  });
26
- //# sourceMappingURL=index.cjs.map
26
+ //# sourceMappingURL=kit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/kit.js ADDED
@@ -0,0 +1,23 @@
1
+ import { SimulatorManager } from "./kit/SimulatorManager.js";
2
+ import { State } from "./kit/State.js";
3
+ import { getDefaultMessage, getDefaultProps, getDefaultSlices } from "./kit/getDefault.js";
4
+ import { getActiveSliceDOM, getSliceZoneDOM, simulatorClass, simulatorRootClass } from "./kit/domHelpers.js";
5
+ import { disableEventHandler, onClickHandler } from "./kit/eventHandlers.js";
6
+ import { sliceSimulatorAccessedDirectly } from "./kit/messages.js";
7
+ import { StateEventType } from "./kit/types.js";
8
+ export {
9
+ SimulatorManager,
10
+ State,
11
+ StateEventType,
12
+ disableEventHandler,
13
+ getActiveSliceDOM,
14
+ getDefaultMessage,
15
+ getDefaultProps,
16
+ getDefaultSlices,
17
+ getSliceZoneDOM,
18
+ onClickHandler,
19
+ simulatorClass,
20
+ simulatorRootClass,
21
+ sliceSimulatorAccessedDirectly
22
+ };
23
+ //# sourceMappingURL=kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/simulator",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Preview and develop Prismic slices fast with minimal configuration",
5
5
  "keywords": [
6
6
  "typescript",
@@ -27,11 +27,11 @@
27
27
  "./kit": {
28
28
  "require": {
29
29
  "types": "./dist/kit/index.d.ts",
30
- "default": "./dist/kit/index.cjs"
30
+ "default": "./dist/kit.cjs"
31
31
  },
32
32
  "import": {
33
33
  "types": "./dist/kit/index.d.ts",
34
- "default": "./dist/kit/index.js"
34
+ "default": "./dist/kit.js"
35
35
  }
36
36
  },
37
37
  "./package.json": "./package.json"
@@ -43,6 +43,16 @@
43
43
  "./dist",
44
44
  "./src"
45
45
  ],
46
+ "typesVersions": {
47
+ "*": {
48
+ "*": [
49
+ "dist/index.d.ts"
50
+ ],
51
+ "kit": [
52
+ "dist/kit/index.d.ts"
53
+ ]
54
+ }
55
+ },
46
56
  "scripts": {
47
57
  "build": "vite build",
48
58
  "dev": "nuxi dev playground",
@@ -62,6 +72,7 @@
62
72
  },
63
73
  "dependencies": {
64
74
  "@prismicio/client": "^7.0.1",
75
+ "@types/statuses": "^2.0.1",
65
76
  "statuses": "^2.0.1"
66
77
  },
67
78
  "devDependencies": {
@@ -72,14 +83,14 @@
72
83
  "@slicemachine/adapter-nuxt": "^0.3.0",
73
84
  "@trivago/prettier-plugin-sort-imports": "^4.1.1",
74
85
  "@types/node": "^18",
75
- "@types/statuses": "^2.0.1",
76
86
  "@typescript-eslint/eslint-plugin": "^5.59.9",
77
87
  "@typescript-eslint/parser": "^5.59.9",
78
- "@vitest/coverage-c8": "^0.32.0",
88
+ "@vitest/coverage-v8": "^0.32.0",
79
89
  "eslint": "^8.42.0",
80
90
  "eslint-config-prettier": "^8.8.0",
81
91
  "eslint-plugin-prettier": "^4.2.1",
82
92
  "eslint-plugin-tsdoc": "^0.2.17",
93
+ "jsdom": "^22.1.0",
83
94
  "nuxt": "^3.5.3",
84
95
  "prettier": "^2.8.8",
85
96
  "prettier-plugin-jsdoc": "^0.4.2",
package/src/index.ts CHANGED
@@ -34,9 +34,7 @@ export type {
34
34
  export { APIRequestType, ClientRequestType } from "./types";
35
35
  export type {
36
36
  ActiveSlice,
37
- VariationSummary,
38
- SliceSummary,
39
- LibrarySummary,
37
+ SliceZoneSize,
40
38
  APITransactions,
41
39
  ClientTransactions,
42
40
  } from "./types";
package/src/kit/State.ts CHANGED
@@ -66,7 +66,7 @@ export class State extends EventEmitter<StateEvents> {
66
66
  }
67
67
 
68
68
  private _setActiveSlice = (): void => {
69
- // There can't be an active slice if there's no slices displayed
69
+ // There can't be an active slice if there's no slice displayed
70
70
  if (this.slices.length === 0) {
71
71
  this.activeSlice = null;
72
72
 
@@ -13,9 +13,9 @@ const footer =
13
13
  export const sliceSimulatorAccessedDirectly = div(
14
14
  [
15
15
  header,
16
- `You're seeing this page because you're accessing Slice Simulator\ndirectly, e.g:\n\n - ${a(
16
+ `You're seeing this page because you're accessing Slice simulator\ndirectly, e.g:\n\n - ${a(
17
17
  "http://localhost:3000/slice-simulator",
18
- )}\n\n\n\nSlice Simulator is not meant to be accessed this way, to preview your\nslices, head over to Slice Machine UI:\n\n - ${a(
18
+ )}\n\n\n\nThe Slice simulator can only be accessed through Slice Machine or the\nPage Builder. To preview your Slices, head over to Slice Machine:\n\n - ${a(
19
19
  "http://localhost:9999",
20
20
  )}\n\n\n\nIf you believe this is an error, please reach out to us:\n\n - ${a(
21
21
  "https://github.com/prismicio/slice-machine/issues/new/choose",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/kit/index.js DELETED
@@ -1,23 +0,0 @@
1
- import { SimulatorManager } from "./SimulatorManager.js";
2
- import { State } from "./State.js";
3
- import { getDefaultMessage, getDefaultProps, getDefaultSlices } from "./getDefault.js";
4
- import { getActiveSliceDOM, getSliceZoneDOM, simulatorClass, simulatorRootClass } from "./domHelpers.js";
5
- import { disableEventHandler, onClickHandler } from "./eventHandlers.js";
6
- import { sliceSimulatorAccessedDirectly } from "./messages.js";
7
- import { StateEventType } from "./types.js";
8
- export {
9
- SimulatorManager,
10
- State,
11
- StateEventType,
12
- disableEventHandler,
13
- getActiveSliceDOM,
14
- getDefaultMessage,
15
- getDefaultProps,
16
- getDefaultSlices,
17
- getSliceZoneDOM,
18
- onClickHandler,
19
- simulatorClass,
20
- simulatorRootClass,
21
- sliceSimulatorAccessedDirectly
22
- };
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}