@flamingo-stack/openframe-frontend-core 0.0.816 → 0.0.817
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/build/export-map.json +1 -1
- package/dist/{case-study-card-NLT2JVI7.cjs → case-study-card-IZBMHA6R.cjs} +3 -3
- package/dist/{chunk-7ERD34HQ.cjs → chunk-24M2JYM5.cjs} +566 -774
- package/dist/{chunk-3E4FIJAM.cjs → chunk-4ROR52OW.cjs} +15 -15
- package/dist/{chunk-SWBLTIN4.cjs → chunk-5TSYOIIZ.cjs} +54 -52
- package/dist/{chunk-JH65CEO4.cjs → chunk-6F4YGHGM.cjs} +36 -36
- package/dist/{chunk-VDXI26G7.cjs → chunk-7KBHLP4E.cjs} +81 -78
- package/dist/{chunk-CNTBGJA7.cjs → chunk-A34UNP5V.cjs} +65 -1
- package/dist/{chunk-633NTKO2.cjs → chunk-BL2J5RJK.cjs} +31 -53
- package/dist/{chunk-7NYWHEQM.cjs → chunk-C2OUXL3Q.cjs} +15 -15
- package/dist/{chunk-53JJLHJM.cjs → chunk-DSBRWP5M.cjs} +20 -20
- package/dist/chunk-DVHSYPDB.cjs +471 -0
- package/dist/{chunk-5TUR7O7H.cjs → chunk-EX7M3VQC.cjs} +90 -90
- package/dist/{chunk-EJCUAADF.cjs → chunk-F2LVBRHC.cjs} +4 -4
- package/dist/{chunk-GAR2IIU6.cjs → chunk-IM366HS6.cjs} +105 -157
- package/dist/{chunk-FUEK43FL.cjs → chunk-IOFIHVVW.cjs} +206 -200
- package/dist/{chunk-JOOZTRXQ.cjs → chunk-JMOCM2SW.cjs} +4 -4
- package/dist/{chunk-PAI4A3UM.cjs → chunk-K5IICQNF.cjs} +61 -54
- package/dist/{chunk-JOKOQOLJ.cjs → chunk-LUID2IB3.cjs} +2 -2
- package/dist/{chunk-L7W4455K.cjs → chunk-MAHJY2PO.cjs} +3 -3
- package/dist/{chunk-4PMD3JUC.cjs → chunk-NPNZAAOB.cjs} +2 -2
- package/dist/{chunk-EB7YAUER.cjs → chunk-P7JQGOX4.cjs} +19 -19
- package/dist/{chunk-O6VWD2SB.cjs → chunk-RDHF3F5R.cjs} +3 -3
- package/dist/{chunk-HM7VCQSX.cjs → chunk-SBFBNOKU.cjs} +4 -4
- package/dist/{chunk-7O7EX7HQ.cjs → chunk-T266OITJ.cjs} +28 -20
- package/dist/{chunk-ZAWHRYJZ.cjs → chunk-TKEYWSDZ.cjs} +45 -45
- package/dist/{chunk-F4ZJRMMM.cjs → chunk-UDLDXVY4.cjs} +8 -8
- package/dist/{chunk-Y6MJMPHV.cjs → chunk-UEULXVW2.cjs} +32 -84
- package/dist/{chunk-RYJJHSHV.cjs → chunk-UFBVOBYR.cjs} +23 -23
- package/dist/{chunk-IKB6AZPV.cjs → chunk-ZECG6GU5.cjs} +2 -2
- package/dist/{chunk-3ELDGEM2.cjs → chunk-ZP4JMX7G.cjs} +87 -84
- package/dist/{cloud-tenants-SRTX2FZC.cjs → cloud-tenants-NMAXIJLL.cjs} +11 -11
- package/dist/components/announcement-bar.d.ts.map +1 -1
- package/dist/components/announcement-bar.js +5 -5
- package/dist/components/case-studies/index.cjs +26 -26
- package/dist/components/chat/chat-markdown-link.d.ts +15 -0
- package/dist/components/chat/chat-markdown-link.d.ts.map +1 -0
- package/dist/components/chat/chat-markdown-link.js +22 -0
- package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
- package/dist/components/chat/chat-message-enhanced.js +3 -9
- package/dist/components/chat/embeddable-chat.d.ts +4 -0
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +30 -67
- package/dist/components/chat/entity-cards/chat-card-disclosure.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/chat-card-disclosure.js +8 -11
- package/dist/components/chat/entity-cards/dispatch.d.ts +5 -5
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.js +18 -17
- package/dist/components/chat/entity-cards/github-activity-card.d.ts +1 -1
- package/dist/components/chat/entity-cards/use-entity-card-link.d.ts +3 -2
- package/dist/components/chat/entity-cards/use-entity-card-link.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/use-entity-card-link.js +6 -4
- package/dist/components/chat/index.cjs +28 -21
- package/dist/components/chat/index.d.ts +2 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +4 -3
- package/dist/components/chat/{inline-app-link-chip.d.ts → inline-chip.d.ts} +1 -14
- package/dist/components/chat/inline-chip.d.ts.map +1 -0
- package/dist/components/chat/inline-chip.js +27 -0
- package/dist/components/chat/nav-link-anchor-via-runtime.d.ts +45 -11
- package/dist/components/chat/nav-link-anchor-via-runtime.d.ts.map +1 -1
- package/dist/components/chat/nav-link-anchor-via-runtime.js +32 -24
- package/dist/components/chat/source-action-button.d.ts +12 -3
- package/dist/components/chat/source-action-button.d.ts.map +1 -1
- package/dist/components/chat/source-action-button.js +41 -26
- package/dist/components/chat/types/component.types.d.ts +1 -1
- package/dist/components/chat/types/message.types.d.ts +1 -1
- package/dist/components/chat/types/message.types.d.ts.map +1 -1
- package/dist/components/chat/utils/chat-nav-resolution.d.ts +1 -6
- package/dist/components/chat/utils/chat-nav-resolution.d.ts.map +1 -1
- package/dist/components/chat/utils/chat-nav-resolution.js +2 -3
- package/dist/components/chat/utils/decide-new-tab.d.ts +0 -3
- package/dist/components/chat/utils/decide-new-tab.d.ts.map +1 -1
- package/dist/components/chat/utils/decide-new-tab.js +0 -1
- package/dist/components/chat/utils/execute-navigation.d.ts +36 -34
- package/dist/components/chat/utils/execute-navigation.d.ts.map +1 -1
- package/dist/components/chat/utils/execute-navigation.js +23 -19
- package/dist/components/chat/utils/index.d.ts +5 -5
- package/dist/components/chat/utils/index.d.ts.map +1 -1
- package/dist/components/chat/utils/index.js +14 -6
- package/dist/components/chat/utils/nav-anchor-props.d.ts +35 -8
- package/dist/components/chat/utils/nav-anchor-props.d.ts.map +1 -1
- package/dist/components/chat/utils/nav-anchor-props.js +14 -5
- package/dist/components/chat/utils/new-tab-rel.d.ts +15 -0
- package/dist/components/chat/utils/new-tab-rel.d.ts.map +1 -0
- package/dist/components/chat/utils/new-tab-rel.js +25 -0
- package/dist/components/contact/index.cjs +12 -12
- package/dist/components/docs/index.cjs +15 -15
- package/dist/components/embeds/index.cjs +12 -12
- package/dist/components/faq/index.cjs +13 -13
- package/dist/components/features/devices/devices-table-columns.d.ts.map +1 -1
- package/dist/components/features/devices/devices-table-columns.js +4 -1
- package/dist/components/features/index.cjs +11 -11
- package/dist/components/help-center-pages/index.cjs +105 -105
- package/dist/components/index.cjs +91 -83
- package/dist/components/meeting-scheduler/index.cjs +50 -50
- package/dist/components/navigation/app-header.d.ts +1 -4
- package/dist/components/navigation/app-header.d.ts.map +1 -1
- package/dist/components/navigation/app-header.js +0 -2
- package/dist/components/navigation/index.cjs +14 -14
- package/dist/components/navigation/ticket-alerts-button.d.ts +1 -4
- package/dist/components/navigation/ticket-alerts-button.d.ts.map +1 -1
- package/dist/components/navigation/ticket-alerts-button.js +5 -5
- package/dist/components/onboarding-guides/index.cjs +14 -14
- package/dist/components/product-demo/index.cjs +20 -20
- package/dist/components/related-content/card-registry.d.ts +1 -1
- package/dist/components/related-content/index.cjs +7 -7
- package/dist/components/related-content/related-content-section.d.ts +3 -3
- package/dist/components/related-content/related-content-section.d.ts.map +1 -1
- package/dist/components/related-content/related-content-section.js +5 -3
- package/dist/components/shared/doc-search/resolve-search-result-action.d.ts +10 -3
- package/dist/components/shared/doc-search/resolve-search-result-action.d.ts.map +1 -1
- package/dist/components/shared/doc-search/resolve-search-result-action.js +8 -17
- package/dist/components/shared/doc-search/use-doc-search.d.ts.map +1 -1
- package/dist/components/shared/doc-search/use-doc-search.js +15 -27
- package/dist/components/shared/product-release/product-release-card.d.ts +2 -2
- package/dist/components/shared/product-release/product-releases-view.d.ts.map +1 -1
- package/dist/components/shared/product-release/product-releases-view.js +1 -3
- package/dist/components/tickets/index.cjs +18 -18
- package/dist/components/tickets/ticket-detail-drawer.d.ts.map +1 -1
- package/dist/components/tickets/ticket-detail-drawer.js +6 -3
- package/dist/components/tickets/types.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/hover-dropdown.d.ts +2 -2
- package/dist/components/ui/index.cjs +31 -23
- package/dist/components/ui/service-card.d.ts.map +1 -1
- package/dist/components/ui/service-card.js +4 -1
- package/dist/components/vendor-display-button.d.ts.map +1 -1
- package/dist/components/vendor-display-button.js +4 -1
- package/dist/contexts/chat-runtime-context.d.ts +11 -11
- package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
- package/dist/{devices-DL4YU64N.cjs → devices-QBKWVHE6.cjs} +12 -12
- package/dist/{embeddable-chat-YRKMPFDY.cjs → embeddable-chat-WNPCPMDL.cjs} +96 -137
- package/dist/hooks/index.cjs +5 -5
- package/dist/hooks/use-contact-submission.d.ts.map +1 -1
- package/dist/hooks/use-contact-submission.js +11 -8
- package/dist/index.cjs +40 -34
- package/dist/{knowledge-VQW5JL2Z.cjs → knowledge-FSAYWM25.cjs} +12 -12
- package/dist/{logs-IY3WBLMW.cjs → logs-OZX4SYHG.cjs} +19 -19
- package/dist/{policies-IXWTWMJO.cjs → policies-LPCUCTLX.cjs} +15 -15
- package/dist/{scripts-D5CLO5EG.cjs → scripts-ZNFZSONW.cjs} +16 -16
- package/dist/{software-update-ULNP6CKJ.cjs → software-update-BRYOVQVY.cjs} +14 -14
- package/dist/utils/index.cjs +116 -89
- package/dist/utils/open-in-new-tab.d.ts +2 -1
- package/dist/utils/open-in-new-tab.d.ts.map +1 -1
- package/dist/utils/open-in-new-tab.js +2 -1
- package/dist/utils/scroll-into-view.d.ts +1 -1
- package/eslint-config/base.js +11 -0
- package/eslint-config/navigation.js +142 -0
- package/package.json +1 -1
- package/src/components/announcement-bar.tsx +8 -6
- package/src/components/chat/chat-markdown-link.tsx +42 -0
- package/src/components/chat/chat-message-enhanced.tsx +10 -36
- package/src/components/chat/embeddable-chat.tsx +63 -106
- package/src/components/chat/entity-cards/chat-card-disclosure.tsx +9 -13
- package/src/components/chat/entity-cards/dispatch.tsx +45 -35
- package/src/components/chat/entity-cards/github-activity-card.tsx +1 -1
- package/src/components/chat/entity-cards/use-entity-card-link.ts +11 -16
- package/src/components/chat/index.ts +3 -1
- package/src/components/chat/{inline-app-link-chip.tsx → inline-chip.tsx} +1 -27
- package/src/components/chat/nav-link-anchor-via-runtime.tsx +73 -33
- package/src/components/chat/source-action-button.tsx +57 -33
- package/src/components/chat/types/component.types.ts +1 -1
- package/src/components/chat/types/message.types.ts +1 -1
- package/src/components/chat/utils/chat-nav-resolution.ts +3 -8
- package/src/components/chat/utils/decide-new-tab.ts +0 -3
- package/src/components/chat/utils/execute-navigation.ts +58 -58
- package/src/components/chat/utils/index.ts +13 -6
- package/src/components/chat/utils/nav-anchor-props.ts +56 -9
- package/src/components/chat/utils/new-tab-rel.ts +39 -0
- package/src/components/features/devices/devices-table-columns.tsx +4 -1
- package/src/components/navigation/app-header.tsx +0 -5
- package/src/components/navigation/ticket-alerts-button.tsx +7 -8
- package/src/components/related-content/card-registry.tsx +1 -1
- package/src/components/related-content/related-content-section.tsx +10 -10
- package/src/components/shared/doc-search/resolve-search-result-action.ts +19 -33
- package/src/components/shared/doc-search/use-doc-search.ts +21 -44
- package/src/components/shared/product-release/product-release-card.tsx +4 -4
- package/src/components/shared/product-release/product-releases-view.tsx +2 -5
- package/src/components/tickets/ticket-detail-drawer.tsx +7 -4
- package/src/components/tickets/types.ts +1 -1
- package/src/components/ui/button/button.tsx +2 -2
- package/src/components/ui/hover-dropdown.tsx +2 -2
- package/src/components/ui/service-card.tsx +4 -1
- package/src/components/vendor-display-button.tsx +5 -2
- package/src/contexts/chat-runtime-context.tsx +15 -12
- package/src/hooks/use-contact-submission.ts +13 -8
- package/src/utils/index.ts +1 -1
- package/src/utils/open-in-new-tab.ts +4 -2
- package/src/utils/scroll-into-view.ts +1 -1
- package/dist/chunk-RD66AGUI.cjs +0 -156
- package/dist/components/chat/inline-app-link-chip.d.ts.map +0 -1
- package/dist/components/chat/inline-app-link-chip.js +0 -37
package/dist/utils/index.cjs
CHANGED
|
@@ -84339,95 +84339,6 @@ var OPENFRAME_DEV_SECTIONS = {
|
|
|
84339
84339
|
}
|
|
84340
84340
|
};
|
|
84341
84341
|
|
|
84342
|
-
// src/utils/open-in-new-tab.ts
|
|
84343
|
-
function openInNewTab(href) {
|
|
84344
|
-
return (event) => {
|
|
84345
|
-
event.preventDefault();
|
|
84346
|
-
window.open(href, "_blank", "noopener,noreferrer");
|
|
84347
|
-
};
|
|
84348
|
-
}
|
|
84349
|
-
|
|
84350
|
-
// src/utils/scroll-into-view.ts
|
|
84351
|
-
var activeRaf = 0;
|
|
84352
|
-
var teardownActive = null;
|
|
84353
|
-
function cancelActiveScroll() {
|
|
84354
|
-
if (activeRaf) {
|
|
84355
|
-
cancelAnimationFrame(activeRaf);
|
|
84356
|
-
activeRaf = 0;
|
|
84357
|
-
}
|
|
84358
|
-
if (teardownActive) {
|
|
84359
|
-
teardownActive();
|
|
84360
|
-
teardownActive = null;
|
|
84361
|
-
}
|
|
84362
|
-
}
|
|
84363
|
-
var easeOutCubic = (t) => 1 - Math.pow(1 - t, 3);
|
|
84364
|
-
function getScrollableAncestor(el) {
|
|
84365
|
-
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
84366
|
-
const overflowY = getComputedStyle(node).overflowY;
|
|
84367
|
-
if ((overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay") && node.scrollHeight > node.clientHeight) {
|
|
84368
|
-
return node;
|
|
84369
|
-
}
|
|
84370
|
-
}
|
|
84371
|
-
return null;
|
|
84372
|
-
}
|
|
84373
|
-
function declaredScrollMarginTop(target) {
|
|
84374
|
-
const margin = Number.parseFloat(getComputedStyle(target).scrollMarginTop);
|
|
84375
|
-
return Number.isFinite(margin) ? margin : 0;
|
|
84376
|
-
}
|
|
84377
|
-
function scrollElementIntoView(target, options = {}) {
|
|
84378
|
-
if (typeof window === "undefined" || !target) return;
|
|
84379
|
-
const { headerOffset = 0, behavior = "smooth", adjustTargetY, durationMs = 320 } = options;
|
|
84380
|
-
const container = getScrollableAncestor(target);
|
|
84381
|
-
const readCurrent = () => container ? container.scrollTop : window.scrollY;
|
|
84382
|
-
const writeTo = (y) => {
|
|
84383
|
-
if (container) container.scrollTop = y;
|
|
84384
|
-
else window.scrollTo(0, y);
|
|
84385
|
-
};
|
|
84386
|
-
const computeTarget = () => {
|
|
84387
|
-
const offset = Math.max(headerOffset, declaredScrollMarginTop(target));
|
|
84388
|
-
const raw2 = container ? container.scrollTop + (target.getBoundingClientRect().top - container.getBoundingClientRect().top) - offset : target.getBoundingClientRect().top + window.scrollY - offset;
|
|
84389
|
-
const adjusted = adjustTargetY ? adjustTargetY(raw2) : raw2;
|
|
84390
|
-
const maxScroll = container ? Math.max(0, container.scrollHeight - container.clientHeight) : Math.max(0, document.documentElement.scrollHeight - window.innerHeight);
|
|
84391
|
-
return Math.min(Math.max(0, adjusted), maxScroll);
|
|
84392
|
-
};
|
|
84393
|
-
cancelActiveScroll();
|
|
84394
|
-
const prefersReduced = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
84395
|
-
if (behavior === "instant" || behavior === "auto" || prefersReduced) {
|
|
84396
|
-
writeTo(computeTarget());
|
|
84397
|
-
return;
|
|
84398
|
-
}
|
|
84399
|
-
let startY = null;
|
|
84400
|
-
let startTime = 0;
|
|
84401
|
-
const onUserGesture = () => cancelActiveScroll();
|
|
84402
|
-
window.addEventListener("wheel", onUserGesture, { passive: true });
|
|
84403
|
-
window.addEventListener("touchmove", onUserGesture, { passive: true });
|
|
84404
|
-
teardownActive = () => {
|
|
84405
|
-
window.removeEventListener("wheel", onUserGesture);
|
|
84406
|
-
window.removeEventListener("touchmove", onUserGesture);
|
|
84407
|
-
};
|
|
84408
|
-
const step = (now) => {
|
|
84409
|
-
if (startY === null) {
|
|
84410
|
-
startY = readCurrent();
|
|
84411
|
-
startTime = now;
|
|
84412
|
-
}
|
|
84413
|
-
const targetY = computeTarget();
|
|
84414
|
-
const t = Math.min(1, (now - startTime) / durationMs);
|
|
84415
|
-
const y = startY + (targetY - startY) * easeOutCubic(t);
|
|
84416
|
-
writeTo(y);
|
|
84417
|
-
if (t < 1) {
|
|
84418
|
-
activeRaf = requestAnimationFrame(step);
|
|
84419
|
-
} else {
|
|
84420
|
-
writeTo(computeTarget());
|
|
84421
|
-
activeRaf = 0;
|
|
84422
|
-
if (teardownActive) {
|
|
84423
|
-
teardownActive();
|
|
84424
|
-
teardownActive = null;
|
|
84425
|
-
}
|
|
84426
|
-
}
|
|
84427
|
-
};
|
|
84428
|
-
activeRaf = requestAnimationFrame(step);
|
|
84429
|
-
}
|
|
84430
|
-
|
|
84431
84342
|
// src/utils/markdown-fences.ts
|
|
84432
84343
|
var FENCE_RE = /^ {0,3}(`{3,}|~{3,})([^\n]*?)\r?$/;
|
|
84433
84344
|
var BLANK_LINE_RE = /^[ \t\r]*$/;
|
|
@@ -84599,6 +84510,87 @@ function findAnchorElementByNormalizedId(rawId, doc) {
|
|
|
84599
84510
|
return findDuplicateShifted(normalized, doc);
|
|
84600
84511
|
}
|
|
84601
84512
|
|
|
84513
|
+
// src/utils/scroll-into-view.ts
|
|
84514
|
+
var activeRaf = 0;
|
|
84515
|
+
var teardownActive = null;
|
|
84516
|
+
function cancelActiveScroll() {
|
|
84517
|
+
if (activeRaf) {
|
|
84518
|
+
cancelAnimationFrame(activeRaf);
|
|
84519
|
+
activeRaf = 0;
|
|
84520
|
+
}
|
|
84521
|
+
if (teardownActive) {
|
|
84522
|
+
teardownActive();
|
|
84523
|
+
teardownActive = null;
|
|
84524
|
+
}
|
|
84525
|
+
}
|
|
84526
|
+
var easeOutCubic = (t) => 1 - Math.pow(1 - t, 3);
|
|
84527
|
+
function getScrollableAncestor(el) {
|
|
84528
|
+
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
84529
|
+
const overflowY = getComputedStyle(node).overflowY;
|
|
84530
|
+
if ((overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay") && node.scrollHeight > node.clientHeight) {
|
|
84531
|
+
return node;
|
|
84532
|
+
}
|
|
84533
|
+
}
|
|
84534
|
+
return null;
|
|
84535
|
+
}
|
|
84536
|
+
function declaredScrollMarginTop(target) {
|
|
84537
|
+
const margin = Number.parseFloat(getComputedStyle(target).scrollMarginTop);
|
|
84538
|
+
return Number.isFinite(margin) ? margin : 0;
|
|
84539
|
+
}
|
|
84540
|
+
function scrollElementIntoView(target, options = {}) {
|
|
84541
|
+
if (typeof window === "undefined" || !target) return;
|
|
84542
|
+
const { headerOffset = 0, behavior = "smooth", adjustTargetY, durationMs = 320 } = options;
|
|
84543
|
+
const container = getScrollableAncestor(target);
|
|
84544
|
+
const readCurrent = () => container ? container.scrollTop : window.scrollY;
|
|
84545
|
+
const writeTo = (y) => {
|
|
84546
|
+
if (container) container.scrollTop = y;
|
|
84547
|
+
else window.scrollTo(0, y);
|
|
84548
|
+
};
|
|
84549
|
+
const computeTarget = () => {
|
|
84550
|
+
const offset = Math.max(headerOffset, declaredScrollMarginTop(target));
|
|
84551
|
+
const raw2 = container ? container.scrollTop + (target.getBoundingClientRect().top - container.getBoundingClientRect().top) - offset : target.getBoundingClientRect().top + window.scrollY - offset;
|
|
84552
|
+
const adjusted = adjustTargetY ? adjustTargetY(raw2) : raw2;
|
|
84553
|
+
const maxScroll = container ? Math.max(0, container.scrollHeight - container.clientHeight) : Math.max(0, document.documentElement.scrollHeight - window.innerHeight);
|
|
84554
|
+
return Math.min(Math.max(0, adjusted), maxScroll);
|
|
84555
|
+
};
|
|
84556
|
+
cancelActiveScroll();
|
|
84557
|
+
const prefersReduced = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
84558
|
+
if (behavior === "instant" || behavior === "auto" || prefersReduced) {
|
|
84559
|
+
writeTo(computeTarget());
|
|
84560
|
+
return;
|
|
84561
|
+
}
|
|
84562
|
+
let startY = null;
|
|
84563
|
+
let startTime = 0;
|
|
84564
|
+
const onUserGesture = () => cancelActiveScroll();
|
|
84565
|
+
window.addEventListener("wheel", onUserGesture, { passive: true });
|
|
84566
|
+
window.addEventListener("touchmove", onUserGesture, { passive: true });
|
|
84567
|
+
teardownActive = () => {
|
|
84568
|
+
window.removeEventListener("wheel", onUserGesture);
|
|
84569
|
+
window.removeEventListener("touchmove", onUserGesture);
|
|
84570
|
+
};
|
|
84571
|
+
const step = (now) => {
|
|
84572
|
+
if (startY === null) {
|
|
84573
|
+
startY = readCurrent();
|
|
84574
|
+
startTime = now;
|
|
84575
|
+
}
|
|
84576
|
+
const targetY = computeTarget();
|
|
84577
|
+
const t = Math.min(1, (now - startTime) / durationMs);
|
|
84578
|
+
const y = startY + (targetY - startY) * easeOutCubic(t);
|
|
84579
|
+
writeTo(y);
|
|
84580
|
+
if (t < 1) {
|
|
84581
|
+
activeRaf = requestAnimationFrame(step);
|
|
84582
|
+
} else {
|
|
84583
|
+
writeTo(computeTarget());
|
|
84584
|
+
activeRaf = 0;
|
|
84585
|
+
if (teardownActive) {
|
|
84586
|
+
teardownActive();
|
|
84587
|
+
teardownActive = null;
|
|
84588
|
+
}
|
|
84589
|
+
}
|
|
84590
|
+
};
|
|
84591
|
+
activeRaf = requestAnimationFrame(step);
|
|
84592
|
+
}
|
|
84593
|
+
|
|
84602
84594
|
// src/utils/same-page-hash-nav.ts
|
|
84603
84595
|
var STICKY_HEADER_OFFSET_PX = 96;
|
|
84604
84596
|
var HUB_HEADER_OFFSET_PX = 80;
|
|
@@ -84694,6 +84686,41 @@ function navigateSamePageHash(target, options = {}) {
|
|
|
84694
84686
|
return true;
|
|
84695
84687
|
}
|
|
84696
84688
|
|
|
84689
|
+
// src/components/chat/utils/new-tab-rel.ts
|
|
84690
|
+
function isOwnSiteHref(href) {
|
|
84691
|
+
if (!href) return false;
|
|
84692
|
+
if (href.startsWith("/") && !href.startsWith("//")) return true;
|
|
84693
|
+
try {
|
|
84694
|
+
const url = new URL(href);
|
|
84695
|
+
return isLocalUrl(url.href) || getPlatformByHostname(url.hostname) !== null;
|
|
84696
|
+
} catch {
|
|
84697
|
+
return false;
|
|
84698
|
+
}
|
|
84699
|
+
}
|
|
84700
|
+
function newTabRel(href, targetPlatform) {
|
|
84701
|
+
return targetPlatform || isOwnSiteHref(href) ? "noopener" : "noopener noreferrer";
|
|
84702
|
+
}
|
|
84703
|
+
function newTabFeatures(href, targetPlatform) {
|
|
84704
|
+
return newTabRel(href, targetPlatform).replace(" ", ",");
|
|
84705
|
+
}
|
|
84706
|
+
|
|
84707
|
+
// src/components/chat/utils/execute-navigation.ts
|
|
84708
|
+
function executeNewTabNavigation({
|
|
84709
|
+
runtime,
|
|
84710
|
+
href,
|
|
84711
|
+
targetPlatform
|
|
84712
|
+
}) {
|
|
84713
|
+
window.open(href, "_blank", newTabFeatures(href, targetPlatform));
|
|
84714
|
+
}
|
|
84715
|
+
|
|
84716
|
+
// src/utils/open-in-new-tab.ts
|
|
84717
|
+
function openInNewTab(href) {
|
|
84718
|
+
return (event) => {
|
|
84719
|
+
event.preventDefault();
|
|
84720
|
+
executeNewTabNavigation({ runtime: null, href });
|
|
84721
|
+
};
|
|
84722
|
+
}
|
|
84723
|
+
|
|
84697
84724
|
// src/utils/list-url.ts
|
|
84698
84725
|
var ALIASES = { blog_post_existing: "blog_post" };
|
|
84699
84726
|
function canonicalContentRefType(contentRefType) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { MouseEvent } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* A click handler that opens `href` in a new tab and does nothing else: the
|
|
4
|
-
* "open in new tab" cell of a table whose rows are links themselves.
|
|
4
|
+
* "open in new tab" cell of a table whose rows are links themselves. Opened the
|
|
5
|
+
* one way the lib opens a tab (`executeNewTabNavigation`).
|
|
5
6
|
*/
|
|
6
7
|
export declare function openInNewTab(href: string): (event: MouseEvent) => void;
|
|
7
8
|
//# sourceMappingURL=open-in-new-tab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-in-new-tab.d.ts","sourceRoot":"","sources":["../../src/utils/open-in-new-tab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"open-in-new-tab.d.ts","sourceRoot":"","sources":["../../src/utils/open-in-new-tab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,IAC/B,OAAO,UAAU,UAI1B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { executeNewTabNavigation } from "../components/chat/utils/execute-navigation.js";
|
|
1
2
|
function openInNewTab(href) {
|
|
2
3
|
return (event) => {
|
|
3
4
|
event.preventDefault();
|
|
4
|
-
|
|
5
|
+
executeNewTabNavigation({ runtime: null, href });
|
|
5
6
|
};
|
|
6
7
|
}
|
|
7
8
|
export {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* viewport, account for sticky chrome, survive layout shifts" helper.
|
|
4
4
|
*
|
|
5
5
|
* One shared implementation so every caller (the ticket drawer expand, the
|
|
6
|
-
*
|
|
6
|
+
* the lib's navigation executor hash scroll, doc-tree, delivery
|
|
7
7
|
* `?focus=`, sticky-section-nav, …) inherits the SAME cancellation-proof
|
|
8
8
|
* motion.
|
|
9
9
|
*
|
package/eslint-config/base.js
CHANGED
|
@@ -9,6 +9,7 @@ import { boxedPrimitivesPlugin } from './boxed-primitives.js';
|
|
|
9
9
|
import { ignores } from './ignores.js';
|
|
10
10
|
import { imageSizesPlugin } from './image-sizes.js';
|
|
11
11
|
import { layoutVariantsPlugin } from './layout-variants.js';
|
|
12
|
+
import { navigationPlugin } from './navigation.js';
|
|
12
13
|
import { popupPortalPlugin } from './popup-portal.js';
|
|
13
14
|
import { reExportsPlugin } from './re-exports.js';
|
|
14
15
|
import { webviewPerformancePlugin } from './webview-performance.js';
|
|
@@ -19,6 +20,7 @@ export const flamingoPlugin = {
|
|
|
19
20
|
rules: {
|
|
20
21
|
...webviewPerformancePlugin.rules,
|
|
21
22
|
...layoutVariantsPlugin.rules,
|
|
23
|
+
...navigationPlugin.rules,
|
|
22
24
|
...imageSizesPlugin.rules,
|
|
23
25
|
...boxedPrimitivesPlugin.rules,
|
|
24
26
|
...popupPortalPlugin.rules,
|
|
@@ -333,6 +335,15 @@ export const base = [
|
|
|
333
335
|
rules: { 'flamingo/no-mixed-layout-variants': 'error' },
|
|
334
336
|
},
|
|
335
337
|
|
|
338
|
+
// A link is followed through the lib's navigation executor only — see ./navigation.js.
|
|
339
|
+
{
|
|
340
|
+
name: 'flamingo/base/navigation',
|
|
341
|
+
files: ['**/*.{js,mjs,jsx,ts,mts,tsx}'],
|
|
342
|
+
ignores: ['**/*.{test,spec}.{js,mjs,jsx,ts,mts,tsx}', '**/__tests__/**'],
|
|
343
|
+
plugins: { flamingo: flamingoPlugin },
|
|
344
|
+
rules: { 'flamingo/no-navigation-fallback': 'error' },
|
|
345
|
+
},
|
|
346
|
+
|
|
336
347
|
// A picture's `sizes` and quality come from the lib's image-size table — see ./image-sizes.js. Tests and stories
|
|
337
348
|
// draw no picture a reader waits on.
|
|
338
349
|
{
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A link is followed in ONE way: the lib's navigation executor (`executeNavigation`, `executeNavigationImperative`,
|
|
3
|
+
* `executeNewTabNavigation`, the hooks built on it), which hands a same-tab link to the host's `runtime.navigation.navigate` and lets the browser
|
|
4
|
+
* open what the host does not take. Nothing beside it navigates: no fallback option handed to it, and no router push or
|
|
5
|
+
* `location` write in the same function as a call to it. A second path is how a host's routing gets skipped quietly
|
|
6
|
+
* (CU-17tkuw61kfy: every caller passed `fallbackNavigate: router.push`). If a host does not navigate, wire its
|
|
7
|
+
* `navigate`; never route around it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** The executor and the hooks that call it. */
|
|
11
|
+
const EXECUTORS = new Set([
|
|
12
|
+
'executeNavigation',
|
|
13
|
+
'executeNavigationImperative',
|
|
14
|
+
'executeNewTabNavigation',
|
|
15
|
+
'useNavLinkViaRuntime',
|
|
16
|
+
'useNavigateViaRuntime',
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
/** `router.push(...)`, `router.replace(...)`: a router call on anything named like a router. */
|
|
20
|
+
const ROUTER_METHOD = new Set(['push', 'replace']);
|
|
21
|
+
const LOCATION_METHOD = new Set(['assign', 'replace']);
|
|
22
|
+
|
|
23
|
+
function calleeName(callee) {
|
|
24
|
+
if (callee.type === 'Identifier') return callee.name;
|
|
25
|
+
if (callee.type === 'MemberExpression' && !callee.computed && callee.property.type === 'Identifier') {
|
|
26
|
+
return callee.property.name;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function objectName(node) {
|
|
32
|
+
if (node.type === 'Identifier') return node.name;
|
|
33
|
+
if (node.type === 'MemberExpression' && !node.computed && node.property.type === 'Identifier') {
|
|
34
|
+
return node.property.name;
|
|
35
|
+
}
|
|
36
|
+
if (node.type === 'CallExpression') return calleeName(node.callee);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A direct navigation: `router.push(x)`, `location.assign(x)`, `window.open(x)`, or a `location.href =` write. */
|
|
41
|
+
function directNavigation(node) {
|
|
42
|
+
if (node.type === 'CallExpression' && node.callee.type === 'MemberExpression' && !node.callee.computed) {
|
|
43
|
+
const method = node.callee.property.name;
|
|
44
|
+
const owner = objectName(node.callee.object);
|
|
45
|
+
if (!owner) return null;
|
|
46
|
+
if (ROUTER_METHOD.has(method) && /router$/i.test(owner)) return `${owner}.${method}()`;
|
|
47
|
+
if (LOCATION_METHOD.has(method) && owner === 'location') return `location.${method}()`;
|
|
48
|
+
if (method === 'open' && owner === 'window') return 'window.open()';
|
|
49
|
+
}
|
|
50
|
+
if (
|
|
51
|
+
node.type === 'AssignmentExpression' &&
|
|
52
|
+
node.left.type === 'MemberExpression' &&
|
|
53
|
+
!node.left.computed &&
|
|
54
|
+
node.left.property.name === 'href' &&
|
|
55
|
+
objectName(node.left.object) === 'location'
|
|
56
|
+
) {
|
|
57
|
+
return 'location.href =';
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const FUNCTION_TYPES = new Set(['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']);
|
|
63
|
+
|
|
64
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
65
|
+
const noNavigationFallback = {
|
|
66
|
+
meta: {
|
|
67
|
+
type: 'problem',
|
|
68
|
+
docs: { description: 'Disallow a second way to navigate beside the lib navigation executor' },
|
|
69
|
+
schema: [],
|
|
70
|
+
messages: {
|
|
71
|
+
option:
|
|
72
|
+
"`{{key}}` hands {{executor}} a second way to navigate. Links go through the host's " +
|
|
73
|
+
'`runtime.navigation.navigate`; a host that does not navigate wires `navigate`, never a fallback.',
|
|
74
|
+
beside:
|
|
75
|
+
'{{call}} navigates beside {{executor}} in the same function. Follow a link through the executor only; a ' +
|
|
76
|
+
'host that does not navigate wires `runtime.navigation.navigate`.',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
create(context) {
|
|
80
|
+
// The module that DEFINES the executor is where navigating is implemented; the rule guards its callers.
|
|
81
|
+
const definesExecutor = context.sourceCode.ast.body.some(statement => {
|
|
82
|
+
const declaration = statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement;
|
|
83
|
+
return declaration?.type === 'FunctionDeclaration' && EXECUTORS.has(declaration.id?.name);
|
|
84
|
+
});
|
|
85
|
+
if (definesExecutor) return {};
|
|
86
|
+
/** Per enclosing function: the executor calls and the direct navigations anywhere inside it (nested handlers
|
|
87
|
+
* included). The file itself is a frame too, but only for its top-level code: two components in one file are
|
|
88
|
+
* two functions. */
|
|
89
|
+
const frames = [];
|
|
90
|
+
const reported = new Set();
|
|
91
|
+
const enter = () => frames.push({ executors: [], direct: [] });
|
|
92
|
+
const exit = () => {
|
|
93
|
+
const frame = frames.pop();
|
|
94
|
+
if (!frame || frame.executors.length === 0) return;
|
|
95
|
+
for (const { node, call } of frame.direct) {
|
|
96
|
+
if (reported.has(node)) continue;
|
|
97
|
+
reported.add(node);
|
|
98
|
+
context.report({ node, messageId: 'beside', data: { call, executor: frame.executors[0] } });
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
/** The frames a fact belongs to: every enclosing function, or the file when at the top level. */
|
|
102
|
+
const owners = () => (frames.length > 1 ? frames.slice(1) : frames);
|
|
103
|
+
const noteDirect = node => {
|
|
104
|
+
const call = directNavigation(node);
|
|
105
|
+
if (call) for (const frame of owners()) frame.direct.push({ node, call });
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
Program: enter,
|
|
110
|
+
'Program:exit': exit,
|
|
111
|
+
...Object.fromEntries(
|
|
112
|
+
[...FUNCTION_TYPES].flatMap(t => [
|
|
113
|
+
[t, enter],
|
|
114
|
+
[`${t}:exit`, exit],
|
|
115
|
+
]),
|
|
116
|
+
),
|
|
117
|
+
CallExpression(node) {
|
|
118
|
+
const name = calleeName(node.callee);
|
|
119
|
+
if (name && EXECUTORS.has(name)) {
|
|
120
|
+
for (const frame of owners()) frame.executors.push(name);
|
|
121
|
+
for (const arg of node.arguments) {
|
|
122
|
+
if (arg.type !== 'ObjectExpression') continue;
|
|
123
|
+
for (const prop of arg.properties) {
|
|
124
|
+
const key = prop.type === 'Property' && !prop.computed ? (prop.key.name ?? prop.key.value) : null;
|
|
125
|
+
if (typeof key === 'string' && /^fallback/i.test(key)) {
|
|
126
|
+
context.report({ node: prop, messageId: 'option', data: { key, executor: name } });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
noteDirect(node);
|
|
133
|
+
},
|
|
134
|
+
AssignmentExpression: noteDirect,
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const navigationPlugin = {
|
|
140
|
+
meta: { name: 'flamingo-navigation' },
|
|
141
|
+
rules: { 'no-navigation-fallback': noNavigationFallback },
|
|
142
|
+
};
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { X } from 'lucide-react';
|
|
4
4
|
import { useEffect, useMemo, useState, useSyncExternalStore } from 'react';
|
|
5
|
+
import { useChatRuntime } from '../contexts/chat-runtime-context';
|
|
5
6
|
import { useEndpointsRuntime } from '../contexts/endpoints-runtime-context';
|
|
6
7
|
import { usePathname } from '../embed-shims/next-navigation';
|
|
7
8
|
import { useSelfFetch } from '../hooks/use-self-fetch';
|
|
@@ -16,6 +17,7 @@ import { isAnnouncementOnSurface } from '../utils/announcement-surface';
|
|
|
16
17
|
import { getAppType } from '../utils/app-config';
|
|
17
18
|
import { pickReadableTextColor } from '../utils/color-analysis';
|
|
18
19
|
import { pathMatchesAny } from '../utils/path-pattern';
|
|
20
|
+
import { executeNavigationImperative, executeNewTabNavigation } from './chat/utils/execute-navigation';
|
|
19
21
|
import { EntityIcon } from './icon-display';
|
|
20
22
|
import { AnnouncementBarView } from './ui/announcement-bar-view';
|
|
21
23
|
import { Button } from './ui/button';
|
|
@@ -89,6 +91,8 @@ export function AnnouncementBar({
|
|
|
89
91
|
// `usePathname` on a Next host, the embedder's registered router elsewhere).
|
|
90
92
|
// Read HERE so every host gets `excluded_paths` with no wiring of its own.
|
|
91
93
|
const pathname = usePathname();
|
|
94
|
+
// The CTA is followed through the lib's navigation executor, with the host's runtime when there is one.
|
|
95
|
+
const runtime = useChatRuntime();
|
|
92
96
|
|
|
93
97
|
// Optional endpoint runtime: no provider → no URL → fetching disabled.
|
|
94
98
|
const endpoints = useEndpointsRuntime();
|
|
@@ -200,7 +204,7 @@ export function AnnouncementBar({
|
|
|
200
204
|
if (previewMode || !announcement?.cta_url) return;
|
|
201
205
|
// Scheme guard: cta_url is admin-entered data — only http(s) (absolute or
|
|
202
206
|
// relative) may navigate. A `javascript:` value would otherwise execute
|
|
203
|
-
// via
|
|
207
|
+
// via a navigation (stored XSS).
|
|
204
208
|
let safeUrl: string;
|
|
205
209
|
try {
|
|
206
210
|
// Resolve against the CURRENT page (not the origin) so path-relative and
|
|
@@ -211,11 +215,9 @@ export function AnnouncementBar({
|
|
|
211
215
|
} catch {
|
|
212
216
|
return;
|
|
213
217
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
window.location.href = safeUrl;
|
|
218
|
-
}
|
|
218
|
+
// The admin chose the tab (`cta_target`).
|
|
219
|
+
if (announcement.cta_target === '_blank') executeNewTabNavigation({ runtime, href: safeUrl });
|
|
220
|
+
else executeNavigationImperative({ runtime, href: safeUrl, openIn: 'same-tab' });
|
|
219
221
|
};
|
|
220
222
|
|
|
221
223
|
// Never had anything to show: render nothing. Dismissal AND deactivation
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A link in a chat answer's markdown, through the host's `NavLinkAnchor` exactly as every chat link is routed. What it
|
|
5
|
+
* draws follows the navigation decision (`navLinkTarget`): a link the runtime keeps in this window is a place in the
|
|
6
|
+
* app, drawn as the inline box the host's entity mentions use (`InlineChip`); any other link (another site, a hub page
|
|
7
|
+
* from an embedded chat, a `mailto:`), and any link outside a chat runtime, stays a plain link.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type React from 'react';
|
|
11
|
+
import { useChatRuntime } from '../../contexts/chat-runtime-context';
|
|
12
|
+
import { BrowserWindowIcon } from '../icons-v2-generated/coding/browser-window-icon';
|
|
13
|
+
import { InlineChip } from './inline-chip';
|
|
14
|
+
import type { NavLinkAnchorComponent } from './types/component.types';
|
|
15
|
+
import { navLinkTarget } from './utils/nav-anchor-props';
|
|
16
|
+
|
|
17
|
+
export function ChatMarkdownLink({
|
|
18
|
+
anchor: Anchor,
|
|
19
|
+
href,
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
...anchorProps
|
|
23
|
+
}: {
|
|
24
|
+
anchor: NavLinkAnchorComponent;
|
|
25
|
+
href: string;
|
|
26
|
+
className?: string;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}): React.ReactElement {
|
|
29
|
+
const runtime = useChatRuntime();
|
|
30
|
+
if (!runtime || navLinkTarget(runtime, href).isNewTab) {
|
|
31
|
+
return (
|
|
32
|
+
<Anchor href={href} className={className} {...anchorProps}>
|
|
33
|
+
{children}
|
|
34
|
+
</Anchor>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return (
|
|
38
|
+
<Anchor href={href} {...anchorProps} className="no-underline">
|
|
39
|
+
<InlineChip icon={<BrowserWindowIcon />} label={children} className="hover:bg-ods-bg-hover" />
|
|
40
|
+
</Anchor>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, memo, type ReactNode, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { createCardMarkerScanner } from '../../chat-protocol/card-marker';
|
|
5
|
-
import { useChatRuntime } from '../../contexts/chat-runtime-context';
|
|
6
5
|
import Link from '../../embed-shims/next-link';
|
|
7
6
|
import { cn } from '../../utils/cn';
|
|
8
7
|
import { isToday } from '../../utils/date-utils';
|
|
@@ -16,6 +15,7 @@ import { ApprovalRequestMessage } from './approval-request-message';
|
|
|
16
15
|
import { AskDisplay } from './ask-display';
|
|
17
16
|
import { ChatAppearanceContext, useChatAppearance } from './chat-appearance-context';
|
|
18
17
|
import { ChatContextChipStrip } from './chat-context-picker';
|
|
18
|
+
import { ChatMarkdownLink } from './chat-markdown-link';
|
|
19
19
|
import {
|
|
20
20
|
CHAT_MESSAGE_FACE_PX,
|
|
21
21
|
CHAT_MESSAGE_HEADER_CLASS,
|
|
@@ -31,7 +31,6 @@ import { ContextCompactionDisplay } from './context-compaction-display';
|
|
|
31
31
|
import { BlockCard, type BlockCardProps } from './entity-cards/block-card';
|
|
32
32
|
import { ErrorMessageDisplay } from './error-message-display';
|
|
33
33
|
import { EscalationOfferMessage } from './escalation-offer-message';
|
|
34
|
-
import { InlineAppLinkChip } from './inline-app-link-chip';
|
|
35
34
|
import { remarkCardLinks } from './remark-card-links';
|
|
36
35
|
import { remarkMentionChips } from './remark-mention-chips';
|
|
37
36
|
import { remarkStripCitations } from './remark-strip-citations';
|
|
@@ -43,7 +42,6 @@ import { TicketEventMessage } from './ticket-event-message';
|
|
|
43
42
|
import { ToolExecutionDisplay } from './tool-execution-display';
|
|
44
43
|
import type { AskSegment, MessageSegment, MessageContent, ChatMessageEnhancedProps } from './types';
|
|
45
44
|
import { CHAT_APPEARANCE } from './types/chat.types';
|
|
46
|
-
import { computeIsNewTab } from './utils/nav-anchor-props';
|
|
47
45
|
|
|
48
46
|
/** Inline `@marker:id` mention token in the message body (sibling of the
|
|
49
47
|
* `[card://]` grammar) — used to filter out items rendered inline from the
|
|
@@ -409,9 +407,6 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
|
|
|
409
407
|
const renderingPlanRef = useRef(renderingPlan);
|
|
410
408
|
renderingPlanRef.current = renderingPlan;
|
|
411
409
|
|
|
412
|
-
// The runtime decides whether a link stays in this app (`computeIsNewTab`); null outside a chat runtime, where
|
|
413
|
-
// every link stays a plain link.
|
|
414
|
-
const chatRuntime = useChatRuntime();
|
|
415
410
|
const cardComponentOverrides = useMemo(() => {
|
|
416
411
|
if (!hasMarkerSupport && !hasMentionSupport) return undefined;
|
|
417
412
|
return {
|
|
@@ -452,14 +447,11 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
|
|
|
452
447
|
return <span className="text-ods-text-secondary opacity-60">{cardId}</span>;
|
|
453
448
|
}
|
|
454
449
|
}
|
|
455
|
-
//
|
|
456
|
-
//
|
|
457
|
-
// clickable surface (source chips,
|
|
458
|
-
//
|
|
459
|
-
// decision
|
|
460
|
-
// tab, in-page doc-tree path → soft swap, same-origin → soft
|
|
461
|
-
// RSC nav. Single mental model across the app, single source
|
|
462
|
-
// of truth in the hub.
|
|
450
|
+
// The host's `NavLinkAnchor` draws the link (the lib's
|
|
451
|
+
// `NavLinkAnchorViaRuntime`, or a host anchor over the same
|
|
452
|
+
// `useNavLinkViaRuntime`), so every clickable surface (source chips,
|
|
453
|
+
// inline cards, search rows, markdown links) follows the one
|
|
454
|
+
// navigation decision (`navLinkTarget`) and executor.
|
|
463
455
|
//
|
|
464
456
|
// Anchor-only links (`#section`) bypass NavLinkAnchor — the
|
|
465
457
|
// host's router would treat them as navigation, but the user
|
|
@@ -467,30 +459,12 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
|
|
|
467
459
|
//
|
|
468
460
|
// When the host has NOT supplied `NavLinkAnchor` (e.g. the
|
|
469
461
|
// flamingo hero-demo with mock content), fall back to a plain
|
|
470
|
-
// `<a href>`.
|
|
471
|
-
// not own routing decisions; the host does.
|
|
472
|
-
// A link that stays in this app is drawn as an inline box, the skin of the host's entity mentions, still
|
|
473
|
-
// routed through the host's `NavLinkAnchor`. Whether it stays is the runtime's ONE new-tab rule
|
|
474
|
-
// (`computeIsNewTab`, the decision the chat's cards and source chips make): a link it keeps in this window
|
|
475
|
-
// is a place in the app; one it sends to a new tab (another site, a hub page from an embedded chat, a
|
|
476
|
-
// `mailto:`) stays a plain link.
|
|
477
|
-
if (
|
|
478
|
-
typeof href === 'string' &&
|
|
479
|
-
!href.startsWith('#') &&
|
|
480
|
-
chatRuntime &&
|
|
481
|
-
!computeIsNewTab(chatRuntime, href, null)
|
|
482
|
-
) {
|
|
483
|
-
return (
|
|
484
|
-
<InlineAppLinkChip href={href} anchor={NavLinkAnchor}>
|
|
485
|
-
{children}
|
|
486
|
-
</InlineAppLinkChip>
|
|
487
|
-
);
|
|
488
|
-
}
|
|
462
|
+
// `<a href>`.
|
|
489
463
|
if (typeof href === 'string' && NavLinkAnchor && !href.startsWith('#')) {
|
|
490
464
|
return (
|
|
491
|
-
<NavLinkAnchor href={href} className={linkClassName} {...rest}>
|
|
465
|
+
<ChatMarkdownLink anchor={NavLinkAnchor} href={href} className={linkClassName} {...rest}>
|
|
492
466
|
{children}
|
|
493
|
-
</
|
|
467
|
+
</ChatMarkdownLink>
|
|
494
468
|
);
|
|
495
469
|
}
|
|
496
470
|
return (
|
|
@@ -504,7 +478,7 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
|
|
|
504
478
|
// streaming turn (booleans + host-stable fn/component identities, both
|
|
505
479
|
// enforced by this file's `memo` comparator). The rendering plan is
|
|
506
480
|
// read through a ref above precisely so it does NOT appear here.
|
|
507
|
-
}, [hasMarkerSupport, hasMentionSupport, renderMention, NavLinkAnchor
|
|
481
|
+
}, [hasMarkerSupport, hasMentionSupport, renderMention, NavLinkAnchor]);
|
|
508
482
|
|
|
509
483
|
/**
|
|
510
484
|
* Body of a markdown-bearing segment (`text` / `guide`).
|