Git Product home page Git Product logo

pagedraw's Introduction

Pagedraw

Pagedraw is a UI builder for React web apps. It works like a Sketch or Figma style design tool, but emits good quality JSX code. You can play with a demo on the web without installing at https://pagedraw.io/tutorials/basics. Videos about pagedraw can be found on Youtube. See https://pagedraw.io/ for more info.

Pagedraw is not currently under development. We do not recommend using it for production. Please fork and use it for something cool!

Here is a blog post with some lessons we took from working on Pagedraw.

Usage

Download the final release at https://github.com/Pagedraw/pagedraw/releases/download/1.0.1/Pagedraw-1.0.1.dmg.

Clone https://github.com/pagedraw/sample-app and use it as the scaffolding for your app. It's based on create-react-app; all very standard. You'll want to do the usual yarn to install dependencies.

Open the Pagedraw app, which will ask you to pick a file. Pick sample-app/main.pagedraw.json to open.

Run yarn start in sample-app (or whatever you've renamed it). This is just the regular create-react-app's yarn start. Once you have your localhost development environment up, try doing things around in Pagedraw. It should live update in the localhost environment. You're all set up!

Adding Pagedraw to an existing project

Use https://github.com/pagedraw/sample-app as a reference.

Put a main.pagedraw.json in the root of your repo. All files built by Pagedraw will be written into a /src/pagedraw/ folder. These are regular JSX/CSS files, so you can import them just like the rest of your code.

If you ever want to stop using Pagedraw, just delete the source *.pagedraw.json files. The generated files will still live in src/pagedraw, and you can treat them like any other code files.

The editor itself is straightforward if you've used a design tool like Sketch or Figma. Detailed documentation is available at https://documentation.pagedraw.io/the-editor/.

When you open Pagedraw for the first time, it will ask you to open a .pagedraw.json file. If you'd like to create a new file, click cancel when it asks you to open a file, and it'll ask you where to create a new file.

Developing

Setting up the development environment

As a prerequisite, install

  1. Node.js version 8.9.0. (nvm is useful here)
  2. yarn
# clone the repo and install the project dependencies
git clone https://github.com/Pagedraw/pagedraw
cd pagedraw
yarn install
cd desktop-app/ && npm install && cd ..

Running Pagedraw in development

In the background, run

yarn devserver

then start Electron with

yarn run-electron

Config for development

Turn on asserts the first time you run in development mode, which will help you debug. In the Electron developer tools console, run __openConfigEditor() and set your local config to

{
  "crashButton": true,
  "asserts": true
}

Running tests

To run the standard tests, run all the servers needed for Pagedraw development, as described in the section above. While yarn devserver is running, run

yarn test

TODOs

  • Today all images brought into Pagedraw are stored as part of the Pagedraw doc as base64 encoded strings and they also get compiled to generated code as img tags with base 64 data srcs. That bloats the Pagedraw docs and forces an unnecessary constraint on generated code. We should move to a world where that system is more flexible and generates code that requires images instead
  • Same thing for fonts. Today they're being stored directly in the Pagedraw doc as base64 strings and also injected into the compiled code as such
  • Make Sketch Importer into a Sketch to Pagedraw converter command instead of a server.
  • Compile-Check can work with local /compiler-blobs, and not depend on S3 to host them. Look in /compiler-blob-builder and /deploy-checks/fetch-other-compiler-build.js.

The code in the repository is being provided to you under an open source license. There are multiple contributors to this code. All contributions provided after 2/1/2019 were done in a personal capacity, and the license you receive to code following 2/1/2019 is from the contributors personally and not their respective employers.

pagedraw's People

Contributors

flip111 avatar gablg1 avatar jaredp avatar marcusellison avatar naveenedala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pagedraw's Issues

Download component definition for re-use

I realize this product has just been open sourced and a community has not yet formed. Anyway i'm throwing this idea out there because i think it could be interesting.

When exporting to React, Angular or another framework, first some internal representation is created from which the export can occur. Let's call this internal representation Pagedraw Model (PM). The PM could be least common denominator which the frameworks support. Maybe this idea is somewhat similar to https://github.com/andlabs/libui but then for the web.

When the PM can be extracted/downloaded. It can also be uploaded by users for other users to get the component for their framework of choice. Right now there are collections of components for particular frameworks such as for react. But they don't offer a good search function (only textual with browser search function). When there are a lot of components in the collections searching becomes more difficult. The PM could help with this. By having a definition it could be queried like "show me all the models with a single text input and a button". Making such a search would not be easy, but searching for the type of things can be done. Hoogle comes to mind when searching for types (not that i suggest that this can be used 1on1 for a component search).

It's not difficult to imagine a repository or marketplace from here if you will. I hope someone finds this idea useful. I don't have the time, means and resources to work on it at the moment. But i would like to discuss it a bit more.

Running on browser

Hi @jaredp and co!

I was trying to get Pagedraw to load on a browser locally, and subsequently, deploy it.

I went through the following:

  • cloned the repo
  • yarn and then yarn devserver

If I visit http://localhost:3000, I get the message described on #2:
This is a placeholder needed for our build system in dev mode. You should never see it.

If I just served desktop-app/index.html, I get the following error
screenshot 2019-03-01 17 02 51

Any tips on getting it to work on a local browser? :)

