pwa/p2js
The program Phix\pwa\p2js.exw and the contents of the Phix\pwa directory represent the next big step for Phix:
Look familiar? Well it should:
As you can see, the aim is "reasonably similar" rather than "pixel perfect".
You can move, resize, and maximise/restore the window just like the desktop.
In fact you should be able to run an online demo here.
Of course it is a little, shall we say off-beat, to draw a desktop window in the middle of a browser... Padding, spacing, and especially resize are likely to be a little wonky and will no doubt remain so for some time. At least most things are vaguely usable, and a single canvas filling the whole window seems good. Removing window decorations and going "full client" (or whatever you want to call it) is likely to take priority, but right now all my focus and energy is and/or should be on the language side of things rather than a GUI, and especially on getting the whole of pwa/p2js to run in a browser. Remember this is all open source, runs locally just as well as it does on a server, needs no third party tools or configuration, and of course contributions and even minor tweaks would be warmly welcomed.
Anyone with a little CSS/JavaScript knowledge should be able to jump straight in, though I should point out it is very much a Douglas-Crockford-esque subset of JavaScript that’s pretty much just Phix in disguise, which does not use objects at all, and I may not take too kindly to ES6 syntax bleatings, promises, modules, object matching, generators, etc
a) if I cannot see the benefit it brings (even/esp fatarrow functions!), and
b) if it makes any of the support files incomprehensible to "Phix-only users".
Also anyone including R*act, *ngular, 3.js, or even plain old jQ*ery will be mercilessly and relentlessly ridiculed, this is vanillaJS only. Show me something that works really rather well, not only in a browser but also on desktop/Phix, and I just might change my mind, but I strongly doubt it.
Licence: as stated in the introduction. You may freely use pwa/p2js to develop and package an otherwise closed source commercial proprietary application, but any modifications, bugfixes, and enhancements to pwa/p2js itself must be made public - besides you probably would not want to have to manually re-apply any such changes to every new release.
Running the exact same program source code both on the desktop and directly in a web browser.The files pwa\p2js.js, pwa\pGUI.js and pGUI.css contain a basic JavaScript re-implementation of a subset of the standard builtins (especially any that use inline assembly in desktop/Phix) and pGUI.e, and the directory pwa\builtins contains auto-transpiled versions of other (more normal) builtins/autoincludes, as well as mpfr.js which is a laboroiously and lovingly hand-crafted drop-in JavaScript replacement for mpfr/gmp.
Example:
--
-- pwa\phix\hello_world.exw
-- ========================
--
include pGUI.e
IupOpen()
Ihandle lbl = IupFlatLabel("World","EXPAND=YES, ALIGNMENT=ACENTER")
Ihandln dlg = IupDialog(lbl,`TITLE="Hello", MINSIZE=225x75`)
IupShow(dlg)
if platform()!=JS then
IupMainLoop()
dlg = IupDestroy(dlg)
IupClose()
end if
Look familiar? Well it should:
Desktop
Browser
As you can see, the aim is "reasonably similar" rather than "pixel perfect".
You can move, resize, and maximise/restore the window just like the desktop.
In fact you should be able to run an online demo here.
Of course it is a little, shall we say off-beat, to draw a desktop window in the middle of a browser... Padding, spacing, and especially resize are likely to be a little wonky and will no doubt remain so for some time. At least most things are vaguely usable, and a single canvas filling the whole window seems good. Removing window decorations and going "full client" (or whatever you want to call it) is likely to take priority, but right now all my focus and energy is and/or should be on the language side of things rather than a GUI, and especially on getting the whole of pwa/p2js to run in a browser. Remember this is all open source, runs locally just as well as it does on a server, needs no third party tools or configuration, and of course contributions and even minor tweaks would be warmly welcomed.
Anyone with a little CSS/JavaScript knowledge should be able to jump straight in, though I should point out it is very much a Douglas-Crockford-esque subset of JavaScript that’s pretty much just Phix in disguise, which does not use objects at all, and I may not take too kindly to ES6 syntax bleatings, promises, modules, object matching, generators, etc
a) if I cannot see the benefit it brings (even/esp fatarrow functions!), and
b) if it makes any of the support files incomprehensible to "Phix-only users".
Also anyone including R*act, *ngular, 3.js, or even plain old jQ*ery will be mercilessly and relentlessly ridiculed, this is vanillaJS only. Show me something that works really rather well, not only in a browser but also on desktop/Phix, and I just might change my mind, but I strongly doubt it.
Licence: as stated in the introduction. You may freely use pwa/p2js to develop and package an otherwise closed source commercial proprietary application, but any modifications, bugfixes, and enhancements to pwa/p2js itself must be made public - besides you probably would not want to have to manually re-apply any such changes to every new release.