@gjsify/canvas2d 0.4.30 → 0.4.32
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/lib/esm/index.js +1 -1
- package/lib/types/canvas2d-bridge.d.ts +19 -18
- package/package.json +15 -8
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{Canvas2DBridge as e}from"./canvas2d-bridge.js";import{CanvasGradient as t,CanvasPattern as n,CanvasRenderingContext2D as r,CanvasRenderingContext2D as i,ImageData as a,ImageData as o,Path2D as s,Path2D as c,parseColor as l}from"@gjsify/canvas2d-core";import{HTMLCanvasElement as u}from"@gjsify/dom-elements";const d=Symbol.for(`gjsify_canvas2d_context`);u.registerContextFactory(`2d`,(e,t)=>{let n=e[d];if(
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{Canvas2DBridge as e}from"./canvas2d-bridge.js";import{CanvasGradient as t,CanvasPattern as n,CanvasRenderingContext2D as r,CanvasRenderingContext2D as i,ImageData as a,ImageData as o,Path2D as s,Path2D as c,parseColor as l}from"@gjsify/canvas2d-core";import{HTMLCanvasElement as u}from"@gjsify/dom-elements";const d=Symbol.for(`gjsify_canvas2d_context`);u.registerContextFactory(`2d`,(e,t)=>{let n=e,r=n[d];if(r)return r;let a=new i(e,t);return n[d]=a,a}),Object.defineProperty(globalThis,"CanvasRenderingContext2D",{value:i,writable:!0,configurable:!0}),Object.defineProperty(globalThis,"ImageData",{value:o,writable:!0,configurable:!0}),Object.defineProperty(globalThis,"Path2D",{value:c,writable:!0,configurable:!0});export{e as Canvas2DBridge,t as CanvasGradient,n as CanvasPattern,r as CanvasRenderingContext2D,a as ImageData,s as Path2D,l as parseColor};
|
|
@@ -2,6 +2,7 @@ import GObject from 'gi://GObject';
|
|
|
2
2
|
import type Gdk from 'gi://Gdk?version=4.0';
|
|
3
3
|
import GLib from 'gi://GLib?version=2.0';
|
|
4
4
|
import Gtk from 'gi://Gtk?version=4.0';
|
|
5
|
+
import type Cairo from 'cairo';
|
|
5
6
|
import { HTMLCanvasElement as GjsifyHTMLCanvasElement } from '@gjsify/dom-elements';
|
|
6
7
|
import type { CanvasRenderingContext2D } from '@gjsify/canvas2d-core';
|
|
7
8
|
type Canvas2DReadyCallback = (canvas: globalThis.HTMLCanvasElement, ctx: CanvasRenderingContext2D) => void;
|
|
@@ -34,7 +35,7 @@ export declare const Canvas2DBridge: {
|
|
|
34
35
|
_frameCallback: FrameRequestCallback | null;
|
|
35
36
|
_timeOrigin: number;
|
|
36
37
|
/** @internal Draw function called by GTK. Blits the Cairo surface to screen. */
|
|
37
|
-
_onDraw(_area: Gtk.DrawingArea, cr:
|
|
38
|
+
_onDraw(_area: Gtk.DrawingArea, cr: Cairo.Context, width: number, height: number): void;
|
|
38
39
|
/** The HTMLCanvasElement backing this widget. Available after the first draw. */
|
|
39
40
|
get canvas(): globalThis.HTMLCanvasElement | null;
|
|
40
41
|
/** Get the 2D rendering context. Available after the first draw. */
|
|
@@ -293,7 +294,7 @@ export declare const Canvas2DBridge: {
|
|
|
293
294
|
get_focus_on_click(): boolean;
|
|
294
295
|
get_focusable(): boolean;
|
|
295
296
|
get_font_map(): import("@girs/pango-1.0").default.FontMap | null;
|
|
296
|
-
get_font_options():
|
|
297
|
+
get_font_options(): Cairo.FontOptions | null;
|
|
297
298
|
get_frame_clock(): Gdk.FrameClock | null;
|
|
298
299
|
get_halign(): Gtk.Align;
|
|
299
300
|
get_has_tooltip(): boolean;
|
|
@@ -378,7 +379,7 @@ export declare const Canvas2DBridge: {
|
|
|
378
379
|
set_focus_on_click(focus_on_click: boolean): void;
|
|
379
380
|
set_focusable(focusable: boolean): void;
|
|
380
381
|
set_font_map(font_map: import("@girs/pango-1.0").default.FontMap | null): void;
|
|
381
|
-
set_font_options(options:
|
|
382
|
+
set_font_options(options: Cairo.FontOptions | null): void;
|
|
382
383
|
set_halign(align: Gtk.Align): void;
|
|
383
384
|
set_has_tooltip(has_tooltip: boolean): void;
|
|
384
385
|
set_hexpand(expand: boolean): void;
|
|
@@ -462,7 +463,7 @@ export declare const Canvas2DBridge: {
|
|
|
462
463
|
_frameCallback: FrameRequestCallback | null;
|
|
463
464
|
_timeOrigin: number;
|
|
464
465
|
/** @internal Draw function called by GTK. Blits the Cairo surface to screen. */
|
|
465
|
-
_onDraw(_area: Gtk.DrawingArea, cr:
|
|
466
|
+
_onDraw(_area: Gtk.DrawingArea, cr: Cairo.Context, width: number, height: number): void;
|
|
466
467
|
/** The HTMLCanvasElement backing this widget. Available after the first draw. */
|
|
467
468
|
get canvas(): globalThis.HTMLCanvasElement | null;
|
|
468
469
|
/** Get the 2D rendering context. Available after the first draw. */
|
|
@@ -721,7 +722,7 @@ export declare const Canvas2DBridge: {
|
|
|
721
722
|
get_focus_on_click(): boolean;
|
|
722
723
|
get_focusable(): boolean;
|
|
723
724
|
get_font_map(): import("@girs/pango-1.0").default.FontMap | null;
|
|
724
|
-
get_font_options():
|
|
725
|
+
get_font_options(): Cairo.FontOptions | null;
|
|
725
726
|
get_frame_clock(): Gdk.FrameClock | null;
|
|
726
727
|
get_halign(): Gtk.Align;
|
|
727
728
|
get_has_tooltip(): boolean;
|
|
@@ -806,7 +807,7 @@ export declare const Canvas2DBridge: {
|
|
|
806
807
|
set_focus_on_click(focus_on_click: boolean): void;
|
|
807
808
|
set_focusable(focusable: boolean): void;
|
|
808
809
|
set_font_map(font_map: import("@girs/pango-1.0").default.FontMap | null): void;
|
|
809
|
-
set_font_options(options:
|
|
810
|
+
set_font_options(options: Cairo.FontOptions | null): void;
|
|
810
811
|
set_halign(align: Gtk.Align): void;
|
|
811
812
|
set_has_tooltip(has_tooltip: boolean): void;
|
|
812
813
|
set_hexpand(expand: boolean): void;
|
|
@@ -890,7 +891,7 @@ export declare const Canvas2DBridge: {
|
|
|
890
891
|
_frameCallback: FrameRequestCallback | null;
|
|
891
892
|
_timeOrigin: number;
|
|
892
893
|
/** @internal Draw function called by GTK. Blits the Cairo surface to screen. */
|
|
893
|
-
_onDraw(_area: Gtk.DrawingArea, cr:
|
|
894
|
+
_onDraw(_area: Gtk.DrawingArea, cr: Cairo.Context, width: number, height: number): void;
|
|
894
895
|
/** The HTMLCanvasElement backing this widget. Available after the first draw. */
|
|
895
896
|
get canvas(): globalThis.HTMLCanvasElement | null;
|
|
896
897
|
/** Get the 2D rendering context. Available after the first draw. */
|
|
@@ -1149,7 +1150,7 @@ export declare const Canvas2DBridge: {
|
|
|
1149
1150
|
get_focus_on_click(): boolean;
|
|
1150
1151
|
get_focusable(): boolean;
|
|
1151
1152
|
get_font_map(): import("@girs/pango-1.0").default.FontMap | null;
|
|
1152
|
-
get_font_options():
|
|
1153
|
+
get_font_options(): Cairo.FontOptions | null;
|
|
1153
1154
|
get_frame_clock(): Gdk.FrameClock | null;
|
|
1154
1155
|
get_halign(): Gtk.Align;
|
|
1155
1156
|
get_has_tooltip(): boolean;
|
|
@@ -1234,7 +1235,7 @@ export declare const Canvas2DBridge: {
|
|
|
1234
1235
|
set_focus_on_click(focus_on_click: boolean): void;
|
|
1235
1236
|
set_focusable(focusable: boolean): void;
|
|
1236
1237
|
set_font_map(font_map: import("@girs/pango-1.0").default.FontMap | null): void;
|
|
1237
|
-
set_font_options(options:
|
|
1238
|
+
set_font_options(options: Cairo.FontOptions | null): void;
|
|
1238
1239
|
set_halign(align: Gtk.Align): void;
|
|
1239
1240
|
set_has_tooltip(has_tooltip: boolean): void;
|
|
1240
1241
|
set_hexpand(expand: boolean): void;
|
|
@@ -1318,7 +1319,7 @@ export declare const Canvas2DBridge: {
|
|
|
1318
1319
|
_frameCallback: FrameRequestCallback | null;
|
|
1319
1320
|
_timeOrigin: number;
|
|
1320
1321
|
/** @internal Draw function called by GTK. Blits the Cairo surface to screen. */
|
|
1321
|
-
_onDraw(_area: Gtk.DrawingArea, cr:
|
|
1322
|
+
_onDraw(_area: Gtk.DrawingArea, cr: Cairo.Context, width: number, height: number): void;
|
|
1322
1323
|
/** The HTMLCanvasElement backing this widget. Available after the first draw. */
|
|
1323
1324
|
get canvas(): globalThis.HTMLCanvasElement | null;
|
|
1324
1325
|
/** Get the 2D rendering context. Available after the first draw. */
|
|
@@ -1577,7 +1578,7 @@ export declare const Canvas2DBridge: {
|
|
|
1577
1578
|
get_focus_on_click(): boolean;
|
|
1578
1579
|
get_focusable(): boolean;
|
|
1579
1580
|
get_font_map(): import("@girs/pango-1.0").default.FontMap | null;
|
|
1580
|
-
get_font_options():
|
|
1581
|
+
get_font_options(): Cairo.FontOptions | null;
|
|
1581
1582
|
get_frame_clock(): Gdk.FrameClock | null;
|
|
1582
1583
|
get_halign(): Gtk.Align;
|
|
1583
1584
|
get_has_tooltip(): boolean;
|
|
@@ -1662,7 +1663,7 @@ export declare const Canvas2DBridge: {
|
|
|
1662
1663
|
set_focus_on_click(focus_on_click: boolean): void;
|
|
1663
1664
|
set_focusable(focusable: boolean): void;
|
|
1664
1665
|
set_font_map(font_map: import("@girs/pango-1.0").default.FontMap | null): void;
|
|
1665
|
-
set_font_options(options:
|
|
1666
|
+
set_font_options(options: Cairo.FontOptions | null): void;
|
|
1666
1667
|
set_halign(align: Gtk.Align): void;
|
|
1667
1668
|
set_has_tooltip(has_tooltip: boolean): void;
|
|
1668
1669
|
set_hexpand(expand: boolean): void;
|
|
@@ -1746,7 +1747,7 @@ export declare const Canvas2DBridge: {
|
|
|
1746
1747
|
_frameCallback: FrameRequestCallback | null;
|
|
1747
1748
|
_timeOrigin: number;
|
|
1748
1749
|
/** @internal Draw function called by GTK. Blits the Cairo surface to screen. */
|
|
1749
|
-
_onDraw(_area: Gtk.DrawingArea, cr:
|
|
1750
|
+
_onDraw(_area: Gtk.DrawingArea, cr: Cairo.Context, width: number, height: number): void;
|
|
1750
1751
|
/** The HTMLCanvasElement backing this widget. Available after the first draw. */
|
|
1751
1752
|
get canvas(): globalThis.HTMLCanvasElement | null;
|
|
1752
1753
|
/** Get the 2D rendering context. Available after the first draw. */
|
|
@@ -2005,7 +2006,7 @@ export declare const Canvas2DBridge: {
|
|
|
2005
2006
|
get_focus_on_click(): boolean;
|
|
2006
2007
|
get_focusable(): boolean;
|
|
2007
2008
|
get_font_map(): import("@girs/pango-1.0").default.FontMap | null;
|
|
2008
|
-
get_font_options():
|
|
2009
|
+
get_font_options(): Cairo.FontOptions | null;
|
|
2009
2010
|
get_frame_clock(): Gdk.FrameClock | null;
|
|
2010
2011
|
get_halign(): Gtk.Align;
|
|
2011
2012
|
get_has_tooltip(): boolean;
|
|
@@ -2090,7 +2091,7 @@ export declare const Canvas2DBridge: {
|
|
|
2090
2091
|
set_focus_on_click(focus_on_click: boolean): void;
|
|
2091
2092
|
set_focusable(focusable: boolean): void;
|
|
2092
2093
|
set_font_map(font_map: import("@girs/pango-1.0").default.FontMap | null): void;
|
|
2093
|
-
set_font_options(options:
|
|
2094
|
+
set_font_options(options: Cairo.FontOptions | null): void;
|
|
2094
2095
|
set_halign(align: Gtk.Align): void;
|
|
2095
2096
|
set_has_tooltip(has_tooltip: boolean): void;
|
|
2096
2097
|
set_hexpand(expand: boolean): void;
|
|
@@ -2174,7 +2175,7 @@ export declare const Canvas2DBridge: {
|
|
|
2174
2175
|
_frameCallback: FrameRequestCallback | null;
|
|
2175
2176
|
_timeOrigin: number;
|
|
2176
2177
|
/** @internal Draw function called by GTK. Blits the Cairo surface to screen. */
|
|
2177
|
-
_onDraw(_area: Gtk.DrawingArea, cr:
|
|
2178
|
+
_onDraw(_area: Gtk.DrawingArea, cr: Cairo.Context, width: number, height: number): void;
|
|
2178
2179
|
/** The HTMLCanvasElement backing this widget. Available after the first draw. */
|
|
2179
2180
|
get canvas(): globalThis.HTMLCanvasElement | null;
|
|
2180
2181
|
/** Get the 2D rendering context. Available after the first draw. */
|
|
@@ -2433,7 +2434,7 @@ export declare const Canvas2DBridge: {
|
|
|
2433
2434
|
get_focus_on_click(): boolean;
|
|
2434
2435
|
get_focusable(): boolean;
|
|
2435
2436
|
get_font_map(): import("@girs/pango-1.0").default.FontMap | null;
|
|
2436
|
-
get_font_options():
|
|
2437
|
+
get_font_options(): Cairo.FontOptions | null;
|
|
2437
2438
|
get_frame_clock(): Gdk.FrameClock | null;
|
|
2438
2439
|
get_halign(): Gtk.Align;
|
|
2439
2440
|
get_has_tooltip(): boolean;
|
|
@@ -2518,7 +2519,7 @@ export declare const Canvas2DBridge: {
|
|
|
2518
2519
|
set_focus_on_click(focus_on_click: boolean): void;
|
|
2519
2520
|
set_focusable(focusable: boolean): void;
|
|
2520
2521
|
set_font_map(font_map: import("@girs/pango-1.0").default.FontMap | null): void;
|
|
2521
|
-
set_font_options(options:
|
|
2522
|
+
set_font_options(options: Cairo.FontOptions | null): void;
|
|
2522
2523
|
set_halign(align: Gtk.Align): void;
|
|
2523
2524
|
set_has_tooltip(has_tooltip: boolean): void;
|
|
2524
2525
|
set_hexpand(expand: boolean): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/canvas2d",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.32",
|
|
4
4
|
"description": "Canvas 2D rendering context for GJS, backed by Cairo",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -40,16 +40,23 @@
|
|
|
40
40
|
"@girs/gtk-4.0": "4.23.0-4.0.1",
|
|
41
41
|
"@girs/pango-1.0": "1.57.1-4.0.1",
|
|
42
42
|
"@girs/pangocairo-1.0": "1.0.0-4.0.1",
|
|
43
|
-
"@gjsify/canvas2d-core": "^0.4.
|
|
44
|
-
"@gjsify/dom-elements": "^0.4.
|
|
45
|
-
"@gjsify/dom-events": "^0.4.
|
|
46
|
-
"@gjsify/event-bridge": "^0.4.
|
|
47
|
-
"@gjsify/utils": "^0.4.
|
|
43
|
+
"@gjsify/canvas2d-core": "^0.4.32",
|
|
44
|
+
"@gjsify/dom-elements": "^0.4.32",
|
|
45
|
+
"@gjsify/dom-events": "^0.4.32",
|
|
46
|
+
"@gjsify/event-bridge": "^0.4.32",
|
|
47
|
+
"@gjsify/utils": "^0.4.32"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@gjsify/cli": "^0.4.
|
|
51
|
-
"@gjsify/unit": "^0.4.
|
|
50
|
+
"@gjsify/cli": "^0.4.32",
|
|
51
|
+
"@gjsify/unit": "^0.4.32",
|
|
52
52
|
"@types/node": "^25.9.1",
|
|
53
53
|
"typescript": "^6.0.3"
|
|
54
|
+
},
|
|
55
|
+
"gjsify": {
|
|
56
|
+
"runtimes": {
|
|
57
|
+
"gjs": "polyfill",
|
|
58
|
+
"node": "none",
|
|
59
|
+
"browser": "none"
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
}
|