From 14cb9542131c1102217053e590c9ee8f36f64386 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 10 Feb 2023 21:42:27 +0100 Subject: [PATCH] themed minirepl + add strudelTheme + add lineBackground with opacity + add some missing light flags + add fallback css variables for non js context --- packages/react/src/components/MiniRepl.jsx | 12 +++- .../react/src/components/MiniRepl.module.css | 8 +-- packages/react/src/components/style.css | 4 -- packages/react/src/index.js | 1 + website/src/components/HeadCommon.astro | 27 ++++++-- website/src/docs/MiniRepl.css | 9 +++ website/src/docs/MiniRepl.jsx | 13 +++- website/src/layouts/MainLayout.astro | 2 +- website/src/pages/index.astro | 2 +- website/src/repl/Footer.jsx | 6 +- website/src/repl/Repl.css | 4 ++ website/src/repl/themes.mjs | 61 +++++++++++++++---- website/tailwind.config.cjs | 1 + 13 files changed, 116 insertions(+), 34 deletions(-) create mode 100644 website/src/docs/MiniRepl.css diff --git a/packages/react/src/components/MiniRepl.jsx b/packages/react/src/components/MiniRepl.jsx index fd803ac1..4649969a 100644 --- a/packages/react/src/components/MiniRepl.jsx +++ b/packages/react/src/components/MiniRepl.jsx @@ -13,7 +13,15 @@ import { logger } from '@strudel.cycles/core'; const getTime = () => getAudioContext().currentTime; -export function MiniRepl({ tune, hideOutsideView = false, enableKeyboard, drawTime, punchcard, canvasHeight = 200 }) { +export function MiniRepl({ + tune, + hideOutsideView = false, + enableKeyboard, + drawTime, + punchcard, + canvasHeight = 200, + theme, +}) { drawTime = drawTime || (punchcard ? [0, 4] : undefined); const evalOnMount = !!drawTime; const drawContext = useCallback( @@ -111,7 +119,7 @@ export function MiniRepl({ tune, hideOutsideView = false, enableKeyboard, drawTi {error &&
{error.message}
}
- {show && } + {show && }
{drawTime && ( * { - background: var(--background); -} diff --git a/packages/react/src/index.js b/packages/react/src/index.js index e8a4c447..40b9fa8d 100644 --- a/packages/react/src/index.js +++ b/packages/react/src/index.js @@ -6,4 +6,5 @@ export { default as useHighlighting } from './hooks/useHighlighting'; export { default as usePostMessage } from './hooks/usePostMessage'; export { default as useStrudel } from './hooks/useStrudel'; export { default as useKeydown } from './hooks/useKeydown'; +export { default as strudelTheme } from './themes/strudel-theme'; export { default as cx } from './cx'; diff --git a/website/src/components/HeadCommon.astro b/website/src/components/HeadCommon.astro index 98143374..796f96db 100644 --- a/website/src/components/HeadCommon.astro +++ b/website/src/components/HeadCommon.astro @@ -5,6 +5,8 @@ import { settings } from '../repl/themes.mjs'; const { BASE_URL } = import.meta.env; const base = BASE_URL; + +const { strudelTheme } = settings; --- @@ -28,14 +30,28 @@ const base = BASE_URL; + + + + {pwaInfo && } -