mn-angular-lib 2.0.33 → 2.0.35
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/fesm2022/mn-angular-lib-alert.mjs +515 -527
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +264 -357
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-button.mjs +819 -382
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar-core.mjs +240 -365
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar.mjs +1691 -1545
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +2367 -2796
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +693 -1241
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-display.mjs +679 -712
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +3671 -4647
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +221 -190
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-core.mjs +711 -896
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2089 -2035
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal.mjs +76 -121
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +289 -277
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-segmented.mjs +189 -241
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tab.mjs +409 -642
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
- package/fesm2022/mn-angular-lib.mjs +16 -29
- package/package.json +1 -1
- package/types/mn-angular-lib-alert.d.ts +239 -241
- package/types/mn-angular-lib-bottom-sheet.d.ts +190 -150
- package/types/mn-angular-lib-button.d.ts +319 -317
- package/types/mn-angular-lib-calendar-core.d.ts +199 -209
- package/types/mn-angular-lib-calendar.d.ts +656 -511
- package/types/mn-angular-lib-collection.d.ts +1649 -1585
- package/types/mn-angular-lib-core.d.ts +524 -535
- package/types/mn-angular-lib-display.d.ts +946 -886
- package/types/mn-angular-lib-forms.d.ts +3012 -3013
- package/types/mn-angular-lib-keyboard.d.ts +125 -85
- package/types/mn-angular-lib-modal-core.d.ts +978 -994
- package/types/mn-angular-lib-modal-ui.d.ts +541 -493
- package/types/mn-angular-lib-modal.d.ts +24 -27
- package/types/mn-angular-lib-rich-text-editor.d.ts +131 -98
- package/types/mn-angular-lib-segmented.d.ts +354 -341
- package/types/mn-angular-lib-tab.d.ts +345 -336
- package/types/mn-angular-lib.d.ts +16 -16
- package/fesm2022/mn-angular-lib.mjs.map +0 -1
|
@@ -1,195 +1,226 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { EventEmitter, HostBinding,
|
|
3
|
-
import { NgTemplateOutlet } from
|
|
4
|
-
import { MnBottomSheet } from
|
|
5
|
-
|
|
6
|
-
/** QWERTY letter rows, lower-case. Rendered upper-case when {@link MnKeyboard.uppercase} is set. */
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, EventEmitter, HostBinding, Input, Output } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { MnBottomSheet } from "mn-angular-lib/bottom-sheet";
|
|
7
5
|
const ALPHA_ROWS = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
[
|
|
7
|
+
"q",
|
|
8
|
+
"w",
|
|
9
|
+
"e",
|
|
10
|
+
"r",
|
|
11
|
+
"t",
|
|
12
|
+
"y",
|
|
13
|
+
"u",
|
|
14
|
+
"i",
|
|
15
|
+
"o",
|
|
16
|
+
"p"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"a",
|
|
20
|
+
"s",
|
|
21
|
+
"d",
|
|
22
|
+
"f",
|
|
23
|
+
"g",
|
|
24
|
+
"h",
|
|
25
|
+
"j",
|
|
26
|
+
"k",
|
|
27
|
+
"l"
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"z",
|
|
31
|
+
"x",
|
|
32
|
+
"c",
|
|
33
|
+
"v",
|
|
34
|
+
"b",
|
|
35
|
+
"n",
|
|
36
|
+
"m"
|
|
37
|
+
]
|
|
38
|
+
];
|
|
39
|
+
const DIGIT_ROW = [
|
|
40
|
+
"1",
|
|
41
|
+
"2",
|
|
42
|
+
"3",
|
|
43
|
+
"4",
|
|
44
|
+
"5",
|
|
45
|
+
"6",
|
|
46
|
+
"7",
|
|
47
|
+
"8",
|
|
48
|
+
"9",
|
|
49
|
+
"0"
|
|
11
50
|
];
|
|
12
|
-
/** The digit row that sits above the letters on an alphanumeric keyboard. */
|
|
13
|
-
const DIGIT_ROW = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
|
|
14
|
-
/** Phone-style pad rows for the numeric layout. */
|
|
15
51
|
const NUMERIC_ROWS = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
52
|
+
[
|
|
53
|
+
"1",
|
|
54
|
+
"2",
|
|
55
|
+
"3"
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"4",
|
|
59
|
+
"5",
|
|
60
|
+
"6"
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"7",
|
|
64
|
+
"8",
|
|
65
|
+
"9"
|
|
66
|
+
],
|
|
67
|
+
["0"]
|
|
20
68
|
];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
backspace() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
type: Output
|
|
177
|
-
}], hostClasses: [{
|
|
178
|
-
type: HostBinding,
|
|
179
|
-
args: ['class']
|
|
180
|
-
}] } });
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Public API of the `mn-angular-lib/keyboard` entry point: the on-screen keyboard.
|
|
184
|
-
*
|
|
185
|
-
* Each entry point is its own module in the published package, so a consumer's bundler
|
|
186
|
-
* splits it into the chunk that uses it instead of loading the whole library at startup.
|
|
187
|
-
* The root `mn-angular-lib` entry re-exports every entry point.
|
|
188
|
-
*/
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Generated bundle index. Do not edit.
|
|
192
|
-
*/
|
|
193
|
-
|
|
69
|
+
var MnKeyboard = class MnKeyboard {
|
|
70
|
+
value = "";
|
|
71
|
+
layout = "alphanumeric";
|
|
72
|
+
presentation = "inline";
|
|
73
|
+
labels = {
|
|
74
|
+
backspace: "⌫",
|
|
75
|
+
clear: "⨯",
|
|
76
|
+
space: "␣",
|
|
77
|
+
submit: "⏎",
|
|
78
|
+
keyboard: ""
|
|
79
|
+
};
|
|
80
|
+
uppercase = false;
|
|
81
|
+
allowSpace = true;
|
|
82
|
+
showSubmit = true;
|
|
83
|
+
submitDisabled = false;
|
|
84
|
+
maxLength = null;
|
|
85
|
+
sheetMaxHeightVh = 60;
|
|
86
|
+
valueChange = new EventEmitter();
|
|
87
|
+
submitted = new EventEmitter();
|
|
88
|
+
dismissed = new EventEmitter();
|
|
89
|
+
get hostClasses() {
|
|
90
|
+
return `mn-keyboard mn-keyboard-${this.layout}`;
|
|
91
|
+
}
|
|
92
|
+
get rows() {
|
|
93
|
+
if (this.layout === "numeric") return NUMERIC_ROWS;
|
|
94
|
+
const letters = this.uppercase ? ALPHA_ROWS.map((row) => row.map((key) => key.toUpperCase())) : ALPHA_ROWS;
|
|
95
|
+
return this.layout === "alpha" ? letters : [[...DIGIT_ROW], ...letters];
|
|
96
|
+
}
|
|
97
|
+
get spaceVisible() {
|
|
98
|
+
return this.allowSpace && this.layout !== "numeric";
|
|
99
|
+
}
|
|
100
|
+
press(key) {
|
|
101
|
+
this.emit(this.value + key);
|
|
102
|
+
}
|
|
103
|
+
pressSpace() {
|
|
104
|
+
this.emit(this.value + " ");
|
|
105
|
+
}
|
|
106
|
+
backspace() {
|
|
107
|
+
this.emit(this.value.slice(0, -1));
|
|
108
|
+
}
|
|
109
|
+
clear() {
|
|
110
|
+
this.emit("");
|
|
111
|
+
}
|
|
112
|
+
submit() {
|
|
113
|
+
if (this.submitDisabled) return;
|
|
114
|
+
this.submitted.emit(this.value);
|
|
115
|
+
}
|
|
116
|
+
onDismiss() {
|
|
117
|
+
this.dismissed.emit();
|
|
118
|
+
}
|
|
119
|
+
emit(next) {
|
|
120
|
+
const clamped = this.maxLength !== null && next.length > this.maxLength ? next.slice(0, this.maxLength) : next;
|
|
121
|
+
if (clamped === this.value) return;
|
|
122
|
+
this.value = clamped;
|
|
123
|
+
this.valueChange.emit(clamped);
|
|
124
|
+
}
|
|
125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
126
|
+
minVersion: "12.0.0",
|
|
127
|
+
version: "22.2.2",
|
|
128
|
+
ngImport: i0,
|
|
129
|
+
type: MnKeyboard,
|
|
130
|
+
deps: [],
|
|
131
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
132
|
+
});
|
|
133
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
134
|
+
minVersion: "17.0.0",
|
|
135
|
+
version: "22.2.2",
|
|
136
|
+
type: MnKeyboard,
|
|
137
|
+
isStandalone: true,
|
|
138
|
+
selector: "mn-keyboard",
|
|
139
|
+
inputs: {
|
|
140
|
+
value: "value",
|
|
141
|
+
layout: "layout",
|
|
142
|
+
presentation: "presentation",
|
|
143
|
+
labels: "labels",
|
|
144
|
+
uppercase: "uppercase",
|
|
145
|
+
allowSpace: "allowSpace",
|
|
146
|
+
showSubmit: "showSubmit",
|
|
147
|
+
submitDisabled: "submitDisabled",
|
|
148
|
+
maxLength: "maxLength",
|
|
149
|
+
sheetMaxHeightVh: "sheetMaxHeightVh"
|
|
150
|
+
},
|
|
151
|
+
outputs: {
|
|
152
|
+
valueChange: "valueChange",
|
|
153
|
+
submitted: "submitted",
|
|
154
|
+
dismissed: "dismissed"
|
|
155
|
+
},
|
|
156
|
+
host: { properties: { "class": "this.hostClasses" } },
|
|
157
|
+
ngImport: i0,
|
|
158
|
+
template: "<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n <div class=\"flex justify-center gap-2\">\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n",
|
|
159
|
+
styles: [":host{display:block}.mn-keyboard-key{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;touch-action:manipulation}\n"],
|
|
160
|
+
dependencies: [{
|
|
161
|
+
kind: "component",
|
|
162
|
+
type: MnBottomSheet,
|
|
163
|
+
selector: "mn-bottom-sheet",
|
|
164
|
+
inputs: [
|
|
165
|
+
"showBackdrop",
|
|
166
|
+
"showGrabber",
|
|
167
|
+
"dismissible",
|
|
168
|
+
"minHeightPx",
|
|
169
|
+
"maxHeightVh",
|
|
170
|
+
"containerClass",
|
|
171
|
+
"ariaLabel",
|
|
172
|
+
"ariaLabelledby",
|
|
173
|
+
"growWithKeyboard",
|
|
174
|
+
"dismissGuard"
|
|
175
|
+
],
|
|
176
|
+
outputs: ["dismiss"]
|
|
177
|
+
}, {
|
|
178
|
+
kind: "directive",
|
|
179
|
+
type: NgTemplateOutlet,
|
|
180
|
+
selector: "[ngTemplateOutlet]",
|
|
181
|
+
inputs: [
|
|
182
|
+
"ngTemplateOutletContext",
|
|
183
|
+
"ngTemplateOutlet",
|
|
184
|
+
"ngTemplateOutletInjector"
|
|
185
|
+
]
|
|
186
|
+
}]
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
190
|
+
minVersion: "12.0.0",
|
|
191
|
+
version: "22.2.2",
|
|
192
|
+
ngImport: i0,
|
|
193
|
+
type: MnKeyboard,
|
|
194
|
+
decorators: [{
|
|
195
|
+
type: Component,
|
|
196
|
+
args: [{
|
|
197
|
+
selector: "mn-keyboard",
|
|
198
|
+
standalone: true,
|
|
199
|
+
imports: [MnBottomSheet, NgTemplateOutlet],
|
|
200
|
+
template: "<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n <div class=\"flex justify-center gap-2\">\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n",
|
|
201
|
+
styles: [":host{display:block}.mn-keyboard-key{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;touch-action:manipulation}\n"]
|
|
202
|
+
}]
|
|
203
|
+
}],
|
|
204
|
+
propDecorators: {
|
|
205
|
+
value: [{ type: Input }],
|
|
206
|
+
layout: [{ type: Input }],
|
|
207
|
+
presentation: [{ type: Input }],
|
|
208
|
+
labels: [{ type: Input }],
|
|
209
|
+
uppercase: [{ type: Input }],
|
|
210
|
+
allowSpace: [{ type: Input }],
|
|
211
|
+
showSubmit: [{ type: Input }],
|
|
212
|
+
submitDisabled: [{ type: Input }],
|
|
213
|
+
maxLength: [{ type: Input }],
|
|
214
|
+
sheetMaxHeightVh: [{ type: Input }],
|
|
215
|
+
valueChange: [{ type: Output }],
|
|
216
|
+
submitted: [{ type: Output }],
|
|
217
|
+
dismissed: [{ type: Output }],
|
|
218
|
+
hostClasses: [{
|
|
219
|
+
type: HostBinding,
|
|
220
|
+
args: ["class"]
|
|
221
|
+
}]
|
|
222
|
+
}
|
|
223
|
+
});
|
|
194
224
|
export { MnKeyboard };
|
|
195
|
-
|
|
225
|
+
|
|
226
|
+
//# sourceMappingURL=mn-angular-lib-keyboard.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mn-angular-lib-keyboard.mjs","sources":["../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.ts","../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.html","../../../projects/mn-angular-lib/keyboard/public-api.ts","../../../projects/mn-angular-lib/keyboard/mn-angular-lib-keyboard.ts"],"sourcesContent":["import {\n Component,\n EventEmitter,\n HostBinding,\n Input,\n Output,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { MnBottomSheet } from 'mn-angular-lib/bottom-sheet';\nimport { MnKeyboardLabels, MnKeyboardLayout, MnKeyboardPresentation } from './mn-keyboard.types';\n\n/** QWERTY letter rows, lower-case. Rendered upper-case when {@link MnKeyboard.uppercase} is set. */\nconst ALPHA_ROWS: readonly string[][] = [\n ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],\n ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'],\n ['z', 'x', 'c', 'v', 'b', 'n', 'm'],\n];\n\n/** The digit row that sits above the letters on an alphanumeric keyboard. */\nconst DIGIT_ROW: readonly string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];\n\n/** Phone-style pad rows for the numeric layout. */\nconst NUMERIC_ROWS: readonly string[][] = [\n ['1', '2', '3'],\n ['4', '5', '6'],\n ['7', '8', '9'],\n ['0'],\n];\n\n/**\n * An on-screen keyboard for touch devices that have no keyboard of their own.\n *\n * It exists for unattended screens — a tablet on a wall, a kiosk by a door — where\n * the OS keyboard is either unavailable or unwanted, and where the same field may\n * need to take a membership number *or* a name. Hence one component with a\n * {@link layout} switch rather than a separate number pad and text pad.\n *\n * It is a controlled component: it never owns the text. The host passes {@link value}\n * and reacts to {@link valueChange}, exactly like a form control, so the same value\n * can also be filled by a barcode scanner or a real keyboard without this component\n * fighting it.\n *\n * With {@link presentation} set to `sheet` it mounts inside an {@link MnBottomSheet},\n * rising from the bottom of the screen and swipeable away — the shape a kiosk wants\n * so the keys do not permanently occupy half the display.\n *\n * The library ships no user-facing English, so every named key takes its caption\n * from {@link labels}.\n */\n@Component({\n selector: 'mn-keyboard',\n standalone: true,\n imports: [MnBottomSheet, NgTemplateOutlet],\n templateUrl: './mn-keyboard.component.html',\n styleUrl: './mn-keyboard.component.css',\n})\nexport class MnKeyboard {\n /** The current text. This component never mutates it — see {@link valueChange}. */\n @Input() value = '';\n /** Which keys to render. */\n @Input() layout: MnKeyboardLayout = 'alphanumeric';\n /** Whether the keys sit in the page or rise from the bottom as a sheet. */\n @Input() presentation: MnKeyboardPresentation = 'inline';\n /**\n * Captions and accessible names for the named keys.\n *\n * The defaults are language-neutral glyphs rather than words, so a consumer that\n * forgets to translate still ships no English (or Dutch) from the library. The\n * accessible name for the keyboard as a whole has no neutral glyph, so it\n * defaults to empty and the attribute is simply omitted until a host supplies one.\n */\n @Input() labels: MnKeyboardLabels = {\n backspace: '⌫',\n clear: '⨯',\n space: '␣',\n submit: '⏎',\n keyboard: '',\n };\n /** Whether letters are rendered (and typed) upper-case. */\n @Input() uppercase = false;\n /** Whether to offer a space key. Off for a field that can never contain one. */\n @Input() allowSpace = true;\n /** Whether to offer a submit key. */\n @Input() showSubmit = true;\n /** Whether the submit key is currently actionable. */\n @Input() submitDisabled = false;\n /** Hard cap on the text length, or null for none. */\n @Input() maxLength: number | null = null;\n /** Cap on the sheet height as a fraction of the viewport, in vh (sheet presentation only). */\n @Input() sheetMaxHeightVh = 60;\n\n /** Emits the full text after every key press, so the host can drive its own field. */\n @Output() valueChange = new EventEmitter<string>();\n /** Emits when the submit key is pressed. */\n @Output() submitted = new EventEmitter<string>();\n /** Emits when a sheet-presented keyboard is swiped or tapped away. */\n @Output() dismissed = new EventEmitter<void>();\n\n @HostBinding('class') get hostClasses(): string {\n return `mn-keyboard mn-keyboard-${this.layout}`;\n }\n\n /** The character rows to render, driven by {@link layout}. */\n get rows(): readonly string[][] {\n if (this.layout === 'numeric') {\n return NUMERIC_ROWS;\n }\n const letters = this.uppercase\n ? ALPHA_ROWS.map((row) => row.map((key) => key.toUpperCase()))\n : ALPHA_ROWS;\n return this.layout === 'alpha' ? letters : [[...DIGIT_ROW], ...letters];\n }\n\n /** Whether the space key should be offered (never on a digits-only pad). */\n get spaceVisible(): boolean {\n return this.allowSpace && this.layout !== 'numeric';\n }\n\n /**\n * Appends a character, respecting {@link maxLength}.\n * @param key The character pressed.\n */\n press(key: string): void {\n this.emit(this.value + key);\n }\n\n /** Appends a space. */\n pressSpace(): void {\n this.emit(this.value + ' ');\n }\n\n /** Removes the last character. */\n backspace(): void {\n this.emit(this.value.slice(0, -1));\n }\n\n /** Empties the field. */\n clear(): void {\n this.emit('');\n }\n\n /** Reports a submit press. The host decides what submitting means. */\n submit(): void {\n if (this.submitDisabled) {\n return;\n }\n this.submitted.emit(this.value);\n }\n\n /** Reports that a sheet-presented keyboard was dismissed. */\n onDismiss(): void {\n this.dismissed.emit();\n }\n\n /**\n * Emits a new value, clamped to {@link maxLength}.\n *\n * Clamping happens here rather than in each key handler so a paste-like burst\n * from a scanner and a tapped key are bounded the same way.\n * @param next The candidate text.\n */\n private emit(next: string): void {\n const clamped =\n this.maxLength !== null && next.length > this.maxLength\n ? next.slice(0, this.maxLength)\n : next;\n if (clamped === this.value) {\n return;\n }\n this.value = clamped;\n this.valueChange.emit(clamped);\n }\n}\n","<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n <div class=\"flex justify-center gap-2\">\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n","/**\n * Public API of the `mn-angular-lib/keyboard` entry point: the on-screen keyboard.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport * from './src/mn-keyboard';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAWA;AACA,MAAM,UAAU,GAAwB;AACtC,IAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAClD,IAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,E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A,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAI9B,UAAU,EAAA,UAAA,EAAA,CAAA;kBAPtB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,cACX,IAAI,EAAA,OAAA,EACP,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAA,QAAA,EAAA,m0FAAA,EAAA,MAAA,EAAA,CAAA,qJAAA,CAAA,EAAA;;sBAMzC;;sBAEA;;sBAEA;;sBASA;;sBAQA;;sBAEA;;sBAEA;;sBAEA;;sBAEA;;sBAEA;;sBAGA;;sBAEA;;sBAEA;;sBAEA,WAAW;uBAAC,OAAO;;;AElGtB;;;;;;AAMG;;ACNH;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"mn-angular-lib-keyboard.mjs","names":[],"sources":["../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.ts","../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.html"],"sourcesContent":["import {\n Component,\n EventEmitter,\n HostBinding,\n Input,\n Output,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { MnBottomSheet } from 'mn-angular-lib/bottom-sheet';\nimport { MnKeyboardLabels, MnKeyboardLayout, MnKeyboardPresentation } from './mn-keyboard.types';\n\n/** QWERTY letter rows, lower-case. Rendered upper-case when {@link MnKeyboard.uppercase} is set. */\nconst ALPHA_ROWS: readonly string[][] = [\n ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],\n ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'],\n ['z', 'x', 'c', 'v', 'b', 'n', 'm'],\n];\n\n/** The digit row that sits above the letters on an alphanumeric keyboard. */\nconst DIGIT_ROW: readonly string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];\n\n/** Phone-style pad rows for the numeric layout. */\nconst NUMERIC_ROWS: readonly string[][] = [\n ['1', '2', '3'],\n ['4', '5', '6'],\n ['7', '8', '9'],\n ['0'],\n];\n\n/**\n * An on-screen keyboard for touch devices that have no keyboard of their own.\n *\n * It exists for unattended screens — a tablet on a wall, a kiosk by a door — where\n * the OS keyboard is either unavailable or unwanted, and where the same field may\n * need to take a membership number *or* a name. Hence one component with a\n * {@link layout} switch rather than a separate number pad and text pad.\n *\n * It is a controlled component: it never owns the text. The host passes {@link value}\n * and reacts to {@link valueChange}, exactly like a form control, so the same value\n * can also be filled by a barcode scanner or a real keyboard without this component\n * fighting it.\n *\n * With {@link presentation} set to `sheet` it mounts inside an {@link MnBottomSheet},\n * rising from the bottom of the screen and swipeable away — the shape a kiosk wants\n * so the keys do not permanently occupy half the display.\n *\n * The library ships no user-facing English, so every named key takes its caption\n * from {@link labels}.\n */\n@Component({\n selector: 'mn-keyboard',\n standalone: true,\n imports: [MnBottomSheet, NgTemplateOutlet],\n templateUrl: './mn-keyboard.component.html',\n styleUrl: './mn-keyboard.component.css',\n})\nexport class MnKeyboard {\n /** The current text. This component never mutates it — see {@link valueChange}. */\n @Input() value = '';\n /** Which keys to render. */\n @Input() layout: MnKeyboardLayout = 'alphanumeric';\n /** Whether the keys sit in the page or rise from the bottom as a sheet. */\n @Input() presentation: MnKeyboardPresentation = 'inline';\n /**\n * Captions and accessible names for the named keys.\n *\n * The defaults are language-neutral glyphs rather than words, so a consumer that\n * forgets to translate still ships no English (or Dutch) from the library. The\n * accessible name for the keyboard as a whole has no neutral glyph, so it\n * defaults to empty and the attribute is simply omitted until a host supplies one.\n */\n @Input() labels: MnKeyboardLabels = {\n backspace: '⌫',\n clear: '⨯',\n space: '␣',\n submit: '⏎',\n keyboard: '',\n };\n /** Whether letters are rendered (and typed) upper-case. */\n @Input() uppercase = false;\n /** Whether to offer a space key. Off for a field that can never contain one. */\n @Input() allowSpace = true;\n /** Whether to offer a submit key. */\n @Input() showSubmit = true;\n /** Whether the submit key is currently actionable. */\n @Input() submitDisabled = false;\n /** Hard cap on the text length, or null for none. */\n @Input() maxLength: number | null = null;\n /** Cap on the sheet height as a fraction of the viewport, in vh (sheet presentation only). */\n @Input() sheetMaxHeightVh = 60;\n\n /** Emits the full text after every key press, so the host can drive its own field. */\n @Output() valueChange = new EventEmitter<string>();\n /** Emits when the submit key is pressed. */\n @Output() submitted = new EventEmitter<string>();\n /** Emits when a sheet-presented keyboard is swiped or tapped away. */\n @Output() dismissed = new EventEmitter<void>();\n\n @HostBinding('class') get hostClasses(): string {\n return `mn-keyboard mn-keyboard-${this.layout}`;\n }\n\n /** The character rows to render, driven by {@link layout}. */\n get rows(): readonly string[][] {\n if (this.layout === 'numeric') {\n return NUMERIC_ROWS;\n }\n const letters = this.uppercase\n ? ALPHA_ROWS.map((row) => row.map((key) => key.toUpperCase()))\n : ALPHA_ROWS;\n return this.layout === 'alpha' ? letters : [[...DIGIT_ROW], ...letters];\n }\n\n /** Whether the space key should be offered (never on a digits-only pad). */\n get spaceVisible(): boolean {\n return this.allowSpace && this.layout !== 'numeric';\n }\n\n /**\n * Appends a character, respecting {@link maxLength}.\n * @param key The character pressed.\n */\n press(key: string): void {\n this.emit(this.value + key);\n }\n\n /** Appends a space. */\n pressSpace(): void {\n this.emit(this.value + ' ');\n }\n\n /** Removes the last character. */\n backspace(): void {\n this.emit(this.value.slice(0, -1));\n }\n\n /** Empties the field. */\n clear(): void {\n this.emit('');\n }\n\n /** Reports a submit press. The host decides what submitting means. */\n submit(): void {\n if (this.submitDisabled) {\n return;\n }\n this.submitted.emit(this.value);\n }\n\n /** Reports that a sheet-presented keyboard was dismissed. */\n onDismiss(): void {\n this.dismissed.emit();\n }\n\n /**\n * Emits a new value, clamped to {@link maxLength}.\n *\n * Clamping happens here rather than in each key handler so a paste-like burst\n * from a scanner and a tapped key are bounded the same way.\n * @param next The candidate text.\n */\n private emit(next: string): void {\n const clamped =\n this.maxLength !== null && next.length > this.maxLength\n ? next.slice(0, this.maxLength)\n : next;\n if (clamped === this.value) {\n return;\n }\n this.value = clamped;\n this.valueChange.emit(clamped);\n }\n}\n","<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n <div class=\"flex justify-center gap-2\">\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n"],"mappings":";;;;AAYA,MAAM,aAAkC;CACtC;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CACjD;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CAC5C;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;AACnC;AAGD,MAAM,YAA+B;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;AAGtF,MAAM,eAAoC;CACxC;EAAC;EAAK;EAAK;CAAG;CACd;EAAC;EAAK;EAAK;CAAG;CACd;EAAC;EAAK;EAAK;CAAG;CACd,CAAC,GAAG;AACL;AA6BD,IAAa,aAAb,MAAa,WAAU;CAEZ,QAAQ;CAER,SAA2B;CAE3B,eAAuC;CASvC,SAA2B;EAClC,WAAW;EACX,OAAO;EACP,OAAO;EACP,QAAQ;EACR,UAAU;CACX;CAEQ,YAAY;CAEZ,aAAa;CAEb,aAAa;CAEb,iBAAiB;CAEjB,YAA2B;CAE3B,mBAAmB;CAGlB,cAAc,IAAI,aAAY;CAE9B,YAAY,IAAI,aAAY;CAE5B,YAAY,IAAI,aAAY;CAEtC,IAA0B,cAAW;EACnC,OAAO,2BAA2B,KAAK;CACzC;CAGA,IAAI,OAAI;EACN,IAAI,KAAK,WAAW,WAClB,OAAO;EAET,MAAM,UAAU,KAAK,YACjB,W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