Giter Club home page Giter Club logo

amidz's Introduction

English/日本語

CircleCI Travis CI Build Status GitHub Actions CI Status This project is using Percy.io for visual regression testing.

Amidz

A knitting and crochet pattern editor.

Prototype Application

The GitHub Page of this repository delivers a prototype application. The prototype application is a Progressive Web App (PWA).

Usage scenarios

Please refer to scenarios.md.

Locally testing the prototype application

The prototype application can be locally tested. The /docs/pwa folder contains a JavsScript that starts a server that delivers the prototype application on localhost:8000.

Please take the following steps to start the server.

  1. Move down to docs/pwa.

    cd docs/pwa
    
  2. Install necessary modules (first time only).

    npm install
    
  3. Start the service.

    npm start
    
  4. A server will start waiting for requests at http://localhost:8000/. It will show a screen similar to the following,

    Sample Screen

Deploying a prototype application

The docs/pwa/www directory contains the latest prototype application files. Those files can be built from the source files in the src directory with Webpack. If you want to build a new application from the source files and deploy it, please take the following steps,

  1. Suppose you are in the root directory of your copy of this repository.

  2. Install necessary modules (first time only).

    npm install
    
  3. Build an application.

    npm run build
    
  4. You will find application files in a dist directory.

  5. Replace the contents of the docs/pwa/www direcotry with those of the dist directory.

    rm -rf docs/pwa/www
    cp -r dist docs/pwa/www
    

Now you can run your application as described in the section Locally testing the prototype application.

Debugging a prototype application

Before deploying your application, you should want to debug it. Copying artifacts to the docs/pwa/www directory every time you build an application is cumbersome, so you can use a Wabpack Dev Server during you debug your application. To start a Webpack Dev Server, please take the following steps,

  1. Suppose you are in the root directory of your copy of this repository.

  2. Install necessary modules (first time only).

    npm install
    
  3. Start a Webpack Dev Server.

    npm run dev
    
  4. Your default browser will open http://localhost:8080.

As a Webpack Dev Server monitors changes on source files and will automatically reload a rebuilt application, you do not need to manually reload the application when you edit a source file.

Unit testing

Unit testing of Amidz is backed by the following packages,

To run unit tests, please take the following steps,

  1. Suppose you are in the root directory of your copy of this repository.

  2. Install necessary modules (first time only).

    npm install
    
  3. Run unit tests.

    npm test
    
  4. You will see test results printed on the console.

You can run tests in the watch mode by specifying -- --watch at the step 3.

npm test -- --watch

End-to-End testing

End-to-End (E2E) testing is conducted by Cypress. To run E2E tests, please take the following steps,

  1. Suppose you are in the root directory of your copy of this repository.

  2. Install necessary modules (first time only).

    npm install
    
  3. Start a Webpack Dev Server in the background.

    npm run dev &
    
  4. Run Cypress.

    npm run cypress:run
    
  5. You will see test results printed on the console.

You can run Cypress in the interactive mode by running cypress:open instead of cypress:run at the step 3.

npm run cypress:open

Generating documentation of the code

The source code of Amidz is documented with JSDoc + the jsdoc-vuejs plugin. If you want to generate documentation of the code, please take the following steps,

  1. Suppose you are in the root directory of your copy of this repository.

  2. Install necessary modules (first time only).

    npm install
    
  3. Run JSDoc.

    npm run build:doc
    
  4. You will find documentation in an api-doc directory.

amidz's People

Contributors

kikuomax avatar

Watchers

 avatar  avatar  avatar

amidz's Issues

CircleCI cache error

I misunderstood the behavior of the save_cache command of CircleCI.

I got the following error,

Skipping cache generation, cache already exists for key: v1-cache-arch1-linux-amd64-6_85-O9mUGkDhk1N3MAsBVWi8Im0Fp8GRCJEHLMibu7DnM38=
Found one created at 2020-01-26 16:04:46 +0000 UTC

I have to do either of the following,

  1. Specify all folders to cache in a single save_cache if I want to use the same key.
  2. Specify another key if I want to run two save_cache commands.

Update packages

