@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.
@@ -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;
@@ -6974,7 +6987,7 @@ function WqlComposer({
6974
6987
  setUndo(currentRef.current.wql);
6975
6988
  updateClause(pill, null);
6976
6989
  } }, pill.id)),
6977
- !desktop && !compact && active.kind !== "wql" && guided && /* @__PURE__ */ 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) => {
6990
+ !desktop && active.kind !== "wql" && guided && /* @__PURE__ */ 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) => {
6978
6991
  const text = event.target.value;
6979
6992
  setPending(text);
6980
6993
  setHighlight(-1);
@@ -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-2XY6AZR6.mjs.map
13672
- //# sourceMappingURL=chunk-2XY6AZR6.mjs.map
13684
+ //# sourceMappingURL=chunk-DKPPJXUH.mjs.map
13685
+ //# sourceMappingURL=chunk-DKPPJXUH.mjs.map