repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
snapre/leoric
src/decorators.ts
<filename>src/decorators.ts<gh_stars>0 import Bone from './bone'; import DataType from './data_types'; import { ASSOCIATE_METADATA_MAP } from './constants'; import 'reflect-metadata'; type DataTypes<T> = { [Property in keyof T as Exclude<Property, "toSqlString">]: T[Property]; } interface ColumnOption { type?: Da...
snapre/leoric
types/index.d.ts
<filename>types/index.d.ts import DataType from './data_types'; export { DataType as DataTypes }; export * from '../src/decorators'; type DataTypes<T> = { [Property in keyof T as Exclude<Property, "toSqlString">]: T[Property] } interface ExprIdentifier { type: 'id'; value: string; qualifiers?: string[] } in...
Nsbx/YaTA
src/components/GlobalStyle.tsx
import { Classes, Colors } from '@blueprintjs/core' import { createGlobalStyle } from 'styled' import base from 'styled/base' /** * Global Style Component. */ export default createGlobalStyle` html, body, .root { height: 100%; overflow-y: hidden; } .__react_component_tooltip { &.channelToolti...
Nsbx/YaTA
src/components/ChannelDetailsSchedule.tsx
<filename>src/components/ChannelDetailsSchedule.tsx import { Classes, Colors, H6, Intent, Tag } from '@blueprintjs/core' import _ from 'lodash' import { Component, Fragment } from 'react' import { connect } from 'react-redux' import { compose } from 'recompose' import { ChannelDetailsProps } from 'components/ChannelDe...
Nsbx/YaTA
src/components/HeaderTooltip.tsx
<reponame>Nsbx/YaTA<filename>src/components/HeaderTooltip.tsx import { ITooltipProps, Position, Tooltip } from '@blueprintjs/core' import * as React from 'react' /** * HeaderTooltip Component. */ const HeaderTooltip: React.FunctionComponent<ITooltipProps> = (props) => ( <Tooltip position={Position.BOTTOM} {...prop...
Nsbx/YaTA
src/libs/Ivr.ts
<reponame>Nsbx/YaTA import _ from 'lodash' import RequestMethod from 'constants/requestMethod' /** * Ivr base API URL. */ const baseAPIUrl = 'https://api.ivr.fi' /** * YaTA API class. */ export default class Ivr { /** * Fetches emote details. * @param emoteId - The emote id. * @return The emote detai...
Nsbx/YaTA
src/utils/bugs.ts
<filename>src/utils/bugs.ts import bowser from 'bowser' /** * Automated report template filenames. */ enum ReportTemplate { Bug = '2_automated_bug_report.yml', Error = '3_automated_error_report.yml', } /** * Opens the report issue page on Github. */ export function reportBug() { openReportOnGithub(getReport...
Nsbx/YaTA
src/containers/SettingsChangelog.tsx
<filename>src/containers/SettingsChangelog.tsx import { Classes, Colors } from '@blueprintjs/core' import _ from 'lodash' import { Component } from 'react' import { connect } from 'react-redux' import SettingsView from 'components/SettingsView' import Spinner from 'components/Spinner' import { setShouldReadChangelog }...
Nsbx/YaTA
src/components/BroadcasterMenuItems.tsx
<gh_stars>10-100 import { Icon, Intent, MenuDivider, MenuItem } from '@blueprintjs/core' import _ from 'lodash' import * as React from 'react' import { connect } from 'react-redux' import Toaster from 'libs/Toaster' import Twitch, { CommercialDuration } from 'libs/Twitch' import { ApplicationState } from 'store/reduce...
Nsbx/YaTA
src/libs/Ffz.ts
<reponame>Nsbx/YaTA import _ from 'lodash' import EmotesProvider, { Emote, EmoteProviderPrefix } from 'libs/EmotesProvider' /** * Ffz base API URL. */ const baseAPIUrl = 'https://api.frankerfacez.com/v1' /** * Ffz class. */ export default class Ffz { /** * Fetches Ffz emotes for a specific channel. * @pa...
Nsbx/YaTA
src/containers/EmoteDetails.tsx
import { Card, Classes, H2, Spinner, Text } from '@blueprintjs/core' import _ from 'lodash' import * as React from 'react' import ProgressiveImage from 'react-progressive-image' import ReactTooltip from 'react-tooltip' import Dialog from 'containers/Dialog' import ExternalLink from 'components/ExternalLink' import Fle...
Nsbx/YaTA
src/libs/ChatterColor.ts
<gh_stars>10-100 import _ from 'lodash' import tinycolor from 'tinycolor2' import Logs from 'constants/logs' /** * ChatterColor class used to sanitize user colors. * This includes readability check with the background theme color. */ export default class ChatterColor { /** * Checks if two colors are equals. ...
Nsbx/YaTA
src/components/SettingsSoundControl.tsx
import { Slider } from '@blueprintjs/core' import { Component } from 'react' import styled from 'styled' import Switch from 'components/Switch' import Sound, { SoundId } from 'libs/Sound' import { SoundSettings } from 'store/ducks/settings' /** * VolumeWrapper component. */ const VolumeWrapper = styled.div` paddi...
Nsbx/YaTA
src/components/HeaderChannelState.tsx
<filename>src/components/HeaderChannelState.tsx import { Button, Classes, Colors, Icon, NavbarDivider } from '@blueprintjs/core' import _ from 'lodash' import { Component } from 'react' import HeaderTooltip from 'components/HeaderTooltip' import { SerializedRoomState } from 'libs/RoomState' import styled, { ifProp, si...
Nsbx/YaTA
src/components/Chatters.tsx
<reponame>Nsbx/YaTA<filename>src/components/Chatters.tsx import { InputGroup } from '@blueprintjs/core' import _ from 'lodash' import * as React from 'react' import { AutoSizer } from 'react-virtualized/dist/es/AutoSizer' import { List, ListRowRenderer } from 'react-virtualized/dist/es/List' import ExternalLink from '...
Nsbx/YaTA
src/components/Help.tsx
import { Alert, Button, Classes, Colors } from '@blueprintjs/core' import { Component } from 'react' import Key from 'constants/key' import styled from 'styled' /** * HelpButton component. */ const HelpButton = styled(Button)` &.${Classes.BUTTON}.${Classes.MINIMAL}, .${Classes.DARK} &.${Classes.BUTTON}.${Classes....
Nsbx/YaTA
src/components/ExternalButton.tsx
import { AnchorButton, ButtonProps } from '@blueprintjs/core' import * as React from 'react' /** * ExternalButton Component. */ const ExternalButton: React.FunctionComponent< ButtonProps<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> > = (props) => <AnchorButton target="_blank" {...props} /> e...
Nsbx/YaTA
src/constants/command.ts
import _ from 'lodash' /** * A list of known command names. */ export enum CommandName { Ban = 'ban', Block = 'block', Clear = 'clear', Emoteonly = 'emoteonly', Emoteonlyoff = 'emoteonlyoff', Followed = 'followed', Followers = 'followers', Followersoff = 'followersoff', Help = 'help', Host = 'hos...
Nsbx/YaTA
src/@types/react-flip-toolkit/index.d.ts
declare module 'react-flip-toolkit' { export interface Spring { stiffness?: number damping?: number overshootClamping?: boolean } export type SpringConfig = 'noWobble' | 'veryGentle' | 'gentle' | 'wobbly' | 'stiff' | Spring export type FlippedComponentIdFilter = string | any[] export interface ...
Nsbx/YaTA
src/libs/Bttv.ts
import _ from 'lodash' import EmotesProvider, { Emote, EmoteProviderPrefix } from 'libs/EmotesProvider' /** * Bttv base API URL. */ const baseAPIUrl = 'https://api.betterttv.net/3/cached' /** * Bttv class. */ export default class Bttv { /** * Fetches Bttv emotes & bots for a specific channel. * @param ch...
Nsbx/YaTA
src/libs/Action.ts
import _ from 'lodash' import { nanoid } from 'nanoid' import { SerializedChatter } from 'libs/Chatter' /** * RegExp used to identify a valid action text. */ const TextRegExp = /^[\w\W]+$/ /** * RegExp used to identify a valid action name. */ const NameRegExp = /^[\w\- ]+$/ /** * RegExp used to identify a vali...
Nsbx/YaTA
src/libs/Twitch.ts
<reponame>Nsbx/YaTA<filename>src/libs/Twitch.ts import * as storage from 'localforage' import _ from 'lodash' import { EmoteSets } from 'twitch-js' import RequestMethod from 'constants/requestMethod' import { getRandomString } from 'utils/crypto' import { subDays, subMonths } from 'utils/date' /** * Twitch various A...
Nsbx/YaTA
src/components/PollEditor.tsx
<reponame>Nsbx/YaTA import { Button, Checkbox, Classes, Colors, FormGroup, HTMLSelect, InputGroup, Intent, TextArea, } from '@blueprintjs/core' import copy from 'copy-to-clipboard' import _ from 'lodash' import * as React from 'react' import FlexLayout from 'components/FlexLayout' import Key from 'co...
Nsbx/YaTA
src/libs/Notice.ts
<filename>src/libs/Notice.ts import linkifyHtml from 'linkifyjs/html' import { nanoid } from 'nanoid' import Event from 'constants/event' import LogType from 'constants/logType' import { escape } from 'utils/html' /** * Notice class. */ export default class Notice implements Serializable<SerializedNotice> { /** ...
Nsbx/YaTA
src/store/ducks/settings.ts
<reponame>Nsbx/YaTA<filename>src/store/ducks/settings.ts import _ from 'lodash' import { Reducer } from 'redux' import { REHYDRATE } from 'redux-persist/lib/constants' import { ShortcutCombo, ShortcutType } from 'constants/shortcut' import Theme from 'constants/theme' import { SerializedAction } from 'libs/Action' imp...
Nsbx/YaTA
src/utils/string.ts
import _ from 'lodash' /** * RegExp used to identify the start of a word. */ const WordStartRegExp = /[\w]+$/ /** * RegExp used to identify the end of a word. */ const WordEndRegExp = /^\w+/ /** * RegExp used to identify a whitespace at the beginning of a string. */ const WhiteSpaceStartRegExp = /^\s/ /** * ...
Nsbx/YaTA
src/components/MessageContent.tsx
<reponame>Nsbx/YaTA import { Colors } from '@blueprintjs/core' import _ from 'lodash' import * as React from 'react' import LogType from 'constants/logType' import { WithNameColorProps } from 'libs/Chatter' import { HighlightColors } from 'libs/Highlight' import { SerializedMessage } from 'libs/Message' import styled,...
Nsbx/YaTA
src/utils/date.ts
<reponame>Nsbx/YaTA /** * Clones a date. * @param date - The date to clone. * @return A new instance of the date. */ function cloneDate(date: Date): Date { return new Date(date.getTime()) } /** * Removes a specified number of days to the given date. * @param date - The date to modify. * @param amount - The...
Nsbx/YaTA
src/components/ReplyReference.tsx
<filename>src/components/ReplyReference.tsx import { Colors, Icon } from '@blueprintjs/core' import _ from 'lodash' import * as React from 'react' import styled, { ifProp, theme } from 'styled' import type { SerializedMessage } from 'libs/Message' /** * Various string replacements used in the reply parent message bo...
Nsbx/YaTA
src/utils/crypto.ts
<reponame>Nsbx/YaTA import { toBase64Url } from 'utils/string' /** * Generates a cryptographically strong random string. * @param length - The string length. * @return The random string. */ export function getRandomString(length = 128): string { // Get cryptographically strong random values. const randomValue...
Nsbx/YaTA
src/components/Preview.tsx
<gh_stars>10-100 import { Card, Classes, Icon, Text } from '@blueprintjs/core' import _ from 'lodash' import { Component } from 'react' import FlexContent from 'components/FlexContent' import FlexLayout from 'components/FlexLayout' import Player from 'libs/Player' import { isResolved, Preview as ResolvedPreview, Unres...
Nsbx/YaTA
src/libs/Command.ts
import _ from 'lodash' import { CommandArgument, CommandDescriptor, CommandName, Commands } from 'constants/command' import Notice from 'libs/Notice' import { SerializedRoomState } from 'libs/RoomState' import Twitch from 'libs/Twitch' import { Log } from 'store/ducks/logs' /** * Actions that could arise when handli...
Nsbx/YaTA
src/components/ExternalLink.tsx
import * as React from 'react' /** * ExternalLink Component. */ const ExternalLink: React.FunctionComponent<React.AnchorHTMLAttributes<HTMLAnchorElement>> = ({ children, ...restProps }) => ( <a target="_blank" {...restProps}> {children} </a> ) export default ExternalLink
Nsbx/YaTA
src/libs/RejectedMessage.ts
import LogType from 'constants/logType' /** * Message rejected by AutoMod. */ export default class RejectedMessage implements Serializable<SerializedRejectedMessage> { /** * Returns the internal ID of a rejected message based on a message ID. * @param messageId - The message ID. * @return The rejected me...
Nsbx/YaTA
src/components/Wrapper.tsx
import * as React from 'react' import { HelmetProvider } from 'react-helmet-async' import { Provider } from 'react-redux' import { BrowserRouter, Route } from 'react-router-dom' import { PersistGate } from 'redux-persist/integration/react' import App from 'containers/App' import ErrorBoundary from 'containers/ErrorBou...
Nsbx/YaTA
src/components/History.tsx
import { Button, Classes, Tooltip } from '@blueprintjs/core' import _ from 'lodash' import { Component } from 'react' import { AutoSizer } from 'react-virtualized/dist/es/AutoSizer' import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/es/CellMeasurer' import { List, ListRowRenderer } from 'react-virt...
Nsbx/YaTA
src/styled/index.ts
import _ from 'lodash' import { ThemedStyledComponentsModule } from 'styled-components' import styledComponents, { createGlobalStyle as styledCreateGlobalStyle, css as styledCss, keyframes as styledKeyframes, ThemeProvider as StyledThemeProvider, withTheme as styledWithTheme, } from 'styled-components/macro' ...
Nsbx/YaTA
src/containers/Auth.tsx
<gh_stars>10-100 import { Component } from 'react' import { connect } from 'react-redux' import { RouteComponentProps, withRouter } from 'react-router' import { Redirect } from 'react-router-dom' import { compose } from 'recompose' import Spinner from 'components/Spinner' import Page from 'constants/page' import Twitc...
Nsbx/YaTA
src/store/selectors/app.ts
import _ from 'lodash' import { createSelector } from 'reselect' import { ApplicationState } from 'store/reducers' /** * Returns the app state. * @param state - The Redux state. * @return The app state. */ const getAppState = (state: ApplicationState) => state.app /** * Returns the current channel. * @param ...
HirokiMiyaoka/KalpaSith
src/types.d.ts
<reponame>HirokiMiyaoka/KalpaSith // ServiceWorker interface SW_MESSAGE { type: string, status?: boolean, message?: string, } interface SW_MESSAGE_CACHE extends SW_MESSAGE { success: number, failure: number, }
HirokiMiyaoka/KalpaSith
src/site/WebComponentsManager.ts
<reponame>HirokiMiyaoka/KalpaSith class WebComponentsManager { private static TAGS: { [ key: string ]: HTMLScriptElement } = {}; public static Exclude( ... tags: string[] ) { tags.forEach( ( tag ) => { if ( !this.TAGS[ tag ] ) { this.TAGS[ tag ] = document.createElement( 'script' ); } if ( !this.TAGS[ tag...
HirokiMiyaoka/KalpaSith
src/components/hello-world.ts
<reponame>HirokiMiyaoka/KalpaSith (class TestComponent extends HTMLElement { public static Init( tagname = 'hello-world' ) { if ( customElements.get( tagname ) ) { return; } customElements.define( tagname, this ); } constructor() { super(); const shadow = this.attachShadow( { mode: 'open' } ); const style =...
HirokiMiyaoka/KalpaSith
src/app.d.ts
<reponame>HirokiMiyaoka/KalpaSith<filename>src/app.d.ts declare const App: { script: HTMLScriptElement; main: () => KalpaSith; wait: () => Promise<void>; load: (...components: string[]) => Promise<void>; clear: (element: HTMLElement) => void; fetch: (input: RequestInfo, init?: RequestInit | unde...
HirokiMiyaoka/KalpaSith
src/site/NowLoading.ts
interface NowLoadingElement extends HTMLElement { loading: boolean; } ( ( wc ) => { wc.Init(); } )( class NowLoading extends HTMLElement implements NowLoadingElement { public static Init( tagname = 'now-loading' ) { if ( customElements.get( tagname ) ) { return; } customElements.define( tagname, this ); } constru...
HirokiMiyaoka/KalpaSith
src/site/ServiceWorker.ts
<reponame>HirokiMiyaoka/KalpaSith class ServiceWorkerClient { public static Remove() { if ( !navigator.serviceWorker ) { return Promise.reject( new Error( 'ServiceWorker disable.' ) ); } return navigator.serviceWorker.getRegistrations().then( ( registrations ) => { // Remove ServiceWorkers. return Promis...
HirokiMiyaoka/KalpaSith
src/site/index.ts
/// <reference path="./App.ts" /> /// <reference path="./KalpaSith.ts" /> /// <reference path="./ServiceWorker.ts" /> function BrowserCheck() { // This browser can use fetch if ( typeof fetch !== 'function' ) { return false; } // This browser can use <temolate> if ( !( 'content' in document.createElement( 'templa...
HirokiMiyaoka/KalpaSith
src/site/CommonMark.ts
<filename>src/site/CommonMark.ts declare class CMParser { parse(input: string): Node; } declare class CMHtmlRenderer { render(root: Node): string; } declare const commonmark: { Parser: { new(): CMParser }, HtmlRenderer: { new(): CMHtmlRenderer }, } interface CommonMarkElement extends HTMLElement { src: string; } (...
HirokiMiyaoka/KalpaSith
src/site/App.ts
<filename>src/site/App.ts const App = ( ( script: HTMLScriptElement ) => { function GetApp() { const kalpa = <KalpaSith>document.querySelector( 'kalpa-sith' ); if ( kalpa ) { app.main = () => { return kalpa; }; } return kalpa; } function Wait() { return customElements.whenDefined( 'kalpa-sith' ); } functio...
HirokiMiyaoka/KalpaSith
src/site/KalpaSith.ts
<reponame>HirokiMiyaoka/KalpaSith /// <reference path="./AppHistory.ts" /> /// <reference path="./WebComponentsManager.ts" /> // Default components. /// <reference path="./CommonMark.ts" /> /// <reference path="./NowLoading.ts" /> /// <reference path="./ScrollBox.ts" /> interface KalpaSithModule extends Renderer, HTML...
HirokiMiyaoka/KalpaSith
src/site/AppHistory.ts
interface GetParams { [ key: string ]: any } interface Renderer { render( url: string ): Promise<any>; } class AppHistory extends EventTarget { private renderer: Renderer; private spa: boolean; constructor( renderer: Renderer ) { super(); this.renderer = renderer; this.spa = typeof history.pushState === ...
HirokiMiyaoka/KalpaSith
src/site/ScrollBox.ts
<gh_stars>0 ( ( wc ) => { wc.Init(); } )( class ScrollBox extends HTMLElement { public static Init( tagname = 'scroll-box' ) { if ( customElements.get( tagname ) ) { return; } customElements.define( tagname, this ); } constructor() { super(); const shadow = this.attachShadow( { mode: 'open' } ); const styl...
thehandsomepanther/throughline
src/components/OrderEditor/OrderEditor.tsx
import * as React from 'react'; import { Dispatch } from '../../actions'; import { changeActiveShape } from '../../actions/editor'; import { addRootRepeater } from '../../actions/repeaters'; import { toggleShapeVisible } from '../../actions/shapes'; import { SidebarHeader } from '../../styles/components/SidebarHeader';...
thehandsomepanther/throughline
src/components/CanvasView/CanvasView.tsx
import * as React from 'react'; import styled from 'react-emotion'; import CanvasEditor from '../../containers/CanvasEditor'; const CanvasView = styled('div')` width: 50%; `; export default () => ( <CanvasView> <CanvasEditor /> </CanvasView> );
thehandsomepanther/throughline
src/components/LeftSidebar/LeftSidebar.tsx
<filename>src/components/LeftSidebar/LeftSidebar.tsx import * as React from 'react'; import styled from 'react-emotion'; import NewShapeEditor from '../../containers/NewShapeEditor'; import OrderEditor from '../../containers/OrderEditor'; import { COLOR_NEAR_BLACK } from '../../styles'; const LeftSidebar = styled('div...
thehandsomepanther/throughline
src/reducers/Repeaters.ts
import { Action } from '../actions'; import { RepeatersAction, RepeatersState } from '../types/repeaters'; import { uniqueRepeaterID } from '../util'; const CHARCODE_LOWERCASE_A = 97; const CHARCODE_LOWERCASE_I = 105; const CHARCODE_LOWERCASE_Z = 122; let charIndex = CHARCODE_LOWERCASE_I - CHARCODE_LOWERCASE_A + 1; c...
thehandsomepanther/throughline
src/util/index.ts
<reponame>thehandsomepanther/throughline<filename>src/util/index.ts export const rgbToHex = (r: number, g: number, b: number): string => `#${Math.floor(r) .toString(16) .padStart(2, '0')}${Math.floor(g) .toString(16) .padStart(2, '0')}${Math.floor(b) .toString(16) .padStart(2, '0')}`; let sha...
thehandsomepanther/throughline
src/components/IconButton.tsx
import * as React from 'react'; import styled from 'react-emotion'; import { mixins } from '../styles'; interface IconButtonProps extends React.HTMLProps<HTMLInputElement> { svg: string; styles?: string; }; const iconMixin = (svg: string) => ` width: 24px; height: 24px; background: url(${svg}); background...
thehandsomepanther/throughline
src/types/shapes.ts
import { ConstFormula, Formula, FunctionFormula } from './formulas'; export enum ShapesAction { UpdateUsing = 'SHAPE_UPDATE_USING', UpdateFormula = 'SHAPE_UPDATE_FORMULA', NewShape = 'SHAPE_NEW_SHAPE', DeleteShape = 'SHAPE_DELETE_SHAPE', SetValues = 'SHAPE_SET_VALUES', UpdateValues = 'SHAPE_UPDATE_VALUES',...
thehandsomepanther/throughline
src/components/NewShapeEditor/index.ts
import NewShapeEditor from './NewShapeEditor'; export default NewShapeEditor;
thehandsomepanther/throughline
src/reducers/Order.ts
import { Action } from '../actions'; import { OrderAction, OrderState } from '../types/order'; import { ShapesAction } from '../types/shapes'; import { shapesInitialState } from './Shapes'; export const orderInitialState: OrderState = Object.keys(shapesInitialState); export default ( state: OrderState = orderInitia...
thehandsomepanther/throughline
src/reducers/Editor.ts
<reponame>thehandsomepanther/throughline import { Action } from '../actions'; import { EditorAction, EditorState } from '../types/editor'; import { ShapesAction } from '../types/shapes'; import { orderInitialState } from './Order'; const initialState: EditorState = { activeShape: orderInitialState[0], shouldRedraw...
thehandsomepanther/throughline
src/components/OrderEditor/index.ts
import OrderEditor from './OrderEditor'; export default OrderEditor;
thehandsomepanther/throughline
src/components/NewShapeEditor/styles.ts
import styled from 'react-emotion'; import { COLOR_BLACK, COLOR_BLUE, COLOR_NEAR_BLACK, COLOR_NEAR_WHITE, COLOR_ORANGE, FONT_SIZE_REGULAR, FONT_STACK_MONOSPACE, mixins } from '../../styles'; export const NewShapeButtonContainer = styled('div')` width: 100%; `; export const NewShapeButton = styled('input')` ${mixi...
thehandsomepanther/throughline
src/components/Home/Home.tsx
<filename>src/components/Home/Home.tsx<gh_stars>1-10 import * as React from 'react'; import { Dispatch } from '../../actions'; import { setShapeValues } from '../../actions/shapes'; import { EditorState } from '../../types/editor'; import { OrderState } from '../../types/order'; import { RepeatersState } from '../../t...
thehandsomepanther/throughline
src/actions/order.ts
import { OrderAction } from '../types/order'; export interface UpdateOrderAction { type: OrderAction.UpdateOrder; oldIndex: number; newIndex: number; } export const updateOrder = ( oldIndex: number, newIndex: number ): UpdateOrderAction => ({ type: OrderAction.UpdateOrder, oldIndex, newIndex });
thehandsomepanther/throughline
src/middleware/Shapes.ts
<reponame>thehandsomepanther/throughline<gh_stars>1-10 import { Action } from '../actions'; import { Dispatch } from '../actions'; import { addErroneousProp, removeErroneousProp } from '../actions/editor'; import { setShapeValues, updateShapeValues } from '../actions/shapes'; import { RepeatersAction, RepeatersState } ...
thehandsomepanther/throughline
src/types/order.ts
// The order branch of the state tree keeps track of the "stack" of frames to // determine the order in which they should be rendered. This keeps an ordered // list of shapeIDs. Shapes are laid out in increasing order of "height", meaning // shapes at the end of the list appear above shapes at the beginning. export typ...
thehandsomepanther/throughline
src/reducers/Shapes.ts
import { pickBy } from 'lodash'; import { Using } from 'src/types/formulas'; import { Action } from '../actions'; import { ShapesAction, ShapesState, ShapeType } from '../types/shapes'; import makeDefaultShape from '../util/makeDefaultShape'; export const shapesInitialState: ShapesState = { rect: makeDefaultShape(Sh...
thehandsomepanther/throughline
src/reducers/index.ts
<filename>src/reducers/index.ts<gh_stars>1-10 import { combineReducers } from 'redux'; import editor from './Editor'; import order from './Order'; import repeaters from './Repeaters'; import shapes from './Shapes'; export default combineReducers({ shapes, order, editor, repeaters });
thehandsomepanther/throughline
src/components/CanvasEditor/painter.ts
<gh_stars>1-10 import { ConstFormula, FunctionFormula, FunctionValue, Using } from '../../types/formulas'; import { OrderState } from '../../types/order'; import { Repeater, RepeatersState } from '../../types/repeaters'; import { ShapesState, ShapeType } from '../../types/shapes'; import { rgbToHex } from '../../util';...
thehandsomepanther/throughline
src/components/CanvasEditor/CanvasEditor.tsx
import * as React from 'react'; import { Dispatch } from '../../actions'; import { changeActiveFrame, resetRedrawCanvases } from '../../actions/editor'; import { EditorState } from '../../types/editor'; import { OrderState } from '../../types/order'; import { RepeatersState } from '../../types/repeaters'; import { Shap...
thehandsomepanther/throughline
src/components/CanvasEditor/styles.ts
import styled from 'react-emotion'; import { COLOR_NEAR_BLACK, COLOR_NEAR_WHITE, COLOR_RED, FONT_SIZE_SMALL, FONT_STACK_MONOSPACE } from '../../styles'; export const CanvasEditorContainer = styled('div')` padding-top: 70px ; `; export const CanvasesContainer = styled('div')` position: relative; display: flex; ...
thehandsomepanther/throughline
src/components/PropertiesEditor/PropertiesEditor.tsx
<filename>src/components/PropertiesEditor/PropertiesEditor.tsx<gh_stars>1-10 import * as React from 'react'; import { Dispatch } from 'src/actions'; import { RepeatersState } from 'src/types/repeaters'; import { updateFormula, updateUsing } from '../../actions/shapes'; import { SidebarHeader } from '../../styles/compo...
thehandsomepanther/throughline
src/types/editor.ts
<reponame>thehandsomepanther/throughline import { EllipseProperties, RectProperties } from './shapes'; export enum EditorAction { RedrawCanvases = 'EDITOR_REDRAW_CANVASES', ResetRedrawCanvases = 'EDITOR_RESET_REDRAW_CANVASES', ChangeActiveShape = 'EDITOR_CHANGE_ACTIVE_SHAPE', AddErroneousProp = 'EDITOR_ADD_ERR...
thehandsomepanther/throughline
src/components/RightSidebar/RightSidebar.tsx
import * as React from 'react'; import styled from 'react-emotion'; import PropertiesEditor from '../../containers/PropertiesEditor'; import { COLOR_NEAR_BLACK } from '../../styles'; const RightSidebar = styled('div')` width: 400px; border-left: 4px solid ${COLOR_NEAR_BLACK}; `; export default () => ( <RightSid...
thehandsomepanther/throughline
src/util/makeDefaultShape.ts
import { Formula, Using } from '../types/formulas'; import { EllipseProperties, RectProperties, Shape, ShapeProperties, ShapeType, shapeTypeToProperties, } from '../types/shapes'; const defaultPropertyValues = { [ShapeType.Rect]: { posX: 250, posY: 250, width: 100, height: 100, scaleX...
thehandsomepanther/throughline
src/components/PropertiesEditor/PropertiesGraph.tsx
import { CanvasForm, CanvasSpace, Pt, Rectangle } from 'pts'; import * as React from 'react'; import { Dispatch } from '../../actions'; import { changeActiveFrame } from '../../actions/editor'; import { COLOR_BLACK, COLOR_BLUE, COLOR_GREY, COLOR_RED } from '../../styles'; import { Using } from '../../types/formulas'; ...
thehandsomepanther/throughline
src/types/repeaters.ts
<filename>src/types/repeaters.ts export enum RepeatersAction { AddRootRepeater = 'REPEATER_ADD_ROOT_REPEATER', AddChildRepeater = 'REPEATER_ADD_CHILD_REPEATER', DeleteRepeater = 'REPEATER_DELETE_REPEATER', UpdateRepeater = 'REPEATER_UPDATE_REPEATER', }; export interface Repeater { times: number; defaultVar...
thehandsomepanther/throughline
src/components/OrderEditor/styles.ts
<reponame>thehandsomepanther/throughline import styled from 'react-emotion'; import { COLOR_BLUE, COLOR_NEAR_BLACK, COLOR_NEAR_WHITE, FONT_SIZE_REGULAR, FONT_STACK_MONOSPACE, mixins } from '../../styles'; export const ShapesList = styled('ol')` display: flex; flex-direction: column; `; interface Layer...
thehandsomepanther/throughline
src/components/RepeaterEditor/index.ts
import RepeaterEditor from './RepeaterEditor'; export default RepeaterEditor;
thehandsomepanther/throughline
src/containers/PropertiesEditor.ts
import { connect } from 'react-redux'; import PropertiesEditor from '../components/PropertiesEditor'; import { EditorState } from '../types/editor'; import { RepeatersState } from '../types/repeaters'; import { ShapesState } from '../types/shapes'; import { Store } from '../types/store'; const mapStateToProps = ( s...
thehandsomepanther/throughline
src/containers/OrderEditor.ts
import { connect } from 'react-redux'; import OrderEditor from '../components/OrderEditor'; import { EditorState } from '../types/editor'; import { OrderState } from '../types/order'; import { RepeatersState } from '../types/repeaters'; import { ShapesState } from '../types/shapes'; import { Store } from '../types/sto...
thehandsomepanther/throughline
src/actions/shapes.ts
<filename>src/actions/shapes.ts import { FormulaValue, Using } from '../types/formulas'; import { EllipseProperties, RectProperties, Shape, ShapesAction, ShapeType } from '../types/shapes'; import { uniqueShapeID } from '../util'; import makeDefaultShape from '../util/makeDefaultShape'; export interface UpdateUsingAct...
thehandsomepanther/throughline
src/components/NewShapeEditor/NewShapeEditor.tsx
<filename>src/components/NewShapeEditor/NewShapeEditor.tsx import * as React from 'react'; import { Dispatch } from '../../actions'; import { addNewShape } from '../../actions/shapes'; import { ShapeType, shapeTypeToProperties } from '../../types/shapes'; import { NewShapeButton, NewShapeButtonContainer, NewShapeDropdo...
thehandsomepanther/throughline
src/components/PropertiesEditor/styles.ts
import styled from 'react-emotion'; import { COLOR_BLACK, COLOR_BLUE, COLOR_GREY, COLOR_NEAR_BLACK, COLOR_NEAR_WHITE, COLOR_YELLOW, FONT_SIZE_REGULAR, FONT_SIZE_SMALL, FONT_STACK_MONOSPACE, mixins } from '../../styles'; import { Using } from '../../types/formulas'; export const PropertiesEditorCont...
thehandsomepanther/throughline
src/store.ts
<reponame>thehandsomepanther/throughline import { applyMiddleware, createStore } from 'redux'; import { shapesMiddleware } from './middleware/Shapes'; import rootReducer from './reducers'; export default (initialState: {} = {}): any => createStore(rootReducer, initialState, applyMiddleware(shapesMiddleware));
thehandsomepanther/throughline
src/components/RepeaterEditor/styles.ts
<filename>src/components/RepeaterEditor/styles.ts<gh_stars>1-10 import styled from 'react-emotion'; import { COLOR_BLACK, COLOR_NEAR_WHITE, FONT_SIZE_SMALL, FONT_STACK_MONOSPACE, mixins } from '../../styles'; export const RepeatersContainer = styled('div')` width: 100%; display: flex; flex-direction: c...
thehandsomepanther/throughline
src/actions/editor.ts
<gh_stars>1-10 import { EditorAction } from '../types/editor'; export interface RedrawCanvasesAction { type: EditorAction.RedrawCanvases; } export const redrawCanvases = (): RedrawCanvasesAction => ({ type: EditorAction.RedrawCanvases }); export interface ResetRedrawCanvasesAction { type: EditorAction.ResetRedr...
thehandsomepanther/throughline
src/components/RepeaterEditor/RepeaterEditor.tsx
import * as React from 'react'; import { Dispatch } from '../../actions'; import { addChildRepeater, deleteRepeater, updateRepeater } from '../../actions/repeaters'; import { RepeatersState } from '../../types/repeaters'; import { Icon, IconButton } from '../IconButton'; import { RepeatersContainer, RepeatersInputConta...
thehandsomepanther/throughline
src/util/shapes.ts
<gh_stars>1-10 import { range, toNumber } from 'lodash'; import { Using } from '../types/formulas'; import { Formula } from '../types/formulas'; import { Repeater, RepeatersState } from '../types/repeaters'; import { Shape } from '../types/shapes'; const isNumberOrArrayOfNumbers = (value: any): boolean => { if (type...
thehandsomepanther/throughline
src/index.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import Home from './containers/Home'; import registerServiceWorker from './registerServiceWorker'; import configureStore from './store'; import './styles/css/fonts/stylesheet.css'; import './styles/css/reset...
thehandsomepanther/throughline
src/types/formulas.ts
<reponame>thehandsomepanther/throughline<filename>src/types/formulas.ts export enum Using { Function = 'USING_FN', Constant = 'USING_CONST', }; export interface VirtualFormula { using: Using; fn?: string; const?: string; }; // A FunctionValue is nested list of numbers. Each level of nesting corresponds to t...
thehandsomepanther/throughline
src/components/PropertiesEditor/index.ts
import PropertiesEditor from './PropertiesEditor'; export default PropertiesEditor;
thehandsomepanther/throughline
src/components/CanvasView/index.ts
import CanvasView from './CanvasView'; export default CanvasView;
thehandsomepanther/throughline
src/styles/components/SidebarHeader.tsx
<filename>src/styles/components/SidebarHeader.tsx import styled from 'react-emotion'; import { COLOR_BLACK, COLOR_GREY, FONT_SIZE_SMALL, FONT_STACK_MONOSPACE, } from '../'; export const SidebarHeader = styled('div')` display: flex; height: 40px; background-color: ${COLOR_BLACK}; color: ${COLOR_GREY}; ...
thehandsomepanther/throughline
src/actions/repeaters.ts
import { RepeatersAction } from '../types/repeaters'; export interface AddRootRepeaterAction { type: RepeatersAction.AddRootRepeater; shapeID: string; } export const addRootRepeater = (shapeID: string): AddRootRepeaterAction => ({ type: RepeatersAction.AddRootRepeater, shapeID }); export interface AddChildRep...
thehandsomepanther/throughline
src/containers/NewShapeEditor.ts
import { connect } from 'react-redux'; import NewShapeEditor from '../components/NewShapeEditor'; const mapStateToProps = (): {} => ({}); export default connect(mapStateToProps)(NewShapeEditor);
thehandsomepanther/throughline
src/types/store.ts
<filename>src/types/store.ts import { Action } from '../actions'; import { EditorState } from './editor'; import { OrderState } from './order'; import { RepeatersState } from './repeaters'; import { ShapesState } from './shapes'; export interface Store { shapes: ShapesState; order: OrderState; editor: EditorStat...
thehandsomepanther/throughline
src/actions/index.ts
import { AddErroneousPropAction, ChangeActiveFrameAction, ChangeActiveShapeAction, RedrawCanvasesAction, RemoveErroneousPropAction, ResetErroneousPropsAction, ResetRedrawCanvasesAction } from './editor'; import { UpdateOrderAction } from './order'; import { AddChildRepeaterAction, AddRootRepeaterActio...
thehandsomepanther/throughline
src/components/CanvasEditor/index.tsx
<filename>src/components/CanvasEditor/index.tsx<gh_stars>1-10 import CanvasEditor from './CanvasEditor'; export default CanvasEditor;