@obelism/content-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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -2
  3. package/package.json +63 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Obelism
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,87 @@
1
- # Temporary Holding Version
1
+ # Obelism Content Vue SDK
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
+ Live preview in the visual editor and rich text, for Vue 3 and Nuxt.
4
+
5
+ ```bash
6
+ npm i @obelism/content @obelism/content-vue
7
+ ```
8
+
9
+ ## Live preview
10
+
11
+ ```vue
12
+ <!-- app.vue: starts the bridge, so blocks are selectable on every page -->
13
+ <template>
14
+ <ContentBridge />
15
+ <NuxtPage />
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { ContentBridge } from '@obelism/content-vue'
20
+ </script>
21
+ ```
22
+
23
+ ```vue
24
+ <!-- A component rendering an entry -->
25
+ <script setup lang="ts">
26
+ import { editable, useLiveEntry } from '@obelism/content-vue'
27
+
28
+ const props = defineProps<{ entry: PageEntry }>()
29
+ // The editor's unsaved version while editing, `entry` everywhere else.
30
+ const live = useLiveEntry(() => props.entry)
31
+ </script>
32
+
33
+ <template>
34
+ <main v-bind="editable(live)">
35
+ <section
36
+ v-for="block in live.fields.body"
37
+ :key="block._uid"
38
+ v-bind="editable(block)"
39
+ >
40
+ …
41
+ </section>
42
+ </main>
43
+ </template>
44
+ ```
45
+
46
+ - `useLiveEntry(entry, { url? })`: a computed ref of `entry` (a ref, getter or
47
+ value), or the editor's live version of it.
48
+ - `useContentBridge()`: a computed ref of `{ isEditing, mode, entryId,
49
+ environment }`, after mount.
50
+ - `useContentBridgeEvent('saved' | 'published' | 'update', listener)`, e.g.
51
+ `refreshNuxtData()` on publish.
52
+ - `<ContentBridge url? prompt? page-path? />`: pass `url` only when not on
53
+ content.obelism.studio; `pagePath(path, locale)` maps a CMS path in a locale
54
+ to the site's URL for pages made with New page (default `/` + path).
55
+
56
+ Call the composables in `setup`. The bridge starts after mount, so server
57
+ rendering and hydration always see "not editing".
58
+
59
+ ## Prompt editing
60
+
61
+ `<ContentBridge />` shows editors a prompt box inside the visual editor (see
62
+ `@obelism/content`). `<ContentBridge :prompt="false" />` leaves it out;
63
+ `useContentPrompt()` gives a computed ref of `{ available, mode, prompting,
64
+ canUndo, selectedUid, prompt, createPage, undo, select, save, publish, signOut,
65
+ setSelecting }` for your own UI.
66
+
67
+ ## Rich text
68
+
69
+ ```vue
70
+ <RichText
71
+ :document="entry.fields.body"
72
+ :embedded-entry="Card"
73
+ :nodes="{ heading: Heading }"
74
+ :marks="{ link: Link }"
75
+ />
76
+ ```
77
+
78
+ Overrides are components: a node or mark override gets `node` or `mark` as a
79
+ prop and its rendered children in the default slot, an embed gets `entry` or
80
+ `asset` and `node`.
81
+
82
+ ```ts
83
+ const Heading: FunctionalComponent<RichTextNodeProps> = (_, { slots }) =>
84
+ h('h2', { class: 'title' }, slots.default?.())
85
+ ```
86
+
87
+ Renders on the server too.
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
- "name": "@obelism/content-vue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@obelism/content-vue",
3
+ "description": "Obelism Content Vue SDK: live preview in the visual editor and rich text, for Vue and Nuxt",
4
+ "version": "0.1.0",
5
+ "keywords": [
6
+ "cms",
7
+ "headless-cms",
8
+ "visual-editor",
9
+ "typescript",
10
+ "obelism",
11
+ "vue",
12
+ "nuxt"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "Obelism <hello@obelism.studio> (https://www.obelism.studio)",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/Obelism/sdk",
19
+ "directory": "packages/content-vue"
20
+ },
21
+ "sideEffects": false,
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "exports": {
26
+ "import": {
27
+ "types": "./dist/index.d.mts",
28
+ "default": "./dist/index.mjs"
29
+ },
30
+ "require": {
31
+ "types": "./dist/index.d.ts",
32
+ "default": "./dist/index.js"
33
+ }
34
+ },
35
+ "scripts": {
36
+ "build": "bunchee",
37
+ "dev": "bunchee --watch --no-clean",
38
+ "test": "vitest",
39
+ "test:coverage": "vitest run --coverage",
40
+ "test:ci": "vitest run",
41
+ "lint": "npm-run-all --parallel lint:*",
42
+ "lint:oxlint": "oxlint",
43
+ "lint:types": "tsc --noEmit",
44
+ "clean": "rm -rf ./node_modules && rm -rf ./dist && rm -rf ./.turbo"
45
+ },
46
+ "peerDependencies": {
47
+ "vue": ">=3.3.0"
48
+ },
49
+ "dependencies": {
50
+ "@obelism/content": "^0.29.0"
51
+ },
52
+ "devDependencies": {
53
+ "@obelism/sdk-typescript-config": "^0.0.0",
54
+ "@typescript/typescript6": "^6.0.2",
55
+ "@vue/test-utils": "^2.5.1",
56
+ "bunchee": "^7.0.2",
57
+ "jsdom": "^30.1.3",
58
+ "npm-run-all2": "^9.0.4",
59
+ "oxlint": "^1.91.0",
60
+ "typescript": "^7.0.2",
61
+ "vitest": "^5.1.0",
62
+ "vue": "^3.5.45"
63
+ }
64
+ }