@curvenote/theme-ui 1.0.1 → 2.0.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.
Files changed (166) hide show
  1. package/dist/components/layout/app-layout.d.ts +1 -1
  2. package/dist/components/layout/app-layout.d.ts.map +1 -1
  3. package/dist/components/layout/app-layout.js +6 -5
  4. package/dist/components/layout/app-sidebar.d.ts.map +1 -1
  5. package/dist/components/layout/app-sidebar.js +10 -6
  6. package/dist/components/layout/article-layout.d.ts +1 -1
  7. package/dist/components/layout/article-layout.d.ts.map +1 -1
  8. package/dist/components/layout/article-layout.js +6 -7
  9. package/dist/components/layout/header.js +1 -1
  10. package/dist/components/layout/index.d.ts +1 -0
  11. package/dist/components/layout/index.d.ts.map +1 -1
  12. package/dist/components/layout/index.js +1 -0
  13. package/dist/components/layout/loading-bar.d.ts +8 -1
  14. package/dist/components/layout/loading-bar.d.ts.map +1 -1
  15. package/dist/components/layout/loading-bar.js +12 -4
  16. package/dist/components/layout/site-header.d.ts +6 -1
  17. package/dist/components/layout/site-header.d.ts.map +1 -1
  18. package/dist/components/layout/site-header.js +7 -4
  19. package/dist/components/layout/types.d.ts +6 -0
  20. package/dist/components/layout/types.d.ts.map +1 -1
  21. package/dist/components/providers/analytics-boundary.d.ts +18 -0
  22. package/dist/components/providers/analytics-boundary.d.ts.map +1 -0
  23. package/dist/components/providers/analytics-boundary.js +53 -0
  24. package/dist/components/providers/analytics-dev-log.d.ts +11 -0
  25. package/dist/components/providers/analytics-dev-log.d.ts.map +1 -0
  26. package/dist/components/providers/analytics-dev-log.js +46 -0
  27. package/dist/components/providers/analytics-dev-tray.d.ts +2 -0
  28. package/dist/components/providers/analytics-dev-tray.d.ts.map +1 -0
  29. package/dist/components/providers/analytics-dev-tray.js +56 -0
  30. package/dist/components/providers/article-versions-provider.d.ts +19 -0
  31. package/dist/components/providers/article-versions-provider.d.ts.map +1 -0
  32. package/dist/components/providers/article-versions-provider.js +13 -0
  33. package/dist/components/providers/curvenote-providers.d.ts +12 -13
  34. package/dist/components/providers/curvenote-providers.d.ts.map +1 -1
  35. package/dist/components/providers/curvenote-providers.js +20 -27
  36. package/dist/components/providers/design.d.ts +3 -33
  37. package/dist/components/providers/design.d.ts.map +1 -1
  38. package/dist/components/providers/design.js +64 -21
  39. package/dist/components/providers/index.d.ts +4 -2
  40. package/dist/components/providers/index.d.ts.map +1 -1
  41. package/dist/components/providers/index.js +3 -1
  42. package/dist/components/providers/lightbox-provider.d.ts +8 -0
  43. package/dist/components/providers/lightbox-provider.d.ts.map +1 -1
  44. package/dist/components/providers/lightbox-provider.js +28 -5
  45. package/dist/components/providers/overlay-depth.d.ts +16 -0
  46. package/dist/components/providers/overlay-depth.d.ts.map +1 -0
  47. package/dist/components/providers/overlay-depth.js +16 -0
  48. package/dist/components/providers/ping-boundary.d.ts +3 -1
  49. package/dist/components/providers/ping-boundary.d.ts.map +1 -1
  50. package/dist/components/providers/ping-boundary.js +7 -4
  51. package/dist/components/providers/platform-providers.d.ts +0 -7
  52. package/dist/components/providers/platform-providers.d.ts.map +1 -1
  53. package/dist/components/providers/platform-providers.js +0 -14
  54. package/dist/components/ui/abbreviations.d.ts +3 -1
  55. package/dist/components/ui/abbreviations.d.ts.map +1 -1
  56. package/dist/components/ui/abbreviations.js +13 -6
  57. package/dist/components/ui/accessibility-skip-to.d.ts +13 -3
  58. package/dist/components/ui/accessibility-skip-to.d.ts.map +1 -1
  59. package/dist/components/ui/accessibility-skip-to.js +4 -1
  60. package/dist/components/ui/arrow.d.ts +6 -0
  61. package/dist/components/ui/arrow.d.ts.map +1 -0
  62. package/dist/components/ui/arrow.js +15 -0
  63. package/dist/components/ui/article-actions-downloads.d.ts.map +1 -1
  64. package/dist/components/ui/article-actions-downloads.js +74 -7
  65. package/dist/components/ui/article-actions-dropdown.d.ts +2 -1
  66. package/dist/components/ui/article-actions-dropdown.d.ts.map +1 -1
  67. package/dist/components/ui/article-actions-dropdown.js +102 -21
  68. package/dist/components/ui/article-actions-share.d.ts +18 -0
  69. package/dist/components/ui/article-actions-share.d.ts.map +1 -1
  70. package/dist/components/ui/article-actions-share.js +38 -2
  71. package/dist/components/ui/article-actions.d.ts.map +1 -1
  72. package/dist/components/ui/article-actions.js +16 -3
  73. package/dist/components/ui/article-bar.d.ts +3 -1
  74. package/dist/components/ui/article-bar.d.ts.map +1 -1
  75. package/dist/components/ui/article-bar.js +19 -5
  76. package/dist/components/ui/article-card.js +1 -1
  77. package/dist/components/ui/author-popover.d.ts +2 -1
  78. package/dist/components/ui/author-popover.d.ts.map +1 -1
  79. package/dist/components/ui/author-popover.js +42 -7
  80. package/dist/components/ui/backmatter.d.ts.map +1 -1
  81. package/dist/components/ui/backmatter.js +23 -5
  82. package/dist/components/ui/banner.d.ts.map +1 -1
  83. package/dist/components/ui/banner.js +1 -1
  84. package/dist/components/ui/bibliography.d.ts +2 -2
  85. package/dist/components/ui/bibliography.d.ts.map +1 -1
  86. package/dist/components/ui/bibliography.js +10 -9
  87. package/dist/components/ui/button.d.ts +1 -1
  88. package/dist/components/ui/button.d.ts.map +1 -1
  89. package/dist/components/ui/button.js +2 -0
  90. package/dist/components/ui/calendar.d.ts +10 -0
  91. package/dist/components/ui/calendar.d.ts.map +1 -0
  92. package/dist/components/ui/calendar.js +85 -0
  93. package/dist/components/ui/citation.d.ts +2 -2
  94. package/dist/components/ui/citation.d.ts.map +1 -1
  95. package/dist/components/ui/citation.js +45 -15
  96. package/dist/components/ui/collapsible-backmatter-section.d.ts +28 -0
  97. package/dist/components/ui/collapsible-backmatter-section.d.ts.map +1 -0
  98. package/dist/components/ui/collapsible-backmatter-section.js +52 -0
  99. package/dist/components/ui/cookie-banner.d.ts +1 -1
  100. package/dist/components/ui/cookie-banner.d.ts.map +1 -1
  101. package/dist/components/ui/cookie-banner.js +9 -2
  102. package/dist/components/ui/document-outline.d.ts.map +1 -1
  103. package/dist/components/ui/document-outline.js +38 -20
  104. package/dist/components/ui/footer-links.d.ts.map +1 -1
  105. package/dist/components/ui/footer-links.js +4 -0
  106. package/dist/components/ui/frontmatter-badges.d.ts +15 -5
  107. package/dist/components/ui/frontmatter-badges.d.ts.map +1 -1
  108. package/dist/components/ui/frontmatter-badges.js +41 -15
  109. package/dist/components/ui/frontmatter.js +1 -1
  110. package/dist/components/ui/hash-link.d.ts +56 -0
  111. package/dist/components/ui/hash-link.d.ts.map +1 -0
  112. package/dist/components/ui/hash-link.js +83 -0
  113. package/dist/components/ui/image.d.ts +5 -2
  114. package/dist/components/ui/image.d.ts.map +1 -1
  115. package/dist/components/ui/image.js +10 -8
  116. package/dist/components/ui/index.d.ts +10 -2
  117. package/dist/components/ui/index.d.ts.map +1 -1
  118. package/dist/components/ui/index.js +9 -2
  119. package/dist/components/ui/keywords.d.ts +4 -0
  120. package/dist/components/ui/keywords.d.ts.map +1 -0
  121. package/dist/components/ui/keywords.js +18 -0
  122. package/dist/components/ui/label.d.ts +4 -0
  123. package/dist/components/ui/label.d.ts.map +1 -0
  124. package/dist/components/ui/label.js +6 -0
  125. package/dist/components/ui/license-description.d.ts.map +1 -1
  126. package/dist/components/ui/license-description.js +8 -5
  127. package/dist/components/ui/license-frontmatter.d.ts.map +1 -1
  128. package/dist/components/ui/license-frontmatter.js +14 -3
  129. package/dist/components/ui/lightbox-container.d.ts.map +1 -1
  130. package/dist/components/ui/lightbox-container.js +2 -2
  131. package/dist/components/ui/lightbox.d.ts +3 -1
  132. package/dist/components/ui/lightbox.d.ts.map +1 -1
  133. package/dist/components/ui/lightbox.js +155 -25
  134. package/dist/components/ui/link-card.d.ts +2 -1
  135. package/dist/components/ui/link-card.d.ts.map +1 -1
  136. package/dist/components/ui/link-card.js +2 -2
  137. package/dist/components/ui/pagination.d.ts +15 -0
  138. package/dist/components/ui/pagination.d.ts.map +1 -0
  139. package/dist/components/ui/pagination.js +31 -0
  140. package/dist/components/ui/popover.js +1 -1
  141. package/dist/components/ui/search.d.ts +2 -1
  142. package/dist/components/ui/search.d.ts.map +1 -1
  143. package/dist/components/ui/search.js +24 -8
  144. package/dist/components/ui/select.d.ts +16 -0
  145. package/dist/components/ui/select.d.ts.map +1 -0
  146. package/dist/components/ui/select.js +38 -0
  147. package/dist/components/ui/separator.js +1 -1
  148. package/dist/components/ui/sidebar.d.ts +2 -12
  149. package/dist/components/ui/sidebar.d.ts.map +1 -1
  150. package/dist/components/ui/sidebar.js +2 -34
  151. package/dist/components/ui/tooltip.d.ts +4 -2
  152. package/dist/components/ui/tooltip.d.ts.map +1 -1
  153. package/dist/components/ui/tooltip.js +5 -4
  154. package/dist/components/ui/types.d.ts +9 -8
  155. package/dist/components/ui/types.d.ts.map +1 -1
  156. package/dist/components/ui/types.js +1 -0
  157. package/dist/lib/dedupeAbbreviations.d.ts +10 -0
  158. package/dist/lib/dedupeAbbreviations.d.ts.map +1 -0
  159. package/dist/lib/dedupeAbbreviations.js +36 -0
  160. package/dist/lib/knownParts.d.ts +18 -0
  161. package/dist/lib/knownParts.d.ts.map +1 -1
  162. package/dist/lib/knownParts.js +38 -1
  163. package/package.json +12 -9
  164. package/dist/components/providers/types.d.ts +0 -30
  165. package/dist/components/providers/types.d.ts.map +0 -1
  166. package/dist/components/providers/types.js +0 -1
