@oomol-lab/open-flow 0.1.0-alpha.2 → 0.1.0-alpha.3

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.
@@ -1,439 +0,0 @@
1
- import { A as e, Bn as t, C as n, D as r, E as i, J as a, K as o, L as s, M as c, N as l, O as u, P as d, R as f, Tr as p, Tt as m, Ut as h, Vn as g, Vt as _, Yr as v, _ as y, _t as b, ft as x, g as S, gr as C, gt as w, ht as T, j as E, k as D, or as O, rt as k, s as A, tr as j, ur as M, ut as N, v as P, w as ee, x as F, xt as I, y as L, yr as R, z } from "./composite-7VwgfnXx.js";
2
- import * as B from "react";
3
- import { useEffect as te, useRef as V, useState as ne } from "react";
4
- import { Fragment as re, jsx as H, jsxs as U } from "react/jsx-runtime";
5
- //#region ../../node_modules/@base-ui/react/esm/dialog/root/DialogRootContext.js
6
- var W = /*#__PURE__*/ B.createContext(void 0);
7
- process.env.NODE_ENV !== "production" && (W.displayName = "DialogRootContext");
8
- function G(e) {
9
- let t = B.useContext(W);
10
- if (e === !1 && t === void 0) throw Error(process.env.NODE_ENV === "production" ? R(27) : "Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.");
11
- return t;
12
- }
13
- //#endregion
14
- //#region ../../node_modules/@base-ui/react/esm/dialog/backdrop/DialogBackdrop.js
15
- var ie = {
16
- ...F,
17
- ...h
18
- }, K = /*#__PURE__*/ B.forwardRef(function(e, t) {
19
- let { render: n, className: r, style: i, forceRender: a = !1, ...o } = e, { store: s } = G(), c = s.useState("open"), l = s.useState("nested"), u = s.useState("mounted"), d = {
20
- open: c,
21
- transitionStatus: s.useState("transitionStatus")
22
- };
23
- return M("div", e, {
24
- state: d,
25
- ref: [s.context.backdropRef, t],
26
- stateAttributesMapping: ie,
27
- props: [{
28
- role: "presentation",
29
- hidden: !u,
30
- style: {
31
- userSelect: "none",
32
- WebkitUserSelect: "none"
33
- }
34
- }, o],
35
- enabled: a || !l
36
- });
37
- });
38
- process.env.NODE_ENV !== "production" && (K.displayName = "DialogBackdrop");
39
- //#endregion
40
- //#region ../../node_modules/@base-ui/react/esm/dialog/close/DialogClose.js
41
- var q = /*#__PURE__*/ B.forwardRef(function(e, t) {
42
- let { render: n, className: r, disabled: i = !1, nativeButton: a = !0, style: o, ...s } = e, { store: c } = G(), l = c.useState("open");
43
- function u(e) {
44
- l && c.setOpen(!1, b(I, e.nativeEvent));
45
- }
46
- let { getButtonProps: d, buttonRef: f } = C({
47
- disabled: i,
48
- native: a
49
- });
50
- return M("button", e, {
51
- state: { disabled: i },
52
- ref: [t, f],
53
- props: [
54
- { onClick: u },
55
- s,
56
- d
57
- ]
58
- });
59
- });
60
- process.env.NODE_ENV !== "production" && (q.displayName = "DialogClose");
61
- //#endregion
62
- //#region ../../node_modules/@base-ui/react/esm/dialog/popup/DialogPopupCssVars.js
63
- var ae = /*#__PURE__*/ function(e) {
64
- return e.nestedDialogs = "--nested-dialogs", e;
65
- }({}), oe = function(e) {
66
- return e[e.open = L.open] = "open", e[e.closed = L.closed] = "closed", e[e.startingStyle = L.startingStyle] = "startingStyle", e[e.endingStyle = L.endingStyle] = "endingStyle", e.nested = "data-nested", e.nestedDialogOpen = "data-nested-dialog-open", e;
67
- }({}), J = /*#__PURE__*/ B.createContext(void 0);
68
- process.env.NODE_ENV !== "production" && (J.displayName = "DialogPortalContext");
69
- function se() {
70
- let e = B.useContext(J);
71
- if (e === void 0) throw Error(process.env.NODE_ENV === "production" ? R(26) : "Base UI: <Dialog.Portal> is missing.");
72
- return e;
73
- }
74
- //#endregion
75
- //#region ../../node_modules/@base-ui/react/esm/dialog/popup/DialogPopup.js
76
- var ce = {
77
- ...F,
78
- ...h,
79
- nestedDialogOpen(e) {
80
- return e ? { [oe.nestedDialogOpen]: "" } : null;
81
- }
82
- }, Y = /*#__PURE__*/ B.forwardRef(function(e, t) {
83
- let { className: n, finalFocus: r, initialFocus: i, render: a, style: o, ...s } = e, { store: c } = G(), l = c.useState("descriptionElementId"), u = c.useState("disablePointerDismissal"), d = c.useState("floatingRootContext"), f = c.useState("popupProps"), p = c.useState("modal"), m = c.useState("mounted"), h = c.useState("nested"), g = c.useState("nestedOpenDialogCount"), v = c.useState("open"), y = c.useState("openMethod"), b = c.useState("titleElementId"), x = c.useState("transitionStatus"), S = c.useState("role");
84
- se(), _({
85
- open: v,
86
- ref: c.context.popupRef,
87
- onComplete() {
88
- v && c.context.onOpenChangeComplete?.(!0);
89
- }
90
- });
91
- function C(e) {
92
- return e !== "touch" || c.context.popupRef.current;
93
- }
94
- let w = i === void 0 ? C : i, T = M("div", e, {
95
- state: {
96
- open: v,
97
- nested: h,
98
- transitionStatus: x,
99
- nestedDialogOpen: g > 0
100
- },
101
- props: [
102
- f,
103
- {
104
- "aria-labelledby": b ?? void 0,
105
- "aria-describedby": l ?? void 0,
106
- role: S,
107
- tabIndex: -1,
108
- hidden: !m,
109
- onKeyDown(e) {
110
- A.has(e.key) && e.stopPropagation();
111
- },
112
- style: { [ae.nestedDialogs]: g }
113
- },
114
- s
115
- ],
116
- ref: [
117
- t,
118
- c.context.popupRef,
119
- c.useStateSetter("popupElement")
120
- ],
121
- stateAttributesMapping: ce
122
- });
123
- return /*#__PURE__*/ H(z, {
124
- context: d,
125
- openInteractionType: y,
126
- disabled: !m,
127
- closeOnFocusOut: !u,
128
- initialFocus: w,
129
- returnFocus: r,
130
- modal: p !== !1,
131
- restoreFocus: "popup",
132
- children: T
133
- });
134
- });
135
- process.env.NODE_ENV !== "production" && (Y.displayName = "DialogPopup");
136
- //#endregion
137
- //#region ../../node_modules/@base-ui/react/esm/dialog/portal/DialogPortal.js
138
- var X = /*#__PURE__*/ B.forwardRef(function(e, t) {
139
- let { keepMounted: n = !1, ...r } = e, { store: i } = G(), a = i.useState("mounted"), s = i.useState("modal"), c = i.useState("open");
140
- return a || n ? /*#__PURE__*/ H(J.Provider, {
141
- value: n,
142
- children: /*#__PURE__*/ U(o, {
143
- ref: t,
144
- ...r,
145
- children: [a && s === !0 && /*#__PURE__*/ H(y, {
146
- ref: i.context.internalBackdropRef,
147
- inert: P(!c)
148
- }), e.children]
149
- })
150
- }) : null;
151
- });
152
- process.env.NODE_ENV !== "production" && (X.displayName = "DialogPortal");
153
- //#endregion
154
- //#region ../../node_modules/@base-ui/react/esm/dialog/root/useDialogRoot.js
155
- function le(e) {
156
- let { store: n, parentContext: a, actionsRef: o, isDrawer: d } = e, f = n.useState("open"), p = n.useState("disablePointerDismissal"), h = n.useState("modal"), _ = n.useState("popupElement"), { openMethod: v, triggerProps: y } = ee(f);
157
- c(n);
158
- let { forceUnmount: x } = l(f, n), C = B.useCallback(() => {
159
- n.setOpen(!1, b(m));
160
- }, [n]);
161
- B.useImperativeHandle(o, () => ({
162
- unmount: x,
163
- close: C
164
- }), [x, C]);
165
- let w = u({
166
- popupStore: n,
167
- onOpenChange: n.setOpen,
168
- treatPopupAsFloatingElement: !0
169
- }), [T, E] = B.useState(0), [D, O] = B.useState(0), k = T === 0, A = i(w), j = s(w, {
170
- outsidePressEvent() {
171
- return n.context.internalBackdropRef.current || n.context.backdropRef.current ? "intentional" : {
172
- mouse: h === "trap-focus" ? "sloppy" : "intentional",
173
- touch: "sloppy"
174
- };
175
- },
176
- outsidePress(e) {
177
- if (!n.context.outsidePressEnabledRef.current || "button" in e && e.button !== 0 || "touches" in e && e.touches.length !== 1) return !1;
178
- let r = g(e);
179
- if (k && !p) {
180
- let e = r;
181
- return h && (n.context.internalBackdropRef.current || n.context.backdropRef.current) ? n.context.internalBackdropRef.current === e || n.context.backdropRef.current === e || t(e, _) && !e?.hasAttribute("data-base-ui-portal") : !0;
182
- }
183
- return !1;
184
- },
185
- escapeKey: k
186
- });
187
- S(f && h === !0, _);
188
- let { getReferenceProps: M, getFloatingProps: N, getTriggerProps: P } = r([A, j]);
189
- n.useContextCallback("onNestedDialogOpen", (e, t) => {
190
- E(e), O(t);
191
- }), n.useContextCallback("onNestedDialogClose", () => {
192
- E(0), O(0);
193
- }), B.useEffect(() => (a?.onNestedDialogOpen && f && a.onNestedDialogOpen(T + 1, D + +!!d), a?.onNestedDialogClose && !f && a.onNestedDialogClose(), () => {
194
- a?.onNestedDialogClose && f && a.onNestedDialogClose();
195
- }), [
196
- d,
197
- f,
198
- T,
199
- D,
200
- a
201
- ]);
202
- let F = B.useMemo(() => M(y), [M, y]), I = B.useMemo(() => P(y), [P, y]), L = B.useMemo(() => N(), [N]);
203
- n.useSyncedValues({
204
- openMethod: v,
205
- activeTriggerProps: F,
206
- inactiveTriggerProps: I,
207
- popupProps: L,
208
- floatingRootContext: w,
209
- nestedOpenDialogCount: T,
210
- nestedOpenDrawerCount: D
211
- });
212
- }
213
- //#endregion
214
- //#region ../../node_modules/@base-ui/react/esm/dialog/store/DialogStore.js
215
- var ue = {
216
- ...e,
217
- modal: N((e) => e.modal),
218
- nested: N((e) => e.nested),
219
- nestedOpenDialogCount: N((e) => e.nestedOpenDialogCount),
220
- nestedOpenDrawerCount: N((e) => e.nestedOpenDrawerCount),
221
- disablePointerDismissal: N((e) => e.disablePointerDismissal),
222
- openMethod: N((e) => e.openMethod),
223
- descriptionElementId: N((e) => e.descriptionElementId),
224
- titleElementId: N((e) => e.titleElementId),
225
- viewportElement: N((e) => e.viewportElement),
226
- role: N((e) => e.role)
227
- }, de = class e extends k {
228
- constructor(e) {
229
- super(fe(e), {
230
- popupRef: /*#__PURE__*/ B.createRef(),
231
- backdropRef: /*#__PURE__*/ B.createRef(),
232
- internalBackdropRef: /*#__PURE__*/ B.createRef(),
233
- outsidePressEnabledRef: { current: !0 },
234
- triggerElements: new E(),
235
- onOpenChange: void 0,
236
- onOpenChangeComplete: void 0
237
- }, ue);
238
- }
239
- setOpen = (e, t) => {
240
- if (t.preventUnmountOnClose = () => {
241
- this.set("preventUnmountingOnClose", !0);
242
- }, !e && t.trigger == null && this.state.activeTriggerId != null && (t.trigger = this.state.activeTriggerElement ?? void 0), this.context.onOpenChange?.(e, t), t.isCanceled) return;
243
- this.state.floatingRootContext.dispatchOpenChange(e, t);
244
- let n = { open: e }, r = t.trigger?.id ?? null;
245
- (r || e) && (n.activeTriggerId = r, n.activeTriggerElement = t.trigger ?? null), this.update(n);
246
- };
247
- static useStore(t, n) {
248
- let r = p(() => new e(n)).current;
249
- return t ?? r;
250
- }
251
- };
252
- function fe(e = {}) {
253
- return {
254
- ...D(),
255
- modal: !0,
256
- disablePointerDismissal: !1,
257
- popupElement: null,
258
- viewportElement: null,
259
- descriptionElementId: void 0,
260
- titleElementId: void 0,
261
- openMethod: null,
262
- nested: !1,
263
- nestedOpenDialogCount: 0,
264
- nestedOpenDrawerCount: 0,
265
- role: "dialog",
266
- ...e
267
- };
268
- }
269
- //#endregion
270
- //#region ../../node_modules/@base-ui/react/esm/dialog/root/DialogRoot.js
271
- var Z = /*#__PURE__*/ B.createContext(!1);
272
- process.env.NODE_ENV !== "production" && (Z.displayName = "IsDrawerContext");
273
- function pe(e) {
274
- 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 = de.useStore(l?.store, {
275
- open: r,
276
- openProp: n,
277
- activeTriggerId: d,
278
- triggerIdProp: u,
279
- modal: s,
280
- disablePointerDismissal: o,
281
- nested: m
282
- });
283
- x(() => {
284
- n === void 0 && h.state.open === !1 && r === !0 && h.update({
285
- open: !0,
286
- activeTriggerId: d
287
- });
288
- }), h.useControlledProp("openProp", n), h.useControlledProp("triggerIdProp", u), h.useSyncedValues({
289
- disablePointerDismissal: o,
290
- nested: m,
291
- modal: s
292
- }), h.useContextCallback("onOpenChange", i), h.useContextCallback("onOpenChangeComplete", a);
293
- let g = h.useState("payload");
294
- le({
295
- store: h,
296
- actionsRef: c,
297
- parentContext: f?.store.context,
298
- isDrawer: p,
299
- onOpenChange: i,
300
- triggerIdProp: u
301
- });
302
- let _ = B.useMemo(() => ({ store: h }), [h]);
303
- return /*#__PURE__*/ H(Z.Provider, {
304
- value: !1,
305
- children: /*#__PURE__*/ H(W.Provider, {
306
- value: _,
307
- children: typeof t == "function" ? t({ payload: g }) : t
308
- })
309
- });
310
- }
311
- //#endregion
312
- //#region ../../node_modules/@base-ui/react/esm/dialog/title/DialogTitle.js
313
- var Q = /*#__PURE__*/ B.forwardRef(function(e, t) {
314
- let { render: n, className: r, style: i, id: a, ...o } = e, { store: s } = G(), c = j(a);
315
- return s.useSyncedValueWithCleanup("titleElementId", c), M("h2", e, {
316
- ref: t,
317
- props: [{ id: c }, o]
318
- });
319
- });
320
- process.env.NODE_ENV !== "production" && (Q.displayName = "DialogTitle");
321
- //#endregion
322
- //#region ../../node_modules/@base-ui/react/esm/dialog/trigger/DialogTrigger.js
323
- var me = /*#__PURE__*/ B.forwardRef(function(e, t) {
324
- let { render: i, className: o, disabled: s = !1, nativeButton: c = !0, id: l, payload: u, handle: p, style: m, ...h } = e, g = G(!0), _ = p?.store ?? g?.store;
325
- if (!_) throw Error(process.env.NODE_ENV === "production" ? R(79) : "Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.");
326
- let v = j(l), y = _.useState("floatingRootContext"), b = _.useState("isOpenedByTrigger", v), x = B.useRef(null), { registerTrigger: S, isMountedByThisTrigger: w } = d(v, x, _, { payload: u }), { getButtonProps: T, buttonRef: E } = C({
327
- disabled: s,
328
- native: c
329
- }), D = f(y, { enabled: y != null }), O = r([D]), k = {
330
- disabled: s,
331
- open: b
332
- }, A = _.useState("triggerProps", w);
333
- return M("button", e, {
334
- state: k,
335
- ref: [
336
- E,
337
- t,
338
- S,
339
- x
340
- ],
341
- props: [
342
- O.getReferenceProps(),
343
- A,
344
- {
345
- [a]: "",
346
- id: v
347
- },
348
- h,
349
- T
350
- ],
351
- stateAttributesMapping: n
352
- });
353
- });
354
- process.env.NODE_ENV !== "production" && (me.displayName = "DialogTrigger");
355
- //#endregion
356
- //#region src/ui/browser/dialog.tsx
357
- var he = pe, $ = q, ge = Y, _e = K, ve = X, ye = Q;
358
- //#endregion
359
- //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
360
- function be({ id: e, issue: t, label: n, name: r, onNameChange: i, onOpenChange: a, onSubmit: o, pending: s, title: c }) {
361
- let l = v(), u = V(null), d = V(null), [f, p] = ne(!1), m = r.length > 0 && t != null, h = l(m ? `resource.nameIssue.${t}` : "resource.nameHint", { max: 80 }), g = `${e}-message`;
362
- return te(() => p(!0), []), /* @__PURE__ */ U(re, { children: [/* @__PURE__ */ H("div", {
363
- className: "resource-dialog-portal",
364
- ref: d
365
- }), /* @__PURE__ */ H(he, {
366
- onOpenChange: p,
367
- onOpenChangeComplete: (e) => {
368
- e || a(!1);
369
- },
370
- open: f,
371
- children: /* @__PURE__ */ U(ve, {
372
- container: d,
373
- children: [/* @__PURE__ */ H(_e, { className: "resource-dialog-backdrop" }), /* @__PURE__ */ H(ge, {
374
- className: "resource-dialog-popup",
375
- initialFocus: () => u.current,
376
- children: /* @__PURE__ */ U("form", {
377
- className: "resource-dialog-form",
378
- onSubmit: o,
379
- children: [
380
- /* @__PURE__ */ U("header", {
381
- className: "resource-dialog-header",
382
- children: [/* @__PURE__ */ H(ye, { children: c }), /* @__PURE__ */ H($, {
383
- "aria-label": l("common.cancel"),
384
- render: /* @__PURE__ */ H(O, {
385
- size: "icon-sm",
386
- variant: "ghost"
387
- }),
388
- type: "button",
389
- children: /* @__PURE__ */ H(T, {
390
- name: "close",
391
- size: 16
392
- })
393
- })]
394
- }),
395
- /* @__PURE__ */ H("div", {
396
- className: "resource-dialog-body",
397
- children: /* @__PURE__ */ U("label", {
398
- className: "resource-dialog-field",
399
- children: [
400
- /* @__PURE__ */ H("span", { children: n }),
401
- /* @__PURE__ */ H(w, {
402
- autoComplete: "off",
403
- "aria-describedby": g,
404
- "aria-invalid": m,
405
- id: e,
406
- name: "resource-name",
407
- onChange: (e) => i(e.target.value),
408
- ref: u,
409
- required: !0,
410
- value: r
411
- }),
412
- /* @__PURE__ */ H("small", {
413
- className: `resource-name-message ${m ? "error" : ""}`,
414
- id: g,
415
- children: h
416
- })
417
- ]
418
- })
419
- }),
420
- /* @__PURE__ */ U("footer", {
421
- className: "resource-dialog-footer",
422
- children: [/* @__PURE__ */ H($, {
423
- render: /* @__PURE__ */ H(O, { variant: "outline" }),
424
- type: "button",
425
- children: l("common.cancel")
426
- }), /* @__PURE__ */ H(O, {
427
- disabled: s || t != null,
428
- type: "submit",
429
- children: l(s ? "common.creating" : "common.create")
430
- })]
431
- })
432
- ]
433
- })
434
- })]
435
- })
436
- })] });
437
- }
438
- //#endregion
439
- export { be as default };
@@ -1,4 +0,0 @@
1
- //#region ../../node_modules/@wopjs/cast/dist/index.mjs
2
- var e = (e) => e !== void 0, t = (e) => !!e, n = (e) => e === !0 || e === !1, r = (e) => typeof e == "string", i = Array.isArray, a = (e) => typeof e == "object" && !!e, o = (e) => a(e) && !i(e), s = (e) => o(e) ? e : void 0, c = () => !0;
3
- //#endregion
4
- export { r as a, s as c, o as i, n, t as o, e as r, c as s, i as t };