@jxsuite/studio 0.30.1 → 0.31.0

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.
@@ -0,0 +1,94 @@
1
+ /// <reference lib="dom" />
2
+ /**
3
+ * A blocking progress modal for long-running package operations (bun install / dependency updates).
4
+ * Shows an indeterminate spinner with a status line; on failure it swaps to an error view with the
5
+ * captured log and a Close button. Built on the persistent-modal layer helper.
6
+ */
7
+
8
+ import { html } from "lit-html";
9
+ import type { TemplateResult } from "lit-html";
10
+ import { openModal } from "./layers";
11
+
12
+ export interface ProgressModalHandle {
13
+ /** Update the status line shown under the title. */
14
+ setStatus: (text: string) => void;
15
+ /** Replace the spinner with an error view (log shown) that the user dismisses. */
16
+ fail: (message: string) => void;
17
+ /** Close the modal (success path). */
18
+ done: () => void;
19
+ }
20
+
21
+ function card(body: TemplateResult): TemplateResult {
22
+ return html`
23
+ <sp-underlay open></sp-underlay>
24
+ <div
25
+ class="progress-modal"
26
+ role="dialog"
27
+ aria-live="polite"
28
+ style="position:fixed;inset:0;margin:auto;width:min(420px,calc(100vw - 48px));max-height:calc(100vh - 96px);height:max-content;background:var(--bg-panel,#1e1e1e);border:1px solid var(--border,#3a3a3a);border-radius:var(--spectrum-corner-radius-200,8px);padding:24px;display:flex;flex-direction:column;gap:16px;box-shadow:0 8px 32px rgba(0,0,0,.4)"
29
+ >
30
+ ${body}
31
+ </div>
32
+ `;
33
+ }
34
+
35
+ function runningView(title: string, status: string): TemplateResult {
36
+ return card(html`
37
+ <div style="display:flex;align-items:center;gap:14px">
38
+ <sp-progress-circle indeterminate size="m" aria-label=${title}></sp-progress-circle>
39
+ <div style="display:flex;flex-direction:column;gap:2px">
40
+ <strong style="font-size:var(--spectrum-font-size-100, 14px)">${title}</strong>
41
+ ${status
42
+ ? html`<span style="font-size:var(--spectrum-font-size-75, 12px);color:var(--fg-dim,#aaa)"
43
+ >${status}</span
44
+ >`
45
+ : ""}
46
+ </div>
47
+ </div>
48
+ `);
49
+ }
50
+
51
+ function errorView(title: string, message: string, onClose: () => void): TemplateResult {
52
+ return card(html`
53
+ <div style="display:flex;flex-direction:column;gap:8px">
54
+ <strong style="font-size:var(--spectrum-font-size-100, 14px);color:var(--danger,#e34850)"
55
+ >${title} failed</strong
56
+ >
57
+ <pre
58
+ style="font-size:var(--spectrum-font-size-50, 11px);white-space:pre-wrap;overflow:auto;max-height:240px;margin:0;color:var(--fg-dim,#aaa)"
59
+ >
60
+ ${message}</pre
61
+ >
62
+ </div>
63
+ <div style="display:flex;justify-content:flex-end">
64
+ <sp-button size="s" @click=${onClose}>Close</sp-button>
65
+ </div>
66
+ `);
67
+ }
68
+
69
+ export function showProgressModal(opts: { title: string; status?: string }): ProgressModalHandle {
70
+ const modal = openModal(runningView(opts.title, opts.status ?? ""));
71
+ let closed = false;
72
+
73
+ const close = () => {
74
+ if (closed) {
75
+ return;
76
+ }
77
+ closed = true;
78
+ modal.close();
79
+ };
80
+
81
+ return {
82
+ done: close,
83
+ fail(message: string) {
84
+ if (!closed) {
85
+ modal.update(errorView(opts.title, message || "Unknown error", close));
86
+ }
87
+ },
88
+ setStatus(text: string) {
89
+ if (!closed) {
90
+ modal.update(runningView(opts.title, text));
91
+ }
92
+ },
93
+ };
94
+ }
@@ -48,6 +48,7 @@ import { Accordion } from "@spectrum-web-components/accordion/src/Accordion.js";
48
48
  import { AccordionItem } from "@spectrum-web-components/accordion/src/AccordionItem.js";
