@lupinum/ginko-editor 0.1.0 → 0.18.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 +7 -73
- package/LICENSE +1 -1
- package/README.md +15 -340
- package/dist/assets.d.ts +70 -0
- package/dist/assets.js +31 -0
- package/dist/core/component-props.d.ts +87 -0
- package/dist/core/component-props.js +134 -0
- package/dist/core/convert.d.ts +24 -0
- package/dist/core/convert.js +278 -0
- package/dist/core/editor.d.ts +60 -0
- package/dist/core/editor.js +85 -0
- package/dist/core/extensions.d.ts +38 -0
- package/dist/core/extensions.js +444 -0
- package/dist/core/file-images.d.ts +9 -0
- package/dist/core/file-images.js +54 -0
- package/dist/core/image-frame.d.ts +23 -0
- package/dist/core/image-frame.js +24 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +17 -0
- package/dist/core/link-card.d.ts +20 -0
- package/dist/core/link-card.js +70 -0
- package/dist/core/link.d.ts +3 -0
- package/dist/core/link.js +8 -0
- package/dist/core/move.d.ts +11 -0
- package/dist/core/move.js +37 -0
- package/dist/core/paste-html.d.ts +6 -0
- package/dist/core/paste-html.js +384 -0
- package/dist/core/paste.d.ts +21 -0
- package/dist/core/paste.js +108 -0
- package/dist/core/problems.d.ts +31 -0
- package/dist/core/problems.js +54 -0
- package/dist/core/search.d.ts +47 -0
- package/dist/core/search.js +148 -0
- package/dist/core/slash.d.ts +93 -0
- package/dist/core/slash.js +215 -0
- package/dist/core/table.d.ts +34 -0
- package/dist/core/table.js +141 -0
- package/dist/core/uploads.d.ts +23 -0
- package/dist/core/uploads.js +71 -0
- package/dist/core/use-editor.d.ts +19 -0
- package/dist/core/use-editor.js +53 -0
- package/dist/index.d.ts +6 -15
- package/dist/index.js +6 -5668
- package/dist/issues.d.ts +49 -0
- package/dist/issues.js +9 -0
- package/dist/today.d.ts +6 -0
- package/dist/today.js +19 -0
- package/dist/useUpload.d.ts +48 -0
- package/dist/useUpload.js +59 -0
- package/dist/values.d.ts +14 -0
- package/dist/values.js +36 -0
- package/package.json +35 -95
- package/dist/GinkoEditor.vue.d.ts +0 -96
- package/dist/GinkoImagePicker.vue.d.ts +0 -36
- package/dist/agent/AGENTS.md +0 -13
- package/dist/agent/pages/docs/getting-started/collaboration.md +0 -435
- package/dist/agent/pages/docs/getting-started/component-coverage.md +0 -107
- package/dist/agent/pages/docs/getting-started/customize.md +0 -384
- package/dist/agent/pages/docs/getting-started/images.md +0 -188
- package/dist/agent/pages/docs/getting-started/in-place-editing.md +0 -110
- package/dist/agent/pages/docs/getting-started/layout-blocks.md +0 -148
- package/dist/agent/pages/docs/getting-started/runtime.md +0 -111
- package/dist/agent/pages/docs/getting-started.md +0 -128
- package/dist/authoring-D7MJezVG.js +0 -1780
- package/dist/authoring-D7MJezVG.js.map +0 -1
- package/dist/authoring.d.ts +0 -122
- package/dist/authoring.js +0 -2
- package/dist/collaboration.d.ts +0 -14
- package/dist/collaboration.js +0 -907
- package/dist/collaboration.js.map +0 -1
- package/dist/composables/useAssetRequests.d.ts +0 -44
- package/dist/composables/useCollaborationBinding.d.ts +0 -59
- package/dist/composables/useDevice.d.ts +0 -10
- package/dist/composables/useInsertMenu.d.ts +0 -67
- package/dist/composables/useMarkdownSync.d.ts +0 -96
- package/dist/composables/useStableAuthoringKit.d.ts +0 -16
- package/dist/documentConfig-Z6LdrWZj.js +0 -2360
- package/dist/documentConfig-Z6LdrWZj.js.map +0 -1
- package/dist/editorProps.d.ts +0 -124
- package/dist/index.js.map +0 -1
- package/dist/layout-kit.d.ts +0 -922
- package/dist/lib/collaboration/presence-record.d.ts +0 -18
- package/dist/lib/collaboration/presence.d.ts +0 -103
- package/dist/lib/collaboration/protocol.d.ts +0 -133
- package/dist/lib/collaboration/recovery.d.ts +0 -45
- package/dist/lib/collaboration/session.d.ts +0 -163
- package/dist/lib/collaboration/validation.d.ts +0 -42
- package/dist/lib/component-converters.d.ts +0 -119
- package/dist/lib/config/documentConfig.d.ts +0 -19
- package/dist/lib/config/editorConfig.d.ts +0 -38
- package/dist/lib/container-items.d.ts +0 -55
- package/dist/lib/conversionInvariants.d.ts +0 -3
- package/dist/lib/conversionLogger.d.ts +0 -10
- package/dist/lib/conversionPipeline.d.ts +0 -17
- package/dist/lib/conversionState.d.ts +0 -10
- package/dist/lib/conversionTypes.d.ts +0 -50
- package/dist/lib/editor-operations.d.ts +0 -39
- package/dist/lib/environment.d.ts +0 -6
- package/dist/lib/extensions/code-block.d.ts +0 -18
- package/dist/lib/extensions/component-boundary.d.ts +0 -9
- package/dist/lib/extensions/container-items.d.ts +0 -29
- package/dist/lib/extensions/element.d.ts +0 -19
- package/dist/lib/extensions/file.d.ts +0 -24
- package/dist/lib/extensions/heading.d.ts +0 -5
- package/dist/lib/extensions/image-upload.d.ts +0 -39
- package/dist/lib/extensions/image.d.ts +0 -39
- package/dist/lib/extensions/index.d.ts +0 -10
- package/dist/lib/extensions/inline-element.d.ts +0 -13
- package/dist/lib/extensions/markdown-clipboard.d.ts +0 -21
- package/dist/lib/extensions/profile.d.ts +0 -11
- package/dist/lib/extensions/slot.d.ts +0 -16
- package/dist/lib/extensions/span-style.d.ts +0 -15
- package/dist/lib/extensions/video.d.ts +0 -15
- package/dist/lib/image-properties.d.ts +0 -20
- package/dist/lib/input-rules.d.ts +0 -7
- package/dist/lib/markdown.d.ts +0 -11
- package/dist/lib/marks.d.ts +0 -7
- package/dist/lib/mdcToTiptap.d.ts +0 -20
- package/dist/lib/mdcTypes.d.ts +0 -20
- package/dist/lib/nodes.d.ts +0 -57
- package/dist/lib/nodeviews/block-actions.d.ts +0 -7
- package/dist/lib/nodeviews/code.d.ts +0 -4
- package/dist/lib/nodeviews/columns.d.ts +0 -17
- package/dist/lib/nodeviews/component.d.ts +0 -6
- package/dist/lib/nodeviews/icons.d.ts +0 -26
- package/dist/lib/nodeviews/image.d.ts +0 -9
- package/dist/lib/nodeviews/items.d.ts +0 -15
- package/dist/lib/nodeviews/lifecycle.d.ts +0 -45
- package/dist/lib/nodeviews/popover.d.ts +0 -15
- package/dist/lib/nodeviews/settings.d.ts +0 -11
- package/dist/lib/nodeviews/table-operations.d.ts +0 -50
- package/dist/lib/nodeviews/table.d.ts +0 -4
- package/dist/lib/profiles.d.ts +0 -62
- package/dist/lib/property-input.d.ts +0 -10
- package/dist/lib/property-step.d.ts +0 -77
- package/dist/lib/props.d.ts +0 -13
- package/dist/lib/stripStyleNodes.d.ts +0 -2
- package/dist/lib/tiptapToMdc.d.ts +0 -18
- package/dist/presence-record-CLdPZWKC.js +0 -291
- package/dist/presence-record-CLdPZWKC.js.map +0 -1
- package/dist/runtime.d.ts +0 -13
- package/dist/runtime.js +0 -3
- package/dist/style.css +0 -2
- package/dist/types.d.ts +0 -126
- package/dist/ui/GinkoActionButton.vue.d.ts +0 -8
- package/dist/ui/GinkoInsertMenu.vue.d.ts +0 -49
- package/dist/ui/GinkoKeyboardDock.vue.d.ts +0 -15
- package/dist/ui/GinkoNodePopover.vue.d.ts +0 -21
- package/dist/ui/GinkoRecipeIcon.vue.d.ts +0 -6
- package/dist/ui/GinkoSelectionToolbar.vue.d.ts +0 -10
- package/dist/ui/GinkoToolbar.vue.d.ts +0 -26
- package/dist/ui/GinkoToolbarIcon.vue.d.ts +0 -6
- package/dist/ui/block-shortcuts.d.ts +0 -6
- package/dist/ui/commands.d.ts +0 -78
- package/dist/ui/context.d.ts +0 -23
- package/dist/ui/editor-keyboard.d.ts +0 -15
- package/dist/ui/messages.d.ts +0 -214
- package/dist/ui/messages.de.d.ts +0 -6
- package/dist/ui/recipe-command.d.ts +0 -14
- package/dist/ui/recipe-search.d.ts +0 -47
- package/dist/ui/slash-command.d.ts +0 -17
- package/dist/ui/writingRecipes.d.ts +0 -13
- package/skills/ginko-editor/SKILL.md +0 -40
- package/skills/ginko-editor/agents/openai.yaml +0 -4
- package/skills/ginko-editor/references/in-place-editing.md +0 -50
- package/skills/ginko-editor/references/quickstart.md +0 -55
package/CHANGELOG.md
CHANGED
|
@@ -1,78 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lupinum/ginko-editor
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.18.0
|
|
4
4
|
|
|
5
|
-
|
|
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
|
|
5
|
+
### Minor Changes
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
- [#148](https://github.com/lupinum-dev/ginko/pull/148) [`38dd667`](https://github.com/lupinum-dev/ginko/commit/38dd667394ceb1134bcd7d0f627c7004cee08841) Thanks [@Mat4m0](https://github.com/Mat4m0)! - Add `@lupinum/ginko-server`, `@lupinum/ginko-studio` and `@lupinum/ginko-editor` to npm, so people can host the Ginko platform themselves.
|
|
11
8
|
|
|
12
|
-
|
|
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.
|
|
9
|
+
### Patch Changes
|
|
43
10
|
|
|
44
|
-
|
|
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.
|
|
11
|
+
- Updated dependencies [[`05c6945`](https://github.com/lupinum-dev/ginko/commit/05c69459b076ca87e9fee376098c10f3b15f66f7), [`ab3b70e`](https://github.com/lupinum-dev/ginko/commit/ab3b70e6ceb230f2de490c818553a4cde78d626c), [`ed2eb8e`](https://github.com/lupinum-dev/ginko/commit/ed2eb8ebc757f20bbfee8077fc6a3ecc690c38e5), [`d89413d`](https://github.com/lupinum-dev/ginko/commit/d89413d2b7ab21863e349bd91c3704587f44b808), [`ab3b70e`](https://github.com/lupinum-dev/ginko/commit/ab3b70e6ceb230f2de490c818553a4cde78d626c), [`103d424`](https://github.com/lupinum-dev/ginko/commit/103d4243c63e3ad0e9507a9efb0173eb1b3b4573), [`d89413d`](https://github.com/lupinum-dev/ginko/commit/d89413d2b7ab21863e349bd91c3704587f44b808), [`ab3b70e`](https://github.com/lupinum-dev/ginko/commit/ab3b70e6ceb230f2de490c818553a4cde78d626c), [`d89413d`](https://github.com/lupinum-dev/ginko/commit/d89413d2b7ab21863e349bd91c3704587f44b808), [`d89413d`](https://github.com/lupinum-dev/ginko/commit/d89413d2b7ab21863e349bd91c3704587f44b808)]:
|
|
12
|
+
- @lupinum/ginko@0.18.0
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,347 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
<h1 align="center">Ginko Editor</h1>
|
|
3
|
-
<p align="center">A portable Vue editor for Ginko content.</p>
|
|
1
|
+
# @lupinum/ginko-editor
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
You do not install this package by hand: the Studio ([`@lupinum/ginko-studio`](../ginko-studio)) depends on it. To
|
|
4
|
+
run the platform, see [Host the platform](https://ginko.lupinum.com/docs/host-the-platform).
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
The editing logic for [Ginko](https://github.com/lupinum-dev/ginko/tree/main/packages/ginko) bricks,
|
|
7
|
+
without any UI. The form components (one per field type, built on shadcn-vue) live in the Studio
|
|
8
|
+
layer, `@lupinum/ginko-studio`.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
The package ships Vue component code, TypeScript declarations, and opt-in CSS.
|
|
10
|
+
## What is in it
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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).
|
|
12
|
+
| Module | Purpose |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| `core/` | The headless Markdown editor: TipTap extensions per profile, Markdown to editor document and back (`toEditorDoc`, `fromEditorDoc`), `createGinkoEditor`, `useGinkoEditor`. Untouched blocks are saved byte for byte. |
|
|
15
|
+
| `assets.ts` | `GinkoAssets`, the upload adapter the host provides once (`provideGinkoAssets`, `useGinkoAssets`). |
|
|
16
|
+
| `useUpload.ts` | The upload flow image and file fields share: picker, cancel, error, retry, save blocking. |
|
|
17
|
+
| `issues.ts` | `BLOCKERS`, `TRANSLATION`, `ownIssues`, `issuesUnder`: server validation issues per field. |
|
|
18
|
+
| `values.ts`, `today.ts` | `textIn`, `newRowId`, `parseMoney`, `formatAmount`, `useToday`. |
|
|
344
19
|
|
|
345
20
|
## License
|
|
346
21
|
|
|
347
|
-
|
|
22
|
+
MIT © Lupinum OG
|
package/dist/assets.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
/** Processing state of one upload: the server checks (and for photos, converts) a file after it arrives. */
|
|
3
|
+
export interface UploadState {
|
|
4
|
+
status: 'processing' | 'ready' | 'failed';
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
/** What a ready upload offers the form: where to show it and the facts about the file. */
|
|
8
|
+
export interface UploadDetails {
|
|
9
|
+
url: string;
|
|
10
|
+
name: string;
|
|
11
|
+
size: number;
|
|
12
|
+
width: number | null;
|
|
13
|
+
height: number | null;
|
|
14
|
+
/** The library's description per language: it applies wherever a field has none of its own. */
|
|
15
|
+
alt?: Record<string, string>;
|
|
16
|
+
/** The focus point set in Files (0..1 from the top left): a crop keeps it in view. */
|
|
17
|
+
focus?: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
/** In the trash: a field keeps showing it, but a text may not name it (the save refuses), so a text shows it as missing. */
|
|
22
|
+
trashed?: true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* How image and file fields reach the host's storage. The host knows its site and its backend;
|
|
26
|
+
* the fields only ask for state, details and uploads.
|
|
27
|
+
*/
|
|
28
|
+
export interface GinkoAssets {
|
|
29
|
+
/** Live processing state of one upload; undefined while unknown or when id is undefined. */
|
|
30
|
+
state(id: Ref<string | undefined>): Ref<UploadState | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Live details (URL and file facts) for uploaded files; undefined while loading. An id that is
|
|
33
|
+
* not ready or not this site's maps to null.
|
|
34
|
+
*/
|
|
35
|
+
details(ids: Ref<string[]>): Ref<Record<string, UploadDetails | null> | undefined>;
|
|
36
|
+
/** Uploads a file and resolves with its id. Rejects when `signal` aborts. */
|
|
37
|
+
upload(kind: 'image' | 'file', file: File, signal: AbortSignal): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* The focus point of a library photo (0..1 from the top left), which every use of the photo shares. `allowed`: this
|
|
40
|
+
* person may change it (on the platform owner and admin). Absent: the host offers no way to set it.
|
|
41
|
+
*/
|
|
42
|
+
focus?: {
|
|
43
|
+
allowed: Ref<boolean>;
|
|
44
|
+
set(file: string, focus: {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export declare const GINKO_ASSETS: InjectionKey<GinkoAssets>;
|
|
51
|
+
/** Call once in a parent of the forms. */
|
|
52
|
+
export declare function provideGinkoAssets(assets: GinkoAssets): void;
|
|
53
|
+
export declare function useGinkoAssets(): GinkoAssets;
|
|
54
|
+
/**
|
|
55
|
+
* The library files that the pictures of one Markdown editor name (``): the text keeps the
|
|
56
|
+
* reference, the editor shows the file. One query for all of them.
|
|
57
|
+
*/
|
|
58
|
+
export interface FileImages {
|
|
59
|
+
/** Starts loading the file of a `$file.<id>` source; any other source needs nothing. Call it outside a computed. */
|
|
60
|
+
want(src: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* The file of a `$file.<id>` source (reactive): undefined while it loads and for any other source, null when the
|
|
63
|
+
* library has no ready file with this ID or the file is in the trash.
|
|
64
|
+
*/
|
|
65
|
+
file(src: string): UploadDetails | null | undefined;
|
|
66
|
+
/** The text in place of a file the library does not have, in the UI language. */
|
|
67
|
+
missingText(): string;
|
|
68
|
+
}
|
|
69
|
+
/** Call once per editor, in setup. Files once seen stay known, so a picture does not flicker while a new one loads. */
|
|
70
|
+
export declare function useFileImages(assets: GinkoAssets, missingText: () => string): FileImages;
|
package/dist/assets.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { fileRefOf } from "@lupinum/ginko/internal";
|
|
2
|
+
import { inject, provide, reactive, ref, watch } from "vue";
|
|
3
|
+
export const GINKO_ASSETS = Symbol("ginko:assets");
|
|
4
|
+
export function provideGinkoAssets(assets) {
|
|
5
|
+
provide(GINKO_ASSETS, assets);
|
|
6
|
+
}
|
|
7
|
+
export function useGinkoAssets() {
|
|
8
|
+
const assets = inject(GINKO_ASSETS, void 0);
|
|
9
|
+
if (!assets) throw new Error("[ginko-editor] provideGinkoAssets(...) fehlt: Bild- und Dateifelder brauchen einen Upload-Adapter.");
|
|
10
|
+
return assets;
|
|
11
|
+
}
|
|
12
|
+
export function useFileImages(assets, missingText) {
|
|
13
|
+
const ids = ref([]);
|
|
14
|
+
const details = assets.details(ids);
|
|
15
|
+
const known = reactive(/* @__PURE__ */ Object.create(null));
|
|
16
|
+
watch(details, (next) => {
|
|
17
|
+
if (next) Object.assign(known, next);
|
|
18
|
+
}, { immediate: true });
|
|
19
|
+
return {
|
|
20
|
+
want(src) {
|
|
21
|
+
const id = fileRefOf(src);
|
|
22
|
+
if (id && !ids.value.includes(id)) ids.value = [...ids.value, id];
|
|
23
|
+
},
|
|
24
|
+
file(src) {
|
|
25
|
+
const id = fileRefOf(src);
|
|
26
|
+
if (id === void 0 || !(id in known)) return void 0;
|
|
27
|
+
return known[id]?.trashed ? null : known[id];
|
|
28
|
+
},
|
|
29
|
+
missingText
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Field, Label } from '@lupinum/ginko';
|
|
2
|
+
import type { ComponentDef, ComponentRegistry, Described } from '@lupinum/ginko/internal';
|
|
3
|
+
export type ComponentProps = Record<string, unknown>;
|
|
4
|
+
/** A prop as a form shows it: `undefined` = not set. */
|
|
5
|
+
export type PropValue = string | number | boolean | string[] | undefined;
|
|
6
|
+
/** The prop fields a component form can edit (the types the registry allows, see `componentProblems`). */
|
|
7
|
+
export type PropField = Extract<Field, {
|
|
8
|
+
type: 'text' | 'longtext' | 'number' | 'boolean' | 'choice' | 'choices' | 'image' | 'ref';
|
|
9
|
+
}>;
|
|
10
|
+
export type ComponentMode = 'live' | 'card';
|
|
11
|
+
/**
|
|
12
|
+
* What a registry entry may say in its `editor` field beyond the core's own type (`icon`, `group`, `example`).
|
|
13
|
+
* `hidden`: not offered in the slash menu (a short form that stays valid in existing texts). `keywords`: more
|
|
14
|
+
* words the slash menu finds the entry by. `aliasOf`: this tag is a short form of `tag` with `prop` = `value`;
|
|
15
|
+
* the settings of a short form offer that prop and turn the node into `tag` when it is changed.
|
|
16
|
+
*/
|
|
17
|
+
export interface EditorMeta {
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
keywords?: readonly string[];
|
|
20
|
+
aliasOf?: {
|
|
21
|
+
tag: string;
|
|
22
|
+
prop: string;
|
|
23
|
+
value: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare const editorMeta: (def: Pick<ComponentDef, "editor"> | undefined) => EditorMeta;
|
|
27
|
+
/** The long form a short-form tag stands for, or undefined when `tag` is not one. */
|
|
28
|
+
export declare function aliasOf(registry: ComponentRegistry | undefined, tag: string): (EditorMeta['aliasOf'] & {
|
|
29
|
+
field: PropField;
|
|
30
|
+
}) | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* How a `component` node is shown: `live` = the real Vue component with the editable content in its default
|
|
33
|
+
* slot; `card` = a frame with the registry label, a one-line summary of the props, and the content below.
|
|
34
|
+
* Live needs a Vue implementation in the Studio (`liveTags`), a block component, no named slots, no `children`
|
|
35
|
+
* restriction (the component reads its children, which the editor wraps), and no `parents` (it looks right
|
|
36
|
+
* only inside its parent).
|
|
37
|
+
*/
|
|
38
|
+
export declare function componentMode(tag: string, registry: ComponentRegistry | undefined, liveTags: ReadonlySet<string> | readonly string[]): ComponentMode;
|
|
39
|
+
/** The prop fields of a component in registry order. Retired props and types a form cannot show are left out. */
|
|
40
|
+
export declare function propFields(def: Pick<ComponentDef, 'props'>): Array<[key: string, field: PropField]>;
|
|
41
|
+
/** The raw value: the key or its bound form `:key`. */
|
|
42
|
+
export declare function rawProp(props: ComponentProps | undefined, key: string): unknown;
|
|
43
|
+
/** The value of a prop for the form. */
|
|
44
|
+
export declare function readProp(field: PropField, props: ComponentProps | undefined, key: string): PropValue;
|
|
45
|
+
/**
|
|
46
|
+
* `props` with one prop set, as a new object. `undefined` (or an empty list) removes it. A boolean that equals
|
|
47
|
+
* the registry default is removed too, so `Geöffnet` off leaves no `open="false"` behind; a boolean that is on
|
|
48
|
+
* is written bare. An empty text stays as an empty string, so the check can report it (a required text must not be empty).
|
|
49
|
+
*/
|
|
50
|
+
export declare function writeProp(field: PropField, props: ComponentProps | undefined, key: string, value: PropValue): ComponentProps;
|
|
51
|
+
/** Prop names the profile check of `parseMarkdown` requires to be a safe address, whatever the field says. */
|
|
52
|
+
/**
|
|
53
|
+
* Why `value` does not fit prop `key` of component `tag`, as a German sentence that starts with the label of the
|
|
54
|
+
* prop ("Titel ist zu lang (höchstens 120 Zeichen)."), or undefined. The messages are the core's (`componentPropProblem`),
|
|
55
|
+
* plus the profile check's rule for addresses. A required prop without value is reported.
|
|
56
|
+
*/
|
|
57
|
+
export declare function propProblem(registry: ComponentRegistry, tag: string, key: string, value: PropValue): string | undefined;
|
|
58
|
+
/** `propProblem` with catalog key and parameters (`coreMessage(locale, key, params)` gives the sentence in a language). */
|
|
59
|
+
export declare function propProblemMessage(registry: ComponentRegistry, tag: string, key: string, value: PropValue): Described | undefined;
|
|
60
|
+
/** The keys of required props that have no valid value in `props`. */
|
|
61
|
+
export declare function missingRequired(registry: ComponentRegistry, tag: string, props: ComponentProps | undefined): string[];
|
|
62
|
+
/** What a block card shows instead of its props: what it is about, a few choices in words, and its pictures. */
|
|
63
|
+
export interface BlockSummary {
|
|
64
|
+
/** The caption, title, description or name, else the first picture's file name; cut at 80 characters. */
|
|
65
|
+
title?: string;
|
|
66
|
+
/** Choices set to something else than their default, as their option labels ("Quadrat"); at most three. */
|
|
67
|
+
facts: string[];
|
|
68
|
+
/** The pictures of the image props in registry order: the stored address, the library file and the line under it. */
|
|
69
|
+
pictures: Array<{
|
|
70
|
+
key: string;
|
|
71
|
+
src: string;
|
|
72
|
+
file?: string;
|
|
73
|
+
note?: string;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The card summary of a block (`::figure{src="$file.k57" caption="Der Gastgarten" width="2756" aspect="square"}`
|
|
78
|
+
* → title "Der Gastgarten", facts ["Quadrat"], one picture). Numbers, addresses and on/off switches are settings
|
|
79
|
+
* for the look (pixel sizes, spacing, "wider than the text"): they stay in the settings, never on the card.
|
|
80
|
+
* `label` gives a registry label in the editor's language; `fileName` the name of a library file (undefined while it loads).
|
|
81
|
+
*/
|
|
82
|
+
export declare function blockSummary(props: ComponentProps | undefined, def: Pick<ComponentDef, 'props'> | undefined, { label, fileName }: {
|
|
83
|
+
label: (label: Label) => string;
|
|
84
|
+
fileName?: (id: string) => string | undefined;
|
|
85
|
+
}): BlockSummary;
|
|
86
|
+
/** Longest value the text input of a prop takes. */
|
|
87
|
+
export declare const propMax: (field: PropField) => number | undefined;
|