@destyler/dialog 0.0.7-beta.5 → 0.0.7-beta.9

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.
package/dist/index.d.ts CHANGED
@@ -1,131 +1,134 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
3
- import * as _zag_js_core from '@zag-js/core';
4
- import { StateMachine, Machine } from '@zag-js/core';
5
- import { DismissableElementHandlers, PersistentElementOptions } from '@zag-js/dismissable';
6
- export { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from '@zag-js/dismissable';
7
-
8
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"trigger" | "backdrop" | "positioner" | "content" | "title" | "description" | "closeTrigger">;
1
+ import * as _destyler_anatomy0 from "@destyler/anatomy";
2
+ import { DismissableElementHandlers, FocusOutsideEvent, InteractOutsideEvent, PersistentElementOptions, PointerDownOutsideEvent } from "@destyler/dismissable";
3
+ import * as _destyler_xstate0 from "@destyler/xstate";
4
+ import { AnyEventObject, Machine, XSend, XState } from "@destyler/xstate";
5
+ import { CommonProperties, DirectionProperty, NormalizeProps, PropTypes, RequiredBy } from "@destyler/types";
9
6
 
7
+ //#region src/anatomy.d.ts
8
+ declare const anatomy: _destyler_anatomy0.AnatomyInstance<"trigger" | "positioner" | "backdrop" | "content" | "closeTrigger" | "title" | "description">;
9
+ //#endregion
10
+ //#region src/types.d.ts
10
11
  interface OpenChangeDetails {
11
- open: boolean;
12
+ open: boolean;
12
13
  }
13
14
  type ElementIds = Partial<{
14
- trigger: string;
15
- positioner: string;
16
- backdrop: string;
17
- content: string;
18
- closeTrigger: string;
19
- title: string;
20
- description: string;
15
+ trigger: string;
16
+ positioner: string;
17
+ backdrop: string;
18
+ content: string;
19
+ closeTrigger: string;
20
+ title: string;
21
+ description: string;
21
22
  }>;
22
23
  interface PublicContext extends DirectionProperty, CommonProperties, DismissableElementHandlers, PersistentElementOptions {
23
- /**
24
- * The ids of the elements in the dialog. Useful for composition.
25
- */
26
- 'ids'?: ElementIds | undefined;
27
- /**
28
- * Whether to trap focus inside the dialog when it's opened
29
- * @default true
30
- */
31
- 'trapFocus': boolean;
32
- /**
33
- * Whether to prevent scrolling behind the dialog when it's opened
34
- * @default true
35
- */
36
- 'preventScroll': boolean;
37
- /**
38
- * Whether to prevent pointer interaction outside the element and hide all content below it
39
- * @default true
40
- */
41
- 'modal'?: boolean | undefined;
42
- /**
43
- * Element to receive focus when the dialog is opened
44
- */
45
- 'initialFocusEl'?: (() => HTMLElement | null) | undefined;
46
- /**
47
- * Element to receive focus when the dialog is closed
48
- */
49
- 'finalFocusEl'?: (() => HTMLElement | null) | undefined;
50
- /**
51
- * Whether to restore focus to the element that had focus before the dialog was opened
52
- */
53
- 'restoreFocus'?: boolean | undefined;
54
- /**
55
- * Callback to be invoked when the dialog is opened or closed
56
- */
57
- 'onOpenChange'?: ((details: OpenChangeDetails) => void) | undefined;
58
- /**
59
- * Whether to close the dialog when the outside is clicked
60
- * @default true
61
- */
62
- 'closeOnInteractOutside': boolean;
63
- /**
64
- * Whether to close the dialog when the escape key is pressed
65
- * @default true
66
- */
67
- 'closeOnEscape': boolean;
68
- /**
69
- * Human readable label for the dialog, in event the dialog title is not rendered
70
- */
71
- 'aria-label'?: string | undefined;
72
- /**
73
- * The dialog's role
74
- * @default "dialog"
75
- */
76
- 'role': 'dialog' | 'alertdialog';
77
- /**
78
- * Whether the dialog is open
79
- */
80
- 'open'?: boolean | undefined;
81
- /**
82
- * Whether the dialog is controlled by the user
83
- */
84
- 'open.controlled'?: boolean | undefined;
24
+ /**
25
+ * The ids of the elements in the dialog. Useful for composition.
26
+ */
27
+ 'ids'?: ElementIds | undefined;
28
+ /**
29
+ * Whether to trap focus inside the dialog when it's opened
30
+ * @default true
31
+ */
32
+ 'trapFocus': boolean;
33
+ /**
34
+ * Whether to prevent scrolling behind the dialog when it's opened
35
+ * @default true
36
+ */
37
+ 'preventScroll': boolean;
38
+ /**
39
+ * Whether to prevent pointer interaction outside the element and hide all content below it
40
+ * @default true
41
+ */
42
+ 'modal'?: boolean | undefined;
43
+ /**
44
+ * Element to receive focus when the dialog is opened
45
+ */
46
+ 'initialFocusEl'?: (() => HTMLElement | null) | undefined;
47
+ /**
48
+ * Element to receive focus when the dialog is closed
49
+ */
50
+ 'finalFocusEl'?: (() => HTMLElement | null) | undefined;
51
+ /**
52
+ * Whether to restore focus to the element that had focus before the dialog was opened
53
+ */
54
+ 'restoreFocus'?: boolean | undefined;
55
+ /**
56
+ * Callback to be invoked when the dialog is opened or closed
57
+ */
58
+ 'onOpenChange'?: ((details: OpenChangeDetails) => void) | undefined;
59
+ /**
60
+ * Whether to close the dialog when the outside is clicked
61
+ * @default true
62
+ */
63
+ 'closeOnInteractOutside': boolean;
64
+ /**
65
+ * Whether to close the dialog when the escape key is pressed
66
+ * @default true
67
+ */
68
+ 'closeOnEscape': boolean;
69
+ /**
70
+ * Human readable label for the dialog, in event the dialog title is not rendered
71
+ */
72
+ 'aria-label'?: string | undefined;
73
+ /**
74
+ * The dialog's role
75
+ * @default "dialog"
76
+ */
77
+ 'role': 'dialog' | 'alertdialog';
78
+ /**
79
+ * Whether the dialog is open
80
+ */
81
+ 'open'?: boolean | undefined;
82
+ /**
83
+ * Whether the dialog is controlled by the user
84
+ */
85
+ 'open.controlled'?: boolean | undefined;
85
86
  }
86
87
  type UserDefinedContext = RequiredBy<PublicContext, 'id'>;
87
88
  type ComputedContext = Readonly<{}>;
88
89
  interface PrivateContext {
89
- /**
90
- * @internal
91
- * Whether some elements are rendered
92
- */
93
- renderedElements: {
94
- title: boolean;
95
- description: boolean;
96
- };
97
- }
98
- interface MachineContext extends PublicContext, PrivateContext, ComputedContext {
90
+ /**
91
+ * @internal
92
+ * Whether some elements are rendered
93
+ */
94
+ renderedElements: {
95
+ title: boolean;
96
+ description: boolean;
97
+ };
99
98
  }
99
+ interface MachineContext extends PublicContext, PrivateContext, ComputedContext {}
100
100
  interface MachineState {
101
- value: 'open' | 'closed';
101
+ value: 'open' | 'closed';
102
102
  }
103
- type State = StateMachine.State<MachineContext, MachineState>;
104
- type Send = StateMachine.Send<StateMachine.AnyEventObject>;
105
- type Service = Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
103
+ type State = XState<MachineContext, MachineState>;
104
+ type Send = XSend<AnyEventObject>;
105
+ type Service = Machine<MachineContext, MachineState, AnyEventObject>;
106
106
  interface MachineApi<T extends PropTypes = PropTypes> {
107
- /**
108
- * Whether the dialog is open
109
- */
110
- open: boolean;
111
- /**
112
- * Function to open or close the dialog
113
- */
114
- setOpen: (open: boolean) => void;
115
- getTriggerProps: () => T['button'];
116
- getBackdropProps: () => T['element'];
117
- getPositionerProps: () => T['element'];
118
- getContentProps: () => T['element'];
119
- getTitleProps: () => T['element'];
120
- getDescriptionProps: () => T['element'];
121
- getCloseTriggerProps: () => T['button'];
107
+ /**
108
+ * Whether the dialog is open
109
+ */
110
+ open: boolean;
111
+ /**
112
+ * Function to open or close the dialog
113
+ */
114
+ setOpen: (open: boolean) => void;
115
+ getTriggerProps: () => T['button'];
116
+ getBackdropProps: () => T['element'];
117
+ getPositionerProps: () => T['element'];
118
+ getContentProps: () => T['element'];
119
+ getTitleProps: () => T['element'];
120
+ getDescriptionProps: () => T['element'];
121
+ getCloseTriggerProps: () => T['button'];
122
122
  }
123
-
123
+ //#endregion
124
+ //#region src/connect.d.ts
124
125
  declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): MachineApi<T>;
