@immediately-run/sdk 0.68.0 → 0.68.2
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.cjs +4 -3
- package/dist/components/MDXComponents.cjs.map +1 -1
- package/dist/components/MDXComponents.js +14 -13
- package/dist/components/MDXComponents.js.map +1 -1
- 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.cjs +4 -3
- package/dist/components/WikiLink.cjs.map +1 -1
- package/dist/components/WikiLink.js +9 -8
- package/dist/components/WikiLink.js.map +1 -1
- 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/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.js +1 -1
- package/dist/hooks.js +2 -2
- package/dist/hostAttention.js +2 -2
- package/dist/hostTransport.js +1 -1
- package/dist/index.js +65 -65
- package/dist/ipc.js +3 -3
- package/dist/launch.js +3 -3
- package/dist/linkSpace.cjs +1 -1
- package/dist/linkSpace.cjs.map +1 -1
- package/dist/linkSpace.d.cts +8 -3
- package/dist/linkSpace.d.ts +8 -3
- package/dist/linkSpace.js +1 -1
- package/dist/linkSpace.js.map +1 -1
- 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.js +7 -7
- 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/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 +4 -3
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,
|
|
@@ -44,11 +44,12 @@ const DEFAULT_MDX_COMPONENTS = {
|
|
|
44
44
|
children,
|
|
45
45
|
...properties
|
|
46
46
|
}) {
|
|
47
|
-
const
|
|
47
|
+
const space = (0, import_react.use)(import_linkSpace.LinkSpaceContext);
|
|
48
|
+
const bundleRoot = space.bundleRoot !== void 0 ? space.bundleRoot : space.corpusRoot ?? null;
|
|
48
49
|
let mapped = href;
|
|
49
|
-
if (href && (href.startsWith(import_linkSpace.FS_PREFIX) ||
|
|
50
|
+
if (href && (href.startsWith(import_linkSpace.FS_PREFIX) || bundleRoot !== null && href.startsWith("/"))) {
|
|
50
51
|
const [pathPart, frag] = (0, import_urlUtils.splitHash)(href);
|
|
51
|
-
const resolution = (0, import_linkSpace.resolveLinkTarget)(pathPart, {
|
|
52
|
+
const resolution = (0, import_linkSpace.resolveLinkTarget)(pathPart, { bundleRoot });
|
|
52
53
|
if (resolution.state !== "resolved") {
|
|
53
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ir-link-broken", "data-state": "broken", title: `Invalid ${import_linkSpace.FS_PREFIX} link: ${href}`, children });
|
|
54
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Admonition } from './Admonition';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\nimport { splitHash } from '../urlUtils';\nimport { HeadingAnchor } from './HeadingAnchor';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { HeadingAnchor } from './HeadingAnchor';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n // R3-273 link spaces, same shared resolver as WikiLink: an `$fs:` href is\n // translated to its mount-absolute path; an ABSOLUTE href is
|
|
1
|
+
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Admonition } from './Admonition';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\nimport { splitHash } from '../urlUtils';\nimport { HeadingAnchor } from './HeadingAnchor';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { HeadingAnchor } from './HeadingAnchor';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n // R3-273 link spaces, same shared resolver as WikiLink: an `$fs:` href is\n // translated to its mount-absolute path; an ABSOLUTE href is bundle-rooted\n // when an enclosing LinkSpaceContext declares a bundleRoot (a non-bundle app\n // declares none and is untouched). Relative and external hrefs pass through —\n // <Link> already routes same-app hrefs and renders the rest as plain anchors.\n // R3-482: new-then-old root read — twin of WikiLink's, same presence rule as\n // mdx-plugins' statedBundleRoot (explicit `bundleRoot: null` is a VALUE).\n const space = use(LinkSpaceContext);\n const bundleRoot = space.bundleRoot !== undefined ? space.bundleRoot : space.corpusRoot ?? null;\n let mapped = href;\n if (href && (href.startsWith(FS_PREFIX) || (bundleRoot !== null && href.startsWith('/')))) {\n const [pathPart, frag] = splitHash(href);\n const resolution = resolveLinkTarget(pathPart, { bundleRoot });\n if (resolution.state !== 'resolved') {\n // Malformed `$fs:` (incl. scheme smuggling) — broken text, never an anchor.\n return (\n <span className=\"ir-link-broken\" data-state=\"broken\" title={`Invalid ${FS_PREFIX} link: ${href}`}>\n {children}\n </span>\n );\n }\n mapped = `${resolution.path}${frag ? `#${frag}` : ''}`;\n }\n return (\n <Link href={mapped} {...properties}>\n {children}\n </Link>\n );\n },\n Admonition,\n HeadingAnchor,\n WikiLink,\n} as Record<string, (props: any) => ReactNode>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CU;AA/CV,mBAA+B;AAC/B,wBAA2B;AAC3B,uBAA+D;AAC/D,sBAA0B;AAC1B,2BAA8B;AAC9B,kBAAqB;AACrB,sBAAyB;AAKzB,IAAAA,eAAmC;AACnC,IAAAC,qBAA2B;AAE3B,IAAAC,wBAA8B;AAC9B,IAAAC,mBAAyB;AAUlB,MAAM,yBAAyB;AAAA,EACpC,EAAE;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAA8F;AAQ5F,UAAM,YAAQ,kBAAI,iCAAgB;AAClC,UAAM,aAAa,MAAM,eAAe,SAAY,MAAM,aAAa,MAAM,cAAc;AAC3F,QAAI,SAAS;AACb,QAAI,SAAS,KAAK,WAAW,0BAAS,KAAM,eAAe,QAAQ,KAAK,WAAW,GAAG,IAAK;AACzF,YAAM,CAAC,UAAU,IAAI,QAAI,2BAAU,IAAI;AACvC,YAAM,iBAAa,oCAAkB,UAAU,EAAE,WAAW,CAAC;AAC7D,UAAI,WAAW,UAAU,YAAY;AAEnC,eACE,4CAAC,UAAK,WAAU,kBAAiB,cAAW,UAAS,OAAO,WAAW,0BAAS,UAAU,IAAI,IAC3F,UACH;AAAA,MAEJ;AACA,eAAS,GAAG,WAAW,IAAI,GAAG,OAAO,IAAI,IAAI,KAAK,EAAE;AAAA,IACtD;AACA,WACE,4CAAC,oBAAK,MAAM,QAAS,GAAG,YACrB,UACH;AAAA,EAEJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["import_Link","import_Admonition","import_HeadingAnchor","import_WikiLink"]}
|
|
@@ -1,27 +1,28 @@
|
|
|
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,
|
|
17
17
|
children,
|
|
18
18
|
...properties
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
20
|
+
const space = use(LinkSpaceContext);
|
|
21
|
+
const bundleRoot = space.bundleRoot !== void 0 ? space.bundleRoot : space.corpusRoot ?? null;
|
|
21
22
|
let mapped = href;
|
|
22
|
-
if (href && (href.startsWith(FS_PREFIX) ||
|
|
23
|
+
if (href && (href.startsWith(FS_PREFIX) || bundleRoot !== null && href.startsWith("/"))) {
|
|
23
24
|
const [pathPart, frag] = splitHash(href);
|
|
24
|
-
const resolution = resolveLinkTarget(pathPart, {
|
|
25
|
+
const resolution = resolveLinkTarget(pathPart, { bundleRoot });
|
|
25
26
|
if (resolution.state !== "resolved") {
|
|
26
27
|
return /* @__PURE__ */ jsx("span", { className: "ir-link-broken", "data-state": "broken", title: `Invalid ${FS_PREFIX} link: ${href}`, children });
|
|
27
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Admonition } from './Admonition';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\nimport { splitHash } from '../urlUtils';\nimport { HeadingAnchor } from './HeadingAnchor';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { HeadingAnchor } from './HeadingAnchor';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n // R3-273 link spaces, same shared resolver as WikiLink: an `$fs:` href is\n // translated to its mount-absolute path; an ABSOLUTE href is
|
|
1
|
+
{"version":3,"sources":["../../src/components/MDXComponents.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Admonition } from './Admonition';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\nimport { splitHash } from '../urlUtils';\nimport { HeadingAnchor } from './HeadingAnchor';\nimport { Link } from './Link';\nimport { WikiLink } from './WikiLink';\n\n// The link primitives moved to ./Link so WikiLink can reuse Link without a\n// MDXComponents ↔ WikiLink import cycle (check:circular). Re-exported here so the\n// public `Link` / `InternalLink` entry points are unchanged.\nexport { InternalLink, Link } from './Link';\nexport { Admonition } from './Admonition';\nexport type { AdmonitionType } from './Admonition';\nexport { HeadingAnchor } from './HeadingAnchor';\nexport { WikiLink } from './WikiLink';\n\n/** Default MDX component overrides passed to {@link MDXProvider} by `boot`. These\n * are the platform's *phantom defaults* (MARKDOWN_SYNTAX_SPEC §11.2): they are\n * always present in the provider — even for a plain-markdown repo that never\n * calls `boot({ mdxComponents })` — so the platform-emitted `Admonition` (§12)\n * and `WikiLink` (§13) components resolve without the MDX missing-reference guard\n * firing, and Markdown links route in-app via {@link Link}. An app overrides any\n * of them by name via `boot({ mdxComponents })`, which *merges* over these\n * defaults (§11.3) — overriding `WikiLink` alone still keeps `a` and `Admonition`. */\nexport const DEFAULT_MDX_COMPONENTS = {\n a({\n href,\n children,\n ...properties\n }: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) {\n // R3-273 link spaces, same shared resolver as WikiLink: an `$fs:` href is\n // translated to its mount-absolute path; an ABSOLUTE href is bundle-rooted\n // when an enclosing LinkSpaceContext declares a bundleRoot (a non-bundle app\n // declares none and is untouched). Relative and external hrefs pass through —\n // <Link> already routes same-app hrefs and renders the rest as plain anchors.\n // R3-482: new-then-old root read — twin of WikiLink's, same presence rule as\n // mdx-plugins' statedBundleRoot (explicit `bundleRoot: null` is a VALUE).\n const space = use(LinkSpaceContext);\n const bundleRoot = space.bundleRoot !== undefined ? space.bundleRoot : space.corpusRoot ?? null;\n let mapped = href;\n if (href && (href.startsWith(FS_PREFIX) || (bundleRoot !== null && href.startsWith('/')))) {\n const [pathPart, frag] = splitHash(href);\n const resolution = resolveLinkTarget(pathPart, { bundleRoot });\n if (resolution.state !== 'resolved') {\n // Malformed `$fs:` (incl. scheme smuggling) — broken text, never an anchor.\n return (\n <span className=\"ir-link-broken\" data-state=\"broken\" title={`Invalid ${FS_PREFIX} link: ${href}`}>\n {children}\n </span>\n );\n }\n mapped = `${resolution.path}${frag ? `#${frag}` : ''}`;\n }\n return (\n <Link href={mapped} {...properties}>\n {children}\n </Link>\n );\n },\n Admonition,\n HeadingAnchor,\n WikiLink,\n} as Record<string, (props: any) => ReactNode>;\n"],"mappings":";AA+CU;AA/CV,SAAoB,WAAW;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,WAAW,kBAAkB,yBAAyB;AAC/D,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAKzB,SAAS,cAAc,QAAAA,aAAY;AACnC,SAAS,cAAAC,mBAAkB;AAE3B,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,YAAAC,iBAAgB;AAUlB,MAAM,yBAAyB;AAAA,EACpC,EAAE;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAA8F;AAQ5F,UAAM,QAAQ,IAAI,gBAAgB;AAClC,UAAM,aAAa,MAAM,eAAe,SAAY,MAAM,aAAa,MAAM,cAAc;AAC3F,QAAI,SAAS;AACb,QAAI,SAAS,KAAK,WAAW,SAAS,KAAM,eAAe,QAAQ,KAAK,WAAW,GAAG,IAAK;AACzF,YAAM,CAAC,UAAU,IAAI,IAAI,UAAU,IAAI;AACvC,YAAM,aAAa,kBAAkB,UAAU,EAAE,WAAW,CAAC;AAC7D,UAAI,WAAW,UAAU,YAAY;AAEnC,eACE,oBAAC,UAAK,WAAU,kBAAiB,cAAW,UAAS,OAAO,WAAW,SAAS,UAAU,IAAI,IAC3F,UACH;AAAA,MAEJ;AACA,eAAS,GAAG,WAAW,IAAI,GAAG,OAAO,IAAI,IAAI,KAAK,EAAE;AAAA,IACtD;AACA,WACE,oBAAC,QAAK,MAAM,QAAS,GAAG,YACrB,UACH;AAAA,EAEJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["Link","Admonition","HeadingAnchor","WikiLink"]}
|
|
@@ -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;
|
|
@@ -39,7 +39,8 @@ const WikiLink = ({
|
|
|
39
39
|
...rest
|
|
40
40
|
}) => {
|
|
41
41
|
const { filesMetadata } = (0, import_react.use)(import_TinkerableContext.TinkerableContext);
|
|
42
|
-
const
|
|
42
|
+
const space = (0, import_react.use)(import_linkSpace.LinkSpaceContext);
|
|
43
|
+
const bundleRoot = space.bundleRoot !== void 0 ? space.bundleRoot : space.corpusRoot ?? null;
|
|
43
44
|
const renderContext = (0, import_react.use)(import_Include.RenderExportedComponentContext);
|
|
44
45
|
const currentFile = renderContext?.evaluationContext?.evaluation?.module?.filepath;
|
|
45
46
|
const rawTarget = target ?? "";
|
|
@@ -51,7 +52,7 @@ const WikiLink = ({
|
|
|
51
52
|
if (pathPart === "" && frag) {
|
|
52
53
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Link.Link, { href: `#${frag}`, className: "ir-wikilink", "data-state": "anchor", ...rest, children: text });
|
|
53
54
|
}
|
|
54
|
-
const resolution = (0, import_linkSpace.resolveLinkTarget)(pathPart, { currentFile,
|
|
55
|
+
const resolution = (0, import_linkSpace.resolveLinkTarget)(pathPart, { currentFile, bundleRoot });
|
|
55
56
|
if (resolution.state === "invalid") {
|
|
56
57
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
58
|
"span",
|
|
@@ -79,7 +80,7 @@ const WikiLink = ({
|
|
|
79
80
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ir-wikilink ir-wikilink-broken", "data-state": "broken", title: `No file at ${resolved}`, ...rest, children: text });
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
const translated = pathPart.startsWith(import_linkSpace.FS_PREFIX) ||
|
|
83
|
+
const translated = pathPart.startsWith(import_linkSpace.FS_PREFIX) || bundleRoot !== null && pathPart.startsWith("/");
|
|
83
84
|
const href = translated && resolved !== void 0 ? `${resolved}${frag ? `#${frag}` : ""}` : rawTarget;
|
|
84
85
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Link.Link, { href, className: "ir-wikilink", "data-state": "resolved", ...rest, children: text });
|
|
85
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/WikiLink.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Link } from './Link';\nimport { RenderExportedComponentContext } from './Include';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { splitHash } from '../urlUtils';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\n\n/** Derive a human label from a target path: basename without the extension. */\nconst labelFromTarget = (target: string): string => {\n const base = target.split(/[\\\\/]/).pop() ?? target;\n return base.replace(/\\.mdx?$/i, '') || target;\n};\n\n/**\n * Default MDX `WikiLink` component — the render target for the `[[target]]` /\n * `[[label|target]]` wiki-link syntax. The transpiler remark plugin (R3-153)\n * compiles that syntax to `<WikiLink target=\"…\" label=\"…\">`, carrying the raw\n * target/label verbatim; **resolution lives here** (MARKDOWN_SYNTAX_SPEC §13.2).\n *\n * Registered in {@link DEFAULT_MDX_COMPONENTS} so wiki-links render even in a\n * plain-markdown repo (§11.2 phantom defaults). Targets are **paths only** —\n * relative (resolved against the current file's directory) or absolute — with\n * **no implicit search path** (§13.3, a deliberate departure from Obsidian).\n *\n * The **current file** — the one the link is *authored in* — is read from the\n * ambient `<Include>` render context. Every MDX file renders through `<Include>`\n * (`FileRouter` renders even the top-level file that way), and Include publishes\n * the rendered module's `EvaluationContext` to its subtree via\n * {@link RenderExportedComponentContext}; the nearest one's\n * `evaluation.module.filepath` is this file's own `/app/…` path. Because that\n * context nests with each `<Include>`, a relative target inside an included\n * fragment resolves against the **fragment**, not the top-level page in the URL.\n *\n * A target may carry a `#fragment` (`[[FILE.mdx#sec-8-9]]`, `[[#sec-8-9]]`): the\n * fragment is **split off** ({@link splitHash}, §13.5) and existence is resolved on\n * the **fragment-stripped path**, so a section citation to an existing file resolves\n * (not \"broken\"). The fragment then rides to navigation, where the scroll-after-nav\n * effect ({@link useScrollAfterNavigation}) lands the reader on the section.\n *\n * The resolved path is checked for **existence** against the live metadata store\n * (keyed by absolute `/app/…` paths) for the states (§13.3, §13.5):\n * - **anchor** — a fragment with no path (`[[#sec-8-9]]`), or a fragment whose path is\n * the current file: a same-page {@link Link} that scrolls in place, no route change.\n * - **self** — the resolved path is the current file (no fragment): inert text, no link.\n * - **broken** — no file at the resolved path (and the store has loaded): rendered\n * as marked text, **not** a throw.\n * - **resolved** — routed through {@link Link} (in-app navigation for a same-app\n * href, a plain `<a>` otherwise), carrying any `#fragment`.\n *\n * The check is **optimistic until the metadata store loads** (an empty store never\n * flashes \"broken\"), and a relative target with no ambient render context (MDX\n * rendered outside `<Include>`) routes optimistically. Such an app overrides this\n * component (§11) for precise resolution.\n */\nexport const WikiLink = ({\n target,\n label,\n children,\n ...rest\n}: {\n target?: string;\n label?: ReactNode;\n children?: ReactNode;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n const { filesMetadata } = use(TinkerableContext);\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/WikiLink.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Link } from './Link';\nimport { RenderExportedComponentContext } from './Include';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { splitHash } from '../urlUtils';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\n\n/** Derive a human label from a target path: basename without the extension. */\nconst labelFromTarget = (target: string): string => {\n const base = target.split(/[\\\\/]/).pop() ?? target;\n return base.replace(/\\.mdx?$/i, '') || target;\n};\n\n/**\n * Default MDX `WikiLink` component — the render target for the `[[target]]` /\n * `[[label|target]]` wiki-link syntax. The transpiler remark plugin (R3-153)\n * compiles that syntax to `<WikiLink target=\"…\" label=\"…\">`, carrying the raw\n * target/label verbatim; **resolution lives here** (MARKDOWN_SYNTAX_SPEC §13.2).\n *\n * Registered in {@link DEFAULT_MDX_COMPONENTS} so wiki-links render even in a\n * plain-markdown repo (§11.2 phantom defaults). Targets are **paths only** —\n * relative (resolved against the current file's directory) or absolute — with\n * **no implicit search path** (§13.3, a deliberate departure from Obsidian).\n *\n * The **current file** — the one the link is *authored in* — is read from the\n * ambient `<Include>` render context. Every MDX file renders through `<Include>`\n * (`FileRouter` renders even the top-level file that way), and Include publishes\n * the rendered module's `EvaluationContext` to its subtree via\n * {@link RenderExportedComponentContext}; the nearest one's\n * `evaluation.module.filepath` is this file's own `/app/…` path. Because that\n * context nests with each `<Include>`, a relative target inside an included\n * fragment resolves against the **fragment**, not the top-level page in the URL.\n *\n * A target may carry a `#fragment` (`[[FILE.mdx#sec-8-9]]`, `[[#sec-8-9]]`): the\n * fragment is **split off** ({@link splitHash}, §13.5) and existence is resolved on\n * the **fragment-stripped path**, so a section citation to an existing file resolves\n * (not \"broken\"). The fragment then rides to navigation, where the scroll-after-nav\n * effect ({@link useScrollAfterNavigation}) lands the reader on the section.\n *\n * The resolved path is checked for **existence** against the live metadata store\n * (keyed by absolute `/app/…` paths) for the states (§13.3, §13.5):\n * - **anchor** — a fragment with no path (`[[#sec-8-9]]`), or a fragment whose path is\n * the current file: a same-page {@link Link} that scrolls in place, no route change.\n * - **self** — the resolved path is the current file (no fragment): inert text, no link.\n * - **broken** — no file at the resolved path (and the store has loaded): rendered\n * as marked text, **not** a throw.\n * - **resolved** — routed through {@link Link} (in-app navigation for a same-app\n * href, a plain `<a>` otherwise), carrying any `#fragment`.\n *\n * The check is **optimistic until the metadata store loads** (an empty store never\n * flashes \"broken\"), and a relative target with no ambient render context (MDX\n * rendered outside `<Include>`) routes optimistically. Such an app overrides this\n * component (§11) for precise resolution.\n */\nexport const WikiLink = ({\n target,\n label,\n children,\n ...rest\n}: {\n target?: string;\n label?: ReactNode;\n children?: ReactNode;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n const { filesMetadata } = use(TinkerableContext);\n // R3-482: the link-space root reads new-then-old — `bundleRoot` when the provider\n // states it at all (an explicit `null` is a VALUE: \"no bundle root\", NOT a miss),\n // the deprecated `corpusRoot` spelling only when `bundleRoot` is absent. The same\n // presence rule as mdx-plugins' statedBundleRoot; twin read in MDXComponents.tsx.\n const space = use(LinkSpaceContext);\n const bundleRoot = space.bundleRoot !== undefined ? space.bundleRoot : space.corpusRoot ?? null;\n const renderContext = use(RenderExportedComponentContext);\n const currentFile = renderContext?.evaluationContext?.evaluation?.module?.filepath;\n\n const rawTarget = target ?? '';\n const [pathPart, frag] = splitHash(rawTarget);\n const text = children ?? label ?? (rawTarget ? labelFromTarget(pathPart || frag || rawTarget) : '');\n\n // Defensive: the kernel never emits an empty target, but a hand-written\n // `<WikiLink>` might. Render inert text rather than a link to nowhere.\n if (!rawTarget) {\n return (\n <span className=\"ir-wikilink\" {...rest}>\n {text}\n </span>\n );\n }\n\n // Same-page anchor: a fragment with no path (`[[#sec-8-9]]`). Scroll within the\n // current file — no route change (§13.5). <Link> intercepts a bare `#`-href.\n if (pathPart === '' && frag) {\n return (\n <Link href={`#${frag}`} className=\"ir-wikilink\" data-state=\"anchor\" {...rest}>\n {text}\n </Link>\n );\n }\n\n // R3-273 link spaces: resolution is the SHARED resolver (`linkSpace.ts`) —\n // default space (bundle-rooted absolute targets when an enclosing provider\n // declares a bundleRoot; fs-rooted otherwise) or the explicit `$fs:` prefix.\n // A malformed `$fs:` target renders BROKEN, never an anchor.\n const resolution = resolveLinkTarget(pathPart, { currentFile, bundleRoot });\n if (resolution.state === 'invalid') {\n return (\n <span\n className=\"ir-wikilink ir-wikilink-broken\"\n data-state=\"broken\"\n title={`Invalid ${FS_PREFIX} target: ${pathPart}`}\n {...rest}\n >\n {text}\n </span>\n );\n }\n const resolved = resolution.state === 'resolved' ? resolution.path : undefined;\n const files = filesMetadata ?? {};\n const loaded = Object.keys(files).length > 0;\n\n // `resolved === undefined` ⇒ a relative target with no known current file: route\n // it optimistically (can't check existence or self-ness generically).\n if (resolved !== undefined) {\n if (currentFile && resolved === currentFile) {\n // The target IS this file. With a fragment it is a same-page anchor to another\n // of this file's sections; without one it is an inert self-reference.\n if (frag) {\n return (\n <Link href={`#${frag}`} className=\"ir-wikilink\" data-state=\"anchor\" {...rest}>\n {text}\n </Link>\n );\n }\n return (\n <span className=\"ir-wikilink ir-wikilink-self\" data-state=\"self\" {...rest}>\n {text}\n </span>\n );\n }\n // Existence is checked on the FRAGMENT-STRIPPED path (optimistic until loaded).\n const exists = !loaded || resolved in files;\n if (!exists) {\n return (\n <span className=\"ir-wikilink ir-wikilink-broken\" data-state=\"broken\" title={`No file at ${resolved}`} {...rest}>\n {text}\n </span>\n );\n }\n }\n // Resolved cross-file target: route through <Link>. A space-translated target\n // (`$fs:` prefix, or a bundle-rooted absolute) navigates to the RESOLVED path —\n // the raw text is not a routable path in those shapes; everything else carries\n // the raw target bit-for-bit so its `#fragment` rides through navigation to the\n // scroll-after-nav effect (§13.5). The fragment is re-attached either way.\n const translated = pathPart.startsWith(FS_PREFIX) || (bundleRoot !== null && pathPart.startsWith('/'));\n const href = translated && resolved !== undefined ? `${resolved}${frag ? `#${frag}` : ''}` : rawTarget;\n return (\n <Link href={href} className=\"ir-wikilink\" data-state=\"resolved\" {...rest}>\n {text}\n </Link>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkFM;AAlFN,mBAA+B;AAC/B,kBAAqB;AACrB,qBAA+C;AAC/C,+BAAkC;AAClC,sBAA0B;AAC1B,uBAA+D;AAG/D,MAAM,kBAAkB,CAAC,WAA2B;AAClD,QAAM,OAAO,OAAO,MAAM,OAAO,EAAE,IAAI,KAAK;AAC5C,SAAO,KAAK,QAAQ,YAAY,EAAE,KAAK;AACzC;AA2CO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAI+E;AAC7E,QAAM,EAAE,cAAc,QAAI,kBAAI,0CAAiB;AAK/C,QAAM,YAAQ,kBAAI,iCAAgB;AAClC,QAAM,aAAa,MAAM,eAAe,SAAY,MAAM,aAAa,MAAM,cAAc;AAC3F,QAAM,oBAAgB,kBAAI,6CAA8B;AACxD,QAAM,cAAc,eAAe,mBAAmB,YAAY,QAAQ;AAE1E,QAAM,YAAY,UAAU;AAC5B,QAAM,CAAC,UAAU,IAAI,QAAI,2BAAU,SAAS;AAC5C,QAAM,OAAO,YAAY,UAAU,YAAY,gBAAgB,YAAY,QAAQ,SAAS,IAAI;AAIhG,MAAI,CAAC,WAAW;AACd,WACE,4CAAC,UAAK,WAAU,eAAe,GAAG,MAC/B,gBACH;AAAA,EAEJ;AAIA,MAAI,aAAa,MAAM,MAAM;AAC3B,WACE,4CAAC,oBAAK,MAAM,IAAI,IAAI,IAAI,WAAU,eAAc,cAAW,UAAU,GAAG,MACrE,gBACH;AAAA,EAEJ;AAMA,QAAM,iBAAa,oCAAkB,UAAU,EAAE,aAAa,WAAW,CAAC;AAC1E,MAAI,WAAW,UAAU,WAAW;AAClC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,cAAW;AAAA,QACX,OAAO,WAAW,0BAAS,YAAY,QAAQ;AAAA,QAC9C,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACA,QAAM,WAAW,WAAW,UAAU,aAAa,WAAW,OAAO;AACrE,QAAM,QAAQ,iBAAiB,CAAC;AAChC,QAAM,SAAS,OAAO,KAAK,KAAK,EAAE,SAAS;AAI3C,MAAI,aAAa,QAAW;AAC1B,QAAI,eAAe,aAAa,aAAa;AAG3C,UAAI,MAAM;AACR,eACE,4CAAC,oBAAK,MAAM,IAAI,IAAI,IAAI,WAAU,eAAc,cAAW,UAAU,GAAG,MACrE,gBACH;AAAA,MAEJ;AACA,aACE,4CAAC,UAAK,WAAU,gCAA+B,cAAW,QAAQ,GAAG,MAClE,gBACH;AAAA,IAEJ;AAEA,UAAM,SAAS,CAAC,UAAU,YAAY;AACtC,QAAI,CAAC,QAAQ;AACX,aACE,4CAAC,UAAK,WAAU,kCAAiC,cAAW,UAAS,OAAO,cAAc,QAAQ,IAAK,GAAG,MACvG,gBACH;AAAA,IAEJ;AAAA,EACF;AAMA,QAAM,aAAa,SAAS,WAAW,0BAAS,KAAM,eAAe,QAAQ,SAAS,WAAW,GAAG;AACpG,QAAM,OAAO,cAAc,aAAa,SAAY,GAAG,QAAQ,GAAG,OAAO,IAAI,IAAI,KAAK,EAAE,KAAK;AAC7F,SACE,4CAAC,oBAAK,MAAY,WAAU,eAAc,cAAW,YAAY,GAAG,MACjE,gBACH;AAEJ;","names":[]}
|
|
@@ -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;
|
|
@@ -17,7 +17,8 @@ const WikiLink = ({
|
|
|
17
17
|
...rest
|
|
18
18
|
}) => {
|
|
19
19
|
const { filesMetadata } = use(TinkerableContext);
|
|
20
|
-
const
|
|
20
|
+
const space = use(LinkSpaceContext);
|
|
21
|
+
const bundleRoot = space.bundleRoot !== void 0 ? space.bundleRoot : space.corpusRoot ?? null;
|
|
21
22
|
const renderContext = use(RenderExportedComponentContext);
|
|
22
23
|
const currentFile = renderContext?.evaluationContext?.evaluation?.module?.filepath;
|
|
23
24
|
const rawTarget = target ?? "";
|
|
@@ -29,7 +30,7 @@ const WikiLink = ({
|
|
|
29
30
|
if (pathPart === "" && frag) {
|
|
30
31
|
return /* @__PURE__ */ jsx(Link, { href: `#${frag}`, className: "ir-wikilink", "data-state": "anchor", ...rest, children: text });
|
|
31
32
|
}
|
|
32
|
-
const resolution = resolveLinkTarget(pathPart, { currentFile,
|
|
33
|
+
const resolution = resolveLinkTarget(pathPart, { currentFile, bundleRoot });
|
|
33
34
|
if (resolution.state === "invalid") {
|
|
34
35
|
return /* @__PURE__ */ jsx(
|
|
35
36
|
"span",
|
|
@@ -57,7 +58,7 @@ const WikiLink = ({
|
|
|
57
58
|
return /* @__PURE__ */ jsx("span", { className: "ir-wikilink ir-wikilink-broken", "data-state": "broken", title: `No file at ${resolved}`, ...rest, children: text });
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
const translated = pathPart.startsWith(FS_PREFIX) ||
|
|
61
|
+
const translated = pathPart.startsWith(FS_PREFIX) || bundleRoot !== null && pathPart.startsWith("/");
|
|
61
62
|
const href = translated && resolved !== void 0 ? `${resolved}${frag ? `#${frag}` : ""}` : rawTarget;
|
|
62
63
|
return /* @__PURE__ */ jsx(Link, { href, className: "ir-wikilink", "data-state": "resolved", ...rest, children: text });
|
|
63
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/WikiLink.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Link } from './Link';\nimport { RenderExportedComponentContext } from './Include';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { splitHash } from '../urlUtils';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\n\n/** Derive a human label from a target path: basename without the extension. */\nconst labelFromTarget = (target: string): string => {\n const base = target.split(/[\\\\/]/).pop() ?? target;\n return base.replace(/\\.mdx?$/i, '') || target;\n};\n\n/**\n * Default MDX `WikiLink` component — the render target for the `[[target]]` /\n * `[[label|target]]` wiki-link syntax. The transpiler remark plugin (R3-153)\n * compiles that syntax to `<WikiLink target=\"…\" label=\"…\">`, carrying the raw\n * target/label verbatim; **resolution lives here** (MARKDOWN_SYNTAX_SPEC §13.2).\n *\n * Registered in {@link DEFAULT_MDX_COMPONENTS} so wiki-links render even in a\n * plain-markdown repo (§11.2 phantom defaults). Targets are **paths only** —\n * relative (resolved against the current file's directory) or absolute — with\n * **no implicit search path** (§13.3, a deliberate departure from Obsidian).\n *\n * The **current file** — the one the link is *authored in* — is read from the\n * ambient `<Include>` render context. Every MDX file renders through `<Include>`\n * (`FileRouter` renders even the top-level file that way), and Include publishes\n * the rendered module's `EvaluationContext` to its subtree via\n * {@link RenderExportedComponentContext}; the nearest one's\n * `evaluation.module.filepath` is this file's own `/app/…` path. Because that\n * context nests with each `<Include>`, a relative target inside an included\n * fragment resolves against the **fragment**, not the top-level page in the URL.\n *\n * A target may carry a `#fragment` (`[[FILE.mdx#sec-8-9]]`, `[[#sec-8-9]]`): the\n * fragment is **split off** ({@link splitHash}, §13.5) and existence is resolved on\n * the **fragment-stripped path**, so a section citation to an existing file resolves\n * (not \"broken\"). The fragment then rides to navigation, where the scroll-after-nav\n * effect ({@link useScrollAfterNavigation}) lands the reader on the section.\n *\n * The resolved path is checked for **existence** against the live metadata store\n * (keyed by absolute `/app/…` paths) for the states (§13.3, §13.5):\n * - **anchor** — a fragment with no path (`[[#sec-8-9]]`), or a fragment whose path is\n * the current file: a same-page {@link Link} that scrolls in place, no route change.\n * - **self** — the resolved path is the current file (no fragment): inert text, no link.\n * - **broken** — no file at the resolved path (and the store has loaded): rendered\n * as marked text, **not** a throw.\n * - **resolved** — routed through {@link Link} (in-app navigation for a same-app\n * href, a plain `<a>` otherwise), carrying any `#fragment`.\n *\n * The check is **optimistic until the metadata store loads** (an empty store never\n * flashes \"broken\"), and a relative target with no ambient render context (MDX\n * rendered outside `<Include>`) routes optimistically. Such an app overrides this\n * component (§11) for precise resolution.\n */\nexport const WikiLink = ({\n target,\n label,\n children,\n ...rest\n}: {\n target?: string;\n label?: ReactNode;\n children?: ReactNode;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n const { filesMetadata } = use(TinkerableContext);\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/WikiLink.tsx"],"sourcesContent":["import { ReactNode, use } from 'react';\nimport { Link } from './Link';\nimport { RenderExportedComponentContext } from './Include';\nimport { TinkerableContext } from '../TinkerableContext';\nimport { splitHash } from '../urlUtils';\nimport { FS_PREFIX, LinkSpaceContext, resolveLinkTarget } from '../linkSpace';\n\n/** Derive a human label from a target path: basename without the extension. */\nconst labelFromTarget = (target: string): string => {\n const base = target.split(/[\\\\/]/).pop() ?? target;\n return base.replace(/\\.mdx?$/i, '') || target;\n};\n\n/**\n * Default MDX `WikiLink` component — the render target for the `[[target]]` /\n * `[[label|target]]` wiki-link syntax. The transpiler remark plugin (R3-153)\n * compiles that syntax to `<WikiLink target=\"…\" label=\"…\">`, carrying the raw\n * target/label verbatim; **resolution lives here** (MARKDOWN_SYNTAX_SPEC §13.2).\n *\n * Registered in {@link DEFAULT_MDX_COMPONENTS} so wiki-links render even in a\n * plain-markdown repo (§11.2 phantom defaults). Targets are **paths only** —\n * relative (resolved against the current file's directory) or absolute — with\n * **no implicit search path** (§13.3, a deliberate departure from Obsidian).\n *\n * The **current file** — the one the link is *authored in* — is read from the\n * ambient `<Include>` render context. Every MDX file renders through `<Include>`\n * (`FileRouter` renders even the top-level file that way), and Include publishes\n * the rendered module's `EvaluationContext` to its subtree via\n * {@link RenderExportedComponentContext}; the nearest one's\n * `evaluation.module.filepath` is this file's own `/app/…` path. Because that\n * context nests with each `<Include>`, a relative target inside an included\n * fragment resolves against the **fragment**, not the top-level page in the URL.\n *\n * A target may carry a `#fragment` (`[[FILE.mdx#sec-8-9]]`, `[[#sec-8-9]]`): the\n * fragment is **split off** ({@link splitHash}, §13.5) and existence is resolved on\n * the **fragment-stripped path**, so a section citation to an existing file resolves\n * (not \"broken\"). The fragment then rides to navigation, where the scroll-after-nav\n * effect ({@link useScrollAfterNavigation}) lands the reader on the section.\n *\n * The resolved path is checked for **existence** against the live metadata store\n * (keyed by absolute `/app/…` paths) for the states (§13.3, §13.5):\n * - **anchor** — a fragment with no path (`[[#sec-8-9]]`), or a fragment whose path is\n * the current file: a same-page {@link Link} that scrolls in place, no route change.\n * - **self** — the resolved path is the current file (no fragment): inert text, no link.\n * - **broken** — no file at the resolved path (and the store has loaded): rendered\n * as marked text, **not** a throw.\n * - **resolved** — routed through {@link Link} (in-app navigation for a same-app\n * href, a plain `<a>` otherwise), carrying any `#fragment`.\n *\n * The check is **optimistic until the metadata store loads** (an empty store never\n * flashes \"broken\"), and a relative target with no ambient render context (MDX\n * rendered outside `<Include>`) routes optimistically. Such an app overrides this\n * component (§11) for precise resolution.\n */\nexport const WikiLink = ({\n target,\n label,\n children,\n ...rest\n}: {\n target?: string;\n label?: ReactNode;\n children?: ReactNode;\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>): ReactNode => {\n const { filesMetadata } = use(TinkerableContext);\n // R3-482: the link-space root reads new-then-old — `bundleRoot` when the provider\n // states it at all (an explicit `null` is a VALUE: \"no bundle root\", NOT a miss),\n // the deprecated `corpusRoot` spelling only when `bundleRoot` is absent. The same\n // presence rule as mdx-plugins' statedBundleRoot; twin read in MDXComponents.tsx.\n const space = use(LinkSpaceContext);\n const bundleRoot = space.bundleRoot !== undefined ? space.bundleRoot : space.corpusRoot ?? null;\n const renderContext = use(RenderExportedComponentContext);\n const currentFile = renderContext?.evaluationContext?.evaluation?.module?.filepath;\n\n const rawTarget = target ?? '';\n const [pathPart, frag] = splitHash(rawTarget);\n const text = children ?? label ?? (rawTarget ? labelFromTarget(pathPart || frag || rawTarget) : '');\n\n // Defensive: the kernel never emits an empty target, but a hand-written\n // `<WikiLink>` might. Render inert text rather than a link to nowhere.\n if (!rawTarget) {\n return (\n <span className=\"ir-wikilink\" {...rest}>\n {text}\n </span>\n );\n }\n\n // Same-page anchor: a fragment with no path (`[[#sec-8-9]]`). Scroll within the\n // current file — no route change (§13.5). <Link> intercepts a bare `#`-href.\n if (pathPart === '' && frag) {\n return (\n <Link href={`#${frag}`} className=\"ir-wikilink\" data-state=\"anchor\" {...rest}>\n {text}\n </Link>\n );\n }\n\n // R3-273 link spaces: resolution is the SHARED resolver (`linkSpace.ts`) —\n // default space (bundle-rooted absolute targets when an enclosing provider\n // declares a bundleRoot; fs-rooted otherwise) or the explicit `$fs:` prefix.\n // A malformed `$fs:` target renders BROKEN, never an anchor.\n const resolution = resolveLinkTarget(pathPart, { currentFile, bundleRoot });\n if (resolution.state === 'invalid') {\n return (\n <span\n className=\"ir-wikilink ir-wikilink-broken\"\n data-state=\"broken\"\n title={`Invalid ${FS_PREFIX} target: ${pathPart}`}\n {...rest}\n >\n {text}\n </span>\n );\n }\n const resolved = resolution.state === 'resolved' ? resolution.path : undefined;\n const files = filesMetadata ?? {};\n const loaded = Object.keys(files).length > 0;\n\n // `resolved === undefined` ⇒ a relative target with no known current file: route\n // it optimistically (can't check existence or self-ness generically).\n if (resolved !== undefined) {\n if (currentFile && resolved === currentFile) {\n // The target IS this file. With a fragment it is a same-page anchor to another\n // of this file's sections; without one it is an inert self-reference.\n if (frag) {\n return (\n <Link href={`#${frag}`} className=\"ir-wikilink\" data-state=\"anchor\" {...rest}>\n {text}\n </Link>\n );\n }\n return (\n <span className=\"ir-wikilink ir-wikilink-self\" data-state=\"self\" {...rest}>\n {text}\n </span>\n );\n }\n // Existence is checked on the FRAGMENT-STRIPPED path (optimistic until loaded).\n const exists = !loaded || resolved in files;\n if (!exists) {\n return (\n <span className=\"ir-wikilink ir-wikilink-broken\" data-state=\"broken\" title={`No file at ${resolved}`} {...rest}>\n {text}\n </span>\n );\n }\n }\n // Resolved cross-file target: route through <Link>. A space-translated target\n // (`$fs:` prefix, or a bundle-rooted absolute) navigates to the RESOLVED path —\n // the raw text is not a routable path in those shapes; everything else carries\n // the raw target bit-for-bit so its `#fragment` rides through navigation to the\n // scroll-after-nav effect (§13.5). The fragment is re-attached either way.\n const translated = pathPart.startsWith(FS_PREFIX) || (bundleRoot !== null && pathPart.startsWith('/'));\n const href = translated && resolved !== undefined ? `${resolved}${frag ? `#${frag}` : ''}` : rawTarget;\n return (\n <Link href={href} className=\"ir-wikilink\" data-state=\"resolved\" {...rest}>\n {text}\n </Link>\n );\n};\n"],"mappings":";AAkFM;AAlFN,SAAoB,WAAW;AAC/B,SAAS,YAAY;AACrB,SAAS,sCAAsC;AAC/C,SAAS,yBAAyB;AAClC,SAAS,iBAAiB;AAC1B,SAAS,WAAW,kBAAkB,yBAAyB;AAG/D,MAAM,kBAAkB,CAAC,WAA2B;AAClD,QAAM,OAAO,OAAO,MAAM,OAAO,EAAE,IAAI,KAAK;AAC5C,SAAO,KAAK,QAAQ,YAAY,EAAE,KAAK;AACzC;AA2CO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAI+E;AAC7E,QAAM,EAAE,cAAc,IAAI,IAAI,iBAAiB;AAK/C,QAAM,QAAQ,IAAI,gBAAgB;AAClC,QAAM,aAAa,MAAM,eAAe,SAAY,MAAM,aAAa,MAAM,cAAc;AAC3F,QAAM,gBAAgB,IAAI,8BAA8B;AACxD,QAAM,cAAc,eAAe,mBAAmB,YAAY,QAAQ;AAE1E,QAAM,YAAY,UAAU;AAC5B,QAAM,CAAC,UAAU,IAAI,IAAI,UAAU,SAAS;AAC5C,QAAM,OAAO,YAAY,UAAU,YAAY,gBAAgB,YAAY,QAAQ,SAAS,IAAI;AAIhG,MAAI,CAAC,WAAW;AACd,WACE,oBAAC,UAAK,WAAU,eAAe,GAAG,MAC/B,gBACH;AAAA,EAEJ;AAIA,MAAI,aAAa,MAAM,MAAM;AAC3B,WACE,oBAAC,QAAK,MAAM,IAAI,IAAI,IAAI,WAAU,eAAc,cAAW,UAAU,GAAG,MACrE,gBACH;AAAA,EAEJ;AAMA,QAAM,aAAa,kBAAkB,UAAU,EAAE,aAAa,WAAW,CAAC;AAC1E,MAAI,WAAW,UAAU,WAAW;AAClC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,cAAW;AAAA,QACX,OAAO,WAAW,SAAS,YAAY,QAAQ;AAAA,QAC9C,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACA,QAAM,WAAW,WAAW,UAAU,aAAa,WAAW,OAAO;AACrE,QAAM,QAAQ,iBAAiB,CAAC;AAChC,QAAM,SAAS,OAAO,KAAK,KAAK,EAAE,SAAS;AAI3C,MAAI,aAAa,QAAW;AAC1B,QAAI,eAAe,aAAa,aAAa;AAG3C,UAAI,MAAM;AACR,eACE,oBAAC,QAAK,MAAM,IAAI,IAAI,IAAI,WAAU,eAAc,cAAW,UAAU,GAAG,MACrE,gBACH;AAAA,MAEJ;AACA,aACE,oBAAC,UAAK,WAAU,gCAA+B,cAAW,QAAQ,GAAG,MAClE,gBACH;AAAA,IAEJ;AAEA,UAAM,SAAS,CAAC,UAAU,YAAY;AACtC,QAAI,CAAC,QAAQ;AACX,aACE,oBAAC,UAAK,WAAU,kCAAiC,cAAW,UAAS,OAAO,cAAc,QAAQ,IAAK,GAAG,MACvG,gBACH;AAAA,IAEJ;AAAA,EACF;AAMA,QAAM,aAAa,SAAS,WAAW,SAAS,KAAM,eAAe,QAAQ,SAAS,WAAW,GAAG;AACpG,QAAM,OAAO,cAAc,aAAa,SAAY,GAAG,QAAQ,GAAG,OAAO,IAAI,IAAI,KAAK,EAAE,KAAK;AAC7F,SACE,oBAAC,QAAK,MAAY,WAAU,eAAc,cAAW,YAAY,GAAG,MACjE,gBACH;AAEJ;","names":[]}
|
|
@@ -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);
|