@aionbuilders/nabu 0.1.0-alpha.9 → 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/CHANGELOG.md +523 -0
- package/LICENSE +21 -0
- package/README.md +82 -144
- package/dist/behaviors/text/RichText.svelte +25 -2
- package/dist/behaviors/text/index.d.ts +2 -0
- package/dist/behaviors/text/index.js +2 -0
- package/dist/behaviors/text/markdown-shortcuts.extension.d.ts +5 -0
- package/dist/behaviors/text/markdown-shortcuts.extension.js +79 -0
- package/dist/behaviors/text/markdown-syntax.d.ts +42 -0
- package/dist/behaviors/text/markdown-syntax.js +81 -0
- package/dist/behaviors/text/rich-text.extension.d.ts +3 -0
- package/dist/behaviors/text/rich-text.extension.js +135 -53
- package/dist/behaviors/text/text.behavior.svelte.d.ts +217 -42
- package/dist/behaviors/text/text.behavior.svelte.js +657 -55
- package/dist/behaviors/text/typography.extension.d.ts +7 -0
- package/dist/behaviors/text/typography.extension.js +25 -0
- package/dist/blocks/Block.svelte +5 -2
- package/dist/blocks/BlockList.svelte +48 -0
- package/dist/blocks/BlockList.svelte.d.ts +17 -0
- package/dist/blocks/Nabu.svelte +180 -14
- package/dist/blocks/Nabu.svelte.d.ts +13 -0
- package/dist/blocks/block.extension.d.ts +3 -0
- package/dist/blocks/block.extension.js +8 -9
- package/dist/blocks/block.svelte.d.ts +356 -68
- package/dist/blocks/block.svelte.js +388 -42
- package/dist/blocks/blockquote/Blockquote.svelte +39 -0
- package/dist/blocks/blockquote/Blockquote.svelte.d.ts +11 -0
- package/dist/blocks/blockquote/blockquote.extension.d.ts +4 -0
- package/dist/blocks/blockquote/blockquote.extension.js +80 -0
- package/dist/blocks/blockquote/blockquote.svelte.d.ts +63 -0
- package/dist/blocks/blockquote/blockquote.svelte.js +136 -0
- package/dist/blocks/blockquote/index.d.ts +3 -0
- package/dist/blocks/blockquote/index.js +3 -0
- package/dist/blocks/callout/Callout.svelte +67 -0
- package/dist/blocks/callout/Callout.svelte.d.ts +11 -0
- package/dist/blocks/callout/callout.extension.d.ts +4 -0
- package/dist/blocks/callout/callout.extension.js +84 -0
- package/dist/blocks/callout/callout.svelte.d.ts +80 -0
- package/dist/blocks/callout/callout.svelte.js +189 -0
- package/dist/blocks/callout/index.d.ts +3 -0
- package/dist/blocks/callout/index.js +3 -0
- package/dist/blocks/chunks.d.ts +49 -0
- package/dist/blocks/chunks.js +90 -0
- package/dist/blocks/code/Code.svelte +84 -0
- package/dist/blocks/code/Code.svelte.d.ts +11 -0
- package/dist/blocks/code/code.extension.d.ts +4 -0
- package/dist/blocks/code/code.extension.js +88 -0
- package/dist/blocks/code/code.svelte.d.ts +68 -0
- package/dist/blocks/code/code.svelte.js +245 -0
- package/dist/blocks/code/index.d.ts +3 -0
- package/dist/blocks/code/index.js +3 -0
- package/dist/blocks/container.utils.d.ts +85 -13
- package/dist/blocks/container.utils.js +338 -178
- package/dist/blocks/dialogue/Dialogue.svelte +8 -2
- package/dist/blocks/dialogue/dialogue.svelte.d.ts +36 -23
- package/dist/blocks/dialogue/dialogue.svelte.js +51 -45
- package/dist/blocks/dialogue/hooks/onBeforeInput.hook.d.ts +2 -2
- package/dist/blocks/dialogue/hooks/onBeforeInput.hook.js +6 -4
- package/dist/blocks/dialogue/index.d.ts +12 -1
- package/dist/blocks/dialogue/index.js +51 -35
- package/dist/blocks/divider/Divider.svelte +28 -0
- package/dist/blocks/divider/Divider.svelte.d.ts +11 -0
- package/dist/blocks/divider/divider.extension.d.ts +23 -0
- package/dist/blocks/divider/divider.extension.js +153 -0
- package/dist/blocks/divider/divider.svelte.d.ts +54 -0
- package/dist/blocks/divider/divider.svelte.js +89 -0
- package/dist/blocks/divider/index.d.ts +3 -0
- package/dist/blocks/divider/index.js +3 -0
- package/dist/blocks/file/File.svelte +56 -0
- package/dist/blocks/file/File.svelte.d.ts +11 -0
- package/dist/blocks/file/file.extension.d.ts +4 -0
- package/dist/blocks/file/file.extension.js +27 -0
- package/dist/blocks/file/file.svelte.d.ts +29 -0
- package/dist/blocks/file/file.svelte.js +77 -0
- package/dist/blocks/file/index.d.ts +3 -0
- package/dist/blocks/file/index.js +3 -0
- package/dist/blocks/heading/Heading.svelte +2 -1
- package/dist/blocks/heading/heading.svelte.d.ts +27 -34
- package/dist/blocks/heading/heading.svelte.js +72 -60
- package/dist/blocks/heading/hooks/onBeforeInput.hook.js +7 -5
- package/dist/blocks/heading/index.d.ts +2 -2
- package/dist/blocks/heading/index.js +33 -8
- package/dist/blocks/image/Image.svelte +41 -0
- package/dist/blocks/image/Image.svelte.d.ts +11 -0
- package/dist/blocks/image/image.extension.d.ts +5 -0
- package/dist/blocks/image/image.extension.js +34 -0
- package/dist/blocks/image/image.svelte.d.ts +61 -0
- package/dist/blocks/image/image.svelte.js +114 -0
- package/dist/blocks/image/index.d.ts +3 -0
- package/dist/blocks/image/index.js +3 -0
- package/dist/blocks/index.d.ts +11 -1
- package/dist/blocks/index.js +11 -1
- package/dist/blocks/list/List.svelte +9 -2
- package/dist/blocks/list/ListItem.svelte +44 -7
- package/dist/blocks/list/convert.d.ts +20 -0
- package/dist/blocks/list/convert.js +92 -0
- package/dist/blocks/list/hooks/onBeforeInput.hook.js +60 -26
- package/dist/blocks/list/html-flat.d.ts +78 -0
- package/dist/blocks/list/html-flat.js +244 -0
- package/dist/blocks/list/indent.d.ts +86 -0
- package/dist/blocks/list/indent.js +205 -0
- package/dist/blocks/list/index.d.ts +7 -3
- package/dist/blocks/list/index.js +43 -31
- package/dist/blocks/list/list-item.svelte.d.ts +43 -17
- package/dist/blocks/list/list-item.svelte.js +143 -93
- package/dist/blocks/list/list.behavior.svelte.d.ts +7 -4
- package/dist/blocks/list/list.behavior.svelte.js +10 -5
- package/dist/blocks/list/list.svelte.d.ts +101 -23
- package/dist/blocks/list/list.svelte.js +136 -114
- package/dist/blocks/list/markdown.d.ts +149 -0
- package/dist/blocks/list/markdown.js +442 -0
- package/dist/blocks/list/normalize.d.ts +11 -0
- package/dist/blocks/list/normalize.js +396 -0
- package/dist/blocks/list/paste.d.ts +45 -0
- package/dist/blocks/list/paste.js +242 -0
- package/dist/blocks/list/step-back.d.ts +24 -0
- package/dist/blocks/list/step-back.js +87 -0
- package/dist/blocks/list/to-list.d.ts +7 -0
- package/dist/blocks/list/to-list.js +44 -0
- package/dist/blocks/list/todos-toggle.d.ts +20 -0
- package/dist/blocks/list/todos-toggle.js +48 -0
- package/dist/blocks/list/todos.svelte.d.ts +35 -0
- package/dist/blocks/list/todos.svelte.js +76 -0
- package/dist/blocks/media/index.d.ts +2 -0
- package/dist/blocks/media/index.js +2 -0
- package/dist/blocks/media/markdown.d.ts +12 -0
- package/dist/blocks/media/markdown.js +26 -0
- package/dist/blocks/media/media-block.svelte.d.ts +107 -0
- package/dist/blocks/media/media-block.svelte.js +181 -0
- package/dist/blocks/media/media.helpers.d.ts +24 -0
- package/dist/blocks/media/media.helpers.js +88 -0
- package/dist/blocks/megablock.svelte.d.ts +50 -19
- package/dist/blocks/megablock.svelte.js +115 -74
- package/dist/blocks/move.d.ts +23 -0
- package/dist/blocks/move.js +92 -0
- package/dist/blocks/nabu.svelte.d.ts +846 -75
- package/dist/blocks/nabu.svelte.js +1990 -182
- package/dist/blocks/paragraph/Paragraph.svelte +1 -0
- package/dist/blocks/paragraph/index.d.ts +2 -2
- package/dist/blocks/paragraph/index.js +35 -16
- package/dist/blocks/paragraph/paragraph.svelte.d.ts +49 -35
- package/dist/blocks/paragraph/paragraph.svelte.js +81 -69
- package/dist/blocks/paragraph/table.html.d.ts +9 -0
- package/dist/blocks/paragraph/table.html.js +111 -0
- package/dist/blocks/paragraph/table.markdown.d.ts +32 -0
- package/dist/blocks/paragraph/table.markdown.js +90 -0
- package/dist/blocks/region/Region.svelte +264 -0
- package/dist/blocks/region/Region.svelte.d.ts +11 -0
- package/dist/blocks/region/actions.d.ts +135 -0
- package/dist/blocks/region/actions.js +402 -0
- package/dist/blocks/region/close.d.ts +35 -0
- package/dist/blocks/region/close.js +130 -0
- package/dist/blocks/region/commands.d.ts +6 -0
- package/dist/blocks/region/commands.js +277 -0
- package/dist/blocks/region/create.d.ts +72 -0
- package/dist/blocks/region/create.js +208 -0
- package/dist/blocks/region/end-marker.d.ts +35 -0
- package/dist/blocks/region/end-marker.js +51 -0
- package/dist/blocks/region/facts.d.ts +69 -0
- package/dist/blocks/region/facts.js +152 -0
- package/dist/blocks/region/format.d.ts +91 -0
- package/dist/blocks/region/format.js +260 -0
- package/dist/blocks/region/index.d.ts +14 -0
- package/dist/blocks/region/index.js +14 -0
- package/dist/blocks/region/insert.d.ts +59 -0
- package/dist/blocks/region/insert.js +102 -0
- package/dist/blocks/region/messages.d.ts +254 -0
- package/dist/blocks/region/messages.js +131 -0
- package/dist/blocks/region/normalize.d.ts +7 -0
- package/dist/blocks/region/normalize.js +170 -0
- package/dist/blocks/region/region.extension.d.ts +58 -0
- package/dist/blocks/region/region.extension.js +119 -0
- package/dist/blocks/region/region.svelte.d.ts +221 -0
- package/dist/blocks/region/region.svelte.js +582 -0
- package/dist/blocks/region/regions.svelte.d.ts +141 -0
- package/dist/blocks/region/regions.svelte.js +276 -0
- package/dist/blocks/region/serialize.d.ts +57 -0
- package/dist/blocks/region/serialize.js +112 -0
- package/dist/blocks/region/types.d.ts +255 -0
- package/dist/blocks/region/types.js +204 -0
- package/dist/blocks/selection.svelte.d.ts +106 -8
- package/dist/blocks/selection.svelte.js +632 -74
- package/dist/blocks/subthread.d.ts +80 -0
- package/dist/blocks/subthread.js +167 -0
- package/dist/blocks/text-block.svelte.d.ts +70 -0
- package/dist/blocks/text-block.svelte.js +108 -0
- package/dist/blocks/toggle/Toggle.svelte +73 -0
- package/dist/blocks/toggle/Toggle.svelte.d.ts +11 -0
- package/dist/blocks/toggle/index.d.ts +3 -0
- package/dist/blocks/toggle/index.js +3 -0
- package/dist/blocks/toggle/markdown.d.ts +20 -0
- package/dist/blocks/toggle/markdown.js +112 -0
- package/dist/blocks/toggle/toggle.extension.d.ts +4 -0
- package/dist/blocks/toggle/toggle.extension.js +18 -0
- package/dist/blocks/toggle/toggle.svelte.d.ts +135 -0
- package/dist/blocks/toggle/toggle.svelte.js +352 -0
- package/dist/blocks/undo-selection.d.ts +175 -0
- package/dist/blocks/undo-selection.js +360 -0
- package/dist/blocks/video/Video.svelte +42 -0
- package/dist/blocks/video/Video.svelte.d.ts +11 -0
- package/dist/blocks/video/index.d.ts +3 -0
- package/dist/blocks/video/index.js +3 -0
- package/dist/blocks/video/video.extension.d.ts +4 -0
- package/dist/blocks/video/video.extension.js +27 -0
- package/dist/blocks/video/video.svelte.d.ts +29 -0
- package/dist/blocks/video/video.svelte.js +80 -0
- package/dist/extend.d.ts +55 -0
- package/dist/extend.js +88 -0
- package/dist/files/assets.clipboard.d.ts +77 -0
- package/dist/files/assets.clipboard.js +152 -0
- package/dist/files/files.svelte.d.ts +363 -0
- package/dist/files/files.svelte.js +897 -0
- package/dist/files/index.d.ts +3 -0
- package/dist/files/index.js +3 -0
- package/dist/files/outbox.d.ts +69 -0
- package/dist/files/outbox.js +48 -0
- package/dist/files/status.d.ts +65 -0
- package/dist/files/status.js +87 -0
- package/dist/files/store.d.ts +97 -0
- package/dist/files/store.js +65 -0
- package/dist/files/uploads.svelte.d.ts +174 -0
- package/dist/files/uploads.svelte.js +504 -0
- package/dist/index.d.ts +68 -6
- package/dist/index.js +117 -7
- package/dist/nabu-theme.css +112 -0
- package/dist/paste/html.paste.d.ts +74 -3
- package/dist/paste/html.paste.js +555 -83
- package/dist/paste/markdown-inline.d.ts +86 -0
- package/dist/paste/markdown-inline.js +528 -0
- package/dist/paste/markdown.paste.d.ts +2 -8
- package/dist/paste/markdown.paste.js +78 -94
- package/dist/paste/nabu.paste.d.ts +3 -0
- package/dist/paste/nabu.paste.js +29 -3
- package/dist/paste/plain-text.paste.d.ts +2 -2
- package/dist/paste/plain-text.paste.js +3 -3
- package/dist/persistence/asset-store.d.ts +51 -0
- package/dist/persistence/asset-store.js +103 -0
- package/dist/persistence/autosave.d.ts +53 -0
- package/dist/persistence/autosave.js +62 -0
- package/dist/persistence/compact.d.ts +162 -0
- package/dist/persistence/compact.js +141 -0
- package/dist/persistence/history.d.ts +77 -0
- package/dist/persistence/history.js +176 -0
- package/dist/persistence/indexeddb.d.ts +190 -4
- package/dist/persistence/indexeddb.js +333 -29
- package/dist/persistence/merge.d.ts +38 -0
- package/dist/persistence/merge.js +36 -0
- package/dist/persistence/outbox.d.ts +25 -0
- package/dist/persistence/outbox.js +40 -0
- package/dist/persistence/persistence.d.ts +70 -9
- package/dist/persistence/persistence.js +507 -35
- package/dist/persistence/recovery.d.ts +79 -0
- package/dist/persistence/recovery.js +79 -0
- package/dist/persistence/release.d.ts +34 -0
- package/dist/persistence/release.js +64 -0
- package/dist/persistence/state.svelte.d.ts +53 -0
- package/dist/persistence/state.svelte.js +48 -0
- package/dist/persistence/sync.d.ts +39 -0
- package/dist/persistence/sync.js +138 -0
- package/dist/persistence/tail.d.ts +42 -0
- package/dist/persistence/tail.js +103 -0
- package/dist/presets.d.ts +29 -24
- package/dist/presets.js +51 -14
- package/dist/themes/atelier.css +318 -0
- package/dist/ui/CommandChooser.svelte +153 -0
- package/dist/ui/CommandChooser.svelte.d.ts +13 -0
- package/dist/ui/CommandInvite.svelte +99 -0
- package/dist/ui/CommandInvite.svelte.d.ts +12 -0
- package/dist/ui/DragHandle.svelte +217 -0
- package/dist/ui/DragHandle.svelte.d.ts +11 -0
- package/dist/ui/FloatingToolbar.svelte +165 -0
- package/dist/ui/FloatingToolbar.svelte.d.ts +27 -0
- package/dist/ui/SlashMenu.svelte +215 -0
- package/dist/ui/SlashMenu.svelte.d.ts +33 -0
- package/dist/ui/anchor.d.ts +112 -0
- package/dist/ui/anchor.js +136 -0
- package/dist/ui/index.d.ts +10 -0
- package/dist/ui/index.js +15 -0
- package/dist/ui/slash-menu.svelte.d.ts +112 -0
- package/dist/ui/slash-menu.svelte.js +150 -0
- package/dist/utils/command-confirm.svelte.d.ts +349 -0
- package/dist/utils/command-confirm.svelte.js +673 -0
- package/dist/utils/commands.d.ts +328 -0
- package/dist/utils/commands.js +416 -0
- package/dist/utils/dom-scope.d.ts +14 -0
- package/dist/utils/dom-scope.js +20 -0
- package/dist/utils/drop.d.ts +160 -0
- package/dist/utils/drop.js +305 -0
- package/dist/utils/extensions.d.ts +488 -40
- package/dist/utils/extensions.js +300 -19
- package/dist/utils/html.d.ts +44 -0
- package/dist/utils/html.js +183 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/keys.d.ts +120 -0
- package/dist/utils/keys.js +248 -0
- package/dist/utils/links.d.ts +22 -0
- package/dist/utils/links.js +34 -0
- package/dist/utils/placeholders.d.ts +88 -0
- package/dist/utils/placeholders.js +91 -0
- package/dist/utils/selection.svelte.d.ts +47 -19
- package/dist/utils/selection.svelte.js +60 -10
- package/dist/utils/spellcheck.d.ts +9 -0
- package/dist/utils/spellcheck.js +17 -0
- package/dist/utils/tab.d.ts +31 -0
- package/dist/utils/tab.js +117 -0
- package/dist/utils/words.d.ts +7 -0
- package/dist/utils/words.js +62 -0
- package/dist/vite.d.ts +22 -0
- package/dist/vite.js +34 -0
- package/package.json +61 -22
- package/dist/blocks/zone/Zone.svelte +0 -258
- package/dist/blocks/zone/Zone.svelte.d.ts +0 -11
- package/dist/blocks/zone/index.d.ts +0 -2
- package/dist/blocks/zone/index.js +0 -2
- package/dist/blocks/zone/zone.extension.d.ts +0 -2
- package/dist/blocks/zone/zone.extension.js +0 -221
- package/dist/blocks/zone/zone.svelte.d.ts +0 -112
- package/dist/blocks/zone/zone.svelte.js +0 -321
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import { MediaBlock } from "../media/media-block.svelte.js";
|
|
3
|
+
import { markdownMediaLink } from "../media/markdown.js";
|
|
4
|
+
import VideoComponent from "./Video.svelte";
|
|
5
|
+
import { escapeHtml, escapeAttr, sanitizeUrl } from "../../utils/html.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @import { Nabu, NabuNode } from "../nabu.svelte.js";
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Void video block. Extends MediaBlock for shared void/metadata behavior.
|
|
13
|
+
* Renders an inert <figure> with a <video> element.
|
|
14
|
+
*/
|
|
15
|
+
// @ts-ignore — static-side variance on create()
|
|
16
|
+
export class VideoBlock extends MediaBlock {
|
|
17
|
+
/** @param {Nabu} nabu @param {NabuNode} node */
|
|
18
|
+
constructor(nabu, node) {
|
|
19
|
+
super(nabu, node);
|
|
20
|
+
|
|
21
|
+
this.serializers.set('markdown', () => VideoBlock.toMarkdown({ type: 'video', partial: false, props: this.exportProps }));
|
|
22
|
+
this.serializers.set('json', () => ({
|
|
23
|
+
id: this.id,
|
|
24
|
+
type: 'video',
|
|
25
|
+
props: this.exportProps,
|
|
26
|
+
}));
|
|
27
|
+
this.serializers.set('application/x-nabu+json', () => ({
|
|
28
|
+
type: 'video',
|
|
29
|
+
props: { ref: this.ref, alt: this.alt, name: this.name, ...this.clipboardState },
|
|
30
|
+
partial: false,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
component = $derived(this.nabu.components.get("video") || VideoComponent);
|
|
35
|
+
|
|
36
|
+
// ── Statics ──────────────────────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
/** @param {import('../../utils/extensions.js').PasteBlock} pb */
|
|
39
|
+
static toMarkdown(pb) {
|
|
40
|
+
if (!pb.props?.ref) return pb.props?.alt || pb.props?.name || ''; // no source: the label only
|
|
41
|
+
return markdownMediaLink(pb.props?.alt || pb.props?.name || 'video', pb.props.ref);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @param {import('../../utils/extensions.js').PasteBlock} pb */
|
|
45
|
+
static toHtml(pb) {
|
|
46
|
+
const ref = pb.props?.ref || '';
|
|
47
|
+
const src = sanitizeUrl(ref, { kind: 'media' }); // null for an empty ref too
|
|
48
|
+
const label = pb.props?.alt || pb.props?.name || '';
|
|
49
|
+
if (src === null) return label ? '<p>' + escapeHtml(label) + '</p>' : ''; // no live <video> without a source
|
|
50
|
+
return '<video src="' + escapeAttr(src) + '" controls></video>';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static htmlRules = [
|
|
54
|
+
{ selector: 'video', embed: true },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {Element} el
|
|
59
|
+
* @returns {import('../../utils/extensions.js').PasteBlock | null}
|
|
60
|
+
*/
|
|
61
|
+
static fromHTML(el) {
|
|
62
|
+
const src = el.getAttribute('src') || el.querySelector('source')?.getAttribute('src') || '';
|
|
63
|
+
if (src && sanitizeUrl(src, { kind: 'media' }) === null) return null;
|
|
64
|
+
return {
|
|
65
|
+
type: 'video',
|
|
66
|
+
props: {
|
|
67
|
+
ref: src,
|
|
68
|
+
alt: '',
|
|
69
|
+
},
|
|
70
|
+
partial: false,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** @param {Nabu} nabu @param {string} type @param {Record<string, any>} [props={}] @param {string|null} [parentId=null] @param {number|null} [index=null] */
|
|
75
|
+
static create(nabu, type, props = {}, parentId = null, index = null) {
|
|
76
|
+
const node = MediaBlock.createNode(nabu, 'video', props, parentId, index);
|
|
77
|
+
const block = new VideoBlock(nabu, /** @type {any} */ (node));
|
|
78
|
+
return block;
|
|
79
|
+
}
|
|
80
|
+
}
|
package/dist/extend.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export { Block } from "./blocks/block.svelte.js";
|
|
2
|
+
export { TextBlock } from "./blocks/text-block.svelte.js";
|
|
3
|
+
export { MegaBlock } from "./blocks/megablock.svelte.js";
|
|
4
|
+
export { default as BlockComponent } from "./blocks/Block.svelte";
|
|
5
|
+
export { TextBehavior } from "./behaviors/text/index.js";
|
|
6
|
+
export { default as RichText } from "./behaviors/text/RichText.svelte";
|
|
7
|
+
/**
|
|
8
|
+
* A node of the document tree: `NabuNode<{ type: 'x', … }>`.
|
|
9
|
+
*/
|
|
10
|
+
export type NabuNode<T extends {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
} = Record<string, any>> = import("./blocks/nabu.svelte.js").NabuNode<T>;
|
|
13
|
+
export type ExtensionInit = import("./utils/extensions.js").ExtensionInit;
|
|
14
|
+
export type ExtensionHooks = import("./utils/extensions.js").ExtensionHooks;
|
|
15
|
+
/**
|
|
16
|
+
* What the `onSplit` hook receives: the caret offset and the tail of the text.
|
|
17
|
+
*/
|
|
18
|
+
export type SplitData = import("./utils/extensions.js").SplitData;
|
|
19
|
+
export type InputRule = import("./utils/extensions.js").InputRule;
|
|
20
|
+
export type PasteBlock = import("./utils/extensions.js").PasteBlock;
|
|
21
|
+
export type PasteFragment = import("./utils/extensions.js").PasteFragment;
|
|
22
|
+
export type PasteInterpreter = import("./utils/extensions.js").PasteInterpreter;
|
|
23
|
+
export type PasteInterpretOptions = import("./utils/extensions.js").PasteInterpretOptions;
|
|
24
|
+
export type PasteFileHandler = import("./utils/extensions.js").PasteFileHandler;
|
|
25
|
+
/**
|
|
26
|
+
* A rule of a block's `static htmlRules`.
|
|
27
|
+
*/
|
|
28
|
+
export type HtmlRule = import("./utils/extensions.js").HtmlRule;
|
|
29
|
+
/**
|
|
30
|
+
* What a block's `static fromHTML` receives.
|
|
31
|
+
*/
|
|
32
|
+
export type HtmlHelpers = import("./utils/extensions.js").HtmlHelpers;
|
|
33
|
+
/**
|
|
34
|
+
* A rule of a block's `static markdownRules`.
|
|
35
|
+
*/
|
|
36
|
+
export type MarkdownRule = import("./utils/extensions.js").MarkdownRule;
|
|
37
|
+
/**
|
|
38
|
+
* What a block's `static fromMarkdown` receives.
|
|
39
|
+
*/
|
|
40
|
+
export type MarkdownHelpers = import("./utils/extensions.js").MarkdownHelpers;
|
|
41
|
+
/**
|
|
42
|
+
* The second argument of a block's `static toMarkdown` / `toHtml`.
|
|
43
|
+
*/
|
|
44
|
+
export type SerializeContext = import("./utils/extensions.js").SerializeContext;
|
|
45
|
+
/**
|
|
46
|
+
* The shape of `nabu.internals`. UNSTABLE: may change in any minor version.
|
|
47
|
+
*/
|
|
48
|
+
export type NabuInternals = import("./blocks/nabu.svelte.js").NabuInternals;
|
|
49
|
+
export type CommandDef = import("./utils/commands.js").CommandDef;
|
|
50
|
+
export type CommandContext = import("./utils/commands.js").CommandContext;
|
|
51
|
+
export type Chord = import("./utils/keys.js").Chord;
|
|
52
|
+
export type Platform = import("./utils/keys.js").Platform;
|
|
53
|
+
export { extension, Extension } from "./utils/extensions.js";
|
|
54
|
+
export { parseChord, canonicalChord, chordId, eventChord, eventChordId, isReservedChord, RESERVED_CHORDS, hasCommandModifier, detectPlatform } from "./utils/keys.js";
|
|
55
|
+
export { escapeHtml, escapeAttr } from "./utils/html.js";
|
package/dist/extend.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @aionbuilders/nabu/extend
|
|
3
|
+
*
|
|
4
|
+
* Writing your own blocks and extensions: the `extension()` factory, the block base classes, the text behavior and the
|
|
5
|
+
* helpers a block needs (keyboard chords, HTML escaping). Mount-time pieces (editor, presets, built-in extensions) are in
|
|
6
|
+
* `@aionbuilders/nabu`.
|
|
7
|
+
*
|
|
8
|
+
* Stability (audit P-119): the members of `Nabu`, `Block`, `TextBlock`, `MegaBlock`, `TextBehavior`, the selection and the
|
|
9
|
+
* command registry tagged `@public` in their JSDoc are the stable contract of a third-party block or extension (pinned by
|
|
10
|
+
* `tests/unit/extend-contract.test.js`). `nabu.internals` exposes the rest of the machinery and is UNSTABLE: it may change in
|
|
11
|
+
* any minor version. See `docs/guides/extensions.md`, "Stability".
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import { extension, TextBlock, TextBehavior, RichText } from '@aionbuilders/nabu/extend';
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Extensions
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
export { extension, Extension } from './utils/extensions.js';
|
|
22
|
+
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Blocks
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
export { Block } from './blocks/block.svelte.js';
|
|
28
|
+
export { TextBlock } from './blocks/text-block.svelte.js';
|
|
29
|
+
export { MegaBlock } from './blocks/megablock.svelte.js';
|
|
30
|
+
export { default as BlockComponent } from './blocks/Block.svelte';
|
|
31
|
+
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Text behavior
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
export { TextBehavior } from './behaviors/text/index.js';
|
|
37
|
+
export { default as RichText } from './behaviors/text/RichText.svelte';
|
|
38
|
+
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Keyboard chords (command `keys`)
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
parseChord,
|
|
45
|
+
canonicalChord,
|
|
46
|
+
chordId,
|
|
47
|
+
eventChord,
|
|
48
|
+
eventChordId,
|
|
49
|
+
isReservedChord,
|
|
50
|
+
RESERVED_CHORDS,
|
|
51
|
+
hasCommandModifier,
|
|
52
|
+
detectPlatform,
|
|
53
|
+
} from './utils/keys.js';
|
|
54
|
+
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// HTML escaping (serializers)
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
export { escapeHtml, escapeAttr } from './utils/html.js';
|
|
60
|
+
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Types
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A node of the document tree: `NabuNode<{ type: 'x', … }>`.
|
|
67
|
+
* @template {Object<string, any>} [T=Record<string, any>]
|
|
68
|
+
* @typedef {import('./blocks/nabu.svelte.js').NabuNode<T>} NabuNode
|
|
69
|
+
*/
|
|
70
|
+
/** @typedef {import('./utils/extensions.js').ExtensionInit} ExtensionInit */
|
|
71
|
+
/** @typedef {import('./utils/extensions.js').ExtensionHooks} ExtensionHooks */
|
|
72
|
+
/** @typedef {import('./utils/extensions.js').SplitData} SplitData What the `onSplit` hook receives: the caret offset and the tail of the text. */
|
|
73
|
+
/** @typedef {import('./utils/extensions.js').InputRule} InputRule */
|
|
74
|
+
/** @typedef {import('./utils/extensions.js').PasteBlock} PasteBlock */
|
|
75
|
+
/** @typedef {import('./utils/extensions.js').PasteFragment} PasteFragment */
|
|
76
|
+
/** @typedef {import('./utils/extensions.js').PasteInterpreter} PasteInterpreter */
|
|
77
|
+
/** @typedef {import('./utils/extensions.js').PasteInterpretOptions} PasteInterpretOptions */
|
|
78
|
+
/** @typedef {import('./utils/extensions.js').PasteFileHandler} PasteFileHandler */
|
|
79
|
+
/** @typedef {import('./utils/extensions.js').HtmlRule} HtmlRule A rule of a block's `static htmlRules`. */
|
|
80
|
+
/** @typedef {import('./utils/extensions.js').HtmlHelpers} HtmlHelpers What a block's `static fromHTML` receives. */
|
|
81
|
+
/** @typedef {import('./utils/extensions.js').MarkdownRule} MarkdownRule A rule of a block's `static markdownRules`. */
|
|
82
|
+
/** @typedef {import('./utils/extensions.js').MarkdownHelpers} MarkdownHelpers What a block's `static fromMarkdown` receives. */
|
|
83
|
+
/** @typedef {import('./utils/extensions.js').SerializeContext} SerializeContext The second argument of a block's `static toMarkdown` / `toHtml`. */
|
|
84
|
+
/** @typedef {import('./blocks/nabu.svelte.js').NabuInternals} NabuInternals The shape of `nabu.internals`. UNSTABLE: may change in any minor version. */
|
|
85
|
+
/** @typedef {import('./utils/commands.js').CommandDef} CommandDef */
|
|
86
|
+
/** @typedef {import('./utils/commands.js').CommandContext} CommandContext */
|
|
87
|
+
/** @typedef {import('./utils/keys.js').Chord} Chord */
|
|
88
|
+
/** @typedef {import('./utils/keys.js').Platform} Platform */
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asset id of a `nabu-asset:` ref, or `null` for any other value.
|
|
3
|
+
* @param {unknown} ref
|
|
4
|
+
* @returns {string | null}
|
|
5
|
+
*/
|
|
6
|
+
export function assetIdOf(ref: unknown): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Whether `id` (the part after `nabu-asset:`) is a content hash.
|
|
9
|
+
* @param {unknown} id
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
export function isHashId(id: unknown): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* SHA-256 of `bytes` as an asset id: `sha256-<64 hex>` (ADR 014 §3.1).
|
|
15
|
+
* @param {BufferSource} bytes
|
|
16
|
+
* @returns {Promise<string>}
|
|
17
|
+
*/
|
|
18
|
+
export function sha256Id(bytes: BufferSource): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Walk PasteBlocks (children included) and call `fn(block, assetId)` for every block whose `props.ref` is a
|
|
21
|
+
* `nabu-asset:` ref. `fn` returns a props PATCH (merged into a COPY of the block) or nothing. Never mutates the input;
|
|
22
|
+
* returns the same array when nothing changed.
|
|
23
|
+
* @template {{ props?: Record<string, any>, children?: any[] }} B
|
|
24
|
+
* @param {B[]} blocks
|
|
25
|
+
* @param {(block: B, id: string) => Record<string, any> | null | undefined | void} fn
|
|
26
|
+
* @returns {B[]}
|
|
27
|
+
*/
|
|
28
|
+
export function mapAssetBlocks<B extends {
|
|
29
|
+
props?: Record<string, any>;
|
|
30
|
+
children?: any[];
|
|
31
|
+
}>(blocks: B[], fn: (block: B, id: string) => Record<string, any> | null | undefined | void): B[];
|
|
32
|
+
/**
|
|
33
|
+
* Walk PasteBlocks (children included) and call `fn(block, url)` for every block whose `props.ref` is an absolute
|
|
34
|
+
* `http(s)` URL (a remote file). `fn` returns a props PATCH or nothing. Same contract as {@link mapAssetBlocks}.
|
|
35
|
+
* @template {{ props?: Record<string, any>, children?: any[] }} B
|
|
36
|
+
* @param {B[]} blocks
|
|
37
|
+
* @param {(block: B, url: string) => Record<string, any> | null | undefined | void} fn
|
|
38
|
+
* @returns {B[]}
|
|
39
|
+
*/
|
|
40
|
+
export function mapRemoteBlocks<B extends {
|
|
41
|
+
props?: Record<string, any>;
|
|
42
|
+
children?: any[];
|
|
43
|
+
}>(blocks: B[], fn: (block: B, url: string) => Record<string, any> | null | undefined | void): B[];
|
|
44
|
+
/**
|
|
45
|
+
* A file name for a remote URL: the last segment of its path, or `file` + the extension of its type.
|
|
46
|
+
* @param {string} url
|
|
47
|
+
* @param {string} [mime]
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
export function remoteFileName(url: string, mime?: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Ids of the assets referenced by PasteBlocks (children included), in order of appearance, deduplicated.
|
|
53
|
+
* @param {any[]} blocks
|
|
54
|
+
* @returns {string[]}
|
|
55
|
+
*/
|
|
56
|
+
export function collectAssetIds(blocks: any[]): string[];
|
|
57
|
+
/**
|
|
58
|
+
* @param {Uint8Array} bytes
|
|
59
|
+
* @returns {string}
|
|
60
|
+
*/
|
|
61
|
+
export function bytesToBase64(bytes: Uint8Array): string;
|
|
62
|
+
/**
|
|
63
|
+
* @param {string} b64
|
|
64
|
+
* @returns {Uint8Array | null} `null` when the string is not valid base64
|
|
65
|
+
*/
|
|
66
|
+
export function base64ToBytes(b64: string): Uint8Array | null;
|
|
67
|
+
/**
|
|
68
|
+
* Pure helpers for moving `nabu-asset:` media through the clipboard (P-51): walking the PasteBlocks that reference
|
|
69
|
+
* an asset, content hashing (ADR 014) and base64 for the bytes carried in `application/x-nabu+json`. No document
|
|
70
|
+
* access here — `Files` (files.svelte.js) does that.
|
|
71
|
+
*/
|
|
72
|
+
/** Scheme of the refs that point to a file held by the asset store: `nabu-asset:sha256-<hex>` (ADR 014), or `nabu-asset:<uuid>` (beta). */
|
|
73
|
+
export const ASSET_PREFIX: "nabu-asset:";
|
|
74
|
+
/** An asset id that is a content hash (what follows `nabu-asset:`). Anything else after the scheme is a legacy beta uuid. */
|
|
75
|
+
export const HASH_ID_RE: RegExp;
|
|
76
|
+
/** Scheme of a ref whose bytes are being re-created in this document (local, transient — see Files#adopt). */
|
|
77
|
+
export const PENDING_PREFIX: "nabu-pending:";
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for moving `nabu-asset:` media through the clipboard (P-51): walking the PasteBlocks that reference
|
|
3
|
+
* an asset, content hashing (ADR 014) and base64 for the bytes carried in `application/x-nabu+json`. No document
|
|
4
|
+
* access here — `Files` (files.svelte.js) does that.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Scheme of the refs that point to a file held by the asset store: `nabu-asset:sha256-<hex>` (ADR 014), or `nabu-asset:<uuid>` (beta). */
|
|
8
|
+
export const ASSET_PREFIX = 'nabu-asset:';
|
|
9
|
+
/** An asset id that is a content hash (what follows `nabu-asset:`). Anything else after the scheme is a legacy beta uuid. */
|
|
10
|
+
export const HASH_ID_RE = /^sha256-[0-9a-f]{64}$/;
|
|
11
|
+
/** Scheme of a ref whose bytes are being re-created in this document (local, transient — see Files#adopt). */
|
|
12
|
+
export const PENDING_PREFIX = 'nabu-pending:';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Asset id of a `nabu-asset:` ref, or `null` for any other value.
|
|
16
|
+
* @param {unknown} ref
|
|
17
|
+
* @returns {string | null}
|
|
18
|
+
*/
|
|
19
|
+
export function assetIdOf(ref) {
|
|
20
|
+
return typeof ref === 'string' && ref.startsWith(ASSET_PREFIX) && ref.length > ASSET_PREFIX.length ? ref.slice(ASSET_PREFIX.length) : null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Whether `id` (the part after `nabu-asset:`) is a content hash.
|
|
25
|
+
* @param {unknown} id
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
export function isHashId(id) {
|
|
29
|
+
return typeof id === 'string' && HASH_ID_RE.test(id);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* SHA-256 of `bytes` as an asset id: `sha256-<64 hex>` (ADR 014 §3.1).
|
|
34
|
+
* @param {BufferSource} bytes
|
|
35
|
+
* @returns {Promise<string>}
|
|
36
|
+
*/
|
|
37
|
+
export async function sha256Id(bytes) {
|
|
38
|
+
const digest = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', bytes));
|
|
39
|
+
let hex = '';
|
|
40
|
+
for (const byte of digest) hex += byte.toString(16).padStart(2, '0');
|
|
41
|
+
return 'sha256-' + hex;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Walk PasteBlocks (children included) and call `fn(block, assetId)` for every block whose `props.ref` is a
|
|
46
|
+
* `nabu-asset:` ref. `fn` returns a props PATCH (merged into a COPY of the block) or nothing. Never mutates the input;
|
|
47
|
+
* returns the same array when nothing changed.
|
|
48
|
+
* @template {{ props?: Record<string, any>, children?: any[] }} B
|
|
49
|
+
* @param {B[]} blocks
|
|
50
|
+
* @param {(block: B, id: string) => Record<string, any> | null | undefined | void} fn
|
|
51
|
+
* @returns {B[]}
|
|
52
|
+
*/
|
|
53
|
+
export function mapAssetBlocks(blocks, fn) {
|
|
54
|
+
if (!Array.isArray(blocks)) return blocks;
|
|
55
|
+
let changed = false;
|
|
56
|
+
const out = blocks.map((pb) => {
|
|
57
|
+
if (!pb || typeof pb !== 'object') return pb;
|
|
58
|
+
let next = pb;
|
|
59
|
+
const id = assetIdOf(pb.props?.ref);
|
|
60
|
+
if (id !== null) {
|
|
61
|
+
const patch = fn(pb, id);
|
|
62
|
+
if (patch) next = { ...next, props: { ...pb.props, ...patch } };
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(pb.children) && pb.children.length) {
|
|
65
|
+
const children = mapAssetBlocks(pb.children, fn);
|
|
66
|
+
if (children !== pb.children) next = { ...next, children };
|
|
67
|
+
}
|
|
68
|
+
if (next !== pb) changed = true;
|
|
69
|
+
return next;
|
|
70
|
+
});
|
|
71
|
+
return changed ? out : blocks;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Walk PasteBlocks (children included) and call `fn(block, url)` for every block whose `props.ref` is an absolute
|
|
76
|
+
* `http(s)` URL (a remote file). `fn` returns a props PATCH or nothing. Same contract as {@link mapAssetBlocks}.
|
|
77
|
+
* @template {{ props?: Record<string, any>, children?: any[] }} B
|
|
78
|
+
* @param {B[]} blocks
|
|
79
|
+
* @param {(block: B, url: string) => Record<string, any> | null | undefined | void} fn
|
|
80
|
+
* @returns {B[]}
|
|
81
|
+
*/
|
|
82
|
+
export function mapRemoteBlocks(blocks, fn) {
|
|
83
|
+
if (!Array.isArray(blocks)) return blocks;
|
|
84
|
+
let changed = false;
|
|
85
|
+
const out = blocks.map((pb) => {
|
|
86
|
+
if (!pb || typeof pb !== 'object') return pb;
|
|
87
|
+
let next = pb;
|
|
88
|
+
const ref = pb.props?.ref;
|
|
89
|
+
if (typeof ref === 'string' && /^https?:\/\//i.test(ref.trim())) {
|
|
90
|
+
const patch = fn(pb, ref.trim());
|
|
91
|
+
if (patch) next = { ...next, props: { ...pb.props, ...patch } };
|
|
92
|
+
}
|
|
93
|
+
if (Array.isArray(pb.children) && pb.children.length) {
|
|
94
|
+
const children = mapRemoteBlocks(pb.children, fn);
|
|
95
|
+
if (children !== pb.children) next = { ...next, children };
|
|
96
|
+
}
|
|
97
|
+
if (next !== pb) changed = true;
|
|
98
|
+
return next;
|
|
99
|
+
});
|
|
100
|
+
return changed ? out : blocks;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A file name for a remote URL: the last segment of its path, or `file` + the extension of its type.
|
|
105
|
+
* @param {string} url
|
|
106
|
+
* @param {string} [mime]
|
|
107
|
+
* @returns {string}
|
|
108
|
+
*/
|
|
109
|
+
export function remoteFileName(url, mime = '') {
|
|
110
|
+
let name = '';
|
|
111
|
+
try { name = decodeURIComponent(new URL(url).pathname.split('/').filter(Boolean).pop() ?? ''); } catch { /* keep '' */ }
|
|
112
|
+
if (name) return name;
|
|
113
|
+
const ext = /^[a-z]+\/([a-z0-9.+-]+)/i.exec(mime)?.[1]?.replace('svg+xml', 'svg').replace('jpeg', 'jpg');
|
|
114
|
+
return ext ? 'file.' + ext : 'file';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Ids of the assets referenced by PasteBlocks (children included), in order of appearance, deduplicated.
|
|
119
|
+
* @param {any[]} blocks
|
|
120
|
+
* @returns {string[]}
|
|
121
|
+
*/
|
|
122
|
+
export function collectAssetIds(blocks) {
|
|
123
|
+
/** @type {Set<string>} */
|
|
124
|
+
const ids = new Set();
|
|
125
|
+
mapAssetBlocks(blocks, (_pb, id) => { ids.add(id); });
|
|
126
|
+
return [...ids];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @param {Uint8Array} bytes
|
|
131
|
+
* @returns {string}
|
|
132
|
+
*/
|
|
133
|
+
export function bytesToBase64(bytes) {
|
|
134
|
+
let binary = '';
|
|
135
|
+
for (let i = 0; i < bytes.length; i += 0x8000) binary += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
|
|
136
|
+
return btoa(binary);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @param {string} b64
|
|
141
|
+
* @returns {Uint8Array | null} `null` when the string is not valid base64
|
|
142
|
+
*/
|
|
143
|
+
export function base64ToBytes(b64) {
|
|
144
|
+
try {
|
|
145
|
+
const binary = atob(b64);
|
|
146
|
+
const bytes = new Uint8Array(binary.length);
|
|
147
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
148
|
+
return bytes;
|
|
149
|
+
} catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|