mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Rename the wasm-interpreter and the online_editor
This commit is contained in:
parent
e92dd7797d
commit
f4a824cf61
8 changed files with 23 additions and 23 deletions
|
@ -2,13 +2,13 @@
|
|||
# SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
[package]
|
||||
name = "sixtyfps-wasm-interpreter"
|
||||
name = "slint-wasm-interpreter"
|
||||
version = "0.2.0"
|
||||
authors = ["SixtyFPS <info@sixtyfps.io>"]
|
||||
edition = "2021"
|
||||
license = "(GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)"
|
||||
publish = false
|
||||
description = "SixtyFPS wasm glue"
|
||||
description = "Slint wasm glue"
|
||||
repository = "https://github.com/sixtyfpsui/sixtyfps"
|
||||
homepage = "https://sixtyfps.io"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import * as monaco from 'monaco-editor';
|
||||
|
||||
|
||||
export const sixtyfps_language = <monaco.languages.IMonarchLanguage>{
|
||||
export const slint_language = <monaco.languages.IMonarchLanguage>{
|
||||
defaultToken: 'invalid',
|
||||
|
||||
root_keywords: [
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
|
||||
<title>SixtyFPS OnlineEditor</title>
|
||||
<title>Slint Online Editor</title>
|
||||
<style>
|
||||
canvas {
|
||||
touch-action: none;
|
||||
|
@ -15,7 +15,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<p>This is a prototype for an online editor for the SixtyFPS language. More info <a
|
||||
<p>This is a prototype for an online editor for the Slint language. More info <a
|
||||
href="https://github.com/sixtyfpsui/sixtyfps">github.com/sixtyfpsui/sixtyfps</a> </p>
|
||||
<p>Select a demo to load: <select id="select_combo">
|
||||
<option value="">-- Select a demo --</option>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@sixtyfps.io>
|
||||
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
import { sixtyfps_language } from "./highlighting";
|
||||
import { slint_language } from "./highlighting";
|
||||
|
||||
import 'monaco-editor/esm/vs/editor/editor.all.js';
|
||||
import 'monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.js';
|
||||
|
@ -24,20 +24,20 @@ self.MonacoEnvironment = {
|
|||
}
|
||||
};
|
||||
|
||||
import sixtyfps_init, * as sixtyfps from "../../../wasm-interpreter/sixtyfps_wasm_interpreter.js";
|
||||
import slint_init, * as sixslint from "../../../wasm-interpreter/slint_wasm_interpreter.js";
|
||||
|
||||
|
||||
(async function () {
|
||||
await sixtyfps_init();
|
||||
await slint_init();
|
||||
|
||||
monaco.languages.register({
|
||||
id: 'sixtyfps'
|
||||
id: 'slint'
|
||||
});
|
||||
monaco.languages.onLanguage('sixtyfps', () => {
|
||||
monaco.languages.setMonarchTokensProvider('sixtyfps', sixtyfps_language);
|
||||
monaco.languages.onLanguage('slint', () => {
|
||||
monaco.languages.setMonarchTokensProvider('slint', slint_language);
|
||||
});
|
||||
var editor = monaco.editor.create(document.getElementById("editor"), {
|
||||
language: 'sixtyfps'
|
||||
language: 'slint'
|
||||
});
|
||||
var base_url = "";
|
||||
|
||||
|
@ -132,7 +132,7 @@ export Demo := Window {
|
|||
}
|
||||
|
||||
function createMainModel(source: string, url: string): monaco.editor.ITextModel {
|
||||
let model = monaco.editor.createModel(source, "sixtyfps");
|
||||
let model = monaco.editor.createModel(source, "slint");
|
||||
model.onDidChangeContent(function () {
|
||||
let permalink = (<HTMLAnchorElement>document.getElementById("permalink"));
|
||||
let params = new URLSearchParams();
|
||||
|
@ -216,12 +216,12 @@ export Demo := Window {
|
|||
div.innerHTML = "";
|
||||
div.appendChild(canvas);
|
||||
var markers = [];
|
||||
let { component, diagnostics, error_string } = await sixtyfps.compile_from_string_with_style(source, base_url, style_combo.value, async (url: string): Promise<string> => {
|
||||
let { component, diagnostics, error_string } = await slint.compile_from_string_with_style(source, base_url, style_combo.value, async (url: string): Promise<string> => {
|
||||
let model_and_state = editor_documents.get(url);
|
||||
if (model_and_state === undefined) {
|
||||
const response = await fetch(url);
|
||||
let doc = await response.text();
|
||||
let model = monaco.editor.createModel(doc, "sixtyfps");
|
||||
let model = monaco.editor.createModel(doc, "slint");
|
||||
model.onDidChangeContent(function () {
|
||||
maybe_update_preview_automatically();
|
||||
});
|
||||
|
@ -251,7 +251,7 @@ export Demo := Window {
|
|||
endColumn: -1,
|
||||
}
|
||||
});
|
||||
monaco.editor.setModelMarkers(editor.getModel(), "sixtyfps", markers);
|
||||
monaco.editor.setModelMarkers(editor.getModel(), "slint", markers);
|
||||
|
||||
if (component !== undefined) {
|
||||
component.run(canvas_id)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "sixtyfps-online-editor",
|
||||
"name": "slint-online-editor",
|
||||
"version": "0.2.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>SixtyFPS Preview</title>
|
||||
<title>Slint File WASM Preview</title>
|
||||
<style>
|
||||
/* beautify ignore:start */
|
||||
.spinner:before {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright © SixtyFPS GmbH <info@sixtyfps.io>
|
||||
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
import sixtyfps_init, * as sixtyfps from "../../../wasm-interpreter/sixtyfps_wasm_interpreter.js";
|
||||
import slint_init, * as slint from "../../../wasm-interpreter/slint_wasm_interpreter.js";
|
||||
|
||||
(async function () {
|
||||
await sixtyfps_init();
|
||||
await slint_init();
|
||||
|
||||
var base_url = "";
|
||||
|
||||
|
@ -41,7 +41,7 @@ export Demo := Window {
|
|||
div.innerHTML = "";
|
||||
div.appendChild(canvas);
|
||||
|
||||
let { component, error_string } = await sixtyfps.compile_from_string_with_style(source, base_url, style, async (url: string): Promise<string> => {
|
||||
let { component, error_string } = await slint.compile_from_string_with_style(source, base_url, style, async (url: string): Promise<string> => {
|
||||
let file_source = loaded_documents.get(url);
|
||||
if (file_source === undefined) {
|
||||
const response = await fetch(url);
|
||||
|
|
|
@ -17,7 +17,7 @@ export default defineConfig(({ command, mode }) => {
|
|||
// For development builds, serve the wasm interpreter straight out of the local file system.
|
||||
base_config.resolve = {
|
||||
alias: {
|
||||
'../../../wasm-interpreter/sixtyfps_wasm_interpreter.js': "../../api/sixtyfps-wasm-interpreter/pkg/sixtyfps_wasm_interpreter.js"
|
||||
'../../../wasm-interpreter/slint_wasm_interpreter.js': "../../api/wasm-interpreter/pkg/slint_wasm_interpreter.js"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@ export default defineConfig(({ command, mode }) => {
|
|||
// relative path to the interpreter is as below.
|
||||
base_config.build = {}
|
||||
base_config.build.rollupOptions = {
|
||||
external: ['../../../wasm-interpreter/sixtyfps_wasm_interpreter.js'],
|
||||
external: ['../../../wasm-interpreter/slint_wasm_interpreter.js'],
|
||||
input: ["index.html", "preview.html"],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue