@picked/client 0.0.1-dev.1777597464369 → 0.0.1-dev.1777601813342

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 (61) hide show
  1. package/dist/{api-DHbW5EXc.cjs → api-BAOO2VZv.cjs} +1 -1
  2. package/dist/{api-BvbkpgoT.js → api-CiR56vZg.js} +1 -1
  3. package/dist/cjs/form/index.js +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/create-experience/index.js +1 -1
  6. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  7. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  10. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  11. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  12. package/dist/cjs/plugins/web-components/index.js +1 -1
  13. package/dist/cjs/plugins/window-object/index.js +1 -1
  14. package/dist/cjs/server/index.js +1 -1
  15. package/dist/esm/form/index.js +8 -16
  16. package/dist/esm/index.js +181 -307
  17. package/dist/esm/plugins/create-experience/index.js +1 -1
  18. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  19. package/dist/esm/plugins/experience-browser-storage/index.js +2 -2
  20. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  21. package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
  22. package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
  23. package/dist/esm/plugins/single-page-app/index.js +93 -25
  24. package/dist/esm/plugins/web-components/index.js +2 -2
  25. package/dist/esm/plugins/window-object/index.js +1 -1
  26. package/dist/esm/server/index.js +1 -1
  27. package/dist/experience-CR19HpPg.js +136 -0
  28. package/dist/experience-DOWnsvA1.cjs +1 -0
  29. package/dist/experience-instance-C2jZU8ho.cjs +1 -0
  30. package/dist/experience-instance-CGLdwg--.js +400 -0
  31. package/dist/nodes-Bmzx3TP_.js +101 -0
  32. package/dist/nodes-Dx9bxj35.cjs +1 -0
  33. package/dist/rules-logic-CvILqbhz.js +266 -0
  34. package/dist/rules-logic-DV5SUr5M.cjs +1 -0
  35. package/dist/supports-DFDQ6eJO.cjs +1 -0
  36. package/dist/{supports-0XIfd4-R.js → supports-DUJbucFW.js} +18 -9
  37. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  38. package/dist/types/entities/framework/framework.d.ts +12 -0
  39. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  40. package/dist/types/form/create-form.d.ts +0 -22
  41. package/dist/types/form/create-form.d.ts.map +1 -1
  42. package/dist/types/plugins/single-page-app/index.d.ts +2 -1
  43. package/dist/types/plugins/single-page-app/index.d.ts.map +1 -1
  44. package/dist/types/plugins/single-page-app/plugin.d.ts +92 -9
  45. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  46. package/dist/types/utils/global-obj.d.ts +5 -0
  47. package/dist/types/utils/global-obj.d.ts.map +1 -1
  48. package/dist/types/utils/supports.d.ts +113 -0
  49. package/dist/types/utils/supports.d.ts.map +1 -1
  50. package/package.json +1 -1
  51. package/dist/experience-instance-DC2gKwA6.cjs +0 -1
  52. package/dist/experience-instance-DJaNc5Ob.js +0 -486
  53. package/dist/object-C82v79xc.js +0 -25
  54. package/dist/object-CUJOjanb.cjs +0 -1
  55. package/dist/rules-logic-BTIxfrJJ.js +0 -240
  56. package/dist/rules-logic-DNLOv90w.cjs +0 -1
  57. package/dist/supports-Dsjg-82e.cjs +0 -1
  58. /package/dist/{id-Bv44ilEo.cjs → id-Cg7fVl1O.cjs} +0 -0
  59. /package/dist/{id-CRqy981z.js → id-n2yrHvNo.js} +0 -0
  60. /package/dist/{logger-6z_gb4rA.js → logger-C44jSdYl.js} +0 -0
  61. /package/dist/{logger-fbvQC40v.cjs → logger-CJUj90QX.cjs} +0 -0
