Recent

Author Topic: pas2js 1.4.0 release  (Read 1110 times)

mattias

  • Administrator
  • Full Member
  • *
  • Posts: 133
    • http://www.lazarus.freepascal.org
pas2js 1.4.0 release
« on: March 24, 2019, 12:46:31 pm »
Hi,

The release of pas2js 1.4.0 is now available for download.

Highlights:
  • class helpers
  • record helpers
  • type helpers
  • advanced records
  • array of const
  • added locate to JSONdataset, as well as lookup and support for lookup fields.
  • added Indexes (sorting) to JSONDataset.

Changes:
http://wiki.freepascal.org/Pas2JS_Version_Changes#Version_1.4.0

Snapshots:
ftp://ftpmaster.freepascal.org/fpc/contrib/pas2js/1.4.0/

SVN release tag:
https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_4_0

SVN fixes branch:
https://svn.freepascal.org/svn/projects/pas2js/branches/fixes_1_4

tatamata

  • Hero Member
  • *****
  • Posts: 692
    • ZMSQL - SQL enhanced in-memory database
Re: pas2js 1.4.0 release
« Reply #1 on: March 24, 2019, 04:42:16 pm »
On http://wiki.lazarus.freepascal.org/lazarus_pas2js_integration there is pas2jsdsgn (components/pas2js/pas2jsdsgn.lpk) mentioned.
I cannot find it?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8063
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: pas2js 1.4.0 release
« Reply #2 on: March 24, 2019, 06:57:33 pm »
Aha! Finally, took quite a while from RC6.

Quick test result: Still no rtl.js found, but it's mentioned in README.md. This is getting very close to newbie friendly distribution, just missing top level README.md to configure PATH to find the compiler or maybe update README.md in demo to use relative path when calling the compiler and referring to rtl.js with -Ji, otherwise it's still look too magical to be able to do:
Code: [Select]
$ pas2js -Jc -Jirtl.js somedemo.pas
from demo folder. One great point that the .cfg is useable right out of the box.
« Last Edit: March 24, 2019, 07:14:27 pm by Leledumbo »

tatamata

  • Hero Member
  • *****
  • Posts: 692
    • ZMSQL - SQL enhanced in-memory database
Re: pas2js 1.4.0 release
« Reply #3 on: March 24, 2019, 07:09:20 pm »
What about visual components? I have found only this: https://github.com/heliosroots/Pas2JS_Widget, but it seems to be a separate project?

jc99

  • Hero Member
  • *****
  • Posts: 527
    • My private Site
Re: pas2js 1.4.0 release
« Reply #4 on: March 24, 2019, 08:31:13 pm »
Ah, great work,
and the demos are running again,
How about a Project Group like (see Download)
I'd also suggest when using the console to put a "pre" and a "code" around the "div console"
like
Code: Text  [Select]
  1. <pre><code><div id="pasjsconsole"> </div></code></pre>
see: https://joecare99.github.io/Public/IOPCC.html
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

sameer

  • New member
  • *
  • Posts: 12
Re: pas2js 1.4.0 release
« Reply #5 on: March 25, 2019, 10:50:55 am »
@tatamata

check this youtube video to get an idea of what is already done :

https://www.youtube.com/watch?v=yv67L4Vi6UQ

engkin

  • Hero Member
  • *****
  • Posts: 2353
Re: pas2js 1.4.0 release
« Reply #6 on: March 25, 2019, 02:07:25 pm »
On http://wiki.lazarus.freepascal.org/lazarus_pas2js_integration there is pas2jsdsgn (components/pas2js/pas2jsdsgn.lpk) mentioned.
I cannot find it?
Check the available packages in your Lazarus installation. Here is a link to the trunk copy:
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/pas2js/?root=lazarus

tatamata

  • Hero Member
  • *****
  • Posts: 692
    • ZMSQL - SQL enhanced in-memory database
Re: pas2js 1.4.0 release
« Reply #7 on: March 25, 2019, 04:54:15 pm »
On http://wiki.lazarus.freepascal.org/lazarus_pas2js_integration there is pas2jsdsgn (components/pas2js/pas2jsdsgn.lpk) mentioned.
I cannot find it?
Check the available packages in your Lazarus installation. Here is a link to the trunk copy:
https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/pas2js/?root=lazarus
Hi, pas2jsdsgn does not contain visual components (widgets)? What's the purpose of this package?

tatamata

  • Hero Member
  • *****
  • Posts: 692
    • ZMSQL - SQL enhanced in-memory database
Re: pas2js 1.4.0 release
« Reply #8 on: March 25, 2019, 05:04:32 pm »
@tatamata

check this youtube video to get an idea of what is already done :

https://www.youtube.com/watch?v=yv67L4Vi6UQ
That again is related to the https://github.com/heliosroots/Pas2JS_Widget, isn't it? How is it related to the core pas2js project, can somebody explain?

engkin

  • Hero Member
  • *****
  • Posts: 2353
Re: pas2js 1.4.0 release
« Reply #9 on: March 25, 2019, 05:35:15 pm »
pas2jsdsgn does not contain visual components (widgets)?
There are no visual components, not published ones at least. I am sure it is planned, but nothing public yet.

What's the purpose of this package?
To allow Lazarus to compile projects using pas2js, and to provide a UI for pas2js' settings and project settings.

What you can do is to take a look at the sample projects. Like DemoCanvas2D:
Code: Pascal  [Select]
  1. Type
  2.   TForm = Class
  3.     Canvas2D : TJSCanvasRenderingContext2D;
  4.     Ex : TJSHTMLInputElement;
  5.     Ey : TJSHTMLInputElement;
  6.     EHeight : TJSHTMLInputElement;
  7.     EWidth  : TJSHTMLInputElement;
  8.     ELineWidth  : TJSHTMLInputElement;
  9.     function ButtonClick(Event{%H-}: TJSMouseEvent): boolean;
  10.     Constructor Create; reintroduce;
  11.   end;

See how an edit box for X is created in code:
Code: Pascal  [Select]
  1. constructor TForm.Create;
  2.  
  3.   Function CreateNumberEdit (aName : String) : TJSHTMLInputElement;
  4.   begin
  5. ...
  6.   end;
  7. ...
  8. begin
  9.   Panel:=document.createElement('div');
  10. ...
  11.   EX:=CreateNumberEdit('X');
  12.   EY:=CreateNumberEdit('Y');
  13.   document.body.appendChild(Panel);
  14.   Panel.appendChild(PanelContent);
  15.   PanelContent.appendChild(Button1);
  16.   PanelContent.appendChild(document.createTextNode('X'));
  17.   PanelContent.appendChild(EX);
  18.   PanelContent.appendChild(document.createTextNode('Y'));
  19.   PanelContent.appendChild(EY);
  20.  

Notice how the value for X is retrieved:
Code: Pascal  [Select]
  1. function TForm.ButtonClick(Event: TJSMouseEvent): boolean;
  2.  
  3. Var
  4.   X,Y,W,H : Double;
  5.  
  6. begin
  7.   writeln('Drawing rectangle');
  8.   X:=StrToFloat(EX.value);
  9.   Y:=StrToFloat(Ey.value);
  10. ...
« Last Edit: March 25, 2019, 05:37:25 pm by engkin »