@vitrinka/web 0.9.2 → 0.9.3
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/CHANGELOG.md +9 -0
- package/README.md +6 -4
- package/build/hud.iife.js +15 -15
- package/build/one.iife.js +1 -1
- package/build/recorder/hud/host-style.d.ts +1 -1
- package/build/recorder/hud/host-style.js +1 -1
- package/build/recorder/hud/host.d.ts +3 -2
- package/build/recorder/hud/host.js +6 -2
- package/build/recorder/version.d.ts +2 -2
- package/build/recorder/version.js +1 -1
- package/build/report/widget.d.ts +4 -4
- package/build/report/widget.js +4 -4
- package/build/report-widget.mjs +9 -9
- package/package.json +1 -1
package/build/one.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var{defineProperty:
|
|
1
|
+
(()=>{var{defineProperty:E,getOwnPropertyNames:z,getOwnPropertyDescriptor:K}=Object,B=Object.prototype.hasOwnProperty;function j(e){return this[e]}var G=(e)=>{var n=(S??=new WeakMap).get(e),t;if(n)return n;if(n=E({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var o of z(e))if(!B.call(n,o))E(n,o,{get:j.bind(e,o),enumerable:!(t=K(e,o))||t.enumerable})}return S.set(e,n),n},S;var J=(e)=>e;function W(e,n){this[e]=J.bind(null,n)}var F=(e,n)=>{for(var t in n)E(e,t,{get:n[t],enumerable:!0,configurable:!0,set:W.bind(n,t)})};var cn={};var _={};F(_,{ACK_EVENT:()=>C,COMMAND_EVENT:()=>x,HELLO_EVENT:()=>c,LEAD_ATTR:()=>l,ONE_VERSION:()=>u,PAGE_ATTR:()=>d,announce:()=>H,answeredBy:()=>D,ask:()=>M,documentEnv:()=>Z,holderAnswers:()=>V,isLive:()=>k,markPage:()=>rn,nonce:()=>h,pageMarked:()=>an,parseAck:()=>N,parseClaim:()=>L,parseCommand:()=>P,parseHello:()=>A,readClaim:()=>b,releaseClaim:()=>tn,sendCommand:()=>ln,serializeClaim:()=>I,serveCommands:()=>dn,serveHello:()=>un,takeClaim:()=>nn,unmarkPage:()=>sn,updateClaim:()=>en,watchClaim:()=>on});function w(e,n,t,o={}){let i=e,r=i.__zone_symbol__addEventListener??e.addEventListener,a=i.__zone_symbol__removeEventListener??e.removeEventListener,m=o.capture??!1;return r.call(e,n,t,{capture:m,passive:!1}),()=>a.call(e,n,t,m)}var u=1,d="data-vitrinka-page",l="data-vitrinka-lead",c="vitrinka:hello",x="vitrinka:command",C="vitrinka:ack";function Z(){let n=globalThis.document?.documentElement;if(!n||typeof globalThis.dispatchEvent!=="function")return null;return{root:n,bus:globalThis}}function h(e){return`${e}.${Math.random().toString(36).slice(2,10)}`}var q=["page","extension"],Q=["starting","recording","paused","stopping","saved"],U=["pause","stop","note"],X=["not_recording","stopping","not_here","bad_command"];function v(e){if(typeof e!=="string")return null;try{let n=JSON.parse(e);return n!==null&&typeof n==="object"&&!Array.isArray(n)?n:null}catch{return null}}var s=(e)=>typeof e==="string",f=(e)=>s(e)&&q.includes(e),T=(e)=>s(e)&&Q.includes(e),g=(e)=>typeof e==="number"&&Number.isInteger(e)&&e>=1;function L(e){let n=v(e);if(!n||!g(n.v)||!f(n.by)||!s(n.id)||!n.id||!T(n.state))return null;return{v:n.v,by:n.by,id:n.id,state:n.state,sessionId:s(n.sessionId)?n.sessionId:Number.isFinite(n.sessionId)?String(n.sessionId):"",since:typeof n.since==="number"?n.since:0}}function I(e){return JSON.stringify({v:e.v,by:e.by,id:e.id,state:e.state,sessionId:e.sessionId,since:e.since})}function k(e){return e!==void 0&&e!==null&&e!=="saved"}function Y(e){if(e===null||typeof e!=="object"||Array.isArray(e))return null;let n=e;if(!f(n.by)||!T(n.state))return null;return{by:n.by,state:n.state,here:n.here===!0,...s(n.id)&&n.id?{id:n.id}:{}}}function A(e){let n=v(e);if(!n||!g(n.v)||!f(n.from)||!s(n.inst)||!n.inst)return null;let t=Y(n.live);return{v:n.v,from:n.from,inst:n.inst,...n.ask===!0?{ask:!0}:{},...n.live!==void 0?{live:t}:{},...n.gone===!0?{gone:!0}:{}}}function P(e){let n=v(e);if(!n||!g(n.v)||!f(n.from)||!s(n.inst)||!n.inst||!s(n.id)||!n.id)return null;if(!s(n.op)||!U.includes(n.op))return null;return{v:n.v,from:n.from,inst:n.inst,id:n.id,op:n.op,...s(n.text)?{text:n.text}:{}}}function N(e){let n=v(e);if(!n||!g(n.v)||!f(n.from)||!s(n.inst)||!s(n.id)||typeof n.ok!=="boolean")return null;return{v:n.v,from:n.from,inst:n.inst,id:n.id,ok:n.ok,...s(n.code)&&X.includes(n.code)?{code:n.code}:{},...s(n.error)?{error:n.error}:{}}}function b(e){return L(e.root.getAttribute(l))}function R(e,n){let t=I(n);if(e.root.getAttribute(l)!==t)e.root.setAttribute(l,t)}function nn(e,n,t){let o=b(e);if(o&&o.id!==t.id&&k(o.state)&&V(e,n,o))return{ok:!1,holder:o};let i={v:u,by:n.from,id:t.id,state:t.state,sessionId:t.sessionId??"",since:o?.id===t.id&&k(o.state)?o.since:Date.now()};return R(e,i),{ok:!0,claim:i}}function en(e,n,t){let o=b(e);if(o?.id!==n)return!1;return R(e,{...o,v:u,state:t.state,sessionId:t.sessionId??o.sessionId}),!0}function tn(e,n){if(b(e)?.id!==n)return!1;return e.root.removeAttribute(l),!0}function on(e,n){if(e.watch)return e.watch(n);if(typeof MutationObserver!=="function"||typeof Node>"u"||!(e.root instanceof Node))return()=>{return};let t=new MutationObserver(n);return t.observe(e.root,{attributes:!0,attributeFilter:[l]}),()=>t.disconnect()}function rn(e,n){if(e.root.getAttribute(d)!==n)e.root.setAttribute(d,n)}function sn(e){e.root.removeAttribute(d)}function an(e){return e.root.getAttribute(d)!==null}function y(e,n,t){e.bus.dispatchEvent(new CustomEvent(n,{detail:JSON.stringify(t)}))}function O(e,n,t){return w(e.bus,n,(o)=>t(o.detail))}function M(e,n){let t=[],o=O(e,c,(i)=>{let r=A(i);if(r&&!r.ask&&r.inst!==n.inst)t.push(r)});try{y(e,c,{v:u,from:n.from,inst:n.inst,ask:!0})}finally{o()}return t}function H(e,n,t,o={}){y(e,c,{v:u,from:n.from,inst:n.inst,live:t,...o.gone?{gone:!0}:{}})}function un(e,n,t,o,i={}){return O(e,c,(r)=>{let a=A(r);if(!a||a.inst===n.inst)return;if(!a.ask)o?.(a);else if(i.answerIf?.()??!0)H(e,n,t())})}function D(e,n){return e.some((t)=>t.live?.here===!0&&(t.live.id?t.live.id===n.id:t.from===n.by))}function V(e,n,t){return D(M(e,n),t)}function ln(e,n,t,o){let i=h("c"),r=null,a=O(e,C,(m)=>{let p=N(m);if(p&&p.id===i&&p.inst!==n.inst&&!r)r=p});try{y(e,x,{v:u,from:n.from,inst:n.inst,id:i,op:t,...o!==void 0?{text:o}:{}})}finally{a()}return r}function dn(e,n,t){return O(e,x,(o)=>{let i=P(o);if(!i||i.inst===n.inst)return;let r=t(i);if(!r)return;y(e,C,{v:u,from:n.from,inst:n.inst,id:i.id,...r})})}globalThis.VitrinkaOne=Object.freeze({..._});})();
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
* into) never pulls the HUD's React sheets in through styles.ts.
|
|
11
11
|
*/
|
|
12
12
|
export declare const HOST_STYLE: string;
|
|
13
|
-
/**
|
|
13
|
+
/** A dialog-associated top-layer popover uses the same viewport-origin box. */
|
|
14
14
|
export declare const SHEET_HOST_STYLE: string;
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export const HOST_STYLE = 'all:initial;position:fixed;z-index:2147483647;inset:0 auto auto 0;margin:0;padding:0;border:0;' +
|
|
13
13
|
'background:transparent;overflow:visible;width:0;height:0;pointer-events:none;color-scheme:normal;';
|
|
14
|
-
/**
|
|
14
|
+
/** A dialog-associated top-layer popover uses the same viewport-origin box. */
|
|
15
15
|
export const SHEET_HOST_STYLE = HOST_STYLE;
|
|
@@ -29,8 +29,9 @@ export declare function createHudHost(): HudHost;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function sheetTarget(): Element | null;
|
|
31
31
|
/**
|
|
32
|
-
* A sheet host
|
|
33
|
-
*
|
|
32
|
+
* A sheet host stays in the dialog's focus/inert subtree, but its manual
|
|
33
|
+
* popover paints in the browser's top layer: fixed children keep the viewport
|
|
34
|
+
* as their containing block, never the dialog's transform, filter or clipping.
|
|
34
35
|
*/
|
|
35
36
|
export declare function createSheetHost(target: Element): {
|
|
36
37
|
mount: HTMLElement;
|
|
@@ -236,8 +236,9 @@ export function sheetTarget() {
|
|
|
236
236
|
return aria[aria.length - 1] ?? null;
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
|
-
* A sheet host
|
|
240
|
-
*
|
|
239
|
+
* A sheet host stays in the dialog's focus/inert subtree, but its manual
|
|
240
|
+
* popover paints in the browser's top layer: fixed children keep the viewport
|
|
241
|
+
* as their containing block, never the dialog's transform, filter or clipping.
|
|
241
242
|
*/
|
|
242
243
|
export function createSheetHost(target) {
|
|
243
244
|
const el = document.createElement('div');
|
|
@@ -249,7 +250,10 @@ export function createSheetHost(target) {
|
|
|
249
250
|
root.append(mount);
|
|
250
251
|
shield(el);
|
|
251
252
|
const releaseGuard = holdKeyGuard();
|
|
253
|
+
if (typeof el.showPopover === 'function')
|
|
254
|
+
el.popover = 'manual';
|
|
252
255
|
target.append(el);
|
|
256
|
+
el.showPopover?.();
|
|
253
257
|
return {
|
|
254
258
|
mount,
|
|
255
259
|
destroy: () => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Sent as `meta.recorder` and written as `data-vitrinka-page`; bumped with the package version. */
|
|
2
|
-
export declare const RECORDER_VERSION = "0.9.
|
|
3
|
-
export declare const RECORDER_ID = "web/0.9.
|
|
2
|
+
export declare const RECORDER_VERSION = "0.9.3";
|
|
3
|
+
export declare const RECORDER_ID = "web/0.9.3";
|
package/build/report/widget.d.ts
CHANGED
|
@@ -110,10 +110,10 @@ export declare class ReportWidget {
|
|
|
110
110
|
private readonly e;
|
|
111
111
|
constructor(opts: WidgetOptions);
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
113
|
+
* Associate with the topmost open dialog so its inert/focus rules leave
|
|
114
|
+
* reporting usable. The sheet host's top-layer popover keeps the button,
|
|
115
|
+
* card and marks anchored to the viewport, independent of the dialog's box.
|
|
116
|
+
* The one DOM tree moves with its draft and marks; focus survives the move.
|
|
117
117
|
*/
|
|
118
118
|
private followDialog;
|
|
119
119
|
open(): void;
|
package/build/report/widget.js
CHANGED
|
@@ -543,10 +543,10 @@ export class ReportWidget {
|
|
|
543
543
|
this.followDialog();
|
|
544
544
|
}
|
|
545
545
|
/**
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
546
|
+
* Associate with the topmost open dialog so its inert/focus rules leave
|
|
547
|
+
* reporting usable. The sheet host's top-layer popover keeps the button,
|
|
548
|
+
* card and marks anchored to the viewport, independent of the dialog's box.
|
|
549
|
+
* The one DOM tree moves with its draft and marks; focus survives the move.
|
|
550
550
|
*/
|
|
551
551
|
followDialog() {
|
|
552
552
|
const target = this.activeDialog();
|