From f5b81d4cf508de7aed68db21066b96c11ddcfa95 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 11:59:01 -0500 Subject: [PATCH 01/12] Prepare plugin for WordPress.org submission --- .gitignore | 10 ++++++ .pressshipignore | 6 ++++ LICENSE | 10 ++++++ README.md | 15 ++++++-- build/index.js | 1 - build/style-index-rtl.css | 1 - build/style-index.css | 1 - build/view.asset.php | 1 - build/view.js | 1 - {build => compiled}/block.json | 0 {build => compiled}/index-rtl.css | 0 {build => compiled}/index.asset.php | 2 +- {build => compiled}/index.css | 0 compiled/index.js | 1 + compiled/style-index-rtl.css | 1 + compiled/style-index.css | 1 + compiled/view.asset.php | 1 + compiled/view.js | 1 + package.json | 12 +++---- readme.txt | 8 +++-- scroll-indicator.php | 2 +- src/edit.js | 14 ++++++-- src/icons.js | 20 +++++++---- src/index.js | 28 --------------- src/save.js | 23 ++++++------- src/style.scss | 10 ++++++ src/view.js | 53 +++++++++++++++++++++-------- 27 files changed, 139 insertions(+), 84 deletions(-) create mode 100644 .pressshipignore create mode 100644 LICENSE delete mode 100644 build/index.js delete mode 100644 build/style-index-rtl.css delete mode 100644 build/style-index.css delete mode 100644 build/view.asset.php delete mode 100644 build/view.js rename {build => compiled}/block.json (100%) rename {build => compiled}/index-rtl.css (100%) rename {build => compiled}/index.asset.php (78%) rename {build => compiled}/index.css (100%) create mode 100644 compiled/index.js create mode 100644 compiled/style-index-rtl.css create mode 100644 compiled/style-index.css create mode 100644 compiled/view.asset.php create mode 100644 compiled/view.js diff --git a/.gitignore b/.gitignore index 04c8b78..8bcfcf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,13 @@ +.DS_Store +.env +.env.* +.npm/ +.cache/ +coverage/ node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +*.log *.zip artefact.xml diff --git a/.pressshipignore b/.pressshipignore new file mode 100644 index 0000000..538b928 --- /dev/null +++ b/.pressshipignore @@ -0,0 +1,6 @@ +.pressshipignore +assets/ +src/ +README.md +package.json +package-lock.json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c84063 --- /dev/null +++ b/LICENSE @@ -0,0 +1,10 @@ +Scroll Indicator is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the Free +Software Foundation, either version 2 of the License, or any later version. + +Scroll Indicator is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. + +You should have received a copy of the GNU General Public License along with +Scroll Indicator. If not, see https://www.gnu.org/licenses/gpl-2.0.html. diff --git a/README.md b/README.md index abee0e5..d82b078 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ # Scroll Indicator -Scroll Indicator is a lightweight WordPress block for adding a polished “keep scrolling” cue to landing pages, editorial layouts, hero sections, and long-form content. +Scroll Indicator is a lightweight WordPress block for adding a “keep scrolling” cue to landing pages, editorial layouts, hero sections, and long-form content. -It gives site builders a small, expressive block that feels designed: choose an icon style, tune the size and color, add optional text, and let visitors click or keyboard-activate the indicator to move one viewport down the page. +Site builders can choose an icon style, tune the size and color, add optional text, and let visitors click or keyboard-activate the indicator to move one viewport down the page. ## Highlights @@ -44,12 +44,19 @@ Create a production build: npm run build ``` -Create a distributable plugin ZIP: +Create a local plugin ZIP: ```bash npm run plugin-zip ``` +PressShip is the preferred WordPress.org submission path for this repo: + +```bash +npx pressship pack . +npx pressship publish . --dry-run +``` + ## Quality Checks ```bash @@ -70,6 +77,8 @@ The `assets/` directory contains WordPress.org plugin directory artwork: These are intended for the WordPress.org SVN `assets` directory after the plugin is approved. They are not required inside the installable plugin ZIP. +The compiled block files live in `compiled/` so PressShip includes them in the installable ZIP by default. + ## License GPLv2 or later. diff --git a/build/index.js b/build/index.js deleted file mode 100644 index d8c2ab4..0000000 --- a/build/index.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{"use strict";var o,e={280(){const o=window.wp.blocks,e=window.wp.i18n,r=window.wp.blockEditor,l=window.wp.components,i=window.ReactJSXRuntime,s={S:"18px",M:"24px",L:"32px",XL:"48px"};function n(o,e){return"custom"===o?e||"24px":s[o]||"24px"}function t(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,i.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})}const c={mouse:t,"arrow-down":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,i.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,i.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,i.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,i.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,i.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function a({iconType:o}){const e=c[o]||t;return(0,i.jsx)(e,{})}const d=[{value:"mouse",label:(0,e.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,e.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,e.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,e.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,e.__)("Hand","scroll-indicator")}],u=["S","M","L","XL","custom"],h=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(h.UU,{edit:function({attributes:o,setAttributes:s}){const{iconType:t="mouse",iconSize:h="M",customSizeValue:x="24px",hideAfterScrolling:p=!1,showText:v=!0,customText:j="Scroll down"}=o,f=n(h,x),m=(0,r.useBlockProps)({style:{"--scroll-indicator-size":f}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.InspectorControls,{children:[(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,i.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Icon Type","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:d.map(o=>{const e=c[o.value];return(0,i.jsx)(l.Button,{className:"scroll-indicator-icon-button",isPressed:t===o.value,onClick:()=>s({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,i.jsx)(e,{})},o.value)})})]}),(0,i.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Size","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-size-buttons",children:u.map(o=>(0,i.jsx)(l.Button,{isPressed:h===o,onClick:()=>s({iconSize:o}),children:"custom"===o?(0,e.__)("Custom","scroll-indicator"):o},o))}),"custom"===h&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Size","scroll-indicator"),value:x,onChange:o=>s({customSizeValue:o}),help:(0,e.__)("Use a CSS size such as 24px, 2rem, or 3em.","scroll-indicator")})]})]}),(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Show text","scroll-indicator"),checked:v,onChange:o=>s({showText:o})}),v&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Text","scroll-indicator"),value:j,onChange:o=>s({customText:o}),placeholder:(0,e.__)("Scroll down","scroll-indicator")})]}),(0,i.jsx)(l.PanelBody,{title:(0,e.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Hide after scrolling","scroll-indicator"),help:(0,e.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:p,onChange:o=>s({hideAfterScrolling:o})})})]}),(0,i.jsx)("div",{...m,children:(0,i.jsxs)("div",{className:`scroll-indicator icon-${t}`,children:[(0,i.jsx)(a,{iconType:t}),v&&(0,i.jsx)("div",{className:"scroll-text",children:j||(0,e.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:s="24px",hideAfterScrolling:t=!1,showText:c=!0,customText:d="Scroll down"}=o,u=n(l,s),h=r.useBlockProps.save({style:{"--scroll-indicator-size":u}});return(0,i.jsx)("div",{...h,children:(0,i.jsxs)("div",{className:`scroll-indicator icon-${e}`,role:"button",tabIndex:"0","aria-label":d||"Scroll down","data-hide-after-scrolling":t?"true":"false",children:[(0,i.jsx)(a,{iconType:e}),c&&(0,i.jsx)("div",{className:"scroll-text",children:d||"Scroll down"})]})})}})}},r={};function l(o){var i=r[o];if(void 0!==i)return i.exports;var s=r[o]={exports:{}};return e[o](s,s.exports,l),s.exports}l.m=e,o=[],l.O=(e,r,i,s)=>{if(!r){var n=1/0;for(d=0;d=s)&&Object.keys(l.O).every(o=>l.O[o](r[c]))?r.splice(c--,1):(t=!1,s0&&o[d-1][2]>s;d--)o[d]=o[d-1];o[d]=[r,i,s]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,r)=>{var i,s,[n,t,c]=r,a=0;if(n.some(e=>0!==o[e])){for(i in t)l.o(t,i)&&(l.m[i]=t[i]);if(c)var d=c(l)}for(e&&e(r);al(280));i=l.O(i)})(); \ No newline at end of file diff --git a/build/style-index-rtl.css b/build/style-index-rtl.css deleted file mode 100644 index aa1eabc..0000000 --- a/build/style-index-rtl.css +++ /dev/null @@ -1 +0,0 @@ -.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;cursor:pointer;display:flex;flex-direction:column;gap:10px;padding:20px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/build/style-index.css b/build/style-index.css deleted file mode 100644 index aa1eabc..0000000 --- a/build/style-index.css +++ /dev/null @@ -1 +0,0 @@ -.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;cursor:pointer;display:flex;flex-direction:column;gap:10px;padding:20px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/build/view.asset.php b/build/view.asset.php deleted file mode 100644 index caa3e8d..0000000 --- a/build/view.asset.php +++ /dev/null @@ -1 +0,0 @@ - array(), 'version' => '2b3837a3c2a852532a1c'); diff --git a/build/view.js b/build/view.js deleted file mode 100644 index 2ad1101..0000000 --- a/build/view.js +++ /dev/null @@ -1 +0,0 @@ -document.addEventListener("DOMContentLoaded",function(){const t=document.querySelectorAll(".scroll-indicator");0!==t.length&&t.forEach(function(t){const e="true"===t.getAttribute("data-hide-after-scrolling"),o=t.closest(".wp-block-scroll-indicator-scroll-indicator");function n(){const t=window.innerHeight,e=window.scrollY+t;window.scrollTo({top:e,behavior:"smooth"})}if(t.addEventListener("click",n),t.addEventListener("keydown",function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n())}),t.style.cursor="pointer",e&&o){let s=o.offsetTop,c=s+o.offsetHeight;function i(){const e=window.scrollY,o=window.innerHeight;e<=s||se?(t.style.transition="opacity 0.3s ease-in",t.style.opacity="1"):(t.style.transition="opacity 0.3s ease-out",t.style.opacity="0")}window.addEventListener("resize",function(){s=o.offsetTop,c=s+o.offsetHeight}),i(),window.addEventListener("scroll",i,{passive:!0})}})}); \ No newline at end of file diff --git a/build/block.json b/compiled/block.json similarity index 100% rename from build/block.json rename to compiled/block.json diff --git a/build/index-rtl.css b/compiled/index-rtl.css similarity index 100% rename from build/index-rtl.css rename to compiled/index-rtl.css diff --git a/build/index.asset.php b/compiled/index.asset.php similarity index 78% rename from build/index.asset.php rename to compiled/index.asset.php index 36dc98f..d6d2448 100644 --- a/build/index.asset.php +++ b/compiled/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '5bf8d8c47e5abc153b6f'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '98dee282c70a217f3d0b'); diff --git a/build/index.css b/compiled/index.css similarity index 100% rename from build/index.css rename to compiled/index.css diff --git a/compiled/index.js b/compiled/index.js new file mode 100644 index 0000000..9ebf4c7 --- /dev/null +++ b/compiled/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var o,e={280(){const o=window.wp.blocks,e=window.wp.i18n,r=window.wp.blockEditor,l=window.wp.components,i=window.ReactJSXRuntime,s={S:"18px",M:"24px",L:"32px",XL:"48px"},n=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function t(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return n.test(o)?o:"24px"}return s[o]||"24px"}const c={mouse:function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,i.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,i.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,i.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,i.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,i.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,i.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function a(o){return Object.prototype.hasOwnProperty.call(c,o)?o:"mouse"}function d({iconType:o}){const e=c[a(o)];return(0,i.jsx)(e,{})}const u=[{value:"mouse",label:(0,e.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,e.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,e.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,e.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,e.__)("Hand","scroll-indicator")}],h=["S","M","L","XL","custom"],x=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(x.UU,{edit:function({attributes:o,setAttributes:s}){const{iconType:n="mouse",iconSize:x="M",customSizeValue:p="24px",hideAfterScrolling:v=!1,showText:j=!0,customText:f="Scroll down"}=o,m=a(n),w=t(x,p),_=(0,r.useBlockProps)({style:{"--scroll-indicator-size":w}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.InspectorControls,{children:[(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,i.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Icon Type","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:u.map(o=>{const e=c[o.value];return(0,i.jsx)(l.Button,{className:"scroll-indicator-icon-button",isPressed:n===o.value,onClick:()=>s({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,i.jsx)(e,{})},o.value)})})]}),(0,i.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Size","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-size-buttons",children:h.map(o=>(0,i.jsx)(l.Button,{isPressed:x===o,onClick:()=>s({iconSize:o}),children:"custom"===o?(0,e.__)("Custom","scroll-indicator"):o},o))}),"custom"===x&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Size","scroll-indicator"),value:p,onChange:o=>s({customSizeValue:o}),help:(0,e.__)("Use a CSS size such as 24px, 2rem, or 3em.","scroll-indicator")})]})]}),(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Show text","scroll-indicator"),checked:j,onChange:o=>s({showText:o})}),j&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Text","scroll-indicator"),value:f,onChange:o=>s({customText:o}),placeholder:(0,e.__)("Scroll down","scroll-indicator")})]}),(0,i.jsx)(l.PanelBody,{title:(0,e.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Hide after scrolling","scroll-indicator"),help:(0,e.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:v,onChange:o=>s({hideAfterScrolling:o})})})]}),(0,i.jsx)("div",{..._,children:(0,i.jsxs)("div",{className:`scroll-indicator icon-${m}`,children:[(0,i.jsx)(d,{iconType:m}),j&&(0,i.jsx)("div",{className:"scroll-text",children:f||(0,e.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:s="24px",hideAfterScrolling:n=!1,showText:c=!0,customText:u="Scroll down"}=o,h=a(e),x=t(l,s),p=u||"Scroll down",v=r.useBlockProps.save({style:{"--scroll-indicator-size":x}});return(0,i.jsx)("div",{...v,children:(0,i.jsxs)("button",{type:"button",className:`scroll-indicator icon-${h}`,"aria-label":p,"data-hide-after-scrolling":n?"true":"false",children:[(0,i.jsx)(d,{iconType:h}),c&&(0,i.jsx)("div",{className:"scroll-text",children:p})]})})}})}},r={};function l(o){var i=r[o];if(void 0!==i)return i.exports;var s=r[o]={exports:{}};return e[o](s,s.exports,l),s.exports}l.m=e,o=[],l.O=(e,r,i,s)=>{if(!r){var n=1/0;for(d=0;d=s)&&Object.keys(l.O).every(o=>l.O[o](r[c]))?r.splice(c--,1):(t=!1,s0&&o[d-1][2]>s;d--)o[d]=o[d-1];o[d]=[r,i,s]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,r)=>{var i,s,[n,t,c]=r,a=0;if(n.some(e=>0!==o[e])){for(i in t)l.o(t,i)&&(l.m[i]=t[i]);if(c)var d=c(l)}for(e&&e(r);al(280));i=l.O(i)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css new file mode 100644 index 0000000..8bb4e77 --- /dev/null +++ b/compiled/style-index-rtl.css @@ -0,0 +1 @@ +.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css new file mode 100644 index 0000000..8bb4e77 --- /dev/null +++ b/compiled/style-index.css @@ -0,0 +1 @@ +.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/view.asset.php b/compiled/view.asset.php new file mode 100644 index 0000000..8c59f3f --- /dev/null +++ b/compiled/view.asset.php @@ -0,0 +1 @@ + array(), 'version' => '04a12027677121da76eb'); diff --git a/compiled/view.js b/compiled/view.js new file mode 100644 index 0000000..70f55b9 --- /dev/null +++ b/compiled/view.js @@ -0,0 +1 @@ +document.addEventListener("DOMContentLoaded",function(){const t=document.querySelectorAll(".scroll-indicator");if(0===t.length)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");t.forEach(function(t){const i="true"===t.getAttribute("data-hide-after-scrolling"),n=t.closest(".wp-block-scroll-indicator-scroll-indicator"),o=t.getAttribute("tabindex");if(t.addEventListener("click",function(){const t=window.innerHeight,i=window.scrollY+t;window.scrollTo({top:i,behavior:e.matches?"auto":"smooth"})}),t.style.cursor="pointer",i&&n){let s=n.offsetTop,c=s+n.offsetHeight;function r(){const e=window.scrollY,i=window.innerHeight;var n;n=e<=s||se,t.style.transition=n?"opacity 0.3s ease-in":"opacity 0.3s ease-out",t.style.opacity=n?"1":"0",t.style.visibility=n?"visible":"hidden",t.style.pointerEvents=n?"auto":"none",n?(t.removeAttribute("aria-hidden"),null===o?t.removeAttribute("tabindex"):t.setAttribute("tabindex",o)):(t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","-1"),t.ownerDocument.activeElement===t&&t.blur())}window.addEventListener("resize",function(){s=n.offsetTop,c=s+n.offsetHeight,r()}),r(),window.addEventListener("scroll",r,{passive:!0})}})}); \ No newline at end of file diff --git a/package.json b/package.json index 403a98e..c9bab0f 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,15 @@ "description": "An animated scroll indicator with multiple icon styles that encourages users to scroll down the page.", "author": "Derek Hanson", "license": "GPL-2.0-or-later", - "main": "build/index.js", + "main": "compiled/index.js", "scripts": { - "build": "wp-scripts build --webpack-copy-php", + "build": "wp-scripts build --webpack-copy-php --output-path=compiled", "format": "wp-scripts format", - "lint:css": "wp-scripts lint-style", - "lint:js": "wp-scripts lint-js", + "lint:css": "wp-scripts lint-style \"src/**/*.scss\"", + "lint:js": "wp-scripts lint-js \"src/**/*.js\"", "packages-update": "wp-scripts packages-update", - "plugin-zip": "wp-scripts plugin-zip", - "start": "wp-scripts start --blocks-manifest" + "plugin-zip": "npx pressship pack . --no-validate", + "start": "wp-scripts start --blocks-manifest --output-path=compiled" }, "devDependencies": { "@wordpress/scripts": "^30.15.0" diff --git a/readme.txt b/readme.txt index a0672e7..1dbec5e 100644 --- a/readme.txt +++ b/readme.txt @@ -8,11 +8,11 @@ Stable tag: 1.0.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html -Add a polished, animated scroll indicator block that encourages visitors to keep moving through your page. +Add an animated scroll indicator block that encourages visitors to keep moving through your page. == Description == -Scroll Indicator adds a small, expressive Gutenberg block for landing pages, hero sections, editorial layouts, and long-form content. It gives visitors a clear visual cue that there is more to explore below the fold. +Scroll Indicator adds a focused block for landing pages, hero sections, editorial layouts, and long-form content. It gives visitors a clear visual cue that there is more to explore below the fold. Choose from multiple icon styles, adjust the size, use native WordPress text color controls, add optional helper text, and let visitors click or keyboard-activate the indicator to move smoothly down the page. @@ -29,6 +29,10 @@ The block is intentionally lightweight. Animations are handled with CSS, respect * Keyboard-accessible click-to-scroll interaction. * No animation libraries or heavy runtime dependencies. += Development = + +Source code and build tooling are maintained at https://github.com/dhanson-wp/scroll-indicator. + = Good For = * Landing page hero sections. diff --git a/scroll-indicator.php b/scroll-indicator.php index b58a921..281cff1 100644 --- a/scroll-indicator.php +++ b/scroll-indicator.php @@ -19,7 +19,7 @@ if ( ! function_exists( 'scroll_indicator_init' ) ) { function scroll_indicator_init() { - register_block_type( __DIR__ . '/build/' ); + register_block_type( __DIR__ . '/compiled/' ); } } add_action( 'init', 'scroll_indicator_init' ); diff --git a/src/edit.js b/src/edit.js index 396045a..2058f44 100644 --- a/src/edit.js +++ b/src/edit.js @@ -9,7 +9,12 @@ import { } from '@wordpress/components'; import './editor.scss'; -import { ICON_COMPONENTS, IconRenderer, getSizeValue } from './icons'; +import { + ICON_COMPONENTS, + IconRenderer, + getIconType, + getSizeValue, +} from './icons'; const ICON_OPTIONS = [ { value: 'mouse', label: __( 'Mouse', 'scroll-indicator' ) }, @@ -34,6 +39,7 @@ export default function Edit( { attributes, setAttributes } ) { customText = 'Scroll down', } = attributes; + const normalizedIconType = getIconType( iconType ); const sizeValue = getSizeValue( iconSize, customSizeValue ); const blockProps = useBlockProps( { @@ -159,8 +165,10 @@ export default function Edit( { attributes, setAttributes } ) {
-
- +
+ { showText && (
{ customText || diff --git a/src/icons.js b/src/icons.js index 12d2990..72fc2b6 100644 --- a/src/icons.js +++ b/src/icons.js @@ -1,8 +1,3 @@ -/** - * SVG icon components for the Scroll Indicator block. - * Shared between edit.js and save.js. - */ - export const SIZE_MAP = { S: '18px', M: '24px', @@ -10,9 +5,14 @@ export const SIZE_MAP = { XL: '48px', }; +const CSS_SIZE_PATTERN = /^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/; + export function getSizeValue( iconSize, customSizeValue ) { if ( iconSize === 'custom' ) { - return customSizeValue || '24px'; + const sizeValue = + typeof customSizeValue === 'string' ? customSizeValue.trim() : ''; + + return CSS_SIZE_PATTERN.test( sizeValue ) ? sizeValue : '24px'; } return SIZE_MAP[ iconSize ] || '24px'; } @@ -116,7 +116,13 @@ export const ICON_COMPONENTS = { 'hand-point': HandPointIcon, }; +export function getIconType( iconType ) { + return Object.prototype.hasOwnProperty.call( ICON_COMPONENTS, iconType ) + ? iconType + : 'mouse'; +} + export function IconRenderer( { iconType } ) { - const Component = ICON_COMPONENTS[ iconType ] || MouseIcon; + const Component = ICON_COMPONENTS[ getIconType( iconType ) ]; return ; } diff --git a/src/index.js b/src/index.js index ade1e47..a52f841 100644 --- a/src/index.js +++ b/src/index.js @@ -1,39 +1,11 @@ -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ import { registerBlockType } from '@wordpress/blocks'; - -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ import './style.scss'; -/** - * Internal dependencies - */ import Edit from './edit'; import save from './save'; import metadata from './block.json'; -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ registerBlockType( metadata.name, { - /** - * @see ./edit.js - */ edit: Edit, - - /** - * @see ./save.js - */ save, } ); diff --git a/src/save.js b/src/save.js index 6536f56..9353447 100644 --- a/src/save.js +++ b/src/save.js @@ -1,5 +1,5 @@ import { useBlockProps } from '@wordpress/block-editor'; -import { IconRenderer, getSizeValue } from './icons'; +import { IconRenderer, getIconType, getSizeValue } from './icons'; export default function save( { attributes } ) { const { @@ -11,7 +11,9 @@ export default function save( { attributes } ) { customText = 'Scroll down', } = attributes; + const normalizedIconType = getIconType( iconType ); const sizeValue = getSizeValue( iconSize, customSizeValue ); + const label = customText || 'Scroll down'; const blockProps = useBlockProps.save( { style: { @@ -21,22 +23,17 @@ export default function save( { attributes } ) { return (
-
- - { showText && ( -
- { customText || 'Scroll down' } -
- ) } -
+ + { showText &&
{ label }
} +
); } diff --git a/src/style.scss b/src/style.scss index cf51547..9a669fd 100644 --- a/src/style.scss +++ b/src/style.scss @@ -6,7 +6,17 @@ align-items: center; gap: 10px; padding: 20px; + border: 0; + background: transparent; + color: inherit; cursor: pointer; + font: inherit; + text-align: center; + + &:focus-visible { + outline: 2px solid currentcolor; + outline-offset: 4px; + } svg { width: var(--scroll-indicator-size, 24px); diff --git a/src/view.js b/src/view.js index 5ec9514..022fdc3 100644 --- a/src/view.js +++ b/src/view.js @@ -5,12 +5,17 @@ document.addEventListener( 'DOMContentLoaded', function () { return; } + const prefersReducedMotion = window.matchMedia( + '(prefers-reduced-motion: reduce)' + ); + scrollIndicators.forEach( function ( indicator ) { const hideAfterScrolling = indicator.getAttribute( 'data-hide-after-scrolling' ) === 'true'; const blockElement = indicator.closest( '.wp-block-scroll-indicator-scroll-indicator' ); + const originalTabIndex = indicator.getAttribute( 'tabindex' ); function scrollOneViewport() { const windowHeight = window.innerHeight; @@ -18,21 +23,12 @@ document.addEventListener( 'DOMContentLoaded', function () { window.scrollTo( { top: targetY, - behavior: 'smooth', + behavior: prefersReducedMotion.matches ? 'auto' : 'smooth', } ); } indicator.addEventListener( 'click', scrollOneViewport ); - indicator.addEventListener( 'keydown', function ( event ) { - if ( event.key !== 'Enter' && event.key !== ' ' ) { - return; - } - - event.preventDefault(); - scrollOneViewport(); - } ); - indicator.style.cursor = 'pointer'; if ( hideAfterScrolling && blockElement ) { @@ -44,7 +40,36 @@ document.addEventListener( 'DOMContentLoaded', function () { blockBottom = blockTop + blockElement.offsetHeight; } - window.addEventListener( 'resize', updateBlockPosition ); + function setIndicatorVisibility( isVisible ) { + indicator.style.transition = isVisible + ? 'opacity 0.3s ease-in' + : 'opacity 0.3s ease-out'; + indicator.style.opacity = isVisible ? '1' : '0'; + indicator.style.visibility = isVisible ? 'visible' : 'hidden'; + indicator.style.pointerEvents = isVisible ? 'auto' : 'none'; + + if ( isVisible ) { + indicator.removeAttribute( 'aria-hidden' ); + + if ( originalTabIndex === null ) { + indicator.removeAttribute( 'tabindex' ); + } else { + indicator.setAttribute( 'tabindex', originalTabIndex ); + } + } else { + indicator.setAttribute( 'aria-hidden', 'true' ); + indicator.setAttribute( 'tabindex', '-1' ); + + if ( indicator.ownerDocument.activeElement === indicator ) { + indicator.blur(); + } + } + } + + window.addEventListener( 'resize', function () { + updateBlockPosition(); + handleScroll(); + } ); function handleScroll() { const scrollTop = window.scrollY; @@ -55,11 +80,9 @@ document.addEventListener( 'DOMContentLoaded', function () { scrollTop <= blockTop || ( blockTop < viewportBottom && blockBottom > scrollTop ) ) { - indicator.style.transition = 'opacity 0.3s ease-in'; - indicator.style.opacity = '1'; + setIndicatorVisibility( true ); } else { - indicator.style.transition = 'opacity 0.3s ease-out'; - indicator.style.opacity = '0'; + setIndicatorVisibility( false ); } } From cabcffcf54a4184467b06c443932a964bca59864 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 14:07:26 -0500 Subject: [PATCH 02/12] Add scroll indicator positioning controls --- README.md | 1 + compiled/block.json | 10 +++++- compiled/index-rtl.css | 2 +- compiled/index.asset.php | 2 +- compiled/index.css | 2 +- compiled/index.js | 2 +- compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- readme.txt | 3 +- src/block.json | 10 +++++- src/edit.js | 68 ++++++++++++++++++++++++++++++++++++ src/editor.scss | 21 +++++------ src/index.js | 2 ++ src/position.js | 31 ++++++++++++++++ src/save.js | 4 +++ src/style.scss | 67 +++++++++++++++++++++++++++++++++++ 16 files changed, 208 insertions(+), 21 deletions(-) create mode 100644 src/position.js diff --git a/README.md b/README.md index d82b078..97c73fc 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Site builders can choose an icon style, tune the size and color, add optional te - Five animated icon styles: mouse, arrow, chevron, dots, and hand. - Preset sizes plus a custom CSS size value. - Native block editor support for text color, spacing, typography, and alignment. +- Optional absolute positioning for bottom-left, bottom-center, and bottom-right placement inside hero-style sections. - CSS-only animation that respects `prefers-reduced-motion`. - Optional helper text beneath the icon. - Optional hide-after-scrolling behavior. diff --git a/compiled/block.json b/compiled/block.json index bb345c0..36e9b63 100644 --- a/compiled/block.json +++ b/compiled/block.json @@ -5,7 +5,7 @@ "version": "1.0.0", "title": "Scroll Indicator", "category": "widgets", - "icon": "arrow-down", + "icon": "mouse", "description": "An animated scroll indicator with multiple icon styles that encourages users to scroll down the page.", "example": {}, "attributes": { @@ -32,6 +32,14 @@ "customText": { "type": "string", "default": "Scroll down" + }, + "positionMode": { + "type": "string", + "default": "flow" + }, + "screenPosition": { + "type": "string", + "default": "bottom-center" } }, "supports": { diff --git a/compiled/index-rtl.css b/compiled/index-rtl.css index 445b9ad..1f4705d 100644 --- a/compiled/index-rtl.css +++ b/compiled/index-rtl.css @@ -1 +1 @@ -.scroll-indicator-icon-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-picker{border:0;margin:0;padding:0}.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-position-buttons{display:grid;gap:4px;grid-template-columns:1fr} diff --git a/compiled/index.asset.php b/compiled/index.asset.php index d6d2448..efe023a 100644 --- a/compiled/index.asset.php +++ b/compiled/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '98dee282c70a217f3d0b'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'e2ecdd64d20cceae93c8'); diff --git a/compiled/index.css b/compiled/index.css index 445b9ad..1f4705d 100644 --- a/compiled/index.css +++ b/compiled/index.css @@ -1 +1 @@ -.scroll-indicator-icon-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-picker{border:0;margin:0;padding:0}.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-position-buttons{display:grid;gap:4px;grid-template-columns:1fr} diff --git a/compiled/index.js b/compiled/index.js index 9ebf4c7..8c22aaa 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var o,e={280(){const o=window.wp.blocks,e=window.wp.i18n,r=window.wp.blockEditor,l=window.wp.components,i=window.ReactJSXRuntime,s={S:"18px",M:"24px",L:"32px",XL:"48px"},n=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function t(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return n.test(o)?o:"24px"}return s[o]||"24px"}const c={mouse:function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,i.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,i.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,i.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,i.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,i.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,i.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function a(o){return Object.prototype.hasOwnProperty.call(c,o)?o:"mouse"}function d({iconType:o}){const e=c[a(o)];return(0,i.jsx)(e,{})}const u=[{value:"mouse",label:(0,e.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,e.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,e.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,e.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,e.__)("Hand","scroll-indicator")}],h=["S","M","L","XL","custom"],x=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(x.UU,{edit:function({attributes:o,setAttributes:s}){const{iconType:n="mouse",iconSize:x="M",customSizeValue:p="24px",hideAfterScrolling:v=!1,showText:j=!0,customText:f="Scroll down"}=o,m=a(n),w=t(x,p),_=(0,r.useBlockProps)({style:{"--scroll-indicator-size":w}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.InspectorControls,{children:[(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,i.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Icon Type","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:u.map(o=>{const e=c[o.value];return(0,i.jsx)(l.Button,{className:"scroll-indicator-icon-button",isPressed:n===o.value,onClick:()=>s({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,i.jsx)(e,{})},o.value)})})]}),(0,i.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Size","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-size-buttons",children:h.map(o=>(0,i.jsx)(l.Button,{isPressed:x===o,onClick:()=>s({iconSize:o}),children:"custom"===o?(0,e.__)("Custom","scroll-indicator"):o},o))}),"custom"===x&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Size","scroll-indicator"),value:p,onChange:o=>s({customSizeValue:o}),help:(0,e.__)("Use a CSS size such as 24px, 2rem, or 3em.","scroll-indicator")})]})]}),(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Show text","scroll-indicator"),checked:j,onChange:o=>s({showText:o})}),j&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Text","scroll-indicator"),value:f,onChange:o=>s({customText:o}),placeholder:(0,e.__)("Scroll down","scroll-indicator")})]}),(0,i.jsx)(l.PanelBody,{title:(0,e.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Hide after scrolling","scroll-indicator"),help:(0,e.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:v,onChange:o=>s({hideAfterScrolling:o})})})]}),(0,i.jsx)("div",{..._,children:(0,i.jsxs)("div",{className:`scroll-indicator icon-${m}`,children:[(0,i.jsx)(d,{iconType:m}),j&&(0,i.jsx)("div",{className:"scroll-text",children:f||(0,e.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:s="24px",hideAfterScrolling:n=!1,showText:c=!0,customText:u="Scroll down"}=o,h=a(e),x=t(l,s),p=u||"Scroll down",v=r.useBlockProps.save({style:{"--scroll-indicator-size":x}});return(0,i.jsx)("div",{...v,children:(0,i.jsxs)("button",{type:"button",className:`scroll-indicator icon-${h}`,"aria-label":p,"data-hide-after-scrolling":n?"true":"false",children:[(0,i.jsx)(d,{iconType:h}),c&&(0,i.jsx)("div",{className:"scroll-text",children:p})]})})}})}},r={};function l(o){var i=r[o];if(void 0!==i)return i.exports;var s=r[o]={exports:{}};return e[o](s,s.exports,l),s.exports}l.m=e,o=[],l.O=(e,r,i,s)=>{if(!r){var n=1/0;for(d=0;d=s)&&Object.keys(l.O).every(o=>l.O[o](r[c]))?r.splice(c--,1):(t=!1,s0&&o[d-1][2]>s;d--)o[d]=o[d-1];o[d]=[r,i,s]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,r)=>{var i,s,[n,t,c]=r,a=0;if(n.some(e=>0!==o[e])){for(i in t)l.o(t,i)&&(l.m[i]=t[i]);if(c)var d=c(l)}for(e&&e(r);al(280));i=l.O(i)})(); \ No newline at end of file +(()=>{"use strict";var o,e={805(){const o=window.wp.blocks,e=window.wp.i18n,t=window.wp.blockEditor,l=window.wp.components,i=window.ReactJSXRuntime,r={S:"18px",M:"24px",L:"32px",XL:"48px"},n=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function s(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return n.test(o)?o:"24px"}return r[o]||"24px"}function c(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,i.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})}const a={mouse:c,"arrow-down":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,i.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,i.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,i.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,i.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,i.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function d(o){return Object.prototype.hasOwnProperty.call(a,o)?o:"mouse"}function u({iconType:o}){const e=a[d(o)];return(0,i.jsx)(e,{})}const h={flow:"flow",absolute:"absolute"},x={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"};function p(o){return h[o]||h.flow}function b(o){return x[o]||x["bottom-center"]}function m(o,e){return"absolute"!==p(o)?"":`is-position-absolute is-screen-position-${b(e)}`}const f=[{value:"mouse",label:(0,e.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,e.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,e.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,e.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,e.__)("Hand","scroll-indicator")}],v=["S","M","L","XL","custom"],j=[{value:"bottom-left",label:(0,e.__)("Bottom left","scroll-indicator")},{value:"bottom-center",label:(0,e.__)("Bottom center","scroll-indicator")},{value:"bottom-right",label:(0,e.__)("Bottom right","scroll-indicator")}],_=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(_.UU,{icon:(0,i.jsx)(c,{}),edit:function({attributes:o,setAttributes:r}){const{iconType:n="mouse",iconSize:c="M",customSizeValue:h="24px",hideAfterScrolling:x=!1,showText:_=!0,customText:w="Scroll down",positionMode:g="flow",screenPosition:k="bottom-center"}=o,y=d(n),C=s(c,h),S=p(g),T=b(k),B=(0,t.useBlockProps)({className:m(S,T),style:{"--scroll-indicator-size":C}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.InspectorControls,{children:[(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,i.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Icon Type","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:f.map(o=>{const e=a[o.value];return(0,i.jsx)(l.Button,{className:"scroll-indicator-icon-button",isPressed:n===o.value,onClick:()=>r({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,i.jsx)(e,{})},o.value)})})]}),(0,i.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Size","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-size-buttons",children:v.map(o=>(0,i.jsx)(l.Button,{isPressed:c===o,onClick:()=>r({iconSize:o}),children:"custom"===o?(0,e.__)("Custom","scroll-indicator"):o},o))}),"custom"===c&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Size","scroll-indicator"),value:h,onChange:o=>r({customSizeValue:o}),help:(0,e.__)("Use a CSS size such as 24px, 2rem, or 3em.","scroll-indicator")})]})]}),(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Use absolute positioning","scroll-indicator"),help:(0,e.__)("Pin the indicator to the bottom of its containing section, such as a Cover block.","scroll-indicator"),checked:"absolute"===S,onChange:o=>r({positionMode:o?"absolute":"flow"})}),"absolute"===S&&(0,i.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Screen Position","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-position-buttons",children:j.map(o=>(0,i.jsx)(l.Button,{isPressed:T===o.value,onClick:()=>r({screenPosition:o.value}),children:o.label},o.value))})]})]}),(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Show text","scroll-indicator"),checked:_,onChange:o=>r({showText:o})}),_&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Text","scroll-indicator"),value:w,onChange:o=>r({customText:o}),placeholder:(0,e.__)("Scroll down","scroll-indicator")})]}),(0,i.jsx)(l.PanelBody,{title:(0,e.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Hide after scrolling","scroll-indicator"),help:(0,e.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:x,onChange:o=>r({hideAfterScrolling:o})})})]}),(0,i.jsx)("div",{...B,children:(0,i.jsxs)("div",{className:`scroll-indicator icon-${y}`,children:[(0,i.jsx)(u,{iconType:y}),_&&(0,i.jsx)("div",{className:"scroll-text",children:w||(0,e.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:r="24px",hideAfterScrolling:n=!1,showText:c=!0,customText:a="Scroll down",positionMode:h="flow",screenPosition:x="bottom-center"}=o,p=d(e),b=s(l,r),f=a||"Scroll down",v=t.useBlockProps.save({className:m(h,x),style:{"--scroll-indicator-size":b}});return(0,i.jsx)("div",{...v,children:(0,i.jsxs)("button",{type:"button",className:`scroll-indicator icon-${p}`,"aria-label":f,"data-hide-after-scrolling":n?"true":"false",children:[(0,i.jsx)(u,{iconType:p}),c&&(0,i.jsx)("div",{className:"scroll-text",children:f})]})})}})}},t={};function l(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,l),r.exports}l.m=e,o=[],l.O=(e,t,i,r)=>{if(!t){var n=1/0;for(d=0;d=r)&&Object.keys(l.O).every(o=>l.O[o](t[c]))?t.splice(c--,1):(s=!1,r0&&o[d-1][2]>r;d--)o[d]=o[d-1];o[d]=[t,i,r]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,t)=>{var i,r,[n,s,c]=t,a=0;if(n.some(e=>0!==o[e])){for(i in s)l.o(s,i)&&(l.m[i]=s[i]);if(c)var d=c(l)}for(e&&e(t);al(805));i=l.O(i)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css index 8bb4e77..ab30730 100644 --- a/compiled/style-index-rtl.css +++ b/compiled/style-index-rtl.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:absolute;left:auto;transform:translateX(50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index 8bb4e77..908a804 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:absolute;right:auto;transform:translateX(-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/readme.txt b/readme.txt index 1dbec5e..6e2b3ea 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: derekhanson Tags: block, scroll, animation, indicator, gutenberg Requires at least: 6.4 -Tested up to: 6.9 +Tested up to: 7.0 Requires PHP: 7.4 Stable tag: 1.0.0 License: GPLv2 or later @@ -23,6 +23,7 @@ The block is intentionally lightweight. Animations are handled with CSS, respect * Five icon styles: mouse, arrow, chevron, dots, and hand. * Preset sizes plus a custom CSS size value. * Native block editor controls for text color, spacing, typography, and alignment. +* Optional absolute positioning for bottom-left, bottom-center, and bottom-right placement inside hero-style sections. * CSS-only animation that respects the visitor's reduced-motion preference. * Optional text label beneath the icon. * Optional hide-after-scrolling behavior. diff --git a/src/block.json b/src/block.json index 1696f72..f0ef057 100644 --- a/src/block.json +++ b/src/block.json @@ -5,7 +5,7 @@ "version": "1.0.0", "title": "Scroll Indicator", "category": "widgets", - "icon": "arrow-down", + "icon": "mouse", "description": "An animated scroll indicator with multiple icon styles that encourages users to scroll down the page.", "example": {}, "attributes": { @@ -32,6 +32,14 @@ "customText": { "type": "string", "default": "Scroll down" + }, + "positionMode": { + "type": "string", + "default": "flow" + }, + "screenPosition": { + "type": "string", + "default": "bottom-center" } }, "supports": { diff --git a/src/edit.js b/src/edit.js index 2058f44..32545fb 100644 --- a/src/edit.js +++ b/src/edit.js @@ -15,6 +15,11 @@ import { getIconType, getSizeValue, } from './icons'; +import { + getPositionClassNames, + getPositionMode, + getScreenPosition, +} from './position'; const ICON_OPTIONS = [ { value: 'mouse', label: __( 'Mouse', 'scroll-indicator' ) }, @@ -29,6 +34,15 @@ const ICON_OPTIONS = [ const SIZE_OPTIONS = [ 'S', 'M', 'L', 'XL', 'custom' ]; +const SCREEN_POSITION_OPTIONS = [ + { value: 'bottom-left', label: __( 'Bottom left', 'scroll-indicator' ) }, + { + value: 'bottom-center', + label: __( 'Bottom center', 'scroll-indicator' ), + }, + { value: 'bottom-right', label: __( 'Bottom right', 'scroll-indicator' ) }, +]; + export default function Edit( { attributes, setAttributes } ) { const { iconType = 'mouse', @@ -37,12 +51,20 @@ export default function Edit( { attributes, setAttributes } ) { hideAfterScrolling = false, showText = true, customText = 'Scroll down', + positionMode = 'flow', + screenPosition = 'bottom-center', } = attributes; const normalizedIconType = getIconType( iconType ); const sizeValue = getSizeValue( iconSize, customSizeValue ); + const normalizedPositionMode = getPositionMode( positionMode ); + const normalizedScreenPosition = getScreenPosition( screenPosition ); const blockProps = useBlockProps( { + className: getPositionClassNames( + normalizedPositionMode, + normalizedScreenPosition + ), style: { '--scroll-indicator-size': sizeValue, }, @@ -119,6 +141,52 @@ export default function Edit( { attributes, setAttributes } ) { ) } + + + setAttributes( { + positionMode: value ? 'absolute' : 'flow', + } ) + } + /> + { normalizedPositionMode === 'absolute' && ( +
+ + { __( 'Screen Position', 'scroll-indicator' ) } + + + { SCREEN_POSITION_OPTIONS.map( ( option ) => ( + + ) ) } + +
+ ) } +
, edit: Edit, save, } ); diff --git a/src/position.js b/src/position.js new file mode 100644 index 0000000..055ba72 --- /dev/null +++ b/src/position.js @@ -0,0 +1,31 @@ +const POSITION_MODE_MAP = { + flow: 'flow', + absolute: 'absolute', +}; + +const SCREEN_POSITION_MAP = { + 'bottom-left': 'bottom-left', + 'bottom-center': 'bottom-center', + 'bottom-right': 'bottom-right', +}; + +export function getPositionMode( positionMode ) { + return POSITION_MODE_MAP[ positionMode ] || POSITION_MODE_MAP.flow; +} + +export function getScreenPosition( screenPosition ) { + return ( + SCREEN_POSITION_MAP[ screenPosition ] || + SCREEN_POSITION_MAP[ 'bottom-center' ] + ); +} + +export function getPositionClassNames( positionMode, screenPosition ) { + if ( getPositionMode( positionMode ) !== 'absolute' ) { + return ''; + } + + return `is-position-absolute is-screen-position-${ getScreenPosition( + screenPosition + ) }`; +} diff --git a/src/save.js b/src/save.js index 9353447..44ac1c3 100644 --- a/src/save.js +++ b/src/save.js @@ -1,5 +1,6 @@ import { useBlockProps } from '@wordpress/block-editor'; import { IconRenderer, getIconType, getSizeValue } from './icons'; +import { getPositionClassNames } from './position'; export default function save( { attributes } ) { const { @@ -9,6 +10,8 @@ export default function save( { attributes } ) { hideAfterScrolling = false, showText = true, customText = 'Scroll down', + positionMode = 'flow', + screenPosition = 'bottom-center', } = attributes; const normalizedIconType = getIconType( iconType ); @@ -16,6 +19,7 @@ export default function save( { attributes } ) { const label = customText || 'Scroll down'; const blockProps = useBlockProps.save( { + className: getPositionClassNames( positionMode, screenPosition ), style: { '--scroll-indicator-size': sizeValue, }, diff --git a/src/style.scss b/src/style.scss index 9a669fd..e50f9a4 100644 --- a/src/style.scss +++ b/src/style.scss @@ -1,10 +1,63 @@ .wp-block-scroll-indicator-scroll-indicator { + box-sizing: border-box; + display: flex; + justify-content: center; + max-width: 100%; + width: 100%; + + &.alignleft, + &.aligncenter, + &.alignright { + float: none; + } + + &.alignleft { + justify-content: flex-start; + } + + &.aligncenter { + justify-content: center; + } + + &.alignright { + justify-content: flex-end; + } + + &.is-position-absolute { + bottom: clamp(16px, 4vw, 32px); + left: 50%; + margin: 0; + position: absolute; + right: auto; + transform: translateX(-50%); + width: auto; + z-index: 2; + } + + &.is-screen-position-bottom-left { + left: clamp(16px, 4vw, 32px); + right: auto; + transform: none; + } + + &.is-screen-position-bottom-center { + left: 50%; + right: auto; + transform: translateX(-50%); + } + + &.is-screen-position-bottom-right { + left: auto; + right: clamp(16px, 4vw, 32px); + transform: none; + } .scroll-indicator { display: flex; flex-direction: column; align-items: center; gap: 10px; + max-width: 100%; padding: 20px; border: 0; background: transparent; @@ -32,6 +85,20 @@ } } +.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { + position: relative; + + // Pin absolute indicators to the full Cover instead of the inner content box. + > .wp-block-cover__inner-container { + position: static; + + > :not(.wp-block-scroll-indicator-scroll-indicator) { + position: relative; + z-index: 1; + } + } +} + // Animations — only when user hasn't requested reduced motion @media (prefers-reduced-motion: no-preference) { From 69b86c7a653d7026a5750116a5adaf31fb137cac Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 14:39:10 -0500 Subject: [PATCH 03/12] Correct fixed and absolute positioning controls --- README.md | 2 +- compiled/block.json | 10 +- compiled/index-rtl.css | 2 +- compiled/index.asset.php | 2 +- compiled/index.css | 2 +- compiled/index.js | 2 +- compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- package-lock.json | 62 ++++++++-- package.json | 1 + readme.txt | 2 +- src/block.json | 10 +- src/edit.js | 218 +++++++++++++++++++++++++++++------ src/editor.scss | 31 ++++- src/index.js | 4 +- src/position.js | 39 ++++++- src/save.js | 5 +- src/style.scss | 27 ++++- 18 files changed, 355 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index 97c73fc..54dca36 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Site builders can choose an icon style, tune the size and color, add optional te - Five animated icon styles: mouse, arrow, chevron, dots, and hand. - Preset sizes plus a custom CSS size value. - Native block editor support for text color, spacing, typography, and alignment. -- Optional absolute positioning for bottom-left, bottom-center, and bottom-right placement inside hero-style sections. +- Fixed screen positioning and draggable absolute positioning for hero-style sections. - CSS-only animation that respects `prefers-reduced-motion`. - Optional helper text beneath the icon. - Optional hide-after-scrolling behavior. diff --git a/compiled/block.json b/compiled/block.json index 36e9b63..521073a 100644 --- a/compiled/block.json +++ b/compiled/block.json @@ -5,7 +5,7 @@ "version": "1.0.0", "title": "Scroll Indicator", "category": "widgets", - "icon": "mouse", + "icon": "arrow-down", "description": "An animated scroll indicator with multiple icon styles that encourages users to scroll down the page.", "example": {}, "attributes": { @@ -40,6 +40,14 @@ "screenPosition": { "type": "string", "default": "bottom-center" + }, + "absoluteX": { + "type": "number", + "default": 50 + }, + "absoluteY": { + "type": "number", + "default": 85 } }, "supports": { diff --git a/compiled/index-rtl.css b/compiled/index-rtl.css index 1f4705d..dd78012 100644 --- a/compiled/index-rtl.css +++ b/compiled/index-rtl.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-position-buttons{display:grid;gap:4px;grid-template-columns:1fr} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px} diff --git a/compiled/index.asset.php b/compiled/index.asset.php index efe023a..6498710 100644 --- a/compiled/index.asset.php +++ b/compiled/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'e2ecdd64d20cceae93c8'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '460f88ec8642d3b56b30'); diff --git a/compiled/index.css b/compiled/index.css index 1f4705d..cccbb48 100644 --- a/compiled/index.css +++ b/compiled/index.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-position-buttons{display:grid;gap:4px;grid-template-columns:1fr} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px} diff --git a/compiled/index.js b/compiled/index.js index 8c22aaa..1f24e99 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var o,e={805(){const o=window.wp.blocks,e=window.wp.i18n,t=window.wp.blockEditor,l=window.wp.components,i=window.ReactJSXRuntime,r={S:"18px",M:"24px",L:"32px",XL:"48px"},n=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function s(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return n.test(o)?o:"24px"}return r[o]||"24px"}function c(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,i.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})}const a={mouse:c,"arrow-down":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,i.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,i.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,i.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,i.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,i.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,i.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function d(o){return Object.prototype.hasOwnProperty.call(a,o)?o:"mouse"}function u({iconType:o}){const e=a[d(o)];return(0,i.jsx)(e,{})}const h={flow:"flow",absolute:"absolute"},x={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"};function p(o){return h[o]||h.flow}function b(o){return x[o]||x["bottom-center"]}function m(o,e){return"absolute"!==p(o)?"":`is-position-absolute is-screen-position-${b(e)}`}const f=[{value:"mouse",label:(0,e.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,e.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,e.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,e.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,e.__)("Hand","scroll-indicator")}],v=["S","M","L","XL","custom"],j=[{value:"bottom-left",label:(0,e.__)("Bottom left","scroll-indicator")},{value:"bottom-center",label:(0,e.__)("Bottom center","scroll-indicator")},{value:"bottom-right",label:(0,e.__)("Bottom right","scroll-indicator")}],_=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(_.UU,{icon:(0,i.jsx)(c,{}),edit:function({attributes:o,setAttributes:r}){const{iconType:n="mouse",iconSize:c="M",customSizeValue:h="24px",hideAfterScrolling:x=!1,showText:_=!0,customText:w="Scroll down",positionMode:g="flow",screenPosition:k="bottom-center"}=o,y=d(n),C=s(c,h),S=p(g),T=b(k),B=(0,t.useBlockProps)({className:m(S,T),style:{"--scroll-indicator-size":C}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.InspectorControls,{children:[(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,i.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Icon Type","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:f.map(o=>{const e=a[o.value];return(0,i.jsx)(l.Button,{className:"scroll-indicator-icon-button",isPressed:n===o.value,onClick:()=>r({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,i.jsx)(e,{})},o.value)})})]}),(0,i.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Size","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-size-buttons",children:v.map(o=>(0,i.jsx)(l.Button,{isPressed:c===o,onClick:()=>r({iconSize:o}),children:"custom"===o?(0,e.__)("Custom","scroll-indicator"):o},o))}),"custom"===c&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Size","scroll-indicator"),value:h,onChange:o=>r({customSizeValue:o}),help:(0,e.__)("Use a CSS size such as 24px, 2rem, or 3em.","scroll-indicator")})]})]}),(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Use absolute positioning","scroll-indicator"),help:(0,e.__)("Pin the indicator to the bottom of its containing section, such as a Cover block.","scroll-indicator"),checked:"absolute"===S,onChange:o=>r({positionMode:o?"absolute":"flow"})}),"absolute"===S&&(0,i.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,i.jsx)("legend",{children:(0,e.__)("Screen Position","scroll-indicator")}),(0,i.jsx)(l.ButtonGroup,{className:"scroll-indicator-position-buttons",children:j.map(o=>(0,i.jsx)(l.Button,{isPressed:T===o.value,onClick:()=>r({screenPosition:o.value}),children:o.label},o.value))})]})]}),(0,i.jsxs)(l.PanelBody,{title:(0,e.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Show text","scroll-indicator"),checked:_,onChange:o=>r({showText:o})}),_&&(0,i.jsx)(l.TextControl,{label:(0,e.__)("Custom Text","scroll-indicator"),value:w,onChange:o=>r({customText:o}),placeholder:(0,e.__)("Scroll down","scroll-indicator")})]}),(0,i.jsx)(l.PanelBody,{title:(0,e.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,i.jsx)(l.ToggleControl,{label:(0,e.__)("Hide after scrolling","scroll-indicator"),help:(0,e.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:x,onChange:o=>r({hideAfterScrolling:o})})})]}),(0,i.jsx)("div",{...B,children:(0,i.jsxs)("div",{className:`scroll-indicator icon-${y}`,children:[(0,i.jsx)(u,{iconType:y}),_&&(0,i.jsx)("div",{className:"scroll-text",children:w||(0,e.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:r="24px",hideAfterScrolling:n=!1,showText:c=!0,customText:a="Scroll down",positionMode:h="flow",screenPosition:x="bottom-center"}=o,p=d(e),b=s(l,r),f=a||"Scroll down",v=t.useBlockProps.save({className:m(h,x),style:{"--scroll-indicator-size":b}});return(0,i.jsx)("div",{...v,children:(0,i.jsxs)("button",{type:"button",className:`scroll-indicator icon-${p}`,"aria-label":f,"data-hide-after-scrolling":n?"true":"false",children:[(0,i.jsx)(u,{iconType:p}),c&&(0,i.jsx)("div",{className:"scroll-text",children:f})]})})}})}},t={};function l(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,l),r.exports}l.m=e,o=[],l.O=(e,t,i,r)=>{if(!t){var n=1/0;for(d=0;d=r)&&Object.keys(l.O).every(o=>l.O[o](t[c]))?t.splice(c--,1):(s=!1,r0&&o[d-1][2]>r;d--)o[d]=o[d-1];o[d]=[t,i,r]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,t)=>{var i,r,[n,s,c]=t,a=0;if(n.some(e=>0!==o[e])){for(i in s)l.o(s,i)&&(l.m[i]=s[i]);if(c)var d=c(l)}for(e&&e(t);al(805));i=l.O(i)})(); \ No newline at end of file +(()=>{"use strict";var o,e={811(){const o=window.wp.blocks,e=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function p(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return v.test(o)?o:"24px"}return x[o]||"24px"}const m={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function w(o){return Object.prototype.hasOwnProperty.call(m,o)?o:"mouse"}function b({iconType:o}){const e=m[w(o)];return(0,t.jsx)(e,{})}const f={flow:"flow",fixed:"fixed",absolute:"absolute"},j={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"};function _(o){return f[o]||f.flow}function g(o){return j[o]||j["bottom-center"]}function k(o,e){const t="number"==typeof o?o:Number.parseFloat(o);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):e}function y(o,e){const t=_(o);return"fixed"===t?`is-position-fixed is-screen-position-${g(e)}`:"absolute"===t?"is-position-absolute":""}function B(o,e,t){return"absolute"!==_(o)?{}:{"--scroll-indicator-x":`${k(e,50)}%`,"--scroll-indicator-y":`${k(t,85)}%`}}const S=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],C=["S","M","L","XL","custom"],M=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],N=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],P=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(P.UU,{icon:i,edit:function({attributes:o,setAttributes:e}){const{iconType:i="mouse",iconSize:s="M",customSizeValue:c="24px",hideAfterScrolling:a=!1,showText:x=!0,customText:v="Scroll down",positionMode:f="flow",screenPosition:j="bottom-center",absoluteX:P=50,absoluteY:V=85}=o,T=(0,r.useRef)(),z=w(i),H=p(s,c),O=_(f),L=g(j),G=k(P,50),Z=k(V,85);function X(o){const t=T.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&e({absoluteX:k((o.clientX-l.left)/l.width*100,50),absoluteY:k((o.clientY-l.top)/l.height*100,85)})}const E=(0,n.useBlockProps)({ref:T,className:y(O,L),style:{"--scroll-indicator-size":H,...B(O,G,Z)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:S.map(o=>{const l=m[o.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:i===o.value,onClick:()=>e({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,t.jsx)(l,{})},o.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Size","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-size-buttons",children:C.map(o=>(0,t.jsx)(h.Button,{isPressed:s===o,onClick:()=>e({iconSize:o}),children:"custom"===o?(0,l.__)("Custom","scroll-indicator"):o},o))}),"custom"===s&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Size","scroll-indicator"),value:c,onChange:o=>e({customSizeValue:o}),help:(0,l.__)("Use a CSS size such as 24px, 2rem, or 3em.","scroll-indicator")})]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:M.map(o=>(0,t.jsx)(h.Button,{isPressed:O===o.value,onClick:()=>e({positionMode:o.value}),children:o.label},o.value))})]}),"fixed"===O&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:N.map(o=>{const i=o.icon;return(0,t.jsx)(h.Button,{icon:i,label:o.label,showTooltip:!0,isPressed:L===o.value,onClick:()=>e({screenPosition:o.value})},o.value)})})]}),"absolute"===O&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:G,min:0,max:100,onChange:o=>e({absoluteX:o})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:Z,min:0,max:100,onChange:o=>e({absoluteY:o})})]}),"fixed"===O&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:x,onChange:o=>e({showText:o})}),x&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:v,onChange:o=>e({customText:o}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]}),(0,t.jsx)(h.PanelBody,{title:(0,l.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Hide after scrolling","scroll-indicator"),help:(0,l.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:a,onChange:o=>e({hideAfterScrolling:o})})})]}),(0,t.jsx)("div",{...E,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${z}`,onPointerDown:function(o){if("absolute"!==O||0!==o.button)return;o.preventDefault(),o.stopPropagation(),X(o);const e=o.currentTarget.ownerDocument,t=o=>{X(o)},i=()=>{e.removeEventListener("pointermove",t),e.removeEventListener("pointerup",i)};e.addEventListener("pointermove",t),e.addEventListener("pointerup",i)},children:[(0,t.jsx)(b,{iconType:z}),x&&(0,t.jsx)("div",{className:"scroll-text",children:v||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:i="M",customSizeValue:l="24px",hideAfterScrolling:r=!1,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85}=o,x=w(e),v=p(i,l),m=c||"Scroll down",f=n.useBlockProps.save({className:y(a,d),style:{"--scroll-indicator-size":v,...B(a,u,h)}});return(0,t.jsx)("div",{...f,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${x}`,"aria-label":m,"data-hide-after-scrolling":r?"true":"false",children:[(0,t.jsx)(b,{iconType:x}),s&&(0,t.jsx)("div",{className:"scroll-text",children:m})]})})}})}},t={};function i(o){var l=t[o];if(void 0!==l)return l.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,i),n.exports}i.m=e,o=[],i.O=(e,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(o=>i.O[o](t[c]))?t.splice(c--,1):(s=!1,n0&&o[d-1][2]>n;d--)o[d]=o[d-1];o[d]=[t,l,n]},i.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};i.O.j=e=>0===o[e];var e=(e,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(e=>0!==o[e])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(e&&e(t);ai(811));l=i.O(l)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css index ab30730..ae9fa97 100644 --- a/compiled/style-index-rtl.css +++ b/compiled/style-index-rtl.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:absolute;left:auto;transform:translateX(50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index 908a804..a78adac 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:absolute;right:auto;transform:translateX(-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/package-lock.json b/package-lock.json index 8f58469..78282ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "GPL-2.0-or-later", "devDependencies": { + "@wordpress/icons": "^13.1.0", "@wordpress/scripts": "^30.15.0" } }, @@ -6018,15 +6019,15 @@ } }, "node_modules/@wordpress/element": { - "version": "6.40.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-6.40.0.tgz", - "integrity": "sha512-OhU8B2xEGg7c41rh/VRiJLOz6TnM/r5r8sraAg5ISc2bF7s2oAFqLwvlR0/U6ervyYwbK644osWZGQxFyL3huA==", + "version": "6.46.0", + "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-6.46.0.tgz", + "integrity": "sha512-hjnrqZi0cZVdkmN0xQavKfSQJYAkb9pVSnDPpuX65OLxeD9/EWkIXvFzBb+nH8c4NzKKSqQU96XCTQrH37OCIA==", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { "@types/react": "^18.3.27", "@types/react-dom": "^18.3.1", - "@wordpress/escape-html": "^3.40.0", + "@wordpress/escape-html": "^3.46.0", "change-case": "^4.1.2", "is-plain-object": "^5.0.0", "react": "^18.3.0", @@ -6038,9 +6039,9 @@ } }, "node_modules/@wordpress/escape-html": { - "version": "3.40.0", - "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-3.40.0.tgz", - "integrity": "sha512-DD6xWVbnw4fGGgO6DFDTJiLj52om0OG4cYHLz7ZhuipmOlEUGljPYOcrj8uxtlh5EFrqHCIPkOya+qQXUHUSBw==", + "version": "3.46.0", + "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-3.46.0.tgz", + "integrity": "sha512-SzrVQwLQBZdaSStYVpTKeYqp97NABz1w551T8me3msDDsfhWWPhSZiZTNaGZ6iqUNfOX2uKyZsqXedvkqwLHqA==", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -6110,6 +6111,25 @@ "node": ">=10" } }, + "node_modules/@wordpress/icons": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-13.1.0.tgz", + "integrity": "sha512-KMZAeYghsLs6e5wKMZ3/Ynrsuu5yZt2gAlMHmZSkWJKQFld++Pz/pEj8nDCJ79z/zx9FO7q4teG49vHHvVosjQ==", + "dev": true, + "license": "GPL-2.0-or-later", + "dependencies": { + "@wordpress/element": "^6.46.0", + "@wordpress/primitives": "^4.46.0", + "change-case": "4.1.2" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "peerDependencies": { + "react": "^18.0.0" + } + }, "node_modules/@wordpress/jest-console": { "version": "8.40.0", "resolved": "https://registry.npmjs.org/@wordpress/jest-console/-/jest-console-8.40.0.tgz", @@ -6194,6 +6214,24 @@ "prettier": ">=3" } }, + "node_modules/@wordpress/primitives": { + "version": "4.46.0", + "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-4.46.0.tgz", + "integrity": "sha512-x1IhEVa/aGDe6otGJ4VIqEioQGfIeK5B1VQm32+ycqinJRbtbw9F5bgx4ARIdnm5M1Lg63oV9Bhmg/XMyGSTZA==", + "dev": true, + "license": "GPL-2.0-or-later", + "dependencies": { + "@wordpress/element": "^6.46.0", + "clsx": "^2.1.1" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "peerDependencies": { + "react": "^18.0.0" + } + }, "node_modules/@wordpress/private-apis": { "version": "1.40.0", "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-1.40.0.tgz", @@ -7978,6 +8016,16 @@ "node": ">=0.10.0" } }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", diff --git a/package.json b/package.json index c9bab0f..6e43339 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "start": "wp-scripts start --blocks-manifest --output-path=compiled" }, "devDependencies": { + "@wordpress/icons": "^13.1.0", "@wordpress/scripts": "^30.15.0" } } diff --git a/readme.txt b/readme.txt index 6e2b3ea..2338e18 100644 --- a/readme.txt +++ b/readme.txt @@ -23,7 +23,7 @@ The block is intentionally lightweight. Animations are handled with CSS, respect * Five icon styles: mouse, arrow, chevron, dots, and hand. * Preset sizes plus a custom CSS size value. * Native block editor controls for text color, spacing, typography, and alignment. -* Optional absolute positioning for bottom-left, bottom-center, and bottom-right placement inside hero-style sections. +* Fixed screen positioning and draggable absolute positioning for hero-style sections. * CSS-only animation that respects the visitor's reduced-motion preference. * Optional text label beneath the icon. * Optional hide-after-scrolling behavior. diff --git a/src/block.json b/src/block.json index f0ef057..8dcf252 100644 --- a/src/block.json +++ b/src/block.json @@ -5,7 +5,7 @@ "version": "1.0.0", "title": "Scroll Indicator", "category": "widgets", - "icon": "mouse", + "icon": "arrow-down", "description": "An animated scroll indicator with multiple icon styles that encourages users to scroll down the page.", "example": {}, "attributes": { @@ -40,6 +40,14 @@ "screenPosition": { "type": "string", "default": "bottom-center" + }, + "absoluteX": { + "type": "number", + "default": 50 + }, + "absoluteY": { + "type": "number", + "default": 85 } }, "supports": { diff --git a/src/edit.js b/src/edit.js index 32545fb..ede7423 100644 --- a/src/edit.js +++ b/src/edit.js @@ -1,11 +1,20 @@ import { __ } from '@wordpress/i18n'; import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; +import { useRef } from '@wordpress/element'; +import { + desktop, + dragHandle, + positionCenter, + positionLeft, + positionRight, +} from '@wordpress/icons'; import { PanelBody, - ToggleControl, TextControl, + ToggleControl, ButtonGroup, Button, + RangeControl, } from '@wordpress/components'; import './editor.scss'; @@ -18,6 +27,8 @@ import { import { getPositionClassNames, getPositionMode, + getPositionStyle, + getAbsoluteCoordinate, getScreenPosition, } from './position'; @@ -34,13 +45,28 @@ const ICON_OPTIONS = [ const SIZE_OPTIONS = [ 'S', 'M', 'L', 'XL', 'custom' ]; +const POSITION_MODE_OPTIONS = [ + { value: 'flow', label: __( 'Flow', 'scroll-indicator' ) }, + { value: 'fixed', label: __( 'Fixed', 'scroll-indicator' ) }, + { value: 'absolute', label: __( 'Absolute', 'scroll-indicator' ) }, +]; + const SCREEN_POSITION_OPTIONS = [ - { value: 'bottom-left', label: __( 'Bottom left', 'scroll-indicator' ) }, + { + value: 'bottom-left', + label: __( 'Bottom left', 'scroll-indicator' ), + icon: positionLeft, + }, { value: 'bottom-center', label: __( 'Bottom center', 'scroll-indicator' ), + icon: positionCenter, + }, + { + value: 'bottom-right', + label: __( 'Bottom right', 'scroll-indicator' ), + icon: positionRight, }, - { value: 'bottom-right', label: __( 'Bottom right', 'scroll-indicator' ) }, ]; export default function Edit( { attributes, setAttributes } ) { @@ -53,20 +79,85 @@ export default function Edit( { attributes, setAttributes } ) { customText = 'Scroll down', positionMode = 'flow', screenPosition = 'bottom-center', + absoluteX = 50, + absoluteY = 85, } = attributes; + const blockRef = useRef(); const normalizedIconType = getIconType( iconType ); const sizeValue = getSizeValue( iconSize, customSizeValue ); const normalizedPositionMode = getPositionMode( positionMode ); const normalizedScreenPosition = getScreenPosition( screenPosition ); + const normalizedAbsoluteX = getAbsoluteCoordinate( absoluteX, 50 ); + const normalizedAbsoluteY = getAbsoluteCoordinate( absoluteY, 85 ); + + function updateAbsolutePosition( event ) { + const wrapper = blockRef.current; + const canvas = + wrapper?.closest( '.wp-block-cover' ) || wrapper?.parentElement; + + if ( ! canvas ) { + return; + } + + const canvasRect = canvas.getBoundingClientRect(); + + if ( canvasRect.width === 0 || canvasRect.height === 0 ) { + return; + } + + setAttributes( { + absoluteX: getAbsoluteCoordinate( + ( ( event.clientX - canvasRect.left ) / canvasRect.width ) * + 100, + 50 + ), + absoluteY: getAbsoluteCoordinate( + ( ( event.clientY - canvasRect.top ) / canvasRect.height ) * + 100, + 85 + ), + } ); + } + + function startAbsoluteDrag( event ) { + if ( normalizedPositionMode !== 'absolute' || event.button !== 0 ) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + updateAbsolutePosition( event ); + + const ownerDocument = event.currentTarget.ownerDocument; + const handlePointerMove = ( moveEvent ) => { + updateAbsolutePosition( moveEvent ); + }; + const handlePointerUp = () => { + ownerDocument.removeEventListener( + 'pointermove', + handlePointerMove + ); + ownerDocument.removeEventListener( 'pointerup', handlePointerUp ); + }; + + ownerDocument.addEventListener( 'pointermove', handlePointerMove ); + ownerDocument.addEventListener( 'pointerup', handlePointerUp ); + } const blockProps = useBlockProps( { + ref: blockRef, className: getPositionClassNames( normalizedPositionMode, normalizedScreenPosition ), style: { '--scroll-indicator-size': sizeValue, + ...getPositionStyle( + normalizedPositionMode, + normalizedAbsoluteX, + normalizedAbsoluteY + ), }, } ); @@ -145,47 +236,101 @@ export default function Edit( { attributes, setAttributes } ) { title={ __( 'Position', 'scroll-indicator' ) } initialOpen={ false } > - - setAttributes( { - positionMode: value ? 'absolute' : 'flow', - } ) - } - /> - { normalizedPositionMode === 'absolute' && ( +
+ + { __( 'Position Mode', 'scroll-indicator' ) } + + + { POSITION_MODE_OPTIONS.map( ( option ) => ( + + ) ) } + +
+ { normalizedPositionMode === 'fixed' && (
{ __( 'Screen Position', 'scroll-indicator' ) } - { SCREEN_POSITION_OPTIONS.map( ( option ) => ( - - ) ) } + { SCREEN_POSITION_OPTIONS.map( ( option ) => { + const PositionIcon = option.icon; + + return ( +
) } + { normalizedPositionMode === 'absolute' && ( +
+

+ + { dragHandle } + + { __( + 'Drag the indicator on the canvas, or fine-tune its position below.', + 'scroll-indicator' + ) } +

+ + setAttributes( { absoluteX: value } ) + } + /> + + setAttributes( { absoluteY: value } ) + } + /> +
+ ) } + { normalizedPositionMode === 'fixed' && ( +

+ + { desktop } + + { __( + "Fixed positioning pins the indicator to the visitor's screen.", + 'scroll-indicator' + ) } +

+ ) }
{ showText && ( diff --git a/src/editor.scss b/src/editor.scss index fc5d48e..c572c49 100644 --- a/src/editor.scss +++ b/src/editor.scss @@ -36,8 +36,35 @@ margin-bottom: 12px; } -.scroll-indicator-position-buttons { +.scroll-indicator-mode-buttons { display: grid; gap: 4px; - grid-template-columns: 1fr; + grid-template-columns: repeat(3, minmax(0, 1fr)); + margin-bottom: 12px; +} + +.scroll-indicator-position-buttons { + display: flex; + gap: 4px; + + .components-button { + justify-content: center; + min-width: 44px; + } +} + +.scroll-indicator-absolute-controls, +.scroll-indicator-position-note { + color: #1e1e1e; + font-size: 12px; + line-height: 1.4; + margin: 0 0 12px; +} + +.scroll-indicator-control-icon { + display: inline-flex; + height: 18px; + margin-right: 6px; + vertical-align: middle; + width: 18px; } diff --git a/src/index.js b/src/index.js index 50846c4..dc3fa61 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,13 @@ import { registerBlockType } from '@wordpress/blocks'; +import { arrowDown } from '@wordpress/icons'; import './style.scss'; import Edit from './edit'; -import { MouseIcon } from './icons'; import save from './save'; import metadata from './block.json'; registerBlockType( metadata.name, { - icon: , + icon: arrowDown, edit: Edit, save, } ); diff --git a/src/position.js b/src/position.js index 055ba72..fc724a8 100644 --- a/src/position.js +++ b/src/position.js @@ -1,5 +1,6 @@ const POSITION_MODE_MAP = { flow: 'flow', + fixed: 'fixed', absolute: 'absolute', }; @@ -20,12 +21,42 @@ export function getScreenPosition( screenPosition ) { ); } +export function getAbsoluteCoordinate( coordinate, fallback ) { + const numericCoordinate = + typeof coordinate === 'number' + ? coordinate + : Number.parseFloat( coordinate ); + + if ( ! Number.isFinite( numericCoordinate ) ) { + return fallback; + } + + return Math.min( 100, Math.max( 0, numericCoordinate ) ); +} + export function getPositionClassNames( positionMode, screenPosition ) { + const normalizedPositionMode = getPositionMode( positionMode ); + + if ( normalizedPositionMode === 'fixed' ) { + return `is-position-fixed is-screen-position-${ getScreenPosition( + screenPosition + ) }`; + } + + if ( normalizedPositionMode === 'absolute' ) { + return 'is-position-absolute'; + } + + return ''; +} + +export function getPositionStyle( positionMode, absoluteX, absoluteY ) { if ( getPositionMode( positionMode ) !== 'absolute' ) { - return ''; + return {}; } - return `is-position-absolute is-screen-position-${ getScreenPosition( - screenPosition - ) }`; + return { + '--scroll-indicator-x': `${ getAbsoluteCoordinate( absoluteX, 50 ) }%`, + '--scroll-indicator-y': `${ getAbsoluteCoordinate( absoluteY, 85 ) }%`, + }; } diff --git a/src/save.js b/src/save.js index 44ac1c3..575c3e8 100644 --- a/src/save.js +++ b/src/save.js @@ -1,6 +1,6 @@ import { useBlockProps } from '@wordpress/block-editor'; import { IconRenderer, getIconType, getSizeValue } from './icons'; -import { getPositionClassNames } from './position'; +import { getPositionClassNames, getPositionStyle } from './position'; export default function save( { attributes } ) { const { @@ -12,6 +12,8 @@ export default function save( { attributes } ) { customText = 'Scroll down', positionMode = 'flow', screenPosition = 'bottom-center', + absoluteX = 50, + absoluteY = 85, } = attributes; const normalizedIconType = getIconType( iconType ); @@ -22,6 +24,7 @@ export default function save( { attributes } ) { className: getPositionClassNames( positionMode, screenPosition ), style: { '--scroll-indicator-size': sizeValue, + ...getPositionStyle( positionMode, absoluteX, absoluteY ), }, } ); diff --git a/src/style.scss b/src/style.scss index e50f9a4..35b2615 100644 --- a/src/style.scss +++ b/src/style.scss @@ -23,35 +23,45 @@ justify-content: flex-end; } - &.is-position-absolute { + &.is-position-fixed { bottom: clamp(16px, 4vw, 32px); left: 50%; margin: 0; - position: absolute; + position: fixed; right: auto; transform: translateX(-50%); width: auto; - z-index: 2; + z-index: 1000; } - &.is-screen-position-bottom-left { + &.is-position-fixed.is-screen-position-bottom-left { left: clamp(16px, 4vw, 32px); right: auto; transform: none; } - &.is-screen-position-bottom-center { + &.is-position-fixed.is-screen-position-bottom-center { left: 50%; right: auto; transform: translateX(-50%); } - &.is-screen-position-bottom-right { + &.is-position-fixed.is-screen-position-bottom-right { left: auto; right: clamp(16px, 4vw, 32px); transform: none; } + &.is-position-absolute { + left: var(--scroll-indicator-x, 50%); + margin: 0; + position: absolute; + top: var(--scroll-indicator-y, 85%); + transform: translate(-50%, -50%); + width: auto; + z-index: 2; + } + .scroll-indicator { display: flex; flex-direction: column; @@ -77,6 +87,11 @@ } } + &.is-position-absolute .scroll-indicator { + cursor: grab; + touch-action: none; + } + .scroll-text { font-size: 14px; color: currentcolor; From 0143f152c3ef11a14af8791709c5414574811d54 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 14:45:26 -0500 Subject: [PATCH 04/12] Add reusable Playground blueprint --- .pressshipignore | 1 + .wp-playground/blueprint.json | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .wp-playground/blueprint.json diff --git a/.pressshipignore b/.pressshipignore index 538b928..1f5be0e 100644 --- a/.pressshipignore +++ b/.pressshipignore @@ -1,6 +1,7 @@ .pressshipignore assets/ src/ +.wp-playground/ README.md package.json package-lock.json diff --git a/.wp-playground/blueprint.json b/.wp-playground/blueprint.json new file mode 100644 index 0000000..27ddb0e --- /dev/null +++ b/.wp-playground/blueprint.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://playground.wordpress.net/blueprint-schema.json", + "preferredVersions": { + "php": "8.3", + "wp": "7.0" + }, + "landingPage": "/wp-admin/post-new.php?post_type=page", + "login": true, + "steps": [ + { + "step": "installPlugin", + "pluginZipFile": { + "resource": "url", + "url": "https://codeload.github.com/dhanson-wp/scroll-indicator/zip/refs/heads/codex/submission-readiness" + }, + "options": { + "activate": true + } + } + ] +} From b1d96729d9c4a905b76a5d8f27c4b75a39169eb6 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 15:25:20 -0500 Subject: [PATCH 05/12] Polish block controls and positioning --- compiled/block.json | 4 ++ compiled/index-rtl.css | 2 +- compiled/index.asset.php | 2 +- compiled/index.css | 2 +- compiled/index.js | 2 +- compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- src/block.json | 4 ++ src/edit.js | 133 ++++++++++++++++++++++++----------- src/editor.scss | 9 ++- src/position.js | 22 +++++- src/save.js | 7 +- src/style.scss | 25 +++---- 13 files changed, 150 insertions(+), 66 deletions(-) diff --git a/compiled/block.json b/compiled/block.json index 521073a..a485a29 100644 --- a/compiled/block.json +++ b/compiled/block.json @@ -48,6 +48,10 @@ "absoluteY": { "type": "number", "default": 85 + }, + "flowAlign": { + "type": "string", + "default": "center" } }, "supports": { diff --git a/compiled/index-rtl.css b/compiled/index-rtl.css index dd78012..1c1b54d 100644 --- a/compiled/index-rtl.css +++ b/compiled/index-rtl.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px} diff --git a/compiled/index.asset.php b/compiled/index.asset.php index 6498710..d9e4a6a 100644 --- a/compiled/index.asset.php +++ b/compiled/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '460f88ec8642d3b56b30'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e225e767c25e05a94c29'); diff --git a/compiled/index.css b/compiled/index.css index cccbb48..6b57fb0 100644 --- a/compiled/index.css +++ b/compiled/index.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-size-buttons{display:flex;margin-bottom:12px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px} diff --git a/compiled/index.js b/compiled/index.js index 1f24e99..d5cf142 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var o,e={811(){const o=window.wp.blocks,e=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function p(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return v.test(o)?o:"24px"}return x[o]||"24px"}const m={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function w(o){return Object.prototype.hasOwnProperty.call(m,o)?o:"mouse"}function b({iconType:o}){const e=m[w(o)];return(0,t.jsx)(e,{})}const f={flow:"flow",fixed:"fixed",absolute:"absolute"},j={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"};function _(o){return f[o]||f.flow}function g(o){return j[o]||j["bottom-center"]}function k(o,e){const t="number"==typeof o?o:Number.parseFloat(o);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):e}function y(o,e){const t=_(o);return"fixed"===t?`is-position-fixed is-screen-position-${g(e)}`:"absolute"===t?"is-position-absolute":""}function B(o,e,t){return"absolute"!==_(o)?{}:{"--scroll-indicator-x":`${k(e,50)}%`,"--scroll-indicator-y":`${k(t,85)}%`}}const S=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],C=["S","M","L","XL","custom"],M=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],N=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],P=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(P.UU,{icon:i,edit:function({attributes:o,setAttributes:e}){const{iconType:i="mouse",iconSize:s="M",customSizeValue:c="24px",hideAfterScrolling:a=!1,showText:x=!0,customText:v="Scroll down",positionMode:f="flow",screenPosition:j="bottom-center",absoluteX:P=50,absoluteY:V=85}=o,T=(0,r.useRef)(),z=w(i),H=p(s,c),O=_(f),L=g(j),G=k(P,50),Z=k(V,85);function X(o){const t=T.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&e({absoluteX:k((o.clientX-l.left)/l.width*100,50),absoluteY:k((o.clientY-l.top)/l.height*100,85)})}const E=(0,n.useBlockProps)({ref:T,className:y(O,L),style:{"--scroll-indicator-size":H,...B(O,G,Z)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:S.map(o=>{const l=m[o.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:i===o.value,onClick:()=>e({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,t.jsx)(l,{})},o.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Size","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-size-buttons",children:C.map(o=>(0,t.jsx)(h.Button,{isPressed:s===o,onClick:()=>e({iconSize:o}),children:"custom"===o?(0,l.__)("Custom","scroll-indicator"):o},o))}),"custom"===s&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Size","scroll-indicator"),value:c,onChange:o=>e({customSizeValue:o}),help:(0,l.__)("Use a CSS size such as 24px, 2rem, or 3em.","scroll-indicator")})]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:M.map(o=>(0,t.jsx)(h.Button,{isPressed:O===o.value,onClick:()=>e({positionMode:o.value}),children:o.label},o.value))})]}),"fixed"===O&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:N.map(o=>{const i=o.icon;return(0,t.jsx)(h.Button,{icon:i,label:o.label,showTooltip:!0,isPressed:L===o.value,onClick:()=>e({screenPosition:o.value})},o.value)})})]}),"absolute"===O&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:G,min:0,max:100,onChange:o=>e({absoluteX:o})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:Z,min:0,max:100,onChange:o=>e({absoluteY:o})})]}),"fixed"===O&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:x,onChange:o=>e({showText:o})}),x&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:v,onChange:o=>e({customText:o}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]}),(0,t.jsx)(h.PanelBody,{title:(0,l.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Hide after scrolling","scroll-indicator"),help:(0,l.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:a,onChange:o=>e({hideAfterScrolling:o})})})]}),(0,t.jsx)("div",{...E,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${z}`,onPointerDown:function(o){if("absolute"!==O||0!==o.button)return;o.preventDefault(),o.stopPropagation(),X(o);const e=o.currentTarget.ownerDocument,t=o=>{X(o)},i=()=>{e.removeEventListener("pointermove",t),e.removeEventListener("pointerup",i)};e.addEventListener("pointermove",t),e.addEventListener("pointerup",i)},children:[(0,t.jsx)(b,{iconType:z}),x&&(0,t.jsx)("div",{className:"scroll-text",children:v||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:i="M",customSizeValue:l="24px",hideAfterScrolling:r=!1,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85}=o,x=w(e),v=p(i,l),m=c||"Scroll down",f=n.useBlockProps.save({className:y(a,d),style:{"--scroll-indicator-size":v,...B(a,u,h)}});return(0,t.jsx)("div",{...f,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${x}`,"aria-label":m,"data-hide-after-scrolling":r?"true":"false",children:[(0,t.jsx)(b,{iconType:x}),s&&(0,t.jsx)("div",{className:"scroll-text",children:m})]})})}})}},t={};function i(o){var l=t[o];if(void 0!==l)return l.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,i),n.exports}i.m=e,o=[],i.O=(e,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(o=>i.O[o](t[c]))?t.splice(c--,1):(s=!1,n0&&o[d-1][2]>n;d--)o[d]=o[d-1];o[d]=[t,l,n]},i.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};i.O.j=e=>0===o[e];var e=(e,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(e=>0!==o[e])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(e&&e(t);ai(811));l=i.O(l)})(); \ No newline at end of file +(()=>{"use strict";var e,o={811(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function p(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return v.test(e)?e:"24px"}return x[e]||"24px"}const m={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function w(e){return Object.prototype.hasOwnProperty.call(m,e)?e:"mouse"}function f({iconType:e}){const o=m[w(e)];return(0,t.jsx)(o,{})}const b={flow:"flow",fixed:"fixed",absolute:"absolute"},g={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},j={left:"left",center:"center",right:"right"};function _(e){return b[e]||b.flow}function k(e){return g[e]||g["bottom-center"]}function y(e){return j[e]||j.center}function B(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function S(e,o,t="center"){const i=_(e);if("fixed"===i)return`is-position-fixed is-screen-position-${k(o)}`;if("absolute"===i)return"is-position-absolute";const l=y(t);return"center"!==l?`is-flow-align-${l}`:""}function M(e,o,t){return"absolute"!==_(e)?{}:{"--scroll-indicator-x":`${B(o,50)}%`,"--scroll-indicator-y":`${B(t,85)}%`}}const N=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],P=[{name:(0,l.__)("Small","scroll-indicator"),slug:"small",size:"18px"},{name:(0,l.__)("Medium","scroll-indicator"),slug:"medium",size:"24px"},{name:(0,l.__)("Large","scroll-indicator"),slug:"large",size:"32px"},{name:(0,l.__)("Extra Large","scroll-indicator"),slug:"extra-large",size:"48px"}],C=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],V=[{value:"left",label:(0,l.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,l.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,l.__)("Align right","scroll-indicator"),icon:a}],T=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],z=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)(z.UU,{icon:i,edit:function({attributes:e,setAttributes:o,isSelected:i}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",hideAfterScrolling:x=!1,showText:v=!0,customText:b="Scroll down",positionMode:g="flow",screenPosition:j="bottom-center",absoluteX:z=50,absoluteY:H=85}=e,O=(0,r.useRef)(),L=w(s),A=p(c,a),G=_(g),Z=k(j),E=B(z,50),$=B(H,85),F=y(e.flowAlign),X=(0,n.useBlockProps)({ref:O,className:S(G,Z,F),style:{"--scroll-indicator-size":A,...M(G,E,$)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:N.map(e=>{const i=m[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(i,{})})},e.value)})})]}),(0,t.jsx)(n.FontSizePicker,{fontSizes:P,value:A,onChange:e=>o({iconSize:"custom",customSizeValue:e||"24px"}),headingLevel:3,withSlider:!1})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:C.map(e=>(0,t.jsx)(h.Button,{isPressed:G===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===G&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:V.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:F===e.value,onClick:()=>o({flowAlign:e.value})},e.value)})})]}),"fixed"===G&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:T.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:Z===e.value,onClick:()=>o({screenPosition:e.value})},e.value)})})]}),"absolute"===G&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:E,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:$,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===G&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:v,onChange:e=>o({showText:e})}),v&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:b,onChange:e=>o({customText:e}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]}),(0,t.jsx)(h.PanelBody,{title:(0,l.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Hide after scrolling","scroll-indicator"),help:(0,l.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:x,onChange:e=>o({hideAfterScrolling:e})})})]}),(0,t.jsx)("div",{...X,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${L}`,onPointerDown:function(e){if("absolute"!==G||0!==e.button||!i)return;e.preventDefault(),e.stopPropagation();const t=e.currentTarget.ownerDocument,l=e=>{!function(e){const t=O.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&o({absoluteX:B((e.clientX-l.left)/l.width*100,50),absoluteY:B((e.clientY-l.top)/l.height*100,85)})}(e)},n=()=>{t.removeEventListener("pointermove",l),t.removeEventListener("pointerup",n)};t.addEventListener("pointermove",l),t.addEventListener("pointerup",n)},children:[(0,t.jsx)(f,{iconType:L}),v&&(0,t.jsx)("div",{className:"scroll-text",children:b||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:i="M",customSizeValue:l="24px",hideAfterScrolling:r=!1,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85,flowAlign:x="center"}=e,v=w(o),m=p(i,l),b=c||"Scroll down",g=n.useBlockProps.save({className:S(a,d,x),style:{"--scroll-indicator-size":m,...M(a,u,h)}});return(0,t.jsx)("div",{...g,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${v}`,"aria-label":b,"data-hide-after-scrolling":r?"true":"false",children:[(0,t.jsx)(f,{iconType:v}),s&&(0,t.jsx)("div",{className:"scroll-text",children:b})]})})}})}},t={};function i(e){var l=t[e];if(void 0!==l)return l.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,e=[],i.O=(o,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,l,n]},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};i.O.j=o=>0===e[o];var o=(o,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(o&&o(t);ai(811));l=i.O(l)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css index ae9fa97..3b6a5d7 100644 --- a/compiled/style-index-rtl.css +++ b/compiled/style-index-rtl.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index a78adac..24ca1ce 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{outline:2px solid currentcolor;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/src/block.json b/src/block.json index 8dcf252..55c74bb 100644 --- a/src/block.json +++ b/src/block.json @@ -48,6 +48,10 @@ "absoluteY": { "type": "number", "default": 85 + }, + "flowAlign": { + "type": "string", + "default": "center" } }, "supports": { diff --git a/src/edit.js b/src/edit.js index ede7423..4cc4664 100644 --- a/src/edit.js +++ b/src/edit.js @@ -1,5 +1,9 @@ import { __ } from '@wordpress/i18n'; -import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; +import { + useBlockProps, + InspectorControls, + FontSizePicker, +} from '@wordpress/block-editor'; import { useRef } from '@wordpress/element'; import { desktop, @@ -29,6 +33,7 @@ import { getPositionMode, getPositionStyle, getAbsoluteCoordinate, + getFlowAlignment, getScreenPosition, } from './position'; @@ -43,7 +48,16 @@ const ICON_OPTIONS = [ { value: 'hand-point', label: __( 'Hand', 'scroll-indicator' ) }, ]; -const SIZE_OPTIONS = [ 'S', 'M', 'L', 'XL', 'custom' ]; +const ICON_SIZE_OPTIONS = [ + { name: __( 'Small', 'scroll-indicator' ), slug: 'small', size: '18px' }, + { name: __( 'Medium', 'scroll-indicator' ), slug: 'medium', size: '24px' }, + { name: __( 'Large', 'scroll-indicator' ), slug: 'large', size: '32px' }, + { + name: __( 'Extra Large', 'scroll-indicator' ), + slug: 'extra-large', + size: '48px', + }, +]; const POSITION_MODE_OPTIONS = [ { value: 'flow', label: __( 'Flow', 'scroll-indicator' ) }, @@ -51,6 +65,24 @@ const POSITION_MODE_OPTIONS = [ { value: 'absolute', label: __( 'Absolute', 'scroll-indicator' ) }, ]; +const FLOW_ALIGNMENT_OPTIONS = [ + { + value: 'left', + label: __( 'Align left', 'scroll-indicator' ), + icon: positionLeft, + }, + { + value: 'center', + label: __( 'Align center', 'scroll-indicator' ), + icon: positionCenter, + }, + { + value: 'right', + label: __( 'Align right', 'scroll-indicator' ), + icon: positionRight, + }, +]; + const SCREEN_POSITION_OPTIONS = [ { value: 'bottom-left', @@ -69,7 +101,7 @@ const SCREEN_POSITION_OPTIONS = [ }, ]; -export default function Edit( { attributes, setAttributes } ) { +export default function Edit( { attributes, setAttributes, isSelected } ) { const { iconType = 'mouse', iconSize = 'M', @@ -90,6 +122,7 @@ export default function Edit( { attributes, setAttributes } ) { const normalizedScreenPosition = getScreenPosition( screenPosition ); const normalizedAbsoluteX = getAbsoluteCoordinate( absoluteX, 50 ); const normalizedAbsoluteY = getAbsoluteCoordinate( absoluteY, 85 ); + const normalizedFlowAlign = getFlowAlignment( attributes.flowAlign ); function updateAbsolutePosition( event ) { const wrapper = blockRef.current; @@ -121,13 +154,16 @@ export default function Edit( { attributes, setAttributes } ) { } function startAbsoluteDrag( event ) { - if ( normalizedPositionMode !== 'absolute' || event.button !== 0 ) { + if ( + normalizedPositionMode !== 'absolute' || + event.button !== 0 || + ! isSelected + ) { return; } event.preventDefault(); event.stopPropagation(); - updateAbsolutePosition( event ); const ownerDocument = event.currentTarget.ownerDocument; const handlePointerMove = ( moveEvent ) => { @@ -149,7 +185,8 @@ export default function Edit( { attributes, setAttributes } ) { ref: blockRef, className: getPositionClassNames( normalizedPositionMode, - normalizedScreenPosition + normalizedScreenPosition, + normalizedFlowAlign ), style: { '--scroll-indicator-size': sizeValue, @@ -189,48 +226,28 @@ export default function Edit( { attributes, setAttributes } ) { label={ option.label } showTooltip > - + + + ); } ) } -
- { __( 'Size', 'scroll-indicator' ) } - - { SIZE_OPTIONS.map( ( size ) => ( - - ) ) } - - { iconSize === 'custom' && ( - - setAttributes( { - customSizeValue: value, - } ) - } - help={ __( - 'Use a CSS size such as 24px, 2rem, or 3em.', - 'scroll-indicator' - ) } - /> - ) } -
+ + setAttributes( { + iconSize: 'custom', + customSizeValue: value || '24px', + } ) + } + headingLevel={ 3 } + withSlider={ false } + /> + { normalizedPositionMode === 'flow' && ( +
+ + { __( 'Alignment', 'scroll-indicator' ) } + + + { FLOW_ALIGNMENT_OPTIONS.map( ( option ) => { + const AlignmentIcon = option.icon; + + return ( +
+ ) } { normalizedPositionMode === 'fixed' && (
diff --git a/src/editor.scss b/src/editor.scss index c572c49..63689df 100644 --- a/src/editor.scss +++ b/src/editor.scss @@ -31,9 +31,12 @@ } } -.scroll-indicator-size-buttons { - display: flex; - margin-bottom: 12px; +.scroll-indicator-icon-preview { + align-items: center; + display: inline-flex; + height: 20px; + justify-content: center; + width: 20px; } .scroll-indicator-mode-buttons { diff --git a/src/position.js b/src/position.js index fc724a8..711e28a 100644 --- a/src/position.js +++ b/src/position.js @@ -10,6 +10,12 @@ const SCREEN_POSITION_MAP = { 'bottom-right': 'bottom-right', }; +const FLOW_ALIGNMENT_MAP = { + left: 'left', + center: 'center', + right: 'right', +}; + export function getPositionMode( positionMode ) { return POSITION_MODE_MAP[ positionMode ] || POSITION_MODE_MAP.flow; } @@ -21,6 +27,10 @@ export function getScreenPosition( screenPosition ) { ); } +export function getFlowAlignment( flowAlign ) { + return FLOW_ALIGNMENT_MAP[ flowAlign ] || FLOW_ALIGNMENT_MAP.center; +} + export function getAbsoluteCoordinate( coordinate, fallback ) { const numericCoordinate = typeof coordinate === 'number' @@ -34,7 +44,11 @@ export function getAbsoluteCoordinate( coordinate, fallback ) { return Math.min( 100, Math.max( 0, numericCoordinate ) ); } -export function getPositionClassNames( positionMode, screenPosition ) { +export function getPositionClassNames( + positionMode, + screenPosition, + flowAlign = 'center' +) { const normalizedPositionMode = getPositionMode( positionMode ); if ( normalizedPositionMode === 'fixed' ) { @@ -47,6 +61,12 @@ export function getPositionClassNames( positionMode, screenPosition ) { return 'is-position-absolute'; } + const normalizedFlowAlign = getFlowAlignment( flowAlign ); + + if ( normalizedFlowAlign !== 'center' ) { + return `is-flow-align-${ normalizedFlowAlign }`; + } + return ''; } diff --git a/src/save.js b/src/save.js index 575c3e8..ddebaf0 100644 --- a/src/save.js +++ b/src/save.js @@ -14,6 +14,7 @@ export default function save( { attributes } ) { screenPosition = 'bottom-center', absoluteX = 50, absoluteY = 85, + flowAlign = 'center', } = attributes; const normalizedIconType = getIconType( iconType ); @@ -21,7 +22,11 @@ export default function save( { attributes } ) { const label = customText || 'Scroll down'; const blockProps = useBlockProps.save( { - className: getPositionClassNames( positionMode, screenPosition ), + className: getPositionClassNames( + positionMode, + screenPosition, + flowAlign + ), style: { '--scroll-indicator-size': sizeValue, ...getPositionStyle( positionMode, absoluteX, absoluteY ), diff --git a/src/style.scss b/src/style.scss index 35b2615..205b561 100644 --- a/src/style.scss +++ b/src/style.scss @@ -23,6 +23,14 @@ justify-content: flex-end; } + &.is-flow-align-left { + justify-content: flex-start; + } + + &.is-flow-align-right { + justify-content: flex-end; + } + &.is-position-fixed { bottom: clamp(16px, 4vw, 32px); left: 50%; @@ -77,7 +85,9 @@ text-align: center; &:focus-visible { - outline: 2px solid currentcolor; + border-radius: 8px; + box-shadow: 0 0 0 2px currentcolor; + outline: 2px solid transparent; outline-offset: 4px; } @@ -100,18 +110,9 @@ } } -.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { +.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute), +.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { position: relative; - - // Pin absolute indicators to the full Cover instead of the inner content box. - > .wp-block-cover__inner-container { - position: static; - - > :not(.wp-block-scroll-indicator-scroll-indicator) { - position: relative; - z-index: 1; - } - } } // Animations — only when user hasn't requested reduced motion From 5f1511c5d6e2acaadebaba8f23b5a38b9168d589 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 15:46:49 -0500 Subject: [PATCH 06/12] Fix positioned block interactions --- compiled/index-rtl.css | 2 +- compiled/index.asset.php | 2 +- compiled/index.css | 2 +- compiled/index.js | 2 +- compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- compiled/view.asset.php | 2 +- compiled/view.js | 2 +- src/edit.js | 12 ++++++------ src/editor.scss | 24 ++++++++++++++++++++++++ src/style.scss | 7 +++++++ src/view.js | 13 +++++++++++-- 12 files changed, 56 insertions(+), 16 deletions(-) diff --git a/compiled/index-rtl.css b/compiled/index-rtl.css index 1c1b54d..fe6af59 100644 --- a/compiled/index-rtl.css +++ b/compiled/index-rtl.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} diff --git a/compiled/index.asset.php b/compiled/index.asset.php index d9e4a6a..8f5d52b 100644 --- a/compiled/index.asset.php +++ b/compiled/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e225e767c25e05a94c29'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '600962fe99bf999d456c'); diff --git a/compiled/index.css b/compiled/index.css index 6b57fb0..fd39c5e 100644 --- a/compiled/index.css +++ b/compiled/index.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} diff --git a/compiled/index.js b/compiled/index.js index d5cf142..22e6f15 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,o={811(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function p(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return v.test(e)?e:"24px"}return x[e]||"24px"}const m={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function w(e){return Object.prototype.hasOwnProperty.call(m,e)?e:"mouse"}function f({iconType:e}){const o=m[w(e)];return(0,t.jsx)(o,{})}const b={flow:"flow",fixed:"fixed",absolute:"absolute"},g={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},j={left:"left",center:"center",right:"right"};function _(e){return b[e]||b.flow}function k(e){return g[e]||g["bottom-center"]}function y(e){return j[e]||j.center}function B(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function S(e,o,t="center"){const i=_(e);if("fixed"===i)return`is-position-fixed is-screen-position-${k(o)}`;if("absolute"===i)return"is-position-absolute";const l=y(t);return"center"!==l?`is-flow-align-${l}`:""}function M(e,o,t){return"absolute"!==_(e)?{}:{"--scroll-indicator-x":`${B(o,50)}%`,"--scroll-indicator-y":`${B(t,85)}%`}}const N=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],P=[{name:(0,l.__)("Small","scroll-indicator"),slug:"small",size:"18px"},{name:(0,l.__)("Medium","scroll-indicator"),slug:"medium",size:"24px"},{name:(0,l.__)("Large","scroll-indicator"),slug:"large",size:"32px"},{name:(0,l.__)("Extra Large","scroll-indicator"),slug:"extra-large",size:"48px"}],C=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],V=[{value:"left",label:(0,l.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,l.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,l.__)("Align right","scroll-indicator"),icon:a}],T=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],z=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)(z.UU,{icon:i,edit:function({attributes:e,setAttributes:o,isSelected:i}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",hideAfterScrolling:x=!1,showText:v=!0,customText:b="Scroll down",positionMode:g="flow",screenPosition:j="bottom-center",absoluteX:z=50,absoluteY:H=85}=e,O=(0,r.useRef)(),L=w(s),A=p(c,a),G=_(g),Z=k(j),E=B(z,50),$=B(H,85),F=y(e.flowAlign),X=(0,n.useBlockProps)({ref:O,className:S(G,Z,F),style:{"--scroll-indicator-size":A,...M(G,E,$)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:N.map(e=>{const i=m[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(i,{})})},e.value)})})]}),(0,t.jsx)(n.FontSizePicker,{fontSizes:P,value:A,onChange:e=>o({iconSize:"custom",customSizeValue:e||"24px"}),headingLevel:3,withSlider:!1})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:C.map(e=>(0,t.jsx)(h.Button,{isPressed:G===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===G&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:V.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:F===e.value,onClick:()=>o({flowAlign:e.value})},e.value)})})]}),"fixed"===G&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:T.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:Z===e.value,onClick:()=>o({screenPosition:e.value})},e.value)})})]}),"absolute"===G&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:E,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:$,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===G&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:v,onChange:e=>o({showText:e})}),v&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:b,onChange:e=>o({customText:e}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]}),(0,t.jsx)(h.PanelBody,{title:(0,l.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Hide after scrolling","scroll-indicator"),help:(0,l.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:x,onChange:e=>o({hideAfterScrolling:e})})})]}),(0,t.jsx)("div",{...X,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${L}`,onPointerDown:function(e){if("absolute"!==G||0!==e.button||!i)return;e.preventDefault(),e.stopPropagation();const t=e.currentTarget.ownerDocument,l=e=>{!function(e){const t=O.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&o({absoluteX:B((e.clientX-l.left)/l.width*100,50),absoluteY:B((e.clientY-l.top)/l.height*100,85)})}(e)},n=()=>{t.removeEventListener("pointermove",l),t.removeEventListener("pointerup",n)};t.addEventListener("pointermove",l),t.addEventListener("pointerup",n)},children:[(0,t.jsx)(f,{iconType:L}),v&&(0,t.jsx)("div",{className:"scroll-text",children:b||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:i="M",customSizeValue:l="24px",hideAfterScrolling:r=!1,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85,flowAlign:x="center"}=e,v=w(o),m=p(i,l),b=c||"Scroll down",g=n.useBlockProps.save({className:S(a,d,x),style:{"--scroll-indicator-size":m,...M(a,u,h)}});return(0,t.jsx)("div",{...g,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${v}`,"aria-label":b,"data-hide-after-scrolling":r?"true":"false",children:[(0,t.jsx)(f,{iconType:v}),s&&(0,t.jsx)("div",{className:"scroll-text",children:b})]})})}})}},t={};function i(e){var l=t[e];if(void 0!==l)return l.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,e=[],i.O=(o,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,l,n]},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};i.O.j=o=>0===e[o];var o=(o,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(o&&o(t);ai(811));l=i.O(l)})(); \ No newline at end of file +(()=>{"use strict";var e,o={511(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,p={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function m(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return v.test(e)?e:"24px"}return p[e]||"24px"}const w={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function f(e){return Object.prototype.hasOwnProperty.call(w,e)?e:"mouse"}function b({iconType:e}){const o=w[f(e)];return(0,t.jsx)(o,{})}const g={flow:"flow",fixed:"fixed",absolute:"absolute"},j={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},_={left:"left",center:"center",right:"right"};function k(e){return g[e]||g.flow}function y(e){return j[e]||j["bottom-center"]}function B(e){return _[e]||_.center}function S(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function M(e,o,t="center"){const i=k(e);if("fixed"===i)return`is-position-fixed is-screen-position-${y(o)}`;if("absolute"===i)return"is-position-absolute";const l=B(t);return"center"!==l?`is-flow-align-${l}`:""}function N(e,o,t){return"absolute"!==k(e)?{}:{"--scroll-indicator-x":`${S(o,50)}%`,"--scroll-indicator-y":`${S(t,85)}%`}}const P=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],C=[{name:(0,l.__)("Small","scroll-indicator"),slug:"small",size:"18px"},{name:(0,l.__)("Medium","scroll-indicator"),slug:"medium",size:"24px"},{name:(0,l.__)("Large","scroll-indicator"),slug:"large",size:"32px"},{name:(0,l.__)("Extra Large","scroll-indicator"),slug:"extra-large",size:"48px"}],V=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],T=[{value:"left",label:(0,l.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,l.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,l.__)("Align right","scroll-indicator"),icon:a}],z=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],H=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)(H.UU,{icon:i,edit:function({attributes:e,setAttributes:o,clientId:i}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",hideAfterScrolling:p=!1,showText:v=!0,customText:g="Scroll down",positionMode:j="flow",screenPosition:_="bottom-center",absoluteX:H=50,absoluteY:O=85}=e,L=(0,r.useRef)(),{selectBlock:A}=(0,x.useDispatch)("core/block-editor"),G=f(s),Z=m(c,a),E=k(j),$=y(_),F=S(H,50),X=S(O,85),D=B(e.flowAlign);function R(e){const t=L.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&o({absoluteX:S((e.clientX-l.left)/l.width*100,50),absoluteY:S((e.clientY-l.top)/l.height*100,85)})}const Y=(0,n.useBlockProps)({ref:L,className:M(E,$,D),style:{"--scroll-indicator-size":Z,...N(E,F,X)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:P.map(e=>{const i=w[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(i,{})})},e.value)})})]}),(0,t.jsx)(n.FontSizePicker,{fontSizes:C,value:Z,onChange:e=>o({iconSize:"custom",customSizeValue:e||"24px"}),headingLevel:3,withSlider:!1})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:V.map(e=>(0,t.jsx)(h.Button,{isPressed:E===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===E&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:T.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:D===e.value,onClick:()=>o({flowAlign:e.value})},e.value)})})]}),"fixed"===E&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:z.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:$===e.value,onClick:()=>o({screenPosition:e.value})},e.value)})})]}),"absolute"===E&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:F,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:X,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===E&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:v,onChange:e=>o({showText:e})}),v&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:g,onChange:e=>o({customText:e}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]}),(0,t.jsx)(h.PanelBody,{title:(0,l.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Hide after scrolling","scroll-indicator"),help:(0,l.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:p,onChange:e=>o({hideAfterScrolling:e})})})]}),(0,t.jsx)("div",{...Y,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${G}`,onPointerDown:function(e){if("absolute"!==E||0!==e.button)return;e.preventDefault(),e.stopPropagation(),A(i),R(e);const o=e.currentTarget.ownerDocument,t=e=>{R(e)},l=()=>{o.removeEventListener("pointermove",t),o.removeEventListener("pointerup",l)};o.addEventListener("pointermove",t),o.addEventListener("pointerup",l)},children:[(0,t.jsx)(b,{iconType:G}),v&&(0,t.jsx)("div",{className:"scroll-text",children:g||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:i="M",customSizeValue:l="24px",hideAfterScrolling:r=!1,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85,flowAlign:x="center"}=e,p=f(o),v=m(i,l),w=c||"Scroll down",g=n.useBlockProps.save({className:M(a,d,x),style:{"--scroll-indicator-size":v,...N(a,u,h)}});return(0,t.jsx)("div",{...g,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${p}`,"aria-label":w,"data-hide-after-scrolling":r?"true":"false",children:[(0,t.jsx)(b,{iconType:p}),s&&(0,t.jsx)("div",{className:"scroll-text",children:w})]})})}})}},t={};function i(e){var l=t[e];if(void 0!==l)return l.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,e=[],i.O=(o,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,l,n]},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};i.O.j=o=>0===e[o];var o=(o,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(o&&o(t);ai(511));l=i.O(l)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css index 3b6a5d7..9f10f34 100644 --- a/compiled/style-index-rtl.css +++ b/compiled/style-index-rtl.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index 24ca1ce..5043022 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/view.asset.php b/compiled/view.asset.php index 8c59f3f..a54dc0f 100644 --- a/compiled/view.asset.php +++ b/compiled/view.asset.php @@ -1 +1 @@ - array(), 'version' => '04a12027677121da76eb'); + array(), 'version' => '34d67748a8104cbcd634'); diff --git a/compiled/view.js b/compiled/view.js index 70f55b9..063be0b 100644 --- a/compiled/view.js +++ b/compiled/view.js @@ -1 +1 @@ -document.addEventListener("DOMContentLoaded",function(){const t=document.querySelectorAll(".scroll-indicator");if(0===t.length)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");t.forEach(function(t){const i="true"===t.getAttribute("data-hide-after-scrolling"),n=t.closest(".wp-block-scroll-indicator-scroll-indicator"),o=t.getAttribute("tabindex");if(t.addEventListener("click",function(){const t=window.innerHeight,i=window.scrollY+t;window.scrollTo({top:i,behavior:e.matches?"auto":"smooth"})}),t.style.cursor="pointer",i&&n){let s=n.offsetTop,c=s+n.offsetHeight;function r(){const e=window.scrollY,i=window.innerHeight;var n;n=e<=s||se,t.style.transition=n?"opacity 0.3s ease-in":"opacity 0.3s ease-out",t.style.opacity=n?"1":"0",t.style.visibility=n?"visible":"hidden",t.style.pointerEvents=n?"auto":"none",n?(t.removeAttribute("aria-hidden"),null===o?t.removeAttribute("tabindex"):t.setAttribute("tabindex",o)):(t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","-1"),t.ownerDocument.activeElement===t&&t.blur())}window.addEventListener("resize",function(){s=n.offsetTop,c=s+n.offsetHeight,r()}),r(),window.addEventListener("scroll",r,{passive:!0})}})}); \ No newline at end of file +document.addEventListener("DOMContentLoaded",function(){const t=document.querySelectorAll(".scroll-indicator");if(0===t.length)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");t.forEach(function(t){const n="true"===t.getAttribute("data-hide-after-scrolling"),i=t.closest(".wp-block-scroll-indicator-scroll-indicator"),o=t.getAttribute("tabindex");if(t.addEventListener("click",function(){const t=window.innerHeight,n=window.scrollY+t;window.scrollTo({top:n,behavior:e.matches?"auto":"smooth"})}),t.style.cursor="pointer",n&&i){let r=i.offsetTop,a=r+i.offsetHeight;const c=e.matches?"none":"opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s",l=e.matches?"none":"opacity 0.35s ease, transform 0.35s ease";function s(){const e=window.scrollY,n=window.innerHeight;var i;i=e<=r||re,t.style.transition=i?l:c,t.style.opacity=i?"1":"0",t.style.visibility=i?"visible":"hidden",t.style.pointerEvents=i?"auto":"none",t.style.transform=i?"translateY(0)":"translateY(10px)",i?(t.removeAttribute("aria-hidden"),null===o?t.removeAttribute("tabindex"):t.setAttribute("tabindex",o)):(t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","-1"),t.ownerDocument.activeElement===t&&t.blur())}window.addEventListener("resize",function(){r=i.offsetTop,a=r+i.offsetHeight,s()}),s(),window.addEventListener("scroll",s,{passive:!0})}})}); \ No newline at end of file diff --git a/src/edit.js b/src/edit.js index 4cc4664..c001746 100644 --- a/src/edit.js +++ b/src/edit.js @@ -20,6 +20,7 @@ import { Button, RangeControl, } from '@wordpress/components'; +import { useDispatch } from '@wordpress/data'; import './editor.scss'; import { @@ -101,7 +102,7 @@ const SCREEN_POSITION_OPTIONS = [ }, ]; -export default function Edit( { attributes, setAttributes, isSelected } ) { +export default function Edit( { attributes, setAttributes, clientId } ) { const { iconType = 'mouse', iconSize = 'M', @@ -116,6 +117,7 @@ export default function Edit( { attributes, setAttributes, isSelected } ) { } = attributes; const blockRef = useRef(); + const { selectBlock } = useDispatch( 'core/block-editor' ); const normalizedIconType = getIconType( iconType ); const sizeValue = getSizeValue( iconSize, customSizeValue ); const normalizedPositionMode = getPositionMode( positionMode ); @@ -154,16 +156,14 @@ export default function Edit( { attributes, setAttributes, isSelected } ) { } function startAbsoluteDrag( event ) { - if ( - normalizedPositionMode !== 'absolute' || - event.button !== 0 || - ! isSelected - ) { + if ( normalizedPositionMode !== 'absolute' || event.button !== 0 ) { return; } event.preventDefault(); event.stopPropagation(); + selectBlock( clientId ); + updateAbsolutePosition( event ); const ownerDocument = event.currentTarget.ownerDocument; const handlePointerMove = ( moveEvent ) => { diff --git a/src/editor.scss b/src/editor.scss index 63689df..ebe3256 100644 --- a/src/editor.scss +++ b/src/editor.scss @@ -37,6 +37,19 @@ height: 20px; justify-content: center; width: 20px; + + &.icon-mouse, + &.icon-arrow-down, + &.icon-chevron-bounce, + &.icon-hand-point { + + svg, + path, + rect, + line { + fill: none; + } + } } .scroll-indicator-mode-buttons { @@ -71,3 +84,14 @@ vertical-align: middle; width: 18px; } + +.editor-styles-wrapper { + + .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed) { + position: relative; + } + + .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed { + position: absolute; + } +} diff --git a/src/style.scss b/src/style.scss index 205b561..f2cd0a6 100644 --- a/src/style.scss +++ b/src/style.scss @@ -115,6 +115,13 @@ position: relative; } +.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { + + > .wp-block-cover__inner-container { + position: static; + } +} + // Animations — only when user hasn't requested reduced motion @media (prefers-reduced-motion: no-preference) { diff --git a/src/view.js b/src/view.js index 022fdc3..f0ecda6 100644 --- a/src/view.js +++ b/src/view.js @@ -34,6 +34,12 @@ document.addEventListener( 'DOMContentLoaded', function () { if ( hideAfterScrolling && blockElement ) { let blockTop = blockElement.offsetTop; let blockBottom = blockTop + blockElement.offsetHeight; + const transition = prefersReducedMotion.matches + ? 'none' + : 'opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s'; + const visibleTransition = prefersReducedMotion.matches + ? 'none' + : 'opacity 0.35s ease, transform 0.35s ease'; function updateBlockPosition() { blockTop = blockElement.offsetTop; @@ -42,11 +48,14 @@ document.addEventListener( 'DOMContentLoaded', function () { function setIndicatorVisibility( isVisible ) { indicator.style.transition = isVisible - ? 'opacity 0.3s ease-in' - : 'opacity 0.3s ease-out'; + ? visibleTransition + : transition; indicator.style.opacity = isVisible ? '1' : '0'; indicator.style.visibility = isVisible ? 'visible' : 'hidden'; indicator.style.pointerEvents = isVisible ? 'auto' : 'none'; + indicator.style.transform = isVisible + ? 'translateY(0)' + : 'translateY(10px)'; if ( isVisible ) { indicator.removeAttribute( 'aria-hidden' ); From 9a3bc81bb46295c52309817a2bb1402a0ae22da9 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 16:29:33 -0500 Subject: [PATCH 07/12] Simplify scroll indicator hide behavior --- README.md | 2 +- compiled/block.json | 2 +- compiled/index-rtl.css | 2 +- compiled/index.asset.php | 2 +- compiled/index.css | 2 +- compiled/index.js | 2 +- compiled/view.asset.php | 2 +- compiled/view.js | 2 +- readme.txt | 8 +-- src/block.json | 2 +- src/edit.js | 49 ++++++---------- src/editor.scss | 7 +++ src/save.js | 5 +- src/view.js | 121 +++++++++++++++++++-------------------- 14 files changed, 96 insertions(+), 112 deletions(-) diff --git a/README.md b/README.md index 54dca36..4df1627 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Site builders can choose an icon style, tune the size and color, add optional te - Fixed screen positioning and draggable absolute positioning for hero-style sections. - CSS-only animation that respects `prefers-reduced-motion`. - Optional helper text beneath the icon. -- Optional hide-after-scrolling behavior. +- Automatic hide-on-scroll behavior. - Keyboard-accessible click-to-scroll behavior on the front end. - No animation libraries or heavy runtime dependencies. diff --git a/compiled/block.json b/compiled/block.json index a485a29..c5c365f 100644 --- a/compiled/block.json +++ b/compiled/block.json @@ -23,7 +23,7 @@ }, "hideAfterScrolling": { "type": "boolean", - "default": false + "default": true }, "showText": { "type": "boolean", diff --git a/compiled/index-rtl.css b/compiled/index-rtl.css index fe6af59..ffad80d 100644 --- a/compiled/index-rtl.css +++ b/compiled/index-rtl.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-size-picker .components-font-size-picker>:first-child{display:none}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} diff --git a/compiled/index.asset.php b/compiled/index.asset.php index 8f5d52b..47f31c9 100644 --- a/compiled/index.asset.php +++ b/compiled/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '600962fe99bf999d456c'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e225724cc9f6cf5c7803'); diff --git a/compiled/index.css b/compiled/index.css index fd39c5e..be846aa 100644 --- a/compiled/index.css +++ b/compiled/index.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-size-picker .components-font-size-picker>:first-child{display:none}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} diff --git a/compiled/index.js b/compiled/index.js index 22e6f15..b01c536 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,o={511(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,p={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function m(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return v.test(e)?e:"24px"}return p[e]||"24px"}const w={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function f(e){return Object.prototype.hasOwnProperty.call(w,e)?e:"mouse"}function b({iconType:e}){const o=w[f(e)];return(0,t.jsx)(o,{})}const g={flow:"flow",fixed:"fixed",absolute:"absolute"},j={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},_={left:"left",center:"center",right:"right"};function k(e){return g[e]||g.flow}function y(e){return j[e]||j["bottom-center"]}function B(e){return _[e]||_.center}function S(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function M(e,o,t="center"){const i=k(e);if("fixed"===i)return`is-position-fixed is-screen-position-${y(o)}`;if("absolute"===i)return"is-position-absolute";const l=B(t);return"center"!==l?`is-flow-align-${l}`:""}function N(e,o,t){return"absolute"!==k(e)?{}:{"--scroll-indicator-x":`${S(o,50)}%`,"--scroll-indicator-y":`${S(t,85)}%`}}const P=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],C=[{name:(0,l.__)("Small","scroll-indicator"),slug:"small",size:"18px"},{name:(0,l.__)("Medium","scroll-indicator"),slug:"medium",size:"24px"},{name:(0,l.__)("Large","scroll-indicator"),slug:"large",size:"32px"},{name:(0,l.__)("Extra Large","scroll-indicator"),slug:"extra-large",size:"48px"}],V=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],T=[{value:"left",label:(0,l.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,l.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,l.__)("Align right","scroll-indicator"),icon:a}],z=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],H=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)(H.UU,{icon:i,edit:function({attributes:e,setAttributes:o,clientId:i}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",hideAfterScrolling:p=!1,showText:v=!0,customText:g="Scroll down",positionMode:j="flow",screenPosition:_="bottom-center",absoluteX:H=50,absoluteY:O=85}=e,L=(0,r.useRef)(),{selectBlock:A}=(0,x.useDispatch)("core/block-editor"),G=f(s),Z=m(c,a),E=k(j),$=y(_),F=S(H,50),X=S(O,85),D=B(e.flowAlign);function R(e){const t=L.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&o({absoluteX:S((e.clientX-l.left)/l.width*100,50),absoluteY:S((e.clientY-l.top)/l.height*100,85)})}const Y=(0,n.useBlockProps)({ref:L,className:M(E,$,D),style:{"--scroll-indicator-size":Z,...N(E,F,X)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:P.map(e=>{const i=w[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(i,{})})},e.value)})})]}),(0,t.jsx)(n.FontSizePicker,{fontSizes:C,value:Z,onChange:e=>o({iconSize:"custom",customSizeValue:e||"24px"}),headingLevel:3,withSlider:!1})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:V.map(e=>(0,t.jsx)(h.Button,{isPressed:E===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===E&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:T.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:D===e.value,onClick:()=>o({flowAlign:e.value})},e.value)})})]}),"fixed"===E&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:z.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:$===e.value,onClick:()=>o({screenPosition:e.value})},e.value)})})]}),"absolute"===E&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:F,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:X,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===E&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:v,onChange:e=>o({showText:e})}),v&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:g,onChange:e=>o({customText:e}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]}),(0,t.jsx)(h.PanelBody,{title:(0,l.__)("Behavior","scroll-indicator"),initialOpen:!1,children:(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Hide after scrolling","scroll-indicator"),help:(0,l.__)("Hide the indicator once user starts scrolling","scroll-indicator"),checked:p,onChange:e=>o({hideAfterScrolling:e})})})]}),(0,t.jsx)("div",{...Y,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${G}`,onPointerDown:function(e){if("absolute"!==E||0!==e.button)return;e.preventDefault(),e.stopPropagation(),A(i),R(e);const o=e.currentTarget.ownerDocument,t=e=>{R(e)},l=()=>{o.removeEventListener("pointermove",t),o.removeEventListener("pointerup",l)};o.addEventListener("pointermove",t),o.addEventListener("pointerup",l)},children:[(0,t.jsx)(b,{iconType:G}),v&&(0,t.jsx)("div",{className:"scroll-text",children:g||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:i="M",customSizeValue:l="24px",hideAfterScrolling:r=!1,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85,flowAlign:x="center"}=e,p=f(o),v=m(i,l),w=c||"Scroll down",g=n.useBlockProps.save({className:M(a,d,x),style:{"--scroll-indicator-size":v,...N(a,u,h)}});return(0,t.jsx)("div",{...g,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${p}`,"aria-label":w,"data-hide-after-scrolling":r?"true":"false",children:[(0,t.jsx)(b,{iconType:p}),s&&(0,t.jsx)("div",{className:"scroll-text",children:w})]})})}})}},t={};function i(e){var l=t[e];if(void 0!==l)return l.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,e=[],i.O=(o,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,l,n]},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};i.O.j=o=>0===e[o];var o=(o,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(o&&o(t);ai(511));l=i.O(l)})(); \ No newline at end of file +(()=>{"use strict";var e,o={511(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,p={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function m(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return v.test(e)?e:"24px"}return p[e]||"24px"}const w={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function b(e){return Object.prototype.hasOwnProperty.call(w,e)?e:"mouse"}function f({iconType:e}){const o=w[b(e)];return(0,t.jsx)(o,{})}const j={flow:"flow",fixed:"fixed",absolute:"absolute"},g={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},_={left:"left",center:"center",right:"right"};function k(e){return j[e]||j.flow}function y(e){return g[e]||g["bottom-center"]}function B(e){return _[e]||_.center}function M(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function N(e,o,t="center"){const i=k(e);if("fixed"===i)return`is-position-fixed is-screen-position-${y(o)}`;if("absolute"===i)return"is-position-absolute";const l=B(t);return"center"!==l?`is-flow-align-${l}`:""}function S(e,o,t){return"absolute"!==k(e)?{}:{"--scroll-indicator-x":`${M(o,50)}%`,"--scroll-indicator-y":`${M(t,85)}%`}}const z=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],P=[{name:(0,l.__)("Small","scroll-indicator"),slug:"small",size:"18px"},{name:(0,l.__)("Medium","scroll-indicator"),slug:"medium",size:"24px"},{name:(0,l.__)("Large","scroll-indicator"),slug:"large",size:"32px"},{name:(0,l.__)("Extra Large","scroll-indicator"),slug:"extra-large",size:"48px"}],V=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],C=[{value:"left",label:(0,l.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,l.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,l.__)("Align right","scroll-indicator"),icon:a}],T=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],L=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)(L.UU,{icon:i,edit:function({attributes:e,setAttributes:o,clientId:i}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",showText:p=!0,customText:v="Scroll down",positionMode:j="flow",screenPosition:g="bottom-center",absoluteX:_=50,absoluteY:L=85}=e,O=(0,r.useRef)(),{selectBlock:H}=(0,x.useDispatch)("core/block-editor"),A=b(s),G=m(c,a),Z=k(j),E=y(g),$=M(_,50),F=M(L,85),X=B(e.flowAlign);function D(e){const t=O.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&o({absoluteX:M((e.clientX-l.left)/l.width*100,50),absoluteY:M((e.clientY-l.top)/l.height*100,85)})}const R=(0,n.useBlockProps)({ref:O,className:N(Z,E,X),style:{"--scroll-indicator-size":G,...S(Z,$,F)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:z.map(e=>{const i=w[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(i,{})})},e.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Size","scroll-indicator")}),(0,t.jsx)(n.FontSizePicker,{fontSizes:P,value:G,onChange:e=>o({iconSize:"custom",customSizeValue:e||"24px"}),headingLevel:3,withSlider:!1})]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:V.map(e=>(0,t.jsx)(h.Button,{isPressed:Z===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===Z&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:C.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:X===e.value,onClick:()=>o({flowAlign:e.value})},e.value)})})]}),"fixed"===Z&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:T.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:E===e.value,onClick:()=>o({screenPosition:e.value})},e.value)})})]}),"absolute"===Z&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:$,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:F,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===Z&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:p,onChange:e=>o({showText:e})}),p&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:v,onChange:e=>o({customText:e}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]})]}),(0,t.jsx)("div",{...R,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${A}`,onPointerDown:function(e){if("absolute"!==Z||0!==e.button)return;e.preventDefault(),e.stopPropagation(),H(i),D(e);const o=e.currentTarget.ownerDocument,t=e=>{D(e)},l=()=>{o.removeEventListener("pointermove",t),o.removeEventListener("pointerup",l)};o.addEventListener("pointermove",t),o.addEventListener("pointerup",l)},children:[(0,t.jsx)(f,{iconType:A}),p&&(0,t.jsx)("div",{className:"scroll-text",children:v||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:i="M",customSizeValue:l="24px",showText:r=!0,customText:s="Scroll down",positionMode:c="flow",screenPosition:a="bottom-center",absoluteX:d=50,absoluteY:u=85,flowAlign:h="center"}=e,x=b(o),p=m(i,l),v=s||"Scroll down",w=n.useBlockProps.save({className:N(c,a,h),style:{"--scroll-indicator-size":p,...S(c,d,u)}});return(0,t.jsx)("div",{...w,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${x}`,"aria-label":v,"data-hide-after-scrolling":"true",children:[(0,t.jsx)(f,{iconType:x}),r&&(0,t.jsx)("div",{className:"scroll-text",children:v})]})})}})}},t={};function i(e){var l=t[e];if(void 0!==l)return l.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,e=[],i.O=(o,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,l,n]},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};i.O.j=o=>0===e[o];var o=(o,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(o&&o(t);ai(511));l=i.O(l)})(); \ No newline at end of file diff --git a/compiled/view.asset.php b/compiled/view.asset.php index a54dc0f..faf9a1b 100644 --- a/compiled/view.asset.php +++ b/compiled/view.asset.php @@ -1 +1 @@ - array(), 'version' => '34d67748a8104cbcd634'); + array(), 'version' => '2a6542ac716471a64c5c'); diff --git a/compiled/view.js b/compiled/view.js index 063be0b..7e60c65 100644 --- a/compiled/view.js +++ b/compiled/view.js @@ -1 +1 @@ -document.addEventListener("DOMContentLoaded",function(){const t=document.querySelectorAll(".scroll-indicator");if(0===t.length)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");t.forEach(function(t){const n="true"===t.getAttribute("data-hide-after-scrolling"),i=t.closest(".wp-block-scroll-indicator-scroll-indicator"),o=t.getAttribute("tabindex");if(t.addEventListener("click",function(){const t=window.innerHeight,n=window.scrollY+t;window.scrollTo({top:n,behavior:e.matches?"auto":"smooth"})}),t.style.cursor="pointer",n&&i){let r=i.offsetTop,a=r+i.offsetHeight;const c=e.matches?"none":"opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s",l=e.matches?"none":"opacity 0.35s ease, transform 0.35s ease";function s(){const e=window.scrollY,n=window.innerHeight;var i;i=e<=r||re,t.style.transition=i?l:c,t.style.opacity=i?"1":"0",t.style.visibility=i?"visible":"hidden",t.style.pointerEvents=i?"auto":"none",t.style.transform=i?"translateY(0)":"translateY(10px)",i?(t.removeAttribute("aria-hidden"),null===o?t.removeAttribute("tabindex"):t.setAttribute("tabindex",o)):(t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","-1"),t.ownerDocument.activeElement===t&&t.blur())}window.addEventListener("resize",function(){r=i.offsetTop,a=r+i.offsetHeight,s()}),s(),window.addEventListener("scroll",s,{passive:!0})}})}); \ No newline at end of file +document.addEventListener("DOMContentLoaded",function(){const t=document.querySelectorAll(".scroll-indicator");if(0===t.length)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");t.forEach(function(t){const n=t.getAttribute("tabindex");let i=!1;t.addEventListener("click",function(){const t=window.innerHeight,n=window.scrollY+t;window.scrollTo({top:n,behavior:e.matches?"auto":"smooth"})}),t.style.cursor="pointer";const o=e.matches?"none":"opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s",s=e.matches?"none":"opacity 0.35s ease, transform 0.35s ease, visibility 0s";function r(){var e;e=window.scrollY<=16,t.style.transition=e?s:o,t.style.opacity=e?"1":"0",t.style.visibility=e?"visible":"hidden",t.style.pointerEvents=e?"auto":"none",t.style.transform=e?"translateY(0)":"translateY(10px)",e?(t.removeAttribute("aria-hidden"),null===n?t.removeAttribute("tabindex"):t.setAttribute("tabindex",n)):(t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","-1"),t.ownerDocument.activeElement===t&&t.blur())}r(),window.addEventListener("scroll",function(){i||(i=!0,window.requestAnimationFrame(function(){r(),i=!1}))},{passive:!0}),"function"==typeof e.addEventListener&&e.addEventListener("change",function(){r()})})}); \ No newline at end of file diff --git a/readme.txt b/readme.txt index 2338e18..b80426c 100644 --- a/readme.txt +++ b/readme.txt @@ -16,7 +16,7 @@ Scroll Indicator adds a focused block for landing pages, hero sections, editoria Choose from multiple icon styles, adjust the size, use native WordPress text color controls, add optional helper text, and let visitors click or keyboard-activate the indicator to move smoothly down the page. -The block is intentionally lightweight. Animations are handled with CSS, respect reduced-motion preferences, and the front-end script is limited to click-to-scroll and optional hide-after-scrolling behavior. +The block is intentionally lightweight. Animations are handled with CSS, respect reduced-motion preferences, and the front-end script is limited to click-to-scroll and automatic hide-on-scroll behavior. = Key Features = @@ -26,7 +26,7 @@ The block is intentionally lightweight. Animations are handled with CSS, respect * Fixed screen positioning and draggable absolute positioning for hero-style sections. * CSS-only animation that respects the visitor's reduced-motion preference. * Optional text label beneath the icon. -* Optional hide-after-scrolling behavior. +* Automatic hide-on-scroll behavior. * Keyboard-accessible click-to-scroll interaction. * No animation libraries or heavy runtime dependencies. @@ -53,7 +53,7 @@ Source code and build tooling are maintained at https://github.com/dhanson-wp/sc = Does this plugin require a JavaScript animation library? = -No. Animations are handled with CSS. The front-end script only powers click-to-scroll and the optional hide-after-scrolling behavior. +No. Animations are handled with CSS. The front-end script only powers click-to-scroll and automatic hide-on-scroll behavior. = Can I change the icon color? = @@ -69,7 +69,7 @@ Yes. The front-end indicator is saved as a keyboard-focusable button-like contro = Will the block work without JavaScript? = -The icon and optional text still render without JavaScript. JavaScript is only needed for click-to-scroll and hide-after-scrolling behavior. +The icon and optional text still render without JavaScript. JavaScript is only needed for click-to-scroll and automatic hide-on-scroll behavior. == Changelog == diff --git a/src/block.json b/src/block.json index 55c74bb..eefa0a5 100644 --- a/src/block.json +++ b/src/block.json @@ -23,7 +23,7 @@ }, "hideAfterScrolling": { "type": "boolean", - "default": false + "default": true }, "showText": { "type": "boolean", diff --git a/src/edit.js b/src/edit.js index c001746..a8f7f54 100644 --- a/src/edit.js +++ b/src/edit.js @@ -107,7 +107,6 @@ export default function Edit( { attributes, setAttributes, clientId } ) { iconType = 'mouse', iconSize = 'M', customSizeValue = '24px', - hideAfterScrolling = false, showText = true, customText = 'Scroll down', positionMode = 'flow', @@ -236,18 +235,23 @@ export default function Edit( { attributes, setAttributes, clientId } ) { } ) }
- - setAttributes( { - iconSize: 'custom', - customSizeValue: value || '24px', - } ) - } - headingLevel={ 3 } - withSlider={ false } - /> +
+ + { __( 'Icon Size', 'scroll-indicator' ) } + + + setAttributes( { + iconSize: 'custom', + customSizeValue: value || '24px', + } ) + } + headingLevel={ 3 } + withSlider={ false } + /> +
) } - - - setAttributes( { hideAfterScrolling: value } ) - } - /> -
:first-child { + display: none; + } +} + .scroll-indicator-icon-buttons { display: flex; flex-wrap: wrap; diff --git a/src/save.js b/src/save.js index ddebaf0..48cc49a 100644 --- a/src/save.js +++ b/src/save.js @@ -7,7 +7,6 @@ export default function save( { attributes } ) { iconType = 'mouse', iconSize = 'M', customSizeValue = '24px', - hideAfterScrolling = false, showText = true, customText = 'Scroll down', positionMode = 'flow', @@ -39,9 +38,7 @@ export default function save( { attributes } ) { type="button" className={ `scroll-indicator icon-${ normalizedIconType }` } aria-label={ label } - data-hide-after-scrolling={ - hideAfterScrolling ? 'true' : 'false' - } + data-hide-after-scrolling="true" > { showText &&
{ label }
} diff --git a/src/view.js b/src/view.js index f0ecda6..26adfca 100644 --- a/src/view.js +++ b/src/view.js @@ -10,12 +10,9 @@ document.addEventListener( 'DOMContentLoaded', function () { ); scrollIndicators.forEach( function ( indicator ) { - const hideAfterScrolling = - indicator.getAttribute( 'data-hide-after-scrolling' ) === 'true'; - const blockElement = indicator.closest( - '.wp-block-scroll-indicator-scroll-indicator' - ); const originalTabIndex = indicator.getAttribute( 'tabindex' ); + const hideThreshold = 16; + let ticking = false; function scrollOneViewport() { const windowHeight = window.innerHeight; @@ -31,75 +28,73 @@ document.addEventListener( 'DOMContentLoaded', function () { indicator.style.cursor = 'pointer'; - if ( hideAfterScrolling && blockElement ) { - let blockTop = blockElement.offsetTop; - let blockBottom = blockTop + blockElement.offsetHeight; - const transition = prefersReducedMotion.matches - ? 'none' - : 'opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s'; - const visibleTransition = prefersReducedMotion.matches - ? 'none' - : 'opacity 0.35s ease, transform 0.35s ease'; - - function updateBlockPosition() { - blockTop = blockElement.offsetTop; - blockBottom = blockTop + blockElement.offsetHeight; - } - - function setIndicatorVisibility( isVisible ) { - indicator.style.transition = isVisible - ? visibleTransition - : transition; - indicator.style.opacity = isVisible ? '1' : '0'; - indicator.style.visibility = isVisible ? 'visible' : 'hidden'; - indicator.style.pointerEvents = isVisible ? 'auto' : 'none'; - indicator.style.transform = isVisible - ? 'translateY(0)' - : 'translateY(10px)'; - - if ( isVisible ) { - indicator.removeAttribute( 'aria-hidden' ); - - if ( originalTabIndex === null ) { - indicator.removeAttribute( 'tabindex' ); - } else { - indicator.setAttribute( 'tabindex', originalTabIndex ); - } + const hiddenTransition = prefersReducedMotion.matches + ? 'none' + : 'opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s'; + const visibleTransition = prefersReducedMotion.matches + ? 'none' + : 'opacity 0.35s ease, transform 0.35s ease, visibility 0s'; + + function setIndicatorVisibility( isVisible ) { + indicator.style.transition = isVisible + ? visibleTransition + : hiddenTransition; + indicator.style.opacity = isVisible ? '1' : '0'; + indicator.style.visibility = isVisible ? 'visible' : 'hidden'; + indicator.style.pointerEvents = isVisible ? 'auto' : 'none'; + indicator.style.transform = isVisible + ? 'translateY(0)' + : 'translateY(10px)'; + + if ( isVisible ) { + indicator.removeAttribute( 'aria-hidden' ); + + if ( originalTabIndex === null ) { + indicator.removeAttribute( 'tabindex' ); } else { - indicator.setAttribute( 'aria-hidden', 'true' ); - indicator.setAttribute( 'tabindex', '-1' ); + indicator.setAttribute( 'tabindex', originalTabIndex ); + } + } else { + indicator.setAttribute( 'aria-hidden', 'true' ); + indicator.setAttribute( 'tabindex', '-1' ); - if ( indicator.ownerDocument.activeElement === indicator ) { - indicator.blur(); - } + if ( indicator.ownerDocument.activeElement === indicator ) { + indicator.blur(); } } + } + + function handleScroll() { + setIndicatorVisibility( window.scrollY <= hideThreshold ); + } + + function requestVisibilityUpdate() { + if ( ticking ) { + return; + } - window.addEventListener( 'resize', function () { - updateBlockPosition(); + ticking = true; + window.requestAnimationFrame( function () { handleScroll(); + ticking = false; } ); + } - function handleScroll() { - const scrollTop = window.scrollY; - const viewportHeight = window.innerHeight; - const viewportBottom = scrollTop + viewportHeight; + function handleReducedMotionChange() { + handleScroll(); + } - if ( - scrollTop <= blockTop || - ( blockTop < viewportBottom && blockBottom > scrollTop ) - ) { - setIndicatorVisibility( true ); - } else { - setIndicatorVisibility( false ); - } - } + handleScroll(); - handleScroll(); + window.addEventListener( 'scroll', requestVisibilityUpdate, { + passive: true, + } ); - window.addEventListener( 'scroll', handleScroll, { - passive: true, - } ); + if ( typeof prefersReducedMotion.addEventListener === 'function' ) { + prefersReducedMotion.addEventListener( + 'change', + handleReducedMotionChange + ); } } ); } ); From dda374359ca21db39143e4319f83433c6b93d688 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Wed, 20 May 2026 16:38:22 -0500 Subject: [PATCH 08/12] Make Playground blueprint use packaged zip --- .wp-playground/blueprint.json | 2 +- .wp-playground/scroll-indicator.zip | Bin 0 -> 12332 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .wp-playground/scroll-indicator.zip diff --git a/.wp-playground/blueprint.json b/.wp-playground/blueprint.json index 27ddb0e..4e551bb 100644 --- a/.wp-playground/blueprint.json +++ b/.wp-playground/blueprint.json @@ -11,7 +11,7 @@ "step": "installPlugin", "pluginZipFile": { "resource": "url", - "url": "https://codeload.github.com/dhanson-wp/scroll-indicator/zip/refs/heads/codex/submission-readiness" + "url": "https://raw.githubusercontent.com/dhanson-wp/scroll-indicator/codex/submission-readiness/.wp-playground/scroll-indicator.zip" }, "options": { "activate": true diff --git a/.wp-playground/scroll-indicator.zip b/.wp-playground/scroll-indicator.zip new file mode 100644 index 0000000000000000000000000000000000000000..892e1b2c1d5782d408259a7ca749abf0577dab34 GIT binary patch literal 12332 zcma)?1#lcomafH27K23=Gqc4^EoPR*%wRDyGcz+YGs|L@ESAM!F+6$p?T$UO_s&*F zMO1f3e3eys{*##}e_2UTFjOEYC@7!|wR%mU-ww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OdiNc!{B$t?A%2ijNFnJ=PBE8hUiB^ma#vjINb9U(1<&;T~0K2los)>zriH0W(>0x zymB;=G1)j|<9SOMiy1^zTEr?9OWQy!*rR_UlQ^JOm{)ikZXCwF@Yx(0u)}}@3+$iH zu0QX6yQXk^VHjmmGDgLQ@K>duHX;N832A%gbffccmm8CnoR(ixpa>S|kQgAITNg(Y zv2MS@HYnJhe--NtN_U16JDD*rrT@65@d=*ZdKn1;HBjlBTD&G-Rxm&Fpc{fH^_EV`Z#*G`6)9?%K) zx8rqZfEV?Hl}za-R5f&K32YGv(z6qRFg;c{Cju_%!K_qr(66Vq+(4Lz^JCTE+g`WL z{KSapE;;%`GnJg-N)PT?Kx$p39j#OQkM)9)yde-?&N?hVWAQo-7DhgEI&aw`dBiE{ z0LS1gRn@}FXvcgIe|QN16u5Hs)b&A+DW%R`qr!WTaRcdUdHN!Ktd1FMF!6f~zfiy% zgBBArTQXwi{>sxoX`eiZ=5-;(yf8bNav`Fbf zx0q7ZUP!Yv`+i?L+6wpSpb@8X${A|JbR?MCJqfm?CYOxRrzS)|#wMBmusB^GID!K< zGbyku>i3~p8P24^+^=-EEdq153Wr-_QOyUb-G7$n4iT8t_34_m15ov}1nkv-+Aksn zUph?XlGXV{6?=Y#aTG*YYue(ZXGV4k{<#ORd}tB17At~dJL*1R?X~G$Z}u~w6tK9KtnC$r2&b_~-g?72z7{c@oGZVDv+1DEsOfPcgNPZ8{&e$;=U*+~)p4gI^Di|h|H z`TI2EuhD;0*8YB{T=wX632gAJO8rrzpt|XeC^n{|Hpg$Dx>@*|Mw*l`5(^! z`Mxgt>u&vX<@T5O-zU0+f8b01GyX4L{jX{A@3|P~53b<5ulwJc{m)7BKU&&O@~3)! u Date: Thu, 21 May 2026 08:57:29 -0500 Subject: [PATCH 09/12] Polish editor controls and positioning --- .wp-playground/scroll-indicator.zip | Bin 12332 -> 12265 bytes compiled/block.json | 3 - compiled/index-rtl.css | 2 +- compiled/index.asset.php | 2 +- compiled/index.css | 2 +- compiled/index.js | 2 +- compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- src/block.json | 1 - src/edit.js | 89 +++++++++++++--------------- src/editor.scss | 17 ++---- src/style.scss | 16 +++-- 12 files changed, 62 insertions(+), 76 deletions(-) diff --git a/.wp-playground/scroll-indicator.zip b/.wp-playground/scroll-indicator.zip index 892e1b2c1d5782d408259a7ca749abf0577dab34..6bcffdf8e32fb59d350dd2bbf520d5e51944da5d 100644 GIT binary patch literal 12265 zcma)?19YC-*0y6?O=H_uW23Qc+in`$jcr?vZQD*`n}52`_kX+H=j?sHH{%__JI0my zJZs+bS!>Q)MgkZF1pop90w7JbRs-Od7yA3p_WE|#78cZ|RtBc}x(?QMw31>1LZ9V@ z!lR_Dmgx}u@3?w7zfhv8=2J3PA_JCNh%x}tlG_>}WwHaY*Jdt%aFR2ar1_rO*?s5r zoxb|6(APExEy4y;o``=-3=R9>Bc*W|2VRV=ST<%gLMkt~yj@Rxc#0C6EIWD#f&@ay zJV-iDzqx%EC1}Xfb|Uzh@bRiBKB7aH#~YCZSodSp8A0?R_iEKPRv22pF0h>*`Iay} zJDkg-{<+xl7eWV>%{q@ksJ!pq4$sAU8(qNqt|URTcC-y_XY>em+2l{K0aPv(PYvBg z%8K@V?z8oZ(;416wtDQ)`@*a*9g<8In_KisD@S6P?K z<(maUq56wYjuNKZ%xt;p`UM)O<2dYvt5aKjW?A`jqgTRVn1s{k-##wbH*yiY*75te z@#`$&A$Eq095hiS7?RWAf54*6d;5}m$?#+?-Fw$HH2dL@RYn3F0$j(3UL6nsfDs4) zK<0lJXk4)Fw*?~lPYa}PZE0g_VQ4_BXJM^xPGe?oZIu@%75ctd0cQ`WUDu7aQ<45L z>Jgu)P^zh@^T1V;7nTMvvObo@(mbt)Qjr$L*6O&;nC!X!h!=KCgOqI{oaLnqjVHq} zk}l~b5Gg$N2+q>739@P^q$<{YklYVxRv>M4{mKibS%rlA6ctNN1XuKBZY+FSSgfzI z5yqfvxTwWNn`YQ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5(g=>s6af?{iR6*8fU?WnP>R>oBbaWG@|GL diff --git a/compiled/block.json b/compiled/block.json index c5c365f..e6e3a75 100644 --- a/compiled/block.json +++ b/compiled/block.json @@ -65,9 +65,6 @@ "text": true, "background": false }, - "typography": { - "fontSize": true - }, "spacing": { "margin": true, "padding": true diff --git a/compiled/index-rtl.css b/compiled/index-rtl.css index ffad80d..4049b21 100644 --- a/compiled/index-rtl.css +++ b/compiled/index-rtl.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-size-picker .components-font-size-picker>:first-child{display:none}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-left:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-scroll-indicator-scroll-indicator.is-position-absolute{cursor:grab}.editor-styles-wrapper .wp-block-scroll-indicator-scroll-indicator.is-position-absolute:active{cursor:grabbing} diff --git a/compiled/index.asset.php b/compiled/index.asset.php index 47f31c9..1d94846 100644 --- a/compiled/index.asset.php +++ b/compiled/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e225724cc9f6cf5c7803'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '1b44d2428cdc22b0bb6b'); diff --git a/compiled/index.css b/compiled/index.css index be846aa..38265f0 100644 --- a/compiled/index.css +++ b/compiled/index.css @@ -1 +1 @@ -.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-size-picker .components-font-size-picker>:first-child{display:none}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed){position:relative}.editor-styles-wrapper .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed{position:absolute} +.scroll-indicator-icon-picker,.scroll-indicator-position-picker,.scroll-indicator-size-picker{border:0;margin:0 0 16px;padding:0}.scroll-indicator-icon-picker legend,.scroll-indicator-position-picker legend,.scroll-indicator-size-picker legend{font-weight:500;margin-bottom:8px}.scroll-indicator-icon-buttons{display:flex;flex-wrap:wrap;gap:4px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button{align-items:center;display:flex;height:44px;justify-content:center;padding:8px;width:44px}.scroll-indicator-icon-buttons .scroll-indicator-icon-button svg{height:20px;width:20px}.scroll-indicator-icon-preview{align-items:center;display:inline-flex;height:20px;justify-content:center;width:20px}.scroll-indicator-icon-preview.icon-arrow-down line,.scroll-indicator-icon-preview.icon-arrow-down path,.scroll-indicator-icon-preview.icon-arrow-down rect,.scroll-indicator-icon-preview.icon-arrow-down svg,.scroll-indicator-icon-preview.icon-chevron-bounce line,.scroll-indicator-icon-preview.icon-chevron-bounce path,.scroll-indicator-icon-preview.icon-chevron-bounce rect,.scroll-indicator-icon-preview.icon-chevron-bounce svg,.scroll-indicator-icon-preview.icon-hand-point line,.scroll-indicator-icon-preview.icon-hand-point path,.scroll-indicator-icon-preview.icon-hand-point rect,.scroll-indicator-icon-preview.icon-hand-point svg,.scroll-indicator-icon-preview.icon-mouse line,.scroll-indicator-icon-preview.icon-mouse path,.scroll-indicator-icon-preview.icon-mouse rect,.scroll-indicator-icon-preview.icon-mouse svg{fill:none}.scroll-indicator-mode-buttons{display:grid;gap:4px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}.scroll-indicator-position-buttons{display:flex;gap:4px}.scroll-indicator-position-buttons .components-button{justify-content:center;min-width:44px}.scroll-indicator-absolute-controls,.scroll-indicator-position-note{color:#1e1e1e;font-size:12px;line-height:1.4;margin:0 0 12px}.scroll-indicator-control-icon{display:inline-flex;height:18px;margin-right:6px;vertical-align:middle;width:18px}.editor-styles-wrapper .wp-block-scroll-indicator-scroll-indicator.is-position-absolute{cursor:grab}.editor-styles-wrapper .wp-block-scroll-indicator-scroll-indicator.is-position-absolute:active{cursor:grabbing} diff --git a/compiled/index.js b/compiled/index.js index b01c536..3ed95e0 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,o={511(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var i=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const l=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,p={S:"18px",M:"24px",L:"32px",XL:"48px"},v=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function m(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return v.test(e)?e:"24px"}return p[e]||"24px"}const w={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function b(e){return Object.prototype.hasOwnProperty.call(w,e)?e:"mouse"}function f({iconType:e}){const o=w[b(e)];return(0,t.jsx)(o,{})}const j={flow:"flow",fixed:"fixed",absolute:"absolute"},g={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},_={left:"left",center:"center",right:"right"};function k(e){return j[e]||j.flow}function y(e){return g[e]||g["bottom-center"]}function B(e){return _[e]||_.center}function M(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function N(e,o,t="center"){const i=k(e);if("fixed"===i)return`is-position-fixed is-screen-position-${y(o)}`;if("absolute"===i)return"is-position-absolute";const l=B(t);return"center"!==l?`is-flow-align-${l}`:""}function S(e,o,t){return"absolute"!==k(e)?{}:{"--scroll-indicator-x":`${M(o,50)}%`,"--scroll-indicator-y":`${M(t,85)}%`}}const z=[{value:"mouse",label:(0,l.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,l.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,l.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,l.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,l.__)("Hand","scroll-indicator")}],P=[{name:(0,l.__)("Small","scroll-indicator"),slug:"small",size:"18px"},{name:(0,l.__)("Medium","scroll-indicator"),slug:"medium",size:"24px"},{name:(0,l.__)("Large","scroll-indicator"),slug:"large",size:"32px"},{name:(0,l.__)("Extra Large","scroll-indicator"),slug:"extra-large",size:"48px"}],V=[{value:"flow",label:(0,l.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,l.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,l.__)("Absolute","scroll-indicator")}],C=[{value:"left",label:(0,l.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,l.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,l.__)("Align right","scroll-indicator"),icon:a}],T=[{value:"bottom-left",label:(0,l.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,l.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,l.__)("Bottom right","scroll-indicator"),icon:a}],L=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)(L.UU,{icon:i,edit:function({attributes:e,setAttributes:o,clientId:i}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",showText:p=!0,customText:v="Scroll down",positionMode:j="flow",screenPosition:g="bottom-center",absoluteX:_=50,absoluteY:L=85}=e,O=(0,r.useRef)(),{selectBlock:H}=(0,x.useDispatch)("core/block-editor"),A=b(s),G=m(c,a),Z=k(j),E=y(g),$=M(_,50),F=M(L,85),X=B(e.flowAlign);function D(e){const t=O.current,i=t?.closest(".wp-block-cover")||t?.parentElement;if(!i)return;const l=i.getBoundingClientRect();0!==l.width&&0!==l.height&&o({absoluteX:M((e.clientX-l.left)/l.width*100,50),absoluteY:M((e.clientY-l.top)/l.height*100,85)})}const R=(0,n.useBlockProps)({ref:O,className:N(Z,E,X),style:{"--scroll-indicator-size":G,...S(Z,$,F)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:z.map(e=>{const i=w[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(i,{})})},e.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Icon Size","scroll-indicator")}),(0,t.jsx)(n.FontSizePicker,{fontSizes:P,value:G,onChange:e=>o({iconSize:"custom",customSizeValue:e||"24px"}),headingLevel:3,withSlider:!1})]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:V.map(e=>(0,t.jsx)(h.Button,{isPressed:Z===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===Z&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:C.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:X===e.value,onClick:()=>o({flowAlign:e.value})},e.value)})})]}),"fixed"===Z&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,l.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:T.map(e=>{const i=e.icon;return(0,t.jsx)(h.Button,{icon:i,label:e.label,showTooltip:!0,isPressed:E===e.value,onClick:()=>o({screenPosition:e.value})},e.value)})})]}),"absolute"===Z&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,l.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Horizontal","scroll-indicator"),value:$,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,l.__)("Vertical","scroll-indicator"),value:F,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===Z&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,l.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]}),(0,t.jsxs)(h.PanelBody,{title:(0,l.__)("Text","scroll-indicator"),initialOpen:!1,children:[(0,t.jsx)(h.ToggleControl,{label:(0,l.__)("Show text","scroll-indicator"),checked:p,onChange:e=>o({showText:e})}),p&&(0,t.jsx)(h.TextControl,{label:(0,l.__)("Custom Text","scroll-indicator"),value:v,onChange:e=>o({customText:e}),placeholder:(0,l.__)("Scroll down","scroll-indicator")})]})]}),(0,t.jsx)("div",{...R,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${A}`,onPointerDown:function(e){if("absolute"!==Z||0!==e.button)return;e.preventDefault(),e.stopPropagation(),H(i),D(e);const o=e.currentTarget.ownerDocument,t=e=>{D(e)},l=()=>{o.removeEventListener("pointermove",t),o.removeEventListener("pointerup",l)};o.addEventListener("pointermove",t),o.addEventListener("pointerup",l)},children:[(0,t.jsx)(f,{iconType:A}),p&&(0,t.jsx)("div",{className:"scroll-text",children:v||(0,l.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:i="M",customSizeValue:l="24px",showText:r=!0,customText:s="Scroll down",positionMode:c="flow",screenPosition:a="bottom-center",absoluteX:d=50,absoluteY:u=85,flowAlign:h="center"}=e,x=b(o),p=m(i,l),v=s||"Scroll down",w=n.useBlockProps.save({className:N(c,a,h),style:{"--scroll-indicator-size":p,...S(c,d,u)}});return(0,t.jsx)("div",{...w,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${x}`,"aria-label":v,"data-hide-after-scrolling":"true",children:[(0,t.jsx)(f,{iconType:x}),r&&(0,t.jsx)("div",{className:"scroll-text",children:v})]})})}})}},t={};function i(e){var l=t[e];if(void 0!==l)return l.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,e=[],i.O=(o,t,l,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(i.O).every(e=>i.O[e](t[c]))?t.splice(c--,1):(s=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,l,n]},i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};i.O.j=o=>0===e[o];var o=(o,t)=>{var l,n,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(l in s)i.o(s,l)&&(i.m[l]=s[l]);if(c)var d=c(i)}for(o&&o(t);ai(511));l=i.O(l)})(); \ No newline at end of file +(()=>{"use strict";var o,e={511(){const o=window.wp.blocks,e=window.wp.primitives,t=window.ReactJSXRuntime;var l=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const i=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,v={S:"18px",M:"24px",L:"32px",XL:"48px"},p=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function w(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return p.test(o)?o:"24px"}return v[o]||"24px"}const m={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function b(o){return Object.prototype.hasOwnProperty.call(m,o)?o:"mouse"}function f({iconType:o}){const e=m[b(o)];return(0,t.jsx)(e,{})}const j={flow:"flow",fixed:"fixed",absolute:"absolute"},_={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},g={left:"left",center:"center",right:"right"};function k(o){return j[o]||j.flow}function B(o){return _[o]||_["bottom-center"]}function y(o){return g[o]||g.center}function M(o,e){const t="number"==typeof o?o:Number.parseFloat(o);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):e}function N(o,e,t="center"){const l=k(o);if("fixed"===l)return`is-position-fixed is-screen-position-${B(e)}`;if("absolute"===l)return"is-position-absolute";const i=y(t);return"center"!==i?`is-flow-align-${i}`:""}function S(o,e,t){return"absolute"!==k(o)?{}:{"--scroll-indicator-x":`${M(e,50)}%`,"--scroll-indicator-y":`${M(t,85)}%`}}const P=[{value:"mouse",label:(0,i.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,i.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,i.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,i.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,i.__)("Hand","scroll-indicator")}],V=[{value:"S",label:(0,i.__)("Small","scroll-indicator"),text:"S"},{value:"M",label:(0,i.__)("Medium","scroll-indicator"),text:"M"},{value:"L",label:(0,i.__)("Large","scroll-indicator"),text:"L"},{value:"XL",label:(0,i.__)("Extra Large","scroll-indicator"),text:"XL"}],T=[{value:"flow",label:(0,i.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,i.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,i.__)("Absolute","scroll-indicator")}],C=[{value:"left",label:(0,i.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,i.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,i.__)("Align right","scroll-indicator"),icon:a}],z=[{value:"bottom-left",label:(0,i.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,i.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,i.__)("Bottom right","scroll-indicator"),icon:a}],L=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(L.UU,{icon:l,edit:function({attributes:o,setAttributes:e,clientId:l}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",showText:v=!0,customText:p="Scroll down",positionMode:j="flow",screenPosition:_="bottom-center",absoluteX:g=50,absoluteY:L=85}=o,H=(0,r.useRef)(),{selectBlock:O}=(0,x.useDispatch)("core/block-editor"),G=b(s),A=w(c,a),X=k(j),Z=B(_),E=M(g,50),$=M(L,85),D=y(o.flowAlign);function F(o){const t=H.current,l=t?.closest(".wp-block-cover")||t?.parentElement;if(!l)return;const i=l.getBoundingClientRect();0!==i.width&&0!==i.height&&e({absoluteX:M((o.clientX-i.left)/i.width*100,50),absoluteY:M((o.clientY-i.top)/i.height*100,85)})}const R=(0,n.useBlockProps)({ref:H,className:N(X,Z,D),style:{"--scroll-indicator-size":A,...S(X,E,$)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,i.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:P.map(o=>{const l=m[o.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===o.value,onClick:()=>e({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${o.value}`,children:(0,t.jsx)(l,{})})},o.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Icon Size","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-size-buttons",children:V.map(o=>(0,t.jsx)(h.Button,{isPressed:c===o.value,label:o.label,showTooltip:!0,onClick:()=>e({iconSize:o.value}),children:o.text},o.value))})]}),(0,t.jsx)(h.ToggleControl,{label:(0,i.__)("Show text","scroll-indicator"),checked:v,onChange:o=>e({showText:o})}),v&&(0,t.jsx)(h.TextControl,{__next40pxDefaultSize:!0,label:(0,i.__)("Text","scroll-indicator"),value:p,onChange:o=>e({customText:o}),placeholder:(0,i.__)("Scroll down","scroll-indicator")})]}),(0,t.jsxs)(h.PanelBody,{title:(0,i.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:T.map(o=>(0,t.jsx)(h.Button,{isPressed:X===o.value,onClick:()=>e({positionMode:o.value}),children:o.label},o.value))})]}),"flow"===X&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:C.map(o=>{const l=o.icon;return(0,t.jsx)(h.Button,{icon:l,label:o.label,showTooltip:!0,isPressed:D===o.value,onClick:()=>e({flowAlign:o.value})},o.value)})})]}),"fixed"===X&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:z.map(o=>{const l=o.icon;return(0,t.jsx)(h.Button,{icon:l,label:o.label,showTooltip:!0,isPressed:Z===o.value,onClick:()=>e({screenPosition:o.value})},o.value)})})]}),"absolute"===X&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,i.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,i.__)("Horizontal","scroll-indicator"),value:E,min:0,max:100,onChange:o=>e({absoluteX:o})}),(0,t.jsx)(h.RangeControl,{label:(0,i.__)("Vertical","scroll-indicator"),value:$,min:0,max:100,onChange:o=>e({absoluteY:o})})]}),"fixed"===X&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,i.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]})]}),(0,t.jsx)("div",{...R,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${G}`,onPointerDown:function(o){if("absolute"!==X||0!==o.button)return;o.preventDefault(),o.stopPropagation(),O(l),F(o);const e=o.currentTarget.ownerDocument,t=o=>{F(o)},i=()=>{e.removeEventListener("pointermove",t),e.removeEventListener("pointerup",i)};e.addEventListener("pointermove",t),e.addEventListener("pointerup",i)},children:[(0,t.jsx)(f,{iconType:G}),v&&(0,t.jsx)("div",{className:"scroll-text",children:p||(0,i.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:i="24px",showText:r=!0,customText:s="Scroll down",positionMode:c="flow",screenPosition:a="bottom-center",absoluteX:d=50,absoluteY:u=85,flowAlign:h="center"}=o,x=b(e),v=w(l,i),p=s||"Scroll down",m=n.useBlockProps.save({className:N(c,a,h),style:{"--scroll-indicator-size":v,...S(c,d,u)}});return(0,t.jsx)("div",{...m,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${x}`,"aria-label":p,"data-hide-after-scrolling":"true",children:[(0,t.jsx)(f,{iconType:x}),r&&(0,t.jsx)("div",{className:"scroll-text",children:p})]})})}})}},t={};function l(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,l),n.exports}l.m=e,o=[],l.O=(e,t,i,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(l.O).every(o=>l.O[o](t[c]))?t.splice(c--,1):(s=!1,n0&&o[d-1][2]>n;d--)o[d]=o[d-1];o[d]=[t,i,n]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,t)=>{var i,n,[r,s,c]=t,a=0;if(r.some(e=>0!==o[e])){for(i in s)l.o(s,i)&&(l.m[i]=s[i]);if(c)var d=c(l)}for(e&&e(t);al(511));i=l.O(i)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css index 9f10f34..3e79518 100644 --- a/compiled/style-index-rtl.css +++ b/compiled/style-index-rtl.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index 5043022..4c926ed 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:20px;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/src/block.json b/src/block.json index eefa0a5..a4a5512 100644 --- a/src/block.json +++ b/src/block.json @@ -58,7 +58,6 @@ "html": false, "align": [ "left", "center", "right" ], "color": { "text": true, "background": false }, - "typography": { "fontSize": true }, "spacing": { "margin": true, "padding": true } }, "textdomain": "scroll-indicator", diff --git a/src/edit.js b/src/edit.js index a8f7f54..cc53d7e 100644 --- a/src/edit.js +++ b/src/edit.js @@ -1,9 +1,5 @@ import { __ } from '@wordpress/i18n'; -import { - useBlockProps, - InspectorControls, - FontSizePicker, -} from '@wordpress/block-editor'; +import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; import { useRef } from '@wordpress/element'; import { desktop, @@ -50,14 +46,10 @@ const ICON_OPTIONS = [ ]; const ICON_SIZE_OPTIONS = [ - { name: __( 'Small', 'scroll-indicator' ), slug: 'small', size: '18px' }, - { name: __( 'Medium', 'scroll-indicator' ), slug: 'medium', size: '24px' }, - { name: __( 'Large', 'scroll-indicator' ), slug: 'large', size: '32px' }, - { - name: __( 'Extra Large', 'scroll-indicator' ), - slug: 'extra-large', - size: '48px', - }, + { value: 'S', label: __( 'Small', 'scroll-indicator' ), text: 'S' }, + { value: 'M', label: __( 'Medium', 'scroll-indicator' ), text: 'M' }, + { value: 'L', label: __( 'Large', 'scroll-indicator' ), text: 'L' }, + { value: 'XL', label: __( 'Extra Large', 'scroll-indicator' ), text: 'XL' }, ]; const POSITION_MODE_OPTIONS = [ @@ -239,19 +231,45 @@ export default function Edit( { attributes, setAttributes, clientId } ) { { __( 'Icon Size', 'scroll-indicator' ) } - + { ICON_SIZE_OPTIONS.map( ( option ) => ( + + ) ) } + + + + setAttributes( { showText: value } ) + } + /> + { showText && ( + - setAttributes( { - iconSize: 'custom', - customSizeValue: value || '24px', - } ) + setAttributes( { customText: value } ) } - headingLevel={ 3 } - withSlider={ false } + placeholder={ __( + 'Scroll down', + 'scroll-indicator' + ) } /> - + ) } ) } - - - setAttributes( { showText: value } ) - } - /> - { showText && ( - - setAttributes( { customText: value } ) - } - placeholder={ __( - 'Scroll down', - 'scroll-indicator' - ) } - /> - ) } -
:first-child { - display: none; - } -} - .scroll-indicator-icon-buttons { display: flex; flex-wrap: wrap; @@ -94,11 +87,11 @@ .editor-styles-wrapper { - .wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-fixed) { - position: relative; - } + .wp-block-scroll-indicator-scroll-indicator.is-position-absolute { + cursor: grab; - .wp-block-cover .wp-block-scroll-indicator-scroll-indicator.is-position-fixed { - position: absolute; + &:active { + cursor: grabbing; + } } } diff --git a/src/style.scss b/src/style.scss index f2cd0a6..e8199d5 100644 --- a/src/style.scss +++ b/src/style.scss @@ -71,17 +71,17 @@ } .scroll-indicator { - display: flex; - flex-direction: column; align-items: center; - gap: 10px; - max-width: 100%; - padding: 20px; - border: 0; background: transparent; + border: 0; color: inherit; cursor: pointer; + display: inline-flex; + flex-direction: column; font: inherit; + gap: 10px; + max-width: 100%; + padding: 0; text-align: center; &:focus-visible { @@ -102,6 +102,10 @@ touch-action: none; } + &.is-position-absolute .scroll-indicator:active { + cursor: grabbing; + } + .scroll-text { font-size: 14px; color: currentcolor; From 49341c9d200c70cb249f52bf9c8ce90df9328e43 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Thu, 21 May 2026 09:26:20 -0500 Subject: [PATCH 10/12] Fix cover content layering --- .wp-playground/scroll-indicator.zip | Bin 12265 -> 12215 bytes compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- src/style.scss | 7 ------- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.wp-playground/scroll-indicator.zip b/.wp-playground/scroll-indicator.zip index 6bcffdf8e32fb59d350dd2bbf520d5e51944da5d..2b8d98d0d443c6b4e06de90ced1c72508b410a5c 100644 GIT binary patch delta 2026 zcmYMzc{~%09|!Q+97C2|k>v{I8s^M>lwlNmVkXROMshTiUq)JzvYu9Kq9@GJL5^H4 zA#zPIA|yS?W@_$=SRVaRzwe))@9XpV@6E+FVykE5fh8`KPxAI=?Kv~%k}XTDnAsT=e+7AB4jU)r zb1Q@*%Do-e8xx!i5@77zmXr)=g zlaWb%e&-HjsFCEre&8fAyK<$87vT#;cb*UDw+Q+*f647;e1<~>!M@j546bDn42_m$m`&#@fZKKnvX7069%D2wy4ENW`Q)7lAy$uh2hx;aYAa`hF#D8`a;@TIX(2_JEY7F z-hyd&Tl@IJ%~Fgxn+&uE&TS3)g!f)3%)X{=nu`!}sHN3-q!BtVRU8GQg0OZ&yfn7K zS;Riwqj*#hPeqItiK&@i?=$W8O`txWJhtF~=OVJ$j`Re~UX8S8vPMeD2I~4jXJ>C; z+t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mxjP~pV!4Jh1Z^L*;x3R!RlUoV z0-Uq_AeAP!;3F<}o;%_93g4N`)xvSEmbe4WI4@+Z`zGzpT9Pl=2E!uQP)d!pPs0*Q z-bd8jUv2TZ(#A~2oD61!k49Nd16yorw4)qLLOC<&XX*WoN$u_VbDFk8Tphx2uFG6D zg1umJ$maV_TaFxzuO05*Cy&6CZ;ZRudj;vNJ*uWdTiPcI)A`kosI2Hx$Hw)D9pTe6!zE{`#2PDn8V6Cm;Q9 z#0%@9cbbdzmnky$JJV(sceEz=j?j+PNa@(4a1zYzV<}#IwpL!2n=a;p&pz#{P_vZ+1J zKk5>WIcny`mznk^6&%TbyJ_TC>ESM#<)9P$GzS#FkXjM0>UXJjmtH7mf@jc|lU9{= z5Ji}Txw19Bb=&;Mjd z;===$!;j|(ZqCLxUB^-i11?*B#fLrZ5u!}Rj*J1D_K2A!NyG`PN?PfOouxLC71s7b zqFsc(o(u*02!M_er7{=eGqMMWs?2g4Mb3s0q?1O6EG5Xw=RaunOln$jRsI` zOG5ou$0FsV`gFSO#rOUGrHM*SRLgA?rFAv3nfrd_nt%CKEjU{GpMvpl`HFN^XFq4? z?zu^L7T#^FUczk*+bwz^W5F!qcW{A%K#;4=0>vR_&y%9Gx{}T*-C%t6){Q1WlU|Ae zM|2NEgl^bY>WptAXFnH;-#q.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index 4c926ed..8297712 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/src/style.scss b/src/style.scss index e8199d5..07ff968 100644 --- a/src/style.scss +++ b/src/style.scss @@ -119,13 +119,6 @@ position: relative; } -.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { - - > .wp-block-cover__inner-container { - position: static; - } -} - // Animations — only when user hasn't requested reduced motion @media (prefers-reduced-motion: no-preference) { From 63e4593dac932a591240ff3d61a1f1e428ae48e5 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Thu, 21 May 2026 11:24:46 -0500 Subject: [PATCH 11/12] Sync positioning controls with core alignment --- .wp-playground/scroll-indicator.zip | Bin 12215 -> 12553 bytes compiled/index.asset.php | 2 +- compiled/index.js | 2 +- compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- src/edit.js | 79 ++++++++++++++++++++++++++-- src/position.js | 26 +++++++++ src/save.js | 20 +++++-- src/style.scss | 12 +++++ 9 files changed, 133 insertions(+), 12 deletions(-) diff --git a/.wp-playground/scroll-indicator.zip b/.wp-playground/scroll-indicator.zip index 2b8d98d0d443c6b4e06de90ced1c72508b410a5c..b4e05f9c02aed8d3e884d41ea0dfe69502ca473a 100644 GIT binary patch delta 6429 zcmZvAWl$Vivn}oroM3|{*kC~eK?4MLcLsNtFu*DYpP)5gtVf1C7__7OroR}qS7^|VY{LILlPZN2tq^X zKPURL{<%b*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XKjhRt5C#isz zuyZ@W{# zcZ^KIsNk2eUY)VqQ1eNd26>L#Z#VZ9Af0Xz%=P2acwK3kNtjUCjA+UTn~UT&LI8B6 z`dK*1GCuIeUp)iv=#>hRyrOH6p$=jQ#tSfhyNa@#k|dScO+|rErUEON>rrg ze3zMxGw>wMA=hHPao=j7*hP!=??*=cRdy2S@ALcD@`JxHJtOfY7+7gy{Iz@<-_U)` z>(m#a`s^3=4NY5W&;!9YSzGh^lV)9vTBVg;SF4rBlh*n{0hpIiqFPV!+(LN;&C54V zgR3|2T-Hwr*+TvamrlQO>M_te>xi!pDO6FmHa3N52k+5mJPAsMX<_YMON((vP%CVJ0y*|)4(+i1=(^;gW-RXO?e|?o@+CbZ@q;w zbT3OWw^QXEvGJ`~luT>A0z&p;atA}5jJ!~i4H(SR*^=;;5h|94O`B4Hu@+e#vSVg0jl z>e(}J4-W?45;nfGwi+^uH0r-u-eUIOw+8qB5-(Hy5wn76d2#v9iT=OvKi-j$*#DOh zO7lm^iD96Rj)Zzn1Wx4TLdm25#|SGU9(a>i5JiUJpP?|HILZ array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '1b44d2428cdc22b0bb6b'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '2a079bfab507fd75781d'); diff --git a/compiled/index.js b/compiled/index.js index 3ed95e0..e020191 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var o,e={511(){const o=window.wp.blocks,e=window.wp.primitives,t=window.ReactJSXRuntime;var l=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const i=window.wp.i18n,n=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,v={S:"18px",M:"24px",L:"32px",XL:"48px"},p=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function w(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return p.test(o)?o:"24px"}return v[o]||"24px"}const m={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function b(o){return Object.prototype.hasOwnProperty.call(m,o)?o:"mouse"}function f({iconType:o}){const e=m[b(o)];return(0,t.jsx)(e,{})}const j={flow:"flow",fixed:"fixed",absolute:"absolute"},_={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},g={left:"left",center:"center",right:"right"};function k(o){return j[o]||j.flow}function B(o){return _[o]||_["bottom-center"]}function y(o){return g[o]||g.center}function M(o,e){const t="number"==typeof o?o:Number.parseFloat(o);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):e}function N(o,e,t="center"){const l=k(o);if("fixed"===l)return`is-position-fixed is-screen-position-${B(e)}`;if("absolute"===l)return"is-position-absolute";const i=y(t);return"center"!==i?`is-flow-align-${i}`:""}function S(o,e,t){return"absolute"!==k(o)?{}:{"--scroll-indicator-x":`${M(e,50)}%`,"--scroll-indicator-y":`${M(t,85)}%`}}const P=[{value:"mouse",label:(0,i.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,i.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,i.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,i.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,i.__)("Hand","scroll-indicator")}],V=[{value:"S",label:(0,i.__)("Small","scroll-indicator"),text:"S"},{value:"M",label:(0,i.__)("Medium","scroll-indicator"),text:"M"},{value:"L",label:(0,i.__)("Large","scroll-indicator"),text:"L"},{value:"XL",label:(0,i.__)("Extra Large","scroll-indicator"),text:"XL"}],T=[{value:"flow",label:(0,i.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,i.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,i.__)("Absolute","scroll-indicator")}],C=[{value:"left",label:(0,i.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,i.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,i.__)("Align right","scroll-indicator"),icon:a}],z=[{value:"bottom-left",label:(0,i.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,i.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,i.__)("Bottom right","scroll-indicator"),icon:a}],L=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(L.UU,{icon:l,edit:function({attributes:o,setAttributes:e,clientId:l}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",showText:v=!0,customText:p="Scroll down",positionMode:j="flow",screenPosition:_="bottom-center",absoluteX:g=50,absoluteY:L=85}=o,H=(0,r.useRef)(),{selectBlock:O}=(0,x.useDispatch)("core/block-editor"),G=b(s),A=w(c,a),X=k(j),Z=B(_),E=M(g,50),$=M(L,85),D=y(o.flowAlign);function F(o){const t=H.current,l=t?.closest(".wp-block-cover")||t?.parentElement;if(!l)return;const i=l.getBoundingClientRect();0!==i.width&&0!==i.height&&e({absoluteX:M((o.clientX-i.left)/i.width*100,50),absoluteY:M((o.clientY-i.top)/i.height*100,85)})}const R=(0,n.useBlockProps)({ref:H,className:N(X,Z,D),style:{"--scroll-indicator-size":A,...S(X,E,$)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,i.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:P.map(o=>{const l=m[o.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===o.value,onClick:()=>e({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${o.value}`,children:(0,t.jsx)(l,{})})},o.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Icon Size","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-size-buttons",children:V.map(o=>(0,t.jsx)(h.Button,{isPressed:c===o.value,label:o.label,showTooltip:!0,onClick:()=>e({iconSize:o.value}),children:o.text},o.value))})]}),(0,t.jsx)(h.ToggleControl,{label:(0,i.__)("Show text","scroll-indicator"),checked:v,onChange:o=>e({showText:o})}),v&&(0,t.jsx)(h.TextControl,{__next40pxDefaultSize:!0,label:(0,i.__)("Text","scroll-indicator"),value:p,onChange:o=>e({customText:o}),placeholder:(0,i.__)("Scroll down","scroll-indicator")})]}),(0,t.jsxs)(h.PanelBody,{title:(0,i.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:T.map(o=>(0,t.jsx)(h.Button,{isPressed:X===o.value,onClick:()=>e({positionMode:o.value}),children:o.label},o.value))})]}),"flow"===X&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:C.map(o=>{const l=o.icon;return(0,t.jsx)(h.Button,{icon:l,label:o.label,showTooltip:!0,isPressed:D===o.value,onClick:()=>e({flowAlign:o.value})},o.value)})})]}),"fixed"===X&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,i.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:z.map(o=>{const l=o.icon;return(0,t.jsx)(h.Button,{icon:l,label:o.label,showTooltip:!0,isPressed:Z===o.value,onClick:()=>e({screenPosition:o.value})},o.value)})})]}),"absolute"===X&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,i.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,i.__)("Horizontal","scroll-indicator"),value:E,min:0,max:100,onChange:o=>e({absoluteX:o})}),(0,t.jsx)(h.RangeControl,{label:(0,i.__)("Vertical","scroll-indicator"),value:$,min:0,max:100,onChange:o=>e({absoluteY:o})})]}),"fixed"===X&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,i.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]})]}),(0,t.jsx)("div",{...R,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${G}`,onPointerDown:function(o){if("absolute"!==X||0!==o.button)return;o.preventDefault(),o.stopPropagation(),O(l),F(o);const e=o.currentTarget.ownerDocument,t=o=>{F(o)},i=()=>{e.removeEventListener("pointermove",t),e.removeEventListener("pointerup",i)};e.addEventListener("pointermove",t),e.addEventListener("pointerup",i)},children:[(0,t.jsx)(f,{iconType:G}),v&&(0,t.jsx)("div",{className:"scroll-text",children:p||(0,i.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:i="24px",showText:r=!0,customText:s="Scroll down",positionMode:c="flow",screenPosition:a="bottom-center",absoluteX:d=50,absoluteY:u=85,flowAlign:h="center"}=o,x=b(e),v=w(l,i),p=s||"Scroll down",m=n.useBlockProps.save({className:N(c,a,h),style:{"--scroll-indicator-size":v,...S(c,d,u)}});return(0,t.jsx)("div",{...m,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${x}`,"aria-label":p,"data-hide-after-scrolling":"true",children:[(0,t.jsx)(f,{iconType:x}),r&&(0,t.jsx)("div",{className:"scroll-text",children:p})]})})}})}},t={};function l(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,l),n.exports}l.m=e,o=[],l.O=(e,t,i,n)=>{if(!t){var r=1/0;for(d=0;d=n)&&Object.keys(l.O).every(o=>l.O[o](t[c]))?t.splice(c--,1):(s=!1,n0&&o[d-1][2]>n;d--)o[d]=o[d-1];o[d]=[t,i,n]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,t)=>{var i,n,[r,s,c]=t,a=0;if(r.some(e=>0!==o[e])){for(i in s)l.o(s,i)&&(l.m[i]=s[i]);if(c)var d=c(l)}for(e&&e(t);al(511));i=l.O(i)})(); \ No newline at end of file +(()=>{"use strict";var e,o={511(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var l=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const n=window.wp.i18n,i=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,v={S:"18px",M:"24px",L:"32px",XL:"48px"},p=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function m(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return p.test(e)?e:"24px"}return v[e]||"24px"}const b={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function w(e){return Object.prototype.hasOwnProperty.call(b,e)?e:"mouse"}function f({iconType:e}){const o=b[w(e)];return(0,t.jsx)(o,{})}const g={flow:"flow",fixed:"fixed",absolute:"absolute"},j={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},_={left:"left",center:"center",right:"right"},k={left:"bottom-left",center:"bottom-center",right:"bottom-right"},M={"bottom-left":"left","bottom-center":"center","bottom-right":"right"};function y(e){return g[e]||g.flow}function B(e){return j[e]||j["bottom-center"]}function N(e){return _[e]||_.center}function C(e){return M[B(e)]||_.center}function S(e){return k[N(e)]||j["bottom-center"]}function V(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function P(e,o,t="center"){const l=y(e);if("fixed"===l)return`is-position-fixed is-screen-position-${B(o)}`;if("absolute"===l)return"is-position-absolute";const n=N(t);return"center"!==n?`is-flow-align-${n}`:""}function T(e,o,t){return"absolute"!==y(e)?{}:{"--scroll-indicator-x":`${V(o,50)}%`,"--scroll-indicator-y":`${V(t,85)}%`}}const z=[{value:"mouse",label:(0,n.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,n.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,n.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,n.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,n.__)("Hand","scroll-indicator")}],L=[{value:"S",label:(0,n.__)("Small","scroll-indicator"),text:"S"},{value:"M",label:(0,n.__)("Medium","scroll-indicator"),text:"M"},{value:"L",label:(0,n.__)("Large","scroll-indicator"),text:"L"},{value:"XL",label:(0,n.__)("Extra Large","scroll-indicator"),text:"XL"},{value:"custom",label:(0,n.__)("Custom","scroll-indicator"),text:(0,n.__)("Custom","scroll-indicator")}],H=[{value:"flow",label:(0,n.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,n.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,n.__)("Absolute","scroll-indicator")}],O=[{value:"left",label:(0,n.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,n.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,n.__)("Align right","scroll-indicator"),icon:a}],G=[{value:"bottom-left",label:(0,n.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,n.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,n.__)("Bottom right","scroll-indicator"),icon:a}],$=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)($.UU,{icon:l,edit:function({attributes:e,setAttributes:o,clientId:l}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",align:v,showText:p=!0,customText:g="Scroll down",positionMode:j="flow",screenPosition:_="bottom-center",absoluteX:k=50,absoluteY:M=85,flowAlign:$="center"}=e,A=(0,r.useRef)(),{selectBlock:X}=(0,x.useDispatch)("core/block-editor"),Z=w(s),E=m(c,a),F=y(j),D=["left","center","right"].includes(v),R=D?S(v):B(_),Y=V(k,50),I=V(M,85),U=N(D?v:$),W=function(e){const o="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(o)?Math.min(96,Math.max(12,o)):24}(a);function J(e){const t=A.current,l=t?.closest(".wp-block-cover")||t?.parentElement;if(!l)return;const n=l.getBoundingClientRect();0!==n.width&&0!==n.height&&o({absoluteX:V((e.clientX-n.left)/n.width*100,50),absoluteY:V((e.clientY-n.top)/n.height*100,85)})}const q=(0,i.useBlockProps)({ref:A,className:P(F,R,U),style:{"--scroll-indicator-size":E,...T(F,Y,I)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(i.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,n.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:z.map(e=>{const l=b[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(l,{})})},e.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Icon Size","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-size-buttons",children:L.map(e=>(0,t.jsx)(h.Button,{isPressed:c===e.value,label:e.label,showTooltip:!0,onClick:()=>function(e){const t={iconSize:e};"custom"===e&&(t.customSizeValue=`${W}px`),o(t)}(e.value),children:e.text},e.value))}),"custom"===c&&(0,t.jsx)(h.RangeControl,{label:(0,n.__)("Custom size","scroll-indicator"),value:W,min:12,max:96,step:1,renderTooltipContent:e=>`${e}px`,onChange:e=>o({customSizeValue:`${e||24}px`})})]}),(0,t.jsx)(h.ToggleControl,{label:(0,n.__)("Show text","scroll-indicator"),checked:p,onChange:e=>o({showText:e})}),p&&(0,t.jsx)(h.TextControl,{__next40pxDefaultSize:!0,label:(0,n.__)("Text","scroll-indicator"),value:g,onChange:e=>o({customText:e}),placeholder:(0,n.__)("Scroll down","scroll-indicator")})]}),(0,t.jsxs)(h.PanelBody,{title:(0,n.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:H.map(e=>(0,t.jsx)(h.Button,{isPressed:F===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===F&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:O.map(e=>{const l=e.icon;return(0,t.jsx)(h.Button,{icon:l,label:e.label,showTooltip:!0,isPressed:U===e.value,onClick:()=>o({flowAlign:e.value,align:e.value})},e.value)})})]}),"fixed"===F&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:G.map(e=>{const l=e.icon;return(0,t.jsx)(h.Button,{icon:l,label:e.label,showTooltip:!0,isPressed:R===e.value,onClick:()=>o({screenPosition:e.value,align:C(e.value)})},e.value)})})]}),"absolute"===F&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,n.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,n.__)("Horizontal","scroll-indicator"),value:Y,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,n.__)("Vertical","scroll-indicator"),value:I,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===F&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,n.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]})]}),(0,t.jsx)("div",{...q,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${Z}`,onPointerDown:function(e){if("absolute"!==F||0!==e.button)return;e.preventDefault(),e.stopPropagation(),X(l),J(e);const o=e.currentTarget.ownerDocument,t=e=>{J(e)},n=()=>{o.removeEventListener("pointermove",t),o.removeEventListener("pointerup",n)};o.addEventListener("pointermove",t),o.addEventListener("pointerup",n)},children:[(0,t.jsx)(f,{iconType:Z}),p&&(0,t.jsx)("div",{className:"scroll-text",children:g||(0,n.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:l="M",customSizeValue:n="24px",align:r,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85,flowAlign:x="center"}=e,v=w(o),p=m(l,n),b=c||"Scroll down",g=["left","center","right"].includes(r),j=g?S(r):B(d),_=N(g?r:x),k=i.useBlockProps.save({className:P(a,j,_),style:{"--scroll-indicator-size":p,...T(a,u,h)}});return(0,t.jsx)("div",{...k,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${v}`,"aria-label":b,"data-hide-after-scrolling":"true",children:[(0,t.jsx)(f,{iconType:v}),s&&(0,t.jsx)("div",{className:"scroll-text",children:b})]})})}})}},t={};function l(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,l),i.exports}l.m=o,e=[],l.O=(o,t,n,i)=>{if(!t){var r=1/0;for(d=0;d=i)&&Object.keys(l.O).every(e=>l.O[e](t[c]))?t.splice(c--,1):(s=!1,i0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[t,n,i]},l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};l.O.j=o=>0===e[o];var o=(o,t)=>{var n,i,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(n in s)l.o(s,n)&&(l.m[n]=s[n]);if(c)var d=c(l)}for(o&&o(t);al(511));n=l.O(n)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css index 7a55763..52e68d4 100644 --- a/compiled/style-index-rtl.css +++ b/compiled/style-index-rtl.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index 8297712..83788be 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/src/edit.js b/src/edit.js index cc53d7e..ee25d9a 100644 --- a/src/edit.js +++ b/src/edit.js @@ -32,6 +32,8 @@ import { getAbsoluteCoordinate, getFlowAlignment, getScreenPosition, + getAlignmentFromScreenPosition, + getScreenPositionFromAlignment, } from './position'; const ICON_OPTIONS = [ @@ -50,8 +52,17 @@ const ICON_SIZE_OPTIONS = [ { value: 'M', label: __( 'Medium', 'scroll-indicator' ), text: 'M' }, { value: 'L', label: __( 'Large', 'scroll-indicator' ), text: 'L' }, { value: 'XL', label: __( 'Extra Large', 'scroll-indicator' ), text: 'XL' }, + { + value: 'custom', + label: __( 'Custom', 'scroll-indicator' ), + text: __( 'Custom', 'scroll-indicator' ), + }, ]; +const CUSTOM_SIZE_MIN = 12; +const CUSTOM_SIZE_MAX = 96; +const CUSTOM_SIZE_DEFAULT = 24; + const POSITION_MODE_OPTIONS = [ { value: 'flow', label: __( 'Flow', 'scroll-indicator' ) }, { value: 'fixed', label: __( 'Fixed', 'scroll-indicator' ) }, @@ -99,12 +110,14 @@ export default function Edit( { attributes, setAttributes, clientId } ) { iconType = 'mouse', iconSize = 'M', customSizeValue = '24px', + align, showText = true, customText = 'Scroll down', positionMode = 'flow', screenPosition = 'bottom-center', absoluteX = 50, absoluteY = 85, + flowAlign = 'center', } = attributes; const blockRef = useRef(); @@ -112,10 +125,42 @@ export default function Edit( { attributes, setAttributes, clientId } ) { const normalizedIconType = getIconType( iconType ); const sizeValue = getSizeValue( iconSize, customSizeValue ); const normalizedPositionMode = getPositionMode( positionMode ); - const normalizedScreenPosition = getScreenPosition( screenPosition ); + const hasCoreAlignment = [ 'left', 'center', 'right' ].includes( align ); + const normalizedScreenPosition = hasCoreAlignment + ? getScreenPositionFromAlignment( align ) + : getScreenPosition( screenPosition ); const normalizedAbsoluteX = getAbsoluteCoordinate( absoluteX, 50 ); const normalizedAbsoluteY = getAbsoluteCoordinate( absoluteY, 85 ); - const normalizedFlowAlign = getFlowAlignment( attributes.flowAlign ); + const normalizedFlowAlign = getFlowAlignment( + hasCoreAlignment ? align : flowAlign + ); + const customSizeNumber = getCustomSizeNumber( customSizeValue ); + + function getCustomSizeNumber( value ) { + const numericValue = + typeof value === 'number' ? value : Number.parseFloat( value ); + + if ( ! Number.isFinite( numericValue ) ) { + return CUSTOM_SIZE_DEFAULT; + } + + return Math.min( + CUSTOM_SIZE_MAX, + Math.max( CUSTOM_SIZE_MIN, numericValue ) + ); + } + + function setIconSize( nextIconSize ) { + const nextAttributes = { + iconSize: nextIconSize, + }; + + if ( nextIconSize === 'custom' ) { + nextAttributes.customSizeValue = `${ customSizeNumber }px`; + } + + setAttributes( nextAttributes ); + } function updateAbsolutePosition( event ) { const wrapper = blockRef.current; @@ -239,15 +284,35 @@ export default function Edit( { attributes, setAttributes, clientId } ) { label={ option.label } showTooltip onClick={ () => - setAttributes( { - iconSize: option.value, - } ) + setIconSize( option.value ) } > { option.text } ) ) } + { iconSize === 'custom' && ( + + `${ value }px` + } + onChange={ ( value ) => + setAttributes( { + customSizeValue: `${ + value || CUSTOM_SIZE_DEFAULT + }px`, + } ) + } + /> + ) } setAttributes( { flowAlign: option.value, + align: option.value, } ) } /> @@ -350,6 +416,9 @@ export default function Edit( { attributes, setAttributes, clientId } ) { setAttributes( { screenPosition: option.value, + align: getAlignmentFromScreenPosition( + option.value + ), } ) } /> diff --git a/src/position.js b/src/position.js index 711e28a..e55a816 100644 --- a/src/position.js +++ b/src/position.js @@ -16,6 +16,18 @@ const FLOW_ALIGNMENT_MAP = { right: 'right', }; +const ALIGNMENT_TO_SCREEN_POSITION = { + left: 'bottom-left', + center: 'bottom-center', + right: 'bottom-right', +}; + +const SCREEN_POSITION_TO_ALIGNMENT = { + 'bottom-left': 'left', + 'bottom-center': 'center', + 'bottom-right': 'right', +}; + export function getPositionMode( positionMode ) { return POSITION_MODE_MAP[ positionMode ] || POSITION_MODE_MAP.flow; } @@ -31,6 +43,20 @@ export function getFlowAlignment( flowAlign ) { return FLOW_ALIGNMENT_MAP[ flowAlign ] || FLOW_ALIGNMENT_MAP.center; } +export function getAlignmentFromScreenPosition( screenPosition ) { + return ( + SCREEN_POSITION_TO_ALIGNMENT[ getScreenPosition( screenPosition ) ] || + FLOW_ALIGNMENT_MAP.center + ); +} + +export function getScreenPositionFromAlignment( alignment ) { + return ( + ALIGNMENT_TO_SCREEN_POSITION[ getFlowAlignment( alignment ) ] || + SCREEN_POSITION_MAP[ 'bottom-center' ] + ); +} + export function getAbsoluteCoordinate( coordinate, fallback ) { const numericCoordinate = typeof coordinate === 'number' diff --git a/src/save.js b/src/save.js index 48cc49a..da8992b 100644 --- a/src/save.js +++ b/src/save.js @@ -1,12 +1,19 @@ import { useBlockProps } from '@wordpress/block-editor'; import { IconRenderer, getIconType, getSizeValue } from './icons'; -import { getPositionClassNames, getPositionStyle } from './position'; +import { + getPositionClassNames, + getPositionStyle, + getFlowAlignment, + getScreenPosition, + getScreenPositionFromAlignment, +} from './position'; export default function save( { attributes } ) { const { iconType = 'mouse', iconSize = 'M', customSizeValue = '24px', + align, showText = true, customText = 'Scroll down', positionMode = 'flow', @@ -19,12 +26,19 @@ export default function save( { attributes } ) { const normalizedIconType = getIconType( iconType ); const sizeValue = getSizeValue( iconSize, customSizeValue ); const label = customText || 'Scroll down'; + const hasCoreAlignment = [ 'left', 'center', 'right' ].includes( align ); + const normalizedScreenPosition = hasCoreAlignment + ? getScreenPositionFromAlignment( align ) + : getScreenPosition( screenPosition ); + const normalizedFlowAlign = getFlowAlignment( + hasCoreAlignment ? align : flowAlign + ); const blockProps = useBlockProps.save( { className: getPositionClassNames( positionMode, - screenPosition, - flowAlign + normalizedScreenPosition, + normalizedFlowAlign ), style: { '--scroll-indicator-size': sizeValue, diff --git a/src/style.scss b/src/style.scss index 07ff968..20078e2 100644 --- a/src/style.scss +++ b/src/style.scss @@ -119,6 +119,18 @@ position: relative; } +.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { + + > .wp-block-cover__inner-container { + position: static; + + > :not(.wp-block-scroll-indicator-scroll-indicator) { + position: relative; + z-index: 1; + } + } +} + // Animations — only when user hasn't requested reduced motion @media (prefers-reduced-motion: no-preference) { From 3a75436b735993295b52639b58e277086c2f8e39 Mon Sep 17 00:00:00 2001 From: Derek Hanson Date: Thu, 21 May 2026 12:18:32 -0500 Subject: [PATCH 12/12] Refine toolbar and flow alignment --- .wp-playground/scroll-indicator.zip | Bin 12553 -> 13392 bytes compiled/block.json | 8 ++--- compiled/index.asset.php | 2 +- compiled/index.js | 2 +- compiled/style-index-rtl.css | 2 +- compiled/style-index.css | 2 +- src/block.json | 4 ++- src/edit.js | 52 ++++++++++++++++++++++++++-- src/position.js | 6 ++++ src/save.js | 5 ++- src/style.scss | 30 ++++++++++++++-- 11 files changed, 97 insertions(+), 16 deletions(-) diff --git a/.wp-playground/scroll-indicator.zip b/.wp-playground/scroll-indicator.zip index b4e05f9c02aed8d3e884d41ea0dfe69502ca473a..27fbdbe3960726b4192ebb6887d73334c9713e0d 100644 GIT binary patch delta 7909 zcmZXZ1yI~iknhpO-Q5YcupvNj4YIf`!Gi{O50D=uxWnS^F2UU$f(4g^;0{3p1iAeG zckjKsds8)2HB8_gkR8M!f*|hbS3PhwiV|W#!5a6^5!45gQBl%QozGXp&8nWiP zme&(NJm{IoGNi*4`AK1ZG~(g6R5E-re34;EgJ(39F8@lHDF0TnJWz*}Q-kkowoat1 zPU*2TMb(?_1BU;Ba2m~$VMs9;ztM76)muQ*=oe!kj|m;p!C-Sl+o603v^`8%wRx!ACN%Sl}c4SnS9 zCYT5b0l}!A03{CTpVx9u!v&uL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=%>SgtC7V zYko3CaxpI7`+BY!)r%kt)3P-i z(3j)Wwti-7mQkL!PyecG8tOlFs_T%mXA7iAxQ_YI1O=XREP(4|jTY|9vZDK$t@08o zm>*zTGl0d9=@ASKx};QTh0YA#UvTgR00`z(M7#W)*wG{6SA69)|!+$yH~!LTxD;;YXEE zUi2K7W9aXe7Dc!;;AC7zHiry+XWj=qDlxPDO`C5|7C;`b1^^goVC98GKOiz$N+=a2tw*WFFt`X}d6QGOz&Y6DwR1Gll7vXp z`K7If&fzyT!J7x1<~=qHNsaqS&lh^KNyVyRtA@JYX(&wzGR}W%DK#9t4u@0sBpNC7 z_Qs#lHE|xnr*zP3<<}1_t=DgS3(hU`tl#|MwdCx>zK(XHXhVyo%MZKh1wBu77M1Ha zrrnuj6W}n*&|%5&r;YR#TFKI7^If`uQZx|aH?eETvl@4wMnbScE)5zN^3W9sSEebp zQ9aCiB+O12Lvy$4rNTPml*KwOVa@kS#e{_LdlqgE$Be`7HjailDtYBUyiWUv*RSV0 zWq*={JhIq`U79PH4o*W8X|JBi40s*g)lk6a-WWo>pY^nP4lwIW327s_vJosP_83si z@nRNHD4#KM7n-Cld z#NYr=BN!a^*4_Zu~;2>g2Oregy78)QX90blWL2g+|h z<14dW5#c0#>Fnir++V=3>7?n;&8decIR}&9X)1i#7`R??&of~FNcdcPz*kH&R!kHB zlh|=)*89zWh^RlS8`sF7)%d@E3{p+GC6JOhQ}ek2NW>_q?%Y%mUewexZfd%} zYX3afBOoA5{i&=7n19-TmD12mw14UT{a(QP>%f=?fCNJSufb0|FaL4yzf%Q array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '2a079bfab507fd75781d'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '3e0f1d3a7adc1dd50ccc'); diff --git a/compiled/index.js b/compiled/index.js index e020191..3d3a92e 100644 --- a/compiled/index.js +++ b/compiled/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,o={511(){const e=window.wp.blocks,o=window.wp.primitives,t=window.ReactJSXRuntime;var l=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const n=window.wp.i18n,i=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),u=(0,t.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(o.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const h=window.wp.components,x=window.wp.data,v={S:"18px",M:"24px",L:"32px",XL:"48px"},p=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function m(e,o){if("custom"===e){const e="string"==typeof o?o.trim():"";return p.test(e)?e:"24px"}return v[e]||"24px"}const b={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function w(e){return Object.prototype.hasOwnProperty.call(b,e)?e:"mouse"}function f({iconType:e}){const o=b[w(e)];return(0,t.jsx)(o,{})}const g={flow:"flow",fixed:"fixed",absolute:"absolute"},j={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},_={left:"left",center:"center",right:"right"},k={left:"bottom-left",center:"bottom-center",right:"bottom-right"},M={"bottom-left":"left","bottom-center":"center","bottom-right":"right"};function y(e){return g[e]||g.flow}function B(e){return j[e]||j["bottom-center"]}function N(e){return _[e]||_.center}function C(e){return M[B(e)]||_.center}function S(e){return k[N(e)]||j["bottom-center"]}function V(e,o){const t="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):o}function P(e,o,t="center"){const l=y(e);if("fixed"===l)return`is-position-fixed is-screen-position-${B(o)}`;if("absolute"===l)return"is-position-absolute";const n=N(t);return"center"!==n?`is-flow-align-${n}`:""}function T(e,o,t){return"absolute"!==y(e)?{}:{"--scroll-indicator-x":`${V(o,50)}%`,"--scroll-indicator-y":`${V(t,85)}%`}}const z=[{value:"mouse",label:(0,n.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,n.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,n.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,n.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,n.__)("Hand","scroll-indicator")}],L=[{value:"S",label:(0,n.__)("Small","scroll-indicator"),text:"S"},{value:"M",label:(0,n.__)("Medium","scroll-indicator"),text:"M"},{value:"L",label:(0,n.__)("Large","scroll-indicator"),text:"L"},{value:"XL",label:(0,n.__)("Extra Large","scroll-indicator"),text:"XL"},{value:"custom",label:(0,n.__)("Custom","scroll-indicator"),text:(0,n.__)("Custom","scroll-indicator")}],H=[{value:"flow",label:(0,n.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,n.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,n.__)("Absolute","scroll-indicator")}],O=[{value:"left",label:(0,n.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,n.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,n.__)("Align right","scroll-indicator"),icon:a}],G=[{value:"bottom-left",label:(0,n.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,n.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,n.__)("Bottom right","scroll-indicator"),icon:a}],$=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,e.registerBlockType)($.UU,{icon:l,edit:function({attributes:e,setAttributes:o,clientId:l}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",align:v,showText:p=!0,customText:g="Scroll down",positionMode:j="flow",screenPosition:_="bottom-center",absoluteX:k=50,absoluteY:M=85,flowAlign:$="center"}=e,A=(0,r.useRef)(),{selectBlock:X}=(0,x.useDispatch)("core/block-editor"),Z=w(s),E=m(c,a),F=y(j),D=["left","center","right"].includes(v),R=D?S(v):B(_),Y=V(k,50),I=V(M,85),U=N(D?v:$),W=function(e){const o="number"==typeof e?e:Number.parseFloat(e);return Number.isFinite(o)?Math.min(96,Math.max(12,o)):24}(a);function J(e){const t=A.current,l=t?.closest(".wp-block-cover")||t?.parentElement;if(!l)return;const n=l.getBoundingClientRect();0!==n.width&&0!==n.height&&o({absoluteX:V((e.clientX-n.left)/n.width*100,50),absoluteY:V((e.clientY-n.top)/n.height*100,85)})}const q=(0,i.useBlockProps)({ref:A,className:P(F,R,U),style:{"--scroll-indicator-size":E,...T(F,Y,I)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(i.InspectorControls,{children:[(0,t.jsxs)(h.PanelBody,{title:(0,n.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:z.map(e=>{const l=b[e.value];return(0,t.jsx)(h.Button,{className:"scroll-indicator-icon-button",isPressed:s===e.value,onClick:()=>o({iconType:e.value}),label:e.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${e.value}`,children:(0,t.jsx)(l,{})})},e.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Icon Size","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-size-buttons",children:L.map(e=>(0,t.jsx)(h.Button,{isPressed:c===e.value,label:e.label,showTooltip:!0,onClick:()=>function(e){const t={iconSize:e};"custom"===e&&(t.customSizeValue=`${W}px`),o(t)}(e.value),children:e.text},e.value))}),"custom"===c&&(0,t.jsx)(h.RangeControl,{label:(0,n.__)("Custom size","scroll-indicator"),value:W,min:12,max:96,step:1,renderTooltipContent:e=>`${e}px`,onChange:e=>o({customSizeValue:`${e||24}px`})})]}),(0,t.jsx)(h.ToggleControl,{label:(0,n.__)("Show text","scroll-indicator"),checked:p,onChange:e=>o({showText:e})}),p&&(0,t.jsx)(h.TextControl,{__next40pxDefaultSize:!0,label:(0,n.__)("Text","scroll-indicator"),value:g,onChange:e=>o({customText:e}),placeholder:(0,n.__)("Scroll down","scroll-indicator")})]}),(0,t.jsxs)(h.PanelBody,{title:(0,n.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:H.map(e=>(0,t.jsx)(h.Button,{isPressed:F===e.value,onClick:()=>o({positionMode:e.value}),children:e.label},e.value))})]}),"flow"===F&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Alignment","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:O.map(e=>{const l=e.icon;return(0,t.jsx)(h.Button,{icon:l,label:e.label,showTooltip:!0,isPressed:U===e.value,onClick:()=>o({flowAlign:e.value,align:e.value})},e.value)})})]}),"fixed"===F&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(h.ButtonGroup,{className:"scroll-indicator-position-buttons",children:G.map(e=>{const l=e.icon;return(0,t.jsx)(h.Button,{icon:l,label:e.label,showTooltip:!0,isPressed:R===e.value,onClick:()=>o({screenPosition:e.value,align:C(e.value)})},e.value)})})]}),"absolute"===F&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:d}),(0,n.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(h.RangeControl,{label:(0,n.__)("Horizontal","scroll-indicator"),value:Y,min:0,max:100,onChange:e=>o({absoluteX:e})}),(0,t.jsx)(h.RangeControl,{label:(0,n.__)("Vertical","scroll-indicator"),value:I,min:0,max:100,onChange:e=>o({absoluteY:e})})]}),"fixed"===F&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,n.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]})]}),(0,t.jsx)("div",{...q,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${Z}`,onPointerDown:function(e){if("absolute"!==F||0!==e.button)return;e.preventDefault(),e.stopPropagation(),X(l),J(e);const o=e.currentTarget.ownerDocument,t=e=>{J(e)},n=()=>{o.removeEventListener("pointermove",t),o.removeEventListener("pointerup",n)};o.addEventListener("pointermove",t),o.addEventListener("pointerup",n)},children:[(0,t.jsx)(f,{iconType:Z}),p&&(0,t.jsx)("div",{className:"scroll-text",children:g||(0,n.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:e}){const{iconType:o="mouse",iconSize:l="M",customSizeValue:n="24px",align:r,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85,flowAlign:x="center"}=e,v=w(o),p=m(l,n),b=c||"Scroll down",g=["left","center","right"].includes(r),j=g?S(r):B(d),_=N(g?r:x),k=i.useBlockProps.save({className:P(a,j,_),style:{"--scroll-indicator-size":p,...T(a,u,h)}});return(0,t.jsx)("div",{...k,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${v}`,"aria-label":b,"data-hide-after-scrolling":"true",children:[(0,t.jsx)(f,{iconType:v}),s&&(0,t.jsx)("div",{className:"scroll-text",children:b})]})})}})}},t={};function l(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,l),i.exports}l.m=o,e=[],l.O=(o,t,n,i)=>{if(!t){var r=1/0;for(d=0;d=i)&&Object.keys(l.O).every(e=>l.O[e](t[c]))?t.splice(c--,1):(s=!1,i0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[t,n,i]},l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};l.O.j=o=>0===e[o];var o=(o,t)=>{var n,i,[r,s,c]=t,a=0;if(r.some(o=>0!==e[o])){for(n in s)l.o(s,n)&&(l.m[n]=s[n]);if(c)var d=c(l)}for(o&&o(t);al(511));n=l.O(n)})(); \ No newline at end of file +(()=>{"use strict";var o,e={83(){const o=window.wp.blocks,e=window.wp.primitives,t=window.ReactJSXRuntime;var l=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const n=window.wp.i18n,i=window.wp.blockEditor,r=window.wp.element;var s=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),c=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),a=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),d=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"})}),u=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"})}),h=(0,t.jsx)(e.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,t.jsx)(e.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})});const x=window.wp.components,v=window.wp.data,p={S:"18px",M:"24px",L:"32px",XL:"48px"},m=/^(?:\d+|\d*\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|%)$/;function b(o,e){if("custom"===o){const o="string"==typeof e?e.trim():"";return m.test(o)?o:"24px"}return p[o]||"24px"}const w={mouse:function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 38",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"1",y:"1",width:"22",height:"36",rx:"11",ry:"11"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16",strokeLinecap:"round",className:"scroll-wheel"})]})},"arrow-down":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M7 13l5 5 5-5"}),(0,t.jsx)("path",{d:"M7 7l5 5 5-5",opacity:"0.4"})]})},"chevron-bounce":function(){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M6 9l6 6 6-6"})})},"scroll-dots":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 36",fill:"currentColor","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("circle",{cx:"12",cy:"6",r:"3",className:"dot dot-1"}),(0,t.jsx)("circle",{cx:"12",cy:"18",r:"3",className:"dot dot-2"}),(0,t.jsx)("circle",{cx:"12",cy:"30",r:"3",className:"dot dot-3"})]})},"hand-point":function(){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("path",{d:"M9 11V6a2 2 0 0 1 4 0v5"}),(0,t.jsx)("path",{d:"M13 11V8a2 2 0 0 1 4 0v5l1 3a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4v-2a2 2 0 0 1 2-2h1"})]})}};function f(o){return Object.prototype.hasOwnProperty.call(w,o)?o:"mouse"}function g({iconType:o}){const e=w[f(o)];return(0,t.jsx)(e,{})}const j={flow:"flow",fixed:"fixed",absolute:"absolute"},_={"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right"},k={left:"left",center:"center",right:"right"},B={left:"bottom-left",center:"bottom-center",right:"bottom-right"},M={"bottom-left":"left","bottom-center":"center","bottom-right":"right"};function C(o){return j[o]||j.flow}function y(o){return _[o]||_["bottom-center"]}function N(o){return k[o]||k.center}function S(o){return M[y(o)]||k.center}function V(o){return B[N(o)]||_["bottom-center"]}function T(o){const e=k[o];return e?`align${e}`:""}function P(o,e){const t="number"==typeof o?o:Number.parseFloat(o);return Number.isFinite(t)?Math.min(100,Math.max(0,t)):e}function z(o,e,t="center"){const l=C(o);if("fixed"===l)return`is-position-fixed is-screen-position-${y(e)}`;if("absolute"===l)return"is-position-absolute";const n=N(t);return"center"!==n?`is-flow-align-${n}`:""}function L(o,e,t){return"absolute"!==C(o)?{}:{"--scroll-indicator-x":`${P(e,50)}%`,"--scroll-indicator-y":`${P(t,85)}%`}}const H=[{value:"mouse",label:(0,n.__)("Mouse","scroll-indicator")},{value:"arrow-down",label:(0,n.__)("Arrow","scroll-indicator")},{value:"chevron-bounce",label:(0,n.__)("Chevron","scroll-indicator")},{value:"scroll-dots",label:(0,n.__)("Dots","scroll-indicator")},{value:"hand-point",label:(0,n.__)("Hand","scroll-indicator")}],O=[{value:"S",label:(0,n.__)("Small","scroll-indicator"),text:"S"},{value:"M",label:(0,n.__)("Medium","scroll-indicator"),text:"M"},{value:"L",label:(0,n.__)("Large","scroll-indicator"),text:"L"},{value:"XL",label:(0,n.__)("Extra Large","scroll-indicator"),text:"XL"},{value:"custom",label:(0,n.__)("Custom","scroll-indicator"),text:(0,n.__)("Custom","scroll-indicator")}],G=[{value:"flow",label:(0,n.__)("Flow","scroll-indicator")},{value:"fixed",label:(0,n.__)("Fixed","scroll-indicator")},{value:"absolute",label:(0,n.__)("Absolute","scroll-indicator")}],A=[{value:"left",label:(0,n.__)("Align left","scroll-indicator"),icon:s},{value:"center",label:(0,n.__)("Align center","scroll-indicator"),icon:c},{value:"right",label:(0,n.__)("Align right","scroll-indicator"),icon:a}],$=[{value:"bottom-left",label:(0,n.__)("Bottom left","scroll-indicator"),icon:s},{value:"bottom-center",label:(0,n.__)("Bottom center","scroll-indicator"),icon:c},{value:"bottom-right",label:(0,n.__)("Bottom right","scroll-indicator"),icon:a}],X=JSON.parse('{"UU":"scroll-indicator/scroll-indicator"}');(0,o.registerBlockType)(X.UU,{icon:l,edit:function({attributes:o,setAttributes:e,clientId:l}){const{iconType:s="mouse",iconSize:c="M",customSizeValue:a="24px",align:p,showText:m=!0,customText:j="Scroll down",positionMode:_="flow",screenPosition:k="bottom-center",absoluteX:B=50,absoluteY:M=85,flowAlign:X="center"}=o,Z=(0,r.useRef)(),{selectBlock:D}=(0,v.useDispatch)("core/block-editor"),E=f(s),F=b(c,a),R=C(_),Y=["left","center","right"].includes(p),I=Y?V(p):y(k),U=P(B,50),W=P(M,85),J=N(Y?p:X),q=Y?p:J,K=function(o){const e="number"==typeof o?o:Number.parseFloat(o);return Number.isFinite(e)?Math.min(96,Math.max(12,e)):24}(a);function Q(o){const t=Z.current,l=t?.closest(".wp-block-cover")||t?.parentElement;if(!l)return;const n=l.getBoundingClientRect();0!==n.width&&0!==n.height&&e({absoluteX:P((o.clientX-n.left)/n.width*100,50),absoluteY:P((o.clientY-n.top)/n.height*100,85)})}const oo=(0,i.useBlockProps)({ref:Z,className:z(R,I,J).concat(" ",T(p)).trim(),style:{"--scroll-indicator-size":F,...L(R,U,W)}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.BlockControls,{group:"block",children:"absolute"===R?(0,t.jsx)(x.ToolbarGroup,{children:(0,t.jsx)(x.ToolbarButton,{icon:d,label:(0,n.__)("Drag on canvas to position","scroll-indicator"),onClick:()=>D(l)})}):(0,t.jsx)(i.AlignmentToolbar,{value:q,onChange:function(o){const t=N(o||"center");e("fixed"!==R?{align:t,flowAlign:t}:{align:t,screenPosition:V(t)})}})}),(0,t.jsxs)(i.InspectorControls,{children:[(0,t.jsxs)(x.PanelBody,{title:(0,n.__)("Settings","scroll-indicator"),initialOpen:!0,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-icon-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Icon Type","scroll-indicator")}),(0,t.jsx)(x.ButtonGroup,{className:"scroll-indicator-icon-buttons",children:H.map(o=>{const l=w[o.value];return(0,t.jsx)(x.Button,{className:"scroll-indicator-icon-button",isPressed:s===o.value,onClick:()=>e({iconType:o.value}),label:o.label,showTooltip:!0,children:(0,t.jsx)("span",{className:`scroll-indicator-icon-preview icon-${o.value}`,children:(0,t.jsx)(l,{})})},o.value)})})]}),(0,t.jsxs)("fieldset",{className:"scroll-indicator-size-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Icon Size","scroll-indicator")}),(0,t.jsx)(x.ButtonGroup,{className:"scroll-indicator-size-buttons",children:O.map(o=>(0,t.jsx)(x.Button,{isPressed:c===o.value,label:o.label,showTooltip:!0,onClick:()=>function(o){const t={iconSize:o};"custom"===o&&(t.customSizeValue=`${K}px`),e(t)}(o.value),children:o.text},o.value))}),"custom"===c&&(0,t.jsx)(x.RangeControl,{label:(0,n.__)("Custom size","scroll-indicator"),value:K,min:12,max:96,step:1,renderTooltipContent:o=>`${o}px`,onChange:o=>e({customSizeValue:`${o||24}px`})})]}),(0,t.jsx)(x.ToggleControl,{label:(0,n.__)("Show text","scroll-indicator"),checked:m,onChange:o=>e({showText:o})}),m&&(0,t.jsx)(x.TextControl,{__next40pxDefaultSize:!0,label:(0,n.__)("Text","scroll-indicator"),value:j,onChange:o=>e({customText:o}),placeholder:(0,n.__)("Scroll down","scroll-indicator")})]}),(0,t.jsxs)(x.PanelBody,{title:(0,n.__)("Position","scroll-indicator"),initialOpen:!1,children:[(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Position Mode","scroll-indicator")}),(0,t.jsx)(x.ButtonGroup,{className:"scroll-indicator-mode-buttons",children:G.map(o=>(0,t.jsx)(x.Button,{isPressed:R===o.value,onClick:()=>e({positionMode:o.value}),children:o.label},o.value))})]}),"flow"===R&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Alignment","scroll-indicator")}),(0,t.jsx)(x.ButtonGroup,{className:"scroll-indicator-position-buttons",children:A.map(o=>{const l=o.icon;return(0,t.jsx)(x.Button,{icon:l,label:o.label,showTooltip:!0,isPressed:J===o.value,onClick:()=>e({flowAlign:o.value,align:o.value})},o.value)})})]}),"fixed"===R&&(0,t.jsxs)("fieldset",{className:"scroll-indicator-position-picker",children:[(0,t.jsx)("legend",{children:(0,n.__)("Screen Position","scroll-indicator")}),(0,t.jsx)(x.ButtonGroup,{className:"scroll-indicator-position-buttons",children:$.map(o=>{const l=o.icon;return(0,t.jsx)(x.Button,{icon:l,label:o.label,showTooltip:!0,isPressed:I===o.value,onClick:()=>e({screenPosition:o.value,align:S(o.value)})},o.value)})})]}),"absolute"===R&&(0,t.jsxs)("div",{className:"scroll-indicator-absolute-controls",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:u}),(0,n.__)("Drag the indicator on the canvas, or fine-tune its position below.","scroll-indicator")]}),(0,t.jsx)(x.RangeControl,{label:(0,n.__)("Horizontal","scroll-indicator"),value:U,min:0,max:100,onChange:o=>e({absoluteX:o})}),(0,t.jsx)(x.RangeControl,{label:(0,n.__)("Vertical","scroll-indicator"),value:W,min:0,max:100,onChange:o=>e({absoluteY:o})})]}),"fixed"===R&&(0,t.jsxs)("p",{className:"scroll-indicator-position-note",children:[(0,t.jsx)("span",{className:"scroll-indicator-control-icon",children:h}),(0,n.__)("Fixed positioning pins the indicator to the visitor's screen.","scroll-indicator")]})]})]}),(0,t.jsx)("div",{...oo,children:(0,t.jsxs)("div",{className:`scroll-indicator icon-${E}`,onPointerDown:function(o){if("absolute"!==R||0!==o.button)return;o.preventDefault(),o.stopPropagation(),D(l),Q(o);const e=o.currentTarget.ownerDocument,t=o=>{Q(o)},n=()=>{e.removeEventListener("pointermove",t),e.removeEventListener("pointerup",n)};e.addEventListener("pointermove",t),e.addEventListener("pointerup",n)},children:[(0,t.jsx)(g,{iconType:E}),m&&(0,t.jsx)("div",{className:"scroll-text",children:j||(0,n.__)("Scroll down","scroll-indicator")})]})})]})},save:function({attributes:o}){const{iconType:e="mouse",iconSize:l="M",customSizeValue:n="24px",align:r,showText:s=!0,customText:c="Scroll down",positionMode:a="flow",screenPosition:d="bottom-center",absoluteX:u=50,absoluteY:h=85,flowAlign:x="center"}=o,v=f(e),p=b(l,n),m=c||"Scroll down",w=["left","center","right"].includes(r),j=w?V(r):y(d),_=N(w?r:x),k=i.useBlockProps.save({className:z(a,j,_).concat(" ",T(r)).trim(),style:{"--scroll-indicator-size":p,...L(a,u,h)}});return(0,t.jsx)("div",{...k,children:(0,t.jsxs)("button",{type:"button",className:`scroll-indicator icon-${v}`,"aria-label":m,"data-hide-after-scrolling":"true",children:[(0,t.jsx)(g,{iconType:v}),s&&(0,t.jsx)("div",{className:"scroll-text",children:m})]})})}})}},t={};function l(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,l),i.exports}l.m=e,o=[],l.O=(e,t,n,i)=>{if(!t){var r=1/0;for(d=0;d=i)&&Object.keys(l.O).every(o=>l.O[o](t[c]))?t.splice(c--,1):(s=!1,i0&&o[d-1][2]>i;d--)o[d]=o[d-1];o[d]=[t,n,i]},l.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};l.O.j=e=>0===o[e];var e=(e,t)=>{var n,i,[r,s,c]=t,a=0;if(r.some(e=>0!==o[e])){for(n in s)l.o(s,n)&&(l.m[n]=s[n]);if(c)var d=c(l)}for(e&&e(t);al(83));n=l.O(n)})(); \ No newline at end of file diff --git a/compiled/style-index-rtl.css b/compiled/style-index-rtl.css index 52e68d4..ae584fd 100644 --- a/compiled/style-index-rtl.css +++ b/compiled/style-index-rtl.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.is-layout-constrained>.wp-block-scroll-indicator-scroll-indicator:not(.is-position-fixed):not(.is-position-absolute){max-width:var(--wp--style--global--content-size);width:100%}.editor-styles-wrapper .is-layout-constrained>.wp-block-scroll-indicator-scroll-indicator:not(.is-position-fixed):not(.is-position-absolute),.is-layout-constrained>.wp-block-scroll-indicator-scroll-indicator:not(.is-position-fixed):not(.is-position-absolute){float:none!important;margin-inline-end:auto!important;margin-inline-start:auto!important;margin-right:auto!important;margin-left:auto!important}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);right:50%;margin:0;position:fixed;left:auto;transform:translateX(50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{right:clamp(16px,4vw,32px);left:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{right:50%;left:auto;transform:translateX(50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{right:auto;left:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{right:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/compiled/style-index.css b/compiled/style-index.css index 83788be..c5a1a6a 100644 --- a/compiled/style-index.css +++ b/compiled/style-index.css @@ -1 +1 @@ -.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} +.wp-block-scroll-indicator-scroll-indicator{box-sizing:border-box;display:flex;justify-content:center;max-width:100%;width:100%}.wp-block-scroll-indicator-scroll-indicator.aligncenter,.wp-block-scroll-indicator-scroll-indicator.alignleft,.wp-block-scroll-indicator-scroll-indicator.alignright{float:none}.wp-block-scroll-indicator-scroll-indicator.alignleft{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.aligncenter{justify-content:center}.wp-block-scroll-indicator-scroll-indicator.alignright{justify-content:flex-end}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-left{justify-content:flex-start}.wp-block-scroll-indicator-scroll-indicator.is-flow-align-right{justify-content:flex-end}.is-layout-constrained>.wp-block-scroll-indicator-scroll-indicator:not(.is-position-fixed):not(.is-position-absolute){max-width:var(--wp--style--global--content-size);width:100%}.editor-styles-wrapper .is-layout-constrained>.wp-block-scroll-indicator-scroll-indicator:not(.is-position-fixed):not(.is-position-absolute),.is-layout-constrained>.wp-block-scroll-indicator-scroll-indicator:not(.is-position-fixed):not(.is-position-absolute){float:none!important;margin-inline-end:auto!important;margin-inline-start:auto!important;margin-left:auto!important;margin-right:auto!important}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed{bottom:clamp(16px,4vw,32px);left:50%;margin:0;position:fixed;right:auto;transform:translateX(-50%);width:auto;z-index:1000}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-left{left:clamp(16px,4vw,32px);right:auto;transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-center{left:50%;right:auto;transform:translateX(-50%)}.wp-block-scroll-indicator-scroll-indicator.is-position-fixed.is-screen-position-bottom-right{left:auto;right:clamp(16px,4vw,32px);transform:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute{left:var(--scroll-indicator-x,50%);margin:0;position:absolute;top:var(--scroll-indicator-y,85%);transform:translate(-50%,-50%);width:auto;z-index:2}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator{align-items:center;background:transparent;border:0;color:inherit;cursor:pointer;display:inline-flex;flex-direction:column;font:inherit;gap:10px;max-width:100%;padding:0;text-align:center}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator:focus-visible{border-radius:8px;box-shadow:0 0 0 2px currentcolor;outline:2px solid transparent;outline-offset:4px}.wp-block-scroll-indicator-scroll-indicator .scroll-indicator svg{height:var(--scroll-indicator-size,24px);width:var(--scroll-indicator-size,24px)}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator{cursor:grab;touch-action:none}.wp-block-scroll-indicator-scroll-indicator.is-position-absolute .scroll-indicator:active{cursor:grabbing}.wp-block-scroll-indicator-scroll-indicator .scroll-text{color:currentcolor;font-size:14px;font-weight:500;opacity:.8}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute),.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute){position:relative}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container{position:static}.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute)>.wp-block-cover__inner-container>:not(.wp-block-scroll-indicator-scroll-indicator){position:relative;z-index:1}@media(prefers-reduced-motion:no-preference){.wp-block-scroll-indicator-scroll-indicator .icon-mouse svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-mouse .scroll-wheel{animation:scroll-indicator-wheel 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-chevron-bounce svg{animation:scroll-indicator-bounce 2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-arrow-down svg path:last-child{animation:scroll-indicator-fade-pulse 2s ease-in-out infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-1{animation:scroll-indicator-dot-pulse 1.4s ease-in-out 0s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-2{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .2s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-scroll-dots .dot-3{animation:scroll-indicator-dot-pulse 1.4s ease-in-out .4s infinite}.wp-block-scroll-indicator-scroll-indicator .icon-hand-point svg{animation:scroll-indicator-bounce 2s infinite}@keyframes scroll-indicator-bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-8px)}60%{transform:translateY(-4px)}}@keyframes scroll-indicator-wheel{0%,50%,to{opacity:1;transform:translateY(0)}25%{opacity:.5;transform:translateY(8px)}}@keyframes scroll-indicator-fade-pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes scroll-indicator-dot-pulse{0%,to{opacity:.2}50%{opacity:1}}} diff --git a/src/block.json b/src/block.json index a4a5512..ddde4f2 100644 --- a/src/block.json +++ b/src/block.json @@ -21,6 +21,9 @@ "type": "string", "default": "24px" }, + "align": { + "type": "string" + }, "hideAfterScrolling": { "type": "boolean", "default": true @@ -56,7 +59,6 @@ }, "supports": { "html": false, - "align": [ "left", "center", "right" ], "color": { "text": true, "background": false }, "spacing": { "margin": true, "padding": true } }, diff --git a/src/edit.js b/src/edit.js index ee25d9a..0f5065f 100644 --- a/src/edit.js +++ b/src/edit.js @@ -1,9 +1,15 @@ import { __ } from '@wordpress/i18n'; -import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; +import { + useBlockProps, + InspectorControls, + BlockControls, + AlignmentToolbar, +} from '@wordpress/block-editor'; import { useRef } from '@wordpress/element'; import { desktop, dragHandle, + moveTo, positionCenter, positionLeft, positionRight, @@ -15,6 +21,8 @@ import { ButtonGroup, Button, RangeControl, + ToolbarButton, + ToolbarGroup, } from '@wordpress/components'; import { useDispatch } from '@wordpress/data'; @@ -34,6 +42,7 @@ import { getScreenPosition, getAlignmentFromScreenPosition, getScreenPositionFromAlignment, + getAlignmentClassName, } from './position'; const ICON_OPTIONS = [ @@ -134,6 +143,7 @@ export default function Edit( { attributes, setAttributes, clientId } ) { const normalizedFlowAlign = getFlowAlignment( hasCoreAlignment ? align : flowAlign ); + const toolbarAlignment = hasCoreAlignment ? align : normalizedFlowAlign; const customSizeNumber = getCustomSizeNumber( customSizeValue ); function getCustomSizeNumber( value ) { @@ -162,6 +172,23 @@ export default function Edit( { attributes, setAttributes, clientId } ) { setAttributes( nextAttributes ); } + function setAlignment( nextAlignment ) { + const alignment = getFlowAlignment( nextAlignment || 'center' ); + + if ( normalizedPositionMode === 'fixed' ) { + setAttributes( { + align: alignment, + screenPosition: getScreenPositionFromAlignment( alignment ), + } ); + return; + } + + setAttributes( { + align: alignment, + flowAlign: alignment, + } ); + } + function updateAbsolutePosition( event ) { const wrapper = blockRef.current; const canvas = @@ -223,7 +250,9 @@ export default function Edit( { attributes, setAttributes, clientId } ) { normalizedPositionMode, normalizedScreenPosition, normalizedFlowAlign - ), + ) + .concat( ' ', getAlignmentClassName( align ) ) + .trim(), style: { '--scroll-indicator-size': sizeValue, ...getPositionStyle( @@ -236,6 +265,25 @@ export default function Edit( { attributes, setAttributes, clientId } ) { return ( <> + + { normalizedPositionMode === 'absolute' ? ( + + selectBlock( clientId ) } + /> + + ) : ( + + ) } + &:not(.is-position-fixed):not(.is-position-absolute) { + float: none !important; + margin-inline-start: auto !important; + margin-inline-end: auto !important; + margin-left: auto !important; + margin-right: auto !important; + max-width: var(--wp--style--global--content-size); + width: 100%; + } + + .editor-styles-wrapper .is-layout-constrained > &:not(.is-position-fixed):not(.is-position-absolute) { + float: none !important; + margin-inline-start: auto !important; + margin-inline-end: auto !important; + margin-left: auto !important; + margin-right: auto !important; + } + &.is-position-fixed { bottom: clamp(16px, 4vw, 32px); left: 50%; @@ -114,12 +132,18 @@ } } -.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute), -.wp-block-group:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { +.wp-block-cover:has( +.wp-block-scroll-indicator-scroll-indicator.is-position-absolute +), +.wp-block-group:has( +.wp-block-scroll-indicator-scroll-indicator.is-position-absolute +) { position: relative; } -.wp-block-cover:has(.wp-block-scroll-indicator-scroll-indicator.is-position-absolute) { +.wp-block-cover:has( +.wp-block-scroll-indicator-scroll-indicator.is-position-absolute +) { > .wp-block-cover__inner-container { position: static;