125
-
126
- declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
127
-
128
- declare const props: ("ids" | "trapFocus" | "preventScroll" | "modal" | "initialFocusEl" | "finalFocusEl" | "restoreFocus" | "onOpenChange" | "closeOnInteractOutside" | "closeOnEscape" | "aria-label" | "role" | "open" | "open.controlled" | "dir" | "id" | "getRootNode" | "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "persistentElements")[];
129
- declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "ids" | "trapFocus" | "preventScroll" | "modal" | "initialFocusEl" | "finalFocusEl" | "restoreFocus" | "onOpenChange" | "closeOnInteractOutside" | "closeOnEscape" | "aria-label" | "role" | "open" | "open.controlled" | "dir" | "id" | "getRootNode" | "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "persistentElements">];
130
-
131
- export { type MachineApi as Api, type UserDefinedContext as Context, type ElementIds, type OpenChangeDetails, type Service, anatomy, connect, machine, props, splitProps };
126
+ //#endregion
127
+ //#region src/machine.d.ts
128
+ declare function machine(userContext: UserDefinedContext): _destyler_xstate0.Machine<MachineContext, MachineState, _destyler_xstate0.AnyEventObject>;
129
+ //#endregion
130
+ //#region src/props.d.ts
131
+ declare const props: ("open" | "id" | "ids" | "trapFocus" | "preventScroll" | "modal" | "initialFocusEl" | "finalFocusEl" | "restoreFocus" | "onOpenChange" | "closeOnInteractOutside" | "closeOnEscape" | "aria-label" | "role" | "open.controlled" | "dir" | "getRootNode" | "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "persistentElements")[];
132
+ declare const splitProps: <Props extends Partial<UserDefinedContext>>(props: Props) => [Partial<UserDefinedContext>, Omit<Props, "open" | "id" | "ids" | "trapFocus" | "preventScroll" | "modal" | "initialFocusEl" | "finalFocusEl" | "restoreFocus" | "onOpenChange" | "closeOnInteractOutside" | "closeOnEscape" | "aria-label" | "role" | "open.controlled" | "dir" | "getRootNode" | "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "persistentElements">];
133
+ //#endregion
134
+ export { type MachineApi as Api, type UserDefinedContext as Context, type ElementIds, type FocusOutsideEvent, type InteractOutsideEvent, type OpenChangeDetails, type PointerDownOutsideEvent, type Service, anatomy, connect, machine, props, splitProps };
package/dist/index.js ADDED
@@ -0,0 +1,310 @@
1
+ import { createAnatomy } from "@destyler/anatomy";
2
+ import { createScope, getComputedStyle, raf } from "@destyler/dom";
3
+ import { ariaHidden } from "@destyler/aria-hidden";
4
+ import { trackDismissableElement } from "@destyler/dismissable";
5
+ import { trapFocus } from "@destyler/focus-trap";
6
+ import { preventBodyScroll } from "@destyler/remove-scroll";
7
+ import { compact, createSplitProps } from "@destyler/utils";
8
+ import { createMachine } from "@destyler/xstate";
9
+ import { createProps } from "@destyler/types";
10
+
11
+ //#region src/anatomy.ts
12
+ const anatomy = createAnatomy("dialog").parts("trigger", "backdrop", "positioner", "content", "title", "description", "closeTrigger");
13
+ const parts = anatomy.build();
14
+
15
+ //#endregion
16
+ //#region src/dom.ts
17
+ const dom = createScope({
18
+ getPositionerId: (ctx) => ctx.ids?.positioner ?? `dialog:${ctx.id}:positioner`,
19
+ getBackdropId: (ctx) => ctx.ids?.backdrop ?? `dialog:${ctx.id}:backdrop`,
20
+ getContentId: (ctx) => ctx.ids?.content ?? `dialog:${ctx.id}:content`,
21
+ getTriggerId: (ctx) => ctx.ids?.trigger ?? `dialog:${ctx.id}:trigger`,
22
+ getTitleId: (ctx) => ctx.ids?.title ?? `dialog:${ctx.id}:title`,
23
+ getDescriptionId: (ctx) => ctx.ids?.description ?? `dialog:${ctx.id}:description`,
24
+ getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `dialog:${ctx.id}:close`,
25
+ getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
26
+ getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
27
+ getBackdropEl: (ctx) => dom.getById(ctx, dom.getBackdropId(ctx)),
28
+ getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
29
+ getTitleEl: (ctx) => dom.getById(ctx, dom.getTitleId(ctx)),
30
+ getDescriptionEl: (ctx) => dom.getById(ctx, dom.getDescriptionId(ctx)),
31
+ getCloseTriggerEl: (ctx) => dom.getById(ctx, dom.getCloseTriggerId(ctx))
32
+ });
33
+
34
+ //#endregion
35
+ //#region src/connect.ts
36
+ function connect(state, send, normalize) {
37
+ const ariaLabel = state.context["aria-label"];
38
+ const open = state.matches("open");
39
+ const rendered = state.context.renderedElements;
40
+ return {
41
+ open,
42
+ setOpen(nextOpen) {
43
+ if (nextOpen === open) return;
44
+ send(nextOpen ? "OPEN" : "CLOSE");
45
+ },
46
+ getTriggerProps() {
47
+ return normalize.button({
48
+ ...parts.trigger.attrs,
49
+ "dir": state.context.dir,
50
+ "id": dom.getTriggerId(state.context),
51
+ "aria-haspopup": "dialog",
52
+ "type": "button",
53
+ "aria-expanded": open,
54
+ "data-state": open ? "open" : "closed",
55
+ "aria-controls": dom.getContentId(state.context),
56
+ onClick(event) {
57
+ if (event.defaultPrevented) return;
58
+ send("TOGGLE");
59
+ }
60
+ });
61
+ },
62
+ getBackdropProps() {
63
+ return normalize.element({
64
+ ...parts.backdrop.attrs,
65
+ "dir": state.context.dir,
66
+ "hidden": !open,
67
+ "id": dom.getBackdropId(state.context),
68
+ "data-state": open ? "open" : "closed"
69
+ });
70
+ },
71
+ getPositionerProps() {
72
+ return normalize.element({
73
+ ...parts.positioner.attrs,
74
+ dir: state.context.dir,
75
+ id: dom.getPositionerId(state.context),
76
+ style: { pointerEvents: open ? void 0 : "none" }
77
+ });
78
+ },
79
+ getContentProps() {
80
+ return normalize.element({
81
+ ...parts.content.attrs,
82
+ "dir": state.context.dir,
83
+ "role": state.context.role,
84
+ "hidden": !open,
85
+ "id": dom.getContentId(state.context),
86
+ "tabIndex": -1,
87
+ "data-state": open ? "open" : "closed",
88
+ "aria-modal": true,
89
+ "aria-label": ariaLabel || void 0,
90
+ "aria-labelledby": ariaLabel || !rendered.title ? void 0 : dom.getTitleId(state.context),
91
+ "aria-describedby": rendered.description ? dom.getDescriptionId(state.context) : void 0
92
+ });
93
+ },
94
+ getTitleProps() {
95
+ return normalize.element({
96
+ ...parts.title.attrs,
97
+ dir: state.context.dir,
98
+ id: dom.getTitleId(state.context)
99
+ });
100
+ },
101
+ getDescriptionProps() {
102
+ return normalize.element({
103
+ ...parts.description.attrs,
104
+ dir: state.context.dir,
105
+ id: dom.getDescriptionId(state.context)
106
+ });
107
+ },
108
+ getCloseTriggerProps() {
109
+ return normalize.button({
110
+ ...parts.closeTrigger.attrs,
111
+ dir: state.context.dir,
112
+ id: dom.getCloseTriggerId(state.context),
113
+ type: "button",
114
+ onClick(event) {
115
+ if (event.defaultPrevented) return;
116
+ event.stopPropagation();
117
+ send("CLOSE");
118
+ }
119
+ });
120
+ }
121
+ };
122
+ }
123
+
124
+ //#endregion
125
+ //#region src/machine.ts
126
+ function machine(userContext) {
127
+ const ctx = compact(userContext);
128
+ return createMachine({
129
+ id: "dialog",
130
+ initial: ctx.open ? "open" : "closed",
131
+ context: {
132
+ role: "dialog",
133
+ renderedElements: {
134
+ title: true,
135
+ description: true
136
+ },
137
+ modal: true,
138
+ trapFocus: true,
139
+ preventScroll: true,
140
+ closeOnInteractOutside: true,
141
+ closeOnEscape: true,
142
+ restoreFocus: true,
143
+ ...ctx
144
+ },
145
+ created: ["setAlertDialogProps"],
146
+ watch: { open: ["toggleVisibility"] },
147
+ states: {
148
+ open: {
149
+ entry: ["checkRenderedElements", "syncZIndex"],
150
+ activities: [
151
+ "trackDismissableElement",
152
+ "trapFocus",
153
+ "preventScroll",
154
+ "hideContentBelow"
155
+ ],
156
+ on: {
157
+ "CONTROLLED.CLOSE": { target: "closed" },
158
+ "CLOSE": [{
159
+ guard: "isOpenControlled",
160
+ actions: ["invokeOnClose"]
161
+ }, {
162
+ target: "closed",
163
+ actions: ["invokeOnClose"]
164
+ }],
165
+ "TOGGLE": [{
166
+ guard: "isOpenControlled",
167
+ actions: ["invokeOnClose"]
168
+ }, {
169
+ target: "closed",
170
+ actions: ["invokeOnClose"]
171
+ }]
172
+ }
173
+ },
174
+ closed: { on: {
175
+ "CONTROLLED.OPEN": { target: "open" },
176
+ "OPEN": [{
177
+ guard: "isOpenControlled",
178
+ actions: ["invokeOnOpen"]
179
+ }, {
180
+ target: "open",
181
+ actions: ["invokeOnOpen"]
182
+ }],
183
+ "TOGGLE": [{
184
+ guard: "isOpenControlled",
185
+ actions: ["invokeOnOpen"]
186
+ }, {
187
+ target: "open",
188
+ actions: ["invokeOnOpen"]
189
+ }]
190
+ } }
191
+ }
192
+ }, {
193
+ guards: { isOpenControlled: (ctx$1) => !!ctx$1["open.controlled"] },
194
+ activities: {
195
+ trackDismissableElement(ctx$1, _evt, { send }) {
196
+ const getContentEl = () => dom.getContentEl(ctx$1);
197
+ return trackDismissableElement(getContentEl, {
198
+ defer: true,
199
+ pointerBlocking: ctx$1.modal,
200
+ exclude: [dom.getTriggerEl(ctx$1)],
201
+ onInteractOutside(event) {
202
+ ctx$1.onInteractOutside?.(event);
203
+ if (!ctx$1.closeOnInteractOutside) event.preventDefault();
204
+ },
205
+ persistentElements: ctx$1.persistentElements,
206
+ onFocusOutside: ctx$1.onFocusOutside,
207
+ onPointerDownOutside: ctx$1.onPointerDownOutside,
208
+ onEscapeKeyDown(event) {
209
+ ctx$1.onEscapeKeyDown?.(event);
210
+ if (!ctx$1.closeOnEscape) event.preventDefault();
211
+ },
212
+ onDismiss() {
213
+ send({
214
+ type: "CLOSE",
215
+ src: "interact-outside"
216
+ });
217
+ }
218
+ });
219
+ },
220
+ preventScroll(ctx$1) {
221
+ if (!ctx$1.preventScroll) return;
222
+ return preventBodyScroll(dom.getDoc(ctx$1));
223
+ },
224
+ trapFocus(ctx$1) {
225
+ if (!ctx$1.trapFocus || !ctx$1.modal) return;
226
+ const contentEl = () => dom.getContentEl(ctx$1);
227
+ return trapFocus(contentEl, {
228
+ preventScroll: true,
229
+ returnFocusOnDeactivate: !!ctx$1.restoreFocus,
230
+ initialFocus: ctx$1.initialFocusEl,
231
+ setReturnFocus: (el) => ctx$1.finalFocusEl?.() ?? el
232
+ });
233
+ },
234
+ hideContentBelow(ctx$1) {
235
+ if (!ctx$1.modal) return;
236
+ const getElements = () => [dom.getContentEl(ctx$1)];
237
+ return ariaHidden(getElements, { defer: true });
238
+ }
239
+ },
240
+ actions: {
241
+ setAlertDialogProps(ctx$1) {
242
+ if (ctx$1.role !== "alertdialog") return;
243
+ ctx$1.initialFocusEl ||= () => dom.getCloseTriggerEl(ctx$1);
244
+ ctx$1.closeOnInteractOutside = false;
245
+ },
246
+ checkRenderedElements(ctx$1) {
247
+ raf(() => {
248
+ ctx$1.renderedElements.title = !!dom.getTitleEl(ctx$1);
249
+ ctx$1.renderedElements.description = !!dom.getDescriptionEl(ctx$1);
250
+ });
251
+ },
252
+ syncZIndex(ctx$1) {
253
+ raf(() => {
254
+ const contentEl = dom.getContentEl(ctx$1);
255
+ if (!contentEl) return;
256
+ const styles = getComputedStyle(contentEl);
257
+ const elems = [dom.getPositionerEl(ctx$1), dom.getBackdropEl(ctx$1)];
258
+ elems.forEach((node) => {
259
+ node?.style.setProperty("--z-index", styles.zIndex);
260
+ });
261
+ });
262
+ },
263
+ invokeOnClose(ctx$1) {
264
+ ctx$1.onOpenChange?.({ open: false });
265
+ },
266
+ invokeOnOpen(ctx$1) {
267
+ ctx$1.onOpenChange?.({ open: true });
268
+ },
269
+ toggleVisibility(ctx$1, evt, { send }) {
270
+ send({
271
+ type: ctx$1.open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE",
272
+ previousEvent: evt
273
+ });
274
+ }
275
+ }
276
+ });
277
+ }
278
+
279
+ //#endregion
280
+ //#region src/props.ts
281
+ const props = createProps()([
282
+ "aria-label",
283
+ "closeOnEscape",
284
+ "closeOnInteractOutside",
285
+ "dir",
286
+ "finalFocusEl",
287
+ "getRootNode",
288
+ "getRootNode",
289
+ "id",
290
+ "id",
291
+ "ids",
292
+ "initialFocusEl",
293
+ "modal",
294
+ "onEscapeKeyDown",
295
+ "onFocusOutside",
296
+ "onInteractOutside",
297
+ "onOpenChange",
298
+ "onPointerDownOutside",
299
+ "open.controlled",
300
+ "open",
301
+ "persistentElements",
302
+ "preventScroll",
303
+ "restoreFocus",
304
+ "role",
305
+ "trapFocus"
306
+ ]);
307
+ const splitProps = createSplitProps(props);
308
+
309
+ //#endregion
310
+ export { anatomy, connect, machine, props, splitProps };
package/package.json CHANGED
@@ -1,39 +1,35 @@
1
1
  {
2
2
  "name": "@destyler/dialog",
3
3
  "type": "module",
4
- "version": "0.0.7-beta.5",
4
+ "version": "0.0.7-beta.9",
5
5
  "description": "before taking action, please confirm.",
6
6
  "author": "Elone Hoo <elonehoo@gmail.com>",
7
7
  "license": "MIT",
8
8
  "exports": {
9
- ".": {
10
- "types": "./dist/index.d.mts",
11
- "default": "./dist/index.mjs"
12
- },
13
- "./*": "./*"
9
+ ".": "./dist/index.js"
14
10
  },
15
- "main": "dist/index.cjs",
16
- "module": "dist/index.mjs",
11
+ "main": "dist/index.js",
12
+ "module": "dist/index.js",
17
13
  "types": "dist/index.d.ts",
18
14
  "files": [
19
15
  "*.d.ts",
20
16
  "dist"
21
17
  ],
22
18
  "dependencies": {
23
- "@zag-js/anatomy": "^0.82.1",
24
- "@zag-js/aria-hidden": "^0.82.1",
25
- "@zag-js/core": "^0.82.1",
26
- "@zag-js/dismissable": "^0.82.1",
27
- "@zag-js/dom-query": "^0.82.1",
28
- "@zag-js/focus-trap": "^0.82.1",
29
- "@zag-js/remove-scroll": "^0.82.1",
30
- "@zag-js/types": "^0.82.1",
31
- "@zag-js/utils": "^0.82.1"
19
+ "@destyler/anatomy": "0.0.7-beta.9",
20
+ "@destyler/dismissable": "0.0.7-beta.9",
21
+ "@destyler/dom": "0.0.7-beta.9",
22
+ "@destyler/focus-trap": "0.0.7-beta.9",
23
+ "@destyler/aria-hidden": "0.0.7-beta.9",
24
+ "@destyler/remove-scroll": "0.0.7-beta.9",
25
+ "@destyler/types": "0.0.7-beta.9",
26
+ "@destyler/utils": "0.0.7-beta.9",
27
+ "@destyler/xstate": "0.0.7-beta.9"
32
28
  },
33
29
  "scripts": {
34
30
  "clear": "rimraf ./dist",
35
31
  "clear:node_modules": "rimraf ./node_modules",
36
- "build": "pnpm run clear && unbuild",
37
- "stub": "unbuild --stub"
32
+ "build": "pnpm run clear && tsdown",
33
+ "watch": "tsdown --watch"
38
34
  }
39
35
  }