@gem-sdk/pages 19.0.0-dev.0 → 19.0.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("./const.js"),n=require("@gem-sdk/core");exports.default=()=>{let[
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("./const.js"),n=require("@gem-sdk/core");exports.default=()=>{let[r,d]=t.useState(!1),{t:p}=n.useI18nStore(),[s,l]=t.useState({width:0,name:"",activeId:null}),[a,g]=t.useState(!1),o=t.useCallback(e=>{l(t=>({...t,...e}))},[l]);t.useEffect(()=>{if(s)g(s.width>0&&s.width<=1024);else{let e=i.devices[0];e&&o({width:e.width,name:e.name,activeId:e.id}),g(!1)}},[s,o]);let c=e=>{let t=i.devices.find(t=>t.id===e);t&&(o({width:t.width,name:t.name,activeId:t.id}),u(t.id)),d(!r)},u=e=>{let t=new CustomEvent("editor:change-device",{bubbles:!0,detail:{id:e}});window.dispatchEvent(t)},w=t.useRef(null),m=e=>{w.current&&!w.current.contains(e.target)&&d(!1)},x=e=>{let t=i.devices.find(t=>t.width===e);if(t)return t.name;let n=p("Desktop");return e<=768?p("Mobile"):e<=1024?p("Tablet"):n},v=t.useCallback(e=>{let t=e.detail;t&&(document.body.toggleAttribute("data-editor-mobile",!!t.isEditorMobile),o({width:t.width,name:x(t.width),activeId:null}))},[o]);t.useEffect(()=>(window.addEventListener("mousedown",m),window.addEventListener("editor:resize-preview-screen",v),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("editor:resize-preview-screen",v),document.body.removeAttribute("data-editor-mobile")}),[v]);let h=e=>e.id===s.activeId||s.name===e.name,f=()=>d(!r);return a?e.jsx(e.Fragment,{children:e.jsxs("div",{ref:w,className:`gp-switch-view gp-font-sans gp-flex gp-h-[40px] gp-absolute gp-top-[2px] gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-gap-2 gp-items-center gp-justify-center gp-cursor-pointer ${r?"gp-z-50":"gp-z-1"}`,children:[e.jsxs("div",{className:`gp-flex gp-gap-1 gp-py-1 gp-px-2 gp-transform -gp-translate-y-[2px] gp-border-[1px] gp-justify-between gp-items-center gp-min-w-[194px] gp-bg-[#F4F4F4] hover:gp-bg-[#E2E2E2] gp-rounded-md gp-leading-5 gp-text-xs gp-font-medium gp-text-[#212121] ${r?"gp-border-[#3C67FF]":"gp-border-transparent"}`,onClick:e=>{e.preventDefault(),f()},role:"presentation",children:[e.jsxs("span",{children:[s.name," (",s.width,"px)"]}),e.jsx("span",{children:e.jsx("svg",{width:"9",height:"5",viewBox:"0 0 9 5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.07564 0.775834C1.30995 0.541519 1.68985 0.541519 1.92417 0.775834L4.6999 3.55157L7.47564 0.775834C7.70995 0.541519 8.08985 0.541519 8.32417 0.775834C8.55848 1.01015 8.55848 1.39005 8.32417 1.62436L5.12417 4.82436C4.88985 5.05868 4.50995 5.05868 4.27564 4.82436L1.07564 1.62436C0.841324 1.39005 0.841324 1.01015 1.07564 0.775834Z",fill:"#212121"})})})]}),e.jsx("div",{className:`gp-absolute gp-top-9 gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-bg-[#212121] gp-rounded-xl gp-p-2 gp-text-[#F9F9F9] gp-w-[176px] gp-z-50 ${r?"":"gp-hidden"}`,children:i.devices.map(t=>e.jsx("div",{className:"gp-p-2 hover:gp-bg-[#3E3E3E] gp-rounded-md",onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t.id)},role:"presentation",children:e.jsxs("div",{className:'gp-flex gp-gap-2 gp-w-full gp-text-left gp-justify-space-between gp-cursor-pointer gp-leading-5 gp-text-xs gp-font-regular gp-text-[#212121]"',children:[e.jsx("span",{className:"gp-min-w-[16px]",children:h(t)&&e.jsx("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.6348 4.89265C12.792 5.07861 12.7878 5.37537 12.6255 5.55547L6.71176 12.118C6.55312 12.294 6.30118 12.294 6.14255 12.118L3.87448 9.60098C3.71219 9.42088 3.70805 9.12412 3.86523 8.93815C4.02241 8.75219 4.2814 8.74744 4.4437 8.92755L6.42716 11.1287L12.0563 4.88203C12.2186 4.70192 12.4776 4.70668 12.6348 4.89265Z",fill:"#00C853"})})}),e.jsx("span",{children:t.name})]})},t.id))})]})}):null};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e,Fragment as t,jsxs as
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{useState as n,useCallback as p,useEffect as d,useRef as r}from"react";import{devices as l}from"./const.js";import{useI18nStore as g}from"@gem-sdk/core";let o=()=>{let[o,a]=n(!1),{t:s}=g(),[m,c]=n({width:0,name:"",activeId:null}),[w,h]=n(!1),u=p(e=>{c(t=>({...t,...e}))},[c]);d(()=>{if(m)h(m.width>0&&m.width<=1024);else{let e=l[0];e&&u({width:e.width,name:e.name,activeId:e.id}),h(!1)}},[m,u]);let v=e=>{let t=l.find(t=>t.id===e);t&&(u({width:t.width,name:t.name,activeId:t.id}),f(t.id)),a(!o)},f=e=>{let t=new CustomEvent("editor:change-device",{bubbles:!0,detail:{id:e}});window.dispatchEvent(t)},x=r(null),b=e=>{x.current&&!x.current.contains(e.target)&&a(!1)},C=e=>{let t=l.find(t=>t.width===e);if(t)return t.name;let i=s("Desktop");return e<=768?s("Mobile"):e<=1024?s("Tablet"):i},E=p(e=>{let t=e.detail;t&&(document.body.toggleAttribute("data-editor-mobile",!!t.isEditorMobile),u({width:t.width,name:C(t.width),activeId:null}))},[u]);d(()=>(window.addEventListener("mousedown",b),window.addEventListener("editor:resize-preview-screen",E),()=>{window.removeEventListener("mousedown",b),window.removeEventListener("editor:resize-preview-screen",E),document.body.removeAttribute("data-editor-mobile")}),[E]);let L=e=>e.id===m.activeId||m.name===e.name,F=()=>a(!o);return w?e(t,{children:i("div",{ref:x,className:`gp-switch-view gp-font-sans gp-flex gp-h-[40px] gp-absolute gp-top-[2px] gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-gap-2 gp-items-center gp-justify-center gp-cursor-pointer ${o?"gp-z-50":"gp-z-1"}`,children:[i("div",{className:`gp-flex gp-gap-1 gp-py-1 gp-px-2 gp-transform -gp-translate-y-[2px] gp-border-[1px] gp-justify-between gp-items-center gp-min-w-[194px] gp-bg-[#F4F4F4] hover:gp-bg-[#E2E2E2] gp-rounded-md gp-leading-5 gp-text-xs gp-font-medium gp-text-[#212121] ${o?"gp-border-[#3C67FF]":"gp-border-transparent"}`,onClick:e=>{e.preventDefault(),F()},role:"presentation",children:[i("span",{children:[m.name," (",m.width,"px)"]}),e("span",{children:e("svg",{width:"9",height:"5",viewBox:"0 0 9 5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.07564 0.775834C1.30995 0.541519 1.68985 0.541519 1.92417 0.775834L4.6999 3.55157L7.47564 0.775834C7.70995 0.541519 8.08985 0.541519 8.32417 0.775834C8.55848 1.01015 8.55848 1.39005 8.32417 1.62436L5.12417 4.82436C4.88985 5.05868 4.50995 5.05868 4.27564 4.82436L1.07564 1.62436C0.841324 1.39005 0.841324 1.01015 1.07564 0.775834Z",fill:"#212121"})})})]}),e("div",{className:`gp-absolute gp-top-9 gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-bg-[#212121] gp-rounded-xl gp-p-2 gp-text-[#F9F9F9] gp-w-[176px] gp-z-50 ${o?"":"gp-hidden"}`,children:l.map(t=>e("div",{className:"gp-p-2 hover:gp-bg-[#3E3E3E] gp-rounded-md",onClick:e=>{e.preventDefault(),e.stopPropagation(),v(t.id)},role:"presentation",children:i("div",{className:'gp-flex gp-gap-2 gp-w-full gp-text-left gp-justify-space-between gp-cursor-pointer gp-leading-5 gp-text-xs gp-font-regular gp-text-[#212121]"',children:[e("span",{className:"gp-min-w-[16px]",children:L(t)&&e("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.6348 4.89265C12.792 5.07861 12.7878 5.37537 12.6255 5.55547L6.71176 12.118C6.55312 12.294 6.30118 12.294 6.14255 12.118L3.87448 9.60098C3.71219 9.42088 3.70805 9.12412 3.86523 8.93815C4.02241 8.75219 4.2814 8.74744 4.4437 8.92755L6.42716 11.1287L12.0563 4.88203C12.2186 4.70192 12.4776 4.70668 12.6348 4.89265Z",fill:"#00C853"})})}),e("span",{children:t.name})]})},t.id))})]})}):null};export{o as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "19.0.0-dev.
|
|
3
|
+
"version": "19.0.0-dev.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"next": "14.2.35"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/core": "19.0.0-dev.
|
|
30
|
+
"@gem-sdk/core": "19.0.0-dev.7",
|
|
31
31
|
"@gem-sdk/plugin-cookie-bar": "19.0.0-dev.0",
|
|
32
32
|
"@gem-sdk/plugin-quick-view": "19.0.0-dev.0",
|
|
33
33
|
"@gem-sdk/plugin-sticky-add-to-cart": "19.0.0-dev.0"
|