@bitcobblers/wod-wiki-ui 0.49.2178 → 0.49.2180
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/{chunk-2XY6AZR6.mjs → chunk-DKPPJXUH.mjs} +38 -25
- package/dist/chunk-DKPPJXUH.mjs.map +1 -0
- package/dist/extensions/index.cjs +35 -22
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.mjs +1 -1
- package/dist/index.cjs +41 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-2XY6AZR6.mjs.map +0 -1
|
@@ -6468,6 +6468,34 @@ function WqlTextEditor({ value, onChange, onSubmit, onEscape, placeholder, autoF
|
|
|
6468
6468
|
const source = wodWikiWql.wqlCompletionSource({
|
|
6469
6469
|
values: async (key) => (await loadSuggestions(key === "tags" ? "tag" : key)).map((item) => ({ label: item.value, detail: item.label, type: "constant" }))
|
|
6470
6470
|
});
|
|
6471
|
+
const handlePointerOrTouchActivation = (editor2, clientX, clientY) => {
|
|
6472
|
+
let { from, to } = editor2.state.selection.main;
|
|
6473
|
+
if (clientX !== void 0 && clientY !== void 0) {
|
|
6474
|
+
const pos = editor2.posAtCoords({ x: clientX, y: clientY });
|
|
6475
|
+
if (pos === null) return false;
|
|
6476
|
+
from = to = pos;
|
|
6477
|
+
}
|
|
6478
|
+
if (from === to) {
|
|
6479
|
+
const line = editor2.state.doc.lineAt(from);
|
|
6480
|
+
const word = Array.from(line.text.matchAll(/[\w.*-]+/g)).find((m) => line.from + m.index <= from && from <= line.from + m.index + m[0].length);
|
|
6481
|
+
if (!word) return false;
|
|
6482
|
+
from = line.from + word.index;
|
|
6483
|
+
to = from + word[0].length;
|
|
6484
|
+
let node = language.syntaxTree(editor2.state).resolveInner(to, -1);
|
|
6485
|
+
while (node.parent && !["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) node = node.parent;
|
|
6486
|
+
if (!["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) return false;
|
|
6487
|
+
if (!callbacks.current.onSlotActivate) {
|
|
6488
|
+
editor2.dispatch({ selection: { anchor: from, head: to } });
|
|
6489
|
+
}
|
|
6490
|
+
}
|
|
6491
|
+
if (callbacks.current.onSlotActivate) {
|
|
6492
|
+
autocomplete.closeCompletion(editor2);
|
|
6493
|
+
activateSlot(editor2, from, (slot) => callbacks.current.onSlotActivate?.(slot));
|
|
6494
|
+
} else {
|
|
6495
|
+
autocomplete.startCompletion(editor2);
|
|
6496
|
+
}
|
|
6497
|
+
return false;
|
|
6498
|
+
};
|
|
6471
6499
|
const editor = new view.EditorView({
|
|
6472
6500
|
parent: host.current,
|
|
6473
6501
|
state: state.EditorState.create({
|
|
@@ -6506,27 +6534,12 @@ function WqlTextEditor({ value, onChange, onSubmit, onEscape, placeholder, autoF
|
|
|
6506
6534
|
// retain token selection and in-row completion.
|
|
6507
6535
|
mouseup: (event, editor2) => {
|
|
6508
6536
|
if (event.button !== 0) return false;
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
to = from + word[0].length;
|
|
6516
|
-
let node = language.syntaxTree(editor2.state).resolveInner(to, -1);
|
|
6517
|
-
while (node.parent && !["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) node = node.parent;
|
|
6518
|
-
if (!["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) return false;
|
|
6519
|
-
if (!callbacks.current.onSlotActivate) {
|
|
6520
|
-
editor2.dispatch({ selection: { anchor: from, head: to } });
|
|
6521
|
-
}
|
|
6522
|
-
}
|
|
6523
|
-
if (callbacks.current.onSlotActivate) {
|
|
6524
|
-
autocomplete.closeCompletion(editor2);
|
|
6525
|
-
activateSlot(editor2, from, (slot) => callbacks.current.onSlotActivate?.(slot));
|
|
6526
|
-
} else {
|
|
6527
|
-
autocomplete.startCompletion(editor2);
|
|
6528
|
-
}
|
|
6529
|
-
return false;
|
|
6537
|
+
return handlePointerOrTouchActivation(editor2);
|
|
6538
|
+
},
|
|
6539
|
+
touchend: (event, editor2) => {
|
|
6540
|
+
if (event.changedTouches.length !== 1) return false;
|
|
6541
|
+
const touch = event.changedTouches[0];
|
|
6542
|
+
return handlePointerOrTouchActivation(editor2, touch.clientX, touch.clientY);
|
|
6530
6543
|
},
|
|
6531
6544
|
keydown: (event, editor2) => {
|
|
6532
6545
|
if (event.isComposing || editor2.compositionStarted) return true;
|
|
@@ -6915,7 +6928,7 @@ function WqlComposer({
|
|
|
6915
6928
|
setUndo(currentRef.current.wql);
|
|
6916
6929
|
updateClause(pill, null);
|
|
6917
6930
|
} }, pill.id)),
|
|
6918
|
-
!desktop &&
|
|
6931
|
+
!desktop && active.kind !== "wql" && guided && /* @__PURE__ */ jsxRuntime.jsx("input", { ref: inputRef, type: "text", role: "combobox", "aria-label": "Search text or WQL", "aria-controls": suggesting ? listId : void 0, "aria-expanded": suggesting, "aria-activedescendant": suggesting && highlight >= 0 ? `${listId}-option-${highlight}` : void 0, value: pending, placeholder, onChange: (event) => {
|
|
6919
6932
|
const text = event.target.value;
|
|
6920
6933
|
setPending(text);
|
|
6921
6934
|
setHighlight(-1);
|