Skip to content

Commit

Permalink
remove unused enum (#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Jun 28, 2024
1 parent 279afb9 commit 34fa5c5
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 40 deletions.
14 changes: 2 additions & 12 deletions package/src/dom/nodes/Node.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import type { Skia } from "../../skia/types";
import type {
Node,
DeclarationNode,
NodeType,
DeclarationType,
} from "../types";
import type { Node, DeclarationNode, NodeType } from "../types";
import type { DeclarationContext } from "../types/DeclarationContext";

export interface NodeContext {
Expand Down Expand Up @@ -72,12 +67,7 @@ export abstract class JsiDeclarationNode<P>
{
private invalidate: Invalidate = () => {};

constructor(
ctx: NodeContext,
public declarationType: DeclarationType,
type: NodeType,
props: P
) {
constructor(ctx: NodeContext, type: NodeType, props: P) {
super(ctx, type, props);
}

Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/PaintNode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from "../../skia/types";
import type { DeclarationNode, PaintProps } from "../types";
import { DeclarationType, NodeType } from "../types";
import { NodeType } from "../types";
import type { DeclarationContext } from "../types/DeclarationContext";

import { enumKey } from "./datatypes";
Expand All @@ -12,7 +12,7 @@ export class PaintNode
implements DeclarationNode<PaintProps>
{
constructor(ctx: NodeContext, props: PaintProps = {}) {
super(ctx, DeclarationType.Paint, NodeType.Paint, props);
super(ctx, NodeType.Paint, props);
}

decorate(ctx: DeclarationContext) {
Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/drawings/Box.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { SkRRect, Skia } from "../../../skia/types";
import { BlurStyle, ClipOp, isRRect } from "../../../skia/types";
import type { DrawingContext } from "../../types";
import { DeclarationType, NodeType } from "../../types";
import { NodeType } from "../../types";
import type { BoxShadowProps, BoxProps } from "../../types/Drawings";
import type { NodeContext } from "../Node";
import { JsiDeclarationNode } from "../Node";
Expand Down Expand Up @@ -38,7 +38,7 @@ const deflate = (

export class BoxShadowNode extends JsiDeclarationNode<BoxShadowProps> {
constructor(ctx: NodeContext, props: BoxShadowProps) {
super(ctx, DeclarationType.Unknown, NodeType.BoxShadow, props);
super(ctx, NodeType.BoxShadow, props);
}

decorate(_ctx: DeclarationContext) {
Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/paint/BlendNode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BlendProps } from "../../types/ImageFilters";
import { BlendMode } from "../../../skia/types";
import { DeclarationType, NodeType } from "../../types/NodeType";
import { NodeType } from "../../types/NodeType";
import type { NodeContext } from "../Node";
import { JsiDeclarationNode } from "../Node";
import { enumKey } from "../datatypes";
Expand All @@ -9,7 +9,7 @@ import { composeDeclarations } from "../../types/DeclarationContext";

export class BlendNode extends JsiDeclarationNode<BlendProps> {
constructor(ctx: NodeContext, props: BlendProps) {
super(ctx, DeclarationType.ImageFilter, NodeType.Blend, props);
super(ctx, NodeType.Blend, props);
}

decorate(ctx: DeclarationContext) {
Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/paint/ColorFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import type {
BlendColorFilterProps,
MatrixColorFilterProps,
} from "../../types";
import { DeclarationType, NodeType } from "../../types";
import { NodeType } from "../../types";
import { enumKey } from "../datatypes/Enum";
import type { LerpColorFilterProps } from "../../types/ColorFilters";
import type { DeclarationContext } from "../../types/DeclarationContext";

export abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {
constructor(ctx: NodeContext, type: NodeType, props: P) {
super(ctx, DeclarationType.ColorFilter, type, props);
super(ctx, type, props);
}

protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter) {
Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/paint/ImageFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
OffsetImageFilterProps,
RuntimeShaderImageFilterProps,
} from "../../types";
import { DeclarationType, NodeType } from "../../types";
import { NodeType } from "../../types";
import { processRadius, enumKey } from "../datatypes";
import type { NodeContext } from "../Node";
import { JsiDeclarationNode } from "../Node";
Expand Down Expand Up @@ -58,7 +58,7 @@ const MakeInnerShadow = (

export abstract class ImageFilterDeclaration<P> extends JsiDeclarationNode<P> {
constructor(ctx: NodeContext, type: NodeType, props: P) {
super(ctx, DeclarationType.ImageFilter, type, props);
super(ctx, type, props);
}

protected input(ctx: DeclarationContext) {
Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/paint/MaskFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { BlurStyle } from "../../../skia/types";
import type { NodeContext } from "../Node";
import { JsiDeclarationNode } from "../Node";
import type { BlurMaskFilterProps } from "../../types";
import { DeclarationType, NodeType } from "../../types";
import { NodeType } from "../../types";
import { enumKey } from "../datatypes";
import type { DeclarationContext } from "../../types/DeclarationContext";

export class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {
constructor(ctx: NodeContext, props: BlurMaskFilterProps) {
super(ctx, DeclarationType.MaskFilter, NodeType.BlurMaskFilter, props);
super(ctx, NodeType.BlurMaskFilter, props);
}

decorate(ctx: DeclarationContext) {
Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/paint/PathEffects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import type {
Path1DPathEffectProps,
Path2DPathEffectProps,
} from "../../types";
import { DeclarationType, NodeType } from "../../types";
import { NodeType } from "../../types";
import { enumKey } from "../datatypes/Enum";
import { processPath } from "../datatypes";
import type { DeclarationContext } from "../../types/DeclarationContext";
import { composeDeclarations } from "../../types/DeclarationContext";

abstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {
constructor(ctx: NodeContext, type: NodeType, props: P) {
super(ctx, DeclarationType.PathEffect, type, props);
super(ctx, type, props);
}

protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect) {
Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/nodes/paint/Shaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
TurbulenceProps,
TwoPointConicalGradientProps,
} from "../../types";
import { DeclarationType, NodeType } from "../../types";
import { NodeType } from "../../types";
import {
enumKey,
fitRects,
Expand All @@ -30,7 +30,7 @@ import {

export abstract class ShaderDeclaration<P> extends JsiDeclarationNode<P> {
constructor(ctx: NodeContext, type: NodeType, props: P) {
super(ctx, DeclarationType.Shader, type, props);
super(ctx, type, props);
}
}

Expand Down
4 changes: 2 additions & 2 deletions package/src/dom/types/Node.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { GroupProps } from "./Common";
import type { DeclarationType, NodeType } from "./NodeType";
import type { NodeType } from "./NodeType";
import type { DeclarationContext } from "./DeclarationContext";
import type { DrawingContext } from "./DrawingContext";

Expand All @@ -19,7 +19,7 @@ export interface Node<P> {
export type Invalidate = () => void;

export interface DeclarationNode<P> extends Node<P> {
declarationType: DeclarationType;
//declarationType: DeclarationType;
decorate(ctx: DeclarationContext): void;

setInvalidate(invalidate: Invalidate): void;
Expand Down
10 changes: 0 additions & 10 deletions package/src/dom/types/NodeType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,3 @@ export const enum NodeType {
// Paragraph
Paragraph = "skParagraph",
}

export const enum DeclarationType {
Paint,
Shader,
ImageFilter,
ColorFilter,
PathEffect,
MaskFilter,
Unknown,
}

0 comments on commit 34fa5c5

Please sign in to comment.