@codefrydev/svg-engine 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunk-VCDC4W3X.js +3439 -0
- package/dist/editor.cjs +2910 -1630
- package/dist/editor.d.cts +2 -4
- package/dist/editor.d.ts +2 -4
- package/dist/editor.js +1068 -433
- package/dist/index.cjs +1864 -1219
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{types-BTYLCn9x.d.cts → types-BHUCCfQX.d.cts} +12 -2
- package/dist/{types-BTYLCn9x.d.ts → types-BHUCCfQX.d.ts} +12 -2
- package/dist/wc.cjs +1 -1
- package/dist/wc.d.cts +6 -3
- package/dist/wc.d.ts +6 -3
- package/dist/wc.iife.js +109 -109
- package/dist/wc.js +1 -1
- package/package.json +10 -4
- package/dist/chunk-KRCGD3CL.js +0 -2794
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
-
import { R as RendererProps, E as ElementRenderer } from './types-
|
|
3
|
-
export { a as Element, b as ElementType, P as Preset, T as ToolCategory,
|
|
2
|
+
import { R as RendererProps, E as ElementRenderer } from './types-BHUCCfQX.cjs';
|
|
3
|
+
export { a as Element, b as ElementType, P as Preset, c as PresetExample, T as ToolCategory, d as ToolDef } from './types-BHUCCfQX.cjs';
|
|
4
4
|
|
|
5
5
|
declare const Renderer: React$1.FC<RendererProps>;
|
|
6
6
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
-
import { R as RendererProps, E as ElementRenderer } from './types-
|
|
3
|
-
export { a as Element, b as ElementType, P as Preset, T as ToolCategory,
|
|
2
|
+
import { R as RendererProps, E as ElementRenderer } from './types-BHUCCfQX.js';
|
|
3
|
+
export { a as Element, b as ElementType, P as Preset, c as PresetExample, T as ToolCategory, d as ToolDef } from './types-BHUCCfQX.js';
|
|
4
4
|
|
|
5
5
|
declare const Renderer: React$1.FC<RendererProps>;
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type ElementType = "select" | "point" | "text" | "line" | "string" | "surface" | "cart" | "disk" | "com" | "particle" | "pivot" | "dashed" | "dashed_line" | "vector" | "ray" | "ground" | "table_edge" | "block" | "sphere" | "shell" | "cylinder" | "slab" | "semicircle" | "quarter_circle" | "cone" | "curved_wedge" | "incline" | "ladder" | "spring" | "pulley" | "rod" | "hinge" | "arc" | "arc_arrow" | "container" | "pipe" | "liquid" | "orbit" | "wire" | "resistor" | "capacitor" | "inductor" | "diode" | "battery" | "meter_v" | "meter_a" | "piston_cylinder" | "heat_engine" | "conduction_rod" | "pv_axes" | "thermo_process" | "carnot_cycle" | "maxwell_boltzmann" | "diatomic_gas" | "random_walk" | "lens_convex" | "lens_concave" | "mirror_concave" | "mirror_convex" | "prism" | "glass_slab" | "slit_double" | "slit_single" | "photon" | "nucleus" | "wedge" | "dimension" | "axes" | "pole_piece" | "b_field_line" | "b_field_curve" | "bezier" | "b_region_in" | "b_region_out" | "current_wire" | "bar_magnet" | "coil" | "meter" | "ac_source" | "axes_3d" | "charge_pos" | "charge_neg" | "dipole" | "charged_plate_pos" | "charged_plate_neg" | "gaussian_sphere" | "gaussian_cylinder" | "mirror_plane" | "energy_level" | "circle" | "ellipse" | "rectangle" | "angle" | "parabola_v" | "parabola_h" | "hyperbola" | "modulus" | "exponential" | "logarithmic" | "sine_wave" | "step_function" | "shaded_area" | "atom" | "charge_plus" | "charge_minus" | "benzene" | "cyclohexane" | "cyclopentane" | "cyclobutane" | "cyclopropane" | "radical" | "lone_pair"
|
|
4
4
|
/** Rotation preset / reference/Rotation.html */
|
|
@@ -62,10 +62,13 @@ interface ElementData {
|
|
|
62
62
|
showProjection?: boolean;
|
|
63
63
|
[key: string]: unknown;
|
|
64
64
|
}
|
|
65
|
+
type EditHandleKind = "start" | "end" | "cp";
|
|
65
66
|
interface RenderContext {
|
|
66
67
|
isSelected?: boolean;
|
|
67
68
|
isGhost?: boolean;
|
|
68
69
|
viewMode?: boolean;
|
|
70
|
+
/** Bound to the current element; implements stopPropagation + drag setup in the editor. */
|
|
71
|
+
onHandlePointerDown?: (e: MouseEvent<SVGElement>, kind: EditHandleKind, cpIndex?: number) => void;
|
|
69
72
|
}
|
|
70
73
|
type ElementRenderer = (element: ElementData, context: RenderContext) => ReactNode;
|
|
71
74
|
interface RendererProps {
|
|
@@ -82,6 +85,7 @@ interface RendererProps {
|
|
|
82
85
|
onBackgroundMouseUp?: (e: React.MouseEvent) => void;
|
|
83
86
|
onBackgroundMouseLeave?: (e: React.MouseEvent) => void;
|
|
84
87
|
onElementMouseDown?: (e: React.MouseEvent, element: ElementData) => void;
|
|
88
|
+
onHandlePointerDown?: (e: React.MouseEvent, element: ElementData, kind: EditHandleKind, cpIndex?: number) => void;
|
|
85
89
|
}
|
|
86
90
|
interface ToolDef {
|
|
87
91
|
id: string;
|
|
@@ -91,10 +95,16 @@ interface ToolCategory {
|
|
|
91
95
|
name: string;
|
|
92
96
|
tools: ToolDef[];
|
|
93
97
|
}
|
|
98
|
+
interface PresetExample {
|
|
99
|
+
name: string;
|
|
100
|
+
elements: ElementData[];
|
|
101
|
+
}
|
|
94
102
|
interface Preset {
|
|
95
103
|
name: string;
|
|
96
104
|
elements: ElementData[];
|
|
97
105
|
toolCategories: ToolCategory[];
|
|
106
|
+
/** Optional named starter scenes; when set, index 0 should match `elements`. */
|
|
107
|
+
examples?: PresetExample[];
|
|
98
108
|
}
|
|
99
109
|
|
|
100
|
-
export type { ElementRenderer as E, Preset as P, RendererProps as R, ToolCategory as T, ElementData as a, ElementType as b,
|
|
110
|
+
export type { ElementRenderer as E, Preset as P, RendererProps as R, ToolCategory as T, ElementData as a, ElementType as b, PresetExample as c, ToolDef as d };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type ElementType = "select" | "point" | "text" | "line" | "string" | "surface" | "cart" | "disk" | "com" | "particle" | "pivot" | "dashed" | "dashed_line" | "vector" | "ray" | "ground" | "table_edge" | "block" | "sphere" | "shell" | "cylinder" | "slab" | "semicircle" | "quarter_circle" | "cone" | "curved_wedge" | "incline" | "ladder" | "spring" | "pulley" | "rod" | "hinge" | "arc" | "arc_arrow" | "container" | "pipe" | "liquid" | "orbit" | "wire" | "resistor" | "capacitor" | "inductor" | "diode" | "battery" | "meter_v" | "meter_a" | "piston_cylinder" | "heat_engine" | "conduction_rod" | "pv_axes" | "thermo_process" | "carnot_cycle" | "maxwell_boltzmann" | "diatomic_gas" | "random_walk" | "lens_convex" | "lens_concave" | "mirror_concave" | "mirror_convex" | "prism" | "glass_slab" | "slit_double" | "slit_single" | "photon" | "nucleus" | "wedge" | "dimension" | "axes" | "pole_piece" | "b_field_line" | "b_field_curve" | "bezier" | "b_region_in" | "b_region_out" | "current_wire" | "bar_magnet" | "coil" | "meter" | "ac_source" | "axes_3d" | "charge_pos" | "charge_neg" | "dipole" | "charged_plate_pos" | "charged_plate_neg" | "gaussian_sphere" | "gaussian_cylinder" | "mirror_plane" | "energy_level" | "circle" | "ellipse" | "rectangle" | "angle" | "parabola_v" | "parabola_h" | "hyperbola" | "modulus" | "exponential" | "logarithmic" | "sine_wave" | "step_function" | "shaded_area" | "atom" | "charge_plus" | "charge_minus" | "benzene" | "cyclohexane" | "cyclopentane" | "cyclobutane" | "cyclopropane" | "radical" | "lone_pair"
|
|
4
4
|
/** Rotation preset / reference/Rotation.html */
|
|
@@ -62,10 +62,13 @@ interface ElementData {
|
|
|
62
62
|
showProjection?: boolean;
|
|
63
63
|
[key: string]: unknown;
|
|
64
64
|
}
|
|
65
|
+
type EditHandleKind = "start" | "end" | "cp";
|
|
65
66
|
interface RenderContext {
|
|
66
67
|
isSelected?: boolean;
|
|
67
68
|
isGhost?: boolean;
|
|
68
69
|
viewMode?: boolean;
|
|
70
|
+
/** Bound to the current element; implements stopPropagation + drag setup in the editor. */
|
|
71
|
+
onHandlePointerDown?: (e: MouseEvent<SVGElement>, kind: EditHandleKind, cpIndex?: number) => void;
|
|
69
72
|
}
|
|
70
73
|
type ElementRenderer = (element: ElementData, context: RenderContext) => ReactNode;
|
|
71
74
|
interface RendererProps {
|
|
@@ -82,6 +85,7 @@ interface RendererProps {
|
|
|
82
85
|
onBackgroundMouseUp?: (e: React.MouseEvent) => void;
|
|
83
86
|
onBackgroundMouseLeave?: (e: React.MouseEvent) => void;
|
|
84
87
|
onElementMouseDown?: (e: React.MouseEvent, element: ElementData) => void;
|
|
88
|
+
onHandlePointerDown?: (e: React.MouseEvent, element: ElementData, kind: EditHandleKind, cpIndex?: number) => void;
|
|
85
89
|
}
|
|
86
90
|
interface ToolDef {
|
|
87
91
|
id: string;
|
|
@@ -91,10 +95,16 @@ interface ToolCategory {
|
|
|
91
95
|
name: string;
|
|
92
96
|
tools: ToolDef[];
|
|
93
97
|
}
|
|
98
|
+
interface PresetExample {
|
|
99
|
+
name: string;
|
|
100
|
+
elements: ElementData[];
|
|
101
|
+
}
|
|
94
102
|
interface Preset {
|
|
95
103
|
name: string;
|
|
96
104
|
elements: ElementData[];
|
|
97
105
|
toolCategories: ToolCategory[];
|
|
106
|
+
/** Optional named starter scenes; when set, index 0 should match `elements`. */
|
|
107
|
+
examples?: PresetExample[];
|
|
98
108
|
}
|
|
99
109
|
|
|
100
|
-
export type { ElementRenderer as E, Preset as P, RendererProps as R, ToolCategory as T, ElementData as a, ElementType as b,
|
|
110
|
+
export type { ElementRenderer as E, Preset as P, RendererProps as R, ToolCategory as T, ElementData as a, ElementType as b, PresetExample as c, ToolDef as d };
|