feat: auto styles
This commit is contained in:
parent
ec4e72c54a
commit
7f1180083f
|
@ -45,6 +45,11 @@ module.exports = {
|
||||||
const testEntry = neutrino.config.entry('test').clear();
|
const testEntry = neutrino.config.entry('test').clear();
|
||||||
testPaths.forEach((path) => testEntry.add(path));
|
testPaths.forEach((path) => testEntry.add(path));
|
||||||
}
|
}
|
||||||
|
const cssPaths = glob.sync('./src/**/*.{css,scss}');
|
||||||
|
if (cssPaths.length > 0) {
|
||||||
|
const cssEntry = neutrino.config.entry('index.css').clear();
|
||||||
|
cssPaths.forEach((path) => cssEntry.add(path));
|
||||||
|
}
|
||||||
neutrino.options.output = '.';
|
neutrino.options.output = '.';
|
||||||
react({
|
react({
|
||||||
clean: false,
|
clean: false,
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
import flatten from 'lodash.flatten';
|
|
||||||
|
|
||||||
import BinaryResourceRenderer from './renderers/binary';
|
|
||||||
import ImageResourceRenderer from './renderers/image';
|
|
||||||
import TextResourceRenderer from './renderers/text';
|
|
||||||
|
|
||||||
export {default as Number} from './components/number';
|
|
||||||
export {default as Range, rangePropType} from './components/range';
|
|
||||||
export {default as Vector, vectorPropType} from './components/vector';
|
|
||||||
export {default as VectorRange, vectorRangePropType} from './components/vector-range';
|
|
||||||
export {default as Stage} from './stage';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
hooks: {
|
|
||||||
'@latus/core/starting': async (latus) => {
|
|
||||||
const Renderers = flatten(await latus.invokeOrdered('@persea/core/resource-renderers'));
|
|
||||||
Renderers.push(
|
|
||||||
ImageResourceRenderer,
|
|
||||||
TextResourceRenderer,
|
|
||||||
BinaryResourceRenderer,
|
|
||||||
);
|
|
||||||
const Renderer = (uri) => Renderers.find(({matcher}) => uri.match(matcher)).Component;
|
|
||||||
latus.set('%resource-renderers', Renderer);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,5 +1,3 @@
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PropTypes,
|
PropTypes,
|
||||||
React,
|
React,
|
|
@ -1,5 +1,3 @@
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PropTypes,
|
PropTypes,
|
||||||
React,
|
React,
|
|
@ -1,5 +1,3 @@
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import {Renderer} from '@avocado/graphics';
|
import {Renderer} from '@avocado/graphics';
|
||||||
import {
|
import {
|
||||||
PropTypes,
|
PropTypes,
|
|
@ -1,5 +1,3 @@
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PropTypes,
|
PropTypes,
|
||||||
React,
|
React,
|
|
@ -1,6 +1,8 @@
|
||||||
import './index.scss';
|
import {
|
||||||
|
PropTypes,
|
||||||
|
React,
|
||||||
|
} from '@latus/react';
|
||||||
|
|
||||||
import {PropTypes, React} from '@latus/react';
|
|
||||||
import Number from '../number';
|
import Number from '../number';
|
||||||
|
|
||||||
const Vector = ({
|
const Vector = ({
|
|
@ -1,5 +1,15 @@
|
||||||
|
import flatten from 'lodash.flatten';
|
||||||
|
|
||||||
|
import BinaryResourceRenderer from './resource-renderers/binary';
|
||||||
|
import ImageResourceRenderer from './resource-renderers/image';
|
||||||
|
import TextResourceRenderer from './resource-renderers/text';
|
||||||
import {projects, user} from './state';
|
import {projects, user} from './state';
|
||||||
|
|
||||||
|
export {default as Number} from './components/number';
|
||||||
|
export {default as Range, rangePropType} from './components/range';
|
||||||
|
export {default as Vector, vectorPropType} from './components/vector';
|
||||||
|
export {default as VectorRange, vectorRangePropType} from './components/vector-range';
|
||||||
|
export {default as Stage} from './components/stage';
|
||||||
export {default as ProjectContext} from './context/project';
|
export {default as ProjectContext} from './context/project';
|
||||||
export {default as UriContext} from './context/uri';
|
export {default as UriContext} from './context/uri';
|
||||||
export {default as useProject} from './hooks/use-project';
|
export {default as useProject} from './hooks/use-project';
|
||||||
|
@ -11,6 +21,16 @@ export default {
|
||||||
'@latus/core/config': () => ({
|
'@latus/core/config': () => ({
|
||||||
'resource-renderers': [],
|
'resource-renderers': [],
|
||||||
}),
|
}),
|
||||||
|
'@latus/core/starting': async (latus) => {
|
||||||
|
const Renderers = flatten(await latus.invokeOrdered('@persea/core/resource-renderers'));
|
||||||
|
Renderers.push(
|
||||||
|
ImageResourceRenderer,
|
||||||
|
TextResourceRenderer,
|
||||||
|
BinaryResourceRenderer,
|
||||||
|
);
|
||||||
|
const Renderer = (uri) => Renderers.find(({matcher}) => uri.match(matcher)).Component;
|
||||||
|
latus.set('%resource-renderers', Renderer);
|
||||||
|
},
|
||||||
'@latus/redux/slices': () => ({
|
'@latus/redux/slices': () => ({
|
||||||
projects,
|
projects,
|
||||||
user,
|
user,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import './index.scss';
|
import {
|
||||||
|
PropTypes,
|
||||||
import {PropTypes, React} from '@latus/react';
|
React,
|
||||||
|
} from '@latus/react';
|
||||||
import HexEditor from 'react-hex-editor';
|
import HexEditor from 'react-hex-editor';
|
||||||
import oneDarkPro from 'react-hex-editor/themes/oneDarkPro';
|
import oneDarkPro from 'react-hex-editor/themes/oneDarkPro';
|
||||||
|
|
||||||
|
@ -32,8 +33,16 @@ export default class BinaryResourceRenderer {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static encode(buffer) {
|
||||||
|
return buffer.toString('base64');
|
||||||
|
}
|
||||||
|
|
||||||
static get matcher() {
|
static get matcher() {
|
||||||
return /.*/;
|
return /.*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static decode(encoded) {
|
||||||
|
return Buffer.from(encoded, 'base64');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
import './index.scss';
|
import {
|
||||||
|
PropTypes,
|
||||||
import {PropTypes, React} from '@latus/react';
|
React,
|
||||||
|
} from '@latus/react';
|
||||||
|
|
||||||
const ImageRendererComponent = ({buffer}) => (
|
const ImageRendererComponent = ({buffer}) => (
|
||||||
<div className="image-renderer">
|
<div className="image-renderer">
|
|
@ -1,6 +1,7 @@
|
||||||
import './index.scss';
|
import {
|
||||||
|
PropTypes,
|
||||||
import {PropTypes, React} from '@latus/react';
|
React,
|
||||||
|
} from '@latus/react';
|
||||||
|
|
||||||
const TextRendererComponent = ({buffer}) => (
|
const TextRendererComponent = ({buffer}) => (
|
||||||
<div className="text-renderer">{buffer.toString()}</div>
|
<div className="text-renderer">{buffer.toString()}</div>
|
|
@ -1 +1,5 @@
|
||||||
module.exports = require('../../config/.neutrinorc');
|
module.exports = require('../../config/.neutrinorc');
|
||||||
|
|
||||||
|
module.exports.use.push((neutrino) => {
|
||||||
|
neutrino.config.entry('index.css').prepend('react-tabs/style/react-tabs.scss');
|
||||||
|
});
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
import 'react-tabs/style/react-tabs.css';
|
|
||||||
|
|
||||||
import {basename, extname} from 'path';
|
|
||||||
|
|
||||||
import {camelCase} from '@latus/core';
|
|
||||||
|
|
||||||
import EntityRenderer from '../entity-renderer';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
hooks: {
|
|
||||||
'@latus/core/starting': async (latus) => {
|
|
||||||
const TraitRenderers = latus.invokeReduce('@persea/entity/trait-renderers');
|
|
||||||
latus.set('%trait-renderers', TraitRenderers);
|
|
||||||
},
|
|
||||||
'@persea/core/resource-renderers': () => [
|
|
||||||
EntityRenderer,
|
|
||||||
],
|
|
||||||
'@persea/entity/trait-renderers': () => {
|
|
||||||
const context = require.context('../trait-renderers', false, /\.jsx$/);
|
|
||||||
return context.keys().reduce((r, key) => ({
|
|
||||||
...r,
|
|
||||||
[camelCase(basename(key, extname(key)))]: context(key).default,
|
|
||||||
}), {});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import {basename, extname} from 'path';
|
||||||
|
|
||||||
|
import {camelCase} from '@latus/core';
|
||||||
|
|
||||||
|
import EntityRenderer from './resource-renderers/entity';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
hooks: {
|
||||||
|
'@latus/core/starting': async (latus) => {
|
||||||
|
const TraitRenderers = latus.invokeReduce('@persea/entity/trait-renderers');
|
||||||
|
latus.set('%trait-renderers', TraitRenderers);
|
||||||
|
},
|
||||||
|
'@persea/core/resource-renderers': () => [
|
||||||
|
EntityRenderer,
|
||||||
|
],
|
||||||
|
'@persea/entity/trait-renderers': () => {
|
||||||
|
const context = require.context('./trait-renderers', false, /\.jsx$/);
|
||||||
|
return context.keys().reduce((r, key) => ({
|
||||||
|
...r,
|
||||||
|
[camelCase(basename(key, extname(key)))]: context(key).default,
|
||||||
|
}), {});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,8 +1,9 @@
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {PropTypes, React} from '@latus/react';
|
import {
|
||||||
|
PropTypes,
|
||||||
|
React,
|
||||||
|
} from '@latus/react';
|
||||||
import {
|
import {
|
||||||
Tab,
|
Tab,
|
||||||
Tabs,
|
Tabs,
|
|
@ -1,5 +1,3 @@
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import {Rectangle, Vector} from '@avocado/math';
|
import {Rectangle, Vector} from '@avocado/math';
|
||||||
import {
|
import {
|
||||||
PropTypes,
|
PropTypes,
|
||||||
|
@ -7,7 +5,7 @@ import {
|
||||||
useEffect,
|
useEffect,
|
||||||
useState,
|
useState,
|
||||||
} from '@latus/react';
|
} from '@latus/react';
|
||||||
import {Stage} from '@persea/core/client';
|
import {Stage} from '@persea/core';
|
||||||
|
|
||||||
const EntityStage = ({entity}) => {
|
const EntityStage = ({entity}) => {
|
||||||
const [size, setSize] = useState([0, 0]);
|
const [size, setSize] = useState([0, 0]);
|
|
@ -1,5 +1,3 @@
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {Trait as BaseTrait} from '@avocado/traits';
|
import {Trait as BaseTrait} from '@avocado/traits';
|
|
@ -1,8 +1,9 @@
|
||||||
import './index.scss';
|
import {
|
||||||
|
PropTypes,
|
||||||
|
React,
|
||||||
|
} from '@latus/react';
|
||||||
|
|
||||||
import {PropTypes, React} from '@latus/react';
|
import useEntity from '../../../hooks/use-entity';
|
||||||
|
|
||||||
import useEntity from '../../hooks/use-entity';
|
|
||||||
import EntityStage from '../stage';
|
import EntityStage from '../stage';
|
||||||
|
|
||||||
const View = ({json}) => {
|
const View = ({json}) => {
|
|
@ -1,5 +1,3 @@
|
||||||
import './emitted.scss';
|
|
||||||
|
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -13,7 +11,7 @@ import {
|
||||||
rangePropType,
|
rangePropType,
|
||||||
VectorRange,
|
VectorRange,
|
||||||
vectorRangePropType,
|
vectorRangePropType,
|
||||||
} from '@persea/core/client';
|
} from '@persea/core';
|
||||||
import {useJsonPatcher} from '@persea/json';
|
import {useJsonPatcher} from '@persea/json';
|
||||||
|
|
||||||
const Emitted = ({json, path}) => {
|
const Emitted = ({json, path}) => {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import './emitter.scss';
|
|
||||||
|
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {PropTypes, React} from '@latus/react';
|
import {PropTypes, React} from '@latus/react';
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
import './particle.scss';
|
|
||||||
|
|
||||||
import {EntityListView} from '@avocado/entity';
|
import {EntityListView} from '@avocado/entity';
|
||||||
import {
|
import {
|
||||||
PropTypes,
|
PropTypes,
|
||||||
React,
|
React,
|
||||||
useLatus,
|
useLatus,
|
||||||
} from '@latus/react';
|
} from '@latus/react';
|
||||||
import {Number, Stage} from '@persea/core/client';
|
import {Number, Stage} from '@persea/core';
|
||||||
import {useJsonPatcher} from '@persea/json';
|
import {useJsonPatcher} from '@persea/json';
|
||||||
|
|
||||||
import Entity from '../../entity-renderer';
|
import Entity from '../../resource-renderers/entity';
|
||||||
import useEntity from '../../hooks/use-entity';
|
import useEntity from '../../hooks/use-entity';
|
||||||
|
|
||||||
const emitterJson = {
|
const emitterJson = {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import './existent.scss';
|
|
||||||
|
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {PropTypes, React} from '@latus/react';
|
import {PropTypes, React} from '@latus/react';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user