@portel/photon 1.20.0 → 1.20.1

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.
Files changed (86) hide show
  1. package/dist/auto-ui/beam/routes/api-config.d.ts.map +1 -1
  2. package/dist/auto-ui/beam/routes/api-config.js +161 -20
  3. package/dist/auto-ui/beam/routes/api-config.js.map +1 -1
  4. package/dist/auto-ui/beam.d.ts.map +1 -1
  5. package/dist/auto-ui/beam.js +4 -3
  6. package/dist/auto-ui/beam.js.map +1 -1
  7. package/dist/auto-ui/bridge/renderers.d.ts.map +1 -1
  8. package/dist/auto-ui/bridge/renderers.js +12 -4
  9. package/dist/auto-ui/bridge/renderers.js.map +1 -1
  10. package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -1
  11. package/dist/auto-ui/streamable-http-transport.js +115 -28
  12. package/dist/auto-ui/streamable-http-transport.js.map +1 -1
  13. package/dist/beam-form.bundle.js +19 -182
  14. package/dist/beam-form.bundle.js.map +4 -4
  15. package/dist/beam.bundle.js +743 -311
  16. package/dist/beam.bundle.js.map +4 -4
  17. package/dist/cli/commands/beam.d.ts.map +1 -1
  18. package/dist/cli/commands/beam.js +47 -30
  19. package/dist/cli/commands/beam.js.map +1 -1
  20. package/dist/cli/commands/build.d.ts.map +1 -1
  21. package/dist/cli/commands/build.js +27 -2
  22. package/dist/cli/commands/build.js.map +1 -1
  23. package/dist/cli/commands/daemon.d.ts.map +1 -1
  24. package/dist/cli/commands/daemon.js +12 -6
  25. package/dist/cli/commands/daemon.js.map +1 -1
  26. package/dist/cli/commands/mcp.d.ts.map +1 -1
  27. package/dist/cli/commands/mcp.js +18 -6
  28. package/dist/cli/commands/mcp.js.map +1 -1
  29. package/dist/cli/commands/serve.d.ts.map +1 -1
  30. package/dist/cli/commands/serve.js +14 -2
  31. package/dist/cli/commands/serve.js.map +1 -1
  32. package/dist/cli-alias.d.ts.map +1 -1
  33. package/dist/cli-alias.js +2 -3
  34. package/dist/cli-alias.js.map +1 -1
  35. package/dist/context-store.d.ts +4 -4
  36. package/dist/context-store.d.ts.map +1 -1
  37. package/dist/context-store.js +18 -15
  38. package/dist/context-store.js.map +1 -1
  39. package/dist/context.d.ts +25 -2
  40. package/dist/context.d.ts.map +1 -1
  41. package/dist/context.js +69 -4
  42. package/dist/context.js.map +1 -1
  43. package/dist/daemon/client.d.ts.map +1 -1
  44. package/dist/daemon/client.js +4 -1
  45. package/dist/daemon/client.js.map +1 -1
  46. package/dist/daemon/manager.d.ts +2 -0
  47. package/dist/daemon/manager.d.ts.map +1 -1
  48. package/dist/daemon/manager.js +40 -8
  49. package/dist/daemon/manager.js.map +1 -1
  50. package/dist/daemon/server.js +59 -15
  51. package/dist/daemon/server.js.map +1 -1
  52. package/dist/daemon/worker-host.js +7 -0
  53. package/dist/daemon/worker-host.js.map +1 -1
  54. package/dist/daemon/worker-manager.d.ts.map +1 -1
  55. package/dist/daemon/worker-manager.js +58 -10
  56. package/dist/daemon/worker-manager.js.map +1 -1
  57. package/dist/daemon/worker-protocol.d.ts +3 -0
  58. package/dist/daemon/worker-protocol.d.ts.map +1 -1
  59. package/dist/deploy/cloudflare.d.ts.map +1 -1
  60. package/dist/deploy/cloudflare.js +2 -4
  61. package/dist/deploy/cloudflare.js.map +1 -1
  62. package/dist/loader.d.ts +7 -0
  63. package/dist/loader.d.ts.map +1 -1
  64. package/dist/loader.js +56 -2
  65. package/dist/loader.js.map +1 -1
  66. package/dist/marketplace-manager.d.ts +1 -1
  67. package/dist/marketplace-manager.d.ts.map +1 -1
  68. package/dist/marketplace-manager.js +5 -4
  69. package/dist/marketplace-manager.js.map +1 -1
  70. package/dist/photon-cli-runner.d.ts.map +1 -1
  71. package/dist/photon-cli-runner.js +40 -21
  72. package/dist/photon-cli-runner.js.map +1 -1
  73. package/dist/photon-doc-extractor.d.ts.map +1 -1
  74. package/dist/photon-doc-extractor.js +59 -15
  75. package/dist/photon-doc-extractor.js.map +1 -1
  76. package/dist/server.d.ts.map +1 -1
  77. package/dist/server.js +14 -16
  78. package/dist/server.js.map +1 -1
  79. package/dist/shared-utils.d.ts +4 -0
  80. package/dist/shared-utils.d.ts.map +1 -1
  81. package/dist/shared-utils.js +22 -0
  82. package/dist/shared-utils.js.map +1 -1
  83. package/dist/template-manager.d.ts.map +1 -1
  84. package/dist/template-manager.js +56 -234
  85. package/dist/template-manager.js.map +1 -1
  86. package/package.json +2 -2
@@ -1787,187 +1787,24 @@ function showToast(message, type = "info", duration = 3e3, action) {
1787
1787
  ToastManager.show(message, type, duration, action);
1788
1788
  }
1789
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);
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
- const beamApp = document.querySelector("beam-app");
1964
- const root = beamApp?.shadowRoot ?? document.body;
1965
- let dialog = root.querySelector("confirm-dialog");
1966
- if (!dialog) {
1967
- dialog = document.createElement("confirm-dialog");
1968
- root.appendChild(dialog);
1969
- }
1970
- return dialog.show(message, options);
1790
+ // src/auto-ui/frontend/utils/elicit.ts
1791
+ function elicit(data) {
1792
+ return new Promise((resolve) => {
1793
+ document.dispatchEvent(
1794
+ new CustomEvent("beam:elicit-local", {
1795
+ detail: { data, resolve }
1796
+ })
1797
+ );
1798
+ });
1799
+ }
1800
+ async function confirmElicit(message, options) {
1801
+ const result = await elicit({
1802
+ ask: "confirm",
1803
+ message,
1804
+ default: false,
1805
+ ...options?.confirm && { placeholder: options.confirm }
1806
+ });
1807
+ return result.action === "accept" && result.value !== false;
1971
1808
  }
1972
1809
 
1973
1810
  // src/auto-ui/frontend/utils/format-label.ts
@@ -3600,7 +3437,7 @@ var InvokeForm = class extends i4 {
3600
3437
  }
3601
3438
  /** Cancel with dirty check. Called by parent chrome wrapper. */
3602
3439
  async handleCancel() {
3603
- if (this.isDirty && !await confirmDialog("You have unsaved changes. Discard them?", {
3440
+ if (this.isDirty && !await confirmElicit("You have unsaved changes. Discard them?", {
3604
3441
  confirm: "Discard",
3605
3442
  destructive: true
3606
3443
  })) {