mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-09 21:20:56 +08:00
Replace TS relative @ import path (#1087)
Migrated the import shortcut used in Svelte from @ to @graphite for better future package compatibility Co-authored-by: Andre Roelofs <andreroelofsai@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Andre Roelofs
Keavon Chambers
parent
f910b45a5b
commit
5759600f95
@@ -1,7 +1,7 @@
|
||||
import { WasmBezier } from "@/../wasm/pkg";
|
||||
import bezierFeatures, { BezierFeatureKey } from "@/features/bezier-features";
|
||||
import { renderDemo } from "@/utils/render";
|
||||
import { getConstructorKey, getCurveType, BezierCallback, BezierCurveType, InputOption, WasmBezierManipulatorKey, Demo } from "@/utils/types";
|
||||
import { WasmBezier } from "@graphite/../wasm/pkg";
|
||||
import bezierFeatures, { BezierFeatureKey } from "@graphite/features/bezier-features";
|
||||
import { renderDemo } from "@graphite/utils/render";
|
||||
import { getConstructorKey, getCurveType, BezierCallback, BezierCurveType, InputOption, WasmBezierManipulatorKey, Demo } from "@graphite/utils/types";
|
||||
|
||||
const SELECTABLE_RANGE = 10;
|
||||
|
||||
@@ -54,7 +54,7 @@ class BezierDemo extends HTMLElement implements Demo {
|
||||
this.render();
|
||||
|
||||
const figure = this.querySelector("figure") as HTMLElement;
|
||||
const wasm = await import("@/../wasm/pkg");
|
||||
const wasm = await import("@graphite/../wasm/pkg");
|
||||
this.bezier = wasm.WasmBezier[getConstructorKey(curveType)](this.points);
|
||||
this.drawDemo(figure);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import bezierFeatures, { BezierFeatureKey } from "@/features/bezier-features";
|
||||
import { renderDemoPane } from "@/utils/render";
|
||||
import { BezierCurveType, BEZIER_CURVE_TYPE, BezierDemoOptions, InputOption, Demo, DemoPane, BezierDemoArgs } from "@/utils/types";
|
||||
import bezierFeatures, { BezierFeatureKey } from "@graphite/features/bezier-features";
|
||||
import { renderDemoPane } from "@graphite/utils/render";
|
||||
import { BezierCurveType, BEZIER_CURVE_TYPE, BezierDemoOptions, InputOption, Demo, DemoPane, BezierDemoArgs } from "@graphite/utils/types";
|
||||
|
||||
const demoDefaults = {
|
||||
Linear: {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { WasmSubpath } from "@/../wasm/pkg";
|
||||
import subpathFeatures, { SubpathFeatureKey } from "@/features/subpath-features";
|
||||
import { renderDemo } from "@/utils/render";
|
||||
import { WasmSubpath } from "@graphite/../wasm/pkg";
|
||||
import subpathFeatures, { SubpathFeatureKey } from "@graphite/features/subpath-features";
|
||||
import { renderDemo } from "@graphite/utils/render";
|
||||
|
||||
import { SubpathCallback, WasmSubpathInstance, WasmSubpathManipulatorKey, InputOption } from "@/utils/types";
|
||||
import { SubpathCallback, WasmSubpathInstance, WasmSubpathManipulatorKey, InputOption } from "@graphite/utils/types";
|
||||
|
||||
const SELECTABLE_RANGE = 10;
|
||||
const POINT_INDEX_TO_MANIPULATOR: WasmSubpathManipulatorKey[] = ["set_anchor", "set_in_handle", "set_out_handle"];
|
||||
@@ -48,7 +48,7 @@ class SubpathDemo extends HTMLElement {
|
||||
this.render();
|
||||
|
||||
const figure = this.querySelector("figure") as HTMLElement;
|
||||
const wasm = await import("@/../wasm/pkg");
|
||||
const wasm = await import("@graphite/../wasm/pkg");
|
||||
this.subpath = wasm.WasmSubpath.from_triples(this.triples, this.closed) as WasmSubpathInstance;
|
||||
this.drawDemo(figure);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import subpathFeatures, { SubpathFeatureKey } from "@/features/subpath-features";
|
||||
import { renderDemoPane } from "@/utils/render";
|
||||
import { Demo, DemoPane, InputOption, SubpathDemoArgs } from "@/utils/types";
|
||||
import subpathFeatures, { SubpathFeatureKey } from "@graphite/features/subpath-features";
|
||||
import { renderDemoPane } from "@graphite/utils/render";
|
||||
import { Demo, DemoPane, InputOption, SubpathDemoArgs } from "@graphite/utils/types";
|
||||
|
||||
class SubpathDemoPane extends HTMLElement implements DemoPane {
|
||||
// Props
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { WasmBezier } from "@/../wasm/pkg";
|
||||
import { tSliderOptions, bezierTValueVariantOptions, errorOptions, minimumSeparationOptions } from "@/utils/options";
|
||||
import { BezierDemoOptions, WasmBezierInstance, BezierCallback, InputOption, BEZIER_T_VALUE_VARIANTS } from "@/utils/types";
|
||||
import { WasmBezier } from "@graphite/../wasm/pkg";
|
||||
import { tSliderOptions, bezierTValueVariantOptions, errorOptions, minimumSeparationOptions } from "@graphite/utils/options";
|
||||
import { BezierDemoOptions, WasmBezierInstance, BezierCallback, InputOption, BEZIER_T_VALUE_VARIANTS } from "@graphite/utils/types";
|
||||
|
||||
const bezierFeatures = {
|
||||
constructor: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { tSliderOptions, subpathTValueVariantOptions, intersectionErrorOptions, minimumSeparationOptions } from "@/utils/options";
|
||||
import { InputOption, SubpathCallback, WasmSubpathInstance, SUBPATH_T_VALUE_VARIANTS } from "@/utils/types";
|
||||
import { tSliderOptions, subpathTValueVariantOptions, intersectionErrorOptions, minimumSeparationOptions } from "@graphite/utils/options";
|
||||
import { InputOption, SubpathCallback, WasmSubpathInstance, SUBPATH_T_VALUE_VARIANTS } from "@graphite/utils/types";
|
||||
|
||||
const subpathFeatures = {
|
||||
constructor: {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import BezierDemo from "@/components/BezierDemo";
|
||||
import BezierDemoPane from "@/components/BezierDemoPane";
|
||||
import SubpathDemo from "@/components/SubpathDemo";
|
||||
import SubpathDemoPane from "@/components/SubpathDemoPane";
|
||||
import BezierDemo from "@graphite/components/BezierDemo";
|
||||
import BezierDemoPane from "@graphite/components/BezierDemoPane";
|
||||
import SubpathDemo from "@graphite/components/SubpathDemo";
|
||||
import SubpathDemoPane from "@graphite/components/SubpathDemoPane";
|
||||
|
||||
import bezierFeatures, { BezierFeatureKey } from "@/features/bezier-features";
|
||||
import subpathFeatures, { SubpathFeatureKey } from "@/features/subpath-features";
|
||||
import bezierFeatures, { BezierFeatureKey } from "@graphite/features/bezier-features";
|
||||
import subpathFeatures, { SubpathFeatureKey } from "@graphite/features/subpath-features";
|
||||
|
||||
import "@/style.css";
|
||||
import "@graphite/style.css";
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BEZIER_T_VALUE_VARIANTS, SUBPATH_T_VALUE_VARIANTS } from "@/utils/types";
|
||||
import { BEZIER_T_VALUE_VARIANTS, SUBPATH_T_VALUE_VARIANTS } from "@graphite/utils/types";
|
||||
|
||||
export const tSliderOptions = {
|
||||
min: 0,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Demo, DemoPane, InputOption } from "@/utils/types";
|
||||
import { Demo, DemoPane, InputOption } from "@graphite/utils/types";
|
||||
|
||||
export function renderDemo(demo: Demo): void {
|
||||
const header = document.createElement("h4");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type WasmRawInstance = typeof import("@/../wasm/pkg");
|
||||
export type WasmRawInstance = typeof import("@graphite/../wasm/pkg");
|
||||
export type WasmBezierInstance = InstanceType<WasmRawInstance["WasmBezier"]>;
|
||||
|
||||
export type WasmBezierKey = keyof WasmBezierInstance;
|
||||
|
||||
Reference in New Issue
Block a user