Many updates have been made on packages that amidz depends on.
So let's update them.

Make a prototype of a pattern chart editor screen

Determine the key strategy to represent a pattern chart as a standalone SVG file.

  • Direct editing of an output SVG
  • Symbols embedded in the defs section of an output SVG
  • Generation of a link to download an output SVG

Determine key modules.

Database migration for #57

The database needs to have capability of expressing rows freely located (#57).

New pattern store

An entry in a new pattern store will look like

  • name: String
  • rows: Array< Object >
    • position: Object (new). Position of the row.
      • left: Number (new). Left position of the row.
      • top: Number (new). Top position of the row.
    • columns: Array< Object >
      • symbolId: String

keyPath is name.

See also #35.

Expand the editor container

Obviously, the current editor container is not large enough to make a practical chart.

The following features are necessary,

  • Zooming In/Out
  • Scrolling

Remove meaningless elements

Remove the following elements since they are now meaningless.

  • The "Main Screen" title.
  • The "Save SVG" button.
  • The "Download SVG" button.

Make rows snap to a grid

To align rows more beautifully, they should snap to a grid.
A designer should be able to choose a grid size from predefined values.
A grid should be shown during a designer is moving a row.

PoC of a row editor

Implement a PoC of a row editor to design a pattern row-by-row.

  • Try some possible interfaces
  • Describe a scenario

Features to implement in this issue.

  • Interface to choose a symbol to put
  • Interface to put a symbol in a cell of a row
  • Interface to change the size, number of cells, of a row

Row expansion does not work on my mobile phone

Problem

The slider handle reacts to my finder when I pressed it, but it does not follow my finger when I move my finger on the screen.

Environment

  • Device: Pixel 3a
  • Android version: 10
  • Browser: Chrome

Workaround for hasPointerCapture issue with Cypress

Currently the row expansion handle checks if hasPointerCapture(event.pointerId) is true to determine if the handle is being grabbed when a pointermove event is triggered. Unfortunately my test code using Cypress does not work as I intend because it does not seem that Cypress correctly simulates PointerEvents.

if (!target.hasPointerCapture(event.pointerId)) {
return
}

The hasPointerCapture check may be bypassed because equivalent information is stored in the rowExpansionHandle.isDragged data property.
A pointercancel event should be handled anyway.

Make rows transparent

When #58 is implemented, rows may be placed everywhere.
So they may overlap each other and one row may hide another row.
I think rows should be transparent.

Make a sample PWA

I think it is a good idea to develop Amidz as a Progressive Web App (PWA).

How about to make a simple PWA to learn it.

Symbol picker dropup

It may be better if the symbol picker is shown above the trigger button to save the space at the bottom of the screen.

Feature to save and load a pattern in IndexedDB

Where to save?

Here I want to provide an offline feature first.
So I will give IndexedDB a shot.

IndexedDB Structure

Database

AmidzDatabase

Object Store

pattern

  • keyPath: 'name'
  • value: Object
    • name: String
    • rows: Array.Object
      • columns: Array.Object
        • symbolId: String

A value object has the same structure as the patternData state of the pattern Vuex store.

Generic draggable handle

It is time to implement a generic draggable handle.
It looks like a button with

  • Gray background
  • Icon
  • Drag event handling

Make rows independent of the grid

To place symbols freely how about to forget about the grid.
I think rows are necessary because we still want to align symbols.

Constraints

  • A row can be located anywhere (#58).
  • A row aligns columns.
  • The width of columns in a row may be changed (#59).
  • The height of a row may be changed (#67).

PoC of a pattern editor

Complete a PoC of a pattern editor.

Features to implement in this issue.

  • Interface to select a row to edit (#32).
  • Interface to add a row (#33).
  • Interface to remove a row (#34).
  • Interface to save a pattern (#35).

Define a metadata of an SVG image

I'd better use a metadata in an editor instead of a direct SVG image, because an SVG image may contain elements only for user interactions. And those elements should not be included in a final SVG output.

Reduce Percy snapshots uploading

It is too expensive to upload Percy snapshots every time I push to GitHub.
How about to limit Percy to run only on the master branch and a pull request to the master branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.