@pageops/sdk 0.1.29 → 0.1.30
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/index.d.ts +8 -0
- package/dist/pageops-sdk.css +1 -1
- package/dist/pageops-sdk.es.js +56 -3
- package/dist/pageops-sdk.umd.cjs +57 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ declare class PageOpsSDKController {
|
|
|
36
36
|
private streamFailure;
|
|
37
37
|
private streamDone;
|
|
38
38
|
private answerAudience;
|
|
39
|
+
private floatingRatio;
|
|
40
|
+
private floatingCleanup;
|
|
39
41
|
private typewriter;
|
|
40
42
|
mount(options: PageOpsMountOptions): void;
|
|
41
43
|
unmount(): void;
|
|
@@ -43,6 +45,12 @@ declare class PageOpsSDKController {
|
|
|
43
45
|
close(): void;
|
|
44
46
|
updateContext(options: Partial<PageOpsMountOptions>): void;
|
|
45
47
|
private renderClosed;
|
|
48
|
+
private floatingStorageKey;
|
|
49
|
+
private loadFloatingRatio;
|
|
50
|
+
private saveFloatingRatio;
|
|
51
|
+
private setFloatingPosition;
|
|
52
|
+
private bindFloatingLauncher;
|
|
53
|
+
private cleanupFloatingLauncher;
|
|
46
54
|
private ensureContext;
|
|
47
55
|
private getPageContext;
|
|
48
56
|
private answerAudienceStorageKey;
|
package/dist/pageops-sdk.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pageops-sdk{--po-text: #172033;--po-muted: #64748b;--po-border: #dbe5f5;--po-soft-border: #e2e8f0;--po-surface: #ffffff;--po-soft: #f8fafc;--po-panel: #fbfdff;--po-primary: #2563eb;--po-primary-dark: #1d4ed8;--po-shadow: 0 24px 70px rgb(15 23 42 / 18%);color:var(--po-text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.pageops-sdk *,.pageops-sdk *:before,.pageops-sdk *:after{box-sizing:border-box}.pageops-sdk button,.pageops-sdk input,.pageops-sdk textarea,.pageops-sdk select{font:inherit}.pageops-sdk button{cursor:pointer}.po-fab{position:fixed;right:24px;bottom:24px;z-index:2147483000;border:0;border-radius:999px;padding:12px 18px;background:linear-gradient(135deg,#2563eb,#14b8a6);color:#fff;font-weight:800;box-shadow:0 18px 42px #2563eb47}.po-panel{position:fixed;inset:40px;z-index:2147483000;display:grid;grid-template-columns:250px minmax(0,1fr) 340px;min-height:520px;overflow:hidden;border:1px solid var(--po-border);border-radius:24px;background:var(--po-surface);box-shadow:var(--po-shadow)}.po-sidebar{display:flex;min-width:0;min-height:0;flex-direction:column;gap:12px;overflow:hidden;border-right:1px solid #dbeafe;background:#eef5ff;padding:16px}.po-brand{display:flex;align-items:center;gap:10px}.po-brand strong,.po-brand span{display:block}.po-brand span{margin-top:2px;color:var(--po-muted);font-size:12px}.po-logo{width:34px;height:34px;flex:0 0 auto;border-radius:12px;background:linear-gradient(135deg,#5eead4,#2563eb)}.po-new,.po-composer button{border:0;border-radius:10px;background:var(--po-primary);color:#fff;font-weight:750}.po-new{width:100%;padding:10px 12px}.po-search,.po-composer textarea{width:100%;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:var(--po-text);outline:none}.po-search{padding:9px 10px}.po-thread-list{display:grid;align-content:start;gap:8px;min-height:0;overflow:auto}.po-thread-row{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 32px;align-items:center;border:1px solid transparent;border-radius:10px}.po-thread-row.active{border-color:#bfdbfe;background:#fff}.po-thread{display:grid;gap:4px;width:100%;border:0;border-radius:10px;background:transparent;color:#334155;padding:9px 10px;text-align:left}.po-thread-row.active .po-thread{color:var(--po-text)}.po-thread span{color:#94a3b8;font-size:12px}.po-thread-delete{display:grid;width:28px;height:28px;place-items:center;border:0;border-radius:6px;background:transparent;color:#94a3b8;opacity:0}.po-thread-row:hover .po-thread-delete,.po-thread-row:focus-within .po-thread-delete{opacity:1}.po-thread-delete:hover{background:#fee2e2;color:#b91c1c}.po-thread-delete:disabled{cursor:not-allowed;opacity:.35}.po-trash-icon{position:relative;width:11px;height:12px;border:1.5px solid currentcolor;border-top:0;border-radius:0 0 2px 2px}.po-trash-icon:before{position:absolute;top:-4px;left:-2px;width:13px;border-top:1.5px solid currentcolor;content:""}.po-trash-icon:after{position:absolute;top:-6px;left:3px;width:4px;height:2px;border:1.5px solid currentcolor;border-bottom:0;border-radius:2px 2px 0 0;content:""}.po-conversation-error{margin:0;color:#b91c1c;font-size:12px}.po-chat{display:flex;min-width:0;min-height:0;flex-direction:column;background:linear-gradient(180deg,#fff,var(--po-panel));padding:22px 26px}.po-chat header,.po-trace header{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--po-soft-border);padding-bottom:14px}.po-chat header p,.po-chat header h2,.po-trace header h2{margin:0}.po-chat header p,.po-chat header span{color:var(--po-muted);font-size:12px}.po-chat header h2,.po-trace header h2{font-size:20px;letter-spacing:0}.po-chat-title{min-width:0}.po-chat-title h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.po-audience{display:flex;flex:0 0 auto;align-items:center;gap:8px}.po-audience>span{white-space:nowrap}.po-audience-options{display:grid;grid-template-columns:repeat(4,44px);height:32px;overflow:hidden;border:1px solid #cbd5e1;border-radius:6px;background:#f8fafc}.po-audience-options button{min-width:0;border:0;border-right:1px solid #e2e8f0;background:transparent;color:#475569;padding:0 8px;font-size:12px;font-weight:650}.po-audience-options button:last-child{border-right:0}.po-audience-options button[aria-pressed=true]{background:var(--po-primary);color:#fff}.po-audience-options button:disabled{cursor:not-allowed;opacity:.55}.po-messages{display:grid;align-content:start;gap:14px;min-height:0;flex:1;overflow:auto;padding:18px 4px 18px 0}.po-message{display:grid;max-width:82%;gap:6px;border:1px solid var(--po-soft-border);border-radius:14px;padding:11px 13px;line-height:1.55;white-space:pre-wrap;word-break:break-word}.po-message b{font-size:12px;opacity:.78}.po-message.user{justify-self:end;border-color:var(--po-primary);background:var(--po-primary);color:#fff}.po-message.assistant{justify-self:start;background:var(--po-soft)}.po-message.run-selected{border-color:#93c5fd;box-shadow:0 0 0 2px #3b82f614}.po-answer-meta{display:flex;min-width:0;align-items:center;flex-wrap:wrap;gap:6px 10px;border-top:1px solid var(--po-soft-border);margin-top:5px;padding-top:8px;color:var(--po-muted);font-size:11px}.po-answer-meta.selected{color:#1d4ed8}.po-run-id{display:flex;min-width:0;max-width:100%;align-items:center;gap:5px}.po-run-id code{display:block;max-width:148px;overflow:hidden;background:transparent;color:inherit;padding:0;text-overflow:ellipsis;white-space:nowrap}.po-answer-meta button{border:0;background:transparent;color:var(--po-primary-dark);padding:2px 0;font-size:11px;font-weight:700}.po-answer-meta button:hover{text-decoration:underline}.po-message.streaming{border-color:#bfdbfe;background:#eff6ff}.po-message.answer-error{border-color:#fecaca;background:#fff7f7;color:#991b1b}.po-message.answer-error>strong{color:#7f1d1d}.po-stream-stopped{justify-self:start;color:var(--po-muted);font-size:12px}.po-ai-waiting{display:inline-flex;align-items:center;gap:9px;min-height:24px;color:#475569}.po-ai-spinner{width:16px;height:16px;flex:0 0 auto;border:2px solid #bfdbfe;border-top-color:var(--po-primary);border-radius:50%;animation:po-ai-spin .7s linear infinite}.po-typing-cursor{display:inline-block;width:2px;height:1em;margin-left:3px;background:var(--po-primary);vertical-align:-.12em;animation:po-typing-cursor .8s steps(1,end) infinite}@keyframes po-ai-spin{to{transform:rotate(360deg)}}@keyframes po-typing-cursor{50%{opacity:0}}.po-message code{border-radius:5px;background:#eaf0ff;color:var(--po-primary-dark);padding:1px 5px}.po-message pre{max-width:100%;margin:8px 0;overflow:auto;border:1px solid var(--po-border);border-radius:6px;background:#f8fafc;padding:10px 12px;white-space:pre}.po-message pre code{border-radius:0;background:transparent;color:#1f2937;padding:0}.po-message h2,.po-message h3,.po-message h4,.po-message p{margin:8px 0}.po-message table{width:100%;margin:12px 0;border-collapse:collapse;border-radius:10px;font-size:14px}.po-message th,.po-message td{border:1px solid var(--po-border);padding:8px 10px;text-align:left;vertical-align:top}.po-message th{background:#eef5ff;color:#334155;font-weight:800}.po-composer{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px;border-top:1px solid var(--po-soft-border);padding-top:12px}.po-composer textarea{min-height:88px;resize:vertical;padding:10px}.po-composer button{min-height:44px;padding:0 16px}.po-composer .po-stop{display:grid;width:44px;height:44px;min-height:44px;place-items:center;border:1px solid #fecaca;background:#fff;color:#dc2626;padding:0}.po-stop span{width:12px;height:12px;border-radius:2px;background:currentcolor}.po-trace{display:flex;min-height:0;flex-direction:column;border-left:1px solid var(--po-soft-border);background:#fafbff}.po-trace header{padding:18px}.po-trace header button{width:32px;height:32px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:#334155;font-size:20px;line-height:1}.po-trace section{display:grid;align-content:start;gap:12px;min-height:0;overflow:auto;padding:16px}.po-steps{display:grid;gap:12px}.po-source-uploader{display:grid;gap:8px;padding-bottom:4px}.po-source-uploader p{margin:0;color:var(--po-muted);font-size:12px;line-height:1.5}.po-upload-button{display:inline-flex;justify-content:center;border:1px solid #bfdbfe;border-radius:6px;background:#eff6ff;color:var(--po-primary-dark);padding:8px 10px;font-weight:750;cursor:pointer}.po-source-reference{display:grid;grid-template-columns:1fr 1fr;overflow:hidden;border:1px solid #cbd5e1;border-radius:6px;background:#fff}.po-source-reference label{display:flex;align-items:center;justify-content:center;gap:6px;min-height:32px;color:#475569;font-size:12px;font-weight:700;cursor:pointer}.po-source-reference label+label{border-left:1px solid #cbd5e1}.po-source-reference label:has(input:checked){background:#eef2ff;color:var(--po-primary-dark)}.po-source-reference input{accent-color:var(--po-primary)}.po-source-reference-value,.po-source-remark{box-sizing:border-box;width:100%;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:var(--po-text);padding:8px 9px;font:inherit;font-size:12px;outline:none}.po-source-reference-value:focus,.po-source-remark:focus{border-color:var(--po-primary);box-shadow:0 0 0 2px #4f46e51f}.po-source-remark{min-height:54px;resize:vertical}.po-upload-button input{display:none}.po-upload-status{color:#166534!important}.po-upload-progress{height:7px;overflow:hidden;border-radius:999px;background:#dbeafe}.po-upload-progress span{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#2563eb,#14b8a6);transition:width .2s ease}.po-upload-empty{color:#92400e!important}.po-source-selector{display:grid;gap:5px;color:var(--po-muted);font-size:12px;font-weight:700}.po-source-selector select{width:100%;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:var(--po-text);padding:7px 8px;font-size:12px;outline:none}.po-source-selector select:focus{border-color:var(--po-primary);box-shadow:0 0 0 2px #4f46e51f}.po-source-selector select:disabled{cursor:not-allowed;opacity:.62}.po-source-list{display:grid;gap:6px}.po-source-item{display:grid;gap:3px;border:1px solid #dbeafe;border-radius:6px;background:#f8fbff;padding:8px}.po-source-item.selected{border-color:#93c5fd;background:#eff6ff;box-shadow:0 0 0 1px #3b82f61f}.po-source-item strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.po-source-item span{color:var(--po-muted);font-size:12px}.po-composer textarea:disabled,.po-composer button:disabled{cursor:not-allowed;opacity:.62}.po-upload-error{color:#b91c1c!important}.po-step{border:1px solid var(--po-soft-border);border-radius:8px;background:#fff;padding:12px}.po-step.running{border-color:#bfdbfe;background:#eff6ff}.po-step.completed{border-color:#bbf7d0}.po-step.failed{border-color:#fecaca;background:#fff1f2}.po-step.cancelled{border-color:#cbd5e1;background:#f8fafc}.po-step summary{display:grid;grid-template-columns:9px minmax(0,1fr) auto;align-items:start;gap:9px;cursor:pointer}.po-step summary::marker{display:none;content:""}.po-step[data-static] summary{cursor:default}.po-step-dot{width:8px;height:8px;margin-top:5px;border:2px solid #94a3b8;border-radius:50%;background:#fff}.po-step.running .po-step-dot{border-color:#2563eb;animation:po-step-pulse 1.2s ease-in-out infinite}.po-step.completed .po-step-dot{border-color:#16a34a;background:#16a34a}.po-step.failed .po-step-dot{border-color:#dc2626;background:#dc2626}.po-step-copy{display:grid;min-width:0;gap:4px}.po-step-copy strong{font-size:13px}.po-step-copy small{color:var(--po-muted);font-size:12px;font-weight:500;line-height:1.45}.po-step-status{color:var(--po-muted);font-size:11px;white-space:nowrap}.po-step-metrics{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 0}.po-step-metrics span{border:1px solid #dbeafe;border-radius:4px;background:#f8fbff;color:#475569;padding:2px 6px;font-size:11px}.po-step-details{display:grid;gap:8px;margin:10px 0 0 18px;border-top:1px solid var(--po-soft-border);padding-top:9px}.po-step-details div{display:grid;gap:3px}.po-step-details span{color:var(--po-muted);font-size:11px}.po-step-details p{overflow-wrap:anywhere;margin:0;color:#334155;font-size:12px;line-height:1.5;white-space:pre-wrap}.po-trace-state{display:flex;align-items:center;gap:8px;border:1px solid var(--po-soft-border);border-radius:8px;background:#fff;color:var(--po-muted);padding:12px;font-size:12px}.po-trace-state.failed{border-color:#fecaca;color:#b91c1c}@keyframes po-step-pulse{50%{opacity:.35}}@media(max-width:900px){.po-panel{inset:12px;grid-template-columns:1fr;overflow:auto}.po-sidebar,.po-trace{min-height:220px;border:0}.po-chat{min-height:520px}.po-chat header{align-items:flex-start;flex-wrap:wrap}.po-audience{width:100%;justify-content:space-between}.po-message{max-width:94%}}@media(prefers-reduced-motion:reduce){.po-ai-spinner,.po-step-dot,.po-typing-cursor{animation:none}}
|
|
1
|
+
.pageops-sdk{--po-text: #172033;--po-muted: #64748b;--po-border: #dbe5f5;--po-soft-border: #e2e8f0;--po-surface: #ffffff;--po-soft: #f8fafc;--po-panel: #fbfdff;--po-primary: #2563eb;--po-primary-dark: #1d4ed8;--po-shadow: 0 24px 70px rgb(15 23 42 / 18%);color:var(--po-text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.pageops-sdk *,.pageops-sdk *:before,.pageops-sdk *:after{box-sizing:border-box}.pageops-sdk button,.pageops-sdk input,.pageops-sdk textarea,.pageops-sdk select{font:inherit}.pageops-sdk button{cursor:pointer}.po-fab{position:fixed;top:var(--pageops-fab-top,50%);right:24px;bottom:auto;z-index:2147483000;border:0;border-radius:999px;padding:12px 18px;background:linear-gradient(135deg,#2563eb,#14b8a6);color:#fff;font-weight:800;box-shadow:0 18px 42px #2563eb47;transform:translateY(-50%);cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}.po-fab.po-fab-dragging{cursor:grabbing}.po-panel{position:fixed;inset:40px;z-index:2147483000;display:grid;grid-template-columns:250px minmax(0,1fr) 340px;min-height:520px;overflow:hidden;border:1px solid var(--po-border);border-radius:24px;background:var(--po-surface);box-shadow:var(--po-shadow)}.po-sidebar{display:flex;min-width:0;min-height:0;flex-direction:column;gap:12px;overflow:hidden;border-right:1px solid #dbeafe;background:#eef5ff;padding:16px}.po-brand{display:flex;align-items:center;gap:10px}.po-brand strong,.po-brand span{display:block}.po-brand span{margin-top:2px;color:var(--po-muted);font-size:12px}.po-logo{width:34px;height:34px;flex:0 0 auto;border-radius:12px;background:linear-gradient(135deg,#5eead4,#2563eb)}.po-new,.po-composer button{border:0;border-radius:10px;background:var(--po-primary);color:#fff;font-weight:750}.po-new{width:100%;padding:10px 12px}.po-search,.po-composer textarea{width:100%;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:var(--po-text);outline:none}.po-search{padding:9px 10px}.po-thread-list{display:grid;align-content:start;gap:8px;min-height:0;overflow:auto}.po-thread-row{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 32px;align-items:center;border:1px solid transparent;border-radius:10px}.po-thread-row.active{border-color:#bfdbfe;background:#fff}.po-thread{display:grid;gap:4px;width:100%;border:0;border-radius:10px;background:transparent;color:#334155;padding:9px 10px;text-align:left}.po-thread-row.active .po-thread{color:var(--po-text)}.po-thread span{color:#94a3b8;font-size:12px}.po-thread-delete{display:grid;width:28px;height:28px;place-items:center;border:0;border-radius:6px;background:transparent;color:#94a3b8;opacity:0}.po-thread-row:hover .po-thread-delete,.po-thread-row:focus-within .po-thread-delete{opacity:1}.po-thread-delete:hover{background:#fee2e2;color:#b91c1c}.po-thread-delete:disabled{cursor:not-allowed;opacity:.35}.po-trash-icon{position:relative;width:11px;height:12px;border:1.5px solid currentcolor;border-top:0;border-radius:0 0 2px 2px}.po-trash-icon:before{position:absolute;top:-4px;left:-2px;width:13px;border-top:1.5px solid currentcolor;content:""}.po-trash-icon:after{position:absolute;top:-6px;left:3px;width:4px;height:2px;border:1.5px solid currentcolor;border-bottom:0;border-radius:2px 2px 0 0;content:""}.po-conversation-error{margin:0;color:#b91c1c;font-size:12px}.po-chat{display:flex;min-width:0;min-height:0;flex-direction:column;background:linear-gradient(180deg,#fff,var(--po-panel));padding:22px 26px}.po-chat header,.po-trace header{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--po-soft-border);padding-bottom:14px}.po-chat header p,.po-chat header h2,.po-trace header h2{margin:0}.po-chat header p,.po-chat header span{color:var(--po-muted);font-size:12px}.po-chat header h2,.po-trace header h2{font-size:20px;letter-spacing:0}.po-chat-title{min-width:0}.po-chat-title h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.po-audience{display:flex;flex:0 0 auto;align-items:center;gap:8px}.po-audience>span{white-space:nowrap}.po-audience-options{display:grid;grid-template-columns:repeat(4,44px);height:32px;overflow:hidden;border:1px solid #cbd5e1;border-radius:6px;background:#f8fafc}.po-audience-options button{min-width:0;border:0;border-right:1px solid #e2e8f0;background:transparent;color:#475569;padding:0 8px;font-size:12px;font-weight:650}.po-audience-options button:last-child{border-right:0}.po-audience-options button[aria-pressed=true]{background:var(--po-primary);color:#fff}.po-audience-options button:disabled{cursor:not-allowed;opacity:.55}.po-messages{display:grid;align-content:start;gap:14px;min-height:0;flex:1;overflow:auto;padding:18px 4px 18px 0}.po-message{display:grid;max-width:82%;gap:6px;border:1px solid var(--po-soft-border);border-radius:14px;padding:11px 13px;line-height:1.55;white-space:pre-wrap;word-break:break-word}.po-message b{font-size:12px;opacity:.78}.po-message.user{justify-self:end;border-color:var(--po-primary);background:var(--po-primary);color:#fff}.po-message.assistant{justify-self:start;background:var(--po-soft)}.po-message.run-selected{border-color:#93c5fd;box-shadow:0 0 0 2px #3b82f614}.po-answer-meta{display:flex;min-width:0;align-items:center;flex-wrap:wrap;gap:6px 10px;border-top:1px solid var(--po-soft-border);margin-top:5px;padding-top:8px;color:var(--po-muted);font-size:11px}.po-answer-meta.selected{color:#1d4ed8}.po-run-id{display:flex;min-width:0;max-width:100%;align-items:center;gap:5px}.po-run-id code{display:block;max-width:148px;overflow:hidden;background:transparent;color:inherit;padding:0;text-overflow:ellipsis;white-space:nowrap}.po-answer-meta button{border:0;background:transparent;color:var(--po-primary-dark);padding:2px 0;font-size:11px;font-weight:700}.po-answer-meta button:hover{text-decoration:underline}.po-message.streaming{border-color:#bfdbfe;background:#eff6ff}.po-message.answer-error{border-color:#fecaca;background:#fff7f7;color:#991b1b}.po-message.answer-error>strong{color:#7f1d1d}.po-stream-stopped{justify-self:start;color:var(--po-muted);font-size:12px}.po-ai-waiting{display:inline-flex;align-items:center;gap:9px;min-height:24px;color:#475569}.po-ai-spinner{width:16px;height:16px;flex:0 0 auto;border:2px solid #bfdbfe;border-top-color:var(--po-primary);border-radius:50%;animation:po-ai-spin .7s linear infinite}.po-typing-cursor{display:inline-block;width:2px;height:1em;margin-left:3px;background:var(--po-primary);vertical-align:-.12em;animation:po-typing-cursor .8s steps(1,end) infinite}@keyframes po-ai-spin{to{transform:rotate(360deg)}}@keyframes po-typing-cursor{50%{opacity:0}}.po-message code{border-radius:5px;background:#eaf0ff;color:var(--po-primary-dark);padding:1px 5px}.po-message pre{max-width:100%;margin:8px 0;overflow:auto;border:1px solid var(--po-border);border-radius:6px;background:#f8fafc;padding:10px 12px;white-space:pre}.po-message pre code{border-radius:0;background:transparent;color:#1f2937;padding:0}.po-message h2,.po-message h3,.po-message h4,.po-message p{margin:8px 0}.po-message table{width:100%;margin:12px 0;border-collapse:collapse;border-radius:10px;font-size:14px}.po-message th,.po-message td{border:1px solid var(--po-border);padding:8px 10px;text-align:left;vertical-align:top}.po-message th{background:#eef5ff;color:#334155;font-weight:800}.po-composer{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px;border-top:1px solid var(--po-soft-border);padding-top:12px}.po-composer textarea{min-height:88px;resize:vertical;padding:10px}.po-composer button{min-height:44px;padding:0 16px}.po-composer .po-stop{display:grid;width:44px;height:44px;min-height:44px;place-items:center;border:1px solid #fecaca;background:#fff;color:#dc2626;padding:0}.po-stop span{width:12px;height:12px;border-radius:2px;background:currentcolor}.po-trace{display:flex;min-height:0;flex-direction:column;border-left:1px solid var(--po-soft-border);background:#fafbff}.po-trace header{padding:18px}.po-trace header button{width:32px;height:32px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:#334155;font-size:20px;line-height:1}.po-trace section{display:grid;align-content:start;gap:12px;min-height:0;overflow:auto;padding:16px}.po-steps{display:grid;gap:12px}.po-source-uploader{display:grid;gap:8px;padding-bottom:4px}.po-source-uploader p{margin:0;color:var(--po-muted);font-size:12px;line-height:1.5}.po-upload-button{display:inline-flex;justify-content:center;border:1px solid #bfdbfe;border-radius:6px;background:#eff6ff;color:var(--po-primary-dark);padding:8px 10px;font-weight:750;cursor:pointer}.po-source-reference{display:grid;grid-template-columns:1fr 1fr;overflow:hidden;border:1px solid #cbd5e1;border-radius:6px;background:#fff}.po-source-reference label{display:flex;align-items:center;justify-content:center;gap:6px;min-height:32px;color:#475569;font-size:12px;font-weight:700;cursor:pointer}.po-source-reference label+label{border-left:1px solid #cbd5e1}.po-source-reference label:has(input:checked){background:#eef2ff;color:var(--po-primary-dark)}.po-source-reference input{accent-color:var(--po-primary)}.po-source-reference-value,.po-source-remark{box-sizing:border-box;width:100%;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:var(--po-text);padding:8px 9px;font:inherit;font-size:12px;outline:none}.po-source-reference-value:focus,.po-source-remark:focus{border-color:var(--po-primary);box-shadow:0 0 0 2px #4f46e51f}.po-source-remark{min-height:54px;resize:vertical}.po-upload-button input{display:none}.po-upload-status{color:#166534!important}.po-upload-progress{height:7px;overflow:hidden;border-radius:999px;background:#dbeafe}.po-upload-progress span{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#2563eb,#14b8a6);transition:width .2s ease}.po-upload-empty{color:#92400e!important}.po-source-selector{display:grid;gap:5px;color:var(--po-muted);font-size:12px;font-weight:700}.po-source-selector select{width:100%;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:var(--po-text);padding:7px 8px;font-size:12px;outline:none}.po-source-selector select:focus{border-color:var(--po-primary);box-shadow:0 0 0 2px #4f46e51f}.po-source-selector select:disabled{cursor:not-allowed;opacity:.62}.po-source-list{display:grid;gap:6px}.po-source-item{display:grid;gap:3px;border:1px solid #dbeafe;border-radius:6px;background:#f8fbff;padding:8px}.po-source-item.selected{border-color:#93c5fd;background:#eff6ff;box-shadow:0 0 0 1px #3b82f61f}.po-source-item strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.po-source-item span{color:var(--po-muted);font-size:12px}.po-composer textarea:disabled,.po-composer button:disabled{cursor:not-allowed;opacity:.62}.po-upload-error{color:#b91c1c!important}.po-step{border:1px solid var(--po-soft-border);border-radius:8px;background:#fff;padding:12px}.po-step.running{border-color:#bfdbfe;background:#eff6ff}.po-step.completed{border-color:#bbf7d0}.po-step.failed{border-color:#fecaca;background:#fff1f2}.po-step.cancelled{border-color:#cbd5e1;background:#f8fafc}.po-step summary{display:grid;grid-template-columns:9px minmax(0,1fr) auto;align-items:start;gap:9px;cursor:pointer}.po-step summary::marker{display:none;content:""}.po-step[data-static] summary{cursor:default}.po-step-dot{width:8px;height:8px;margin-top:5px;border:2px solid #94a3b8;border-radius:50%;background:#fff}.po-step.running .po-step-dot{border-color:#2563eb;animation:po-step-pulse 1.2s ease-in-out infinite}.po-step.completed .po-step-dot{border-color:#16a34a;background:#16a34a}.po-step.failed .po-step-dot{border-color:#dc2626;background:#dc2626}.po-step-copy{display:grid;min-width:0;gap:4px}.po-step-copy strong{font-size:13px}.po-step-copy small{color:var(--po-muted);font-size:12px;font-weight:500;line-height:1.45}.po-step-status{color:var(--po-muted);font-size:11px;white-space:nowrap}.po-step-metrics{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 0}.po-step-metrics span{border:1px solid #dbeafe;border-radius:4px;background:#f8fbff;color:#475569;padding:2px 6px;font-size:11px}.po-step-details{display:grid;gap:8px;margin:10px 0 0 18px;border-top:1px solid var(--po-soft-border);padding-top:9px}.po-step-details div{display:grid;gap:3px}.po-step-details span{color:var(--po-muted);font-size:11px}.po-step-details p{overflow-wrap:anywhere;margin:0;color:#334155;font-size:12px;line-height:1.5;white-space:pre-wrap}.po-trace-state{display:flex;align-items:center;gap:8px;border:1px solid var(--po-soft-border);border-radius:8px;background:#fff;color:var(--po-muted);padding:12px;font-size:12px}.po-trace-state.failed{border-color:#fecaca;color:#b91c1c}@keyframes po-step-pulse{50%{opacity:.35}}@media(max-width:900px){.po-panel{inset:12px;grid-template-columns:1fr;overflow:auto}.po-sidebar,.po-trace{min-height:220px;border:0}.po-chat{min-height:520px}.po-chat header{align-items:flex-start;flex-wrap:wrap}.po-audience{width:100%;justify-content:space-between}.po-message{max-width:94%}}@media(max-width:600px){.po-fab{right:12px}}@media(prefers-reduced-motion:reduce){.po-ai-spinner,.po-step-dot,.po-typing-cursor{animation:none}}
|
package/dist/pageops-sdk.es.js
CHANGED
|
@@ -210,6 +210,8 @@ class V {
|
|
|
210
210
|
i(this, "streamFailure", "");
|
|
211
211
|
i(this, "streamDone", null);
|
|
212
212
|
i(this, "answerAudience", "business");
|
|
213
|
+
i(this, "floatingRatio", 0.5);
|
|
214
|
+
i(this, "floatingCleanup", null);
|
|
213
215
|
i(this, "typewriter", new Q((e) => {
|
|
214
216
|
this.streaming += e, this.updateStreamingMessage();
|
|
215
217
|
}));
|
|
@@ -220,10 +222,10 @@ class V {
|
|
|
220
222
|
}
|
|
221
223
|
unmount() {
|
|
222
224
|
var e;
|
|
223
|
-
this.stopSourceRefresh(), this.cancelActiveAnswer(!1), this.resetAnswerState(), (e = this.root) == null || e.remove(), this.root = null, this.panel = null, this.context = null, this.contextKey = "", this.selectedPageKey = "", this.currentThread = null, this.conversations = [], this.messages = [], this.steps = [], this.selectedAgentRunId = "", this.runLoading = !1, this.runLoadError = "", this.clearCopyFeedback(), this.sourceSnapshots = [], this.selectedSourceSnapshotId = null, this.sourceUploadStatus = "", this.sourceUploadProgress = null, this.sourceUploadError = "", this.sourceLoadError = "", this.sourceUploading = !1, this.answerAudience = "business";
|
|
225
|
+
this.cleanupFloatingLauncher(), this.stopSourceRefresh(), this.cancelActiveAnswer(!1), this.resetAnswerState(), (e = this.root) == null || e.remove(), this.root = null, this.panel = null, this.context = null, this.contextKey = "", this.selectedPageKey = "", this.currentThread = null, this.conversations = [], this.messages = [], this.steps = [], this.selectedAgentRunId = "", this.runLoading = !1, this.runLoadError = "", this.clearCopyFeedback(), this.sourceSnapshots = [], this.selectedSourceSnapshotId = null, this.sourceUploadStatus = "", this.sourceUploadProgress = null, this.sourceUploadError = "", this.sourceLoadError = "", this.sourceUploading = !1, this.answerAudience = "business";
|
|
224
226
|
}
|
|
225
227
|
open() {
|
|
226
|
-
this.root && (this.root.innerHTML = "", this.panel = document.createElement("div"), this.panel.className = "po-panel", this.root.appendChild(this.panel), this.loadSources(), this.loadConversations(), this.renderPanel());
|
|
228
|
+
this.root && (this.cleanupFloatingLauncher(), this.root.innerHTML = "", this.panel = document.createElement("div"), this.panel.className = "po-panel", this.root.appendChild(this.panel), this.loadSources(), this.loadConversations(), this.renderPanel());
|
|
227
229
|
}
|
|
228
230
|
close() {
|
|
229
231
|
this.stopSourceRefresh(), this.cancelActiveAnswer(!1), this.renderClosed();
|
|
@@ -235,7 +237,58 @@ class V {
|
|
|
235
237
|
}
|
|
236
238
|
renderClosed() {
|
|
237
239
|
var e;
|
|
238
|
-
this.root && (this.root.innerHTML = '<button class="po-fab" type="button">多轮问答</button>',
|
|
240
|
+
this.root && (this.cleanupFloatingLauncher(), this.root.innerHTML = '<button class="po-fab" type="button">多轮问答</button>', e = this.root.querySelector("button"), e && (this.bindFloatingLauncher(e), e.addEventListener("click", () => this.open())));
|
|
241
|
+
}
|
|
242
|
+
floatingStorageKey() {
|
|
243
|
+
var e;
|
|
244
|
+
return `pageops:floating-position:${((e = this.options) == null ? void 0 : e.appId) || "default"}`;
|
|
245
|
+
}
|
|
246
|
+
loadFloatingRatio() {
|
|
247
|
+
try {
|
|
248
|
+
const e = localStorage.getItem(this.floatingStorageKey());
|
|
249
|
+
if (e === null) return 0.5;
|
|
250
|
+
const t = Number(e);
|
|
251
|
+
return Number.isFinite(t) && t >= 0 && t <= 1 ? t : 0.5;
|
|
252
|
+
} catch (e) {
|
|
253
|
+
return 0.5;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
saveFloatingRatio() {
|
|
257
|
+
try {
|
|
258
|
+
localStorage.setItem(this.floatingStorageKey(), String(this.floatingRatio));
|
|
259
|
+
} catch (e) {
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
setFloatingPosition(e, t) {
|
|
263
|
+
if (!this.root) return;
|
|
264
|
+
const s = Math.max(e.getBoundingClientRect().height / 2, 24), r = 12 + s, n = window.innerHeight - 12 - s, c = n < r ? (r + n) / 2 : Math.min(Math.max(t, r), n);
|
|
265
|
+
this.floatingRatio = window.innerHeight > 0 ? c / window.innerHeight : 0.5, this.root.style.setProperty("--pageops-fab-top", `${c}px`);
|
|
266
|
+
}
|
|
267
|
+
bindFloatingLauncher(e) {
|
|
268
|
+
this.cleanupFloatingLauncher(), this.floatingRatio = this.loadFloatingRatio(), this.setFloatingPosition(e, window.innerHeight * this.floatingRatio);
|
|
269
|
+
let t = null, s = !1;
|
|
270
|
+
const r = (o) => {
|
|
271
|
+
if (!t || o.pointerId !== t.pointerId) return;
|
|
272
|
+
s = t.moved, e.classList.remove("po-fab-dragging"), e.hasPointerCapture && e.hasPointerCapture(o.pointerId) && e.releasePointerCapture(o.pointerId), t.moved && this.saveFloatingRatio(), t = null;
|
|
273
|
+
}, n = (o) => {
|
|
274
|
+
if (typeof o.button == "number" && o.button !== 0) return;
|
|
275
|
+
const l = e.getBoundingClientRect();
|
|
276
|
+
t = { pointerId: o.pointerId, startClientY: o.clientY, startCenterY: l.top + l.height / 2, moved: !1 }, e.setPointerCapture && e.setPointerCapture(o.pointerId), e.classList.add("po-fab-dragging");
|
|
277
|
+
}, c = (o) => {
|
|
278
|
+
if (!t || o.pointerId !== t.pointerId) return;
|
|
279
|
+
const l = o.clientY - t.startClientY;
|
|
280
|
+
!t.moved && Math.abs(l) >= 4 && (t.moved = !0), t.moved && (o.preventDefault(), this.setFloatingPosition(e, t.startCenterY + l));
|
|
281
|
+
}, p = (o) => {
|
|
282
|
+
s && (s = !1, o.preventDefault(), o.stopImmediatePropagation());
|
|
283
|
+
}, m = () => {
|
|
284
|
+
e.isConnected && this.setFloatingPosition(e, window.innerHeight * this.floatingRatio);
|
|
285
|
+
};
|
|
286
|
+
e.addEventListener("pointerdown", n), e.addEventListener("pointermove", c), e.addEventListener("pointerup", r), e.addEventListener("pointercancel", r), e.addEventListener("click", p, !0), window.addEventListener("resize", m), this.floatingCleanup = () => {
|
|
287
|
+
e.removeEventListener("pointerdown", n), e.removeEventListener("pointermove", c), e.removeEventListener("pointerup", r), e.removeEventListener("pointercancel", r), e.removeEventListener("click", p, !0), window.removeEventListener("resize", m);
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
cleanupFloatingLauncher() {
|
|
291
|
+
this.floatingCleanup && (this.floatingCleanup(), this.floatingCleanup = null), this.root && this.root.style.removeProperty("--pageops-fab-top");
|
|
239
292
|
}
|
|
240
293
|
async ensureContext() {
|
|
241
294
|
if (!this.client || !this.options) throw new Error("PageOps SDK 未初始化");
|
package/dist/pageops-sdk.umd.cjs
CHANGED
|
@@ -210,6 +210,8 @@ class V {
|
|
|
210
210
|
i(this, "streamFailure", "");
|
|
211
211
|
i(this, "streamDone", null);
|
|
212
212
|
i(this, "answerAudience", "business");
|
|
213
|
+
i(this, "floatingRatio", 0.5);
|
|
214
|
+
i(this, "floatingCleanup", null);
|
|
213
215
|
i(this, "typewriter", new Q((e) => {
|
|
214
216
|
this.streaming += e, this.updateStreamingMessage();
|
|
215
217
|
}));
|
|
@@ -220,10 +222,10 @@ class V {
|
|
|
220
222
|
}
|
|
221
223
|
unmount() {
|
|
222
224
|
var e;
|
|
223
|
-
this.stopSourceRefresh(), this.cancelActiveAnswer(false), this.resetAnswerState(), (e = this.root) == null || e.remove(), this.root = null, this.panel = null, this.context = null, this.contextKey = "", this.selectedPageKey = "", this.currentThread = null, this.conversations = [], this.messages = [], this.steps = [], this.selectedAgentRunId = "", this.runLoading = false, this.runLoadError = "", this.clearCopyFeedback(), this.sourceSnapshots = [], this.selectedSourceSnapshotId = null, this.sourceUploadStatus = "", this.sourceUploadProgress = null, this.sourceUploadError = "", this.sourceLoadError = "", this.sourceUploading = false, this.answerAudience = "business";
|
|
225
|
+
this.cleanupFloatingLauncher(), this.stopSourceRefresh(), this.cancelActiveAnswer(false), this.resetAnswerState(), (e = this.root) == null || e.remove(), this.root = null, this.panel = null, this.context = null, this.contextKey = "", this.selectedPageKey = "", this.currentThread = null, this.conversations = [], this.messages = [], this.steps = [], this.selectedAgentRunId = "", this.runLoading = false, this.runLoadError = "", this.clearCopyFeedback(), this.sourceSnapshots = [], this.selectedSourceSnapshotId = null, this.sourceUploadStatus = "", this.sourceUploadProgress = null, this.sourceUploadError = "", this.sourceLoadError = "", this.sourceUploading = false, this.answerAudience = "business";
|
|
224
226
|
}
|
|
225
227
|
open() {
|
|
226
|
-
this.root && (this.root.innerHTML = "", this.panel = document.createElement("div"), this.panel.className = "po-panel", this.root.appendChild(this.panel), this.loadSources(), this.loadConversations(), this.renderPanel());
|
|
228
|
+
this.root && (this.cleanupFloatingLauncher(), this.root.innerHTML = "", this.panel = document.createElement("div"), this.panel.className = "po-panel", this.root.appendChild(this.panel), this.loadSources(), this.loadConversations(), this.renderPanel());
|
|
227
229
|
}
|
|
228
230
|
close() {
|
|
229
231
|
this.stopSourceRefresh(), this.cancelActiveAnswer(false), this.renderClosed();
|
|
@@ -235,7 +237,58 @@ class V {
|
|
|
235
237
|
}
|
|
236
238
|
renderClosed() {
|
|
237
239
|
var e;
|
|
238
|
-
this.root && (this.root.innerHTML = '<button class="po-fab" type="button">多轮问答</button>',
|
|
240
|
+
this.root && (this.cleanupFloatingLauncher(), this.root.innerHTML = '<button class="po-fab" type="button">多轮问答</button>', e = this.root.querySelector("button"), e && (this.bindFloatingLauncher(e), e.addEventListener("click", () => this.open())));
|
|
241
|
+
}
|
|
242
|
+
floatingStorageKey() {
|
|
243
|
+
var e;
|
|
244
|
+
return `pageops:floating-position:${((e = this.options) == null ? void 0 : e.appId) || "default"}`;
|
|
245
|
+
}
|
|
246
|
+
loadFloatingRatio() {
|
|
247
|
+
try {
|
|
248
|
+
const e = localStorage.getItem(this.floatingStorageKey());
|
|
249
|
+
if (e === null) return 0.5;
|
|
250
|
+
const t = Number(e);
|
|
251
|
+
return Number.isFinite(t) && t >= 0 && t <= 1 ? t : 0.5;
|
|
252
|
+
} catch (e) {
|
|
253
|
+
return 0.5;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
saveFloatingRatio() {
|
|
257
|
+
try {
|
|
258
|
+
localStorage.setItem(this.floatingStorageKey(), String(this.floatingRatio));
|
|
259
|
+
} catch (e) {
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
setFloatingPosition(e, t) {
|
|
263
|
+
if (!this.root) return;
|
|
264
|
+
const s = Math.max(e.getBoundingClientRect().height / 2, 24), r = 12 + s, n = window.innerHeight - 12 - s, c = n < r ? (r + n) / 2 : Math.min(Math.max(t, r), n);
|
|
265
|
+
this.floatingRatio = window.innerHeight > 0 ? c / window.innerHeight : 0.5, this.root.style.setProperty("--pageops-fab-top", `${c}px`);
|
|
266
|
+
}
|
|
267
|
+
bindFloatingLauncher(e) {
|
|
268
|
+
this.cleanupFloatingLauncher(), this.floatingRatio = this.loadFloatingRatio(), this.setFloatingPosition(e, window.innerHeight * this.floatingRatio);
|
|
269
|
+
let t = null, s = false;
|
|
270
|
+
const r = (o) => {
|
|
271
|
+
if (!t || o.pointerId !== t.pointerId) return;
|
|
272
|
+
s = t.moved, e.classList.remove("po-fab-dragging"), e.hasPointerCapture && e.hasPointerCapture(o.pointerId) && e.releasePointerCapture(o.pointerId), t.moved && this.saveFloatingRatio(), t = null;
|
|
273
|
+
}, n = (o) => {
|
|
274
|
+
if (typeof o.button == "number" && o.button !== 0) return;
|
|
275
|
+
const l = e.getBoundingClientRect();
|
|
276
|
+
t = { pointerId: o.pointerId, startClientY: o.clientY, startCenterY: l.top + l.height / 2, moved: false }, e.setPointerCapture && e.setPointerCapture(o.pointerId), e.classList.add("po-fab-dragging");
|
|
277
|
+
}, c = (o) => {
|
|
278
|
+
if (!t || o.pointerId !== t.pointerId) return;
|
|
279
|
+
const l = o.clientY - t.startClientY;
|
|
280
|
+
!t.moved && Math.abs(l) >= 4 && (t.moved = true), t.moved && (o.preventDefault(), this.setFloatingPosition(e, t.startCenterY + l));
|
|
281
|
+
}, p = (o) => {
|
|
282
|
+
s && (s = false, o.preventDefault(), o.stopImmediatePropagation());
|
|
283
|
+
}, m = () => {
|
|
284
|
+
e.isConnected && this.setFloatingPosition(e, window.innerHeight * this.floatingRatio);
|
|
285
|
+
};
|
|
286
|
+
e.addEventListener("pointerdown", n), e.addEventListener("pointermove", c), e.addEventListener("pointerup", r), e.addEventListener("pointercancel", r), e.addEventListener("click", p, true), window.addEventListener("resize", m), this.floatingCleanup = () => {
|
|
287
|
+
e.removeEventListener("pointerdown", n), e.removeEventListener("pointermove", c), e.removeEventListener("pointerup", r), e.removeEventListener("pointercancel", r), e.removeEventListener("click", p, true), window.removeEventListener("resize", m);
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
cleanupFloatingLauncher() {
|
|
291
|
+
this.floatingCleanup && (this.floatingCleanup(), this.floatingCleanup = null), this.root && this.root.style.removeProperty("--pageops-fab-top");
|
|
239
292
|
}
|
|
240
293
|
async ensureContext() {
|
|
241
294
|
if (!this.client || !this.options) throw new Error("PageOps SDK 未初始化");
|
|
@@ -698,4 +751,4 @@ function G(a) {
|
|
|
698
751
|
function Z(a) {
|
|
699
752
|
return { pending: "等待中", running: "执行中", completed: "已完成", failed: "失败", cancelled: "已停止" }[a];
|
|
700
753
|
}
|
|
701
|
-
const Y = new V();exports.PageOpsSDK=Y;}));
|
|
754
|
+
const Y = new V();exports.PageOpsSDK=Y;}));
|