@hazem3500/palette 0.9.115 → 0.9.116

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.
package/README.md CHANGED
@@ -442,6 +442,8 @@ Frame opens on your browser window's own size at **Fit**, and one compact contro
442
442
 
443
443
  `frame: { mode: "iframe" }` adds a simulated viewport, like a browser's device mode. The current URL renders in a same-origin `<iframe>` sized to the chosen width × height, at Fit or 100%, so media queries, `vw`/`vh`, `matchMedia`, resize events and `window.innerWidth` are real. Palette keeps running on your page and reaches into the frame: picking, hover outlines, pins, threads, Design mode (inspector, previews, Undo, Before/After), Tokens previews and keyboard shortcuts all work there, including with focus inside the frame. The page's own Palette, booted inside the frame, sees that Palette framed it and stays inert, so there is only ever one instance. Reviewers turn it on or off with **Simulate real viewport**, a checkbox row at the end of the Frame size menu ("Reloads the page in a frame so breakpoints and popovers match this size. Runs a second copy of the app."). Unchecked, Frame shows the page itself. Palette remembers the choice per project.
444
444
 
445
+ Hosts that store normalized comment paths can supply `frame.resolveUrl(destination, current)`. It receives the comment URL and the live iframe's `Location`; return the real same-origin `URL` for that context, or `null` to cancel. This hook is used only for comment navigation inside the viewport; `navigate` continues to own outer-page SPA navigation. Preserve any query/hash the host needs. Palette consumes its own `comment`/`comment-view` parameters before assigning the resolved URL. Exceptions, cancellation and cross-origin results retain the conversation without navigating. Stored page identities and anchors are unchanged.
446
+
445
447
  - **Opt-in.** The frame runs a second live copy of your app, with its own requests, sockets, analytics and auth refreshes, so the default stays `"transform"` (the page itself). Turn it on once your app is safe to run twice. With `defaultMode: "transform"`, Frame opens on the page itself and offers the simulated viewport, and a reviewer's own choice is remembered over the default. Without `mode: "iframe"` (an `iframeUrl` alone included) Frame never creates the iframe and the row doesn't appear; a choice remembered earlier is kept, unused, and applies again if you turn the mode back on.
446
448
  - **`iframeUrl(location)`** picks the URL to frame, e.g. a preview route for an app that needs its own bootstrap. It must be same-origin. If it changes the path, pass `page(location)` too, so comments keep the page they belong to: in the simulated viewport Palette passes the frame's location to `page`.
447
449
  - **Fallback.** When the frame can't show a same-origin page, Frame falls back to the page itself and the ⓘ beside the control says why: X-Frame-Options `DENY`, a CSP `frame-ancestors` that excludes the page, a redirect to another origin, or no load within 15 seconds. Turning **Simulate real viewport** off and on again retries.