@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.
@@ -9,7 +9,7 @@ export { blockContentId } from '@bitcobblers/wod-wiki-core';
9
9
  import { invertedEffects, history, defaultKeymap, historyKeymap, indentWithTab, cursorPageUp, cursorPageDown, cursorDocStart, cursorDocEnd } from '@codemirror/commands';
10
10
  import { WQL_FIND_TARGETS, WQL_SOURCE_VALUES, WQL_RESULT_PLANES, WQL_AGGREGATORS, WQL_VIRTUAL_DIMS, WQL_TAG_KEYS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_CALC_TARGETS, WQL_DISPLAY_UNITS, WQL_INTENSITY_TIERS, parseQueryWidgetSuffix, wqlLanguage, parseFrontmatterBody, wqlCompletionSource, parseQuery, isFindQuery, isDashboardWidgetType, unknownWidgetTypeMessage, resolveWidgetType, PLANNED_WIDGET_TYPES, notebookSlugOfSourceId, isPipelineQuery, wqlGroupingDimensions, isAggregateQuery, serialize, allowedFilterTypesForTarget, CONTENT_GROUPING_DIMENSIONS, substituteTokens, unknownTokensMessage, wql, WQL_NOTE_DEFAULT_SOURCES, wqlHighlightStyle, supportsWqlFilterKey } from '@bitcobblers/wod-wiki-wql';
11
11
  export { CONTENT_GROUPING_DIMENSIONS } from '@bitcobblers/wod-wiki-wql';
12
- import { snippet, autocompletion, CompletionContext, closeBrackets, closeBracketsKeymap, completionStatus, closeCompletion, startCompletion, moveCompletionSelection, setSelectedCompletion, currentCompletions, acceptCompletion, ifNotIn, completeFromList, snippetCompletion } from '@codemirror/autocomplete';
12
+ import { snippet, autocompletion, CompletionContext, closeBrackets, closeBracketsKeymap, completionStatus, startCompletion, moveCompletionSelection, setSelectedCompletion, currentCompletions, acceptCompletion, closeCompletion, ifNotIn, completeFromList, snippetCompletion } from '@codemirror/autocomplete';
13
13
  import { createRoot } from 'react-dom/client';
14
14
  import * as React2 from 'react';
15
15
  import React2__default, { createElement, useMemo, useState, useCallback, useEffect, useId, useRef, useSyncExternalStore } from 'react';
