@shopify/klint 0.0.9 → 0.0.92
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/dist/elements/index.cjs +946 -0
- package/dist/{plugins → elements}/index.d.cts +3 -78
- package/dist/elements/index.d.ts +656 -0
- package/dist/elements/index.js +913 -0
- package/dist/index.cjs +941 -17
- package/dist/index.d.cts +7 -81
- package/dist/index.d.ts +7 -81
- package/dist/index.js +941 -17
- package/package.json +4 -2
|
@@ -329,7 +329,7 @@ declare const KlintFunctions: {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
type KlintContexts = KlintContext | KlintOffscreenContext;
|
|
332
|
-
interface KlintOffscreenContext extends CanvasRenderingContext2D, KlintFunctions,
|
|
332
|
+
interface KlintOffscreenContext extends CanvasRenderingContext2D, KlintFunctions, KlintElements {
|
|
333
333
|
width: number;
|
|
334
334
|
height: number;
|
|
335
335
|
__dpr: number;
|
|
@@ -412,80 +412,6 @@ declare class Easing implements KlintEasing {
|
|
|
412
412
|
log: () => void;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
type SVGFontPaths = Array<Array<Array<{
|
|
416
|
-
x: number;
|
|
417
|
-
y: number;
|
|
418
|
-
}>>>;
|
|
419
|
-
interface FontMetrics {
|
|
420
|
-
fontFamily: string;
|
|
421
|
-
fontWeight: string;
|
|
422
|
-
unitsPerEm: number;
|
|
423
|
-
ascent: number;
|
|
424
|
-
descent: number;
|
|
425
|
-
xHeight: number;
|
|
426
|
-
capHeight: number;
|
|
427
|
-
}
|
|
428
|
-
interface GlyphMetrics {
|
|
429
|
-
name: string;
|
|
430
|
-
unicode: string;
|
|
431
|
-
horizAdvX: number;
|
|
432
|
-
d?: string;
|
|
433
|
-
}
|
|
434
|
-
interface KlintSVGfont {
|
|
435
|
-
context: KlintContexts;
|
|
436
|
-
metrics: FontMetrics;
|
|
437
|
-
glyphs: Map<string, GlyphMetrics>;
|
|
438
|
-
parse(font: string): void;
|
|
439
|
-
}
|
|
440
|
-
interface PointOptions {
|
|
441
|
-
factor: number;
|
|
442
|
-
align?: "center" | "left" | "right";
|
|
443
|
-
center?: "alphabetic" | "middle" | "top";
|
|
444
|
-
letterSpacing?: number;
|
|
445
|
-
treshold?: number;
|
|
446
|
-
}
|
|
447
|
-
interface DisplacementParams {
|
|
448
|
-
point: {
|
|
449
|
-
x: number;
|
|
450
|
-
y: number;
|
|
451
|
-
};
|
|
452
|
-
position: {
|
|
453
|
-
x: number;
|
|
454
|
-
y: number;
|
|
455
|
-
};
|
|
456
|
-
groupIndex: number;
|
|
457
|
-
letterSpacing: number;
|
|
458
|
-
}
|
|
459
|
-
interface DisplacementCallback {
|
|
460
|
-
(params: DisplacementParams): {
|
|
461
|
-
x: number;
|
|
462
|
-
y: number;
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
declare class SVGfont implements KlintSVGfont {
|
|
466
|
-
readonly context: KlintContexts;
|
|
467
|
-
readonly metrics: FontMetrics;
|
|
468
|
-
readonly glyphs: Map<string, GlyphMetrics>;
|
|
469
|
-
private font;
|
|
470
|
-
private SCALE;
|
|
471
|
-
private targetXHeight;
|
|
472
|
-
constructor(context: KlintContexts);
|
|
473
|
-
parse(font: string, desiredXHeight?: number): void;
|
|
474
|
-
toJSON(): {
|
|
475
|
-
metrics: FontMetrics;
|
|
476
|
-
glyphs: Record<string, GlyphMetrics>;
|
|
477
|
-
};
|
|
478
|
-
getPoints(text: string, options: PointOptions): Array<Array<Array<{
|
|
479
|
-
x: number;
|
|
480
|
-
y: number;
|
|
481
|
-
}>>>;
|
|
482
|
-
flatten(points: SVGFontPaths, displacement?: DisplacementCallback): Array<{
|
|
483
|
-
x: number;
|
|
484
|
-
y: number;
|
|
485
|
-
}>;
|
|
486
|
-
draw(points: SVGFontPaths, displacement?: DisplacementCallback): void;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
415
|
type KlintStateValue = unknown;
|
|
490
416
|
type KlintStateCallback = (key: string, value: KlintStateValue) => void;
|
|
491
417
|
interface KlintState {
|
|
@@ -717,10 +643,9 @@ declare class Thing implements KlintThing {
|
|
|
717
643
|
log(): void;
|
|
718
644
|
}
|
|
719
645
|
|
|
720
|
-
interface
|
|
646
|
+
interface KlintElements {
|
|
721
647
|
Color: Color;
|
|
722
648
|
Easing: Easing;
|
|
723
|
-
SVGfont: SVGfont;
|
|
724
649
|
State: State;
|
|
725
650
|
Vector: Vector;
|
|
726
651
|
Time: Time;
|
|
@@ -728,4 +653,4 @@ interface KlintPlugins {
|
|
|
728
653
|
Thing: Thing;
|
|
729
654
|
}
|
|
730
655
|
|
|
731
|
-
export { Color, Easing, type
|
|
656
|
+
export { Color, Easing, type KlintElements, State, Text, Thing, Time, Vector };
|