@openleaf-editor/ui 0.1.0-beta.2 → 0.1.0-beta.4
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 +85 -0
- package/dist/block-type.d.ts +5 -0
- package/dist/block-type.d.ts.map +1 -0
- package/dist/block-type.js +133 -0
- package/dist/block-type.js.map +1 -0
- package/dist/content-css.d.ts +18 -0
- package/dist/content-css.d.ts.map +1 -1
- package/dist/content-css.js +231 -16
- package/dist/content-css.js.map +1 -1
- package/dist/css.d.ts +23 -0
- package/dist/css.d.ts.map +1 -0
- package/dist/css.js +846 -0
- package/dist/css.js.map +1 -0
- package/dist/dialog.d.ts +93 -0
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +414 -86
- package/dist/dialog.js.map +1 -1
- package/dist/floating.d.ts +4 -0
- package/dist/floating.d.ts.map +1 -1
- package/dist/floating.js +50 -2
- package/dist/floating.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +29 -5
- package/dist/help.js.map +1 -1
- package/dist/i18n.d.ts +8 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +32 -7
- package/dist/i18n.js.map +1 -1
- package/dist/icons.d.ts +7 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +6 -2
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/items.d.ts +0 -1
- package/dist/items.d.ts.map +1 -1
- package/dist/items.js +211 -20
- package/dist/items.js.map +1 -1
- package/dist/live.d.ts +42 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +83 -0
- package/dist/live.js.map +1 -0
- package/dist/menu.d.ts +31 -2
- package/dist/menu.d.ts.map +1 -1
- package/dist/menu.js +163 -23
- package/dist/menu.js.map +1 -1
- package/dist/openleaf.css +147 -12
- package/dist/overflow.d.ts +47 -4
- package/dist/overflow.d.ts.map +1 -1
- package/dist/overflow.js +338 -83
- package/dist/overflow.js.map +1 -1
- package/dist/registry.d.ts +72 -18
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -6
- package/dist/registry.js.map +1 -1
- package/dist/skins.d.ts.map +1 -1
- package/dist/skins.js +48 -14
- package/dist/skins.js.map +1 -1
- package/dist/styles.d.ts +61 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +77 -637
- package/dist/styles.js.map +1 -1
- package/dist/testing.d.ts +3 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +3 -0
- package/dist/testing.js.map +1 -0
- package/dist/toolbar.d.ts +71 -12
- package/dist/toolbar.d.ts.map +1 -1
- package/dist/toolbar.js +410 -166
- package/dist/toolbar.js.map +1 -1
- package/dist/upload.d.ts +32 -7
- package/dist/upload.d.ts.map +1 -1
- package/dist/upload.js +64 -8
- package/dist/upload.js.map +1 -1
- package/package.json +17 -3
package/dist/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,IAAI,kBAAkB,GAAG,KAAK,CAAA;AAE9B;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,kBAAkB,GAAG,IAAI,CAAA;AAC3B,CAAC;AAED,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAY,CAAA;AACxC,8EAA8E;AAC9E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AAA;QAClB,CAAC;QAAC,MAAM,CAAC;YACP,iCAAiC;QACnC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,IAAI,CAAA;QACb,OAAO,CAAC,IAAI,CACV,iFAAiF;YAC/E,mDAAmD;YACnD,yEAAyE;YACzE,yDAAyD,CAC5D,CAAA;IACH,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,GAAa;IACxC,IAAI,kBAAkB;QAAE,OAAO,UAAU,CAAA;IACzC,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAA;IACvC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACxC,IAAI,OAAO,KAAK,SAAS;QAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5C,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/toolbar.d.ts
CHANGED
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Two details that are easy to get wrong and both matter:
|
|
15
15
|
*
|
|
16
|
-
* 1. **Arrow-key roving
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* 1. **Arrow-key roving covers the `<select>` controls too.** The default bar has
|
|
17
|
+
* four of them -- paragraph style, font family, font size, line height -- and
|
|
18
|
+
* when focus is on one, Left/Right have two competing owners: the roving
|
|
19
|
+
* handler wants to move to the next item, the select natively wants to change
|
|
20
|
+
* its value. Leaving them out was the earlier resolution, and it cost more
|
|
21
|
+
* than it saved: ArrowRight from Redo jumped past four controls to Bold, and
|
|
22
|
+
* each select became its own tab stop, making the default bar five tab stops
|
|
23
|
+
* instead of one. The APG resolution is the one used here -- the toolbar takes
|
|
24
|
+
* Left/Right, and Up/Down, Home/End and typeahead are left to the select, so
|
|
25
|
+
* it is still fully operable and Alt+Down still opens its list.
|
|
23
26
|
*
|
|
24
27
|
* 2. **Escape returns focus and the selection to the content.** Preventing mouse
|
|
25
28
|
* clicks from stealing focus solves the mouse case and leaves the keyboard
|
|
@@ -49,6 +52,24 @@ export interface ToolbarOptions {
|
|
|
49
52
|
*/
|
|
50
53
|
locale?: string | null;
|
|
51
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* What a host or a plugin actually needs from a toolbar.
|
|
57
|
+
*
|
|
58
|
+
* Published instead of the `Toolbar` class itself. The documented need is
|
|
59
|
+
* `setItemState` -- pushing state no predicate can derive, such as an upload in
|
|
60
|
+
* flight -- and the keyboard entry point; exposing the class froze its whole
|
|
61
|
+
* surface, private fields and rendering internals included, into the public API
|
|
62
|
+
* before 1.0.
|
|
63
|
+
*/
|
|
64
|
+
export interface ToolbarHandle {
|
|
65
|
+
/** Force a control's state, overriding its `isActive`/`isEnabled` predicate. */
|
|
66
|
+
setItemState(id: string, state: {
|
|
67
|
+
active?: boolean;
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
}): void;
|
|
70
|
+
/** Move focus into the bar, as Alt+F10 does. */
|
|
71
|
+
focusToolbar(): void;
|
|
72
|
+
}
|
|
52
73
|
export declare class Toolbar {
|
|
53
74
|
#private;
|
|
54
75
|
readonly el: HTMLDivElement;
|
|
@@ -60,18 +81,56 @@ export declare class Toolbar {
|
|
|
60
81
|
* not relabel every other editor on the page.
|
|
61
82
|
*/
|
|
62
83
|
setLocale(next: string | null): void;
|
|
84
|
+
/**
|
|
85
|
+
* Enter or leave source view.
|
|
86
|
+
*
|
|
87
|
+
* Every control except the one that leaves again goes unavailable. In source
|
|
88
|
+
* mode a formatting command ran against the hidden document and the textarea
|
|
89
|
+
* was then reparsed over the top of it, so pressing Bold silently discarded
|
|
90
|
+
* the edit -- a button that does nothing is better than a button that
|
|
91
|
+
* destroys work, and a button that says it is unavailable is better still.
|
|
92
|
+
*/
|
|
93
|
+
setSourceMode(active: boolean): void;
|
|
63
94
|
/** Attach to a view and build the controls. */
|
|
64
95
|
mount(view: EditorView): void;
|
|
96
|
+
/**
|
|
97
|
+
* Detach the toolbar AND take its DOM with it.
|
|
98
|
+
*
|
|
99
|
+
* Removing the nodes is part of the contract, not tidiness. The host appends
|
|
100
|
+
* `el` into the editor element and reads that element's
|
|
101
|
+
* `innerHTML` back as document content when it rebuilds -- so a toolbar left
|
|
102
|
+
* behind by `destroy()` becomes the author's document on the next build, and
|
|
103
|
+
* then gets posted to the server.
|
|
104
|
+
*
|
|
105
|
+
* Idempotent: `.remove()` on a detached node is a no-op.
|
|
106
|
+
*/
|
|
65
107
|
destroy(): void;
|
|
66
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* The editor's live region.
|
|
110
|
+
*
|
|
111
|
+
* One per host, shared by every bar on it, and already mounted -- so a host
|
|
112
|
+
* that appends this is moving a node it already owns rather than adopting a
|
|
113
|
+
* detached one. Kept on the class because integrations reach for it.
|
|
114
|
+
*/
|
|
67
115
|
get liveRegion(): HTMLDivElement;
|
|
68
116
|
/**
|
|
69
117
|
* Reflect the editor state onto the controls.
|
|
70
118
|
*
|
|
71
|
-
* Deliberately synchronous, not batched into an animation frame
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
119
|
+
* Deliberately synchronous, not batched into an animation frame: batching
|
|
120
|
+
* would put a perceptible frame of lag between pressing Bold and the button
|
|
121
|
+
* lighting up.
|
|
122
|
+
*
|
|
123
|
+
* This used to claim the predicates were "sub-millisecond work" and that the
|
|
124
|
+
* performance problem "does not exist". It did. Every control without an
|
|
125
|
+
* `isEnabled` is probed by dry-running its command, each of which walks the
|
|
126
|
+
* selection, and a page routinely carries four bars over one editor -- so a
|
|
127
|
+
* Select-All on a hundred-page document measured 1.4 ms per bar and about
|
|
128
|
+
* 3 ms per pointermove during a selection drag, inside `dispatchTransaction`.
|
|
129
|
+
* What makes synchronous affordable is the three guards below it: skipping
|
|
130
|
+
* transactions that cannot have changed an answer, caching each answer per
|
|
131
|
+
* state so the four bars share one computation, and giving the alignment items
|
|
132
|
+
* an explicit `isEnabled` so they stop dry-running a command that walks the
|
|
133
|
+
* selection twice.
|
|
75
134
|
*
|
|
76
135
|
* `tr` is passed so announcements can be gated on a real formatting change.
|
|
77
136
|
*/
|
package/dist/toolbar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../src/toolbar.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../src/toolbar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAclD,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,SAAS,UAA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