mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-18 01:32:27 +00:00
docs: bring the open-source documentation into this repository (#4122)
Move the public website pages into `docs/web` beside the SDK, with
shared navigation and executable example sources in `docs/web-tests`.
The combined website is assembled by
[lancedb/docs#355](https://github.com/lancedb/docs/pull/355), with six
Enterprise replacements from
[lancedb/sophon#7681](https://github.com/lancedb/sophon/pull/7681).
This includes Function guidance, runnable Quickstarts, regenerated
snippets, production contact/demo fixes, the legacy SQL route, and the
LeRobot redirect. LeRobot remains attributed to Geneva; all 34 Geneva
pages remain in the docs repository until Function officially launches.
Materialized-view guidance follows the full rebuild refresh introduced
by #4373: local refresh writes the complete result, has no `full`
argument, supports `source_version`, and no longer requires stable row
IDs. Deployment SQL refresh options and stable-ID setup are qualified by
version/configuration. Function input guidance distinguishes ordinary
stored columns from computed inputs supported by newer deployments.
**Validation:** independently accepted local checks include 95 Python
tests (real Enterprise excluded), eight TypeScript tests, Rust
Quickstart, snippet parity, typos, deterministic assembly, Mint
validation and links/anchors/redirects. The combined baseline retains
all 181 production routes and 17 legacy redirects. Examples ran locally
against source-built Python SDK 0.40.0b13; existing GitHub workflows do
not run `docs/web-tests`. New main at `069b2f7d` is 0.41.0b0 and adds
computed Function inputs; that SDK was not exercised by the accepted
tests. Latest prose corrections receive focused site validation.
**Merge/rollout:** merge this and #7681 before #355's combined CI, which
reads producer `main`. This is migration infrastructure: section
overlays, source-owned skills and automatic versioned paired releases
remain follow-ups. The current manual publisher is transitional. Hosted
validation, a supported SDK/Enterprise release pair and a real
Enterprise walkthrough remain pending.
Production Mintlify watches `lancedb/docs:deploy-freeze`, directory
`docs`; preserve that source through review. The separate SDK GitHub
Pages reference workflow rebuilds on main merges.
**Updated-head CI (9a50f8db):**
[Typos](https://github.com/lancedb/lancedb/actions/runs/37654185443/job/112904990558),
[PR
title](https://github.com/lancedb/lancedb/actions/runs/37654179507/job/112904974595)
and
[Aikido](https://app.aikido.dev/featurebranch/scan/215386145?groupId=74229)
pass. Critical findings in the example lockfiles were patched: all Sharp
copies use 0.35.5, protobufjs 7.6.6, tar 7.5.22, quinn-proto 0.11.19,
zerovec 0.11.8 and zerovec-derive 0.11.6. The SDK's product dependencies
are unchanged. The revised lockfiles pass eight TypeScript examples,
HuggingFace decode/resize/crop/rescale/normalize plus AVIF roundtrip,
and Rust Quickstart. Aikido passing does not mean every advisory is
cleared; npm still reports 29 high and five moderate advisories in the
example dependency graph. No scanner bypass or suppression was added.
The Function prose correction passes combined/standalone Mint,
deterministic assembly, routes and assets. The revised 325-file site
checksum is
`175bec06864abb400dd292e667ba93448c0479b8359fd7bf6146afabf9040647`. This
PR remains open for independent review; further merges are on hold.
---------
Co-authored-by: Brendan Clement <brendan.clement@lancedb.com>
This commit is contained in:
co-authored by
Brendan Clement
parent
de005f1d61
commit
47b7babc08
@@ -0,0 +1,213 @@
|
||||
/**
|
||||
* Cookie consent banner + consent-gated RB2B loader for docs.lancedb.com.
|
||||
*
|
||||
* Mintlify loads every .js file in the content directory on every page, so this
|
||||
* file runs site-wide. RB2B is opt-in: its script is never requested until the
|
||||
* visitor clicks "Accept". The choice is stored in localStorage and can be
|
||||
* changed later from the "Cookie settings" footer link (any link to
|
||||
* #cookie-settings) or window.lancedbCookieConsent.open().
|
||||
*
|
||||
* GA4 and Mintlify's own analytics are NOT gated by this banner.
|
||||
*/
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
if (typeof window === "undefined" || window.lancedbCookieConsent) return;
|
||||
|
||||
// RB2B script ID: app.rb2b.com > Script, the value inside reb2b.load("...").
|
||||
var RB2B_KEY = "9NMMZHRRWYNW";
|
||||
|
||||
var STORAGE_KEY = "lancedb-cookie-consent"; // "accepted" | "rejected"
|
||||
var POLICY_URL =
|
||||
"https://242023405.fs1.hubspotusercontent-na2.net/hubfs/242023405/Website%20Documentation/privacy.pdf";
|
||||
var BANNER_ID = "lancedb-cookie-banner";
|
||||
var STYLE_ID = "lancedb-cookie-banner-style";
|
||||
var SCRIPT_ID = "rb2b-script";
|
||||
var SETTINGS_HASH = "#cookie-settings";
|
||||
|
||||
function readConsent() {
|
||||
try {
|
||||
return window.localStorage.getItem(STORAGE_KEY);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function writeConsent(value) {
|
||||
try {
|
||||
window.localStorage.setItem(STORAGE_KEY, value);
|
||||
} catch (e) {
|
||||
/* storage blocked: banner will simply reappear next visit */
|
||||
}
|
||||
}
|
||||
|
||||
function hasKey() {
|
||||
return RB2B_KEY && RB2B_KEY.indexOf("REPLACE_") !== 0;
|
||||
}
|
||||
|
||||
// ---- RB2B -----------------------------------------------------------------
|
||||
// Mirrors RB2B's official SPA guidance: remove and re-append the script on
|
||||
// every route change so each client-side navigation is recorded.
|
||||
function loadRb2b() {
|
||||
if (!hasKey() || readConsent() !== "accepted") return;
|
||||
var existing = document.getElementById(SCRIPT_ID);
|
||||
if (existing) existing.remove();
|
||||
var s = document.createElement("script");
|
||||
s.id = SCRIPT_ID;
|
||||
s.async = true;
|
||||
s.src =
|
||||
"https://ddwl4m2hdecbv.cloudfront.net/b/" + RB2B_KEY + "/" + RB2B_KEY + ".js.gz";
|
||||
document.body.appendChild(s);
|
||||
}
|
||||
|
||||
var lastPath = null;
|
||||
function onRouteChange() {
|
||||
var path = window.location.pathname + window.location.search;
|
||||
if (path === lastPath) return;
|
||||
lastPath = path;
|
||||
loadRb2b();
|
||||
}
|
||||
|
||||
function watchRoutes() {
|
||||
["pushState", "replaceState"].forEach(function (method) {
|
||||
var original = window.history[method];
|
||||
window.history[method] = function () {
|
||||
var result = original.apply(this, arguments);
|
||||
setTimeout(onRouteChange, 0);
|
||||
return result;
|
||||
};
|
||||
});
|
||||
window.addEventListener("popstate", onRouteChange);
|
||||
}
|
||||
|
||||
// ---- Banner ---------------------------------------------------------------
|
||||
var CSS = [
|
||||
"#" + BANNER_ID + "{",
|
||||
" --lcb-bg:#ffffff;--lcb-fg:#1f2328;--lcb-muted:#57606a;--lcb-border:rgba(0,0,0,.12);",
|
||||
" --lcb-accent:#FF6B35;--lcb-accent-fg:#1b0f09;--lcb-link:#B8431A;--lcb-btn2:#f3f4f6;--lcb-btn2-fg:#1f2328;",
|
||||
" position:fixed;z-index:2147483000;left:16px;bottom:16px;max-width:400px;",
|
||||
" box-sizing:border-box;padding:16px 18px;border-radius:12px;",
|
||||
" background:var(--lcb-bg);color:var(--lcb-fg);border:1px solid var(--lcb-border);",
|
||||
" box-shadow:0 8px 30px rgba(0,0,0,.12);",
|
||||
" font:14px/1.5 Inter,ui-sans-serif,system-ui,-apple-system,'Segoe UI',sans-serif;",
|
||||
"}",
|
||||
"html.dark #" + BANNER_ID + "{",
|
||||
" --lcb-bg:#161616;--lcb-fg:#e6e6e6;--lcb-muted:#a0a0a0;--lcb-border:rgba(255,255,255,.12);",
|
||||
" --lcb-btn2:#262626;--lcb-btn2-fg:#e6e6e6;--lcb-link:#FF8A5C;box-shadow:0 8px 30px rgba(0,0,0,.5);",
|
||||
"}",
|
||||
"#" + BANNER_ID + " p{margin:0 0 12px;color:var(--lcb-muted);}",
|
||||
"#" + BANNER_ID + " strong{display:block;margin-bottom:4px;color:var(--lcb-fg);font-weight:600;}",
|
||||
"#" + BANNER_ID + " a{color:var(--lcb-link);text-decoration:underline;}",
|
||||
"#" + BANNER_ID + " .lcb-actions{display:flex;gap:8px;}",
|
||||
"#" + BANNER_ID + " button{flex:1;cursor:pointer;border:0;border-radius:8px;padding:8px 12px;",
|
||||
" font:inherit;font-weight:600;}",
|
||||
"#" + BANNER_ID + " .lcb-reject{background:var(--lcb-btn2);color:var(--lcb-btn2-fg);}",
|
||||
"#" + BANNER_ID + " .lcb-accept{background:var(--lcb-accent);color:var(--lcb-accent-fg);}",
|
||||
"#" + BANNER_ID + " button:focus-visible{outline:2px solid var(--lcb-accent);outline-offset:2px;}",
|
||||
"@media (max-width:480px){#" + BANNER_ID + "{left:16px;right:16px;max-width:none;}}",
|
||||
"@media print{#" + BANNER_ID + "{display:none;}}",
|
||||
].join("\n");
|
||||
|
||||
function injectStyles() {
|
||||
if (document.getElementById(STYLE_ID)) return;
|
||||
var style = document.createElement("style");
|
||||
style.id = STYLE_ID;
|
||||
style.textContent = CSS;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
|
||||
function closeBanner() {
|
||||
var el = document.getElementById(BANNER_ID);
|
||||
if (el) el.remove();
|
||||
}
|
||||
|
||||
function choose(value) {
|
||||
var previous = readConsent();
|
||||
writeConsent(value);
|
||||
closeBanner();
|
||||
if (value === "accepted") {
|
||||
lastPath = window.location.pathname + window.location.search;
|
||||
loadRb2b();
|
||||
} else if (previous === "accepted") {
|
||||
// RB2B may already be running in this tab; reload so it stops.
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function openBanner() {
|
||||
if (document.getElementById(BANNER_ID)) return;
|
||||
injectStyles();
|
||||
|
||||
var el = document.createElement("div");
|
||||
el.id = BANNER_ID;
|
||||
el.setAttribute("role", "dialog");
|
||||
el.setAttribute("aria-live", "polite");
|
||||
el.setAttribute("aria-labelledby", BANNER_ID + "-title");
|
||||
el.innerHTML =
|
||||
'<p><strong id="' + BANNER_ID + '-title">Cookies on LanceDB Docs</strong>' +
|
||||
"With your permission, we use a third-party service (RB2B) that sets cookies " +
|
||||
"to help us understand which companies and people visit our docs. " +
|
||||
"Nothing loads unless you accept. " +
|
||||
'<a href="' + POLICY_URL + '" target="_blank" rel="noopener">Privacy policy</a></p>' +
|
||||
'<div class="lcb-actions">' +
|
||||
'<button type="button" class="lcb-reject">Decline</button>' +
|
||||
'<button type="button" class="lcb-accept">Accept</button>' +
|
||||
"</div>";
|
||||
|
||||
el.querySelector(".lcb-reject").addEventListener("click", function () {
|
||||
choose("rejected");
|
||||
});
|
||||
el.querySelector(".lcb-accept").addEventListener("click", function () {
|
||||
choose("accepted");
|
||||
});
|
||||
|
||||
document.body.appendChild(el);
|
||||
}
|
||||
|
||||
// Any link to #cookie-settings (e.g. the footer link) reopens the banner.
|
||||
function watchSettingsLinks() {
|
||||
document.addEventListener(
|
||||
"click",
|
||||
function (event) {
|
||||
var link = event.target && event.target.closest && event.target.closest("a[href]");
|
||||
if (!link) return;
|
||||
var href = link.getAttribute("href") || "";
|
||||
if (href.slice(-SETTINGS_HASH.length) !== SETTINGS_HASH) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
openBanner();
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// ---- Init -----------------------------------------------------------------
|
||||
window.lancedbCookieConsent = {
|
||||
open: openBanner,
|
||||
get: readConsent,
|
||||
reset: function () {
|
||||
try {
|
||||
window.localStorage.removeItem(STORAGE_KEY);
|
||||
} catch (e) {}
|
||||
openBanner();
|
||||
},
|
||||
};
|
||||
|
||||
function init() {
|
||||
watchRoutes();
|
||||
watchSettingsLinks();
|
||||
var consent = readConsent();
|
||||
if (consent === "accepted") {
|
||||
onRouteChange();
|
||||
} else if (consent !== "rejected") {
|
||||
openBanner();
|
||||
}
|
||||
if (window.location.hash === SETTINGS_HASH) openBanner();
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user