All Projects → MauriceConrad → Photon

MauriceConrad / Photon

Licence: mit
Clone native desktop UI's like cocoa and develop native feeling applications using web technologies

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Photon

Timeoff Management Application
Simple yet powerful absence management software for small and medium size business (community edition)
Stars: ✭ 644 (+74.53%)
Mutual labels:  web-app, node-js
Robot Js
Native system automation for node.js
Stars: ✭ 169 (-54.2%)
Mutual labels:  node-js, native
Offline invoicing
Desktop invoicing app built with electron. Create Quotes and Invoices. Download PDF or Email directly to your customers.
Stars: ✭ 47 (-87.26%)
Mutual labels:  node-js, electron-app
webviewhs
🌐 A Haskell binding to the webview library created by Serge Zaitsev.
Stars: ✭ 109 (-70.46%)
Mutual labels:  native, electron-app
heroku-flask-template
A simple, fast and easy-to-deploy Heroku ready flask web app template written in Python.
Stars: ✭ 26 (-92.95%)
Mutual labels:  css3, web-app
Electrode
Web applications with node.js and React
Stars: ✭ 2,033 (+450.95%)
Mutual labels:  web-app, node-js
Musicplayer
A minimal music player built on electron.
Stars: ✭ 145 (-60.7%)
Mutual labels:  node-js, electron-app
Shuttle
The fastest access to your favorite applications.
Stars: ✭ 52 (-85.91%)
Mutual labels:  css3, electron-app
webgui
Web Technologies based Crossplatform GUI Framework with Dark theme
Stars: ✭ 81 (-78.05%)
Mutual labels:  css3, electron-app
MERN-BUS-APP
This is a MFRP (My first Real Project) assigned to me during my internship at Cognizant. Made with MERN Stack technology.
Stars: ✭ 92 (-75.07%)
Mutual labels:  css3, node-js
Vue Shiyanlou
😘基于vue2和vuex的复杂单页面应用,20+页面53个API(仿实验楼)✨✨
Stars: ✭ 342 (-7.32%)
Mutual labels:  css3
App Inspector
App-inspector is a mobile UI viewer in browser.
Stars: ✭ 343 (-7.05%)
Mutual labels:  native
Minta
✳️  Electron app for generating regular expressions
Stars: ✭ 353 (-4.34%)
Mutual labels:  electron-app
Nodejs Api Boilerplate
A boilerplate for kickstart your nodejs api project with JWT Auth and some new Techs :)
Stars: ✭ 364 (-1.36%)
Mutual labels:  node-js
Tropy
Research photo management
Stars: ✭ 337 (-8.67%)
Mutual labels:  node-js
Navigation
Scene-Based Navigation for React and React Native
Stars: ✭ 350 (-5.15%)
Mutual labels:  native
Vonic
Mobile UI Components, based on Vue.js and ionic CSS. https://wangdahoo.github.io/vonic-documents
Stars: ✭ 3,422 (+827.37%)
Mutual labels:  web-app
Filter.js
Filter.js: Video and Image Processing and Computer Vision Library in pure JavaScript (Browser and Node.js)
Stars: ✭ 335 (-9.21%)
Mutual labels:  node-js
Themer Gui
A graphical UI for themer. Replaced by Progressive Web App at https://themer.dev.
Stars: ✭ 337 (-8.67%)
Mutual labels:  atom
Scrumonline
PHP web app for planning poker
Stars: ✭ 368 (-0.27%)
Mutual labels:  web-app

Photon

Official Website

Develop native looking UI's for Electron with HTML, CSS & JS.

ShowReel

Install

npm install electron-photon

NPM

Usage

// Require photon
const Photon = require("electron-photon");

Use in Browser

If you want to use Photon in a Browser, you have to mention some things. First of all, embed the browserified script file like anything else using a <script> Tag. But now, you also have to set a relative path for loading the components.

<script src="photon.browser.js"></script>
<script>
  Photon.__baseDir = "/myPhotonMaster";
</script>

Why?

This is because Photon needs an “endpoint” that contains a /dist folder to load each component. The problem is, that we are embedding the photon.browser.js using a former script tag. And sadly, there exist no API to get the relative source of an embedded script from himself. Of course there exist a lot of hacks workarounds but currently this is the only “clean” solution.

Just look at the magic! Everything works out of the box.

Your Photon instance is just used to contain the component controllers and to perform special actions like Dialog() (More about Dialogs). Or if you want to hack a components lifecycle, there you get the classes you need.

Troubleshooting

I get an error ERR_FILE_NOT_FOUND when requiring the Photon. Sometimes the components will not load and you may ask yourself why. Generally, Photon loads each component on its own. Therefore, a general /dist folder is required that contains all component folders. By default, the module tries to use the /dist folder relative to the location of photon.js using node's __dirname. Because of the fact that browsers does not support a clear solution to get the relative path of embedded javascript file by itself, you have to set Photon.__baseDir manually when using the browserified version. And if you do not contain your /dist directory relative to the location of photon.js (which is the main file for the node module), you also have to set Photon.__baseDir manually.

Therefore, if you get such an error, just try to set the Photon.__baseDir manually to the /dist folder you want to use to load your components

Example

Just run the demo/ShowReel folder with electron and will see the whole beauty of Photon!

Application Layout

The main layout of your application needs a <ph-window> element in which the <tool-bar>'s and your <window-content> will find their place.

<ph-window>
  <!--Top header bar here-->
  <tool-bar type="header">
    Toolbar Header
  </tool-bar>
  <!--Window content here-->
  <window-content>
    Window Content
  </window-content>
  <!--Bottom footer bar here-->
  <tool-bar type="footer">
    Footer Header
  </tool-bar>
</ph-window>

Components

If you have a look at the project's structure, you will see that there exist a very well balanced component system you theoretically can contribute to with custom components.

Styles

How do I set the style of the UI? Photon supports multiple styles, inspired by native user interfaces from macOS or Windows.

By default, Photon tries to use the style that is connected to the running OS, stored in process.platform. But you can easily set the style to one of the supported ones. Note that the styles do not have the name of an operating system but their real name such as cocoa.

Style Name Related Operating System Support
cocoa macOS (Apple) True
metro Windows (Microsoft) Coming soon
unity Ubuntu (Linux) Coming soon

Set Style

You can easily control the current style just with the style property of your Photon instance.

// Set style
Photon.style = "cocoa";
// Works as expected

You can do this whenever you want while your application is running ;-)

Note, that when you set a style the first time in your session, it may takes time to load the resources because they are not cached.

Set An Invalid Style

// Set style
Photon.style = "xxx";
// Occurs an error

Panes

Paned Layout

More about the panes in Panes

Navigation List

Navigation List

More about the navigation list in Navigation List

Toolbar

Toolbars

More about toolbars in Toolbar

Table View

Table View

More about the table view in Table View

Tabs

Example Example

More about tabs in Tabs

Lists & Swipes

Lists

Lists

Swipes

Swipe Swipe

Swipes Showreel (GIF is slower than in reality)

More about lists & swipe actions in Lists & Swipes

Button

Button Default

Button Default

More about all buttons in Button

Button Group

Button Group Default

ButtonGroup Segmented

More about the button group component in Button Group

Circular Slider

Circular Slider

More about the circular slider in Circular Slider

Content Frame & Select List

Input Field Focused

More about the content frames and selectable lists in Content Frame & Select List

Input

Simple Text Field

Input Field Input Field Focused

Number Input & Stepper

Number Input with Stepper

More about input fields in Input

Messages

Messages

More about messages view in Messages

Number Input

Number Input

More about number input in Number Input

Progress Circle

Progress Circle

More about progress circle in Progress Circle

Slider

Slider

More about sliders in Slider

Dialog

Dialog

More about dialog controller in Dialog

Drop Down Menu

Dialog

More about drop down menu controller in [Drop Down Menu](dist/Drop Down Menu)

Browserify

You can browserify the photon.js file completely using the --ignore-missing flag which ignores the missing electron requirements. Please note, that not all features are supported in browsers because they may need electron or node functions.

If you browserify photon.js and execute it in a non-node enviroment, the Photon instance will adopted globally to the window object.

This repository contains a valid browserified file named photon-browser.js, you normally should use.

More

You are missing something or do you have improvements?

Please open a pull-request or an Issue and I will do my best ;-)

Disclaimer

This framework is a hard fork of the original PhotonKit framework of connors. Because connors project is not developed anymore since more than 2 years, this is the release of Photon to version 1.0.

Pieces of the code that is used here, is originally written by connors. The original code is contained within the CSS file dist/PhotonOriginal/photon-original.css.

But I made some important changes on the original components. E.g. I use modern technologies like Custom Elements to handle components much easier and cleaner and to provide a lighter API ;-)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].