Thank you!

Electron App not working

Electron app wouldnt start for me. I get no windows.
So I removed show: false from new BrowserWindow({show: false})
And enabled dev tools. Errors are attached.

Screenshot 2019-05-19 01 30 07

Steps

Cloned fresh copy of Pagedraw from Github
Followed the install Procedure
Started Dev server
Started run-electron

Additional Info

OS: MacOS Mojave
Node: 8.9.0

Not sure what I am doing wrong.
Would appreciate some help in this matter.

Preview dosn't work

Steps to reproduce:
nvm use 8.9.0
git clone https://github.com/Pagedraw/pagedraw
cd pagedraw
yarn install
cd desktop-app/ && npm install && cd ..

Terminal: yarn devserver
Terminal2: yarn run-electron

Cancel to open .json
Create new .json

In pagedraw app create new Artboard and rectangle in it.
Then "Preview" button

Got error chromewebdata/:1 Not allowed to load local resource: file:///pages/undefined/play/9847489285036914/

4.9.0-9-amd64 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux

Are preview working on windows/macOS?
Any chance to make preview work?

Tutorial source

hello,
first of all thanks for sharing such a beatiful piece of code, i'm trying to build an online editor for expo app.
I've successfully run the app in the browser following the advices in a previous issue (for who is interested can find the code in my fork) but i would like to build something similar to your tutorial, with the editor attached.
any chance you would share the tutorial source?

Kind regards
Luca

I have successfully run PageDraw in the browser by the source code, which may be helpful.

From the Readme, we can preview by the electron.

So I briefly explain how to preview by the browser. Just a few simple changes, it can successfully preview. more info.

  1. create pagedraw/ide-integrations/browser.cjsx
React = require 'react'
createReactClass = require 'create-react-class'
_l = require 'lodash'

{Editor} = require '../editor/edit-page'
{Doc} = require '../doc'
core = require '../core'
config = require '../config'
util = require '../util'

open_file = 'untitled.pagedraw.json'
initialDocjson = (new Doc()).serialize()

module.exports = createReactClass

    render: ->
        <Editor
            initialDocJson={initialDocjson}
            onChange={@handleDocjsonChanged}
            windowTitle="Pagedraw"
        />

# definitely not "right", kind of a hack
isInsideDir = (dir_path, file_path) -> file_path.startsWith(dir_path)
  1. update pagedraw/src/editor/router.cjsx . And one line browser: -> require('../ide-integrations/browser') at line 58.
   pages = {
        # some other routes
        browser: -> require('../ide-integrations/browser')
        electron_app: -> require('../ide-integrations/electron-app')
    }
  1. copy pagedraw/desktop-app/index.html to pagedraw/static/brower.html. And update some code at line 15.
window.pd_params = {
      "route": "browser"
};
  1. run yarn devserver and open http://localhost:3000/brower.html in the browser.

image

  1. if you want preview the project like 'https://pagedraw.io/tutorials/basics' in local. You can just edit pagedraw/static/brower.html at line 15.
 window.pd_params = {
      "tutorial": true,
      "blitz_id": "basics",
      "route": "stackblitz"
 };

image

Running from source

Trying to run this on a non-Mac, the instructions in the Readme result in the app serving This is a placeholder needed for our build system in dev mode. You should never see it.

Running the electron app in this state just delivers a popup to select a file in the desktop-app folder.

I assume because it's titled Setting up the development environment that it's not the way I want to run this as a user. How would I go about that?

Make it framework-agnostic

What would it take to make Pagedraw framework-agnostic, i.e. replace React with any other component-based JS framework, such as Vue or Riot? Which parts of Pagedraw should be changed?

login doesn't work

I was trying to use pagedraw.
i have installed pagedraw-cli... but when i run pagedraw login it opens up a page which says The page you were looking for doesn't exist

how can i proceed?

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.