@bitcobblers/wod-wiki-ui 0.56.2210 → 0.57.2213
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-VYFKXF46.mjs → chunk-W23ZR6NQ.mjs} +49 -15
- package/dist/chunk-W23ZR6NQ.mjs.map +1 -0
- package/dist/extensions/index.cjs +49 -12
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.mjs +1 -1
- package/dist/{index-CfljPEK3.d.cts → index-DUNwBTpa.d.cts} +22 -1
- package/dist/{index-CfljPEK3.d.ts → index-DUNwBTpa.d.ts} +22 -1
- package/dist/index.cjs +55 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-VYFKXF46.mjs.map +0 -1
|
@@ -331,6 +331,33 @@ var lineIdsExtension = ViewPlugin.fromClass(
|
|
|
331
331
|
decorations: (v) => v.decorations
|
|
332
332
|
}
|
|
333
333
|
);
|
|
334
|
+
var affiliateTagFacet = Facet.define({
|
|
335
|
+
combine(values2) {
|
|
336
|
+
for (let i = values2.length - 1; i >= 0; i--) {
|
|
337
|
+
const trimmed = values2[i]?.trim();
|
|
338
|
+
if (trimmed) return trimmed;
|
|
339
|
+
}
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
var AMAZON_RETAIL_HOST_RE = /^(?:www\.|smile\.|m\.)?amazon\.[a-z]{2,3}(?:\.[a-z]{2})?$/i;
|
|
344
|
+
function isAmazonRetailHost(hostname) {
|
|
345
|
+
return AMAZON_RETAIL_HOST_RE.test(hostname);
|
|
346
|
+
}
|
|
347
|
+
function applyAmazonAffiliateTag(url, associateTag) {
|
|
348
|
+
const tag = associateTag?.trim();
|
|
349
|
+
if (!tag || !/^https?:\/\//i.test(url)) return url;
|
|
350
|
+
try {
|
|
351
|
+
const parsed = new URL(url);
|
|
352
|
+
if (!isAmazonRetailHost(parsed.hostname)) return url;
|
|
353
|
+
parsed.searchParams.set("tag", tag);
|
|
354
|
+
return parsed.toString();
|
|
355
|
+
} catch {
|
|
356
|
+
return url;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// src/extensions/link-open.ts
|
|
334
361
|
var navigationFacet = Facet.define({
|
|
335
362
|
combine(values2) {
|
|
336
363
|
return values2.length > 0 ? values2[values2.length - 1] : null;
|
|
@@ -421,12 +448,13 @@ var ctrlClickPlugin = ViewPlugin.fromClass(
|
|
|
421
448
|
if (!url) return;
|
|
422
449
|
e.preventDefault();
|
|
423
450
|
e.stopPropagation();
|
|
451
|
+
const resolvedUrl = applyAmazonAffiliateTag(url, view.state.facet(affiliateTagFacet));
|
|
424
452
|
const navHook = view.state.facet(navigationFacet);
|
|
425
453
|
if (navHook) {
|
|
426
|
-
navHook(
|
|
454
|
+
navHook(resolvedUrl, view);
|
|
427
455
|
} else if (typeof window !== "undefined") {
|
|
428
|
-
const isInternal =
|
|
429
|
-
window.open(
|
|
456
|
+
const isInternal = resolvedUrl.startsWith("/") || resolvedUrl.startsWith("#");
|
|
457
|
+
window.open(resolvedUrl, isInternal ? "_self" : "_blank", isInternal ? void 0 : "noopener,noreferrer");
|
|
430
458
|
}
|
|
431
459
|
};
|
|
432
460
|
view.dom.addEventListener("mousedown", this.handler, true);
|
|
@@ -4046,11 +4074,12 @@ function appendFormattedCellContent(container, rawText, view) {
|
|
|
4046
4074
|
} else if (match[2] !== void 0 && match[3] !== void 0) {
|
|
4047
4075
|
const label = match[2];
|
|
4048
4076
|
const url = match[3];
|
|
4077
|
+
const isExternal = /^https?:\/\//i.test(url);
|
|
4078
|
+
const resolvedUrl = isExternal ? applyAmazonAffiliateTag(url, view.state.facet(affiliateTagFacet)) : url;
|
|
4049
4079
|
const a = document.createElement("a");
|
|
4050
|
-
a.href =
|
|
4080
|
+
a.href = resolvedUrl;
|
|
4051
4081
|
a.textContent = label;
|
|
4052
4082
|
a.className = "cm-table-cell-link underline underline-offset-2";
|
|
4053
|
-
const isExternal = /^https?:\/\//i.test(url);
|
|
4054
4083
|
if (isExternal) {
|
|
4055
4084
|
a.target = "_blank";
|
|
4056
4085
|
a.rel = "noopener noreferrer";
|
|
@@ -4508,7 +4537,8 @@ function openLinkEditPopover(anchorEl, view, match) {
|
|
|
4508
4537
|
openBtn.addEventListener("click", (e) => {
|
|
4509
4538
|
e.preventDefault();
|
|
4510
4539
|
e.stopPropagation();
|
|
4511
|
-
const
|
|
4540
|
+
const rawUrl = urlInput.value.trim() || match.url;
|
|
4541
|
+
const targetUrl = applyAmazonAffiliateTag(rawUrl, view.state.facet(affiliateTagFacet));
|
|
4512
4542
|
closeActiveLinkPopover();
|
|
4513
4543
|
const navHook = view.state.facet(navigationFacet);
|
|
4514
4544
|
if (!isExternalHttpUrl(targetUrl) && navHook) {
|
|
@@ -4595,21 +4625,23 @@ function openLinkEditPopover(anchorEl, view, match) {
|
|
|
4595
4625
|
labelInput.select();
|
|
4596
4626
|
}
|
|
4597
4627
|
var LinkPillWidget = class extends WidgetType {
|
|
4598
|
-
constructor(label, url, from, to, readOnly) {
|
|
4628
|
+
constructor(label, url, from, to, readOnly, affiliateTag) {
|
|
4599
4629
|
super();
|
|
4600
4630
|
this.label = label;
|
|
4601
4631
|
this.url = url;
|
|
4602
4632
|
this.from = from;
|
|
4603
4633
|
this.to = to;
|
|
4604
4634
|
this.readOnly = readOnly;
|
|
4635
|
+
this.affiliateTag = affiliateTag;
|
|
4605
4636
|
}
|
|
4606
4637
|
label;
|
|
4607
4638
|
url;
|
|
4608
4639
|
from;
|
|
4609
4640
|
to;
|
|
4610
4641
|
readOnly;
|
|
4642
|
+
affiliateTag;
|
|
4611
4643
|
eq(other) {
|
|
4612
|
-
return this.label === other.label && this.url === other.url && this.from === other.from && this.to === other.to && this.readOnly === other.readOnly;
|
|
4644
|
+
return this.label === other.label && this.url === other.url && this.from === other.from && this.to === other.to && this.readOnly === other.readOnly && this.affiliateTag === other.affiliateTag;
|
|
4613
4645
|
}
|
|
4614
4646
|
toDOM(view) {
|
|
4615
4647
|
const isExternal = isExternalHttpUrl(this.url);
|
|
@@ -4636,9 +4668,10 @@ var LinkPillWidget = class extends WidgetType {
|
|
|
4636
4668
|
});
|
|
4637
4669
|
}
|
|
4638
4670
|
pill.appendChild(label);
|
|
4671
|
+
const resolvedUrl = isExternal ? applyAmazonAffiliateTag(this.url, this.affiliateTag) : this.url;
|
|
4639
4672
|
const open = document.createElement("a");
|
|
4640
4673
|
open.className = "cm-link-pill-open";
|
|
4641
|
-
open.href =
|
|
4674
|
+
open.href = resolvedUrl;
|
|
4642
4675
|
if (isExternal) {
|
|
4643
4676
|
open.target = "_blank";
|
|
4644
4677
|
open.rel = "noopener noreferrer";
|
|
@@ -4650,11 +4683,11 @@ var LinkPillWidget = class extends WidgetType {
|
|
|
4650
4683
|
if (navHook) {
|
|
4651
4684
|
e.preventDefault();
|
|
4652
4685
|
e.stopPropagation();
|
|
4653
|
-
navHook(
|
|
4686
|
+
navHook(resolvedUrl, view);
|
|
4654
4687
|
}
|
|
4655
4688
|
});
|
|
4656
4689
|
}
|
|
4657
|
-
open.title =
|
|
4690
|
+
open.title = resolvedUrl;
|
|
4658
4691
|
open.appendChild(createLinkArrowIcon(isExternal));
|
|
4659
4692
|
pill.appendChild(open);
|
|
4660
4693
|
return pill;
|
|
@@ -4788,7 +4821,8 @@ function buildLinkDecos(state) {
|
|
|
4788
4821
|
link.url,
|
|
4789
4822
|
link.from,
|
|
4790
4823
|
link.to,
|
|
4791
|
-
state.readOnly
|
|
4824
|
+
state.readOnly,
|
|
4825
|
+
state.facet(affiliateTagFacet)
|
|
4792
4826
|
)
|
|
4793
4827
|
})
|
|
4794
4828
|
);
|
|
@@ -17624,6 +17658,6 @@ function editorPreset(optionsOrDialect = "markdown") {
|
|
|
17624
17658
|
return extensions;
|
|
17625
17659
|
}
|
|
17626
17660
|
|
|
17627
|
-
export { AGG_OPTIONS, CANONICAL_BLOCK_TYPES, CLAUSE_META, ComposerRegistry, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DEFAULT_OUTPUT_FILTERS, DEFAULT_PRIMARY_FILTER, DefaultFrontmatterWidget, EditorDialog, GROUPBY_OPTIONS, GoalRings, INTERNAL_FRONTMATTER_KEYS, KIND_OPTIONS, METRIC_OPTIONS, MULTI_VALUE_TYPES, MetricBadge, OUTPUT_TYPE_CLASS, OUTPUT_TYPE_DOT, OutputFilterPills, OutputStatementsTable, PLANE_OPTIONS, PRBadge, ProposedMetricBadge, QueryBlockView, QueryObjectBuilder, 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, attachmentUrlFacet, autocompleteTooltipTheme, bindTokenParamIntoWql, bindTokenToQueryObject, blockTypesFromBlocks, canonicalSuggestionItems, cn, compactNumber, composerRegistry, computeSessionPrHighlights, configureOverlayActions, createExecutorDocumentHost, cursorFocusExtension, customCompletionSources, cycleBaselineLayer, dateRangeSlot, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editQueryClause, editingQuerySectionsField, editingWidgetsField, editorFocusField, editorFocusTracker, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, extractMetricsByCategory, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatClockTime, formatMMSS, formatTimeseriesTick, formatTimeseriesTooltipValue, formatTimestamp, frontmatterDebugMode, frontmatterDetailed, frontmatterKeymap, frontmatterPreview, frontmatterPreviewField, frontmatterReferenceIndex, frontmatterSource, frontmatterSuggestions, frontmatterVisibility, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, handleSmartUrlPaste, hashCode, inlineButtonDecoration, insertMarkdownLinkCommand, invalidateSuggestions, isEditorFocused, isInternalFrontmatterKey, isNavigableUrl, lineIdsExtension, linkOpen, linkPreview, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, matchFilterTypeahead, mergeSeries, mergeSuggestionItems, mergeTagSuggestions, navigationFacet, nestedCompletion, nestedCompletionOptions, normalizeOutputFilter, normalizeSimplePipelineToAggregate, notebookSlugsFromBlocks, outputToRunResult, outputsToRunResult, patchBlockQuery, presentBadges, previewDecorations, primaryQueryOf, promoteFindToChartObject, queryBlockPreview, readSessionRpe, referenceIndexReload, registeredSectionWidgets, removeRuntimePanel, removeSeriesLayer, resolveCodeLanguage, resolveQueryDraft, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sectionIdentity, sectionIdentityHistory, sectionMove, sectionRestore, sectionSaved, sessionQueryFence, sessionQueryInsert, sessionQueryWql, setEditorFocused, setFrontmatterDetailed, setFrontmatterSource, setGutterHighlights, setPrimaryQueryOnObject, setQuerySourceEditing, setSuggestionBinding, slashBlockCompletion, smartIncrement, summarizeAggregate, summarizeFind, summarizePipeline, tagsFromStaticBlocks, toChartResult, toggleCompareLayer, toggleGoalLayer, toggleInlineMarkdown, toggleWidgetEdit, tooltipTimestamp, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useVisualViewportRect, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodCompletionSource, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToPills, wrapInTimeFence };
|
|
17628
|
-
//# sourceMappingURL=chunk-
|
|
17629
|
-
//# sourceMappingURL=chunk-
|
|
17661
|
+
export { AGG_OPTIONS, CANONICAL_BLOCK_TYPES, CLAUSE_META, ComposerRegistry, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DEFAULT_OUTPUT_FILTERS, DEFAULT_PRIMARY_FILTER, DefaultFrontmatterWidget, EditorDialog, GROUPBY_OPTIONS, GoalRings, INTERNAL_FRONTMATTER_KEYS, KIND_OPTIONS, METRIC_OPTIONS, MULTI_VALUE_TYPES, MetricBadge, OUTPUT_TYPE_CLASS, OUTPUT_TYPE_DOT, OutputFilterPills, OutputStatementsTable, PLANE_OPTIONS, PRBadge, ProposedMetricBadge, QueryBlockView, QueryObjectBuilder, 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, affiliateTagFacet, applyAmazonAffiliateTag, attachmentUrlFacet, autocompleteTooltipTheme, bindTokenParamIntoWql, bindTokenToQueryObject, blockTypesFromBlocks, canonicalSuggestionItems, cn, compactNumber, composerRegistry, computeSessionPrHighlights, configureOverlayActions, createExecutorDocumentHost, cursorFocusExtension, customCompletionSources, cycleBaselineLayer, dateRangeSlot, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editQueryClause, editingQuerySectionsField, editingWidgetsField, editorFocusField, editorFocusTracker, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, extractMetricsByCategory, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatClockTime, formatMMSS, formatTimeseriesTick, formatTimeseriesTooltipValue, formatTimestamp, frontmatterDebugMode, frontmatterDetailed, frontmatterKeymap, frontmatterPreview, frontmatterPreviewField, frontmatterReferenceIndex, frontmatterSource, frontmatterSuggestions, frontmatterVisibility, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, handleSmartUrlPaste, hashCode, inlineButtonDecoration, insertMarkdownLinkCommand, invalidateSuggestions, isAmazonRetailHost, isEditorFocused, isInternalFrontmatterKey, isNavigableUrl, lineIdsExtension, linkOpen, linkPreview, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, matchFilterTypeahead, mergeSeries, mergeSuggestionItems, mergeTagSuggestions, navigationFacet, nestedCompletion, nestedCompletionOptions, normalizeOutputFilter, normalizeSimplePipelineToAggregate, notebookSlugsFromBlocks, outputToRunResult, outputsToRunResult, patchBlockQuery, presentBadges, previewDecorations, primaryQueryOf, promoteFindToChartObject, queryBlockPreview, readSessionRpe, referenceIndexReload, registeredSectionWidgets, removeRuntimePanel, removeSeriesLayer, resolveCodeLanguage, resolveQueryDraft, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sectionIdentity, sectionIdentityHistory, sectionMove, sectionRestore, sectionSaved, sessionQueryFence, sessionQueryInsert, sessionQueryWql, setEditorFocused, setFrontmatterDetailed, setFrontmatterSource, setGutterHighlights, setPrimaryQueryOnObject, setQuerySourceEditing, setSuggestionBinding, slashBlockCompletion, smartIncrement, summarizeAggregate, summarizeFind, summarizePipeline, tagsFromStaticBlocks, toChartResult, toggleCompareLayer, toggleGoalLayer, toggleInlineMarkdown, toggleWidgetEdit, tooltipTimestamp, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useVisualViewportRect, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodCompletionSource, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToPills, wrapInTimeFence };
|
|
17662
|
+
//# sourceMappingURL=chunk-W23ZR6NQ.mjs.map
|
|
17663
|
+
//# sourceMappingURL=chunk-W23ZR6NQ.mjs.map
|