@redneckz/wildless-cms-uni-blocks 0.2.65 → 0.2.69

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.
Files changed (70) hide show
  1. package/dist/Gallery.mobile.d.ts +2 -0
  2. package/dist/Gallery.mobile.js +18 -0
  3. package/dist/Gallery.mobile.js.map +1 -0
  4. package/dist/Header/isSubItemActive.d.ts +1 -1
  5. package/dist/Header/isSubItemActive.js +2 -4
  6. package/dist/Header/isSubItemActive.js.map +1 -1
  7. package/dist/Header/isTopItemActive.d.ts +1 -1
  8. package/dist/Header/isTopItemActive.js +2 -8
  9. package/dist/Header/isTopItemActive.js.map +1 -1
  10. package/dist/MobileBlocks.d.ts +2 -4
  11. package/dist/MobileBlocks.js +7 -8
  12. package/dist/MobileBlocks.js.map +1 -1
  13. package/dist/Placeholder.js +1 -1
  14. package/dist/Placeholder.js.map +1 -1
  15. package/dist/ProductBlock.mobile.d.ts +5 -0
  16. package/dist/ProductBlock.mobile.js +10 -0
  17. package/dist/ProductBlock.mobile.js.map +1 -0
  18. package/dist/ProductBlockInner.js +4 -2
  19. package/dist/ProductBlockInner.js.map +1 -1
  20. package/dist/index.d.ts +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/useLink.js +1 -1
  23. package/dist/useLink.js.map +1 -1
  24. package/dist/utils/url.d.ts +13 -1
  25. package/dist/utils/url.js +26 -10
  26. package/dist/utils/url.js.map +1 -1
  27. package/lib/Gallery.mobile.d.ts +2 -0
  28. package/lib/Gallery.mobile.js +16 -0
  29. package/lib/Gallery.mobile.js.map +1 -0
  30. package/lib/Header/isSubItemActive.d.ts +1 -1
  31. package/lib/Header/isSubItemActive.js +3 -5
  32. package/lib/Header/isSubItemActive.js.map +1 -1
  33. package/lib/Header/isTopItemActive.d.ts +1 -1
  34. package/lib/Header/isTopItemActive.js +3 -9
  35. package/lib/Header/isTopItemActive.js.map +1 -1
  36. package/lib/MobileBlocks.d.ts +2 -4
  37. package/lib/MobileBlocks.js +6 -7
  38. package/lib/MobileBlocks.js.map +1 -1
  39. package/lib/Placeholder.js +1 -1
  40. package/lib/Placeholder.js.map +1 -1
  41. package/lib/ProductBlock.mobile.d.ts +5 -0
  42. package/lib/ProductBlock.mobile.js +8 -0
  43. package/lib/ProductBlock.mobile.js.map +1 -0
  44. package/lib/ProductBlockInner.js +4 -2
  45. package/lib/ProductBlockInner.js.map +1 -1
  46. package/lib/common.css +1 -1
  47. package/lib/index.d.ts +2 -0
  48. package/lib/index.js.map +1 -1
  49. package/lib/useLink.js +2 -2
  50. package/lib/useLink.js.map +1 -1
  51. package/lib/utils/url.d.ts +13 -1
  52. package/lib/utils/url.js +22 -9
  53. package/lib/utils/url.js.map +1 -1
  54. package/package.json +8 -3
  55. package/src/ContentPage.fixture.tsx +2 -2
  56. package/src/ContentPage.page.json +1 -1
  57. package/src/Gallery.fixture.tsx +2 -0
  58. package/src/Gallery.mobile.tsx +70 -0
  59. package/src/Header/isSubItemActive.ts +3 -5
  60. package/src/Header/isTopItemActive.ts +4 -9
  61. package/src/MobileBlocks.ts +6 -7
  62. package/src/Placeholder.tsx +1 -1
  63. package/src/ProductBlock.mobile.tsx +19 -0
  64. package/src/ProductBlockInner.tsx +6 -2
  65. package/src/common.css +26 -0
  66. package/src/index.ts +3 -0
  67. package/src/setup-fixture.ts +12 -0
  68. package/src/useLink.ts +2 -2
  69. package/src/utils/url.spec.ts +53 -0
  70. package/src/utils/url.ts +39 -9
