@preprio/toolkit 0.5.0-rc.4 → 0.5.0-rc.5
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 +226 -153
- package/dist/astro/index.cjs +1 -1
- package/dist/astro/index.js +1 -1
- package/dist/{chunk-AHBN6FQP.js → chunk-3X55JL52.js} +1 -1
- package/dist/{chunk-46ISDRHT.js → chunk-CMUFTCG3.js} +1 -1
- package/dist/{chunk-PDNCNTDB.js → chunk-SBLZANL5.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/nextjs/components.cjs +1 -1
- package/dist/nextjs/components.js +2 -2
- package/dist/nextjs/index.cjs +1 -1
- package/dist/nextjs/index.d.cts +2 -0
- package/dist/nextjs/index.d.ts +2 -0
- package/dist/nextjs/index.js +1 -1
- package/dist/nextjs/live-action.js +2 -2
- package/dist/nextjs/live.cjs +4 -1
- package/dist/nextjs/live.d.cts +3 -1
- package/dist/nextjs/live.d.ts +3 -1
- package/dist/nextjs/live.js +4 -1
- package/dist/nuxt/index.cjs +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/react/components.cjs +1 -1
- package/dist/react/components.js +1 -1
- package/dist/sveltekit/index.cjs +1 -1
- package/dist/sveltekit/index.js +1 -1
- package/dist/sveltekit/live-preview-O2ZTJNW4.js +1520 -0
- package/dist/sveltekit/live.cjs +1731 -0
- package/dist/sveltekit/live.d.cts +59 -0
- package/dist/sveltekit/live.d.ts +59 -0
- package/dist/sveltekit/live.js +97 -0
- package/package.json +6 -1
package/dist/nextjs/index.js
CHANGED
package/dist/nextjs/live.cjs
CHANGED
|
@@ -1722,12 +1722,15 @@ function useLive(data, opts) {
|
|
|
1722
1722
|
}
|
|
1723
1723
|
function PreprRefresh({
|
|
1724
1724
|
enabled = false,
|
|
1725
|
+
allowedEditorOrigins: origins,
|
|
1725
1726
|
strictMode: strict = false
|
|
1726
1727
|
}) {
|
|
1727
1728
|
const router = (0, import_navigation.useRouter)();
|
|
1729
|
+
const originsKey = origins?.join(" ");
|
|
1728
1730
|
(0, import_react.useEffect)(() => {
|
|
1729
1731
|
if (!enabled || !isFramed()) return;
|
|
1730
1732
|
if (strict) strictMode = true;
|
|
1733
|
+
if (originsKey) allowedEditorOrigins = originsKey.split(" ");
|
|
1731
1734
|
const sync = createLogSync();
|
|
1732
1735
|
let unsubscribe = null;
|
|
1733
1736
|
let active = true;
|
|
@@ -1748,7 +1751,7 @@ function PreprRefresh({
|
|
|
1748
1751
|
unsubscribe?.();
|
|
1749
1752
|
sync.cancel();
|
|
1750
1753
|
};
|
|
1751
|
-
}, [enabled, strict, router]);
|
|
1754
|
+
}, [enabled, originsKey, strict, router]);
|
|
1752
1755
|
return null;
|
|
1753
1756
|
}
|
|
1754
1757
|
var STEGA_CHARS = /[\u200b-\u200d\u2060-\u2064\ufeff]/;
|
package/dist/nextjs/live.d.cts
CHANGED
|
@@ -19,6 +19,8 @@ interface LivePreviewConfig {
|
|
|
19
19
|
interface PreprRefreshProps {
|
|
20
20
|
/** Pass your preview flag; never `true` on a production deployment. */
|
|
21
21
|
enabled?: boolean;
|
|
22
|
+
/** Exact editor origins, replacing the `*.prepr.io` default. */
|
|
23
|
+
allowedEditorOrigins?: string[];
|
|
22
24
|
/** Your preview token uses GraphQL strict mode; see the toolbar option. */
|
|
23
25
|
strictMode?: boolean;
|
|
24
26
|
}
|
|
@@ -47,6 +49,6 @@ declare function useLive<T>(data: T, opts?: UseLiveOptions): T;
|
|
|
47
49
|
* Use this or `useLive` with a `query`, not both: a save would refetch and
|
|
48
50
|
* refresh.
|
|
49
51
|
*/
|
|
50
|
-
declare function PreprRefresh({ enabled, strictMode: strict, }: PreprRefreshProps): null;
|
|
52
|
+
declare function PreprRefresh({ enabled, allowedEditorOrigins: origins, strictMode: strict, }: PreprRefreshProps): null;
|
|
51
53
|
|
|
52
54
|
export { type LivePreviewConfig, PreprRefresh, type PreprRefreshProps, type UseLiveOptions, initLivePreview, useLive };
|
package/dist/nextjs/live.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ interface LivePreviewConfig {
|
|
|
19
19
|
interface PreprRefreshProps {
|
|
20
20
|
/** Pass your preview flag; never `true` on a production deployment. */
|
|
21
21
|
enabled?: boolean;
|
|
22
|
+
/** Exact editor origins, replacing the `*.prepr.io` default. */
|
|
23
|
+
allowedEditorOrigins?: string[];
|
|
22
24
|
/** Your preview token uses GraphQL strict mode; see the toolbar option. */
|
|
23
25
|
strictMode?: boolean;
|
|
24
26
|
}
|
|
@@ -47,6 +49,6 @@ declare function useLive<T>(data: T, opts?: UseLiveOptions): T;
|
|
|
47
49
|
* Use this or `useLive` with a `query`, not both: a save would refetch and
|
|
48
50
|
* refresh.
|
|
49
51
|
*/
|
|
50
|
-
declare function PreprRefresh({ enabled, strictMode: strict, }: PreprRefreshProps): null;
|
|
52
|
+
declare function PreprRefresh({ enabled, allowedEditorOrigins: origins, strictMode: strict, }: PreprRefreshProps): null;
|
|
51
53
|
|
|
52
54
|
export { type LivePreviewConfig, PreprRefresh, type PreprRefreshProps, type UseLiveOptions, initLivePreview, useLive };
|
package/dist/nextjs/live.js
CHANGED
|
@@ -92,12 +92,15 @@ function useLive(data, opts) {
|
|
|
92
92
|
}
|
|
93
93
|
function PreprRefresh({
|
|
94
94
|
enabled = false,
|
|
95
|
+
allowedEditorOrigins: origins,
|
|
95
96
|
strictMode: strict = false
|
|
96
97
|
}) {
|
|
97
98
|
const router = useRouter();
|
|
99
|
+
const originsKey = origins?.join(" ");
|
|
98
100
|
useEffect(() => {
|
|
99
101
|
if (!enabled || !isFramed()) return;
|
|
100
102
|
if (strict) strictMode = true;
|
|
103
|
+
if (originsKey) allowedEditorOrigins = originsKey.split(" ");
|
|
101
104
|
const sync = createLogSync();
|
|
102
105
|
let unsubscribe = null;
|
|
103
106
|
let active = true;
|
|
@@ -118,7 +121,7 @@ function PreprRefresh({
|
|
|
118
121
|
unsubscribe?.();
|
|
119
122
|
sync.cancel();
|
|
120
123
|
};
|
|
121
|
-
}, [enabled, strict, router]);
|
|
124
|
+
}, [enabled, originsKey, strict, router]);
|
|
122
125
|
return null;
|
|
123
126
|
}
|
|
124
127
|
var STEGA_CHARS = /[\u200b-\u200d\u2060-\u2064\ufeff]/;
|
package/dist/nuxt/index.cjs
CHANGED
package/dist/nuxt/index.js
CHANGED
|
@@ -3513,7 +3513,7 @@ function createPreprPreview(opts = {}) {
|
|
|
3513
3513
|
}
|
|
3514
3514
|
|
|
3515
3515
|
// src/version.ts
|
|
3516
|
-
var VERSION = "0.5.0-rc.
|
|
3516
|
+
var VERSION = "0.5.0-rc.5";
|
|
3517
3517
|
|
|
3518
3518
|
// src/core/pixel.ts
|
|
3519
3519
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/react/components.js
CHANGED
|
@@ -3489,7 +3489,7 @@ function createPreprPreview(opts = {}) {
|
|
|
3489
3489
|
}
|
|
3490
3490
|
|
|
3491
3491
|
// src/version.ts
|
|
3492
|
-
var VERSION = "0.5.0-rc.
|
|
3492
|
+
var VERSION = "0.5.0-rc.5";
|
|
3493
3493
|
|
|
3494
3494
|
// src/core/pixel.ts
|
|
3495
3495
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/sveltekit/index.cjs
CHANGED
package/dist/sveltekit/index.js
CHANGED