notemend 0.1.18 → 0.1.21
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/.claude-plugin/plugin.json +1 -1
- package/README.md +9 -5
- package/bin/notemend.mjs +15 -15
- package/package.json +1 -1
- package/src/client/index.js +248 -1
- package/src/client/notemend.css +1 -1
- package/src/hosting.mjs +1 -1
- package/src/next.mjs +1 -1
- package/src/server/middleware.mjs +1 -1
- package/src/store/cloud.mjs +3 -3
- package/src/store/comments.mjs +3 -3
- package/src/store/thread.mjs +1 -1
- package/store.d.ts +30 -5
- package/thread.d.ts +12 -3
- package/src/client/anchor.js +0 -1
- package/src/client/api.js +0 -1
- package/src/client/boot.js +0 -1
- package/src/client/canvas.js +0 -1
- package/src/client/config.js +0 -1
- package/src/client/devices.js +0 -1
- package/src/client/field-menu.js +0 -1
- package/src/client/inspect.js +0 -1
- package/src/client/logs.js +0 -1
- package/src/client/markup.js +0 -128
- package/src/client/panel.js +0 -43
- package/src/client/review.js +0 -7
- package/src/client/run.js +0 -74
- package/src/client/toplayer.js +0 -1
- package/src/client/turbo.js +0 -1
package/store.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Working } from './thread.js';
|
|
2
2
|
|
|
3
3
|
/** One reply in a thread: `author: 'claude'` is any agent, `agent` says which */
|
|
4
|
-
export interface Reply { author: 'you' | 'claude'; text: string; at: string; by?: string; byName?: string; agent?: string; mentions?: string[]
|
|
4
|
+
export interface Reply { author: 'you' | 'claude'; text: string; at: string; by?: string; byName?: string; agent?: string; mentions?: string[];
|
|
5
|
+
/** taken back by its writer: kept in place, emptied */
|
|
6
|
+
deleted?: boolean }
|
|
5
7
|
/** A line the page logged before the comment was written (the bar's logs) */
|
|
6
8
|
export interface LogLine { at: string; kind: 'console' | 'error' | 'rejection' | 'network'; text: string }
|
|
7
9
|
|
|
@@ -15,6 +17,18 @@ export interface Comment {
|
|
|
15
17
|
doneBy: string | null; doneAgent?: string | null;
|
|
16
18
|
images: string[]; suggest?: { from: string; to: string }; assignee?: string;
|
|
17
19
|
working?: Working | null; logs?: LogLine[];
|
|
20
|
+
stage?: 'new' | 'approved' | 'progress' | 'review' | 'waiting' | 'accepted';
|
|
21
|
+
priority?: 'urgent' | 'high' | 'normal' | 'low';
|
|
22
|
+
/** the project's clients see it too */
|
|
23
|
+
shared?: boolean;
|
|
24
|
+
/** a person sent it back: the agent's last word before this is no question */
|
|
25
|
+
reopenedAt?: string; acceptedAt?: string;
|
|
26
|
+
/** who ticked it as fixed, in a team */
|
|
27
|
+
confirmedBy?: string | null; confirmedAt?: string | null;
|
|
28
|
+
/** the person the agent ran as when it resolved it */
|
|
29
|
+
doneFor?: string | null;
|
|
30
|
+
/** a guest's thread, approved by the studio */
|
|
31
|
+
approvedBy?: string | null;
|
|
18
32
|
/** the copy of the site it was written on — live, staging, localhost — as host[:port] */
|
|
19
33
|
host?: string;
|
|
20
34
|
by?: string; byName?: string; createdAt: string; updatedAt: string | null;
|
|
@@ -36,21 +50,32 @@ export function shotName(path: string): string;
|
|
|
36
50
|
/** The next thread's number: never one a deleted or archived thread had */
|
|
37
51
|
export function nextId(db: Db): number;
|
|
38
52
|
export function add(db: Db, comment: NewComment): Comment;
|
|
39
|
-
export function reply(db: Db, id: number | string, author: 'you' | 'claude', text: string, agent?: string): Comment | null;
|
|
53
|
+
export function reply(db: Db, id: number | string, author: 'you' | 'claude', text: string, agent?: string, by?: string): Comment | null;
|
|
40
54
|
/** Reword the comment (`at` null) or one of your replies (by when it was written) */
|
|
41
55
|
export function edit(db: Db, id: number | string, at: string | null, text: string): Comment | null;
|
|
56
|
+
/** Take back one of your replies, found by when it was written */
|
|
57
|
+
export function unsay(db: Db, id: number | string, at: string): Comment | null;
|
|
42
58
|
export function patch(db: Db, id: number | string, changes: Partial<Comment>): Comment | null;
|
|
59
|
+
export type Media = { base64: string; voice: boolean; ext: string; type: string; slug?: string };
|
|
60
|
+
/** What a data: URL files as — a screenshot, a recording, a voice note or a document — else null */
|
|
61
|
+
export function mediaOf(dataUrl: string): Media | null;
|
|
62
|
+
/** The filed name: <id>-<ms>.<ext>, voice-…, or before-… / after-… for a frame */
|
|
63
|
+
export function mediaName(id: number, ms: number, media: Media, kind?: 'before' | 'after'): string;
|
|
64
|
+
/** File a frame of the element, dropping the older one of its kind; either store */
|
|
65
|
+
export function fileFrame(store: { attach: Function; detach: Function }, db: Db, id: number | string, dataUrl: unknown, kind: 'before' | 'after'): Promise<string | null>;
|
|
43
66
|
|
|
44
67
|
/** One project's store on disk: <root>/feedback/comments.json and feedback/images/ */
|
|
45
68
|
export function createStore(root: string): {
|
|
46
69
|
root: string; file: string; imageDir: string; archiveDir: string; archiveImageDir: string;
|
|
47
70
|
load(): Db;
|
|
48
71
|
save(db: Db): void;
|
|
49
|
-
/** file
|
|
50
|
-
|
|
72
|
+
/** the file's stamp, for ?since= polls: '0' when there is no file yet */
|
|
73
|
+
version(): string;
|
|
74
|
+
/** file a data: URL screenshot (or webm) under the comment — `kind` makes it a frame; returns its path or null */
|
|
75
|
+
attach(db: Db, id: number | string, dataUrl: string, kind?: 'before' | 'after'): string | null;
|
|
51
76
|
detach(db: Db, id: number | string, name: string): boolean;
|
|
52
77
|
remove(db: Db, id: number | string): boolean;
|
|
53
78
|
/** move resolved threads to feedback/archive/, leaving the id floor behind */
|
|
54
79
|
prune(db: Db, opts?: { dry?: boolean; date?: string }): { moving: Comment[]; keeping: Comment[]; archiveFile: string; images: string[] };
|
|
55
|
-
add: typeof add; patch: typeof patch; reply: typeof reply; edit: typeof edit; nextId: typeof nextId;
|
|
80
|
+
add: typeof add; patch: typeof patch; reply: typeof reply; edit: typeof edit; unsay: typeof unsay; nextId: typeof nextId;
|
|
56
81
|
};
|
package/thread.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export function agentName(id?: string | null): string;
|
|
|
10
10
|
/** The agent mark: twelve rays drawn with a stroke, in viewBox AI_BOX. */
|
|
11
11
|
export const AI_BOX: string;
|
|
12
12
|
export const AI_RAYS: string;
|
|
13
|
-
/** Whose agent a thread is for: the email in 'agent:<email>', else null */
|
|
13
|
+
/** Whose agent a thread is for: the email in 'agent:<email>' (legacy, before one agent in 0.1.15), else null */
|
|
14
14
|
export function agentOwner(assignee?: string | null): string | null;
|
|
15
15
|
/** Given to an agent: the shared queue ('claude') or a person's own ('agent:<email>') */
|
|
16
16
|
export function toAgent(assignee?: string | null): boolean;
|
|
@@ -32,8 +32,8 @@ export function workingOn(c: { working?: Working | null; status?: string } | nul
|
|
|
32
32
|
export function isGuest(email?: string | null): boolean;
|
|
33
33
|
/** A guest's thread the studio has not approved yet: no agent takes it */
|
|
34
34
|
export function held(c: { by?: string | null; approvedBy?: string | null }): boolean;
|
|
35
|
-
/** The
|
|
36
|
-
export function agentHandles(
|
|
35
|
+
/** The agent a message can @mention: one, Claude */
|
|
36
|
+
export function agentHandles(): { assignee: string; handle: string; owner: string | null }[];
|
|
37
37
|
/** The agent a text hands its thread to: the last one it @mentions, else null */
|
|
38
38
|
export function agentMentioned(text: string, people?: { email: string; name?: string | null; agent_name?: string | null }[]): string | null;
|
|
39
39
|
export type AgentStep = "held" | "queued" | "asks" | "working" | "stuck" | "review" | "done";
|
|
@@ -53,3 +53,12 @@ export const DOCS: { pdf: string; doc: string; docx: string };
|
|
|
53
53
|
export function docSlug(name: string): string;
|
|
54
54
|
/** What to call a document — "brief.pdf" — by its path or data: URL; null when it is not one */
|
|
55
55
|
export function docOf(path: string): string | null;
|
|
56
|
+
/** The element's frames a thread keeps above its conversation */
|
|
57
|
+
export const FRAMES: ('before' | 'after')[];
|
|
58
|
+
/** Which frame a filed path is — before-… or after-… — else null */
|
|
59
|
+
export function frameOf(path: string): 'before' | 'after' | null;
|
|
60
|
+
/** A thread's latest frame of each kind */
|
|
61
|
+
export function framesOf(c: { images?: string[] } | null | undefined): { before?: string; after?: string };
|
|
62
|
+
export type ThreadMessage = { author: string; text: string; at?: string | null; by?: string; byName?: string; agent?: string; deleted?: boolean; images: string[] };
|
|
63
|
+
/** The comment, the note and the replies in order, each with the screenshots sent with it; deleted replies left out */
|
|
64
|
+
export function threadOf(c: { text: string; createdAt?: string; by?: string; byName?: string; note?: string; updatedAt?: string | null; replies?: Record<string, any>[]; images?: string[] }): ThreadMessage[];
|
package/src/client/anchor.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const s=i=>(i??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim();function y(){const i=e=>{const t=[];let n=e;for(;n&&n.tagName!=="HTML"&&t.length<8;){if(n.id){t.unshift("#"+CSS.escape(n.id));break}const r=n.parentElement,o=n.tagName.toLowerCase(),l=r?[...r.children].filter(c=>c.tagName===n.tagName):[];t.unshift(l.length>1?`${o}:nth-of-type(${l.indexOf(n)+1})`:o),n=r}return t.join(">")},a=(e,t)=>!t||s(e.textContent||"").slice(0,60)===t,h=(e,t)=>[e||"*",...(t||[]).map(n=>"."+CSS.escape(n))].join(""),m=e=>{try{return[...document.querySelectorAll(h(e.tag,e.classes))]}catch{return[]}},f=e=>{const t=s(e.textContent||"").replace(/\s+/g," ");for(let n=e.parentElement,r=0;n&&n!==document.body&&r<4;n=n.parentElement,r++){const o=s(n.textContent||"").replace(/\s+/g," ");if(o&&o!==t)return o}return""},b=e=>f(e).slice(0,80),u=(e,t)=>!t||f(e).startsWith(t),g=e=>{let t=null;try{t=document.querySelector(e.selector)}catch{t=null}if(t&&a(t,e.label)&&u(t,e.ctx))return t;const n=m(e),r=s(e.label)?n.filter(l=>a(l,e.label)):[];return(r.find(l=>u(l,e.ctx))??n.find(l=>e.ctx&&u(l,e.ctx)&&!s(e.label)))||r[0]||(t&&a(t,e.label)?t:null)||(e.nth!=null?n[e.nth]:null)||n[0]||t},p=e=>{let t=null;for(let n=e,r=e.parentElement;r&&r!==document.body&&getComputedStyle(n).position!=="fixed";n=r,r=r.parentElement){const o=getComputedStyle(r);if(o.overflowX==="visible"&&o.overflowY==="visible")continue;const l=r.getBoundingClientRect();t=t?{l:Math.max(t.l,l.left),t:Math.max(t.t,l.top),r:Math.min(t.r,l.right),b:Math.min(t.b,l.bottom)}:{l:l.left,t:l.top,r:l.right,b:l.bottom}}return t};return{cssPath:i,poolOf:m,contextOf:b,resolveEl:g,anchorOf:e=>{const t=g(e);if(!t)return null;const n=t.getBoundingClientRect();if(!n.width&&!n.height)return null;const r=n.left+n.width*e.rx,o=n.top+n.height*e.ry,l=p(t);if(!l)return{x:r,y:o,off:"",el:t};if(l.r-l.l<18||l.b-l.t<18)return null;const c=Math.min(Math.max(r,l.l),l.r-18),x=Math.min(Math.max(o,l.t+18),l.b),d=r<l.l?"l":r>l.r-18?"r":o<l.t+18?"t":o>l.b?"b":"";return{x:c,y:x,off:d,el:t}}}}export{y as anchors,s as clean};
|
package/src/client/api.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const n={base:"",via:null,signed:{},live:!1};async function o(e,s={}){if(!n.via)return fetch(`/__devbar/${e}`,s);const t=await n.via(e,s);if(t.ok&&e.startsWith("comments")&&(s.method??"GET")==="GET"){const i=await t.clone().json().catch(()=>null);i?.signed&&Object.assign(n.signed,i.signed)}return t}const r=e=>n.via?n.signed[e]??"":`/__devbar/image?name=${encodeURIComponent(e)}`,a=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})();export{o as api,a as canvasCopy,n as host,r as imageUrl};
|
package/src/client/boot.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{loadConfig as i}from"./config";import{mount as c}from"./markup";import{run as l}from"./run";import{keepAboveModals as f}from"./toplayer";import{canvasCopy as u,host as d}from"./api";import{watchLogs as p}from"./logs";function E(){const r=window;if(r.__notemend)return;r.__notemend=!0,p(t=>t.includes("/__devbar/")||!!d.base&&t.startsWith(d.base));const s=new Promise(t=>{if(!("__next_f"in self))return t();let o=0;const e=()=>Object.keys(document.documentElement).some(n=>n.startsWith("__reactFiber$"))||++o>330?t():setTimeout(e,30);e()});s.then(()=>{u&&document.documentElement.classList.add("dt-in-frame")}),Promise.all([i(),s]).then(([t])=>{document.documentElement.style.setProperty("--dt-z",String(t.zIndex));const o=t.brand?.color;if(o&&/^#[0-9a-f]{6}$/i.test(o)){const[e,n,a]=[1,3,5].map(m=>parseInt(o.slice(m,m+2),16)/255);document.documentElement.style.setProperty("--dt-accent",o),document.documentElement.style.setProperty("--dt-accent-ink",.2126*e+.7152*n+.0722*a>.55?"#000000":"#ffffff")}c(t),l(t),f([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab"].map(e=>document.querySelector(e)).filter(e=>!!e))}).catch(t=>console.warn("[notemend] not started:",t))}export{E as start};
|
package/src/client/canvas.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEVTOOLS_DEVICES as le}from"../devtools-devices.mjs";import{drawDevice as Me,pageTints as Se,inkFor as ie}from"./devices";function $e(de){const{cfg:ce,inFrame:ue,persist:D,frame:m,frameEl:l,devicesMenu:f,bpBtns:me,notesOverlay:j,WIDE:fe,bpOf:$,currentBp:h,deviceById:x,notesOn:C,filter:N,filterTo:L,dropFrameDrafts:pe,putAway:O,tellFrame:P,syncBpButtons:k,render:be,reread:U}=de,v=ce.breakpoints,s=document.querySelector(".dt-device"),Q=document.querySelector(".dt-shell"),w=document.querySelector('.dt-chrome[data-at="top"]'),B=document.querySelector('.dt-chrome[data-at="bottom"]'),M=document.querySelector(".dt-ruler"),he=[...document.querySelectorAll(".dt-frame-handle")],Z=document.querySelector(".dt-frame-size"),W=document.querySelector(".dt-frame-rotate"),S=document.querySelector(".dt-frame-bars");let T="overlay",g="";const I="dt-w",z="dt-canvas",y="dt-device";let p=localStorage.getItem(z)==="1",r=localStorage.getItem(y)||"";r&&!x(r)&&(r="",localStorage.setItem(y,""));let i=Number(localStorage.getItem(I))||0;const ee="dt-emu";let d=(()=>{try{return JSON.parse(localStorage.getItem(ee)||"null")}catch{return null}})();const q=()=>d?le.find(e=>e.id===d.id)??null:null,ve=()=>{const e=q();return e?d.turned?{w:e.h,h:e.w}:{w:e.w,h:e.h}:null};let H=localStorage.getItem("dt-bars-min")==="1";const E=e=>{d=e,D(ee,e?JSON.stringify(e):"")},K=e=>{Z.textContent=e,m.style.setProperty("--dt-badge-w",`${Z.offsetWidth}px`)},te=e=>{if(!e){M.innerHTML="";return}let t="";for(let n=0;n<=e;n+=50)t+=`<span class="dt-tick${n%200===0?" is-major":""}" style="left:${n}px"></span>`;for(const n of v)for(const o of[n.min,n.max])o>0&&Number.isFinite(o)&&o<=e&&(t+=`<span class="dt-edge" style="left:${o}px" title="${n.label} edge"></span>`);M.innerHTML=t,M.style.width=`${e}px`},_=()=>{const e=parseFloat(s.style.width)||0,t=parseFloat(s.style.height)||0;if(!e||!t){s.style.transform="",delete s.dataset.scaled;return}const n=r||d?Math.min(1,(innerWidth-80)/e,(innerHeight-120)/t):Math.min(1,(innerWidth-80)/e);s.style.transform=n<1?`scale(${n})`:"",s.dataset.scaled=n<1?String(Math.round(n*100)):""},ge=e=>le.find(t=>t.w===e.w&&t.h===e.h&&t.cutout?.shape==="pill")?.cutout,A=()=>{try{return l.contentDocument}catch{return null}},ne=()=>A()?.title.split("\u2014").pop()?.trim()||"",G=()=>{const e=A(),t=r?x(r):null;if(!e?.body||!t)return;const n=Se(e),o=t.browser==="chrome-android"?n.theme||"rgb(255, 255, 255)":n.top,a=t.browser==="chrome-android"?"rgb(255, 255, 255)":n.bottom;s.style.setProperty("--dt-top",o),s.style.setProperty("--dt-top-ink",ie(o)),s.style.setProperty("--dt-bottom",a),s.style.setProperty("--dt-bottom-ink",ie(a));const c=w.querySelector(".dt-win-tab > span");c&&(c.textContent=ne()||location.host)};let R=0;l.addEventListener("load",()=>{A()&&(G(),l.contentWindow?.addEventListener("scroll",()=>{R||(R=requestAnimationFrame(()=>{R=0,G()}))},{passive:!0}))});for(const e of[w,B])e.addEventListener("click",t=>{const n=t.target.closest("[data-nav]")?.dataset.nav;if(n)try{const o=l.contentWindow?.navigation;if(!A()||!o)throw new Error("foreign");n==="back"?o.canGoBack&&o.back():n==="fwd"?o.canGoForward&&o.forward():o.reload()}catch{(n==="reload"||n==="back")&&(l.src=location.href)}});S.addEventListener("click",()=>{H=!H,D("dt-bars-min",H?"1":"0"),u()});const u=()=>{if(ue)return;const e=r?x(r)??null:null;if(r&&!e&&(r="",localStorage.setItem(y,"")),!e&&!p){m.hidden=!0,l.removeAttribute("src"),document.documentElement.classList.remove("dt-framing"),j.hidden=!C(),M.innerHTML="",k(),W.hidden=!0,S.hidden=!0,L(null),g="",pe(),k(),Y(),U();return}if(m.hidden=!1,document.documentElement.classList.add("dt-framing"),j.hidden=!0,l.src||(l.src=location.href),e){const t=Me(e,{host:location.host,title:ne(),now:new Date,min:H,cutout:ge(e)}),{screen:n}=t;m.dataset.mode="device",s.dataset.shell=e.shell,s.dataset.browser=e.browser,s.style.width=`${t.footprint.w}px`,s.style.height=`${t.footprint.h}px`,s.style.setProperty("--dt-r",`${n.r}px`),s.style.setProperty("--dt-rb",`${n.rb}px`),Q.innerHTML=t.shell;const o=(b,F,J,we)=>{b.innerHTML=we,b.style.cssText=`left:${n.x}px;top:${F}px;width:${n.w}px;height:${J}px`};o(w,n.y,t.topH,t.top),o(B,n.y+n.h-t.bottomH,t.bottomH,t.bottom);const a=n.h-t.topH-t.bottomH;l.style.position="absolute",l.style.left=`${n.x}px`,l.style.top=`${n.y+t.topH}px`,l.style.width=`${n.w}px`,l.style.height=`${a}px`,M.innerHTML="";const c=H&&t.canMinimize;T=t.scrollbar,g=`${e.label}${c?" \xB7 bars folded":""}`,L($(e.w)),P({notes:C(),scrollbar:T,device:g}),S.hidden=!t.canMinimize,S.setAttribute("aria-pressed",String(c)),K(`${e.label} \xB7 page ${e.w}\xD7${a} of ${e.w}\xD7${e.h}${c?" \xB7 bars folded":""} \xB7 ${v.find(b=>b.id===N())?.label??""}`),G()}else{const t=ve();t||E(null);const n=t?.w||i||v.find(c=>c.id===h()).ideal;i=n,m.dataset.mode="canvas",delete s.dataset.shell,delete s.dataset.browser,Q.innerHTML=w.innerHTML=B.innerHTML="",w.style.cssText=B.style.cssText="",S.hidden=!0,T="overlay",s.style.width=`${n}px`,s.style.height=`${t?.h??innerHeight-84}px`,l.style.position="",l.style.left=l.style.top="",l.style.width="100%",l.style.height="100%",te(n),P({notes:C()});const o=v.find(c=>c.id===$(n)),a=q();g=a?`${a.label}${d?.turned?" \xB7 landscape":""}`:"",P({scrollbar:T,device:g}),K(a&&t?`${a.label} \xB7 ${t.w}\xD7${t.h} \xB7 ${o.label}`:`${n}px \xB7 ${o.label}`),L($(n))}W.hidden=!(q()?.rotates&&!e),Y(),_(),k(),U()},oe=e=>{const t=v.find(n=>n.id===e);r="",localStorage.setItem(y,""),E(null),p=e!==fe,i=p?t.ideal:0,L(p?e:null),localStorage.setItem(z,p?"1":"0"),localStorage.setItem(I,String(i)),O(),u()};for(const e of me)e.addEventListener("click",()=>oe(e.dataset.bp));for(const e of document.querySelectorAll("[data-device]"))e.addEventListener("click",()=>{r=e.dataset.device===r?"":e.dataset.device,localStorage.setItem(y,r),f.open=!1,u()});for(const e of document.querySelectorAll("[data-emu]"))e.addEventListener("click",()=>{const t=d?.id===e.dataset.emu&&!r;r="",localStorage.setItem(y,""),E(t?null:{id:e.dataset.emu,turned:!1}),p=!t,i=0,localStorage.setItem(z,p?"1":"0"),L(null),O(),f.open=!1,u()});W.addEventListener("click",()=>{d&&(E({...d,turned:!d.turned}),O(),u())});const re=[...f.querySelectorAll("[data-tab]")],ye=[...f.querySelectorAll("[data-panel]")],se=e=>{for(const t of re)t.setAttribute("aria-selected",String(t.dataset.tab===e));for(const t of ye)t.hidden=t.dataset.panel!==e;D("dt-devices-tab",e)};for(const e of re)e.addEventListener("click",()=>se(e.dataset.tab));se(localStorage.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");const V=f.querySelector(".dt-emu-search");V.addEventListener("input",()=>{const e=V.value.trim().toLowerCase();let t=null,n=!1;const o=()=>{t&&(t.hidden=!n)};for(const a of V.parentElement.children){if(a.classList.contains("dt-devices-group")){o(),t=a,n=!1;continue}a.dataset.emu&&(a.hidden=!!e&&!a.textContent.toLowerCase().includes(e),n||=!a.hidden)}o()});const Ee=f.querySelector(".dt-devices-name");function Y(){for(const t of f.querySelectorAll("[data-device]"))t.setAttribute("aria-pressed",String(t.dataset.device===r));const e=!r&&!m.hidden?d?.id:void 0;for(const t of f.querySelectorAll("[data-emu]"))t.setAttribute("aria-pressed",String(t.dataset.emu===e));Ee.textContent=r&&x(r)?.label||e&&q()?.label||"Device"}const X=e=>v.find(t=>t.id===e),Le=e=>{const t=X(N()??h());return Math.max(t.min||320,Math.min(Number.isFinite(t.max)?t.max:2560,Math.round(e)))};for(const e of he){const t=e.dataset.edge==="l"?-1:1;e.addEventListener("pointerdown",n=>{if(r)return;n.preventDefault(),d&&(E(null),u()),e.setPointerCapture(n.pointerId);const o=n.clientX,a=i,c=Number(s.dataset.scaled||100)/100;m.dataset.dragging="1";const b=J=>{i=Le(a+t*(J.clientX-o)*2/c),s.style.width=`${i}px`,te(i),K(`${i}px \xB7 ${X($(i)).label}`),_()},F=()=>{e.removeEventListener("pointermove",b),e.removeEventListener("pointerup",F),delete m.dataset.dragging,localStorage.setItem(I,String(i)),u()};e.addEventListener("pointermove",b),e.addEventListener("pointerup",F)}),e.addEventListener("dblclick",()=>{if(r)return;E(null);const n=X(N()??h()),o=[n.min||320,Number.isFinite(n.max)?n.max:n.ideal];i=Math.abs(i-o[0])<Math.abs(i-o[1])?o[0]:o[1],localStorage.setItem(I,String(i)),u()})}let ae=h();return addEventListener("resize",()=>{k(),h()!==ae&&(ae=h(),be()),m.hidden||(!r&&!d&&(s.style.height=`${innerHeight-84}px`),_())}),{apply:u,pickBp:oe,look:()=>({scrollbar:T,device:g}),restore:()=>{p||r?u():Y()}}}export{$e as canvas};
|
package/src/client/config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{api as t}from"./api";async function i(){const n=await t("config");if(!n.ok)throw new Error(`config ${n.status}`);const r=await n.json();return r.breakpoints=r.breakpoints.map(e=>({...e,max:e.max??1/0})),r}export{i as loadConfig};
|
package/src/client/devices.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const v=t=>t.replace(/[&<>"]/g,s=>({"&":"&","<":"<",">":">",'"':"""})[s]),a={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},B=(t,s)=>t.toLocaleTimeString("en-US",s),k=t=>B(t,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),D={island:t=>({side:12,top:12,bottom:12,r:t.w>=430?62:55,body:t.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:t=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((t.w+32)*.12),extraH:18}),laptop:t=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((t.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function S(t,s,e,h,n){const i=t.w+2*s.side,b=t.h+s.top+s.bottom,c=(e-i)/2,d=`<rect class="dt-shell-screen" x="${n}" y="${s.top}" width="${t.w}" height="${t.h}" rx="${s.r}"/>`;let r="";if(t.shell==="island"||t.shell==="home"||t.shell==="punch"){const l=(p,m,o)=>`<rect class="dt-shell-btn" x="${p}" y="${m}" width="4" height="${o}" rx="2"/>`;r+=t.shell==="punch"?l(c+i-1,150,70)+l(c+i-1,240,44):l(c-3,120,28)+l(c-3,170,56)+l(c-3,236,56)+l(c+i-1,190,90),r+=`<rect class="dt-shell-body" x="${c}" y="0" width="${i}" height="${b}" rx="${s.body}"/>`,r+=`<rect class="dt-shell-bezel" x="${c+3}" y="3" width="${i-6}" height="${b-6}" rx="${s.body-3}"/>`,t.shell==="home"&&(r+=`<rect class="dt-shell-slot" x="${e/2-26}" y="44" width="52" height="6" rx="3"/>`,r+=`<circle class="dt-shell-slot" cx="${e/2-48}" cy="47" r="5"/>`,r+=`<circle class="dt-shell-homebtn" cx="${e/2}" cy="${b-46}" r="28"/>`)}else if(t.shell==="tablet")r+=`<rect class="dt-shell-body dt-shell-body--light" x="${c}" y="0" width="${i}" height="${b}" rx="${s.body}"/>`,r+=`<rect class="dt-shell-bezel" x="${c+4}" y="4" width="${i-8}" height="${b-8}" rx="${s.body-4}"/>`;else if(t.shell==="monitor"){const l=Math.round(i*.1);r+=`<path class="dt-shell-stand" d="M${e/2-l/2} ${b-2}h${l}l${l*.2} 84h${-l*1.4}z"/>`,r+=`<rect class="dt-shell-stand" x="${e/2-i*.15}" y="${b+80}" width="${i*.3}" height="14" rx="7"/>`,r+=`<rect class="dt-shell-body" x="${c}" y="0" width="${i}" height="${b}" rx="${s.body}"/>`}else{const l=i+(s.extraW??0),p=(e-l)/2,m=s.extraH??16;r+=`<path class="dt-shell-body" d="M${c} ${s.body}a${s.body} ${s.body} 0 0 1 ${s.body} ${-s.body}h${i-2*s.body}a${s.body} ${s.body} 0 0 1 ${s.body} ${s.body}V${b}H${c}z"/>`,r+=`<path class="dt-shell-base${t.shell==="macbook"?" dt-shell-base--silver":""}" d="M${p} ${b}h${l}v${m-8}a8 8 0 0 1-8 8H${p+8}a8 8 0 0 1-8-8z"/>`,r+=`<rect class="dt-shell-lip" x="${e/2-i*.07}" y="${b}" width="${i*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${e} ${h}" width="${e}" height="${h}" aria-hidden="true">${r}${d}</svg>`}const z={"safari-ios":t=>{const s=t.shell==="home"?20:t.w>=400?62:59;return{top:s,bottom:98,topMin:s,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},W=({d:t,now:s,cutout:e},h)=>{if(t.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${a.signal}${a.wifi}</span><b>${k(s)}</b><span class="dt-sb-r">${a.battery}</span></div>`;const n=e??{x:(t.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${n.x}px;top:${n.y}px;width:${n.width}px;height:${n.height}px"></span><b class="dt-sb-time" style="top:${n.y}px;height:${n.height}px">${k(s)}</b><span class="dt-sb-icons" style="top:${n.y}px;height:${n.height}px">${a.signal}${a.wifi}${a.battery}</span></div>`},F=({d:t,host:s,min:e},h)=>{const n=t.shell==="home"?"":'<i class="dt-home-ind"></i>';return e?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${v(s)}</span>${n}</div>`:`<div class="dt-ios-bar" style="height:${h}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back">${a.back}</button><span class="dt-glass dt-ios-url"><span>${v(s)}</span><button data-nav="reload">${a.reload}</button></span><span class="dt-glass dt-glass--round">${a.dots}</span></div>${n}</div>`},R=({now:t,min:s},e)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${B(t,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${a.wifi}${a.signal}${a.battery}</span></div>`+(s?"":`<div class="dt-and-bar"><span class="dt-and-url">${a.tune}<span>${v(e)}</span></span><span class="dt-and-tabs">1</span>${a.dotsV}</div>`),L=()=>`<div class="dt-and-nav">${a.recent}${a.home}${a.navBack}</div>`,T=({now:t,host:s})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${k(t)} ${t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${a.wifi}${a.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${a.sidebar}<button data-nav="back">${a.back}</button><button data-nav="fwd">${a.fwd}</button></span><span class="dt-ipad-url">${a.lock}<span>${v(s)}</span><button data-nav="reload">${a.reload}</button></span><span class="dt-bar-group">${a.share}${a.plus}${a.tabs}</span></div>`,V=({now:t,host:s},e)=>'<div class="dt-mac-menu"><span class="dt-mac-apps"><b>Safari</b><span>File</span><span>Edit</span><span>View</span><span>History</span><span>Bookmarks</span><span>Window</span><span>Help</span></span>'+(e?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${a.wifi}${a.battery}<span>${t.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${k(t)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${a.sidebar}<button data-nav="back">${a.back}</button><button data-nav="fwd">${a.fwd}</button></span><span class="dt-mac-url">${a.lock}<span>${v(s)}</span><button data-nav="reload">${a.reload}</button></span><span class="dt-bar-group">${a.share}${a.plus}${a.tabs}</span></div>`,E=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(t,s)=>`<i style="--hue:${s*40}"></i>`).join("")}</span></div>`,A=({host:t,title:s})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${v(s||t)}</span>${a.close}</span><span class="dt-win-new">${a.plus}</span><span class="dt-win-ctrl">${a.winMin}${a.winMax}${a.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back">${a.back}</button><button data-nav="fwd">${a.fwd}</button><button data-nav="reload">${a.reload}</button></span><span class="dt-win-url">${a.tune}<span>${v(t)}</span>${a.star}</span><span class="dt-bar-group">${a.user}${a.dotsV}</span></div>`,U=({now:t})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(s,e)=>`<i style="--hue:${200+e*30}"></i>`).join("")}</span><span class="dt-win-tray">${a.chevUp}${a.wifi}${a.volume}${a.battery}<span class="dt-win-clock">${B(t,{hour:"numeric",minute:"2-digit"})}<br>${t.toLocaleDateString("en-US")}</span></span></div>`;function j(t,s){const e=D[t.shell](t),h=t.w+2*e.side,n=t.h+e.top+e.bottom,i=h+(e.extraW??0),b=n+(t.shell==="monitor"||t.shell==="macbook"||t.shell==="laptop"?e.extraH??0:0),c=(i-h)/2+e.side,d=z[t.browser](t),r=s.min?d.topMin??d.top:d.top,l=s.min?d.bottomMin??d.bottom:d.bottom,p={...s,d:t};let m="",o="";switch(t.browser){case"safari-ios":m=W(p,r),o=F(p,l);break;case"chrome-android":m=R(p,s.host),o=L();break;case"safari-ipad":m=T(p),o='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":m=V(p,t.shell==="macbook"),o=E();break;case"chrome-windows":m=A(p),o=U(p);break}return{footprint:{w:i,h:b},screen:{x:c,y:e.top,w:t.w,h:t.h,r:e.r,rb:e.rb??e.r},topH:r,bottomH:l,shell:S(t,e,i,b,c),top:m,bottom:o,canMinimize:d.topMin!==void 0&&(d.topMin!==d.top||d.bottomMin!==d.bottom),scrollbar:t.browser==="chrome-windows"?"classic":"overlay"}}let g=null;function y(t){if(g??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!g||!t)return[0,0,0,0];g.clearRect(0,0,1,1),g.fillStyle="rgba(0, 0, 0, 0)",g.fillStyle=t,g.fillRect(0,0,1,1);const[s,e,h,n]=g.getImageData(0,0,1,1).data;return[s,e,h,n/255]}const w=([t,s,e])=>`rgb(${t}, ${s}, ${e})`;function O(t){const s=t.defaultView,e=o=>!o||y(o)[3]===0,h=[t.body,t.documentElement].map(o=>o&&s.getComputedStyle(o).backgroundColor).find(o=>o&&!e(o)),[n,i,b,c]=h?y(h):[255,255,255,1],d=[n,i,b].map(o=>Math.round(o*c+255*(1-c))),r=o=>{const[u,$,M,x]=y(o);if(x>=.75)return w([u,$,M]);const f=(C,H)=>Math.round(C*x+H*(1-x));return w([f(u,d[0]),f($,d[1]),f(M,d[2])])},l=o=>{let u=t.elementFromPoint(s.innerWidth/2,o);for(;u&&u!==t.documentElement;u=u.parentElement){const $=s.getComputedStyle(u);if($.position!=="fixed"&&$.position!=="sticky")continue;const M=u.getBoundingClientRect().width>=s.innerWidth*.9,x=$.backdropFilter&&$.backdropFilter!=="none";return M&&!x&&!e($.backgroundColor)?r($.backgroundColor):null}return null},p=t.querySelector('meta[name="theme-color"]')?.content||"",m=p&&!e(p)?w(y(p)):"";return{top:l(4)??w(d),bottom:l(s.innerHeight-4)??w(d),theme:m}}function q(t){const[s,e,h]=y(t).map(n=>n/255).map(n=>n<=.04045?n/12.92:((n+.055)/1.055)**2.4);return .2126*s+.7152*e+.0722*h>.4?"#000":"#fff"}export{j as drawDevice,q as inkFor,O as pageTints,y as rgbaOf};
|
package/src/client/field-menu.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const f=(u,a)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(i=>`<rect x="${.5+i*3}" y="${8.5-i*2.5}" width="2" height="${3+i*2.5}" rx="0.6" fill="${a}" stroke="none" opacity="${i<u?1:.28}"/>`).join("")}</svg>`;function g(u,a,i){const t=document.createElement("div");t.className="dt-field-menu",t.setAttribute("role","listbox"),t.hidden=!0,document.body.append(t);for(const n of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])t.addEventListener(n,s=>s.stopPropagation());let o=null;const d=()=>{t.hidden=!0,o=null};u.addEventListener("mousedown",n=>{const s=n.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!s){t.contains(n.target)||d();return}if(n.preventDefault(),o===s){d();return}o=s;const l=s.classList.contains("dt-more-select"),m=e=>l?e.dataset.on!=null:e.selected;t.innerHTML=[...s.options].map((e,p)=>e.hidden?"":`${e.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${p}" aria-selected="${m(e)}"${e.dataset.danger!=null?' class="is-danger"':""}>${e.dataset.icon?e.dataset.icon:e.dataset.initial!=null?e.dataset.face?`<img class="dt-face" src="${a(e.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${a(e.dataset.initial)}</b>`:`<i style="background:${a(e.dataset.c||"#717171")}"></i>`}<span>${a(e.text)}</span>${e.dataset.hint?`<small>${a(e.dataset.hint)}</small>`:""}${m(e)?i:""}</button>`).join("");const r=s.parentElement.getBoundingClientRect();t.style.left=`${r.left}px`,t.style.top=`${r.bottom+4}px`,t.style.minWidth=`${r.width}px`,t.hidden=!1;const c=t.getBoundingClientRect();c.bottom>innerHeight-8&&(t.style.top=`${r.top-4-c.height}px`),c.right>innerWidth-8&&(t.style.left=`${Math.max(8,r.right-c.width)}px`)}),t.addEventListener("click",n=>{const s=n.target.closest("[data-i]");if(!s||!o)return;const l=o;d(),!(l.selectedIndex===Number(s.dataset.i)&&!l.classList.contains("dt-more-select"))&&(l.selectedIndex=Number(s.dataset.i),l.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",n=>{n.key==="Escape"&&!t.hidden&&(n.stopPropagation(),d())},!0),document.addEventListener("pointerdown",n=>{!t.hidden&&!t.contains(n.target)&&!n.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&d()},!0),addEventListener("scroll",n=>{t.contains(n.target)||d()},!0)}export{f as bars,g as fieldMenus};
|
package/src/client/inspect.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function J(h){const p=o=>{const t=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,e=o/t;return Math.round(e*10)%10===0?String(Math.round(e)):e.toFixed(1)},d=(o,t,e,n,r,c="p")=>{if(e<=0||n<=0)return"";const a=r!==""?`<span class="dt-pad-chip dt-pad-chip--${c}" style="left:${o+e/2}px;top:${t+n/2}px">${r}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${c}" style="left:${o}px;top:${t}px;width:${e}px;height:${n}px"></span>${a}`},L=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],T=o=>{let t=o;for(let e=0;t&&e<6;e++,t=t.parentElement){const n=getComputedStyle(t);if(L.some(r=>parseFloat(n[r])>=2))return t}return o},B=(o,t)=>{const e=parseFloat(t.columnGap)||0,n=parseFloat(t.rowGap)||0;if(!(t.display.includes("flex")||t.display.includes("grid"))||!e&&!n)return"";const r=[...o.children].map(a=>a.getBoundingClientRect()).filter(a=>a.width||a.height);let c="";for(let a=1;a<r.length;a++){const s=r[a-1],l=r[a];if(e&&l.left>=s.right-1){const i=Math.max(s.top,l.top);c+=d(s.right,i,l.left-s.right,Math.min(s.bottom,l.bottom)-i,p(e),"g")}else if(n&&l.top>=s.bottom-1){const i=Math.min(s.left,l.left);c+=d(i,s.bottom,Math.max(s.right,l.right)-i,l.top-s.bottom,p(n),"g")}}return c},x=o=>`<span class="dt-pad-outline" style="left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px"></span>`,f=(o,t,e="")=>`<span class="dt-pad-tag" style="left:${t.left}px;top:${Math.max(2,t.top-22)}px">${o.tagName.toLowerCase()+(o.classList[0]?"."+o.classList[0]:"")}${e}</span>`,A=o=>{const t=o.getBoundingClientRect(),e=getComputedStyle(o),n=parseFloat(e.paddingTop),r=parseFloat(e.paddingRight),c=parseFloat(e.paddingBottom),a=parseFloat(e.paddingLeft);let s=x(t);s+=d(t.left,t.top,t.width,n,n>=2?p(n):""),s+=d(t.left,t.bottom-c,t.width,c,c>=2?p(c):""),s+=d(t.left,t.top+n,a,t.height-n-c,a>=2?p(a):""),s+=d(t.right-r,t.top+n,r,t.height-n-c,r>=2?p(r):"");const l=parseFloat(e.marginTop),i=parseFloat(e.marginRight),m=parseFloat(e.marginBottom),g=parseFloat(e.marginLeft);s+=d(t.left,t.top-l,t.width,l,l>=2?p(l):"","m"),s+=d(t.left,t.bottom,t.width,m,m>=2?p(m):"","m"),s+=d(t.left-g,t.top,g,t.height,g>=2?p(g):"","m"),s+=d(t.right,t.top,i,t.height,i>=2?p(i):"","m"),s+=B(o,e);const u=parseFloat(e.columnGap)||0,y=parseFloat(e.rowGap)||0,Z=(e.display.includes("flex")||e.display.includes("grid"))&&(u||y)?` \xB7 gap ${p(u)}${y&&y!==u?"/"+p(y):""}`:"";h.innerHTML=s+f(o,t,Z)},H=o=>{const t=o.getBoundingClientRect();h.innerHTML=x(t)+`<span class="dt-pad-chip" style="left:${t.left+t.width/2}px;top:${t.top+t.height/2}px">${p(t.width)} \xD7 ${p(t.height)}</span>`+f(o,t)},S=o=>{const t=(o.match(/[\d.]+/g)||[]).map(Number);if(t.length<3)return o;const e="#"+t.slice(0,3).map(n=>Math.round(n).toString(16).padStart(2,"0")).join("");return t[3]!==void 0&&t[3]<1?`${e} \xB7 ${Math.round(t[3]*100)}%`:e};let w=null;const W=()=>{if(w)return w;const o=getComputedStyle(document.documentElement),t=document.createElement("span");t.style.display="none",document.body.append(t);const e=[];for(const n of Array.from(o)){if(!n.startsWith("--"))continue;const r=o.getPropertyValue(n).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(r))continue;t.style.color="rgb(1, 2, 3)",t.style.color=r;const c=getComputedStyle(t).color;c&&c!=="rgb(1, 2, 3)"&&e.push([c,n])}return t.remove(),e.sort((n,r)=>n[1].length-r[1].length),w=e,e},G=o=>W().find(([t])=>t===o)?.[1]??"";let C=null;const V=()=>{if(C)return C;const o=[],t=e=>{for(const n of Array.from(e))n instanceof CSSStyleRule?n.style.cssText.includes("var(--")&&o.push({sel:n.selectorText,style:n.style}):n instanceof CSSMediaRule?matchMedia(n.conditionText).matches&&t(n.cssRules):"cssRules"in n&&t(n.cssRules)};for(const e of Array.from(document.styleSheets))try{t(e.cssRules)}catch{}return C=o},D={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(o=>[`border-${o}-color`,[`border-${o}-color`,"border-color",`border-${o}`,"border"]]))},N=(o,t)=>{const e=D[t]??[t],n=t==="color";for(let r=o;r;r=n?r.parentElement:null){const c=l=>e.map(i=>/var\(\s*(--[\w-]+)/.exec(l.getPropertyValue(i))?.[1]).find(Boolean),a=r instanceof HTMLElement?c(r.style):void 0;if(a)return a;let s="";for(const l of V()){let i=!1;try{i=r.matches(l.sel)}catch{}i&&(s=c(l.style)||s)}if(s)return s;if(n&&r.parentElement&&getComputedStyle(r).color!==getComputedStyle(r.parentElement).color)break}return""},b=(o,t,e)=>{const n=N(o,t);if(n)return`<b class="dt-var">${n}</b> <em>${S(e)}</em>`;const r=G(e);return r?`<span title="Same value as ${r}; not written with it">\u2248 ${r}</span> <em>${S(e)}</em>`:S(e)},$=o=>`<i class="dt-type-sw" style="background:${o}"></i>`,P={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},R=o=>(o.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),E=(o,t)=>o.slice(0,3).map((e,n)=>e*o[3]+t[n]*(1-o[3])).concat([1]),z=o=>{const t=[];for(let e=o;e;e=e.parentElement){const n=getComputedStyle(e);if(n.backgroundImage!=="none")return null;const r=R(n.backgroundColor);if(r[3]>0&&(t.push(r),r[3]>=1))break}return t.reduceRight((e,n)=>E(n,e),[255,255,255,1])},M=o=>{const[t,e,n]=o.slice(0,3).map(r=>(r/=255,r<=.03928?r/12.92:((r+.055)/1.055)**2.4));return .2126*t+.7152*e+.0722*n},I=(o,t,e)=>{const n=z(o);if(!n)return["Contrast","<em>on an image</em>"];const r=E(R(t.color),n),[c,a]=[M(r),M(n)].sort((m,g)=>g-m),s=(c+.05)/(a+.05),l=e>=24||e>=18.66&&Number(t.fontWeight)>=700,i=s>=(l?4.5:7)?"AAA":s>=(l?3:4.5)?"AA":"fails AA";return["Contrast",`${s.toFixed(2)}:1 <em class="${i==="fails AA"?"dt-type-bad":""}">${i}${l?" \xB7 large":""}</em>`]},j=o=>{const t=o.getBoundingClientRect(),e=getComputedStyle(o),n=parseFloat(e.fontSize),r=e.lineHeight==="normal"?0:parseFloat(e.lineHeight),c=parseFloat(e.letterSpacing)||0,a=g=>`${(g*100).toFixed(1).replace(/\.0$/,"")}%`,s=[["Font",e.fontFamily.split(",")[0].replace(/["']/g,"")+(e.fontStyle!=="normal"?` ${e.fontStyle}`:"")],["Weight",`${P[e.fontWeight]??""} <em>${e.fontWeight}</em>`],["Size",`${p(n)}px`],["Line",r?`${a(r/n)} <em>${p(r)}px</em>`:"normal"],["Letter",c?`${a(c/n)} <em>${c.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",$(e.color)+b(o,"color",e.color)],I(o,e,n)],i=t.bottom+150<innerHeight?t.bottom+8:Math.max(8,t.top-158),m=Math.min(Math.max(8,t.left),innerWidth-210);h.innerHTML=x(t)+f(o,t)+`<div class="dt-type-card" style="left:${m}px;top:${i}px">${s.map(([g,u])=>`<span class="dt-type-row"><b>${g}</b><span>${u}</span></span>`).join("")}</div>`},F=o=>o.every(t=>t===o[0])?o[0]:o[1]===o[3]&&o[0]===o[2]?`${o[0]} ${o[1]}`:o.join(" "),O=o=>/^rgba\(.*,\s*0\)$|^transparent$/.test(o),k=(o,t,e,n="")=>{const r=16+e.length*18,a=t.bottom+r+12<innerHeight?t.bottom+8:Math.max(8,t.top-r-8),s=Math.min(Math.max(8,t.left),innerWidth-230);h.innerHTML=`<span class="dt-pad-outline" style="left:${t.left}px;top:${t.top}px;width:${t.width}px;height:${t.height}px${n?`;border-radius:${n}`:""}"></span>`+f(o,t)+`<div class="dt-type-card dt-style-card" style="left:${s}px;top:${a}px">${e.map(([l,i])=>`<span class="dt-type-row"><b>${l}</b><span>${i}</span></span>`).join("")}</div>`};return{spacer:T,drawPads:A,drawSize:H,drawType:j,drawColor:o=>{const t=getComputedStyle(o),e=[];t.backgroundImage!=="none"&&e.push(["Fill",`<em>${/gradient/.test(t.backgroundImage)?"gradient":"image"}</em>`]),O(t.backgroundColor)||e.push(["Fill",$(t.backgroundColor)+b(o,"background-color",t.backgroundColor)]),o.textContent?.trim()&&e.push(["Text",$(t.color)+b(o,"color",t.color)]),Number(t.opacity)<1&&e.push(["Opacity",`${Math.round(Number(t.opacity)*100)}%`]),e.length||e.push(["Color","<em>no fill or text</em>"]),k(o,o.getBoundingClientRect(),e)},drawBorder:o=>{const t=getComputedStyle(o),e=[],n=["top","right","bottom","left"],r=n.map(a=>parseFloat(t.getPropertyValue(`border-${a}-width`))||0);if(r.some(a=>a>0)){const a=n.filter((l,i)=>r[i]>0);e.push(["Width",`${F(r.map(p))} <em>${t.getPropertyValue(`border-${a[0]}-style`)}</em>`]);const s=a.map(l=>t.getPropertyValue(`border-${l}-color`));a.forEach((l,i)=>{i&&s[i]===s[0]||e.push([i?`\u21B3 ${l}`:"Color",$(s[i])+b(o,`border-${l}-color`,s[i])])})}else e.push(["Width","<em>none</em>"]);const c=["top-left","top-right","bottom-right","bottom-left"].map(a=>{const[s,l=s]=t.getPropertyValue(`border-${a}-radius`).split(" "),i=m=>m.endsWith("%")?m:p(parseFloat(m)||0);return s===l?i(s):`${i(s)}/${i(l)}`});e.push(["Radius",F(c)]),k(o,o.getBoundingClientRect(),e,t.borderRadius)}}}export{J as inspectors};
|
package/src/client/logs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{mask as w}from"../store/mask.mjs";const a=[],c=e=>{if(e instanceof Error)return`${e.name}: ${e.message}`;if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}},s=(e,i)=>{a.push({at:new Date().toISOString(),kind:e,text:w(i.replace(/\s+/g," ").trim()).slice(0,500)}),a.length>50&&a.shift()};let g=!1;function d(e){if(g||typeof window>"u")return;g=!0;const i=console.error;console.error=(...t)=>{s("console",t.map(c).join(" ")),i.apply(console,t)},addEventListener("error",t=>{if(t instanceof ErrorEvent)return s("error",`${t.message}${t.filename?` (${t.filename}:${t.lineno})`:""}`);const n=t.target,r=n?.src||n?.href;r&&!e(r)&&s("network",`${n.tagName?.toLowerCase()} ${r} did not load`)},!0),addEventListener("unhandledrejection",t=>s("rejection",c(t.reason)));const l=window.fetch;window.fetch=async(t,n)=>{const r=typeof t=="string"?t:t instanceof URL?t.href:t.url,f=(n?.method||(t instanceof Request?t.method:"GET")).toUpperCase();try{const o=await l.call(window,t,n);return o.status>=400&&!e(r)&&s("network",`${f} ${r} \u2192 ${o.status}`),o}catch(o){throw!e(r)&&o?.name!=="AbortError"&&s("network",`${f} ${r} \u2192 no answer (${c(o)})`),o}};const u=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(t,n,...r){return this._nm=`${t.toUpperCase()} ${String(n)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(e(String(n))||s("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),u.call(this,t,n,...r)}}const p=(e=Date.now())=>a.filter(i=>e-Date.parse(i.at)<10*6e4).slice(-20);export{p as recentLogs,d as watchLogs};
|
package/src/client/markup.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import{DEVTOOLS_DEVICES as b,DEVTOOLS_GROUPS as m}from"../devtools-devices.mjs";import{AI_BOX as l,AI_RAYS as g,AI_RAYS_CW as $}from"../store/thread.mjs";const s=t=>t.replace(/[&<>"]/g,d=>({"&":"&","<":"<",">":">",'"':"""})[d]),M=t=>t?new Date(t).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",x='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',f='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',k='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',j='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.4 5.4l9.2 9.2M14.6 5.4l-9.2 9.2"/></svg>',B='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M12 5l-5 5 5 5" stroke-linejoin="round"/></svg>',C='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',S='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.5 8.5h7.5a3.5 3.5 0 0 1 0 7H8.5M7.5 5.5l-3 3 3 3" stroke-linejoin="round"/></svg>',A=t=>`<svg viewBox="${l}" width="${t}" height="${t}" aria-hidden="true" class="dt-claude"><path d="${g}" stroke-width="1.15" stroke-linecap="round"/></svg>`,D=(t,d)=>`<svg viewBox="${l}" width="${t}" height="${t}" aria-hidden="true" class="dt-claude dt-claude--fill">${$.map((n,o)=>`<path d="${n}" stroke-width="1.15" stroke-linecap="round"${o<d?"":' class="is-off"'}/>`).join("")}</svg>`,i=(t,d=15)=>`<svg viewBox="0 0 20 20" width="${d}" height="${d}" aria-hidden="true">${t}</svg>`;function T(t){const d=location.pathname.replace(/\/$/,"")||"/",n=t.client?' style="display:none"':"",o=t.breakpoints.map(a=>["new","progress","review","waiting","accepted","done"].map(e=>`<b data-bp="${s(a.id)}" data-state="${e}" hidden>${i(a.icon,11)}<i></i></b>`).join("")).join(""),h=t.groups.map(a=>`<li class="dt-pages-group">${s(a)}</li>`+t.pages.filter(e=>e.group===a).map(e=>`<li><a href="${/^\/(?![\/\\])/.test(e.route)?s(e.route):"#"}"${e.route===d?' aria-current="page"':""}><span class="dt-menu-label">${s(e.label)}</span><em class="dt-pages-n" hidden>${o}</em></a></li>`).join("")).join(""),p=[...new Set(t.devices.map(a=>a.group))].map(a=>`<p class="dt-devices-group">${s(a)}</p>`+t.devices.filter(e=>e.group===a).map(e=>`<button type="button" data-device="${s(e.id)}" aria-pressed="false"${e.note?` title="${s(e.note)}"`:""}><span class="dt-menu-label">${s(e.label)}</span><em>${e.w}×${e.h}</em></button>`).join("")).join(""),c=m.map(a=>`<p class="dt-devices-group">${s(a)}</p>`+b.filter(e=>e.group===a).map(e=>`<button type="button" data-emu="${s(e.id)}" aria-pressed="false"><span class="dt-menu-label">${s(e.label)}</span><em>${e.w}×${e.h}</em></button>`).join("")).join(""),u=t.breakpoints.map(a=>`<button class="dt-icon dt-bp" type="button" data-bp="${s(a.id)}" aria-pressed="false" title="${s(a.label)}">${i(a.icon,16)}</button>`).join(""),v=Array.from({length:t.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),r="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
|
-
<!-- One bar, bottom-centre: pages | inspectors | comments | breakpoints \xB7 devices. -->
|
|
3
|
-
<div class="devtools">
|
|
4
|
-
${t.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(t.brand.logo)?`<img class="dt-brand" src="${s(t.brand.logo)}" alt="" />`:""}
|
|
5
|
-
<div class="dt-group dt-group--menus">
|
|
6
|
-
<details class="dt-pages" name="dt-menu">
|
|
7
|
-
<summary aria-label="Pages" title="Pages">
|
|
8
|
-
${i('<rect x="4.5" y="2.5" width="11" height="15" rx="1.5" /><path d="M7.5 6.6h5M7.5 10h5M7.5 13.4h3" />')}
|
|
9
|
-
<span class="dt-pages-name">${s(d)}</span>
|
|
10
|
-
</summary>
|
|
11
|
-
<ul>${h}</ul>
|
|
12
|
-
</details>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<div class="dt-group" role="group" aria-label="Inspect"${n}>
|
|
16
|
-
<button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
|
|
17
|
-
${i('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
|
|
18
|
-
</button>
|
|
19
|
-
<button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
|
|
20
|
-
${i('<rect x="2.5" y="2.5" width="15" height="15" rx="1.5" /><rect x="6.5" y="6.5" width="7" height="7" rx="1" stroke-dasharray="2 2" />')}
|
|
21
|
-
</button>
|
|
22
|
-
<button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
|
|
23
|
-
${i('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
|
|
24
|
-
</button>
|
|
25
|
-
<button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
|
|
26
|
-
${i('<path d="M2.5 15.5 6.5 5l4 10.5M3.9 12.6h5.2M15 4.5v11M13.2 6.3 15 4.5l1.8 1.8M13.2 13.7 15 15.5l1.8-1.8" />')}
|
|
27
|
-
</button>
|
|
28
|
-
<button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
|
|
29
|
-
${i('<path d="M10 3c2.9 3.4 4.6 5.9 4.6 8.2a4.6 4.6 0 0 1-9.2 0C5.4 8.9 7.1 6.4 10 3z" />')}
|
|
30
|
-
</button>
|
|
31
|
-
<button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
|
|
32
|
-
${i('<path d="M3.5 16.5V8a4.5 4.5 0 0 1 4.5-4.5h8.5" /><path d="M16.5 8v8.5H8" stroke-dasharray="1.6 2.2" />')}
|
|
33
|
-
</button>
|
|
34
|
-
<button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${t.sanity?"":" hidden"}>
|
|
35
|
-
${i('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
|
|
36
|
-
</button>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<div class="dt-group" role="group" aria-label="Comments">
|
|
40
|
-
<button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
|
|
41
|
-
${i('<path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z" stroke-linejoin="round" />')}
|
|
42
|
-
<span class="dt-notes-count" hidden></span>
|
|
43
|
-
</button>
|
|
44
|
-
<button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
|
|
45
|
-
${i('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
|
|
46
|
-
</button>
|
|
47
|
-
<!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
|
|
48
|
-
<button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
|
|
49
|
-
${i('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
|
|
50
|
-
</button>
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<div class="dt-group dt-bps" role="group" aria-label="Breakpoint">${u}</div>
|
|
54
|
-
|
|
55
|
-
<div class="dt-group dt-group--menus">
|
|
56
|
-
<details class="dt-devices" name="dt-menu">
|
|
57
|
-
<summary title="Devices">
|
|
58
|
-
${i('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
|
|
59
|
-
<span class="dt-devices-name">Device</span>
|
|
60
|
-
</summary>
|
|
61
|
-
<div class="dt-devices-menu">
|
|
62
|
-
<div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
|
|
63
|
-
<button type="button" role="tab" data-tab="preview" aria-selected="true">Preview</button>
|
|
64
|
-
<button type="button" role="tab" data-tab="devtools" aria-selected="false">DevTools</button>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
67
|
-
<p class="dt-menu-note">The screens most visitors use, with the browser around the page. Comments go to the breakpoint its width falls in, with the device named.</p>
|
|
68
|
-
${p}
|
|
69
|
-
</div>
|
|
70
|
-
<div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
|
|
71
|
-
<p class="dt-menu-note">Opens the canvas at the device's size. Comments go to its breakpoint.</p>
|
|
72
|
-
<input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
|
|
73
|
-
${c}
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</details>
|
|
77
|
-
<!-- the list is written by the script, from the same table that runs the keys -->
|
|
78
|
-
<details class="dt-keys" name="dt-menu"${t.shortcuts?"":" hidden"}>
|
|
79
|
-
<summary class="dt-icon" title="Shortcuts">
|
|
80
|
-
${i('<rect x="2" y="5" width="16" height="10" rx="2" /><path d="M5.5 8.5h.01M8.5 8.5h.01M11.5 8.5h.01M14.5 8.5h.01M6.5 12h7" />')}
|
|
81
|
-
</summary>
|
|
82
|
-
<div class="dt-keys-menu"></div>
|
|
83
|
-
</details>
|
|
84
|
-
</div>
|
|
85
|
-
<!-- turbo: its own round button beside the bar, always there for the studio \u2014 lit while
|
|
86
|
-
an agent session takes comments, grey when none is listening or it is paused here -->
|
|
87
|
-
<button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${t.client?" hidden":""}>
|
|
88
|
-
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${i('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
|
|
89
|
-
</button>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<!-- The handle under the bar, on the window's bottom edge. Its own element, not the
|
|
93
|
-
bar's child: it stays put while the bar slides away. -->
|
|
94
|
-
<button class="dt-tab" type="button" aria-expanded="true" aria-label="Hide the bar">
|
|
95
|
-
<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M5.5 8 10 12.5 14.5 8" /></svg>
|
|
96
|
-
</button>
|
|
97
|
-
|
|
98
|
-
<div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
|
|
99
|
-
<div class="dt-stage">
|
|
100
|
-
<span class="dt-frame-handle" data-edge="l" title="${r}"></span>
|
|
101
|
-
<div class="dt-device">
|
|
102
|
-
<div class="dt-shell"></div>
|
|
103
|
-
<iframe title="Breakpoint preview"></iframe>
|
|
104
|
-
<div class="dt-chrome" data-at="top"></div>
|
|
105
|
-
<div class="dt-chrome" data-at="bottom"></div>
|
|
106
|
-
</div>
|
|
107
|
-
<span class="dt-frame-handle" data-edge="r" title="${r}"></span>
|
|
108
|
-
</div>
|
|
109
|
-
<div class="dt-ruler"></div>
|
|
110
|
-
<span class="dt-frame-size"></span>
|
|
111
|
-
<button class="dt-frame-bars dt-frame-btn" type="button" hidden title="Browser bars: shown / folded on scroll">
|
|
112
|
-
<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3v14M6.5 6.5 10 3l3.5 3.5M6.5 13.5 10 17l3.5-3.5" /></svg>
|
|
113
|
-
</button>
|
|
114
|
-
<button class="dt-frame-rotate dt-frame-btn" type="button" hidden title="Rotate">
|
|
115
|
-
<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M14.5 5.5A6.5 6.5 0 1 0 16.5 10" /><path d="M16.8 3.6v3.4h-3.4" /></svg>
|
|
116
|
-
</button>
|
|
117
|
-
</div>
|
|
118
|
-
|
|
119
|
-
<aside class="dt-history" hidden aria-label="Comment history"></aside>
|
|
120
|
-
<div class="dt-notes-hi" hidden aria-hidden="true"><span class="dt-hi-box"></span><span class="dt-hi-tag"></span></div>
|
|
121
|
-
<div class="dt-notes-overlay" hidden role="region" aria-label="Comments on this page"></div>
|
|
122
|
-
<div class="dt-grid-overlay" hidden aria-hidden="true">
|
|
123
|
-
<div class="${s(t.grid.container)} dt-overlay-container">
|
|
124
|
-
<div class="${s(t.grid.grid)} dt-overlay-grid">${v}</div>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
<div class="dt-pad-overlay" hidden aria-hidden="true"></div>
|
|
128
|
-
`)}export{D as AGENT_MARK,A as CLAUDE_MARK,j as CROSS,C as NEXT,k as PENCIL,B as PREV,f as TICK,x as TRASH,S as UNDO,s as esc,T as mount,M as stamp};
|
package/src/client/panel.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import{categoryOf as P}from"../store/categories.mjs";import{stateOf as l,STATE_LABEL as U}from"../store/status.mjs";import{agentName as H}from"../store/thread.mjs";import{CLAUDE_MARK as K,CROSS as G,PENCIL as _,TICK as R,TRASH as C,esc as i,stamp as V}from"./markup";const N='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg>',z='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Z(a){const{bp:h,notes:m,breakpoints:$,bandOfNote:v,whoseAgent:w,statusTools:S,showResolved:f,drafts:p,find:s}=a,g=m.filter(t=>v(t)===h),B=new Map(g.map((t,e)=>[t.id,e+1])),M=t=>[t.text,t.note,t.byName,...(t.replies??[]).filter(e=>!e.deleted).map(e=>e.text)].join(" ").toLowerCase(),q=t=>s.view==="me"?a.forMe(t):s.view==="agent"?a.forAgent(t):!0,y=t=>Date.parse(t.updatedAt||t.createdAt||"")||0,D=g.filter(t=>q(t)&&(!s.q||M(t).includes(s.q.trim().toLowerCase()))).sort((t,e)=>(s.sort==="unread"?Number(a.unread(e))-Number(a.unread(t)):0)||y(e)-y(t)),o={open:[],claude:[],done:[]};for(const t of D)o[l(t)].push(t);const E=t=>{const e=(t.replies??[]).filter(I=>!I.deleted),n=e.length+(t.note?1:0),c=P(t.category),d=l(t),j=d==="claude",A=a.orphan(t),u=e.length?e[e.length-1]:t.note?{author:"claude",text:t.note}:{author:"you",text:t.text};return`<div class="dt-hist-row is-${d}${A?" is-orphan":""}">
|
|
2
|
-
<button class="dt-hist-go" data-go="${t.id}">
|
|
3
|
-
${a.marker(t)}
|
|
4
|
-
<span class="dt-hist-body">
|
|
5
|
-
<span class="dt-hist-id">#${B.get(t.id)}<em>${c.label}</em>${j?`<b class="dt-hist-claude" data-unmark="${t.id}" role="button" tabindex="0" title="Resolved by ${i(w(t.doneAgent,t.doneFor))} \u2014 click to clear: back to open">${K(9)}${i(H(t.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${A?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
|
|
6
|
-
<span class="dt-hist-text">${u.author==="claude"?`<b>${i(w(u.agent,u.by))}:</b> `:""}${i(u.text)}</span>
|
|
7
|
-
<span class="dt-hist-meta">${V(t.updatedAt||t.createdAt)}${t.device?` \xB7 ${i(t.device)}`:t.browser?` \xB7 ${i(t.browser)}`:""}${n?` \xB7 ${n} repl${n===1?"y":"ies"}`:""}</span>
|
|
8
|
-
</span>
|
|
9
|
-
</button>
|
|
10
|
-
<span class="dt-note-tools dt-hist-tools">${S(t)}<i class="dt-note-sep"></i
|
|
11
|
-
><button data-rm="${t.id}" title="Delete this comment">${C}</button></span>
|
|
12
|
-
</div>`},x=$.find(t=>t.id===h),T=$.map(t=>{const e=m.filter(n=>v(n)===t.id&&l(n)!=="done");return{band:t,open:e.filter(n=>l(n)==="open").length,total:e.length}}).filter(t=>t.total&&t.band.id!==h),F=T.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${T.map(({band:t,open:e,total:n})=>`<button data-bp="${t.id}" data-state="${e?"open":"claude"}"
|
|
13
|
-
title="${t.label}: ${e} open \xB7 ${n-e} to check"
|
|
14
|
-
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${t.icon}</svg><i>${n}</i></button>`).join("")}</div>`:"",k=["open","claude","done"].filter(t=>o[t].length&&(t!=="done"||f)),O=t=>`<div class="dt-hist-row is-draft">
|
|
15
|
-
<button class="dt-hist-go" data-draft-go="${t.i}">
|
|
16
|
-
<span class="dt-hist-n">${_}</span>
|
|
17
|
-
<span class="dt-hist-body">
|
|
18
|
-
<span class="dt-hist-id">${i(t.el)}${t.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
|
|
19
|
-
<span class="dt-hist-text">${t.text?i(t.text):`${t.shots} screenshot${t.shots===1?"":"s"}`}</span>
|
|
20
|
-
</span>
|
|
21
|
-
</button>
|
|
22
|
-
<span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${t.i}" title="Discard this draft">${C}</button></span>
|
|
23
|
-
</div>`,b=g.filter(t=>l(t)!=="done"),r=(t,e,n,c,d)=>`<button type="button" role="menuitemradio" aria-checked="${c}" ${t}="${e}"><i>${c?R:""}</i><span>${n}</span>${d==null?"":`<em>${d}</em>`}</button>`,L=()=>`<div class="dt-hist-find">
|
|
24
|
-
<label class="dt-hist-search">${N}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${i(s.q)}" spellcheck="false">${s.q?`<button type="button" data-hist-clear aria-label="Clear search">${G}</button>`:""}</label>
|
|
25
|
-
<button type="button" class="dt-hist-filter${s.view!=="all"||s.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${s.menu}" data-tip="Filter">${z}</button>
|
|
26
|
-
${s.menu?`<div class="dt-hist-menu" role="menu">${r("data-hist-view","me","For me",s.view==="me",b.filter(a.forMe).length)}${r("data-hist-view","agent","Agent",s.view==="agent",b.filter(a.forAgent).length)}${r("data-hist-view","all","All",s.view==="all",b.length)}<hr>${r("data-hist-sort","new","Newest",s.sort==="new")}${r("data-hist-sort","unread","Unread first",s.sort==="unread")}</div>`:""}
|
|
27
|
-
</div>`;return`<div class="dt-hist-head">
|
|
28
|
-
<span class="dt-hist-here" title="${x?.label??h}"
|
|
29
|
-
><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${x?.icon??""}</svg></span>
|
|
30
|
-
<span class="dt-hist-title">Comments</span>
|
|
31
|
-
${F}
|
|
32
|
-
${a.checks?`<button class="dt-review-btn" data-review aria-label="Check all ${a.checks} ${a.checks===1?"fix":"fixes"}" data-tip="${a.checks} ${a.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${R}${a.checks}</button>`:""}
|
|
33
|
-
<button class="dt-hist-refresh" data-refresh aria-label="Reload comments from the file">
|
|
34
|
-
<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M16 10a6 6 0 1 1-1.8-4.3"/><path d="M16.3 3.4v3.4h-3.4"/></svg>
|
|
35
|
-
</button>
|
|
36
|
-
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel">
|
|
37
|
-
<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.5 8.5 10 12.5l4.5-4"/></svg>
|
|
38
|
-
</button>
|
|
39
|
-
</div>`+L()+(k.length||p.length?`<div class="dt-hist-list">${p.length?`<p class="dt-hist-group">Drafts<em>${p.length}</em></p>${p.map(O).join("")}`:""}${k.map(t=>`<p class="dt-hist-group">${U[t]}<em>${o[t].length}</em></p>`+o[t].map(E).join("")).join("")}</div>`:s.q.trim()?`<div class="dt-hist-empty">${N}<p>No comments match \xAB${i(s.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:s.view!=="all"?'<div class="dt-hist-empty"><p>Nothing in this view at this breakpoint.</p><button data-hist-view="all">Show all</button></div>':`<p class="dt-hist-empty">${o.done.length?"Everything here is resolved.":"No comments at this breakpoint yet. Click anything on the page to leave one."}</p>`)+`<div class="dt-hist-foot">
|
|
40
|
-
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${f}"
|
|
41
|
-
><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="10" r="7.5"/><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round"/></svg
|
|
42
|
-
><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
43
|
-
</div>`}export{Z as historyHtml};
|
package/src/client/review.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{stateOf as l}from"../store/status.mjs";import{CROSS as E,NEXT as R,PREV as S,TICK as T,UNDO as x}from"./markup";function $(g){const{inFrame:f,everything:a,route:u,open:h,settle:v,keepIn:k,toast:w}=g,c="nm-review",o=()=>{try{return JSON.parse(sessionStorage.getItem(c)||"null")}catch{return null}},s=e=>{try{e?sessionStorage.setItem(c,JSON.stringify(e)):sessionStorage.removeItem(c)}catch{}},r=document.createElement("div");r.className="dt-review",r.setAttribute("role","region"),r.setAttribute("aria-label","Checking fixes"),r.hidden=!0,k(r),f||document.body.append(r);const m=()=>a().filter(e=>l(e)==="claude"),y=()=>{const e=m().sort((t,i)=>+(i.route===u())-+(t.route===u())||String(t.route).localeCompare(String(i.route))||t.id-i.id).map(t=>t.id);e.length&&(s({ids:e,i:0}),d())},d=()=>{const e=o();if(!e||f){r.hidden=!0;return}for(;e.i<e.ids.length&&l(a().find(n=>n.id===e.ids[e.i])??{status:"done"})!=="claude";)e.i++;if(e.i>=e.ids.length){s(null),r.hidden=!0,w("Every fix is checked.");return}s(e);const t=a().find(n=>n.id===e.ids[e.i]);if(t.route&&t.route!==u()){location.assign(t.route+location.search);return}h(t);const i=e.ids.slice(0,e.i).some(n=>l(a().find(p=>p.id===n)??{status:"done"})==="claude");r.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
|
|
2
|
-
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${i?"":" disabled"}>${S}</button>
|
|
3
|
-
<span class="dt-review-n">${e.i+1} of ${e.ids.length}</span>
|
|
4
|
-
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${R}</button></span>
|
|
5
|
-
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${T}</button>
|
|
6
|
-
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${x}</button>
|
|
7
|
-
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${E}</button>`,r.hidden=!1};r.addEventListener("click",async e=>{const t=e.target.closest("[data-r]"),i=o();if(!t||!i)return;if(t.dataset.r==="stop"){s(null),r.hidden=!0;return}if(t.dataset.r==="prev"){b();return}const n=i.ids[i.i];s({...i,i:i.i+1});const p=t.dataset.r==="ok"?v(n,!0):t.dataset.r==="no"?v(n,!1):null;d(),await p});const b=()=>{const e=o();if(e){for(let t=e.i-1;t>=0;t--)if(l(a().find(i=>i.id===e.ids[t])??{status:"done"})==="claude"){s({...e,i:t}),d();return}}};return document.addEventListener("keydown",e=>{r.hidden||e.metaKey||e.ctrlKey||e.altKey||e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.target.closest?.("input, textarea, select, [contenteditable]")||(e.preventDefault(),e.key==="ArrowLeft"?b():r.querySelector('[data-r="skip"]')?.click())}),{start:y,toCheck:m,resume:()=>{o()&&d()}}}export{$ as review};
|