mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 04:38:11 +08:00
Rename /frontend/wasm -> /frontend/wrapper (#3927)
This commit is contained in:
@@ -32,7 +32,7 @@ let
|
|||||||
];
|
];
|
||||||
buildInputs = [ pkgs.openssl ];
|
buildInputs = [ pkgs.openssl ];
|
||||||
env.CARGO_PROFILE = if dev then "dev" else "release";
|
env.CARGO_PROFILE = if dev then "dev" else "release";
|
||||||
cargoExtraArgs = "--target wasm32-unknown-unknown -p graphite-wasm --no-default-features --features native";
|
cargoExtraArgs = "--target wasm32-unknown-unknown -p graphite-wasm-wrapper --no-default-features --features native";
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
resources = deps.crane.lib.buildPackage (
|
resources = deps.crane.lib.buildPackage (
|
||||||
|
|||||||
Generated
+1
-1
@@ -2439,7 +2439,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "graphite-wasm"
|
name = "graphite-wasm-wrapper"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"graph-craft",
|
"graph-craft",
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@ members = [
|
|||||||
"desktop/platform/mac",
|
"desktop/platform/mac",
|
||||||
"desktop/platform/win",
|
"desktop/platform/win",
|
||||||
"editor",
|
"editor",
|
||||||
"frontend/wasm",
|
"frontend/wrapper",
|
||||||
"libraries/dyn-any",
|
"libraries/dyn-any",
|
||||||
"libraries/math-parser",
|
"libraries/math-parser",
|
||||||
"node-graph/libraries/*",
|
"node-graph/libraries/*",
|
||||||
@@ -30,7 +30,7 @@ members = [
|
|||||||
]
|
]
|
||||||
default-members = [
|
default-members = [
|
||||||
"editor",
|
"editor",
|
||||||
"frontend/wasm",
|
"frontend/wrapper",
|
||||||
"libraries/dyn-any",
|
"libraries/dyn-any",
|
||||||
"libraries/math-parser",
|
"libraries/math-parser",
|
||||||
"node-graph/graph-craft",
|
"node-graph/graph-craft",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ pub mod grid_overlays;
|
|||||||
mod overlays_message;
|
mod overlays_message;
|
||||||
mod overlays_message_handler;
|
mod overlays_message_handler;
|
||||||
pub mod utility_functions;
|
pub mod utility_functions;
|
||||||
// Native (non‑wasm)
|
// Native (non‑Wasm)
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
pub mod utility_types_native;
|
pub mod utility_types_native;
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ Images that are used in components and embedded into the application bundle by t
|
|||||||
|
|
||||||
Source code for the web app in the form of Svelte components and [TypeScript](https://www.typescriptlang.org/) files.
|
Source code for the web app in the form of Svelte components and [TypeScript](https://www.typescriptlang.org/) files.
|
||||||
|
|
||||||
## WebAssembly wrapper: `wasm/`
|
## Editor wrapper: `wrapper/`
|
||||||
|
|
||||||
Wraps the editor backend codebase (`/editor`) and provides a JS-centric API for the web app to use as an entry point, unburdened by Rust's complex data types that are incompatible with JS data types. Bindings (JS functions that call into the Wasm module) are provided by [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) in concert with [wasm-pack](https://github.com/rustwasm/wasm-pack).
|
Wraps the editor backend codebase (`/editor`) and provides a JS-centric API for the web app to use as an entry point, unburdened by Rust's complex data types that are incompatible with JS data types. Bindings (JS functions that call into the Wasm module) are provided by [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) in concert with [wasm-pack](https://github.com/rustwasm/wasm-pack).
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export default defineConfig([
|
|||||||
{
|
{
|
||||||
patterns: [
|
patterns: [
|
||||||
{ group: ["./**", "../**"], message: "\nImports must be absolute (e.g. '/src/<subpath>') not relative (e.g. './<subpath>')." },
|
{ group: ["./**", "../**"], message: "\nImports must be absolute (e.g. '/src/<subpath>') not relative (e.g. './<subpath>')." },
|
||||||
{ group: ["src/**", "assets/**", "wasm/**"], message: "\nLocal imports must start with '/' (e.g. '/src/<subpath>' not 'src/<subpath>')." },
|
{ group: ["src/**", "assets/**", "wrapper/**"], message: "\nLocal imports must start with '/' (e.g. '/src/<subpath>' not 'src/<subpath>')." },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -19,12 +19,12 @@
|
|||||||
"fix": "eslint --fix",
|
"fix": "eslint --fix",
|
||||||
"---------- INTERNAL ----------": "",
|
"---------- INTERNAL ----------": "",
|
||||||
"setup": "node package-installer.js && node branding-installer.js",
|
"setup": "node package-installer.js && node branding-installer.js",
|
||||||
"native:build-dev": "wasm-pack build ./wasm --dev --target=web --no-default-features --features native && vite build --mode native",
|
"native:build-dev": "wasm-pack build ./wrapper --dev --target=web --no-default-features --features native && vite build --mode native",
|
||||||
"native:build-production": "wasm-pack build ./wasm --release --target=web --no-default-features --features native && vite build --mode native",
|
"native:build-production": "wasm-pack build ./wrapper --release --target=web --no-default-features --features native && vite build --mode native",
|
||||||
"wasm:build-dev": "wasm-pack build ./wasm --dev --target=web",
|
"wasm:build-dev": "wasm-pack build ./wrapper --dev --target=web",
|
||||||
"wasm:build-production": "wasm-pack build ./wasm --release --target=web",
|
"wasm:build-production": "wasm-pack build ./wrapper --release --target=web",
|
||||||
"wasm:watch-dev": "cargo watch --postpone --watch-when-idle --workdir=wasm --shell \"wasm-pack build . --dev --target=web -- --color=always\"",
|
"wasm:watch-dev": "cargo watch --postpone --watch-when-idle --workdir=wrapper --shell \"wasm-pack build . --dev --target=web -- --color=always\"",
|
||||||
"wasm:watch-production": "cargo watch --postpone --watch-when-idle --workdir=wasm --shell \"wasm-pack build . --release --target=web -- --color=always\""
|
"wasm:watch-production": "cargo watch --postpone --watch-when-idle --workdir=wrapper --shell \"wasm-pack build . --release --target=web -- --color=always\""
|
||||||
},
|
},
|
||||||
"//": "NOTE: `source-sans-pro` is never to be upgraded to 3.x because that renders a pixel above its intended position.",
|
"//": "NOTE: `source-sans-pro` is never to be upgraded to 3.x because that renders a pixel above its intended position.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -5,16 +5,16 @@
|
|||||||
import type { MessageName, SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { MessageName, SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { loadDemoArtwork } from "/src/utility-functions/network";
|
import { loadDemoArtwork } from "/src/utility-functions/network";
|
||||||
import { operatingSystem } from "/src/utility-functions/platform";
|
import { operatingSystem } from "/src/utility-functions/platform";
|
||||||
import init, { EditorWrapper, receiveNativeMessage } from "/wasm/pkg/graphite_wasm";
|
import init, { EditorWrapper, receiveNativeMessage } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import type { FrontendMessage } from "/wasm/pkg/graphite_wasm";
|
import type { FrontendMessage } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let subscriptions: SubscriptionsRouter | undefined = undefined;
|
let subscriptions: SubscriptionsRouter | undefined = undefined;
|
||||||
let editor: EditorWrapper | undefined = undefined;
|
let editor: EditorWrapper | undefined = undefined;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
// Initialize the Wasm module
|
// Initialize the editor wrapper
|
||||||
const wasm = await init();
|
const wrapper = await init();
|
||||||
for (const [name, f] of Object.entries(wasm)) {
|
for (const [name, f] of Object.entries(wrapper)) {
|
||||||
if (name.startsWith("__node_registry")) f();
|
if (name.startsWith("__node_registry")) f();
|
||||||
}
|
}
|
||||||
window.imageCanvases = {};
|
window.imageCanvases = {};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Svelte components that build the Graphite editor GUI from layouts, panels, widge
|
|||||||
|
|
||||||
## Managers: `managers/`
|
## Managers: `managers/`
|
||||||
|
|
||||||
TypeScript files, constructed by the editor frontend, which manage the input/output of browser APIs and link this functionality with the editor backend. These files subscribe to frontend messages to execute JS APIs, and in response to these APIs or user interactions, they may call functions in the backend (defined in `/frontend/wasm/editor_wrapper.rs`).
|
TypeScript files, constructed by the editor frontend, which manage the input/output of browser APIs and link this functionality with the editor backend. These files subscribe to frontend messages to execute JS APIs, and in response to these APIs or user interactions, they may call functions in the backend (defined in `/frontend/wrapper/editor_wrapper.rs`).
|
||||||
|
|
||||||
Each manager module stores its dependencies (like `subscriptionsRouter` and `editorWrapper`) in module-level variables and exports a `create*()` and `destroy*()` function pair. `Editor.svelte` calls each `create*()` constructor in its `onMount` and calls each `destroy*()` in its `onDestroy`. Managers replace themselves during HMR updates if they are modified live during development.
|
Each manager module stores its dependencies (like `subscriptionsRouter` and `editorWrapper`) in module-level variables and exports a `create*()` and `destroy*()` function pair. `Editor.svelte` calls each `create*()` constructor in its `onMount` and calls each `destroy*()` in its `onDestroy`. Managers replace themselves during HMR updates if they are modified live during development.
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ Associates messages from the backend with subscribers in the frontend, and route
|
|||||||
|
|
||||||
## Svelte app entry point: `App.svelte`
|
## Svelte app entry point: `App.svelte`
|
||||||
|
|
||||||
The entry point for the Svelte application. Initializes the Wasm module, creates the `EditorWrapper` backend instance and the subscriptions router, and renders `Editor.svelte` once both are ready. The `EditorWrapper` is the wasm-bindgen interface to the Rust editor backend (defined in `/frontend/wasm/editor_wrapper.rs`), providing access to callable backend functions. Both the editor and subscriptions router are passed as props to `Editor.svelte` and set as Svelte contexts for use throughout the component tree.
|
The entry point for the Svelte application. Initializes and creates the `EditorWrapper` backend instance and the subscriptions router and renders `Editor.svelte` once both are ready. The `EditorWrapper` is the wasm-bindgen interface to the Rust editor backend (defined in `/frontend/wrapper/editor_wrapper.rs`), providing access to callable backend functions. Both the editor and subscriptions router are passed as props to `Editor.svelte` and set as Svelte contexts for use throughout the component tree.
|
||||||
|
|
||||||
## Editor base instance: `Editor.svelte`
|
## Editor base instance: `Editor.svelte`
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
import { createPortfolioStore, destroyPortfolioStore } from "/src/stores/portfolio";
|
import { createPortfolioStore, destroyPortfolioStore } from "/src/stores/portfolio";
|
||||||
import { createTooltipStore, destroyTooltipStore } from "/src/stores/tooltip";
|
import { createTooltipStore, destroyTooltipStore } from "/src/stores/tooltip";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Graphite Wasm editor and subscriptions router
|
// Graphite Wasm editor and subscriptions router
|
||||||
export let subscriptions: SubscriptionsRouter;
|
export let subscriptions: SubscriptionsRouter;
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
colorEquals,
|
colorEquals,
|
||||||
gradientFirstColor,
|
gradientFirstColor,
|
||||||
} from "/src/utility-functions/colors";
|
} from "/src/utility-functions/colors";
|
||||||
import { isPlatformNative } from "/wasm/pkg/graphite_wasm";
|
import { isPlatformNative } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import type { FillChoice, MenuDirection, Color } from "/wasm/pkg/graphite_wasm";
|
import type { FillChoice, MenuDirection, Color } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
type PresetColors = "None" | "Black" | "White" | "Red" | "Yellow" | "Green" | "Cyan" | "Blue" | "Magenta";
|
type PresetColors = "None" | "Black" | "White" | "Red" | "Yellow" | "Green" | "Cyan" | "Blue" | "Magenta";
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
import Separator from "/src/components/widgets/labels/Separator.svelte";
|
import Separator from "/src/components/widgets/labels/Separator.svelte";
|
||||||
import ShortcutLabel from "/src/components/widgets/labels/ShortcutLabel.svelte";
|
import ShortcutLabel from "/src/components/widgets/labels/ShortcutLabel.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { MenuListEntry, MenuDirection } from "/wasm/pkg/graphite_wasm";
|
import type { MenuListEntry, MenuDirection } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let self: FloatingMenu | undefined;
|
let self: FloatingMenu | undefined;
|
||||||
let scroller: LayoutCol | undefined;
|
let scroller: LayoutCol | undefined;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import TextInput from "/src/components/widgets/inputs/TextInput.svelte";
|
import TextInput from "/src/components/widgets/inputs/TextInput.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { NodeGraphStore } from "/src/stores/node-graph";
|
import type { NodeGraphStore } from "/src/stores/node-graph";
|
||||||
import type { FrontendNodeType } from "/wasm/pkg/graphite_wasm";
|
import type { FrontendNodeType } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ selectNodeType: string }>();
|
const dispatch = createEventDispatcher<{ selectNodeType: string }>();
|
||||||
const nodeGraph = getContext<NodeGraphStore>("nodeGraph");
|
const nodeGraph = getContext<NodeGraphStore>("nodeGraph");
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import ShortcutLabel from "/src/components/widgets/labels/ShortcutLabel.svelte";
|
import ShortcutLabel from "/src/components/widgets/labels/ShortcutLabel.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { TooltipStore } from "/src/stores/tooltip";
|
import type { TooltipStore } from "/src/stores/tooltip";
|
||||||
import type { EditorWrapper, LabeledShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, LabeledShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const tooltip = getContext<TooltipStore>("tooltip");
|
const tooltip = getContext<TooltipStore>("tooltip");
|
||||||
const editor = getContext<EditorWrapper>("editor");
|
const editor = getContext<EditorWrapper>("editor");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
import { onMount, onDestroy, afterUpdate, createEventDispatcher, tick } from "svelte";
|
import { onMount, onDestroy, afterUpdate, createEventDispatcher, tick } from "svelte";
|
||||||
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
||||||
import { browserVersion } from "/src/utility-functions/platform";
|
import { browserVersion } from "/src/utility-functions/platform";
|
||||||
import type { MenuDirection } from "/wasm/pkg/graphite_wasm";
|
import type { MenuDirection } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const BUTTON_LEFT = 0;
|
const BUTTON_LEFT = 0;
|
||||||
const POINTER_STRAY_DISTANCE = 100;
|
const POINTER_STRAY_DISTANCE = 100;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let className = "";
|
let className = "";
|
||||||
export { className as class };
|
export { className as class };
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let className = "";
|
let className = "";
|
||||||
export { className as class };
|
export { className as class };
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import type { Layout } from "/wasm/pkg/graphite_wasm";
|
import type { Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import { textInputCleanup } from "/src/utility-functions/keyboard-entry";
|
import { textInputCleanup } from "/src/utility-functions/keyboard-entry";
|
||||||
import { rasterizeSVGCanvas } from "/src/utility-functions/rasterization";
|
import { rasterizeSVGCanvas } from "/src/utility-functions/rasterization";
|
||||||
import { setupViewportResizeObserver } from "/src/utility-functions/viewports";
|
import { setupViewportResizeObserver } from "/src/utility-functions/viewports";
|
||||||
import type { Color, EditorWrapper, MenuDirection, MouseCursorIcon } from "/wasm/pkg/graphite_wasm";
|
import type { Color, EditorWrapper, MenuDirection, MouseCursorIcon } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let rulerHorizontal: RulerInput | undefined;
|
let rulerHorizontal: RulerInput | undefined;
|
||||||
let rulerVertical: RulerInput | undefined;
|
let rulerVertical: RulerInput | undefined;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import { pasteFile } from "/src/utility-functions/files";
|
import { pasteFile } from "/src/utility-functions/files";
|
||||||
import { operatingSystem } from "/src/utility-functions/platform";
|
import { operatingSystem } from "/src/utility-functions/platform";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import type { EditorWrapper, LayerPanelEntry, LayerStructureEntry, Layout } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, LayerPanelEntry, LayerStructureEntry, Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
type LayerListingInfo = {
|
type LayerListingInfo = {
|
||||||
folderIndex: number;
|
folderIndex: number;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import type { Layout } from "/wasm/pkg/graphite_wasm";
|
import type { Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { pasteFile } from "/src/utility-functions/files";
|
import { pasteFile } from "/src/utility-functions/files";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import { isPlatformNative } from "/wasm/pkg/graphite_wasm";
|
import { isPlatformNative } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import type { EditorWrapper, Layout } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
||||||
const editor = getContext<EditorWrapper>("editor");
|
const editor = getContext<EditorWrapper>("editor");
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
import type { DocumentStore } from "/src/stores/document";
|
import type { DocumentStore } from "/src/stores/document";
|
||||||
import type { NodeGraphStore } from "/src/stores/node-graph";
|
import type { NodeGraphStore } from "/src/stores/node-graph";
|
||||||
import { closeContextMenu } from "/src/stores/node-graph";
|
import { closeContextMenu } from "/src/stores/node-graph";
|
||||||
import type { EditorWrapper, FrontendGraphInput, FrontendGraphOutput, FrontendNode } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, FrontendGraphInput, FrontendGraphOutput, FrontendNode } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const GRID_COLLAPSE_SPACING = 10;
|
const GRID_COLLAPSE_SPACING = 10;
|
||||||
const GRID_SIZE = 24;
|
const GRID_SIZE = 24;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import WidgetSection from "/src/components/widgets/WidgetSection.svelte";
|
import WidgetSection from "/src/components/widgets/WidgetSection.svelte";
|
||||||
import WidgetSpan from "/src/components/widgets/WidgetSpan.svelte";
|
import WidgetSpan from "/src/components/widgets/WidgetSpan.svelte";
|
||||||
import WidgetTable from "/src/components/widgets/WidgetTable.svelte";
|
import WidgetTable from "/src/components/widgets/WidgetTable.svelte";
|
||||||
import type { Layout, LayoutTarget } from "/wasm/pkg/graphite_wasm";
|
import type { Layout, LayoutTarget } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export let layout: Layout;
|
export let layout: Layout;
|
||||||
export let layoutTarget: LayoutTarget;
|
export let layoutTarget: LayoutTarget;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import IconButton from "/src/components/widgets/buttons/IconButton.svelte";
|
import IconButton from "/src/components/widgets/buttons/IconButton.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import WidgetSpan from "/src/components/widgets/WidgetSpan.svelte";
|
import WidgetSpan from "/src/components/widgets/WidgetSpan.svelte";
|
||||||
import type { EditorWrapper, LayoutTarget, WidgetSection as WidgetSectionData } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, LayoutTarget, WidgetSection as WidgetSectionData } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export let widgetData: WidgetSectionData;
|
export let widgetData: WidgetSectionData;
|
||||||
export let layoutTarget: LayoutTarget;
|
export let layoutTarget: LayoutTarget;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
import ShortcutLabel from "/src/components/widgets/labels/ShortcutLabel.svelte";
|
import ShortcutLabel from "/src/components/widgets/labels/ShortcutLabel.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import { parseFillChoice } from "/src/utility-functions/colors";
|
import { parseFillChoice } from "/src/utility-functions/colors";
|
||||||
import type { EditorWrapper, LayoutTarget, Widget, WidgetInstance } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, LayoutTarget, Widget, WidgetInstance } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Extract the discriminant key names from the Widget tagged enum union (e.g. "TextButton" | "CheckboxInput" | ...)
|
// Extract the discriminant key names from the Widget tagged enum union (e.g. "TextButton" | "CheckboxInput" | ...)
|
||||||
type WidgetKind = Widget extends infer T ? (T extends Record<infer K, unknown> ? K & string : never) : never;
|
type WidgetKind = Widget extends infer T ? (T extends Record<infer K, unknown> ? K & string : never) : never;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import WidgetSpan from "/src/components/widgets/WidgetSpan.svelte";
|
import WidgetSpan from "/src/components/widgets/WidgetSpan.svelte";
|
||||||
import type { LayoutTarget, WidgetTable } from "/wasm/pkg/graphite_wasm";
|
import type { LayoutTarget, WidgetTable } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export let widgetData: WidgetTable;
|
export let widgetData: WidgetTable;
|
||||||
export let layoutTarget: LayoutTarget;
|
export let layoutTarget: LayoutTarget;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import TextButton from "/src/components/widgets/buttons/TextButton.svelte";
|
import TextButton from "/src/components/widgets/buttons/TextButton.svelte";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
export let labels: string[];
|
export let labels: string[];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
||||||
import type { IconName, IconSize } from "/src/icons";
|
import type { IconName, IconSize } from "/src/icons";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
export let icon: IconName;
|
export let icon: IconName;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { IMAGE_BASE64_STRINGS } from "/src/utility-functions/images";
|
import { IMAGE_BASE64_STRINGS } from "/src/utility-functions/images";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let className = "";
|
let className = "";
|
||||||
export { className as class };
|
export { className as class };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import type { FrontendGraphDataType, ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { FrontendGraphDataType, ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
export let exposed: boolean;
|
export let exposed: boolean;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
||||||
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
||||||
import type { IconName, PopoverButtonStyle } from "/src/icons";
|
import type { IconName, PopoverButtonStyle } from "/src/icons";
|
||||||
import type { MenuDirection, ActionShortcut, Layout, LayoutTarget } from "/wasm/pkg/graphite_wasm";
|
import type { MenuDirection, ActionShortcut, Layout, LayoutTarget } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export let layoutTarget: LayoutTarget;
|
export let layoutTarget: LayoutTarget;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { IconName } from "/src/icons";
|
import type { IconName } from "/src/icons";
|
||||||
import type { MenuListEntry, ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { MenuListEntry, ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ selectedEntryValuePath: string[] }>();
|
const dispatch = createEventDispatcher<{ selectedEntryValuePath: string[] }>();
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
||||||
import type { IconName } from "/src/icons";
|
import type { IconName } from "/src/icons";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ checked: boolean }>();
|
const dispatch = createEventDispatcher<{ checked: boolean }>();
|
||||||
const backupId = String(Math.random()).substring(2);
|
const backupId = String(Math.random()).substring(2);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import ColorPicker from "/src/components/floating-menus/ColorPicker.svelte";
|
import ColorPicker from "/src/components/floating-menus/ColorPicker.svelte";
|
||||||
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
||||||
import { contrastingOutlineFactor, fillChoiceColor, fillChoiceGradientStops, colorToHexOptionalAlpha, gradientToLinearGradientCSS } from "/src/utility-functions/colors";
|
import { contrastingOutlineFactor, fillChoiceColor, fillChoiceGradientStops, colorToHexOptionalAlpha, gradientToLinearGradientCSS } from "/src/utility-functions/colors";
|
||||||
import type { FillChoice, MenuDirection, ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { FillChoice, MenuDirection, ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ value: FillChoice; startHistoryTransaction: undefined }>();
|
const dispatch = createEventDispatcher<{ value: FillChoice; startHistoryTransaction: undefined }>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import type { Curve, CurveManipulatorGroup, ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { Curve, CurveManipulatorGroup, ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{
|
const dispatch = createEventDispatcher<{
|
||||||
value: Curve;
|
value: Curve;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { MenuListEntry, ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { MenuListEntry, ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const DASH_ENTRY: MenuListEntry = {
|
const DASH_ENTRY: MenuListEntry = {
|
||||||
value: "",
|
value: "",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { preventEscapeClosingParentFloatingMenu } from "/src/components/layout/FloatingMenu.svelte";
|
import { preventEscapeClosingParentFloatingMenu } from "/src/components/layout/FloatingMenu.svelte";
|
||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import { operatingSystem } from "/src/utility-functions/platform";
|
import { operatingSystem } from "/src/utility-functions/platform";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{
|
const dispatch = createEventDispatcher<{
|
||||||
value: string;
|
value: string;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
||||||
import { PRESS_REPEAT_DELAY_MS, PRESS_REPEAT_INTERVAL_MS } from "/src/managers/input";
|
import { PRESS_REPEAT_DELAY_MS, PRESS_REPEAT_INTERVAL_MS } from "/src/managers/input";
|
||||||
import { browserVersion } from "/src/utility-functions/platform";
|
import { browserVersion } from "/src/utility-functions/platform";
|
||||||
import { evaluateMathExpression, isPlatformNative } from "/wasm/pkg/graphite_wasm";
|
import { evaluateMathExpression, isPlatformNative } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import type { ActionShortcut, EditorWrapper, NumberInputIncrementBehavior, NumberInputMode } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut, EditorWrapper, NumberInputIncrementBehavior, NumberInputMode } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const BUTTONS_LEFT = 0b0000_0001;
|
const BUTTONS_LEFT = 0b0000_0001;
|
||||||
const BUTTONS_RIGHT = 0b0000_0010;
|
const BUTTONS_RIGHT = 0b0000_0010;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
import IconLabel from "/src/components/widgets/labels/IconLabel.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { RadioEntryData } from "/wasm/pkg/graphite_wasm";
|
import type { RadioEntryData } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ selectedIndex: number }>();
|
const dispatch = createEventDispatcher<{ selectedIndex: number }>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import type { ReferencePoint, ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ReferencePoint, ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ value: ReferencePoint }>();
|
const dispatch = createEventDispatcher<{ value: ReferencePoint }>();
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import { colorToHexOptionalAlpha, colorToRgbCSS, gradientFirstColor, gradientLastColor, gradientToLinearGradientCSS } from "/src/utility-functions/colors";
|
import { colorToHexOptionalAlpha, colorToRgbCSS, gradientFirstColor, gradientLastColor, gradientToLinearGradientCSS } from "/src/utility-functions/colors";
|
||||||
import { evaluateGradientAtPosition } from "/wasm/pkg/graphite_wasm";
|
import { evaluateGradientAtPosition } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import type { Color, GradientStops } from "/wasm/pkg/graphite_wasm";
|
import type { Color, GradientStops } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const BUTTON_LEFT = 0;
|
const BUTTON_LEFT = 0;
|
||||||
const BUTTON_RIGHT = 2;
|
const BUTTON_RIGHT = 2;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ commitText: string }>();
|
const dispatch = createEventDispatcher<{ commitText: string }>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ commitText: string }>();
|
const dispatch = createEventDispatcher<{ commitText: string }>();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import { fillChoiceColor, colorToRgbaCSS } from "/src/utility-functions/colors";
|
import { fillChoiceColor, colorToRgbaCSS } from "/src/utility-functions/colors";
|
||||||
import type { Color, EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { Color, EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const editor = getContext<EditorWrapper>("editor");
|
const editor = getContext<EditorWrapper>("editor");
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import { ICONS, ICON_SVG_STRINGS } from "/src/icons";
|
import { ICONS, ICON_SVG_STRINGS } from "/src/icons";
|
||||||
import type { IconName } from "/src/icons";
|
import type { IconName } from "/src/icons";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let className = "";
|
let className = "";
|
||||||
export { className as class };
|
export { className as class };
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let className = "";
|
let className = "";
|
||||||
export { className as class };
|
export { className as class };
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { SeparatorDirection, SeparatorStyle } from "/wasm/pkg/graphite_wasm";
|
import type { SeparatorDirection, SeparatorStyle } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
export let direction: SeparatorDirection = "Horizontal";
|
export let direction: SeparatorDirection = "Horizontal";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { IconName } from "/src/icons";
|
import type { IconName } from "/src/icons";
|
||||||
import { operatingSystem } from "/src/utility-functions/platform";
|
import { operatingSystem } from "/src/utility-functions/platform";
|
||||||
import type { ActionShortcut, Key, LabeledShortcut, MouseMotion } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut, Key, LabeledShortcut, MouseMotion } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
export let shortcut: ActionShortcut;
|
export let shortcut: ActionShortcut;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from "svelte";
|
import { onMount, onDestroy } from "svelte";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let className = "";
|
let className = "";
|
||||||
export { className as class };
|
export { className as class };
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import type { AppWindowStore } from "/src/stores/app-window";
|
import type { AppWindowStore } from "/src/stores/app-window";
|
||||||
import type { DialogStore } from "/src/stores/dialog";
|
import type { DialogStore } from "/src/stores/dialog";
|
||||||
import type { TooltipStore } from "/src/stores/tooltip";
|
import type { TooltipStore } from "/src/stores/tooltip";
|
||||||
import { isPlatformNative } from "/wasm/pkg/graphite_wasm";
|
import { isPlatformNative } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const dialog = getContext<DialogStore>("dialog");
|
const dialog = getContext<DialogStore>("dialog");
|
||||||
const tooltip = getContext<TooltipStore>("tooltip");
|
const tooltip = getContext<TooltipStore>("tooltip");
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
import Welcome from "/src/components/panels/Welcome.svelte";
|
import Welcome from "/src/components/panels/Welcome.svelte";
|
||||||
import IconButton from "/src/components/widgets/buttons/IconButton.svelte";
|
import IconButton from "/src/components/widgets/buttons/IconButton.svelte";
|
||||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
type PanelType = keyof typeof PANEL_COMPONENTS;
|
type PanelType = keyof typeof PANEL_COMPONENTS;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import type { Layout } from "/wasm/pkg/graphite_wasm";
|
import type { Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
import type { TooltipStore } from "/src/stores/tooltip";
|
import type { TooltipStore } from "/src/stores/tooltip";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import type { EditorWrapper, Layout } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import { isPlatformNative } from "/wasm/pkg/graphite_wasm";
|
import { isPlatformNative } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const keyboardLockApiSupported = navigator.keyboard !== undefined && "lock" in navigator.keyboard;
|
const keyboardLockApiSupported = navigator.keyboard !== undefined && "lock" in navigator.keyboard;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||||
import Panel from "/src/components/window/Panel.svelte";
|
import Panel from "/src/components/window/Panel.svelte";
|
||||||
import type { PortfolioStore } from "/src/stores/portfolio";
|
import type { PortfolioStore } from "/src/stores/portfolio";
|
||||||
import type { EditorWrapper, OpenDocument } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, OpenDocument } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const MIN_PANEL_SIZE = 100;
|
const MIN_PANEL_SIZE = 100;
|
||||||
const PANEL_SIZES = {
|
const PANEL_SIZES = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { insertAtCaret, readAtCaret } from "/src/utility-functions/clipboard";
|
import { insertAtCaret, readAtCaret } from "/src/utility-functions/clipboard";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let subscriptionsRouter: SubscriptionsRouter | undefined = undefined;
|
let subscriptionsRouter: SubscriptionsRouter | undefined = undefined;
|
||||||
let editorWrapper: EditorWrapper | undefined = undefined;
|
let editorWrapper: EditorWrapper | undefined = undefined;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
type ApiResponse = { family: string; variants: string[]; files: Record<string, string> }[];
|
type ApiResponse = { family: string; variants: string[]; files: Record<string, string> }[];
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
onPaste,
|
onPaste,
|
||||||
onPointerLockChange,
|
onPointerLockChange,
|
||||||
} from "/src/utility-functions/input";
|
} from "/src/utility-functions/input";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
type EventName = keyof HTMLElementEventMap | keyof WindowEventHandlersEventMap | "modifyinputfield" | "pointerlockchange" | "pointerlockerror";
|
type EventName = keyof HTMLElementEventMap | keyof WindowEventHandlersEventMap | "modifyinputfield" | "pointerlockchange" | "pointerlockerror";
|
||||||
type EventListenerTarget = {
|
type EventListenerTarget = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { localizeTimestamp } from "/src/utility-functions/time";
|
import { localizeTimestamp } from "/src/utility-functions/time";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let subscriptionsRouter: SubscriptionsRouter | undefined = undefined;
|
let subscriptionsRouter: SubscriptionsRouter | undefined = undefined;
|
||||||
let editorWrapper: EditorWrapper | undefined = undefined;
|
let editorWrapper: EditorWrapper | undefined = undefined;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { PortfolioStore } from "/src/stores/portfolio";
|
import type { PortfolioStore } from "/src/stores/portfolio";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { saveEditorPreferences, loadEditorPreferences, storeDocument, removeDocument, loadFirstDocument, loadRestDocuments, saveActiveDocument } from "/src/utility-functions/persistence";
|
import { saveEditorPreferences, loadEditorPreferences, storeDocument, removeDocument, loadFirstDocument, loadRestDocuments, saveActiveDocument } from "/src/utility-functions/persistence";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
let subscriptionsRouter: SubscriptionsRouter | undefined = undefined;
|
let subscriptionsRouter: SubscriptionsRouter | undefined = undefined;
|
||||||
let editorWrapper: EditorWrapper | undefined = undefined;
|
let editorWrapper: EditorWrapper | undefined = undefined;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import type { AppWindowPlatform } from "/wasm/pkg/graphite_wasm";
|
import type { AppWindowPlatform } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export type AppWindowStore = ReturnType<typeof createAppWindowStore>;
|
export type AppWindowStore = ReturnType<typeof createAppWindowStore>;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { Writable } from "svelte/store";
|
|||||||
import type { IconName } from "/src/icons";
|
import type { IconName } from "/src/icons";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import type { EditorWrapper, Layout } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export type DialogStore = ReturnType<typeof createDialogStore>;
|
export type DialogStore = ReturnType<typeof createDialogStore>;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { writable } from "svelte/store";
|
|||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { patchLayout } from "/src/utility-functions/widgets";
|
import { patchLayout } from "/src/utility-functions/widgets";
|
||||||
import type { Layout } from "/wasm/pkg/graphite_wasm";
|
import type { Layout } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export type DocumentStore = ReturnType<typeof createDocumentStore>;
|
export type DocumentStore = ReturnType<typeof createDocumentStore>;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { writable } from "svelte/store";
|
|||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import type { MessageBody } from "/src/subscriptions-router";
|
import type { MessageBody } from "/src/subscriptions-router";
|
||||||
import type { NodeGraphErrorDiagnostic, BoxSelection, FrontendClickTargets, ContextMenuInformation, FrontendNode, FrontendNodeType, WirePath } from "/wasm/pkg/graphite_wasm";
|
import type { NodeGraphErrorDiagnostic, BoxSelection, FrontendClickTargets, ContextMenuInformation, FrontendNode, FrontendNodeType, WirePath } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export type NodeGraphStore = ReturnType<typeof createNodeGraphStore>;
|
export type NodeGraphStore = ReturnType<typeof createNodeGraphStore>;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { Writable } from "svelte/store";
|
|||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { downloadFile, downloadFileBlob, upload } from "/src/utility-functions/files";
|
import { downloadFile, downloadFileBlob, upload } from "/src/utility-functions/files";
|
||||||
import { rasterizeSVG } from "/src/utility-functions/rasterization";
|
import { rasterizeSVG } from "/src/utility-functions/rasterization";
|
||||||
import type { EditorWrapper, OpenDocument } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper, OpenDocument } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export type PortfolioStore = ReturnType<typeof createPortfolioStore>;
|
export type PortfolioStore = ReturnType<typeof createPortfolioStore>;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { writable } from "svelte/store";
|
|||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||||
import { operatingSystem } from "/src/utility-functions/platform";
|
import { operatingSystem } from "/src/utility-functions/platform";
|
||||||
import type { ActionShortcut } from "/wasm/pkg/graphite_wasm";
|
import type { ActionShortcut } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export type TooltipStore = ReturnType<typeof createTooltipStore>;
|
export type TooltipStore = ReturnType<typeof createTooltipStore>;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { FrontendMessage, LayoutTarget, WidgetDiff } from "/wasm/pkg/graphite_wasm";
|
import type { FrontendMessage, LayoutTarget, WidgetDiff } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Type convert a union of messages into a map of messages
|
// Type convert a union of messages into a map of messages
|
||||||
export type ToMessageMap<T> = {
|
export type ToMessageMap<T> = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { extractPixelData } from "/src/utility-functions/rasterization";
|
import { extractPixelData } from "/src/utility-functions/rasterization";
|
||||||
import { stripIndents } from "/src/utility-functions/strip-indents";
|
import { stripIndents } from "/src/utility-functions/strip-indents";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export function readAtCaret(cut: boolean): string | undefined {
|
export function readAtCaret(cut: boolean): string | undefined {
|
||||||
const element = window.document.activeElement;
|
const element = window.document.activeElement;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { sampleInterpolatedGradient } from "/wasm/pkg/graphite_wasm";
|
import { sampleInterpolatedGradient } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import type { Color, FillChoice, GradientStops } from "/wasm/pkg/graphite_wasm";
|
import type { Color, FillChoice, GradientStops } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
// Channels can have any range (0-1, 0-255, 0-100, 0-360) in the context they are being used in, these are just containers for the numbers
|
// Channels can have any range (0-1, 0-255, 0-100, 0-360) in the context they are being used in, these are just containers for the numbers
|
||||||
export type HSV = { h: number; s: number; v: number };
|
export type HSV = { h: number; s: number; v: number };
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { extractPixelData } from "/src/utility-functions/rasterization";
|
import { extractPixelData } from "/src/utility-functions/rasterization";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export function downloadFileURL(filename: string, url: string) {
|
export function downloadFileURL(filename: string, url: string) {
|
||||||
const element = document.createElement("a");
|
const element = document.createElement("a");
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import type { PortfolioStore } from "/src/stores/portfolio";
|
|||||||
import { pasteFile } from "/src/utility-functions/files";
|
import { pasteFile } from "/src/utility-functions/files";
|
||||||
import { makeKeyboardModifiersBitfield, textInputCleanup, getLocalizedScanCode } from "/src/utility-functions/keyboard-entry";
|
import { makeKeyboardModifiersBitfield, textInputCleanup, getLocalizedScanCode } from "/src/utility-functions/keyboard-entry";
|
||||||
import { operatingSystem } from "/src/utility-functions/platform";
|
import { operatingSystem } from "/src/utility-functions/platform";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
import { isPlatformNative } from "/wasm/pkg/graphite_wasm";
|
import { isPlatformNative } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const BUTTON_LEFT = 0;
|
const BUTTON_LEFT = 0;
|
||||||
const BUTTON_MIDDLE = 1;
|
const BUTTON_MIDDLE = 1;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export type RequestResult = { body: string; status: number };
|
export type RequestResult = { body: string; status: number };
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as idb from "idb-keyval";
|
|||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
import type { PortfolioStore } from "/src/stores/portfolio";
|
import type { PortfolioStore } from "/src/stores/portfolio";
|
||||||
import type { MessageBody } from "/src/subscriptions-router";
|
import type { MessageBody } from "/src/subscriptions-router";
|
||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export async function storeCurrentDocumentId(documentId: string) {
|
export async function storeCurrentDocumentId(documentId: string) {
|
||||||
const indexedDbStorage = idb.createStore("graphite", "store");
|
const indexedDbStorage = idb.createStore("graphite", "store");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
export function setupViewportResizeObserver(editor: EditorWrapper): () => void {
|
export function setupViewportResizeObserver(editor: EditorWrapper): () => void {
|
||||||
const viewports = Array.from(window.document.querySelectorAll("[data-viewport-container]"));
|
const viewports = Array.from(window.document.querySelectorAll("[data-viewport-container]"));
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Layout, LayoutGroup, WidgetDiff, WidgetInstance } from "/wasm/pkg/graphite_wasm";
|
import type { Layout, LayoutGroup, WidgetDiff, WidgetInstance } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
type UIItem = Layout | LayoutGroup | WidgetInstance[] | WidgetInstance;
|
type UIItem = Layout | LayoutGroup | WidgetInstance[] | WidgetInstance;
|
||||||
// Updates a widget layout based on a list of updates, giving the new layout by mutating the `layout` argument
|
// Updates a widget layout based on a list of updates, giving the new layout by mutating the `layout` argument
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-wasm"
|
name = "graphite-wasm-wrapper"
|
||||||
publish = false
|
publish = false
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
rust-version = "1.88"
|
rust-version = "1.88"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Overview of `/frontend/wasm/`
|
# Overview of `/frontend/wrapper/`
|
||||||
|
|
||||||
## Wasm wrapper API: `src/editor_wrapper.rs`
|
## Wasm wrapper API: `src/editor_wrapper.rs`
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ fastnoise-lite = { workspace = true, optional = true }
|
|||||||
serde = { workspace = true, optional = true }
|
serde = { workspace = true, optional = true }
|
||||||
kurbo = { workspace = true, optional = true }
|
kurbo = { workspace = true, optional = true }
|
||||||
|
|
||||||
# Workspace wasm dependencies
|
# Workspace Wasm dependencies
|
||||||
tsify = { workspace = true, optional = true }
|
tsify = { workspace = true, optional = true }
|
||||||
wasm-bindgen = { workspace = true, optional = true }
|
wasm-bindgen = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Graphite is built from several main software components. New developers may choo
|
|||||||
|
|
||||||
*Location: [`/frontend/src`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/src)*
|
*Location: [`/frontend/src`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/src)*
|
||||||
|
|
||||||
The frontend is the GUI for Graphite which users see and interact with. It is built using web technologies with TypeScript and Svelte (HTML and SCSS). The frontend's philosophy is to be as lightweight and minimal as possible. It acts as the entry point for user input and then quickly hands off its work to the WebAssembly editor backend via its [Wasm wrapper API](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/wasm). That API is written in Rust but has TypeScript bindings generated by the [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) tooling that is part of the Vite-based build toolchain. The frontend is built of many [components](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/src/components) that recursively form the window, panels, and widgets that make up the user interface.
|
The frontend is the GUI for Graphite which users see and interact with. It is built using web technologies with TypeScript and Svelte (HTML and SCSS). The frontend's philosophy is to be as lightweight and minimal as possible. It acts as the entry point for user input and then quickly hands off its work to the WebAssembly editor backend via its [Wasm wrapper API](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/wrapper). That API is written in Rust but has TypeScript bindings generated by the [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) tooling that is part of the Vite-based build toolchain. The frontend is built of many [components](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/src/components) that recursively form the window, panels, and widgets that make up the user interface.
|
||||||
|
|
||||||
### Editor
|
### Editor
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ This diagram shows the structure of the crates that comprise the Graphite codeba
|
|||||||
|
|
||||||
## Frontend/backend communication
|
## Frontend/backend communication
|
||||||
|
|
||||||
Frontend-to-backend communication is achieved through a thin Rust translation layer in [`/frontend/wasm/src/editor_wrapper.rs`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/wasm/src/editor_wrapper.rs) which wraps the editor backend's Rust-based message system API and provides the TypeScript-compatible API of callable functions. These wrapper functions are compiled by [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) into autogenerated TS functions that serve as an entry point from TS into the Wasm binary.
|
Frontend-to-backend communication is achieved through a thin Rust translation layer in [`/frontend/wrapper/src/editor_wrapper.rs`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/wrapper/src/editor_wrapper.rs) which wraps the editor backend's Rust-based message system API and provides the TypeScript-compatible API of callable functions. These wrapper functions are compiled by [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) into autogenerated TS functions that serve as an entry point from TS into the Wasm binary.
|
||||||
|
|
||||||
Backend-to-frontend communication happens by sending a queue of messages to the frontend message dispatcher. After the TS has called any wrapper API function to get into backend code execution, the editor's business logic runs and queues up each [`FrontendMessage`](https://github.com/GraphiteEditor/Graphite/tree/master/editor/src/messages/frontend/frontend_message.rs) which get mapped from Rust to JavaScript data structures in [`/frontend/src/messages.ts`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/src/messages.ts). Various TS code subscribes to these messages by calling:
|
Backend-to-frontend communication happens by sending a queue of messages to the frontend message dispatcher. After the TS has called any wrapper API function to get into backend code execution, the editor's business logic runs and queues up each [`FrontendMessage`](https://github.com/GraphiteEditor/Graphite/tree/master/editor/src/messages/frontend/frontend_message.rs) which get mapped from Rust to JavaScript data structures in [`/frontend/src/messages.ts`](https://github.com/GraphiteEditor/Graphite/tree/master/frontend/src/messages.ts). Various TS code subscribes to these messages by calling:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user