package/lib/common.css CHANGED
@@ -1 +1 @@
1
- @import "../fonts/ubuntu/ubuntu.css";[data-theme=pc]{--color-primary-main:66,171,68;--color-primary-hover:36,131,65;--color-primary-active:36,95,52;--color-secondary-hover:216,242,217;--color-secondary-active:197,226,198}[data-theme=bc]{--color-primary-main:131,184,62;--color-primary-hover:92,146,29;--color-primary-active:60,94,16;--color-secondary-hover:232,244,217;--color-secondary-active:216,227,202}[data-theme=eo]{--color-primary-main:221,182,61;--color-primary-hover:187,151,39;--color-primary-active:126,99,12;--color-secondary-hover:241,236,221;--color-secondary-active:229,222,199}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.absolute{position:absolute}.relative{position:relative}.sticky{position:-webkit-sticky;position:sticky}.top-4{top:1rem}.right-4{right:1rem}.bottom-0{bottom:0}.right-0{right:0}.top-1\/2{top:50%}.left-8{left:2rem}.right-1{right:.25rem}.top-0{top:0}.left-0{left:0}.-bottom-2{bottom:-.5rem}.top-1{top:.25rem}.z-20{z-index:20}.z-10{z-index:10}.col-span-12{grid-column:span 12/span 12}.col-span-8{grid-column:span 8/span 8}.col-span-4{grid-column:span 4/span 4}.col-span-6{grid-column:span 6/span 6}.m-0{margin:0}.m-auto{margin:auto}.-mx-20{margin-left:-5rem;margin-right:-5rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-4{margin-bottom:1rem;margin-top:1rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mt-9{margin-top:2.25rem}.mt-auto{margin-top:auto}.ml-7{margin-left:1.75rem}.mt-2\.5{margin-top:.625rem}.mt-2{margin-top:.5rem}.ml-2{margin-left:.5rem}.mb-8{margin-bottom:2rem}.mt-3{margin-top:.75rem}.mb-6{margin-bottom:1.5rem}.mt-6{margin-top:1.5rem}.ml-4{margin-left:1rem}.mb-3\.5{margin-bottom:.875rem}.mb-3{margin-bottom:.75rem}.mt-5{margin-top:1.25rem}.mb-1{margin-bottom:.25rem}.mr-8{margin-right:2rem}.mt-4{margin-top:1rem}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mr-5{margin-right:1.25rem}.mr-7{margin-right:1.75rem}.mr-2{margin-right:.5rem}.ml-2\.5{margin-left:.625rem}.box-border{box-sizing:border-box}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-full{height:100%}.h-\[70px\]{height:70px}.h-8{height:2rem}.h-\[90px\]{height:90px}.h-4{height:1rem}.h-\[50px\]{height:50px}.h-\[3px\]{height:3px}.h-0\.5{height:.125rem}.h-0{height:0}.h-\[100px\]{height:100px}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-12{height:3rem}.h-\[8px\]{height:8px}.h-\[2px\]{height:2px}.h-\[24px\]{height:24px}.min-h-\[70px\]{min-height:70px}.min-h-\[90px\]{min-height:90px}.min-h-\[50px\]{min-height:50px}.min-h-\[100px\]{min-height:100px}.min-h-\[320px\]{min-height:320px}.min-h-\[32px\]{min-height:32px}.min-h-\[8px\]{min-height:8px}.w-\[70px\]{width:70px}.w-full{width:100%}.w-8{width:2rem}.w-\[84px\]{width:84px}.w-\[364px\]{width:364px}.w-\[125px\]{width:125px}.w-\[90px\]{width:90px}.w-\[50px\]{width:50px}.w-\[100px\]{width:100px}.w-\[276px\]{width:276px}.w-4{width:1rem}.w-\[280px\]{width:280px}.w-\[235px\]{width:235px}.w-9{width:2.25rem}.w-\[24px\]{width:24px}.w-12{width:3rem}.w-\[8px\]{width:8px}.w-\[36px\]{width:36px}.w-10{width:2.5rem}.min-w-\[70px\]{min-width:70px}.min-w-\[364px\]{min-width:364px}.min-w-\[90px\]{min-width:90px}.min-w-\[600px\]{min-width:600px}.min-w-\[50px\]{min-width:50px}.min-w-\[100px\]{min-width:100px}.min-w-\[32px\]{min-width:32px}.min-w-\[8px\]{min-width:8px}.max-w-\[600px\]{max-width:600px}.max-w-\[47rem\]{max-width:47rem}.max-w-\[580px\]{max-width:580px}.max-w-\[308px\]{max-width:308px}.max-w-min{max-width:-webkit-min-content;max-width:-moz-min-content;max-width:min-content}.max-w-\[292px\]{max-width:292px}.max-w-\[170px\]{max-width:170px}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.basis-0{flex-basis:0px}.-translate-x-full{--tw-translate-x:-100%}.-translate-x-full,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@-webkit-keyframes progress{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes progress{0%{transform:translateX(-100%)}to{transform:translateX(0)}}.animate-slide{-webkit-animation:progress linear;animation:progress linear}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-3{gap:.75rem}.gap-5{gap:1.25rem}.gap-1{gap:.25rem}.gap-6{gap:1.5rem}.gap-4{gap:1rem}.gap-32{gap:8rem}.gap-11{gap:2.75rem}.gap-\[14px\]{gap:14px}.gap-2{gap:.5rem}.gap-3\.5{gap:.875rem}.gap-x-24{-moz-column-gap:6rem;column-gap:6rem}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.rounded-3xl{border-radius:1.5rem}.rounded{border-radius:.25rem}.rounded-tl-lg{border-top-left-radius:.5rem}.rounded-bl-3xl{border-bottom-left-radius:1.5rem}.rounded-br-3xl{border-bottom-right-radius:1.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-0{border-width:0}.border-x-0{border-left-width:0;border-right-width:0}.border-y{border-bottom-width:1px}.border-t,.border-y{border-top-width:1px}.border-r{border-right-width:1px}.border-solid{border-style:solid}.border-none{border-style:none}.border-main-divider{--tw-border-opacity:1;border-color:rgba(235,237,240,var(--tw-border-opacity))}.border-main{--tw-border-opacity:1;border-color:rgba(240,244,240,var(--tw-border-opacity))}.border-primary-main{--tw-border-opacity:1;border-color:rgba(var(--color-primary-main),var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-y-main-divider{--tw-border-opacity:1;border-bottom-color:rgba(235,237,240,var(--tw-border-opacity));border-top-color:rgba(235,237,240,var(--tw-border-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-main{--tw-bg-opacity:1;background-color:rgba(240,244,240,var(--tw-bg-opacity))}.bg-secondary-text{--tw-bg-opacity:1;background-color:rgba(125,126,127,var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-secondary-light{--tw-bg-opacity:1;background-color:rgba(245,247,249,var(--tw-bg-opacity))}.bg-inherit{background-color:inherit}.bg-primary-main{--tw-bg-opacity:1;background-color:rgba(var(--color-primary-main),var(--tw-bg-opacity))}.bg-primary-main\/10{background-color:rgba(var(--color-primary-main),.1)}.bg-main-divider{--tw-bg-opacity:1;background-color:rgba(235,237,240,var(--tw-bg-opacity))}.bg-secondary-dark{--tw-bg-opacity:1;background-color:rgba(226,228,229,var(--tw-bg-opacity))}.p-12{padding:3rem}.p-10{padding:2.5rem}.p-20{padding:5rem}.p-7{padding:1.75rem}.p-2{padding:.5rem}.p-\[10px\]{padding:10px}.p-\[26px\]{padding:26px}.p-9{padding:2.25rem}.p-0{padding:0}.px-0{padding-left:0;padding-right:0}.py-4{padding-bottom:1rem;padding-top:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-12{padding-left:3rem;padding-right:3rem}.py-12{padding-bottom:3rem;padding-top:3rem}.px-\[88px\]{padding-left:88px;padding-right:88px}.px-3{padding-left:.75rem;padding-right:.75rem}.px-9{padding-left:2.25rem;padding-right:2.25rem}.py-0\.5{padding-bottom:.125rem;padding-top:.125rem}.py-0{padding-bottom:0;padding-top:0}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.px-20{padding-left:5rem;padding-right:5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1\.5{padding-bottom:.375rem;padding-top:.375rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-4{padding-left:1rem;padding-right:1rem}.pb-2{padding-bottom:.5rem}.pt-0{padding-top:0}.pl-11{padding-left:2.75rem}.pt-4{padding-top:1rem}.pt-10{padding-top:2.5rem}.pl-\[50px\]{padding-left:50px}.pb-\[50px\]{padding-bottom:50px}.pr-\[7\.5rem\]{padding-right:7.5rem}.pl-2\.5{padding-left:.625rem}.pt-2\.5{padding-top:.625rem}.pb-1\.5{padding-bottom:.375rem}.pr-\[6\.25rem\]{padding-right:6.25rem}.pl-2{padding-left:.5rem}.pt-2{padding-top:.5rem}.pb-1{padding-bottom:.25rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pr-4{padding-right:1rem}.pt-0\.5{padding-top:.125rem}.pr-3{padding-right:.75rem}.pr-28{padding-right:7rem}.pr-9{padding-right:2.25rem}.pr-\[4\.75rem\]{padding-right:4.75rem}.pr-\[9\.4rem\]{padding-right:9.4rem}.pb-8{padding-bottom:2rem}.pt-\[3px\]{padding-top:3px}.pt-\[30px\]{padding-top:30px}.pb-7{padding-bottom:1.75rem}.pt-5{padding-top:1.25rem}.pb-\[5px\]{padding-bottom:5px}.pt-\[5px\]{padding-top:5px}.pl-4{padding-left:1rem}.pl-12{padding-left:3rem}.pr-\[6\%\]{padding-right:6%}.text-left{text-align:left}.text-center{text-align:center}.font-sans{font-family:Ubuntu,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-base{font-size:1rem;line-height:1.5rem}.text-title{font-size:2rem;line-height:2.5rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.375rem}.text-xs{font-size:.75rem;line-height:1.125rem}.text-title-sm{font-size:1.75rem;line-height:2.5rem}.text-xxs{font-size:.625rem;line-height:.625rem}.text-title-lg{font-size:2.5rem;line-height:3rem}.text-title-xs{font-size:1.5rem;line-height:1.875rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.text-primary-text{--tw-text-opacity:1;color:rgba(28,28,28,var(--tw-text-opacity))}.text-secondary-text{--tw-text-opacity:1;color:rgba(125,126,127,var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-primary-main{--tw-text-opacity:1;color:rgba(var(--color-primary-main),var(--tw-text-opacity))}.text-secondary-light{--tw-text-opacity:1;color:rgba(245,247,249,var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.no-underline{-webkit-text-decoration-line:none;text-decoration-line:none}.shadow-\[0_8px_32px_0px_\#00000014\]{--tw-shadow:0 8px 32px 0px #00000014;--tw-shadow-colored:0 8px 32px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.duration-1000{transition-duration:1s}.rotate-180{transform:rotate(180deg)}.-translate-x-full{transform:translateX(-100%)}.visited\:text-secondary-text:visited{color:rgba(125,126,127,var(--tw-text-opacity))}.hover\:bg-primary-hover:hover{--tw-bg-opacity:1;background-color:rgba(var(--color-primary-hover),var(--tw-bg-opacity))}.hover\:bg-secondary-hover:hover{--tw-bg-opacity:1;background-color:rgba(var(--color-secondary-hover),var(--tw-bg-opacity))}.hover\:text-primary-text:hover{--tw-text-opacity:1;color:rgba(28,28,28,var(--tw-text-opacity))}.hover\:text-primary-main:hover{--tw-text-opacity:1;color:rgba(var(--color-primary-main),var(--tw-text-opacity))}.hover\:text-secondary-active:hover{--tw-text-opacity:1;color:rgba(var(--color-secondary-active),var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.active\:bg-primary-active:active{--tw-bg-opacity:1;background-color:rgba(var(--color-primary-active),var(--tw-bg-opacity))}.active\:bg-secondary-active:active{--tw-bg-opacity:1;background-color:rgba(var(--color-secondary-active),var(--tw-bg-opacity))}.group:hover .group-hover\:text-primary-text{--tw-text-opacity:1;color:rgba(28,28,28,var(--tw-text-opacity))}@media (min-width:1280px) and (max-width:1535px){.xl\:w-\[220px\]{width:220px}.xl\:gap-8{gap:2rem}.xl\:gap-5{gap:1.25rem}}
1
+ @import "../fonts/ubuntu/ubuntu.css";[data-theme=pc]{--color-primary-main:66,171,68;--color-primary-hover:36,131,65;--color-primary-active:36,95,52;--color-secondary-hover:216,242,217;--color-secondary-active:197,226,198}[data-theme=bc]{--color-primary-main:131,184,62;--color-primary-hover:92,146,29;--color-primary-active:60,94,16;--color-secondary-hover:232,244,217;--color-secondary-active:216,227,202}[data-theme=eo]{--color-primary-main:221,182,61;--color-primary-hover:187,151,39;--color-primary-active:126,99,12;--color-secondary-hover:241,236,221;--color-secondary-active:229,222,199}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.absolute{position:absolute}.relative{position:relative}.sticky{position:-webkit-sticky;position:sticky}.top-4{top:1rem}.right-4{right:1rem}.bottom-0{bottom:0}.right-0{right:0}.top-1\/2{top:50%}.left-8{left:2rem}.right-1{right:.25rem}.top-0{top:0}.left-0{left:0}.-bottom-2{bottom:-.5rem}.top-1{top:.25rem}.z-20{z-index:20}.z-10{z-index:10}.col-span-12{grid-column:span 12/span 12}.col-span-8{grid-column:span 8/span 8}.col-span-4{grid-column:span 4/span 4}.col-span-6{grid-column:span 6/span 6}.m-0{margin:0}.m-auto{margin:auto}.-mx-20{margin-left:-5rem;margin-right:-5rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-4{margin-bottom:1rem;margin-top:1rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mt-9{margin-top:2.25rem}.mt-auto{margin-top:auto}.ml-7{margin-left:1.75rem}.mt-2\.5{margin-top:.625rem}.mt-2{margin-top:.5rem}.ml-2{margin-left:.5rem}.mb-8{margin-bottom:2rem}.mt-3{margin-top:.75rem}.mb-6{margin-bottom:1.5rem}.mt-6{margin-top:1.5rem}.ml-4{margin-left:1rem}.mb-3\.5{margin-bottom:.875rem}.mb-3{margin-bottom:.75rem}.mt-5{margin-top:1.25rem}.mb-1{margin-bottom:.25rem}.mr-8{margin-right:2rem}.mt-4{margin-top:1rem}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mr-5{margin-right:1.25rem}.mr-7{margin-right:1.75rem}.mr-2{margin-right:.5rem}.ml-2\.5{margin-left:.625rem}.box-border{box-sizing:border-box}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-full{height:100%}.h-\[70px\]{height:70px}.h-8{height:2rem}.h-\[90px\]{height:90px}.h-4{height:1rem}.h-\[50px\]{height:50px}.h-\[3px\]{height:3px}.h-0\.5{height:.125rem}.h-0{height:0}.h-\[100px\]{height:100px}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-12{height:3rem}.h-\[8px\]{height:8px}.h-\[2px\]{height:2px}.h-\[24px\]{height:24px}.min-h-\[70px\]{min-height:70px}.min-h-\[90px\]{min-height:90px}.min-h-\[50px\]{min-height:50px}.min-h-\[100px\]{min-height:100px}.min-h-\[320px\]{min-height:320px}.min-h-\[32px\]{min-height:32px}.min-h-\[8px\]{min-height:8px}.w-\[70px\]{width:70px}.w-full{width:100%}.w-8{width:2rem}.w-\[84px\]{width:84px}.w-\[364px\]{width:364px}.w-\[125px\]{width:125px}.w-\[90px\]{width:90px}.w-\[50px\]{width:50px}.w-\[100px\]{width:100px}.w-\[276px\]{width:276px}.w-4{width:1rem}.w-\[280px\]{width:280px}.w-\[235px\]{width:235px}.w-9{width:2.25rem}.w-\[24px\]{width:24px}.w-12{width:3rem}.w-\[8px\]{width:8px}.w-\[36px\]{width:36px}.w-10{width:2.5rem}.min-w-\[70px\]{min-width:70px}.min-w-\[364px\]{min-width:364px}.min-w-\[90px\]{min-width:90px}.min-w-\[600px\]{min-width:600px}.min-w-\[50px\]{min-width:50px}.min-w-\[100px\]{min-width:100px}.min-w-\[32px\]{min-width:32px}.min-w-\[8px\]{min-width:8px}.max-w-\[600px\]{max-width:600px}.max-w-\[47rem\]{max-width:47rem}.max-w-\[580px\]{max-width:580px}.max-w-\[308px\]{max-width:308px}.max-w-min{max-width:-webkit-min-content;max-width:-moz-min-content;max-width:min-content}.max-w-\[292px\]{max-width:292px}.max-w-\[170px\]{max-width:170px}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.basis-0{flex-basis:0px}.-translate-x-full{--tw-translate-x:-100%}.-translate-x-full,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@-webkit-keyframes progress{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes progress{0%{transform:translateX(-100%)}to{transform:translateX(0)}}.animate-slide{-webkit-animation:progress linear;animation:progress linear}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-3{gap:.75rem}.gap-5{gap:1.25rem}.gap-1{gap:.25rem}.gap-6{gap:1.5rem}.gap-4{gap:1rem}.gap-32{gap:8rem}.gap-11{gap:2.75rem}.gap-\[14px\]{gap:14px}.gap-2{gap:.5rem}.gap-3\.5{gap:.875rem}.gap-x-24{-moz-column-gap:6rem;column-gap:6rem}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.rounded-3xl{border-radius:1.5rem}.rounded{border-radius:.25rem}.rounded-tl-lg{border-top-left-radius:.5rem}.rounded-bl-3xl{border-bottom-left-radius:1.5rem}.rounded-br-3xl{border-bottom-right-radius:1.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-0{border-width:0}.border-x-0{border-left-width:0;border-right-width:0}.border-y{border-bottom-width:1px}.border-t,.border-y{border-top-width:1px}.border-r{border-right-width:1px}.border-solid{border-style:solid}.border-none{border-style:none}.border-main-divider{--tw-border-opacity:1;border-color:rgba(235,237,240,var(--tw-border-opacity))}.border-main{--tw-border-opacity:1;border-color:rgba(240,244,240,var(--tw-border-opacity))}.border-primary-main{--tw-border-opacity:1;border-color:rgba(var(--color-primary-main),var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-y-main-divider{--tw-border-opacity:1;border-bottom-color:rgba(235,237,240,var(--tw-border-opacity));border-top-color:rgba(235,237,240,var(--tw-border-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-main{--tw-bg-opacity:1;background-color:rgba(240,244,240,var(--tw-bg-opacity))}.bg-secondary-text{--tw-bg-opacity:1;background-color:rgba(125,126,127,var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-secondary-light{--tw-bg-opacity:1;background-color:rgba(245,247,249,var(--tw-bg-opacity))}.bg-inherit{background-color:inherit}.bg-primary-main{--tw-bg-opacity:1;background-color:rgba(var(--color-primary-main),var(--tw-bg-opacity))}.bg-primary-main\/10{background-color:rgba(var(--color-primary-main),.1)}.bg-main-divider{--tw-bg-opacity:1;background-color:rgba(235,237,240,var(--tw-bg-opacity))}.bg-secondary-dark{--tw-bg-opacity:1;background-color:rgba(226,228,229,var(--tw-bg-opacity))}.p-12{padding:3rem}.p-10{padding:2.5rem}.p-20{padding:5rem}.p-4{padding:1rem}.p-7{padding:1.75rem}.p-2{padding:.5rem}.p-\[10px\]{padding:10px}.p-\[26px\]{padding:26px}.p-9{padding:2.25rem}.p-0{padding:0}.px-0{padding-left:0;padding-right:0}.py-4{padding-bottom:1rem;padding-top:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-12{padding-left:3rem;padding-right:3rem}.py-12{padding-bottom:3rem;padding-top:3rem}.px-\[88px\]{padding-left:88px;padding-right:88px}.px-3{padding-left:.75rem;padding-right:.75rem}.px-9{padding-left:2.25rem;padding-right:2.25rem}.py-0\.5{padding-bottom:.125rem;padding-top:.125rem}.py-0{padding-bottom:0;padding-top:0}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.px-20{padding-left:5rem;padding-right:5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1\.5{padding-bottom:.375rem;padding-top:.375rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-4{padding-left:1rem;padding-right:1rem}.pb-2{padding-bottom:.5rem}.pt-0{padding-top:0}.pl-11{padding-left:2.75rem}.pt-4{padding-top:1rem}.pt-10{padding-top:2.5rem}.pl-\[50px\]{padding-left:50px}.pb-\[50px\]{padding-bottom:50px}.pr-\[7\.5rem\]{padding-right:7.5rem}.pl-2\.5{padding-left:.625rem}.pt-2\.5{padding-top:.625rem}.pb-1\.5{padding-bottom:.375rem}.pr-\[6\.25rem\]{padding-right:6.25rem}.pl-2{padding-left:.5rem}.pt-2{padding-top:.5rem}.pb-1{padding-bottom:.25rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pr-4{padding-right:1rem}.pt-0\.5{padding-top:.125rem}.pr-3{padding-right:.75rem}.pr-28{padding-right:7rem}.pr-9{padding-right:2.25rem}.pr-\[4\.75rem\]{padding-right:4.75rem}.pr-\[9\.4rem\]{padding-right:9.4rem}.pb-8{padding-bottom:2rem}.pt-\[3px\]{padding-top:3px}.pt-\[30px\]{padding-top:30px}.pb-7{padding-bottom:1.75rem}.pt-5{padding-top:1.25rem}.pb-\[5px\]{padding-bottom:5px}.pt-\[5px\]{padding-top:5px}.pl-4{padding-left:1rem}.pl-12{padding-left:3rem}.pr-\[6\%\]{padding-right:6%}.text-left{text-align:left}.text-center{text-align:center}.font-sans{font-family:Ubuntu,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-base{font-size:1rem;line-height:1.5rem}.text-title{font-size:2rem;line-height:2.5rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.375rem}.text-xs{font-size:.75rem;line-height:1.125rem}.text-title-sm{font-size:1.75rem;line-height:2.5rem}.text-xxs{font-size:.625rem;line-height:.625rem}.text-title-lg{font-size:2.5rem;line-height:3rem}.text-title-xs{font-size:1.5rem;line-height:1.875rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.text-primary-text{--tw-text-opacity:1;color:rgba(28,28,28,var(--tw-text-opacity))}.text-secondary-text{--tw-text-opacity:1;color:rgba(125,126,127,var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-primary-main{--tw-text-opacity:1;color:rgba(var(--color-primary-main),var(--tw-text-opacity))}.text-secondary-light{--tw-text-opacity:1;color:rgba(245,247,249,var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.no-underline{-webkit-text-decoration-line:none;text-decoration-line:none}.shadow-\[0_8px_32px_0px_\#00000014\]{--tw-shadow:0 8px 32px 0px #00000014;--tw-shadow-colored:0 8px 32px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.duration-1000{transition-duration:1s}.rotate-180{transform:rotate(180deg)}.-translate-x-full{transform:translateX(-100%)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.horizontal-list{-ms-scroll-chaining:none;-webkit-overflow-scrolling:touch;display:flex;overflow-x:scroll;overscroll-behavior:contain;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;touch-action:pan-x}.horizontal-list-item{flex-shrink:0;scroll-snap-align:start;scroll-snap-stop:always;width:100%}.visited\:text-secondary-text:visited{color:rgba(125,126,127,var(--tw-text-opacity))}.hover\:bg-primary-hover:hover{--tw-bg-opacity:1;background-color:rgba(var(--color-primary-hover),var(--tw-bg-opacity))}.hover\:bg-secondary-hover:hover{--tw-bg-opacity:1;background-color:rgba(var(--color-secondary-hover),var(--tw-bg-opacity))}.hover\:text-primary-text:hover{--tw-text-opacity:1;color:rgba(28,28,28,var(--tw-text-opacity))}.hover\:text-primary-main:hover{--tw-text-opacity:1;color:rgba(var(--color-primary-main),var(--tw-text-opacity))}.hover\:text-secondary-active:hover{--tw-text-opacity:1;color:rgba(var(--color-secondary-active),var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.active\:bg-primary-active:active{--tw-bg-opacity:1;background-color:rgba(var(--color-primary-active),var(--tw-bg-opacity))}.active\:bg-secondary-active:active{--tw-bg-opacity:1;background-color:rgba(var(--color-secondary-active),var(--tw-bg-opacity))}.group:hover .group-hover\:text-primary-text{--tw-text-opacity:1;color:rgba(28,28,28,var(--tw-text-opacity))}@media (min-width:1280px) and (max-width:1535px){.xl\:w-\[220px\]{width:220px}.xl\:gap-8{gap:2rem}.xl\:gap-5{gap:1.25rem}}
package/lib/index.d.ts CHANGED
@@ -2,9 +2,11 @@ export type { ProjectSettings } from './ProjectSettings';
2
2
  export { projectSettings } from './ProjectSettings';
3
3
  export { LikeAPI } from './api/LikeAPI';
4
4
  export { DaDataAPI } from './api/DaDataAPI';
5
+ export type { HeaderContent as SitemapContent } from './Header';
5
6
  export type { BlockDef, UniBlockProps, ContentPageMeta, ContentPageDef, Img, ImgSource, Picture, } from './types';
6
7
  export type { ContentPageContext, Router, AsyncDataHook, GeolocationHook, LikeService, HandlerDecorator, Search, } from './ContentPageContext';
7
8
  export { ContentPageHead } from './ContentPageHead';
9
+ export type { BlockDecorator } from './ContentPage';
8
10
  export { ContentPage } from './ContentPage';
9
11
  export { toMobilePage } from './toMobilePage';
10
12
  export { Blocks } from './Blocks';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAqB5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuB5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
package/lib/useLink.js CHANGED
@@ -1,7 +1,7 @@
1
- import { isURL, toRelativeHref } from './utils/url.js';
1
+ import { adjustHref, isURL } from './utils/url.js';
2
2
  const defaultHandlerDecorator = (handler, targetContent) => handler;
3
3
  export function useLink({ router, handlerDecorator = defaultHandlerDecorator, }, link) {
4
- const href = toRelativeHref(link.href, router.href);
4
+ const href = adjustHref(link.href, router);
5
5
  return {
6
6
  ...link,
7
7
  href,
@@ -1 +1 @@
1
- {"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,uBAAuB,GAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC;AAEtF,MAAM,UAAU,OAAO,CACrB,EACE,MAAM,EACN,gBAAgB,GAAG,uBAAuB,GACc,EAC1D,IAA0B;IAE1B,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO;QACL,GAAG,IAAI;QACP,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,IAAI;QACpB,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAc,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzC,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;YAC9D,IAAI,WAAW,IAAI,aAAa,EAAE;gBAChC,EAAE,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,EAAE,IAAI,CAAC;KACT,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,uBAAuB,GAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC;AAEtF,MAAM,UAAU,OAAO,CACrB,EACE,MAAM,EACN,gBAAgB,GAAG,uBAAuB,GACc,EAC1D,IAA0B;IAE1B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO;QACL,GAAG,IAAI;QACP,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,IAAI;QACpB,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAc,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzC,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;YAC9D,IAAI,WAAW,IAAI,aAAa,EAAE;gBAChC,EAAE,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,EAAE,IAAI,CAAC;KACT,CAAC;AACJ,CAAC"}
@@ -1,4 +1,16 @@
1
+ export declare const MOBILE_URL_PATH = "/mobile";
1
2
  export declare const isURL: (href?: string) => boolean | undefined;
3
+ export declare const isHrefActive: (href: string | undefined, router: {
4
+ pathname?: string | undefined;
5
+ href?: string | undefined;
6
+ }, cmp?: (href: string, baseHref: string) => boolean) => boolean;
2
7
  export declare const withoutQuery: (href?: string) => string;
8
+ export declare const withoutMobilePath: (href?: string) => string;
3
9
  export declare const getOrigin: (href?: string) => string | undefined;
4
- export declare const toRelativeHref: (href?: string, baseURL?: string) => string | undefined;
10
+ export declare const adjustHref: (href: string | undefined, router: {
11
+ pathname: string;
12
+ href?: string | undefined;
13
+ }) => string | undefined;
14
+ export declare const toRelativeHref: (href: string | undefined, router: {
15
+ href?: string | undefined;
16
+ }) => string | undefined;
package/lib/utils/url.js CHANGED
@@ -1,20 +1,33 @@
1
+ export const MOBILE_URL_PATH = '/mobile';
1
2
  export const isURL = (href) => href?.includes('//');
3
+ export const isHrefActive = (href, router, cmp = (href, baseHref) => href === baseHref) => {
4
+ return cmp(withoutQuery(href), withoutMobilePath(withoutQuery(isURL(href) ? router.href : router.pathname)));
5
+ };
2
6
  export const withoutQuery = (href) => (href || '').replace(/\/?\?.*/, '');
7
+ export const withoutMobilePath = (href) => (href || '').replace(MOBILE_URL_PATH, '');
3
8
  export const getOrigin = (href) => {
4
- if (isURL(href)) {
5
- const url = href;
6
- const protoSeparator = '://';
7
- const endOfProto = url.indexOf(protoSeparator);
8
- const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
9
- return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
9
+ if (!isURL(href)) {
10
+ return undefined;
11
+ }
12
+ const url = href;
13
+ const protoSeparator = '//';
14
+ const endOfProto = url.indexOf(protoSeparator);
15
+ const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
16
+ return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
17
+ };
18
+ export const adjustHref = (href, router) => {
19
+ if (!href) {
20
+ return href;
10
21
  }
11
- return undefined;
22
+ const relativeHref = toRelativeHref(href, router);
23
+ const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
24
+ return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
12
25
  };
13
- export const toRelativeHref = (href, baseURL) => {
26
+ export const toRelativeHref = (href, router) => {
14
27
  if (!href) {
15
28
  return href;
16
29
  }
17
- const origin = getOrigin(baseURL);
30
+ const origin = getOrigin(router?.href);
18
31
  return origin ? href.replace(origin, '') || '/' : href;
19
32
  };
20
33
  //# sourceMappingURL=url.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;QACf,MAAM,GAAG,GAAG,IAAK,CAAC;QAClB,MAAM,cAAc,GAAG,KAAK,CAAC;QAC7B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KACjE;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAa,EAAE,OAAgB,EAAE,EAAE;IAChE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC"}
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAwB,EACxB,MAA4C,EAC5C,MAAmD,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,EACxF,EAAE;IACF,OAAO,GAAG,CACR,YAAY,CAAC,IAAI,CAAC,EAClB,iBAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAK,CAAC;IAClB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAwB,EACxB,MAA2C,EAC3C,EAAE;IACF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAE,CAAC;IACnD,MAAM,YAAY,GAAG,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAClE,OAAO,YAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,GAAG,YAAY,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAwB,EAAE,MAAyB,EAAE,EAAE;IACpF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.2.65",
3
+ "version": "0.2.69",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,6 +60,7 @@
60
60
  "files": [
61
61
  "lib",
62
62
  "dist",
63
+ "bundle",
63
64
  "fonts",
64
65
  "src"
65
66
  ],
@@ -75,13 +76,13 @@
75
76
  },
76
77
  "scripts": {
77
78
  "start": "npm run cosmos",
78
- "build": "npm run build:lib && npm run build:commonjs && npm run build:style && npm run build:icons",
79
+ "build": "npm run build:lib && npm run build:commonjs && npm run bundle && npm run build:style && npm run build:icons",
80
+ "postbuild": "npm run size",
79
81
  "build:lib": "rimraf ./lib && tsc --build --verbose",
80
82
  "postbuild:lib": "replace-in-file --configFile=replace-config.lib.cjs --verbose",
81
83
  "build:commonjs": "rimraf ./dist && tsc --module commonjs --noImplicitUseStrict --outDir dist",
82
84
  "bundle": "rimraf ./bundle && rollup -c",
83
85
  "build:style": "postcss './src/**/*.css' --env production --dir ./lib",
84
- "postbuild:style": "npm run size",
85
86
  "build:icons": "svgo -f ./src/icons -o ./cosmos-static/icons",
86
87
  "size": "size-limit",
87
88
  "test": "jest --coverage",
@@ -146,6 +147,10 @@
146
147
  {
147
148
  "limit": "7 kB",
148
149
  "path": "lib/common.css"
150
+ },
151
+ {
152
+ "limit": "30 kB",
153
+ "path": "bundle/bundle.umd.min.js"
149
154
  }
150
155
  ],
151
156
  "lint-staged": {
@@ -1,4 +1,4 @@
1
- import { context } from './setup-fixture';
1
+ import { context, mobileContext } from './setup-fixture';
2
2
 
3
3
  import { Blocks } from './Blocks';
4
4
  import { BlockDecorator, ContentPage } from './ContentPage';
@@ -39,7 +39,7 @@ export default {
39
39
  mobile: (
40
40
  <ContentPage
41
41
  className="bg-secondary-text"
42
- context={context}
42
+ context={mobileContext}
43
43
  blocksRegistry={MobileBlocks}
44
44
  data={toMobilePage(data as ContentPageDef)}
45
45
  />
@@ -430,7 +430,7 @@
430
430
  "type": "Unknown",
431
431
  "style": ["col-span-12"],
432
432
  "content": {
433
- "title": "Неизвестный блок"
433
+ "title": "Какой то новый блок"
434
434
  }
435
435
  },
436
436
  {
@@ -1,6 +1,7 @@
1
1
  import { context } from './setup-fixture';
2
2
 
3
3
  import { Gallery, GalleryProps } from './Gallery';
4
+ import { Gallery as MobileGallery } from './Gallery.mobile';
4
5
  import { Picture } from './types';
5
6
 
6
7
  const image: Picture = {
@@ -210,4 +211,5 @@ export default {
210
211
  'list and button': <Gallery {...listAndButtonProps} />,
211
212
  'text and no button': <Gallery {...textAndNoButtonProps} />,
212
213
  'only title': <Gallery {...onlyTitleProps} />,
214
+ mobile: <MobileGallery {...defaultProps} />,
213
215
  };
@@ -0,0 +1,70 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { GalleryCard, GalleryProps } from './Gallery';
3
+ import { Img } from './Img';
4
+ import { BlockItem } from './ui-kit/BlockItem';
5
+ import { Button } from './ui-kit/Button';
6
+ import { Title } from './ui-kit/Title';
7
+
8
+ export const Gallery = JSX<GalleryProps>(({ title, description, cards = [], className }) => {
9
+ return (
10
+ <section
11
+ className={`relative font-sans text-primary-text bg-white p-4 overflow-hidden ${className}`}
12
+ >
13
+ <div className="flex flex-col items-center mb-8">
14
+ <Title className="font-medium m-0 text-centers">{title}</Title>
15
+ {description ? (
16
+ <div className="font-normal text-base max-w-[600px] mt-3">{description}</div>
17
+ ) : null}
18
+ </div>
19
+ <div className="horizontal-list no-scrollbar" role="list">
20
+ {cards?.map(renderCard)}
21
+ </div>
22
+ </section>
23
+ );
24
+ });
25
+
26
+ function renderCard(card: GalleryCard, key: number) {
27
+ return (
28
+ <div
29
+ className="box-border horizontal-list-item border-solid border rounded-md border-main-divider p-4 mx-1 flex flex-col justify-between items-stretch"
30
+ role="listitem"
31
+ key={key}
32
+ >
33
+ <div>
34
+ {card.image?.src ? (
35
+ <div className="flex justify-center">
36
+ <Img className="mb-6" image={card.image} />
37
+ </div>
38
+ ) : null}
39
+ {card.title ? (
40
+ <h4
41
+ className={`font-medium text-xl m-0 ${
42
+ !card.description && !card.items?.length ? 'text-center' : ''
43
+ }`}
44
+ >
45
+ {card.title}
46
+ </h4>
47
+ ) : null}
48
+ {card.description ? (
49
+ <div className="font-normal text-sm text-secondary-text mt-2">{card.description}</div>
50
+ ) : null}
51
+ {card.items?.length ? renderItems(card.items) : null}
52
+ </div>
53
+ {card.href ? (
54
+ <Button className="mt-6" text="Подробнее" version="secondary" href={card.href} />
55
+ ) : null}
56
+ </div>
57
+ );
58
+ }
59
+
60
+ function renderItems(items: string[] = []) {
61
+ return (
62
+ <section className="max-w-[308px] mt-2" role="list">
63
+ {items.map((item, i) => (
64
+ <BlockItem key={String(i)}>
65
+ <span className="text-sm text-secondary-text">{item}</span>
66
+ </BlockItem>
67
+ ))}
68
+ </section>
69
+ );
70
+ }
@@ -1,9 +1,7 @@
1
1
  import type { Router } from '../ContentPageContext';
2
2
  import type { LinkContent } from '../types';
3
- import { isURL, withoutQuery } from '../utils/url';
3
+ import { isHrefActive } from '../utils/url';
4
4
 
5
- export function isSubItemActive({ href, pathname }: Router) {
6
- return (item: LinkContent): boolean => {
7
- return withoutQuery(item.href) === (isURL(item.href) ? withoutQuery(href) : pathname);
8
- };
5
+ export function isSubItemActive(router: Router) {
6
+ return (subItem: LinkContent): boolean => isHrefActive(subItem.href, router);
9
7
  }
@@ -1,13 +1,8 @@
1
1
  import type { Router } from '../ContentPageContext';
2
2
  import type { LinkContent } from '../types';
3
- import { isURL, withoutQuery } from '../utils/url';
3
+ import { isHrefActive } from '../utils/url';
4
4
 
5
- export function isTopItemActive({ href, pathname }: Router) {
6
- return (item: LinkContent): boolean => {
7
- const itemHref = withoutQuery(item.href);
8
- if (isURL(itemHref)) {
9
- return Boolean(href && href.startsWith(itemHref));
10
- }
11
- return Boolean(itemHref && pathname.startsWith(itemHref));
12
- };
5
+ export function isTopItemActive(router: Router) {
6
+ return (topItem: LinkContent): boolean =>
7
+ isHrefActive(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
13
8
  }
@@ -1,13 +1,11 @@
1
- import { BenefitsBlock } from './BenefitsBlock';
2
1
  import { ExchangeRateTile } from './ExchangeRateTile';
3
2
  import { Footer } from './Footer/Footer.mobile';
3
+ import { Gallery } from './Gallery.mobile';
4
4
  import { Header } from './Header/index';
5
5
  import { MobileAppTile } from './MobileAppTile';
6
6
  import { Placeholder } from './Placeholder';
7
- import { ProductBlock } from './ProductBlock';
8
- import { ProductGallery } from './ProductGallery';
7
+ import { ProductBlock } from './ProductBlock.mobile';
9
8
  import { ProductTile } from './ProductTile';
10
- import { StepsBlock } from './StepsBlock';
11
9
  import { TextBlock } from './TextBlock';
12
10
  import { Tile } from './Tile';
13
11
 
@@ -18,10 +16,11 @@ export const MobileBlocks = {
18
16
  Tile,
19
17
  ProductTile,
20
18
  ProductBlock,
21
- StepsBlock,
22
19
  TextBlock,
23
- BenefitsBlock,
24
- ProductGallery,
25
20
  ExchangeRateTile,
26
21
  MobileAppTile,
22
+ Gallery,
23
+ // TODO StepsBlock,
24
+ // TODO BenefitsBlock,
25
+ // TODO ProductGallery
27
26
  };
@@ -14,7 +14,7 @@ const GOLDEN_RATIO = 1.618;
14
14
 
15
15
  export const Placeholder = JSX<PlaceholderProps>(({ className, context, title }) => {
16
16
  return (
17
- <Tile className={className} context={context} title={title}>
17
+ <Tile className={className} context={context} title={title} description="Блок в разработке...">
18
18
  <figure className="m-0 min-w-[600px]">{renderShimmer()}</figure>
19
19
  </Tile>
20
20
  );
@@ -0,0 +1,19 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { ProductBlockInnerContent } from './ProductBlockInner';
3
+ import { ProductBlockInner } from './ProductBlockInner';
4
+ import type { UniBlockProps } from './types';
5
+
6
+ export interface ProductBlockProps extends ProductBlockInnerContent, UniBlockProps {}
7
+
8
+ export const ProductBlock = JSX<ProductBlockProps>(
9
+ ({ titleSize, image, benefits, ...props } /* Get rid of image and benefits */) => {
10
+ const { className } = props;
11
+ return (
12
+ <section
13
+ className={`font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`}
14
+ >
15
+ <ProductBlockInner {...props} titleSize="L" />
16
+ </section>
17
+ );
18
+ },
19
+ );
@@ -14,12 +14,16 @@ export interface ProductBlockInnerContent extends BaseTileContent {
14
14
  export interface ProductBlockInnerProps extends ProductBlockInnerContent, UniBlockProps {}
15
15
 
16
16
  export const ProductBlockInner = JSX<ProductBlockInnerProps>(
17
- ({ className, context, title, description, benefits, buttons, image, items }) => {
17
+ ({ className, context, title, titleSize, description, benefits, buttons, image, items }) => {
18
18
  return (
19
19
  <div className={`flex grow justify-between items-stretch ${className || ''}`}>
20
20
  <div className={'flex flex-col'}>
21
21
  {title && (
22
- <Title size="XL" className="font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]">
22
+ /* TODO Why <Title> is duplicated here? */
23
+ <Title
24
+ size={titleSize || 'XL'}
25
+ className="font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]"
26
+ >
23
27
  {title}
24
28
  </Title>
25
29
  )}
package/src/common.css CHANGED
@@ -36,4 +36,30 @@
36
36
  .-translate-x-full {
37
37
  transform: translateX(-100%);
38
38
  }
39
+
40
+ /* Chrome, Safari and Opera */
41
+ .no-scrollbar::-webkit-scrollbar {
42
+ display: none;
43
+ }
44
+
45
+ .no-scrollbar {
46
+ -ms-overflow-style: none; /* IE and Edge */
47
+ scrollbar-width: none; /* Firefox */
48
+ }
49
+
50
+ .horizontal-list {
51
+ display: flex;
52
+ overflow-x: scroll;
53
+ overscroll-behavior: contain;
54
+ -webkit-overflow-scrolling: touch;
55
+ touch-action: pan-x;
56
+ scroll-snap-type: x mandatory;
57
+ }
58
+
59
+ .horizontal-list-item {
60
+ flex-shrink: 0;
61
+ scroll-snap-align: start;
62
+ scroll-snap-stop: always;
63
+ width: 100%;
64
+ }
39
65
  }
package/src/index.ts CHANGED
@@ -4,6 +4,8 @@ export { projectSettings } from './ProjectSettings';
4
4
  export { LikeAPI } from './api/LikeAPI';
5
5
  export { DaDataAPI } from './api/DaDataAPI';
6
6
 
7
+ export type { HeaderContent as SitemapContent } from './Header';
8
+
7
9
  export type {
8
10
  BlockDef,
9
11
  UniBlockProps,
@@ -24,6 +26,7 @@ export type {
24
26
  } from './ContentPageContext';
25
27
 
26
28
  export { ContentPageHead } from './ContentPageHead';
29
+ export type { BlockDecorator } from './ContentPage';
27
30
  export { ContentPage } from './ContentPage';
28
31
  export { toMobilePage } from './toMobilePage';
29
32
 
@@ -70,3 +70,15 @@ export const context: ContentPageContext = {
70
70
  };
71
71
  },
72
72
  };
73
+
74
+ export const mobileContext: ContentPageContext = {
75
+ ...context,
76
+ useRouter: () => ({
77
+ href: `${TEST_ORIGIN}/mobile/credits`,
78
+ pathname: '/mobile/credits',
79
+ query: {},
80
+ push: (url: string) => {
81
+ console.log(url);
82
+ },
83
+ }),
84
+ };
package/src/useLink.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { HandlerDecorator, Router } from './ContentPageContext';
2
2
  import type { LinkContent } from './types';
3
- import { isURL, toRelativeHref } from './utils/url';
3
+ import { adjustHref, isURL } from './utils/url';
4
4
 
5
5
  const defaultHandlerDecorator: HandlerDecorator = (handler, targetContent) => handler;
6
6
 
@@ -11,7 +11,7 @@ export function useLink(
11
11
  }: { router: Router; handlerDecorator?: HandlerDecorator },
12
12
  link: Partial<LinkContent>,
13
13
  ) {
14
- const href = toRelativeHref(link.href, router.href);
14
+ const href = adjustHref(link.href, router);
15
15
  return {
16
16
  ...link,
17
17
  href,
@@ -0,0 +1,53 @@
1
+ import { adjustHref, getOrigin, toRelativeHref, withoutQuery } from './url';
2
+
3
+ describe('url', () => {
4
+ describe('withoutQuery', () => {
5
+ it('should return URL without query params', () => {
6
+ expect(withoutQuery('http://foo.ru/other/path?first=1&second=2')).toBe(
7
+ 'http://foo.ru/other/path',
8
+ );
9
+ });
10
+ });
11
+
12
+ describe('getOrigin', () => {
13
+ it('should return origin of specified URL', () => {
14
+ expect(getOrigin('http://foo.ru/other/path?first=1&second=2')).toBe('http://foo.ru');
15
+ });
16
+ });
17
+
18
+ describe('adjustHref', () => {
19
+ it('should compute URL relative to some base URL', () => {
20
+ expect(
21
+ adjustHref('http://foo.ru/other/path', {
22
+ pathname: '/some/path',
23
+ href: 'http://foo.ru/some/path',
24
+ }),
25
+ ).toBe('/other/path');
26
+ });
27
+
28
+ it('should compute mobile URL for mobile pages', () => {
29
+ expect(
30
+ adjustHref('http://foo.ru/other/path', {
31
+ pathname: '/mobile/some/path',
32
+ href: 'http://foo.ru/mobile/some/path',
33
+ }),
34
+ ).toBe('/mobile/other/path');
35
+ });
36
+
37
+ it('should return nothing if nothing provided', () => {
38
+ expect(adjustHref(undefined, { pathname: '/mobile/some/path' })).toBe(undefined);
39
+ });
40
+ });
41
+
42
+ describe('toRelativeHref', () => {
43
+ it('should compute URL relative to some base URL', () => {
44
+ expect(toRelativeHref('http://foo.ru/other/path', { href: 'http://foo.ru/some/path' })).toBe(
45
+ '/other/path',
46
+ );
47
+ });
48
+
49
+ it('should return nothing if nothing provided', () => {
50
+ expect(toRelativeHref(undefined, {})).toBe(undefined);
51
+ });
52
+ });
53
+ });
package/src/utils/url.ts CHANGED
@@ -1,22 +1,52 @@
1
+ export const MOBILE_URL_PATH = '/mobile';
2
+
1
3
  export const isURL = (href?: string) => href?.includes('//');
2
4
 
5
+ export const isHrefActive = (
6
+ href: string | undefined,
7
+ router: { pathname?: string; href?: string },
8
+ cmp: (href: string, baseHref: string) => boolean = (href, baseHref) => href === baseHref,
9
+ ) => {
10
+ return cmp(
11
+ withoutQuery(href),
12
+ withoutMobilePath(withoutQuery(isURL(href) ? router.href : router.pathname)),
13
+ );
14
+ };
15
+
3
16
  export const withoutQuery = (href?: string) => (href || '').replace(/\/?\?.*/, '');
4
17
 
18
+ export const withoutMobilePath = (href?: string) => (href || '').replace(MOBILE_URL_PATH, '');
19
+
5
20
  export const getOrigin = (href?: string) => {
6
- if (isURL(href)) {
7
- const url = href!;
8
- const protoSeparator = '://';
9
- const endOfProto = url.indexOf(protoSeparator);
10
- const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
11
- return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
21
+ if (!isURL(href)) {
22
+ return undefined;
23
+ }
24
+
25
+ const url = href!;
26
+ const protoSeparator = '//';
27
+ const endOfProto = url.indexOf(protoSeparator);
28
+ const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
29
+ return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
30
+ };
31
+
32
+ export const adjustHref = (
33
+ href: string | undefined,
34
+ router: { pathname: string; href?: string },
35
+ ) => {
36
+ if (!href) {
37
+ return href;
12
38
  }
13
- return undefined;
39
+
40
+ const relativeHref = toRelativeHref(href, router)!;
41
+ const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
42
+ return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
14
43
  };
15
44
 
16
- export const toRelativeHref = (href?: string, baseURL?: string) => {
45
+ export const toRelativeHref = (href: string | undefined, router: { href?: string }) => {
17
46
  if (!href) {
18
47
  return href;
19
48
  }
20
- const origin = getOrigin(baseURL);
49
+
50
+ const origin = getOrigin(router?.href);
21
51
  return origin ? href.replace(origin, '') || '/' : href;
22
52
  };