modern-canvas 0.1.5 → 0.1.6
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/index.cjs +45 -5
- package/dist/index.d.cts +28 -5
- package/dist/index.d.mts +28 -5
- package/dist/index.d.ts +28 -5
- package/dist/index.js +31 -31
- package/dist/index.mjs +45 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -246,6 +246,45 @@ class EventEmitter {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
class RawWeakMap {
|
|
250
|
+
_map = /* @__PURE__ */ new WeakMap();
|
|
251
|
+
_toRaw(value) {
|
|
252
|
+
if (value && typeof value === "object") {
|
|
253
|
+
if ("__v_raw" in value) {
|
|
254
|
+
value = value.__v_raw;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return value;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Removes the specified element from the WeakMap.
|
|
261
|
+
* @returns true if the element was successfully removed, or false if it was not present.
|
|
262
|
+
*/
|
|
263
|
+
delete(key) {
|
|
264
|
+
return this._map.delete(this._toRaw(key));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @returns a specified element.
|
|
268
|
+
*/
|
|
269
|
+
get(key) {
|
|
270
|
+
return this._map.get(this._toRaw(key));
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* @returns a boolean indicating whether an element with the specified key exists or not.
|
|
274
|
+
*/
|
|
275
|
+
has(key) {
|
|
276
|
+
return this._map.has(this._toRaw(key));
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Adds a new element with a specified key and value.
|
|
280
|
+
* @param key Must be an object or symbol.
|
|
281
|
+
*/
|
|
282
|
+
set(key, value) {
|
|
283
|
+
this._map.set(this._toRaw(key), this._toRaw(value));
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
249
288
|
const customNodes = /* @__PURE__ */ new Map();
|
|
250
289
|
function customNode(options) {
|
|
251
290
|
let tag;
|
|
@@ -272,7 +311,7 @@ function customNode(options) {
|
|
|
272
311
|
};
|
|
273
312
|
}
|
|
274
313
|
|
|
275
|
-
const declarationMap =
|
|
314
|
+
const declarationMap = new RawWeakMap();
|
|
276
315
|
function getDeclarations(constructor) {
|
|
277
316
|
let declarations = declarationMap.get(constructor);
|
|
278
317
|
if (!declarations) {
|
|
@@ -537,7 +576,7 @@ class Geometry extends Resource {
|
|
|
537
576
|
indexBuffer;
|
|
538
577
|
instanceCount;
|
|
539
578
|
mode;
|
|
540
|
-
_materialWeakMap =
|
|
579
|
+
_materialWeakMap = new RawWeakMap();
|
|
541
580
|
constructor(options = {}) {
|
|
542
581
|
super();
|
|
543
582
|
this.vertexAttributes = new Map(Object.entries(options?.vertexAttributes ?? {}));
|
|
@@ -4458,7 +4497,7 @@ let Animation2D = class extends Node {
|
|
|
4458
4497
|
easing;
|
|
4459
4498
|
_keyframes = [];
|
|
4460
4499
|
_starting = false;
|
|
4461
|
-
_startProps =
|
|
4500
|
+
_startProps = new RawWeakMap();
|
|
4462
4501
|
constructor(options) {
|
|
4463
4502
|
super();
|
|
4464
4503
|
this._onUpdateTime = this._onUpdateTime.bind(this);
|
|
@@ -9309,7 +9348,7 @@ class Renderer {
|
|
|
9309
9348
|
view;
|
|
9310
9349
|
pixelRatio = DEVICE_PIXEL_RATIO;
|
|
9311
9350
|
screen = { x: 0, y: 0, width: 0, height: 0 };
|
|
9312
|
-
related =
|
|
9351
|
+
related = new RawWeakMap();
|
|
9313
9352
|
getRelated(source, createFn) {
|
|
9314
9353
|
let related = this.related.get(source);
|
|
9315
9354
|
if (related)
|
|
@@ -10381,7 +10420,7 @@ class WebGLProgramModule extends WebGLModule {
|
|
|
10381
10420
|
return {
|
|
10382
10421
|
attributes: /* @__PURE__ */ new Map(),
|
|
10383
10422
|
uniforms: /* @__PURE__ */ new Map(),
|
|
10384
|
-
boundUniforms:
|
|
10423
|
+
boundUniforms: new RawWeakMap()
|
|
10385
10424
|
};
|
|
10386
10425
|
});
|
|
10387
10426
|
}
|
|
@@ -11539,4 +11578,4 @@ async function render(options) {
|
|
|
11539
11578
|
});
|
|
11540
11579
|
}
|
|
11541
11580
|
|
|
11542
|
-
export { Animation2D, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BlurEffect, CanvasContext, CanvasItem, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, DEG_TO_RAD, DEVICE_PIXEL_RATIO, Effect, EffectMaterial, EmbossEffect, Engine, EventEmitter, FontLoader, Geometry, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, Image2DResource, ImageTexture, IndexBuffer, Input, InternalMode, JsonLoader, KawaseEffect, LeftEraseEffect, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Reference, RenderStack, Renderer, Resource, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SceneTree, Style2D, Style2DBackgroundModule, Style2DFilterModule, Style2DModule, Style2DTextModule, Style2DTransformModule, Text2D, TextLoader, Texture, TextureLoader, Ticker, TiltShiftEffect, Timer, Transform2D, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, assets, clamp, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, timingFunctions, uid };
|
|
11581
|
+
export { Animation2D, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BlurEffect, CanvasContext, CanvasItem, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, DEG_TO_RAD, DEVICE_PIXEL_RATIO, Effect, EffectMaterial, EmbossEffect, Engine, EventEmitter, FontLoader, Geometry, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, Image2DResource, ImageTexture, IndexBuffer, Input, InternalMode, JsonLoader, KawaseEffect, LeftEraseEffect, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, RawWeakMap, Reference, RenderStack, Renderer, Resource, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SceneTree, Style2D, Style2DBackgroundModule, Style2DFilterModule, Style2DModule, Style2DTextModule, Style2DTransformModule, Text2D, TextLoader, Texture, TextureLoader, Ticker, TiltShiftEffect, Timer, Transform2D, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, assets, clamp, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, timingFunctions, uid };
|