@bitcobblers/wod-wiki-ui 0.49.2179 → 0.49.2181
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-CD7P6Q4Z.mjs → chunk-DKPPJXUH.mjs} +39 -26
- package/dist/chunk-DKPPJXUH.mjs.map +1 -0
- package/dist/extensions/index.cjs +36 -23
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.mjs +1 -1
- package/dist/index.cjs +42 -29
- 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-CD7P6Q4Z.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;
|
|
@@ -6874,7 +6887,7 @@ function WqlComposer({
|
|
|
6874
6887
|
"data-testid": "wql-composer-root",
|
|
6875
6888
|
children: [
|
|
6876
6889
|
diagnosticsPosition === "top" && showDiagnostics && /* @__PURE__ */ jsxRuntime.jsx(WqlDiagnosticsStrip, { diagnostics, stages, actions: action, variant: "header" }),
|
|
6877
|
-
(desktop || active.kind === "wql" || !guided) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 w-full items-center gap-2", children: [
|
|
6890
|
+
(desktop || compact || active.kind === "wql" || !guided) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 w-full items-center gap-2", children: [
|
|
6878
6891
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6879
6892
|
WqlTextEditor,
|
|
6880
6893
|
{
|
|
@@ -6900,7 +6913,7 @@ function WqlComposer({
|
|
|
6900
6913
|
setUndo(void 0);
|
|
6901
6914
|
}, className: "min-h-9 shrink-0 rounded-lg px-2.5 text-xs text-muted-foreground hover:text-foreground", children: "Undo removal" })
|
|
6902
6915
|
] }),
|
|
6903
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex min-w-0 flex-wrap items-center gap-1", !desktop && !compact && "rounded-xl border border-border p-2",
|
|
6916
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex min-w-0 flex-wrap items-center gap-1", !desktop && !compact && "rounded-xl border border-border p-2", compact && "hidden"), "data-testid": "wql-composer", onKeyDown: (event) => {
|
|
6904
6917
|
if (!["Delete", "Backspace"].includes(event.key) || !(event.target instanceof HTMLButtonElement)) return;
|
|
6905
6918
|
const buttons = Array.from(event.currentTarget.querySelectorAll('[data-testid^="token-slot-"]:not([data-testid^="token-slot-remove-"]):not([data-testid^="token-slot-value-"])'));
|
|
6906
6919
|
const pill = visiblePills[buttons.indexOf(event.target)];
|