@daybook/feedback 1.2.2 → 1.2.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/README.md +35 -1
- package/dist/feedback.js +123 -48
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types.d.ts +12 -0
- package/dist/widget.d.ts +45 -4
- package/dist/widget.js +274 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -227,7 +227,15 @@ three days later when the reporter has moved on.
|
|
|
227
227
|
- **Breadcrumbs** — the last 40 navigations, clicks, console errors and failed or slow requests.
|
|
228
228
|
- **A screenshot**, if the reporter ticks "Capture the screen" and consents to the browser's share
|
|
229
229
|
prompt. The widget hides itself for the frame, so the picture is of the page underneath rather
|
|
230
|
-
than of the form that was just filled in
|
|
230
|
+
than of the form that was just filled in — and if the reporter pinned an element, that element is
|
|
231
|
+
ringed in the picture.
|
|
232
|
+
|
|
233
|
+
The ring is the difference between a report you can act on and one you have to reconstruct. A
|
|
234
|
+
selector and a text snapshot tell you which node; they do not tell you which of the forty things
|
|
235
|
+
on that screen the sentence is about. It is drawn in the widget's own layer, never on your page:
|
|
236
|
+
no style of yours is touched, nothing reflows, and there is no undo to get wrong. The rest of the
|
|
237
|
+
page is left exactly as it was — no dimming — because the screenshot is also the record of what
|
|
238
|
+
the page looked like, and a report about a colour should not arrive with the colours changed.
|
|
231
239
|
|
|
232
240
|
`screenshots` decides what the composer offers, and takes three values:
|
|
233
241
|
|
|
@@ -325,6 +333,32 @@ await pm.report('Checkout threw', { // a caught error, no user present
|
|
|
325
333
|
|
|
326
334
|
`report()` takes no screenshot: there is nobody there to consent to a screen share.
|
|
327
335
|
|
|
336
|
+
## The look is set in Daybook, not in code
|
|
337
|
+
|
|
338
|
+
Everything about the widget's appearance lives on the integration, so it is changed on the Feedback
|
|
339
|
+
widget page in Daybook and takes effect on every install of that key without a deploy:
|
|
340
|
+
|
|
341
|
+
| | |
|
|
342
|
+
|---|---|
|
|
343
|
+
| Button style | `pill`, `pill-icon`, `icon`, `text`, `outline` |
|
|
344
|
+
| Button text | Anything up to 24 characters. Defaults to "Feedback" |
|
|
345
|
+
| Colour scheme | `auto` (the default), `light`, `dark` |
|
|
346
|
+
| Corner | Bottom right by default — and `placement` in `init()` overrides it |
|
|
347
|
+
| Accent | Any CSS colour |
|
|
348
|
+
|
|
349
|
+
**Auto is the default and is the one to keep.** The widget is a guest on your page, and your page is
|
|
350
|
+
already light or dark for that reader; following their own setting is almost always right. Pin it
|
|
351
|
+
only when your app is one or the other regardless of the system.
|
|
352
|
+
|
|
353
|
+
The five button styles exist because one button cannot be right for every page. A product with its
|
|
354
|
+
own bold chat bubble does not want a second bold pill beside it; a spare documentation site does not
|
|
355
|
+
want a filled button at all; a dense application usually wants the smallest possible mark. All five
|
|
356
|
+
keep the same hit area in the same corner, so nothing else about the widget changes with the choice.
|
|
357
|
+
|
|
358
|
+
If you are building your own settings screen, `previewLauncher(element, theme)` draws the real
|
|
359
|
+
button — the real stylesheet, in a shadow root — so a preview cannot drift from the thing it
|
|
360
|
+
previews.
|
|
361
|
+
|
|
328
362
|
## Theming, but not styling
|
|
329
363
|
|
|
330
364
|
The widget renders in a shadow root. A host page's `* { }` reset, its `button { all: unset }`, or its
|
package/dist/feedback.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";var DaybookFeedback=(()=>{var P=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var be=(n,e)=>{for(var t in e)P(n,t,{get:e[t],enumerable:!0})},ye=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of me(e))!ge.call(n,i)&&i!==t&&P(n,i,{get:()=>e[i],enumerable:!(o=fe(e,i))||o.enumerable});return n};var we=n=>ye(P({},"__esModule",{value:!0}),n);var ze={};be(ze,{DEFAULT_API_URL:()=>ue,DaybookFeedback:()=>R,captureAnchor:()=>_,init:()=>Be,resolveAnchor:()=>ae});function v(n){var e;try{let t=new URL(n,location.href);return t.origin===location.origin?t.pathname:`${t.origin}${t.pathname}`}catch{return(e=n.split("?")[0])!=null?e:n}}function F(n){var o,i,r,s,a,c;let e=n.tagName.toLowerCase();if(!n.getAttribute("aria-label")&&!n.getAttribute("data-testid")&&!((o=n.textContent)!=null?o:"").trim()){let l=n.closest("button, a, [role=button], [data-testid], label");if(l&&l!==n)return F(l)}if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement){let l=(r=(i=n.getAttribute("name"))!=null?i:n.id)!=null?r:"",h=n instanceof HTMLInputElement?n.type:e;return`${e}[${h}]${l?` name=${l}`:""}`}let t=(c=(s=n.getAttribute("aria-label"))!=null?s:n.getAttribute("data-testid"))!=null?c:((a=n.textContent)!=null?a:"").replace(/\s+/g," ").trim().slice(0,40);return t?`${e} "${t}"`:e}function Q(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,"[jwt]").replace(/\bBearer\s+[\w.-]+/gi,"Bearer [redacted]").replace(/\b\d{12,19}\b/g,"[number]").slice(0,500)}var J="data-daybook-private";var k=class{constructor(e=40,t=!0){this.limit=e;this.redact=t;this.entries=[];this.detach=[]}list(){return[...this.entries]}add(e,t){for(this.entries.push({at:new Date().toISOString(),type:e,message:this.redact?Q(t):t.slice(0,500)});this.entries.length>this.limit;)this.entries.shift()}start(){let e=a=>{let c=a.target;c instanceof Element&&(c.closest("[data-daybook-feedback]")||this.add("click",F(c)))};document.addEventListener("click",e,{capture:!0,passive:!0}),this.detach.push(()=>document.removeEventListener("click",e,{capture:!0}));let t=history.pushState,o=history.replaceState,i=()=>this.add("nav",v(location.href));history.pushState=(...a)=>{t.apply(history,a),i()},history.replaceState=(...a)=>{o.apply(history,a),i()},window.addEventListener("popstate",i),this.detach.push(()=>{history.pushState=t,history.replaceState=o,window.removeEventListener("popstate",i)});for(let a of["error","warn"]){let c=console[a];console[a]=(...l)=>{this.add("console",`${a}: ${l.map(I).join(" ")}`),c.apply(console,l)},this.detach.push(()=>{console[a]=c})}let r=a=>this.add("console",`uncaught: ${a.message}`),s=a=>this.add("console",`unhandled rejection: ${I(a.reason)}`);window.addEventListener("error",r),window.addEventListener("unhandledrejection",s),this.detach.push(()=>{window.removeEventListener("error",r),window.removeEventListener("unhandledrejection",s)}),this.watchFetch()}stop(){for(let e of this.detach.splice(0))e()}watchFetch(){if(typeof window.fetch!="function")return;let e=window.fetch;window.fetch=async(...t)=>{let o=performance.now();try{let i=await e.apply(window,t),r=Math.round(performance.now()-o);return(!i.ok||r>3e3)&&this.add("network",`${i.status} ${v(G(t[0]))} ${r}ms`),i}catch(i){throw this.add("network",`failed ${v(G(t[0]))}: ${I(i)}`),i}},this.detach.push(()=>{window.fetch=e})}};function G(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function I(n){var e,t;if(typeof n=="string")return n;if(n instanceof Error)return`${n.name}: ${n.message}`;try{return(t=(e=JSON.stringify(n))==null?void 0:e.slice(0,200))!=null?t:String(n)}catch{return String(n)}}var O="pm.feedback.queue";var T=class{constructor(e,t){this.apiUrl=e;this.ingestKey=t;this.session=null;this.identityToken=null}setSession(e){this.session=e}async send(e,t=[],o){var c,l,h;let i={idempotencyKey:(c=e.idempotencyKey)!=null?c:Z(),...e,attachments:[...(l=e.attachments)!=null?l:[],...t.map(p=>({filename:p.filename,contentType:p.contentType,size:p.blob.size}))]},r=await this.post("/ingest/v1",i);if(!r.ok)throw await E(r);let s=await r.json(),a=((h=e.attachments)!=null?h:[]).length;return await Promise.all(t.map(async(p,g)=>{let b=ve(s,a+g);if(!b){o==null||o(p,new Error("The server would not accept that file."));return}try{await this.upload(b,p)}catch(w){o==null||o(p,w)}})),s}async flush(){let e=te();if(e.length!==0){ne([]);for(let t of e)try{let o=await this.post("/ingest/v1",t);!o.ok&&(o.status===429||o.status>=500)&&j(t)}catch{j(t)}}}queue(e){var t;j({...e,idempotencyKey:(t=e.idempotencyKey)!=null?t:Z(),attachments:void 0})}async signIn(){let e=ee(64),t=await xe(e),o=ee(16),i=`${this.base()}/ingest/v1/authorize?key=${encodeURIComponent(this.ingestKey)}&origin=${encodeURIComponent(location.origin)}&code_challenge=${encodeURIComponent(t)}&state=${encodeURIComponent(o)}`,r=window.open(i,"daybook-feedback","width=460,height=640");if(!r)throw Object.assign(new Error("Popup blocked"),{code:"popup_blocked"});let s=await new Promise((l,h)=>{let p=setInterval(()=>{r.closed&&(b(),h(Object.assign(new Error("Sign-in cancelled"),{code:"cancelled"})))},400),g=w=>{if(w.origin!==new URL(this.base()).origin)return;let m=w.data;if((m==null?void 0:m.source)==="daybook-feedback"&&m.state===o){if(b(),m.error||!m.code){h(Object.assign(new Error("Sign-in was refused"),{code:m.error||"refused"}));return}l(m.code)}},b=()=>{clearInterval(p),window.removeEventListener("message",g)};window.addEventListener("message",g)}),a=await this.post("/ingest/v1/token",{code:s,codeVerifier:e});if(!a.ok)throw await E(a);let{identityToken:c}=await a.json();return this.identityToken=c,c}base(){return this.apiUrl.replace(/\/$/,"")}resolve(e){try{let t=new URL(this.base()),o=new URL(e,t);return o.hostname===t.hostname?new URL(o.pathname+o.search,t).toString():o.toString()}catch{return e}}async handshake(e){var i,r;let t=await this.post("/ingest/v1/session",{...e,identityToken:(i=this.identityToken)!=null?i:void 0});if(!t.ok)throw await E(t);let o=await t.json();return this.session=(r=o.sessionToken)!=null?r:null,o}post(e,t){let o={"Content-Type":"application/json","X-Ingest-Key":this.ingestKey};return this.session&&(o["X-Feedback-Session"]=this.session),fetch(`${this.base()}${e}`,{method:"POST",headers:o,body:JSON.stringify(t),credentials:"omit"})}async upload(e,t){let o=await fetch(this.resolve(e.uploadUrl),{method:e.method,headers:{"Content-Type":e.contentType,"X-Ingest-Key":this.ingestKey},body:t.blob,credentials:"omit"});if(!o.ok)throw await E(o);await this.post(`/ingest/v1/attachments/${e.id}/confirm`,{})}};function ve(n,e){let t=n.attachments.find(o=>o.index===e);return t!=null?t:n.attachments.some(o=>typeof o.index=="number")?void 0:n.attachments[e]}function j(n){let e=te();e.push(n),ne(e.slice(-20))}function te(){try{let n=localStorage.getItem(O);return n?JSON.parse(n):[]}catch{return[]}}function ne(n){try{n.length===0?localStorage.removeItem(O):localStorage.setItem(O,JSON.stringify(n))}catch{}}async function E(n){let e=`http_${n.status}`;try{let t=await n.json();if(t.code&&(e=t.code),t.message)return Object.assign(new Error(t.message),{code:e})}catch{}return Object.assign(new Error(`Ingest failed (${n.status})`),{code:e})}function Z(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ee(n){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=new Uint8Array(n);return crypto.getRandomValues(t),Array.from(t,o=>e[o%e.length]).join("")}async function xe(n){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function q(n){var t;let e={platform:"web",route:location.pathname,title:document.title.slice(0,200),locale:navigator.language,timezone:Ee(),viewport:{width:window.innerWidth,height:window.innerHeight,dpr:(t=window.devicePixelRatio)!=null?t:1},device:ke()};return document.referrer&&(e.referrer=v(document.referrer)),n.app&&(e.app=n.app),n.anchor&&(e.anchor=n.anchor),n.breadcrumbs&&n.breadcrumbs.length>0&&(e.breadcrumbs=n.breadcrumbs),e}function ke(){var i;let n=navigator.userAgent,e=/Edg\//.test(n)?"Edge":/OPR\//.test(n)?"Opera":/Firefox\//.test(n)?"Firefox":/Chrome\//.test(n)?"Chrome":/Safari\//.test(n)?"Safari":"Unknown",t=/Windows NT/.test(n)?"Windows":/iPhone|iPad|iPod/.test(n)?"iOS":/Mac OS X/.test(n)?"macOS":/Android/.test(n)?"Android":/Linux/.test(n)?"Linux":"Unknown",o=(i=n.match(/(?:Edg|OPR|Firefox|Chrome|Version)\/(\d+)/))==null?void 0:i[1];return{browser:o?`${e} ${o}`:e,os:t,touch:navigator.maxTouchPoints>0,userAgent:n.slice(0,300)}}function Ee(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return`UTC${-new Date().getTimezoneOffset()/60}`}}async function re(n,e=()=>()=>{}){var r;if(typeof((r=navigator.mediaDevices)==null?void 0:r.getDisplayMedia)!="function")return null;let t=n?_e():()=>{},o=e(),i=null;try{return i=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),i.getVideoTracks()[0]?(await new Promise(a=>setTimeout(a,250)),await Le(i)):null}catch{return null}finally{i==null||i.getTracks().forEach(s=>s.stop()),o(),t()}}var oe=1920,Te=.82;async function Le(n){let e=document.createElement("video");e.srcObject=n,e.muted=!0,await e.play().catch(()=>{});let t=e.videoWidth||window.innerWidth,o=e.videoHeight||window.innerHeight,i=t>oe?oe/t:1,r=document.createElement("canvas");r.width=Math.round(t*i),r.height=Math.round(o*i);let s=r.getContext("2d");if(!s)return null;s.imageSmoothingQuality="high",s.drawImage(e,0,0,r.width,r.height),e.pause(),e.srcObject=null;let a=await Se(r);if(!a)return null;let c=a.type||"image/png";return{blob:a,filename:`screenshot.${c==="image/webp"?"webp":c==="image/jpeg"?"jpg":"png"}`,contentType:c}}async function Se(n){for(let e of["image/webp","image/jpeg"]){let t=await ie(n,e,Te);if((t==null?void 0:t.type)===e)return t}return ie(n,"image/png")}function ie(n,e,t){return new Promise(o=>n.toBlob(i=>o(i),e,t))}function _e(){let n=[...document.querySelectorAll(`[${J}]`),...document.querySelectorAll('input[type="password"]')],e=n.map(t=>t.style.filter);return n.forEach(t=>{t.style.filter="blur(12px)"}),()=>{n.forEach((t,o)=>{var i;t.style.filter=(i=e[o])!=null?i:""})}}function _(n,e){let t=document.elementFromPoint(n,e);if(!(t instanceof HTMLElement))return{selector:null,offsetX:S(n/window.innerWidth),offsetY:S(e/window.innerHeight),elementText:null};let o=t.getBoundingClientRect();return{selector:Me(t),offsetX:o.width>0?S((n-o.left)/o.width):0,offsetY:o.height>0?S((e-o.top)/o.height):0,elementText:$e(t)}}function ae(n){if(!n.selector)return{x:n.offsetX*window.innerWidth,y:n.offsetY*window.innerHeight};let e=null;try{e=document.querySelector(n.selector)}catch{return null}if(!e)return null;let t=e.getBoundingClientRect();return{x:t.left+n.offsetX*t.width,y:t.top+n.offsetY*t.height}}function Me(n){if(n===document.body)return"body";for(let i of["data-testid","data-test","data-daybook-id","data-cy"]){let r=n.getAttribute(i);if(r){let s=`[${i}="${B(r)}"]`;if(L(s))return s}}if(n.id&&!se(n.id)){let i=`#${B(n.id)}`;if(L(i))return i}let e=[],t=n;for(;t&&t!==document.body&&e.length<8;){let i=t.tagName.toLowerCase(),r=Array.from(t.classList).filter(c=>!se(c)).slice(0,2);r.length>0&&(i+=r.map(c=>`.${B(c)}`).join(""));let s=t.parentElement;if(s){let c=Array.from(s.children).filter(l=>l.tagName===t.tagName);c.length>1&&(i+=`:nth-of-type(${c.indexOf(t)+1})`)}e.unshift(i);let a=e.join(" > ");if(L(a))return a;t=s}let o=e.length>0?`body > ${e.join(" > ")}`:null;return o&&L(o)?o:null}function L(n){try{return document.querySelectorAll(n).length===1}catch{return!1}}function se(n){return/^[a-z]{1,3}[0-9a-f]{5,}$/i.test(n)||/--[0-9a-f]{5,}$/i.test(n)||/^_[0-9a-z]{5,}/i.test(n)||/^v-[0-9a-f]{6,}$/i.test(n)||/^ng-/.test(n)||/[0-9a-f]{8,}/i.test(n)}function $e(n){var o,i,r;let t=((i=(o=n.innerText)!=null?o:n.textContent)!=null?i:"").replace(/\s+/g," ").trim();if(!t){let s=(r=n.getAttribute("aria-label"))!=null?r:n.getAttribute("title");return(s==null?void 0:s.trim())||null}return t.length>80?`${t.slice(0,77)}\u2026`:t}function S(n){return Number.isFinite(n)?Math.max(0,Math.min(1,n)):0}function B(n){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/([^\w-])/g,"\\$1")}var Ae=/^(image\/(png|jpeg|gif|webp)|video\/(mp4|quicktime|webm))$/;function ce(n,e){let t=[];for(let o of n){if(e+t.length>=5)break;let i=Ae.test(o.type)?o.size>26214400?`Too large (${(o.size/1048576).toFixed(1)} MB, max 25).`:null:"Only images and short videos.";t.push({blob:o,filename:o.name||`pasted-${t.length+1}.${Re(o.type)}`,contentType:o.type,preview:i?null:URL.createObjectURL(o),error:i})}return t}function le(n){var o;let e=(o=n.clipboardData)==null?void 0:o.items;if(!e)return[];let t=[];for(let i of e){if(i.kind!=="file")continue;let r=i.getAsFile();r&&t.push(r)}return t}function M(n){for(let e of n)e.preview&&URL.revokeObjectURL(e.preview)}function Re(n){var e,t;return(t=(e=n.split("/")[1])==null?void 0:e.replace("quicktime","mov"))!=null?t:"bin"}function de(n){var o;let t=(o=(typeof n.composedPath=="function"?n.composedPath():[])[0])!=null?o:n.target;return!t||t.nodeType!==1?!1:/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)?!0:typeof t.closest=="function"&&t.closest('[contenteditable=""], [contenteditable="true"]')!==null}function He(n,e,t){let o=0;for(let s of e){if(s.right<=n.left||s.left>=n.right)continue;let a=n.v==="bottom"?t.height-s.top:s.bottom;a>o&&(o=a)}if(o===0)return 0;let i=n.v==="bottom"?t.height-n.bottom:n.top,r=Math.round(o+12-i);return r<=0||r>t.height*.35?0:r}function Ce(n,e,t){if(n===e||e.contains(n)||n.contains(e)||n===document.body||n===document.documentElement)return!1;let o=getComputedStyle(n);if(o.position!=="fixed"&&o.position!=="sticky"||o.visibility==="hidden"||o.display==="none"||Number(o.opacity)===0)return!1;let i=n.getBoundingClientRect();return!(i.width<8||i.height<8||i.width*i.height>t.width*t.height*.25)}function Pe(n,e,t){if(typeof document.elementsFromPoint!="function")return[];let o=new Map,i=[];for(let s=n.left+4;s<n.right;s+=32)i.push(s);i.push(n.right-4);let r=t.height*.35;for(let s=0;s<=r;s+=32){let a=n.v==="bottom"?n.bottom-s:n.top+s;if(a<0||a>t.height)break;for(let c of i)if(!(c<0||c>t.width))for(let l of document.elementsFromPoint(c,a)){if(o.has(l)||!Ce(l,e,t))continue;let h=l.getBoundingClientRect();o.set(l,{top:h.top,bottom:h.bottom,left:h.left,right:h.right})}}return[...o.values()]}function pe(n,e){let t={width:window.innerWidth,height:window.innerHeight};return He(n,Pe(n,e,t),t)}var A=class{constructor(e,t){this.options=e;this.onSubmit=t;this.mode="idle";this.anchor=null;this.detach=[];this.clearance=0;this.state="ready";this.policy=null;this.dragged=null;this.reference=null;this.uploadsFailed=0;this.host=document.createElement("div"),this.host.setAttribute("data-daybook-feedback",""),this.host.style.cssText="position:fixed;inset:0;z-index:2147483000;pointer-events:none",this.root=this.host.attachShadow({mode:"open"}),this.root.innerHTML=`<style>${qe}</style><style id="theme"></style><style id="place"></style><div id="layer"></div>`}setTheme(e){var r;let t=this.root.getElementById("theme");if(!t)return;if(!e){t.textContent="";return}let o=[];Oe(e.accent)&&o.push(`--pm-accent: ${e.accent}`);let i={none:"0",sm:"6px",md:"12px",lg:"18px"}[(r=e.cornerRadius)!=null?r:"md"];i&&o.push(`--pm-radius: ${i}`),t.textContent=o.length>0?`:host { ${o.join("; ")} }`:"",this.themePlacement=e.position,this.applyPlacement(),this.launcherLabel=typeof e.launcherLabel=="string"&&e.launcherLabel.length>0?e.launcherLabel.slice(0,24):void 0}get placement(){var e,t;return(t=(e=this.options.placement)!=null?e:this.themePlacement)!=null?t:"bottom-right"}applyPlacement(){let e=this.root.getElementById("place");if(!e)return;let t=this.placement,o=t.startsWith("bottom")?"bottom":"top",i=t.endsWith("right")?"right":"left",r=f+this.clearance;e.textContent=`:host {
|
|
2
|
-
--pm-${
|
|
3
|
-
--pm-${o}: ${
|
|
4
|
-
}`}homeSlot(){let e=this.placement,t=220,o=48,
|
|
1
|
+
"use strict";var DaybookFeedback=(()=>{var I=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var Le=(n,e)=>{for(var t in e)I(n,t,{get:e[t],enumerable:!0})},_e=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Te(e))!Se.call(n,r)&&r!==t&&I(n,r,{get:()=>e[r],enumerable:!(o=Ee(e,r))||o.enumerable});return n};var $e=n=>_e(I({},"__esModule",{value:!0}),n);var Je={};Le(Je,{DEFAULT_API_URL:()=>ke,DaybookFeedback:()=>H,captureAnchor:()=>_,init:()=>Ye,previewLauncher:()=>ye,resolveAnchor:()=>le});function v(n){var e;try{let t=new URL(n,location.href);return t.origin===location.origin?t.pathname:`${t.origin}${t.pathname}`}catch{return(e=n.split("?")[0])!=null?e:n}}function P(n){var o,r,i,s,a,c;let e=n.tagName.toLowerCase();if(!n.getAttribute("aria-label")&&!n.getAttribute("data-testid")&&!((o=n.textContent)!=null?o:"").trim()){let l=n.closest("button, a, [role=button], [data-testid], label");if(l&&l!==n)return P(l)}if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement){let l=(i=(r=n.getAttribute("name"))!=null?r:n.id)!=null?i:"",h=n instanceof HTMLInputElement?n.type:e;return`${e}[${h}]${l?` name=${l}`:""}`}let t=(c=(s=n.getAttribute("aria-label"))!=null?s:n.getAttribute("data-testid"))!=null?c:((a=n.textContent)!=null?a:"").replace(/\s+/g," ").trim().slice(0,40);return t?`${e} "${t}"`:e}function G(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,"[jwt]").replace(/\bBearer\s+[\w.-]+/gi,"Bearer [redacted]").replace(/\b\d{12,19}\b/g,"[number]").slice(0,500)}var Z="data-daybook-private";var k=class{constructor(e=40,t=!0){this.limit=e;this.redact=t;this.entries=[];this.detach=[]}list(){return[...this.entries]}add(e,t){for(this.entries.push({at:new Date().toISOString(),type:e,message:this.redact?G(t):t.slice(0,500)});this.entries.length>this.limit;)this.entries.shift()}start(){let e=a=>{let c=a.target;c instanceof Element&&(c.closest("[data-daybook-feedback]")||this.add("click",P(c)))};document.addEventListener("click",e,{capture:!0,passive:!0}),this.detach.push(()=>document.removeEventListener("click",e,{capture:!0}));let t=history.pushState,o=history.replaceState,r=()=>this.add("nav",v(location.href));history.pushState=(...a)=>{t.apply(history,a),r()},history.replaceState=(...a)=>{o.apply(history,a),r()},window.addEventListener("popstate",r),this.detach.push(()=>{history.pushState=t,history.replaceState=o,window.removeEventListener("popstate",r)});for(let a of["error","warn"]){let c=console[a];console[a]=(...l)=>{this.add("console",`${a}: ${l.map(B).join(" ")}`),c.apply(console,l)},this.detach.push(()=>{console[a]=c})}let i=a=>this.add("console",`uncaught: ${a.message}`),s=a=>this.add("console",`unhandled rejection: ${B(a.reason)}`);window.addEventListener("error",i),window.addEventListener("unhandledrejection",s),this.detach.push(()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",s)}),this.watchFetch()}stop(){for(let e of this.detach.splice(0))e()}watchFetch(){if(typeof window.fetch!="function")return;let e=window.fetch;window.fetch=async(...t)=>{let o=performance.now();try{let r=await e.apply(window,t),i=Math.round(performance.now()-o);return(!r.ok||i>3e3)&&this.add("network",`${r.status} ${v(ee(t[0]))} ${i}ms`),r}catch(r){throw this.add("network",`failed ${v(ee(t[0]))}: ${B(r)}`),r}},this.detach.push(()=>{window.fetch=e})}};function ee(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function B(n){var e,t;if(typeof n=="string")return n;if(n instanceof Error)return`${n.name}: ${n.message}`;try{return(t=(e=JSON.stringify(n))==null?void 0:e.slice(0,200))!=null?t:String(n)}catch{return String(n)}}var j="pm.feedback.queue";var T=class{constructor(e,t){this.apiUrl=e;this.ingestKey=t;this.session=null;this.identityToken=null}setSession(e){this.session=e}async send(e,t=[],o){var c,l,h;let r={idempotencyKey:(c=e.idempotencyKey)!=null?c:te(),...e,attachments:[...(l=e.attachments)!=null?l:[],...t.map(p=>({filename:p.filename,contentType:p.contentType,size:p.blob.size}))]},i=await this.post("/ingest/v1",r);if(!i.ok)throw await E(i);let s=await i.json(),a=((h=e.attachments)!=null?h:[]).length;return await Promise.all(t.map(async(p,g)=>{let b=Me(s,a+g);if(!b){o==null||o(p,new Error("The server would not accept that file."));return}try{await this.upload(b,p)}catch(w){o==null||o(p,w)}})),s}async flush(){let e=oe();if(e.length!==0){re([]);for(let t of e)try{let o=await this.post("/ingest/v1",t);!o.ok&&(o.status===429||o.status>=500)&&O(t)}catch{O(t)}}}queue(e){var t;O({...e,idempotencyKey:(t=e.idempotencyKey)!=null?t:te(),attachments:void 0})}async signIn(){let e=ne(64),t=await Ae(e),o=ne(16),r=`${this.base()}/ingest/v1/authorize?key=${encodeURIComponent(this.ingestKey)}&origin=${encodeURIComponent(location.origin)}&code_challenge=${encodeURIComponent(t)}&state=${encodeURIComponent(o)}`,i=window.open(r,"daybook-feedback","width=460,height=640");if(!i)throw Object.assign(new Error("Popup blocked"),{code:"popup_blocked"});let s=await new Promise((l,h)=>{let p=setInterval(()=>{i.closed&&(b(),h(Object.assign(new Error("Sign-in cancelled"),{code:"cancelled"})))},400),g=w=>{if(w.origin!==new URL(this.base()).origin)return;let f=w.data;if((f==null?void 0:f.source)==="daybook-feedback"&&f.state===o){if(b(),f.error||!f.code){h(Object.assign(new Error("Sign-in was refused"),{code:f.error||"refused"}));return}l(f.code)}},b=()=>{clearInterval(p),window.removeEventListener("message",g)};window.addEventListener("message",g)}),a=await this.post("/ingest/v1/token",{code:s,codeVerifier:e});if(!a.ok)throw await E(a);let{identityToken:c}=await a.json();return this.identityToken=c,c}base(){return this.apiUrl.replace(/\/$/,"")}resolve(e){try{let t=new URL(this.base()),o=new URL(e,t);return o.hostname===t.hostname?new URL(o.pathname+o.search,t).toString():o.toString()}catch{return e}}async handshake(e){var r,i;let t=await this.post("/ingest/v1/session",{...e,identityToken:(r=this.identityToken)!=null?r:void 0});if(!t.ok)throw await E(t);let o=await t.json();return this.session=(i=o.sessionToken)!=null?i:null,o}post(e,t){let o={"Content-Type":"application/json","X-Ingest-Key":this.ingestKey};return this.session&&(o["X-Feedback-Session"]=this.session),fetch(`${this.base()}${e}`,{method:"POST",headers:o,body:JSON.stringify(t),credentials:"omit"})}async upload(e,t){let o=await fetch(this.resolve(e.uploadUrl),{method:e.method,headers:{"Content-Type":e.contentType,"X-Ingest-Key":this.ingestKey},body:t.blob,credentials:"omit"});if(!o.ok)throw await E(o);await this.post(`/ingest/v1/attachments/${e.id}/confirm`,{})}};function Me(n,e){let t=n.attachments.find(o=>o.index===e);return t!=null?t:n.attachments.some(o=>typeof o.index=="number")?void 0:n.attachments[e]}function O(n){let e=oe();e.push(n),re(e.slice(-20))}function oe(){try{let n=localStorage.getItem(j);return n?JSON.parse(n):[]}catch{return[]}}function re(n){try{n.length===0?localStorage.removeItem(j):localStorage.setItem(j,JSON.stringify(n))}catch{}}async function E(n){let e=`http_${n.status}`;try{let t=await n.json();if(t.code&&(e=t.code),t.message)return Object.assign(new Error(t.message),{code:e})}catch{}return Object.assign(new Error(`Ingest failed (${n.status})`),{code:e})}function te(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ne(n){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=new Uint8Array(n);return crypto.getRandomValues(t),Array.from(t,o=>e[o%e.length]).join("")}async function Ae(n){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function q(n){var t;let e={platform:"web",route:location.pathname,title:document.title.slice(0,200),locale:navigator.language,timezone:He(),viewport:{width:window.innerWidth,height:window.innerHeight,dpr:(t=window.devicePixelRatio)!=null?t:1},device:Re()};return document.referrer&&(e.referrer=v(document.referrer)),n.app&&(e.app=n.app),n.anchor&&(e.anchor=n.anchor),n.breadcrumbs&&n.breadcrumbs.length>0&&(e.breadcrumbs=n.breadcrumbs),e}function Re(){var r;let n=navigator.userAgent,e=/Edg\//.test(n)?"Edge":/OPR\//.test(n)?"Opera":/Firefox\//.test(n)?"Firefox":/Chrome\//.test(n)?"Chrome":/Safari\//.test(n)?"Safari":"Unknown",t=/Windows NT/.test(n)?"Windows":/iPhone|iPad|iPod/.test(n)?"iOS":/Mac OS X/.test(n)?"macOS":/Android/.test(n)?"Android":/Linux/.test(n)?"Linux":"Unknown",o=(r=n.match(/(?:Edg|OPR|Firefox|Chrome|Version)\/(\d+)/))==null?void 0:r[1];return{browser:o?`${e} ${o}`:e,os:t,touch:navigator.maxTouchPoints>0,userAgent:n.slice(0,300)}}function He(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return`UTC${-new Date().getTimezoneOffset()/60}`}}async function ae(n,e=()=>()=>{}){var i;if(typeof((i=navigator.mediaDevices)==null?void 0:i.getDisplayMedia)!="function")return null;let t=n?Pe():()=>{},o=e(),r=null;try{return r=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),r.getVideoTracks()[0]?(await new Promise(a=>setTimeout(a,250)),await Fe(r)):null}catch{return null}finally{r==null||r.getTracks().forEach(s=>s.stop()),o(),t()}}var ie=1920,Ce=.82;async function Fe(n){let e=document.createElement("video");e.srcObject=n,e.muted=!0,await e.play().catch(()=>{});let t=e.videoWidth||window.innerWidth,o=e.videoHeight||window.innerHeight,r=t>ie?ie/t:1,i=document.createElement("canvas");i.width=Math.round(t*r),i.height=Math.round(o*r);let s=i.getContext("2d");if(!s)return null;s.imageSmoothingQuality="high",s.drawImage(e,0,0,i.width,i.height),e.pause(),e.srcObject=null;let a=await Ie(i);if(!a)return null;let c=a.type||"image/png";return{blob:a,filename:`screenshot.${c==="image/webp"?"webp":c==="image/jpeg"?"jpg":"png"}`,contentType:c}}async function Ie(n){for(let e of["image/webp","image/jpeg"]){let t=await se(n,e,Ce);if((t==null?void 0:t.type)===e)return t}return se(n,"image/png")}function se(n,e,t){return new Promise(o=>n.toBlob(r=>o(r),e,t))}function Pe(){let n=[...document.querySelectorAll(`[${Z}]`),...document.querySelectorAll('input[type="password"]')],e=n.map(t=>t.style.filter);return n.forEach(t=>{t.style.filter="blur(12px)"}),()=>{n.forEach((t,o)=>{var r;t.style.filter=(r=e[o])!=null?r:""})}}function _(n,e){let t=document.elementFromPoint(n,e);if(!(t instanceof HTMLElement))return{selector:null,offsetX:L(n/window.innerWidth),offsetY:L(e/window.innerHeight),elementText:null};let o=t.getBoundingClientRect();return{selector:Be(t),offsetX:o.width>0?L((n-o.left)/o.width):0,offsetY:o.height>0?L((e-o.top)/o.height):0,elementText:Oe(t)}}function le(n){if(!n.selector)return{x:n.offsetX*window.innerWidth,y:n.offsetY*window.innerHeight};let e=null;try{e=document.querySelector(n.selector)}catch{return null}if(!e)return null;let t=e.getBoundingClientRect();return{x:t.left+n.offsetX*t.width,y:t.top+n.offsetY*t.height}}function Be(n){if(n===document.body)return"body";for(let r of["data-testid","data-test","data-daybook-id","data-cy"]){let i=n.getAttribute(r);if(i){let s=`[${r}="${U(i)}"]`;if(S(s))return s}}if(n.id&&!ce(n.id)){let r=`#${U(n.id)}`;if(S(r))return r}let e=[],t=n;for(;t&&t!==document.body&&e.length<8;){let r=t.tagName.toLowerCase(),i=Array.from(t.classList).filter(c=>!ce(c)).slice(0,2);i.length>0&&(r+=i.map(c=>`.${U(c)}`).join(""));let s=t.parentElement;if(s){let c=Array.from(s.children).filter(l=>l.tagName===t.tagName);c.length>1&&(r+=`:nth-of-type(${c.indexOf(t)+1})`)}e.unshift(r);let a=e.join(" > ");if(S(a))return a;t=s}let o=e.length>0?`body > ${e.join(" > ")}`:null;return o&&S(o)?o:null}function S(n){try{return document.querySelectorAll(n).length===1}catch{return!1}}function ce(n){return/^[a-z]{1,3}[0-9a-f]{5,}$/i.test(n)||/--[0-9a-f]{5,}$/i.test(n)||/^_[0-9a-z]{5,}/i.test(n)||/^v-[0-9a-f]{6,}$/i.test(n)||/^ng-/.test(n)||/[0-9a-f]{8,}/i.test(n)}function Oe(n){var o,r,i;let t=((r=(o=n.innerText)!=null?o:n.textContent)!=null?r:"").replace(/\s+/g," ").trim();if(!t){let s=(i=n.getAttribute("aria-label"))!=null?i:n.getAttribute("title");return(s==null?void 0:s.trim())||null}return t.length>80?`${t.slice(0,77)}\u2026`:t}function L(n){return Number.isFinite(n)?Math.max(0,Math.min(1,n)):0}function U(n){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/([^\w-])/g,"\\$1")}var je=/^(image\/(png|jpeg|gif|webp)|video\/(mp4|quicktime|webm))$/;function de(n,e){let t=[];for(let o of n){if(e+t.length>=5)break;let r=je.test(o.type)?o.size>26214400?`Too large (${(o.size/1048576).toFixed(1)} MB, max 25).`:null:"Only images and short videos.";t.push({blob:o,filename:o.name||`pasted-${t.length+1}.${qe(o.type)}`,contentType:o.type,preview:r?null:URL.createObjectURL(o),error:r})}return t}function pe(n){var o;let e=(o=n.clipboardData)==null?void 0:o.items;if(!e)return[];let t=[];for(let r of e){if(r.kind!=="file")continue;let i=r.getAsFile();i&&t.push(i)}return t}function $(n){for(let e of n)e.preview&&URL.revokeObjectURL(e.preview)}function qe(n){var e,t;return(t=(e=n.split("/")[1])==null?void 0:e.replace("quicktime","mov"))!=null?t:"bin"}function he(n){var o;let t=(o=(typeof n.composedPath=="function"?n.composedPath():[])[0])!=null?o:n.target;return!t||t.nodeType!==1?!1:/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)?!0:typeof t.closest=="function"&&t.closest('[contenteditable=""], [contenteditable="true"]')!==null}function Ue(n,e,t){let o=0;for(let s of e){if(s.right<=n.left||s.left>=n.right)continue;let a=n.v==="bottom"?t.height-s.top:s.bottom;a>o&&(o=a)}if(o===0)return 0;let r=n.v==="bottom"?t.height-n.bottom:n.top,i=Math.round(o+12-r);return i<=0||i>t.height*.35?0:i}function ze(n,e,t){if(n===e||e.contains(n)||n.contains(e)||n===document.body||n===document.documentElement)return!1;let o=getComputedStyle(n);if(o.position!=="fixed"&&o.position!=="sticky"||o.visibility==="hidden"||o.display==="none"||Number(o.opacity)===0)return!1;let r=n.getBoundingClientRect();return!(r.width<8||r.height<8||r.width*r.height>t.width*t.height*.25)}function Ne(n,e,t){if(typeof document.elementsFromPoint!="function")return[];let o=new Map,r=[];for(let s=n.left+4;s<n.right;s+=32)r.push(s);r.push(n.right-4);let i=t.height*.35;for(let s=0;s<=i;s+=32){let a=n.v==="bottom"?n.bottom-s:n.top+s;if(a<0||a>t.height)break;for(let c of r)if(!(c<0||c>t.width))for(let l of document.elementsFromPoint(c,a)){if(o.has(l)||!ze(l,e,t))continue;let h=l.getBoundingClientRect();o.set(l,{top:h.top,bottom:h.bottom,left:h.left,right:h.right})}}return[...o.values()]}function ue(n,e){let t={width:window.innerWidth,height:window.innerHeight};return Ue(n,Ne(n,e,t),t)}var R=class{constructor(e,t){this.options=e;this.onSubmit=t;this.mode="idle";this.anchor=null;this.detach=[];this.buttonStyle="pill";this.clearance=0;this.state="ready";this.policy=null;this.dragged=null;this.reference=null;this.uploadsFailed=0;this.host=document.createElement("div"),this.host.setAttribute("data-daybook-feedback",""),this.host.style.cssText="position:fixed;inset:0;z-index:2147483000;pointer-events:none",this.root=this.host.attachShadow({mode:"open"}),this.root.innerHTML=`<style>${xe}</style><style id="theme"></style><style id="place"></style><div id="layer"></div>`}setTheme(e){let t=this.root.getElementById("theme");if(t){if(!e){t.textContent="";return}t.textContent=fe(e),this.buttonStyle=ge(e),this.themePlacement=e.position,this.applyPlacement(),this.launcherLabel=typeof e.launcherLabel=="string"&&e.launcherLabel.length>0?e.launcherLabel.slice(0,24):void 0}}get placement(){var e,t;return(t=(e=this.options.placement)!=null?e:this.themePlacement)!=null?t:"bottom-right"}applyPlacement(){let e=this.root.getElementById("place");if(!e)return;let t=this.placement,o=t.startsWith("bottom")?"bottom":"top",r=t.endsWith("right")?"right":"left",i=m+this.clearance;e.textContent=`:host {
|
|
2
|
+
--pm-${r}: ${m}px; --pm-${r==="right"?"left":"right"}: auto;
|
|
3
|
+
--pm-${o}: ${i}px; --pm-${o==="bottom"?"top":"bottom"}: auto;
|
|
4
|
+
}`}homeSlot(){let e=this.placement,t=220,o=48,r=e.endsWith("right")?window.innerWidth-m:m+t,i=e.startsWith("bottom")?window.innerHeight-m:m+o;return{left:r-t,right:r,top:i-o,bottom:i,v:e.startsWith("bottom")?"bottom":"top"}}watchClearance(){if(this.options.avoidOverlap===!1)return;let e=!1,t=()=>{if(e=!1,this.mode==="idle")try{let i=ue(this.homeSlot(),this.host);if(Math.abs(i-this.clearance)<4)return;this.clearance=i,this.applyPlacement()}catch{}},o=typeof requestAnimationFrame=="function"?i=>requestAnimationFrame(i):i=>setTimeout(i,16),r=()=>{e||(e=!0,o(t))};if(window.addEventListener("scroll",r,{passive:!0,capture:!0}),window.addEventListener("resize",r),this.detach.push(()=>{window.removeEventListener("scroll",r,{capture:!0}),window.removeEventListener("resize",r)}),typeof MutationObserver=="function"){let i=new MutationObserver(r);i.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden"]}),this.detach.push(()=>i.disconnect())}r()}setState(e){this.state=e,this.host.isConnected&&this.render()}mount(){var e;if(document.body.appendChild(this.host),this.applyPlacement(),this.render(),this.watchClearance(),this.options.hotkey!==null){let t=((e=this.options.hotkey)!=null?e:"f").toLowerCase(),o=r=>{if(r.key==="Escape"){this.mode==="picking"&&(this.mode="idle",this.anchor=null,this.dragged=null,this.render());return}r.metaKey||r.ctrlKey||r.altKey||he(r)||this.mode!=="composing"&&r.key.toLowerCase()===t&&(this.mode=this.mode==="picking"?"idle":"picking",this.render())};window.addEventListener("keydown",o),this.detach.push(()=>window.removeEventListener("keydown",o))}}unmount(){for(let e of this.detach.splice(0))e();this.host.remove()}open(){this.mode="picking",this.render()}setReporter(e){this.reporter=e}setPolicy(e){this.policy=e}capture(){var t,o;let e=(t=this.options.screenshots)!=null?t:!0;return e===!1||((o=this.policy)==null?void 0:o.screenshots)===!1?{offered:!1,checked:!1}:{offered:!0,checked:e!=="optional"}}conceal(){let e=this.root.getElementById("layer"),t=e.style.visibility;e.style.visibility="hidden";let o=this.ringAnchor();return()=>{e.style.visibility=t,o==null||o.remove()}}ringAnchor(){var i;let e=(i=this.anchor)==null?void 0:i.selector;if(!e)return null;let t=null;try{t=document.querySelector(e)}catch{return null}if(!t)return null;let o=t.getBoundingClientRect();if(o.width<1||o.height<1)return null;let r=document.createElement("div");return r.className="ring",r.style.left=`${o.left-M}px`,r.style.top=`${o.top-M}px`,r.style.width=`${o.width+M*2}px`,r.style.height=`${o.height+M*2}px`,this.root.appendChild(r),r}movable(e,t){this.place(e),t.classList.add("drag"),t.title="Drag to move \xB7 double-click to reset",t.addEventListener("dblclick",()=>{this.dragged=null,this.place(e)}),t.addEventListener("pointerdown",o=>{if(o.target.closest("button")||o.button!==0)return;o.preventDefault();let r=e.getBoundingClientRect(),i=o.clientX-r.left,s=o.clientY-r.top;t.setPointerCapture(o.pointerId),e.classList.add("panel--dragging");let a=l=>{let h=A(l.clientX-i,m-r.width+z,window.innerWidth-z),p=A(l.clientY-s,0,window.innerHeight-z);e.style.left=`${h}px`,e.style.top=`${p}px`,e.style.right="auto",e.style.bottom="auto"},c=()=>{t.releasePointerCapture(o.pointerId),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",c),e.classList.remove("panel--dragging"),this.dragged=Xe(e.getBoundingClientRect()),this.place(e)};t.addEventListener("pointermove",a),t.addEventListener("pointerup",c),t.addEventListener("pointercancel",c)})}place(e){let t=this.dragged;if(!t){e.style.left=e.style.right=e.style.top=e.style.bottom="";return}let o=e.offsetWidth||380,r=e.offsetHeight||240,i=A(t.dx,m,Math.max(m,window.innerWidth-o-m)),s=A(t.dy,m,Math.max(m,window.innerHeight-r-m));e.style.left=t.h==="left"?`${i}px`:"auto",e.style.right=t.h==="right"?`${i}px`:"auto",e.style.top=t.v==="top"?`${s}px`:"auto",e.style.bottom=t.v==="bottom"?`${s}px`:"auto"}render(){let e=this.root.getElementById("layer");if(e.innerHTML="",this.mode==="idle"){e.appendChild(this.state==="pending"?this.pending():this.launcher());return}if(this.mode==="sent"){this.dragged=null,e.appendChild(this.sent());return}if(this.mode==="picking"){e.appendChild(this.picker());return}let t=this.composer();e.appendChild(t),this.place(t)}pending(){let e=document.createElement("div");return e.className="launcher launcher--pending",e.setAttribute("role","status"),e.textContent="Feedback access pending approval",e}sent(){var c;let e=document.createElement("div");e.className="panel panel--sent",e.setAttribute("role","status");let t=this.reference,o=this.uploadsFailed;e.innerHTML=`
|
|
5
5
|
<div class="sent__tick" aria-hidden="true">✓</div>
|
|
6
6
|
<div class="sent__body">
|
|
7
7
|
<div class="panel__title">Thank you \u2014 that is on its way.</div>
|
|
8
8
|
${t?`<div class="sent__ref">
|
|
9
|
-
<code class="sent__id">${
|
|
9
|
+
<code class="sent__id">${N(t)}</code>
|
|
10
10
|
<button type="button" class="sent__copy" data-copy>Copy</button>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="panel__anchor">Quote it if you follow it up.</div>`:""}
|
|
13
13
|
${o>0?`<div class="sent__warn">${o===1?"One attachment could not be uploaded.":`${o} attachments could not be uploaded.`} The report was filed without it.</div>`:""}
|
|
14
14
|
</div>
|
|
15
|
-
${t?'<button type="button" class="panel__close" data-dismiss aria-label="Dismiss">×</button>':""}`;let
|
|
15
|
+
${t?'<button type="button" class="panel__close" data-dismiss aria-label="Dismiss">×</button>':""}`;let r=()=>{this.mode==="sent"&&(this.mode="idle",this.render())},i=window.setTimeout(r,o>0?2e4:t?12e3:6e3),s=()=>window.clearTimeout(i);if(this.detach.push(()=>window.clearTimeout(i)),this.contain(e),this.place(e),!t)return e;e.addEventListener("pointerenter",s),e.addEventListener("focusin",s),(c=e.querySelector("[data-dismiss]"))==null||c.addEventListener("click",r);let a=e.querySelector("[data-copy]");return a&&(a.onclick=async()=>{s();let l=await Ke(t);a.textContent=l?"Copied":"Copy failed",a.classList.toggle("sent__copy--done",l)}),e}launcher(){var t,o;let e=be(this.buttonStyle,(t=this.launcherLabel)!=null?t:"Feedback");return e.title=this.options.hotkey===null?"Report a problem":`Report a problem (${((o=this.options.hotkey)!=null?o:"f").toUpperCase()})`,e.onclick=()=>{this.mode="picking",this.render()},e}picker(){let e=document.createElement("div");return e.className="mask",e.innerHTML='<div class="hint">Click the thing that is wrong \xB7 <kbd>Esc</kbd> to cancel</div>',e.onclick=t=>{e.style.pointerEvents="none",this.anchor=_(t.clientX,t.clientY),e.style.pointerEvents="",this.mode="composing",this.render()},e}composer(){var X,W,V,Y,Q;let e=document.createElement("div");e.className="panel";let t=(X=this.anchor)!=null&&X.elementText?`on \u201C${this.anchor.elementText}\u201D`:(W=this.anchor)!=null&&W.selector?`on ${this.anchor.selector}`:"on this page",o=this.capture();e.innerHTML=`
|
|
16
16
|
<div class="panel__head" id="head">
|
|
17
17
|
<span class="panel__grip" aria-hidden="true">\u283F</span>
|
|
18
18
|
<div class="panel__heading">
|
|
19
|
-
<div class="panel__anchor">${
|
|
19
|
+
<div class="panel__anchor">${N(t)}</div>
|
|
20
20
|
<div class="panel__title">Report a problem</div>
|
|
21
21
|
</div>
|
|
22
22
|
<button id="close" class="panel__close" aria-label="Close">×</button>
|
|
@@ -56,20 +56,44 @@
|
|
|
56
56
|
<span class="panel__note">Sends the page, your browser, and recent errors.</span>
|
|
57
57
|
<button id="cancel" class="ghost">Cancel</button>
|
|
58
58
|
<button id="send" class="primary">Send</button>
|
|
59
|
-
</div>`;let
|
|
59
|
+
</div>`;let r=[],i=e.querySelector("#files"),s=e.querySelector("#drop"),a=e.querySelector("#file"),c=()=>{i.innerHTML="",r.forEach((d,u)=>{var J;let y=document.createElement("div");y.className=d.error?"file file--bad":"file",y.innerHTML=d.preview?`<img src="${d.preview}" alt="" />`:'<span class="file__icon">\u25A6</span>';let F=document.createElement("span");F.className="file__name",F.textContent=(J=d.error)!=null?J:d.filename,y.appendChild(F);let x=document.createElement("button");x.className="link",x.textContent="\xD7",x.onclick=()=>{$([d]),r.splice(u,1),c()},y.appendChild(x),i.appendChild(y)}),s.style.display=r.length>=5?"none":""},l=d=>{r.push(...de(d,r.length)),c()};a.onchange=()=>{a.files&&l(a.files)},e.querySelector("#browse").onclick=()=>a.click(),e.addEventListener("paste",d=>{let u=pe(d);u.length>0&&(d.preventDefault(),l(u))}),s.addEventListener("dragover",d=>{d.preventDefault(),s.classList.add("drop--over")}),s.addEventListener("dragleave",()=>s.classList.remove("drop--over")),s.addEventListener("drop",d=>{var u,y;d.preventDefault(),s.classList.remove("drop--over"),l(Array.from((y=(u=d.dataTransfer)==null?void 0:u.files)!=null?y:[]))});let h="bug";e.querySelectorAll(".kind").forEach(d=>{d.onclick=()=>{var u;h=(u=d.dataset.kind)!=null?u:"bug",e.querySelectorAll(".kind").forEach(y=>y.classList.remove("kind--on")),d.classList.add("kind--on")}});let p=e.querySelector("#message"),g=e.querySelector("#email"),b=(Q=(V=this.reporter)==null?void 0:V.email)!=null?Q:(Y=this.options.reporter)==null?void 0:Y.email;b&&!g.value&&(g.value=b);let w=e.querySelector("#shot"),f=e.querySelector("#status"),C=e.querySelector("#send"),D=()=>{$(r),this.mode="idle",this.anchor=null,this.dragged=null,this.render()};e.querySelector("#cancel").onclick=D,e.querySelector("#close").onclick=D;let K=async()=>{var d;if(!p.value.trim()){f.textContent="Say what happened first.";return}C.disabled=!0,f.textContent="Sending\u2026";try{let u=await this.onSubmit({message:p.value.trim(),kind:h,email:g.value.trim()||void 0,anchor:this.anchor,withScreenshot:(d=w==null?void 0:w.checked)!=null?d:!1,files:r.filter(y=>!y.error)});this.reference=u.reference,this.uploadsFailed=u.uploadsFailed,$(r),this.mode="sent",this.anchor=null,this.render()}catch(u){C.disabled=!1,f.textContent=u instanceof Error?`${u.message} \u2014 saved, will retry.`:"Failed, saved and will retry."}};return C.onclick=K,p.onkeydown=d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&K()},setTimeout(()=>p.focus(),0),this.contain(e),this.movable(e,e.querySelector("#head")),e}contain(e){for(let t of["pointerdown","mousedown","click"])e.addEventListener(t,o=>o.stopPropagation())}};async function Ke(n){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(n),!0}catch{}let e=document.createElement("textarea");e.value=n,e.setAttribute("readonly",""),e.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0",document.body.appendChild(e);try{return e.select(),document.execCommand("copy")}catch{return!1}finally{e.remove()}}var m=16,M=3,z=56;function Xe(n){let e={left:n.left,right:window.innerWidth-n.right,top:n.top,bottom:window.innerHeight-n.bottom},t=Object.keys(e).reduce((i,s)=>e[s]<e[i]?s:i),o=t==="left"||t==="right"?t:e.left<=e.right?"left":"right",r=t==="top"||t==="bottom"?t:e.top<=e.bottom?"top":"bottom";return{h:o,v:r,dx:t===o?m:Math.max(m,Math.round(e[o])),dy:t===r?m:Math.max(m,Math.round(e[r]))}}function A(n,e,t){return Math.min(Math.max(n,e),t)}function N(n){return n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function We(n){return typeof n=="string"&&/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/deg]+\)|[a-z]{3,20})$/i.test(n.trim())}var me='<svg class="launcher__icon" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M2 6.2C2 4.4 3.4 3 5.2 3h5.6C12.6 3 14 4.4 14 6.2v2.6c0 1.8-1.4 3.2-3.2 3.2H7l-3 2.4v-2.5A3.2 3.2 0 0 1 2 8.8V6.2Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>';function fe(n){var o;let e=[];We(n.accent)&&e.push(`--pm-accent: ${n.accent}`);let t={none:"0",sm:"6px",md:"12px",lg:"18px"}[(o=n.cornerRadius)!=null?o:"md"];return t&&e.push(`--pm-radius: ${t}`),n.colorScheme==="dark"?e.push(ve):n.colorScheme==="light"&&e.push(we),e.length>0?`:host { ${e.join("; ")} }`:""}var ge=n=>Ve.includes(n.buttonStyle)?n.buttonStyle:"pill";function be(n,e){let t=document.createElement("button");return t.className=`launcher launcher--${n}`,n==="icon"?(t.innerHTML=me,t.setAttribute("aria-label",e)):n==="pill-icon"?t.innerHTML=`${me}<span>${N(e)}</span>`:t.textContent=e,t}function ye(n,e={}){var i;let t=(i=n.shadowRoot)!=null?i:n.attachShadow({mode:"open"}),o=typeof e.launcherLabel=="string"&&e.launcherLabel.length>0?e.launcherLabel.slice(0,24):"Feedback";t.innerHTML=`<style>${xe}</style><style>${fe(e)}</style>`;let r=be(ge(e),o);r.classList.add("launcher--preview"),r.disabled=!0,t.appendChild(r)}var Ve=["pill","pill-icon","icon","text","outline"],we="--pm-surface: #fff; --pm-ink: #171717; --pm-muted: #525252; --pm-faint: #a3a3a3; --pm-line: #e5e5e5; --pm-line-strong: #d4d4d4; --pm-sunken: #f5f5f5; --pm-kbd: #404040; --pm-warn: #b45309; --pm-good: #047857; --pm-good-bg: #ecfdf5; --pm-good-line: #a7f3d0; --pm-accent: #171717; --pm-on-accent: #fafafa;",ve="--pm-surface: #1c1c1c; --pm-ink: #fafafa; --pm-muted: #a3a3a3; --pm-faint: #737373; --pm-line: #333; --pm-line-strong: #454545; --pm-sunken: #262626; --pm-kbd: #d4d4d4; --pm-warn: #fbbf24; --pm-good: #34d399; --pm-good-bg: #05271f; --pm-good-line: #065f46; --pm-accent: #fafafa; --pm-on-accent: #171717;",xe=`
|
|
60
|
+
/*
|
|
61
|
+
Every colour in this file is one of these, and there are two sets of them.
|
|
62
|
+
|
|
63
|
+
Not for fashion: the widget is a panel laid over somebody else's page, and a white card on a dark
|
|
64
|
+
application is a flashbang. It followed the host's scheme in exactly one respect before \u2014 it did
|
|
65
|
+
not, and was always light.
|
|
66
|
+
|
|
67
|
+
System is the default and costs no JavaScript: the media query below is in the base stylesheet, so
|
|
68
|
+
a widget nobody has configured tracks the reader's own setting. A workspace that picks light or
|
|
69
|
+
dark gets those values written into the theme block instead, which is a later stylesheet at the
|
|
70
|
+
same specificity and therefore wins over the query.
|
|
71
|
+
|
|
72
|
+
The accent pair is inverse emphasis \u2014 a dark pill on a light page, a light pill on a dark one \u2014
|
|
73
|
+
because the launcher sits on the HOST page rather than on our panel, and a near-black button on a
|
|
74
|
+
near-black application is a button nobody finds. A host that sets its own accent gets white text
|
|
75
|
+
on it, unchanged from before; we cannot compute contrast in CSS and guessing wrong is worse than
|
|
76
|
+
the one case where a very pale brand colour needs its own care.
|
|
77
|
+
*/
|
|
60
78
|
:host {
|
|
61
79
|
all: initial;
|
|
62
80
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"put it on the left" has to be four numbers and not one word. */
|
|
66
|
-
--pm-accent: #171717;
|
|
81
|
+
${we}
|
|
82
|
+
|
|
67
83
|
--pm-radius: 12px;
|
|
84
|
+
|
|
85
|
+
/* Offsets rather than a keyword: a custom property can hold a value, not a property name, so
|
|
86
|
+
"put it on the left" has to be four numbers and not one word. */
|
|
68
87
|
--pm-left: auto;
|
|
69
88
|
--pm-right: 16px;
|
|
70
89
|
--pm-top: auto;
|
|
71
90
|
--pm-bottom: 16px;
|
|
72
91
|
}
|
|
92
|
+
|
|
93
|
+
@media (prefers-color-scheme: dark) {
|
|
94
|
+
:host { ${ve} }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
73
97
|
* { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
|
|
74
98
|
@media (prefers-reduced-motion: reduce) { .launcher { transition: none } }
|
|
75
99
|
#layer { position: fixed; inset: 0; pointer-events: none }
|
|
@@ -81,16 +105,67 @@
|
|
|
81
105
|
reads as a bug. Honoured only where motion is welcome. */
|
|
82
106
|
transition: bottom .18s ease, top .18s ease;
|
|
83
107
|
padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
|
|
84
|
-
background: var(--pm-accent); color:
|
|
108
|
+
background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
|
|
85
109
|
box-shadow: 0 2px 12px rgba(0,0,0,.3);
|
|
86
110
|
}
|
|
87
111
|
.launcher:hover { filter: brightness(1.15) }
|
|
88
112
|
.launcher--pending { cursor: default; opacity: .85 }
|
|
89
113
|
.launcher--pending:hover { filter: none }
|
|
114
|
+
.launcher__icon { flex: none; width: 15px; height: 15px; display: block }
|
|
115
|
+
/* For previewLauncher: in the flow of a settings page rather than pinned to a corner. */
|
|
116
|
+
.launcher--preview { position: static; cursor: default; opacity: 1 }
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
Five buttons, because one button cannot be right for every page it is a guest on.
|
|
120
|
+
|
|
121
|
+
A product with its own bold chat bubble does not want a second bold pill beside it; a spare
|
|
122
|
+
documentation site does not want a filled button at all; a dense application often wants the
|
|
123
|
+
smallest possible mark. The set is deliberately small \u2014 five things somebody can look at and
|
|
124
|
+
choose between in a moment, rather than a colour picker and a padding field.
|
|
125
|
+
|
|
126
|
+
Every one of them keeps the same hit area at the same corner, so the clearance measurement and
|
|
127
|
+
the placement work unchanged whichever is picked.
|
|
128
|
+
*/
|
|
129
|
+
.launcher { display: inline-flex; align-items: center; gap: 7px }
|
|
130
|
+
|
|
131
|
+
/* Filled and round. The default, and the one that reads as a product feature. */
|
|
132
|
+
.launcher--pill {}
|
|
133
|
+
|
|
134
|
+
/* The same, with the icon in front for pages where a word alone reads as body text. */
|
|
135
|
+
.launcher--pill-icon {}
|
|
136
|
+
|
|
137
|
+
/* The mark on its own, for a corner that is already busy. */
|
|
138
|
+
.launcher--icon { padding: 10px; border-radius: 999px }
|
|
139
|
+
|
|
140
|
+
/* No fill at all. For a page whose own furniture is quiet and would be shouted over. */
|
|
141
|
+
.launcher--text {
|
|
142
|
+
background: transparent; color: var(--pm-ink); box-shadow: none;
|
|
143
|
+
padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
|
|
144
|
+
}
|
|
145
|
+
.launcher--text:hover { filter: none; color: var(--pm-accent) }
|
|
146
|
+
|
|
147
|
+
/* Outlined: present without being loud, and it inherits the accent rather than filling with it. */
|
|
148
|
+
.launcher--outline {
|
|
149
|
+
background: transparent; color: var(--pm-accent);
|
|
150
|
+
border: 1px solid currentColor; box-shadow: none;
|
|
151
|
+
}
|
|
152
|
+
.launcher--outline:hover { filter: none; background: var(--pm-sunken) }
|
|
90
153
|
.mask {
|
|
91
154
|
position: fixed; inset: 0; pointer-events: auto; cursor: crosshair;
|
|
92
155
|
background: rgba(23,23,23,.12);
|
|
93
156
|
}
|
|
157
|
+
/*
|
|
158
|
+
The pinned element, ringed for the screenshot.
|
|
159
|
+
|
|
160
|
+
Three rings rather than one: a red line alone disappears against a red button, and a white one
|
|
161
|
+
disappears against a white card. Red, then white, then a soft red \u2014 one of the three is always
|
|
162
|
+
against something it contrasts with, on any page, without touching that page's own colours.
|
|
163
|
+
*/
|
|
164
|
+
.ring {
|
|
165
|
+
position: fixed; pointer-events: none; border-radius: 3px;
|
|
166
|
+
border: 2px solid #ef4444;
|
|
167
|
+
box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 5px rgba(239,68,68,.35);
|
|
168
|
+
}
|
|
94
169
|
/*
|
|
95
170
|
Bottom, not top.
|
|
96
171
|
|
|
@@ -102,18 +177,18 @@
|
|
|
102
177
|
*/
|
|
103
178
|
.hint {
|
|
104
179
|
position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
|
|
105
|
-
padding: 7px 12px; border-radius: 8px; background:
|
|
180
|
+
padding: 7px 12px; border-radius: 8px; background: var(--pm-ink); color: var(--pm-on-accent);
|
|
106
181
|
font-size: 12px; white-space: nowrap;
|
|
107
182
|
}
|
|
108
183
|
kbd {
|
|
109
|
-
padding: 1px 5px; border-radius: 4px; background:
|
|
184
|
+
padding: 1px 5px; border-radius: 4px; background: var(--pm-kbd); color: var(--pm-surface);
|
|
110
185
|
font-family: ui-monospace, monospace; font-size: 11px;
|
|
111
186
|
}
|
|
112
187
|
.panel {
|
|
113
188
|
position: fixed; width: 380px; max-width: calc(100vw - 32px); pointer-events: auto;
|
|
114
189
|
left: var(--pm-left); right: var(--pm-right);
|
|
115
190
|
top: var(--pm-top); bottom: var(--pm-bottom);
|
|
116
|
-
padding: 16px; border-radius: var(--pm-radius); background:
|
|
191
|
+
padding: 16px; border-radius: var(--pm-radius); background: var(--pm-surface); color: var(--pm-ink);
|
|
117
192
|
box-shadow: 0 8px 32px rgba(0,0,0,.24); font-size: 13px;
|
|
118
193
|
}
|
|
119
194
|
.panel__head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px }
|
|
@@ -129,29 +204,29 @@ kbd {
|
|
|
129
204
|
*/
|
|
130
205
|
.drag { cursor: grab; touch-action: none; user-select: none }
|
|
131
206
|
.drag:active { cursor: grabbing }
|
|
132
|
-
.panel__grip { flex: none; color:
|
|
133
|
-
.drag:hover .panel__grip { color:
|
|
207
|
+
.panel__grip { flex: none; color: var(--pm-faint); font-size: 15px; line-height: 16px; letter-spacing: -1px }
|
|
208
|
+
.drag:hover .panel__grip { color: var(--pm-muted) }
|
|
134
209
|
.panel--dragging { box-shadow: 0 16px 48px rgba(0,0,0,.32); opacity: .92 }
|
|
135
210
|
|
|
136
211
|
/* An incomplete report, said plainly. Amber rather than red: the words arrived. */
|
|
137
|
-
.sent__warn { margin-top: 6px; color:
|
|
212
|
+
.sent__warn { margin-top: 6px; color: var(--pm-warn); font-size: 11px; line-height: 1.4 }
|
|
138
213
|
|
|
139
214
|
/* The anchor leads: it is what the reporter pointed at, and the part they need to recognise. */
|
|
140
215
|
.panel__anchor {
|
|
141
|
-
color:
|
|
216
|
+
color: var(--pm-muted); font-size: 11px;
|
|
142
217
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
143
218
|
}
|
|
144
219
|
.panel__close {
|
|
145
220
|
margin-left: auto; border: 0; background: none; cursor: pointer;
|
|
146
|
-
color:
|
|
221
|
+
color: var(--pm-faint); font-size: 20px; line-height: 1; padding: 0 2px;
|
|
147
222
|
}
|
|
148
|
-
.panel__close:hover { color:
|
|
223
|
+
.panel__close:hover { color: var(--pm-ink) }
|
|
149
224
|
|
|
150
225
|
/* A confirmation, not a form. */
|
|
151
226
|
.panel--sent { display: flex; align-items: flex-start; gap: 10px }
|
|
152
227
|
.sent__tick {
|
|
153
228
|
flex: none; width: 24px; height: 24px; border-radius: 999px;
|
|
154
|
-
background:
|
|
229
|
+
background: var(--pm-good-bg); color: var(--pm-good);
|
|
155
230
|
display: grid; place-items: center; font-size: 14px;
|
|
156
231
|
}
|
|
157
232
|
.sent__body { min-width: 0 }
|
|
@@ -160,28 +235,28 @@ kbd {
|
|
|
160
235
|
.sent__ref { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px }
|
|
161
236
|
.sent__id {
|
|
162
237
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
|
|
163
|
-
color:
|
|
238
|
+
color: var(--pm-ink); background: var(--pm-sunken); border-radius: 5px; padding: 2px 6px;
|
|
164
239
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
165
240
|
}
|
|
166
241
|
.sent__copy {
|
|
167
|
-
flex: none; border: 1px solid
|
|
168
|
-
color:
|
|
242
|
+
flex: none; border: 1px solid var(--pm-line); border-radius: 6px; background: var(--pm-surface);
|
|
243
|
+
color: var(--pm-muted); cursor: pointer; font-size: 11px; padding: 3px 8px;
|
|
169
244
|
}
|
|
170
|
-
.sent__copy:hover { border-color:
|
|
171
|
-
.sent__copy--done { border-color:
|
|
245
|
+
.sent__copy:hover { border-color: var(--pm-faint); color: var(--pm-ink) }
|
|
246
|
+
.sent__copy--done { border-color: var(--pm-good-line); background: var(--pm-good-bg); color: var(--pm-good) }
|
|
172
247
|
|
|
173
248
|
.panel__kinds { display: flex; gap: 6px; margin: 8px 0 }
|
|
174
249
|
.kind {
|
|
175
|
-
flex: 1; padding: 5px 0; border: 1px solid
|
|
176
|
-
background:
|
|
250
|
+
flex: 1; padding: 5px 0; border: 1px solid var(--pm-line); border-radius: 7px;
|
|
251
|
+
background: var(--pm-surface); color: var(--pm-muted); cursor: pointer; font-size: 12px; text-transform: capitalize;
|
|
177
252
|
}
|
|
178
|
-
.kind--on { border-color:
|
|
253
|
+
.kind--on { border-color: var(--pm-ink); background: var(--pm-ink); color: var(--pm-surface) }
|
|
179
254
|
textarea, input[type=email] {
|
|
180
|
-
width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid
|
|
181
|
-
border-radius: 8px; font-size: 13px; resize: vertical; color:
|
|
255
|
+
width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--pm-line);
|
|
256
|
+
border-radius: 8px; font-size: 13px; resize: vertical; color: var(--pm-ink); background: var(--pm-surface);
|
|
182
257
|
}
|
|
183
|
-
textarea:focus, input:focus { outline: 2px solid
|
|
184
|
-
.shot { display: flex; align-items: center; gap: 6px; color:
|
|
258
|
+
textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset: -1px }
|
|
259
|
+
.shot { display: flex; align-items: center; gap: 6px; color: var(--pm-muted); font-size: 12px }
|
|
185
260
|
|
|
186
261
|
/*
|
|
187
262
|
One row. Cancel used to sit ABOVE Send in a stacked span, which read as a label for it rather than
|
|
@@ -189,16 +264,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
|
|
|
189
264
|
*/
|
|
190
265
|
.panel__foot {
|
|
191
266
|
display: flex; align-items: center; gap: 8px; margin-top: 12px;
|
|
192
|
-
padding-top: 12px; border-top: 1px solid
|
|
267
|
+
padding-top: 12px; border-top: 1px solid var(--pm-sunken);
|
|
193
268
|
}
|
|
194
|
-
.panel__note { flex: 1; color:
|
|
269
|
+
.panel__note { flex: 1; color: var(--pm-faint); font-size: 10px; line-height: 1.3 }
|
|
195
270
|
.primary, .ghost {
|
|
196
271
|
padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
|
|
197
272
|
}
|
|
198
|
-
.primary { border: 0; background:
|
|
273
|
+
.primary { border: 0; background: var(--pm-ink); color: var(--pm-surface) }
|
|
199
274
|
.primary:disabled { opacity: .5; cursor: default }
|
|
200
|
-
.ghost { border: 0; background: transparent; color:
|
|
201
|
-
.status { margin-top: 6px; color:
|
|
275
|
+
.ghost { border: 0; background: transparent; color: var(--pm-muted) }
|
|
276
|
+
.status { margin-top: 6px; color: var(--pm-warn); font-size: 11px; min-height: 0 }
|
|
202
277
|
/*
|
|
203
278
|
One attachment area, holding both ways of adding a picture. They were a checkbox and a dropzone
|
|
204
279
|
stacked \u2014 two affordances for one job, and together the busiest part of a panel whose busiest part
|
|
@@ -206,16 +281,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
|
|
|
206
281
|
*/
|
|
207
282
|
.drop {
|
|
208
283
|
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
|
|
209
|
-
margin-top: 8px; padding: 8px 10px; border: 1px dashed
|
|
210
|
-
color:
|
|
284
|
+
margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--pm-line-strong); border-radius: 8px;
|
|
285
|
+
color: var(--pm-faint); font-size: 11px;
|
|
211
286
|
}
|
|
212
|
-
.drop__or { color:
|
|
213
|
-
.drop--over { border-color:
|
|
287
|
+
.drop__or { color: var(--pm-faint) }
|
|
288
|
+
.drop--over { border-color: var(--pm-ink); color: var(--pm-ink); background: var(--pm-sunken) }
|
|
214
289
|
.files { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
|
|
215
|
-
.file { display: flex; align-items: center; gap: 6px; font-size: 11px; color:
|
|
216
|
-
.file--bad { color:
|
|
290
|
+
.file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pm-muted) }
|
|
291
|
+
.file--bad { color: var(--pm-warn) }
|
|
217
292
|
.file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px }
|
|
218
293
|
.file__icon { width: 28px; text-align: center }
|
|
219
294
|
.file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
|
|
220
|
-
.link { border: 0; background: transparent; color:
|
|
221
|
-
`;var
|
|
295
|
+
.link { border: 0; background: transparent; color: var(--pm-muted); cursor: pointer; font-size: 11px; text-decoration: underline }
|
|
296
|
+
`;var ke="https://api.daybook.team",H=class{constructor(e){this.options=e;this.widget=null;this.started=!1;this.inFlight=null;this.epoch=0;this.ready=null;this.stopped=!1;var t;if(!e.ingestKey)throw new Error("ingestKey is required");this.client=new T((t=e.apiUrl)!=null?t:ke,e.ingestKey),this.trail=e.breadcrumbs===!1?null:new k(40,e.redact!==!1)}start(){var e;return this.stopped=!1,(e=this.trail)==null||e.start(),this.mount(),this.started||(this.started=!0,this.client.flush()),this.handshake(),this}mount(){this.widget||this.stopped||(this.widget=new R(this.options,e=>this.submit(e)),this.widget.setReporter(this.options.reporter),this.widget.mount())}handshake(){var o,r,i;let e=JSON.stringify([(o=this.options.reporter)!=null?o:null,(r=this.options.signature)!=null?r:null,this.epoch]);if(((i=this.inFlight)==null?void 0:i.key)===e)return this.inFlight.promise;let t=this.runHandshake().finally(()=>{var s;((s=this.inFlight)==null?void 0:s.promise)===t&&(this.inFlight=null)});return this.inFlight={key:e,promise:t},t}async runHandshake(){var e,t,o,r,i,s,a;try{let c=await this.client.handshake({identity:this.options.reporter,signature:this.options.signature,locale:typeof navigator!="undefined"?navigator.language:void 0});if(this.ready=c,(t=(e=this.options).onReady)==null||t.call(e,c),c.reporterStatus==="Blocked"){(o=this.widget)==null||o.unmount(),this.widget=null;return}this.mount(),this.widget.setTheme(Qe(c.theme)),this.widget.setPolicy((r=c.policy)!=null?r:null),this.widget.setState(c.reporterStatus==="Pending"?"pending":"ready")}catch(c){(s=(i=this.options).onError)==null||s.call(i,c),console.warn("[feedback] handshake failed; the widget will not appear",c),(a=this.widget)==null||a.unmount(),this.widget=null}}identify(e){var t;this.options={...this.options,reporter:e?{...this.options.reporter,...e}:void 0},(t=this.widget)==null||t.setReporter(this.options.reporter),this.widget&&this.handshake()}async signIn(){await this.client.signIn(),this.epoch++,await this.handshake()}authenticate(e){this.options={...this.options,signature:e!=null?e:void 0},this.widget&&this.handshake()}stop(){var e,t;this.started=!1,this.stopped=!0,(e=this.trail)==null||e.stop(),(t=this.widget)==null||t.unmount(),this.widget=null}open(){var e;(e=this.widget)==null||e.open()}async report(e,t={}){var o,r,i;return this.client.send({message:e,surface:this.options.surface,...t,context:{...q({breadcrumbs:(o=this.trail)==null?void 0:o.list(),app:this.options.app}),...(r=t.context)!=null?r:{}},reporter:(i=t.reporter)!=null?i:this.options.reporter})}async submit(e){var s,a,c,l,h;let t=e.withScreenshot?await ae(this.options.redact!==!1,()=>{var p,g;return(g=(p=this.widget)==null?void 0:p.conceal())!=null?g:(()=>{})}):null,o=[...e.files,...t?[t]:[]],r={message:e.message,kind:e.kind,app:this.options.app,surface:this.options.surface,reporter:e.email?{...this.options.reporter,email:e.email}:this.options.reporter,context:q({anchor:e.anchor,breadcrumbs:(s=this.trail)==null?void 0:s.list(),app:this.options.app})},i=[];try{let p=await this.client.send(r,o,(g,b)=>{var w,f;i.push(b),console.warn(`[feedback] "${g.filename}" did not upload`,b),(f=(w=this.options).onError)==null||f.call(w,b)});return p.uploadsFailed=i.length,(c=(a=this.options).onSent)==null||c.call(a,p),{reference:p.reference,uploadsFailed:i.length}}catch(p){throw this.client.queue(r),(h=(l=this.options).onError)==null||h.call(l,p),p}}};function Ye(n){return new H(n).start()}function Qe(n){if(!n)return null;try{let e=JSON.parse(n);return e&&typeof e=="object"?e:null}catch{return null}}return $e(Je);})();
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export type { Anchor, Breadcrumb, FeedbackKind, FeedbackTheme, HandshakeRequest,
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const DEFAULT_API_URL = "https://api.daybook.team";
|
|
15
15
|
export { captureAnchor, resolveAnchor } from './anchor.js';
|
|
16
|
+
/** Draws the launcher into an element you own, for a settings screen that previews a theme. */
|
|
17
|
+
export { previewLauncher, type ButtonStyle } from './widget.js';
|
|
16
18
|
/**
|
|
17
19
|
* In-app feedback for the web.
|
|
18
20
|
*
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ import { FeedbackWidget } from './widget.js';
|
|
|
16
16
|
*/
|
|
17
17
|
export const DEFAULT_API_URL = 'https://api.daybook.team';
|
|
18
18
|
export { captureAnchor, resolveAnchor } from './anchor.js';
|
|
19
|
+
/** Draws the launcher into an element you own, for a settings screen that previews a theme. */
|
|
20
|
+
export { previewLauncher } from './widget.js';
|
|
19
21
|
/**
|
|
20
22
|
* In-app feedback for the web.
|
|
21
23
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -106,8 +106,20 @@ export type ReporterStatus = 'Approved' | 'Pending' | 'Blocked' | 'Anonymous';
|
|
|
106
106
|
export interface FeedbackTheme {
|
|
107
107
|
accent?: string;
|
|
108
108
|
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
109
|
+
/** The word on the button. Defaults to "Feedback". */
|
|
109
110
|
launcherLabel?: string;
|
|
110
111
|
cornerRadius?: 'none' | 'sm' | 'md' | 'lg';
|
|
112
|
+
/**
|
|
113
|
+
* The shape of the launcher.
|
|
114
|
+
*
|
|
115
|
+
* pill filled and round, with the label — the default
|
|
116
|
+
* pill-icon the same, with a speech bubble in front of it
|
|
117
|
+
* icon the bubble on its own, for a corner that is already busy
|
|
118
|
+
* text no fill, underlined label, for a page that would be shouted over
|
|
119
|
+
* outline the accent as a border rather than a fill
|
|
120
|
+
*/
|
|
121
|
+
buttonStyle?: 'pill' | 'pill-icon' | 'icon' | 'text' | 'outline';
|
|
122
|
+
/** Follows the reader's own setting unless overruled. Defaults to auto. */
|
|
111
123
|
colorScheme?: 'auto' | 'light' | 'dark';
|
|
112
124
|
}
|
|
113
125
|
export interface FeedbackOptions {
|
package/dist/widget.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export declare class FeedbackWidget {
|
|
|
39
39
|
private launcherLabel;
|
|
40
40
|
/** The corner the workspace chose, if it chose one. The init option outranks it. */
|
|
41
41
|
private themePlacement;
|
|
42
|
+
/** Which of the five shapes the launcher takes. */
|
|
43
|
+
private buttonStyle;
|
|
42
44
|
/** How far the host page's own floating buttons push us out of that corner. */
|
|
43
45
|
private clearance;
|
|
44
46
|
/** Where the widget lives: the caller's choice, then the workspace's, then the bottom right. */
|
|
@@ -102,13 +104,36 @@ export declare class FeedbackWidget {
|
|
|
102
104
|
/** Whether the composer offers screen capture at all, and whether it starts ticked. */
|
|
103
105
|
private capture;
|
|
104
106
|
/**
|
|
105
|
-
* Takes the widget off the screen and hands back the undo.
|
|
107
|
+
* Takes the widget off the screen, rings what the report is about, and hands back the undo.
|
|
106
108
|
*
|
|
107
|
-
* For the screen capture.
|
|
108
|
-
*
|
|
109
|
-
*
|
|
109
|
+
* For the screen capture. It is `visibility`, not `display`, because removing the panel from
|
|
110
|
+
* layout would reflow the host page underneath it and the picture would be of a page that never
|
|
111
|
+
* existed.
|
|
112
|
+
*
|
|
113
|
+
* The UI hides but the host element stays visible, because the ring is drawn inside it. That is
|
|
114
|
+
* the whole reason to do it here rather than on the page: a report used to arrive as a selector,
|
|
115
|
+
* a text snapshot and a picture of a whole screen, leaving whoever read it to work out which of
|
|
116
|
+
* forty things on that screen the sentence was about. Now the picture says.
|
|
110
117
|
*/
|
|
111
118
|
conceal(): () => void;
|
|
119
|
+
/**
|
|
120
|
+
* A ring over the pinned element, drawn in our own shadow root.
|
|
121
|
+
*
|
|
122
|
+
* Not on the element itself. Setting a style on somebody else's node means fighting their
|
|
123
|
+
* specificity, risking a reflow that changes the picture being taken, and owning the undo — and
|
|
124
|
+
* the undo is the part that bites: hidePrivate already exists to blur private fields for a frame,
|
|
125
|
+
* and its comment is about exactly this, that a page left permanently altered because a capture
|
|
126
|
+
* threw is worse than the bug being reported. A rectangle in our own layer touches nothing.
|
|
127
|
+
*
|
|
128
|
+
* No scrim over the rest, tempting as it is. A screenshot is also the record of what the page
|
|
129
|
+
* looked like, and dimming it changes the colours in a report that may well be about the colours.
|
|
130
|
+
* The ring is doubled — red, white, red — so it carries on a dark page and on a light one without
|
|
131
|
+
* altering either.
|
|
132
|
+
*
|
|
133
|
+
* Resolved at capture time rather than at pick time: the composer may have been open for a while,
|
|
134
|
+
* and where the element is NOW is where the picture will show it.
|
|
135
|
+
*/
|
|
136
|
+
private ringAnchor;
|
|
112
137
|
/**
|
|
113
138
|
* Where the reporter dragged the panel to, if they did — for this report only.
|
|
114
139
|
*
|
|
@@ -190,3 +215,19 @@ export declare class FeedbackWidget {
|
|
|
190
215
|
* selection, and a selection made inside a shadow root is not the document's.
|
|
191
216
|
*/
|
|
192
217
|
export declare function copyText(text: string): Promise<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* Draws the launcher, and only the launcher, inside an element you own.
|
|
220
|
+
*
|
|
221
|
+
* For a settings screen that has to show what a theme will look like before anybody saves it. It is
|
|
222
|
+
* the real button with the real stylesheet in a real shadow root: a second implementation in the
|
|
223
|
+
* console's own CSS would be a picture of the widget rather than the widget, and would begin lying
|
|
224
|
+
* the first time either one changed.
|
|
225
|
+
*
|
|
226
|
+
* Nothing else comes with it — no handshake, no listeners, no page-level positioning — so it is
|
|
227
|
+
* safe to call ten times on one screen. Call it again to change the theme; it replaces what it drew.
|
|
228
|
+
*/
|
|
229
|
+
export declare function previewLauncher(into: HTMLElement, theme?: FeedbackTheme): void;
|
|
230
|
+
/** The button shapes a workspace can choose between. Anything else falls back to the first. */
|
|
231
|
+
declare const BUTTON_STYLES: readonly ["pill", "pill-icon", "icon", "text", "outline"];
|
|
232
|
+
export type ButtonStyle = (typeof BUTTON_STYLES)[number];
|
|
233
|
+
export {};
|
package/dist/widget.js
CHANGED
|
@@ -18,6 +18,8 @@ export class FeedbackWidget {
|
|
|
18
18
|
this.mode = 'idle';
|
|
19
19
|
this.anchor = null;
|
|
20
20
|
this.detach = [];
|
|
21
|
+
/** Which of the five shapes the launcher takes. */
|
|
22
|
+
this.buttonStyle = 'pill';
|
|
21
23
|
/** How far the host page's own floating buttons push us out of that corner. */
|
|
22
24
|
this.clearance = 0;
|
|
23
25
|
/**
|
|
@@ -77,15 +79,8 @@ export class FeedbackWidget {
|
|
|
77
79
|
style.textContent = '';
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// colour would otherwise close the property and let the rest of the string be read as CSS.
|
|
83
|
-
if (isColor(theme.accent))
|
|
84
|
-
declarations.push(`--pm-accent: ${theme.accent}`);
|
|
85
|
-
const radius = { none: '0', sm: '6px', md: '12px', lg: '18px' }[theme.cornerRadius ?? 'md'];
|
|
86
|
-
if (radius)
|
|
87
|
-
declarations.push(`--pm-radius: ${radius}`);
|
|
88
|
-
style.textContent = declarations.length > 0 ? `:host { ${declarations.join('; ')} }` : '';
|
|
82
|
+
style.textContent = themeVars(theme);
|
|
83
|
+
this.buttonStyle = buttonStyleOf(theme);
|
|
89
84
|
// The corner is deliberately NOT written here. Where the widget sits is decided by one method
|
|
90
85
|
// that also has to account for the host page's furniture, and two style blocks both claiming
|
|
91
86
|
// --pm-bottom is how the second one silently wins.
|
|
@@ -274,16 +269,69 @@ export class FeedbackWidget {
|
|
|
274
269
|
return { offered: true, checked: asked !== 'optional' };
|
|
275
270
|
}
|
|
276
271
|
/**
|
|
277
|
-
* Takes the widget off the screen and hands back the undo.
|
|
272
|
+
* Takes the widget off the screen, rings what the report is about, and hands back the undo.
|
|
278
273
|
*
|
|
279
|
-
* For the screen capture.
|
|
280
|
-
*
|
|
281
|
-
*
|
|
274
|
+
* For the screen capture. It is `visibility`, not `display`, because removing the panel from
|
|
275
|
+
* layout would reflow the host page underneath it and the picture would be of a page that never
|
|
276
|
+
* existed.
|
|
277
|
+
*
|
|
278
|
+
* The UI hides but the host element stays visible, because the ring is drawn inside it. That is
|
|
279
|
+
* the whole reason to do it here rather than on the page: a report used to arrive as a selector,
|
|
280
|
+
* a text snapshot and a picture of a whole screen, leaving whoever read it to work out which of
|
|
281
|
+
* forty things on that screen the sentence was about. Now the picture says.
|
|
282
282
|
*/
|
|
283
283
|
conceal() {
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
const layer = this.root.getElementById('layer');
|
|
285
|
+
const previous = layer.style.visibility;
|
|
286
|
+
layer.style.visibility = 'hidden';
|
|
287
|
+
const ring = this.ringAnchor();
|
|
288
|
+
return () => {
|
|
289
|
+
layer.style.visibility = previous;
|
|
290
|
+
ring?.remove();
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* A ring over the pinned element, drawn in our own shadow root.
|
|
295
|
+
*
|
|
296
|
+
* Not on the element itself. Setting a style on somebody else's node means fighting their
|
|
297
|
+
* specificity, risking a reflow that changes the picture being taken, and owning the undo — and
|
|
298
|
+
* the undo is the part that bites: hidePrivate already exists to blur private fields for a frame,
|
|
299
|
+
* and its comment is about exactly this, that a page left permanently altered because a capture
|
|
300
|
+
* threw is worse than the bug being reported. A rectangle in our own layer touches nothing.
|
|
301
|
+
*
|
|
302
|
+
* No scrim over the rest, tempting as it is. A screenshot is also the record of what the page
|
|
303
|
+
* looked like, and dimming it changes the colours in a report that may well be about the colours.
|
|
304
|
+
* The ring is doubled — red, white, red — so it carries on a dark page and on a light one without
|
|
305
|
+
* altering either.
|
|
306
|
+
*
|
|
307
|
+
* Resolved at capture time rather than at pick time: the composer may have been open for a while,
|
|
308
|
+
* and where the element is NOW is where the picture will show it.
|
|
309
|
+
*/
|
|
310
|
+
ringAnchor() {
|
|
311
|
+
const selector = this.anchor?.selector;
|
|
312
|
+
if (!selector)
|
|
313
|
+
return null;
|
|
314
|
+
let target = null;
|
|
315
|
+
try {
|
|
316
|
+
target = document.querySelector(selector);
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
// A selector the page has since invalidated. No ring beats an exception mid-capture.
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
if (!target)
|
|
323
|
+
return null;
|
|
324
|
+
const rect = target.getBoundingClientRect();
|
|
325
|
+
if (rect.width < 1 || rect.height < 1)
|
|
326
|
+
return null;
|
|
327
|
+
const ring = document.createElement('div');
|
|
328
|
+
ring.className = 'ring';
|
|
329
|
+
ring.style.left = `${rect.left - RING_PAD}px`;
|
|
330
|
+
ring.style.top = `${rect.top - RING_PAD}px`;
|
|
331
|
+
ring.style.width = `${rect.width + RING_PAD * 2}px`;
|
|
332
|
+
ring.style.height = `${rect.height + RING_PAD * 2}px`;
|
|
333
|
+
this.root.appendChild(ring);
|
|
334
|
+
return ring;
|
|
287
335
|
}
|
|
288
336
|
/**
|
|
289
337
|
* Makes the panel draggable by its header, and snaps it to a side when it is let go near one.
|
|
@@ -468,9 +516,7 @@ export class FeedbackWidget {
|
|
|
468
516
|
return note;
|
|
469
517
|
}
|
|
470
518
|
launcher() {
|
|
471
|
-
const button =
|
|
472
|
-
button.className = 'launcher';
|
|
473
|
-
button.textContent = this.launcherLabel ?? 'Feedback';
|
|
519
|
+
const button = launcherButton(this.buttonStyle, this.launcherLabel ?? 'Feedback');
|
|
474
520
|
button.title = this.options.hotkey === null
|
|
475
521
|
? 'Report a problem'
|
|
476
522
|
: `Report a problem (${(this.options.hotkey ?? 'f').toUpperCase()})`;
|
|
@@ -746,6 +792,8 @@ export async function copyText(text) {
|
|
|
746
792
|
}
|
|
747
793
|
/** The margin every edge of the widget keeps from the frame. */
|
|
748
794
|
const EDGE = 16;
|
|
795
|
+
/** How far the ring sits outside the element it marks, so it frames rather than covers. */
|
|
796
|
+
const RING_PAD = 3;
|
|
749
797
|
/** Enough of the header must stay reachable to drag it back. */
|
|
750
798
|
const HANDLE = 56;
|
|
751
799
|
/**
|
|
@@ -808,20 +856,137 @@ function isColor(value) {
|
|
|
808
856
|
return typeof value === 'string'
|
|
809
857
|
&& /^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/deg]+\)|[a-z]{3,20})$/i.test(value.trim());
|
|
810
858
|
}
|
|
859
|
+
/**
|
|
860
|
+
* The two palettes, as declaration lists.
|
|
861
|
+
*
|
|
862
|
+
* Written once and used twice: the stylesheet takes them for its default and its media query, and a
|
|
863
|
+
* workspace that has chosen light or dark takes the same string for the theme block. Two copies of
|
|
864
|
+
* fourteen colours would agree on the day they were written and not for long after.
|
|
865
|
+
*/
|
|
866
|
+
/**
|
|
867
|
+
* The mark, inline.
|
|
868
|
+
*
|
|
869
|
+
* A speech bubble because it is the one shape nobody has to be taught. Drawn with currentColor so
|
|
870
|
+
* it belongs to whichever preset it is in — filled white on a pill, accent-coloured in an outline.
|
|
871
|
+
*/
|
|
872
|
+
const ICON = '<svg class="launcher__icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">'
|
|
873
|
+
+ '<path d="M2 6.2C2 4.4 3.4 3 5.2 3h5.6C12.6 3 14 4.4 14 6.2v2.6c0 1.8-1.4 3.2-3.2 3.2H7l-3 2.4'
|
|
874
|
+
+ 'v-2.5A3.2 3.2 0 0 1 2 8.8V6.2Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>';
|
|
875
|
+
/**
|
|
876
|
+
* A theme, as the declarations it becomes. Shared so the preview cannot drift from the real thing.
|
|
877
|
+
*
|
|
878
|
+
* Every value is validated against a shape rather than passed through: a colour that is not a
|
|
879
|
+
* colour would otherwise close the property and let the rest of the string be read as CSS, and this
|
|
880
|
+
* string arrives from a server.
|
|
881
|
+
*/
|
|
882
|
+
function themeVars(theme) {
|
|
883
|
+
const declarations = [];
|
|
884
|
+
if (isColor(theme.accent))
|
|
885
|
+
declarations.push(`--pm-accent: ${theme.accent}`);
|
|
886
|
+
const radius = { none: '0', sm: '6px', md: '12px', lg: '18px' }[theme.cornerRadius ?? 'md'];
|
|
887
|
+
if (radius)
|
|
888
|
+
declarations.push(`--pm-radius: ${radius}`);
|
|
889
|
+
// System is the default and is what the base stylesheet already does, so "auto" writes nothing at
|
|
890
|
+
// all. Only a workspace that has overruled the reader gets a palette pinned here — where it beats
|
|
891
|
+
// the media query by being a later stylesheet at the same specificity.
|
|
892
|
+
if (theme.colorScheme === 'dark')
|
|
893
|
+
declarations.push(DARK);
|
|
894
|
+
else if (theme.colorScheme === 'light')
|
|
895
|
+
declarations.push(LIGHT);
|
|
896
|
+
return declarations.length > 0 ? `:host { ${declarations.join('; ')} }` : '';
|
|
897
|
+
}
|
|
898
|
+
const buttonStyleOf = (theme) => BUTTON_STYLES.includes(theme.buttonStyle)
|
|
899
|
+
? theme.buttonStyle
|
|
900
|
+
: 'pill';
|
|
901
|
+
/**
|
|
902
|
+
* The launcher, as an element. One builder, so the settings screen shows the real button.
|
|
903
|
+
*
|
|
904
|
+
* The icon is markup rather than a font or an image: one is a network request on somebody else's
|
|
905
|
+
* page and the other is a glyph that may not be there. The label is escaped on the way in — it
|
|
906
|
+
* arrives from the handshake, and everything from there is treated as data.
|
|
907
|
+
*/
|
|
908
|
+
function launcherButton(style, label) {
|
|
909
|
+
const button = document.createElement('button');
|
|
910
|
+
button.className = `launcher launcher--${style}`;
|
|
911
|
+
if (style === 'icon') {
|
|
912
|
+
button.innerHTML = ICON;
|
|
913
|
+
// Nothing to read, so the name has to come from somewhere. Without this the button is announced
|
|
914
|
+
// as "button" and a screen reader user has no idea what it does.
|
|
915
|
+
button.setAttribute('aria-label', label);
|
|
916
|
+
}
|
|
917
|
+
else if (style === 'pill-icon') {
|
|
918
|
+
button.innerHTML = `${ICON}<span>${escapeHtml(label)}</span>`;
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
button.textContent = label;
|
|
922
|
+
}
|
|
923
|
+
return button;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Draws the launcher, and only the launcher, inside an element you own.
|
|
927
|
+
*
|
|
928
|
+
* For a settings screen that has to show what a theme will look like before anybody saves it. It is
|
|
929
|
+
* the real button with the real stylesheet in a real shadow root: a second implementation in the
|
|
930
|
+
* console's own CSS would be a picture of the widget rather than the widget, and would begin lying
|
|
931
|
+
* the first time either one changed.
|
|
932
|
+
*
|
|
933
|
+
* Nothing else comes with it — no handshake, no listeners, no page-level positioning — so it is
|
|
934
|
+
* safe to call ten times on one screen. Call it again to change the theme; it replaces what it drew.
|
|
935
|
+
*/
|
|
936
|
+
export function previewLauncher(into, theme = {}) {
|
|
937
|
+
const root = into.shadowRoot ?? into.attachShadow({ mode: 'open' });
|
|
938
|
+
const label = typeof theme.launcherLabel === 'string' && theme.launcherLabel.length > 0
|
|
939
|
+
? theme.launcherLabel.slice(0, 24)
|
|
940
|
+
: 'Feedback';
|
|
941
|
+
root.innerHTML = `<style>${STYLES}</style><style>${themeVars(theme)}</style>`;
|
|
942
|
+
const button = launcherButton(buttonStyleOf(theme), label);
|
|
943
|
+
// In place, not pinned to the viewport: the caller is laying these out in a row.
|
|
944
|
+
button.classList.add('launcher--preview');
|
|
945
|
+
button.disabled = true;
|
|
946
|
+
root.appendChild(button);
|
|
947
|
+
}
|
|
948
|
+
/** The button shapes a workspace can choose between. Anything else falls back to the first. */
|
|
949
|
+
const BUTTON_STYLES = ['pill', 'pill-icon', 'icon', 'text', 'outline'];
|
|
950
|
+
const LIGHT = '--pm-surface: #fff; --pm-ink: #171717; --pm-muted: #525252; --pm-faint: #a3a3a3; --pm-line: #e5e5e5; --pm-line-strong: #d4d4d4; --pm-sunken: #f5f5f5; --pm-kbd: #404040; --pm-warn: #b45309; --pm-good: #047857; --pm-good-bg: #ecfdf5; --pm-good-line: #a7f3d0; --pm-accent: #171717; --pm-on-accent: #fafafa;';
|
|
951
|
+
const DARK = '--pm-surface: #1c1c1c; --pm-ink: #fafafa; --pm-muted: #a3a3a3; --pm-faint: #737373; --pm-line: #333; --pm-line-strong: #454545; --pm-sunken: #262626; --pm-kbd: #d4d4d4; --pm-warn: #fbbf24; --pm-good: #34d399; --pm-good-bg: #05271f; --pm-good-line: #065f46; --pm-accent: #fafafa; --pm-on-accent: #171717;';
|
|
811
952
|
const STYLES = `
|
|
953
|
+
/*
|
|
954
|
+
Every colour in this file is one of these, and there are two sets of them.
|
|
955
|
+
|
|
956
|
+
Not for fashion: the widget is a panel laid over somebody else's page, and a white card on a dark
|
|
957
|
+
application is a flashbang. It followed the host's scheme in exactly one respect before — it did
|
|
958
|
+
not, and was always light.
|
|
959
|
+
|
|
960
|
+
System is the default and costs no JavaScript: the media query below is in the base stylesheet, so
|
|
961
|
+
a widget nobody has configured tracks the reader's own setting. A workspace that picks light or
|
|
962
|
+
dark gets those values written into the theme block instead, which is a later stylesheet at the
|
|
963
|
+
same specificity and therefore wins over the query.
|
|
964
|
+
|
|
965
|
+
The accent pair is inverse emphasis — a dark pill on a light page, a light pill on a dark one —
|
|
966
|
+
because the launcher sits on the HOST page rather than on our panel, and a near-black button on a
|
|
967
|
+
near-black application is a button nobody finds. A host that sets its own accent gets white text
|
|
968
|
+
on it, unchanged from before; we cannot compute contrast in CSS and guessing wrong is worse than
|
|
969
|
+
the one case where a very pale brand colour needs its own care.
|
|
970
|
+
*/
|
|
812
971
|
:host {
|
|
813
972
|
all: initial;
|
|
814
973
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
"put it on the left" has to be four numbers and not one word. */
|
|
818
|
-
--pm-accent: #171717;
|
|
974
|
+
${LIGHT}
|
|
975
|
+
|
|
819
976
|
--pm-radius: 12px;
|
|
977
|
+
|
|
978
|
+
/* Offsets rather than a keyword: a custom property can hold a value, not a property name, so
|
|
979
|
+
"put it on the left" has to be four numbers and not one word. */
|
|
820
980
|
--pm-left: auto;
|
|
821
981
|
--pm-right: 16px;
|
|
822
982
|
--pm-top: auto;
|
|
823
983
|
--pm-bottom: 16px;
|
|
824
984
|
}
|
|
985
|
+
|
|
986
|
+
@media (prefers-color-scheme: dark) {
|
|
987
|
+
:host { ${DARK} }
|
|
988
|
+
}
|
|
989
|
+
}
|
|
825
990
|
* { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
|
|
826
991
|
@media (prefers-reduced-motion: reduce) { .launcher { transition: none } }
|
|
827
992
|
#layer { position: fixed; inset: 0; pointer-events: none }
|
|
@@ -833,16 +998,67 @@ const STYLES = `
|
|
|
833
998
|
reads as a bug. Honoured only where motion is welcome. */
|
|
834
999
|
transition: bottom .18s ease, top .18s ease;
|
|
835
1000
|
padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
|
|
836
|
-
background: var(--pm-accent); color:
|
|
1001
|
+
background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
|
|
837
1002
|
box-shadow: 0 2px 12px rgba(0,0,0,.3);
|
|
838
1003
|
}
|
|
839
1004
|
.launcher:hover { filter: brightness(1.15) }
|
|
840
1005
|
.launcher--pending { cursor: default; opacity: .85 }
|
|
841
1006
|
.launcher--pending:hover { filter: none }
|
|
1007
|
+
.launcher__icon { flex: none; width: 15px; height: 15px; display: block }
|
|
1008
|
+
/* For previewLauncher: in the flow of a settings page rather than pinned to a corner. */
|
|
1009
|
+
.launcher--preview { position: static; cursor: default; opacity: 1 }
|
|
1010
|
+
|
|
1011
|
+
/*
|
|
1012
|
+
Five buttons, because one button cannot be right for every page it is a guest on.
|
|
1013
|
+
|
|
1014
|
+
A product with its own bold chat bubble does not want a second bold pill beside it; a spare
|
|
1015
|
+
documentation site does not want a filled button at all; a dense application often wants the
|
|
1016
|
+
smallest possible mark. The set is deliberately small — five things somebody can look at and
|
|
1017
|
+
choose between in a moment, rather than a colour picker and a padding field.
|
|
1018
|
+
|
|
1019
|
+
Every one of them keeps the same hit area at the same corner, so the clearance measurement and
|
|
1020
|
+
the placement work unchanged whichever is picked.
|
|
1021
|
+
*/
|
|
1022
|
+
.launcher { display: inline-flex; align-items: center; gap: 7px }
|
|
1023
|
+
|
|
1024
|
+
/* Filled and round. The default, and the one that reads as a product feature. */
|
|
1025
|
+
.launcher--pill {}
|
|
1026
|
+
|
|
1027
|
+
/* The same, with the icon in front for pages where a word alone reads as body text. */
|
|
1028
|
+
.launcher--pill-icon {}
|
|
1029
|
+
|
|
1030
|
+
/* The mark on its own, for a corner that is already busy. */
|
|
1031
|
+
.launcher--icon { padding: 10px; border-radius: 999px }
|
|
1032
|
+
|
|
1033
|
+
/* No fill at all. For a page whose own furniture is quiet and would be shouted over. */
|
|
1034
|
+
.launcher--text {
|
|
1035
|
+
background: transparent; color: var(--pm-ink); box-shadow: none;
|
|
1036
|
+
padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
|
|
1037
|
+
}
|
|
1038
|
+
.launcher--text:hover { filter: none; color: var(--pm-accent) }
|
|
1039
|
+
|
|
1040
|
+
/* Outlined: present without being loud, and it inherits the accent rather than filling with it. */
|
|
1041
|
+
.launcher--outline {
|
|
1042
|
+
background: transparent; color: var(--pm-accent);
|
|
1043
|
+
border: 1px solid currentColor; box-shadow: none;
|
|
1044
|
+
}
|
|
1045
|
+
.launcher--outline:hover { filter: none; background: var(--pm-sunken) }
|
|
842
1046
|
.mask {
|
|
843
1047
|
position: fixed; inset: 0; pointer-events: auto; cursor: crosshair;
|
|
844
1048
|
background: rgba(23,23,23,.12);
|
|
845
1049
|
}
|
|
1050
|
+
/*
|
|
1051
|
+
The pinned element, ringed for the screenshot.
|
|
1052
|
+
|
|
1053
|
+
Three rings rather than one: a red line alone disappears against a red button, and a white one
|
|
1054
|
+
disappears against a white card. Red, then white, then a soft red — one of the three is always
|
|
1055
|
+
against something it contrasts with, on any page, without touching that page's own colours.
|
|
1056
|
+
*/
|
|
1057
|
+
.ring {
|
|
1058
|
+
position: fixed; pointer-events: none; border-radius: 3px;
|
|
1059
|
+
border: 2px solid #ef4444;
|
|
1060
|
+
box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 5px rgba(239,68,68,.35);
|
|
1061
|
+
}
|
|
846
1062
|
/*
|
|
847
1063
|
Bottom, not top.
|
|
848
1064
|
|
|
@@ -854,18 +1070,18 @@ const STYLES = `
|
|
|
854
1070
|
*/
|
|
855
1071
|
.hint {
|
|
856
1072
|
position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
|
|
857
|
-
padding: 7px 12px; border-radius: 8px; background:
|
|
1073
|
+
padding: 7px 12px; border-radius: 8px; background: var(--pm-ink); color: var(--pm-on-accent);
|
|
858
1074
|
font-size: 12px; white-space: nowrap;
|
|
859
1075
|
}
|
|
860
1076
|
kbd {
|
|
861
|
-
padding: 1px 5px; border-radius: 4px; background:
|
|
1077
|
+
padding: 1px 5px; border-radius: 4px; background: var(--pm-kbd); color: var(--pm-surface);
|
|
862
1078
|
font-family: ui-monospace, monospace; font-size: 11px;
|
|
863
1079
|
}
|
|
864
1080
|
.panel {
|
|
865
1081
|
position: fixed; width: 380px; max-width: calc(100vw - 32px); pointer-events: auto;
|
|
866
1082
|
left: var(--pm-left); right: var(--pm-right);
|
|
867
1083
|
top: var(--pm-top); bottom: var(--pm-bottom);
|
|
868
|
-
padding: 16px; border-radius: var(--pm-radius); background:
|
|
1084
|
+
padding: 16px; border-radius: var(--pm-radius); background: var(--pm-surface); color: var(--pm-ink);
|
|
869
1085
|
box-shadow: 0 8px 32px rgba(0,0,0,.24); font-size: 13px;
|
|
870
1086
|
}
|
|
871
1087
|
.panel__head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px }
|
|
@@ -881,29 +1097,29 @@ kbd {
|
|
|
881
1097
|
*/
|
|
882
1098
|
.drag { cursor: grab; touch-action: none; user-select: none }
|
|
883
1099
|
.drag:active { cursor: grabbing }
|
|
884
|
-
.panel__grip { flex: none; color:
|
|
885
|
-
.drag:hover .panel__grip { color:
|
|
1100
|
+
.panel__grip { flex: none; color: var(--pm-faint); font-size: 15px; line-height: 16px; letter-spacing: -1px }
|
|
1101
|
+
.drag:hover .panel__grip { color: var(--pm-muted) }
|
|
886
1102
|
.panel--dragging { box-shadow: 0 16px 48px rgba(0,0,0,.32); opacity: .92 }
|
|
887
1103
|
|
|
888
1104
|
/* An incomplete report, said plainly. Amber rather than red: the words arrived. */
|
|
889
|
-
.sent__warn { margin-top: 6px; color:
|
|
1105
|
+
.sent__warn { margin-top: 6px; color: var(--pm-warn); font-size: 11px; line-height: 1.4 }
|
|
890
1106
|
|
|
891
1107
|
/* The anchor leads: it is what the reporter pointed at, and the part they need to recognise. */
|
|
892
1108
|
.panel__anchor {
|
|
893
|
-
color:
|
|
1109
|
+
color: var(--pm-muted); font-size: 11px;
|
|
894
1110
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
895
1111
|
}
|
|
896
1112
|
.panel__close {
|
|
897
1113
|
margin-left: auto; border: 0; background: none; cursor: pointer;
|
|
898
|
-
color:
|
|
1114
|
+
color: var(--pm-faint); font-size: 20px; line-height: 1; padding: 0 2px;
|
|
899
1115
|
}
|
|
900
|
-
.panel__close:hover { color:
|
|
1116
|
+
.panel__close:hover { color: var(--pm-ink) }
|
|
901
1117
|
|
|
902
1118
|
/* A confirmation, not a form. */
|
|
903
1119
|
.panel--sent { display: flex; align-items: flex-start; gap: 10px }
|
|
904
1120
|
.sent__tick {
|
|
905
1121
|
flex: none; width: 24px; height: 24px; border-radius: 999px;
|
|
906
|
-
background:
|
|
1122
|
+
background: var(--pm-good-bg); color: var(--pm-good);
|
|
907
1123
|
display: grid; place-items: center; font-size: 14px;
|
|
908
1124
|
}
|
|
909
1125
|
.sent__body { min-width: 0 }
|
|
@@ -912,28 +1128,28 @@ kbd {
|
|
|
912
1128
|
.sent__ref { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px }
|
|
913
1129
|
.sent__id {
|
|
914
1130
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
|
|
915
|
-
color:
|
|
1131
|
+
color: var(--pm-ink); background: var(--pm-sunken); border-radius: 5px; padding: 2px 6px;
|
|
916
1132
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
917
1133
|
}
|
|
918
1134
|
.sent__copy {
|
|
919
|
-
flex: none; border: 1px solid
|
|
920
|
-
color:
|
|
1135
|
+
flex: none; border: 1px solid var(--pm-line); border-radius: 6px; background: var(--pm-surface);
|
|
1136
|
+
color: var(--pm-muted); cursor: pointer; font-size: 11px; padding: 3px 8px;
|
|
921
1137
|
}
|
|
922
|
-
.sent__copy:hover { border-color:
|
|
923
|
-
.sent__copy--done { border-color:
|
|
1138
|
+
.sent__copy:hover { border-color: var(--pm-faint); color: var(--pm-ink) }
|
|
1139
|
+
.sent__copy--done { border-color: var(--pm-good-line); background: var(--pm-good-bg); color: var(--pm-good) }
|
|
924
1140
|
|
|
925
1141
|
.panel__kinds { display: flex; gap: 6px; margin: 8px 0 }
|
|
926
1142
|
.kind {
|
|
927
|
-
flex: 1; padding: 5px 0; border: 1px solid
|
|
928
|
-
background:
|
|
1143
|
+
flex: 1; padding: 5px 0; border: 1px solid var(--pm-line); border-radius: 7px;
|
|
1144
|
+
background: var(--pm-surface); color: var(--pm-muted); cursor: pointer; font-size: 12px; text-transform: capitalize;
|
|
929
1145
|
}
|
|
930
|
-
.kind--on { border-color:
|
|
1146
|
+
.kind--on { border-color: var(--pm-ink); background: var(--pm-ink); color: var(--pm-surface) }
|
|
931
1147
|
textarea, input[type=email] {
|
|
932
|
-
width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid
|
|
933
|
-
border-radius: 8px; font-size: 13px; resize: vertical; color:
|
|
1148
|
+
width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--pm-line);
|
|
1149
|
+
border-radius: 8px; font-size: 13px; resize: vertical; color: var(--pm-ink); background: var(--pm-surface);
|
|
934
1150
|
}
|
|
935
|
-
textarea:focus, input:focus { outline: 2px solid
|
|
936
|
-
.shot { display: flex; align-items: center; gap: 6px; color:
|
|
1151
|
+
textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset: -1px }
|
|
1152
|
+
.shot { display: flex; align-items: center; gap: 6px; color: var(--pm-muted); font-size: 12px }
|
|
937
1153
|
|
|
938
1154
|
/*
|
|
939
1155
|
One row. Cancel used to sit ABOVE Send in a stacked span, which read as a label for it rather than
|
|
@@ -941,16 +1157,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
|
|
|
941
1157
|
*/
|
|
942
1158
|
.panel__foot {
|
|
943
1159
|
display: flex; align-items: center; gap: 8px; margin-top: 12px;
|
|
944
|
-
padding-top: 12px; border-top: 1px solid
|
|
1160
|
+
padding-top: 12px; border-top: 1px solid var(--pm-sunken);
|
|
945
1161
|
}
|
|
946
|
-
.panel__note { flex: 1; color:
|
|
1162
|
+
.panel__note { flex: 1; color: var(--pm-faint); font-size: 10px; line-height: 1.3 }
|
|
947
1163
|
.primary, .ghost {
|
|
948
1164
|
padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
|
|
949
1165
|
}
|
|
950
|
-
.primary { border: 0; background:
|
|
1166
|
+
.primary { border: 0; background: var(--pm-ink); color: var(--pm-surface) }
|
|
951
1167
|
.primary:disabled { opacity: .5; cursor: default }
|
|
952
|
-
.ghost { border: 0; background: transparent; color:
|
|
953
|
-
.status { margin-top: 6px; color:
|
|
1168
|
+
.ghost { border: 0; background: transparent; color: var(--pm-muted) }
|
|
1169
|
+
.status { margin-top: 6px; color: var(--pm-warn); font-size: 11px; min-height: 0 }
|
|
954
1170
|
/*
|
|
955
1171
|
One attachment area, holding both ways of adding a picture. They were a checkbox and a dropzone
|
|
956
1172
|
stacked — two affordances for one job, and together the busiest part of a panel whose busiest part
|
|
@@ -958,16 +1174,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
|
|
|
958
1174
|
*/
|
|
959
1175
|
.drop {
|
|
960
1176
|
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
|
|
961
|
-
margin-top: 8px; padding: 8px 10px; border: 1px dashed
|
|
962
|
-
color:
|
|
1177
|
+
margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--pm-line-strong); border-radius: 8px;
|
|
1178
|
+
color: var(--pm-faint); font-size: 11px;
|
|
963
1179
|
}
|
|
964
|
-
.drop__or { color:
|
|
965
|
-
.drop--over { border-color:
|
|
1180
|
+
.drop__or { color: var(--pm-faint) }
|
|
1181
|
+
.drop--over { border-color: var(--pm-ink); color: var(--pm-ink); background: var(--pm-sunken) }
|
|
966
1182
|
.files { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
|
|
967
|
-
.file { display: flex; align-items: center; gap: 6px; font-size: 11px; color:
|
|
968
|
-
.file--bad { color:
|
|
1183
|
+
.file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pm-muted) }
|
|
1184
|
+
.file--bad { color: var(--pm-warn) }
|
|
969
1185
|
.file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px }
|
|
970
1186
|
.file__icon { width: 28px; text-align: center }
|
|
971
1187
|
.file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
|
|
972
|
-
.link { border: 0; background: transparent; color:
|
|
1188
|
+
.link { border: 0; background: transparent; color: var(--pm-muted); cursor: pointer; font-size: 11px; text-decoration: underline }
|
|
973
1189
|
`;
|
package/package.json
CHANGED