mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-29 04:00:09 +00:00
Initial commit of eigent-main
This commit is contained in:
commit
723df5a03e
1144 changed files with 103478 additions and 0 deletions
112
package/@stackframe/react/dist/esm/utils/browser-script.js
vendored
Normal file
112
package/@stackframe/react/dist/esm/utils/browser-script.js
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
// src/utils/browser-script.tsx
|
||||
import { SsrScript } from "../components/elements/ssr-layout-effect";
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
var script = () => {
|
||||
const attributes = ["data-joy-color-scheme", "data-mui-color-scheme", "data-theme", "data-color-scheme", "class"];
|
||||
const getColorMode = (value) => {
|
||||
if (value.includes("dark")) {
|
||||
return "dark";
|
||||
}
|
||||
if (value.includes("light")) {
|
||||
return "light";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const setTheme = (mode) => {
|
||||
let el = document.getElementById(`--stack-theme-mode`);
|
||||
if (!el) {
|
||||
el = document.createElement("style");
|
||||
el.id = `--stack-theme-mode`;
|
||||
el.innerHTML = `/* This tag is used by Stack Auth to set the theme in the browser without causing a hydration error (since React ignores additional tags in the <head>). We later use the \`html:has(head > [data-stack-theme=XYZ])\` selector to apply styles based on the theme. */`;
|
||||
document.head.appendChild(el);
|
||||
}
|
||||
el.setAttribute("data-stack-theme", mode);
|
||||
};
|
||||
const colorToRGB = (color) => {
|
||||
const temp = document.createElement("div");
|
||||
temp.style.color = color;
|
||||
document.body.appendChild(temp);
|
||||
const computedColor = getComputedStyle(temp).color;
|
||||
document.body.removeChild(temp);
|
||||
const match = computedColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||
if (match) {
|
||||
return [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const rgbToLuma = (rgb) => {
|
||||
return (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1e3;
|
||||
};
|
||||
const copyFromColorScheme = () => {
|
||||
const colorScheme = getComputedStyle(document.documentElement).getPropertyValue("color-scheme");
|
||||
if (colorScheme) {
|
||||
const mode = getColorMode(colorScheme);
|
||||
if (mode) {
|
||||
setTheme(mode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const copyFromVariables = () => {
|
||||
let backgroundColor = getComputedStyle(document.documentElement).getPropertyValue("--background");
|
||||
if (backgroundColor) {
|
||||
if (/^\d+\s\d+%\s\d+(\.\d+)?%$/.test(backgroundColor)) {
|
||||
backgroundColor = `hsl(${backgroundColor})`;
|
||||
}
|
||||
const rgb = colorToRGB(backgroundColor);
|
||||
if (rgb) {
|
||||
const luma = rgbToLuma(rgb);
|
||||
if (luma < 128) {
|
||||
setTheme("dark");
|
||||
} else {
|
||||
setTheme("light");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const copyFromAttributes = () => {
|
||||
for (const attributeName of attributes) {
|
||||
const colorTheme = document.documentElement.getAttribute(attributeName);
|
||||
if (colorTheme) {
|
||||
const mode = getColorMode(colorTheme);
|
||||
if (mode) {
|
||||
setTheme(mode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
if (copyFromColorScheme()) {
|
||||
return;
|
||||
}
|
||||
if (mutation.attributeName && attributes.includes(mutation.attributeName) && copyFromAttributes()) {
|
||||
return;
|
||||
}
|
||||
if (copyFromVariables()) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(document.documentElement, {
|
||||
attributes: true,
|
||||
attributeFilter: attributes
|
||||
});
|
||||
if (!copyFromColorScheme()) {
|
||||
if (!copyFromAttributes()) {
|
||||
copyFromVariables();
|
||||
}
|
||||
}
|
||||
};
|
||||
function BrowserScript(props) {
|
||||
return /* @__PURE__ */ jsx(SsrScript, { nonce: props.nonce, script: `(${script.toString()})()` });
|
||||
}
|
||||
export {
|
||||
BrowserScript
|
||||
};
|
||||
//# sourceMappingURL=browser-script.js.map
|
||||
1
package/@stackframe/react/dist/esm/utils/browser-script.js.map
vendored
Normal file
1
package/@stackframe/react/dist/esm/utils/browser-script.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
66
package/@stackframe/react/dist/esm/utils/constants.js
vendored
Normal file
66
package/@stackframe/react/dist/esm/utils/constants.js
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// src/utils/constants.tsx
|
||||
var FONT_SIZES = { "xs": "0.75rem", "sm": "0.875rem", "md": "1rem", "lg": "1.125rem", "xl": "1.25rem" };
|
||||
var LINE_HEIGHTS = { "xs": "1rem", "sm": "1.25rem", "md": "1.5rem", "lg": "1.75rem", "xl": "2rem" };
|
||||
var FONT_FAMILY = 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
|
||||
var PRIMARY_FONT_COLORS = { "dark": "white", "light": "black" };
|
||||
var SECONDARY_FONT_COLORS = { "dark": "#a8a8a8", "light": "#737373" };
|
||||
var SELECTED_BACKGROUND_COLORS = { "dark": "rgba(255, 255, 255, 0.1)", "light": "rgba(0, 0, 0, 0.04)" };
|
||||
var LINK_COLORS = { "dark": "#fff", "light": "#000" };
|
||||
var SHADOW = "0 1px 2px 0 rgba(0, 0, 0, 0.05)";
|
||||
var DEFAULT_THEME = {
|
||||
light: {
|
||||
background: "hsl(0 0% 100%)",
|
||||
foreground: "hsl(240 10% 3.9%)",
|
||||
card: "hsl(0 0% 100%)",
|
||||
cardForeground: "hsl(240 10% 3.9%)",
|
||||
popover: "hsl(0 0% 100%)",
|
||||
popoverForeground: "hsl(240 10% 3.9%)",
|
||||
primary: "hsl(240 5.9% 10%)",
|
||||
primaryForeground: "hsl(0 0% 98%)",
|
||||
secondary: "hsl(240 4.8% 95.9%)",
|
||||
secondaryForeground: "hsl(240 5.9% 10%)",
|
||||
muted: "hsl(240 4.8% 95.9%)",
|
||||
mutedForeground: "hsl(240 3.8% 46.1%)",
|
||||
accent: "hsl(240 4.8% 95.9%)",
|
||||
accentForeground: "hsl(240 5.9% 10%)",
|
||||
destructive: "hsl(0 84.2% 60.2%)",
|
||||
destructiveForeground: "hsl(0 0% 98%)",
|
||||
border: "hsl(240 5.9% 90%)",
|
||||
input: "hsl(240 5.9% 90%)",
|
||||
ring: "hsl(240 10% 3.9%)"
|
||||
},
|
||||
dark: {
|
||||
background: "hsl(240 10% 3.9%)",
|
||||
foreground: "hsl(0 0% 98%)",
|
||||
card: "hsl(240 10% 3.9%)",
|
||||
cardForeground: "hsl(0 0% 98%)",
|
||||
popover: "hsl(240 10% 3.9%)",
|
||||
popoverForeground: "hsl(0 0% 98%)",
|
||||
primary: "hsl(0 0% 98%)",
|
||||
primaryForeground: "hsl(240 5.9% 10%)",
|
||||
secondary: "hsl(240 3.7% 15.9%)",
|
||||
secondaryForeground: "hsl(0 0% 98%)",
|
||||
muted: "hsl(240 3.7% 15.9%)",
|
||||
mutedForeground: "hsl(240 5% 64.9%)",
|
||||
accent: "hsl(240 3.7% 15.9%)",
|
||||
accentForeground: "hsl(0 0% 98%)",
|
||||
destructive: "hsl(0 62.8% 50%)",
|
||||
destructiveForeground: "hsl(0 0% 98%)",
|
||||
border: "hsl(240 3.7% 15.9%)",
|
||||
input: "hsl(240 3.7% 15.9%)",
|
||||
ring: "hsl(240 4.9% 83.9%)"
|
||||
},
|
||||
radius: "0.5rem"
|
||||
};
|
||||
export {
|
||||
DEFAULT_THEME,
|
||||
FONT_FAMILY,
|
||||
FONT_SIZES,
|
||||
LINE_HEIGHTS,
|
||||
LINK_COLORS,
|
||||
PRIMARY_FONT_COLORS,
|
||||
SECONDARY_FONT_COLORS,
|
||||
SELECTED_BACKGROUND_COLORS,
|
||||
SHADOW
|
||||
};
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
package/@stackframe/react/dist/esm/utils/constants.js.map
vendored
Normal file
1
package/@stackframe/react/dist/esm/utils/constants.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/utils/constants.tsx"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nexport const FONT_SIZES = { 'xs': '0.75rem', 'sm': '0.875rem', 'md': '1rem', 'lg': '1.125rem', 'xl': '1.25rem' } as const;\nexport const LINE_HEIGHTS = { 'xs': '1rem', 'sm': '1.25rem', 'md': '1.5rem', 'lg': '1.75rem', 'xl': '2rem' } as const;\nexport const FONT_FAMILY = 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"';\nexport const PRIMARY_FONT_COLORS = { 'dark': 'white', 'light': 'black' } as const;\nexport const SECONDARY_FONT_COLORS = { 'dark': '#a8a8a8', 'light': '#737373' } as const;\nexport const SELECTED_BACKGROUND_COLORS = { 'dark': 'rgba(255, 255, 255, 0.1)', 'light': 'rgba(0, 0, 0, 0.04)' } as const;\nexport const LINK_COLORS = { 'dark': '#fff', 'light': '#000' } as const;\nexport const SHADOW = '0 1px 2px 0 rgba(0, 0, 0, 0.05)';\n\nexport const DEFAULT_THEME = {\n light: {\n background: 'hsl(0 0% 100%)',\n foreground: 'hsl(240 10% 3.9%)',\n card: 'hsl(0 0% 100%)',\n cardForeground: 'hsl(240 10% 3.9%)',\n popover: 'hsl(0 0% 100%)',\n popoverForeground: 'hsl(240 10% 3.9%)',\n primary: 'hsl(240 5.9% 10%)',\n primaryForeground: 'hsl(0 0% 98%)',\n secondary: 'hsl(240 4.8% 95.9%)',\n secondaryForeground: 'hsl(240 5.9% 10%)',\n muted: 'hsl(240 4.8% 95.9%)',\n mutedForeground: 'hsl(240 3.8% 46.1%)',\n accent: 'hsl(240 4.8% 95.9%)',\n accentForeground: 'hsl(240 5.9% 10%)',\n destructive: 'hsl(0 84.2% 60.2%)',\n destructiveForeground: 'hsl(0 0% 98%)',\n border: 'hsl(240 5.9% 90%)',\n input: 'hsl(240 5.9% 90%)',\n ring: 'hsl(240 10% 3.9%)',\n },\n dark: {\n background: 'hsl(240 10% 3.9%)',\n foreground: 'hsl(0 0% 98%)',\n card: 'hsl(240 10% 3.9%)',\n cardForeground: 'hsl(0 0% 98%)',\n popover: 'hsl(240 10% 3.9%)',\n popoverForeground: 'hsl(0 0% 98%)',\n primary: 'hsl(0 0% 98%)',\n primaryForeground: 'hsl(240 5.9% 10%)',\n secondary: 'hsl(240 3.7% 15.9%)',\n secondaryForeground: 'hsl(0 0% 98%)',\n muted: 'hsl(240 3.7% 15.9%)',\n mutedForeground: 'hsl(240 5% 64.9%)',\n accent: 'hsl(240 3.7% 15.9%)',\n accentForeground: 'hsl(0 0% 98%)',\n destructive: 'hsl(0 62.8% 50%)',\n destructiveForeground: 'hsl(0 0% 98%)',\n border: 'hsl(240 3.7% 15.9%)',\n input: 'hsl(240 3.7% 15.9%)',\n ring: 'hsl(240 4.9% 83.9%)',\n },\n radius: '0.5rem',\n} as const;\n"],"mappings":";AAIO,IAAM,aAAa,EAAE,MAAM,WAAW,MAAM,YAAY,MAAM,QAAQ,MAAM,YAAY,MAAM,UAAU;AACxG,IAAM,eAAe,EAAE,MAAM,QAAQ,MAAM,WAAW,MAAM,UAAU,MAAM,WAAW,MAAM,OAAO;AACpG,IAAM,cAAc;AACpB,IAAM,sBAAsB,EAAE,QAAQ,SAAS,SAAS,QAAQ;AAChE,IAAM,wBAAwB,EAAE,QAAQ,WAAW,SAAS,UAAU;AACtE,IAAM,6BAA6B,EAAE,QAAQ,4BAA4B,SAAS,sBAAsB;AACxG,IAAM,cAAc,EAAE,QAAQ,QAAQ,SAAS,OAAO;AACtD,IAAM,SAAS;AAEf,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,IACL,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,qBAAqB;AAAA,IACrB,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,uBAAuB;AAAA,IACvB,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,qBAAqB;AAAA,IACrB,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,uBAAuB;AAAA,IACvB,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,QAAQ;AACV;","names":[]}
|
||||
21
package/@stackframe/react/dist/esm/utils/url.js
vendored
Normal file
21
package/@stackframe/react/dist/esm/utils/url.js
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// src/utils/url.ts
|
||||
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
function constructRedirectUrl(redirectUrl, callbackUrlName) {
|
||||
if (typeof window === "undefined" || !window.location) {
|
||||
throw new StackAssertionError(`${callbackUrlName} option is required in a non-browser environment.`, { redirectUrl });
|
||||
}
|
||||
const retainedQueryParams = ["after_auth_return_to"];
|
||||
const currentUrl = new URL(window.location.href);
|
||||
const url = redirectUrl ? new URL(redirectUrl, window.location.href) : new URL(window.location.href);
|
||||
for (const param of retainedQueryParams) {
|
||||
if (currentUrl.searchParams.has(param)) {
|
||||
url.searchParams.set(param, currentUrl.searchParams.get(param));
|
||||
}
|
||||
}
|
||||
url.hash = "";
|
||||
return url.toString();
|
||||
}
|
||||
export {
|
||||
constructRedirectUrl
|
||||
};
|
||||
//# sourceMappingURL=url.js.map
|
||||
1
package/@stackframe/react/dist/esm/utils/url.js.map
vendored
Normal file
1
package/@stackframe/react/dist/esm/utils/url.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/utils/url.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { StackAssertionError } from \"@stackframe/stack-shared/dist/utils/errors\";\n\n\nexport function constructRedirectUrl(redirectUrl: URL | string | undefined, callbackUrlName: string) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (typeof window === 'undefined' || !window.location) {\n throw new StackAssertionError(`${callbackUrlName} option is required in a non-browser environment.`, { redirectUrl });\n }\n\n const retainedQueryParams = [\"after_auth_return_to\"];\n const currentUrl = new URL(window.location.href);\n const url = redirectUrl ? new URL(redirectUrl, window.location.href) : new URL(window.location.href);\n for (const param of retainedQueryParams) {\n if (currentUrl.searchParams.has(param)) {\n url.searchParams.set(param, currentUrl.searchParams.get(param)!);\n }\n }\n url.hash = \"\";\n return url.toString();\n}\n"],"mappings":";AAIA,SAAS,2BAA2B;AAG7B,SAAS,qBAAqB,aAAuC,iBAAyB;AAEnG,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,UAAU;AACrD,UAAM,IAAI,oBAAoB,GAAG,eAAe,qDAAqD,EAAE,YAAY,CAAC;AAAA,EACtH;AAEA,QAAM,sBAAsB,CAAC,sBAAsB;AACnD,QAAM,aAAa,IAAI,IAAI,OAAO,SAAS,IAAI;AAC/C,QAAM,MAAM,cAAc,IAAI,IAAI,aAAa,OAAO,SAAS,IAAI,IAAI,IAAI,IAAI,OAAO,SAAS,IAAI;AACnG,aAAW,SAAS,qBAAqB;AACvC,QAAI,WAAW,aAAa,IAAI,KAAK,GAAG;AACtC,UAAI,aAAa,IAAI,OAAO,WAAW,aAAa,IAAI,KAAK,CAAE;AAAA,IACjE;AAAA,EACF;AACA,MAAI,OAAO;AACX,SAAO,IAAI,SAAS;AACtB;","names":[]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue