@oomol-lab/open-flow 0.1.0-beta.4 → 0.1.0-beta.5

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 (34) hide show
  1. package/dist/browser/{DesignerIcon-DdfuH2jW.js → DesignerIcon-XKBRy_0Q.js} +640 -640
  2. package/dist/browser/createResourceDialog-Cf7QpXp6.js +505 -0
  3. package/dist/browser/{dist-BMqL-qR5.js → dist-BMRLCebL.js} +291 -292
  4. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  5. package/dist/browser/{dist-CJpzJrLM.js → dist-Cc0y2Pli.js} +811 -812
  6. package/dist/browser/{dist-DUzA0Ukh.js → dist-Dg_VXC8f.js} +134 -135
  7. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  8. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  9. package/dist/browser/dist-DxahK_I8.js +2688 -0
  10. package/dist/browser/{dist-CPuF50D9.js → dist-meg_oHVR.js} +335 -335
  11. package/dist/browser/{esm-C9jQK70n.js → esm-xWDFFpGd.js} +5 -6
  12. package/dist/browser/flow-authoring-module.d.ts +2 -2
  13. package/dist/browser/flow-authoring-node.d.ts +2 -2
  14. package/dist/browser/flow-authoring.js +469 -209
  15. package/dist/browser/flow-change.d.ts +96 -8
  16. package/dist/browser/flow-change.js +319 -96
  17. package/dist/browser/{flowChanges-Bs-ZcJV8.js → flowChanges-CeMiiZIO.js} +1578 -1541
  18. package/dist/browser/{flowRunInputEditorStore-BYa8zFLC.js → flowRunInputEditorStore-DDidwd8h.js} +9 -1
  19. package/dist/browser/{flowWorkspace-BewofPeU.js → flowWorkspace-VnS8nLMT.js} +9354 -9349
  20. package/dist/browser/{getPseudoElementBounds-qDxSDwzN.js → getPseudoElementBounds-5LArT6Xc.js} +494 -474
  21. package/dist/browser/icons-CRxvozBE.js +726 -0
  22. package/dist/browser/{typeScriptSession-CwMPjseS.js → typeScriptSession-Bj2HDFRd.js} +255 -256
  23. package/dist/browser/{waitNotificationInputs-DtrPBwA1.js → waitNotificationInputs-ClCAEIAM.js} +2 -2
  24. package/dist/browser/workbench.css +1 -1
  25. package/dist/browser/workbench.js +547 -611
  26. package/dist/browser/{workbenchSelect-CX8KtT7L.js → workbenchSelect-Cf1zlVm9.js} +398 -398
  27. package/dist/common/control-api-conformance.js +21 -19
  28. package/dist/common/control-api.d.ts +4 -11
  29. package/dist/common/control-api.js +6 -18
  30. package/package.json +1 -1
  31. package/dist/browser/createResourceDialog-4YQKl8lG.js +0 -505
  32. package/dist/browser/dist-BpopSHwP.js +0 -1543
  33. package/dist/browser/dist-CUSrALSX.js +0 -1620
  34. package/dist/browser/icons-DRoMXL5h.js +0 -521
@@ -62,17 +62,18 @@ function d(e, t, n) {
62
62
  async function f(e, t, n) {
63
63
  return c(await d(e, t, n), 201, "Create Flow");
64
64
  }
65
- function p(e, t, n, r) {
65
+ function p(e, t, n, r, i = `change-${crypto.randomUUID()}`) {
66
66
  return u(e, `/v1/flows/${encodeURIComponent(t)}/draft/changes`, {
67
67
  body: JSON.stringify({
68
68
  expectedRevisionId: n,
69
69
  operations: r,
70
70
  version: 1
71
71
  }),
72
+ headers: { "idempotency-key": i },
72
73
  method: "POST"
73
74
  });
74
75
  }
75
- function m(e, t, n, r = "marker") {
76
+ function m(e, t, n, r = "marker", i) {
76
77
  return p(e, t, n, [{
77
78
  kind: "graph.node.create",
78
79
  node: {
@@ -88,7 +89,7 @@ function m(e, t, n, r = "marker") {
88
89
  },
89
90
  nodeId: r,
90
91
  target: { kind: "flow" }
91
- }]);
92
+ }], i);
92
93
  }
93
94
  function h(e, t) {
94
95
  return s(a(e.revision, `${t} revision`).revisionId, `${t} revisionId`);
@@ -197,24 +198,25 @@ var b = [
197
198
  {
198
199
  name: "commits immutable Draft Revisions for one Flow",
199
200
  async verify(e) {
200
- let t = await f(e, "Draft flow", "draft-flow"), n = s(t.flowId, "Draft Flow flowId"), r = s(t.draftRevisionId, "Draft Flow revisionId"), o = await c(await m(e, n, r), 200, "Change Draft"), d = h(o, "Changed Draft");
201
- i(a(o.revision, "Changed Draft revision").parentRevisionId, r, "Changed Draft parent"), await l(await p(e, n, d, [{
202
- kind: "graph.node.replace",
203
- node: {
204
- concurrency: 1,
205
- inputs: {},
206
- kind: "value",
207
- values: [{
208
- handle: "ready",
209
- jsonSchema: { type: "boolean" },
210
- nullable: !1,
211
- value: !0
212
- }]
213
- },
201
+ let t = await f(e, "Draft flow", "draft-flow"), n = s(t.flowId, "Draft Flow flowId"), r = s(t.draftRevisionId, "Draft Flow revisionId"), o = await c(await m(e, n, r, "marker", "draft-change"), 200, "Change Draft"), d = h(o, "Changed Draft");
202
+ i(a(o.revision, "Changed Draft revision").parentRevisionId, r, "Changed Draft parent"), i(await c(await m(e, n, r, "marker", "draft-change"), 200, "Replay Draft change"), o, "Replayed Draft change"), await l(await m(e, n, r, "another-marker", "draft-change"), 409, "flow.conflict", "Conflicting Draft change replay"), await l(await p(e, n, d, [{
203
+ before: [{
204
+ handle: "ready",
205
+ jsonSchema: { type: "boolean" },
206
+ nullable: !1,
207
+ value: !0
208
+ }],
209
+ kind: "graph.node.values.set",
214
210
  nodeId: "marker",
215
- target: { kind: "flow" }
211
+ target: { kind: "flow" },
212
+ value: [{
213
+ handle: "ready",
214
+ jsonSchema: { type: "boolean" },
215
+ nullable: !1,
216
+ value: !0
217
+ }]
216
218
  }]), 400, "flow.invalid", "No-op Draft change"), await l(await m(e, n, r, "stale"), 412, "flow.revision-conflict", "Stale Draft change"), i(a(a(a(a((await c(await u(e, `/v1/flows/${n}/revisions/${r}`), 200, "Read old Revision")).content, "Old content").document, "Old document").graph, "Old graph").nodes, "Old nodes"), {}, "Old Revision nodes"), i((await c(await u(e, `/v1/flows/${n}/draft`), 200, "Read Draft")).revisionId, d, "Draft revisionId");
217
- let g = await c(await u(e, `/v1/flows/${n}/draft/sync?fromRevisionId=${r}`), 200, "Sync Draft");
219
+ let g = await c(await u(e, `/v1/flows/${n}/draft/sync`), 200, "Sync Draft");
218
220
  i(g.kind, "snapshot", "Draft sync kind"), i(a(g.draft, "Draft snapshot").revisionId, d, "Draft snapshot revisionId");
219
221
  }
220
222
  },
@@ -114,18 +114,11 @@ export interface DraftChange {
114
114
  readonly revision: RevisionMetadata;
115
115
  readonly version: 1;
116
116
  }
117
- export type DraftSync = {
118
- readonly kind: 'changes';
119
- readonly revisions: readonly {
120
- readonly operations: readonly ChangeOperation[];
121
- readonly revision: RevisionMetadata;
122
- }[];
123
- readonly version: 1;
124
- } | {
117
+ export interface DraftSync {
125
118
  readonly draft: Draft;
126
119
  readonly kind: 'snapshot';
127
120
  readonly version: 1;
128
- };
121
+ }
129
122
  export interface Publication {
130
123
  readonly actorId: string;
131
124
  readonly closureDigest: string;
@@ -339,7 +332,7 @@ export declare class ControlClient {
339
332
  resumeFlowTrigger(flowId: string, triggerNodeId: string): Promise<TriggerBinding>;
340
333
  testFlowPollTrigger(flowId: string, triggerNodeId: string): Promise<PollTriggerTestResult>;
341
334
  getDraft(flowId: string): Promise<Draft>;
342
- syncDraft(flowId: string, fromRevisionId?: string): Promise<DraftSync>;
335
+ syncDraft(flowId: string): Promise<DraftSync>;
343
336
  getRevision(flowId: string, revisionId: string): Promise<Draft>;
344
337
  listConnectorProviders(signal?: AbortSignal, flowId?: string): Promise<readonly ConnectorProvider[]>;
345
338
  listConnectorActions(serviceId?: string, signal?: AbortSignal, flowId?: string): Promise<readonly ConnectorAction[]>;
@@ -347,7 +340,7 @@ export declare class ControlClient {
347
340
  getConnectorAction(actionId: string, signal?: AbortSignal, flowId?: string): Promise<ConnectorAction>;
348
341
  listConnectorConnections(serviceId: string, signal?: AbortSignal, flowId?: string): Promise<readonly ConnectorConnection[]>;
349
342
  createConnectorConnectionPage(serviceId: string, flowId?: string): Promise<string>;
350
- changeDraft(flowId: string, expectedRevisionId: string, operations: readonly ChangeOperation[]): Promise<DraftChange>;
343
+ changeDraft(flowId: string, expectedRevisionId: string, operations: readonly ChangeOperation[], changeId?: string): Promise<DraftChange>;
351
344
  checkFlow(flowId: string, revisionId: string): Promise<FlowCheck>;
352
345
  getLive(flowId: string): Promise<Live>;
353
346
  listPublications(flowId: string, options?: {
@@ -396,23 +396,11 @@ function M(e) {
396
396
  }
397
397
  function N(e) {
398
398
  let t = a(e);
399
- return t.version == 1 ? t.kind == "snapshot" ? {
399
+ return t.version != 1 || t.kind != "snapshot" ? i() : {
400
400
  draft: j(t.draft),
401
401
  kind: "snapshot",
402
402
  version: 1
403
- } : t.kind != "changes" || !Array.isArray(t.revisions) ? i() : {
404
- kind: "changes",
405
- revisions: t.revisions.map((e) => {
406
- let t = a(e);
407
- if (!Array.isArray(t.operations) || t.operations.length == 0) return i();
408
- for (let e of t.operations) if (typeof a(e).kind != "string") return i();
409
- return {
410
- operations: t.operations,
411
- revision: A(t.revision)
412
- };
413
- }),
414
- version: 1
415
- } : i();
403
+ };
416
404
  }
417
405
  function P(e) {
418
406
  let t = a(e), n = t.operation, r = t.sourcePublicationId;
@@ -839,9 +827,8 @@ var ee = class {
839
827
  async getDraft(e) {
840
828
  return j(await this.request(`/v1/flows/${Q(e)}/draft`));
841
829
  }
842
- async syncDraft(e, t) {
843
- let n = t == null ? "" : `?fromRevisionId=${Q(t)}`;
844
- return N(await this.request(`/v1/flows/${Q(e)}/draft/sync${n}`));
830
+ async syncDraft(e) {
831
+ return N(await this.request(`/v1/flows/${Q(e)}/draft/sync`));
845
832
  }
846
833
  async getRevision(e, t) {
847
834
  return j(await this.request(`/v1/flows/${Q(e)}/revisions/${Q(t)}`));
@@ -887,13 +874,14 @@ var ee = class {
887
874
  return i();
888
875
  }
889
876
  }
890
- async changeDraft(e, t, n) {
877
+ async changeDraft(e, t, n, r = $("change")) {
891
878
  return M(await this.request(`/v1/flows/${Q(e)}/draft/changes`, {
892
879
  body: JSON.stringify({
893
880
  expectedRevisionId: t,
894
881
  operations: n,
895
882
  version: 1
896
883
  }),
884
+ headers: { "idempotency-key": r },
897
885
  method: "POST"
898
886
  }));
899
887
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oomol-lab/open-flow",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "TypeScript contracts and Browser runtime for Open Flow.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,505 +0,0 @@
1
- import { a as e } from "./main-DmjVyuWr.js";
2
- import { $t as t, At as n, B as r, Bn as i, Ct as a, Dn as o, F as s, Fn as c, Gn as l, Hn as u, L as d, Lt as f, M as p, Nt as m, On as h, P as g, R as _, Tt as v, V as y, W as b, Xt as x, Z as S, Zn as C, c as w, er as T, et as E, i as D, jt as O, kt as k, lt as A, n as ee, nt as j, o as te, or as M, p as N, x as P, z as F } from "./getPseudoElementBounds-qDxSDwzN.js";
3
- import { a as I, c as L, d as R, l as ne, s as z, t as re, u as ie } from "./icons-DRoMXL5h.js";
4
- import { t as ae } from "./workbenchSelect-CX8KtT7L.js";
5
- import * as B from "react";
6
- import { useEffect as oe, useRef as V, useState as se } from "react";
7
- import { Fragment as ce, jsx as H, jsxs as U } from "react/jsx-runtime";
8
- //#region ../../node_modules/.bun/lucide-react@0.468.0+f4eacebf2041cd4f/node_modules/lucide-react/dist/esm/icons/x.js
9
- var le = k("X", [["path", {
10
- d: "M18 6 6 18",
11
- key: "1bl5f8"
12
- }], ["path", {
13
- d: "m6 6 12 12",
14
- key: "d8bk6v"
15
- }]]), W = /*#__PURE__*/ B.createContext(void 0);
16
- process.env.NODE_ENV !== "production" && (W.displayName = "DialogRootContext");
17
- function G(e) {
18
- let t = B.useContext(W);
19
- if (e === !1 && t === void 0) throw Error(process.env.NODE_ENV === "production" ? T(27) : "Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.");
20
- return t;
21
- }
22
- //#endregion
23
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/backdrop/DialogBackdrop.js
24
- var ue = {
25
- ...v,
26
- ...t
27
- }, K = /*#__PURE__*/ B.forwardRef(function(e, t) {
28
- let { render: n, className: r, style: i, forceRender: a = !1, ...o } = e, { store: s } = G(), c = s.useState("open"), u = s.useState("nested"), d = s.useState("mounted"), f = {
29
- open: c,
30
- transitionStatus: s.useState("transitionStatus")
31
- };
32
- return l("div", e, {
33
- state: f,
34
- ref: [s.context.backdropRef, t],
35
- stateAttributesMapping: ue,
36
- props: [{
37
- role: "presentation",
38
- hidden: !d,
39
- style: {
40
- userSelect: "none",
41
- WebkitUserSelect: "none"
42
- }
43
- }, o],
44
- enabled: a || !u
45
- });
46
- });
47
- process.env.NODE_ENV !== "production" && (K.displayName = "DialogBackdrop");
48
- //#endregion
49
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/close/DialogClose.js
50
- var q = /*#__PURE__*/ B.forwardRef(function(e, t) {
51
- let { render: n, className: r, disabled: i = !1, nativeButton: a = !0, style: o, ...s } = e, { store: c } = G(), u = c.useState("open");
52
- function d(e) {
53
- u && c.setOpen(!1, O(m, e.nativeEvent));
54
- }
55
- let { getButtonProps: f, buttonRef: p } = C({
56
- disabled: i,
57
- native: a
58
- });
59
- return l("button", e, {
60
- state: { disabled: i },
61
- ref: [t, p],
62
- props: [
63
- { onClick: d },
64
- s,
65
- f
66
- ]
67
- });
68
- });
69
- process.env.NODE_ENV !== "production" && (q.displayName = "DialogClose");
70
- //#endregion
71
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/popup/DialogPopupCssVars.js
72
- var de = /*#__PURE__*/ function(e) {
73
- return e.nestedDialogs = "--nested-dialogs", e;
74
- }({}), fe = function(e) {
75
- return e[e.open = a.open] = "open", e[e.closed = a.closed] = "closed", e[e.startingStyle = a.startingStyle] = "startingStyle", e[e.endingStyle = a.endingStyle] = "endingStyle", e.nested = "data-nested", e.nestedDialogOpen = "data-nested-dialog-open", e;
76
- }({}), J = /*#__PURE__*/ B.createContext(void 0);
77
- process.env.NODE_ENV !== "production" && (J.displayName = "DialogPortalContext");
78
- function pe() {
79
- let e = B.useContext(J);
80
- if (e === void 0) throw Error(process.env.NODE_ENV === "production" ? T(26) : "Base UI: <Dialog.Portal> is missing.");
81
- return e;
82
- }
83
- //#endregion
84
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/popup/DialogPopup.js
85
- var me = {
86
- ...v,
87
- ...t,
88
- nestedDialogOpen(e) {
89
- return e ? { [fe.nestedDialogOpen]: "" } : null;
90
- }
91
- }, Y = /*#__PURE__*/ B.forwardRef(function(e, t) {
92
- let { className: n, finalFocus: r, initialFocus: i, render: a, style: o, ...s } = e, { store: c } = G(), u = c.useState("descriptionElementId"), d = c.useState("disablePointerDismissal"), f = c.useState("floatingRootContext"), p = c.useState("popupProps"), m = c.useState("modal"), h = c.useState("mounted"), g = c.useState("nested"), _ = c.useState("nestedOpenDialogCount"), v = c.useState("open"), y = c.useState("openMethod"), b = c.useState("titleElementId"), S = c.useState("transitionStatus"), C = c.useState("role");
93
- pe(), x({
94
- open: v,
95
- ref: c.context.popupRef,
96
- onComplete() {
97
- v && c.context.onOpenChangeComplete?.(!0);
98
- }
99
- });
100
- function w(e) {
101
- return e !== "touch" || c.context.popupRef.current;
102
- }
103
- let T = i === void 0 ? w : i, E = l("div", e, {
104
- state: {
105
- open: v,
106
- nested: g,
107
- transitionStatus: S,
108
- nestedDialogOpen: _ > 0
109
- },
110
- props: [
111
- p,
112
- {
113
- "aria-labelledby": b ?? void 0,
114
- "aria-describedby": u ?? void 0,
115
- role: C,
116
- tabIndex: -1,
117
- hidden: !h,
118
- onKeyDown(e) {
119
- P.has(e.key) && e.stopPropagation();
120
- },
121
- style: { [de.nestedDialogs]: _ }
122
- },
123
- s
124
- ],
125
- ref: [
126
- t,
127
- c.context.popupRef,
128
- c.useStateSetter("popupElement")
129
- ],
130
- stateAttributesMapping: me
131
- });
132
- return /*#__PURE__*/ H(j, {
133
- context: f,
134
- openInteractionType: y,
135
- disabled: !h,
136
- closeOnFocusOut: !d,
137
- initialFocus: T,
138
- returnFocus: r,
139
- modal: m !== !1,
140
- restoreFocus: "popup",
141
- children: E
142
- });
143
- });
144
- process.env.NODE_ENV !== "production" && (Y.displayName = "DialogPopup");
145
- //#endregion
146
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/portal/DialogPortal.js
147
- var X = /*#__PURE__*/ B.forwardRef(function(e, t) {
148
- let { keepMounted: n = !1, ...r } = e, { store: i } = G(), a = i.useState("mounted"), o = i.useState("modal"), s = i.useState("open");
149
- return a || n ? /*#__PURE__*/ H(J.Provider, {
150
- value: n,
151
- children: /*#__PURE__*/ U(A, {
152
- ref: t,
153
- ...r,
154
- children: [a && o === !0 && /*#__PURE__*/ H(w, {
155
- ref: i.context.internalBackdropRef,
156
- inert: N(!s)
157
- }), e.children]
158
- })
159
- }) : null;
160
- });
161
- process.env.NODE_ENV !== "production" && (X.displayName = "DialogPortal");
162
- //#endregion
163
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/root/useDialogRoot.js
164
- function he(e) {
165
- let { store: t, parentContext: n, actionsRef: i, isDrawer: a } = e, c = t.useState("open"), l = t.useState("disablePointerDismissal"), u = t.useState("modal"), d = t.useState("popupElement"), { openMethod: m, triggerProps: _ } = ee(c);
166
- r(t);
167
- let { forceUnmount: v } = y(c, t), b = B.useCallback(() => {
168
- t.setOpen(!1, O(f));
169
- }, [t]);
170
- B.useImperativeHandle(i, () => ({
171
- unmount: v,
172
- close: b
173
- }), [v, b]);
174
- let x = s({
175
- popupStore: t,
176
- onOpenChange: t.setOpen,
177
- treatPopupAsFloatingElement: !0
178
- }), [S, C] = B.useState(0), [w, T] = B.useState(0), D = S === 0, k = p(x), A = E(x, {
179
- outsidePressEvent() {
180
- return t.context.internalBackdropRef.current || t.context.backdropRef.current ? "intentional" : {
181
- mouse: u === "trap-focus" ? "sloppy" : "intentional",
182
- touch: "sloppy"
183
- };
184
- },
185
- outsidePress(e) {
186
- if (!t.context.outsidePressEnabledRef.current || "button" in e && e.button !== 0 || "touches" in e && e.touches.length !== 1) return !1;
187
- let n = h(e);
188
- if (D && !l) {
189
- let e = n;
190
- return u && (t.context.internalBackdropRef.current || t.context.backdropRef.current) ? t.context.internalBackdropRef.current === e || t.context.backdropRef.current === e || o(e, d) && !e?.hasAttribute("data-base-ui-portal") : !0;
191
- }
192
- return !1;
193
- },
194
- escapeKey: D
195
- });
196
- te(c && u === !0, d);
197
- let { getReferenceProps: j, getFloatingProps: M, getTriggerProps: N } = g([k, A]);
198
- t.useContextCallback("onNestedDialogOpen", (e, t) => {
199
- C(e), T(t);
200
- }), t.useContextCallback("onNestedDialogClose", () => {
201
- C(0), T(0);
202
- }), B.useEffect(() => (n?.onNestedDialogOpen && c && n.onNestedDialogOpen(S + 1, w + +!!a), n?.onNestedDialogClose && !c && n.onNestedDialogClose(), () => {
203
- n?.onNestedDialogClose && c && n.onNestedDialogClose();
204
- }), [
205
- a,
206
- c,
207
- S,
208
- w,
209
- n
210
- ]);
211
- let P = B.useMemo(() => j(_), [j, _]), F = B.useMemo(() => N(_), [N, _]), I = B.useMemo(() => M(), [M]);
212
- t.useSyncedValues({
213
- openMethod: m,
214
- activeTriggerProps: P,
215
- inactiveTriggerProps: F,
216
- popupProps: I,
217
- floatingRootContext: x,
218
- nestedOpenDialogCount: S,
219
- nestedOpenDrawerCount: w
220
- });
221
- }
222
- //#endregion
223
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/store/DialogStore.js
224
- var ge = {
225
- ..._,
226
- modal: S((e) => e.modal),
227
- nested: S((e) => e.nested),
228
- nestedOpenDialogCount: S((e) => e.nestedOpenDialogCount),
229
- nestedOpenDrawerCount: S((e) => e.nestedOpenDrawerCount),
230
- disablePointerDismissal: S((e) => e.disablePointerDismissal),
231
- openMethod: S((e) => e.openMethod),
232
- descriptionElementId: S((e) => e.descriptionElementId),
233
- titleElementId: S((e) => e.titleElementId),
234
- viewportElement: S((e) => e.viewportElement),
235
- role: S((e) => e.role)
236
- }, _e = class e extends b {
237
- constructor(e) {
238
- super(ve(e), {
239
- popupRef: /*#__PURE__*/ B.createRef(),
240
- backdropRef: /*#__PURE__*/ B.createRef(),
241
- internalBackdropRef: /*#__PURE__*/ B.createRef(),
242
- outsidePressEnabledRef: { current: !0 },
243
- triggerElements: new F(),
244
- onOpenChange: void 0,
245
- onOpenChangeComplete: void 0
246
- }, ge);
247
- }
248
- setOpen = (e, t) => {
249
- if (t.preventUnmountOnClose = () => {
250
- this.set("preventUnmountingOnClose", !0);
251
- }, !e && t.trigger == null && this.state.activeTriggerId != null && (t.trigger = this.state.activeTriggerElement ?? void 0), this.context.onOpenChange?.(e, t), t.isCanceled) return;
252
- this.state.floatingRootContext.dispatchOpenChange(e, t);
253
- let n = { open: e }, r = t.trigger?.id ?? null;
254
- (r || e) && (n.activeTriggerId = r, n.activeTriggerElement = t.trigger ?? null), this.update(n);
255
- };
256
- static useStore(t, n) {
257
- let r = M(() => new e(n)).current;
258
- return t ?? r;
259
- }
260
- };
261
- function ve(e = {}) {
262
- return {
263
- ...d(),
264
- modal: !0,
265
- disablePointerDismissal: !1,
266
- popupElement: null,
267
- viewportElement: null,
268
- descriptionElementId: void 0,
269
- titleElementId: void 0,
270
- openMethod: null,
271
- nested: !1,
272
- nestedOpenDialogCount: 0,
273
- nestedOpenDrawerCount: 0,
274
- role: "dialog",
275
- ...e
276
- };
277
- }
278
- //#endregion
279
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/root/DialogRoot.js
280
- var Z = /*#__PURE__*/ B.createContext(!1);
281
- process.env.NODE_ENV !== "production" && (Z.displayName = "IsDrawerContext");
282
- function ye(e) {
283
- let { children: t, open: n, defaultOpen: r = !1, onOpenChange: i, onOpenChangeComplete: a, disablePointerDismissal: o = !1, modal: s = !0, actionsRef: c, handle: l, triggerId: u, defaultTriggerId: d = null } = e, f = G(!0), p = B.useContext(Z), m = !!f, h = _e.useStore(l?.store, {
284
- open: r,
285
- openProp: n,
286
- activeTriggerId: d,
287
- triggerIdProp: u,
288
- modal: s,
289
- disablePointerDismissal: o,
290
- nested: m
291
- });
292
- D(() => {
293
- n === void 0 && h.state.open === !1 && r === !0 && h.update({
294
- open: !0,
295
- activeTriggerId: d
296
- });
297
- }), h.useControlledProp("openProp", n), h.useControlledProp("triggerIdProp", u), h.useSyncedValues({
298
- disablePointerDismissal: o,
299
- nested: m,
300
- modal: s
301
- }), h.useContextCallback("onOpenChange", i), h.useContextCallback("onOpenChangeComplete", a);
302
- let g = h.useState("payload");
303
- he({
304
- store: h,
305
- actionsRef: c,
306
- parentContext: f?.store.context,
307
- isDrawer: p,
308
- onOpenChange: i,
309
- triggerIdProp: u
310
- });
311
- let _ = B.useMemo(() => ({ store: h }), [h]);
312
- return /*#__PURE__*/ H(Z.Provider, {
313
- value: !1,
314
- children: /*#__PURE__*/ H(W.Provider, {
315
- value: _,
316
- children: typeof t == "function" ? t({ payload: g }) : t
317
- })
318
- });
319
- }
320
- //#endregion
321
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+b87d06724be9db7a/node_modules/@base-ui/react/esm/dialog/title/DialogTitle.js
322
- var Q = /*#__PURE__*/ B.forwardRef(function(e, t) {
323
- let { render: n, className: r, style: i, id: a, ...o } = e, { store: s } = G(), u = c(a);
324
- return s.useSyncedValueWithCleanup("titleElementId", u), l("h2", e, {
325
- ref: t,
326
- props: [{ id: u }, o]
327
- });
328
- });
329
- process.env.NODE_ENV !== "production" && (Q.displayName = "DialogTitle");
330
- //#endregion
331
- //#region src/ui/browser/dialog.tsx
332
- function be(e) {
333
- return /* @__PURE__ */ H(ye, {
334
- "data-slot": "dialog",
335
- ...e
336
- });
337
- }
338
- function xe(e) {
339
- return /* @__PURE__ */ H(X, {
340
- "data-slot": "dialog-portal",
341
- ...e
342
- });
343
- }
344
- function $(e) {
345
- return /* @__PURE__ */ H(q, {
346
- "data-slot": "dialog-close",
347
- ...e
348
- });
349
- }
350
- function Se({ className: e, ...t }) {
351
- return /* @__PURE__ */ H(K, {
352
- "data-slot": "dialog-overlay",
353
- className: u("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:animate-none motion-reduce:transition-none", e),
354
- ...t
355
- });
356
- }
357
- function Ce({ children: e, className: t, closeLabel: n = "Close", container: r, showCloseButton: a = !0, ...o }) {
358
- return /* @__PURE__ */ U(xe, {
359
- container: r,
360
- children: [/* @__PURE__ */ H(Se, {}), /* @__PURE__ */ U(Y, {
361
- "data-slot": "dialog-content",
362
- className: u("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none motion-reduce:transition-none", t),
363
- ...o,
364
- children: [e, a && /* @__PURE__ */ U(q, {
365
- "data-slot": "dialog-close",
366
- render: /* @__PURE__ */ H(i, {
367
- className: "absolute top-2 right-2",
368
- size: "icon-sm",
369
- variant: "ghost"
370
- }),
371
- children: [/* @__PURE__ */ H(le, {}), /* @__PURE__ */ H("span", {
372
- className: "sr-only",
373
- children: n
374
- })]
375
- })]
376
- })]
377
- });
378
- }
379
- function we({ className: e, ...t }) {
380
- return /* @__PURE__ */ H("div", {
381
- "data-slot": "dialog-header",
382
- className: u("flex flex-col gap-2", e),
383
- ...t
384
- });
385
- }
386
- function Te({ className: e, ...t }) {
387
- return /* @__PURE__ */ H("div", {
388
- "data-slot": "dialog-footer",
389
- className: u("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-border bg-muted/50 p-4 sm:flex-row sm:justify-end", e),
390
- ...t
391
- });
392
- }
393
- function Ee({ className: e, ...t }) {
394
- return /* @__PURE__ */ H(Q, {
395
- "data-slot": "dialog-title",
396
- className: u("text-base leading-none font-medium", e),
397
- ...t
398
- });
399
- }
400
- //#endregion
401
- //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
402
- function De({ disabled: t, field: r, id: a, issue: o, label: s, name: c, onNameChange: l, onOpenChange: u, onSubmit: d, pending: f, title: p }) {
403
- let m = e(), h = V(null), g = V(null), [_, v] = se(!1), y = c.length > 0 && o != null, b = m(y ? `resource.nameIssue.${o}` : "resource.nameHint", { max: 80 }), x = `${a}-message`, S = `${a}-option`;
404
- return oe(() => v(!0), []), /* @__PURE__ */ U(ce, { children: [/* @__PURE__ */ H("div", { ref: g }), /* @__PURE__ */ H(be, {
405
- onOpenChange: v,
406
- onOpenChangeComplete: (e) => {
407
- e || u(!1);
408
- },
409
- open: _,
410
- children: /* @__PURE__ */ H(Ce, {
411
- container: g.current,
412
- initialFocus: () => h.current,
413
- showCloseButton: !1,
414
- children: /* @__PURE__ */ U("form", {
415
- className: "flex flex-col gap-4",
416
- onSubmit: d,
417
- children: [
418
- /* @__PURE__ */ U(we, {
419
- className: "flex-row items-center justify-between",
420
- children: [/* @__PURE__ */ H(Ee, { children: p }), /* @__PURE__ */ H($, {
421
- "aria-label": m("common.cancel"),
422
- render: /* @__PURE__ */ H(i, {
423
- size: "icon-sm",
424
- variant: "ghost"
425
- }),
426
- type: "button",
427
- children: /* @__PURE__ */ H(re, { name: "close" })
428
- })]
429
- }),
430
- /* @__PURE__ */ U(ie, {
431
- className: "gap-4",
432
- children: [/* @__PURE__ */ U(z, {
433
- "data-invalid": y,
434
- children: [
435
- /* @__PURE__ */ H(R, {
436
- htmlFor: a,
437
- children: s
438
- }),
439
- /* @__PURE__ */ H(n, {
440
- autoComplete: "off",
441
- "aria-describedby": x,
442
- "aria-invalid": y,
443
- id: a,
444
- name: "resource-name",
445
- onChange: (e) => l(e.target.value),
446
- ref: h,
447
- required: !0,
448
- value: c
449
- }),
450
- H(y ? ne : L, {
451
- id: x,
452
- children: b
453
- })
454
- ]
455
- }), r != null && /* @__PURE__ */ U(z, { children: [
456
- /* @__PURE__ */ H(R, {
457
- htmlFor: r.state == "ready" ? S : void 0,
458
- children: r.label
459
- }),
460
- r.state == "ready" ? /* @__PURE__ */ H(ae, {
461
- ariaLabel: r.ariaLabel,
462
- className: "w-full",
463
- id: S,
464
- onValueChange: r.onValueChange,
465
- options: r.options,
466
- portalRoot: g.current,
467
- value: r.value
468
- }) : /* @__PURE__ */ U("div", {
469
- className: "flex min-h-9 items-center gap-2 rounded-lg border bg-muted/30 px-3 py-2 text-sm text-muted-foreground",
470
- role: r.state == "error" ? "alert" : "status",
471
- children: [
472
- r.state == "loading" && /* @__PURE__ */ H(I, { "aria-hidden": "true" }),
473
- /* @__PURE__ */ H("span", { children: r.status }),
474
- r.state == "error" && /* @__PURE__ */ H(i, {
475
- className: "ml-auto bg-background",
476
- onClick: r.onRetry,
477
- size: "sm",
478
- type: "button",
479
- variant: "outline",
480
- children: r.retry
481
- })
482
- ]
483
- }),
484
- /* @__PURE__ */ H(L, { children: r.description })
485
- ] })]
486
- }),
487
- /* @__PURE__ */ U(Te, {
488
- className: "mx-0 mb-0 border-0 bg-transparent p-0 pt-1",
489
- children: [/* @__PURE__ */ H($, {
490
- render: /* @__PURE__ */ H(i, { variant: "outline" }),
491
- type: "button",
492
- children: m("common.cancel")
493
- }), /* @__PURE__ */ H(i, {
494
- disabled: t || f || o != null,
495
- type: "submit",
496
- children: m(f ? "common.creating" : "common.create")
497
- })]
498
- })
499
- ]
500
- })
501
- })
502
- })] });
503
- }
504
- //#endregion
505
- export { De as default };