@makeswift/runtime 0.0.0-20230109233611 → 0.0.0-20230110205857

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/Box.cjs.js CHANGED
@@ -35,8 +35,8 @@ var React = require("react");
35
35
  var css = require("@emotion/css");
36
36
  var next = require("./index.cjs.js");
37
37
  var jsxRuntime = require("react/jsx-runtime");
38
- var gridItem = require("./grid-item.cjs.js");
39
38
  var boxModels = require("./box-models.cjs.js");
39
+ var gridItem = require("./grid-item.cjs.js");
40
40
  var uuid = require("uuid");
41
41
  require("use-sync-external-store/shim/with-selector");
42
42
  require("./react-page.cjs.js");
@@ -64,10 +64,10 @@ require("http-proxy");
64
64
  require("set-cookie-parser");
65
65
  require("uuid/v4");
66
66
  require("corporate-ipsum");
67
+ require("css-box-model");
67
68
  require("next/image");
68
69
  require("react-player");
69
70
  require("./useMediaQuery.cjs.js");
70
- require("css-box-model");
71
71
  var Placeholder = React.forwardRef(function Placeholder2(_a, ref) {
72
72
  var _b = _a, {
73
73
  hide = false
@@ -172,13 +172,37 @@ const Box = React.forwardRef(function Box2({
172
172
  alignItems
173
173
  })));
174
174
  const key = React.useMemo(() => uuid.v4(), [boxAnimateType, boxAnimateDuration, boxAnimateDelay, itemAnimateType, itemAnimateDuration, itemAnimateDelay, itemStaggerDuration]);
175
- const {
176
- isEntered,
177
- resetEntered
178
- } = gridItem.useIsEntered(boxElement);
175
+ const observerRef = React.useRef(null);
179
176
  React.useEffect(() => {
180
- resetEntered();
181
- }, [boxAnimateType, boxAnimateDuration, boxAnimateDelay, itemAnimateType, itemAnimateDuration, itemAnimateDelay, itemStaggerDuration]);
177
+ var _a;
178
+ if (boxElement) {
179
+ if (observerRef.current == null) {
180
+ observerRef.current = new IntersectionObserver(function intersectionCallback([entry]) {
181
+ if (entry.isIntersecting) {
182
+ entry.target.classList.add("show");
183
+ }
184
+ }, {
185
+ root: null,
186
+ rootMargin: `0px 0px -10% 0px`,
187
+ threshold: 0.2
188
+ });
189
+ }
190
+ observerRef.current.observe(boxElement);
191
+ } else {
192
+ (_a = observerRef.current) == null ? void 0 : _a.disconnect();
193
+ observerRef.current = null;
194
+ }
195
+ return () => {
196
+ var _a2;
197
+ if (boxElement)
198
+ (_a2 = observerRef.current) == null ? void 0 : _a2.unobserve(boxElement);
199
+ };
200
+ }, [boxElement]);
201
+ React.useEffect(() => {
202
+ boxElement == null ? void 0 : boxElement.classList.remove("show");
203
+ const timeout = setTimeout(() => boxElement == null ? void 0 : boxElement.classList.add("show"), 100);
204
+ return () => clearTimeout(timeout);
205
+ }, [key]);
182
206
  return /* @__PURE__ */ jsxRuntime.jsx(gridItem.BackgroundsContainer, {
183
207
  ref: setBoxElement,
184
208
  id,
@@ -190,7 +214,7 @@ const Box = React.forwardRef(function Box2({
190
214
  boxAnimateType,
191
215
  boxAnimateDuration,
192
216
  boxAnimateDelay,
193
- isEntered,
217
+ itemAnimationType: itemAnimateType,
194
218
  backgrounds,
195
219
  children: /* @__PURE__ */ jsxRuntime.jsx("div", {
196
220
  ref: innerRef,
@@ -209,7 +233,6 @@ const Box = React.forwardRef(function Box2({
209
233
  itemAnimateDuration,
210
234
  itemAnimateDelay,
211
235
  itemStaggerDuration,
212
- isEntered,
213
236
  columnGap,
214
237
  rowGap,
215
238
  children: /* @__PURE__ */ jsxRuntime.jsx(next.Element, {
@@ -218,8 +241,8 @@ const Box = React.forwardRef(function Box2({
218
241
  }, child.key)) : /* @__PURE__ */ jsxRuntime.jsx(Placeholder, {
219
242
  hide: hidePlaceholder
220
243
  })
221
- })
222
- }, key);
244
+ }, key)
245
+ });
223
246
  });
224
247
  exports["default"] = Box;
225
248
  //# sourceMappingURL=Box.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Box.cjs.js","sources":["../src/components/builtin/Box/components/Placeholder/index.tsx","../src/components/builtin/Box/Box.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\ntype Props = { hide?: boolean }\n\nexport default forwardRef(function Placeholder(\n { hide = false, ...restOfProps }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n style={{ visibility: hide ? 'hidden' : 'initial' }}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n height: 80,\n padding: 8,\n })}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n style={{ overflow: 'visible' }}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n </svg>\n </div>\n )\n})\n","import { forwardRef, Ref, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { useIsEntered } from './animations'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n GridValue,\n GapYValue,\n GapXValue,\n CheckboxValue,\n ResponsiveSelectValue,\n ResponsiveNumberValue,\n BackgroundsValue,\n} from '../../../prop-controllers/descriptors'\nimport { BoxModelHandle, parse, createBox } from '../../../box-model'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { BoxAnimateIn } from './constants'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { v4 } from 'uuid'\n\ntype Props = {\n id?: ElementIDValue\n backgrounds?: BackgroundsValue\n width?: string\n height?: ResponsiveIconRadioGroupValue<'auto' | 'stretch'>\n verticalAlign?: ResponsiveIconRadioGroupValue<\n 'flex-start' | 'center' | 'flex-end' | 'space-between'\n >\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n rowGap?: GapYValue\n columnGap?: GapXValue\n boxAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n boxAnimateDuration?: ResponsiveNumberValue\n boxAnimateDelay?: ResponsiveNumberValue\n itemAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n itemAnimateDuration?: ResponsiveNumberValue\n itemAnimateDelay?: ResponsiveNumberValue\n itemStaggerDuration?: ResponsiveNumberValue\n hidePlaceholder?: CheckboxValue\n children?: GridValue\n}\n\nconst Box = forwardRef(function Box(\n {\n id,\n backgrounds,\n width,\n height,\n margin,\n padding,\n border,\n children,\n borderRadius,\n boxShadow,\n rowGap,\n columnGap,\n hidePlaceholder,\n verticalAlign,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemStaggerDuration,\n }: Props,\n ref: Ref<BoxModelHandle>,\n) {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const [boxElement, setBoxElement] = useState<HTMLElement | null>(null)\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const paddingBoxElement = innerRef.current\n const borderBoxElement = innerRef.current\n const marginBoxElement = boxElement\n const borderBox = innerRef.current?.getBoundingClientRect()\n const paddingBoxComputedStyle =\n paddingBoxElement?.ownerDocument.defaultView?.getComputedStyle(paddingBoxElement)\n const borderBoxComputedStyle =\n borderBoxElement?.ownerDocument.defaultView?.getComputedStyle(borderBoxElement)\n const marginBoxComputedStyle =\n marginBoxElement?.ownerDocument.defaultView?.getComputedStyle(marginBoxElement)\n const padding = paddingBoxComputedStyle && {\n top: parse(paddingBoxComputedStyle.paddingTop),\n right: parse(paddingBoxComputedStyle.paddingRight),\n bottom: parse(paddingBoxComputedStyle.paddingBottom),\n left: parse(paddingBoxComputedStyle.paddingLeft),\n }\n const border = borderBoxComputedStyle && {\n top: parse(borderBoxComputedStyle.borderTopWidth),\n right: parse(borderBoxComputedStyle.borderRightWidth),\n bottom: parse(borderBoxComputedStyle.borderBottomWidth),\n left: parse(borderBoxComputedStyle.borderLeftWidth),\n }\n const margin = marginBoxComputedStyle && {\n top: parse(marginBoxComputedStyle.marginTop),\n right: parse(marginBoxComputedStyle.marginRight),\n bottom: parse(marginBoxComputedStyle.marginBottom),\n left: parse(marginBoxComputedStyle.marginLeft),\n }\n\n return borderBox ? createBox({ borderBox, padding, border, margin }) : null\n },\n }),\n [boxElement],\n )\n\n const gridItemClassName = useStyle(\n responsiveStyle([verticalAlign], ([alignItems = 'flex-start']) => ({ alignItems })),\n )\n\n const key = useMemo(\n () => v4(),\n [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ],\n )\n\n const { isEntered, resetEntered } = useIsEntered(boxElement)\n\n useEffect(() => {\n resetEntered()\n }, [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ])\n\n return (\n <BackgroundsContainer\n ref={setBoxElement}\n id={id}\n key={key}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(responsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n )}\n boxAnimateType={boxAnimateType}\n boxAnimateDuration={boxAnimateDuration}\n boxAnimateDelay={boxAnimateDelay}\n isEntered={isEntered}\n backgrounds={backgrounds}\n >\n <div\n ref={innerRef}\n className={cx(\n padding,\n boxShadow,\n border,\n useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' }),\n useStyle(\n responsiveStyle([verticalAlign], ([alignContent = 'flex-start']) => ({\n alignContent,\n })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n className={gridItemClassName}\n grid={children.columns}\n index={index}\n itemAnimateType={itemAnimateType}\n itemAnimateDuration={itemAnimateDuration}\n itemAnimateDelay={itemAnimateDelay}\n itemStaggerDuration={itemStaggerDuration}\n isEntered={isEntered}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder hide={hidePlaceholder} />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Box\n"],"names":["forwardRef","ref","hide","restOfProps","visibility","useStyle","width","background","height","padding","overflow","Box","id","backgrounds","margin","border","children","borderRadius","boxShadow","rowGap","columnGap","hidePlaceholder","verticalAlign","boxAnimateType","boxAnimateDuration","boxAnimateDelay","itemAnimateDelay","itemAnimateType","itemAnimateDuration","itemStaggerDuration","innerRef","useRef","boxElement","setBoxElement","useState","useImperativeHandle","getBoxModel","paddingBoxElement","current","borderBoxElement","marginBoxElement","borderBox","getBoundingClientRect","paddingBoxComputedStyle","ownerDocument","defaultView","getComputedStyle","borderBoxComputedStyle","marginBoxComputedStyle","top","parse","paddingTop","right","paddingRight","bottom","paddingBottom","left","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","marginTop","marginRight","marginBottom","marginLeft","createBox","gridItemClassName","responsiveStyle","alignItems","key","useMemo","v4","isEntered","resetEntered","useIsEntered","useEffect","BackgroundsContainer","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","GridItem","columns","Element"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAA,cAAeA,iBAAW,sBACxB,IACAC,KACA;AAFA,eAAEC;AAAAA,WAAO;AAAA,MAAT,IAAmBC,wBAAnB,IAAmBA;AAAAA,IAAjBD;AAAAA;AAGF,gFAEQC;IACJ;AAAA,IACA,OAAO;AAAA,MAAEC,YAAYF,OAAO,WAAW;AAAA,IAHzC;AAAA,IAIE,WAAWG,KAAAA,SAAS;AAAA,MAClBC,OAAO;AAAA,MACPC,YAAY;AAAA,MACZC,QAAQ;AAAA,MACRC,SAAS;AAAA,IAAA,CAJQ;AAAA,IAOnB,yCAAA,OAAA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AAuDH,CA3JqB;;"}
1
+ {"version":3,"file":"Box.cjs.js","sources":["../src/components/builtin/Box/components/Placeholder/index.tsx","../src/components/builtin/Box/Box.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\ntype Props = { hide?: boolean }\n\nexport default forwardRef(function Placeholder(\n { hide = false, ...restOfProps }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n style={{ visibility: hide ? 'hidden' : 'initial' }}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n height: 80,\n padding: 8,\n })}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n style={{ overflow: 'visible' }}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n </svg>\n </div>\n )\n})\n","import { forwardRef, Ref, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n GridValue,\n GapYValue,\n GapXValue,\n CheckboxValue,\n ResponsiveSelectValue,\n ResponsiveNumberValue,\n BackgroundsValue,\n} from '../../../prop-controllers/descriptors'\nimport { BoxModelHandle, parse, createBox } from '../../../box-model'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { BoxAnimateIn } from './constants'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { v4 } from 'uuid'\n\ntype Props = {\n id?: ElementIDValue\n backgrounds?: BackgroundsValue\n width?: string\n height?: ResponsiveIconRadioGroupValue<'auto' | 'stretch'>\n verticalAlign?: ResponsiveIconRadioGroupValue<\n 'flex-start' | 'center' | 'flex-end' | 'space-between'\n >\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n rowGap?: GapYValue\n columnGap?: GapXValue\n boxAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n boxAnimateDuration?: ResponsiveNumberValue\n boxAnimateDelay?: ResponsiveNumberValue\n itemAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n itemAnimateDuration?: ResponsiveNumberValue\n itemAnimateDelay?: ResponsiveNumberValue\n itemStaggerDuration?: ResponsiveNumberValue\n hidePlaceholder?: CheckboxValue\n children?: GridValue\n}\n\nconst Box = forwardRef(function Box(\n {\n id,\n backgrounds,\n width,\n height,\n margin,\n padding,\n border,\n children,\n borderRadius,\n boxShadow,\n rowGap,\n columnGap,\n hidePlaceholder,\n verticalAlign,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemStaggerDuration,\n }: Props,\n ref: Ref<BoxModelHandle>,\n) {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const [boxElement, setBoxElement] = useState<HTMLElement | null>(null)\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const paddingBoxElement = innerRef.current\n const borderBoxElement = innerRef.current\n const marginBoxElement = boxElement\n const borderBox = innerRef.current?.getBoundingClientRect()\n const paddingBoxComputedStyle =\n paddingBoxElement?.ownerDocument.defaultView?.getComputedStyle(paddingBoxElement)\n const borderBoxComputedStyle =\n borderBoxElement?.ownerDocument.defaultView?.getComputedStyle(borderBoxElement)\n const marginBoxComputedStyle =\n marginBoxElement?.ownerDocument.defaultView?.getComputedStyle(marginBoxElement)\n const padding = paddingBoxComputedStyle && {\n top: parse(paddingBoxComputedStyle.paddingTop),\n right: parse(paddingBoxComputedStyle.paddingRight),\n bottom: parse(paddingBoxComputedStyle.paddingBottom),\n left: parse(paddingBoxComputedStyle.paddingLeft),\n }\n const border = borderBoxComputedStyle && {\n top: parse(borderBoxComputedStyle.borderTopWidth),\n right: parse(borderBoxComputedStyle.borderRightWidth),\n bottom: parse(borderBoxComputedStyle.borderBottomWidth),\n left: parse(borderBoxComputedStyle.borderLeftWidth),\n }\n const margin = marginBoxComputedStyle && {\n top: parse(marginBoxComputedStyle.marginTop),\n right: parse(marginBoxComputedStyle.marginRight),\n bottom: parse(marginBoxComputedStyle.marginBottom),\n left: parse(marginBoxComputedStyle.marginLeft),\n }\n\n return borderBox ? createBox({ borderBox, padding, border, margin }) : null\n },\n }),\n [boxElement],\n )\n\n const gridItemClassName = useStyle(\n responsiveStyle([verticalAlign], ([alignItems = 'flex-start']) => ({ alignItems })),\n )\n\n const key = useMemo(\n () => v4(),\n [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ],\n )\n\n const observerRef = useRef<IntersectionObserver | null>(null)\n\n useEffect(() => {\n if (boxElement) {\n if (observerRef.current == null) {\n observerRef.current = new IntersectionObserver(\n function intersectionCallback([entry]: IntersectionObserverEntry[]) {\n if (entry.isIntersecting) {\n entry.target.classList.add('show')\n }\n },\n {\n root: null,\n rootMargin: `0px 0px -10% 0px`,\n threshold: 0.2,\n },\n )\n }\n observerRef.current.observe(boxElement)\n } else {\n observerRef.current?.disconnect()\n observerRef.current = null\n }\n\n return () => {\n if (boxElement) observerRef.current?.unobserve(boxElement)\n }\n }, [boxElement])\n\n useEffect(() => {\n boxElement?.classList.remove('show')\n const timeout = setTimeout(() => boxElement?.classList.add('show'), 100)\n return () => clearTimeout(timeout)\n }, [key])\n\n return (\n <BackgroundsContainer\n ref={setBoxElement}\n id={id}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(responsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n )}\n boxAnimateType={boxAnimateType}\n boxAnimateDuration={boxAnimateDuration}\n boxAnimateDelay={boxAnimateDelay}\n itemAnimationType={itemAnimateType}\n backgrounds={backgrounds}\n >\n <div\n ref={innerRef}\n key={key}\n className={cx(\n padding,\n boxShadow,\n border,\n useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' }),\n useStyle(\n responsiveStyle([verticalAlign], ([alignContent = 'flex-start']) => ({\n alignContent,\n })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n className={gridItemClassName}\n grid={children.columns}\n index={index}\n itemAnimateType={itemAnimateType}\n itemAnimateDuration={itemAnimateDuration}\n itemAnimateDelay={itemAnimateDelay}\n itemStaggerDuration={itemStaggerDuration}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder hide={hidePlaceholder} />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Box\n"],"names":["forwardRef","ref","hide","restOfProps","visibility","useStyle","width","background","height","padding","overflow","Box","id","backgrounds","margin","border","children","borderRadius","boxShadow","rowGap","columnGap","hidePlaceholder","verticalAlign","boxAnimateType","boxAnimateDuration","boxAnimateDelay","itemAnimateDelay","itemAnimateType","itemAnimateDuration","itemStaggerDuration","innerRef","useRef","boxElement","setBoxElement","useState","useImperativeHandle","getBoxModel","paddingBoxElement","current","borderBoxElement","marginBoxElement","borderBox","getBoundingClientRect","paddingBoxComputedStyle","ownerDocument","defaultView","getComputedStyle","borderBoxComputedStyle","marginBoxComputedStyle","top","parse","paddingTop","right","paddingRight","bottom","paddingBottom","left","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","marginTop","marginRight","marginBottom","marginLeft","createBox","gridItemClassName","responsiveStyle","alignItems","key","useMemo","v4","observerRef","useEffect","IntersectionObserver","entry","isIntersecting","target","classList","add","root","rootMargin","threshold","observe","disconnect","unobserve","remove","timeout","setTimeout","clearTimeout","BackgroundsContainer","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","GridItem","columns","Element"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAA,cAAeA,iBAAW,sBACxB,IACAC,KACA;AAFA,eAAEC;AAAAA,WAAO;AAAA,MAAT,IAAmBC,wBAAnB,IAAmBA;AAAAA,IAAjBD;AAAAA;AAGF,gFAEQC;IACJ;AAAA,IACA,OAAO;AAAA,MAAEC,YAAYF,OAAO,WAAW;AAAA,IAHzC;AAAA,IAIE,WAAWG,KAAAA,SAAS;AAAA,MAClBC,OAAO;AAAA,MACPC,YAAY;AAAA,MACZC,QAAQ;AAAA,MACRC,SAAS;AAAA,IAAA,CAJQ;AAAA,IAOnB,yCAAA,OAAA;AAAA,MACE,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,OAAO;AAAA,QAAEC,UAAU;AAAA,MAJrB;AAAA,MAME,yCAAA,QAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,OAAM;AAAA,QACN,QAAO;AAAA,QACP,aAAa;AAAA,QACb,iBAAgB;AAAA,QAChB,MAAK;AAAA,QACL,QAAO;AAAA,QACP,IAAG;AAAA,QACH,IAAG;AAAA,MAAA,CAVL;AAAA,IAAA,CANF;AAAA,EAAA,EAZJ;AAiCD,CArCwB;AC6CnBC,MAAAA,MAAMX,MAAAA,WAAW,cACrB;AAAA,EACEY;AAAAA,EACAC;AAAAA,EACAP;AAAAA,EACAE;AAAAA,EACAM;AAAAA,EACAL;AAAAA,EACAM;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,GAEF5B,KACA;AACM6B,QAAAA,WAAWC,aAA8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, useEffect }
33
33
  import { cx } from "@emotion/css";
34
34
  import { n as useStyle, r as responsiveStyle, E as Element } from "./index.es.js";
35
35
  import { jsx } from "react/jsx-runtime";
36
- import { a as useIsEntered, B as BackgroundsContainer, G as GridItem } from "./grid-item.es.js";
37
36
  import { p as parse, c as createBox } from "./box-models.es.js";
37
+ import { B as BackgroundsContainer, G as GridItem } from "./grid-item.es.js";
38
38
  import { v4 } from "uuid";
39
39
  import "use-sync-external-store/shim/with-selector";
40
40
  import "./react-page.es.js";
@@ -62,10 +62,10 @@ import "http-proxy";
62
62
  import "set-cookie-parser";
63
63
  import "uuid/v4";
64
64
  import "corporate-ipsum";
65
+ import "css-box-model";
65
66
  import "next/image";
66
67
  import "react-player";
67
68
  import "./useMediaQuery.es.js";
68
- import "css-box-model";
69
69
  var Placeholder = forwardRef(function Placeholder2(_a, ref) {
70
70
  var _b = _a, {
71
71
  hide = false
@@ -170,13 +170,37 @@ const Box = forwardRef(function Box2({
170
170
  alignItems
171
171
  })));
172
172
  const key = useMemo(() => v4(), [boxAnimateType, boxAnimateDuration, boxAnimateDelay, itemAnimateType, itemAnimateDuration, itemAnimateDelay, itemStaggerDuration]);
173
- const {
174
- isEntered,
175
- resetEntered
176
- } = useIsEntered(boxElement);
173
+ const observerRef = useRef(null);
177
174
  useEffect(() => {
178
- resetEntered();
179
- }, [boxAnimateType, boxAnimateDuration, boxAnimateDelay, itemAnimateType, itemAnimateDuration, itemAnimateDelay, itemStaggerDuration]);
175
+ var _a;
176
+ if (boxElement) {
177
+ if (observerRef.current == null) {
178
+ observerRef.current = new IntersectionObserver(function intersectionCallback([entry]) {
179
+ if (entry.isIntersecting) {
180
+ entry.target.classList.add("show");
181
+ }
182
+ }, {
183
+ root: null,
184
+ rootMargin: `0px 0px -10% 0px`,
185
+ threshold: 0.2
186
+ });
187
+ }
188
+ observerRef.current.observe(boxElement);
189
+ } else {
190
+ (_a = observerRef.current) == null ? void 0 : _a.disconnect();
191
+ observerRef.current = null;
192
+ }
193
+ return () => {
194
+ var _a2;
195
+ if (boxElement)
196
+ (_a2 = observerRef.current) == null ? void 0 : _a2.unobserve(boxElement);
197
+ };
198
+ }, [boxElement]);
199
+ useEffect(() => {
200
+ boxElement == null ? void 0 : boxElement.classList.remove("show");
201
+ const timeout = setTimeout(() => boxElement == null ? void 0 : boxElement.classList.add("show"), 100);
202
+ return () => clearTimeout(timeout);
203
+ }, [key]);
180
204
  return /* @__PURE__ */ jsx(BackgroundsContainer, {
181
205
  ref: setBoxElement,
182
206
  id,
@@ -188,7 +212,7 @@ const Box = forwardRef(function Box2({
188
212
  boxAnimateType,
189
213
  boxAnimateDuration,
190
214
  boxAnimateDelay,
191
- isEntered,
215
+ itemAnimationType: itemAnimateType,
192
216
  backgrounds,
193
217
  children: /* @__PURE__ */ jsx("div", {
194
218
  ref: innerRef,
@@ -207,7 +231,6 @@ const Box = forwardRef(function Box2({
207
231
  itemAnimateDuration,
208
232
  itemAnimateDelay,
209
233
  itemStaggerDuration,
210
- isEntered,
211
234
  columnGap,
212
235
  rowGap,
213
236
  children: /* @__PURE__ */ jsx(Element, {
@@ -216,8 +239,8 @@ const Box = forwardRef(function Box2({
216
239
  }, child.key)) : /* @__PURE__ */ jsx(Placeholder, {
217
240
  hide: hidePlaceholder
218
241
  })
219
- })
220
- }, key);
242
+ }, key)
243
+ });
221
244
  });
222
245
  export { Box as default };
223
246
  //# sourceMappingURL=Box.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Box.es.js","sources":["../src/components/builtin/Box/components/Placeholder/index.tsx","../src/components/builtin/Box/Box.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\ntype Props = { hide?: boolean }\n\nexport default forwardRef(function Placeholder(\n { hide = false, ...restOfProps }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n style={{ visibility: hide ? 'hidden' : 'initial' }}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n height: 80,\n padding: 8,\n })}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n style={{ overflow: 'visible' }}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n </svg>\n </div>\n )\n})\n","import { forwardRef, Ref, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { useIsEntered } from './animations'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n GridValue,\n GapYValue,\n GapXValue,\n CheckboxValue,\n ResponsiveSelectValue,\n ResponsiveNumberValue,\n BackgroundsValue,\n} from '../../../prop-controllers/descriptors'\nimport { BoxModelHandle, parse, createBox } from '../../../box-model'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { BoxAnimateIn } from './constants'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { v4 } from 'uuid'\n\ntype Props = {\n id?: ElementIDValue\n backgrounds?: BackgroundsValue\n width?: string\n height?: ResponsiveIconRadioGroupValue<'auto' | 'stretch'>\n verticalAlign?: ResponsiveIconRadioGroupValue<\n 'flex-start' | 'center' | 'flex-end' | 'space-between'\n >\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n rowGap?: GapYValue\n columnGap?: GapXValue\n boxAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n boxAnimateDuration?: ResponsiveNumberValue\n boxAnimateDelay?: ResponsiveNumberValue\n itemAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n itemAnimateDuration?: ResponsiveNumberValue\n itemAnimateDelay?: ResponsiveNumberValue\n itemStaggerDuration?: ResponsiveNumberValue\n hidePlaceholder?: CheckboxValue\n children?: GridValue\n}\n\nconst Box = forwardRef(function Box(\n {\n id,\n backgrounds,\n width,\n height,\n margin,\n padding,\n border,\n children,\n borderRadius,\n boxShadow,\n rowGap,\n columnGap,\n hidePlaceholder,\n verticalAlign,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemStaggerDuration,\n }: Props,\n ref: Ref<BoxModelHandle>,\n) {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const [boxElement, setBoxElement] = useState<HTMLElement | null>(null)\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const paddingBoxElement = innerRef.current\n const borderBoxElement = innerRef.current\n const marginBoxElement = boxElement\n const borderBox = innerRef.current?.getBoundingClientRect()\n const paddingBoxComputedStyle =\n paddingBoxElement?.ownerDocument.defaultView?.getComputedStyle(paddingBoxElement)\n const borderBoxComputedStyle =\n borderBoxElement?.ownerDocument.defaultView?.getComputedStyle(borderBoxElement)\n const marginBoxComputedStyle =\n marginBoxElement?.ownerDocument.defaultView?.getComputedStyle(marginBoxElement)\n const padding = paddingBoxComputedStyle && {\n top: parse(paddingBoxComputedStyle.paddingTop),\n right: parse(paddingBoxComputedStyle.paddingRight),\n bottom: parse(paddingBoxComputedStyle.paddingBottom),\n left: parse(paddingBoxComputedStyle.paddingLeft),\n }\n const border = borderBoxComputedStyle && {\n top: parse(borderBoxComputedStyle.borderTopWidth),\n right: parse(borderBoxComputedStyle.borderRightWidth),\n bottom: parse(borderBoxComputedStyle.borderBottomWidth),\n left: parse(borderBoxComputedStyle.borderLeftWidth),\n }\n const margin = marginBoxComputedStyle && {\n top: parse(marginBoxComputedStyle.marginTop),\n right: parse(marginBoxComputedStyle.marginRight),\n bottom: parse(marginBoxComputedStyle.marginBottom),\n left: parse(marginBoxComputedStyle.marginLeft),\n }\n\n return borderBox ? createBox({ borderBox, padding, border, margin }) : null\n },\n }),\n [boxElement],\n )\n\n const gridItemClassName = useStyle(\n responsiveStyle([verticalAlign], ([alignItems = 'flex-start']) => ({ alignItems })),\n )\n\n const key = useMemo(\n () => v4(),\n [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ],\n )\n\n const { isEntered, resetEntered } = useIsEntered(boxElement)\n\n useEffect(() => {\n resetEntered()\n }, [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ])\n\n return (\n <BackgroundsContainer\n ref={setBoxElement}\n id={id}\n key={key}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(responsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n )}\n boxAnimateType={boxAnimateType}\n boxAnimateDuration={boxAnimateDuration}\n boxAnimateDelay={boxAnimateDelay}\n isEntered={isEntered}\n backgrounds={backgrounds}\n >\n <div\n ref={innerRef}\n className={cx(\n padding,\n boxShadow,\n border,\n useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' }),\n useStyle(\n responsiveStyle([verticalAlign], ([alignContent = 'flex-start']) => ({\n alignContent,\n })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n className={gridItemClassName}\n grid={children.columns}\n index={index}\n itemAnimateType={itemAnimateType}\n itemAnimateDuration={itemAnimateDuration}\n itemAnimateDelay={itemAnimateDelay}\n itemStaggerDuration={itemStaggerDuration}\n isEntered={isEntered}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder hide={hidePlaceholder} />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Box\n"],"names":["forwardRef","ref","hide","restOfProps","visibility","useStyle","width","background","height","padding","overflow","Box","id","backgrounds","margin","border","children","borderRadius","boxShadow","rowGap","columnGap","hidePlaceholder","verticalAlign","boxAnimateType","boxAnimateDuration","boxAnimateDelay","itemAnimateDelay","itemAnimateType","itemAnimateDuration","itemStaggerDuration","innerRef","useRef","boxElement","setBoxElement","useState","useImperativeHandle","getBoxModel","paddingBoxElement","current","borderBoxElement","marginBoxElement","borderBox","getBoundingClientRect","paddingBoxComputedStyle","ownerDocument","defaultView","getComputedStyle","borderBoxComputedStyle","marginBoxComputedStyle","top","parse","paddingTop","right","paddingRight","bottom","paddingBottom","left","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","marginTop","marginRight","marginBottom","marginLeft","createBox","gridItemClassName","responsiveStyle","alignItems","key","useMemo","v4","isEntered","resetEntered","useIsEntered","useEffect","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","columns"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAA,cAAeA,WAAW,sBACxB,IACAC,KACA;AAFA,eAAEC;AAAAA,WAAO;AAAA,MAAT,IAAmBC,wBAAnB,IAAmBA;AAAAA,IAAjBD;AAAAA;AAGF,qEAEQC;IACJ;AAAA,IACA,OAAO;AAAA,MAAEC,YAAYF,OAAO,WAAW;AAAA,IAHzC;AAAA,IAIE,WAAWG,SAAS;AAAA,MAClBC,OAAO;AAAA,MACPC,YAAY;AAAA,MACZC,QAAQ;AAAA,MACRC,SAAS;AAAA,IAAA,CAJQ;AAAA,IAOnB,8BAAA,OAAA;AAAA,MACE,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,OAAO;AAAA,QAAEC,UAAU;AAAA,MAJrB;AAAA,MAME,8BAAA,QAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,OAAM;AAAA,QACN,QAAO;AAAA,QACP,aAAa;AAAA,QACb,iBA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G;AAAA,IAOb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,8BAAA,OAAA;AAAA,MACE,KAAKjD;AAAAA,MACL,WAAW+C,GACTpE,SACAS,WACAH,QACAV,SAAS;AAAA,QAAEyE,SAAS;AAAA,QAAQE,UAAU;AAAA,QAAQ1E,OAAO;AAAA,MAAA,CAA7C,GACRD,SACE+D,gBAAgB,CAAC9C,aAAD,GAAiB,CAAC,CAAC2D,eAAe,kBAAmB;AAAA,QACnEA;AAAAA,MAD+B,EAAlB,CADT,CALG;AAAA,MAYZjE,UAAAA,YAAYA,SAASkE,SAASC,SAAS,IACtCnE,SAASkE,SAASE,IAAI,CAACC,OAAOC,8BAC3B,UAAD;AAAA,QAEE,WAAWnB;AAAAA,QACX,MAAMnD,SAASuE;AAAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAXF,8BAaG,SAAD;AAAA,UAAS,SAASF;AAAAA,QAAAA,CAAlB;AAAA,SAZKA,MAAMf,GADb,CADF,wBAkBC,aAAD;AAAA,QAAa,MAAMjD;AAAAA,MAAAA,CAAnB;AAAA,IAAA,CAjCJ;AAAA,KAdKiD,GAHP;AAuDH,CA3JqB;;"}
1
+ {"version":3,"file":"Box.es.js","sources":["../src/components/builtin/Box/components/Placeholder/index.tsx","../src/components/builtin/Box/Box.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\ntype Props = { hide?: boolean }\n\nexport default forwardRef(function Placeholder(\n { hide = false, ...restOfProps }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n style={{ visibility: hide ? 'hidden' : 'initial' }}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n height: 80,\n padding: 8,\n })}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n style={{ overflow: 'visible' }}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n </svg>\n </div>\n )\n})\n","import { forwardRef, Ref, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n GridValue,\n GapYValue,\n GapXValue,\n CheckboxValue,\n ResponsiveSelectValue,\n ResponsiveNumberValue,\n BackgroundsValue,\n} from '../../../prop-controllers/descriptors'\nimport { BoxModelHandle, parse, createBox } from '../../../box-model'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { BoxAnimateIn } from './constants'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { v4 } from 'uuid'\n\ntype Props = {\n id?: ElementIDValue\n backgrounds?: BackgroundsValue\n width?: string\n height?: ResponsiveIconRadioGroupValue<'auto' | 'stretch'>\n verticalAlign?: ResponsiveIconRadioGroupValue<\n 'flex-start' | 'center' | 'flex-end' | 'space-between'\n >\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n rowGap?: GapYValue\n columnGap?: GapXValue\n boxAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n boxAnimateDuration?: ResponsiveNumberValue\n boxAnimateDelay?: ResponsiveNumberValue\n itemAnimateType?: ResponsiveSelectValue<BoxAnimateIn>\n itemAnimateDuration?: ResponsiveNumberValue\n itemAnimateDelay?: ResponsiveNumberValue\n itemStaggerDuration?: ResponsiveNumberValue\n hidePlaceholder?: CheckboxValue\n children?: GridValue\n}\n\nconst Box = forwardRef(function Box(\n {\n id,\n backgrounds,\n width,\n height,\n margin,\n padding,\n border,\n children,\n borderRadius,\n boxShadow,\n rowGap,\n columnGap,\n hidePlaceholder,\n verticalAlign,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemStaggerDuration,\n }: Props,\n ref: Ref<BoxModelHandle>,\n) {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const [boxElement, setBoxElement] = useState<HTMLElement | null>(null)\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const paddingBoxElement = innerRef.current\n const borderBoxElement = innerRef.current\n const marginBoxElement = boxElement\n const borderBox = innerRef.current?.getBoundingClientRect()\n const paddingBoxComputedStyle =\n paddingBoxElement?.ownerDocument.defaultView?.getComputedStyle(paddingBoxElement)\n const borderBoxComputedStyle =\n borderBoxElement?.ownerDocument.defaultView?.getComputedStyle(borderBoxElement)\n const marginBoxComputedStyle =\n marginBoxElement?.ownerDocument.defaultView?.getComputedStyle(marginBoxElement)\n const padding = paddingBoxComputedStyle && {\n top: parse(paddingBoxComputedStyle.paddingTop),\n right: parse(paddingBoxComputedStyle.paddingRight),\n bottom: parse(paddingBoxComputedStyle.paddingBottom),\n left: parse(paddingBoxComputedStyle.paddingLeft),\n }\n const border = borderBoxComputedStyle && {\n top: parse(borderBoxComputedStyle.borderTopWidth),\n right: parse(borderBoxComputedStyle.borderRightWidth),\n bottom: parse(borderBoxComputedStyle.borderBottomWidth),\n left: parse(borderBoxComputedStyle.borderLeftWidth),\n }\n const margin = marginBoxComputedStyle && {\n top: parse(marginBoxComputedStyle.marginTop),\n right: parse(marginBoxComputedStyle.marginRight),\n bottom: parse(marginBoxComputedStyle.marginBottom),\n left: parse(marginBoxComputedStyle.marginLeft),\n }\n\n return borderBox ? createBox({ borderBox, padding, border, margin }) : null\n },\n }),\n [boxElement],\n )\n\n const gridItemClassName = useStyle(\n responsiveStyle([verticalAlign], ([alignItems = 'flex-start']) => ({ alignItems })),\n )\n\n const key = useMemo(\n () => v4(),\n [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ],\n )\n\n const observerRef = useRef<IntersectionObserver | null>(null)\n\n useEffect(() => {\n if (boxElement) {\n if (observerRef.current == null) {\n observerRef.current = new IntersectionObserver(\n function intersectionCallback([entry]: IntersectionObserverEntry[]) {\n if (entry.isIntersecting) {\n entry.target.classList.add('show')\n }\n },\n {\n root: null,\n rootMargin: `0px 0px -10% 0px`,\n threshold: 0.2,\n },\n )\n }\n observerRef.current.observe(boxElement)\n } else {\n observerRef.current?.disconnect()\n observerRef.current = null\n }\n\n return () => {\n if (boxElement) observerRef.current?.unobserve(boxElement)\n }\n }, [boxElement])\n\n useEffect(() => {\n boxElement?.classList.remove('show')\n const timeout = setTimeout(() => boxElement?.classList.add('show'), 100)\n return () => clearTimeout(timeout)\n }, [key])\n\n return (\n <BackgroundsContainer\n ref={setBoxElement}\n id={id}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(responsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n )}\n boxAnimateType={boxAnimateType}\n boxAnimateDuration={boxAnimateDuration}\n boxAnimateDelay={boxAnimateDelay}\n itemAnimationType={itemAnimateType}\n backgrounds={backgrounds}\n >\n <div\n ref={innerRef}\n key={key}\n className={cx(\n padding,\n boxShadow,\n border,\n useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' }),\n useStyle(\n responsiveStyle([verticalAlign], ([alignContent = 'flex-start']) => ({\n alignContent,\n })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n className={gridItemClassName}\n grid={children.columns}\n index={index}\n itemAnimateType={itemAnimateType}\n itemAnimateDuration={itemAnimateDuration}\n itemAnimateDelay={itemAnimateDelay}\n itemStaggerDuration={itemStaggerDuration}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder hide={hidePlaceholder} />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Box\n"],"names":["forwardRef","ref","hide","restOfProps","visibility","useStyle","width","background","height","padding","overflow","Box","id","backgrounds","margin","border","children","borderRadius","boxShadow","rowGap","columnGap","hidePlaceholder","verticalAlign","boxAnimateType","boxAnimateDuration","boxAnimateDelay","itemAnimateDelay","itemAnimateType","itemAnimateDuration","itemStaggerDuration","innerRef","useRef","boxElement","setBoxElement","useState","useImperativeHandle","getBoxModel","paddingBoxElement","current","borderBoxElement","marginBoxElement","borderBox","getBoundingClientRect","paddingBoxComputedStyle","ownerDocument","defaultView","getComputedStyle","borderBoxComputedStyle","marginBoxComputedStyle","top","parse","paddingTop","right","paddingRight","bottom","paddingBottom","left","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","marginTop","marginRight","marginBottom","marginLeft","createBox","gridItemClassName","responsiveStyle","alignItems","key","useMemo","v4","observerRef","useEffect","IntersectionObserver","entry","isIntersecting","target","classList","add","root","rootMargin","threshold","observe","disconnect","unobserve","remove","timeout","setTimeout","clearTimeout","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","columns"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAA,cAAeA,WAAW,sBACxB,IACAC,KACA;AAFA,eAAEC;AAAAA,WAAO;AAAA,MAAT,IAAmBC,wBAAnB,IAAmBA;AAAAA,IAAjBD;AAAAA;AAGF,qEAEQC;IACJ;AAAA,IACA,OAAO;AAAA,MAAEC,YAAYF,OAAO,WAAW;AAAA,IAHzC;AAAA,IAIE,WAAWG,SAAS;AAAA,MAClBC,OAAO;AAAA,MACPC,YAAY;AAAA,MACZC,QAAQ;AAAA,MACRC,SAAS;AAAA,IAAA,CAJQ;AAAA,IAO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ADT,CALG;AAAA,MAYZ/E,UAAAA,YAAYA,SAASgF,SAASC,SAAS,IACtCjF,SAASgF,SAASE,IAAI,CAACC,OAAOC,8BAC3B,UAAD;AAAA,QAEE,WAAWjC;AAAAA,QACX,MAAMnD,SAASqF;AAAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAVF,8BAYG,SAAD;AAAA,UAAS,SAASF;AAAAA,QAAAA,CAAlB;AAAA,SAXKA,MAAM7B,GADb,CADF,wBAiBC,aAAD;AAAA,QAAa,MAAMjD;AAAAA,MAAAA,CAAnB;AAAA,OA/BGiD,GAFP;AAAA,EAAA,CAjBJ;AAuDD,CA/KqB;;"}
@@ -198,56 +198,44 @@ const enteredBoxAnimationProperties = {
198
198
  opacity: 1
199
199
  }
200
200
  };
201
- function useAnimation(responsiveAnimationType, responsiveDuration, responisveDelay, responsiveStagger, index) {
201
+ function useBoxAnimation(responsiveAnimationType, responsiveDuration, responisveDelay, itemResponsiveAnimationType) {
202
202
  const reducedMotion = usePrefersReducedMotion();
203
203
  const animationType = useMediaQuery.useMediaQuery(responsiveAnimationType) || next.DEFAULT_BOX_ANIMATE_TYPE;
204
+ const itemAnimationType = useMediaQuery.useMediaQuery(itemResponsiveAnimationType) || next.DEFAULT_ITEM_ANIMATE_TYPE;
205
+ const duration = useMediaQuery.useMediaQuery(responsiveDuration) || next.DEFAULT_BOX_ANIMATE_DURATION;
206
+ const delay = useMediaQuery.useMediaQuery(responisveDelay) || next.DEFAULT_BOX_ANIMATE_DELAY;
207
+ const actualDelay = delay * 1e3;
208
+ const actualDuration = duration * 1e3;
209
+ const className = next.useStyle(__spreadProps(__spreadValues({}, exitedBoxAnimationProperties[animationType]), {
210
+ transition: `all 0ms`,
211
+ "&.show": __spreadProps(__spreadValues({}, enteredBoxAnimationProperties[animationType]), {
212
+ transition: `transform ${actualDuration}ms cubic-bezier(0.16, 0.84, 0.44, 1) ${actualDelay}ms,filter ${actualDuration}ms cubic-bezier(0.16, 0.84, 0.44, 1) ${actualDelay}ms, opacity ${actualDuration}ms ease ${actualDelay}ms`
213
+ }),
214
+ "&:not(.show) > div > div": __spreadProps(__spreadValues({}, exitedBoxAnimationProperties[itemAnimationType]), {
215
+ transition: `all 0ms !important`
216
+ }),
217
+ "&.show > div > div": __spreadValues({}, enteredBoxAnimationProperties[itemAnimationType])
218
+ }));
219
+ if (reducedMotion) {
220
+ return "";
221
+ }
222
+ return className;
223
+ }
224
+ function useItemAnimation(responsiveDuration, responisveDelay, responsiveStagger, index) {
225
+ const reducedMotion = usePrefersReducedMotion();
204
226
  const duration = useMediaQuery.useMediaQuery(responsiveDuration) || next.DEFAULT_BOX_ANIMATE_DURATION;
205
227
  const delay = useMediaQuery.useMediaQuery(responisveDelay) || next.DEFAULT_BOX_ANIMATE_DELAY;
206
228
  const stagger = useMediaQuery.useMediaQuery(responsiveStagger) || next.DEFAULT_ITEM_STAGGER_DURATION;
207
229
  const delayFromStagger = responsiveStagger == null || index == null ? 0 : stagger * index;
208
230
  const actualDelay = (delay + delayFromStagger) * 1e3;
209
231
  const actualDuration = duration * 1e3;
210
- const exited = next.useStyle(__spreadProps(__spreadValues({}, exitedBoxAnimationProperties[animationType]), {
211
- transition: `all 0ms`
212
- }));
213
- const entered = next.useStyle(__spreadProps(__spreadValues({}, enteredBoxAnimationProperties[animationType]), {
214
- transition: `transform ${actualDuration}ms cubic-bezier(0.16, 0.84, 0.44, 1) ${actualDelay}ms,filter ${actualDuration}ms cubic-bezier(0.16, 0.84, 0.44, 1) ${actualDelay}ms, opacity ${actualDuration}ms ease ${actualDelay}ms`
215
- }));
216
- if (animationType === "none" || reducedMotion) {
217
- return {
218
- exited: "",
219
- entered: ""
220
- };
232
+ const className = next.useStyle({
233
+ transition: `transform ${actualDuration}ms cubic-bezier(0.16, 0.84, 0.44, 1) ${actualDelay}ms,filter ${actualDuration}ms cubic-bezier(0.16, 0.84, 0.44, 1) ${actualDelay}ms, opacity ${actualDuration}ms ease ${actualDelay}ms !important`
234
+ });
235
+ if (reducedMotion) {
236
+ return "";
221
237
  }
222
- return {
223
- exited,
224
- entered
225
- };
226
- }
227
- function useIsEntered(element) {
228
- const [isEntered, setEntered] = React.useState(false);
229
- React.useEffect(() => {
230
- const observer = new IntersectionObserver(intersectionCallback, {
231
- root: null,
232
- rootMargin: `0px 0px -10% 0px`,
233
- threshold: 0.2
234
- });
235
- if (element)
236
- observer.observe(element);
237
- return () => {
238
- if (element)
239
- observer.unobserve(element);
240
- };
241
- function intersectionCallback([entry]) {
242
- if (entry == null ? void 0 : entry.isIntersecting) {
243
- setEntered(true);
244
- }
245
- }
246
- }, [element]);
247
- return {
248
- isEntered,
249
- resetEntered: () => setEntered(false)
250
- };
238
+ return className;
251
239
  }
252
240
  const clamp = (min, val, max) => Math.min(Math.max(min, val), max);
253
241
  function isScrollable(element) {
@@ -672,7 +660,7 @@ var BackgroundsContainer = React.forwardRef(function BackgroundsContainer2(_e, r
672
660
  boxAnimateType,
673
661
  boxAnimateDuration,
674
662
  boxAnimateDelay,
675
- isEntered
663
+ itemAnimationType
676
664
  } = _f, restOfProps = __objRest(_f, [
677
665
  "backgrounds",
678
666
  "children",
@@ -680,14 +668,11 @@ var BackgroundsContainer = React.forwardRef(function BackgroundsContainer2(_e, r
680
668
  "boxAnimateType",
681
669
  "boxAnimateDuration",
682
670
  "boxAnimateDelay",
683
- "isEntered"
671
+ "itemAnimationType"
684
672
  ]);
685
673
  const [handle, setHandle] = React.useState(null);
686
674
  React.useImperativeHandle(ref, () => handle, [handle]);
687
- const {
688
- exited,
689
- entered
690
- } = useAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay);
675
+ const animationClassName = useBoxAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay, itemAnimationType);
691
676
  return /* @__PURE__ */ jsxRuntime.jsxs("div", __spreadProps(__spreadValues({}, restOfProps), {
692
677
  ref: setHandle,
693
678
  className: css.cx(next.useStyle({
@@ -701,7 +686,7 @@ var BackgroundsContainer = React.forwardRef(function BackgroundsContainer2(_e, r
701
686
  "> :last-child": {
702
687
  position: "relative"
703
688
  }
704
- }), className, exited, isEntered && entered),
689
+ }), className, animationClassName),
705
690
  children: [/* @__PURE__ */ jsxRuntime.jsx(Backgrounds, {
706
691
  backgrounds: useBackgrounds(backgrounds)
707
692
  }), React.Children.only(children)]
@@ -717,8 +702,7 @@ function GridItem(_g) {
717
702
  itemAnimateType,
718
703
  itemAnimateDuration,
719
704
  itemAnimateDelay,
720
- itemStaggerDuration,
721
- isEntered
705
+ itemStaggerDuration
722
706
  } = _h, restOfProps = __objRest(_h, [
723
707
  "grid",
724
708
  "index",
@@ -728,8 +712,7 @@ function GridItem(_g) {
728
712
  "itemAnimateType",
729
713
  "itemAnimateDuration",
730
714
  "itemAnimateDelay",
731
- "itemStaggerDuration",
732
- "isEntered"
715
+ "itemStaggerDuration"
733
716
  ]);
734
717
  const gridItemClassName = next.useStyle(next.responsiveGridItem({
735
718
  grid,
@@ -737,16 +720,12 @@ function GridItem(_g) {
737
720
  columnGap,
738
721
  rowGap
739
722
  }));
740
- const {
741
- entered,
742
- exited
743
- } = useAnimation(itemAnimateType, itemAnimateDuration, itemAnimateDelay, itemStaggerDuration, index);
723
+ const animationClassName = useItemAnimation(itemAnimateDuration, itemAnimateDelay, itemStaggerDuration, index);
744
724
  return /* @__PURE__ */ jsxRuntime.jsx("div", __spreadProps(__spreadValues({}, restOfProps), {
745
- className: css.cx(gridItemClassName, className, exited, isEntered && entered)
725
+ className: css.cx(gridItemClassName, className, animationClassName)
746
726
  }));
747
727
  }
748
728
  exports.BackgroundsContainer = BackgroundsContainer;
749
729
  exports.GridItem = GridItem;
750
730
  exports.useBackgrounds = useBackgrounds;
751
- exports.useIsEntered = useIsEntered;
752
731
  //# sourceMappingURL=grid-item.cjs.js.map