mechanica-shared 2.0.0-alpha.4 → 2.0.0-alpha.6

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.
@@ -1,4 +1,4 @@
1
- export type { Block, ContentBlock, ComposedBlockDefinition, ComposerComponentDefinition, ComposerComponentEntry, ComposerManifest, ComposerClassDefinition, ComposerClassEntry, ComposerClassDef, ComposerElementKind, ComposerBreakpoints, PropBinding, DataEntry, DataScope, PageMeta, State, PageLink, } from './types';
1
+ export type { Block, ContentBlock, ComposedBlockDefinition, ComposerComponentDefinition, ComposerComponentEntry, ComposerManifest, ComposerClassDefinition, ComposerClassEntry, ComposerClassDef, ComposerElementKind, ComposerBreakpoints, PropBinding, DataEntry, DataScope, PageMeta, State, PageLink, VirtualPage, } from './types';
2
2
  export { normalizeClassManifest } from './composer-manifest';
3
3
  export { normalizeLocales, isLocale, parseLocalePath, localePath, localeLabel, type LocalesConfig, type LocalesOption, } from './locale';
4
4
  export { resolveComposedTemplate, resolveBindings, templateBlockIds, isBinding, } from './compose';
@@ -277,6 +277,35 @@ export interface State {
277
277
  * locale and build language switchers. Absent when i18n is off.
278
278
  */
279
279
  locales?: LocalesConfig;
280
+ /**
281
+ * Dev only: this state belongs to a programmatically generated page
282
+ * ({@link VirtualPage}) that has no `.page.md` file. The editor treats it as
283
+ * read-only — it never queues a save against a nonexistent file.
284
+ */
285
+ generated?: boolean;
286
+ }
287
+ /**
288
+ * A page produced programmatically (the plugin's `generatePages` option) instead
289
+ * of from a `.page.md` file — plain, serializable data. The plugin runs its
290
+ * providers at build and bakes the output into the SSR bundle for the static
291
+ * export; the same shape is what a future render backend consumes for on-demand
292
+ * / webhook regeneration. One `VirtualPage` per (logical page × locale).
293
+ */
294
+ export interface VirtualPage {
295
+ /** Logical (unprefixed) path, e.g. `/docs/api/math/mathf`. Localized per `locale` when served. */
296
+ path: string;
297
+ /** The block tree to render — usually one template block parameterized by `data`. */
298
+ content: ContentBlock[];
299
+ /** Page-scoped data (head, layout, block props). Site data still merges under it. */
300
+ data?: Record<string, unknown>;
301
+ /** Page meta: `title` (breadcrumb / SEO name), `noindex`, and `{{ page.meta.* }}` hints. */
302
+ meta?: Record<string, unknown>;
303
+ /** The locale this page renders in. Omit for the default locale. */
304
+ locale?: string;
305
+ /** Every locale this logical page exists in — for hreflang alternates + language switchers. */
306
+ locales?: string[];
307
+ /** Sitemap `<lastmod>` (ISO date). The provider supplies it; there is no file to stat. */
308
+ lastmod?: string;
280
309
  }
281
310
  /** A link target produced by the `smartLink` field type. */
282
311
  export interface PageLink {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mechanica-shared",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.6",
4
4
  "description": "DOM-free types, schema helpers and page-generation core shared across Mechanica",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export type {
16
16
  PageMeta,
17
17
  State,
18
18
  PageLink,
19
+ VirtualPage,
19
20
  } from './types'
20
21
 
21
22
  export { normalizeClassManifest } from './composer-manifest'
package/src/types.ts CHANGED
@@ -291,6 +291,36 @@ export interface State {
291
291
  * locale and build language switchers. Absent when i18n is off.
292
292
  */
293
293
  locales?: LocalesConfig
294
+ /**
295
+ * Dev only: this state belongs to a programmatically generated page
296
+ * ({@link VirtualPage}) that has no `.page.md` file. The editor treats it as
297
+ * read-only — it never queues a save against a nonexistent file.
298
+ */
299
+ generated?: boolean
300
+ }
301
+
302
+ /**
303
+ * A page produced programmatically (the plugin's `generatePages` option) instead
304
+ * of from a `.page.md` file — plain, serializable data. The plugin runs its
305
+ * providers at build and bakes the output into the SSR bundle for the static
306
+ * export; the same shape is what a future render backend consumes for on-demand
307
+ * / webhook regeneration. One `VirtualPage` per (logical page × locale).
308
+ */
309
+ export interface VirtualPage {
310
+ /** Logical (unprefixed) path, e.g. `/docs/api/math/mathf`. Localized per `locale` when served. */
311
+ path: string
312
+ /** The block tree to render — usually one template block parameterized by `data`. */
313
+ content: ContentBlock[]
314
+ /** Page-scoped data (head, layout, block props). Site data still merges under it. */
315
+ data?: Record<string, unknown>
316
+ /** Page meta: `title` (breadcrumb / SEO name), `noindex`, and `{{ page.meta.* }}` hints. */
317
+ meta?: Record<string, unknown>
318
+ /** The locale this page renders in. Omit for the default locale. */
319
+ locale?: string
320
+ /** Every locale this logical page exists in — for hreflang alternates + language switchers. */
321
+ locales?: string[]
322
+ /** Sitemap `<lastmod>` (ISO date). The provider supplies it; there is no file to stat. */
323
+ lastmod?: string
294
324
  }
295
325
 
296
326
  /** A link target produced by the `smartLink` field type. */