@lushly-dev/fast-element 3.0.1-preview.0 → 3.0.1-preview.2
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/CHANGELOG.md +12 -0
- package/dist/command/command.api.json +7857 -0
- package/dist/context/context.api.json +1084 -0
- package/dist/declarative/declarative.api.json +8130 -0
- package/dist/definition-schema/definition-schema.api.json +2689 -0
- package/dist/di/di.api.json +4945 -0
- package/dist/dts/arrays.d.ts +2 -0
- package/dist/dts/binding/binding.d.ts +59 -0
- package/dist/dts/binding/exports.d.ts +9 -0
- package/dist/dts/binding/normalize.d.ts +9 -0
- package/dist/dts/binding/one-time.d.ts +11 -0
- package/dist/dts/binding/one-way.d.ts +20 -0
- package/dist/dts/binding/signal.d.ts +36 -0
- package/dist/dts/binding/two-way.d.ts +44 -0
- package/dist/dts/command/behavior.d.ts +94 -0
- package/dist/dts/command/behaviors/confirm-behavior.d.ts +139 -0
- package/dist/dts/command/behaviors/undo-behavior.d.ts +178 -0
- package/dist/dts/command/command.d.ts +79 -0
- package/dist/dts/command/component-registry.d.ts +50 -0
- package/dist/dts/command/components/confirm-dialog.d.ts +117 -0
- package/dist/dts/command/index.d.ts +21 -0
- package/dist/dts/command/registry.d.ts +201 -0
- package/dist/dts/command/schema-validation.d.ts +45 -0
- package/dist/dts/command/types.d.ts +332 -0
- package/dist/dts/command/validation.d.ts +116 -0
- package/dist/dts/command/weak-ref.d.ts +11 -0
- package/dist/dts/components/attributes.d.ts +153 -0
- package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
- package/dist/dts/components/element-controller.d.ts +349 -0
- package/dist/dts/components/element-hydration.d.ts +2 -0
- package/dist/dts/components/enable-hydration.d.ts +66 -0
- package/dist/dts/components/fast-definitions.d.ts +211 -0
- package/dist/dts/components/fast-element-registry.d.ts +23 -0
- package/dist/dts/components/fast-element.d.ts +91 -0
- package/dist/dts/components/hydration-tracker.d.ts +110 -0
- package/dist/dts/components/hydration.d.ts +52 -0
- package/dist/dts/components/schema.d.ts +205 -0
- package/dist/dts/context.d.ts +171 -0
- package/dist/dts/debug.d.ts +5 -0
- package/dist/dts/declarative/attribute-map.d.ts +58 -0
- package/dist/dts/declarative/debug.d.ts +4 -0
- package/dist/dts/declarative/index.d.ts +14 -0
- package/dist/dts/declarative/interfaces.d.ts +8 -0
- package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
- package/dist/dts/declarative/observer-map.d.ts +89 -0
- package/dist/dts/declarative/runtime.d.ts +5 -0
- package/dist/dts/declarative/syntax.d.ts +21 -0
- package/dist/dts/declarative/template-bridge.d.ts +33 -0
- package/dist/dts/declarative/template-parser.d.ts +98 -0
- package/dist/dts/declarative/template.d.ts +9 -0
- package/dist/dts/declarative/utilities.d.ts +358 -0
- package/dist/dts/definition-schema/api.d.ts +42 -0
- package/dist/dts/definition-schema/cem.d.ts +78 -0
- package/dist/dts/definition-schema/extension.d.ts +18 -0
- package/dist/dts/definition-schema/extract.d.ts +38 -0
- package/dist/dts/definition-schema/index.d.ts +9 -0
- package/dist/dts/definition-schema/storage.d.ts +35 -0
- package/dist/dts/definition-schema/types.d.ts +176 -0
- package/dist/dts/dev-mode.d.ts +13 -0
- package/dist/dts/di/di.d.ts +894 -0
- package/dist/dts/dom-policy.d.ts +101 -0
- package/dist/dts/dom.d.ts +88 -0
- package/dist/dts/hydration/diagnostics.d.ts +93 -0
- package/dist/dts/hydration/exports.d.ts +18 -0
- package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
- package/dist/dts/hydration/messages.d.ts +62 -0
- package/dist/dts/hydration/runtime.d.ts +7 -0
- package/dist/dts/hydration/target-builder.d.ts +107 -0
- package/dist/dts/index.d.ts +51 -0
- package/dist/dts/index.debug.d.ts +1 -0
- package/dist/dts/index.rollup.d.ts +1 -0
- package/dist/dts/index.rollup.debug.d.ts +1 -0
- package/dist/dts/interfaces.d.ts +106 -0
- package/dist/dts/metadata.d.ts +26 -0
- package/dist/dts/observation/arrays.d.ts +248 -0
- package/dist/dts/observation/notifier.d.ts +127 -0
- package/dist/dts/observation/observable.d.ts +276 -0
- package/dist/dts/observation/update-queue.d.ts +40 -0
- package/dist/dts/observation/volatile.d.ts +9 -0
- package/dist/dts/platform.d.ts +87 -0
- package/dist/dts/registry.d.ts +2 -0
- package/dist/dts/render.d.ts +7 -0
- package/dist/dts/schema.d.ts +1 -0
- package/dist/dts/scoped/detection.d.ts +55 -0
- package/dist/dts/scoped/index.d.ts +68 -0
- package/dist/dts/scoped/mixin.d.ts +118 -0
- package/dist/dts/scoped/registry.d.ts +76 -0
- package/dist/dts/scoped/types.d.ts +48 -0
- package/dist/dts/state/exports.d.ts +3 -0
- package/dist/dts/state/reactive.d.ts +8 -0
- package/dist/dts/state/state.d.ts +141 -0
- package/dist/dts/state/visitor.d.ts +6 -0
- package/dist/dts/state/watch.d.ts +10 -0
- package/dist/dts/styles/css-directive.d.ts +50 -0
- package/dist/dts/styles/css.d.ts +34 -0
- package/dist/dts/styles/element-styles.d.ts +61 -0
- package/dist/dts/styles/host.d.ts +65 -0
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/children.d.ts +62 -0
- package/dist/dts/templating/compiler.d.ts +54 -0
- package/dist/dts/templating/html-binding-directive.d.ts +155 -0
- package/dist/dts/templating/html-directive.d.ts +218 -0
- package/dist/dts/templating/html.d.ts +1 -0
- package/dist/dts/templating/hydration-view.d.ts +130 -0
- package/dist/dts/templating/markup.d.ts +48 -0
- package/dist/dts/templating/node-observation.d.ts +99 -0
- package/dist/dts/templating/ref.d.ts +23 -0
- package/dist/dts/templating/render.d.ts +318 -0
- package/dist/dts/templating/repeat.d.ts +131 -0
- package/dist/dts/templating/slotted.d.ts +38 -0
- package/dist/dts/templating/template.d.ts +221 -0
- package/dist/dts/templating/view.d.ts +268 -0
- package/dist/dts/templating/when.d.ts +12 -0
- package/dist/dts/testing/exports.d.ts +3 -0
- package/dist/dts/testing/fakes.d.ts +16 -0
- package/dist/dts/testing/fixture.d.ts +84 -0
- package/dist/dts/testing/models.d.ts +20 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/dts/trust/index.d.ts +8 -0
- package/dist/dts/trust/types.d.ts +48 -0
- package/dist/dts/trust/utils.d.ts +26 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/utilities.d.ts +76 -0
- package/dist/esm/arrays.js +1 -0
- package/dist/esm/binding/binding.js +18 -0
- package/dist/esm/binding/exports.js +6 -0
- package/dist/esm/binding/normalize.js +17 -0
- package/dist/esm/binding/one-time.js +21 -0
- package/dist/esm/binding/one-way.js +30 -0
- package/dist/esm/binding/signal.js +99 -0
- package/dist/esm/binding/two-way.js +109 -0
- package/dist/esm/command/behavior.js +155 -0
- package/dist/esm/command/behaviors/confirm-behavior.js +225 -0
- package/dist/esm/command/behaviors/undo-behavior.js +313 -0
- package/dist/esm/command/command.js +104 -0
- package/dist/esm/command/component-registry.js +107 -0
- package/dist/esm/command/components/confirm-dialog.js +370 -0
- package/dist/esm/command/index.js +22 -0
- package/dist/esm/command/registry.js +755 -0
- package/dist/esm/command/schema-validation.js +194 -0
- package/dist/esm/command/types.js +86 -0
- package/dist/esm/command/validation.js +508 -0
- package/dist/esm/command/weak-ref.js +5 -0
- package/dist/esm/components/attributes.js +219 -0
- package/dist/esm/components/definition-schema-transforms.js +23 -0
- package/dist/esm/components/element-controller.js +840 -0
- package/dist/esm/components/element-hydration.js +2 -0
- package/dist/esm/components/enable-hydration.js +123 -0
- package/dist/esm/components/fast-definitions.js +294 -0
- package/dist/esm/components/fast-element-registry.js +67 -0
- package/dist/esm/components/fast-element.js +82 -0
- package/dist/esm/components/hydration-tracker.js +211 -0
- package/dist/esm/components/hydration.js +187 -0
- package/dist/esm/components/schema.js +253 -0
- package/dist/esm/context.js +185 -0
- package/dist/esm/debug.js +71 -0
- package/dist/esm/declarative/attribute-map.js +122 -0
- package/dist/esm/declarative/debug.js +4 -0
- package/dist/esm/declarative/index.js +10 -0
- package/dist/esm/declarative/interfaces.js +9 -0
- package/dist/esm/declarative/observer-map-utilities.js +565 -0
- package/dist/esm/declarative/observer-map.js +216 -0
- package/dist/esm/declarative/runtime.js +14 -0
- package/dist/esm/declarative/syntax.js +36 -0
- package/dist/esm/declarative/template-bridge.js +160 -0
- package/dist/esm/declarative/template-parser.js +306 -0
- package/dist/esm/declarative/template.js +116 -0
- package/dist/esm/declarative/utilities.js +1069 -0
- package/dist/esm/definition-schema/api.js +129 -0
- package/dist/esm/definition-schema/cem.js +89 -0
- package/dist/esm/definition-schema/extension.js +53 -0
- package/dist/esm/definition-schema/extract.js +167 -0
- package/dist/esm/definition-schema/index.js +8 -0
- package/dist/esm/definition-schema/storage.js +58 -0
- package/dist/esm/definition-schema/types.js +8 -0
- package/dist/esm/dev-mode.js +22 -0
- package/dist/esm/di/di.js +1441 -0
- package/dist/esm/dom-policy.js +374 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/hydration/diagnostics.js +50 -0
- package/dist/esm/hydration/exports.js +6 -0
- package/dist/esm/hydration/hydration-debugger.js +112 -0
- package/dist/esm/hydration/messages.js +84 -0
- package/dist/esm/hydration/runtime.js +33 -0
- package/dist/esm/hydration/target-builder.js +264 -0
- package/dist/esm/index.debug.js +3 -0
- package/dist/esm/index.js +49 -0
- package/dist/esm/index.rollup.debug.js +6 -0
- package/dist/esm/index.rollup.js +4 -0
- package/dist/esm/interfaces.js +55 -0
- package/dist/esm/metadata.js +57 -0
- package/dist/esm/observation/arrays.js +661 -0
- package/dist/esm/observation/notifier.js +162 -0
- package/dist/esm/observation/observable.js +324 -0
- package/dist/esm/observation/update-queue.js +56 -0
- package/dist/esm/observation/volatile.js +16 -0
- package/dist/esm/platform.js +98 -0
- package/dist/esm/registry.js +2 -0
- package/dist/esm/render.js +1 -0
- package/dist/esm/schema.js +1 -0
- package/dist/esm/scoped/detection.js +102 -0
- package/dist/esm/scoped/index.js +69 -0
- package/dist/esm/scoped/mixin.js +127 -0
- package/dist/esm/scoped/registry.js +125 -0
- package/dist/esm/scoped/types.js +4 -0
- package/dist/esm/state/exports.js +3 -0
- package/dist/esm/state/reactive.js +34 -0
- package/dist/esm/state/state.js +148 -0
- package/dist/esm/state/visitor.js +28 -0
- package/dist/esm/state/watch.js +36 -0
- package/dist/esm/styles/css-directive.js +36 -0
- package/dist/esm/styles/css.js +56 -0
- package/dist/esm/styles/element-styles.js +144 -0
- package/dist/esm/styles/host.js +1 -0
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/children.js +67 -0
- package/dist/esm/templating/compiler.js +359 -0
- package/dist/esm/templating/html-binding-directive.js +288 -0
- package/dist/esm/templating/html-directive.js +113 -0
- package/dist/esm/templating/html.js +1 -0
- package/dist/esm/templating/hydration-view.js +228 -0
- package/dist/esm/templating/markup.js +83 -0
- package/dist/esm/templating/node-observation.js +84 -0
- package/dist/esm/templating/ref.js +21 -0
- package/dist/esm/templating/render.js +468 -0
- package/dist/esm/templating/repeat.js +434 -0
- package/dist/esm/templating/slotted.js +49 -0
- package/dist/esm/templating/template.js +206 -0
- package/dist/esm/templating/view.js +298 -0
- package/dist/esm/templating/when.js +22 -0
- package/dist/esm/testing/exports.js +3 -0
- package/dist/esm/testing/fakes.js +107 -0
- package/dist/esm/testing/fixture.js +86 -0
- package/dist/esm/testing/models.js +58 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/esm/trust/index.js +7 -0
- package/dist/esm/trust/types.js +6 -0
- package/dist/esm/trust/utils.js +126 -0
- package/dist/esm/utilities.js +140 -0
- package/dist/fast-element.api.json +26798 -0
- package/dist/fast-element.d.ts +3985 -0
- package/dist/fast-element.debug.js +7604 -0
- package/dist/fast-element.debug.min.js +3 -0
- package/dist/fast-element.js +7603 -0
- package/dist/fast-element.min.js +3 -0
- package/dist/fast-element.untrimmed.d.ts +4103 -0
- package/dist/observation/arrays/arrays.api.json +2621 -0
- package/dist/scoped/scoped.api.json +891 -0
- package/dist/trust/trust.api.json +629 -0
- package/package.json +21 -23
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the `command` decorator system.
|
|
3
|
+
* Enables AI agents to interact with FASTElement components through structured commands.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This module contains types only - no runtime code.
|
|
7
|
+
* Re-exports AFD core types for ecosystem alignment.
|
|
8
|
+
* FAST-AF is an "agent runtime for Web Components".
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Metadata attached to command results for tracing and analytics.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface ResultMetadata {
|
|
15
|
+
/** Execution duration in milliseconds */
|
|
16
|
+
duration?: number;
|
|
17
|
+
/** Trace ID for distributed tracing */
|
|
18
|
+
traceId?: string;
|
|
19
|
+
/** Additional custom metadata */
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Structured error information for failed commands.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export interface CommandError {
|
|
27
|
+
/** Machine-readable error code */
|
|
28
|
+
code: string;
|
|
29
|
+
/** Human-readable error message */
|
|
30
|
+
message: string;
|
|
31
|
+
/** Suggestion for how to resolve the error */
|
|
32
|
+
suggestion?: string;
|
|
33
|
+
/** Whether the operation can be retried */
|
|
34
|
+
retryable?: boolean;
|
|
35
|
+
/** Additional error details */
|
|
36
|
+
details?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Result type for command execution.
|
|
40
|
+
* Discriminated union based on success field.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export type CommandResult<T = unknown> = {
|
|
44
|
+
success: true;
|
|
45
|
+
data: T;
|
|
46
|
+
metadata?: ResultMetadata;
|
|
47
|
+
} | {
|
|
48
|
+
success: false;
|
|
49
|
+
error: CommandError;
|
|
50
|
+
metadata?: ResultMetadata;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Standard error codes for command failures.
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export declare const ErrorCodes: {
|
|
57
|
+
/** Command ID not found in registry */
|
|
58
|
+
readonly COMMAND_NOT_FOUND: "COMMAND_NOT_FOUND";
|
|
59
|
+
/** Command is currently disabled */
|
|
60
|
+
readonly COMMAND_DISABLED: "COMMAND_DISABLED";
|
|
61
|
+
/** Command is not exposed to the interface that invoked it */
|
|
62
|
+
readonly COMMAND_NOT_EXPOSED: "COMMAND_NOT_EXPOSED";
|
|
63
|
+
/** Invalid parameters provided */
|
|
64
|
+
readonly INVALID_PARAMETERS: "INVALID_PARAMETERS";
|
|
65
|
+
/** Destructive command requires confirmation but no confirmation handler is installed */
|
|
66
|
+
readonly CONFIRMATION_REQUIRED: "CONFIRMATION_REQUIRED";
|
|
67
|
+
/** Command execution failed */
|
|
68
|
+
readonly EXECUTION_FAILED: "EXECUTION_FAILED";
|
|
69
|
+
/** Operation timed out */
|
|
70
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
71
|
+
/** Generic internal error */
|
|
72
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Create a successful command result.
|
|
76
|
+
* @param data - The result data
|
|
77
|
+
* @param metadata - Optional metadata
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export declare function success<T>(data: T, metadata?: ResultMetadata): CommandResult<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Create a failed command result.
|
|
83
|
+
* @param error - The error information
|
|
84
|
+
* @param metadata - Optional metadata
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export declare function failure(error: CommandError, metadata?: ResultMetadata): CommandResult<never>;
|
|
88
|
+
/**
|
|
89
|
+
* Type guard for successful results.
|
|
90
|
+
* @param result - The result to check
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export declare function isSuccess<T>(result: CommandResult<T>): result is {
|
|
94
|
+
success: true;
|
|
95
|
+
data: T;
|
|
96
|
+
metadata?: ResultMetadata;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Type guard for failed results.
|
|
100
|
+
* @param result - The result to check
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export declare function isFailure<T>(result: CommandResult<T>): result is {
|
|
104
|
+
success: false;
|
|
105
|
+
error: CommandError;
|
|
106
|
+
metadata?: ResultMetadata;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Create a CommandError object.
|
|
110
|
+
* @param code - Error code
|
|
111
|
+
* @param message - Error message
|
|
112
|
+
* @param options - Additional error options
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
export declare function createError(code: string, message: string, options?: Omit<CommandError, "code" | "message">): CommandError;
|
|
116
|
+
/**
|
|
117
|
+
* Namespace-prefixed command ID.
|
|
118
|
+
* TypeScript template literal enforces at compile time.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* Commands must include a namespace prefix to avoid collisions.
|
|
122
|
+
* Format: "namespace.action" or "\@scope/namespace.action"
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* // Valid IDs:
|
|
127
|
+
* const id1: CommandId = "editor.save";
|
|
128
|
+
* const id2: CommandId = "app.settings.toggle";
|
|
129
|
+
* const id3: CommandId = "@myorg/editor.format";
|
|
130
|
+
*
|
|
131
|
+
* // Invalid (compile error):
|
|
132
|
+
* const bad: CommandId = "save"; // Missing namespace
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @public
|
|
136
|
+
*/
|
|
137
|
+
export type CommandId = `${string}.${string}` | `@${string}/${string}.${string}`;
|
|
138
|
+
/**
|
|
139
|
+
* JSONSchema type for parameter validation.
|
|
140
|
+
* Flexible until formal JSON Schema type is added.
|
|
141
|
+
*
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
export type JSONSchema = Record<string, unknown>;
|
|
145
|
+
/**
|
|
146
|
+
* Decorator metadata stored via createMetadataLocator.
|
|
147
|
+
* Represents the compile-time configuration of a command.
|
|
148
|
+
*
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
151
|
+
export interface CommandMetadata {
|
|
152
|
+
/** Namespace-prefixed command identifier */
|
|
153
|
+
id: CommandId;
|
|
154
|
+
/** Name of the decorated method on the component class */
|
|
155
|
+
methodName: string;
|
|
156
|
+
/** Human-readable label for UI display */
|
|
157
|
+
label?: string;
|
|
158
|
+
/** Icon identifier (e.g., "save", "fluent:save-24-regular") */
|
|
159
|
+
icon?: string;
|
|
160
|
+
/** Extended description for command palettes and documentation */
|
|
161
|
+
description?: string;
|
|
162
|
+
/** Grouping category for organization in UI */
|
|
163
|
+
category?: string;
|
|
164
|
+
/** Keyboard shortcut (e.g., "Ctrl+S", "Cmd+Shift+P") */
|
|
165
|
+
keybinding?: string;
|
|
166
|
+
/** JSON Schema for runtime parameter validation */
|
|
167
|
+
parameters?: JSONSchema;
|
|
168
|
+
/** Context expression for conditional visibility (e.g., "editorFocus") */
|
|
169
|
+
when?: string;
|
|
170
|
+
/** If true, command is registered but hidden from UI */
|
|
171
|
+
hidden?: boolean;
|
|
172
|
+
/** If true, command requires user confirmation before execution */
|
|
173
|
+
destructive?: boolean;
|
|
174
|
+
/** Custom confirmation prompt (default: "Are you sure?") */
|
|
175
|
+
confirmPrompt?: string;
|
|
176
|
+
/** Interface exposure configuration */
|
|
177
|
+
expose?: ExposeConfig;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Options passed to the `command` decorator.
|
|
181
|
+
* All fields except id are optional.
|
|
182
|
+
*
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
185
|
+
export interface CommandOptions {
|
|
186
|
+
/** Human-readable label for UI display */
|
|
187
|
+
label?: string;
|
|
188
|
+
/** Icon identifier (e.g., "save", "fluent:save-24-regular") */
|
|
189
|
+
icon?: string;
|
|
190
|
+
/** Extended description for command palettes and documentation */
|
|
191
|
+
description?: string;
|
|
192
|
+
/** Grouping category for organization in UI */
|
|
193
|
+
category?: string;
|
|
194
|
+
/** Keyboard shortcut (e.g., "Ctrl+S", "Cmd+Shift+P") */
|
|
195
|
+
keybinding?: string;
|
|
196
|
+
/** JSON Schema for runtime parameter validation */
|
|
197
|
+
parameters?: JSONSchema;
|
|
198
|
+
/** Context expression for conditional visibility (e.g., "editorFocus") */
|
|
199
|
+
when?: string;
|
|
200
|
+
/** If true, command is registered but hidden from UI */
|
|
201
|
+
hidden?: boolean;
|
|
202
|
+
/** If true, command requires user confirmation before execution */
|
|
203
|
+
destructive?: boolean;
|
|
204
|
+
/** Custom confirmation prompt (default: "Are you sure?") */
|
|
205
|
+
confirmPrompt?: string;
|
|
206
|
+
/** Interface exposure configuration */
|
|
207
|
+
expose?: ExposeConfig;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Runtime command entry in the CommandRegistry.
|
|
211
|
+
* Uses AFD's CommandResult for full ecosystem alignment.
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* Created at connect-time by CommandBehavior from CommandMetadata.
|
|
215
|
+
* The source WeakRef allows garbage collection of disconnected elements.
|
|
216
|
+
*
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
export interface CommandEntry {
|
|
220
|
+
/** Namespace-prefixed command identifier */
|
|
221
|
+
id: CommandId;
|
|
222
|
+
/**
|
|
223
|
+
* Name of the method on the source element that implements the command.
|
|
224
|
+
* Set by CommandBehavior; used for conventions such as `${methodName}Undo()`.
|
|
225
|
+
*/
|
|
226
|
+
methodName?: string;
|
|
227
|
+
/** Human-readable label for UI display */
|
|
228
|
+
label: string;
|
|
229
|
+
/** Icon identifier (e.g., "save", "fluent:save-24-regular") */
|
|
230
|
+
icon?: string;
|
|
231
|
+
/** Extended description for command palettes and documentation */
|
|
232
|
+
description?: string;
|
|
233
|
+
/** Grouping category for organization in UI */
|
|
234
|
+
category?: string;
|
|
235
|
+
/** Keyboard shortcut (e.g., "Ctrl+S", "Cmd+Shift+P") */
|
|
236
|
+
keybinding?: string;
|
|
237
|
+
/** JSON Schema for runtime parameter validation */
|
|
238
|
+
parameters?: JSONSchema;
|
|
239
|
+
/** If true, command stays registered and executable but is omitted from `getActions()` */
|
|
240
|
+
hidden?: boolean;
|
|
241
|
+
/** If true, command requires user confirmation before execution */
|
|
242
|
+
destructive?: boolean;
|
|
243
|
+
/** Custom confirmation prompt (default: "Are you sure?") */
|
|
244
|
+
confirmPrompt?: string;
|
|
245
|
+
/** Interface exposure configuration */
|
|
246
|
+
expose?: ExposeConfig;
|
|
247
|
+
/**
|
|
248
|
+
* Execute the command with optional arguments.
|
|
249
|
+
* Returns AFD CommandResult for consistent error handling.
|
|
250
|
+
*/
|
|
251
|
+
execute: (...args: unknown[]) => CommandResult | Promise<CommandResult>;
|
|
252
|
+
/**
|
|
253
|
+
* Whether the command can currently be executed.
|
|
254
|
+
* Reactive via Observable.track() on the source element.
|
|
255
|
+
*/
|
|
256
|
+
readonly canExecute: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Whether the command should be visible in UI.
|
|
259
|
+
* Reactive via Observable.track() on the source element.
|
|
260
|
+
*/
|
|
261
|
+
readonly when: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* WeakRef to the source element.
|
|
264
|
+
* Allows garbage collection of disconnected elements.
|
|
265
|
+
*/
|
|
266
|
+
source: {
|
|
267
|
+
deref(): HTMLElement | undefined;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Action format for command palette integration.
|
|
272
|
+
* Compatible with ninja-keys and similar libraries.
|
|
273
|
+
*
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
export interface Action {
|
|
277
|
+
/** Unique action identifier */
|
|
278
|
+
id: string;
|
|
279
|
+
/** Display title for the action */
|
|
280
|
+
title: string;
|
|
281
|
+
/** Icon identifier */
|
|
282
|
+
icon?: string;
|
|
283
|
+
/** Section/category for grouping */
|
|
284
|
+
section?: string;
|
|
285
|
+
/** Keyboard shortcut string */
|
|
286
|
+
hotkey?: string;
|
|
287
|
+
/** Whether the action is currently disabled */
|
|
288
|
+
disabled?: boolean;
|
|
289
|
+
/** Handler function to execute the action */
|
|
290
|
+
handler: () => void;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Interface types for command exposure filtering.
|
|
294
|
+
* @public
|
|
295
|
+
*/
|
|
296
|
+
export type InterfaceType = "palette" | "agent" | "mcp" | "cli";
|
|
297
|
+
/**
|
|
298
|
+
* Configuration for which interfaces a command is exposed to.
|
|
299
|
+
* Secure defaults: palette and agent are opt-out, mcp and cli are opt-in.
|
|
300
|
+
*
|
|
301
|
+
* @remarks
|
|
302
|
+
* - palette: Command palette UI (ninja-keys, etc.)
|
|
303
|
+
* - agent: AI agents interacting with the component
|
|
304
|
+
* - mcp: Model Context Protocol servers
|
|
305
|
+
* - cli: Command-line interface tools
|
|
306
|
+
*
|
|
307
|
+
* @public
|
|
308
|
+
*/
|
|
309
|
+
export interface ExposeConfig {
|
|
310
|
+
/** Expose to command palette UI (default: true) */
|
|
311
|
+
palette?: boolean;
|
|
312
|
+
/** Expose to AI agents (default: true) */
|
|
313
|
+
agent?: boolean;
|
|
314
|
+
/** Expose to MCP servers (default: false - opt-in for security) */
|
|
315
|
+
mcp?: boolean;
|
|
316
|
+
/** Expose to CLI tools (default: false - opt-in for security) */
|
|
317
|
+
cli?: boolean;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Default expose configuration.
|
|
321
|
+
* Secure defaults: palette and agent are enabled, mcp and cli require opt-in.
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
324
|
+
export declare const DEFAULT_EXPOSE_CONFIG: Required<ExposeConfig>;
|
|
325
|
+
/**
|
|
326
|
+
* Filter options for getActions().
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
export interface ActionFilter {
|
|
330
|
+
/** Filter by interface type */
|
|
331
|
+
interface?: InterfaceType;
|
|
332
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation commands for FAST elements.
|
|
3
|
+
* Provides linting and accessibility auditing capabilities.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Task 10: Implements fast.lint.check for code validation against FAST best practices.
|
|
7
|
+
* Task 11: Implements fast.a11y.audit for accessibility auditing.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Severity level for lint issues.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type LintSeverity = "error" | "warning" | "info";
|
|
14
|
+
/**
|
|
15
|
+
* A single lint issue found in code.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface LintIssue {
|
|
19
|
+
/** Rule ID that triggered the issue */
|
|
20
|
+
rule: string;
|
|
21
|
+
/** Issue severity */
|
|
22
|
+
severity: LintSeverity;
|
|
23
|
+
/** Human-readable message describing the issue */
|
|
24
|
+
message: string;
|
|
25
|
+
/** Line number where the issue occurs (1-indexed) */
|
|
26
|
+
line: number;
|
|
27
|
+
/** Column number where the issue occurs (1-indexed) */
|
|
28
|
+
column: number;
|
|
29
|
+
/** Suggested fix for the issue */
|
|
30
|
+
fix?: string;
|
|
31
|
+
/** Confidence level for the suggested fix (0-1) */
|
|
32
|
+
fixConfidence?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Issue counts by severity level.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export interface LintCounts {
|
|
39
|
+
error: number;
|
|
40
|
+
warning: number;
|
|
41
|
+
info: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A plan step for fixing a lint issue.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export interface LintPlanStep {
|
|
48
|
+
/** Step number (1-indexed) */
|
|
49
|
+
step: number;
|
|
50
|
+
/** Action to take to fix the issue */
|
|
51
|
+
action: string;
|
|
52
|
+
/** Confidence level for this fix (0-1) */
|
|
53
|
+
confidence: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Result of a lint check operation.
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
export interface LintResult {
|
|
60
|
+
/** Array of lint issues found */
|
|
61
|
+
issues: LintIssue[];
|
|
62
|
+
/** Issue counts by severity */
|
|
63
|
+
counts: LintCounts;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* WCAG conformance level.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export type WcagLevel = "A" | "AA" | "AAA";
|
|
70
|
+
/**
|
|
71
|
+
* Impact severity for accessibility violations.
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export type A11yImpact = "minor" | "moderate" | "serious" | "critical";
|
|
75
|
+
/**
|
|
76
|
+
* A single accessibility violation found during audit.
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export interface A11yViolation {
|
|
80
|
+
/** WCAG rule ID that was violated (e.g., "color-contrast", "aria-label") */
|
|
81
|
+
rule: string;
|
|
82
|
+
/** Impact severity of the violation */
|
|
83
|
+
impact: A11yImpact;
|
|
84
|
+
/** CSS selector identifying the violating element */
|
|
85
|
+
selector: string;
|
|
86
|
+
/** WCAG level this rule applies to */
|
|
87
|
+
wcagLevel: WcagLevel;
|
|
88
|
+
/** Human-readable description of the violation */
|
|
89
|
+
message: string;
|
|
90
|
+
/** WCAG success criterion reference (e.g., "1.4.3") */
|
|
91
|
+
wcagCriterion?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Result of an accessibility audit operation.
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export interface A11yAuditResult {
|
|
98
|
+
/** Array of accessibility violations found */
|
|
99
|
+
violations: A11yViolation[];
|
|
100
|
+
/** WCAG level used for the audit */
|
|
101
|
+
level: WcagLevel;
|
|
102
|
+
/** Target element selector that was audited */
|
|
103
|
+
target: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Register fast.lint.* and fast.a11y.* commands with the CommandRegistry.
|
|
107
|
+
* Called during fast-element initialization.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* These commands provide code validation and accessibility auditing:
|
|
111
|
+
* - fast.lint.check: Validates code against FAST best practices
|
|
112
|
+
* - fast.a11y.audit: Runs WCAG accessibility audit on DOM elements
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export declare function registerValidationCommands(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal WeakRef surface used by command entries without requiring the
|
|
3
|
+
* ES2021.WeakRef TypeScript library in FAST Element's compilation target.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
interface WeakReference<T extends object> {
|
|
7
|
+
deref(): T | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare function createWeakReference<T extends object>(target: T): WeakReference<T>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { type Accessor } from "../observation/observable.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents objects that can convert values to and from
|
|
4
|
+
* view or model representations.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface ValueConverter {
|
|
8
|
+
/**
|
|
9
|
+
* Converts a value from its representation in the model, to a representation for the view.
|
|
10
|
+
* @param value - The value to convert to a view representation.
|
|
11
|
+
*/
|
|
12
|
+
toView(value: any): any;
|
|
13
|
+
/**
|
|
14
|
+
* Converts a value from its representation in the view, to a representation for the model.
|
|
15
|
+
* @param value - The value to convert to a model representation.
|
|
16
|
+
*/
|
|
17
|
+
fromView(value: any): any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The mode that specifies the runtime behavior of the attribute.
|
|
21
|
+
* @remarks
|
|
22
|
+
* By default, attributes run in `reflect` mode, propagating their property
|
|
23
|
+
* values to the DOM and DOM values to the property. The `boolean` mode also
|
|
24
|
+
* reflects values, but uses the HTML standard boolean attribute behavior,
|
|
25
|
+
* interpreting the presence of the attribute as `true` and the absence as
|
|
26
|
+
* `false`. The `fromView` behavior only updates the property value based on
|
|
27
|
+
* changes in the DOM, but does not reflect property changes back.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export type AttributeMode = "reflect" | "boolean" | "fromView";
|
|
31
|
+
/**
|
|
32
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export type AttributeConfiguration = {
|
|
36
|
+
property: string;
|
|
37
|
+
attribute?: string;
|
|
38
|
+
mode?: AttributeMode;
|
|
39
|
+
converter?: ValueConverter;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Metadata used to configure a custom attribute's behavior.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare const AttributeConfiguration: Readonly<{
|
|
46
|
+
/**
|
|
47
|
+
* Locates all attribute configurations associated with a type.
|
|
48
|
+
*/
|
|
49
|
+
locate: (target: {}) => AttributeConfiguration[];
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Metadata used to configure a custom attribute's behavior through a decorator.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
56
|
+
/**
|
|
57
|
+
* A {@link ValueConverter} that converts to and from `boolean` values.
|
|
58
|
+
* @remarks
|
|
59
|
+
* Used automatically when the `boolean` {@link AttributeMode} is selected.
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export declare const booleanConverter: ValueConverter;
|
|
63
|
+
/**
|
|
64
|
+
* A {@link ValueConverter} that converts to and from `boolean` values. `null`, `undefined`, `""`,
|
|
65
|
+
* and `void` values are converted to `null`.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export declare const nullableBooleanConverter: ValueConverter;
|
|
69
|
+
/**
|
|
70
|
+
* A {@link ValueConverter} that converts to and from `number` values.
|
|
71
|
+
* @remarks
|
|
72
|
+
* This converter allows for nullable numbers, returning `null` if the
|
|
73
|
+
* input was `null`, `undefined`, or `NaN`.
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
export declare const nullableNumberConverter: ValueConverter;
|
|
77
|
+
/**
|
|
78
|
+
* An implementation of {@link Accessor} that supports reactivity,
|
|
79
|
+
* change callbacks, attribute reflection, and type conversion for
|
|
80
|
+
* custom elements.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export declare class AttributeDefinition implements Accessor {
|
|
84
|
+
private readonly fieldName;
|
|
85
|
+
private readonly callbackName;
|
|
86
|
+
private readonly hasCallback;
|
|
87
|
+
private readonly guards;
|
|
88
|
+
/**
|
|
89
|
+
* The class constructor that owns this attribute.
|
|
90
|
+
*/
|
|
91
|
+
readonly Owner: Function;
|
|
92
|
+
/**
|
|
93
|
+
* The name of the property associated with the attribute.
|
|
94
|
+
*/
|
|
95
|
+
readonly name: string;
|
|
96
|
+
/**
|
|
97
|
+
* The name of the attribute in HTML.
|
|
98
|
+
*/
|
|
99
|
+
readonly attribute: string;
|
|
100
|
+
/**
|
|
101
|
+
* The {@link AttributeMode} that describes the behavior of this attribute.
|
|
102
|
+
*/
|
|
103
|
+
readonly mode: AttributeMode;
|
|
104
|
+
/**
|
|
105
|
+
* A {@link ValueConverter} that integrates with the property getter/setter
|
|
106
|
+
* to convert values to and from a DOM string.
|
|
107
|
+
*/
|
|
108
|
+
readonly converter?: ValueConverter;
|
|
109
|
+
/**
|
|
110
|
+
* Creates an instance of AttributeDefinition.
|
|
111
|
+
* @param Owner - The class constructor that owns this attribute.
|
|
112
|
+
* @param name - The name of the property associated with the attribute.
|
|
113
|
+
* @param attribute - The name of the attribute in HTML.
|
|
114
|
+
* @param mode - The {@link AttributeMode} that describes the behavior of this attribute.
|
|
115
|
+
* @param converter - A {@link ValueConverter} that integrates with the property getter/setter
|
|
116
|
+
* to convert values to and from a DOM string.
|
|
117
|
+
*/
|
|
118
|
+
constructor(Owner: Function, name: string, attribute?: string, mode?: AttributeMode, converter?: ValueConverter);
|
|
119
|
+
/**
|
|
120
|
+
* Sets the value of the attribute/property on the source element.
|
|
121
|
+
* @param source - The source element to access.
|
|
122
|
+
* @param newValue - The value to set the attribute/property to.
|
|
123
|
+
*/
|
|
124
|
+
setValue(source: HTMLElement, newValue: any): void;
|
|
125
|
+
/**
|
|
126
|
+
* Gets the value of the attribute/property on the source element.
|
|
127
|
+
* @param source - The source element to access.
|
|
128
|
+
*/
|
|
129
|
+
getValue(source: HTMLElement): any;
|
|
130
|
+
/** @internal */
|
|
131
|
+
onAttributeChangedCallback(element: HTMLElement, value: any): void;
|
|
132
|
+
private tryReflectToAttribute;
|
|
133
|
+
/**
|
|
134
|
+
* Collects all attribute definitions associated with the owner.
|
|
135
|
+
* @param Owner - The class constructor to collect attribute for.
|
|
136
|
+
* @param attributeLists - Any existing attributes to collect and merge with those associated with the owner.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
static collect(Owner: Function, ...attributeLists: (ReadonlyArray<string | AttributeConfiguration> | undefined)[]): ReadonlyArray<AttributeDefinition>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Decorator: Specifies an HTML attribute.
|
|
143
|
+
* @param config - The configuration for the attribute.
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
146
|
+
export declare function attr(config?: DecoratorAttributeConfiguration): (target: {}, property: string) => void;
|
|
147
|
+
/**
|
|
148
|
+
* Decorator: Specifies an HTML attribute.
|
|
149
|
+
* @param target - The class to define the attribute on.
|
|
150
|
+
* @param prop - The property name to be associated with the attribute.
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
export declare function attr(target: {}, prop: string): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FASTElementDefinition } from "../components/fast-definitions.js";
|
|
2
|
+
import type { Schema } from "./schema.js";
|
|
3
|
+
export interface DeclarativeSchemaTransformContext {
|
|
4
|
+
definition: FASTElementDefinition;
|
|
5
|
+
schema: Schema;
|
|
6
|
+
}
|
|
7
|
+
export type DeclarativeSchemaTransform = (context: DeclarativeSchemaTransformContext) => void;
|
|
8
|
+
export declare function setDefinitionSchemaTransform(definition: FASTElementDefinition, key: string, transform: DeclarativeSchemaTransform, priority: number): void;
|
|
9
|
+
export declare function getDefinitionSchemaTransforms(definition?: FASTElementDefinition): readonly DeclarativeSchemaTransform[];
|