@graview/guest 0.2.16 → 0.2.18
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 +24 -12
- package/client.js +1 -1
- package/dist/audit/page.generated.js +1 -1
- package/dist/channel.d.ts +9 -0
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +24 -0
- package/dist/channel.js.map +1 -1
- package/dist/client.generated.d.ts.map +1 -1
- package/dist/client.generated.js +2 -2
- package/dist/client.generated.js.map +1 -1
- package/dist/guest.d.ts.map +1 -1
- package/dist/guest.js +35 -0
- package/dist/guest.js.map +1 -1
- package/dist/headless/seats.d.ts +1 -1
- package/dist/headless/seats.d.ts.map +1 -1
- package/dist/headless/seats.js +5 -1
- package/dist/headless/seats.js.map +1 -1
- package/dist/host/frame.d.ts.map +1 -1
- package/dist/host/frame.js +65 -1
- package/dist/host/frame.js.map +1 -1
- package/dist/host/view-runtime.generated.d.ts.map +1 -1
- package/dist/host/view-runtime.generated.js +1 -1
- package/dist/host/view-runtime.generated.js.map +1 -1
- package/dist/host/writes.d.ts.map +1 -1
- package/dist/host/writes.js +3 -2
- package/dist/host/writes.js.map +1 -1
- package/dist/protocol.d.ts +13 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +8 -0
- package/dist/protocol.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -45,7 +45,10 @@ pictures it asked for) and asked for its height — or stayed quiet for a
|
|
|
45
45
|
moment after, if it never asks — and `data-guest-view-failed="silent"` when
|
|
46
46
|
it does not say it is ready in `limits.readyMs` (eight seconds by default).
|
|
47
47
|
It is `aria-busy` until one or the other; a guest that says it is ready
|
|
48
|
-
after all is drawn then.
|
|
48
|
+
after all is drawn then. A frame that loads its page again — taken out of
|
|
49
|
+
the page and put back where the browser cannot move it as it is (no
|
|
50
|
+
`Element.moveBefore`), as the one face does taking in the page it is on —
|
|
51
|
+
loses its mark and is busy again until the new page has drawn.
|
|
49
52
|
|
|
50
53
|
## In the guest
|
|
51
54
|
|
|
@@ -139,9 +142,9 @@ drawn once they are read, or after two seconds, saying which did not come.
|
|
|
139
142
|
What is not lent is said to the host's `{ onProblem }` (`guestView` says it in the console).
|
|
140
143
|
|
|
141
144
|
`title` names the frame for assistive technology. Registered with the same
|
|
142
|
-
title, the guest is a place
|
|
143
|
-
`/places/the-price-sheet` on
|
|
144
|
-
the
|
|
145
|
+
title, the guest is a place: listed by `placesOf`, at
|
|
146
|
+
`/places/the-price-sheet` as a page, and standing on its district on the
|
|
147
|
+
Map (`#view=the-price-sheet` on the Scene's own face). `props.places` lists the app's places, and
|
|
145
148
|
`guest.navigate({ place: "the-packages" })` goes to one.
|
|
146
149
|
|
|
147
150
|
### One client, served or inlined
|
|
@@ -455,8 +458,8 @@ attaches to (the members the face hands it, or every one the viewer sees)
|
|
|
455
458
|
and the kinds and edges it reads: a record the viewer may not see is in
|
|
456
459
|
none of it, and a kind it did not ask to read is not handed to it however
|
|
457
460
|
visible. Every record's `label` is filled as the host labels it — for a
|
|
458
|
-
frame guest too. A titled view is a named place
|
|
459
|
-
|
|
461
|
+
frame guest too. A titled view is a named place, by its title, as a page
|
|
462
|
+
and on the Map; whatever the registry drew for that kind
|
|
460
463
|
before is drawn if the view fails. A view of one record (`cardinality:
|
|
461
464
|
"one"`) is drawn above the record's own fields, which stay editable: on
|
|
462
465
|
the scene the record drawn at full is the view and then the record's
|
|
@@ -599,16 +602,16 @@ place the app has. `graview.navigate("offer:coaching")` and
|
|
|
599
602
|
string is a record the viewer may see first, then a place by that slug, so
|
|
600
603
|
`graview.navigate("the-packages")` goes to the place. The Scene and the
|
|
601
604
|
home are places by name too (FR-235): `data-place="overview"` goes to the
|
|
602
|
-
Scene's overview and `data-place="home"` to the front page, on
|
|
603
|
-
face; a kind's list by its slug. What a view may name is one vocabulary,
|
|
605
|
+
Map (the Scene's overview) and `data-place="home"` to the front page, on
|
|
606
|
+
every face; a kind's list by its slug. What a view may name is one vocabulary,
|
|
604
607
|
`placeNamesOf` on `@graview/core/navigate`, read alike by the headless
|
|
605
608
|
check and the page. A destination that
|
|
606
609
|
is neither goes nowhere and says why — in the view's console, and to the
|
|
607
610
|
host's problems (the onProblem option on `mountWorkerView` and on a registered view's
|
|
608
611
|
definition) — naming the places there are. The
|
|
609
612
|
props list the app's places (`places`, each with its slug and title). On
|
|
610
|
-
the
|
|
611
|
-
the
|
|
613
|
+
the Scene's own face a record is focused and chosen and a place is drawn; on
|
|
614
|
+
the routed face each goes to its own address — through `useGoTo` in
|
|
612
615
|
`@graview/react`, which the routed face provides — and an `<a data-record>`
|
|
613
616
|
or `<a data-place>` carries that address as its `href` (`GoTo.href`, or
|
|
614
617
|
the address option on `mountWorkerView`): a plain click, a tap and Enter are followed
|
|
@@ -946,9 +949,18 @@ A draft, a preview on the Scene and a view that has not drawn are not kept.
|
|
|
946
949
|
A face says which view is its page's own (`PageOfItsOwn`, the routed face and
|
|
947
950
|
the one face do); a row, a card or a panel is never kept. A frame is kept
|
|
948
951
|
only where its host says it may be (`guestView({ keeps: true })`), since its
|
|
949
|
-
document runs on out of sight
|
|
952
|
+
document runs on out of sight, and where the
|
|
950
953
|
browser can move one without loading it again (`Element.moveBefore`: Chrome
|
|
951
|
-
133, Firefox 144); elsewhere it is loaded again.
|
|
954
|
+
133, Firefox 144); elsewhere it is loaded again. A kept frame is told it is
|
|
955
|
+
off the page and back (`{ type: "away", away }` over its port): the client
|
|
956
|
+
pauses the `<video>` and `<audio>` in its document that are playing and
|
|
957
|
+
plays them again on return, and the guest's code hears both, for a sound of
|
|
958
|
+
its own making (Web Audio, a `new Audio()` never put in the document, media
|
|
959
|
+
in a shadow root):
|
|
960
|
+
|
|
961
|
+
```ts
|
|
962
|
+
guest.onAway((away) => (away ? music.suspend() : music.resume()));
|
|
963
|
+
```
|
|
952
964
|
|
|
953
965
|
A host that mounts views by hand has the same in `rest` and `wake` on what
|
|
954
966
|
`mountWorkerView` and `mountGuestView` answer. A first visit waits for
|
package/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @graview/guest/client.js — a frame guest's client (GraviewGuest.connect). Generated from src/client-script.ts. Elastic License 2.0. */
|
|
2
|
-
"use strict";var GraviewGuest=(()=>{var k=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var
|
|
2
|
+
"use strict";var GraviewGuest=(()=>{var k=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var o in t)k(e,o,{get:t[o],enumerable:!0})},z=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _(t))!P.call(e,s)&&s!==o&&k(e,s,{get:()=>t[s],enumerable:!(i=N(t,s))||i.enumerable});return e};var L=e=>z(k({},"__esModule",{value:!0}),e);var W={};B(W,{connect:()=>F,protocol:()=>M});var M=1;function T(e){if(typeof e=="string")return{type:"navigate",to:e};let{place:t,record:o,where:i,section:s}=e??{},a={...i===void 0?{}:{where:i},...s===void 0?{}:{section:String(s)}};return typeof t=="string"?{type:"navigate",place:t,...a}:typeof o=="string"?{type:"navigate",to:o,...a}:void 0}function S(e){let t=e;return typeof e=="object"&&e!==null&&t.graview==="host-hello"&&typeof t.nonce=="string"}function A(e,t={}){let o,i="",s,a=0,d=new Set,u=new Set,f=!1,c=new Map,y=[],g=r=>{o?o.postMessage({...r,nonce:i}):y.push(r)},x=r=>{let n=r.data;if(!(!n||typeof n!="object")){if(n.type==="props"){s=n.props;for(let l of d)l(n.props)}else n.type==="answer"?(c.get(n.id)?.(n),c.delete(n.id)):n.type==="event"&&typeof n.listener=="number"?t.onEvent?.(n):n.type==="away"&&typeof n.away=="boolean"?f=n.away:n.type==="heartbeat"&&typeof n.beat=="number"&&g({type:"heartbeat",beat:n.beat});if(t.onMessage?.(n),n.type==="away"&&typeof n.away=="boolean")for(let l of[...u])try{l(n.away)}catch(p){console.error(p)}}},m=()=>{},E=r=>{if(o||!e.fromHost(r)||!S(r.data)||r.data.protocol!==1)return;let n=r.ports[0];if(n){o=n,i=r.data.nonce,o.onmessage=x,o.start?.(),m();for(let l of y.splice(0))g(l)}};m=e.listen(E),e.ready({graview:"guest-ready",protocol:1});let b,R={get props(){return s},subscribe(r){return d.add(r),()=>d.delete(r)},get away(){return f},onAway(r){return u.add(r),()=>void u.delete(r)},act(r,n={}){let l=a+=1;return new Promise(p=>{c.set(l,p),g({type:"act",id:l,name:r,args:n})})},navigate(r){let n=T(r);n&&g(n)},size(r){g({type:"size",height:r})},autoSize(r){let n=r??globalThis.document?.documentElement,l=globalThis.ResizeObserver;if(!n||!l||typeof n.getBoundingClientRect!="function")return()=>{};b?.disconnect();let p=new l(()=>R.size(Math.ceil(n.getBoundingClientRect().height)));return p.observe(n),b=p,()=>p.disconnect()},close(){b?.disconnect(),m(),o?.close(),d.clear(),u.clear()}};return{guest:R,send:g}}function H(e,t){let o=e.document,i="",s=0,a=0,d=g=>{if(s=0,g-a<16)return u();let x=[],m=[],E=new Map,b=r=>Math.round(r*10)/10;for(let r of o.querySelectorAll("[data-record]")){if(m.length>=200)break;let n=r.getAttribute("data-record");if(!n)continue;m.push(n);let{left:l,top:p,right:v,bottom:G}=r.getBoundingClientRect();for(let h=r.parentElement;h;h=h.parentElement){let w=E.get(h);if(w===void 0){let O=e.getComputedStyle(h);E.set(h,w=O.overflowX!=="visible"||O.overflowY!=="visible"?h.getBoundingClientRect():null)}w&&(l=Math.max(l,w.left),p=Math.max(p,w.top),v=Math.min(v,w.right),G=Math.min(G,w.bottom))}l=Math.max(l,0),p=Math.max(p,0),v=Math.min(v,e.innerWidth),G=Math.min(G,e.innerHeight),v-l>=1&&G-p>=1&&x.push({id:n,x:b(l),y:b(p),width:b(v-l),height:b(G-p)})}let R=JSON.stringify([x,m]);R!==i&&(i=R,a=g,t(x,m))},u=()=>{s||=e.requestAnimationFrame(d)},f=new e.MutationObserver(u);f.observe(o.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let c=new e.ResizeObserver(u);c.observe(o.documentElement);let y=["scroll","resize","load"];for(let g of y)e.addEventListener(g,u,!0);return u(),()=>{for(let g of y)e.removeEventListener(g,u,!0);f.disconnect(),c.disconnect(),e.cancelAnimationFrame(s)}}var U=/^data:font\/(?:woff2|woff|ttf|otf);base64,[A-Za-z0-9+/]+=*$/;function q(){let e=[];return t=>{if(t.type!=="fonts"||!Array.isArray(t.fonts))return;let o=globalThis,i=o.FontFace,s=o.document?.fonts;if(!i||!s)return;let a=e;e=[];for(let d of t.fonts.slice(0,8)){if(typeof d?.family!="string"||typeof d.src!="string"||!U.test(d.src))continue;let u=`url(${JSON.stringify(d.src)})`,f={display:"swap",...typeof d.weight=="string"?{weight:d.weight}:{},...typeof d.style=="string"?{style:d.style}:{}},c=new i(d.family,u,f);c.status==="error"&&(c=new i(JSON.stringify(d.family),u,f)),s.add(c),e.push(c),c.load().catch(()=>s.delete(c))}for(let d of a)s.delete(d)}}function D(e){let t=[];return o=>{if(o.type!=="away"||typeof o.away!="boolean")return;let i=e();if(!i)return;if(o.away){for(let a of i.querySelectorAll("video, audio"))a.paused||(a.pause(),t.push(a));return}let s=t;t=[];for(let a of s)a.isConnected&&a.paused&&a.play()?.catch(()=>{})}}function F(e={}){let t=e.window??globalThis,o=q(),i=D(()=>t.document),s,a=t,d=()=>{!s&&a.document&&"ResizeObserver"in a&&"MutationObserver"in a&&"requestAnimationFrame"in a&&(s=H(a,(y,g)=>u.send({type:"records",boxes:y,shows:g})))},u=A({listen(y){return t.addEventListener("message",y),()=>t.removeEventListener("message",y)},fromHost:y=>y.source===t.parent&&(e.hostOrigin===void 0||y.origin===e.hostOrigin),ready:y=>t.parent?.postMessage(y,"*")},{onMessage:y=>{o(y),i(y),d()}}),{guest:f}=u,c=f.close;return f.close=()=>(s?.(),c()),f}return L(W);})();
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* The audit as one classic script (0.1.48): `graview view check --audit
|
|
4
4
|
* --browser` puts it in the Chromium it opens, where it leaves `__graviewAudit`.
|
|
5
5
|
*/
|
|
6
|
-
export const AUDIT_PAGE_SCRIPT = "/*! @graview/guest audit, as a page runs it. Elastic License 2.0. */\n\"use strict\";(()=>{var be=Symbol.for(\"graview.view.clicked\");function Q(e){for(let o=e,r=0;o&&r<64;r+=1){let a=o[be];if(Array.isArray(a))return a;o=o.host??o.parentNode}}var ee=\"http://www.w3.org/1999/xhtml\",te=new Set([\"button\",\"submit\",\"reset\",\"checkbox\",\"radio\",\"image\"]);var ge=new Set([\"div\",\"span\",\"section\",\"article\",\"aside\",\"header\",\"footer\",\"figure\",\"p\",\"b\",\"i\",\"em\",\"strong\",\"small\",\"mark\",\"time\",\"img\"]),S=(e,...o)=>e.namespaceURI===ee&&o.includes(e.localName),re=e=>(e.getAttribute(\"type\")??\"text\").toLowerCase(),W=e=>S(e,\"textarea\",\"select\")||S(e,\"input\")&&!te.has(re(e)),K=e=>S(e,\"input\",\"select\",\"textarea\");function $(e){return S(e,\"button\",\"summary\")||S(e,\"input\")&&te.has(re(e))||e.localName===\"a\"&&e.hasAttribute(\"data-graview-link\")}function Ae(e){if(S(e,\"option\",\"optgroup\",\"datalist\"))return'An option is never pressed by itself: put data-act on its select, with data-save=\"change\", or on a button.';if(S(e,\"label\"))return\"A press on a label presses its field too, and would ask for the act twice: put data-act on a button, or on the field.\";if(W(e)&&!e.hasAttribute(\"data-save\"))return'A click into a field to type or to pick is not a press: give it data-save (\"input\" or \"change\") to save it as it is typed, or put data-act on a button beside it.'}var oe=e=>e.hasAttribute(\"data-act\")&&Ae(e)===void 0&&!(K(e)&&e.hasAttribute(\"data-save\")),ye=new Set([\"button\",\"checkbox\",\"switch\",\"tab\"]);function ae(e,o=e.getAttribute(\"role\")){return $(e)||K(e)||S(e,\"label\",\"option\")||e.hasAttribute(\"data-graview-link\")?!1:ye.has(o??\"\")||e.hasAttribute(\"aria-pressed\")||e.hasAttribute(\"aria-expanded\")}function B(e){return S(e,\"button\",\"input\",\"select\",\"textarea\",\"summary\",\"iframe\")||e.localName===\"a\"&&e.hasAttribute(\"href\")?!0:e.hasAttribute(\"tabindex\")||(e.getAttribute(\"contenteditable\")??\"false\")!==\"false\"}var V=e=>!e.hasAttribute(\"role\")&&(e.namespaceURI!==ee||ge.has(e.localName));function ne(e,o){return!e.hasAttribute(\"data-record\")&&!e.hasAttribute(\"data-place\")?!1:e.localName===\"a\"?!0:o||K(e)||S(e,\"fieldset\",\"form\",\"label\",\"option\")||e.localName===\"graview-video\"||e.hasAttribute(\"data-act\")||e.hasAttribute(\"data-lightbox\")||e.hasAttribute(\"data-drop\")||e.hasAttribute(\"data-field\")?!1:e.getAttribute(\"role\")!==\"group\"}function Y(e,o){if(e.localName===\"a\"||e.localName===\"button\")return!1;let r=e.getAttribute(\"data-record\"),a=e.getAttribute(\"data-place\");for(let i of o)if(i.localName===\"a\"&&(r!==null?i.getAttribute(\"data-record\")===r:a!==null&&i.getAttribute(\"data-place\")===a))return!0;return!1}var Ee=/^#([0-9a-f]{3,8})$/i,we=/(rgba?|hsla?)\\(([^)]+)\\)/gi;function xe(e){let o=Ee.exec(e.trim());if(!o)return null;let r=o[1];if((r.length===3||r.length===4)&&(r=[...r].map(n=>n+n).join(\"\")),r.length!==6&&r.length!==8)return null;let a=Number.parseInt(r.slice(0,6),16),i=r.length===8?Number.parseInt(r.slice(6,8),16)/255:1;return{r:a>>16&255,g:a>>8&255,b:a&255,a:i}}function ke(e){let o=e.slice(0,e.indexOf(\"(\")).toLowerCase(),a=e.slice(e.indexOf(\"(\")+1,e.lastIndexOf(\")\")).split(/[,\\s/]+/).filter(Boolean).map(h=>h.endsWith(\"%\")?Number.parseFloat(h)/100:Number.parseFloat(h));if(a.some(Number.isNaN))return null;if(o.startsWith(\"rgb\")){let[h,s,b,k]=a;return h===void 0||s===void 0||b===void 0?null:{r:h,g:s,b,a:k??1}}let[i,n,d,m]=a;return i===void 0||n===void 0||d===void 0?null:{...ve(i,n>1?n/100:n,d>1?d/100:d),a:m??1}}function ve(e,o,r){let a=(1-Math.abs(2*r-1))*o,i=(e%360+360)%360/60,n=a*(1-Math.abs(i%2-1)),[d,m,h]=i<1?[a,n,0]:i<2?[n,a,0]:i<3?[0,a,n]:i<4?[0,n,a]:i<5?[n,0,a]:[a,0,n],s=r-a/2;return{r:Math.round((d+s)*255),g:Math.round((m+s)*255),b:Math.round((h+s)*255)}}function z(e){let o=[];for(let r of e.matchAll(we)){let a=ke(r[0]);a&&o.push(a)}for(let r of e.matchAll(/#[0-9a-fA-F]{3,8}\\b/g)){let a=xe(r[0]);a&&o.push(a)}return o}function M(e,o){let r=e.a+o.a*(1-e.a);if(r===0)return{r:0,g:0,b:0,a:0};let a=(i,n)=>(i*e.a+n*o.a*(1-e.a))/r;return{r:a(e.r,o.r),g:a(e.g,o.g),b:a(e.b,o.b),a:r}}function j(e){let o=e/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4}function q(e){return .2126*j(e.r)+.7152*j(e.g)+.0722*j(e.b)}function G(e,o){let[r,a]=[q(e),q(o)].sort((i,n)=>n-i);return(r+.05)/(a+.05)}var Ie={r:255,g:255,b:255,a:1},Se={r:18,g:18,b:18,a:1},H=e=>e.parentElement??e.getRootNode().host??null,_;function X(e,o){if(e===\"transparent\")return{r:0,g:0,b:0,a:0};let[r]=z(e);if(r)return r;if(_===void 0&&(_=o.createElement(\"canvas\").getContext(\"2d\",{willReadFrequently:!0})),!_)return;_.clearRect(0,0,1,1),_.fillStyle=\"#000\",_.fillStyle=e,_.fillRect(0,0,1,1);let[a,i,n,d]=_.getImageData(0,0,1,1).data;return{r:a,g:i,b:n,a:d/255}}function ie(e){let o=e.ownerDocument,r=o.defaultView,a=[];for(let n=e;n;n=H(n)){let d=r.getComputedStyle(n);if(d.backgroundImage&&d.backgroundImage!==\"none\")return;let m=X(d.backgroundColor,o);if(!m)return;if(m.a>0&&a.push(m),m.a>=1)break}let i=r.getComputedStyle(o.documentElement).colorScheme.includes(\"dark\")&&r.matchMedia?.(\"(prefers-color-scheme: dark)\").matches;return a.reverse().reduce((n,d)=>M(d,n),i?Se:Ie)}var se=e=>`${Math.floor(e*100)/100}:1`;function de(e,o){let r={},a=l=>r[l]=(r[l]??0)+1,i=e.filter(l=>typeof l.getBoundingClientRect==\"function\"),n=i[0];if(!n)return{unmeasured:r,measured:{contrast:0,\"focus-visible\":0}};let d=n.ownerDocument,m=d.defaultView,h=l=>{let O=l.getBoundingClientRect();return O.width>1&&O.height>1},s=0;for(let l of i){if(s>=o.limit)break;if(!Array.from(l.childNodes).some(c=>c.nodeType===3&&(c.textContent??\"\").trim()!==\"\")||l.namespaceURI!==\"http://www.w3.org/1999/xhtml\"||l.hasAttribute(\"disabled\")||l.getAttribute(\"aria-disabled\")===\"true\")continue;let v=m.getComputedStyle(l);if(v.visibility!==\"visible\"||v.display===\"none\"||!h(l))continue;s+=1;let g=X(v.color,d),I=ie(l);if(!g||!I){a(\"contrast\");continue}let w=G(M(g,I),I),T=Number.parseFloat(v.fontSize),P=Number.parseInt(v.fontWeight,10),t=T>=24||T>=18.66&&P>=700,u=t?3:4.5;w+.005<u&&o.say(\"contrast\",l,\"serious\",`Its words are at ${se(w)} against their ground; ${u}:1 is the least ${t?\"large \":\"\"}text may be.`,\"Give it a color further from its ground: --graview-ink and --graview-ink-muted are held to the app's grounds.\")}let b=d.activeElement,k=0;for(let l of i){if(k>=o.limit)break;if(!o.tabbable(l)||!h(l))continue;if(k+=1,l.focus({preventScroll:!0,focusVisible:!0}),l.getRootNode().activeElement!==l||!l.matches(\":focus-visible\")){a(\"focus-visible\");continue}let g=m.getComputedStyle(l),I=Number.parseFloat(g.outlineWidth)||0,w=!1;for(let u=l;u;u=H(u))u.hasAttribute(\"data-graview-view-root\")&&(w=!0);if(g.outlineStyle===\"auto\"){a(\"focus-visible\");continue}if(g.outlineStyle===\"none\"||I===0){g.boxShadow&&g.boxShadow!==\"none\"?a(\"focus-visible\"):o.say(\"focus-visible\",l,\"serious\",\"It shows no ring when it has the keyboard: a person cannot see where they are.\",\"Leave the outline on :focus-visible (in a view the host draws it; restyle it with --graview-focus-color).\",\"2.4.7\",w);continue}if(I+.01<2){o.say(\"focus-visible\",l,\"serious\",`Its ring is ${I}px: at least 2px is seen.`,\"Give the outline 2px or more (--graview-focus-width in a view).\",\"2.4.7\",w);continue}let T=X(g.outlineColor,d),P=H(l)?ie(H(l)):void 0;if(!T||!P){a(\"focus-visible\");continue}let t=G(M(T,P),P);t+.005<3&&o.say(\"focus-visible\",l,\"serious\",`Its ring is at ${se(t)} against what is around it; 3:1 is the least a ring may be.`,\"Give the ring a color at 3:1 against the ground (--graview-focus-color in a view; the app's accent is held to it).\",\"1.4.11\",w)}k>0&&(d.activeElement?.blur?.(),b&&b!==d.body&&b.focus?.({preventScroll:!0}));for(let l of i){let O=m.getComputedStyle(l);if(!(/(auto|scroll)/.test(O.overflowX)||/(auto|scroll)/.test(O.overflowY)))continue;let g=l;(g.scrollHeight>g.clientHeight+1||g.scrollWidth>g.clientWidth+1)&&o.scrollsOnPage(l)}return{unmeasured:r,measured:{contrast:s,\"focus-visible\":k}}}var le={keyboard:{wcag:\"2.1.1\",says:\"What a person can click is reached by the keyboard.\",needs:\"structure\"},role:{wcag:\"4.1.2\",says:\"What takes the keyboard says what it is.\",needs:\"structure\"},name:{wcag:\"4.1.2\",says:\"Every control and link has a name.\",needs:\"structure\"},\"toggle-state\":{wcag:\"4.1.2\",says:\"A toggle says whether it is on, open or chosen.\",needs:\"structure\"},\"nested-interactive\":{wcag:\"4.1.2\",says:\"No control or link is inside another.\",needs:\"structure\"},\"img-alt\":{wcag:\"1.1.1\",says:'Every image says what it shows, or says it is decoration (alt=\"\").',needs:\"structure\"},\"svg-name\":{wcag:\"1.1.1\",says:'A picture drawn in SVG that means something is role=\"img\" with a name; one that does not is hidden.',needs:\"structure\"},\"scroll-region\":{wcag:\"2.1.1\",says:\"A box that scrolls by itself takes the keyboard and has a name.\",needs:\"structure\"},\"focus-visible\":{wcag:\"2.4.7\",says:\"Whatever has the keyboard shows a ring at least 2px wide, at 3:1 against its ground.\",needs:\"layout\"},contrast:{wcag:\"1.4.3\",says:\"Text is at 4.5:1 against its ground, 3:1 when large.\",needs:\"layout\"},\"keyboard-trap\":{wcag:\"2.1.2\",says:\"Tab leaves the view: the keyboard is never held inside it.\",needs:\"keys\"}};var me=\"http://www.w3.org/1999/xhtml\",U=\"http://www.w3.org/2000/svg\",p=(e,...o)=>e.namespaceURI===me&&o.includes(e.localName),he=e=>e.nodeType===1,L=e=>Array.from(e.childNodes).filter(he),Re=new Set([\"button\",\"link\",\"checkbox\",\"switch\",\"radio\",\"tab\",\"menuitem\",\"menuitemcheckbox\",\"menuitemradio\",\"option\",\"slider\",\"spinbutton\",\"textbox\",\"searchbox\",\"combobox\",\"treeitem\"]),Oe=new Set([\"button\",\"link\",\"checkbox\",\"switch\",\"radio\",\"tab\",\"menuitem\",\"menuitemcheckbox\",\"menuitemradio\",\"option\",\"img\",\"slider\",\"progressbar\",\"scrollbar\",\"separator\"]),Ne={checkbox:\"aria-checked\",switch:\"aria-checked\",radio:\"aria-checked\",menuitemcheckbox:\"aria-checked\",menuitemradio:\"aria-checked\",tab:\"aria-selected\",option:\"aria-selected\"},ue=new Set([\"true\",\"false\",\"mixed\"]),Te=/^(show|hide|expand|collapse)?\\s*(more|less|all|details|everything)?$/i;function N(e){let o=[],r=a=>{for(let i of L(a))o.push(i),r(i)};return r(e),o}function ce(e){for(let o=e;o;o=o.parentElement)if(o.getAttribute(\"aria-hidden\")===\"true\"||o.hasAttribute(\"hidden\"))return!0;return!1}var F=e=>e.getAttribute(\"role\")?.trim().split(/\\s+/)[0]?.toLowerCase()??null,Pe=e=>{let o=e.getAttribute(\"tabindex\");if(o===null)return;let r=Number.parseInt(o,10);return Number.isNaN(r)?void 0:r},_e=e=>e.hasAttribute(\"disabled\")||e.getAttribute(\"aria-disabled\")===\"true\",R=e=>p(e,\"input\")&&(e.getAttribute(\"type\")??\"\").toLowerCase()===\"hidden\"||p(e,\"button\",\"input\",\"select\",\"textarea\")&&e.hasAttribute(\"disabled\")?!1:B(e)&&(Pe(e)??0)>=0,Z=e=>p(e,\"button\",\"select\",\"textarea\",\"summary\")||p(e,\"input\")&&(e.getAttribute(\"type\")??\"\").toLowerCase()!==\"hidden\"||e.localName===\"a\"&&e.hasAttribute(\"href\"),fe=e=>Z(e)||e.hasAttribute(\"data-graview-link\")||e.hasAttribute(\"data-graview-press\")?!0:Re.has(F(e)??\"\"),Le=e=>e.hasAttribute(\"role\")||!V(e);function Ce(e){let o=[],r=a=>JSON.stringify(a);for(let a=e;a&&!a.hasAttribute(\"data-graview-view-root\");a=a.parentElement){let i=a.getAttribute(\"data-key\");if(i!==null){o.unshift(`[data-key=${r(i)}]`);break}let n=a.getAttribute(\"id\");if(n){o.unshift(`[id=${r(n)}]`);break}let d=a.getAttribute(\"class\")?.trim().split(/\\s+/)[0],m=`${a.localName}${d?`.${d}`:\"\"}`,h=a.parentElement;if(h){let s=L(h).filter(b=>b.localName===a.localName);s.length>1&&(m+=`:nth-of-type(${s.indexOf(a)+1})`)}o.unshift(m)}return o.join(\" > \")}var Fe=e=>{for(let o=e;o;o=o.parentElement){let r=o.getAttribute(\"data-key\");if(r!==null)return r}};function x(e){if(e.nodeType===3)return e.textContent??\"\";if(!he(e)||e.getAttribute(\"aria-hidden\")===\"true\"||e.hasAttribute(\"hidden\"))return\"\";let o=e.getAttribute(\"aria-label\")?.trim();if(o)return` ${o} `;if(e.localName===\"img\")return` ${e.getAttribute(\"alt\")??\"\"} `;if(e.namespaceURI===U&&e.localName===\"svg\"){let r=L(e).find(a=>a.localName===\"title\");return r?` ${x(r)} `:\"\"}return p(e,\"input\",\"select\",\"textarea\")?\"\":Array.from(e.childNodes).map(x).join(\"\")}var y=e=>e.replace(/\\s+/g,\" \").trim();function Me(e,o,r){let a=e.getAttribute(\"aria-labelledby\");if(a){let n=y(a.split(/\\s+/).map(d=>o.get(d)?x(o.get(d)):\"\").join(\" \"));if(n)return n}let i=y(e.getAttribute(\"aria-label\")??\"\");if(i)return i;if(p(e,\"input\",\"select\",\"textarea\")){let n=(e.getAttribute(\"type\")??\"\").toLowerCase();if(p(e,\"input\")&&[\"submit\",\"reset\",\"button\"].includes(n))return y(e.getAttribute(\"value\")??(n===\"submit\"?\"Submit\":n===\"reset\"?\"Reset\":\"\"));if(p(e,\"input\")&&n===\"image\")return y(e.getAttribute(\"alt\")??\"\");let d=e.getAttribute(\"id\"),m=d?r.find(s=>s.getAttribute(\"for\")===d):void 0;if(m&&y(x(m)))return y(x(m));for(let s=e.parentElement;s;s=s.parentElement)if(p(s,\"label\")&&y(x(s)))return y(x(s));let h=y(e.getAttribute(\"placeholder\")??\"\");return h||y(e.getAttribute(\"title\")??\"\")}return e.localName===\"img\"?y(e.getAttribute(\"alt\")??e.getAttribute(\"title\")??\"\"):y(x(e))||y(e.getAttribute(\"title\")??\"\")}function De(e){let o=N(e);for(let r of o){let a=N(r).some(W);if(!ne(r,a)||(r.setAttribute(\"data-graview-link\",\"\"),Y(r,N(r))))continue;let i=r.localName===\"a\";if(!r.hasAttribute(\"role\")&&(i||V(r))&&r.setAttribute(\"role\",\"link\"),p(r,\"tr\")){let n=L(r).find(d=>d.localName===\"td\"||d.localName===\"th\");n&&!n.hasAttribute(\"tabindex\")&&n.setAttribute(\"tabindex\",\"0\");continue}!p(r,\"button\")&&!r.hasAttribute(\"tabindex\")&&r.setAttribute(\"tabindex\",\"0\")}for(let r of o){let a=oe(r)&&!$(r)&&!p(r,\"input\",\"select\",\"textarea\"),i=!a&&ae(r);!a&&!i||(B(r)||r.setAttribute(\"tabindex\",\"0\"),a&&V(r)&&r.setAttribute(\"role\",\"button\"),r.setAttribute(\"data-graview-press\",\"\"))}for(let r of o.filter(a=>a.namespaceURI===U&&a.localName===\"svg\")){let a=r.hasAttribute(\"role\")||r.hasAttribute(\"aria-label\")||r.hasAttribute(\"aria-labelledby\")||L(r).some(n=>n.localName===\"title\"),i=[r,...N(r)].some(n=>n.hasAttribute(\"tabindex\")||n.hasAttribute(\"data-graview-link\")||n.hasAttribute(\"data-graview-press\")||n.localName===\"a\");!a&&!i&&!r.hasAttribute(\"aria-hidden\")&&r.setAttribute(\"aria-hidden\",\"true\")}}function Ve(e,o){let r=e;return typeof r.querySelectorAll!=\"function\"?[]:o.flatMap(a=>{try{return Array.from(r.querySelectorAll(a))}catch{return[]}})}function J(e){for(let o of L(e)){if(R(o)||J(o))return!0;let r=o.shadowRoot;if(r&&J(r))return!0}return!1}function Ge(e){let o=e.ownerDocument?.defaultView;if(!o||typeof o.getComputedStyle!=\"function\")return!1;let a=(e.host??e).getBoundingClientRect?.();return!!(a&&(a.width>0||a.height>0))}function pe(e,o={}){o.host===\"pending\"&&De(e);let r=N(e),a=new Map(r.flatMap(t=>t.getAttribute(\"id\")?[[t.getAttribute(\"id\"),t]]:[])),i=r.filter(t=>p(t,\"label\")),n=o.clicked?Array.from(o.clicked):[...Q(e)??[]],d=new Set([...n.filter(t=>typeof t==\"object\"),...Ve(e,n.filter(t=>typeof t==\"string\"))]),m=o.chrome===!0,h=[],s=(t,u,c,A,f,E=!1,C=le[t].wcag)=>{let D=Fe(u);h.push({rule:t,wcag:C,impact:c,at:Ce(u),...D!==void 0?{key:D}:{},says:A,fix:f,automatic:E||m})},b=r.filter(t=>!ce(t)),k=t=>Me(t,a,i)!==\"\",l=new Set(b.filter(t=>t.hasAttribute(\"data-graview-link\")&&Y(t,N(t))));for(let t of b){if(_e(t))continue;let u=t.hasAttribute(\"data-graview-link\"),c=t.hasAttribute(\"data-graview-press\"),A=d.has(t);if(!u&&!c&&!A||Z(t)&&R(t)||l.has(t)&&!A||p(t,\"tr\")&&L(t).some(E=>(E.localName===\"td\"||E.localName===\"th\")&&R(E)))continue;if(!(R(t)||A&&N(t).some(E=>R(E)&&(Z(E)||E.hasAttribute(\"data-graview-press\")||E.hasAttribute(\"data-graview-link\"))))){u||c?s(\"keyboard\",t,\"serious\",\"It is a link or a press the host makes, and Tab does not reach it.\",\"The host gives it the keyboard when it draws the view; audit the view as the host drew it.\",!0):s(\"keyboard\",t,\"serious\",`A <${t.localName}> the view hears a click on, which Tab does not reach: a mouse can press it and a keyboard cannot.`,'Draw it as a <button type=\"button\"> (the host resets its look), or give it role=\"button\" and the host gives it the keyboard, Enter and Space.');continue}R(t)&&!Le(t)&&!(t.localName===\"a\"&&t.hasAttribute(\"href\"))&&s(\"role\",t,\"serious\",`A <${t.localName}> that takes the keyboard says nothing of what it is: a screen reader says \"group\" or nothing.`,'Draw it as a <button type=\"button\">, or give it role=\"button\" (or role=\"link\" when it goes somewhere).',u||c)}for(let t of b){if(!fe(t)||l.has(t)||k(t))continue;let u=F(t),c=p(t,\"button\")||u===\"button\"||t.hasAttribute(\"data-graview-press\"),A=p(t,\"input\",\"select\",\"textarea\")||[\"textbox\",\"searchbox\",\"combobox\",\"slider\",\"spinbutton\"].includes(u??\"\"),f=A?\"field\":c?\"button\":t.hasAttribute(\"data-graview-link\")||t.localName===\"a\"||u===\"link\"?\"link\":\"control\";s(\"name\",t,c||A?\"critical\":\"serious\",`A ${f} with no name: a screen reader says only \"${f}\".`,A?'Give it a <label for> or aria-label=\"\\u2026\".':'Put words in it \\u2014 a .graview-sr span when it shows only an icon \\u2014 or aria-label=\"\\u2026\".')}for(let t of b){let u=F(t),c=u&&!p(t,\"input\")?Ne[u]:void 0;if(c&&!t.hasAttribute(c)){s(\"toggle-state\",t,\"serious\",`It is role=\"${u}\" and says no ${c}: a screen reader cannot say whether it is ${c===\"aria-checked\"?\"on\":\"chosen\"}.`,`Give it ${c}=\"true\" or \"false\", and draw it again as it changes.`);continue}for(let[f,E]of[[\"aria-checked\",ue],[\"aria-pressed\",ue],[\"aria-expanded\",new Set([\"true\",\"false\"])],[\"aria-selected\",new Set([\"true\",\"false\"])]]){let C=t.getAttribute(f);C!==null&&!E.has(C)&&s(\"toggle-state\",t,\"serious\",`${f}=\"${C}\" is no state a screen reader can say.`,`Give ${f} \"true\" or \"false\"${E.has(\"mixed\")?' (or \"mixed\")':\"\"}.`)}!(p(t,\"button\")||u===\"button\"||t.hasAttribute(\"data-graview-press\"))||t.hasAttribute(\"aria-expanded\")||t.hasAttribute(\"aria-pressed\")||(t.hasAttribute(\"aria-controls\")?s(\"toggle-state\",t,\"serious\",\"A button that says what it controls (aria-controls) and not whether that is open.\",'Give it aria-expanded=\"true\" or \"false\", and draw it again as it opens and closes.'):d.has(t)&&y(x(t))!==\"\"&&Te.test(y(x(t)))&&s(\"toggle-state\",t,\"moderate\",`A button the view hears that reads \"${y(x(t))}\" \\u2014 it opens and closes something \\u2014 and says no state.`,'Give it aria-expanded=\"true\" or \"false\" (or aria-pressed for a toggle), and draw it again as it changes.'))}for(let t of b){let u=F(t)??(p(t,\"button\")?\"button\":t.localName===\"a\"&&t.hasAttribute(\"href\")?\"link\":null);if(!u||!Oe.has(u)||u===\"img\")continue;let c=N(t).find(f=>!ce(f)&&(R(f)||fe(f)));if(!c)continue;let A=t.hasAttribute(\"data-graview-link\")&&!p(t,\"a\");s(\"nested-interactive\",t,\"serious\",`A ${u} holds a <${c.localName}> a person presses on its own: a screen reader reads the ${u} as one thing and never reaches what is inside.`,A?\"Put an <a> to the card's own record or place on its heading: the card is then a bigger target for a pointer, and the <a> the keyboard's way in.\":`Move the <${c.localName}> out of the ${u}, beside it.`)}for(let t of b){if(t.localName===\"img\"&&t.namespaceURI===me){if(t.hasAttribute(\"alt\")||t.hasAttribute(\"aria-label\")||t.hasAttribute(\"aria-labelledby\")||[\"none\",\"presentation\"].includes(F(t)??\"\"))continue;s(\"img-alt\",t,\"critical\",\"An image with no alt: a screen reader reads its address, or nothing.\",'Give it alt=\"what it shows\", or alt=\"\" when it is decoration.');continue}if(t.namespaceURI!==U||t.localName!==\"svg\"||t.parentElement?.namespaceURI===U||[t,...N(t)].some(f=>R(f)||f.hasAttribute(\"data-graview-link\")||f.hasAttribute(\"data-graview-press\")||f.localName===\"a\"))continue;let c=F(t);if(c===\"none\"||c===\"presentation\")continue;let A=k(t)&&(t.hasAttribute(\"aria-label\")||t.hasAttribute(\"aria-labelledby\")||L(t).some(f=>f.localName===\"title\"));!c&&!A?s(\"svg-name\",t,\"minor\",\"An SVG that says nothing, which a screen reader still meets.\",\"The host hides an SVG that says nothing when it draws the view.\",!0):c!==\"img\"&&c!==\"graphics-document\"?s(\"svg-name\",t,\"minor\",\"An SVG with a name and no role: some screen readers skip it.\",'Give it role=\"img\" beside its aria-label.'):A||s(\"svg-name\",t,\"serious\",'An SVG that is role=\"img\" with no name: a screen reader says \"image\" and nothing more.','Give it aria-label=\"what it shows\", or a <title> first inside it.')}let O=t=>/overflow(-[xy])?\\s*:\\s*(auto|scroll)/i.test(t.getAttribute(\"style\")??\"\"),v=t=>{R(t)&&k(t)||J(t)||s(\"scroll-region\",t,\"serious\",\"A box that scrolls by itself and holds nothing Tab reaches: the keyboard cannot scroll it, and what is past its edge is out of reach.\",'Give it tabindex=\"0\", role=\"region\" and aria-label=\"what it holds\", or let it flow with the page.')},g=o.measure!==!1&&Ge(e);if(!g)for(let t of b)O(t)&&v(t);let I=[\"keyboard\",\"role\",\"name\",\"toggle-state\",\"nested-interactive\",\"img-alt\",\"svg-name\",\"scroll-region\"],w=[],T={},P={};if(g){let t=de(b,{limit:o.limit??400,tabbable:R,scrollsOnPage:v,say:(u,c,A,f,E,C,D)=>s(u,c,A,f,E,D===!0,C)});I.push(\"focus-visible\",\"contrast\"),Object.assign(T,t.unmeasured),Object.assign(P,t.measured)}else{let t=o.measure===!1?\"Asked not to measure.\":\"Nothing here is laid out (a headless run, or a DOM with no layout): it needs a browser's styles and boxes.\";w.push({rule:\"focus-visible\",why:t},{rule:\"contrast\",why:t})}return w.push({rule:\"keyboard-trap\",why:\"It needs keys pressed in a browser: a harness's Tab walk presses them (pnpm verify a11y).\"}),{problems:h,ran:I,skipped:w,unmeasured:T,measured:P}}globalThis.__graviewAudit=pe;})();\n";
|
|
6
|
+
export const AUDIT_PAGE_SCRIPT = "/*! @graview/guest audit, as a page runs it. Elastic License 2.0. */\n\"use strict\";(()=>{var be=Symbol.for(\"graview.view.clicked\");function Q(e){for(let o=e,r=0;o&&r<64;r+=1){let a=o[be];if(Array.isArray(a))return a;o=o.host??o.parentNode}}var ee=\"http://www.w3.org/1999/xhtml\",te=new Set([\"button\",\"submit\",\"reset\",\"checkbox\",\"radio\",\"image\"]);var ge=new Set([\"div\",\"span\",\"section\",\"article\",\"aside\",\"header\",\"footer\",\"figure\",\"p\",\"b\",\"i\",\"em\",\"strong\",\"small\",\"mark\",\"time\",\"img\"]),R=(e,...o)=>e.namespaceURI===ee&&o.includes(e.localName),re=e=>(e.getAttribute(\"type\")??\"text\").toLowerCase(),W=e=>R(e,\"textarea\",\"select\")||R(e,\"input\")&&!te.has(re(e)),K=e=>R(e,\"input\",\"select\",\"textarea\");function $(e){return R(e,\"button\",\"summary\")||R(e,\"input\")&&te.has(re(e))||e.localName===\"a\"&&e.hasAttribute(\"data-graview-link\")}function Ae(e){if(R(e,\"option\",\"optgroup\",\"datalist\"))return'An option is never pressed by itself: put data-act on its select, with data-save=\"change\", or on a button.';if(R(e,\"label\"))return\"A press on a label presses its field too, and would ask for the act twice: put data-act on a button, or on the field.\";if(W(e)&&!e.hasAttribute(\"data-save\"))return'A click into a field to type or to pick is not a press: give it data-save (\"input\" or \"change\") to save it as it is typed, or put data-act on a button beside it.'}var oe=e=>e.hasAttribute(\"data-act\")&&Ae(e)===void 0&&!(K(e)&&e.hasAttribute(\"data-save\")),ye=new Set([\"button\",\"checkbox\",\"switch\",\"tab\"]);function ae(e,o=e.getAttribute(\"role\")){return $(e)||K(e)||R(e,\"label\",\"option\")||e.hasAttribute(\"data-graview-link\")?!1:ye.has(o??\"\")||e.hasAttribute(\"aria-pressed\")||e.hasAttribute(\"aria-expanded\")}function B(e){return R(e,\"button\",\"input\",\"select\",\"textarea\",\"summary\",\"iframe\")||e.localName===\"a\"&&e.hasAttribute(\"href\")?!0:e.hasAttribute(\"tabindex\")||(e.getAttribute(\"contenteditable\")??\"false\")!==\"false\"}var V=e=>!e.hasAttribute(\"role\")&&(e.namespaceURI!==ee||ge.has(e.localName));function ne(e,o){return!e.hasAttribute(\"data-record\")&&!e.hasAttribute(\"data-place\")?!1:e.localName===\"a\"?!0:o||K(e)||R(e,\"fieldset\",\"form\",\"label\",\"option\")||e.localName===\"graview-video\"||e.hasAttribute(\"data-act\")||e.hasAttribute(\"data-lightbox\")||e.hasAttribute(\"data-drop\")||e.hasAttribute(\"data-field\")?!1:e.getAttribute(\"role\")!==\"group\"}function Y(e,o){if(e.localName===\"a\"||e.localName===\"button\")return!1;let r=e.getAttribute(\"data-record\"),a=e.getAttribute(\"data-place\");for(let i of o)if(i.localName===\"a\"&&(r!==null?i.getAttribute(\"data-record\")===r:a!==null&&i.getAttribute(\"data-place\")===a))return!0;return!1}var Ee=/^#([0-9a-f]{3,8})$/i,we=/(rgba?|hsla?)\\(([^)]+)\\)/gi;function xe(e){let o=Ee.exec(e.trim());if(!o)return null;let r=o[1];if((r.length===3||r.length===4)&&(r=[...r].map(n=>n+n).join(\"\")),r.length!==6&&r.length!==8)return null;let a=Number.parseInt(r.slice(0,6),16),i=r.length===8?Number.parseInt(r.slice(6,8),16)/255:1;return{r:a>>16&255,g:a>>8&255,b:a&255,a:i}}function ke(e){let o=e.slice(0,e.indexOf(\"(\")).toLowerCase(),a=e.slice(e.indexOf(\"(\")+1,e.lastIndexOf(\")\")).split(/[,\\s/]+/).filter(Boolean).map(p=>p.endsWith(\"%\")?Number.parseFloat(p)/100:Number.parseFloat(p));if(a.some(Number.isNaN))return null;if(o.startsWith(\"rgb\")){let[p,s,b,k]=a;return p===void 0||s===void 0||b===void 0?null:{r:p,g:s,b,a:k??1}}let[i,n,d,m]=a;return i===void 0||n===void 0||d===void 0?null:{...ve(i,n>1?n/100:n,d>1?d/100:d),a:m??1}}function ve(e,o,r){let a=(1-Math.abs(2*r-1))*o,i=(e%360+360)%360/60,n=a*(1-Math.abs(i%2-1)),[d,m,p]=i<1?[a,n,0]:i<2?[n,a,0]:i<3?[0,a,n]:i<4?[0,n,a]:i<5?[n,0,a]:[a,0,n],s=r-a/2;return{r:Math.round((d+s)*255),g:Math.round((m+s)*255),b:Math.round((p+s)*255)}}function z(e){let o=[];for(let r of e.matchAll(we)){let a=ke(r[0]);a&&o.push(a)}for(let r of e.matchAll(/#[0-9a-fA-F]{3,8}\\b/g)){let a=xe(r[0]);a&&o.push(a)}return o}function M(e,o){let r=e.a+o.a*(1-e.a);if(r===0)return{r:0,g:0,b:0,a:0};let a=(i,n)=>(i*e.a+n*o.a*(1-e.a))/r;return{r:a(e.r,o.r),g:a(e.g,o.g),b:a(e.b,o.b),a:r}}function j(e){let o=e/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4}function q(e){return .2126*j(e.r)+.7152*j(e.g)+.0722*j(e.b)}function G(e,o){let[r,a]=[q(e),q(o)].sort((i,n)=>n-i);return(r+.05)/(a+.05)}var Se={r:255,g:255,b:255,a:1},Re={r:18,g:18,b:18,a:1},H=e=>e.parentElement??e.getRootNode().host??null,_;function X(e,o){if(e===\"transparent\")return{r:0,g:0,b:0,a:0};let[r]=z(e);if(r)return r;if(_===void 0&&(_=o.createElement(\"canvas\").getContext(\"2d\",{willReadFrequently:!0})),!_)return;_.clearRect(0,0,1,1),_.fillStyle=\"#000\",_.fillStyle=e,_.fillRect(0,0,1,1);let[a,i,n,d]=_.getImageData(0,0,1,1).data;return{r:a,g:i,b:n,a:d/255}}function ie(e){let o=e.ownerDocument,r=o.defaultView,a=[];for(let n=e;n;n=H(n)){let d=r.getComputedStyle(n);if(d.backgroundImage&&d.backgroundImage!==\"none\")return;let m=X(d.backgroundColor,o);if(!m)return;if(m.a>0&&a.push(m),m.a>=1)break}let i=r.getComputedStyle(o.documentElement).colorScheme.includes(\"dark\")&&r.matchMedia?.(\"(prefers-color-scheme: dark)\").matches;return a.reverse().reduce((n,d)=>M(d,n),i?Re:Se)}var se=e=>`${Math.floor(e*100)/100}:1`;function de(e,o){let r={},a=l=>r[l]=(r[l]??0)+1,i=e.filter(l=>typeof l.getBoundingClientRect==\"function\"),n=i[0];if(!n)return{unmeasured:r,measured:{contrast:0,\"focus-visible\":0}};let d=n.ownerDocument,m=d.defaultView,p=l=>{let O=l.getBoundingClientRect();return O.width>1&&O.height>1},s=0;for(let l of i){if(s>=o.limit)break;if(!Array.from(l.childNodes).some(c=>c.nodeType===3&&(c.textContent??\"\").trim()!==\"\")||l.namespaceURI!==\"http://www.w3.org/1999/xhtml\"||l.hasAttribute(\"disabled\")||l.getAttribute(\"aria-disabled\")===\"true\")continue;let v=m.getComputedStyle(l);if(v.visibility!==\"visible\"||v.display===\"none\"||!p(l))continue;s+=1;let g=X(v.color,d),S=ie(l);if(!g||!S){a(\"contrast\");continue}let w=G(M(g,S),S),T=Number.parseFloat(v.fontSize),P=Number.parseInt(v.fontWeight,10),t=T>=24||T>=18.66&&P>=700,u=t?3:4.5;w+.005<u&&o.say(\"contrast\",l,\"serious\",`Its words are at ${se(w)} against their ground; ${u}:1 is the least ${t?\"large \":\"\"}text may be.`,\"Give it a color further from its ground: --graview-ink and --graview-ink-muted are held to the app's grounds.\")}let b=d.activeElement,k=0;for(let l of i){if(k>=o.limit)break;if(!o.tabbable(l)||!p(l))continue;if(k+=1,l.focus({preventScroll:!0,focusVisible:!0}),l.getRootNode().activeElement!==l||!l.matches(\":focus-visible\")){a(\"focus-visible\");continue}let g=m.getComputedStyle(l),S=Number.parseFloat(g.outlineWidth)||0,w=!1;for(let u=l;u;u=H(u))u.hasAttribute(\"data-graview-view-root\")&&(w=!0);if(g.outlineStyle===\"auto\"){a(\"focus-visible\");continue}if(g.outlineStyle===\"none\"||S===0){g.boxShadow&&g.boxShadow!==\"none\"?a(\"focus-visible\"):o.say(\"focus-visible\",l,\"serious\",\"It shows no ring when it has the keyboard: a person cannot see where they are.\",\"Leave the outline on :focus-visible (in a view the host draws it; restyle it with --graview-focus-color).\",\"2.4.7\",w);continue}if(S+.01<2){o.say(\"focus-visible\",l,\"serious\",`Its ring is ${S}px: at least 2px is seen.`,\"Give the outline 2px or more (--graview-focus-width in a view).\",\"2.4.7\",w);continue}let T=X(g.outlineColor,d),P=H(l)?ie(H(l)):void 0;if(!T||!P){a(\"focus-visible\");continue}let t=G(M(T,P),P);t+.005<3&&o.say(\"focus-visible\",l,\"serious\",`Its ring is at ${se(t)} against what is around it; 3:1 is the least a ring may be.`,\"Give the ring a color at 3:1 against the ground (--graview-focus-color in a view; the app's accent is held to it).\",\"1.4.11\",w)}k>0&&(d.activeElement?.blur?.(),b&&b!==d.body&&b.focus?.({preventScroll:!0}));for(let l of i){let O=m.getComputedStyle(l);if(!(/(auto|scroll)/.test(O.overflowX)||/(auto|scroll)/.test(O.overflowY)))continue;let g=l;(g.scrollHeight>g.clientHeight+1||g.scrollWidth>g.clientWidth+1)&&o.scrollsOnPage(l)}return{unmeasured:r,measured:{contrast:s,\"focus-visible\":k}}}var le={keyboard:{wcag:\"2.1.1\",says:\"What a person can click is reached by the keyboard.\",needs:\"structure\"},role:{wcag:\"4.1.2\",says:\"What takes the keyboard says what it is.\",needs:\"structure\"},name:{wcag:\"4.1.2\",says:\"Every control and link has a name.\",needs:\"structure\"},\"toggle-state\":{wcag:\"4.1.2\",says:\"A toggle says whether it is on, open or chosen.\",needs:\"structure\"},\"nested-interactive\":{wcag:\"4.1.2\",says:\"No control or link is inside another.\",needs:\"structure\"},\"img-alt\":{wcag:\"1.1.1\",says:'Every image says what it shows, or says it is decoration (alt=\"\").',needs:\"structure\"},\"svg-name\":{wcag:\"1.1.1\",says:'A picture drawn in SVG that means something is role=\"img\" with a name; one that does not is hidden.',needs:\"structure\"},\"scroll-region\":{wcag:\"2.1.1\",says:\"A box that scrolls by itself takes the keyboard and has a name.\",needs:\"structure\"},\"focus-visible\":{wcag:\"2.4.7\",says:\"Whatever has the keyboard shows a ring at least 2px wide, at 3:1 against its ground.\",needs:\"layout\"},contrast:{wcag:\"1.4.3\",says:\"Text is at 4.5:1 against its ground, 3:1 when large.\",needs:\"layout\"},\"keyboard-trap\":{wcag:\"2.1.2\",says:\"Tab leaves the view: the keyboard is never held inside it.\",needs:\"keys\"}};var me=\"http://www.w3.org/1999/xhtml\",U=\"http://www.w3.org/2000/svg\",h=(e,...o)=>e.namespaceURI===me&&o.includes(e.localName),pe=e=>e.nodeType===1,L=e=>Array.from(e.childNodes).filter(pe),Ie=new Set([\"button\",\"link\",\"checkbox\",\"switch\",\"radio\",\"tab\",\"menuitem\",\"menuitemcheckbox\",\"menuitemradio\",\"option\",\"slider\",\"spinbutton\",\"textbox\",\"searchbox\",\"combobox\",\"treeitem\"]),Oe=new Set([\"button\",\"link\",\"checkbox\",\"switch\",\"radio\",\"tab\",\"menuitem\",\"menuitemcheckbox\",\"menuitemradio\",\"option\",\"img\",\"slider\",\"progressbar\",\"scrollbar\",\"separator\"]),Ne={checkbox:\"aria-checked\",switch:\"aria-checked\",radio:\"aria-checked\",menuitemcheckbox:\"aria-checked\",menuitemradio:\"aria-checked\",tab:\"aria-selected\",option:\"aria-selected\"},ue=new Set([\"true\",\"false\",\"mixed\"]),Te=/^(show|hide|expand|collapse)?\\s*(more|less|all|details|everything)?$/i;function N(e){let o=[],r=a=>{for(let i of L(a))o.push(i),r(i)};return r(e),o}function ce(e){for(let o=e;o;o=o.parentElement)if(o.getAttribute(\"aria-hidden\")===\"true\"||o.hasAttribute(\"hidden\"))return!0;return!1}var F=e=>e.getAttribute(\"role\")?.trim().split(/\\s+/)[0]?.toLowerCase()??null,Pe=e=>{let o=e.getAttribute(\"tabindex\");if(o===null)return;let r=Number.parseInt(o,10);return Number.isNaN(r)?void 0:r},_e=e=>e.hasAttribute(\"disabled\")||e.getAttribute(\"aria-disabled\")===\"true\",I=e=>h(e,\"input\")&&(e.getAttribute(\"type\")??\"\").toLowerCase()===\"hidden\"||h(e,\"button\",\"input\",\"select\",\"textarea\")&&e.hasAttribute(\"disabled\")?!1:B(e)&&(Pe(e)??0)>=0,Z=e=>h(e,\"button\",\"select\",\"textarea\",\"summary\")||h(e,\"input\")&&(e.getAttribute(\"type\")??\"\").toLowerCase()!==\"hidden\"||e.localName===\"a\"&&e.hasAttribute(\"href\"),fe=e=>Z(e)||e.hasAttribute(\"data-graview-link\")||e.hasAttribute(\"data-graview-press\")?!0:Ie.has(F(e)??\"\"),Le=e=>e.hasAttribute(\"role\")||!V(e);function Ce(e){let o=[],r=a=>JSON.stringify(a);for(let a=e;a&&!a.hasAttribute(\"data-graview-view-root\");a=a.parentElement){let i=a.getAttribute(\"data-key\");if(i!==null){o.unshift(`[data-key=${r(i)}]`);break}let n=a.getAttribute(\"id\");if(n){o.unshift(`[id=${r(n)}]`);break}let d=a.getAttribute(\"class\")?.trim().split(/\\s+/)[0],m=`${a.localName}${d?`.${d}`:\"\"}`,p=a.parentElement;if(p){let s=L(p).filter(b=>b.localName===a.localName);s.length>1&&(m+=`:nth-of-type(${s.indexOf(a)+1})`)}o.unshift(m)}return o.join(\" > \")}var Fe=e=>{for(let o=e;o;o=o.parentElement){let r=o.getAttribute(\"data-key\");if(r!==null)return r}};function x(e){if(e.nodeType===3)return e.textContent??\"\";if(!pe(e)||e.getAttribute(\"aria-hidden\")===\"true\"||e.hasAttribute(\"hidden\"))return\"\";let o=e.getAttribute(\"aria-label\")?.trim();if(o)return` ${o} `;if(e.localName===\"img\")return` ${e.getAttribute(\"alt\")??\"\"} `;if(e.namespaceURI===U&&e.localName===\"svg\"){let r=L(e).find(a=>a.localName===\"title\");return r?` ${x(r)} `:\"\"}return h(e,\"input\",\"select\",\"textarea\")?\"\":Array.from(e.childNodes).map(x).join(\"\")}var y=e=>e.replace(/\\s+/g,\" \").trim();function Me(e,o,r){let a=e.getAttribute(\"aria-labelledby\");if(a){let n=y(a.split(/\\s+/).map(d=>o.get(d)?x(o.get(d)):\"\").join(\" \"));if(n)return n}let i=y(e.getAttribute(\"aria-label\")??\"\");if(i)return i;if(h(e,\"input\",\"select\",\"textarea\")){let n=(e.getAttribute(\"type\")??\"\").toLowerCase();if(h(e,\"input\")&&[\"submit\",\"reset\",\"button\"].includes(n))return y(e.getAttribute(\"value\")??(n===\"submit\"?\"Submit\":n===\"reset\"?\"Reset\":\"\"));if(h(e,\"input\")&&n===\"image\")return y(e.getAttribute(\"alt\")??\"\");let d=e.getAttribute(\"id\"),m=d?r.find(s=>s.getAttribute(\"for\")===d):void 0;if(m&&y(x(m)))return y(x(m));for(let s=e.parentElement;s;s=s.parentElement)if(h(s,\"label\")&&y(x(s)))return y(x(s));let p=y(e.getAttribute(\"placeholder\")??\"\");return p||y(e.getAttribute(\"title\")??\"\")}return e.localName===\"img\"?y(e.getAttribute(\"alt\")??e.getAttribute(\"title\")??\"\"):y(x(e))||y(e.getAttribute(\"title\")??\"\")}function De(e){let o=N(e);for(let r of o){let a=N(r).some(W);if(!ne(r,a)||(r.setAttribute(\"data-graview-link\",\"\"),Y(r,N(r))))continue;let i=r.localName===\"a\";if(!r.hasAttribute(\"role\")&&(i||V(r))&&r.setAttribute(\"role\",\"link\"),h(r,\"tr\")){let n=L(r).find(d=>d.localName===\"td\"||d.localName===\"th\");n&&!n.hasAttribute(\"tabindex\")&&n.setAttribute(\"tabindex\",\"0\");continue}!h(r,\"button\")&&!r.hasAttribute(\"tabindex\")&&r.setAttribute(\"tabindex\",\"0\")}for(let r of o){let a=oe(r)&&!$(r)&&!h(r,\"input\",\"select\",\"textarea\"),i=!a&&ae(r);!a&&!i||(B(r)||r.setAttribute(\"tabindex\",\"0\"),a&&V(r)&&r.setAttribute(\"role\",\"button\"),r.setAttribute(\"data-graview-press\",\"\"))}for(let r of o.filter(a=>a.namespaceURI===U&&a.localName===\"svg\")){let a=r.hasAttribute(\"role\")||r.hasAttribute(\"aria-label\")||r.hasAttribute(\"aria-labelledby\")||L(r).some(n=>n.localName===\"title\"),i=[r,...N(r)].some(n=>n.hasAttribute(\"tabindex\")||n.hasAttribute(\"data-graview-link\")||n.hasAttribute(\"data-graview-press\")||n.localName===\"a\");!a&&!i&&!r.hasAttribute(\"aria-hidden\")&&r.setAttribute(\"aria-hidden\",\"true\")}}function Ve(e,o){let r=e;return typeof r.querySelectorAll!=\"function\"?[]:o.flatMap(a=>{try{return Array.from(r.querySelectorAll(a))}catch{return[]}})}function J(e){for(let o of L(e)){if(I(o)||J(o))return!0;let r=o.shadowRoot;if(r&&J(r))return!0}return!1}function Ge(e){let o=e.ownerDocument?.defaultView;if(!o||typeof o.getComputedStyle!=\"function\")return!1;let a=(e.host??e).getBoundingClientRect?.();return!!(a&&(a.width>0||a.height>0))}function he(e,o={}){o.host===\"pending\"&&De(e);let r=N(e),a=new Map(r.flatMap(t=>t.getAttribute(\"id\")?[[t.getAttribute(\"id\"),t]]:[])),i=r.filter(t=>h(t,\"label\")),n=o.clicked?Array.from(o.clicked):[...Q(e)??[]],d=new Set([...n.filter(t=>typeof t==\"object\"),...Ve(e,n.filter(t=>typeof t==\"string\"))]),m=o.chrome===!0,p=[],s=(t,u,c,A,f,E=!1,C=le[t].wcag)=>{let D=Fe(u);p.push({rule:t,wcag:C,impact:c,at:Ce(u),...D!==void 0?{key:D}:{},says:A,fix:f,automatic:E||m})},b=r.filter(t=>!ce(t)),k=t=>Me(t,a,i)!==\"\",l=new Set(b.filter(t=>t.hasAttribute(\"data-graview-link\")&&Y(t,N(t))));for(let t of b){if(_e(t))continue;let u=t.hasAttribute(\"data-graview-link\"),c=t.hasAttribute(\"data-graview-press\"),A=d.has(t);if(!u&&!c&&!A||Z(t)&&I(t)||l.has(t)&&!A||h(t,\"tr\")&&L(t).some(E=>(E.localName===\"td\"||E.localName===\"th\")&&I(E)))continue;if(!(I(t)||A&&N(t).some(E=>I(E)&&(Z(E)||E.hasAttribute(\"data-graview-press\")||E.hasAttribute(\"data-graview-link\"))))){u||c?s(\"keyboard\",t,\"serious\",\"It is a link or a press the host makes, and Tab does not reach it.\",\"The host gives it the keyboard when it draws the view; audit the view as the host drew it.\",!0):s(\"keyboard\",t,\"serious\",`A <${t.localName}> the view hears a click on, which Tab does not reach: a mouse can press it and a keyboard cannot.`,'Draw it as a <button type=\"button\"> (the host resets its look), or give it role=\"button\" and the host gives it the keyboard, Enter and Space.');continue}I(t)&&!Le(t)&&!(t.localName===\"a\"&&t.hasAttribute(\"href\"))&&s(\"role\",t,\"serious\",`A <${t.localName}> that takes the keyboard says nothing of what it is: a screen reader says \"group\" or nothing.`,'Draw it as a <button type=\"button\">, or give it role=\"button\" (or role=\"link\" when it goes somewhere).',u||c)}for(let t of b){if(!fe(t)||l.has(t)||k(t))continue;let u=F(t),c=h(t,\"button\")||u===\"button\"||t.hasAttribute(\"data-graview-press\"),A=h(t,\"input\",\"select\",\"textarea\")||[\"textbox\",\"searchbox\",\"combobox\",\"slider\",\"spinbutton\"].includes(u??\"\"),f=A?\"field\":c?\"button\":t.hasAttribute(\"data-graview-link\")||t.localName===\"a\"||u===\"link\"?\"link\":\"control\";s(\"name\",t,c||A?\"critical\":\"serious\",`A ${f} with no name: a screen reader says only \"${f}\".`,A?'Give it a <label for> or aria-label=\"\\u2026\".':'Put words in it \\u2014 a .graview-sr span when it shows only an icon \\u2014 or aria-label=\"\\u2026\".')}for(let t of b){let u=F(t),c=u&&!h(t,\"input\")?Ne[u]:void 0;if(c&&!t.hasAttribute(c)){s(\"toggle-state\",t,\"serious\",`It is role=\"${u}\" and says no ${c}: a screen reader cannot say whether it is ${c===\"aria-checked\"?\"on\":\"chosen\"}.`,`Give it ${c}=\"true\" or \"false\", and draw it again as it changes.`);continue}for(let[f,E]of[[\"aria-checked\",ue],[\"aria-pressed\",ue],[\"aria-expanded\",new Set([\"true\",\"false\"])],[\"aria-selected\",new Set([\"true\",\"false\"])]]){let C=t.getAttribute(f);C!==null&&!E.has(C)&&s(\"toggle-state\",t,\"serious\",`${f}=\"${C}\" is no state a screen reader can say.`,`Give ${f} \"true\" or \"false\"${E.has(\"mixed\")?' (or \"mixed\")':\"\"}.`)}!(h(t,\"button\")||u===\"button\"||t.hasAttribute(\"data-graview-press\"))||t.hasAttribute(\"aria-expanded\")||t.hasAttribute(\"aria-pressed\")||(t.hasAttribute(\"aria-controls\")?s(\"toggle-state\",t,\"serious\",\"A button that says what it controls (aria-controls) and not whether that is open.\",'Give it aria-expanded=\"true\" or \"false\", and draw it again as it opens and closes.'):d.has(t)&&y(x(t))!==\"\"&&Te.test(y(x(t)))&&s(\"toggle-state\",t,\"moderate\",`A button the view hears that reads \"${y(x(t))}\" \\u2014 it opens and closes something \\u2014 and says no state.`,'Give it aria-expanded=\"true\" or \"false\" (or aria-pressed for a toggle), and draw it again as it changes.'))}for(let t of b){let u=F(t)??(h(t,\"button\")?\"button\":t.localName===\"a\"&&t.hasAttribute(\"href\")?\"link\":null);if(!u||!Oe.has(u)||u===\"img\")continue;let c=N(t).find(f=>!ce(f)&&(I(f)||fe(f)));if(!c)continue;let A=t.hasAttribute(\"data-graview-link\")&&!h(t,\"a\");s(\"nested-interactive\",t,\"serious\",`A ${u} holds a <${c.localName}> a person presses on its own: a screen reader reads the ${u} as one thing and never reaches what is inside.`,A?\"Put an <a> to the card's own record or place on its heading: the card is then a bigger target for a pointer, and the <a> the keyboard's way in.\":`Move the <${c.localName}> out of the ${u}, beside it.`)}for(let t of b){if(t.localName===\"img\"&&t.namespaceURI===me){if(t.hasAttribute(\"alt\")||t.hasAttribute(\"aria-label\")||t.hasAttribute(\"aria-labelledby\")||[\"none\",\"presentation\"].includes(F(t)??\"\"))continue;s(\"img-alt\",t,\"critical\",\"An image with no alt: a screen reader reads its address, or nothing.\",'Give it alt=\"what it shows\", or alt=\"\" when it is decoration.');continue}if(t.namespaceURI!==U||t.localName!==\"svg\"||t.parentElement?.namespaceURI===U||[t,...N(t)].some(f=>I(f)||f.hasAttribute(\"data-graview-link\")||f.hasAttribute(\"data-graview-press\")||f.localName===\"a\"))continue;let c=F(t);if(c===\"none\"||c===\"presentation\")continue;let A=k(t)&&(t.hasAttribute(\"aria-label\")||t.hasAttribute(\"aria-labelledby\")||L(t).some(f=>f.localName===\"title\"));!c&&!A?s(\"svg-name\",t,\"minor\",\"An SVG that says nothing, which a screen reader still meets.\",\"The host hides an SVG that says nothing when it draws the view.\",!0):c!==\"img\"&&c!==\"graphics-document\"?s(\"svg-name\",t,\"minor\",\"An SVG with a name and no role: some screen readers skip it.\",'Give it role=\"img\" beside its aria-label.'):A||s(\"svg-name\",t,\"serious\",'An SVG that is role=\"img\" with no name: a screen reader says \"image\" and nothing more.','Give it aria-label=\"what it shows\", or a <title> first inside it.')}let O=t=>/overflow(-[xy])?\\s*:\\s*(auto|scroll)/i.test(t.getAttribute(\"style\")??\"\"),v=t=>{I(t)&&k(t)||J(t)||s(\"scroll-region\",t,\"serious\",\"A box that scrolls by itself and holds nothing Tab reaches: the keyboard cannot scroll it, and what is past its edge is out of reach.\",'Give it tabindex=\"0\", role=\"region\" and aria-label=\"what it holds\", or let it flow with the page.')},g=o.measure!==!1&&Ge(e);if(!g)for(let t of b)O(t)&&v(t);let S=[\"keyboard\",\"role\",\"name\",\"toggle-state\",\"nested-interactive\",\"img-alt\",\"svg-name\",\"scroll-region\"],w=[],T={},P={};if(g){let t=de(b,{limit:o.limit??400,tabbable:I,scrollsOnPage:v,say:(u,c,A,f,E,C,D)=>s(u,c,A,f,E,D===!0,C)});S.push(\"focus-visible\",\"contrast\"),Object.assign(T,t.unmeasured),Object.assign(P,t.measured)}else{let t=o.measure===!1?\"Asked not to measure.\":\"Nothing here is laid out (a headless run, or a DOM with no layout): it needs a browser's styles and boxes.\";w.push({rule:\"focus-visible\",why:t},{rule:\"contrast\",why:t})}return w.push({rule:\"keyboard-trap\",why:\"It needs keys pressed in a browser: a harness's Tab walk presses them (pnpm verify a11y).\"}),{problems:p,ran:S,skipped:w,unmeasured:T,measured:P}}globalThis.__graviewAudit=he;})();\n";
|
|
7
7
|
//# sourceMappingURL=page.generated.js.map
|
package/dist/channel.d.ts
CHANGED
|
@@ -9,6 +9,15 @@ export interface Guest {
|
|
|
9
9
|
readonly props: GuestProps | undefined;
|
|
10
10
|
/** Called with every push. Returns the unsubscribe. */
|
|
11
11
|
subscribe(listener: (props: GuestProps) => void): () => void;
|
|
12
|
+
/** Whether the host has it off the page, out of sight: a frame kept for a return, its page left. */
|
|
13
|
+
readonly away: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Called as the host takes it off the page (`true`) and puts it back
|
|
16
|
+
* (`false`). The frame's client pauses its playing `<video>` and
|
|
17
|
+
* `<audio>` itself; a sound of the guest's own making (Web Audio) is
|
|
18
|
+
* its to stop here. Returns the stop.
|
|
19
|
+
*/
|
|
20
|
+
onAway(listener: (away: boolean) => void): () => void;
|
|
12
21
|
/** Ask for an act by name — or several of it, as one change and one undo, with a list of arguments (FR-193). Resolves with the host's answer; never rejects for a refusal. */
|
|
13
22
|
act(name: string, args?: Readonly<Record<string, unknown>> | readonly Readonly<Record<string, unknown>>[]): Promise<GuestAnswer>;
|
|
14
23
|
/**
|
package/dist/channel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IACvC,uDAAuD;IACvD,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC7D,8KAA8K;IAC9K,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,QAAQ,CA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AAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEhH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wEAAwE;IACxE,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACzD,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;IACvC,iBAAiB;IACjB,KAAK,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACtF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,EACf,KAAK,GAAE;IACL,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC/C,mIAAmI;IACnI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAChD,GACL;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAgHxD"}
|
package/dist/channel.js
CHANGED
|
@@ -10,6 +10,8 @@ export function openGuest(link, hooks = {}) {
|
|
|
10
10
|
let props;
|
|
11
11
|
let next = 0;
|
|
12
12
|
const listeners = new Set();
|
|
13
|
+
const awayListeners = new Set();
|
|
14
|
+
let away = false;
|
|
13
15
|
const waiting = new Map();
|
|
14
16
|
const queued = [];
|
|
15
17
|
const send = (request) => {
|
|
@@ -34,11 +36,25 @@ export function openGuest(link, hooks = {}) {
|
|
|
34
36
|
else if (message.type === "event" && typeof message.listener === "number") {
|
|
35
37
|
hooks.onEvent?.(message);
|
|
36
38
|
}
|
|
39
|
+
else if (message.type === "away" && typeof message.away === "boolean") {
|
|
40
|
+
away = message.away;
|
|
41
|
+
}
|
|
37
42
|
else if (message.type === "heartbeat" && typeof message.beat === "number") {
|
|
38
43
|
/* The runtime answers, so only a blocked event loop goes quiet. */
|
|
39
44
|
send({ type: "heartbeat", beat: message.beat });
|
|
40
45
|
}
|
|
41
46
|
hooks.onMessage?.(message);
|
|
47
|
+
/* Heard by the guest's code once the client has done its own with it (its media paused): a listener that throws stops nothing of that. */
|
|
48
|
+
if (message.type === "away" && typeof message.away === "boolean") {
|
|
49
|
+
for (const listener of [...awayListeners]) {
|
|
50
|
+
try {
|
|
51
|
+
listener(message.away);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error(error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
42
58
|
};
|
|
43
59
|
let stop = () => { };
|
|
44
60
|
const hello = (event) => {
|
|
@@ -70,6 +86,13 @@ export function openGuest(link, hooks = {}) {
|
|
|
70
86
|
listeners.add(listener);
|
|
71
87
|
return () => listeners.delete(listener);
|
|
72
88
|
},
|
|
89
|
+
get away() {
|
|
90
|
+
return away;
|
|
91
|
+
},
|
|
92
|
+
onAway(listener) {
|
|
93
|
+
awayListeners.add(listener);
|
|
94
|
+
return () => void awayListeners.delete(listener);
|
|
95
|
+
},
|
|
73
96
|
act(name, args = {}) {
|
|
74
97
|
const id = (next += 1);
|
|
75
98
|
return new Promise((resolve) => {
|
|
@@ -101,6 +124,7 @@ export function openGuest(link, hooks = {}) {
|
|
|
101
124
|
stop();
|
|
102
125
|
port?.close();
|
|
103
126
|
listeners.clear();
|
|
127
|
+
awayListeners.clear();
|
|
104
128
|
},
|
|
105
129
|
};
|
|
106
130
|
return { guest, send };
|
package/dist/channel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,GAOh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,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACrC,CAAC;QACD,KAAK;YACH,QAAQ,EAAE,UAAU,EAAE,CAAC;YACvB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,KAAK,EAAE,CAAC;YACd,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,aAAa,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;KACF,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.generated.d.ts","sourceRoot":"","sources":["../src/client.generated.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"client.generated.d.ts","sourceRoot":"","sources":["../src/client.generated.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,EAAE,MAA2xK,CAAC;AACvzK,mCAAmC;AACnC,eAAO,MAAM,mBAAmB,EAAE,MAA8D,CAAC"}
|
package/dist/client.generated.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* The frame guest's client as one classic script (FR-88), as text a host
|
|
4
4
|
* inlines, and its hash for a policy that names it.
|
|
5
5
|
*/
|
|
6
|
-
export const GUEST_CLIENT = "/*! @graview/guest/client.js — a frame guest's client (GraviewGuest.connect). Generated from src/client-script.ts. Elastic License 2.0. */\n\"use strict\";var GraviewGuest=(()=>{var k=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var
|
|
6
|
+
export const GUEST_CLIENT = "/*! @graview/guest/client.js — a frame guest's client (GraviewGuest.connect). Generated from src/client-script.ts. Elastic License 2.0. */\n\"use strict\";var GraviewGuest=(()=>{var k=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var o in t)k(e,o,{get:t[o],enumerable:!0})},z=(e,t,o,i)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let s of _(t))!P.call(e,s)&&s!==o&&k(e,s,{get:()=>t[s],enumerable:!(i=N(t,s))||i.enumerable});return e};var L=e=>z(k({},\"__esModule\",{value:!0}),e);var W={};B(W,{connect:()=>F,protocol:()=>M});var M=1;function T(e){if(typeof e==\"string\")return{type:\"navigate\",to:e};let{place:t,record:o,where:i,section:s}=e??{},a={...i===void 0?{}:{where:i},...s===void 0?{}:{section:String(s)}};return typeof t==\"string\"?{type:\"navigate\",place:t,...a}:typeof o==\"string\"?{type:\"navigate\",to:o,...a}:void 0}function S(e){let t=e;return typeof e==\"object\"&&e!==null&&t.graview===\"host-hello\"&&typeof t.nonce==\"string\"}function A(e,t={}){let o,i=\"\",s,a=0,d=new Set,u=new Set,f=!1,c=new Map,y=[],g=r=>{o?o.postMessage({...r,nonce:i}):y.push(r)},x=r=>{let n=r.data;if(!(!n||typeof n!=\"object\")){if(n.type===\"props\"){s=n.props;for(let l of d)l(n.props)}else n.type===\"answer\"?(c.get(n.id)?.(n),c.delete(n.id)):n.type===\"event\"&&typeof n.listener==\"number\"?t.onEvent?.(n):n.type===\"away\"&&typeof n.away==\"boolean\"?f=n.away:n.type===\"heartbeat\"&&typeof n.beat==\"number\"&&g({type:\"heartbeat\",beat:n.beat});if(t.onMessage?.(n),n.type===\"away\"&&typeof n.away==\"boolean\")for(let l of[...u])try{l(n.away)}catch(p){console.error(p)}}},m=()=>{},E=r=>{if(o||!e.fromHost(r)||!S(r.data)||r.data.protocol!==1)return;let n=r.ports[0];if(n){o=n,i=r.data.nonce,o.onmessage=x,o.start?.(),m();for(let l of y.splice(0))g(l)}};m=e.listen(E),e.ready({graview:\"guest-ready\",protocol:1});let b,R={get props(){return s},subscribe(r){return d.add(r),()=>d.delete(r)},get away(){return f},onAway(r){return u.add(r),()=>void u.delete(r)},act(r,n={}){let l=a+=1;return new Promise(p=>{c.set(l,p),g({type:\"act\",id:l,name:r,args:n})})},navigate(r){let n=T(r);n&&g(n)},size(r){g({type:\"size\",height:r})},autoSize(r){let n=r??globalThis.document?.documentElement,l=globalThis.ResizeObserver;if(!n||!l||typeof n.getBoundingClientRect!=\"function\")return()=>{};b?.disconnect();let p=new l(()=>R.size(Math.ceil(n.getBoundingClientRect().height)));return p.observe(n),b=p,()=>p.disconnect()},close(){b?.disconnect(),m(),o?.close(),d.clear(),u.clear()}};return{guest:R,send:g}}function H(e,t){let o=e.document,i=\"\",s=0,a=0,d=g=>{if(s=0,g-a<16)return u();let x=[],m=[],E=new Map,b=r=>Math.round(r*10)/10;for(let r of o.querySelectorAll(\"[data-record]\")){if(m.length>=200)break;let n=r.getAttribute(\"data-record\");if(!n)continue;m.push(n);let{left:l,top:p,right:v,bottom:G}=r.getBoundingClientRect();for(let h=r.parentElement;h;h=h.parentElement){let w=E.get(h);if(w===void 0){let O=e.getComputedStyle(h);E.set(h,w=O.overflowX!==\"visible\"||O.overflowY!==\"visible\"?h.getBoundingClientRect():null)}w&&(l=Math.max(l,w.left),p=Math.max(p,w.top),v=Math.min(v,w.right),G=Math.min(G,w.bottom))}l=Math.max(l,0),p=Math.max(p,0),v=Math.min(v,e.innerWidth),G=Math.min(G,e.innerHeight),v-l>=1&&G-p>=1&&x.push({id:n,x:b(l),y:b(p),width:b(v-l),height:b(G-p)})}let R=JSON.stringify([x,m]);R!==i&&(i=R,a=g,t(x,m))},u=()=>{s||=e.requestAnimationFrame(d)},f=new e.MutationObserver(u);f.observe(o.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let c=new e.ResizeObserver(u);c.observe(o.documentElement);let y=[\"scroll\",\"resize\",\"load\"];for(let g of y)e.addEventListener(g,u,!0);return u(),()=>{for(let g of y)e.removeEventListener(g,u,!0);f.disconnect(),c.disconnect(),e.cancelAnimationFrame(s)}}var U=/^data:font\\/(?:woff2|woff|ttf|otf);base64,[A-Za-z0-9+/]+=*$/;function q(){let e=[];return t=>{if(t.type!==\"fonts\"||!Array.isArray(t.fonts))return;let o=globalThis,i=o.FontFace,s=o.document?.fonts;if(!i||!s)return;let a=e;e=[];for(let d of t.fonts.slice(0,8)){if(typeof d?.family!=\"string\"||typeof d.src!=\"string\"||!U.test(d.src))continue;let u=`url(${JSON.stringify(d.src)})`,f={display:\"swap\",...typeof d.weight==\"string\"?{weight:d.weight}:{},...typeof d.style==\"string\"?{style:d.style}:{}},c=new i(d.family,u,f);c.status===\"error\"&&(c=new i(JSON.stringify(d.family),u,f)),s.add(c),e.push(c),c.load().catch(()=>s.delete(c))}for(let d of a)s.delete(d)}}function D(e){let t=[];return o=>{if(o.type!==\"away\"||typeof o.away!=\"boolean\")return;let i=e();if(!i)return;if(o.away){for(let a of i.querySelectorAll(\"video, audio\"))a.paused||(a.pause(),t.push(a));return}let s=t;t=[];for(let a of s)a.isConnected&&a.paused&&a.play()?.catch(()=>{})}}function F(e={}){let t=e.window??globalThis,o=q(),i=D(()=>t.document),s,a=t,d=()=>{!s&&a.document&&\"ResizeObserver\"in a&&\"MutationObserver\"in a&&\"requestAnimationFrame\"in a&&(s=H(a,(y,g)=>u.send({type:\"records\",boxes:y,shows:g})))},u=A({listen(y){return t.addEventListener(\"message\",y),()=>t.removeEventListener(\"message\",y)},fromHost:y=>y.source===t.parent&&(e.hostOrigin===void 0||y.origin===e.hostOrigin),ready:y=>t.parent?.postMessage(y,\"*\")},{onMessage:y=>{o(y),i(y),d()}}),{guest:f}=u,c=f.close;return f.close=()=>(s?.(),c()),f}return L(W);})();\n";
|
|
7
7
|
/** For `script-src 'sha256-…'`. */
|
|
8
|
-
export const GUEST_CLIENT_SHA256 = "sha256-
|
|
8
|
+
export const GUEST_CLIENT_SHA256 = "sha256-O5M2iMMcJB59hOTK/gwnFrnZIHE/8aQ3qpYg86eM/WI=";
|
|
9
9
|
//# sourceMappingURL=client.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.generated.js","sourceRoot":"","sources":["../src/client.generated.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAW,
|
|
1
|
+
{"version":3,"file":"client.generated.js","sourceRoot":"","sources":["../src/client.generated.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAW,kxKAAkxK,CAAC;AACvzK,mCAAmC;AACnC,MAAM,CAAC,MAAM,mBAAmB,GAAW,qDAAqD,CAAC"}
|
package/dist/guest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guest.d.ts","sourceRoot":"","sources":["../src/guest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrD,8DAA8D;AAC9D,UAAU,WAAW;IACnB,QAAQ,CAAC,MAAM,EAAE;QAAE,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACtF,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAC;IACjF,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAC;CACrF;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,YAAY,EAAE,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"guest.d.ts","sourceRoot":"","sources":["../src/guest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrD,8DAA8D;AAC9D,UAAU,WAAW;IACnB,QAAQ,CAAC,MAAM,EAAE;QAAE,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACtF,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAC;IACjF,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAC;CACrF;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,YAAY,EAAE,KAAK,EAAE,CAAC;AAkEtB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,KAAK,CA+BrE"}
|
package/dist/guest.js
CHANGED
|
@@ -38,6 +38,39 @@ function frameFonts() {
|
|
|
38
38
|
faces.delete(face);
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* WHAT IT PLAYS STOPS WHERE NOBODY SEES IT (Graview HQ
|
|
43
|
+
* feature:f-kept-frame-told-off-page): a frame kept for a return is moved,
|
|
44
|
+
* still running, off the page as its page is left. Told so, the client
|
|
45
|
+
* pauses every `<video>` and `<audio>` of the document that is playing, and
|
|
46
|
+
* told it is back, plays again what it paused that still stands paused.
|
|
47
|
+
* A sound of the guest's own making — Web Audio, a `new Audio()` never put
|
|
48
|
+
* in the document, media in a shadow root — is its to stop (`guest.onAway`).
|
|
49
|
+
*/
|
|
50
|
+
function mediaAway(document) {
|
|
51
|
+
let paused = [];
|
|
52
|
+
return (message) => {
|
|
53
|
+
if (message.type !== "away" || typeof message.away !== "boolean")
|
|
54
|
+
return;
|
|
55
|
+
const here = document();
|
|
56
|
+
if (!here)
|
|
57
|
+
return;
|
|
58
|
+
if (message.away) {
|
|
59
|
+
for (const media of here.querySelectorAll("video, audio")) {
|
|
60
|
+
if (media.paused)
|
|
61
|
+
continue;
|
|
62
|
+
media.pause();
|
|
63
|
+
paused.push(media);
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const again = paused;
|
|
68
|
+
paused = [];
|
|
69
|
+
for (const media of again)
|
|
70
|
+
if (media.isConnected && media.paused)
|
|
71
|
+
void media.play()?.catch(() => undefined);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
41
74
|
/**
|
|
42
75
|
* Connect a guest view to its host: say it is ready, take the first hello
|
|
43
76
|
* from the parent, and talk only over the port that came with it.
|
|
@@ -45,6 +78,7 @@ function frameFonts() {
|
|
|
45
78
|
export function connectGuest(options = {}) {
|
|
46
79
|
const at = options.window ?? globalThis;
|
|
47
80
|
const fonts = frameFonts();
|
|
81
|
+
const media = mediaAway(() => at.document);
|
|
48
82
|
/* Where its records are, said once the host has said hello, and again as they move (record-report.ts): what a line to each is drawn from. A window that lays nothing out says nothing. */
|
|
49
83
|
let reporting;
|
|
50
84
|
const laidOut = at;
|
|
@@ -62,6 +96,7 @@ export function connectGuest(options = {}) {
|
|
|
62
96
|
}, {
|
|
63
97
|
onMessage: (message) => {
|
|
64
98
|
fonts(message);
|
|
99
|
+
media(message);
|
|
65
100
|
report();
|
|
66
101
|
},
|
|
67
102
|
});
|
package/dist/guest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guest.js","sourceRoot":"","sources":["../src/guest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAsBnD,sFAAsF;AACtF,MAAM,SAAS,GAAG,6DAA6D,CAAC;AAEhF;;;;;;GAMG;AACH,SAAS,UAAU;IACjB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zD,EACD;QACE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YACrB,KAAK,CAAC,OAAO,CAAC,CAAC;YACf,KAAK,CAAC,OAAO,CAAC,CAAC;YACf,MAAM,EAAE,CAAC;QACX,CAAC;KACF,CACF,CAAC;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,KAAK,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7C,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/headless/seats.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface HeadlessSeat {
|
|
|
18
18
|
* owner alone. Where the owner handed holds the policy's own `owner`
|
|
19
19
|
* role, it is that role's seat, and none is made up for it a second time.
|
|
20
20
|
*/
|
|
21
|
-
export declare function seatsOfPolicy(
|
|
21
|
+
export declare function seatsOfPolicy(given: Policy | undefined, owner: Principal): readonly HeadlessSeat[];
|
|
22
22
|
/** What came of a view for one seat. */
|
|
23
23
|
export interface SeatCheck {
|
|
24
24
|
/** The seat, as `seatsOfPolicy` or the host named it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seats.d.ts","sourceRoot":"","sources":["../../src/headless/seats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seats.d.ts","sourceRoot":"","sources":["../../src/headless/seats.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAa/E,+FAA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B;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,SAAS,IAAI,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG;IAC5G,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C,CAAC;AAcF;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CA4C5H"}
|
package/dist/headless/seats.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRoomsOwn } from "@graview/core/rooms";
|
|
1
2
|
import { rolesOf } from "@graview/core";
|
|
2
3
|
import { forgetSeatView } from "@graview/core/seat";
|
|
3
4
|
import { readsOnlyUnseen, unseenOf, viewKinds } from "../host/unseen.js";
|
|
@@ -12,8 +13,11 @@ import { readsOnlyUnseen, unseenOf, viewKinds } from "../host/unseen.js";
|
|
|
12
13
|
* owner alone. Where the owner handed holds the policy's own `owner`
|
|
13
14
|
* role, it is that role's seat, and none is made up for it a second time.
|
|
14
15
|
*/
|
|
15
|
-
export function seatsOfPolicy(
|
|
16
|
+
export function seatsOfPolicy(given, owner) {
|
|
16
17
|
const seats = [{ name: "owner", principal: owner }];
|
|
18
|
+
// The app's own policy: what the framework folds in for its rooms and its conversations with the AI makes no seat.
|
|
19
|
+
const grants = (given?.grants ?? []).filter((grant) => !isRoomsOwn(grant));
|
|
20
|
+
const policy = given && grants.length > 0 ? { ...given, grants, ...(given.sees ? { sees: given.sees.filter((sight) => !isRoomsOwn(sight)) } : {}) } : undefined;
|
|
17
21
|
if (!policy)
|
|
18
22
|
return seats;
|
|
19
23
|
const named = new Set(rolesOf(policy));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seats.js","sourceRoot":"","sources":["../../src/headless/seats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+C,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAqBzE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"seats.js","sourceRoot":"","sources":["../../src/headless/seats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAA+C,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAqBzE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB,EAAE,KAAgB;IACvE,MAAM,KAAK,GAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACpE,mHAAmH;IACnH,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAuB,KAAK,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,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