@bitcobblers/wod-wiki-ui 0.56.2208 → 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-3NJIIKMT.mjs → chunk-W23ZR6NQ.mjs} +53 -22
- package/dist/chunk-W23ZR6NQ.mjs.map +1 -0
- package/dist/extensions/index.cjs +53 -19
- 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 +59 -25
- 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-3NJIIKMT.mjs.map +0 -1
|
@@ -330,7 +330,7 @@ var lineIdsExtension = view.ViewPlugin.fromClass(
|
|
|
330
330
|
if (!label) label = timestamp;
|
|
331
331
|
}
|
|
332
332
|
id = label.toLowerCase().replace(/[^\w]+/g, "-");
|
|
333
|
-
} else if (/^```(time|log)
|
|
333
|
+
} else if (/^```(time|wod|whiteboard|log)/i.test(trimmed)) {
|
|
334
334
|
id = `workout-line-${i}`;
|
|
335
335
|
}
|
|
336
336
|
if (id && line.from >= view$1.viewport.from && line.to <= view$1.viewport.to) {
|
|
@@ -350,6 +350,33 @@ var lineIdsExtension = view.ViewPlugin.fromClass(
|
|
|
350
350
|
decorations: (v) => v.decorations
|
|
351
351
|
}
|
|
352
352
|
);
|
|
353
|
+
var affiliateTagFacet = state.Facet.define({
|
|
354
|
+
combine(values2) {
|
|
355
|
+
for (let i = values2.length - 1; i >= 0; i--) {
|
|
356
|
+
const trimmed = values2[i]?.trim();
|
|
357
|
+
if (trimmed) return trimmed;
|
|
358
|
+
}
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
var AMAZON_RETAIL_HOST_RE = /^(?:www\.|smile\.|m\.)?amazon\.[a-z]{2,3}(?:\.[a-z]{2})?$/i;
|
|
363
|
+
function isAmazonRetailHost(hostname) {
|
|
364
|
+
return AMAZON_RETAIL_HOST_RE.test(hostname);
|
|
365
|
+
}
|
|
366
|
+
function applyAmazonAffiliateTag(url, associateTag) {
|
|
367
|
+
const tag = associateTag?.trim();
|
|
368
|
+
if (!tag || !/^https?:\/\//i.test(url)) return url;
|
|
369
|
+
try {
|
|
370
|
+
const parsed = new URL(url);
|
|
371
|
+
if (!isAmazonRetailHost(parsed.hostname)) return url;
|
|
372
|
+
parsed.searchParams.set("tag", tag);
|
|
373
|
+
return parsed.toString();
|
|
374
|
+
} catch {
|
|
375
|
+
return url;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/extensions/link-open.ts
|
|
353
380
|
var navigationFacet = state.Facet.define({
|
|
354
381
|
combine(values2) {
|
|
355
382
|
return values2.length > 0 ? values2[values2.length - 1] : null;
|
|
@@ -440,12 +467,13 @@ var ctrlClickPlugin = view.ViewPlugin.fromClass(
|
|
|
440
467
|
if (!url) return;
|
|
441
468
|
e.preventDefault();
|
|
442
469
|
e.stopPropagation();
|
|
470
|
+
const resolvedUrl = applyAmazonAffiliateTag(url, view.state.facet(affiliateTagFacet));
|
|
443
471
|
const navHook = view.state.facet(navigationFacet);
|
|
444
472
|
if (navHook) {
|
|
445
|
-
navHook(
|
|
473
|
+
navHook(resolvedUrl, view);
|
|
446
474
|
} else if (typeof window !== "undefined") {
|
|
447
|
-
const isInternal =
|
|
448
|
-
window.open(
|
|
475
|
+
const isInternal = resolvedUrl.startsWith("/") || resolvedUrl.startsWith("#");
|
|
476
|
+
window.open(resolvedUrl, isInternal ? "_self" : "_blank", isInternal ? void 0 : "noopener,noreferrer");
|
|
449
477
|
}
|
|
450
478
|
};
|
|
451
479
|
view.dom.addEventListener("mousedown", this.handler, true);
|
|
@@ -4065,11 +4093,12 @@ function appendFormattedCellContent(container, rawText, view) {
|
|
|
4065
4093
|
} else if (match[2] !== void 0 && match[3] !== void 0) {
|
|
4066
4094
|
const label = match[2];
|
|
4067
4095
|
const url = match[3];
|
|
4096
|
+
const isExternal = /^https?:\/\//i.test(url);
|
|
4097
|
+
const resolvedUrl = isExternal ? applyAmazonAffiliateTag(url, view.state.facet(affiliateTagFacet)) : url;
|
|
4068
4098
|
const a = document.createElement("a");
|
|
4069
|
-
a.href =
|
|
4099
|
+
a.href = resolvedUrl;
|
|
4070
4100
|
a.textContent = label;
|
|
4071
4101
|
a.className = "cm-table-cell-link underline underline-offset-2";
|
|
4072
|
-
const isExternal = /^https?:\/\//i.test(url);
|
|
4073
4102
|
if (isExternal) {
|
|
4074
4103
|
a.target = "_blank";
|
|
4075
4104
|
a.rel = "noopener noreferrer";
|
|
@@ -4527,7 +4556,8 @@ function openLinkEditPopover(anchorEl, view, match) {
|
|
|
4527
4556
|
openBtn.addEventListener("click", (e) => {
|
|
4528
4557
|
e.preventDefault();
|
|
4529
4558
|
e.stopPropagation();
|
|
4530
|
-
const
|
|
4559
|
+
const rawUrl = urlInput.value.trim() || match.url;
|
|
4560
|
+
const targetUrl = applyAmazonAffiliateTag(rawUrl, view.state.facet(affiliateTagFacet));
|
|
4531
4561
|
closeActiveLinkPopover();
|
|
4532
4562
|
const navHook = view.state.facet(navigationFacet);
|
|
4533
4563
|
if (!isExternalHttpUrl(targetUrl) && navHook) {
|
|
@@ -4614,21 +4644,23 @@ function openLinkEditPopover(anchorEl, view, match) {
|
|
|
4614
4644
|
labelInput.select();
|
|
4615
4645
|
}
|
|
4616
4646
|
var LinkPillWidget = class extends view.WidgetType {
|
|
4617
|
-
constructor(label, url, from, to, readOnly) {
|
|
4647
|
+
constructor(label, url, from, to, readOnly, affiliateTag) {
|
|
4618
4648
|
super();
|
|
4619
4649
|
this.label = label;
|
|
4620
4650
|
this.url = url;
|
|
4621
4651
|
this.from = from;
|
|
4622
4652
|
this.to = to;
|
|
4623
4653
|
this.readOnly = readOnly;
|
|
4654
|
+
this.affiliateTag = affiliateTag;
|
|
4624
4655
|
}
|
|
4625
4656
|
label;
|
|
4626
4657
|
url;
|
|
4627
4658
|
from;
|
|
4628
4659
|
to;
|
|
4629
4660
|
readOnly;
|
|
4661
|
+
affiliateTag;
|
|
4630
4662
|
eq(other) {
|
|
4631
|
-
return this.label === other.label && this.url === other.url && this.from === other.from && this.to === other.to && this.readOnly === other.readOnly;
|
|
4663
|
+
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;
|
|
4632
4664
|
}
|
|
4633
4665
|
toDOM(view) {
|
|
4634
4666
|
const isExternal = isExternalHttpUrl(this.url);
|
|
@@ -4655,9 +4687,10 @@ var LinkPillWidget = class extends view.WidgetType {
|
|
|
4655
4687
|
});
|
|
4656
4688
|
}
|
|
4657
4689
|
pill.appendChild(label);
|
|
4690
|
+
const resolvedUrl = isExternal ? applyAmazonAffiliateTag(this.url, this.affiliateTag) : this.url;
|
|
4658
4691
|
const open = document.createElement("a");
|
|
4659
4692
|
open.className = "cm-link-pill-open";
|
|
4660
|
-
open.href =
|
|
4693
|
+
open.href = resolvedUrl;
|
|
4661
4694
|
if (isExternal) {
|
|
4662
4695
|
open.target = "_blank";
|
|
4663
4696
|
open.rel = "noopener noreferrer";
|
|
@@ -4669,11 +4702,11 @@ var LinkPillWidget = class extends view.WidgetType {
|
|
|
4669
4702
|
if (navHook) {
|
|
4670
4703
|
e.preventDefault();
|
|
4671
4704
|
e.stopPropagation();
|
|
4672
|
-
navHook(
|
|
4705
|
+
navHook(resolvedUrl, view);
|
|
4673
4706
|
}
|
|
4674
4707
|
});
|
|
4675
4708
|
}
|
|
4676
|
-
open.title =
|
|
4709
|
+
open.title = resolvedUrl;
|
|
4677
4710
|
open.appendChild(createLinkArrowIcon(isExternal));
|
|
4678
4711
|
pill.appendChild(open);
|
|
4679
4712
|
return pill;
|
|
@@ -4807,7 +4840,8 @@ function buildLinkDecos(state$1) {
|
|
|
4807
4840
|
link.url,
|
|
4808
4841
|
link.from,
|
|
4809
4842
|
link.to,
|
|
4810
|
-
state$1.readOnly
|
|
4843
|
+
state$1.readOnly,
|
|
4844
|
+
state$1.facet(affiliateTagFacet)
|
|
4811
4845
|
)
|
|
4812
4846
|
})
|
|
4813
4847
|
);
|
|
@@ -6843,9 +6877,6 @@ function WqlBars({ result, unit: unitProp }) {
|
|
|
6843
6877
|
] }) });
|
|
6844
6878
|
}
|
|
6845
6879
|
var MAX_ROWS = 12;
|
|
6846
|
-
function formatValue(v, unit) {
|
|
6847
|
-
return `${v.toLocaleString()}${unit ? ` ${unit}` : ""}`;
|
|
6848
|
-
}
|
|
6849
6880
|
function WqlTable({ result, unit: unitProp }) {
|
|
6850
6881
|
const shape = useChartShape(result);
|
|
6851
6882
|
const unit = result.series[0]?.unit ?? unitProp ?? "";
|
|
@@ -6853,14 +6884,14 @@ function WqlTable({ result, unit: unitProp }) {
|
|
|
6853
6884
|
if (shape.kind === "scalar") {
|
|
6854
6885
|
return {
|
|
6855
6886
|
head: ["Metric", "Value"],
|
|
6856
|
-
body: [[result.series[0]?.label ?? "scalar",
|
|
6887
|
+
body: [[result.series[0]?.label ?? "scalar", formatTimeseriesTooltipValue(shape.value, unit)]],
|
|
6857
6888
|
more: 0
|
|
6858
6889
|
};
|
|
6859
6890
|
}
|
|
6860
6891
|
if (shape.kind === "bars") {
|
|
6861
6892
|
const all = result.series.map((s) => [
|
|
6862
6893
|
s.label,
|
|
6863
|
-
|
|
6894
|
+
formatTimeseriesTooltipValue(s.points[0]?.value ?? 0, unit)
|
|
6864
6895
|
]);
|
|
6865
6896
|
return {
|
|
6866
6897
|
head: ["Series", "Value"],
|
|
@@ -6881,7 +6912,7 @@ function WqlTable({ result, unit: unitProp }) {
|
|
|
6881
6912
|
formatTimestamp(ts),
|
|
6882
6913
|
...result.series.map((s) => {
|
|
6883
6914
|
const v = seriesMap.get(s.label)?.get(ts);
|
|
6884
|
-
return v !== void 0 ?
|
|
6915
|
+
return v !== void 0 ? formatTimeseriesTooltipValue(v, unit) : "\u2014";
|
|
6885
6916
|
})
|
|
6886
6917
|
]);
|
|
6887
6918
|
return { head, body, more: Math.max(0, timestamps.length - MAX_ROWS) };
|
|
@@ -17455,6 +17486,8 @@ exports.DefaultFrontmatterWidget = DefaultFrontmatterWidget;
|
|
|
17455
17486
|
exports.INTERNAL_FRONTMATTER_KEYS = INTERNAL_FRONTMATTER_KEYS;
|
|
17456
17487
|
exports.activeCursorSection = activeCursorSection;
|
|
17457
17488
|
exports.addRuntimePanel = addRuntimePanel;
|
|
17489
|
+
exports.affiliateTagFacet = affiliateTagFacet;
|
|
17490
|
+
exports.applyAmazonAffiliateTag = applyAmazonAffiliateTag;
|
|
17458
17491
|
exports.attachmentUrlFacet = attachmentUrlFacet;
|
|
17459
17492
|
exports.autocompleteTooltipTheme = autocompleteTooltipTheme;
|
|
17460
17493
|
exports.configureOverlayActions = configureOverlayActions;
|
|
@@ -17493,6 +17526,7 @@ exports.handleFenceAutoWrap = handleFenceAutoWrap;
|
|
|
17493
17526
|
exports.handleSmartUrlPaste = handleSmartUrlPaste;
|
|
17494
17527
|
exports.inlineButtonDecoration = inlineButtonDecoration;
|
|
17495
17528
|
exports.insertMarkdownLinkCommand = insertMarkdownLinkCommand;
|
|
17529
|
+
exports.isAmazonRetailHost = isAmazonRetailHost;
|
|
17496
17530
|
exports.isEditorFocused = isEditorFocused;
|
|
17497
17531
|
exports.isInternalFrontmatterKey = isInternalFrontmatterKey;
|
|
17498
17532
|
exports.isNavigableUrl = isNavigableUrl;
|