@alulore/kumiko 0.19.0 → 0.19.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.
@@ -1,4 +1,4 @@
1
- import type { DialogProps } from "@ui-sdk/react/dialog";
1
+ import { type DialogProps } from "@ui-sdk/react/dialog";
2
2
  import { type OverlayHostProps as SdkOverlayHostProps } from "@ui-sdk/react/overlays";
3
3
  import { type ReactNode } from "react";
4
4
  import type { DialogLabels } from "./dialog-labels";
@@ -1,4 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AlertDialog as SdkAlertDialog } from "@ui-sdk/react/alert-dialog";
3
+ import { Dialog as SdkDialog } from "@ui-sdk/react/dialog";
2
4
  import { OverlayHost as SdkOverlayHost } from "@ui-sdk/react/overlays";
3
5
  import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
4
6
  import { useSettledClose } from "../motion/settle-close";
@@ -21,6 +23,13 @@ function useDialogsChange(open, onChange) {
21
23
  }
22
24
  }, [open]);
23
25
  }
26
+ /**
27
+ * A closed dialog and question that stay mounted, so ui-sdk writes their popover styles when the app loads.
28
+ * Written at the first open instead, the new stylesheet makes the browser restyle the whole page.
29
+ */
30
+ function ReadyRoots() {
31
+ return (_jsxs(_Fragment, { children: [_jsx(SdkDialog, { open: false }), _jsx(SdkAlertDialog, { open: false })] }));
32
+ }
24
33
  /**
25
34
  * The opened dialogs, in a box of their own that is always there. Mounted straight into a big container,
26
35
  * each open and close would make the browser recheck most of that container; inside this box, only the box.
@@ -29,7 +38,7 @@ function DialogHost({ token, modal, closeIcon, onDialogsChange }) {
29
38
  const state = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
30
39
  const active = state.activeHost === token;
31
40
  useDialogsChange(active && anyOpen(state), active ? onDialogsChange : undefined);
32
- return (_jsx("div", { "data-slot": "dialog-host", style: { display: "contents" }, children: active ? (_jsx(DialogModalContext.Provider, { value: modal, children: _jsx(DialogCloseIconContext.Provider, { value: closeIcon, children: _jsx(Stack, { parent: null, state: state }) }) })) : null }));
41
+ return (_jsxs("div", { "data-slot": "dialog-host", style: { display: "contents" }, children: [_jsx(ReadyRoots, {}), active ? (_jsx(DialogModalContext.Provider, { value: modal, children: _jsx(DialogCloseIconContext.Provider, { value: closeIcon, children: _jsx(Stack, { parent: null, state: state }) }) })) : null] }));
33
42
  }
34
43
  /**
35
44
  * The host for `toast()`, `confirm()`, `openDialog()` and `ask()`. Mount it once, near the root and inside
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alulore/kumiko",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Polished, cozy React components with gentle motion, built on ui-sdk. Every look and behaviour can be switched with props and CSS tokens.",
5
5
  "license": "MIT",
6
6
  "repository": {