Commit graph

359 commits

Author SHA1 Message Date
Simon Hausmann
ac5769b1db Make the permalink visible again 2020-11-02 11:04:47 +01:00
Olivier Goffart
e4e7ae46f4 Support for for in box layout in the interpreter 2020-10-31 11:24:31 +01:00
Olivier Goffart
fc9da9b8ea Fix online editor errors while typing
the id was changed causing JS errors
2020-10-30 18:09:46 +01:00
Simon Hausmann
69029e2e49 Online editor tweak
Use a tab bar and show at least one tab with the main source file name

Also use bootstrap for the styling
2020-10-30 16:35:04 +01:00
Olivier Goffart
359f42c5f7 Prepare the compiler to be async
This will allow the online editor to load imports from URL asynchroniously later

Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
2020-10-30 15:00:04 +01:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Olivier Goffart
65ec7e9b7d Fix panic on parse error
Properly report the errors instead.

The later passes panic if the AST is not well formed
2020-10-19 19:43:13 +02:00
Simon Hausmann
04661913b1 Add support for markdown code fences in the syntax updater 2020-10-16 12:30:11 +02:00
Simon Hausmann
bacc43140d Minor cleanup in syntax updater
Move the .rs file processing into a helper function as we'll add a .md one soon, too.
2020-10-16 12:30:11 +02:00
Simon Hausmann
6aa292eac1 Change the names of the logical and physical pixel units
The logical pixels are now just called "px" and the less frequently
used physical pixels have the "phx" suffix.

