@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
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { a as e, c as t, n, o as r, s as i } from "./documentConfig-Z6LdrWZj.js";
|
|
2
|
-
import { isSafePublicLinkUrl as a } from "@lupinum/ginko-content/cms-contract";
|
|
3
|
-
import { AttrStep as o, Step as s, Transform as c } from "@tiptap/pm/transform";
|
|
4
|
-
//#region src/lib/collaboration/protocol.ts
|
|
5
|
-
var l = "ginko-editor-2", u = 1, d = Object.freeze({
|
|
6
|
-
documentBytes: 512 * 1024,
|
|
7
|
-
batchBytes: 256 * 1024,
|
|
8
|
-
stepsPerBatch: 128,
|
|
9
|
-
jsonDepth: 64
|
|
10
|
-
}), f = class extends Error {
|
|
11
|
-
code;
|
|
12
|
-
constructor(e, t) {
|
|
13
|
-
super(t), this.code = e, this.name = "CollaborationError";
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
function p(e) {
|
|
17
|
-
if (e.protocolVersion !== void 0 && e.protocolVersion !== 1) throw new f("protocol", "This editor uses a different collaboration protocol. Update the editor.");
|
|
18
|
-
}
|
|
19
|
-
function m(e) {
|
|
20
|
-
if (!e || typeof e != "object" || !Number.isSafeInteger(e.version) || e.version < 0 || typeof e.epoch != "string" || !e.epoch || e.epoch.length > 200 || typeof e.policyRevision != "string" || !e.policyRevision || e.policyRevision.length > 200) throw new f("invalid", "Invalid collaborative document version.");
|
|
21
|
-
if (p(e), e.schemaRevision !== "ginko-editor-2") throw new f("schema", "The editor schema has changed. Reopen this document.");
|
|
22
|
-
}
|
|
23
|
-
function h(e, t) {
|
|
24
|
-
if (e.epoch !== t.epoch) return "epoch";
|
|
25
|
-
if (e.schemaRevision !== t.schemaRevision) return "schema";
|
|
26
|
-
if (e.policyRevision !== t.policyRevision) return "policy";
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/lib/collaboration/validation.ts
|
|
30
|
-
var g = Object.freeze([
|
|
31
|
-
"replace",
|
|
32
|
-
"replaceAround",
|
|
33
|
-
"addMark",
|
|
34
|
-
"removeMark",
|
|
35
|
-
"addNodeMark",
|
|
36
|
-
"removeNodeMark",
|
|
37
|
-
"attr",
|
|
38
|
-
"ginkoSetNodePropertyV1",
|
|
39
|
-
"ginkoSetComponentVariantV1",
|
|
40
|
-
"ginkoSetNodeAttributeV1"
|
|
41
|
-
]), _ = new Set(g), v = new TextEncoder();
|
|
42
|
-
function y(e) {
|
|
43
|
-
for (let t of [
|
|
44
|
-
"from",
|
|
45
|
-
"to",
|
|
46
|
-
"pos",
|
|
47
|
-
"gapFrom",
|
|
48
|
-
"gapTo",
|
|
49
|
-
"insert"
|
|
50
|
-
]) if (t in e && (!Number.isSafeInteger(e[t]) || Number(e[t]) < 0)) throw new f("invalid", "Editor step positions must be nonnegative safe integers.");
|
|
51
|
-
if (e.slice && typeof e.slice == "object") {
|
|
52
|
-
for (let [t, n] of Object.entries(e.slice)) if (["openStart", "openEnd"].includes(t) && (!Number.isSafeInteger(n) || Number(n) < 0)) throw new f("invalid", "Editor slice depths must be nonnegative safe integers.");
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function b(e, t = 0) {
|
|
56
|
-
if (t > d.jsonDepth) throw new f("limit", "The document is too deeply nested.");
|
|
57
|
-
if (typeof e == "number" && !Number.isFinite(e)) throw new f("invalid", "JSON numbers must be finite.");
|
|
58
|
-
return Array.isArray(e) ? `[${e.map((e) => b(e, t + 1)).join(",")}]` : e && typeof e == "object" ? `{${Object.entries(e).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, n]) => `${JSON.stringify(e)}:${b(n, t + 1)}`).join(",")}}` : JSON.stringify(e);
|
|
59
|
-
}
|
|
60
|
-
function x(e, t) {
|
|
61
|
-
if (typeof e != "string") throw new f("invalid", "Expected encoded JSON.");
|
|
62
|
-
if (v.encode(e).byteLength > t) throw new f("limit", "The change is too large.");
|
|
63
|
-
try {
|
|
64
|
-
let t = JSON.parse(e);
|
|
65
|
-
return b(t), t;
|
|
66
|
-
} catch (e) {
|
|
67
|
-
throw e instanceof f ? e : new f("invalid", "The change contains invalid JSON.");
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function S(e, t = n()) {
|
|
71
|
-
let r = x(e, d.documentBytes);
|
|
72
|
-
try {
|
|
73
|
-
let e = t.nodeFromJSON(r);
|
|
74
|
-
if (e.check(), e.type !== t.topNodeType || b(e.toJSON()) !== b(r)) throw Error("Non-canonical document");
|
|
75
|
-
return e;
|
|
76
|
-
} catch {
|
|
77
|
-
throw new f("content", "The collaborative document does not match this editor schema.");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function C(e, t = n()) {
|
|
81
|
-
if (!Array.isArray(e) || e.length < 1 || e.length > d.stepsPerBatch) throw new f("limit", "The change has an invalid number of steps.");
|
|
82
|
-
let r = 0;
|
|
83
|
-
return e.map((e) => {
|
|
84
|
-
let n = x(e, d.batchBytes);
|
|
85
|
-
if (r += v.encode(e).byteLength, r > d.batchBytes) throw new f("limit", "The change batch is too large.");
|
|
86
|
-
if (!n || typeof n != "object" || !("stepType" in n) || typeof n.stepType != "string" || !_.has(n.stepType)) throw new f("invalid", "Unsupported editor step.");
|
|
87
|
-
y(n);
|
|
88
|
-
try {
|
|
89
|
-
let e = s.fromJSON(t, n);
|
|
90
|
-
if (b(e.toJSON()) !== b(n)) throw Error("Non-canonical step");
|
|
91
|
-
return e;
|
|
92
|
-
} catch {
|
|
93
|
-
throw new f("invalid", "The editor step would lose data when decoded.");
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
var w = /^[A-Za-z][\w.:-]{0,127}$/, T = /^[^\s"'<>=`\\]{1,128}$/, E = /* @__PURE__ */ new Set([
|
|
98
|
-
null,
|
|
99
|
-
"1",
|
|
100
|
-
"a",
|
|
101
|
-
"A",
|
|
102
|
-
"i",
|
|
103
|
-
"I"
|
|
104
|
-
]);
|
|
105
|
-
function D(e, t, n = !1) {
|
|
106
|
-
return e === null || typeof e == "string" && e.length <= t && (!n || !/[\r\n]/.test(e));
|
|
107
|
-
}
|
|
108
|
-
function O(e) {
|
|
109
|
-
return e === null || typeof e == "number" && Number.isFinite(e) || typeof e == "string" && e.length <= 32 && e.trim() !== "" && Number.isFinite(Number(e));
|
|
110
|
-
}
|
|
111
|
-
function k(e) {
|
|
112
|
-
throw new f("content", e);
|
|
113
|
-
}
|
|
114
|
-
function A(e) {
|
|
115
|
-
let t = e.attrs;
|
|
116
|
-
e.type.name === "link" && ((typeof t.href != "string" || t.href.length > 2048 || !a(t.href)) && k("A link must use a safe URL."), (![null, "_blank"].includes(t.target) || !D(t.rel, 200, !0) || !D(t.class, 200, !0) || !D(t.title, 1e3)) && k("A link has an unsupported attribute value."));
|
|
117
|
-
}
|
|
118
|
-
function j(e) {
|
|
119
|
-
let t = e.attrs;
|
|
120
|
-
switch (e.type.name) {
|
|
121
|
-
case "heading":
|
|
122
|
-
(!Number.isSafeInteger(t.level) || t.level < 1 || t.level > 6) && k("A heading level must be a whole number from 1 to 6."), t.id !== null && (typeof t.id != "string" || !/^[A-Za-z0-9_-]{1,200}$/.test(t.id)) && k("A heading id must contain only letters, digits, hyphens, and underscores.");
|
|
123
|
-
break;
|
|
124
|
-
case "orderedList": {
|
|
125
|
-
let e = typeof t.start == "string" && /^\d{1,9}$/.test(t.start) ? Number(t.start) : t.start;
|
|
126
|
-
(!Number.isSafeInteger(e) || e < 0 || e > 999999999 || !E.has(t.type)) && k("A numbered list has an unsupported start or type.");
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
case "codeBlock":
|
|
130
|
-
(!D(t.language, 100, !0) || !D(t.filename, 500, !0)) && k("Code metadata must be one line of text.");
|
|
131
|
-
break;
|
|
132
|
-
case "element":
|
|
133
|
-
case "inline-element":
|
|
134
|
-
(typeof t.tag != "string" || !w.test(t.tag)) && k("A component has an unsupported name.");
|
|
135
|
-
break;
|
|
136
|
-
case "slot":
|
|
137
|
-
(typeof t.name != "string" || !T.test(t.name)) && k("A component slot has an unsupported name.");
|
|
138
|
-
break;
|
|
139
|
-
case "video":
|
|
140
|
-
(!D(t.src, 2048, !0) || !D(t.title, 1e3) || !D(t.alt, 1e3) || typeof t.key != "string" || t.key.length > 200 || !O(t.width) || !O(t.height)) && k("A video has an unsupported attribute value.");
|
|
141
|
-
break;
|
|
142
|
-
case "span-style":
|
|
143
|
-
(!D(t.class, 500, !0) || !D(t.style, 2e3, !0)) && k("Styled text has an unsupported attribute value.");
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
for (let t of e.marks) A(t);
|
|
147
|
-
}
|
|
148
|
-
function M(e) {
|
|
149
|
-
e.descendants((e) => {
|
|
150
|
-
j(e);
|
|
151
|
-
let n = e.attrs.props;
|
|
152
|
-
if (n && (typeof n != "object" || Array.isArray(n))) throw new f("content", "Node properties must be an object.");
|
|
153
|
-
if (n && typeof n == "object") for (let [r, i] of Object.entries(n)) {
|
|
154
|
-
if (r === "$") {
|
|
155
|
-
if (!i || typeof i != "object" || Array.isArray(i) || Object.keys(i).sort().join(",") !== "block,sourceName,syntax" || !("syntax" in i) || i.syntax !== "angle" && i.syntax !== "colon" || !("block" in i) || i.block !== 0 && i.block !== 1 || !("sourceName" in i) || typeof i.sourceName != "string") throw new f("content", "Invalid component source metadata.");
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
if (!(r === "__tiptapWrap" && i === !0 && e.type.name === "element") && !(r === "__mdc_block" && i === !0 && ["image", "file"].includes(e.type.name)) && e.type.name === "image") {
|
|
159
|
-
let e = Object.entries(t).find(([e]) => e === r)?.[1];
|
|
160
|
-
if (!e) throw new f("content", "An image property cannot be saved as Content.");
|
|
161
|
-
if (i == null || i === "") continue;
|
|
162
|
-
if (e === "text" ? typeof i != "string" : !["number", "string"].includes(typeof i) || !Number.isFinite(Number(i))) throw new f("content", "An image property has an unsupported value.");
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (e.type.name === "codeBlock" && ["language", "filename"].some((t) => e.attrs[t] !== null && typeof e.attrs[t] != "string")) throw new f("content", "Code metadata must be text.");
|
|
166
|
-
if (e.type.name === "table") {
|
|
167
|
-
let t = e.firstChild?.childCount;
|
|
168
|
-
if (!t || e.content.content.some((e, n) => e.childCount !== t || e.content.content.some((e) => e.type.name !== (n === 0 ? "tableHeader" : "tableCell")))) throw new f("content", "Content tables need a rectangular layout and one header row.");
|
|
169
|
-
if (e.content.content.some((t) => t.content.content.some((t, n) => (t.attrs.align ?? "left") !== (e.firstChild.child(n).attrs.align ?? "left")))) throw new f("content", "Content tables need one alignment per column.");
|
|
170
|
-
}
|
|
171
|
-
if (["tableCell", "tableHeader"].includes(e.type.name) && (e.attrs.colspan !== 1 || e.attrs.rowspan !== 1 || e.attrs.colwidth !== null || ![
|
|
172
|
-
null,
|
|
173
|
-
"left",
|
|
174
|
-
"center",
|
|
175
|
-
"right"
|
|
176
|
-
].includes(e.attrs.align))) throw new f("content", "Merged cells and custom cell widths cannot be saved as Content.");
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
async function N(t, n, r) {
|
|
180
|
-
try {
|
|
181
|
-
t.check();
|
|
182
|
-
} catch {
|
|
183
|
-
throw new f("content", "The collaborative document does not match this editor schema.");
|
|
184
|
-
}
|
|
185
|
-
M(t);
|
|
186
|
-
let a = JSON.stringify(t.toJSON());
|
|
187
|
-
if (v.encode(a).byteLength > d.documentBytes) throw new f("limit", "The collaborative document is too large.");
|
|
188
|
-
let o = await e(t.toJSON(), r.output);
|
|
189
|
-
if (!o.ok || o.value === void 0) throw new f("content", "The document cannot be saved as Content.");
|
|
190
|
-
if (await i(o.value, { policy: r.policy })) throw new f("content", "The document is outside the host content policy.");
|
|
191
|
-
return {
|
|
192
|
-
snapshot: {
|
|
193
|
-
...n,
|
|
194
|
-
document: a
|
|
195
|
-
},
|
|
196
|
-
markdown: o.value
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
async function P(e, t) {
|
|
200
|
-
if (typeof e != "string" || v.encode(e).byteLength > d.documentBytes) throw new f("limit", "The source document is too large.");
|
|
201
|
-
let i = {
|
|
202
|
-
epoch: t.epoch,
|
|
203
|
-
policyRevision: t.policyRevision,
|
|
204
|
-
schemaRevision: l,
|
|
205
|
-
version: 0
|
|
206
|
-
};
|
|
207
|
-
m(i);
|
|
208
|
-
let a = n(), o = await r(e, t.output, a, { policy: t.policy });
|
|
209
|
-
if (!o.ok || !o.value) throw new f("content", "This source needs source-only editing.");
|
|
210
|
-
let s;
|
|
211
|
-
try {
|
|
212
|
-
s = a.nodeFromJSON(o.value);
|
|
213
|
-
} catch {
|
|
214
|
-
throw new f("content", "This source needs source-only editing.");
|
|
215
|
-
}
|
|
216
|
-
return N(s, i, t);
|
|
217
|
-
}
|
|
218
|
-
async function F(e, t, r) {
|
|
219
|
-
m(e), m(t), p(t);
|
|
220
|
-
let i = h(e, t);
|
|
221
|
-
if (i) throw new f(i, "The collaborative document has changed. Reopen it with your recovery copy.");
|
|
222
|
-
if (t.version !== e.version) throw new f("version", "Fetch accepted steps before submitting this change.");
|
|
223
|
-
if (typeof t.clientId != "string" || !t.clientId || t.clientId.length > 200) throw new f("invalid", "Invalid editor client ID.");
|
|
224
|
-
let a = n(), s = C(t.steps, a);
|
|
225
|
-
if (!Number.isSafeInteger(e.version + s.length)) throw new f("limit", "The document version is too large.");
|
|
226
|
-
let l = new c(S(e.document, a));
|
|
227
|
-
try {
|
|
228
|
-
for (let e of s) {
|
|
229
|
-
if (e instanceof o && !Object.hasOwn(l.doc.nodeAt(e.pos)?.type.spec.attrs ?? {}, e.attr)) throw new f("content", "Unknown node attribute.");
|
|
230
|
-
l.step(e);
|
|
231
|
-
}
|
|
232
|
-
l.doc.check();
|
|
233
|
-
} catch (e) {
|
|
234
|
-
throw e instanceof f ? e : new f("content", "The editor change does not apply to this document.");
|
|
235
|
-
}
|
|
236
|
-
return N(l.doc, {
|
|
237
|
-
epoch: e.epoch,
|
|
238
|
-
schemaRevision: e.schemaRevision,
|
|
239
|
-
policyRevision: e.policyRevision,
|
|
240
|
-
version: e.version + s.length
|
|
241
|
-
}, r);
|
|
242
|
-
}
|
|
243
|
-
//#endregion
|
|
244
|
-
//#region src/lib/collaboration/presence-record.ts
|
|
245
|
-
var I = /^(?:#[\da-f]{3}(?:[\da-f]{3})?|(?:rgb|hsl)a?\([\d\s.,%/]+\))$/i;
|
|
246
|
-
function L(e) {
|
|
247
|
-
let t = 2166136261;
|
|
248
|
-
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
249
|
-
return `hsl(${(t >>> 0) % 360} 70% 38%)`;
|
|
250
|
-
}
|
|
251
|
-
function R(e, t) {
|
|
252
|
-
return typeof e == "string" && e.length <= 64 && I.test(e.trim()) ? e.trim() : L(t);
|
|
253
|
-
}
|
|
254
|
-
function z(e, t) {
|
|
255
|
-
let n = e && typeof e == "object" ? e : {}, r = typeof n.name == "string" ? n.name.replace(/\s+/g, " ").trim().slice(0, 64) : "";
|
|
256
|
-
return {
|
|
257
|
-
...typeof n.id == "string" && n.id.length <= 200 ? { id: n.id } : {},
|
|
258
|
-
name: r,
|
|
259
|
-
color: R(n.color, t)
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function B(e) {
|
|
263
|
-
return Number.isSafeInteger(e) && Number(e) >= 0 ? Number(e) : void 0;
|
|
264
|
-
}
|
|
265
|
-
function V(e) {
|
|
266
|
-
if (!e || typeof e != "object") return null;
|
|
267
|
-
let t = e;
|
|
268
|
-
if (t.protocolVersion !== 1 || typeof t.clientId != "string" || !t.clientId || t.clientId.length > 200 || typeof t.epoch != "string" || t.epoch.length > 200 || B(t.version) === void 0 || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt)) return null;
|
|
269
|
-
let n = null;
|
|
270
|
-
if (t.selection !== null) {
|
|
271
|
-
let e = t.selection && typeof t.selection == "object" ? t.selection : {}, r = B(e.anchor), i = B(e.head);
|
|
272
|
-
if (r === void 0 || i === void 0) return null;
|
|
273
|
-
n = {
|
|
274
|
-
anchor: r,
|
|
275
|
-
head: i
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
return {
|
|
279
|
-
protocolVersion: 1,
|
|
280
|
-
clientId: t.clientId,
|
|
281
|
-
epoch: t.epoch,
|
|
282
|
-
version: Number(t.version),
|
|
283
|
-
updatedAt: t.updatedAt,
|
|
284
|
-
selection: n,
|
|
285
|
-
user: z(t.user, t.clientId)
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
//#endregion
|
|
289
|
-
export { P as a, b as c, d, u as f, F as i, f as l, h as m, V as n, S as o, l as p, z as r, C as s, L as t, m as u };
|
|
290
|
-
|
|
291
|
-
//# sourceMappingURL=presence-record-CLdPZWKC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"presence-record-CLdPZWKC.js","names":[],"sources":["../src/lib/collaboration/protocol.ts","../src/lib/collaboration/validation.ts","../src/lib/collaboration/presence-record.ts"],"sourcesContent":["/**\n * Increment when a wire step or the shared document schema changes.\n * `test/collaboration-schema.test.ts` fails when the schema fingerprint changes\n * without a new revision.\n * @experimental\n */\nexport const editorSchemaRevision = 'ginko-editor-2' as const\n\n/**\n * Version of the message envelope: heads, batches, replies and presence.\n * The schema revision identifies document content; this value identifies the\n * shape of the messages around it.\n * @experimental\n */\nexport const collaborationProtocolVersion = 1 as const\n\n/** @experimental */\nexport interface CollaborationFence {\n /** A new value fences clients after import, restore, or source replacement. */\n epoch: string\n schemaRevision: string\n /** The host changes this when the allowed content policy changes. */\n policyRevision: string\n}\n\n/** @experimental */\nexport interface CollaborationHead extends CollaborationFence {\n version: number\n /**\n * Message envelope version. Clients send `1` with pull and push requests.\n * A missing value is read as version `1`; any other value is rejected.\n */\n protocolVersion?: typeof collaborationProtocolVersion\n}\n\n/** @experimental */\nexport interface CollaborationSnapshot extends CollaborationHead {\n /** ProseMirror JSON encoded as a string, including MDC's reserved `$` key. */\n document: string\n}\n\n/** @experimental */\nexport interface CollaborationSteps extends CollaborationHead {\n clientId: string\n steps: string[]\n}\n\n/** @experimental */\nexport interface CollaborationUpdate extends CollaborationHead {\n /** Version immediately before the first returned step. */\n fromVersion: number\n steps: string[]\n clientIds: string[]\n}\n\n/** @experimental */\nexport type CollaborationReply =\n | { status: 'ok'; update: CollaborationUpdate }\n | { status: 'stale'; head: CollaborationHead; reason: 'epoch' | 'schema' | 'policy' | 'history' }\n\n/** A collaborator's display identity. The host supplies it from its own accounts. */\nexport interface CollaborationUser {\n /** Stable host account identifier. Do not use a secret or an email address. */\n id?: string\n name: string\n /** A CSS color: `#rgb`, `#rrggbb`, `rgb(...)` or `hsl(...)`. Derived from the client ID when omitted. */\n color?: string\n}\n\n/**\n * Positions refer to the confirmed document at `version` in `epoch`.\n * @experimental\n */\nexport interface CollaborationPresenceSelection {\n anchor: number\n head: number\n}\n\n/** One client's ephemeral presence record. The host must not store it with the document. */\nexport interface CollaborationPresenceUpdate {\n protocolVersion: typeof collaborationProtocolVersion\n clientId: string\n user: CollaborationUser\n epoch: string\n /** Confirmed document version for the selection positions. */\n version: number\n selection: CollaborationPresenceSelection | null\n /** Milliseconds since the Unix epoch. Hosts should replace it with the server time. */\n updatedAt: number\n}\n\n/**\n * Optional awareness channel. Presence is best effort: it never changes the\n * document and a failure never stops editing. The host must apply the same\n * document authorization and expire records it has not seen recently.\n * @experimental\n */\nexport interface CollaborationPresenceChannel {\n publish(update: CollaborationPresenceUpdate): Promise<void> | void\n /** Deliver all current records for the document, including this client's own record. */\n subscribe(onPeers: (updates: readonly CollaborationPresenceUpdate[]) => void): () => void\n /** Remove this client's record when the session closes. */\n leave?(clientId: string): Promise<void> | void\n}\n\n/**\n * The host closes over the document ID and supplies its authenticated client.\n * @experimental\n */\nexport interface CollaborationTransport {\n subscribe(onHead: (head: CollaborationHead) => void, onError: (error: unknown) => void): () => void\n pull(head: CollaborationHead): Promise<CollaborationReply>\n push(batch: CollaborationSteps): Promise<CollaborationReply>\n presence?: CollaborationPresenceChannel\n}\n\n/** @experimental */\nexport const collaborationLimits = Object.freeze({\n documentBytes: 512 * 1024,\n batchBytes: 256 * 1024,\n stepsPerBatch: 128,\n jsonDepth: 64,\n})\n\n/**\n * Validation and transport failure codes. Servers use the first eight codes.\n * A host transport can throw `forbidden` for revoked access and `unavailable`\n * for a temporary server failure that the session should retry.\n * @experimental\n */\nexport type CollaborationErrorCode = 'invalid' | 'limit' | 'version' | 'epoch' | 'schema' | 'policy' | 'content' | 'protocol'\n | 'forbidden' | 'unavailable'\n\n/** @experimental */\nexport class CollaborationError extends Error {\n constructor(readonly code: CollaborationErrorCode, message: string) {\n super(message)\n this.name = 'CollaborationError'\n }\n}\n\nexport function assertProtocolVersion(value: { protocolVersion?: unknown }) {\n if (value.protocolVersion !== undefined && value.protocolVersion !== collaborationProtocolVersion) {\n throw new CollaborationError('protocol', 'This editor uses a different collaboration protocol. Update the editor.')\n }\n}\n\nexport function assertCollaborationHead(head: CollaborationHead) {\n if (!head || typeof head !== 'object' || !Number.isSafeInteger(head.version) || head.version < 0\n || typeof head.epoch !== 'string' || !head.epoch || head.epoch.length > 200\n || typeof head.policyRevision !== 'string' || !head.policyRevision || head.policyRevision.length > 200) {\n throw new CollaborationError('invalid', 'Invalid collaborative document version.')\n }\n assertProtocolVersion(head)\n if (head.schemaRevision !== editorSchemaRevision) {\n throw new CollaborationError('schema', 'The editor schema has changed. Reopen this document.')\n }\n}\n\n/** @experimental */\nexport function fenceMismatch(left: CollaborationFence, right: CollaborationFence): 'epoch' | 'schema' | 'policy' | undefined {\n if (left.epoch !== right.epoch) return 'epoch'\n if (left.schemaRevision !== right.schemaRevision) return 'schema'\n if (left.policyRevision !== right.policyRevision) return 'policy'\n}\n","import type { Node, Schema } from '@tiptap/pm/model'\nimport { AttrStep, Step, Transform } from '@tiptap/pm/transform'\nimport { isSafePublicLinkUrl, type PortableComponentPolicyV2 } from '@lupinum/ginko-content/cms-contract'\nimport type { Mark } from '@tiptap/pm/model'\nimport { createEditorSchema } from '../config/documentConfig'\nimport { convertTiptapDocToMarkdown, prepareMarkdownForVisualEditing, validateMarkdownForAuthoring } from '../conversionPipeline'\nimport type { TiptapToMDCOptions } from '../tiptapToMdc'\nimport { imageProperties } from '../image-properties'\nimport {\n assertCollaborationHead, assertProtocolVersion, collaborationLimits, CollaborationError, editorSchemaRevision, fenceMismatch,\n type CollaborationSnapshot, type CollaborationSteps,\n} from './protocol'\n\n/** Step IDs accepted on the wire. Changing this list requires a new schema revision. */\nexport const collaborationWireSteps: readonly string[] = Object.freeze(['replace', 'replaceAround', 'addMark', 'removeMark', 'addNodeMark',\n 'removeNodeMark', 'attr', 'ginkoSetNodePropertyV1', 'ginkoSetComponentVariantV1', 'ginkoSetNodeAttributeV1'])\nconst wireSteps = new Set(collaborationWireSteps)\nconst encoder = new TextEncoder()\n\nfunction validateStepPositions(json: Record<string, unknown>) {\n for (const field of ['from', 'to', 'pos', 'gapFrom', 'gapTo', 'insert']) {\n if (field in json && (!Number.isSafeInteger(json[field]) || Number(json[field]) < 0)) {\n throw new CollaborationError('invalid', 'Editor step positions must be nonnegative safe integers.')\n }\n }\n if (json.slice && typeof json.slice === 'object') {\n for (const [key, value] of Object.entries(json.slice)) {\n if (['openStart', 'openEnd'].includes(key) && (!Number.isSafeInteger(value) || Number(value) < 0)) {\n throw new CollaborationError('invalid', 'Editor slice depths must be nonnegative safe integers.')\n }\n }\n }\n}\n\nexport function stableJson(value: unknown, depth = 0): string {\n if (depth > collaborationLimits.jsonDepth) throw new CollaborationError('limit', 'The document is too deeply nested.')\n if (typeof value === 'number' && !Number.isFinite(value)) throw new CollaborationError('invalid', 'JSON numbers must be finite.')\n if (Array.isArray(value)) return `[${value.map(item => stableJson(item, depth + 1)).join(',')}]`\n if (value && typeof value === 'object') {\n return `{${Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)\n .map(([key, item]) => `${JSON.stringify(key)}:${stableJson(item, depth + 1)}`).join(',')}}`\n }\n return JSON.stringify(value)\n}\n\nfunction parseBounded(source: string, maxBytes: number): unknown {\n if (typeof source !== 'string') throw new CollaborationError('invalid', 'Expected encoded JSON.')\n if (encoder.encode(source).byteLength > maxBytes) throw new CollaborationError('limit', 'The change is too large.')\n try {\n const value: unknown = JSON.parse(source)\n stableJson(value)\n return value\n } catch (error) {\n if (error instanceof CollaborationError) throw error\n throw new CollaborationError('invalid', 'The change contains invalid JSON.')\n }\n}\n\n/**\n * Reject unknown nodes, attributes and malformed shapes instead of dropping them.\n * @experimental\n */\nexport function decodeCollaborationDocument(source: string, schema: Schema = createEditorSchema()): Node {\n const json = parseBounded(source, collaborationLimits.documentBytes)\n try {\n const doc = schema.nodeFromJSON(json)\n doc.check()\n if (doc.type !== schema.topNodeType || stableJson(doc.toJSON()) !== stableJson(json)) {\n throw new Error('Non-canonical document')\n }\n return doc\n } catch {\n throw new CollaborationError('content', 'The collaborative document does not match this editor schema.')\n }\n}\n\n/**\n * The caller must check host authorization and the document fence first.\n * @experimental\n */\nexport function decodeCollaborationSteps(encoded: readonly string[], schema: Schema = createEditorSchema()): Step[] {\n if (!Array.isArray(encoded) || encoded.length < 1 || encoded.length > collaborationLimits.stepsPerBatch) {\n throw new CollaborationError('limit', 'The change has an invalid number of steps.')\n }\n let bytes = 0\n return encoded.map(source => {\n const json = parseBounded(source, collaborationLimits.batchBytes)\n bytes += encoder.encode(source).byteLength\n if (bytes > collaborationLimits.batchBytes) throw new CollaborationError('limit', 'The change batch is too large.')\n if (!json || typeof json !== 'object' || !('stepType' in json) || typeof json.stepType !== 'string'\n || !wireSteps.has(json.stepType)) throw new CollaborationError('invalid', 'Unsupported editor step.')\n validateStepPositions(json)\n try {\n const step = Step.fromJSON(schema, json)\n if (stableJson(step.toJSON()) !== stableJson(json)) throw new Error('Non-canonical step')\n return step\n } catch {\n throw new CollaborationError('invalid', 'The editor step would lose data when decoded.')\n }\n })\n}\n\n/** @experimental */\nexport interface CollaborationContentOptions {\n policy: PortableComponentPolicyV2\n output?: TiptapToMDCOptions\n}\n\n/** @experimental */\nexport interface CollaborationCheckpoint {\n snapshot: CollaborationSnapshot\n /** Derived from the accepted snapshot, never taken from a client checkpoint. */\n markdown: string\n}\n\nconst componentTag = /^[A-Za-z][\\w.:-]{0,127}$/\nconst slotName = /^[^\\s\"'<>=`\\\\]{1,128}$/\nconst orderedListTypes = new Set([null, '1', 'a', 'A', 'i', 'I'])\n\nfunction optionalText(value: unknown, maxLength: number, singleLine = false) {\n return value === null || (typeof value === 'string' && value.length <= maxLength && (!singleLine || !/[\\r\\n]/.test(value)))\n}\n\nfunction optionalNumber(value: unknown) {\n return value === null || (typeof value === 'number' && Number.isFinite(value))\n || (typeof value === 'string' && value.length <= 32 && value.trim() !== '' && Number.isFinite(Number(value)))\n}\n\nfunction invalidValue(message: string): never {\n throw new CollaborationError('content', message)\n}\n\nfunction validateMark(mark: Mark) {\n const attrs = mark.attrs\n if (mark.type.name !== 'link') return\n if (typeof attrs.href !== 'string' || attrs.href.length > 2048 || !isSafePublicLinkUrl(attrs.href)) {\n invalidValue('A link must use a safe URL.')\n }\n if (![null, '_blank'].includes(attrs.target) || !optionalText(attrs.rel, 200, true)\n || !optionalText(attrs.class, 200, true) || !optionalText(attrs.title, 1000)) {\n invalidValue('A link has an unsupported attribute value.')\n }\n}\n\n/** Check each schema attribute value. ProseMirror only checks attribute names. */\nfunction validateAttributeValues(node: Node) {\n const attrs = node.attrs\n switch (node.type.name) {\n case 'heading':\n if (!Number.isSafeInteger(attrs.level) || attrs.level < 1 || attrs.level > 6) invalidValue('A heading level must be a whole number from 1 to 6.')\n if (attrs.id !== null && (typeof attrs.id !== 'string' || !/^[A-Za-z0-9_-]{1,200}$/.test(attrs.id))) {\n invalidValue('A heading id must contain only letters, digits, hyphens, and underscores.')\n }\n break\n case 'orderedList': {\n const start = typeof attrs.start === 'string' && /^\\d{1,9}$/.test(attrs.start) ? Number(attrs.start) : attrs.start\n if (!Number.isSafeInteger(start) || start < 0 || start > 999_999_999 || !orderedListTypes.has(attrs.type)) {\n invalidValue('A numbered list has an unsupported start or type.')\n }\n break\n }\n case 'codeBlock':\n if (!optionalText(attrs.language, 100, true) || !optionalText(attrs.filename, 500, true)) invalidValue('Code metadata must be one line of text.')\n break\n case 'element':\n case 'inline-element':\n if (typeof attrs.tag !== 'string' || !componentTag.test(attrs.tag)) invalidValue('A component has an unsupported name.')\n break\n case 'slot':\n if (typeof attrs.name !== 'string' || !slotName.test(attrs.name)) invalidValue('A component slot has an unsupported name.')\n break\n case 'video':\n if (!optionalText(attrs.src, 2048, true) || !optionalText(attrs.title, 1000) || !optionalText(attrs.alt, 1000)\n || typeof attrs.key !== 'string' || attrs.key.length > 200 || !optionalNumber(attrs.width) || !optionalNumber(attrs.height)) {\n invalidValue('A video has an unsupported attribute value.')\n }\n break\n case 'span-style':\n if (!optionalText(attrs.class, 500, true) || !optionalText(attrs.style, 2000, true)) invalidValue('Styled text has an unsupported attribute value.')\n break\n }\n for (const mark of node.marks) validateMark(mark)\n}\n\nfunction validateRuntimeMetadata(doc: Node) {\n doc.descendants(node => {\n validateAttributeValues(node)\n const props: unknown = node.attrs.props\n if (props && (typeof props !== 'object' || Array.isArray(props))) throw new CollaborationError('content', 'Node properties must be an object.')\n if (props && typeof props === 'object') {\n for (const [key, value] of Object.entries(props)) {\n if (key === '$') {\n if (!value || typeof value !== 'object' || Array.isArray(value)\n || Object.keys(value).sort().join(',') !== 'block,sourceName,syntax'\n || !('syntax' in value) || (value.syntax !== 'angle' && value.syntax !== 'colon')\n || !('block' in value) || (value.block !== 0 && value.block !== 1)\n || !('sourceName' in value) || typeof value.sourceName !== 'string') {\n throw new CollaborationError('content', 'Invalid component source metadata.')\n }\n continue\n }\n if (key === '__tiptapWrap' && value === true && node.type.name === 'element') continue\n if (key === '__mdc_block' && value === true && ['image', 'file'].includes(node.type.name)) continue\n if (node.type.name === 'image') {\n const definition = Object.entries(imageProperties).find(([name]) => name === key)?.[1]\n if (!definition) throw new CollaborationError('content', 'An image property cannot be saved as Content.')\n if (value === null || value === undefined || value === '') continue\n if (definition === 'text' ? typeof value !== 'string'\n : !['number', 'string'].includes(typeof value) || !Number.isFinite(Number(value))) {\n throw new CollaborationError('content', 'An image property has an unsupported value.')\n }\n }\n }\n }\n if (node.type.name === 'codeBlock' && ['language', 'filename'].some(key => node.attrs[key] !== null && typeof node.attrs[key] !== 'string')) {\n throw new CollaborationError('content', 'Code metadata must be text.')\n }\n if (node.type.name === 'table') {\n const width = node.firstChild?.childCount\n if (!width || node.content.content.some((row, index) => row.childCount !== width\n || row.content.content.some(cell => cell.type.name !== (index === 0 ? 'tableHeader' : 'tableCell')))) {\n throw new CollaborationError('content', 'Content tables need a rectangular layout and one header row.')\n }\n if (node.content.content.some(row => row.content.content.some((cell, column) =>\n (cell.attrs.align ?? 'left') !== (node.firstChild!.child(column).attrs.align ?? 'left')))) {\n throw new CollaborationError('content', 'Content tables need one alignment per column.')\n }\n }\n if (['tableCell', 'tableHeader'].includes(node.type.name)\n && (node.attrs.colspan !== 1 || node.attrs.rowspan !== 1 || node.attrs.colwidth !== null\n || ![null, 'left', 'center', 'right'].includes(node.attrs.align))) {\n throw new CollaborationError('content', 'Merged cells and custom cell widths cannot be saved as Content.')\n }\n })\n}\n\nasync function checkpoint(doc: Node, head: Omit<CollaborationSnapshot, 'document'>, options: CollaborationContentOptions): Promise<CollaborationCheckpoint> {\n try {\n doc.check()\n } catch {\n throw new CollaborationError('content', 'The collaborative document does not match this editor schema.')\n }\n validateRuntimeMetadata(doc)\n const document = JSON.stringify(doc.toJSON())\n if (encoder.encode(document).byteLength > collaborationLimits.documentBytes) {\n throw new CollaborationError('limit', 'The collaborative document is too large.')\n }\n const result = await convertTiptapDocToMarkdown(doc.toJSON(), options.output)\n if (!result.ok || result.value === undefined) throw new CollaborationError('content', 'The document cannot be saved as Content.')\n const issue = await validateMarkdownForAuthoring(result.value, { policy: options.policy })\n if (issue) throw new CollaborationError('content', 'The document is outside the host content policy.')\n return { snapshot: { ...head, document }, markdown: result.value }\n}\n\n/**\n * Seed or replace a room only inside a host-authorized transaction with a new epoch.\n * @experimental\n */\nexport async function createCollaborationSnapshot(markdown: string, options: CollaborationContentOptions & {\n epoch: string\n policyRevision: string\n}): Promise<CollaborationCheckpoint> {\n if (typeof markdown !== 'string' || encoder.encode(markdown).byteLength > collaborationLimits.documentBytes) {\n throw new CollaborationError('limit', 'The source document is too large.')\n }\n const head = { epoch: options.epoch, policyRevision: options.policyRevision, schemaRevision: editorSchemaRevision, version: 0 }\n assertCollaborationHead(head)\n const schema = createEditorSchema()\n const prepared = await prepareMarkdownForVisualEditing(markdown, options.output, schema, { policy: options.policy })\n if (!prepared.ok || !prepared.value) throw new CollaborationError('content', 'This source needs source-only editing.')\n let doc: Node\n try {\n doc = schema.nodeFromJSON(prepared.value)\n } catch {\n throw new CollaborationError('content', 'This source needs source-only editing.')\n }\n return checkpoint(doc, head, options)\n}\n\n/**\n * Apply an exact-version batch. Persist the result and operation log atomically.\n * @experimental\n */\nexport async function applyCollaborationSteps(snapshot: CollaborationSnapshot, batch: CollaborationSteps,\n options: CollaborationContentOptions): Promise<CollaborationCheckpoint> {\n assertCollaborationHead(snapshot)\n assertCollaborationHead(batch)\n assertProtocolVersion(batch)\n const mismatch = fenceMismatch(snapshot, batch)\n if (mismatch) throw new CollaborationError(mismatch, 'The collaborative document has changed. Reopen it with your recovery copy.')\n if (batch.version !== snapshot.version) throw new CollaborationError('version', 'Fetch accepted steps before submitting this change.')\n if (typeof batch.clientId !== 'string' || !batch.clientId || batch.clientId.length > 200) {\n throw new CollaborationError('invalid', 'Invalid editor client ID.')\n }\n const schema = createEditorSchema()\n const steps = decodeCollaborationSteps(batch.steps, schema)\n if (!Number.isSafeInteger(snapshot.version + steps.length)) throw new CollaborationError('limit', 'The document version is too large.')\n const transform = new Transform(decodeCollaborationDocument(snapshot.document, schema))\n try {\n for (const step of steps) {\n if (step instanceof AttrStep && !Object.hasOwn(transform.doc.nodeAt(step.pos)?.type.spec.attrs ?? {}, step.attr)) {\n throw new CollaborationError('content', 'Unknown node attribute.')\n }\n transform.step(step)\n }\n transform.doc.check()\n } catch (error) {\n if (error instanceof CollaborationError) throw error\n throw new CollaborationError('content', 'The editor change does not apply to this document.')\n }\n return checkpoint(transform.doc, { epoch: snapshot.epoch, schemaRevision: snapshot.schemaRevision,\n policyRevision: snapshot.policyRevision, version: snapshot.version + steps.length }, options)\n}\n","import { collaborationProtocolVersion, type CollaborationPresenceSelection, type CollaborationPresenceUpdate } from './protocol'\n\nconst colorPattern = /^(?:#[\\da-f]{3}(?:[\\da-f]{3})?|(?:rgb|hsl)a?\\([\\d\\s.,%/]+\\))$/i\n\n/**\n * Deterministic, readable caret color for a client ID.\n * @experimental\n */\nexport function collaborationColor(clientId: string) {\n let hash = 0x811c9dc5\n for (let index = 0; index < clientId.length; index++) {\n hash ^= clientId.charCodeAt(index)\n hash = Math.imul(hash, 0x01000193)\n }\n return `hsl(${(hash >>> 0) % 360} 70% 38%)`\n}\n\nfunction safeColor(color: unknown, clientId: string) {\n return typeof color === 'string' && color.length <= 64 && colorPattern.test(color.trim()) ? color.trim() : collaborationColor(clientId)\n}\n\n/** @internal */\nexport function sanitizeCollaborationUser(user: unknown, clientId: string): { id?: string; name: string; color: string } {\n const value = user && typeof user === 'object' ? user as Record<string, unknown> : {}\n const name = typeof value.name === 'string' ? value.name.replace(/\\s+/g, ' ').trim().slice(0, 64) : ''\n return { ...(typeof value.id === 'string' && value.id.length <= 200 ? { id: value.id } : {}), name,\n color: safeColor(value.color, clientId) }\n}\n\nfunction position(value: unknown) {\n return Number.isSafeInteger(value) && Number(value) >= 0 ? Number(value) : undefined\n}\n\n/**\n * Read an untrusted presence record, for example in a server mutation.\n * Returns a normalized copy, or null for a malformed record.\n * @experimental\n */\nexport function readCollaborationPresence(value: unknown): CollaborationPresenceUpdate | null {\n if (!value || typeof value !== 'object') return null\n const record = value as Record<string, unknown>\n if (record.protocolVersion !== collaborationProtocolVersion || typeof record.clientId !== 'string' || !record.clientId\n || record.clientId.length > 200 || typeof record.epoch !== 'string' || record.epoch.length > 200 || position(record.version) === undefined\n || typeof record.updatedAt !== 'number' || !Number.isFinite(record.updatedAt)) return null\n let selection: CollaborationPresenceSelection | null = null\n if (record.selection !== null) {\n const raw = record.selection && typeof record.selection === 'object' ? record.selection as Record<string, unknown> : {}\n const anchor = position(raw.anchor), head = position(raw.head)\n if (anchor === undefined || head === undefined) return null\n selection = { anchor, head }\n }\n return { protocolVersion: collaborationProtocolVersion, clientId: record.clientId, epoch: record.epoch,\n version: Number(record.version), updatedAt: record.updatedAt, selection, user: sanitizeCollaborationUser(record.user, record.clientId) }\n}\n"],"mappings":";;;;AAMA,IAAa,IAAuB,kBAQvB,IAA+B,GAuG/B,IAAsB,OAAO,OAAO;CAC/C,eAAe,MAAM;CACrB,YAAY,MAAM;CAClB,eAAe;CACf,WAAW;AACb,CAAC,GAYY,IAAb,cAAwC,MAAM;CACvB;CAArB,YAAY,GAAuC,GAAiB;EAElE,AADA,MAAM,CAAO,GADM,KAAA,OAAA,GAEnB,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,EAAsB,GAAsC;CAC1E,IAAI,EAAM,oBAAoB,KAAA,KAAa,EAAM,oBAAA,GAC/C,MAAM,IAAI,EAAmB,YAAY,yEAAyE;AAEtH;AAEA,SAAgB,EAAwB,GAAyB;CAC/D,IAAI,CAAC,KAAQ,OAAO,KAAS,YAAY,CAAC,OAAO,cAAc,EAAK,OAAO,KAAK,EAAK,UAAU,KAC1F,OAAO,EAAK,SAAU,YAAY,CAAC,EAAK,SAAS,EAAK,MAAM,SAAS,OACrE,OAAO,EAAK,kBAAmB,YAAY,CAAC,EAAK,kBAAkB,EAAK,eAAe,SAAS,KACnG,MAAM,IAAI,EAAmB,WAAW,yCAAyC;CAGnF,IADA,EAAsB,CAAI,GACtB,EAAK,mBAAA,kBACP,MAAM,IAAI,EAAmB,UAAU,sDAAsD;AAEjG;AAGA,SAAgB,EAAc,GAA0B,GAAsE;CAC5H,IAAI,EAAK,UAAU,EAAM,OAAO,OAAO;CACvC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Q;EAAK;CAC7B;CACA,OAAO;EAAE,iBAAA;EAA+C,UAAU,EAAO;EAAU,OAAO,EAAO;EAC/F,SAAS,OAAO,EAAO,OAAO;EAAG,WAAW,EAAO;EAAW;EAAW,MAAM,EAA0B,EAAO,MAAM,EAAO,QAAQ;CAAE;AAC3I"}
|
package/dist/runtime.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Runtime-neutral conversion boundary. No Vue views, styles, or host persistence. */
|
|
2
|
-
export { createEditorSchema } from './lib/config/documentConfig.js';
|
|
3
|
-
export { editorProfiles, findProfileViolations, sanitizeFragment } from './lib/profiles.js';
|
|
4
|
-
export type { EditorProfile, EditorProfileName, EditorProfileViolation } from './lib/profiles.js';
|
|
5
|
-
export { SetNodePropertyStep, SetComponentVariantStep, SetNodeAttributeStep } from './lib/property-step.js';
|
|
6
|
-
export { applyCollaborationSteps, createCollaborationSnapshot, decodeCollaborationDocument, decodeCollaborationSteps } from './lib/collaboration/validation.js';
|
|
7
|
-
export type { CollaborationContentOptions, CollaborationCheckpoint } from './lib/collaboration/validation.js';
|
|
8
|
-
export { readCollaborationPresence } from './lib/collaboration/presence-record.js';
|
|
9
|
-
export { editorSchemaRevision, collaborationProtocolVersion, collaborationLimits, CollaborationError, fenceMismatch, } from './lib/collaboration/protocol.js';
|
|
10
|
-
export type { CollaborationErrorCode, CollaborationFence, CollaborationHead, CollaborationSnapshot, CollaborationSteps, CollaborationUpdate, CollaborationReply, CollaborationTransport, CollaborationPresenceChannel, CollaborationPresenceSelection, CollaborationPresenceUpdate, } from './lib/collaboration/protocol.js';
|
|
11
|
-
export { convertMarkdownToTiptapDoc, convertTiptapDocToMarkdown, prepareMarkdownForVisualEditing, validateMarkdownForAuthoring, } from './lib/conversionPipeline.js';
|
|
12
|
-
export type { TiptapToMDCOptions } from './lib/tiptapToMdc.js';
|
|
13
|
-
export type { ConversionIssue, ConversionResult, ConversionPhase, } from './lib/conversionTypes.js';
|
package/dist/runtime.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { C as e, S as t, a as n, d as r, i, n as a, o, s, u as c, w as l, y as u } from "./documentConfig-Z6LdrWZj.js";
|
|
2
|
-
import { a as d, d as f, f as p, i as m, l as h, m as g, n as _, o as v, p as y, s as b } from "./presence-record-CLdPZWKC.js";
|
|
3
|
-
export { h as CollaborationError, t as SetComponentVariantStep, e as SetNodeAttributeStep, l as SetNodePropertyStep, m as applyCollaborationSteps, f as collaborationLimits, p as collaborationProtocolVersion, i as convertMarkdownToTiptapDoc, n as convertTiptapDocToMarkdown, d as createCollaborationSnapshot, a as createEditorSchema, v as decodeCollaborationDocument, b as decodeCollaborationSteps, c as editorProfiles, y as editorSchemaRevision, g as fenceMismatch, r as findProfileViolations, o as prepareMarkdownForVisualEditing, _ as readCollaborationPresence, u as sanitizeFragment, s as validateMarkdownForAuthoring };
|
package/dist/style.css
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
@layer ginko{:where(.ginko-editor,.ginko-overlay-root,.ginko-node-popover-content,.ginko-image-picker,.ginko-toolbar):not(:where(.ginko-editor,.ginko-overlay-root,.ginko-image-picker) *){--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--ginko-background:var(--background,#fff);--ginko-foreground:var(--foreground,#171717);--ginko-muted:var(--muted,#f5f5f5);--ginko-muted-foreground:var(--muted-foreground,#737373);--ginko-border:var(--border,#e5e5e5);--ginko-input:var(--input,var(--ginko-border));--ginko-accent:var(--accent,#f5f5f5);--ginko-accent-foreground:var(--accent-foreground,var(--ginko-foreground));--ginko-primary:var(--primary,#171717);--ginko-primary-foreground:var(--primary-foreground,#fafafa);--ginko-destructive:var(--destructive,#b42318);--ginko-popover:var(--popover,var(--ginko-background));--ginko-popover-foreground:var(--popover-foreground,var(--ginko-foreground));--ginko-ring:var(--ring,#737373);--ginko-radius:var(--radius,.625rem);--ginko-warning:#e4a11b;--ginko-warning-background:#fff8e6;--ginko-warning-foreground:#5c4300;--ginko-selection:color-mix(in srgb, #76a9d7 15%, var(--ginko-background));--ginko-tone-neutral:#8c8c87;--ginko-tone-info:#3786d7;--ginko-tone-warning:#b9811a;--ginko-tone-danger:#d15e51;--ginko-tone-success:#4a9266;--ginko-tone-idea:#9370c2;--ginko-shadow-sm:0 2px 8px #00000014;--ginko-shadow-md:0 8px 28px #00000021, 0 2px 6px #0000000d;--ginko-shadow-lg:0 12px 40px #00000029, 0 2px 6px #0000000f;--ginko-overlay-backdrop:#00000052;--ginko-z-menu:50;--ginko-z-floating:100;--ginko-z-popover:200;--ginko-z-dropdown:250;--ginko-z-tooltip:300}:where(.dark,[data-ginko-theme=dark]) :where(.ginko-editor,.ginko-overlay-root,.ginko-node-popover-content,.ginko-image-picker,.ginko-toolbar):not(:where(.ginko-editor,.ginko-overlay-root,.ginko-image-picker) *),:where(.ginko-editor,.ginko-overlay-root,.ginko-node-popover-content,.ginko-image-picker,.ginko-toolbar):where(.dark,[data-ginko-theme=dark]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--ginko-background:var(--background,#0a0a0a);--ginko-foreground:var(--foreground,#fafafa);--ginko-muted:var(--muted,#262626);--ginko-muted-foreground:var(--muted-foreground,#a3a3a3);--ginko-border:var(--border,#333);--ginko-accent:var(--accent,#262626);--ginko-primary:var(--primary,#fafafa);--ginko-primary-foreground:var(--primary-foreground,#171717);--ginko-destructive:var(--destructive,#f97066);--ginko-ring:var(--ring,#a3a3a3);--ginko-warning:#f5b83d;--ginko-warning-background:#2b2111;--ginko-warning-foreground:#fbe3a8;--ginko-selection:color-mix(in srgb, #76a9d7 25%, var(--ginko-background));--ginko-tone-neutral:#a3a39e;--ginko-tone-info:#5ea3eb;--ginko-tone-warning:#d9a13a;--ginko-tone-danger:#ec7d70;--ginko-tone-success:#68b384;--ginko-tone-idea:#ae8fdb;--ginko-shadow-sm:0 2px 8px #0006;--ginko-shadow-md:0 8px 28px #00000080, 0 2px 6px #0000004d;--ginko-shadow-lg:0 12px 40px #0009, 0 2px 6px #0000004d;--ginko-overlay-backdrop:#0009}@media (prefers-color-scheme:dark){:where([data-ginko-theme=auto]) :where(.ginko-editor,.ginko-overlay-root,.ginko-node-popover-content,.ginko-image-picker,.ginko-toolbar):not(:where(.ginko-editor,.ginko-overlay-root,.ginko-image-picker) *),:where(.ginko-editor,.ginko-overlay-root,.ginko-node-popover-content,.ginko-image-picker,.ginko-toolbar):where([data-ginko-theme=auto]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--ginko-background:var(--background,#0a0a0a);--ginko-foreground:var(--foreground,#fafafa);--ginko-muted:var(--muted,#262626);--ginko-muted-foreground:var(--muted-foreground,#a3a3a3);--ginko-border:var(--border,#333);--ginko-accent:var(--accent,#262626);--ginko-primary:var(--primary,#fafafa);--ginko-primary-foreground:var(--primary-foreground,#171717);--ginko-destructive:var(--destructive,#f97066);--ginko-ring:var(--ring,#a3a3a3);--ginko-warning:#f5b83d;--ginko-warning-background:#2b2111;--ginko-warning-foreground:#fbe3a8;--ginko-selection:color-mix(in srgb, #76a9d7 25%, var(--ginko-background));--ginko-tone-neutral:#a3a39e;--ginko-tone-info:#5ea3eb;--ginko-tone-warning:#d9a13a;--ginko-tone-danger:#ec7d70;--ginko-tone-success:#68b384;--ginko-tone-idea:#ae8fdb;--ginko-shadow-sm:0 2px 8px #0006;--ginko-shadow-md:0 8px 28px #00000080, 0 2px 6px #0000004d;--ginko-shadow-lg:0 12px 40px #0009, 0 2px 6px #0000004d;--ginko-overlay-backdrop:#0009}}.ginko-editor{border:1px solid var(--ginko-border);border-radius:var(--ginko-radius);background:var(--ginko-background);color:var(--ginko-foreground);font-family:inherit;font-size:14px;line-height:1.5;position:relative;overflow:visible}:is(.ginko-editor__header,.ginko-editor__warning,.ginko-editor__insert-menu) button{min-height:2.25rem;color:inherit;cursor:pointer;white-space:nowrap;background:0 0;border:0;border-radius:.4rem;padding:.35rem .65rem}:is(.ginko-editor__header,.ginko-editor__warning,.ginko-editor__insert-menu) button:hover,:is(.ginko-editor__header,.ginko-editor__warning,.ginko-editor__insert-menu) button[aria-pressed=true]{background:var(--ginko-muted)}:is(.ginko-editor__header,.ginko-editor__warning,.ginko-editor__insert-menu) :is(button,input,select):focus-visible,.ginko-editor__source:focus-visible{outline-offset:2px}.ginko-editor__header{border-bottom:1px solid var(--ginko-border);flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:.5rem;padding:.5rem .6rem;display:flex}.ginko-editor__insert-trigger{align-items:center;gap:.45rem;margin-inline-end:auto;font-weight:600;display:inline-flex}.ginko-editor__insert-trigger span[aria-hidden=true]{background:var(--ginko-primary);width:1.35rem;height:1.35rem;color:var(--ginko-primary-foreground);border-radius:999px;place-items:center;font-size:1rem;line-height:1;transition:transform .16s cubic-bezier(.2,0,0,1);display:inline-grid}.ginko-editor__insert-trigger[aria-expanded=true] span[aria-hidden=true]{transform:rotate(45deg)}.ginko-editor__modes{border-radius:calc(var(--ginko-radius) - 1px);background:var(--ginko-muted);gap:2px;padding:3px;display:flex}.ginko-editor__header .ginko-editor__modes button{border-radius:calc(var(--ginko-radius) - 3px);min-height:1.9rem;color:var(--ginko-muted-foreground);font-size:.8rem;font-weight:550;transition:background-color .14s,color .14s,box-shadow .14s}.ginko-editor__header .ginko-editor__modes button:hover{color:var(--ginko-foreground);background:0 0}.ginko-editor__header .ginko-editor__modes button[aria-pressed=true]{background:var(--ginko-background);color:var(--ginko-foreground);box-shadow:0 1px 2px #00000014, 0 0 0 1px color-mix(in srgb, var(--ginko-border) 70%, transparent)}.ginko-editor__peers{align-items:center;margin:0;padding:0;list-style:none;display:flex}.ginko-editor__peer{border:2px solid var(--ginko-background);background:var(--ginko-collab-color,var(--ginko-muted));color:#fff;border-radius:999px;place-items:center;width:1.5rem;height:1.5rem;margin-inline-start:-.25rem;font-size:.6875rem;font-weight:600;line-height:1;display:inline-grid}.ginko-editor__peer:first-child{margin-inline-start:0}.ginko-editor__peer--more{background:var(--ginko-muted);color:var(--ginko-muted-foreground)}.ginko-editor__status{color:var(--ginko-muted-foreground);white-space:nowrap;font-size:.78rem}.ginko-editor__header .ginko-editor__status{order:1}.ginko-editor__header .ginko-editor__peers{order:2}.ginko-editor__header .ginko-editor__modes{order:3}.ginko-editor__sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.ginko-editor__insert-menu{z-index:var(--ginko-z-menu);border:1px solid var(--ginko-border);background:var(--ginko-background);width:min(320px,100vw - 24px);box-shadow:var(--ginko-shadow-lg);border-radius:.75rem;flex-direction:column;padding:.35rem;display:flex;position:fixed;overflow:hidden}@media (width>=700px){.ginko-editor__insert-menu--preview{grid-template-rows:auto minmax(0,1fr) auto auto;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);width:min(620px,100vw - 24px);display:grid}.ginko-editor__insert-menu--preview .ginko-editor__insert-search,.ginko-editor__insert-menu--preview .ginko-editor__insert-query,.ginko-editor__insert-menu--preview .ginko-editor__insert-results,.ginko-editor__insert-menu--preview .ginko-editor__insert-help,.ginko-editor__insert-menu--preview .ginko-editor__insert-error{grid-column:1}.ginko-editor__insert-menu--preview .ginko-editor__recipe-preview{border-top:0;border-left:1px solid var(--ginko-border);background:color-mix(in srgb, var(--ginko-background) 97%, var(--ginko-foreground));grid-area:1/2/5;align-items:safe center;min-width:0;max-height:none;margin:-.35rem -.35rem -.35rem .35rem;padding:1.1rem;display:flex}}.ginko-editor__insert-search{border-bottom:1px solid var(--ginko-border);color:var(--ginko-muted-foreground);align-items:center;gap:.65rem;margin:0 .35rem .35rem;padding:.2rem .35rem .55rem;display:flex}.ginko-editor__insert-query{color:var(--ginko-muted-foreground);border-bottom:1px solid var(--ginko-border);justify-content:space-between;gap:1rem;margin-bottom:.35rem;padding:.55rem .6rem;font-size:.75rem;display:flex}.ginko-editor__insert-query kbd{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ginko-editor__insert-search input{width:100%;min-width:0;color:var(--ginko-foreground);font:inherit;background:0 0;border:0;padding:.4rem 0}.ginko-editor__insert-search:focus-within{border-bottom-color:var(--ginko-muted-foreground)}.ginko-editor__insert-results{overscroll-behavior:contain;flex:auto;min-height:48px;overflow-y:auto}.ginko-editor__insert-results button{text-align:start;white-space:normal;align-items:center;gap:.7rem;width:100%;min-height:57px;padding:.5rem;display:flex}.ginko-editor__insert-results button[aria-selected=true]{background:var(--ginko-muted)}.ginko-editor__recipe-symbol{border:1px solid var(--ginko-border);background:var(--ginko-background);border-radius:.4rem;flex:0 0 35px;place-items:center;height:35px;font:500 16px/1 ui-sans-serif,system-ui,sans-serif;display:grid}.ginko-editor__recipe-symbol svg{width:17px;height:17px;color:var(--ginko-muted-foreground)}.ginko-editor__insert-group+.ginko-editor__insert-group{margin-top:.25rem}.ginko-editor__insert-group-label{color:var(--ginko-muted-foreground);letter-spacing:.02em;text-transform:uppercase;padding:.45rem .5rem .2rem;font:600 .66rem/1.4 ui-sans-serif,system-ui,sans-serif}.ginko-editor__recipe-match{color:inherit;text-decoration:underline;text-decoration-thickness:2px;-webkit-text-decoration-color:color-mix(in srgb, var(--ginko-tone-info) 70%, transparent);text-decoration-color:color-mix(in srgb, var(--ginko-tone-info) 70%, transparent);text-underline-offset:2px;background:0 0}.ginko-editor__insert-empty p{margin:0}.ginko-editor__insert-empty .ginko-editor__insert-hint{margin-top:.25rem;font-size:.75rem}.ginko-editor__recipe-preview:focus-visible{outline:2px solid var(--ginko-ring);outline-offset:-2px}.ginko-editor__recipe-text{flex:1;gap:.1rem;display:grid}.ginko-editor__recipe-text strong{font-size:.85rem;font-weight:550}.ginko-editor__recipe-text small{color:var(--ginko-muted-foreground);font-size:.73rem;line-height:1.4}.ginko-editor__recipe-preview{border-top:1px solid var(--ginko-border);flex:none;max-height:150px;padding:.7rem;overflow:auto}.ginko-editor__insert-empty,.ginko-editor__insert-error{margin:0;padding:.75rem;font-size:.85rem}.ginko-editor__insert-empty{color:var(--ginko-muted-foreground)}.ginko-editor__insert-error{color:var(--ginko-destructive)}.ginko-editor__insert-help{border-top:1px solid var(--ginko-border);color:var(--ginko-muted-foreground);justify-content:space-between;gap:.5rem;margin:.3rem 0 0;padding:.55rem .35rem .15rem;font-size:.68rem;display:flex}.ginko-editor__insert-help kbd{font:inherit;margin-inline-end:.2rem}.ginko-editor__warning{border-bottom:1px solid var(--ginko-warning);background:var(--ginko-warning-background);color:var(--ginko-warning-foreground);gap:.15rem;padding:.65rem .8rem;display:grid}.ginko-editor__clipboard-error{border-bottom:1px solid var(--ginko-border);color:var(--ginko-destructive);margin:0;padding:.65rem .8rem;font-size:.85rem}.ginko-editor[data-variant=default] .ginko-editor__surface{padding:clamp(1rem,3vw,1.75rem)}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror{outline:none;max-width:46rem;min-height:22rem;margin-inline:auto;font-size:1rem;line-height:1.7}.ginko-editor__surface .ProseMirror p.mdc-editor-empty:first-child:before{content:attr(data-placeholder);float:left;pointer-events:none;height:0;color:var(--ginko-muted-foreground)}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror h1{font-size:2rem;font-weight:650}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror h2{font-size:1.5rem;font-weight:650}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror h3{font-size:1.2rem;font-weight:650}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror ul{padding-inline-start:1.5rem;list-style:outside}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror ol{padding-inline-start:1.5rem;list-style:decimal}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror blockquote{border-inline-start:3px solid var(--ginko-foreground);margin-inline:0;padding-inline-start:1rem}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror pre{background:var(--ginko-muted);border-radius:.5rem;padding:1rem;overflow-x:auto}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror>:first-child{margin-top:0}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror>*+*{margin-block-start:1em}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror :is(h1,h2,h3){letter-spacing:-.02em;line-height:1.2}.ginko-editor__surface .ProseMirror div[data-type=Slot]{border:1px dashed var(--ginko-border);border-radius:.5rem;min-height:3.5rem;padding:1.8rem .7rem .5rem;position:relative}.ginko-editor__surface .ProseMirror div[data-type=Slot]:before{content:attr(name);color:var(--ginko-muted-foreground);text-transform:uppercase;font-size:.68rem;font-weight:650;position:absolute;inset-block-start:.45rem;inset-inline-start:.6rem}.ginko-editor__surface .ProseMirror img{max-width:100%;height:auto;display:block}.ginko-editor[data-variant=default] .ginko-editor__surface table{border-collapse:collapse;width:100%}.ginko-editor[data-variant=default] .ginko-editor__surface td,.ginko-editor__surface th{border:1px solid var(--ginko-border);padding:.5rem}.ginko-editor__source{box-sizing:border-box;resize:vertical;background:var(--ginko-background);width:100%;min-height:280px;color:var(--ginko-foreground);border:0;outline:none;padding:1rem;font:13px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;display:block}@media (width<=34rem){:is(.ginko-editor__header,.ginko-editor__warning,.ginko-editor__insert-menu) button{min-height:2.75rem}.ginko-editor__header .ginko-editor__status{flex-basis:100%;order:4;padding-inline:.65rem}.ginko-editor[data-variant=default] .ginko-editor__surface{padding:1rem}.ginko-editor[data-variant=default] .ginko-editor__surface .ProseMirror{min-height:18rem}}.ginko-editor[data-variant=default]>.ginko-toolbar{top:var(--ginko-sticky-top,0px);z-index:5;background:color-mix(in srgb, var(--ginko-background) 92%, transparent);-webkit-backdrop-filter:saturate(1.4)blur(10px);backdrop-filter:saturate(1.4)blur(10px);position:sticky}.ginko-editor[data-variant=inline]{color:inherit;font-size:inherit;line-height:inherit;background:0 0;border:0;border-radius:0}.ginko-editor[data-variant=inline] .ginko-editor__surface .ProseMirror{outline:none;min-height:1lh}.ginko-editor[data-variant=inline]:focus-within{outline:var(--ginko-inline-focus-outline,2px solid color-mix(in srgb, var(--ginko-ring) 55%, transparent));outline-offset:var(--ginko-inline-focus-offset,6px);border-radius:var(--ginko-inline-focus-radius,4px)}.ginko-editor[data-variant=inline] .ginko-editor__surface .ProseMirror p.mdc-editor-empty:first-child:before{color:currentColor;opacity:.45}.ginko-keyboard-dock{inset-inline:0;z-index:var(--ginko-z-floating);transform:translateY(calc(-1 * var(--ginko-keyboard-inset,0px)));border-top:1px solid var(--ginko-border);padding:.25rem max(.5rem, env(safe-area-inset-right)) calc(.25rem + env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));background:color-mix(in srgb, var(--ginko-popover) 90%, transparent);color:var(--ginko-popover-foreground);-webkit-backdrop-filter:saturate(1.6)blur(14px);backdrop-filter:saturate(1.6)blur(14px);position:fixed;bottom:0;box-shadow:0 -8px 24px #00000014}.ginko-keyboard-dock[data-keyboard=open]{padding-bottom:.25rem}.ginko-keyboard-dock .ginko-toolbar{overscroll-behavior-x:contain;scrollbar-width:none;flex-wrap:nowrap;overflow-x:auto}.ginko-keyboard-dock .ginko-toolbar::-webkit-scrollbar{display:none}.ginko-keyboard-dock .ginko-control{min-width:44px;min-height:44px}.ginko-keyboard-dock-enter-active,.ginko-keyboard-dock-leave-active{transition:opacity .16s ease-out,translate .2s cubic-bezier(.2,0,0,1)}.ginko-keyboard-dock-enter-from,.ginko-keyboard-dock-leave-to{opacity:0;translate:0 100%}@media (prefers-reduced-motion:reduce){.ginko-keyboard-dock-enter-active,.ginko-keyboard-dock-leave-active,.ginko-editor__insert-trigger span[aria-hidden=true]{transition:none}}.ginko-editor .ginko-block{--ginko-tone:var(--ginko-tone-neutral);border:1px solid var(--ginko-border);background:var(--ginko-background);border-radius:.5rem;min-width:0;padding:.8rem 1rem;position:relative}.ginko-editor .ginko-block[data-tone=info]{--ginko-tone:var(--ginko-tone-info)}.ginko-editor .ginko-block[data-tone=warning]{--ginko-tone:var(--ginko-tone-warning)}.ginko-editor .ginko-block[data-tone=danger]{--ginko-tone:var(--ginko-tone-danger)}.ginko-editor .ginko-block[data-tone=success]{--ginko-tone:var(--ginko-tone-success)}.ginko-editor .ginko-block[data-tone=idea]{--ginko-tone:var(--ginko-tone-idea)}.ginko-editor .ginko-block[data-callout=true]{background:color-mix(in srgb, var(--ginko-muted) 75%, var(--ginko-background));border:0;padding:.7rem 1rem .7rem 2.65rem}.ginko-editor .ginko-block[data-callout=true]:before{content:"";background:var(--ginko-tone);border-radius:2px;width:2px;position:absolute;top:.7rem;bottom:.7rem;left:.45rem}.ginko-editor .ginko-block[data-appearance=quiet]{background:0 0}.ginko-editor .ginko-block__header{align-items:center;gap:.45rem;min-width:0;display:flex;position:relative}.ginko-editor .ginko-block__label{color:var(--ginko-muted-foreground);opacity:.55;font:500 .68rem/1.5 ui-sans-serif,system-ui,sans-serif;transition:opacity .12s}.ginko-editor .ginko-block:hover>.ginko-block__header>.ginko-block__label,.ginko-editor .ginko-block:focus-within>.ginko-block__header>.ginko-block__label{opacity:1}.ginko-editor .ginko-block__title{width:100%;min-width:0;color:var(--ginko-foreground);font:inherit;text-overflow:ellipsis;background:0 0;border:0;border-radius:.2rem;padding:0 1.4rem 0 0;font-weight:650;line-height:1.75;display:block}.ginko-editor .ginko-block__title:focus{box-shadow:0 1px 0 color-mix(in srgb, var(--ginko-tone) 60%, transparent);outline:none}.ginko-editor .ginko-block__title::placeholder{color:var(--ginko-muted-foreground);opacity:.65;font-weight:450}.ginko-editor .ginko-block__title:disabled{opacity:1}.ginko-editor .ginko-block__symbol{color:var(--ginko-tone);display:flex;position:absolute;top:.35rem;left:-1.55rem}.ginko-editor .ginko-block__symbol svg{width:19px;height:19px}.ginko-editor .ginko-block__body{min-width:0;position:relative}.ginko-editor .ginko-block__content>:first-child{margin-top:.25rem}.ginko-editor .ginko-block__content>:last-child{margin-bottom:0}.ginko-editor .ginko-block[data-columns=true]{background:0 0;border:0;padding:0}.ginko-editor .ginko-block[data-columns=true]>.ginko-block__header{margin-bottom:.35rem}.ginko-editor .ginko-block[data-columns=true]>.ginko-block__body>.ginko-block__content,.ginko-editor .ginko-block[data-columns=true]>.ginko-block__body>.ginko-block__content>[data-type=Slot]{grid-template-columns:minmax(0, var(--column-ratio,50%)) minmax(0, 1fr);display:grid}.ginko-editor .ginko-block[data-columns=true]>.ginko-block__body>.ginko-block__content>[data-type=Slot]{border:0;grid-column:1/-1;padding:0}.ginko-editor .ginko-block[data-columns=true]>.ginko-block__body>.ginko-block__content>[data-type=Slot]:before{display:none}.ginko-editor .ginko-block[data-column=true]{background:0 0;border:0;border-radius:0;margin-top:0;padding:.25rem .9rem .4rem}.ginko-editor .ginko-block__divider{top:0;bottom:0;left:var(--column-ratio);cursor:col-resize;touch-action:none;z-index:2;width:20px;margin-left:-10px;position:absolute}.ginko-editor .ginko-block__divider:before{content:"";background:var(--ginko-border);width:1px;position:absolute;top:.1rem;bottom:.1rem;left:9px}.ginko-editor .ginko-block__divider:after{content:"";background:var(--ginko-tone);opacity:0;border-radius:4px;width:5px;height:24px;transition:opacity .12s;position:absolute;top:calc(50% - 12px);left:7px}.ginko-editor .ginko-block__divider:hover:after,.ginko-editor .ginko-block__divider:focus:after{opacity:1}.ginko-editor .ginko-block__divider:focus-visible{outline:2px solid var(--ginko-tone);outline-offset:1px;border-radius:4px}.ginko-editor .ginko-settings{position:absolute;top:-.2rem;right:-.65rem}.ginko-editor .ginko-icon-button{box-sizing:border-box;width:28px;height:28px;min-height:28px;color:var(--ginko-muted-foreground);cursor:pointer;background:0 0;border:0;border-radius:5px;flex:none;justify-content:center;align-items:center;padding:0;list-style:none;display:inline-flex}.ginko-editor .ginko-icon-button::-webkit-details-marker{display:none}.ginko-editor .ginko-icon-button:hover,.ginko-editor .ginko-icon-button[aria-pressed=true],.ginko-editor .ginko-popover[open]>.ginko-icon-button{background:var(--ginko-muted);color:var(--ginko-foreground)}.ginko-editor .ginko-settings>.ginko-icon-button{opacity:.15;transition:opacity .12s}.ginko-editor .ginko-block:hover>.ginko-block__header>.ginko-settings>.ginko-icon-button,.ginko-editor .ginko-block:focus-within>.ginko-block__header>.ginko-settings>.ginko-icon-button,.ginko-editor .ginko-settings[data-state=open]>summary{opacity:1}:is(.ginko-editor,.ginko-node-popover-content) .ginko-popover__panel{z-index:var(--ginko-z-popover);box-sizing:border-box;border:1px solid var(--ginko-border);background:var(--ginko-background);box-shadow:var(--ginko-shadow-md);color:var(--ginko-foreground);border-radius:.7rem;padding:.5rem;font:13px/1.5 ui-sans-serif,system-ui,sans-serif;position:fixed;overflow:auto}:is(.ginko-editor,.ginko-node-popover-content) .ginko-popover__panel>strong{padding:.35rem .45rem .65rem;font-size:.8rem;display:block}:is(.ginko-editor,.ginko-node-popover-content) .ginko-popover__panel button{width:100%;min-height:32px;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:.3rem;align-items:center;gap:.6rem;padding:.35rem .5rem;display:flex}:is(.ginko-editor,.ginko-node-popover-content) .ginko-popover__panel button:hover{background:var(--ginko-muted)}:is(.ginko-editor,.ginko-node-popover-content) .ginko-popover__panel button:disabled{opacity:.4;cursor:default}:is(.ginko-editor,.ginko-node-popover-content) .ginko-popover__panel button.ginko-danger{color:var(--ginko-destructive)}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields{gap:.7rem;padding:0 .4rem .5rem;display:grid}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields label{gap:.2rem;display:grid}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields label>span{color:var(--ginko-muted-foreground);font-size:.72rem}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields input:not([type=checkbox]),:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields select,:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields textarea{box-sizing:border-box;border:1px solid var(--ginko-border);background:var(--ginko-background);width:100%;min-width:0;color:inherit;font:inherit;border-radius:.35rem;padding:.35rem .5rem}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields textarea{resize:vertical;font:.75rem/1.45 ui-monospace,SFMono-Regular,Menlo,monospace}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields textarea[aria-invalid=true]{border-color:var(--ginko-destructive)}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields input[type=checkbox]{accent-color:var(--ginko-foreground);width:15px;height:15px}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__fields small{color:var(--ginko-muted-foreground);font-size:.7rem}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__block-actions{border-top:1px solid var(--ginko-border);margin-top:.3rem;padding-top:.35rem}:is(.ginko-editor,.ginko-node-popover-content) .ginko-editor__field-error{color:var(--ginko-destructive);margin:0;padding:.3rem .4rem;font-size:.72rem}.ginko-editor .ginko-table{max-width:100%;position:relative}.ginko-editor .ginko-table__viewport{border:1px solid var(--ginko-border);border-radius:.4rem;overflow-x:auto}.ginko-editor .ginko-table table{border-style:hidden;width:100%;min-width:18rem;margin:0}.ginko-editor .ginko-table th{text-align:left;background:color-mix(in srgb, var(--ginko-muted) 60%, var(--ginko-background))}.ginko-editor .ginko-table td,.ginko-editor .ginko-table th{min-width:3rem}.ginko-editor .ginko-table .selectedCell{background:var(--ginko-selection)}.ginko-editor .ginko-table__tools{z-index:8;border:1px solid var(--ginko-border);background:var(--ginko-background);box-shadow:var(--ginko-shadow-sm);border-radius:.5rem;gap:2px;padding:3px;display:flex;position:absolute;bottom:calc(100% + .25rem);right:0}.ginko-editor .ginko-table__alignment{border-top:1px solid var(--ginko-border);gap:.25rem;margin-top:.3rem;padding:.5rem .25rem .15rem;display:flex}.ginko-editor .ginko-table__alignment .ginko-icon-button{justify-content:center;width:32px}.ginko-editor .ginko-code{border:1px solid var(--ginko-border);border-radius:.5rem;overflow:hidden}.ginko-editor .ginko-code pre{border-radius:0;margin:0}.ginko-editor .ginko-code__tools{background:var(--ginko-muted);align-items:center;gap:.5rem;padding:.35rem .65rem;display:flex}.ginko-editor .ginko-code__tools input,.ginko-editor .ginko-code__tools select{min-width:0;color:var(--ginko-muted-foreground);background:0 0;border:0;padding:.2rem 0;font:.72rem/1.5 ui-monospace,monospace}.ginko-editor .ginko-code__tools input{flex:1;width:8rem}.ginko-editor [hidden]{display:none!important}@media (hover:none){.ginko-editor .ginko-settings>.ginko-icon-button{opacity:.65}.ginko-editor .ginko-icon-button{min-width:36px;min-height:36px}.ginko-editor .ginko-block__divider:after{opacity:.6}}@media (prefers-reduced-motion:reduce){.ginko-editor .ginko-block__label,.ginko-editor .ginko-settings>.ginko-icon-button,.ginko-editor .ginko-block__divider:after{transition:none}}.ginko-editor .ginko-image{margin-inline:0;position:relative}.ginko-editor .ginko-image__picture img{max-width:100%;display:block}.ginko-editor .ginko-image>.ginko-popover{position:absolute;top:.5rem;right:.5rem}.ginko-editor .ginko-image-upload{box-sizing:border-box;border:1px dashed var(--ginko-border);background:color-mix(in srgb, var(--ginko-muted) 45%, var(--ginko-background));border-radius:.65rem;margin:1rem 0;transition:border-color .12s,background .12s;position:relative}.ginko-editor .ginko-image-upload__dropzone{width:100%;min-height:180px;color:var(--ginko-foreground);border-radius:inherit;font:inherit;cursor:pointer;background:0 0;border:0;flex-direction:column;justify-content:center;align-items:center;gap:.45rem;padding:1.5rem 2rem;display:flex}.ginko-editor .ginko-image-upload__symbol{border:1px solid var(--ginko-border);background:var(--ginko-background);width:48px;height:48px;color:var(--ginko-muted-foreground);border-radius:.75rem;place-items:center;margin-bottom:.35rem;display:grid;box-shadow:0 2px 5px #0000000a}.ginko-editor .ginko-image-upload__symbol svg{width:25px;height:25px}.ginko-editor .ginko-image-upload__label{font-size:.875rem;font-weight:550}.ginko-editor .ginko-image-upload__hint{color:var(--ginko-muted-foreground);font-size:.75rem}.ginko-editor .ginko-image-upload__cancel{width:28px;height:28px;color:var(--ginko-muted-foreground);cursor:pointer;background:0 0;border:0;border-radius:.35rem;place-items:center;padding:0;display:grid;position:absolute;top:.5rem;right:.5rem}.ginko-editor .ginko-image-upload__cancel:hover{color:var(--ginko-foreground);background:var(--ginko-muted)}.ginko-editor .ginko-image-upload[data-dragging=true]{border-color:var(--ginko-foreground);background:var(--ginko-muted)}.ginko-editor .ginko-image-upload:has(.ginko-image-upload__dropzone:hover){border-color:var(--ginko-foreground);background:var(--ginko-muted)}.ginko-editor .ginko-image-upload__dropzone:disabled{cursor:progress}.ginko-editor .ginko-image-upload__error{color:var(--ginko-destructive);text-align:center;margin:0;padding:0 1rem 1rem;font-size:.8rem}@media (prefers-reduced-motion:reduce){.ginko-editor .ginko-image-upload{transition:none}}.ginko-editor .ginko-image-upload__confirmation{text-align:center;justify-items:center;gap:.65rem;padding:1.5rem;display:grid}.ginko-editor .ginko-image-upload__confirmation img{object-fit:contain;border-radius:.4rem;width:120px;max-width:100%;height:120px;max-height:120px}.ginko-editor .ginko-image-upload__confirmation h3{font:inherit;margin:0;font-size:1rem;font-weight:600}.ginko-editor .ginko-image-upload__confirmation p{overflow-wrap:anywhere;max-width:100%;color:var(--ginko-muted-foreground);margin:0;font-size:.8rem}.ginko-editor .ginko-image-upload__actions{flex-wrap:wrap;justify-content:center;gap:.5rem;margin-top:.3rem;display:flex}.ginko-editor .ginko-image-upload__actions button{border:1px solid var(--ginko-border);background:var(--ginko-background);min-height:40px;color:var(--ginko-foreground);font:inherit;cursor:pointer;border-radius:.4rem;padding:.5rem .9rem;font-size:.85rem}.ginko-editor .ginko-image-upload__actions button:last-child{background:var(--ginko-foreground);color:var(--ginko-background);border-color:var(--ginko-foreground)}.ginko-editor .ginko-image-upload__actions button:focus-visible{outline:2px solid var(--ginko-foreground);outline-offset:3px}.ginko-editor .ginko-image--drop-target{outline:2px solid var(--ginko-foreground);outline-offset:5px;border-radius:.5rem}.ginko-editor .ginko-image-drop-hint{z-index:var(--ginko-z-floating);border:1px solid var(--ginko-border);background:var(--ginko-background);max-width:calc(100vw - 2rem);color:var(--ginko-foreground);box-shadow:var(--ginko-shadow-md);pointer-events:none;text-align:center;border-radius:.65rem;padding:.8rem 1.2rem;font:500 .875rem/1.4 system-ui,sans-serif;position:fixed;bottom:1.5rem;left:50%;transform:translate(-50%)}.ginko-editor .ginko-image-upload[data-replacement=true]{z-index:var(--ginko-z-popover);border:1px solid var(--ginko-border);background:var(--ginko-background);box-shadow:var(--ginko-shadow-md);border-radius:.7rem;margin:0;position:fixed;overflow:auto}.ginko-editor .ginko-image-upload[data-replacement=true] .ginko-image-upload__confirmation{gap:.5rem;padding:1.25rem 1rem 1rem}.ginko-editor .ginko-image-upload[data-replacement=true] .ginko-image-upload__confirmation img{width:64px;height:64px;max-height:64px}.ginko-editor .ginko-image-upload[data-replacement=true] .ginko-image-upload__confirmation h3{letter-spacing:normal;font-size:.875rem;line-height:1.4}.ginko-editor .ginko-image-upload[data-replacement=true] .ginko-image-upload__dropzone{min-height:160px;padding:1.25rem 1rem}.ginko-editor .ginko-image--replacing{outline:2px solid var(--ginko-border);outline-offset:4px;border-radius:.5rem}.ginko-toolbar{border-bottom:1px solid var(--ginko-border);color:var(--ginko-foreground);flex-wrap:wrap;align-items:center;gap:.35rem;padding:.5rem .65rem;font-size:13px;line-height:1.4;display:flex}.ginko-toolbar__group{align-items:center;gap:.125rem;display:flex}.ginko-toolbar__separator{background:var(--ginko-border);width:1px;height:22px;margin-inline:.25rem}.ginko-control{border-radius:calc(var(--ginko-radius) - 2px);min-width:32px;min-height:32px;color:inherit;font:inherit;cursor:pointer;white-space:nowrap;background:0 0;border:0;justify-content:center;align-items:center;gap:.4rem;padding:.35rem .5rem;display:inline-flex}.ginko-control:hover,.ginko-control[data-state=open],.ginko-control[aria-pressed=true]{background:var(--ginko-accent);color:var(--ginko-accent-foreground)}.ginko-control:disabled,.ginko-menu__item[data-disabled]{opacity:.4;cursor:default}.ginko-control:focus-visible,.ginko-menu__item:focus-visible,.ginko-menu input:focus-visible,.ginko-button:focus-visible,.ginko-table-size button:focus-visible{outline:2px solid var(--ginko-ring);outline-offset:2px}.ginko-control svg,.ginko-menu__item svg{flex:0 0 18px}.ginko-menu{z-index:var(--ginko-z-dropdown);min-width:180px;max-width:min(320px,100vw - 24px);max-height:var(--reka-popper-available-height,400px);border:1px solid var(--ginko-border);border-radius:var(--ginko-radius);background:var(--ginko-popover);color:var(--ginko-popover-foreground);box-shadow:var(--ginko-shadow-sm);padding:.3rem;font-family:inherit;font-size:13px;line-height:1.5;overflow:auto}.ginko-menu__item{border-radius:calc(var(--ginko-radius) - 3px);cursor:default;-webkit-user-select:none;user-select:none;outline:none;align-items:center;gap:.6rem;padding:.45rem .55rem;display:flex}.ginko-menu__item[data-highlighted],.ginko-menu__item[data-active]{background:var(--ginko-accent);color:var(--ginko-accent-foreground)}.ginko-tooltip{z-index:var(--ginko-z-tooltip);border:1px solid var(--ginko-border);border-radius:calc(var(--ginko-radius) - 2px);background:var(--ginko-popover);color:var(--ginko-popover-foreground);box-shadow:var(--ginko-shadow-sm);gap:.7rem;padding:.3rem .5rem;font:12px/1.4 ui-sans-serif,system-ui,sans-serif;display:flex}.ginko-tooltip kbd{color:var(--ginko-muted-foreground);font:inherit}.ginko-toolbar__form{min-width:260px;padding:.85rem}.ginko-toolbar__form form{gap:.75rem;display:grid}.ginko-toolbar__form label{gap:.35rem;font-size:12px;display:grid}.ginko-toolbar__form input{box-sizing:border-box;border:1px solid var(--ginko-input);border-radius:calc(var(--ginko-radius) - 2px);width:100%;min-width:0;color:inherit;font:inherit;background:0 0;padding:.45rem .6rem}.ginko-toolbar__form [role=alert]{color:var(--ginko-destructive);margin:0}.ginko-toolbar__form-actions,.ginko-toolbar__dimensions{justify-content:space-between;align-items:center;gap:.5rem;display:flex}.ginko-toolbar__dimensions label{flex:1;min-width:0}.ginko-button{border-radius:calc(var(--ginko-radius) - 2px);color:var(--ginko-primary-foreground);background:var(--ginko-primary);font:inherit;cursor:pointer;border:1px solid #0000;justify-content:center;align-items:center;padding:.45rem .7rem;display:inline-flex}.ginko-table-size{grid-template-columns:repeat(5,1fr);gap:4px;display:grid}.ginko-table-size button{aspect-ratio:1.4;border:1px solid var(--ginko-border);cursor:pointer;background:0 0;border-radius:3px}.ginko-table-size button[data-active]{background:var(--ginko-accent);border-color:var(--ginko-ring)}.ginko-toolbar--compact{border:0;flex-wrap:nowrap;padding:.25rem}@media (width<=640px){.ginko-toolbar{gap:.2rem;padding:.35rem}.ginko-toolbar__separator{margin-inline:.1rem}.ginko-control{min-height:36px}}.ginko-selection-toolbar{z-index:var(--ginko-z-floating);border:1px solid color-mix(in srgb, var(--ginko-border) 80%, transparent);border-radius:calc(var(--ginko-radius) + 2px);background:var(--ginko-popover);color:var(--ginko-popover-foreground);box-shadow:var(--ginko-shadow-md);transform-origin:bottom;animation:.14s cubic-bezier(.2,0,0,1) ginko-selection-in;position:fixed}.ginko-selection-toolbar[data-side=bottom]{--ginko-selection-shift:-4px;transform-origin:top}@keyframes ginko-selection-in{0%{opacity:0;transform:translateY(var(--ginko-selection-shift,4px)) scale(.97)}}@media (prefers-reduced-motion:reduce){.ginko-selection-toolbar{animation:none}}.ginko-table__row-handle,.ginko-table__column-handle{z-index:9;position:absolute}.ginko-table__row-handle{transform:translate(-100%,-50%)}.ginko-table__column-handle{transform:translate(-50%,-100%)}.ginko-editor .ginko-table__tools{flex-wrap:wrap;align-items:center;max-width:calc(100% - 20px);font-size:12px}.ginko-table__scope{color:var(--ginko-muted-foreground);white-space:nowrap;text-overflow:ellipsis;max-width:160px;padding:.2rem .4rem;overflow:hidden}.ginko-editor .ginko-table__alignment{border:0;gap:1px;margin:0;padding:0}.ginko-table__add{white-space:nowrap;font:inherit;align-items:center;gap:.3rem;display:inline-flex}.ginko-table__header-hint{color:var(--ginko-muted-foreground);margin:.25rem .45rem .65rem;font-size:12px;line-height:1.5}.ginko-node-popover-content{z-index:var(--ginko-z-dropdown);width:min(260px,100vw - 24px);max-height:var(--reka-popover-content-available-height,calc(100vh - 24px));overflow:auto}:is(.ginko-editor,.ginko-node-popover-content) .ginko-popover__panel,.ginko-node-popover-content .ginko-popover__panel{box-sizing:border-box;width:100%;position:static}.ginko-editor .ginko-settings>.ginko-icon-button{opacity:.25}.ginko-editor .ginko-block:hover>.ginko-block__header>.ginko-settings>.ginko-icon-button,.ginko-editor .ginko-block:focus-within>.ginko-block__header>.ginko-settings>.ginko-icon-button,.ginko-editor .ginko-settings>.ginko-icon-button[data-state=open]{opacity:1}.ginko-editor .ginko-image>.ginko-popover>.ginko-icon-button{background:var(--ginko-background);border:1px solid var(--ginko-border);opacity:.35}.ginko-editor .ginko-image:hover>.ginko-popover>.ginko-icon-button,.ginko-editor .ginko-image:focus-within>.ginko-popover>.ginko-icon-button{opacity:1}@media (hover:none){.ginko-editor .ginko-settings>.ginko-icon-button{opacity:.75}}.ginko-editor [data-ginko-item-hidden=true]{display:none!important}.ginko-editor .ginko-items__strip{border-bottom:1px solid var(--ginko-border);align-items:center;gap:.25rem;min-width:0;margin:.3rem 0 .6rem;display:flex}.ginko-editor .ginko-items__strip[hidden],.ginko-editor .ginko-items__footer[hidden],.ginko-editor .ginko-items__add[hidden]{display:none}.ginko-editor .ginko-items__tabs{scrollbar-width:none;gap:.15rem;min-width:0;display:flex;overflow:auto hidden}.ginko-editor .ginko-items__tab{border-bottom:2px solid #0000;flex:none;align-items:center;margin-bottom:-1px;display:inline-flex}.ginko-editor .ginko-items__tab[data-active=true]{border-bottom-color:var(--ginko-foreground)}.ginko-editor .ginko-items__tab>[role=tab]{color:var(--ginko-muted-foreground);white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:.3rem .3rem 0 0;padding:.3rem .5rem;font:500 .8rem/1.5 ui-sans-serif,system-ui,sans-serif}.ginko-editor .ginko-items__tab[data-active=true]>[role=tab],.ginko-editor .ginko-items__tab>[role=tab]:hover{color:var(--ginko-foreground)}.ginko-editor .ginko-items__tab>[role=tab]:focus-visible,.ginko-editor .ginko-items__add:focus-visible,.ginko-editor .ginko-block__collapse:focus-visible{outline:2px solid var(--ginko-ring);outline-offset:-2px}.ginko-editor .ginko-items__rename{border:1px solid var(--ginko-input);background:var(--ginko-background);width:12ch;color:var(--ginko-foreground);border-radius:.3rem;margin:.15rem .25rem;padding:.1rem .3rem;font:500 .8rem/1.5 ui-sans-serif,system-ui,sans-serif}.ginko-editor .ginko-items__remove{width:20px;height:20px;color:var(--ginko-muted-foreground);opacity:0;cursor:pointer;background:0 0;border:0;border-radius:4px;justify-content:center;align-items:center;padding:0;display:inline-flex}.ginko-editor .ginko-items__remove svg{width:12px;height:12px}.ginko-editor .ginko-items__tab:hover>.ginko-items__remove,.ginko-editor .ginko-items__tab[data-active=true]>.ginko-items__remove{opacity:.7}.ginko-editor .ginko-items__remove[data-confirm=true]{opacity:1;color:var(--ginko-destructive);background:color-mix(in srgb, var(--ginko-destructive) 10%, transparent)}.ginko-editor .ginko-items__add{border:1px dashed var(--ginko-border);color:var(--ginko-muted-foreground);cursor:pointer;background:0 0;border-radius:.4rem;align-items:center;gap:.3rem;padding:.2rem .55rem;font:500 .75rem/1.5 ui-sans-serif,system-ui,sans-serif;display:inline-flex}.ginko-editor .ginko-items__add:hover{color:var(--ginko-foreground);background:var(--ginko-muted)}.ginko-editor .ginko-items__add--strip{border:0;flex:none;padding:.2rem}.ginko-editor .ginko-items__add svg{width:14px;height:14px}.ginko-editor .ginko-items__footer{margin-top:.5rem}.ginko-editor .ginko-block[data-ginko-item=tabs]{background:0 0;border:0;padding:0}.ginko-editor .ginko-block[data-ginko-item=tabs]>.ginko-block__header>:is(.ginko-block__title,.ginko-block__label){display:none}.ginko-editor .ginko-block[data-items=grid]>.ginko-block__body>.ginko-block__content{grid-template-columns:repeat(var(--ginko-item-columns,2), minmax(0, 1fr));gap:.6rem;display:grid}.ginko-editor .ginko-block[data-items=grid]>.ginko-block__body>.ginko-block__content>*{margin:0}.ginko-editor [data-ginko-item=steps]{margin-left:0;padding-left:2.1rem;position:relative}.ginko-editor [data-ginko-item=steps]:after{content:"";background:var(--ginko-border);width:1px;position:absolute;top:0;bottom:-.6rem;left:.7rem}.ginko-editor [data-ginko-item=steps][data-ginko-item-start=true]:before{content:attr(data-ginko-item-index);z-index:1;background:var(--ginko-muted);width:1.45rem;height:1.45rem;color:var(--ginko-foreground);text-align:center;border-radius:999px;font:600 .75rem/1.45rem ui-sans-serif,system-ui,sans-serif;position:absolute;top:.15em;left:0}.ginko-editor [data-ginko-item=steps][data-ginko-item-start=true]:after{top:1.8rem}.ginko-editor .ginko-block[data-ginko-item=timeline]{margin-left:1.3rem}.ginko-editor .ginko-block[data-ginko-item=timeline]:after{content:"";border:2px solid var(--ginko-background);background:var(--ginko-tone-info);width:.55rem;height:.55rem;box-shadow:0 0 0 1px var(--ginko-border);border-radius:999px;position:absolute;top:1.05rem;left:-1.05rem}.ginko-editor .ginko-block[data-items=timeline]>.ginko-block__body>.ginko-block__content{border-left:1px solid var(--ginko-border);margin-left:.35rem;padding-left:0}.ginko-editor .ginko-block__collapse{width:22px;height:22px;min-height:22px;margin-left:-.35rem}.ginko-editor .ginko-block__collapse[hidden]{display:none}.ginko-editor .ginko-block__collapse svg{transition:transform .12s}.ginko-editor .ginko-block__collapse[aria-expanded=false] svg{transform:rotate(-90deg)}.ginko-editor .ginko-block[data-ginko-item-collapsed=true]>.ginko-block__body{display:none}.ginko-editor .ginko-block[data-items=accordion]>.ginko-block__body>.ginko-block__content>[data-ginko-item]+[data-ginko-item],.ginko-editor .ginko-block[data-items=stack]>.ginko-block__body>.ginko-block__content>[data-ginko-item]+[data-ginko-item]{margin-top:.5rem}@media (prefers-reduced-motion:reduce){.ginko-editor .ginko-block__collapse svg{transition:none}}.ginko-image-picker__overlay{z-index:var(--ginko-z-floating,100);background:var(--ginko-overlay-backdrop,#00000052);position:fixed;inset:0}.ginko-image-picker{z-index:calc(var(--ginko-z-floating,100) + 1);border:1px solid var(--ginko-border);background:var(--ginko-popover);width:min(42rem,100vw - 2rem);max-height:calc(100dvh - 2rem);color:var(--ginko-popover-foreground);box-shadow:var(--ginko-shadow-lg);font:inherit;border-radius:.875rem;flex-direction:column;display:flex;position:fixed;inset-block-start:50%;inset-inline-start:50%;overflow:hidden;transform:translate(-50%,-50%)}.ginko-image-picker__header{justify-content:space-between;align-items:flex-start;gap:1rem;padding:1.25rem 1.25rem .75rem;display:flex}.ginko-image-picker__title{margin:0;font-size:1.125rem;font-weight:600;line-height:1.5}.ginko-image-picker__description{color:var(--ginko-muted-foreground);margin:.25rem 0 0;font-size:.875rem}.ginko-image-picker button,.ginko-image-picker input{font:inherit}.ginko-image-picker button{cursor:pointer;color:inherit}.ginko-image-picker button:disabled{cursor:default;opacity:.5}.ginko-image-picker button:focus-visible,.ginko-image-picker input:focus-visible{outline:2px solid var(--ginko-ring);outline-offset:3px}.ginko-image-picker__close{background:0 0;border:0;border-radius:.375rem;place-items:center;min-width:2.25rem;min-height:2.25rem;display:grid}.ginko-image-picker__close:hover,.ginko-image-picker__button:hover{background:var(--ginko-muted)}.ginko-image-picker__tools{gap:.75rem;padding:.5rem 1.25rem 1rem;display:flex}.ginko-image-picker__search{border:1px solid var(--ginko-border);min-width:0;color:var(--ginko-muted-foreground);border-radius:.5rem;flex:1;align-items:center;gap:.5rem;padding:.5rem .625rem;display:flex}.ginko-image-picker__search input{width:100%;min-width:0;color:var(--ginko-foreground);outline-offset:2px;background:0 0;border:0;padding:0}.ginko-image-picker__button{border:1px solid var(--ginko-border);background:0 0;border-radius:.5rem;justify-content:center;align-items:center;gap:.5rem;min-height:2.25rem;padding:.375rem .75rem;display:inline-flex;font-size:.875rem!important}.ginko-image-picker__error{color:var(--ginko-destructive);margin:0 1.25rem .75rem;font-size:.875rem}.ginko-image-picker__results{min-height:10rem;padding:.25rem 1.25rem 1.25rem;overflow:auto}.ginko-image-picker__grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:.875rem;display:grid}.ginko-image-picker__item{border:1px solid var(--ginko-border);text-align:start;background:0 0;border-radius:.5rem;min-width:0;padding:0;overflow:hidden}.ginko-image-picker__item:hover{border-color:var(--ginko-ring);background:var(--ginko-muted)}.ginko-image-picker__thumbnail{aspect-ratio:4/3;background:var(--ginko-muted);color:var(--ginko-muted-foreground);place-items:center;display:grid}.ginko-image-picker__thumbnail img{object-fit:cover;width:100%;height:100%;display:block}.ginko-image-picker__label{text-overflow:ellipsis;white-space:nowrap;padding:.625rem;font-size:.8125rem;display:block;overflow:hidden}.ginko-image-picker__empty{text-align:center;color:var(--ginko-muted-foreground);padding:2.5rem 1rem;font-size:.875rem}.ginko-image-picker__status{text-align:center;color:var(--ginko-muted-foreground);font-size:.8125rem}.ginko-image-picker__footer{border-top:1px solid var(--ginko-border);justify-content:space-between;padding:1rem 1.25rem;display:flex}@media (width<=30rem){.ginko-image-picker__grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ginko-image-picker__button,.ginko-image-picker__close{min-height:2.75rem}}.ginko-collab-selection{background-color:color-mix(in srgb, var(--ginko-collab-color,#3786d7) 22%, transparent);border-radius:2px}.ginko-collab-caret{border-inline-start:2px solid var(--ginko-collab-color,#3786d7);pointer-events:none;-webkit-user-select:none;user-select:none;word-break:normal;margin-inline:-1px;display:inline;position:relative}.ginko-collab-caret__label{z-index:1;background:var(--ginko-collab-color,#3786d7);color:#fff;text-overflow:ellipsis;white-space:nowrap;opacity:.92;border-radius:3px 3px 3px 0;max-width:12rem;padding:1px 4px;font-family:inherit;font-size:11px;font-style:normal;font-weight:600;line-height:1.3;position:absolute;inset-block-end:100%;inset-inline-start:-2px;overflow:hidden}@media (forced-colors:active){.ginko-collab-caret{border-inline-start-color:highlight}.ginko-collab-caret__label{color:highlighttext;background:highlight}.ginko-collab-selection{background:0 0;outline:1px dotted highlight}}}
|
|
2
|
-
/*$vite$:1*/
|
package/dist/types.d.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
export type JsonPrimitive = boolean | null | number | string;
|
|
2
|
-
export interface JsonRecord {
|
|
3
|
-
[key: string]: JsonValue | undefined;
|
|
4
|
-
}
|
|
5
|
-
export type JsonValue = JsonPrimitive | JsonRecord | JsonValue[];
|
|
6
|
-
export interface AssetInfo {
|
|
7
|
-
id: string;
|
|
8
|
-
filename: string;
|
|
9
|
-
url: string;
|
|
10
|
-
alt?: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
width?: number;
|
|
13
|
-
height?: number;
|
|
14
|
-
size?: number;
|
|
15
|
-
mimeType?: string;
|
|
16
|
-
thumbnailUrl?: string | null;
|
|
17
|
-
thumbnailWidth?: number;
|
|
18
|
-
thumbnailHeight?: number;
|
|
19
|
-
fit?: string;
|
|
20
|
-
quality?: number;
|
|
21
|
-
focalX?: number;
|
|
22
|
-
focalY?: number;
|
|
23
|
-
cropX?: number;
|
|
24
|
-
cropY?: number;
|
|
25
|
-
cropWidth?: number;
|
|
26
|
-
cropHeight?: number;
|
|
27
|
-
scope?: 'entry' | 'collection' | 'global';
|
|
28
|
-
collection?: string;
|
|
29
|
-
entryId?: string;
|
|
30
|
-
ownerName?: string | null;
|
|
31
|
-
tags?: string[];
|
|
32
|
-
createdAt?: number;
|
|
33
|
-
updatedAt?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface AssetProvider {
|
|
36
|
-
/** Replace this method on a reactive provider when display URLs become available. */
|
|
37
|
-
buildUrl: (asset: Partial<AssetInfo>) => string;
|
|
38
|
-
parseUrl: (url: string) => Partial<AssetInfo> | null;
|
|
39
|
-
}
|
|
40
|
-
/** A stored asset reference: a stable `id`, a durable `url`, or both. */
|
|
41
|
-
export type EditorAssetReference = {
|
|
42
|
-
id: string;
|
|
43
|
-
url?: string;
|
|
44
|
-
} | {
|
|
45
|
-
id?: never;
|
|
46
|
-
url: string;
|
|
47
|
-
};
|
|
48
|
-
/** An image's stored identity and presentation. Storage and temporary display URLs stay with the host. */
|
|
49
|
-
export type EditorImage = Partial<Pick<AssetInfo, 'alt' | 'title' | 'width' | 'height' | 'fit' | 'quality' | 'focalX' | 'focalY' | 'cropX' | 'cropY' | 'cropWidth' | 'cropHeight'>> & EditorAssetReference;
|
|
50
|
-
/** A file's stored identity and download presentation. */
|
|
51
|
-
export type EditorFile = Partial<Pick<AssetInfo, 'filename' | 'title' | 'size' | 'mimeType'>> & EditorAssetReference;
|
|
52
|
-
/** A video source and its optional title. */
|
|
53
|
-
export interface EditorVideo {
|
|
54
|
-
src: string;
|
|
55
|
-
title?: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @deprecated Return `EditorImage` from an upload handler. The editor still reads
|
|
59
|
-
* the image fields of this older asset shape at runtime.
|
|
60
|
-
*/
|
|
61
|
-
export type LegacyImageUploadResult = Partial<AssetInfo>;
|
|
62
|
-
/** Host-owned persistence for an inline image upload. Reject to show a retryable error. */
|
|
63
|
-
export type ImageUploadHandler = (file: File, context: {
|
|
64
|
-
signal: AbortSignal;
|
|
65
|
-
}) => Promise<EditorImage | LegacyImageUploadResult>;
|
|
66
|
-
/** Host-supplied library display data, separate from the image stored in the document. */
|
|
67
|
-
export interface EditorImagePickerItem {
|
|
68
|
-
key: string;
|
|
69
|
-
label: string;
|
|
70
|
-
image: EditorImage;
|
|
71
|
-
thumbnailUrl?: string;
|
|
72
|
-
}
|
|
73
|
-
/** Choose an existing image. Null cancels; rejection leaves the placeholder available for retry. */
|
|
74
|
-
export type ImagePicker = (context: {
|
|
75
|
-
signal: AbortSignal;
|
|
76
|
-
current?: EditorImage;
|
|
77
|
-
}) => Promise<EditorImage | null>;
|
|
78
|
-
export interface EditorAssetRequest<T> {
|
|
79
|
-
/** Complete once. Null cancels permanently; false means nothing was applied. */
|
|
80
|
-
complete: (value: T | null) => boolean;
|
|
81
|
-
}
|
|
82
|
-
/** A flush failure that is not a conversion result. */
|
|
83
|
-
export type EditorFlushStateErrorCode = 'collaboration_pending' | 'image_upload_pending' | 'not_ready';
|
|
84
|
-
export interface EditorFlushStateError {
|
|
85
|
-
code: EditorFlushStateErrorCode;
|
|
86
|
-
message: string;
|
|
87
|
-
}
|
|
88
|
-
/** A conversion failure, or an editor state that prevents a safe flush. Check `code` to tell them apart. */
|
|
89
|
-
export type EditorFlushError = import('./lib/conversionTypes.js').ConversionErrorPayload | EditorFlushStateError;
|
|
90
|
-
export type EditorFlushResult = {
|
|
91
|
-
emitted: boolean;
|
|
92
|
-
ok: true;
|
|
93
|
-
} | {
|
|
94
|
-
error: EditorFlushError;
|
|
95
|
-
ok: false;
|
|
96
|
-
};
|
|
97
|
-
/** The public component instance API. Get it with a template ref. */
|
|
98
|
-
export interface GinkoEditorHandle {
|
|
99
|
-
/** Emit pending visual edits. Await it before you close the editor or replace its document. */
|
|
100
|
-
flush: () => Promise<EditorFlushResult>;
|
|
101
|
-
/** True while visual edits, image operations, commands, or shared steps are pending. */
|
|
102
|
-
hasPendingChanges: () => boolean;
|
|
103
|
-
/** Remove the selected image, file, or video. Returns false when nothing was removed. */
|
|
104
|
-
removeSelectedMedia: () => boolean;
|
|
105
|
-
/** Move keyboard focus into the visual editor, or into the Markdown source in source mode. */
|
|
106
|
-
focus: (position?: 'start' | 'end') => void;
|
|
107
|
-
/**
|
|
108
|
-
* Unstable escape hatch: the TipTap editor instance, or `undefined` before it exists.
|
|
109
|
-
* Its API follows TipTap and the editor schema and can change in any release.
|
|
110
|
-
* Do not dispatch changes that bypass the editor's validation.
|
|
111
|
-
*/
|
|
112
|
-
getEditor: () => import('@tiptap/core').Editor | undefined;
|
|
113
|
-
}
|
|
114
|
-
/** @deprecated Use `EditorVideo`. */
|
|
115
|
-
export type VideoInfo = EditorVideo;
|
|
116
|
-
export interface PropFormItem {
|
|
117
|
-
custom?: boolean;
|
|
118
|
-
default?: PropValue;
|
|
119
|
-
key: string;
|
|
120
|
-
label: string;
|
|
121
|
-
options?: readonly string[] | string[];
|
|
122
|
-
type: PropType;
|
|
123
|
-
value: PropValue;
|
|
124
|
-
}
|
|
125
|
-
export type PropType = 'array' | 'boolean' | 'number' | 'object' | 'select' | 'string';
|
|
126
|
-
export type PropValue = JsonValue | undefined;
|