@molecule/app-http-inspector-angular 0.0.0-stage → 0.0.1-stage

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 ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @molecule/app-http-inspector-angular
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ HTTP method + URL builder + headers/params/body tabs + response status/timing display
4
+
5
+ ```
6
+ npm install @molecule/app-http-inspector-angular
7
+ ```
8
+
9
+ Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
10
+
11
+ License: Apache-2.0
@@ -0,0 +1,220 @@
1
+ import type { UIClassMap } from '@molecule/app-ui';
2
+ import type { HttpHeader, HttpMethod, HttpResponse } from './types.js';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * HttpInspector component.
6
+ *
7
+ * Controlled HTTP request builder + response panel. The host IS the outer
8
+ * `<div>` React renders (`div[mol-http-inspector]`), with the same classes.
9
+ * App owns request state + the actual `fetch`; this component renders the UI:
10
+ * method + URL row, headers key/value editor, body textarea (methods that
11
+ * allow a body), Send button, then a response panel showing status + timing +
12
+ * body.
13
+ */
14
+ export declare class HttpInspector {
15
+ /** The request's HTTP method. */
16
+ method: HttpMethod;
17
+ /** Called with the new method when the user picks one (React's `onMethodChange`). */
18
+ onMethodChange?: (method: HttpMethod) => void;
19
+ /** The request URL. */
20
+ url: string;
21
+ /** Called with the new URL as the user types (React's `onUrlChange`). */
22
+ onUrlChange?: (url: string) => void;
23
+ /** The request headers, in render order. */
24
+ headers: HttpHeader[];
25
+ /** Called with the next header list on any header edit (React's `onHeadersChange`). */
26
+ onHeadersChange?: (headers: HttpHeader[]) => void;
27
+ /** The request body. */
28
+ body: string;
29
+ /** Called with the new body as the user types (React's `onBodyChange`). */
30
+ onBodyChange?: (body: string) => void;
31
+ /** Sends the request (React's `onSend`). */
32
+ onSend?: () => void | Promise<void>;
33
+ /** Whether a send is in flight (React's `sending`). */
34
+ sending?: boolean;
35
+ /** The last response to show (React's `response`). */
36
+ response?: HttpResponse | null;
37
+ /** Extra classes on the outer wrapper (React's `className`). */
38
+ className?: string;
39
+ /** The method options, in React's order. */
40
+ readonly methodOptions: {
41
+ value: HttpMethod;
42
+ label: HttpMethod;
43
+ }[];
44
+ /** The body textarea's placeholder (React's literal). */
45
+ readonly bodyPlaceholder = "{\"key\": \"value\"}";
46
+ /**
47
+ * Reactive translation, read in the injection context. Its `t` reads the
48
+ * locale, so the view re-renders the labels on a locale switch (the static
49
+ * `t` does not).
50
+ */
51
+ private readonly i18n;
52
+ /**
53
+ * The current class map.
54
+ * @returns The UIClassMap.
55
+ */
56
+ cm(): UIClassMap;
57
+ /**
58
+ * The wrapper class list (React's `cm.cn(cm.stack(3), className)`).
59
+ * @returns The class string.
60
+ */
61
+ classes(): string;
62
+ /**
63
+ * The method + URL row's class (React's `cm.flex({ align: 'center', gap: 'sm' })`).
64
+ * @returns The class string.
65
+ */
66
+ rowClasses(): string;
67
+ /**
68
+ * A header row's class (React's `cm.flex({ align: 'center', gap: 'xs' })`).
69
+ * @returns The class string.
70
+ */
71
+ headerRowClasses(): string;
72
+ /**
73
+ * The headers / body section's class (React's `cm.stack(1)`).
74
+ * @returns The class string.
75
+ */
76
+ stack1Classes(): string;
77
+ /**
78
+ * The response section's class (React's `cm.stack(2)`).
79
+ * @returns The class string.
80
+ */
81
+ stack2Classes(): string;
82
+ /**
83
+ * A section label's class (React's `cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'))`).
84
+ * @returns The class string.
85
+ */
86
+ labelClasses(): string;
87
+ /**
88
+ * The timing span's class (React's `cm.textSize('xs')`).
89
+ * @returns The class string.
90
+ */
91
+ textXsClasses(): string;
92
+ /**
93
+ * The response body panel's class (React's `cm.cn(cm.sp('p', 3), cm.textSize('xs'))`).
94
+ * @returns The class string.
95
+ */
96
+ preClasses(): string;
97
+ /**
98
+ * The URL input's extra class (React's `cm.flex1`).
99
+ * @returns The class string.
100
+ */
101
+ flexClasses(): string;
102
+ /**
103
+ * The status badge's class list (React's `cm.bgTone(tone)` + `cm.textOnTone`).
104
+ *
105
+ * @param code - The response status code.
106
+ * @returns The class string.
107
+ */
108
+ statusClasses(code: number): string;
109
+ /**
110
+ * The status badge's inline style (React's padding, radius and weight; the
111
+ * tone colours come from {@link statusClasses}).
112
+ *
113
+ * @returns The style map.
114
+ */
115
+ statusStyle(): Record<string, string>;
116
+ /**
117
+ * The response body panel's inline style (horizontal scrolling).
118
+ * @returns The style map.
119
+ */
120
+ preStyle(): Record<string, string>;
121
+ /**
122
+ * Whether the body editor renders (React hides it for GET and HEAD).
123
+ * @returns True when the method allows a body.
124
+ */
125
+ showBody(): boolean;
126
+ /**
127
+ * The Send button's pending label (React's `httpInspector.sending`).
128
+ * @returns The label text.
129
+ */
130
+ sendingText(): string;
131
+ /**
132
+ * The Send button's idle label (React's `httpInspector.send`).
133
+ * @returns The label text.
134
+ */
135
+ sendText(): string;
136
+ /**
137
+ * The headers section's label (React's `httpInspector.headers`).
138
+ * @returns The label text.
139
+ */
140
+ headersLabel(): string;
141
+ /**
142
+ * The body section's label (React's `httpInspector.body`).
143
+ * @returns The label text.
144
+ */
145
+ bodyLabel(): string;
146
+ /**
147
+ * The add-header button's label (React's `httpInspector.addHeader`).
148
+ * @returns The label text.
149
+ */
150
+ addHeaderLabel(): string;
151
+ /**
152
+ * The method select's accessible label (React's `httpInspector.methodLabel`).
153
+ * @returns The label text.
154
+ */
155
+ methodLabel(): string;
156
+ /**
157
+ * The URL field's accessible label (React's `httpInspector.urlLabel`).
158
+ * @returns The label text.
159
+ */
160
+ urlLabel(): string;
161
+ /**
162
+ * A header row's key placeholder (React's `httpInspector.headerPlaceholder`).
163
+ * @returns The placeholder text.
164
+ */
165
+ headerPlaceholder(): string;
166
+ /**
167
+ * A header row's value placeholder (React's `httpInspector.valuePlaceholder`).
168
+ * @returns The placeholder text.
169
+ */
170
+ valuePlaceholder(): string;
171
+ /**
172
+ * Reports a picked method (React's `onMethodChange`).
173
+ *
174
+ * @param method - The selected option value.
175
+ */
176
+ handleMethodChange(method: string): void;
177
+ /**
178
+ * Adopts the typed URL (React's `onUrlChange`).
179
+ *
180
+ * @param event - The native input event.
181
+ */
182
+ handleUrlChange(event: Event): void;
183
+ /**
184
+ * Updates a single header's key, keeping its value (React's `setHeader`).
185
+ *
186
+ * @param i - The row index.
187
+ * @param event - The native input event.
188
+ */
189
+ handleHeaderKey(i: number, event: Event): void;
190
+ /**
191
+ * Updates a single header's value, keeping its key (React's `setHeader`).
192
+ *
193
+ * @param i - The row index.
194
+ * @param event - The native input event.
195
+ */
196
+ handleHeaderValue(i: number, event: Event): void;
197
+ /**
198
+ * Removes one header (React's `headers.filter((_, j) => j !== i)`).
199
+ *
200
+ * @param i - The row index.
201
+ */
202
+ removeHeader(i: number): void;
203
+ /**
204
+ * Appends an empty header (React's `[...headers, { key: '', value: '' }]`).
205
+ */
206
+ addHeader(): void;
207
+ /**
208
+ * Adopts the typed body (React's `onBodyChange`).
209
+ *
210
+ * @param event - The native input event.
211
+ */
212
+ handleBodyChange(event: Event): void;
213
+ /**
214
+ * Calls the app's send handler (React's `void onSend()`).
215
+ */
216
+ send(): void;
217
+ static ɵfac: i0.ɵɵFactoryDeclaration<HttpInspector, never>;
218
+ static ɵcmp: i0.ɵɵComponentDeclaration<HttpInspector, "div[mol-http-inspector]", never, { "method": { "alias": "method"; "required": false; }; "onMethodChange": { "alias": "onMethodChange"; "required": false; }; "url": { "alias": "url"; "required": false; }; "onUrlChange": { "alias": "onUrlChange"; "required": false; }; "headers": { "alias": "headers"; "required": false; }; "onHeadersChange": { "alias": "onHeadersChange"; "required": false; }; "body": { "alias": "body"; "required": false; }; "onBodyChange": { "alias": "onBodyChange"; "required": false; }; "onSend": { "alias": "onSend"; "required": false; }; "sending": { "alias": "sending"; "required": false; }; "response": { "alias": "response"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
219
+ }
220
+ //# sourceMappingURL=http-inspector.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-inspector.component.d.ts","sourceRoot":"","sources":["../src/http-inspector.component.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIhE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;;AAoBtE;;;;;;;;;GASG;AACH,qBAgGa,aAAa;IACxB,iCAAiC;IACjC,MAAM,EAAE,UAAU,CAAQ;IAC1B,qFAAqF;IACrF,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IAC7C,uBAAuB;IACvB,GAAG,SAAK;IACR,yEAAyE;IACzE,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,4CAA4C;IAC5C,OAAO,EAAE,UAAU,EAAE,CAAK;IAC1B,uFAAuF;IACvF,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IACjD,wBAAwB;IACxB,IAAI,SAAK;IACT,2EAA2E;IAC3E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC9B,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,4CAA4C;IAC5C,QAAQ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AAG,IAAI;IAInC;;;;;OAKG;IACH,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAM9C;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAMhD;;;;OAIG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI7B;;OAEG;IACH,SAAS,IAAI,IAAI;IAIjB;;;;OAIG;IACH,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAIpC;;OAEG;IACH,IAAI,IAAI,IAAI;yCA7SD,aAAa;2CAAb,aAAa;CAgTzB"}
@@ -0,0 +1,555 @@
1
+ /**
2
+ * HttpInspector component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { Component } from '@angular/core';
7
+ import { useTranslation } from '@molecule/app-angular';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ import { Button, Input, Select, Textarea } from '@molecule/app-ui-angular';
10
+ import * as i0 from "@angular/core";
11
+ function HttpInspector_For_9_Template(rf, ctx) { if (rf & 1) {
12
+ const _r1 = i0.ɵɵgetCurrentView();
13
+ i0.ɵɵelementStart(0, "div")(1, "div", 5);
14
+ i0.ɵɵlistener("change", function HttpInspector_For_9_Template_div_change_1_listener($event) { const $index_r2 = i0.ɵɵrestoreView(_r1).$index; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.handleHeaderKey($index_r2, $event)); });
15
+ i0.ɵɵelementEnd();
16
+ i0.ɵɵelementStart(2, "div", 6);
17
+ i0.ɵɵlistener("change", function HttpInspector_For_9_Template_div_change_2_listener($event) { const $index_r2 = i0.ɵɵrestoreView(_r1).$index; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.handleHeaderValue($index_r2, $event)); });
18
+ i0.ɵɵelementEnd();
19
+ i0.ɵɵelementStart(3, "button", 4);
20
+ i0.ɵɵlistener("click", function HttpInspector_For_9_Template_button_click_3_listener() { const $index_r2 = i0.ɵɵrestoreView(_r1).$index; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.removeHeader($index_r2)); });
21
+ i0.ɵɵtext(4, "\u00D7");
22
+ i0.ɵɵelementEnd()();
23
+ } if (rf & 2) {
24
+ const header_r4 = ctx.$implicit;
25
+ const $index_r2 = ctx.$index;
26
+ const ctx_r2 = i0.ɵɵnextContext();
27
+ i0.ɵɵclassMap(ctx_r2.headerRowClasses());
28
+ i0.ɵɵadvance();
29
+ i0.ɵɵproperty("id", "http-inspector-header-" + $index_r2 + "-key")("type", "text")("value", header_r4.key)("placeholder", ctx_r2.headerPlaceholder());
30
+ i0.ɵɵadvance();
31
+ i0.ɵɵproperty("id", "http-inspector-header-" + $index_r2 + "-value")("type", "text")("value", header_r4.value)("placeholder", ctx_r2.valuePlaceholder())("className", ctx_r2.flexClasses());
32
+ i0.ɵɵadvance();
33
+ i0.ɵɵproperty("variant", "ghost")("size", "sm");
34
+ } }
35
+ function HttpInspector_Conditional_12_Template(rf, ctx) { if (rf & 1) {
36
+ const _r5 = i0.ɵɵgetCurrentView();
37
+ i0.ɵɵelementStart(0, "div")(1, "span");
38
+ i0.ɵɵtext(2);
39
+ i0.ɵɵelementEnd();
40
+ i0.ɵɵelementStart(3, "div", 7);
41
+ i0.ɵɵlistener("change", function HttpInspector_Conditional_12_Template_div_change_3_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.handleBodyChange($event)); });
42
+ i0.ɵɵelementEnd()();
43
+ } if (rf & 2) {
44
+ const ctx_r2 = i0.ɵɵnextContext();
45
+ i0.ɵɵclassMap(ctx_r2.stack1Classes());
46
+ i0.ɵɵadvance();
47
+ i0.ɵɵclassMap(ctx_r2.labelClasses());
48
+ i0.ɵɵadvance();
49
+ i0.ɵɵtextInterpolate(ctx_r2.bodyLabel());
50
+ i0.ɵɵadvance();
51
+ i0.ɵɵproperty("id", "http-inspector-body")("value", ctx_r2.body)("rows", 6)("placeholder", ctx_r2.bodyPlaceholder);
52
+ } }
53
+ function HttpInspector_Conditional_13_Conditional_4_Template(rf, ctx) { if (rf & 1) {
54
+ i0.ɵɵelementStart(0, "span");
55
+ i0.ɵɵtext(1);
56
+ i0.ɵɵelementEnd();
57
+ } if (rf & 2) {
58
+ const resp_r6 = i0.ɵɵnextContext();
59
+ const ctx_r2 = i0.ɵɵnextContext();
60
+ i0.ɵɵclassMap(ctx_r2.textXsClasses());
61
+ i0.ɵɵadvance();
62
+ i0.ɵɵtextInterpolate1("", resp_r6.durationMs, "ms");
63
+ } }
64
+ function HttpInspector_Conditional_13_Conditional_6_Template(rf, ctx) { if (rf & 1) {
65
+ i0.ɵɵelementContainerStart(0);
66
+ i0.ɵɵtext(1);
67
+ i0.ɵɵelementContainerEnd();
68
+ } if (rf & 2) {
69
+ const resp_r6 = i0.ɵɵnextContext();
70
+ i0.ɵɵadvance();
71
+ i0.ɵɵtextInterpolate(resp_r6.body);
72
+ } }
73
+ function HttpInspector_Conditional_13_Template(rf, ctx) { if (rf & 1) {
74
+ i0.ɵɵelementStart(0, "div")(1, "div")(2, "span");
75
+ i0.ɵɵtext(3);
76
+ i0.ɵɵelementEnd();
77
+ i0.ɵɵconditionalCreate(4, HttpInspector_Conditional_13_Conditional_4_Template, 2, 3, "span", 3);
78
+ i0.ɵɵelementEnd();
79
+ i0.ɵɵelementStart(5, "pre");
80
+ i0.ɵɵconditionalCreate(6, HttpInspector_Conditional_13_Conditional_6_Template, 2, 1, "ng-container");
81
+ i0.ɵɵelementEnd()();
82
+ } if (rf & 2) {
83
+ const resp_r6 = ctx;
84
+ const ctx_r2 = i0.ɵɵnextContext();
85
+ i0.ɵɵclassMap(ctx_r2.stack2Classes());
86
+ i0.ɵɵadvance();
87
+ i0.ɵɵclassMap(ctx_r2.rowClasses());
88
+ i0.ɵɵadvance();
89
+ i0.ɵɵstyleMap(ctx_r2.statusStyle());
90
+ i0.ɵɵclassMap(ctx_r2.statusClasses(resp_r6.statusCode));
91
+ i0.ɵɵadvance();
92
+ i0.ɵɵtextInterpolate2("", resp_r6.statusCode, " ", resp_r6.statusText ?? "");
93
+ i0.ɵɵadvance();
94
+ i0.ɵɵconditional(resp_r6.durationMs !== undefined ? 4 : -1);
95
+ i0.ɵɵadvance();
96
+ i0.ɵɵstyleMap(ctx_r2.preStyle());
97
+ i0.ɵɵclassMap(ctx_r2.preClasses());
98
+ i0.ɵɵadvance();
99
+ i0.ɵɵconditional(resp_r6.body !== "" ? 6 : -1);
100
+ } }
101
+ /** The method options, in React's order. */
102
+ const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'];
103
+ /**
104
+ * Returns the semantic tone representing the severity of an HTTP status code:
105
+ * the theme's success green below 300, info blue for a redirect, warning amber
106
+ * for a client error, error red for a server error.
107
+ *
108
+ * @param code - The response status code.
109
+ * @returns The badge's semantic tone.
110
+ */
111
+ const statusTone = (code) => {
112
+ if (code < 300)
113
+ return 'success';
114
+ if (code < 400)
115
+ return 'info';
116
+ if (code < 500)
117
+ return 'warning';
118
+ return 'error';
119
+ };
120
+ /**
121
+ * HttpInspector component.
122
+ *
123
+ * Controlled HTTP request builder + response panel. The host IS the outer
124
+ * `<div>` React renders (`div[mol-http-inspector]`), with the same classes.
125
+ * App owns request state + the actual `fetch`; this component renders the UI:
126
+ * method + URL row, headers key/value editor, body textarea (methods that
127
+ * allow a body), Send button, then a response panel showing status + timing +
128
+ * body.
129
+ */
130
+ export class HttpInspector {
131
+ /** The request's HTTP method. */
132
+ method = 'GET';
133
+ /** Called with the new method when the user picks one (React's `onMethodChange`). */
134
+ onMethodChange;
135
+ /** The request URL. */
136
+ url = '';
137
+ /** Called with the new URL as the user types (React's `onUrlChange`). */
138
+ onUrlChange;
139
+ /** The request headers, in render order. */
140
+ headers = [];
141
+ /** Called with the next header list on any header edit (React's `onHeadersChange`). */
142
+ onHeadersChange;
143
+ /** The request body. */
144
+ body = '';
145
+ /** Called with the new body as the user types (React's `onBodyChange`). */
146
+ onBodyChange;
147
+ /** Sends the request (React's `onSend`). */
148
+ onSend;
149
+ /** Whether a send is in flight (React's `sending`). */
150
+ sending;
151
+ /** The last response to show (React's `response`). */
152
+ response;
153
+ /** Extra classes on the outer wrapper (React's `className`). */
154
+ className;
155
+ /** The method options, in React's order. */
156
+ methodOptions = METHODS.map((method) => ({ value: method, label: method }));
157
+ /** The body textarea's placeholder (React's literal). */
158
+ bodyPlaceholder = '{"key": "value"}';
159
+ /**
160
+ * Reactive translation, read in the injection context. Its `t` reads the
161
+ * locale, so the view re-renders the labels on a locale switch (the static
162
+ * `t` does not).
163
+ */
164
+ i18n = useTranslation();
165
+ /**
166
+ * The current class map.
167
+ * @returns The UIClassMap.
168
+ */
169
+ cm() {
170
+ return getClassMap();
171
+ }
172
+ /**
173
+ * The wrapper class list (React's `cm.cn(cm.stack(3), className)`).
174
+ * @returns The class string.
175
+ */
176
+ classes() {
177
+ return this.cm().cn(this.cm().stack(3), this.className);
178
+ }
179
+ /**
180
+ * The method + URL row's class (React's `cm.flex({ align: 'center', gap: 'sm' })`).
181
+ * @returns The class string.
182
+ */
183
+ rowClasses() {
184
+ return this.cm().flex({ align: 'center', gap: 'sm' });
185
+ }
186
+ /**
187
+ * A header row's class (React's `cm.flex({ align: 'center', gap: 'xs' })`).
188
+ * @returns The class string.
189
+ */
190
+ headerRowClasses() {
191
+ return this.cm().flex({ align: 'center', gap: 'xs' });
192
+ }
193
+ /**
194
+ * The headers / body section's class (React's `cm.stack(1)`).
195
+ * @returns The class string.
196
+ */
197
+ stack1Classes() {
198
+ return this.cm().stack(1);
199
+ }
200
+ /**
201
+ * The response section's class (React's `cm.stack(2)`).
202
+ * @returns The class string.
203
+ */
204
+ stack2Classes() {
205
+ return this.cm().stack(2);
206
+ }
207
+ /**
208
+ * A section label's class (React's `cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'))`).
209
+ * @returns The class string.
210
+ */
211
+ labelClasses() {
212
+ return this.cm().cn(this.cm().textSize('xs'), this.cm().fontWeight('semibold'));
213
+ }
214
+ /**
215
+ * The timing span's class (React's `cm.textSize('xs')`).
216
+ * @returns The class string.
217
+ */
218
+ textXsClasses() {
219
+ return this.cm().textSize('xs');
220
+ }
221
+ /**
222
+ * The response body panel's class (React's `cm.cn(cm.sp('p', 3), cm.textSize('xs'))`).
223
+ * @returns The class string.
224
+ */
225
+ preClasses() {
226
+ return this.cm().cn(this.cm().sp('p', 3), this.cm().textSize('xs'));
227
+ }
228
+ /**
229
+ * The URL input's extra class (React's `cm.flex1`).
230
+ * @returns The class string.
231
+ */
232
+ flexClasses() {
233
+ return this.cm().flex1;
234
+ }
235
+ /**
236
+ * The status badge's class list (React's `cm.bgTone(tone)` + `cm.textOnTone`).
237
+ *
238
+ * @param code - The response status code.
239
+ * @returns The class string.
240
+ */
241
+ statusClasses(code) {
242
+ return this.cm().cn(this.cm().bgTone(statusTone(code)), this.cm().textOnTone);
243
+ }
244
+ /**
245
+ * The status badge's inline style (React's padding, radius and weight; the
246
+ * tone colours come from {@link statusClasses}).
247
+ *
248
+ * @returns The style map.
249
+ */
250
+ statusStyle() {
251
+ return {
252
+ padding: '2px 8px',
253
+ 'border-radius': '4px',
254
+ 'font-weight': '700',
255
+ };
256
+ }
257
+ /**
258
+ * The response body panel's inline style (horizontal scrolling).
259
+ * @returns The style map.
260
+ */
261
+ preStyle() {
262
+ return { 'overflow-x': 'auto' };
263
+ }
264
+ /**
265
+ * Whether the body editor renders (React hides it for GET and HEAD).
266
+ * @returns True when the method allows a body.
267
+ */
268
+ showBody() {
269
+ return this.method !== 'GET' && this.method !== 'HEAD';
270
+ }
271
+ /**
272
+ * The Send button's pending label (React's `httpInspector.sending`).
273
+ * @returns The label text.
274
+ */
275
+ sendingText() {
276
+ return this.i18n.t('httpInspector.sending', {}, { defaultValue: 'Sending…' });
277
+ }
278
+ /**
279
+ * The Send button's idle label (React's `httpInspector.send`).
280
+ * @returns The label text.
281
+ */
282
+ sendText() {
283
+ return this.i18n.t('httpInspector.send', {}, { defaultValue: 'Send' });
284
+ }
285
+ /**
286
+ * The headers section's label (React's `httpInspector.headers`).
287
+ * @returns The label text.
288
+ */
289
+ headersLabel() {
290
+ return this.i18n.t('httpInspector.headers', {}, { defaultValue: 'Headers' });
291
+ }
292
+ /**
293
+ * The body section's label (React's `httpInspector.body`).
294
+ * @returns The label text.
295
+ */
296
+ bodyLabel() {
297
+ return this.i18n.t('httpInspector.body', {}, { defaultValue: 'Body' });
298
+ }
299
+ /**
300
+ * The add-header button's label (React's `httpInspector.addHeader`).
301
+ * @returns The label text.
302
+ */
303
+ addHeaderLabel() {
304
+ return this.i18n.t('httpInspector.addHeader', {}, { defaultValue: 'Add header' });
305
+ }
306
+ /**
307
+ * The method select's accessible label (React's `httpInspector.methodLabel`).
308
+ * @returns The label text.
309
+ */
310
+ methodLabel() {
311
+ return this.i18n.t('httpInspector.methodLabel', {}, { defaultValue: 'HTTP method' });
312
+ }
313
+ /**
314
+ * The URL field's accessible label (React's `httpInspector.urlLabel`).
315
+ * @returns The label text.
316
+ */
317
+ urlLabel() {
318
+ return this.i18n.t('httpInspector.urlLabel', {}, { defaultValue: 'URL' });
319
+ }
320
+ /**
321
+ * A header row's key placeholder (React's `httpInspector.headerPlaceholder`).
322
+ * @returns The placeholder text.
323
+ */
324
+ headerPlaceholder() {
325
+ return this.i18n.t('httpInspector.headerPlaceholder', {}, { defaultValue: 'Header' });
326
+ }
327
+ /**
328
+ * A header row's value placeholder (React's `httpInspector.valuePlaceholder`).
329
+ * @returns The placeholder text.
330
+ */
331
+ valuePlaceholder() {
332
+ return this.i18n.t('httpInspector.valuePlaceholder', {}, { defaultValue: 'Value' });
333
+ }
334
+ /**
335
+ * Reports a picked method (React's `onMethodChange`).
336
+ *
337
+ * @param method - The selected option value.
338
+ */
339
+ handleMethodChange(method) {
340
+ this.onMethodChange?.(method);
341
+ }
342
+ /**
343
+ * Adopts the typed URL (React's `onUrlChange`).
344
+ *
345
+ * @param event - The native input event.
346
+ */
347
+ handleUrlChange(event) {
348
+ this.onUrlChange?.(event.target.value);
349
+ }
350
+ /**
351
+ * Updates a single header's key, keeping its value (React's `setHeader`).
352
+ *
353
+ * @param i - The row index.
354
+ * @param event - The native input event.
355
+ */
356
+ handleHeaderKey(i, event) {
357
+ const next = [...this.headers];
358
+ next[i] = { key: event.target.value, value: next[i].value };
359
+ this.onHeadersChange?.(next);
360
+ }
361
+ /**
362
+ * Updates a single header's value, keeping its key (React's `setHeader`).
363
+ *
364
+ * @param i - The row index.
365
+ * @param event - The native input event.
366
+ */
367
+ handleHeaderValue(i, event) {
368
+ const next = [...this.headers];
369
+ next[i] = { key: next[i].key, value: event.target.value };
370
+ this.onHeadersChange?.(next);
371
+ }
372
+ /**
373
+ * Removes one header (React's `headers.filter((_, j) => j !== i)`).
374
+ *
375
+ * @param i - The row index.
376
+ */
377
+ removeHeader(i) {
378
+ this.onHeadersChange?.(this.headers.filter((_, j) => j !== i));
379
+ }
380
+ /**
381
+ * Appends an empty header (React's `[...headers, { key: '', value: '' }]`).
382
+ */
383
+ addHeader() {
384
+ this.onHeadersChange?.([...this.headers, { key: '', value: '' }]);
385
+ }
386
+ /**
387
+ * Adopts the typed body (React's `onBodyChange`).
388
+ *
389
+ * @param event - The native input event.
390
+ */
391
+ handleBodyChange(event) {
392
+ this.onBodyChange?.(event.target.value);
393
+ }
394
+ /**
395
+ * Calls the app's send handler (React's `void onSend()`).
396
+ */
397
+ send() {
398
+ void this.onSend?.();
399
+ }
400
+ static ɵfac = function HttpInspector_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || HttpInspector)(); };
401
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: HttpInspector, selectors: [["div", "mol-http-inspector", ""]], hostVars: 2, hostBindings: function HttpInspector_HostBindings(rf, ctx) { if (rf & 2) {
402
+ i0.ɵɵclassMap(ctx.classes());
403
+ } }, inputs: { method: "method", onMethodChange: "onMethodChange", url: "url", onUrlChange: "onUrlChange", headers: "headers", onHeadersChange: "onHeadersChange", body: "body", onBodyChange: "onBodyChange", onSend: "onSend", sending: "sending", response: "response", className: "className" }, decls: 14, vars: 25, consts: [["mol-select", "", "translate", "no", 3, "valueChange", "id", "options", "value"], ["mol-input", "", "placeholder", "https://api.example.com/v1/resources", "translate", "no", 3, "change", "id", "type", "value", "className"], ["mol-button", "", 3, "click", "variant", "color", "disabled"], [3, "class"], ["mol-button", "", 3, "click", "variant", "size"], ["mol-input", "", 3, "change", "id", "type", "value", "placeholder"], ["mol-input", "", 3, "change", "id", "type", "value", "placeholder", "className"], ["mol-textarea", "", "translate", "no", 3, "change", "id", "value", "rows", "placeholder"]], template: function HttpInspector_Template(rf, ctx) { if (rf & 1) {
404
+ i0.ɵɵelementStart(0, "div")(1, "div", 0);
405
+ i0.ɵɵlistener("valueChange", function HttpInspector_Template_div_valueChange_1_listener($event) { return ctx.handleMethodChange($event); });
406
+ i0.ɵɵelementEnd();
407
+ i0.ɵɵelementStart(2, "div", 1);
408
+ i0.ɵɵlistener("change", function HttpInspector_Template_div_change_2_listener($event) { return ctx.handleUrlChange($event); });
409
+ i0.ɵɵelementEnd();
410
+ i0.ɵɵelementStart(3, "button", 2);
411
+ i0.ɵɵlistener("click", function HttpInspector_Template_button_click_3_listener() { return ctx.send(); });
412
+ i0.ɵɵtext(4);
413
+ i0.ɵɵelementEnd()();
414
+ i0.ɵɵelementStart(5, "div")(6, "span");
415
+ i0.ɵɵtext(7);
416
+ i0.ɵɵelementEnd();
417
+ i0.ɵɵrepeaterCreate(8, HttpInspector_For_9_Template, 5, 13, "div", 3, i0.ɵɵrepeaterTrackByIndex);
418
+ i0.ɵɵelementStart(10, "button", 4);
419
+ i0.ɵɵlistener("click", function HttpInspector_Template_button_click_10_listener() { return ctx.addHeader(); });
420
+ i0.ɵɵtext(11);
421
+ i0.ɵɵelementEnd()();
422
+ i0.ɵɵconditionalCreate(12, HttpInspector_Conditional_12_Template, 4, 9, "div", 3);
423
+ i0.ɵɵconditionalCreate(13, HttpInspector_Conditional_13_Template, 7, 16, "div", 3);
424
+ } if (rf & 2) {
425
+ let tmp_22_0;
426
+ i0.ɵɵclassMap(ctx.rowClasses());
427
+ i0.ɵɵadvance();
428
+ i0.ɵɵproperty("id", "http-inspector-method")("options", ctx.methodOptions)("value", ctx.method);
429
+ i0.ɵɵattribute("aria-label", ctx.methodLabel());
430
+ i0.ɵɵadvance();
431
+ i0.ɵɵproperty("id", "http-inspector-url")("type", "text")("value", ctx.url)("className", ctx.flexClasses());
432
+ i0.ɵɵattribute("aria-label", ctx.urlLabel());
433
+ i0.ɵɵadvance();
434
+ i0.ɵɵproperty("variant", "solid")("color", "primary")("disabled", !!ctx.sending);
435
+ i0.ɵɵadvance();
436
+ i0.ɵɵtextInterpolate(ctx.sending ? ctx.sendingText() : ctx.sendText());
437
+ i0.ɵɵadvance();
438
+ i0.ɵɵclassMap(ctx.stack1Classes());
439
+ i0.ɵɵadvance();
440
+ i0.ɵɵclassMap(ctx.labelClasses());
441
+ i0.ɵɵadvance();
442
+ i0.ɵɵtextInterpolate(ctx.headersLabel());
443
+ i0.ɵɵadvance();
444
+ i0.ɵɵrepeater(ctx.headers);
445
+ i0.ɵɵadvance(2);
446
+ i0.ɵɵproperty("variant", "ghost")("size", "sm");
447
+ i0.ɵɵadvance();
448
+ i0.ɵɵtextInterpolate1("+ ", ctx.addHeaderLabel());
449
+ i0.ɵɵadvance();
450
+ i0.ɵɵconditional(ctx.showBody() ? 12 : -1);
451
+ i0.ɵɵadvance();
452
+ i0.ɵɵconditional((tmp_22_0 = ctx.response) ? 13 : -1, tmp_22_0);
453
+ } }, dependencies: [Button, Input, Select, Textarea], encapsulation: 2 });
454
+ }
455
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(HttpInspector, [{
456
+ type: Component,
457
+ args: [{
458
+ selector: 'div[mol-http-inspector]',
459
+ standalone: true,
460
+ imports: [Button, Input, Select, Textarea],
461
+ inputs: [
462
+ 'method',
463
+ 'onMethodChange',
464
+ 'url',
465
+ 'onUrlChange',
466
+ 'headers',
467
+ 'onHeadersChange',
468
+ 'body',
469
+ 'onBodyChange',
470
+ 'onSend',
471
+ 'sending',
472
+ 'response',
473
+ 'className',
474
+ ],
475
+ host: {
476
+ '[class]': 'classes()',
477
+ },
478
+ // prettier-ignore
479
+ template: `<div [class]="rowClasses()"
480
+ ><!-- The options are protocol tokens (GET, POST, …): never translated, so the element carries HTML's own translate="no" attribute. --><div
481
+ mol-select
482
+ [id]="'http-inspector-method'"
483
+ [options]="methodOptions"
484
+ [value]="method"
485
+ (valueChange)="handleMethodChange($event)"
486
+ translate="no"
487
+ [attr.aria-label]="methodLabel()"
488
+ ></div
489
+ ><!-- The placeholder is an example URL — input, not prose: never translated. --><div
490
+ mol-input
491
+ [id]="'http-inspector-url'"
492
+ [type]="'text'"
493
+ [value]="url"
494
+ (change)="handleUrlChange($event)"
495
+ placeholder="https://api.example.com/v1/resources"
496
+ translate="no"
497
+ [className]="flexClasses()"
498
+ [attr.aria-label]="urlLabel()"
499
+ ></div
500
+ ><button
501
+ mol-button
502
+ [variant]="'solid'"
503
+ [color]="'primary'"
504
+ (click)="send()"
505
+ [disabled]="!!sending"
506
+ >{{ sending ? sendingText() : sendText() }}</button
507
+ ></div>
508
+ <div [class]="stack1Classes()"><span [class]="labelClasses()">{{ headersLabel() }}</span>
509
+ @for (header of headers; track $index) {
510
+ <div [class]="headerRowClasses()"
511
+ ><div
512
+ mol-input
513
+ [id]="'http-inspector-header-' + $index + '-key'"
514
+ [type]="'text'"
515
+ [value]="header.key"
516
+ (change)="handleHeaderKey($index, $event)"
517
+ [placeholder]="headerPlaceholder()"
518
+ ></div
519
+ ><div
520
+ mol-input
521
+ [id]="'http-inspector-header-' + $index + '-value'"
522
+ [type]="'text'"
523
+ [value]="header.value"
524
+ (change)="handleHeaderValue($index, $event)"
525
+ [placeholder]="valuePlaceholder()"
526
+ [className]="flexClasses()"
527
+ ></div
528
+ ><button mol-button [variant]="'ghost'" [size]="'sm'" (click)="removeHeader($index)">×</button
529
+ ></div>
530
+ }
531
+ <button mol-button [variant]="'ghost'" [size]="'sm'" (click)="addHeader()">+ {{ addHeaderLabel() }}</button>
532
+ </div>
533
+ @if (showBody()) {
534
+ <div [class]="stack1Classes()"><span [class]="labelClasses()">{{ bodyLabel() }}</span><!-- The placeholder is a JSON example — input, not prose: never translated. --><div
535
+ mol-textarea
536
+ [id]="'http-inspector-body'"
537
+ [value]="body"
538
+ (change)="handleBodyChange($event)"
539
+ [rows]="6"
540
+ [placeholder]="bodyPlaceholder"
541
+ translate="no"
542
+ ></div></div>
543
+ }
544
+ @if (response; as resp) {
545
+ <div [class]="stack2Classes()">
546
+ <div [class]="rowClasses()"
547
+ ><span [class]="statusClasses(resp.statusCode)" [style]="statusStyle()">{{ resp.statusCode }} {{ resp.statusText ?? '' }}</span
548
+ >@if (resp.durationMs !== undefined) {<span [class]="textXsClasses()">{{ resp.durationMs }}ms</span>}</div
549
+ ><pre [class]="preClasses()" [style]="preStyle()">@if (resp.body !== '') {<ng-container>{{ resp.body }}</ng-container>}</pre>
550
+ </div>
551
+ }`,
552
+ }]
553
+ }], null, null); })();
554
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(HttpInspector, { className: "HttpInspector", filePath: "http-inspector.component.ts", lineNumber: 140 }); })();
555
+ //# sourceMappingURL=http-inspector.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-inspector.component.js","sourceRoot":"","sources":["../src/http-inspector.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EA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,SAAS,EAAE,WAAW;iBACvB;gBACD,kBAAkB;gBAClB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwER;aACH;;kFACY,aAAa"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Angular HTTP request builder + response inspector — the counterpart of
3
+ * `@molecule/app-http-inspector-react`: the same props and the same DOM for the
4
+ * same input.
5
+ *
6
+ * Exports `<HttpInspector>`, `HttpMethod`, `HttpHeader`, `HttpResponse` types.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { Component, signal } from '@angular/core'
11
+ * import { HttpInspector } from '@molecule/app-http-inspector-angular'
12
+ * import type { HttpHeader, HttpMethod, HttpResponse } from '@molecule/app-http-inspector-angular'
13
+ *
14
+ * @Component({
15
+ * selector: 'app-inspector',
16
+ * standalone: true,
17
+ * imports: [HttpInspector],
18
+ * template: `
19
+ * <div
20
+ * mol-http-inspector
21
+ * [method]="method()"
22
+ * (onMethodChange)="method.set($event)"
23
+ * [url]="url()"
24
+ * (onUrlChange)="url.set($event)"
25
+ * [headers]="headers()"
26
+ * (onHeadersChange)="headers.set($event)"
27
+ * [body]="body()"
28
+ * (onBodyChange)="body.set($event)"
29
+ * [onSend]="send"
30
+ * [sending]="sending()"
31
+ * [response]="response()"
32
+ * ></div>
33
+ * `,
34
+ * })
35
+ * export class Inspector {
36
+ * readonly method = signal<HttpMethod>('GET')
37
+ * readonly url = signal('https://api.example.com/v1/users')
38
+ * readonly headers = signal<HttpHeader[]>([])
39
+ * readonly body = signal('')
40
+ * readonly sending = signal(false)
41
+ * readonly response = signal<HttpResponse | null>(null)
42
+ *
43
+ * async send() {
44
+ * this.sending.set(true)
45
+ * try {
46
+ * // YOUR fetch here; then this.response.set(...)
47
+ * } finally {
48
+ * this.sending.set(false)
49
+ * }
50
+ * }
51
+ * }
52
+ * ```
53
+ *
54
+ * @remarks
55
+ * - Fully controlled and transport-agnostic: the component renders the
56
+ * builder UI only — YOUR `onSend` performs the fetch and sets `response`
57
+ * (`HttpResponse` with statusCode/durationMs/body). `sending` disables the
58
+ * Send button.
59
+ * - Requires the Angular binding's i18n provider (`useTranslation()` THROWS
60
+ * without it) and a bonded ClassMap; button/tab labels come from the
61
+ * `@molecule/app-locales-http-inspector` companion bond.
62
+ * - The body editor renders only for methods with bodies (hidden for GET and
63
+ * HEAD).
64
+ * - The response status chip uses fixed severity colors (green/blue/
65
+ * yellow/red) rendered inline — they do not follow the app theme.
66
+ *
67
+ * @module
68
+ */
69
+ export * from './http-inspector.component.js';
70
+ export * from './types.js';
71
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Angular HTTP request builder + response inspector — the counterpart of
3
+ * `@molecule/app-http-inspector-react`: the same props and the same DOM for the
4
+ * same input.
5
+ *
6
+ * Exports `<HttpInspector>`, `HttpMethod`, `HttpHeader`, `HttpResponse` types.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { Component, signal } from '@angular/core'
11
+ * import { HttpInspector } from '@molecule/app-http-inspector-angular'
12
+ * import type { HttpHeader, HttpMethod, HttpResponse } from '@molecule/app-http-inspector-angular'
13
+ *
14
+ * @Component({
15
+ * selector: 'app-inspector',
16
+ * standalone: true,
17
+ * imports: [HttpInspector],
18
+ * template: `
19
+ * <div
20
+ * mol-http-inspector
21
+ * [method]="method()"
22
+ * (onMethodChange)="method.set($event)"
23
+ * [url]="url()"
24
+ * (onUrlChange)="url.set($event)"
25
+ * [headers]="headers()"
26
+ * (onHeadersChange)="headers.set($event)"
27
+ * [body]="body()"
28
+ * (onBodyChange)="body.set($event)"
29
+ * [onSend]="send"
30
+ * [sending]="sending()"
31
+ * [response]="response()"
32
+ * ></div>
33
+ * `,
34
+ * })
35
+ * export class Inspector {
36
+ * readonly method = signal<HttpMethod>('GET')
37
+ * readonly url = signal('https://api.example.com/v1/users')
38
+ * readonly headers = signal<HttpHeader[]>([])
39
+ * readonly body = signal('')
40
+ * readonly sending = signal(false)
41
+ * readonly response = signal<HttpResponse | null>(null)
42
+ *
43
+ * async send() {
44
+ * this.sending.set(true)
45
+ * try {
46
+ * // YOUR fetch here; then this.response.set(...)
47
+ * } finally {
48
+ * this.sending.set(false)
49
+ * }
50
+ * }
51
+ * }
52
+ * ```
53
+ *
54
+ * @remarks
55
+ * - Fully controlled and transport-agnostic: the component renders the
56
+ * builder UI only — YOUR `onSend` performs the fetch and sets `response`
57
+ * (`HttpResponse` with statusCode/durationMs/body). `sending` disables the
58
+ * Send button.
59
+ * - Requires the Angular binding's i18n provider (`useTranslation()` THROWS
60
+ * without it) and a bonded ClassMap; button/tab labels come from the
61
+ * `@molecule/app-locales-http-inspector` companion bond.
62
+ * - The body editor renders only for methods with bodies (hidden for GET and
63
+ * HEAD).
64
+ * - The response status chip uses fixed severity colors (green/blue/
65
+ * yellow/red) rendered inline — they do not follow the app theme.
66
+ *
67
+ * @module
68
+ */
69
+ export * from './http-inspector.component.js';
70
+ export * from './types.js';
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Types of `@molecule/app-http-inspector-angular` — the Angular counterpart of
3
+ * `@molecule/app-http-inspector-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ /** HTTP method verb for a request. */
8
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
9
+ /** A single HTTP request or response header key/value pair. */
10
+ export interface HttpHeader {
11
+ key: string;
12
+ value: string;
13
+ }
14
+ /** Parsed HTTP response returned after a request completes. */
15
+ export interface HttpResponse {
16
+ statusCode: number;
17
+ statusText?: string;
18
+ durationMs?: number;
19
+ body: string;
20
+ headers?: HttpHeader[];
21
+ }
22
+ /** Inputs accepted by {@link HttpInspector} — the same props `@molecule/app-http-inspector-react` accepts. */
23
+ export interface HttpInspectorProps {
24
+ /** The request's HTTP method. */
25
+ method: HttpMethod;
26
+ /** Called with the new method when the user picks one. */
27
+ onMethodChange: (method: HttpMethod) => void;
28
+ /** The request URL. */
29
+ url: string;
30
+ /** Called with the new URL as the user types. */
31
+ onUrlChange: (url: string) => void;
32
+ /** The request headers, in render order. */
33
+ headers: HttpHeader[];
34
+ /** Called with the next header list on any header edit. */
35
+ onHeadersChange: (headers: HttpHeader[]) => void;
36
+ /** The request body. */
37
+ body: string;
38
+ /** Called with the new body as the user types. */
39
+ onBodyChange: (body: string) => void;
40
+ /** Sends the request; the app owns the fetch and the response state. */
41
+ onSend: () => void | Promise<void>;
42
+ /** Whether a send is in flight (disables the Send button, shows `Sending…`). */
43
+ sending?: boolean;
44
+ /** The last response to show, or `null`/absent for none. */
45
+ response?: HttpResponse | null;
46
+ /** Extra classes on the outer wrapper. */
47
+ className?: string;
48
+ }
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sCAAsC;AACtC,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAEzF,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,8GAA8G;AAC9G,MAAM,WAAW,kBAAkB;IACjC,iCAAiC;IACjC,MAAM,EAAE,UAAU,CAAA;IAClB,0DAA0D;IAC1D,cAAc,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IAC5C,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,iDAAiD;IACjD,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,4CAA4C;IAC5C,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,2DAA2D;IAC3D,eAAe,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IAChD,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,wEAAwE;IACxE,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-http-inspector-angular` — the Angular counterpart of
3
+ * `@molecule/app-http-inspector-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "@molecule/app-http-inspector-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-stage",
4
+ "description": "HTTP method + URL builder + headers/params/body tabs + response status/timing display",
5
+ "homepage": "https://www.molecule.dev/packages/app-http-inspector-angular",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "ngc",
21
+ "dev": "ngc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "http-inspector",
28
+ "angular"
29
+ ],
30
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/molecule-dev/molecule.git",
35
+ "directory": "packages/app/features/http-inspector-angular"
36
+ },
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
40
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@angular/common": "^22.0.0",
46
+ "@angular/core": "^22.0.0",
47
+ "@angular/platform-browser": "^22.0.0",
48
+ "@molecule/app-angular": "^3.5.0",
49
+ "@molecule/app-ui": "^1.4.0",
50
+ "@molecule/app-ui-angular": "^1.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@angular/common": "22.2.3",
54
+ "@angular/compiler": "22.2.3",
55
+ "@angular/compiler-cli": "22.2.3",
56
+ "@angular/core": "22.2.3",
57
+ "@angular/platform-browser": "22.2.3",
58
+ "@molecule/app-angular": "3.7.2",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-ui": "1.4.0",
63
+ "@molecule/app-ui-angular": "1.2.1",
64
+ "@types/node": "26.6.5",
65
+ "jsdom": "30.1.3",
66
+ "rxjs": "7.8.2",
67
+ "typescript": "6.0.3",
68
+ "vitest": "4.1.12",
69
+ "zone.js": "0.16.3"
70
+ }
71
+ }