-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathActionMode.ts
More file actions
741 lines (631 loc) · 16.9 KB
/
Copy pathActionMode.ts
File metadata and controls
741 lines (631 loc) · 16.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
import { SchemaDefinition } from '@sozialhelden/simpl-schema';
import { AccessType, AccessTypes } from './AccessType.js';
import BooleanField from './BooleanField.js';
import IETFLanguageCodeSchemaKeyDefinition, { IETFLanguageTag } from './ietfLanguageTags.js';
import getPrefixedSchemaDefinition, { getPrefixedArraySchemaDefinition } from './lib/getPrefixedSchemaDefinition.js';
import { getLocalizedStringSchemaDefinition, LocalizedString } from './LocalizedString.js';
import { Necessity, NecessityField } from './Necessity.js';
import { getPerceptionModeSchemaDefinition, PerceptionMode } from './PerceptionMode.js';
import {
Force,
ForceSchema,
getPrefixedQuantitySchemaDefinition,
Length,
LengthSchema, Mass,
MassSchema, TimeInterval,
TimeIntervalSchema
} from './Quantity.js';
import { getTechCombinationSchemaDefinition, TechCombination } from './TechCombination.js';
import validateUrl from './validateUrl.js';
/**
* Describes a physical direction axis relative to a person’s body.
*
* @see https://wisc.pb.unizin.org/app/uploads/sites/123/2018/10/Anatomical-Planes-and-Axes.jpg
*/
export const DirectionAxes = [
'sagittal',
'coronal',
'axial',
] as const;
/**
* Describes a physical direction axis relative to a person’s body.
*
* @see https://wisc.pb.unizin.org/app/uploads/sites/123/2018/10/Anatomical-Planes-and-Axes.jpg
*/
export type DirectionAxis = typeof DirectionAxes[number];
/**
* Describes physical directions, from the perspective of a person facing forward.
*/
export const Directions = [
'up',
'down',
'left',
'right',
'forward',
'backward',
'clockwise',
'counterclockwise',
] as const;
/**
* Describes a physical direction, from the perspective of a person facing forward.
*/
export type Direction = typeof Directions[number];
/**
* Describes necessary abilities and modes inputting information.
*/
export interface ActionMode {
/**
* Describes which output is meant. Helpful if there are multiple outputs.
*/
name?: LocalizedString;
/**
* Describes the output as human-readable text.
*/
description?: LocalizedString;
/**
* Input languages supported.
*/
languages?: IETFLanguageTag[];
/**
* Who has access to this action?
*/
access?: AccessType[];
/**
* `true` if the action is optional, `false` if it is required.
*/
optional?: boolean;
/**
* `false` if the action is optional, `true` if it is required.
*/
required?: boolean;
/**
* Force needed for the described input method.
*/
activationForce?: Force;
/**
* Time interval needed for activation/engagement.
*/
activationTimeInterval?: TimeInterval;
/**
* A weight you need to be able to lift.
*/
weight?: Mass;
/**
* A supported body weight.
*/
bodyMass?: Mass;
/**
* A supported body height.
*/
bodyHeight?: Length;
/**
* Height you need to be able to climb over (for obstacles)
*/
necessaryClimbHeight?: Length;
/**
* Attention time needed for activation/engagement.
*/
attentionSpan?: TimeInterval;
/**
* How is feedback given for an input?
*/
feedback?: PerceptionMode;
/**
* The ability to carry a weight is supported or needed.
*/
carryWeight?: Necessity;
/**
* The ability to speak is supported or needed.
*/
speak?: Necessity;
/**
* Morse code input is supported or needed.
*/
morseCode?: Necessity;
/**
* Clapping your hands is supported or needed.
*/
clap?: Necessity;
/**
* Waving your hands is supported or needed.
*/
wave?: Necessity;
/**
* Walking is supported or needed.
*/
walk?: Necessity;
/**
* The ability to use sign language is supported or needed.
*/
signLanguage?: Necessity;
/**
* A QR code is supported or needed.
*/
qrCode?: Necessity;
/**
* Headphones are supported or needed.
*/
headphone?: Necessity;
/**
* A cable is supported or needed.
*/
cable?: Necessity;
/**
* URL where you can use the input mechanism, e.g. on your phone.
*/
url?: LocalizedString;
/**
* URL describing how to use the input mechanism.
*/
instructionsUrl?: LocalizedString;
/**
* Tactile input is supported or needed.
*/
tactile?: Necessity;
/**
* Haptic input is supported or needed.
*/
haptic?: Necessity;
/**
* The ability to read braille is supported or needed.
*/
brailleText?: Necessity;
/**
* The ability to write textual content with a braille keyboard is supported or needed.
*/
brailleKeyboard?: Necessity;
/**
* You can or must give input with both hands.
*/
twoHanded?: Necessity;
/**
* You can or must give input with one hand.
*/
singleHanded?: Necessity;
/**
* You can or must give input with your left hand.
*/
leftHanded?: Necessity;
/**
* You can or must give input with your right hand.
*/
rightHanded?: Necessity;
/**
* The ability to write textual content by hand is supported or needed.
*/
handwriting?: Necessity;
/**
* The ability to write textual content by typing on a keyboard is supported or needed.
*/
keyboard?: Necessity;
/**
* The ability to write numbers by typing on a keypad is supported or needed.
*/
keypad?: Necessity;
/**
* The ability to use a mouse is supported or needed.
*/
mouse?: Necessity;
/**
* The ability to click a button with a finger is supported or needed.
*/
click?: Necessity;
/**
* The ability to click a button with a finger is supported or needed.
*/
doubleClick?: Necessity;
/**
* The ability to click a button with a finger is supported or needed.
*/
tripleClick?: Necessity;
/**
* The ability to tap an element with a finger is supported or needed.
*/
tap?: Necessity;
/**
* The ability to use a trackball is supported or needed.
*/
trackball?: Necessity;
/**
* The ability to use a push switch is supported or needed.
*/
pushSwitch?: Necessity;
/**
* The ability to use a push button is supported or needed.
*/
pushButton?: Necessity;
/**
* The action uses a capacity sensor, for example a touch sensor.
*/
capacitive?: Necessity;
/**
* State count for a button or switch, for example 2 for a toggle button, 3 for a 3-way button.
*/
stateCount?: number;
/**
* The ability to use a pedal is supported or needed.
*/
pedal?: Necessity;
/**
* The ability to use a pull switch is supported or needed.
*/
pullSwitch?: Necessity;
/**
* The ability to use a pullstring is supported or needed.
*/
pullstring?: Necessity;
/**
* The input has tactile guides, for example around buttons.
*/
tactileGuides?: Necessity;
/**
* The input has a knurled surface, for example around buttons.
*/
knurled?: boolean;
/**
* The input has high contrast elements, for example around buttons.
*/
highContrast?: boolean;
/**
* Touchscreen input is supported or needed.
*/
touchscreen?: Necessity;
/**
* A screen is supported or needed.
*/
screen?: Necessity;
/**
* Handling paper is supported or needed.
*/
paper?: Necessity;
/**
* Touch input is supported or needed.
*/
touch?: Necessity;
/**
* There is a burn hazard.
*/
burnHazard?: boolean;
/**
* The ability to apply force to an object is supported or needed.
*/
press?: Necessity;
/**
* The ability to tear something apart is supported or needed.
*/
tearApart?: Necessity;
/**
* The ability to use a joystick is supported or needed.
*/
joystick?: Necessity;
/**
* The ability to turn a knob is supported or needed.
*/
turnKnob?: Necessity;
/**
* The action uses a knob.
*/
knob?: Necessity;
/**
* The ability to drag an object is supported or needed.
*/
drag?: Necessity;
/**
* The ability to turn an object is supported or needed.
*/
turn?: Necessity;
/**
* The direction of the action, relative to the body.
*/
direction?: Direction;
/**
* The direction axis of the action, relative to the body.
*/
directionAxis?: DirectionAxis;
/**
* The ability to pinch an object is supported or needed.
*/
pinch?: Necessity;
/**
* The ability to squeeze an object is supported or needed.
*/
squeeze?: Necessity;
/**
* The ability to rotate an object is supported or needed.
*/
rotate?: Necessity;
/**
* The ability to tilt an object is supported or needed.
*/
tilt?: Necessity;
/**
* The ability to move an object is supported or needed.
*/
move?: Necessity;
/**
* The ability to move an object with your tongue is supported or needed.
*/
tongue?: Necessity;
/**
* The ability to lick an object with your tongue is supported or needed (e.g. a lollipop)
*/
lick?: Necessity;
/**
* The ability to smell is supported or needed.
*/
smell?: Necessity;
/**
* The ability to scratch is supported or needed.
*/
scratch?: Necessity;
/**
* The ability to use a sip and puff switch is supported or needed.
*/
sipAndPuff?: Necessity;
/**
* The ability to use a pinch finger gesture is supported or needed.
*/
pinchFingerGesture?: Necessity;
/**
* The ability to do a virtual drag-and-drop finger/mouse gesture is supported or needed.
*/
dragAndDropGesture?: Necessity;
/**
* The ability to use a two-finger rotation gesture is supported or needed.
*/
rotateTwoFingersGesture?: Necessity;
/**
* The ability to use a swipe finger gesture is supported or needed.
*/
swipeFingerGesture?: Necessity;
/**
* The ability to use a three-finger swipe gesture is supported or needed.
*/
swipeTwoFingersGesture?: Necessity;
/**
* The ability to use a three-finger swipe gesture is supported or needed.
*/
swipeThreeFingersGesture?: Necessity;
/**
* The ability to use rhythm input is supported or needed.
*/
rhythm?: Necessity;
/**
* The ability to use a head pointer is supported or needed.
*/
headPointer?: Necessity;
/**
* The ability to use an eye tracker is supported or needed.
*/
eyeTracker?: Necessity;
/**
* The input features a wheel.
*/
wheel?: Necessity;
/**
* The input is wireless.
*/
wireless?: Necessity;
/**
* The input makes a photo.
*/
photo?: Necessity;
/**
* The input makes a video.
*/
video?: Necessity;
/**
* The input makes a sound recording.
*/
soundRecording?: Necessity;
/**
* The input uses face recognition.
*/
faceRecognition?: Necessity;
/**
* The input uses a fingerprint scanner.
*/
fingerprintScan?: Necessity;
/**
* The input uses an iris scanner.
*/
irisScan?: Necessity;
/**
* `true` if the controls or signs have raised letters, `false` if not.
*/
raisedText?: Necessity;
/**
* `true` if the control is activated by voice, `false` if not.
*/
voiceActivation?: Necessity;
/**
* `true` if the input user interface needs or supports visual input, `false` if not.
*/
visualRecognition?: Necessity;
/**
* The height you need to grip to perceive the content/output/signal.
*/
necessaryGripHeight?: Length;
/**
* How tall do you have to be to perceive the content/output/signal.
*/
necessaryEyeHeight?: Length;
/**
* The input API documentation URL.
*/
apiDocumentationUrl?: LocalizedString;
/**
* `true` if the input is easy to understand, `false` if people might face difficulties trying to
* understand how the input works, or `undefined` if this is unknown or irrelevant.
*/
isEasyToUnderstand?: boolean;
/**
* `true` if the item is easy to find, `false` if people might face difficulties trying to
* find the item, or `undefined` if this is unknown or irrelevant.
*/
isEasyToFind?: boolean;
/**
* Technology combinations that are sufficient to make use of the output.
*/
techSufficient?: TechCombination[];
/**
* Technologies that are sufficient to make use of the output.
*/
techSupported?: TechCombination[];
/**
* Education level needed to understand the action.
*
* http://www.ibe.unesco.org/en/glossary-curriculum-terminology/l/levels-education
*
* - early childhood education (level 0)
* - primary education (level 1)
* - lower secondary education (level 2)
* - upper secondary education (level 3)
* - postsecondary non-tertiary education (level 4)
* - short-cycle tertiary education (level 5)
* - bachelor’s or equivalent level (level 6)
* - master’s or equivalent level (level 7)
* - doctor or equivalent level (level 8).
*/
educationLevel?: Number;
}
export const getActionModeSchemaDefinition: () => SchemaDefinition = () => ({
optional: BooleanField,
required: BooleanField,
...getLocalizedStringSchemaDefinition('name'),
...getLocalizedStringSchemaDefinition('description'),
...getLocalizedStringSchemaDefinition('url'),
...getLocalizedStringSchemaDefinition('instructionsUrl', {}, {
custom: validateUrl,
}),
...getLocalizedStringSchemaDefinition('apiDocumentationUrl', {}, {
custom: validateUrl,
}),
languages: {
type: Array,
optional: true,
},
'languages.$': IETFLanguageCodeSchemaKeyDefinition,
speak: NecessityField,
morseCode: NecessityField,
signLanguage: NecessityField,
tactile: NecessityField,
haptic: NecessityField,
brailleText: NecessityField,
brailleKeyboard: NecessityField,
twoHanded: NecessityField,
singleHanded: NecessityField,
leftHanded: NecessityField,
rightHanded: NecessityField,
handwriting: NecessityField,
click: NecessityField,
doubleClick: NecessityField,
tripleClick: NecessityField,
tap: NecessityField,
tactileGuides: NecessityField,
touch: NecessityField,
drag: NecessityField,
press: NecessityField,
pinch: NecessityField,
clap: NecessityField,
wave: NecessityField,
squeeze: NecessityField,
rotate: NecessityField,
tilt: NecessityField,
move: NecessityField,
tongue: NecessityField,
walk: NecessityField,
knurled: BooleanField,
capacitive: NecessityField,
screen: NecessityField,
paper: NecessityField,
pinchFingerGesture: NecessityField,
rotateTwoFingersGesture: NecessityField,
swipeFingerGesture: NecessityField,
swipeTwoFingersGesture: NecessityField,
swipeThreeFingersGesture: NecessityField,
dragAndDropGesture: NecessityField,
rhythm: NecessityField,
keypad: NecessityField,
keyboard: NecessityField,
mouse: NecessityField,
trackball: NecessityField,
pushSwitch: NecessityField,
pushButton: NecessityField,
stateCount: {
type: Number,
min: 1,
optional: true,
},
pedal: NecessityField,
pullSwitch: NecessityField,
pullstring: NecessityField,
touchscreen: NecessityField,
joystick: NecessityField,
sipAndPuff: NecessityField,
turn: NecessityField,
turnKnob: NecessityField,
direction: {
type: String,
allowedValues: (Directions as any) as string[],
optional: true,
},
directionAxis: {
type: String,
allowedValues: (DirectionAxes as any) as string[],
optional: true,
},
tearApart: NecessityField,
lick: NecessityField,
smell: NecessityField,
scratch: NecessityField,
headPointer: NecessityField,
eyeTracker: NecessityField,
wheel: NecessityField,
wireless: NecessityField,
qrCode: NecessityField,
knob: NecessityField,
headphone: NecessityField,
cable: NecessityField,
phone: NecessityField,
photo: NecessityField,
video: NecessityField,
soundRecording: NecessityField,
faceRecognition: NecessityField,
fingerprintScan: NecessityField,
irisScan: NecessityField,
raisedText: NecessityField,
voiceActivation: NecessityField,
visualRecognition: NecessityField,
carryWeight: NecessityField,
highContrast: BooleanField,
isEasyToUnderstand: BooleanField,
isEasyToFind: BooleanField,
burnHazard: BooleanField,
educationLevel: {
type: Number,
optional: true,
allowedValues: [0, 1, 2, 3, 4, 5, 6, 7, 8],
},
...getPrefixedQuantitySchemaDefinition('heightFromFloor', LengthSchema),
...getPrefixedQuantitySchemaDefinition('necessaryGripHeight', LengthSchema),
...getPrefixedQuantitySchemaDefinition('necessaryClimbHeight', LengthSchema),
...getPrefixedQuantitySchemaDefinition('necessaryEyeHeight', LengthSchema),
...getPrefixedQuantitySchemaDefinition('activationForce', ForceSchema),
...getPrefixedQuantitySchemaDefinition('activationTimeInterval', TimeIntervalSchema),
...getPrefixedQuantitySchemaDefinition('weight', MassSchema),
...getPrefixedQuantitySchemaDefinition('bodyMass', MassSchema),
...getPrefixedQuantitySchemaDefinition('bodyHeight', LengthSchema),
...getPrefixedArraySchemaDefinition('techSufficient', getTechCombinationSchemaDefinition()),
...getPrefixedArraySchemaDefinition('techSupported', getTechCombinationSchemaDefinition()),
...getPrefixedSchemaDefinition('feedback', getPerceptionModeSchemaDefinition()),
...getPrefixedQuantitySchemaDefinition('attentionSpan', TimeIntervalSchema),
access: {
type: Array,
optional: true,
},
'access.$': {
type: String,
allowedValues: (AccessTypes as any) as any,
},
});