@immediately-run/sdk 0.94.0 → 0.96.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/components/FileRouter.cjs +4 -1
- package/dist/components/FileRouter.cjs.map +1 -1
- package/dist/components/FileRouter.js +4 -1
- package/dist/components/FileRouter.js.map +1 -1
- package/dist/components/HeadingAnchor.cjs.map +1 -1
- package/dist/components/HeadingAnchor.d.cts +4 -3
- package/dist/components/HeadingAnchor.d.ts +4 -3
- package/dist/components/HeadingAnchor.js.map +1 -1
- package/dist/components/Prose.cjs +72 -0
- package/dist/components/Prose.cjs.map +1 -0
- package/dist/components/Prose.d.cts +23 -0
- package/dist/components/Prose.d.ts +23 -0
- package/dist/components/Prose.js +49 -0
- package/dist/components/Prose.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/loading.cjs +2 -6
- package/dist/loading.cjs.map +1 -1
- package/dist/loading.js +2 -6
- package/dist/loading.js.map +1 -1
- package/dist/proseStyles.cjs +181 -0
- package/dist/proseStyles.cjs.map +1 -0
- package/dist/proseStyles.d.cts +36 -0
- package/dist/proseStyles.d.ts +36 -0
- package/dist/proseStyles.js +153 -0
- package/dist/proseStyles.js.map +1 -0
- package/dist/proseTokens.cjs +235 -0
- package/dist/proseTokens.cjs.map +1 -0
- package/dist/proseTokens.d.cts +80 -0
- package/dist/proseTokens.d.ts +80 -0
- package/dist/proseTokens.js +204 -0
- package/dist/proseTokens.js.map +1 -0
- package/dist/proseTokensHook.cjs +116 -0
- package/dist/proseTokensHook.cjs.map +1 -0
- package/dist/proseTokensHook.d.cts +10 -0
- package/dist/proseTokensHook.d.ts +10 -0
- package/dist/proseTokensHook.js +99 -0
- package/dist/proseTokensHook.js.map +1 -0
- package/dist/styleElement.cjs +37 -0
- package/dist/styleElement.cjs.map +1 -0
- package/dist/styleElement.d.cts +13 -0
- package/dist/styleElement.d.ts +13 -0
- package/dist/styleElement.js +14 -0
- package/dist/styleElement.js.map +1 -0
- 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/package.json +1 -1
|
@@ -27,6 +27,8 @@ var import_TinkerableContext = require("../TinkerableContext");
|
|
|
27
27
|
var import_urlUtils = require("../urlUtils");
|
|
28
28
|
var import_defaults = require("./defaults");
|
|
29
29
|
var import_Include = require("./Include");
|
|
30
|
+
var import_Prose = require("./Prose");
|
|
31
|
+
var import_proseStyles = require("../proseStyles");
|
|
30
32
|
const FileRouter = ({
|
|
31
33
|
LoadingComponent = import_defaults.defaultLoadingComponent,
|
|
32
34
|
ErrorComponent = import_defaults.defaultErrorComponent
|
|
@@ -45,7 +47,7 @@ const FileRouter = ({
|
|
|
45
47
|
}
|
|
46
48
|
);
|
|
47
49
|
}
|
|
48
|
-
|
|
50
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
51
|
import_Include.Include,
|
|
50
52
|
{
|
|
51
53
|
filename: (0, import_urlUtils.underAppRoot)(filename),
|
|
@@ -54,6 +56,7 @@ const FileRouter = ({
|
|
|
54
56
|
baseModule: module
|
|
55
57
|
}
|
|
56
58
|
);
|
|
59
|
+
return (0, import_proseStyles.isProseFile)(filename) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Prose.Prose, { filename, children: content }) : content;
|
|
57
60
|
};
|
|
58
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
62
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/FileRouter.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useContext } from 'react';\n\nimport { TinkerableContext } from '../TinkerableContext';\nimport { underAppRoot } from '../urlUtils';\nimport { defaultErrorComponent, defaultLoadingComponent } from './defaults';\nimport { Include } from './Include';\n\nexport const FileRouter: FC = ({\n LoadingComponent = defaultLoadingComponent,\n ErrorComponent = defaultErrorComponent,\n}: {\n LoadingComponent?: typeof defaultLoadingComponent;\n ErrorComponent?: typeof defaultErrorComponent;\n} = {}) => {\n const {\n navigationState: { pathParameters, sandboxPath },\n } = useContext(TinkerableContext);\n // The default table matches `/files/*`, surfacing the file path under the `*`\n // wildcard (SANDBOX_ROUTING_SPEC §4.1/§7).\n const filename = pathParameters?.['*'];\n if (!filename) {\n return (\n <ErrorComponent\n error={new Error(`No filename could be extracted from ${sandboxPath}`)}\n resetErrorBoundary={() => {}}\n />\n );\n }\n // URL subpaths are repo-relative; the sandbox fs is rooted at `/` with the\n // repo mounted at `APP_ROOT`, so anchor the file path there before resolving.\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/FileRouter.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useContext } from 'react';\n\nimport { TinkerableContext } from '../TinkerableContext';\nimport { underAppRoot } from '../urlUtils';\nimport { defaultErrorComponent, defaultLoadingComponent } from './defaults';\nimport { Include } from './Include';\nimport { Prose } from './Prose';\nimport { isProseFile } from '../proseStyles';\n\nexport const FileRouter: FC = ({\n LoadingComponent = defaultLoadingComponent,\n ErrorComponent = defaultErrorComponent,\n}: {\n LoadingComponent?: typeof defaultLoadingComponent;\n ErrorComponent?: typeof defaultErrorComponent;\n} = {}) => {\n const {\n navigationState: { pathParameters, sandboxPath },\n } = useContext(TinkerableContext);\n // The default table matches `/files/*`, surfacing the file path under the `*`\n // wildcard (SANDBOX_ROUTING_SPEC §4.1/§7).\n const filename = pathParameters?.['*'];\n if (!filename) {\n return (\n <ErrorComponent\n error={new Error(`No filename could be extracted from ${sandboxPath}`)}\n resetErrorBoundary={() => {}}\n />\n );\n }\n // URL subpaths are repo-relative; the sandbox fs is rooted at `/` with the\n // repo mounted at `APP_ROOT`, so anchor the file path there before resolving.\n const content = (\n <Include\n filename={underAppRoot(filename)}\n LoadingComponent={LoadingComponent}\n ErrorComponent={ErrorComponent}\n // @ts-ignore\n baseModule={module}\n />\n );\n // Markdown gets the default typography; a routed app component or HTML file renders as\n // it always has, so an app's own interface is never restyled.\n return isProseFile(filename) ? <Prose filename={filename}>{content}</Prose> : content;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBM;AAxBN,mBAA2B;AAE3B,+BAAkC;AAClC,sBAA6B;AAC7B,sBAA+D;AAC/D,qBAAwB;AACxB,mBAAsB;AACtB,yBAA4B;AAErB,MAAM,aAAiB,CAAC;AAAA,EAC7B,mBAAmB;AAAA,EACnB,iBAAiB;AACnB,IAGI,CAAC,MAAM;AACT,QAAM;AAAA,IACJ,iBAAiB,EAAE,gBAAgB,YAAY;AAAA,EACjD,QAAI,yBAAW,0CAAiB;AAGhC,QAAM,WAAW,iBAAiB,GAAG;AACrC,MAAI,CAAC,UAAU;AACb,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,IAAI,MAAM,uCAAuC,WAAW,EAAE;AAAA,QACrE,oBAAoB,MAAM;AAAA,QAAC;AAAA;AAAA,IAC7B;AAAA,EAEJ;AAGA,QAAM,UACJ;AAAA,IAAC;AAAA;AAAA,MACC,cAAU,8BAAa,QAAQ;AAAA,MAC/B;AAAA,MACA;AAAA,MAEA,YAAY;AAAA;AAAA,EACd;AAIF,aAAO,gCAAY,QAAQ,IAAI,4CAAC,sBAAM,UAAqB,mBAAQ,IAAW;AAChF;","names":[]}
|
|
@@ -5,6 +5,8 @@ import { TinkerableContext } from "../TinkerableContext.js";
|
|
|
5
5
|
import { underAppRoot } from "../urlUtils.js";
|
|
6
6
|
import { defaultErrorComponent, defaultLoadingComponent } from "./defaults.js";
|
|
7
7
|
import { Include } from "./Include.js";
|
|
8
|
+
import { Prose } from "./Prose.js";
|
|
9
|
+
import { isProseFile } from "../proseStyles.js";
|
|
8
10
|
const FileRouter = ({
|
|
9
11
|
LoadingComponent = defaultLoadingComponent,
|
|
10
12
|
ErrorComponent = defaultErrorComponent
|
|
@@ -23,7 +25,7 @@ const FileRouter = ({
|
|
|
23
25
|
}
|
|
24
26
|
);
|
|
25
27
|
}
|
|
26
|
-
|
|
28
|
+
const content = /* @__PURE__ */ jsx(
|
|
27
29
|
Include,
|
|
28
30
|
{
|
|
29
31
|
filename: underAppRoot(filename),
|
|
@@ -32,6 +34,7 @@ const FileRouter = ({
|
|
|
32
34
|
baseModule: module
|
|
33
35
|
}
|
|
34
36
|
);
|
|
37
|
+
return isProseFile(filename) ? /* @__PURE__ */ jsx(Prose, { filename, children: content }) : content;
|
|
35
38
|
};
|
|
36
39
|
export {
|
|
37
40
|
FileRouter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/FileRouter.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useContext } from 'react';\n\nimport { TinkerableContext } from '../TinkerableContext';\nimport { underAppRoot } from '../urlUtils';\nimport { defaultErrorComponent, defaultLoadingComponent } from './defaults';\nimport { Include } from './Include';\n\nexport const FileRouter: FC = ({\n LoadingComponent = defaultLoadingComponent,\n ErrorComponent = defaultErrorComponent,\n}: {\n LoadingComponent?: typeof defaultLoadingComponent;\n ErrorComponent?: typeof defaultErrorComponent;\n} = {}) => {\n const {\n navigationState: { pathParameters, sandboxPath },\n } = useContext(TinkerableContext);\n // The default table matches `/files/*`, surfacing the file path under the `*`\n // wildcard (SANDBOX_ROUTING_SPEC §4.1/§7).\n const filename = pathParameters?.['*'];\n if (!filename) {\n return (\n <ErrorComponent\n error={new Error(`No filename could be extracted from ${sandboxPath}`)}\n resetErrorBoundary={() => {}}\n />\n );\n }\n // URL subpaths are repo-relative; the sandbox fs is rooted at `/` with the\n // repo mounted at `APP_ROOT`, so anchor the file path there before resolving.\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/FileRouter.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useContext } from 'react';\n\nimport { TinkerableContext } from '../TinkerableContext';\nimport { underAppRoot } from '../urlUtils';\nimport { defaultErrorComponent, defaultLoadingComponent } from './defaults';\nimport { Include } from './Include';\nimport { Prose } from './Prose';\nimport { isProseFile } from '../proseStyles';\n\nexport const FileRouter: FC = ({\n LoadingComponent = defaultLoadingComponent,\n ErrorComponent = defaultErrorComponent,\n}: {\n LoadingComponent?: typeof defaultLoadingComponent;\n ErrorComponent?: typeof defaultErrorComponent;\n} = {}) => {\n const {\n navigationState: { pathParameters, sandboxPath },\n } = useContext(TinkerableContext);\n // The default table matches `/files/*`, surfacing the file path under the `*`\n // wildcard (SANDBOX_ROUTING_SPEC §4.1/§7).\n const filename = pathParameters?.['*'];\n if (!filename) {\n return (\n <ErrorComponent\n error={new Error(`No filename could be extracted from ${sandboxPath}`)}\n resetErrorBoundary={() => {}}\n />\n );\n }\n // URL subpaths are repo-relative; the sandbox fs is rooted at `/` with the\n // repo mounted at `APP_ROOT`, so anchor the file path there before resolving.\n const content = (\n <Include\n filename={underAppRoot(filename)}\n LoadingComponent={LoadingComponent}\n ErrorComponent={ErrorComponent}\n // @ts-ignore\n baseModule={module}\n />\n );\n // Markdown gets the default typography; a routed app component or HTML file renders as\n // it always has, so an app's own interface is never restyled.\n return isProseFile(filename) ? <Prose filename={filename}>{content}</Prose> : content;\n};\n"],"mappings":";AAyBM;AAxBN,SAAS,kBAAkB;AAE3B,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB,+BAA+B;AAC/D,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAErB,MAAM,aAAiB,CAAC;AAAA,EAC7B,mBAAmB;AAAA,EACnB,iBAAiB;AACnB,IAGI,CAAC,MAAM;AACT,QAAM;AAAA,IACJ,iBAAiB,EAAE,gBAAgB,YAAY;AAAA,EACjD,IAAI,WAAW,iBAAiB;AAGhC,QAAM,WAAW,iBAAiB,GAAG;AACrC,MAAI,CAAC,UAAU;AACb,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,IAAI,MAAM,uCAAuC,WAAW,EAAE;AAAA,QACrE,oBAAoB,MAAM;AAAA,QAAC;AAAA;AAAA,IAC7B;AAAA,EAEJ;AAGA,QAAM,UACJ;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,aAAa,QAAQ;AAAA,MAC/B;AAAA,MACA;AAAA,MAEA,YAAY;AAAA;AAAA,EACd;AAIF,SAAO,YAAY,QAAQ,IAAI,oBAAC,SAAM,UAAqB,mBAAQ,IAAW;AAChF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/HeadingAnchor.tsx"],"sourcesContent":["import { ReactNode, use, useCallback } from 'react';\nimport { scrollToId } from '../scrollToId';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { constructOuterUrl } from '../urlUtils';\nimport { FragmentLink } from './Link';\n\n/**\n * Default MDX `HeadingAnchor` component — the render target for the autolink anchor\n * the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)\n * prepends to every heading. That plugin sets the heading's own `id` (a text slug,\n * or a `sec-…` section id for a numbered heading, R3-211) and emits\n * `<HeadingAnchor id=\"<that id>\" />` as the heading's first child.\n *\n * It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders\n * even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the\n * MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is\n * semantic and accessible — an `aria`-labelled `<a href=\"#id\">` permalink
|
|
1
|
+
{"version":3,"sources":["../../src/components/HeadingAnchor.tsx"],"sourcesContent":["import { ReactNode, use, useCallback } from 'react';\nimport { scrollToId } from '../scrollToId';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { constructOuterUrl } from '../urlUtils';\nimport { FragmentLink } from './Link';\n\n/**\n * Default MDX `HeadingAnchor` component — the render target for the autolink anchor\n * the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)\n * prepends to every heading. That plugin sets the heading's own `id` (a text slug,\n * or a `sec-…` section id for a numbered heading, R3-211) and emits\n * `<HeadingAnchor id=\"<that id>\" />` as the heading's first child.\n *\n * It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders\n * even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the\n * MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is\n * semantic and accessible — an `aria`-labelled `<a href=\"#id\">` permalink. Its look\n * comes from the SDK's default prose stylesheet (`proseStyles.ts`, MARKDOWN_SYNTAX_SPEC\n * §16.4): in the gutter on hover devices, at the line end on touch. An app restyles it\n * with CSS targeting the `ir-heading-anchor` class, or\n * overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to\n * change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of\n * every heading anchor in every content file at once (§15.4 late binding).\n *\n * `id` is the *heading's own* id, so the permalink `#id` is the same URL a reader\n * copies and (for a `sec-…` id) an agent computes from a `§`-citation with zero\n * lookup. A missing/empty `id` (defensive — the plugin always supplies one)\n * renders nothing rather than a dead `#` link.\n */\nexport const HeadingAnchor = ({\n id,\n ...rest\n}: {\n id?: string;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n // ⚠ A BARE `#id` IS THE WRONG HREF INSIDE A SANDBOXED APP, and wrong in a way that only\n // shows up when someone copies the link. The app runs in an iframe whose document URL is\n // the SANDBOX's (`https://sandbox.immediately.run/index.html?href=…`), so the browser\n // resolves `#id` against THAT — \"copy link address\" on a heading yields a\n // sandbox-internal URL that means nothing to anyone else. Reported from a real wiki\n // (2026-08-14) as exactly that URL instead of the entry's.\n //\n // Both halves have to be right, and they pull in opposite directions:\n // • the HREF must be absolute in the HOST's space, so copy-link / middle-click /\n // open-in-new-tab all produce a URL that resolves for a reader;\n // • the CLICK must NOT navigate to it — that would be a full page load to the page you\n // are already on. It scrolls, leaving the sandbox URL the host owns untouched.\n //\n // `FragmentLink` is the SDK's existing home for the second half; it runs the caller's\n // `onClick` first and stands down if it preventDefaults, which is what lets the href be\n // absolute here while the behaviour stays a scroll.\n const ctx = use(TinkerableContext);\n const onAnchorClick = useCallback(\n (e: React.MouseEvent<HTMLAnchorElement>) => {\n // Let a modified click through: cmd/ctrl/middle-click means \"open the permalink\",\n // and that is precisely the case the absolute href exists to serve.\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) return;\n e.preventDefault();\n if (id) scrollToId(id);\n },\n [id],\n );\n if (!id) return null;\n // No context (a plain-markdown repo that never called `boot()`) → keep the old bare\n // fragment, which FragmentLink handles on its own.\n const href = ctx?.navigationState ? constructOuterUrl(ctx.outerHref, `#${id}`, ctx.navigationState) : `#${id}`;\n return (\n <FragmentLink\n className=\"ir-heading-anchor\"\n href={href}\n onClick={onAnchorClick}\n aria-label=\"Permalink to this heading\"\n {...rest}\n >\n <span aria-hidden=\"true\">#</span>\n </FragmentLink>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0EM;AA1EN,mBAA4C;AAC5C,wBAA2B;AAC3B,+BAAkC;AAClC,sBAAkC;AAClC,kBAA6B;AAyBtB,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,MAE+E;AAiB7E,QAAM,UAAM,kBAAI,0CAAiB;AACjC,QAAM,oBAAgB;AAAA,IACpB,CAAC,MAA2C;AAG1C,UAAI,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAG;AACxE,QAAE,eAAe;AACjB,UAAI,GAAI,mCAAW,EAAE;AAAA,IACvB;AAAA,IACA,CAAC,EAAE;AAAA,EACL;AACA,MAAI,CAAC,GAAI,QAAO;AAGhB,QAAM,OAAO,KAAK,sBAAkB,mCAAkB,IAAI,WAAW,IAAI,EAAE,IAAI,IAAI,eAAe,IAAI,IAAI,EAAE;AAC5G,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV;AAAA,MACA,SAAS;AAAA,MACT,cAAW;AAAA,MACV,GAAG;AAAA,MAEJ,sDAAC,UAAK,eAAY,QAAO,eAAC;AAAA;AAAA,EAC5B;AAEJ;","names":[]}
|
|
@@ -10,9 +10,10 @@ import { ReactNode } from 'react';
|
|
|
10
10
|
* It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders
|
|
11
11
|
* even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the
|
|
12
12
|
* MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is
|
|
13
|
-
* semantic and accessible — an `aria`-labelled `<a href="#id">` permalink
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* semantic and accessible — an `aria`-labelled `<a href="#id">` permalink. Its look
|
|
14
|
+
* comes from the SDK's default prose stylesheet (`proseStyles.ts`, MARKDOWN_SYNTAX_SPEC
|
|
15
|
+
* §16.4): in the gutter on hover devices, at the line end on touch. An app restyles it
|
|
16
|
+
* with CSS targeting the `ir-heading-anchor` class, or
|
|
16
17
|
* overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to
|
|
17
18
|
* change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of
|
|
18
19
|
* every heading anchor in every content file at once (§15.4 late binding).
|
|
@@ -10,9 +10,10 @@ import { ReactNode } from 'react';
|
|
|
10
10
|
* It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders
|
|
11
11
|
* even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the
|
|
12
12
|
* MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is
|
|
13
|
-
* semantic and accessible — an `aria`-labelled `<a href="#id">` permalink
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* semantic and accessible — an `aria`-labelled `<a href="#id">` permalink. Its look
|
|
14
|
+
* comes from the SDK's default prose stylesheet (`proseStyles.ts`, MARKDOWN_SYNTAX_SPEC
|
|
15
|
+
* §16.4): in the gutter on hover devices, at the line end on touch. An app restyles it
|
|
16
|
+
* with CSS targeting the `ir-heading-anchor` class, or
|
|
16
17
|
* overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to
|
|
17
18
|
* change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of
|
|
18
19
|
* every heading anchor in every content file at once (§15.4 late binding).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/HeadingAnchor.tsx"],"sourcesContent":["import { ReactNode, use, useCallback } from 'react';\nimport { scrollToId } from '../scrollToId';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { constructOuterUrl } from '../urlUtils';\nimport { FragmentLink } from './Link';\n\n/**\n * Default MDX `HeadingAnchor` component — the render target for the autolink anchor\n * the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)\n * prepends to every heading. That plugin sets the heading's own `id` (a text slug,\n * or a `sec-…` section id for a numbered heading, R3-211) and emits\n * `<HeadingAnchor id=\"<that id>\" />` as the heading's first child.\n *\n * It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders\n * even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the\n * MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is\n * semantic and accessible — an `aria`-labelled `<a href=\"#id\">` permalink
|
|
1
|
+
{"version":3,"sources":["../../src/components/HeadingAnchor.tsx"],"sourcesContent":["import { ReactNode, use, useCallback } from 'react';\nimport { scrollToId } from '../scrollToId';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { constructOuterUrl } from '../urlUtils';\nimport { FragmentLink } from './Link';\n\n/**\n * Default MDX `HeadingAnchor` component — the render target for the autolink anchor\n * the transpiler's heading-slug plugin (R3-186, `MARKDOWN_SYNTAX_SPEC §15.4`)\n * prepends to every heading. That plugin sets the heading's own `id` (a text slug,\n * or a `sec-…` section id for a numbered heading, R3-211) and emits\n * `<HeadingAnchor id=\"<that id>\" />` as the heading's first child.\n *\n * It is registered in {@link DEFAULT_MDX_COMPONENTS} so a heading anchor renders\n * even in a plain-markdown repo that never calls `boot({ mdxComponents })` — the\n * MDX missing-reference guard never fires (§11.2 phantom defaults). The markup is\n * semantic and accessible — an `aria`-labelled `<a href=\"#id\">` permalink. Its look\n * comes from the SDK's default prose stylesheet (`proseStyles.ts`, MARKDOWN_SYNTAX_SPEC\n * §16.4): in the gutter on hover devices, at the line end on touch. An app restyles it\n * with CSS targeting the `ir-heading-anchor` class, or\n * overrides this component via `boot({ mdxComponents: { HeadingAnchor } })` to\n * change the icon, position, or behaviour (e.g. copy-permalink-to-clipboard) of\n * every heading anchor in every content file at once (§15.4 late binding).\n *\n * `id` is the *heading's own* id, so the permalink `#id` is the same URL a reader\n * copies and (for a `sec-…` id) an agent computes from a `§`-citation with zero\n * lookup. A missing/empty `id` (defensive — the plugin always supplies one)\n * renders nothing rather than a dead `#` link.\n */\nexport const HeadingAnchor = ({\n id,\n ...rest\n}: {\n id?: string;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n // ⚠ A BARE `#id` IS THE WRONG HREF INSIDE A SANDBOXED APP, and wrong in a way that only\n // shows up when someone copies the link. The app runs in an iframe whose document URL is\n // the SANDBOX's (`https://sandbox.immediately.run/index.html?href=…`), so the browser\n // resolves `#id` against THAT — \"copy link address\" on a heading yields a\n // sandbox-internal URL that means nothing to anyone else. Reported from a real wiki\n // (2026-08-14) as exactly that URL instead of the entry's.\n //\n // Both halves have to be right, and they pull in opposite directions:\n // • the HREF must be absolute in the HOST's space, so copy-link / middle-click /\n // open-in-new-tab all produce a URL that resolves for a reader;\n // • the CLICK must NOT navigate to it — that would be a full page load to the page you\n // are already on. It scrolls, leaving the sandbox URL the host owns untouched.\n //\n // `FragmentLink` is the SDK's existing home for the second half; it runs the caller's\n // `onClick` first and stands down if it preventDefaults, which is what lets the href be\n // absolute here while the behaviour stays a scroll.\n const ctx = use(TinkerableContext);\n const onAnchorClick = useCallback(\n (e: React.MouseEvent<HTMLAnchorElement>) => {\n // Let a modified click through: cmd/ctrl/middle-click means \"open the permalink\",\n // and that is precisely the case the absolute href exists to serve.\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) return;\n e.preventDefault();\n if (id) scrollToId(id);\n },\n [id],\n );\n if (!id) return null;\n // No context (a plain-markdown repo that never called `boot()`) → keep the old bare\n // fragment, which FragmentLink handles on its own.\n const href = ctx?.navigationState ? constructOuterUrl(ctx.outerHref, `#${id}`, ctx.navigationState) : `#${id}`;\n return (\n <FragmentLink\n className=\"ir-heading-anchor\"\n href={href}\n onClick={onAnchorClick}\n aria-label=\"Permalink to this heading\"\n {...rest}\n >\n <span aria-hidden=\"true\">#</span>\n </FragmentLink>\n );\n};\n"],"mappings":";AA0EM;AA1EN,SAAoB,KAAK,mBAAmB;AAC5C,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAyBtB,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,GAAG;AACL,MAE+E;AAiB7E,QAAM,MAAM,IAAI,iBAAiB;AACjC,QAAM,gBAAgB;AAAA,IACpB,CAAC,MAA2C;AAG1C,UAAI,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAG;AACxE,QAAE,eAAe;AACjB,UAAI,GAAI,YAAW,EAAE;AAAA,IACvB;AAAA,IACA,CAAC,EAAE;AAAA,EACL;AACA,MAAI,CAAC,GAAI,QAAO;AAGhB,QAAM,OAAO,KAAK,kBAAkB,kBAAkB,IAAI,WAAW,IAAI,EAAE,IAAI,IAAI,eAAe,IAAI,IAAI,EAAE;AAC5G,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV;AAAA,MACA,SAAS;AAAA,MACT,cAAW;AAAA,MACV,GAAG;AAAA,MAEJ,8BAAC,UAAK,eAAY,QAAO,eAAC;AAAA;AAAA,EAC5B;AAEJ;","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 Prose_exports = {};
|
|
20
|
+
__export(Prose_exports, {
|
|
21
|
+
Prose: () => Prose
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Prose_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_proseStyles = require("../proseStyles");
|
|
27
|
+
var import_proseTokens = require("../proseTokens");
|
|
28
|
+
var import_proseTokensHook = require("../proseTokensHook");
|
|
29
|
+
var import_theme = require("../theme");
|
|
30
|
+
const assignRef = (ref, value) => {
|
|
31
|
+
if (typeof ref === "function") ref(value);
|
|
32
|
+
else if (ref) ref.current = value;
|
|
33
|
+
};
|
|
34
|
+
const Prose = ({ className, children, filename, ref, ...rest }) => {
|
|
35
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
36
|
+
(0, import_proseStyles.ensureProseStyles)();
|
|
37
|
+
}, []);
|
|
38
|
+
const theme = (0, import_theme.useHostTheme)();
|
|
39
|
+
const tokens = (0, import_proseTokensHook.useProseTokens)(filename);
|
|
40
|
+
const element = (0, import_react.useRef)(null);
|
|
41
|
+
const setElement = (0, import_react.useCallback)(
|
|
42
|
+
(node) => {
|
|
43
|
+
element.current = node;
|
|
44
|
+
assignRef(ref, node);
|
|
45
|
+
},
|
|
46
|
+
[ref]
|
|
47
|
+
);
|
|
48
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
49
|
+
const el = element.current;
|
|
50
|
+
if (!el || !tokens) return;
|
|
51
|
+
const entries = (0, import_proseTokens.tokensFor)(tokens, theme);
|
|
52
|
+
for (const [name, value] of entries) el.style.setProperty(name, value);
|
|
53
|
+
return () => {
|
|
54
|
+
for (const [name] of entries) el.style.removeProperty(name);
|
|
55
|
+
};
|
|
56
|
+
}, [tokens, theme]);
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
"article",
|
|
59
|
+
{
|
|
60
|
+
...rest,
|
|
61
|
+
ref: setElement,
|
|
62
|
+
className: className ? `${import_proseStyles.PROSE_CLASS} ${className}` : import_proseStyles.PROSE_CLASS,
|
|
63
|
+
"data-theme": theme,
|
|
64
|
+
children
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
Prose
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=Prose.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Prose.tsx"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, type ComponentPropsWithRef, type Ref } from 'react';\n\nimport { ensureProseStyles, PROSE_CLASS } from '../proseStyles';\nimport { tokensFor } from '../proseTokens';\nimport { useProseTokens } from '../proseTokensHook';\nimport { useHostTheme } from '../theme';\n\nexport interface ProseProps extends ComponentPropsWithRef<'article'> {\n /**\n * The repo-relative path of the Markdown file this wraps. When set, the author token\n * file that governs it (`PROSE_TOKEN_FILE`, or the file a bundle marker's `styles`\n * names — MARKDOWN_SYNTAX_SPEC §16.6) restyles this article. `FileRouter` passes it.\n */\n filename?: string;\n}\n\nconst assignRef = <T,>(ref: Ref<T> | undefined, value: T | null): void => {\n if (typeof ref === 'function') ref(value);\n else if (ref) (ref as { current: T | null }).current = value;\n};\n\n/**\n * The wrapper for rendered Markdown: an `<article class=\"ir-prose\">` styled by the SDK's\n * layered default stylesheet and keyed to the host theme through `data-theme`.\n *\n * `FileRouter` uses it for every routed `.md`/`.mdx` file. An app that renders Markdown\n * itself can wrap its content in it to get the same typography; any unlayered CSS the app\n * ships overrides the defaults, and setting a token such as `--accent` or `--sans` on an\n * ancestor restyles every rule that reads it.\n */\nexport const Prose = ({ className, children, filename, ref, ...rest }: ProseProps) => {\n useLayoutEffect(() => {\n ensureProseStyles();\n }, []);\n const theme = useHostTheme();\n const tokens = useProseTokens(filename);\n const element = useRef<HTMLElement | null>(null);\n const setElement = useCallback(\n (node: HTMLElement | null) => {\n element.current = node;\n assignRef(ref, node);\n },\n [ref],\n );\n\n // Author tokens are SET, one property at a time, on this element; never written as CSS\n // text. Each set is removed before the next (a token dropped from the file must stop\n // applying) and on unmount.\n useLayoutEffect(() => {\n const el = element.current;\n if (!el || !tokens) return;\n const entries = tokensFor(tokens, theme);\n for (const [name, value] of entries) el.style.setProperty(name, value);\n return () => {\n for (const [name] of entries) el.style.removeProperty(name);\n };\n }, [tokens, theme]);\n\n return (\n <article\n {...rest}\n ref={setElement}\n className={className ? `${PROSE_CLASS} ${className}` : PROSE_CLASS}\n data-theme={theme}\n >\n {children}\n </article>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2DI;AA3DJ,mBAA2F;AAE3F,yBAA+C;AAC/C,yBAA0B;AAC1B,6BAA+B;AAC/B,mBAA6B;AAW7B,MAAM,YAAY,CAAK,KAAyB,UAA0B;AACxE,MAAI,OAAO,QAAQ,WAAY,KAAI,KAAK;AAAA,WAC/B,IAAK,CAAC,IAA8B,UAAU;AACzD;AAWO,MAAM,QAAQ,CAAC,EAAE,WAAW,UAAU,UAAU,KAAK,GAAG,KAAK,MAAkB;AACpF,oCAAgB,MAAM;AACpB,8CAAkB;AAAA,EACpB,GAAG,CAAC,CAAC;AACL,QAAM,YAAQ,2BAAa;AAC3B,QAAM,aAAS,uCAAe,QAAQ;AACtC,QAAM,cAAU,qBAA2B,IAAI;AAC/C,QAAM,iBAAa;AAAA,IACjB,CAAC,SAA6B;AAC5B,cAAQ,UAAU;AAClB,gBAAU,KAAK,IAAI;AAAA,IACrB;AAAA,IACA,CAAC,GAAG;AAAA,EACN;AAKA,oCAAgB,MAAM;AACpB,UAAM,KAAK,QAAQ;AACnB,QAAI,CAAC,MAAM,CAAC,OAAQ;AACpB,UAAM,cAAU,8BAAU,QAAQ,KAAK;AACvC,eAAW,CAAC,MAAM,KAAK,KAAK,QAAS,IAAG,MAAM,YAAY,MAAM,KAAK;AACrE,WAAO,MAAM;AACX,iBAAW,CAAC,IAAI,KAAK,QAAS,IAAG,MAAM,eAAe,IAAI;AAAA,IAC5D;AAAA,EACF,GAAG,CAAC,QAAQ,KAAK,CAAC;AAElB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,WAAW,YAAY,GAAG,8BAAW,IAAI,SAAS,KAAK;AAAA,MACvD,cAAY;AAAA,MAEX;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ProseProps extends ComponentPropsWithRef<'article'> {
|
|
5
|
+
/**
|
|
6
|
+
* The repo-relative path of the Markdown file this wraps. When set, the author token
|
|
7
|
+
* file that governs it (`PROSE_TOKEN_FILE`, or the file a bundle marker's `styles`
|
|
8
|
+
* names — MARKDOWN_SYNTAX_SPEC §16.6) restyles this article. `FileRouter` passes it.
|
|
9
|
+
*/
|
|
10
|
+
filename?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The wrapper for rendered Markdown: an `<article class="ir-prose">` styled by the SDK's
|
|
14
|
+
* layered default stylesheet and keyed to the host theme through `data-theme`.
|
|
15
|
+
*
|
|
16
|
+
* `FileRouter` uses it for every routed `.md`/`.mdx` file. An app that renders Markdown
|
|
17
|
+
* itself can wrap its content in it to get the same typography; any unlayered CSS the app
|
|
18
|
+
* ships overrides the defaults, and setting a token such as `--accent` or `--sans` on an
|
|
19
|
+
* ancestor restyles every rule that reads it.
|
|
20
|
+
*/
|
|
21
|
+
declare const Prose: ({ className, children, filename, ref, ...rest }: ProseProps) => react.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { Prose, type ProseProps };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ProseProps extends ComponentPropsWithRef<'article'> {
|
|
5
|
+
/**
|
|
6
|
+
* The repo-relative path of the Markdown file this wraps. When set, the author token
|
|
7
|
+
* file that governs it (`PROSE_TOKEN_FILE`, or the file a bundle marker's `styles`
|
|
8
|
+
* names — MARKDOWN_SYNTAX_SPEC §16.6) restyles this article. `FileRouter` passes it.
|
|
9
|
+
*/
|
|
10
|
+
filename?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The wrapper for rendered Markdown: an `<article class="ir-prose">` styled by the SDK's
|
|
14
|
+
* layered default stylesheet and keyed to the host theme through `data-theme`.
|
|
15
|
+
*
|
|
16
|
+
* `FileRouter` uses it for every routed `.md`/`.mdx` file. An app that renders Markdown
|
|
17
|
+
* itself can wrap its content in it to get the same typography; any unlayered CSS the app
|
|
18
|
+
* ships overrides the defaults, and setting a token such as `--accent` or `--sans` on an
|
|
19
|
+
* ancestor restyles every rule that reads it.
|
|
20
|
+
*/
|
|
21
|
+
declare const Prose: ({ className, children, filename, ref, ...rest }: ProseProps) => react.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { Prose, type ProseProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "../chunk-VHAA22YE.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useLayoutEffect, useRef } from "react";
|
|
4
|
+
import { ensureProseStyles, PROSE_CLASS } from "../proseStyles.js";
|
|
5
|
+
import { tokensFor } from "../proseTokens.js";
|
|
6
|
+
import { useProseTokens } from "../proseTokensHook.js";
|
|
7
|
+
import { useHostTheme } from "../theme.js";
|
|
8
|
+
const assignRef = (ref, value) => {
|
|
9
|
+
if (typeof ref === "function") ref(value);
|
|
10
|
+
else if (ref) ref.current = value;
|
|
11
|
+
};
|
|
12
|
+
const Prose = ({ className, children, filename, ref, ...rest }) => {
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
ensureProseStyles();
|
|
15
|
+
}, []);
|
|
16
|
+
const theme = useHostTheme();
|
|
17
|
+
const tokens = useProseTokens(filename);
|
|
18
|
+
const element = useRef(null);
|
|
19
|
+
const setElement = useCallback(
|
|
20
|
+
(node) => {
|
|
21
|
+
element.current = node;
|
|
22
|
+
assignRef(ref, node);
|
|
23
|
+
},
|
|
24
|
+
[ref]
|
|
25
|
+
);
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
const el = element.current;
|
|
28
|
+
if (!el || !tokens) return;
|
|
29
|
+
const entries = tokensFor(tokens, theme);
|
|
30
|
+
for (const [name, value] of entries) el.style.setProperty(name, value);
|
|
31
|
+
return () => {
|
|
32
|
+
for (const [name] of entries) el.style.removeProperty(name);
|
|
33
|
+
};
|
|
34
|
+
}, [tokens, theme]);
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"article",
|
|
37
|
+
{
|
|
38
|
+
...rest,
|
|
39
|
+
ref: setElement,
|
|
40
|
+
className: className ? `${PROSE_CLASS} ${className}` : PROSE_CLASS,
|
|
41
|
+
"data-theme": theme,
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
Prose
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=Prose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Prose.tsx"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, type ComponentPropsWithRef, type Ref } from 'react';\n\nimport { ensureProseStyles, PROSE_CLASS } from '../proseStyles';\nimport { tokensFor } from '../proseTokens';\nimport { useProseTokens } from '../proseTokensHook';\nimport { useHostTheme } from '../theme';\n\nexport interface ProseProps extends ComponentPropsWithRef<'article'> {\n /**\n * The repo-relative path of the Markdown file this wraps. When set, the author token\n * file that governs it (`PROSE_TOKEN_FILE`, or the file a bundle marker's `styles`\n * names — MARKDOWN_SYNTAX_SPEC §16.6) restyles this article. `FileRouter` passes it.\n */\n filename?: string;\n}\n\nconst assignRef = <T,>(ref: Ref<T> | undefined, value: T | null): void => {\n if (typeof ref === 'function') ref(value);\n else if (ref) (ref as { current: T | null }).current = value;\n};\n\n/**\n * The wrapper for rendered Markdown: an `<article class=\"ir-prose\">` styled by the SDK's\n * layered default stylesheet and keyed to the host theme through `data-theme`.\n *\n * `FileRouter` uses it for every routed `.md`/`.mdx` file. An app that renders Markdown\n * itself can wrap its content in it to get the same typography; any unlayered CSS the app\n * ships overrides the defaults, and setting a token such as `--accent` or `--sans` on an\n * ancestor restyles every rule that reads it.\n */\nexport const Prose = ({ className, children, filename, ref, ...rest }: ProseProps) => {\n useLayoutEffect(() => {\n ensureProseStyles();\n }, []);\n const theme = useHostTheme();\n const tokens = useProseTokens(filename);\n const element = useRef<HTMLElement | null>(null);\n const setElement = useCallback(\n (node: HTMLElement | null) => {\n element.current = node;\n assignRef(ref, node);\n },\n [ref],\n );\n\n // Author tokens are SET, one property at a time, on this element; never written as CSS\n // text. Each set is removed before the next (a token dropped from the file must stop\n // applying) and on unmount.\n useLayoutEffect(() => {\n const el = element.current;\n if (!el || !tokens) return;\n const entries = tokensFor(tokens, theme);\n for (const [name, value] of entries) el.style.setProperty(name, value);\n return () => {\n for (const [name] of entries) el.style.removeProperty(name);\n };\n }, [tokens, theme]);\n\n return (\n <article\n {...rest}\n ref={setElement}\n className={className ? `${PROSE_CLASS} ${className}` : PROSE_CLASS}\n data-theme={theme}\n >\n {children}\n </article>\n );\n};\n"],"mappings":";AA2DI;AA3DJ,SAAS,aAAa,iBAAiB,cAAoD;AAE3F,SAAS,mBAAmB,mBAAmB;AAC/C,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAW7B,MAAM,YAAY,CAAK,KAAyB,UAA0B;AACxE,MAAI,OAAO,QAAQ,WAAY,KAAI,KAAK;AAAA,WAC/B,IAAK,CAAC,IAA8B,UAAU;AACzD;AAWO,MAAM,QAAQ,CAAC,EAAE,WAAW,UAAU,UAAU,KAAK,GAAG,KAAK,MAAkB;AACpF,kBAAgB,MAAM;AACpB,sBAAkB;AAAA,EACpB,GAAG,CAAC,CAAC;AACL,QAAM,QAAQ,aAAa;AAC3B,QAAM,SAAS,eAAe,QAAQ;AACtC,QAAM,UAAU,OAA2B,IAAI;AAC/C,QAAM,aAAa;AAAA,IACjB,CAAC,SAA6B;AAC5B,cAAQ,UAAU;AAClB,gBAAU,KAAK,IAAI;AAAA,IACrB;AAAA,IACA,CAAC,GAAG;AAAA,EACN;AAKA,kBAAgB,MAAM;AACpB,UAAM,KAAK,QAAQ;AACnB,QAAI,CAAC,MAAM,CAAC,OAAQ;AACpB,UAAM,UAAU,UAAU,QAAQ,KAAK;AACvC,eAAW,CAAC,MAAM,KAAK,KAAK,QAAS,IAAG,MAAM,YAAY,MAAM,KAAK;AACrE,WAAO,MAAM;AACX,iBAAW,CAAC,IAAI,KAAK,QAAS,IAAG,MAAM,eAAe,IAAI;AAAA,IAC5D;AAAA,EACF,GAAG,CAAC,QAAQ,KAAK,CAAC;AAElB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,WAAW,YAAY,GAAG,WAAW,IAAI,SAAS,KAAK;AAAA,MACvD,cAAY;AAAA,MAEX;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -19,6 +19,8 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var index_exports = {};
|
|
21
21
|
__export(index_exports, {
|
|
22
|
+
PROSE_CLASS: () => import_proseStyles.PROSE_CLASS,
|
|
23
|
+
Prose: () => import_Prose.Prose,
|
|
22
24
|
SafeInclude: () => import_SafeInclude.SafeInclude,
|
|
23
25
|
ScrollRestoration: () => import_ScrollRestoration.ScrollRestoration,
|
|
24
26
|
followBundleLink: () => import_followBundleLink.followBundleLink,
|
|
@@ -44,6 +46,8 @@ __reExport(index_exports, require("./metadataSource"), module.exports);
|
|
|
44
46
|
var import_injectedBundler = require("./injectedBundler");
|
|
45
47
|
__reExport(index_exports, require("./auth"), module.exports);
|
|
46
48
|
__reExport(index_exports, require("./theme"), module.exports);
|
|
49
|
+
var import_Prose = require("./components/Prose");
|
|
50
|
+
var import_proseStyles = require("./proseStyles");
|
|
47
51
|
__reExport(index_exports, require("./editorContext"), module.exports);
|
|
48
52
|
__reExport(index_exports, require("./editor"), module.exports);
|
|
49
53
|
__reExport(index_exports, require("./formFactor"), module.exports);
|
|
@@ -98,6 +102,8 @@ __reExport(index_exports, require("./scrollRestore"), module.exports);
|
|
|
98
102
|
var import_ScrollRestoration = require("./components/ScrollRestoration");
|
|
99
103
|
// Annotate the CommonJS export names for ESM import in node:
|
|
100
104
|
0 && (module.exports = {
|
|
105
|
+
PROSE_CLASS,
|
|
106
|
+
Prose,
|
|
101
107
|
SafeInclude,
|
|
102
108
|
ScrollRestoration,
|
|
103
109
|
followBundleLink,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './MDXProvider';\nexport * from './routing';\nexport * from './boot';\nexport * from './components/Include';\n// Only the component is public. `stripFrontmatter`/`appMountRelative` are module-level\n// exports so they can be unit-tested directly, NOT public API — the SDK's surface is\n// backwards-compatible forever, so an internal helper exported for a test's convenience is a\n// permanent commitment made for the wrong reason.\nexport { SafeInclude } from './components/SafeInclude';\nexport * from './sourceCache';\nexport * from './components/MDXComponents';\nexport * from './linkSpace';\n// R3-1324: a link that leaves its bundle is handed to the host (`bundle-link`).\nexport { followBundleLink } from './followBundleLink';\nexport * from './bundle';\n// Deprecated `Corpus*` spellings of the above (R3-482); see `src/corpus.ts`.\nexport * from './corpus';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks';\n// R3-276: the supported way for a viewer app to provide its own metadata store,\n// replacing a wholesale re-provision of `TinkerableContext` in app code.\nexport * from './metadataSource';\n// The deprecated injected-bundler adapters, re-exported so their deprecation notices\n// are visible in the published docs (R3-278; the window only narrows).\nexport { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from './injectedBundler';\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './chromeState';\nexport * from './workspace';\nexport * from './hostAttention';\nexport * from './region';\n// R3-708 — the spaces mode's route channel and its one navigation verb.\nexport * from './spacesMode';\nexport * from './mounts';\nexport * from './analytics';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './feed';\nexport * from './secrets';\nexport * from './recents'; // R3-485: the gated recent-projects read (page.home)\nexport * from './openRepository'; // R3-476: host-mediated open-in-a-new-tab (route:read)\nexport * from './openExternal'; // R3-619: host-brokered outward-link open (link:open)\nexport * from './openBundle'; // host-mediated open of a bundle in its own tab\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './launch';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './dialog';\nexport * from './status';\nexport * from './protocolStream';\nexport * from './protocolDeadline';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n// R3-489 (GROVE_AGENT_SPEC): the embedded-agent seam every app shares — the tool-use\n// loop ported from agent-demo (`runAgent` over the host chat slot), the MDX metadata\n// query tool, the headings index collector, the deixis context block, and the fence\n// for corpus-derived bytes entering a loop.\nexport * from './agentLoop';\nexport * from './agentSteering';\nexport * from './agentPause';\nexport * from './agentChatClient';\nexport * from './metadataQueryTool';\nexport * from './collectHeadings';\nexport * from './agentContext';\nexport * from './fence';\nexport * from './platformLink';\n// R3-627: the per-history-entry scratch, and the scroll restoration built on it —\n// Back lands where the reader left, for however many entries deep they go.\nexport * from './entryState';\nexport * from './useEntryState';\nexport * from './scrollRestore';\nexport { ScrollRestoration, type ScrollRestorationProps } from './components/ScrollRestoration';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,0BAAd;AACA,0BAAc,sBADd;AAEA,0BAAc,mBAFd;AAGA,0BAAc,iCAHd;AAQA,yBAA4B;AAC5B,0BAAc,0BATd;AAUA,0BAAc,uCAVd;AAWA,0BAAc,wBAXd;AAaA,8BAAiC;AACjC,0BAAc,qBAdd;AAgBA,0BAAc,qBAhBd;AAiBA,0BAAc,oCAjBd;AAkBA,0BAAc,gCAlBd;AAmBA,0BAAc,oBAnBd;AAsBA,0BAAc,6BAtBd;AAyBA,6BAAwE;AACxE,0BAAc,mBA1Bd;AA2BA,0BAAc,oBA3Bd;AA4BA,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './MDXProvider';\nexport * from './routing';\nexport * from './boot';\nexport * from './components/Include';\n// Only the component is public. `stripFrontmatter`/`appMountRelative` are module-level\n// exports so they can be unit-tested directly, NOT public API — the SDK's surface is\n// backwards-compatible forever, so an internal helper exported for a test's convenience is a\n// permanent commitment made for the wrong reason.\nexport { SafeInclude } from './components/SafeInclude';\nexport * from './sourceCache';\nexport * from './components/MDXComponents';\nexport * from './linkSpace';\n// R3-1324: a link that leaves its bundle is handed to the host (`bundle-link`).\nexport { followBundleLink } from './followBundleLink';\nexport * from './bundle';\n// Deprecated `Corpus*` spellings of the above (R3-482); see `src/corpus.ts`.\nexport * from './corpus';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks';\n// R3-276: the supported way for a viewer app to provide its own metadata store,\n// replacing a wholesale re-provision of `TinkerableContext` in app code.\nexport * from './metadataSource';\n// The deprecated injected-bundler adapters, re-exported so their deprecation notices\n// are visible in the published docs (R3-278; the window only narrows).\nexport { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from './injectedBundler';\nexport * from './auth';\nexport * from './theme';\nexport { Prose } from './components/Prose';\nexport { PROSE_CLASS } from './proseStyles';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './chromeState';\nexport * from './workspace';\nexport * from './hostAttention';\nexport * from './region';\n// R3-708 — the spaces mode's route channel and its one navigation verb.\nexport * from './spacesMode';\nexport * from './mounts';\nexport * from './analytics';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './feed';\nexport * from './secrets';\nexport * from './recents'; // R3-485: the gated recent-projects read (page.home)\nexport * from './openRepository'; // R3-476: host-mediated open-in-a-new-tab (route:read)\nexport * from './openExternal'; // R3-619: host-brokered outward-link open (link:open)\nexport * from './openBundle'; // host-mediated open of a bundle in its own tab\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './launch';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './dialog';\nexport * from './status';\nexport * from './protocolStream';\nexport * from './protocolDeadline';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n// R3-489 (GROVE_AGENT_SPEC): the embedded-agent seam every app shares — the tool-use\n// loop ported from agent-demo (`runAgent` over the host chat slot), the MDX metadata\n// query tool, the headings index collector, the deixis context block, and the fence\n// for corpus-derived bytes entering a loop.\nexport * from './agentLoop';\nexport * from './agentSteering';\nexport * from './agentPause';\nexport * from './agentChatClient';\nexport * from './metadataQueryTool';\nexport * from './collectHeadings';\nexport * from './agentContext';\nexport * from './fence';\nexport * from './platformLink';\n// R3-627: the per-history-entry scratch, and the scroll restoration built on it —\n// Back lands where the reader left, for however many entries deep they go.\nexport * from './entryState';\nexport * from './useEntryState';\nexport * from './scrollRestore';\nexport { ScrollRestoration, type ScrollRestorationProps } from './components/ScrollRestoration';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,0BAAd;AACA,0BAAc,sBADd;AAEA,0BAAc,mBAFd;AAGA,0BAAc,iCAHd;AAQA,yBAA4B;AAC5B,0BAAc,0BATd;AAUA,0BAAc,uCAVd;AAWA,0BAAc,wBAXd;AAaA,8BAAiC;AACjC,0BAAc,qBAdd;AAgBA,0BAAc,qBAhBd;AAiBA,0BAAc,oCAjBd;AAkBA,0BAAc,gCAlBd;AAmBA,0BAAc,oBAnBd;AAsBA,0BAAc,6BAtBd;AAyBA,6BAAwE;AACxE,0BAAc,mBA1Bd;AA2BA,0BAAc,oBA3Bd;AA4BA,mBAAsB;AACtB,yBAA4B;AAC5B,0BAAc,4BA9Bd;AA+BA,0BAAc,qBA/Bd;AAgCA,0BAAc,yBAhCd;AAiCA,0BAAc,0BAjCd;AAkCA,0BAAc,wB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napshot } from './injectedBundler.cjs';
|
|
16
16
|
export { AuthState, AuthStatus, SandboxUser, getAuthState, onAuthChange, useAuth } from './auth.cjs';
|
|
17
17
|
export { HostTheme, HostThemeSelection, SetHostThemeSelectionParams, ThemeBundleLocation, ThemeCatalog, ThemeCatalogEntry, addThemeSource, getHostTheme, getHostThemeSelection, getThemeCatalog, onHostThemeChange, onHostThemeSelectionChange, onThemeCatalogChange, removeThemeSource, setHostTheme, setHostThemeSelection, useHostTheme, useHostThemeSelection, useThemeCatalog } from './theme.cjs';
|
|
18
|
+
export { Prose } from './components/Prose.cjs';
|
|
19
|
+
export { PROSE_CLASS } from './proseStyles.cjs';
|
|
18
20
|
export { EditorContext, getEditorContext, onEditorContextChange, useEditorContext } from './editorContext.cjs';
|
|
19
21
|
export { EditTarget, EditorOpenError, EditorOpenOptions, EditorSelection, EditorSessionError, EditorWriteError, RequestEditError, closeFile, createFile, createFolder, deleteEntry, openInEditor, renameEntry, requestEdit, setActiveFile, uploadFile } from './editor.cjs';
|
|
20
22
|
export { FormFactor, FormFactorClass, Orientation, getFormFactor, onFormFactorChange, useFormFactor } from './formFactor.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export { MetadataSource, MetadataSourceMode, MetadataSourceProps, useMetadataSto
|
|
|
15
15
|
export { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from './injectedBundler.js';
|
|
16
16
|
export { AuthState, AuthStatus, SandboxUser, getAuthState, onAuthChange, useAuth } from './auth.js';
|
|
17
17
|
export { HostTheme, HostThemeSelection, SetHostThemeSelectionParams, ThemeBundleLocation, ThemeCatalog, ThemeCatalogEntry, addThemeSource, getHostTheme, getHostThemeSelection, getThemeCatalog, onHostThemeChange, onHostThemeSelectionChange, onThemeCatalogChange, removeThemeSource, setHostTheme, setHostThemeSelection, useHostTheme, useHostThemeSelection, useThemeCatalog } from './theme.js';
|
|
18
|
+
export { Prose } from './components/Prose.js';
|
|
19
|
+
export { PROSE_CLASS } from './proseStyles.js';
|
|
18
20
|
export { EditorContext, getEditorContext, onEditorContextChange, useEditorContext } from './editorContext.js';
|
|
19
21
|
export { EditTarget, EditorOpenError, EditorOpenOptions, EditorSelection, EditorSessionError, EditorWriteError, RequestEditError, closeFile, createFile, createFolder, deleteEntry, openInEditor, renameEntry, requestEdit, setActiveFile, uploadFile } from './editor.js';
|
|
20
22
|
export { FormFactor, FormFactorClass, Orientation, getFormFactor, onFormFactorChange, useFormFactor } from './formFactor.js';
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export * from "./metadataSource.js";
|
|
|
17
17
|
import { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from "./injectedBundler.js";
|
|
18
18
|
export * from "./auth.js";
|
|
19
19
|
export * from "./theme.js";
|
|
20
|
+
import { Prose } from "./components/Prose.js";
|
|
21
|
+
import { PROSE_CLASS } from "./proseStyles.js";
|
|
20
22
|
export * from "./editorContext.js";
|
|
21
23
|
export * from "./editor.js";
|
|
22
24
|
export * from "./formFactor.js";
|
|
@@ -70,6 +72,8 @@ export * from "./useEntryState.js";
|
|
|
70
72
|
export * from "./scrollRestore.js";
|
|
71
73
|
import { ScrollRestoration } from "./components/ScrollRestoration.js";
|
|
72
74
|
export {
|
|
75
|
+
PROSE_CLASS,
|
|
76
|
+
Prose,
|
|
73
77
|
SafeInclude,
|
|
74
78
|
ScrollRestoration,
|
|
75
79
|
followBundleLink,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './MDXProvider';\nexport * from './routing';\nexport * from './boot';\nexport * from './components/Include';\n// Only the component is public. `stripFrontmatter`/`appMountRelative` are module-level\n// exports so they can be unit-tested directly, NOT public API — the SDK's surface is\n// backwards-compatible forever, so an internal helper exported for a test's convenience is a\n// permanent commitment made for the wrong reason.\nexport { SafeInclude } from './components/SafeInclude';\nexport * from './sourceCache';\nexport * from './components/MDXComponents';\nexport * from './linkSpace';\n// R3-1324: a link that leaves its bundle is handed to the host (`bundle-link`).\nexport { followBundleLink } from './followBundleLink';\nexport * from './bundle';\n// Deprecated `Corpus*` spellings of the above (R3-482); see `src/corpus.ts`.\nexport * from './corpus';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks';\n// R3-276: the supported way for a viewer app to provide its own metadata store,\n// replacing a wholesale re-provision of `TinkerableContext` in app code.\nexport * from './metadataSource';\n// The deprecated injected-bundler adapters, re-exported so their deprecation notices\n// are visible in the published docs (R3-278; the window only narrows).\nexport { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from './injectedBundler';\nexport * from './auth';\nexport * from './theme';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './chromeState';\nexport * from './workspace';\nexport * from './hostAttention';\nexport * from './region';\n// R3-708 — the spaces mode's route channel and its one navigation verb.\nexport * from './spacesMode';\nexport * from './mounts';\nexport * from './analytics';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './feed';\nexport * from './secrets';\nexport * from './recents'; // R3-485: the gated recent-projects read (page.home)\nexport * from './openRepository'; // R3-476: host-mediated open-in-a-new-tab (route:read)\nexport * from './openExternal'; // R3-619: host-brokered outward-link open (link:open)\nexport * from './openBundle'; // host-mediated open of a bundle in its own tab\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './launch';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './dialog';\nexport * from './status';\nexport * from './protocolStream';\nexport * from './protocolDeadline';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n// R3-489 (GROVE_AGENT_SPEC): the embedded-agent seam every app shares — the tool-use\n// loop ported from agent-demo (`runAgent` over the host chat slot), the MDX metadata\n// query tool, the headings index collector, the deixis context block, and the fence\n// for corpus-derived bytes entering a loop.\nexport * from './agentLoop';\nexport * from './agentSteering';\nexport * from './agentPause';\nexport * from './agentChatClient';\nexport * from './metadataQueryTool';\nexport * from './collectHeadings';\nexport * from './agentContext';\nexport * from './fence';\nexport * from './platformLink';\n// R3-627: the per-history-entry scratch, and the scroll restoration built on it —\n// Back lands where the reader left, for however many entries deep they go.\nexport * from './entryState';\nexport * from './useEntryState';\nexport * from './scrollRestore';\nexport { ScrollRestoration, type ScrollRestorationProps } from './components/ScrollRestoration';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAKd,SAAS,mBAAmB;AAC5B,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,wBAAwB;AACjC,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,SAAS,4BAA4B,mCAAmC;AACxE,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAKd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,yBAAsD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './MDXProvider';\nexport * from './routing';\nexport * from './boot';\nexport * from './components/Include';\n// Only the component is public. `stripFrontmatter`/`appMountRelative` are module-level\n// exports so they can be unit-tested directly, NOT public API — the SDK's surface is\n// backwards-compatible forever, so an internal helper exported for a test's convenience is a\n// permanent commitment made for the wrong reason.\nexport { SafeInclude } from './components/SafeInclude';\nexport * from './sourceCache';\nexport * from './components/MDXComponents';\nexport * from './linkSpace';\n// R3-1324: a link that leaves its bundle is handed to the host (`bundle-link`).\nexport { followBundleLink } from './followBundleLink';\nexport * from './bundle';\n// Deprecated `Corpus*` spellings of the above (R3-482); see `src/corpus.ts`.\nexport * from './corpus';\nexport * from './components/MountImage';\nexport * from './components/Routes';\nexport * from './hooks';\n// R3-276: the supported way for a viewer app to provide its own metadata store,\n// replacing a wholesale re-provision of `TinkerableContext` in app code.\nexport * from './metadataSource';\n// The deprecated injected-bundler adapters, re-exported so their deprecation notices\n// are visible in the published docs (R3-278; the window only narrows).\nexport { getInjectedMetadataEmitter, getInjectedMetadataSnapshot } from './injectedBundler';\nexport * from './auth';\nexport * from './theme';\nexport { Prose } from './components/Prose';\nexport { PROSE_CLASS } from './proseStyles';\nexport * from './editorContext';\nexport * from './editor';\nexport * from './formFactor';\nexport * from './chromeState';\nexport * from './workspace';\nexport * from './hostAttention';\nexport * from './region';\n// R3-708 — the spaces mode's route channel and its one navigation verb.\nexport * from './spacesMode';\nexport * from './mounts';\nexport * from './analytics';\nexport * from './contribute';\nexport * from './catalog';\nexport * from './ipc';\nexport * from './dnd';\nexport * from './netFetch';\nexport * from './feed';\nexport * from './secrets';\nexport * from './recents'; // R3-485: the gated recent-projects read (page.home)\nexport * from './openRepository'; // R3-476: host-mediated open-in-a-new-tab (route:read)\nexport * from './openExternal'; // R3-619: host-brokered outward-link open (link:open)\nexport * from './openBundle'; // host-mediated open of a bundle in its own tab\nexport * from './llm';\nexport * from './diagnostics';\nexport * from './vcs';\nexport * from './onFsChange';\nexport * from './fs';\nexport * from './debug';\nexport * from './tasks';\nexport * from './launch';\nexport * from './runtime';\nexport * from './irMarkers';\nexport * from './ready';\nexport * from './loading';\nexport * from './dialog';\nexport * from './status';\nexport * from './protocolStream';\nexport * from './protocolDeadline';\nexport * from './sandboxTypes';\nexport * from './safeContent';\n// R3-489 (GROVE_AGENT_SPEC): the embedded-agent seam every app shares — the tool-use\n// loop ported from agent-demo (`runAgent` over the host chat slot), the MDX metadata\n// query tool, the headings index collector, the deixis context block, and the fence\n// for corpus-derived bytes entering a loop.\nexport * from './agentLoop';\nexport * from './agentSteering';\nexport * from './agentPause';\nexport * from './agentChatClient';\nexport * from './metadataQueryTool';\nexport * from './collectHeadings';\nexport * from './agentContext';\nexport * from './fence';\nexport * from './platformLink';\n// R3-627: the per-history-entry scratch, and the scroll restoration built on it —\n// Back lands where the reader left, for however many entries deep they go.\nexport * from './entryState';\nexport * from './useEntryState';\nexport * from './scrollRestore';\nexport { ScrollRestoration, type ScrollRestorationProps } from './components/ScrollRestoration';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAKd,SAAS,mBAAmB;AAC5B,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,wBAAwB;AACjC,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,SAAS,4BAA4B,mCAAmC;AACxE,cAAc;AACd,cAAc;AACd,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAKd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,yBAAsD;","names":[]}
|
package/dist/loading.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(loading_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(loading_exports);
|
|
28
28
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
var import_react = require("react");
|
|
30
|
+
var import_styleElement = require("./styleElement");
|
|
30
31
|
const LOADING_TIMINGS = {
|
|
31
32
|
/** Below this, NO spinner appears — a fast wait never flashes one (§6.2 floor). */
|
|
32
33
|
spinThresholdMs: 150,
|
|
@@ -45,12 +46,7 @@ const STYLE_TEXT = `
|
|
|
45
46
|
@media (prefers-reduced-motion:reduce){.ir-sdk-shim::after{display:none}.ir-sdk-spin{animation:none}}
|
|
46
47
|
`;
|
|
47
48
|
function ensureLoadingStyles() {
|
|
48
|
-
|
|
49
|
-
if (document.getElementById(STYLE_ID)) return;
|
|
50
|
-
const el = document.createElement("style");
|
|
51
|
-
el.id = STYLE_ID;
|
|
52
|
-
el.textContent = STYLE_TEXT;
|
|
53
|
-
document.head.appendChild(el);
|
|
49
|
+
(0, import_styleElement.ensureStyleElement)(STYLE_ID, STYLE_TEXT);
|
|
54
50
|
}
|
|
55
51
|
function useLoadingStyles() {
|
|
56
52
|
(0, import_react.useLayoutEffect)(() => {
|
package/dist/loading.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/loading.tsx"],"sourcesContent":["// In-app loading primitives (LOADING_UX_SPEC §9, Surface E; design brief 19).\n//\n// Opt-in, presentational components an app author drops in for IN-APP waits (a\n// React.lazy chunk, a slow fetch, a pending action) so they match the platform's\n// loading language for free. Per product_values §3 this is convenience — a plain\n// app that ignores it still works.\n//\n// TRUST BOUNDARY (read brief 19): these render INSIDE the app's iframe, under the\n// app's principal — presentational only, NO capability, NO host round-trip. They\n// share the token VOCABULARY (radii, the shimmer sweep, soft placeholder fills)\n// with the host skeletons, but they are deliberately NOT the host's trusted chrome:\n// no reserved landmark, no wordmark, no \"platform is loading\" framing. They use\n// ordinary app a11y (`aria-hidden` for decorative skeletons, `role=\"status\"` for an\n// indeterminate indicator) — never the host's reserved landmark/accessible name\n// (that is the trusted-path control, reserved to the host). An in-app loader that\n// mimicked host chrome would be a spoofing vector.\n//\n// Self-contained: the SDK ships no CSS pipeline, so the keyframes are injected once\n// into the document and everything else is inline styles — zero config for the author.\nimport { useEffect, useLayoutEffect, useState, type CSSProperties, type ReactNode } from 'react';\n\n/** Loading timing constants, matching the host (LOADING_UX_SPEC §3, the 2026-06-22\n * design bundle). Exported so authors who hand-roll still match the platform. */\nexport const LOADING_TIMINGS = {\n /** Below this, NO spinner appears — a fast wait never flashes one (§6.2 floor). */\n spinThresholdMs: 150,\n /** The reveal cross-fade duration the host uses. */\n fadeMs: 150,\n /** One slow shimmer sweep across a placeholder. */\n shimmerMs: 1900,\n} as const;\n\n/** The in-app skeleton archetypes (the same shapes as the host §4.1 catalog). */\nexport type SkeletonArchetype = 'panel.list' | 'panel.tree' | 'panel.editor' | 'panel.conversation' | 'generic';\n\nconst STYLE_ID = 'ir-sdk-loading-styles';\nconst STYLE_TEXT = `\n@keyframes ir-sdk-sweep{0%{transform:translateX(-130%)}60%,100%{transform:translateX(130%)}}\n@keyframes ir-sdk-spin{to{transform:rotate(360deg)}}\n.ir-sdk-shim{position:relative;overflow:hidden}\n.ir-sdk-shim::after{content:\"\";position:absolute;inset:0;background:linear-gradient(100deg,transparent 28%,rgba(127,127,127,.18) 50%,transparent 72%);transform:translateX(-130%);animation:ir-sdk-sweep ${LOADING_TIMINGS.shimmerMs}ms ease-in-out infinite}\n.ir-sdk-spin{animation:ir-sdk-spin .8s linear infinite}\n@media (prefers-reduced-motion:reduce){.ir-sdk-shim::after{display:none}.ir-sdk-spin{animation:none}}\n`;\n\n/** Inject the shimmer/spin keyframes once (idempotent, browser-only). */\nfunction ensureLoadingStyles(): void {\n if (typeof document === 'undefined') return;\n if (document.getElementById(STYLE_ID)) return;\n const el = document.createElement('style');\n el.id = STYLE_ID;\n el.textContent = STYLE_TEXT;\n document.head.appendChild(el);\n}\n\n/** Ensure the loading keyframes exist before the component paints. */\nfunction useLoadingStyles(): void {\n useLayoutEffect(() => {\n ensureLoadingStyles();\n }, []);\n}\n\n// A soft, low-contrast placeholder fill that reads on a light OR dark app surface.\nconst PLACEHOLDER: CSSProperties = {\n background: 'rgba(127,127,127,0.20)',\n borderRadius: 6,\n};\n\n/** A single placeholder bar — compose these into a custom skeleton shape. */\nexport function SkeletonRow({\n width = '100%',\n height = 12,\n style,\n}: {\n width?: number | string;\n height?: number | string;\n style?: CSSProperties;\n}) {\n useLoadingStyles();\n return <div className=\"ir-sdk-shim\" aria-hidden=\"true\" style={{ ...PLACEHOLDER, width, height, ...style }} />;\n}\n\nfunction rows(specs: Array<CSSProperties & { key: number }>): ReactNode {\n return specs.map(({ key, ...s }) => (\n <div key={key} className=\"ir-sdk-shim\" aria-hidden=\"true\" style={{ ...PLACEHOLDER, ...s }} />\n ));\n}\n\n/** A shaped, in-app skeleton matching the host archetypes — for an app's own lazy\n * region (e.g. `<Suspense fallback={<Skeleton archetype=\"panel.list\" />}>`).\n * Decorative (`aria-hidden`); pair it with `aria-busy` on the region it stands in. */\nexport function Skeleton({ archetype = 'generic', style }: { archetype?: SkeletonArchetype; style?: CSSProperties }) {\n useLoadingStyles();\n const wrap: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: 10,\n padding: 12,\n width: '100%',\n boxSizing: 'border-box',\n ...style,\n };\n let body: ReactNode;\n switch (archetype) {\n case 'panel.list':\n body = rows([0, 1, 2, 3, 4].map((key) => ({ key, height: 14 })));\n break;\n case 'panel.tree':\n body = rows([0, 1, 2, 3, 4].map((key) => ({ key, height: 14, marginLeft: (key % 3) * 16 })));\n break;\n case 'panel.editor':\n body = rows([62, 88, 73, 41, 80].map((w, key) => ({ key, height: 11, width: `${w}%` })));\n break;\n case 'panel.conversation':\n body = rows(\n [0, 1, 2, 3].map((key) => ({\n key,\n height: 40,\n width: '70%',\n borderRadius: 12,\n alignSelf: key % 2 ? 'flex-end' : 'flex-start',\n })),\n );\n break;\n case 'generic':\n default:\n body = (\n <>\n <div\n className=\"ir-sdk-shim\"\n aria-hidden=\"true\"\n style={{ ...PLACEHOLDER, height: 16, width: '45%', borderRadius: 4 }}\n />\n {rows([0, 1].map((key) => ({ key, height: 56, borderRadius: 8 })))}\n </>\n );\n }\n return (\n <div aria-hidden=\"true\" style={wrap}>\n {body}\n </div>\n );\n}\n\n/** Become true after `ms`, so a fast wait never flashes an indicator (§6.2 floor). */\nfunction useDelayedFlag(ms: number): boolean {\n const [on, setOn] = useState(false);\n useEffect(() => {\n const t = setTimeout(() => setOn(true), ms);\n return () => clearTimeout(t);\n }, [ms]);\n return on;\n}\n\n/** An indeterminate spinner for waits where a shaped skeleton doesn't fit (a pending\n * button, a small inline fetch). Wired to the host's ~150 ms-before-spin rule: it\n * renders nothing until the threshold, so a fast wait shows no flash. Reduced motion\n * stills the rotation (the ring stays as a static indicator). In-app a11y only. */\nexport function Spinner({\n size = 18,\n thresholdMs = LOADING_TIMINGS.spinThresholdMs,\n label = 'Loading',\n}: {\n size?: number;\n thresholdMs?: number;\n label?: string;\n}) {\n useLoadingStyles();\n const show = useDelayedFlag(thresholdMs);\n if (!show) return null;\n return (\n <span\n className=\"ir-sdk-spin\"\n role=\"status\"\n aria-label={label}\n style={{\n display: 'inline-block',\n width: size,\n height: size,\n border: '2px solid rgba(127,127,127,0.3)',\n borderTopColor: 'currentColor',\n borderRadius: '50%',\n boxSizing: 'border-box',\n }}\n />\n );\n}\n\n/** Wrap an in-app region whose content is still loading: shows a centered spinner\n * (past the 150 ms floor) with `aria-busy`, then reveals `children`. For a shaped\n * wait, pass a `<Skeleton>` as `fallback` instead. App a11y only — not host chrome. */\nexport function LoadingRegion({\n loading,\n fallback,\n label = 'Loading',\n children,\n}: {\n loading: boolean;\n fallback?: ReactNode;\n label?: string;\n children?: ReactNode;\n}) {\n useLoadingStyles();\n if (!loading) return <>{children}</>;\n return (\n <div\n aria-busy=\"true\"\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n minHeight: 48,\n }}\n >\n {fallback ?? <Spinner label={label} />}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+ES;AA5DT,mBAAyF;AAIlF,MAAM,kBAAkB;AAAA;AAAA,EAE7B,iBAAiB;AAAA;AAAA,EAEjB,QAAQ;AAAA;AAAA,EAER,WAAW;AACb;AAKA,MAAM,WAAW;AACjB,MAAM,aAAa;AAAA;AAAA;AAAA;AAAA,2MAIwL,gBAAgB,SAAS;AAAA;AAAA;AAAA;AAMpO,SAAS,sBAA4B;AACnC,MAAI,OAAO,aAAa,YAAa;AACrC,MAAI,SAAS,eAAe,QAAQ,EAAG;AACvC,QAAM,KAAK,SAAS,cAAc,OAAO;AACzC,KAAG,KAAK;AACR,KAAG,cAAc;AACjB,WAAS,KAAK,YAAY,EAAE;AAC9B;AAGA,SAAS,mBAAyB;AAChC,oCAAgB,MAAM;AACpB,wBAAoB;AAAA,EACtB,GAAG,CAAC,CAAC;AACP;AAGA,MAAM,cAA6B;AAAA,EACjC,YAAY;AAAA,EACZ,cAAc;AAChB;AAGO,SAAS,YAAY;AAAA,EAC1B,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AACF,GAIG;AACD,mBAAiB;AACjB,SAAO,4CAAC,SAAI,WAAU,eAAc,eAAY,QAAO,OAAO,EAAE,GAAG,aAAa,OAAO,QAAQ,GAAG,MAAM,GAAG;AAC7G;AAEA,SAAS,KAAK,OAA0D;AACtE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AEC,sBAAY,4CAAC,WAAQ,OAAc;AAAA;AAAA,EACtC;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/loading.tsx"],"sourcesContent":["// In-app loading primitives (LOADING_UX_SPEC §9, Surface E; design brief 19).\n//\n// Opt-in, presentational components an app author drops in for IN-APP waits (a\n// React.lazy chunk, a slow fetch, a pending action) so they match the platform's\n// loading language for free. Per product_values §3 this is convenience — a plain\n// app that ignores it still works.\n//\n// TRUST BOUNDARY (read brief 19): these render INSIDE the app's iframe, under the\n// app's principal — presentational only, NO capability, NO host round-trip. They\n// share the token VOCABULARY (radii, the shimmer sweep, soft placeholder fills)\n// with the host skeletons, but they are deliberately NOT the host's trusted chrome:\n// no reserved landmark, no wordmark, no \"platform is loading\" framing. They use\n// ordinary app a11y (`aria-hidden` for decorative skeletons, `role=\"status\"` for an\n// indeterminate indicator) — never the host's reserved landmark/accessible name\n// (that is the trusted-path control, reserved to the host). An in-app loader that\n// mimicked host chrome would be a spoofing vector.\n//\n// Self-contained: the SDK ships no CSS pipeline, so the keyframes are injected once\n// into the document and everything else is inline styles — zero config for the author.\nimport { useEffect, useLayoutEffect, useState, type CSSProperties, type ReactNode } from 'react';\nimport { ensureStyleElement } from './styleElement';\n\n/** Loading timing constants, matching the host (LOADING_UX_SPEC §3, the 2026-06-22\n * design bundle). Exported so authors who hand-roll still match the platform. */\nexport const LOADING_TIMINGS = {\n /** Below this, NO spinner appears — a fast wait never flashes one (§6.2 floor). */\n spinThresholdMs: 150,\n /** The reveal cross-fade duration the host uses. */\n fadeMs: 150,\n /** One slow shimmer sweep across a placeholder. */\n shimmerMs: 1900,\n} as const;\n\n/** The in-app skeleton archetypes (the same shapes as the host §4.1 catalog). */\nexport type SkeletonArchetype = 'panel.list' | 'panel.tree' | 'panel.editor' | 'panel.conversation' | 'generic';\n\nconst STYLE_ID = 'ir-sdk-loading-styles';\nconst STYLE_TEXT = `\n@keyframes ir-sdk-sweep{0%{transform:translateX(-130%)}60%,100%{transform:translateX(130%)}}\n@keyframes ir-sdk-spin{to{transform:rotate(360deg)}}\n.ir-sdk-shim{position:relative;overflow:hidden}\n.ir-sdk-shim::after{content:\"\";position:absolute;inset:0;background:linear-gradient(100deg,transparent 28%,rgba(127,127,127,.18) 50%,transparent 72%);transform:translateX(-130%);animation:ir-sdk-sweep ${LOADING_TIMINGS.shimmerMs}ms ease-in-out infinite}\n.ir-sdk-spin{animation:ir-sdk-spin .8s linear infinite}\n@media (prefers-reduced-motion:reduce){.ir-sdk-shim::after{display:none}.ir-sdk-spin{animation:none}}\n`;\n\n/** Inject the shimmer/spin keyframes once (idempotent, browser-only). */\nfunction ensureLoadingStyles(): void {\n ensureStyleElement(STYLE_ID, STYLE_TEXT);\n}\n\n/** Ensure the loading keyframes exist before the component paints. */\nfunction useLoadingStyles(): void {\n useLayoutEffect(() => {\n ensureLoadingStyles();\n }, []);\n}\n\n// A soft, low-contrast placeholder fill that reads on a light OR dark app surface.\nconst PLACEHOLDER: CSSProperties = {\n background: 'rgba(127,127,127,0.20)',\n borderRadius: 6,\n};\n\n/** A single placeholder bar — compose these into a custom skeleton shape. */\nexport function SkeletonRow({\n width = '100%',\n height = 12,\n style,\n}: {\n width?: number | string;\n height?: number | string;\n style?: CSSProperties;\n}) {\n useLoadingStyles();\n return <div className=\"ir-sdk-shim\" aria-hidden=\"true\" style={{ ...PLACEHOLDER, width, height, ...style }} />;\n}\n\nfunction rows(specs: Array<CSSProperties & { key: number }>): ReactNode {\n return specs.map(({ key, ...s }) => (\n <div key={key} className=\"ir-sdk-shim\" aria-hidden=\"true\" style={{ ...PLACEHOLDER, ...s }} />\n ));\n}\n\n/** A shaped, in-app skeleton matching the host archetypes — for an app's own lazy\n * region (e.g. `<Suspense fallback={<Skeleton archetype=\"panel.list\" />}>`).\n * Decorative (`aria-hidden`); pair it with `aria-busy` on the region it stands in. */\nexport function Skeleton({ archetype = 'generic', style }: { archetype?: SkeletonArchetype; style?: CSSProperties }) {\n useLoadingStyles();\n const wrap: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: 10,\n padding: 12,\n width: '100%',\n boxSizing: 'border-box',\n ...style,\n };\n let body: ReactNode;\n switch (archetype) {\n case 'panel.list':\n body = rows([0, 1, 2, 3, 4].map((key) => ({ key, height: 14 })));\n break;\n case 'panel.tree':\n body = rows([0, 1, 2, 3, 4].map((key) => ({ key, height: 14, marginLeft: (key % 3) * 16 })));\n break;\n case 'panel.editor':\n body = rows([62, 88, 73, 41, 80].map((w, key) => ({ key, height: 11, width: `${w}%` })));\n break;\n case 'panel.conversation':\n body = rows(\n [0, 1, 2, 3].map((key) => ({\n key,\n height: 40,\n width: '70%',\n borderRadius: 12,\n alignSelf: key % 2 ? 'flex-end' : 'flex-start',\n })),\n );\n break;\n case 'generic':\n default:\n body = (\n <>\n <div\n className=\"ir-sdk-shim\"\n aria-hidden=\"true\"\n style={{ ...PLACEHOLDER, height: 16, width: '45%', borderRadius: 4 }}\n />\n {rows([0, 1].map((key) => ({ key, height: 56, borderRadius: 8 })))}\n </>\n );\n }\n return (\n <div aria-hidden=\"true\" style={wrap}>\n {body}\n </div>\n );\n}\n\n/** Become true after `ms`, so a fast wait never flashes an indicator (§6.2 floor). */\nfunction useDelayedFlag(ms: number): boolean {\n const [on, setOn] = useState(false);\n useEffect(() => {\n const t = setTimeout(() => setOn(true), ms);\n return () => clearTimeout(t);\n }, [ms]);\n return on;\n}\n\n/** An indeterminate spinner for waits where a shaped skeleton doesn't fit (a pending\n * button, a small inline fetch). Wired to the host's ~150 ms-before-spin rule: it\n * renders nothing until the threshold, so a fast wait shows no flash. Reduced motion\n * stills the rotation (the ring stays as a static indicator). In-app a11y only. */\nexport function Spinner({\n size = 18,\n thresholdMs = LOADING_TIMINGS.spinThresholdMs,\n label = 'Loading',\n}: {\n size?: number;\n thresholdMs?: number;\n label?: string;\n}) {\n useLoadingStyles();\n const show = useDelayedFlag(thresholdMs);\n if (!show) return null;\n return (\n <span\n className=\"ir-sdk-spin\"\n role=\"status\"\n aria-label={label}\n style={{\n display: 'inline-block',\n width: size,\n height: size,\n border: '2px solid rgba(127,127,127,0.3)',\n borderTopColor: 'currentColor',\n borderRadius: '50%',\n boxSizing: 'border-box',\n }}\n />\n );\n}\n\n/** Wrap an in-app region whose content is still loading: shows a centered spinner\n * (past the 150 ms floor) with `aria-busy`, then reveals `children`. For a shaped\n * wait, pass a `<Skeleton>` as `fallback` instead. App a11y only — not host chrome. */\nexport function LoadingRegion({\n loading,\n fallback,\n label = 'Loading',\n children,\n}: {\n loading: boolean;\n fallback?: ReactNode;\n label?: string;\n children?: ReactNode;\n}) {\n useLoadingStyles();\n if (!loading) return <>{children}</>;\n return (\n <div\n aria-busy=\"true\"\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n minHeight: 48,\n }}\n >\n {fallback ?? <Spinner label={label} />}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2ES;AAxDT,mBAAyF;AACzF,0BAAmC;AAI5B,MAAM,kBAAkB;AAAA;AAAA,EAE7B,iBAAiB;AAAA;AAAA,EAEjB,QAAQ;AAAA;AAAA,EAER,WAAW;AACb;AAKA,MAAM,WAAW;AACjB,MAAM,aAAa;AAAA;AAAA;AAAA;AAAA,2MAIwL,gBAAgB,SAAS;AAAA;AAAA;AAAA;AAMpO,SAAS,sBAA4B;AACnC,8CAAmB,UAAU,UAAU;AACzC;AAGA,SAAS,mBAAyB;AAChC,oCAAgB,MAAM;AACpB,wBAAoB;AAAA,EACtB,GAAG,CAAC,CAAC;AACP;AAGA,MAAM,cAA6B;AAAA,EACjC,YAAY;AAAA,EACZ,cAAc;AAChB;AAGO,SAAS,YAAY;AAAA,EAC1B,QAAQ;AAAA,EACR,SAAS;AAAA,EACT;AACF,GAIG;AACD,mBAAiB;AACjB,SAAO,4CAAC,SAAI,WAAU,eAAc,eAAY,Q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YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,WAAW;AAAA,MACb;AAAA,MAEC,sBAAY,4CAAC,WAAQ,OAAc;AAAA;AAAA,EACtC;AAEJ;","names":[]}
|
package/dist/loading.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./chunk-VHAA22YE.js";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useLayoutEffect, useState } from "react";
|
|
4
|
+
import { ensureStyleElement } from "./styleElement.js";
|
|
4
5
|
const LOADING_TIMINGS = {
|
|
5
6
|
/** Below this, NO spinner appears — a fast wait never flashes one (§6.2 floor). */
|
|
6
7
|
spinThresholdMs: 150,
|
|
@@ -19,12 +20,7 @@ const STYLE_TEXT = `
|
|
|
19
20
|
@media (prefers-reduced-motion:reduce){.ir-sdk-shim::after{display:none}.ir-sdk-spin{animation:none}}
|
|
20
21
|
`;
|
|
21
22
|
function ensureLoadingStyles() {
|
|
22
|
-
|
|
23
|
-
if (document.getElementById(STYLE_ID)) return;
|
|
24
|
-
const el = document.createElement("style");
|
|
25
|
-
el.id = STYLE_ID;
|
|
26
|
-
el.textContent = STYLE_TEXT;
|
|
27
|
-
document.head.appendChild(el);
|
|
23
|
+
ensureStyleElement(STYLE_ID, STYLE_TEXT);
|
|
28
24
|
}
|
|
29
25
|
function useLoadingStyles() {
|
|
30
26
|
useLayoutEffect(() => {
|