@onereach/ui-components 4.2.0-beta.2549.0 → 4.2.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/dist/bundled/v2/components/OrCheckboxGroupV3/OrCheckboxGroup.js +145 -0
- package/dist/bundled/v2/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/bundled/v2/components/OrCheckboxGroupV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrCheckboxGroupV3/index.js +31 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.js +226 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/index.js +23 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/styles.d.ts +2 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/styles.js +10 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/types.d.ts +8 -0
- package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.js +37 -39
- package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.vue.d.ts +18 -16
- package/dist/bundled/v2/components/OrCheckboxV3/index.js +1 -0
- package/dist/bundled/v2/components/OrCode/OrCode.js +3727 -6
- package/dist/bundled/v2/components/OrCode/index.js +2 -6
- package/dist/bundled/v2/components/OrCode/lang.js +3 -3897
- package/dist/bundled/v2/components/OrCode/theme.js +1 -2
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +0 -1
- package/dist/bundled/v2/components/OrConfirm/index.js +0 -1
- package/dist/bundled/v2/components/OrFormGroupV3/OrFormGroup.js +127 -0
- package/dist/bundled/v2/components/OrFormGroupV3/OrFormGroup.vue.d.ts +87 -0
- package/dist/bundled/v2/components/OrFormGroupV3/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrFormGroupV3/index.js +12 -0
- package/dist/bundled/v2/components/OrFormGroupV3/props.d.ts +4 -0
- package/dist/bundled/v2/components/OrFormGroupV3/props.js +7 -0
- package/dist/bundled/v2/components/OrFormGroupV3/styles.d.ts +5 -0
- package/dist/bundled/v2/components/OrFormGroupV3/styles.js +17 -0
- package/dist/bundled/v2/components/OrModal/OrModal.js +1266 -3
- package/dist/bundled/v2/components/OrModal/index.js +0 -1
- package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.js +132 -0
- package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/bundled/v2/components/OrRadioGroupV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRadioGroupV3/index.js +19 -0
- package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +1 -1
- package/dist/bundled/v2/components/OrSelectV3/index.js +1 -1
- package/dist/bundled/v2/components/OrTooltipContent/OrTooltipContent.js +2 -2
- package/dist/bundled/v2/components/index.d.ts +0 -1
- package/dist/bundled/v2/components/index.js +2 -15
- package/dist/bundled/v2/{index-f5487f12.js → index-6976c52a.js} +115 -3
- package/dist/bundled/v2/index.d.ts +1 -0
- package/dist/bundled/v2/index.js +8 -20
- package/dist/bundled/v2/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
- package/dist/bundled/v2/utils/functions/flattenDeep.d.ts +2 -0
- package/dist/bundled/v2/utils/functions/flattenDeep.js +5 -0
- package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-29e8ad0e.js → OrAvatar.vue_vue_type_script_lang-6511e348.js} +1 -1
- package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-a4a16fe5.js → OrButton.vue_vue_type_script_lang-da7f7ed0.js} +1 -1
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-c1d83552.js → OrCardCollection.vue_vue_type_script_lang-7a2e1332.js} +3 -3
- package/dist/bundled/v3/{OrCarousel.vue_vue_type_script_lang-0e87c56b.js → OrCarousel.vue_vue_type_script_lang-6976844a.js} +1 -1
- package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-6ff51af9.js → OrCheckbox.vue_vue_type_script_lang-11b16d93.js} +1 -1
- package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-60cefcbd.js → OrCheckbox.vue_vue_type_script_lang-b274a5ee.js} +27 -11
- package/dist/bundled/v3/OrCheckboxTree.vue_vue_type_script_lang-f9807b75.js +115 -0
- package/dist/bundled/v3/{OrChip.vue_vue_type_script_lang-ceebbd82.js → OrChip.vue_vue_type_script_lang-5a390853.js} +1 -1
- package/dist/bundled/v3/{OrChips.vue_vue_type_script_lang-94b456c7.js → OrChips.vue_vue_type_script_lang-d4bb44eb.js} +1 -1
- package/dist/bundled/{v2/index-16aee5bc.js → v3/OrCode.vue_vue_type_script_lang-5397df6a.js} +234 -14
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-36318ca2.js → OrConfirm.vue_vue_type_script_lang-89febea7.js} +2 -2
- package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-5c1a5d4a.js → OrDateTimePicker.vue_vue_type_script_lang-8ff54abd.js} +1 -1
- package/dist/bundled/v3/OrFormGroup.vue_vue_type_script_lang-1c6844d6.js +63 -0
- package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-5d204461.js → OrIconButton.vue_vue_type_script_lang-96cb5b59.js} +2 -2
- package/dist/bundled/v3/{OrInlineTextEdit.vue_vue_type_script_lang-424e2c26.js → OrInlineTextEdit.vue_vue_type_script_lang-45987769.js} +1 -1
- package/dist/bundled/v3/{OrList.vue_vue_type_script_lang-c65271b9.js → OrList.vue_vue_type_script_lang-2c7537cc.js} +3 -3
- package/dist/bundled/v3/{OrListOfInputs.vue_vue_type_script_lang-d3dce7b8.js → OrListOfInputs.vue_vue_type_script_lang-009f62a5.js} +3 -3
- package/dist/bundled/v3/{useFocusTrap-9567b3c8.js → OrModal.vue_vue_type_script_lang-c53617ae.js} +105 -3
- package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-ef4f2661.js → OrNotification.vue_vue_type_script_lang-efb05bb2.js} +2 -2
- package/dist/bundled/v3/{OrOverflowMenu.vue_vue_type_script_lang-0c461991.js → OrOverflowMenu.vue_vue_type_script_lang-ba50133f.js} +2 -2
- package/dist/bundled/v3/{OrPassword.vue_vue_type_script_lang-3d308fef.js → OrPassword.vue_vue_type_script_lang-37f52611.js} +1 -1
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-86f4f5c7.js → OrSearch.vue_vue_type_script_lang-bcb935c3.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-f7601423.js → OrSelect.vue_vue_type_script_lang-098ea3ab.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-d2fecd97.js → OrSelect.vue_vue_type_script_lang-c82d8f58.js} +3 -3
- package/dist/bundled/v3/{OrSlider.vue_vue_type_script_lang-900036a2.js → OrSlider.vue_vue_type_script_lang-45ecddbe.js} +1 -1
- package/dist/bundled/v3/{OrStepper.vue_vue_type_script_lang-2821c496.js → OrStepper.vue_vue_type_script_lang-975a4df6.js} +1 -1
- package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-f06b54a2.js → OrTag.vue_vue_type_script_lang-621e9307.js} +1 -1
- package/dist/bundled/v3/{OrTextbox.vue_vue_type_script_lang-b8d5341b.js → OrTextbox.vue_vue_type_script_lang-812f302d.js} +1 -1
- package/dist/bundled/v3/components/OrAvatar/OrAvatar.js +3 -3
- package/dist/bundled/v3/components/OrAvatar/index.js +2 -2
- package/dist/bundled/v3/components/OrButtonV2/OrButton.js +3 -3
- package/dist/bundled/v3/components/OrButtonV2/index.js +4 -4
- package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.js +6 -6
- package/dist/bundled/v3/components/OrCardCollection/index.js +5 -5
- package/dist/bundled/v3/components/OrCarousel/OrCarousel.js +3 -3
- package/dist/bundled/v3/components/OrCarousel/index.js +2 -2
- package/dist/bundled/v3/components/OrCheckbox/OrCheckbox.js +3 -3
- package/dist/bundled/v3/components/OrCheckbox/index.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +121 -0
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/bundled/v3/components/OrCheckboxGroupV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +40 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +90 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +28 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/styles.d.ts +2 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/styles.js +10 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/types.d.ts +8 -0
- package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.js +12 -9
- package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.vue.d.ts +18 -16
- package/dist/bundled/v3/components/OrCheckboxV3/index.js +2 -1
- package/dist/bundled/v3/components/OrChip/OrChip.js +3 -3
- package/dist/bundled/v3/components/OrChip/index.js +2 -2
- package/dist/bundled/v3/components/OrChips/OrChips.js +4 -4
- package/dist/bundled/v3/components/OrChips/index.js +3 -3
- package/dist/bundled/v3/components/OrCode/OrCode.js +9 -13
- package/dist/bundled/v3/components/OrCode/index.js +7 -11
- package/dist/bundled/v3/components/OrCode/lang.js +3 -3897
- package/dist/bundled/v3/components/OrCode/theme.js +1 -2
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +7 -8
- package/dist/bundled/v3/components/OrConfirm/index.js +6 -7
- package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.js +5 -5
- package/dist/bundled/v3/components/OrDateTimePicker/index.js +4 -4
- package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.js +59 -0
- package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.vue.d.ts +87 -0
- package/dist/bundled/v3/components/OrFormGroupV3/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrFormGroupV3/index.js +15 -0
- package/dist/bundled/v3/components/OrFormGroupV3/props.d.ts +4 -0
- package/dist/bundled/v3/components/OrFormGroupV3/props.js +7 -0
- package/dist/bundled/v3/components/OrFormGroupV3/styles.d.ts +5 -0
- package/dist/bundled/v3/components/OrFormGroupV3/styles.js +17 -0
- package/dist/bundled/v3/components/OrIcon/OrIcon.js +2 -2
- package/dist/bundled/v3/components/OrIcon/index.js +1 -1
- package/dist/bundled/v3/components/OrIconButtonV2/OrIconButton.js +4 -4
- package/dist/bundled/v3/components/OrIconButtonV2/index.js +3 -3
- package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.js +5 -5
- package/dist/bundled/v3/components/OrInlineTextEdit/index.js +4 -4
- package/dist/bundled/v3/components/OrList/OrList.js +6 -6
- package/dist/bundled/v3/components/OrList/index.js +5 -5
- package/dist/bundled/v3/components/OrListOfInputs/OrListOfInputs.js +7 -7
- package/dist/bundled/v3/components/OrListOfInputs/index.js +6 -6
- package/dist/bundled/v3/components/OrModal/OrModal.js +5 -6
- package/dist/bundled/v3/components/OrModal/index.js +4 -5
- package/dist/bundled/v3/components/OrNotification/OrNotification.js +5 -5
- package/dist/bundled/v3/components/OrNotification/index.js +4 -4
- package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.js +6 -6
- package/dist/bundled/v3/components/OrOverflowMenu/index.js +5 -5
- package/dist/bundled/v3/components/OrPassword/OrPassword.js +5 -5
- package/dist/bundled/v3/components/OrPassword/index.js +4 -4
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.js +104 -0
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/bundled/v3/components/OrRadioGroupV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRadioGroupV3/index.js +24 -0
- package/dist/bundled/v3/components/OrSearch/OrSearch.js +5 -5
- package/dist/bundled/v3/components/OrSearch/index.js +4 -4
- package/dist/bundled/v3/components/OrSelect/OrSelect.js +5 -5
- package/dist/bundled/v3/components/OrSelect/index.js +4 -4
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +4 -4
- package/dist/bundled/v3/components/OrSelectV3/index.js +3 -3
- package/dist/bundled/v3/components/OrSlider/OrSlider.js +3 -3
- package/dist/bundled/v3/components/OrSlider/index.js +2 -2
- package/dist/bundled/v3/components/OrStepper/OrStepper.js +4 -4
- package/dist/bundled/v3/components/OrStepper/index.js +3 -3
- package/dist/bundled/v3/components/OrTag/OrTag.js +3 -3
- package/dist/bundled/v3/components/OrTag/index.js +2 -2
- package/dist/bundled/v3/components/OrTextbox/OrTextbox.js +5 -5
- package/dist/bundled/v3/components/OrTextbox/index.js +4 -4
- package/dist/bundled/v3/components/OrToast/OrToast.js +3 -3
- package/dist/bundled/v3/components/OrToast/index.js +4 -4
- package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +5 -5
- package/dist/bundled/v3/components/OrToastContainer/index.js +4 -4
- package/dist/bundled/v3/components/OrTooltip/OrTooltip.js +2 -2
- package/dist/bundled/v3/components/OrTooltip/index.js +1 -1
- package/dist/bundled/v3/components/OrTooltipContent/OrTooltipContent.js +1 -1
- package/dist/bundled/v3/components/index.d.ts +0 -1
- package/dist/bundled/v3/components/index.js +31 -45
- package/dist/bundled/v3/{index-f5487f12.js → index-6976c52a.js} +115 -3
- package/dist/bundled/v3/index.d.ts +1 -0
- package/dist/bundled/v3/index.js +39 -53
- package/dist/bundled/v3/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
- package/dist/bundled/v3/utils/functions/flattenDeep.d.ts +2 -0
- package/dist/bundled/v3/utils/functions/flattenDeep.js +5 -0
- package/dist/esm/v2/{OrAvatar-da5cba16.js → OrAvatar-7c024521.js} +1 -1
- package/dist/esm/v2/{OrButton-bdddd8d4.js → OrButton-4e532ddb.js} +1 -1
- package/dist/esm/v2/{OrButton.vue_rollup-plugin-vue_styles.0-3dbd90b4.js → OrButton.vue_rollup-plugin-vue_styles.0-48c5883e.js} +2 -2
- package/dist/esm/v2/{OrCardCollection-4e014d25.js → OrCardCollection-9bf513b7.js} +5 -5
- package/dist/esm/v2/{OrCarousel-3c809a13.js → OrCarousel-e0c2e387.js} +1 -1
- package/dist/esm/v2/{OrCheckbox-dc587ec9.js → OrCheckbox-39c94019.js} +37 -40
- package/dist/esm/v2/{OrCheckbox-bf34eb0f.js → OrCheckbox-7b98fc08.js} +1 -1
- package/dist/esm/v2/OrCheckboxTree-7b81e76c.js +220 -0
- package/dist/esm/v2/{OrChip-416e848e.js → OrChip-8a1abfc5.js} +1 -1
- package/dist/esm/v2/{OrChips-77e789e9.js → OrChips-a01d8520.js} +1 -1
- package/dist/esm/v2/{OrChips.vue_rollup-plugin-vue_styles.0-e05c5ca8.js → OrChips.vue_rollup-plugin-vue_styles.0-3cbb0871.js} +1 -1
- package/dist/esm/v2/{OrCode-dcb0132a.js → OrCode-e54e09f7.js} +4 -4
- package/dist/esm/v2/{OrConfirm-497cd260.js → OrConfirm-5d5dd9bc.js} +3 -3
- package/dist/esm/v2/{OrDateTimePicker-c88ca716.js → OrDateTimePicker-6e2853ec.js} +3 -3
- package/dist/esm/v2/OrFormGroup-29a514db.js +141 -0
- package/dist/esm/v2/{OrIcon-8a6d663a.js → OrIcon-a40e60af.js} +2 -2
- package/dist/esm/v2/{OrIconButton-97bfd51d.js → OrIconButton-23972f7d.js} +1 -1
- package/dist/esm/v2/{OrIconButton.vue_rollup-plugin-vue_styles.0-e3806cef.js → OrIconButton.vue_rollup-plugin-vue_styles.0-277ce06c.js} +3 -3
- package/dist/esm/v2/{OrInlineTextEdit-e8414fb6.js → OrInlineTextEdit-9541b625.js} +3 -3
- package/dist/esm/v2/{OrList-a46d6306.js → OrList-61c7b8ea.js} +4 -4
- package/dist/esm/v2/{OrListOfInputs-33a7bf87.js → OrListOfInputs-e1b09290.js} +5 -5
- package/dist/esm/v2/{OrModal-6d84829c.js → OrModal-b9cfb8ec.js} +3 -3
- package/dist/esm/v2/{OrNotification-7945568d.js → OrNotification-fdb88eec.js} +4 -4
- package/dist/esm/v2/{OrOverflowMenu-5ce7171b.js → OrOverflowMenu-83540c76.js} +4 -4
- package/dist/esm/v2/{OrPassword-3597153d.js → OrPassword-022e10fd.js} +3 -3
- package/dist/esm/v2/{OrSearch-49ceaac4.js → OrSearch-620d5d76.js} +3 -3
- package/dist/esm/v2/{OrSelect-40183874.js → OrSelect-1865c781.js} +1 -1
- package/dist/esm/v2/{OrSelect-eb5cc918.js → OrSelect-d887118b.js} +4 -4
- package/dist/esm/v2/{OrSlider-32a14ca4.js → OrSlider-c0a7f9cf.js} +1 -1
- package/dist/esm/v2/{OrStepper-462bc9e6.js → OrStepper-b00f7531.js} +2 -2
- package/dist/esm/v2/{OrTag-a1fff567.js → OrTag-6349049b.js} +1 -1
- package/dist/esm/v2/{OrTextbox-0a89a533.js → OrTextbox-0373bd6a.js} +3 -3
- package/dist/esm/v2/{OrToastContainer-5ce15a5b.js → OrToastContainer-1625b803.js} +3 -3
- package/dist/esm/v2/{OrTooltip-cfb56e8f.js → OrTooltip-97a42707.js} +1 -1
- package/dist/esm/v2/{OrTooltip.vue_rollup-plugin-vue_styles.0-122f7804.js → OrTooltip.vue_rollup-plugin-vue_styles.0-a256ac18.js} +1 -1
- package/dist/esm/v2/{OrTooltipContent-c9540548.js → OrTooltipContent-d85e1071.js} +2 -2
- package/dist/esm/v2/components/index.d.ts +0 -1
- package/dist/esm/v2/components/index.js +34 -58
- package/dist/esm/v2/components/or-avatar/index.js +4 -4
- package/dist/esm/v2/components/or-button-v2/index.js +8 -8
- package/dist/esm/v2/components/or-card-collection/index.js +9 -9
- package/dist/esm/v2/components/or-carousel/index.js +4 -4
- package/dist/esm/v2/components/or-checkbox/index.js +4 -4
- package/dist/esm/v2/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/esm/v2/components/or-checkbox-group-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-checkbox-group-v3/index.js +130 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/index.js +12 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/styles.d.ts +2 -0
- package/dist/esm/v2/components/or-checkbox-tree-v3/types.d.ts +8 -0
- package/dist/esm/v2/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -16
- package/dist/esm/v2/components/or-checkbox-v3/index.js +2 -2
- package/dist/esm/v2/components/or-chips/index.js +6 -6
- package/dist/esm/v2/components/or-chips/or-chip/index.js +4 -4
- package/dist/esm/v2/components/or-code/index.js +9 -9
- package/dist/esm/v2/components/or-confirm/index.js +10 -10
- package/dist/esm/v2/components/or-date-time-picker/index.js +8 -8
- package/dist/esm/v2/components/or-form-group-v3/OrFormGroup.vue.d.ts +87 -0
- package/dist/esm/v2/components/or-form-group-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-form-group-v3/index.js +6 -0
- package/dist/esm/v2/components/or-form-group-v3/props.d.ts +4 -0
- package/dist/esm/v2/components/or-form-group-v3/styles.d.ts +5 -0
- package/dist/esm/v2/components/or-icon/index.js +3 -3
- package/dist/esm/v2/components/or-icon-button-v2/index.js +6 -6
- package/dist/esm/v2/components/or-inline-text-edit/index.js +8 -8
- package/dist/esm/v2/components/or-list/index.js +9 -9
- package/dist/esm/v2/components/or-list-of-inputs/index.js +10 -10
- package/dist/esm/v2/components/or-modal/index.js +8 -8
- package/dist/esm/v2/components/or-notification/index.js +8 -8
- package/dist/esm/v2/components/or-overflow-menu/index.js +9 -9
- package/dist/esm/v2/components/or-password/index.js +8 -8
- package/dist/esm/v2/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/esm/v2/components/or-radio-group-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-radio-group-v3/index.js +124 -0
- package/dist/esm/v2/components/or-search/index.js +8 -8
- package/dist/esm/v2/components/or-select/index.js +7 -7
- package/dist/esm/v2/components/or-select-v3/index.js +2 -2
- package/dist/esm/v2/components/or-slider/index.js +4 -4
- package/dist/esm/v2/components/or-stepper/index.js +8 -8
- package/dist/esm/v2/components/or-tag/index.js +4 -4
- package/dist/esm/v2/components/or-textbox/index.js +8 -8
- package/dist/esm/v2/components/or-toast/index.js +8 -8
- package/dist/esm/v2/components/or-toast/or-toast-container/index.js +8 -8
- package/dist/esm/v2/components/or-tooltip/index.js +3 -3
- package/dist/esm/v2/components/or-tooltip/or-tooltip-content/index.js +1 -1
- package/dist/esm/v2/flattenDeep-e7a8b995.js +5 -0
- package/dist/esm/v2/index.d.ts +1 -0
- package/dist/esm/v2/index.js +35 -58
- package/dist/esm/v2/utils/functions/flattenDeep.d.ts +2 -0
- package/dist/esm/v3/{OrAvatar-b18f2208.js → OrAvatar-14a5c5f0.js} +1 -1
- package/dist/esm/v3/{OrButton-170b493f.js → OrButton-f8b10d79.js} +2 -2
- package/dist/esm/v3/{OrCardCollection-dc158967.js → OrCardCollection-ffbb9eda.js} +4 -4
- package/dist/esm/v3/{OrCarousel-8de5d65b.js → OrCarousel-03597740.js} +1 -1
- package/dist/esm/v3/{OrCheckbox-56f849f7.js → OrCheckbox-488b6915.js} +36 -19
- package/dist/esm/v3/{OrCheckbox-c2d9cf53.js → OrCheckbox-7efd5f26.js} +1 -1
- package/dist/esm/v3/OrCheckboxTree-87d0528b.js +182 -0
- package/dist/esm/v3/{OrChip-ccd4b331.js → OrChip-97a85e10.js} +1 -1
- package/dist/esm/v3/{OrChips-9a19aa03.js → OrChips-64b86761.js} +1 -1
- package/dist/esm/v3/{OrCode-b0b514ab.js → OrCode-6f2e4d99.js} +3 -3
- package/dist/esm/v3/{OrConfirm-1ffb7ed6.js → OrConfirm-ab04201f.js} +3 -3
- package/dist/esm/v3/{OrDateTimePicker-02c6de49.js → OrDateTimePicker-014f7819.js} +2 -2
- package/dist/esm/v3/OrFormGroup-9f581536.js +122 -0
- package/dist/esm/v3/{OrIcon-9b3d24cc.js → OrIcon-925c5413.js} +2 -2
- package/dist/esm/v3/{OrIconButton-9d08aa44.js → OrIconButton-5387fd59.js} +3 -3
- package/dist/esm/v3/{OrInlineTextEdit-8cfde85c.js → OrInlineTextEdit-6f97629f.js} +2 -2
- package/dist/esm/v3/{OrList-d3e330be.js → OrList-b8799cf4.js} +3 -3
- package/dist/esm/v3/{OrListOfInputs-3c8eaf97.js → OrListOfInputs-16ba8358.js} +4 -4
- package/dist/esm/v3/{OrModal-f8ae7146.js → OrModal-e6513e8c.js} +2 -2
- package/dist/esm/v3/{OrNotification-24192897.js → OrNotification-4c56f7ea.js} +3 -3
- package/dist/esm/v3/{OrOverflowMenu-a7568f8d.js → OrOverflowMenu-fe77e22c.js} +2 -2
- package/dist/esm/v3/{OrPassword-88a67993.js → OrPassword-9c8a458d.js} +2 -2
- package/dist/esm/v3/{OrSearch-fb2dd591.js → OrSearch-c4caf04e.js} +2 -2
- package/dist/esm/v3/{OrSelect-5502d82d.js → OrSelect-35b41c3f.js} +1 -1
- package/dist/esm/v3/{OrSelect-3d923250.js → OrSelect-d8a78242.js} +4 -4
- package/dist/esm/v3/{OrSlider-ae7b8a11.js → OrSlider-80e0f2e6.js} +1 -1
- package/dist/esm/v3/{OrStepper-446007c5.js → OrStepper-3a586401.js} +2 -2
- package/dist/esm/v3/{OrTag-38d1ba92.js → OrTag-e7adb078.js} +1 -1
- package/dist/esm/v3/{OrTextbox-7de2b10c.js → OrTextbox-f7388a30.js} +2 -2
- package/dist/esm/v3/{OrToastContainer-c3ecb1c8.js → OrToastContainer-94ba2803.js} +2 -2
- package/dist/esm/v3/{OrTooltip-be7209e5.js → OrTooltip-618ce7c9.js} +1 -1
- package/dist/esm/v3/{OrTooltipContent-68c34911.js → OrTooltipContent-37a5f562.js} +1 -1
- package/dist/esm/v3/components/index.d.ts +0 -1
- package/dist/esm/v3/components/index.js +30 -54
- package/dist/esm/v3/components/or-avatar/index.js +4 -4
- package/dist/esm/v3/components/or-button-v2/index.js +5 -5
- package/dist/esm/v3/components/or-card-collection/index.js +7 -7
- package/dist/esm/v3/components/or-carousel/index.js +4 -4
- package/dist/esm/v3/components/or-checkbox/index.js +4 -4
- package/dist/esm/v3/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +91 -0
- package/dist/esm/v3/components/or-checkbox-group-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-checkbox-group-v3/index.js +97 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +91 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/index.js +12 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/styles.d.ts +2 -0
- package/dist/esm/v3/components/or-checkbox-tree-v3/types.d.ts +8 -0
- package/dist/esm/v3/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -16
- package/dist/esm/v3/components/or-checkbox-v3/index.js +2 -2
- package/dist/esm/v3/components/or-chips/index.js +5 -5
- package/dist/esm/v3/components/or-chips/or-chip/index.js +4 -4
- package/dist/esm/v3/components/or-code/index.js +7 -7
- package/dist/esm/v3/components/or-confirm/index.js +7 -7
- package/dist/esm/v3/components/or-date-time-picker/index.js +6 -6
- package/dist/esm/v3/components/or-form-group-v3/OrFormGroup.vue.d.ts +87 -0
- package/dist/esm/v3/components/or-form-group-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-form-group-v3/index.js +6 -0
- package/dist/esm/v3/components/or-form-group-v3/props.d.ts +4 -0
- package/dist/esm/v3/components/or-form-group-v3/styles.d.ts +5 -0
- package/dist/esm/v3/components/or-icon/index.js +3 -3
- package/dist/esm/v3/components/or-icon-button-v2/index.js +4 -4
- package/dist/esm/v3/components/or-inline-text-edit/index.js +6 -6
- package/dist/esm/v3/components/or-list/index.js +6 -6
- package/dist/esm/v3/components/or-list-of-inputs/index.js +7 -7
- package/dist/esm/v3/components/or-modal/index.js +6 -6
- package/dist/esm/v3/components/or-notification/index.js +6 -6
- package/dist/esm/v3/components/or-overflow-menu/index.js +6 -6
- package/dist/esm/v3/components/or-password/index.js +6 -6
- package/dist/esm/v3/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +110 -0
- package/dist/esm/v3/components/or-radio-group-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-radio-group-v3/index.js +91 -0
- package/dist/esm/v3/components/or-search/index.js +6 -6
- package/dist/esm/v3/components/or-select/index.js +7 -7
- package/dist/esm/v3/components/or-select-v3/index.js +2 -2
- package/dist/esm/v3/components/or-slider/index.js +4 -4
- package/dist/esm/v3/components/or-stepper/index.js +6 -6
- package/dist/esm/v3/components/or-tag/index.js +4 -4
- package/dist/esm/v3/components/or-textbox/index.js +6 -6
- package/dist/esm/v3/components/or-toast/index.js +6 -6
- package/dist/esm/v3/components/or-toast/or-toast-container/index.js +6 -6
- package/dist/esm/v3/components/or-tooltip/index.js +2 -2
- package/dist/esm/v3/components/or-tooltip/or-tooltip-content/index.js +1 -1
- package/dist/esm/v3/flattenDeep-e7a8b995.js +5 -0
- package/dist/esm/v3/index.d.ts +1 -0
- package/dist/esm/v3/index.js +31 -54
- package/dist/esm/v3/utils/functions/flattenDeep.d.ts +2 -0
- package/package.json +5 -25
- package/src/components/index.ts +0 -1
- package/src/components/or-checkbox-group-v3/OrCheckboxGroup.docs.mdx +7 -0
- package/src/components/or-checkbox-group-v3/OrCheckboxGroup.stories3.ts +373 -0
- package/src/components/or-checkbox-group-v3/OrCheckboxGroup.vue +80 -0
- package/src/components/or-checkbox-group-v3/index.ts +1 -0
- package/src/components/or-checkbox-tree-v3/OrCheckboxTree.docs.mdx +7 -0
- package/src/components/or-checkbox-tree-v3/OrCheckboxTree.stories3.ts +112 -0
- package/src/components/or-checkbox-tree-v3/OrCheckboxTree.vue +192 -0
- package/src/components/or-checkbox-tree-v3/index.ts +2 -0
- package/src/components/or-checkbox-tree-v3/styles.ts +15 -0
- package/src/components/or-checkbox-tree-v3/types.ts +8 -0
- package/src/components/or-checkbox-v3/OrCheckbox.vue +33 -13
- package/src/components/or-form-group-v3/OrFormGroup.stories3.ts +114 -0
- package/src/components/or-form-group-v3/OrFormGroup.vue +116 -0
- package/src/components/or-form-group-v3/index.ts +2 -0
- package/src/components/or-form-group-v3/props.ts +4 -0
- package/src/components/or-form-group-v3/styles.ts +33 -0
- package/src/components/or-radio-group-v3/OrRadioGroup.stories3.ts +81 -0
- package/src/components/or-radio-group-v3/OrRadioGroup.vue +80 -0
- package/src/components/or-radio-group-v3/index.ts +1 -0
- package/src/components/or-radio-v3/OrRadio.stories3.ts +1 -1
- package/src/components/or-tooltip/or-tooltip-content/OrTooltipContent.vue +0 -1
- package/src/index.ts +1 -0
- package/src/utils/functions/flattenDeep.ts +5 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -1990
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +0 -68
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +0 -6
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +0 -38
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +0 -5
- package/dist/bundled/v2/index-62c3221b.js +0 -6956
- package/dist/bundled/v2/index.es-3f39f316.js +0 -115
- package/dist/bundled/v2/markdown-516daba9.js +0 -18737
- package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +0 -9360
- package/dist/bundled/v2/useFocusTrap-9567b3c8.js +0 -1268
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-f6f74339.js +0 -236
- package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-af0c4288.js +0 -107
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-fec87993.js +0 -1765
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -228
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +0 -84
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +0 -6
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +0 -38
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +0 -5
- package/dist/bundled/v3/index-16aee5bc.js +0 -3740
- package/dist/bundled/v3/index-62c3221b.js +0 -6956
- package/dist/bundled/v3/index.es-3f39f316.js +0 -115
- package/dist/bundled/v3/markdown-516daba9.js +0 -18737
- package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +0 -9360
- package/dist/esm/v2/OrRichTextEditor-b3da3217.js +0 -724
- package/dist/esm/v2/codemirrorView-be2c7423.js +0 -353
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +0 -59
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -6
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
- package/dist/esm/v3/OrRichTextEditor-39eb04a8.js +0 -687
- package/dist/esm/v3/codemirrorView-be2c7423.js +0 -353
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -170
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +0 -57
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -6
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -7
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -102
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -624
- package/src/components/or-rich-text-editor-v3/index.ts +0 -1
- package/src/components/or-rich-text-editor-v3/styles.ts +0 -64
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +0 -40
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +0 -254
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +0 -1
- package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +0 -213
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +0 -22
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +0 -117
- /package/dist/bundled/v2/components/{OrRichTextEditorV3/utils/codemirror → OrCheckboxTreeV3}/types.js +0 -0
- /package/dist/bundled/v3/{OrIcon.vue_vue_type_script_lang-e3152dc5.js → OrIcon.vue_vue_type_script_lang-e5349e49.js} +0 -0
- /package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-0811fd48.js → OrToastContainer.vue_vue_type_script_lang-70cc38be.js} +0 -0
- /package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-b8594f7e.js → OrTooltip.vue_vue_type_script_lang-76a6b7f4.js} +0 -0
- /package/dist/bundled/v3/components/{OrRichTextEditorV3/utils/codemirror → OrCheckboxTreeV3}/types.js +0 -0
|
@@ -1,3897 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '../../index.es-3f39f316.js';
|
|
5
|
-
|
|
6
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
7
|
-
const scriptText = 54,
|
|
8
|
-
StartCloseScriptTag = 1,
|
|
9
|
-
styleText = 55,
|
|
10
|
-
StartCloseStyleTag = 2,
|
|
11
|
-
textareaText = 56,
|
|
12
|
-
StartCloseTextareaTag = 3,
|
|
13
|
-
StartTag = 4,
|
|
14
|
-
StartScriptTag = 5,
|
|
15
|
-
StartStyleTag = 6,
|
|
16
|
-
StartTextareaTag = 7,
|
|
17
|
-
StartSelfClosingTag = 8,
|
|
18
|
-
StartCloseTag = 9,
|
|
19
|
-
NoMatchStartCloseTag = 10,
|
|
20
|
-
MismatchedStartCloseTag = 11,
|
|
21
|
-
missingCloseTag = 57,
|
|
22
|
-
IncompleteCloseTag = 12,
|
|
23
|
-
commentContent$1 = 58,
|
|
24
|
-
Element$1 = 18,
|
|
25
|
-
TagName = 20,
|
|
26
|
-
Attribute = 21,
|
|
27
|
-
AttributeName = 22,
|
|
28
|
-
AttributeValue = 24,
|
|
29
|
-
UnquotedAttributeValue = 25,
|
|
30
|
-
ScriptText = 27,
|
|
31
|
-
StyleText = 30,
|
|
32
|
-
TextareaText = 33,
|
|
33
|
-
OpenTag = 35,
|
|
34
|
-
CloseTag = 36,
|
|
35
|
-
Dialect_noMatch = 0;
|
|
36
|
-
|
|
37
|
-
/* Hand-written tokenizers for HTML. */
|
|
38
|
-
|
|
39
|
-
const selfClosers = {
|
|
40
|
-
area: true,
|
|
41
|
-
base: true,
|
|
42
|
-
br: true,
|
|
43
|
-
col: true,
|
|
44
|
-
command: true,
|
|
45
|
-
embed: true,
|
|
46
|
-
frame: true,
|
|
47
|
-
hr: true,
|
|
48
|
-
img: true,
|
|
49
|
-
input: true,
|
|
50
|
-
keygen: true,
|
|
51
|
-
link: true,
|
|
52
|
-
meta: true,
|
|
53
|
-
param: true,
|
|
54
|
-
source: true,
|
|
55
|
-
track: true,
|
|
56
|
-
wbr: true,
|
|
57
|
-
menuitem: true
|
|
58
|
-
};
|
|
59
|
-
const implicitlyClosed = {
|
|
60
|
-
dd: true,
|
|
61
|
-
li: true,
|
|
62
|
-
optgroup: true,
|
|
63
|
-
option: true,
|
|
64
|
-
p: true,
|
|
65
|
-
rp: true,
|
|
66
|
-
rt: true,
|
|
67
|
-
tbody: true,
|
|
68
|
-
td: true,
|
|
69
|
-
tfoot: true,
|
|
70
|
-
th: true,
|
|
71
|
-
tr: true
|
|
72
|
-
};
|
|
73
|
-
const closeOnOpen = {
|
|
74
|
-
dd: {
|
|
75
|
-
dd: true,
|
|
76
|
-
dt: true
|
|
77
|
-
},
|
|
78
|
-
dt: {
|
|
79
|
-
dd: true,
|
|
80
|
-
dt: true
|
|
81
|
-
},
|
|
82
|
-
li: {
|
|
83
|
-
li: true
|
|
84
|
-
},
|
|
85
|
-
option: {
|
|
86
|
-
option: true,
|
|
87
|
-
optgroup: true
|
|
88
|
-
},
|
|
89
|
-
optgroup: {
|
|
90
|
-
optgroup: true
|
|
91
|
-
},
|
|
92
|
-
p: {
|
|
93
|
-
address: true,
|
|
94
|
-
article: true,
|
|
95
|
-
aside: true,
|
|
96
|
-
blockquote: true,
|
|
97
|
-
dir: true,
|
|
98
|
-
div: true,
|
|
99
|
-
dl: true,
|
|
100
|
-
fieldset: true,
|
|
101
|
-
footer: true,
|
|
102
|
-
form: true,
|
|
103
|
-
h1: true,
|
|
104
|
-
h2: true,
|
|
105
|
-
h3: true,
|
|
106
|
-
h4: true,
|
|
107
|
-
h5: true,
|
|
108
|
-
h6: true,
|
|
109
|
-
header: true,
|
|
110
|
-
hgroup: true,
|
|
111
|
-
hr: true,
|
|
112
|
-
menu: true,
|
|
113
|
-
nav: true,
|
|
114
|
-
ol: true,
|
|
115
|
-
p: true,
|
|
116
|
-
pre: true,
|
|
117
|
-
section: true,
|
|
118
|
-
table: true,
|
|
119
|
-
ul: true
|
|
120
|
-
},
|
|
121
|
-
rp: {
|
|
122
|
-
rp: true,
|
|
123
|
-
rt: true
|
|
124
|
-
},
|
|
125
|
-
rt: {
|
|
126
|
-
rp: true,
|
|
127
|
-
rt: true
|
|
128
|
-
},
|
|
129
|
-
tbody: {
|
|
130
|
-
tbody: true,
|
|
131
|
-
tfoot: true
|
|
132
|
-
},
|
|
133
|
-
td: {
|
|
134
|
-
td: true,
|
|
135
|
-
th: true
|
|
136
|
-
},
|
|
137
|
-
tfoot: {
|
|
138
|
-
tbody: true
|
|
139
|
-
},
|
|
140
|
-
th: {
|
|
141
|
-
td: true,
|
|
142
|
-
th: true
|
|
143
|
-
},
|
|
144
|
-
thead: {
|
|
145
|
-
tbody: true,
|
|
146
|
-
tfoot: true
|
|
147
|
-
},
|
|
148
|
-
tr: {
|
|
149
|
-
tr: true
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
function nameChar(ch) {
|
|
153
|
-
return ch == 45 || ch == 46 || ch == 58 || ch >= 65 && ch <= 90 || ch == 95 || ch >= 97 && ch <= 122 || ch >= 161;
|
|
154
|
-
}
|
|
155
|
-
function isSpace(ch) {
|
|
156
|
-
return ch == 9 || ch == 10 || ch == 13 || ch == 32;
|
|
157
|
-
}
|
|
158
|
-
let cachedName = null,
|
|
159
|
-
cachedInput = null,
|
|
160
|
-
cachedPos = 0;
|
|
161
|
-
function tagNameAfter(input, offset) {
|
|
162
|
-
let pos = input.pos + offset;
|
|
163
|
-
if (cachedPos == pos && cachedInput == input) return cachedName;
|
|
164
|
-
let next = input.peek(offset);
|
|
165
|
-
while (isSpace(next)) next = input.peek(++offset);
|
|
166
|
-
let name = "";
|
|
167
|
-
for (;;) {
|
|
168
|
-
if (!nameChar(next)) break;
|
|
169
|
-
name += String.fromCharCode(next);
|
|
170
|
-
next = input.peek(++offset);
|
|
171
|
-
}
|
|
172
|
-
// Undefined to signal there's a <? or <!, null for just missing
|
|
173
|
-
cachedInput = input;
|
|
174
|
-
cachedPos = pos;
|
|
175
|
-
return cachedName = name ? name.toLowerCase() : next == question || next == bang ? undefined : null;
|
|
176
|
-
}
|
|
177
|
-
const lessThan = 60,
|
|
178
|
-
greaterThan = 62,
|
|
179
|
-
slash = 47,
|
|
180
|
-
question = 63,
|
|
181
|
-
bang = 33,
|
|
182
|
-
dash$1 = 45;
|
|
183
|
-
function ElementContext(name, parent) {
|
|
184
|
-
this.name = name;
|
|
185
|
-
this.parent = parent;
|
|
186
|
-
this.hash = parent ? parent.hash : 0;
|
|
187
|
-
for (let i = 0; i < name.length; i++) this.hash += (this.hash << 4) + name.charCodeAt(i) + (name.charCodeAt(i) << 8);
|
|
188
|
-
}
|
|
189
|
-
const startTagTerms = [StartTag, StartSelfClosingTag, StartScriptTag, StartStyleTag, StartTextareaTag];
|
|
190
|
-
const elementContext = new ContextTracker({
|
|
191
|
-
start: null,
|
|
192
|
-
shift(context, term, stack, input) {
|
|
193
|
-
return startTagTerms.indexOf(term) > -1 ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
|
|
194
|
-
},
|
|
195
|
-
reduce(context, term) {
|
|
196
|
-
return term == Element$1 && context ? context.parent : context;
|
|
197
|
-
},
|
|
198
|
-
reuse(context, node, stack, input) {
|
|
199
|
-
let type = node.type.id;
|
|
200
|
-
return type == StartTag || type == OpenTag ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
|
|
201
|
-
},
|
|
202
|
-
hash(context) {
|
|
203
|
-
return context ? context.hash : 0;
|
|
204
|
-
},
|
|
205
|
-
strict: false
|
|
206
|
-
});
|
|
207
|
-
const tagStart = new ExternalTokenizer((input, stack) => {
|
|
208
|
-
if (input.next != lessThan) {
|
|
209
|
-
// End of file, close any open tags
|
|
210
|
-
if (input.next < 0 && stack.context) input.acceptToken(missingCloseTag);
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
input.advance();
|
|
214
|
-
let close = input.next == slash;
|
|
215
|
-
if (close) input.advance();
|
|
216
|
-
let name = tagNameAfter(input, 0);
|
|
217
|
-
if (name === undefined) return;
|
|
218
|
-
if (!name) return input.acceptToken(close ? IncompleteCloseTag : StartTag);
|
|
219
|
-
let parent = stack.context ? stack.context.name : null;
|
|
220
|
-
if (close) {
|
|
221
|
-
if (name == parent) return input.acceptToken(StartCloseTag);
|
|
222
|
-
if (parent && implicitlyClosed[parent]) return input.acceptToken(missingCloseTag, -2);
|
|
223
|
-
if (stack.dialectEnabled(Dialect_noMatch)) return input.acceptToken(NoMatchStartCloseTag);
|
|
224
|
-
for (let cx = stack.context; cx; cx = cx.parent) if (cx.name == name) return;
|
|
225
|
-
input.acceptToken(MismatchedStartCloseTag);
|
|
226
|
-
} else {
|
|
227
|
-
if (name == "script") return input.acceptToken(StartScriptTag);
|
|
228
|
-
if (name == "style") return input.acceptToken(StartStyleTag);
|
|
229
|
-
if (name == "textarea") return input.acceptToken(StartTextareaTag);
|
|
230
|
-
if (selfClosers.hasOwnProperty(name)) return input.acceptToken(StartSelfClosingTag);
|
|
231
|
-
if (parent && closeOnOpen[parent] && closeOnOpen[parent][name]) input.acceptToken(missingCloseTag, -1);else input.acceptToken(StartTag);
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
contextual: true
|
|
235
|
-
});
|
|
236
|
-
const commentContent = new ExternalTokenizer(input => {
|
|
237
|
-
for (let dashes = 0, i = 0;; i++) {
|
|
238
|
-
if (input.next < 0) {
|
|
239
|
-
if (i) input.acceptToken(commentContent$1);
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
if (input.next == dash$1) {
|
|
243
|
-
dashes++;
|
|
244
|
-
} else if (input.next == greaterThan && dashes >= 2) {
|
|
245
|
-
if (i > 3) input.acceptToken(commentContent$1, -2);
|
|
246
|
-
break;
|
|
247
|
-
} else {
|
|
248
|
-
dashes = 0;
|
|
249
|
-
}
|
|
250
|
-
input.advance();
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
function contentTokenizer(tag, textToken, endToken) {
|
|
254
|
-
let lastState = 2 + tag.length;
|
|
255
|
-
return new ExternalTokenizer(input => {
|
|
256
|
-
// state means:
|
|
257
|
-
// - 0 nothing matched
|
|
258
|
-
// - 1 '<' matched
|
|
259
|
-
// - 2 '</' + possibly whitespace matched
|
|
260
|
-
// - 3-(1+tag.length) part of the tag matched
|
|
261
|
-
// - lastState whole tag + possibly whitespace matched
|
|
262
|
-
for (let state = 0, matchedLen = 0, i = 0;; i++) {
|
|
263
|
-
if (input.next < 0) {
|
|
264
|
-
if (i) input.acceptToken(textToken);
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
if (state == 0 && input.next == lessThan || state == 1 && input.next == slash || state >= 2 && state < lastState && input.next == tag.charCodeAt(state - 2)) {
|
|
268
|
-
state++;
|
|
269
|
-
matchedLen++;
|
|
270
|
-
} else if ((state == 2 || state == lastState) && isSpace(input.next)) {
|
|
271
|
-
matchedLen++;
|
|
272
|
-
} else if (state == lastState && input.next == greaterThan) {
|
|
273
|
-
if (i > matchedLen) input.acceptToken(textToken, -matchedLen);else input.acceptToken(endToken, -(matchedLen - 2));
|
|
274
|
-
break;
|
|
275
|
-
} else if ((input.next == 10 /* '\n' */ || input.next == 13 /* '\r' */) && i) {
|
|
276
|
-
input.acceptToken(textToken, 1);
|
|
277
|
-
break;
|
|
278
|
-
} else {
|
|
279
|
-
state = matchedLen = 0;
|
|
280
|
-
}
|
|
281
|
-
input.advance();
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
const scriptTokens = contentTokenizer("script", scriptText, StartCloseScriptTag);
|
|
286
|
-
const styleTokens = contentTokenizer("style", styleText, StartCloseStyleTag);
|
|
287
|
-
const textareaTokens = contentTokenizer("textarea", textareaText, StartCloseTextareaTag);
|
|
288
|
-
const htmlHighlighting = styleTags({
|
|
289
|
-
"Text RawText": tags$1.content,
|
|
290
|
-
"StartTag StartCloseTag SelfClosingEndTag EndTag": tags$1.angleBracket,
|
|
291
|
-
TagName: tags$1.tagName,
|
|
292
|
-
"MismatchedCloseTag/TagName": [tags$1.tagName, tags$1.invalid],
|
|
293
|
-
AttributeName: tags$1.attributeName,
|
|
294
|
-
"AttributeValue UnquotedAttributeValue": tags$1.attributeValue,
|
|
295
|
-
Is: tags$1.definitionOperator,
|
|
296
|
-
"EntityReference CharacterReference": tags$1.character,
|
|
297
|
-
Comment: tags$1.blockComment,
|
|
298
|
-
ProcessingInst: tags$1.processingInstruction,
|
|
299
|
-
DoctypeDecl: tags$1.documentMeta
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
303
|
-
const parser$3 = LRParser.deserialize({
|
|
304
|
-
version: 14,
|
|
305
|
-
states: ",xOVOxOOO!WQ!bO'#CoO!]Q!bO'#CyO!bQ!bO'#C|O!gQ!bO'#DPO!lQ!bO'#DRO!qOXO'#CnO!|OYO'#CnO#XO[O'#CnO$eOxO'#CnOOOW'#Cn'#CnO$lO!rO'#DTO$tQ!bO'#DVO$yQ!bO'#DWOOOW'#Dk'#DkOOOW'#DY'#DYQVOxOOO%OQ#tO,59ZO%WQ#tO,59eO%`Q#tO,59hO%hQ#tO,59kO%sQ#tO,59mOOOX'#D^'#D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QO~OfyOj!SOv!TO~OfyOj!TO~O!WfOPkX!ZkX~OP!WO!Z!XO~O!XiOQnX!ZnX~OQ!ZO!Z!XO~O!YlORqX!ZqX~OR!]O!Z!XO~O!Z!XO~P#dOd!_O~O![sO!e!aO~Oj!bO~Oj!cO~Og!dOfeXjeXveX~OfyOj!fO~OfyOj!gO~OfyOj!hO~OfyOj!iOv!jO~OfyOj!jO~Od!kO~Od!lO~Od!mO~Oj!nO~Oi!qO!`!oO!b!pO~Oj!rO~Oj!sO~Oj!tO~O_!uO`!uOa!uO!`!wO!a!uO~O_!xO`!xOa!xO!b!wO!c!xO~O_!uO`!uOa!uO!`!{O!a!uO~O_!xO`!xOa!xO!b!{O!c!xO~Ov~vj`!dx{_a_~",
|
|
307
|
-
goto: "%p!`PPPPPPPPPPPPPPPPPP!a!gP!mPP!yPP!|#P#S#Y#]#`#f#i#l#r#xP!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",
|
|
308
|
-
nodeNames: "⚠ StartCloseTag StartCloseTag StartCloseTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue EndTag ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag SelfClosingEndTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",
|
|
309
|
-
maxTerm: 67,
|
|
310
|
-
context: elementContext,
|
|
311
|
-
nodeProps: [["closedBy", -10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, "EndTag", 4, "EndTag SelfClosingEndTag", -4, 19, 29, 32, 35, "CloseTag"], ["group", -9, 12, 15, 16, 17, 18, 39, 40, 41, 42, "Entity", 14, "Entity TextContent", -3, 27, 30, 33, "TextContent Entity"], ["openedBy", 26, "StartTag StartCloseTag", -4, 28, 31, 34, 36, "OpenTag", 38, "StartTag"]],
|
|
312
|
-
propSources: [htmlHighlighting],
|
|
313
|
-
skippedNodes: [0],
|
|
314
|
-
repeatNodeCount: 9,
|
|
315
|
-
tokenData: "#(r!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q!!O!Q![-_![!]!$c!]!^-_!^!_!(k!_!`#'S!`!a#'z!a!c-_!c!}!$c!}#R-_#R#S!$c#S#T3V#T#o!$c#o#s-_#s$f$q$f%W-_%W%o!$c%o%p-_%p&a!$c&a&b-_&b1p!$c1p4U-_4U4d!$c4d4e-_4e$IS!$c$IS$I`-_$I`$Ib!$c$Ib$Kh-_$Kh%#t!$c%#t&/x-_&/x&Et!$c&Et&FV-_&FV;'S!$c;'S;:j!(e;:j;=`4s<%l?&r-_?&r?Ah!$c?Ah?BY$q?BY?Mn!$c?MnO$q!Z$|c^PiW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX^P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV^P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT^POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({W^P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*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!V#'_XgS^P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!X#(VX^P!a`!cpjUOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",
|
|
316
|
-
tokenizers: [scriptTokens, styleTokens, textareaTokens, tagStart, commentContent, 0, 1, 2, 3, 4, 5],
|
|
317
|
-
topRules: {
|
|
318
|
-
"Document": [0, 13]
|
|
319
|
-
},
|
|
320
|
-
dialects: {
|
|
321
|
-
noMatch: 0,
|
|
322
|
-
selfClosing: 485
|
|
323
|
-
},
|
|
324
|
-
tokenPrec: 487
|
|
325
|
-
});
|
|
326
|
-
function getAttrs(openTag, input) {
|
|
327
|
-
let attrs = Object.create(null);
|
|
328
|
-
for (let att of openTag.getChildren(Attribute)) {
|
|
329
|
-
let name = att.getChild(AttributeName),
|
|
330
|
-
value = att.getChild(AttributeValue) || att.getChild(UnquotedAttributeValue);
|
|
331
|
-
if (name) attrs[input.read(name.from, name.to)] = !value ? "" : value.type.id == AttributeValue ? input.read(value.from + 1, value.to - 1) : input.read(value.from, value.to);
|
|
332
|
-
}
|
|
333
|
-
return attrs;
|
|
334
|
-
}
|
|
335
|
-
function findTagName(openTag, input) {
|
|
336
|
-
let tagNameNode = openTag.getChild(TagName);
|
|
337
|
-
return tagNameNode ? input.read(tagNameNode.from, tagNameNode.to) : " ";
|
|
338
|
-
}
|
|
339
|
-
function maybeNest(node, input, tags) {
|
|
340
|
-
let attrs;
|
|
341
|
-
for (let tag of tags) {
|
|
342
|
-
if (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(node.node.parent.firstChild, input)))) return {
|
|
343
|
-
parser: tag.parser
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
return null;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// tags?: {
|
|
350
|
-
// tag: string,
|
|
351
|
-
// attrs?: ({[attr: string]: string}) => boolean,
|
|
352
|
-
// parser: Parser
|
|
353
|
-
// }[]
|
|
354
|
-
// attributes?: {
|
|
355
|
-
// name: string,
|
|
356
|
-
// tagName?: string,
|
|
357
|
-
// parser: Parser
|
|
358
|
-
// }[]
|
|
359
|
-
|
|
360
|
-
function configureNesting(tags = [], attributes = []) {
|
|
361
|
-
let script = [],
|
|
362
|
-
style = [],
|
|
363
|
-
textarea = [],
|
|
364
|
-
other = [];
|
|
365
|
-
for (let tag of tags) {
|
|
366
|
-
let array = tag.tag == "script" ? script : tag.tag == "style" ? style : tag.tag == "textarea" ? textarea : other;
|
|
367
|
-
array.push(tag);
|
|
368
|
-
}
|
|
369
|
-
let attrs = attributes.length ? Object.create(null) : null;
|
|
370
|
-
for (let attr of attributes) (attrs[attr.name] || (attrs[attr.name] = [])).push(attr);
|
|
371
|
-
return parseMixed((node, input) => {
|
|
372
|
-
let id = node.type.id;
|
|
373
|
-
if (id == ScriptText) return maybeNest(node, input, script);
|
|
374
|
-
if (id == StyleText) return maybeNest(node, input, style);
|
|
375
|
-
if (id == TextareaText) return maybeNest(node, input, textarea);
|
|
376
|
-
if (id == OpenTag && other.length) {
|
|
377
|
-
let n = node.node,
|
|
378
|
-
tagName = findTagName(n, input),
|
|
379
|
-
attrs;
|
|
380
|
-
for (let tag of other) {
|
|
381
|
-
if (tag.tag == tagName && (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(n, input))))) {
|
|
382
|
-
let close = n.parent.lastChild;
|
|
383
|
-
return {
|
|
384
|
-
parser: tag.parser,
|
|
385
|
-
overlay: [{
|
|
386
|
-
from: node.to,
|
|
387
|
-
to: close.type.id == CloseTag ? close.from : n.parent.to
|
|
388
|
-
}]
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
if (attrs && id == Attribute) {
|
|
394
|
-
let n = node.node,
|
|
395
|
-
nameNode;
|
|
396
|
-
if (nameNode = n.firstChild) {
|
|
397
|
-
let matches = attrs[input.read(nameNode.from, nameNode.to)];
|
|
398
|
-
if (matches) for (let attr of matches) {
|
|
399
|
-
if (attr.tagName && attr.tagName != findTagName(n.parent, input)) continue;
|
|
400
|
-
let value = n.lastChild;
|
|
401
|
-
if (value.type.id == AttributeValue) return {
|
|
402
|
-
parser: attr.parser,
|
|
403
|
-
overlay: [{
|
|
404
|
-
from: value.from + 1,
|
|
405
|
-
to: value.to - 1
|
|
406
|
-
}]
|
|
407
|
-
};else if (value.type.id == UnquotedAttributeValue) return {
|
|
408
|
-
parser: attr.parser,
|
|
409
|
-
overlay: [{
|
|
410
|
-
from: value.from,
|
|
411
|
-
to: value.to
|
|
412
|
-
}]
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
return null;
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
422
|
-
const descendantOp = 94,
|
|
423
|
-
Unit = 1,
|
|
424
|
-
callee = 95,
|
|
425
|
-
identifier$2 = 96,
|
|
426
|
-
VariableName = 2;
|
|
427
|
-
|
|
428
|
-
/* Hand-written tokenizers for CSS tokens that can't be
|
|
429
|
-
expressed by Lezer's built-in tokenizer. */
|
|
430
|
-
|
|
431
|
-
const space$1 = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
|
|
432
|
-
const colon = 58,
|
|
433
|
-
parenL = 40,
|
|
434
|
-
underscore = 95,
|
|
435
|
-
bracketL = 91,
|
|
436
|
-
dash = 45,
|
|
437
|
-
period = 46,
|
|
438
|
-
hash = 35,
|
|
439
|
-
percent = 37;
|
|
440
|
-
function isAlpha(ch) {
|
|
441
|
-
return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161;
|
|
442
|
-
}
|
|
443
|
-
function isDigit(ch) {
|
|
444
|
-
return ch >= 48 && ch <= 57;
|
|
445
|
-
}
|
|
446
|
-
const identifiers = new ExternalTokenizer((input, stack) => {
|
|
447
|
-
for (let inside = false, dashes = 0, i = 0;; i++) {
|
|
448
|
-
let {
|
|
449
|
-
next
|
|
450
|
-
} = input;
|
|
451
|
-
if (isAlpha(next) || next == dash || next == underscore || inside && isDigit(next)) {
|
|
452
|
-
if (!inside && (next != dash || i > 0)) inside = true;
|
|
453
|
-
if (dashes === i && next == dash) dashes++;
|
|
454
|
-
input.advance();
|
|
455
|
-
} else {
|
|
456
|
-
if (inside) input.acceptToken(next == parenL ? callee : dashes == 2 && stack.canShift(VariableName) ? VariableName : identifier$2);
|
|
457
|
-
break;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
const descendant = new ExternalTokenizer(input => {
|
|
462
|
-
if (space$1.includes(input.peek(-1))) {
|
|
463
|
-
let {
|
|
464
|
-
next
|
|
465
|
-
} = input;
|
|
466
|
-
if (isAlpha(next) || next == underscore || next == hash || next == period || next == bracketL || next == colon || next == dash) input.acceptToken(descendantOp);
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
const unitToken = new ExternalTokenizer(input => {
|
|
470
|
-
if (!space$1.includes(input.peek(-1))) {
|
|
471
|
-
let {
|
|
472
|
-
next
|
|
473
|
-
} = input;
|
|
474
|
-
if (next == percent) {
|
|
475
|
-
input.advance();
|
|
476
|
-
input.acceptToken(Unit);
|
|
477
|
-
}
|
|
478
|
-
if (isAlpha(next)) {
|
|
479
|
-
do {
|
|
480
|
-
input.advance();
|
|
481
|
-
} while (isAlpha(input.next));
|
|
482
|
-
input.acceptToken(Unit);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
const cssHighlighting = styleTags({
|
|
487
|
-
"AtKeyword import charset namespace keyframes media supports": tags$1.definitionKeyword,
|
|
488
|
-
"from to selector": tags$1.keyword,
|
|
489
|
-
NamespaceName: tags$1.namespace,
|
|
490
|
-
KeyframeName: tags$1.labelName,
|
|
491
|
-
TagName: tags$1.tagName,
|
|
492
|
-
ClassName: tags$1.className,
|
|
493
|
-
PseudoClassName: tags$1.constant(tags$1.className),
|
|
494
|
-
IdName: tags$1.labelName,
|
|
495
|
-
"FeatureName PropertyName": tags$1.propertyName,
|
|
496
|
-
AttributeName: tags$1.attributeName,
|
|
497
|
-
NumberLiteral: tags$1.number,
|
|
498
|
-
KeywordQuery: tags$1.keyword,
|
|
499
|
-
UnaryQueryOp: tags$1.operatorKeyword,
|
|
500
|
-
"CallTag ValueName": tags$1.atom,
|
|
501
|
-
VariableName: tags$1.variableName,
|
|
502
|
-
Callee: tags$1.operatorKeyword,
|
|
503
|
-
Unit: tags$1.unit,
|
|
504
|
-
"UniversalSelector NestingSelector": tags$1.definitionOperator,
|
|
505
|
-
MatchOp: tags$1.compareOperator,
|
|
506
|
-
"ChildOp SiblingOp, LogicOp": tags$1.logicOperator,
|
|
507
|
-
BinOp: tags$1.arithmeticOperator,
|
|
508
|
-
Important: tags$1.modifier,
|
|
509
|
-
Comment: tags$1.blockComment,
|
|
510
|
-
ParenthesizedContent: tags$1.special(tags$1.name),
|
|
511
|
-
ColorLiteral: tags$1.color,
|
|
512
|
-
StringLiteral: tags$1.string,
|
|
513
|
-
":": tags$1.punctuation,
|
|
514
|
-
"PseudoOp #": tags$1.derefOperator,
|
|
515
|
-
"; ,": tags$1.separator,
|
|
516
|
-
"( )": tags$1.paren,
|
|
517
|
-
"[ ]": tags$1.squareBracket,
|
|
518
|
-
"{ }": tags$1.brace
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
522
|
-
const spec_callee = {
|
|
523
|
-
__proto__: null,
|
|
524
|
-
lang: 32,
|
|
525
|
-
"nth-child": 32,
|
|
526
|
-
"nth-last-child": 32,
|
|
527
|
-
"nth-of-type": 32,
|
|
528
|
-
"nth-last-of-type": 32,
|
|
529
|
-
dir: 32,
|
|
530
|
-
"host-context": 32,
|
|
531
|
-
url: 60,
|
|
532
|
-
"url-prefix": 60,
|
|
533
|
-
domain: 60,
|
|
534
|
-
regexp: 60,
|
|
535
|
-
selector: 134
|
|
536
|
-
};
|
|
537
|
-
const spec_AtKeyword = {
|
|
538
|
-
__proto__: null,
|
|
539
|
-
"@import": 114,
|
|
540
|
-
"@media": 138,
|
|
541
|
-
"@charset": 142,
|
|
542
|
-
"@namespace": 146,
|
|
543
|
-
"@keyframes": 152,
|
|
544
|
-
"@supports": 164
|
|
545
|
-
};
|
|
546
|
-
const spec_identifier = {
|
|
547
|
-
__proto__: null,
|
|
548
|
-
not: 128,
|
|
549
|
-
only: 128,
|
|
550
|
-
from: 158,
|
|
551
|
-
to: 160
|
|
552
|
-
};
|
|
553
|
-
const parser$2 = LRParser.deserialize({
|
|
554
|
-
version: 14,
|
|
555
|
-
states: "7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQWO,59SO)UQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)ZQ`O,59oOOQS'#Cp'#CpO$vQdO'#CqO)cQvO'#CsO*pQtO,5:POOQO'#Cx'#CxO)UQWO'#CwO+UQWO'#CyOOQS'#Eg'#EgOOQO'#Dh'#DhO+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S!UR#k!sq!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mp!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mT$R#b$Sq!UY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mp!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mQ!b]R#a!cQyUR!rnQ!qyR#k!rQ|VR!toQ!OWR!upQuTQ!pmQ#^!_Q#d!fQ#e!gR$f$RSfPtQ!lgQ#g!jR$Y#hZePgt!j#ha!^Z_`!S!Y![#X#YR#V!YR!c]R!e^R#c!eQcOSgPtU!hcg#hR#h!jQ#r!{U$^#r$d$mQ$d#yR$m$_Q$`#rR$n$`QmTS!om$[R$[#oQ$W#fR$j$WQ!kfS#i!k#jR#j!lQ#Z!ZR#}#ZQ$S#bR$g$S_bOPcgt!j#h^TOPcgt!j#hQ!nlQ!vqQ!wrQ!xsQ#o!zR$O#]R#s!{Q!SYQ!`[Q#O!QQ#f!i[#q!{#r#y$_$d$mQ#t!}Q#v#QS$U#f$WQ$Z#mR$i$VR#p!zQhPR!ytQ!_ZQ!g`R#R!SU!ZZ`!SQ!f_Q#W!YQ#[![Q#{#XR#|#Y",
|
|
558
|
-
nodeNames: "⚠ Unit VariableName Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent , PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList from to SupportsStatement supports A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
|
|
571
|
-
term: 95,
|
|
572
|
-
get: value => spec_callee[value] || -1
|
|
573
|
-
}, {
|
|
574
|
-
term: 56,
|
|
575
|
-
get: value => spec_AtKeyword[value] || -1
|
|
576
|
-
}, {
|
|
577
|
-
term: 96,
|
|
578
|
-
get: value => spec_identifier[value] || -1
|
|
579
|
-
}],
|
|
580
|
-
tokenPrec: 1123
|
|
581
|
-
});
|
|
582
|
-
|
|
583
|
-
let _properties = null;
|
|
584
|
-
function properties() {
|
|
585
|
-
if (!_properties && typeof document == "object" && document.body) {
|
|
586
|
-
let names = [];
|
|
587
|
-
for (let prop in document.body.style) {
|
|
588
|
-
if (!/[A-Z]|^-|^(item|length)$/.test(prop)) names.push(prop);
|
|
589
|
-
}
|
|
590
|
-
_properties = names.sort().map(name => ({
|
|
591
|
-
type: "property",
|
|
592
|
-
label: name
|
|
593
|
-
}));
|
|
594
|
-
}
|
|
595
|
-
return _properties || [];
|
|
596
|
-
}
|
|
597
|
-
const pseudoClasses = /*@__PURE__*/["active", "after", "before", "checked", "default", "disabled", "empty", "enabled", "first-child", "first-letter", "first-line", "first-of-type", "focus", "hover", "in-range", "indeterminate", "invalid", "lang", "last-child", "last-of-type", "link", "not", "nth-child", "nth-last-child", "nth-last-of-type", "nth-of-type", "only-of-type", "only-child", "optional", "out-of-range", "placeholder", "read-only", "read-write", "required", "root", "selection", "target", "valid", "visited"].map(name => ({
|
|
598
|
-
type: "class",
|
|
599
|
-
label: name
|
|
600
|
-
}));
|
|
601
|
-
const values = /*@__PURE__*/["above", "absolute", "activeborder", "additive", "activecaption", "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", "always", "antialiased", "appworkspace", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "clear", "clip", "close-quote", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "compact", "condensed", "contain", "content", "contents", "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "destination-in", "destination-out", "destination-over", "difference", "disc", "discard", "disclosure-closed", "disclosure-open", "document", "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic-abegede-gez", "ethiopic-halehame-aa-er", "ethiopic-halehame-gez", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", "forwards", "from", "geometricPrecision", "graytext", "grid", "groove", "hand", "hard-light", "help", "hidden", "hide", "higher", "highlight", "highlighttext", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "keep-all", "landscape", "large", "larger", "left", "level", "lighter", "lighten", "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lowercase", "ltr", "luminosity", "manipulation", "match", "matrix", "matrix3d", "medium", "menu", "menutext", "message-box", "middle", "min-intrinsic", "mix", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "n-resize", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "opacity", "open-quote", "optimizeLegibility", "optimizeSpeed", "outset", "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", "painted", "page", "paused", "perspective", "pinch-zoom", "plus-darker", "plus-lighter", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radial-gradient", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "scroll", "scrollbar", "scroll-position", "se-resize", "self-start", "self-end", "semi-condensed", "semi-expanded", "separate", "serif", "show", "single", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square", "start", "static", "status-bar", "stretch", "stroke", "stroke-box", "sub", "subpixel-antialiased", "svg_masks", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "text", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "to", "top", "transform", "translate", "translate3d", "translateX", "translateY", "translateZ", "transparent", "ultra-condensed", "ultra-expanded", "underline", "unidirectional-pan", "unset", "up", "upper-latin", "uppercase", "url", "var", "vertical", "vertical-text", "view-box", "visible", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", "xx-large", "xx-small"].map(name => ({
|
|
602
|
-
type: "keyword",
|
|
603
|
-
label: name
|
|
604
|
-
})).concat( /*@__PURE__*/["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"].map(name => ({
|
|
605
|
-
type: "constant",
|
|
606
|
-
label: name
|
|
607
|
-
})));
|
|
608
|
-
const tags = /*@__PURE__*/["a", "abbr", "address", "article", "aside", "b", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "figcaption", "figure", "footer", "form", "header", "hgroup", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "meter", "nav", "ol", "output", "p", "pre", "ruby", "section", "select", "small", "source", "span", "strong", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "tr", "u", "ul"].map(name => ({
|
|
609
|
-
type: "type",
|
|
610
|
-
label: name
|
|
611
|
-
}));
|
|
612
|
-
const identifier$1 = /^[\w-]*/;
|
|
613
|
-
/**
|
|
614
|
-
CSS property and value keyword completion source.
|
|
615
|
-
*/
|
|
616
|
-
const cssCompletionSource = context => {
|
|
617
|
-
let {
|
|
618
|
-
state,
|
|
619
|
-
pos
|
|
620
|
-
} = context,
|
|
621
|
-
node = syntaxTree(state).resolveInner(pos, -1);
|
|
622
|
-
if (node.name == "PropertyName") return {
|
|
623
|
-
from: node.from,
|
|
624
|
-
options: properties(),
|
|
625
|
-
validFor: identifier$1
|
|
626
|
-
};
|
|
627
|
-
if (node.name == "ValueName") return {
|
|
628
|
-
from: node.from,
|
|
629
|
-
options: values,
|
|
630
|
-
validFor: identifier$1
|
|
631
|
-
};
|
|
632
|
-
if (node.name == "PseudoClassName") return {
|
|
633
|
-
from: node.from,
|
|
634
|
-
options: pseudoClasses,
|
|
635
|
-
validFor: identifier$1
|
|
636
|
-
};
|
|
637
|
-
if (node.name == "TagName") {
|
|
638
|
-
for (let {
|
|
639
|
-
parent
|
|
640
|
-
} = node; parent; parent = parent.parent) if (parent.name == "Block") return {
|
|
641
|
-
from: node.from,
|
|
642
|
-
options: properties(),
|
|
643
|
-
validFor: identifier$1
|
|
644
|
-
};
|
|
645
|
-
return {
|
|
646
|
-
from: node.from,
|
|
647
|
-
options: tags,
|
|
648
|
-
validFor: identifier$1
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
if (!context.explicit) return null;
|
|
652
|
-
let above = node.resolve(pos),
|
|
653
|
-
before = above.childBefore(pos);
|
|
654
|
-
if (before && before.name == ":" && above.name == "PseudoClassSelector") return {
|
|
655
|
-
from: pos,
|
|
656
|
-
options: pseudoClasses,
|
|
657
|
-
validFor: identifier$1
|
|
658
|
-
};
|
|
659
|
-
if (before && before.name == ":" && above.name == "Declaration" || above.name == "ArgList") return {
|
|
660
|
-
from: pos,
|
|
661
|
-
options: values,
|
|
662
|
-
validFor: identifier$1
|
|
663
|
-
};
|
|
664
|
-
if (above.name == "Block") return {
|
|
665
|
-
from: pos,
|
|
666
|
-
options: properties(),
|
|
667
|
-
validFor: identifier$1
|
|
668
|
-
};
|
|
669
|
-
return null;
|
|
670
|
-
};
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
A language provider based on the [Lezer CSS
|
|
674
|
-
parser](https://github.com/lezer-parser/css), extended with
|
|
675
|
-
highlighting and indentation information.
|
|
676
|
-
*/
|
|
677
|
-
const cssLanguage = /*@__PURE__*/LRLanguage.define({
|
|
678
|
-
parser: /*@__PURE__*/parser$2.configure({
|
|
679
|
-
props: [/*@__PURE__*/indentNodeProp.add({
|
|
680
|
-
Declaration: /*@__PURE__*/continuedIndent()
|
|
681
|
-
}), /*@__PURE__*/foldNodeProp.add({
|
|
682
|
-
Block: foldInside
|
|
683
|
-
})]
|
|
684
|
-
}),
|
|
685
|
-
languageData: {
|
|
686
|
-
commentTokens: {
|
|
687
|
-
block: {
|
|
688
|
-
open: "/*",
|
|
689
|
-
close: "*/"
|
|
690
|
-
}
|
|
691
|
-
},
|
|
692
|
-
indentOnInput: /^\s*\}$/,
|
|
693
|
-
wordChars: "-"
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
/**
|
|
697
|
-
Language support for CSS.
|
|
698
|
-
*/
|
|
699
|
-
function css() {
|
|
700
|
-
return new LanguageSupport(cssLanguage, cssLanguage.data.of({
|
|
701
|
-
autocomplete: cssCompletionSource
|
|
702
|
-
}));
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
const Targets = ["_blank", "_self", "_top", "_parent"];
|
|
706
|
-
const Charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
|
|
707
|
-
const Methods = ["get", "post", "put", "delete"];
|
|
708
|
-
const Encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
|
|
709
|
-
const Bool = ["true", "false"];
|
|
710
|
-
const S = {}; // Empty tag spec
|
|
711
|
-
const Tags = {
|
|
712
|
-
a: {
|
|
713
|
-
attrs: {
|
|
714
|
-
href: null,
|
|
715
|
-
ping: null,
|
|
716
|
-
type: null,
|
|
717
|
-
media: null,
|
|
718
|
-
target: Targets,
|
|
719
|
-
hreflang: null
|
|
720
|
-
}
|
|
721
|
-
},
|
|
722
|
-
abbr: S,
|
|
723
|
-
acronym: S,
|
|
724
|
-
address: S,
|
|
725
|
-
applet: S,
|
|
726
|
-
area: {
|
|
727
|
-
attrs: {
|
|
728
|
-
alt: null,
|
|
729
|
-
coords: null,
|
|
730
|
-
href: null,
|
|
731
|
-
target: null,
|
|
732
|
-
ping: null,
|
|
733
|
-
media: null,
|
|
734
|
-
hreflang: null,
|
|
735
|
-
type: null,
|
|
736
|
-
shape: ["default", "rect", "circle", "poly"]
|
|
737
|
-
}
|
|
738
|
-
},
|
|
739
|
-
article: S,
|
|
740
|
-
aside: S,
|
|
741
|
-
audio: {
|
|
742
|
-
attrs: {
|
|
743
|
-
src: null,
|
|
744
|
-
mediagroup: null,
|
|
745
|
-
crossorigin: ["anonymous", "use-credentials"],
|
|
746
|
-
preload: ["none", "metadata", "auto"],
|
|
747
|
-
autoplay: ["autoplay"],
|
|
748
|
-
loop: ["loop"],
|
|
749
|
-
controls: ["controls"]
|
|
750
|
-
}
|
|
751
|
-
},
|
|
752
|
-
b: S,
|
|
753
|
-
base: {
|
|
754
|
-
attrs: {
|
|
755
|
-
href: null,
|
|
756
|
-
target: Targets
|
|
757
|
-
}
|
|
758
|
-
},
|
|
759
|
-
basefont: S,
|
|
760
|
-
bdi: S,
|
|
761
|
-
bdo: S,
|
|
762
|
-
big: S,
|
|
763
|
-
blockquote: {
|
|
764
|
-
attrs: {
|
|
765
|
-
cite: null
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
body: S,
|
|
769
|
-
br: S,
|
|
770
|
-
button: {
|
|
771
|
-
attrs: {
|
|
772
|
-
form: null,
|
|
773
|
-
formaction: null,
|
|
774
|
-
name: null,
|
|
775
|
-
value: null,
|
|
776
|
-
autofocus: ["autofocus"],
|
|
777
|
-
disabled: ["autofocus"],
|
|
778
|
-
formenctype: Encs,
|
|
779
|
-
formmethod: Methods,
|
|
780
|
-
formnovalidate: ["novalidate"],
|
|
781
|
-
formtarget: Targets,
|
|
782
|
-
type: ["submit", "reset", "button"]
|
|
783
|
-
}
|
|
784
|
-
},
|
|
785
|
-
canvas: {
|
|
786
|
-
attrs: {
|
|
787
|
-
width: null,
|
|
788
|
-
height: null
|
|
789
|
-
}
|
|
790
|
-
},
|
|
791
|
-
caption: S,
|
|
792
|
-
center: S,
|
|
793
|
-
cite: S,
|
|
794
|
-
code: S,
|
|
795
|
-
col: {
|
|
796
|
-
attrs: {
|
|
797
|
-
span: null
|
|
798
|
-
}
|
|
799
|
-
},
|
|
800
|
-
colgroup: {
|
|
801
|
-
attrs: {
|
|
802
|
-
span: null
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
command: {
|
|
806
|
-
attrs: {
|
|
807
|
-
type: ["command", "checkbox", "radio"],
|
|
808
|
-
label: null,
|
|
809
|
-
icon: null,
|
|
810
|
-
radiogroup: null,
|
|
811
|
-
command: null,
|
|
812
|
-
title: null,
|
|
813
|
-
disabled: ["disabled"],
|
|
814
|
-
checked: ["checked"]
|
|
815
|
-
}
|
|
816
|
-
},
|
|
817
|
-
data: {
|
|
818
|
-
attrs: {
|
|
819
|
-
value: null
|
|
820
|
-
}
|
|
821
|
-
},
|
|
822
|
-
datagrid: {
|
|
823
|
-
attrs: {
|
|
824
|
-
disabled: ["disabled"],
|
|
825
|
-
multiple: ["multiple"]
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
datalist: {
|
|
829
|
-
attrs: {
|
|
830
|
-
data: null
|
|
831
|
-
}
|
|
832
|
-
},
|
|
833
|
-
dd: S,
|
|
834
|
-
del: {
|
|
835
|
-
attrs: {
|
|
836
|
-
cite: null,
|
|
837
|
-
datetime: null
|
|
838
|
-
}
|
|
839
|
-
},
|
|
840
|
-
details: {
|
|
841
|
-
attrs: {
|
|
842
|
-
open: ["open"]
|
|
843
|
-
}
|
|
844
|
-
},
|
|
845
|
-
dfn: S,
|
|
846
|
-
dir: S,
|
|
847
|
-
div: S,
|
|
848
|
-
dl: S,
|
|
849
|
-
dt: S,
|
|
850
|
-
em: S,
|
|
851
|
-
embed: {
|
|
852
|
-
attrs: {
|
|
853
|
-
src: null,
|
|
854
|
-
type: null,
|
|
855
|
-
width: null,
|
|
856
|
-
height: null
|
|
857
|
-
}
|
|
858
|
-
},
|
|
859
|
-
eventsource: {
|
|
860
|
-
attrs: {
|
|
861
|
-
src: null
|
|
862
|
-
}
|
|
863
|
-
},
|
|
864
|
-
fieldset: {
|
|
865
|
-
attrs: {
|
|
866
|
-
disabled: ["disabled"],
|
|
867
|
-
form: null,
|
|
868
|
-
name: null
|
|
869
|
-
}
|
|
870
|
-
},
|
|
871
|
-
figcaption: S,
|
|
872
|
-
figure: S,
|
|
873
|
-
font: S,
|
|
874
|
-
footer: S,
|
|
875
|
-
form: {
|
|
876
|
-
attrs: {
|
|
877
|
-
action: null,
|
|
878
|
-
name: null,
|
|
879
|
-
"accept-charset": Charsets,
|
|
880
|
-
autocomplete: ["on", "off"],
|
|
881
|
-
enctype: Encs,
|
|
882
|
-
method: Methods,
|
|
883
|
-
novalidate: ["novalidate"],
|
|
884
|
-
target: Targets
|
|
885
|
-
}
|
|
886
|
-
},
|
|
887
|
-
frame: S,
|
|
888
|
-
frameset: S,
|
|
889
|
-
h1: S,
|
|
890
|
-
h2: S,
|
|
891
|
-
h3: S,
|
|
892
|
-
h4: S,
|
|
893
|
-
h5: S,
|
|
894
|
-
h6: S,
|
|
895
|
-
head: {
|
|
896
|
-
children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
|
|
897
|
-
},
|
|
898
|
-
header: S,
|
|
899
|
-
hgroup: S,
|
|
900
|
-
hr: S,
|
|
901
|
-
html: {
|
|
902
|
-
attrs: {
|
|
903
|
-
manifest: null
|
|
904
|
-
}
|
|
905
|
-
},
|
|
906
|
-
i: S,
|
|
907
|
-
iframe: {
|
|
908
|
-
attrs: {
|
|
909
|
-
src: null,
|
|
910
|
-
srcdoc: null,
|
|
911
|
-
name: null,
|
|
912
|
-
width: null,
|
|
913
|
-
height: null,
|
|
914
|
-
sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
|
|
915
|
-
seamless: ["seamless"]
|
|
916
|
-
}
|
|
917
|
-
},
|
|
918
|
-
img: {
|
|
919
|
-
attrs: {
|
|
920
|
-
alt: null,
|
|
921
|
-
src: null,
|
|
922
|
-
ismap: null,
|
|
923
|
-
usemap: null,
|
|
924
|
-
width: null,
|
|
925
|
-
height: null,
|
|
926
|
-
crossorigin: ["anonymous", "use-credentials"]
|
|
927
|
-
}
|
|
928
|
-
},
|
|
929
|
-
input: {
|
|
930
|
-
attrs: {
|
|
931
|
-
alt: null,
|
|
932
|
-
dirname: null,
|
|
933
|
-
form: null,
|
|
934
|
-
formaction: null,
|
|
935
|
-
height: null,
|
|
936
|
-
list: null,
|
|
937
|
-
max: null,
|
|
938
|
-
maxlength: null,
|
|
939
|
-
min: null,
|
|
940
|
-
name: null,
|
|
941
|
-
pattern: null,
|
|
942
|
-
placeholder: null,
|
|
943
|
-
size: null,
|
|
944
|
-
src: null,
|
|
945
|
-
step: null,
|
|
946
|
-
value: null,
|
|
947
|
-
width: null,
|
|
948
|
-
accept: ["audio/*", "video/*", "image/*"],
|
|
949
|
-
autocomplete: ["on", "off"],
|
|
950
|
-
autofocus: ["autofocus"],
|
|
951
|
-
checked: ["checked"],
|
|
952
|
-
disabled: ["disabled"],
|
|
953
|
-
formenctype: Encs,
|
|
954
|
-
formmethod: Methods,
|
|
955
|
-
formnovalidate: ["novalidate"],
|
|
956
|
-
formtarget: Targets,
|
|
957
|
-
multiple: ["multiple"],
|
|
958
|
-
readonly: ["readonly"],
|
|
959
|
-
required: ["required"],
|
|
960
|
-
type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month", "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"]
|
|
961
|
-
}
|
|
962
|
-
},
|
|
963
|
-
ins: {
|
|
964
|
-
attrs: {
|
|
965
|
-
cite: null,
|
|
966
|
-
datetime: null
|
|
967
|
-
}
|
|
968
|
-
},
|
|
969
|
-
kbd: S,
|
|
970
|
-
keygen: {
|
|
971
|
-
attrs: {
|
|
972
|
-
challenge: null,
|
|
973
|
-
form: null,
|
|
974
|
-
name: null,
|
|
975
|
-
autofocus: ["autofocus"],
|
|
976
|
-
disabled: ["disabled"],
|
|
977
|
-
keytype: ["RSA"]
|
|
978
|
-
}
|
|
979
|
-
},
|
|
980
|
-
label: {
|
|
981
|
-
attrs: {
|
|
982
|
-
for: null,
|
|
983
|
-
form: null
|
|
984
|
-
}
|
|
985
|
-
},
|
|
986
|
-
legend: S,
|
|
987
|
-
li: {
|
|
988
|
-
attrs: {
|
|
989
|
-
value: null
|
|
990
|
-
}
|
|
991
|
-
},
|
|
992
|
-
link: {
|
|
993
|
-
attrs: {
|
|
994
|
-
href: null,
|
|
995
|
-
type: null,
|
|
996
|
-
hreflang: null,
|
|
997
|
-
media: null,
|
|
998
|
-
sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
|
|
999
|
-
}
|
|
1000
|
-
},
|
|
1001
|
-
map: {
|
|
1002
|
-
attrs: {
|
|
1003
|
-
name: null
|
|
1004
|
-
}
|
|
1005
|
-
},
|
|
1006
|
-
mark: S,
|
|
1007
|
-
menu: {
|
|
1008
|
-
attrs: {
|
|
1009
|
-
label: null,
|
|
1010
|
-
type: ["list", "context", "toolbar"]
|
|
1011
|
-
}
|
|
1012
|
-
},
|
|
1013
|
-
meta: {
|
|
1014
|
-
attrs: {
|
|
1015
|
-
content: null,
|
|
1016
|
-
charset: Charsets,
|
|
1017
|
-
name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
|
|
1018
|
-
"http-equiv": ["content-language", "content-type", "default-style", "refresh"]
|
|
1019
|
-
}
|
|
1020
|
-
},
|
|
1021
|
-
meter: {
|
|
1022
|
-
attrs: {
|
|
1023
|
-
value: null,
|
|
1024
|
-
min: null,
|
|
1025
|
-
low: null,
|
|
1026
|
-
high: null,
|
|
1027
|
-
max: null,
|
|
1028
|
-
optimum: null
|
|
1029
|
-
}
|
|
1030
|
-
},
|
|
1031
|
-
nav: S,
|
|
1032
|
-
noframes: S,
|
|
1033
|
-
noscript: S,
|
|
1034
|
-
object: {
|
|
1035
|
-
attrs: {
|
|
1036
|
-
data: null,
|
|
1037
|
-
type: null,
|
|
1038
|
-
name: null,
|
|
1039
|
-
usemap: null,
|
|
1040
|
-
form: null,
|
|
1041
|
-
width: null,
|
|
1042
|
-
height: null,
|
|
1043
|
-
typemustmatch: ["typemustmatch"]
|
|
1044
|
-
}
|
|
1045
|
-
},
|
|
1046
|
-
ol: {
|
|
1047
|
-
attrs: {
|
|
1048
|
-
reversed: ["reversed"],
|
|
1049
|
-
start: null,
|
|
1050
|
-
type: ["1", "a", "A", "i", "I"]
|
|
1051
|
-
},
|
|
1052
|
-
children: ["li", "script", "template", "ul", "ol"]
|
|
1053
|
-
},
|
|
1054
|
-
optgroup: {
|
|
1055
|
-
attrs: {
|
|
1056
|
-
disabled: ["disabled"],
|
|
1057
|
-
label: null
|
|
1058
|
-
}
|
|
1059
|
-
},
|
|
1060
|
-
option: {
|
|
1061
|
-
attrs: {
|
|
1062
|
-
disabled: ["disabled"],
|
|
1063
|
-
label: null,
|
|
1064
|
-
selected: ["selected"],
|
|
1065
|
-
value: null
|
|
1066
|
-
}
|
|
1067
|
-
},
|
|
1068
|
-
output: {
|
|
1069
|
-
attrs: {
|
|
1070
|
-
for: null,
|
|
1071
|
-
form: null,
|
|
1072
|
-
name: null
|
|
1073
|
-
}
|
|
1074
|
-
},
|
|
1075
|
-
p: S,
|
|
1076
|
-
param: {
|
|
1077
|
-
attrs: {
|
|
1078
|
-
name: null,
|
|
1079
|
-
value: null
|
|
1080
|
-
}
|
|
1081
|
-
},
|
|
1082
|
-
pre: S,
|
|
1083
|
-
progress: {
|
|
1084
|
-
attrs: {
|
|
1085
|
-
value: null,
|
|
1086
|
-
max: null
|
|
1087
|
-
}
|
|
1088
|
-
},
|
|
1089
|
-
q: {
|
|
1090
|
-
attrs: {
|
|
1091
|
-
cite: null
|
|
1092
|
-
}
|
|
1093
|
-
},
|
|
1094
|
-
rp: S,
|
|
1095
|
-
rt: S,
|
|
1096
|
-
ruby: S,
|
|
1097
|
-
s: S,
|
|
1098
|
-
samp: S,
|
|
1099
|
-
script: {
|
|
1100
|
-
attrs: {
|
|
1101
|
-
type: ["text/javascript"],
|
|
1102
|
-
src: null,
|
|
1103
|
-
async: ["async"],
|
|
1104
|
-
defer: ["defer"],
|
|
1105
|
-
charset: Charsets
|
|
1106
|
-
}
|
|
1107
|
-
},
|
|
1108
|
-
section: S,
|
|
1109
|
-
select: {
|
|
1110
|
-
attrs: {
|
|
1111
|
-
form: null,
|
|
1112
|
-
name: null,
|
|
1113
|
-
size: null,
|
|
1114
|
-
autofocus: ["autofocus"],
|
|
1115
|
-
disabled: ["disabled"],
|
|
1116
|
-
multiple: ["multiple"]
|
|
1117
|
-
}
|
|
1118
|
-
},
|
|
1119
|
-
slot: {
|
|
1120
|
-
attrs: {
|
|
1121
|
-
name: null
|
|
1122
|
-
}
|
|
1123
|
-
},
|
|
1124
|
-
small: S,
|
|
1125
|
-
source: {
|
|
1126
|
-
attrs: {
|
|
1127
|
-
src: null,
|
|
1128
|
-
type: null,
|
|
1129
|
-
media: null
|
|
1130
|
-
}
|
|
1131
|
-
},
|
|
1132
|
-
span: S,
|
|
1133
|
-
strike: S,
|
|
1134
|
-
strong: S,
|
|
1135
|
-
style: {
|
|
1136
|
-
attrs: {
|
|
1137
|
-
type: ["text/css"],
|
|
1138
|
-
media: null,
|
|
1139
|
-
scoped: null
|
|
1140
|
-
}
|
|
1141
|
-
},
|
|
1142
|
-
sub: S,
|
|
1143
|
-
summary: S,
|
|
1144
|
-
sup: S,
|
|
1145
|
-
table: S,
|
|
1146
|
-
tbody: S,
|
|
1147
|
-
td: {
|
|
1148
|
-
attrs: {
|
|
1149
|
-
colspan: null,
|
|
1150
|
-
rowspan: null,
|
|
1151
|
-
headers: null
|
|
1152
|
-
}
|
|
1153
|
-
},
|
|
1154
|
-
template: S,
|
|
1155
|
-
textarea: {
|
|
1156
|
-
attrs: {
|
|
1157
|
-
dirname: null,
|
|
1158
|
-
form: null,
|
|
1159
|
-
maxlength: null,
|
|
1160
|
-
name: null,
|
|
1161
|
-
placeholder: null,
|
|
1162
|
-
rows: null,
|
|
1163
|
-
cols: null,
|
|
1164
|
-
autofocus: ["autofocus"],
|
|
1165
|
-
disabled: ["disabled"],
|
|
1166
|
-
readonly: ["readonly"],
|
|
1167
|
-
required: ["required"],
|
|
1168
|
-
wrap: ["soft", "hard"]
|
|
1169
|
-
}
|
|
1170
|
-
},
|
|
1171
|
-
tfoot: S,
|
|
1172
|
-
th: {
|
|
1173
|
-
attrs: {
|
|
1174
|
-
colspan: null,
|
|
1175
|
-
rowspan: null,
|
|
1176
|
-
headers: null,
|
|
1177
|
-
scope: ["row", "col", "rowgroup", "colgroup"]
|
|
1178
|
-
}
|
|
1179
|
-
},
|
|
1180
|
-
thead: S,
|
|
1181
|
-
time: {
|
|
1182
|
-
attrs: {
|
|
1183
|
-
datetime: null
|
|
1184
|
-
}
|
|
1185
|
-
},
|
|
1186
|
-
title: S,
|
|
1187
|
-
tr: S,
|
|
1188
|
-
track: {
|
|
1189
|
-
attrs: {
|
|
1190
|
-
src: null,
|
|
1191
|
-
label: null,
|
|
1192
|
-
default: null,
|
|
1193
|
-
kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
|
|
1194
|
-
srclang: null
|
|
1195
|
-
}
|
|
1196
|
-
},
|
|
1197
|
-
tt: S,
|
|
1198
|
-
u: S,
|
|
1199
|
-
ul: {
|
|
1200
|
-
children: ["li", "script", "template", "ul", "ol"]
|
|
1201
|
-
},
|
|
1202
|
-
var: S,
|
|
1203
|
-
video: {
|
|
1204
|
-
attrs: {
|
|
1205
|
-
src: null,
|
|
1206
|
-
poster: null,
|
|
1207
|
-
width: null,
|
|
1208
|
-
height: null,
|
|
1209
|
-
crossorigin: ["anonymous", "use-credentials"],
|
|
1210
|
-
preload: ["auto", "metadata", "none"],
|
|
1211
|
-
autoplay: ["autoplay"],
|
|
1212
|
-
mediagroup: ["movie"],
|
|
1213
|
-
muted: ["muted"],
|
|
1214
|
-
controls: ["controls"]
|
|
1215
|
-
}
|
|
1216
|
-
},
|
|
1217
|
-
wbr: S
|
|
1218
|
-
};
|
|
1219
|
-
const GlobalAttrs = {
|
|
1220
|
-
accesskey: null,
|
|
1221
|
-
class: null,
|
|
1222
|
-
contenteditable: Bool,
|
|
1223
|
-
contextmenu: null,
|
|
1224
|
-
dir: ["ltr", "rtl", "auto"],
|
|
1225
|
-
draggable: ["true", "false", "auto"],
|
|
1226
|
-
dropzone: ["copy", "move", "link", "string:", "file:"],
|
|
1227
|
-
hidden: ["hidden"],
|
|
1228
|
-
id: null,
|
|
1229
|
-
inert: ["inert"],
|
|
1230
|
-
itemid: null,
|
|
1231
|
-
itemprop: null,
|
|
1232
|
-
itemref: null,
|
|
1233
|
-
itemscope: ["itemscope"],
|
|
1234
|
-
itemtype: null,
|
|
1235
|
-
lang: ["ar", "bn", "de", "en-GB", "en-US", "es", "fr", "hi", "id", "ja", "pa", "pt", "ru", "tr", "zh"],
|
|
1236
|
-
spellcheck: Bool,
|
|
1237
|
-
autocorrect: Bool,
|
|
1238
|
-
autocapitalize: Bool,
|
|
1239
|
-
style: null,
|
|
1240
|
-
tabindex: null,
|
|
1241
|
-
title: null,
|
|
1242
|
-
translate: ["yes", "no"],
|
|
1243
|
-
onclick: null,
|
|
1244
|
-
rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"],
|
|
1245
|
-
role: /*@__PURE__*/"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),
|
|
1246
|
-
"aria-activedescendant": null,
|
|
1247
|
-
"aria-atomic": Bool,
|
|
1248
|
-
"aria-autocomplete": ["inline", "list", "both", "none"],
|
|
1249
|
-
"aria-busy": Bool,
|
|
1250
|
-
"aria-checked": ["true", "false", "mixed", "undefined"],
|
|
1251
|
-
"aria-controls": null,
|
|
1252
|
-
"aria-describedby": null,
|
|
1253
|
-
"aria-disabled": Bool,
|
|
1254
|
-
"aria-dropeffect": null,
|
|
1255
|
-
"aria-expanded": ["true", "false", "undefined"],
|
|
1256
|
-
"aria-flowto": null,
|
|
1257
|
-
"aria-grabbed": ["true", "false", "undefined"],
|
|
1258
|
-
"aria-haspopup": Bool,
|
|
1259
|
-
"aria-hidden": Bool,
|
|
1260
|
-
"aria-invalid": ["true", "false", "grammar", "spelling"],
|
|
1261
|
-
"aria-label": null,
|
|
1262
|
-
"aria-labelledby": null,
|
|
1263
|
-
"aria-level": null,
|
|
1264
|
-
"aria-live": ["off", "polite", "assertive"],
|
|
1265
|
-
"aria-multiline": Bool,
|
|
1266
|
-
"aria-multiselectable": Bool,
|
|
1267
|
-
"aria-owns": null,
|
|
1268
|
-
"aria-posinset": null,
|
|
1269
|
-
"aria-pressed": ["true", "false", "mixed", "undefined"],
|
|
1270
|
-
"aria-readonly": Bool,
|
|
1271
|
-
"aria-relevant": null,
|
|
1272
|
-
"aria-required": Bool,
|
|
1273
|
-
"aria-selected": ["true", "false", "undefined"],
|
|
1274
|
-
"aria-setsize": null,
|
|
1275
|
-
"aria-sort": ["ascending", "descending", "none", "other"],
|
|
1276
|
-
"aria-valuemax": null,
|
|
1277
|
-
"aria-valuemin": null,
|
|
1278
|
-
"aria-valuenow": null,
|
|
1279
|
-
"aria-valuetext": null
|
|
1280
|
-
};
|
|
1281
|
-
class Schema {
|
|
1282
|
-
constructor(extraTags, extraAttrs) {
|
|
1283
|
-
this.tags = Object.assign(Object.assign({}, Tags), extraTags);
|
|
1284
|
-
this.globalAttrs = Object.assign(Object.assign({}, GlobalAttrs), extraAttrs);
|
|
1285
|
-
this.allTags = Object.keys(this.tags);
|
|
1286
|
-
this.globalAttrNames = Object.keys(this.globalAttrs);
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
Schema.default = /*@__PURE__*/new Schema();
|
|
1290
|
-
function elementName(doc, tree, max = doc.length) {
|
|
1291
|
-
if (!tree) return "";
|
|
1292
|
-
let tag = tree.firstChild;
|
|
1293
|
-
let name = tag && tag.getChild("TagName");
|
|
1294
|
-
return name ? doc.sliceString(name.from, Math.min(name.to, max)) : "";
|
|
1295
|
-
}
|
|
1296
|
-
function findParentElement(tree, skip = false) {
|
|
1297
|
-
for (let cur = tree.parent; cur; cur = cur.parent) if (cur.name == "Element") {
|
|
1298
|
-
if (skip) skip = false;else return cur;
|
|
1299
|
-
}
|
|
1300
|
-
return null;
|
|
1301
|
-
}
|
|
1302
|
-
function allowedChildren(doc, tree, schema) {
|
|
1303
|
-
let parentInfo = schema.tags[elementName(doc, findParentElement(tree, true))];
|
|
1304
|
-
return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags;
|
|
1305
|
-
}
|
|
1306
|
-
function openTags(doc, tree) {
|
|
1307
|
-
let open = [];
|
|
1308
|
-
for (let parent = tree; parent = findParentElement(parent);) {
|
|
1309
|
-
let tagName = elementName(doc, parent);
|
|
1310
|
-
if (tagName && parent.lastChild.name == "CloseTag") break;
|
|
1311
|
-
if (tagName && open.indexOf(tagName) < 0 && (tree.name == "EndTag" || tree.from >= parent.firstChild.to)) open.push(tagName);
|
|
1312
|
-
}
|
|
1313
|
-
return open;
|
|
1314
|
-
}
|
|
1315
|
-
const identifier = /^[:\-\.\w\u00b7-\uffff]*$/;
|
|
1316
|
-
function completeTag(state, schema, tree, from, to) {
|
|
1317
|
-
let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
|
|
1318
|
-
return {
|
|
1319
|
-
from,
|
|
1320
|
-
to,
|
|
1321
|
-
options: allowedChildren(state.doc, tree, schema).map(tagName => ({
|
|
1322
|
-
label: tagName,
|
|
1323
|
-
type: "type"
|
|
1324
|
-
})).concat(openTags(state.doc, tree).map((tag, i) => ({
|
|
1325
|
-
label: "/" + tag,
|
|
1326
|
-
apply: "/" + tag + end,
|
|
1327
|
-
type: "type",
|
|
1328
|
-
boost: 99 - i
|
|
1329
|
-
}))),
|
|
1330
|
-
validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
function completeCloseTag(state, tree, from, to) {
|
|
1334
|
-
let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
|
|
1335
|
-
return {
|
|
1336
|
-
from,
|
|
1337
|
-
to,
|
|
1338
|
-
options: openTags(state.doc, tree).map((tag, i) => ({
|
|
1339
|
-
label: tag,
|
|
1340
|
-
apply: tag + end,
|
|
1341
|
-
type: "type",
|
|
1342
|
-
boost: 99 - i
|
|
1343
|
-
})),
|
|
1344
|
-
validFor: identifier
|
|
1345
|
-
};
|
|
1346
|
-
}
|
|
1347
|
-
function completeStartTag(state, schema, tree, pos) {
|
|
1348
|
-
let options = [],
|
|
1349
|
-
level = 0;
|
|
1350
|
-
for (let tagName of allowedChildren(state.doc, tree, schema)) options.push({
|
|
1351
|
-
label: "<" + tagName,
|
|
1352
|
-
type: "type"
|
|
1353
|
-
});
|
|
1354
|
-
for (let open of openTags(state.doc, tree)) options.push({
|
|
1355
|
-
label: "</" + open + ">",
|
|
1356
|
-
type: "type",
|
|
1357
|
-
boost: 99 - level++
|
|
1358
|
-
});
|
|
1359
|
-
return {
|
|
1360
|
-
from: pos,
|
|
1361
|
-
to: pos,
|
|
1362
|
-
options,
|
|
1363
|
-
validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
|
-
function completeAttrName(state, schema, tree, from, to) {
|
|
1367
|
-
let elt = findParentElement(tree),
|
|
1368
|
-
info = elt ? schema.tags[elementName(state.doc, elt)] : null;
|
|
1369
|
-
let names = info && info.attrs ? Object.keys(info.attrs).concat(schema.globalAttrNames) : schema.globalAttrNames;
|
|
1370
|
-
return {
|
|
1371
|
-
from,
|
|
1372
|
-
to,
|
|
1373
|
-
options: names.map(attrName => ({
|
|
1374
|
-
label: attrName,
|
|
1375
|
-
type: "property"
|
|
1376
|
-
})),
|
|
1377
|
-
validFor: identifier
|
|
1378
|
-
};
|
|
1379
|
-
}
|
|
1380
|
-
function completeAttrValue(state, schema, tree, from, to) {
|
|
1381
|
-
var _a;
|
|
1382
|
-
let nameNode = (_a = tree.parent) === null || _a === void 0 ? void 0 : _a.getChild("AttributeName");
|
|
1383
|
-
let options = [],
|
|
1384
|
-
token = undefined;
|
|
1385
|
-
if (nameNode) {
|
|
1386
|
-
let attrName = state.sliceDoc(nameNode.from, nameNode.to);
|
|
1387
|
-
let attrs = schema.globalAttrs[attrName];
|
|
1388
|
-
if (!attrs) {
|
|
1389
|
-
let elt = findParentElement(tree),
|
|
1390
|
-
info = elt ? schema.tags[elementName(state.doc, elt)] : null;
|
|
1391
|
-
attrs = (info === null || info === void 0 ? void 0 : info.attrs) && info.attrs[attrName];
|
|
1392
|
-
}
|
|
1393
|
-
if (attrs) {
|
|
1394
|
-
let base = state.sliceDoc(from, to).toLowerCase(),
|
|
1395
|
-
quoteStart = '"',
|
|
1396
|
-
quoteEnd = '"';
|
|
1397
|
-
if (/^['"]/.test(base)) {
|
|
1398
|
-
token = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/;
|
|
1399
|
-
quoteStart = "";
|
|
1400
|
-
quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? "" : base[0];
|
|
1401
|
-
base = base.slice(1);
|
|
1402
|
-
from++;
|
|
1403
|
-
} else {
|
|
1404
|
-
token = /^[^\s<>='"]*$/;
|
|
1405
|
-
}
|
|
1406
|
-
for (let value of attrs) options.push({
|
|
1407
|
-
label: value,
|
|
1408
|
-
apply: quoteStart + value + quoteEnd,
|
|
1409
|
-
type: "constant"
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
return {
|
|
1414
|
-
from,
|
|
1415
|
-
to,
|
|
1416
|
-
options,
|
|
1417
|
-
validFor: token
|
|
1418
|
-
};
|
|
1419
|
-
}
|
|
1420
|
-
function htmlCompletionFor(schema, context) {
|
|
1421
|
-
let {
|
|
1422
|
-
state,
|
|
1423
|
-
pos
|
|
1424
|
-
} = context,
|
|
1425
|
-
around = syntaxTree(state).resolveInner(pos),
|
|
1426
|
-
tree = around.resolve(pos, -1);
|
|
1427
|
-
for (let scan = pos, before; around == tree && (before = tree.childBefore(scan));) {
|
|
1428
|
-
let last = before.lastChild;
|
|
1429
|
-
if (!last || !last.type.isError || last.from < last.to) break;
|
|
1430
|
-
around = tree = before;
|
|
1431
|
-
scan = last.from;
|
|
1432
|
-
}
|
|
1433
|
-
if (tree.name == "TagName") {
|
|
1434
|
-
return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos) : completeTag(state, schema, tree, tree.from, pos);
|
|
1435
|
-
} else if (tree.name == "StartTag") {
|
|
1436
|
-
return completeTag(state, schema, tree, pos, pos);
|
|
1437
|
-
} else if (tree.name == "StartCloseTag" || tree.name == "IncompleteCloseTag") {
|
|
1438
|
-
return completeCloseTag(state, tree, pos, pos);
|
|
1439
|
-
} else if (context.explicit && (tree.name == "OpenTag" || tree.name == "SelfClosingTag") || tree.name == "AttributeName") {
|
|
1440
|
-
return completeAttrName(state, schema, tree, tree.name == "AttributeName" ? tree.from : pos, pos);
|
|
1441
|
-
} else if (tree.name == "Is" || tree.name == "AttributeValue" || tree.name == "UnquotedAttributeValue") {
|
|
1442
|
-
return completeAttrValue(state, schema, tree, tree.name == "Is" ? pos : tree.from, pos);
|
|
1443
|
-
} else if (context.explicit && (around.name == "Element" || around.name == "Text" || around.name == "Document")) {
|
|
1444
|
-
return completeStartTag(state, schema, tree, pos);
|
|
1445
|
-
} else {
|
|
1446
|
-
return null;
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
/**
|
|
1450
|
-
Create a completion source for HTML extended with additional tags
|
|
1451
|
-
or attributes.
|
|
1452
|
-
*/
|
|
1453
|
-
function htmlCompletionSourceWith(config) {
|
|
1454
|
-
let {
|
|
1455
|
-
extraTags,
|
|
1456
|
-
extraGlobalAttributes: extraAttrs
|
|
1457
|
-
} = config;
|
|
1458
|
-
let schema = extraAttrs || extraTags ? new Schema(extraTags, extraAttrs) : Schema.default;
|
|
1459
|
-
return context => htmlCompletionFor(schema, context);
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
/**
|
|
1463
|
-
A language provider based on the [Lezer HTML
|
|
1464
|
-
parser](https://github.com/lezer-parser/html), extended with the
|
|
1465
|
-
JavaScript and CSS parsers to parse the content of `<script>` and
|
|
1466
|
-
`<style>` tags.
|
|
1467
|
-
*/
|
|
1468
|
-
const htmlLanguage = /*@__PURE__*/LRLanguage.define({
|
|
1469
|
-
parser: /*@__PURE__*/parser$3.configure({
|
|
1470
|
-
props: [/*@__PURE__*/indentNodeProp.add({
|
|
1471
|
-
Element(context) {
|
|
1472
|
-
let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
1473
|
-
if (context.node.to <= context.pos + after[0].length) return context.continue();
|
|
1474
|
-
return context.lineIndent(context.node.from) + (after[2] ? 0 : context.unit);
|
|
1475
|
-
},
|
|
1476
|
-
"OpenTag CloseTag SelfClosingTag"(context) {
|
|
1477
|
-
return context.column(context.node.from) + context.unit;
|
|
1478
|
-
},
|
|
1479
|
-
Document(context) {
|
|
1480
|
-
if (context.pos + /\s*/.exec(context.textAfter)[0].length < context.node.to) return context.continue();
|
|
1481
|
-
let endElt = null,
|
|
1482
|
-
close;
|
|
1483
|
-
for (let cur = context.node;;) {
|
|
1484
|
-
let last = cur.lastChild;
|
|
1485
|
-
if (!last || last.name != "Element" || last.to != cur.to) break;
|
|
1486
|
-
endElt = cur = last;
|
|
1487
|
-
}
|
|
1488
|
-
if (endElt && !((close = endElt.lastChild) && (close.name == "CloseTag" || close.name == "SelfClosingTag"))) return context.lineIndent(endElt.from) + context.unit;
|
|
1489
|
-
return null;
|
|
1490
|
-
}
|
|
1491
|
-
}), /*@__PURE__*/foldNodeProp.add({
|
|
1492
|
-
Element(node) {
|
|
1493
|
-
let first = node.firstChild,
|
|
1494
|
-
last = node.lastChild;
|
|
1495
|
-
if (!first || first.name != "OpenTag") return null;
|
|
1496
|
-
return {
|
|
1497
|
-
from: first.to,
|
|
1498
|
-
to: last.name == "CloseTag" ? last.from : node.to
|
|
1499
|
-
};
|
|
1500
|
-
}
|
|
1501
|
-
})],
|
|
1502
|
-
wrap: /*@__PURE__*/configureNesting([{
|
|
1503
|
-
tag: "script",
|
|
1504
|
-
attrs(attrs) {
|
|
1505
|
-
return !attrs.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type);
|
|
1506
|
-
},
|
|
1507
|
-
parser: javascriptLanguage.parser
|
|
1508
|
-
}, {
|
|
1509
|
-
tag: "style",
|
|
1510
|
-
attrs(attrs) {
|
|
1511
|
-
return (!attrs.lang || attrs.lang == "css") && (!attrs.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(attrs.type));
|
|
1512
|
-
},
|
|
1513
|
-
parser: cssLanguage.parser
|
|
1514
|
-
}])
|
|
1515
|
-
}),
|
|
1516
|
-
languageData: {
|
|
1517
|
-
commentTokens: {
|
|
1518
|
-
block: {
|
|
1519
|
-
open: "<!--",
|
|
1520
|
-
close: "-->"
|
|
1521
|
-
}
|
|
1522
|
-
},
|
|
1523
|
-
indentOnInput: /^\s*<\/\w+\W$/,
|
|
1524
|
-
wordChars: "-._"
|
|
1525
|
-
}
|
|
1526
|
-
});
|
|
1527
|
-
/**
|
|
1528
|
-
Language support for HTML, including
|
|
1529
|
-
[`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and
|
|
1530
|
-
CSS support extensions.
|
|
1531
|
-
*/
|
|
1532
|
-
function html(config = {}) {
|
|
1533
|
-
let lang = htmlLanguage;
|
|
1534
|
-
if (config.matchClosingTags === false) lang = lang.configure({
|
|
1535
|
-
dialect: "noMatch"
|
|
1536
|
-
});
|
|
1537
|
-
return new LanguageSupport(lang, [htmlLanguage.data.of({
|
|
1538
|
-
autocomplete: htmlCompletionSourceWith(config)
|
|
1539
|
-
}), config.autoCloseTags !== false ? autoCloseTags : [], javascript().support, css().support]);
|
|
1540
|
-
}
|
|
1541
|
-
/**
|
|
1542
|
-
Extension that will automatically insert close tags when a `>` or
|
|
1543
|
-
`/` is typed.
|
|
1544
|
-
*/
|
|
1545
|
-
const autoCloseTags = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, text) => {
|
|
1546
|
-
if (view.composing || view.state.readOnly || from != to || text != ">" && text != "/" || !htmlLanguage.isActiveAt(view.state, from, -1)) return false;
|
|
1547
|
-
let {
|
|
1548
|
-
state
|
|
1549
|
-
} = view;
|
|
1550
|
-
let changes = state.changeByRange(range => {
|
|
1551
|
-
var _a, _b, _c;
|
|
1552
|
-
let {
|
|
1553
|
-
head
|
|
1554
|
-
} = range,
|
|
1555
|
-
around = syntaxTree(state).resolveInner(head, -1),
|
|
1556
|
-
name;
|
|
1557
|
-
if (around.name == "TagName" || around.name == "StartTag") around = around.parent;
|
|
1558
|
-
if (text == ">" && around.name == "OpenTag") {
|
|
1559
|
-
if (((_b = (_a = around.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "CloseTag" && (name = elementName(state.doc, around.parent, head))) return {
|
|
1560
|
-
range: EditorSelection.cursor(head + 1),
|
|
1561
|
-
changes: {
|
|
1562
|
-
from: head,
|
|
1563
|
-
insert: `></${name}>`
|
|
1564
|
-
}
|
|
1565
|
-
};
|
|
1566
|
-
} else if (text == "/" && around.name == "OpenTag") {
|
|
1567
|
-
let empty = around.parent,
|
|
1568
|
-
base = empty === null || empty === void 0 ? void 0 : empty.parent;
|
|
1569
|
-
if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name = elementName(state.doc, base, head))) {
|
|
1570
|
-
let insert = `/${name}>`;
|
|
1571
|
-
return {
|
|
1572
|
-
range: EditorSelection.cursor(head + insert.length),
|
|
1573
|
-
changes: {
|
|
1574
|
-
from: head,
|
|
1575
|
-
insert
|
|
1576
|
-
}
|
|
1577
|
-
};
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
return {
|
|
1581
|
-
range
|
|
1582
|
-
};
|
|
1583
|
-
});
|
|
1584
|
-
if (changes.changes.empty) return false;
|
|
1585
|
-
view.dispatch(changes, {
|
|
1586
|
-
userEvent: "input.type",
|
|
1587
|
-
scrollIntoView: true
|
|
1588
|
-
});
|
|
1589
|
-
return true;
|
|
1590
|
-
});
|
|
1591
|
-
|
|
1592
|
-
const jsonHighlighting = styleTags({
|
|
1593
|
-
String: tags$1.string,
|
|
1594
|
-
Number: tags$1.number,
|
|
1595
|
-
"True False": tags$1.bool,
|
|
1596
|
-
PropertyName: tags$1.propertyName,
|
|
1597
|
-
Null: tags$1.null,
|
|
1598
|
-
",": tags$1.separator,
|
|
1599
|
-
"[ ]": tags$1.squareBracket,
|
|
1600
|
-
"{ }": tags$1.brace
|
|
1601
|
-
});
|
|
1602
|
-
|
|
1603
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
1604
|
-
const parser$1 = LRParser.deserialize({
|
|
1605
|
-
version: 14,
|
|
1606
|
-
states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",
|
|
1607
|
-
stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",
|
|
1608
|
-
goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
|
|
1609
|
-
nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",
|
|
1610
|
-
maxTerm: 25,
|
|
1611
|
-
nodeProps: [["openedBy", 7, "{", 12, "["], ["closedBy", 8, "}", 13, "]"]],
|
|
1612
|
-
propSources: [jsonHighlighting],
|
|
1613
|
-
skippedNodes: [0],
|
|
1614
|
-
repeatNodeCount: 2,
|
|
1615
|
-
tokenData: "(p~RaXY!WYZ!W]^!Wpq!Wrs!]|}$i}!O$n!Q!R$w!R![&V![!]&h!}#O&m#P#Q&r#Y#Z&w#b#c'f#h#i'}#o#p(f#q#r(k~!]Oc~~!`Upq!]qr!]rs!rs#O!]#O#P!w#P~!]~!wOe~~!zXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#g~#jR!Q![#s!c!i#s#T#Z#s~#vR!Q![$P!c!i$P#T#Z$P~$SR!Q![$]!c!i$]#T#Z$]~$`R!Q![!]!c!i!]#T#Z!]~$nOh~~$qQ!Q!R$w!R![&V~$|RT~!O!P%V!g!h%k#X#Y%k~%YP!Q![%]~%bRT~!Q![%]!g!h%k#X#Y%k~%nR{|%w}!O%w!Q![%}~%zP!Q![%}~&SPT~!Q![%}~&[ST~!O!P%V!Q![&V!g!h%k#X#Y%k~&mOg~~&rO]~~&wO[~~&zP#T#U&}~'QP#`#a'T~'WP#g#h'Z~'^P#X#Y'a~'fOR~~'iP#i#j'l~'oP#`#a'r~'uP#`#a'x~'}OS~~(QP#f#g(T~(WP#i#j(Z~(^P#X#Y(a~(fOQ~~(kOW~~(pOV~",
|
|
1616
|
-
tokenizers: [0],
|
|
1617
|
-
topRules: {
|
|
1618
|
-
"JsonText": [0, 1]
|
|
1619
|
-
},
|
|
1620
|
-
tokenPrec: 0
|
|
1621
|
-
});
|
|
1622
|
-
|
|
1623
|
-
/**
|
|
1624
|
-
A language provider that provides JSON parsing.
|
|
1625
|
-
*/
|
|
1626
|
-
const jsonLanguage = /*@__PURE__*/LRLanguage.define({
|
|
1627
|
-
parser: /*@__PURE__*/parser$1.configure({
|
|
1628
|
-
props: [/*@__PURE__*/indentNodeProp.add({
|
|
1629
|
-
Object: /*@__PURE__*/continuedIndent({
|
|
1630
|
-
except: /^\s*\}/
|
|
1631
|
-
}),
|
|
1632
|
-
Array: /*@__PURE__*/continuedIndent({
|
|
1633
|
-
except: /^\s*\]/
|
|
1634
|
-
})
|
|
1635
|
-
}), /*@__PURE__*/foldNodeProp.add({
|
|
1636
|
-
"Object Array": foldInside
|
|
1637
|
-
})]
|
|
1638
|
-
}),
|
|
1639
|
-
languageData: {
|
|
1640
|
-
closeBrackets: {
|
|
1641
|
-
brackets: ["[", "{", '"']
|
|
1642
|
-
},
|
|
1643
|
-
indentOnInput: /^\s*[\}\]]$/
|
|
1644
|
-
}
|
|
1645
|
-
});
|
|
1646
|
-
/**
|
|
1647
|
-
JSON language support.
|
|
1648
|
-
*/
|
|
1649
|
-
function json() {
|
|
1650
|
-
return new LanguageSupport(jsonLanguage);
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
class CompositeBlock {
|
|
1654
|
-
constructor(type,
|
|
1655
|
-
// Used for indentation in list items, markup character in lists
|
|
1656
|
-
value, from, hash, end, children, positions) {
|
|
1657
|
-
this.type = type;
|
|
1658
|
-
this.value = value;
|
|
1659
|
-
this.from = from;
|
|
1660
|
-
this.hash = hash;
|
|
1661
|
-
this.end = end;
|
|
1662
|
-
this.children = children;
|
|
1663
|
-
this.positions = positions;
|
|
1664
|
-
this.hashProp = [[NodeProp.contextHash, hash]];
|
|
1665
|
-
}
|
|
1666
|
-
static create(type, value, from, parentHash, end) {
|
|
1667
|
-
let hash = parentHash + (parentHash << 8) + type + (value << 4) | 0;
|
|
1668
|
-
return new CompositeBlock(type, value, from, hash, end, [], []);
|
|
1669
|
-
}
|
|
1670
|
-
addChild(child, pos) {
|
|
1671
|
-
if (child.prop(NodeProp.contextHash) != this.hash) child = new Tree(child.type, child.children, child.positions, child.length, this.hashProp);
|
|
1672
|
-
this.children.push(child);
|
|
1673
|
-
this.positions.push(pos);
|
|
1674
|
-
}
|
|
1675
|
-
toTree(nodeSet, end = this.end) {
|
|
1676
|
-
let last = this.children.length - 1;
|
|
1677
|
-
if (last >= 0) end = Math.max(end, this.positions[last] + this.children[last].length + this.from);
|
|
1678
|
-
let tree = new Tree(nodeSet.types[this.type], this.children, this.positions, end - this.from).balance({
|
|
1679
|
-
makeTree: (children, positions, length) => new Tree(NodeType.none, children, positions, length, this.hashProp)
|
|
1680
|
-
});
|
|
1681
|
-
return tree;
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
var Type;
|
|
1685
|
-
(function (Type) {
|
|
1686
|
-
Type[Type["Document"] = 1] = "Document";
|
|
1687
|
-
Type[Type["CodeBlock"] = 2] = "CodeBlock";
|
|
1688
|
-
Type[Type["FencedCode"] = 3] = "FencedCode";
|
|
1689
|
-
Type[Type["Blockquote"] = 4] = "Blockquote";
|
|
1690
|
-
Type[Type["HorizontalRule"] = 5] = "HorizontalRule";
|
|
1691
|
-
Type[Type["BulletList"] = 6] = "BulletList";
|
|
1692
|
-
Type[Type["OrderedList"] = 7] = "OrderedList";
|
|
1693
|
-
Type[Type["ListItem"] = 8] = "ListItem";
|
|
1694
|
-
Type[Type["ATXHeading1"] = 9] = "ATXHeading1";
|
|
1695
|
-
Type[Type["ATXHeading2"] = 10] = "ATXHeading2";
|
|
1696
|
-
Type[Type["ATXHeading3"] = 11] = "ATXHeading3";
|
|
1697
|
-
Type[Type["ATXHeading4"] = 12] = "ATXHeading4";
|
|
1698
|
-
Type[Type["ATXHeading5"] = 13] = "ATXHeading5";
|
|
1699
|
-
Type[Type["ATXHeading6"] = 14] = "ATXHeading6";
|
|
1700
|
-
Type[Type["SetextHeading1"] = 15] = "SetextHeading1";
|
|
1701
|
-
Type[Type["SetextHeading2"] = 16] = "SetextHeading2";
|
|
1702
|
-
Type[Type["HTMLBlock"] = 17] = "HTMLBlock";
|
|
1703
|
-
Type[Type["LinkReference"] = 18] = "LinkReference";
|
|
1704
|
-
Type[Type["Paragraph"] = 19] = "Paragraph";
|
|
1705
|
-
Type[Type["CommentBlock"] = 20] = "CommentBlock";
|
|
1706
|
-
Type[Type["ProcessingInstructionBlock"] = 21] = "ProcessingInstructionBlock";
|
|
1707
|
-
// Inline
|
|
1708
|
-
Type[Type["Escape"] = 22] = "Escape";
|
|
1709
|
-
Type[Type["Entity"] = 23] = "Entity";
|
|
1710
|
-
Type[Type["HardBreak"] = 24] = "HardBreak";
|
|
1711
|
-
Type[Type["Emphasis"] = 25] = "Emphasis";
|
|
1712
|
-
Type[Type["StrongEmphasis"] = 26] = "StrongEmphasis";
|
|
1713
|
-
Type[Type["Link"] = 27] = "Link";
|
|
1714
|
-
Type[Type["Image"] = 28] = "Image";
|
|
1715
|
-
Type[Type["InlineCode"] = 29] = "InlineCode";
|
|
1716
|
-
Type[Type["HTMLTag"] = 30] = "HTMLTag";
|
|
1717
|
-
Type[Type["Comment"] = 31] = "Comment";
|
|
1718
|
-
Type[Type["ProcessingInstruction"] = 32] = "ProcessingInstruction";
|
|
1719
|
-
Type[Type["URL"] = 33] = "URL";
|
|
1720
|
-
// Smaller tokens
|
|
1721
|
-
Type[Type["HeaderMark"] = 34] = "HeaderMark";
|
|
1722
|
-
Type[Type["QuoteMark"] = 35] = "QuoteMark";
|
|
1723
|
-
Type[Type["ListMark"] = 36] = "ListMark";
|
|
1724
|
-
Type[Type["LinkMark"] = 37] = "LinkMark";
|
|
1725
|
-
Type[Type["EmphasisMark"] = 38] = "EmphasisMark";
|
|
1726
|
-
Type[Type["CodeMark"] = 39] = "CodeMark";
|
|
1727
|
-
Type[Type["CodeText"] = 40] = "CodeText";
|
|
1728
|
-
Type[Type["CodeInfo"] = 41] = "CodeInfo";
|
|
1729
|
-
Type[Type["LinkTitle"] = 42] = "LinkTitle";
|
|
1730
|
-
Type[Type["LinkLabel"] = 43] = "LinkLabel";
|
|
1731
|
-
})(Type || (Type = {}));
|
|
1732
|
-
/// Data structure used to accumulate a block's content during [leaf
|
|
1733
|
-
/// block parsing](#BlockParser.leaf).
|
|
1734
|
-
class LeafBlock {
|
|
1735
|
-
/// @internal
|
|
1736
|
-
constructor(
|
|
1737
|
-
/// The start position of the block.
|
|
1738
|
-
start,
|
|
1739
|
-
/// The block's text content.
|
|
1740
|
-
content) {
|
|
1741
|
-
this.start = start;
|
|
1742
|
-
this.content = content;
|
|
1743
|
-
/// @internal
|
|
1744
|
-
this.marks = [];
|
|
1745
|
-
/// The block parsers active for this block.
|
|
1746
|
-
this.parsers = [];
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
/// Data structure used during block-level per-line parsing.
|
|
1750
|
-
class Line {
|
|
1751
|
-
constructor() {
|
|
1752
|
-
/// The line's full text.
|
|
1753
|
-
this.text = "";
|
|
1754
|
-
/// The base indent provided by the composite contexts (that have
|
|
1755
|
-
/// been handled so far).
|
|
1756
|
-
this.baseIndent = 0;
|
|
1757
|
-
/// The string position corresponding to the base indent.
|
|
1758
|
-
this.basePos = 0;
|
|
1759
|
-
/// The number of contexts handled @internal
|
|
1760
|
-
this.depth = 0;
|
|
1761
|
-
/// Any markers (i.e. block quote markers) parsed for the contexts. @internal
|
|
1762
|
-
this.markers = [];
|
|
1763
|
-
/// The position of the next non-whitespace character beyond any
|
|
1764
|
-
/// list, blockquote, or other composite block markers.
|
|
1765
|
-
this.pos = 0;
|
|
1766
|
-
/// The column of the next non-whitespace character.
|
|
1767
|
-
this.indent = 0;
|
|
1768
|
-
/// The character code of the character after `pos`.
|
|
1769
|
-
this.next = -1;
|
|
1770
|
-
}
|
|
1771
|
-
/// @internal
|
|
1772
|
-
forward() {
|
|
1773
|
-
if (this.basePos > this.pos) this.forwardInner();
|
|
1774
|
-
}
|
|
1775
|
-
/// @internal
|
|
1776
|
-
forwardInner() {
|
|
1777
|
-
let newPos = this.skipSpace(this.basePos);
|
|
1778
|
-
this.indent = this.countIndent(newPos, this.pos, this.indent);
|
|
1779
|
-
this.pos = newPos;
|
|
1780
|
-
this.next = newPos == this.text.length ? -1 : this.text.charCodeAt(newPos);
|
|
1781
|
-
}
|
|
1782
|
-
/// Skip whitespace after the given position, return the position of
|
|
1783
|
-
/// the next non-space character or the end of the line if there's
|
|
1784
|
-
/// only space after `from`.
|
|
1785
|
-
skipSpace(from) {
|
|
1786
|
-
return skipSpace(this.text, from);
|
|
1787
|
-
}
|
|
1788
|
-
/// @internal
|
|
1789
|
-
reset(text) {
|
|
1790
|
-
this.text = text;
|
|
1791
|
-
this.baseIndent = this.basePos = this.pos = this.indent = 0;
|
|
1792
|
-
this.forwardInner();
|
|
1793
|
-
this.depth = 1;
|
|
1794
|
-
while (this.markers.length) this.markers.pop();
|
|
1795
|
-
}
|
|
1796
|
-
/// Move the line's base position forward to the given position.
|
|
1797
|
-
/// This should only be called by composite [block
|
|
1798
|
-
/// parsers](#BlockParser.parse) or [markup skipping
|
|
1799
|
-
/// functions](#NodeSpec.composite).
|
|
1800
|
-
moveBase(to) {
|
|
1801
|
-
this.basePos = to;
|
|
1802
|
-
this.baseIndent = this.countIndent(to, this.pos, this.indent);
|
|
1803
|
-
}
|
|
1804
|
-
/// Move the line's base position forward to the given _column_.
|
|
1805
|
-
moveBaseColumn(indent) {
|
|
1806
|
-
this.baseIndent = indent;
|
|
1807
|
-
this.basePos = this.findColumn(indent);
|
|
1808
|
-
}
|
|
1809
|
-
/// Store a composite-block-level marker. Should be called from
|
|
1810
|
-
/// [markup skipping functions](#NodeSpec.composite) when they
|
|
1811
|
-
/// consume any non-whitespace characters.
|
|
1812
|
-
addMarker(elt) {
|
|
1813
|
-
this.markers.push(elt);
|
|
1814
|
-
}
|
|
1815
|
-
/// Find the column position at `to`, optionally starting at a given
|
|
1816
|
-
/// position and column.
|
|
1817
|
-
countIndent(to, from = 0, indent = 0) {
|
|
1818
|
-
for (let i = from; i < to; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
|
|
1819
|
-
return indent;
|
|
1820
|
-
}
|
|
1821
|
-
/// Find the position corresponding to the given column.
|
|
1822
|
-
findColumn(goal) {
|
|
1823
|
-
let i = 0;
|
|
1824
|
-
for (let indent = 0; i < this.text.length && indent < goal; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
|
|
1825
|
-
return i;
|
|
1826
|
-
}
|
|
1827
|
-
/// @internal
|
|
1828
|
-
scrub() {
|
|
1829
|
-
if (!this.baseIndent) return this.text;
|
|
1830
|
-
let result = "";
|
|
1831
|
-
for (let i = 0; i < this.basePos; i++) result += " ";
|
|
1832
|
-
return result + this.text.slice(this.basePos);
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
function skipForList(bl, cx, line) {
|
|
1836
|
-
if (line.pos == line.text.length || bl != cx.block && line.indent >= cx.stack[line.depth + 1].value + line.baseIndent) return true;
|
|
1837
|
-
if (line.indent >= line.baseIndent + 4) return false;
|
|
1838
|
-
let size = (bl.type == Type.OrderedList ? isOrderedList : isBulletList)(line, cx, false);
|
|
1839
|
-
return size > 0 && (bl.type != Type.BulletList || isHorizontalRule(line, cx, false) < 0) && line.text.charCodeAt(line.pos + size - 1) == bl.value;
|
|
1840
|
-
}
|
|
1841
|
-
const DefaultSkipMarkup = {
|
|
1842
|
-
[Type.Blockquote](bl, cx, line) {
|
|
1843
|
-
if (line.next != 62 /* '>' */) return false;
|
|
1844
|
-
line.markers.push(elt(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1));
|
|
1845
|
-
line.moveBase(line.pos + (space(line.text.charCodeAt(line.pos + 1)) ? 2 : 1));
|
|
1846
|
-
bl.end = cx.lineStart + line.text.length;
|
|
1847
|
-
return true;
|
|
1848
|
-
},
|
|
1849
|
-
[Type.ListItem](bl, _cx, line) {
|
|
1850
|
-
if (line.indent < line.baseIndent + bl.value && line.next > -1) return false;
|
|
1851
|
-
line.moveBaseColumn(line.baseIndent + bl.value);
|
|
1852
|
-
return true;
|
|
1853
|
-
},
|
|
1854
|
-
[Type.OrderedList]: skipForList,
|
|
1855
|
-
[Type.BulletList]: skipForList,
|
|
1856
|
-
[Type.Document]() {
|
|
1857
|
-
return true;
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
function space(ch) {
|
|
1861
|
-
return ch == 32 || ch == 9 || ch == 10 || ch == 13;
|
|
1862
|
-
}
|
|
1863
|
-
function skipSpace(line, i = 0) {
|
|
1864
|
-
while (i < line.length && space(line.charCodeAt(i))) i++;
|
|
1865
|
-
return i;
|
|
1866
|
-
}
|
|
1867
|
-
function skipSpaceBack(line, i, to) {
|
|
1868
|
-
while (i > to && space(line.charCodeAt(i - 1))) i--;
|
|
1869
|
-
return i;
|
|
1870
|
-
}
|
|
1871
|
-
function isFencedCode(line) {
|
|
1872
|
-
if (line.next != 96 && line.next != 126 /* '`~' */) return -1;
|
|
1873
|
-
let pos = line.pos + 1;
|
|
1874
|
-
while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
|
|
1875
|
-
if (pos < line.pos + 3) return -1;
|
|
1876
|
-
if (line.next == 96) for (let i = pos; i < line.text.length; i++) if (line.text.charCodeAt(i) == 96) return -1;
|
|
1877
|
-
return pos;
|
|
1878
|
-
}
|
|
1879
|
-
function isBlockquote(line) {
|
|
1880
|
-
return line.next != 62 /* '>' */ ? -1 : line.text.charCodeAt(line.pos + 1) == 32 ? 2 : 1;
|
|
1881
|
-
}
|
|
1882
|
-
function isHorizontalRule(line, cx, breaking) {
|
|
1883
|
-
if (line.next != 42 && line.next != 45 && line.next != 95 /* '_-*' */) return -1;
|
|
1884
|
-
let count = 1;
|
|
1885
|
-
for (let pos = line.pos + 1; pos < line.text.length; pos++) {
|
|
1886
|
-
let ch = line.text.charCodeAt(pos);
|
|
1887
|
-
if (ch == line.next) count++;else if (!space(ch)) return -1;
|
|
1888
|
-
}
|
|
1889
|
-
// Setext headers take precedence
|
|
1890
|
-
if (breaking && line.next == 45 && isSetextUnderline(line) > -1 && line.depth == cx.stack.length) return -1;
|
|
1891
|
-
return count < 3 ? -1 : 1;
|
|
1892
|
-
}
|
|
1893
|
-
function inList(cx, type) {
|
|
1894
|
-
for (let i = cx.stack.length - 1; i >= 0; i--) if (cx.stack[i].type == type) return true;
|
|
1895
|
-
return false;
|
|
1896
|
-
}
|
|
1897
|
-
function isBulletList(line, cx, breaking) {
|
|
1898
|
-
return (line.next == 45 || line.next == 43 || line.next == 42 /* '-+*' */) && (line.pos == line.text.length - 1 || space(line.text.charCodeAt(line.pos + 1))) && (!breaking || inList(cx, Type.BulletList) || line.skipSpace(line.pos + 2) < line.text.length) ? 1 : -1;
|
|
1899
|
-
}
|
|
1900
|
-
function isOrderedList(line, cx, breaking) {
|
|
1901
|
-
let pos = line.pos,
|
|
1902
|
-
next = line.next;
|
|
1903
|
-
for (;;) {
|
|
1904
|
-
if (next >= 48 && next <= 57 /* '0-9' */) pos++;else break;
|
|
1905
|
-
if (pos == line.text.length) return -1;
|
|
1906
|
-
next = line.text.charCodeAt(pos);
|
|
1907
|
-
}
|
|
1908
|
-
if (pos == line.pos || pos > line.pos + 9 || next != 46 && next != 41 /* '.)' */ || pos < line.text.length - 1 && !space(line.text.charCodeAt(pos + 1)) || breaking && !inList(cx, Type.OrderedList) && (line.skipSpace(pos + 1) == line.text.length || pos > line.pos + 1 || line.next != 49 /* '1' */)) return -1;
|
|
1909
|
-
return pos + 1 - line.pos;
|
|
1910
|
-
}
|
|
1911
|
-
function isAtxHeading(line) {
|
|
1912
|
-
if (line.next != 35 /* '#' */) return -1;
|
|
1913
|
-
let pos = line.pos + 1;
|
|
1914
|
-
while (pos < line.text.length && line.text.charCodeAt(pos) == 35) pos++;
|
|
1915
|
-
if (pos < line.text.length && line.text.charCodeAt(pos) != 32) return -1;
|
|
1916
|
-
let size = pos - line.pos;
|
|
1917
|
-
return size > 6 ? -1 : size;
|
|
1918
|
-
}
|
|
1919
|
-
function isSetextUnderline(line) {
|
|
1920
|
-
if (line.next != 45 && line.next != 61 /* '-=' */ || line.indent >= line.baseIndent + 4) return -1;
|
|
1921
|
-
let pos = line.pos + 1;
|
|
1922
|
-
while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
|
|
1923
|
-
let end = pos;
|
|
1924
|
-
while (pos < line.text.length && space(line.text.charCodeAt(pos))) pos++;
|
|
1925
|
-
return pos == line.text.length ? end : -1;
|
|
1926
|
-
}
|
|
1927
|
-
const EmptyLine = /^[ \t]*$/,
|
|
1928
|
-
CommentEnd = /-->/,
|
|
1929
|
-
ProcessingEnd = /\?>/;
|
|
1930
|
-
const HTMLBlockStyle = [[/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i], [/^\s*<!--/, CommentEnd], [/^\s*<\?/, ProcessingEnd], [/^\s*<![A-Z]/, />/], [/^\s*<!\[CDATA\[/, /\]\]>/], [/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i, EmptyLine], [/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, EmptyLine]];
|
|
1931
|
-
function isHTMLBlock(line, _cx, breaking) {
|
|
1932
|
-
if (line.next != 60 /* '<' */) return -1;
|
|
1933
|
-
let rest = line.text.slice(line.pos);
|
|
1934
|
-
for (let i = 0, e = HTMLBlockStyle.length - (breaking ? 1 : 0); i < e; i++) if (HTMLBlockStyle[i][0].test(rest)) return i;
|
|
1935
|
-
return -1;
|
|
1936
|
-
}
|
|
1937
|
-
function getListIndent(line, pos) {
|
|
1938
|
-
let indentAfter = line.countIndent(pos, line.pos, line.indent);
|
|
1939
|
-
let indented = line.countIndent(line.skipSpace(pos), pos, indentAfter);
|
|
1940
|
-
return indented >= indentAfter + 5 ? indentAfter + 1 : indented;
|
|
1941
|
-
}
|
|
1942
|
-
function addCodeText(marks, from, to) {
|
|
1943
|
-
let last = marks.length - 1;
|
|
1944
|
-
if (last >= 0 && marks[last].to == from && marks[last].type == Type.CodeText) marks[last].to = to;else marks.push(elt(Type.CodeText, from, to));
|
|
1945
|
-
}
|
|
1946
|
-
// Rules for parsing blocks. A return value of false means the rule
|
|
1947
|
-
// doesn't apply here, true means it does. When true is returned and
|
|
1948
|
-
// `p.line` has been updated, the rule is assumed to have consumed a
|
|
1949
|
-
// leaf block. Otherwise, it is assumed to have opened a context.
|
|
1950
|
-
const DefaultBlockParsers = {
|
|
1951
|
-
LinkReference: undefined,
|
|
1952
|
-
IndentedCode(cx, line) {
|
|
1953
|
-
let base = line.baseIndent + 4;
|
|
1954
|
-
if (line.indent < base) return false;
|
|
1955
|
-
let start = line.findColumn(base);
|
|
1956
|
-
let from = cx.lineStart + start,
|
|
1957
|
-
to = cx.lineStart + line.text.length;
|
|
1958
|
-
let marks = [],
|
|
1959
|
-
pendingMarks = [];
|
|
1960
|
-
addCodeText(marks, from, to);
|
|
1961
|
-
while (cx.nextLine() && line.depth >= cx.stack.length) {
|
|
1962
|
-
if (line.pos == line.text.length) {
|
|
1963
|
-
// Empty
|
|
1964
|
-
addCodeText(pendingMarks, cx.lineStart - 1, cx.lineStart);
|
|
1965
|
-
for (let m of line.markers) pendingMarks.push(m);
|
|
1966
|
-
} else if (line.indent < base) {
|
|
1967
|
-
break;
|
|
1968
|
-
} else {
|
|
1969
|
-
if (pendingMarks.length) {
|
|
1970
|
-
for (let m of pendingMarks) {
|
|
1971
|
-
if (m.type == Type.CodeText) addCodeText(marks, m.from, m.to);else marks.push(m);
|
|
1972
|
-
}
|
|
1973
|
-
pendingMarks = [];
|
|
1974
|
-
}
|
|
1975
|
-
addCodeText(marks, cx.lineStart - 1, cx.lineStart);
|
|
1976
|
-
for (let m of line.markers) marks.push(m);
|
|
1977
|
-
to = cx.lineStart + line.text.length;
|
|
1978
|
-
let codeStart = cx.lineStart + line.findColumn(line.baseIndent + 4);
|
|
1979
|
-
if (codeStart < to) addCodeText(marks, codeStart, to);
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
if (pendingMarks.length) {
|
|
1983
|
-
pendingMarks = pendingMarks.filter(m => m.type != Type.CodeText);
|
|
1984
|
-
if (pendingMarks.length) line.markers = pendingMarks.concat(line.markers);
|
|
1985
|
-
}
|
|
1986
|
-
cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.CodeBlock, to - from), from);
|
|
1987
|
-
return true;
|
|
1988
|
-
},
|
|
1989
|
-
FencedCode(cx, line) {
|
|
1990
|
-
let fenceEnd = isFencedCode(line);
|
|
1991
|
-
if (fenceEnd < 0) return false;
|
|
1992
|
-
let from = cx.lineStart + line.pos,
|
|
1993
|
-
ch = line.next,
|
|
1994
|
-
len = fenceEnd - line.pos;
|
|
1995
|
-
let infoFrom = line.skipSpace(fenceEnd),
|
|
1996
|
-
infoTo = skipSpaceBack(line.text, line.text.length, infoFrom);
|
|
1997
|
-
let marks = [elt(Type.CodeMark, from, from + len)];
|
|
1998
|
-
if (infoFrom < infoTo) marks.push(elt(Type.CodeInfo, cx.lineStart + infoFrom, cx.lineStart + infoTo));
|
|
1999
|
-
for (let first = true; cx.nextLine() && line.depth >= cx.stack.length; first = false) {
|
|
2000
|
-
let i = line.pos;
|
|
2001
|
-
if (line.indent - line.baseIndent < 4) while (i < line.text.length && line.text.charCodeAt(i) == ch) i++;
|
|
2002
|
-
if (i - line.pos >= len && line.skipSpace(i) == line.text.length) {
|
|
2003
|
-
for (let m of line.markers) marks.push(m);
|
|
2004
|
-
marks.push(elt(Type.CodeMark, cx.lineStart + line.pos, cx.lineStart + i));
|
|
2005
|
-
cx.nextLine();
|
|
2006
|
-
break;
|
|
2007
|
-
} else {
|
|
2008
|
-
if (!first) addCodeText(marks, cx.lineStart - 1, cx.lineStart);
|
|
2009
|
-
for (let m of line.markers) marks.push(m);
|
|
2010
|
-
let textStart = cx.lineStart + line.basePos,
|
|
2011
|
-
textEnd = cx.lineStart + line.text.length;
|
|
2012
|
-
if (textStart < textEnd) addCodeText(marks, textStart, textEnd);
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.FencedCode, cx.prevLineEnd() - from), from);
|
|
2016
|
-
return true;
|
|
2017
|
-
},
|
|
2018
|
-
Blockquote(cx, line) {
|
|
2019
|
-
let size = isBlockquote(line);
|
|
2020
|
-
if (size < 0) return false;
|
|
2021
|
-
cx.startContext(Type.Blockquote, line.pos);
|
|
2022
|
-
cx.addNode(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1);
|
|
2023
|
-
line.moveBase(line.pos + size);
|
|
2024
|
-
return null;
|
|
2025
|
-
},
|
|
2026
|
-
HorizontalRule(cx, line) {
|
|
2027
|
-
if (isHorizontalRule(line, cx, false) < 0) return false;
|
|
2028
|
-
let from = cx.lineStart + line.pos;
|
|
2029
|
-
cx.nextLine();
|
|
2030
|
-
cx.addNode(Type.HorizontalRule, from);
|
|
2031
|
-
return true;
|
|
2032
|
-
},
|
|
2033
|
-
BulletList(cx, line) {
|
|
2034
|
-
let size = isBulletList(line, cx, false);
|
|
2035
|
-
if (size < 0) return false;
|
|
2036
|
-
if (cx.block.type != Type.BulletList) cx.startContext(Type.BulletList, line.basePos, line.next);
|
|
2037
|
-
let newBase = getListIndent(line, line.pos + 1);
|
|
2038
|
-
cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
|
|
2039
|
-
cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
|
|
2040
|
-
line.moveBaseColumn(newBase);
|
|
2041
|
-
return null;
|
|
2042
|
-
},
|
|
2043
|
-
OrderedList(cx, line) {
|
|
2044
|
-
let size = isOrderedList(line, cx, false);
|
|
2045
|
-
if (size < 0) return false;
|
|
2046
|
-
if (cx.block.type != Type.OrderedList) cx.startContext(Type.OrderedList, line.basePos, line.text.charCodeAt(line.pos + size - 1));
|
|
2047
|
-
let newBase = getListIndent(line, line.pos + size);
|
|
2048
|
-
cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
|
|
2049
|
-
cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
|
|
2050
|
-
line.moveBaseColumn(newBase);
|
|
2051
|
-
return null;
|
|
2052
|
-
},
|
|
2053
|
-
ATXHeading(cx, line) {
|
|
2054
|
-
let size = isAtxHeading(line);
|
|
2055
|
-
if (size < 0) return false;
|
|
2056
|
-
let off = line.pos,
|
|
2057
|
-
from = cx.lineStart + off;
|
|
2058
|
-
let endOfSpace = skipSpaceBack(line.text, line.text.length, off),
|
|
2059
|
-
after = endOfSpace;
|
|
2060
|
-
while (after > off && line.text.charCodeAt(after - 1) == line.next) after--;
|
|
2061
|
-
if (after == endOfSpace || after == off || !space(line.text.charCodeAt(after - 1))) after = line.text.length;
|
|
2062
|
-
let buf = cx.buffer.write(Type.HeaderMark, 0, size).writeElements(cx.parser.parseInline(line.text.slice(off + size + 1, after), from + size + 1), -from);
|
|
2063
|
-
if (after < line.text.length) buf.write(Type.HeaderMark, after - off, endOfSpace - off);
|
|
2064
|
-
let node = buf.finish(Type.ATXHeading1 - 1 + size, line.text.length - off);
|
|
2065
|
-
cx.nextLine();
|
|
2066
|
-
cx.addNode(node, from);
|
|
2067
|
-
return true;
|
|
2068
|
-
},
|
|
2069
|
-
HTMLBlock(cx, line) {
|
|
2070
|
-
let type = isHTMLBlock(line, cx, false);
|
|
2071
|
-
if (type < 0) return false;
|
|
2072
|
-
let from = cx.lineStart + line.pos,
|
|
2073
|
-
end = HTMLBlockStyle[type][1];
|
|
2074
|
-
let marks = [],
|
|
2075
|
-
trailing = end != EmptyLine;
|
|
2076
|
-
while (!end.test(line.text) && cx.nextLine()) {
|
|
2077
|
-
if (line.depth < cx.stack.length) {
|
|
2078
|
-
trailing = false;
|
|
2079
|
-
break;
|
|
2080
|
-
}
|
|
2081
|
-
for (let m of line.markers) marks.push(m);
|
|
2082
|
-
}
|
|
2083
|
-
if (trailing) cx.nextLine();
|
|
2084
|
-
let nodeType = end == CommentEnd ? Type.CommentBlock : end == ProcessingEnd ? Type.ProcessingInstructionBlock : Type.HTMLBlock;
|
|
2085
|
-
let to = cx.prevLineEnd();
|
|
2086
|
-
cx.addNode(cx.buffer.writeElements(marks, -from).finish(nodeType, to - from), from);
|
|
2087
|
-
return true;
|
|
2088
|
-
},
|
|
2089
|
-
SetextHeading: undefined // Specifies relative precedence for block-continue function
|
|
2090
|
-
};
|
|
2091
|
-
// This implements a state machine that incrementally parses link references. At each
|
|
2092
|
-
// next line, it looks ahead to see if the line continues the reference or not. If it
|
|
2093
|
-
// doesn't and a valid link is available ending before that line, it finishes that.
|
|
2094
|
-
// Similarly, on `finish` (when the leaf is terminated by external circumstances), it
|
|
2095
|
-
// creates a link reference if there's a valid reference up to the current point.
|
|
2096
|
-
class LinkReferenceParser {
|
|
2097
|
-
constructor(leaf) {
|
|
2098
|
-
this.stage = 0 /* Start */;
|
|
2099
|
-
this.elts = [];
|
|
2100
|
-
this.pos = 0;
|
|
2101
|
-
this.start = leaf.start;
|
|
2102
|
-
this.advance(leaf.content);
|
|
2103
|
-
}
|
|
2104
|
-
nextLine(cx, line, leaf) {
|
|
2105
|
-
if (this.stage == -1 /* Failed */) return false;
|
|
2106
|
-
let content = leaf.content + "\n" + line.scrub();
|
|
2107
|
-
let finish = this.advance(content);
|
|
2108
|
-
if (finish > -1 && finish < content.length) return this.complete(cx, leaf, finish);
|
|
2109
|
-
return false;
|
|
2110
|
-
}
|
|
2111
|
-
finish(cx, leaf) {
|
|
2112
|
-
if ((this.stage == 2 /* Link */ || this.stage == 3 /* Title */) && skipSpace(leaf.content, this.pos) == leaf.content.length) return this.complete(cx, leaf, leaf.content.length);
|
|
2113
|
-
return false;
|
|
2114
|
-
}
|
|
2115
|
-
complete(cx, leaf, len) {
|
|
2116
|
-
cx.addLeafElement(leaf, elt(Type.LinkReference, this.start, this.start + len, this.elts));
|
|
2117
|
-
return true;
|
|
2118
|
-
}
|
|
2119
|
-
nextStage(elt) {
|
|
2120
|
-
if (elt) {
|
|
2121
|
-
this.pos = elt.to - this.start;
|
|
2122
|
-
this.elts.push(elt);
|
|
2123
|
-
this.stage++;
|
|
2124
|
-
return true;
|
|
2125
|
-
}
|
|
2126
|
-
if (elt === false) this.stage = -1 /* Failed */;
|
|
2127
|
-
return false;
|
|
2128
|
-
}
|
|
2129
|
-
advance(content) {
|
|
2130
|
-
for (;;) {
|
|
2131
|
-
if (this.stage == -1 /* Failed */) {
|
|
2132
|
-
return -1;
|
|
2133
|
-
} else if (this.stage == 0 /* Start */) {
|
|
2134
|
-
if (!this.nextStage(parseLinkLabel(content, this.pos, this.start, true))) return -1;
|
|
2135
|
-
if (content.charCodeAt(this.pos) != 58 /* ':' */) return this.stage = -1 /* Failed */;
|
|
2136
|
-
this.elts.push(elt(Type.LinkMark, this.pos + this.start, this.pos + this.start + 1));
|
|
2137
|
-
this.pos++;
|
|
2138
|
-
} else if (this.stage == 1 /* Label */) {
|
|
2139
|
-
if (!this.nextStage(parseURL(content, skipSpace(content, this.pos), this.start))) return -1;
|
|
2140
|
-
} else if (this.stage == 2 /* Link */) {
|
|
2141
|
-
let skip = skipSpace(content, this.pos),
|
|
2142
|
-
end = 0;
|
|
2143
|
-
if (skip > this.pos) {
|
|
2144
|
-
let title = parseLinkTitle(content, skip, this.start);
|
|
2145
|
-
if (title) {
|
|
2146
|
-
let titleEnd = lineEnd(content, title.to - this.start);
|
|
2147
|
-
if (titleEnd > 0) {
|
|
2148
|
-
this.nextStage(title);
|
|
2149
|
-
end = titleEnd;
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
if (!end) end = lineEnd(content, this.pos);
|
|
2154
|
-
return end > 0 && end < content.length ? end : -1;
|
|
2155
|
-
} else {
|
|
2156
|
-
// RefStage.Title
|
|
2157
|
-
return lineEnd(content, this.pos);
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
function lineEnd(text, pos) {
|
|
2163
|
-
for (; pos < text.length; pos++) {
|
|
2164
|
-
let next = text.charCodeAt(pos);
|
|
2165
|
-
if (next == 10) break;
|
|
2166
|
-
if (!space(next)) return -1;
|
|
2167
|
-
}
|
|
2168
|
-
return pos;
|
|
2169
|
-
}
|
|
2170
|
-
class SetextHeadingParser {
|
|
2171
|
-
nextLine(cx, line, leaf) {
|
|
2172
|
-
let underline = line.depth < cx.stack.length ? -1 : isSetextUnderline(line);
|
|
2173
|
-
let next = line.next;
|
|
2174
|
-
if (underline < 0) return false;
|
|
2175
|
-
let underlineMark = elt(Type.HeaderMark, cx.lineStart + line.pos, cx.lineStart + underline);
|
|
2176
|
-
cx.nextLine();
|
|
2177
|
-
cx.addLeafElement(leaf, elt(next == 61 ? Type.SetextHeading1 : Type.SetextHeading2, leaf.start, cx.prevLineEnd(), [...cx.parser.parseInline(leaf.content, leaf.start), underlineMark]));
|
|
2178
|
-
return true;
|
|
2179
|
-
}
|
|
2180
|
-
finish() {
|
|
2181
|
-
return false;
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
const DefaultLeafBlocks = {
|
|
2185
|
-
LinkReference(_, leaf) {
|
|
2186
|
-
return leaf.content.charCodeAt(0) == 91 /* '[' */ ? new LinkReferenceParser(leaf) : null;
|
|
2187
|
-
},
|
|
2188
|
-
SetextHeading() {
|
|
2189
|
-
return new SetextHeadingParser();
|
|
2190
|
-
}
|
|
2191
|
-
};
|
|
2192
|
-
const DefaultEndLeaf = [(_, line) => isAtxHeading(line) >= 0, (_, line) => isFencedCode(line) >= 0, (_, line) => isBlockquote(line) >= 0, (p, line) => isBulletList(line, p, true) >= 0, (p, line) => isOrderedList(line, p, true) >= 0, (p, line) => isHorizontalRule(line, p, true) >= 0, (p, line) => isHTMLBlock(line, p, true) >= 0];
|
|
2193
|
-
const scanLineResult = {
|
|
2194
|
-
text: "",
|
|
2195
|
-
end: 0
|
|
2196
|
-
};
|
|
2197
|
-
/// Block-level parsing functions get access to this context object.
|
|
2198
|
-
class BlockContext {
|
|
2199
|
-
/// @internal
|
|
2200
|
-
constructor(
|
|
2201
|
-
/// The parser configuration used.
|
|
2202
|
-
parser,
|
|
2203
|
-
/// @internal
|
|
2204
|
-
input, fragments,
|
|
2205
|
-
/// @internal
|
|
2206
|
-
ranges) {
|
|
2207
|
-
this.parser = parser;
|
|
2208
|
-
this.input = input;
|
|
2209
|
-
this.ranges = ranges;
|
|
2210
|
-
this.line = new Line();
|
|
2211
|
-
this.atEnd = false;
|
|
2212
|
-
/// @internal
|
|
2213
|
-
this.dontInject = new Set();
|
|
2214
|
-
this.stoppedAt = null;
|
|
2215
|
-
/// The range index that absoluteLineStart points into @internal
|
|
2216
|
-
this.rangeI = 0;
|
|
2217
|
-
this.to = ranges[ranges.length - 1].to;
|
|
2218
|
-
this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = ranges[0].from;
|
|
2219
|
-
this.block = CompositeBlock.create(Type.Document, 0, this.lineStart, 0, 0);
|
|
2220
|
-
this.stack = [this.block];
|
|
2221
|
-
this.fragments = fragments.length ? new FragmentCursor(fragments, input) : null;
|
|
2222
|
-
this.readLine();
|
|
2223
|
-
}
|
|
2224
|
-
get parsedPos() {
|
|
2225
|
-
return this.absoluteLineStart;
|
|
2226
|
-
}
|
|
2227
|
-
advance() {
|
|
2228
|
-
if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt) return this.finish();
|
|
2229
|
-
let {
|
|
2230
|
-
line
|
|
2231
|
-
} = this;
|
|
2232
|
-
for (;;) {
|
|
2233
|
-
while (line.depth < this.stack.length) this.finishContext();
|
|
2234
|
-
for (let mark of line.markers) this.addNode(mark.type, mark.from, mark.to);
|
|
2235
|
-
if (line.pos < line.text.length) break;
|
|
2236
|
-
// Empty line
|
|
2237
|
-
if (!this.nextLine()) return this.finish();
|
|
2238
|
-
}
|
|
2239
|
-
if (this.fragments && this.reuseFragment(line.basePos)) return null;
|
|
2240
|
-
start: for (;;) {
|
|
2241
|
-
for (let type of this.parser.blockParsers) if (type) {
|
|
2242
|
-
let result = type(this, line);
|
|
2243
|
-
if (result != false) {
|
|
2244
|
-
if (result == true) return null;
|
|
2245
|
-
line.forward();
|
|
2246
|
-
continue start;
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
break;
|
|
2250
|
-
}
|
|
2251
|
-
let leaf = new LeafBlock(this.lineStart + line.pos, line.text.slice(line.pos));
|
|
2252
|
-
for (let parse of this.parser.leafBlockParsers) if (parse) {
|
|
2253
|
-
let parser = parse(this, leaf);
|
|
2254
|
-
if (parser) leaf.parsers.push(parser);
|
|
2255
|
-
}
|
|
2256
|
-
lines: while (this.nextLine()) {
|
|
2257
|
-
if (line.pos == line.text.length) break;
|
|
2258
|
-
if (line.indent < line.baseIndent + 4) {
|
|
2259
|
-
for (let stop of this.parser.endLeafBlock) if (stop(this, line, leaf)) break lines;
|
|
2260
|
-
}
|
|
2261
|
-
for (let parser of leaf.parsers) if (parser.nextLine(this, line, leaf)) return null;
|
|
2262
|
-
leaf.content += "\n" + line.scrub();
|
|
2263
|
-
for (let m of line.markers) leaf.marks.push(m);
|
|
2264
|
-
}
|
|
2265
|
-
this.finishLeaf(leaf);
|
|
2266
|
-
return null;
|
|
2267
|
-
}
|
|
2268
|
-
stopAt(pos) {
|
|
2269
|
-
if (this.stoppedAt != null && this.stoppedAt < pos) throw new RangeError("Can't move stoppedAt forward");
|
|
2270
|
-
this.stoppedAt = pos;
|
|
2271
|
-
}
|
|
2272
|
-
reuseFragment(start) {
|
|
2273
|
-
if (!this.fragments.moveTo(this.absoluteLineStart + start, this.absoluteLineStart) || !this.fragments.matches(this.block.hash)) return false;
|
|
2274
|
-
let taken = this.fragments.takeNodes(this);
|
|
2275
|
-
if (!taken) return false;
|
|
2276
|
-
let withoutGaps = taken,
|
|
2277
|
-
end = this.absoluteLineStart + taken;
|
|
2278
|
-
for (let i = 1; i < this.ranges.length; i++) {
|
|
2279
|
-
let gapFrom = this.ranges[i - 1].to,
|
|
2280
|
-
gapTo = this.ranges[i].from;
|
|
2281
|
-
if (gapFrom >= this.lineStart && gapTo < end) withoutGaps -= gapTo - gapFrom;
|
|
2282
|
-
}
|
|
2283
|
-
this.lineStart += withoutGaps;
|
|
2284
|
-
this.absoluteLineStart += taken;
|
|
2285
|
-
this.moveRangeI();
|
|
2286
|
-
if (this.absoluteLineStart < this.to) {
|
|
2287
|
-
this.lineStart++;
|
|
2288
|
-
this.absoluteLineStart++;
|
|
2289
|
-
this.readLine();
|
|
2290
|
-
} else {
|
|
2291
|
-
this.atEnd = true;
|
|
2292
|
-
this.readLine();
|
|
2293
|
-
}
|
|
2294
|
-
return true;
|
|
2295
|
-
}
|
|
2296
|
-
/// The number of parent blocks surrounding the current block.
|
|
2297
|
-
get depth() {
|
|
2298
|
-
return this.stack.length;
|
|
2299
|
-
}
|
|
2300
|
-
/// Get the type of the parent block at the given depth. When no
|
|
2301
|
-
/// depth is passed, return the type of the innermost parent.
|
|
2302
|
-
parentType(depth = this.depth - 1) {
|
|
2303
|
-
return this.parser.nodeSet.types[this.stack[depth].type];
|
|
2304
|
-
}
|
|
2305
|
-
/// Move to the next input line. This should only be called by
|
|
2306
|
-
/// (non-composite) [block parsers](#BlockParser.parse) that consume
|
|
2307
|
-
/// the line directly, or leaf block parser
|
|
2308
|
-
/// [`nextLine`](#LeafBlockParser.nextLine) methods when they
|
|
2309
|
-
/// consume the current line (and return true).
|
|
2310
|
-
nextLine() {
|
|
2311
|
-
this.lineStart += this.line.text.length;
|
|
2312
|
-
if (this.absoluteLineEnd >= this.to) {
|
|
2313
|
-
this.absoluteLineStart = this.absoluteLineEnd;
|
|
2314
|
-
this.atEnd = true;
|
|
2315
|
-
this.readLine();
|
|
2316
|
-
return false;
|
|
2317
|
-
} else {
|
|
2318
|
-
this.lineStart++;
|
|
2319
|
-
this.absoluteLineStart = this.absoluteLineEnd + 1;
|
|
2320
|
-
this.moveRangeI();
|
|
2321
|
-
this.readLine();
|
|
2322
|
-
return true;
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
moveRangeI() {
|
|
2326
|
-
while (this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to) {
|
|
2327
|
-
this.rangeI++;
|
|
2328
|
-
this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
|
|
2329
|
-
}
|
|
2330
|
-
}
|
|
2331
|
-
/// @internal
|
|
2332
|
-
scanLine(start) {
|
|
2333
|
-
let r = scanLineResult;
|
|
2334
|
-
r.end = start;
|
|
2335
|
-
if (start >= this.to) {
|
|
2336
|
-
r.text = "";
|
|
2337
|
-
} else {
|
|
2338
|
-
r.text = this.lineChunkAt(start);
|
|
2339
|
-
r.end += r.text.length;
|
|
2340
|
-
if (this.ranges.length > 1) {
|
|
2341
|
-
let textOffset = this.absoluteLineStart,
|
|
2342
|
-
rangeI = this.rangeI;
|
|
2343
|
-
while (this.ranges[rangeI].to < r.end) {
|
|
2344
|
-
rangeI++;
|
|
2345
|
-
let nextFrom = this.ranges[rangeI].from;
|
|
2346
|
-
let after = this.lineChunkAt(nextFrom);
|
|
2347
|
-
r.end = nextFrom + after.length;
|
|
2348
|
-
r.text = r.text.slice(0, this.ranges[rangeI - 1].to - textOffset) + after;
|
|
2349
|
-
textOffset = r.end - r.text.length;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
return r;
|
|
2354
|
-
}
|
|
2355
|
-
/// @internal
|
|
2356
|
-
readLine() {
|
|
2357
|
-
let {
|
|
2358
|
-
line
|
|
2359
|
-
} = this,
|
|
2360
|
-
{
|
|
2361
|
-
text,
|
|
2362
|
-
end
|
|
2363
|
-
} = this.scanLine(this.absoluteLineStart);
|
|
2364
|
-
this.absoluteLineEnd = end;
|
|
2365
|
-
line.reset(text);
|
|
2366
|
-
for (; line.depth < this.stack.length; line.depth++) {
|
|
2367
|
-
let cx = this.stack[line.depth],
|
|
2368
|
-
handler = this.parser.skipContextMarkup[cx.type];
|
|
2369
|
-
if (!handler) throw new Error("Unhandled block context " + Type[cx.type]);
|
|
2370
|
-
if (!handler(cx, this, line)) break;
|
|
2371
|
-
line.forward();
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
lineChunkAt(pos) {
|
|
2375
|
-
let next = this.input.chunk(pos),
|
|
2376
|
-
text;
|
|
2377
|
-
if (!this.input.lineChunks) {
|
|
2378
|
-
let eol = next.indexOf("\n");
|
|
2379
|
-
text = eol < 0 ? next : next.slice(0, eol);
|
|
2380
|
-
} else {
|
|
2381
|
-
text = next == "\n" ? "" : next;
|
|
2382
|
-
}
|
|
2383
|
-
return pos + text.length > this.to ? text.slice(0, this.to - pos) : text;
|
|
2384
|
-
}
|
|
2385
|
-
/// The end position of the previous line.
|
|
2386
|
-
prevLineEnd() {
|
|
2387
|
-
return this.atEnd ? this.lineStart : this.lineStart - 1;
|
|
2388
|
-
}
|
|
2389
|
-
/// @internal
|
|
2390
|
-
startContext(type, start, value = 0) {
|
|
2391
|
-
this.block = CompositeBlock.create(type, value, this.lineStart + start, this.block.hash, this.lineStart + this.line.text.length);
|
|
2392
|
-
this.stack.push(this.block);
|
|
2393
|
-
}
|
|
2394
|
-
/// Start a composite block. Should only be called from [block
|
|
2395
|
-
/// parser functions](#BlockParser.parse) that return null.
|
|
2396
|
-
startComposite(type, start, value = 0) {
|
|
2397
|
-
this.startContext(this.parser.getNodeType(type), start, value);
|
|
2398
|
-
}
|
|
2399
|
-
/// @internal
|
|
2400
|
-
addNode(block, from, to) {
|
|
2401
|
-
if (typeof block == "number") block = new Tree(this.parser.nodeSet.types[block], none, none, (to !== null && to !== void 0 ? to : this.prevLineEnd()) - from);
|
|
2402
|
-
this.block.addChild(block, from - this.block.from);
|
|
2403
|
-
}
|
|
2404
|
-
/// Add a block element. Can be called by [block
|
|
2405
|
-
/// parsers](#BlockParser.parse).
|
|
2406
|
-
addElement(elt) {
|
|
2407
|
-
this.block.addChild(elt.toTree(this.parser.nodeSet), elt.from - this.block.from);
|
|
2408
|
-
}
|
|
2409
|
-
/// Add a block element from a [leaf parser](#LeafBlockParser). This
|
|
2410
|
-
/// makes sure any extra composite block markup (such as blockquote
|
|
2411
|
-
/// markers) inside the block are also added to the syntax tree.
|
|
2412
|
-
addLeafElement(leaf, elt) {
|
|
2413
|
-
this.addNode(this.buffer.writeElements(injectMarks(elt.children, leaf.marks), -elt.from).finish(elt.type, elt.to - elt.from), elt.from);
|
|
2414
|
-
}
|
|
2415
|
-
/// @internal
|
|
2416
|
-
finishContext() {
|
|
2417
|
-
let cx = this.stack.pop();
|
|
2418
|
-
let top = this.stack[this.stack.length - 1];
|
|
2419
|
-
top.addChild(cx.toTree(this.parser.nodeSet), cx.from - top.from);
|
|
2420
|
-
this.block = top;
|
|
2421
|
-
}
|
|
2422
|
-
finish() {
|
|
2423
|
-
while (this.stack.length > 1) this.finishContext();
|
|
2424
|
-
return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
|
|
2425
|
-
}
|
|
2426
|
-
addGaps(tree) {
|
|
2427
|
-
return this.ranges.length > 1 ? injectGaps(this.ranges, 0, tree.topNode, this.ranges[0].from, this.dontInject) : tree;
|
|
2428
|
-
}
|
|
2429
|
-
/// @internal
|
|
2430
|
-
finishLeaf(leaf) {
|
|
2431
|
-
for (let parser of leaf.parsers) if (parser.finish(this, leaf)) return;
|
|
2432
|
-
let inline = injectMarks(this.parser.parseInline(leaf.content, leaf.start), leaf.marks);
|
|
2433
|
-
this.addNode(this.buffer.writeElements(inline, -leaf.start).finish(Type.Paragraph, leaf.content.length), leaf.start);
|
|
2434
|
-
}
|
|
2435
|
-
elt(type, from, to, children) {
|
|
2436
|
-
if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
|
|
2437
|
-
return new TreeElement(type, from);
|
|
2438
|
-
}
|
|
2439
|
-
/// @internal
|
|
2440
|
-
get buffer() {
|
|
2441
|
-
return new Buffer(this.parser.nodeSet);
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
|
-
function injectGaps(ranges, rangeI, tree, offset, dont) {
|
|
2445
|
-
if (dont.has(tree.tree)) return tree.tree;
|
|
2446
|
-
let rangeEnd = ranges[rangeI].to;
|
|
2447
|
-
let children = [],
|
|
2448
|
-
positions = [],
|
|
2449
|
-
start = tree.from + offset;
|
|
2450
|
-
function movePastNext(upto, inclusive) {
|
|
2451
|
-
while (inclusive ? upto >= rangeEnd : upto > rangeEnd) {
|
|
2452
|
-
let size = ranges[rangeI + 1].from - rangeEnd;
|
|
2453
|
-
offset += size;
|
|
2454
|
-
upto += size;
|
|
2455
|
-
rangeI++;
|
|
2456
|
-
rangeEnd = ranges[rangeI].to;
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
for (let ch = tree.firstChild; ch; ch = ch.nextSibling) {
|
|
2460
|
-
movePastNext(ch.from + offset, true);
|
|
2461
|
-
let from = ch.from + offset,
|
|
2462
|
-
node;
|
|
2463
|
-
if (ch.to + offset > rangeEnd) {
|
|
2464
|
-
node = injectGaps(ranges, rangeI, ch, offset, dont);
|
|
2465
|
-
movePastNext(ch.to + offset, false);
|
|
2466
|
-
} else {
|
|
2467
|
-
node = ch.toTree();
|
|
2468
|
-
}
|
|
2469
|
-
children.push(node);
|
|
2470
|
-
positions.push(from - start);
|
|
2471
|
-
}
|
|
2472
|
-
movePastNext(tree.to + offset, false);
|
|
2473
|
-
return new Tree(tree.type, children, positions, tree.to + offset - start, tree.tree ? tree.tree.propValues : undefined);
|
|
2474
|
-
}
|
|
2475
|
-
/// A Markdown parser configuration.
|
|
2476
|
-
class MarkdownParser extends Parser {
|
|
2477
|
-
/// @internal
|
|
2478
|
-
constructor(
|
|
2479
|
-
/// The parser's syntax [node
|
|
2480
|
-
/// types](https://lezer.codemirror.net/docs/ref/#common.NodeSet).
|
|
2481
|
-
nodeSet,
|
|
2482
|
-
/// @internal
|
|
2483
|
-
blockParsers,
|
|
2484
|
-
/// @internal
|
|
2485
|
-
leafBlockParsers,
|
|
2486
|
-
/// @internal
|
|
2487
|
-
blockNames,
|
|
2488
|
-
/// @internal
|
|
2489
|
-
endLeafBlock,
|
|
2490
|
-
/// @internal
|
|
2491
|
-
skipContextMarkup,
|
|
2492
|
-
/// @internal
|
|
2493
|
-
inlineParsers,
|
|
2494
|
-
/// @internal
|
|
2495
|
-
inlineNames,
|
|
2496
|
-
/// @internal
|
|
2497
|
-
wrappers) {
|
|
2498
|
-
super();
|
|
2499
|
-
this.nodeSet = nodeSet;
|
|
2500
|
-
this.blockParsers = blockParsers;
|
|
2501
|
-
this.leafBlockParsers = leafBlockParsers;
|
|
2502
|
-
this.blockNames = blockNames;
|
|
2503
|
-
this.endLeafBlock = endLeafBlock;
|
|
2504
|
-
this.skipContextMarkup = skipContextMarkup;
|
|
2505
|
-
this.inlineParsers = inlineParsers;
|
|
2506
|
-
this.inlineNames = inlineNames;
|
|
2507
|
-
this.wrappers = wrappers;
|
|
2508
|
-
/// @internal
|
|
2509
|
-
this.nodeTypes = Object.create(null);
|
|
2510
|
-
for (let t of nodeSet.types) this.nodeTypes[t.name] = t.id;
|
|
2511
|
-
}
|
|
2512
|
-
createParse(input, fragments, ranges) {
|
|
2513
|
-
let parse = new BlockContext(this, input, fragments, ranges);
|
|
2514
|
-
for (let w of this.wrappers) parse = w(parse, input, fragments, ranges);
|
|
2515
|
-
return parse;
|
|
2516
|
-
}
|
|
2517
|
-
/// Reconfigure the parser.
|
|
2518
|
-
configure(spec) {
|
|
2519
|
-
let config = resolveConfig(spec);
|
|
2520
|
-
if (!config) return this;
|
|
2521
|
-
let {
|
|
2522
|
-
nodeSet,
|
|
2523
|
-
skipContextMarkup
|
|
2524
|
-
} = this;
|
|
2525
|
-
let blockParsers = this.blockParsers.slice(),
|
|
2526
|
-
leafBlockParsers = this.leafBlockParsers.slice(),
|
|
2527
|
-
blockNames = this.blockNames.slice(),
|
|
2528
|
-
inlineParsers = this.inlineParsers.slice(),
|
|
2529
|
-
inlineNames = this.inlineNames.slice(),
|
|
2530
|
-
endLeafBlock = this.endLeafBlock.slice(),
|
|
2531
|
-
wrappers = this.wrappers;
|
|
2532
|
-
if (nonEmpty(config.defineNodes)) {
|
|
2533
|
-
skipContextMarkup = Object.assign({}, skipContextMarkup);
|
|
2534
|
-
let nodeTypes = nodeSet.types.slice(),
|
|
2535
|
-
styles;
|
|
2536
|
-
for (let s of config.defineNodes) {
|
|
2537
|
-
let {
|
|
2538
|
-
name,
|
|
2539
|
-
block,
|
|
2540
|
-
composite,
|
|
2541
|
-
style
|
|
2542
|
-
} = typeof s == "string" ? {
|
|
2543
|
-
name: s
|
|
2544
|
-
} : s;
|
|
2545
|
-
if (nodeTypes.some(t => t.name == name)) continue;
|
|
2546
|
-
if (composite) skipContextMarkup[nodeTypes.length] = (bl, cx, line) => composite(cx, line, bl.value);
|
|
2547
|
-
let id = nodeTypes.length;
|
|
2548
|
-
let group = composite ? ["Block", "BlockContext"] : !block ? undefined : id >= Type.ATXHeading1 && id <= Type.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"];
|
|
2549
|
-
nodeTypes.push(NodeType.define({
|
|
2550
|
-
id,
|
|
2551
|
-
name,
|
|
2552
|
-
props: group && [[NodeProp.group, group]]
|
|
2553
|
-
}));
|
|
2554
|
-
if (style) {
|
|
2555
|
-
if (!styles) styles = {};
|
|
2556
|
-
if (Array.isArray(style) || style instanceof Tag) styles[name] = style;else Object.assign(styles, style);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
nodeSet = new NodeSet(nodeTypes);
|
|
2560
|
-
if (styles) nodeSet = nodeSet.extend(styleTags(styles));
|
|
2561
|
-
}
|
|
2562
|
-
if (nonEmpty(config.props)) nodeSet = nodeSet.extend(...config.props);
|
|
2563
|
-
if (nonEmpty(config.remove)) {
|
|
2564
|
-
for (let rm of config.remove) {
|
|
2565
|
-
let block = this.blockNames.indexOf(rm),
|
|
2566
|
-
inline = this.inlineNames.indexOf(rm);
|
|
2567
|
-
if (block > -1) blockParsers[block] = leafBlockParsers[block] = undefined;
|
|
2568
|
-
if (inline > -1) inlineParsers[inline] = undefined;
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
if (nonEmpty(config.parseBlock)) {
|
|
2572
|
-
for (let spec of config.parseBlock) {
|
|
2573
|
-
let found = blockNames.indexOf(spec.name);
|
|
2574
|
-
if (found > -1) {
|
|
2575
|
-
blockParsers[found] = spec.parse;
|
|
2576
|
-
leafBlockParsers[found] = spec.leaf;
|
|
2577
|
-
} else {
|
|
2578
|
-
let pos = spec.before ? findName(blockNames, spec.before) : spec.after ? findName(blockNames, spec.after) + 1 : blockNames.length - 1;
|
|
2579
|
-
blockParsers.splice(pos, 0, spec.parse);
|
|
2580
|
-
leafBlockParsers.splice(pos, 0, spec.leaf);
|
|
2581
|
-
blockNames.splice(pos, 0, spec.name);
|
|
2582
|
-
}
|
|
2583
|
-
if (spec.endLeaf) endLeafBlock.push(spec.endLeaf);
|
|
2584
|
-
}
|
|
2585
|
-
}
|
|
2586
|
-
if (nonEmpty(config.parseInline)) {
|
|
2587
|
-
for (let spec of config.parseInline) {
|
|
2588
|
-
let found = inlineNames.indexOf(spec.name);
|
|
2589
|
-
if (found > -1) {
|
|
2590
|
-
inlineParsers[found] = spec.parse;
|
|
2591
|
-
} else {
|
|
2592
|
-
let pos = spec.before ? findName(inlineNames, spec.before) : spec.after ? findName(inlineNames, spec.after) + 1 : inlineNames.length - 1;
|
|
2593
|
-
inlineParsers.splice(pos, 0, spec.parse);
|
|
2594
|
-
inlineNames.splice(pos, 0, spec.name);
|
|
2595
|
-
}
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
if (config.wrap) wrappers = wrappers.concat(config.wrap);
|
|
2599
|
-
return new MarkdownParser(nodeSet, blockParsers, leafBlockParsers, blockNames, endLeafBlock, skipContextMarkup, inlineParsers, inlineNames, wrappers);
|
|
2600
|
-
}
|
|
2601
|
-
/// @internal
|
|
2602
|
-
getNodeType(name) {
|
|
2603
|
-
let found = this.nodeTypes[name];
|
|
2604
|
-
if (found == null) throw new RangeError(`Unknown node type '${name}'`);
|
|
2605
|
-
return found;
|
|
2606
|
-
}
|
|
2607
|
-
/// Parse the given piece of inline text at the given offset,
|
|
2608
|
-
/// returning an array of [`Element`](#Element) objects representing
|
|
2609
|
-
/// the inline content.
|
|
2610
|
-
parseInline(text, offset) {
|
|
2611
|
-
let cx = new InlineContext(this, text, offset);
|
|
2612
|
-
outer: for (let pos = offset; pos < cx.end;) {
|
|
2613
|
-
let next = cx.char(pos);
|
|
2614
|
-
for (let token of this.inlineParsers) if (token) {
|
|
2615
|
-
let result = token(cx, next, pos);
|
|
2616
|
-
if (result >= 0) {
|
|
2617
|
-
pos = result;
|
|
2618
|
-
continue outer;
|
|
2619
|
-
}
|
|
2620
|
-
}
|
|
2621
|
-
pos++;
|
|
2622
|
-
}
|
|
2623
|
-
return cx.resolveMarkers(0);
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2626
|
-
function nonEmpty(a) {
|
|
2627
|
-
return a != null && a.length > 0;
|
|
2628
|
-
}
|
|
2629
|
-
function resolveConfig(spec) {
|
|
2630
|
-
if (!Array.isArray(spec)) return spec;
|
|
2631
|
-
if (spec.length == 0) return null;
|
|
2632
|
-
let conf = resolveConfig(spec[0]);
|
|
2633
|
-
if (spec.length == 1) return conf;
|
|
2634
|
-
let rest = resolveConfig(spec.slice(1));
|
|
2635
|
-
if (!rest || !conf) return conf || rest;
|
|
2636
|
-
let conc = (a, b) => (a || none).concat(b || none);
|
|
2637
|
-
let wrapA = conf.wrap,
|
|
2638
|
-
wrapB = rest.wrap;
|
|
2639
|
-
return {
|
|
2640
|
-
props: conc(conf.props, rest.props),
|
|
2641
|
-
defineNodes: conc(conf.defineNodes, rest.defineNodes),
|
|
2642
|
-
parseBlock: conc(conf.parseBlock, rest.parseBlock),
|
|
2643
|
-
parseInline: conc(conf.parseInline, rest.parseInline),
|
|
2644
|
-
remove: conc(conf.remove, rest.remove),
|
|
2645
|
-
wrap: !wrapA ? wrapB : !wrapB ? wrapA : (inner, input, fragments, ranges) => wrapA(wrapB(inner, input, fragments, ranges), input, fragments, ranges)
|
|
2646
|
-
};
|
|
2647
|
-
}
|
|
2648
|
-
function findName(names, name) {
|
|
2649
|
-
let found = names.indexOf(name);
|
|
2650
|
-
if (found < 0) throw new RangeError(`Position specified relative to unknown parser ${name}`);
|
|
2651
|
-
return found;
|
|
2652
|
-
}
|
|
2653
|
-
let nodeTypes = [NodeType.none];
|
|
2654
|
-
for (let i = 1, name; name = Type[i]; i++) {
|
|
2655
|
-
nodeTypes[i] = NodeType.define({
|
|
2656
|
-
id: i,
|
|
2657
|
-
name,
|
|
2658
|
-
props: i >= Type.Escape ? [] : [[NodeProp.group, i in DefaultSkipMarkup ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]]
|
|
2659
|
-
});
|
|
2660
|
-
}
|
|
2661
|
-
const none = [];
|
|
2662
|
-
class Buffer {
|
|
2663
|
-
constructor(nodeSet) {
|
|
2664
|
-
this.nodeSet = nodeSet;
|
|
2665
|
-
this.content = [];
|
|
2666
|
-
this.nodes = [];
|
|
2667
|
-
}
|
|
2668
|
-
write(type, from, to, children = 0) {
|
|
2669
|
-
this.content.push(type, from, to, 4 + children * 4);
|
|
2670
|
-
return this;
|
|
2671
|
-
}
|
|
2672
|
-
writeElements(elts, offset = 0) {
|
|
2673
|
-
for (let e of elts) e.writeTo(this, offset);
|
|
2674
|
-
return this;
|
|
2675
|
-
}
|
|
2676
|
-
finish(type, length) {
|
|
2677
|
-
return Tree.build({
|
|
2678
|
-
buffer: this.content,
|
|
2679
|
-
nodeSet: this.nodeSet,
|
|
2680
|
-
reused: this.nodes,
|
|
2681
|
-
topID: type,
|
|
2682
|
-
length
|
|
2683
|
-
});
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
/// Elements are used to compose syntax nodes during parsing.
|
|
2687
|
-
class Element {
|
|
2688
|
-
/// @internal
|
|
2689
|
-
constructor(
|
|
2690
|
-
/// The node's
|
|
2691
|
-
/// [id](https://lezer.codemirror.net/docs/ref/#common.NodeType.id).
|
|
2692
|
-
type,
|
|
2693
|
-
/// The start of the node, as an offset from the start of the document.
|
|
2694
|
-
from,
|
|
2695
|
-
/// The end of the node.
|
|
2696
|
-
to,
|
|
2697
|
-
/// The node's child nodes @internal
|
|
2698
|
-
children = none) {
|
|
2699
|
-
this.type = type;
|
|
2700
|
-
this.from = from;
|
|
2701
|
-
this.to = to;
|
|
2702
|
-
this.children = children;
|
|
2703
|
-
}
|
|
2704
|
-
/// @internal
|
|
2705
|
-
writeTo(buf, offset) {
|
|
2706
|
-
let startOff = buf.content.length;
|
|
2707
|
-
buf.writeElements(this.children, offset);
|
|
2708
|
-
buf.content.push(this.type, this.from + offset, this.to + offset, buf.content.length + 4 - startOff);
|
|
2709
|
-
}
|
|
2710
|
-
/// @internal
|
|
2711
|
-
toTree(nodeSet) {
|
|
2712
|
-
return new Buffer(nodeSet).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
class TreeElement {
|
|
2716
|
-
constructor(tree, from) {
|
|
2717
|
-
this.tree = tree;
|
|
2718
|
-
this.from = from;
|
|
2719
|
-
}
|
|
2720
|
-
get to() {
|
|
2721
|
-
return this.from + this.tree.length;
|
|
2722
|
-
}
|
|
2723
|
-
get type() {
|
|
2724
|
-
return this.tree.type.id;
|
|
2725
|
-
}
|
|
2726
|
-
get children() {
|
|
2727
|
-
return none;
|
|
2728
|
-
}
|
|
2729
|
-
writeTo(buf, offset) {
|
|
2730
|
-
buf.nodes.push(this.tree);
|
|
2731
|
-
buf.content.push(buf.nodes.length - 1, this.from + offset, this.to + offset, -1);
|
|
2732
|
-
}
|
|
2733
|
-
toTree() {
|
|
2734
|
-
return this.tree;
|
|
2735
|
-
}
|
|
2736
|
-
}
|
|
2737
|
-
function elt(type, from, to, children) {
|
|
2738
|
-
return new Element(type, from, to, children);
|
|
2739
|
-
}
|
|
2740
|
-
const EmphasisUnderscore = {
|
|
2741
|
-
resolve: "Emphasis",
|
|
2742
|
-
mark: "EmphasisMark"
|
|
2743
|
-
};
|
|
2744
|
-
const EmphasisAsterisk = {
|
|
2745
|
-
resolve: "Emphasis",
|
|
2746
|
-
mark: "EmphasisMark"
|
|
2747
|
-
};
|
|
2748
|
-
const LinkStart = {},
|
|
2749
|
-
ImageStart = {};
|
|
2750
|
-
class InlineDelimiter {
|
|
2751
|
-
constructor(type, from, to, side) {
|
|
2752
|
-
this.type = type;
|
|
2753
|
-
this.from = from;
|
|
2754
|
-
this.to = to;
|
|
2755
|
-
this.side = side;
|
|
2756
|
-
}
|
|
2757
|
-
}
|
|
2758
|
-
const Escapable = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
|
2759
|
-
let Punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
|
|
2760
|
-
try {
|
|
2761
|
-
Punctuation = new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]", "u");
|
|
2762
|
-
} catch (_) {}
|
|
2763
|
-
const DefaultInline = {
|
|
2764
|
-
Escape(cx, next, start) {
|
|
2765
|
-
if (next != 92 /* '\\' */ || start == cx.end - 1) return -1;
|
|
2766
|
-
let escaped = cx.char(start + 1);
|
|
2767
|
-
for (let i = 0; i < Escapable.length; i++) if (Escapable.charCodeAt(i) == escaped) return cx.append(elt(Type.Escape, start, start + 2));
|
|
2768
|
-
return -1;
|
|
2769
|
-
},
|
|
2770
|
-
Entity(cx, next, start) {
|
|
2771
|
-
if (next != 38 /* '&' */) return -1;
|
|
2772
|
-
let m = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(cx.slice(start + 1, start + 31));
|
|
2773
|
-
return m ? cx.append(elt(Type.Entity, start, start + 1 + m[0].length)) : -1;
|
|
2774
|
-
},
|
|
2775
|
-
InlineCode(cx, next, start) {
|
|
2776
|
-
if (next != 96 /* '`' */ || start && cx.char(start - 1) == 96) return -1;
|
|
2777
|
-
let pos = start + 1;
|
|
2778
|
-
while (pos < cx.end && cx.char(pos) == 96) pos++;
|
|
2779
|
-
let size = pos - start,
|
|
2780
|
-
curSize = 0;
|
|
2781
|
-
for (; pos < cx.end; pos++) {
|
|
2782
|
-
if (cx.char(pos) == 96) {
|
|
2783
|
-
curSize++;
|
|
2784
|
-
if (curSize == size && cx.char(pos + 1) != 96) return cx.append(elt(Type.InlineCode, start, pos + 1, [elt(Type.CodeMark, start, start + size), elt(Type.CodeMark, pos + 1 - size, pos + 1)]));
|
|
2785
|
-
} else {
|
|
2786
|
-
curSize = 0;
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
return -1;
|
|
2790
|
-
},
|
|
2791
|
-
HTMLTag(cx, next, start) {
|
|
2792
|
-
if (next != 60 /* '<' */ || start == cx.end - 1) return -1;
|
|
2793
|
-
let after = cx.slice(start + 1, cx.end);
|
|
2794
|
-
let url = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(after);
|
|
2795
|
-
if (url) return cx.append(elt(Type.URL, start, start + 1 + url[0].length));
|
|
2796
|
-
let comment = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(after);
|
|
2797
|
-
if (comment) return cx.append(elt(Type.Comment, start, start + 1 + comment[0].length));
|
|
2798
|
-
let procInst = /^\?[^]*?\?>/.exec(after);
|
|
2799
|
-
if (procInst) return cx.append(elt(Type.ProcessingInstruction, start, start + 1 + procInst[0].length));
|
|
2800
|
-
let m = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(after);
|
|
2801
|
-
if (!m) return -1;
|
|
2802
|
-
return cx.append(elt(Type.HTMLTag, start, start + 1 + m[0].length));
|
|
2803
|
-
},
|
|
2804
|
-
Emphasis(cx, next, start) {
|
|
2805
|
-
if (next != 95 && next != 42) return -1;
|
|
2806
|
-
let pos = start + 1;
|
|
2807
|
-
while (cx.char(pos) == next) pos++;
|
|
2808
|
-
let before = cx.slice(start - 1, start),
|
|
2809
|
-
after = cx.slice(pos, pos + 1);
|
|
2810
|
-
let pBefore = Punctuation.test(before),
|
|
2811
|
-
pAfter = Punctuation.test(after);
|
|
2812
|
-
let sBefore = /\s|^$/.test(before),
|
|
2813
|
-
sAfter = /\s|^$/.test(after);
|
|
2814
|
-
let leftFlanking = !sAfter && (!pAfter || sBefore || pBefore);
|
|
2815
|
-
let rightFlanking = !sBefore && (!pBefore || sAfter || pAfter);
|
|
2816
|
-
let canOpen = leftFlanking && (next == 42 || !rightFlanking || pBefore);
|
|
2817
|
-
let canClose = rightFlanking && (next == 42 || !leftFlanking || pAfter);
|
|
2818
|
-
return cx.append(new InlineDelimiter(next == 95 ? EmphasisUnderscore : EmphasisAsterisk, start, pos, (canOpen ? 1 /* Open */ : 0) | (canClose ? 2 /* Close */ : 0)));
|
|
2819
|
-
},
|
|
2820
|
-
HardBreak(cx, next, start) {
|
|
2821
|
-
if (next == 92 /* '\\' */ && cx.char(start + 1) == 10 /* '\n' */) return cx.append(elt(Type.HardBreak, start, start + 2));
|
|
2822
|
-
if (next == 32) {
|
|
2823
|
-
let pos = start + 1;
|
|
2824
|
-
while (cx.char(pos) == 32) pos++;
|
|
2825
|
-
if (cx.char(pos) == 10 && pos >= start + 2) return cx.append(elt(Type.HardBreak, start, pos + 1));
|
|
2826
|
-
}
|
|
2827
|
-
return -1;
|
|
2828
|
-
},
|
|
2829
|
-
Link(cx, next, start) {
|
|
2830
|
-
return next == 91 /* '[' */ ? cx.append(new InlineDelimiter(LinkStart, start, start + 1, 1 /* Open */)) : -1;
|
|
2831
|
-
},
|
|
2832
|
-
Image(cx, next, start) {
|
|
2833
|
-
return next == 33 /* '!' */ && cx.char(start + 1) == 91 /* '[' */ ? cx.append(new InlineDelimiter(ImageStart, start, start + 2, 1 /* Open */)) : -1;
|
|
2834
|
-
},
|
|
2835
|
-
LinkEnd(cx, next, start) {
|
|
2836
|
-
if (next != 93 /* ']' */) return -1;
|
|
2837
|
-
// Scanning back to the next link/image start marker
|
|
2838
|
-
for (let i = cx.parts.length - 1; i >= 0; i--) {
|
|
2839
|
-
let part = cx.parts[i];
|
|
2840
|
-
if (part instanceof InlineDelimiter && (part.type == LinkStart || part.type == ImageStart)) {
|
|
2841
|
-
// If this one has been set invalid (because it would produce
|
|
2842
|
-
// a nested link) or there's no valid link here ignore both.
|
|
2843
|
-
if (!part.side || cx.skipSpace(part.to) == start && !/[(\[]/.test(cx.slice(start + 1, start + 2))) {
|
|
2844
|
-
cx.parts[i] = null;
|
|
2845
|
-
return -1;
|
|
2846
|
-
}
|
|
2847
|
-
// Finish the content and replace the entire range in
|
|
2848
|
-
// this.parts with the link/image node.
|
|
2849
|
-
let content = cx.takeContent(i);
|
|
2850
|
-
let link = cx.parts[i] = finishLink(cx, content, part.type == LinkStart ? Type.Link : Type.Image, part.from, start + 1);
|
|
2851
|
-
// Set any open-link markers before this link to invalid.
|
|
2852
|
-
if (part.type == LinkStart) for (let j = 0; j < i; j++) {
|
|
2853
|
-
let p = cx.parts[j];
|
|
2854
|
-
if (p instanceof InlineDelimiter && p.type == LinkStart) p.side = 0;
|
|
2855
|
-
}
|
|
2856
|
-
return link.to;
|
|
2857
|
-
}
|
|
2858
|
-
}
|
|
2859
|
-
return -1;
|
|
2860
|
-
}
|
|
2861
|
-
};
|
|
2862
|
-
function finishLink(cx, content, type, start, startPos) {
|
|
2863
|
-
let {
|
|
2864
|
-
text
|
|
2865
|
-
} = cx,
|
|
2866
|
-
next = cx.char(startPos),
|
|
2867
|
-
endPos = startPos;
|
|
2868
|
-
content.unshift(elt(Type.LinkMark, start, start + (type == Type.Image ? 2 : 1)));
|
|
2869
|
-
content.push(elt(Type.LinkMark, startPos - 1, startPos));
|
|
2870
|
-
if (next == 40 /* '(' */) {
|
|
2871
|
-
let pos = cx.skipSpace(startPos + 1);
|
|
2872
|
-
let dest = parseURL(text, pos - cx.offset, cx.offset),
|
|
2873
|
-
title;
|
|
2874
|
-
if (dest) {
|
|
2875
|
-
pos = cx.skipSpace(dest.to);
|
|
2876
|
-
title = parseLinkTitle(text, pos - cx.offset, cx.offset);
|
|
2877
|
-
if (title) pos = cx.skipSpace(title.to);
|
|
2878
|
-
}
|
|
2879
|
-
if (cx.char(pos) == 41 /* ')' */) {
|
|
2880
|
-
content.push(elt(Type.LinkMark, startPos, startPos + 1));
|
|
2881
|
-
endPos = pos + 1;
|
|
2882
|
-
if (dest) content.push(dest);
|
|
2883
|
-
if (title) content.push(title);
|
|
2884
|
-
content.push(elt(Type.LinkMark, pos, endPos));
|
|
2885
|
-
}
|
|
2886
|
-
} else if (next == 91 /* '[' */) {
|
|
2887
|
-
let label = parseLinkLabel(text, startPos - cx.offset, cx.offset, false);
|
|
2888
|
-
if (label) {
|
|
2889
|
-
content.push(label);
|
|
2890
|
-
endPos = label.to;
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
return elt(type, start, endPos, content);
|
|
2894
|
-
}
|
|
2895
|
-
// These return `null` when falling off the end of the input, `false`
|
|
2896
|
-
// when parsing fails otherwise (for use in the incremental link
|
|
2897
|
-
// reference parser).
|
|
2898
|
-
function parseURL(text, start, offset) {
|
|
2899
|
-
let next = text.charCodeAt(start);
|
|
2900
|
-
if (next == 60 /* '<' */) {
|
|
2901
|
-
for (let pos = start + 1; pos < text.length; pos++) {
|
|
2902
|
-
let ch = text.charCodeAt(pos);
|
|
2903
|
-
if (ch == 62 /* '>' */) return elt(Type.URL, start + offset, pos + 1 + offset);
|
|
2904
|
-
if (ch == 60 || ch == 10 /* '<\n' */) return false;
|
|
2905
|
-
}
|
|
2906
|
-
return null;
|
|
2907
|
-
} else {
|
|
2908
|
-
let depth = 0,
|
|
2909
|
-
pos = start;
|
|
2910
|
-
for (let escaped = false; pos < text.length; pos++) {
|
|
2911
|
-
let ch = text.charCodeAt(pos);
|
|
2912
|
-
if (space(ch)) {
|
|
2913
|
-
break;
|
|
2914
|
-
} else if (escaped) {
|
|
2915
|
-
escaped = false;
|
|
2916
|
-
} else if (ch == 40 /* '(' */) {
|
|
2917
|
-
depth++;
|
|
2918
|
-
} else if (ch == 41 /* ')' */) {
|
|
2919
|
-
if (!depth) break;
|
|
2920
|
-
depth--;
|
|
2921
|
-
} else if (ch == 92 /* '\\' */) {
|
|
2922
|
-
escaped = true;
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
return pos > start ? elt(Type.URL, start + offset, pos + offset) : pos == text.length ? null : false;
|
|
2926
|
-
}
|
|
2927
|
-
}
|
|
2928
|
-
function parseLinkTitle(text, start, offset) {
|
|
2929
|
-
let next = text.charCodeAt(start);
|
|
2930
|
-
if (next != 39 && next != 34 && next != 40 /* '"\'(' */) return false;
|
|
2931
|
-
let end = next == 40 ? 41 : next;
|
|
2932
|
-
for (let pos = start + 1, escaped = false; pos < text.length; pos++) {
|
|
2933
|
-
let ch = text.charCodeAt(pos);
|
|
2934
|
-
if (escaped) escaped = false;else if (ch == end) return elt(Type.LinkTitle, start + offset, pos + 1 + offset);else if (ch == 92 /* '\\' */) escaped = true;
|
|
2935
|
-
}
|
|
2936
|
-
return null;
|
|
2937
|
-
}
|
|
2938
|
-
function parseLinkLabel(text, start, offset, requireNonWS) {
|
|
2939
|
-
for (let escaped = false, pos = start + 1, end = Math.min(text.length, pos + 999); pos < end; pos++) {
|
|
2940
|
-
let ch = text.charCodeAt(pos);
|
|
2941
|
-
if (escaped) escaped = false;else if (ch == 93 /* ']' */) return requireNonWS ? false : elt(Type.LinkLabel, start + offset, pos + 1 + offset);else {
|
|
2942
|
-
if (requireNonWS && !space(ch)) requireNonWS = false;
|
|
2943
|
-
if (ch == 91 /* '[' */) return false;else if (ch == 92 /* '\\' */) escaped = true;
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
return null;
|
|
2947
|
-
}
|
|
2948
|
-
/// Inline parsing functions get access to this context, and use it to
|
|
2949
|
-
/// read the content and emit syntax nodes.
|
|
2950
|
-
class InlineContext {
|
|
2951
|
-
/// @internal
|
|
2952
|
-
constructor(
|
|
2953
|
-
/// The parser that is being used.
|
|
2954
|
-
parser,
|
|
2955
|
-
/// The text of this inline section.
|
|
2956
|
-
text,
|
|
2957
|
-
/// The starting offset of the section in the document.
|
|
2958
|
-
offset) {
|
|
2959
|
-
this.parser = parser;
|
|
2960
|
-
this.text = text;
|
|
2961
|
-
this.offset = offset;
|
|
2962
|
-
/// @internal
|
|
2963
|
-
this.parts = [];
|
|
2964
|
-
}
|
|
2965
|
-
/// Get the character code at the given (document-relative)
|
|
2966
|
-
/// position.
|
|
2967
|
-
char(pos) {
|
|
2968
|
-
return pos >= this.end ? -1 : this.text.charCodeAt(pos - this.offset);
|
|
2969
|
-
}
|
|
2970
|
-
/// The position of the end of this inline section.
|
|
2971
|
-
get end() {
|
|
2972
|
-
return this.offset + this.text.length;
|
|
2973
|
-
}
|
|
2974
|
-
/// Get a substring of this inline section. Again uses
|
|
2975
|
-
/// document-relative positions.
|
|
2976
|
-
slice(from, to) {
|
|
2977
|
-
return this.text.slice(from - this.offset, to - this.offset);
|
|
2978
|
-
}
|
|
2979
|
-
/// @internal
|
|
2980
|
-
append(elt) {
|
|
2981
|
-
this.parts.push(elt);
|
|
2982
|
-
return elt.to;
|
|
2983
|
-
}
|
|
2984
|
-
/// Add a [delimiter](#DelimiterType) at this given position. `open`
|
|
2985
|
-
/// and `close` indicate whether this delimiter is opening, closing,
|
|
2986
|
-
/// or both. Returns the end of the delimiter, for convenient
|
|
2987
|
-
/// returning from [parse functions](#InlineParser.parse).
|
|
2988
|
-
addDelimiter(type, from, to, open, close) {
|
|
2989
|
-
return this.append(new InlineDelimiter(type, from, to, (open ? 1 /* Open */ : 0) | (close ? 2 /* Close */ : 0)));
|
|
2990
|
-
}
|
|
2991
|
-
/// Add an inline element. Returns the end of the element.
|
|
2992
|
-
addElement(elt) {
|
|
2993
|
-
return this.append(elt);
|
|
2994
|
-
}
|
|
2995
|
-
/// Resolve markers between this.parts.length and from, wrapping matched markers in the
|
|
2996
|
-
/// appropriate node and updating the content of this.parts. @internal
|
|
2997
|
-
resolveMarkers(from) {
|
|
2998
|
-
// Scan forward, looking for closing tokens
|
|
2999
|
-
for (let i = from; i < this.parts.length; i++) {
|
|
3000
|
-
let close = this.parts[i];
|
|
3001
|
-
if (!(close instanceof InlineDelimiter && close.type.resolve && close.side & 2 /* Close */)) continue;
|
|
3002
|
-
let emp = close.type == EmphasisUnderscore || close.type == EmphasisAsterisk;
|
|
3003
|
-
let closeSize = close.to - close.from;
|
|
3004
|
-
let open,
|
|
3005
|
-
j = i - 1;
|
|
3006
|
-
// Continue scanning for a matching opening token
|
|
3007
|
-
for (; j >= from; j--) {
|
|
3008
|
-
let part = this.parts[j];
|
|
3009
|
-
if (part instanceof InlineDelimiter && part.side & 1 /* Open */ && part.type == close.type &&
|
|
3010
|
-
// Ignore emphasis delimiters where the character count doesn't match
|
|
3011
|
-
!(emp && (close.side & 1 /* Open */ || part.side & 2 /* Close */) && (part.to - part.from + closeSize) % 3 == 0 && ((part.to - part.from) % 3 || closeSize % 3))) {
|
|
3012
|
-
open = part;
|
|
3013
|
-
break;
|
|
3014
|
-
}
|
|
3015
|
-
}
|
|
3016
|
-
if (!open) continue;
|
|
3017
|
-
let type = close.type.resolve,
|
|
3018
|
-
content = [];
|
|
3019
|
-
let start = open.from,
|
|
3020
|
-
end = close.to;
|
|
3021
|
-
// Emphasis marker effect depends on the character count. Size consumed is minimum of the two
|
|
3022
|
-
// markers.
|
|
3023
|
-
if (emp) {
|
|
3024
|
-
let size = Math.min(2, open.to - open.from, closeSize);
|
|
3025
|
-
start = open.to - size;
|
|
3026
|
-
end = close.from + size;
|
|
3027
|
-
type = size == 1 ? "Emphasis" : "StrongEmphasis";
|
|
3028
|
-
}
|
|
3029
|
-
// Move the covered region into content, optionally adding marker nodes
|
|
3030
|
-
if (open.type.mark) content.push(this.elt(open.type.mark, start, open.to));
|
|
3031
|
-
for (let k = j + 1; k < i; k++) {
|
|
3032
|
-
if (this.parts[k] instanceof Element) content.push(this.parts[k]);
|
|
3033
|
-
this.parts[k] = null;
|
|
3034
|
-
}
|
|
3035
|
-
if (close.type.mark) content.push(this.elt(close.type.mark, close.from, end));
|
|
3036
|
-
let element = this.elt(type, start, end, content);
|
|
3037
|
-
// If there are leftover emphasis marker characters, shrink the close/open markers. Otherwise, clear them.
|
|
3038
|
-
this.parts[j] = emp && open.from != start ? new InlineDelimiter(open.type, open.from, start, open.side) : null;
|
|
3039
|
-
let keep = this.parts[i] = emp && close.to != end ? new InlineDelimiter(close.type, end, close.to, close.side) : null;
|
|
3040
|
-
// Insert the new element in this.parts
|
|
3041
|
-
if (keep) this.parts.splice(i, 0, element);else this.parts[i] = element;
|
|
3042
|
-
}
|
|
3043
|
-
// Collect the elements remaining in this.parts into an array.
|
|
3044
|
-
let result = [];
|
|
3045
|
-
for (let i = from; i < this.parts.length; i++) {
|
|
3046
|
-
let part = this.parts[i];
|
|
3047
|
-
if (part instanceof Element) result.push(part);
|
|
3048
|
-
}
|
|
3049
|
-
return result;
|
|
3050
|
-
}
|
|
3051
|
-
/// Find an opening delimiter of the given type. Returns `null` if
|
|
3052
|
-
/// no delimiter is found, or an index that can be passed to
|
|
3053
|
-
/// [`takeContent`](#InlineContext.takeContent) otherwise.
|
|
3054
|
-
findOpeningDelimiter(type) {
|
|
3055
|
-
for (let i = this.parts.length - 1; i >= 0; i--) {
|
|
3056
|
-
let part = this.parts[i];
|
|
3057
|
-
if (part instanceof InlineDelimiter && part.type == type) return i;
|
|
3058
|
-
}
|
|
3059
|
-
return null;
|
|
3060
|
-
}
|
|
3061
|
-
/// Remove all inline elements and delimiters starting from the
|
|
3062
|
-
/// given index (which you should get from
|
|
3063
|
-
/// [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
|
|
3064
|
-
/// resolve delimiters inside of them, and return them as an array
|
|
3065
|
-
/// of elements.
|
|
3066
|
-
takeContent(startIndex) {
|
|
3067
|
-
let content = this.resolveMarkers(startIndex);
|
|
3068
|
-
this.parts.length = startIndex;
|
|
3069
|
-
return content;
|
|
3070
|
-
}
|
|
3071
|
-
/// Skip space after the given (document) position, returning either
|
|
3072
|
-
/// the position of the next non-space character or the end of the
|
|
3073
|
-
/// section.
|
|
3074
|
-
skipSpace(from) {
|
|
3075
|
-
return skipSpace(this.text, from - this.offset) + this.offset;
|
|
3076
|
-
}
|
|
3077
|
-
elt(type, from, to, children) {
|
|
3078
|
-
if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
|
|
3079
|
-
return new TreeElement(type, from);
|
|
3080
|
-
}
|
|
3081
|
-
}
|
|
3082
|
-
function injectMarks(elements, marks) {
|
|
3083
|
-
if (!marks.length) return elements;
|
|
3084
|
-
if (!elements.length) return marks;
|
|
3085
|
-
let elts = elements.slice(),
|
|
3086
|
-
eI = 0;
|
|
3087
|
-
for (let mark of marks) {
|
|
3088
|
-
while (eI < elts.length && elts[eI].to < mark.to) eI++;
|
|
3089
|
-
if (eI < elts.length && elts[eI].from < mark.from) {
|
|
3090
|
-
let e = elts[eI];
|
|
3091
|
-
if (e instanceof Element) elts[eI] = new Element(e.type, e.from, e.to, injectMarks(e.children, [mark]));
|
|
3092
|
-
} else {
|
|
3093
|
-
elts.splice(eI++, 0, mark);
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
return elts;
|
|
3097
|
-
}
|
|
3098
|
-
// These are blocks that can span blank lines, and should thus only be
|
|
3099
|
-
// reused if their next sibling is also being reused.
|
|
3100
|
-
const NotLast = [Type.CodeBlock, Type.ListItem, Type.OrderedList, Type.BulletList];
|
|
3101
|
-
class FragmentCursor {
|
|
3102
|
-
constructor(fragments, input) {
|
|
3103
|
-
this.fragments = fragments;
|
|
3104
|
-
this.input = input;
|
|
3105
|
-
// Index into fragment array
|
|
3106
|
-
this.i = 0;
|
|
3107
|
-
// Active fragment
|
|
3108
|
-
this.fragment = null;
|
|
3109
|
-
this.fragmentEnd = -1;
|
|
3110
|
-
// Cursor into the current fragment, if any. When `moveTo` returns
|
|
3111
|
-
// true, this points at the first block after `pos`.
|
|
3112
|
-
this.cursor = null;
|
|
3113
|
-
if (fragments.length) this.fragment = fragments[this.i++];
|
|
3114
|
-
}
|
|
3115
|
-
nextFragment() {
|
|
3116
|
-
this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null;
|
|
3117
|
-
this.cursor = null;
|
|
3118
|
-
this.fragmentEnd = -1;
|
|
3119
|
-
}
|
|
3120
|
-
moveTo(pos, lineStart) {
|
|
3121
|
-
while (this.fragment && this.fragment.to <= pos) this.nextFragment();
|
|
3122
|
-
if (!this.fragment || this.fragment.from > (pos ? pos - 1 : 0)) return false;
|
|
3123
|
-
if (this.fragmentEnd < 0) {
|
|
3124
|
-
let end = this.fragment.to;
|
|
3125
|
-
while (end > 0 && this.input.read(end - 1, end) != "\n") end--;
|
|
3126
|
-
this.fragmentEnd = end ? end - 1 : 0;
|
|
3127
|
-
}
|
|
3128
|
-
let c = this.cursor;
|
|
3129
|
-
if (!c) {
|
|
3130
|
-
c = this.cursor = this.fragment.tree.cursor();
|
|
3131
|
-
c.firstChild();
|
|
3132
|
-
}
|
|
3133
|
-
let rPos = pos + this.fragment.offset;
|
|
3134
|
-
while (c.to <= rPos) if (!c.parent()) return false;
|
|
3135
|
-
for (;;) {
|
|
3136
|
-
if (c.from >= rPos) return this.fragment.from <= lineStart;
|
|
3137
|
-
if (!c.childAfter(rPos)) return false;
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
matches(hash) {
|
|
3141
|
-
let tree = this.cursor.tree;
|
|
3142
|
-
return tree && tree.prop(NodeProp.contextHash) == hash;
|
|
3143
|
-
}
|
|
3144
|
-
takeNodes(cx) {
|
|
3145
|
-
let cur = this.cursor,
|
|
3146
|
-
off = this.fragment.offset,
|
|
3147
|
-
fragEnd = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0);
|
|
3148
|
-
let start = cx.absoluteLineStart,
|
|
3149
|
-
end = start,
|
|
3150
|
-
blockI = cx.block.children.length;
|
|
3151
|
-
let prevEnd = end,
|
|
3152
|
-
prevI = blockI;
|
|
3153
|
-
for (;;) {
|
|
3154
|
-
if (cur.to - off > fragEnd) {
|
|
3155
|
-
if (cur.type.isAnonymous && cur.firstChild()) continue;
|
|
3156
|
-
break;
|
|
3157
|
-
}
|
|
3158
|
-
cx.dontInject.add(cur.tree);
|
|
3159
|
-
cx.addNode(cur.tree, cur.from - off);
|
|
3160
|
-
// Taken content must always end in a block, because incremental
|
|
3161
|
-
// parsing happens on block boundaries. Never stop directly
|
|
3162
|
-
// after an indented code block, since those can continue after
|
|
3163
|
-
// any number of blank lines.
|
|
3164
|
-
if (cur.type.is("Block")) {
|
|
3165
|
-
if (NotLast.indexOf(cur.type.id) < 0) {
|
|
3166
|
-
end = cur.to - off;
|
|
3167
|
-
blockI = cx.block.children.length;
|
|
3168
|
-
} else {
|
|
3169
|
-
end = prevEnd;
|
|
3170
|
-
blockI = prevI;
|
|
3171
|
-
prevEnd = cur.to - off;
|
|
3172
|
-
prevI = cx.block.children.length;
|
|
3173
|
-
}
|
|
3174
|
-
}
|
|
3175
|
-
if (!cur.nextSibling()) break;
|
|
3176
|
-
}
|
|
3177
|
-
while (cx.block.children.length > blockI) {
|
|
3178
|
-
cx.block.children.pop();
|
|
3179
|
-
cx.block.positions.pop();
|
|
3180
|
-
}
|
|
3181
|
-
return end - start;
|
|
3182
|
-
}
|
|
3183
|
-
}
|
|
3184
|
-
const markdownHighlighting = styleTags({
|
|
3185
|
-
"Blockquote/...": tags$1.quote,
|
|
3186
|
-
HorizontalRule: tags$1.contentSeparator,
|
|
3187
|
-
"ATXHeading1/... SetextHeading1/...": tags$1.heading1,
|
|
3188
|
-
"ATXHeading2/... SetextHeading2/...": tags$1.heading2,
|
|
3189
|
-
"ATXHeading3/...": tags$1.heading3,
|
|
3190
|
-
"ATXHeading4/...": tags$1.heading4,
|
|
3191
|
-
"ATXHeading5/...": tags$1.heading5,
|
|
3192
|
-
"ATXHeading6/...": tags$1.heading6,
|
|
3193
|
-
"Comment CommentBlock": tags$1.comment,
|
|
3194
|
-
Escape: tags$1.escape,
|
|
3195
|
-
Entity: tags$1.character,
|
|
3196
|
-
"Emphasis/...": tags$1.emphasis,
|
|
3197
|
-
"StrongEmphasis/...": tags$1.strong,
|
|
3198
|
-
"Link/... Image/...": tags$1.link,
|
|
3199
|
-
"OrderedList/... BulletList/...": tags$1.list,
|
|
3200
|
-
"BlockQuote/...": tags$1.quote,
|
|
3201
|
-
"InlineCode CodeText": tags$1.monospace,
|
|
3202
|
-
URL: tags$1.url,
|
|
3203
|
-
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": tags$1.processingInstruction,
|
|
3204
|
-
"CodeInfo LinkLabel": tags$1.labelName,
|
|
3205
|
-
LinkTitle: tags$1.string,
|
|
3206
|
-
Paragraph: tags$1.content
|
|
3207
|
-
});
|
|
3208
|
-
/// The default CommonMark parser.
|
|
3209
|
-
const parser = new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting), Object.keys(DefaultBlockParsers).map(n => DefaultBlockParsers[n]), Object.keys(DefaultBlockParsers).map(n => DefaultLeafBlocks[n]), Object.keys(DefaultBlockParsers), DefaultEndLeaf, DefaultSkipMarkup, Object.keys(DefaultInline).map(n => DefaultInline[n]), Object.keys(DefaultInline), []);
|
|
3210
|
-
function leftOverSpace(node, from, to) {
|
|
3211
|
-
let ranges = [];
|
|
3212
|
-
for (let n = node.firstChild, pos = from;; n = n.nextSibling) {
|
|
3213
|
-
let nextPos = n ? n.from : to;
|
|
3214
|
-
if (nextPos > pos) ranges.push({
|
|
3215
|
-
from: pos,
|
|
3216
|
-
to: nextPos
|
|
3217
|
-
});
|
|
3218
|
-
if (!n) break;
|
|
3219
|
-
pos = n.to;
|
|
3220
|
-
}
|
|
3221
|
-
return ranges;
|
|
3222
|
-
}
|
|
3223
|
-
/// Create a Markdown extension to enable nested parsing on code
|
|
3224
|
-
/// blocks and/or embedded HTML.
|
|
3225
|
-
function parseCode(config) {
|
|
3226
|
-
let {
|
|
3227
|
-
codeParser,
|
|
3228
|
-
htmlParser
|
|
3229
|
-
} = config;
|
|
3230
|
-
let wrap = parseMixed((node, input) => {
|
|
3231
|
-
let id = node.type.id;
|
|
3232
|
-
if (codeParser && (id == Type.CodeBlock || id == Type.FencedCode)) {
|
|
3233
|
-
let info = "";
|
|
3234
|
-
if (id == Type.FencedCode) {
|
|
3235
|
-
let infoNode = node.node.getChild(Type.CodeInfo);
|
|
3236
|
-
if (infoNode) info = input.read(infoNode.from, infoNode.to);
|
|
3237
|
-
}
|
|
3238
|
-
let parser = codeParser(info);
|
|
3239
|
-
if (parser) return {
|
|
3240
|
-
parser,
|
|
3241
|
-
overlay: node => node.type.id == Type.CodeText
|
|
3242
|
-
};
|
|
3243
|
-
} else if (htmlParser && (id == Type.HTMLBlock || id == Type.HTMLTag)) {
|
|
3244
|
-
return {
|
|
3245
|
-
parser: htmlParser,
|
|
3246
|
-
overlay: leftOverSpace(node.node, node.from, node.to)
|
|
3247
|
-
};
|
|
3248
|
-
}
|
|
3249
|
-
return null;
|
|
3250
|
-
});
|
|
3251
|
-
return {
|
|
3252
|
-
wrap
|
|
3253
|
-
};
|
|
3254
|
-
}
|
|
3255
|
-
const StrikethroughDelim = {
|
|
3256
|
-
resolve: "Strikethrough",
|
|
3257
|
-
mark: "StrikethroughMark"
|
|
3258
|
-
};
|
|
3259
|
-
/// An extension that implements
|
|
3260
|
-
/// [GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
|
|
3261
|
-
/// Strikethrough syntax using `~~` delimiters.
|
|
3262
|
-
const Strikethrough = {
|
|
3263
|
-
defineNodes: [{
|
|
3264
|
-
name: "Strikethrough",
|
|
3265
|
-
style: {
|
|
3266
|
-
"Strikethrough/...": tags$1.strikethrough
|
|
3267
|
-
}
|
|
3268
|
-
}, {
|
|
3269
|
-
name: "StrikethroughMark",
|
|
3270
|
-
style: tags$1.processingInstruction
|
|
3271
|
-
}],
|
|
3272
|
-
parseInline: [{
|
|
3273
|
-
name: "Strikethrough",
|
|
3274
|
-
parse(cx, next, pos) {
|
|
3275
|
-
if (next != 126 /* '~' */ || cx.char(pos + 1) != 126 || cx.char(pos + 2) == 126) return -1;
|
|
3276
|
-
let before = cx.slice(pos - 1, pos),
|
|
3277
|
-
after = cx.slice(pos + 2, pos + 3);
|
|
3278
|
-
let sBefore = /\s|^$/.test(before),
|
|
3279
|
-
sAfter = /\s|^$/.test(after);
|
|
3280
|
-
let pBefore = Punctuation.test(before),
|
|
3281
|
-
pAfter = Punctuation.test(after);
|
|
3282
|
-
return cx.addDelimiter(StrikethroughDelim, pos, pos + 2, !sAfter && (!pAfter || sBefore || pBefore), !sBefore && (!pBefore || sAfter || pAfter));
|
|
3283
|
-
},
|
|
3284
|
-
after: "Emphasis"
|
|
3285
|
-
}]
|
|
3286
|
-
};
|
|
3287
|
-
function parseRow(cx, line, startI = 0, elts, offset = 0) {
|
|
3288
|
-
let count = 0,
|
|
3289
|
-
first = true,
|
|
3290
|
-
cellStart = -1,
|
|
3291
|
-
cellEnd = -1,
|
|
3292
|
-
esc = false;
|
|
3293
|
-
let parseCell = () => {
|
|
3294
|
-
elts.push(cx.elt("TableCell", offset + cellStart, offset + cellEnd, cx.parser.parseInline(line.slice(cellStart, cellEnd), offset + cellStart)));
|
|
3295
|
-
};
|
|
3296
|
-
for (let i = startI; i < line.length; i++) {
|
|
3297
|
-
let next = line.charCodeAt(i);
|
|
3298
|
-
if (next == 124 /* '|' */ && !esc) {
|
|
3299
|
-
if (!first || cellStart > -1) count++;
|
|
3300
|
-
first = false;
|
|
3301
|
-
if (elts) {
|
|
3302
|
-
if (cellStart > -1) parseCell();
|
|
3303
|
-
elts.push(cx.elt("TableDelimiter", i + offset, i + offset + 1));
|
|
3304
|
-
}
|
|
3305
|
-
cellStart = cellEnd = -1;
|
|
3306
|
-
} else if (esc || next != 32 && next != 9) {
|
|
3307
|
-
if (cellStart < 0) cellStart = i;
|
|
3308
|
-
cellEnd = i + 1;
|
|
3309
|
-
}
|
|
3310
|
-
esc = !esc && next == 92;
|
|
3311
|
-
}
|
|
3312
|
-
if (cellStart > -1) {
|
|
3313
|
-
count++;
|
|
3314
|
-
if (elts) parseCell();
|
|
3315
|
-
}
|
|
3316
|
-
return count;
|
|
3317
|
-
}
|
|
3318
|
-
function hasPipe(str, start) {
|
|
3319
|
-
for (let i = start; i < str.length; i++) {
|
|
3320
|
-
let next = str.charCodeAt(i);
|
|
3321
|
-
if (next == 124 /* '|' */) return true;
|
|
3322
|
-
if (next == 92 /* '\\' */) i++;
|
|
3323
|
-
}
|
|
3324
|
-
return false;
|
|
3325
|
-
}
|
|
3326
|
-
const delimiterLine = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
|
|
3327
|
-
class TableParser {
|
|
3328
|
-
constructor() {
|
|
3329
|
-
// Null means we haven't seen the second line yet, false means this
|
|
3330
|
-
// isn't a table, and an array means this is a table and we've
|
|
3331
|
-
// parsed the given rows so far.
|
|
3332
|
-
this.rows = null;
|
|
3333
|
-
}
|
|
3334
|
-
nextLine(cx, line, leaf) {
|
|
3335
|
-
if (this.rows == null) {
|
|
3336
|
-
// Second line
|
|
3337
|
-
this.rows = false;
|
|
3338
|
-
let lineText;
|
|
3339
|
-
if ((line.next == 45 || line.next == 58 || line.next == 124 /* '-:|' */) && delimiterLine.test(lineText = line.text.slice(line.pos))) {
|
|
3340
|
-
let firstRow = [],
|
|
3341
|
-
firstCount = parseRow(cx, leaf.content, 0, firstRow, leaf.start);
|
|
3342
|
-
if (firstCount == parseRow(cx, lineText, line.pos)) this.rows = [cx.elt("TableHeader", leaf.start, leaf.start + leaf.content.length, firstRow), cx.elt("TableDelimiter", cx.lineStart + line.pos, cx.lineStart + line.text.length)];
|
|
3343
|
-
}
|
|
3344
|
-
} else if (this.rows) {
|
|
3345
|
-
// Line after the second
|
|
3346
|
-
let content = [];
|
|
3347
|
-
parseRow(cx, line.text, line.pos, content, cx.lineStart);
|
|
3348
|
-
this.rows.push(cx.elt("TableRow", cx.lineStart + line.pos, cx.lineStart + line.text.length, content));
|
|
3349
|
-
}
|
|
3350
|
-
return false;
|
|
3351
|
-
}
|
|
3352
|
-
finish(cx, leaf) {
|
|
3353
|
-
if (!this.rows) return false;
|
|
3354
|
-
cx.addLeafElement(leaf, cx.elt("Table", leaf.start, leaf.start + leaf.content.length, this.rows));
|
|
3355
|
-
return true;
|
|
3356
|
-
}
|
|
3357
|
-
}
|
|
3358
|
-
/// This extension provides
|
|
3359
|
-
/// [GFM-style](https://github.github.com/gfm/#tables-extension-)
|
|
3360
|
-
/// tables, using syntax like this:
|
|
3361
|
-
///
|
|
3362
|
-
/// ```
|
|
3363
|
-
/// | head 1 | head 2 |
|
|
3364
|
-
/// | --- | --- |
|
|
3365
|
-
/// | cell 1 | cell 2 |
|
|
3366
|
-
/// ```
|
|
3367
|
-
const Table = {
|
|
3368
|
-
defineNodes: [{
|
|
3369
|
-
name: "Table",
|
|
3370
|
-
block: true
|
|
3371
|
-
}, {
|
|
3372
|
-
name: "TableHeader",
|
|
3373
|
-
style: {
|
|
3374
|
-
"TableHeader/...": tags$1.heading
|
|
3375
|
-
}
|
|
3376
|
-
}, "TableRow", {
|
|
3377
|
-
name: "TableCell",
|
|
3378
|
-
style: tags$1.content
|
|
3379
|
-
}, {
|
|
3380
|
-
name: "TableDelimiter",
|
|
3381
|
-
style: tags$1.processingInstruction
|
|
3382
|
-
}],
|
|
3383
|
-
parseBlock: [{
|
|
3384
|
-
name: "Table",
|
|
3385
|
-
leaf(_, leaf) {
|
|
3386
|
-
return hasPipe(leaf.content, 0) ? new TableParser() : null;
|
|
3387
|
-
},
|
|
3388
|
-
endLeaf(cx, line, leaf) {
|
|
3389
|
-
if (leaf.parsers.some(p => p instanceof TableParser) || !hasPipe(line.text, line.basePos)) return false;
|
|
3390
|
-
let next = cx.scanLine(cx.absoluteLineEnd + 1).text;
|
|
3391
|
-
return delimiterLine.test(next) && parseRow(cx, line.text, line.basePos) == parseRow(cx, next, line.basePos);
|
|
3392
|
-
},
|
|
3393
|
-
before: "SetextHeading"
|
|
3394
|
-
}]
|
|
3395
|
-
};
|
|
3396
|
-
class TaskParser {
|
|
3397
|
-
nextLine() {
|
|
3398
|
-
return false;
|
|
3399
|
-
}
|
|
3400
|
-
finish(cx, leaf) {
|
|
3401
|
-
cx.addLeafElement(leaf, cx.elt("Task", leaf.start, leaf.start + leaf.content.length, [cx.elt("TaskMarker", leaf.start, leaf.start + 3), ...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3)]));
|
|
3402
|
-
return true;
|
|
3403
|
-
}
|
|
3404
|
-
}
|
|
3405
|
-
/// Extension providing
|
|
3406
|
-
/// [GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
|
|
3407
|
-
/// task list items, where list items can be prefixed with `[ ]` or
|
|
3408
|
-
/// `[x]` to add a checkbox.
|
|
3409
|
-
const TaskList = {
|
|
3410
|
-
defineNodes: [{
|
|
3411
|
-
name: "Task",
|
|
3412
|
-
block: true,
|
|
3413
|
-
style: tags$1.list
|
|
3414
|
-
}, {
|
|
3415
|
-
name: "TaskMarker",
|
|
3416
|
-
style: tags$1.atom
|
|
3417
|
-
}],
|
|
3418
|
-
parseBlock: [{
|
|
3419
|
-
name: "TaskList",
|
|
3420
|
-
leaf(cx, leaf) {
|
|
3421
|
-
return /^\[[ xX]\]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser() : null;
|
|
3422
|
-
},
|
|
3423
|
-
after: "SetextHeading"
|
|
3424
|
-
}]
|
|
3425
|
-
};
|
|
3426
|
-
/// Extension bundle containing [`Table`](#Table),
|
|
3427
|
-
/// [`TaskList`](#TaskList) and [`Strikethrough`](#Strikethrough).
|
|
3428
|
-
const GFM = [Table, TaskList, Strikethrough];
|
|
3429
|
-
function parseSubSuper(ch, node, mark) {
|
|
3430
|
-
return (cx, next, pos) => {
|
|
3431
|
-
if (next != ch || cx.char(pos + 1) == ch) return -1;
|
|
3432
|
-
let elts = [cx.elt(mark, pos, pos + 1)];
|
|
3433
|
-
for (let i = pos + 1; i < cx.end; i++) {
|
|
3434
|
-
let next = cx.char(i);
|
|
3435
|
-
if (next == ch) return cx.addElement(cx.elt(node, pos, i + 1, elts.concat(cx.elt(mark, i, i + 1))));
|
|
3436
|
-
if (next == 92 /* '\\' */) elts.push(cx.elt("Escape", i, i++ + 2));
|
|
3437
|
-
if (space(next)) break;
|
|
3438
|
-
}
|
|
3439
|
-
return -1;
|
|
3440
|
-
};
|
|
3441
|
-
}
|
|
3442
|
-
/// Extension providing
|
|
3443
|
-
/// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
|
|
3444
|
-
/// superscript using `^` markers.
|
|
3445
|
-
const Superscript = {
|
|
3446
|
-
defineNodes: [{
|
|
3447
|
-
name: "Superscript",
|
|
3448
|
-
style: tags$1.special(tags$1.content)
|
|
3449
|
-
}, {
|
|
3450
|
-
name: "SuperscriptMark",
|
|
3451
|
-
style: tags$1.processingInstruction
|
|
3452
|
-
}],
|
|
3453
|
-
parseInline: [{
|
|
3454
|
-
name: "Superscript",
|
|
3455
|
-
parse: parseSubSuper(94 /* '^' */, "Superscript", "SuperscriptMark")
|
|
3456
|
-
}]
|
|
3457
|
-
};
|
|
3458
|
-
/// Extension providing
|
|
3459
|
-
/// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
|
|
3460
|
-
/// subscript using `~` markers.
|
|
3461
|
-
const Subscript = {
|
|
3462
|
-
defineNodes: [{
|
|
3463
|
-
name: "Subscript",
|
|
3464
|
-
style: tags$1.special(tags$1.content)
|
|
3465
|
-
}, {
|
|
3466
|
-
name: "SubscriptMark",
|
|
3467
|
-
style: tags$1.processingInstruction
|
|
3468
|
-
}],
|
|
3469
|
-
parseInline: [{
|
|
3470
|
-
name: "Subscript",
|
|
3471
|
-
parse: parseSubSuper(126 /* '~' */, "Subscript", "SubscriptMark")
|
|
3472
|
-
}]
|
|
3473
|
-
};
|
|
3474
|
-
/// Extension that parses two colons with only letters, underscores,
|
|
3475
|
-
/// and numbers between them as `Emoji` nodes.
|
|
3476
|
-
const Emoji = {
|
|
3477
|
-
defineNodes: [{
|
|
3478
|
-
name: "Emoji",
|
|
3479
|
-
style: tags$1.character
|
|
3480
|
-
}],
|
|
3481
|
-
parseInline: [{
|
|
3482
|
-
name: "Emoji",
|
|
3483
|
-
parse(cx, next, pos) {
|
|
3484
|
-
let match;
|
|
3485
|
-
if (next != 58 /* ':' */ || !(match = /^[a-zA-Z_0-9]+:/.exec(cx.slice(pos + 1, cx.end)))) return -1;
|
|
3486
|
-
return cx.addElement(cx.elt("Emoji", pos, pos + 1 + match[0].length));
|
|
3487
|
-
}
|
|
3488
|
-
}]
|
|
3489
|
-
};
|
|
3490
|
-
|
|
3491
|
-
const data = /*@__PURE__*/defineLanguageFacet({
|
|
3492
|
-
block: {
|
|
3493
|
-
open: "<!--",
|
|
3494
|
-
close: "-->"
|
|
3495
|
-
}
|
|
3496
|
-
});
|
|
3497
|
-
const commonmark = /*@__PURE__*/parser.configure({
|
|
3498
|
-
props: [/*@__PURE__*/foldNodeProp.add(type => {
|
|
3499
|
-
if (!type.is("Block") || type.is("Document")) return undefined;
|
|
3500
|
-
return (tree, state) => ({
|
|
3501
|
-
from: state.doc.lineAt(tree.from).to,
|
|
3502
|
-
to: tree.to
|
|
3503
|
-
});
|
|
3504
|
-
}), /*@__PURE__*/indentNodeProp.add({
|
|
3505
|
-
Document: () => null
|
|
3506
|
-
}), /*@__PURE__*/languageDataProp.add({
|
|
3507
|
-
Document: data
|
|
3508
|
-
})]
|
|
3509
|
-
});
|
|
3510
|
-
function mkLang(parser) {
|
|
3511
|
-
return new Language(data, parser);
|
|
3512
|
-
}
|
|
3513
|
-
/**
|
|
3514
|
-
Language support for strict CommonMark.
|
|
3515
|
-
*/
|
|
3516
|
-
const commonmarkLanguage = /*@__PURE__*/mkLang(commonmark);
|
|
3517
|
-
const extended = /*@__PURE__*/commonmark.configure([GFM, Subscript, Superscript, Emoji]);
|
|
3518
|
-
/**
|
|
3519
|
-
Language support for [GFM](https://github.github.com/gfm/) plus
|
|
3520
|
-
subscript, superscript, and emoji syntax.
|
|
3521
|
-
*/
|
|
3522
|
-
const markdownLanguage = /*@__PURE__*/mkLang(extended);
|
|
3523
|
-
function getCodeParser(languages, defaultLanguage) {
|
|
3524
|
-
return info => {
|
|
3525
|
-
if (info && languages) {
|
|
3526
|
-
let found = null;
|
|
3527
|
-
// Strip anything after whitespace
|
|
3528
|
-
info = /\S*/.exec(info)[0];
|
|
3529
|
-
if (typeof languages == "function") found = languages(info);else found = LanguageDescription.matchLanguageName(languages, info, true);
|
|
3530
|
-
if (found instanceof LanguageDescription) return found.support ? found.support.language.parser : ParseContext.getSkippingParser(found.load());else if (found) return found.parser;
|
|
3531
|
-
}
|
|
3532
|
-
return defaultLanguage ? defaultLanguage.parser : null;
|
|
3533
|
-
};
|
|
3534
|
-
}
|
|
3535
|
-
function nodeStart(node, doc) {
|
|
3536
|
-
return doc.sliceString(node.from, node.from + 50);
|
|
3537
|
-
}
|
|
3538
|
-
class Context {
|
|
3539
|
-
constructor(node, from, to, spaceBefore, spaceAfter, type, item) {
|
|
3540
|
-
this.node = node;
|
|
3541
|
-
this.from = from;
|
|
3542
|
-
this.to = to;
|
|
3543
|
-
this.spaceBefore = spaceBefore;
|
|
3544
|
-
this.spaceAfter = spaceAfter;
|
|
3545
|
-
this.type = type;
|
|
3546
|
-
this.item = item;
|
|
3547
|
-
}
|
|
3548
|
-
blank(trailing = true) {
|
|
3549
|
-
let result = this.spaceBefore;
|
|
3550
|
-
if (this.node.name == "Blockquote") result += ">";else for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--) result += " ";
|
|
3551
|
-
return result + (trailing ? this.spaceAfter : "");
|
|
3552
|
-
}
|
|
3553
|
-
marker(doc, add) {
|
|
3554
|
-
let number = this.node.name == "OrderedList" ? String(+itemNumber(this.item, doc)[2] + add) : "";
|
|
3555
|
-
return this.spaceBefore + number + this.type + this.spaceAfter;
|
|
3556
|
-
}
|
|
3557
|
-
}
|
|
3558
|
-
function getContext(node, line, doc) {
|
|
3559
|
-
let nodes = [];
|
|
3560
|
-
for (let cur = node; cur && cur.name != "Document"; cur = cur.parent) {
|
|
3561
|
-
if (cur.name == "ListItem" || cur.name == "Blockquote") nodes.push(cur);
|
|
3562
|
-
}
|
|
3563
|
-
let context = [],
|
|
3564
|
-
pos = 0;
|
|
3565
|
-
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
3566
|
-
let node = nodes[i],
|
|
3567
|
-
match,
|
|
3568
|
-
start = pos;
|
|
3569
|
-
if (node.name == "Blockquote" && (match = /^[ \t]*>( ?)/.exec(line.slice(pos)))) {
|
|
3570
|
-
pos += match[0].length;
|
|
3571
|
-
context.push(new Context(node, start, pos, "", match[1], ">", null));
|
|
3572
|
-
} else if (node.name == "ListItem" && node.parent.name == "OrderedList" && (match = /^([ \t]*)\d+([.)])([ \t]*)/.exec(nodeStart(node, doc)))) {
|
|
3573
|
-
let after = match[3],
|
|
3574
|
-
len = match[0].length;
|
|
3575
|
-
if (after.length >= 4) {
|
|
3576
|
-
after = after.slice(0, after.length - 4);
|
|
3577
|
-
len -= 4;
|
|
3578
|
-
}
|
|
3579
|
-
pos += len;
|
|
3580
|
-
context.push(new Context(node.parent, start, pos, match[1], after, match[2], node));
|
|
3581
|
-
} else if (node.name == "ListItem" && node.parent.name == "BulletList" && (match = /^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(nodeStart(node, doc)))) {
|
|
3582
|
-
let after = match[4],
|
|
3583
|
-
len = match[0].length;
|
|
3584
|
-
if (after.length > 4) {
|
|
3585
|
-
after = after.slice(0, after.length - 4);
|
|
3586
|
-
len -= 4;
|
|
3587
|
-
}
|
|
3588
|
-
let type = match[2];
|
|
3589
|
-
if (match[3]) type += match[3].replace(/[xX]/, ' ');
|
|
3590
|
-
pos += len;
|
|
3591
|
-
context.push(new Context(node.parent, start, pos, match[1], after, type, node));
|
|
3592
|
-
}
|
|
3593
|
-
}
|
|
3594
|
-
return context;
|
|
3595
|
-
}
|
|
3596
|
-
function itemNumber(item, doc) {
|
|
3597
|
-
return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
|
|
3598
|
-
}
|
|
3599
|
-
function renumberList(after, doc, changes, offset = 0) {
|
|
3600
|
-
for (let prev = -1, node = after;;) {
|
|
3601
|
-
if (node.name == "ListItem") {
|
|
3602
|
-
let m = itemNumber(node, doc);
|
|
3603
|
-
let number = +m[2];
|
|
3604
|
-
if (prev >= 0) {
|
|
3605
|
-
if (number != prev + 1) return;
|
|
3606
|
-
changes.push({
|
|
3607
|
-
from: node.from + m[1].length,
|
|
3608
|
-
to: node.from + m[0].length,
|
|
3609
|
-
insert: String(prev + 2 + offset)
|
|
3610
|
-
});
|
|
3611
|
-
}
|
|
3612
|
-
prev = number;
|
|
3613
|
-
}
|
|
3614
|
-
let next = node.nextSibling;
|
|
3615
|
-
if (!next) break;
|
|
3616
|
-
node = next;
|
|
3617
|
-
}
|
|
3618
|
-
}
|
|
3619
|
-
/**
|
|
3620
|
-
This command, when invoked in Markdown context with cursor
|
|
3621
|
-
selection(s), will create a new line with the markup for
|
|
3622
|
-
blockquotes and lists that were active on the old line. If the
|
|
3623
|
-
cursor was directly after the end of the markup for the old line,
|
|
3624
|
-
trailing whitespace and list markers are removed from that line.
|
|
3625
|
-
|
|
3626
|
-
The command does nothing in non-Markdown context, so it should
|
|
3627
|
-
not be used as the only binding for Enter (even in a Markdown
|
|
3628
|
-
document, HTML and code regions might use a different language).
|
|
3629
|
-
*/
|
|
3630
|
-
const insertNewlineContinueMarkup = ({
|
|
3631
|
-
state,
|
|
3632
|
-
dispatch
|
|
3633
|
-
}) => {
|
|
3634
|
-
let tree = syntaxTree(state),
|
|
3635
|
-
{
|
|
3636
|
-
doc
|
|
3637
|
-
} = state;
|
|
3638
|
-
let dont = null,
|
|
3639
|
-
changes = state.changeByRange(range => {
|
|
3640
|
-
if (!range.empty || !markdownLanguage.isActiveAt(state, range.from)) return dont = {
|
|
3641
|
-
range
|
|
3642
|
-
};
|
|
3643
|
-
let pos = range.from,
|
|
3644
|
-
line = doc.lineAt(pos);
|
|
3645
|
-
let context = getContext(tree.resolveInner(pos, -1), line.text, doc);
|
|
3646
|
-
while (context.length && context[context.length - 1].from > pos - line.from) context.pop();
|
|
3647
|
-
if (!context.length) return dont = {
|
|
3648
|
-
range
|
|
3649
|
-
};
|
|
3650
|
-
let inner = context[context.length - 1];
|
|
3651
|
-
if (inner.to - inner.spaceAfter.length > pos - line.from) return dont = {
|
|
3652
|
-
range
|
|
3653
|
-
};
|
|
3654
|
-
let emptyLine = pos >= inner.to - inner.spaceAfter.length && !/\S/.test(line.text.slice(inner.to));
|
|
3655
|
-
// Empty line in list
|
|
3656
|
-
if (inner.item && emptyLine) {
|
|
3657
|
-
// First list item or blank line before: delete a level of markup
|
|
3658
|
-
if (inner.node.firstChild.to >= pos || line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text)) {
|
|
3659
|
-
let next = context.length > 1 ? context[context.length - 2] : null;
|
|
3660
|
-
let delTo,
|
|
3661
|
-
insert = "";
|
|
3662
|
-
if (next && next.item) {
|
|
3663
|
-
// Re-add marker for the list at the next level
|
|
3664
|
-
delTo = line.from + next.from;
|
|
3665
|
-
insert = next.marker(doc, 1);
|
|
3666
|
-
} else {
|
|
3667
|
-
delTo = line.from + (next ? next.to : 0);
|
|
3668
|
-
}
|
|
3669
|
-
let changes = [{
|
|
3670
|
-
from: delTo,
|
|
3671
|
-
to: pos,
|
|
3672
|
-
insert
|
|
3673
|
-
}];
|
|
3674
|
-
if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes, -2);
|
|
3675
|
-
if (next && next.node.name == "OrderedList") renumberList(next.item, doc, changes);
|
|
3676
|
-
return {
|
|
3677
|
-
range: EditorSelection.cursor(delTo + insert.length),
|
|
3678
|
-
changes
|
|
3679
|
-
};
|
|
3680
|
-
} else {
|
|
3681
|
-
// Move this line down
|
|
3682
|
-
let insert = "";
|
|
3683
|
-
for (let i = 0, e = context.length - 2; i <= e; i++) insert += context[i].blank(i < e);
|
|
3684
|
-
insert += state.lineBreak;
|
|
3685
|
-
return {
|
|
3686
|
-
range: EditorSelection.cursor(pos + insert.length),
|
|
3687
|
-
changes: {
|
|
3688
|
-
from: line.from,
|
|
3689
|
-
insert
|
|
3690
|
-
}
|
|
3691
|
-
};
|
|
3692
|
-
}
|
|
3693
|
-
}
|
|
3694
|
-
if (inner.node.name == "Blockquote" && emptyLine && line.from) {
|
|
3695
|
-
let prevLine = doc.lineAt(line.from - 1),
|
|
3696
|
-
quoted = />\s*$/.exec(prevLine.text);
|
|
3697
|
-
// Two aligned empty quoted lines in a row
|
|
3698
|
-
if (quoted && quoted.index == inner.from) {
|
|
3699
|
-
let changes = state.changes([{
|
|
3700
|
-
from: prevLine.from + quoted.index,
|
|
3701
|
-
to: prevLine.to
|
|
3702
|
-
}, {
|
|
3703
|
-
from: line.from + inner.from,
|
|
3704
|
-
to: line.to
|
|
3705
|
-
}]);
|
|
3706
|
-
return {
|
|
3707
|
-
range: range.map(changes),
|
|
3708
|
-
changes
|
|
3709
|
-
};
|
|
3710
|
-
}
|
|
3711
|
-
}
|
|
3712
|
-
let changes = [];
|
|
3713
|
-
if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes);
|
|
3714
|
-
let insert = state.lineBreak;
|
|
3715
|
-
let continued = inner.item && inner.item.from < line.from;
|
|
3716
|
-
// If not dedented
|
|
3717
|
-
if (!continued || /^[\s\d.)\-+*>]*/.exec(line.text)[0].length >= inner.to) {
|
|
3718
|
-
for (let i = 0, e = context.length - 1; i <= e; i++) insert += i == e && !continued ? context[i].marker(doc, 1) : context[i].blank();
|
|
3719
|
-
}
|
|
3720
|
-
let from = pos;
|
|
3721
|
-
while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1))) from--;
|
|
3722
|
-
changes.push({
|
|
3723
|
-
from,
|
|
3724
|
-
to: pos,
|
|
3725
|
-
insert
|
|
3726
|
-
});
|
|
3727
|
-
return {
|
|
3728
|
-
range: EditorSelection.cursor(from + insert.length),
|
|
3729
|
-
changes
|
|
3730
|
-
};
|
|
3731
|
-
});
|
|
3732
|
-
if (dont) return false;
|
|
3733
|
-
dispatch(state.update(changes, {
|
|
3734
|
-
scrollIntoView: true,
|
|
3735
|
-
userEvent: "input"
|
|
3736
|
-
}));
|
|
3737
|
-
return true;
|
|
3738
|
-
};
|
|
3739
|
-
function isMark(node) {
|
|
3740
|
-
return node.name == "QuoteMark" || node.name == "ListMark";
|
|
3741
|
-
}
|
|
3742
|
-
function contextNodeForDelete(tree, pos) {
|
|
3743
|
-
let node = tree.resolveInner(pos, -1),
|
|
3744
|
-
scan = pos;
|
|
3745
|
-
if (isMark(node)) {
|
|
3746
|
-
scan = node.from;
|
|
3747
|
-
node = node.parent;
|
|
3748
|
-
}
|
|
3749
|
-
for (let prev; prev = node.childBefore(scan);) {
|
|
3750
|
-
if (isMark(prev)) {
|
|
3751
|
-
scan = prev.from;
|
|
3752
|
-
} else if (prev.name == "OrderedList" || prev.name == "BulletList") {
|
|
3753
|
-
node = prev.lastChild;
|
|
3754
|
-
scan = node.to;
|
|
3755
|
-
} else {
|
|
3756
|
-
break;
|
|
3757
|
-
}
|
|
3758
|
-
}
|
|
3759
|
-
return node;
|
|
3760
|
-
}
|
|
3761
|
-
/**
|
|
3762
|
-
This command will, when invoked in a Markdown context with the
|
|
3763
|
-
cursor directly after list or blockquote markup, delete one level
|
|
3764
|
-
of markup. When the markup is for a list, it will be replaced by
|
|
3765
|
-
spaces on the first invocation (a further invocation will delete
|
|
3766
|
-
the spaces), to make it easy to continue a list.
|
|
3767
|
-
|
|
3768
|
-
When not after Markdown block markup, this command will return
|
|
3769
|
-
false, so it is intended to be bound alongside other deletion
|
|
3770
|
-
commands, with a higher precedence than the more generic commands.
|
|
3771
|
-
*/
|
|
3772
|
-
const deleteMarkupBackward = ({
|
|
3773
|
-
state,
|
|
3774
|
-
dispatch
|
|
3775
|
-
}) => {
|
|
3776
|
-
let tree = syntaxTree(state);
|
|
3777
|
-
let dont = null,
|
|
3778
|
-
changes = state.changeByRange(range => {
|
|
3779
|
-
let pos = range.from,
|
|
3780
|
-
{
|
|
3781
|
-
doc
|
|
3782
|
-
} = state;
|
|
3783
|
-
if (range.empty && markdownLanguage.isActiveAt(state, range.from)) {
|
|
3784
|
-
let line = doc.lineAt(pos);
|
|
3785
|
-
let context = getContext(contextNodeForDelete(tree, pos), line.text, doc);
|
|
3786
|
-
if (context.length) {
|
|
3787
|
-
let inner = context[context.length - 1];
|
|
3788
|
-
let spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
|
|
3789
|
-
// Delete extra trailing space after markup
|
|
3790
|
-
if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from))) return {
|
|
3791
|
-
range: EditorSelection.cursor(line.from + spaceEnd),
|
|
3792
|
-
changes: {
|
|
3793
|
-
from: line.from + spaceEnd,
|
|
3794
|
-
to: pos
|
|
3795
|
-
}
|
|
3796
|
-
};
|
|
3797
|
-
if (pos - line.from == spaceEnd) {
|
|
3798
|
-
let start = line.from + inner.from;
|
|
3799
|
-
// Replace a list item marker with blank space
|
|
3800
|
-
if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) return {
|
|
3801
|
-
range,
|
|
3802
|
-
changes: {
|
|
3803
|
-
from: start,
|
|
3804
|
-
to: line.from + inner.to,
|
|
3805
|
-
insert: inner.blank()
|
|
3806
|
-
}
|
|
3807
|
-
};
|
|
3808
|
-
// Delete one level of indentation
|
|
3809
|
-
if (start < pos) return {
|
|
3810
|
-
range: EditorSelection.cursor(start),
|
|
3811
|
-
changes: {
|
|
3812
|
-
from: start,
|
|
3813
|
-
to: pos
|
|
3814
|
-
}
|
|
3815
|
-
};
|
|
3816
|
-
}
|
|
3817
|
-
}
|
|
3818
|
-
}
|
|
3819
|
-
return dont = {
|
|
3820
|
-
range
|
|
3821
|
-
};
|
|
3822
|
-
});
|
|
3823
|
-
if (dont) return false;
|
|
3824
|
-
dispatch(state.update(changes, {
|
|
3825
|
-
scrollIntoView: true,
|
|
3826
|
-
userEvent: "delete"
|
|
3827
|
-
}));
|
|
3828
|
-
return true;
|
|
3829
|
-
};
|
|
3830
|
-
|
|
3831
|
-
/**
|
|
3832
|
-
A small keymap with Markdown-specific bindings. Binds Enter to
|
|
3833
|
-
[`insertNewlineContinueMarkup`](https://codemirror.net/6/docs/ref/#lang-markdown.insertNewlineContinueMarkup)
|
|
3834
|
-
and Backspace to
|
|
3835
|
-
[`deleteMarkupBackward`](https://codemirror.net/6/docs/ref/#lang-markdown.deleteMarkupBackward).
|
|
3836
|
-
*/
|
|
3837
|
-
const markdownKeymap = [{
|
|
3838
|
-
key: "Enter",
|
|
3839
|
-
run: insertNewlineContinueMarkup
|
|
3840
|
-
}, {
|
|
3841
|
-
key: "Backspace",
|
|
3842
|
-
run: deleteMarkupBackward
|
|
3843
|
-
}];
|
|
3844
|
-
const htmlNoMatch = /*@__PURE__*/html({
|
|
3845
|
-
matchClosingTags: false
|
|
3846
|
-
});
|
|
3847
|
-
/**
|
|
3848
|
-
Markdown language support.
|
|
3849
|
-
*/
|
|
3850
|
-
function markdown(config = {}) {
|
|
3851
|
-
let {
|
|
3852
|
-
codeLanguages,
|
|
3853
|
-
defaultCodeLanguage,
|
|
3854
|
-
addKeymap = true,
|
|
3855
|
-
base: {
|
|
3856
|
-
parser
|
|
3857
|
-
} = commonmarkLanguage
|
|
3858
|
-
} = config;
|
|
3859
|
-
if (!(parser instanceof MarkdownParser)) throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
|
|
3860
|
-
let extensions = config.extensions ? [config.extensions] : [];
|
|
3861
|
-
let support = [htmlNoMatch.support],
|
|
3862
|
-
defaultCode;
|
|
3863
|
-
if (defaultCodeLanguage instanceof LanguageSupport) {
|
|
3864
|
-
support.push(defaultCodeLanguage.support);
|
|
3865
|
-
defaultCode = defaultCodeLanguage.language;
|
|
3866
|
-
} else if (defaultCodeLanguage) {
|
|
3867
|
-
defaultCode = defaultCodeLanguage;
|
|
3868
|
-
}
|
|
3869
|
-
let codeParser = codeLanguages || defaultCode ? getCodeParser(codeLanguages, defaultCode) : undefined;
|
|
3870
|
-
extensions.push(parseCode({
|
|
3871
|
-
codeParser,
|
|
3872
|
-
htmlParser: htmlNoMatch.language.parser
|
|
3873
|
-
}));
|
|
3874
|
-
if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
|
|
3875
|
-
return new LanguageSupport(mkLang(parser.configure(extensions)), support);
|
|
3876
|
-
}
|
|
3877
|
-
|
|
3878
|
-
const JS = javascript({
|
|
3879
|
-
typescript: false
|
|
3880
|
-
});
|
|
3881
|
-
const TS = javascript({
|
|
3882
|
-
typescript: true
|
|
3883
|
-
});
|
|
3884
|
-
const CSS = css();
|
|
3885
|
-
const HTML = html();
|
|
3886
|
-
const JSON$1 = json();
|
|
3887
|
-
const MD = markdown();
|
|
3888
|
-
var languages = {
|
|
3889
|
-
[OrCodeLanguages.JS]: JS,
|
|
3890
|
-
[OrCodeLanguages.TS]: TS,
|
|
3891
|
-
[OrCodeLanguages.CSS]: CSS,
|
|
3892
|
-
[OrCodeLanguages.HTML]: HTML,
|
|
3893
|
-
[OrCodeLanguages.JSON]: JSON$1,
|
|
3894
|
-
[OrCodeLanguages.MD]: MD
|
|
3895
|
-
};
|
|
3896
|
-
|
|
3897
|
-
export { CSS, HTML, JS, JSON$1 as JSON, MD, TS, languages as default };
|
|
1
|
+
export { C as CSS, H as HTML, J as JS, e as JSON, M as MD, T as TS, l as default } from '../../lang-02d2bb2d.js';
|
|
2
|
+
import './constants.js';
|
|
3
|
+
import '../../index-6976c52a.js';
|