@lushly-dev/afd-adapters 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +77 -0
- package/css/afd-theme.css +31 -0
- package/dist/css-variables.d.ts +32 -0
- package/dist/css-variables.d.ts.map +1 -0
- package/dist/css-variables.js +38 -0
- package/dist/css-variables.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +87 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -0
- package/dist/web-adapter.d.ts +57 -0
- package/dist/web-adapter.d.ts.map +1 -0
- package/dist/web-adapter.js +232 -0
- package/dist/web-adapter.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lushly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @lushly-dev/afd-adapters
|
|
2
|
+
|
|
3
|
+
Frontend adapters for rendering AFD `CommandResult` data into styled HTML.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @lushly-dev/afd-adapters
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { WebAdapter } from '@lushly-dev/afd-adapters';
|
|
15
|
+
|
|
16
|
+
// Render package results from lint/test/build commands
|
|
17
|
+
const result = await fetch('/api/execute', { command: 'lint' });
|
|
18
|
+
const html = WebAdapter.renderPackageResults(result.data);
|
|
19
|
+
container.innerHTML = html;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## CSS Variables
|
|
23
|
+
|
|
24
|
+
The adapters use CSS custom properties for theming. Include the default theme or define your own:
|
|
25
|
+
|
|
26
|
+
```css
|
|
27
|
+
/* Option 1: Use the default theme */
|
|
28
|
+
@import '@lushly-dev/afd-adapters/css';
|
|
29
|
+
|
|
30
|
+
/* Option 2: Define your own */
|
|
31
|
+
:root {
|
|
32
|
+
--afd-success: #22c55e;
|
|
33
|
+
--afd-error: #ef4444;
|
|
34
|
+
--afd-warning: #f59e0b;
|
|
35
|
+
--afd-info: #3b82f6;
|
|
36
|
+
--afd-muted: #6b7280;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Violet Integration
|
|
41
|
+
|
|
42
|
+
Map AFD variables to Violet design tokens:
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
:root {
|
|
46
|
+
--afd-success: var(--violet-color-semantic-success);
|
|
47
|
+
--afd-error: var(--violet-color-semantic-error);
|
|
48
|
+
--afd-warning: var(--violet-color-semantic-warning);
|
|
49
|
+
--afd-info: var(--violet-color-semantic-info);
|
|
50
|
+
--afd-muted: var(--violet-color-text-muted);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
### WebAdapter
|
|
57
|
+
|
|
58
|
+
| Method | Description |
|
|
59
|
+
|--------|-------------|
|
|
60
|
+
| `renderPackageResults(data, options?)` | Render lint/test/build results |
|
|
61
|
+
| `renderError(message)` | Render error message |
|
|
62
|
+
| `renderSuccess(message)` | Render success message |
|
|
63
|
+
| `renderWarning(message)` | Render warning message |
|
|
64
|
+
| `renderResult(result)` | Auto-detect and render CommandResult |
|
|
65
|
+
|
|
66
|
+
### Options
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
interface RenderOptions {
|
|
70
|
+
showFailureOutput?: boolean; // Show stderr for failed packages (default: true)
|
|
71
|
+
maxOutputLength?: number; // Truncate long output
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AFD Adapters - Default Theme
|
|
3
|
+
*
|
|
4
|
+
* These CSS custom properties control the styling of rendered output.
|
|
5
|
+
* Override them in your stylesheet to match your design system.
|
|
6
|
+
*
|
|
7
|
+
* For Violet integration, map these to Violet tokens:
|
|
8
|
+
* --afd-success: var(--violet-color-semantic-success);
|
|
9
|
+
* --afd-error: var(--violet-color-semantic-error);
|
|
10
|
+
* etc.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
/* Success/Pass - green */
|
|
15
|
+
--afd-success: #22c55e;
|
|
16
|
+
|
|
17
|
+
/* Error/Fail - red */
|
|
18
|
+
--afd-error: #ef4444;
|
|
19
|
+
|
|
20
|
+
/* Warning - yellow/amber */
|
|
21
|
+
--afd-warning: #f59e0b;
|
|
22
|
+
|
|
23
|
+
/* Info/Names - blue */
|
|
24
|
+
--afd-info: #3b82f6;
|
|
25
|
+
|
|
26
|
+
/* Muted/Secondary - gray */
|
|
27
|
+
--afd-muted: #6b7280;
|
|
28
|
+
|
|
29
|
+
/* Default text - inherits from parent */
|
|
30
|
+
--afd-text: inherit;
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS variable constants and status type mappings.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Status types for semantic styling.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StatusType: {
|
|
8
|
+
readonly SUCCESS: "success";
|
|
9
|
+
readonly FAILURE: "failure";
|
|
10
|
+
readonly WARNING: "warning";
|
|
11
|
+
readonly INFO: "info";
|
|
12
|
+
readonly MUTED: "muted";
|
|
13
|
+
readonly NEUTRAL: "neutral";
|
|
14
|
+
};
|
|
15
|
+
export type StatusTypeValue = (typeof StatusType)[keyof typeof StatusType];
|
|
16
|
+
/**
|
|
17
|
+
* CSS variable names for theming.
|
|
18
|
+
* These should be defined in your stylesheet.
|
|
19
|
+
*/
|
|
20
|
+
export declare const AFD_CSS_VARIABLES: {
|
|
21
|
+
readonly success: "--afd-success";
|
|
22
|
+
readonly error: "--afd-error";
|
|
23
|
+
readonly warning: "--afd-warning";
|
|
24
|
+
readonly info: "--afd-info";
|
|
25
|
+
readonly muted: "--afd-muted";
|
|
26
|
+
readonly text: "--afd-text";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* CSS variable mappings with fallback colors.
|
|
30
|
+
*/
|
|
31
|
+
export declare const STATUS_COLORS: Record<StatusTypeValue, string>;
|
|
32
|
+
//# sourceMappingURL=css-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-variables.d.ts","sourceRoot":"","sources":["../src/css-variables.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;CAOpB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAOzD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS variable constants and status type mappings.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Status types for semantic styling.
|
|
6
|
+
*/
|
|
7
|
+
export const StatusType = {
|
|
8
|
+
SUCCESS: 'success',
|
|
9
|
+
FAILURE: 'failure',
|
|
10
|
+
WARNING: 'warning',
|
|
11
|
+
INFO: 'info',
|
|
12
|
+
MUTED: 'muted',
|
|
13
|
+
NEUTRAL: 'neutral',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* CSS variable names for theming.
|
|
17
|
+
* These should be defined in your stylesheet.
|
|
18
|
+
*/
|
|
19
|
+
export const AFD_CSS_VARIABLES = {
|
|
20
|
+
success: '--afd-success',
|
|
21
|
+
error: '--afd-error',
|
|
22
|
+
warning: '--afd-warning',
|
|
23
|
+
info: '--afd-info',
|
|
24
|
+
muted: '--afd-muted',
|
|
25
|
+
text: '--afd-text',
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* CSS variable mappings with fallback colors.
|
|
29
|
+
*/
|
|
30
|
+
export const STATUS_COLORS = {
|
|
31
|
+
[StatusType.SUCCESS]: 'var(--afd-success, #22c55e)',
|
|
32
|
+
[StatusType.FAILURE]: 'var(--afd-error, #ef4444)',
|
|
33
|
+
[StatusType.WARNING]: 'var(--afd-warning, #f59e0b)',
|
|
34
|
+
[StatusType.INFO]: 'var(--afd-info, #3b82f6)',
|
|
35
|
+
[StatusType.MUTED]: 'var(--afd-muted, #6b7280)',
|
|
36
|
+
[StatusType.NEUTRAL]: 'inherit',
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=css-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-variables.js","sourceRoot":"","sources":["../src/css-variables.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACT,CAAC;AAIX;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,aAAa;IACpB,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,YAAY;CACT,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAoC;IAC7D,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,6BAA6B;IACnD,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,2BAA2B;IACjD,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,6BAA6B;IACnD,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,0BAA0B;IAC7C,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,2BAA2B;IAC/C,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS;CAC/B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @afd/adapters - Frontend adapters for rendering CommandResult to styled HTML.
|
|
3
|
+
*
|
|
4
|
+
* Uses CSS custom properties for theming. Set these in your stylesheet:
|
|
5
|
+
* --afd-success, --afd-error, --afd-warning, --afd-info, --afd-muted
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { WebAdapter } from '@afd/adapters';
|
|
10
|
+
*
|
|
11
|
+
* const result = await fetch('/api/execute', { command: 'lint' });
|
|
12
|
+
* const html = WebAdapter.renderPackageResults(result.data);
|
|
13
|
+
* container.innerHTML = html;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export { AFD_CSS_VARIABLES, STATUS_COLORS, StatusType } from './css-variables.js';
|
|
17
|
+
export type { CommandErrorInput, CommandResultInput, PackageResult, PackageResults, PipelineStepInput, RenderOptions, WarningInput, } from './types.js';
|
|
18
|
+
export { escapeHtml, styledSpan } from './utils.js';
|
|
19
|
+
export { WebAdapter } from './web-adapter.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAClF,YAAY,EACX,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,YAAY,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @afd/adapters - Frontend adapters for rendering CommandResult to styled HTML.
|
|
3
|
+
*
|
|
4
|
+
* Uses CSS custom properties for theming. Set these in your stylesheet:
|
|
5
|
+
* --afd-success, --afd-error, --afd-warning, --afd-info, --afd-muted
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { WebAdapter } from '@afd/adapters';
|
|
10
|
+
*
|
|
11
|
+
* const result = await fetch('/api/execute', { command: 'lint' });
|
|
12
|
+
* const html = WebAdapter.renderPackageResults(result.data);
|
|
13
|
+
* container.innerHTML = html;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export { AFD_CSS_VARIABLES, STATUS_COLORS, StatusType } from './css-variables.js';
|
|
17
|
+
export { escapeHtml, styledSpan } from './utils.js';
|
|
18
|
+
export { WebAdapter } from './web-adapter.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUlF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for AFD adapters.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Result for a single package (lint/test/build).
|
|
6
|
+
*/
|
|
7
|
+
export interface PackageResult {
|
|
8
|
+
name: string;
|
|
9
|
+
passed: boolean;
|
|
10
|
+
stdout?: string;
|
|
11
|
+
stderr?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Aggregated results for multiple packages.
|
|
15
|
+
*/
|
|
16
|
+
export interface PackageResults {
|
|
17
|
+
packages: PackageResult[];
|
|
18
|
+
total: number;
|
|
19
|
+
passed: number;
|
|
20
|
+
failed: number;
|
|
21
|
+
success: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options for rendering.
|
|
25
|
+
*/
|
|
26
|
+
export interface RenderOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Whether to show output for failed packages.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
showFailureOutput?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum length of output to display per package.
|
|
34
|
+
* @default undefined (no limit)
|
|
35
|
+
*/
|
|
36
|
+
maxOutputLength?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A CommandError with optional suggestion for recovery.
|
|
40
|
+
*/
|
|
41
|
+
export interface CommandErrorInput {
|
|
42
|
+
code: string;
|
|
43
|
+
message: string;
|
|
44
|
+
suggestion?: string;
|
|
45
|
+
details?: unknown;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A warning from a command result.
|
|
49
|
+
*/
|
|
50
|
+
export interface WarningInput {
|
|
51
|
+
code?: string;
|
|
52
|
+
message: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A pipeline step result for rendering progress.
|
|
56
|
+
*/
|
|
57
|
+
export interface PipelineStepInput {
|
|
58
|
+
index: number;
|
|
59
|
+
command: string;
|
|
60
|
+
alias?: string;
|
|
61
|
+
status: 'success' | 'failure' | 'skipped';
|
|
62
|
+
executionTimeMs?: number;
|
|
63
|
+
error?: {
|
|
64
|
+
code?: string;
|
|
65
|
+
message?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Full CommandResult shape for the adapter to render.
|
|
70
|
+
*/
|
|
71
|
+
export interface CommandResultInput {
|
|
72
|
+
success: boolean;
|
|
73
|
+
data?: unknown;
|
|
74
|
+
error?: CommandErrorInput;
|
|
75
|
+
confidence?: number;
|
|
76
|
+
reasoning?: string;
|
|
77
|
+
warnings?: WarningInput[];
|
|
78
|
+
sources?: Array<{
|
|
79
|
+
label: string;
|
|
80
|
+
url?: string;
|
|
81
|
+
}>;
|
|
82
|
+
alternatives?: Array<{
|
|
83
|
+
command: string;
|
|
84
|
+
description: string;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC1C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/D"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for adapters.
|
|
3
|
+
*/
|
|
4
|
+
import { type StatusTypeValue } from './css-variables.js';
|
|
5
|
+
/**
|
|
6
|
+
* Escape HTML special characters (fast regex version, no DOM).
|
|
7
|
+
*/
|
|
8
|
+
export declare function escapeHtml(text: unknown): string;
|
|
9
|
+
/**
|
|
10
|
+
* Create a styled span using CSS variables.
|
|
11
|
+
*/
|
|
12
|
+
export declare function styledSpan(text: string, status?: StatusTypeValue, bold?: boolean): string;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErF;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAOhD;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,eAAoC,EAC5C,IAAI,UAAQ,GACV,MAAM,CAMR"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for adapters.
|
|
3
|
+
*/
|
|
4
|
+
import { STATUS_COLORS, StatusType } from './css-variables.js';
|
|
5
|
+
/**
|
|
6
|
+
* Escape HTML special characters (fast regex version, no DOM).
|
|
7
|
+
*/
|
|
8
|
+
export function escapeHtml(text) {
|
|
9
|
+
if (typeof text !== 'string')
|
|
10
|
+
return String(text);
|
|
11
|
+
return text
|
|
12
|
+
.replace(/&/g, '&')
|
|
13
|
+
.replace(/</g, '<')
|
|
14
|
+
.replace(/>/g, '>')
|
|
15
|
+
.replace(/"/g, '"');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a styled span using CSS variables.
|
|
19
|
+
*/
|
|
20
|
+
export function styledSpan(text, status = StatusType.NEUTRAL, bold = false) {
|
|
21
|
+
const color = STATUS_COLORS[status] || 'inherit';
|
|
22
|
+
const fontWeight = bold ? 'font-weight: bold;' : '';
|
|
23
|
+
const style = `color: ${color}; ${fontWeight}`.trim();
|
|
24
|
+
return `<span style="${style}">${escapeHtml(text)}</span>`;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAwB,MAAM,oBAAoB,CAAC;AAErF;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAa;IACvC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,IAAI;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CACzB,IAAY,EACZ,SAA0B,UAAU,CAAC,OAAO,EAC5C,IAAI,GAAG,KAAK;IAEZ,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;IACjD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,MAAM,KAAK,GAAG,UAAU,KAAK,KAAK,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC;IAEtD,OAAO,gBAAgB,KAAK,KAAK,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebAdapter - Renders CommandResult to HTML with CSS variable theming.
|
|
3
|
+
*/
|
|
4
|
+
import type { CommandErrorInput, CommandResultInput, PackageResults, PipelineStepInput, RenderOptions, WarningInput } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* WebAdapter transforms AFD CommandResult data into styled HTML.
|
|
7
|
+
*
|
|
8
|
+
* Uses CSS custom properties for theming:
|
|
9
|
+
* --afd-success, --afd-error, --afd-warning, --afd-info, --afd-muted
|
|
10
|
+
*/
|
|
11
|
+
export declare const WebAdapter: {
|
|
12
|
+
/**
|
|
13
|
+
* Render package results (lint/test/build) as HTML.
|
|
14
|
+
*/
|
|
15
|
+
renderPackageResults(data: PackageResults, options?: RenderOptions): string;
|
|
16
|
+
/**
|
|
17
|
+
* Render an error message.
|
|
18
|
+
*/
|
|
19
|
+
renderError(message: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Render a success message.
|
|
22
|
+
*/
|
|
23
|
+
renderSuccess(message: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Render a warning message.
|
|
26
|
+
*/
|
|
27
|
+
renderWarning(message: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Render a generic result with auto-detection.
|
|
30
|
+
*/
|
|
31
|
+
renderResult(result: {
|
|
32
|
+
success: boolean;
|
|
33
|
+
data?: unknown;
|
|
34
|
+
error?: unknown;
|
|
35
|
+
}): string;
|
|
36
|
+
/**
|
|
37
|
+
* Render a CommandError with code, message, and optional suggestion.
|
|
38
|
+
*/
|
|
39
|
+
renderCommandError(error: CommandErrorInput): string;
|
|
40
|
+
/**
|
|
41
|
+
* Render a confidence indicator (0-1 scale).
|
|
42
|
+
*/
|
|
43
|
+
renderConfidence(confidence: number, reasoning?: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Render a list of warnings.
|
|
46
|
+
*/
|
|
47
|
+
renderWarnings(warnings: WarningInput[]): string;
|
|
48
|
+
/**
|
|
49
|
+
* Render pipeline step progress.
|
|
50
|
+
*/
|
|
51
|
+
renderPipelineSteps(steps: PipelineStepInput[]): string;
|
|
52
|
+
/**
|
|
53
|
+
* Render a full CommandResult with all metadata sections.
|
|
54
|
+
*/
|
|
55
|
+
renderCommandResult(result: CommandResultInput): string;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=web-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-adapter.d.ts","sourceRoot":"","sources":["../src/web-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,MAAM,YAAY,CAAC;AAGpB;;;;;GAKG;AACH,eAAO,MAAM,UAAU;IACtB;;OAEG;+BACwB,cAAc,YAAW,aAAa,GAAQ,MAAM;IA+D/E;;OAEG;yBACkB,MAAM,GAAG,MAAM;IAIpC;;OAEG;2BACoB,MAAM,GAAG,MAAM;IAItC;;OAEG;2BACoB,MAAM,GAAG,MAAM;IAItC;;OAEG;yBACkB;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;IAoBnF;;OAEG;8BACuB,iBAAiB,GAAG,MAAM;IAgBpD;;OAEG;iCAC0B,MAAM,cAAc,MAAM,GAAG,MAAM;IAyBhE;;OAEG;6BACsB,YAAY,EAAE,GAAG,MAAM;IAchD;;OAEG;+BACwB,iBAAiB,EAAE,GAAG,MAAM;IA8CvD;;OAEG;gCACyB,kBAAkB,GAAG,MAAM;CA8BvD,CAAC"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebAdapter - Renders CommandResult to HTML with CSS variable theming.
|
|
3
|
+
*/
|
|
4
|
+
import { StatusType } from './css-variables.js';
|
|
5
|
+
import { escapeHtml, styledSpan } from './utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* WebAdapter transforms AFD CommandResult data into styled HTML.
|
|
8
|
+
*
|
|
9
|
+
* Uses CSS custom properties for theming:
|
|
10
|
+
* --afd-success, --afd-error, --afd-warning, --afd-info, --afd-muted
|
|
11
|
+
*/
|
|
12
|
+
export const WebAdapter = {
|
|
13
|
+
/**
|
|
14
|
+
* Render package results (lint/test/build) as HTML.
|
|
15
|
+
*/
|
|
16
|
+
renderPackageResults(data, options = {}) {
|
|
17
|
+
const { showFailureOutput = true, maxOutputLength } = options;
|
|
18
|
+
if (!data || !Array.isArray(data.packages)) {
|
|
19
|
+
return '<pre>No results</pre>';
|
|
20
|
+
}
|
|
21
|
+
const lines = [];
|
|
22
|
+
const total = data.total || data.packages.length;
|
|
23
|
+
const passed = data.passed || 0;
|
|
24
|
+
const failed = data.failed || 0;
|
|
25
|
+
// Header
|
|
26
|
+
lines.push(styledSpan(`Processing ${total} package(s)...`, StatusType.NEUTRAL, true));
|
|
27
|
+
lines.push('');
|
|
28
|
+
// Package results
|
|
29
|
+
for (const pkg of data.packages) {
|
|
30
|
+
const name = pkg.name || 'unknown';
|
|
31
|
+
const pkgPassed = pkg.passed;
|
|
32
|
+
// Package name in info color (blue)
|
|
33
|
+
lines.push(styledSpan(`> ${name}`, StatusType.INFO));
|
|
34
|
+
// Status indicator
|
|
35
|
+
if (pkgPassed) {
|
|
36
|
+
lines.push(styledSpan(' [PASS]', StatusType.SUCCESS));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
lines.push(styledSpan(' [FAIL]', StatusType.FAILURE));
|
|
40
|
+
}
|
|
41
|
+
// Show output for failed packages
|
|
42
|
+
if (!pkgPassed && showFailureOutput) {
|
|
43
|
+
const stdout = pkg.stdout || '';
|
|
44
|
+
const stderr = pkg.stderr || '';
|
|
45
|
+
let output = (stdout + stderr).trim();
|
|
46
|
+
if (maxOutputLength && output.length > maxOutputLength) {
|
|
47
|
+
output = `${output.slice(0, maxOutputLength)}...`;
|
|
48
|
+
}
|
|
49
|
+
if (output) {
|
|
50
|
+
lines.push(styledSpan(output, StatusType.MUTED));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
lines.push('');
|
|
54
|
+
}
|
|
55
|
+
// Summary
|
|
56
|
+
const summaryParts = [styledSpan('Results: ', StatusType.NEUTRAL, true)];
|
|
57
|
+
if (passed > 0) {
|
|
58
|
+
summaryParts.push(styledSpan(`${passed} passed`, StatusType.SUCCESS));
|
|
59
|
+
}
|
|
60
|
+
if (failed > 0) {
|
|
61
|
+
if (passed > 0)
|
|
62
|
+
summaryParts.push(', ');
|
|
63
|
+
summaryParts.push(styledSpan(`${failed} failed`, StatusType.FAILURE));
|
|
64
|
+
}
|
|
65
|
+
lines.push(summaryParts.join(''));
|
|
66
|
+
return `<pre>${lines.join('<br>')}</pre>`;
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Render an error message.
|
|
70
|
+
*/
|
|
71
|
+
renderError(message) {
|
|
72
|
+
return `<pre>${styledSpan(`Error: ${message}`, StatusType.FAILURE)}</pre>`;
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Render a success message.
|
|
76
|
+
*/
|
|
77
|
+
renderSuccess(message) {
|
|
78
|
+
return `<pre>${styledSpan(message, StatusType.SUCCESS)}</pre>`;
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Render a warning message.
|
|
82
|
+
*/
|
|
83
|
+
renderWarning(message) {
|
|
84
|
+
return `<pre>${styledSpan(`Warning: ${message}`, StatusType.WARNING)}</pre>`;
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Render a generic result with auto-detection.
|
|
88
|
+
*/
|
|
89
|
+
renderResult(result) {
|
|
90
|
+
if (result.success === false && result.error) {
|
|
91
|
+
const errorMsg = typeof result.error === 'object' && result.error !== null
|
|
92
|
+
? result.error.message || String(result.error)
|
|
93
|
+
: String(result.error);
|
|
94
|
+
return this.renderError(errorMsg);
|
|
95
|
+
}
|
|
96
|
+
const data = result.data;
|
|
97
|
+
// Check if it's package results
|
|
98
|
+
if (data?.packages && Array.isArray(data.packages)) {
|
|
99
|
+
return this.renderPackageResults(data);
|
|
100
|
+
}
|
|
101
|
+
// Fallback to JSON display
|
|
102
|
+
return `<pre>${escapeHtml(JSON.stringify(result.data, null, 2))}</pre>`;
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* Render a CommandError with code, message, and optional suggestion.
|
|
106
|
+
*/
|
|
107
|
+
renderCommandError(error) {
|
|
108
|
+
const lines = [];
|
|
109
|
+
lines.push(styledSpan(`[${error.code}] ${error.message}`, StatusType.FAILURE, true));
|
|
110
|
+
if (error.suggestion) {
|
|
111
|
+
lines.push(styledSpan(`Suggestion: ${error.suggestion}`, StatusType.INFO));
|
|
112
|
+
}
|
|
113
|
+
if (error.details) {
|
|
114
|
+
lines.push(styledSpan(`Details: ${JSON.stringify(error.details)}`, StatusType.MUTED));
|
|
115
|
+
}
|
|
116
|
+
return `<pre>${lines.join('<br>')}</pre>`;
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Render a confidence indicator (0-1 scale).
|
|
120
|
+
*/
|
|
121
|
+
renderConfidence(confidence, reasoning) {
|
|
122
|
+
const pct = Math.round(confidence * 100);
|
|
123
|
+
const barWidth = 20;
|
|
124
|
+
const filled = Math.round(confidence * barWidth);
|
|
125
|
+
const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(barWidth - filled);
|
|
126
|
+
let status;
|
|
127
|
+
if (confidence >= 0.8) {
|
|
128
|
+
status = StatusType.SUCCESS;
|
|
129
|
+
}
|
|
130
|
+
else if (confidence >= 0.5) {
|
|
131
|
+
status = StatusType.WARNING;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
status = StatusType.FAILURE;
|
|
135
|
+
}
|
|
136
|
+
const lines = [];
|
|
137
|
+
lines.push(`${styledSpan(`Confidence: ${pct}%`, status, true)} ${styledSpan(bar, status)}`);
|
|
138
|
+
if (reasoning) {
|
|
139
|
+
lines.push(styledSpan(reasoning, StatusType.MUTED));
|
|
140
|
+
}
|
|
141
|
+
return `<pre>${lines.join('<br>')}</pre>`;
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* Render a list of warnings.
|
|
145
|
+
*/
|
|
146
|
+
renderWarnings(warnings) {
|
|
147
|
+
if (warnings.length === 0)
|
|
148
|
+
return '';
|
|
149
|
+
const lines = [];
|
|
150
|
+
lines.push(styledSpan(`${warnings.length} warning(s):`, StatusType.WARNING, true));
|
|
151
|
+
for (const warning of warnings) {
|
|
152
|
+
const prefix = warning.code ? `[${warning.code}] ` : '';
|
|
153
|
+
lines.push(styledSpan(` \u26A0 ${prefix}${warning.message}`, StatusType.WARNING));
|
|
154
|
+
}
|
|
155
|
+
return `<pre>${lines.join('<br>')}</pre>`;
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* Render pipeline step progress.
|
|
159
|
+
*/
|
|
160
|
+
renderPipelineSteps(steps) {
|
|
161
|
+
if (steps.length === 0)
|
|
162
|
+
return '<pre>No pipeline steps</pre>';
|
|
163
|
+
const lines = [];
|
|
164
|
+
const succeeded = steps.filter((s) => s.status === 'success').length;
|
|
165
|
+
const failed = steps.filter((s) => s.status === 'failure').length;
|
|
166
|
+
const skipped = steps.filter((s) => s.status === 'skipped').length;
|
|
167
|
+
lines.push(styledSpan(`Pipeline: ${steps.length} steps`, StatusType.NEUTRAL, true));
|
|
168
|
+
lines.push('');
|
|
169
|
+
for (const step of steps) {
|
|
170
|
+
let icon;
|
|
171
|
+
let status;
|
|
172
|
+
if (step.status === 'success') {
|
|
173
|
+
icon = '\u2713';
|
|
174
|
+
status = StatusType.SUCCESS;
|
|
175
|
+
}
|
|
176
|
+
else if (step.status === 'failure') {
|
|
177
|
+
icon = '\u2717';
|
|
178
|
+
status = StatusType.FAILURE;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
icon = '\u2014';
|
|
182
|
+
status = StatusType.MUTED;
|
|
183
|
+
}
|
|
184
|
+
const alias = step.alias ? ` (${step.alias})` : '';
|
|
185
|
+
const time = step.executionTimeMs !== undefined ? ` ${step.executionTimeMs.toFixed(1)}ms` : '';
|
|
186
|
+
lines.push(styledSpan(` ${icon} ${step.command}${alias}${time}`, status));
|
|
187
|
+
if (step.status === 'failure' && step.error) {
|
|
188
|
+
lines.push(styledSpan(` ${step.error.message ?? 'Unknown error'}`, StatusType.FAILURE));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
lines.push('');
|
|
192
|
+
const summaryParts = [];
|
|
193
|
+
if (succeeded > 0)
|
|
194
|
+
summaryParts.push(styledSpan(`${succeeded} passed`, StatusType.SUCCESS));
|
|
195
|
+
if (failed > 0)
|
|
196
|
+
summaryParts.push(styledSpan(`${failed} failed`, StatusType.FAILURE));
|
|
197
|
+
if (skipped > 0)
|
|
198
|
+
summaryParts.push(styledSpan(`${skipped} skipped`, StatusType.MUTED));
|
|
199
|
+
lines.push(summaryParts.join(', '));
|
|
200
|
+
return `<pre>${lines.join('<br>')}</pre>`;
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* Render a full CommandResult with all metadata sections.
|
|
204
|
+
*/
|
|
205
|
+
renderCommandResult(result) {
|
|
206
|
+
const sections = [];
|
|
207
|
+
// Error section
|
|
208
|
+
if (!result.success && result.error) {
|
|
209
|
+
sections.push(this.renderCommandError(result.error));
|
|
210
|
+
}
|
|
211
|
+
// Success data
|
|
212
|
+
if (result.success && result.data !== undefined) {
|
|
213
|
+
const data = result.data;
|
|
214
|
+
if (data?.packages && Array.isArray(data.packages)) {
|
|
215
|
+
sections.push(this.renderPackageResults(data));
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
sections.push(`<pre>${escapeHtml(JSON.stringify(result.data, null, 2))}</pre>`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// Confidence
|
|
222
|
+
if (result.confidence !== undefined) {
|
|
223
|
+
sections.push(this.renderConfidence(result.confidence, result.reasoning));
|
|
224
|
+
}
|
|
225
|
+
// Warnings
|
|
226
|
+
if (result.warnings && result.warnings.length > 0) {
|
|
227
|
+
sections.push(this.renderWarnings(result.warnings));
|
|
228
|
+
}
|
|
229
|
+
return sections.join('\n');
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
//# sourceMappingURL=web-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-adapter.js","sourceRoot":"","sources":["../src/web-adapter.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AC3E,CAAC;QAED,WAAW;QACX,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lushly-dev/afd-adapters",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Frontend adapters for rendering AFD CommandResult to styled HTML",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./css": "./css/afd-theme.css"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"css"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.3.0",
|
|
22
|
+
"vitest": "^1.6.0",
|
|
23
|
+
"@lushly-dev/afd-core": "0.3.0"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@lushly-dev/afd-core": ">=0.1.0"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"afd",
|
|
30
|
+
"adapters",
|
|
31
|
+
"frontend",
|
|
32
|
+
"rendering",
|
|
33
|
+
"command-result"
|
|
34
|
+
],
|
|
35
|
+
"author": "Falkicon",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"homepage": "https://github.com/lushly-dev/afd#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/lushly-dev/afd/issues"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/lushly-dev/afd.git",
|
|
44
|
+
"directory": "packages/adapters"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20.0.0"
|
|
48
|
+
},
|
|
49
|
+
"sideEffects": false,
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:watch": "vitest",
|
|
57
|
+
"lint": "biome check src/",
|
|
58
|
+
"format": "biome format --write src/"
|
|
59
|
+
}
|
|
60
|
+
}
|