comisai 1.0.24 → 1.0.26
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/node_modules/@comis/agent/dist/bootstrap/sections/tool-descriptions.js +130 -10
- package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.d.ts +1 -1
- package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.js +9 -2
- package/node_modules/@comis/agent/dist/bridge/bridge-metrics.d.ts +8 -0
- package/node_modules/@comis/agent/dist/bridge/bridge-metrics.js +2 -0
- package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.d.ts +29 -0
- package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.js +242 -2
- package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.d.ts +210 -0
- package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.js +566 -0
- package/node_modules/@comis/agent/dist/context-engine/context-engine.js +8 -6
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.d.ts +51 -30
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.js +109 -36
- package/node_modules/@comis/agent/dist/executor/executor-context-engine-setup.js +5 -1
- package/node_modules/@comis/agent/dist/executor/executor-post-execution.js +22 -20
- package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.d.ts +2 -0
- package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +111 -15
- package/node_modules/@comis/agent/dist/executor/executor-response-filter.d.ts +20 -17
- package/node_modules/@comis/agent/dist/executor/executor-response-filter.js +132 -52
- package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +16 -3
- package/node_modules/@comis/agent/dist/executor/model-retry.d.ts +14 -0
- package/node_modules/@comis/agent/dist/executor/model-retry.js +72 -1
- package/node_modules/@comis/agent/dist/executor/pi-executor.d.ts +3 -0
- package/node_modules/@comis/agent/dist/executor/pi-executor.js +68 -9
- package/node_modules/@comis/agent/dist/executor/post-batch-continuation.d.ts +82 -0
- package/node_modules/@comis/agent/dist/executor/post-batch-continuation.js +200 -0
- package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.js +1 -9
- package/node_modules/@comis/agent/dist/executor/tool-deferral.d.ts +37 -2
- package/node_modules/@comis/agent/dist/executor/tool-deferral.js +45 -3
- package/node_modules/@comis/agent/dist/executor/tool-parallelism.js +0 -1
- package/node_modules/@comis/agent/dist/executor/types.d.ts +11 -2
- package/node_modules/@comis/agent/dist/index.d.ts +3 -1
- package/node_modules/@comis/agent/dist/index.js +2 -0
- package/node_modules/@comis/agent/dist/model/last-known-model.d.ts +36 -0
- package/node_modules/@comis/agent/dist/model/last-known-model.js +49 -0
- package/node_modules/@comis/agent/dist/model/model-registry-adapter.d.ts +16 -4
- package/node_modules/@comis/agent/dist/model/model-registry-adapter.js +65 -21
- package/node_modules/@comis/agent/dist/planner/types.d.ts +0 -2
- package/node_modules/@comis/agent/dist/session/comis-session-manager.d.ts +10 -0
- package/node_modules/@comis/agent/dist/session/comis-session-manager.js +5 -0
- package/node_modules/@comis/agent/dist/spawn/pi-mono-adapters.js +7 -0
- package/node_modules/@comis/agent/package.json +1 -1
- package/node_modules/@comis/channels/package.json +1 -1
- package/node_modules/@comis/cli/dist/client/rpc-client.js +6 -1
- package/node_modules/@comis/cli/dist/commands/doctor.js +5 -3
- package/node_modules/@comis/cli/dist/commands/health.js +5 -2
- package/node_modules/@comis/cli/dist/wizard/json-output.js +7 -3
- package/node_modules/@comis/cli/dist/wizard/steps/11-daemon-start.js +130 -0
- package/node_modules/@comis/cli/package.json +1 -1
- package/node_modules/@comis/core/dist/bootstrap.js +5 -0
- package/node_modules/@comis/core/dist/config/env-layer.d.ts +31 -0
- package/node_modules/@comis/core/dist/config/env-layer.js +41 -0
- package/node_modules/@comis/core/dist/config/immutable-keys.d.ts +2 -2
- package/node_modules/@comis/core/dist/config/immutable-keys.js +8 -3
- package/node_modules/@comis/core/dist/config/layered.d.ts +9 -0
- package/node_modules/@comis/core/dist/config/layered.js +11 -0
- package/node_modules/@comis/core/dist/config/managed-sections.d.ts +43 -4
- package/node_modules/@comis/core/dist/config/managed-sections.js +100 -6
- package/node_modules/@comis/core/dist/config/schema-agent.d.ts +39 -0
- package/node_modules/@comis/core/dist/config/schema-agent.js +14 -0
- package/node_modules/@comis/core/dist/config/schema.d.ts +4 -0
- package/node_modules/@comis/core/dist/config/schema.js +14 -0
- package/node_modules/@comis/core/dist/domain/execution-graph.d.ts +1 -1
- package/node_modules/@comis/core/dist/event-bus/events-agent.d.ts +17 -2
- package/node_modules/@comis/core/dist/exports/config.d.ts +2 -2
- package/node_modules/@comis/core/dist/exports/config.js +1 -1
- package/node_modules/@comis/core/package.json +1 -1
- package/node_modules/@comis/daemon/dist/daemon.d.ts +22 -0
- package/node_modules/@comis/daemon/dist/daemon.js +45 -0
- package/node_modules/@comis/daemon/dist/rpc/agent-handlers.d.ts +5 -2
- package/node_modules/@comis/daemon/dist/rpc/agent-handlers.js +80 -1
- package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.d.ts +67 -0
- package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.js +139 -0
- package/node_modules/@comis/daemon/dist/rpc/model-handlers.d.ts +3 -0
- package/node_modules/@comis/daemon/dist/rpc/model-handlers.js +29 -5
- package/node_modules/@comis/daemon/dist/rpc/probe-provider-auth.d.ts +30 -0
- package/node_modules/@comis/daemon/dist/rpc/probe-provider-auth.js +59 -0
- package/node_modules/@comis/daemon/dist/rpc/provider-handlers.d.ts +37 -0
- package/node_modules/@comis/daemon/dist/rpc/provider-handlers.js +330 -0
- package/node_modules/@comis/daemon/dist/rpc/rpc-dispatch.js +18 -1
- package/node_modules/@comis/daemon/dist/setup-docker-restart-warn.d.ts +4 -0
- package/node_modules/@comis/daemon/dist/setup-docker-restart-warn.js +30 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-agents.d.ts +3 -1
- package/node_modules/@comis/daemon/dist/wiring/setup-agents.js +28 -2
- package/node_modules/@comis/daemon/dist/wiring/setup-cross-session.js +1 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-tools.js +7 -4
- package/node_modules/@comis/daemon/package.json +1 -1
- package/node_modules/@comis/gateway/package.json +1 -1
- package/node_modules/@comis/infra/dist/index.d.ts +1 -0
- package/node_modules/@comis/infra/dist/index.js +2 -0
- package/node_modules/@comis/infra/dist/runtime/is-docker.d.ts +1 -0
- package/node_modules/@comis/infra/dist/runtime/is-docker.js +25 -0
- package/node_modules/@comis/infra/package.json +1 -1
- package/node_modules/@comis/memory/package.json +1 -1
- package/node_modules/@comis/scheduler/package.json +1 -1
- package/node_modules/@comis/shared/package.json +1 -1
- package/node_modules/@comis/skills/dist/bridge/tool-metadata-registry.js +1 -3
- package/node_modules/@comis/skills/dist/builtin/platform/admin-manage-factory.js +24 -1
- package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.d.ts +53 -7
- package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.js +218 -24
- package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.d.ts +4 -1
- package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.js +16 -1
- package/node_modules/@comis/skills/dist/builtin/platform/index.d.ts +1 -1
- package/node_modules/@comis/skills/dist/builtin/platform/index.js +1 -1
- package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.d.ts +56 -0
- package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.js +203 -0
- package/node_modules/@comis/skills/dist/index.d.ts +1 -1
- package/node_modules/@comis/skills/dist/index.js +2 -2
- package/node_modules/@comis/skills/dist/policy/tool-policy.js +0 -1
- package/node_modules/@comis/skills/package.json +1 -1
- package/node_modules/@comis/web/dist/assets/{agent-detail-BG9MGWWj.js → agent-detail-DqL6Artv.js} +270 -270
- package/node_modules/@comis/web/dist/assets/agent-editor-CNM_h94Y.js +2173 -0
- package/node_modules/@comis/web/dist/assets/{agent-list-LHCJ4rw2.js → agent-list-Dbh-xD_F.js} +170 -170
- package/node_modules/@comis/web/dist/assets/{approvals-q9VH_IKr.js → approvals-C-K6hN2U.js} +13 -13
- package/node_modules/@comis/web/dist/assets/billing-view-C1DmtyzK.js +375 -0
- package/node_modules/@comis/web/dist/assets/{channel-detail-CaInesJM.js → channel-detail-CtCH22N1.js} +265 -265
- package/node_modules/@comis/web/dist/assets/channel-list-C7xXn-60.js +323 -0
- package/node_modules/@comis/web/dist/assets/{chat-console-CNmzl0JW.js → chat-console-C51pjFwk.js} +243 -246
- package/node_modules/@comis/web/dist/assets/{config-editor-DX4ITw6y.js → config-editor-BLArYRB7.js} +477 -477
- package/node_modules/@comis/web/dist/assets/{context-dag-browser-BwiaF5tf.js → context-dag-browser-fuyMinNI.js} +105 -105
- package/node_modules/@comis/web/dist/assets/{context-engine-BZ5Am6hA.js → context-engine-Bngf2bH0.js} +136 -136
- package/node_modules/@comis/web/dist/assets/decorate-BvWYovGE.js +38 -0
- package/node_modules/@comis/web/dist/assets/{delivery-view-OfBZof-m.js → delivery-view-C80hucxX.js} +134 -134
- package/node_modules/@comis/web/dist/assets/{diagnostics-view-YFwCxgr2.js → diagnostics-view-Cl4VbHZ6.js} +82 -82
- package/node_modules/@comis/web/dist/assets/directive-BOYXJ-K-.js +1 -0
- package/node_modules/@comis/web/dist/assets/{extract-variables-BM5qyK-s.js → extract-variables-B7-Doo7l.js} +39 -39
- package/node_modules/@comis/web/dist/assets/{ic-array-editor-B7m6x7-S.js → ic-array-editor-BLoEyeLS.js} +29 -29
- package/node_modules/@comis/web/dist/assets/{ic-breadcrumb-CUMpp3BL.js → ic-breadcrumb-DqN6G3gc.js} +16 -16
- package/node_modules/@comis/web/dist/assets/{ic-budget-segment-bar-BtJ6x5mN.js → ic-budget-segment-bar-zLsMzjDO.js} +20 -20
- package/node_modules/@comis/web/dist/assets/ic-chat-message-ByFUoMm6.js +352 -0
- package/node_modules/@comis/web/dist/assets/{ic-confirm-dialog-CCDbB04e.js → ic-confirm-dialog-DGlPbV1T.js} +26 -26
- package/node_modules/@comis/web/dist/assets/{ic-connection-dot-CnT1b8xr.js → ic-connection-dot-C4nDHgY2.js} +13 -13
- package/node_modules/@comis/web/dist/assets/ic-data-table-CKIvr-ag.js +277 -0
- package/node_modules/@comis/web/dist/assets/ic-delivery-row-B3YwjjuM.js +67 -0
- package/node_modules/@comis/web/dist/assets/{ic-detail-panel-BF83r-if.js → ic-detail-panel-DiCe4hLr.js} +27 -27
- package/node_modules/@comis/web/dist/assets/{ic-empty-state-60l2ePhd.js → ic-empty-state-CM3Wbj2f.js} +19 -19
- package/node_modules/@comis/web/dist/assets/ic-graph-canvas-ByRjij68.js +359 -0
- package/node_modules/@comis/web/dist/assets/ic-icon-BGNCCPpZ.js +33 -0
- package/node_modules/@comis/web/dist/assets/{ic-layer-waterfall-COvEYMg5.js → ic-layer-waterfall-WkaFyu-l.js} +18 -18
- package/node_modules/@comis/web/dist/assets/ic-relative-time-B3UAnTqg.js +12 -0
- package/node_modules/@comis/web/dist/assets/{ic-search-input-CSOxY9g7.js → ic-search-input-B02AGw1i.js} +22 -22
- package/node_modules/@comis/web/dist/assets/{ic-select-Ce-Raudx.js → ic-select-BqfZISjw.js} +29 -29
- package/node_modules/@comis/web/dist/assets/ic-tabs-yBjkWKJH.js +95 -0
- package/node_modules/@comis/web/dist/assets/ic-tag-CvMVQFRR.js +33 -0
- package/node_modules/@comis/web/dist/assets/{ic-time-range-picker-CypCT68y.js → ic-time-range-picker-DXbYeBmY.js} +31 -31
- package/node_modules/@comis/web/dist/assets/{ic-tool-call-7MaXSsCW.js → ic-tool-call-Bh5kq-yY.js} +51 -51
- package/node_modules/@comis/web/dist/assets/index-BBkuC-EU.js +2792 -0
- package/node_modules/@comis/web/dist/assets/index-CVEaS9aY.css +2 -0
- package/node_modules/@comis/web/dist/assets/{mcp-management-BNZPnpDn.js → mcp-management-DB-phOo7.js} +209 -209
- package/node_modules/@comis/web/dist/assets/{media-config-BBvTYxOX.js → media-config-CRqZ1ZUH.js} +154 -154
- package/node_modules/@comis/web/dist/assets/{media-test-BkK3RCRK.js → media-test-C9vE20Oy.js} +259 -259
- package/node_modules/@comis/web/dist/assets/{memory-inspector-1hDGCGat.js → memory-inspector-CeqfnxMZ.js} +450 -450
- package/node_modules/@comis/web/dist/assets/{message-center-CXefwsUu.js → message-center-Daup7Mof.js} +290 -290
- package/node_modules/@comis/web/dist/assets/{models-C1qcU_j3.js → models-DLYnEU8E.js} +371 -371
- package/node_modules/@comis/web/dist/assets/observability-types-D0tkwElU.js +1 -0
- package/node_modules/@comis/web/dist/assets/{observe-view-C0VBhX4C.js → observe-view-BTSt_PO5.js} +399 -399
- package/node_modules/@comis/web/dist/assets/pipeline-builder-DknfzyLt.js +1495 -0
- package/node_modules/@comis/web/dist/assets/{pipeline-history-DkfOQ6SW.js → pipeline-history-JnHZdeU_.js} +124 -124
- package/node_modules/@comis/web/dist/assets/{pipeline-history-detail-hyHgD0ai.js → pipeline-history-detail-Dg4knsEb.js} +65 -65
- package/node_modules/@comis/web/dist/assets/{pipeline-list-BPW8hV-q.js → pipeline-list-AEnibjsp.js} +227 -227
- package/node_modules/@comis/web/dist/assets/{pipeline-monitor-Bip16T7e.js → pipeline-monitor-DG7RbIOO.js} +298 -298
- package/node_modules/@comis/web/dist/assets/{scheduler-BGgwKd06.js → scheduler-uL1fYKAT.js} +486 -486
- package/node_modules/@comis/web/dist/assets/{security-D15st4xx.js → security-C3DywRLH.js} +389 -389
- package/node_modules/@comis/web/dist/assets/{session-detail-SGEYNJ0M.js → session-detail-BtqCNWXV.js} +294 -294
- package/node_modules/@comis/web/dist/assets/session-key-parser-Dkqcj2Ss.js +1 -0
- package/node_modules/@comis/web/dist/assets/session-list-CJXWa2XT.js +231 -0
- package/node_modules/@comis/web/dist/assets/{setup-wizard-nT0tz9QP.js → setup-wizard-ywn7oJvu.js} +486 -494
- package/node_modules/@comis/web/dist/assets/{skills-D8yVfSUy.js → skills-DX0KYnWD.js} +329 -329
- package/node_modules/@comis/web/dist/assets/{subagents-HHXMeHYo.js → subagents-B8p5YJEB.js} +74 -74
- package/node_modules/@comis/web/dist/assets/{workspace-manager-BQlr10iH.js → workspace-manager-CgzNIrw1.js} +236 -236
- package/node_modules/@comis/web/dist/index.html +3 -2
- package/node_modules/@comis/web/package.json +1 -1
- package/package.json +15 -15
- package/node_modules/@comis/skills/dist/builtin/platform/agents-list-tool.d.ts +0 -19
- package/node_modules/@comis/skills/dist/builtin/platform/agents-list-tool.js +0 -39
- package/node_modules/@comis/web/dist/assets/agent-editor-C26Q_xCs.js +0 -2173
- package/node_modules/@comis/web/dist/assets/billing-view-CtYvBqTE.js +0 -375
- package/node_modules/@comis/web/dist/assets/channel-list-B8dj3O9a.js +0 -323
- package/node_modules/@comis/web/dist/assets/directive-DoeGSK_T.js +0 -1
- package/node_modules/@comis/web/dist/assets/ic-chat-message-CFyDJd0z.js +0 -352
- package/node_modules/@comis/web/dist/assets/ic-data-table-CKUNTxHw.js +0 -277
- package/node_modules/@comis/web/dist/assets/ic-delivery-row-GP5Fkygs.js +0 -67
- package/node_modules/@comis/web/dist/assets/ic-graph-canvas-C8FuSMe1.js +0 -359
- package/node_modules/@comis/web/dist/assets/ic-icon-xeGTVhVG.js +0 -33
- package/node_modules/@comis/web/dist/assets/ic-relative-time-3FqpjeAI.js +0 -12
- package/node_modules/@comis/web/dist/assets/ic-tabs-B7QtM_v8.js +0 -95
- package/node_modules/@comis/web/dist/assets/ic-tag-CPPUnDLF.js +0 -33
- package/node_modules/@comis/web/dist/assets/index-CEcM1R_C.js +0 -2830
- package/node_modules/@comis/web/dist/assets/index-CIJFuItj.css +0 -1
- package/node_modules/@comis/web/dist/assets/observability-types-D7jUtSde.js +0 -1
- package/node_modules/@comis/web/dist/assets/pipeline-builder-DcUUIrm0.js +0 -1496
- package/node_modules/@comis/web/dist/assets/session-key-parser-DPORMVyU.js +0 -1
- package/node_modules/@comis/web/dist/assets/session-list-6ybUTxbY.js +0 -231
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import{A as h,E as j,s as _,f as O,i as C,n as b,r as I,a as k,b as d,t as T,I as D}from"./index-CEcM1R_C.js";import{e as E,i as S,t as H}from"./directive-DoeGSK_T.js";import"./ic-icon-xeGTVhVG.js";class w extends S{constructor(e){if(super(e),this.it=h,e.type!==H.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===h||e==null)return this._t=void 0,this.it=e;if(e===j)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const s=[e];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}w.directiveName="unsafeHTML",w.resultType=1;const L=E(w);var B=Object.defineProperty,M=Object.getOwnPropertyDescriptor,y=(i,e,s,n)=>{for(var t=n>1?void 0:n?M(e,s):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(t=(n?a(e,s,t):a(t))||t);return n&&t&&B(e,s,t),t};const P=new Set(["const","let","var","function","return","if","else","for","while","import","export","from","true","false","null","undefined","class","new","this","async","await","throw","try","catch","switch","case","break","continue","default","typeof","instanceof","void","delete","in","of","yield","static","extends","implements","interface","type","enum","abstract","readonly"]);function $(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function R(i,e){if(!e)return $(i);const s=e.toLowerCase();let t=$(i);return t=t.replace(/\/\*[\s\S]*?\*\//g,r=>`<span class="hl-comment">${r}</span>`),t=t.replace(/\/\/[^\n]*/g,r=>r.includes("hl-comment")?r:`<span class="hl-comment">${r}</span>`),(s==="yaml"||s==="yml"||s==="bash"||s==="sh"||s==="python"||s==="py")&&(t=t.replace(new RegExp("(?:^|(?<=\\n))(\\s*#[^\\n]*)","g"),r=>`<span class="hl-comment">${r}</span>`)),t=t.replace(new RegExp('(?<!<span class=")("(?:[^&]|&(?!quot;))*?")',"g"),r=>r.includes("hl-")?r:`<span class="hl-string">${r}</span>`),t=t.replace(new RegExp("(?<![=\\w])('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')","g"),r=>r.includes("hl-")?r:`<span class="hl-string">${r}</span>`),t=t.replace(/\b(\d+(?:\.\d+)?)\b/g,r=>r.includes("hl-")?r:`<span class="hl-number">${r}</span>`),(s==="json"||s==="yaml"||s==="yml")&&(t=t.replace(new RegExp("(?:^|(?<=\\n))(\\s*)("[\\w.-]+")(\\s*:)","gm"),(r,a,c,o)=>`${a}<span class="hl-property">${c}</span>${o}`),(s==="yaml"||s==="yml")&&(t=t.replace(new RegExp("(?:^|(?<=\\n))(\\s*)([\\w.-]+)(\\s*:)","gm"),(r,a,c,o)=>c.includes("hl-")?r:`${a}<span class="hl-property">${c}</span>${o}`))),(s==="javascript"||s==="js"||s==="typescript"||s==="ts"||s==="jsx"||s==="tsx")&&(t=t.replace(/\b([a-z]+)\b/g,r=>P.has(r)?`<span class="hl-keyword">${r}</span>`:r)),t}let m=class extends k{constructor(){super(...arguments),this.code="",this.language="",this.copyable=!0,this._copied=!1,this._copyTimer=null}disconnectedCallback(){super.disconnectedCallback(),this._copyTimer!==null&&(clearTimeout(this._copyTimer),this._copyTimer=null)}async _handleCopy(){try{await navigator.clipboard.writeText(this.code),this._copied=!0,this._copyTimer!==null&&clearTimeout(this._copyTimer),this._copyTimer=setTimeout(()=>{this._copied=!1,this._copyTimer=null},2e3)}catch{}}_renderHeader(){return!this.language&&!this.copyable?h:d`
|
|
2
|
-
<div class="header">
|
|
3
|
-
<span class="language-label">${this.language||""}</span>
|
|
4
|
-
${this.copyable?d`
|
|
5
|
-
<button
|
|
6
|
-
class="copy-btn"
|
|
7
|
-
@click=${this._handleCopy}
|
|
8
|
-
aria-label="Copy code"
|
|
9
|
-
>
|
|
10
|
-
${this._copied?d`<span>Copied!</span>`:d`<ic-icon name="copy" size="14px"></ic-icon><span>Copy</span>`}
|
|
11
|
-
</button>
|
|
12
|
-
`:h}
|
|
13
|
-
</div>
|
|
14
|
-
`}render(){const i=R(this.code,this.language);return d`
|
|
15
|
-
<div class="container" role="region" aria-label="Code block">
|
|
16
|
-
${this._renderHeader()}
|
|
17
|
-
<div class="code-area">
|
|
18
|
-
<pre><code .innerHTML=${i}></code></pre>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
`}};m.styles=[_,O,C`
|
|
22
|
-
:host {
|
|
23
|
-
display: block;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.container {
|
|
27
|
-
background: var(--ic-bg);
|
|
28
|
-
border: 1px solid var(--ic-border);
|
|
29
|
-
border-radius: var(--ic-radius-md);
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.header {
|
|
34
|
-
display: flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
justify-content: space-between;
|
|
37
|
-
background: var(--ic-surface-2);
|
|
38
|
-
padding: var(--ic-space-xs) var(--ic-space-md);
|
|
39
|
-
border-bottom: 1px solid var(--ic-border);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.language-label {
|
|
43
|
-
font-size: var(--ic-text-xs);
|
|
44
|
-
color: var(--ic-text-dim);
|
|
45
|
-
text-transform: uppercase;
|
|
46
|
-
letter-spacing: 0.04em;
|
|
47
|
-
font-weight: 500;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.copy-btn {
|
|
51
|
-
display: inline-flex;
|
|
52
|
-
align-items: center;
|
|
53
|
-
gap: 4px;
|
|
54
|
-
background: none;
|
|
55
|
-
border: none;
|
|
56
|
-
color: var(--ic-text-dim);
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
padding: 2px 4px;
|
|
59
|
-
border-radius: var(--ic-radius-sm);
|
|
60
|
-
font-size: var(--ic-text-xs);
|
|
61
|
-
font-family: inherit;
|
|
62
|
-
transition: color var(--ic-transition);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.copy-btn:hover {
|
|
66
|
-
color: var(--ic-text);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.code-area {
|
|
70
|
-
max-height: 24rem;
|
|
71
|
-
overflow-y: auto;
|
|
72
|
-
overflow-x: auto;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
pre {
|
|
76
|
-
margin: 0;
|
|
77
|
-
padding: var(--ic-space-md);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
code {
|
|
81
|
-
font-family: var(--ic-font-mono);
|
|
82
|
-
font-size: var(--ic-text-sm);
|
|
83
|
-
line-height: 1.6;
|
|
84
|
-
color: var(--ic-text);
|
|
85
|
-
white-space: pre;
|
|
86
|
-
tab-size: 2;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/* Syntax highlighting colors */
|
|
90
|
-
.hl-string { color: #a5d6ff; }
|
|
91
|
-
.hl-number { color: #79c0ff; }
|
|
92
|
-
.hl-keyword { color: #ff7b72; }
|
|
93
|
-
.hl-comment { color: var(--ic-text-dim); font-style: italic; }
|
|
94
|
-
.hl-property { color: #7ee787; }
|
|
95
|
-
`];y([b()],m.prototype,"code",2);y([b()],m.prototype,"language",2);y([b({type:Boolean})],m.prototype,"copyable",2);y([I()],m.prototype,"_copied",2);m=y([T("ic-code-block")],m);var q=Object.defineProperty,A=Object.getOwnPropertyDescriptor,g=(i,e,s,n)=>{for(var t=n>1?void 0:n?A(e,s):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(t=(n?a(e,s,t):a(t))||t);return n&&t&&q(e,s,t),t};function N(i){let e=i;return e=e.replace(/<\/?(?:script|iframe|object|embed|form)\b[^>]*>/gi,""),e=e.replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*)/gi,""),e=e.replace(/javascript\s*:/gi,""),e}function f(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function K(i){if(i.length<2)return i.join(`
|
|
96
|
-
`);const e=i.filter(a=>a.trim()!=="");if(e.length<2||!/^\s*\|[\s-:|]+\|\s*$/.test(e[1]))return i.join(`
|
|
97
|
-
`);const s=a=>a.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(c=>c.trim()),n=s(e[0]),t=e.slice(2);let r="<table><thead><tr>";for(const a of n)r+=`<th>${a}</th>`;r+="</tr></thead><tbody>";for(const a of t){const c=s(a);r+="<tr>";for(const o of c)r+=`<td>${o}</td>`;r+="</tr>"}return r+="</tbody></table>",r}function U(i,e){try{const{url:s,type:n,fileName:t}=JSON.parse(i),r=e&&s.startsWith("/media/")?`${s}${s.includes("?")?"&":"?"}token=${encodeURIComponent(e)}`:s,a=f(r),c=f(t);switch(n){case"image":return`<img src="${a}" alt="${c}" style="max-width:100%;border-radius:8px;margin:4px 0" loading="lazy" />`;case"audio":return`<audio controls src="${a}" style="width:100%;margin:4px 0"></audio>`;case"video":return`<video controls src="${a}" style="max-width:100%;border-radius:8px;margin:4px 0"></video>`;default:return`<a href="${a}" download="${c}" target="_blank" rel="noopener" class="md-link">${c}</a>`}}catch{return""}}function J(i,e=""){let s=N(i);const n=[];s=s.replace(/```(\w*)\n([\s\S]*?)```/g,(o,p,l)=>{const v=f(l.replace(/\n$/,"")),z=`\0CODE_BLOCK_${n.length}\0`;return n.push(`<ic-code-block language="${f(p)}" code="${v}"></ic-code-block>`),z}),s=s.replace(/`([^`]+)`/g,(o,p)=>`<code class="inline-code">${f(p)}</code>`);const t=s.split(`
|
|
98
|
-
`),r=[];let a=0;for(;a<t.length;){const o=t[a];if(o.includes("\0CODE_BLOCK_")){const l=o.match(/\x00CODE_BLOCK_(\d+)\x00/);if(l){r.push(n[parseInt(l[1],10)]),a++;continue}}if(/^\s*\|/.test(o)){const l=[o];for(a++;a<t.length&&/^\s*\|/.test(t[a]);)l.push(t[a]),a++;r.push(K(l));continue}const p=o.match(/^(#{1,4})\s+(.+)$/);if(p){const l=Math.min(p[1].length+2,6);r.push(`<h${l}>${x(p[2])}</h${l}>`),a++;continue}if(/^\s*[-*]\s+/.test(o)){const l=[];for(;a<t.length&&/^\s*[-*]\s+/.test(t[a]);)l.push(x(t[a].replace(/^\s*[-*]\s+/,""))),a++;r.push(`<ul>${l.map(v=>`<li>${v}</li>`).join("")}</ul>`);continue}if(/^\s*\d+\.\s+/.test(o)){const l=[];for(;a<t.length&&/^\s*\d+\.\s+/.test(t[a]);)l.push(x(t[a].replace(/^\s*\d+\.\s+/,""))),a++;r.push(`<ol>${l.map(v=>`<li>${v}</li>`).join("")}</ol>`);continue}if(o.trim()===""){r.push("<br><br>"),a++;continue}r.push(x(o)),a++}let c=r.join(`
|
|
99
|
-
`);return c=c.replace(/<!-- attachment:(.*?) -->/g,(o,p)=>U(p,e)),c}function x(i){let e=i;return e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(s,n,t)=>`<a href="${f(t)}" target="_blank" rel="noopener noreferrer" class="md-link">${n}</a>`),e=e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),e=e.replace(/__(.+?)__/g,"<strong>$1</strong>"),e=e.replace(new RegExp("(?<!\\w)\\*([^*]+)\\*(?!\\w)","g"),"<em>$1</em>"),e=e.replace(new RegExp("(?<!\\w)_([^_]+)_(?!\\w)","g"),"<em>$1</em>"),e}let u=class extends k{constructor(){super(...arguments),this.role="user",this.content="",this.timestamp=0,this.messageId="",this.showActions=!0,this.mediaToken=""}_handleCopy(){navigator.clipboard.writeText(this.content).then(()=>{D.show("Copied to clipboard","success")}).catch(()=>{})}_handleRetry(){this.dispatchEvent(new CustomEvent("retry",{detail:{messageId:this.messageId},bubbles:!0,composed:!0}))}_handleDelete(){this.dispatchEvent(new CustomEvent("delete",{detail:{messageId:this.messageId},bubbles:!0,composed:!0}))}_formatTime(i){return new Date(i).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}_renderContent(){if(this.role==="user")return this.content;const i=J(this.content,this.mediaToken);return L(i)}_renderActions(){return!this.showActions||this.role==="system"?h:d`
|
|
100
|
-
<div class="message-actions">
|
|
101
|
-
<button class="action-btn" aria-label="Copy message" @click=${this._handleCopy}>
|
|
102
|
-
<ic-icon name="copy" size="14px"></ic-icon>
|
|
103
|
-
</button>
|
|
104
|
-
${this.role==="assistant"?d`
|
|
105
|
-
<button class="action-btn" aria-label="Retry message" @click=${this._handleRetry}>
|
|
106
|
-
<ic-icon name="retry" size="14px"></ic-icon>
|
|
107
|
-
</button>
|
|
108
|
-
`:h}
|
|
109
|
-
<button class="action-btn" aria-label="Delete message" @click=${this._handleDelete}>
|
|
110
|
-
<ic-icon name="trash" size="14px"></ic-icon>
|
|
111
|
-
</button>
|
|
112
|
-
</div>
|
|
113
|
-
`}render(){const i=`wrapper wrapper--${this.role}`,e=`bubble bubble--${this.role}`;return d`
|
|
114
|
-
<div class=${i} role="article" aria-label="${this.role} message">
|
|
115
|
-
${this._renderActions()}
|
|
116
|
-
<div class=${e}>${this._renderContent()}</div>
|
|
117
|
-
${this.timestamp>0?d`<span class="timestamp">${this._formatTime(this.timestamp)}</span>`:h}
|
|
118
|
-
</div>
|
|
119
|
-
`}};u.styles=[_,C`
|
|
120
|
-
:host {
|
|
121
|
-
display: block;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.wrapper {
|
|
125
|
-
display: flex;
|
|
126
|
-
flex-direction: column;
|
|
127
|
-
max-width: min(80%, 640px);
|
|
128
|
-
width: fit-content;
|
|
129
|
-
position: relative;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/* Role-specific alignment */
|
|
133
|
-
.wrapper--user {
|
|
134
|
-
align-self: flex-end;
|
|
135
|
-
margin-left: auto;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.wrapper--assistant {
|
|
139
|
-
align-self: flex-start;
|
|
140
|
-
margin-right: auto;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.wrapper--error {
|
|
144
|
-
align-self: flex-start;
|
|
145
|
-
margin-right: auto;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.wrapper--system {
|
|
149
|
-
align-self: center;
|
|
150
|
-
max-width: 100%;
|
|
151
|
-
text-align: center;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/* Bubble styles */
|
|
155
|
-
.bubble {
|
|
156
|
-
padding: var(--ic-space-sm) var(--ic-space-md);
|
|
157
|
-
border-radius: var(--ic-radius-xl);
|
|
158
|
-
font-size: var(--ic-text-sm);
|
|
159
|
-
line-height: 1.6;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.bubble--user {
|
|
163
|
-
background: var(--ic-accent);
|
|
164
|
-
color: white;
|
|
165
|
-
border-radius: var(--ic-radius-lg);
|
|
166
|
-
border-bottom-right-radius: 4px;
|
|
167
|
-
white-space: pre-wrap;
|
|
168
|
-
word-break: break-word;
|
|
169
|
-
padding: 6px 12px;
|
|
170
|
-
line-height: 1.4;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.bubble--assistant {
|
|
174
|
-
background: var(--ic-surface);
|
|
175
|
-
color: var(--ic-text);
|
|
176
|
-
border-bottom-left-radius: 4px;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.bubble--error {
|
|
180
|
-
background: color-mix(in srgb, var(--ic-error) 15%, transparent);
|
|
181
|
-
border: 1px solid var(--ic-error);
|
|
182
|
-
color: var(--ic-text);
|
|
183
|
-
border-bottom-left-radius: 4px;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.bubble--system {
|
|
187
|
-
color: var(--ic-text-dim);
|
|
188
|
-
font-size: var(--ic-text-xs);
|
|
189
|
-
font-style: italic;
|
|
190
|
-
padding: var(--ic-space-xs);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/* Timestamp */
|
|
194
|
-
.timestamp {
|
|
195
|
-
font-size: var(--ic-text-xs);
|
|
196
|
-
color: var(--ic-text-dim);
|
|
197
|
-
margin-top: 2px;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.wrapper--user .timestamp {
|
|
201
|
-
text-align: right;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/* Markdown inline styles */
|
|
205
|
-
.bubble--assistant code.inline-code,
|
|
206
|
-
.bubble--error code.inline-code {
|
|
207
|
-
background: var(--ic-surface-2);
|
|
208
|
-
padding: 0.125em 0.375em;
|
|
209
|
-
border-radius: var(--ic-radius-sm);
|
|
210
|
-
font-family: var(--ic-font-mono);
|
|
211
|
-
font-size: 0.9em;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.bubble--assistant strong,
|
|
215
|
-
.bubble--error strong {
|
|
216
|
-
font-weight: 600;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.bubble--assistant a.md-link,
|
|
220
|
-
.bubble--error a.md-link {
|
|
221
|
-
color: var(--ic-accent);
|
|
222
|
-
text-decoration: none;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.bubble--assistant a.md-link:hover,
|
|
226
|
-
.bubble--error a.md-link:hover {
|
|
227
|
-
text-decoration: underline;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.bubble--assistant h3,
|
|
231
|
-
.bubble--assistant h4,
|
|
232
|
-
.bubble--assistant h5,
|
|
233
|
-
.bubble--assistant h6,
|
|
234
|
-
.bubble--error h3,
|
|
235
|
-
.bubble--error h4,
|
|
236
|
-
.bubble--error h5,
|
|
237
|
-
.bubble--error h6 {
|
|
238
|
-
margin: var(--ic-space-sm) 0;
|
|
239
|
-
font-weight: 600;
|
|
240
|
-
line-height: 1.3;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.bubble--assistant h3,
|
|
244
|
-
.bubble--error h3 { font-size: 1.1em; }
|
|
245
|
-
.bubble--assistant h4,
|
|
246
|
-
.bubble--error h4 { font-size: 1.05em; }
|
|
247
|
-
|
|
248
|
-
.bubble--assistant ul,
|
|
249
|
-
.bubble--error ul {
|
|
250
|
-
list-style: disc;
|
|
251
|
-
padding-left: 1.5em;
|
|
252
|
-
margin: var(--ic-space-xs) 0;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.bubble--assistant ol,
|
|
256
|
-
.bubble--error ol {
|
|
257
|
-
list-style: decimal;
|
|
258
|
-
padding-left: 1.5em;
|
|
259
|
-
margin: var(--ic-space-xs) 0;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.bubble--assistant table,
|
|
263
|
-
.bubble--error table {
|
|
264
|
-
border-collapse: collapse;
|
|
265
|
-
border: 1px solid var(--ic-border);
|
|
266
|
-
margin: var(--ic-space-xs) 0;
|
|
267
|
-
width: 100%;
|
|
268
|
-
font-size: var(--ic-text-xs);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
.bubble--assistant th,
|
|
272
|
-
.bubble--assistant td,
|
|
273
|
-
.bubble--error th,
|
|
274
|
-
.bubble--error td {
|
|
275
|
-
padding: var(--ic-space-xs) var(--ic-space-sm);
|
|
276
|
-
border: 1px solid var(--ic-border);
|
|
277
|
-
text-align: left;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.bubble--assistant th,
|
|
281
|
-
.bubble--error th {
|
|
282
|
-
background: var(--ic-surface-2);
|
|
283
|
-
font-weight: 600;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/* Inline attachment media */
|
|
287
|
-
.bubble--assistant img {
|
|
288
|
-
max-width: 100%;
|
|
289
|
-
border-radius: var(--ic-radius-lg);
|
|
290
|
-
margin: var(--ic-space-xs) 0;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.bubble--assistant audio,
|
|
294
|
-
.bubble--assistant video {
|
|
295
|
-
max-width: 100%;
|
|
296
|
-
margin: var(--ic-space-xs) 0;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/* Code blocks inside messages */
|
|
300
|
-
.bubble--assistant ic-code-block,
|
|
301
|
-
.bubble--error ic-code-block {
|
|
302
|
-
margin: var(--ic-space-xs) 0;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/* Message action buttons */
|
|
306
|
-
.message-actions {
|
|
307
|
-
position: absolute;
|
|
308
|
-
top: -0.5rem;
|
|
309
|
-
display: flex;
|
|
310
|
-
gap: 2px;
|
|
311
|
-
background: var(--ic-surface-2);
|
|
312
|
-
border: 1px solid var(--ic-border);
|
|
313
|
-
border-radius: var(--ic-radius-sm);
|
|
314
|
-
padding: 2px;
|
|
315
|
-
box-shadow: var(--ic-shadow-sm);
|
|
316
|
-
opacity: 0;
|
|
317
|
-
transition: opacity var(--ic-transition);
|
|
318
|
-
pointer-events: none;
|
|
319
|
-
z-index: 1;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.wrapper--user .message-actions {
|
|
323
|
-
right: 0;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.wrapper--assistant .message-actions,
|
|
327
|
-
.wrapper--error .message-actions {
|
|
328
|
-
left: 0;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.wrapper:hover .message-actions {
|
|
332
|
-
opacity: 1;
|
|
333
|
-
pointer-events: auto;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.action-btn {
|
|
337
|
-
background: transparent;
|
|
338
|
-
border: none;
|
|
339
|
-
color: var(--ic-text-dim);
|
|
340
|
-
cursor: pointer;
|
|
341
|
-
padding: 4px;
|
|
342
|
-
border-radius: var(--ic-radius-sm);
|
|
343
|
-
display: inline-flex;
|
|
344
|
-
align-items: center;
|
|
345
|
-
justify-content: center;
|
|
346
|
-
transition: color var(--ic-transition);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.action-btn:hover {
|
|
350
|
-
color: var(--ic-text);
|
|
351
|
-
}
|
|
352
|
-
`];g([b()],u.prototype,"role",2);g([b()],u.prototype,"content",2);g([b({type:Number})],u.prototype,"timestamp",2);g([b()],u.prototype,"messageId",2);g([b({type:Boolean})],u.prototype,"showActions",2);g([b()],u.prototype,"mediaToken",2);u=g([T("ic-chat-message")],u);export{L as o,J as r};
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import{s as _,f as x,i as y,n as c,r as g,a as f,b as d,A as p,t as m}from"./index-CEcM1R_C.js";var w=Object.defineProperty,k=Object.getOwnPropertyDescriptor,n=(t,e,r,s)=>{for(var a=s>1?void 0:s?k(e,r):e,i=t.length-1,h;i>=0;i--)(h=t[i])&&(a=(s?h(e,r,a):h(a))||a);return s&&a&&w(e,r,a),a};let o=class extends f{constructor(){super(...arguments),this.columns=[],this.rows=[],this.pageSize=25,this.selectable=!1,this.emptyMessage="No data",this.resizable=!1,this.expandable=!1,this.expandRenderer=null,this._sortKey="",this._sortDir="asc",this._page=0,this._selectedIds=new Set,this._columnWidths=new Map,this._expandedIds=new Set,this._resizing=null,this._boundPointerMove=this._handlePointerMove.bind(this),this._boundPointerUp=this._handlePointerUp.bind(this)}_getRowId(t){if(this.columns.length===0)return"";const e=this.columns[0].key;return String(t[e]??"")}_getCellValue(t,e){return t[e]}_getSortedRows(){const t=[...this.rows];return this._sortKey?t.sort((e,r)=>{const s=this._getCellValue(e,this._sortKey),a=this._getCellValue(r,this._sortKey);let i;return typeof s=="number"&&typeof a=="number"?i=s-a:i=String(s??"").localeCompare(String(a??"")),this._sortDir==="asc"?i:-i}):t}_getPagedRows(){const t=this._getSortedRows(),e=this._page*this.pageSize;return t.slice(e,e+this.pageSize)}_getTotalPages(){return Math.max(1,Math.ceil(this.rows.length/this.pageSize))}_handleSort(t){t.sortable&&(this._sortKey===t.key?this._sortDir=this._sortDir==="asc"?"desc":"asc":(this._sortKey=t.key,this._sortDir="asc"))}_handleRowClick(t,e){const r=e.target.tagName;r==="INPUT"||r==="BUTTON"||this.dispatchEvent(new CustomEvent("row-click",{detail:t,bubbles:!0}))}_handleRowKeydown(t,e){if(e.key==="Enter"||e.key===" ")e.preventDefault(),this.dispatchEvent(new CustomEvent("row-click",{detail:t,bubbles:!0}));else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const r=e.currentTarget,s=e.key==="ArrowDown"?r.nextElementSibling:r.previousElementSibling;s?.classList.contains("grid-row")&&s.focus()}}_handleCheckboxChange(t,e){e.stopPropagation();const r=this._getRowId(t),s=new Set(this._selectedIds);s.has(r)?s.delete(r):s.add(r),this._selectedIds=s,this.dispatchEvent(new CustomEvent("selection-change",{detail:[...this._selectedIds],bubbles:!0}))}_handleSelectAll(t){t.stopPropagation();const e=this._getPagedRows(),r=e.every(a=>this._selectedIds.has(this._getRowId(a))),s=new Set(this._selectedIds);if(r)for(const a of e)s.delete(this._getRowId(a));else for(const a of e)s.add(this._getRowId(a));this._selectedIds=s,this.dispatchEvent(new CustomEvent("selection-change",{detail:[...this._selectedIds],bubbles:!0}))}_handlePrev(){this._page>0&&this._page--}_handleNext(){this._page<this._getTotalPages()-1&&this._page++}_sortArrowClass(t){return this._sortKey===t.key?"sort-indicator sorted":"sort-indicator"}_sortArrow(t){return this._sortKey!==t.key?"":this._sortDir==="asc"?"▲":"▼"}_handleResizeStart(t,e){e.preventDefault(),e.stopPropagation();const r=e.target.parentElement,s=this._columnWidths.get(t.key)??r.offsetWidth;this._resizing={key:t.key,startX:e.clientX,startWidth:s},document.addEventListener("pointermove",this._boundPointerMove),document.addEventListener("pointerup",this._boundPointerUp)}_handlePointerMove(t){if(!this._resizing)return;const e=t.clientX-this._resizing.startX,r=Math.max(50,this._resizing.startWidth+e),s=new Map(this._columnWidths);s.set(this._resizing.key,r),this._columnWidths=s}_handlePointerUp(){this._resizing=null,document.removeEventListener("pointermove",this._boundPointerMove),document.removeEventListener("pointerup",this._boundPointerUp)}_toggleExpand(t,e){e.stopPropagation();const r=this._getRowId(t),s=new Set(this._expandedIds);s.has(r)?s.delete(r):s.add(r),this._expandedIds=s}_getColumnStyle(t){const e=this._columnWidths.get(t.key);return e?`width: ${e}px; flex: none;`:""}render(){if(this.rows.length===0)return d`
|
|
2
|
-
<div class="table-container">
|
|
3
|
-
<div class="empty-message">${this.emptyMessage}</div>
|
|
4
|
-
</div>
|
|
5
|
-
`;const t=this._getPagedRows(),e=this._getTotalPages(),r=this._page*this.pageSize+1,s=Math.min(r+this.pageSize-1,this.rows.length),a=t.length>0&&t.every(i=>this._selectedIds.has(this._getRowId(i)));return d`
|
|
6
|
-
<div class="table-container">
|
|
7
|
-
<div class="table-wrapper">
|
|
8
|
-
<div role="grid">
|
|
9
|
-
<div class="grid-header" role="row">
|
|
10
|
-
${this.expandable?d`<div class="expand-cell header-cell" role="columnheader"></div>`:p}
|
|
11
|
-
${this.selectable?d`
|
|
12
|
-
<div class="checkbox-cell header-cell" role="columnheader">
|
|
13
|
-
<input
|
|
14
|
-
type="checkbox"
|
|
15
|
-
.checked=${a}
|
|
16
|
-
@change=${this._handleSelectAll}
|
|
17
|
-
aria-label="Select all rows"
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
`:p}
|
|
21
|
-
${this.columns.map(i=>d`
|
|
22
|
-
<div
|
|
23
|
-
class="header-cell ${i.sortable?"sortable":""} ${this._sortKey===i.key?"sorted":""}"
|
|
24
|
-
role="columnheader"
|
|
25
|
-
aria-sort=${this._sortKey===i.key?this._sortDir==="asc"?"ascending":"descending":"none"}
|
|
26
|
-
style=${this._getColumnStyle(i)}
|
|
27
|
-
@click=${()=>this._handleSort(i)}
|
|
28
|
-
>
|
|
29
|
-
${i.label}
|
|
30
|
-
<span class=${this._sortArrowClass(i)}>${this._sortArrow(i)}</span>
|
|
31
|
-
${this.resizable?d`<div class="resize-handle" @pointerdown=${h=>this._handleResizeStart(i,h)}></div>`:p}
|
|
32
|
-
</div>
|
|
33
|
-
`)}
|
|
34
|
-
</div>
|
|
35
|
-
${t.map(i=>{const h=this._getRowId(i),u=this._expandedIds.has(h);return d`
|
|
36
|
-
<div class="grid-row focusable" role="row" tabindex="0"
|
|
37
|
-
@click=${l=>this._handleRowClick(i,l)}
|
|
38
|
-
@keydown=${l=>this._handleRowKeydown(i,l)}>
|
|
39
|
-
${this.expandable?d`
|
|
40
|
-
<div class="expand-cell cell" role="cell">
|
|
41
|
-
<button
|
|
42
|
-
class="expand-btn ${u?"expand-btn--open":""}"
|
|
43
|
-
aria-expanded=${u?"true":"false"}
|
|
44
|
-
aria-label=${u?"Collapse row":"Expand row"}
|
|
45
|
-
@click=${l=>this._toggleExpand(i,l)}
|
|
46
|
-
>\u25B6</button>
|
|
47
|
-
</div>
|
|
48
|
-
`:p}
|
|
49
|
-
${this.selectable?d`
|
|
50
|
-
<div class="checkbox-cell cell" role="cell">
|
|
51
|
-
<input
|
|
52
|
-
type="checkbox"
|
|
53
|
-
.checked=${this._selectedIds.has(this._getRowId(i))}
|
|
54
|
-
@change=${l=>this._handleCheckboxChange(i,l)}
|
|
55
|
-
aria-label="Select row"
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
`:p}
|
|
59
|
-
${this.columns.map(l=>{const v=this._getCellValue(i,l.key),b=l.render?l.render(v,i):v;return d`<div class="cell" role="cell" style=${this._getColumnStyle(l)}>${b}</div>`})}
|
|
60
|
-
</div>
|
|
61
|
-
${u&&this.expandRenderer?d`<div class="expanded-content" role="region" aria-label="Row details">${this.expandRenderer(i)}</div>`:p}
|
|
62
|
-
`})}
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
<div class="pagination">
|
|
66
|
-
<span class="pagination-info">${r}-${s} of ${this.rows.length}</span>
|
|
67
|
-
<div class="pagination-controls">
|
|
68
|
-
<button
|
|
69
|
-
class="page-btn"
|
|
70
|
-
?disabled=${this._page===0}
|
|
71
|
-
@click=${this._handlePrev}
|
|
72
|
-
aria-label="Previous page"
|
|
73
|
-
>
|
|
74
|
-
Prev
|
|
75
|
-
</button>
|
|
76
|
-
<button
|
|
77
|
-
class="page-btn"
|
|
78
|
-
?disabled=${this._page>=e-1}
|
|
79
|
-
@click=${this._handleNext}
|
|
80
|
-
aria-label="Next page"
|
|
81
|
-
>
|
|
82
|
-
Next
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
`}};o.styles=[_,x,y`
|
|
88
|
-
:host {
|
|
89
|
-
display: block;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.table-container {
|
|
93
|
-
background: var(--ic-surface);
|
|
94
|
-
border: 1px solid var(--ic-border);
|
|
95
|
-
border-radius: var(--ic-radius-lg);
|
|
96
|
-
overflow: hidden;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.table-wrapper {
|
|
100
|
-
overflow-x: auto;
|
|
101
|
-
overflow-y: auto;
|
|
102
|
-
max-height: var(--table-max-height, none);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.grid-header {
|
|
106
|
-
display: flex;
|
|
107
|
-
background: var(--ic-bg);
|
|
108
|
-
position: sticky;
|
|
109
|
-
top: 0;
|
|
110
|
-
z-index: 1;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.header-cell {
|
|
114
|
-
padding: var(--ic-space-sm) var(--ic-space-md);
|
|
115
|
-
text-transform: uppercase;
|
|
116
|
-
font-size: var(--ic-text-xs);
|
|
117
|
-
color: var(--ic-text-muted);
|
|
118
|
-
letter-spacing: 0.05em;
|
|
119
|
-
font-weight: 600;
|
|
120
|
-
text-align: left;
|
|
121
|
-
white-space: nowrap;
|
|
122
|
-
user-select: none;
|
|
123
|
-
flex: 1;
|
|
124
|
-
min-width: 0;
|
|
125
|
-
position: relative;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.header-cell.sortable {
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.header-cell.sortable:hover {
|
|
133
|
-
color: var(--ic-text);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.header-cell.sorted {
|
|
137
|
-
color: var(--ic-accent);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.sort-indicator {
|
|
141
|
-
display: inline-block;
|
|
142
|
-
margin-left: 4px;
|
|
143
|
-
font-size: 10px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.grid-row {
|
|
147
|
-
display: flex;
|
|
148
|
-
border-top: 1px solid var(--ic-border);
|
|
149
|
-
cursor: pointer;
|
|
150
|
-
transition: background var(--ic-transition);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.grid-row:hover {
|
|
154
|
-
background: var(--ic-surface-2);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.cell {
|
|
158
|
-
padding: var(--ic-space-sm) var(--ic-space-md);
|
|
159
|
-
color: var(--ic-text);
|
|
160
|
-
font-size: var(--ic-text-sm);
|
|
161
|
-
flex: 1;
|
|
162
|
-
min-width: 0;
|
|
163
|
-
overflow: hidden;
|
|
164
|
-
text-overflow: ellipsis;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.checkbox-cell {
|
|
168
|
-
width: 40px;
|
|
169
|
-
flex: none;
|
|
170
|
-
text-align: center;
|
|
171
|
-
display: flex;
|
|
172
|
-
align-items: center;
|
|
173
|
-
justify-content: center;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.expand-cell {
|
|
177
|
-
width: 36px;
|
|
178
|
-
flex: none;
|
|
179
|
-
display: flex;
|
|
180
|
-
align-items: center;
|
|
181
|
-
justify-content: center;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.expand-btn {
|
|
185
|
-
background: none;
|
|
186
|
-
border: none;
|
|
187
|
-
color: var(--ic-text-dim);
|
|
188
|
-
cursor: pointer;
|
|
189
|
-
padding: 4px;
|
|
190
|
-
font-size: 12px;
|
|
191
|
-
transition: transform 0.15s;
|
|
192
|
-
line-height: 1;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.expand-btn:hover {
|
|
196
|
-
color: var(--ic-text);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.expand-btn--open {
|
|
200
|
-
transform: rotate(90deg);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.expanded-content {
|
|
204
|
-
border-top: 1px solid var(--ic-border);
|
|
205
|
-
padding: var(--ic-space-md);
|
|
206
|
-
background: var(--ic-bg);
|
|
207
|
-
font-size: var(--ic-text-sm);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
input[type="checkbox"] {
|
|
211
|
-
accent-color: var(--ic-accent);
|
|
212
|
-
cursor: pointer;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/* Resize handle */
|
|
216
|
-
.resize-handle {
|
|
217
|
-
position: absolute;
|
|
218
|
-
right: 0;
|
|
219
|
-
top: 0;
|
|
220
|
-
bottom: 0;
|
|
221
|
-
width: 4px;
|
|
222
|
-
cursor: col-resize;
|
|
223
|
-
background: transparent;
|
|
224
|
-
z-index: 2;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.resize-handle:hover {
|
|
228
|
-
background: var(--ic-border);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.pagination {
|
|
232
|
-
display: flex;
|
|
233
|
-
align-items: center;
|
|
234
|
-
justify-content: space-between;
|
|
235
|
-
padding: var(--ic-space-sm) var(--ic-space-md);
|
|
236
|
-
border-top: 1px solid var(--ic-border);
|
|
237
|
-
font-size: var(--ic-text-sm);
|
|
238
|
-
color: var(--ic-text-muted);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.pagination-info {
|
|
242
|
-
font-size: var(--ic-text-xs);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.pagination-controls {
|
|
246
|
-
display: flex;
|
|
247
|
-
gap: var(--ic-space-sm);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.page-btn {
|
|
251
|
-
background: transparent;
|
|
252
|
-
border: none;
|
|
253
|
-
color: var(--ic-text-muted);
|
|
254
|
-
cursor: pointer;
|
|
255
|
-
padding: var(--ic-space-xs) var(--ic-space-sm);
|
|
256
|
-
border-radius: var(--ic-radius-sm);
|
|
257
|
-
font-family: inherit;
|
|
258
|
-
font-size: var(--ic-text-sm);
|
|
259
|
-
transition: color var(--ic-transition);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.page-btn:hover:not(:disabled) {
|
|
263
|
-
color: var(--ic-text);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.page-btn:disabled {
|
|
267
|
-
opacity: 0.4;
|
|
268
|
-
cursor: not-allowed;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
.empty-message {
|
|
272
|
-
padding: var(--ic-space-xl);
|
|
273
|
-
text-align: center;
|
|
274
|
-
color: var(--ic-text-muted);
|
|
275
|
-
font-size: var(--ic-text-sm);
|
|
276
|
-
}
|
|
277
|
-
`];n([c({type:Array})],o.prototype,"columns",2);n([c({type:Array})],o.prototype,"rows",2);n([c({type:Number})],o.prototype,"pageSize",2);n([c({type:Boolean})],o.prototype,"selectable",2);n([c()],o.prototype,"emptyMessage",2);n([c({type:Boolean})],o.prototype,"resizable",2);n([c({type:Boolean})],o.prototype,"expandable",2);n([c({attribute:!1})],o.prototype,"expandRenderer",2);n([g()],o.prototype,"_sortKey",2);n([g()],o.prototype,"_sortDir",2);n([g()],o.prototype,"_page",2);n([g()],o.prototype,"_selectedIds",2);n([g()],o.prototype,"_columnWidths",2);n([g()],o.prototype,"_expandedIds",2);o=n([m("ic-data-table")],o);
|