mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 21:18:49 +00:00
Merge pull request #490 from tidalcycles/refactor-react
refactor react package
This commit is contained in:
commit
dcbe799d25
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel.cycles/react",
|
"name": "@strudel.cycles/react",
|
||||||
"version": "0.6.0",
|
"version": "0.6.3",
|
||||||
"description": "React components for strudel",
|
"description": "React components for strudel",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import strudelTheme from '../themes/strudel-theme';
|
|||||||
import './style.css';
|
import './style.css';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { autocompletion } from '@codemirror/autocomplete';
|
import { autocompletion } from '@codemirror/autocomplete';
|
||||||
import { strudelAutocomplete } from './Autocomplete';
|
//import { strudelAutocomplete } from './Autocomplete';
|
||||||
import { vim } from '@replit/codemirror-vim';
|
import { vim } from '@replit/codemirror-vim';
|
||||||
import { emacs } from '@replit/codemirror-emacs';
|
import { emacs } from '@replit/codemirror-emacs';
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import useHighlighting from '../hooks/useHighlighting.mjs';
|
|||||||
import useStrudel from '../hooks/useStrudel.mjs';
|
import useStrudel from '../hooks/useStrudel.mjs';
|
||||||
import CodeMirror6, { flash } from './CodeMirror6';
|
import CodeMirror6, { flash } from './CodeMirror6';
|
||||||
import { Icon } from './Icon';
|
import { Icon } from './Icon';
|
||||||
import styles from './MiniRepl.module.css';
|
|
||||||
import './style.css';
|
import './style.css';
|
||||||
import { logger } from '@strudel.cycles/core';
|
import { logger } from '@strudel.cycles/core';
|
||||||
import useEvent from '../hooks/useEvent.mjs';
|
import useEvent from '../hooks/useEvent.mjs';
|
||||||
@ -129,19 +128,32 @@ export function MiniRepl({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container} ref={ref}>
|
<div className="overflow-hidden rounded-t-md bg-background border border-lineHighlight" ref={ref}>
|
||||||
<div className={styles.header}>
|
<div className="flex justify-between bg-lineHighlight">
|
||||||
<div className={styles.buttons}>
|
<div className="flex">
|
||||||
<button className={cx(styles.button, started ? 'animate-pulse' : '')} onClick={() => togglePlay()}>
|
<button
|
||||||
|
className={cx(
|
||||||
|
'cursor-pointer w-16 flex items-center justify-center p-1 border-r border-lineHighlight text-foreground bg-lineHighlight hover:bg-background',
|
||||||
|
started ? 'animate-pulse' : '',
|
||||||
|
)}
|
||||||
|
onClick={() => togglePlay()}
|
||||||
|
>
|
||||||
<Icon type={started ? 'stop' : 'play'} />
|
<Icon type={started ? 'stop' : 'play'} />
|
||||||
</button>
|
</button>
|
||||||
<button className={cx(isDirty ? styles.button : styles.buttonDisabled)} onClick={() => activateCode()}>
|
<button
|
||||||
|
className={cx(
|
||||||
|
isDirty
|
||||||
|
? 'cursor-pointer w-16 flex items-center justify-center p-1 text-foreground bg-lineHighlight hover:bg-background'
|
||||||
|
: 'w-16 flex items-center justify-center p-1 opacity-50 cursor-not-allowed bg-lineHighlight',
|
||||||
|
)}
|
||||||
|
onClick={() => activateCode()}
|
||||||
|
>
|
||||||
<Icon type="refresh" />
|
<Icon type="refresh" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{error && <div className={styles.error}>{error.message}</div>}
|
{error && <div className="text-right p-1 text-sm text-red-200">{error.message}</div>}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.body}>
|
<div className="overflow-auto relative">
|
||||||
{show && <CodeMirror6 value={code} onChange={setCode} onViewChanged={setView} theme={theme} />}
|
{show && <CodeMirror6 value={code} onChange={setCode} onViewChanged={setView} theme={theme} />}
|
||||||
</div>
|
</div>
|
||||||
{drawTime && (
|
{drawTime && (
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
.container {
|
|
||||||
@apply overflow-hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
@apply flex justify-between bg-lineHighlight border-t border-l border-r border-lineHighlight rounded-t-md overflow-hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttons {
|
|
||||||
@apply flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
@apply cursor-pointer w-16 flex items-center justify-center p-1 border-r border-lineHighlight text-foreground hover:bg-background;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttonDisabled {
|
|
||||||
@apply w-16 flex items-center justify-center p-1 opacity-50 cursor-not-allowed border-r border-lineHighlight;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
|
||||||
@apply text-right p-1 text-sm text-red-200;
|
|
||||||
}
|
|
||||||
|
|
||||||
.body {
|
|
||||||
@apply overflow-auto relative;
|
|
||||||
}
|
|
||||||
@ -1,3 +1,15 @@
|
|||||||
|
:root {
|
||||||
|
--background: #222;
|
||||||
|
--lineBackground: #22222250;
|
||||||
|
--foreground: #fff;
|
||||||
|
--caret: #ffcc00;
|
||||||
|
--selection: rgba(128, 203, 196, 0.5);
|
||||||
|
--selectionMatch: #036dd626;
|
||||||
|
--lineHighlight: #00000050;
|
||||||
|
--gutterBackground: transparent;
|
||||||
|
--gutterForeground: #8a919966;
|
||||||
|
}
|
||||||
|
|
||||||
.cm-editor {
|
.cm-editor {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@ -1,7 +1,21 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {},
|
extend: {
|
||||||
|
colors: {
|
||||||
|
// codemirror-theme settings
|
||||||
|
background: 'var(--background)',
|
||||||
|
lineBackground: 'var(--lineBackground)',
|
||||||
|
foreground: 'var(--foreground)',
|
||||||
|
caret: 'var(--caret)',
|
||||||
|
selection: 'var(--selection)',
|
||||||
|
selectionMatch: 'var(--selectionMatch)',
|
||||||
|
gutterBackground: 'var(--gutterBackground)',
|
||||||
|
gutterForeground: 'var(--gutterForeground)',
|
||||||
|
gutterBorder: 'var(--gutterBorder)',
|
||||||
|
lineHighlight: 'var(--lineHighlight)',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
plugins: [],
|
plugins: [],
|
||||||
corePlugins: {
|
corePlugins: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user