securemark 0.240.0 → 0.241.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 +12 -0
- package/design.md +2 -2
- package/dist/securemark.js +1260 -2745
- package/gulpfile.js +1 -1
- package/index.d.ts +0 -1
- package/package-lock.json +285 -160
- package/package.json +8 -8
- package/src/combinator/control/manipulation/fallback.ts +0 -1
- package/src/combinator/control/manipulation/indent.ts +3 -3
- package/src/combinator/data/parser/some.ts +28 -6
- package/src/combinator/data/parser.ts +21 -16
- package/src/debug.test.ts +1 -1
- package/src/parser/api/bind.test.ts +1 -1
- package/src/parser/api/parse.test.ts +7 -1
- package/src/parser/api/parse.ts +1 -1
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/codeblock.ts +1 -1
- package/src/parser/block/dlist.ts +1 -1
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/block/extension/figbase.ts +1 -1
- package/src/parser/block/extension/figure.ts +21 -20
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/placeholder.ts +1 -1
- package/src/parser/block/extension/table.test.ts +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/heading.ts +1 -1
- package/src/parser/block/horizontalrule.ts +1 -1
- package/src/parser/block/ilist.ts +1 -1
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block/olist.ts +8 -8
- package/src/parser/block/paragraph.ts +1 -1
- package/src/parser/block/reply/cite.ts +1 -1
- package/src/parser/block/reply/quote.ts +1 -1
- package/src/parser/block/reply.ts +1 -1
- package/src/parser/block/table.ts +1 -1
- package/src/parser/block/ulist.ts +1 -1
- package/src/parser/block.ts +1 -1
- package/src/parser/header.ts +1 -1
- package/src/parser/inline/annotation.ts +2 -2
- package/src/parser/inline/autolink/account.ts +1 -1
- package/src/parser/inline/autolink/anchor.ts +1 -1
- package/src/parser/inline/autolink/channel.ts +1 -1
- package/src/parser/inline/autolink/email.ts +1 -1
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.ts +1 -1
- package/src/parser/inline/bracket.test.ts +5 -1
- package/src/parser/inline/bracket.ts +3 -3
- package/src/parser/inline/code.ts +1 -1
- package/src/parser/inline/comment.ts +2 -2
- package/src/parser/inline/deletion.ts +1 -1
- package/src/parser/inline/emphasis.ts +1 -1
- package/src/parser/inline/emstrong.ts +1 -1
- package/src/parser/inline/extension/index.ts +1 -1
- package/src/parser/inline/extension/indexee.ts +1 -1
- package/src/parser/inline/extension/indexer.ts +1 -1
- package/src/parser/inline/extension/label.ts +1 -1
- package/src/parser/inline/extension/placeholder.ts +1 -1
- package/src/parser/inline/html.ts +1 -1
- package/src/parser/inline/htmlentity.ts +1 -1
- package/src/parser/inline/insertion.ts +1 -1
- package/src/parser/inline/link.ts +1 -1
- package/src/parser/inline/mark.ts +1 -1
- package/src/parser/inline/math.ts +1 -1
- package/src/parser/inline/media.ts +1 -1
- package/src/parser/inline/reference.ts +2 -2
- package/src/parser/inline/ruby.ts +1 -1
- package/src/parser/inline/strong.ts +1 -1
- package/src/parser/inline/template.ts +1 -1
- package/src/parser/inline.test.ts +4 -0
- package/src/parser/locale.ts +1 -1
- package/src/parser/processor/figure.test.ts +1 -1
- package/src/parser/processor/figure.ts +1 -1
- package/src/parser/processor/footnote.test.ts +1 -1
- package/src/parser/processor/footnote.ts +5 -4
- package/src/parser/source/text.ts +1 -1
- package/src/renderer/render/math.ts +1 -1
- package/src/renderer/render/media/audio.ts +1 -1
- package/src/renderer/render/media/image.ts +1 -1
- package/src/renderer/render/media/pdf.ts +1 -1
- package/src/renderer/render/media/twitter.ts +21 -23
- package/src/renderer/render/media/video.ts +1 -1
- package/src/renderer/render/media/youtube.ts +1 -1
- package/src/renderer/render/media.test.ts +1 -1
- package/src/util/quote.ts +1 -1
- package/src/util/toc.test.ts +1 -1
- package/src/util/toc.ts +1 -1
- package/src/util.ts +0 -1
- package/src/util/sync.ts +0 -57
package/src/util/sync.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { undefined, window, document } from 'spica/global';
|
|
2
|
-
import { abs, ceil, sign } from 'spica/alias';
|
|
3
|
-
import { aggregate } from 'spica/arrow';
|
|
4
|
-
import { clear } from 'spica/function';
|
|
5
|
-
import { bind, once } from 'typed-dom';
|
|
6
|
-
|
|
7
|
-
export function sync(
|
|
8
|
-
editor: HTMLElement,
|
|
9
|
-
viewer: HTMLElement,
|
|
10
|
-
bottom: Element | null = viewer.firstElementChild,
|
|
11
|
-
): () => void {
|
|
12
|
-
let hover = document.activeElement?.contains(editor) ?? true;
|
|
13
|
-
let scroll = editor.scrollTop;
|
|
14
|
-
return clear(aggregate(
|
|
15
|
-
once(viewer, 'mousemove', () => {
|
|
16
|
-
hover = false;
|
|
17
|
-
}, passive),
|
|
18
|
-
once(viewer, 'mousedown', () => {
|
|
19
|
-
hover = false;
|
|
20
|
-
}, passive),
|
|
21
|
-
once(viewer, 'wheel', () => {
|
|
22
|
-
hover = false;
|
|
23
|
-
}, passive),
|
|
24
|
-
bind(editor, 'input', () => {
|
|
25
|
-
hover = true;
|
|
26
|
-
}, passive),
|
|
27
|
-
bind(editor, 'keydown', () => {
|
|
28
|
-
hover = true;
|
|
29
|
-
}, passive),
|
|
30
|
-
bind(editor, 'mouseenter', () => {
|
|
31
|
-
hover = true;
|
|
32
|
-
}, passive),
|
|
33
|
-
bind(editor, 'mouseleave', () => {
|
|
34
|
-
hover = false;
|
|
35
|
-
}, passive),
|
|
36
|
-
bind(editor, 'scroll', () => {
|
|
37
|
-
if (!hover) return scroll = editor.scrollTop, undefined;
|
|
38
|
-
const delta = editor.scrollTop - scroll;
|
|
39
|
-
switch (scroll += delta) {
|
|
40
|
-
case 0:
|
|
41
|
-
return void viewer.scrollTo({ top: 0 });
|
|
42
|
-
default:
|
|
43
|
-
const last = bottom?.previousElementSibling as HTMLElement | null;
|
|
44
|
-
const viewer_scrollHeight = last
|
|
45
|
-
? last.offsetTop + last.offsetHeight + +window.getComputedStyle(last).marginBottom.slice(0, -2)
|
|
46
|
-
: viewer.scrollHeight;
|
|
47
|
-
return void viewer.scrollBy({
|
|
48
|
-
top: sign(delta) * ceil(
|
|
49
|
-
+ abs(delta)
|
|
50
|
-
* (viewer_scrollHeight - viewer.clientHeight)
|
|
51
|
-
/ (editor.scrollHeight - editor.clientHeight)),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}, passive)));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const passive = { passive: true };
|