Skip to content

Commit

Permalink
refactor: 馃挕 move canvas property from deck decl to constructor
Browse files Browse the repository at this point in the history
Deck constructor accepts a canvas property as a separate argument now,
instead of passing it through deck declaration

BREAKING CHANGE: 馃Ж DeckDeclaration no longer accepts canvas property. Instead, it must go
into Deck constructor as a separate argument.
  • Loading branch information
ghaiklor committed May 9, 2020
1 parent f595679 commit 104953f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
9 changes: 0 additions & 9 deletions packages/kittik-deck/spec/Deck.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Deck, DeckDeclaration } from '../src/Deck';
import { Shape, ShapeRenderable } from 'kittik-shape-basic';
import { Animationable } from 'kittik-animation-basic';
import { Canvas } from 'terminal-canvas';
import { Print } from 'kittik-animation-print';
import { Slide } from 'kittik-slide';

const DECK_DECLARATION: DeckDeclaration = {
canvas: Canvas.create(),
shapes: [
{
name: 'Global Shape',
Expand Down Expand Up @@ -143,7 +141,6 @@ describe('deck', () => {
expect.hasAssertions();

const deck = new Deck({
canvas: DECK_DECLARATION.canvas,
slides: [
{
name: 'Test',
Expand Down Expand Up @@ -175,7 +172,6 @@ describe('deck', () => {
expect.hasAssertions();

const deck = new Deck({
canvas: DECK_DECLARATION.canvas,
slides: [{ name: 'Test', shapes: [], order: [] }]
});

Expand All @@ -200,7 +196,6 @@ describe('deck', () => {

const shape: ShapeRenderable = new Shape();
const deck = new Deck({
canvas: DECK_DECLARATION.canvas,
slides: [
{
name: 'Test',
Expand All @@ -225,7 +220,6 @@ describe('deck', () => {

const shape: ShapeRenderable = new Shape();
const deck = new Deck({
canvas: DECK_DECLARATION.canvas,
slides: [
{
name: 'Test',
Expand All @@ -250,7 +244,6 @@ describe('deck', () => {

const animation: Animationable = new Print();
const deck = new Deck({
canvas: DECK_DECLARATION.canvas,
slides: [
{
name: 'Test',
Expand All @@ -276,7 +269,6 @@ describe('deck', () => {

const animation: Animationable = new Print();
const deck = new Deck({
canvas: DECK_DECLARATION.canvas,
slides: [
{
name: 'Test',
Expand All @@ -301,7 +293,6 @@ describe('deck', () => {
expect.hasAssertions();

const deck = new Deck({
canvas: DECK_DECLARATION.canvas,
slides: [
{
name: 'Slide #1',
Expand Down
6 changes: 3 additions & 3 deletions packages/kittik-deck/src/Deck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export class Deck extends EventEmitter {
private isRendering = false;
private currentSlideIndex = 0;

public constructor (declaration?: DeckDeclaration) {
public constructor (declaration?: DeckDeclaration, canvas?: Canvas) {
super();

if (typeof declaration?.canvas !== 'undefined') {
this.canvas = declaration.canvas;
if (typeof canvas !== 'undefined') {
this.canvas = canvas;
}

if (typeof declaration !== 'undefined') {
Expand Down
2 changes: 0 additions & 2 deletions packages/kittik-deck/src/DeckDeclaration.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { AnimationDeclaration, ShapeDeclaration, SlideDeclaration } from 'kittik-slide';
import { Canvas } from 'terminal-canvas';

export interface DeckDeclaration {
canvas?: Canvas
shapes?: ShapeDeclaration[]
animations?: AnimationDeclaration[]
slides: SlideDeclaration[]
Expand Down

0 comments on commit 104953f

Please sign in to comment.