@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.
@@ -665,6 +665,7 @@ var theme = i`
665
665
  border: 1px solid var(--border-glass);
666
666
  border-radius: var(--radius-md);
667
667
  box-shadow: var(--shadow-sm);
668
+ color: inherit;
668
669
  }
669
670
 
670
671
  .text-gradient {
@@ -706,21 +707,25 @@ var theme = i`
706
707
  border-radius: var(--radius-xs);
707
708
  }
708
709
 
709
- /* Scrollbar */
710
+ /* Scrollbar — thin, translucent, doesn't crowd content */
711
+ * {
712
+ scrollbar-width: thin;
713
+ scrollbar-color: color-mix(in srgb, var(--t-muted, #888) 30%, transparent) transparent;
714
+ }
710
715
  ::-webkit-scrollbar {
711
- width: 8px;
712
- height: 8px;
716
+ width: 6px;
717
+ height: 6px;
713
718
  }
714
719
  ::-webkit-scrollbar-track {
715
720
  background: transparent;
721
+ margin: 4px 0;
716
722
  }
717
723
  ::-webkit-scrollbar-thumb {
718
- background: var(--border-glass);
719
- border-radius: var(--radius-xs);
724
+ background: color-mix(in srgb, var(--t-muted) 30%, transparent);
725
+ border-radius: var(--radius-full);
720
726
  }
721
727
  ::-webkit-scrollbar-thumb:hover {
722
- background: var(--t-muted);
723
- opacity: 0.5;
728
+ background: color-mix(in srgb, var(--t-muted) 60%, transparent);
724
729
  }
725
730
  /* Toggle Switch */
726
731
  .switch {
@@ -1782,6 +1787,187 @@ function showToast(message, type = "info", duration = 3e3, action) {
1782
1787
  ToastManager.show(message, type, duration, action);
1783
1788
  }
1784
1789
 
1790
+ // src/auto-ui/frontend/components/confirm-dialog.ts
1791
+ var ConfirmDialog = class extends i4 {
1792
+ constructor() {
1793
+ super(...arguments);
1794
+ this.open = false;
1795
+ this.message = "";
1796
+ this.confirmLabel = "OK";
1797
+ this.cancelLabel = "Cancel";
1798
+ this.destructive = false;
1799
+ }
1800
+ show(message, options) {
1801
+ this.message = message;
1802
+ this.confirmLabel = options?.confirm ?? "OK";
1803
+ this.cancelLabel = options?.cancel ?? "Cancel";
1804
+ this.destructive = options?.destructive ?? false;
1805
+ this.open = true;
1806
+ return new Promise((resolve) => {
1807
+ this._resolve = resolve;
1808
+ });
1809
+ }
1810
+ _handleConfirm() {
1811
+ this.open = false;
1812
+ this._resolve?.(true);
1813
+ }
1814
+ _handleCancel() {
1815
+ this.open = false;
1816
+ this._resolve?.(false);
1817
+ }
1818
+ _handleKeydown(e5) {
1819
+ if (e5.key === "Escape") this._handleCancel();
1820
+ if (e5.key === "Enter") this._handleConfirm();
1821
+ }
1822
+ render() {
1823
+ return b2`
1824
+ <div class="dialog" @keydown=${(e5) => this._handleKeydown(e5)}>
1825
+ <div class="message">${this.message}</div>
1826
+ <div class="actions">
1827
+ <button class="btn-cancel" @click=${() => this._handleCancel()}>
1828
+ ${this.cancelLabel}
1829
+ </button>
1830
+ <button
1831
+ class="btn-confirm ${this.destructive ? "destructive" : ""}"
1832
+ @click=${() => this._handleConfirm()}
1833
+ >
1834
+ ${this.confirmLabel}
1835
+ </button>
1836
+ </div>
1837
+ </div>
1838
+ `;
1839
+ }
1840
+ };
1841
+ ConfirmDialog.styles = [
1842
+ theme,
1843
+ i`
1844
+ :host {
1845
+ display: none;
1846
+ }
1847
+
1848
+ @keyframes backdrop-in {
1849
+ from {
1850
+ opacity: 0;
1851
+ }
1852
+ to {
1853
+ opacity: 1;
1854
+ }
1855
+ }
1856
+
1857
+ @keyframes content-in {
1858
+ from {
1859
+ opacity: 0;
1860
+ transform: scale(0.95) translateY(8px);
1861
+ }
1862
+ to {
1863
+ opacity: 1;
1864
+ transform: scale(1) translateY(0);
1865
+ }
1866
+ }
1867
+
1868
+ :host([open]) {
1869
+ display: flex;
1870
+ position: fixed;
1871
+ inset: 0;
1872
+ background: rgba(0, 0, 0, 0.6);
1873
+ backdrop-filter: blur(4px);
1874
+ z-index: 10001;
1875
+ align-items: center;
1876
+ justify-content: center;
1877
+ animation: backdrop-in 0.15s ease-out both;
1878
+ }
1879
+
1880
+ .dialog {
1881
+ background: var(--bg-panel);
1882
+ border: 1px solid var(--border-glass);
1883
+ border-radius: var(--radius-md, 12px);
1884
+ padding: 24px;
1885
+ max-width: 400px;
1886
+ width: 90%;
1887
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
1888
+ animation: content-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
1889
+ animation-delay: 0.05s;
1890
+ }
1891
+
1892
+ .message {
1893
+ font-size: 14px;
1894
+ line-height: 1.5;
1895
+ color: var(--t-primary);
1896
+ margin-bottom: 20px;
1897
+ }
1898
+
1899
+ .actions {
1900
+ display: flex;
1901
+ justify-content: flex-end;
1902
+ gap: 8px;
1903
+ }
1904
+
1905
+ button {
1906
+ padding: 8px 16px;
1907
+ border-radius: var(--radius-sm, 6px);
1908
+ font-size: 13px;
1909
+ font-weight: 500;
1910
+ cursor: pointer;
1911
+ transition: all 0.15s ease;
1912
+ font-family: inherit;
1913
+ border: none;
1914
+ }
1915
+
1916
+ .btn-cancel {
1917
+ background: var(--bg-glass);
1918
+ color: var(--t-primary);
1919
+ border: 1px solid var(--border-glass);
1920
+ }
1921
+
1922
+ .btn-cancel:hover {
1923
+ background: var(--bg-glass-strong, rgba(255, 255, 255, 0.08));
1924
+ }
1925
+
1926
+ .btn-confirm {
1927
+ background: var(--accent);
1928
+ color: #fff;
1929
+ }
1930
+
1931
+ .btn-confirm:hover {
1932
+ opacity: 0.9;
1933
+ }
1934
+
1935
+ .btn-confirm.destructive {
1936
+ background: hsl(0, 60%, 50%);
1937
+ }
1938
+
1939
+ .btn-confirm.destructive:hover {
1940
+ background: hsl(0, 60%, 45%);
1941
+ }
1942
+ `
1943
+ ];
1944
+ __decorateClass([
1945
+ n4({ type: Boolean, reflect: true })
1946
+ ], ConfirmDialog.prototype, "open", 2);
1947
+ __decorateClass([
1948
+ n4({ type: String })
1949
+ ], ConfirmDialog.prototype, "message", 2);
1950
+ __decorateClass([
1951
+ n4({ type: String })
1952
+ ], ConfirmDialog.prototype, "confirmLabel", 2);
1953
+ __decorateClass([
1954
+ n4({ type: String })
1955
+ ], ConfirmDialog.prototype, "cancelLabel", 2);
1956
+ __decorateClass([
1957
+ n4({ type: Boolean })
1958
+ ], ConfirmDialog.prototype, "destructive", 2);
1959
+ ConfirmDialog = __decorateClass([
1960
+ t3("confirm-dialog")
1961
+ ], ConfirmDialog);
1962
+ async function confirmDialog(message, options) {
1963
+ let dialog = document.querySelector("confirm-dialog");
1964
+ if (!dialog) {
1965
+ dialog = document.createElement("confirm-dialog");
1966
+ document.body.appendChild(dialog);
1967
+ }
1968
+ return dialog.show(message, options);
1969
+ }
1970
+
1785
1971
  // src/auto-ui/frontend/utils/format-label.ts
1786
1972
  function formatLabel(name) {
1787
1973
  if (!name) return name;
@@ -2114,7 +2300,15 @@ var InvokeForm = class extends i4 {
2114
2300
  return b2`<div class="form-container"></div>`;
2115
2301
  }
2116
2302
  return b2`
2117
- <div class="form-container">
2303
+ <div
2304
+ class="form-container"
2305
+ @keydown=${(e5) => {
2306
+ if (e5.key === "Enter" && !e5.shiftKey && !e5.target?.matches("textarea")) {
2307
+ e5.preventDefault();
2308
+ this.handleSubmit();
2309
+ }
2310
+ }}
2311
+ >
2118
2312
  ${this._viewMode === "form" ? this._renderFields() : this._renderJsonEditor()}
2119
2313
  </div>
2120
2314
  `;
@@ -3365,8 +3559,11 @@ var InvokeForm = class extends i4 {
3365
3559
  this.dispatchEvent(new CustomEvent("submit", { detail: { args: this._values } }));
3366
3560
  }
3367
3561
  /** Cancel with dirty check. Called by parent chrome wrapper. */
3368
- handleCancel() {
3369
- if (this.isDirty && !confirm("You have unsaved changes. Discard them?")) {
3562
+ async handleCancel() {
3563
+ if (this.isDirty && !await confirmDialog("You have unsaved changes. Discard them?", {
3564
+ confirm: "Discard",
3565
+ destructive: true
3566
+ })) {
3370
3567
  return;
3371
3568
  }
3372
3569
  this.dispatchEvent(new CustomEvent("cancel"));