@input/pen-types 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +45 -0
- package/dist/index.cjs +467 -0
- package/dist/index.d.cts +2477 -0
- package/dist/index.d.ts +2477 -0
- package/dist/index.mjs +394 -0
- package/package.json +57 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Input B.V.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# `@input/pen-types`
|
|
2
|
+
|
|
3
|
+
`@input/pen-types` is not a package to install alone. Install `@input/pen-core` or `@input/pen`; those depend on this package and re-export the contracts a host actually uses.
|
|
4
|
+
|
|
5
|
+
This package is the shared type, constant, and guard surface for Pen. It does not create an editor, apply ops, or render a surface.
|
|
6
|
+
|
|
7
|
+
The only runtime helper most hosts touch is `generateId()`, which is the HOST4 ID source (a v4 UUID). Everything else is types, frozen constants, and type guards.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
This package has no peer dependencies. Hosts should install `@input/pen-core` instead of depending on this package directly.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @input/pen-types
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`engines.node` is `>=22`.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { generateId } from "@input/pen-types";
|
|
23
|
+
import type { DocumentOp } from "@input/pen-types";
|
|
24
|
+
|
|
25
|
+
const id = generateId();
|
|
26
|
+
const ops: DocumentOp[] = [];
|
|
27
|
+
void id;
|
|
28
|
+
void ops;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Prefer importing `createEditor` from `@input/pen-core` in application code. Import `DocumentOp` from this package — `@input/pen-core` does not re-export it. Reach for this package when you are writing an extension or a typed helper that must not depend on the runtime.
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
This package has no options.
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
The docs site (the `@input/pen-docs` package) covers this area on the Core concepts page (`#/core-concepts`).
|
|
40
|
+
|
|
41
|
+
The public signatures of record are in `api-report.md` next to this package's source in the Pen repository. The docs site does not host a generated browsable reference.
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT © Input B.V. See [`LICENSE.md`](./LICENSE.md).
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AI_AUTOCOMPLETE_CONTROLLER_SLOT: () => AI_AUTOCOMPLETE_CONTROLLER_SLOT,
|
|
24
|
+
AI_CONTROLLER_SLOT: () => AI_CONTROLLER_SLOT,
|
|
25
|
+
AI_EGRESS_INVENTORY_CODE: () => AI_EGRESS_INVENTORY_CODE,
|
|
26
|
+
AI_INLINE_HISTORY_SLOT: () => AI_INLINE_HISTORY_SLOT,
|
|
27
|
+
AI_REQUEST_REFUSED_CODE: () => AI_REQUEST_REFUSED_CODE,
|
|
28
|
+
AI_REVIEW_CONTROLLER_SLOT: () => AI_REVIEW_CONTROLLER_SLOT,
|
|
29
|
+
AI_SUGGESTIONS_CONTROLLER_SLOT: () => AI_SUGGESTIONS_CONTROLLER_SLOT,
|
|
30
|
+
ANNOUNCER_SLOT_KEY: () => ANNOUNCER_SLOT_KEY,
|
|
31
|
+
AWAIT_EXTENSION_LIFECYCLE_SLOT_KEY: () => AWAIT_EXTENSION_LIFECYCLE_SLOT_KEY,
|
|
32
|
+
COLLECT_KEY_BINDINGS_SLOT_KEY: () => COLLECT_KEY_BINDINGS_SLOT_KEY,
|
|
33
|
+
DECORATION_OMIT_FROM_RENDER_ATTRIBUTE: () => DECORATION_OMIT_FROM_RENDER_ATTRIBUTE,
|
|
34
|
+
DEFAULT_MESSAGE_CATALOG: () => DEFAULT_MESSAGE_CATALOG,
|
|
35
|
+
DOCUMENT_PROFILE_METADATA_KEY: () => DOCUMENT_PROFILE_METADATA_KEY,
|
|
36
|
+
FIELD_EDITOR_SLOT_KEY: () => FIELD_EDITOR_SLOT_KEY,
|
|
37
|
+
HISTORY_ORIGIN_TAG: () => HISTORY_ORIGIN_TAG,
|
|
38
|
+
HOOK_PRIORITY_AUTH: () => HOOK_PRIORITY_AUTH,
|
|
39
|
+
HOOK_PRIORITY_DEFAULT: () => HOOK_PRIORITY_DEFAULT,
|
|
40
|
+
HOOK_PRIORITY_INPUT_RULE: () => HOOK_PRIORITY_INPUT_RULE,
|
|
41
|
+
HOOK_PRIORITY_SUGGEST: () => HOOK_PRIORITY_SUGGEST,
|
|
42
|
+
IMPLICIT_V1_FORMAT_STAMP: () => IMPLICIT_V1_FORMAT_STAMP,
|
|
43
|
+
INLINE_COMPLETION_SLOT: () => INLINE_COMPLETION_SLOT,
|
|
44
|
+
INLINE_COMPLETION_VISIBLE_BLOCK_ATTRIBUTE: () => INLINE_COMPLETION_VISIBLE_BLOCK_ATTRIBUTE,
|
|
45
|
+
INPUT_RULES_ENGINE_SLOT_KEY: () => INPUT_RULES_ENGINE_SLOT_KEY,
|
|
46
|
+
MIGRATION_LEDGER_METADATA_KEY: () => MIGRATION_LEDGER_METADATA_KEY,
|
|
47
|
+
MULTIPLAYER_CONTROLLER_SLOT: () => MULTIPLAYER_CONTROLLER_SLOT,
|
|
48
|
+
MUTATION_GROUP_METADATA_KEY: () => MUTATION_GROUP_METADATA_KEY,
|
|
49
|
+
PEN_CLIPBOARD_JSON_MIME: () => PEN_CLIPBOARD_JSON_MIME,
|
|
50
|
+
PEN_CLIPBOARD_JSON_MIME_LEGACY: () => PEN_CLIPBOARD_JSON_MIME_LEGACY,
|
|
51
|
+
PEN_CLIPBOARD_PAYLOAD_VERSION: () => PEN_CLIPBOARD_PAYLOAD_VERSION,
|
|
52
|
+
PEN_DOCUMENT_FORMAT: () => PEN_DOCUMENT_FORMAT,
|
|
53
|
+
PEN_FORMAT_METADATA_KEY: () => PEN_FORMAT_METADATA_KEY,
|
|
54
|
+
PEN_STREAM_PROTOCOL_VERSION: () => PEN_STREAM_PROTOCOL_VERSION,
|
|
55
|
+
RESERVED_METADATA_KEYS: () => RESERVED_METADATA_KEYS,
|
|
56
|
+
REVIEW_SURFACE_BLOCK_SUGGESTION_CLASSES: () => REVIEW_SURFACE_BLOCK_SUGGESTION_CLASSES,
|
|
57
|
+
REVIEW_SURFACE_CLASSES: () => REVIEW_SURFACE_CLASSES,
|
|
58
|
+
REVIEW_SURFACE_CUSTOM_PROPERTIES: () => REVIEW_SURFACE_CUSTOM_PROPERTIES,
|
|
59
|
+
SEARCH_CONTROLLER_SLOT: () => SEARCH_CONTROLLER_SLOT,
|
|
60
|
+
SNAPSHOTS_CONTROLLER_SLOT: () => SNAPSHOTS_CONTROLLER_SLOT,
|
|
61
|
+
UNDO_HISTORY_METADATA_CONTROLLER_SLOT_KEY: () => UNDO_HISTORY_METADATA_CONTROLLER_SLOT_KEY,
|
|
62
|
+
UNDO_HISTORY_RESTORE_SLOT_KEY: () => UNDO_HISTORY_RESTORE_SLOT_KEY,
|
|
63
|
+
generateId: () => generateId,
|
|
64
|
+
isA11yLabelledBy: () => isA11yLabelledBy,
|
|
65
|
+
isAsyncIterable: () => isAsyncIterable,
|
|
66
|
+
isMessageKey: () => isMessageKey,
|
|
67
|
+
isNestedContent: () => isNestedContent,
|
|
68
|
+
isPluralMessage: () => isPluralMessage,
|
|
69
|
+
isScopedSelectionTarget: () => isScopedSelectionTarget
|
|
70
|
+
});
|
|
71
|
+
module.exports = __toCommonJS(index_exports);
|
|
72
|
+
|
|
73
|
+
// src/types/ops.ts
|
|
74
|
+
var MUTATION_GROUP_METADATA_KEY = "mutation-group";
|
|
75
|
+
|
|
76
|
+
// src/types/stream.ts
|
|
77
|
+
var PEN_STREAM_PROTOCOL_VERSION = 1;
|
|
78
|
+
|
|
79
|
+
// src/types/schema.ts
|
|
80
|
+
function isNestedContent(content) {
|
|
81
|
+
return Array.isArray(content);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/types/editor.ts
|
|
85
|
+
var HOOK_PRIORITY_AUTH = 100;
|
|
86
|
+
var HOOK_PRIORITY_SUGGEST = 200;
|
|
87
|
+
var HOOK_PRIORITY_INPUT_RULE = 300;
|
|
88
|
+
var HOOK_PRIORITY_DEFAULT = 500;
|
|
89
|
+
|
|
90
|
+
// src/types/tools.ts
|
|
91
|
+
function isScopedSelectionTarget(target) {
|
|
92
|
+
return target.kind === "scoped-range";
|
|
93
|
+
}
|
|
94
|
+
function isAsyncIterable(value) {
|
|
95
|
+
return value != null && typeof value === "object" && Symbol.asyncIterator in value;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/types/aiRequest.ts
|
|
99
|
+
var AI_REQUEST_REFUSED_CODE = "ai-request-refused";
|
|
100
|
+
var AI_EGRESS_INVENTORY_CODE = "ai-egress-inventory";
|
|
101
|
+
|
|
102
|
+
// src/types/a11y.ts
|
|
103
|
+
function isA11yLabelledBy(value) {
|
|
104
|
+
return typeof value === "object" && value !== null && "labelledBy" in value;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/types/messages.ts
|
|
108
|
+
var DEFAULT_MESSAGE_CATALOG = {
|
|
109
|
+
"pen.a11y.blockConverted": "Converted to {blockType}",
|
|
110
|
+
"pen.a11y.undoApplied": "Undid {hint}",
|
|
111
|
+
"pen.a11y.redoApplied": "Redid {hint}",
|
|
112
|
+
"pen.a11y.blockSelectionEntered": {
|
|
113
|
+
one: "{count} block selected",
|
|
114
|
+
other: "{count} blocks selected"
|
|
115
|
+
},
|
|
116
|
+
"pen.a11y.blockSelectionChanged": {
|
|
117
|
+
one: "{count} block selected",
|
|
118
|
+
other: "{count} blocks selected"
|
|
119
|
+
},
|
|
120
|
+
"pen.a11y.cellSelectionChanged": "{rows} by {columns} cells selected",
|
|
121
|
+
"pen.a11y.suggestionAppeared": "Suggestion appeared",
|
|
122
|
+
"pen.a11y.suggestionAccepted": "Suggestion accepted",
|
|
123
|
+
"pen.a11y.suggestionRejected": "Suggestion rejected",
|
|
124
|
+
"pen.a11y.streamingStarted": "Streaming started",
|
|
125
|
+
"pen.a11y.streamingFinished": "Streaming finished",
|
|
126
|
+
"pen.a11y.findMatches": {
|
|
127
|
+
one: "{count} match",
|
|
128
|
+
other: "{count} matches"
|
|
129
|
+
},
|
|
130
|
+
"pen.a11y.atomSelected": "{atomType} selected",
|
|
131
|
+
"pen.a11y.collaboratorJoined": "{name} joined",
|
|
132
|
+
"pen.a11y.collaboratorEditing": "{name} is editing",
|
|
133
|
+
"pen.selection.blocksSelected": {
|
|
134
|
+
one: "{count} block selected",
|
|
135
|
+
other: "{count} blocks selected"
|
|
136
|
+
},
|
|
137
|
+
"pen.ai.review.accept": "Accept",
|
|
138
|
+
"pen.schema.paragraph.title": "Paragraph",
|
|
139
|
+
"pen.schema.paragraph.description": "Plain text paragraph",
|
|
140
|
+
"pen.schema.paragraph.placeholder": "Text",
|
|
141
|
+
"pen.schema.heading.title": "Heading",
|
|
142
|
+
"pen.schema.heading.placeholder": "Heading",
|
|
143
|
+
"pen.display.group.basic": "Basic",
|
|
144
|
+
"pen.display.group.lists": "Lists",
|
|
145
|
+
"pen.display.group.other": "Other",
|
|
146
|
+
"pen.schema.document.emptyPlaceholder": "Start writing...",
|
|
147
|
+
"pen.editor.label": "Editor",
|
|
148
|
+
"pen.toolbar.formatting": "Formatting",
|
|
149
|
+
"pen.drag.reorderBlock": "Drag to reorder block",
|
|
150
|
+
"pen.blockHandle.reorder": "Reorder block",
|
|
151
|
+
"pen.blockHandle.moveUp": "Move up",
|
|
152
|
+
"pen.blockHandle.moveDown": "Move down",
|
|
153
|
+
"pen.search.input.placeholder": "Search...",
|
|
154
|
+
"pen.search.input.label": "Find in document",
|
|
155
|
+
"pen.search.replace.placeholder": "Replace...",
|
|
156
|
+
"pen.search.replace.label": "Replace with",
|
|
157
|
+
"pen.search.results.label": "Search results",
|
|
158
|
+
"pen.search.results.none": "No matches",
|
|
159
|
+
"pen.search.results.count": {
|
|
160
|
+
one: "{current} of {count} matches",
|
|
161
|
+
other: "{current} of {count} matches"
|
|
162
|
+
},
|
|
163
|
+
"pen.search.next": "Next match",
|
|
164
|
+
"pen.search.previous": "Previous match",
|
|
165
|
+
"pen.search.replaceMatch": "Replace match",
|
|
166
|
+
"pen.search.replaceAll": "Replace all matches",
|
|
167
|
+
"pen.search.toggle.caseSensitive": "Toggle case-sensitive search",
|
|
168
|
+
"pen.search.toggle.regex": "Toggle regular expression search",
|
|
169
|
+
"pen.search.toggle.wholeWord": "Toggle whole-word search",
|
|
170
|
+
"pen.slash.input.placeholder": "Search blocks...",
|
|
171
|
+
"pen.slash.list.label": "Slash menu",
|
|
172
|
+
"pen.suggestion.list.label": "Suggestions",
|
|
173
|
+
"pen.table.addColumn": "Add column",
|
|
174
|
+
"pen.table.addRow": "Add row",
|
|
175
|
+
"pen.table.columnPlaceholder": "Column {index}",
|
|
176
|
+
"pen.table.columnMenu.label": "{title} column",
|
|
177
|
+
"pen.table.columnMenu.type": "Type",
|
|
178
|
+
"pen.table.columnMenu.insertLeft": "\u2190 Insert left",
|
|
179
|
+
"pen.table.columnMenu.insertRight": "Insert right \u2192",
|
|
180
|
+
"pen.table.columnMenu.delete": "Delete column",
|
|
181
|
+
"pen.table.columnType.text": "Text",
|
|
182
|
+
"pen.table.columnType.number": "Number",
|
|
183
|
+
"pen.table.columnType.select": "Select",
|
|
184
|
+
"pen.table.columnType.checkbox": "Checkbox",
|
|
185
|
+
"pen.table.columnType.date": "Date",
|
|
186
|
+
"pen.table.columnType.url": "URL",
|
|
187
|
+
"pen.table.columnType.email": "Email",
|
|
188
|
+
"pen.toggle.collapse": "Collapse toggle",
|
|
189
|
+
"pen.toggle.expand": "Expand toggle",
|
|
190
|
+
"pen.toggle.empty": "Empty toggle. Click to add a block.",
|
|
191
|
+
"pen.checklist.toggle": "Toggle checkbox",
|
|
192
|
+
"pen.ai.suggestion.previous": "Previous suggestion",
|
|
193
|
+
"pen.ai.suggestion.next": "Next suggestion",
|
|
194
|
+
"pen.ai.suggestion.count": {
|
|
195
|
+
one: "{current} of {count}",
|
|
196
|
+
other: "{current} of {count}"
|
|
197
|
+
},
|
|
198
|
+
"pen.ai.suggestion.groupPrevious": "Previous suggestion group",
|
|
199
|
+
"pen.ai.suggestion.groupNext": "Next suggestion group",
|
|
200
|
+
"pen.ai.prompt.placeholder": "Edit selection",
|
|
201
|
+
"pen.ai.turn.pending": {
|
|
202
|
+
one: "{count} pending",
|
|
203
|
+
other: "{count} pending"
|
|
204
|
+
},
|
|
205
|
+
"pen.ai.turn.working": "Working",
|
|
206
|
+
"pen.ai.turn.accepted": "Accepted",
|
|
207
|
+
"pen.ai.turn.rejected": "Rejected",
|
|
208
|
+
"pen.ai.turn.error": "Error",
|
|
209
|
+
"pen.ai.turn.done": "Done",
|
|
210
|
+
"pen.ai.review.reject": "Reject",
|
|
211
|
+
"pen.ai.session.inlineEdit": "Inline edit",
|
|
212
|
+
"pen.ai.session.selectedRange": "Selected range",
|
|
213
|
+
"pen.ai.session.selectedText": "Selected text",
|
|
214
|
+
"pen.ai.session.targetActive": "AI target is active",
|
|
215
|
+
"pen.ai.session.targetPinned": "Pinned to the original selection",
|
|
216
|
+
"pen.ai.session.followUp": "Add follow-up",
|
|
217
|
+
"pen.ai.session.runEdit": "Run edit",
|
|
218
|
+
"pen.ai.commandMenu.placeholder": "Search AI commands",
|
|
219
|
+
"pen.ai.commandMenu.label": "AI command menu",
|
|
220
|
+
"pen.ai.command.rewrite": "Rewrite",
|
|
221
|
+
"pen.ai.command.rewrite.description": "Rewrite the selected text",
|
|
222
|
+
"pen.ai.command.continue": "Continue writing",
|
|
223
|
+
"pen.ai.command.continue.description": "Continue writing from the current position",
|
|
224
|
+
"pen.ai.command.summarize": "Summarize",
|
|
225
|
+
"pen.ai.command.summarize.description": "Summarize the selected text",
|
|
226
|
+
"pen.ai.command.fixGrammar": "Fix grammar",
|
|
227
|
+
"pen.ai.command.fixGrammar.description": "Fix grammar and spelling",
|
|
228
|
+
"pen.ai.command.simplify": "Simplify",
|
|
229
|
+
"pen.ai.command.simplify.description": "Make the text simpler and more concise",
|
|
230
|
+
"pen.ai.command.expand": "Expand",
|
|
231
|
+
"pen.ai.command.expand.description": "Expand the text with more detail",
|
|
232
|
+
"pen.ai.command.translate": "Translate",
|
|
233
|
+
"pen.ai.command.translate.description": "Translate to another language",
|
|
234
|
+
"pen.ai.shortcut.undoInline": "Undo AI inline turn",
|
|
235
|
+
"pen.ai.shortcut.redoInline": "Redo AI inline turn",
|
|
236
|
+
"pen.ai.suggestion.keep": "Keep",
|
|
237
|
+
"pen.ai.suggestion.undo": "Undo",
|
|
238
|
+
"pen.ai.suggestion.heading": "Suggestion",
|
|
239
|
+
"pen.ai.suggestion.applyHint": "Apply to accept this edit.",
|
|
240
|
+
"pen.ai.suggestion.dismiss": "Dismiss",
|
|
241
|
+
"pen.ai.suggestion.apply": "Apply",
|
|
242
|
+
"pen.ai.suggestion.kind.spelling": "Spelling",
|
|
243
|
+
"pen.ai.suggestion.kind.grammar": "Grammar",
|
|
244
|
+
"pen.ai.suggestion.kind.clarity": "Clarity",
|
|
245
|
+
"pen.ai.suggestion.kind.rephrase": "Rephrase",
|
|
246
|
+
"pen.ai.suggestion.kind.other": "Suggestion",
|
|
247
|
+
"pen.ai.review.section.content": "Content changes",
|
|
248
|
+
"pen.ai.review.section.block": "Block changes",
|
|
249
|
+
"pen.ai.review.section.row": "Row changes",
|
|
250
|
+
"pen.ai.review.section.cell": "Cell changes",
|
|
251
|
+
"pen.ai.review.section.schema": "Schema changes",
|
|
252
|
+
"pen.ai.review.section.view": "View changes",
|
|
253
|
+
"pen.ai.review.kind.added": "Added",
|
|
254
|
+
"pen.ai.review.kind.removed": "Removed",
|
|
255
|
+
"pen.ai.review.kind.updated": "Updated",
|
|
256
|
+
"pen.ai.review.kind.moved": "Moved",
|
|
257
|
+
"pen.ai.review.subgroup.content.added": "Content additions",
|
|
258
|
+
"pen.ai.review.subgroup.content.removed": "Content removals",
|
|
259
|
+
"pen.ai.review.subgroup.content.updated": "Content updates",
|
|
260
|
+
"pen.ai.review.subgroup.content.moved": "Content moves",
|
|
261
|
+
"pen.ai.review.subgroup.block.added": "Block additions",
|
|
262
|
+
"pen.ai.review.subgroup.block.removed": "Block removals",
|
|
263
|
+
"pen.ai.review.subgroup.block.updated": "Block updates",
|
|
264
|
+
"pen.ai.review.subgroup.block.moved": "Block moves",
|
|
265
|
+
"pen.ai.review.subgroup.row.added": "Row additions",
|
|
266
|
+
"pen.ai.review.subgroup.row.removed": "Row removals",
|
|
267
|
+
"pen.ai.review.subgroup.row.updated": "Row updates",
|
|
268
|
+
"pen.ai.review.subgroup.row.moved": "Row moves",
|
|
269
|
+
"pen.ai.review.subgroup.cell.added": "Cell additions",
|
|
270
|
+
"pen.ai.review.subgroup.cell.removed": "Cell removals",
|
|
271
|
+
"pen.ai.review.subgroup.cell.updated": "Cell updates",
|
|
272
|
+
"pen.ai.review.subgroup.cell.moved": "Cell moves",
|
|
273
|
+
"pen.ai.review.subgroup.schema.added": "Schema additions",
|
|
274
|
+
"pen.ai.review.subgroup.schema.removed": "Schema removals",
|
|
275
|
+
"pen.ai.review.subgroup.schema.updated": "Schema updates",
|
|
276
|
+
"pen.ai.review.subgroup.schema.moved": "Schema moves",
|
|
277
|
+
"pen.ai.review.subgroup.view.added": "View additions",
|
|
278
|
+
"pen.ai.review.subgroup.view.removed": "View removals",
|
|
279
|
+
"pen.ai.review.subgroup.view.updated": "View updates",
|
|
280
|
+
"pen.ai.review.subgroup.view.moved": "View moves",
|
|
281
|
+
"pen.ai.review.action.insert": "Insert",
|
|
282
|
+
"pen.ai.review.action.delete": "Delete",
|
|
283
|
+
"pen.ai.review.action.move": "Move",
|
|
284
|
+
"pen.ai.review.action.convert": "Convert",
|
|
285
|
+
"pen.ai.review.action.change": "Change",
|
|
286
|
+
"pen.ai.review.blockSuggestion.insert": "Insert {blockType}",
|
|
287
|
+
"pen.ai.review.blockSuggestion.delete": "Delete {blockType}",
|
|
288
|
+
"pen.ai.review.blockSuggestion.move": "Move {blockType}",
|
|
289
|
+
"pen.ai.review.blockSuggestion.convert": "Convert {blockType}",
|
|
290
|
+
"pen.ai.review.blockType.fallback": "block",
|
|
291
|
+
"pen.ai.review.acceptGroup": "Accept group",
|
|
292
|
+
"pen.ai.review.rejectGroup": "Reject group",
|
|
293
|
+
"pen.ai.review.acceptSubgroup": "Accept subgroup",
|
|
294
|
+
"pen.ai.review.rejectSubgroup": "Reject subgroup",
|
|
295
|
+
"pen.ai.review.expand": "Expand",
|
|
296
|
+
"pen.ai.review.collapse": "Collapse",
|
|
297
|
+
"pen.ai.review.structuralSuggestion": "(structural suggestion)",
|
|
298
|
+
"pen.ai.review.noPendingChanges": "No pending changes.",
|
|
299
|
+
"pen.ai.session.close": "Close"
|
|
300
|
+
};
|
|
301
|
+
function isMessageKey(value) {
|
|
302
|
+
return Object.prototype.hasOwnProperty.call(DEFAULT_MESSAGE_CATALOG, value);
|
|
303
|
+
}
|
|
304
|
+
function isPluralMessage(value) {
|
|
305
|
+
return typeof value === "object" && value !== null && typeof value.other === "string";
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// src/types/format.ts
|
|
309
|
+
var PEN_DOCUMENT_FORMAT = 3;
|
|
310
|
+
var PEN_FORMAT_METADATA_KEY = "penFormat";
|
|
311
|
+
var DOCUMENT_PROFILE_METADATA_KEY = "documentProfile";
|
|
312
|
+
var MIGRATION_LEDGER_METADATA_KEY = "penMigrations";
|
|
313
|
+
var RESERVED_METADATA_KEYS = Object.freeze([
|
|
314
|
+
PEN_FORMAT_METADATA_KEY,
|
|
315
|
+
DOCUMENT_PROFILE_METADATA_KEY,
|
|
316
|
+
MIGRATION_LEDGER_METADATA_KEY
|
|
317
|
+
]);
|
|
318
|
+
var IMPLICIT_V1_FORMAT_STAMP = Object.freeze({
|
|
319
|
+
format: 1,
|
|
320
|
+
minReader: 1,
|
|
321
|
+
writer: "unknown"
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// src/constants/decorations.ts
|
|
325
|
+
var INLINE_COMPLETION_VISIBLE_BLOCK_ATTRIBUTE = "data-pen-inline-completion-visible";
|
|
326
|
+
|
|
327
|
+
// src/constants/reviewSurface.ts
|
|
328
|
+
var REVIEW_SURFACE_CLASSES = Object.freeze({
|
|
329
|
+
/** Inserted text in a proposed edit. */
|
|
330
|
+
suggestionInsert: "pen-suggestion-insert",
|
|
331
|
+
/** Deleted text in a proposed edit, including in-flight originals. */
|
|
332
|
+
suggestionDelete: "pen-suggestion-delete",
|
|
333
|
+
/** Text still arriving, shown before anything is written. */
|
|
334
|
+
preview: "pen-ai-review-preview",
|
|
335
|
+
/** Selection context kept visible around an edit under review. */
|
|
336
|
+
context: "pen-ai-review-context",
|
|
337
|
+
/** The range an edit under review affects. */
|
|
338
|
+
affectedRange: "pen-ai-affected-range",
|
|
339
|
+
/** A block carrying a proposed structural change. */
|
|
340
|
+
blockSuggestion: "pen-block-suggestion"
|
|
341
|
+
});
|
|
342
|
+
var REVIEW_SURFACE_BLOCK_SUGGESTION_CLASSES = Object.freeze({
|
|
343
|
+
"insert-block": "pen-block-suggestion-insert-block",
|
|
344
|
+
"delete-block": "pen-block-suggestion-delete-block",
|
|
345
|
+
"move-block": "pen-block-suggestion-move-block",
|
|
346
|
+
"convert-block": "pen-block-suggestion-convert-block",
|
|
347
|
+
"split-block": "pen-block-suggestion-split-block",
|
|
348
|
+
"format-text": "pen-block-suggestion-format-text"
|
|
349
|
+
});
|
|
350
|
+
var REVIEW_SURFACE_CUSTOM_PROPERTIES = Object.freeze({
|
|
351
|
+
insertColor: "--pen-ai-review-insert-color",
|
|
352
|
+
insertBackground: "--pen-ai-review-insert-background",
|
|
353
|
+
deleteColor: "--pen-ai-review-delete-color",
|
|
354
|
+
contextBackground: "--pen-ai-review-context-background",
|
|
355
|
+
contextBoxShadow: "--pen-ai-review-context-box-shadow",
|
|
356
|
+
borderRadius: "--pen-ai-review-border-radius",
|
|
357
|
+
inlinePaddingBlock: "--pen-ai-review-inline-padding-block",
|
|
358
|
+
inlineMarginBlock: "--pen-ai-review-inline-margin-block"
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
// src/types/decorations.ts
|
|
362
|
+
var DECORATION_OMIT_FROM_RENDER_ATTRIBUTE = "data-pen-omit-from-render";
|
|
363
|
+
|
|
364
|
+
// src/types/clipboard.ts
|
|
365
|
+
var PEN_CLIPBOARD_PAYLOAD_VERSION = 1;
|
|
366
|
+
var PEN_CLIPBOARD_JSON_MIME = "application/x-pen-blocks+json";
|
|
367
|
+
var PEN_CLIPBOARD_JSON_MIME_LEGACY = "application/x-pen-blocks";
|
|
368
|
+
|
|
369
|
+
// src/utils/generateId.ts
|
|
370
|
+
var HEX_DIGITS = "0123456789abcdef";
|
|
371
|
+
var UUID_DASH_POSITIONS = /* @__PURE__ */ new Set([3, 5, 7, 9]);
|
|
372
|
+
function formatUuidV4(bytes) {
|
|
373
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
374
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
375
|
+
let id = "";
|
|
376
|
+
for (let index = 0; index < 16; index++) {
|
|
377
|
+
const byte = bytes[index];
|
|
378
|
+
id += HEX_DIGITS[byte >> 4] + HEX_DIGITS[byte & 15];
|
|
379
|
+
if (UUID_DASH_POSITIONS.has(index)) {
|
|
380
|
+
id += "-";
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return id;
|
|
384
|
+
}
|
|
385
|
+
function generateId() {
|
|
386
|
+
const webCrypto = typeof crypto === "undefined" ? void 0 : crypto;
|
|
387
|
+
if (typeof webCrypto?.randomUUID === "function") {
|
|
388
|
+
return webCrypto.randomUUID();
|
|
389
|
+
}
|
|
390
|
+
if (typeof webCrypto?.getRandomValues === "function") {
|
|
391
|
+
return formatUuidV4(webCrypto.getRandomValues(new Uint8Array(16)));
|
|
392
|
+
}
|
|
393
|
+
const bytes = new Uint8Array(16);
|
|
394
|
+
for (let index = 0; index < bytes.length; index++) {
|
|
395
|
+
bytes[index] = Math.floor(Math.random() * 256);
|
|
396
|
+
}
|
|
397
|
+
return formatUuidV4(bytes);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/constants/slots.ts
|
|
401
|
+
var FIELD_EDITOR_SLOT_KEY = "field-editor";
|
|
402
|
+
var COLLECT_KEY_BINDINGS_SLOT_KEY = "core:collect-key-bindings";
|
|
403
|
+
var AWAIT_EXTENSION_LIFECYCLE_SLOT_KEY = "core:await-extension-lifecycle";
|
|
404
|
+
var INPUT_RULES_ENGINE_SLOT_KEY = "input-rules:engine";
|
|
405
|
+
var UNDO_HISTORY_RESTORE_SLOT_KEY = "undo:history-restore";
|
|
406
|
+
var UNDO_HISTORY_METADATA_CONTROLLER_SLOT_KEY = "undo:history-metadata-controller";
|
|
407
|
+
var INLINE_COMPLETION_SLOT = "ai:inline-completion";
|
|
408
|
+
var AI_CONTROLLER_SLOT = "ai:controller";
|
|
409
|
+
var AI_INLINE_HISTORY_SLOT = "ai:inline-history";
|
|
410
|
+
var AI_REVIEW_CONTROLLER_SLOT = "ai:review";
|
|
411
|
+
var AI_AUTOCOMPLETE_CONTROLLER_SLOT = "ai-autocomplete:controller";
|
|
412
|
+
var AI_SUGGESTIONS_CONTROLLER_SLOT = "ai-suggestions:controller";
|
|
413
|
+
var SEARCH_CONTROLLER_SLOT = "search:controller";
|
|
414
|
+
var MULTIPLAYER_CONTROLLER_SLOT = "multiplayer:controller";
|
|
415
|
+
var SNAPSHOTS_CONTROLLER_SLOT = "snapshots:controller";
|
|
416
|
+
var ANNOUNCER_SLOT_KEY = "pen.announcer";
|
|
417
|
+
var HISTORY_ORIGIN_TAG = "__pen_history__";
|
|
418
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
419
|
+
0 && (module.exports = {
|
|
420
|
+
AI_AUTOCOMPLETE_CONTROLLER_SLOT,
|
|
421
|
+
AI_CONTROLLER_SLOT,
|
|
422
|
+
AI_EGRESS_INVENTORY_CODE,
|
|
423
|
+
AI_INLINE_HISTORY_SLOT,
|
|
424
|
+
AI_REQUEST_REFUSED_CODE,
|
|
425
|
+
AI_REVIEW_CONTROLLER_SLOT,
|
|
426
|
+
AI_SUGGESTIONS_CONTROLLER_SLOT,
|
|
427
|
+
ANNOUNCER_SLOT_KEY,
|
|
428
|
+
AWAIT_EXTENSION_LIFECYCLE_SLOT_KEY,
|
|
429
|
+
COLLECT_KEY_BINDINGS_SLOT_KEY,
|
|
430
|
+
DECORATION_OMIT_FROM_RENDER_ATTRIBUTE,
|
|
431
|
+
DEFAULT_MESSAGE_CATALOG,
|
|
432
|
+
DOCUMENT_PROFILE_METADATA_KEY,
|
|
433
|
+
FIELD_EDITOR_SLOT_KEY,
|
|
434
|
+
HISTORY_ORIGIN_TAG,
|
|
435
|
+
HOOK_PRIORITY_AUTH,
|
|
436
|
+
HOOK_PRIORITY_DEFAULT,
|
|
437
|
+
HOOK_PRIORITY_INPUT_RULE,
|
|
438
|
+
HOOK_PRIORITY_SUGGEST,
|
|
439
|
+
IMPLICIT_V1_FORMAT_STAMP,
|
|
440
|
+
INLINE_COMPLETION_SLOT,
|
|
441
|
+
INLINE_COMPLETION_VISIBLE_BLOCK_ATTRIBUTE,
|
|
442
|
+
INPUT_RULES_ENGINE_SLOT_KEY,
|
|
443
|
+
MIGRATION_LEDGER_METADATA_KEY,
|
|
444
|
+
MULTIPLAYER_CONTROLLER_SLOT,
|
|
445
|
+
MUTATION_GROUP_METADATA_KEY,
|
|
446
|
+
PEN_CLIPBOARD_JSON_MIME,
|
|
447
|
+
PEN_CLIPBOARD_JSON_MIME_LEGACY,
|
|
448
|
+
PEN_CLIPBOARD_PAYLOAD_VERSION,
|
|
449
|
+
PEN_DOCUMENT_FORMAT,
|
|
450
|
+
PEN_FORMAT_METADATA_KEY,
|
|
451
|
+
PEN_STREAM_PROTOCOL_VERSION,
|
|
452
|
+
RESERVED_METADATA_KEYS,
|
|
453
|
+
REVIEW_SURFACE_BLOCK_SUGGESTION_CLASSES,
|
|
454
|
+
REVIEW_SURFACE_CLASSES,
|
|
455
|
+
REVIEW_SURFACE_CUSTOM_PROPERTIES,
|
|
456
|
+
SEARCH_CONTROLLER_SLOT,
|
|
457
|
+
SNAPSHOTS_CONTROLLER_SLOT,
|
|
458
|
+
UNDO_HISTORY_METADATA_CONTROLLER_SLOT_KEY,
|
|
459
|
+
UNDO_HISTORY_RESTORE_SLOT_KEY,
|
|
460
|
+
generateId,
|
|
461
|
+
isA11yLabelledBy,
|
|
462
|
+
isAsyncIterable,
|
|
463
|
+
isMessageKey,
|
|
464
|
+
isNestedContent,
|
|
465
|
+
isPluralMessage,
|
|
466
|
+
isScopedSelectionTarget
|
|
467
|
+
});
|