@hazem3500/palette 0.9.114 → 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/dist/setup.js CHANGED
@@ -1 +1 @@
1
- import{a as n,d as o}from"./chunk-AXW6CU4X.js";import"./chunk-KLPQTFVH.js";import"./chunk-RBHY7UDS.js";import"./chunk-LMXFSXO6.js";import"./chunk-DU7H4TEX.js";import"./chunk-5HZI7HRR.js";import"./chunk-2BS2OWWH.js";import"./chunk-J47R52WX.js";import"./chunk-VX6XCU4E.js";import"./chunk-4HBBEVFK.js";function r(r){return(t={})=>o(n({...r,...t}))}var t=r;export{t as defineKomo,r as definePalette};
1
+ import{a as n,d as o}from"./chunk-ZGJYCFAB.js";import"./chunk-KLPQTFVH.js";import"./chunk-RBHY7UDS.js";import"./chunk-LMXFSXO6.js";import"./chunk-DU7H4TEX.js";import"./chunk-5HZI7HRR.js";import"./chunk-2BS2OWWH.js";import"./chunk-J47R52WX.js";import"./chunk-VX6XCU4E.js";import"./chunk-4HBBEVFK.js";function r(r){return(t={})=>o(n({...r,...t}))}var t=r;export{t as defineKomo,r as definePalette};
@@ -0,0 +1 @@
1
+ var e="palette-shell",t="palette:shell";function a(t,a){let o=new URL(t,location.href);return o.searchParams.delete("komo-shell"),a?o.searchParams.set(e,a):o.searchParams.delete(e),o.href}function o(e,o=""){try{sessionStorage.removeItem(t),sessionStorage.removeItem("komo:shell"),o&&sessionStorage.setItem("palette:shell-off",o)}catch{}location.replace(a(e,""))}function l(e,o,l,r){try{let n=sessionStorage.getItem("palette:shell-off");if(n)return r(n);if(o&&!confirm(`Reload in Frame?\n\nUnsaved app changes${l?" and unposted Design changes":""} will be lost.`))return r("Reload cancelled.");let s=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");sessionStorage.setItem(t,JSON.stringify({v:1,project:e,nonce:s,origin:location.origin})),location.replace(a(location.href,s))}catch{return r("Storage blocked.")}setTimeout(r,3e3,"Reload cancelled.")}function r(e,t){try{let o=e.location.href,l=a(o,t);o.startsWith(location.origin)&&l!==location.href&&history.replaceState(history.state,"",l)}catch{}}export{l as enterShell,o as leaveShellPage,a as shellUrl,r as syncShell};
@@ -4,9 +4,9 @@ export declare function shellUrl(href: string, nonce: string): string;
4
4
  export declare function leaveShellPage(href: string, reason?: string): void;
5
5
  /**
6
6
  * Reloads this page as the shell. `ask` confirms first; `fallback` runs when the
7
- * reviewer keeps two copies, storage is blocked, or the page didn't unload (the
7
+ * reviewer cancels, storage is blocked, or the page didn't unload (the
8
8
  * app's own unsaved-changes guard can keep it).
9
9
  */
10
- export declare function enterShell(project: string, ask: boolean, edited: boolean, fallback: () => void): void;
10
+ export declare function enterShell(project: string, ask: boolean, edited: boolean, fallback: (reason: string) => void): void;
11
11
  /** The shell's URL follows the frame's route, so reloading or sharing it keeps the page. */
12
12
  export declare function syncShell(view: Window | null | undefined, nonce: string): void;
@@ -4,7 +4,7 @@ export declare const SHELL_PARAM = "palette-shell";
4
4
  export declare const LEGACY_SHELL_PARAM = "komo-shell";
5
5
  /** sessionStorage: the shell Palette started in this tab, `{ v, project, nonce, origin }`. */
6
6
  export declare const SHELL_KEY = "palette:shell";
7
- /** sessionStorage: why the last shell ended early. This tab then keeps two copies, without reloading. */
7
+ /** sessionStorage: why the last shell ended early. This tab stays on the normal page until an explicit retry. */
8
8
  export declare const SHELL_OFF_KEY = "palette:shell-off";
9
9
  /** The page's shell nonce, when Palette started a shell for `project` in this tab; else "". */
10
10
  export declare function shellNonce(project: string): string;
package/dist/types.d.ts CHANGED
@@ -271,10 +271,13 @@ export interface CommentsOptions {
271
271
  */
272
272
  defaultMode?: "iframe" | "transform";
273
273
  iframeUrl?(location: Location): string;
274
+ /** Resolve a comment destination before same-origin iframe navigation. Null cancels; current is the live framed page, not the shell. */
275
+ resolveUrl?(destination: URL, current: Location): URL | null;
274
276
  /**
275
277
  * Single-copy simulated viewport (with mode "iframe"): turning it on reloads this page as a
276
278
  * shell for Palette, so the app runs once, in the frame. Requires the app's entry
277
279
  * to skip mounting when `isShell(project)` from `@hazem3500/palette/shell` is true.
280
+ * Cancellation or failure keeps the normal page; a second app is never loaded as fallback.
278
281
  */
279
282
  shell?: boolean;
280
283
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazem3500/palette",
3
- "version": "0.9.114",
3
+ "version": "0.9.116",
4
4
  "description": "Point, area, and threaded comments for website branches.",
5
5
  "type": "module",
6
6
  "license": "MIT",