drupal-canvas 0.7.0 → 0.8.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/README.md CHANGED
@@ -69,9 +69,10 @@ export default function PageHeader() {
69
69
  (the primary Drupal entity, `null` on routes without one), including language
70
70
  and translation information. See
71
71
  [Main entity metadata](https://project.pages.drupalcode.org/canvas/code-components/data-fetching#main-entity-metadata).
72
- - Site context (`SiteContext`): `branding`, the Drupal `baseUrl`, and
73
- `themeAssets`. Headless frontends receive empty theme asset URLs; that is
74
- valid site context, so shared components must handle empty asset URLs.
72
+ - Site context (`SiteContext`): `branding`, the Drupal `baseUrl`, `themeAssets`,
73
+ and the interface `langcode`. Headless frontends receive empty theme asset
74
+ URLs; that is valid site context, so shared components must handle empty asset
75
+ URLs.
75
76
 
76
77
  Call the hooks unconditionally at the top level of a function component or
77
78
  custom hook (React's rules of hooks) and handle `null` results.
@@ -88,7 +89,35 @@ import { CanvasContextProvider } from 'drupal-canvas/react';
88
89
  ```
89
90
 
90
91
  The `CanvasContext` type describes the provider's value:
91
- `{ page: PageContext | null; site: SiteContext | null }`.
92
+ `{ page: PageContext | null; site: SiteContext | null; translations?: Translations | null }`.
93
+
94
+ ### `useTranslation`
95
+
96
+ Translate interface strings with `t()` and `formatPlural()`, which take the same
97
+ arguments as `Drupal.t()` and `Drupal.formatPlural()`. They work in every
98
+ frontend mode: they read the translations from the context. Without a
99
+ translation, they return the source string.
100
+
101
+ ```jsx
102
+ import { useTranslation } from 'drupal-canvas/react';
103
+
104
+ export default function Greeting({ name, count }) {
105
+ const { t, formatPlural } = useTranslation();
106
+ return (
107
+ <p>
108
+ {t('Hello @name', { '@name': name })}{' '}
109
+ {formatPlural(count, '1 new message', '@count new messages')}
110
+ </p>
111
+ );
112
+ }
113
+ ```
114
+
115
+ The code editor, the Canvas CLI, and the Headless SDK find the strings in the
116
+ component source, so pass string literals, and a string literal as the
117
+ `context`. Only `@` placeholders, such as `@name`, are replaced. Unlike Drupal's
118
+ functions, which return HTML, both return text: HTML in a string is shown as
119
+ text. See
120
+ [Interface translation](https://project.pages.drupalcode.org/canvas/code-components/interface-translation).
92
121
 
93
122
  ### `getPageData` and `getSiteData` (deprecated)
94
123
 
@@ -1,4 +1,3 @@
1
- //#region src/FormattedText.d.ts
2
1
  type FormattedTextProps = {
3
2
  children: string;
4
3
  as?: 'div' | 'span';
@@ -7,6 +6,4 @@ type FormattedTextProps = {
7
6
  style?: Record<string, string>;
8
7
  [key: string]: any;
9
8
  };
10
- declare function FormattedText({ children, as, ...props }: FormattedTextProps): import("react/jsx-runtime").JSX.Element;
11
- //#endregion
12
- export { FormattedText as default };
9
+ export default function FormattedText({ children, as, ...props }: FormattedTextProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- //#region src/FormattedText.tsx
2
+ // src/FormattedText.tsx
3
3
  function FormattedText({ children, as = "div", ...props }) {
4
4
  return /* @__PURE__ */ jsx(as, {
5
5
  dangerouslySetInnerHTML: { __html: children },
6
6
  ...props
7
7
  });
8
8
  }
9
- //#endregion
10
9
  export { FormattedText as default };
@@ -0,0 +1,94 @@
1
+ import { d as PageContext, f as SiteContext, p as Translations, u as CanvasContext } from "./drupal-utils-BIiH7B6O.js";
2
+ import { ReactNode } from "react";
3
+ /**
4
+ * Placeholder replacements, keyed by `@` placeholders, e.g.
5
+ * `{ '@name': name }`. Drupal's other placeholder prefixes (`%`, `:` and `!`)
6
+ * are not supported: such keys are ignored, so their placeholders stay in the
7
+ * text.
8
+ */
9
+ type TranslationArgs = Record<`@${string}`, string | number>;
10
+ interface TranslationOptions {
11
+ /** The string context, to tell apart identical source strings. */
12
+ context?: string;
13
+ }
14
+ /**
15
+ * Translates a string, with the same arguments as `Drupal.t()`.
16
+ *
17
+ * Unlike `Drupal.t()`, which returns HTML, the result is text: `@`
18
+ * placeholders insert their values as is, and HTML in the source string or its
19
+ * translation is not interpreted. React escapes the text when it renders it.
20
+ */
21
+ type TranslateFunction = (str: string, args?: TranslationArgs, options?: TranslationOptions) => string;
22
+ /**
23
+ * Formats a singular or plural string for a count, with the same arguments as
24
+ * `Drupal.formatPlural()`. `@count` is replaced with the count. The result is
25
+ * text, not HTML, as with `TranslateFunction`.
26
+ */
27
+ type FormatPluralFunction = (count: number, singular: string, plural: string, args?: TranslationArgs, options?: TranslationOptions) => string;
28
+ interface CanvasContextProviderProps {
29
+ context: CanvasContext;
30
+ children?: ReactNode;
31
+ }
32
+ /**
33
+ * Makes page and site context available to every React descendant. Adds no
34
+ * DOM wrapper. Rendering integrations use it internally; applications can use
35
+ * it to reach components outside the Canvas tree, such as a site header.
36
+ */
37
+ declare function CanvasContextProvider({ context, children }: CanvasContextProviderProps): import("react/jsx-runtime").JSX.Element;
38
+ interface TranslationsProviderProps {
39
+ /**
40
+ * The translations for every component below, e.g. the application's own
41
+ * dictionary. They replace the translations of the Canvas context instead
42
+ * of being merged with them; `null` means none, so components show their
43
+ * source strings.
44
+ */
45
+ translations: Translations | null;
46
+ children?: ReactNode;
47
+ }
48
+ /**
49
+ * Replaces the translations `useTranslation()` uses below it. The nearest
50
+ * provider takes precedence over the Canvas context's translations, also over
51
+ * a context that a rendering integration provides further down, such as the
52
+ * `context` of `CanvasComponentTree`. Without it, components use the
53
+ * translations of the Canvas context. Adds no DOM wrapper.
54
+ */
55
+ declare function TranslationsProvider({ translations, children }: TranslationsProviderProps): import("react/jsx-runtime").JSX.Element;
56
+ /**
57
+ * Returns the current page context, or `null` when no provider supplies one.
58
+ * Emits a deduplicated developer warning in that case; a provider that
59
+ * carries valid empty page data is not a missing-context condition.
60
+ */
61
+ declare function usePageContext(): PageContext | null;
62
+ /**
63
+ * Returns the current site context, or `null` when no provider supplies one.
64
+ * Emits a deduplicated developer warning in that case.
65
+ */
66
+ declare function useSiteContext(): SiteContext | null;
67
+ /**
68
+ * Returns `t()` and `formatPlural()`, which translate strings into the page's
69
+ * interface language. They take the arguments of `Drupal.t()` and
70
+ * `Drupal.formatPlural()`, with `@` placeholders only, but return text, not
71
+ * HTML, which React escapes when it renders it. The code editor, the Canvas
72
+ * CLI, and the Headless SDK find the strings to translate in the component
73
+ * source: pass string literals.
74
+ *
75
+ * The translations come from the nearest `TranslationsProvider`, otherwise
76
+ * from the Canvas context. Without a translation for a string, they return the
77
+ * source string. Without either provider they also warn once.
78
+ *
79
+ * @example
80
+ * const { t, formatPlural } = useTranslation();
81
+ * t('Hello @name', { '@name': name });
82
+ * formatPlural(count, '1 item', '@count items');
83
+ */
84
+ declare function useTranslation(): {
85
+ t: TranslateFunction;
86
+ formatPlural: FormatPluralFunction;
87
+ };
88
+ /**
89
+ * Whether a `CanvasContextProvider` is mounted above the calling component.
90
+ * Rendering integrations use it to decide whether to inherit an outer
91
+ * provider instead of adding their own.
92
+ */
93
+ declare function useHasCanvasContext(): boolean;
94
+ export { useHasCanvasContext as a, useTranslation as c, TranslationArgs as d, TranslationOptions as f, TranslationsProviderProps as i, FormatPluralFunction as l, CanvasContextProviderProps as n, usePageContext as o, TranslationsProvider as r, useSiteContext as s, CanvasContextProvider as t, TranslateFunction as u };
@@ -1,4 +1,3 @@
1
- //#region src/context-types.d.ts
2
1
  /**
3
2
  * The page context: the same shape `getPageData()` returns. The primary
4
3
  * entity can be `null` on routes without one.
@@ -10,13 +9,36 @@ type PageContext = PageData;
10
9
  * missing context.
11
10
  */
12
11
  type SiteContext = SiteData;
12
+ /**
13
+ * Interface translations for the strings Code Components pass to `t()` and
14
+ * `formatPlural()`, in the page's interface language. Same layout as Drupal's
15
+ * `drupalTranslations`.
16
+ */
17
+ interface Translations {
18
+ /**
19
+ * Translated strings keyed by context (`''` when none), then by source
20
+ * string. Plural strings join their forms with `\x03`, in source and
21
+ * translation alike. Untranslated strings can be omitted.
22
+ */
23
+ strings: Record<string, Record<string, string>>;
24
+ /**
25
+ * The plural form index for a count, with a `default` for counts not
26
+ * listed. As in Drupal, it covers counts up to 199: a larger count uses the
27
+ * index of 100 plus its remainder over 100. Without it, translated plurals
28
+ * use the first form for 1 and the second for other counts.
29
+ */
30
+ pluralFormula?: Record<string, number> | null;
31
+ }
13
32
  /** The context a rendering integration supplies to a component tree. */
14
33
  interface CanvasContext {
15
34
  page: PageContext | null;
16
35
  site: SiteContext | null;
36
+ /**
37
+ * Absent or `null` when there is nothing to translate: `t()` then returns
38
+ * source strings.
39
+ */
40
+ translations?: Translations | null;
17
41
  }
18
- //#endregion
19
- //#region src/drupal-utils.d.ts
20
42
  interface Linkset {
21
43
  linkset: LinksetItem[];
22
44
  }
@@ -90,6 +112,11 @@ interface SiteData {
90
112
  };
91
113
  baseUrl: string;
92
114
  themeAssets: ThemeAssets;
115
+ /**
116
+ * The interface language of the site, e.g. `fr`. `useDateFormatter()`
117
+ * formats dates in it. Absent when the integration did not supply it.
118
+ */
119
+ langcode?: string;
93
120
  }
94
121
  /**
95
122
  * Reads the current page data from `drupalSettings`.
@@ -113,5 +140,4 @@ declare const getPageData: () => PageData;
113
140
  * components.
114
141
  */
115
142
  declare const getSiteData: () => SiteData;
116
- //#endregion
117
- export { ThemeAssets as a, getSiteData as c, PageContext as d, SiteContext as f, SiteData as i, sortMenu as l, EntityMetadata as n, TranslationMetadata as o, PageData as r, getPageData as s, BreadcrumbLink as t, CanvasContext as u };
143
+ export { ThemeAssets as a, getSiteData as c, PageContext as d, SiteContext as f, SiteData as i, sortMenu as l, EntityMetadata as n, TranslationMetadata as o, Translations as p, PageData as r, getPageData as s, BreadcrumbLink as t, CanvasContext as u };
@@ -1,2 +1,2 @@
1
- import { a as ThemeAssets, c as getSiteData, d as PageContext, f as SiteContext, i as SiteData, l as sortMenu, n as EntityMetadata, o as TranslationMetadata, r as PageData, s as getPageData, t as BreadcrumbLink, u as CanvasContext } from "./drupal-utils-CUaK4jOk.js";
1
+ import { a as ThemeAssets, c as getSiteData, d as PageContext, f as SiteContext, i as SiteData, l as sortMenu, n as EntityMetadata, o as TranslationMetadata, r as PageData, s as getPageData, t as BreadcrumbLink, u as CanvasContext } from "./drupal-utils-BIiH7B6O.js";
2
2
  export { BreadcrumbLink, type CanvasContext, EntityMetadata, type PageContext, PageData, type SiteContext, SiteData, ThemeAssets, TranslationMetadata, getPageData, getSiteData, sortMenu };
@@ -1,5 +1,5 @@
1
- import { r as assertLegacyRuntime } from "./migration-CPBzW78_.js";
2
- //#region src/drupal-utils.ts
1
+ import { r as assertLegacyRuntime } from "./migration-CxRMGzhm.js";
2
+ // src/drupal-utils.ts
3
3
  /**
4
4
  * Sort menu items from core's menu API into a tree with additional
5
5
  * _children and _hasSubmenu properties.
@@ -94,5 +94,4 @@ const getSiteData = () => {
94
94
  });
95
95
  return siteData;
96
96
  };
97
- //#endregion
98
97
  export { getPageData, getSiteData, sortMenu };
package/dist/index.d.ts CHANGED
@@ -1,108 +1,11 @@
1
+ import "./context-DMp0nsTU.js";
2
+ import { a as LegacyJsonApiClient, i as JsonApiRuntimeConfig, n as DraftSessionError, o as createJsonApiClient, r as JsonApiClientConfig, s as isDraftSessionError, t as CanvasJsonApiClient } from "./jsonapi-client-CKzxh1on.js";
3
+ import { a as ThemeAssets, c as getSiteData, d as PageContext, f as SiteContext, i as SiteData, l as sortMenu, n as EntityMetadata, o as TranslationMetadata, p as Translations, r as PageData, s as getPageData, t as BreadcrumbLink, u as CanvasContext } from "./drupal-utils-BIiH7B6O.js";
1
4
  import FormattedText from "./FormattedText.js";
2
- import { a as ThemeAssets, c as getSiteData, d as PageContext, f as SiteContext, i as SiteData, l as sortMenu, n as EntityMetadata, o as TranslationMetadata, r as PageData, s as getPageData, t as BreadcrumbLink, u as CanvasContext } from "./drupal-utils-CUaK4jOk.js";
3
- import "./context-Cb4HbPbR.js";
4
- import { a as LegacyJsonApiClient, i as JsonApiRuntimeConfig, n as DraftSessionError, o as createJsonApiClient, r as JsonApiClientConfig, s as isDraftSessionError, t as CanvasJsonApiClient } from "./jsonapi-client-BAQ3V5CC.js";
5
5
  import { getNodePath, sortMenu as sortMenu$1 } from "./jsonapi-utils.js";
6
6
  import Image from "./next-image-standalone.js";
7
7
  import { cn } from "./utils.js";
8
8
  import { ReactNode } from "react";
9
- //#region src/date-utils.d.ts
10
- /**
11
- * Locale-aware date formatting utilities for Canvas Code Components.
12
- *
13
- * These functions format ISO date/time strings using the Drupal-selected
14
- * langcode from `drupalSettings.canvasData.v0.langcode`. They are opt-in: Canvas passes date
15
- * props to templates as raw ISO strings by default. Use these utilities when
16
- * you want to display a date in the user's locale.
17
- *
18
- * All functions accept an optional `options` object so callers can override
19
- * default format styles without losing the Drupal langcode or the UTC timezone
20
- * guard that prevents stored dates from shifting by the viewer's UTC offset.
21
- *
22
- * @example Twig: `{{ my_date_prop|canvasFormatDate }}`
23
- * @example JSX: `canvasFormatDate(myDateProp)`
24
- * @example JSX with options: `canvasFormatDate(myDateProp, { dateStyle: 'long' })`
25
- */
26
- /**
27
- * Options accepted by the Canvas date formatting utilities.
28
- *
29
- * All fields are optional and default to `'short'`. Pass an options object to
30
- * override the format style without losing the Drupal langcode or UTC timezone
31
- * guard.
32
- */
33
- interface CanvasDateFormatOptions {
34
- /** Controls the date portion style. Defaults to `'short'`. */
35
- dateStyle?: Intl.DateTimeFormatOptions['dateStyle'];
36
- /** Controls the time portion style. Defaults to `'short'`. */
37
- timeStyle?: Intl.DateTimeFormatOptions['timeStyle'];
38
- }
39
- /**
40
- * Formats an ISO date string using the active Drupal locale's date format.
41
- *
42
- * Returns the original `iso` string unchanged if it cannot be parsed, and an
43
- * empty string for `null` or `undefined` (an optional prop without a value).
44
- *
45
- * @param iso
46
- * ISO date string, e.g. '2026-01-15'.
47
- * @param options
48
- * Optional format overrides. Defaults to `{ dateStyle: 'short' }`.
49
- *
50
- * @return
51
- * Locale-formatted date string, e.g. '1/15/26' (en) or '15/01/2026' (fr).
52
- */
53
- declare function canvasFormatDate(iso: string | null | undefined, options?: Pick<CanvasDateFormatOptions, 'dateStyle'>): string;
54
- /**
55
- * Formats an ISO datetime string using the active Drupal locale's format.
56
- *
57
- * Returns the original `iso` string unchanged if it cannot be parsed, and an
58
- * empty string for `null` or `undefined` (an optional prop without a value).
59
- *
60
- * @param iso
61
- * ISO datetime string, e.g. '2026-01-15T14:30:00Z'.
62
- * @param options
63
- * Optional format overrides. Defaults to
64
- * `{ dateStyle: 'short', timeStyle: 'short' }`.
65
- *
66
- * @return
67
- * Locale-formatted datetime string.
68
- */
69
- declare function canvasFormatDateTime(iso: string | null | undefined, options?: CanvasDateFormatOptions): string;
70
- /**
71
- * Formats an ISO time/datetime string using the active Drupal locale's time format.
72
- *
73
- * Returns the original `iso` string unchanged if it cannot be parsed, and an
74
- * empty string for `null` or `undefined` (an optional prop without a value).
75
- *
76
- * @param iso
77
- * ISO time or datetime string, e.g. '14:30:00' or '2026-01-15T14:30:00Z'.
78
- * @param options
79
- * Optional format overrides. Defaults to `{ timeStyle: 'short' }`.
80
- *
81
- * @return
82
- * Locale-formatted time string.
83
- */
84
- declare function canvasFormatTime(iso: string | null | undefined, options?: Pick<CanvasDateFormatOptions, 'timeStyle'>): string;
85
- /**
86
- * Formats the `from` and `to` fields of a Canvas date-range prop.
87
- *
88
- * Returns `null` or `undefined` unchanged (an optional prop without a value).
89
- *
90
- * @param range
91
- * Canvas date-range object, e.g. `{ from: '2026-01-15', to: '2026-03-20' }`.
92
- * @param options
93
- * Optional format overrides passed to each field. Defaults to
94
- * `{ dateStyle: 'short' }`.
95
- *
96
- * @return
97
- * A new object with the same keys; each string date value is replaced with a
98
- * formatted string.
99
- */
100
- declare function canvasFormatDateRange<T extends {
101
- from?: string | null;
102
- to?: string | null;
103
- } | null | undefined>(range: T, options?: Pick<CanvasDateFormatOptions, 'dateStyle'>): T;
104
- //#endregion
105
- //#region src/drupal-settings.d.ts
106
9
  /** The subset of `drupalSettings.canvasData.v0` the context API reads. */
107
10
  interface CanvasDataV0 {
108
11
  pageTitle?: string | null;
@@ -112,10 +15,12 @@ interface CanvasDataV0 {
112
15
  mainEntity?: NonNullable<CanvasContext['page']>['mainEntity'];
113
16
  branding?: NonNullable<CanvasContext['site']>['branding'] | null;
114
17
  baseUrl?: string | null;
18
+ langcode?: string | null;
115
19
  themeAssets?: NonNullable<CanvasContext['site']>['themeAssets'] | null;
116
20
  jsonapiSettings?: {
117
21
  apiPrefix?: string;
118
22
  } | null;
23
+ translations?: Translations | null;
119
24
  }
120
25
  interface DrupalSettingsLike {
121
26
  canvasData?: {
@@ -123,27 +28,25 @@ interface DrupalSettingsLike {
123
28
  } | null;
124
29
  }
125
30
  /** Reads `drupalSettings.canvasData.v0` from a settings object or the global. */
126
- declare function readCanvasDataV0(settings?: DrupalSettingsLike | undefined): CanvasDataV0 | null;
31
+ export declare function readCanvasDataV0(settings?: DrupalSettingsLike | undefined): CanvasDataV0 | null;
127
32
  /**
128
33
  * Builds the page and site context from `drupalSettings.canvasData.v0`.
129
34
  *
130
35
  * Page context is available when Drupal attached any page-level key
131
36
  * (`pageTitle`, `breadcrumbs`, or `mainEntity`); site context when it attached
132
- * `branding`. Missing keys inside an available group take the same defaults
37
+ * `branding` or `langcode`. Missing keys inside an available group take the same defaults
133
38
  * as the legacy getters.
134
39
  */
135
- declare function drupalSettingsToCanvasContext(v0: CanvasDataV0 | null | undefined): CanvasContext;
40
+ export declare function drupalSettingsToCanvasContext(v0: CanvasDataV0 | null | undefined): CanvasContext;
136
41
  /**
137
42
  * Builds the JSON:API runtime configuration for a Drupal-rendered page from
138
43
  * `drupalSettings.canvasData.v0`, or `null` when the settings do not carry a
139
44
  * base URL or JSON:API is not installed. Previews read working copies through
140
45
  * the editor's Drupal session.
141
46
  */
142
- declare function drupalSettingsToJsonApiRuntimeConfig(v0: CanvasDataV0 | null | undefined, options?: {
47
+ export declare function drupalSettingsToJsonApiRuntimeConfig(v0: CanvasDataV0 | null | undefined, options?: {
143
48
  preview?: boolean;
144
49
  }): JsonApiRuntimeConfig | null;
145
- //#endregion
146
- //#region src/migration.d.ts
147
50
  /**
148
51
  * @file
149
52
  * Migration guidance shared by the legacy API errors, the hook warnings, and
@@ -153,9 +56,9 @@ declare function drupalSettingsToJsonApiRuntimeConfig(v0: CanvasDataV0 | null |
153
56
  * The AI-agent migration prompt included in legacy API errors and printed by
154
57
  * the Canvas CLI for components it could not migrate automatically.
155
58
  */
156
- declare const AGENT_MIGRATION_PROMPT: string;
59
+ export declare const AGENT_MIGRATION_PROMPT: string;
157
60
  /** Replacement guidance per legacy API. */
158
- declare const LEGACY_API_GUIDANCE: {
61
+ export declare const LEGACY_API_GUIDANCE: {
159
62
  readonly 'getPageData()': string;
160
63
  readonly 'getSiteData()': string;
161
64
  readonly 'new JsonApiClient()': string;
@@ -165,9 +68,7 @@ type LegacyApiName = keyof typeof LEGACY_API_GUIDANCE;
165
68
  * Builds the error message thrown when a legacy API is invoked outside Drupal
166
69
  * and Workbench.
167
70
  */
168
- declare function formatLegacyApiError(api: LegacyApiName): string;
169
- //#endregion
170
- //#region src/Region.d.ts
71
+ export declare function formatLegacyApiError(api: LegacyApiName): string;
171
72
  type RegionsMap = Record<string, ReactNode>;
172
73
  type RegionsProviderProps = {
173
74
  regions: RegionsMap;
@@ -179,7 +80,7 @@ type RegionsProviderProps = {
179
80
  * @deprecated Theme-global regions were replaced by page variants (ADR 19);
180
81
  * compose pages with the component tree instead. Kept for compatibility.
181
82
  */
182
- declare function RegionsProvider({ regions, children }: RegionsProviderProps): import("react/jsx-runtime").JSX.Element;
83
+ export declare function RegionsProvider({ regions, children }: RegionsProviderProps): import("react/jsx-runtime").JSX.Element;
183
84
  type RegionProps = {
184
85
  name: string;
185
86
  fallback?: ReactNode;
@@ -190,9 +91,7 @@ type RegionProps = {
190
91
  * @deprecated Theme-global regions were replaced by page variants (ADR 19);
191
92
  * compose pages with the component tree instead. Kept for compatibility.
192
93
  */
193
- declare function Region({ name, fallback }: RegionProps): import("react/jsx-runtime").JSX.Element;
194
- //#endregion
195
- //#region src/runtime.d.ts
94
+ export declare function Region({ name, fallback }: RegionProps): import("react/jsx-runtime").JSX.Element;
196
95
  /**
197
96
  * @file
198
97
  * The runtime marker that identifies the environments in which the legacy
@@ -213,15 +112,14 @@ type CanvasRuntimeEnvironment = 'drupal' | 'workbench';
213
112
  * Declares the current runtime environment. Called by Drupal and Workbench
214
113
  * integrations, never by Code Components or headless applications.
215
114
  */
216
- declare function declareCanvasRuntime(environment: CanvasRuntimeEnvironment): void;
115
+ export declare function declareCanvasRuntime(environment: CanvasRuntimeEnvironment): void;
217
116
  /**
218
117
  * Returns the declared runtime environment, or `null` outside Drupal and
219
118
  * Workbench.
220
119
  */
221
- declare function getCanvasRuntime(): CanvasRuntimeEnvironment | null;
120
+ export declare function getCanvasRuntime(): CanvasRuntimeEnvironment | null;
222
121
  /**
223
122
  * Whether the legacy runtime APIs are supported in the current environment.
224
123
  */
225
- declare function isLegacyRuntimeSupported(): boolean;
226
- //#endregion
227
- export { AGENT_MIGRATION_PROMPT, type BreadcrumbLink, type CanvasContext, type CanvasDataV0, type CanvasDateFormatOptions, type CanvasJsonApiClient, type CanvasRuntimeEnvironment, DraftSessionError, type EntityMetadata, FormattedText, Image, LegacyJsonApiClient as JsonApiClient, type JsonApiClientConfig, type JsonApiRuntimeConfig, LEGACY_API_GUIDANCE, type PageContext, type PageData, Region, RegionsProvider, type SiteContext, type SiteData, type ThemeAssets, type TranslationMetadata, canvasFormatDate, canvasFormatDateRange, canvasFormatDateTime, canvasFormatTime, cn, createJsonApiClient, declareCanvasRuntime, drupalSettingsToCanvasContext, drupalSettingsToJsonApiRuntimeConfig, formatLegacyApiError, getCanvasRuntime, getNodePath, getPageData, getSiteData, isDraftSessionError, isLegacyRuntimeSupported, readCanvasDataV0, sortMenu as sortLinksetMenu, sortMenu$1 as sortMenu };
124
+ export declare function isLegacyRuntimeSupported(): boolean;
125
+ export { type BreadcrumbLink, type CanvasContext, type CanvasDataV0, type CanvasJsonApiClient, type CanvasRuntimeEnvironment, DraftSessionError, type EntityMetadata, FormattedText, Image, LegacyJsonApiClient as JsonApiClient, type JsonApiClientConfig, type JsonApiRuntimeConfig, type PageContext, type PageData, type SiteContext, type SiteData, type ThemeAssets, type TranslationMetadata, type Translations, cn, createJsonApiClient, getNodePath, getPageData, getSiteData, isDraftSessionError, sortMenu as sortLinksetMenu, sortMenu$1 as sortMenu };