@comet/site-react 7.21.0-canary-20250522145352

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 (116) hide show
  1. package/LICENSE +24 -0
  2. package/lib/blockLoader/blockLoader.d.ts +32 -0
  3. package/lib/blockLoader/blockLoader.d.ts.map +1 -0
  4. package/lib/blockLoader/blockLoader.js +57 -0
  5. package/lib/blocks/PropsWithData.d.ts +4 -0
  6. package/lib/blocks/PropsWithData.d.ts.map +1 -0
  7. package/lib/blocks/SvgImageBlock.d.ts +9 -0
  8. package/lib/blocks/SvgImageBlock.d.ts.map +1 -0
  9. package/lib/blocks/SvgImageBlock.js +23 -0
  10. package/lib/blocks/factories/BlocksBlock.d.ts +15 -0
  11. package/lib/blocks/factories/BlocksBlock.d.ts.map +1 -0
  12. package/lib/blocks/factories/BlocksBlock.js +30 -0
  13. package/lib/blocks/factories/ListBlock.d.ts +14 -0
  14. package/lib/blocks/factories/ListBlock.d.ts.map +1 -0
  15. package/lib/blocks/factories/ListBlock.js +13 -0
  16. package/lib/blocks/factories/OneOfBlock.d.ts +15 -0
  17. package/lib/blocks/factories/OneOfBlock.d.ts.map +1 -0
  18. package/lib/blocks/factories/OneOfBlock.js +26 -0
  19. package/lib/blocks/factories/OptionalBlock.d.ts +11 -0
  20. package/lib/blocks/factories/OptionalBlock.d.ts.map +1 -0
  21. package/lib/blocks/factories/OptionalBlock.js +10 -0
  22. package/lib/blocks/factories/types.d.ts +5 -0
  23. package/lib/blocks/factories/types.d.ts.map +1 -0
  24. package/lib/blocks/helpers/RichTextBlockHelper.d.ts +3 -0
  25. package/lib/blocks/helpers/RichTextBlockHelper.d.ts.map +1 -0
  26. package/lib/blocks/helpers/RichTextBlockHelper.js +7 -0
  27. package/lib/blocks/helpers/useIsElementInViewport.d.ts +2 -0
  28. package/lib/blocks/helpers/useIsElementInViewport.d.ts.map +1 -0
  29. package/lib/blocks/helpers/useIsElementInViewport.js +21 -0
  30. package/lib/blocks.generated.d.ts +176 -0
  31. package/lib/blocks.generated.d.ts.map +1 -0
  32. package/lib/cookies/CookieApiContext.d.ts +14 -0
  33. package/lib/cookies/CookieApiContext.d.ts.map +1 -0
  34. package/lib/cookies/CookieApiContext.js +19 -0
  35. package/lib/cookies/CookieSafe.d.ts +9 -0
  36. package/lib/cookies/CookieSafe.d.ts.map +1 -0
  37. package/lib/cookies/CookieSafe.js +19 -0
  38. package/lib/cookies/useCookieBotCookieApi.d.ts +3 -0
  39. package/lib/cookies/useCookieBotCookieApi.d.ts.map +1 -0
  40. package/lib/cookies/useCookieBotCookieApi.js +34 -0
  41. package/lib/cookies/useLocalStorageCookieApi.d.ts +11 -0
  42. package/lib/cookies/useLocalStorageCookieApi.d.ts.map +1 -0
  43. package/lib/cookies/useLocalStorageCookieApi.js +41 -0
  44. package/lib/cookies/useOneTrustCookieApi.d.ts +3 -0
  45. package/lib/cookies/useOneTrustCookieApi.d.ts.map +1 -0
  46. package/lib/cookies/useOneTrustCookieApi.js +49 -0
  47. package/lib/errorHandler/ErrorHandlerBoundary.d.ts +3 -0
  48. package/lib/errorHandler/ErrorHandlerBoundary.d.ts.map +1 -0
  49. package/lib/errorHandler/ErrorHandlerBoundary.js +10 -0
  50. package/lib/errorHandler/ErrorHandlerBoundaryInternal.d.ts +17 -0
  51. package/lib/errorHandler/ErrorHandlerBoundaryInternal.d.ts.map +1 -0
  52. package/lib/errorHandler/ErrorHandlerBoundaryInternal.js +27 -0
  53. package/lib/errorHandler/ErrorHandlerProvider.d.ts +9 -0
  54. package/lib/errorHandler/ErrorHandlerProvider.d.ts.map +1 -0
  55. package/lib/errorHandler/ErrorHandlerProvider.js +22 -0
  56. package/lib/graphQLFetch/fetchInMemoryCache.d.ts +4 -0
  57. package/lib/graphQLFetch/fetchInMemoryCache.d.ts.map +1 -0
  58. package/lib/graphQLFetch/fetchInMemoryCache.js +38 -0
  59. package/lib/graphQLFetch/graphQLFetch.d.ts +12 -0
  60. package/lib/graphQLFetch/graphQLFetch.d.ts.map +1 -0
  61. package/lib/graphQLFetch/graphQLFetch.js +111 -0
  62. package/lib/iframebridge/IFrameBridge.d.ts +40 -0
  63. package/lib/iframebridge/IFrameBridge.d.ts.map +1 -0
  64. package/lib/iframebridge/IFrameBridge.js +239 -0
  65. package/lib/iframebridge/IFrameBridge.module.scss.js +8 -0
  66. package/lib/iframebridge/IFrameMessage.d.ts +118 -0
  67. package/lib/iframebridge/IFrameMessage.d.ts.map +1 -0
  68. package/lib/iframebridge/IFrameMessage.js +21 -0
  69. package/lib/iframebridge/Preview.d.ts +9 -0
  70. package/lib/iframebridge/Preview.d.ts.map +1 -0
  71. package/lib/iframebridge/Preview.js +57 -0
  72. package/lib/iframebridge/Preview.module.scss.js +8 -0
  73. package/lib/iframebridge/PreviewOverlay.d.ts +2 -0
  74. package/lib/iframebridge/PreviewOverlay.d.ts.map +1 -0
  75. package/lib/iframebridge/PreviewOverlay.js +27 -0
  76. package/lib/iframebridge/PreviewOverlay.module.scss.js +8 -0
  77. package/lib/iframebridge/PreviewOverlayElement.d.ts +7 -0
  78. package/lib/iframebridge/PreviewOverlayElement.d.ts.map +1 -0
  79. package/lib/iframebridge/PreviewOverlayElement.js +36 -0
  80. package/lib/iframebridge/PreviewOverlayElement.module.scss.js +20 -0
  81. package/lib/iframebridge/useBlockPreviewFetch.d.ts +16 -0
  82. package/lib/iframebridge/useBlockPreviewFetch.d.ts.map +1 -0
  83. package/lib/iframebridge/useBlockPreviewFetch.js +29 -0
  84. package/lib/iframebridge/useIFrameBridge.d.ts +3 -0
  85. package/lib/iframebridge/useIFrameBridge.d.ts.map +1 -0
  86. package/lib/iframebridge/useIFrameBridge.js +8 -0
  87. package/lib/iframebridge/utils.d.ts +10 -0
  88. package/lib/iframebridge/utils.d.ts.map +1 -0
  89. package/lib/iframebridge/utils.js +45 -0
  90. package/lib/iframebridge/withPreview.d.ts +18 -0
  91. package/lib/iframebridge/withPreview.d.ts.map +1 -0
  92. package/lib/iframebridge/withPreview.js +34 -0
  93. package/lib/image/Image.d.ts +8 -0
  94. package/lib/image/Image.d.ts.map +1 -0
  95. package/lib/image/Image.js +10 -0
  96. package/lib/image/image.utils.d.ts +18 -0
  97. package/lib/image/image.utils.d.ts.map +1 -0
  98. package/lib/image/image.utils.js +53 -0
  99. package/lib/index.d.ts +32 -0
  100. package/lib/index.d.ts.map +1 -0
  101. package/lib/index.js +69 -0
  102. package/lib/preview/BlockPreviewProvider.d.ts +3 -0
  103. package/lib/preview/BlockPreviewProvider.d.ts.map +1 -0
  104. package/lib/preview/BlockPreviewProvider.js +18 -0
  105. package/lib/preview/PreviewContext.d.ts +9 -0
  106. package/lib/preview/PreviewContext.d.ts.map +1 -0
  107. package/lib/preview/PreviewContext.js +11 -0
  108. package/lib/preview/usePreview.d.ts +11 -0
  109. package/lib/preview/usePreview.d.ts.map +1 -0
  110. package/lib/preview/usePreview.js +41 -0
  111. package/lib/previewskeleton/PreviewSkeleton.d.ts +14 -0
  112. package/lib/previewskeleton/PreviewSkeleton.d.ts.map +1 -0
  113. package/lib/previewskeleton/PreviewSkeleton.js +64 -0
  114. package/lib/previewskeleton/PreviewSkeleton.module.scss.js +17 -0
  115. package/lib/style.css +1 -0
  116. package/package.json +84 -0
