mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
Rename EditorHandle -> EditorWrapper and organize editor_api.rs (#3925)
* Rename EditorHandle -> EditorWrapper and organize editor_api.rs * pub -> pub(crate)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import IconButton from "/src/components/widgets/buttons/IconButton.svelte";
|
||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||
import WidgetSpan from "/src/components/widgets/WidgetSpan.svelte";
|
||||
import type { EditorHandle, LayoutTarget, WidgetSection as WidgetSectionData } from "/wasm/pkg/graphite_wasm";
|
||||
import type { EditorWrapper, LayoutTarget, WidgetSection as WidgetSectionData } from "/wasm/pkg/graphite_wasm";
|
||||
|
||||
export let widgetData: WidgetSectionData;
|
||||
export let layoutTarget: LayoutTarget;
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
let expanded = true;
|
||||
|
||||
const editor = getContext<EditorHandle>("editor");
|
||||
const editor = getContext<EditorWrapper>("editor");
|
||||
</script>
|
||||
|
||||
<!-- TODO: Implement collapsable sections with properties system -->
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
import ShortcutLabel from "/src/components/widgets/labels/ShortcutLabel.svelte";
|
||||
import TextLabel from "/src/components/widgets/labels/TextLabel.svelte";
|
||||
import { parseFillChoice } from "/src/utility-functions/colors";
|
||||
import type { EditorHandle, LayoutTarget, Widget, WidgetInstance } from "/wasm/pkg/graphite_wasm";
|
||||
import type { EditorWrapper, LayoutTarget, Widget, WidgetInstance } from "/wasm/pkg/graphite_wasm";
|
||||
|
||||
// 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;
|
||||
@@ -32,7 +32,7 @@
|
||||
// A Widget tagged enum unwrapped into a correlated [kind, props] tuple
|
||||
type UnwrappedWidget = { [K in WidgetKind]: [kind: K, props: WidgetProps<K>] }[WidgetKind];
|
||||
|
||||
const editor = getContext<EditorHandle>("editor");
|
||||
const editor = getContext<EditorWrapper>("editor");
|
||||
|
||||
export let widgets: WidgetInstance[];
|
||||
export let direction: "row" | "column";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { PRESS_REPEAT_DELAY_MS, PRESS_REPEAT_INTERVAL_MS } from "/src/managers/input";
|
||||
import { browserVersion } from "/src/utility-functions/platform";
|
||||
import { evaluateMathExpression, isPlatformNative } from "/wasm/pkg/graphite_wasm";
|
||||
import type { ActionShortcut, EditorHandle, NumberInputIncrementBehavior, NumberInputMode } from "/wasm/pkg/graphite_wasm";
|
||||
import type { ActionShortcut, EditorWrapper, NumberInputIncrementBehavior, NumberInputMode } from "/wasm/pkg/graphite_wasm";
|
||||
|
||||
const BUTTONS_LEFT = 0b0000_0001;
|
||||
const BUTTONS_RIGHT = 0b0000_0010;
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
const dispatch = createEventDispatcher<{ value: number | undefined; startHistoryTransaction: undefined }>();
|
||||
|
||||
const editor = getContext<EditorHandle>("editor");
|
||||
const editor = getContext<EditorWrapper>("editor");
|
||||
|
||||
// Content
|
||||
/// When `value` is not provided (i.e. it's `undefined`), a dash is displayed.
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
||||
import LayoutRow from "/src/components/layout/LayoutRow.svelte";
|
||||
import { fillChoiceColor, colorToRgbaCSS } from "/src/utility-functions/colors";
|
||||
import type { Color, EditorHandle } from "/wasm/pkg/graphite_wasm";
|
||||
import type { Color, EditorWrapper } from "/wasm/pkg/graphite_wasm";
|
||||
|
||||
const editor = getContext<EditorHandle>("editor");
|
||||
const editor = getContext<EditorWrapper>("editor");
|
||||
|
||||
// Content
|
||||
export let primary: Color;
|
||||
|
||||
Reference in New Issue
Block a user