@eldrajs/theme-vue 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # @eldrajs/theme-vue 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
+ - `EldraContext` gains `messages` (reactive `{ defaultLocale, locales }`, flat dotted keys): the
9
+ theme's resolved message catalogue, defaulting to the fallback catalogue
10
+ (`{ defaultLocale: 'en-US', locales: {} }`) in `provideEldra()` (a new optional `messages` option
11
+ there overrides it — a Storybook mount or a unit test that passes none renders exactly as a
12
+ theme with no `i18n/` directory does), and to `virtual:eldra/messages`'s build-time-merged content
13
+ in `@eldrajs/theme-nuxt`'s runtime plugin. `useEldraPreview` handles the new
14
+ `editor:theme-messages` bridge message beside `editor:design-tokens`: `applyThemeMessages`
15
+ replaces `context.messages.locales[tag]` wholesale, per locale the push names (through
16
+ `@eldrajs/theme-core/i18n`'s `sanitizeLocaleMessages`, refusing a forbidden locale tag —
17
+ `__proto__`/`prototype`/`constructor` — that would otherwise reassign the live, reactive
18
+ object's own prototype instead of adding a property named for it), ignoring a stale revision
19
+ (`preview.messagesRevision`, mirroring `designTokensRevision`'s guard) the same way.
20
+
21
+ - `useEldraLink()` now spells every resolved same-site href in the active content locale, children
22
+ included — a navigation resolved on `/is-IS/...` points into `/is-IS/...` instead of dropping the
23
+ visitor back into the default language. The rewrite is idempotent, so a theme's router-link
24
+ component may prefix as well without the two compounding, and it short-circuits entirely on a
25
+ page in the locale served at `/`.
26
+
27
+ - `EldraContext` gains an optional `locales` slice (`EldraLocaleState`) and `useEldraLocale()`
28
+ reads it: which content locale the page is in, which locales the site serves, and three helpers
29
+ for spelling a destination in one of them (`path`, `switchPath`, `select`). It lives on the theme
30
+ context rather than in a framework composable so a **block** reaches it through the same single
31
+ `inject` it already uses — a block has to render in a Storybook story and a unit mount with no
32
+ router anywhere. `createEldraLocaleState()` is the one-unprefixed-site state every context starts
33
+ with (`provideEldra` seeds it), and an adapter with real routing replaces it;
34
+ `useEldraLocale()` answers the same shape outside a themed app, so a block can read it with no
35
+ branch. An adapter one version behind simply serves one unprefixed site.
36
+
37
+ - `EldraContext['preview']` gains `tokenRevision`, bumped every time `editor:init` carries a
38
+ preview token that differs from the one before it — a consumer can tell "a new token arrived"
39
+ from "another content update arrived" (`refreshRevision` bumps for both). A context assembled by
40
+ hand must include it; `createEldraPreviewState()` does.
41
+
42
+ - `startEldraPreview` posts the new `theme:request-failed` bridge message for every failed gateway
43
+ request the preview makes while a preview token is in use (404 excepted — that is a miss the theme
44
+ resolves itself). It is what lets the editor notice that the organization's single preview token
45
+ has been revoked by a mint elsewhere, hand over a fresh one and have the drafts reappear, instead
46
+ of the canvas silently showing none.
47
+
48
+ - New `useEldraLink()`: returns `(value) => ResolvedLink | null`, which resolves a `link` field's
49
+ value against the site's own pages and route templates. Keep the returned function — it closes
50
+ over the reactive theme context, so a row re-resolves when its target arrives or a preview draft
51
+ changes the value, and outside a themed app it resolves everything to `null` rather than throwing.
52
+ `resolveLink`, `linkTargetKeys`, `safeLinkHref` and the link types are re-exported from the
53
+ package root.
54
+
55
+ - `EldraContext` gains a reactive `links` slice (`pages`, `templates`, `targets`), built by the new
56
+ `createEldraLinkState()` beside `createEldraPreviewState()`. An adapter that assembles a context
57
+ by hand must build it from there.
58
+
59
+ - Feat: `EldraLayout` renders `data-eldra-hidden` on a layout node its style hides at one or more
60
+ breakpoints, listing them space separated (`data-eldra-hidden="tablet mobile"`). It is rendered
61
+ unconditionally — identical on the server and the client, carrying no styling of its own — and is
62
+ how `@eldrajs/theme-core`'s overlay finds the nodes to mark when Studio puts the theme in edit
63
+ mode, where a hidden node is dimmed rather than removed.
64
+
65
+ - Feat: `EldraLayout` renders reusable component placements inside a **route template**. The
66
+ `templateEntry` branch now passes `reusableComponentProjection` (an absent one is the empty
67
+ projection, so a placement fails closed exactly as it does on a page) and the resolved `blocks`
68
+ entry map into `@eldrajs/theme-core`'s `createTemplateLayoutRenderModel` — the expanded
69
+ component's blocks are ordinary block nodes and resolve through that map, where they previously
70
+ had none and rendered as the hidden `data-eldra-missing-block` placeholder. Identity is the page
71
+ behaviour byte for byte: each expanded node keeps its authored id, carries
72
+ `data-eldra-reusable-placement`, and gets the same deterministic render id and scoped class, so
73
+ Studio addresses a placement inside a template exactly as it addresses one inside a page. Pass
74
+ the **template read's own** projection: a projection carrying a binding the template does not
75
+ place fails the layout closed (`COMPONENT_STALE`). The **public** (non-preview) template read
76
+ arrives already expanded and carries no projection at all — the resolved entry map is what makes
77
+ that shape render too, and it renders the same layout, minus the preview-only placement identity.
78
+ - Fix: `EldraLayout`'s template-block catalog now carries each manifest block's declared field
79
+ renames (built from its `migrations` array via `@eldrajs/theme-core`'s `buildTemplateBlockRenames`),
80
+ so a route template's `template-block` node still keyed by a field's pre-migration name resolves
81
+ and renders instead of falling back to the hidden invalid-layout placeholder.
82
+ - **`EldraRichText` takes a `minHeadingLevel` prop**: a floor applied to every heading node at
83
+ render time (`h{max(minHeadingLevel, level)}`, still capped at 6; default `1`, i.e. the document's
84
+ own levels). A page owns its heading outline and a rich-text field does not — the same stored
85
+ document is legitimately an h2-and-down section in one block and an h3-and-down one in another —
86
+ and nothing in the document or in `block.json`'s level-agnostic `heading` toolbar control can say
87
+ so. Applying it at render time leaves the document untouched, so an editor's own level survives a
88
+ round trip through Studio and the `data-eldra-pos` stamps native editing depends on do not move; a
89
+ theme no longer needs a per-block transform over the TipTap JSON. The floor itself (and every
90
+ out-of-range/non-integer guard) is `@eldrajs/theme-core`'s `buildRichTextTree`, which gained the
91
+ matching `minHeadingLevel` render option.
92
+
93
+ - First release under the `@eldrajs` scope, moved from the private `@eldra/theme-vue` package.
94
+ - Fix: a draft's own top-level `select` field now unwraps to its plain string value the same way
95
+ one nested inside a draft's embedded block already did, so a live-editing `Block.vue`'s `===`
96
+ comparison keeps working for a top-level `select`/`variant` field too.
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,31 @@
1
- # Temporary Holding Version
1
+ # @eldrajs/theme-vue
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Vue 3 bindings for the Eldra theme SDK: `EldraBlockZone` and `EldraLayout` render a page's block
4
+ tree, `EldraRichText` renders a rich-text document, and `useEldra`/`provideEldra` share the entry
5
+ context down the component tree. `useEldraPreview`/`startEldraPreview` wire a theme up to the
6
+ Studio page-builder preview — live block edits, breakpoint switching, design tokens and the
7
+ in-place overlay — over `@eldrajs/theme-core`'s bridge. It imports only `vue` and
8
+ `@eldrajs/theme-core`.
9
+
10
+ ```bash
11
+ pnpm add @eldrajs/theme-vue
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import { createApp } from 'vue';
18
+ import { EldraBlockZone, provideEldra } from '@eldrajs/theme-vue';
19
+
20
+ const app = createApp({
21
+ setup() {
22
+ provideEldra({ entry, client });
23
+ },
24
+ });
25
+ ```
26
+
27
+ `EldraBlockZone`/`EldraLayout` resolve block components from the `virtual:eldra/blocks` module
28
+ that `@eldrajs/vite-plugin-theme` generates at build time — this package never bundles a stub for
29
+ it, so it must be consumed through the Vite plugin.
30
+
31
+ See [docs/themes.md](../../docs/themes.md) for the full theme integration guide.