@portel/photon 1.17.2 → 1.17.4

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.
@@ -18147,6 +18147,7 @@ var theme = i`
18147
18147
  border: 1px solid var(--border-glass);
18148
18148
  border-radius: var(--radius-md);
18149
18149
  box-shadow: var(--shadow-sm);
18150
+ color: inherit;
18150
18151
  }
18151
18152
 
18152
18153
  .text-gradient {
@@ -18188,21 +18189,25 @@ var theme = i`
18188
18189
  border-radius: var(--radius-xs);
18189
18190
  }
18190
18191
 
18191
- /* Scrollbar */
18192
+ /* Scrollbar — thin, translucent, doesn't crowd content */
18193
+ * {
18194
+ scrollbar-width: thin;
18195
+ scrollbar-color: color-mix(in srgb, var(--t-muted, #888) 30%, transparent) transparent;
18196
+ }
18192
18197
  ::-webkit-scrollbar {
18193
- width: 8px;
18194
- height: 8px;
18198
+ width: 6px;
18199
+ height: 6px;
18195
18200
  }
18196
18201
  ::-webkit-scrollbar-track {
18197
18202
  background: transparent;
18203
+ margin: 4px 0;
18198
18204
  }
18199
18205
  ::-webkit-scrollbar-thumb {
18200
- background: var(--border-glass);
18201
- border-radius: var(--radius-xs);
18206
+ background: color-mix(in srgb, var(--t-muted) 30%, transparent);
18207
+ border-radius: var(--radius-full);
18202
18208
  }
18203
18209
  ::-webkit-scrollbar-thumb:hover {
18204
- background: var(--t-muted);
18205
- opacity: 0.5;
18210
+ background: color-mix(in srgb, var(--t-muted) 60%, transparent);
18206
18211
  }
18207
18212
  /* Toggle Switch */
18208
18213
  .switch {
@@ -19264,6 +19269,187 @@ function showToast(message, type = "info", duration4 = 3e3, action) {
19264
19269
  ToastManager.show(message, type, duration4, action);
19265
19270
  }
19266
19271
 
19272
+ // src/auto-ui/frontend/components/confirm-dialog.ts
19273
+ var ConfirmDialog = class extends i4 {
19274
+ constructor() {
19275
+ super(...arguments);
19276
+ this.open = false;
19277
+ this.message = "";
19278
+ this.confirmLabel = "OK";
19279
+ this.cancelLabel = "Cancel";
19280
+ this.destructive = false;
19281
+ }
19282
+ show(message, options) {
19283
+ this.message = message;
19284
+ this.confirmLabel = options?.confirm ?? "OK";
19285
+ this.cancelLabel = options?.cancel ?? "Cancel";
19286
+ this.destructive = options?.destructive ?? false;
19287
+ this.open = true;
19288
+ return new Promise((resolve2) => {
19289
+ this._resolve = resolve2;
19290
+ });
19291
+ }
19292
+ _handleConfirm() {
19293
+ this.open = false;
19294
+ this._resolve?.(true);
19295
+ }
19296
+ _handleCancel() {
19297
+ this.open = false;
19298
+ this._resolve?.(false);
19299
+ }
19300
+ _handleKeydown(e8) {
19301
+ if (e8.key === "Escape") this._handleCancel();
19302
+ if (e8.key === "Enter") this._handleConfirm();
19303
+ }
19304
+ render() {
19305
+ return b2`
19306
+ <div class="dialog" @keydown=${(e8) => this._handleKeydown(e8)}>
19307
+ <div class="message">${this.message}</div>
19308
+ <div class="actions">
19309
+ <button class="btn-cancel" @click=${() => this._handleCancel()}>
19310
+ ${this.cancelLabel}
19311
+ </button>
19312
+ <button
19313
+ class="btn-confirm ${this.destructive ? "destructive" : ""}"
19314
+ @click=${() => this._handleConfirm()}
19315
+ >
19316
+ ${this.confirmLabel}
19317
+ </button>
19318
+ </div>
19319
+ </div>
19320
+ `;
19321
+ }
19322
+ };
19323
+ ConfirmDialog.styles = [
19324
+ theme,
19325
+ i`
19326
+ :host {
19327
+ display: none;
19328
+ }
19329
+
19330
+ @keyframes backdrop-in {
19331
+ from {
19332
+ opacity: 0;
19333
+ }
19334
+ to {
19335
+ opacity: 1;
19336
+ }
19337
+ }
19338
+
19339
+ @keyframes content-in {
19340
+ from {
19341
+ opacity: 0;
19342
+ transform: scale(0.95) translateY(8px);
19343
+ }
19344
+ to {
19345
+ opacity: 1;
19346
+ transform: scale(1) translateY(0);
19347
+ }
19348
+ }
19349
+
19350
+ :host([open]) {
19351
+ display: flex;
19352
+ position: fixed;
19353
+ inset: 0;
19354
+ background: rgba(0, 0, 0, 0.6);
19355
+ backdrop-filter: blur(4px);
19356
+ z-index: 10001;
19357
+ align-items: center;
19358
+ justify-content: center;
19359
+ animation: backdrop-in 0.15s ease-out both;
19360
+ }
19361
+
19362
+ .dialog {
19363
+ background: var(--bg-panel);
19364
+ border: 1px solid var(--border-glass);
19365
+ border-radius: var(--radius-md, 12px);
19366
+ padding: 24px;
19367
+ max-width: 400px;
19368
+ width: 90%;
19369
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
19370
+ animation: content-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
19371
+ animation-delay: 0.05s;
19372
+ }
19373
+
19374
+ .message {
19375
+ font-size: 14px;
19376
+ line-height: 1.5;
19377
+ color: var(--t-primary);
19378
+ margin-bottom: 20px;
19379
+ }
19380
+
19381
+ .actions {
19382
+ display: flex;
19383
+ justify-content: flex-end;
19384
+ gap: 8px;
19385
+ }
19386
+
19387
+ button {
19388
+ padding: 8px 16px;
19389
+ border-radius: var(--radius-sm, 6px);
19390
+ font-size: 13px;
19391
+ font-weight: 500;
19392
+ cursor: pointer;
19393
+ transition: all 0.15s ease;
19394
+ font-family: inherit;
19395
+ border: none;
19396
+ }
19397
+
19398
+ .btn-cancel {
19399
+ background: var(--bg-glass);
19400
+ color: var(--t-primary);
19401
+ border: 1px solid var(--border-glass);
19402
+ }
19403
+
19404
+ .btn-cancel:hover {
19405
+ background: var(--bg-glass-strong, rgba(255, 255, 255, 0.08));
19406
+ }
19407
+
19408
+ .btn-confirm {
19409
+ background: var(--accent);
19410
+ color: #fff;
19411
+ }
19412
+
19413
+ .btn-confirm:hover {
19414
+ opacity: 0.9;
19415
+ }
19416
+
19417
+ .btn-confirm.destructive {
19418
+ background: hsl(0, 60%, 50%);
19419
+ }
19420
+
19421
+ .btn-confirm.destructive:hover {
19422
+ background: hsl(0, 60%, 45%);
19423
+ }
19424
+ `
19425
+ ];
19426
+ __decorateClass([
19427
+ n4({ type: Boolean, reflect: true })
19428
+ ], ConfirmDialog.prototype, "open", 2);
19429
+ __decorateClass([
19430
+ n4({ type: String })
19431
+ ], ConfirmDialog.prototype, "message", 2);
19432
+ __decorateClass([
19433
+ n4({ type: String })
19434
+ ], ConfirmDialog.prototype, "confirmLabel", 2);
19435
+ __decorateClass([
19436
+ n4({ type: String })
19437
+ ], ConfirmDialog.prototype, "cancelLabel", 2);
19438
+ __decorateClass([
19439
+ n4({ type: Boolean })
19440
+ ], ConfirmDialog.prototype, "destructive", 2);
19441
+ ConfirmDialog = __decorateClass([
19442
+ t4("confirm-dialog")
19443
+ ], ConfirmDialog);
19444
+ async function confirmDialog(message, options) {
19445
+ let dialog = document.querySelector("confirm-dialog");
19446
+ if (!dialog) {
19447
+ dialog = document.createElement("confirm-dialog");
19448
+ document.body.appendChild(dialog);
19449
+ }
19450
+ return dialog.show(message, options);
19451
+ }
19452
+
19267
19453
  // node_modules/lit-html/directives/unsafe-svg.js
19268
19454
  var t5 = class extends e5 {
19269
19455
  };
@@ -22623,7 +22809,10 @@ var BeamApp = class extends i4 {
22623
22809
  this._handleRemove = async () => {
22624
22810
  this._closeSettingsMenu();
22625
22811
  if (this._selectedPhoton && this._mcpReady) {
22626
- if (confirm(`Remove ${this._selectedPhoton.name} from this workspace?`)) {
22812
+ if (await confirmDialog(`Remove ${this._selectedPhoton.name} from this workspace?`, {
22813
+ confirm: "Remove",
22814
+ destructive: true
22815
+ })) {
22627
22816
  const result = await mcpClient.removePhoton(this._selectedPhoton.name);
22628
22817
  if (!result.success) {
22629
22818
  showToast(result.error || "Remove failed", "error");
@@ -22990,10 +23179,11 @@ var BeamApp = class extends i4 {
22990
23179
  }
22991
23180
  }
22992
23181
  };
22993
- this._handleDeletePhoton = () => {
23182
+ this._handleDeletePhoton = async () => {
22994
23183
  this._closeSettingsMenu();
22995
- if (confirm(
22996
- `Are you sure you want to delete "${this._selectedPhoton?.name}"? This cannot be undone.`
23184
+ if (await confirmDialog(
23185
+ `Are you sure you want to delete "${this._selectedPhoton?.name}"? This cannot be undone.`,
23186
+ { confirm: "Delete", destructive: true }
22997
23187
  )) {
22998
23188
  void this._invokeMakerMethod("delete");
22999
23189
  }
@@ -23292,7 +23482,7 @@ var BeamApp = class extends i4 {
23292
23482
  return;
23293
23483
  }
23294
23484
  if (this._view === "form" && this._selectedMethod) {
23295
- this._handleBackFromMethod();
23485
+ void this._handleBackFromMethod();
23296
23486
  return;
23297
23487
  }
23298
23488
  if (this._view === "marketplace") {
@@ -23323,7 +23513,7 @@ var BeamApp = class extends i4 {
23323
23513
  }
23324
23514
  if (e8.key === "h") {
23325
23515
  if (this._view === "form") {
23326
- this._handleBackFromMethod();
23516
+ void this._handleBackFromMethod();
23327
23517
  } else if (this._view === "marketplace") {
23328
23518
  this._view = "list";
23329
23519
  this._updateRoute();
@@ -23425,7 +23615,7 @@ var BeamApp = class extends i4 {
23425
23615
  const { action } = e8.detail;
23426
23616
  switch (action) {
23427
23617
  case "back":
23428
- this._handleBackFromMethod();
23618
+ void this._handleBackFromMethod();
23429
23619
  break;
23430
23620
  case "edit-studio":
23431
23621
  if (this._selectedPhoton) {
@@ -23500,7 +23690,7 @@ var BeamApp = class extends i4 {
23500
23690
  void this._handleContribute();
23501
23691
  break;
23502
23692
  case "delete":
23503
- this._handleDeletePhoton();
23693
+ void this._handleDeletePhoton();
23504
23694
  break;
23505
23695
  case "remove":
23506
23696
  void this._handleRemove();
@@ -24744,7 +24934,7 @@ var BeamApp = class extends i4 {
24744
24934
  class="mobile-menu-btn ${this._sidebarVisible ? "open" : ""}"
24745
24935
  @click=${() => {
24746
24936
  if (!this._sidebarVisible && this._selectedMethod && this._selectedPhoton && !this._selectedPhoton.isApp) {
24747
- this._handleBackFromMethod();
24937
+ void this._handleBackFromMethod();
24748
24938
  } else {
24749
24939
  this._toggleSidebar();
24750
24940
  }
@@ -25603,7 +25793,7 @@ ${photon.errorMessage || "Unknown error"}</pre
25603
25793
  progress: this._progress,
25604
25794
  formParams: this._lastFormParams,
25605
25795
  onSubmit: (e8) => void this._handleExecute(e8),
25606
- onCancel: () => this._handleBackFromMethod(),
25796
+ onCancel: () => void this._handleBackFromMethod(),
25607
25797
  appSurface: true
25608
25798
  })}
25609
25799
  </div>
@@ -26148,7 +26338,7 @@ ${photon.errorMessage || "Unknown error"}</pre
26148
26338
  progress: this._progress,
26149
26339
  formParams: this._lastFormParams,
26150
26340
  onSubmit: (e8) => void this._handleExecute(e8),
26151
- onCancel: () => this._handleBackFromMethod(),
26341
+ onCancel: () => void this._handleBackFromMethod(),
26152
26342
  panelLabel: "Primary",
26153
26343
  instance: this._currentInstance,
26154
26344
  instances: this._instances,
@@ -26192,7 +26382,7 @@ ${photon.errorMessage || "Unknown error"}</pre
26192
26382
  progress: this._progress,
26193
26383
  formParams: this._lastFormParams,
26194
26384
  onSubmit: (e8) => void this._handleExecute(e8),
26195
- onCancel: () => this._handleBackFromMethod(),
26385
+ onCancel: () => void this._handleBackFromMethod(),
26196
26386
  appSurface: this._viewMode !== "full",
26197
26387
  panelLabel: "Primary",
26198
26388
  instance: this._currentInstance,
@@ -26316,7 +26506,9 @@ ${photon.errorMessage || "Unknown error"}</pre
26316
26506
  _renderMethodBody(opts) {
26317
26507
  const hasParams = !!opts.method?.params?.properties && Object.keys(opts.method.params.properties).length > 0;
26318
26508
  return b2`
26319
- <div style="display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto;">
26509
+ <div
26510
+ style="display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable;"
26511
+ >
26320
26512
  ${opts.appSurface ? "" : this._renderDescription(opts.method.description)}
26321
26513
  ${opts.appSurface && !hasParams ? "" : b2`
26322
26514
  <invoke-form
@@ -26333,8 +26525,9 @@ ${photon.errorMessage || "Unknown error"}</pre
26333
26525
  <div class="form-chrome">
26334
26526
  ${hasParams ? b2`<button
26335
26527
  class="btn-secondary"
26336
- @click=${() => {
26337
- const form = this.shadowRoot?.querySelector("invoke-form");
26528
+ @click=${(e8) => {
26529
+ const panel = e8.target.closest(".method-detail");
26530
+ const form = panel?.querySelector("invoke-form");
26338
26531
  form?.handleCancel();
26339
26532
  }}
26340
26533
  ?disabled=${opts.executing}
@@ -26343,8 +26536,9 @@ ${photon.errorMessage || "Unknown error"}</pre
26343
26536
  </button>` : ""}
26344
26537
  <button
26345
26538
  class="btn-primary"
26346
- @click=${() => {
26347
- const form = this.shadowRoot?.querySelector("invoke-form");
26539
+ @click=${(e8) => {
26540
+ const panel = e8.target.closest(".method-detail");
26541
+ const form = panel?.querySelector("invoke-form");
26348
26542
  form?.handleSubmit();
26349
26543
  }}
26350
26544
  ?disabled=${opts.executing}
@@ -26734,9 +26928,12 @@ ${photon.errorMessage || "Unknown error"}</pre
26734
26928
  const args = this._sharedFormParams ?? {};
26735
26929
  void this._handleExecute(new CustomEvent("execute", { detail: { args } }));
26736
26930
  }
26737
- _handleBackFromMethod() {
26931
+ async _handleBackFromMethod() {
26738
26932
  const form = this.shadowRoot?.querySelector("invoke-form");
26739
- if (form?.isDirty && !confirm("You have unsaved changes. Discard them?")) {
26933
+ if (form?.isDirty && !await confirmDialog("You have unsaved changes. Discard them?", {
26934
+ confirm: "Discard",
26935
+ destructive: true
26936
+ })) {
26740
26937
  return;
26741
26938
  }
26742
26939
  this._closeSecondPanel();
@@ -28637,6 +28834,7 @@ BeamApp.styles = [
28637
28834
  overflow-y: auto;
28638
28835
  overflow-x: hidden;
28639
28836
  padding: var(--space-lg);
28837
+ scrollbar-gutter: stable;
28640
28838
  }
28641
28839
 
28642
28840
  /* Page transition when switching photons */
@@ -31002,6 +31200,8 @@ BeamSidebar.styles = [
31002
31200
  .sidebar-content {
31003
31201
  flex: 1;
31004
31202
  overflow-y: auto;
31203
+ padding-right: 4px;
31204
+ scrollbar-gutter: stable;
31005
31205
  }
31006
31206
 
31007
31207
  .empty-state {
@@ -32787,7 +32987,15 @@ var InvokeForm = class extends i4 {
32787
32987
  return b2`<div class="form-container"></div>`;
32788
32988
  }
32789
32989
  return b2`
32790
- <div class="form-container">
32990
+ <div
32991
+ class="form-container"
32992
+ @keydown=${(e8) => {
32993
+ if (e8.key === "Enter" && !e8.shiftKey && !e8.target?.matches("textarea")) {
32994
+ e8.preventDefault();
32995
+ this.handleSubmit();
32996
+ }
32997
+ }}
32998
+ >
32791
32999
  ${this._viewMode === "form" ? this._renderFields() : this._renderJsonEditor()}
32792
33000
  </div>
32793
33001
  `;
@@ -34038,8 +34246,11 @@ var InvokeForm = class extends i4 {
34038
34246
  this.dispatchEvent(new CustomEvent("submit", { detail: { args: this._values } }));
34039
34247
  }
34040
34248
  /** Cancel with dirty check. Called by parent chrome wrapper. */
34041
- handleCancel() {
34042
- if (this.isDirty && !confirm("You have unsaved changes. Discard them?")) {
34249
+ async handleCancel() {
34250
+ if (this.isDirty && !await confirmDialog("You have unsaved changes. Discard them?", {
34251
+ confirm: "Discard",
34252
+ destructive: true
34253
+ })) {
34043
34254
  return;
34044
34255
  }
34045
34256
  this.dispatchEvent(new CustomEvent("cancel"));
@@ -36206,7 +36417,7 @@ var ResultViewer = class extends i4 {
36206
36417
  case "mermaid":
36207
36418
  return typeof data === "string";
36208
36419
  case "markdown":
36209
- return typeof data === "string";
36420
+ return typeof data === "string" || Array.isArray(data) && data.every((i7) => typeof i7 === "string");
36210
36421
  case "slides":
36211
36422
  return typeof data === "string";
36212
36423
  case "checklist":
@@ -36240,8 +36451,10 @@ var ResultViewer = class extends i4 {
36240
36451
  return this._renderChips(filteredData);
36241
36452
  case "tree":
36242
36453
  return this._renderTree(filteredData);
36243
- case "markdown":
36244
- return this._renderMarkdown(filteredData);
36454
+ case "markdown": {
36455
+ const mdData = Array.isArray(filteredData) ? filteredData.join("\n\n---\n\n") : filteredData;
36456
+ return this._renderMarkdown(mdData);
36457
+ }
36245
36458
  case "html":
36246
36459
  return this._renderHtml(filteredData);
36247
36460
  case "text":
@@ -42785,15 +42998,24 @@ ResultViewer.styles = [
42785
42998
 
42786
42999
  .dashboard-panel-content {
42787
43000
  padding: var(--space-xs);
43001
+ display: flex;
43002
+ align-items: center;
43003
+ justify-content: center;
43004
+ text-align: center;
42788
43005
  }
42789
43006
 
42790
43007
  .dashboard-panel .chart-container {
42791
43008
  max-height: 250px;
43009
+ width: 100%;
42792
43010
  display: flex;
42793
43011
  justify-content: center;
42794
43012
  align-items: center;
42795
43013
  }
42796
43014
 
43015
+ .dashboard-panel .table-wrapper {
43016
+ width: 100%;
43017
+ }
43018
+
42797
43019
  .dashboard-panel .chart-container canvas {
42798
43020
  max-width: 100%;
42799
43021
  max-height: 230px;
@@ -44535,7 +44757,10 @@ var MarketplaceView = class extends i4 {
44535
44757
  this._items = items;
44536
44758
  }
44537
44759
  async _removeSource(name2) {
44538
- if (!confirm(`Remove marketplace "${name2}"? This will not uninstall any photons.`)) {
44760
+ if (!await confirmDialog(`Remove marketplace "${name2}"? This will not uninstall any photons.`, {
44761
+ confirm: "Remove",
44762
+ destructive: true
44763
+ })) {
44539
44764
  return;
44540
44765
  }
44541
44766
  try {
@@ -44598,7 +44823,11 @@ var MarketplaceView = class extends i4 {
44598
44823
  }
44599
44824
  }
44600
44825
  async _remove(item) {
44601
- if (!confirm(`Remove "${item.name}"? This will delete the photon files.`)) return;
44826
+ if (!await confirmDialog(`Remove "${item.name}"? This will delete the photon files.`, {
44827
+ confirm: "Remove",
44828
+ destructive: true
44829
+ }))
44830
+ return;
44602
44831
  this._removing = item.name;
44603
44832
  try {
44604
44833
  const res = await fetch("/api/marketplace/remove", {
@@ -94152,9 +94381,13 @@ ${indent}* ` },
94152
94381
  const matchingItem = this._outlineItems.filter((item) => pos >= item.from && pos <= Math.max(item.to, item.from + 1)).sort((left, right) => right.level - left.level)[0];
94153
94382
  this._activeOutlineKey = matchingItem ? this._outlineKey(matchingItem) : "";
94154
94383
  }
94155
- _close() {
94384
+ async _close() {
94156
94385
  if (this._dirty) {
94157
- if (!confirm("You have unsaved changes. Close anyway?")) return;
94386
+ if (!await confirmDialog("You have unsaved changes. Close anyway?", {
94387
+ confirm: "Close",
94388
+ destructive: true
94389
+ }))
94390
+ return;
94158
94391
  }
94159
94392
  this.dispatchEvent(new CustomEvent("studio-close", { bubbles: true, composed: true }));
94160
94393
  }