@arwes/core
Framework core set of components.
It contains the main components to build an standard Arwes user interface.
It depends on the design, animation, and sounds packages.
Since the components are still development, APIs are most likely to change over the releases. It is not recommended to use them for real/production projects yet.
Installation
All the tools are bundled and can be installed with the following NPM packages:
npm install @arwes/design @arwes/animation @arwes/sounds @arwes/core
The Arwes packages require the following peer dependencies:
npm install react@17 react-dom@17 prop-types @emotion/css@11 @emotion/react@11 polished@4 animejs@3 howler@2.2
In TypeScript, the following type packages are needed:
npm install @types/react@17 @types/react-dom@17 @types/animejs@3 @types/howler@2.2
Components
The guides and API documentation for the core components is still under development.
All the available components previews and examples can be tested in the
playground sandboxes in the @arwes/core
package.
See: playground.arwes.dev.
Example
A similar example as the sandbox playground.arwes.dev/core/Figure/basic can be replicated in a local project like:
import React, { FC, useState, useEffect } from 'react';import ReactDOM from 'react-dom';import { AnimatorGeneralProvider, Animator } from '@arwes/animation';import { BleepsProvider } from '@arwes/sounds';import { ArwesThemeProvider, StylesBaseline, Text, Figure } from '@arwes/core';// For the font-family to work, you would have to setup the Google Fonts link:// <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Titillium+Web:wght@300;400;600&display=swap" />const ROOT_FONT_FAMILY = '"Titillium Web", sans-serif';const IMAGE_URL = 'https://playground.arwes.dev/assets/images/wallpaper.jpg';const SOUND_OBJECT_URL = 'https://playground.arwes.dev/assets/sounds/object.mp3';const SOUND_TYPE_URL = 'https://playground.arwes.dev/assets/sounds/type.mp3';const audioSettings = { common: { volume: 0.25 } };const playersSettings = {object: { src: [SOUND_OBJECT_URL] },type: { src: [SOUND_TYPE_URL], loop: true }};const bleepsSettings = {object: { player: 'object' },type: { player: 'type' }};const generalAnimator = { duration: { enter: 200, exit: 200 } };const App: FC = () => {const [activate, setActivate] = useState(true);useEffect(() => {const timeout = setTimeout(() => setActivate(!activate), 2000);return () => clearTimeout(timeout);}, [activate]);return (<ArwesThemeProvider><StylesBaseline styles={{ body: { fontFamily: ROOT_FONT_FAMILY } }} /><BleepsProvideraudioSettings={audioSettings}playersSettings={playersSettings}bleepsSettings={bleepsSettings}><AnimatorGeneralProvider animator={generalAnimator}><Animator animator={{ activate, manager: 'stagger' }}><Text as='h1'>Nebula</Text><Text as='p'>A nebula is an interstellar cloud of dust, hydrogen, helium andother ionized gases. Originally, the term was used to describe anydiffused astronomical object, including galaxies beyond the MilkyWay. The Andromeda Galaxy, for instance, was once referred to asthe Andromeda Nebula (and spiral galaxies in general as "spiralnebulae") before the true nature of galaxies was confirmed in theearly 20th century by Vesto Slipher, Edwin Hubble and others.</Text><Figuresrc={IMAGE_URL}alt='A nebula'>A nebula is an interstellar cloud of dust, hydrogen, helium andother ionized gases. Originally, the term was used to describeany diffused astronomical object, including galaxies beyondthe Milky Way.</Figure><Text as='p'>Most nebulae are of vast size; some are hundreds of light-years indiameter. A nebula that is visible to the human eye from Earthwould appear larger, but no brighter, from close by. The OrionNebula, the brightest nebula in the sky and occupying an areatwice the angular diameter of the full Moon, can be viewed withthe naked eye but was missed by early astronomers. Although denserthan the space surrounding them, most nebulae are far less densethan any vacuum created on Earth – a nebular cloud the size of theEarth would have a total mass of only a few kilograms.</Text></Animator></AnimatorGeneralProvider></BleepsProvider></ArwesThemeProvider>);};// Assuming there is a HTML element with id "root".ReactDOM.render(<App />, document.querySelector('#root'));
Other playground sandboxes can be replicated in a similar way.