The existing markup was adapted using the syntax updater and the
following patch:

    +    if node.kind() == SyntaxKind::NumberLiteral {
    +        if node.text().ends_with("lx") {
    +            return write!(
    +                file,
    +                "{}px",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +        if node.text().ends_with("px") {
    +            return write!(
    +                file,
    +                "{}phx",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +    }

Fixes #49
2020-10-16 07:19:40 +02:00
Olivier Goffart
d57ad389e0 Default to the native style in the viewer if it is available 2020-10-14 14:51:47 +02:00
Olivier Goffart
1138c9dbed Normalize the spelling of SixtyFPS 2020-10-13 07:48:55 +02:00
Olivier Goffart
cbf252f73b Online editor: go back to hello world if no demo is selected 2020-10-12 12:25:34 +02:00
Olivier Goffart
0845b4ab85 Online editor: Add a timeout 2020-10-12 12:22:49 +02:00
Simon Hausmann
e374fd35c4 Ignore the generated pkg/ directory 2020-10-12 11:26:15 +02:00
Olivier Goffart
69b07eee53 Revert the changes to the hello world in the code editor
These were not meant to be commited
2020-10-10 15:46:38 +02:00
Olivier Goffart
e57554a71d Missing license header 2020-10-10 13:20:13 +02:00
Olivier Goffart
8ec820cb9f Online editor syntax highliting 2020-10-10 13:00:14 +02:00
Olivier Goffart
29f4910cbd Some changes to the online editor
- Set a small hello world by default
 - add a permalink
 - allow to load an URL
2020-10-09 13:14:30 +02:00
Olivier Goffart
18881cfcad Online editor don't ship with support for other languages 2020-10-09 12:48:56 +02:00
Simon Hausmann
67f387e628 Prepare for relative resource loading from the web
Pass the base url as path to the interpreter
2020-10-08 20:42:46 +02:00
Olivier Goffart
47ee896b57 Online editor: Ability to open any snippet passed in the query 2020-10-07 15:33:04 +02:00
Olivier Goffart
117e1d3389 Online-editor: Add a compilation button
Fixes #76
2020-10-07 15:12:38 +02:00
Olivier Goffart
f592a04f3d Online code editor: load the demo from github 2020-10-06 13:03:51 +02:00
Olivier Goffart
c9d60d3575 Online editor: clear errors 2020-10-06 11:50:49 +02:00
Olivier Goffart
1f50e8c85e Highlight the error in the online editor 2020-10-06 11:33:44 +02:00
Simon Hausmann
2041144f45 Fix a warning on start-up about freezing the UI
The console log would show

  "Could not create web worker(s). Falling back to loading web worker code
  in main thread, which might cause UI freezes. Please see
  https://github.com/Microsoft/monaco-editor#faq"

and

  "VM3793 simpleWorker.js:29 You must define a function
  MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker"

when loading. This is fixed by using the monaco editor webpack plugin, which
ensures that the workers are loaded via async script tags.
2020-10-06 10:21:15 +02:00
Simon Hausmann
94fcb725b4 Separate release and dev builds of the online editor
Let `npm run build` do a release build and `npm run start` be used for
development.
2020-10-05 16:45:29 +02:00
Simon Hausmann
79150a9b20 Apply the same license (check) as for .js files 2020-10-05 16:06:14 +02:00
Simon Hausmann
5d392db2cf Use the local wasm interpreter for the online editor 2020-10-05 15:38:07 +02:00
Simon Hausmann
f74ae174b6 Ported the online editor across into this repo
This now uses npm and webpack to pull in Monaco as external dependency.
2020-10-05 15:05:55 +02:00
Olivier Goffart
8134fe5088 Support for named type as property 2020-09-17 13:14:01 +02:00
Simon Hausmann
ff9c118e07 Propagate warnings to the end of the compilation step and print them 2020-09-04 20:34:20 +02:00
Olivier Goffart
f1ad78bc25 Qt style support for the rust backend
Need to set the SIXTYFPS_STYLE=native env variable while compiling
2020-09-01 12:25:11 +02:00
Olivier Goffart
6d41b1981d Move the Qt style to a new backend: the Qt backend
Currently the Qt backend still redirect everything to the GL backend,
but the goal is to use QPainter and QWindow

This also adds a "default" backend, whose goal is to select the proper
backend at compile time
2020-08-31 17:26:04 +02:00
Olivier Goffart
d28e34eef6 Don't enable the display diagnostic feature in the interpreter 2020-08-26 19:12:28 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Olivier Goffart
ea1f215367 Some polishinbg of the .toml files
- Give all the sixtyfps-* create a 0.0.1 version
 - Make sure that the internal dependences are using the exact same version
   (so "=0.0.1")
 - Add the description/homepage/repository fields in the .toml files
 - Set publish=false  to crates that are not meant to be published on crates.io
2020-08-24 16:28:11 +02:00
Simon Hausmann
7f1d9f5252 Commit correct license tags to Cargo.toml
For now that's GPL-3.0 only, but this can be changed :-)
2020-08-18 10:12:59 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
aafb96cb93 Get rid of abi::datastructures::WindowProperties
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Simon Hausmann
f2eec61968 Add a window to the top-level component
This means that we always have a window and for the C++
API we don't require this ComponentWindow use anymore.
2020-08-11 13:38:38 +02:00
Simon Hausmann
6c5d423cd4 Rename sixtyfps_corelib to sixtyfps-corelib 2020-08-03 10:01:58 +02:00
Simon Hausmann
09cae799d3 Fix return type of compile_syntax_node
All call sites are only interested in the root component, so might
as well return that.
2020-07-28 09:21:32 +02:00
Olivier Goffart
d77d7cddc3 The viewer can use the Qt style with --style qt 2020-07-24 18:06:55 +02:00
Simon Hausmann
a9b0d84a72 Improve source file propagation
Instead of doing the SyntaxNodeWithSourceFile construction as late as
possible (in Document::from_node), we can do it as early as possible.
That'll reduce the chances of missing out the source file and prepares
for dependency loading just based on a SNWS :)

This also makes the source_file optional in the SNWS, but that's
consistent with what the diagnostics expect.
2020-07-22 16:10:02 +02:00
Simon Hausmann
2f0718bffa Add include path options to the viewer and compiler
This allows specifying additional component locations. It works for
simple structs, but not yet for more complex types due to a bug yet to
be fixed :-)
2020-07-17 15:26:35 +02:00
Simon Hausmann
732a56259f Simplify compilation call sites further
Move run_passes into the library compilation function. That way the
FileDiagnostics are created by the parser, can be passed on to the library
compilation function and after that we don't need them anymore and can
replace them with future BuildDiagnostics for example.
2020-07-16 18:53:59 +02:00
Simon Hausmann
c3aae7648a Further simplify compilation call sites
Remove the need to construct the type registry at all the call sites by
offering a compile_syntax_node function in the compiler library.
2020-07-16 09:25:26 +02:00
Simon Hausmann
64a4e749b7 Simplify path setup in the Diagnostics
Pass the path to the parse function, as that's easier at most call sites.
Also offer a convenience parse_file function.
2020-07-15 19:21:25 +02:00