A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: carousel global styles which fixes latex rendering (#916)
Myles Scolnick8fdca3302ba6
diff --git a/frontend/src/plugins/core/registerReactComponent.tsx b/frontend/src/plugins/core/registerReactComponent.tsxindex 4cc46527ea..239ad380dd 100644--- a/frontend/src/plugins/core/registerReactComponent.tsx+++ b/frontend/src/plugins/core/registerReactComponent.tsx@@ -391,6 +391,13 @@ export function registerReactComponent<T>(plugin: IPlugin<T, unknown>): void {}// Add all stylesheets to the shadow rootshadowRoot.adoptedStyleSheets = [...styleSheetCache.values()];++ // Custom styles provided by the plugin+ if (plugin.cssStyles) {+ const style = document.createElement("style");+ style.textContent = plugin.cssStyles.join("\n");+ shadowRoot.append(style);+ }}private copyStylesFallback() {diff --git a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsxindex 299adbef59..60b7c1aa6a 100644--- a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx+++ b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx@@ -42,7 +42,7 @@ const AnyWidgetSlot = (props: IPluginProps<T, Data>) => {} = useAsyncData(async () => {const baseUrl = document.baseURI;const url = new URL(jsUrl, baseUrl).toString();- return await import(url);+ return await import(/* @vite-ignore */ url);}, []);// Mount the CSSdiff --git a/frontend/src/plugins/layout/CarouselPlugin.tsx b/frontend/src/plugins/layout/CarouselPlugin.tsxindex 57fe72103a..6a6d17d023 100644--- a/frontend/src/plugins/layout/CarouselPlugin.tsx+++ b/frontend/src/plugins/layout/CarouselPlugin.tsx@@ -14,13 +14,13 @@ import { Button } from "@/components/ui/button";import { cn } from "@/utils/cn";import { useEventListener } from "@/hooks/useEventListener";-import "swiper/css";-import "swiper/css/virtual";-import "swiper/css/keyboard";-import "swiper/css/navigation";-import "swiper/css/pagination";-import "swiper/css/scrollbar";import "./carousel.css";+import swiperCss from "swiper/css?inline";+import swiperCssVirtual from "swiper/css/virtual?inline";+import swiperCssKeyboard from "swiper/css/keyboard?inline";+import swiperCssNavigation from "swiper/css/navigation?inline";+import swiperCssPagination from "swiper/css/pagination?inline";+import swiperCssScrollbar from "swiper/css/scrollbar?inline";interface Data {index?: string | null;@@ -35,6 +35,15 @@ export class CarouselPlugin implements IStatelessPlugin<Data> {height: z.union([z.string(), z.number()]).nullish(),});+ cssStyles = [+ swiperCss,+ swiperCssVirtual,+ swiperCssKeyboard,+ swiperCssNavigation,+ swiperCssPagination,+ swiperCssScrollbar,+ ];+render(props: IStatelessPluginProps<Data>): JSX.Element {return (<CarouselComponent {...props.data}>{props.children}</CarouselComponent>@@ -64,7 +73,7 @@ const CarouselComponent = ({return (<Swiperref={el}- className="relative w-full border rounded bg-background"+ className="relative w-full border rounded bg-background mo-carousel"spaceBetween={50}style={{height: isFullscreen ? "100%" : height || "550px",diff --git a/frontend/src/plugins/layout/carousel.css b/frontend/src/plugins/layout/carousel.cssindex 5e0f54f2fa..6393bf085c 100644--- a/frontend/src/plugins/layout/carousel.css+++ b/frontend/src/plugins/layout/carousel.css@@ -1,3 +1,31 @@+.mo-carousel {+ --swiper-theme-color: hsl(var(--primary));+ --swiper-pagination-color: var(--swiper-theme-color);+ --swiper-pagination-left: auto;+ --swiper-pagination-right: 8px;+ --swiper-pagination-bottom: 8px;+ --swiper-pagination-top: auto;+ --swiper-pagination-fraction-color: inherit;+ --swiper-pagination-progressbar-bg-color: rgba(0, 0, 0, 0.25);+ --swiper-pagination-progressbar-size: 4px;+ --swiper-pagination-bullet-size: 8px;+ --swiper-pagination-bullet-width: 8px;+ --swiper-pagination-bullet-height: 8px;+ --swiper-pagination-bullet-border-radius: 50%;+ --swiper-pagination-bullet-inactive-color: #000;+ --swiper-pagination-bullet-inactive-opacity: 0.2;+ --swiper-pagination-bullet-opacity: 1;+ --swiper-pagination-bullet-horizontal-gap: 4px;+ --swiper-pagination-bullet-vertical-gap: 6px;+}++@font-face {+ font-family: "swiper-icons";+ src: url("data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEA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LdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA");+ font-weight: 400;+ font-style: normal;+}+.swiper-button-prev,.swiper-button-next {height: 100%;@@ -12,7 +40,6 @@--swiper-navigation-sides-offset: 0;--swiper-navigation-size: 20px;- --swiper-theme-color: var(--text);&.swiper-button-disabled {opacity: 0;diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.tsindex 8c83692ed2..e587d5a0ec 100644--- a/frontend/src/plugins/types.ts+++ b/frontend/src/plugins/types.ts@@ -57,6 +57,7 @@ export interface IPlugin<D = Record<string, never>,F extends PluginFunctions = {},> {+ cssStyles?: string[];/*** The html tag name to render the plugin.*/diff --git a/frontend/vite.config.mts b/frontend/vite.config.mtsindex 0569028f31..945c1cb0ad 100644--- a/frontend/vite.config.mts+++ b/frontend/vite.config.mts@@ -70,7 +70,7 @@ const htmlDevPlugin = (): Plugin => {devDoc.head.append(element);});- return devDoc.documentElement.outerHTML;+ return "<!DOCTYPE html>\n" + devDoc.documentElement.outerHTML;},};};