modern-canvas 0.1.5 → 0.1.7

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.mjs CHANGED
@@ -246,6 +246,47 @@ class EventEmitter {
246
246
  }
247
247
  }
248
248
 
249
+ class RawWeakMap {
250
+ _map = /* @__PURE__ */ new WeakMap();
251
+ // fix: vue reactive object
252
+ _toRaw(value) {
253
+ if (value && typeof value === "object") {
254
+ const raw = value.__v_raw;
255
+ if (raw) {
256
+ value = this._toRaw(raw);
257
+ }
258
+ }
259
+ return value;
260
+ }
261
+ /**
262
+ * Removes the specified element from the WeakMap.
263
+ * @returns true if the element was successfully removed, or false if it was not present.
264
+ */
265
+ delete(key) {
266
+ return this._map.delete(this._toRaw(key));
267
+ }
268
+ /**
269
+ * @returns a specified element.
270
+ */
271
+ get(key) {
272
+ return this._map.get(this._toRaw(key));
273
+ }
274
+ /**
275
+ * @returns a boolean indicating whether an element with the specified key exists or not.
276
+ */
277
+ has(key) {
278
+ return this._map.has(this._toRaw(key));
279
+ }
280
+ /**
281
+ * Adds a new element with a specified key and value.
282
+ * @param key Must be an object or symbol.
283
+ */
284
+ set(key, value) {
285
+ this._map.set(this._toRaw(key), this._toRaw(value));
286
+ return this;
287
+ }
288
+ }
289
+
249
290
  const customNodes = /* @__PURE__ */ new Map();
250
291
  function customNode(options) {
251
292
  let tag;
@@ -272,7 +313,7 @@ function customNode(options) {
272
313
  };
273
314
  }
274
315
 
275
- const declarationMap = /* @__PURE__ */ new WeakMap();
316
+ const declarationMap = new RawWeakMap();
276
317
  function getDeclarations(constructor) {
277
318
  let declarations = declarationMap.get(constructor);
278
319
  if (!declarations) {
@@ -537,7 +578,7 @@ class Geometry extends Resource {
537
578
  indexBuffer;
538
579
  instanceCount;
539
580
  mode;
540
- _materialWeakMap = /* @__PURE__ */ new WeakMap();
581
+ _materialWeakMap = new RawWeakMap();
541
582
  constructor(options = {}) {
542
583
  super();
543
584
  this.vertexAttributes = new Map(Object.entries(options?.vertexAttributes ?? {}));
@@ -4458,7 +4499,7 @@ let Animation2D = class extends Node {
4458
4499
  easing;
4459
4500
  _keyframes = [];
4460
4501
  _starting = false;
4461
- _startProps = /* @__PURE__ */ new WeakMap();
4502
+ _startProps = new RawWeakMap();
4462
4503
  constructor(options) {
4463
4504
  super();
4464
4505
  this._onUpdateTime = this._onUpdateTime.bind(this);
@@ -9309,7 +9350,7 @@ class Renderer {
9309
9350
  view;
9310
9351
  pixelRatio = DEVICE_PIXEL_RATIO;
9311
9352
  screen = { x: 0, y: 0, width: 0, height: 0 };
9312
- related = /* @__PURE__ */ new WeakMap();
9353
+ related = new RawWeakMap();
9313
9354
  getRelated(source, createFn) {
9314
9355
  let related = this.related.get(source);
9315
9356
  if (related)
@@ -10381,7 +10422,7 @@ class WebGLProgramModule extends WebGLModule {
10381
10422
  return {
10382
10423
  attributes: /* @__PURE__ */ new Map(),
10383
10424
  uniforms: /* @__PURE__ */ new Map(),
10384
- boundUniforms: /* @__PURE__ */ new WeakMap()
10425
+ boundUniforms: new RawWeakMap()
10385
10426
  };
10386
10427
  });
10387
10428
  }
@@ -11539,4 +11580,4 @@ async function render(options) {
11539
11580
  });
11540
11581
  }
11541
11582
 
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 };
11583
+ 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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.7",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",