UNPKG

@wordpress/global-styles-ui

Version:
161 lines (160 loc) • 5.47 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); // \0rolldown/runtime.js var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); let _wordpress_components = require("@wordpress/components"); let __hooks_ts = require("./hooks.cjs"); let __preview_hooks_tsx = require("./preview-hooks.cjs"); let __typography_example_tsx = require("./typography-example.cjs"); __typography_example_tsx = __toESM(__typography_example_tsx); let __highlighted_colors_tsx = require("./highlighted-colors.cjs"); __highlighted_colors_tsx = __toESM(__highlighted_colors_tsx); let __preview_wrapper_tsx = require("./preview-wrapper.cjs"); __preview_wrapper_tsx = __toESM(__preview_wrapper_tsx); let react_jsx_runtime = require("react/jsx-runtime"); // packages/global-styles-ui/src/preview-styles.tsx const firstFrameVariants = { start: { scale: 1, opacity: 1 }, hover: { scale: 0, opacity: 0 } }; const midFrameVariants = { hover: { opacity: 1 }, start: { opacity: .5 } }; const secondFrameVariants = { hover: { scale: 1, opacity: 1 }, start: { scale: 0, opacity: 0 } }; function PreviewStyles({ label, isFocused, withHoverView, variation }) { const [fontWeight] = (0, __hooks_ts.useStyle)("typography.fontWeight"); const [fontFamily = "serif"] = (0, __hooks_ts.useStyle)("typography.fontFamily"); const [headingFontFamily = fontFamily] = (0, __hooks_ts.useStyle)("elements.h1.typography.fontFamily"); const [headingFontWeight = fontWeight] = (0, __hooks_ts.useStyle)("elements.h1.typography.fontWeight"); const [textColor = "black"] = (0, __hooks_ts.useStyle)("color.text"); const [headingColor = textColor] = (0, __hooks_ts.useStyle)("elements.h1.color.text"); const { paletteColors } = (0, __preview_hooks_tsx.useStylesPreviewColors)(); return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__preview_wrapper_tsx.default, { label, isFocused, withHoverView, children: [ ({ ratio, key }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__unstableMotion.div, { variants: firstFrameVariants, style: { height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_components.__experimentalHStack, { spacing: 10 * ratio, justify: "center", style: { height: "100%", overflow: "hidden" }, children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__typography_example_tsx.default, { fontSize: 65 * ratio, variation }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__highlighted_colors_tsx.default, { normalizedColorSwatchSize: 32, ratio }) })] }) }, key), ({ key }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__unstableMotion.div, { variants: withHoverView ? midFrameVariants : void 0, style: { height: "100%", width: "100%", position: "absolute", top: 0, overflow: "hidden", filter: "blur(60px)", opacity: .1 }, children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalHStack, { spacing: 0, justify: "flex-start", style: { height: "100%", overflow: "hidden" }, children: paletteColors.slice(0, 4).map(({ color }, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { height: "100%", background: color, flexGrow: 1 } }, index)) }) }, key), ({ ratio, key }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__unstableMotion.div, { variants: secondFrameVariants, style: { height: "100%", width: "100%", overflow: "hidden", position: "absolute", top: 0 }, children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalVStack, { spacing: 3 * ratio, justify: "center", style: { height: "100%", overflow: "hidden", padding: 10 * ratio, boxSizing: "border-box" }, children: label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { fontSize: 40 * ratio, fontFamily: headingFontFamily, color: headingColor, fontWeight: headingFontWeight, lineHeight: "1em", textAlign: "center" }, children: label }) }) }, key) ] }); } exports.default = PreviewStyles; //# sourceMappingURL=preview-styles.cjs.map