@@ -0,0 +1,266 @@
1
+ //#region src/logic-engine.ts
2
+ function e(e) {
3
+ return typeof e == "number" && !isNaN(e);
4
+ }
5
+ function t(e) {
6
+ return typeof e == "string";
7
+ }
8
+ function n(e) {
9
+ return Array.isArray(e);
10
+ }
11
+ function r(e) {
12
+ return e instanceof Promise;
13
+ }
14
+ function i(e) {
15
+ return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
16
+ }
17
+ function a(t) {
18
+ if (e(t)) return t;
19
+ let n = parseFloat(`${t}`);
20
+ return isNaN(n) ? 0 : n;
21
+ }
22
+ function o(e) {
23
+ return `${e}`;
24
+ }
25
+ var s = {
26
+ "==": (e, t) => e == t,
27
+ "===": (e, t) => e === t,
28
+ "!=": (e, t) => e != t,
29
+ "!==": (e, t) => e !== t,
30
+ ">": (e, t) => a(e) > a(t),
31
+ ">=": (e, t) => a(e) >= a(t),
32
+ "<": (e, t, n) => {
33
+ let r = a(e), i = a(t);
34
+ if (n === void 0) return r < i;
35
+ let o = a(n);
36
+ return r < i && i < o;
37
+ },
38
+ "<=": (e, t, n) => {
39
+ let r = a(e), i = a(t);
40
+ if (n === void 0) return r <= i;
41
+ let o = a(n);
42
+ return r <= i && i <= o;
43
+ },
44
+ "!!": async (e) => await l(e),
45
+ "!": async (e) => !await l(e),
46
+ "%": (e, t) => a(e) % a(t),
47
+ log: (e) => (console.log(e), e),
48
+ in: (e, r) => r ? t(r) ? r.indexOf(o(e)) !== -1 : n(r) ? r.includes(e) : !1 : !1,
49
+ cat: (...e) => e.map(o).join(""),
50
+ substr: (e, t, n) => {
51
+ let r = o(e), i = a(t);
52
+ if (n === void 0) return r.substr(i);
53
+ let s = a(n);
54
+ if (s < 0) {
55
+ let e = r.substr(i);
56
+ return e.substr(0, e.length + s);
57
+ }
58
+ return r.substr(i, s);
59
+ },
60
+ "+": (...e) => e.reduce((e, t) => a(e) + a(t), 0),
61
+ "*": (...e) => e.reduce((e, t) => a(e) * a(t), 1),
62
+ "-": (e, t) => {
63
+ let n = a(e);
64
+ return t === void 0 ? -n : n - a(t);
65
+ },
66
+ "/": (e, t) => a(e) / a(t),
67
+ min: (...e) => Math.min(...e.map(a)),
68
+ max: (...e) => Math.max(...e.map(a)),
69
+ merge: (...e) => e.reduce((e, t) => n(t) ? e.concat(t) : e.concat([t]), []),
70
+ var(e, t) {
71
+ let n = arguments.length > 1 ? t : null;
72
+ if (e === "" || e === "." || e == null) return this;
73
+ if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
74
+ let r = o(e);
75
+ if (r === "" || r === ".") return this;
76
+ let i = r.split("."), a = this;
77
+ for (let e of i) {
78
+ if (a == null) return n;
79
+ if (Array.isArray(a)) {
80
+ let t = parseInt(e, 10);
81
+ a = isNaN(t) ? a[e] : a[t];
82
+ } else a = a[e];
83
+ }
84
+ return a === void 0 ? n : a;
85
+ },
86
+ async missing(...e) {
87
+ let t = n(e[0]) ? e[0] : e, r = [];
88
+ for (let e of t) {
89
+ let t = await c({ var: e }, this);
90
+ (t === null || t === "") && r.push(`${e}`);
91
+ }
92
+ return r;
93
+ },
94
+ async missing_some(e, r) {
95
+ let i = await c({ missing: r }, this);
96
+ if (!n(i) || !n(r)) return [];
97
+ let o = i.filter(t);
98
+ return r.filter(t).length - o.length >= a(e) ? [] : o;
99
+ },
100
+ invoke(...e) {
101
+ let [t, ...n] = e;
102
+ return typeof t == "function" ? Reflect.apply(t, null, n) : null;
103
+ },
104
+ startsWith: (e, n) => t(e) && t(n) && e.startsWith(n),
105
+ endsWith: (e, n) => t(e) && t(n) && e.endsWith(n),
106
+ regexp_matches(e, r) {
107
+ let i = e, a = "";
108
+ if (n(e)) {
109
+ let [t, n] = e;
110
+ i = t, a = n;
111
+ }
112
+ return !t(i) || !t(a) ? !1 : new RegExp(i, a).test(o(r));
113
+ },
114
+ throw(e) {
115
+ throw Error(o(e));
116
+ }
117
+ };
118
+ async function c(e, t) {
119
+ if (!e) return e;
120
+ if (r(e)) return c(await e, t);
121
+ if (n(e)) return Promise.all(e.map((e) => c(e, t)));
122
+ if (!i(e)) return e;
123
+ let a = u(e), o = a ? e[a] ?? [] : [];
124
+ switch (n(o) || (o = [o]), a) {
125
+ case "if":
126
+ case "?:":
127
+ for (let e = 0; e < o.length - 1; e += 2) if (await l(await c(o[e], t))) return c(o[e + 1], t);
128
+ return o.length % 2 == 1 ? c(o[o.length - 1], t) : null;
129
+ case "and": {
130
+ let e = null;
131
+ for (let n of o) if (e = await c(n, t), !await l(e)) return e;
132
+ return e;
133
+ }
134
+ case "or": {
135
+ let e = null;
136
+ for (let n of o) if (e = await c(n, t), await l(e)) return e;
137
+ return e;
138
+ }
139
+ case "map": {
140
+ let e = await c(o[0], t);
141
+ return n(e) ? await Promise.all(e.map((e) => c(o[1], e))) : [];
142
+ }
143
+ case "filter": {
144
+ let e = await c(o[0], t);
145
+ return n(e) ? (await Promise.all(e.map(async (e) => ({
146
+ item: e,
147
+ shouldInclude: await l(await c(o[1], e))
148
+ })))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
149
+ }
150
+ case "reduce": {
151
+ let e = await c(o[0], t);
152
+ if (!n(e)) return o.length > 2 ? await c(o[2], t) : null;
153
+ let r = o[1], i = o.length > 2 ? await c(o[2], t) : null;
154
+ for (let t of e) i = await c(r, {
155
+ current: t,
156
+ accumulator: i
157
+ });
158
+ return i;
159
+ }
160
+ case "all": {
161
+ let e = await c(o[0], t);
162
+ if (!n(e) || e.length === 0) return !1;
163
+ for (let t of e) if (!await l(await c(o[1], t))) return !1;
164
+ return !0;
165
+ }
166
+ case "some": {
167
+ let e = await c(o[0], t);
168
+ if (!n(e)) return !1;
169
+ for (let t of e) if (await l(await c(o[1], t))) return !0;
170
+ return !1;
171
+ }
172
+ case "none": {
173
+ let e = await c(o[0], t);
174
+ if (!n(e)) return !0;
175
+ for (let t of e) if (await l(await c(o[1], t))) return !1;
176
+ return !0;
177
+ }
178
+ case "catch": try {
179
+ return await c(o[0], t);
180
+ } catch (e) {
181
+ return i(e) ? await c(e, t) : o[1] ? await c(o[1], e) : e instanceof Error ? e.message : e;
182
+ }
183
+ }
184
+ let d = await Promise.all(o.map((e) => c(e, t))), f = a ? s[a] : void 0;
185
+ if (!f) throw Error(`Unrecognized operation ${a}`);
186
+ return f.apply(t, d);
187
+ }
188
+ async function l(e) {
189
+ return r(e) ? l(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
190
+ }
191
+ function u(e) {
192
+ return Object.keys(e)[0];
193
+ }
194
+ //#endregion
195
+ //#region src/utils/object.ts
196
+ function d(e, t, n) {
197
+ if (!(t in e)) return;
198
+ let r = e[t];
199
+ if (typeof r != "function") throw Error(`Expected '${String(t)}' to be a function`);
200
+ let i = n(r);
201
+ p(i, r), e[t] = i;
202
+ }
203
+ function f(e, t, n) {
204
+ Object.defineProperty(e, t, {
205
+ enumerable: !1,
206
+ value: n,
207
+ writable: !0,
208
+ configurable: !0
209
+ });
210
+ }
211
+ function p(e, t) {
212
+ let n = t.prototype || {};
213
+ t.prototype = n, e.prototype = n, f(e, "__picked_original", t);
214
+ }
215
+ function m(e) {
216
+ return typeof e == "function" && "__picked_original" in e;
217
+ }
218
+ function h(e) {
219
+ return e === void 0 || typeof e == "object" && !!e && e.constructor === Object && Object.keys(e).length === 0;
220
+ }
221
+ //#endregion
222
+ //#region src/utils/rules-logic.ts
223
+ function g(e) {
224
+ return !h(e);
225
+ }
226
+ async function _(e, t, n) {
227
+ let r = e.getStateSnapshot(), i = e.predicates.listStore.getState().reduce((e, t) => ({
228
+ ...e,
229
+ [t.name]: (...e) => t.predicate({
230
+ ...r,
231
+ args: e
232
+ })
233
+ }), {}), a = e.actions.listStore.getState().reduce((e, t) => ({
234
+ ...e,
235
+ [t.key]: (...e) => t.action({
236
+ ...r,
237
+ args: e
238
+ }, null)
239
+ }), {}), o = e.features.listStore.getState().reduce((e, t) => ({
240
+ ...e,
241
+ [t.id]: async () => {
242
+ let { bucket: e } = await t.getBucket();
243
+ return e;
244
+ }
245
+ }), {});
246
+ return await c(t, {
247
+ responses: e.responses.getAllStore.getState(),
248
+ location: typeof r.location == "object" ? {
249
+ hash: r.location.hash,
250
+ host: r.location.host,
251
+ hostname: r.location.hostname,
252
+ href: r.location.href,
253
+ origin: r.location.origin,
254
+ pathname: r.location.pathname,
255
+ port: r.location.port,
256
+ protocol: r.location.protocol,
257
+ search: r.location.search
258
+ } : void 0,
259
+ predicates: i,
260
+ actions: a,
261
+ features: o,
262
+ ...n
263
+ });
264
+ }
265
+ //#endregion
266
+ export { d as a, m as i, g as n, h as r, _ as t };
@@ -0,0 +1 @@
1
+ function e(e){return typeof e==`number`&&!isNaN(e)}function t(e){return typeof e==`string`}function n(e){return Array.isArray(e)}function r(e){return e instanceof Promise}function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===1}function a(t){if(e(t))return t;let n=parseFloat(`${t}`);return isNaN(n)?0:n}function o(e){return`${e}`}var s={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>a(e)>a(t),">=":(e,t)=>a(e)>=a(t),"<":(e,t,n)=>{let r=a(e),i=a(t);if(n===void 0)return r<i;let o=a(n);return r<i&&i<o},"<=":(e,t,n)=>{let r=a(e),i=a(t);if(n===void 0)return r<=i;let o=a(n);return r<=i&&i<=o},"!!":async e=>await l(e),"!":async e=>!await l(e),"%":(e,t)=>a(e)%a(t),log:e=>(console.log(e),e),in:(e,r)=>r?t(r)?r.indexOf(o(e))!==-1:n(r)?r.includes(e):!1:!1,cat:(...e)=>e.map(o).join(``),substr:(e,t,n)=>{let r=o(e),i=a(t);if(n===void 0)return r.substr(i);let s=a(n);if(s<0){let e=r.substr(i);return e.substr(0,e.length+s)}return r.substr(i,s)},"+":(...e)=>e.reduce((e,t)=>a(e)+a(t),0),"*":(...e)=>e.reduce((e,t)=>a(e)*a(t),1),"-":(e,t)=>{let n=a(e);return t===void 0?-n:n-a(t)},"/":(e,t)=>a(e)/a(t),min:(...e)=>Math.min(...e.map(a)),max:(...e)=>Math.max(...e.map(a)),merge:(...e)=>e.reduce((e,t)=>n(t)?e.concat(t):e.concat([t]),[]),var(e,t){let n=arguments.length>1?t:null;if(e===``||e===`.`||e==null)return this;if(typeof e==`number`&&Array.isArray(this))return e>=0&&e<this.length?this[e]:n;let r=o(e);if(r===``||r===`.`)return this;let i=r.split(`.`),a=this;for(let e of i){if(a==null)return n;if(Array.isArray(a)){let t=parseInt(e,10);a=isNaN(t)?a[e]:a[t]}else a=a[e]}return a===void 0?n:a},async missing(...e){let t=n(e[0])?e[0]:e,r=[];for(let e of t){let t=await c({var:e},this);(t===null||t===``)&&r.push(`${e}`)}return r},async missing_some(e,r){let i=await c({missing:r},this);if(!n(i)||!n(r))return[];let o=i.filter(t);return r.filter(t).length-o.length>=a(e)?[]:o},invoke(...e){let[t,...n]=e;return typeof t==`function`?Reflect.apply(t,null,n):null},startsWith:(e,n)=>t(e)&&t(n)&&e.startsWith(n),endsWith:(e,n)=>t(e)&&t(n)&&e.endsWith(n),regexp_matches(e,r){let i=e,a=``;if(n(e)){let[t,n]=e;i=t,a=n}return!t(i)||!t(a)?!1:new RegExp(i,a).test(o(r))},throw(e){throw Error(o(e))}};async function c(e,t){if(!e)return e;if(r(e))return c(await e,t);if(n(e))return Promise.all(e.map(e=>c(e,t)));if(!i(e))return e;let a=u(e),o=a?e[a]??[]:[];switch(n(o)||(o=[o]),a){case`if`:case`?:`:for(let e=0;e<o.length-1;e+=2)if(await l(await c(o[e],t)))return c(o[e+1],t);return o.length%2==1?c(o[o.length-1],t):null;case`and`:{let e=null;for(let n of o)if(e=await c(n,t),!await l(e))return e;return e}case`or`:{let e=null;for(let n of o)if(e=await c(n,t),await l(e))return e;return e}case`map`:{let e=await c(o[0],t);return n(e)?await Promise.all(e.map(e=>c(o[1],e))):[]}case`filter`:{let e=await c(o[0],t);return n(e)?(await Promise.all(e.map(async e=>({item:e,shouldInclude:await l(await c(o[1],e))})))).filter(({shouldInclude:e})=>e).map(({item:e})=>e):[]}case`reduce`:{let e=await c(o[0],t);if(!n(e))return o.length>2?await c(o[2],t):null;let r=o[1],i=o.length>2?await c(o[2],t):null;for(let t of e)i=await c(r,{current:t,accumulator:i});return i}case`all`:{let e=await c(o[0],t);if(!n(e)||e.length===0)return!1;for(let t of e)if(!await l(await c(o[1],t)))return!1;return!0}case`some`:{let e=await c(o[0],t);if(!n(e))return!1;for(let t of e)if(await l(await c(o[1],t)))return!0;return!1}case`none`:{let e=await c(o[0],t);if(!n(e))return!0;for(let t of e)if(await l(await c(o[1],t)))return!1;return!0}case`catch`:try{return await c(o[0],t)}catch(e){return i(e)?await c(e,t):o[1]?await c(o[1],e):e instanceof Error?e.message:e}}let d=await Promise.all(o.map(e=>c(e,t))),f=a?s[a]:void 0;if(!f)throw Error(`Unrecognized operation ${a}`);return f.apply(t,d)}async function l(e){return r(e)?l(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function u(e){return Object.keys(e)[0]}function d(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)throw Error(`Expected '${String(t)}' to be a function`);let i=n(r);p(i,r),e[t]=i}function f(e,t,n){Object.defineProperty(e,t,{enumerable:!1,value:n,writable:!0,configurable:!0})}function p(e,t){let n=t.prototype||{};t.prototype=n,e.prototype=n,f(e,`__picked_original`,t)}function m(e){return typeof e==`function`&&`__picked_original`in e}function h(e){return e===void 0||typeof e==`object`&&!!e&&e.constructor===Object&&Object.keys(e).length===0}function g(e){return!h(e)}async function _(e,t,n){let r=e.getStateSnapshot(),i=e.predicates.listStore.getState().reduce((e,t)=>({...e,[t.name]:(...e)=>t.predicate({...r,args:e})}),{}),a=e.actions.listStore.getState().reduce((e,t)=>({...e,[t.key]:(...e)=>t.action({...r,args:e},null)}),{}),o=e.features.listStore.getState().reduce((e,t)=>({...e,[t.id]:async()=>{let{bucket:e}=await t.getBucket();return e}}),{});return await c(t,{responses:e.responses.getAllStore.getState(),location:typeof r.location==`object`?{hash:r.location.hash,host:r.location.host,hostname:r.location.hostname,href:r.location.href,origin:r.location.origin,pathname:r.location.pathname,port:r.location.port,protocol:r.location.protocol,search:r.location.search}:void 0,predicates:i,actions:a,features:o,...n})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
@@ -0,0 +1 @@
1
+ var e=Symbol(`Picked`),t=globalThis,n=n=>{t[e]=n};function r(){try{return`location`in t&&!!t.location}catch{return!1}}function i(){try{return`history`in t&&!!t.history}catch{return!1}}function a(){try{if(!(`navigation`in t))return!1;let e=t.navigation;return!!e&&typeof e?.addEventListener==`function`}catch{return!1}}function o(){try{return`localStorage`in t&&!!t.localStorage}catch{return!1}}function s(){try{return`sessionStorage`in t&&!!t.sessionStorage}catch{return!1}}function c(){try{return`document`in t&&`cookie`in t.document}catch{return!1}}function l(){try{return`document`in t&&`createElement`in t.document&&`attachShadow`in t.document.createElement(`div`)}catch{return!1}}function u(){try{return`window`in t}catch{return!1}}function d(){try{return`document`in t}catch{return!1}}function f(){try{return`IntersectionObserver`in t}catch{return!1}}function p(){try{return`customElements`in t&&!!t.customElements}catch{return!1}}function m(){try{return`crypto`in t&&`randomUUID`in t.crypto}catch{return!1}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return l}});
@@ -20,61 +20,70 @@ function i() {
20
20
  }
21
21
  function a() {
22
22
  try {
23
- return "localStorage" in t && !!t.localStorage;
23
+ if (!("navigation" in t)) return !1;
24
+ let e = t.navigation;
25
+ return !!e && typeof e?.addEventListener == "function";
24
26
  } catch {
25
27
  return !1;
26
28
  }
27
29
  }
28
30
  function o() {
29
31
  try {
30
- return "sessionStorage" in t && !!t.sessionStorage;
32
+ return "localStorage" in t && !!t.localStorage;
31
33
  } catch {
32
34
  return !1;
33
35
  }
34
36
  }
35
37
  function s() {
36
38
  try {
37
- return "document" in t && "cookie" in t.document;
39
+ return "sessionStorage" in t && !!t.sessionStorage;
38
40
  } catch {
39
41
  return !1;
40
42
  }
41
43
  }
42
44
  function c() {
43
45
  try {
44
- return "document" in t && "createElement" in t.document && "attachShadow" in t.document.createElement("div");
46
+ return "document" in t && "cookie" in t.document;
45
47
  } catch {
46
48
  return !1;
47
49
  }
48
50
  }
49
51
  function l() {
50
52
  try {
51
- return "window" in t;
53
+ return "document" in t && "createElement" in t.document && "attachShadow" in t.document.createElement("div");
52
54
  } catch {
53
55
  return !1;
54
56
  }
55
57
  }
56
58
  function u() {
57
59
  try {
58
- return "document" in t;
60
+ return "window" in t;
59
61
  } catch {
60
62
  return !1;
61
63
  }
62
64
  }
63
65
  function d() {
64
66
  try {
65
- return "IntersectionObserver" in t;
67
+ return "document" in t;
66
68
  } catch {
67
69
  return !1;
68
70
  }
69
71
  }
70
72
  function f() {
71
73
  try {
72
- return "customElements" in t && !!t.customElements;
74
+ return "IntersectionObserver" in t;
73
75
  } catch {
74
76
  return !1;
75
77
  }
76
78
  }
77
79
  function p() {
80
+ try {
81
+ return "customElements" in t && !!t.customElements;
82
+ } catch {
83
+ return !1;
84
+ }
85
+ }
86
+ function m() {
78
87
  try {
79
88
  return "crypto" in t && "randomUUID" in t.crypto;
80
89
  } catch {
@@ -82,4 +91,4 @@ function p() {
82
91
  }
83
92
  }
84
93
  //#endregion
85
- export { d as a, o as c, l as d, t as f, i, c as l, p as n, a as o, n as p, u as r, r as s, s as t, f as u };
94
+ export { f as a, a as c, p as d, u as f, i, s as l, n as m, m as n, o, t as p, d as r, r as s, c as t, l as u };
@@ -1 +1 @@
1
- {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC3C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IACjD,UAAU,EAAE,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,CAAA;IAC5C,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC3B,IAAI,EAAE,aAAa,CAAC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C,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA0J1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
1
+ {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC3C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;I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AAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,iCAgdF,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA2L1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
@@ -5,6 +5,7 @@ export type FrameworksStore = ReturnType<typeof createFrameworkIndex>;
5
5
  export interface Framework {
6
6
  name: string;
7
7
  render: FrameworkRender;
8
+ unRender: FrameworkUnRender;
8
9
  }
9
10
  declare const createFrameworkIndexFactory: ({ client }: {
10
11
  client: Picked;
@@ -13,8 +14,19 @@ declare const createFrameworkIndexFactory: ({ client }: {
13
14
  getByName: (name: string) => import('effector').Store<Framework | undefined>;
14
15
  listStore: import('effector').Store<Framework[]>;
15
16
  };
17
+ /**
18
+ * Creates the framework registry store and its register/getByName API for the
19
+ * given Picked client.
20
+ *
21
+ * @template T
22
+ * @param {T} params - Factory parameters; carries the parent Picked client.
23
+ * @returns {ReturnType<typeof createFrameworkIndexFactory>} The framework index store and its API.
24
+ * @example
25
+ * const frameworks = createFrameworkIndex({ client })
26
+ */
16
27
  export declare function createFrameworkIndex<T extends Parameters<typeof createFrameworkIndexFactory>[0]>(params: T): ReturnType<typeof createFrameworkIndexFactory>;
17
28
  export type FrameworkRender = (shadowRoot: ShadowRoot, component: AdaptedComponent, client: Picked, experience: ExperienceInstance) => void;
29
+ export type FrameworkUnRender = (shadowRoot: ShadowRoot) => void | Promise<void>;
18
30
  export declare const setupFramework: (framework: Framework, frameworks: FrameworksStore) => void;
19
31
  export {};
20
32
  //# sourceMappingURL=framework.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../../../src/entities/framework/framework.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAEpF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIrE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;CACxB;AAGD,QAAA,MAAM,2BAA2B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;qBAcvD,MAAM,aAAa,SAAS,KAAG,IAAI;sBAiBlC,MAAM;;CAS/B,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,IAAI,CAAA;AAET,eAAO,MAAM,cAAc,GAAI,WAAW,SAAS,EAAE,YAAY,eAAe,KAAG,IAElF,CAAA"}
1
+ {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../../../src/entities/framework/framework.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAEpF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIrE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B;AAGD,QAAA,MAAM,2BAA2B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;qBAuBvD,MAAM,aAAa,SAAS,KAAG,IAAI;sBA0BlC,MAAM;;CAS/B,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,IAAI,CAAA;AAET,MAAM,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAEhF,eAAO,MAAM,cAAc,GAAI,WAAW,SAAS,EAAE,YAAY,eAAe,KAAG,IAElF,CAAA"}
@@ -69,28 +69,6 @@ export interface FormInstance<TFieldKeys extends string = string> {
69
69
  * ```
70
70
  */
71
71
  export declare function getEventValue(e: Event): FieldValue | undefined;
72
- /**
73
- * Extracts the staged value for a field from a form event. For multi-value
74
- * fields (`field.multiple === true`), reads the aggregate from the parent
75
- * form's FormData (checkbox group) or selected options (`<select multiple>`)
76
- * so a single toggle stages the full array. Falls back to {@link getEventValue}
77
- * for single-value fields and for multi fields whose target cannot be
78
- * aggregated.
79
- *
80
- * Not re-exported from the form barrel; intended for use by the form's own
81
- * field handlers and for direct unit testing.
82
- *
83
- * @param {Event} e - The DOM event from a form input.
84
- * @param {Field} field - The field whose handler received the event.
85
- * @returns {FieldValue | undefined} The value to stage, or undefined if the event target is not a recognised form element.
86
- * @example
87
- * ```ts
88
- * input.addEventListener('change', (e) => {
89
- * const value = getStagedEventValue(e, field)
90
- * })
91
- * ```
92
- */
93
- export declare function getStagedEventValue(e: Event, field: Field): FieldValue | undefined;
94
72
  /**
95
73
  * Creates a form instance tied to a set of field keys.
96
74
  * Handles field evaluation, form submission, data transformation,
@@ -1 +1 @@
1
- {"version":3,"file":"create-form.d.ts","sourceRoot":"","sources":["../../../src/form/create-form.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,KAAK,EAEX,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,4BAA4B,EACjC,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAA;AAEjC,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG;IAC9B,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;IAC7B,8DAA8D;IAC9D,KAAK,EAAE,eAAe,GAAG,SAAS,CAAA;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,4DAA4D;IAC5D,KAAK,EAAE;QACL,EAAE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SAAS,EAAE,CAAC,CAAA;CAC3B;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS,CAW9D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,GACzB,YAAY,CAoLd"}
@@ -1,3 +1,4 @@
1
- export { singlePageAppPlugin } from './plugin';
1
+ /** @file Public entrypoint for the single-page-app plugin and its `notifyNavigation` escape hatch. */
2
+ export { singlePageAppPlugin, notifyNavigation } from './plugin';
2
3
  export type * from './plugin';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,mBAAmB,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/index.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChE,mBAAmB,UAAU,CAAA"}
@@ -1,20 +1,50 @@
1
1
  import { Plugin } from '../../entities/plugin/plugin';
2
+ import { Picked } from '../../picked';
2
3
  interface SinglePageAppPluginOptions {
3
4
  /**
4
- * Enables monitoring of browser history events (pushState, replaceState, popstate)
5
- * to automatically restart the client when navigating in single-page applications.
6
- * Only `true` is supported at this time.
5
+ * When `true`, the plugin falls back to wrapping `pushState`, `replaceState`, and
6
+ * `popstate` on platforms without the Navigation API. Set to `false` to skip the
7
+ * fallback and rely on {@link notifyNavigation} from the host router instead.
8
+ *
9
+ * @default true
7
10
  */
8
- instrumentHistory: true;
11
+ instrumentHistory?: boolean;
12
+ /**
13
+ * Hard upper bound (ms) on how long a reconcile window observes DOM mutations.
14
+ * Increase for SSR-hydrating apps whose target tree takes longer than the default
15
+ * to settle.
16
+ *
17
+ * @default 1000
18
+ */
19
+ maxWindowMs?: number;
20
+ /**
21
+ * Idle threshold (ms) — when no DOM mutation arrives for this long, the
22
+ * reconcile window disconnects early. Smaller values cut work sooner on
23
+ * quiet pages.
24
+ *
25
+ * @default 150
26
+ */
27
+ idleDebounceMs?: number;
9
28
  }
10
29
  /**
11
30
  * Enables compatibility with Single Page Applications (SPAs).
12
- * This plugin monitors browser history events and automatically triggers client re-rendering
13
- * when navigation occurs within the SPA.
31
+ * This plugin subscribes to browser route changes and reconciles experiences with
32
+ * the new route's DOM: after a route change it re-runs the per-experience spawn
33
+ * pass (`initialiseExperiences`) immediately and again on each DOM mutation batch
34
+ * until the DOM settles, so widgets re-appear when their target elements are
35
+ * (re)rendered by the host framework. Prefers the Navigation API
36
+ * (`window.navigation.addEventListener('navigatesuccess', …)`) when available
37
+ * and falls back to instrumenting `pushState` / `replaceState` / `popstate`
38
+ * otherwise.
14
39
  *
15
- * @param {SinglePageAppPluginOptions} options - Configuration options for the SPA plugin
16
- * @returns {Plugin} The plugin.
40
+ * Note: route changes drive `initialiseExperiences` only — the broader side
41
+ * effects of `client.start()` (precondition/condition gate re-evaluation,
42
+ * `runPluginStartHooks`, `ping`, and `initialize`/`ready`/`session` events)
43
+ * are intentionally not re-run per navigation. Consumers that need per-route
44
+ * gate re-evaluation should call `client.start()` from their router themselves.
17
45
  *
46
+ * @param {SinglePageAppPluginOptions} options - Configuration options for the SPA plugin.
47
+ * @returns {Plugin} The plugin.
18
48
  * @example
19
49
  * ```typescript
20
50
  * createClient({
@@ -26,7 +56,60 @@ interface SinglePageAppPluginOptions {
26
56
  * })
27
57
  * ```
28
58
  */
29
- export declare const singlePageAppPlugin: (_options: SinglePageAppPluginOptions) => Plugin;
59
+ export declare const singlePageAppPlugin: (options?: SinglePageAppPluginOptions) => Plugin;
60
+ /**
61
+ * Triggers experience reconciliation for the next ~1 second of DOM mutations.
62
+ * Use from a router lifecycle hook when the SPA plugin's history instrumentation
63
+ * is unable to detect navigations — for example when another script has wrapped
64
+ * `pushState` after Picked's setup, or when the host router doesn't go through
65
+ * `pushState` at all.
66
+ *
67
+ * Safe to call any number of times — successive calls cancel and replace the
68
+ * prior reconcile window for the given client. No-ops outside browser
69
+ * environments and on partial-DOM runtimes that lack `MutationObserver`,
70
+ * `requestAnimationFrame`, or `document.body`.
71
+ *
72
+ * @param {Picked} client - The Picked client instance to reconcile.
73
+ * @example
74
+ * // React Router
75
+ * useEffect(() => { notifyNavigation(picked) }, [location.pathname])
76
+ *
77
+ * // SvelteKit
78
+ * afterNavigate(() => notifyNavigation(picked))
79
+ */
80
+ export declare function notifyNavigation(client: Picked): void;
81
+ interface SubscribeOptions {
82
+ fallbackToHistory: boolean;
83
+ }
84
+ /**
85
+ * Subscribes to browser route changes and invokes `callback` once per URL
86
+ * change. Prefers the Navigation API
87
+ * (`window.navigation.addEventListener('navigatesuccess', …)`) when available
88
+ * because it captures every same-document navigation regardless of the host
89
+ * router's mechanism and survives third-party scripts that wrap
90
+ * `pushState` / `replaceState`. Falls back to {@link instrumentHistory} on
91
+ * platforms without the Navigation API.
92
+ *
93
+ * @param {() => void} callback - Invoked once per URL change.
94
+ * @param {SubscribeOptions} [options] - Whether to fall back to history instrumentation when the Navigation API is unavailable.
95
+ * @example
96
+ * subscribeToRouteChanges(() => reconcile())
97
+ */
98
+ export declare function subscribeToRouteChanges(callback: () => void, options?: SubscribeOptions): void;
99
+ /**
100
+ * Instruments browser history so the callback fires whenever the navigation
101
+ * URL changes via `popstate`, `pushState`, or `replaceState`. Same-URL events
102
+ * are ignored so repeated replaces of the current location don't re-trigger.
103
+ * Used as the fallback for environments without the Navigation API.
104
+ *
105
+ * Idempotent: if `pushState`/`replaceState` are already wrapped (i.e. Carry
106
+ * the `__picked_original` marker), the wrap is skipped so HMR or repeat client
107
+ * setup does not stack listeners..
108
+ *
109
+ * @param {() => void} callback - Invoked once per URL change.
110
+ * @example
111
+ * instrumentHistory(() => console.log('route changed'))
112
+ */
30
113
  export declare function instrumentHistory(callback: () => void): void;
31
114
  export {};
32
115
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,0BAA0B;IAClC;;;;OAIG;IACH,iBAAiB,EAAE,IAAI,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,0BAA0B,KAAG,MAa1E,CAAA;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAwC5D"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAa1C,UAAU,0BAA0B;IAClC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAS,0BAA+B,KAAG,MAoB9E,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CASrD;AA+LD,UAAU,gBAAgB;IACxB,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,GAAE,gBAA8C,GACtD,IAAI,CAuBN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CA0D5D"}
@@ -3,6 +3,11 @@ declare const globalObjKey: unique symbol;
3
3
  interface InternalGlobal {
4
4
  [globalObjKey]?: Picked;
5
5
  Picked?: Picked;
6
+ navigation?: NavigationEventTarget;
7
+ }
8
+ interface NavigationEventTarget {
9
+ addEventListener: (type: 'navigatesuccess', listener: () => void, options?: AddEventListenerOptions) => void;
10
+ removeEventListener: (type: 'navigatesuccess', listener: () => void, options?: EventListenerOptions) => void;
6
11
  }
7
12
  export declare const GLOBAL_OBJ: typeof globalThis & InternalGlobal;
8
13
  export declare const bindClient: (client: Picked) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../src/utils/global-obj.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,QAAA,MAAM,YAAY,eAAmB,CAAA;AAErC,UAAU,cAAc;IACtB,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,eAAO,MAAM,UAAU,EAAiB,OAAO,UAAU,GAAG,cAAc,CAAA;AAE1E,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,SAExC,CAAA"}
1
+ {"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../src/utils/global-obj.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,QAAA,MAAM,YAAY,eAAmB,CAAA;AAErC,UAAU,cAAc;IACtB,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,qBAAqB,CAAA;CACnC;AAED,UAAU,qBAAqB;IAC7B,gBAAgB,EAAE,CAChB,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,CAAC,EAAE,uBAAuB,KAC9B,IAAI,CAAA;IACT,mBAAmB,EAAE,CACnB,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,CAAC,EAAE,oBAAoB,KAC3B,IAAI,CAAA;CACV;AAGD,eAAO,MAAM,UAAU,EAAiB,OAAO,UAAU,GAAG,cAAc,CAAA;AAE1E,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,SAExC,CAAA"}