efficient-shell 15.5.0 → 15.8.0
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 +11 -5
- package/dist/{Browser-AW3JESXA.js → Browser-5QLDJ74Z.js} +11 -11
- package/dist/Calculator-6WNTZLWL.js +29 -0
- package/dist/{CurrencyConverter-H34LZQBN.js → CurrencyConverter-C4KCZWUM.js} +10 -10
- package/dist/{Files-MUH6WMVG.js → Files-VFRXPQLV.js} +23 -23
- package/dist/Notepad-S5JMXH2O.js +24 -0
- package/dist/PomodoroTimer-BGTCWT53.js +91 -0
- package/dist/{Preview-II3EEMFX.js → Preview-HTFTEL7K.js} +22 -22
- package/dist/{Stock-R5A7NOZT.js → Stock-LIOPTQG5.js} +6 -6
- package/dist/{Weather-U2LR5SRL.js → Weather-K3BVAFRV.js} +20 -20
- package/dist/{WorldClock-HGGHJ5SX.js → WorldClock-RHAHXLW4.js} +6 -6
- package/dist/apps/ImageAnnotator.js +1 -1
- package/dist/apps/index.js +1 -1
- package/dist/bin/browser-check.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/chunk-3AUPCKBR.js +1 -0
- package/dist/chunk-6FOLK4HD.js +1 -0
- package/dist/{chunk-3BILUDDY.js → chunk-EA423N2F.js} +3 -3
- package/dist/{chunk-F4DVE2J2.js → chunk-FQ3SYDKI.js} +1 -1
- package/dist/chunk-FUUUPTVN.js +18 -0
- package/dist/chunk-GD5NGS6D.js +89 -0
- package/dist/chunk-GZ4AMXEU.js +1 -0
- package/dist/{chunk-WDVQXZ5F.js → chunk-QJ3X2PHY.js} +1 -1
- package/dist/{chunk-HB2PSIVY.js → chunk-RRWQBWLW.js} +1 -1
- package/dist/chunk-WGDVYCQX.js +69 -0
- package/dist/{chunk-L7EQ2DJV.js → chunk-XZKVGJIB.js} +1 -1
- package/dist/{chunk-TAU7GC7W.js → chunk-YFVQKS5U.js} +1 -1
- package/dist/chunk-ZLB5GRL6.js +1 -0
- package/dist/format/index.d.ts +15 -1
- package/dist/format/index.js +1 -1
- package/dist/hooks/index.d.ts +42 -1
- package/dist/hooks/index.js +1 -1
- package/dist/index.d.ts +121 -75
- package/dist/index.js +662 -662
- package/dist/motion.css +9 -4
- package/dist/routine-index.json +1 -1
- package/dist/shell/SidebarLayout.d.ts +11 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/value-index.json +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-HHAC23S4.js +0 -29
- package/dist/Notepad-PYOQ3WJS.js +0 -24
- package/dist/PomodoroTimer-GZZD7LPW.js +0 -91
- package/dist/chunk-GG2UON56.js +0 -1
- package/dist/chunk-KFVGNKKJ.js +0 -92
- package/dist/chunk-POMRPKZO.js +0 -16
- package/dist/chunk-TDUOBP55.js +0 -69
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-GG2UON56.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],N=[800,1800],U=e=>{document.prerendering?E(()=>U(e)):"complete"!==document.readyState?addEventListener("load",()=>U(e),!0):setTimeout(e)};var B=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,G=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,D=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(D,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&B.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,N,t.reportAllChanges);U(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,N,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,N,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(G,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
1
|
+
import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-6FOLK4HD.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},F=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{F(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var O=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},K=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,D=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&U.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&O.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;F(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(K,"[redacted]").replace(J,"[redacted]").replace(D,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{UndoContext as e}from"./chunk-3AUPCKBR.js";import{useContext as t,useRef as r,useMemo as n,useEffect as o}from"react";var u={past:[],future:[]};function c(e,t){switch(t.type){case"record":{const r=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&r?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const n=[...e.past,t.step];return{past:n.length>100?n.slice(n.length-100):n,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:u}}var s=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);function a(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),r="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!r)return null;const n=e.target;if(n?.isContentEditable)return null;if(n?.tagName&&s.has(n.tagName.toUpperCase()))return null;const o=n?.closest?.("[contenteditable]");return o&&"false"!==o.getAttribute("contenteditable")||n?.closest?.('[role="textbox"]')?null:r}function l(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function f(u,c=[]){const s=t(e),l=r(u);l.current=u;const f=n(()=>({undo:()=>l.current.undo(),redo:()=>l.current.redo(),canUndo:()=>l.current.canUndo(),canRedo:()=>l.current.canRedo()}),[]),i=s?.addSource,d=s?.bindKeys;o(()=>{const e=c.filter(e=>!!e);if(i&&d){const t=[i(f),...e.map(e=>d(e))];return()=>{for(const e of t)e()}}const t=e=>{const t=a(e);t&&("undo"===t?f.canUndo():f.canRedo())&&(e.preventDefault(),"undo"===t?f.undo():f.redo())},r=[window,...e];for(const e of r)e.addEventListener("keydown",t);return()=>{for(const e of r)e.removeEventListener("keydown",t)}},[i,d,f,...c])}export{u as emptyUndoState,a as matchUndoHotkey,l as sameValue,c as undoReducer,f as useUndoHistory};
|
package/dist/format/index.d.ts
CHANGED
|
@@ -84,6 +84,8 @@ declare const PIN_STICK_VAR = "--motion-pin-stick";
|
|
|
84
84
|
declare const PIN_TRACK_POSITION_VAR = "--motion-pin-track-position";
|
|
85
85
|
/** The stack order of a box marked `PIN_ABOVE_ATTR` (default 30: over the later sections, under a host header and its page overlays). */
|
|
86
86
|
declare const PIN_ABOVE_Z_VAR = "--motion-pin-above-z";
|
|
87
|
+
/** A track's end: 1 = the next section slides over the frame (default), 0 = the frame scrolls away with the page (`pinAttrs` `end`). */
|
|
88
|
+
declare const PIN_OVER_VAR = "--motion-pin-over";
|
|
87
89
|
interface ScrollValue {
|
|
88
90
|
readonly effect: ScrollEffect;
|
|
89
91
|
/** Percent, inside `SCROLL_ZOOM`. */
|
|
@@ -100,6 +102,16 @@ interface ScrollValue {
|
|
|
100
102
|
*/
|
|
101
103
|
declare const PIN_FORMS: readonly ["track", "stick"];
|
|
102
104
|
type PinForm = (typeof PIN_FORMS)[number];
|
|
105
|
+
/**
|
|
106
|
+
* How a track ends. `over`: the next section slides over the frame in the
|
|
107
|
+
* track's last screen (default, the look every stored pin has). `away`: no
|
|
108
|
+
* slide-over screen; when the effect screens end, the frame goes up with the
|
|
109
|
+
* page and the next section follows right under it.
|
|
110
|
+
*/
|
|
111
|
+
declare const PIN_ENDS: readonly ["over", "away"];
|
|
112
|
+
type PinEnd = (typeof PIN_ENDS)[number];
|
|
113
|
+
/** A stored pin end, read: anything but `away` is `over`. */
|
|
114
|
+
declare function readPinEnd(v: unknown): PinEnd;
|
|
103
115
|
interface PinValue {
|
|
104
116
|
readonly on: boolean;
|
|
105
117
|
/** Screens, inside `PIN_LENGTH`. */
|
|
@@ -142,10 +154,12 @@ declare function pinStickVars(stick: boolean): Record<string, string>;
|
|
|
142
154
|
* stick form reads `--motion-pin-position` (it ignores `--motion-pin-on`).
|
|
143
155
|
* `above` marks a stuck box that stays painted above the sections after it
|
|
144
156
|
* (a bar); a track takes the mark only where a view draws it stuck.
|
|
157
|
+
* `end: 'away'` writes `--motion-pin-over: 0` (a track only): no slide-over.
|
|
145
158
|
*/
|
|
146
159
|
declare function pinAttrs(value: PinValue, form?: PinForm, options?: {
|
|
147
160
|
readonly stick?: boolean;
|
|
148
161
|
readonly above?: boolean;
|
|
162
|
+
readonly end?: PinEnd;
|
|
149
163
|
}): {
|
|
150
164
|
attrs: Record<string, string>;
|
|
151
165
|
style: Record<string, string>;
|
|
@@ -205,4 +219,4 @@ type HoverKind = (typeof HOVER_KINDS)[number];
|
|
|
205
219
|
/** The kinds of {@link HOVER_KINDS} in `offered`, in the list's order. */
|
|
206
220
|
declare function hoverKindsOf<K extends HoverKind>(offered: readonly K[]): readonly K[];
|
|
207
221
|
|
|
208
|
-
export { HOVER_KINDS, type HoverKind, type LayoutNode, MotionRange, PIN_ABOVE_ATTR, PIN_ABOVE_Z_VAR, PIN_ATTR, PIN_FORMS, PIN_FRAME_ATTR, PIN_LENGTH, PIN_LENGTH_VAR, PIN_ON_VAR, PIN_POSITION_VAR, PIN_STICK_VAR, PIN_TOP_VAR, PIN_TRACK_POSITION_VAR, type PinForm, type PinValue, SCROLL_ATTR, SCROLL_EFFECTS, SCROLL_EFFECTS_WITH_ZOOM, SCROLL_END, SCROLL_END_VAR, SCROLL_ORIGIN_VAR, SCROLL_PROGRESS_VAR, SCROLL_START, SCROLL_START_VAR, SCROLL_ZOOM, SCROLL_ZOOM_VAR, type ScrollBox, type ScrollEffect, type ScrollValue, armScrollProgress, hoverKindsOf, layoutBox, pinAttrs, pinStickVars, readPin, readScroll, scrollAttrs, scrollProgress };
|
|
222
|
+
export { HOVER_KINDS, type HoverKind, type LayoutNode, MotionRange, PIN_ABOVE_ATTR, PIN_ABOVE_Z_VAR, PIN_ATTR, PIN_ENDS, PIN_FORMS, PIN_FRAME_ATTR, PIN_LENGTH, PIN_LENGTH_VAR, PIN_ON_VAR, PIN_OVER_VAR, PIN_POSITION_VAR, PIN_STICK_VAR, PIN_TOP_VAR, PIN_TRACK_POSITION_VAR, type PinEnd, type PinForm, type PinValue, SCROLL_ATTR, SCROLL_EFFECTS, SCROLL_EFFECTS_WITH_ZOOM, SCROLL_END, SCROLL_END_VAR, SCROLL_ORIGIN_VAR, SCROLL_PROGRESS_VAR, SCROLL_START, SCROLL_START_VAR, SCROLL_ZOOM, SCROLL_ZOOM_VAR, type ScrollBox, type ScrollEffect, type ScrollValue, armScrollProgress, hoverKindsOf, layoutBox, pinAttrs, pinStickVars, readPin, readPinEnd, readScroll, scrollAttrs, scrollProgress };
|
package/dist/format/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{slugify}from"../chunk-24AL3CDS.js";import{ENTRANCE_ATTR as t}from"../chunk-YYGA4Y6E.js";export{ENTRANCE_ATTR,ENTRANCE_DELAY_VAR,ENTRANCE_DURATION_VAR,ENTRANCE_FROM,ENTRANCE_FROM_ATTR,ENTRANCE_FROM_DEFAULT,ENTRANCE_KINDS,ENTRANCE_KINDS_WITH_FROM,ENTRANCE_STATE_ATTR,armEntrance,entranceAttrs,playEntrance,readEntrance}from"../chunk-YYGA4Y6E.js";export{HOVER_MOTION,MOTION_EASING,MOTION_GROUPS,MOTION_TIMING,motionSeconds,rotateDegrees}from"../chunk-AIJ3G6BD.js";export{hexWithAlpha,mixHex,rgbToHex}from"../chunk-CJSZW3OS.js";export{addShowWhenFacts,isShown,lazyShowWhenContext,showWhenFactReaders,showWhenFactsContext,showWhenOf,shownForOption,truthy,withRowRules,withRowsShownWhen,withShowWhen,withShowWhenFacts}from"../chunk-HCP7WOAL.js";export{gridColumnCount}from"../chunk-VNNVG4NR.js";export{BORDER_LINE_STYLES}from"../chunk-NOMWJTN2.js";export{FOCAL_DEFAULT,FOCAL_NUDGE_COARSE,FOCAL_NUDGE_STEP,focalFromRect,formatFocal,nudgeFocal,parseFocal}from"../chunk-25RR3GQW.js";export{contrastRatio,hexToRgb,parseHexColor,readableInk,relativeLuminance}from"../chunk-S6OB6HJB.js";export{escapeHtml}from"../chunk-G6DKCCWH.js";export{currencyDecimals,currencySymbol,formatBytes,formatMoney,setCurrencyFormats,timeAgo}from"../chunk-OJI4ROSD.js";export{DATE_FORMAT_OPTIONS,TZ_AUTO,dayKeyInZone,formatDate,formatDateTime,formatTime,getUserDateFormat,getUserTimezone,instantOnDayKey,knownZone,setUserDateFormat,setUserTimezone,syncTimezoneFromProfile,userToday,userZone}from"../chunk-NHKT5IH6.js";export{EMPTY_VALUE}from"../chunk-36BRD5J3.js";export{fromDateKey,toDateKey}from"../chunk-JRQMX4PK.js";import"../chunk-LF27WIN2.js";import{parseOption as e}from"../chunk-YPXONNBV.js";export{parseOption}from"../chunk-YPXONNBV.js";export{ROOT_THEME_ATTRIBUTES,rootIsDark,watchRootTheme}from"../chunk-LNXBTK7Q.js";var o=["none","zoom-in","zoom-out","fade-in","fade-out","move-up","move-down","reveal","parallax"],n=["zoom-in","zoom-out"],r=(t,e,o,n)=>({default:t,min:e,max:o,step:n}),i=r(30,0,100,10),
|
|
1
|
+
export{slugify}from"../chunk-24AL3CDS.js";import{ENTRANCE_ATTR as t}from"../chunk-YYGA4Y6E.js";export{ENTRANCE_ATTR,ENTRANCE_DELAY_VAR,ENTRANCE_DURATION_VAR,ENTRANCE_FROM,ENTRANCE_FROM_ATTR,ENTRANCE_FROM_DEFAULT,ENTRANCE_KINDS,ENTRANCE_KINDS_WITH_FROM,ENTRANCE_STATE_ATTR,armEntrance,entranceAttrs,playEntrance,readEntrance}from"../chunk-YYGA4Y6E.js";export{HOVER_MOTION,MOTION_EASING,MOTION_GROUPS,MOTION_TIMING,motionSeconds,rotateDegrees}from"../chunk-AIJ3G6BD.js";export{hexWithAlpha,mixHex,rgbToHex}from"../chunk-CJSZW3OS.js";export{addShowWhenFacts,isShown,lazyShowWhenContext,showWhenFactReaders,showWhenFactsContext,showWhenOf,shownForOption,truthy,withRowRules,withRowsShownWhen,withShowWhen,withShowWhenFacts}from"../chunk-HCP7WOAL.js";export{gridColumnCount}from"../chunk-VNNVG4NR.js";export{BORDER_LINE_STYLES}from"../chunk-NOMWJTN2.js";export{FOCAL_DEFAULT,FOCAL_NUDGE_COARSE,FOCAL_NUDGE_STEP,focalFromRect,formatFocal,nudgeFocal,parseFocal}from"../chunk-25RR3GQW.js";export{contrastRatio,hexToRgb,parseHexColor,readableInk,relativeLuminance}from"../chunk-S6OB6HJB.js";export{escapeHtml}from"../chunk-G6DKCCWH.js";export{currencyDecimals,currencySymbol,formatBytes,formatMoney,setCurrencyFormats,timeAgo}from"../chunk-OJI4ROSD.js";export{DATE_FORMAT_OPTIONS,TZ_AUTO,dayKeyInZone,formatDate,formatDateTime,formatTime,getUserDateFormat,getUserTimezone,instantOnDayKey,knownZone,setUserDateFormat,setUserTimezone,syncTimezoneFromProfile,userToday,userZone}from"../chunk-NHKT5IH6.js";export{EMPTY_VALUE}from"../chunk-36BRD5J3.js";export{fromDateKey,toDateKey}from"../chunk-JRQMX4PK.js";import"../chunk-LF27WIN2.js";import{parseOption as e}from"../chunk-YPXONNBV.js";export{parseOption}from"../chunk-YPXONNBV.js";export{ROOT_THEME_ATTRIBUTES,rootIsDark,watchRootTheme}from"../chunk-LNXBTK7Q.js";var o=["none","zoom-in","zoom-out","fade-in","fade-out","move-up","move-down","reveal","parallax"],n=["zoom-in","zoom-out"],r=(t,e,o,n)=>({default:t,min:e,max:o,step:n}),i=r(30,0,100,10),a=r(0,0,100,5),s=r(100,0,100,5),m=r(2,0,4,.5),u="data-motion-scroll",c="data-motion-pin",f="data-motion-pin-frame",l="data-motion-pin-above",h="--motion-zoom",p="--motion-origin",d="--motion-scroll-start",N="--motion-scroll-end",T="--motion-p",E="--motion-pin-on",y="--motion-pin-top",A="--motion-pin-length",R="--motion-pin-position",g="--motion-pin-stick",w="--motion-pin-track-position",O="--motion-pin-above-z",S="--motion-pin-over",x=["track","stick"],F=["over","away"];function _(t){return e(F,"over",t)}var k=/^\s*-?\d+(\.\d+)?\s*$/;function v(t,e){const o="number"==typeof e?e:"string"==typeof e&&k.test(e)?Number(e):Number.NaN;if(!Number.isFinite(o))return t.default;const n=Math.min(t.max,Math.max(t.min,o)),r=Math.round(Number((n/t.step).toFixed(6)));return Number((r*t.step).toFixed(3))}function C(t,n,r,m){const u=e(o,"none",t),c=v(a,r),f=v(s,m);return{effect:u,zoom:v(i,n),start:Math.min(c,f),end:Math.max(c,f)}}function D(t,e){if("none"===t.effect)return{attrs:{},style:{}};const o={};var r;return r=t.effect,n.includes(r)&&(o[h]=String(Number((1+t.zoom/100).toFixed(3))),e&&(o[p]=e)),t.start!==a.default&&(o[d]=String(t.start)),t.end!==s.default&&(o[N]=String(t.end)),{attrs:{[u]:t.effect},style:o}}function I(t,e){return{on:!0===t,length:v(m,e)}}function M(t){return t?{[g]:"1",[w]:"sticky"}:{[g]:"0",[w]:"relative"}}function j(t,e="track",o={}){if(!t.on)return{attrs:{},style:{}};const n=!0===o.above?{[l]:""}:{};if("stick"===e)return{attrs:{[c]:"stick",...n},style:{}};const r={...t.length===m.default?{}:{[A]:String(t.length)},..."away"===o.end?{[S]:"0"}:{}};return{attrs:{[c]:"",...n},style:!0===o.stick?{...r,...M(!0)}:r}}function b(t,e,o,n){let r;if(e){const t=e.length*e.vh;r=t>0?((e.stop??0)-e.top)/t:1}else r=(t.vh-t.top)/(t.vh+t.height);const i=o/100,a=n/100,s=a>i?(r-i)/(a-i):r>=a?1:0;return Math.min(1,Math.max(0,Number(s.toFixed(4))))}var L=(t,e)=>{const o=Number.parseFloat(t);return Number.isFinite(o)?o:e};function P(e=document){const o=()=>{};if("undefined"==typeof window||"undefined"==typeof CSS)return o;if(CSS.supports("animation-timeline: view()"))return o;let n=0;const r=()=>{n=0;const o=window.innerHeight||document.documentElement.clientHeight,r=[];for(const n of e.querySelectorAll(`[${u}]`)){if(n.hasAttribute(t))continue;const e=getComputedStyle(n),i=n.closest(`[${c}]:not([${c}="stick"])`),u=i?getComputedStyle(i):null,l=!!u&&(0===L(u.getPropertyValue(E),1)||0!==L(u.getPropertyValue(g),0)),h=W(l&&i?i:n,o),p=i?.querySelector(`[${f}]`),T=i&&!l?{...W(i,o),length:L(u.getPropertyValue(A),m.default),stop:p?L(getComputedStyle(p).top,0):0}:null;r.push({el:n,p:b({top:h.top,height:h.height,vh:o},T,L(e.getPropertyValue(d),a.default),L(e.getPropertyValue(N),s.default))})}for(const{el:t,p:e}of r)t.style.setProperty(T,String(e))},i=()=>{n||(n=requestAnimationFrame(r))};return r(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),()=>{n&&cancelAnimationFrame(n),window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}}function W(t,e,o=("undefined"==typeof window?0:window.scrollY)){let n=0;for(let e=t;e;e=e.offsetParent)n+=e.offsetTop;return{top:n-o,height:t.offsetHeight,vh:e}}var z=["none","nextImage","rotate","zoom","lift","mono"];function H(t){return z.filter(e=>t.includes(e))}export{z as HOVER_KINDS,l as PIN_ABOVE_ATTR,O as PIN_ABOVE_Z_VAR,c as PIN_ATTR,F as PIN_ENDS,x as PIN_FORMS,f as PIN_FRAME_ATTR,m as PIN_LENGTH,A as PIN_LENGTH_VAR,E as PIN_ON_VAR,S as PIN_OVER_VAR,R as PIN_POSITION_VAR,g as PIN_STICK_VAR,y as PIN_TOP_VAR,w as PIN_TRACK_POSITION_VAR,u as SCROLL_ATTR,o as SCROLL_EFFECTS,n as SCROLL_EFFECTS_WITH_ZOOM,s as SCROLL_END,N as SCROLL_END_VAR,p as SCROLL_ORIGIN_VAR,T as SCROLL_PROGRESS_VAR,a as SCROLL_START,d as SCROLL_START_VAR,i as SCROLL_ZOOM,h as SCROLL_ZOOM_VAR,P as armScrollProgress,H as hoverKindsOf,W as layoutBox,j as pinAttrs,M as pinStickVars,I as readPin,_ as readPinEnd,C as readScroll,D as scrollAttrs,b as scrollProgress};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -27,4 +27,45 @@ import { EffectCallback, DependencyList } from 'react';
|
|
|
27
27
|
*/
|
|
28
28
|
declare function useBrowserLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* A history that lives outside the shell's form stack — an editor's document
|
|
32
|
+
* store — answered by the shell's keys. Read at each key press, so the
|
|
33
|
+
* functions may close over live state and need not be stable.
|
|
34
|
+
*/
|
|
35
|
+
interface UndoSource {
|
|
36
|
+
undo: () => void;
|
|
37
|
+
redo: () => void;
|
|
38
|
+
/** False leaves the key alone (no `preventDefault`), as an empty stack does:
|
|
39
|
+
* nothing to step to, or the document may not be written right now. */
|
|
40
|
+
canUndo: () => boolean;
|
|
41
|
+
canRedo: () => boolean;
|
|
42
|
+
}
|
|
43
|
+
/** Something that dispatches `keydown`: a frame's `Document`, or an element. */
|
|
44
|
+
type KeyTarget = Pick<EventTarget, 'addEventListener' | 'removeEventListener'>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Put a history the shell does not hold under the shell's undo keys.
|
|
48
|
+
*
|
|
49
|
+
* The shell is the one owner of ⌘Z / Ctrl+Z (undo) and ⇧⌘Z / Ctrl+Shift+Z /
|
|
50
|
+
* Ctrl+Y (redo), and undo has no buttons. An editor that keeps its own history
|
|
51
|
+
* (efficient-easel's document store) does not bind the keys itself; it hands
|
|
52
|
+
* the history over:
|
|
53
|
+
*
|
|
54
|
+
* useUndoHistory(
|
|
55
|
+
* { undo: history.back, redo: history.forward,
|
|
56
|
+
* canUndo: () => canWrite() && history.hasPast,
|
|
57
|
+
* canRedo: () => canWrite() && history.hasFuture },
|
|
58
|
+
* [canvasFrameDocument],
|
|
59
|
+
* );
|
|
60
|
+
*
|
|
61
|
+
* Inside a window, the window's stack answers the keys with this history while
|
|
62
|
+
* the caller is mounted. `keyTargets` are other places a key can be pressed
|
|
63
|
+
* that never reach `window` — an iframe's document — and they answer for the
|
|
64
|
+
* same window; pass the same number of them on every render. Outside any `UndoProvider` (a page with no shell windows) the
|
|
65
|
+
* hook binds `window` and the targets itself, with the same key rule
|
|
66
|
+
* (`matchUndoHotkey`), so there is still one rule. A press in a text field is
|
|
67
|
+
* that field's own undo either way.
|
|
68
|
+
*/
|
|
69
|
+
declare function useUndoHistory(source: UndoSource, keyTargets?: ReadonlyArray<KeyTarget | null | undefined>): void;
|
|
70
|
+
|
|
71
|
+
export { type KeyTarget, type UndoSource, useBrowserLayoutEffect, useUndoHistory };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{useBrowserLayoutEffect}from"../chunk-PU2GJVMG.js";
|
|
2
|
+
export{useUndoHistory}from"../chunk-ZLB5GRL6.js";export{useBrowserLayoutEffect}from"../chunk-PU2GJVMG.js";import"../chunk-3AUPCKBR.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -247,7 +247,7 @@ import * as _tanstack_query_core from '@tanstack/query-core';
|
|
|
247
247
|
export { A as AnonymousClientTelemetryConfig, C as ClientTelemetry, a as ClientTelemetryConfig, S as SignedInClientTelemetryConfig, s as startClientTelemetry } from './client-DZeDEyG1.js';
|
|
248
248
|
export { B as BORDER_LINE_STYLES, a as BorderLineStyle } from './borderLineStyles-C-W0uSzL.js';
|
|
249
249
|
export { B as BRAND_ICON_NAMES, a as BrandIconName, i as isBrandIconName } from './brand-icon-names-hvdry30t.js';
|
|
250
|
-
export { useBrowserLayoutEffect } from './hooks/index.js';
|
|
250
|
+
export { KeyTarget, UndoSource, useBrowserLayoutEffect, useUndoHistory } from './hooks/index.js';
|
|
251
251
|
import './optionItems-Cxd85rTy.js';
|
|
252
252
|
import './moveGrip-sB7jfCia.js';
|
|
253
253
|
import 'web-vitals';
|
|
@@ -743,6 +743,10 @@ interface WindowControlsInset {
|
|
|
743
743
|
rowClass: string;
|
|
744
744
|
/** Width in px of the floating controls, 0 while they are not over the element. */
|
|
745
745
|
controlsWidth: number;
|
|
746
|
+
/** The window's name as plain text, to draw beside the controls. */
|
|
747
|
+
title?: string;
|
|
748
|
+
/** The window is the active one. */
|
|
749
|
+
active?: boolean;
|
|
746
750
|
}
|
|
747
751
|
/**
|
|
748
752
|
* Claim the window controls for `ref`'s element while `enabled`. The claim is
|
|
@@ -865,6 +869,20 @@ declare class WindowErrorBoundary extends Component<WindowErrorBoundaryProps, {
|
|
|
865
869
|
render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
866
870
|
}
|
|
867
871
|
|
|
872
|
+
interface Shortcut {
|
|
873
|
+
keys: string;
|
|
874
|
+
description: string;
|
|
875
|
+
}
|
|
876
|
+
interface ShortcutSection {
|
|
877
|
+
title: string;
|
|
878
|
+
shortcuts: Shortcut[];
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* The shell's shortcuts — the one list. A host that draws its own sheet (the
|
|
882
|
+
* admin portal adds its Windows and Help sections) starts from this rather
|
|
883
|
+
* than copying it, so a key the shell adds shows up there too.
|
|
884
|
+
*/
|
|
885
|
+
declare const SHELL_SHORTCUT_SECTIONS: ShortcutSection[];
|
|
868
886
|
declare function ShortcutHelp(): react_jsx_runtime.JSX.Element;
|
|
869
887
|
|
|
870
888
|
interface ShellContextMenuProps {
|
|
@@ -2188,33 +2206,23 @@ interface MergeBulkOptions<T extends BaseItem> {
|
|
|
2188
2206
|
declare function mergeBulkItems<T extends BaseItem>(options: MergeBulkOptions<T>): MergeBulkResult<T>;
|
|
2189
2207
|
|
|
2190
2208
|
interface UndoControlsProps {
|
|
2191
|
-
/**
|
|
2209
|
+
/** Ignored since undo became keys only. Kept so existing call sites compile. */
|
|
2192
2210
|
className?: string;
|
|
2193
|
-
/**
|
|
2194
|
-
* Set by the shell on the pair it mounts itself — the window footer's, or a
|
|
2195
|
-
* nested provider's. A form's own `<UndoControls />` leaves it unset and
|
|
2196
|
-
* claims the stack, and the shell then mounts nothing for it — so a form
|
|
2197
|
-
* written before the shell did this keeps its pair where it put it, and
|
|
2198
|
-
* shows one rather than two.
|
|
2199
|
-
*/
|
|
2211
|
+
/** Ignored since undo became keys only. */
|
|
2200
2212
|
auto?: boolean;
|
|
2201
2213
|
}
|
|
2202
2214
|
/**
|
|
2203
|
-
* Undo
|
|
2204
|
-
*
|
|
2205
|
-
* The shell mounts this pair itself, in the window footer's left slot, for any
|
|
2206
|
-
* window whose form has registered state and whose user may edit it — a form
|
|
2207
|
-
* has nothing to add for the buttons to appear. Mount it by hand only for a
|
|
2208
|
-
* place the footer is not: a section header, a toolbar of a page with no
|
|
2209
|
-
* window footer. The keys work without it; this is for discoverability and for
|
|
2210
|
-
* the mouse. Both buttons stay rendered and go disabled, so the row does not
|
|
2211
|
-
* reflow the moment there is something to undo.
|
|
2215
|
+
* @deprecated Undo and redo are keyboard only (⌘Z, ⇧⌘Z, Ctrl+Y), and the
|
|
2216
|
+
* shell owns the keys (`UndoProvider`). This renders nothing. Remove the call.
|
|
2212
2217
|
*
|
|
2213
|
-
*
|
|
2214
|
-
*
|
|
2215
|
-
*
|
|
2218
|
+
* It drew an Undo/Redo pair in a form's footer. On 2026-11-24 Victor Mau ruled
|
|
2219
|
+
* that undo needs no buttons and has one owner: the shell's per-window stack,
|
|
2220
|
+
* which every window already has through `WindowManager`. The export stays as
|
|
2221
|
+
* a no-op so the portals keep building while they drop their calls.
|
|
2222
|
+
* Delete by 2027-01-31, after admin, customer and supplier drop their calls
|
|
2223
|
+
* (the undo-hotkeys rollout owns that move).
|
|
2216
2224
|
*/
|
|
2217
|
-
declare function UndoControls(
|
|
2225
|
+
declare function UndoControls(_props: UndoControlsProps): null;
|
|
2218
2226
|
|
|
2219
2227
|
/** Result of a single health poll. `latencyMs` is optional; when omitted on
|
|
2220
2228
|
* an ok result the indicator simply shows no latency for that poll. */
|
|
@@ -2562,6 +2570,96 @@ interface UndoState {
|
|
|
2562
2570
|
past: UndoStep[];
|
|
2563
2571
|
future: UndoStep[];
|
|
2564
2572
|
}
|
|
2573
|
+
/** The parts of a keydown the matcher reads. */
|
|
2574
|
+
interface UndoHotkeyEvent {
|
|
2575
|
+
key: string;
|
|
2576
|
+
metaKey: boolean;
|
|
2577
|
+
ctrlKey: boolean;
|
|
2578
|
+
shiftKey: boolean;
|
|
2579
|
+
altKey: boolean;
|
|
2580
|
+
target: {
|
|
2581
|
+
tagName?: string;
|
|
2582
|
+
isContentEditable?: boolean;
|
|
2583
|
+
/** Present on an Element: the rule asks for an editable ancestor, which a
|
|
2584
|
+
* browser folds into `isContentEditable` and jsdom does not. */
|
|
2585
|
+
closest?: (selector: string) => {
|
|
2586
|
+
getAttribute: (name: string) => string | null;
|
|
2587
|
+
} | null;
|
|
2588
|
+
} | null;
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Which action a keydown asks for, or null for none.
|
|
2592
|
+
*
|
|
2593
|
+
* ⌘Z / Ctrl+Z undoes, ⇧⌘Z / Ctrl+Shift+Z / Ctrl+Y redoes — except while the
|
|
2594
|
+
* caret is in a field. Inside an input, a textarea, or a grid cell, ⌘Z means
|
|
2595
|
+
* "take back what I just typed", and the browser does that better than we
|
|
2596
|
+
* could. Leaving the field ends that run and turns it into one step here, so
|
|
2597
|
+
* the next ⌘Z outside the field takes the whole edit back.
|
|
2598
|
+
*/
|
|
2599
|
+
declare function matchUndoHotkey(e: UndoHotkeyEvent): 'undo' | 'redo' | null;
|
|
2600
|
+
|
|
2601
|
+
/**
|
|
2602
|
+
* The slice hooks of the window undo stack, in a leaf module that reaches
|
|
2603
|
+
* React and the context and nothing else.
|
|
2604
|
+
*
|
|
2605
|
+
* Moved out of `UndoProvider.tsx` (2026-11-24) so a kit module — the image
|
|
2606
|
+
* annotator, which `efficient-shell/ui` ships — can put its state under the
|
|
2607
|
+
* window's stack without importing the provider, `Modal` and the window
|
|
2608
|
+
* manager behind it. `UndoProvider.tsx` re-exports both; import them from
|
|
2609
|
+
* there or the barrel as before.
|
|
2610
|
+
*/
|
|
2611
|
+
interface UndoableOptions {
|
|
2612
|
+
/** Names the step in a button title: `"qty"`, `"line items"`. */
|
|
2613
|
+
label: string;
|
|
2614
|
+
/**
|
|
2615
|
+
* Consecutive changes sharing a key fold into one step — pass the field name
|
|
2616
|
+
* so a run of typing is one Undo rather than one per keystroke. Omit for a
|
|
2617
|
+
* change that is already whole, like a bulk import or a deleted row.
|
|
2618
|
+
*/
|
|
2619
|
+
coalesceKey?: string | null;
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* Put one piece of the form's state under the window's undo stack.
|
|
2623
|
+
*
|
|
2624
|
+
* `value` is watched; when it changes, the form as it stood beforehand becomes
|
|
2625
|
+
* a step. `apply` puts a value back — the same setter the form already uses.
|
|
2626
|
+
*
|
|
2627
|
+
* const [items, setItems] = useState<Line[]>([]);
|
|
2628
|
+
* useUndoable(items, setItems, { label: 'line items' });
|
|
2629
|
+
*
|
|
2630
|
+
* Registering more than one slice is the point: a step snapshots all of them
|
|
2631
|
+
* together, so undoing restores a coherent form rather than one slice out of
|
|
2632
|
+
* step with the rest.
|
|
2633
|
+
*
|
|
2634
|
+
* `value` must be the state itself, not something derived from it on the way
|
|
2635
|
+
* in. A change is detected by identity, so `useUndoable(rows.filter(r => r.on),
|
|
2636
|
+
* ...)` hands over a new array on every render and reads as a change every
|
|
2637
|
+
* time — and since recording a step re-renders the provider, that closes a
|
|
2638
|
+
* loop at render speed. The provider trips a runaway guard and says so rather
|
|
2639
|
+
* than letting the tab hang, but the fix is at the call site: register the
|
|
2640
|
+
* state, and derive from it afterwards.
|
|
2641
|
+
*/
|
|
2642
|
+
declare function useUndoable<T>(value: T, apply: (next: T) => void, opts: UndoableOptions): void;
|
|
2643
|
+
/**
|
|
2644
|
+
* `useState`, with the value in the window's undo stack.
|
|
2645
|
+
*
|
|
2646
|
+
* Written to be a rename rather than an extra line, because the forms this is
|
|
2647
|
+
* for hold their state in dozens of separate `useState` calls — one of them has
|
|
2648
|
+
* forty-three. Adopting a form is then a per-line edit:
|
|
2649
|
+
*
|
|
2650
|
+
* const [supplier, setSupplier] = useState('');
|
|
2651
|
+
* const [supplier, setSupplier] = useUndoableState('', { label: 'supplier' });
|
|
2652
|
+
*
|
|
2653
|
+
* Which also makes the choice legible: state left as plain `useState` is state
|
|
2654
|
+
* deliberately kept out of the history. Keep it that way for anything that is
|
|
2655
|
+
* not the user's input — a search box, fetched data, validation output, an
|
|
2656
|
+
* initialisation guard. Undoing those puts stale results back on screen, and a
|
|
2657
|
+
* reverted guard can re-fire the effect it exists to suppress.
|
|
2658
|
+
*
|
|
2659
|
+
* Pass `coalesceKey` for anything typed into, so a run of keystrokes is one
|
|
2660
|
+
* Undo; the field's own name is the obvious key.
|
|
2661
|
+
*/
|
|
2662
|
+
declare function useUndoableState<T>(initial: T | (() => T), opts: UndoableOptions): [T, React.Dispatch<React.SetStateAction<T>>];
|
|
2565
2663
|
|
|
2566
2664
|
interface UndoProviderProps {
|
|
2567
2665
|
children: React.ReactNode;
|
|
@@ -2693,57 +2791,5 @@ declare function useUndo(): UndoControlsApi;
|
|
|
2693
2791
|
* the footer for the pair with it.
|
|
2694
2792
|
*/
|
|
2695
2793
|
declare function useUndoCanEdit(canEdit: boolean): void;
|
|
2696
|
-
interface UndoableOptions {
|
|
2697
|
-
/** Names the step in a button title: `"qty"`, `"line items"`. */
|
|
2698
|
-
label: string;
|
|
2699
|
-
/**
|
|
2700
|
-
* Consecutive changes sharing a key fold into one step — pass the field name
|
|
2701
|
-
* so a run of typing is one Undo rather than one per keystroke. Omit for a
|
|
2702
|
-
* change that is already whole, like a bulk import or a deleted row.
|
|
2703
|
-
*/
|
|
2704
|
-
coalesceKey?: string | null;
|
|
2705
|
-
}
|
|
2706
|
-
/**
|
|
2707
|
-
* Put one piece of the form's state under the window's undo stack.
|
|
2708
|
-
*
|
|
2709
|
-
* `value` is watched; when it changes, the form as it stood beforehand becomes
|
|
2710
|
-
* a step. `apply` puts a value back — the same setter the form already uses.
|
|
2711
|
-
*
|
|
2712
|
-
* const [items, setItems] = useState<Line[]>([]);
|
|
2713
|
-
* useUndoable(items, setItems, { label: 'line items' });
|
|
2714
|
-
*
|
|
2715
|
-
* Registering more than one slice is the point: a step snapshots all of them
|
|
2716
|
-
* together, so undoing restores a coherent form rather than one slice out of
|
|
2717
|
-
* step with the rest.
|
|
2718
|
-
*
|
|
2719
|
-
* `value` must be the state itself, not something derived from it on the way
|
|
2720
|
-
* in. A change is detected by identity, so `useUndoable(rows.filter(r => r.on),
|
|
2721
|
-
* ...)` hands over a new array on every render and reads as a change every
|
|
2722
|
-
* time — and since recording a step re-renders the provider, that closes a
|
|
2723
|
-
* loop at render speed. The provider trips a runaway guard and says so rather
|
|
2724
|
-
* than letting the tab hang, but the fix is at the call site: register the
|
|
2725
|
-
* state, and derive from it afterwards.
|
|
2726
|
-
*/
|
|
2727
|
-
declare function useUndoable<T>(value: T, apply: (next: T) => void, opts: UndoableOptions): void;
|
|
2728
|
-
/**
|
|
2729
|
-
* `useState`, with the value in the window's undo stack.
|
|
2730
|
-
*
|
|
2731
|
-
* Written to be a rename rather than an extra line, because the forms this is
|
|
2732
|
-
* for hold their state in dozens of separate `useState` calls — one of them has
|
|
2733
|
-
* forty-three. Adopting a form is then a per-line edit:
|
|
2734
|
-
*
|
|
2735
|
-
* const [supplier, setSupplier] = useState('');
|
|
2736
|
-
* const [supplier, setSupplier] = useUndoableState('', { label: 'supplier' });
|
|
2737
|
-
*
|
|
2738
|
-
* Which also makes the choice legible: state left as plain `useState` is state
|
|
2739
|
-
* deliberately kept out of the history. Keep it that way for anything that is
|
|
2740
|
-
* not the user's input — a search box, fetched data, validation output, an
|
|
2741
|
-
* initialisation guard. Undoing those puts stale results back on screen, and a
|
|
2742
|
-
* reverted guard can re-fire the effect it exists to suppress.
|
|
2743
|
-
*
|
|
2744
|
-
* Pass `coalesceKey` for anything typed into, so a run of keystrokes is one
|
|
2745
|
-
* Undo; the field's own name is the obvious key.
|
|
2746
|
-
*/
|
|
2747
|
-
declare function useUndoableState<T>(initial: T | (() => T), opts: UndoableOptions): [T, React.Dispatch<React.SetStateAction<T>>];
|
|
2748
2794
|
|
|
2749
|
-
export { type ActivityKind, type AsyncEnvironment, BLOCKED_PCT_CPU, type BatteryInfo, BehaviorPanel, type BottleneckKind, type BulkColumn, type BulkColumnKind, BulkImportGrid, type BulkImportGridProps, type BulkRow, CancelButton, ChangePasswordForm, type ChangePasswordFormProps, type ChangelogEntry, type ClockCalendarConfig, CopyButton, Customization, type CustomizationOmitSection, type CustomizationProps, type CustomizationSection, DEV_BANNER_TEXT, Desktop, type DesktopContextMenuItem, type DesktopHostConfig, DesktopHostProvider, DevIndicator, DocFavStar, DropdownMenuEntry, type DuplicateGroup, EditState, type EntityFetcher, type EntityRefetchIntervalOption, type EntityRefetchOnWindowFocusOption, EntityWindowFallback, type EntityWindowFallbackProps, EntityWindowLoading, EntityWindowState, type EntityWindowStateProps, FilterBar, type FilterOption, type FpsGroup, type HealthCheckResult, IN_BROWSER, LOG_CAP, Layout, type LayoutMode, type LayoutProps, type LogSummary, MIN_EVENT_SAMPLES, MIN_GROUP_SAMPLES, MODAL_SUBMIT_SELECTOR, type MenuLayer, type MergeBulkOptions, type MergeBulkResult, type MobileAppConfig, Modal, ModalActions, type ModalEdit, ModalMoreActions, NotificationBell, type NotificationsConfig, type OpenPageOptions, PaginatedResponse, PdfActionButton, type PdfActionButtonProps, type PerfEnvironment, type PerfLogRecord, type PerfReading, type PerfReport, PerfStats, type PerfStatsProps, type PlatformHints, SMOOTH_FPS, SearchConfig, ServerStatusIndicator, type ServerStatusIndicatorProps, type ServerStatusUser, type ShellAuth, ShellAuthProvider, type ShellBranding, ShellContextMenu, type ShellContextMenuProps, ShellEntityFetcherProvider, type ShellNotification, ShortcutHelp, SoundsPanel, type StagedTarget, StartMenu, type StickyEntityRef, type StickyResolver, SystemPreferences, type SystemPreferencesProps, type SystemPreferencesSection, type TitleParts, type TitleRole, type TodoProvider, type TodoTask, UndoControls, type UndoControlsApi, type UndoControlsProps, UndoProvider, type UndoProviderProps, type UndoSnapshot, type UndoState, type UndoStep, type UndoableOptions, type Verdict, WidgetManager, type WindowControlsInset, WindowCrashedFallback, WindowEditSlot, WindowErrorBoundary, WindowManagerProvider, WindowRegistry, type WindowTarget, type WindowTargetOptions, WindowTitle, activateWindowById, appendRecord as appendPerfRecord, applyDevTitle, beginWindowGesture, classifyActivity, classify as classifyPerf, commitExposeHighlight, copyToClipboard, createWindowRegistry, createWindowTarget, describeMachine, describePerfReport, exitExposeMode, findDuplicateKeys, getActiveWindowRoute, getExposeHighlight, getWindowPosition, installThemeIconSets, isDevEnv, isInteracting, layoutModeOf, markMenuOpen, mergeBulkItems, notificationRowParts, toCsv as perfLogToCsv, perfReportFile, readEnvironment as readPerfEnvironment, requestAsyncEnvironment, requestWindowFront, setExposeHighlight, setShellAuthBridge, setShellNavIcons, setShellTodoProvider, setWindowDefaultPosition, setWindowPosition, splitTitle, subscribeExposeHighlight, summariseFrames, summariseLog as summarisePerfLog, toggleExposeMode, useCurrentTabKey, useDesktopHost, useEditHotkey, useEnclosingModalId, useFilters, useInfiniteScroll, useIsActiveWindow, useModalActive, useModalDuplicate, useModalSave, useNewHotkey, usePageSearch, useSetLayoutMode, useShellAuth, useShellEntityFetcher, useUndo, useUndoCanEdit, useUndoable, useUndoableState, useWidgetSettings, useWindowControlsInset, useWindowDirty, useWindowManager, useWindowMenuItem, useWindowTarget, useWindowTitle };
|
|
2795
|
+
export { type ActivityKind, type AsyncEnvironment, BLOCKED_PCT_CPU, type BatteryInfo, BehaviorPanel, type BottleneckKind, type BulkColumn, type BulkColumnKind, BulkImportGrid, type BulkImportGridProps, type BulkRow, CancelButton, ChangePasswordForm, type ChangePasswordFormProps, type ChangelogEntry, type ClockCalendarConfig, CopyButton, Customization, type CustomizationOmitSection, type CustomizationProps, type CustomizationSection, DEV_BANNER_TEXT, Desktop, type DesktopContextMenuItem, type DesktopHostConfig, DesktopHostProvider, DevIndicator, DocFavStar, DropdownMenuEntry, type DuplicateGroup, EditState, type EntityFetcher, type EntityRefetchIntervalOption, type EntityRefetchOnWindowFocusOption, EntityWindowFallback, type EntityWindowFallbackProps, EntityWindowLoading, EntityWindowState, type EntityWindowStateProps, FilterBar, type FilterOption, type FpsGroup, type HealthCheckResult, IN_BROWSER, LOG_CAP, Layout, type LayoutMode, type LayoutProps, type LogSummary, MIN_EVENT_SAMPLES, MIN_GROUP_SAMPLES, MODAL_SUBMIT_SELECTOR, type MenuLayer, type MergeBulkOptions, type MergeBulkResult, type MobileAppConfig, Modal, ModalActions, type ModalEdit, ModalMoreActions, NotificationBell, type NotificationsConfig, type OpenPageOptions, PaginatedResponse, PdfActionButton, type PdfActionButtonProps, type PerfEnvironment, type PerfLogRecord, type PerfReading, type PerfReport, PerfStats, type PerfStatsProps, type PlatformHints, SHELL_SHORTCUT_SECTIONS, SMOOTH_FPS, SearchConfig, ServerStatusIndicator, type ServerStatusIndicatorProps, type ServerStatusUser, type ShellAuth, ShellAuthProvider, type ShellBranding, ShellContextMenu, type ShellContextMenuProps, ShellEntityFetcherProvider, type ShellNotification, type Shortcut, ShortcutHelp, type ShortcutSection, SoundsPanel, type StagedTarget, StartMenu, type StickyEntityRef, type StickyResolver, SystemPreferences, type SystemPreferencesProps, type SystemPreferencesSection, type TitleParts, type TitleRole, type TodoProvider, type TodoTask, UndoControls, type UndoControlsApi, type UndoControlsProps, UndoProvider, type UndoProviderProps, type UndoSnapshot, type UndoState, type UndoStep, type UndoableOptions, type Verdict, WidgetManager, type WindowControlsInset, WindowCrashedFallback, WindowEditSlot, WindowErrorBoundary, WindowManagerProvider, WindowRegistry, type WindowTarget, type WindowTargetOptions, WindowTitle, activateWindowById, appendRecord as appendPerfRecord, applyDevTitle, beginWindowGesture, classifyActivity, classify as classifyPerf, commitExposeHighlight, copyToClipboard, createWindowRegistry, createWindowTarget, describeMachine, describePerfReport, exitExposeMode, findDuplicateKeys, getActiveWindowRoute, getExposeHighlight, getWindowPosition, installThemeIconSets, isDevEnv, isInteracting, layoutModeOf, markMenuOpen, matchUndoHotkey, mergeBulkItems, notificationRowParts, toCsv as perfLogToCsv, perfReportFile, readEnvironment as readPerfEnvironment, requestAsyncEnvironment, requestWindowFront, setExposeHighlight, setShellAuthBridge, setShellNavIcons, setShellTodoProvider, setWindowDefaultPosition, setWindowPosition, splitTitle, subscribeExposeHighlight, summariseFrames, summariseLog as summarisePerfLog, toggleExposeMode, useCurrentTabKey, useDesktopHost, useEditHotkey, useEnclosingModalId, useFilters, useInfiniteScroll, useIsActiveWindow, useModalActive, useModalDuplicate, useModalSave, useNewHotkey, usePageSearch, useSetLayoutMode, useShellAuth, useShellEntityFetcher, useUndo, useUndoCanEdit, useUndoable, useUndoableState, useWidgetSettings, useWindowControlsInset, useWindowDirty, useWindowManager, useWindowMenuItem, useWindowTarget, useWindowTitle };
|