@mdsvex/parse 1.0.0-next.0 → 1.0.0-next.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/CHANGELOG.md +213 -0
- package/WIRE_FORMAT.md +5 -1
- package/dist/buf-utils.js +23 -23
- package/dist/buf_utils.d.ts +1 -1
- package/dist/cursor.d.ts +17 -13
- package/dist/cursor.js +118 -31
- package/dist/main.d.ts +362 -26
- package/dist/main.js +5841 -3420
- package/dist/node_view-bvM0i0-p.js +407 -0
- package/dist/node_view.d.ts +11 -12
- package/dist/opcodes.d.ts +23 -6
- package/dist/plugin_dispatch.d.ts +22 -8
- package/dist/tree-builder.js +185 -66
- package/dist/tree_builder.d.ts +42 -11
- package/dist/undo_log.d.ts +11 -1
- package/dist/utils.d.ts +77 -51
- package/dist/utils.js +687 -209
- package/dist/wire-tree-builder.js +69 -71
- package/dist/wire_tree_builder.d.ts +4 -7
- package/package.json +1 -1
- package/src/buf_utils.ts +10 -14
- package/src/cursor.ts +74 -57
- package/src/main.ts +9898 -5593
- package/src/node_view.ts +159 -140
- package/src/opcodes.ts +39 -7
- package/src/plugin_dispatch.ts +328 -219
- package/src/tree_builder.ts +278 -98
- package/src/undo_log.ts +58 -24
- package/src/utils.spec.ts +86 -9
- package/src/utils.ts +769 -392
- package/src/wire_emitter.ts +6 -0
- package/src/wire_tree_builder.ts +39 -52
- package/test/block_quotes.spec.ts +78 -7
- package/test/code_spans.spec.ts +158 -6
- package/test/crlf.spec.ts +49 -1
- package/test/directives.spec.ts +530 -1
- package/test/emphasis.spec.ts +10 -4
- package/test/fixtures/pfm/block_quotes/pfm_fence_close.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_compact.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_end_quote.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_info.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_longer.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_nested.md +3 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_twice.md +6 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_info_eof.md +1 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_unclosed.md +2 -0
- package/test/fixtures/pfm/code_spans/pfm_328_5.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_6.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_7.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_8.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_9.md +2 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof.md +1 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof_no_lf.md +1 -0
- package/test/fixtures/pfm/generic_directives/106.md +1 -0
- package/test/fixtures/pfm/generic_directives/107.md +3 -0
- package/test/fixtures/pfm/generic_directives/108.md +1 -0
- package/test/fixtures/pfm/generic_directives/109.md +1 -0
- package/test/fixtures/pfm/generic_directives/110.md +1 -0
- package/test/fixtures/pfm/generic_directives/111.md +1 -0
- package/test/fixtures/pfm/generic_directives/112.md +1 -0
- package/test/fixtures/pfm/generic_directives/113.md +1 -0
- package/test/fixtures/pfm/generic_directives/114.md +2 -0
- package/test/fixtures/pfm/generic_directives/115.md +1 -0
- package/test/fixtures/pfm/generic_directives/116.md +6 -0
- package/test/fixtures/pfm/generic_directives/117.md +3 -0
- package/test/fixtures/pfm/generic_directives/118.md +6 -0
- package/test/fixtures/pfm/generic_directives/119.md +3 -0
- package/test/fixtures/pfm/generic_directives/120.md +5 -0
- package/test/fixtures/pfm/generic_directives/121.md +3 -0
- package/test/fixtures/pfm/generic_directives/122.md +4 -0
- package/test/fixtures/pfm/generic_directives/123.md +2 -0
- package/test/html.spec.ts +44 -1
- package/test/html_block_containers.spec.ts +445 -0
- package/test/incremental.spec.ts +271 -0
- package/test/lists.spec.ts +107 -1
- package/test/parser_reuse.spec.ts +40 -0
- package/test/plugins.spec.ts +196 -226
- package/test/print.ts +2 -3
- package/test/run_bytecode.spec.ts +36 -0
- package/test/snapshots/hybrid/component-children.snap.ast +9 -16
- package/test/snapshots/hybrid/component-simple-00.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-01.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-03.snap.ast +13 -13
- package/test/snapshots/hybrid/component-simple-04.snap.ast +1 -2
- package/test/snapshots/hybrid/error.snap.ast +1 -2
- package/test/snapshots/markdown/blockquote-nested-markdown.snap.ast +2 -1
- package/test/snapshots/markdown/emphasis.snap.ast +2 -2
- package/test/snapshots/markdown/encodeHTMLCodeTags.snap.ast +1 -2
- package/test/snapshots/markdown/github-style-codeblock-inside-quote.snap.ast +8 -1
- package/test/snapshots/markdown/html-comments.snap.ast +11 -13
- package/test/snapshots/markdown/html5-strutural-tags.snap.ast +16 -31
- package/test/snapshots/markdown/line-starts-with-html.snap.ast +5 -6
- package/test/snapshots/markdown/literal-html-tags.snap.ast +11 -14
- package/test/snapshots/markdown/nested-blockquote.snap.ast +3 -3
- package/test/snapshots/markdown/pre-code-tags.snap.ast +5 -8
- package/test/snapshots/pfm/block_quotes/237.snap.ast +1 -2
- package/test/snapshots/pfm/block_quotes/251.snap.ast +5 -5
- package/test/snapshots/pfm/block_quotes/pfm_fence_close.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_compact.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_end_quote.snap.ast +8 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_info.snap.ast +4 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_longer.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_nested.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_twice.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_info_eof.snap.ast +3 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_unclosed.snap.ast +3 -0
- package/test/snapshots/pfm/code_spans/344.snap.ast +1 -1
- package/test/snapshots/pfm/code_spans/347.snap.ast +1 -2
- package/test/snapshots/pfm/code_spans/pfm_328_5.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_6.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_7.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_8.snap.ast +8 -0
- package/test/snapshots/pfm/code_spans/pfm_328_9.snap.ast +10 -0
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/417.snap.ast +2 -2
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/438.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/441.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/444.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/445.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/450.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/453.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/456.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/457.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/473.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/475.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/476.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/477.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/478.snap.ast +3 -4
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/479.snap.ast +3 -4
- package/test/snapshots/pfm/fenced_code_blocks/126.snap.ast +1 -2
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof.snap.ast +2 -0
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof_no_lf.snap.ast +2 -0
- package/test/snapshots/pfm/generic_directives/011.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/015.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/016.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/017.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/019.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/020.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/030.snap.ast +4 -6
- package/test/snapshots/pfm/generic_directives/034.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/036.snap.ast +5 -1
- package/test/snapshots/pfm/generic_directives/038.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/039.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/040.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/044.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/046.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/089.snap.ast +1 -1
- package/test/snapshots/pfm/generic_directives/103.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/106.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/107.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/108.snap.ast +5 -0
- package/test/snapshots/pfm/generic_directives/109.snap.ast +4 -0
- package/test/snapshots/pfm/generic_directives/110.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/111.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/112.snap.ast +18 -0
- package/test/snapshots/pfm/generic_directives/113.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/114.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/115.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/116.snap.ast +13 -0
- package/test/snapshots/pfm/generic_directives/117.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/118.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/119.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/120.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/121.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/122.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/123.snap.ast +3 -0
- package/test/snapshots/pfm/hard_line_breaks/642.snap.ast +1 -1
- package/test/snapshots/pfm/hard_line_breaks/643.snap.ast +1 -1
- package/test/snapshots/pfm/html/148.snap.ast +1 -1
- package/test/snapshots/pfm/html/150.snap.ast +1 -1
- package/test/snapshots/pfm/html/159.snap.ast +2 -3
- package/test/snapshots/pfm/html/162.snap.ast +3 -4
- package/test/snapshots/pfm/html/163.snap.ast +1 -1
- package/test/snapshots/pfm/html/164.snap.ast +3 -4
- package/test/snapshots/pfm/html/166.snap.ast +1 -1
- package/test/snapshots/pfm/html/168.snap.ast +2 -3
- package/test/snapshots/pfm/html/169.snap.ast +5 -7
- package/test/snapshots/pfm/html/174.snap.ast +3 -3
- package/test/snapshots/pfm/html/182.snap.ast +1 -1
- package/test/snapshots/pfm/html/613.snap.ast +2 -2
- package/test/snapshots/pfm/html/615.snap.ast +2 -2
- package/test/snapshots/pfm/images/585.snap.ast +1 -1
- package/test/snapshots/pfm/images/589.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/201.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/208.snap.ast +1 -1
- package/test/snapshots/pfm/links/491.snap.ast +1 -1
- package/test/snapshots/pfm/links/494.snap.ast +2 -2
- package/test/snapshots/pfm/links/516.snap.ast +8 -9
- package/test/snapshots/pfm/links/521.snap.ast +1 -1
- package/test/snapshots/pfm/links/530.snap.ast +8 -12
- package/test/snapshots/pfm/links/534.snap.ast +1 -1
- package/test/snapshots/pfm/links/552.snap.ast +2 -2
- package/test/snapshots/pfm/links/559.snap.ast +1 -1
- package/test/snapshots/pfm/links/564.snap.ast +1 -1
- package/test/snapshots/pfm/list_items/260.snap.ast +3 -4
- package/test/snapshots/pfm/list_items/293.snap.ast +2 -2
- package/test/snapshots/pfm/tabs/16.snap.ast +2 -3
- package/test/snapshots/pfm/tabs/4.snap.ast +6 -5
- package/test/snapshots/svelte/00-introduction/00-hello-world/App.snap.ast +3 -4
- package/test/snapshots/svelte/00-introduction/02-styling/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/Nested.snap.ast +1 -2
- package/test/snapshots/svelte/00-introduction/04-html-tags/App.snap.ast +1 -2
- package/test/snapshots/svelte/01-reactivity/00-reactive-assignments/App.snap.ast +5 -6
- package/test/snapshots/svelte/01-reactivity/01-reactive-declarations/App.snap.ast +11 -14
- package/test/snapshots/svelte/01-reactivity/02-reactive-statements/App.snap.ast +5 -6
- package/test/snapshots/svelte/02-props/00-declaring-props/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/01-default-values/App.snap.ast +1 -1
- package/test/snapshots/svelte/02-props/01-default-values/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/02-spread-props/Info.snap.ast +16 -17
- package/test/snapshots/svelte/03-logic/00-if-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/01-else-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/02-else-if-blocks/App.snap.ast +6 -9
- package/test/snapshots/svelte/03-logic/03-each-blocks/App.snap.ast +5 -8
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/App.snap.ast +4 -7
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/Thing.snap.ast +4 -5
- package/test/snapshots/svelte/04-events/02-event-modifiers/App.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/03-component-events/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/04-event-forwarding/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/05-dom-event-forwarding/FancyButton.snap.ast +2 -3
- package/test/snapshots/svelte/05-bindings/00-text-inputs/App.snap.ast +3 -4
- package/test/snapshots/svelte/05-bindings/01-numeric-inputs/App.snap.ast +9 -8
- package/test/snapshots/svelte/05-bindings/02-checkbox-inputs/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/03-group-inputs/App.snap.ast +21 -30
- package/test/snapshots/svelte/05-bindings/04-textarea-inputs/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/05-select-bindings/App.snap.ast +5 -9
- package/test/snapshots/svelte/05-bindings/06-multiple-select-bindings/App.snap.ast +18 -26
- package/test/snapshots/svelte/05-bindings/07-each-block-bindings/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/08-media-elements/App.snap.ast +15 -19
- package/test/snapshots/svelte/05-bindings/09-dimensions/App.snap.ast +7 -9
- package/test/snapshots/svelte/05-bindings/11-component-bindings/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/11-component-bindings/Keypad.snap.ast +32 -34
- package/test/snapshots/svelte/06-lifecycle/00-onmount/App.snap.ast +3 -6
- package/test/snapshots/svelte/06-lifecycle/01-ondestroy/App.snap.ast +6 -7
- package/test/snapshots/svelte/06-lifecycle/02-update/App.snap.ast +2 -4
- package/test/snapshots/svelte/07-stores/00-writable-stores/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/00-writable-stores/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/02-readable-stores/App.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/03-derived-stores/App.snap.ast +8 -10
- package/test/snapshots/svelte/07-stores/04-custom-stores/App.snap.ast +7 -11
- package/test/snapshots/svelte/08-motion/00-tweened/App.snap.ast +10 -15
- package/test/snapshots/svelte/08-motion/01-spring/App.snap.ast +10 -10
- package/test/snapshots/svelte/09-transitions/00-transition/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/01-adding-parameters-to-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/02-in-and-out/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/03-custom-css-transitions/App.snap.ast +4 -6
- package/test/snapshots/svelte/09-transitions/04-custom-js-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/05-transition-events/App.snap.ast +5 -8
- package/test/snapshots/svelte/10-animations/00-animate/App.snap.ast +16 -20
- package/test/snapshots/svelte/11-easing/00-easing/App.snap.ast +16 -11
- package/test/snapshots/svelte/11-easing/00-easing/Controls.snap.ast +11 -16
- package/test/snapshots/svelte/11-easing/00-easing/Grid.snap.ast +2 -2
- package/test/snapshots/svelte/12-svg/01-clock/App.snap.ast +2 -1
- package/test/snapshots/svelte/12-svg/02-bar-chart/App.snap.ast +7 -9
- package/test/snapshots/svelte/12-svg/03-area-chart/App.snap.ast +14 -15
- package/test/snapshots/svelte/12-svg/04-scatterplot/App.snap.ast +7 -5
- package/test/snapshots/svelte/12-svg/04-scatterplot/Scatterplot.snap.ast +6 -6
- package/test/snapshots/svelte/12-svg/05-svg-transitions/App.snap.ast +5 -6
- package/test/snapshots/svelte/13-actions/01-adding-parameters-to-actions/App.snap.ast +2 -3
- package/test/snapshots/svelte/14-classes/00-classes/App.snap.ast +3 -6
- package/test/snapshots/svelte/14-classes/01-class-shorthand/App.snap.ast +2 -3
- package/test/snapshots/svelte/15-composition/00-slots/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/Box.snap.ast +1 -2
- package/test/snapshots/svelte/15-composition/02-named-slots/App.snap.ast +7 -11
- package/test/snapshots/svelte/15-composition/02-named-slots/ContactCard.snap.ast +3 -6
- package/test/snapshots/svelte/15-composition/03-slot-props/App.snap.ast +9 -15
- package/test/snapshots/svelte/15-composition/04-modal/App.snap.ast +17 -26
- package/test/snapshots/svelte/15-composition/04-modal/Modal.snap.ast +3 -3
- package/test/snapshots/svelte/16-context/00-context-api/App.snap.ast +10 -5
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/File.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/Folder.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/App.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/BlueThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/GreenThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/RedThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/02-svelte-window/App.snap.ast +3 -6
- package/test/snapshots/svelte/17-special-elements/03-svelte-window-bindings/App.snap.ast +2 -4
- package/test/snapshots/svelte/17-special-elements/05-svelte-head/App.snap.ast +6 -12
- package/test/snapshots/svelte/18-module-context/01-module-exports/App.snap.ast +2 -3
- package/test/snapshots/svelte/18-module-context/01-module-exports/AudioPlayer.snap.ast +4 -7
- package/test/snapshots/svelte/19-debugging/00-debug/App.snap.ast +5 -7
- package/test/snapshots/svelte/19-debugging/00-debug/Test.snap.ast +7 -11
- package/test/snapshots/svelte/20-7guis/01-7guis-counter/App.snap.ast +2 -3
- package/test/snapshots/svelte/20-7guis/02-7guis-temperature/App.snap.ast +2 -2
- package/test/snapshots/svelte/20-7guis/03-7guis-flight-booker/App.snap.ast +4 -7
- package/test/snapshots/svelte/20-7guis/04-7guis-timer/App.snap.ast +13 -17
- package/test/snapshots/svelte/20-7guis/05-7guis-crud/App.snap.ast +11 -13
- package/test/snapshots/svelte/20-7guis/06-7guis-circles/App.snap.ast +10 -11
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Comment.snap.ast +4 -6
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Item.snap.ast +9 -13
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/List.snap.ast +3 -5
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Summary.snap.ast +7 -11
- package/test/snapshots/svelte/21-miscellaneous/02-immutable-data/App.snap.ast +2 -4
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/App.snap.ast +6 -7
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/Hero.snap.ast +3 -5
- package/test/snapshots/svelte/99-embeds/20190420-blog-write-less-code/App.snap.ast +6 -7
- package/test/svelte_expressions.spec.ts +93 -4
- package/test/svelte_tags.spec.ts +27 -12
- package/test/tables.spec.ts +347 -0
- package/test/tree_builder.spec.ts +286 -1
- package/test/unclosed_delimiters.spec.ts +529 -0
- package/tsc/buf_utils.d.ts +1 -1
- package/tsc/buf_utils.js +9 -9
- package/tsc/cursor.d.ts +17 -13
- package/tsc/cursor.js +60 -43
- package/tsc/main.d.ts +362 -26
- package/tsc/main.js +8955 -4891
- package/tsc/node_view.d.ts +11 -12
- package/tsc/node_view.js +134 -102
- package/tsc/opcodes.d.ts +23 -6
- package/tsc/plugin_dispatch.d.ts +22 -8
- package/tsc/plugin_dispatch.js +292 -170
- package/tsc/tree_builder.d.ts +42 -11
- package/tsc/tree_builder.js +237 -82
- package/tsc/undo_log.d.ts +11 -1
- package/tsc/undo_log.js +54 -19
- package/tsc/utils.d.ts +77 -51
- package/tsc/utils.js +687 -344
- package/tsc/utils.spec.js +83 -9
- package/tsc/wire_emitter.js +6 -0
- package/tsc/wire_tree_builder.d.ts +4 -7
- package/tsc/wire_tree_builder.js +34 -37
- package/dist/node_view-BEh2-H86.js +0 -373
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import { kind_to_string as l, string_to_kind as h } from "./utils.js";
|
|
2
|
-
const c = 4294967295, u = Symbol("ATTR_DID_NOT_EXIST");
|
|
3
|
-
function f(d, t, e) {
|
|
4
|
-
const i = d._prev_siblings[e], r = d._next_siblings[e];
|
|
5
|
-
i !== c ? d._next_siblings[i] = r : d._children_starts[t] === e && (d._children_starts[t] = r !== c && d._parents[r] === t ? r : c), r !== c && d._parents[r] === t && (d._prev_siblings[r] = i), d._children_ends[t] === e && (d._children_ends[t] = i !== c ? i : c), d._parents[e] = c, d._next_siblings[e] = c, d._prev_siblings[e] = c;
|
|
6
|
-
}
|
|
7
|
-
class x {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.logs = /* @__PURE__ */ new Map(), this.active_node = c;
|
|
10
|
-
}
|
|
11
|
-
/** called by dispatcher before invoking plugin handlers for a node. */
|
|
12
|
-
set_active_node(t) {
|
|
13
|
-
this.active_node = t;
|
|
14
|
-
}
|
|
15
|
-
/** called by dispatcher after handlers complete. */
|
|
16
|
-
clear_active_node() {
|
|
17
|
-
this.active_node = c;
|
|
18
|
-
}
|
|
19
|
-
record_attr_set(t, e, i) {
|
|
20
|
-
this._append({
|
|
21
|
-
kind: 0,
|
|
22
|
-
target: t,
|
|
23
|
-
key: e,
|
|
24
|
-
prior_value: i
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
record_attr_delete(t, e, i) {
|
|
28
|
-
this._append({
|
|
29
|
-
kind: 1,
|
|
30
|
-
target: t,
|
|
31
|
-
key: e,
|
|
32
|
-
prior_value: i
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
record_type_change(t, e) {
|
|
36
|
-
this._append({
|
|
37
|
-
kind: 2,
|
|
38
|
-
target: t,
|
|
39
|
-
prior_kind: e
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
record_wrap_inner(t, e, i, r) {
|
|
43
|
-
this._append({
|
|
44
|
-
kind: 3,
|
|
45
|
-
parent: t,
|
|
46
|
-
wrapper: e,
|
|
47
|
-
prior_first_child: i,
|
|
48
|
-
prior_last_child: r
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
record_prepend(t, e, i) {
|
|
52
|
-
this._append({
|
|
53
|
-
kind: 4,
|
|
54
|
-
parent: t,
|
|
55
|
-
created: e,
|
|
56
|
-
prior_first_child: i
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
record_append(t, e, i) {
|
|
60
|
-
this._append({
|
|
61
|
-
kind: 5,
|
|
62
|
-
parent: t,
|
|
63
|
-
created: e,
|
|
64
|
-
prior_last_child: i
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
_append(t) {
|
|
68
|
-
const e = this.active_node;
|
|
69
|
-
if (e === c)
|
|
70
|
-
return;
|
|
71
|
-
let i = this.logs.get(e);
|
|
72
|
-
i === void 0 && (i = [], this.logs.set(e, i)), i.push(t);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* revoke all mutations attributed to the given handler node.
|
|
76
|
-
* walks the undo log in reverse order, restoring prior state.
|
|
77
|
-
*/
|
|
78
|
-
revoke(t, e) {
|
|
79
|
-
const i = this.logs.get(t);
|
|
80
|
-
if (i !== void 0) {
|
|
81
|
-
for (let r = i.length - 1; r >= 0; r--) {
|
|
82
|
-
const n = i[r];
|
|
83
|
-
switch (n.kind) {
|
|
84
|
-
case 0: {
|
|
85
|
-
const s = e.metadata_at(n.target);
|
|
86
|
-
s && (n.prior_value === u ? delete s[n.key] : s[n.key] = n.prior_value, e.set_metadata(n.target, s));
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
case 1: {
|
|
90
|
-
const s = e.metadata_at(n.target) ?? {};
|
|
91
|
-
s[n.key] = n.prior_value, e.set_metadata(n.target, s);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 2: {
|
|
95
|
-
e._kinds[n.target] = n.prior_kind;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
case 3: {
|
|
99
|
-
n.parent;
|
|
100
|
-
const s = n.wrapper;
|
|
101
|
-
e.unwrap_node(s), e._parents[s] = c;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
case 4:
|
|
105
|
-
case 5: {
|
|
106
|
-
const s = n.parent, _ = n.created;
|
|
107
|
-
f(e, s, _);
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
this.logs.delete(t);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* commit a node, discard its undo log, making mutations permanent.
|
|
117
|
-
*/
|
|
118
|
-
commit(t) {
|
|
119
|
-
this.logs.delete(t);
|
|
120
|
-
}
|
|
121
|
-
/** check whether a node has any recorded mutations. */
|
|
122
|
-
has(t) {
|
|
123
|
-
return this.logs.has(t);
|
|
124
|
-
}
|
|
125
|
-
/** get undo entries for a node (for redirect detection). */
|
|
126
|
-
get_entries(t) {
|
|
127
|
-
return this.logs.get(t);
|
|
128
|
-
}
|
|
129
|
-
/** discard all logs. */
|
|
130
|
-
clear() {
|
|
131
|
-
this.logs.clear(), this.active_node = c;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const o = 4294967295;
|
|
135
|
-
class k {
|
|
136
|
-
constructor(t) {
|
|
137
|
-
this.source = t;
|
|
138
|
-
}
|
|
139
|
-
slice(t, e) {
|
|
140
|
-
return this.source.slice(t, e);
|
|
141
|
-
}
|
|
142
|
-
get_string(t) {
|
|
143
|
-
}
|
|
144
|
-
/** update source for incremental parsing. */
|
|
145
|
-
set_source(t) {
|
|
146
|
-
this.source = t;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
class v {
|
|
150
|
-
constructor(t) {
|
|
151
|
-
this.strings = t;
|
|
152
|
-
}
|
|
153
|
-
slice(t, e) {
|
|
154
|
-
return "";
|
|
155
|
-
}
|
|
156
|
-
get_string(t) {
|
|
157
|
-
return this.strings[t];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
class w {
|
|
161
|
-
constructor(t, e, i, r) {
|
|
162
|
-
this.views = /* @__PURE__ */ new Map(), this.buf = t, this.text_source = e, this.undo = i, this.handler_node = r;
|
|
163
|
-
}
|
|
164
|
-
/** get or create a NodeView for the given buffer index. */
|
|
165
|
-
get(t) {
|
|
166
|
-
if (t === o)
|
|
167
|
-
return null;
|
|
168
|
-
let e = this.views.get(t);
|
|
169
|
-
return e === void 0 && (e = new g(t, this.buf, this.text_source, this, this.undo, this.handler_node), this.views.set(t, e)), e;
|
|
170
|
-
}
|
|
171
|
-
/** discard all cached views. */
|
|
172
|
-
clear() {
|
|
173
|
-
this.views.clear();
|
|
174
|
-
}
|
|
175
|
-
/** update the handler node (for re-use across dispatches). */
|
|
176
|
-
set_handler_node(t) {
|
|
177
|
-
this.handler_node = t;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
class g {
|
|
181
|
-
constructor(t, e, i, r, n, s) {
|
|
182
|
-
this._attrs = null, this._index = t, this._buf = e, this._text_source = i, this._cache = r, this._undo = n, this._handler_node = s;
|
|
183
|
-
}
|
|
184
|
-
get type() {
|
|
185
|
-
return l(this._buf._kinds[this._index]);
|
|
186
|
-
}
|
|
187
|
-
set type(t) {
|
|
188
|
-
const e = h(t);
|
|
189
|
-
if (e === void 0)
|
|
190
|
-
return;
|
|
191
|
-
const i = this._buf._kinds[this._index];
|
|
192
|
-
this._undo.record_type_change(this._index, i), this._buf._kinds[this._index] = e;
|
|
193
|
-
}
|
|
194
|
-
get parent() {
|
|
195
|
-
return this._cache.get(this._buf._parents[this._index]);
|
|
196
|
-
}
|
|
197
|
-
get first_child() {
|
|
198
|
-
return this._cache.get(this._buf._children_starts[this._index]);
|
|
199
|
-
}
|
|
200
|
-
get last_child() {
|
|
201
|
-
return this._cache.get(this._buf._children_ends[this._index]);
|
|
202
|
-
}
|
|
203
|
-
get next() {
|
|
204
|
-
const t = this._buf._next_siblings[this._index];
|
|
205
|
-
return t === o || this._buf._parents[t] !== this._buf._parents[this._index] ? null : this._cache.get(t);
|
|
206
|
-
}
|
|
207
|
-
get prev() {
|
|
208
|
-
const t = this._buf._prev_siblings[this._index];
|
|
209
|
-
return t === o ? null : this._cache.get(t);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* flattened text of all descendants.
|
|
213
|
-
* only guaranteed complete in the close callback.
|
|
214
|
-
*/
|
|
215
|
-
get text_content() {
|
|
216
|
-
return this._collect_text(this._index);
|
|
217
|
-
}
|
|
218
|
-
_collect_text(t) {
|
|
219
|
-
const e = this._buf, i = e._kinds[t];
|
|
220
|
-
if (i === 1) {
|
|
221
|
-
const s = this._text_source.get_string(t);
|
|
222
|
-
if (s !== void 0)
|
|
223
|
-
return s;
|
|
224
|
-
const _ = e._value_starts[t], a = e._value_ends[t];
|
|
225
|
-
return _ === o || a === o || a <= _ ? "" : this._text_source.slice(_, a);
|
|
226
|
-
}
|
|
227
|
-
if (i === 5 || i === 8 || i === 26) {
|
|
228
|
-
const s = this._text_source.get_string(t);
|
|
229
|
-
if (s !== void 0)
|
|
230
|
-
return s;
|
|
231
|
-
const _ = e._value_starts[t], a = e._value_ends[t];
|
|
232
|
-
return _ === o || a === o || a <= _ ? "" : this._text_source.slice(_, a);
|
|
233
|
-
}
|
|
234
|
-
if (i === 3) {
|
|
235
|
-
const s = this._text_source.get_string(t);
|
|
236
|
-
if (s !== void 0)
|
|
237
|
-
return s;
|
|
238
|
-
const _ = e._value_starts[t], a = e._value_ends[t];
|
|
239
|
-
if (_ !== o && a !== o && a > _)
|
|
240
|
-
return this._text_source.slice(_, a);
|
|
241
|
-
}
|
|
242
|
-
let r = "", n = e._children_starts[t];
|
|
243
|
-
for (; n !== o && e._parents[n] === t; )
|
|
244
|
-
r += this._collect_text(n), n = e._next_siblings[n];
|
|
245
|
-
return r;
|
|
246
|
-
}
|
|
247
|
-
/** heading depth (1-6). only meaningful when type === 'heading'. */
|
|
248
|
-
get depth() {
|
|
249
|
-
if (this._buf._kinds[this._index] === 3)
|
|
250
|
-
return this._buf._extras[this._index];
|
|
251
|
-
}
|
|
252
|
-
/** code block language/info string. */
|
|
253
|
-
get lang() {
|
|
254
|
-
if (this._buf._kinds[this._index] !== 5)
|
|
255
|
-
return;
|
|
256
|
-
const e = this._buf.metadata_at(this._index);
|
|
257
|
-
if (e) {
|
|
258
|
-
if (e.info)
|
|
259
|
-
return e.info;
|
|
260
|
-
if (e.info_start != null && e.info_end != null)
|
|
261
|
-
return this._text_source.slice(e.info_start, e.info_end);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/** link/image href. */
|
|
265
|
-
get href() {
|
|
266
|
-
const t = this._buf.metadata_at(this._index);
|
|
267
|
-
return t == null ? void 0 : t.href;
|
|
268
|
-
}
|
|
269
|
-
/** link/image title. */
|
|
270
|
-
get title() {
|
|
271
|
-
const t = this._buf.metadata_at(this._index);
|
|
272
|
-
return t == null ? void 0 : t.title;
|
|
273
|
-
}
|
|
274
|
-
/** list: ordered flag. */
|
|
275
|
-
get ordered() {
|
|
276
|
-
const t = this._buf.metadata_at(this._index);
|
|
277
|
-
return t == null ? void 0 : t.ordered;
|
|
278
|
-
}
|
|
279
|
-
/** list: start number. */
|
|
280
|
-
get start() {
|
|
281
|
-
const t = this._buf.metadata_at(this._index);
|
|
282
|
-
return t == null ? void 0 : t.start;
|
|
283
|
-
}
|
|
284
|
-
/** list: tight flag. */
|
|
285
|
-
get tight() {
|
|
286
|
-
const t = this._buf.metadata_at(this._index);
|
|
287
|
-
return t == null ? void 0 : t.tight;
|
|
288
|
-
}
|
|
289
|
-
get attrs() {
|
|
290
|
-
if (this._attrs !== null)
|
|
291
|
-
return this._attrs;
|
|
292
|
-
const t = this._buf, e = this._index, i = this._undo;
|
|
293
|
-
return this._attrs = new Proxy({}, {
|
|
294
|
-
get(r, n) {
|
|
295
|
-
const s = t.metadata_at(e);
|
|
296
|
-
return s ? s[n] : void 0;
|
|
297
|
-
},
|
|
298
|
-
set(r, n, s) {
|
|
299
|
-
const _ = t.metadata_at(e), a = _ && n in _ ? _[n] : u;
|
|
300
|
-
return i.record_attr_set(e, n, a), _ ? (_[n] = s, t.set_metadata(e, _)) : t.set_metadata(e, { [n]: s }), !0;
|
|
301
|
-
},
|
|
302
|
-
deleteProperty(r, n) {
|
|
303
|
-
const s = t.metadata_at(e);
|
|
304
|
-
if (!s || !(n in s))
|
|
305
|
-
return !0;
|
|
306
|
-
const _ = s[n];
|
|
307
|
-
return i.record_attr_delete(e, n, _), delete s[n], t.set_metadata(e, s), !0;
|
|
308
|
-
},
|
|
309
|
-
has(r, n) {
|
|
310
|
-
const s = t.metadata_at(e);
|
|
311
|
-
return s ? n in s : !1;
|
|
312
|
-
},
|
|
313
|
-
ownKeys() {
|
|
314
|
-
const r = t.metadata_at(e);
|
|
315
|
-
return r ? Object.keys(r) : [];
|
|
316
|
-
},
|
|
317
|
-
getOwnPropertyDescriptor(r, n) {
|
|
318
|
-
const s = t.metadata_at(e);
|
|
319
|
-
if (s && n in s)
|
|
320
|
-
return {
|
|
321
|
-
configurable: !0,
|
|
322
|
-
enumerable: !0,
|
|
323
|
-
value: s[n]
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
}), this._attrs;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* insert a new node between this node and its current children.
|
|
330
|
-
* all current children become children of the new wrapper.
|
|
331
|
-
* returns a view for the new wrapper node.
|
|
332
|
-
*/
|
|
333
|
-
wrap_inner(t, e) {
|
|
334
|
-
const i = h(t);
|
|
335
|
-
if (i === void 0)
|
|
336
|
-
throw new Error(`Unknown node type: ${t}`);
|
|
337
|
-
const r = this._buf, n = this._index, s = r._children_starts[n], _ = r._children_ends[n], a = r.wrap_children(n, i, 0, e);
|
|
338
|
-
return this._undo.record_wrap_inner(n, a, s, _), this._cache.get(a);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* insert a new node as the first child of this node.
|
|
342
|
-
* returns a view for the new node.
|
|
343
|
-
*/
|
|
344
|
-
prepend(t, e) {
|
|
345
|
-
const i = h(t);
|
|
346
|
-
if (i === void 0)
|
|
347
|
-
throw new Error(`Unknown node type: ${t}`);
|
|
348
|
-
const r = this._buf, n = this._index, s = r._children_starts[n];
|
|
349
|
-
if (s === o) {
|
|
350
|
-
const a = r.push(i, 0, n, 0, e);
|
|
351
|
-
return this._undo.record_prepend(n, a, s), this._cache.get(a);
|
|
352
|
-
}
|
|
353
|
-
const _ = r.push_unlinked(i, 0, 0, e);
|
|
354
|
-
return r._parents[_] = n, r._next_siblings[_] = s, r._prev_siblings[s] = _, r._children_starts[n] = _, this._undo.record_prepend(n, _, s), this._cache.get(_);
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* insert a new node as the last child of this node.
|
|
358
|
-
* returns a view for the new node.
|
|
359
|
-
*/
|
|
360
|
-
append(t, e) {
|
|
361
|
-
const i = h(t);
|
|
362
|
-
if (i === void 0)
|
|
363
|
-
throw new Error(`Unknown node type: ${t}`);
|
|
364
|
-
const r = this._buf, n = this._index, s = r._children_ends[n], _ = r.push(i, 0, n, 0, e);
|
|
365
|
-
return this._undo.record_append(n, _, s), this._cache.get(_);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
export {
|
|
369
|
-
k as S,
|
|
370
|
-
x as U,
|
|
371
|
-
w as V,
|
|
372
|
-
v as W
|
|
373
|
-
};
|