grab 0.1.47-dev.5902b2a → 0.1.47-dev.61857c7
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/dist/{copy-content-pjGQdIH0.d.cts → copy-content-Bu9TkfQ-.d.cts} +41 -7
- package/dist/copy-content-CbkJ7J6S.cjs +10 -0
- package/dist/copy-content-fAdecUHO.js +10 -0
- package/dist/{copy-content-D8CqvhtV.d.ts → copy-content-gFhiC_Op.d.ts} +41 -7
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/core-BL9TAEy1.cjs +14 -0
- package/dist/core-mTDC4h_Q.js +14 -0
- package/dist/create-pointer-move-prompt-handoff-DHAI0IUp.cjs +9 -0
- package/dist/create-pointer-move-prompt-handoff-DP3dYRgh.js +9 -0
- package/dist/freeze-updates-DFGqjTbl.cjs +51 -0
- package/dist/freeze-updates-Dlsx15dh.js +51 -0
- package/dist/{index-olf-8IUn.d.cts → index-Chk_n5Il.d.cts} +1 -1
- package/dist/{index-CxCZZDDI.d.ts → index-DR2XmmEU.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.global.js +18 -19
- package/dist/index.js +1 -1
- package/dist/primitives.cjs +2 -2
- package/dist/primitives.d.cts +1 -1
- package/dist/primitives.d.ts +1 -1
- package/dist/primitives.js +2 -2
- package/dist/renderer-BIN-MhpY.cjs +9 -0
- package/dist/renderer-CiVvDHwR.js +9 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/dist/action-shortcuts-DL_fNiKq.cjs +0 -9
- package/dist/action-shortcuts-ocj5_ojx.js +0 -9
- package/dist/copy-content-BSGg9AQY.cjs +0 -10
- package/dist/copy-content-DFCo1cn6.js +0 -10
- package/dist/core-D1pE8sWC.cjs +0 -15
- package/dist/core-SbYPyoHY.js +0 -15
- package/dist/freeze-updates-BIaWuSxb.js +0 -51
- package/dist/freeze-updates-aKMJfE3c.cjs +0 -51
- package/dist/renderer-BOx5gFuC.cjs +0 -9
- package/dist/renderer-DmMBnFxF.js +0 -9
|
@@ -214,6 +214,12 @@ interface EnumPendingEdit {
|
|
|
214
214
|
}
|
|
215
215
|
type PendingEdit = NumericPendingEdit | ColorPendingEdit | EnumPendingEdit;
|
|
216
216
|
type PendingEdits = PendingEdit[];
|
|
217
|
+
interface DesignTokenResolver {
|
|
218
|
+
readonly hasTokens: boolean;
|
|
219
|
+
matchColor: (hex: string) => string | null;
|
|
220
|
+
matchLength: (px: number, cssProperty: string) => string | null;
|
|
221
|
+
stepLength: (px: number, direction: 1 | -1, cssProperty: string) => number | null;
|
|
222
|
+
}
|
|
217
223
|
interface PreviewStyles {
|
|
218
224
|
apply: (cssProperties: readonly string[], cssValue: string) => void;
|
|
219
225
|
restore: () => void;
|
|
@@ -232,6 +238,7 @@ interface EditPanelState {
|
|
|
232
238
|
htmlPreview?: string;
|
|
233
239
|
initialSearchQuery?: string;
|
|
234
240
|
hasSessionEdits?: boolean;
|
|
241
|
+
designTokens?: DesignTokenResolver;
|
|
235
242
|
}
|
|
236
243
|
interface ContextMenuAction {
|
|
237
244
|
id: string;
|
|
@@ -242,14 +249,15 @@ interface ContextMenuAction {
|
|
|
242
249
|
enabled?: boolean | ((context: ActionContext) => boolean);
|
|
243
250
|
onAction: (context: ContextMenuActionContext) => void | Promise<void>;
|
|
244
251
|
}
|
|
245
|
-
interface
|
|
252
|
+
interface HierarchyItem {
|
|
246
253
|
tagName: string;
|
|
247
254
|
componentName?: string;
|
|
255
|
+
depth: number;
|
|
256
|
+
isLast: boolean;
|
|
248
257
|
}
|
|
249
|
-
interface
|
|
250
|
-
items:
|
|
258
|
+
interface HierarchyState {
|
|
259
|
+
items: HierarchyItem[];
|
|
251
260
|
activeIndex: number;
|
|
252
|
-
isVisible: boolean;
|
|
253
261
|
}
|
|
254
262
|
interface PluginHooks {
|
|
255
263
|
onActivate?: () => void;
|
|
@@ -293,6 +301,12 @@ interface Plugin {
|
|
|
293
301
|
}
|
|
294
302
|
interface Options {
|
|
295
303
|
enabled?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Confine React Grab to a single container element instead of the whole page.
|
|
306
|
+
* Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
|
|
307
|
+
* Used by the demo build to scope the showcase to its card.
|
|
308
|
+
*/
|
|
309
|
+
container?: HTMLElement;
|
|
296
310
|
activationMode?: ActivationMode;
|
|
297
311
|
keyHoldDuration?: number;
|
|
298
312
|
allowActivationInsideInput?: boolean;
|
|
@@ -324,12 +338,31 @@ interface Options {
|
|
|
324
338
|
interface SettableOptions extends Options {
|
|
325
339
|
enabled?: never;
|
|
326
340
|
telemetry?: never;
|
|
341
|
+
container?: never;
|
|
327
342
|
}
|
|
328
343
|
interface SourceInfo {
|
|
329
344
|
filePath: string;
|
|
330
345
|
lineNumber: number | null;
|
|
331
346
|
componentName: string | null;
|
|
332
347
|
}
|
|
348
|
+
interface SelectedElementPayload {
|
|
349
|
+
tagName: string;
|
|
350
|
+
id?: string;
|
|
351
|
+
className?: string;
|
|
352
|
+
textContent?: string;
|
|
353
|
+
componentName?: string;
|
|
354
|
+
filePath?: string;
|
|
355
|
+
lineNumber?: number;
|
|
356
|
+
columnNumber?: number;
|
|
357
|
+
}
|
|
358
|
+
interface ElementSelectedEventDetail {
|
|
359
|
+
elements: SelectedElementPayload[];
|
|
360
|
+
}
|
|
361
|
+
declare global {
|
|
362
|
+
interface WindowEventMap {
|
|
363
|
+
"react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
333
366
|
interface ToolbarState {
|
|
334
367
|
edge: "top" | "bottom" | "left" | "right";
|
|
335
368
|
ratio: number;
|
|
@@ -353,6 +386,7 @@ interface ReactGrabAPI {
|
|
|
353
386
|
getToolbarState: () => ToolbarState | null;
|
|
354
387
|
setToolbarState: (state: Partial<ToolbarState>) => void;
|
|
355
388
|
onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
|
|
389
|
+
reset: () => void;
|
|
356
390
|
dispose: () => void;
|
|
357
391
|
copyElement: (elements: Element | Element[]) => Promise<boolean>;
|
|
358
392
|
getSource: (element: Element) => Promise<SourceInfo | null>;
|
|
@@ -412,8 +446,8 @@ interface ReactGrabRendererProps {
|
|
|
412
446
|
selectionComponentName?: string;
|
|
413
447
|
selectionLabelVisible?: boolean;
|
|
414
448
|
selectionLabelStatus?: SelectionLabelStatus;
|
|
415
|
-
|
|
416
|
-
|
|
449
|
+
hierarchyState?: HierarchyState;
|
|
450
|
+
hierarchyMenuPosition?: DropdownAnchor | null;
|
|
417
451
|
labelInstances?: SelectionLabelInstance[];
|
|
418
452
|
dragVisible?: boolean;
|
|
419
453
|
dragBounds?: OverlayBounds;
|
|
@@ -717,4 +751,4 @@ interface CopyContentOptions {
|
|
|
717
751
|
}
|
|
718
752
|
declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
|
|
719
753
|
//#endregion
|
|
720
|
-
export {
|
|
754
|
+
export { SourceInfo as A, PromptModeContext as C, Rect as D, ReactGrabState as E, ToolbarState as M, SelectedElementPayload as O, Position as S, ReactGrabRendererProps as T, Options as _, ActionContext as a, PluginConfig as b, AgentContext as c, DeepPartial as d, DragRect as f, GrabbedBox as g, ElementSelectedEventDetail as h, isInstrumentationActive as i, Theme as j, SettableOptions as k, ContextMenuAction as l, ElementLabelVariant as m, StackFrame as n, ActionContextHooks as o, ElementLabelContext as p, Fiber as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, OverlayBounds as v, ReactGrabAPI as w, PluginHooks as x, Plugin as y };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 Aiden Bai
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
const e=require(`./freeze-updates-DFGqjTbl.cjs`);var t=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},n=class extends t{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},r=class extends t{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},i=class extends t{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},a=class extends t{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}};const o=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),s=e=>{try{return decodeURIComponent(e)}catch{return e}},c=/(?:^|[/\\])node_modules[/\\]/,l=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,u=/\.[mc]?[jt]sx?$/i,d=/^chunk-[A-Za-z0-9_-]+$/,f=/[/\\]/,p=/^(.+?)@v?\d/,m=e=>e.split(f).filter(Boolean),ee=e=>{let[t,n]=m(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},te=e=>{let t=m(e)[0];if(!t)return null;let n=t.replace(u,``);if(d.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},h=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},g=e=>e?.match(p)?.[1]??null,ne=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=m(t.pathname).map(s);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=g(n[e+1]);if(r)return`${t}/${r}`;continue}let r=g(t);if(r)return r}return null},re=e=>h(e,l,te)??h(e,c,ee),ie=t=>{if(!t)return null;let n=e.E(t);return n&&(re(s(n))||ne(t))||null},ae=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,oe=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,se=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),ce=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),le=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},ue=t=>{let n=le(s(e.E(t)));if(n.startsWith(`/`))return null;let[r,i,...a]=m(n);return!r||!i||a.length===0||!ae.test(r)||ce.has(r.slice(1))||!oe.test(i)||u.test(i)||se.has(i)?null:`${r}/${i}`},de=e=>e?ie(e)??ue(e):null,_=t=>{if(!t)return{origin:`unknown`,packageName:null};let n=de(t);return n?{origin:`package`,packageName:n}:e.w(t)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},fe=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),v=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},pe=(e,t)=>{let n=fe.has(e)||e.startsWith(`data-`)&&v(e),r=v(t)&&t.length<100||t.startsWith(`#`)&&v(t.slice(1));return n&&r},y=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},b=e=>{let t=0;for(let n of e)t+=n.penalty;return t},x=(e,t)=>b(e)-b(t),S=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},me=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,C=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,he=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&v(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)v(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=S(e,i);a!==void 0&&n.push({name:C(i,a),penalty:10});let o=S(e);return o!==void 0&&n.push({name:me(i,o),penalty:50}),n},w=(t,n=e.ut,r=[])=>{if(n<=0)return[];if(t.length===0)return[r];let i=[];for(let e of t[0]){let a=n-i.length;if(a<=0)break;i.push(...w(t.slice(1),a,[...r,e]))}return i},ge=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},T=(e,t)=>t.querySelectorAll(y(e)).length===1,_e=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=S(n,e);if(t===void 0)return;r.push({name:C(e,t),penalty:10}),n=n.parentElement}return T(r,t)?r:void 0},ve=(e,t,a,o)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new n;if(e.tagName.toLowerCase()===`html`)return`html`;let s=ge(t,e),c=Date.now(),l=[],u=e,d=0,f;for(;u&&u!==s&&!f;)if(l.push(he(u,o)),u=u.parentElement,d++,d>=3){let t=w(l);t.sort(x);for(let n of t){if(Date.now()-c>a){let t=_e(e,s);if(!t)throw new r(a);return y(t)}if(T(n,s)){f=n;break}}}if(!f&&d<3){let e=w(l);e.sort(x);for(let t of e){if(Date.now()-c>a)break;if(T(t,s)){f=t;break}}}if(!f)throw new i;return y(f)},E=e=>e.ownerDocument.body??e.ownerDocument.documentElement,D=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),O=e=>e.length>0&&e.length<=120,k=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},ye=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(k(e,t))return t}for(let t of D){let n=e.getAttribute(t);if(!n||!O(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(k(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(k(e,i))return i}return null},be=e=>{let t=[],n=E(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},A=e=>{let t=ye(e);if(t)return t;try{let t=ve(e,E(e),200,(e,t)=>pe(e,t)||D.has(e)&&O(t));if(t)return t}catch{}return be(e)},xe=t=>{if(!t)return!1;let n=`/${e.x(t)}/`.toLowerCase();return e.Mt.some(e=>n.includes(e))},Se=[`about://React/`,`rsc://React/`],Ce=e=>Se.some(t=>e.startsWith(t)),we=e=>{for(let t of Se){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return s(i>r?e.slice(r,i):e.slice(r))}return e},Te=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},Ee=async(t,n)=>{let r=[],i=[];for(let e=0;e<t.length;e++){let n=t[e];!n.isServer||!n.fileName||(r.push(e),i.push({file:we(n.fileName),methodName:n.functionName??`<unknown>`,line1:n.lineNumber??null,column1:n.columnNumber??null,arguments:[]}))}if(i.length===0)return t;let a=new AbortController,o=setTimeout(()=>a.abort(),e.Pt),s=()=>a.abort();n?.aborted&&a.abort(),n?.addEventListener(`abort`,s);try{let n=await fetch(`${e.y()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:i,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:a.signal});if(!n.ok)return t;let o=await n.json();if(!Array.isArray(o))return t;let s=[...t];for(let e=0;e<r.length;e++){let n=Te(o[e]);if(!n)continue;let i=r[e];s[i]={...t[i],fileName:n.file,lineNumber:n.line1??void 0,columnNumber:n.column1??void 0,isSymbolicated:!0}}return s}catch{return t}finally{clearTimeout(o),n?.removeEventListener(`abort`,s)}},De=t=>{let n=new Map;return e.k(t,t=>{if(!e.O(t))return!1;let r=e.T(t._debugStack.stack);if(!r)return!1;for(let t of e.D(r))!t.functionName||!t.fileName||Ce(t.fileName)&&(n.has(t.functionName)||n.set(t.functionName,{...t,isServer:!0}));return!1},!0),n},Oe=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=De(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})};let j=0;const M=[],ke=()=>j<3?(j+=1,Promise.resolve()):new Promise(e=>{M.push(e)}),Ae=()=>{let e=M.shift();if(e){e();return}--j},N=async(t,n,r=e.Nt)=>{await ke();let i=new AbortController,a,o=new Promise(e=>{a=setTimeout(()=>{i.abort(),e(n)},r)}),s=t(i.signal);s.catch(()=>{});try{return await Promise.race([s,o])}finally{clearTimeout(a),Ae()}},P=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,je=e=>e.startsWith(`data-react-grab-`),F=e=>e.replace(/\s+/g,` `).trim(),Me=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=F(n.textContent??``);e&&t.push(e)}return t.join(` `)},I=t=>t.getAttribute(`aria-hidden`)===`true`||t.hasAttribute(`hidden`)?!0:e.Dt.has(t.tagName.toLowerCase()),L=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=F(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||I(e))return n;for(let r of e.childNodes)if(n=L(r,t,n),n<=0)break;return n},R=(t,n)=>{if(I(t))return``;let r=Me(t);if(!e.wt.has(n)||r&&t.children.length===0)return r;let i=[];return L(t,i,100),i.join(` `)},z=e=>P(e,15),Ne=t=>{let n=[];for(let r of e.Et){let e=t.getAttribute(r);e&&n.push(`${r}="${e}"`)}return n.length>0?` ${n.join(` `)}`:``},Pe=e=>e===`class`||e===`className`||e===`style`,B=t=>{let n=[],r=[],i=``;for(let{name:a,value:o}of t.attributes)if(!je(a)){if(Pe(a)){a!==`style`&&o&&(i=` class="${z(o)}"`);continue}e.Tt.has(a)?n.push(o?` ${a}="${o}"`:` ${a}`):o&&r.push(` ${a}="${z(o)}"`)}return n.join(``)+r.join(``)+i},V=t=>t.length===0?``:t.length<=2?t.map(t=>`<${e.I(t)} ...>`).join(`
|
|
10
|
+
`):`(${t.length} elements)`,Fe=t=>{let n=e.I(t);if(!(t instanceof HTMLElement))return`<${n}${Ne(t)} />`;let r=B(t),i=P(R(t,n),100);return i?`<${n}${r}>${i}</${n}>`:`<${n}${r} />`},H=t=>{let n=e.I(t),r=B(t),i=R(t,n),a=[],o=[],s=!1;for(let e of t.childNodes)e.nodeType!==Node.COMMENT_NODE&&(e.nodeType===Node.TEXT_NODE?e.textContent&&e.textContent.trim().length>0&&(s=!0):e instanceof Element&&(s?o.push(e):a.push(e)));let c=i.length>0&&e.wt.has(n),l=``,u=V(a);u&&!c&&(l+=`\n ${u}`),i&&(l+=`\n ${P(i,100)}`);let d=V(o);return d&&!c&&(l+=`\n ${d}`),l.length>0?`<${n}${r}>${l}\n</${n}>`:`<${n}${r} />`},Ie=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),Le=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),Re=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),ze=new Set([`MotionDOMComponent`]),U=e=>{if(Le.has(e)||Re.has(e)||ze.has(e))return!0;for(let t of Ie)if(e.startsWith(t))return!0;return!1},Be=e=>!(!e||U(e)||e===`SlotClone`||e===`Slot`),Ve=e=>!(e.length<=1||U(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),W=e=>e&&Ve(e)?e:null,G=t=>{if(!e.A())return t;let n=t;for(;n;){if(e.M(n))return n;n=n.parentElement}return t},He=t=>{if(!e.A())return null;let n=e.M(G(t)),r=0;for(;n;){if(n.key)return n.key;if(e.N(n)&&(r+=1,r===2))break;n=n.return}return null},K=new WeakMap,q=new WeakMap,J=e=>t=>fetch(t,{signal:e,priority:`high`}),Ue=t=>N(async n=>{try{let r=e.M(t);if(!r)return null;let i=await e.C(r,!0,J(n));return e.b()?await Ee(Oe(r,i),n):i}catch{return null}},null),Y=t=>{if(!e.A())return Promise.resolve([]);let n=G(t),r=K.get(n);if(r)return r;let i=Ue(n).then(e=>(e===null&&K.delete(n),e));return K.set(n,i),i},We=async t=>{if(!e.A())return null;let n=await Y(t);if(!n)return null;for(let e of n){let t=W(e.functionName);if(t)return t}return null},Ge=e=>e.find(e=>!!W(e.functionName))??e[0]??null,Ke=t=>!t||!e.N(t)?null:W(e.j(t.type)),qe=t=>N(async n=>{let r=e.M(G(t));if(!r)return null;try{let t=await e.S(r,!0,J(n));return t?.fileName?{filePath:e.x(t.fileName),lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:W(t.functionName)??Ke(r._debugOwner),origin:_(t.fileName).origin}:null}catch{return null}},null),X=e=>{let t=G(e),n=q.get(t);if(n)return n;let r=qe(t).then(e=>(e||q.delete(t),e));return q.set(t,r),r},Je=[`app`,`package`],Ye=(t,n)=>{for(let r of Je){if(t?.origin===r)return t;let i=Ge(n.filter(e=>_(e.fileName).origin===r));if(i?.fileName)return{filePath:e.x(i.fileName),lineNumber:i.lineNumber??null,columnNumber:i.columnNumber??null,componentName:W(i.functionName),origin:r}}return null},Xe=async e=>{let t=await X(e);return t?.origin===`app`?t:Ye(t,await Y(e)??[])},Ze=e=>Z(G(e),1)[0]??null,Z=(t,n)=>{if(!e.A())return[];let r=e.M(t);if(!r)return[];let i=[];return e.k(r,t=>{if(i.length>=n)return!0;if(e.N(t)){let n=e.j(t.type);n&&Be(n)&&i.push(n)}return!1},!0),i},Qe=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],$e=(t,n)=>{let r=e.x(t);if(!n||!r.startsWith(`/`))return r;for(let e of Qe){let t=r.indexOf(e);if(t!==-1)return`/./${r.slice(t+1)}`}return r},et=(e,t)=>{let n=$e(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},Q={isAppSource:!1,consumesBudget:!1},tt=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...Q}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...Q}:i?{text:`\n in ${i}`,...Q}:a?{text:et({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!xe(a)}:null},nt=(t,n={},r=null)=>{let i=o(n.maxLines),a=Math.max(i,20),s=e.b(),c=[],l=null,u=!1,d=!1,f=0;r&&(d=r.origin===`app`,xe(r.filePath)||(f+=1),c.push(et(r,s)));for(let e of t){if(f>=i||c.length>=a)break;let t=_(e.fileName),n=W(e.functionName),o=t.packageName?`${t.packageName}:${n??``}:${e.isServer?`server`:`client`}`:null;if(o&&o===l)continue;if(!u&&n&&n===r?.componentName){u=!0;continue}let p=tt(e,t,n,s);p!==null&&p.text!==c[c.length-1]&&(p.isAppSource&&(d=!0),p.consumesBudget&&(f+=1),c.push(p.text),l=o)}return{text:c.join(``),shouldAppendSelectorHint:!d}},rt=async e=>{let t=await X(e);return t?.origin===`app`?t:null},$=async(e,t={})=>{let n=await rt(e),r=nt(await Y(e)??[],t,n);if(r.text)return r;let i=Z(G(e),o(t.maxLines));return i.length>0?{text:i.map(e=>`\n in ${e}`).join(``),shouldAppendSelectorHint:!0}:{text:``,shouldAppendSelectorHint:!0}},it=async(e,t={})=>(await $(e,t)).text,at=(e,t)=>{let n=He(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${A(e)}`:``;return`${t.text}${r}${i}`},ot=async(e,t={})=>{let n=await $(e,t);return`${Fe(e)}${at(e,n).replace(/\n\s+/g,` `)}`},st=async(e,t={})=>{let n=G(e);return`${H(n)}${at(n,await $(n,t))}`},ct=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),lt=(t,n)=>{let r=n?.componentName??`div`,i={version:e.It,content:t,entries:n?.entries??[{tagName:n?.tagName,componentName:r,content:t,commentText:n?.commentText}],timestamp:Date.now()},a=e=>{e.preventDefault(),e.clipboardData?.setData(`text/plain`,t),e.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${ct(t)}</code></pre>`),e.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(i))};document.addEventListener(`copy`,a);let o=document.createElement(`textarea`);o.value=t,o.style.position=`fixed`,o.style.left=`-9999px`,o.ariaHidden=`true`,document.body.appendChild(o),o.select();try{return typeof document.execCommand==`function`?document.execCommand(`copy`):!1}finally{document.removeEventListener(`copy`,a),o.remove()}};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return st}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return A}});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 Aiden Bai
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import{A as e,C as t,D as n,Dt as r,E as i,Et as a,I as o,It as s,M as c,Mt as l,N as u,Nt as d,O as f,Pt as p,S as ee,T as te,Tt as ne,b as m,j as re,k as ie,ut as ae,w as oe,wt as se,x as h,y as ce}from"./freeze-updates-Dlsx15dh.js";var g=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},le=class extends g{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},ue=class extends g{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},de=class extends g{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},fe=class extends g{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}};const pe=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),_=e=>{try{return decodeURIComponent(e)}catch{return e}},me=/(?:^|[/\\])node_modules[/\\]/,he=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,ge=/\.[mc]?[jt]sx?$/i,_e=/^chunk-[A-Za-z0-9_-]+$/,ve=/[/\\]/,ye=/^(.+?)@v?\d/,v=e=>e.split(ve).filter(Boolean),be=e=>{let[t,n]=v(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},xe=e=>{let t=v(e)[0];if(!t)return null;let n=t.replace(ge,``);if(_e.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},y=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},b=e=>e?.match(ye)?.[1]??null,Se=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=v(t.pathname).map(_);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=b(n[e+1]);if(r)return`${t}/${r}`;continue}let r=b(t);if(r)return r}return null},Ce=e=>y(e,he,xe)??y(e,me,be),we=e=>{if(!e)return null;let t=i(e);return t&&(Ce(_(t))||Se(e))||null},Te=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,Ee=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,De=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),Oe=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),ke=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},Ae=e=>{let t=ke(_(i(e)));if(t.startsWith(`/`))return null;let[n,r,...a]=v(t);return!n||!r||a.length===0||!Te.test(n)||Oe.has(n.slice(1))||!Ee.test(r)||ge.test(r)||De.has(r)?null:`${n}/${r}`},je=e=>e?we(e)??Ae(e):null,x=e=>{if(!e)return{origin:`unknown`,packageName:null};let t=je(e);return t?{origin:`package`,packageName:t}:oe(e)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},Me=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),S=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},Ne=(e,t)=>{let n=Me.has(e)||e.startsWith(`data-`)&&S(e),r=S(t)&&t.length<100||t.startsWith(`#`)&&S(t.slice(1));return n&&r},C=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},w=e=>{let t=0;for(let n of e)t+=n.penalty;return t},Pe=(e,t)=>w(e)-w(t),T=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},Fe=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,E=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,Ie=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&S(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)S(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=T(e,i);a!==void 0&&n.push({name:E(i,a),penalty:10});let o=T(e);return o!==void 0&&n.push({name:Fe(i,o),penalty:50}),n},D=(e,t=ae,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...D(e.slice(1),a,[...n,i]))}return r},Le=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},O=(e,t)=>t.querySelectorAll(C(e)).length===1,Re=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=T(n,e);if(t===void 0)return;r.push({name:E(e,t),penalty:10}),n=n.parentElement}return O(r,t)?r:void 0},ze=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new le;if(e.tagName.toLowerCase()===`html`)return`html`;let i=Le(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(Ie(s,r)),s=s.parentElement,c++,c>=3){let t=D(o);t.sort(Pe);for(let r of t){if(Date.now()-a>n){let t=Re(e,i);if(!t)throw new ue(n);return C(t)}if(O(r,i)){l=r;break}}}if(!l&&c<3){let e=D(o);e.sort(Pe);for(let t of e){if(Date.now()-a>n)break;if(O(t,i)){l=t;break}}}if(!l)throw new de;return C(l)},Be=e=>e.ownerDocument.body??e.ownerDocument.documentElement,Ve=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),k=e=>e.length>0&&e.length<=120,A=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},He=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(A(e,t))return t}for(let t of Ve){let n=e.getAttribute(t);if(!n||!k(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(A(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(A(e,i))return i}return null},Ue=e=>{let t=[],n=Be(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},j=e=>{let t=He(e);if(t)return t;try{let t=ze(e,Be(e),200,(e,t)=>Ne(e,t)||Ve.has(e)&&k(t));if(t)return t}catch{}return Ue(e)},M=e=>{if(!e)return!1;let t=`/${h(e)}/`.toLowerCase();return l.some(e=>t.includes(e))},N=[`about://React/`,`rsc://React/`],We=e=>N.some(t=>e.startsWith(t)),Ge=e=>{for(let t of N){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return _(i>r?e.slice(r,i):e.slice(r))}return e},Ke=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},qe=async(e,t)=>{let n=[],r=[];for(let t=0;t<e.length;t++){let i=e[t];!i.isServer||!i.fileName||(n.push(t),r.push({file:Ge(i.fileName),methodName:i.functionName??`<unknown>`,line1:i.lineNumber??null,column1:i.columnNumber??null,arguments:[]}))}if(r.length===0)return e;let i=new AbortController,a=setTimeout(()=>i.abort(),p),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${ce()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:r,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:i.signal});if(!t.ok)return e;let a=await t.json();if(!Array.isArray(a))return e;let o=[...e];for(let t=0;t<n.length;t++){let r=Ke(a[t]);if(!r)continue;let i=n[t];o[i]={...e[i],fileName:r.file,lineNumber:r.line1??void 0,columnNumber:r.column1??void 0,isSymbolicated:!0}}return o}catch{return e}finally{clearTimeout(a),t?.removeEventListener(`abort`,o)}},Je=e=>{let t=new Map;return ie(e,e=>{if(!f(e))return!1;let r=te(e._debugStack.stack);if(!r)return!1;for(let e of n(r))!e.functionName||!e.fileName||We(e.fileName)&&(t.has(e.functionName)||t.set(e.functionName,{...e,isServer:!0}));return!1},!0),t},Ye=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=Je(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})};let P=0;const F=[],Xe=()=>P<3?(P+=1,Promise.resolve()):new Promise(e=>{F.push(e)}),Ze=()=>{let e=F.shift();if(e){e();return}--P},I=async(e,t,n=d)=>{await Xe();let r=new AbortController,i,a=new Promise(e=>{i=setTimeout(()=>{r.abort(),e(t)},n)}),o=e(r.signal);o.catch(()=>{});try{return await Promise.race([o,a])}finally{clearTimeout(i),Ze()}},L=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,Qe=e=>e.startsWith(`data-react-grab-`),R=e=>e.replace(/\s+/g,` `).trim(),$e=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=R(n.textContent??``);e&&t.push(e)}return t.join(` `)},z=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:r.has(e.tagName.toLowerCase()),B=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=R(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||z(e))return n;for(let r of e.childNodes)if(n=B(r,t,n),n<=0)break;return n},V=(e,t)=>{if(z(e))return``;let n=$e(e);if(!se.has(t)||n&&e.children.length===0)return n;let r=[];return B(e,r,100),r.join(` `)},H=e=>L(e,15),et=e=>{let t=[];for(let n of a){let r=e.getAttribute(n);r&&t.push(`${n}="${r}"`)}return t.length>0?` ${t.join(` `)}`:``},tt=e=>e===`class`||e===`className`||e===`style`,U=e=>{let t=[],n=[],r=``;for(let{name:i,value:a}of e.attributes)if(!Qe(i)){if(tt(i)){i!==`style`&&a&&(r=` class="${H(a)}"`);continue}ne.has(i)?t.push(a?` ${i}="${a}"`:` ${i}`):a&&n.push(` ${i}="${H(a)}"`)}return t.join(``)+n.join(``)+r},W=e=>e.length===0?``:e.length<=2?e.map(e=>`<${o(e)} ...>`).join(`
|
|
10
|
+
`):`(${e.length} elements)`,nt=e=>{let t=o(e);if(!(e instanceof HTMLElement))return`<${t}${et(e)} />`;let n=U(e),r=L(V(e,t),100);return r?`<${t}${n}>${r}</${t}>`:`<${t}${n} />`},G=e=>{let t=o(e),n=U(e),r=V(e,t),i=[],a=[],s=!1;for(let t of e.childNodes)t.nodeType!==Node.COMMENT_NODE&&(t.nodeType===Node.TEXT_NODE?t.textContent&&t.textContent.trim().length>0&&(s=!0):t instanceof Element&&(s?a.push(t):i.push(t)));let c=r.length>0&&se.has(t),l=``,u=W(i);u&&!c&&(l+=`\n ${u}`),r&&(l+=`\n ${L(r,100)}`);let d=W(a);return d&&!c&&(l+=`\n ${d}`),l.length>0?`<${t}${n}>${l}\n</${t}>`:`<${t}${n} />`},rt=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),it=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),at=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),ot=new Set([`MotionDOMComponent`]),K=e=>{if(it.has(e)||at.has(e)||ot.has(e))return!0;for(let t of rt)if(e.startsWith(t))return!0;return!1},st=e=>!(!e||K(e)||e===`SlotClone`||e===`Slot`),ct=e=>!(e.length<=1||K(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),q=e=>e&&ct(e)?e:null,J=t=>{if(!e())return t;let n=t;for(;n;){if(c(n))return n;n=n.parentElement}return t},lt=t=>{if(!e())return null;let n=c(J(t)),r=0;for(;n;){if(n.key)return n.key;if(u(n)&&(r+=1,r===2))break;n=n.return}return null},Y=new WeakMap,X=new WeakMap,ut=e=>t=>fetch(t,{signal:e,priority:`high`}),dt=e=>I(async n=>{try{let r=c(e);if(!r)return null;let i=await t(r,!0,ut(n));return m()?await qe(Ye(r,i),n):i}catch{return null}},null),Z=t=>{if(!e())return Promise.resolve([]);let n=J(t),r=Y.get(n);if(r)return r;let i=dt(n).then(e=>(e===null&&Y.delete(n),e));return Y.set(n,i),i},ft=async t=>{if(!e())return null;let n=await Z(t);if(!n)return null;for(let e of n){let t=q(e.functionName);if(t)return t}return null},pt=e=>e.find(e=>!!q(e.functionName))??e[0]??null,mt=e=>!e||!u(e)?null:q(re(e.type)),ht=e=>I(async t=>{let n=c(J(e));if(!n)return null;try{let e=await ee(n,!0,ut(t));return e?.fileName?{filePath:h(e.fileName),lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:q(e.functionName)??mt(n._debugOwner),origin:x(e.fileName).origin}:null}catch{return null}},null),gt=e=>{let t=J(e),n=X.get(t);if(n)return n;let r=ht(t).then(e=>(e||X.delete(t),e));return X.set(t,r),r},_t=[`app`,`package`],vt=(e,t)=>{for(let n of _t){if(e?.origin===n)return e;let r=pt(t.filter(e=>x(e.fileName).origin===n));if(r?.fileName)return{filePath:h(r.fileName),lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null,componentName:q(r.functionName),origin:n}}return null},yt=async e=>{let t=await gt(e);return t?.origin===`app`?t:vt(t,await Z(e)??[])},bt=e=>xt(J(e),1)[0]??null,xt=(t,n)=>{if(!e())return[];let r=c(t);if(!r)return[];let i=[];return ie(r,e=>{if(i.length>=n)return!0;if(u(e)){let t=re(e.type);t&&st(t)&&i.push(t)}return!1},!0),i},St=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],Ct=(e,t)=>{let n=h(e);if(!t||!n.startsWith(`/`))return n;for(let e of St){let t=n.indexOf(e);if(t!==-1)return`/./${n.slice(t+1)}`}return n},wt=(e,t)=>{let n=Ct(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},Q={isAppSource:!1,consumesBudget:!1},Tt=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...Q}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...Q}:i?{text:`\n in ${i}`,...Q}:a?{text:wt({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!M(a)}:null},Et=(e,t={},n=null)=>{let r=pe(t.maxLines),i=Math.max(r,20),a=m(),o=[],s=null,c=!1,l=!1,u=0;n&&(l=n.origin===`app`,M(n.filePath)||(u+=1),o.push(wt(n,a)));for(let t of e){if(u>=r||o.length>=i)break;let e=x(t.fileName),d=q(t.functionName),f=e.packageName?`${e.packageName}:${d??``}:${t.isServer?`server`:`client`}`:null;if(f&&f===s)continue;if(!c&&d&&d===n?.componentName){c=!0;continue}let p=Tt(t,e,d,a);p!==null&&p.text!==o[o.length-1]&&(p.isAppSource&&(l=!0),p.consumesBudget&&(u+=1),o.push(p.text),s=f)}return{text:o.join(``),shouldAppendSelectorHint:!l}},Dt=async e=>{let t=await gt(e);return t?.origin===`app`?t:null},$=async(e,t={})=>{let n=await Dt(e),r=Et(await Z(e)??[],t,n);if(r.text)return r;let i=xt(J(e),pe(t.maxLines));return i.length>0?{text:i.map(e=>`\n in ${e}`).join(``),shouldAppendSelectorHint:!0}:{text:``,shouldAppendSelectorHint:!0}},Ot=async(e,t={})=>(await $(e,t)).text,kt=(e,t)=>{let n=lt(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${j(e)}`:``;return`${t.text}${r}${i}`},At=async(e,t={})=>{let n=await $(e,t);return`${nt(e)}${kt(e,n).replace(/\n\s+/g,` `)}`},jt=async(e,t={})=>{let n=J(e);return`${G(n)}${kt(n,await $(n,t))}`},Mt=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),Nt=(e,t)=>{let n=t?.componentName??`div`,r={version:s,content:e,entries:t?.entries??[{tagName:t?.tagName,componentName:n,content:e,commentText:t?.commentText}],timestamp:Date.now()},i=t=>{t.preventDefault(),t.clipboardData?.setData(`text/plain`,e),t.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${Mt(e)}</code></pre>`),t.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(r))};document.addEventListener(`copy`,i);let a=document.createElement(`textarea`);a.value=e,a.style.position=`fixed`,a.style.left=`-9999px`,a.ariaHidden=`true`,document.body.appendChild(a),a.select();try{return typeof document.execCommand==`function`?document.execCommand(`copy`):!1}finally{document.removeEventListener(`copy`,i),a.remove()}};export{ft as a,yt as c,fe as d,At as i,G as l,jt as n,Z as o,bt as r,Ot as s,Nt as t,j as u};
|
|
@@ -214,6 +214,12 @@ interface EnumPendingEdit {
|
|
|
214
214
|
}
|
|
215
215
|
type PendingEdit = NumericPendingEdit | ColorPendingEdit | EnumPendingEdit;
|
|
216
216
|
type PendingEdits = PendingEdit[];
|
|
217
|
+
interface DesignTokenResolver {
|
|
218
|
+
readonly hasTokens: boolean;
|
|
219
|
+
matchColor: (hex: string) => string | null;
|
|
220
|
+
matchLength: (px: number, cssProperty: string) => string | null;
|
|
221
|
+
stepLength: (px: number, direction: 1 | -1, cssProperty: string) => number | null;
|
|
222
|
+
}
|
|
217
223
|
interface PreviewStyles {
|
|
218
224
|
apply: (cssProperties: readonly string[], cssValue: string) => void;
|
|
219
225
|
restore: () => void;
|
|
@@ -232,6 +238,7 @@ interface EditPanelState {
|
|
|
232
238
|
htmlPreview?: string;
|
|
233
239
|
initialSearchQuery?: string;
|
|
234
240
|
hasSessionEdits?: boolean;
|
|
241
|
+
designTokens?: DesignTokenResolver;
|
|
235
242
|
}
|
|
236
243
|
interface ContextMenuAction {
|
|
237
244
|
id: string;
|
|
@@ -242,14 +249,15 @@ interface ContextMenuAction {
|
|
|
242
249
|
enabled?: boolean | ((context: ActionContext) => boolean);
|
|
243
250
|
onAction: (context: ContextMenuActionContext) => void | Promise<void>;
|
|
244
251
|
}
|
|
245
|
-
interface
|
|
252
|
+
interface HierarchyItem {
|
|
246
253
|
tagName: string;
|
|
247
254
|
componentName?: string;
|
|
255
|
+
depth: number;
|
|
256
|
+
isLast: boolean;
|
|
248
257
|
}
|
|
249
|
-
interface
|
|
250
|
-
items:
|
|
258
|
+
interface HierarchyState {
|
|
259
|
+
items: HierarchyItem[];
|
|
251
260
|
activeIndex: number;
|
|
252
|
-
isVisible: boolean;
|
|
253
261
|
}
|
|
254
262
|
interface PluginHooks {
|
|
255
263
|
onActivate?: () => void;
|
|
@@ -293,6 +301,12 @@ interface Plugin {
|
|
|
293
301
|
}
|
|
294
302
|
interface Options {
|
|
295
303
|
enabled?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Confine React Grab to a single container element instead of the whole page.
|
|
306
|
+
* Hit-testing, the toolbar viewport, and scroll re-anchoring are scoped to it.
|
|
307
|
+
* Used by the demo build to scope the showcase to its card.
|
|
308
|
+
*/
|
|
309
|
+
container?: HTMLElement;
|
|
296
310
|
activationMode?: ActivationMode;
|
|
297
311
|
keyHoldDuration?: number;
|
|
298
312
|
allowActivationInsideInput?: boolean;
|
|
@@ -324,12 +338,31 @@ interface Options {
|
|
|
324
338
|
interface SettableOptions extends Options {
|
|
325
339
|
enabled?: never;
|
|
326
340
|
telemetry?: never;
|
|
341
|
+
container?: never;
|
|
327
342
|
}
|
|
328
343
|
interface SourceInfo {
|
|
329
344
|
filePath: string;
|
|
330
345
|
lineNumber: number | null;
|
|
331
346
|
componentName: string | null;
|
|
332
347
|
}
|
|
348
|
+
interface SelectedElementPayload {
|
|
349
|
+
tagName: string;
|
|
350
|
+
id?: string;
|
|
351
|
+
className?: string;
|
|
352
|
+
textContent?: string;
|
|
353
|
+
componentName?: string;
|
|
354
|
+
filePath?: string;
|
|
355
|
+
lineNumber?: number;
|
|
356
|
+
columnNumber?: number;
|
|
357
|
+
}
|
|
358
|
+
interface ElementSelectedEventDetail {
|
|
359
|
+
elements: SelectedElementPayload[];
|
|
360
|
+
}
|
|
361
|
+
declare global {
|
|
362
|
+
interface WindowEventMap {
|
|
363
|
+
"react-grab:element-selected": CustomEvent<ElementSelectedEventDetail>;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
333
366
|
interface ToolbarState {
|
|
334
367
|
edge: "top" | "bottom" | "left" | "right";
|
|
335
368
|
ratio: number;
|
|
@@ -353,6 +386,7 @@ interface ReactGrabAPI {
|
|
|
353
386
|
getToolbarState: () => ToolbarState | null;
|
|
354
387
|
setToolbarState: (state: Partial<ToolbarState>) => void;
|
|
355
388
|
onToolbarStateChange: (callback: (state: ToolbarState) => void) => () => void;
|
|
389
|
+
reset: () => void;
|
|
356
390
|
dispose: () => void;
|
|
357
391
|
copyElement: (elements: Element | Element[]) => Promise<boolean>;
|
|
358
392
|
getSource: (element: Element) => Promise<SourceInfo | null>;
|
|
@@ -412,8 +446,8 @@ interface ReactGrabRendererProps {
|
|
|
412
446
|
selectionComponentName?: string;
|
|
413
447
|
selectionLabelVisible?: boolean;
|
|
414
448
|
selectionLabelStatus?: SelectionLabelStatus;
|
|
415
|
-
|
|
416
|
-
|
|
449
|
+
hierarchyState?: HierarchyState;
|
|
450
|
+
hierarchyMenuPosition?: DropdownAnchor | null;
|
|
417
451
|
labelInstances?: SelectionLabelInstance[];
|
|
418
452
|
dragVisible?: boolean;
|
|
419
453
|
dragBounds?: OverlayBounds;
|
|
@@ -717,4 +751,4 @@ interface CopyContentOptions {
|
|
|
717
751
|
}
|
|
718
752
|
declare const copyContent: (content: string, options?: CopyContentOptions) => boolean;
|
|
719
753
|
//#endregion
|
|
720
|
-
export {
|
|
754
|
+
export { SourceInfo as A, PromptModeContext as C, Rect as D, ReactGrabState as E, ToolbarState as M, SelectedElementPayload as O, Position as S, ReactGrabRendererProps as T, Options as _, ActionContext as a, PluginConfig as b, AgentContext as c, DeepPartial as d, DragRect as f, GrabbedBox as g, ElementSelectedEventDetail as h, isInstrumentationActive as i, Theme as j, SettableOptions as k, ContextMenuAction as l, ElementLabelVariant as m, StackFrame as n, ActionContextHooks as o, ElementLabelContext as p, Fiber as r, ActivationMode as s, copyContent as t, ContextMenuActionContext as u, OverlayBounds as v, ReactGrabAPI as w, PluginHooks as x, Plugin as y };
|
package/dist/core/index.cjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../core-
|
|
9
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../core-BL9TAEy1.cjs`),t=require(`../freeze-updates-DFGqjTbl.cjs`),n=require(`../copy-content-CbkJ7J6S.cjs`);exports.DEFAULT_THEME=e.a,exports.copyContent=n.t,exports.formatElementInfo=n.n,exports.generateSnippet=e.n,exports.getStack=n.o,exports.init=e.t,exports.isInstrumentationActive=t.A;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-
|
|
9
|
+
import { A as SourceInfo, T as ReactGrabRendererProps, _ as Options, a as ActionContext, b as PluginConfig, c as AgentContext, i as isInstrumentationActive, k as SettableOptions, l as ContextMenuAction, t as copyContent, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "../copy-content-Bu9TkfQ-.cjs";
|
|
10
|
+
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-Chk_n5Il.cjs";
|
|
11
11
|
export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-
|
|
9
|
+
import { A as SourceInfo, T as ReactGrabRendererProps, _ as Options, a as ActionContext, b as PluginConfig, c as AgentContext, i as isInstrumentationActive, k as SettableOptions, l as ContextMenuAction, t as copyContent, v as OverlayBounds, w as ReactGrabAPI, x as PluginHooks, y as Plugin } from "../copy-content-gFhiC_Op.js";
|
|
10
|
+
import { a as getStack, i as formatElementInfo, n as generateSnippet, r as DEFAULT_THEME, t as init } from "../index-DR2XmmEU.js";
|
|
11
11
|
export { ActionContext, AgentContext, ContextMenuAction, DEFAULT_THEME, Options, OverlayBounds, Plugin, PluginConfig, PluginHooks, ReactGrabAPI, ReactGrabRendererProps, SettableOptions, SourceInfo, copyContent, formatElementInfo, generateSnippet, getStack, init, isInstrumentationActive };
|
package/dist/core/index.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
import{a as e,n as t,t as n}from"../core-
|
|
9
|
+
import{a as e,n as t,t as n}from"../core-mTDC4h_Q.js";import{A as r}from"../freeze-updates-Dlsx15dh.js";import{n as i,o as a,t as o}from"../copy-content-fAdecUHO.js";export{e as DEFAULT_THEME,o as copyContent,i as formatElementInfo,t as generateSnippet,a as getStack,n as init,r as isInstrumentationActive};
|