49
49
  import { ActionBar } from "@spectrum-web-components/action-bar/src/ActionBar.js";
50
50
  import { Toast } from "@spectrum-web-components/toast/src/Toast.js";
51
+ import { ProgressCircle } from "@spectrum-web-components/progress-circle/src/ProgressCircle.js";
51
52
  import { Table } from "@spectrum-web-components/table/src/Table.js";
52
53
  import { TableHead } from "@spectrum-web-components/table/src/TableHead.js";
53
54
  import { TableHeadCell } from "@spectrum-web-components/table/src/TableHeadCell.js";
@@ -87,6 +88,7 @@ import { IconCode } from "@spectrum-web-components/icons-workflow/src/elements/I
87
88
  import { IconBrush } from "@spectrum-web-components/icons-workflow/src/elements/IconBrush.js";
88
89
  import { IconGears } from "@spectrum-web-components/icons-workflow/src/elements/IconGears.js";
89
90
  import { IconSettings } from "@spectrum-web-components/icons-workflow/src/elements/IconSettings.js";
91
+ import { IconInfo } from "@spectrum-web-components/icons-workflow/src/elements/IconInfo.js";
90
92
  import { IconBack } from "@spectrum-web-components/icons-workflow/src/elements/IconBack.js";
91
93
  import { IconProperties } from "@spectrum-web-components/icons-workflow/src/elements/IconProperties.js";
92
94
  import { IconEvent } from "@spectrum-web-components/icons-workflow/src/elements/IconEvent.js";
@@ -190,6 +192,7 @@ const components = [
190
192
  ["sp-accordion-item", AccordionItem],
191
193
  ["sp-action-bar", ActionBar],
192
194
  ["sp-toast", Toast],
195
+ ["sp-progress-circle", ProgressCircle],
193
196
  ["sp-table", Table],
194
197
  ["sp-table-head", TableHead],
195
198
  ["sp-table-head-cell", TableHeadCell],
@@ -227,6 +230,7 @@ const components = [
227
230
  ["sp-icon-brush", IconBrush],
228
231
  ["sp-icon-gears", IconGears],
229
232
  ["sp-icon-settings", IconSettings],
233
+ ["sp-icon-info", IconInfo],
230
234
  ["sp-icon-back", IconBack],
231
235
  ["sp-icon-properties", IconProperties],
232
236
  ["sp-icon-event", IconEvent],
package/src/version.ts ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Version.ts — build-time metadata for the About screen.
3
+ *
4
+ * The constants below are replaced at bundle time by scripts/build.ts via Bun's `define`. They're
5
+ * read through `typeof` guards so the module stays safe under `bun test`, where the defines are
6
+ * absent and the fallbacks apply.
7
+ */
8
+
9
+ declare const __JX_VERSION__: string;
10
+ declare const __JX_BUILD_DATE__: string;
11
+ declare const __JX_GIT_COMMIT__: string;
12
+
13
+ export const APP_NAME = "Jx Studio";
14
+
15
+ /*
16
+ * The `typeof` guards are deliberate: the identifiers are `declare const` placeholders that
17
+ * only exist after Bun's build-time `define` substitution. Under `bun test` they're never
18
+ * bound, so a direct `=== undefined` comparison would throw a ReferenceError.
19
+ */
20
+
21
+ // oxlint-disable-next-line unicorn/no-typeof-undefined -- guards undeclared build-time define
22
+ export const VERSION = typeof __JX_VERSION__ === "undefined" ? "dev" : __JX_VERSION__;
23
+
24
+ // oxlint-disable-next-line unicorn/no-typeof-undefined -- guards undeclared build-time define
25
+ export const BUILD_DATE = typeof __JX_BUILD_DATE__ === "undefined" ? "" : __JX_BUILD_DATE__;
26
+
27
+ // oxlint-disable-next-line unicorn/no-typeof-undefined -- guards undeclared build-time define
28
+ export const GIT_COMMIT = typeof __JX_GIT_COMMIT__ === "undefined" ? "unknown" : __JX_GIT_COMMIT__;
29
+
30
+ export const LINKS = {
31
+ github: "https://github.com/jxsuite/jx",
32
+ docs: "https://github.com/jxsuite/jx#readme",
33
+ license: "https://github.com/jxsuite/jx/blob/main/LICENSE",
34
+ } as const;