@hyperfixi/core 2.10.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast-utils/index.js +109 -8
- package/dist/ast-utils/index.mjs +109 -8
- package/dist/behaviors/index.js +2 -1
- package/dist/behaviors/index.mjs +2 -1
- package/dist/chunks/{bridge-CPNAPYAo.js → bridge-qaAHXV7X.js} +2 -2
- package/dist/chunks/browser-modular-DqXN1HOD.js +2 -0
- package/dist/chunks/{index-BQkkNlzO.js → index-CbRUhmE7.js} +2 -2
- package/dist/commands/helpers/dom-mutation.d.ts +3 -2
- package/dist/commands/helpers/index.d.ts +1 -1
- package/dist/commands/index.js +74 -8
- package/dist/commands/index.mjs +74 -8
- package/dist/hyperfixi-browser-classic-i18n.js +1 -1
- package/dist/hyperfixi-browser-minimal.js +1 -1
- package/dist/hyperfixi-browser-standard.js +1 -1
- package/dist/hyperfixi-browser.js +1 -1
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx-v4.js +1 -1
- package/dist/hyperfixi-minimal.js +1 -1
- package/dist/hyperfixi-multilingual.js +1 -1
- package/dist/hyperfixi-standard.js +1 -1
- package/dist/hyperfixi.js +1 -1
- package/dist/hyperfixi.mjs +1 -1
- package/dist/index.js +224 -33
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +224 -33
- package/dist/lokascript-browser-classic-i18n.js +1 -1
- package/dist/lokascript-browser-minimal.js +1 -1
- package/dist/lokascript-browser-standard.js +1 -1
- package/dist/lokascript-browser.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/lsp-metadata.js +2 -2
- package/dist/lsp-metadata.mjs +2 -2
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.js +13 -11
- package/dist/metadata.mjs +13 -11
- package/dist/reference/index.js +7 -2
- package/dist/reference/index.mjs +7 -2
- package/dist/registry/index.js +6 -4
- package/dist/registry/index.mjs +6 -4
- package/dist/utils/element-check.d.ts +1 -0
- package/dist/version.d.ts +2 -0
- package/package.json +5 -5
- package/dist/chunks/browser-modular-B0lGdcoP.js +0 -2
package/dist/hyperfixi.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{O as ObjectPool,P as Parser,R as Runtime,d as debug,h as default,a as defaultAttributeProcessor,b as detectFeatures,e as evalHyperScript,c as evalHyperScriptAsync,f as evalHyperScriptSmart,g as getLoadedFeatures,i as hyperscript,j as isFeatureLoaded,l as loadRequiredFeatures,p as preloadDocumentFeatures,k as preloadFeatures,s as styleBatcher,t as tokenize}from"./chunks/browser-modular-
|
|
1
|
+
export{O as ObjectPool,P as Parser,R as Runtime,d as debug,h as default,a as defaultAttributeProcessor,b as detectFeatures,e as evalHyperScript,c as evalHyperScriptAsync,f as evalHyperScriptSmart,g as getLoadedFeatures,i as hyperscript,j as isFeatureLoaded,l as loadRequiredFeatures,p as preloadDocumentFeatures,k as preloadFeatures,s as styleBatcher,t as tokenize}from"./chunks/browser-modular-DqXN1HOD.js";import"./chunks/feature-sockets-CcTxD5sT.js";
|
|
2
2
|
//# sourceMappingURL=hyperfixi.mjs.map
|
package/dist/index.js
CHANGED
|
@@ -8785,6 +8785,12 @@ function isHTMLElement$2(value) {
|
|
|
8785
8785
|
typeof value.tagName === 'string' &&
|
|
8786
8786
|
'classList' in value);
|
|
8787
8787
|
}
|
|
8788
|
+
function isInsertableNode(value) {
|
|
8789
|
+
if (value === null || typeof value !== 'object')
|
|
8790
|
+
return false;
|
|
8791
|
+
const nodeType = value.nodeType;
|
|
8792
|
+
return nodeType === 1 || nodeType === 3 || nodeType === 11;
|
|
8793
|
+
}
|
|
8788
8794
|
function isNodeList(value) {
|
|
8789
8795
|
return (value !== null &&
|
|
8790
8796
|
typeof value === 'object' &&
|
|
@@ -10657,6 +10663,12 @@ function evaluateLiteral(node) {
|
|
|
10657
10663
|
}
|
|
10658
10664
|
async function evaluateIdentifier(node, context) {
|
|
10659
10665
|
const name = node.name;
|
|
10666
|
+
if (name.startsWith('$')) {
|
|
10667
|
+
notifyGlobalRead(name.slice(1), context);
|
|
10668
|
+
}
|
|
10669
|
+
else if (node.scope === 'global') {
|
|
10670
|
+
notifyGlobalRead(name, context);
|
|
10671
|
+
}
|
|
10660
10672
|
if (name === 'me' || name === 'my' || name === 'I') {
|
|
10661
10673
|
return getExpr(context, 'me').evaluate(context);
|
|
10662
10674
|
}
|
|
@@ -10676,7 +10688,6 @@ async function evaluateIdentifier(node, context) {
|
|
|
10676
10688
|
return getExpr(context, 'document').evaluate(context);
|
|
10677
10689
|
}
|
|
10678
10690
|
if (node.scope === 'global' && context.globals?.has(name)) {
|
|
10679
|
-
notifyGlobalRead(name, context);
|
|
10680
10691
|
return context.globals.get(name);
|
|
10681
10692
|
}
|
|
10682
10693
|
if (node.scope === 'element') {
|
|
@@ -10687,12 +10698,9 @@ async function evaluateIdentifier(node, context) {
|
|
|
10687
10698
|
return context.locals.get(name);
|
|
10688
10699
|
}
|
|
10689
10700
|
if (context.globals && context.globals.has(name)) {
|
|
10690
|
-
if (name.startsWith('$'))
|
|
10691
|
-
notifyGlobalRead(name.slice(1), context);
|
|
10692
10701
|
return context.globals.get(name);
|
|
10693
10702
|
}
|
|
10694
10703
|
if (name.startsWith('$') && context.globals && context.globals.has(name.slice(1))) {
|
|
10695
|
-
notifyGlobalRead(name.slice(1), context);
|
|
10696
10704
|
return context.globals.get(name.slice(1));
|
|
10697
10705
|
}
|
|
10698
10706
|
if (context[name] !== undefined) {
|
|
@@ -17822,7 +17830,7 @@ function insertContent(target, content, position) {
|
|
|
17822
17830
|
insertReplace(target, content);
|
|
17823
17831
|
return;
|
|
17824
17832
|
}
|
|
17825
|
-
if (
|
|
17833
|
+
if (isInsertableNode(content)) {
|
|
17826
17834
|
insertElement(target, content, position);
|
|
17827
17835
|
}
|
|
17828
17836
|
else {
|
|
@@ -17833,7 +17841,7 @@ function insertContentSemantic(target, content, position) {
|
|
|
17833
17841
|
insertContent(target, content, toInsertPosition(position));
|
|
17834
17842
|
}
|
|
17835
17843
|
function insertReplace(target, content) {
|
|
17836
|
-
if (
|
|
17844
|
+
if (isInsertableNode(content)) {
|
|
17837
17845
|
target.innerHTML = '';
|
|
17838
17846
|
target.appendChild(content);
|
|
17839
17847
|
}
|
|
@@ -17880,6 +17888,53 @@ function insertText(target, content, position) {
|
|
|
17880
17888
|
target.insertAdjacentText(domPosition, content);
|
|
17881
17889
|
}
|
|
17882
17890
|
}
|
|
17891
|
+
function moveOrInsert(parent, element, ref) {
|
|
17892
|
+
const p = parent;
|
|
17893
|
+
if (typeof p.moveBefore === 'function' && element.isConnected && parent.isConnected) {
|
|
17894
|
+
try {
|
|
17895
|
+
p.moveBefore(element, ref);
|
|
17896
|
+
return;
|
|
17897
|
+
}
|
|
17898
|
+
catch {
|
|
17899
|
+
}
|
|
17900
|
+
}
|
|
17901
|
+
parent.insertBefore(element, ref);
|
|
17902
|
+
}
|
|
17903
|
+
function insertElementsInOrder(target, elements, position) {
|
|
17904
|
+
switch (position) {
|
|
17905
|
+
case 'beforeend':
|
|
17906
|
+
for (const el of elements)
|
|
17907
|
+
moveOrInsert(target, el, null);
|
|
17908
|
+
break;
|
|
17909
|
+
case 'afterbegin':
|
|
17910
|
+
for (let i = elements.length - 1; i >= 0; i--) {
|
|
17911
|
+
moveOrInsert(target, elements[i], target.firstChild);
|
|
17912
|
+
}
|
|
17913
|
+
break;
|
|
17914
|
+
case 'beforebegin': {
|
|
17915
|
+
const parent = target.parentElement;
|
|
17916
|
+
if (!parent)
|
|
17917
|
+
return;
|
|
17918
|
+
for (const el of elements)
|
|
17919
|
+
moveOrInsert(parent, el, target);
|
|
17920
|
+
break;
|
|
17921
|
+
}
|
|
17922
|
+
case 'afterend': {
|
|
17923
|
+
const parent = target.parentElement;
|
|
17924
|
+
if (!parent)
|
|
17925
|
+
return;
|
|
17926
|
+
for (let i = elements.length - 1; i >= 0; i--) {
|
|
17927
|
+
moveOrInsert(parent, elements[i], target.nextSibling);
|
|
17928
|
+
}
|
|
17929
|
+
break;
|
|
17930
|
+
}
|
|
17931
|
+
case 'replace':
|
|
17932
|
+
target.innerHTML = '';
|
|
17933
|
+
for (const el of elements)
|
|
17934
|
+
moveOrInsert(target, el, null);
|
|
17935
|
+
break;
|
|
17936
|
+
}
|
|
17937
|
+
}
|
|
17883
17938
|
function removeElement(element) {
|
|
17884
17939
|
if (element.parentNode) {
|
|
17885
17940
|
element.remove();
|
|
@@ -18970,7 +19025,12 @@ let PutCommand = (() => {
|
|
|
18970
19025
|
else {
|
|
18971
19026
|
for (const t of targets) {
|
|
18972
19027
|
const content = this.parseValue(value);
|
|
18973
|
-
|
|
19028
|
+
if (Array.isArray(content)) {
|
|
19029
|
+
insertElementsInOrder(t, content, toInsertPosition(position));
|
|
19030
|
+
}
|
|
19031
|
+
else {
|
|
19032
|
+
insertContentSemantic(t, content, position);
|
|
19033
|
+
}
|
|
18974
19034
|
}
|
|
18975
19035
|
}
|
|
18976
19036
|
return targets;
|
|
@@ -19002,6 +19062,11 @@ let PutCommand = (() => {
|
|
|
19002
19062
|
parseValue(v) {
|
|
19003
19063
|
if (isHTMLElement$2(v))
|
|
19004
19064
|
return v;
|
|
19065
|
+
if (Array.isArray(v) && v.length > 0 && v.every(isHTMLElement$2)) {
|
|
19066
|
+
return v;
|
|
19067
|
+
}
|
|
19068
|
+
if (isInsertableNode(v))
|
|
19069
|
+
return v;
|
|
19005
19070
|
return v == null ? '' : String(v);
|
|
19006
19071
|
}
|
|
19007
19072
|
looksLikeCss(s) {
|
|
@@ -20223,8 +20288,9 @@ const morphAdapter = {
|
|
|
20223
20288
|
function getStartViewTransition() {
|
|
20224
20289
|
if (typeof document === 'undefined')
|
|
20225
20290
|
return undefined;
|
|
20226
|
-
|
|
20291
|
+
const fn = document
|
|
20227
20292
|
.startViewTransition;
|
|
20293
|
+
return typeof fn === 'function' ? fn.bind(document) : undefined;
|
|
20228
20294
|
}
|
|
20229
20295
|
function isViewTransitionsSupported() {
|
|
20230
20296
|
return typeof getStartViewTransition() === 'function';
|
|
@@ -27323,6 +27389,8 @@ class Runtime extends RuntimeBase {
|
|
|
27323
27389
|
}
|
|
27324
27390
|
}
|
|
27325
27391
|
|
|
27392
|
+
const VERSION$1 = '2.11.1';
|
|
27393
|
+
|
|
27326
27394
|
// src/types.ts
|
|
27327
27395
|
function createLiteral$1(value, dataType) {
|
|
27328
27396
|
return dataType ? { type: "literal", value, dataType } : { type: "literal", value };
|
|
@@ -31664,14 +31732,26 @@ var MultilingualDSLImpl = class {
|
|
|
31664
31732
|
}
|
|
31665
31733
|
translate(input, fromLanguage, toLanguage) {
|
|
31666
31734
|
if (isExplicitSyntax$1(input)) return input;
|
|
31667
|
-
|
|
31668
|
-
|
|
31669
|
-
|
|
31670
|
-
|
|
31671
|
-
|
|
31735
|
+
let node;
|
|
31736
|
+
try {
|
|
31737
|
+
node = this.parseWithConfidence(input, fromLanguage).node;
|
|
31738
|
+
} catch (parseError) {
|
|
31739
|
+
if (this.hasGrammarProfile(fromLanguage) && this.hasGrammarProfile(toLanguage)) {
|
|
31740
|
+
return this.transformer.transform(input, fromLanguage, toLanguage);
|
|
31672
31741
|
}
|
|
31742
|
+
throw parseError;
|
|
31673
31743
|
}
|
|
31674
|
-
|
|
31744
|
+
const rendered = this.registry.getSupportedLanguages().includes(toLanguage) ? this.render(node, toLanguage) : null;
|
|
31745
|
+
if (rendered != null) return rendered;
|
|
31746
|
+
if (this.hasGrammarProfile(fromLanguage) && this.hasGrammarProfile(toLanguage)) {
|
|
31747
|
+
return this.transformer.transform(input, fromLanguage, toLanguage);
|
|
31748
|
+
}
|
|
31749
|
+
throw new Error(
|
|
31750
|
+
`translate() could not render action "${node.action}" in language "${toLanguage}": no custom renderer, domain renderer, or schema pattern covers it, and no grammar profile is configured for the transformer fallback. Either add "${toLanguage}" to the DSL's languages/renderer, or set 'grammarProfile' on its LanguageConfig in createMultilingualDSL() (parse/validate/compile do not need it).`
|
|
31751
|
+
);
|
|
31752
|
+
}
|
|
31753
|
+
hasGrammarProfile(language) {
|
|
31754
|
+
return this.profileProvider.getProfile(language) != null;
|
|
31675
31755
|
}
|
|
31676
31756
|
compile(input, language) {
|
|
31677
31757
|
if (!this.codeGenerator) {
|
|
@@ -35963,7 +36043,13 @@ var init_command_schemas = __esm({
|
|
|
35963
36043
|
expectedTypes: ["selector"],
|
|
35964
36044
|
selectorKinds: ["class", "attribute"],
|
|
35965
36045
|
svoPosition: 1,
|
|
35966
|
-
sovPosition: 2
|
|
36046
|
+
sovPosition: 2,
|
|
36047
|
+
// zh: the transformer emits `\u5207\u6362 \u628a .active` (the profile's \u628a patient
|
|
36048
|
+
// marker), but natural zh writes `\u5207\u6362 .active` bare \u2014 the handcrafted
|
|
36049
|
+
// patterns' form. Optional accepts both; without it the generated
|
|
36050
|
+
// pattern REQUIRED \u628a and the slim bundles could not parse the bare
|
|
36051
|
+
// form at all. Same treatment as go's destination.
|
|
36052
|
+
markerOptional: { zh: true }
|
|
35967
36053
|
},
|
|
35968
36054
|
{
|
|
35969
36055
|
role: "destination",
|
|
@@ -36301,6 +36387,8 @@ var init_command_schemas = __esm({
|
|
|
36301
36387
|
markerOverride: {
|
|
36302
36388
|
en: "",
|
|
36303
36389
|
// No marker before destination in English: "set :x to 5"
|
|
36390
|
+
es: "",
|
|
36391
|
+
// "establecer x a 5" - no marker before variable (profile default `en` matched nothing)
|
|
36304
36392
|
ja: "\u3092",
|
|
36305
36393
|
// "x \u3092 10 \u306b \u8a2d\u5b9a" - variable gets object marker
|
|
36306
36394
|
ko: "\uB97C",
|
|
@@ -36323,9 +36411,19 @@ var init_command_schemas = __esm({
|
|
|
36323
36411
|
// generated hi set patterns carried the swapped markers and matched no
|
|
36324
36412
|
// corpus, so the whole hi set-family (set-text/inner-html/style/attribute)
|
|
36325
36413
|
// fell to the bare-event fallback (S6 set-trio).
|
|
36326
|
-
hi: "\u0915\u094B"
|
|
36414
|
+
hi: "\u0915\u094B",
|
|
36327
36415
|
// target (destination) gets \u0915\u094b
|
|
36328
|
-
|
|
36416
|
+
// zh: the transformer emits the verb-first BA form `\u8bbe\u7f6e \u628a X \u5230 V`
|
|
36417
|
+
// (\u628a before the variable), while natural zh writes `\u8bbe\u7f6e X \u4e3a V`
|
|
36418
|
+
// (unmarked). \u628a as the marker, optional below, accepts both. The
|
|
36419
|
+
// profile default \u5728 matched neither form, so the generated zh set
|
|
36420
|
+
// patterns were dead weight and the slim bundles (schema-generated
|
|
36421
|
+
// patterns only) could not parse set at all.
|
|
36422
|
+
zh: "\u628A"
|
|
36423
|
+
},
|
|
36424
|
+
// Accept the unmarked natural form alongside the transformer's \u628a form
|
|
36425
|
+
// (same treatment as go's destination).
|
|
36426
|
+
markerOptional: { zh: true }
|
|
36329
36427
|
},
|
|
36330
36428
|
{
|
|
36331
36429
|
role: "patient",
|
|
@@ -36368,8 +36466,14 @@ var init_command_schemas = __esm({
|
|
|
36368
36466
|
// "x \u0995\u09c7 10 \u09a4\u09c7 \u09b8\u09c7\u099f" - destination marker on value
|
|
36369
36467
|
qu: "man",
|
|
36370
36468
|
// "x ta 10 man churay" - destination marker on value
|
|
36371
|
-
hi: "\u092E\u0947\u0902"
|
|
36469
|
+
hi: "\u092E\u0947\u0902",
|
|
36372
36470
|
// value (patient) gets \u092e\u0947\u0902 \u2014 see the destination note above
|
|
36471
|
+
// zh: the transformer/corpus form marks the value with \u5230 (`\u8bbe\u7f6e \u628a X
|
|
36472
|
+
// \u5230 V`); natural zh uses \u4e3a (`\u8bbe\u7f6e X \u4e3a V`). \u5230 is the override,
|
|
36473
|
+
// the \u4e3a-family rides along as variants (all merged as alternatives
|
|
36474
|
+
// by schemaMarkerAlternatives). Profile default \u628a was the PATIENT
|
|
36475
|
+
// marker, which never precedes set's value in either form.
|
|
36476
|
+
zh: "\u5230"
|
|
36373
36477
|
},
|
|
36374
36478
|
// Turkish dative is allomorphic under vowel harmony: the i18n transformer
|
|
36375
36479
|
// emits `e` for quoted-string values (`"red" e`) but `-ya` for a value
|
|
@@ -36382,7 +36486,11 @@ var init_command_schemas = __esm({
|
|
|
36382
36486
|
// not parse as a bare command while `t\u0131klama da @disabled i do\u011fru ya
|
|
36383
36487
|
// ayarla` did. See STRUCTURAL_ARCS_ROADMAP.md (tr set-attribute).
|
|
36384
36488
|
markerVariants: {
|
|
36385
|
-
tr: ["e", "a", "ye", "ya"]
|
|
36489
|
+
tr: ["e", "a", "ye", "ya"],
|
|
36490
|
+
// Natural zh value markers (`\u8bbe\u7f6e X \u4e3a V`), simplified + traditional +
|
|
36491
|
+
// resultative \u2014 the handcrafted set-zh-full alternatives, kept parseable
|
|
36492
|
+
// alongside the transformer's \u5230 override above.
|
|
36493
|
+
zh: ["\u4E3A", "\u70BA", "\u6210"]
|
|
36386
36494
|
}
|
|
36387
36495
|
},
|
|
36388
36496
|
{
|
|
@@ -60027,9 +60135,10 @@ function appendOptionalTailRole(tokens, extraction, commandSchema, languageCode,
|
|
|
60027
60135
|
type: "group",
|
|
60028
60136
|
optional: true,
|
|
60029
60137
|
tokens: [
|
|
60030
|
-
...(marker ? marker.split(/\s+/) : []).map(
|
|
60031
|
-
|
|
60032
|
-
|
|
60138
|
+
...(marker ? marker.split(/\s+/) : []).map((word) => ({
|
|
60139
|
+
type: "literal",
|
|
60140
|
+
value: word
|
|
60141
|
+
})),
|
|
60033
60142
|
{
|
|
60034
60143
|
type: "role",
|
|
60035
60144
|
role,
|
|
@@ -60160,6 +60269,70 @@ function generateSOVPatientFirstEventHandlerPattern(commandSchema, profile, keyw
|
|
|
60160
60269
|
extraction
|
|
60161
60270
|
};
|
|
60162
60271
|
}
|
|
60272
|
+
function generateSOVPatientFirstSourceFrontedEventHandlerPattern(commandSchema, profile, keyword, eventMarker, config) {
|
|
60273
|
+
const sourceSpec = commandSchema.roles.find((r) => r.role === "source");
|
|
60274
|
+
if (!sourceSpec) return null;
|
|
60275
|
+
const { marker: sourceMarker, alternatives: sourceAlts } = resolveRoleMarker(sourceSpec, profile);
|
|
60276
|
+
const patientMarker = profile.roleMarkers.patient;
|
|
60277
|
+
if (!sourceMarker) return null;
|
|
60278
|
+
if (sourceMarker === eventMarker.primary || sourceMarker === patientMarker?.primary) return null;
|
|
60279
|
+
const tokens = [];
|
|
60280
|
+
tokens.push({ type: "role", role: "patient", optional: false });
|
|
60281
|
+
if (patientMarker) {
|
|
60282
|
+
tokens.push(
|
|
60283
|
+
patientMarker.alternatives ? {
|
|
60284
|
+
type: "literal",
|
|
60285
|
+
value: patientMarker.primary,
|
|
60286
|
+
alternatives: patientMarker.alternatives
|
|
60287
|
+
} : { type: "literal", value: patientMarker.primary }
|
|
60288
|
+
);
|
|
60289
|
+
}
|
|
60290
|
+
tokens.push({
|
|
60291
|
+
type: "role",
|
|
60292
|
+
role: "source",
|
|
60293
|
+
optional: false,
|
|
60294
|
+
...sourceSpec.expectedTypes ? { expectedTypes: sourceSpec.expectedTypes } : {},
|
|
60295
|
+
...sourceSpec.valueShape !== void 0 ? { valueShape: sourceSpec.valueShape } : {}
|
|
60296
|
+
});
|
|
60297
|
+
for (const word of sourceMarker.split(/\s+/)) {
|
|
60298
|
+
tokens.push(
|
|
60299
|
+
sourceAlts && sourceMarker.split(/\s+/).length === 1 ? { type: "literal", value: word, alternatives: sourceAlts } : { type: "literal", value: word }
|
|
60300
|
+
);
|
|
60301
|
+
}
|
|
60302
|
+
tokens.push({ type: "role", role: "event", optional: false });
|
|
60303
|
+
if (eventMarker.position === "after") {
|
|
60304
|
+
const markerWords = eventMarker.primary.split(/\s+/);
|
|
60305
|
+
if (markerWords.length > 1) {
|
|
60306
|
+
for (const word of markerWords) tokens.push({ type: "literal", value: word });
|
|
60307
|
+
} else {
|
|
60308
|
+
tokens.push(
|
|
60309
|
+
eventMarker.alternatives ? { type: "literal", value: eventMarker.primary, alternatives: eventMarker.alternatives } : { type: "literal", value: eventMarker.primary }
|
|
60310
|
+
);
|
|
60311
|
+
}
|
|
60312
|
+
}
|
|
60313
|
+
tokens.push(
|
|
60314
|
+
keyword.alternatives ? { type: "literal", value: keyword.primary, alternatives: keyword.alternatives } : { type: "literal", value: keyword.primary }
|
|
60315
|
+
);
|
|
60316
|
+
const extraction = {
|
|
60317
|
+
action: { value: commandSchema.action },
|
|
60318
|
+
event: { fromRole: "event" },
|
|
60319
|
+
patient: { fromRole: "patient" },
|
|
60320
|
+
source: { fromRole: "source" }
|
|
60321
|
+
};
|
|
60322
|
+
appendOptionalRecipient(tokens, extraction, commandSchema, profile.code);
|
|
60323
|
+
appendOptionalViewTransition(tokens, extraction, commandSchema, profile.code);
|
|
60324
|
+
return {
|
|
60325
|
+
id: `${commandSchema.action}-event-${profile.code}-sov-source-fronted`,
|
|
60326
|
+
language: profile.code,
|
|
60327
|
+
command: "on",
|
|
60328
|
+
priority: (config.basePriority ?? 100) + 48,
|
|
60329
|
+
template: {
|
|
60330
|
+
format: `{patient} ${patientMarker?.primary || ""} {source} ${sourceMarker} {event} ${eventMarker.primary} ${keyword.primary}`,
|
|
60331
|
+
tokens
|
|
60332
|
+
},
|
|
60333
|
+
extraction
|
|
60334
|
+
};
|
|
60335
|
+
}
|
|
60163
60336
|
function generateSOVPatientFirstWithDestEventHandlerPattern(commandSchema, profile, keyword, eventMarker, config) {
|
|
60164
60337
|
const tokens = [];
|
|
60165
60338
|
tokens.push({ type: "role", role: "patient", optional: false });
|
|
@@ -61062,6 +61235,14 @@ function generateEventHandlerPatterns(commandSchema, profile, config = defaultCo
|
|
|
61062
61235
|
config
|
|
61063
61236
|
)
|
|
61064
61237
|
);
|
|
61238
|
+
const sourceFronted = generateSOVPatientFirstSourceFrontedEventHandlerPattern(
|
|
61239
|
+
commandSchema,
|
|
61240
|
+
profile,
|
|
61241
|
+
keyword,
|
|
61242
|
+
eventMarker,
|
|
61243
|
+
config
|
|
61244
|
+
);
|
|
61245
|
+
if (sourceFronted) patterns.push(sourceFronted);
|
|
61065
61246
|
const destMarkerCheck = profile.roleMarkers.destination;
|
|
61066
61247
|
if (destMarkerCheck && destMarkerCheck.primary !== eventMarker.primary) {
|
|
61067
61248
|
patterns.push(
|
|
@@ -66117,7 +66298,10 @@ var _PatternMatcher = class _PatternMatcher {
|
|
|
66117
66298
|
}
|
|
66118
66299
|
}
|
|
66119
66300
|
if (patternToken.valueShape === "keyword" && value.type === "expression") {
|
|
66120
|
-
captured.set(
|
|
66301
|
+
captured.set(
|
|
66302
|
+
patternToken.role,
|
|
66303
|
+
createLiteral(String(value.raw ?? ""))
|
|
66304
|
+
);
|
|
66121
66305
|
} else {
|
|
66122
66306
|
captured.set(patternToken.role, value);
|
|
66123
66307
|
}
|
|
@@ -67215,7 +67399,7 @@ var _PatternMatcher = class _PatternMatcher {
|
|
|
67215
67399
|
} else if (rule.value !== void 0) {
|
|
67216
67400
|
captured.set(role, { type: "literal", value: rule.value });
|
|
67217
67401
|
} else if (rule.default) {
|
|
67218
|
-
captured.set(role, rule.default);
|
|
67402
|
+
captured.set(role, { ...rule.default, implicit: true });
|
|
67219
67403
|
}
|
|
67220
67404
|
}
|
|
67221
67405
|
}
|
|
@@ -68169,14 +68353,20 @@ var SemanticRendererImpl = class {
|
|
|
68169
68353
|
return parts.join(" ");
|
|
68170
68354
|
}
|
|
68171
68355
|
/**
|
|
68172
|
-
* Join a statement list the way a block body reads:
|
|
68173
|
-
* but a single space immediately after a loop/tell block header
|
|
68174
|
-
* follows directly).
|
|
68175
|
-
* keeps its own copy because it also handles the multi-handler
|
|
68176
|
-
* cases.
|
|
68356
|
+
* Join a statement list the way a block body reads: the target language's `then`
|
|
68357
|
+
* between siblings, but a single space immediately after a loop/tell block header
|
|
68358
|
+
* (whose body follows directly). Used by renderConditional's branches;
|
|
68359
|
+
* renderCompound keeps its own copy because it also handles the multi-handler
|
|
68360
|
+
* and bind-feature cases.
|
|
68361
|
+
*
|
|
68362
|
+
* The chain word is localized (`this.keyword(language, 'then')`) for the same
|
|
68363
|
+
* reason renderCompound localizes it: a hardcoded English `then` leaks into every
|
|
68364
|
+
* non-en block body (`\u3082\u3057 \u2026 \u524a\u9664 then \u8ffd\u52a0`), which no target-language tokenizer
|
|
68365
|
+
* recognizes as a connector.
|
|
68177
68366
|
*/
|
|
68178
68367
|
joinStatements(statements, language) {
|
|
68179
68368
|
const rendered = statements.map((s) => this.render(s, language));
|
|
68369
|
+
const thenKw = this.keyword(language, "then");
|
|
68180
68370
|
let out = rendered[0] ?? "";
|
|
68181
68371
|
for (let i = 1; i < rendered.length; i++) {
|
|
68182
68372
|
const prev = statements[i - 1];
|
|
@@ -68184,7 +68374,7 @@ var SemanticRendererImpl = class {
|
|
|
68184
68374
|
if (prev.kind === "command" && BLOCK_NEEDS_TRAILING_END.has(prev.action)) {
|
|
68185
68375
|
out += ` ${this.keyword(language, "end")}`;
|
|
68186
68376
|
}
|
|
68187
|
-
out += (afterBlockHeader ? " " :
|
|
68377
|
+
out += (afterBlockHeader ? " " : ` ${thenKw} `) + rendered[i];
|
|
68188
68378
|
}
|
|
68189
68379
|
return out;
|
|
68190
68380
|
}
|
|
@@ -68357,6 +68547,7 @@ var SemanticRendererImpl = class {
|
|
|
68357
68547
|
if (!roleToken) continue;
|
|
68358
68548
|
const roleValue = node.roles.get(roleName);
|
|
68359
68549
|
if (roleValue?.type !== "reference" || roleValue.value !== "me") continue;
|
|
68550
|
+
if (!roleValue.implicit) continue;
|
|
68360
68551
|
if (roleName === "destination") {
|
|
68361
68552
|
const patient = node.roles.get("patient");
|
|
68362
68553
|
if (patient?.type === "literal" && patient.dataType === "string") continue;
|
|
@@ -68798,7 +68989,7 @@ function fillSchemaDefaults(node) {
|
|
|
68798
68989
|
const roles = node.roles;
|
|
68799
68990
|
for (const spec of schema.roles) {
|
|
68800
68991
|
if (spec.default !== void 0 && !roles.has(spec.role)) {
|
|
68801
|
-
roles.set(spec.role, { ...spec.default });
|
|
68992
|
+
roles.set(spec.role, { ...spec.default, implicit: true });
|
|
68802
68993
|
}
|
|
68803
68994
|
}
|
|
68804
68995
|
}
|
|
@@ -69403,7 +69594,7 @@ var _SemanticParserImpl = class _SemanticParserImpl {
|
|
|
69403
69594
|
}
|
|
69404
69595
|
let eventModifiers = patternMatcher.extractEventModifiers(tokens);
|
|
69405
69596
|
const sourceValue = match.captured.get("source");
|
|
69406
|
-
if (sourceValue && match.pattern.id.
|
|
69597
|
+
if (sourceValue && match.pattern.id.endsWith("source") && !(sourceValue.type === "reference" && sourceValue.value === "me")) {
|
|
69407
69598
|
eventModifiers = { ...eventModifiers ?? {}, from: sourceValue };
|
|
69408
69599
|
}
|
|
69409
69600
|
const additionalEvents = this.extractOrConjunctionEvents(tokens, language);
|
|
@@ -80986,7 +81177,7 @@ function createRuntimeInstance(options) {
|
|
|
80986
81177
|
return new Runtime(options);
|
|
80987
81178
|
}
|
|
80988
81179
|
function getVersion() {
|
|
80989
|
-
return
|
|
81180
|
+
return VERSION$1;
|
|
80990
81181
|
}
|
|
80991
81182
|
function toCompileError(error) {
|
|
80992
81183
|
return {
|