face-up 0.0.0 → 0.0.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/.gitmodules +3 -0
- package/.kiro/steering/project-context.md +17 -0
- package/.vscode/settings.json +3 -0
- package/FaceUp.js +305 -0
- package/README.md +162 -2
- package/imports.html +8 -0
- package/package.json +30 -20
- package/tests/test1.html +115 -0
- package/types/.kiro/specs/conversion-template/README.md +128 -0
- package/types/.kiro/specs/conversion-template/design.md +360 -0
- package/types/.kiro/specs/conversion-template/requirements.md +191 -0
- package/types/.kiro/specs/conversion-template/tasks.md +174 -0
- package/types/.kiro/steering/coding-standards.md +17 -0
- package/types/.kiro/steering/conversion-guide.md +103 -0
- package/types/.kiro/steering/declarative-configuration.md +108 -0
- package/types/.kiro/steering/emc-json-serializability.md +306 -0
- package/types/EnhancementConversionInstructions.md +1626 -0
- package/types/LICENSE +21 -0
- package/types/NewCustomElementFeature.md +673 -0
- package/types/NewEnhancementInstructions.md +395 -0
- package/types/README.md +2 -0
- package/types/agrace/types.d.ts +11 -0
- package/types/assign-gingerly/types.d.ts +328 -0
- package/types/be-a-beacon/types.d.ts +17 -0
- package/types/be-bound/types.d.ts +61 -0
- package/types/be-buttoned-up/types.d.ts +19 -0
- package/types/be-clonable/types.d.ts +36 -0
- package/types/be-committed/types.d.ts +22 -0
- package/types/be-decked-with/types.d.ts +26 -0
- package/types/be-delible/types.d.ts +25 -0
- package/types/be-reflective/types.d.ts +80 -0
- package/types/be-render-neutral/types.d.ts +29 -0
- package/types/be-typed/types.d.ts +31 -0
- package/types/do-inc/types.d.ts +56 -0
- package/types/do-invoke/types.d.ts +38 -0
- package/types/do-merge/types.d.ts +28 -0
- package/types/do-toggle/types.d.ts +31 -0
- package/types/face-up/types.d.ts +104 -0
- package/types/global.d.ts +29 -0
- package/types/id-generation/types.d.ts +26 -0
- package/types/inferencer/types.d.ts +46 -0
- package/types/mount-observer/types.d.ts +363 -0
- package/types/nested-regex-groups/types.d.ts +101 -0
- package/types/roundabout/types.d.ts +255 -0
- package/types/time-ticker/types.d.ts +66 -0
- package/types/truth-sourcer/types.d.ts +46 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ElementEnhancementGateway, SpawnContext } from "../assign-gingerly/types";
|
|
2
|
+
import { StatementsResult } from "../nested-regex-groups/types";
|
|
3
|
+
|
|
4
|
+
export interface EndUserProps{
|
|
5
|
+
parsedStatements: StatementsResult<IncParameters>,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AllProps extends EndUserProps{
|
|
9
|
+
enhancedElement: Element & ElementEnhancementGateway;
|
|
10
|
+
resolved: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AP = AllProps;
|
|
14
|
+
|
|
15
|
+
export type PAP = Partial<AP>;
|
|
16
|
+
|
|
17
|
+
export type ProPAP = Promise<PAP>
|
|
18
|
+
|
|
19
|
+
export interface Actions{
|
|
20
|
+
hydrate(self: AP & Actions): ProPAP;
|
|
21
|
+
handleEvent(self: AP, event: Event, incParameters: IncParameters): void;
|
|
22
|
+
init(self: AP, enhancedElement: Element, ctx: SpawnContext, initVals: PAP): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type asOptions =
|
|
26
|
+
| 'number'
|
|
27
|
+
| 'boolean'
|
|
28
|
+
| 'string'
|
|
29
|
+
| 'object'
|
|
30
|
+
| 'regexp'
|
|
31
|
+
| 'urlpattern'
|
|
32
|
+
| 'boolean|number'
|
|
33
|
+
;
|
|
34
|
+
|
|
35
|
+
export type SubPropPath = string;
|
|
36
|
+
export type EventName = string;
|
|
37
|
+
|
|
38
|
+
// export interface Specifier {
|
|
39
|
+
// id?: string,
|
|
40
|
+
// prop?: string,
|
|
41
|
+
// path?: SubPropPath,
|
|
42
|
+
// evtName?: EventName,
|
|
43
|
+
// as?: asOptions,
|
|
44
|
+
// constVal?: any;
|
|
45
|
+
// enhKey?: string;
|
|
46
|
+
// ish?: boolean;
|
|
47
|
+
// host?: boolean;
|
|
48
|
+
// }
|
|
49
|
+
|
|
50
|
+
export interface IncParameters {
|
|
51
|
+
prop?: string | null,
|
|
52
|
+
byAmtS?: string,
|
|
53
|
+
byAmtN?: number,
|
|
54
|
+
targetElementId?: string,
|
|
55
|
+
localEventType?: string,
|
|
56
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ElementEnhancementGateway, SpawnContext } from "../assign-gingerly/types";
|
|
2
|
+
import { StatementsResult } from "../nested-regex-groups/types";
|
|
3
|
+
|
|
4
|
+
export interface Specifier {
|
|
5
|
+
selector?: string;
|
|
6
|
+
prop?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface EndUserProps{
|
|
10
|
+
invokeParamSet: StatementsResult<InvokingParameters>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AllProps extends EndUserProps{
|
|
14
|
+
enhancedElement: Element & ElementEnhancementGateway;
|
|
15
|
+
resolved: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type AP = AllProps;
|
|
19
|
+
|
|
20
|
+
export type PAP = Partial<AP>;
|
|
21
|
+
|
|
22
|
+
export type ProPAP = Promise<PAP>
|
|
23
|
+
|
|
24
|
+
export interface Actions{
|
|
25
|
+
hydrate(self: AP): ProPAP;
|
|
26
|
+
init(self: AP, enhancedElement: Element, ctx: SpawnContext, initVals: PAP): Promise<void>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export interface InvokingParameters {
|
|
32
|
+
targetSpecifier: {
|
|
33
|
+
hostOrPeerMethodName: string,
|
|
34
|
+
targetElementId?: string,
|
|
35
|
+
},
|
|
36
|
+
//defaults to "click" if not specified
|
|
37
|
+
localEventType: string,
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ElementEnhancementGateway, SpawnContext, IAssignGingerlyOptions } from "../assign-gingerly/types";
|
|
2
|
+
|
|
3
|
+
export interface MergeParameters {
|
|
4
|
+
assign: Record<string, any>;
|
|
5
|
+
on?: string;
|
|
6
|
+
options?: IAssignGingerlyOptions;
|
|
7
|
+
targetElementId?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface EndUserProps {
|
|
11
|
+
mergeParamSets: MergeParameters | MergeParameters[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AllProps extends EndUserProps {
|
|
15
|
+
enhancedElement: Element & ElementEnhancementGateway;
|
|
16
|
+
resolved: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type AP = AllProps;
|
|
20
|
+
|
|
21
|
+
export type PAP = Partial<AP>;
|
|
22
|
+
|
|
23
|
+
export type ProPAP = Promise<PAP>;
|
|
24
|
+
|
|
25
|
+
export interface Actions {
|
|
26
|
+
init(self: AP, enhancedElement: Element, ctx: SpawnContext, initVals: PAP): Promise<void>;
|
|
27
|
+
hydrate(self: AP): ProPAP;
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ElementEnhancementGateway, SpawnContext } from "../assign-gingerly/types";
|
|
2
|
+
import { StatementsResult } from "../nested-regex-groups/types";
|
|
3
|
+
|
|
4
|
+
export interface EndUserProps{}
|
|
5
|
+
|
|
6
|
+
export interface AllProps extends EndUserProps{
|
|
7
|
+
enhancedElement: Element & ElementEnhancementGateway;
|
|
8
|
+
parsedStatements: StatementsResult<TogglingParameters>;
|
|
9
|
+
resolved?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AP = AllProps;
|
|
13
|
+
|
|
14
|
+
export type PAP = Partial<AP>;
|
|
15
|
+
|
|
16
|
+
export type ProPAP = Promise<PAP>
|
|
17
|
+
|
|
18
|
+
export interface Actions{
|
|
19
|
+
init(self: AllProps, enhancedElement: Element, ctx: SpawnContext, initVals: PAP): Promise<void>;
|
|
20
|
+
hydrate(self: AP): ProPAP;
|
|
21
|
+
handleEvent(self: AP, e: Event, parsedStatement: TogglingParameters): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TogglingParameters {
|
|
25
|
+
prop?: string | null;
|
|
26
|
+
localEventType?: string;
|
|
27
|
+
targetSpecifier: {
|
|
28
|
+
prop?: string;
|
|
29
|
+
targetElementId?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { SpawnContext } from "../assign-gingerly/types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared context passed via getSharedContext — contains everything
|
|
5
|
+
* FaceUp needs to manage form association for the host element.
|
|
6
|
+
*/
|
|
7
|
+
export interface FaceUpSharedContext {
|
|
8
|
+
/** The ElementInternals instance for form control APIs */
|
|
9
|
+
internals: ElementInternals;
|
|
10
|
+
/** The EventTarget the host dispatches property change events on */
|
|
11
|
+
hostPropagator: EventTarget;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Context passed to the FaceUp feature constructor
|
|
16
|
+
*/
|
|
17
|
+
export interface FeatureSpawnContext extends SpawnContext {
|
|
18
|
+
key: string;
|
|
19
|
+
optIn: any;
|
|
20
|
+
injection: any;
|
|
21
|
+
featuresRegistry: any;
|
|
22
|
+
shared?: FaceUpSharedContext;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Validation flags matching the ValidityStateFlags interface.
|
|
27
|
+
* Used with setValidity() to indicate the type of validation error.
|
|
28
|
+
*/
|
|
29
|
+
export interface ValidationFlags {
|
|
30
|
+
valueMissing?: boolean;
|
|
31
|
+
typeMismatch?: boolean;
|
|
32
|
+
patternMismatch?: boolean;
|
|
33
|
+
tooLong?: boolean;
|
|
34
|
+
tooShort?: boolean;
|
|
35
|
+
rangeUnderflow?: boolean;
|
|
36
|
+
rangeOverflow?: boolean;
|
|
37
|
+
stepMismatch?: boolean;
|
|
38
|
+
badInput?: boolean;
|
|
39
|
+
customError?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Properties that the FaceUp feature exposes.
|
|
44
|
+
* These allow the host custom element to participate in HTML forms
|
|
45
|
+
* via the ElementInternals API.
|
|
46
|
+
*/
|
|
47
|
+
export interface FaceUpProps {
|
|
48
|
+
/**
|
|
49
|
+
* The current form value of the control.
|
|
50
|
+
* Setting this calls setFormValue() on the internals.
|
|
51
|
+
*/
|
|
52
|
+
value: string | File | FormData | null;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Internal state for form restoration (optional).
|
|
56
|
+
* If provided, passed as the second argument to setFormValue().
|
|
57
|
+
*/
|
|
58
|
+
state: string | File | FormData | null;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Whether the control is currently disabled.
|
|
62
|
+
*/
|
|
63
|
+
disabled: boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether the control requires a value for form submission.
|
|
67
|
+
*/
|
|
68
|
+
required: boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Custom validation message. Setting a non-empty string
|
|
72
|
+
* marks the control as invalid with customError.
|
|
73
|
+
*/
|
|
74
|
+
validationMessage: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The EventTarget that the host element uses to propagate property change events.
|
|
78
|
+
* Provided via getSharedContext.
|
|
79
|
+
*/
|
|
80
|
+
hostPropagator: EventTarget | null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Internal state
|
|
85
|
+
*/
|
|
86
|
+
export interface AllProps extends FaceUpProps {
|
|
87
|
+
/**
|
|
88
|
+
* WeakRef to the host custom element
|
|
89
|
+
*/
|
|
90
|
+
hostRef: WeakRef<HTMLElement> | null;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The ElementInternals instance from the host (for form control APIs)
|
|
94
|
+
*/
|
|
95
|
+
internals: ElementInternals | null;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* AbortController for cleaning up event listeners
|
|
99
|
+
*/
|
|
100
|
+
abortController: AbortController | null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type AP = AllProps;
|
|
104
|
+
export type PAP = Partial<AP>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Type declarations for Map.prototype.getOrInsertComputed and WeakMap.prototype.getOrInsertComputed
|
|
2
|
+
// Feature is now supported in all modern browsers (Chrome 146+, Firefox 134+, Safari 18.2+)
|
|
3
|
+
// See: https://web-platform-dx.github.io/web-features-explorer/features/getorinsert/
|
|
4
|
+
|
|
5
|
+
interface Map<K, V> {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the value associated with the key if it exists, otherwise inserts
|
|
8
|
+
* the value returned by the insert callback and returns it.
|
|
9
|
+
* @param key The key to look up
|
|
10
|
+
* @param insert A callback that returns the value to insert if the key doesn't exist
|
|
11
|
+
* @returns The existing or newly inserted value
|
|
12
|
+
*/
|
|
13
|
+
getOrInsertComputed(key: K, insert: () => V): V;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface WeakMap<K extends object, V> {
|
|
17
|
+
/**
|
|
18
|
+
* Returns the value associated with the key if it exists, otherwise inserts
|
|
19
|
+
* the value returned by the insert callback and returns it.
|
|
20
|
+
* @param key The key to look up
|
|
21
|
+
* @param insert A callback that returns the value to insert if the key doesn't exist
|
|
22
|
+
* @returns The existing or newly inserted value
|
|
23
|
+
*/
|
|
24
|
+
getOrInsertComputed(key: K, insert: () => V): V;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface HTMLTemplateElement {
|
|
28
|
+
remoteContent?: Node;
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Type definitions for id-generation
|
|
2
|
+
|
|
3
|
+
export interface GenIdsOptions {
|
|
4
|
+
//startCounter?: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ParsedDataId {
|
|
8
|
+
name: string;
|
|
9
|
+
setName: boolean;
|
|
10
|
+
setItemprop: boolean;
|
|
11
|
+
setClass: boolean;
|
|
12
|
+
setPart: boolean;
|
|
13
|
+
setItemscope: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ScopeInfo {
|
|
17
|
+
scopeElement: Element;
|
|
18
|
+
elementsToProcess: Element[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AttributeReplacement {
|
|
22
|
+
element: Element;
|
|
23
|
+
attributeName: string;
|
|
24
|
+
oldValue: string;
|
|
25
|
+
newValue: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { EnhancementConfig } from "../assign-gingerly/types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Symbol for smart value assignment
|
|
5
|
+
*/
|
|
6
|
+
export declare const value: symbol;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Symbol for smart display assignment
|
|
10
|
+
*/
|
|
11
|
+
export declare const display: symbol;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Enhancement class that provides smart value and display property inference
|
|
15
|
+
*/
|
|
16
|
+
export declare class Infer<TValue = any, TDisplay = any> {
|
|
17
|
+
get enhancedElement(): Element;
|
|
18
|
+
constructor(enhancedElement?: Element);
|
|
19
|
+
get value(): TValue | undefined;
|
|
20
|
+
set value(nv: TValue);
|
|
21
|
+
get display(): TDisplay | undefined;
|
|
22
|
+
set display(nv: TDisplay);
|
|
23
|
+
get eventType(): string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Registry item for the Infer enhancement
|
|
28
|
+
*/
|
|
29
|
+
export declare const registryItem: EnhancementConfig;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Infer the most appropriate value property for an element
|
|
33
|
+
*/
|
|
34
|
+
export declare function inferValueProperty(element: Element): string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Infer the most appropriate display property for an element
|
|
38
|
+
*/
|
|
39
|
+
export declare function inferDisplayProperty(element: Element): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Infer the most appropriate event type for an element
|
|
43
|
+
*/
|
|
44
|
+
export declare function inferEventType(element: Element): string;
|
|
45
|
+
|
|
46
|
+
export default registryItem;
|