@bitcobblers/wod-wiki-lang 0.60.2257 → 0.60.2258
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/index.cjs +71 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +71 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -809,6 +809,8 @@ interface CompletionValueOption {
|
|
|
809
809
|
value: string;
|
|
810
810
|
/** Display label; defaults to `value`. */
|
|
811
811
|
label?: string;
|
|
812
|
+
/** Optional aliases (e.g. "swing", "kbs") matched alongside label and value. */
|
|
813
|
+
aliases?: readonly string[];
|
|
812
814
|
/** Short annotation shown after the label; the provider supplies a default. */
|
|
813
815
|
detail?: string;
|
|
814
816
|
/** Longer description shown in the completion info panel. */
|
package/dist/index.d.ts
CHANGED
|
@@ -809,6 +809,8 @@ interface CompletionValueOption {
|
|
|
809
809
|
value: string;
|
|
810
810
|
/** Display label; defaults to `value`. */
|
|
811
811
|
label?: string;
|
|
812
|
+
/** Optional aliases (e.g. "swing", "kbs") matched alongside label and value. */
|
|
813
|
+
aliases?: readonly string[];
|
|
812
814
|
/** Short annotation shown after the label; the provider supplies a default. */
|
|
813
815
|
detail?: string;
|
|
814
816
|
/** Longer description shown in the completion info panel. */
|
package/dist/index.mjs
CHANGED
|
@@ -3089,18 +3089,41 @@ function structureKeywords() {
|
|
|
3089
3089
|
apply: STRUCTURE_KEYWORD_DISPLAY[word] ?? word.toUpperCase()
|
|
3090
3090
|
}));
|
|
3091
3091
|
}
|
|
3092
|
+
var ACTION_CUE_COMPLETIONS = [
|
|
3093
|
+
{ label: "[:rest]", detail: "Rest cue", type: "keyword", apply: "[:rest] ", boost: 20 },
|
|
3094
|
+
{ label: "[:next]", detail: "Advance segment", type: "keyword", apply: "[:next] ", boost: 15 },
|
|
3095
|
+
{ label: "[:done]", detail: "Complete block", type: "keyword", apply: "[:done] ", boost: 12 },
|
|
3096
|
+
{ label: "[:mark]", detail: "Split / lap marker", type: "keyword", apply: "[:mark] ", boost: 10 }
|
|
3097
|
+
];
|
|
3098
|
+
var completionAliases = /* @__PURE__ */ new WeakMap();
|
|
3092
3099
|
function toCompletions(values, detail, quoteValues = false) {
|
|
3093
3100
|
return values.map((value) => {
|
|
3094
3101
|
const insertText = quoteValues ? !/^[A-Za-z][A-Za-z0-9]*$/.test(value.value) ? JSON.stringify(value.value) : value.value : value.label ?? value.value;
|
|
3095
|
-
|
|
3102
|
+
const item = {
|
|
3096
3103
|
label: value.label ?? value.value,
|
|
3097
3104
|
apply: insertText,
|
|
3098
3105
|
detail: value.detail ?? (value.label && value.label !== value.value ? value.value : detail),
|
|
3099
3106
|
type: "text",
|
|
3100
3107
|
info: value.info
|
|
3101
3108
|
};
|
|
3109
|
+
if (value.aliases?.length) {
|
|
3110
|
+
completionAliases.set(item, value.aliases.map((a) => a.toLowerCase()));
|
|
3111
|
+
}
|
|
3112
|
+
return item;
|
|
3102
3113
|
});
|
|
3103
3114
|
}
|
|
3115
|
+
function completionMatchesAliasOnly(option, typedLower) {
|
|
3116
|
+
const aliases = completionAliases.get(option);
|
|
3117
|
+
return aliases ? aliases.some((alias) => alias.includes(typedLower)) : false;
|
|
3118
|
+
}
|
|
3119
|
+
function completionMatchesWord(option, typedLower) {
|
|
3120
|
+
const inserted = (typeof option.apply === "string" ? option.apply : option.label).toLowerCase();
|
|
3121
|
+
const label = option.label.toLowerCase();
|
|
3122
|
+
if (inserted.startsWith(typedLower) || label.startsWith(typedLower)) return "prefix";
|
|
3123
|
+
if (inserted.includes(typedLower) || label.includes(typedLower)) return "word";
|
|
3124
|
+
if (completionMatchesAliasOnly(option, typedLower)) return "alias";
|
|
3125
|
+
return null;
|
|
3126
|
+
}
|
|
3104
3127
|
function dialectWords(sport) {
|
|
3105
3128
|
if (!sport) return [];
|
|
3106
3129
|
const vocabulary = SPORT_VOCABULARY[SPORT_ALIASES[sport] ?? sport];
|
|
@@ -3167,6 +3190,14 @@ function whiteboardScriptCompletionSource(options = {}) {
|
|
|
3167
3190
|
const before = line.text.slice(0, pos - line.from);
|
|
3168
3191
|
const word = /([A-Za-z0-9-]*)$/.exec(before)[1];
|
|
3169
3192
|
const beforeWord = before.slice(0, before.length - word.length);
|
|
3193
|
+
const actionMatch = /(\[:[a-zA-Z0-9-]*)$/.exec(before);
|
|
3194
|
+
if (actionMatch) {
|
|
3195
|
+
return {
|
|
3196
|
+
from: pos - actionMatch[1].length,
|
|
3197
|
+
options: ACTION_CUE_COMPLETIONS,
|
|
3198
|
+
validFor: /^\[:[a-zA-Z0-9-]*\]?$/
|
|
3199
|
+
};
|
|
3200
|
+
}
|
|
3170
3201
|
if (beforeWord.endsWith("#") && options.tags) {
|
|
3171
3202
|
return { from: pos - word.length, options: toCompletions(await options.tags(), "tag") };
|
|
3172
3203
|
}
|
|
@@ -3191,9 +3222,27 @@ function whiteboardScriptCompletionSource(options = {}) {
|
|
|
3191
3222
|
const effortOptions = [...keywords, ...efforts, ...equipmentPrefixes, ...sportWords];
|
|
3192
3223
|
if (/^[ \t]*[A-Za-z][A-Za-z0-9]*$/.test(before)) {
|
|
3193
3224
|
const supplied = suppliedPropertyKeys(context);
|
|
3225
|
+
const allStartOptions = [
|
|
3226
|
+
...COMPLETION_PROPERTY_KEYS.filter((key) => !supplied.has(key)).map((key) => ({ label: key, detail: "property", type: "property", boost: 5 })),
|
|
3227
|
+
...snippets,
|
|
3228
|
+
...keywords,
|
|
3229
|
+
...efforts,
|
|
3230
|
+
...sportWords
|
|
3231
|
+
];
|
|
3232
|
+
const typedStart = before.trimStart().toLowerCase();
|
|
3233
|
+
const hasAliasHit = typedStart.length >= 2 && effortOptions.some((opt) => completionMatchesWord(opt, typedStart) === "alias");
|
|
3234
|
+
if (hasAliasHit) {
|
|
3235
|
+
const matched = allStartOptions.filter((opt) => completionMatchesWord(opt, typedStart) !== null);
|
|
3236
|
+
return {
|
|
3237
|
+
from: pos - before.trimStart().length,
|
|
3238
|
+
options: matched,
|
|
3239
|
+
filter: false,
|
|
3240
|
+
validFor: /^[A-Za-z]*$/
|
|
3241
|
+
};
|
|
3242
|
+
}
|
|
3194
3243
|
return {
|
|
3195
3244
|
from: pos - before.trimStart().length,
|
|
3196
|
-
options:
|
|
3245
|
+
options: allStartOptions,
|
|
3197
3246
|
validFor: /^[A-Za-z]*$/
|
|
3198
3247
|
};
|
|
3199
3248
|
}
|
|
@@ -3208,9 +3257,20 @@ function whiteboardScriptCompletionSource(options = {}) {
|
|
|
3208
3257
|
(fragment) => fragment.firstChild?.name === "Action" && fragment.from < (quantity?.from ?? pos) && !context.state.doc.sliceString(fragment.from, fragment.to).includes(":")
|
|
3209
3258
|
);
|
|
3210
3259
|
if (quantity && !incompleteAction) {
|
|
3260
|
+
const wordText = completingWord ? context.state.doc.sliceString(last.from, pos).toLowerCase() : "";
|
|
3261
|
+
const hasAliasHit = wordText.length >= 2 && effortOptions.some((opt) => completionMatchesWord(opt, wordText) === "alias");
|
|
3262
|
+
const pool = [...quantity.getChild("AtSign") ? massUnitOptions : allUnitOptions, ...effortOptions];
|
|
3263
|
+
if (hasAliasHit && completingWord) {
|
|
3264
|
+
return {
|
|
3265
|
+
from: last.from,
|
|
3266
|
+
options: pool.filter((opt) => completionMatchesWord(opt, wordText) !== null),
|
|
3267
|
+
filter: false,
|
|
3268
|
+
validFor: /^[A-Za-z]*$/
|
|
3269
|
+
};
|
|
3270
|
+
}
|
|
3211
3271
|
return {
|
|
3212
3272
|
from: completingWord ? last.from : pos,
|
|
3213
|
-
options:
|
|
3273
|
+
options: pool,
|
|
3214
3274
|
validFor: /^[A-Za-z]*$/
|
|
3215
3275
|
};
|
|
3216
3276
|
}
|
|
@@ -3229,11 +3289,14 @@ function whiteboardScriptCompletionSource(options = {}) {
|
|
|
3229
3289
|
const last2 = effortRun[effortRun.length - 1];
|
|
3230
3290
|
if (!first || !last2 || last2.to < pos) return null;
|
|
3231
3291
|
const typed = context.state.doc.sliceString(first.from, pos).toLowerCase();
|
|
3232
|
-
const compatible = effortOptions.filter((option) =>
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3292
|
+
const compatible = effortOptions.filter((option) => completionMatchesWord(option, typed) !== null);
|
|
3293
|
+
const usesAlias = compatible.some((option) => completionMatchesWord(option, typed) === "alias");
|
|
3294
|
+
return {
|
|
3295
|
+
from: first.from,
|
|
3296
|
+
options: compatible,
|
|
3297
|
+
...usesAlias ? { filter: false } : {},
|
|
3298
|
+
validFor: /^[A-Za-z ]*$/
|
|
3299
|
+
};
|
|
3237
3300
|
}
|
|
3238
3301
|
return null;
|
|
3239
3302
|
};
|