@@ -1,15 +1,7 @@
1
- import type { SiteDTO, JournalThemeConfig, ArticleThemeConfig } from '@curvenote/common';
2
- import { type ExtendedCoreOptions } from '@curvenote/bridge-jupyter';
1
+ import type { JournalThemeConfig, ArticleThemeConfig, DesignOptions, DesignPresetConfig } from '@curvenote/common';
2
+ import { type ExtendedCoreOptions, type PingFn } from '@curvenote/bridge-jupyter';
3
3
  import { type SiteManifest } from 'myst-config';
4
- import { type DesignPresetName } from './design';
5
4
  type ManifestProject = Required<SiteManifest>['projects'][0];
6
- /**
7
- * merge the incoming dynamic site config with the hard coded theme config
8
- * this allows a particular site to configure the theme by overriding the built
9
- * in theme config
10
- * @returns
11
- */
12
- export declare function makeSiteTheme(site: SiteDTO): import("./types").JournalTheme;
13
5
  /**
14
6
  * Based on the article SubmissionKind, resolve the theme config options for that kind, if specified,
15
7
  * pulling up defaults from the base theme.config.articles object and theme.config.jupyter object as needed
@@ -18,7 +10,7 @@ export declare function makeSiteTheme(site: SiteDTO): import("./types").JournalT
18
10
  * @param config
19
11
  * @returns - a resolved set of options that can be applied to the article without the need for further fallback logic
20
12
  */
