@lupinum/ginko-editor 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 (120) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE +21 -0
  3. package/README.md +346 -2
  4. package/dist/GinkoEditor.vue.d.ts +96 -0
  5. package/dist/GinkoImagePicker.vue.d.ts +36 -0
  6. package/dist/agent/AGENTS.md +13 -0
  7. package/dist/agent/pages/docs/getting-started/collaboration.md +435 -0
  8. package/dist/agent/pages/docs/getting-started/component-coverage.md +107 -0
  9. package/dist/agent/pages/docs/getting-started/customize.md +384 -0
  10. package/dist/agent/pages/docs/getting-started/images.md +188 -0
  11. package/dist/agent/pages/docs/getting-started/in-place-editing.md +110 -0
  12. package/dist/agent/pages/docs/getting-started/layout-blocks.md +148 -0
  13. package/dist/agent/pages/docs/getting-started/runtime.md +111 -0
  14. package/dist/agent/pages/docs/getting-started.md +128 -0
  15. package/dist/authoring-D7MJezVG.js +1780 -0
  16. package/dist/authoring-D7MJezVG.js.map +1 -0
  17. package/dist/authoring.d.ts +122 -0
  18. package/dist/authoring.js +2 -0
  19. package/dist/collaboration.d.ts +14 -0
  20. package/dist/collaboration.js +907 -0
  21. package/dist/collaboration.js.map +1 -0
  22. package/dist/composables/useAssetRequests.d.ts +44 -0
  23. package/dist/composables/useCollaborationBinding.d.ts +59 -0
  24. package/dist/composables/useDevice.d.ts +10 -0
  25. package/dist/composables/useInsertMenu.d.ts +67 -0
  26. package/dist/composables/useMarkdownSync.d.ts +96 -0
  27. package/dist/composables/useStableAuthoringKit.d.ts +16 -0
  28. package/dist/documentConfig-Z6LdrWZj.js +2360 -0
  29. package/dist/documentConfig-Z6LdrWZj.js.map +1 -0
  30. package/dist/editorProps.d.ts +124 -0
  31. package/dist/index.d.ts +15 -0
  32. package/dist/index.js +5668 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/layout-kit.d.ts +922 -0
  35. package/dist/lib/collaboration/presence-record.d.ts +18 -0
  36. package/dist/lib/collaboration/presence.d.ts +103 -0
  37. package/dist/lib/collaboration/protocol.d.ts +133 -0
  38. package/dist/lib/collaboration/recovery.d.ts +45 -0
  39. package/dist/lib/collaboration/session.d.ts +163 -0
  40. package/dist/lib/collaboration/validation.d.ts +42 -0
  41. package/dist/lib/component-converters.d.ts +119 -0
  42. package/dist/lib/config/documentConfig.d.ts +19 -0
  43. package/dist/lib/config/editorConfig.d.ts +38 -0
  44. package/dist/lib/container-items.d.ts +55 -0
  45. package/dist/lib/conversionInvariants.d.ts +3 -0
  46. package/dist/lib/conversionLogger.d.ts +10 -0
  47. package/dist/lib/conversionPipeline.d.ts +17 -0
  48. package/dist/lib/conversionState.d.ts +10 -0
  49. package/dist/lib/conversionTypes.d.ts +50 -0
  50. package/dist/lib/editor-operations.d.ts +39 -0
  51. package/dist/lib/environment.d.ts +6 -0
  52. package/dist/lib/extensions/code-block.d.ts +18 -0
  53. package/dist/lib/extensions/component-boundary.d.ts +9 -0
  54. package/dist/lib/extensions/container-items.d.ts +29 -0
  55. package/dist/lib/extensions/element.d.ts +19 -0
  56. package/dist/lib/extensions/file.d.ts +24 -0
  57. package/dist/lib/extensions/heading.d.ts +5 -0
  58. package/dist/lib/extensions/image-upload.d.ts +39 -0
  59. package/dist/lib/extensions/image.d.ts +39 -0
  60. package/dist/lib/extensions/index.d.ts +10 -0
  61. package/dist/lib/extensions/inline-element.d.ts +13 -0
  62. package/dist/lib/extensions/markdown-clipboard.d.ts +21 -0
  63. package/dist/lib/extensions/profile.d.ts +11 -0
  64. package/dist/lib/extensions/slot.d.ts +16 -0
  65. package/dist/lib/extensions/span-style.d.ts +15 -0
  66. package/dist/lib/extensions/video.d.ts +15 -0
  67. package/dist/lib/image-properties.d.ts +20 -0
  68. package/dist/lib/input-rules.d.ts +7 -0
  69. package/dist/lib/markdown.d.ts +11 -0
  70. package/dist/lib/marks.d.ts +7 -0
  71. package/dist/lib/mdcToTiptap.d.ts +20 -0
  72. package/dist/lib/mdcTypes.d.ts +20 -0
  73. package/dist/lib/nodes.d.ts +57 -0
  74. package/dist/lib/nodeviews/block-actions.d.ts +7 -0
  75. package/dist/lib/nodeviews/code.d.ts +4 -0
  76. package/dist/lib/nodeviews/columns.d.ts +17 -0
  77. package/dist/lib/nodeviews/component.d.ts +6 -0
  78. package/dist/lib/nodeviews/icons.d.ts +26 -0
  79. package/dist/lib/nodeviews/image.d.ts +9 -0
  80. package/dist/lib/nodeviews/items.d.ts +15 -0
  81. package/dist/lib/nodeviews/lifecycle.d.ts +45 -0
  82. package/dist/lib/nodeviews/popover.d.ts +15 -0
  83. package/dist/lib/nodeviews/settings.d.ts +11 -0
  84. package/dist/lib/nodeviews/table-operations.d.ts +50 -0
  85. package/dist/lib/nodeviews/table.d.ts +4 -0
  86. package/dist/lib/profiles.d.ts +62 -0
  87. package/dist/lib/property-input.d.ts +10 -0
  88. package/dist/lib/property-step.d.ts +77 -0
  89. package/dist/lib/props.d.ts +13 -0
  90. package/dist/lib/stripStyleNodes.d.ts +2 -0
  91. package/dist/lib/tiptapToMdc.d.ts +18 -0
  92. package/dist/presence-record-CLdPZWKC.js +291 -0
  93. package/dist/presence-record-CLdPZWKC.js.map +1 -0
  94. package/dist/runtime.d.ts +13 -0
  95. package/dist/runtime.js +3 -0
  96. package/dist/style.css +2 -0
  97. package/dist/types.d.ts +126 -0
  98. package/dist/ui/GinkoActionButton.vue.d.ts +8 -0
  99. package/dist/ui/GinkoInsertMenu.vue.d.ts +49 -0
  100. package/dist/ui/GinkoKeyboardDock.vue.d.ts +15 -0
  101. package/dist/ui/GinkoNodePopover.vue.d.ts +21 -0
  102. package/dist/ui/GinkoRecipeIcon.vue.d.ts +6 -0
  103. package/dist/ui/GinkoSelectionToolbar.vue.d.ts +10 -0
  104. package/dist/ui/GinkoToolbar.vue.d.ts +26 -0
  105. package/dist/ui/GinkoToolbarIcon.vue.d.ts +6 -0
  106. package/dist/ui/block-shortcuts.d.ts +6 -0
  107. package/dist/ui/commands.d.ts +78 -0
  108. package/dist/ui/context.d.ts +23 -0
  109. package/dist/ui/editor-keyboard.d.ts +15 -0
  110. package/dist/ui/messages.d.ts +214 -0
  111. package/dist/ui/messages.de.d.ts +6 -0
  112. package/dist/ui/recipe-command.d.ts +14 -0
  113. package/dist/ui/recipe-search.d.ts +47 -0
  114. package/dist/ui/slash-command.d.ts +17 -0
  115. package/dist/ui/writingRecipes.d.ts +13 -0
  116. package/package.json +118 -3
  117. package/skills/ginko-editor/SKILL.md +40 -0
  118. package/skills/ginko-editor/agents/openai.yaml +4 -0
  119. package/skills/ginko-editor/references/in-place-editing.md +50 -0
  120. package/skills/ginko-editor/references/quickstart.md +55 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,78 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ First release on npm. Ginko Editor is a Vue editor for Ginko content. Markdown
