index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/imageFilters/Shadow.tsx
import React from "react"; import type { DropShadowImageFilterProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors/Animations/Animations"; export const Shadow = (props: SkiaProps<DropShadowImageFilterProps>) => { return <skDropShadowImageFilter {...props} />; };
7,400
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/imageFilters/index.ts
export * from "./Blur"; export * from "./Offset"; export * from "./DisplacementMap"; export * from "./Shadow"; export * from "./Morphology"; export * from "./RuntimeShader";
7,401
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/maskFilters/Blur.tsx
import React from "react"; import type { BlurMaskFilterProps } from "../../../dom/types"; import type { SkiaDefaultProps } from "../../processors/Animations/Animations"; export const BlurMask = ({ style = "normal", respectCTM = true, ...props }: SkiaDefaultProps<BlurMaskFilterProps, "style" | "respectCTM">) => ...
7,402
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/maskFilters/index.ts
export * from "./Blur";
7,403
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/Corner.tsx
import React from "react"; import type { CornerPathEffectProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const CornerPathEffect = (props: SkiaProps<CornerPathEffectProps>) => { return <skCornerPathEffect {...props} />; };
7,404
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/Dash.tsx
import React from "react"; import type { DashPathEffectProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const DashPathEffect = (props: SkiaProps<DashPathEffectProps>) => { return <skDashPathEffect {...props} />; };
7,405
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/Discrete.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors/Animations/Animations"; import type { DiscretePathEffectProps } from "../../../dom/types"; export const DiscretePathEffect = ({ seed = 0, ...props }: SkiaDefaultProps<DiscretePathEffectProps, "seed">) => { return <skDiscretePathE...
7,406
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/Line2D.tsx
import React from "react"; import type { SkiaProps } from "../../processors/Animations/Animations"; import type { Line2DPathEffectProps } from "../../../dom/types"; export const Line2DPathEffect = (props: SkiaProps<Line2DPathEffectProps>) => { return <skLine2DPathEffect {...props} />; };
7,407
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/Path1D.tsx
import React from "react"; import type { SkiaProps } from "../../processors/Animations/Animations"; import type { Path1DPathEffectProps } from "../../../dom/types"; export const Path1DPathEffect = (props: SkiaProps<Path1DPathEffectProps>) => { return <skPath1DPathEffect {...props} />; };
7,408
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/Path2D.tsx
import React from "react"; import type { SkiaProps } from "../../processors/Animations/Animations"; import type { Path2DPathEffectProps } from "../../../dom/types"; export const Path2DPathEffect = (props: SkiaProps<Path2DPathEffectProps>) => { return <skPath2DPathEffect {...props} />; };
7,409
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/Sum.tsx
import React from "react"; import type { ChildrenProps } from "../../../dom/types"; export const SumPathEffect = (props: ChildrenProps) => { return <skSumPathEffect {...props} />; };
7,410
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/pathEffects/index.ts
export * from "./Discrete"; export * from "./Dash"; export * from "./Corner"; export * from "./Sum"; export * from "./Line2D"; export * from "./Path1D"; export * from "./Path2D";
7,411
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/Color.tsx
import React from "react"; import type { SkiaProps } from "../../processors"; import type { ColorProps } from "../../../dom/types"; export const ColorShader = (props: SkiaProps<ColorProps>) => { return <skColorShader {...props} />; };
7,412
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/FractalNoise.tsx
import React from "react"; import type { FractalNoiseProps } from "../../../dom/types"; import type { SkiaDefaultProps } from "../../processors/Animations/Animations"; export const FractalNoise = ({ seed = 0, tileWidth = 0, tileHeight = 0, ...props }: SkiaDefaultProps< FractalNoiseProps, "seed" | "tileHei...
7,413
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/LinearGradient.tsx
import React from "react"; import type { SkiaProps } from "../../processors"; import type { LinearGradientProps } from "../../../dom/types"; export const LinearGradient = (props: SkiaProps<LinearGradientProps>) => { return <skLinearGradient {...props} />; };
7,414
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/RadialGradient.tsx
import React from "react"; import type { SkiaProps } from "../../processors"; import type { RadialGradientProps } from "../../../dom/types"; export const RadialGradient = (props: SkiaProps<RadialGradientProps>) => { return <skRadialGradient {...props} />; };
7,415
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/Shader.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors"; import type { ShaderProps } from "../../../dom/types"; export const Shader = ({ uniforms = {}, ...props }: SkiaDefaultProps<ShaderProps, "uniforms">) => { return <skShader uniforms={uniforms} {...props} />; };
7,416
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/ShaderLib.ts
const MATH = ` const float PI = 3.1415926535897932384626433832795; const float TAU = 2 * PI; float normalizeRad(float value) { float rest = mod(value, TAU); return rest > 0 ? rest : TAU + rest; } vec2 canvas2Cartesian(vec2 v, vec2 center) { return vec2(v.x - center.x, -1 * (v.y - center.y)); } vec2 cartesian2C...
7,417
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/SweepGradient.tsx
import React from "react"; import type { SweepGradientProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const SweepGradient = (props: SkiaProps<SweepGradientProps>) => { return <skSweepGradient {...props} />; };
7,418
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/Turbulence.tsx
import React from "react"; import type { TurbulenceProps } from "../../../dom/types"; import type { SkiaDefaultProps } from "../../processors/Animations/Animations"; export const Turbulence = ({ seed = 0, tileWidth = 0, tileHeight = 0, ...props }: SkiaDefaultProps<TurbulenceProps, "seed" | "tileWidth" | "tile...
7,419
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/TwoPointConicalGradient.tsx
import React from "react"; import type { TwoPointConicalGradientProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const TwoPointConicalGradient = ( props: SkiaProps<TwoPointConicalGradientProps> ) => { return <skTwoPointConicalGradient {...props} />; };
7,420
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shaders/index.ts
export * from "./RadialGradient"; export * from "./LinearGradient"; export * from "./TwoPointConicalGradient"; export * from "./SweepGradient"; export * from "./Color"; export * from "./Turbulence"; export * from "./FractalNoise"; export * from "./Shader"; export * from "./ShaderLib";
7,421
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Box.tsx
import React from "react"; import type { BoxProps, BoxShadowProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const BoxShadow = (props: SkiaProps<BoxShadowProps>) => { return <skBoxShadow {...props} />; }; export const Box = (props: SkiaProps<BoxProps>) => { return <skB...
7,422
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Circle.tsx
import React from "react"; import type { SkiaProps } from "../../processors"; import type { CircleProps } from "../../../dom/types"; export const Circle = (props: SkiaProps<CircleProps>) => { return <skCircle {...props} />; };
7,423
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/DiffRect.tsx
import React from "react"; import type { SkiaProps } from "../../processors/Animations/Animations"; import type { DiffRectProps } from "../../../dom/types"; export const DiffRect = (props: SkiaProps<DiffRectProps>) => { return <skDiffRect {...props} />; };
7,424
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Fill.tsx
import React from "react"; import type { DrawingNodeProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors/Animations/Animations"; export const Fill = (props: SkiaProps<DrawingNodeProps>) => { return <skFill {...props} />; };
7,425
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/FitBox.tsx
import type { ReactNode } from "react"; import React, { useMemo } from "react"; import type { Fit } from "../../../dom/nodes"; import { fitRects, rect2rect } from "../../../dom/nodes"; import type { SkRect } from "../../../skia/types"; import { Group } from "../Group"; interface FitProps { fit?: Fit; src: SkRect;...
7,426
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Line.tsx
import React from "react"; import type { SkiaProps } from "../../processors"; import type { LineProps } from "../../../dom/types"; export const Line = (props: SkiaProps<LineProps>) => { return <skLine {...props} />; };
7,427
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Oval.tsx
import React from "react"; import type { OvalProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const Oval = (props: SkiaProps<OvalProps>) => { return <skOval {...props} />; };
7,428
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Patch.tsx
import React from "react"; import type { SkiaProps } from "../../processors"; import type { PatchProps } from "../../../dom/types"; export const Patch = (props: SkiaProps<PatchProps>) => { return <skPatch {...props} />; };
7,429
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Path.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors"; import type { PathProps } from "../../../dom/types"; export const Path = ({ start = 0, end = 1, ...props }: SkiaDefaultProps<PathProps, "start" | "end">) => { return <skPath start={start} end={end} {...props} />; };
7,430
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Points.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors/Animations/Animations"; import type { PointsProps } from "../../../dom/types"; export const Points = ({ mode = "points", ...props }: SkiaDefaultProps<PointsProps, "mode">) => { return <skPoints mode={mode} {...props} />; };
7,431
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Rect.tsx
import React from "react"; import type { RectProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const Rect = (props: SkiaProps<RectProps>) => { return <skRect {...props} />; };
7,432
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/RoundedRect.tsx
import React from "react"; import type { RoundedRectProps } from "../../../dom/types"; import type { SkiaProps } from "../../processors"; export const RoundedRect = (props: SkiaProps<RoundedRectProps>) => { return <skRRect {...props} />; };
7,433
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/Vertices.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors"; import type { VerticesProps } from "../../../dom/types"; export const Vertices = ({ mode = "triangles", ...props }: SkiaDefaultProps<VerticesProps, "mode">) => { return <skVertices mode={mode} {...props} />; };
7,434
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/shapes/index.ts
export * from "./Circle"; export * from "./Rect"; export * from "./RoundedRect"; export * from "./DiffRect"; export * from "./Line"; export * from "./Path"; export * from "./Oval"; export * from "./Points"; export * from "./Patch"; export * from "./Vertices"; export * from "./Fill"; export * from "./FitBox"; export * f...
7,435
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/text/Glyphs.tsx
import React from "react"; import type { GlyphsProps } from "../../../dom/types"; import type { SkiaDefaultProps } from "../../processors/Animations/Animations"; export const Glyphs = ({ x = 0, y = 0, ...props }: SkiaDefaultProps<GlyphsProps, "x" | "y">) => { return <skGlyphs x={x} y={y} {...props} />; };
7,436
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/text/Text.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors"; import type { TextProps } from "../../../dom/types"; export const Text = ({ x = 0, y = 0, ...props }: SkiaDefaultProps<TextProps, "x" | "y">) => { return <skText x={x} y={y} {...props} />; };
7,437
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/text/TextBlob.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors"; import type { TextBlobProps } from "../../../dom/types"; export const TextBlob = ({ x = 0, y = 0, ...props }: SkiaDefaultProps<TextBlobProps, "x" | "y">) => { return <skTextBlob x={x} y={y} {...props} />; };
7,438
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/text/TextPath.tsx
import React from "react"; import type { SkiaDefaultProps } from "../../processors"; import type { TextPathProps } from "../../../dom/types"; export const TextPath = ({ initialOffset = 0, ...props }: SkiaDefaultProps<TextPathProps, "initialOffset">) => { return <skTextPath initialOffset={initialOffset} {...prop...
7,439
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/components
petrpan-code/Shopify/react-native-skia/package/src/renderer/components/text/index.ts
export * from "./Text"; export * from "./Glyphs"; export * from "./TextBlob"; export * from "./TextPath";
7,440
0
petrpan-code/Shopify/react-native-skia/package/src/renderer
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/index.ts
export * from "./Animations"; export * from "./math";
7,441
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/Animations/Animations.ts
import type { SkiaSelector, SkiaValue } from "../../../values"; export type SharedValueType<T = number> = { value: T; }; export const isValue = (value: unknown): value is SkiaValue<unknown> => { if (value === undefined || value === null) { return false; } try { if ( typeof value === "object" && ...
7,442
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/Animations/index.ts
export * from "./Animations";
7,443
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/Animations
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/Animations/__tests__/animations.spec.ts
import { Selector } from "../../../../values"; import { RNSkValue } from "../../../../values/web/RNSkValue"; import { isSelector, isValue } from "../Animations"; describe("Animations", () => { describe("isValue", () => { it("should return true for a Skia value", async () => { const value = new RNSkValue(["...
7,444
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/math/Coordinates.ts
import type { Vector } from "../../../skia/types"; export interface PolarPoint { theta: number; radius: number; } export const canvas2Cartesian = (v: Vector, center: Vector) => { "worklet"; return { x: v.x - center.x, y: -1 * (v.y - center.y), }; }; export const cartesian2Canvas = (v: Vector, cente...
7,445
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/math/Math.ts
/** * Linear interpolation * @param value * @param x * @param y */ export const mix = (value: number, x: number, y: number) => { "worklet"; return x * (1 - value) + y * value; }; /** * @summary Clamps a node with a lower and upper bound. * @example clamp(-1, 0, 100); // 0 clamp(1, 0, 100); // 1 ...
7,446
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/math/Transforms.ts
import type { Vector } from "../../../skia/types"; import { canvas2Polar, polar2Canvas } from "./Coordinates"; export const rotate = (tr: Vector, origin: Vector, rotation: number) => { "worklet"; const { radius, theta } = canvas2Polar(tr, origin); return polar2Canvas({ radius, theta: theta + rotation }, origin)...
7,447
0
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors
petrpan-code/Shopify/react-native-skia/package/src/renderer/processors/math/index.ts
export * from "./Coordinates"; export * from "./Math"; export * from "./Transforms";
7,448
0
petrpan-code/Shopify/react-native-skia/package/src
petrpan-code/Shopify/react-native-skia/package/src/skia/NativeSetup.ts
import { Platform } from "../Platform"; import NativeSkiaModule from "../specs/NativeSkiaModule"; if (Platform.OS !== "web" && global.SkiaApi == null) { // Initialize RN Skia const SkiaModule = NativeSkiaModule; if (SkiaModule == null || typeof SkiaModule.install !== "function") { throw new Error( "Nat...
7,449
0
petrpan-code/Shopify/react-native-skia/package/src
petrpan-code/Shopify/react-native-skia/package/src/skia/Skia.ts
/*global SkiaApi*/ import type { Skia as SkSkiaApi } from "./types"; /** * Declares the SkiaApi as an available object in the global scope */ declare global { var SkiaApi: SkSkiaApi; } export const Skia = SkiaApi;
7,450
0
petrpan-code/Shopify/react-native-skia/package/src
petrpan-code/Shopify/react-native-skia/package/src/skia/Skia.web.ts
import { JsiSkApi } from "./web"; export const Skia = JsiSkApi(global.CanvasKit);
7,451
0
petrpan-code/Shopify/react-native-skia/package/src
petrpan-code/Shopify/react-native-skia/package/src/skia/index.ts
export { Skia } from "./Skia"; export * from "./core"; export * from "./types";
7,452
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/ColorFilter.spec.ts
import fs from "fs"; import path from "path"; import { processResult } from "../../__tests__/setup"; import type { SkColorFilter } from "../types/ColorFilter/ColorFilter"; import { setupSkia } from "./setup"; describe("Color Filters", () => { it("Duotone Color Matrix", () => { const ctx = setupSkia(); cons...
7,453
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Data.spec.ts
import type { JsiSkData } from "../web/JsiSkData"; import { importSkia, resolveFile } from "../../renderer/__tests__/setup"; import { setupSkia } from "./setup"; describe("Data", () => { it("Should create a SkData instance from a base64 string", () => { const { Skia } = setupSkia(); const data = Skia.Data.f...
7,454
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Drawings.spec.ts
import { processResult } from "../../__tests__/setup"; import { BlendMode, PaintStyle, StrokeCap } from "../types"; import { setupSkia } from "./setup"; describe("Drawings", () => { it("Lightblue rectangle", () => { const { surface, canvas, Skia } = setupSkia(); const paint = Skia.Paint(); paint.setColo...
7,455
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Enums.spec.ts
import type { EmbindEnum } from "canvaskit-wasm"; import { AlphaType, BlurStyle, ClipOp, ColorType, FillType, FilterMode, FontEdging, FontHinting, FontSlant, FontWeight, FontWidth, ImageFormat, MipmapMode, PaintStyle, PathOp, PathVerb, PointMode, SaveLayerFlag, StrokeCap, Stroke...
7,456
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Geometry.spec.ts
import { importSkia } from "../../renderer/__tests__/setup"; describe("Geometry", () => { it("should calculate the bounding box the union of multiple rectangles", () => { const { bounds, rect } = importSkia(); const r1 = rect(-10, -10, 30, 30); const r2 = rect(30, 30, 100, 20); const result = bounds...
7,457
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/ImageFilter.spec.ts
import { processResult } from "../../__tests__/setup"; import { TileMode } from "../types"; import { setupSkia } from "./setup"; describe("ImageFilter", () => { it("Blured lightblue circle", () => { const { surface, canvas, width, Skia } = setupSkia(); const r = width / 2; const paint = Skia.Paint(); ...
7,458
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Mock.spec.ts
describe("Test the mock we provide to users", () => { it("Should load the mock successfully", () => { expect(() => { require("../../mock"); }).not.toThrow(); }); });
7,459
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Paint.spec.ts
import { processResult } from "../../__tests__/setup"; import { setupSkia } from "./setup"; describe("Paint", () => { it("should have anti-aliasing is true by default but the value be preserved when using copy()", () => { const { surface, canvas, Skia, width } = setupSkia(); const size = width; const p1...
7,460
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Path.spec.ts
/* eslint-disable max-len */ import { interpolatePaths } from "../../animation/functions/interpolatePaths"; import type { Skia, SkPath } from "../types"; import { FillType, PathOp, PathVerb } from "../types"; import { processResult } from "../../__tests__/setup"; import { PaintStyle } from "../types/Paint/Paint"; impo...
7,461
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/RuntimeEffect.spec.ts
import { processResult } from "../../__tests__/setup"; import { setupSkia } from "./setup"; const spiralSkSL = ` uniform float rad_scale; uniform int2 in_center; uniform float4 in_colors0; uniform float4 in_colors1; half4 main(float2 p) { float2 pp = p - float2(in_center); float radius = sqrt(dot(pp, pp)); ...
7,462
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Shader.spec.ts
import { width as size } from "../../renderer/__tests__/setup"; import { processResult } from "../../__tests__/setup"; import { TileMode } from "../types"; import { BlendMode } from "../types/Paint/BlendMode"; import { setupSkia } from "./setup"; describe("Shader", () => { it("Simple color interpolation", () => { ...
7,463
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Text.spec.ts
import { processResult } from "../../__tests__/setup"; import { loadFont } from "../../renderer/__tests__/setup"; import { setupSkia } from "./setup"; describe("Text API", () => { it("Hello world text", () => { const { surface, canvas, Skia } = setupSkia(); const paint = Skia.Paint(); paint.setColor(Ski...
7,464
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Transform.spec.ts
import fs from "fs"; import path from "path"; import { processResult } from "../../__tests__/setup"; import type { SkCanvas } from "../types/Canvas"; import { setupSkia } from "./setup"; describe("Test transforms", () => { it("Scale and rotate image", () => { testImageTransform((canvas) => { canvas.scale...
7,465
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/Vertices.spec.ts
import { processResult } from "../../__tests__/setup"; import { BlendMode, VertexMode } from "../types"; import { setupSkia } from "./setup"; describe("Vertices", () => { it("Billinear gradient", () => { const { surface, canvas, width, Skia } = setupSkia(); const vertices = [ Skia.Point(0, 0), S...
7,466
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/setup.ts
import type { Node } from "../../dom/types"; import { mapKeys } from "../../renderer/typeddash"; import { LoadSkiaWeb } from "../../web/LoadSkiaWeb"; import { isMatrix, Skia } from "../types"; import { JsiSkApi } from "../web"; let Skia: ReturnType<typeof JsiSkApi>; beforeAll(async () => { await LoadSkiaWeb(); Sk...
7,467
0
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__
petrpan-code/Shopify/react-native-skia/package/src/skia/__tests__/assets/tiger.svg
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="800" width="800"> <g transform="translate(200,200)" style="fill-opacity:1; fill:none;"> <g style="fill: #ffffff; stroke:#000000; stroke-width:0.172"> <path d="M-122.304 84.285C-122.304 84.285 -122.203 86.1...
7,468
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/AnimatedImage.ts
import { Skia } from "../Skia"; import type { DataSourceParam } from "../types"; import { useRawData } from "./Data"; const animatedImgFactory = Skia.AnimatedImage.MakeAnimatedImageFromEncoded.bind( Skia.AnimatedImage ); /** * Returns a Skia Animated Image object * */ export const useAnimatedImage = ( source: ...
7,469
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Data.ts
import { useEffect, useRef, useState } from "react"; import { Skia } from "../Skia"; import type { SkData, DataSourceParam, SkJSIInstance } from "../types"; import { Platform } from "../../Platform"; const factoryWrapper = <T>( data2: SkData, factory: (data: SkData) => T, onError?: (err: Error) => void ) => { ...
7,470
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Font.ts
/*global SkiaApi*/ import { useEffect, useMemo, useState } from "react"; import { Skia } from "../Skia"; import { FontSlant } from "../types"; import type { DataModule, DataSourceParam, SkFontMgr } from "../types"; import { Platform } from "../../Platform"; import type { SkTypefaceFontProvider } from "../types/Paragra...
7,471
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Image.ts
import { Platform } from "../../Platform"; import { Skia } from "../Skia"; import type { DataSourceParam, SkImage } from "../types"; import { useRawData } from "./Data"; const imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image); /** * Returns a Skia Image object * */ export const useImage = ( source: D...
7,472
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Matrix.ts
import { Skia } from "../Skia"; import type { Transforms2d } from "../types"; import { processTransform } from "../types"; export const processTransform2d = (transforms: Transforms2d) => processTransform(Skia.Matrix(), transforms);
7,473
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Picture.ts
import { Skia } from "../Skia"; import type { SkCanvas, SkRect } from "../types"; /** * Memoizes and returns an SkPicture that can be drawn to another canvas. * @param rect Picture bounds * @param cb Callback for drawing to the canvas * @returns SkPicture */ export const createPicture = (rect: SkRect, cb: (canvas...
7,474
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/RRect.tsx
import { Skia } from "../Skia"; import type { SkRect } from "../types"; export const rrect = (r: SkRect, rx: number, ry: number) => { "worklet"; return Skia.RRectXY(r, rx, ry); };
7,475
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Rect.ts
import { Skia } from "../Skia"; import type { SkRect, SkRRect } from "../types"; import { isRRect } from "../types"; import { vec } from "./Vector"; export const rect = (x: number, y: number, width: number, height: number) => { "worklet"; return Skia.XYWHRect(x, y, width, height); }; export const bounds = (rects...
7,476
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/SVG.ts
import { Skia } from "../Skia"; import type { DataSourceParam } from "../types"; import { useRawData } from "./Data"; const svgFactory = Skia.SVG.MakeFromData.bind(Skia.SVG); export const useSVG = ( source: DataSourceParam, onError?: (err: Error) => void ) => useRawData(source, svgFactory, onError);
7,477
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Typeface.ts
import { Skia } from "../Skia"; import type { DataSourceParam } from "../types"; import { useRawData } from "./Data"; const tfFactory = Skia.Typeface.MakeFreeTypeFaceFromData.bind(Skia.Typeface); /** * Returns a Skia Typeface object * */ export const useTypeface = ( source: DataSourceParam, onError?: (err: Err...
7,478
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/Vector.ts
import { Skia } from "../Skia"; import type { Vector } from "../types"; export const vec = (x = 0, y?: number) => { "worklet"; return Skia.Point(x, y ?? x); }; export const point = vec; export const neg = (a: Vector) => { "worklet"; return vec(-a.x, -a.y); }; export const add = (a: Vector, b: Vector) => { "w...
7,479
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/core/index.ts
export * from "./Data"; export * from "./Font"; export * from "./Typeface"; export * from "./Image"; export * from "./AnimatedImage"; export * from "./Picture"; export * from "./SVG"; export * from "./Vector"; export * from "./Rect"; export * from "./RRect"; export * from "./Matrix";
7,480
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/Canvas.ts
import type { SkPaint } from "./Paint"; import type { SkRect } from "./Rect"; import type { SkFont } from "./Font"; import type { SkPath } from "./Path"; import type { SkImage, MipmapMode, FilterMode, ImageInfo } from "./Image"; import type { SkSVG } from "./SVG"; import type { SkColor } from "./Color"; import type { S...
7,481
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/Color.ts
// This is the JSI color export type SkColor = Float32Array; // Input colors can be string, number, number[] or Float32Array export type Color = string | Float32Array | number | number[];
7,482
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/ContourMeasure.tsx
import type { SkJSIInstance } from "./JsiInstance"; import type { SkPath } from "./Path/Path"; import type { SkPoint } from "./Point"; export interface PosTan { px: number; py: number; tx: number; ty: number; } export interface SkContourMeasure extends SkJSIInstance<"ContourMeasure"> { /** * Returns the ...
7,483
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/JsiInstance.ts
export interface SkJSIInstance<T extends string> { __typename__: T; dispose(): void; }
7,484
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/MaskFilter.ts
import type { SkJSIInstance } from "./JsiInstance"; export enum BlurStyle { Normal, //!< fuzzy inside and outside Solid, //!< solid inside, fuzzy outside Outer, //!< nothing inside, fuzzy outside Inner, //!< fuzzy inside, nothing outside } export const isMaskFilter = ( obj: SkJSIInstance<string> | null ): o...
7,485
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/Matrix.ts
import type { SkJSIInstance } from "./JsiInstance"; import type { SkCanvas } from "./Canvas"; export enum MatrixIndex { ScaleX = 0, SkewX = 1, TransX = 2, SkewY = 3, ScaleY = 4, TransY = 5, Persp0 = 6, Persp1 = 7, Persp2 = 8, } export const isMatrix = (obj: unknown): obj is SkMatrix => obj !== null...
7,486
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/PathEffect.ts
import type { SkJSIInstance } from "./JsiInstance"; import type { SkPath } from "./Path/Path"; import type { SkMatrix } from "./Matrix"; export type SkPathEffect = SkJSIInstance<"PathEffect">; export const isPathEffect = ( obj: SkJSIInstance<string> | null ): obj is SkPathEffect => obj !== null && obj.__typename__ ...
7,487
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/Point.ts
export enum PointMode { Points, Lines, Polygon, } export interface SkPoint { readonly x: number; readonly y: number; } export type Vector = SkPoint;
7,488
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/RRect.ts
import type { SkRect } from "./Rect"; export interface SkRRect { readonly rect: SkRect; readonly rx: number; readonly ry: number; } // We have an issue to check property existence on JSI backed instances export const isRRect = (def: SkRect | SkRRect): def is SkRRect => // eslint-disable-next-line @typescript-...
7,489
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/RSXform.ts
import type { SkJSIInstance } from "./JsiInstance"; export type SkRSXform = SkJSIInstance<"RSXform">;
7,490
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/Rect.ts
export interface SkRect { readonly x: number; readonly y: number; readonly width: number; readonly height: number; }
7,491
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/Size.ts
export interface SkSize { width: number; height: number; }
7,492
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/Skia.ts
import type { ImageFilterFactory } from "./ImageFilter"; import type { PathFactory } from "./Path"; import type { ColorFilterFactory } from "./ColorFilter"; import type { SkFont, FontMgrFactory } from "./Font"; import type { SkTypeface, TypefaceFactory } from "./Typeface"; import type { ImageFactory } from "./Image"; i...
7,493
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/TextBlob.ts
import type { SkJSIInstance } from "./JsiInstance"; import type { SkFont } from "./Font/Font"; import type { SkRSXform } from "./RSXform"; export type SkTextBlob = SkJSIInstance<"TextBlob">; export interface TextBlobFactory { /** * Return a TextBlob with a single run of text. * * It uses the default charac...
7,494
0
petrpan-code/Shopify/react-native-skia/package/src/skia
petrpan-code/Shopify/react-native-skia/package/src/skia/types/index.ts
export * from "./Picture"; export * from "./Data"; export * from "./SVG"; export * from "./Surface"; export * from "./Vertices"; export * from "./RuntimeEffect"; export * from "./Shader"; export * from "./Image"; export * from "./AnimatedImage"; export * from "./ColorFilter"; export * from "./ImageFilter"; export * fro...
7,495
0
petrpan-code/Shopify/react-native-skia/package/src/skia/types
petrpan-code/Shopify/react-native-skia/package/src/skia/types/AnimatedImage/AnimatedImage.ts
import type { SkJSIInstance } from "../JsiInstance"; import type { SkImage } from "../Image"; export interface SkAnimatedImage extends SkJSIInstance<"AnimatedImage"> { /** * Decode the next frame. * * If the animation is on the last frame or has hit an error, returns * kFinished (-1). */ decodeNe...
7,496
0
petrpan-code/Shopify/react-native-skia/package/src/skia/types
petrpan-code/Shopify/react-native-skia/package/src/skia/types/AnimatedImage/AnimatedImageFactory.ts
import type { SkData } from "../Data"; import type { SkAnimatedImage } from "./AnimatedImage"; export interface AnimatedImageFactory { /** * Decodes the given bytes into an animated image. Returns null if the bytes were invalid. * The passed in bytes will be copied into the WASM heap, so the caller can dispos...
7,497
0
petrpan-code/Shopify/react-native-skia/package/src/skia/types
petrpan-code/Shopify/react-native-skia/package/src/skia/types/AnimatedImage/index.ts
export * from "./AnimatedImage"; export * from "./AnimatedImageFactory";
7,498
0
petrpan-code/Shopify/react-native-skia/package/src/skia/types
petrpan-code/Shopify/react-native-skia/package/src/skia/types/ColorFilter/ColorFilter.ts
import type { SkJSIInstance } from "../JsiInstance"; export const isColorFilter = ( obj: SkJSIInstance<string> | null ): obj is SkColorFilter => obj !== null && obj.__typename__ === "ColorFilter"; export type SkColorFilter = SkJSIInstance<"ColorFilter">;
7,499