@health-samurai/react-components 0.0.0-alpha.4 → 0.0.0-alpha.6
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/bundle.css +1375 -484
- 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.d.ts +2 -0
- package/dist/src/components/code-editor/http/grammar/http.test.d.ts.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 +4 -0
- package/dist/src/components/code-editor/http/index.d.ts.map +1 -0
- package/dist/src/components/code-editor/http/index.js +66 -0
- package/dist/src/components/code-editor/http/index.js.map +1 -0
- package/dist/src/components/code-editor/index.d.ts +14 -2
- package/dist/src/components/code-editor/index.d.ts.map +1 -1
- package/dist/src/components/code-editor/index.js +309 -20
- package/dist/src/components/code-editor/index.js.map +1 -1
- package/dist/src/components/code-editor.stories.d.ts +1 -0
- package/dist/src/components/code-editor.stories.d.ts.map +1 -1
- package/dist/src/components/code-editor.stories.js +255 -2
- 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 +8 -0
- package/dist/src/components/data-table.d.ts.map +1 -0
- package/dist/src/components/data-table.js +65 -0
- package/dist/src/components/data-table.js.map +1 -0
- package/dist/src/components/data-table.stories.d.ts +7 -0
- package/dist/src/components/data-table.stories.d.ts.map +1 -0
- package/dist/src/components/data-table.stories.js +44 -0
- package/dist/src/components/data-table.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 +229 -0
- package/dist/src/components/fhir-structure-view.js.map +1 -0
- package/dist/src/components/fhir-structure-view.stories.d.ts +7 -0
- package/dist/src/components/fhir-structure-view.stories.d.ts.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/patient-table.d.ts +73 -0
- package/dist/src/components/patient-table.d.ts.map +1 -0
- package/dist/src/components/patient-table.js +921 -0
- package/dist/src/components/patient-table.js.map +1 -0
- package/dist/src/components/patient-table.stories.d.ts +111 -0
- package/dist/src/components/patient-table.stories.d.ts.map +1 -0
- package/dist/src/components/patient-table.stories.js +172 -0
- package/dist/src/components/patient-table.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 +72 -49
- package/dist/src/components/request-line-editor.js.map +1 -1
- package/dist/src/components/request-line-editor.stories.d.ts.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/segment-control.d.ts +16 -0
- package/dist/src/components/segment-control.d.ts.map +1 -0
- package/dist/src/components/segment-control.js +48 -0
- package/dist/src/components/segment-control.js.map +1 -0
- package/dist/src/components/segment-control.stories.d.ts +15 -0
- package/dist/src/components/segment-control.stories.d.ts.map +1 -0
- package/dist/src/components/segment-control.stories.js +33 -0
- package/dist/src/components/segment-control.stories.js.map +1 -0
- package/dist/src/components/split-button.d.ts +5 -0
- package/dist/src/components/split-button.d.ts.map +1 -0
- package/dist/src/components/split-button.js +12 -0
- package/dist/src/components/split-button.js.map +1 -0
- package/dist/src/components/split-button.stories.d.ts +7 -0
- package/dist/src/components/split-button.stories.d.ts.map +1 -0
- package/dist/src/components/split-button.stories.js +57 -0
- package/dist/src/components/split-button.stories.js.map +1 -0
- package/dist/src/components/tree-view.d.ts +22 -0
- package/dist/src/components/tree-view.d.ts.map +1 -0
- package/dist/src/components/tree-view.js +101 -0
- package/dist/src/components/tree-view.js.map +1 -0
- package/dist/src/components/tree-view.stories.d.ts +13 -0
- package/dist/src/components/tree-view.stories.d.ts.map +1 -0
- package/dist/src/components/tree-view.stories.js +274 -0
- package/dist/src/components/tree-view.stories.js.map +1 -0
- package/dist/src/icons.d.ts +9 -0
- package/dist/src/icons.d.ts.map +1 -0
- package/dist/src/icons.js +279 -0
- package/dist/src/icons.js.map +1 -0
- package/dist/src/index.css +42 -3
- package/dist/src/index.d.ts +9 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/accordion.js +23 -5
- package/dist/src/shadcn/components/ui/accordion.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts +3 -1
- package/dist/src/shadcn/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert-dialog.js +5 -2
- package/dist/src/shadcn/components/ui/alert-dialog.js.map +1 -1
- package/dist/src/shadcn/components/ui/alert.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/alert.js +12 -5
- package/dist/src/shadcn/components/ui/alert.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/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.map +1 -1
- package/dist/src/shadcn/components/ui/breadcrumb.js +6 -6
- package/dist/src/shadcn/components/ui/breadcrumb.js.map +1 -1
- package/dist/src/shadcn/components/ui/button.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/button.js +19 -11
- package/dist/src/shadcn/components/ui/button.js.map +1 -1
- package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/card.js +14 -6
- package/dist/src/shadcn/components/ui/card.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.js +20 -5
- package/dist/src/shadcn/components/ui/checkbox.js.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/checkbox.stories.js +44 -35
- package/dist/src/shadcn/components/ui/checkbox.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/combobox.d.ts +18 -0
- package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.js +121 -0
- package/dist/src/shadcn/components/ui/combobox.js.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.d.ts +11 -0
- package/dist/src/shadcn/components/ui/combobox.stories.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js +16 -0
- package/dist/src/shadcn/components/ui/combobox.stories.js.map +1 -0
- package/dist/src/shadcn/components/ui/command.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/command.js +73 -12
- package/dist/src/shadcn/components/ui/command.js.map +1 -1
- package/dist/src/shadcn/components/ui/command.stories.js +0 -1
- package/dist/src/shadcn/components/ui/command.stories.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 +26 -5
- package/dist/src/shadcn/components/ui/drawer.js.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js +12 -1
- package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
- package/dist/src/shadcn/components/ui/form.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/form.js +12 -4
- package/dist/src/shadcn/components/ui/form.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/label.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/label.js +8 -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.map +1 -1
- package/dist/src/shadcn/components/ui/pagination.js +6 -6
- package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
- package/dist/src/shadcn/components/ui/popover.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/popover.js +12 -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-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.js +11 -6
- package/dist/src/shadcn/components/ui/radio-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/radio-group.stories.js +57 -34
- package/dist/src/shadcn/components/ui/radio-group.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 +9 -3
- package/dist/src/shadcn/components/ui/scroll-area.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.js +49 -14
- package/dist/src/shadcn/components/ui/select.js.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/select.stories.js +1 -4
- 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 +7 -1
- package/dist/src/shadcn/components/ui/separator.js.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sidebar.js +20 -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 +34 -4
- package/dist/src/shadcn/components/ui/slider.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts +16 -1
- package/dist/src/shadcn/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.js +23 -3
- package/dist/src/shadcn/components/ui/sonner.js.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/sonner.stories.js +19 -11
- package/dist/src/shadcn/components/ui/sonner.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/switch.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/switch.js +18 -2
- package/dist/src/shadcn/components/ui/switch.js.map +1 -1
- package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/table.js +12 -8
- package/dist/src/shadcn/components/ui/table.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.d.ts +21 -3
- package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.js +315 -9
- package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js +50 -1
- package/dist/src/shadcn/components/ui/tabs.stories.js.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/textarea.js +15 -1
- package/dist/src/shadcn/components/ui/textarea.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle-group.js +6 -2
- package/dist/src/shadcn/components/ui/toggle-group.js.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/toggle.js +18 -6
- package/dist/src/shadcn/components/ui/toggle.js.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/shadcn/components/ui/tooltip.js +11 -1
- package/dist/src/shadcn/components/ui/tooltip.js.map +1 -1
- package/dist/src/shadcn/components/ui/tree.d.ts +28 -0
- package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -0
- package/dist/src/shadcn/components/ui/tree.js +122 -0
- package/dist/src/shadcn/components/ui/tree.js.map +1 -0
- package/dist/src/typography.css +12 -0
- package/package.json +13 -2
- 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 +87 -0
- package/src/components/code-editor/index.tsx +307 -21
- package/src/components/code-editor.stories.tsx +295 -1
- package/src/components/copy-icon.tsx +57 -3
- package/src/components/data-table.stories.tsx +38 -0
- package/src/components/data-table.tsx +117 -0
- package/src/components/fhir-structure-view.stories.tsx +439 -0
- package/src/components/fhir-structure-view.tsx +231 -0
- package/src/components/patient-table.stories.tsx +111 -0
- package/src/components/patient-table.tsx +1301 -0
- package/src/components/request-line-editor.stories.tsx +17 -27
- package/src/components/request-line-editor.tsx +98 -61
- package/src/components/segment-control.stories.tsx +29 -0
- package/src/components/segment-control.tsx +80 -0
- package/src/components/split-button.stories.tsx +49 -0
- package/src/components/split-button.tsx +17 -0
- package/src/components/tree-view.stories.tsx +259 -0
- package/src/components/tree-view.tsx +172 -0
- package/src/icons.tsx +287 -0
- package/src/index.css +42 -3
- package/src/index.tsx +9 -2
- package/src/shadcn/components/ui/accordion.tsx +66 -8
- package/src/shadcn/components/ui/alert-dialog.tsx +6 -2
- package/src/shadcn/components/ui/alert.tsx +53 -15
- package/src/shadcn/components/ui/avatar.tsx +17 -6
- package/src/shadcn/components/ui/badge.tsx +67 -18
- package/src/shadcn/components/ui/breadcrumb.tsx +35 -7
- package/src/shadcn/components/ui/button.tsx +118 -57
- package/src/shadcn/components/ui/card.tsx +44 -13
- package/src/shadcn/components/ui/checkbox.stories.tsx +20 -24
- package/src/shadcn/components/ui/checkbox.tsx +45 -4
- package/src/shadcn/components/ui/combobox.stories.tsx +19 -0
- package/src/shadcn/components/ui/combobox.tsx +142 -0
- package/src/shadcn/components/ui/command.stories.tsx +1 -1
- package/src/shadcn/components/ui/command.tsx +192 -36
- package/src/shadcn/components/ui/dialog.tsx +101 -13
- package/src/shadcn/components/ui/drawer.tsx +93 -18
- package/src/shadcn/components/ui/dropdown-menu.tsx +37 -9
- package/src/shadcn/components/ui/form.tsx +16 -4
- package/src/shadcn/components/ui/input.tsx +400 -29
- package/src/shadcn/components/ui/label.tsx +21 -4
- package/src/shadcn/components/ui/menubar.tsx +188 -43
- package/src/shadcn/components/ui/pagination.tsx +12 -6
- package/src/shadcn/components/ui/popover.tsx +35 -4
- package/src/shadcn/components/ui/progress.tsx +21 -5
- package/src/shadcn/components/ui/radio-group.stories.tsx +22 -14
- package/src/shadcn/components/ui/radio-group.tsx +42 -5
- package/src/shadcn/components/ui/scroll-area.tsx +33 -5
- package/src/shadcn/components/ui/select.stories.tsx +0 -2
- package/src/shadcn/components/ui/select.tsx +184 -33
- package/src/shadcn/components/ui/separator.tsx +15 -5
- package/src/shadcn/components/ui/sidebar.tsx +68 -26
- package/src/shadcn/components/ui/skeleton.tsx +4 -1
- package/src/shadcn/components/ui/slider.tsx +82 -11
- package/src/shadcn/components/ui/sonner.stories.tsx +19 -15
- package/src/shadcn/components/ui/sonner.tsx +53 -3
- package/src/shadcn/components/ui/switch.tsx +53 -7
- package/src/shadcn/components/ui/table.tsx +38 -11
- package/src/shadcn/components/ui/tabs.stories.tsx +32 -0
- package/src/shadcn/components/ui/tabs.tsx +456 -17
- package/src/shadcn/components/ui/textarea.tsx +42 -4
- package/src/shadcn/components/ui/toggle-group.tsx +27 -5
- package/src/shadcn/components/ui/toggle.tsx +59 -18
- package/src/shadcn/components/ui/tooltip.tsx +33 -8
- package/src/shadcn/components/ui/tree.tsx +233 -0
- package/src/typography.css +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../../../src/components/code-editor/http/grammar/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,eAAO,MAAM,MAAM,UAkBjB,CAAC"}
|
|
@@ -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,38 @@
|
|
|
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: "'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(_",
|
|
6
|
+
stateData: "$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",
|
|
7
|
+
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",
|
|
8
|
+
nodeNames: "⚠ Http HttpRequestMethod HttpRequestPath HttpHeaders HttpHeader HttpHeaderName HttpHeaderValue HttpBody",
|
|
9
|
+
maxTerm: 22,
|
|
10
|
+
nodeProps: [
|
|
11
|
+
[
|
|
12
|
+
"group",
|
|
13
|
+
2,
|
|
14
|
+
"Method"
|
|
15
|
+
]
|
|
16
|
+
],
|
|
17
|
+
skippedNodes: [
|
|
18
|
+
0
|
|
19
|
+
],
|
|
20
|
+
repeatNodeCount: 3,
|
|
21
|
+
tokenData: "'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",
|
|
22
|
+
tokenizers: [
|
|
23
|
+
0,
|
|
24
|
+
1,
|
|
25
|
+
2,
|
|
26
|
+
3,
|
|
27
|
+
4
|
|
28
|
+
],
|
|
29
|
+
topRules: {
|
|
30
|
+
Http: [
|
|
31
|
+
0,
|
|
32
|
+
1
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
tokenPrec: 0
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/code-editor/http/grammar/http.ts"],"sourcesContent":["// This file was generated by lezer-generator. You probably shouldn't edit it.\nimport { LRParser } from \"@lezer/lr\";\nexport const parser = LRParser.deserialize({\n\tversion: 14,\n\tstates:\n\t\t\"'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(_\",\n\tstateData:\n\t\t\"$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\",\n\tgoto: \"#|_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\",\n\tnodeNames:\n\t\t\"⚠ Http HttpRequestMethod HttpRequestPath HttpHeaders HttpHeader HttpHeaderName HttpHeaderValue HttpBody\",\n\tmaxTerm: 22,\n\tnodeProps: [[\"group\", 2, \"Method\"]],\n\tskippedNodes: [0],\n\trepeatNodeCount: 3,\n\ttokenData:\n\t\t\"'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\",\n\ttokenizers: [0, 1, 2, 3, 4],\n\ttopRules: { Http: [0, 1] },\n\ttokenPrec: 0,\n});\n"],"names":["LRParser","parser","deserialize","version","states","stateData","goto","nodeNames","maxTerm","nodeProps","skippedNodes","repeatNodeCount","tokenData","tokenizers","topRules","Http","tokenPrec"],"mappings":"AAAA,8EAA8E;AAC9E,SAASA,QAAQ,QAAQ,YAAY;AACrC,OAAO,MAAMC,SAASD,SAASE,WAAW,CAAC;IAC1CC,SAAS;IACTC,QACC;IACDC,WACC;IACDC,MAAM;IACNC,WACC;IACDC,SAAS;IACTC,WAAW;QAAC;YAAC;YAAS;YAAG;SAAS;KAAC;IACnCC,cAAc;QAAC;KAAE;IACjBC,iBAAiB;IACjBC,WACC;IACDC,YAAY;QAAC;QAAG;QAAG;QAAG;QAAG;KAAE;IAC3BC,UAAU;QAAEC,MAAM;YAAC;YAAG;SAAE;IAAC;IACzBC,WAAW;AACZ,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.terms.d.ts","sourceRoot":"","sources":["../../../../../../src/components/code-editor/http/grammar/http.terms.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,IAAI,IAAI,EACpB,iBAAiB,IAAI,EACrB,eAAe,IAAI,EACnB,WAAW,IAAI,EACf,UAAU,IAAI,EACd,cAAc,IAAI,EAClB,eAAe,IAAI,EACnB,QAAQ,IAAI,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
export const Http = 1, HttpRequestMethod = 2, HttpRequestPath = 3, HttpHeaders = 4, HttpHeader = 5, HttpHeaderName = 6, HttpHeaderValue = 7, HttpBody = 8;
|
|
3
|
+
|
|
4
|
+
//# sourceMappingURL=http.terms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/code-editor/http/grammar/http.terms.ts"],"sourcesContent":["// This file was generated by lezer-generator. You probably shouldn't edit it.\nexport const Http = 1,\n\tHttpRequestMethod = 2,\n\tHttpRequestPath = 3,\n\tHttpHeaders = 4,\n\tHttpHeader = 5,\n\tHttpHeaderName = 6,\n\tHttpHeaderValue = 7,\n\tHttpBody = 8;\n"],"names":["Http","HttpRequestMethod","HttpRequestPath","HttpHeaders","HttpHeader","HttpHeaderName","HttpHeaderValue","HttpBody"],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,MAAMA,OAAO,GACnBC,oBAAoB,GACpBC,kBAAkB,GAClBC,cAAc,GACdC,aAAa,GACbC,iBAAiB,GACjBC,kBAAkB,GAClBC,WAAW,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.test.d.ts","sourceRoot":"","sources":["../../../../../../src/components/code-editor/http/grammar/http.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Tests for lezer Http grammar
|
|
2
|
+
import { testTree } from "@lezer/generator/test";
|
|
3
|
+
import { parser } from "./http.js";
|
|
4
|
+
function parseHttp(input) {
|
|
5
|
+
const stack = [];
|
|
6
|
+
parser.parse(input).iterate({
|
|
7
|
+
enter: (node)=>{
|
|
8
|
+
const nodeName = node.type.name;
|
|
9
|
+
const nodeFrom = node.from;
|
|
10
|
+
const nodeTo = node.to;
|
|
11
|
+
const value = input.slice(nodeFrom, nodeTo);
|
|
12
|
+
stack.push({
|
|
13
|
+
name: nodeName,
|
|
14
|
+
from: nodeFrom,
|
|
15
|
+
to: nodeTo,
|
|
16
|
+
value: value,
|
|
17
|
+
children: []
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
leave: ()=>{
|
|
21
|
+
const current = stack.pop();
|
|
22
|
+
if (current === undefined) {
|
|
23
|
+
throw "Stack underflow";
|
|
24
|
+
}
|
|
25
|
+
if (stack.length === 0) {
|
|
26
|
+
// Re-push root
|
|
27
|
+
stack.push(current);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const parent = stack[stack.length - 1];
|
|
31
|
+
if (parent === undefined) {
|
|
32
|
+
throw "Impossible";
|
|
33
|
+
}
|
|
34
|
+
parent.children.push(current);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const res = stack.pop();
|
|
38
|
+
if (res === undefined) {
|
|
39
|
+
throw "Stack underflow";
|
|
40
|
+
}
|
|
41
|
+
return res;
|
|
42
|
+
}
|
|
43
|
+
function transform(root) {
|
|
44
|
+
const tree = {
|
|
45
|
+
name: root.name,
|
|
46
|
+
children: []
|
|
47
|
+
};
|
|
48
|
+
let pos = root.from;
|
|
49
|
+
for (const child of root.children){
|
|
50
|
+
if (pos < child.from) {
|
|
51
|
+
const prefix = root.value.slice(pos - root.from, child.from - root.from);
|
|
52
|
+
tree.children.push(prefix);
|
|
53
|
+
}
|
|
54
|
+
tree.children.push(transform(child));
|
|
55
|
+
pos = child.to;
|
|
56
|
+
}
|
|
57
|
+
if (pos < root.to) {
|
|
58
|
+
tree.children.push(root.value.slice(pos - root.from));
|
|
59
|
+
}
|
|
60
|
+
return tree;
|
|
61
|
+
}
|
|
62
|
+
const tree = parser.parse("GET /\nAccept: text/yaml\n\nhello: world");
|
|
63
|
+
console.dir(parseHttp("GET /\nAccept: text/yaml\n\nhello: world\n\nagain"), {
|
|
64
|
+
depth: null
|
|
65
|
+
});
|
|
66
|
+
console.dir(transform(parseHttp("GET /\nAccept: text/yaml\n\nhello: world\n\nagain")), {
|
|
67
|
+
depth: null
|
|
68
|
+
});
|
|
69
|
+
console.log(tree);
|
|
70
|
+
tree.iterate({
|
|
71
|
+
enter: (node)=>{
|
|
72
|
+
console.log(`ENTER ${node.type.name}[${node.from}:${node.to}]`);
|
|
73
|
+
},
|
|
74
|
+
leave: (node)=>{
|
|
75
|
+
console.log(`LEAVE ${node.type.name}[${node.from}:${node.to}]`);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
testTree(tree, `Http`);
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=http.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/code-editor/http/grammar/http.test.ts"],"sourcesContent":["// Tests for lezer Http grammar\n\nimport { testTree } from \"@lezer/generator/test\";\nimport { parser } from \"./http\";\n\ntype StackEntry = {\n\tname: string;\n\tfrom: number;\n\tto: number;\n\tvalue: string;\n\tchildren: StackEntry[];\n\ttextNode?: boolean;\n};\n\nfunction parseHttp(input: string): StackEntry {\n\tconst stack: StackEntry[] = [];\n\tparser.parse(input).iterate({\n\t\tenter: (node) => {\n\t\t\tconst nodeName = node.type.name;\n\t\t\tconst nodeFrom = node.from;\n\t\t\tconst nodeTo = node.to;\n\t\t\tconst value = input.slice(nodeFrom, nodeTo);\n\n\t\t\tstack.push({\n\t\t\t\tname: nodeName,\n\t\t\t\tfrom: nodeFrom,\n\t\t\t\tto: nodeTo,\n\t\t\t\tvalue: value,\n\t\t\t\tchildren: [],\n\t\t\t});\n\t\t},\n\n\t\tleave: () => {\n\t\t\tconst current = stack.pop();\n\t\t\tif (current === undefined) {\n\t\t\t\tthrow \"Stack underflow\";\n\t\t\t}\n\n\t\t\tif (stack.length === 0) {\n\t\t\t\t// Re-push root\n\t\t\t\tstack.push(current);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst parent = stack[stack.length - 1];\n\t\t\tif (parent === undefined) {\n\t\t\t\tthrow \"Impossible\";\n\t\t\t}\n\n\t\t\tparent.children.push(current);\n\t\t},\n\t});\n\n\tconst res = stack.pop();\n\tif (res === undefined) {\n\t\tthrow \"Stack underflow\";\n\t}\n\treturn res;\n}\n\ntype Tree = TreeNode | string;\ntype TreeNode = {\n\tname: string;\n\tchildren: Tree[];\n};\n\nfunction transform(root: StackEntry): Tree {\n\tconst tree: Tree = {\n\t\tname: root.name,\n\t\tchildren: [],\n\t};\n\n\tlet pos = root.from;\n\tfor (const child of root.children) {\n\t\tif (pos < child.from) {\n\t\t\tconst prefix = root.value.slice(pos - root.from, child.from - root.from);\n\t\t\ttree.children.push(prefix);\n\t\t}\n\n\t\ttree.children.push(transform(child));\n\t\tpos = child.to;\n\t}\n\n\tif (pos < root.to) {\n\t\ttree.children.push(root.value.slice(pos - root.from));\n\t}\n\n\treturn tree;\n}\n\nconst tree = parser.parse(\"GET /\\nAccept: text/yaml\\n\\nhello: world\");\nconsole.dir(parseHttp(\"GET /\\nAccept: text/yaml\\n\\nhello: world\\n\\nagain\"), {\n\tdepth: null,\n});\nconsole.dir(\n\ttransform(parseHttp(\"GET /\\nAccept: text/yaml\\n\\nhello: world\\n\\nagain\")),\n\t{\n\t\tdepth: null,\n\t},\n);\nconsole.log(tree);\ntree.iterate({\n\tenter: (node) => {\n\t\tconsole.log(`ENTER ${node.type.name}[${node.from}:${node.to}]`);\n\t},\n\tleave: (node) => {\n\t\tconsole.log(`LEAVE ${node.type.name}[${node.from}:${node.to}]`);\n\t},\n});\ntestTree(tree, `Http`);\n"],"names":["testTree","parser","parseHttp","input","stack","parse","iterate","enter","node","nodeName","type","name","nodeFrom","from","nodeTo","to","value","slice","push","children","leave","current","pop","undefined","length","parent","res","transform","root","tree","pos","child","prefix","console","dir","depth","log"],"mappings":"AAAA,+BAA+B;AAE/B,SAASA,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,MAAM,QAAQ,YAAS;AAWhC,SAASC,UAAUC,KAAa;IAC/B,MAAMC,QAAsB,EAAE;IAC9BH,OAAOI,KAAK,CAACF,OAAOG,OAAO,CAAC;QAC3BC,OAAO,CAACC;YACP,MAAMC,WAAWD,KAAKE,IAAI,CAACC,IAAI;YAC/B,MAAMC,WAAWJ,KAAKK,IAAI;YAC1B,MAAMC,SAASN,KAAKO,EAAE;YACtB,MAAMC,QAAQb,MAAMc,KAAK,CAACL,UAAUE;YAEpCV,MAAMc,IAAI,CAAC;gBACVP,MAAMF;gBACNI,MAAMD;gBACNG,IAAID;gBACJE,OAAOA;gBACPG,UAAU,EAAE;YACb;QACD;QAEAC,OAAO;YACN,MAAMC,UAAUjB,MAAMkB,GAAG;YACzB,IAAID,YAAYE,WAAW;gBAC1B,MAAM;YACP;YAEA,IAAInB,MAAMoB,MAAM,KAAK,GAAG;gBACvB,eAAe;gBACfpB,MAAMc,IAAI,CAACG;gBACX;YACD;YAEA,MAAMI,SAASrB,KAAK,CAACA,MAAMoB,MAAM,GAAG,EAAE;YACtC,IAAIC,WAAWF,WAAW;gBACzB,MAAM;YACP;YAEAE,OAAON,QAAQ,CAACD,IAAI,CAACG;QACtB;IACD;IAEA,MAAMK,MAAMtB,MAAMkB,GAAG;IACrB,IAAII,QAAQH,WAAW;QACtB,MAAM;IACP;IACA,OAAOG;AACR;AAQA,SAASC,UAAUC,IAAgB;IAClC,MAAMC,OAAa;QAClBlB,MAAMiB,KAAKjB,IAAI;QACfQ,UAAU,EAAE;IACb;IAEA,IAAIW,MAAMF,KAAKf,IAAI;IACnB,KAAK,MAAMkB,SAASH,KAAKT,QAAQ,CAAE;QAClC,IAAIW,MAAMC,MAAMlB,IAAI,EAAE;YACrB,MAAMmB,SAASJ,KAAKZ,KAAK,CAACC,KAAK,CAACa,MAAMF,KAAKf,IAAI,EAAEkB,MAAMlB,IAAI,GAAGe,KAAKf,IAAI;YACvEgB,KAAKV,QAAQ,CAACD,IAAI,CAACc;QACpB;QAEAH,KAAKV,QAAQ,CAACD,IAAI,CAACS,UAAUI;QAC7BD,MAAMC,MAAMhB,EAAE;IACf;IAEA,IAAIe,MAAMF,KAAKb,EAAE,EAAE;QAClBc,KAAKV,QAAQ,CAACD,IAAI,CAACU,KAAKZ,KAAK,CAACC,KAAK,CAACa,MAAMF,KAAKf,IAAI;IACpD;IAEA,OAAOgB;AACR;AAEA,MAAMA,OAAO5B,OAAOI,KAAK,CAAC;AAC1B4B,QAAQC,GAAG,CAAChC,UAAU,sDAAsD;IAC3EiC,OAAO;AACR;AACAF,QAAQC,GAAG,CACVP,UAAUzB,UAAU,uDACpB;IACCiC,OAAO;AACR;AAEDF,QAAQG,GAAG,CAACP;AACZA,KAAKvB,OAAO,CAAC;IACZC,OAAO,CAACC;QACPyB,QAAQG,GAAG,CAAC,CAAC,MAAM,EAAE5B,KAAKE,IAAI,CAACC,IAAI,CAAC,CAAC,EAAEH,KAAKK,IAAI,CAAC,CAAC,EAAEL,KAAKO,EAAE,CAAC,CAAC,CAAC;IAC/D;IACAK,OAAO,CAACZ;QACPyB,QAAQG,GAAG,CAAC,CAAC,MAAM,EAAE5B,KAAKE,IAAI,CAACC,IAAI,CAAC,CAAC,EAAEH,KAAKK,IAAI,CAAC,CAAC,EAAEL,KAAKO,EAAE,CAAC,CAAC,CAAC;IAC/D;AACD;AACAf,SAAS6B,MAAM,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/code-editor/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,QAAQ,EACb,eAAe,EAEf,MAAM,sBAAsB,CAAC;AA0E9B,iBAAS,IAAI,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,QAAQ,GAAG,IAAI,mBAIpE;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { foldInside, foldNodeProp, LanguageSupport, LRLanguage } from "@codemirror/language";
|
|
2
|
+
import { parseMixed } from "@lezer/common";
|
|
3
|
+
import { styleTags, tags } from "@lezer/highlight";
|
|
4
|
+
import { parser } from "./grammar/http.js";
|
|
5
|
+
function makeParser(bodyLanguages) {
|
|
6
|
+
return parser.configure({
|
|
7
|
+
props: [
|
|
8
|
+
styleTags({
|
|
9
|
+
HttpHeaderName: tags.variableName,
|
|
10
|
+
HttpHeaderValue: tags.attributeValue
|
|
11
|
+
}),
|
|
12
|
+
foldNodeProp.add({
|
|
13
|
+
HttpHeaders: foldInside
|
|
14
|
+
})
|
|
15
|
+
],
|
|
16
|
+
wrap: parseMixed((node, input)=>{
|
|
17
|
+
if (node.name !== "HttpBody") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const headers = node.node.prevSibling;
|
|
21
|
+
if (headers?.name !== "HttpHeaders") {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
let contentType = null;
|
|
25
|
+
for(let child = headers.firstChild; child !== null; child = child.nextSibling){
|
|
26
|
+
const headerNameNode = child.getChild("HttpHeaderName");
|
|
27
|
+
if (headerNameNode === null) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const headerName = input.read(headerNameNode.from, headerNameNode.to);
|
|
31
|
+
if (headerName.toLowerCase() !== "content-type") {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (contentType !== null) {
|
|
35
|
+
// Disallow multiple content types
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const headerValueNode = child.getChild("HttpHeaderValue");
|
|
39
|
+
if (headerValueNode === null) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
contentType = input.read(headerValueNode.from, headerValueNode.to);
|
|
43
|
+
}
|
|
44
|
+
if (contentType === null) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const language = bodyLanguages(contentType);
|
|
48
|
+
if (language === null) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
parser: language.parser
|
|
53
|
+
};
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function http(bodyLanguages) {
|
|
58
|
+
const parser = makeParser(bodyLanguages);
|
|
59
|
+
const language = LRLanguage.define({
|
|
60
|
+
parser: parser
|
|
61
|
+
});
|
|
62
|
+
return new LanguageSupport(language, []);
|
|
63
|
+
}
|
|
64
|
+
export { http };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/code-editor/http/index.ts"],"sourcesContent":["import {\n\tfoldInside,\n\tfoldNodeProp,\n\ttype Language,\n\tLanguageSupport,\n\tLRLanguage,\n} from \"@codemirror/language\";\nimport { parseMixed } from \"@lezer/common\";\nimport { styleTags, tags } from \"@lezer/highlight\";\nimport type { LRParser } from \"@lezer/lr\";\nimport { parser } from \"./grammar/http\";\n\nfunction makeParser(\n\tbodyLanguages: (contentType: string) => Language | null,\n): LRParser {\n\treturn parser.configure({\n\t\tprops: [\n\t\t\tstyleTags({\n\t\t\t\tHttpHeaderName: tags.variableName,\n\t\t\t\tHttpHeaderValue: tags.attributeValue,\n\t\t\t}),\n\n\t\t\tfoldNodeProp.add({\n\t\t\t\tHttpHeaders: foldInside,\n\t\t\t}),\n\t\t],\n\t\twrap: parseMixed((node, input) => {\n\t\t\tif (node.name !== \"HttpBody\") {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst headers = node.node.prevSibling;\n\t\t\tif (headers?.name !== \"HttpHeaders\") {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tlet contentType: string | null = null;\n\n\t\t\tfor (\n\t\t\t\tlet child = headers.firstChild;\n\t\t\t\tchild !== null;\n\t\t\t\tchild = child.nextSibling\n\t\t\t) {\n\t\t\t\tconst headerNameNode = child.getChild(\"HttpHeaderName\");\n\t\t\t\tif (headerNameNode === null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst headerName = input.read(headerNameNode.from, headerNameNode.to);\n\t\t\t\tif (headerName.toLowerCase() !== \"content-type\") {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (contentType !== null) {\n\t\t\t\t\t// Disallow multiple content types\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst headerValueNode = child.getChild(\"HttpHeaderValue\");\n\t\t\t\tif (headerValueNode === null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentType = input.read(headerValueNode.from, headerValueNode.to);\n\t\t\t}\n\n\t\t\tif (contentType === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst language = bodyLanguages(contentType);\n\t\t\tif (language === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn { parser: language.parser };\n\t\t}),\n\t});\n}\n\nfunction http(bodyLanguages: (contentType: string) => Language | null) {\n\tconst parser = makeParser(bodyLanguages);\n\tconst language = LRLanguage.define({ parser: parser });\n\treturn new LanguageSupport(language, []);\n}\n\nexport { http };\n"],"names":["foldInside","foldNodeProp","LanguageSupport","LRLanguage","parseMixed","styleTags","tags","parser","makeParser","bodyLanguages","configure","props","HttpHeaderName","variableName","HttpHeaderValue","attributeValue","add","HttpHeaders","wrap","node","input","name","headers","prevSibling","contentType","child","firstChild","nextSibling","headerNameNode","getChild","headerName","read","from","to","toLowerCase","headerValueNode","language","http","define"],"mappings":"AAAA,SACCA,UAAU,EACVC,YAAY,EAEZC,eAAe,EACfC,UAAU,QACJ,uBAAuB;AAC9B,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,SAAS,EAAEC,IAAI,QAAQ,mBAAmB;AAEnD,SAASC,MAAM,QAAQ,oBAAiB;AAExC,SAASC,WACRC,aAAuD;IAEvD,OAAOF,OAAOG,SAAS,CAAC;QACvBC,OAAO;YACNN,UAAU;gBACTO,gBAAgBN,KAAKO,YAAY;gBACjCC,iBAAiBR,KAAKS,cAAc;YACrC;YAEAd,aAAae,GAAG,CAAC;gBAChBC,aAAajB;YACd;SACA;QACDkB,MAAMd,WAAW,CAACe,MAAMC;YACvB,IAAID,KAAKE,IAAI,KAAK,YAAY;gBAC7B,OAAO;YACR;YAEA,MAAMC,UAAUH,KAAKA,IAAI,CAACI,WAAW;YACrC,IAAID,SAASD,SAAS,eAAe;gBACpC,OAAO;YACR;YAEA,IAAIG,cAA6B;YAEjC,IACC,IAAIC,QAAQH,QAAQI,UAAU,EAC9BD,UAAU,MACVA,QAAQA,MAAME,WAAW,CACxB;gBACD,MAAMC,iBAAiBH,MAAMI,QAAQ,CAAC;gBACtC,IAAID,mBAAmB,MAAM;oBAC5B;gBACD;gBAEA,MAAME,aAAaV,MAAMW,IAAI,CAACH,eAAeI,IAAI,EAAEJ,eAAeK,EAAE;gBACpE,IAAIH,WAAWI,WAAW,OAAO,gBAAgB;oBAChD;gBACD;gBAEA,IAAIV,gBAAgB,MAAM;oBACzB,kCAAkC;oBAClC,OAAO;gBACR;gBAEA,MAAMW,kBAAkBV,MAAMI,QAAQ,CAAC;gBACvC,IAAIM,oBAAoB,MAAM;oBAC7B;gBACD;gBAEAX,cAAcJ,MAAMW,IAAI,CAACI,gBAAgBH,IAAI,EAAEG,gBAAgBF,EAAE;YAClE;YAEA,IAAIT,gBAAgB,MAAM;gBACzB,OAAO;YACR;YAEA,MAAMY,WAAW3B,cAAce;YAC/B,IAAIY,aAAa,MAAM;gBACtB,OAAO;YACR;YAEA,OAAO;gBAAE7B,QAAQ6B,SAAS7B,MAAM;YAAC;QAClC;IACD;AACD;AAEA,SAAS8B,KAAK5B,aAAuD;IACpE,MAAMF,SAASC,WAAWC;IAC1B,MAAM2B,WAAWjC,WAAWmC,MAAM,CAAC;QAAE/B,QAAQA;IAAO;IACpD,OAAO,IAAIL,gBAAgBkC,UAAU,EAAE;AACxC;AAEA,SAASC,IAAI,GAAG"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { EditorView, type ViewUpdate } from "@codemirror/view";
|
|
2
|
+
type LanguageMode = "json" | "http" | "sql" | "yaml";
|
|
3
|
+
type CodeEditorProps = {
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
isReadOnlyTheme?: boolean;
|
|
2
6
|
defaultValue?: string;
|
|
7
|
+
currentValue?: string;
|
|
3
8
|
onChange?: (value: string) => void;
|
|
4
|
-
|
|
9
|
+
onUpdate?: (update: ViewUpdate) => void;
|
|
10
|
+
id?: string;
|
|
11
|
+
mode?: LanguageMode;
|
|
12
|
+
viewCallback?: (view: EditorView) => void;
|
|
13
|
+
};
|
|
14
|
+
export type CodeEditorView = EditorView;
|
|
15
|
+
export declare function CodeEditor({ defaultValue, currentValue, onChange, onUpdate, viewCallback, readOnly, id, mode, isReadOnlyTheme, }: CodeEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
5
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAIN,UAAU,EAOV,KAAK,UAAU,EACf,MAAM,kBAAkB,CAAC;AA2L1B,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAgCrD,KAAK,eAAe,GAAG;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AAExC,wBAAgB,UAAU,CAAC,EAC1B,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,QAAgB,EAChB,EAAE,EACF,IAAa,EACb,eAAuB,GACvB,EAAE,eAAe,2CAwJjB"}
|