proposal-studio 0.1.2
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 +26 -0
- package/README.md +199 -0
- package/dist/editor-document.html +684 -0
- package/dist/proposal-studio.cjs +968 -0
- package/dist/proposal-studio.d.ts +90 -0
- package/dist/proposal-studio.esm.js +945 -0
- package/dist/proposal-studio.global.js +970 -0
- package/dist/proposal-studio.global.min.js +684 -0
- package/package.json +64 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Type definitions for proposal-studio.
|
|
2
|
+
|
|
3
|
+
/** A message posted by the editor iframe (re-broadcast as a `message` event). */
|
|
4
|
+
export interface ProposalStudioMessage {
|
|
5
|
+
source?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ProposalStudioReadyDetail {
|
|
11
|
+
editor: ProposalStudioElement;
|
|
12
|
+
}
|
|
13
|
+
export interface ProposalStudioChangeDetail {
|
|
14
|
+
html: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ProposalStudioResizeDetail {
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ProposalStudioEventMap {
|
|
21
|
+
ready: CustomEvent<ProposalStudioReadyDetail>;
|
|
22
|
+
change: CustomEvent<ProposalStudioChangeDetail>;
|
|
23
|
+
resize: CustomEvent<ProposalStudioResizeDetail>;
|
|
24
|
+
message: CustomEvent<ProposalStudioMessage>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The `<proposal-studio>` custom element. Hosts the visual editor in an
|
|
29
|
+
* isolated, same-origin iframe.
|
|
30
|
+
*/
|
|
31
|
+
export declare class ProposalStudioElement extends HTMLElement {
|
|
32
|
+
static readonly observedAttributes: string[];
|
|
33
|
+
|
|
34
|
+
/** True once the editor engine has booted inside the iframe. */
|
|
35
|
+
readonly ready: boolean;
|
|
36
|
+
/** The editor iframe's window (same-origin). */
|
|
37
|
+
readonly contentWindow: Window | null;
|
|
38
|
+
/** The editor iframe's document. */
|
|
39
|
+
readonly contentDocument: Document | null;
|
|
40
|
+
|
|
41
|
+
/** Get/set the canvas HTML. */
|
|
42
|
+
value: string;
|
|
43
|
+
|
|
44
|
+
/** Resolves when the editor is ready (immediately if already ready). */
|
|
45
|
+
whenReady(): Promise<this>;
|
|
46
|
+
/** Returns the current canvas HTML (or '' before ready). */
|
|
47
|
+
getHtml(): string;
|
|
48
|
+
/** Replaces the canvas content; queued if called before ready. */
|
|
49
|
+
setHtml(html: string): this;
|
|
50
|
+
/** Alias of setHtml, reads naturally when loading a saved template. */
|
|
51
|
+
loadTemplate(html: string): this;
|
|
52
|
+
/** Low-level: post a message to the editor iframe. */
|
|
53
|
+
post(message: unknown): this;
|
|
54
|
+
/** Focus the editor canvas. */
|
|
55
|
+
focus(): void;
|
|
56
|
+
|
|
57
|
+
addEventListener<K extends keyof ProposalStudioEventMap>(
|
|
58
|
+
type: K,
|
|
59
|
+
listener: (this: ProposalStudioElement, ev: ProposalStudioEventMap[K]) => unknown,
|
|
60
|
+
options?: boolean | AddEventListenerOptions
|
|
61
|
+
): void;
|
|
62
|
+
addEventListener(
|
|
63
|
+
type: string,
|
|
64
|
+
listener: EventListenerOrEventListenerObject,
|
|
65
|
+
options?: boolean | AddEventListenerOptions
|
|
66
|
+
): void;
|
|
67
|
+
removeEventListener<K extends keyof ProposalStudioEventMap>(
|
|
68
|
+
type: K,
|
|
69
|
+
listener: (this: ProposalStudioElement, ev: ProposalStudioEventMap[K]) => unknown,
|
|
70
|
+
options?: boolean | EventListenerOptions
|
|
71
|
+
): void;
|
|
72
|
+
removeEventListener(
|
|
73
|
+
type: string,
|
|
74
|
+
listener: EventListenerOrEventListenerObject,
|
|
75
|
+
options?: boolean | EventListenerOptions
|
|
76
|
+
): void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export declare const TAG_NAME: 'proposal-studio';
|
|
80
|
+
|
|
81
|
+
/** Register the custom element (idempotent). */
|
|
82
|
+
export declare function defineProposalStudio(tagName?: string): typeof ProposalStudioElement;
|
|
83
|
+
|
|
84
|
+
export default ProposalStudioElement;
|
|
85
|
+
|
|
86
|
+
declare global {
|
|
87
|
+
interface HTMLElementTagNameMap {
|
|
88
|
+
'proposal-studio': ProposalStudioElement;
|
|
89
|
+
}
|
|
90
|
+
}
|