@@ -0,0 +1,10 @@
1
+ export declare const BLOCK_PREVIEW_CONTAINER_DATA_ATTRIBUTE = "data-comet-block-preview-container";
2
+ export declare const PREVIEW_ELEMENT_SCROLLED_INTO_VIEW_EVENT = "comet-preview-element-scrolled-into-view";
3
+ export declare const getRecursiveChildrenOfPreviewElement: (rootElement: Element) => Element[];
4
+ export declare const getCombinedPositioningOfElements: (elements: Element[]) => {
5
+ top: number;
6
+ left: number;
7
+ width: number;
8
+ height: number;
9
+ };
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/iframebridge/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sCAAsC,uCAAuC,CAAC;AAC3F,eAAO,MAAM,wCAAwC,6CAA6C,CAAC;AAEnG,eAAO,MAAM,oCAAoC,gBAAiB,OAAO,KAAG,OAAO,EAclF,CAAC;AAEF,eAAO,MAAM,gCAAgC,aAAc,OAAO,EAAE;;;;;CAgCnE,CAAC"}
@@ -0,0 +1,45 @@
1
+ const BLOCK_PREVIEW_CONTAINER_DATA_ATTRIBUTE = "data-comet-block-preview-container";
2
+ const PREVIEW_ELEMENT_SCROLLED_INTO_VIEW_EVENT = "comet-preview-element-scrolled-into-view";
3
+ const getRecursiveChildrenOfPreviewElement = (rootElement) => {
4
+ const previewElementChildNodes = [];
5
+ rootElement.childNodes.forEach((childNode) => {
6
+ if (!(childNode instanceof Element))
7
+ return;
8
+ if (childNode.hasAttribute(BLOCK_PREVIEW_CONTAINER_DATA_ATTRIBUTE)) {
9
+ previewElementChildNodes.push(...getRecursiveChildrenOfPreviewElement(childNode));
10
+ } else {
11
+ previewElementChildNodes.push(childNode);
12
+ }
13
+ });
14
+ return previewElementChildNodes;
15
+ };
16
+ const getCombinedPositioningOfElements = (elements) => {
17
+ const topPositions = [];
18
+ const leftPositions = [];
19
+ elements.forEach((element) => {
20
+ const { top, left, bottom, right } = element.getBoundingClientRect();
21
+ topPositions.push(top + window.scrollY);
22
+ leftPositions.push(left + window.scrollX);
23
+ });
24
+ const highestTopPosition = Math.min(...topPositions);
25
+ const highestLeftPosition = Math.min(...leftPositions);
26
+ const widthValues = [];
27
+ const heightValues = [];
28
+ elements.forEach((element) => {
29
+ const { right, bottom } = element.getBoundingClientRect();
30
+ widthValues.push(right - highestLeftPosition);
31
+ heightValues.push(bottom - highestTopPosition + window.scrollY);
32
+ });
33
+ return {
34
+ top: highestTopPosition,
35
+ left: highestLeftPosition,
36
+ width: Math.max(...widthValues),
37
+ height: Math.max(...heightValues)
38
+ };
39
+ };
40
+ export {
41
+ BLOCK_PREVIEW_CONTAINER_DATA_ATTRIBUTE,
42
+ PREVIEW_ELEMENT_SCROLLED_INTO_VIEW_EVENT,
43
+ getCombinedPositioningOfElements,
44
+ getRecursiveChildrenOfPreviewElement
45
+ };
@@ -0,0 +1,18 @@
1
+ import { ComponentType } from 'react';
2
+ interface AdminMetaInterface {
3
+ route: string;
4
+ }
5
+ export interface WithPreviewProps {
6
+ data: WithPreviewPropsData;
7
+ }
8
+ export interface WithPreviewPropsData {
9
+ adminMeta?: AdminMetaInterface;
10
+ }
11
+ export declare function isWithPreviewPropsData(block: unknown): block is WithPreviewPropsData;
12
+ interface PreviewOptions {
13
+ label?: string;
14
+ enabledChildrenAutoScrolling?: boolean;
15
+ }
16
+ export declare const withPreview: <ComponentProps>(Component: ComponentType<ComponentProps>, { label, enabledChildrenAutoScrolling }: PreviewOptions) => ({ ...componentProps }: WithPreviewProps & ComponentProps) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=withPreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withPreview.d.ts","sourceRoot":"","sources":["../../src/iframebridge/withPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAA6B,MAAM,OAAO,CAAC;AAItE,UAAU,kBAAkB;IACxB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,oBAAoB,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAEpF;AAED,UAAU,cAAc;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAWD,eAAO,MAAM,WAAW,sGAEwC,cAAc,0GAsB7E,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext } from "react";
4
+ import { Preview } from "./Preview.js";
5
+ function isWithPreviewPropsData(block) {
6
+ return block.adminMeta !== void 0;
7
+ }
8
+ const AdminRouteContext = createContext({
9
+ parentRoute: "",
10
+ parentEnabledAutoScrolling: true
11
+ });
12
+ const withPreview = (Component, { label = "No type", enabledChildrenAutoScrolling = true }) => {
13
+ return ({ ...componentProps }) => {
14
+ var _a, _b, _c, _d;
15
+ const { parentRoute, parentEnabledAutoScrolling } = useContext(AdminRouteContext);
16
+ if (((_a = componentProps.data) == null ? void 0 : _a.adminMeta) && ((_b = componentProps.data) == null ? void 0 : _b.adminMeta.route) !== parentRoute) {
17
+ return /* @__PURE__ */ jsx(
18
+ AdminRouteContext.Provider,
19
+ {
20
+ value: {
21
+ parentRoute: (_c = componentProps.data) == null ? void 0 : _c.adminMeta.route,
22
+ parentEnabledAutoScrolling: !parentEnabledAutoScrolling ? false : enabledChildrenAutoScrolling
23
+ },
24
+ children: /* @__PURE__ */ jsx(Preview, { adminRoute: (_d = componentProps.data) == null ? void 0 : _d.adminMeta.route, label, enabledAutoScrolling: parentEnabledAutoScrolling, children: /* @__PURE__ */ jsx(Component, { ...componentProps }) })
25
+ }
26
+ );
27
+ }
28
+ return /* @__PURE__ */ jsx(Component, { ...componentProps });
29
+ };
30
+ };
31
+ export {
32
+ isWithPreviewPropsData,
33
+ withPreview
34
+ };
@@ -0,0 +1,8 @@
1
+ import { ImgHTMLAttributes } from 'react';
2
+ export type ImageProps = ImgHTMLAttributes<HTMLImageElement> & {
3
+ aspectRatio: string | number;
4
+ src: string;
5
+ width: string | number;
6
+ };
7
+ export declare function Image({ aspectRatio, src, width, ...imgProps }: ImageProps): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../src/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAErI,wBAAgB,KAAK,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,EAAE,UAAU,2CAKzE"}
@@ -0,0 +1,10 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { parseAspectRatio, generateImageUrl } from "./image.utils.js";
3
+ function Image({ aspectRatio, src, width, ...imgProps }) {
4
+ const usedAspectRatio = parseAspectRatio(aspectRatio);
5
+ const imageUrl = generateImageUrl({ src, width: Number(width) }, usedAspectRatio);
6
+ return /* @__PURE__ */ jsx("img", { src: imageUrl, ...imgProps });
7
+ }
8
+ export {
9
+ Image
10
+ };
@@ -0,0 +1,18 @@
1
+ export declare function parseAspectRatio(value: string | number): number;
2
+ export interface ImageDimensions {
3
+ width: number;
4
+ height: number;
5
+ }
6
+ export declare function getMaxDimensionsFromArea(area: ImageDimensions, aspectRatio: number): ImageDimensions;
7
+ export declare function calculateInheritAspectRatio(imageDimensions: ImageDimensions, cropArea: {
8
+ focalPoint: "SMART" | "CENTER" | "NORTHWEST" | "NORTHEAST" | "SOUTHWEST" | "SOUTHEAST";
9
+ width?: number;
10
+ height?: number;
11
+ x?: number;
12
+ y?: number;
13
+ }): number;
14
+ export declare function generateImageUrl({ src, width }: {
15
+ src: string;
16
+ width: number;
17
+ }, aspectRatio: number): string;
18
+ //# sourceMappingURL=image.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.utils.d.ts","sourceRoot":"","sources":["../../src/image/image.utils.ts"],"names":[],"mappings":"AACA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAkB/D;AAGD,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAGD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,eAAe,CAcpG;AAGD,wBAAgB,2BAA2B,CACvC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE;IACN,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,GACF,MAAM,CAUR;AAED,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAE5G"}
@@ -0,0 +1,53 @@
1
+ function parseAspectRatio(value) {
2
+ let width, height;
3
+ if (typeof value === "string") {
4
+ [width, height] = value.split(/[x/:]/).map((v) => {
5
+ let ret = parseFloat(v);
6
+ if (isNaN(ret))
7
+ ret = void 0;
8
+ return ret;
9
+ });
10
+ if (width && !height) {
11
+ height = 1;
12
+ }
13
+ } else {
14
+ width = value;
15
+ height = 1;
16
+ }
17
+ if (!width || !height)
18
+ throw Error(`An error occurred while parsing the aspect ratio: ${value}`);
19
+ return width / height;
20
+ }
21
+ function getMaxDimensionsFromArea(area, aspectRatio) {
22
+ let width, height;
23
+ if (aspectRatio < 1) {
24
+ width = Math.min(area.height * aspectRatio, area.width);
25
+ height = width / aspectRatio;
26
+ } else {
27
+ height = Math.min(area.width / aspectRatio, area.height);
28
+ width = height * aspectRatio;
29
+ }
30
+ return {
31
+ width,
32
+ height
33
+ };
34
+ }
35
+ function calculateInheritAspectRatio(imageDimensions, cropArea) {
36
+ if (cropArea.focalPoint === "SMART") {
37
+ return imageDimensions.width / imageDimensions.height;
38
+ } else {
39
+ if (cropArea.width === void 0 || cropArea.height === void 0) {
40
+ throw new Error("Missing crop dimensions");
41
+ }
42
+ return cropArea.width * imageDimensions.width / 100 / (cropArea.height * imageDimensions.height / 100);
43
+ }
44
+ }
45
+ function generateImageUrl({ src, width }, aspectRatio) {
46
+ return src.replace("$resizeWidth", String(width)).replace("$resizeHeight", String(Math.ceil(width / aspectRatio)));
47
+ }
48
+ export {
49
+ calculateInheritAspectRatio,
50
+ generateImageUrl,
51
+ getMaxDimensionsFromArea,
52
+ parseAspectRatio
53
+ };
package/lib/index.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ export { type BlockLoader, type BlockLoaderDependencies, recursivelyLoadBlockData } from './blockLoader/blockLoader';
2
+ export { BlocksBlock } from './blocks/factories/BlocksBlock';
3
+ export { ListBlock } from './blocks/factories/ListBlock';
4
+ export { OneOfBlock } from './blocks/factories/OneOfBlock';
5
+ export { OptionalBlock } from './blocks/factories/OptionalBlock';
6
+ export type { SupportedBlocks } from './blocks/factories/types';
7
+ export { hasRichTextBlockContent } from './blocks/helpers/RichTextBlockHelper';
8
+ export { useIsElementInViewport } from './blocks/helpers/useIsElementInViewport';
9
+ export type { PropsWithData } from './blocks/PropsWithData';
10
+ export { SvgImageBlock } from './blocks/SvgImageBlock';
11
+ export { type CookieApi, CookieApiProvider, useCookieApi } from './cookies/CookieApiContext';
12
+ export { CookieSafe } from './cookies/CookieSafe';
13
+ export { useCookieBotCookieApi } from './cookies/useCookieBotCookieApi';
14
+ export { useLocalStorageCookieApi } from './cookies/useLocalStorageCookieApi';
15
+ export { useOneTrustCookieApi } from './cookies/useOneTrustCookieApi';
16
+ export { ErrorHandlerBoundary } from './errorHandler/ErrorHandlerBoundary';
17
+ export { ErrorHandlerProvider } from './errorHandler/ErrorHandlerProvider';
18
+ export { createFetchInMemoryCache } from './graphQLFetch/fetchInMemoryCache';
19
+ export { type GraphQLFetch, type PreviewData, convertPreviewDataToHeaders, createFetchWithDefaults, createFetchWithPreviewHeaders, createGraphQLFetch, gql, } from './graphQLFetch/graphQLFetch';
20
+ export { IFrameBridgeProvider } from './iframebridge/IFrameBridge';
21
+ export { IFrameMessageType } from './iframebridge/IFrameMessage';
22
+ export { Preview } from './iframebridge/Preview';
23
+ export { useBlockPreviewFetch } from './iframebridge/useBlockPreviewFetch';
24
+ export { useIFrameBridge } from './iframebridge/useIFrameBridge';
25
+ export { type WithPreviewProps, isWithPreviewPropsData, withPreview } from './iframebridge/withPreview';
26
+ export { Image } from './image/Image';
27
+ export { type ImageDimensions, calculateInheritAspectRatio, generateImageUrl, getMaxDimensionsFromArea, parseAspectRatio } from './image/image.utils';
28
+ export { BlockPreviewProvider } from './preview/BlockPreviewProvider';
29
+ export { PreviewContext } from './preview/PreviewContext';
30
+ export { usePreview } from './preview/usePreview';
31
+ export { PreviewSkeleton } from './previewskeleton/PreviewSkeleton';
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrH,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,6BAA6B,EAC7B,kBAAkB,EAClB,GAAG,GACN,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,KAAK,gBAAgB,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,KAAK,eAAe,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,69 @@
1
+ import { recursivelyLoadBlockData } from "./blockLoader/blockLoader.js";
2
+ import { BlocksBlock } from "./blocks/factories/BlocksBlock.js";
3
+ import { ListBlock } from "./blocks/factories/ListBlock.js";
4
+ import { OneOfBlock } from "./blocks/factories/OneOfBlock.js";
5
+ import { OptionalBlock } from "./blocks/factories/OptionalBlock.js";
6
+ import { hasRichTextBlockContent } from "./blocks/helpers/RichTextBlockHelper.js";
7
+ import { useIsElementInViewport } from "./blocks/helpers/useIsElementInViewport.js";
8
+ import { SvgImageBlock } from "./blocks/SvgImageBlock.js";
9
+ import { CookieApiProvider, useCookieApi } from "./cookies/CookieApiContext.js";
10
+ import { CookieSafe } from "./cookies/CookieSafe.js";
11
+ import { useCookieBotCookieApi } from "./cookies/useCookieBotCookieApi.js";
12
+ import { useLocalStorageCookieApi } from "./cookies/useLocalStorageCookieApi.js";
13
+ import { useOneTrustCookieApi } from "./cookies/useOneTrustCookieApi.js";
14
+ import { ErrorHandlerBoundary } from "./errorHandler/ErrorHandlerBoundary.js";
15
+ import { ErrorHandlerProvider } from "./errorHandler/ErrorHandlerProvider.js";
16
+ import { createFetchInMemoryCache } from "./graphQLFetch/fetchInMemoryCache.js";
17
+ import { convertPreviewDataToHeaders, createFetchWithDefaults, createFetchWithPreviewHeaders, createGraphQLFetch, gql } from "./graphQLFetch/graphQLFetch.js";
18
+ import { IFrameBridgeProvider } from "./iframebridge/IFrameBridge.js";
19
+ import { IFrameMessageType } from "./iframebridge/IFrameMessage.js";
20
+ import { Preview } from "./iframebridge/Preview.js";
21
+ import { useBlockPreviewFetch } from "./iframebridge/useBlockPreviewFetch.js";
22
+ import { useIFrameBridge } from "./iframebridge/useIFrameBridge.js";
23
+ import { isWithPreviewPropsData, withPreview } from "./iframebridge/withPreview.js";
24
+ import { Image } from "./image/Image.js";
25
+ import { calculateInheritAspectRatio, generateImageUrl, getMaxDimensionsFromArea, parseAspectRatio } from "./image/image.utils.js";
26
+ import { BlockPreviewProvider } from "./preview/BlockPreviewProvider.js";
27
+ import { PreviewContext } from "./preview/PreviewContext.js";
28
+ import { usePreview } from "./preview/usePreview.js";
29
+ import { PreviewSkeleton } from "./previewskeleton/PreviewSkeleton.js";
30
+ export {
31
+ BlockPreviewProvider,
32
+ BlocksBlock,
33
+ CookieApiProvider,
34
+ CookieSafe,
35
+ ErrorHandlerBoundary,
36
+ ErrorHandlerProvider,
37
+ IFrameBridgeProvider,
38
+ IFrameMessageType,
39
+ Image,
40
+ ListBlock,
41
+ OneOfBlock,
42
+ OptionalBlock,
43
+ Preview,
44
+ PreviewContext,
45
+ PreviewSkeleton,
46
+ SvgImageBlock,
47
+ calculateInheritAspectRatio,
48
+ convertPreviewDataToHeaders,
49
+ createFetchInMemoryCache,
50
+ createFetchWithDefaults,
51
+ createFetchWithPreviewHeaders,
52
+ createGraphQLFetch,
53
+ generateImageUrl,
54
+ getMaxDimensionsFromArea,
55
+ gql,
56
+ hasRichTextBlockContent,
57
+ isWithPreviewPropsData,
58
+ parseAspectRatio,
59
+ recursivelyLoadBlockData,
60
+ useBlockPreviewFetch,
61
+ useCookieApi,
62
+ useCookieBotCookieApi,
63
+ useIFrameBridge,
64
+ useIsElementInViewport,
65
+ useLocalStorageCookieApi,
66
+ useOneTrustCookieApi,
67
+ usePreview,
68
+ withPreview
69
+ };
@@ -0,0 +1,3 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export declare const BlockPreviewProvider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=BlockPreviewProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockPreviewProvider.d.ts","sourceRoot":"","sources":["../../src/preview/BlockPreviewProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,oBAAoB,iBAAkB,iBAAiB,4CAWnE,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { PreviewContext } from "./PreviewContext.js";
4
+ const BlockPreviewProvider = ({ children }) => {
5
+ return /* @__PURE__ */ jsx(
6
+ PreviewContext.Provider,
7
+ {
8
+ value: {
9
+ previewType: "BlockPreview",
10
+ showPreviewSkeletons: true
11
+ },
12
+ children
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ BlockPreviewProvider
18
+ };
@@ -0,0 +1,9 @@
1
+ import { UrlObject } from 'url';
2
+ export type Url = string | UrlObject;
3
+ export interface PreviewContextOptions {
4
+ previewType: "SitePreview" | "BlockPreview" | "NoPreview";
5
+ showPreviewSkeletons: boolean;
6
+ }
7
+ export declare const defaultPreviewContextValue: PreviewContextOptions;
8
+ export declare const PreviewContext: import('react').Context<PreviewContextOptions>;
9
+ //# sourceMappingURL=PreviewContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewContext.d.ts","sourceRoot":"","sources":["../../src/preview/PreviewContext.tsx"],"names":[],"mappings":";;AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;AAErC,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,aAAa,GAAG,cAAc,GAAG,WAAW,CAAC;IAC1D,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,0BAA0B,EAAE,qBAGxC,CAAC;AAEF,eAAO,MAAM,cAAc,gDAAmE,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { createContext } from "react";
3
+ const defaultPreviewContextValue = {
4
+ previewType: "NoPreview",
5
+ showPreviewSkeletons: false
6
+ };
7
+ const PreviewContext = createContext(defaultPreviewContextValue);
8
+ export {
9
+ PreviewContext,
10
+ defaultPreviewContextValue
11
+ };
@@ -0,0 +1,11 @@
1
+ import { PreviewContextOptions } from './PreviewContext';
2
+ export interface PreviewHookReturn extends PreviewContextOptions {
3
+ isSelected: (url: string, options?: {
4
+ exactMatch?: boolean;
5
+ }) => boolean;
6
+ isHovered: (url: string, options?: {
7
+ exactMatch?: boolean;
8
+ }) => boolean;
9
+ }
10
+ export declare function usePreview(): PreviewHookReturn;
11
+ //# sourceMappingURL=usePreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePreview.d.ts","sourceRoot":"","sources":["../../src/preview/usePreview.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAE9E,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC5D,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC;IACzE,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC;CAC3E;AAED,wBAAgB,UAAU,IAAI,iBAAiB,CAqC9C"}
@@ -0,0 +1,41 @@
1
+ import { useContext, useCallback } from "react";
2
+ import { useIFrameBridge } from "../iframebridge/useIFrameBridge.js";
3
+ import { PreviewContext } from "./PreviewContext.js";
4
+ function usePreview() {
5
+ const iFrameBridge = useIFrameBridge();
6
+ const previewContext = useContext(PreviewContext);
7
+ const isSelected = useCallback(
8
+ (url, options) => {
9
+ var _a;
10
+ if (!iFrameBridge.selectedAdminRoute) {
11
+ return false;
12
+ }
13
+ const exactMatch = (options == null ? void 0 : options.exactMatch) ?? true;
14
+ if (exactMatch) {
15
+ return url === iFrameBridge.selectedAdminRoute;
16
+ } else {
17
+ return (_a = iFrameBridge.selectedAdminRoute) == null ? void 0 : _a.startsWith(url);
18
+ }
19
+ },
20
+ [iFrameBridge.selectedAdminRoute]
21
+ );
22
+ const isHovered = useCallback(
23
+ (url, options) => {
24
+ var _a;
25
+ if (!iFrameBridge.hoveredAdminRoute) {
26
+ return false;
27
+ }
28
+ const exactMatch = (options == null ? void 0 : options.exactMatch) ?? true;
29
+ if (exactMatch) {
30
+ return url === iFrameBridge.hoveredAdminRoute;
31
+ } else {
32
+ return (_a = iFrameBridge.hoveredAdminRoute) == null ? void 0 : _a.startsWith(url);
33
+ }
34
+ },
35
+ [iFrameBridge.hoveredAdminRoute]
36
+ );
37
+ return { ...previewContext, isSelected, isHovered };
38
+ }
39
+ export {
40
+ usePreview
41
+ };
@@ -0,0 +1,14 @@
1
+ import { PropsWithChildren, ReactNode } from 'react';
2
+ interface SkeletonProps extends PropsWithChildren {
3
+ type?: "bar" | "rows" | "media";
4
+ aspectRatio?: string | number;
5
+ height?: string | number;
6
+ hasContent: boolean;
7
+ backgroundColor?: string;
8
+ color?: string;
9
+ title?: ReactNode;
10
+ customContainer?: ReactNode;
11
+ }
12
+ declare const PreviewSkeleton: ({ children, customContainer, title, type, aspectRatio, height: passedHeight, hasContent, color, backgroundColor, }: SkeletonProps) => import("react/jsx-runtime").JSX.Element | null;
13
+ export { PreviewSkeleton };
14
+ //# sourceMappingURL=PreviewSkeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewSkeleton.d.ts","sourceRoot":"","sources":["../../src/previewskeleton/PreviewSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK/D,UAAU,aAAc,SAAQ,iBAAiB;IAC7C,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,eAAe,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED,QAAA,MAAM,eAAe,uHAUlB,aAAa,mDA+Cf,CAAC;AAsBF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
+ import { usePreview } from "../preview/usePreview.js";
4
+ import styles from "./PreviewSkeleton.module.scss.js";
5
+ const PreviewSkeleton = ({
6
+ children,
7
+ customContainer,
8
+ title,
9
+ type = "bar",
10
+ aspectRatio,
11
+ height: passedHeight,
12
+ hasContent,
13
+ color = "#A8A7A8",
14
+ backgroundColor = type === "media" ? "#efefef" : "#E0DDE0"
15
+ }) => {
16
+ const preview = usePreview();
17
+ const validAspectRatio = getValidAspectRatio(aspectRatio);
18
+ if (preview.showPreviewSkeletons && !hasContent) {
19
+ if (customContainer) {
20
+ return /* @__PURE__ */ jsx(Fragment, { children: customContainer });
21
+ } else if (type === "bar") {
22
+ return /* @__PURE__ */ jsx("div", { className: styles.barSkeleton, style: { "--background-color": backgroundColor, "--color": color }, children: title });
23
+ } else if (type === "rows") {
24
+ return /* @__PURE__ */ jsxs("div", { className: styles.rowsContainer, children: [
25
+ /* @__PURE__ */ jsx("div", { className: styles.rowSkeleton, style: { "--width": "75%", "--background-color": backgroundColor, "--color": color }, children: title }),
26
+ /* @__PURE__ */ jsx("div", { className: styles.rowSkeleton, style: { "--width": "100%", "--background-color": backgroundColor, "--color": color } }),
27
+ /* @__PURE__ */ jsx("div", { className: styles.rowSkeleton, style: { "--width": "50%", "--background-color": backgroundColor, "--color": color } })
28
+ ] });
29
+ } else if (type === "media") {
30
+ const height = passedHeight ?? 300;
31
+ return /* @__PURE__ */ jsx(
32
+ "div",
33
+ {
34
+ className: styles.imageContainer,
35
+ style: {
36
+ "--background-color": backgroundColor,
37
+ "--color": color,
38
+ ...validAspectRatio === void 0 ? { "--height": typeof height === "string" ? height : `${height}px` } : { "--aspect-ratio": validAspectRatio }
39
+ },
40
+ children: title
41
+ }
42
+ );
43
+ }
44
+ }
45
+ if (!hasContent) {
46
+ return null;
47
+ }
48
+ return /* @__PURE__ */ jsx(Fragment, { children });
49
+ };
50
+ const getValidAspectRatio = (aspectRatio) => {
51
+ if (aspectRatio === "inherit") {
52
+ return void 0;
53
+ }
54
+ if (aspectRatio === "auto") {
55
+ return void 0;
56
+ }
57
+ if (typeof aspectRatio === "string") {
58
+ return aspectRatio.replace("x", "/");
59
+ }
60
+ return aspectRatio;
61
+ };
62
+ export {
63
+ PreviewSkeleton
64
+ };
@@ -0,0 +1,17 @@
1
+ const barSkeleton = "_barSkeleton_zomv4_1";
2
+ const rowsContainer = "_rowsContainer_zomv4_9";
3
+ const rowSkeleton = "_rowSkeleton_zomv4_14";
4
+ const imageContainer = "_imageContainer_zomv4_22";
5
+ const styles = {
6
+ barSkeleton,
7
+ rowsContainer,
8
+ rowSkeleton,
9
+ imageContainer
10
+ };
11
+ export {
12
+ barSkeleton,
13
+ styles as default,
14
+ imageContainer,
15
+ rowSkeleton,
16
+ rowsContainer
17
+ };
package/lib/style.css ADDED
@@ -0,0 +1 @@
1
+ ._childrenWrapper_qguhx_1{position:relative;z-index:1}._previewElementContainer_nwhl6_1{display:contents}._barSkeleton_zomv4_1{min-height:20px;margin-bottom:5px;margin-right:5px;background-color:var(--background-color);color:var(--color)}._rowsContainer_zomv4_9{width:100%;min-width:300px}._rowSkeleton_zomv4_14{margin-bottom:10px;min-height:20px;width:var(--width);background-color:var(--background-color);color:var(--color)}._imageContainer_zomv4_22{width:100%;aspect-ratio:var(--aspect-ratio);height:var(--height);background-color:var(--background-color);color:var(--color)}._root_v4248_1{position:absolute;z-index:2;top:0;left:0;right:0;min-height:100vh;height:var(--height)}._root_1ya0k_1{position:absolute;cursor:pointer;outline:1px solid transparent;outline-offset:-1px}._root_1ya0k_1:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;opacity:.25}._root_1ya0k_1:hover{outline-color:#29b6f6;outline-style:solid}._root_1ya0k_1:hover:after{background-color:#29b6f6}._isHoveredInBlockList_1ya0k_24{outline-color:#29b6f6;outline-style:solid}._isHoveredInBlockList_1ya0k_24:after{background-color:#29b6f6}._showBlockOutlines_1ya0k_32:not(:hover){outline-color:#d9d9d9;outline-style:dashed}._blockIsSelected_1ya0k_37{outline-color:#29b6f6}._blockIsSelected_1ya0k_37 ._label_1ya0k_40{display:inline-block}._label_1ya0k_40{position:absolute;padding:2px;background-color:#57b0eb;line-height:16px;color:#fff;top:1px;right:1px;font-size:12px;display:none}
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@comet/site-react",
3
+ "type": "module",
4
+ "version": "7.21.0-canary-20250522145352",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/vivid-planet/comet",
8
+ "directory": "packages/site/site-react"
9
+ },
10
+ "license": "BSD-2-Clause",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./lib/index.d.ts",
14
+ "import": "./lib/index.js"
15
+ },
16
+ "./css": "./lib/style.css"
17
+ },
18
+ "module": "./lib/index.js",
19
+ "types": "lib/index.d.ts",
20
+ "files": [
21
+ "lib/*"
22
+ ],
23
+ "dependencies": {
24
+ "clsx": "^2.1.1",
25
+ "jose": "^5.2.4",
26
+ "lodash.isequal": "^4.5.0",
27
+ "rimraf": "^3.0.0",
28
+ "scroll-into-view-if-needed": "^2.0.0",
29
+ "server-only": "^0.0.1",
30
+ "usehooks-ts": "^3.1.0"
31
+ },
32
+ "devDependencies": {
33
+ "@comet/cli": "7.21.0-canary-20250522145352",
34
+ "@comet/eslint-config": "7.21.0-canary-20250522145352",
35
+ "@gitbeaker/node": "^34.0.0",
36
+ "@types/draft-js": "^0.11.10",
37
+ "@types/jest": "^29.5.0",
38
+ "@types/lodash.isequal": "^4.5.8",
39
+ "@types/react": "^18.3.18",
40
+ "@types/react-dom": "^18.3.5",
41
+ "@vitejs/plugin-react": "^4.4.1",
42
+ "chokidar-cli": "^2.0.0",
43
+ "eslint": "^8.0.0",
44
+ "jest": "^29.5.0",
45
+ "jest-environment-jsdom": "^29.5.0",
46
+ "jest-junit": "^15.0.0",
47
+ "npm-run-all": "^4.1.5",
48
+ "prettier": "^2.0.0",
49
+ "react": "^18.3.1",
50
+ "react-dom": "^18.3.1",
51
+ "react-is": "^18.3.1",
52
+ "rollup": "^4.40.2",
53
+ "rollup-plugin-preserve-directives": "^0.4.0",
54
+ "sass": "^1.87.0",
55
+ "ts-jest": "^29.0.5",
56
+ "typescript": "^4.0.0",
57
+ "vite": "^5.1.6",
58
+ "vite-plugin-dts": "^4.5.3"
59
+ },
60
+ "peerDependencies": {
61
+ "react": "^18.0.0",
62
+ "react-dom": "^18.0.0"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public",
66
+ "registry": "https://registry.npmjs.org"
67
+ },
68
+ "engines": {
69
+ "node": ">=18.0.0"
70
+ },
71
+ "scripts": {
72
+ "build": "$npm_execpath run clean && npm run generate-block-types && vite build",
73
+ "clean": "rimraf lib 'src/**/*.generated.ts'",
74
+ "dev": "$npm_execpath run clean && $npm_execpath generate-block-types && vite build --watch",
75
+ "generate-block-types": "comet generate-block-types",
76
+ "generate-block-types:watch": "chokidar -s \"block-meta.json\" -c \"$npm_execpath generate-block-types\"",
77
+ "lint": "$npm_execpath generate-block-types && run-p lint:prettier lint:eslint lint:tsc",
78
+ "lint:eslint": "eslint --max-warnings 0 --ext .ts,.tsx,.js,.jsx,.json,.md src/ package.json",
79
+ "lint:prettier": "npx prettier --check './**/*.{js,json,md,yml,yaml,css,scss}'",
80
+ "lint:tsc": "tsc --noEmit",
81
+ "test": "jest --verbose=true --passWithNoTests",
82
+ "test:watch": "jest --watch"
83
+ }
84
+ }