@kumwe/studio-rich-text 0.1.0-alpha.6 → 0.1.0-rc.1
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/README.md +18 -5
- package/THIRD_PARTY_NOTICES.md +19 -0
- package/dist/first-party-tools.d.ts +173 -0
- package/dist/first-party-tools.d.ts.map +1 -0
- package/dist/first-party-tools.js +1012 -0
- package/dist/first-party-tools.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +99 -15
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +14 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +272 -0
- package/dist/markdown.js.map +1 -0
- package/dist/profiles.d.ts +19 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +87 -0
- package/dist/profiles.js.map +1 -0
- package/dist/safe-html.d.ts +16 -0
- package/dist/safe-html.d.ts.map +1 -0
- package/dist/safe-html.js +249 -0
- package/dist/safe-html.js.map +1 -0
- package/dist/strict-csp-surface.d.ts +10 -0
- package/dist/strict-csp-surface.d.ts.map +1 -0
- package/dist/strict-csp-surface.js +298 -0
- package/dist/strict-csp-surface.js.map +1 -0
- package/dist/studio-rich-text-editor.d.ts +55 -0
- package/dist/studio-rich-text-editor.d.ts.map +1 -0
- package/dist/studio-rich-text-editor.js +121 -0
- package/dist/studio-rich-text-editor.js.map +1 -0
- package/package.json +6 -5
- package/third-party-licenses/codex-notifier-1.1.2.txt +21 -0
- package/third-party-licenses/codex-tooltip-1.0.6.txt +7 -0
- package/third-party-licenses/editorjs__caret-1.1.0.txt +21 -0
- package/third-party-licenses/editorjs__dom-1.1.0.txt +21 -0
- package/third-party-licenses/editorjs__editorjs-2.31.6.txt +190 -0
- package/third-party-licenses/editorjs__helpers-1.2.2.txt +21 -0
package/README.md
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
# `@kumwe/studio-rich-text`
|
|
2
2
|
|
|
3
|
-
Status:
|
|
3
|
+
Status: integration-candidate implementation. Gate claims still require the evidence ledger.
|
|
4
4
|
|
|
5
|
-
A bounded
|
|
6
|
-
|
|
5
|
+
A bounded Studio-owned rich-text authoring boundary backed internally by Editor.js `2.31.6`. It supplies a
|
|
6
|
+
deliberate Studio tool profile for structured-content leaf fields; it is not a second page-layout model.
|
|
7
|
+
Consumers use `StudioRichTextEditorFactory`, named Studio profiles, and canonical
|
|
8
|
+
`StudioRichTextDocument` values. Editor.js output and plugin configuration are deliberately not public API or
|
|
9
|
+
persisted state.
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
Editor.js remains the private default surface. Strict style-CSP/Trusted-Types hosts can instead pass
|
|
12
|
+
Studio's `StudioStrictCspRichTextSurfaceAdapter` to the factory, or select the corresponding Studio
|
|
13
|
+
registry policy through `@kumwe/studio`. The sink-free surface retains the same first-party structured
|
|
14
|
+
blocks, semantic inline formatting, read-only rules, and canonical JSON; it does not inject styles or
|
|
15
|
+
write HTML strings.
|
|
16
|
+
|
|
17
|
+
The package also provides deterministic Markdown import/export and policy-sanitized HTML import.
|
|
18
|
+
HTML import can only narrow the fixed portable tag ceiling; it never persists HTML, event handlers,
|
|
19
|
+
styles, URLs, scripts, or editor-native data. Dynamic host bindings are displayed read-only.
|
|
20
|
+
|
|
21
|
+
Hosts remain responsible for authoritative validation and for rendering canonical JSON with their
|
|
22
|
+
own escaping server-side presenter.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
<!-- Generated by scripts/generate-third-party-notices.mjs. Do not edit by hand. -->
|
|
4
|
+
|
|
5
|
+
Package: `@kumwe/studio-rich-text`
|
|
6
|
+
|
|
7
|
+
Production closure SHA-256: `7b581c7b8fcb6a7436a017215ef59840857990b2ae30d9d798c3e81d04b2750b`
|
|
8
|
+
|
|
9
|
+
The following packages are present in this package's lock-derived production dependency closure.
|
|
10
|
+
They retain their own copyright and license terms.
|
|
11
|
+
|
|
12
|
+
| Package | Version | Declared license | License text SHA-256 | Evidence source |
|
|
13
|
+
| --- | --- | --- | --- | --- |
|
|
14
|
+
| @editorjs/caret | 1.1.0 | MIT | [`5955c6e9d1de490608d7a41b4cfff00e769867ddb5fac2999b8efc874500e3a1`](third-party-licenses/editorjs__caret-1.1.0.txt) | [curated upstream source](https://github.com/editor-js/utils/blob/023b992f3ed56d32f7a907914e851d3cfdf78036/LICENSE) |
|
|
15
|
+
| @editorjs/dom | 1.1.0 | MIT | [`5955c6e9d1de490608d7a41b4cfff00e769867ddb5fac2999b8efc874500e3a1`](third-party-licenses/editorjs__dom-1.1.0.txt) | [curated upstream source](https://github.com/editor-js/utils/blob/023b992f3ed56d32f7a907914e851d3cfdf78036/LICENSE) |
|
|
16
|
+
| @editorjs/editorjs | 2.31.6 | Apache-2.0 | [`b946f387bbb7de6843c0db34f87a8956f229d220b3bf81b16b8425788cacf3ed`](third-party-licenses/editorjs__editorjs-2.31.6.txt) | [curated upstream source](https://github.com/codex-team/editor.js/blob/v2.31.6/LICENSE) |
|
|
17
|
+
| @editorjs/helpers | 1.2.2 | MIT | [`5955c6e9d1de490608d7a41b4cfff00e769867ddb5fac2999b8efc874500e3a1`](third-party-licenses/editorjs__helpers-1.2.2.txt) | [curated upstream source](https://github.com/editor-js/utils/blob/023b992f3ed56d32f7a907914e851d3cfdf78036/LICENSE) |
|
|
18
|
+
| codex-notifier | 1.1.2 | MIT | [`698022d282ae51ef05451e18cda80381aa74c6a8bb19b4ee4565b1926d36e08a`](third-party-licenses/codex-notifier-1.1.2.txt) | [curated upstream source](https://github.com/codex-team/js-notifier/blob/d000792c90bbde682d438b3554f3b9c8f6ddcb95/LICENSE) |
|
|
19
|
+
| codex-tooltip | 1.0.6 | MIT | [`4350bad7723eb798e1b61d8bb006dbdba611d64257b711f81bc9dc737e82b69f`](third-party-licenses/codex-tooltip-1.0.6.txt) | [curated upstream source](https://github.com/codex-team/codex.tooltips/blob/c1d3798621189ede6aaa66765acd5901b5310275/LICENSE) |
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { StudioRichTextDocument, StudioRichTextNode } from './index.js';
|
|
2
|
+
export type StudioEditorJsToolName = 'callout' | 'checklist' | 'code' | 'delimiter' | 'header' | 'list' | 'paragraph' | 'quote' | 'table';
|
|
3
|
+
export declare const STUDIO_EDITOR_JS_TOOL_NAMES: readonly StudioEditorJsToolName[];
|
|
4
|
+
export interface StudioEditorJsBlock {
|
|
5
|
+
data: {
|
|
6
|
+
node: StudioRichTextNode;
|
|
7
|
+
};
|
|
8
|
+
type: StudioEditorJsToolName;
|
|
9
|
+
}
|
|
10
|
+
interface ToolOptions {
|
|
11
|
+
data?: {
|
|
12
|
+
node?: StudioRichTextNode;
|
|
13
|
+
};
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ToolClass {
|
|
17
|
+
new (options: ToolOptions): {
|
|
18
|
+
render(): HTMLElement;
|
|
19
|
+
save(): {
|
|
20
|
+
node: StudioRichTextNode;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
readonly isReadOnlySupported: boolean;
|
|
24
|
+
readonly toolbox: {
|
|
25
|
+
icon: string;
|
|
26
|
+
title: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function studioEditorJsTools(): Readonly<Record<StudioEditorJsToolName, ToolClass>>;
|
|
30
|
+
export declare function toStudioEditorJsBlocks(document: StudioRichTextDocument): StudioEditorJsBlock[];
|
|
31
|
+
export declare function fromStudioEditorJsBlocks(value: unknown): StudioRichTextDocument;
|
|
32
|
+
declare abstract class InlineToolBase {
|
|
33
|
+
static readonly isReadOnlySupported: boolean;
|
|
34
|
+
protected readonly node: StudioRichTextNode;
|
|
35
|
+
protected readonly readOnly: boolean;
|
|
36
|
+
protected field?: HTMLElement;
|
|
37
|
+
constructor(options: ToolOptions, fallback: StudioRichTextNode);
|
|
38
|
+
protected renderInline(label: string, content: readonly StudioRichTextNode[]): HTMLElement;
|
|
39
|
+
protected saveInline(original: readonly StudioRichTextNode[]): StudioRichTextNode[];
|
|
40
|
+
abstract render(): HTMLElement;
|
|
41
|
+
abstract save(): {
|
|
42
|
+
node: StudioRichTextNode;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare class StudioParagraphTool extends InlineToolBase {
|
|
46
|
+
static readonly isReadOnlySupported: boolean;
|
|
47
|
+
static readonly toolbox: {
|
|
48
|
+
readonly icon: "¶";
|
|
49
|
+
readonly title: "Paragraph";
|
|
50
|
+
};
|
|
51
|
+
constructor(options: ToolOptions);
|
|
52
|
+
render(): HTMLElement;
|
|
53
|
+
save(): {
|
|
54
|
+
node: StudioRichTextNode;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export declare class StudioHeaderTool extends InlineToolBase {
|
|
58
|
+
#private;
|
|
59
|
+
static readonly isReadOnlySupported: boolean;
|
|
60
|
+
static readonly toolbox: {
|
|
61
|
+
readonly icon: "H";
|
|
62
|
+
readonly title: "Heading";
|
|
63
|
+
};
|
|
64
|
+
constructor(options: ToolOptions);
|
|
65
|
+
render(): HTMLElement;
|
|
66
|
+
save(): {
|
|
67
|
+
node: StudioRichTextNode;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export declare class StudioQuoteTool extends InlineToolBase {
|
|
71
|
+
static readonly isReadOnlySupported: boolean;
|
|
72
|
+
static readonly toolbox: {
|
|
73
|
+
readonly icon: "“";
|
|
74
|
+
readonly title: "Quote";
|
|
75
|
+
};
|
|
76
|
+
constructor(options: ToolOptions);
|
|
77
|
+
render(): HTMLElement;
|
|
78
|
+
save(): {
|
|
79
|
+
node: StudioRichTextNode;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export declare class StudioDelimiterTool {
|
|
83
|
+
static readonly isReadOnlySupported: boolean;
|
|
84
|
+
static readonly toolbox: {
|
|
85
|
+
readonly icon: "—";
|
|
86
|
+
readonly title: "Separator";
|
|
87
|
+
};
|
|
88
|
+
render(): HTMLElement;
|
|
89
|
+
save(): {
|
|
90
|
+
node: StudioRichTextNode;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export declare class StudioCalloutTool extends InlineToolBase {
|
|
94
|
+
#private;
|
|
95
|
+
static readonly isReadOnlySupported: boolean;
|
|
96
|
+
static readonly toolbox: {
|
|
97
|
+
readonly icon: "!";
|
|
98
|
+
readonly title: "Callout";
|
|
99
|
+
};
|
|
100
|
+
constructor(options: ToolOptions);
|
|
101
|
+
render(): HTMLElement;
|
|
102
|
+
save(): {
|
|
103
|
+
node: StudioRichTextNode;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export declare class StudioCodeTool {
|
|
107
|
+
#private;
|
|
108
|
+
static readonly isReadOnlySupported: boolean;
|
|
109
|
+
static readonly toolbox: {
|
|
110
|
+
readonly icon: "</>";
|
|
111
|
+
readonly title: "Code";
|
|
112
|
+
};
|
|
113
|
+
constructor(options: ToolOptions);
|
|
114
|
+
render(): HTMLElement;
|
|
115
|
+
save(): {
|
|
116
|
+
node: StudioRichTextNode;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export declare class StudioListTool {
|
|
120
|
+
#private;
|
|
121
|
+
static readonly isReadOnlySupported: boolean;
|
|
122
|
+
static readonly toolbox: {
|
|
123
|
+
readonly icon: "•";
|
|
124
|
+
readonly title: "List";
|
|
125
|
+
};
|
|
126
|
+
constructor(options: ToolOptions);
|
|
127
|
+
render(): HTMLElement;
|
|
128
|
+
save(): {
|
|
129
|
+
node: StudioRichTextNode;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export declare class StudioChecklistTool {
|
|
133
|
+
#private;
|
|
134
|
+
static readonly isReadOnlySupported: boolean;
|
|
135
|
+
static readonly toolbox: {
|
|
136
|
+
readonly icon: "☑";
|
|
137
|
+
readonly title: "Checklist";
|
|
138
|
+
};
|
|
139
|
+
constructor(options: ToolOptions);
|
|
140
|
+
render(): HTMLElement;
|
|
141
|
+
save(): {
|
|
142
|
+
node: StudioRichTextNode;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export declare class StudioTableTool {
|
|
146
|
+
#private;
|
|
147
|
+
static readonly isReadOnlySupported: boolean;
|
|
148
|
+
static readonly toolbox: {
|
|
149
|
+
readonly icon: "▦";
|
|
150
|
+
readonly title: "Table";
|
|
151
|
+
};
|
|
152
|
+
constructor(options: ToolOptions);
|
|
153
|
+
render(): HTMLElement;
|
|
154
|
+
save(): {
|
|
155
|
+
node: StudioRichTextNode;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** Editor.js inline tool for a bounded semantic highlight tone. */
|
|
159
|
+
export declare class StudioMarkerTool {
|
|
160
|
+
#private;
|
|
161
|
+
static readonly isInline: boolean;
|
|
162
|
+
static readonly sanitize: {
|
|
163
|
+
readonly mark: {
|
|
164
|
+
readonly 'data-studio-tone': true;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
checkState(selection: Selection): boolean;
|
|
168
|
+
render(): HTMLElement;
|
|
169
|
+
renderActions(): HTMLElement;
|
|
170
|
+
surround(range: Range): void;
|
|
171
|
+
}
|
|
172
|
+
export {};
|
|
173
|
+
//# sourceMappingURL=first-party-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-party-tools.d.ts","sourceRoot":"","sources":["../src/first-party-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAsB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEjG,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,WAAW,GACX,MAAM,GACN,WAAW,GACX,QAAQ,GACR,MAAM,GACN,WAAW,GACX,OAAO,GACP,OAAO,CAAC;AAEZ,eAAO,MAAM,2BAA2B,EAAE,SAAS,sBAAsB,EAU9D,CAAC;AAEZ,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE;QAAE,IAAI,EAAE,kBA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