Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Nav menu internals (#2153)
Ivan Starkov61acb2395cc8
diff --git a/packages/icons/icons/navigation-menu.svg b/packages/icons/icons/navigation-menu.svgindex c81f793d4c..782bfac613 100644--- a/packages/icons/icons/navigation-menu.svg+++ b/packages/icons/icons/navigation-menu.svg@@ -1,3 +1,4 @@-<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">-<path fill-rule="evenodd" clip-rule="evenodd" d="M7.6559 0.906997C7.88124 0.845983 8.11876 0.845983 8.34411 0.906997C8.60553 0.977779 8.82581 1.15066 9.00433 1.29077C9.02124 1.30405 9.03777 1.31702 9.05393 1.32959L13.5755 4.84634C13.5927 4.85974 13.6098 4.87299 13.6267 4.88614C13.8784 5.0815 14.0978 5.25178 14.2612 5.47272C14.4047 5.66668 14.5116 5.88518 14.5766 6.1175C14.6507 6.38213 14.6504 6.65986 14.65 6.97851C14.65 6.99994 14.65 7.02156 14.65 7.04337V11.8918C14.65 12.2437 14.65 12.5463 14.6297 12.7953C14.6082 13.0579 14.561 13.3176 14.4338 13.5671C14.2437 13.9403 13.9403 14.2437 13.5671 14.4338C13.3176 14.561 13.0579 14.6082 12.7953 14.6297C12.5463 14.65 12.2437 14.65 11.8918 14.65L10.5181 14.65C10.4385 14.65 10.3443 14.6501 10.2615 14.6433C10.1657 14.6355 10.0295 14.6155 9.88691 14.5428C9.70189 14.4485 9.55146 14.2981 9.45718 14.1131C9.38454 13.9705 9.36453 13.8343 9.3567 13.7385C9.34994 13.6557 9.34997 13.5615 9.35 13.4819L9.35 9.06666C9.35 8.86925 9.3495 8.76029 9.34308 8.68173C9.34236 8.67294 9.34162 8.66543 9.34091 8.65909C9.33457 8.65838 9.32706 8.65764 9.31827 8.65692C9.23971 8.6505 9.13075 8.64999 8.93334 8.64999H7.06667C6.86926 8.64999 6.76029 8.6505 6.68174 8.65692C6.67294 8.65764 6.66544 8.65838 6.6591 8.65909C6.65839 8.66543 6.65765 8.67294 6.65693 8.68173C6.65051 8.76029 6.65 8.86925 6.65 9.06666L6.65001 13.4819C6.65004 13.5615 6.65007 13.6557 6.6433 13.7385C6.63548 13.8343 6.61546 13.9705 6.54283 14.1131C6.44855 14.2981 6.29812 14.4485 6.11309 14.5428C5.97054 14.6155 5.83431 14.6355 5.73853 14.6433C5.6557 14.6501 5.56152 14.65 5.48193 14.65L4.10816 14.65C3.75628 14.65 3.4537 14.65 3.20467 14.6297C2.94214 14.6082 2.68243 14.561 2.43292 14.4338C2.05973 14.2437 1.75632 13.9403 1.56617 13.5671C1.43904 13.3176 1.39178 13.0579 1.37033 12.7953C1.34998 12.5463 1.34999 12.2437 1.35 11.8918L1.35 7.04337C1.35 7.02156 1.34998 6.99994 1.34996 6.9785C1.34963 6.65986 1.34934 6.38213 1.42341 6.1175C1.48844 5.88518 1.59531 5.66668 1.73876 5.47272C1.90218 5.25178 2.12158 5.0815 2.3733 4.88613C2.39024 4.87299 2.40732 4.85974 2.42453 4.84634L6.94607 1.32959C6.96223 1.31702 6.97877 1.30405 6.99568 1.29077C7.1742 1.15066 7.39448 0.977779 7.6559 0.906997ZM8 2.16464C8.00399 2.16716 8.00869 2.1702 8.01413 2.17383C8.06485 2.20772 8.13139 2.25898 8.25581 2.35575L12.7773 5.8725C13.1087 6.13018 13.1727 6.18717 13.2161 6.24576C13.2655 6.31259 13.3023 6.38787 13.3247 6.46791C13.3444 6.5381 13.35 6.62366 13.35 7.04337V11.8667C13.35 12.2508 13.3495 12.4997 13.334 12.6895C13.3191 12.8716 13.2937 12.9412 13.2755 12.9769C13.21 13.1055 13.1055 13.21 12.9769 13.2755C12.9412 13.2937 12.8716 13.3191 12.6895 13.334C12.4997 13.3495 12.2508 13.35 11.8667 13.35H10.65L10.65 9.04575C10.65 8.87717 10.65 8.71394 10.6388 8.57587C10.6264 8.4245 10.5973 8.24712 10.5065 8.06891C10.3803 7.82116 10.1788 7.61974 9.93109 7.4935C9.75288 7.4027 9.5755 7.3736 9.42413 7.36124C9.28606 7.34996 9.12282 7.34997 8.95425 7.34999H7.04575C6.87718 7.34997 6.71395 7.34996 6.57587 7.36124C6.42451 7.3736 6.24712 7.4027 6.06892 7.4935C5.82117 7.61974 5.61974 7.82116 5.49351 8.06891C5.40271 8.24712 5.37361 8.4245 5.36124 8.57587C5.34996 8.71394 5.34998 8.87717 5.35 9.04574L5.35 13.35H4.13334C3.74924 13.35 3.50026 13.3495 3.31054 13.334C3.1284 13.3191 3.05881 13.2937 3.02311 13.2755C2.89453 13.21 2.79 13.1055 2.72448 12.9769C2.70629 12.9412 2.68089 12.8716 2.66601 12.6895C2.65051 12.4997 2.65 12.2508 2.65 11.8667V7.04337C2.65 6.62366 2.65565 6.5381 2.6753 6.46791C2.6977 6.38787 2.73452 6.31259 2.78395 6.24576C2.82729 6.18717 2.89135 6.13018 3.22266 5.8725L7.74419 2.35575C7.86861 2.25898 7.93516 2.20772 7.98588 2.17383C7.99132 2.1702 7.99601 2.16716 8 2.16464Z" />+<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">+<path d="M10.8269 1.3501H5.17301C4.63586 1.35009 4.19353 1.35008 3.83343 1.37951C3.45973 1.41004 3.11769 1.47547 2.79688 1.63893C2.29825 1.893 1.89285 2.29839 1.63879 2.79702C1.45773 3.15237 1.39629 3.53566 1.37035 3.96048C1.35942 4.13942 1.42289 4.31492 1.54572 4.44549C1.66856 4.57606 1.83987 4.6501 2.01914 4.6501H13.9808C14.16 4.6501 14.3313 4.57606 14.4542 4.44549C14.577 4.31492 14.6405 4.13942 14.6296 3.96048C14.6036 3.53566 14.5422 3.15237 14.3611 2.79702C14.1071 2.29839 13.7017 1.893 13.203 1.63893C12.8822 1.47547 12.5402 1.41004 12.1665 1.37951C11.8064 1.35008 11.364 1.35009 10.8269 1.3501Z"/>+<path d="M1.99998 6.02002C2.35896 6.02002 2.64998 6.31103 2.64998 6.67002V10.8001C2.64998 11.3709 2.65048 11.7599 2.67507 12.0608C2.69903 12.3541 2.74259 12.506 2.79712 12.613C2.92655 12.867 3.13307 13.0735 3.38709 13.203C3.4941 13.2575 3.646 13.301 3.93931 13.325C4.24021 13.3496 4.6292 13.3501 5.19998 13.3501H10.8C11.3708 13.3501 11.7597 13.3496 12.0606 13.325C12.3539 13.301 12.5059 13.2575 12.6129 13.203C12.8669 13.0735 13.0734 12.867 13.2028 12.613C13.2574 12.506 13.3009 12.3541 13.3249 12.0608C13.3495 11.7599 13.35 11.3709 13.35 10.8001V6.6701C13.35 6.31111 13.641 6.0201 14 6.0201C14.359 6.0201 14.65 6.31111 14.65 6.6701V10.827C14.65 11.3642 14.65 11.8065 14.6206 12.1666C14.59 12.5403 14.5246 12.8824 14.3611 13.2032C14.1071 13.7018 13.7017 14.1072 13.2031 14.3613C12.8822 14.5247 12.5402 14.5902 12.1665 14.6207C11.8064 14.6501 11.3641 14.6501 10.8269 14.6501H5.17304C4.63588 14.6501 4.19356 14.6501 3.83345 14.6207C3.45975 14.5902 3.11772 14.5247 2.7969 14.3613C2.29827 14.1072 1.89287 13.7018 1.63881 13.2032C1.47535 12.8824 1.40992 12.5403 1.37938 12.1666C1.34996 11.8065 1.34997 11.3642 1.34998 10.827V6.67002C1.34998 6.31103 1.64099 6.02002 1.99998 6.02002Z" /></svg>diff --git a/packages/icons/icons/viewport.svg b/packages/icons/icons/viewport.svgnew file mode 100644index 0000000000..2fbbc97f81--- /dev/null+++ b/packages/icons/icons/viewport.svg@@ -0,0 +1,4 @@+<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">+<path fill-rule="evenodd" clip-rule="evenodd" d="M5.17304 1.35001L5.32998 1.35001C5.68896 1.35001 5.97998 1.64102 5.97998 2.00001C5.97998 2.35899 5.68896 2.65001 5.32998 2.65001H5.19998C4.6292 2.65001 4.24021 2.65051 3.93931 2.6751C3.646 2.69906 3.4941 2.74262 3.38709 2.79715C3.13307 2.92658 2.92655 3.1331 2.79712 3.38712C2.74259 3.49413 2.69903 3.64603 2.67507 3.93934C2.65048 4.24024 2.64998 4.62923 2.64998 5.20001V5.33001C2.64998 5.68899 2.35896 5.98001 1.99998 5.98001C1.64099 5.98001 1.34998 5.68899 1.34998 5.33001L1.34998 5.17307C1.34997 4.63591 1.34996 4.19359 1.37938 3.83348C1.40992 3.45978 1.47534 3.11775 1.63881 2.79693C1.89287 2.2983 2.29827 1.8929 2.7969 1.63884C3.11772 1.47538 3.45975 1.40995 3.83345 1.37941C4.19356 1.34999 4.63588 1.35 5.17304 1.35001ZM12.0606 2.6751C11.7597 2.65051 11.3708 2.65001 10.8 2.65001H10.67C10.311 2.65001 10.02 2.35899 10.02 2.00001C10.02 1.64102 10.311 1.35001 10.67 1.35001L10.8269 1.35001C11.3641 1.35 11.8064 1.34999 12.1665 1.37941C12.5402 1.40995 12.8822 1.47538 13.2031 1.63884C13.7017 1.8929 14.1071 2.2983 14.3611 2.79693C14.5246 3.11775 14.59 3.45978 14.6206 3.83348C14.65 4.19359 14.65 4.63591 14.65 5.17307V5.33001C14.65 5.68899 14.359 5.98001 14 5.98001C13.641 5.98001 13.35 5.68899 13.35 5.33001V5.20001C13.35 4.62923 13.3495 4.24024 13.3249 3.93934C13.3009 3.64603 13.2574 3.49413 13.2028 3.38712C13.0734 3.1331 12.8669 2.92658 12.6129 2.79715C12.5059 2.74262 12.3539 2.69906 12.0606 2.6751ZM1.99998 10.02C2.35896 10.02 2.64998 10.311 2.64998 10.67V10.8C2.64998 11.3708 2.65048 11.7598 2.67507 12.0607C2.69903 12.354 2.74259 12.5059 2.79712 12.6129C2.92655 12.8669 3.13307 13.0734 3.38709 13.2029C3.4941 13.2574 3.646 13.301 3.93931 13.3249C4.24021 13.3495 4.6292 13.35 5.19998 13.35H5.32998C5.68896 13.35 5.97998 13.641 5.97998 14C5.97998 14.359 5.68896 14.65 5.32998 14.65H5.17304C4.63588 14.65 4.19356 14.65 3.83345 14.6206C3.45975 14.5901 3.11772 14.5246 2.7969 14.3612C2.29827 14.1071 1.89287 13.7017 1.63881 13.2031C1.47534 12.8823 1.40992 12.5402 1.37938 12.1665C1.34996 11.8064 1.34997 11.3641 1.34998 10.8269L1.34998 10.67C1.34998 10.311 1.64099 10.02 1.99998 10.02ZM14 10.02C14.359 10.02 14.65 10.311 14.65 10.67V10.8269C14.65 11.3641 14.65 11.8064 14.6206 12.1665C14.59 12.5402 14.5246 12.8823 14.3611 13.2031C14.1071 13.7017 13.7017 14.1071 13.2031 14.3612C12.8822 14.5246 12.5402 14.5901 12.1665 14.6206C11.8064 14.65 11.3641 14.65 10.8269 14.65H10.67C10.311 14.65 10.02 14.359 10.02 14C10.02 13.641 10.311 13.35 10.67 13.35H10.8C11.3708 13.35 11.7597 13.3495 12.0606 13.3249C12.3539 13.301 12.5059 13.2574 12.6129 13.2029C12.8669 13.0734 13.0734 12.8669 13.2028 12.6129C13.2574 12.5059 13.3009 12.354 13.3249 12.0607C13.3495 11.7598 13.35 11.3708 13.35 10.8V10.67C13.35 10.311 13.641 10.02 14 10.02Z" />+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.99998 10.0334C9.12294 10.0334 10.0333 9.12304 10.0333 8.00007C10.0333 6.8771 9.12294 5.96675 7.99998 5.96675C6.87701 5.96675 5.96666 6.8771 5.96666 8.00007C5.96666 9.12304 6.87701 10.0334 7.99998 10.0334ZM7.99998 11.3334C9.84091 11.3334 11.3333 9.84101 11.3333 8.00007C11.3333 6.15913 9.84091 4.66675 7.99998 4.66675C6.15904 4.66675 4.66666 6.15913 4.66666 8.00007C4.66666 9.84101 6.15904 11.3334 7.99998 11.3334Z" />+</svg>diff --git a/packages/icons/src/__generated__/index.ts b/packages/icons/src/__generated__/index.tsindex 13c6448f41..c3e5198f8b 100644--- a/packages/icons/src/__generated__/index.ts+++ b/packages/icons/src/__generated__/index.ts@@ -145,6 +145,7 @@ export * from "./text";export * from "./tooltip";export * from "./trigger";export * from "./video";+export * from "./viewport";export * from "./vimeo";export * from "./webstudio";export * from "./wrap";diff --git a/packages/icons/src/__generated__/navigation-menu.tsx b/packages/icons/src/__generated__/navigation-menu.tsxindex 57f9d40f11..12e4307b25 100644--- a/packages/icons/src/__generated__/navigation-menu.tsx+++ b/packages/icons/src/__generated__/navigation-menu.tsx@@ -7,7 +7,7 @@ import type { IconProps } from "../types";export const NavigationMenuIcon = forwardRef<SVGSVGElement, IconProps>(({ color = "currentColor", size = 16, ...props }, forwardedRef) => {return (- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M7.656.907c.225-.061.463-.061.688 0 .262.07.482.244.66.384l.05.039 4.521 3.516.052.04c.251.196.47.366.634.587.144.194.25.412.316.644.074.265.073.543.073.862v4.913c0 .352 0 .654-.02.903a2.02 2.02 0 0 1-.196.772c-.19.373-.494.677-.867.867a2.02 2.02 0 0 1-.772.196c-.249.02-.551.02-.903.02h-1.374c-.08 0-.174 0-.257-.007a.987.987 0 0 1-.374-.1.984.984 0 0 1-.43-.43.989.989 0 0 1-.1-.374 3.277 3.277 0 0 1-.007-.257V9.067a5.468 5.468 0 0 0-.01-.408 5.466 5.466 0 0 0-.408-.01H7.068a5.466 5.466 0 0 0-.408.01 5.466 5.466 0 0 0-.01.408l.001 4.415c0 .08 0 .174-.007.257a.989.989 0 0 1-.1.374.984.984 0 0 1-.43.43.987.987 0 0 1-.374.1c-.083.007-.177.007-.257.007H4.108c-.352 0-.654 0-.903-.02a2.02 2.02 0 0 1-.772-.196 1.983 1.983 0 0 1-.867-.867 2.02 2.02 0 0 1-.196-.772c-.02-.249-.02-.551-.02-.903V6.979c0-.32 0-.597.073-.862.065-.232.172-.45.316-.644.163-.221.383-.391.634-.587l.052-.04L6.946 1.33l.05-.04c.178-.14.398-.312.66-.383ZM8 2.165a4.861 4.861 0 0 1 .256.191l4.521 3.516c.332.258.396.315.44.374.048.067.085.142.108.222.02.07.025.156.025.575v4.824c0 .384 0 .633-.016.822-.015.183-.04.252-.059.288a.683.683 0 0 1-.298.298c-.036.019-.105.044-.287.059-.19.016-.44.016-.823.016H10.65V9.046c0-.169 0-.332-.011-.47a1.332 1.332 0 0 0-.132-.507 1.317 1.317 0 0 0-.576-.576 1.331 1.331 0 0 0-.507-.132 6.11 6.11 0 0 0-.47-.011H7.046c-.169 0-.332 0-.47.011a1.331 1.331 0 0 0-.507.133c-.248.126-.45.327-.575.575-.091.178-.12.355-.133.507-.011.138-.011.301-.011.47v4.304H4.133c-.384 0-.633 0-.822-.016-.183-.015-.252-.04-.288-.059a.683.683 0 0 1-.299-.298c-.018-.036-.043-.105-.058-.287-.015-.19-.016-.44-.016-.823V7.043c0-.42.006-.505.025-.575a.683.683 0 0 1 .109-.222c.043-.059.107-.116.439-.374l4.521-3.516A4.86 4.86 0 0 1 8 2.165Z" clipRule="evenodd" /></svg>+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path d="M10.827 1.35H5.173c-.537 0-.98 0-1.34.03-.373.03-.715.095-1.036.259a2.65 2.65 0 0 0-1.158 1.158c-.181.355-.243.739-.269 1.163a.65.65 0 0 0 .65.69h11.96a.65.65 0 0 0 .65-.69c-.026-.424-.088-.808-.269-1.163a2.65 2.65 0 0 0-1.158-1.158c-.32-.164-.663-.229-1.037-.26-.36-.029-.802-.029-1.34-.029ZM2 6.02a.65.65 0 0 1 .65.65v4.13c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.055.259.098.552.122.301.025.69.025 1.261.025h5.6c.57 0 .96 0 1.26-.025.294-.024.446-.067.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.26V6.67a.65.65 0 1 1 1.3 0v4.156c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.03-.802.03-1.34.03H5.174c-.537 0-.98 0-1.34-.03-.373-.03-.715-.096-1.036-.26a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.036-.029-.36-.029-.803-.029-1.34V6.67A.65.65 0 0 1 2 6.02Z" /></svg>);});diff --git a/packages/icons/src/__generated__/svg/index.ts b/packages/icons/src/__generated__/svg/index.tsindex 9f0c5324a6..6c0d4e0023 100644--- a/packages/icons/src/__generated__/svg/index.ts+++ b/packages/icons/src/__generated__/svg/index.ts@@ -145,6 +145,7 @@ export { TextIcon } from "./text";export { TooltipIcon } from "./tooltip";export { TriggerIcon } from "./trigger";export { VideoIcon } from "./video";+export { ViewportIcon } from "./viewport";export { VimeoIcon } from "./vimeo";export { WebstudioIcon } from "./webstudio";export { WrapIcon } from "./wrap";diff --git a/packages/icons/src/__generated__/svg/navigation-menu.ts b/packages/icons/src/__generated__/svg/navigation-menu.tsindex ffc11c34f9..3c07c80709 100644--- a/packages/icons/src/__generated__/svg/navigation-menu.ts+++ b/packages/icons/src/__generated__/svg/navigation-menu.ts@@ -1 +1 @@-export const NavigationMenuIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path fill-rule="evenodd" d="M7.656.907c.225-.061.463-.061.688 0 .262.07.482.244.66.384l.05.039 4.521 3.516.052.04c.251.196.47.366.634.587.144.194.25.412.316.644.074.265.073.543.073.862v4.913c0 .352 0 .654-.02.903a2.02 2.02 0 0 1-.196.772c-.19.373-.494.677-.867.867a2.02 2.02 0 0 1-.772.196c-.249.02-.551.02-.903.02h-1.374c-.08 0-.174 0-.257-.007a.987.987 0 0 1-.374-.1.984.984 0 0 1-.43-.43.989.989 0 0 1-.1-.374 3.277 3.277 0 0 1-.007-.257V9.067a5.468 5.468 0 0 0-.01-.408 5.466 5.466 0 0 0-.408-.01H7.068a5.466 5.466 0 0 0-.408.01 5.466 5.466 0 0 0-.01.408l.001 4.415c0 .08 0 .174-.007.257a.989.989 0 0 1-.1.374.984.984 0 0 1-.43.43.987.987 0 0 1-.374.1c-.083.007-.177.007-.257.007H4.108c-.352 0-.654 0-.903-.02a2.02 2.02 0 0 1-.772-.196 1.983 1.983 0 0 1-.867-.867 2.02 2.02 0 0 1-.196-.772c-.02-.249-.02-.551-.02-.903V6.979c0-.32 0-.597.073-.862.065-.232.172-.45.316-.644.163-.221.383-.391.634-.587l.052-.04L6.946 1.33l.05-.04c.178-.14.398-.312.66-.383ZM8 2.165a4.861 4.861 0 0 1 .256.191l4.521 3.516c.332.258.396.315.44.374.048.067.085.142.108.222.02.07.025.156.025.575v4.824c0 .384 0 .633-.016.822-.015.183-.04.252-.059.288a.683.683 0 0 1-.298.298c-.036.019-.105.044-.287.059-.19.016-.44.016-.823.016H10.65V9.046c0-.169 0-.332-.011-.47a1.332 1.332 0 0 0-.132-.507 1.317 1.317 0 0 0-.576-.576 1.331 1.331 0 0 0-.507-.132 6.11 6.11 0 0 0-.47-.011H7.046c-.169 0-.332 0-.47.011a1.331 1.331 0 0 0-.507.133c-.248.126-.45.327-.575.575-.091.178-.12.355-.133.507-.011.138-.011.301-.011.47v4.304H4.133c-.384 0-.633 0-.822-.016-.183-.015-.252-.04-.288-.059a.683.683 0 0 1-.299-.298c-.018-.036-.043-.105-.058-.287-.015-.19-.016-.44-.016-.823V7.043c0-.42.006-.505.025-.575a.683.683 0 0 1 .109-.222c.043-.059.107-.116.439-.374l4.521-3.516A4.86 4.86 0 0 1 8 2.165Z" clip-rule="evenodd"/></svg>`;+export const NavigationMenuIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path d="M10.827 1.35H5.173c-.537 0-.98 0-1.34.03-.373.03-.715.095-1.036.259a2.65 2.65 0 0 0-1.158 1.158c-.181.355-.243.739-.269 1.163a.65.65 0 0 0 .65.69h11.96a.65.65 0 0 0 .65-.69c-.026-.424-.088-.808-.269-1.163a2.65 2.65 0 0 0-1.158-1.158c-.32-.164-.663-.229-1.037-.26-.36-.029-.802-.029-1.34-.029ZM2 6.02a.65.65 0 0 1 .65.65v4.13c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.055.259.098.552.122.301.025.69.025 1.261.025h5.6c.57 0 .96 0 1.26-.025.294-.024.446-.067.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.26V6.67a.65.65 0 1 1 1.3 0v4.156c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.03-.802.03-1.34.03H5.174c-.537 0-.98 0-1.34-.03-.373-.03-.715-.096-1.036-.26a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.036-.029-.36-.029-.803-.029-1.34V6.67A.65.65 0 0 1 2 6.02Z"/></svg>`;diff --git a/packages/icons/src/__generated__/svg/viewport.ts b/packages/icons/src/__generated__/svg/viewport.tsnew file mode 100644index 0000000000..a9701965c1--- /dev/null+++ b/packages/icons/src/__generated__/svg/viewport.ts@@ -0,0 +1 @@+export const ViewportIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="100%" height="100%" style="display: block;"><path fill-rule="evenodd" d="M5.173 1.35h.157a.65.65 0 0 1 0 1.3H5.2c-.57 0-.96 0-1.26.025-.294.024-.446.068-.553.122a1.35 1.35 0 0 0-.59.59c-.054.107-.098.259-.122.552-.025.301-.025.69-.025 1.261v.13a.65.65 0 0 1-1.3 0v-.157c0-.537 0-.98.03-1.34.03-.373.095-.715.259-1.036a2.65 2.65 0 0 1 1.158-1.158c.32-.164.663-.229 1.036-.26.36-.029.803-.029 1.34-.029Zm6.888 1.325c-.301-.024-.69-.025-1.261-.025h-.13a.65.65 0 1 1 0-1.3h.157c.537 0 .98 0 1.34.03.373.03.715.095 1.036.259.499.254.904.66 1.158 1.158.164.32.229.663.26 1.036.029.36.029.803.029 1.34v.157a.65.65 0 1 1-1.3 0V5.2c0-.57 0-.96-.025-1.26-.024-.294-.068-.446-.122-.553a1.35 1.35 0 0 0-.59-.59c-.107-.054-.26-.098-.552-.122ZM2 10.02a.65.65 0 0 1 .65.65v.13c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.054.259.098.552.122.301.025.69.025 1.261.025h.13a.65.65 0 1 1 0 1.3h-.157c-.537 0-.98 0-1.34-.03-.373-.03-.715-.095-1.036-.259a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.037-.029-.36-.029-.802-.029-1.34v-.156a.65.65 0 0 1 .65-.65Zm12 0a.65.65 0 0 1 .65.65v.157c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.029-.802.029-1.34.029h-.156a.65.65 0 1 1 0-1.3h.13c.57 0 .96 0 1.26-.025.294-.024.446-.068.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.261v-.13a.65.65 0 0 1 .65-.65ZM8 10.033a2.033 2.033 0 1 0 0-4.066 2.033 2.033 0 0 0 0 4.066Zm0 1.3a3.333 3.333 0 1 0 0-6.666 3.333 3.333 0 0 0 0 6.666Z" clip-rule="evenodd"/></svg>`;diff --git a/packages/icons/src/__generated__/viewport.tsx b/packages/icons/src/__generated__/viewport.tsxnew file mode 100644index 0000000000..40103fcbcf--- /dev/null+++ b/packages/icons/src/__generated__/viewport.tsx@@ -0,0 +1,15 @@+// Generated from icons/viewport.svg++import { forwardRef } from "react";+import type { IconProps } from "../types";++// prettier-ignore+export const ViewportIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M5.173 1.35h.157a.65.65 0 0 1 0 1.3H5.2c-.57 0-.96 0-1.26.025-.294.024-.446.068-.553.122a1.35 1.35 0 0 0-.59.59c-.054.107-.098.259-.122.552-.025.301-.025.69-.025 1.261v.13a.65.65 0 0 1-1.3 0v-.157c0-.537 0-.98.03-1.34.03-.373.095-.715.259-1.036a2.65 2.65 0 0 1 1.158-1.158c.32-.164.663-.229 1.036-.26.36-.029.803-.029 1.34-.029Zm6.888 1.325c-.301-.024-.69-.025-1.261-.025h-.13a.65.65 0 1 1 0-1.3h.157c.537 0 .98 0 1.34.03.373.03.715.095 1.036.259.499.254.904.66 1.158 1.158.164.32.229.663.26 1.036.029.36.029.803.029 1.34v.157a.65.65 0 1 1-1.3 0V5.2c0-.57 0-.96-.025-1.26-.024-.294-.068-.446-.122-.553a1.35 1.35 0 0 0-.59-.59c-.107-.054-.26-.098-.552-.122ZM2 10.02a.65.65 0 0 1 .65.65v.13c0 .57 0 .96.025 1.26.024.294.068.446.122.553.13.254.336.46.59.59.107.054.259.098.552.122.301.025.69.025 1.261.025h.13a.65.65 0 1 1 0 1.3h-.157c-.537 0-.98 0-1.34-.03-.373-.03-.715-.095-1.036-.259a2.65 2.65 0 0 1-1.158-1.158c-.164-.32-.23-.663-.26-1.037-.029-.36-.029-.802-.029-1.34v-.156a.65.65 0 0 1 .65-.65Zm12 0a.65.65 0 0 1 .65.65v.157c0 .537 0 .98-.03 1.34-.03.373-.095.715-.259 1.036a2.65 2.65 0 0 1-1.158 1.158c-.32.164-.663.23-1.037.26-.36.029-.802.029-1.34.029h-.156a.65.65 0 1 1 0-1.3h.13c.57 0 .96 0 1.26-.025.294-.024.446-.068.553-.122.254-.13.46-.336.59-.59.054-.107.098-.259.122-.552.025-.301.025-.69.025-1.261v-.13a.65.65 0 0 1 .65-.65ZM8 10.033a2.033 2.033 0 1 0 0-4.066 2.033 2.033 0 0 0 0 4.066Zm0 1.3a3.333 3.333 0 1 0 0-6.666 3.333 3.333 0 0 0 0 6.666Z" clipRule="evenodd" /></svg>+ );+ }+);++ViewportIcon.displayName = "ViewportIcon";diff --git a/packages/react-sdk/src/embed-template.ts b/packages/react-sdk/src/embed-template.tsindex e6e8c3028b..c308d7232a 100644--- a/packages/react-sdk/src/embed-template.ts+++ b/packages/react-sdk/src/embed-template.ts@@ -248,11 +248,12 @@ const createInstancesFromTemplate = (}}+ const styleSourceIds: string[] = [];+// convert tokens into style sources and stylesif (item.tokens) {const meta = metas.get(item.component);if (meta?.presetTokens) {- const styleSourceIds: string[] = [];for (const name of item.tokens) {const tokenValue = meta.presetTokens[name];if (tokenValue) {@@ -274,10 +275,6 @@ const createInstancesFromTemplate = (}}}- styleSourceSelections.push({- instanceId,- values: styleSourceIds,- });}}@@ -288,10 +285,7 @@ const createInstancesFromTemplate = (type: "local",id: styleSourceId,});- styleSourceSelections.push({- instanceId,- values: [styleSourceId],- });+ styleSourceIds.push(styleSourceId);for (const styleDecl of item.styles) {styles.push({breakpointId: defaultBreakpointId,@@ -303,6 +297,13 @@ const createInstancesFromTemplate = (}}+ if (styleSourceIds.length > 0) {+ styleSourceSelections.push({+ instanceId,+ values: styleSourceIds,+ });+ }+// populate instancesconst instance: Instance = {type: "instance",diff --git a/packages/sdk-components-react-radix/src/button.ws.ts b/packages/sdk-components-react-radix/src/button.ws.tsindex dd867dd0cb..3a9ac940b8 100644--- a/packages/sdk-components-react-radix/src/button.ws.ts+++ b/packages/sdk-components-react-radix/src/button.ws.ts@@ -17,13 +17,16 @@ const presetStyle = {export const template = (props?: {props?: EmbedTemplateInstance["props"];children?: WsComponentMeta["template"];+ tokens?: string[];+ styles?: EmbedTemplateInstance["styles"];}): NonNullable<WsComponentMeta["template"]> => [{type: "instance",component: "Button",- tokens: ["button", "buttonPrimary", "buttonMd"],+ tokens: props?.tokens ?? ["button", "buttonPrimary", "buttonMd"],children: props?.children ?? [{ type: "text", value: "Button" }],props: props?.props,+ styles: props?.styles,},];diff --git a/packages/sdk-components-react-radix/src/navigation-menu.ws.ts b/packages/sdk-components-react-radix/src/navigation-menu.ws.tsindex 7e052dfa03..bb90c6943d 100644--- a/packages/sdk-components-react-radix/src/navigation-menu.ws.ts+++ b/packages/sdk-components-react-radix/src/navigation-menu.ws.ts@@ -1,11 +1,12 @@import {ContentIcon,- HeaderIcon,- HamburgerMenuIcon,- ItemIcon,+ ListIcon,+ ListItemIcon,TriggerIcon,- LinkIcon,- ExternalLinkIcon,+ BoxIcon,+ ChevronDownIcon,+ ViewportIcon,+ NavigationMenuIcon,} from "@webstudio-is/icons/svg";import type {PresetStyle,@@ -33,10 +34,158 @@ const presetStyle = {div,} satisfies PresetStyle<"div">;+const components = [+ {+ title: "Sheet",+ href: "/docs/components/sheet",+ description:+ "Extends the Dialog component to display content that complements the main content of the screen.",+ },+ {+ title: "Navigation Menu",+ href: "/docs/components/navigation-menu",+ description: "A collection of links for navigating websites.",+ },+ {+ title: "Tabs",+ href: "/docs/components/tabs",+ description:+ "A set of layered sections of content—known as tab panels—that are displayed one at a time.",+ },+ {+ title: "Accordion",+ href: "/docs/components/accordion",+ description:+ "A vertically stacked set of interactive headings that each reveal a section of content.",+ },+ {+ title: "Dialog",+ href: "/docs/components/dialog",+ description:+ "A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.",+ },+ {+ title: "Collapsible",+ href: "/docs/components/collapsible",+ description: "An interactive component which expands/collapses a panel.",+ },++ {+ title: "Popover",+ href: "/docs/components/popover",+ description: "Displays rich content in a portal, triggered by a button.",+ },++ {+ title: "Tooltip",+ href: "/docs/components/tooltip",+ description:+ "A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.",+ },++ {+ title: "Button",+ href: "/docs/components/button",+ description: "Displays a button or a component that looks like a button.",+ },+];++const navItem = (+ props: (typeof components)[number]+): NonNullable<WsComponentMeta["template"]> => [+ {+ type: "instance",+ component: "NavigationMenuLink",+ children: [+ {+ type: "instance",+ component: "Link",+ // block select-none space-y-1 rounded-md p-3 leading-none+ // no-underline outline-none transition-colors+ // hover:bg-accent hover:text-accent-foreground+ // focus:bg-accent focus:text-accent-foreground+ styles: [+ tc.text("inherit"),+ tc.flex(),+ tc.flex("col"),+ tc.select("none"),+ tc.gap(1),+ tc.rounded("md"),+ tc.p(3),+ tc.leading("none"),+ tc.noUnderline(),+ tc.outline("none"),+ tc.hover([tc.bg("accent"), tc.text("accentForeground")].flat()),+ tc.focus([tc.bg("accent"), tc.text("accentForeground")].flat()),+ ].flat(),+ props: [+ {+ name: "href",+ type: "string",+ value: `https://ui.shadcn.com${props.href}`,+ },+ ],+ children: [+ {+ type: "instance",+ component: "Text",+ // text-sm font-medium leading-none+ styles: [+ tc.text("sm"),+ tc.font("medium"),+ tc.leading("none"),+ ].flat(),+ children: [+ {+ type: "text",+ value: props.title,+ },+ ],+ },+ {+ type: "instance",+ component: "Paragraph",+ // line-clamp-2 text-sm leading-snug text-muted-foreground+ styles: [+ tc.m(0),+ tc.lineClamp(2),+ tc.text("sm"),+ tc.leading("snug"),+ tc.text("mutedForeground"),+ ].flat(),++ children: [+ {+ type: "text",+ value: props.description,+ },+ ],+ },+ ],+ },+ ],+ },+];++const navItemsList = (props: {+ count: number;+ offset: number;+}): NonNullable<WsComponentMeta["template"]> => [+ {+ type: "instance",+ component: "Box",+ label: "Flex Column",+ styles: [tc.w(64), tc.flex(), tc.gap(4), tc.flex("col")].flat(),+ children: Array.from(Array(props.count), (_, index) =>+ navItem(components[index + props.offset])+ ).flat(),+ },+];+const menuItem = (props: {title: string;- linkPrefix: string;- linkCount: number;+ children: NonNullable<WsComponentMeta["template"]>;+ padding: 0 | 2;}): NonNullable<WsComponentMeta["template"]> => [{type: "instance",@@ -46,7 +195,59 @@ const menuItem = (props: {type: "instance",component: "NavigationMenuTrigger",children: buttonTemplate({- children: [{ type: "text", value: props.title }],+ tokens: ["button", "buttonGhost", "buttonSm"],+ styles: [+ tc.property("--navigation-menu-trigger-icon-transform", "0deg"),+ tc.state(+ [+ tc.property(+ "--navigation-menu-trigger-icon-transform",+ "180deg"+ ),+ ],+ "[data-state=open]"+ ),+ ].flat(),+ children: [+ {+ type: "instance",+ component: "Text",+ children: [{ type: "text", value: props.title }],+ },+ {+ type: "instance",+ component: "Box",+ label: "Icon Container",+ // h-4 w-4 shrink-0 transition-transform duration-200+ styles: [+ tc.ml(1),+ tc.property(+ "rotate",+ "--navigation-menu-trigger-icon-transform"+ ),+ tc.h(4),+ tc.w(4),+ tc.shrink(0),+ tc.transition("all"),+ tc.duration(200),+ ].flat(),+ children: [+ {+ type: "instance",+ component: "HtmlEmbed",+ label: "Chevron Icon",+ props: [+ {+ type: "string",+ name: "code",+ value: ChevronDownIcon,+ },+ ],+ children: [],+ },+ ],+ },+ ],}),},{@@ -58,44 +259,8 @@ const menuItem = (props: {type: "instance",component: "Box",label: "Content Container",- styles: [tc.flex(), tc.gap(4)].flat(),-- children: [- {- type: "instance",- component: "Box",- styles: [tc.bg("border"), tc.p(4)].flat(),- children: [- {- type: "text",- value: "Content",- },- ],- },-- {- type: "instance",- component: "Box",- label: "Content Container",- styles: [tc.flex(), tc.gap(4), tc.flex("col")].flat(),- children: Array.from(Array(props.linkCount), (_, index) => ({- type: "instance",- component: "NavigationMenuLink",- children: [- {- type: "instance",- component: "Link",- children: [- {- type: "text",- value: `${props.linkPrefix} + ${index}`,- },- ],- },- ],- })),- },- ],+ styles: [tc.flex(), tc.gap(4), tc.p(props.padding)].flat(),+ children: props.children,},],},@@ -107,7 +272,7 @@ export const metaNavigationMenu: WsComponentMeta = {category: "radix",order: 2,type: "container",- icon: HamburgerMenuIcon,+ icon: NavigationMenuIcon,presetStyle,presetTokens: {navigationMenu: {@@ -148,14 +313,35 @@ export const metaNavigationMenu: WsComponentMeta = {tokens: ["navigationMenuList"],children: [...menuItem({- title: "Item One",- linkCount: 5,- linkPrefix: "Link to page",+ title: "About",+ padding: 2,+ children: [+ {+ type: "instance",+ component: "Box",+ styles: [+ tc.bg("border"),+ tc.p(4),+ tc.w(48),+ tc.rounded("md"),+ ].flat(),+ children: [+ {+ type: "text",+ value: "",+ },+ ],+ },+ ...navItemsList({ count: 3, offset: 0 }),+ ],}),...menuItem({- title: "Item Two",- linkCount: 3,- linkPrefix: "Link to other page",+ title: "Components",+ padding: 0,+ children: [+ ...navItemsList({ count: 3, offset: 3 }),+ ...navItemsList({ count: 3, offset: 6 }),+ ],}),],},@@ -191,7 +377,7 @@ export const metaNavigationMenuList: WsComponentMeta = {category: "hidden",detachable: false,type: "container",- icon: HeaderIcon,+ icon: ListIcon,requiredAncestors: ["NavigationMenu"],presetStyle,presetTokens: {@@ -216,7 +402,7 @@ export const metaNavigationMenuItem: WsComponentMeta = {category: "hidden",detachable: false,type: "container",- icon: ItemIcon,+ icon: ListItemIcon,requiredAncestors: ["NavigationMenu"],presetStyle,indexWithinAncestor: "NavigationMenu",@@ -260,16 +446,16 @@ export const metaNavigationMenuLink: WsComponentMeta = {detachable: true,type: "container",stylable: false,- icon: LinkIcon,+ icon: BoxIcon,requiredAncestors: ["NavigationMenuContent"],presetStyle,};export const metaNavigationMenuViewport: WsComponentMeta = {category: "hidden",- detachable: false,+ detachable: true,type: "container",- icon: ExternalLinkIcon,+ icon: ViewportIcon,requiredAncestors: ["NavigationMenu"],presetStyle,presetTokens: {diff --git a/packages/sdk-components-react-radix/src/theme/tailwind-classes.ts b/packages/sdk-components-react-radix/src/theme/tailwind-classes.tsindex 9bb11b12aa..3171bad600 100644--- a/packages/sdk-components-react-radix/src/theme/tailwind-classes.ts+++ b/packages/sdk-components-react-radix/src/theme/tailwind-classes.ts@@ -436,6 +436,18 @@ export const list = (return [{ property: "listStyleType", value }];};+export const select = (selectValue: "none"): EmbedTemplateStyleDecl[] => {+ return [+ {+ property: "userSelect",+ value: {+ type: "keyword",+ value: "none",+ },+ },+ ];+};+export const bg = (color: keyof EvaluatedDefaultTheme["colors"],alpha?: number@@ -528,6 +540,10 @@ export const inlineFlex = (): EmbedTemplateStyleDecl[] => {];};+export const block = (): EmbedTemplateStyleDecl[] => {+ return [{ property: "display", value: { type: "keyword", value: "block" } }];+};+const flexDirection = { row: "row", col: "column" } as const;type FlexDirection = keyof typeof flexDirection;@@ -650,6 +666,45 @@ export const gap = (];};+export const lineClamp = (+ lineClampValue: StringEnumToNumeric<keyof EvaluatedDefaultTheme["lineClamp"]>+): EmbedTemplateStyleDecl[] => {+ const key = `${lineClampValue}` as const;+ const valueString = theme("lineClamp")?.[key];++ return [+ {+ property: "overflow",+ value: {+ type: "keyword",+ value: "hidden",+ },+ },+ {+ property: "display",++ value: {+ type: "keyword",+ value: "-webkit-box",+ },+ },+ {+ property: "-webkit-box-orient" as "display",+ value: {+ type: "keyword",+ value: "vertical",+ },+ },+ {+ property: "-webkit-line-clamp" as "display",+ value: {+ type: "keyword",+ value: valueString,+ },+ },+ ];+};+export const leading = (lineHeight:| StringEnumToNumeric<keyof EvaluatedDefaultTheme["lineHeight"]>@@ -740,6 +795,15 @@ export const text = (];};+export const noUnderline = (): EmbedTemplateStyleDecl[] => {+ return [+ {+ property: "textDecorationLine",+ value: { type: "keyword", value: "none" },+ },+ ];+};+export const underline = (): EmbedTemplateStyleDecl[] => {return [{diff --git a/packages/sdk-components-react-radix/src/theme/tailwind-colors.ts b/packages/sdk-components-react-radix/src/theme/tailwind-colors.tsindex bc9dd2eb54..e9e9842676 100644--- a/packages/sdk-components-react-radix/src/theme/tailwind-colors.ts+++ b/packages/sdk-components-react-radix/src/theme/tailwind-colors.ts@@ -11,6 +11,7 @@export const colors = {transparent: "transparent",current: "currentColor",+ inherit: "inherit",popover: "rgb(255, 255, 255)",popoverForeground: "rgb(2, 8, 23)",border: "rgb(226, 232, 240)",