@health-samurai/react-components 0.0.0-alpha.2 → 0.0.0-alpha.21
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/LICENSE +21 -0
- package/README.md +102 -1
- package/dist/bundle.css +2349 -754
- package/dist/src/components/button-dropdown.d.ts +10 -0
- package/dist/src/components/button-dropdown.d.ts.map +1 -0
- package/dist/src/components/button-dropdown.js +70 -0
- package/dist/src/components/button-dropdown.js.map +1 -0
- package/dist/src/components/button-dropdown.stories.js +48 -0
- package/dist/src/components/button-dropdown.stories.js.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.d.ts +70 -0
- package/dist/src/components/code-editor/fhir-autocomplete.d.ts.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.js +1850 -0
- package/dist/src/components/code-editor/fhir-autocomplete.js.map +1 -0
- package/dist/src/components/code-editor/fhir-autocomplete.test.js +1099 -0
- package/dist/src/components/code-editor/fhir-autocomplete.test.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts +3 -0
- package/dist/src/components/code-editor/http/grammar/http.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/dist/src/components/code-editor/http/grammar/http.js +38 -0
- package/dist/src/components/code-editor/http/grammar/http.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js +4 -0
- package/dist/src/components/code-editor/http/grammar/http.terms.js.map +1 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js +80 -0
- package/dist/src/components/code-editor/http/grammar/http.test.js.map +1 -0
- package/dist/src/components/code-editor/http/index.d.ts +12 -0
- package/dist/src/components/code-editor/http/index.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/index.js +486 -0
- package/dist/src/components/code-editor/http/index.js.map +1 -0
- package/dist/src/components/code-editor/index.d.ts +39 -1
- package/dist/src/components/code-editor/index.d.ts.map +1 -1
- package/dist/src/components/code-editor/index.js +1792 -45
- package/dist/src/components/code-editor/index.js.map +1 -1
- package/dist/src/components/code-editor/json-ast.d.ts +46 -0
- package/dist/src/components/code-editor/json-ast.d.ts.map +1 -0
- package/dist/src/components/code-editor/json-ast.js +465 -0
- package/dist/src/components/code-editor/json-ast.js.map +1 -0
- package/dist/src/components/code-editor/json-ast.test.js +206 -0
- package/dist/src/components/code-editor/json-ast.test.js.map +1 -0
- package/dist/src/components/code-editor/sql-completion.d.ts +22 -0
- package/dist/src/components/code-editor/sql-completion.d.ts.map +1 -0
- package/dist/src/components/code-editor/sql-completion.js +897 -0
- package/dist/src/components/code-editor/sql-completion.js.map +1 -0
- package/dist/src/components/code-editor.stories.js +280 -3
- package/dist/src/components/code-editor.stories.js.map +1 -1
- package/dist/src/components/copy-icon.d.ts +5 -1
- package/dist/src/components/copy-icon.d.ts.map +1 -1
- package/dist/src/components/copy-icon.js +41 -3
- package/dist/src/components/copy-icon.js.map +1 -1
- package/dist/src/components/data-table.d.ts +9 -0
- package/dist/src/components/data-table.d.ts.map +1 -0
- package/dist/src/components/data-table.js +66 -0
- package/dist/src/components/data-table.js.map +1 -0
- package/dist/src/components/data-table.stories.js +240 -0
- package/dist/src/components/data-table.stories.js.map +1 -0
- package/dist/src/components/date-picker-input.d.ts +10 -0
- package/dist/src/components/date-picker-input.d.ts.map +1 -0
- package/dist/src/components/date-picker-input.js +90 -0
- package/dist/src/components/date-picker-input.js.map +1 -0
- package/dist/src/components/date-picker-input.stories.js +76 -0
- package/dist/src/components/date-picker-input.stories.js.map +1 -0
- package/dist/src/components/fhir-structure-view.d.ts +34 -0
- package/dist/src/components/fhir-structure-view.d.ts.map +1 -0
- package/dist/src/components/fhir-structure-view.js +230 -0
- package/dist/src/components/fhir-structure-view.js.map +1 -0
- package/dist/src/components/fhir-structure-view.stories.js +447 -0
- package/dist/src/components/fhir-structure-view.stories.js.map +1 -0
- package/dist/src/components/icon-button.d.ts +12 -0
- package/dist/src/components/icon-button.d.ts.map +1 -0
- package/dist/src/components/icon-button.js +41 -0
- package/dist/src/components/icon-button.js.map +1 -0
- package/dist/src/components/icon-button.stories.js +157 -0
- package/dist/src/components/icon-button.stories.js.map +1 -0
- package/dist/src/components/operation-outcome-view.d.ts +27 -0
- package/dist/src/components/operation-outcome-view.d.ts.map +1 -0
- package/dist/src/components/operation-outcome-view.js +198 -0
- package/dist/src/components/operation-outcome-view.js.map +1 -0
- package/dist/src/components/operation-outcome-view.stories.js +207 -0
- package/dist/src/components/operation-outcome-view.stories.js.map +1 -0
- package/dist/src/components/request-line-editor.d.ts +13 -35
- package/dist/src/components/request-line-editor.d.ts.map +1 -1
- package/dist/src/components/request-line-editor.js +73 -49
- package/dist/src/components/request-line-editor.js.map +1 -1
- package/dist/src/components/request-line-editor.stories.js +17 -53
- package/dist/src/components/request-line-editor.stories.js.map +1 -1
- package/dist/src/components/sandbox.d.ts +13 -0
- package/dist/src/components/sandbox.d.ts.map +1 -0
- package/dist/src/components/sandbox.js +107 -0
- package/dist/src/components/sandbox.js.map +1 -0
- package/dist/src/components/sandbox.stories.js +126 -0
- package/dist/src/components/sandbox.stories.js.map +1 -0
- package/dist/src/components/segment-control.d.ts +13 -0
- package/dist/src/components/segment-control.d.ts.map +1 -0
- package/dist/src/components/segment-control.js +33 -0
- package/dist/src/components/segment-control.js.map +1 -0
- package/dist/src/components/segment-control.stories.js +68 -0
- package/dist/src/components/segment-control.stories.js.map +1 -0
- package/dist/src/components/split-button.d.ts +12 -0
- package/dist/src/components/split-button.d.ts.map +1 -0
- package/dist/src/components/split-button.js +33 -0
- package/dist/src/components/split-button.js.map +1 -0
- package/dist/src/components/split-button.stories.js +84 -0
- package/dist/src/components/split-button.stories.js.map +1 -0
- package/dist/src/components/tag.d.ts +16 -0
- package/dist/src/components/tag.d.ts.map +1 -0
- package/dist/src/components/tag.js +198 -0
- package/dist/src/components/tag.js.map +1 -0
- package/dist/src/components/tag.stories.js +459 -0
- package/dist/src/components/tag.stories.js.map +1 -0
- package/dist/src/components/tile.d.ts +15 -0
- package/dist/src/components/tile.d.ts.map +1 -0
- package/dist/src/components/tile.js +76 -0
- package/dist/src/components/tile.js.map +1 -0
- package/dist/src/components/tile.stories.js +167 -0
- package/dist/src/components/tile.stories.js.map +1 -0
- package/dist/src/components/toolbar.d.ts +18 -0
- package/dist/src/components/toolbar.d.ts.map +1 -0
- package/dist/src/components/toolbar.js +61 -0
- package/dist/src/components/toolbar.js.map +1 -0
- package/dist/src/components/toolbar.stories.js +69 -0
- package/dist/src/components/toolbar.stories.js.map +1 -0
- package/dist/src/components/tree-view.d.ts +47 -0
- package/dist/src/components/tree-view.d.ts.map +1 -0
- package/dist/src/components/tree-view.js +122 -0
- package/dist/src/components/tree-view.js.map +1 -0
- package/dist/src/components/tree-view.stories.js +283 -0
- package/dist/src/components/tree-view.stories.js.map +1 -0
- package/dist/src/icons.d.ts +11 -0
- package/dist/src/icons.d.ts.map +1 -0
- package/dist/src/icons.js +328 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.css +358 -74
- package/dist/src/index.d.ts +17 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +17 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.d.ts +2 -2
- package/dist/src/shadcn/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.js +35 -9
- package/dist/src/shadcn/components/ui/accordion.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts +12 -4
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.js +128 -18
- package/dist/src/shadcn/components/ui/alert-dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.stories.js +269 -19
- package/dist/src/shadcn/components/ui/alert-dialog.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.d.ts +29 -6
- package/dist/src/shadcn/components/ui/alert.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert.js +50 -19
- package/dist/src/shadcn/components/ui/alert.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.stories.js +140 -36
- package/dist/src/shadcn/components/ui/alert.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.js +1 -0
- package/dist/src/shadcn/components/ui/aspect-ratio.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.js +4 -3
- package/dist/src/shadcn/components/ui/avatar.js.map +1 -1
- package/dist/src/shadcn/components/ui/avatar.stories.js +68 -2
- package/dist/src/shadcn/components/ui/avatar.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts +1 -1
- package/dist/src/shadcn/components/ui/badge.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/badge.js +16 -5
- package/dist/src/shadcn/components/ui/badge.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts +5 -2
- package/dist/src/shadcn/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.js +98 -13
- package/dist/src/shadcn/components/ui/breadcrumb.js.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.stories.js +205 -45
- package/dist/src/shadcn/components/ui/breadcrumb.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/button.js +65 -11
- package/dist/src/shadcn/components/ui/button.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.stories.js +99 -17
- package/dist/src/shadcn/components/ui/button.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/calendar.d.ts +1 -1
- package/dist/src/shadcn/components/ui/calendar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/calendar.js +1 -0
- package/dist/src/shadcn/components/ui/calendar.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.d.ts +5 -1
- package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/card.js +28 -7
- package/dist/src/shadcn/components/ui/card.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.stories.js +23 -2
- package/dist/src/shadcn/components/ui/card.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/carousel.d.ts +1 -1
- package/dist/src/shadcn/components/ui/carousel.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/carousel.js +1 -0
- package/dist/src/shadcn/components/ui/carousel.js.map +1 -1
- package/dist/src/shadcn/components/ui/chart.d.ts +5 -5
- package/dist/src/shadcn/components/ui/chart.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/chart.js +4 -3
- package/dist/src/shadcn/components/ui/chart.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts +5 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.js +46 -6
- package/dist/src/shadcn/components/ui/checkbox.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.js +156 -46
- package/dist/src/shadcn/components/ui/checkbox.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/combobox.d.ts +29 -0
- package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.js +226 -0
- package/dist/src/shadcn/components/ui/combobox.js.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js +167 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/command.d.ts +4 -2
- package/dist/src/shadcn/components/ui/command.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/command.js +75 -13
- package/dist/src/shadcn/components/ui/command.js.map +1 -1
- package/dist/src/shadcn/components/ui/command.stories.js +277 -57
- package/dist/src/shadcn/components/ui/command.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/context-menu.d.ts +7 -3
- package/dist/src/shadcn/components/ui/context-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/context-menu.js +120 -13
- package/dist/src/shadcn/components/ui/context-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dialog.js +35 -7
- package/dist/src/shadcn/components/ui/dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/drawer.js +27 -5
- package/dist/src/shadcn/components/ui/drawer.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts +7 -3
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js +122 -14
- package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.js +22 -5
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/form.d.ts +2 -2
- package/dist/src/shadcn/components/ui/form.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/form.js +17 -8
- package/dist/src/shadcn/components/ui/form.js.map +1 -1
- package/dist/src/shadcn/components/ui/hover-card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/hover-card.js +2 -1
- package/dist/src/shadcn/components/ui/hover-card.js.map +1 -1
- package/dist/src/shadcn/components/ui/input-otp.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input-otp.js +1 -0
- package/dist/src/shadcn/components/ui/input-otp.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.d.ts +3 -1
- package/dist/src/shadcn/components/ui/input.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/input.js +126 -17
- package/dist/src/shadcn/components/ui/input.js.map +1 -1
- package/dist/src/shadcn/components/ui/input.stories.js +218 -29
- package/dist/src/shadcn/components/ui/input.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/label.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/label.js +9 -1
- package/dist/src/shadcn/components/ui/label.js.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/menubar.js +35 -13
- package/dist/src/shadcn/components/ui/menubar.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.d.ts +9 -2
- package/dist/src/shadcn/components/ui/pagination.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.js +41 -24
- package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.stories.js +44 -37
- package/dist/src/shadcn/components/ui/pagination.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/popover.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/popover.js +13 -1
- package/dist/src/shadcn/components/ui/popover.js.map +1 -1
- package/dist/src/shadcn/components/ui/progress.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/progress.js +6 -2
- package/dist/src/shadcn/components/ui/progress.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-button-group.d.ts +21 -0
- package/dist/src/shadcn/components/ui/radio-button-group.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/radio-button-group.js +148 -0
- package/dist/src/shadcn/components/ui/radio-button-group.js.map +1 -0
- package/dist/src/shadcn/components/ui/radio-button-group.stories.js +283 -0
- package/dist/src/shadcn/components/ui/radio-button-group.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/radio-group.d.ts +5 -1
- package/dist/src/shadcn/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.js +40 -7
- package/dist/src/shadcn/components/ui/radio-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.js +107 -32
- package/dist/src/shadcn/components/ui/radio-group.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.js +2 -1
- package/dist/src/shadcn/components/ui/resizable.js.map +1 -1
- package/dist/src/shadcn/components/ui/resizable.stories.js +2 -2
- package/dist/src/shadcn/components/ui/resizable.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/scroll-area.js +10 -3
- package/dist/src/shadcn/components/ui/scroll-area.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.d.ts +1 -2
- package/dist/src/shadcn/components/ui/select.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.js +49 -19
- package/dist/src/shadcn/components/ui/select.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.js +193 -70
- package/dist/src/shadcn/components/ui/select.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/separator.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/separator.js +8 -1
- package/dist/src/shadcn/components/ui/separator.js.map +1 -1
- package/dist/src/shadcn/components/ui/sheet.js +1 -1
- package/dist/src/shadcn/components/ui/sheet.js.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.d.ts +4 -4
- package/dist/src/shadcn/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.js +21 -6
- package/dist/src/shadcn/components/ui/sidebar.js.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/skeleton.js +3 -1
- package/dist/src/shadcn/components/ui/skeleton.js.map +1 -1
- package/dist/src/shadcn/components/ui/slider.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/slider.js +35 -4
- package/dist/src/shadcn/components/ui/slider.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts +24 -2
- package/dist/src/shadcn/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.js +127 -9
- package/dist/src/shadcn/components/ui/sonner.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.js +251 -12
- package/dist/src/shadcn/components/ui/sonner.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.d.ts +7 -1
- package/dist/src/shadcn/components/ui/switch.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/switch.js +55 -3
- package/dist/src/shadcn/components/ui/switch.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.stories.js +84 -9
- package/dist/src/shadcn/components/ui/switch.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.d.ts +23 -6
- package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/table.js +65 -20
- package/dist/src/shadcn/components/ui/table.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.stories.js +217 -97
- package/dist/src/shadcn/components/ui/table.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.d.ts +30 -5
- package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.js +470 -23
- package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js +405 -181
- package/dist/src/shadcn/components/ui/tabs.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts +8 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.js +30 -2
- package/dist/src/shadcn/components/ui/textarea.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.stories.js +85 -4
- package/dist/src/shadcn/components/ui/textarea.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.d.ts +3 -3
- package/dist/src/shadcn/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.js +14 -12
- package/dist/src/shadcn/components/ui/toggle-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.d.ts +3 -4
- package/dist/src/shadcn/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.js +44 -16
- package/dist/src/shadcn/components/ui/toggle.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.stories.js +130 -7
- package/dist/src/shadcn/components/ui/toggle.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.js +12 -1
- package/dist/src/shadcn/components/ui/tooltip.js.map +1 -1
- package/dist/src/shadcn/components/ui/tree.d.ts +29 -0
- package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/tree.js +135 -0
- package/dist/src/shadcn/components/ui/tree.js.map +1 -0
- package/dist/src/shadcn/shadcn.css +4 -4
- package/dist/src/tokens.css +50 -20
- package/dist/src/typography.css +78 -15
- package/package.json +84 -64
- package/src/components/button-dropdown.stories.tsx +41 -0
- package/src/components/button-dropdown.tsx +97 -0
- package/src/components/code-editor/fhir-autocomplete.test.ts +993 -0
- package/src/components/code-editor/fhir-autocomplete.ts +2322 -0
- package/src/components/code-editor/http/grammar/http.grammar +74 -0
- package/src/components/code-editor/http/grammar/http.terms.ts +9 -0
- package/src/components/code-editor/http/grammar/http.test.ts +110 -0
- package/src/components/code-editor/http/grammar/http.ts +21 -0
- package/src/components/code-editor/http/index.ts +424 -0
- package/src/components/code-editor/index.tsx +1944 -42
- package/src/components/code-editor/json-ast.test.ts +230 -0
- package/src/components/code-editor/json-ast.ts +590 -0
- package/src/components/code-editor/sql-completion.ts +1112 -0
- package/src/components/code-editor.stories.tsx +325 -2
- package/src/components/copy-icon.tsx +57 -3
- package/src/components/data-table.stories.tsx +91 -0
- package/src/components/data-table.tsx +126 -0
- package/src/components/date-picker-input.stories.tsx +79 -0
- package/src/components/date-picker-input.tsx +104 -0
- package/src/components/fhir-structure-view.stories.tsx +439 -0
- package/src/components/fhir-structure-view.tsx +233 -0
- package/src/components/icon-button.stories.tsx +86 -0
- package/src/components/icon-button.tsx +57 -0
- package/src/components/operation-outcome-view.stories.tsx +163 -0
- package/src/components/operation-outcome-view.tsx +254 -0
- package/src/components/request-line-editor.stories.tsx +17 -27
- package/src/components/request-line-editor.tsx +103 -61
- package/src/components/sandbox.stories.tsx +131 -0
- package/src/components/sandbox.tsx +191 -0
- package/src/components/segment-control.stories.tsx +61 -0
- package/src/components/segment-control.tsx +83 -0
- package/src/components/split-button.stories.tsx +68 -0
- package/src/components/split-button.tsx +74 -0
- package/src/components/tag.stories.tsx +371 -0
- package/src/components/tag.tsx +236 -0
- package/src/components/tile.stories.tsx +149 -0
- package/src/components/tile.tsx +105 -0
- package/src/components/toolbar.stories.tsx +64 -0
- package/src/components/toolbar.tsx +98 -0
- package/src/components/tree-view.stories.tsx +265 -0
- package/src/components/tree-view.tsx +246 -0
- package/src/icons.tsx +331 -0
- package/src/index.css +358 -74
- package/src/index.tsx +17 -3
- package/src/shadcn/components/ui/accordion.tsx +91 -10
- package/src/shadcn/components/ui/alert-dialog.stories.tsx +209 -15
- package/src/shadcn/components/ui/alert-dialog.tsx +236 -26
- package/src/shadcn/components/ui/alert.stories.tsx +120 -21
- package/src/shadcn/components/ui/alert.tsx +125 -28
- package/src/shadcn/components/ui/aspect-ratio.tsx +1 -0
- package/src/shadcn/components/ui/avatar.stories.tsx +74 -1
- package/src/shadcn/components/ui/avatar.tsx +22 -6
- package/src/shadcn/components/ui/badge.tsx +67 -18
- package/src/shadcn/components/ui/breadcrumb.stories.tsx +161 -41
- package/src/shadcn/components/ui/breadcrumb.tsx +172 -23
- package/src/shadcn/components/ui/button.stories.tsx +106 -18
- package/src/shadcn/components/ui/button.tsx +151 -55
- package/src/shadcn/components/ui/calendar.tsx +1 -0
- package/src/shadcn/components/ui/card.stories.tsx +17 -3
- package/src/shadcn/components/ui/card.tsx +89 -14
- package/src/shadcn/components/ui/carousel.tsx +1 -0
- package/src/shadcn/components/ui/chart.tsx +9 -5
- package/src/shadcn/components/ui/checkbox.stories.tsx +78 -30
- package/src/shadcn/components/ui/checkbox.tsx +91 -8
- package/src/shadcn/components/ui/combobox.stories.tsx +148 -0
- package/src/shadcn/components/ui/combobox.tsx +324 -0
- package/src/shadcn/components/ui/command.stories.tsx +184 -39
- package/src/shadcn/components/ui/command.tsx +218 -37
- package/src/shadcn/components/ui/context-menu.tsx +333 -40
- package/src/shadcn/components/ui/dialog.tsx +101 -13
- package/src/shadcn/components/ui/drawer.tsx +94 -18
- package/src/shadcn/components/ui/dropdown-menu.stories.tsx +18 -2
- package/src/shadcn/components/ui/dropdown-menu.tsx +334 -68
- package/src/shadcn/components/ui/form.tsx +22 -11
- package/src/shadcn/components/ui/hover-card.tsx +2 -1
- package/src/shadcn/components/ui/input-otp.tsx +1 -0
- package/src/shadcn/components/ui/input.stories.tsx +235 -27
- package/src/shadcn/components/ui/input.tsx +400 -29
- package/src/shadcn/components/ui/label.tsx +22 -4
- package/src/shadcn/components/ui/menubar.tsx +188 -43
- package/src/shadcn/components/ui/pagination.stories.tsx +8 -2
- package/src/shadcn/components/ui/pagination.tsx +65 -8
- package/src/shadcn/components/ui/popover.tsx +36 -4
- package/src/shadcn/components/ui/progress.tsx +21 -5
- package/src/shadcn/components/ui/radio-button-group.stories.tsx +247 -0
- package/src/shadcn/components/ui/radio-button-group.tsx +188 -0
- package/src/shadcn/components/ui/radio-group.stories.tsx +70 -14
- package/src/shadcn/components/ui/radio-group.tsx +85 -9
- package/src/shadcn/components/ui/resizable.stories.tsx +2 -2
- package/src/shadcn/components/ui/resizable.tsx +2 -1
- package/src/shadcn/components/ui/scroll-area.tsx +34 -5
- package/src/shadcn/components/ui/select.stories.tsx +108 -32
- package/src/shadcn/components/ui/select.tsx +182 -36
- package/src/shadcn/components/ui/separator.tsx +16 -5
- package/src/shadcn/components/ui/sheet.tsx +1 -1
- package/src/shadcn/components/ui/sidebar.tsx +69 -26
- package/src/shadcn/components/ui/skeleton.tsx +4 -1
- package/src/shadcn/components/ui/slider.tsx +83 -11
- package/src/shadcn/components/ui/sonner.stories.tsx +238 -17
- package/src/shadcn/components/ui/sonner.tsx +254 -11
- package/src/shadcn/components/ui/switch.stories.tsx +52 -5
- package/src/shadcn/components/ui/switch.tsx +92 -7
- package/src/shadcn/components/ui/table.stories.tsx +252 -72
- package/src/shadcn/components/ui/table.tsx +204 -26
- package/src/shadcn/components/ui/tabs.stories.tsx +235 -123
- package/src/shadcn/components/ui/tabs.tsx +694 -36
- package/src/shadcn/components/ui/textarea.stories.tsx +94 -2
- package/src/shadcn/components/ui/textarea.tsx +70 -5
- package/src/shadcn/components/ui/toggle-group.tsx +35 -13
- package/src/shadcn/components/ui/toggle.stories.tsx +92 -5
- package/src/shadcn/components/ui/toggle.tsx +96 -23
- package/src/shadcn/components/ui/tooltip.tsx +34 -8
- package/src/shadcn/components/ui/tree.tsx +257 -0
- package/src/shadcn/shadcn.css +4 -4
- package/src/tokens.css +50 -20
- package/src/typography.css +78 -15
- package/dist/src/components/code-editor.stories.d.ts +0 -7
- package/dist/src/components/code-editor.stories.d.ts.map +0 -1
- package/dist/src/components/request-line-editor.stories.d.ts +0 -11
- package/dist/src/components/request-line-editor.stories.d.ts.map +0 -1
- package/dist/src/index.stories.d.ts +0 -14
- package/dist/src/index.stories.d.ts.map +0 -1
- package/dist/src/index.stories.js +0 -19
- package/dist/src/index.stories.js.map +0 -1
- package/dist/src/shadcn/components/ui/accordion.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/accordion.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/alert-dialog.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/alert-dialog.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/alert.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/alert.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/aspect-ratio.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/aspect-ratio.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/avatar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/avatar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/badge.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/badge.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/breadcrumb.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/breadcrumb.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/button.stories.d.ts +0 -23
- package/dist/src/shadcn/components/ui/button.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/calendar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/calendar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/card.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/card.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/carousel.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/carousel.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/chart.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/chart.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/collapsible.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/collapsible.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/command.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/command.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/context-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/context-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/dialog.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/dialog.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/drawer.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/drawer.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/dropdown-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/form.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/form.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/hover-card.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/hover-card.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/input-otp.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/input-otp.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/input.stories.d.ts +0 -18
- package/dist/src/shadcn/components/ui/input.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/label.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/label.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/menubar.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/menubar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/navigation-menu.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/navigation-menu.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/pagination.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/pagination.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/popover.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/popover.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/progress.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/progress.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/resizable.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/resizable.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/scroll-area.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/scroll-area.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/select.stories.d.ts +0 -11
- package/dist/src/shadcn/components/ui/select.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/separator.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/separator.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sheet.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/sheet.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sidebar.stories.d.ts +0 -11
- package/dist/src/shadcn/components/ui/sidebar.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/skeleton.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/skeleton.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/slider.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/slider.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/switch.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/switch.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/table.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/table.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts +0 -32
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/textarea.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/textarea.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/toggle-group.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/toggle-group.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/toggle.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/toggle.stories.d.ts.map +0 -1
- package/dist/src/shadcn/components/ui/tooltip.stories.d.ts +0 -8
- package/dist/src/shadcn/components/ui/tooltip.stories.d.ts.map +0 -1
- package/src/index.stories.tsx +0 -21
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
@top Http {
|
|
2
|
+
httpRequest
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
@tokens {
|
|
6
|
+
eof { @eof }
|
|
7
|
+
|
|
8
|
+
lf { $[\n] }
|
|
9
|
+
notLf { ![\n] }
|
|
10
|
+
|
|
11
|
+
cr { $[\r] }
|
|
12
|
+
notCr { ![\r] }
|
|
13
|
+
|
|
14
|
+
colon { $[:] }
|
|
15
|
+
notColon { ![:] }
|
|
16
|
+
|
|
17
|
+
space { $[ \t] }
|
|
18
|
+
notSpace { ![ \t] }
|
|
19
|
+
|
|
20
|
+
headerNameChar { ![\n\r \t:] }
|
|
21
|
+
headerNameText { headerNameChar+ }
|
|
22
|
+
|
|
23
|
+
headerValueFirstChar { ![\n\r \t] }
|
|
24
|
+
headerValueChar { ![\n\r] }
|
|
25
|
+
headerValueLastChar { headerValueFirstChar }
|
|
26
|
+
headerValueText { headerValueFirstChar headerValueChar* headerValueLastChar | headerValueFirstChar }
|
|
27
|
+
|
|
28
|
+
methodChar { ![\n\r \t] }
|
|
29
|
+
methodText { methodChar+ }
|
|
30
|
+
|
|
31
|
+
pathChar { ![\n\r] }
|
|
32
|
+
firstPathChar { ![\n\r \t] }
|
|
33
|
+
pathText { firstPathChar pathChar* }
|
|
34
|
+
|
|
35
|
+
crlf { (cr lf) | cr | lf }
|
|
36
|
+
|
|
37
|
+
bodyChar { _ }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
HttpRequestMethod[group="Method"] {
|
|
41
|
+
methodText
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
HttpRequestPath {
|
|
45
|
+
pathText
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
httpRequestLine {
|
|
49
|
+
space* HttpRequestMethod space+ HttpRequestPath crlf
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
HttpHeaderName {
|
|
53
|
+
headerNameText
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
HttpHeaderValue {
|
|
57
|
+
headerValueText
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
HttpHeader {
|
|
61
|
+
space* HttpHeaderName space* colon space* HttpHeaderValue space* crlf
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
HttpHeaders {
|
|
65
|
+
HttpHeader+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
HttpBody {
|
|
69
|
+
bodyChar*
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
httpRequest {
|
|
73
|
+
httpRequestLine HttpHeaders? crlf HttpBody
|
|
74
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Tests for lezer Http grammar
|
|
2
|
+
|
|
3
|
+
import { testTree } from "@lezer/generator/test";
|
|
4
|
+
import { parser } from "./http";
|
|
5
|
+
|
|
6
|
+
type StackEntry = {
|
|
7
|
+
name: string;
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
value: string;
|
|
11
|
+
children: StackEntry[];
|
|
12
|
+
textNode?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function parseHttp(input: string): StackEntry {
|
|
16
|
+
const stack: StackEntry[] = [];
|
|
17
|
+
parser.parse(input).iterate({
|
|
18
|
+
enter: (node) => {
|
|
19
|
+
const nodeName = node.type.name;
|
|
20
|
+
const nodeFrom = node.from;
|
|
21
|
+
const nodeTo = node.to;
|
|
22
|
+
const value = input.slice(nodeFrom, nodeTo);
|
|
23
|
+
|
|
24
|
+
stack.push({
|
|
25
|
+
name: nodeName,
|
|
26
|
+
from: nodeFrom,
|
|
27
|
+
to: nodeTo,
|
|
28
|
+
value: value,
|
|
29
|
+
children: [],
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
leave: () => {
|
|
34
|
+
const current = stack.pop();
|
|
35
|
+
if (current === undefined) {
|
|
36
|
+
throw "Stack underflow";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (stack.length === 0) {
|
|
40
|
+
// Re-push root
|
|
41
|
+
stack.push(current);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const parent = stack[stack.length - 1];
|
|
46
|
+
if (parent === undefined) {
|
|
47
|
+
throw "Impossible";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
parent.children.push(current);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const res = stack.pop();
|
|
55
|
+
if (res === undefined) {
|
|
56
|
+
throw "Stack underflow";
|
|
57
|
+
}
|
|
58
|
+
return res;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type Tree = TreeNode | string;
|
|
62
|
+
type TreeNode = {
|
|
63
|
+
name: string;
|
|
64
|
+
children: Tree[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
function transform(root: StackEntry): Tree {
|
|
68
|
+
const tree: Tree = {
|
|
69
|
+
name: root.name,
|
|
70
|
+
children: [],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
let pos = root.from;
|
|
74
|
+
for (const child of root.children) {
|
|
75
|
+
if (pos < child.from) {
|
|
76
|
+
const prefix = root.value.slice(pos - root.from, child.from - root.from);
|
|
77
|
+
tree.children.push(prefix);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
tree.children.push(transform(child));
|
|
81
|
+
pos = child.to;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (pos < root.to) {
|
|
85
|
+
tree.children.push(root.value.slice(pos - root.from));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return tree;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const tree = parser.parse("GET /\nAccept: text/yaml\n\nhello: world");
|
|
92
|
+
console.dir(parseHttp("GET /\nAccept: text/yaml\n\nhello: world\n\nagain"), {
|
|
93
|
+
depth: null,
|
|
94
|
+
});
|
|
95
|
+
console.dir(
|
|
96
|
+
transform(parseHttp("GET /\nAccept: text/yaml\n\nhello: world\n\nagain")),
|
|
97
|
+
{
|
|
98
|
+
depth: null,
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
console.log(tree);
|
|
102
|
+
tree.iterate({
|
|
103
|
+
enter: (node) => {
|
|
104
|
+
console.log(`ENTER ${node.type.name}[${node.from}:${node.to}]`);
|
|
105
|
+
},
|
|
106
|
+
leave: (node) => {
|
|
107
|
+
console.log(`LEAVE ${node.type.name}[${node.from}:${node.to}]`);
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
testTree(tree, `Http`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import { LRParser } from "@lezer/lr";
|
|
3
|
+
export const parser = LRParser.deserialize({
|
|
4
|
+
version: 14,
|
|
5
|
+
states:
|
|
6
|
+
"'zOQOPOOOOOO'#Ce'#CeOQOPO'#CjOOOO'#C^'#C^OYOPO'#CjO_OQO'#CiQOOOOOOOOO-E6c-E6cOYOPO,59UOjOSO,59UOrOQO'#CaOOOO'#Cb'#CbOzOQO'#CaOOOO'#Cf'#CfO!SOQO'#C`O!_OWO,59TO!gOPO,59TOjOSO1G.pOOOO'#C_'#C_O!lOPO1G.pO!qOQO,58{O!qOQO,58{O!yO`O,58{OOOO-E6d-E6dOOOO'#Cg'#CgO#ROWO'#CdOOOO1G.o1G.oO!_OWO1G.oO#ZOPO7+$[OOOO7+$[7+$[O#`OQO1G.gO!yO`O1G.gO!yO`O1G.gOOOO'#Cc'#CcO#hOPO1G.gOOOO-E6e-E6eOOOO7+$Z7+$ZOOOO<<Gv<<GvO!yO`O7+$RO!yO`O7+$RO#pOPO7+$RO#pOPO7+$ROOOO7+$R7+$RO!yO`O<<GmO#xOPO<<GmO#xOPO<<GmOOOO<<Gm<<GmO$QOPOAN=XO$QOPOAN=XOOOOAN=XAN=XO$YOPOG22sOOOOG22sG22sOOOOLD(_LD(_",
|
|
7
|
+
stateData:
|
|
8
|
+
"$b~O_PO`RO~O_PO~O_POb_OcZO~O_POabO~O_POcZO~O_POdfO~O_POcZObSX~OfhO[WP~ObkO~ObmO~O_POdoO~O_POeqO~OfhO[WX~ObuO~O_POdvO~O_PObzO~O_POb!OO~O_POb!RO~O_POb!TO~O_POb!UO~O",
|
|
9
|
+
goto: "#|_PP`flosz!Y!`#i#oP#v#yQSORWQQcXRlaR`TT]T^S[T^RdYQrfSxopS|vwR!P{Qj_RtkQQOjVQXYaenpwy{}!Q!SQXSSYT^QaWQe[QndQpfQwoQyrQ{vQ}xQ!Q|R!S!PQ^TRg^Si_kRsiRUORTO",
|
|
10
|
+
nodeNames:
|
|
11
|
+
"⚠ Http HttpRequestMethod HttpRequestPath HttpHeaders HttpHeader HttpHeaderName HttpHeaderValue HttpBody",
|
|
12
|
+
maxTerm: 22,
|
|
13
|
+
nodeProps: [["group", 2, "Method"]],
|
|
14
|
+
skippedNodes: [0],
|
|
15
|
+
repeatNodeCount: 3,
|
|
16
|
+
tokenData:
|
|
17
|
+
"'xoR]OXzXY&VYZ&^Z]z]^&e^pzpq&Vq![z![!]&t!];'Sz;'S;=`'k;=`<%l's<%lOzo!XYfWcQe``PaSOX!wXY#rZ]!w^p!wpq#rq![!w![!]%W!];'S!w;'S;=`&P<%lO!wg#SYcQe``PaSOX!wXY#rZ]!w^p!wpq#rq![!w![!]%W!];'S!w;'S;=`&P<%lO!wd#wWaSOX$aXY#rZ]$a^p$apq#rq;'S$a;'S;=`%Q<%lO$ad$hWe`aSOX$aXY#rZ]$a^p$apq#rq;'S$a;'S;=`%Q<%lO$ad%TP;=`<%l$ae%aWe``PaSOX%WXY#rZ]%W^p%Wpq#rq;'S%W;'S;=`%y<%lO%We%|P;=`<%l%Wg&SP;=`<%l!wo&^OfW_gZ&eOfWbRZ&lPfWbRYZ&oR&tObRo'RWfWdQe``PaSOX%WXY#rZ]%W^p%Wpq#rq;'S%W;'S;=`%y<%lO%Wo'pPfW;=`<%lzW'xOfW",
|
|
18
|
+
tokenizers: [0, 1, 2, 3, 4],
|
|
19
|
+
topRules: { Http: [0, 1] },
|
|
20
|
+
tokenPrec: 0,
|
|
21
|
+
});
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import {
|
|
2
|
+
foldInside,
|
|
3
|
+
foldNodeProp,
|
|
4
|
+
type Language,
|
|
5
|
+
LanguageSupport,
|
|
6
|
+
LRLanguage,
|
|
7
|
+
syntaxTree,
|
|
8
|
+
} from "@codemirror/language";
|
|
9
|
+
import { RangeSetBuilder } from "@codemirror/state";
|
|
10
|
+
import {
|
|
11
|
+
Decoration,
|
|
12
|
+
type DecorationSet,
|
|
13
|
+
EditorView,
|
|
14
|
+
ViewPlugin,
|
|
15
|
+
type ViewUpdate,
|
|
16
|
+
} from "@codemirror/view";
|
|
17
|
+
import { parseMixed } from "@lezer/common";
|
|
18
|
+
import { styleTags, tags } from "@lezer/highlight";
|
|
19
|
+
import type { LRParser } from "@lezer/lr";
|
|
20
|
+
import { parser } from "./grammar/http";
|
|
21
|
+
import { HttpRequestMethod } from "./grammar/http.terms";
|
|
22
|
+
|
|
23
|
+
function makeParser(
|
|
24
|
+
bodyLanguages: (contentType: string) => Language | null,
|
|
25
|
+
): LRParser {
|
|
26
|
+
return parser.configure({
|
|
27
|
+
props: [
|
|
28
|
+
styleTags({
|
|
29
|
+
HttpHeaderName: tags.variableName,
|
|
30
|
+
HttpHeaderValue: tags.attributeValue,
|
|
31
|
+
}),
|
|
32
|
+
|
|
33
|
+
foldNodeProp.add({
|
|
34
|
+
HttpHeaders: foldInside,
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
wrap: parseMixed((node, input) => {
|
|
38
|
+
if (node.name !== "HttpBody") {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const headers = node.node.prevSibling;
|
|
43
|
+
if (headers?.name !== "HttpHeaders") {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let contentType: string | null = null;
|
|
48
|
+
|
|
49
|
+
for (
|
|
50
|
+
let child = headers.firstChild;
|
|
51
|
+
child !== null;
|
|
52
|
+
child = child.nextSibling
|
|
53
|
+
) {
|
|
54
|
+
const headerNameNode = child.getChild("HttpHeaderName");
|
|
55
|
+
if (headerNameNode === null) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const headerName = input.read(headerNameNode.from, headerNameNode.to);
|
|
60
|
+
if (headerName.toLowerCase() !== "content-type") {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (contentType !== null) {
|
|
65
|
+
// Disallow multiple content types
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const headerValueNode = child.getChild("HttpHeaderValue");
|
|
70
|
+
if (headerValueNode === null) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
contentType = input.read(headerValueNode.from, headerValueNode.to);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (contentType === null) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const language = bodyLanguages(contentType);
|
|
82
|
+
if (language === null) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return { parser: language.parser };
|
|
87
|
+
}),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const methodDecorations: Record<string, Decoration> = {
|
|
92
|
+
GET: Decoration.mark({ class: "cm-http-method-get" }),
|
|
93
|
+
POST: Decoration.mark({ class: "cm-http-method-post" }),
|
|
94
|
+
PUT: Decoration.mark({ class: "cm-http-method-put" }),
|
|
95
|
+
PATCH: Decoration.mark({ class: "cm-http-method-patch" }),
|
|
96
|
+
DELETE: Decoration.mark({ class: "cm-http-method-delete" }),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
function buildMethodDecorations(view: EditorView): DecorationSet {
|
|
100
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
101
|
+
const tree = syntaxTree(view.state);
|
|
102
|
+
tree.iterate({
|
|
103
|
+
enter(node) {
|
|
104
|
+
if (node.type.id === HttpRequestMethod) {
|
|
105
|
+
const text = view.state.sliceDoc(node.from, node.to).toUpperCase();
|
|
106
|
+
const deco = methodDecorations[text];
|
|
107
|
+
if (deco) {
|
|
108
|
+
builder.add(node.from, node.to, deco);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
return builder.finish();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const httpMethodHighlighter = ViewPlugin.fromClass(
|
|
117
|
+
class {
|
|
118
|
+
decorations: DecorationSet;
|
|
119
|
+
constructor(view: EditorView) {
|
|
120
|
+
this.decorations = buildMethodDecorations(view);
|
|
121
|
+
}
|
|
122
|
+
update(update: ViewUpdate) {
|
|
123
|
+
if (update.docChanged || update.viewportChanged) {
|
|
124
|
+
this.decorations = buildMethodDecorations(update.view);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{ decorations: (v) => v.decorations },
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const httpMethodTheme = EditorView.baseTheme({
|
|
132
|
+
".cm-http-method-get": {
|
|
133
|
+
color: "var(--color-utility-green)",
|
|
134
|
+
},
|
|
135
|
+
".cm-http-method-post": {
|
|
136
|
+
color: "var(--color-utility-yellow)",
|
|
137
|
+
},
|
|
138
|
+
".cm-http-method-put": {
|
|
139
|
+
color: "var(--color-utility-blue)",
|
|
140
|
+
},
|
|
141
|
+
".cm-http-method-patch": {
|
|
142
|
+
color: "var(--color-utility-violet)",
|
|
143
|
+
},
|
|
144
|
+
".cm-http-method-delete": {
|
|
145
|
+
color: "var(--color-utility-red)",
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// ── HTTP header autocomplete ────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
import type {
|
|
152
|
+
Completion,
|
|
153
|
+
CompletionContext,
|
|
154
|
+
CompletionResult,
|
|
155
|
+
} from "@codemirror/autocomplete";
|
|
156
|
+
import {
|
|
157
|
+
HttpHeaderName,
|
|
158
|
+
HttpHeaders,
|
|
159
|
+
HttpHeaderValue,
|
|
160
|
+
HttpRequestPath,
|
|
161
|
+
} from "./grammar/http.terms";
|
|
162
|
+
|
|
163
|
+
const COMMON_HEADERS: Completion[] = [
|
|
164
|
+
// Standard HTTP
|
|
165
|
+
{ label: "Accept", type: "header", apply: "Accept: " },
|
|
166
|
+
{ label: "Accept-Encoding", type: "header", apply: "Accept-Encoding: " },
|
|
167
|
+
{ label: "Accept-Language", type: "header", apply: "Accept-Language: " },
|
|
168
|
+
{ label: "Authorization", type: "header", apply: "Authorization: " },
|
|
169
|
+
{ label: "Cache-Control", type: "header", apply: "Cache-Control: " },
|
|
170
|
+
{ label: "Content-Type", type: "header", apply: "Content-Type: " },
|
|
171
|
+
{ label: "Cookie", type: "header", apply: "Cookie: " },
|
|
172
|
+
{ label: "Host", type: "header", apply: "Host: " },
|
|
173
|
+
{ label: "If-Match", type: "header", apply: "If-Match: " },
|
|
174
|
+
{ label: "If-Modified-Since", type: "header", apply: "If-Modified-Since: " },
|
|
175
|
+
{ label: "If-None-Match", type: "header", apply: "If-None-Match: " },
|
|
176
|
+
{ label: "Origin", type: "header", apply: "Origin: " },
|
|
177
|
+
{ label: "Prefer", type: "header", apply: "Prefer: " },
|
|
178
|
+
// Aidbox-specific
|
|
179
|
+
{ label: "x-audit", type: "header", apply: "x-audit: " },
|
|
180
|
+
{ label: "x-correlation-id", type: "header", apply: "x-correlation-id: " },
|
|
181
|
+
{ label: "x-debug", type: "header", apply: "x-debug: " },
|
|
182
|
+
{
|
|
183
|
+
label: "x-external-user-id",
|
|
184
|
+
type: "header",
|
|
185
|
+
apply: "x-external-user-id: ",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
label: "x-max-isolation-level",
|
|
189
|
+
type: "header",
|
|
190
|
+
apply: "x-max-isolation-level: ",
|
|
191
|
+
},
|
|
192
|
+
{ label: "x-original-uri", type: "header", apply: "x-original-uri: " },
|
|
193
|
+
{ label: "x-request-id", type: "header", apply: "x-request-id: " },
|
|
194
|
+
{ label: "x-use-ro-replica", type: "header", apply: "x-use-ro-replica: " },
|
|
195
|
+
{ label: "su", type: "header", apply: "su: " },
|
|
196
|
+
{ label: "traceparent", type: "header", apply: "traceparent: " },
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
// Header value completions by header name
|
|
200
|
+
const HEADER_VALUES: Record<string, Completion[]> = {
|
|
201
|
+
"content-type": [
|
|
202
|
+
{ label: "application/json", type: "text" },
|
|
203
|
+
{ label: "application/fhir+json", type: "text" },
|
|
204
|
+
{ label: "text/yaml", type: "text" },
|
|
205
|
+
{ label: "application/ndjson", type: "text" },
|
|
206
|
+
{ label: "application/gzip", type: "text" },
|
|
207
|
+
{ label: "text/csv", type: "text" },
|
|
208
|
+
],
|
|
209
|
+
accept: [
|
|
210
|
+
{ label: "application/json", type: "text" },
|
|
211
|
+
{ label: "application/yaml", type: "text" },
|
|
212
|
+
{ label: "text/yaml", type: "text" },
|
|
213
|
+
],
|
|
214
|
+
prefer: [
|
|
215
|
+
{ label: "respond-async", type: "text" },
|
|
216
|
+
{ label: "return=minimal", type: "text" },
|
|
217
|
+
{ label: "return=representation", type: "text" },
|
|
218
|
+
{ label: "return=OperationOutcome", type: "text" },
|
|
219
|
+
],
|
|
220
|
+
"x-debug": [{ label: "policy", type: "text" }],
|
|
221
|
+
"x-max-isolation-level": [
|
|
222
|
+
{ label: "read-committed", type: "text" },
|
|
223
|
+
{ label: "repeatable-read", type: "text" },
|
|
224
|
+
{ label: "serializable", type: "text" },
|
|
225
|
+
],
|
|
226
|
+
"cache-control": [
|
|
227
|
+
{ label: "no-cache", type: "text" },
|
|
228
|
+
{ label: "no-store", type: "text" },
|
|
229
|
+
{ label: "max-age=0", type: "text" },
|
|
230
|
+
],
|
|
231
|
+
authorization: [
|
|
232
|
+
{ label: "Bearer ", type: "text" },
|
|
233
|
+
{ label: "Basic ", type: "text" },
|
|
234
|
+
],
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const HTTP_METHODS: Completion[] = [
|
|
238
|
+
"GET",
|
|
239
|
+
"POST",
|
|
240
|
+
"PUT",
|
|
241
|
+
"PATCH",
|
|
242
|
+
"DELETE",
|
|
243
|
+
].map((method) => ({
|
|
244
|
+
label: method,
|
|
245
|
+
type: "keyword" as const,
|
|
246
|
+
apply: (view: EditorView, _c: Completion, from: number, to: number) => {
|
|
247
|
+
const line = view.state.doc.lineAt(from);
|
|
248
|
+
const afterTo = line.text.slice(to - line.from);
|
|
249
|
+
// Skip whitespace after the method word to avoid double spaces
|
|
250
|
+
const wsMatch = afterTo.match(/^(\s*)/);
|
|
251
|
+
const actualTo = to + (wsMatch?.[1]?.length ?? 0);
|
|
252
|
+
const rest = line.text.slice(actualTo - line.from);
|
|
253
|
+
const insert = rest.startsWith("/") ? `${method} ` : `${method} /`;
|
|
254
|
+
view.dispatch({
|
|
255
|
+
changes: { from, to: actualTo, insert },
|
|
256
|
+
selection: { anchor: from + insert.length },
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
}));
|
|
260
|
+
|
|
261
|
+
function httpCompletionSource(
|
|
262
|
+
context: CompletionContext,
|
|
263
|
+
): CompletionResult | null {
|
|
264
|
+
const { state, pos } = context;
|
|
265
|
+
const tree = syntaxTree(state);
|
|
266
|
+
const node = tree.resolveInner(pos, -1);
|
|
267
|
+
|
|
268
|
+
const line = state.doc.lineAt(pos);
|
|
269
|
+
const beforeCursor = line.text.slice(0, pos - line.from);
|
|
270
|
+
|
|
271
|
+
// Request method completion — first line, typing method
|
|
272
|
+
if (
|
|
273
|
+
node.type.id === HttpRequestMethod ||
|
|
274
|
+
(line.number === 1 && /^\s*[a-zA-Z]*$/.test(beforeCursor))
|
|
275
|
+
) {
|
|
276
|
+
const word = context.matchBefore(/[a-zA-Z]*/);
|
|
277
|
+
return {
|
|
278
|
+
from: word?.from ?? pos,
|
|
279
|
+
options: HTTP_METHODS,
|
|
280
|
+
validFor: /^[a-zA-Z]*$/i,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Header value completion — after colon
|
|
285
|
+
const colonIdx = beforeCursor.indexOf(":");
|
|
286
|
+
if (colonIdx >= 0) {
|
|
287
|
+
const inHeaderValue = node.type.id === HttpHeaderValue;
|
|
288
|
+
const parentIsHeaders = node.parent?.type.id === HttpHeaders;
|
|
289
|
+
if (
|
|
290
|
+
!inHeaderValue &&
|
|
291
|
+
!parentIsHeaders &&
|
|
292
|
+
node.parent?.parent?.type.id !== HttpHeaders
|
|
293
|
+
)
|
|
294
|
+
return null;
|
|
295
|
+
|
|
296
|
+
const headerName = beforeCursor.slice(0, colonIdx).trim().toLowerCase();
|
|
297
|
+
const values = HEADER_VALUES[headerName];
|
|
298
|
+
if (!values) return null;
|
|
299
|
+
|
|
300
|
+
const word = context.matchBefore(/\S*/);
|
|
301
|
+
return {
|
|
302
|
+
from: word?.from ?? pos,
|
|
303
|
+
options: values,
|
|
304
|
+
validFor: /^\S*$/,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Header name completion — before colon
|
|
309
|
+
const inHeaderName = node.type.id === HttpHeaderName;
|
|
310
|
+
const inHeaders = node.type.id === HttpHeaders;
|
|
311
|
+
const parentIsHeaders = node.parent?.type.id === HttpHeaders;
|
|
312
|
+
|
|
313
|
+
if (!inHeaderName && !inHeaders && !parentIsHeaders) return null;
|
|
314
|
+
|
|
315
|
+
const word = context.matchBefore(/[\w-]+/);
|
|
316
|
+
if (!word) return null;
|
|
317
|
+
return {
|
|
318
|
+
from: word.from,
|
|
319
|
+
options: COMMON_HEADERS,
|
|
320
|
+
validFor: /^[\w-]+$/,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export interface UrlSuggestion {
|
|
325
|
+
label: string;
|
|
326
|
+
value: string;
|
|
327
|
+
type?: string;
|
|
328
|
+
description?: string;
|
|
329
|
+
expression?: string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export type GetUrlSuggestions = (
|
|
333
|
+
path: string,
|
|
334
|
+
method: string,
|
|
335
|
+
) => UrlSuggestion[] | Promise<UrlSuggestion[]>;
|
|
336
|
+
|
|
337
|
+
function httpUrlCompletionSource(
|
|
338
|
+
getUrlSuggestions: GetUrlSuggestions,
|
|
339
|
+
): (context: CompletionContext) => Promise<CompletionResult | null> {
|
|
340
|
+
return async (
|
|
341
|
+
context: CompletionContext,
|
|
342
|
+
): Promise<CompletionResult | null> => {
|
|
343
|
+
const { state, pos } = context;
|
|
344
|
+
const tree = syntaxTree(state);
|
|
345
|
+
const node = tree.resolveInner(pos, -1);
|
|
346
|
+
|
|
347
|
+
if (node.type.id !== HttpRequestPath) return null;
|
|
348
|
+
|
|
349
|
+
const line = state.doc.lineAt(pos);
|
|
350
|
+
const lineText = line.text;
|
|
351
|
+
// Extract method from the beginning of the line
|
|
352
|
+
const methodMatch = lineText.match(/^\s*(\w+)\s+/);
|
|
353
|
+
if (!methodMatch?.[1]) return null;
|
|
354
|
+
const method = methodMatch[1].toUpperCase();
|
|
355
|
+
|
|
356
|
+
const pathStart = line.from + methodMatch[0].length;
|
|
357
|
+
const currentPath = state.sliceDoc(pathStart, pos);
|
|
358
|
+
|
|
359
|
+
const suggestions = await getUrlSuggestions(currentPath, method);
|
|
360
|
+
if (suggestions.length === 0) return null;
|
|
361
|
+
|
|
362
|
+
const options: Completion[] = suggestions.map((s) => {
|
|
363
|
+
const c: Completion = {
|
|
364
|
+
label: s.label,
|
|
365
|
+
type:
|
|
366
|
+
s.type === "resource-type"
|
|
367
|
+
? "type"
|
|
368
|
+
: s.type === "operation"
|
|
369
|
+
? "function"
|
|
370
|
+
: s.type === "search-param"
|
|
371
|
+
? "search-param"
|
|
372
|
+
: "text",
|
|
373
|
+
};
|
|
374
|
+
if (s.type === "search-param") c.apply = `${s.label}=`;
|
|
375
|
+
else if (s.type === "path" && s.label === "fhir") c.apply = `${s.label}/`;
|
|
376
|
+
if (s.description) c.detail = s.description.toUpperCase();
|
|
377
|
+
if (s.expression) c.info = s.expression;
|
|
378
|
+
return c;
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
// Match from the last segment separator (/ or ? or &)
|
|
382
|
+
const hasQuery = currentPath.includes("?");
|
|
383
|
+
let from: number;
|
|
384
|
+
if (hasQuery) {
|
|
385
|
+
const lastSep = Math.max(
|
|
386
|
+
currentPath.lastIndexOf("?"),
|
|
387
|
+
currentPath.lastIndexOf("&"),
|
|
388
|
+
);
|
|
389
|
+
from = pathStart + lastSep + 1;
|
|
390
|
+
} else {
|
|
391
|
+
const lastSlash = currentPath.lastIndexOf("/");
|
|
392
|
+
from = pathStart + lastSlash + 1;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return {
|
|
396
|
+
from,
|
|
397
|
+
options,
|
|
398
|
+
validFor: /^[^\s&=]*/,
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function http(
|
|
404
|
+
bodyLanguages: (contentType: string) => Language | null,
|
|
405
|
+
getUrlSuggestions?: GetUrlSuggestions,
|
|
406
|
+
) {
|
|
407
|
+
const parser = makeParser(bodyLanguages);
|
|
408
|
+
const language = LRLanguage.define({ parser: parser });
|
|
409
|
+
const extensions = [
|
|
410
|
+
httpMethodHighlighter,
|
|
411
|
+
httpMethodTheme,
|
|
412
|
+
language.data.of({ autocomplete: httpCompletionSource }),
|
|
413
|
+
];
|
|
414
|
+
if (getUrlSuggestions) {
|
|
415
|
+
extensions.push(
|
|
416
|
+
language.data.of({
|
|
417
|
+
autocomplete: httpUrlCompletionSource(getUrlSuggestions),
|
|
418
|
+
}),
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
return new LanguageSupport(language, extensions);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export { http };
|