@eldrajs/vite-plugin-theme 0.0.0 → 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,270 @@
1
+ # @eldrajs/vite-plugin-theme changelog
2
+
3
+ Hand-maintained: every change a consumer can see gets a line under Unreleased in the same change.
4
+ Release-please writes the generated notes from commit messages and does not replace this.
5
+
6
+ ## Unreleased
7
+
8
+ - **Breaking:** a theme must declare its id in `package.json` under `eldra.themeId`
9
+ (`^[a-z][a-z0-9-]{1,48}$`, `catalog` reserved). The scanner emits it as `manifest.theme.id` and
10
+ `manifestVersion` is now `2` (`ThemeManifest.manifestVersion: 2`, `theme.id: string`). A missing
11
+ or invalid id is a scan error, so the plugin build, `eldra-theme validate` and
12
+ `eldra-theme deploy` fail naming `package.json: eldra.themeId`; there is no derivation from the
13
+ package name and no v1 manifest is produced. Core stores a theme's block schemas as
14
+ `<themeId>:<blockApiId>`; block ids in `block.json` and the manifest stay bare.
15
+ A v1 `.eldra/manifest.json` left on disk from an earlier build is rejected as the previous
16
+ manifest (`previous manifest: expected manifestVersion 2`): delete it once before the first build
17
+ after upgrading. See `docs/themes.md`'s "Theme id and schema ownership".
18
+
19
+ - The scanner now reads a theme's own message catalogue: `i18n/<tag>.json`, siblings of
20
+ `tokens.json`, one file per locale, each a nested JSON object of strings that gets flattened to
21
+ dotted keys (`header.menu`, `cart.empty.title`). It validates key grammar/length, value
22
+ type/length, the 2000-key and 20-locale bounds, that every file name is a canonical `ll-RR` BCP-47
23
+ tag, and that every non-default locale's keys are a subset of the default locale's (naming the
24
+ locale and the first offending key otherwise). The default locale is declared under
25
+ `package.json`'s own `eldra.defaultLocale` key, beside the `name`/`version` the scanner already
26
+ reads from the same file; when undeclared it falls back to `en-US` when shipped, else the
27
+ alphabetically first locale file. `manifest.messages = { defaultLocale, locales }` is **absent**
28
+ — not an empty object — when the theme has no `i18n/` directory, so a theme shipping no texts
29
+ never changes its manifest shape. A new virtual module, `virtual:eldra/messages`
30
+ (`{ defaultLocale: string; locales: Record<string, Record<string, string>> }`), serves the
31
+ manifest's own block today, or `{ defaultLocale: 'en-US', locales: {} }` when the theme declares
32
+ none; the Nuxt wrapper will later merge a live organization read over it. `generateBlockTypes`
33
+ (and therefore every `.eldra/block-types.d.ts` write, from the plugin on every scan and from
34
+ `eldra-theme types --blocks`) now also emits a `type MessageKey = '…' | '…';` union from the
35
+ default locale's keys when the theme ships any, so a theme's own code gets typed message keys
36
+ without a hand-written `Messages` interface. See `docs/theme-design-tokens.md`'s new "Messages"
37
+ section.
38
+
39
+ - `eldraTheme()` takes a new option, `resolveMessages?: (themeMessages) => themeMessages` — when
40
+ set, `virtual:eldra/messages` serves its return value instead of the manifest's own `messages`
41
+ block unchanged. `@eldrajs/theme-nuxt`'s module is the one caller: it sets this once its own
42
+ build-time read of the public platform route has settled, merging that response over the
43
+ manifest defaults and resolving the result over the organisation's locales
44
+ (`@eldrajs/theme-core/i18n`). Absent, nothing changes from today's behaviour.
45
+
46
+ - `eldraTheme()` takes a matching option for design tokens, `resolveTokens?: (manifestTokens) =>
47
+ ThemeDesignTokens` — when set, `virtual:eldra/tokens.css` generates its CSS from its return value
48
+ instead of `normalizeThemeDesignTokens(manifest.tokens)`. `@eldrajs/theme-nuxt`'s module is the one
49
+ caller: it sets this once its own build-time read of the organisation's resolved design-token
50
+ catalog has settled, answering that catalog outright — there is nothing to merge per key, unlike
51
+ messages — and falling back to the manifest's own tokens, normalized, when the read found nothing.
52
+ Absent, nothing changes from today's behaviour. See `docs/theme-design-tokens.md`'s new
53
+ "The build-time merge" section.
54
+
55
+ - A route template seed may now target `catalog:category`, and its pattern's trailing parameter is
56
+ the **catch-all** `:path*` (`/categories/:path*`) rather than `:slug`: a category is addressed by
57
+ its canonical path — the slugs of its ancestors, root first, then its own. The pairing is checked
58
+ both ways, so a category seed carrying `:slug` and a product or collection seed carrying a
59
+ catch-all are each refused by name, with the parameter the target actually takes. Core enforces
60
+ the same pairing on the route-template entry and on the manifest's seed target, so a pattern the
61
+ scan accepted and the deploy refused would be a scan that lied.
62
+
63
+ - `eldra.templates` now also declares **static page seeds**: an entry naming `page: { slug }`
64
+ instead of `schemaApiId`/`routePattern` seeds a Page at `/<slug>` (at most 16 of them, counted
65
+ separately from the 8 route templates). A seed names one target or the other, never both. Its
66
+ `blocks` array **is** the page in document order — there is no `layout` and there are no node
67
+ ids; Core lays the entries out in one column — and an entry is either a block
68
+ (`{ apiId, data, required? }`, emitted as `{ type: apiId, data, required? }`) or a placement of
69
+ one of the site's shared regions (`{ role: 'header' | 'footer' }`, emitted as the reserved
70
+ `{ type: '@header' }` / `{ type: '@footer' }`, at most once each and only where the theme declares
71
+ that `templateRoles` role). A region may sit anywhere in the order, so an announcement bar can
72
+ precede the header. `required: true` makes the node Core creates locked: the author reorders it
73
+ and edits its fields, but cannot delete it or move it out of the page root; it is refused on a
74
+ route template's blocks. Block `data` goes through exactly the walk a template seed's data does.
75
+ The home page is **not** a page seed — it stays the `templates` entry it has always been, which
76
+ Core maps to the site's root Page itself, so the home seed on the wire is unchanged, and a page
77
+ seed may not claim the slug `home` while that template seed exists. `pageSeeds` is absent rather
78
+ than empty when a theme seeds no pages. Every key a page seed cannot take is refused by name
79
+ rather than dropped — `layout`, `header` and `footer` on the seed, `templates`, `bindings` and
80
+ `id` on one of its block entries, and anything else at either level — because the manifest is
81
+ decoded with unknown fields disallowed, so a key swallowed by the scan would fail the entire
82
+ deploy later with a message about a file the author never wrote.
83
+
84
+ - A seed's `link` value with `kind: "url"` is checked against the platform's href allowlist rather
85
+ than only for being a non-blank string, so a scan refuses what a deploy refuses. A `mock.json` or
86
+ `preview.json` carrying `javascript:…`, a `data:` url, a protocol-relative `//host`, a bare `#`,
87
+ a backslash, a control character, a value over 2048 bytes or a scheme with the wrong number of
88
+ slashes (`https:example.com`) now fails `eldra-theme validate` and `pnpm dev`/`build` with a line
89
+ naming the path that carries it, instead of failing at the deploy — the one place a theme author
90
+ cannot fix it offline.
91
+
92
+ - A block migration step may now carry `convertToLink`, which turns an existing field's values into
93
+ a `link` field's on deploy — where a handle can still be resolved against the catalog — rather
94
+ than letting a composite-to-link change land as a retirement that leaves the new field empty:
95
+
96
+ ```jsonc
97
+ "migrations": [{
98
+ "version": 3,
99
+ "renames": [],
100
+ "convertToLink": [
101
+ { "from": "links", "to": "links", "shape": "list",
102
+ "label": "label", "url": "href",
103
+ "children": { "from": "menuLinks", "group": "group" } },
104
+ { "from": "ctaHref", "to": "cta", "shape": "string", "label": "ctaLabel" }
105
+ ]
106
+ }]
107
+ ```
108
+
109
+ `label`, `url` and `group` name the fields of the **row** being converted; `children` names the
110
+ nested list and the key names those nested rows use, each falling back to the step's own when it
111
+ is left out. They are separate because the row above rarely uses the same names — a footer column
112
+ is `{title, links[]}` while each link under it is `{label, href}`, which one set of keys could not
113
+ carry.
114
+
115
+ `shape` says what the old field was: a `string` holding an href, or a `list` of composites whose
116
+ named children carry the label, href, group and nested links. **The conversion copies; it never
117
+ deletes.** `from` is left alone, so the ordinary retirement pass then stashes it as
118
+ `<from>__v<previousVersion>` and anything the old shape carried and a link cannot hold stays
119
+ readable — and a step that converts still has to bump the block's version for that reason. It is
120
+ idempotent for free: on the next deploy `from` no longer exists under its old id.
121
+
122
+ The scanner checks that `to` exists in the incoming fields and is a `link` (or, for
123
+ `shape: "list"`, a list whose item is one), that no two conversions in a step write the same
124
+ field, that a `shape: "string"` conversion declares no `url`, `group` or `children` (it reads one
125
+ field and writes one link, so there are no rows to name), that a `children` mapping has an href
126
+ key at one level or the other (without one every child converts blank and is dropped), that
127
+ `from` exists in the previous local manifest — for as long as that manifest still describes the
128
+ old shape; a step stops being source-checked once `from` is gone or has itself become the link
129
+ the step writes, which is what redeploying an applied step produces — and
130
+ that every named key exists at the level it names: `label`/`url`/`group` on the previous item's
131
+ composite, `children.from` as a list of composites under it, and `children`'s own key names on
132
+ that nested composite. For `shape: "string"`, that `label` names another string field of the
133
+ previous block.
134
+
135
+ - `renames` is now optional on a migration step, so a step may carry only conversions. A step must
136
+ still declare at least one of `renames` and `convertToLink`.
137
+
138
+ - Seed data (a block's `mock.json`, a template seed's block data and a template role's data) may
139
+ name a `link` field's destination. A product or a collection may be named by handle —
140
+ `{ "kind": "collection", "target": { "_type": "collection", "slug": "the-winter-edit" } }` — and
141
+ Core resolves it against the organisation's own catalog at seed time, leaving that one link out
142
+ when nothing matches rather than emptying the field. The other kinds address
143
+ organisation-owned objects a theme has no portable name for, so a seed leaves their `target` out
144
+ and an author fills it in. The scanner refuses anything else: an unknown `kind`, a `url` on a
145
+ kind that is not `url` (or a missing one on a kind that is), a `target` on `kind: "url"`, an id
146
+ that is not a uuid, a target whose `_type` does not mirror its `kind` (the rule Core's own
147
+ validator refuses a mismatch on at deploy), a handle for a kind Core cannot resolve one for, and a
148
+ child carrying children of its own. Children are walked with the same rules, and a `link` inside a list or a
149
+ composite is walked as well.
150
+
151
+ - A `link` value may be `kind: "none"` — a heading that groups the links under it and goes nowhere
152
+ itself, which is the only shape a footer column heading or a mega-menu parent without its own page
153
+ has. It carries a `label` and non-empty `children`, never a `target` or a `url`, and is refused
154
+ anywhere it cannot head anything (as a child, or with no children of its own). `metadata.kinds`
155
+ accepts it alongside the six destinations.
156
+
157
+ - A block field may now declare `"type": "link"` — one destination the platform understands rather
158
+ than a typed-out URL. Its value is
159
+ `{ kind, target?: { _type, id }, url?, label?, openInNewTab?, group?, children? }` with `kind` one
160
+ of `product`, `collection`, `category`, `entry`, `page` or `url`; `url` is set only for
161
+ `kind: "url"` and `target` only for the other five, and `children` is one level deep and never
162
+ more. Three metadata keys belong to the type and to nothing else: `kinds` (the kinds an author may
163
+ pick from — every kind when absent), `allowedEntrySchemaApiIds` (restricts `kind: "entry"` to the
164
+ named schemas, and requires `kinds` to include `entry`), and `tree` (author the field as a tree of
165
+ one level of children — allowed only on a `link` that is a `list`'s `metadata.item`, because a
166
+ `list` may declare only `allowedSchemas` and `item` itself). A `link` field may not declare
167
+ `relation`. Each refusal names the field's own path
168
+ (`blocks/navigation/block.json: fields[3].metadata.item.metadata.kinds — unknown kind "blog"`).
169
+
170
+ - `.eldra/block-types.d.ts` types a `link` field as the new global `EldraLink` interface — a list of
171
+ links as `Array<EldraLink>`, a link inside a composite inline with the rest — and declares the
172
+ interface only when some block actually uses the type, the way `RichTextNode` is only imported
173
+ when one declares rich text.
174
+
175
+ - Seed data (a block's `mock.json`, a template seed's block data and a template role's data) may
176
+ now name a catalog collection by slug in a `reference` field:
177
+ `{ "_type": "collection", "slug": "the-winter-edit" }`. A theme cannot know an organisation's
178
+ collection ids, so this is the only form it can ship; Core resolves it against the
179
+ organisation's own catalog at seed time and leaves the field empty when nothing matches, so the
180
+ deploy still succeeds. The scanner now validates every seed reference value: absent,
181
+ `{ _type, id: <uuid> }`, or the slug form on a relation whose `allowCollections` is true.
182
+ Anything else — a bare handle string, a resolved read's whole object, a slug on a relation that
183
+ allows no collection — is a validation error naming the path that carries it
184
+ (`blocks/collection-grid/mock.json: collection: reference values must be absent, …`), the same
185
+ way a media value that is not `{assetId: uuid}` already was.
186
+
187
+ - A block field may now declare `showWhen: { "field": "<sibling>", "in": ["<value>", …] }` — the
188
+ field is offered to an author only while that sibling holds one of the listed values.
189
+ `equals: "x"` is sugar for `in: ["x"]` and is normalized away while scanning, so the manifest
190
+ always carries `in`. `field` names a sibling in the *same* field set (top level, or the same
191
+ composite / list item) which must be a `select`, `bool` or `string` field carrying no `showWhen`
192
+ of its own — conditions do not chain — and, for a `select` sibling, every listed value must be
193
+ one of its `metadata.options`. Each rule is a validation error naming the field
194
+ (`blocks/product-carousel/block.json: fields[2].showWhen.field — references unknown sibling
195
+ "variation"`), and Core's manifest ingest refuses the same shapes the same way. Visibility is
196
+ authoring UX, not storage: adding, changing or removing `showWhen` is **not** a breaking field
197
+ change, so it never demands a `version` bump, and the generated `.eldra/block-types.d.ts` is
198
+ unchanged by it.
199
+
200
+ - A declared template seed block may now carry `templates` and `bindings`
201
+ (`Record<string, string>` each), and they are emitted on that block's node in the generated —
202
+ or declared — seed layout rather than on `templates[].blocks[]`, which still carries only the
203
+ three keys Core decodes. Both are keyed by a target path into the block's own fields, the same
204
+ grammar the theme's template layout reads (identifier segments with list indices allowed:
205
+ `heading`, `items.0.label`, first segment a field the block declares), and each value must be a
206
+ non-empty string — a text template (`{{ title }}`) for `templates`, a path on the routed entry
207
+ for `bindings`. A key that is not such a path, or a value that is not a non-empty string, is a
208
+ validation error naming it (`templates[0].blocks[0].templates.subheading — must be a path into
209
+ hero's fields (expected …)`). This is what lets a catalog-backed seed fill a block in from the
210
+ object its route resolved instead of pinning one product or collection into the seed data.
211
+
212
+ - Themes can declare `templates`: up to 8 default page templates a site is seeded with on its
213
+ first deploy, so a merchant gets working product and collection pages without building
214
+ anything. A seed is `{ routePattern, schemaApiId, title, blocks: [{ id, apiId, data }],
215
+ layout? }`, where `schemaApiId` is `catalog:product`, `catalog:collection` or `home`, and each
216
+ block's `data` is the same kind of seed as a block's `mock.json` — validated the same way, so a
217
+ media value must be `{assetId: uuid}` or absent (`templates[0].blocks[1].data — image: media
218
+ values must be {assetId: uuid} — use preview.json for demo imagery`). Every block `apiId` must
219
+ be one the theme ships, ids are unique and shaped `^[a-z][a-z0-9-]{0,47}$`, and route patterns
220
+ do not repeat. The pattern has to agree with what the seed is a template for: `home` owns `/`,
221
+ and a catalog seed needs a static prefix plus the one `:slug` parameter it is resolved by. A seed without a `layout` gets one column of its blocks in order, framed by a
222
+ header and a footer node that name a *role* rather than a component id (the site's own reusable
223
+ components are resolved on deploy); `header: false` / `footer: false` leave the role out. Those
224
+ two switches steer the generated layout and are never written to the manifest. The key is
225
+ emitted only when a theme declares at least one seed.
226
+
227
+ A theme can also declare `templateRoles`: the block data behind the `header`/`footer` roles its
228
+ template seed layouts reference — `{ header?: { apiId, data }, footer?: { apiId, data } }`,
229
+ validated the same way as a seed block (`templateRoles.header.apiId — unknown block "…"`,
230
+ `templateRoles.header.data — …`). A role is required once any declared seed's layout places it
231
+ (generated or declared), whether or not that seed also carries the switch that puts it there:
232
+ `templateRoles.header — required: templates[0] places the header role`. Emitted only when the
233
+ theme declares at least one role, same as `templates`.
234
+
235
+ - A `reference` field's `relation` now names its targets as any combination of `allowedTagIds`
236
+ (semantic tag names), `allowProducts` and `allowCollections`, with at least one of them —
237
+ `allowedTagIds` is no longer required, and `allowProducts` is no longer refused. A relation that
238
+ names none — one carrying only `multiple` included — fails with `blocks/<id>/block.json:
239
+ fields[<i>] — relation requires one of allowedTagIds, allowProducts or allowCollections`, the
240
+ same rule and wording Core's manifest ingest applies. `allowedSchemaIds` stays refused (`themes
241
+ may use only relation.allowedTagIds, relation.allowProducts and relation.allowCollections`):
242
+ schema ids are not portable across organizations, while products and collections are catalog
243
+ objects every organization has.
244
+ - `generateBlockTypes` now declares `EldraCollectionReference`
245
+ (`{ id; _type: 'collection'; slug?; status?; type?; productCount?; translations? }` — only
246
+ `id`/`_type` are guaranteed, since the public read returns the stub at depth 0, for an archived
247
+ collection, and for a page builder draft overlay) and types a `reference` field whose relation targets
248
+ catalog collections *and nothing else* as `EldraCollectionReference | null`, or
249
+ `EldraCollectionReference[]` when the relation is `multiple`. A relation mixing targets keeps
250
+ `Record<string, unknown>`.
251
+ - The advisory local-history check now requires a block `version` bump for a storage-incompatible
252
+ field change (type or `localized` flip, or a nested composite/list child change) under the same
253
+ `fieldId`, and for a field removed without a declared rename — mirroring Core's field retirement,
254
+ which archives the previous content into a read-only `<fieldId>__v<n>` field on a bump instead of
255
+ refusing the deploy. Without the bump, `migrationChecks` fails with `blocks/<id>/block.json: field
256
+ <fieldId> changed type (<old> → <new>); bump "version" to <n+1> so Core retires the previous
257
+ content` (or `changed localization` / `was removed`). See `docs/theme-field-migrations.md` → "Type
258
+ changes and removed fields".
259
+ - First release under the `@eldrajs` scope, moved from the private `@eldra/vite-plugin-theme` package.
260
+ - Adds `generateBlockTypes(blocks)`, a framework-free generator that turns every scanned block's
261
+ `block.json` into a global ambient `.eldra/block-types.d.ts` (`interface EldraBlockData`,
262
+ `EldraBlockEntry<K>`, `EldraMedia`) so a theme's `Block.vue` components get typed `entry.data`.
263
+ The plugin now writes that file next to `.eldra/manifest.json` on `buildStart` and on block file
264
+ changes in dev, skipping the write when the content is unchanged.
265
+ - `scanTheme` now validates every media field value in a block's `mock.json` against Core's
266
+ write-side shape (`{ assetId: <uuid>, framing? }`), so a fixture-shaped value (or any other shape)
267
+ fails with `mock.json: <field>: media values must be {assetId: uuid} — use preview.json for demo
268
+ imagery` instead of only surfacing as a 400 when Studio later seeds a freshly-inserted block's CMS
269
+ entry from it. The check walks `list`/`composite` nesting and `multiple: true` media fields too. A
270
+ media field may still be entirely absent — that's the expected shape.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eldra Tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
1
  # @eldrajs/vite-plugin-theme
2
2
 
3
- Placeholder that reserved the name for trusted publishing. Install a real version.
3
+ Vite plugin for Eldra themes. Scans `blocks/*/block.json`, validates them against the manifest
4
+ schema, and emits the theme manifest plus the virtual modules a theme's runtime reads: block
5
+ components, the block manifest, per-block field projections, layout breakpoints, and generated
6
+ design-token CSS (including an optional Tailwind v4 theme layer). `./scan` exposes the scanner
7
+ standalone, used by `@eldrajs/theme-cli`'s `validate`/`types` commands.
8
+
9
+ ```bash
10
+ pnpm add -D @eldrajs/vite-plugin-theme
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ // vite.config.ts
17
+ import { defineConfig } from 'vite';
18
+ import eldraTheme from '@eldrajs/vite-plugin-theme';
19
+
20
+ export default defineConfig({
21
+ plugins: [eldraTheme({ tailwind: true })],
22
+ });
23
+ ```
24
+
25
+ ```ts
26
+ // scan a theme directory directly
27
+ import { scanTheme } from '@eldrajs/vite-plugin-theme/scan';
28
+
29
+ const { manifest, errors } = scanTheme({ themeDir: '.', framework: 'nuxt' });
30
+ ```
31
+
32
+ See [docs/themes.md](../../docs/themes.md) for the full theme integration guide.
@@ -0,0 +1,74 @@
1
+ import { A as ThemeManifest, C as ScanOptions, D as TemplateSeedLayoutNode, E as TemplateSeedLayout, O as TemplateSeedReusableNode, S as PageSeedTarget, T as TemplateSeedBlockNode, _ as ManifestPageSeedRegion, a as DeclaredPageSeedBlock, b as ManifestTemplateSeed, c as DeclaredSeed, d as DeclaredThemeCodePage, f as EldraThemeOptions, g as ManifestPageSeedEntry, h as ManifestPageSeedBlock, i as DeclaredPageSeed, j as ThemeMessages, k as TemplateSeedSchemaApiId, l as DeclaredTemplateSeed, m as ManifestPageSeed, n as BlockField, o as DeclaredPageSeedEntry, p as LegacyThemeTokens, r as BlockMigration, s as DeclaredPageSeedRegion, t as BlockDefinition, u as DeclaredTemplateSeedBlock, v as ManifestRoute, w as ScanResult, x as ManifestTemplateSeedBlock, y as ManifestTemplateRoles } from "./types-kcnroZCz.js";
2
+ import { Plugin } from "vite";
3
+ //#region src/plugin.d.ts
4
+ export default function eldraTheme(options?: EldraThemeOptions): Plugin;
5
+ //#endregion
6
+ //#region src/blockTypes.d.ts
7
+ export declare function generateBlockTypes(blocks: BlockDefinition[], messages?: ThemeMessages): string;
8
+ //#endregion
9
+ //#region src/templates.d.ts
10
+ /**
11
+ * The layout a seed gets when it declares none: one column of its blocks in
12
+ * order, framed by the header and footer roles unless the seed opts out. The
13
+ * roles are resolved to the site's own reusable components on deploy, which is
14
+ * why they travel as a role rather than an id.
15
+ */
16
+ export declare function seedLayout(seed: DeclaredTemplateSeed): TemplateSeedLayout;
17
+ /**
18
+ * Validates the theme's declared template seeds against the blocks it ships and
19
+ * returns them in manifest shape: every seed with a layout, and without the
20
+ * `header`/`footer` switches, which steer the generated layout and are never
21
+ * emitted.
22
+ *
23
+ * The declared list also carries static **page** seeds (`page: { slug }`);
24
+ * those are skipped here and validated by `validatePageSeeds`, which reads the
25
+ * same list. Only the template seeds count against the template cap.
26
+ */
27
+ export declare function validateTemplateSeeds(seeds: ReadonlyArray<DeclaredSeed>, blocks: ReadonlyArray<Record<string, unknown>>, errors: string[]): ManifestTemplateSeed[];
28
+ /**
29
+ * Validates the theme's declared **page** seeds — the entries of the same
30
+ * `templates` list that name `page: { slug }` instead of a template target —
31
+ * and returns them in manifest shape.
32
+ *
33
+ * A page seed is the simplest seed there is: a slug, a title and the page's
34
+ * content in document order. There is no `layout` and there are no node ids:
35
+ * the `blocks` array **is** the page, and Core synthesises the one-column
36
+ * layout from it. An entry is either
37
+ *
38
+ * - a **block** — `{ apiId, data, required? }`, emitted as
39
+ * `{ type: apiId, data, required? }`. `required: true` makes the node Core
40
+ * creates locked: the author reorders it and edits its fields but cannot
41
+ * delete it or move it out of the page root, so a cart page cannot lose its
42
+ * cart.
43
+ * - a **region placement** — `{ role: 'header' | 'footer' }`, emitted as the
44
+ * reserved `{ type: '@header' }` / `{ type: '@footer' }`. It carries no data:
45
+ * the block behind the region is `templateRoles`, and Core resolves the
46
+ * placement to the site's own reusable component, so every seeded page shares
47
+ * one header and one footer. A region may sit anywhere in the order — which
48
+ * is what lets an announcement bar precede the header — at most once each, and
49
+ * only when the theme declares that role.
50
+ *
51
+ * The **home** page is not a page seed. It keeps being the `templates` entry it
52
+ * has always been, which Core maps to the site's root Page itself, so the home
53
+ * seed on the wire is byte-identical to the one every theme has emitted; a page
54
+ * seed may therefore not claim the slug `home` while that template seed exists.
55
+ *
56
+ * Every rule a seed's data obeys is the one `validateTemplateSeeds` applies —
57
+ * the same `checkSeedData` walk, because a page seed is the same kind of write
58
+ * Core makes on deploy.
59
+ */
60
+ export declare function validatePageSeeds(seeds: ReadonlyArray<DeclaredSeed>, blocks: ReadonlyArray<Record<string, unknown>>, templates: ReadonlyArray<ManifestTemplateSeed>, roles: ManifestTemplateRoles | undefined, errors: string[]): ManifestPageSeed[];
61
+ /**
62
+ * Validates the block data a theme declares behind the `header`/`footer`
63
+ * roles its template seed layouts may reference, and returns it in manifest
64
+ * shape. A role's `apiId` must be a block the theme ships and its `data` is
65
+ * validated exactly like a seed block's data (the same media walk `mock.json`
66
+ * and `templates[].blocks[].data` go through) — the manifest write it becomes
67
+ * is the same kind of write. Cross-checked against the already-validated
68
+ * `templates`: a role a seed's layout places (whether generated or declared)
69
+ * and that the theme did not declare is an error naming the seed that needs
70
+ * it, so Core is never handed a template it cannot seed a site with.
71
+ */
72
+ export declare function validateTemplateRoles(roles: ManifestTemplateRoles | undefined, blocks: ReadonlyArray<Record<string, unknown>>, templates: ReadonlyArray<ManifestTemplateSeed>, errors: string[]): ManifestTemplateRoles | undefined;
73
+ //#endregion
74
+ export type { BlockDefinition, BlockField, BlockMigration, DeclaredPageSeed, DeclaredPageSeedBlock, DeclaredPageSeedEntry, DeclaredPageSeedRegion, DeclaredSeed, DeclaredTemplateSeed, DeclaredTemplateSeedBlock, DeclaredThemeCodePage, EldraThemeOptions, LegacyThemeTokens, ManifestPageSeed, ManifestPageSeedBlock, ManifestPageSeedEntry, ManifestPageSeedRegion, ManifestRoute, ManifestTemplateRoles, ManifestTemplateSeed, ManifestTemplateSeedBlock, PageSeedTarget, ScanOptions, ScanResult, TemplateSeedBlockNode, TemplateSeedLayout, TemplateSeedLayoutNode, TemplateSeedReusableNode, TemplateSeedSchemaApiId, ThemeManifest, ThemeMessages };