Skip to content

Commit

Permalink
Merge branch 'main' into nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Jul 7, 2024
2 parents 380f44a + f4eb0e6 commit 07ad19a
Show file tree
Hide file tree
Showing 19 changed files with 283 additions and 152 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
[submodule "blueprint-compiler"]
path = blueprint-compiler
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
[submodule "src/langs/typescript/template/gi-types"]
path = src/langs/typescript/gi-types
url = https://gitlab.gnome.org/BrainBlasted/gi-typescript-definitions.git
branch = nightly
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ unit:
test: unit lint
./build-aux/fun workbench-cli ci demos/src/Welcome

ci: setup test
ci: setup build test
./build-aux/fun workbench-cli ci demos/src/*

# Note that if you have Sdk extensions installed they will be used
Expand Down
287 changes: 211 additions & 76 deletions src/Library/Library.blp
Original file line number Diff line number Diff line change
Expand Up @@ -16,82 +16,217 @@ Adw.Window window {
};
}

content: Adw.PreferencesPage {
Adw.PreferencesGroup {
Box {
halign: center;
vexpand: false;

Picture picture_illustration {
can-shrink: false;
margin-bottom: 32;
}
}

Label {
label: _("Learn, Test, Remix");

styles [
"title-1"
]
}

SearchEntry search_entry {
search-delay: 100;
placeholder-text: _("Search demos");
activates-default: true;
width-request: 400;
margin-top: 32;
}
}

Adw.PreferencesGroup library_uncategorized {}

Adw.PreferencesGroup library_tools {
title: _("Tools");
}

Adw.PreferencesGroup library_network {
title: _("Network");
}

Adw.PreferencesGroup library_controls {
title: _("Controls");
}

Adw.PreferencesGroup library_layout {
title: _("Layout");
}

Adw.PreferencesGroup library_feedback {
title: _("Feedback");
}

Adw.PreferencesGroup library_navigation {
title: _("Navigation");
}

Adw.PreferencesGroup library_user_interface {
title: _("User Interface");
}

Adw.PreferencesGroup library_platform {
title: _("Platform APIs");
}

Adw.PreferencesGroup {
vexpand: true;
valign: end;

Label {
label: _("All examples are dedicated to the public domain\nand <b>can be used freely</b> under the terms of <a href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0 1.0</a>");
use-markup: true;

styles [
"caption"
]
}
}
content: ScrolledWindow {
hscrollbar-policy: never;

child: Adw.Clamp {
maximum-size: 576;
margin-end: 12;
margin-start: 12;

child: Box {
orientation: vertical;
spacing: 12;

Box {
orientation: vertical;

Box {
halign: center;
vexpand: false;

Picture picture_illustration {
can-shrink: false;
margin-bottom: 32;
margin-top: 24;
}
}

Label {
label: _("Learn, Test, Remix");

styles [
"title-1"
]
}

SearchEntry search_entry {
search-delay: 100;
placeholder-text: _("Search demos");
activates-default: true;
width-request: 400;
margin-top: 32;
}
}

ListBox library_uncategorized {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_tools {
label: _("Tools");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_tools {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_network {
label: _("Network");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_network {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_controls {
label: _("Controls");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_controls {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_layout {
label: _("Layout");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_layout {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_feedback {
label: _("Feedback");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_feedback {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_navigation {
label: _("Navigation");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_navigation {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_user_interface {
label: _("User Interface");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_user_interface {
selection-mode: none;

styles [
"boxed-list"
]
}

Label label_platform {
label: _("Platform APIs");
halign: start;
margin-top: 12;

styles [
"title-4"
]
}

ListBox library_platform {
selection-mode: none;

styles [
"boxed-list"
]
}

Box {
halign: center;
margin-bottom: 24;
margin-top: 12;

Label {
label: _("All examples are dedicated to the public domain\nand <b>can be used freely</b> under the terms of <a href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0 1.0</a>");
use-markup: true;

styles [
"caption"
]
}
}
};
};
};
}
}
4 changes: 3 additions & 1 deletion src/Library/Library.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function Library({ application }) {
if (!category_map.has(demo.category)) {
category_map.set(demo.category, objects[`library_${demo.category}`]);
}
objects[`library_${demo.category}`].add(entry_row);
objects[`library_${demo.category}`].append(entry_row);
widgets_map.set(demo.name, { entry_row, category: demo.category });
});

Expand All @@ -65,6 +65,8 @@ export default function Library({ application }) {
});

category_map.forEach((category_widget, category_name) => {
const label = objects[`label_${category_name}`];
if (label) label.visible = search_term === "";
category_widget.visible = visible_categories.has(category_name);
});
});
Expand Down
5 changes: 4 additions & 1 deletion src/PanelCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function PanelCode({
builder,
previewer,
session: { settings, file },
langs,
}) {
const panel_code = builder.get_object("panel_code");
const button_code = builder.get_object("button_code");
Expand Down Expand Up @@ -59,7 +60,9 @@ export default function PanelCode({
}

if (panel.language.toLowerCase() === "typescript") {
setupTypeScriptProject(file).catch(console.error);
setupTypeScriptProject(file, langs.typescript.document).catch(
console.error,
);
}
}
switchLanguage();
Expand Down
9 changes: 1 addition & 8 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,7 @@ export const languages = [
document: null,
default_file: "main.ts",
index: 4,
language_server: [
"biome",
"lsp-proxy",
// src/meson.build installs biome.json there
GLib.getenv("FLATPAK_ID")
? `--config-path=${pkg.pkgdatadir}`
: `--config-path=src/langs/typescript`,
],
language_server: ["typescript-language-server", "--stdio"],
formatting_options: {
...formatting_options,
tabSize: 2,
Expand Down
5 changes: 1 addition & 4 deletions src/langs/typescript/TypeScriptDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class TypeScriptDocument extends Document {
super(...args);

this.lspc = setup({ document: this });
this.code_view.lspc = this.lspc;
}

async format() {
Expand All @@ -25,10 +26,6 @@ export class TypeScriptDocument extends Document {
},
});

// Biome doesn't support diff - it just returns one edit
// we don't want to loose the cursor position so we use this
const state = this.code_view.saveState();
applyTextEdits(text_edits, this.buffer);
await this.code_view.restoreState(state);
}
}
Loading

0 comments on commit 07ad19a

Please sign in to comment.