@joralvmel/cosmos-core 0.2.0 → 0.4.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.
Files changed (157) hide show
  1. package/dist/catalog.d.ts +3 -3
  2. package/dist/catalog.d.ts.map +1 -1
  3. package/dist/catalog.js +25 -6
  4. package/dist/catalog.js.map +1 -1
  5. package/dist/codegen.d.ts +16 -0
  6. package/dist/codegen.d.ts.map +1 -1
  7. package/dist/codegen.js +396 -57
  8. package/dist/codegen.js.map +1 -1
  9. package/dist/headless/calendar.d.ts +32 -0
  10. package/dist/headless/calendar.d.ts.map +1 -0
  11. package/dist/headless/calendar.js +242 -0
  12. package/dist/headless/calendar.js.map +1 -0
  13. package/dist/headless/listbox.d.ts +9 -0
  14. package/dist/headless/listbox.d.ts.map +1 -0
  15. package/dist/headless/listbox.js +103 -0
  16. package/dist/headless/listbox.js.map +1 -0
  17. package/dist/headless/pagination.d.ts +34 -0
  18. package/dist/headless/pagination.d.ts.map +1 -0
  19. package/dist/headless/pagination.js +92 -0
  20. package/dist/headless/pagination.js.map +1 -0
  21. package/dist/headless/radio-group.d.ts +10 -0
  22. package/dist/headless/radio-group.d.ts.map +1 -0
  23. package/dist/headless/radio-group.js +59 -0
  24. package/dist/headless/radio-group.js.map +1 -0
  25. package/dist/headless/select.d.ts +4 -0
  26. package/dist/headless/select.d.ts.map +1 -0
  27. package/dist/headless/select.js +7 -0
  28. package/dist/headless/select.js.map +1 -0
  29. package/dist/headless/size.d.ts +3 -0
  30. package/dist/headless/size.d.ts.map +1 -0
  31. package/dist/headless/size.js +7 -0
  32. package/dist/headless/size.js.map +1 -0
  33. package/dist/headless/text-field.d.ts +25 -0
  34. package/dist/headless/text-field.d.ts.map +1 -0
  35. package/dist/headless/text-field.js +12 -0
  36. package/dist/headless/text-field.js.map +1 -0
  37. package/dist/index.d.ts +1709 -19
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +60 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/markdown.d.ts.map +1 -1
  42. package/dist/markdown.js +7 -3
  43. package/dist/markdown.js.map +1 -1
  44. package/dist/specs/badge.d.ts +65 -0
  45. package/dist/specs/badge.d.ts.map +1 -0
  46. package/dist/specs/badge.js +64 -0
  47. package/dist/specs/badge.js.map +1 -0
  48. package/dist/specs/badge.scenarios.d.ts +21 -0
  49. package/dist/specs/badge.scenarios.d.ts.map +1 -0
  50. package/dist/specs/badge.scenarios.js +35 -0
  51. package/dist/specs/badge.scenarios.js.map +1 -0
  52. package/dist/specs/calendar.d.ts +120 -0
  53. package/dist/specs/calendar.d.ts.map +1 -0
  54. package/dist/specs/calendar.js +121 -0
  55. package/dist/specs/calendar.js.map +1 -0
  56. package/dist/specs/calendar.scenarios.d.ts +39 -0
  57. package/dist/specs/calendar.scenarios.d.ts.map +1 -0
  58. package/dist/specs/calendar.scenarios.js +139 -0
  59. package/dist/specs/calendar.scenarios.js.map +1 -0
  60. package/dist/specs/checkbox.d.ts +139 -0
  61. package/dist/specs/checkbox.d.ts.map +1 -0
  62. package/dist/specs/checkbox.js +129 -0
  63. package/dist/specs/checkbox.js.map +1 -0
  64. package/dist/specs/checkbox.scenarios.d.ts +28 -0
  65. package/dist/specs/checkbox.scenarios.d.ts.map +1 -0
  66. package/dist/specs/checkbox.scenarios.js +54 -0
  67. package/dist/specs/checkbox.scenarios.js.map +1 -0
  68. package/dist/specs/dialog.d.ts +167 -0
  69. package/dist/specs/dialog.d.ts.map +1 -0
  70. package/dist/specs/dialog.js +136 -0
  71. package/dist/specs/dialog.js.map +1 -0
  72. package/dist/specs/dialog.scenarios.d.ts +42 -0
  73. package/dist/specs/dialog.scenarios.d.ts.map +1 -0
  74. package/dist/specs/dialog.scenarios.js +129 -0
  75. package/dist/specs/dialog.scenarios.js.map +1 -0
  76. package/dist/specs/icon-button.d.ts +136 -0
  77. package/dist/specs/icon-button.d.ts.map +1 -0
  78. package/dist/specs/icon-button.js +119 -0
  79. package/dist/specs/icon-button.js.map +1 -0
  80. package/dist/specs/icon-button.scenarios.d.ts +28 -0
  81. package/dist/specs/icon-button.scenarios.d.ts.map +1 -0
  82. package/dist/specs/icon-button.scenarios.js +95 -0
  83. package/dist/specs/icon-button.scenarios.js.map +1 -0
  84. package/dist/specs/icon.d.ts +11 -20
  85. package/dist/specs/icon.d.ts.map +1 -1
  86. package/dist/specs/icon.js +11 -20
  87. package/dist/specs/icon.js.map +1 -1
  88. package/dist/specs/icon.scenarios.d.ts +9 -1
  89. package/dist/specs/icon.scenarios.d.ts.map +1 -1
  90. package/dist/specs/icon.scenarios.js +70 -6
  91. package/dist/specs/icon.scenarios.js.map +1 -1
  92. package/dist/specs/listbox.d.ts +157 -0
  93. package/dist/specs/listbox.d.ts.map +1 -0
  94. package/dist/specs/listbox.js +144 -0
  95. package/dist/specs/listbox.js.map +1 -0
  96. package/dist/specs/listbox.scenarios.d.ts +37 -0
  97. package/dist/specs/listbox.scenarios.d.ts.map +1 -0
  98. package/dist/specs/listbox.scenarios.js +110 -0
  99. package/dist/specs/listbox.scenarios.js.map +1 -0
  100. package/dist/specs/pagination.d.ts +147 -0
  101. package/dist/specs/pagination.d.ts.map +1 -0
  102. package/dist/specs/pagination.js +122 -0
  103. package/dist/specs/pagination.js.map +1 -0
  104. package/dist/specs/pagination.scenarios.d.ts +15 -0
  105. package/dist/specs/pagination.scenarios.d.ts.map +1 -0
  106. package/dist/specs/pagination.scenarios.js +29 -0
  107. package/dist/specs/pagination.scenarios.js.map +1 -0
  108. package/dist/specs/popover.d.ts +201 -0
  109. package/dist/specs/popover.d.ts.map +1 -0
  110. package/dist/specs/popover.js +169 -0
  111. package/dist/specs/popover.js.map +1 -0
  112. package/dist/specs/popover.scenarios.d.ts +83 -0
  113. package/dist/specs/popover.scenarios.d.ts.map +1 -0
  114. package/dist/specs/popover.scenarios.js +368 -0
  115. package/dist/specs/popover.scenarios.js.map +1 -0
  116. package/dist/specs/radio-group.d.ts +154 -0
  117. package/dist/specs/radio-group.d.ts.map +1 -0
  118. package/dist/specs/radio-group.js +133 -0
  119. package/dist/specs/radio-group.js.map +1 -0
  120. package/dist/specs/radio-group.scenarios.d.ts +35 -0
  121. package/dist/specs/radio-group.scenarios.d.ts.map +1 -0
  122. package/dist/specs/radio-group.scenarios.js +67 -0
  123. package/dist/specs/radio-group.scenarios.js.map +1 -0
  124. package/dist/specs/select.d.ts +167 -0
  125. package/dist/specs/select.d.ts.map +1 -0
  126. package/dist/specs/select.js +148 -0
  127. package/dist/specs/select.js.map +1 -0
  128. package/dist/specs/select.scenarios.d.ts +37 -0
  129. package/dist/specs/select.scenarios.d.ts.map +1 -0
  130. package/dist/specs/select.scenarios.js +77 -0
  131. package/dist/specs/select.scenarios.js.map +1 -0
  132. package/dist/specs/switch.d.ts +123 -0
  133. package/dist/specs/switch.d.ts.map +1 -0
  134. package/dist/specs/switch.js +113 -0
  135. package/dist/specs/switch.js.map +1 -0
  136. package/dist/specs/switch.scenarios.d.ts +27 -0
  137. package/dist/specs/switch.scenarios.d.ts.map +1 -0
  138. package/dist/specs/switch.scenarios.js +54 -0
  139. package/dist/specs/switch.scenarios.js.map +1 -0
  140. package/dist/specs/text-field.d.ts +232 -0
  141. package/dist/specs/text-field.d.ts.map +1 -0
  142. package/dist/specs/text-field.js +220 -0
  143. package/dist/specs/text-field.js.map +1 -0
  144. package/dist/specs/text-field.scenarios.d.ts +52 -0
  145. package/dist/specs/text-field.scenarios.d.ts.map +1 -0
  146. package/dist/specs/text-field.scenarios.js +106 -0
  147. package/dist/specs/text-field.scenarios.js.map +1 -0
  148. package/dist/specs/textarea.d.ts +144 -0
  149. package/dist/specs/textarea.d.ts.map +1 -0
  150. package/dist/specs/textarea.js +134 -0
  151. package/dist/specs/textarea.js.map +1 -0
  152. package/dist/specs/textarea.scenarios.d.ts +33 -0
  153. package/dist/specs/textarea.scenarios.d.ts.map +1 -0
  154. package/dist/specs/textarea.scenarios.js +82 -0
  155. package/dist/specs/textarea.scenarios.js.map +1 -0
  156. package/llms.md +797 -6
  157. package/package.json +1 -1
