@immediately-run/sdk 0.68.1 → 0.69.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.
- package/dist/agentChatClient.js +1 -1
- package/dist/agentContext.js +4 -4
- package/dist/agentLoop.js +1 -1
- package/dist/analytics.js +3 -3
- package/dist/auth.js +2 -2
- package/dist/boot.js +16 -16
- package/dist/bundle.js +1 -1
- package/dist/catalog.js +4 -4
- package/dist/chromeState.js +2 -2
- package/dist/components/FileRouter.js +4 -4
- package/dist/components/HeadingAnchor.js +4 -4
- package/dist/components/Include.js +5 -5
- package/dist/components/Link.js +5 -5
- package/dist/components/MDXComponents.js +10 -10
- package/dist/components/MainContent.js +4 -4
- package/dist/components/MountImage.js +1 -1
- package/dist/components/Routes.js +3 -3
- package/dist/components/SafeInclude.js +7 -7
- package/dist/components/ScrollAfterNavigation.js +2 -2
- package/dist/components/ScrollRestoration.js +4 -4
- package/dist/components/WikiLink.js +5 -5
- package/dist/components/defaults.js +1 -1
- package/dist/components/errors.js +1 -1
- package/dist/contextUtils.js +3 -3
- package/dist/contribute.js +2 -2
- package/dist/corpus.js +2 -2
- package/dist/debug.js +3 -3
- package/dist/diagnostics.js +2 -2
- package/dist/dialog.cjs +93 -0
- package/dist/dialog.cjs.map +1 -0
- package/dist/dialog.d.cts +47 -0
- package/dist/dialog.d.ts +47 -0
- package/dist/dialog.js +68 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dnd.js +3 -3
- package/dist/editor.js +3 -3
- package/dist/editorContext.js +2 -2
- package/dist/feed.js +3 -3
- package/dist/formFactor.js +2 -2
- package/dist/fs.js +2 -2
- package/dist/generated/spaces.cjs +89 -17
- package/dist/generated/spaces.cjs.map +1 -1
- package/dist/generated/spaces.d.cts +184 -12
- package/dist/generated/spaces.d.ts +184 -12
- package/dist/generated/spaces.js +85 -18
- package/dist/generated/spaces.js.map +1 -1
- package/dist/hooks.js +2 -2
- package/dist/hostAttention.js +2 -2
- package/dist/hostTransport.js +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +67 -65
- package/dist/index.js.map +1 -1
- package/dist/ipc.js +3 -3
- package/dist/launch.js +3 -3
- package/dist/llm.js +3 -3
- package/dist/markers.js +2 -2
- package/dist/metadataQueryTool.js +1 -1
- package/dist/metadataSource.js +1 -1
- package/dist/moduleCache.js +2 -2
- package/dist/mounts.cjs +5 -16
- package/dist/mounts.cjs.map +1 -1
- package/dist/mounts.d.cts +3 -35
- package/dist/mounts.d.ts +3 -35
- package/dist/mounts.js +13 -19
- package/dist/mounts.js.map +1 -1
- package/dist/netFetch.js +4 -4
- package/dist/onFsChange.js +2 -2
- package/dist/openExternal.js +3 -3
- package/dist/openRepository.js +3 -3
- package/dist/platformLink.js +4 -4
- package/dist/protocolSchemes.js +1 -1
- package/dist/protocolStream.js +2 -2
- package/dist/pushChannel.js +1 -1
- package/dist/ready.js +1 -1
- package/dist/recents.js +3 -3
- package/dist/region.js +3 -3
- package/dist/routing.js +7 -7
- package/dist/runtime.js +4 -4
- package/dist/sandboxUtils.js +4 -4
- package/dist/secrets.js +4 -4
- package/dist/status.cjs +48 -0
- package/dist/status.cjs.map +1 -0
- package/dist/status.d.cts +43 -0
- package/dist/status.d.ts +43 -0
- package/dist/status.js +24 -0
- package/dist/status.js.map +1 -0
- package/dist/tasks.js +4 -4
- package/dist/theme.js +4 -4
- package/dist/urlUtils.js +1 -1
- package/dist/useEntryState.js +1 -1
- package/dist/vcs.js +4 -4
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/workspace.js +2 -2
- package/package.json +7 -5
package/dist/agentChatClient.js
CHANGED
package/dist/agentContext.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import { TinkerableContext } from "./TinkerableContext";
|
|
4
|
-
import { useAuth } from "./auth";
|
|
5
|
-
import { useMounts } from "./mounts";
|
|
6
|
-
import { fenceUntrusted } from "./fence";
|
|
3
|
+
import { TinkerableContext } from "./TinkerableContext.js";
|
|
4
|
+
import { useAuth } from "./auth.js";
|
|
5
|
+
import { useMounts } from "./mounts.js";
|
|
6
|
+
import { fenceUntrusted } from "./fence.js";
|
|
7
7
|
function useAgentContext(app = {}) {
|
|
8
8
|
const tinker = useContext(TinkerableContext);
|
|
9
9
|
const auth = useAuth();
|
package/dist/agentLoop.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { anySignal, steerWireText, INTERRUPTED_TURN_TEXT } from "./agentSteering";
|
|
2
|
+
import { anySignal, steerWireText, INTERRUPTED_TURN_TEXT } from "./agentSteering.js";
|
|
3
3
|
const textOf = (blocks) => blocks.filter((b) => b.type === "text").map((b) => b.text).join("");
|
|
4
4
|
const TERMINAL_STOPS = /* @__PURE__ */ new Set(["max_tokens", "refusal"]);
|
|
5
5
|
const INTENT_RE = /\b(i'?ll|i will|i'?m going to|going to|let me|let's|now,? i(?:'?ll| will)?|next,? i(?:'?ll| will)?)\b[\s\S]{0,80}?\b(read|write|edit|creat|add|updat|modif|regist|check|look|call|run|search|grep|list|open|fetch|inspect|review|explor|implement|fix|appl)/i;
|
package/dist/analytics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { protocolRequest } from "./sandboxUtils";
|
|
3
|
-
import { SCHEMES } from "./protocolSchemes";
|
|
4
|
-
import { PROTOCOL_ANALYTICS } from "./generated/protocol";
|
|
2
|
+
import { protocolRequest } from "./sandboxUtils.js";
|
|
3
|
+
import { SCHEMES } from "./protocolSchemes.js";
|
|
4
|
+
import { PROTOCOL_ANALYTICS } from "./generated/protocol.js";
|
|
5
5
|
const emitAnalyticsEvent = (name, props) => protocolRequest(SCHEMES[PROTOCOL_ANALYTICS], "emit", [{ name, ...props ? { props } : {} }]);
|
|
6
6
|
const recordRoute = (path) => protocolRequest(SCHEMES[PROTOCOL_ANALYTICS], "route", [{ path }]);
|
|
7
7
|
const track = (name, props) => {
|
package/dist/auth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { createPushChannel } from "./pushChannel";
|
|
3
|
-
import { AUTH_STATE, REQUEST_AUTH_STATE } from "./generated/protocol";
|
|
2
|
+
import { createPushChannel } from "./pushChannel.js";
|
|
3
|
+
import { AUTH_STATE, REQUEST_AUTH_STATE } from "./generated/protocol.js";
|
|
4
4
|
const isAuthState = (v) => {
|
|
5
5
|
const s = v;
|
|
6
6
|
return !!s && (s.status === "unknown" || s.status === "signed-in" || s.status === "signed-out") && (s.user === null || typeof s.user === "object" && typeof s.user.login === "string");
|
package/dist/boot.js
CHANGED
|
@@ -2,22 +2,22 @@ import "./chunk-VHAA22YE.js";
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { StrictMode, useEffect, useLayoutEffect, useState } from "react";
|
|
4
4
|
import { createRoot } from "react-dom/client";
|
|
5
|
-
import { emitMarkerOnce } from "./markers";
|
|
6
|
-
import { ErrorNotFound } from "./components/errors";
|
|
7
|
-
import { FileRouter } from "./components/FileRouter";
|
|
8
|
-
import { MainContent } from "./components/MainContent";
|
|
9
|
-
import { DEFAULT_MDX_COMPONENTS } from "./components/MDXComponents";
|
|
10
|
-
import { ScrollAfterNavigation } from "./components/ScrollAfterNavigation";
|
|
11
|
-
import { getInitialContext, updateContext } from "./contextUtils";
|
|
12
|
-
import { getInjectedMetadataEmitter, resolveMetadataSource } from "./injectedBundler";
|
|
13
|
-
import { MDXProvider } from "./MDXProvider";
|
|
14
|
-
import { ModuleCache, ModuleCacheContextProvider } from "./moduleCache";
|
|
15
|
-
import { Router } from "./routing";
|
|
16
|
-
import { addListener } from "./sandboxUtils";
|
|
17
|
-
import { TinkerableContext } from "./TinkerableContext";
|
|
18
|
-
import { FILES_PREFIX } from "./urlUtils";
|
|
19
|
-
import { METADATA_UPDATE, URLCHANGE } from "./generated/protocol";
|
|
20
|
-
import { receiveNavigation } from "./entryState";
|
|
5
|
+
import { emitMarkerOnce } from "./markers.js";
|
|
6
|
+
import { ErrorNotFound } from "./components/errors.js";
|
|
7
|
+
import { FileRouter } from "./components/FileRouter.js";
|
|
8
|
+
import { MainContent } from "./components/MainContent.js";
|
|
9
|
+
import { DEFAULT_MDX_COMPONENTS } from "./components/MDXComponents.js";
|
|
10
|
+
import { ScrollAfterNavigation } from "./components/ScrollAfterNavigation.js";
|
|
11
|
+
import { getInitialContext, updateContext } from "./contextUtils.js";
|
|
12
|
+
import { getInjectedMetadataEmitter, resolveMetadataSource } from "./injectedBundler.js";
|
|
13
|
+
import { MDXProvider } from "./MDXProvider.js";
|
|
14
|
+
import { ModuleCache, ModuleCacheContextProvider } from "./moduleCache.js";
|
|
15
|
+
import { Router } from "./routing.js";
|
|
16
|
+
import { addListener } from "./sandboxUtils.js";
|
|
17
|
+
import { TinkerableContext } from "./TinkerableContext.js";
|
|
18
|
+
import { FILES_PREFIX } from "./urlUtils.js";
|
|
19
|
+
import { METADATA_UPDATE, URLCHANGE } from "./generated/protocol.js";
|
|
20
|
+
import { receiveNavigation } from "./entryState.js";
|
|
21
21
|
const resolveMdxComponents = (mdxComponents) => mdxComponents === void 0 ? DEFAULT_MDX_COMPONENTS : typeof mdxComponents === "function" ? mdxComponents(DEFAULT_MDX_COMPONENTS) : { ...DEFAULT_MDX_COMPONENTS, ...mdxComponents };
|
|
22
22
|
const updateAlreadyApplied = (filesMetadata, update) => {
|
|
23
23
|
for (let [key, value] of Object.entries(update)) {
|
package/dist/bundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
2
|
import { createContext, use, useMemo } from "react";
|
|
3
|
-
import { useMetadataStore } from "./metadataSource";
|
|
3
|
+
import { useMetadataStore } from "./metadataSource.js";
|
|
4
4
|
const EMPTY_SCOPE = { root: null, entry: null, toHref: (p) => p };
|
|
5
5
|
const BundleContext = createContext(EMPTY_SCOPE);
|
|
6
6
|
const useBundle = () => use(BundleContext);
|
package/dist/catalog.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { protocolRequest, sendMessage, addListener } from "./sandboxUtils";
|
|
3
|
-
import { consumeStream } from "./protocolStream";
|
|
4
|
-
import { createPushChannel } from "./pushChannel";
|
|
5
|
-
import { API_CATALOG, REQUEST_API_CATALOG } from "./generated/protocol";
|
|
2
|
+
import { protocolRequest, sendMessage, addListener } from "./sandboxUtils.js";
|
|
3
|
+
import { consumeStream } from "./protocolStream.js";
|
|
4
|
+
import { createPushChannel } from "./pushChannel.js";
|
|
5
|
+
import { API_CATALOG, REQUEST_API_CATALOG } from "./generated/protocol.js";
|
|
6
6
|
const split = (name) => {
|
|
7
7
|
const i = name.indexOf(":");
|
|
8
8
|
if (i <= 0) throw new Error(`invalid catalog method name: ${name}`);
|
package/dist/chromeState.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { createPushChannel } from "./pushChannel";
|
|
3
|
-
import { CHROME_STATE, REQUEST_CHROME_STATE } from "./generated/protocol";
|
|
2
|
+
import { createPushChannel } from "./pushChannel.js";
|
|
3
|
+
import { CHROME_STATE, REQUEST_CHROME_STATE } from "./generated/protocol.js";
|
|
4
4
|
const DEFAULT_CHROME_STATE = { overlay: "none", tab: { edge: "top-right" } };
|
|
5
5
|
const isChromeState = (v) => {
|
|
6
6
|
const c = v;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext } from "react";
|
|
4
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
5
|
-
import { underAppRoot } from "../urlUtils";
|
|
6
|
-
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults";
|
|
7
|
-
import { Include } from "./Include";
|
|
4
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
5
|
+
import { underAppRoot } from "../urlUtils.js";
|
|
6
|
+
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults.js";
|
|
7
|
+
import { Include } from "./Include.js";
|
|
8
8
|
const FileRouter = ({
|
|
9
9
|
LoadingComponent = defaultLoadingComponent,
|
|
10
10
|
ErrorComponent = defaultErrorComponent
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use, useCallback } from "react";
|
|
4
|
-
import { scrollToId } from "../scrollToId";
|
|
5
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
6
|
-
import { constructOuterUrl } from "../urlUtils";
|
|
7
|
-
import { FragmentLink } from "./Link";
|
|
4
|
+
import { scrollToId } from "../scrollToId.js";
|
|
5
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
6
|
+
import { constructOuterUrl } from "../urlUtils.js";
|
|
7
|
+
import { FragmentLink } from "./Link.js";
|
|
8
8
|
const HeadingAnchor = ({
|
|
9
9
|
id,
|
|
10
10
|
...rest
|
|
@@ -2,11 +2,11 @@ import "../chunk-VHAA22YE.js";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Suspense, use } from "react";
|
|
4
4
|
import { ErrorBoundary } from "react-error-boundary";
|
|
5
|
-
import { ModuleCacheContext } from "../moduleCache";
|
|
6
|
-
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults";
|
|
7
|
-
import { IncludeModeContext, RenderExportedComponentContext } from "./includeContexts";
|
|
8
|
-
import { SafeInclude } from "./SafeInclude";
|
|
9
|
-
import { IncludeModeContext as IncludeModeContext2, RenderExportedComponentContext as RenderExportedComponentContext2 } from "./includeContexts";
|
|
5
|
+
import { ModuleCacheContext } from "../moduleCache.js";
|
|
6
|
+
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults.js";
|
|
7
|
+
import { IncludeModeContext, RenderExportedComponentContext } from "./includeContexts.js";
|
|
8
|
+
import { SafeInclude } from "./SafeInclude.js";
|
|
9
|
+
import { IncludeModeContext as IncludeModeContext2, RenderExportedComponentContext as RenderExportedComponentContext2 } from "./includeContexts.js";
|
|
10
10
|
const RenderExportedComponent = ({
|
|
11
11
|
evaluationContextPromise,
|
|
12
12
|
exportedSymbol = "default"
|
package/dist/components/Link.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use } from "react";
|
|
4
|
-
import { isBrowserGestureClick, useComposedAnchorClick } from "../anchorClick";
|
|
5
|
-
import { navigate } from "../routing";
|
|
6
|
-
import { scrollToId } from "../scrollToId";
|
|
7
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
8
|
-
import { constructOuterUrl, isInternalHref } from "../urlUtils";
|
|
4
|
+
import { isBrowserGestureClick, useComposedAnchorClick } from "../anchorClick.js";
|
|
5
|
+
import { navigate } from "../routing.js";
|
|
6
|
+
import { scrollToId } from "../scrollToId.js";
|
|
7
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
8
|
+
import { constructOuterUrl, isInternalHref } from "../urlUtils.js";
|
|
9
9
|
const FragmentLink = ({
|
|
10
10
|
href,
|
|
11
11
|
children,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use } from "react";
|
|
4
|
-
import { Admonition } from "./Admonition";
|
|
5
|
-
import { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from "../linkSpace";
|
|
6
|
-
import { splitHash } from "../urlUtils";
|
|
7
|
-
import { HeadingAnchor } from "./HeadingAnchor";
|
|
8
|
-
import { Link } from "./Link";
|
|
9
|
-
import { WikiLink } from "./WikiLink";
|
|
10
|
-
import { InternalLink, Link as Link2 } from "./Link";
|
|
11
|
-
import { Admonition as Admonition2 } from "./Admonition";
|
|
12
|
-
import { HeadingAnchor as HeadingAnchor2 } from "./HeadingAnchor";
|
|
13
|
-
import { WikiLink as WikiLink2 } from "./WikiLink";
|
|
4
|
+
import { Admonition } from "./Admonition.js";
|
|
5
|
+
import { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from "../linkSpace.js";
|
|
6
|
+
import { splitHash } from "../urlUtils.js";
|
|
7
|
+
import { HeadingAnchor } from "./HeadingAnchor.js";
|
|
8
|
+
import { Link } from "./Link.js";
|
|
9
|
+
import { WikiLink } from "./WikiLink.js";
|
|
10
|
+
import { InternalLink, Link as Link2 } from "./Link.js";
|
|
11
|
+
import { Admonition as Admonition2 } from "./Admonition.js";
|
|
12
|
+
import { HeadingAnchor as HeadingAnchor2 } from "./HeadingAnchor.js";
|
|
13
|
+
import { WikiLink as WikiLink2 } from "./WikiLink.js";
|
|
14
14
|
const DEFAULT_MDX_COMPONENTS = {
|
|
15
15
|
a({
|
|
16
16
|
href,
|
|
@@ -2,10 +2,10 @@ import "../chunk-VHAA22YE.js";
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Suspense, use, useEffect, useMemo } from "react";
|
|
4
4
|
import { ErrorBoundary } from "react-error-boundary";
|
|
5
|
-
import { navigate, useTinkerableLink } from "../routing";
|
|
6
|
-
import { FILES_PREFIX, underAppRoot } from "../urlUtils";
|
|
7
|
-
import { sandboxFs } from "../fs";
|
|
8
|
-
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults";
|
|
5
|
+
import { navigate, useTinkerableLink } from "../routing.js";
|
|
6
|
+
import { FILES_PREFIX, underAppRoot } from "../urlUtils.js";
|
|
7
|
+
import { sandboxFs } from "../fs.js";
|
|
8
|
+
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults.js";
|
|
9
9
|
const candidates = [
|
|
10
10
|
"/src/App.tsx",
|
|
11
11
|
"/src/App.ts",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useObjectUrl } from "../hooks";
|
|
3
|
+
import { useObjectUrl } from "../hooks.js";
|
|
4
4
|
function MountImage({ mount, relPath, type, placeholder, fallback, alt = "", ...imgProps }) {
|
|
5
5
|
const { url, loading, error } = useObjectUrl(mount, relPath, type ? { type } : void 0);
|
|
6
6
|
if (loading) return /* @__PURE__ */ jsx(Fragment, { children: placeholder ?? null });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Children, isValidElement, use } from "react";
|
|
4
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
5
|
-
import { matchRoute } from "../routeMatch";
|
|
6
|
-
import { renderRoute } from "../routing";
|
|
4
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
5
|
+
import { matchRoute } from "../routeMatch.js";
|
|
6
|
+
import { renderRoute } from "../routing.js";
|
|
7
7
|
const Route = (_props) => null;
|
|
8
8
|
const Routes = ({ children, fallback = null }) => {
|
|
9
9
|
const context = use(TinkerableContext);
|
|
@@ -2,13 +2,13 @@ import "../chunk-VHAA22YE.js";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Suspense, use, useMemo } from "react";
|
|
4
4
|
import { ErrorBoundary } from "react-error-boundary";
|
|
5
|
-
import { openAppFs, openFs } from "../fs";
|
|
6
|
-
import { getAppMountPath } from "../mounts";
|
|
7
|
-
import { useMDXComponents } from "../MDXProvider";
|
|
8
|
-
import { SafeContent } from "../safeContent/SafeContent";
|
|
9
|
-
import { createSourceCache } from "../sourceCache";
|
|
10
|
-
import { RenderExportedComponentContext } from "./includeContexts";
|
|
11
|
-
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults";
|
|
5
|
+
import { openAppFs, openFs } from "../fs.js";
|
|
6
|
+
import { getAppMountPath } from "../mounts.js";
|
|
7
|
+
import { useMDXComponents } from "../MDXProvider.js";
|
|
8
|
+
import { SafeContent } from "../safeContent/SafeContent.js";
|
|
9
|
+
import { createSourceCache } from "../sourceCache.js";
|
|
10
|
+
import { RenderExportedComponentContext } from "./includeContexts.js";
|
|
11
|
+
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults.js";
|
|
12
12
|
function stripFrontmatter(source) {
|
|
13
13
|
return source.replace(/^\uFEFF?---\r?\n[\s\S]*?\r?\n---[ \t]*\r?\n?/, "");
|
|
14
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { use, useEffect } from "react";
|
|
3
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
4
|
-
import { scrollToId } from "../scrollToId";
|
|
3
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
4
|
+
import { scrollToId } from "../scrollToId.js";
|
|
5
5
|
const useScrollAfterNavigation = () => {
|
|
6
6
|
const { navigationState } = use(TinkerableContext);
|
|
7
7
|
const frag = navigationState.hash;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { use, useEffect, useRef } from "react";
|
|
3
|
-
import { registerEntryStateCollector } from "../entryState";
|
|
4
|
-
import { nextRestoreAction, RESTORE_DEADLINE_MS } from "../scrollRestore";
|
|
5
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
6
|
-
import { useEntryState, useNavigationDirection } from "../useEntryState";
|
|
3
|
+
import { registerEntryStateCollector } from "../entryState.js";
|
|
4
|
+
import { nextRestoreAction, RESTORE_DEADLINE_MS } from "../scrollRestore.js";
|
|
5
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
6
|
+
import { useEntryState, useNavigationDirection } from "../useEntryState.js";
|
|
7
7
|
const SCROLL_KEY = "ir.scroll";
|
|
8
8
|
const documentScroller = () => {
|
|
9
9
|
if (typeof document === "undefined" || typeof window === "undefined") return null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use } from "react";
|
|
4
|
-
import { Link } from "./Link";
|
|
5
|
-
import { RenderExportedComponentContext } from "./Include";
|
|
6
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
7
|
-
import { splitHash } from "../urlUtils";
|
|
8
|
-
import { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from "../linkSpace";
|
|
4
|
+
import { Link } from "./Link.js";
|
|
5
|
+
import { RenderExportedComponentContext } from "./Include.js";
|
|
6
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
7
|
+
import { splitHash } from "../urlUtils.js";
|
|
8
|
+
import { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from "../linkSpace.js";
|
|
9
9
|
const labelFromTarget = (target) => {
|
|
10
10
|
const base = target.split(/[\\/]/).pop() ?? target;
|
|
11
11
|
return base.replace(/\.mdx?$/i, "") || target;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-VHAA22YE.js";
|
|
2
2
|
import { Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useContext } from "react";
|
|
4
|
-
import { TinkerableContext } from "../TinkerableContext";
|
|
4
|
+
import { TinkerableContext } from "../TinkerableContext.js";
|
|
5
5
|
const ErrorNotFound = () => {
|
|
6
6
|
const {
|
|
7
7
|
navigationState: { pathParameters }
|
package/dist/contextUtils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { parseHref, getSearchParams } from "./urlUtils";
|
|
3
|
-
import { applyRoutingRule } from "./routing";
|
|
4
|
-
import { getInjectedMetadataSnapshot } from "./injectedBundler";
|
|
2
|
+
import { parseHref, getSearchParams } from "./urlUtils.js";
|
|
3
|
+
import { applyRoutingRule } from "./routing.js";
|
|
4
|
+
import { getInjectedMetadataSnapshot } from "./injectedBundler.js";
|
|
5
5
|
const getContextFromUrl = (routingSpec, outerHref, filesMetadata) => {
|
|
6
6
|
const navigationState = parseHref(outerHref);
|
|
7
7
|
const appliedRoutingRule = applyRoutingRule(routingSpec, navigationState);
|
package/dist/contribute.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { protocolStream } from "./protocolStream";
|
|
3
|
-
import { PROTOCOL_CONTRIBUTE } from "./generated/protocol";
|
|
2
|
+
import { protocolStream } from "./protocolStream.js";
|
|
3
|
+
import { PROTOCOL_CONTRIBUTE } from "./generated/protocol.js";
|
|
4
4
|
function contribute(opts) {
|
|
5
5
|
return protocolStream(PROTOCOL_CONTRIBUTE, "run", [opts]);
|
|
6
6
|
}
|
package/dist/corpus.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
useBundleEntry,
|
|
7
7
|
toBundlePath,
|
|
8
8
|
fromBundlePath
|
|
9
|
-
} from "./bundle";
|
|
10
|
-
import { useCurrentEntry } from "./bundle";
|
|
9
|
+
} from "./bundle.js";
|
|
10
|
+
import { useCurrentEntry } from "./bundle.js";
|
|
11
11
|
export {
|
|
12
12
|
BundleContext as CorpusContext,
|
|
13
13
|
fromBundlePath as fromCorpusPath,
|
package/dist/debug.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { createPushChannel } from "./pushChannel";
|
|
3
|
-
import { sendMessage, addListener } from "./sandboxUtils";
|
|
4
|
-
import { DEBUG_ENABLED, DEBUG_LOG, DEBUG_QUERY, DEBUG_QUERY_RESULT, REQUEST_DEBUG_ENABLED } from "./generated/protocol";
|
|
2
|
+
import { createPushChannel } from "./pushChannel.js";
|
|
3
|
+
import { sendMessage, addListener } from "./sandboxUtils.js";
|
|
4
|
+
import { DEBUG_ENABLED, DEBUG_LOG, DEBUG_QUERY, DEBUG_QUERY_RESULT, REQUEST_DEBUG_ENABLED } from "./generated/protocol.js";
|
|
5
5
|
const enabledChannel = createPushChannel({
|
|
6
6
|
pushType: DEBUG_ENABLED,
|
|
7
7
|
requestType: REQUEST_DEBUG_ENABLED,
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
|
-
import { createPushChannel } from "./pushChannel";
|
|
3
|
-
import { DIAGNOSTICS, REQUEST_DIAGNOSTICS } from "./generated/protocol";
|
|
2
|
+
import { createPushChannel } from "./pushChannel.js";
|
|
3
|
+
import { DIAGNOSTICS, REQUEST_DIAGNOSTICS } from "./generated/protocol.js";
|
|
4
4
|
const EMPTY = { buildErrors: [], consoleEntries: [], provenance: null };
|
|
5
5
|
const channel = createPushChannel({
|
|
6
6
|
pushType: DIAGNOSTICS,
|
package/dist/dialog.cjs
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dialog_exports = {};
|
|
20
|
+
__export(dialog_exports, {
|
|
21
|
+
Dialog: () => Dialog,
|
|
22
|
+
useDialogDismiss: () => useDialogDismiss,
|
|
23
|
+
useDialogFocus: () => useDialogFocus
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(dialog_exports);
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
const FOCUSABLE = 'button:not([disabled]), [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])';
|
|
29
|
+
const stack = [];
|
|
30
|
+
const onDocumentKeyDown = (e) => {
|
|
31
|
+
if (e.key !== "Escape") return;
|
|
32
|
+
const top = stack[stack.length - 1];
|
|
33
|
+
if (!top) return;
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
top.onDismiss();
|
|
36
|
+
};
|
|
37
|
+
function useDialogDismiss(onDismiss, { enabled = true } = {}) {
|
|
38
|
+
const ref = (0, import_react.useRef)(onDismiss);
|
|
39
|
+
ref.current = onDismiss;
|
|
40
|
+
(0, import_react.useEffect)(() => {
|
|
41
|
+
if (!enabled) return;
|
|
42
|
+
const entry = { onDismiss: () => ref.current() };
|
|
43
|
+
stack.push(entry);
|
|
44
|
+
if (stack.length === 1) document.addEventListener("keydown", onDocumentKeyDown, true);
|
|
45
|
+
return () => {
|
|
46
|
+
const i = stack.indexOf(entry);
|
|
47
|
+
if (i !== -1) stack.splice(i, 1);
|
|
48
|
+
if (stack.length === 0) document.removeEventListener("keydown", onDocumentKeyDown, true);
|
|
49
|
+
};
|
|
50
|
+
}, [enabled]);
|
|
51
|
+
}
|
|
52
|
+
function useDialogFocus(ref, { enabled = true } = {}) {
|
|
53
|
+
(0, import_react.useEffect)(() => {
|
|
54
|
+
const node = ref.current;
|
|
55
|
+
if (!enabled || !node) return;
|
|
56
|
+
const invoker = document.activeElement;
|
|
57
|
+
const first = node.querySelector(FOCUSABLE) ?? node;
|
|
58
|
+
first.focus();
|
|
59
|
+
const onKeyDown = (e) => {
|
|
60
|
+
if (e.key !== "Tab") return;
|
|
61
|
+
const list = Array.from(node.querySelectorAll(FOCUSABLE));
|
|
62
|
+
if (list.length === 0) return;
|
|
63
|
+
const firstEl = list[0];
|
|
64
|
+
const lastEl = list[list.length - 1];
|
|
65
|
+
const active = document.activeElement;
|
|
66
|
+
if (e.shiftKey && active === firstEl) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
lastEl.focus();
|
|
69
|
+
} else if (!e.shiftKey && active === lastEl) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
firstEl.focus();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
node.addEventListener("keydown", onKeyDown);
|
|
75
|
+
return () => {
|
|
76
|
+
node.removeEventListener("keydown", onKeyDown);
|
|
77
|
+
invoker?.focus?.();
|
|
78
|
+
};
|
|
79
|
+
}, [enabled, ref]);
|
|
80
|
+
}
|
|
81
|
+
function Dialog({ children, onDismiss, className, style, ...aria }) {
|
|
82
|
+
const ref = (0, import_react.useRef)(null);
|
|
83
|
+
useDialogDismiss(onDismiss);
|
|
84
|
+
useDialogFocus(ref);
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, role: "dialog", "aria-modal": "true", className, style, ...aria, children });
|
|
86
|
+
}
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
Dialog,
|
|
90
|
+
useDialogDismiss,
|
|
91
|
+
useDialogFocus
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=dialog.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dialog.tsx"],"sourcesContent":["// In-app dialog primitives (interaction_standards R-IX-1; the dialog half of the\n// standards' delivery vehicle, R3-613).\n//\n// The APG dialog contract as imports: Escape dismisses the TOPMOST open dialog,\n// focus moves into the dialog on open and back to the invoker on close, and Tab\n// wraps inside it. Generalized from the host's own pair (site-main\n// `useHostDialogDismiss`/`useHostDialogFocus`, R3-592) — the same decisions,\n// renamed for an app context; site-main holds the two to identical behaviour\n// with a parity test, so \"generalized\" is a fact and an app can swap between\n// the primitives without re-litigating the contract.\n//\n// TRUST BOUNDARY (same rule as `./loading`): these render INSIDE the app's\n// iframe, under the app's principal — presentational only, NO capability, NO\n// host round-trip, no reserved landmark or host wordmark. Ordinary app a11y,\n// never trusted-chrome framing; adds nothing to a grant set.\n//\n// The dismiss listener is a capture-phase listener on the app's OWN document,\n// installed while the stack is non-empty. Capture is what makes the contract\n// hold on both sides: a keystroke the app dialog claims (Escape → stopPropagation)\n// never reaches an app-level bubble handler behind the dialog — and the host's\n// top-document listener lives in another document entirely, so neither side's\n// dismissal can suppress the other's, with no protocol between them.\nimport { useEffect, useRef, type CSSProperties, type ReactNode } from 'react';\n\n/** The focusable-selector constant. Deliberately NOT exported from `index.ts`:\n * it is an implementation detail of the trap, not author surface. Includes\n * `iframe` because a dialog whose body hosts a frame must let Tab reach it. */\nconst FOCUSABLE = 'button:not([disabled]), [href], input, select, textarea, iframe, [tabindex]:not([tabindex=\"-1\"])';\n\ntype Entry = { onDismiss: () => void };\n\n// A module-level stack is the whole registry: the ONE capture-phase document\n// listener is installed when the first dialog mounts and removed when the last\n// unmounts. Reading `stack` fresh on each keypress makes removal-of-a-non-top-\n// entry safe.\nconst stack: Entry[] = [];\n\nconst onDocumentKeyDown = (e: KeyboardEvent): void => {\n if (e.key !== 'Escape') return;\n const top = stack[stack.length - 1];\n if (!top) return;\n e.stopPropagation();\n top.onDismiss();\n};\n\n/**\n * Register `onDismiss` as this dialog's Escape handler. The topmost mounted\n * dialog wins: only its handler runs, and only on Escape.\n *\n * `onDismiss` is read through a ref so a new inline lambda on each render (the\n * near-universal shape of an `onClose` prop) does NOT re-register the dialog —\n * the entry is torn down and re-added only when `enabled` changes.\n */\nexport function useDialogDismiss(onDismiss: () => void, { enabled = true }: { enabled?: boolean } = {}): void {\n const ref = useRef(onDismiss);\n ref.current = onDismiss;\n\n useEffect(() => {\n if (!enabled) return;\n const entry: Entry = { onDismiss: () => ref.current() };\n stack.push(entry);\n if (stack.length === 1) document.addEventListener('keydown', onDocumentKeyDown, true);\n return () => {\n // Unmounting removes THIS dialog's entry, which may not be the top — a\n // dialog closed out of stack order must not leak its entry. Splice by\n // identity, never by \"pop\".\n const i = stack.indexOf(entry);\n if (i !== -1) stack.splice(i, 1);\n if (stack.length === 0) document.removeEventListener('keydown', onDocumentKeyDown, true);\n };\n }, [enabled]);\n}\n\n/**\n * Manage focus for one dialog rooted at `ref`: on open, record the invoking\n * element and focus the first focusable descendant (falling back to `ref`\n * itself — give the root `tabIndex={-1}` for that case); on close, return\n * focus to the invoker (guarded — it may itself have unmounted); Tab /\n * Shift-Tab wrap at the ends of the focusable list, read at keydown time\n * rather than cached on mount (dialog contents change).\n */\nexport function useDialogFocus(\n ref: { current: HTMLElement | null },\n { enabled = true }: { enabled?: boolean } = {},\n): void {\n useEffect(() => {\n const node = ref.current;\n if (!enabled || !node) return;\n\n // Record the invoker BEFORE stealing focus — the element that opened the dialog.\n const invoker = document.activeElement as HTMLElement | null;\n const first = node.querySelector<HTMLElement>(FOCUSABLE) ?? node;\n first.focus();\n\n const onKeyDown = (e: KeyboardEvent): void => {\n if (e.key !== 'Tab') return;\n const list = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (list.length === 0) return;\n const firstEl = list[0];\n const lastEl = list[list.length - 1];\n const active = document.activeElement;\n if (e.shiftKey && active === firstEl) {\n e.preventDefault();\n lastEl.focus();\n } else if (!e.shiftKey && active === lastEl) {\n e.preventDefault();\n firstEl.focus();\n }\n };\n node.addEventListener('keydown', onKeyDown);\n\n return () => {\n node.removeEventListener('keydown', onKeyDown);\n // The invoker may itself have unmounted by the time the dialog closes; the\n // optional calls are why this stays safe (and why it can never throw on teardown).\n invoker?.focus?.();\n };\n }, [enabled, ref]);\n}\n\n/** Props for {@link Dialog}. Styling is the app's — the primitive is structural. */\nexport interface DialogProps {\n children: ReactNode;\n /** Called on Escape (the topmost dialog wins). Click-outside/scrim handling is\n * the app's: the scrim is app chrome, and its click handler calls the same\n * `onDismiss`. */\n onDismiss: () => void;\n /** The accessible name — a dialog without one is unnamed to AT (4.1.2). */\n 'aria-label'?: string;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * A dialog with the contract wired: `role=\"dialog\" aria-modal=\"true\"`, Escape\n * dismiss (topmost wins), focus in on open / back to the invoker on close, Tab\n * trapped inside. Render it when the dialog is open, with the invoker still\n * focused — the invoker is recorded at mount.\n */\nexport function Dialog({ children, onDismiss, className, style, ...aria }: DialogProps): ReactNode {\n const ref = useRef<HTMLDivElement>(null);\n useDialogDismiss(onDismiss);\n useDialogFocus(ref);\n return (\n <div ref={ref} role=\"dialog\" aria-modal=\"true\" className={className} style={style} {...aria}>\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgJI;AA1HJ,mBAAsE;AAKtE,MAAM,YAAY;AAQlB,MAAM,QAAiB,CAAC;AAExB,MAAM,oBAAoB,CAAC,MAA2B;AACpD,MAAI,EAAE,QAAQ,SAAU;AACxB,QAAM,MAAM,MAAM,MAAM,SAAS,CAAC;AAClC,MAAI,CAAC,IAAK;AACV,IAAE,gBAAgB;AAClB,MAAI,UAAU;AAChB;AAUO,SAAS,iBAAiB,WAAuB,EAAE,UAAU,KAAK,IAA2B,CAAC,GAAS;AAC5G,QAAM,UAAM,qBAAO,SAAS;AAC5B,MAAI,UAAU;AAEd,8BAAU,MAAM;AACd,QAAI,CAAC,QAAS;AACd,UAAM,QAAe,EAAE,WAAW,MAAM,IAAI,QAAQ,EAAE;AACtD,UAAM,KAAK,KAAK;AAChB,QAAI,MAAM,WAAW,EAAG,UAAS,iBAAiB,WAAW,mBAAmB,IAAI;AACpF,WAAO,MAAM;AAIX,YAAM,IAAI,MAAM,QAAQ,KAAK;AAC7B,UAAI,MAAM,GAAI,OAAM,OAAO,GAAG,CAAC;AAC/B,UAAI,MAAM,WAAW,EAAG,UAAS,oBAAoB,WAAW,mBAAmB,IAAI;AAAA,IACzF;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AACd;AAUO,SAAS,eACd,KACA,EAAE,UAAU,KAAK,IAA2B,CAAC,GACvC;AACN,8BAAU,MAAM;AACd,UAAM,OAAO,IAAI;AACjB,QAAI,CAAC,WAAW,CAAC,KAAM;AAGvB,UAAM,UAAU,SAAS;AACzB,UAAM,QAAQ,KAAK,cAA2B,SAAS,KAAK;AAC5D,UAAM,MAAM;AAEZ,UAAM,YAAY,CAAC,MAA2B;AAC5C,UAAI,EAAE,QAAQ,MAAO;AACrB,YAAM,OAAO,MAAM,KAAK,KAAK,iBAA8B,SAAS,CAAC;AACrE,UAAI,KAAK,WAAW,EAAG;AACvB,YAAM,UAAU,KAAK,CAAC;AACtB,YAAM,SAAS,KAAK,KAAK,SAAS,CAAC;AACnC,YAAM,SAAS,SAAS;AACxB,UAAI,EAAE,YAAY,WAAW,SAAS;AACpC,UAAE,eAAe;AACjB,eAAO,MAAM;AAAA,MACf,WAAW,CAAC,EAAE,YAAY,WAAW,QAAQ;AAC3C,UAAE,eAAe;AACjB,gBAAQ,MAAM;AAAA,MAChB;AAAA,IACF;AACA,SAAK,iBAAiB,WAAW,SAAS;AAE1C,WAAO,MAAM;AACX,WAAK,oBAAoB,WAAW,SAAS;AAG7C,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,SAAS,GAAG,CAAC;AACnB;AAqBO,SAAS,OAAO,EAAE,UAAU,WAAW,WAAW,OAAO,GAAG,KAAK,GAA2B;AACjG,QAAM,UAAM,qBAAuB,IAAI;AACvC,mBAAiB,SAAS;AAC1B,iBAAe,GAAG;AAClB,SACE,4CAAC,SAAI,KAAU,MAAK,UAAS,cAAW,QAAO,WAAsB,OAAe,GAAG,MACpF,UACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Register `onDismiss` as this dialog's Escape handler. The topmost mounted
|
|
5
|
+
* dialog wins: only its handler runs, and only on Escape.
|
|
6
|
+
*
|
|
7
|
+
* `onDismiss` is read through a ref so a new inline lambda on each render (the
|
|
8
|
+
* near-universal shape of an `onClose` prop) does NOT re-register the dialog —
|
|
9
|
+
* the entry is torn down and re-added only when `enabled` changes.
|
|
10
|
+
*/
|
|
11
|
+
declare function useDialogDismiss(onDismiss: () => void, { enabled }?: {
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
/**
|
|
15
|
+
* Manage focus for one dialog rooted at `ref`: on open, record the invoking
|
|
16
|
+
* element and focus the first focusable descendant (falling back to `ref`
|
|
17
|
+
* itself — give the root `tabIndex={-1}` for that case); on close, return
|
|
18
|
+
* focus to the invoker (guarded — it may itself have unmounted); Tab /
|
|
19
|
+
* Shift-Tab wrap at the ends of the focusable list, read at keydown time
|
|
20
|
+
* rather than cached on mount (dialog contents change).
|
|
21
|
+
*/
|
|
22
|
+
declare function useDialogFocus(ref: {
|
|
23
|
+
current: HTMLElement | null;
|
|
24
|
+
}, { enabled }?: {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
}): void;
|
|
27
|
+
/** Props for {@link Dialog}. Styling is the app's — the primitive is structural. */
|
|
28
|
+
interface DialogProps {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
/** Called on Escape (the topmost dialog wins). Click-outside/scrim handling is
|
|
31
|
+
* the app's: the scrim is app chrome, and its click handler calls the same
|
|
32
|
+
* `onDismiss`. */
|
|
33
|
+
onDismiss: () => void;
|
|
34
|
+
/** The accessible name — a dialog without one is unnamed to AT (4.1.2). */
|
|
35
|
+
'aria-label'?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A dialog with the contract wired: `role="dialog" aria-modal="true"`, Escape
|
|
41
|
+
* dismiss (topmost wins), focus in on open / back to the invoker on close, Tab
|
|
42
|
+
* trapped inside. Render it when the dialog is open, with the invoker still
|
|
43
|
+
* focused — the invoker is recorded at mount.
|
|
44
|
+
*/
|
|
45
|
+
declare function Dialog({ children, onDismiss, className, style, ...aria }: DialogProps): ReactNode;
|
|
46
|
+
|
|
47
|
+
export { Dialog, type DialogProps, useDialogDismiss, useDialogFocus };
|
package/dist/dialog.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Register `onDismiss` as this dialog's Escape handler. The topmost mounted
|
|
5
|
+
* dialog wins: only its handler runs, and only on Escape.
|
|
6
|
+
*
|
|
7
|
+
* `onDismiss` is read through a ref so a new inline lambda on each render (the
|
|
8
|
+
* near-universal shape of an `onClose` prop) does NOT re-register the dialog —
|
|
9
|
+
* the entry is torn down and re-added only when `enabled` changes.
|
|
10
|
+
*/
|
|
11
|
+
declare function useDialogDismiss(onDismiss: () => void, { enabled }?: {
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
/**
|
|
15
|
+
* Manage focus for one dialog rooted at `ref`: on open, record the invoking
|
|
16
|
+
* element and focus the first focusable descendant (falling back to `ref`
|
|
17
|
+
* itself — give the root `tabIndex={-1}` for that case); on close, return
|
|
18
|
+
* focus to the invoker (guarded — it may itself have unmounted); Tab /
|
|
19
|
+
* Shift-Tab wrap at the ends of the focusable list, read at keydown time
|
|
20
|
+
* rather than cached on mount (dialog contents change).
|
|
21
|
+
*/
|
|
22
|
+
declare function useDialogFocus(ref: {
|
|
23
|
+
current: HTMLElement | null;
|
|
24
|
+
}, { enabled }?: {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
}): void;
|
|
27
|
+
/** Props for {@link Dialog}. Styling is the app's — the primitive is structural. */
|
|
28
|
+
interface DialogProps {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
/** Called on Escape (the topmost dialog wins). Click-outside/scrim handling is
|
|
31
|
+
* the app's: the scrim is app chrome, and its click handler calls the same
|
|
32
|
+
* `onDismiss`. */
|
|
33
|
+
onDismiss: () => void;
|
|
34
|
+
/** The accessible name — a dialog without one is unnamed to AT (4.1.2). */
|
|
35
|
+
'aria-label'?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A dialog with the contract wired: `role="dialog" aria-modal="true"`, Escape
|
|
41
|
+
* dismiss (topmost wins), focus in on open / back to the invoker on close, Tab
|
|
42
|
+
* trapped inside. Render it when the dialog is open, with the invoker still
|
|
43
|
+
* focused — the invoker is recorded at mount.
|
|
44
|
+
*/
|
|
45
|
+
declare function Dialog({ children, onDismiss, className, style, ...aria }: DialogProps): ReactNode;
|
|
46
|
+
|
|
47
|
+
export { Dialog, type DialogProps, useDialogDismiss, useDialogFocus };
|