@lokascript/domain-voice 2.1.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.
- package/dist/generators/voice-generator.d.ts +8 -0
- package/dist/generators/voice-renderer.d.ts +14 -0
- package/dist/index.cjs +1864 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +152 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +1803 -0
- package/dist/index.js.map +1 -0
- package/dist/profiles/index.d.ts +20 -0
- package/dist/schemas/index.d.ts +16 -0
- package/dist/tokenizers/index.d.ts +16 -0
- package/dist/types.d.ts +23 -0
- package/package.json +48 -0
- package/src/__test__/voice-domain.test.ts +1232 -0
- package/src/generators/voice-generator.ts +313 -0
- package/src/generators/voice-renderer.ts +420 -0
- package/src/index.ts +190 -0
- package/src/profiles/index.ts +235 -0
- package/src/schemas/index.ts +515 -0
- package/src/tokenizers/index.ts +644 -0
- package/src/types.ts +36 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1864 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ArabicVoiceTokenizer: () => ArabicVoiceTokenizer,
|
|
24
|
+
ChineseVoiceTokenizer: () => ChineseVoiceTokenizer,
|
|
25
|
+
EnglishVoiceTokenizer: () => EnglishVoiceTokenizer,
|
|
26
|
+
FrenchVoiceTokenizer: () => FrenchVoiceTokenizer,
|
|
27
|
+
JapaneseVoiceTokenizer: () => JapaneseVoiceTokenizer,
|
|
28
|
+
KoreanVoiceTokenizer: () => KoreanVoiceTokenizer,
|
|
29
|
+
SpanishVoiceTokenizer: () => SpanishVoiceTokenizer,
|
|
30
|
+
TurkishVoiceTokenizer: () => TurkishVoiceTokenizer,
|
|
31
|
+
allProfiles: () => allProfiles,
|
|
32
|
+
allSchemas: () => allSchemas,
|
|
33
|
+
arProfile: () => arProfile,
|
|
34
|
+
backSchema: () => backSchema,
|
|
35
|
+
clickSchema: () => clickSchema,
|
|
36
|
+
closeSchema: () => closeSchema,
|
|
37
|
+
createVoiceDSL: () => createVoiceDSL,
|
|
38
|
+
enProfile: () => enProfile,
|
|
39
|
+
esProfile: () => esProfile,
|
|
40
|
+
focusSchema: () => focusSchema,
|
|
41
|
+
forwardSchema: () => forwardSchema,
|
|
42
|
+
frProfile: () => frProfile,
|
|
43
|
+
helpSchema: () => helpSchema,
|
|
44
|
+
jaProfile: () => jaProfile,
|
|
45
|
+
koProfile: () => koProfile,
|
|
46
|
+
navigateSchema: () => navigateSchema,
|
|
47
|
+
openSchema: () => openSchema,
|
|
48
|
+
readSchema: () => readSchema,
|
|
49
|
+
renderVoice: () => renderVoice,
|
|
50
|
+
scrollSchema: () => scrollSchema,
|
|
51
|
+
searchSchema: () => searchSchema,
|
|
52
|
+
selectSchema: () => selectSchema,
|
|
53
|
+
toVoiceActionSpec: () => toVoiceActionSpec,
|
|
54
|
+
trProfile: () => trProfile,
|
|
55
|
+
typeSchema: () => typeSchema,
|
|
56
|
+
voiceCodeGenerator: () => voiceCodeGenerator,
|
|
57
|
+
voiceScanConfig: () => voiceScanConfig,
|
|
58
|
+
zhProfile: () => zhProfile,
|
|
59
|
+
zoomSchema: () => zoomSchema
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(index_exports);
|
|
62
|
+
var import_framework6 = require("@lokascript/framework");
|
|
63
|
+
|
|
64
|
+
// src/schemas/index.ts
|
|
65
|
+
var import_framework = require("@lokascript/framework");
|
|
66
|
+
var navigateSchema = (0, import_framework.defineCommand)({
|
|
67
|
+
action: "navigate",
|
|
68
|
+
description: "Navigate to a URL, page section, or ARIA landmark",
|
|
69
|
+
category: "navigation",
|
|
70
|
+
primaryRole: "destination",
|
|
71
|
+
roles: [
|
|
72
|
+
(0, import_framework.defineRole)({
|
|
73
|
+
role: "destination",
|
|
74
|
+
description: "URL, page section, or ARIA landmark to navigate to",
|
|
75
|
+
required: true,
|
|
76
|
+
expectedTypes: ["expression"],
|
|
77
|
+
svoPosition: 1,
|
|
78
|
+
sovPosition: 1,
|
|
79
|
+
markerOverride: {
|
|
80
|
+
en: "to",
|
|
81
|
+
es: "a",
|
|
82
|
+
ja: "\u306B",
|
|
83
|
+
ar: "\u0625\u0644\u0649",
|
|
84
|
+
ko: "\uB85C",
|
|
85
|
+
zh: "\u5230",
|
|
86
|
+
tr: "ya",
|
|
87
|
+
fr: "vers"
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
var clickSchema = (0, import_framework.defineCommand)({
|
|
93
|
+
action: "click",
|
|
94
|
+
description: "Click an element identified by selector, text content, or ARIA label",
|
|
95
|
+
category: "interaction",
|
|
96
|
+
primaryRole: "patient",
|
|
97
|
+
roles: [
|
|
98
|
+
(0, import_framework.defineRole)({
|
|
99
|
+
role: "patient",
|
|
100
|
+
description: "The element to click",
|
|
101
|
+
required: true,
|
|
102
|
+
expectedTypes: ["expression", "selector"],
|
|
103
|
+
svoPosition: 1,
|
|
104
|
+
sovPosition: 1,
|
|
105
|
+
markerOverride: {
|
|
106
|
+
ja: "\u3092",
|
|
107
|
+
ko: "\uC744",
|
|
108
|
+
ar: "\u0639\u0644\u0649",
|
|
109
|
+
fr: "sur"
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
var typeSchema = (0, import_framework.defineCommand)({
|
|
115
|
+
action: "type",
|
|
116
|
+
description: "Type text into an input field",
|
|
117
|
+
category: "interaction",
|
|
118
|
+
primaryRole: "patient",
|
|
119
|
+
roles: [
|
|
120
|
+
(0, import_framework.defineRole)({
|
|
121
|
+
role: "patient",
|
|
122
|
+
description: "The text to type",
|
|
123
|
+
required: true,
|
|
124
|
+
expectedTypes: ["expression"],
|
|
125
|
+
svoPosition: 2,
|
|
126
|
+
sovPosition: 2,
|
|
127
|
+
markerOverride: { ja: "\u3092", ko: "\uC744" }
|
|
128
|
+
}),
|
|
129
|
+
(0, import_framework.defineRole)({
|
|
130
|
+
role: "destination",
|
|
131
|
+
description: "The input field to type into",
|
|
132
|
+
required: false,
|
|
133
|
+
expectedTypes: ["expression", "selector"],
|
|
134
|
+
svoPosition: 1,
|
|
135
|
+
sovPosition: 3,
|
|
136
|
+
markerOverride: {
|
|
137
|
+
en: "into",
|
|
138
|
+
es: "en",
|
|
139
|
+
ja: "\u306B",
|
|
140
|
+
ar: "\u0641\u064A",
|
|
141
|
+
ko: "\uC5D0",
|
|
142
|
+
zh: "\u5230",
|
|
143
|
+
tr: "ya",
|
|
144
|
+
fr: "dans"
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
});
|
|
149
|
+
var scrollSchema = (0, import_framework.defineCommand)({
|
|
150
|
+
action: "scroll",
|
|
151
|
+
description: "Scroll the page or a specific element",
|
|
152
|
+
category: "navigation",
|
|
153
|
+
primaryRole: "manner",
|
|
154
|
+
roles: [
|
|
155
|
+
(0, import_framework.defineRole)({
|
|
156
|
+
role: "manner",
|
|
157
|
+
description: "Direction to scroll (up, down, left, right, top, bottom)",
|
|
158
|
+
required: true,
|
|
159
|
+
expectedTypes: ["expression"],
|
|
160
|
+
svoPosition: 2,
|
|
161
|
+
sovPosition: 2
|
|
162
|
+
}),
|
|
163
|
+
(0, import_framework.defineRole)({
|
|
164
|
+
role: "quantity",
|
|
165
|
+
description: 'Amount to scroll (pixels or "page")',
|
|
166
|
+
required: false,
|
|
167
|
+
expectedTypes: ["expression"],
|
|
168
|
+
svoPosition: 1,
|
|
169
|
+
sovPosition: 1,
|
|
170
|
+
markerOverride: {
|
|
171
|
+
en: "by",
|
|
172
|
+
es: "por",
|
|
173
|
+
ja: "\u3060\u3051",
|
|
174
|
+
ar: "\u0628",
|
|
175
|
+
ko: "\uB9CC\uD07C",
|
|
176
|
+
zh: "\u5E45",
|
|
177
|
+
tr: "kadar",
|
|
178
|
+
fr: "de"
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
});
|
|
183
|
+
var readSchema = (0, import_framework.defineCommand)({
|
|
184
|
+
action: "read",
|
|
185
|
+
description: "Read element content aloud using text-to-speech",
|
|
186
|
+
category: "accessibility",
|
|
187
|
+
primaryRole: "patient",
|
|
188
|
+
roles: [
|
|
189
|
+
(0, import_framework.defineRole)({
|
|
190
|
+
role: "patient",
|
|
191
|
+
description: "The element whose content to read aloud",
|
|
192
|
+
required: true,
|
|
193
|
+
expectedTypes: ["expression", "selector"],
|
|
194
|
+
svoPosition: 1,
|
|
195
|
+
sovPosition: 1,
|
|
196
|
+
markerOverride: { ja: "\u3092", ko: "\uC744" }
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
var zoomSchema = (0, import_framework.defineCommand)({
|
|
201
|
+
action: "zoom",
|
|
202
|
+
description: "Zoom the page in or out",
|
|
203
|
+
category: "accessibility",
|
|
204
|
+
primaryRole: "manner",
|
|
205
|
+
roles: [
|
|
206
|
+
(0, import_framework.defineRole)({
|
|
207
|
+
role: "manner",
|
|
208
|
+
description: "Zoom direction (in, out, reset)",
|
|
209
|
+
required: true,
|
|
210
|
+
expectedTypes: ["expression"],
|
|
211
|
+
svoPosition: 1,
|
|
212
|
+
sovPosition: 1
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
var selectSchema = (0, import_framework.defineCommand)({
|
|
217
|
+
action: "select",
|
|
218
|
+
description: "Select text content or an element",
|
|
219
|
+
category: "interaction",
|
|
220
|
+
primaryRole: "patient",
|
|
221
|
+
roles: [
|
|
222
|
+
(0, import_framework.defineRole)({
|
|
223
|
+
role: "patient",
|
|
224
|
+
description: "The element or text to select",
|
|
225
|
+
required: true,
|
|
226
|
+
expectedTypes: ["expression", "selector"],
|
|
227
|
+
svoPosition: 1,
|
|
228
|
+
sovPosition: 1,
|
|
229
|
+
markerOverride: { ja: "\u3092", ko: "\uB97C" }
|
|
230
|
+
})
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
var backSchema = (0, import_framework.defineCommand)({
|
|
234
|
+
action: "back",
|
|
235
|
+
description: "Navigate to the previous page in history",
|
|
236
|
+
category: "navigation",
|
|
237
|
+
primaryRole: "quantity",
|
|
238
|
+
roles: [
|
|
239
|
+
(0, import_framework.defineRole)({
|
|
240
|
+
role: "quantity",
|
|
241
|
+
description: "Number of pages to go back (default: 1)",
|
|
242
|
+
required: false,
|
|
243
|
+
expectedTypes: ["expression"],
|
|
244
|
+
svoPosition: 1,
|
|
245
|
+
sovPosition: 1
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
});
|
|
249
|
+
var forwardSchema = (0, import_framework.defineCommand)({
|
|
250
|
+
action: "forward",
|
|
251
|
+
description: "Navigate to the next page in history",
|
|
252
|
+
category: "navigation",
|
|
253
|
+
primaryRole: "quantity",
|
|
254
|
+
roles: [
|
|
255
|
+
(0, import_framework.defineRole)({
|
|
256
|
+
role: "quantity",
|
|
257
|
+
description: "Number of pages to go forward (default: 1)",
|
|
258
|
+
required: false,
|
|
259
|
+
expectedTypes: ["expression"],
|
|
260
|
+
svoPosition: 1,
|
|
261
|
+
sovPosition: 1
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
});
|
|
265
|
+
var focusSchema = (0, import_framework.defineCommand)({
|
|
266
|
+
action: "focus",
|
|
267
|
+
description: "Move keyboard focus to an element",
|
|
268
|
+
category: "accessibility",
|
|
269
|
+
primaryRole: "patient",
|
|
270
|
+
roles: [
|
|
271
|
+
(0, import_framework.defineRole)({
|
|
272
|
+
role: "patient",
|
|
273
|
+
description: "The element to focus",
|
|
274
|
+
required: true,
|
|
275
|
+
expectedTypes: ["expression", "selector"],
|
|
276
|
+
svoPosition: 1,
|
|
277
|
+
sovPosition: 1,
|
|
278
|
+
markerOverride: {
|
|
279
|
+
ja: "\u306B",
|
|
280
|
+
ko: "\uC5D0",
|
|
281
|
+
ar: "\u0639\u0644\u0649",
|
|
282
|
+
tr: "ya"
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
]
|
|
286
|
+
});
|
|
287
|
+
var closeSchema = (0, import_framework.defineCommand)({
|
|
288
|
+
action: "close",
|
|
289
|
+
description: "Close the current tab, dialog, or modal",
|
|
290
|
+
category: "interaction",
|
|
291
|
+
primaryRole: "patient",
|
|
292
|
+
roles: [
|
|
293
|
+
(0, import_framework.defineRole)({
|
|
294
|
+
role: "patient",
|
|
295
|
+
description: "What to close (tab, dialog, modal, menu)",
|
|
296
|
+
required: false,
|
|
297
|
+
expectedTypes: ["expression"],
|
|
298
|
+
svoPosition: 1,
|
|
299
|
+
sovPosition: 1,
|
|
300
|
+
markerOverride: { ja: "\u3092", ko: "\uB97C" }
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
});
|
|
304
|
+
var openSchema = (0, import_framework.defineCommand)({
|
|
305
|
+
action: "open",
|
|
306
|
+
description: "Open a link in a new tab, or open a menu/dropdown",
|
|
307
|
+
category: "interaction",
|
|
308
|
+
primaryRole: "patient",
|
|
309
|
+
roles: [
|
|
310
|
+
(0, import_framework.defineRole)({
|
|
311
|
+
role: "patient",
|
|
312
|
+
description: "What to open (link, tab, menu, URL)",
|
|
313
|
+
required: true,
|
|
314
|
+
expectedTypes: ["expression"],
|
|
315
|
+
svoPosition: 1,
|
|
316
|
+
sovPosition: 1,
|
|
317
|
+
markerOverride: { ja: "\u3092", ko: "\uC744" }
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
});
|
|
321
|
+
var searchSchema = (0, import_framework.defineCommand)({
|
|
322
|
+
action: "search",
|
|
323
|
+
description: "Search for text on the page or via a search form",
|
|
324
|
+
category: "interaction",
|
|
325
|
+
primaryRole: "patient",
|
|
326
|
+
roles: [
|
|
327
|
+
(0, import_framework.defineRole)({
|
|
328
|
+
role: "patient",
|
|
329
|
+
description: "The search query text",
|
|
330
|
+
required: true,
|
|
331
|
+
expectedTypes: ["expression"],
|
|
332
|
+
svoPosition: 2,
|
|
333
|
+
sovPosition: 2,
|
|
334
|
+
markerOverride: {
|
|
335
|
+
ar: "\u0639\u0646",
|
|
336
|
+
ja: "\u3092",
|
|
337
|
+
ko: "\uC744"
|
|
338
|
+
}
|
|
339
|
+
}),
|
|
340
|
+
(0, import_framework.defineRole)({
|
|
341
|
+
role: "destination",
|
|
342
|
+
description: "Where to search (page, site, or search field)",
|
|
343
|
+
required: false,
|
|
344
|
+
expectedTypes: ["expression"],
|
|
345
|
+
svoPosition: 1,
|
|
346
|
+
sovPosition: 3,
|
|
347
|
+
markerOverride: {
|
|
348
|
+
en: "in",
|
|
349
|
+
es: "en",
|
|
350
|
+
ja: "\u3067",
|
|
351
|
+
ar: "\u0641\u064A",
|
|
352
|
+
ko: "\uC5D0\uC11C",
|
|
353
|
+
zh: "\u5728",
|
|
354
|
+
tr: "da",
|
|
355
|
+
fr: "dans"
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
]
|
|
359
|
+
});
|
|
360
|
+
var helpSchema = (0, import_framework.defineCommand)({
|
|
361
|
+
action: "help",
|
|
362
|
+
description: "List available voice commands or get help for a specific command",
|
|
363
|
+
category: "meta",
|
|
364
|
+
primaryRole: "patient",
|
|
365
|
+
roles: [
|
|
366
|
+
(0, import_framework.defineRole)({
|
|
367
|
+
role: "patient",
|
|
368
|
+
description: "Specific command to get help for (optional)",
|
|
369
|
+
required: false,
|
|
370
|
+
expectedTypes: ["expression"],
|
|
371
|
+
svoPosition: 1,
|
|
372
|
+
sovPosition: 1
|
|
373
|
+
})
|
|
374
|
+
]
|
|
375
|
+
});
|
|
376
|
+
var allSchemas = [
|
|
377
|
+
navigateSchema,
|
|
378
|
+
clickSchema,
|
|
379
|
+
typeSchema,
|
|
380
|
+
scrollSchema,
|
|
381
|
+
readSchema,
|
|
382
|
+
zoomSchema,
|
|
383
|
+
selectSchema,
|
|
384
|
+
backSchema,
|
|
385
|
+
forwardSchema,
|
|
386
|
+
focusSchema,
|
|
387
|
+
closeSchema,
|
|
388
|
+
openSchema,
|
|
389
|
+
searchSchema,
|
|
390
|
+
helpSchema
|
|
391
|
+
];
|
|
392
|
+
|
|
393
|
+
// src/profiles/index.ts
|
|
394
|
+
var enProfile = {
|
|
395
|
+
code: "en",
|
|
396
|
+
wordOrder: "SVO",
|
|
397
|
+
keywords: {
|
|
398
|
+
navigate: { primary: "navigate", alternatives: ["go"] },
|
|
399
|
+
click: { primary: "click", alternatives: ["press", "tap"] },
|
|
400
|
+
type: { primary: "type", alternatives: ["enter"] },
|
|
401
|
+
scroll: { primary: "scroll" },
|
|
402
|
+
read: { primary: "read", alternatives: ["say"] },
|
|
403
|
+
zoom: { primary: "zoom" },
|
|
404
|
+
select: { primary: "select" },
|
|
405
|
+
back: { primary: "back" },
|
|
406
|
+
forward: { primary: "forward" },
|
|
407
|
+
focus: { primary: "focus" },
|
|
408
|
+
close: { primary: "close" },
|
|
409
|
+
open: { primary: "open" },
|
|
410
|
+
search: { primary: "search", alternatives: ["find"] },
|
|
411
|
+
help: { primary: "help" }
|
|
412
|
+
},
|
|
413
|
+
roleMarkers: {}
|
|
414
|
+
};
|
|
415
|
+
var esProfile = {
|
|
416
|
+
code: "es",
|
|
417
|
+
wordOrder: "SVO",
|
|
418
|
+
keywords: {
|
|
419
|
+
navigate: { primary: "navegar", alternatives: ["ir"] },
|
|
420
|
+
click: { primary: "clic", alternatives: ["pulsar"] },
|
|
421
|
+
type: { primary: "escribir" },
|
|
422
|
+
scroll: { primary: "desplazar" },
|
|
423
|
+
read: { primary: "leer" },
|
|
424
|
+
zoom: { primary: "zoom" },
|
|
425
|
+
select: { primary: "seleccionar" },
|
|
426
|
+
back: { primary: "atr\xE1s", alternatives: ["volver"] },
|
|
427
|
+
forward: { primary: "adelante" },
|
|
428
|
+
focus: { primary: "enfocar" },
|
|
429
|
+
close: { primary: "cerrar" },
|
|
430
|
+
open: { primary: "abrir" },
|
|
431
|
+
search: { primary: "buscar" },
|
|
432
|
+
help: { primary: "ayuda" }
|
|
433
|
+
},
|
|
434
|
+
roleMarkers: {}
|
|
435
|
+
};
|
|
436
|
+
var jaProfile = {
|
|
437
|
+
code: "ja",
|
|
438
|
+
wordOrder: "SOV",
|
|
439
|
+
keywords: {
|
|
440
|
+
navigate: { primary: "\u79FB\u52D5" },
|
|
441
|
+
click: { primary: "\u30AF\u30EA\u30C3\u30AF" },
|
|
442
|
+
type: { primary: "\u5165\u529B" },
|
|
443
|
+
scroll: { primary: "\u30B9\u30AF\u30ED\u30FC\u30EB" },
|
|
444
|
+
read: { primary: "\u8AAD\u3080" },
|
|
445
|
+
zoom: { primary: "\u30BA\u30FC\u30E0" },
|
|
446
|
+
select: { primary: "\u9078\u629E" },
|
|
447
|
+
back: { primary: "\u623B\u308B" },
|
|
448
|
+
forward: { primary: "\u9032\u3080" },
|
|
449
|
+
focus: { primary: "\u30D5\u30A9\u30FC\u30AB\u30B9" },
|
|
450
|
+
close: { primary: "\u9589\u3058\u308B" },
|
|
451
|
+
open: { primary: "\u958B\u304F" },
|
|
452
|
+
search: { primary: "\u691C\u7D22" },
|
|
453
|
+
help: { primary: "\u30D8\u30EB\u30D7" }
|
|
454
|
+
},
|
|
455
|
+
roleMarkers: {}
|
|
456
|
+
};
|
|
457
|
+
var arProfile = {
|
|
458
|
+
code: "ar",
|
|
459
|
+
wordOrder: "VSO",
|
|
460
|
+
keywords: {
|
|
461
|
+
navigate: { primary: "\u0627\u0646\u062A\u0642\u0644" },
|
|
462
|
+
click: { primary: "\u0627\u0646\u0642\u0631" },
|
|
463
|
+
type: { primary: "\u0627\u0643\u062A\u0628" },
|
|
464
|
+
scroll: { primary: "\u062A\u0645\u0631\u064A\u0631" },
|
|
465
|
+
read: { primary: "\u0627\u0642\u0631\u0623" },
|
|
466
|
+
zoom: { primary: "\u062A\u0643\u0628\u064A\u0631" },
|
|
467
|
+
select: { primary: "\u0627\u062E\u062A\u0631" },
|
|
468
|
+
back: { primary: "\u0631\u062C\u0648\u0639" },
|
|
469
|
+
forward: { primary: "\u062A\u0642\u062F\u0645" },
|
|
470
|
+
focus: { primary: "\u0631\u0643\u0632" },
|
|
471
|
+
close: { primary: "\u0623\u063A\u0644\u0642" },
|
|
472
|
+
open: { primary: "\u0627\u0641\u062A\u062D" },
|
|
473
|
+
search: { primary: "\u0627\u0628\u062D\u062B" },
|
|
474
|
+
help: { primary: "\u0645\u0633\u0627\u0639\u062F\u0629" }
|
|
475
|
+
},
|
|
476
|
+
roleMarkers: {}
|
|
477
|
+
};
|
|
478
|
+
var koProfile = {
|
|
479
|
+
code: "ko",
|
|
480
|
+
wordOrder: "SOV",
|
|
481
|
+
keywords: {
|
|
482
|
+
navigate: { primary: "\uC774\uB3D9" },
|
|
483
|
+
click: { primary: "\uD074\uB9AD" },
|
|
484
|
+
type: { primary: "\uC785\uB825" },
|
|
485
|
+
scroll: { primary: "\uC2A4\uD06C\uB864" },
|
|
486
|
+
read: { primary: "\uC77D\uAE30" },
|
|
487
|
+
zoom: { primary: "\uD655\uB300" },
|
|
488
|
+
select: { primary: "\uC120\uD0DD" },
|
|
489
|
+
back: { primary: "\uB4A4\uB85C" },
|
|
490
|
+
forward: { primary: "\uC55E\uC73C\uB85C" },
|
|
491
|
+
focus: { primary: "\uD3EC\uCEE4\uC2A4" },
|
|
492
|
+
close: { primary: "\uB2EB\uAE30" },
|
|
493
|
+
open: { primary: "\uC5F4\uAE30" },
|
|
494
|
+
search: { primary: "\uAC80\uC0C9" },
|
|
495
|
+
help: { primary: "\uB3C4\uC6C0\uB9D0" }
|
|
496
|
+
},
|
|
497
|
+
roleMarkers: {}
|
|
498
|
+
};
|
|
499
|
+
var zhProfile = {
|
|
500
|
+
code: "zh",
|
|
501
|
+
wordOrder: "SVO",
|
|
502
|
+
keywords: {
|
|
503
|
+
navigate: { primary: "\u5BFC\u822A" },
|
|
504
|
+
click: { primary: "\u70B9\u51FB" },
|
|
505
|
+
type: { primary: "\u8F93\u5165" },
|
|
506
|
+
scroll: { primary: "\u6EDA\u52A8" },
|
|
507
|
+
read: { primary: "\u6717\u8BFB" },
|
|
508
|
+
zoom: { primary: "\u7F29\u653E" },
|
|
509
|
+
select: { primary: "\u9009\u62E9" },
|
|
510
|
+
back: { primary: "\u8FD4\u56DE" },
|
|
511
|
+
forward: { primary: "\u524D\u8FDB" },
|
|
512
|
+
focus: { primary: "\u805A\u7126" },
|
|
513
|
+
close: { primary: "\u5173\u95ED" },
|
|
514
|
+
open: { primary: "\u6253\u5F00" },
|
|
515
|
+
search: { primary: "\u641C\u7D22" },
|
|
516
|
+
help: { primary: "\u5E2E\u52A9" }
|
|
517
|
+
},
|
|
518
|
+
roleMarkers: {}
|
|
519
|
+
};
|
|
520
|
+
var trProfile = {
|
|
521
|
+
code: "tr",
|
|
522
|
+
wordOrder: "SOV",
|
|
523
|
+
keywords: {
|
|
524
|
+
navigate: { primary: "git" },
|
|
525
|
+
click: { primary: "t\u0131kla" },
|
|
526
|
+
type: { primary: "yaz" },
|
|
527
|
+
scroll: { primary: "kayd\u0131r" },
|
|
528
|
+
read: { primary: "oku" },
|
|
529
|
+
zoom: { primary: "yak\u0131nla\u015F" },
|
|
530
|
+
select: { primary: "se\xE7" },
|
|
531
|
+
back: { primary: "geri" },
|
|
532
|
+
forward: { primary: "ileri" },
|
|
533
|
+
focus: { primary: "odakla" },
|
|
534
|
+
close: { primary: "kapat" },
|
|
535
|
+
open: { primary: "a\xE7" },
|
|
536
|
+
search: { primary: "ara" },
|
|
537
|
+
help: { primary: "yard\u0131m" }
|
|
538
|
+
},
|
|
539
|
+
roleMarkers: {}
|
|
540
|
+
};
|
|
541
|
+
var frProfile = {
|
|
542
|
+
code: "fr",
|
|
543
|
+
wordOrder: "SVO",
|
|
544
|
+
keywords: {
|
|
545
|
+
navigate: { primary: "naviguer", alternatives: ["aller"] },
|
|
546
|
+
click: { primary: "cliquer" },
|
|
547
|
+
type: { primary: "taper", alternatives: ["\xE9crire"] },
|
|
548
|
+
scroll: { primary: "d\xE9filer" },
|
|
549
|
+
read: { primary: "lire" },
|
|
550
|
+
zoom: { primary: "zoomer" },
|
|
551
|
+
select: { primary: "s\xE9lectionner" },
|
|
552
|
+
back: { primary: "retour" },
|
|
553
|
+
forward: { primary: "avancer" },
|
|
554
|
+
focus: { primary: "focaliser" },
|
|
555
|
+
close: { primary: "fermer" },
|
|
556
|
+
open: { primary: "ouvrir" },
|
|
557
|
+
search: { primary: "chercher", alternatives: ["rechercher"] },
|
|
558
|
+
help: { primary: "aide" }
|
|
559
|
+
},
|
|
560
|
+
roleMarkers: {}
|
|
561
|
+
};
|
|
562
|
+
var allProfiles = [
|
|
563
|
+
enProfile,
|
|
564
|
+
esProfile,
|
|
565
|
+
jaProfile,
|
|
566
|
+
arProfile,
|
|
567
|
+
koProfile,
|
|
568
|
+
zhProfile,
|
|
569
|
+
trProfile,
|
|
570
|
+
frProfile
|
|
571
|
+
];
|
|
572
|
+
|
|
573
|
+
// src/tokenizers/index.ts
|
|
574
|
+
var import_framework2 = require("@lokascript/framework");
|
|
575
|
+
var CSSSelectorExtractor = class {
|
|
576
|
+
name = "css-selector";
|
|
577
|
+
canExtract(input, position) {
|
|
578
|
+
const ch = input[position];
|
|
579
|
+
return ch === "#" || ch === ".";
|
|
580
|
+
}
|
|
581
|
+
extract(input, position) {
|
|
582
|
+
const prefix = input[position];
|
|
583
|
+
if (prefix !== "#" && prefix !== ".") return null;
|
|
584
|
+
let end = position + 1;
|
|
585
|
+
while (end < input.length && /[\p{L}\p{N}_-]/u.test(input[end])) {
|
|
586
|
+
end++;
|
|
587
|
+
}
|
|
588
|
+
if (end === position + 1) return null;
|
|
589
|
+
return { value: input.slice(position, end), length: end - position };
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
var LatinExtendedIdentifierExtractor = class {
|
|
593
|
+
name = "latin-extended-identifier";
|
|
594
|
+
canExtract(input, position) {
|
|
595
|
+
return /\p{L}/u.test(input[position]);
|
|
596
|
+
}
|
|
597
|
+
extract(input, position) {
|
|
598
|
+
let end = position;
|
|
599
|
+
while (end < input.length && /[\p{L}\p{N}_-]/u.test(input[end])) {
|
|
600
|
+
end++;
|
|
601
|
+
}
|
|
602
|
+
if (end === position) return null;
|
|
603
|
+
return { value: input.slice(position, end), length: end - position };
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
var cssSelectorExtractor = new CSSSelectorExtractor();
|
|
607
|
+
var EnglishVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
608
|
+
language: "en",
|
|
609
|
+
direction: "ltr",
|
|
610
|
+
customExtractors: [cssSelectorExtractor],
|
|
611
|
+
keywords: [
|
|
612
|
+
// commands
|
|
613
|
+
"navigate",
|
|
614
|
+
"go",
|
|
615
|
+
"click",
|
|
616
|
+
"press",
|
|
617
|
+
"tap",
|
|
618
|
+
"type",
|
|
619
|
+
"enter",
|
|
620
|
+
"scroll",
|
|
621
|
+
"read",
|
|
622
|
+
"say",
|
|
623
|
+
"zoom",
|
|
624
|
+
"select",
|
|
625
|
+
"back",
|
|
626
|
+
"forward",
|
|
627
|
+
"focus",
|
|
628
|
+
"close",
|
|
629
|
+
"open",
|
|
630
|
+
"search",
|
|
631
|
+
"find",
|
|
632
|
+
"help",
|
|
633
|
+
// markers
|
|
634
|
+
"to",
|
|
635
|
+
"into",
|
|
636
|
+
"by",
|
|
637
|
+
"in",
|
|
638
|
+
"on",
|
|
639
|
+
"the",
|
|
640
|
+
"a",
|
|
641
|
+
// direction words
|
|
642
|
+
"up",
|
|
643
|
+
"down",
|
|
644
|
+
"left",
|
|
645
|
+
"right",
|
|
646
|
+
"top",
|
|
647
|
+
"bottom",
|
|
648
|
+
// zoom words
|
|
649
|
+
"in",
|
|
650
|
+
"out",
|
|
651
|
+
"reset",
|
|
652
|
+
// targets
|
|
653
|
+
"tab",
|
|
654
|
+
"dialog",
|
|
655
|
+
"modal",
|
|
656
|
+
"menu",
|
|
657
|
+
"page",
|
|
658
|
+
"all"
|
|
659
|
+
],
|
|
660
|
+
caseInsensitive: true
|
|
661
|
+
});
|
|
662
|
+
var SpanishVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
663
|
+
language: "es",
|
|
664
|
+
direction: "ltr",
|
|
665
|
+
customExtractors: [cssSelectorExtractor, new LatinExtendedIdentifierExtractor()],
|
|
666
|
+
keywords: [
|
|
667
|
+
"navegar",
|
|
668
|
+
"ir",
|
|
669
|
+
"clic",
|
|
670
|
+
"pulsar",
|
|
671
|
+
"escribir",
|
|
672
|
+
"desplazar",
|
|
673
|
+
"leer",
|
|
674
|
+
"zoom",
|
|
675
|
+
"seleccionar",
|
|
676
|
+
"atr\xE1s",
|
|
677
|
+
"volver",
|
|
678
|
+
"adelante",
|
|
679
|
+
"enfocar",
|
|
680
|
+
"cerrar",
|
|
681
|
+
"abrir",
|
|
682
|
+
"buscar",
|
|
683
|
+
"ayuda",
|
|
684
|
+
"a",
|
|
685
|
+
"en",
|
|
686
|
+
"por",
|
|
687
|
+
"el",
|
|
688
|
+
"la",
|
|
689
|
+
"de",
|
|
690
|
+
"sur",
|
|
691
|
+
"arriba",
|
|
692
|
+
"abajo",
|
|
693
|
+
"izquierda",
|
|
694
|
+
"derecha",
|
|
695
|
+
"m\xE1s",
|
|
696
|
+
"menos",
|
|
697
|
+
"todo",
|
|
698
|
+
"p\xE1gina",
|
|
699
|
+
"di\xE1logo"
|
|
700
|
+
],
|
|
701
|
+
caseInsensitive: true
|
|
702
|
+
});
|
|
703
|
+
var JapaneseVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
704
|
+
language: "ja",
|
|
705
|
+
direction: "ltr",
|
|
706
|
+
customExtractors: [cssSelectorExtractor],
|
|
707
|
+
keywords: [
|
|
708
|
+
"\u79FB\u52D5",
|
|
709
|
+
"\u30AF\u30EA\u30C3\u30AF",
|
|
710
|
+
"\u5165\u529B",
|
|
711
|
+
"\u30B9\u30AF\u30ED\u30FC\u30EB",
|
|
712
|
+
"\u8AAD\u3080",
|
|
713
|
+
"\u30BA\u30FC\u30E0",
|
|
714
|
+
"\u9078\u629E",
|
|
715
|
+
"\u623B\u308B",
|
|
716
|
+
"\u9032\u3080",
|
|
717
|
+
"\u30D5\u30A9\u30FC\u30AB\u30B9",
|
|
718
|
+
"\u9589\u3058\u308B",
|
|
719
|
+
"\u958B\u304F",
|
|
720
|
+
"\u691C\u7D22",
|
|
721
|
+
"\u30D8\u30EB\u30D7",
|
|
722
|
+
"\u3092",
|
|
723
|
+
"\u306B",
|
|
724
|
+
"\u3067",
|
|
725
|
+
"\u306E",
|
|
726
|
+
"\u3060\u3051",
|
|
727
|
+
"\u4E0A",
|
|
728
|
+
"\u4E0B",
|
|
729
|
+
"\u5DE6",
|
|
730
|
+
"\u53F3",
|
|
731
|
+
"\u30A4\u30F3",
|
|
732
|
+
"\u30A2\u30A6\u30C8",
|
|
733
|
+
"\u30EA\u30BB\u30C3\u30C8",
|
|
734
|
+
"\u30BF\u30D6",
|
|
735
|
+
"\u30C0\u30A4\u30A2\u30ED\u30B0",
|
|
736
|
+
"\u30DA\u30FC\u30B8",
|
|
737
|
+
"\u5168\u3066"
|
|
738
|
+
],
|
|
739
|
+
keywordExtras: [
|
|
740
|
+
{ native: "\u79FB\u52D5", normalized: "navigate" },
|
|
741
|
+
{ native: "\u30AF\u30EA\u30C3\u30AF", normalized: "click" },
|
|
742
|
+
{ native: "\u5165\u529B", normalized: "type" },
|
|
743
|
+
{ native: "\u30B9\u30AF\u30ED\u30FC\u30EB", normalized: "scroll" },
|
|
744
|
+
{ native: "\u8AAD\u3080", normalized: "read" },
|
|
745
|
+
{ native: "\u30BA\u30FC\u30E0", normalized: "zoom" },
|
|
746
|
+
{ native: "\u9078\u629E", normalized: "select" },
|
|
747
|
+
{ native: "\u623B\u308B", normalized: "back" },
|
|
748
|
+
{ native: "\u9032\u3080", normalized: "forward" },
|
|
749
|
+
{ native: "\u30D5\u30A9\u30FC\u30AB\u30B9", normalized: "focus" },
|
|
750
|
+
{ native: "\u9589\u3058\u308B", normalized: "close" },
|
|
751
|
+
{ native: "\u958B\u304F", normalized: "open" },
|
|
752
|
+
{ native: "\u691C\u7D22", normalized: "search" },
|
|
753
|
+
{ native: "\u30D8\u30EB\u30D7", normalized: "help" },
|
|
754
|
+
{ native: "\u3092", normalized: "wo" },
|
|
755
|
+
{ native: "\u306B", normalized: "ni" },
|
|
756
|
+
{ native: "\u3067", normalized: "de" }
|
|
757
|
+
],
|
|
758
|
+
keywordProfile: {
|
|
759
|
+
keywords: {
|
|
760
|
+
navigate: { primary: "\u79FB\u52D5" },
|
|
761
|
+
click: { primary: "\u30AF\u30EA\u30C3\u30AF" },
|
|
762
|
+
type: { primary: "\u5165\u529B" },
|
|
763
|
+
scroll: { primary: "\u30B9\u30AF\u30ED\u30FC\u30EB" },
|
|
764
|
+
read: { primary: "\u8AAD\u3080" },
|
|
765
|
+
zoom: { primary: "\u30BA\u30FC\u30E0" },
|
|
766
|
+
select: { primary: "\u9078\u629E" },
|
|
767
|
+
back: { primary: "\u623B\u308B" },
|
|
768
|
+
forward: { primary: "\u9032\u3080" },
|
|
769
|
+
focus: { primary: "\u30D5\u30A9\u30FC\u30AB\u30B9" },
|
|
770
|
+
close: { primary: "\u9589\u3058\u308B" },
|
|
771
|
+
open: { primary: "\u958B\u304F" },
|
|
772
|
+
search: { primary: "\u691C\u7D22" },
|
|
773
|
+
help: { primary: "\u30D8\u30EB\u30D7" }
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
caseInsensitive: false
|
|
777
|
+
});
|
|
778
|
+
var ArabicVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
779
|
+
language: "ar",
|
|
780
|
+
direction: "rtl",
|
|
781
|
+
customExtractors: [cssSelectorExtractor],
|
|
782
|
+
keywords: [
|
|
783
|
+
"\u0627\u0646\u062A\u0642\u0644",
|
|
784
|
+
"\u0627\u0646\u0642\u0631",
|
|
785
|
+
"\u0627\u0643\u062A\u0628",
|
|
786
|
+
"\u062A\u0645\u0631\u064A\u0631",
|
|
787
|
+
"\u0627\u0642\u0631\u0623",
|
|
788
|
+
"\u062A\u0643\u0628\u064A\u0631",
|
|
789
|
+
"\u0627\u062E\u062A\u0631",
|
|
790
|
+
"\u0631\u062C\u0648\u0639",
|
|
791
|
+
"\u062A\u0642\u062F\u0645",
|
|
792
|
+
"\u0631\u0643\u0632",
|
|
793
|
+
"\u0623\u063A\u0644\u0642",
|
|
794
|
+
"\u0627\u0641\u062A\u062D",
|
|
795
|
+
"\u0627\u0628\u062D\u062B",
|
|
796
|
+
"\u0645\u0633\u0627\u0639\u062F\u0629",
|
|
797
|
+
"\u0625\u0644\u0649",
|
|
798
|
+
"\u0639\u0644\u0649",
|
|
799
|
+
"\u0641\u064A",
|
|
800
|
+
"\u0639\u0646",
|
|
801
|
+
"\u0628",
|
|
802
|
+
"\u0623\u0639\u0644\u0649",
|
|
803
|
+
"\u0623\u0633\u0641\u0644",
|
|
804
|
+
"\u064A\u0633\u0627\u0631",
|
|
805
|
+
"\u064A\u0645\u064A\u0646",
|
|
806
|
+
"\u0627\u0644\u0643\u0644",
|
|
807
|
+
"\u0627\u0644\u0635\u0641\u062D\u0629",
|
|
808
|
+
"\u0627\u0644\u062D\u0648\u0627\u0631"
|
|
809
|
+
],
|
|
810
|
+
keywordExtras: [
|
|
811
|
+
{ native: "\u0627\u0646\u062A\u0642\u0644", normalized: "navigate" },
|
|
812
|
+
{ native: "\u0627\u0646\u0642\u0631", normalized: "click" },
|
|
813
|
+
{ native: "\u0627\u0643\u062A\u0628", normalized: "type" },
|
|
814
|
+
{ native: "\u062A\u0645\u0631\u064A\u0631", normalized: "scroll" },
|
|
815
|
+
{ native: "\u0627\u0642\u0631\u0623", normalized: "read" },
|
|
816
|
+
{ native: "\u062A\u0643\u0628\u064A\u0631", normalized: "zoom" },
|
|
817
|
+
{ native: "\u0627\u062E\u062A\u0631", normalized: "select" },
|
|
818
|
+
{ native: "\u0631\u062C\u0648\u0639", normalized: "back" },
|
|
819
|
+
{ native: "\u062A\u0642\u062F\u0645", normalized: "forward" },
|
|
820
|
+
{ native: "\u0631\u0643\u0632", normalized: "focus" },
|
|
821
|
+
{ native: "\u0623\u063A\u0644\u0642", normalized: "close" },
|
|
822
|
+
{ native: "\u0627\u0641\u062A\u062D", normalized: "open" },
|
|
823
|
+
{ native: "\u0627\u0628\u062D\u062B", normalized: "search" },
|
|
824
|
+
{ native: "\u0645\u0633\u0627\u0639\u062F\u0629", normalized: "help" },
|
|
825
|
+
{ native: "\u0625\u0644\u0649", normalized: "to" },
|
|
826
|
+
{ native: "\u0639\u0644\u0649", normalized: "on" },
|
|
827
|
+
{ native: "\u0641\u064A", normalized: "in" },
|
|
828
|
+
{ native: "\u0639\u0646", normalized: "about" }
|
|
829
|
+
],
|
|
830
|
+
keywordProfile: {
|
|
831
|
+
keywords: {
|
|
832
|
+
navigate: { primary: "\u0627\u0646\u062A\u0642\u0644" },
|
|
833
|
+
click: { primary: "\u0627\u0646\u0642\u0631" },
|
|
834
|
+
type: { primary: "\u0627\u0643\u062A\u0628" },
|
|
835
|
+
scroll: { primary: "\u062A\u0645\u0631\u064A\u0631" },
|
|
836
|
+
read: { primary: "\u0627\u0642\u0631\u0623" },
|
|
837
|
+
zoom: { primary: "\u062A\u0643\u0628\u064A\u0631" },
|
|
838
|
+
select: { primary: "\u0627\u062E\u062A\u0631" },
|
|
839
|
+
back: { primary: "\u0631\u062C\u0648\u0639" },
|
|
840
|
+
forward: { primary: "\u062A\u0642\u062F\u0645" },
|
|
841
|
+
focus: { primary: "\u0631\u0643\u0632" },
|
|
842
|
+
close: { primary: "\u0623\u063A\u0644\u0642" },
|
|
843
|
+
open: { primary: "\u0627\u0641\u062A\u062D" },
|
|
844
|
+
search: { primary: "\u0627\u0628\u062D\u062B" },
|
|
845
|
+
help: { primary: "\u0645\u0633\u0627\u0639\u062F\u0629" }
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
caseInsensitive: false
|
|
849
|
+
});
|
|
850
|
+
var KoreanVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
851
|
+
language: "ko",
|
|
852
|
+
direction: "ltr",
|
|
853
|
+
customExtractors: [cssSelectorExtractor],
|
|
854
|
+
keywords: [
|
|
855
|
+
"\uC774\uB3D9",
|
|
856
|
+
"\uD074\uB9AD",
|
|
857
|
+
"\uC785\uB825",
|
|
858
|
+
"\uC2A4\uD06C\uB864",
|
|
859
|
+
"\uC77D\uAE30",
|
|
860
|
+
"\uD655\uB300",
|
|
861
|
+
"\uC120\uD0DD",
|
|
862
|
+
"\uB4A4\uB85C",
|
|
863
|
+
"\uC55E\uC73C\uB85C",
|
|
864
|
+
"\uD3EC\uCEE4\uC2A4",
|
|
865
|
+
"\uB2EB\uAE30",
|
|
866
|
+
"\uC5F4\uAE30",
|
|
867
|
+
"\uAC80\uC0C9",
|
|
868
|
+
"\uB3C4\uC6C0\uB9D0",
|
|
869
|
+
"\uC744",
|
|
870
|
+
"\uB97C",
|
|
871
|
+
"\uC5D0",
|
|
872
|
+
"\uC5D0\uC11C",
|
|
873
|
+
"\uB85C",
|
|
874
|
+
"\uB9CC\uD07C",
|
|
875
|
+
"\uC704",
|
|
876
|
+
"\uC544\uB798",
|
|
877
|
+
"\uC67C\uCABD",
|
|
878
|
+
"\uC624\uB978\uCABD",
|
|
879
|
+
"\uC804\uCCB4",
|
|
880
|
+
"\uD0ED",
|
|
881
|
+
"\uB300\uD654\uC0C1\uC790",
|
|
882
|
+
"\uD398\uC774\uC9C0"
|
|
883
|
+
],
|
|
884
|
+
keywordExtras: [
|
|
885
|
+
{ native: "\uC774\uB3D9", normalized: "navigate" },
|
|
886
|
+
{ native: "\uD074\uB9AD", normalized: "click" },
|
|
887
|
+
{ native: "\uC785\uB825", normalized: "type" },
|
|
888
|
+
{ native: "\uC2A4\uD06C\uB864", normalized: "scroll" },
|
|
889
|
+
{ native: "\uC77D\uAE30", normalized: "read" },
|
|
890
|
+
{ native: "\uD655\uB300", normalized: "zoom" },
|
|
891
|
+
{ native: "\uC120\uD0DD", normalized: "select" },
|
|
892
|
+
{ native: "\uB4A4\uB85C", normalized: "back" },
|
|
893
|
+
{ native: "\uC55E\uC73C\uB85C", normalized: "forward" },
|
|
894
|
+
{ native: "\uD3EC\uCEE4\uC2A4", normalized: "focus" },
|
|
895
|
+
{ native: "\uB2EB\uAE30", normalized: "close" },
|
|
896
|
+
{ native: "\uC5F4\uAE30", normalized: "open" },
|
|
897
|
+
{ native: "\uAC80\uC0C9", normalized: "search" },
|
|
898
|
+
{ native: "\uB3C4\uC6C0\uB9D0", normalized: "help" },
|
|
899
|
+
{ native: "\uC744", normalized: "eul" },
|
|
900
|
+
{ native: "\uB97C", normalized: "reul" },
|
|
901
|
+
{ native: "\uC5D0", normalized: "e" },
|
|
902
|
+
{ native: "\uC5D0\uC11C", normalized: "eseo" },
|
|
903
|
+
{ native: "\uB85C", normalized: "ro" }
|
|
904
|
+
],
|
|
905
|
+
keywordProfile: {
|
|
906
|
+
keywords: {
|
|
907
|
+
navigate: { primary: "\uC774\uB3D9" },
|
|
908
|
+
click: { primary: "\uD074\uB9AD" },
|
|
909
|
+
type: { primary: "\uC785\uB825" },
|
|
910
|
+
scroll: { primary: "\uC2A4\uD06C\uB864" },
|
|
911
|
+
read: { primary: "\uC77D\uAE30" },
|
|
912
|
+
zoom: { primary: "\uD655\uB300" },
|
|
913
|
+
select: { primary: "\uC120\uD0DD" },
|
|
914
|
+
back: { primary: "\uB4A4\uB85C" },
|
|
915
|
+
forward: { primary: "\uC55E\uC73C\uB85C" },
|
|
916
|
+
focus: { primary: "\uD3EC\uCEE4\uC2A4" },
|
|
917
|
+
close: { primary: "\uB2EB\uAE30" },
|
|
918
|
+
open: { primary: "\uC5F4\uAE30" },
|
|
919
|
+
search: { primary: "\uAC80\uC0C9" },
|
|
920
|
+
help: { primary: "\uB3C4\uC6C0\uB9D0" }
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
caseInsensitive: false
|
|
924
|
+
});
|
|
925
|
+
var ChineseVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
926
|
+
language: "zh",
|
|
927
|
+
direction: "ltr",
|
|
928
|
+
customExtractors: [cssSelectorExtractor],
|
|
929
|
+
keywords: [
|
|
930
|
+
"\u5BFC\u822A",
|
|
931
|
+
"\u70B9\u51FB",
|
|
932
|
+
"\u8F93\u5165",
|
|
933
|
+
"\u6EDA\u52A8",
|
|
934
|
+
"\u6717\u8BFB",
|
|
935
|
+
"\u7F29\u653E",
|
|
936
|
+
"\u9009\u62E9",
|
|
937
|
+
"\u8FD4\u56DE",
|
|
938
|
+
"\u524D\u8FDB",
|
|
939
|
+
"\u805A\u7126",
|
|
940
|
+
"\u5173\u95ED",
|
|
941
|
+
"\u6253\u5F00",
|
|
942
|
+
"\u641C\u7D22",
|
|
943
|
+
"\u5E2E\u52A9",
|
|
944
|
+
"\u5230",
|
|
945
|
+
"\u5728",
|
|
946
|
+
"\u5E45",
|
|
947
|
+
"\u4E0A",
|
|
948
|
+
"\u4E0B",
|
|
949
|
+
"\u5DE6",
|
|
950
|
+
"\u53F3",
|
|
951
|
+
"\u5168\u90E8",
|
|
952
|
+
"\u6807\u7B7E",
|
|
953
|
+
"\u5BF9\u8BDD\u6846",
|
|
954
|
+
"\u9875\u9762",
|
|
955
|
+
"\u653E\u5927",
|
|
956
|
+
"\u7F29\u5C0F",
|
|
957
|
+
"\u91CD\u7F6E"
|
|
958
|
+
],
|
|
959
|
+
keywordExtras: [
|
|
960
|
+
{ native: "\u5BFC\u822A", normalized: "navigate" },
|
|
961
|
+
{ native: "\u70B9\u51FB", normalized: "click" },
|
|
962
|
+
{ native: "\u8F93\u5165", normalized: "type" },
|
|
963
|
+
{ native: "\u6EDA\u52A8", normalized: "scroll" },
|
|
964
|
+
{ native: "\u6717\u8BFB", normalized: "read" },
|
|
965
|
+
{ native: "\u7F29\u653E", normalized: "zoom" },
|
|
966
|
+
{ native: "\u9009\u62E9", normalized: "select" },
|
|
967
|
+
{ native: "\u8FD4\u56DE", normalized: "back" },
|
|
968
|
+
{ native: "\u524D\u8FDB", normalized: "forward" },
|
|
969
|
+
{ native: "\u805A\u7126", normalized: "focus" },
|
|
970
|
+
{ native: "\u5173\u95ED", normalized: "close" },
|
|
971
|
+
{ native: "\u6253\u5F00", normalized: "open" },
|
|
972
|
+
{ native: "\u641C\u7D22", normalized: "search" },
|
|
973
|
+
{ native: "\u5E2E\u52A9", normalized: "help" },
|
|
974
|
+
{ native: "\u5230", normalized: "to" },
|
|
975
|
+
{ native: "\u5728", normalized: "in" }
|
|
976
|
+
],
|
|
977
|
+
keywordProfile: {
|
|
978
|
+
keywords: {
|
|
979
|
+
navigate: { primary: "\u5BFC\u822A" },
|
|
980
|
+
click: { primary: "\u70B9\u51FB" },
|
|
981
|
+
type: { primary: "\u8F93\u5165" },
|
|
982
|
+
scroll: { primary: "\u6EDA\u52A8" },
|
|
983
|
+
read: { primary: "\u6717\u8BFB" },
|
|
984
|
+
zoom: { primary: "\u7F29\u653E" },
|
|
985
|
+
select: { primary: "\u9009\u62E9" },
|
|
986
|
+
back: { primary: "\u8FD4\u56DE" },
|
|
987
|
+
forward: { primary: "\u524D\u8FDB" },
|
|
988
|
+
focus: { primary: "\u805A\u7126" },
|
|
989
|
+
close: { primary: "\u5173\u95ED" },
|
|
990
|
+
open: { primary: "\u6253\u5F00" },
|
|
991
|
+
search: { primary: "\u641C\u7D22" },
|
|
992
|
+
help: { primary: "\u5E2E\u52A9" }
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
caseInsensitive: false
|
|
996
|
+
});
|
|
997
|
+
var TurkishVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
998
|
+
language: "tr",
|
|
999
|
+
direction: "ltr",
|
|
1000
|
+
customExtractors: [cssSelectorExtractor, new LatinExtendedIdentifierExtractor()],
|
|
1001
|
+
keywords: [
|
|
1002
|
+
"git",
|
|
1003
|
+
"t\u0131kla",
|
|
1004
|
+
"yaz",
|
|
1005
|
+
"kayd\u0131r",
|
|
1006
|
+
"oku",
|
|
1007
|
+
"yak\u0131nla\u015F",
|
|
1008
|
+
"se\xE7",
|
|
1009
|
+
"geri",
|
|
1010
|
+
"ileri",
|
|
1011
|
+
"odakla",
|
|
1012
|
+
"kapat",
|
|
1013
|
+
"a\xE7",
|
|
1014
|
+
"ara",
|
|
1015
|
+
"yard\u0131m",
|
|
1016
|
+
"ya",
|
|
1017
|
+
"da",
|
|
1018
|
+
"kadar",
|
|
1019
|
+
"yukar\u0131",
|
|
1020
|
+
"a\u015Fa\u011F\u0131",
|
|
1021
|
+
"sol",
|
|
1022
|
+
"sa\u011F",
|
|
1023
|
+
"sekme",
|
|
1024
|
+
"diyalog",
|
|
1025
|
+
"sayfa",
|
|
1026
|
+
"hepsi"
|
|
1027
|
+
],
|
|
1028
|
+
keywordExtras: [
|
|
1029
|
+
{ native: "git", normalized: "navigate" },
|
|
1030
|
+
{ native: "t\u0131kla", normalized: "click" },
|
|
1031
|
+
{ native: "yaz", normalized: "type" },
|
|
1032
|
+
{ native: "kayd\u0131r", normalized: "scroll" },
|
|
1033
|
+
{ native: "oku", normalized: "read" },
|
|
1034
|
+
{ native: "yak\u0131nla\u015F", normalized: "zoom" },
|
|
1035
|
+
{ native: "se\xE7", normalized: "select" },
|
|
1036
|
+
{ native: "geri", normalized: "back" },
|
|
1037
|
+
{ native: "ileri", normalized: "forward" },
|
|
1038
|
+
{ native: "odakla", normalized: "focus" },
|
|
1039
|
+
{ native: "kapat", normalized: "close" },
|
|
1040
|
+
{ native: "a\xE7", normalized: "open" },
|
|
1041
|
+
{ native: "ara", normalized: "search" },
|
|
1042
|
+
{ native: "yard\u0131m", normalized: "help" },
|
|
1043
|
+
{ native: "ya", normalized: "to" },
|
|
1044
|
+
{ native: "da", normalized: "in" }
|
|
1045
|
+
],
|
|
1046
|
+
keywordProfile: {
|
|
1047
|
+
keywords: {
|
|
1048
|
+
navigate: { primary: "git" },
|
|
1049
|
+
click: { primary: "t\u0131kla" },
|
|
1050
|
+
type: { primary: "yaz" },
|
|
1051
|
+
scroll: { primary: "kayd\u0131r" },
|
|
1052
|
+
read: { primary: "oku" },
|
|
1053
|
+
zoom: { primary: "yak\u0131nla\u015F" },
|
|
1054
|
+
select: { primary: "se\xE7" },
|
|
1055
|
+
back: { primary: "geri" },
|
|
1056
|
+
forward: { primary: "ileri" },
|
|
1057
|
+
focus: { primary: "odakla" },
|
|
1058
|
+
close: { primary: "kapat" },
|
|
1059
|
+
open: { primary: "a\xE7" },
|
|
1060
|
+
search: { primary: "ara" },
|
|
1061
|
+
help: { primary: "yard\u0131m" }
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
caseInsensitive: true
|
|
1065
|
+
});
|
|
1066
|
+
var FrenchVoiceTokenizer = (0, import_framework2.createSimpleTokenizer)({
|
|
1067
|
+
language: "fr",
|
|
1068
|
+
direction: "ltr",
|
|
1069
|
+
customExtractors: [cssSelectorExtractor, new LatinExtendedIdentifierExtractor()],
|
|
1070
|
+
keywords: [
|
|
1071
|
+
"naviguer",
|
|
1072
|
+
"aller",
|
|
1073
|
+
"cliquer",
|
|
1074
|
+
"taper",
|
|
1075
|
+
"\xE9crire",
|
|
1076
|
+
"d\xE9filer",
|
|
1077
|
+
"lire",
|
|
1078
|
+
"zoomer",
|
|
1079
|
+
"s\xE9lectionner",
|
|
1080
|
+
"retour",
|
|
1081
|
+
"avancer",
|
|
1082
|
+
"focaliser",
|
|
1083
|
+
"fermer",
|
|
1084
|
+
"ouvrir",
|
|
1085
|
+
"chercher",
|
|
1086
|
+
"rechercher",
|
|
1087
|
+
"aide",
|
|
1088
|
+
"vers",
|
|
1089
|
+
"dans",
|
|
1090
|
+
"de",
|
|
1091
|
+
"sur",
|
|
1092
|
+
"le",
|
|
1093
|
+
"la",
|
|
1094
|
+
"les",
|
|
1095
|
+
"un",
|
|
1096
|
+
"une",
|
|
1097
|
+
"haut",
|
|
1098
|
+
"bas",
|
|
1099
|
+
"gauche",
|
|
1100
|
+
"droite",
|
|
1101
|
+
"onglet",
|
|
1102
|
+
"dialogue",
|
|
1103
|
+
"page",
|
|
1104
|
+
"tout"
|
|
1105
|
+
],
|
|
1106
|
+
keywordExtras: [
|
|
1107
|
+
{ native: "naviguer", normalized: "navigate" },
|
|
1108
|
+
{ native: "aller", normalized: "go" },
|
|
1109
|
+
{ native: "cliquer", normalized: "click" },
|
|
1110
|
+
{ native: "taper", normalized: "type" },
|
|
1111
|
+
{ native: "\xE9crire", normalized: "write" },
|
|
1112
|
+
{ native: "d\xE9filer", normalized: "scroll" },
|
|
1113
|
+
{ native: "lire", normalized: "read" },
|
|
1114
|
+
{ native: "zoomer", normalized: "zoom" },
|
|
1115
|
+
{ native: "s\xE9lectionner", normalized: "select" },
|
|
1116
|
+
{ native: "retour", normalized: "back" },
|
|
1117
|
+
{ native: "avancer", normalized: "forward" },
|
|
1118
|
+
{ native: "focaliser", normalized: "focus" },
|
|
1119
|
+
{ native: "fermer", normalized: "close" },
|
|
1120
|
+
{ native: "ouvrir", normalized: "open" },
|
|
1121
|
+
{ native: "chercher", normalized: "search" },
|
|
1122
|
+
{ native: "rechercher", normalized: "search" },
|
|
1123
|
+
{ native: "aide", normalized: "help" },
|
|
1124
|
+
{ native: "vers", normalized: "to" },
|
|
1125
|
+
{ native: "dans", normalized: "in" },
|
|
1126
|
+
{ native: "sur", normalized: "on" }
|
|
1127
|
+
],
|
|
1128
|
+
keywordProfile: {
|
|
1129
|
+
keywords: {
|
|
1130
|
+
navigate: { primary: "naviguer", alternatives: ["aller"] },
|
|
1131
|
+
click: { primary: "cliquer" },
|
|
1132
|
+
type: { primary: "taper", alternatives: ["\xE9crire"] },
|
|
1133
|
+
scroll: { primary: "d\xE9filer" },
|
|
1134
|
+
read: { primary: "lire" },
|
|
1135
|
+
zoom: { primary: "zoomer" },
|
|
1136
|
+
select: { primary: "s\xE9lectionner" },
|
|
1137
|
+
back: { primary: "retour" },
|
|
1138
|
+
forward: { primary: "avancer" },
|
|
1139
|
+
focus: { primary: "focaliser" },
|
|
1140
|
+
close: { primary: "fermer" },
|
|
1141
|
+
open: { primary: "ouvrir" },
|
|
1142
|
+
search: { primary: "chercher", alternatives: ["rechercher"] },
|
|
1143
|
+
help: { primary: "aide" }
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
caseInsensitive: true
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
// src/generators/voice-generator.ts
|
|
1150
|
+
var import_framework3 = require("@lokascript/framework");
|
|
1151
|
+
function esc(s) {
|
|
1152
|
+
return s.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\$/g, "\\$");
|
|
1153
|
+
}
|
|
1154
|
+
var FIND_EL = [
|
|
1155
|
+
`if(!window._findEl){window._findEl=function(q,root){`,
|
|
1156
|
+
` root=root||document;`,
|
|
1157
|
+
` if(q.startsWith('#')||q.startsWith('.')||q.includes('[')){`,
|
|
1158
|
+
` try{return root.querySelector(q)}catch(e){}`,
|
|
1159
|
+
` }`,
|
|
1160
|
+
` var el=root.querySelector('[aria-label="'+q+'"]');`,
|
|
1161
|
+
` if(el)return el;`,
|
|
1162
|
+
` el=root.querySelector('[role="'+q+'"]');`,
|
|
1163
|
+
` if(el)return el;`,
|
|
1164
|
+
` var c=root.querySelectorAll('button,a,input,[role="button"],[tabindex]');`,
|
|
1165
|
+
` var lq=q.toLowerCase();`,
|
|
1166
|
+
` for(var i=0;i<c.length;i++){`,
|
|
1167
|
+
` if((c[i].textContent||'').toLowerCase().includes(lq))return c[i];`,
|
|
1168
|
+
` if((c[i].getAttribute('aria-label')||'').toLowerCase().includes(lq))return c[i];`,
|
|
1169
|
+
` }`,
|
|
1170
|
+
` return null;`,
|
|
1171
|
+
`}}`
|
|
1172
|
+
].join("");
|
|
1173
|
+
var SELECT_ALL_WORDS = /* @__PURE__ */ new Set(["all", "todo", "\u5168\u3066", "\u5168\u90E8", "\u0627\u0644\u0643\u0644", "\uC804\uCCB4", "hepsi", "tout"]);
|
|
1174
|
+
var TAB_WORDS = /* @__PURE__ */ new Set(["tab", "pesta\xF1a", "\u30BF\u30D6", "\uD0ED", "\u6807\u7B7E", "sekme", "onglet"]);
|
|
1175
|
+
var DIALOG_WORDS = /* @__PURE__ */ new Set([
|
|
1176
|
+
"dialog",
|
|
1177
|
+
"modal",
|
|
1178
|
+
"di\xE1logo",
|
|
1179
|
+
"\u30C0\u30A4\u30A2\u30ED\u30B0",
|
|
1180
|
+
"\uB300\uD654\uC0C1\uC790",
|
|
1181
|
+
"\u5BF9\u8BDD\u6846",
|
|
1182
|
+
"diyalog",
|
|
1183
|
+
"dialogue"
|
|
1184
|
+
]);
|
|
1185
|
+
var PAGE_WORDS = /* @__PURE__ */ new Set(["page", "p\xE1gina", "\u30DA\u30FC\u30B8", "\u0627\u0644\u0635\u0641\u062D\u0629", "\uD398\uC774\uC9C0", "\u9875\u9762", "sayfa"]);
|
|
1186
|
+
function generateNavigate(node) {
|
|
1187
|
+
const dest = (0, import_framework3.extractRoleValue)(node, "destination");
|
|
1188
|
+
if (!dest) return "// navigate: missing destination";
|
|
1189
|
+
if (dest.startsWith("/") || dest.startsWith("http")) {
|
|
1190
|
+
return `window.location.href = '${esc(dest)}';`;
|
|
1191
|
+
}
|
|
1192
|
+
return [
|
|
1193
|
+
FIND_EL,
|
|
1194
|
+
`var el = _findEl('${esc(dest)}');`,
|
|
1195
|
+
`if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' });`,
|
|
1196
|
+
`else window.location.hash = '${esc(dest)}';`
|
|
1197
|
+
].join("\n");
|
|
1198
|
+
}
|
|
1199
|
+
function generateClick(node) {
|
|
1200
|
+
const patient = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1201
|
+
if (!patient) return "// click: missing target";
|
|
1202
|
+
return [FIND_EL, `var el = _findEl('${esc(patient)}');`, `if (el) el.click();`].join("\n");
|
|
1203
|
+
}
|
|
1204
|
+
function generateType(node) {
|
|
1205
|
+
const text = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1206
|
+
if (!text) return "// type: missing text";
|
|
1207
|
+
const dest = (0, import_framework3.extractRoleValue)(node, "destination");
|
|
1208
|
+
const target = dest ? `_findEl('${esc(dest)}') || document.activeElement` : `document.activeElement`;
|
|
1209
|
+
return [
|
|
1210
|
+
FIND_EL,
|
|
1211
|
+
`var el = ${target};`,
|
|
1212
|
+
`if (el && ('value' in el || el.isContentEditable)) {`,
|
|
1213
|
+
` if ('value' in el) { el.value = (el.value || '') + '${esc(text)}'; }`,
|
|
1214
|
+
` else { el.textContent = (el.textContent || '') + '${esc(text)}'; }`,
|
|
1215
|
+
` el.dispatchEvent(new Event('input', { bubbles: true }));`,
|
|
1216
|
+
`}`
|
|
1217
|
+
].join("\n");
|
|
1218
|
+
}
|
|
1219
|
+
function generateScroll(node) {
|
|
1220
|
+
const manner = ((0, import_framework3.extractRoleValue)(node, "manner") || "down").toLowerCase();
|
|
1221
|
+
const quantity = (0, import_framework3.extractRoleValue)(node, "quantity");
|
|
1222
|
+
const px = quantity ? parseInt(quantity, 10) || 300 : 300;
|
|
1223
|
+
switch (manner) {
|
|
1224
|
+
case "up":
|
|
1225
|
+
return `window.scrollBy({ top: -${px}, behavior: 'smooth' });`;
|
|
1226
|
+
case "down":
|
|
1227
|
+
return `window.scrollBy({ top: ${px}, behavior: 'smooth' });`;
|
|
1228
|
+
case "left":
|
|
1229
|
+
return `window.scrollBy({ left: -${px}, behavior: 'smooth' });`;
|
|
1230
|
+
case "right":
|
|
1231
|
+
return `window.scrollBy({ left: ${px}, behavior: 'smooth' });`;
|
|
1232
|
+
case "top":
|
|
1233
|
+
return `window.scrollTo({ top: 0, behavior: 'smooth' });`;
|
|
1234
|
+
case "bottom":
|
|
1235
|
+
return `window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });`;
|
|
1236
|
+
default:
|
|
1237
|
+
return `window.scrollBy({ top: ${px}, behavior: 'smooth' });`;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
function generateRead(node) {
|
|
1241
|
+
const patient = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1242
|
+
if (!patient) return "// read: missing target";
|
|
1243
|
+
return [
|
|
1244
|
+
FIND_EL,
|
|
1245
|
+
`var el = _findEl('${esc(patient)}');`,
|
|
1246
|
+
`if (el && el.textContent) {`,
|
|
1247
|
+
` var utterance = new SpeechSynthesisUtterance(el.textContent);`,
|
|
1248
|
+
` speechSynthesis.speak(utterance);`,
|
|
1249
|
+
`}`
|
|
1250
|
+
].join("\n");
|
|
1251
|
+
}
|
|
1252
|
+
function generateZoom(node) {
|
|
1253
|
+
const manner = ((0, import_framework3.extractRoleValue)(node, "manner") || "in").toLowerCase();
|
|
1254
|
+
if (manner === "reset") {
|
|
1255
|
+
return [
|
|
1256
|
+
`document.documentElement.dataset.zoom = '1';`,
|
|
1257
|
+
`document.documentElement.style.transform = '';`
|
|
1258
|
+
].join("\n");
|
|
1259
|
+
}
|
|
1260
|
+
const factor = manner === "out" ? 0.9 : 1.1;
|
|
1261
|
+
return [
|
|
1262
|
+
`var s = parseFloat(document.documentElement.dataset.zoom || '1');`,
|
|
1263
|
+
`s = Math.round(s * ${factor} * 100) / 100;`,
|
|
1264
|
+
`document.documentElement.dataset.zoom = s;`,
|
|
1265
|
+
`document.documentElement.style.transform = 'scale(' + s + ')';`,
|
|
1266
|
+
`document.documentElement.style.transformOrigin = 'top left';`
|
|
1267
|
+
].join("\n");
|
|
1268
|
+
}
|
|
1269
|
+
function generateSelect(node) {
|
|
1270
|
+
const patient = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1271
|
+
if (!patient) return "// select: missing target";
|
|
1272
|
+
const target = SELECT_ALL_WORDS.has(patient) ? "document.body" : `_findEl('${esc(patient)}')`;
|
|
1273
|
+
const lines = SELECT_ALL_WORDS.has(patient) ? [] : [FIND_EL];
|
|
1274
|
+
lines.push(
|
|
1275
|
+
`var el = ${target};`,
|
|
1276
|
+
`if (el) {`,
|
|
1277
|
+
` var range = document.createRange();`,
|
|
1278
|
+
` range.selectNodeContents(el);`,
|
|
1279
|
+
` var sel = window.getSelection();`,
|
|
1280
|
+
` sel.removeAllRanges();`,
|
|
1281
|
+
` sel.addRange(range);`,
|
|
1282
|
+
`}`
|
|
1283
|
+
);
|
|
1284
|
+
return lines.join("\n");
|
|
1285
|
+
}
|
|
1286
|
+
function generateBack(node) {
|
|
1287
|
+
const quantity = (0, import_framework3.extractRoleValue)(node, "quantity");
|
|
1288
|
+
const n = quantity ? parseInt(quantity, 10) || 1 : 1;
|
|
1289
|
+
return `history.go(-${n});`;
|
|
1290
|
+
}
|
|
1291
|
+
function generateForward(node) {
|
|
1292
|
+
const quantity = (0, import_framework3.extractRoleValue)(node, "quantity");
|
|
1293
|
+
const n = quantity ? parseInt(quantity, 10) || 1 : 1;
|
|
1294
|
+
return `history.go(${n});`;
|
|
1295
|
+
}
|
|
1296
|
+
function generateFocus(node) {
|
|
1297
|
+
const patient = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1298
|
+
if (!patient) return "// focus: missing target";
|
|
1299
|
+
return [FIND_EL, `var el = _findEl('${esc(patient)}');`, `if (el) el.focus();`].join("\n");
|
|
1300
|
+
}
|
|
1301
|
+
function generateClose(node) {
|
|
1302
|
+
const patient = (0, import_framework3.extractRoleValue)(node, "patient") || "";
|
|
1303
|
+
if (TAB_WORDS.has(patient)) {
|
|
1304
|
+
return `window.close();`;
|
|
1305
|
+
}
|
|
1306
|
+
if (DIALOG_WORDS.has(patient)) {
|
|
1307
|
+
return `var d = document.querySelector('dialog[open]'); if (d) d.close();`;
|
|
1308
|
+
}
|
|
1309
|
+
return [
|
|
1310
|
+
`var d = document.querySelector('dialog[open]');`,
|
|
1311
|
+
`if (d) { d.close(); }`,
|
|
1312
|
+
`else {`,
|
|
1313
|
+
` var m = document.querySelector('[role="dialog"], .modal.show, .modal.open');`,
|
|
1314
|
+
` if (m) m.remove();`,
|
|
1315
|
+
`}`
|
|
1316
|
+
].join("\n");
|
|
1317
|
+
}
|
|
1318
|
+
function generateOpen(node) {
|
|
1319
|
+
const patient = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1320
|
+
if (!patient) return "// open: missing target";
|
|
1321
|
+
if (patient.startsWith("/") || patient.startsWith("http")) {
|
|
1322
|
+
return `window.open('${esc(patient)}', '_blank');`;
|
|
1323
|
+
}
|
|
1324
|
+
return [FIND_EL, `var el = _findEl('${esc(patient)}');`, `if (el) el.click();`].join("\n");
|
|
1325
|
+
}
|
|
1326
|
+
function generateSearch(node) {
|
|
1327
|
+
const query = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1328
|
+
if (!query) return "// search: missing query";
|
|
1329
|
+
const dest = (0, import_framework3.extractRoleValue)(node, "destination");
|
|
1330
|
+
if (dest && PAGE_WORDS.has(dest)) {
|
|
1331
|
+
return `window.find('${esc(query)}');`;
|
|
1332
|
+
}
|
|
1333
|
+
const selector = dest ? `'${esc(dest)}'` : `'input[type="search"], [role="searchbox"], input[name="q"], input[name="search"]'`;
|
|
1334
|
+
return [
|
|
1335
|
+
`var searchInput = document.querySelector(${selector});`,
|
|
1336
|
+
`if (searchInput) {`,
|
|
1337
|
+
` searchInput.value = '${esc(query)}';`,
|
|
1338
|
+
` searchInput.dispatchEvent(new Event('input', { bubbles: true }));`,
|
|
1339
|
+
` if (searchInput.form) searchInput.form.submit();`,
|
|
1340
|
+
`}`
|
|
1341
|
+
].join("\n");
|
|
1342
|
+
}
|
|
1343
|
+
function generateHelp(node) {
|
|
1344
|
+
const topic = (0, import_framework3.extractRoleValue)(node, "patient");
|
|
1345
|
+
const commands = [
|
|
1346
|
+
"navigate",
|
|
1347
|
+
"click",
|
|
1348
|
+
"type",
|
|
1349
|
+
"scroll",
|
|
1350
|
+
"read",
|
|
1351
|
+
"zoom",
|
|
1352
|
+
"select",
|
|
1353
|
+
"back",
|
|
1354
|
+
"forward",
|
|
1355
|
+
"focus",
|
|
1356
|
+
"close",
|
|
1357
|
+
"open",
|
|
1358
|
+
"search",
|
|
1359
|
+
"help"
|
|
1360
|
+
];
|
|
1361
|
+
if (topic) {
|
|
1362
|
+
return `console.log('Help: ${esc(topic)}');`;
|
|
1363
|
+
}
|
|
1364
|
+
return `console.log('Available commands: ${commands.join(", ")}');`;
|
|
1365
|
+
}
|
|
1366
|
+
var voiceCodeGenerator = {
|
|
1367
|
+
generate(node) {
|
|
1368
|
+
switch (node.action) {
|
|
1369
|
+
case "navigate":
|
|
1370
|
+
return generateNavigate(node);
|
|
1371
|
+
case "click":
|
|
1372
|
+
return generateClick(node);
|
|
1373
|
+
case "type":
|
|
1374
|
+
return generateType(node);
|
|
1375
|
+
case "scroll":
|
|
1376
|
+
return generateScroll(node);
|
|
1377
|
+
case "read":
|
|
1378
|
+
return generateRead(node);
|
|
1379
|
+
case "zoom":
|
|
1380
|
+
return generateZoom(node);
|
|
1381
|
+
case "select":
|
|
1382
|
+
return generateSelect(node);
|
|
1383
|
+
case "back":
|
|
1384
|
+
return generateBack(node);
|
|
1385
|
+
case "forward":
|
|
1386
|
+
return generateForward(node);
|
|
1387
|
+
case "focus":
|
|
1388
|
+
return generateFocus(node);
|
|
1389
|
+
case "close":
|
|
1390
|
+
return generateClose(node);
|
|
1391
|
+
case "open":
|
|
1392
|
+
return generateOpen(node);
|
|
1393
|
+
case "search":
|
|
1394
|
+
return generateSearch(node);
|
|
1395
|
+
case "help":
|
|
1396
|
+
return generateHelp(node);
|
|
1397
|
+
default:
|
|
1398
|
+
return `// Unknown voice command: ${node.action}`;
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
|
|
1403
|
+
// src/generators/voice-renderer.ts
|
|
1404
|
+
var import_framework4 = require("@lokascript/framework");
|
|
1405
|
+
var COMMAND_KEYWORDS = {
|
|
1406
|
+
navigate: {
|
|
1407
|
+
en: "navigate",
|
|
1408
|
+
es: "navegar",
|
|
1409
|
+
ja: "\u79FB\u52D5",
|
|
1410
|
+
ar: "\u0627\u0646\u062A\u0642\u0644",
|
|
1411
|
+
ko: "\uC774\uB3D9",
|
|
1412
|
+
zh: "\u5BFC\u822A",
|
|
1413
|
+
tr: "git",
|
|
1414
|
+
fr: "naviguer"
|
|
1415
|
+
},
|
|
1416
|
+
click: {
|
|
1417
|
+
en: "click",
|
|
1418
|
+
es: "clic",
|
|
1419
|
+
ja: "\u30AF\u30EA\u30C3\u30AF",
|
|
1420
|
+
ar: "\u0627\u0646\u0642\u0631",
|
|
1421
|
+
ko: "\uD074\uB9AD",
|
|
1422
|
+
zh: "\u70B9\u51FB",
|
|
1423
|
+
tr: "t\u0131kla",
|
|
1424
|
+
fr: "cliquer"
|
|
1425
|
+
},
|
|
1426
|
+
type: {
|
|
1427
|
+
en: "type",
|
|
1428
|
+
es: "escribir",
|
|
1429
|
+
ja: "\u5165\u529B",
|
|
1430
|
+
ar: "\u0627\u0643\u062A\u0628",
|
|
1431
|
+
ko: "\uC785\uB825",
|
|
1432
|
+
zh: "\u8F93\u5165",
|
|
1433
|
+
tr: "yaz",
|
|
1434
|
+
fr: "taper"
|
|
1435
|
+
},
|
|
1436
|
+
scroll: {
|
|
1437
|
+
en: "scroll",
|
|
1438
|
+
es: "desplazar",
|
|
1439
|
+
ja: "\u30B9\u30AF\u30ED\u30FC\u30EB",
|
|
1440
|
+
ar: "\u062A\u0645\u0631\u064A\u0631",
|
|
1441
|
+
ko: "\uC2A4\uD06C\uB864",
|
|
1442
|
+
zh: "\u6EDA\u52A8",
|
|
1443
|
+
tr: "kayd\u0131r",
|
|
1444
|
+
fr: "d\xE9filer"
|
|
1445
|
+
},
|
|
1446
|
+
read: {
|
|
1447
|
+
en: "read",
|
|
1448
|
+
es: "leer",
|
|
1449
|
+
ja: "\u8AAD\u3080",
|
|
1450
|
+
ar: "\u0627\u0642\u0631\u0623",
|
|
1451
|
+
ko: "\uC77D\uAE30",
|
|
1452
|
+
zh: "\u6717\u8BFB",
|
|
1453
|
+
tr: "oku",
|
|
1454
|
+
fr: "lire"
|
|
1455
|
+
},
|
|
1456
|
+
zoom: {
|
|
1457
|
+
en: "zoom",
|
|
1458
|
+
es: "zoom",
|
|
1459
|
+
ja: "\u30BA\u30FC\u30E0",
|
|
1460
|
+
ar: "\u062A\u0643\u0628\u064A\u0631",
|
|
1461
|
+
ko: "\uD655\uB300",
|
|
1462
|
+
zh: "\u7F29\u653E",
|
|
1463
|
+
tr: "yak\u0131nla\u015F",
|
|
1464
|
+
fr: "zoomer"
|
|
1465
|
+
},
|
|
1466
|
+
select: {
|
|
1467
|
+
en: "select",
|
|
1468
|
+
es: "seleccionar",
|
|
1469
|
+
ja: "\u9078\u629E",
|
|
1470
|
+
ar: "\u0627\u062E\u062A\u0631",
|
|
1471
|
+
ko: "\uC120\uD0DD",
|
|
1472
|
+
zh: "\u9009\u62E9",
|
|
1473
|
+
tr: "se\xE7",
|
|
1474
|
+
fr: "s\xE9lectionner"
|
|
1475
|
+
},
|
|
1476
|
+
back: {
|
|
1477
|
+
en: "back",
|
|
1478
|
+
es: "atr\xE1s",
|
|
1479
|
+
ja: "\u623B\u308B",
|
|
1480
|
+
ar: "\u0631\u062C\u0648\u0639",
|
|
1481
|
+
ko: "\uB4A4\uB85C",
|
|
1482
|
+
zh: "\u8FD4\u56DE",
|
|
1483
|
+
tr: "geri",
|
|
1484
|
+
fr: "retour"
|
|
1485
|
+
},
|
|
1486
|
+
forward: {
|
|
1487
|
+
en: "forward",
|
|
1488
|
+
es: "adelante",
|
|
1489
|
+
ja: "\u9032\u3080",
|
|
1490
|
+
ar: "\u062A\u0642\u062F\u0645",
|
|
1491
|
+
ko: "\uC55E\uC73C\uB85C",
|
|
1492
|
+
zh: "\u524D\u8FDB",
|
|
1493
|
+
tr: "ileri",
|
|
1494
|
+
fr: "avancer"
|
|
1495
|
+
},
|
|
1496
|
+
focus: {
|
|
1497
|
+
en: "focus",
|
|
1498
|
+
es: "enfocar",
|
|
1499
|
+
ja: "\u30D5\u30A9\u30FC\u30AB\u30B9",
|
|
1500
|
+
ar: "\u0631\u0643\u0632",
|
|
1501
|
+
ko: "\uD3EC\uCEE4\uC2A4",
|
|
1502
|
+
zh: "\u805A\u7126",
|
|
1503
|
+
tr: "odakla",
|
|
1504
|
+
fr: "focaliser"
|
|
1505
|
+
},
|
|
1506
|
+
close: {
|
|
1507
|
+
en: "close",
|
|
1508
|
+
es: "cerrar",
|
|
1509
|
+
ja: "\u9589\u3058\u308B",
|
|
1510
|
+
ar: "\u0623\u063A\u0644\u0642",
|
|
1511
|
+
ko: "\uB2EB\uAE30",
|
|
1512
|
+
zh: "\u5173\u95ED",
|
|
1513
|
+
tr: "kapat",
|
|
1514
|
+
fr: "fermer"
|
|
1515
|
+
},
|
|
1516
|
+
open: {
|
|
1517
|
+
en: "open",
|
|
1518
|
+
es: "abrir",
|
|
1519
|
+
ja: "\u958B\u304F",
|
|
1520
|
+
ar: "\u0627\u0641\u062A\u062D",
|
|
1521
|
+
ko: "\uC5F4\uAE30",
|
|
1522
|
+
zh: "\u6253\u5F00",
|
|
1523
|
+
tr: "a\xE7",
|
|
1524
|
+
fr: "ouvrir"
|
|
1525
|
+
},
|
|
1526
|
+
search: {
|
|
1527
|
+
en: "search",
|
|
1528
|
+
es: "buscar",
|
|
1529
|
+
ja: "\u691C\u7D22",
|
|
1530
|
+
ar: "\u0627\u0628\u062D\u062B",
|
|
1531
|
+
ko: "\uAC80\uC0C9",
|
|
1532
|
+
zh: "\u641C\u7D22",
|
|
1533
|
+
tr: "ara",
|
|
1534
|
+
fr: "chercher"
|
|
1535
|
+
},
|
|
1536
|
+
help: {
|
|
1537
|
+
en: "help",
|
|
1538
|
+
es: "ayuda",
|
|
1539
|
+
ja: "\u30D8\u30EB\u30D7",
|
|
1540
|
+
ar: "\u0645\u0633\u0627\u0639\u062F\u0629",
|
|
1541
|
+
ko: "\uB3C4\uC6C0\uB9D0",
|
|
1542
|
+
zh: "\u5E2E\u52A9",
|
|
1543
|
+
tr: "yard\u0131m",
|
|
1544
|
+
fr: "aide"
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
function buildMarkerLookup(schemas) {
|
|
1548
|
+
const lookup = {};
|
|
1549
|
+
for (const schema of schemas) {
|
|
1550
|
+
const actionMarkers = {};
|
|
1551
|
+
for (const role of schema.roles) {
|
|
1552
|
+
if (role.markerOverride) {
|
|
1553
|
+
actionMarkers[role.role] = role.markerOverride;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
lookup[schema.action] = actionMarkers;
|
|
1557
|
+
}
|
|
1558
|
+
return lookup;
|
|
1559
|
+
}
|
|
1560
|
+
var SCHEMA_MARKERS = buildMarkerLookup(allSchemas);
|
|
1561
|
+
function getMarker(action, role, lang) {
|
|
1562
|
+
return SCHEMA_MARKERS[action]?.[role]?.[lang] ?? "";
|
|
1563
|
+
}
|
|
1564
|
+
var SOV_LANGUAGES = /* @__PURE__ */ new Set(["ja", "ko", "tr"]);
|
|
1565
|
+
function kw(command, lang) {
|
|
1566
|
+
return COMMAND_KEYWORDS[command]?.[lang] ?? command;
|
|
1567
|
+
}
|
|
1568
|
+
function renderSingleRole(node, lang, roleName) {
|
|
1569
|
+
const value = (0, import_framework4.extractRoleValue)(node, roleName) || "";
|
|
1570
|
+
const keyword = kw(node.action, lang);
|
|
1571
|
+
if (!value) return keyword;
|
|
1572
|
+
if (SOV_LANGUAGES.has(lang)) {
|
|
1573
|
+
const parts = [value];
|
|
1574
|
+
const marker2 = getMarker(node.action, roleName, lang);
|
|
1575
|
+
if (marker2) parts.push(marker2);
|
|
1576
|
+
parts.push(keyword);
|
|
1577
|
+
return parts.join(" ");
|
|
1578
|
+
}
|
|
1579
|
+
const marker = getMarker(node.action, roleName, lang);
|
|
1580
|
+
if (marker) return `${keyword} ${marker} ${value}`;
|
|
1581
|
+
return `${keyword} ${value}`;
|
|
1582
|
+
}
|
|
1583
|
+
function renderNavigate(node, lang) {
|
|
1584
|
+
const dest = (0, import_framework4.extractRoleValue)(node, "destination") || "";
|
|
1585
|
+
const keyword = kw("navigate", lang);
|
|
1586
|
+
if (!dest) return keyword;
|
|
1587
|
+
const marker = getMarker("navigate", "destination", lang);
|
|
1588
|
+
if (SOV_LANGUAGES.has(lang)) {
|
|
1589
|
+
return marker ? `${dest} ${marker} ${keyword}` : `${dest} ${keyword}`;
|
|
1590
|
+
}
|
|
1591
|
+
return marker ? `${keyword} ${marker} ${dest}` : `${keyword} ${dest}`;
|
|
1592
|
+
}
|
|
1593
|
+
function renderClick(node, lang) {
|
|
1594
|
+
return renderSingleRole(node, lang, "patient");
|
|
1595
|
+
}
|
|
1596
|
+
function renderType(node, lang) {
|
|
1597
|
+
const text = (0, import_framework4.extractRoleValue)(node, "patient") || "";
|
|
1598
|
+
const dest = (0, import_framework4.extractRoleValue)(node, "destination");
|
|
1599
|
+
const keyword = kw("type", lang);
|
|
1600
|
+
if (!text) return keyword;
|
|
1601
|
+
if (SOV_LANGUAGES.has(lang)) {
|
|
1602
|
+
const parts2 = [];
|
|
1603
|
+
if (dest) {
|
|
1604
|
+
parts2.push(dest);
|
|
1605
|
+
const destMarker = getMarker("type", "destination", lang);
|
|
1606
|
+
if (destMarker) parts2.push(destMarker);
|
|
1607
|
+
}
|
|
1608
|
+
parts2.push(text);
|
|
1609
|
+
const patientMarker = getMarker("type", "patient", lang);
|
|
1610
|
+
if (patientMarker) parts2.push(patientMarker);
|
|
1611
|
+
parts2.push(keyword);
|
|
1612
|
+
return parts2.join(" ");
|
|
1613
|
+
}
|
|
1614
|
+
const parts = [keyword, text];
|
|
1615
|
+
if (dest) {
|
|
1616
|
+
const destMarker = getMarker("type", "destination", lang);
|
|
1617
|
+
if (destMarker) parts.push(destMarker);
|
|
1618
|
+
parts.push(dest);
|
|
1619
|
+
}
|
|
1620
|
+
return parts.filter(Boolean).join(" ");
|
|
1621
|
+
}
|
|
1622
|
+
function renderScroll(node, lang) {
|
|
1623
|
+
const manner = (0, import_framework4.extractRoleValue)(node, "manner") || "";
|
|
1624
|
+
const keyword = kw("scroll", lang);
|
|
1625
|
+
if (!manner) return keyword;
|
|
1626
|
+
if (SOV_LANGUAGES.has(lang)) {
|
|
1627
|
+
return `${manner} ${keyword}`;
|
|
1628
|
+
}
|
|
1629
|
+
return `${keyword} ${manner}`;
|
|
1630
|
+
}
|
|
1631
|
+
function renderRead(node, lang) {
|
|
1632
|
+
return renderSingleRole(node, lang, "patient");
|
|
1633
|
+
}
|
|
1634
|
+
function renderZoom(node, lang) {
|
|
1635
|
+
const manner = (0, import_framework4.extractRoleValue)(node, "manner") || "";
|
|
1636
|
+
const keyword = kw("zoom", lang);
|
|
1637
|
+
if (!manner) return keyword;
|
|
1638
|
+
if (SOV_LANGUAGES.has(lang)) {
|
|
1639
|
+
return `${manner} ${keyword}`;
|
|
1640
|
+
}
|
|
1641
|
+
return `${keyword} ${manner}`;
|
|
1642
|
+
}
|
|
1643
|
+
function renderSelect(node, lang) {
|
|
1644
|
+
return renderSingleRole(node, lang, "patient");
|
|
1645
|
+
}
|
|
1646
|
+
function renderBack(node, lang) {
|
|
1647
|
+
const quantity = (0, import_framework4.extractRoleValue)(node, "quantity");
|
|
1648
|
+
const keyword = kw("back", lang);
|
|
1649
|
+
if (quantity) return `${keyword} ${quantity}`;
|
|
1650
|
+
return keyword;
|
|
1651
|
+
}
|
|
1652
|
+
function renderForward(node, lang) {
|
|
1653
|
+
const quantity = (0, import_framework4.extractRoleValue)(node, "quantity");
|
|
1654
|
+
const keyword = kw("forward", lang);
|
|
1655
|
+
if (quantity) return `${keyword} ${quantity}`;
|
|
1656
|
+
return keyword;
|
|
1657
|
+
}
|
|
1658
|
+
function renderFocus(node, lang) {
|
|
1659
|
+
const patient = (0, import_framework4.extractRoleValue)(node, "patient") || "";
|
|
1660
|
+
const keyword = kw("focus", lang);
|
|
1661
|
+
if (!patient) return keyword;
|
|
1662
|
+
if (SOV_LANGUAGES.has(lang)) {
|
|
1663
|
+
const marker = getMarker("focus", "patient", lang);
|
|
1664
|
+
return marker ? `${patient} ${marker} ${keyword}` : `${patient} ${keyword}`;
|
|
1665
|
+
}
|
|
1666
|
+
return `${keyword} ${patient}`;
|
|
1667
|
+
}
|
|
1668
|
+
function renderClose(node, lang) {
|
|
1669
|
+
return renderSingleRole(node, lang, "patient");
|
|
1670
|
+
}
|
|
1671
|
+
function renderOpen(node, lang) {
|
|
1672
|
+
return renderSingleRole(node, lang, "patient");
|
|
1673
|
+
}
|
|
1674
|
+
function renderSearch(node, lang) {
|
|
1675
|
+
const query = (0, import_framework4.extractRoleValue)(node, "patient") || "";
|
|
1676
|
+
const dest = (0, import_framework4.extractRoleValue)(node, "destination");
|
|
1677
|
+
const keyword = kw("search", lang);
|
|
1678
|
+
if (!query) return keyword;
|
|
1679
|
+
if (SOV_LANGUAGES.has(lang)) {
|
|
1680
|
+
const parts2 = [];
|
|
1681
|
+
if (dest) {
|
|
1682
|
+
parts2.push(dest);
|
|
1683
|
+
const destMarker = getMarker("search", "destination", lang);
|
|
1684
|
+
if (destMarker) parts2.push(destMarker);
|
|
1685
|
+
}
|
|
1686
|
+
parts2.push(query);
|
|
1687
|
+
const patientMarker = getMarker("search", "patient", lang);
|
|
1688
|
+
if (patientMarker) parts2.push(patientMarker);
|
|
1689
|
+
parts2.push(keyword);
|
|
1690
|
+
return parts2.filter(Boolean).join(" ");
|
|
1691
|
+
}
|
|
1692
|
+
const parts = [keyword, query];
|
|
1693
|
+
if (dest) {
|
|
1694
|
+
const destMarker = getMarker("search", "destination", lang);
|
|
1695
|
+
if (destMarker) parts.push(destMarker, dest);
|
|
1696
|
+
}
|
|
1697
|
+
return parts.join(" ");
|
|
1698
|
+
}
|
|
1699
|
+
function renderHelp(node, lang) {
|
|
1700
|
+
const topic = (0, import_framework4.extractRoleValue)(node, "patient");
|
|
1701
|
+
const keyword = kw("help", lang);
|
|
1702
|
+
if (topic) return `${keyword} ${topic}`;
|
|
1703
|
+
return keyword;
|
|
1704
|
+
}
|
|
1705
|
+
function renderVoice(node, language) {
|
|
1706
|
+
switch (node.action) {
|
|
1707
|
+
case "navigate":
|
|
1708
|
+
return renderNavigate(node, language);
|
|
1709
|
+
case "click":
|
|
1710
|
+
return renderClick(node, language);
|
|
1711
|
+
case "type":
|
|
1712
|
+
return renderType(node, language);
|
|
1713
|
+
case "scroll":
|
|
1714
|
+
return renderScroll(node, language);
|
|
1715
|
+
case "read":
|
|
1716
|
+
return renderRead(node, language);
|
|
1717
|
+
case "zoom":
|
|
1718
|
+
return renderZoom(node, language);
|
|
1719
|
+
case "select":
|
|
1720
|
+
return renderSelect(node, language);
|
|
1721
|
+
case "back":
|
|
1722
|
+
return renderBack(node, language);
|
|
1723
|
+
case "forward":
|
|
1724
|
+
return renderForward(node, language);
|
|
1725
|
+
case "focus":
|
|
1726
|
+
return renderFocus(node, language);
|
|
1727
|
+
case "close":
|
|
1728
|
+
return renderClose(node, language);
|
|
1729
|
+
case "open":
|
|
1730
|
+
return renderOpen(node, language);
|
|
1731
|
+
case "search":
|
|
1732
|
+
return renderSearch(node, language);
|
|
1733
|
+
case "help":
|
|
1734
|
+
return renderHelp(node, language);
|
|
1735
|
+
default:
|
|
1736
|
+
return `-- Unknown: ${node.action}`;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
// src/types.ts
|
|
1741
|
+
var import_framework5 = require("@lokascript/framework");
|
|
1742
|
+
function toVoiceActionSpec(node, language) {
|
|
1743
|
+
return {
|
|
1744
|
+
action: node.action,
|
|
1745
|
+
target: (0, import_framework5.extractRoleValue)(node, "patient") || (0, import_framework5.extractRoleValue)(node, "destination") || void 0,
|
|
1746
|
+
value: (0, import_framework5.extractRoleValue)(node, "patient") || void 0,
|
|
1747
|
+
direction: (0, import_framework5.extractRoleValue)(node, "manner") || void 0,
|
|
1748
|
+
amount: (0, import_framework5.extractRoleValue)(node, "quantity") || void 0,
|
|
1749
|
+
metadata: { sourceLanguage: language }
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
// src/index.ts
|
|
1754
|
+
function createVoiceDSL() {
|
|
1755
|
+
return /* @__PURE__ */ (0, import_framework6.createMultilingualDSL)({
|
|
1756
|
+
name: "Voice",
|
|
1757
|
+
schemas: allSchemas,
|
|
1758
|
+
languages: [
|
|
1759
|
+
{
|
|
1760
|
+
code: "en",
|
|
1761
|
+
name: "English",
|
|
1762
|
+
nativeName: "English",
|
|
1763
|
+
tokenizer: EnglishVoiceTokenizer,
|
|
1764
|
+
patternProfile: enProfile
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
code: "es",
|
|
1768
|
+
name: "Spanish",
|
|
1769
|
+
nativeName: "Espa\xF1ol",
|
|
1770
|
+
tokenizer: SpanishVoiceTokenizer,
|
|
1771
|
+
patternProfile: esProfile
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
code: "ja",
|
|
1775
|
+
name: "Japanese",
|
|
1776
|
+
nativeName: "\u65E5\u672C\u8A9E",
|
|
1777
|
+
tokenizer: JapaneseVoiceTokenizer,
|
|
1778
|
+
patternProfile: jaProfile
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
code: "ar",
|
|
1782
|
+
name: "Arabic",
|
|
1783
|
+
nativeName: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629",
|
|
1784
|
+
tokenizer: ArabicVoiceTokenizer,
|
|
1785
|
+
patternProfile: arProfile
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
code: "ko",
|
|
1789
|
+
name: "Korean",
|
|
1790
|
+
nativeName: "\uD55C\uAD6D\uC5B4",
|
|
1791
|
+
tokenizer: KoreanVoiceTokenizer,
|
|
1792
|
+
patternProfile: koProfile
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
code: "zh",
|
|
1796
|
+
name: "Chinese",
|
|
1797
|
+
nativeName: "\u4E2D\u6587",
|
|
1798
|
+
tokenizer: ChineseVoiceTokenizer,
|
|
1799
|
+
patternProfile: zhProfile
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
code: "tr",
|
|
1803
|
+
name: "Turkish",
|
|
1804
|
+
nativeName: "T\xFCrk\xE7e",
|
|
1805
|
+
tokenizer: TurkishVoiceTokenizer,
|
|
1806
|
+
patternProfile: trProfile
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
code: "fr",
|
|
1810
|
+
name: "French",
|
|
1811
|
+
nativeName: "Fran\xE7ais",
|
|
1812
|
+
tokenizer: FrenchVoiceTokenizer,
|
|
1813
|
+
patternProfile: frProfile
|
|
1814
|
+
}
|
|
1815
|
+
],
|
|
1816
|
+
codeGenerator: voiceCodeGenerator
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
var voiceScanConfig = {
|
|
1820
|
+
attributes: ["data-voice", "_voice"],
|
|
1821
|
+
scriptTypes: ["text/voice"],
|
|
1822
|
+
defaultLanguage: "en"
|
|
1823
|
+
};
|
|
1824
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1825
|
+
0 && (module.exports = {
|
|
1826
|
+
ArabicVoiceTokenizer,
|
|
1827
|
+
ChineseVoiceTokenizer,
|
|
1828
|
+
EnglishVoiceTokenizer,
|
|
1829
|
+
FrenchVoiceTokenizer,
|
|
1830
|
+
JapaneseVoiceTokenizer,
|
|
1831
|
+
KoreanVoiceTokenizer,
|
|
1832
|
+
SpanishVoiceTokenizer,
|
|
1833
|
+
TurkishVoiceTokenizer,
|
|
1834
|
+
allProfiles,
|
|
1835
|
+
allSchemas,
|
|
1836
|
+
arProfile,
|
|
1837
|
+
backSchema,
|
|
1838
|
+
clickSchema,
|
|
1839
|
+
closeSchema,
|
|
1840
|
+
createVoiceDSL,
|
|
1841
|
+
enProfile,
|
|
1842
|
+
esProfile,
|
|
1843
|
+
focusSchema,
|
|
1844
|
+
forwardSchema,
|
|
1845
|
+
frProfile,
|
|
1846
|
+
helpSchema,
|
|
1847
|
+
jaProfile,
|
|
1848
|
+
koProfile,
|
|
1849
|
+
navigateSchema,
|
|
1850
|
+
openSchema,
|
|
1851
|
+
readSchema,
|
|
1852
|
+
renderVoice,
|
|
1853
|
+
scrollSchema,
|
|
1854
|
+
searchSchema,
|
|
1855
|
+
selectSchema,
|
|
1856
|
+
toVoiceActionSpec,
|
|
1857
|
+
trProfile,
|
|
1858
|
+
typeSchema,
|
|
1859
|
+
voiceCodeGenerator,
|
|
1860
|
+
voiceScanConfig,
|
|
1861
|
+
zhProfile,
|
|
1862
|
+
zoomSchema
|
|
1863
|
+
});
|
|
1864
|
+
//# sourceMappingURL=index.cjs.map
|