@@ -0,0 +1,77 @@
1
+ export const selectScenarioItems = [
2
+ { value: 'apple', label: 'Apple' },
3
+ { value: 'cherry', label: 'Cherry' },
4
+ { value: 'lime', label: 'Lime', disabled: true },
5
+ ];
6
+ const baseProps = {
7
+ label: 'Fruit',
8
+ items: selectScenarioItems,
9
+ placeholder: 'Choose a fruit',
10
+ };
11
+ export const selectScenarios = [
12
+ {
13
+ name: 'starts without a selection',
14
+ props: baseProps,
15
+ actions: [],
16
+ expected: { value: null, changes: [] },
17
+ },
18
+ {
19
+ name: 'supports the filled variant',
20
+ props: { ...baseProps, variant: 'filled' },
21
+ actions: [],
22
+ expected: { value: null, changes: [] },
23
+ },
24
+ {
25
+ name: 'initializes autonomous selection from defaultValue',
26
+ props: { ...baseProps, defaultValue: 'apple' },
27
+ actions: [],
28
+ expected: { value: 'apple', changes: [] },
29
+ },
30
+ {
31
+ name: 'commits autonomous selection and emits its proposal',
32
+ props: baseProps,
33
+ actions: [{ type: 'select', value: 'cherry' }],
34
+ expected: { value: 'cherry', changes: ['cherry'] },
35
+ },
36
+ {
37
+ name: 'controlled selection waits for the owner',
38
+ props: { ...baseProps, value: 'apple' },
39
+ actions: [{ type: 'select', value: 'cherry' }],
40
+ expected: { value: 'apple', changes: ['cherry'] },
41
+ },
42
+ {
43
+ name: 'controlled null remains unselected until the owner accepts',
44
+ props: { ...baseProps, value: null },
45
+ actions: [{ type: 'select', value: 'apple' }],
46
+ expected: { value: null, changes: ['apple'] },
47
+ },
48
+ {
49
+ name: 'controlled selection commits after the owner updates',
50
+ props: { ...baseProps, value: 'apple' },
51
+ actions: [
52
+ { type: 'select', value: 'cherry' },
53
+ { type: 'set-value', value: 'cherry' },
54
+ ],
55
+ expected: { value: 'cherry', changes: ['cherry'] },
56
+ },
57
+ {
58
+ name: 'does not emit when the selected option is activated',
59
+ props: { ...baseProps, defaultValue: 'apple' },
60
+ actions: [{ type: 'select', value: 'apple' }],
61
+ expected: { value: 'apple', changes: [] },
62
+ },
63
+ {
64
+ name: 'does not select a disabled option',
65
+ props: baseProps,
66
+ actions: [{ type: 'select', value: 'lime' }],
67
+ expected: { value: null, changes: [] },
68
+ },
69
+ {
70
+ name: 'does not select an option when the control is disabled',
71
+ props: { ...baseProps, disabled: true },
72
+ actions: [{ type: 'select', value: 'apple' }],
73
+ expected: { value: null, changes: [] },
74
+ },
75
+ ];
76
+ export const selectScenariosFor = (platform) => selectScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
77
+ //# sourceMappingURL=select.scenarios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.scenarios.js","sourceRoot":"","sources":["../../src/specs/select.scenarios.ts"],"names":[],"mappings":"AAgCA,MAAM,CAAC,MAAM,mBAAmB,GAAgB;IAC9C,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;CACjD,CAAC;AAEF,MAAM,SAAS,GAAG;IAChB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAA8B;IACxD;QACE,IAAI,EAAE,4BAA4B;QAClC,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;KACvC;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC1C,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;KACvC;I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C;QACD,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE;KACnD;IACD;QACE,IAAI,EAAE,qDAAqD;QAC3D,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE;QAC9C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAC7C,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;KAC1C;IACD;QACE,IAAI,EAAE,mCAAmC;QACzC,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAC5C,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;KACvC;IACD;QACE,IAAI,EAAE,wDAAwD;QAC9D,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QACvC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAC7C,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;KACvC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAkB,EAAE,EAAE,CACvD,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,123 @@
1
+ /** A proposed checked value after the switch is activated. */
2
+ export interface SwitchCheckedChangeDetail {
3
+ checked: boolean;
4
+ }
5
+ /**
6
+ * An immediate binary setting with autonomous or controlled checked state.
7
+ *
8
+ * | State | Autonomous | Controlled | Event |
9
+ * | --- | --- | --- | --- |
10
+ * | checked | Starts at defaultChecked and commits activation | A supplied checked, including false, waits for the owner | checkedChange |
11
+ */
12
+ export declare const switchContract: {
13
+ readonly name: "switch";
14
+ readonly tag: "cosm-switch";
15
+ readonly description: "Toggles a binary setting immediately with a stable accessible name and form behavior on the web.";
16
+ readonly role: "switch";
17
+ readonly pattern: "https://www.w3.org/WAI/ARIA/apg/patterns/switch/";
18
+ readonly props: {
19
+ readonly label: {
20
+ readonly type: "string";
21
+ readonly required: true;
22
+ readonly description: "Required nonempty accessible name; remains stable in both states.";
23
+ };
24
+ readonly labelHidden: {
25
+ readonly type: "boolean";
26
+ readonly default: false;
27
+ readonly reflect: true;
28
+ readonly description: "Visually hides the label while retaining its accessible name.";
29
+ };
30
+ readonly checked: {
31
+ readonly type: "boolean";
32
+ readonly default: false;
33
+ readonly description: "Controlled checked value when supplied, including false; activation proposes changes without self-committing.";
34
+ };
35
+ readonly defaultChecked: {
36
+ readonly type: "boolean";
37
+ readonly default: false;
38
+ readonly description: "Initial autonomous checked value; later changes do not reset it.";
39
+ };
40
+ readonly size: {
41
+ readonly type: "enum";
42
+ readonly values: readonly ["sm", "md", "lg"];
43
+ readonly default: "md";
44
+ readonly reflect: true;
45
+ readonly platforms: readonly ["web", "react", "angular"];
46
+ readonly description: "Small, medium or large web switch. Native uses system Switch sizing.";
47
+ };
48
+ readonly disabled: {
49
+ readonly type: "boolean";
50
+ readonly default: false;
51
+ readonly reflect: true;
52
+ readonly description: "Prevents user interaction and excludes the value from web form submission.";
53
+ };
54
+ readonly invalid: {
55
+ readonly type: "boolean";
56
+ readonly default: false;
57
+ readonly reflect: true;
58
+ readonly description: "Externally supplied invalid presentation. Does not change checked state or form validity; native uses danger colors without an equivalent system invalid trait.";
59
+ };
60
+ readonly helperText: {
61
+ readonly type: "string";
62
+ readonly description: "Optional consumer-localized supporting text associated with the switch.";
63
+ };
64
+ readonly name: {
65
+ readonly type: "string";
66
+ readonly reflect: true;
67
+ readonly platforms: readonly ["web", "react", "angular"];
68
+ readonly description: "Web form field name; React Native has no HTML form association.";
69
+ };
70
+ readonly value: {
71
+ readonly type: "string";
72
+ readonly default: "on";
73
+ readonly platforms: readonly ["web", "react", "angular"];
74
+ readonly description: "Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value.";
75
+ };
76
+ };
77
+ readonly events: {
78
+ readonly checkedChange: {
79
+ readonly description: "Proposes the next checked value after enabled user activation; controlled state waits for the owner.";
80
+ readonly detail: "SwitchCheckedChangeDetail";
81
+ readonly names: {
82
+ readonly dom: "cosm-checked-change";
83
+ readonly react: "onCheckedChange";
84
+ readonly angular: "checkedChange";
85
+ readonly native: "onCheckedChange";
86
+ };
87
+ };
88
+ };
89
+ readonly states: readonly [{
90
+ readonly prop: "checked";
91
+ readonly event: "checkedChange";
92
+ readonly defaultProp: "defaultChecked";
93
+ }];
94
+ readonly slots: {};
95
+ readonly parts: {
96
+ readonly base: "Label, control and supporting text layout.";
97
+ readonly input: "Native checkbox input and web focus target.";
98
+ readonly track: "Visible switch track.";
99
+ readonly thumb: "Visible switch thumb.";
100
+ readonly label: "Visible or visually hidden label text.";
101
+ readonly 'help-text': "Supporting text associated with the switch.";
102
+ };
103
+ readonly cssProperties: {
104
+ readonly '--cosm-switch-width': "Track width.";
105
+ readonly '--cosm-switch-height': "Track height.";
106
+ readonly '--cosm-switch-thumb-size': "Thumb diameter.";
107
+ readonly '--cosm-switch-track-background': "Unchecked track background.";
108
+ readonly '--cosm-switch-checked-track-background': "Checked track background.";
109
+ readonly '--cosm-switch-thumb-background': "Thumb background.";
110
+ readonly '--cosm-switch-border': "Unchecked track boundary color.";
111
+ readonly '--cosm-switch-radius': "Track corner radius.";
112
+ readonly '--cosm-switch-gap': "Space between the switch and label.";
113
+ readonly '--cosm-switch-focus': "Visible keyboard focus indicator color.";
114
+ };
115
+ readonly keyboard: readonly [{
116
+ readonly keys: readonly ["Tab", "Shift+Tab"];
117
+ readonly action: "Moves focus to or from the enabled switch.";
118
+ }, {
119
+ readonly keys: readonly ["Space"];
120
+ readonly action: "Toggles checked state and emits a checkedChange proposal.";
121
+ }];
122
+ };
123
+ //# sourceMappingURL=switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/specs/switch.ts"],"names":[],"mappings":"AAEA,8DAA8D;AAC9D,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GzB,CAAC"}
@@ -0,0 +1,113 @@
1
+ import { defineContract } from '../contract.js';
2
+ /**
3
+ * An immediate binary setting with autonomous or controlled checked state.
4
+ *
5
+ * | State | Autonomous | Controlled | Event |
6
+ * | --- | --- | --- | --- |
7
+ * | checked | Starts at defaultChecked and commits activation | A supplied checked, including false, waits for the owner | checkedChange |
8
+ */
9
+ export const switchContract = defineContract({
10
+ name: 'switch',
11
+ tag: 'cosm-switch',
12
+ description: 'Toggles a binary setting immediately with a stable accessible name and form behavior on the web.',
13
+ role: 'switch',
14
+ pattern: 'https://www.w3.org/WAI/ARIA/apg/patterns/switch/',
15
+ props: {
16
+ label: {
17
+ type: 'string',
18
+ required: true,
19
+ description: 'Required nonempty accessible name; remains stable in both states.',
20
+ },
21
+ labelHidden: {
22
+ type: 'boolean',
23
+ default: false,
24
+ reflect: true,
25
+ description: 'Visually hides the label while retaining its accessible name.',
26
+ },
27
+ checked: {
28
+ type: 'boolean',
29
+ default: false,
30
+ description: 'Controlled checked value when supplied, including false; activation proposes changes without self-committing.',
31
+ },
32
+ defaultChecked: {
33
+ type: 'boolean',
34
+ default: false,
35
+ description: 'Initial autonomous checked value; later changes do not reset it.',
36
+ },
37
+ size: {
38
+ type: 'enum',
39
+ values: ['sm', 'md', 'lg'],
40
+ default: 'md',
41
+ reflect: true,
42
+ platforms: ['web', 'react', 'angular'],
43
+ description: 'Small, medium or large web switch. Native uses system Switch sizing.',
44
+ },
45
+ disabled: {
46
+ type: 'boolean',
47
+ default: false,
48
+ reflect: true,
49
+ description: 'Prevents user interaction and excludes the value from web form submission.',
50
+ },
51
+ invalid: {
52
+ type: 'boolean',
53
+ default: false,
54
+ reflect: true,
55
+ description: 'Externally supplied invalid presentation. Does not change checked state or form validity; native uses danger colors without an equivalent system invalid trait.',
56
+ },
57
+ helperText: {
58
+ type: 'string',
59
+ description: 'Optional consumer-localized supporting text associated with the switch.',
60
+ },
61
+ name: {
62
+ type: 'string',
63
+ reflect: true,
64
+ platforms: ['web', 'react', 'angular'],
65
+ description: 'Web form field name; React Native has no HTML form association.',
66
+ },
67
+ value: {
68
+ type: 'string',
69
+ default: 'on',
70
+ platforms: ['web', 'react', 'angular'],
71
+ description: 'Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value.',
72
+ },
73
+ },
74
+ events: {
75
+ checkedChange: {
76
+ description: 'Proposes the next checked value after enabled user activation; controlled state waits for the owner.',
77
+ detail: 'SwitchCheckedChangeDetail',
78
+ names: {
79
+ dom: 'cosm-checked-change',
80
+ react: 'onCheckedChange',
81
+ angular: 'checkedChange',
82
+ native: 'onCheckedChange',
83
+ },
84
+ },
85
+ },
86
+ states: [{ prop: 'checked', event: 'checkedChange', defaultProp: 'defaultChecked' }],
87
+ slots: {},
88
+ parts: {
89
+ base: 'Label, control and supporting text layout.',
90
+ input: 'Native checkbox input and web focus target.',
91
+ track: 'Visible switch track.',
92
+ thumb: 'Visible switch thumb.',
93
+ label: 'Visible or visually hidden label text.',
94
+ 'help-text': 'Supporting text associated with the switch.',
95
+ },
96
+ cssProperties: {
97
+ '--cosm-switch-width': 'Track width.',
98
+ '--cosm-switch-height': 'Track height.',
99
+ '--cosm-switch-thumb-size': 'Thumb diameter.',
100
+ '--cosm-switch-track-background': 'Unchecked track background.',
101
+ '--cosm-switch-checked-track-background': 'Checked track background.',
102
+ '--cosm-switch-thumb-background': 'Thumb background.',
103
+ '--cosm-switch-border': 'Unchecked track boundary color.',
104
+ '--cosm-switch-radius': 'Track corner radius.',
105
+ '--cosm-switch-gap': 'Space between the switch and label.',
106
+ '--cosm-switch-focus': 'Visible keyboard focus indicator color.',
107
+ },
108
+ keyboard: [
109
+ { keys: ['Tab', 'Shift+Tab'], action: 'Moves focus to or from the enabled switch.' },
110
+ { keys: ['Space'], action: 'Toggles checked state and emits a checkedChange proposal.' },
111
+ ],
112
+ });
113
+ //# sourceMappingURL=switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/specs/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAOhD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,aAAa;IAClB,WAAW,EACT,kGAAkG;IACpG,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,kDAAkD;IAC3D,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,mEAAmE;SACjF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,+DAA+D;SAC7E;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EACT,+GAA+G;SAClH;QACD,cAAc,EAAE;YACd,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,kEAAkE;SAChF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,CAAC,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D,KAAK,EAAE,uBAAuB;QAC9B,KAAK,EAAE,uBAAuB;QAC9B,KAAK,EAAE,wCAAwC;QAC/C,WAAW,EAAE,6CAA6C;KAC3D;IACD,aAAa,EAAE;QACb,qBAAqB,EAAE,cAAc;QACrC,sBAAsB,EAAE,eAAe;QACvC,0BAA0B,EAAE,iBAAiB;QAC7C,gCAAgC,EAAE,6BAA6B;QAC/D,wCAAwC,EAAE,2BAA2B;QACrE,gCAAgC,EAAE,mBAAmB;QACrD,sBAAsB,EAAE,iCAAiC;QACzD,sBAAsB,EAAE,sBAAsB;QAC9C,mBAAmB,EAAE,qCAAqC;QAC1D,qBAAqB,EAAE,yCAAyC;KACjE;IACD,QAAQ,EAAE;QACR,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,4CAA4C,EAAE;QACpF,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,2DAA2D,EAAE;KACzF;CACF,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Platform } from '../contract.js';
2
+ export type SwitchAction = {
3
+ type: 'activate';
4
+ } | {
5
+ type: 'sync';
6
+ checked: boolean;
7
+ };
8
+ export interface SwitchScenario {
9
+ name: string;
10
+ props: {
11
+ label: string;
12
+ checked?: boolean;
13
+ defaultChecked?: boolean;
14
+ disabled?: boolean;
15
+ invalid?: boolean;
16
+ };
17
+ actions: readonly SwitchAction[];
18
+ expected: {
19
+ checked: boolean;
20
+ changes: readonly boolean[];
21
+ };
22
+ platforms?: readonly Platform[];
23
+ }
24
+ /** Normative checked-state cases shared by platform drivers. */
25
+ export declare const switchScenarios: readonly SwitchScenario[];
26
+ export declare const switchScenariosFor: (platform: Platform) => SwitchScenario[];
27
+ //# sourceMappingURL=switch.scenarios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/switch.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAErF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IACjC,QAAQ,EAAE;QACR,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;KAC7B,CAAC;IACF,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACjC;AAID,gEAAgE;AAChE,eAAO,MAAM,eAAe,EAAE,SAAS,cAAc,EAiDpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,UAAU,QAAQ,qBAC6C,CAAC"}
@@ -0,0 +1,54 @@
1
+ const fixture = { label: 'Enable notifications' };
2
+ /** Normative checked-state cases shared by platform drivers. */
3
+ export const switchScenarios = [
4
+ {
5
+ name: 'starts unchecked without a proposal',
6
+ props: fixture,
7
+ actions: [],
8
+ expected: { checked: false, changes: [] },
9
+ },
10
+ {
11
+ name: 'defaultChecked initializes autonomous state',
12
+ props: { ...fixture, defaultChecked: true },
13
+ actions: [],
14
+ expected: { checked: true, changes: [] },
15
+ },
16
+ {
17
+ name: 'autonomous activation toggles and proposes each next value',
18
+ props: fixture,
19
+ actions: [{ type: 'activate' }, { type: 'activate' }],
20
+ expected: { checked: false, changes: [true, false] },
21
+ },
22
+ {
23
+ name: 'disabled prevents activation and proposals',
24
+ props: { ...fixture, disabled: true, defaultChecked: true },
25
+ actions: [{ type: 'activate' }],
26
+ expected: { checked: true, changes: [] },
27
+ },
28
+ {
29
+ name: 'a controlled false value refuses proposals without self-committing',
30
+ props: { ...fixture, checked: false },
31
+ actions: [{ type: 'activate' }, { type: 'activate' }],
32
+ expected: { checked: false, changes: [true, true] },
33
+ },
34
+ {
35
+ name: 'invalid presentation does not block autonomous activation',
36
+ props: { ...fixture, invalid: true },
37
+ actions: [{ type: 'activate' }],
38
+ expected: { checked: true, changes: [true] },
39
+ },
40
+ {
41
+ name: 'invalid presentation preserves controlled proposal ownership',
42
+ props: { ...fixture, invalid: true, checked: false },
43
+ actions: [{ type: 'activate' }],
44
+ expected: { checked: false, changes: [true] },
45
+ },
46
+ {
47
+ name: 'controlled state follows the value accepted by the owner',
48
+ props: { ...fixture, checked: false },
49
+ actions: [{ type: 'activate' }, { type: 'sync', checked: true }, { type: 'activate' }],
50
+ expected: { checked: true, changes: [true, false] },
51
+ },
52
+ ];
53
+ export const switchScenariosFor = (platform) => switchScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
54
+ //# sourceMappingURL=switch.scenarios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.scenarios.js","sourceRoot":"","sources":["../../src/specs/switch.scenarios.ts"],"names":[],"mappings":"AAqBA,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;AAElD,gEAAgE;AAChE,MAAM,CAAC,MAAM,eAAe,GAA8B;IACxD;QACE,IAAI,EAAE,qCAAqC;QAC3C,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;KAC1C;IACD;QACE,IAAI,EAAE,6CAA6C;QACnD,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE;QAC3C,OAAO,EAAE,EAAE;QACX,QAAQ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O,EAAE,KAAK,EAAE;QACpD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAC/B,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE;KAC9C;IACD;QACE,IAAI,EAAE,0DAA0D;QAChE,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QACrC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QACtF,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;KACpD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAkB,EAAE,EAAE,CACvD,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,232 @@
1
+ /** Value proposed when the user edits or clears a text field. */
2
+ export interface TextFieldChangeDetail {
3
+ value: string;
4
+ }
5
+ /** Current value when the user invokes the field's submit action. */
6
+ export interface TextFieldSubmitDetail {
7
+ value: string;
8
+ }
9
+ /**
10
+ * Single-line text entry with an accessible label and native form semantics on the web.
11
+ * The editable value follows the controlled/autonomous ownership rules in ADR 0003.
12
+ */
13
+ export declare const textFieldContract: {
14
+ readonly name: "text-field";
15
+ readonly tag: "cosm-text-field";
16
+ readonly description: "Accepts a single line of text with an accessible label, optional helper and error text, and native form validation on the web.";
17
+ readonly role: "textbox";
18
+ readonly pattern: "https://html.spec.whatwg.org/multipage/input.html";
19
+ readonly props: {
20
+ readonly label: {
21
+ readonly type: "string";
22
+ readonly required: true;
23
+ readonly description: "Accessible name for the editable control. It is rendered above the control unless visually hidden.";
24
+ };
25
+ readonly labelHidden: {
26
+ readonly type: "boolean";
27
+ readonly default: false;
28
+ readonly reflect: true;
29
+ readonly description: "Visually hides the label while keeping it available to assistive technology.";
30
+ };
31
+ readonly value: {
32
+ readonly type: "string";
33
+ readonly description: "Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value.";
34
+ };
35
+ readonly defaultValue: {
36
+ readonly type: "string";
37
+ readonly default: "";
38
+ readonly description: "Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits.";
39
+ };
40
+ readonly type: {
41
+ readonly type: "enum";
42
+ readonly values: readonly ["text", "email", "password", "tel", "url", "search"];
43
+ readonly default: "text";
44
+ readonly reflect: true;
45
+ readonly description: "Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior.";
46
+ };
47
+ readonly variant: {
48
+ readonly type: "enum";
49
+ readonly values: readonly ["outlined", "filled"];
50
+ readonly default: "outlined";
51
+ readonly reflect: true;
52
+ readonly description: "Visual treatment of the editable control.";
53
+ };
54
+ readonly size: {
55
+ readonly type: "enum";
56
+ readonly values: readonly ["sm", "md", "lg"];
57
+ readonly default: "md";
58
+ readonly reflect: true;
59
+ readonly description: "Small, medium or large editable control.";
60
+ };
61
+ readonly placeholder: {
62
+ readonly type: "string";
63
+ readonly description: "Short input hint; it never replaces the accessible label.";
64
+ };
65
+ readonly helperText: {
66
+ readonly type: "string";
67
+ readonly description: "Optional supporting text associated with the editable control.";
68
+ };
69
+ readonly errorText: {
70
+ readonly type: "string";
71
+ readonly description: "Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state.";
72
+ };
73
+ readonly invalid: {
74
+ readonly type: "boolean";
75
+ readonly default: false;
76
+ readonly reflect: true;
77
+ readonly description: "External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation.";
78
+ };
79
+ readonly required: {
80
+ readonly type: "boolean";
81
+ readonly default: false;
82
+ readonly reflect: true;
83
+ readonly description: "Exposes required semantics. On web, participates in native HTML constraint validation.";
84
+ };
85
+ readonly disabled: {
86
+ readonly type: "boolean";
87
+ readonly default: false;
88
+ readonly reflect: true;
89
+ readonly description: "Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission.";
90
+ };
91
+ readonly readOnly: {
92
+ readonly type: "boolean";
93
+ readonly default: false;
94
+ readonly reflect: true;
95
+ readonly description: "Prevents editing while remaining focusable and form-submittable on web; distinct from disabled.";
96
+ };
97
+ readonly minLength: {
98
+ readonly type: "number";
99
+ readonly description: "Minimum number of characters. Web uses native HTML validity; native business validation remains the consumer’s responsibility.";
100
+ };
101
+ readonly maxLength: {
102
+ readonly type: "number";
103
+ readonly description: "Maximum number of characters. Web uses native HTML validity and native applies supported input limits.";
104
+ };
105
+ readonly pattern: {
106
+ readonly type: "string";
107
+ readonly platforms: readonly ["web", "react", "angular"];
108
+ readonly description: "Web-only HTML pattern constraint. Native does not emulate HTML regular-expression validation.";
109
+ };
110
+ readonly name: {
111
+ readonly type: "string";
112
+ readonly reflect: true;
113
+ readonly platforms: readonly ["web", "react", "angular"];
114
+ readonly description: "Form field name on web. React Native has no HTML form association or name-based submission.";
115
+ };
116
+ readonly autoComplete: {
117
+ readonly type: "string";
118
+ readonly description: "Consumer-provided completion/autofill hint, mapped to attributes supported by each platform.";
119
+ };
120
+ readonly inputMode: {
121
+ readonly type: "union";
122
+ readonly variants: readonly [{
123
+ readonly type: "enum";
124
+ readonly values: readonly ["none", "text", "decimal", "numeric", "tel", "search", "email", "url"];
125
+ }];
126
+ readonly description: "Input or keyboard hint (none, text, decimal, numeric, tel, search, email or url); it does not add numeric or multiline field behavior.";
127
+ };
128
+ readonly startIcon: {
129
+ readonly type: "reference";
130
+ readonly reference: "IconDefinition";
131
+ readonly options: readonly ["search", "house", "heart", "star"];
132
+ readonly example: "search";
133
+ readonly description: "Optional structured decorative icon before the editable text.";
134
+ };
135
+ readonly endIcon: {
136
+ readonly type: "reference";
137
+ readonly reference: "IconDefinition";
138
+ readonly options: readonly ["search", "house", "heart", "star"];
139
+ readonly example: "search";
140
+ readonly description: "Optional structured decorative icon after the editable text.";
141
+ };
142
+ readonly prefix: {
143
+ readonly type: "string";
144
+ readonly description: "Optional non-interactive text decoration before the editable text.";
145
+ };
146
+ readonly suffix: {
147
+ readonly type: "string";
148
+ readonly description: "Optional non-interactive text decoration after the editable text.";
149
+ };
150
+ readonly clearable: {
151
+ readonly type: "boolean";
152
+ readonly default: false;
153
+ readonly reflect: true;
154
+ readonly description: "Shows a clear action for non-empty editable fields. Supply clearLabel when enabled.";
155
+ };
156
+ readonly clearLabel: {
157
+ readonly type: "string";
158
+ readonly description: "Consumer-supplied localized accessible name for the clear action.";
159
+ };
160
+ readonly passwordReveal: {
161
+ readonly type: "boolean";
162
+ readonly default: false;
163
+ readonly reflect: true;
164
+ readonly description: "Opts into a reveal action for password fields. Supply both revealPasswordLabel and hidePasswordLabel when enabled.";
165
+ };
166
+ readonly revealPasswordLabel: {
167
+ readonly type: "string";
168
+ readonly description: "Consumer-supplied localized accessible name while the password is concealed.";
169
+ };
170
+ readonly hidePasswordLabel: {
171
+ readonly type: "string";
172
+ readonly description: "Consumer-supplied localized accessible name while the password is revealed.";
173
+ };
174
+ };
175
+ readonly events: {
176
+ readonly change: {
177
+ readonly description: "Proposes the current text after each user edit, including clear; this is not a blur/commit event.";
178
+ readonly detail: "TextFieldChangeDetail";
179
+ readonly names: {
180
+ readonly dom: "cosm-change";
181
+ readonly react: "onChange";
182
+ readonly angular: "valueChange";
183
+ readonly native: "onValueChange";
184
+ };
185
+ };
186
+ readonly submit: {
187
+ readonly description: "Reports the current text when the user invokes the field submit action (Enter/return).";
188
+ readonly detail: "TextFieldSubmitDetail";
189
+ readonly names: {
190
+ readonly dom: "cosm-submit";
191
+ readonly react: "onSubmit";
192
+ readonly angular: "submit";
193
+ readonly native: "onSubmitEditing";
194
+ };
195
+ };
196
+ };
197
+ readonly states: readonly [{
198
+ readonly prop: "value";
199
+ readonly event: "change";
200
+ readonly defaultProp: "defaultValue";
201
+ }];
202
+ readonly slots: {};
203
+ readonly parts: {
204
+ readonly label: "Accessible label above the control.";
205
+ readonly control: "Visual control containing the editable input and decorations.";
206
+ readonly input: "The single-line editable input.";
207
+ readonly start: "Start icon or prefix decoration.";
208
+ readonly end: "End icon, suffix decoration or clear/reveal action.";
209
+ readonly help: "Supporting text associated with the editable input.";
210
+ readonly error: "External or native-validity error text associated with the editable input.";
211
+ readonly 'clear-button': "Optional accessible clear action.";
212
+ readonly 'reveal-button': "Optional accessible password visibility action.";
213
+ };
214
+ readonly cssProperties: {
215
+ readonly '--cosm-text-field-background': "Editable control background.";
216
+ readonly '--cosm-text-field-color': "Editable and decoration text color.";
217
+ readonly '--cosm-text-field-placeholder': "Placeholder text color.";
218
+ readonly '--cosm-text-field-border': "Editable control boundary color.";
219
+ readonly '--cosm-text-field-focus': "Visible focus indicator color.";
220
+ readonly '--cosm-text-field-radius': "Editable control corner radius.";
221
+ readonly '--cosm-text-field-start-icon-color': "Start icon color, independent of text and affixes.";
222
+ readonly '--cosm-text-field-end-icon-color': "End icon color, independent of text and affixes.";
223
+ };
224
+ readonly keyboard: readonly [{
225
+ readonly keys: readonly ["Tab", "Shift+Tab"];
226
+ readonly action: "Moves focus to or from the enabled editable control.";
227
+ }, {
228
+ readonly keys: readonly ["Enter"];
229
+ readonly action: "Invokes the submit action; web form behavior remains native.";
230
+ }];
231
+ };
232
+ //# sourceMappingURL=text-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../src/specs/text-field.ts"],"names":[],"mappings":"AAEA,iEAAiE;AACjE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyO5B,CAAC"}