An open source alternative to Tableau. Embeddable visual analytic
TypeScript bidatadata-analysisdata-miningdata-visualizationedak6skanarieslow-codepivot-tablereacttableautableau-alternativetypescriptvegavega-litevisualization
feat: add gallery in playground (#401)
BHznJNs0083263f986f
diff --git a/packages/playground/gallery.html b/packages/playground/gallery.htmlnew file mode 100644index 00000000..a2c68d85--- /dev/null+++ b/packages/playground/gallery.html@@ -0,0 +1,14 @@+<!DOCTYPE html>+<html lang="en" class="h-full bg-white">+ <head>+ <meta charset="UTF-8" />+ <link rel="icon" type="image/svg+xml" href="/src/assets/kanaries.ico" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Graphic Walker Gallery</title>+ <meta name="description" content="An easy to use Exploratory Data Analysis tool">+ </head>+ <body class="h-full">+ <div id="root" class="h-full dark:bg-black"></div>+ <script type="module" src="/src/gallery/index.tsx"></script>+ </body>+</html>diff --git a/packages/playground/src/gallery/components/ErrorPage.tsx b/packages/playground/src/gallery/components/ErrorPage.tsxnew file mode 100644index 00000000..f75ced4b--- /dev/null+++ b/packages/playground/src/gallery/components/ErrorPage.tsx@@ -0,0 +1 @@+export { default } from '../../examples/components/errorPage';diff --git a/packages/playground/src/gallery/components/Example.tsx b/packages/playground/src/gallery/components/Example.tsxnew file mode 100644index 00000000..08121d26--- /dev/null+++ b/packages/playground/src/gallery/components/Example.tsx@@ -0,0 +1,143 @@+import React, { useContext, useState, Fragment } from 'react';+import { Link } from 'react-router-dom';+import { Menu, Transition } from '@headlessui/react';+import { ChevronDownIcon } from '@heroicons/react/20/solid';+import { ArrowUturnLeftIcon } from '@heroicons/react/24/solid';+import { IChart, PureRenderer, GraphicWalker } from '@kanaries/graphic-walker';+import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';+import { a11yDark } from 'react-syntax-highlighter/dist/esm/styles/prism';+import { themeContext } from '../context';+import { GalleryItemOption } from './GalleryGroup';+import { specDict } from '../resources';+import { IDataSource, useFetch } from '../util';++function getResourceURL(type: 'datasets' | 'specs', name: string): string {+ if (type === 'specs') {+ return specDict[name];+ } else if (type === 'datasets') {+ return `https://pub-2422ed4100b443659f588f2382cfc7b1.r2.dev/datasets/${name}.json`;+ } else {+ throw new Error(`Unknown fetch type: "${type}".`);+ }+}++interface ExampleProps {+ title: string;+ specName: string;+ datasetName: string;+}++function classNames(...classes: string[]) {+ return classes.filter(Boolean).join(' ');+}++function Dropdown({ showMode, setShowMode }: { showMode: 'preview' | 'editor'; setShowMode: (mode: 'preview' | 'editor') => void }) {+ return (+ <div className="absolute top-4 right-4 w-56 text-right z-10">+ <Menu as="div" className="relative inline-block text-left">+ <div>+ <Menu.Button className="inline-flex w-full justify-center rounded-md px-4 py-2 text-sm font-medium bg-gray-950 text-white hover:bg-gray-800 dark:bg-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75">+ {showMode === 'preview' ? 'Preview' : 'Editor'}+ <ChevronDownIcon className="-mr-1 ml-2 h-5 w-5" aria-hidden="true" />+ </Menu.Button>+ </div>+ <Transition+ as={Fragment}+ enter="transition ease-out duration-100"+ enterFrom="transform opacity-0 scale-95"+ enterTo="transform opacity-100 scale-100"+ leave="transition ease-in duration-75"+ leaveFrom="transform opacity-100 scale-100"+ leaveTo="transform opacity-0 scale-95"+ >+ <Menu.Items className="absolute right-0 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white dark:bg-gray-900 shadow-lg ring-1 ring-black/5 focus:outline-none">+ <div className="px-1 py-1 ">+ <Menu.Item>+ {({ active }) => (+ <button+ onClick={() => setShowMode('preview')}+ className={`${+ active ? 'bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-200' : 'text-gray-700 dark:text-gray-400'+ } group flex w-full items-center rounded-md px-2 py-2 text-sm`}+ >+ Preview+ </button>+ )}+ </Menu.Item>+ <Menu.Item>+ {({ active }) => (+ <button+ onClick={() => setShowMode('editor')}+ className={`${+ active ? 'bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-200' : 'text-gray-700 dark:text-gray-400'+ } group flex w-full items-center rounded-md px-2 py-2 text-sm`}+ >+ Editor+ </button>+ )}+ </Menu.Item>+ </div>+ </Menu.Items>+ </Transition>+ </Menu>+ </div>+ );+}++function Example(props: ExampleProps) {+ const { title, specName, datasetName } = props;+ const { theme } = useContext(themeContext);+ const [showMode, setShowMode] = useState<'preview' | 'editor'>('preview');+ const datasetURL = getResourceURL('datasets', datasetName);+ const specsURL = getResourceURL('specs', specName);+ const { dataSource, fields } = useFetch<IDataSource>(datasetURL);+ const spec = useFetch<IChart[]>(specsURL);+ const chart = spec[0] as IChart;++ return (+ <div>+ <div className="flex gap-2 items-center">+ <Link to="..">+ <button+ type="button"+ className="flex items-center justify-center rounded-md px-1 py-1 transition hover:bg-zinc-900/5 dark:text-white dark:hover:bg-white/5"+ >+ <ArrowUturnLeftIcon className="h-5 w-5" />+ </button>+ </Link>+ <h2 className="text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{title}</h2>+ </div>++ <div className={classNames('relative', showMode === 'editor' ? 'mt-6 border dark:border-gray-600 rounded-md overflow-hidden' : '')}>+ <Dropdown showMode={showMode} setShowMode={setShowMode} />+ {showMode === 'preview' && (+ <>+ <PureRenderer+ className="mt-6 border dark:border-gray-600 rounded-md overflow-hidden"+ rawData={dataSource}+ visualConfig={chart.config}+ visualState={chart.encodings}+ visualLayout={chart.layout}+ appearance={theme}+ />+ <h2 className="mt-16 mb-6 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Graphic Walker JSON Specification</h2>+ <SyntaxHighlighter language="tsx" style={a11yDark}>+ {JSON.stringify(spec, null, 2)}+ </SyntaxHighlighter>+ </>+ )}++ {showMode === 'editor' && <GraphicWalker fields={fields} data={dataSource} chart={spec} appearance={theme} />}+ </div>+ </div>+ );+}++export default function ExampleWrapper(props: { options: GalleryItemOption }) {+ const { options } = props;+ return (+ <React.Suspense fallback={<p>Loading component...</p>}>+ <Example title={options.title} specName={options.id} datasetName={options.datasetName} />+ </React.Suspense>+ );+}diff --git a/packages/playground/src/gallery/components/GalleryGroup.tsx b/packages/playground/src/gallery/components/GalleryGroup.tsxnew file mode 100644index 00000000..40308f54--- /dev/null+++ b/packages/playground/src/gallery/components/GalleryGroup.tsx@@ -0,0 +1,56 @@+import { useMemo } from 'react';+import { Link, Outlet, useLocation } from 'react-router-dom';+import { imageDict } from '../resources';+import { useTheme } from '../context';++interface GalleryItemProps {+ id: string;+ title: string;+}+export type GalleryItemOption = GalleryItemProps & { datasetName: string };++function GalleryItem(props: GalleryItemProps) {+ const { id, title } = props;+ const imageURL = imageDict[id];+ const { theme } = useTheme();++ return (+ <Link to={id}>+ <div className="divide-y divide-gray-200 dark:divide-gray-800 h-full overflow-hidden rounded-lg bg-white dark:bg-gray-900 shadow group">+ <div+ className="w-full h-36 bg-cover bg-no-repeat overflow-hidden hover:bg-right-bottom"+ style={{+ backgroundImage: `url(${imageURL})`,+ transition: 'background-position 2s',+ filter: theme === 'dark' ? 'invert(1) hue-rotate(180deg)' : '',+ }}+ ></div>+ <div className="px-4 pt-2 pb-4 sm:px-6 text-sm text-gray-700 dark:text-gray-200 group-hover:underline">{title}</div>+ </div>+ </Link>+ );+}++export default function GalleryGroup(props: { title: string; path: string; items: GalleryItemProps[] }) {+ const { title, path, items } = props;+ const location = useLocation();+ const isActive = useMemo(() => {+ return location.pathname.endsWith(path) || location.pathname.endsWith(path + '/');+ }, [location.pathname, path]);++ return (+ <>+ {isActive && (+ <>+ <h2 className="mb-6 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{title}</h2>+ <div className="grid justify-between gap-y-5 gap-x-4 grid-cols-[repeat(auto-fill,minmax(16rem,1fr))] my-7">+ {items.map(({ id, title }, index) => (+ <GalleryItem key={index} id={id} title={title} />+ ))}+ </div>+ </>+ )}+ <Outlet />+ </>+ );+}diff --git a/packages/playground/src/gallery/components/ThemeToggle.tsx b/packages/playground/src/gallery/components/ThemeToggle.tsxnew file mode 100644index 00000000..c19c4c45--- /dev/null+++ b/packages/playground/src/gallery/components/ThemeToggle.tsx@@ -0,0 +1,25 @@+import { useTheme } from '../context';+import { SunIcon, MoonIcon } from '@heroicons/react/24/solid';++export const CurrentTheme = () => {+ const { theme } = useTheme();+ const iconStyle = 'h-4 dark:text-gray-200';+ const textStyle = 'text-gray-700 hover:text-gray-950 dark:text-gray-200 group gap-x-3 rounded-md p-2 text-sm font-semibold leading-6';++ return (+ <div className="flex items-center">+ {theme === 'light' && (+ <>+ <SunIcon className={iconStyle} />+ <p className={textStyle}>Light</p>+ </>+ )}+ {theme === 'dark' && (+ <>+ <MoonIcon className={iconStyle} />+ <p className={textStyle}>Dark</p>+ </>+ )}+ </div>+ );+};diff --git a/packages/playground/src/gallery/context.ts b/packages/playground/src/gallery/context.tsnew file mode 100644index 00000000..425df7fb--- /dev/null+++ b/packages/playground/src/gallery/context.ts@@ -0,0 +1,11 @@+import { createContext, useContext } from 'react';++export const themeContext = createContext<{+ theme: 'light' | 'dark';+ toggleTheme: () => void;+}>({+ theme: 'light',+ toggleTheme: () => {},+});++export const useTheme = () => useContext(themeContext);diff --git a/packages/playground/src/gallery/index.css b/packages/playground/src/gallery/index.cssnew file mode 100644index 00000000..b5c61c95--- /dev/null+++ b/packages/playground/src/gallery/index.css@@ -0,0 +1,3 @@+@tailwind base;+@tailwind components;+@tailwind utilities;diff --git a/packages/playground/src/gallery/index.tsx b/packages/playground/src/gallery/index.tsxnew file mode 100644index 00000000..ceef272d--- /dev/null+++ b/packages/playground/src/gallery/index.tsx@@ -0,0 +1,26 @@+import React from 'react';+import { createRoot } from 'react-dom/client';+import { createBrowserRouter, RouterProvider } from 'react-router-dom';+import Layout from './layout';+import { pages } from './pages';+import ErrorPage from './components/ErrorPage';+import './index.css';++export const homeRoute = '/gallery';++const root = createRoot(document.getElementById('root') as HTMLElement);++const router = createBrowserRouter([+ {+ path: homeRoute,+ element: <Layout />,+ errorElement: <ErrorPage />,+ children: pages,+ },+]);++root.render(+ <React.StrictMode>+ <RouterProvider router={router} />+ </React.StrictMode>,+);diff --git a/packages/playground/src/gallery/layout.tsx b/packages/playground/src/gallery/layout.tsxnew file mode 100644index 00000000..b8caa23b--- /dev/null+++ b/packages/playground/src/gallery/layout.tsx@@ -0,0 +1,190 @@+import { useMemo, useState, Fragment, useEffect } from 'react';+import { Link, Outlet, useLocation } from 'react-router-dom';+import { Dialog, Transition } from '@headlessui/react';+import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/solid';+import { CurrentTheme } from './components/ThemeToggle';+import { themeContext, useTheme } from './context';+import { pages } from './pages';+import { homeRoute } from '.';++interface SidebarItemProps {+ name: string;+ path: string;+}++const Logo = () => (+ <>+ <img className="h-8 w-auto" src="/kanaries.ico" alt="Kanaries Data Inc." />+ <span className="text-gray-700 dark:text-white p-2 font-semibold leading-6 select-none">Kanaries</span>+ </>+);++const SidebarItem = ({ name, path }: SidebarItemProps) => (+ <li>+ <Link+ to={path}+ className="text-gray-700 hover:bg-gray-50 hover:text-gray-950 dark:text-gray-200 dark:hover:bg-gray-800 group flex gap-x-3 rounded-md p-2 text-sm font-semibold leading-6"+ >+ {name}+ </Link>+ </li>+);++const DialogSidebar = ({ sidebarOpen, setSidebarOpen }: { sidebarOpen: boolean; setSidebarOpen: (open: boolean) => void }) => (+ <Transition.Root as={Fragment} show={sidebarOpen}>+ <Dialog className="relative z-50 lg:hidden" onClose={setSidebarOpen}>+ <Transition.Child+ as={Fragment}+ enter="ease-out duration-300"+ enterFrom="opacity-0"+ enterTo="opacity-100"+ leave="ease-in duration-200"+ leaveFrom="opacity-100"+ leaveTo="opacity-0"+ >+ <Dialog.Backdrop className="fixed inset-0 z-50 bg-gray-900/80" />+ </Transition.Child>++ <div className="fixed inset-0 flex">+ <Transition.Child+ as={Fragment}+ enter="transition ease-in-out duration-300 transform"+ enterFrom="-translate-x-full"+ enterTo="translate-x-0"+ leave="transition ease-in-out duration-300 transform"+ leaveFrom="translate-x-0"+ leaveTo="-translate-x-full"+ >+ <Dialog.Panel className="relative mr-16 flex w-full max-w-xs flex-1">+ <Transition.Child+ as={Fragment}+ enter="ease-out duration-300"+ enterFrom="opacity-0"+ enterTo="opacity-100"+ leave="ease-in duration-200"+ leaveFrom="opacity-100"+ leaveTo="opacity-0"+ >+ <div className="absolute left-full top-0 flex w-16 justify-center pt-5 duration-300 ease-in-out data-[closed]:opacity-0">+ <button type="button" className="-m-2.5 p-2.5" onClick={() => setSidebarOpen(false)}>+ <span className="sr-only">Close sidebar</span>+ <XMarkIcon className="h-6 w-6 text-white" aria-hidden="true" />+ </button>+ </div>+ </Transition.Child>++ <div className="flex grow flex-col gap-y-5 px-6 pb-2 overflow-y-auto bg-white dark:bg-gray-900">+ <div className="flex h-16 shrink-0 items-center">+ <Logo />+ </div>+ <nav className="flex flex-1 flex-col">+ <ul role="list" className="-mx-2 space-y-1">+ {pages.map((item, index) => (+ <SidebarItem key={index} {...item} />+ ))}+ </ul>+ </nav>+ </div>+ </Dialog.Panel>+ </Transition.Child>+ </div>+ </Dialog>+ </Transition.Root>+);++const StaticSidebar = () => {+ const { toggleTheme } = useTheme();+ return (+ <div className="hidden lg:fixed lg:inset-y-0 lg:z-50 lg:flex lg:w-72 lg:flex-col">+ <div className="flex grow flex-col gap-y-5 overflow-y-auto border-r border-gray-200 bg-white dark:bg-gray-900 dark:border-none px-6">+ <Link to={homeRoute}>+ <div className="flex h-16 shrink-0 items-center">+ <Logo />+ </div>+ </Link>++ <nav className="flex flex-1 flex-col">+ <ul role="list" className="flex flex-1 flex-col gap-y-7">+ <li>+ <ul role="list" className="-mx-2 space-y-1">+ {pages.map((item, index) => (+ <SidebarItem key={index} {...item} />+ ))}+ </ul>+ </li>+ <li className="-mx-6 mt-auto">+ <div+ onClick={toggleTheme}+ className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer"+ >+ <CurrentTheme />+ </div>+ </li>+ </ul>+ </nav>+ </div>+ </div>+ );+};++export default function Layout() {+ const [sidebarOpen, setSidebarOpen] = useState<boolean>(false);+ const [theme, setTheme] = useState<'light' | 'dark'>('light');+ const toggleTheme = () => setTheme(theme === 'dark' ? 'light' : 'dark');+ const route = 'gallery';+ const location = useLocation();+ const isHome = useMemo(() => {+ return location.pathname.endsWith(route) || location.pathname.endsWith(route + '/');+ }, [location.pathname]);++ useEffect(() => {+ const root = document.body;+ root.classList.toggle('dark', theme === 'dark');+ }, [theme]);++ useEffect(() => {+ const colorSchemeQuery = window.matchMedia('(prefers-color-scheme: dark)');+ const handleColorSchemeChange = (e: MediaQueryList | MediaQueryListEvent) => setTheme(e.matches ? 'dark' : 'light');+ colorSchemeQuery.addEventListener('change', handleColorSchemeChange);+ handleColorSchemeChange(colorSchemeQuery);+ }, []);++ return (+ <themeContext.Provider value={{ theme, toggleTheme }}>+ <div className="dark:bg-black">+ <DialogSidebar sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} />+ <StaticSidebar />++ <div className="sticky top-0 z-40 flex items-center gap-x-6 bg-white dark:bg-gray-900 px-4 py-4 shadow-sm sm:px-6 lg:hidden">+ <button type="button" className="-m-2.5 p-2.5 text-gray-700 dark:text-gray-400 lg:hidden" onClick={() => setSidebarOpen(true)}>+ <span className="sr-only">Open sidebar</span>+ <Bars3Icon className="h-6 w-6" aria-hidden="true" />+ </button>+ <Link className="flex-1" to={homeRoute}>+ <div className="text-md font-semibold leading-6 text-gray-900 dark:text-white">Graphic Walker</div>+ </Link>+ <div+ onClick={toggleTheme}+ className="flex items-center gap-x-4 px-4 text-sm font-semibold leading-6 text-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 rounded cursor-pointer"+ >+ <CurrentTheme />+ </div>+ </div>++ <main className="py-10 lg:pl-72">+ <div className="px-4 sm:px-6 lg:px-8">+ {isHome && (+ <>+ <h1 className="mt-2 text-3xl font-bold tracking-tight text-gray-900 dark:text-gray-200 sm:text-4xl">Graphic Walker Gallery</h1>+ <p className="mt-6 text-xl leading-8 text-gray-700 dark:text-gray-200">+ This page shows use cases with specifications for different types of charts, please click tabs left to check.+ </p>+ </>+ )}+ <Outlet />+ </div>+ </main>+ </div>+ </themeContext.Provider>+ );+}diff --git a/packages/playground/src/gallery/pages.tsx b/packages/playground/src/gallery/pages.tsxnew file mode 100644index 00000000..6910c322--- /dev/null+++ b/packages/playground/src/gallery/pages.tsx@@ -0,0 +1,116 @@+import ExampleWrapper from './components/Example';+import GalleryGroup, { GalleryItemOption } from './components/GalleryGroup';++interface SubPage {+ name: string;+ path: string;+ children: GalleryItemOption[];+}++const pagesData: SubPage[] = [+ {+ name: 'Line, Area',+ path: 'line_area',+ children: [+ {+ id: 'bike-sharing-service-line',+ title: 'Monitor the Changes of a Bike Sharing Service by Month and Year',+ datasetName: 'ds-bikesharing-service',+ },+ {+ id: 'bike-sharing-service-area',+ title: 'The Seasonal Changes of Casual and Registered Users for a Bike Sharing Service',+ datasetName: 'ds-bikesharing-service',+ },+ {+ id: 'students-service-area',+ title: 'Compare Math Performance of Male and Female Students',+ datasetName: 'ds-students-service',+ },+ {+ id: 'cars-service-line',+ title: 'Compare Miles per Gallon between Three Different Countries',+ datasetName: 'ds-cars-service',+ },+ ],+ },+ {+ name: 'Bar, Box, Rect',+ path: 'bar_box_rect',+ children: [+ {+ id: 'bike-sharing-service-bar',+ title: 'Seasonal Change of Causal Bike Sharing Users on Working Days and Weekends',+ datasetName: 'ds-bikesharing-service',+ },+ {+ id: 'carsales-service-bar',+ title: 'Compare Sales from Different Manufacturers and Different Models',+ datasetName: 'ds-carsales-service',+ },+ {+ id: 'students-service-bar',+ title: "What Affects the Students' Math Scores?",+ datasetName: 'ds-students-service',+ },+ {+ id: 'btcgold-service-box',+ title: 'Monitor the Price Change of BTC and Gold by Year',+ datasetName: 'ds-btcgold-service',+ },+ ],+ },+ {+ name: 'Scatterplot, Heatmap',+ path: 'scatterplot_heatmap',+ children: [+ {+ id: 'bike-sharing-service-circle',+ title: 'Compare the Seasonal Changes of Casual and Registered Users for a Bike Sharing Service',+ datasetName: 'ds-bikesharing-service',+ },+ {+ id: 'cars-service-heatmap',+ title: 'Show the Relationship between Horsepower, Acceleration and Miles per Gallon',+ datasetName: 'ds-cars-service',+ },+ {+ id: 'students-service-heatmap',+ title: "Monitor Students' Performance in Reading and Writing",+ datasetName: 'ds-students-service',+ },+ {+ id: 'college-service-scatterplot',+ title: 'How State Funding Model Affects U.S. Colleges',+ datasetName: 'ds-collage-service',+ },+ ],+ },+ {+ name: 'Pie, Tick, Other',+ path: 'pie_tick_other',+ children: [+ {+ id: 'carsales-service-pie',+ title: 'Compare Sales of Main Car Manufacturer',+ datasetName: 'ds-carsales-service',+ },+ {+ id: 'bike-sharing-service-table',+ title: 'Bike Sharing Service Usage Tracker',+ datasetName: 'ds-bikesharing-service',+ },+ ],+ },+];++export const pages = pagesData.map((item) => ({+ name: item.name,+ path: item.path,+ element: <GalleryGroup title={item.name} path={item.path} items={item.children} />,+ children: item.children.map((item) => ({+ name: item.id,+ path: item.id,+ element: <ExampleWrapper options={item} />,+ })),+}));diff --git a/packages/playground/src/gallery/resources.ts b/packages/playground/src/gallery/resources.tsnew file mode 100644index 00000000..b0808eaf--- /dev/null+++ b/packages/playground/src/gallery/resources.ts@@ -0,0 +1,51 @@+interface ResourceDict {+ [key: string]: string;+}++export const imageDict: ResourceDict = {+ 'bike-sharing-service-area':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-area-S1v0UHMnUW7nlBIbIrACivddXvJAtZ.png?download=1',+ 'bike-sharing-service-bar':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-bar-tdXGxv68vYVCTrmSpFbjGtXwvXaZyz.png?download=1',+ 'bike-sharing-service-circle':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-circle-vFxBrAQKCsk2srzTClyINBkBMZSmKr.png?download=1',+ 'bike-sharing-service-line':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-line-xteeOQvMJx3OLgCxjREJG4FycmWMIJ.png?download=1',+ 'bike-sharing-service-table':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-table-wapZW8CyBjaoPv9NjoxBoJW5BHCjV6.png?download=1',+ 'btcgold-service-box': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/btcgold-service-box-g2jfOCyHxdK3VKiB7YZIkTzBgEWmNM.png?download=1',+ 'cars-service-line': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/cars-service-line-IicBy6Gqltdb2K9TB9csfgni8wIq3A.png?download=1',+ 'cars-service-heatmap': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/cars-service-heatmap-8NUM5hz4yesUINOyWCPU16OGMNm4Ct.png?download=1',+ 'carsales-service-bar': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/carsales-service-bar-39OEXjUgiyzyvYBtpiM3sT4UpBwHxX.png?download=1',+ 'carsales-service-pie': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/carsales-service-pie-M6jLNO62sjdBiNvzctBCgVpMz8jIZ7.png?download=1',+ 'college-service-scatterplot':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/college-service-scatterplot-XkRnRQBLbNe33DP2o2gZwZBpkyAVBi.png?download=1',+ 'students-service-area': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/students-service-area-jfukfr8iDnhYDi6pGewJiWo5SKGzzn.png?download=1',+ 'students-service-bar': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/students-service-bar-NCnZyCKJ6QfFXfMKIQaQuVFS9yzRjF.png?download=1',+ 'students-service-heatmap':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/students-service-heatmap-kJ1zQAl4j2B9TJU0poW0rMwPz1ybEx.png?download=1',+};++export const specDict: ResourceDict = {+ 'bike-sharing-service-area':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-area-aXyfWXj3tCLWN7jhHL4UU2vDQYAkya.json?download=1',+ 'bike-sharing-service-bar':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-bar-jmAxAUSxgnt3lNIqTWTU8jZZx0zTjt.json?download=1',+ 'bike-sharing-service-circle':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-circle-SRCrXXqHRQwh6T0HfpyfwfnQ8DDC0w.json?download=1',+ 'bike-sharing-service-line':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-line-dn36B2RiBmKRkRQOfhCj0IcYbbNK82.json?download=1',+ 'bike-sharing-service-table':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/bike-sharing-service-table-h6YIPyzFBRtQTsIfSOl3yz4Odv6if7.json?download=1',+ 'btcgold-service-box': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/btcgold-service-box-xHfJ78VSN4EILmOhuUiOhAJPaV0NB4.json?download=1',+ 'cars-service-line': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/cars-service-line-Cd27pRigYmgADKbQdWUQyR3dmN3rvP.json?download=1',+ 'cars-service-heatmap': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/cars-service-heatmap-5NE50rmMaeTDSXupCuDyWv6cDRRXrt.json?download=1',+ 'carsales-service-bar': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/carsales-service-bar-ESV23TThDRsEpF9xcyjxQAZ519uctM.json?download=1',+ 'carsales-service-pie': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/carsales-service-pie-qLgMmVQyAbxfEB3mMml2jZUe0V4WD7.json?download=1',+ 'college-service-scatterplot':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/college-service-scatterplot-grnpdMnRBXo2tHq1jS79I60ni51uhO.json?download=1',+ 'students-service-area': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/students-service-area-vFMbyq6A4lo2aRqBAu3MvvA2YaabSc.json?download=1',+ 'students-service-bar': 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/students-service-bar-ZEIC3o4He01oEVfCPPFA4hP0EwhL89.json?download=1',+ 'students-service-heatmap':+ 'https://lyov3r453gmssqgy.public.blob.vercel-storage.com/students-service-heatmap-zzjnsMq9IGSMLdyzL3uxPZEX670hHY.json?download=1',+};diff --git a/packages/playground/src/gallery/util.ts b/packages/playground/src/gallery/util.tsnew file mode 100644index 00000000..bfe2b272--- /dev/null+++ b/packages/playground/src/gallery/util.ts@@ -0,0 +1,2 @@+export type { IDataSource } from '../examples/util';+export { useFetch } from '../examples/util';diff --git a/packages/playground/vercel.json b/packages/playground/vercel.jsonindex 1096a157..52259342 100644--- a/packages/playground/vercel.json+++ b/packages/playground/vercel.json@@ -1,9 +1,12 @@{- "rewrites": [- {- "source": "/examples(/.*)?",- "destination": "/examples.html"- }- ]- }-\ No newline at end of file+ "rewrites": [+ {+ "source": "/examples(/.*)?",+ "destination": "/examples.html"+ },+ {+ "source": "/gallery(/.*)?",+ "destination": "/gallery.html"+ }+ ]+}\ No newline at end of filediff --git a/packages/playground/vite.config.ts b/packages/playground/vite.config.tsindex 3f1648c4..12f5b0d2 100644--- a/packages/playground/vite.config.ts+++ b/packages/playground/vite.config.ts@@ -13,6 +13,8 @@ export default defineConfig({viteDevServer.middlewares.use(async (req, res, next) => {if (req.originalUrl.startsWith("/examples")) {req.url = "/examples.html";+ } else if (req.originalUrl.startsWith("/gallery")) {+ req.url = "/gallery.html"}next();@@ -26,6 +28,7 @@ export default defineConfig({input: {main: "index.html",examples: "examples.html",+ gallery: "gallery.html",},},},