el-maker 0.0.0 → 0.0.1

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.
Files changed (45) hide show
  1. package/.gitmodules +3 -0
  2. package/ElementMaker.js +95 -0
  3. package/Instructions.md +9 -0
  4. package/README.md +105 -1
  5. package/SuggestionForExtending.md +131 -0
  6. package/package.json +19 -3
  7. package/types/.kiro/specs/conversion-template/README.md +128 -0
  8. package/types/.kiro/specs/conversion-template/design.md +360 -0
  9. package/types/.kiro/specs/conversion-template/requirements.md +191 -0
  10. package/types/.kiro/specs/conversion-template/tasks.md +174 -0
  11. package/types/.kiro/steering/coding-standards.md +17 -0
  12. package/types/.kiro/steering/conversion-guide.md +103 -0
  13. package/types/.kiro/steering/declarative-configuration.md +108 -0
  14. package/types/.kiro/steering/emc-json-serializability.md +306 -0
  15. package/types/EnhancementConversionInstructions.md +1626 -0
  16. package/types/LICENSE +21 -0
  17. package/types/NewCustomElementFeature.md +683 -0
  18. package/types/NewEnhancementInstructions.md +395 -0
  19. package/types/README.md +2 -0
  20. package/types/agrace/types.d.ts +11 -0
  21. package/types/assign-gingerly/types.d.ts +476 -0
  22. package/types/be-a-beacon/types.d.ts +17 -0
  23. package/types/be-bound/types.d.ts +61 -0
  24. package/types/be-buttoned-up/types.d.ts +19 -0
  25. package/types/be-clonable/types.d.ts +36 -0
  26. package/types/be-committed/types.d.ts +22 -0
  27. package/types/be-decked-with/types.d.ts +26 -0
  28. package/types/be-delible/types.d.ts +25 -0
  29. package/types/be-reflective/types.d.ts +78 -0
  30. package/types/be-render-neutral/types.d.ts +29 -0
  31. package/types/be-typed/types.d.ts +31 -0
  32. package/types/do-inc/types.d.ts +56 -0
  33. package/types/do-invoke/types.d.ts +38 -0
  34. package/types/do-merge/types.d.ts +28 -0
  35. package/types/do-toggle/types.d.ts +31 -0
  36. package/types/face-up/types.d.ts +100 -0
  37. package/types/global.d.ts +29 -0
  38. package/types/id-generation/types.d.ts +26 -0
  39. package/types/inferencer/types.d.ts +46 -0
  40. package/types/mount-observer/types.d.ts +363 -0
  41. package/types/nested-regex-groups/types.d.ts +101 -0
  42. package/types/roundabout/types.d.ts +255 -0
  43. package/types/templ-maker/types.d.ts +43 -0
  44. package/types/time-ticker/types.d.ts +62 -0
  45. package/types/truth-sourcer/types.d.ts +44 -0
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Shared context passed via getSharedContext — contains everything
3
+ * the Reflector needs to self-activate on spawn.
4
+ */
5
+ export interface ReflectorSharedContext {
6
+ /** The ElementInternals instance for custom state manipulation */
7
+ internals: ElementInternals;
8
+ /** The EventTarget the host dispatches property change events on */
9
+ hostPropagator: EventTarget;
10
+ }
11
+
12
+ /**
13
+ * Context passed to the Reflector feature constructor
14
+ */
15
+ export interface FeatureSpawnContext {
16
+ key: string;
17
+ optIn: any;
18
+ injection: any;
19
+ featuresRegistry: any;
20
+ shared?: ReflectorSharedContext;
21
+ }
22
+
23
+ /**
24
+ * A single custom state export rule parsed from --custom-state-exports
25
+ */
26
+ export interface CustomStateRule {
27
+ /** The custom state name to toggle (e.g. "disabled", "alertTypeIndicatesSuccess") */
28
+ stateName: string;
29
+ /** The property name to observe */
30
+ propName: string;
31
+ /** The condition type */
32
+ conditionType: 'boolean' | 'equals' | 'contains' | 'endsWith' | 'modulo' | 'lessThan' | 'greaterThan' | 'lessThanOrEqual' | 'greaterThanOrEqual';
33
+ /** The comparison value (for non-boolean conditions) */
34
+ compareValue?: string | number;
35
+ /** The modulo divisor (for modulo conditions) */
36
+ moduloDivisor?: number;
37
+ }
38
+
39
+ /**
40
+ * Properties that the Reflector feature exposes.
41
+ * With callbackForwarding, hostPropagator is provided via getSharedContext
42
+ * and the feature self-activates — but the setter remains for manual use cases.
43
+ */
44
+ export interface ReflectorProps {
45
+ /**
46
+ * The EventTarget that the host element uses to propagate property change events.
47
+ * Provided via getSharedContext. Also settable post-spawn for reconnection.
48
+ */
49
+ hostPropagator: EventTarget | null;
50
+ }
51
+
52
+ /**
53
+ * Internal state
54
+ */
55
+ export interface AllProps extends ReflectorProps {
56
+ /**
57
+ * WeakRef to the host custom element
58
+ */
59
+ hostRef: WeakRef<HTMLElement> | null;
60
+
61
+ /**
62
+ * The ElementInternals instance from the host (for custom state manipulation)
63
+ */
64
+ internals: ElementInternals | null;
65
+
66
+ /**
67
+ * Parsed custom state rules from --custom-state-exports CSS property
68
+ */
69
+ rules: CustomStateRule[];
70
+
71
+ /**
72
+ * AbortController for cleaning up event listeners
73
+ */
74
+ abortController: AbortController | null;
75
+ }
76
+
77
+ export type AP = AllProps;
78
+ export type PAP = Partial<AP>;
@@ -0,0 +1,29 @@
1
+ export interface RenderingHTMLScriptElement extends HTMLScriptElement{
2
+ renderer: (vm: any, html: any) => any,
3
+ }
4
+
5
+ export interface EndUserProps{
6
+ vm: any,
7
+ with: Array<string>,
8
+ }
9
+
10
+ export type Renderer = (vm: any, html: any) => any;
11
+
12
+ export interface AllProps extends EndUserProps{
13
+ enhancedElement: Element;
14
+ renderer: Renderer,
15
+ absorbingObject: any
16
+ }
17
+
18
+ export type PAP = Partial<AllProps>;
19
+
20
+ export type AP = AllProps;
21
+
22
+ export type ProPAP = Promise<PAP>;
23
+
24
+ export interface Actions {
25
+ getRenderer(self: AP): PAP;
26
+ doRender(self: AP): void;
27
+ observe(self: AP): ProPAP;
28
+ absorb(self: AP, e?: Event): ProPAP;
29
+ }
@@ -0,0 +1,31 @@
1
+ export interface EndUserProps {
2
+ triggerInsertPosition: InsertPosition;
3
+ labelTextContainer: string;
4
+ buttonContent: string;
5
+ nudge?: boolean;
6
+ }
7
+
8
+ export interface AllProps extends EndUserProps{
9
+ enhancedElement: Element;
10
+ byob?: boolean;
11
+ trigger: WeakRef<HTMLButtonElement>
12
+ }
13
+
14
+ export type AP = AllProps;
15
+
16
+ export type PAP = Partial<AP>;
17
+
18
+ export type ProPAP = Promise<PAP>;
19
+
20
+
21
+
22
+ export interface Actions{
23
+ addTypeBtn(self: AP): ProPAP;
24
+ setBtnContent(self: AP): void;
25
+ openDialog(self: AP): Promise<void>
26
+ }
27
+
28
+ export interface ITyper{
29
+ showDialog(): void;
30
+ dispose(): void;
31
+ }
@@ -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,100 @@
1
+ /**
2
+ * Shared context passed via getSharedContext — contains the
3
+ * ElementInternals instance needed for form control APIs.
4
+ */
5
+ export interface FaceUpSharedContext {
6
+ /** The ElementInternals instance for form control APIs */
7
+ internals: ElementInternals;
8
+ }
9
+
10
+ /**
11
+ * Context passed to the FaceUp feature constructor
12
+ */
13
+ export interface FeatureSpawnContext {
14
+ key: string;
15
+ optIn: any;
16
+ injection: any;
17
+ featuresRegistry: any;
18
+ shared?: FaceUpSharedContext;
19
+ }
20
+
21
+ /**
22
+ * Validation flags matching the ValidityStateFlags interface.
23
+ * Used with setValidity() to indicate the type of validation error.
24
+ */
25
+ export interface ValidationFlags {
26
+ valueMissing?: boolean;
27
+ typeMismatch?: boolean;
28
+ patternMismatch?: boolean;
29
+ tooLong?: boolean;
30
+ tooShort?: boolean;
31
+ rangeUnderflow?: boolean;
32
+ rangeOverflow?: boolean;
33
+ stepMismatch?: boolean;
34
+ badInput?: boolean;
35
+ customError?: boolean;
36
+ }
37
+
38
+ /**
39
+ * Properties that the FaceUp feature exposes.
40
+ * These allow the host custom element to participate in HTML forms
41
+ * via the ElementInternals API.
42
+ *
43
+ * Because the feature is installed as a getter-only property,
44
+ * assignGingerly merges directly into the instance. The consumer
45
+ * simply sets properties (e.g., el.faceUp.value = x) and the
46
+ * setters handle syncing to ElementInternals automatically.
47
+ */
48
+ export interface FaceUpProps {
49
+ /**
50
+ * The current form value of the control.
51
+ * Setting this calls setFormValue() on the internals.
52
+ */
53
+ value: string | File | FormData | null;
54
+
55
+ /**
56
+ * Internal state for form restoration (optional).
57
+ * If provided, passed as the second argument to setFormValue().
58
+ */
59
+ state: string | File | FormData | null;
60
+
61
+ /**
62
+ * Whether the control is currently disabled.
63
+ */
64
+ disabled: boolean;
65
+
66
+ /**
67
+ * Whether the control requires a value for form submission.
68
+ */
69
+ required: boolean;
70
+
71
+ /**
72
+ * Custom validation message. Setting a non-empty string
73
+ * marks the control as invalid with customError.
74
+ */
75
+ validationMessage: string;
76
+ }
77
+
78
+ /**
79
+ * Internal state
80
+ */
81
+ export interface AllProps extends FaceUpProps {
82
+ /**
83
+ * WeakRef to the host custom element
84
+ */
85
+ hostRef: WeakRef<HTMLElement> | null;
86
+
87
+ /**
88
+ * The ElementInternals instance from the host (for form control APIs)
89
+ */
90
+ internals: ElementInternals | null;
91
+ }
92
+
93
+ export type AP = AllProps;
94
+ export type PAP = Partial<AP>;
95
+
96
+
97
+
98
+ export interface CustomData {
99
+ integrateWithRoundabout: boolean;
100
+ }
@@ -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;