@curvenote/theme-ui 2.0.1 → 2.1.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/index.d.ts +4 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -3
- package/dist/components/layout/app-layout.d.ts +3 -3
- package/dist/components/layout/app-layout.d.ts.map +1 -1
- package/dist/components/layout/app-layout.js +26 -16
- package/dist/components/layout/app-sidebar.d.ts +2 -1
- package/dist/components/layout/app-sidebar.d.ts.map +1 -1
- package/dist/components/layout/app-sidebar.js +8 -8
- package/dist/components/layout/article-layout.d.ts +3 -3
- package/dist/components/layout/article-layout.d.ts.map +1 -1
- package/dist/components/layout/article-layout.js +17 -10
- package/dist/components/layout/grid.d.ts +1 -1
- package/dist/components/layout/grid.d.ts.map +1 -1
- package/dist/components/layout/header.d.ts +5 -3
- package/dist/components/layout/header.d.ts.map +1 -1
- package/dist/components/layout/header.js +6 -3
- package/dist/components/layout/index.d.ts +7 -7
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +7 -7
- package/dist/components/layout/layout-header.d.ts +9 -0
- package/dist/components/layout/layout-header.d.ts.map +1 -0
- package/dist/components/layout/layout-header.js +13 -0
- package/dist/components/layout/loading-bar.d.ts +1 -1
- package/dist/components/layout/loading-bar.d.ts.map +1 -1
- package/dist/components/layout/loading-bar.js +1 -1
- package/dist/components/layout/site-header.d.ts +1 -1
- package/dist/components/layout/site-header.d.ts.map +1 -1
- package/dist/components/layout/site-header.js +21 -9
- package/dist/components/layout/types.d.ts +11 -0
- package/dist/components/layout/types.d.ts.map +1 -1
- package/dist/components/providers/analytics-boundary.d.ts +1 -1
- package/dist/components/providers/analytics-boundary.d.ts.map +1 -1
- package/dist/components/providers/analytics-boundary.js +3 -3
- package/dist/components/providers/analytics-dev-tray.d.ts +1 -1
- package/dist/components/providers/analytics-dev-tray.d.ts.map +1 -1
- package/dist/components/providers/analytics-dev-tray.js +3 -3
- package/dist/components/providers/article-versions-provider.d.ts +1 -1
- package/dist/components/providers/article-versions-provider.d.ts.map +1 -1
- package/dist/components/providers/compute.d.ts +1 -1
- package/dist/components/providers/compute.d.ts.map +1 -1
- package/dist/components/providers/curvenote-providers.d.ts +28 -19
- package/dist/components/providers/curvenote-providers.d.ts.map +1 -1
- package/dist/components/providers/curvenote-providers.js +28 -14
- package/dist/components/providers/design.d.ts +1 -1
- package/dist/components/providers/design.d.ts.map +1 -1
- package/dist/components/providers/design.js +2 -1
- package/dist/components/providers/index.d.ts +11 -11
- package/dist/components/providers/index.d.ts.map +1 -1
- package/dist/components/providers/index.js +11 -11
- package/dist/components/providers/lightbox-provider.d.ts +1 -1
- package/dist/components/providers/lightbox-provider.d.ts.map +1 -1
- package/dist/components/providers/myst-providers.d.ts +1 -1
- package/dist/components/providers/myst-providers.d.ts.map +1 -1
- package/dist/components/providers/overlay-depth.d.ts +1 -1
- package/dist/components/providers/overlay-depth.d.ts.map +1 -1
- package/dist/components/providers/page-providers.d.ts +2 -2
- package/dist/components/providers/page-providers.d.ts.map +1 -1
- package/dist/components/providers/ping-boundary.d.ts +1 -1
- package/dist/components/providers/ping-boundary.d.ts.map +1 -1
- package/dist/components/providers/platform-providers.d.ts +1 -1
- package/dist/components/providers/platform-providers.d.ts.map +1 -1
- package/dist/components/site-renderers/host-import-map-script.d.ts +8 -0
- package/dist/components/site-renderers/host-import-map-script.d.ts.map +1 -0
- package/dist/components/site-renderers/host-import-map-script.js +30 -0
- package/dist/components/site-renderers/host-import-map.d.ts +40 -0
- package/dist/components/site-renderers/host-import-map.d.ts.map +1 -0
- package/dist/components/site-renderers/host-import-map.js +136 -0
- package/dist/components/site-renderers/host-react-modules.d.ts +15 -0
- package/dist/components/site-renderers/host-react-modules.d.ts.map +1 -0
- package/dist/components/site-renderers/host-react-modules.js +17 -0
- package/dist/components/site-renderers/index.d.ts +6 -0
- package/dist/components/site-renderers/index.d.ts.map +1 -0
- package/dist/components/site-renderers/index.js +7 -0
- package/dist/components/site-renderers/site-myst-providers.d.ts +8 -0
- package/dist/components/site-renderers/site-myst-providers.d.ts.map +1 -0
- package/dist/components/site-renderers/site-myst-providers.js +40 -0
- package/dist/components/site-renderers/site-renderers.d.ts +23 -0
- package/dist/components/site-renderers/site-renderers.d.ts.map +1 -0
- package/dist/components/site-renderers/site-renderers.js +48 -0
- package/dist/components/ui/Callout.d.ts +1 -1
- package/dist/components/ui/Callout.d.ts.map +1 -1
- package/dist/components/ui/Callout.js +1 -1
- package/dist/components/ui/PageCards.d.ts +2 -1
- package/dist/components/ui/PageCards.d.ts.map +1 -1
- package/dist/components/ui/abbreviations.d.ts +2 -1
- package/dist/components/ui/abbreviations.d.ts.map +1 -1
- package/dist/components/ui/abbreviations.js +7 -14
- package/dist/components/ui/abstract.d.ts +1 -1
- package/dist/components/ui/abstract.d.ts.map +1 -1
- package/dist/components/ui/accessibility-skip-to.d.ts +3 -3
- package/dist/components/ui/accessibility-skip-to.d.ts.map +1 -1
- package/dist/components/ui/accessibility-skip-to.js +1 -1
- package/dist/components/ui/acknowledgements.d.ts +1 -1
- package/dist/components/ui/acknowledgements.d.ts.map +1 -1
- package/dist/components/ui/acknowledgements.js +4 -4
- package/dist/components/ui/arrow.d.ts +3 -3
- package/dist/components/ui/arrow.d.ts.map +1 -1
- package/dist/components/ui/article-actions-downloads.d.ts +24 -3
- package/dist/components/ui/article-actions-downloads.d.ts.map +1 -1
- package/dist/components/ui/article-actions-downloads.js +58 -16
- package/dist/components/ui/article-actions-dropdown.d.ts +1 -1
- package/dist/components/ui/article-actions-dropdown.d.ts.map +1 -1
- package/dist/components/ui/article-actions-dropdown.js +9 -9
- package/dist/components/ui/article-actions-share.d.ts +1 -1
- package/dist/components/ui/article-actions-share.d.ts.map +1 -1
- package/dist/components/ui/article-actions-share.js +2 -2
- package/dist/components/ui/article-actions.d.ts +1 -1
- package/dist/components/ui/article-actions.d.ts.map +1 -1
- package/dist/components/ui/article-actions.js +29 -8
- package/dist/components/ui/article-bar.d.ts +16 -3
- package/dist/components/ui/article-bar.d.ts.map +1 -1
- package/dist/components/ui/article-bar.js +9 -7
- package/dist/components/ui/article-card.d.ts +1 -1
- package/dist/components/ui/article-card.d.ts.map +1 -1
- package/dist/components/ui/article-card.js +9 -4
- package/dist/components/ui/article-footer.d.ts +1 -1
- package/dist/components/ui/article-footer.d.ts.map +1 -1
- package/dist/components/ui/article-footer.js +1 -1
- package/dist/components/ui/author-popover.d.ts +1 -1
- package/dist/components/ui/author-popover.d.ts.map +1 -1
- package/dist/components/ui/author-popover.js +3 -3
- package/dist/components/ui/backmatter.d.ts +41 -3
- package/dist/components/ui/backmatter.d.ts.map +1 -1
- package/dist/components/ui/backmatter.js +117 -34
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/banner.d.ts +22 -1
- package/dist/components/ui/banner.d.ts.map +1 -1
- package/dist/components/ui/banner.js +44 -3
- package/dist/components/ui/bibliography.d.ts +1 -1
- package/dist/components/ui/bibliography.d.ts.map +1 -1
- package/dist/components/ui/bibliography.js +3 -3
- package/dist/components/ui/breadcrumb.d.ts +7 -7
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/calendar.d.ts +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/citation.d.ts +2 -2
- package/dist/components/ui/citation.d.ts.map +1 -1
- package/dist/components/ui/citation.js +5 -5
- package/dist/components/ui/collapsible-backmatter-section.d.ts +2 -2
- package/dist/components/ui/collapsible-backmatter-section.d.ts.map +1 -1
- package/dist/components/ui/collapsible-backmatter-section.js +3 -3
- package/dist/components/ui/collapsible.d.ts +3 -3
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/cookie-banner.d.ts +2 -1
- package/dist/components/ui/cookie-banner.d.ts.map +1 -1
- package/dist/components/ui/cookie-banner.js +4 -4
- package/dist/components/ui/data-availability.d.ts +1 -1
- package/dist/components/ui/data-availability.d.ts.map +1 -1
- package/dist/components/ui/data-availability.js +4 -4
- package/dist/components/ui/dhr-cta-buttons.d.ts +30 -0
- package/dist/components/ui/dhr-cta-buttons.d.ts.map +1 -0
- package/dist/components/ui/dhr-cta-buttons.js +40 -0
- package/dist/components/ui/dialog.d.ts +10 -10
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/document-outline.d.ts +11 -2
- package/dist/components/ui/document-outline.d.ts.map +1 -1
- package/dist/components/ui/document-outline.js +101 -54
- package/dist/components/ui/dropdown-menu.d.ts +15 -15
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/error-page.d.ts +1 -1
- package/dist/components/ui/error-page.d.ts.map +1 -1
- package/dist/components/ui/error-page.js +1 -1
- package/dist/components/ui/font-styles.d.ts +23 -0
- package/dist/components/ui/font-styles.d.ts.map +1 -0
- package/dist/components/ui/font-styles.js +39 -0
- package/dist/components/ui/footer-links.d.ts +1 -1
- package/dist/components/ui/footer-links.d.ts.map +1 -1
- package/dist/components/ui/footer-links.js +2 -2
- package/dist/components/ui/footnotes.d.ts +1 -1
- package/dist/components/ui/footnotes.d.ts.map +1 -1
- package/dist/components/ui/footnotes.js +3 -2
- package/dist/components/ui/frontmatter-badges.d.ts +7 -7
- package/dist/components/ui/frontmatter-badges.d.ts.map +1 -1
- package/dist/components/ui/frontmatter-badges.js +5 -5
- package/dist/components/ui/frontmatter.d.ts +1 -1
- package/dist/components/ui/frontmatter.d.ts.map +1 -1
- package/dist/components/ui/frontmatter.js +1 -1
- package/dist/components/ui/hash-link.d.ts.map +1 -1
- package/dist/components/ui/hash-link.js +2 -1
- package/dist/components/ui/image.d.ts +2 -2
- package/dist/components/ui/image.d.ts.map +1 -1
- package/dist/components/ui/image.js +3 -3
- package/dist/components/ui/index.d.ts +62 -57
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +59 -56
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/keywords.d.ts +1 -1
- package/dist/components/ui/keywords.d.ts.map +1 -1
- package/dist/components/ui/keywords.js +3 -3
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/license-description.d.ts +1 -1
- package/dist/components/ui/license-description.d.ts.map +1 -1
- package/dist/components/ui/license-description.js +3 -3
- package/dist/components/ui/license-frontmatter.d.ts +2 -2
- package/dist/components/ui/license-frontmatter.d.ts.map +1 -1
- package/dist/components/ui/license-frontmatter.js +4 -4
- package/dist/components/ui/lightbox-container.d.ts +2 -2
- package/dist/components/ui/lightbox-container.d.ts.map +1 -1
- package/dist/components/ui/lightbox-container.js +2 -2
- package/dist/components/ui/lightbox.d.ts +3 -2
- package/dist/components/ui/lightbox.d.ts.map +1 -1
- package/dist/components/ui/lightbox.js +6 -6
- package/dist/components/ui/link-card.d.ts +1 -1
- package/dist/components/ui/link-card.d.ts.map +1 -1
- package/dist/components/ui/link-card.js +1 -1
- package/dist/components/ui/pagination.d.ts +7 -7
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/popover.d.ts +4 -4
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/search.d.ts +1 -1
- package/dist/components/ui/search.d.ts.map +1 -1
- package/dist/components/ui/search.js +2 -2
- package/dist/components/ui/select.d.ts +10 -10
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/separator.d.ts +1 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.d.ts +8 -8
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +23 -23
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +3 -3
- package/dist/components/ui/site-color-styles.d.ts +8 -0
- package/dist/components/ui/site-color-styles.d.ts.map +1 -0
- package/dist/components/ui/site-color-styles.js +16 -0
- package/dist/components/ui/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/sonner.d.ts +1 -1
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/theme-button.d.ts +1 -1
- package/dist/components/ui/theme-button.d.ts.map +1 -1
- package/dist/components/ui/theme-button.js +3 -3
- package/dist/components/ui/tooltip.d.ts +4 -4
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +2 -2
- package/dist/components/ui/types.d.ts +1 -0
- package/dist/components/ui/types.d.ts.map +1 -1
- package/dist/components/ui/types.js +1 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/use-theme.d.ts +1 -1
- package/dist/hooks/use-theme.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/dedupeAbbreviations.d.ts +11 -0
- package/dist/lib/dedupeAbbreviations.d.ts.map +1 -1
- package/dist/lib/dedupeAbbreviations.js +17 -0
- package/dist/lib/fonts.d.ts +29 -0
- package/dist/lib/fonts.d.ts.map +1 -0
- package/dist/lib/fonts.js +148 -0
- package/dist/lib/index.d.ts +6 -5
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +6 -5
- package/dist/lib/site-colors.d.ts +10 -0
- package/dist/lib/site-colors.d.ts.map +1 -0
- package/dist/lib/site-colors.js +20 -0
- package/package.json +22 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SiteThemeConfig, ArticleThemeConfig, DesignOptions, DesignPresetConfig } from '@curvenote/common';
|
|
2
2
|
import { type ExtendedCoreOptions, type PingFn } from '@curvenote/bridge-jupyter';
|
|
3
3
|
import { type SiteManifest } from 'myst-config';
|
|
4
|
+
import type { ThebeServer } from 'thebe-core';
|
|
4
5
|
type ManifestProject = Required<SiteManifest>['projects'][0];
|
|
5
6
|
/**
|
|
6
7
|
* Based on the article SubmissionKind, resolve the theme config options for that kind, if specified,
|
|
@@ -10,42 +11,50 @@ type ManifestProject = Required<SiteManifest>['projects'][0];
|
|
|
10
11
|
* @param config
|
|
11
12
|
* @returns - a resolved set of options that can be applied to the article without the need for further fallback logic
|
|
12
13
|
*/
|
|
13
|
-
export declare function resolveArticleConfigOptions(kindName: string, config?:
|
|
14
|
+
export declare function resolveArticleConfigOptions(kindName: string, config?: SiteThemeConfig): ArticleThemeConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Where compute settings come from. With 'site', the platform site's `theme_config.jupyter` turns
|
|
17
|
+
* compute on and configures it, and the project can switch it off. With 'project', the site's
|
|
18
|
+
* `jupyter` settings are ignored and the project's own `jupyter` frontmatter alone decides.
|
|
19
|
+
*/
|
|
20
|
+
export type ComputeSettingsSource = 'site' | 'project';
|
|
21
|
+
/** `resolveArticleConfigOptions`, with the `jupyter` settings taken from `source`. */
|
|
22
|
+
export declare function resolveArticleConfigForCompute(kindName: string, config: SiteThemeConfig | undefined, source: ComputeSettingsSource): ArticleThemeConfig;
|
|
14
23
|
export declare function resolveThemeAndProjectComputeOptions(resolvedArticleConfig: ArticleThemeConfig, project: Required<SiteManifest>['projects'][0]): ArticleThemeConfig;
|
|
15
24
|
type RepoProviderSpec = any;
|
|
25
|
+
type AdditionalThemeComputeConfig = {
|
|
26
|
+
optionOverrideFn?: (opts?: ExtendedCoreOptions) => ExtendedCoreOptions | undefined;
|
|
27
|
+
customRepoProviders?: RepoProviderSpec[];
|
|
28
|
+
customConnectFn?: (server: ThebeServer) => Promise<void>;
|
|
29
|
+
mecaUrl?: string | null;
|
|
30
|
+
errors?: {
|
|
31
|
+
noMecaBundle?: boolean | null;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
16
34
|
export declare function getCustomRepoProviders(names: string[]): RepoProviderSpec[];
|
|
17
35
|
/**
|
|
18
36
|
* Get the Jupyter configuration based on a combination of the theme's
|
|
19
37
|
* features and overrides, and the site manifest
|
|
20
38
|
*/
|
|
21
|
-
export declare function getAdditionalThemeComputeConfig(resolvedConfig: ArticleThemeConfig, mecaUrl: string | null, respectLocalServerSettings?: boolean):
|
|
22
|
-
optionOverrideFn?: undefined;
|
|
23
|
-
customRepoProviders?: undefined;
|
|
24
|
-
customConnectFn?: undefined;
|
|
25
|
-
mecaUrl?: undefined;
|
|
26
|
-
errors?: undefined;
|
|
27
|
-
} | {
|
|
28
|
-
optionOverrideFn: (opts?: ExtendedCoreOptions) => ExtendedCoreOptions | undefined;
|
|
29
|
-
customRepoProviders: any[] | undefined;
|
|
30
|
-
customConnectFn: ((server: import("thebe-core").ThebeServer) => Promise<void>) | undefined;
|
|
31
|
-
mecaUrl: string | null;
|
|
32
|
-
errors: {
|
|
33
|
-
noMecaBundle: boolean | undefined;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
39
|
+
export declare function getAdditionalThemeComputeConfig(resolvedConfig: ArticleThemeConfig, mecaUrl: string | null, respectLocalServerSettings?: boolean, computeSettings?: ComputeSettingsSource): AdditionalThemeComputeConfig;
|
|
36
40
|
type CurvenoteDesignConfig = DesignPresetConfig | DesignOptions;
|
|
37
41
|
export declare function getFullyQualifiedUrlToMECABundle(project: ManifestProject): string | null;
|
|
38
|
-
export declare function CurvenoteProviders({ children, submissionKind, design, mode, pingFn: providedPingFn, }: {
|
|
42
|
+
export declare function CurvenoteProviders({ children, submissionKind, design, mode, computeSettings, pingFn: providedPingFn, }: {
|
|
39
43
|
children: React.ReactNode;
|
|
40
44
|
submissionKind: string;
|
|
41
45
|
design?: CurvenoteDesignConfig | CurvenoteDesignConfig[];
|
|
42
46
|
mode?: 'development' | 'production';
|
|
47
|
+
/**
|
|
48
|
+
* Where compute settings come from, 'site' by default. The Curvenote CLI theme uses 'project':
|
|
49
|
+
* it previews a local project, not a site.
|
|
50
|
+
*/
|
|
51
|
+
computeSettings?: ComputeSettingsSource;
|
|
43
52
|
/**
|
|
44
53
|
* Optional ping function with route-specific metadata.
|
|
45
54
|
* If provided, this will be used for bridge-jupyter LogBoundary instead of the default.
|
|
46
55
|
* This allows routes to curry in metadata like workVersionId, articleTitle, etc.
|
|
47
56
|
*/
|
|
48
57
|
pingFn?: PingFn;
|
|
49
|
-
}): import("react
|
|
58
|
+
}): import("react").JSX.Element;
|
|
50
59
|
export {};
|
|
51
60
|
//# sourceMappingURL=curvenote-providers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curvenote-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/curvenote-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"curvenote-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/curvenote-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAElB,aAAa,EACb,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,MAAM,EACZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAYhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,KAAK,eAAe,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7D;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,eAAe,GACvB,kBAAkB,CAyBpB;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvD,sFAAsF;AACtF,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,MAAM,EAAE,qBAAqB,GAC5B,kBAAkB,CAMpB;AAED,wBAAgB,oCAAoC,CAClD,qBAAqB,EAAE,kBAAkB,EACzC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,sBAqC/C;AAED,KAAK,gBAAgB,GAAG,GAAG,CAAC;AAG5B,KAAK,4BAA4B,GAAG;IAClC,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,mBAAmB,KAAK,mBAAmB,GAAG,SAAS,CAAC;IACnF,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE;QACP,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;KAC/B,CAAC;CACH,CAAC;AA0BF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAE1E;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,cAAc,EAAE,kBAAkB,EAClC,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,0BAA0B,CAAC,EAAE,OAAO,EACpC,eAAe,GAAE,qBAA8B,GAC9C,4BAA4B,CAgE9B;AAQD,KAAK,qBAAqB,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAEhE,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAIxF;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,cAA6B,EAC7B,MAAM,EACN,IAAmB,EACnB,eAAwB,EACxB,MAAM,EAAE,cAAc,GACvB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,qBAAqB,GAAG,qBAAqB,EAAE,CAAC;IACzD,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IACpC;;;OAGG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,+BAmEA"}
|
|
@@ -2,16 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ComputeOptionsProvider, ConnectionStatusTray, LogBoundary, } from '@curvenote/bridge-jupyter';
|
|
3
3
|
import { useProjectManifest, useReferences, useSiteManifest } from '@myst-theme/providers';
|
|
4
4
|
import {} from 'myst-config';
|
|
5
|
-
import { useAnalytics } from './analytics-boundary';
|
|
6
|
-
import { ComputeProvider } from './compute';
|
|
7
|
-
import { checkHasMECAExport } from '../../lib';
|
|
8
|
-
import { useImages } from './lightbox-provider';
|
|
9
|
-
import { jupyterHubStreamingConnectFnFactory } from './connect';
|
|
10
|
-
import { LightboxContainer } from '../ui/lightbox-container';
|
|
11
|
-
import { DesignProvider } from './design';
|
|
12
|
-
import { usePage } from './page-providers';
|
|
13
|
-
import { usePingFn } from './ping-boundary';
|
|
14
|
-
import { usePlatformSite } from './platform-providers';
|
|
5
|
+
import { useAnalytics } from './analytics-boundary.js';
|
|
6
|
+
import { ComputeProvider } from './compute.js';
|
|
7
|
+
import { checkHasMECAExport } from '../../lib/index.js';
|
|
8
|
+
import { useImages } from './lightbox-provider.js';
|
|
9
|
+
import { jupyterHubStreamingConnectFnFactory } from './connect.js';
|
|
10
|
+
import { LightboxContainer } from '../ui/lightbox-container.js';
|
|
11
|
+
import { DesignProvider } from './design.js';
|
|
12
|
+
import { usePage } from './page-providers.js';
|
|
13
|
+
import { usePingFn } from './ping-boundary.js';
|
|
14
|
+
import { usePlatformSite } from './platform-providers.js';
|
|
15
15
|
/**
|
|
16
16
|
* Based on the article SubmissionKind, resolve the theme config options for that kind, if specified,
|
|
17
17
|
* pulling up defaults from the base theme.config.articles object and theme.config.jupyter object as needed
|
|
@@ -41,6 +41,15 @@ export function resolveArticleConfigOptions(kindName, config) {
|
|
|
41
41
|
}
|
|
42
42
|
return articleConfig;
|
|
43
43
|
}
|
|
44
|
+
/** `resolveArticleConfigOptions`, with the `jupyter` settings taken from `source`. */
|
|
45
|
+
export function resolveArticleConfigForCompute(kindName, config, source) {
|
|
46
|
+
const articleConfig = resolveArticleConfigOptions(kindName, config);
|
|
47
|
+
if (source === 'site')
|
|
48
|
+
return articleConfig;
|
|
49
|
+
// The notebook toolbar and figure controls; resolveThemeAndProjectComputeOptions then switches
|
|
50
|
+
// them off unless the project sets `jupyter`.
|
|
51
|
+
return { ...articleConfig, jupyter: { notebookCompute: true, figureCompute: true } };
|
|
52
|
+
}
|
|
44
53
|
export function resolveThemeAndProjectComputeOptions(resolvedArticleConfig, project) {
|
|
45
54
|
const themeEnablesCompute = !!resolvedArticleConfig.jupyter && resolvedArticleConfig.jupyter.enable !== false;
|
|
46
55
|
const projectJupyterConfig = project.thebe ?? project.jupyter; // future proofing
|
|
@@ -95,7 +104,7 @@ export function getCustomRepoProviders(names) {
|
|
|
95
104
|
* Get the Jupyter configuration based on a combination of the theme's
|
|
96
105
|
* features and overrides, and the site manifest
|
|
97
106
|
*/
|
|
98
|
-
export function getAdditionalThemeComputeConfig(resolvedConfig, mecaUrl, respectLocalServerSettings) {
|
|
107
|
+
export function getAdditionalThemeComputeConfig(resolvedConfig, mecaUrl, respectLocalServerSettings, computeSettings = 'site') {
|
|
99
108
|
const jupyter = resolvedConfig.jupyter;
|
|
100
109
|
if (!jupyter || jupyter.enable === false)
|
|
101
110
|
return {};
|
|
@@ -104,6 +113,11 @@ export function getAdditionalThemeComputeConfig(resolvedConfig, mecaUrl, respect
|
|
|
104
113
|
return undefined;
|
|
105
114
|
if (opts?.serverSettings && respectLocalServerSettings)
|
|
106
115
|
return opts;
|
|
116
|
+
// Compute from the project alone (the Curvenote theme) has no site to supply a Binder, MECA
|
|
117
|
+
// bundle or hub, and doesn't run JupyterLite (CN-2749), so it needs the project's own server
|
|
118
|
+
// or Binder.
|
|
119
|
+
if (computeSettings === 'project' && !opts?.binderOptions)
|
|
120
|
+
return undefined;
|
|
107
121
|
const { useJupyterLite, ...rest } = opts ?? {};
|
|
108
122
|
const enableJupyterLite = jupyter.allowLite && useJupyterLite;
|
|
109
123
|
const useBinder = !enableJupyterLite && jupyter.dedicatedHub === undefined;
|
|
@@ -156,19 +170,19 @@ export function getFullyQualifiedUrlToMECABundle(project) {
|
|
|
156
170
|
const meca = (project?.exports).find((e) => e.format === 'meca');
|
|
157
171
|
return meca?.url ?? null;
|
|
158
172
|
}
|
|
159
|
-
export function CurvenoteProviders({ children, submissionKind = 'SITE_PAGES', design, mode = 'production', pingFn: providedPingFn, }) {
|
|
173
|
+
export function CurvenoteProviders({ children, submissionKind = 'SITE_PAGES', design, mode = 'production', computeSettings = 'site', pingFn: providedPingFn, }) {
|
|
160
174
|
const platformSite = usePlatformSite();
|
|
161
175
|
const site = useSiteManifest();
|
|
162
176
|
const project = useProjectManifest();
|
|
163
177
|
const page = usePage();
|
|
164
|
-
const config =
|
|
178
|
+
const config = resolveArticleConfigForCompute(submissionKind, platformSite.theme_config, computeSettings);
|
|
165
179
|
const references = useReferences();
|
|
166
180
|
const articleConfig = resolveThemeAndProjectComputeOptions(config, project);
|
|
167
181
|
const mecaUrl = getFullyQualifiedUrlToMECABundle(project);
|
|
168
182
|
const respectLocalServerSettings = mode === 'development';
|
|
169
183
|
const resolved = {
|
|
170
184
|
...articleConfig,
|
|
171
|
-
...getAdditionalThemeComputeConfig(articleConfig, mecaUrl, respectLocalServerSettings),
|
|
185
|
+
...getAdditionalThemeComputeConfig(articleConfig, mecaUrl, respectLocalServerSettings, computeSettings),
|
|
172
186
|
};
|
|
173
187
|
const images = useImages({ mdast: references?.article });
|
|
174
188
|
const enable = articleConfig?.jupyter?.enable !== false;
|
|
@@ -4,6 +4,6 @@ export declare const DESIGN_PRESETS: Record<DesignPresetName, Omit<DesignPresetC
|
|
|
4
4
|
export declare function DesignProvider({ children, designs, }: {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
designs: (DesignPresetConfig | DesignOptions | undefined)[];
|
|
7
|
-
}):
|
|
7
|
+
}): React.JSX.Element;
|
|
8
8
|
export declare function useDesign(): DesignOptions;
|
|
9
9
|
//# sourceMappingURL=design.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../../src/components/providers/design.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE7F,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../../src/components/providers/design.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE7F,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAyCvF,CAAC;AAmCF,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC,kBAAkB,GAAG,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC;CAC7D,qBAKA;AAED,wBAAgB,SAAS,IAAI,aAAa,CAoBzC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useProjectManifest, useReferences } from '@myst-theme/providers';
|
|
3
3
|
import React, { createContext, useContext } from 'react';
|
|
4
4
|
import { select } from 'unist-util-select';
|
|
5
|
-
import { useIsIndexPage } from './page-providers';
|
|
5
|
+
import { useIsIndexPage } from './page-providers.js';
|
|
6
6
|
export const DESIGN_PRESETS = {
|
|
7
7
|
landing: {
|
|
8
8
|
base: {
|
|
@@ -17,6 +17,7 @@ export const DESIGN_PRESETS = {
|
|
|
17
17
|
hide_bibliography: true,
|
|
18
18
|
hide_footnotes: false,
|
|
19
19
|
hide_outline: true,
|
|
20
|
+
hide_license_description: true,
|
|
20
21
|
},
|
|
21
22
|
index: {},
|
|
22
23
|
page: {},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { ComputeProvider } from './compute';
|
|
2
|
-
export { CurvenoteProviders } from './curvenote-providers';
|
|
3
|
-
export { MystProviders } from './myst-providers';
|
|
4
|
-
export * from './ping-boundary';
|
|
5
|
-
export * from './analytics-boundary';
|
|
6
|
-
export * from './overlay-depth';
|
|
7
|
-
export * from './platform-providers';
|
|
8
|
-
export { LightboxProvider, useLightbox, type LightboxImageData, useImages, } from './lightbox-provider';
|
|
9
|
-
export { PageProviders, useIsIndexPage, usePage } from './page-providers';
|
|
10
|
-
export { ArticleVersionsProvider, useArticleVersions, type ArticleVersionNavItem, } from './article-versions-provider';
|
|
11
|
-
export { DesignProvider, useDesign } from './design';
|
|
1
|
+
export { ComputeProvider } from './compute.js';
|
|
2
|
+
export { CurvenoteProviders } from './curvenote-providers.js';
|
|
3
|
+
export { MystProviders } from './myst-providers.js';
|
|
4
|
+
export * from './ping-boundary.js';
|
|
5
|
+
export * from './analytics-boundary.js';
|
|
6
|
+
export * from './overlay-depth.js';
|
|
7
|
+
export * from './platform-providers.js';
|
|
8
|
+
export { LightboxProvider, useLightbox, type LightboxImageData, useImages, } from './lightbox-provider.js';
|
|
9
|
+
export { PageProviders, useIsIndexPage, usePage } from './page-providers.js';
|
|
10
|
+
export { ArticleVersionsProvider, useArticleVersions, type ArticleVersionNavItem, } from './article-versions-provider.js';
|
|
11
|
+
export { DesignProvider, useDesign } from './design.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/providers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/providers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAGxC,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,KAAK,iBAAiB,EACtB,SAAS,GACV,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,qBAAqB,GAC3B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Provider Components
|
|
2
|
-
export { ComputeProvider } from './compute';
|
|
3
|
-
export { CurvenoteProviders } from './curvenote-providers';
|
|
4
|
-
export { MystProviders } from './myst-providers';
|
|
5
|
-
export * from './ping-boundary';
|
|
6
|
-
export * from './analytics-boundary';
|
|
7
|
-
export * from './overlay-depth';
|
|
8
|
-
export * from './platform-providers';
|
|
2
|
+
export { ComputeProvider } from './compute.js';
|
|
3
|
+
export { CurvenoteProviders } from './curvenote-providers.js';
|
|
4
|
+
export { MystProviders } from './myst-providers.js';
|
|
5
|
+
export * from './ping-boundary.js';
|
|
6
|
+
export * from './analytics-boundary.js';
|
|
7
|
+
export * from './overlay-depth.js';
|
|
8
|
+
export * from './platform-providers.js';
|
|
9
9
|
// Lightbox Provider
|
|
10
|
-
export { LightboxProvider, useLightbox, useImages, } from './lightbox-provider';
|
|
10
|
+
export { LightboxProvider, useLightbox, useImages, } from './lightbox-provider.js';
|
|
11
11
|
// Page Providers
|
|
12
|
-
export { PageProviders, useIsIndexPage, usePage } from './page-providers';
|
|
13
|
-
export { ArticleVersionsProvider, useArticleVersions, } from './article-versions-provider';
|
|
14
|
-
export { DesignProvider, useDesign } from './design';
|
|
12
|
+
export { PageProviders, useIsIndexPage, usePage } from './page-providers.js';
|
|
13
|
+
export { ArticleVersionsProvider, useArticleVersions, } from './article-versions-provider.js';
|
|
14
|
+
export { DesignProvider, useDesign } from './design.js';
|
|
@@ -33,7 +33,7 @@ interface LightboxProviderProps {
|
|
|
33
33
|
children: React.ReactNode;
|
|
34
34
|
imageList?: LightboxImageData[];
|
|
35
35
|
}
|
|
36
|
-
export declare function LightboxProvider({ children, imageList: initialImageList, }: LightboxProviderProps):
|
|
36
|
+
export declare function LightboxProvider({ children, imageList: initialImageList, }: LightboxProviderProps): React.JSX.Element;
|
|
37
37
|
export declare function useLightbox(): LightboxContextType;
|
|
38
38
|
export {};
|
|
39
39
|
//# sourceMappingURL=lightbox-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightbox-provider.d.ts","sourceRoot":"","sources":["../../../src/components/providers/lightbox-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,iBAAiB,EAAE,CA2ClF;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,uBAI7D;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACjC,kGAAkG;IAClG,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACvC,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAID,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,SAAS,EAAE,gBAAqB,GACjC,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"lightbox-provider.d.ts","sourceRoot":"","sources":["../../../src/components/providers/lightbox-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,iBAAiB,EAAE,CA2ClF;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,uBAI7D;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACjC,kGAAkG;IAClG,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACvC,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAID,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,SAAS,EAAE,gBAAqB,GACjC,EAAE,qBAAqB,qBAoFvB;AAED,wBAAgB,WAAW,wBAM1B"}
|
|
@@ -2,5 +2,5 @@ import { type NodeRenderers } from '@myst-theme/providers';
|
|
|
2
2
|
export declare function MystProviders({ children, renderers, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
renderers: NodeRenderers;
|
|
5
|
-
}): import("react
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=myst-providers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"myst-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/myst-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AA0B/B,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,aAAa,CAAC;CAC1B
|
|
1
|
+
{"version":3,"file":"myst-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/myst-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AA0B/B,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,aAAa,CAAC;CAC1B,+BAkBA"}
|
|
@@ -12,5 +12,5 @@ export type OverlayDepthIncrementProps = {
|
|
|
12
12
|
* Wrap floating overlay **content** (not the trigger) so nested interactions report a
|
|
13
13
|
* higher `overlay_depth` without manual per-callsite wiring.
|
|
14
14
|
*/
|
|
15
|
-
export declare function OverlayDepthIncrement({ children }: OverlayDepthIncrementProps): import("react
|
|
15
|
+
export declare function OverlayDepthIncrement({ children }: OverlayDepthIncrementProps): import("react").JSX.Element;
|
|
16
16
|
//# sourceMappingURL=overlay-depth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-depth.d.ts","sourceRoot":"","sources":["../../../src/components/providers/overlay-depth.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,iCAAmB,CAAC;AAE/D,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B
|
|
1
|
+
{"version":3,"file":"overlay-depth.d.ts","sourceRoot":"","sources":["../../../src/components/providers/overlay-depth.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,iCAAmB,CAAC;AAE/D,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,+BAO7E"}
|
|
@@ -3,7 +3,7 @@ import type { SiteManifest } from 'myst-config';
|
|
|
3
3
|
export declare function PageProvider({ children, page }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
page: PageLoader;
|
|
6
|
-
}): import("react
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
7
|
export declare function usePage(): PageLoader;
|
|
8
8
|
export declare function useIsIndexPage(): boolean;
|
|
9
9
|
export declare function PageProviders({ children, page, config, project, }: {
|
|
@@ -11,5 +11,5 @@ export declare function PageProviders({ children, page, config, project, }: {
|
|
|
11
11
|
page: PageLoader;
|
|
12
12
|
config?: SiteManifest;
|
|
13
13
|
project?: string | undefined;
|
|
14
|
-
}): import("react
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
15
|
//# sourceMappingURL=page-providers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/page-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE
|
|
1
|
+
{"version":3,"file":"page-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/page-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,+BAE/F;AAED,wBAAgB,OAAO,IAAI,UAAU,CAIpC;AAED,wBAAgB,cAAc,IAAI,OAAO,CAIxC;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,+BAqBA"}
|
|
@@ -18,7 +18,7 @@ import type { PingFn, PingPayload } from '@curvenote/bridge-jupyter';
|
|
|
18
18
|
export declare function PingBoundary({ csrfToken, site, children, }: React.PropsWithChildren<{
|
|
19
19
|
csrfToken: string;
|
|
20
20
|
site: SiteDTO;
|
|
21
|
-
}>): import("react
|
|
21
|
+
}>): import("react").JSX.Element;
|
|
22
22
|
/**
|
|
23
23
|
* A hook to get the ping function from the PingBoundary context.
|
|
24
24
|
* Is additionalPayload is provided, it will be merged with the payload of the ping event
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ping-boundary.d.ts","sourceRoot":"","sources":["../../../src/components/providers/ping-boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAyDrE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,IAAI,EACJ,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC
|
|
1
|
+
{"version":3,"file":"ping-boundary.d.ts","sourceRoot":"","sources":["../../../src/components/providers/ping-boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAyDrE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,IAAI,EACJ,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC,+BAQD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,UAkBvE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,IAAI,UAAQ,QAWnF"}
|
|
@@ -5,7 +5,7 @@ export declare function PlatformSiteProvider({ site, config, children, }: {
|
|
|
5
5
|
site?: Site;
|
|
6
6
|
config?: SiteManifest;
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
}):
|
|
8
|
+
}): React.JSX.Element;
|
|
9
9
|
export declare function usePlatformSite(): Partial<Site>;
|
|
10
10
|
export declare function usePlatformConfig(): Partial<SiteManifest>;
|
|
11
11
|
//# sourceMappingURL=platform-providers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/platform-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAU9C,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,MAAM,EACN,QAAQ,GACT,EAAE;IACD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,
|
|
1
|
+
{"version":3,"file":"platform-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/platform-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAU9C,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,MAAM,EACN,QAAQ,GACT,EAAE;IACD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAMA;AAED,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAG/C;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,CAGzD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HOST_REACT_MODULES } from './host-react-modules.js';
|
|
2
|
+
export { HOST_REACT_MODULES };
|
|
3
|
+
/**
|
|
4
|
+
* Emits the host React import map as static SSR markup in <head> (before
|
|
5
|
+
* <Scripts />). Host module registration happens at module scope above.
|
|
6
|
+
*/
|
|
7
|
+
export declare function HostImportMap(): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=host-import-map-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-import-map-script.d.ts","sourceRoot":"","sources":["../../../src/components/site-renderers/host-import-map-script.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAA4B,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAsB9B;;;GAGG;AACH,wBAAgB,aAAa,gCAQ5B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { HOST_IMPORT_EXPORT_NAMES, IMPORT_MAP_ATTR, buildHostImportMap, } from './host-import-map.js';
|
|
3
|
+
import { HOST_REACT_MODULES, registerReactHostModules } from './host-react-modules.js';
|
|
4
|
+
export { HOST_REACT_MODULES };
|
|
5
|
+
// Register as soon as this module evaluates (SSR + client). Must not wait for
|
|
6
|
+
// an effect — the import map is live from first HTML byte and shims read this
|
|
7
|
+
// global unconditionally once a bare specifier is imported.
|
|
8
|
+
registerReactHostModules();
|
|
9
|
+
/**
|
|
10
|
+
* Import-map JSON from the shared export allowlist (not Object.keys of the
|
|
11
|
+
* local React build), so SSR and client emit the same mappings even when
|
|
12
|
+
* Node resolves react.development.js and the browser bundle uses production.
|
|
13
|
+
*/
|
|
14
|
+
const HOST_IMPORT_MAP_JSON = JSON.stringify(buildHostImportMap(HOST_IMPORT_EXPORT_NAMES));
|
|
15
|
+
const importMapScriptProps = {
|
|
16
|
+
type: 'importmap',
|
|
17
|
+
[IMPORT_MAP_ATTR]: 'true',
|
|
18
|
+
// Match React Router's own importmap script: SSR/client text can still
|
|
19
|
+
// differ under unusual bundling; never fail hydration over map markup.
|
|
20
|
+
suppressHydrationWarning: true,
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Emits the host React import map as static SSR markup in <head> (before
|
|
24
|
+
* <Scripts />). Host module registration happens at module scope above.
|
|
25
|
+
*/
|
|
26
|
+
export function HostImportMap() {
|
|
27
|
+
return (_jsx("script", { ...importMapScriptProps,
|
|
28
|
+
// Import map JSON must be text content, not a child React node.
|
|
29
|
+
dangerouslySetInnerHTML: { __html: HOST_IMPORT_MAP_JSON } }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const HOST_MODULES_KEY = "__CURVENOTE_HOST_IMPORT_MODULES__";
|
|
2
|
+
export declare const IMPORT_MAP_ATTR = "data-curvenote-host-importmap";
|
|
3
|
+
/**
|
|
4
|
+
* Stable public React exports shared by SSR and client import-map shims.
|
|
5
|
+
* Deliberately excludes development-only exports (act, captureOwnerStack) and
|
|
6
|
+
* internals so Object.keys() differences between React builds cannot diverge
|
|
7
|
+
* the emitted map.
|
|
8
|
+
*/
|
|
9
|
+
export declare const HOST_REACT_EXPORT_NAMES: readonly ["Activity", "Children", "Component", "Fragment", "Profiler", "PureComponent", "StrictMode", "Suspense", "cache", "cacheSignal", "cloneElement", "createContext", "createElement", "createRef", "forwardRef", "isValidElement", "lazy", "memo", "startTransition", "use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useEffectEvent", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition", "version"];
|
|
10
|
+
export declare const HOST_JSX_RUNTIME_EXPORT_NAMES: readonly ["Fragment", "jsx", "jsxs"];
|
|
11
|
+
export declare const HOST_JSX_DEV_RUNTIME_EXPORT_NAMES: readonly ["Fragment", "jsxDEV"];
|
|
12
|
+
/** Stable public react-dom exports; private internals and unstable APIs are excluded. */
|
|
13
|
+
export declare const HOST_REACT_DOM_EXPORT_NAMES: readonly ["createPortal", "flushSync", "preconnect", "prefetchDNS", "preinit", "preinitModule", "preload", "preloadModule", "requestFormReset", "useFormState", "useFormStatus", "version"];
|
|
14
|
+
export declare const HOST_REACT_DOM_CLIENT_EXPORT_NAMES: readonly ["createRoot", "hydrateRoot", "version"];
|
|
15
|
+
/** Specifier → export names used when building the host import map. */
|
|
16
|
+
export declare const HOST_IMPORT_EXPORT_NAMES: {
|
|
17
|
+
readonly react: readonly ["Activity", "Children", "Component", "Fragment", "Profiler", "PureComponent", "StrictMode", "Suspense", "cache", "cacheSignal", "cloneElement", "createContext", "createElement", "createRef", "forwardRef", "isValidElement", "lazy", "memo", "startTransition", "use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useEffectEvent", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition", "version"];
|
|
18
|
+
readonly 'react/jsx-runtime': readonly ["Fragment", "jsx", "jsxs"];
|
|
19
|
+
readonly 'react/jsx-dev-runtime': readonly ["Fragment", "jsxDEV"];
|
|
20
|
+
readonly 'react-dom': readonly ["createPortal", "flushSync", "preconnect", "prefetchDNS", "preinit", "preinitModule", "preload", "preloadModule", "requestFormReset", "useFormState", "useFormStatus", "version"];
|
|
21
|
+
readonly 'react-dom/client': readonly ["createRoot", "hydrateRoot", "version"];
|
|
22
|
+
};
|
|
23
|
+
/** ESM shim source that re-exports a namespace already registered on globalThis. */
|
|
24
|
+
export declare function createNamespaceShimSource(specifier: string, exportNames: readonly string[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* Build an import map document using data: URLs (SSR-safe; no blob:).
|
|
27
|
+
* Export names come from an explicit allowlist, not Object.keys(runtimeNamespace).
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildHostImportMap(exportsBySpecifier: Record<string, readonly string[]>): {
|
|
30
|
+
imports: Record<string, string>;
|
|
31
|
+
};
|
|
32
|
+
/** Populate globalThis so data: shim modules can resolve host exports. */
|
|
33
|
+
export declare function registerHostModules(modules: Record<string, object>): void;
|
|
34
|
+
/**
|
|
35
|
+
* True when a dynamic import failed because the host import map was missing,
|
|
36
|
+
* rejected (inserted too late), did not cover a bare specifier, or the shim
|
|
37
|
+
* ran before registerHostModules.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isImportMapResolutionError(error: unknown): boolean;
|
|
40
|
+
//# sourceMappingURL=host-import-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-import-map.d.ts","sourceRoot":"","sources":["../../../src/components/site-renderers/host-import-map.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,sCAAsC,CAAC;AACpE,eAAO,MAAM,eAAe,kCAAkC,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,okBAwC1B,CAAC;AAEX,eAAO,MAAM,6BAA6B,sCAAuC,CAAC;AAElF,eAAO,MAAM,iCAAiC,iCAAkC,CAAC;AAEjF,yFAAyF;AACzF,eAAO,MAAM,2BAA2B,6LAa9B,CAAC;AAEX,eAAO,MAAM,kCAAkC,mDAAoD,CAAC;AAEpG,uEAAuE;AACvE,eAAO,MAAM,wBAAwB;;;;;;CAM3B,CAAC;AAsBX,oFAAoF;AACpF,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,MAAM,CAUR;AAOD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,GAAG;IACzF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAMA;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAKlE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQlE"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export const HOST_MODULES_KEY = '__CURVENOTE_HOST_IMPORT_MODULES__';
|
|
2
|
+
export const IMPORT_MAP_ATTR = 'data-curvenote-host-importmap';
|
|
3
|
+
/**
|
|
4
|
+
* Stable public React exports shared by SSR and client import-map shims.
|
|
5
|
+
* Deliberately excludes development-only exports (act, captureOwnerStack) and
|
|
6
|
+
* internals so Object.keys() differences between React builds cannot diverge
|
|
7
|
+
* the emitted map.
|
|
8
|
+
*/
|
|
9
|
+
export const HOST_REACT_EXPORT_NAMES = [
|
|
10
|
+
'Activity',
|
|
11
|
+
'Children',
|
|
12
|
+
'Component',
|
|
13
|
+
'Fragment',
|
|
14
|
+
'Profiler',
|
|
15
|
+
'PureComponent',
|
|
16
|
+
'StrictMode',
|
|
17
|
+
'Suspense',
|
|
18
|
+
'cache',
|
|
19
|
+
'cacheSignal',
|
|
20
|
+
'cloneElement',
|
|
21
|
+
'createContext',
|
|
22
|
+
'createElement',
|
|
23
|
+
'createRef',
|
|
24
|
+
'forwardRef',
|
|
25
|
+
'isValidElement',
|
|
26
|
+
'lazy',
|
|
27
|
+
'memo',
|
|
28
|
+
'startTransition',
|
|
29
|
+
'use',
|
|
30
|
+
'useActionState',
|
|
31
|
+
'useCallback',
|
|
32
|
+
'useContext',
|
|
33
|
+
'useDebugValue',
|
|
34
|
+
'useDeferredValue',
|
|
35
|
+
'useEffect',
|
|
36
|
+
'useEffectEvent',
|
|
37
|
+
'useId',
|
|
38
|
+
'useImperativeHandle',
|
|
39
|
+
'useInsertionEffect',
|
|
40
|
+
'useLayoutEffect',
|
|
41
|
+
'useMemo',
|
|
42
|
+
'useOptimistic',
|
|
43
|
+
'useReducer',
|
|
44
|
+
'useRef',
|
|
45
|
+
'useState',
|
|
46
|
+
'useSyncExternalStore',
|
|
47
|
+
'useTransition',
|
|
48
|
+
'version',
|
|
49
|
+
];
|
|
50
|
+
export const HOST_JSX_RUNTIME_EXPORT_NAMES = ['Fragment', 'jsx', 'jsxs'];
|
|
51
|
+
export const HOST_JSX_DEV_RUNTIME_EXPORT_NAMES = ['Fragment', 'jsxDEV'];
|
|
52
|
+
/** Stable public react-dom exports; private internals and unstable APIs are excluded. */
|
|
53
|
+
export const HOST_REACT_DOM_EXPORT_NAMES = [
|
|
54
|
+
'createPortal',
|
|
55
|
+
'flushSync',
|
|
56
|
+
'preconnect',
|
|
57
|
+
'prefetchDNS',
|
|
58
|
+
'preinit',
|
|
59
|
+
'preinitModule',
|
|
60
|
+
'preload',
|
|
61
|
+
'preloadModule',
|
|
62
|
+
'requestFormReset',
|
|
63
|
+
'useFormState',
|
|
64
|
+
'useFormStatus',
|
|
65
|
+
'version',
|
|
66
|
+
];
|
|
67
|
+
export const HOST_REACT_DOM_CLIENT_EXPORT_NAMES = ['createRoot', 'hydrateRoot', 'version'];
|
|
68
|
+
/** Specifier → export names used when building the host import map. */
|
|
69
|
+
export const HOST_IMPORT_EXPORT_NAMES = {
|
|
70
|
+
react: HOST_REACT_EXPORT_NAMES,
|
|
71
|
+
'react/jsx-runtime': HOST_JSX_RUNTIME_EXPORT_NAMES,
|
|
72
|
+
'react/jsx-dev-runtime': HOST_JSX_DEV_RUNTIME_EXPORT_NAMES,
|
|
73
|
+
'react-dom': HOST_REACT_DOM_EXPORT_NAMES,
|
|
74
|
+
'react-dom/client': HOST_REACT_DOM_CLIENT_EXPORT_NAMES,
|
|
75
|
+
};
|
|
76
|
+
function getHostModules() {
|
|
77
|
+
const g = globalThis;
|
|
78
|
+
g[HOST_MODULES_KEY] ??= {};
|
|
79
|
+
return g[HOST_MODULES_KEY];
|
|
80
|
+
}
|
|
81
|
+
function isValidExportName(name) {
|
|
82
|
+
return name !== 'default' && /^[$A-Z_a-z][\w$]*$/.test(name);
|
|
83
|
+
}
|
|
84
|
+
function encodeBase64Utf8(text) {
|
|
85
|
+
if (typeof Buffer !== 'undefined') {
|
|
86
|
+
return Buffer.from(text, 'utf8').toString('base64');
|
|
87
|
+
}
|
|
88
|
+
// Shim sources are ASCII-only; btoa is sufficient in browsers without Buffer.
|
|
89
|
+
return btoa(text);
|
|
90
|
+
}
|
|
91
|
+
/** ESM shim source that re-exports a namespace already registered on globalThis. */
|
|
92
|
+
export function createNamespaceShimSource(specifier, exportNames) {
|
|
93
|
+
const names = exportNames.filter(isValidExportName).sort();
|
|
94
|
+
return `
|
|
95
|
+
const __ns = globalThis[${JSON.stringify(HOST_MODULES_KEY)}]?.[${JSON.stringify(specifier)}];
|
|
96
|
+
if (!__ns) {
|
|
97
|
+
throw new Error(${JSON.stringify(`host modules not registered for ${specifier}`)});
|
|
98
|
+
}
|
|
99
|
+
export default __ns.default ?? __ns;
|
|
100
|
+
${names.map((name) => `export const ${name} = __ns[${JSON.stringify(name)}];`).join('\n')}
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
function createNamespaceShimDataUrl(specifier, exportNames) {
|
|
104
|
+
const source = createNamespaceShimSource(specifier, exportNames);
|
|
105
|
+
return `data:text/javascript;base64,${encodeBase64Utf8(source)}`;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Build an import map document using data: URLs (SSR-safe; no blob:).
|
|
109
|
+
* Export names come from an explicit allowlist, not Object.keys(runtimeNamespace).
|
|
110
|
+
*/
|
|
111
|
+
export function buildHostImportMap(exportsBySpecifier) {
|
|
112
|
+
const imports = {};
|
|
113
|
+
for (const [specifier, exportNames] of Object.entries(exportsBySpecifier)) {
|
|
114
|
+
imports[specifier] = createNamespaceShimDataUrl(specifier, exportNames);
|
|
115
|
+
}
|
|
116
|
+
return { imports };
|
|
117
|
+
}
|
|
118
|
+
/** Populate globalThis so data: shim modules can resolve host exports. */
|
|
119
|
+
export function registerHostModules(modules) {
|
|
120
|
+
const hostModules = getHostModules();
|
|
121
|
+
for (const [specifier, namespace] of Object.entries(modules)) {
|
|
122
|
+
hostModules[specifier] = namespace;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* True when a dynamic import failed because the host import map was missing,
|
|
127
|
+
* rejected (inserted too late), did not cover a bare specifier, or the shim
|
|
128
|
+
* ran before registerHostModules.
|
|
129
|
+
*/
|
|
130
|
+
export function isImportMapResolutionError(error) {
|
|
131
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
132
|
+
return (/import map/i.test(message) ||
|
|
133
|
+
/Failed to resolve module specifier/i.test(message) ||
|
|
134
|
+
/Relative references must start with/i.test(message) ||
|
|
135
|
+
/host modules not registered/i.test(message));
|
|
136
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as ReactNamespace from 'react';
|
|
2
|
+
import * as ReactDOMNamespace from 'react-dom';
|
|
3
|
+
import * as ReactDOMClientNamespace from 'react-dom/client';
|
|
4
|
+
import * as JsxRuntime from 'react/jsx-runtime';
|
|
5
|
+
import * as JsxDevRuntime from 'react/jsx-dev-runtime';
|
|
6
|
+
/** Runtime namespaces corresponding exactly to the supported host import-map specifiers. */
|
|
7
|
+
export declare const HOST_REACT_MODULES: {
|
|
8
|
+
react: typeof ReactNamespace;
|
|
9
|
+
'react/jsx-runtime': typeof JsxRuntime;
|
|
10
|
+
'react/jsx-dev-runtime': typeof JsxDevRuntime;
|
|
11
|
+
'react-dom': typeof ReactDOMNamespace;
|
|
12
|
+
'react-dom/client': typeof ReactDOMClientNamespace;
|
|
13
|
+
};
|
|
14
|
+
export declare function registerReactHostModules(): void;
|
|
15
|
+
//# sourceMappingURL=host-react-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-react-modules.d.ts","sourceRoot":"","sources":["../../../src/components/site-renderers/host-react-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,iBAAiB,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,aAAa,MAAM,uBAAuB,CAAC;AAGvD,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB;;;;;;CAM9B,CAAC;AAEF,wBAAgB,wBAAwB,SAEvC"}
|