6
+ is the stored value, and the visual editor opens a document only when it can
7
+ keep its meaning; any other document stays in source mode. Documentation:
8
+ https://ginko-editor.lupinum.com
9
+
10
+ ### What it does
11
+
12
+ - **Visual and source editing** of Ginko MDC, with a toolbar, a block menu,
13
+ inline component editing, tables, and clipboard round trips that keep
14
+ component values, media metadata, list paragraphs, table alignment and
15
+ code fences.
16
+ - **Layout blocks** for the Ginko Docs components (`createGinkoLayoutKit()`):
17
+ callouts, columns, tabs, accordion, steps, cards, timeline, code group,
18
+ figure and more. Tabs, accordion items, steps, cards and timeline entries are
19
+ edited in place, and each change is one undo step.
20
+ - **A block menu** grouped by Text, Lists, Media, Layout, Callouts, Advanced and
21
+ your own groups, with fuzzy search, highlighted matches and recent blocks.
22
+ - **Images, files and videos** through the `request-image`, `request-file` and
23
+ `request-video` events or an `asset-provider`. Uploads are limited by
24
+ `image-max-bytes` (default 10 MB).
25
+ - **Editor profiles, in-place editing and an inline variant** for editing
26
+ inside a page instead of a full editor.
27
+ - **Document safety.** Saved Markdown escapes text that a site parser would
28
+ turn into a link, typed `{{ … }}`, `:name:` and times stay text,
29
+ headings keep custom `{#id}` anchors, and an unknown node stops the save with
30
+ an error instead of losing content.
31
+ - **A server entry**, `@lupinum/ginko-editor/runtime`, that converts and
32
+ validates documents without Vue or browser globals.
33
+ - **Shared editing (experimental).** A transport interface with presence
34
+ (remote carets and a collaborator list), offline and retry states, recovery
35
+ of unsent changes, and server-side validation. It can change in a minor
36
+ release.
37
+ - **Styling and text.** Styles live in the `ginko` cascade layer and use public
38
+ `--ginko-*` tokens, with dark mode through a `.dark` ancestor or
39
+ `data-ginko-theme`. All interface text is in `messages`; English and German
40
+ ship with the package.
41
+ - **Agent docs.** The package ships its version-matched documentation and an
42
+ agent skill.
43
+
44
+ ### Requirements
45
+
46
+ - `@lupinum/ginko-content` `>=1.0.0-beta.11 <2`, so the editor and your site
47
+ renderer share one parser.
48
+ - TipTap `^3.31.4` (`@tiptap/core`, `@tiptap/pm`, `@tiptap/vue-3`) and Vue
49
+ `^3.5.40`. The `/runtime` entry needs neither Vue nor `@tiptap/vue-3`.
50
+
51
+ ### Upgrading from a pre-release build
52
+
53
+ Only for hosts that installed a tarball or preview build before 0.1.0, such as
54
+ Ginko CMS.
55
+
56
+ - Install `@lupinum/ginko-content` in the host. It is now a peer dependency.
57
+ - The component handle is `GinkoEditorHandle`: `flush()`,
58
+ `hasPendingChanges()`, `removeSelectedMedia()`, `focus(position?)` and
59
+ `getEditor()`. Replace `handle.editor` with `handle.getEditor()`, and insert
60
+ assets through the request events instead of `insertImageAsset`,
61
+ `insertFileAsset` and `insertVideo`. `rawContent` and `viewMode` are gone.
62
+ - A flush `error` is a `ConversionErrorPayload` or a state error with the code
63
+ `image_upload_pending`, `collaboration_pending` or `not_ready`. Check `code`
64
+ first.
65
+ - The `enableDebug` prop is removed.
66
+ - CSS tokens are renamed: `--ginko-bg`, `--ginko-text`, `--ginko-muted-text`,
67
+ `--ginko-popover-text` and `--ginko-accent-bg` become `--ginko-background`,
68
+ `--ginko-foreground`, `--ginko-muted-foreground`,
69
+ `--ginko-popover-foreground` and `--ginko-accent`. Unlayered host rules now
70
+ override editor styles.
71
+ - Block drag handles and block reordering are removed.
72
+ - Shared editing: import transport types from `@lupinum/ginko-editor/runtime`,
73
+ let backends with strict argument validation accept the optional
74
+ `protocolVersion` field, and re-seed shared rooms for the schema revision
75
+ `ginko-editor-2`. New component insertions record angle syntax; rooms saved
76
+ without source-origin data keep the colon syntax. Update client and backend
77
+ together.
78
+ - The `V1` type names and `VideoInfo` still work as deprecated aliases.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lupinum OG
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,347 @@
1
- # Temporary Holding Version
1
+ <p align="center"><img src="docs/public/icon.svg" width="128" alt="Ginko Editor icon"></p>
2
+ <h1 align="center">Ginko Editor</h1>
3
+ <p align="center">A portable Vue editor for Ginko content.</p>
2
4
 
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.
5
+ > [!NOTE]
6
+ > Ginko Editor is before 1.0, so a minor release can change the API. Shared editing is experimental.
7
+
8
+ ## Why use Ginko Editor?
9
+
10
+ Use Ginko Editor to add one portable Ginko content editor to a Vue application.
11
+ The package ships Vue component code, TypeScript declarations, and opt-in CSS.
12
+
13
+ ## When to use it
14
+
15
+ Use this package in Vue 3 applications that edit Ginko MDC source. Markdown is
16
+ the canonical value. The visual editor only opens when it can preserve the
17
+ document's parsed meaning. Unsupported or invalid documents stay in source mode.
18
+
19
+ ## Requirements
20
+
21
+ - A bundler that resolves package `exports`, such as Vite or Nuxt, on Node.js 22.18 or later.
22
+ - Vue 3.5.40 or later and TipTap 3.31.4 or a later 3.x version in the application.
23
+ The root entry needs `vue` and `@tiptap/vue-3`.
24
+ - `@lupinum/ginko-content` 1.0.0-beta.11 or a later 1.x version. It is a peer
25
+ dependency and supplies the shared CMS contract.
26
+
27
+ Repository development has separate requirements. Read [CONTRIBUTING.md](CONTRIBUTING.md).
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pnpm add @lupinum/ginko-editor @lupinum/ginko-content @tiptap/core @tiptap/pm @tiptap/vue-3 vue
33
+ ```
34
+
35
+ Import `@lupinum/ginko-editor/style.css` one time in the application. The
36
+ JavaScript entries do not import CSS.
37
+
38
+ The `@lupinum/ginko-editor/runtime` entry converts and validates documents
39
+ without Vue views or browser globals. Server code needs only these packages:
40
+
41
+ ```bash
42
+ pnpm add @lupinum/ginko-editor @lupinum/ginko-content @tiptap/core @tiptap/pm
43
+ ```
44
+
45
+ The runtime entry does not import Vue. A package manager can still install Vue
46
+ because other packages declare it as a peer dependency.
47
+
48
+ ## Quick start
49
+
50
+ ```vue
51
+ <script setup lang="ts">
52
+ import { ref } from 'vue'
53
+ import { GinkoEditor } from '@lupinum/ginko-editor'
54
+ import '@lupinum/ginko-editor/style.css'
55
+
56
+ const source = ref('# Hello\n')
57
+ </script>
58
+
59
+ <template>
60
+ <GinkoEditor v-model="source" :enable-images="false" :enable-files="false" :enable-video="false" />
61
+ </template>
62
+ ```
63
+
64
+ Opening, closing, or changing modes does not rewrite `source`. A real visual edit
65
+ emits normalized MDC. An invalid or unsupported value remains byte-for-byte
66
+ available in the Markdown textarea.
67
+
68
+ The host owns persistence and asset selection. Supply `image-upload` and/or `image-picker` for the inline
69
+ image flow below, or listen for `request-image`,
70
+ `request-file`, or `request-video`, then call the event request's `complete`
71
+ method after the user selects an asset. Pass `null` when selection is cancelled.
72
+ Each request can complete once. Cancellation is permanent. Completion returns
73
+ `false` if nothing was applied, including an empty asset source or a changed
74
+ document, selection, mode, or editability. Set `enable-images`, `enable-files`,
75
+ and `enable-video` to `false` for pickers your host does not provide. These flags
76
+ control insertion actions; existing media remains readable and removable.
77
+ Only the latest emitted value is recognized as a normal `v-model` echo. After an
78
+ external replacement, the current external source remains authoritative; hosts
79
+ should not replay older editor emissions as intentional replacements.
80
+ Before closing the editor or replacing its document, await the exposed `flush()`
81
+ method. Continue only when it returns `{ ok: true }`. A `{ ok: false, error }`
82
+ result means conversion failed or an image operation is unfinished: keep the editor
83
+ open so the user can correct the document, finish the image operation, or remove it. The `error` is a
84
+ `ConversionErrorPayload`, or `{ code, message }` with code `image_upload_pending`,
85
+ `collaboration_pending`, or `not_ready`. A failed flush blocks switching to Markdown, which
86
+ would otherwise replace pending visual edits with older source. `flush()` emits
87
+ the latest converted source but does
88
+ not persist it; the host still owns and must await its save operation.
89
+ The editor does not import Nuxt, the CMS, Convex, or an application router.
90
+
91
+ The component handle, from a template ref, has the type `GinkoEditorHandle`:
92
+ `flush()`, `hasPendingChanges()`, `removeSelectedMedia()`, `focus(position?)`, and
93
+ `getEditor()`. `getEditor()` returns the TipTap editor as an unstable escape hatch.
94
+ All props are reactive except `collaboration` and `profile`, which the editor reads
95
+ once when it mounts. New inline callbacks and equal authoring kits do not cancel uploads or
96
+ reload the document.
97
+
98
+ ## Edit text in place
99
+
100
+ `variant="inline"` edits text where it appears on the page, with the host's
101
+ typography and no frame, header, or source switch. `profile` limits what a
102
+ writer can create: `plain`, `inline` (bold, italic, link), `article`, or `full`.
103
+ It applies to the toolbar, shortcuts, the slash menu, Markdown input rules, and
104
+ paste. On touch devices the formatting row docks above the on-screen keyboard
105
+ and the floating selection toolbar is off. `germanMessages` is a complete German
106
+ message set. See [Edit text in place](docs/content/docs/1.getting-started/8.in-place-editing.md).
107
+
108
+ ## Agent skill
109
+
110
+ The package ships an agent skill in `skills/ginko-editor`. Point your coding
111
+ agent at it to embed and configure the editor correctly.
112
+
113
+ ## Writing and component previews
114
+
115
+ Type `/` on a new paragraph or use **Insert** to search writing blocks. Native
116
+ Markdown blocks work without an authoring kit; host kits add component recipes.
117
+ Recipes can include a short `description`, search `keywords`, a menu `group`,
118
+ and a Lucide `icon` name. The menu groups results, shows recent blocks first, and
119
+ offers "Add tab" or "Add item" when the caret is inside a container.
120
+
121
+ ### Built-in layout blocks
122
+
123
+ The editor includes a layout kit with the Ginko Docs components: callouts, tabs,
124
+ accordions, steps, cards, timelines, columns, code groups, figures, quizzes, and
125
+ more. Its policy is the Ginko Docs policy, so the documents render on a Docs site.
126
+ Compose it with your own kit:
127
+
128
+ ```ts
129
+ import { composeAuthoringKits, ginkoLayoutKitSource } from '@lupinum/ginko-editor/authoring'
130
+
131
+ const kit = await composeAuthoringKits(ginkoLayoutKitSource, hostKitSource)
132
+ ```
133
+
134
+ `createGinkoLayoutKit()` returns the layout kit alone. See
135
+ [Layout blocks](docs/content/docs/1.getting-started/4.layout-blocks.md) for what
136
+ each block can edit.
137
+
138
+ The optional `recipe-preview` slot receives `{ recipe }`. Hosts render its source
139
+ with Ginko Content and their own components. The menu handles selection, focus,
140
+ viewport placement, and insertion. The package does not depend on host renderers.
141
+
142
+ Copy and Cut put canonical Markdown and component source on the clipboard, so
143
+ selections can be shared with AI tools or pasted back into the editor. Titles
144
+ and settings are serialized as component properties; editing controls are never
145
+ copied. Text selected inside a title or settings input copies normally.
146
+ Markdown paste uses Content's parser and the same fidelity checks as opening a
147
+ document. An unsupported paste leaves the document unchanged and explains why.
148
+ `createAuthoringKit` consumes and freezes its input before asynchronous recipe
149
+ validation. Pass a fresh object if the application must keep an editable draft
150
+ of the configuration.
151
+
152
+ ## Images: upload and browse
153
+
154
+ Provide one callback to enable an upload placeholder for **Add image**, `/image`,
155
+ and **Replace image**. The editor accepts one non-empty image file per placeholder,
156
+ up to 10 MB by default, from the file chooser or drag and drop. Set
157
+ `image-max-bytes` to change the limit. Add `image-picker` to
158
+ show **Browse images** in the same placeholder. A picker can also run without
159
+ an upload callback. Drop a file directly
160
+ onto the editor to see its preview and confirm **Add image**. Drop onto an
161
+ existing editor image to confirm **Replace image** in a compact popover attached
162
+ to that image, without moving the document. Cancel preserves the original;
163
+ no upload starts before confirmation. Dropping inside text chooses the nearby
164
+ block boundary, independently of the current caret.
165
+
166
+ By default, the editor owns file drops within its own surface. To include an
167
+ outer writing workspace, pass its element as `image-drop-target`. Drops outside
168
+ the editor append to the document; nested independent editors keep their own
169
+ drop handling. The playground uses this option for its whole workspace, including
170
+ the reader pane. Dragging existing content and block-reordering controls are not supported.
171
+
172
+ ```vue
173
+ <script setup lang="ts">
174
+ import { ref } from 'vue'
175
+ import { GinkoEditor, type ImageUploadHandler } from '@lupinum/ginko-editor'
176
+ import '@lupinum/ginko-editor/style.css'
177
+ import { saveImage } from './assets' // Your host's validated storage operation.
178
+
179
+ const source = ref('')
180
+ const uploadImage: ImageUploadHandler = async (file, { signal }) => {
181
+ const saved = await saveImage(file, { signal })
182
+ return { url: saved.url, alt: file.name }
183
+ }
184
+ </script>
185
+
186
+ <template>
187
+ <GinkoEditor v-model="source" :image-upload="uploadImage" :enable-files="false" :enable-video="false" />
188
+ </template>
189
+ ```
190
+
191
+ Return a durable URL, or an `id` with an `asset-provider` that resolves it for
192
+ display. The provider's safe display URL takes precedence over the stored image
193
+ source. A host-policy `image` keeps native controls after reload when its stable
194
+ `id` equals `src` and its complete property and media contract matches native
195
+ image editing. Restricted or extended image policies keep component controls so
196
+ native actions cannot write unsupported properties.
197
+ Match stored references to the consuming Content policy; native image
198
+ URLs support site-relative paths such as `/images/photo.png`. Use
199
+ `image-output="markdown"` for native Markdown; the default MDC output also
200
+ preserves supported image dimensions and crop/focal metadata.
201
+
202
+ The host validates and persists files. Reject with a user-facing error to keep
203
+ the placeholder available for retry. Respect `signal` to cancel work when the
204
+ placeholder, document, active handler, or editor lifetime changes. A failed or
205
+ cancelled replacement keeps the original image. Completion follows the original
206
+ insertion point as text changes and does not interrupt typing elsewhere.
207
+
208
+ Pending placeholders are temporary view state, never Markdown or document nodes.
209
+ `hasPendingChanges()` and `pending-change` include them; `flush()` returns
210
+ `image_upload_pending` until upload or browse operations finish or are removed. Preserve this guard when
211
+ saving, leaving, or changing documents. When neither `image-upload` nor `image-picker` is provided, the existing
212
+ `request-image` event applies. The callback flow takes precedence over that event.
213
+
214
+ `ImagePicker` receives `{ signal, current? }` and resolves an `EditorImage` or
215
+ `null`. Return a stored `{ id }` or a durable `{ url }`, plus optional presentation
216
+ metadata. Use the exported `GinkoImagePicker` for a controlled library dialog, or
217
+ provide your own picker. The host owns its images, search, pagination, and uploads.
218
+ See the [image picker guide](docs/content/docs/1.getting-started/3.images.md) for a
219
+ complete callback adapter and cancellation rules.
220
+
221
+ The docs playground stores uploaded files in this browser's IndexedDB. Its local
222
+ image references survive reloads in that browser, but do not publish images or
223
+ make them available on other devices. Applications supply their own storage.
224
+
225
+ ## Inline component controls
226
+
227
+ The kit describes editing controls without depending on Vue render components:
228
+
229
+ ```ts
230
+ // Authoring metadata alongside an existing Content policy and implementation.
231
+ authoring: {
232
+ note: {
233
+ label: 'Note',
234
+ props: { title: { label: 'Title', control: 'text' } },
235
+ canvas: { titleProp: 'title', switchGroup: 'callout', tone: 'neutral' },
236
+ },
237
+ warning: {
238
+ label: 'Warning',
239
+ props: { title: { label: 'Title', control: 'text' } },
240
+ canvas: { titleProp: 'title', switchGroup: 'callout', tone: 'warning' },
241
+ },
242
+ layout: {
243
+ label: 'Columns',
244
+ canvas: {
245
+ columns: {
246
+ childTag: 'column', sizeProp: 'size',
247
+ presets: [
248
+ { label: 'Small / Large', values: ['sm', 'lg'], ratio: 1 / 3 },
249
+ { label: 'Medium / Medium', values: ['md', 'md'], ratio: 1 / 2 },
250
+ { label: 'Large / Small', values: ['lg', 'sm'], ratio: 2 / 3 },
251
+ ],
252
+ },
253
+ },
254
+ },
255
+ }
256
+ ```
257
+
258
+ `titleProp` edits the declared text property directly. A populated title slot
259
+ keeps its existing rich content. Other declared fields and block actions live in
260
+ the block's cog menu. `switchGroup` offers compatible variants; the complete
261
+ candidate document must pass the active Content policy before a switch applies.
262
+ It never drops properties to make a switch succeed.
263
+
264
+ `columns` references existing child props and allowed values. For exactly two
265
+ columns, the divider changes both sizes in one undoable operation, using pointer
266
+ drag or arrow keys. Imported custom pairs and layouts with other column counts
267
+ remain unchanged until explicitly edited. Presets require unique pairs and
268
+ increasing finite ratios between zero and one.
269
+
270
+ `items` describes the repeated children of a container:
271
+
272
+ ```ts
273
+ tabs: {
274
+ label: 'Tabs',
275
+ canvas: {
276
+ items: {
277
+ childTag: 'tab', labelProp: 'label', presentation: 'tabs', addLabel: 'Add tab',
278
+ template: '::tab{label="New tab"}\nWrite the tab content here.\n::',
279
+ },
280
+ },
281
+ }
282
+ ```
283
+
284
+ Set `childTag` for component items, or `childNode: 'codeBlock'` or
285
+ `childNode: 'heading'` for code blocks and heading sections. `presentation` is
286
+ `tabs`, `accordion`, `stack`, `grid`, `steps`, or `timeline`. `columnsProp` names
287
+ a container property with the grid column count. The template must contain
288
+ exactly one item. Adding, removing, and renaming items are single undoable
289
+ changes that pass the Content policy. The selected tab and collapsed accordion
290
+ items are view state and never enter the document.
291
+
292
+ A `json` control edits a property whose policy allows `json`. The field accepts
293
+ JSON text and applies it only when it is valid.
294
+
295
+ Tables expose row, column, and alignment menus beside the active table. The first
296
+ row is the Markdown header; another row can be promoted to that position.
297
+ Merged cells and arbitrary header placement are outside the Markdown table
298
+ contract. Code blocks expose their language and file name above the code. Images have a
299
+ cog for their description, replacement, host metadata, and removal.
300
+
301
+ ## Toolbar and host controls
302
+
303
+ Use `toolbar-items` to group the built-in commands. Replace individual controls
304
+ through `GinkoToolbar` slots, or render your toolbar with the editor
305
+ `#toolbar="{ actions }"` slot. The same actions expose labels, active and disabled
306
+ states, and guarded `run()` operations. `messages`, `shortcuts`, and
307
+ `overlay-container` configure each editor independently. Compiled styles use
308
+ public `--ginko-*` tokens with shadcn semantic variables as fallbacks, and work
309
+ without Tailwind. All styles are in the `ginko` cascade layer, so unlayered host
310
+ rules override them. Dark fallbacks apply below a `.dark` ancestor or with
311
+ `data-ginko-theme="dark"` or `"auto"`.
312
+
313
+ - [Customize the editor](docs/content/docs/1.getting-started/2.customize.md): Vue, Nuxt, toolbar actions, messages, shortcuts, and overlays.
314
+ - [Layout blocks](docs/content/docs/1.getting-started/4.layout-blocks.md): the built-in layout kit and what each block can edit.
315
+ - [Component coverage](docs/content/docs/1.getting-started/5.component-coverage.md): current Docs tags, named slots, and source-mode limits.
316
+
317
+ ## Documentation
318
+
319
+ The proposed documentation address is
320
+ [ginko-editor.lupinum.com](https://ginko-editor.lupinum.com). Deployment is not
321
+ part of the scaffold milestone.
322
+
323
+ Vercel deploys the documentation from `docs/`. Enable source files outside the
324
+ Root Directory because the documentation build uses this package.
325
+
326
+ ## Contributing and development
327
+
328
+ Read [CONTRIBUTING.md](CONTRIBUTING.md) before you open a pull request.
329
+
330
+ ### Local documentation playground
331
+
332
+ Build the package, then start the documentation site with the playground:
333
+
334
+ ```bash
335
+ pnpm dev
336
+ ```
337
+
338
+ The site uses the published Ginko Docs layer and the Content version of this
339
+ workspace, so the playground and the Editor share one parser.
340
+
341
+ ## Support and security
342
+
343
+ Ask questions in the [Lupinum OSS Discord](https://discord.gg/RPH6SeA36N). Report vulnerabilities through [GitHub private vulnerability reporting](https://github.com/lupinum-dev/ginko-editor/security/advisories/new).
344
+
345
+ ## License
346
+
347
+ [MIT](LICENSE) © Lupinum OG.
@@ -0,0 +1,96 @@
1
+ import { type GinkoEditorProps } from './editorProps.js';
2
+ import type { ConversionErrorPayload, ConversionRecoveredPayload } from './lib/conversionPipeline.js';
3
+ import type { EditorAssetRequest, EditorFile, EditorImage, EditorVideo, GinkoEditorHandle } from './types.js';
4
+ import { type EditorActions } from './ui/commands.js';
5
+ declare var __VLS_1: {
6
+ state: {
7
+ readonly status: import("./collaboration.js").CollaborationStatus;
8
+ readonly version: number;
9
+ readonly pendingSteps: number;
10
+ readonly message?: string | undefined;
11
+ readonly code?: import("./collaboration.js").CollaborationStateCode | undefined;
12
+ } | undefined;
13
+ session: import("./collaboration.js").EditorCollaborationSession;
14
+ }, __VLS_15: {
15
+ recipe: import("./authoring.js").AuthoringRecipe;
16
+ }, __VLS_17: {
17
+ actions: EditorActions;
18
+ };
19
+ type __VLS_Slots = {} & {
20
+ collaboration?: (props: typeof __VLS_1) => any;
21
+ } & {
22
+ 'recipe-preview'?: (props: typeof __VLS_15) => any;
23
+ } & {
24
+ toolbar?: (props: typeof __VLS_17) => any;
25
+ };
26
+ declare const __VLS_base: import("vue").DefineComponent<GinkoEditorProps, GinkoEditorHandle, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
27
+ "conversion-error": (payload: ConversionErrorPayload) => any;
28
+ "conversion-recovered": (payload: ConversionRecoveredPayload) => any;
29
+ "request-file": (request: EditorAssetRequest<EditorFile>) => any;
30
+ "request-image": (request: EditorAssetRequest<EditorImage>) => any;
31
+ "request-image-metadata": (assetId: string) => any;
32
+ "pending-change": (pending: boolean) => any;
33
+ "request-video": (request: EditorAssetRequest<EditorVideo>) => any;
34
+ "update:modelValue": (value: string) => any;
35
+ }, string, import("vue").PublicProps, Readonly<GinkoEditorProps> & Readonly<{
36
+ "onConversion-error"?: ((payload: ConversionErrorPayload) => any) | undefined;
37
+ "onConversion-recovered"?: ((payload: ConversionRecoveredPayload) => any) | undefined;
38
+ "onRequest-file"?: ((request: EditorAssetRequest<EditorFile>) => any) | undefined;
39
+ "onRequest-image"?: ((request: EditorAssetRequest<EditorImage>) => any) | undefined;
40
+ "onRequest-image-metadata"?: ((assetId: string) => any) | undefined;
41
+ "onPending-change"?: ((pending: boolean) => any) | undefined;
42
+ "onRequest-video"?: ((request: EditorAssetRequest<EditorVideo>) => any) | undefined;
43
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
44
+ }>, {
45
+ imageUpload: import("./types.js").ImageUploadHandler;
46
+ header: boolean;
47
+ disabled: boolean;
48
+ videoOutput: "html" | "mdc";
49
+ profile: import("./index.js").EditorProfileName;
50
+ showMarkdownMarkers: boolean;
51
+ codeBlockTheme: "atom-dark" | "dark" | "default" | "github-dark" | "github-dim" | "github-light" | "visual-studio-dark";
52
+ placeholder: string;
53
+ fileOutput: "markdown" | "mdc";
54
+ imageOutput: "markdown" | "mdc";
55
+ shortcuts: import("./index.js").EditorShortcuts;
56
+ ariaLabel: string;
57
+ variant: "default" | "inline";
58
+ sourceToggle: boolean;
59
+ toolbarPlacement: "top" | "keyboard" | "auto" | false;
60
+ selectionToolbar: "auto" | "always" | false;
61
+ selectionToolbarItems: readonly import("./index.js").EditorToolbarGroup[];
62
+ toolbarItems: readonly import("./index.js").EditorToolbarGroup[];
63
+ messages: import("./index.js").EditorMessages;
64
+ overlayContainer: globalThis.HTMLElement;
65
+ imageDropTarget: globalThis.HTMLElement;
66
+ imagePicker: import("./types.js").ImagePicker;
67
+ imageMaxBytes: number;
68
+ assetProvider: import("./types.js").AssetProvider;
69
+ authoringKit: Readonly<import("./authoring.js").AuthoringKitSource<Record<string, {
70
+ kind: "block" | "inline";
71
+ props: Record<string, import("@lupinum/ginko-content/cms-contract").PortableComponentPropPolicyV2>;
72
+ slots: readonly string[];
73
+ allowedParents: readonly string[] | null;
74
+ allowedChildren: readonly string[] | null;
75
+ media: {
76
+ sourceProp: string;
77
+ altProp: string | null;
78
+ titleProp: string | null;
79
+ filenameProp: string | null;
80
+ } | null;
81
+ }>>>;
82
+ collaboration: import("./collaboration.js").EditorCollaborationSession;
83
+ enableFiles: boolean;
84
+ enableImages: boolean;
85
+ enableImageMetadata: boolean;
86
+ enableVideo: boolean;
87
+ syncDebounceMs: number;
88
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
89
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
90
+ declare const _default: typeof __VLS_export;
91
+ export default _default;
92
+ type __VLS_WithSlots<T, S> = T & {
93
+ new (): {
94
+ $slots: S;
95
+ };
96
+ };
@@ -0,0 +1,36 @@
1
+ import type { EditorImage, EditorImagePickerItem } from './types.js';
2
+ import { type EditorMessages } from './ui/messages.js';
3
+ type __VLS_Props = {
4
+ messages?: EditorMessages;
5
+ open: boolean;
6
+ images: readonly EditorImagePickerItem[];
7
+ query?: string;
8
+ loading?: boolean;
9
+ error?: string;
10
+ hasMore?: boolean;
11
+ enableUpload?: boolean;
12
+ overlayContainer?: string | globalThis.HTMLElement;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ select: (image: EditorImage) => any;
16
+ upload: () => any;
17
+ "update:open": (open: boolean) => any;
18
+ "update:query": (query: string) => any;
19
+ "load-more": () => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ onSelect?: ((image: EditorImage) => any) | undefined;
22
+ onUpload?: (() => any) | undefined;
23
+ "onUpdate:open"?: ((open: boolean) => any) | undefined;
24
+ "onUpdate:query"?: ((query: string) => any) | undefined;
25
+ "onLoad-more"?: (() => any) | undefined;
26
+ }>, {
27
+ error: string;
28
+ loading: boolean;
29
+ query: string;
30
+ messages: EditorMessages;
31
+ overlayContainer: string | globalThis.HTMLElement;
32
+ hasMore: boolean;
33
+ enableUpload: boolean;
34
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
+ declare const _default: typeof __VLS_export;
36
+ export default _default;
@@ -0,0 +1,13 @@
1
+ # @lupinum/ginko-editor 0.1.0 documentation
2
+
3
+ These pages match the installed version 0.1.0. Prefer them over the
4
+ website, which may describe a different version.
5
+
6
+ - [Getting started](./pages/docs/getting-started.md) — /docs/getting-started
7
+ - [Share an editing session](./pages/docs/getting-started/collaboration.md) — /docs/getting-started/collaboration
8
+ - [Component coverage](./pages/docs/getting-started/component-coverage.md) — /docs/getting-started/component-coverage
9
+ - [Customize the editor](./pages/docs/getting-started/customize.md) — /docs/getting-started/customize
10
+ - [Images](./pages/docs/getting-started/images.md) — /docs/getting-started/images
11
+ - [Edit text in place](./pages/docs/getting-started/in-place-editing.md) — /docs/getting-started/in-place-editing
12
+ - [Layout blocks](./pages/docs/getting-started/layout-blocks.md) — /docs/getting-started/layout-blocks
13
+ - [Validate content on the server](./pages/docs/getting-started/runtime.md) — /docs/getting-started/runtime