@makeswift/runtime 0.0.0-20230105221408 → 0.0.0-20230106212652
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 +43 -64
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +44 -65
- package/dist/Box.es.js.map +1 -1
- package/dist/Root.cjs.js +0 -1
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +0 -1
- package/dist/Root.es.js.map +1 -1
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +1 -1
- package/dist/grid-item.cjs.js +169 -137
- package/dist/grid-item.cjs.js.map +1 -1
- package/dist/grid-item.es.js +170 -140
- package/dist/grid-item.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/types/src/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/animations.d.ts +10 -60
- package/dist/types/src/components/builtin/Box/animations.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts +1 -254
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/grid-item.d.ts +5 -6
- package/dist/types/src/components/shared/grid-item.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/src/components/builtin/Box/useAnimation.d.ts +0 -11
- package/dist/types/src/components/builtin/Box/useAnimation.d.ts.map +0 -1
package/dist/Box.cjs.js
CHANGED
|
@@ -35,9 +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
|
-
require("framer-motion");
|
|
39
|
-
var boxModels = require("./box-models.cjs.js");
|
|
40
38
|
var gridItem = require("./grid-item.cjs.js");
|
|
39
|
+
var boxModels = require("./box-models.cjs.js");
|
|
41
40
|
require("use-sync-external-store/shim/with-selector");
|
|
42
41
|
require("./react-page.cjs.js");
|
|
43
42
|
require("redux");
|
|
@@ -65,10 +64,10 @@ require("http-proxy");
|
|
|
65
64
|
require("set-cookie-parser");
|
|
66
65
|
require("uuid/v4");
|
|
67
66
|
require("corporate-ipsum");
|
|
68
|
-
require("css-box-model");
|
|
69
67
|
require("next/image");
|
|
70
68
|
require("react-player");
|
|
71
69
|
require("./useMediaQuery.cjs.js");
|
|
70
|
+
require("css-box-model");
|
|
72
71
|
var Placeholder = React.forwardRef(function Placeholder2(_a, ref) {
|
|
73
72
|
var _b = _a, {
|
|
74
73
|
hide = false
|
|
@@ -108,24 +107,6 @@ var Placeholder = React.forwardRef(function Placeholder2(_a, ref) {
|
|
|
108
107
|
})
|
|
109
108
|
}));
|
|
110
109
|
});
|
|
111
|
-
const useElementOnScreen = (element, options) => {
|
|
112
|
-
const [isVisible, setIsVisible] = React.useState(false);
|
|
113
|
-
React.useEffect(() => {
|
|
114
|
-
const observer = new IntersectionObserver(intersectionCallback, options);
|
|
115
|
-
if (element)
|
|
116
|
-
observer.observe(element);
|
|
117
|
-
return () => {
|
|
118
|
-
if (element)
|
|
119
|
-
observer.unobserve(element);
|
|
120
|
-
};
|
|
121
|
-
function intersectionCallback([entry]) {
|
|
122
|
-
if (entry == null ? void 0 : entry.isIntersecting) {
|
|
123
|
-
setIsVisible(true);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}, [element, options]);
|
|
127
|
-
return isVisible;
|
|
128
|
-
};
|
|
129
110
|
const Box = React.forwardRef(function Box2({
|
|
130
111
|
id,
|
|
131
112
|
backgrounds,
|
|
@@ -151,7 +132,6 @@ const Box = React.forwardRef(function Box2({
|
|
|
151
132
|
}, ref) {
|
|
152
133
|
const innerRef = React.useRef(null);
|
|
153
134
|
const [boxElement, setBoxElement] = React.useState(null);
|
|
154
|
-
const hasBoxAnimation = boxAnimateType != null;
|
|
155
135
|
React.useImperativeHandle(ref, () => ({
|
|
156
136
|
getBoxModel() {
|
|
157
137
|
var _a, _b, _c, _d;
|
|
@@ -191,51 +171,50 @@ const Box = React.forwardRef(function Box2({
|
|
|
191
171
|
const gridItemClassName = next.useStyle(next.responsiveStyle([verticalAlign], ([alignItems = "flex-start"]) => ({
|
|
192
172
|
alignItems
|
|
193
173
|
})));
|
|
194
|
-
const isBoxVisible = useElementOnScreen(boxElement, {
|
|
195
|
-
root: null,
|
|
196
|
-
rootMargin: `0px 0px -10% 0px`,
|
|
197
|
-
threshold: 0.2
|
|
198
|
-
});
|
|
199
174
|
const {
|
|
200
|
-
|
|
201
|
-
|
|
175
|
+
exited,
|
|
176
|
+
entered
|
|
202
177
|
} = gridItem.useAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
index,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
178
|
+
const isEntered = gridItem.useIsEntered(boxElement, [boxAnimateType, boxAnimateDuration, boxAnimateDelay, itemAnimateType, itemAnimateDuration, itemAnimateDelay, itemStaggerDuration]);
|
|
179
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gridItem.EnteredContext.Provider, {
|
|
180
|
+
value: {
|
|
181
|
+
isEntered
|
|
182
|
+
},
|
|
183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gridItem.BackgroundsContainer, {
|
|
184
|
+
ref: setBoxElement,
|
|
185
|
+
id,
|
|
186
|
+
className: css.cx(width, margin, borderRadius, next.useStyle({
|
|
187
|
+
display: "flex"
|
|
188
|
+
}), next.useStyle(next.responsiveStyle([height], ([alignSelf = "auto"]) => ({
|
|
189
|
+
alignSelf
|
|
190
|
+
}))), exited, isEntered && entered),
|
|
191
|
+
backgrounds,
|
|
192
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
193
|
+
ref: innerRef,
|
|
194
|
+
className: css.cx(padding, boxShadow, border, next.useStyle({
|
|
195
|
+
display: "flex",
|
|
196
|
+
flexWrap: "wrap",
|
|
197
|
+
width: "100%"
|
|
198
|
+
}), next.useStyle(next.responsiveStyle([verticalAlign], ([alignContent = "flex-start"]) => ({
|
|
199
|
+
alignContent
|
|
200
|
+
})))),
|
|
201
|
+
children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(gridItem.GridItem, {
|
|
202
|
+
className: gridItemClassName,
|
|
203
|
+
grid: children.columns,
|
|
204
|
+
index,
|
|
205
|
+
itemAnimateType,
|
|
206
|
+
itemAnimateDuration,
|
|
207
|
+
itemAnimateDelay,
|
|
208
|
+
itemStaggerDuration,
|
|
209
|
+
isEntered,
|
|
210
|
+
columnGap,
|
|
211
|
+
rowGap,
|
|
212
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(next.Element, {
|
|
213
|
+
element: child
|
|
214
|
+
})
|
|
215
|
+
}, child.key)) : /* @__PURE__ */ jsxRuntime.jsx(Placeholder, {
|
|
216
|
+
hide: hidePlaceholder
|
|
236
217
|
})
|
|
237
|
-
}, child.key)) : /* @__PURE__ */ jsxRuntime.jsx(Placeholder, {
|
|
238
|
-
hide: hidePlaceholder
|
|
239
218
|
})
|
|
240
219
|
})
|
|
241
220
|
});
|
package/dist/Box.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.cjs.js","sources":["../src/components/builtin/Box/components/Placeholder/index.tsx","../src/components/builtin/Box/animations.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 {\n TargetAndTransition,\n Transition,\n useAnimation,\n useReducedMotion,\n Variants,\n MotionProps,\n} from 'framer-motion'\nimport { TransitionMap } from 'framer-motion/types/types'\nimport { useCallback, useEffect, useState } from 'react'\n\nimport { ResponsiveValue } from '../../../prop-controllers'\nimport { useMediaQuery } from '../../hooks'\nimport { Element } from '../../../state/react-page'\nimport {\n BoxAnimateIn,\n DEFAULT_BOX_ANIMATE_DELAY,\n DEFAULT_BOX_ANIMATE_DURATION,\n DEFAULT_BOX_ANIMATE_TYPE,\n DEFAULT_ITEM_ANIMATE_DELAY,\n DEFAULT_ITEM_ANIMATE_DURATION,\n DEFAULT_ITEM_ANIMATE_TYPE,\n DEFAULT_ITEM_STAGGER_DURATION,\n} from './constants'\n\nconst defaultExitedProps = {\n opacity: 0,\n x: 0,\n y: 0,\n scale: 1,\n}\n\ntype BoxAnimationVariants = {\n entered: TargetAndTransition\n exited: TargetAndTransition\n}\n\nexport const boxAnimations: {\n [key in BoxAnimateIn]: {\n transition: TransitionMap\n } & BoxAnimationVariants\n} = {\n none: {\n entered: {\n opacity: 1,\n },\n exited: {\n ...defaultExitedProps,\n opacity: 1,\n },\n transition: {},\n },\n fadeIn: {\n exited: defaultExitedProps,\n entered: {\n opacity: 1,\n },\n transition: {},\n },\n fadeLeft: {\n exited: {\n ...defaultExitedProps,\n x: 60,\n },\n entered: {\n opacity: 1,\n x: 0,\n },\n transition: {\n x: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n fadeRight: {\n exited: {\n ...defaultExitedProps,\n x: -60,\n },\n entered: {\n opacity: 1,\n x: 0,\n },\n transition: {\n x: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n fadeUp: {\n exited: {\n ...defaultExitedProps,\n y: 80,\n },\n entered: {\n opacity: 1,\n y: 0,\n },\n transition: {\n y: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n fadeDown: {\n exited: {\n ...defaultExitedProps,\n y: -80,\n },\n entered: {\n opacity: 1,\n y: 0,\n },\n transition: {\n y: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n blurIn: {\n exited: {\n ...defaultExitedProps,\n filter: 'blur(20px)',\n },\n entered: {\n opacity: 1,\n filter: 'blur(0px)',\n },\n transition: {},\n },\n scaleDown: {\n exited: {\n ...defaultExitedProps,\n scale: 1.2,\n },\n entered: {\n opacity: 1,\n scale: 1,\n },\n transition: {\n scale: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n scaleUp: {\n exited: {\n ...defaultExitedProps,\n scale: 0.75,\n },\n entered: {\n opacity: 1,\n scale: 1,\n },\n transition: {\n scale: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n}\n\nconst mergeCustomTransitionWithDefault = (\n transitions: TransitionMap,\n props: Transition,\n): TransitionMap | Transition =>\n transitions\n ? Object.keys(transitions).reduce(\n (a, c) => ({\n ...a,\n [c]: {\n ...transitions[c as string],\n ...props,\n },\n }),\n props,\n )\n : props\n\nexport type BoxAnimationType = {\n containerAnimationProps: {\n transition: Transition\n variants: Variants\n }\n parentAnimationProps: {\n transition: Transition\n }\n childAnimationProps: {\n transition: Transition\n variants: Variants\n }\n}\n\nexport const useElementOnScreen = (\n element: HTMLElement | null,\n options: IntersectionObserverInit,\n) => {\n const [isVisible, setIsVisible] = useState(false)\n\n useEffect(() => {\n const observer = new IntersectionObserver(intersectionCallback, options)\n\n if (element) observer.observe(element)\n\n return () => {\n if (element) observer.unobserve(element)\n }\n\n function intersectionCallback([entry]: IntersectionObserverEntry[]) {\n if (entry?.isIntersecting) {\n setIsVisible(true)\n }\n }\n }, [element, options])\n\n return isVisible\n}\n\ntype UseBoxAnimationsPayload = {\n initial?: { container: MotionProps['initial']; parent: MotionProps['initial'] }\n animate?: { container: MotionProps['animate']; parent: MotionProps['animate'] }\n variants?: { container: MotionProps['variants']; child: MotionProps['variants'] }\n transition?: {\n container: MotionProps['transition']\n parent: MotionProps['transition']\n child: MotionProps['transition']\n }\n key?: { container: string }\n}\n\nexport const useBoxAnimations = ({\n boxElement,\n elements,\n ...props\n}: {\n boxAnimateType: ResponsiveValue<BoxAnimateIn> | undefined\n boxAnimateDuration: ResponsiveValue<number> | undefined\n boxAnimateDelay: ResponsiveValue<number> | undefined\n itemAnimateType: ResponsiveValue<BoxAnimateIn> | undefined\n itemAnimateDuration: ResponsiveValue<number> | undefined\n itemAnimateDelay: ResponsiveValue<number> | undefined\n itemStaggerDuration: ResponsiveValue<number> | undefined\n boxElement: HTMLElement | null\n elements: Element[] | undefined\n}): UseBoxAnimationsPayload => {\n const reducedMotion = useReducedMotion()\n const boxAnimateType = useMediaQuery(props.boxAnimateType) || DEFAULT_BOX_ANIMATE_TYPE\n const boxAnimateDuration = useMediaQuery(props.boxAnimateDuration) || DEFAULT_BOX_ANIMATE_DURATION\n const boxAnimateDelay = useMediaQuery(props.boxAnimateDelay) || DEFAULT_BOX_ANIMATE_DELAY\n const itemAnimateType = useMediaQuery(props.itemAnimateType) || DEFAULT_ITEM_ANIMATE_TYPE\n const itemAnimateDuration =\n useMediaQuery(props.itemAnimateDuration) || DEFAULT_ITEM_ANIMATE_DURATION\n const itemAnimateDelay = useMediaQuery(props.itemAnimateDelay) || DEFAULT_ITEM_ANIMATE_DELAY\n const itemStaggerDuration =\n useMediaQuery(props.itemStaggerDuration) || DEFAULT_ITEM_STAGGER_DURATION\n\n const isBoxVisible = useElementOnScreen(boxElement, {\n root: null,\n rootMargin: `0px 0px -10% 0px`,\n threshold: 0.2,\n })\n\n const itemControls = useAnimation()\n const boxControls = useAnimation()\n\n const setSequence = useCallback(\n (variant: keyof BoxAnimationVariants) => {\n boxControls.stop()\n itemControls.stop()\n boxControls.set(variant)\n itemControls.set(variant)\n },\n [boxControls, itemControls],\n )\n\n const playSequence = useCallback(() => {\n boxControls.stop()\n itemControls.stop()\n boxControls.set('exited')\n itemControls.set('exited')\n boxControls.start('entered')\n itemControls.start('entered')\n }, [boxControls, itemControls])\n\n useEffect(() => {\n if (isBoxVisible) {\n setSequence('entered')\n }\n }, [\n elements\n ?.map(e => e.key)\n .sort()\n .join(),\n setSequence,\n ])\n\n useEffect(() => {\n if (isBoxVisible) {\n playSequence()\n }\n }, [\n isBoxVisible,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n reducedMotion,\n playSequence,\n ])\n\n const boxVariant = boxAnimations[boxAnimateType]\n const itemVariant = boxAnimations[itemAnimateType]\n\n return {\n initial: {\n container: reducedMotion ? 'entered' : 'exited',\n parent: reducedMotion ? 'entered' : 'exited',\n },\n animate: {\n container: reducedMotion ? undefined : boxControls,\n parent: reducedMotion ? undefined : itemControls,\n },\n variants: {\n container: {\n exited: boxVariant.exited,\n entered: boxVariant.entered,\n },\n child: {\n exited: itemVariant.exited,\n entered: itemVariant.entered,\n },\n },\n transition: {\n container: mergeCustomTransitionWithDefault(boxVariant.transition, {\n delay: boxAnimateDelay,\n duration: boxAnimateDuration,\n }),\n parent: {\n delayChildren: itemAnimateDelay,\n staggerChildren: itemStaggerDuration,\n duration: itemAnimateDuration,\n },\n child: mergeCustomTransitionWithDefault(itemVariant.transition, {\n duration: itemAnimateDuration,\n }),\n },\n key: {\n container:\n boxAnimateType +\n boxAnimateDuration +\n boxAnimateDelay +\n itemAnimateType +\n itemAnimateDuration +\n itemAnimateDelay +\n itemStaggerDuration +\n reducedMotion,\n },\n }\n}\n","import { forwardRef, Ref, useImperativeHandle, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { useElementOnScreen } 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 { useAnimation } from './useAnimation'\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 const hasBoxAnimation = boxAnimateType != 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 isBoxVisible = useElementOnScreen(boxElement, {\n root: null,\n rootMargin: `0px 0px -10% 0px`,\n threshold: 0.2,\n })\n\n const { initial, animate } = useAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay)\n\n return (\n <BackgroundsContainer\n ref={setBoxElement}\n hasAnimations={false}\n id={id}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(responsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n hasBoxAnimation && initial,\n isBoxVisible && hasBoxAnimation && animate,\n )}\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']) => ({ alignContent })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n as={'div'}\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 isBoxVisible={isBoxVisible}\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","useElementOnScreen","element","options","isVisible","setIsVisible","useState","useEffect","observer","IntersectionObserver","intersectionCallback","observe","unobserve","entry","isIntersecting","Box","id","backgrounds","margin","border","children","borderRadius","boxShadow","rowGap","columnGap","hidePlaceholder","verticalAlign","boxAnimateType","boxAnimateDuration","boxAnimateDelay","itemAnimateDelay","itemAnimateType","itemAnimateDuration","itemStaggerDuration","innerRef","useRef","boxElement","setBoxElement","hasBoxAnimation","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","isBoxVisible","root","rootMargin","threshold","initial","animate","useAnimation","BackgroundsContainer","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","GridItem","columns","Element","key"],"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,a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A,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAZF,yCAcGC,cAAD;AAAA,UAAS,SAASJ;AAAAA,QAAAA,CAAlB;AAAA,SAZKA,MAAMK,GAFb,CADF,mCAmBC,aAAD;AAAA,QAAa,MAAMtE;AAAAA,MAAAA,CAAnB;AAAA,IAAA,CAhCJ;AAAA,EAAA,CAhBJ;AAqDD,CAtIqB;;"}
|
|
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, useImperativeHandle, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { EnteredContext, 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 { useAnimation } from './animations'\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 { exited, entered } = useAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay)\n\n const isEntered = useIsEntered(boxElement, [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ])\n\n return (\n <EnteredContext.Provider value={{ isEntered }}>\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 exited,\n isEntered && entered,\n )}\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 </EnteredContext.Provider>\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","exited","entered","useAnimation","isEntered","useIsEntered","_jsx","EnteredContext","BackgroundsContainer","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","GridItem","columns","Element","key"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAA,cAAeA,iBAAW,sBACxB,IACAC,KACA;AAFA,eAAEC;AAAAA,WAAO;AAAA,MAAT,IAAmBC,wBAAnB,IAAmBA;AA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AA,UACA;AAAA,UAXF,yCAaGC,cAAD;AAAA,YAAS,SAASJ;AAAAA,UAAAA,CAAlB;AAAA,WAZKA,MAAMK,GADb,CADF,mCAkBC,aAAD;AAAA,UAAa,MAAMtE;AAAAA,QAAAA,CAAnB;AAAA,MAAA,CAjCJ;AAAA,IAAA,CAdF;AAAA,EAAA,CAFJ;AAuDD,CA3IqB;;"}
|
package/dist/Box.es.js
CHANGED
|
@@ -29,13 +29,12 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { forwardRef,
|
|
32
|
+
import { forwardRef, useRef, useState, useImperativeHandle } from "react";
|
|
33
33
|
import { cx } from "@emotion/css";
|
|
34
34
|
import { q as useStyle, r as responsiveStyle, E as Element } from "./index.es.js";
|
|
35
35
|
import { jsx } from "react/jsx-runtime";
|
|
36
|
-
import "
|
|
36
|
+
import { a as useAnimation, b as useIsEntered, E as EnteredContext, B as BackgroundsContainer, G as GridItem } from "./grid-item.es.js";
|
|
37
37
|
import { p as parse, c as createBox } from "./box-models.es.js";
|
|
38
|
-
import { a as useAnimation, B as BackgroundsContainer, G as GridItem } from "./grid-item.es.js";
|
|
39
38
|
import "use-sync-external-store/shim/with-selector";
|
|
40
39
|
import "./react-page.es.js";
|
|
41
40
|
import "redux";
|
|
@@ -63,10 +62,10 @@ import "http-proxy";
|
|
|
63
62
|
import "set-cookie-parser";
|
|
64
63
|
import "uuid/v4";
|
|
65
64
|
import "corporate-ipsum";
|
|
66
|
-
import "css-box-model";
|
|
67
65
|
import "next/image";
|
|
68
66
|
import "react-player";
|
|
69
67
|
import "./useMediaQuery.es.js";
|
|
68
|
+
import "css-box-model";
|
|
70
69
|
var Placeholder = forwardRef(function Placeholder2(_a, ref) {
|
|
71
70
|
var _b = _a, {
|
|
72
71
|
hide = false
|
|
@@ -106,24 +105,6 @@ var Placeholder = forwardRef(function Placeholder2(_a, ref) {
|
|
|
106
105
|
})
|
|
107
106
|
}));
|
|
108
107
|
});
|
|
109
|
-
const useElementOnScreen = (element, options) => {
|
|
110
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
const observer = new IntersectionObserver(intersectionCallback, options);
|
|
113
|
-
if (element)
|
|
114
|
-
observer.observe(element);
|
|
115
|
-
return () => {
|
|
116
|
-
if (element)
|
|
117
|
-
observer.unobserve(element);
|
|
118
|
-
};
|
|
119
|
-
function intersectionCallback([entry]) {
|
|
120
|
-
if (entry == null ? void 0 : entry.isIntersecting) {
|
|
121
|
-
setIsVisible(true);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}, [element, options]);
|
|
125
|
-
return isVisible;
|
|
126
|
-
};
|
|
127
108
|
const Box = forwardRef(function Box2({
|
|
128
109
|
id,
|
|
129
110
|
backgrounds,
|
|
@@ -149,7 +130,6 @@ const Box = forwardRef(function Box2({
|
|
|
149
130
|
}, ref) {
|
|
150
131
|
const innerRef = useRef(null);
|
|
151
132
|
const [boxElement, setBoxElement] = useState(null);
|
|
152
|
-
const hasBoxAnimation = boxAnimateType != null;
|
|
153
133
|
useImperativeHandle(ref, () => ({
|
|
154
134
|
getBoxModel() {
|
|
155
135
|
var _a, _b, _c, _d;
|
|
@@ -189,51 +169,50 @@ const Box = forwardRef(function Box2({
|
|
|
189
169
|
const gridItemClassName = useStyle(responsiveStyle([verticalAlign], ([alignItems = "flex-start"]) => ({
|
|
190
170
|
alignItems
|
|
191
171
|
})));
|
|
192
|
-
const isBoxVisible = useElementOnScreen(boxElement, {
|
|
193
|
-
root: null,
|
|
194
|
-
rootMargin: `0px 0px -10% 0px`,
|
|
195
|
-
threshold: 0.2
|
|
196
|
-
});
|
|
197
172
|
const {
|
|
198
|
-
|
|
199
|
-
|
|
173
|
+
exited,
|
|
174
|
+
entered
|
|
200
175
|
} = useAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
index,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
176
|
+
const isEntered = useIsEntered(boxElement, [boxAnimateType, boxAnimateDuration, boxAnimateDelay, itemAnimateType, itemAnimateDuration, itemAnimateDelay, itemStaggerDuration]);
|
|
177
|
+
return /* @__PURE__ */ jsx(EnteredContext.Provider, {
|
|
178
|
+
value: {
|
|
179
|
+
isEntered
|
|
180
|
+
},
|
|
181
|
+
children: /* @__PURE__ */ jsx(BackgroundsContainer, {
|
|
182
|
+
ref: setBoxElement,
|
|
183
|
+
id,
|
|
184
|
+
className: cx(width, margin, borderRadius, useStyle({
|
|
185
|
+
display: "flex"
|
|
186
|
+
}), useStyle(responsiveStyle([height], ([alignSelf = "auto"]) => ({
|
|
187
|
+
alignSelf
|
|
188
|
+
}))), exited, isEntered && entered),
|
|
189
|
+
backgrounds,
|
|
190
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
191
|
+
ref: innerRef,
|
|
192
|
+
className: cx(padding, boxShadow, border, useStyle({
|
|
193
|
+
display: "flex",
|
|
194
|
+
flexWrap: "wrap",
|
|
195
|
+
width: "100%"
|
|
196
|
+
}), useStyle(responsiveStyle([verticalAlign], ([alignContent = "flex-start"]) => ({
|
|
197
|
+
alignContent
|
|
198
|
+
})))),
|
|
199
|
+
children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsx(GridItem, {
|
|
200
|
+
className: gridItemClassName,
|
|
201
|
+
grid: children.columns,
|
|
202
|
+
index,
|
|
203
|
+
itemAnimateType,
|
|
204
|
+
itemAnimateDuration,
|
|
205
|
+
itemAnimateDelay,
|
|
206
|
+
itemStaggerDuration,
|
|
207
|
+
isEntered,
|
|
208
|
+
columnGap,
|
|
209
|
+
rowGap,
|
|
210
|
+
children: /* @__PURE__ */ jsx(Element, {
|
|
211
|
+
element: child
|
|
212
|
+
})
|
|
213
|
+
}, child.key)) : /* @__PURE__ */ jsx(Placeholder, {
|
|
214
|
+
hide: hidePlaceholder
|
|
234
215
|
})
|
|
235
|
-
}, child.key)) : /* @__PURE__ */ jsx(Placeholder, {
|
|
236
|
-
hide: hidePlaceholder
|
|
237
216
|
})
|
|
238
217
|
})
|
|
239
218
|
});
|
package/dist/Box.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.es.js","sources":["../src/components/builtin/Box/components/Placeholder/index.tsx","../src/components/builtin/Box/animations.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 {\n TargetAndTransition,\n Transition,\n useAnimation,\n useReducedMotion,\n Variants,\n MotionProps,\n} from 'framer-motion'\nimport { TransitionMap } from 'framer-motion/types/types'\nimport { useCallback, useEffect, useState } from 'react'\n\nimport { ResponsiveValue } from '../../../prop-controllers'\nimport { useMediaQuery } from '../../hooks'\nimport { Element } from '../../../state/react-page'\nimport {\n BoxAnimateIn,\n DEFAULT_BOX_ANIMATE_DELAY,\n DEFAULT_BOX_ANIMATE_DURATION,\n DEFAULT_BOX_ANIMATE_TYPE,\n DEFAULT_ITEM_ANIMATE_DELAY,\n DEFAULT_ITEM_ANIMATE_DURATION,\n DEFAULT_ITEM_ANIMATE_TYPE,\n DEFAULT_ITEM_STAGGER_DURATION,\n} from './constants'\n\nconst defaultExitedProps = {\n opacity: 0,\n x: 0,\n y: 0,\n scale: 1,\n}\n\ntype BoxAnimationVariants = {\n entered: TargetAndTransition\n exited: TargetAndTransition\n}\n\nexport const boxAnimations: {\n [key in BoxAnimateIn]: {\n transition: TransitionMap\n } & BoxAnimationVariants\n} = {\n none: {\n entered: {\n opacity: 1,\n },\n exited: {\n ...defaultExitedProps,\n opacity: 1,\n },\n transition: {},\n },\n fadeIn: {\n exited: defaultExitedProps,\n entered: {\n opacity: 1,\n },\n transition: {},\n },\n fadeLeft: {\n exited: {\n ...defaultExitedProps,\n x: 60,\n },\n entered: {\n opacity: 1,\n x: 0,\n },\n transition: {\n x: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n fadeRight: {\n exited: {\n ...defaultExitedProps,\n x: -60,\n },\n entered: {\n opacity: 1,\n x: 0,\n },\n transition: {\n x: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n fadeUp: {\n exited: {\n ...defaultExitedProps,\n y: 80,\n },\n entered: {\n opacity: 1,\n y: 0,\n },\n transition: {\n y: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n fadeDown: {\n exited: {\n ...defaultExitedProps,\n y: -80,\n },\n entered: {\n opacity: 1,\n y: 0,\n },\n transition: {\n y: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n blurIn: {\n exited: {\n ...defaultExitedProps,\n filter: 'blur(20px)',\n },\n entered: {\n opacity: 1,\n filter: 'blur(0px)',\n },\n transition: {},\n },\n scaleDown: {\n exited: {\n ...defaultExitedProps,\n scale: 1.2,\n },\n entered: {\n opacity: 1,\n scale: 1,\n },\n transition: {\n scale: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n scaleUp: {\n exited: {\n ...defaultExitedProps,\n scale: 0.75,\n },\n entered: {\n opacity: 1,\n scale: 1,\n },\n transition: {\n scale: {\n type: 'tween',\n ease: [0.165, 0.84, 0.44, 1],\n },\n },\n },\n}\n\nconst mergeCustomTransitionWithDefault = (\n transitions: TransitionMap,\n props: Transition,\n): TransitionMap | Transition =>\n transitions\n ? Object.keys(transitions).reduce(\n (a, c) => ({\n ...a,\n [c]: {\n ...transitions[c as string],\n ...props,\n },\n }),\n props,\n )\n : props\n\nexport type BoxAnimationType = {\n containerAnimationProps: {\n transition: Transition\n variants: Variants\n }\n parentAnimationProps: {\n transition: Transition\n }\n childAnimationProps: {\n transition: Transition\n variants: Variants\n }\n}\n\nexport const useElementOnScreen = (\n element: HTMLElement | null,\n options: IntersectionObserverInit,\n) => {\n const [isVisible, setIsVisible] = useState(false)\n\n useEffect(() => {\n const observer = new IntersectionObserver(intersectionCallback, options)\n\n if (element) observer.observe(element)\n\n return () => {\n if (element) observer.unobserve(element)\n }\n\n function intersectionCallback([entry]: IntersectionObserverEntry[]) {\n if (entry?.isIntersecting) {\n setIsVisible(true)\n }\n }\n }, [element, options])\n\n return isVisible\n}\n\ntype UseBoxAnimationsPayload = {\n initial?: { container: MotionProps['initial']; parent: MotionProps['initial'] }\n animate?: { container: MotionProps['animate']; parent: MotionProps['animate'] }\n variants?: { container: MotionProps['variants']; child: MotionProps['variants'] }\n transition?: {\n container: MotionProps['transition']\n parent: MotionProps['transition']\n child: MotionProps['transition']\n }\n key?: { container: string }\n}\n\nexport const useBoxAnimations = ({\n boxElement,\n elements,\n ...props\n}: {\n boxAnimateType: ResponsiveValue<BoxAnimateIn> | undefined\n boxAnimateDuration: ResponsiveValue<number> | undefined\n boxAnimateDelay: ResponsiveValue<number> | undefined\n itemAnimateType: ResponsiveValue<BoxAnimateIn> | undefined\n itemAnimateDuration: ResponsiveValue<number> | undefined\n itemAnimateDelay: ResponsiveValue<number> | undefined\n itemStaggerDuration: ResponsiveValue<number> | undefined\n boxElement: HTMLElement | null\n elements: Element[] | undefined\n}): UseBoxAnimationsPayload => {\n const reducedMotion = useReducedMotion()\n const boxAnimateType = useMediaQuery(props.boxAnimateType) || DEFAULT_BOX_ANIMATE_TYPE\n const boxAnimateDuration = useMediaQuery(props.boxAnimateDuration) || DEFAULT_BOX_ANIMATE_DURATION\n const boxAnimateDelay = useMediaQuery(props.boxAnimateDelay) || DEFAULT_BOX_ANIMATE_DELAY\n const itemAnimateType = useMediaQuery(props.itemAnimateType) || DEFAULT_ITEM_ANIMATE_TYPE\n const itemAnimateDuration =\n useMediaQuery(props.itemAnimateDuration) || DEFAULT_ITEM_ANIMATE_DURATION\n const itemAnimateDelay = useMediaQuery(props.itemAnimateDelay) || DEFAULT_ITEM_ANIMATE_DELAY\n const itemStaggerDuration =\n useMediaQuery(props.itemStaggerDuration) || DEFAULT_ITEM_STAGGER_DURATION\n\n const isBoxVisible = useElementOnScreen(boxElement, {\n root: null,\n rootMargin: `0px 0px -10% 0px`,\n threshold: 0.2,\n })\n\n const itemControls = useAnimation()\n const boxControls = useAnimation()\n\n const setSequence = useCallback(\n (variant: keyof BoxAnimationVariants) => {\n boxControls.stop()\n itemControls.stop()\n boxControls.set(variant)\n itemControls.set(variant)\n },\n [boxControls, itemControls],\n )\n\n const playSequence = useCallback(() => {\n boxControls.stop()\n itemControls.stop()\n boxControls.set('exited')\n itemControls.set('exited')\n boxControls.start('entered')\n itemControls.start('entered')\n }, [boxControls, itemControls])\n\n useEffect(() => {\n if (isBoxVisible) {\n setSequence('entered')\n }\n }, [\n elements\n ?.map(e => e.key)\n .sort()\n .join(),\n setSequence,\n ])\n\n useEffect(() => {\n if (isBoxVisible) {\n playSequence()\n }\n }, [\n isBoxVisible,\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n reducedMotion,\n playSequence,\n ])\n\n const boxVariant = boxAnimations[boxAnimateType]\n const itemVariant = boxAnimations[itemAnimateType]\n\n return {\n initial: {\n container: reducedMotion ? 'entered' : 'exited',\n parent: reducedMotion ? 'entered' : 'exited',\n },\n animate: {\n container: reducedMotion ? undefined : boxControls,\n parent: reducedMotion ? undefined : itemControls,\n },\n variants: {\n container: {\n exited: boxVariant.exited,\n entered: boxVariant.entered,\n },\n child: {\n exited: itemVariant.exited,\n entered: itemVariant.entered,\n },\n },\n transition: {\n container: mergeCustomTransitionWithDefault(boxVariant.transition, {\n delay: boxAnimateDelay,\n duration: boxAnimateDuration,\n }),\n parent: {\n delayChildren: itemAnimateDelay,\n staggerChildren: itemStaggerDuration,\n duration: itemAnimateDuration,\n },\n child: mergeCustomTransitionWithDefault(itemVariant.transition, {\n duration: itemAnimateDuration,\n }),\n },\n key: {\n container:\n boxAnimateType +\n boxAnimateDuration +\n boxAnimateDelay +\n itemAnimateType +\n itemAnimateDuration +\n itemAnimateDelay +\n itemStaggerDuration +\n reducedMotion,\n },\n }\n}\n","import { forwardRef, Ref, useImperativeHandle, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { useElementOnScreen } 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 { useAnimation } from './useAnimation'\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 const hasBoxAnimation = boxAnimateType != 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 isBoxVisible = useElementOnScreen(boxElement, {\n root: null,\n rootMargin: `0px 0px -10% 0px`,\n threshold: 0.2,\n })\n\n const { initial, animate } = useAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay)\n\n return (\n <BackgroundsContainer\n ref={setBoxElement}\n hasAnimations={false}\n id={id}\n className={cx(\n width,\n margin,\n borderRadius,\n useStyle({ display: 'flex' }),\n useStyle(responsiveStyle([height], ([alignSelf = 'auto']) => ({ alignSelf }))),\n hasBoxAnimation && initial,\n isBoxVisible && hasBoxAnimation && animate,\n )}\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']) => ({ alignContent })),\n ),\n )}\n >\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n as={'div'}\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 isBoxVisible={isBoxVisible}\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","useElementOnScreen","element","options","isVisible","setIsVisible","useState","useEffect","observer","IntersectionObserver","intersectionCallback","observe","unobserve","entry","isIntersecting","Box","id","backgrounds","margin","border","children","borderRadius","boxShadow","rowGap","columnGap","hidePlaceholder","verticalAlign","boxAnimateType","boxAnimateDuration","boxAnimateDelay","itemAnimateDelay","itemAnimateType","itemAnimateDuration","itemStaggerDuration","innerRef","useRef","boxElement","setBoxElement","hasBoxAnimation","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","isBoxVisible","root","rootMargin","threshold","initial","animate","useAnimation","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","columns","key"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAA,cAAeA,WAAW,sBACxB,IACAC,KACA;AAFA,e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B,CAAC,CAAC2D,eAAe,kBAAmB;AAAA,QAAEA;AAAAA,MAAtC,EAAlB,CADT,CALG;AAAA,MAUZjE,UAAAA,YAAYA,SAASkE,SAASC,SAAS,IACtCnE,SAASkE,SAASE,IAAI,CAACC,OAAOC,8BAC3B,UAAD;AAAA,QACE,IAAI;AAAA,QAEJ,WAAWnB;AAAAA,QACX,MAAMnD,SAASuE;AAAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAZF,8BAcG,SAAD;AAAA,UAAS,SAASF;AAAAA,QAAAA,CAAlB;AAAA,SAZKA,MAAMG,GAFb,CADF,wBAmBC,aAAD;AAAA,QAAa,MAAMnE;AAAAA,MAAAA,CAAnB;AAAA,IAAA,CAhCJ;AAAA,EAAA,CAhBJ;AAqDD,CAtIqB;;"}
|
|
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, useImperativeHandle, useRef, useState } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { Element } from '../../../runtimes/react'\nimport Placeholder from './components/Placeholder'\nimport { EnteredContext, 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 { useAnimation } from './animations'\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 { exited, entered } = useAnimation(boxAnimateType, boxAnimateDuration, boxAnimateDelay)\n\n const isEntered = useIsEntered(boxElement, [\n boxAnimateType,\n boxAnimateDuration,\n boxAnimateDelay,\n itemAnimateType,\n itemAnimateDuration,\n itemAnimateDelay,\n itemStaggerDuration,\n ])\n\n return (\n <EnteredContext.Provider value={{ isEntered }}>\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 exited,\n isEntered && entered,\n )}\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 </EnteredContext.Provider>\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","exited","entered","useAnimation","isEntered","useIsEntered","_jsx","cx","display","alignSelf","flexWrap","alignContent","elements","length","map","child","index","columns","key"],"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,iBAAgB;AAAA,QAChB,MAAK;AAAA,QACL,QAAO;AAAA,QACP,IAAG;AAAA,QACH,IAAG;AAAA,MAAA,CAVL;AAAA,IAAA,CANF;AAAA,EAAA,EAZJ;AAiCD,CArCwB;AC8CnBC,MAAAA,MAAMX,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,WAAW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;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAXF,8BAaG,SAAD;AAAA,YAAS,SAASF;AAAAA,UAAAA,CAAlB;AAAA,WAZKA,MAAMG,GADb,CADF,wBAkBC,aAAD;AAAA,UAAa,MAAMlE;AAAAA,QAAAA,CAAnB;AAAA,MAAA,CAjCJ;AAAA,IAAA,CAdF;AAAA,EAAA,CAFJ;AAuDD,CA3IqB;;"}
|
package/dist/Root.cjs.js
CHANGED
package/dist/Root.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.cjs.js","sources":["../src/components/builtin/Root/components/Placeholder/index.tsx","../src/runtimes/react/use-global-style.ts","../src/components/builtin/Root/Root.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nexport default forwardRef<HTMLDivElement>(function Placeholder(_props, ref) {\n return (\n <div\n ref={ref}\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 * as React from 'react'\nimport { useRef } from 'react'\nimport { cache, injectGlobal } from '@emotion/css'\nimport { CSSInterpolation, serializeStyles } from '@emotion/serialize'\nimport { StyleSheet } from '@emotion/sheet'\nimport { insertStyles } from '@emotion/utils'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useGlobalStyle(...args: CSSInterpolation[]): void {\n if (isServer) return injectGlobal(args)\n\n const serialized = serializeStyles(args, cache.registered)\n const sheetRef = useRef<[StyleSheet, boolean]>()\n\n // Hydration\n useInsertionEffect(() => {\n const key = `${cache.key}-global`\n\n const cacheSheet = cache.sheet as StyleSheet\n const sheet = new (cacheSheet.constructor as typeof StyleSheet)({\n key,\n nonce: cacheSheet.nonce,\n container: cacheSheet.container,\n speedy: cacheSheet.isSpeedy,\n })\n\n const node = document.querySelector<HTMLStyleElement>(\n `style[data-emotion=\"${key} ${serialized.name}\"]`,\n )\n\n if (cache.sheet.tags.length > 0) {\n sheet.before = cache.sheet.tags[0]\n }\n\n let rehydrating = false\n\n if (node != null) {\n rehydrating = true\n node.setAttribute('data-emotion', key)\n sheet.hydrate([node])\n }\n\n sheetRef.current = [sheet, rehydrating]\n\n return () => {\n sheet.flush()\n }\n })\n\n // Insertion\n useInsertionEffect(() => {\n const [sheet, rehydrating] = sheetRef.current ?? []\n\n if (sheet == null || rehydrating == null) return\n\n if (rehydrating) {\n sheetRef.current = [sheet, false]\n\n return\n }\n\n if (serialized.next != null) {\n insertStyles(cache, serialized.next, true)\n }\n\n if (sheet.tags.length > 0) {\n const element = sheet.tags[sheet.tags.length - 1].nextElementSibling\n\n sheet.before = element\n\n sheet.flush()\n }\n\n cache.insert('', serialized, sheet, false)\n })\n}\n","import { normalize } from 'polished'\nimport { forwardRef, Ref } from 'react'\n\nimport Placeholder from './components/Placeholder'\nimport type {\n GridValue,\n BackgroundsValue,\n GapXValue,\n GapYValue,\n} from '../../../prop-controllers/descriptors'\nimport { Element } from '../../../runtimes/react'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useGlobalStyle } from '../../../runtimes/react/use-global-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n children?: GridValue\n backgrounds?: BackgroundsValue\n rowGap?: GapYValue\n columnGap?: GapXValue\n}\n\nconst Root = forwardRef(function Page(\n { children, backgrounds, rowGap, columnGap }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n useGlobalStyle({\n html: {\n boxSizing: 'border-box',\n },\n '*, *::before, *::after': {\n boxSizing: 'inherit',\n },\n })\n\n useGlobalStyle(normalize())\n\n return (\n <BackgroundsContainer ref={ref} style={{ background: 'white' }} backgrounds={backgrounds}>\n <div className={useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' })}>\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n grid={children.columns}\n index={index}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Root\n"],"names":["forwardRef","_props","ref","useStyle","width","background","height","padding","overflow","React","injectGlobal","serializeStyles","cache","useRef","insertStyles","Root","children","backgrounds","rowGap","columnGap","html","boxSizing","useGlobalStyle","normalize","BackgroundsContainer","display","flexWrap","elements","length","map","child","index","GridItem","columns","Element","key","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Root.cjs.js","sources":["../src/components/builtin/Root/components/Placeholder/index.tsx","../src/runtimes/react/use-global-style.ts","../src/components/builtin/Root/Root.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nexport default forwardRef<HTMLDivElement>(function Placeholder(_props, ref) {\n return (\n <div\n ref={ref}\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 * as React from 'react'\nimport { useRef } from 'react'\nimport { cache, injectGlobal } from '@emotion/css'\nimport { CSSInterpolation, serializeStyles } from '@emotion/serialize'\nimport { StyleSheet } from '@emotion/sheet'\nimport { insertStyles } from '@emotion/utils'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useGlobalStyle(...args: CSSInterpolation[]): void {\n if (isServer) return injectGlobal(args)\n\n const serialized = serializeStyles(args, cache.registered)\n const sheetRef = useRef<[StyleSheet, boolean]>()\n\n // Hydration\n useInsertionEffect(() => {\n const key = `${cache.key}-global`\n\n const cacheSheet = cache.sheet as StyleSheet\n const sheet = new (cacheSheet.constructor as typeof StyleSheet)({\n key,\n nonce: cacheSheet.nonce,\n container: cacheSheet.container,\n speedy: cacheSheet.isSpeedy,\n })\n\n const node = document.querySelector<HTMLStyleElement>(\n `style[data-emotion=\"${key} ${serialized.name}\"]`,\n )\n\n if (cache.sheet.tags.length > 0) {\n sheet.before = cache.sheet.tags[0]\n }\n\n let rehydrating = false\n\n if (node != null) {\n rehydrating = true\n node.setAttribute('data-emotion', key)\n sheet.hydrate([node])\n }\n\n sheetRef.current = [sheet, rehydrating]\n\n return () => {\n sheet.flush()\n }\n })\n\n // Insertion\n useInsertionEffect(() => {\n const [sheet, rehydrating] = sheetRef.current ?? []\n\n if (sheet == null || rehydrating == null) return\n\n if (rehydrating) {\n sheetRef.current = [sheet, false]\n\n return\n }\n\n if (serialized.next != null) {\n insertStyles(cache, serialized.next, true)\n }\n\n if (sheet.tags.length > 0) {\n const element = sheet.tags[sheet.tags.length - 1].nextElementSibling\n\n sheet.before = element\n\n sheet.flush()\n }\n\n cache.insert('', serialized, sheet, false)\n })\n}\n","import { normalize } from 'polished'\nimport { forwardRef, Ref } from 'react'\n\nimport Placeholder from './components/Placeholder'\nimport type {\n GridValue,\n BackgroundsValue,\n GapXValue,\n GapYValue,\n} from '../../../prop-controllers/descriptors'\nimport { Element } from '../../../runtimes/react'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useGlobalStyle } from '../../../runtimes/react/use-global-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n children?: GridValue\n backgrounds?: BackgroundsValue\n rowGap?: GapYValue\n columnGap?: GapXValue\n}\n\nconst Root = forwardRef(function Page(\n { children, backgrounds, rowGap, columnGap }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n useGlobalStyle({\n html: {\n boxSizing: 'border-box',\n },\n '*, *::before, *::after': {\n boxSizing: 'inherit',\n },\n })\n\n useGlobalStyle(normalize())\n\n return (\n <BackgroundsContainer ref={ref} style={{ background: 'white' }} backgrounds={backgrounds}>\n <div className={useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' })}>\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n grid={children.columns}\n index={index}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Root\n"],"names":["forwardRef","_props","ref","useStyle","width","background","height","padding","overflow","React","injectGlobal","serializeStyles","cache","useRef","insertStyles","Root","children","backgrounds","rowGap","columnGap","html","boxSizing","useGlobalStyle","normalize","BackgroundsContainer","display","flexWrap","elements","length","map","child","index","GridItem","columns","Element","key","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAeA,cAAAA,MAAAA,WAA2B,sBAAqBC,QAAQC,KAAK;AAExE,wCAAA,OAAA;AAAA,IACE;AAAA,IACA,WAAWC,KAAAA,SAAS;AAAA,MAClBC,OAAO;AAAA,MACPC,YAAY;AAAA,MACZC,QAAQ;AAAA,MACRC,SAAS;AAAA,IAAA,CAJQ;AAA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,yCAOGC,cAAD;AAAA,UAAS,SAASJ;AAAAA,QAAAA,CAAlB;AAAA,MAAA,GANKA,MAAMK,GADb,CADF,IAYCC,2BAAAA,IAAA,aAAD,CAAA,CAAA;AAAA,IAAA,CAdJ;AAAA,EAAA,CAFJ;AAqBD,CApCsB;;"}
|
package/dist/Root.es.js
CHANGED
package/dist/Root.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.es.js","sources":["../src/components/builtin/Root/components/Placeholder/index.tsx","../src/runtimes/react/use-global-style.ts","../src/components/builtin/Root/Root.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nexport default forwardRef<HTMLDivElement>(function Placeholder(_props, ref) {\n return (\n <div\n ref={ref}\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 * as React from 'react'\nimport { useRef } from 'react'\nimport { cache, injectGlobal } from '@emotion/css'\nimport { CSSInterpolation, serializeStyles } from '@emotion/serialize'\nimport { StyleSheet } from '@emotion/sheet'\nimport { insertStyles } from '@emotion/utils'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useGlobalStyle(...args: CSSInterpolation[]): void {\n if (isServer) return injectGlobal(args)\n\n const serialized = serializeStyles(args, cache.registered)\n const sheetRef = useRef<[StyleSheet, boolean]>()\n\n // Hydration\n useInsertionEffect(() => {\n const key = `${cache.key}-global`\n\n const cacheSheet = cache.sheet as StyleSheet\n const sheet = new (cacheSheet.constructor as typeof StyleSheet)({\n key,\n nonce: cacheSheet.nonce,\n container: cacheSheet.container,\n speedy: cacheSheet.isSpeedy,\n })\n\n const node = document.querySelector<HTMLStyleElement>(\n `style[data-emotion=\"${key} ${serialized.name}\"]`,\n )\n\n if (cache.sheet.tags.length > 0) {\n sheet.before = cache.sheet.tags[0]\n }\n\n let rehydrating = false\n\n if (node != null) {\n rehydrating = true\n node.setAttribute('data-emotion', key)\n sheet.hydrate([node])\n }\n\n sheetRef.current = [sheet, rehydrating]\n\n return () => {\n sheet.flush()\n }\n })\n\n // Insertion\n useInsertionEffect(() => {\n const [sheet, rehydrating] = sheetRef.current ?? []\n\n if (sheet == null || rehydrating == null) return\n\n if (rehydrating) {\n sheetRef.current = [sheet, false]\n\n return\n }\n\n if (serialized.next != null) {\n insertStyles(cache, serialized.next, true)\n }\n\n if (sheet.tags.length > 0) {\n const element = sheet.tags[sheet.tags.length - 1].nextElementSibling\n\n sheet.before = element\n\n sheet.flush()\n }\n\n cache.insert('', serialized, sheet, false)\n })\n}\n","import { normalize } from 'polished'\nimport { forwardRef, Ref } from 'react'\n\nimport Placeholder from './components/Placeholder'\nimport type {\n GridValue,\n BackgroundsValue,\n GapXValue,\n GapYValue,\n} from '../../../prop-controllers/descriptors'\nimport { Element } from '../../../runtimes/react'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useGlobalStyle } from '../../../runtimes/react/use-global-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n children?: GridValue\n backgrounds?: BackgroundsValue\n rowGap?: GapYValue\n columnGap?: GapXValue\n}\n\nconst Root = forwardRef(function Page(\n { children, backgrounds, rowGap, columnGap }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n useGlobalStyle({\n html: {\n boxSizing: 'border-box',\n },\n '*, *::before, *::after': {\n boxSizing: 'inherit',\n },\n })\n\n useGlobalStyle(normalize())\n\n return (\n <BackgroundsContainer ref={ref} style={{ background: 'white' }} backgrounds={backgrounds}>\n <div className={useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' })}>\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n grid={children.columns}\n index={index}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Root\n"],"names":["forwardRef","_props","ref","useStyle","width","background","height","padding","overflow","Root","children","backgrounds","rowGap","columnGap","html","boxSizing","useGlobalStyle","normalize","display","flexWrap","elements","length","map","child","index","columns","key","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Root.es.js","sources":["../src/components/builtin/Root/components/Placeholder/index.tsx","../src/runtimes/react/use-global-style.ts","../src/components/builtin/Root/Root.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nexport default forwardRef<HTMLDivElement>(function Placeholder(_props, ref) {\n return (\n <div\n ref={ref}\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 * as React from 'react'\nimport { useRef } from 'react'\nimport { cache, injectGlobal } from '@emotion/css'\nimport { CSSInterpolation, serializeStyles } from '@emotion/serialize'\nimport { StyleSheet } from '@emotion/sheet'\nimport { insertStyles } from '@emotion/utils'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useGlobalStyle(...args: CSSInterpolation[]): void {\n if (isServer) return injectGlobal(args)\n\n const serialized = serializeStyles(args, cache.registered)\n const sheetRef = useRef<[StyleSheet, boolean]>()\n\n // Hydration\n useInsertionEffect(() => {\n const key = `${cache.key}-global`\n\n const cacheSheet = cache.sheet as StyleSheet\n const sheet = new (cacheSheet.constructor as typeof StyleSheet)({\n key,\n nonce: cacheSheet.nonce,\n container: cacheSheet.container,\n speedy: cacheSheet.isSpeedy,\n })\n\n const node = document.querySelector<HTMLStyleElement>(\n `style[data-emotion=\"${key} ${serialized.name}\"]`,\n )\n\n if (cache.sheet.tags.length > 0) {\n sheet.before = cache.sheet.tags[0]\n }\n\n let rehydrating = false\n\n if (node != null) {\n rehydrating = true\n node.setAttribute('data-emotion', key)\n sheet.hydrate([node])\n }\n\n sheetRef.current = [sheet, rehydrating]\n\n return () => {\n sheet.flush()\n }\n })\n\n // Insertion\n useInsertionEffect(() => {\n const [sheet, rehydrating] = sheetRef.current ?? []\n\n if (sheet == null || rehydrating == null) return\n\n if (rehydrating) {\n sheetRef.current = [sheet, false]\n\n return\n }\n\n if (serialized.next != null) {\n insertStyles(cache, serialized.next, true)\n }\n\n if (sheet.tags.length > 0) {\n const element = sheet.tags[sheet.tags.length - 1].nextElementSibling\n\n sheet.before = element\n\n sheet.flush()\n }\n\n cache.insert('', serialized, sheet, false)\n })\n}\n","import { normalize } from 'polished'\nimport { forwardRef, Ref } from 'react'\n\nimport Placeholder from './components/Placeholder'\nimport type {\n GridValue,\n BackgroundsValue,\n GapXValue,\n GapYValue,\n} from '../../../prop-controllers/descriptors'\nimport { Element } from '../../../runtimes/react'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useGlobalStyle } from '../../../runtimes/react/use-global-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n children?: GridValue\n backgrounds?: BackgroundsValue\n rowGap?: GapYValue\n columnGap?: GapXValue\n}\n\nconst Root = forwardRef(function Page(\n { children, backgrounds, rowGap, columnGap }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n useGlobalStyle({\n html: {\n boxSizing: 'border-box',\n },\n '*, *::before, *::after': {\n boxSizing: 'inherit',\n },\n })\n\n useGlobalStyle(normalize())\n\n return (\n <BackgroundsContainer ref={ref} style={{ background: 'white' }} backgrounds={backgrounds}>\n <div className={useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' })}>\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n grid={children.columns}\n index={index}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Root\n"],"names":["forwardRef","_props","ref","useStyle","width","background","height","padding","overflow","Root","children","backgrounds","rowGap","columnGap","html","boxSizing","useGlobalStyle","normalize","display","flexWrap","elements","length","map","child","index","columns","key","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAeA,cAAAA,WAA2B,sBAAqBC,QAAQC,KAAK;AAExE,6BAAA,OAAA;AAAA,IACE;AAAA,IACA,WAAWC,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,iBAAgB;AAAA,QAChB,MAAK;AA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K,SAAS,GAAG;AACzB,YAAM,UAAU,MAAM,KAAK,MAAM,KAAK,SAAS,GAAG;AAElD,YAAM,SAAS;AAEf,YAAM,MAAM;AAAA,IACd;AAEA,UAAM,OAAO,IAAI,YAAY,OAAO,KAAK;AAAA,EAAA,CAC1C;AACH;ACvDMC,MAAAA,OAAOT,WAAW,cACtB;AAAA,EAAEU;AAAAA,EAAUC;AAAAA,EAAaC;AAAAA,EAAQC;AAAAA,GACjCX,KACA;AACe,iBAAA;AAAA,IACbY,MAAM;AAAA,MACJC,WAAW;AAAA,IAFA;AAAA,IAIa,0BAAA;AAAA,MACxBA,WAAW;AAAA,IADa;AAAA,EAAA,CAJd;AASdC,iBAAeC,WAAD;AAEd,6BACG,sBAAD;AAAA,IAAsB;AAAA,IAAU,OAAO;AAAA,MAAEZ,YAAY;AAAA,IAArD;AAAA,IAAgE;AAAA,IAC9D,8BAAA,OAAA;AAAA,MAAK,WAAWF,SAAS;AAAA,QAAEe,SAAS;AAAA,QAAQC,UAAU;AAAA,QAAQf,OAAO;AAAA,MAAA,CAA7C;AAAA,MACrBM,UAAAA,YAAYA,SAASU,SAASC,SAAS,IACtCX,SAASU,SAASE,IAAI,CAACC,OAAOC,8BAC3B,UAAD;AAAA,QAEE,MAAMd,SAASe;AAAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QALF,8BAOG,SAAD;AAAA,UAAS,SAASF;AAAAA,QAAAA,CAAlB;AAAA,MAAA,GANKA,MAAMG,GADb,CADF,IAYCC,oBAAA,aAAD,CAAA,CAAA;AAAA,IAAA,CAdJ;AAAA,EAAA,CAFJ;AAqBD,CApCsB;;"}
|
package/dist/components.cjs.js
CHANGED
|
@@ -19,7 +19,6 @@ var useMediaQuery = require("./useMediaQuery.cjs.js");
|
|
|
19
19
|
require("react");
|
|
20
20
|
require("@emotion/css");
|
|
21
21
|
require("react/jsx-runtime");
|
|
22
|
-
require("framer-motion");
|
|
23
22
|
require("./box-models.cjs.js");
|
|
24
23
|
require("css-box-model");
|
|
25
24
|
require("./actions.cjs.js");
|
|
@@ -51,6 +50,7 @@ require("uuid/v4");
|
|
|
51
50
|
require("corporate-ipsum");
|
|
52
51
|
require("./index.cjs2.js");
|
|
53
52
|
require("next/link");
|
|
53
|
+
require("framer-motion");
|
|
54
54
|
require("react-use-gesture");
|
|
55
55
|
require("@popmotion/popcorn");
|
|
56
56
|
require("formik");
|
package/dist/components.es.js
CHANGED
|
@@ -17,7 +17,6 @@ export { u as useMediaQuery } from "./useMediaQuery.es.js";
|
|
|
17
17
|
import "react";
|
|
18
18
|
import "@emotion/css";
|
|
19
19
|
import "react/jsx-runtime";
|
|
20
|
-
import "framer-motion";
|
|
21
20
|
import "./box-models.es.js";
|
|
22
21
|
import "css-box-model";
|
|
23
22
|
import "./actions.es.js";
|
|
@@ -49,6 +48,7 @@ import "uuid/v4";
|
|
|
49
48
|
import "corporate-ipsum";
|
|
50
49
|
import "./index.es2.js";
|
|
51
50
|
import "next/link";
|
|
51
|
+
import "framer-motion";
|
|
52
52
|
import "react-use-gesture";
|
|
53
53
|
import "@popmotion/popcorn";
|
|
54
54
|
import "formik";
|