@@ -6527,6 +6527,34 @@ function WqlTextEditor({ value, onChange, onSubmit, onEscape, placeholder: place
6527
6527
  const source = wqlCompletionSource({
6528
6528
  values: async (key) => (await loadSuggestions(key === "tags" ? "tag" : key)).map((item) => ({ label: item.value, detail: item.label, type: "constant" }))
6529
6529
  });
6530
+ const handlePointerOrTouchActivation = (editor2, clientX, clientY) => {
6531
+ let { from, to } = editor2.state.selection.main;
6532
+ if (clientX !== void 0 && clientY !== void 0) {
6533
+ const pos = editor2.posAtCoords({ x: clientX, y: clientY });
6534
+ if (pos === null) return false;
6535
+ from = to = pos;
6536
+ }
6537
+ if (from === to) {
6538
+ const line = editor2.state.doc.lineAt(from);
6539
+ const word = Array.from(line.text.matchAll(/[\w.*-]+/g)).find((m) => line.from + m.index <= from && from <= line.from + m.index + m[0].length);
6540
+ if (!word) return false;
6541
+ from = line.from + word.index;
6542
+ to = from + word[0].length;
6543
+ let node = syntaxTree(editor2.state).resolveInner(to, -1);
6544
+ while (node.parent && !["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) node = node.parent;
6545
+ if (!["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) return false;
6546
+ if (!callbacks.current.onSlotActivate) {
6547
+ editor2.dispatch({ selection: { anchor: from, head: to } });
6548
+ }
6549
+ }
6550
+ if (callbacks.current.onSlotActivate) {
6551
+ closeCompletion(editor2);
6552
+ activateSlot(editor2, from, (slot) => callbacks.current.onSlotActivate?.(slot));
6553
+ } else {
6554
+ startCompletion(editor2);
6555
+ }
6556
+ return false;
6557
+ };
6530
6558
  const editor = new EditorView({
6531
6559
  parent: host.current,
6532
6560
  state: EditorState.create({
@@ -6565,27 +6593,12 @@ function WqlTextEditor({ value, onChange, onSubmit, onEscape, placeholder: place
6565
6593
  // retain token selection and in-row completion.
6566
6594
  mouseup: (event, editor2) => {
6567
6595
  if (event.button !== 0) return false;
6568
- let { from, to } = editor2.state.selection.main;
6569
- if (from === to) {
6570
- const line = editor2.state.doc.lineAt(from);
6571
- const word = Array.from(line.text.matchAll(/[\w.*-]+/g)).find((m) => line.from + m.index <= from && from <= line.from + m.index + m[0].length);
6572
- if (!word) return false;
6573
- from = line.from + word.index;
6574
- to = from + word[0].length;
6575
- let node = syntaxTree(editor2.state).resolveInner(to, -1);
6576
- while (node.parent && !["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) node = node.parent;
6577
- if (!["Head", "Filter", "GroupBy", "Rollup"].includes(node.name)) return false;
6578
- if (!callbacks.current.onSlotActivate) {
6579
- editor2.dispatch({ selection: { anchor: from, head: to } });
6580
- }
6581
- }
6582
- if (callbacks.current.onSlotActivate) {
6583
- closeCompletion(editor2);
6584
- activateSlot(editor2, from, (slot) => callbacks.current.onSlotActivate?.(slot));
6585
- } else {
6586
- startCompletion(editor2);
6587
- }
6588
- return false;
6596
+ return handlePointerOrTouchActivation(editor2);
6597
+ },
6598
+ touchend: (event, editor2) => {
6599
+ if (event.changedTouches.length !== 1) return false;
6600
+ const touch = event.changedTouches[0];
6601
+ return handlePointerOrTouchActivation(editor2, touch.clientX, touch.clientY);
6589
6602
  },
6590
6603
  keydown: (event, editor2) => {
6591
6604
  if (event.isComposing || editor2.compositionStarted) return true;
@@ -6933,7 +6946,7 @@ function WqlComposer({
6933
6946
  "data-testid": "wql-composer-root",
6934
6947
  children: [
6935
6948
  diagnosticsPosition === "top" && showDiagnostics && /* @__PURE__ */ jsx(WqlDiagnosticsStrip, { diagnostics, stages, actions: action, variant: "header" }),
6936
- (desktop || active.kind === "wql" || !guided) && /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 w-full items-center gap-2", children: [
6949
+ (desktop || compact || active.kind === "wql" || !guided) && /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 w-full items-center gap-2", children: [
6937
6950
  /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(
6938
6951
  WqlTextEditor,
6939
6952
  {
@@ -6959,7 +6972,7 @@ function WqlComposer({
6959
6972
  setUndo(void 0);
6960
6973
  }, className: "min-h-9 shrink-0 rounded-lg px-2.5 text-xs text-muted-foreground hover:text-foreground", children: "Undo removal" })
6961
6974
  ] }),
6962
- /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 flex-wrap items-center gap-1", !desktop && !compact && "rounded-xl border border-border p-2", desktop && compact && "hidden"), "data-testid": "wql-composer", onKeyDown: (event) => {
6975
+ /* @__PURE__ */ 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) => {
6963
6976
  if (!["Delete", "Backspace"].includes(event.key) || !(event.target instanceof HTMLButtonElement)) return;
6964
6977
  const buttons = Array.from(event.currentTarget.querySelectorAll('[data-testid^="token-slot-"]:not([data-testid^="token-slot-remove-"]):not([data-testid^="token-slot-value-"])'));
6965
6978
  const pill = visiblePills[buttons.indexOf(event.target)];
@@ -13668,5 +13681,5 @@ function editorPreset(optionsOrDialect = "markdown") {
13668
13681
  }
13669
13682
 
13670
13683
  export { AGG_OPTIONS, CANONICAL_BLOCK_TYPES, CLAUSE_META, ComposerRegistry, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DEFAULT_OUTPUT_FILTERS, DEFAULT_PRIMARY_FILTER, DefaultFrontmatterWidget, EditorDialog, GROUPBY_OPTIONS, GoalRings, KIND_OPTIONS, METRIC_OPTIONS, MULTI_VALUE_TYPES, MetricBadge, OUTPUT_TYPE_CLASS, OUTPUT_TYPE_DOT, OutputFilterPills, OutputStatementsTable, PLANE_OPTIONS, ProposedMetricBadge, QueryBlockView, QueryValue, ROLLUP_OPTIONS, RowsResultsChrome, RowsTable, SERIES_COLORS, SOURCE_OPTIONS, SUGGESTION_BINDINGS, StackedBar, TARGET_OPTIONS, TIME_OPTIONS, TONE_CLASS, TokenSlotPill, TopList, UNIT_OPTIONS, WHERE_AGGREGATORS, WHERE_METRICS, WidgetChart, WidgetProblemBadge, WqlBars, WqlComposer, WqlDiagnosticsStrip, WqlEmptyState, WqlQueryInspectorModal, WqlTable, WqlTimeseries, ZoneDistribution, activeCursorSection, addRuntimePanel, autocompleteTooltipTheme, blockTypesFromBlocks, canonicalSuggestionItems, cn, compactNumber, composerRegistry, configureOverlayActions, cursorFocusExtension, customCompletionSources, dateRangeSlot, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editQueryClause, editingWidgetsField, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, extractMetricsByCategory, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatClockTime, formatMMSS, formatTimestamp, frontmatterDetailed, frontmatterPreview, frontmatterPreviewField, frontmatterReferenceIndex, frontmatterSource, frontmatterSuggestions, frontmatterVisibility, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, hashCode, inlineButtonDecoration, invalidateSuggestions, lineIdsExtension, linkOpen, linkPreview, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, matchFilterTypeahead, mergeSeries, mergeSuggestionItems, mergeTagSuggestions, navigationFacet, nestedCompletion, nestedCompletionOptions, normalizeOutputFilter, notebookSlugsFromBlocks, patchBlockQuery, presentBadges, previewDecorations, queryBlockPreview, readSessionRpe, referenceIndexReload, registeredSectionWidgets, removeRuntimePanel, resolveCodeLanguage, resolveQueryDraft, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sectionIdentity, sectionIdentityHistory, sectionMove, sectionRestore, sectionSaved, sessionQueryInsert, sessionQueryWql, setFrontmatterDetailed, setFrontmatterSource, setGutterHighlights, setSuggestionBinding, smartIncrement, summarizeAggregate, summarizeFind, summarizePipeline, tagsFromStaticBlocks, toChartResult, toggleWidgetEdit, tooltipTimestamp, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useVisualViewportRect, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodCompletionSource, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToPills, wrapInTimeFence };
13671
- //# sourceMappingURL=chunk-CD7P6Q4Z.mjs.map
13672
- //# sourceMappingURL=chunk-CD7P6Q4Z.mjs.map
13684
+ //# sourceMappingURL=chunk-DKPPJXUH.mjs.map
13685
+ //# sourceMappingURL=chunk-DKPPJXUH.mjs.map