21
- export declare function resolveArticleConfigOptions(kindName: string, config: JournalThemeConfig): ArticleThemeConfig;
13
+ export declare function resolveArticleConfigOptions(kindName: string, config?: JournalThemeConfig): ArticleThemeConfig;
22
14
  export declare function resolveThemeAndProjectComputeOptions(resolvedArticleConfig: ArticleThemeConfig, project: Required<SiteManifest>['projects'][0]): ArticleThemeConfig;
23
15
  type RepoProviderSpec = any;
24
16
  export declare function getCustomRepoProviders(names: string[]): RepoProviderSpec[];
@@ -41,12 +33,19 @@ export declare function getAdditionalThemeComputeConfig(resolvedConfig: ArticleT
41
33
  noMecaBundle: boolean | undefined;
42
34
  };
43
35
  };
36
+ type CurvenoteDesignConfig = DesignPresetConfig | DesignOptions;
44
37
  export declare function getFullyQualifiedUrlToMECABundle(project: ManifestProject): string | null;
45
- export declare function CurvenoteProviders({ children, submissionKind, designPreset, mode, }: {
38
+ export declare function CurvenoteProviders({ children, submissionKind, design, mode, pingFn: providedPingFn, }: {
46
39
  children: React.ReactNode;
47
40
  submissionKind: string;
48
- designPreset?: DesignPresetName;
41
+ design?: CurvenoteDesignConfig | CurvenoteDesignConfig[];
49
42
  mode?: 'development' | 'production';
43
+ /**
44
+ * Optional ping function with route-specific metadata.
45
+ * If provided, this will be used for bridge-jupyter LogBoundary instead of the default.
46
+ * This allows routes to curry in metadata like workVersionId, articleTitle, etc.
47
+ */
48
+ pingFn?: PingFn;
50
49
  }): import("react/jsx-runtime").JSX.Element;
51
50
  export {};
52
51
  //# 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":[],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,EAAE,gBAAgB,CAAC;IAChC,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;CACrC,2CAmDA"}
1
+ {"version":3,"file":"curvenote-providers.d.ts","sourceRoot":"","sources":["../../../src/components/providers/curvenote-providers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,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;AAchD,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,kBAAkB,GAC1B,kBAAkB,CAyBpB;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;AA2B5B,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;;;;;;;8BAKH,mBAAmB;;;;;;;EAwDrD;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,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;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,2CA0DA"}
@@ -1,29 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ComputeOptionsProvider, ConnectionStatusTray, } from '@curvenote/bridge-jupyter';
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';
5
6
  import { ComputeProvider } from './compute';
6
7
  import { checkHasMECAExport } from '../../lib';
7
8
  import { useImages } from './lightbox-provider';
8
- import merge from 'lodash.merge';
9
9
  import { jupyterHubStreamingConnectFnFactory } from './connect';
10
- import { defaultTheme, usePlatformTheme } from './platform-providers';
11
10
  import { LightboxContainer } from '../ui/lightbox-container';
12
- import { DESIGN_PRESETS, DesignProvider } from './design';
13
- import { useIsIndexPage, usePage } from './page-providers';
14
- /**
15
- * merge the incoming dynamic site config with the hard coded theme config
16
- * this allows a particular site to configure the theme by overriding the built
17
- * in theme config
18
- * @returns
19
- */
20
- export function makeSiteTheme(site) {
21
- if (!site.theme_config)
22
- return defaultTheme;
23
- // prune any keys that we don't want to allow configuration of
24
- const { name, custom, ...configurable } = site.theme_config;
25
- return { ...defaultTheme, config: merge({}, defaultTheme.config, configurable) };
26
- }
11
+ import { DesignProvider } from './design';
12
+ import { usePage } from './page-providers';
13
+ import { usePingFn } from './ping-boundary';
14
+ import { usePlatformSite } from './platform-providers';
27
15
  /**
28
16
  * Based on the article SubmissionKind, resolve the theme config options for that kind, if specified,
29
17
  * pulling up defaults from the base theme.config.articles object and theme.config.jupyter object as needed
@@ -33,6 +21,8 @@ export function makeSiteTheme(site) {
33
21
  * @returns - a resolved set of options that can be applied to the article without the need for further fallback logic
34
22
  */
35
23
  export function resolveArticleConfigOptions(kindName, config) {
24
+ if (!config)
25
+ return {};
36
26
  // get jupyter settings for this kind
37
27
  const { jupyter: byKindJupyter, ...options } = config.articles?.byKind?.[kindName] ?? config.articles?.byKind?.[kindName?.toLowerCase()] ?? {};
38
28
  // get the jupyter default settings for articles
@@ -61,7 +51,7 @@ export function resolveThemeAndProjectComputeOptions(resolvedArticleConfig, proj
61
51
  if (resolvedArticleConfig.jupyter?.mecaBundle && !checkHasMECAExport(project)) {
62
52
  resolvedArticleConfig.jupyter = { ...resolvedArticleConfig.jupyter, enable: false };
63
53
  if (typeof window !== 'undefined') {
64
- console.warn('⚠️ Compute Disabled - MECA bundle not found but is required. Please add a MECA export to your project to build the MECA bundle and enable compute');
54
+ console.debug('⚠️ Compute Disabled - MECA bundle not found but is required. Please add a MECA export to your project to build the MECA bundle and enable compute');
65
55
  }
66
56
  }
67
57
  if (!resolvedArticleConfig.jupyter?.mecaBundle &&
@@ -166,13 +156,12 @@ export function getFullyQualifiedUrlToMECABundle(project) {
166
156
  const meca = (project?.exports).find((e) => e.format === 'meca');
167
157
  return meca?.url ?? null;
168
158
  }
169
- export function CurvenoteProviders({ children, submissionKind = 'SITE_PAGES', designPreset = 'book', mode = 'production', }) {
159
+ export function CurvenoteProviders({ children, submissionKind = 'SITE_PAGES', design, mode = 'production', pingFn: providedPingFn, }) {
160
+ const platformSite = usePlatformSite();
170
161
  const site = useSiteManifest();
171
162
  const project = useProjectManifest();
172
163
  const page = usePage();
173
- const isIndex = useIsIndexPage();
174
- const theme = usePlatformTheme();
175
- const config = resolveArticleConfigOptions(submissionKind, theme.config);
164
+ const config = resolveArticleConfigOptions(submissionKind, platformSite.theme_config);
176
165
  const references = useReferences();
177
166
  const articleConfig = resolveThemeAndProjectComputeOptions(config, project);
178
167
  const mecaUrl = getFullyQualifiedUrlToMECABundle(project);
@@ -190,10 +179,14 @@ export function CurvenoteProviders({ children, submissionKind = 'SITE_PAGES', de
190
179
  openInServerRoot: (enable && resolved?.jupyter?.openInServerRoot) ?? false,
191
180
  openInServerTargetPath: (enable && resolved?.jupyter?.openInServerTargetPath) ?? undefined,
192
181
  };
182
+ const globalBaseDesign = platformSite.theme_config?.design?.$base;
193
183
  const baseDesignOptions = site?.options;
194
184
  const articleDesignOptions = page?.frontmatter?.site;
195
- const designPresetOptions = DESIGN_PRESETS[designPreset];
196
- const presetBase = designPresetOptions?.base;
197
- const presetPage = isIndex ? designPresetOptions?.index : designPresetOptions?.page;
198
- return (_jsx(DesignProvider, { designs: [presetBase, presetPage, baseDesignOptions, articleDesignOptions], children: _jsx(ComputeOptionsProvider, { features: features, optionOverrideFn: resolved?.optionOverrideFn, customRepoProviders: resolved?.customRepoProviders, customConnectFn: resolved?.customConnectFn, children: _jsxs(ComputeProvider, { article: page, children: [_jsx(LightboxContainer, { imageList: images, children: children }), _jsx(ConnectionStatusTray, {})] }) }) }));
185
+ const routeDesigns = Array.isArray(design) ? design.filter(Boolean) : design ? [design] : [];
186
+ // Get the ping function from PingBoundary to connect bridge-jupyter LogBoundary
187
+ // Use provided pingFn if available (with route-specific metadata), otherwise use default
188
+ const defaultPingFn = usePingFn();
189
+ const pingFn = providedPingFn ?? defaultPingFn;
190
+ const analyticsCapture = useAnalytics();
191
+ return (_jsx(DesignProvider, { designs: [globalBaseDesign, ...routeDesigns, baseDesignOptions, articleDesignOptions], children: _jsx(ComputeOptionsProvider, { features: features, optionOverrideFn: resolved?.optionOverrideFn, customRepoProviders: resolved?.customRepoProviders, customConnectFn: resolved?.customConnectFn, children: _jsx(LogBoundary, { pingFn: pingFn, analyticsCapture: analyticsCapture, children: _jsxs(ComputeProvider, { article: page, children: [_jsx(LightboxContainer, { imageList: images, children: children }), _jsx(ConnectionStatusTray, {})] }) }) }) }));
199
192
  }
@@ -1,39 +1,9 @@
1
+ import type { DesignPresetName, DesignPresetConfig, DesignOptions } from '@curvenote/common';
1
2
  import React from 'react';
2
- export type Image = {
3
- url: string;
4
- };
5
- export type DesignOptions = {
6
- preset?: 'article' | 'book';
7
- logo?: Image;
8
- logo_dark?: Image;
9
- favicon?: Image;
10
- layout?: 'article' | 'app';
11
- frontmatter_layout?: 'article' | 'blog';
12
- hide_outline?: boolean;
13
- hide_top_nav?: boolean;
14
- hide_toc?: boolean;
15
- hide_footer_links?: boolean;
16
- hide_backmatter?: boolean;
17
- hide_title_block?: boolean;
18
- hide_abbreviation_list?: boolean;
19
- hide_bibliography?: boolean;
20
- hide_license_description?: boolean;
21
- hide_footnotes?: boolean;
22
- hide_search?: boolean;
23
- hide_downloads?: boolean;
24
- disable_search?: boolean;
25
- outline_maxdepth?: number;
26
- };
27
- export type DesignPresetName = 'landing' | 'single_article' | 'single_article_supporting' | 'book' | string;
28
- export type PresetConfig = {
29
- base?: DesignOptions;
30
- index?: DesignOptions;
31
- page?: DesignOptions;
32
- };
33
- export declare const DESIGN_PRESETS: Record<DesignPresetName, PresetConfig>;
3
+ export declare const DESIGN_PRESETS: Record<DesignPresetName, Omit<DesignPresetConfig, 'preset'>>;
34
4
  export declare function DesignProvider({ children, designs, }: {
35
5
  children: React.ReactNode;
36
- designs: (Record<string, any> | undefined)[];
6
+ designs: (DesignPresetConfig | DesignOptions | undefined)[];
37
7
  }): import("react/jsx-runtime").JSX.Element;
38
8
  export declare function useDesign(): DesignOptions;
39
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,KAAoC,MAAM,OAAO,CAAC;AAEzD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MA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C,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;CAC9C,2CAIA;AAED,wBAAgB,SAAS,IAAI,aAAa,CAGzC"}
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,CAwCvF,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,2CAKA;AAED,wBAAgB,SAAS,IAAI,aAAa,CAoBzC"}
@@ -1,50 +1,93 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useProjectManifest, useReferences } from '@myst-theme/providers';
2
3
  import React, { createContext, useContext } from 'react';
4
+ import { select } from 'unist-util-select';
5
+ import { useIsIndexPage } from './page-providers';
3
6
  export const DESIGN_PRESETS = {
4
7
  landing: {
5
- index: {
8
+ base: {
6
9
  layout: 'article',
7
- hide_outline: true,
8
- hide_title_block: true,
10
+ hide_title_block: 'hero',
11
+ hide_article_bar: true,
9
12
  hide_search: true,
10
13
  hide_downloads: true,
14
+ hide_exports: true,
15
+ hide_footer_links: true,
16
+ hide_abbreviation_list: true,
17
+ hide_bibliography: true,
18
+ hide_footnotes: false,
19
+ hide_outline: true,
11
20
  },
12
- page: {
13
- layout: 'article',
14
- },
15
- },
16
- single_article: {
17
- index: {
18
- layout: 'article',
19
- hide_search: true,
20
- },
21
- page: {
22
- layout: 'app',
23
- },
21
+ index: {},
22
+ page: {},
24
23
  },
25
- single_article_supporting: {
24
+ article: {
26
25
  base: {
27
- layout: 'app',
28
26
  hide_search: true,
27
+ hide_exports: true,
28
+ },
29
+ index: {
30
+ layout: 'app_if_multipage',
29
31
  },
30
- index: {},
31
32
  page: {
33
+ layout: 'app',
34
+ hide_article_bar: true,
35
+ hide_authors_list: true,
32
36
  hide_license_description: true,
37
+ hide_acknowledgements: true,
38
+ hide_data_availability: true,
33
39
  },
34
40
  },
35
41
  book: {
36
42
  base: {
37
43
  layout: 'app',
38
- hide_search: true,
39
44
  },
40
45
  },
41
46
  };
42
47
  const DesignContext = createContext(undefined);
48
+ function isDesignPresetConfig(design) {
49
+ return (typeof design === 'object' &&
50
+ design !== null &&
51
+ Object.keys(design).length <= 4 &&
52
+ Object.keys(design).every((key) => ['preset', 'base', 'index', 'page'].includes(key)));
53
+ }
54
+ function mergeDesignOptions(designs, opts) {
55
+ return designs.filter(Boolean).reduce((acc, curr) => {
56
+ if (isDesignPresetConfig(curr)) {
57
+ const preset = curr.preset && DESIGN_PRESETS[curr.preset];
58
+ if (preset) {
59
+ return {
60
+ ...acc,
61
+ ...preset.base,
62
+ ...(opts.isIndex ? preset.index : preset.page),
63
+ ...curr.base,
64
+ ...(opts.isIndex ? curr.index : curr.page),
65
+ };
66
+ }
67
+ return { ...acc, ...curr.base, ...(opts.isIndex ? curr.index : curr.page) };
68
+ }
69
+ return { ...acc, ...curr };
70
+ }, {});
71
+ }
43
72
  export function DesignProvider({ children, designs, }) {
44
- const designOptions = designs.filter(Boolean).reduce((acc, curr) => ({ ...acc, ...curr }), {});
73
+ const isIndex = useIsIndexPage();
74
+ const designOptions = mergeDesignOptions(designs, { isIndex });
45
75
  return _jsx(DesignContext.Provider, { value: designOptions, children: children });
46
76
  }
47
77
  export function useDesign() {
78
+ const references = useReferences();
79
+ const project = useProjectManifest();
48
80
  const contextDesign = useContext(DesignContext);
49
- return contextDesign ?? {};
81
+ if (!contextDesign)
82
+ return {};
83
+ // if the hide_title_block is 'hero', then we need to check if the article contains a hero section
84
+ const hideTitleBlock = contextDesign.hide_title_block === 'hero'
85
+ ? select('block[kind=hero]', references?.article) != null
86
+ : contextDesign.hide_title_block;
87
+ const layout = contextDesign.layout === 'app_if_multipage'
88
+ ? project?.pages?.length && project?.pages?.length > 0
89
+ ? 'app'
90
+ : 'article'
91
+ : contextDesign.layout;
92
+ return { ...contextDesign, hide_title_block: hideTitleBlock, layout };
50
93
  }
@@ -2,9 +2,11 @@ export { ComputeProvider } from './compute';
2
2
  export { CurvenoteProviders } from './curvenote-providers';
3
3
  export { MystProviders } from './myst-providers';
4
4
  export * from './ping-boundary';
5
+ export * from './analytics-boundary';
6
+ export * from './overlay-depth';
5
7
  export * from './platform-providers';
6
- export * from './types';
7
8
  export { LightboxProvider, useLightbox, type LightboxImageData, useImages, } from './lightbox-provider';
8
9
  export { PageProviders, useIsIndexPage, usePage } from './page-providers';
9
- export { DesignProvider, useDesign, type DesignOptions } from './design';
10
+ export { ArticleVersionsProvider, useArticleVersions, type ArticleVersionNavItem, } from './article-versions-provider';
11
+ export { DesignProvider, useDesign } from './design';
10
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,WAAW,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,KAAK,iBAAiB,EACtB,SAAS,GACV,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/providers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAGrC,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,KAAK,iBAAiB,EACtB,SAAS,GACV,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE1E,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,qBAAqB,GAC3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
@@ -3,10 +3,12 @@ export { ComputeProvider } from './compute';
3
3
  export { CurvenoteProviders } from './curvenote-providers';
4
4
  export { MystProviders } from './myst-providers';
5
5
  export * from './ping-boundary';
6
+ export * from './analytics-boundary';
7
+ export * from './overlay-depth';
6
8
  export * from './platform-providers';
7
- export * from './types';
8
9
  // Lightbox Provider
9
10
  export { LightboxProvider, useLightbox, useImages, } from './lightbox-provider';
10
11
  // Page Providers
11
12
  export { PageProviders, useIsIndexPage, usePage } from './page-providers';
13
+ export { ArticleVersionsProvider, useArticleVersions, } from './article-versions-provider';
12
14
  export { DesignProvider, useDesign } from './design';
@@ -1,5 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import type { GenericParent } from 'myst-common';
3
+ /**
4
+ * Collect the gallery images (figures and standalone images) from an mdast tree for the
5
+ * lightbox. Equation images — `inline-graphic`/`graphic` nodes rendered inside `math` /
6
+ * `inlineMath` — are excluded: their math subtrees are skipped entirely.
7
+ */
8
+ export declare function collectLightboxImages(content?: GenericParent): LightboxImageData[];
3
9
  export declare function useImages({ mdast }: {
4
10
  mdast?: GenericParent;
5
11
  }): LightboxImageData[];
@@ -9,6 +15,8 @@ export interface LightboxImageData {
9
15
  urlSource?: string;
10
16
  alt?: string;
11
17
  caption?: string | GenericParent;
18
+ /** Depth of the opener's subtree when the lightbox was opened (for `overlay_depth` analytics). */
19
+ openingOverlayDepth?: number;
12
20
  }
13
21
  interface LightboxContextType {
14
22
  isOpen: boolean;
@@ -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,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,uBAwC7D;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;CAClC;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,CAA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AAK,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,2CAoFvB;AAED,wBAAgB,WAAW,wBAM1B"}
@@ -3,13 +3,21 @@ import * as React from 'react';
3
3
  import { useReferences } from '@myst-theme/providers';
4
4
  import { SKIP, visit } from 'unist-util-visit';
5
5
  import { select, selectAll } from 'unist-util-select';
6
- export function useImages({ mdast }) {
7
- const article = useReferences();
8
- const content = mdast ?? article?.article;
6
+ /**
7
+ * Collect the gallery images (figures and standalone images) from an mdast tree for the
8
+ * lightbox. Equation images — `inline-graphic`/`graphic` nodes rendered inside `math` /
9
+ * `inlineMath` — are excluded: their math subtrees are skipped entirely.
10
+ */
11
+ export function collectLightboxImages(content) {
9
12
  if (!content)
10
13
  return [];
11
14
  const allImages = [];
12
15
  visit(content, (node) => {
16
+ // Equations may be provided as images (e.g. JATS inline-graphic/graphic inside a
17
+ // math node). Those are not gallery images, so skip math subtrees entirely.
18
+ if (node.type === 'math' || node.type === 'inlineMath') {
19
+ return SKIP;
20
+ }
13
21
  // Track container entry/exit
14
22
  if (node.type === 'container') {
15
23
  if ('kind' in node && node.kind === 'figure') {
@@ -40,6 +48,11 @@ export function useImages({ mdast }) {
40
48
  });
41
49
  return allImages;
42
50
  }
51
+ export function useImages({ mdast }) {
52
+ const article = useReferences();
53
+ const content = mdast ?? article?.article;
54
+ return collectLightboxImages(content);
55
+ }
43
56
  const LightboxContext = React.createContext(undefined);
44
57
  export function LightboxProvider({ children, imageList: initialImageList = [], }) {
45
58
  const [isOpen, setIsOpen] = React.useState(false);
@@ -53,7 +66,11 @@ export function LightboxProvider({ children, imageList: initialImageList = [], }
53
66
  const openLightbox = React.useCallback((image) => {
54
67
  // Find index by matching src
55
68
  const index = imageList.findIndex((img) => img.src === image.src);
56
- setCurrentImage(index >= 0 ? imageList[index] : image);
69
+ const base = index >= 0 ? imageList[index] : image;
70
+ setCurrentImage({
71
+ ...base,
72
+ openingOverlayDepth: image.openingOverlayDepth,
73
+ });
57
74
  setCurrentIndex(index >= 0 ? index : 0);
58
75
  setIsOpen(true);
59
76
  }, [imageList]);
@@ -73,7 +90,13 @@ export function LightboxProvider({ children, imageList: initialImageList = [], }
73
90
  newIndex = currentIndex < imageList.length - 1 ? currentIndex + 1 : 0;
74
91
  }
75
92
  setCurrentIndex(newIndex);
76
- setCurrentImage(imageList[newIndex]);
93
+ setCurrentImage((prev) => {
94
+ const next = imageList[newIndex];
95
+ return {
96
+ ...next,
97
+ openingOverlayDepth: prev?.openingOverlayDepth,
98
+ };
99
+ });
77
100
  }, [currentIndex, imageList]);
78
101
  const hasNext = imageList.length > 1;
79
102
  const hasPrev = imageList.length > 1;
@@ -0,0 +1,16 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * Tracks how many overlay content shells (hover cards, etc.) enclose this subtree.
4
+ * Default is 0 (page / article body). Each {@link OverlayDepthIncrement} adds 1.
5
+ * Consumed by {@link useAnalytics} in `analytics-boundary.tsx` as `overlay_depth`.
6
+ */
7
+ export declare const OverlayInteractionDepthContext: import("react").Context<number>;
8
+ export type OverlayDepthIncrementProps = {
9
+ children: ReactNode;
10
+ };
11
+ /**
12
+ * Wrap floating overlay **content** (not the trigger) so nested interactions report a
13
+ * higher `overlay_depth` without manual per-callsite wiring.
14
+ */
15
+ export declare function OverlayDepthIncrement({ children }: OverlayDepthIncrementProps): import("react/jsx-runtime").JSX.Element;
16
+ //# sourceMappingURL=overlay-depth.d.ts.map
@@ -0,0 +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,2CAO7E"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ /**
4
+ * Tracks how many overlay content shells (hover cards, etc.) enclose this subtree.
5
+ * Default is 0 (page / article body). Each {@link OverlayDepthIncrement} adds 1.
6
+ * Consumed by {@link useAnalytics} in `analytics-boundary.tsx` as `overlay_depth`.
7
+ */
8
+ export const OverlayInteractionDepthContext = createContext(0);
9
+ /**
10
+ * Wrap floating overlay **content** (not the trigger) so nested interactions report a
11
+ * higher `overlay_depth` without manual per-callsite wiring.
12
+ */
13
+ export function OverlayDepthIncrement({ children }) {
14
+ const parent = useContext(OverlayInteractionDepthContext);
15
+ return (_jsx(OverlayInteractionDepthContext.Provider, { value: parent + 1, children: children }));
16
+ }
@@ -1,3 +1,4 @@
1
+ import type { SiteDTO } from '@curvenote/common';
1
2
  import type { PingFn, PingPayload } from '@curvenote/bridge-jupyter';
2
3
  /**
3
4
  * A provider that provides a ping function to send ping events to the server.
@@ -14,8 +15,9 @@ import type { PingFn, PingPayload } from '@curvenote/bridge-jupyter';
14
15
  * @see PingFn
15
16
  * @see LogBoundary
16
17
  */
17
- export declare function PingBoundary({ csrfToken, children, }: React.PropsWithChildren<{
18
+ export declare function PingBoundary({ csrfToken, site, children, }: React.PropsWithChildren<{
18
19
  csrfToken: string;
20
+ site: SiteDTO;
19
21
  }>): import("react/jsx-runtime").JSX.Element;
20
22
  /**
21
23
  * A hook to get the ping function from the PingBoundary context.
@@ -1 +1 @@
1
- {"version":3,"file":"ping-boundary.d.ts","sourceRoot":"","sources":["../../../src/components/providers/ping-boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAsDrE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,2CAQD;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"}
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,2CAQD;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"}
@@ -13,7 +13,7 @@ const PingBoundaryContext = createContext(undefined);
13
13
  * const ping = makePingFn('/api/ping', 'csrf-token');
14
14
  * ping({ event: 'navigate' });
15
15
  */
16
- function makePingFn(pingServiceUrl, csrfToken) {
16
+ function makePingFn(pingServiceUrl, csrfToken, site) {
17
17
  return async function ping(payload) {
18
18
  if (!pingServiceUrl) {
19
19
  console.debug('No ping service URL provided');
@@ -30,6 +30,9 @@ function makePingFn(pingServiceUrl, csrfToken) {
30
30
  search: window.location.search,
31
31
  hash: window.location.hash,
32
32
  url: window.location.href,
33
+ siteId: site.id,
34
+ siteName: site.name,
35
+ siteSecure: site.private,
33
36
  csrfToken,
34
37
  }),
35
38
  headers: {
@@ -60,12 +63,12 @@ function makePingFn(pingServiceUrl, csrfToken) {
60
63
  * @see PingFn
61
64
  * @see LogBoundary
62
65
  */
63
- export function PingBoundary({ csrfToken, children, }) {
66
+ export function PingBoundary({ csrfToken, site, children, }) {
64
67
  const value = useMemo(() => {
65
68
  return {
66
- ping: makePingFn('/api/ping', csrfToken),
69
+ ping: makePingFn('/api/ping', csrfToken, site),
67
70
  };
68
- }, [csrfToken]);
71
+ }, [csrfToken, site]);
69
72
  return _jsx(PingBoundaryContext.Provider, { value: value, children: children });
70
73
  }
71
74
  /**
@@ -1,8 +1,6 @@
1
1
  import type { SiteManifest } from 'myst-config';
2
2
  import React from 'react';
3
3
  import type { Site } from '@curvenote/common';
4
- import type { JournalTheme } from './types';
5
- export declare const defaultTheme: JournalTheme;
6
4
  export declare function PlatformSiteProvider({ site, config, children, }: {
7
5
  site?: Site;
8
6
  config?: SiteManifest;
@@ -10,9 +8,4 @@ export declare function PlatformSiteProvider({ site, config, children, }: {
10
8
  }): import("react/jsx-runtime").JSX.Element;
11
9
  export declare function usePlatformSite(): Partial<Site>;
12
10
  export declare function usePlatformConfig(): Partial<SiteManifest>;
13
- export declare function PlatformThemeProvider({ theme, children, }: {
14
- theme: JournalTheme;
15
- children: React.ReactNode;
16
- }): import("react/jsx-runtime").JSX.Element;
17
- export declare function usePlatformTheme(): JournalTheme;
18
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;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAC;AASF,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,2CAMA;AAED,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAG/C;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,CAGzD;AAID,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAEA;AAED,wBAAgB,gBAAgB,IAAI,YAAY,CAI/C"}
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,2CAMA;AAED,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAG/C;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,CAGzD"}
@@ -1,11 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { createContext, useContext } from 'react';
3
3
  import { SiteProvider } from '@myst-theme/providers';
4
- export const defaultTheme = {
5
- config: {
6
- name: 'theme-one',
7
- },
8
- };
9
4
  const PlatformSiteContext = createContext(undefined);
10
5
  export function PlatformSiteProvider({ site, config, children, }) {
11
6
  return (_jsx(PlatformSiteContext.Provider, { value: { site, config }, children: _jsx(SiteProvider, { config: config, children: children }) }));
@@ -18,12 +13,3 @@ export function usePlatformConfig() {
18
13
  const config = useContext(PlatformSiteContext)?.config ?? {};
19
14
  return config;
20
15
  }
21
- const PlatformThemeContext = createContext(undefined);
22
- export function PlatformThemeProvider({ theme, children, }) {
23
- return _jsx(PlatformThemeContext.Provider, { value: theme, children: children });
24
- }
25
- export function usePlatformTheme() {
26
- // TODO need to watch out for the base theme to loaded theme transition causing flicker
27
- const context = useContext(PlatformThemeContext) ?? defaultTheme;
28
- return context;
29
- }
@@ -1,5 +1,7 @@
1
- export declare function Abbreviations({ sorted, className, }: {
1
+ export declare function Abbreviations({ sorted, className, hideManyAbbreviations, }: {
2
2
  sorted?: boolean;
3
3
  className?: string;
4
+ /** When truthy, initially show only this many abbreviations with a "Show All" option. Pass a number or true. */
5
+ hideManyAbbreviations?: boolean | number;
4
6
  }): import("react/jsx-runtime").JSX.Element | null;
5
7
  //# sourceMappingURL=abbreviations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abbreviations.d.ts","sourceRoot":"","sources":["../../../src/components/ui/abbreviations.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,aAAa,CAAC,EAC5B,MAAa,EACb,SAAS,GACV,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,kDAqCA"}
1
+ {"version":3,"file":"abbreviations.d.ts","sourceRoot":"","sources":["../../../src/components/ui/abbreviations.tsx"],"names":[],"mappings":"AAgCA,wBAAgB,aAAa,CAAC,EAC5B,MAAa,EACb,SAAS,EACT,qBAAkD,GACnD,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gHAAgH;IAChH,qBAAqB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1C,kDAsDA"}