@antv/g-webgpu 1.7.19 → 1.7.20

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.umd.js CHANGED
@@ -1194,15 +1194,6 @@
1194
1194
 
1195
1195
  function __param(paramIndex, decorator) {
1196
1196
  return function (target, key) { decorator(target, key, paramIndex); }
1197
- }
1198
-
1199
- /** @deprecated */
1200
- function __spreadArrays() {
1201
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1202
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
1203
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
1204
- r[k] = a[j];
1205
- return r;
1206
1197
  }
1207
1198
 
1208
1199
  var eventemitter3 = createCommonjsModule(function (module) {
@@ -1978,148 +1969,6 @@
1978
1969
  return _setPrototypeOf$1(o, p);
1979
1970
  }
1980
1971
 
1981
- var toString$1 = {}.toString;
1982
-
1983
- var isType$1 = function isType(value, type) {
1984
- return toString$1.call(value) === '[object ' + type + ']';
1985
- };
1986
- /**
1987
- * 是否为函数
1988
- * @param {*} fn 对象
1989
- * @return {Boolean} 是否函数
1990
- */
1991
-
1992
-
1993
- var isFunction = function isFunction(value) {
1994
- return isType$1(value, 'Function');
1995
- };
1996
-
1997
- var isArray = function isArray(value) {
1998
- return Array.isArray ? Array.isArray(value) : isType$1(value, 'Array');
1999
- };
2000
-
2001
- var isObject = function isObject(value) {
2002
- /**
2003
- * isObject({}) => true
2004
- * isObject([1, 2, 3]) => true
2005
- * isObject(Function) => true
2006
- * isObject(null) => false
2007
- */
2008
- var type = typeof value;
2009
- return value !== null && type === 'object' || type === 'function';
2010
- };
2011
-
2012
- function each(elements, func) {
2013
- if (!elements) {
2014
- return;
2015
- }
2016
-
2017
- var rst;
2018
-
2019
- if (isArray(elements)) {
2020
- for (var i = 0, len = elements.length; i < len; i++) {
2021
- rst = func(elements[i], i);
2022
-
2023
- if (rst === false) {
2024
- break;
2025
- }
2026
- }
2027
- } else if (isObject(elements)) {
2028
- for (var k in elements) {
2029
- if (elements.hasOwnProperty(k)) {
2030
- rst = func(elements[k], k);
2031
-
2032
- if (rst === false) {
2033
- break;
2034
- }
2035
- }
2036
- }
2037
- }
2038
- }
2039
-
2040
- var isString$1 = function isString(str) {
2041
- return isType$1(str, 'String');
2042
- }; // @ts-ignore
2043
-
2044
-
2045
- var values = Object.values ? function (obj) {
2046
- return Object.values(obj);
2047
- } : function (obj) {
2048
- var result = [];
2049
- each(obj, function (value, key) {
2050
- if (!(isFunction(obj) && key === 'prototype')) {
2051
- result.push(value);
2052
- }
2053
- });
2054
- return result;
2055
- };
2056
- /**
2057
- * _.memoize(calColor);
2058
- * _.memoize(calColor, (...args) => args[0]);
2059
- * @param f
2060
- * @param resolver
2061
- */
2062
-
2063
- var memoize = function memoize(f, resolver) {
2064
- if (!isFunction(f)) {
2065
- throw new TypeError('Expected a function');
2066
- }
2067
-
2068
- var memoized = function memoized() {
2069
- var args = [];
2070
-
2071
- for (var _i = 0; _i < arguments.length; _i++) {
2072
- args[_i] = arguments[_i];
2073
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
2074
-
2075
-
2076
- var key = resolver ? resolver.apply(this, args) : args[0];
2077
- var cache = memoized.cache;
2078
-
2079
- if (cache.has(key)) {
2080
- return cache.get(key);
2081
- }
2082
-
2083
- var result = f.apply(this, args); // 缓存起来
2084
-
2085
- cache.set(key, result);
2086
- return result;
2087
- };
2088
-
2089
- memoized.cache = new Map();
2090
- return memoized;
2091
- };
2092
-
2093
- var ctx;
2094
- /**
2095
- * 计算文本的宽度
2096
- */
2097
-
2098
- memoize(function (text, font) {
2099
- if (font === void 0) {
2100
- font = {};
2101
- }
2102
-
2103
- var fontSize = font.fontSize,
2104
- fontFamily = font.fontFamily,
2105
- fontWeight = font.fontWeight,
2106
- fontStyle = font.fontStyle,
2107
- fontVariant = font.fontVariant;
2108
-
2109
- if (!ctx) {
2110
- ctx = document.createElement('canvas').getContext('2d');
2111
- }
2112
-
2113
- ctx.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
2114
- return ctx.measureText(isString$1(text) ? text : '').width;
2115
- }, function (text, font) {
2116
- if (font === void 0) {
2117
- font = {};
2118
- }
2119
-
2120
- return __spreadArrays([text], values(font)).join('');
2121
- });
2122
-
2123
1972
  var ImagePool = /*#__PURE__*/function () {
2124
1973
  function ImagePool(canvasConfig) {
2125
1974
  this.canvasConfig = void 0;
@@ -2192,7 +2041,7 @@
2192
2041
  repetition = pattern.repetition;
2193
2042
  var src; // Image URL
2194
2043
 
2195
- if (isString$1(image)) {
2044
+ if (isString(image)) {
2196
2045
  src = this.getImageSync(image, callback);
2197
2046
  } else {
2198
2047
  src = image;
@@ -2276,7 +2125,7 @@
2276
2125
  var image = pattern.image,
2277
2126
  repetition = pattern.repetition; // only generate cache for Image
2278
2127
 
2279
- if (isString$1(image)) {
2128
+ if (isString(image)) {
2280
2129
  return "pattern-" + image + "-" + repetition;
2281
2130
  }
2282
2131
  };
@@ -2310,7 +2159,7 @@
2310
2159
  if (nodeName === gLite.Shape.IMAGE) {
2311
2160
  var img = attributes.img;
2312
2161
 
2313
- if (isString$1(img)) {
2162
+ if (isString(img)) {
2314
2163
  _this.imagePool.getImageSync(img, function () {
2315
2164
  // set dirty rectangle flag
2316
2165
  object.renderable.dirty = true;
@@ -2327,7 +2176,7 @@
2327
2176
 
2328
2177
  if (object.nodeName === gLite.Shape.IMAGE) {
2329
2178
  if (attrName === 'img') {
2330
- if (isString$1(newValue)) {
2179
+ if (isString(newValue)) {
2331
2180
  _this.imagePool.getOrCreateImage(newValue).then(function () {
2332
2181
  // set dirty rectangle flag
2333
2182
  object.renderable.dirty = true;
@@ -16622,148 +16471,6 @@
16622
16471
  return _setPrototypeOf$4(o, p);
16623
16472
  }
16624
16473
 
16625
- var toString$2 = {}.toString;
16626
-
16627
- var isType$2 = function isType(value, type) {
16628
- return toString$2.call(value) === '[object ' + type + ']';
16629
- };
16630
- /**
16631
- * 是否为函数
16632
- * @param {*} fn 对象
16633
- * @return {Boolean} 是否函数
16634
- */
16635
-
16636
-
16637
- var isFunction$1 = function isFunction(value) {
16638
- return isType$2(value, 'Function');
16639
- };
16640
-
16641
- var isArray$1 = function isArray(value) {
16642
- return Array.isArray ? Array.isArray(value) : isType$2(value, 'Array');
16643
- };
16644
-
16645
- var isObject$1 = function isObject(value) {
16646
- /**
16647
- * isObject({}) => true
16648
- * isObject([1, 2, 3]) => true
16649
- * isObject(Function) => true
16650
- * isObject(null) => false
16651
- */
16652
- var type = typeof value;
16653
- return value !== null && type === 'object' || type === 'function';
16654
- };
16655
-
16656
- function each$1(elements, func) {
16657
- if (!elements) {
16658
- return;
16659
- }
16660
-
16661
- var rst;
16662
-
16663
- if (isArray$1(elements)) {
16664
- for (var i = 0, len = elements.length; i < len; i++) {
16665
- rst = func(elements[i], i);
16666
-
16667
- if (rst === false) {
16668
- break;
16669
- }
16670
- }
16671
- } else if (isObject$1(elements)) {
16672
- for (var k in elements) {
16673
- if (elements.hasOwnProperty(k)) {
16674
- rst = func(elements[k], k);
16675
-
16676
- if (rst === false) {
16677
- break;
16678
- }
16679
- }
16680
- }
16681
- }
16682
- }
16683
-
16684
- var isString$2 = function isString(str) {
16685
- return isType$2(str, 'String');
16686
- }; // @ts-ignore
16687
-
16688
-
16689
- var values$1 = Object.values ? function (obj) {
16690
- return Object.values(obj);
16691
- } : function (obj) {
16692
- var result = [];
16693
- each$1(obj, function (value, key) {
16694
- if (!(isFunction$1(obj) && key === 'prototype')) {
16695
- result.push(value);
16696
- }
16697
- });
16698
- return result;
16699
- };
16700
- /**
16701
- * _.memoize(calColor);
16702
- * _.memoize(calColor, (...args) => args[0]);
16703
- * @param f
16704
- * @param resolver
16705
- */
16706
-
16707
- var memoize$1 = function memoize(f, resolver) {
16708
- if (!isFunction$1(f)) {
16709
- throw new TypeError('Expected a function');
16710
- }
16711
-
16712
- var memoized = function memoized() {
16713
- var args = [];
16714
-
16715
- for (var _i = 0; _i < arguments.length; _i++) {
16716
- args[_i] = arguments[_i];
16717
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
16718
-
16719
-
16720
- var key = resolver ? resolver.apply(this, args) : args[0];
16721
- var cache = memoized.cache;
16722
-
16723
- if (cache.has(key)) {
16724
- return cache.get(key);
16725
- }
16726
-
16727
- var result = f.apply(this, args); // 缓存起来
16728
-
16729
- cache.set(key, result);
16730
- return result;
16731
- };
16732
-
16733
- memoized.cache = new Map();
16734
- return memoized;
16735
- };
16736
-
16737
- var ctx$1;
16738
- /**
16739
- * 计算文本的宽度
16740
- */
16741
-
16742
- memoize$1(function (text, font) {
16743
- if (font === void 0) {
16744
- font = {};
16745
- }
16746
-
16747
- var fontSize = font.fontSize,
16748
- fontFamily = font.fontFamily,
16749
- fontWeight = font.fontWeight,
16750
- fontStyle = font.fontStyle,
16751
- fontVariant = font.fontVariant;
16752
-
16753
- if (!ctx$1) {
16754
- ctx$1 = document.createElement('canvas').getContext('2d');
16755
- }
16756
-
16757
- ctx$1.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
16758
- return ctx$1.measureText(isString$2(text) ? text : '').width;
16759
- }, function (text, font) {
16760
- if (font === void 0) {
16761
- font = {};
16762
- }
16763
-
16764
- return __spreadArrays([text], values$1(font)).join('');
16765
- });
16766
-
16767
16474
  var _class$3;
16768
16475
 
16769
16476
  var HTMLRenderingPlugin_1;
@@ -16926,7 +16633,7 @@
16926
16633
  case 'innerHTML':
16927
16634
  var innerHTML = object.parsedStyle.innerHTML;
16928
16635
 
16929
- if (isString$2(innerHTML)) {
16636
+ if (isString(innerHTML)) {
16930
16637
  $el.innerHTML = innerHTML;
16931
16638
  } else {
16932
16639
  $el.innerHTML = '';
@@ -18460,157 +18167,6 @@
18460
18167
  return ComputePipeline_WebGPU;
18461
18168
  }(ResourceBase_WebGPU);
18462
18169
 
18463
- var toString$3 = {}.toString;
18464
-
18465
- var isType$3 = function isType(value, type) {
18466
- return toString$3.call(value) === '[object ' + type + ']';
18467
- };
18468
- /**
18469
- * 是否为函数
18470
- * @param {*} fn 对象
18471
- * @return {Boolean} 是否函数
18472
- */
18473
-
18474
-
18475
- var isFunction$2 = function isFunction(value) {
18476
- return isType$3(value, 'Function');
18477
- }; // isFinite,
18478
-
18479
-
18480
- var isNil$1 = function isNil(value) {
18481
- /**
18482
- * isNil(null) => true
18483
- * isNil() => true
18484
- */
18485
- return value === null || value === undefined;
18486
- };
18487
-
18488
- var isArray$2 = function isArray(value) {
18489
- return Array.isArray ? Array.isArray(value) : isType$3(value, 'Array');
18490
- };
18491
-
18492
- var isObject$2 = function isObject(value) {
18493
- /**
18494
- * isObject({}) => true
18495
- * isObject([1, 2, 3]) => true
18496
- * isObject(Function) => true
18497
- * isObject(null) => false
18498
- */
18499
- var type = typeof value;
18500
- return value !== null && type === 'object' || type === 'function';
18501
- };
18502
-
18503
- function each$2(elements, func) {
18504
- if (!elements) {
18505
- return;
18506
- }
18507
-
18508
- var rst;
18509
-
18510
- if (isArray$2(elements)) {
18511
- for (var i = 0, len = elements.length; i < len; i++) {
18512
- rst = func(elements[i], i);
18513
-
18514
- if (rst === false) {
18515
- break;
18516
- }
18517
- }
18518
- } else if (isObject$2(elements)) {
18519
- for (var k in elements) {
18520
- if (elements.hasOwnProperty(k)) {
18521
- rst = func(elements[k], k);
18522
-
18523
- if (rst === false) {
18524
- break;
18525
- }
18526
- }
18527
- }
18528
- }
18529
- }
18530
-
18531
- var isString$3 = function isString(str) {
18532
- return isType$3(str, 'String');
18533
- }; // @ts-ignore
18534
-
18535
-
18536
- var values$2 = Object.values ? function (obj) {
18537
- return Object.values(obj);
18538
- } : function (obj) {
18539
- var result = [];
18540
- each$2(obj, function (value, key) {
18541
- if (!(isFunction$2(obj) && key === 'prototype')) {
18542
- result.push(value);
18543
- }
18544
- });
18545
- return result;
18546
- };
18547
- /**
18548
- * _.memoize(calColor);
18549
- * _.memoize(calColor, (...args) => args[0]);
18550
- * @param f
18551
- * @param resolver
18552
- */
18553
-
18554
- var memoize$2 = function memoize(f, resolver) {
18555
- if (!isFunction$2(f)) {
18556
- throw new TypeError('Expected a function');
18557
- }
18558
-
18559
- var memoized = function memoized() {
18560
- var args = [];
18561
-
18562
- for (var _i = 0; _i < arguments.length; _i++) {
18563
- args[_i] = arguments[_i];
18564
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
18565
-
18566
-
18567
- var key = resolver ? resolver.apply(this, args) : args[0];
18568
- var cache = memoized.cache;
18569
-
18570
- if (cache.has(key)) {
18571
- return cache.get(key);
18572
- }
18573
-
18574
- var result = f.apply(this, args); // 缓存起来
18575
-
18576
- cache.set(key, result);
18577
- return result;
18578
- };
18579
-
18580
- memoized.cache = new Map();
18581
- return memoized;
18582
- };
18583
-
18584
- var ctx$2;
18585
- /**
18586
- * 计算文本的宽度
18587
- */
18588
-
18589
- memoize$2(function (text, font) {
18590
- if (font === void 0) {
18591
- font = {};
18592
- }
18593
-
18594
- var fontSize = font.fontSize,
18595
- fontFamily = font.fontFamily,
18596
- fontWeight = font.fontWeight,
18597
- fontStyle = font.fontStyle,
18598
- fontVariant = font.fontVariant;
18599
-
18600
- if (!ctx$2) {
18601
- ctx$2 = document.createElement('canvas').getContext('2d');
18602
- }
18603
-
18604
- ctx$2.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
18605
- return ctx$2.measureText(isString$3(text) ? text : '').width;
18606
- }, function (text, font) {
18607
- if (font === void 0) {
18608
- font = {};
18609
- }
18610
-
18611
- return __spreadArrays([text], values$2(font)).join('');
18612
- });
18613
-
18614
18170
  var InputLayout_WebGPU = /*#__PURE__*/function (_ResourceBase_WebGPU) {
18615
18171
  _inheritsLoose$5(InputLayout_WebGPU, _ResourceBase_WebGPU);
18616
18172
 
@@ -18631,7 +18187,7 @@
18631
18187
 
18632
18188
  for (var i = 0; i < descriptor.vertexBufferDescriptors.length; i++) {
18633
18189
  var b = descriptor.vertexBufferDescriptors[i];
18634
- if (isNil$1(b)) continue;
18190
+ if (isNil(b)) continue;
18635
18191
  var arrayStride = b.byteStride;
18636
18192
  var stepMode = translateVertexBufferFrequency(b.frequency);
18637
18193
  var attributes = [];
@@ -19319,7 +18875,7 @@
19319
18875
 
19320
18876
  for (var i = 0; i < inputState.vertexBuffers.length; i++) {
19321
18877
  var b = inputState.vertexBuffers[i];
19322
- if (isNil$1(b)) continue;
18878
+ if (isNil(b)) continue;
19323
18879
  this.gpuRenderPassEncoder.setVertexBuffer(i, getPlatformBuffer(b.buffer), b.byteOffset);
19324
18880
  }
19325
18881
  };
@@ -20285,122 +19841,6 @@
20285
19841
 
20286
19842
  var DeviceRendererPlugin = gLite.Syringe.defineToken('');
20287
19843
 
20288
- var toString$4 = {}.toString;
20289
- var isType$4 = function (value, type) { return toString$4.call(value) === '[object ' + type + ']'; };
20290
-
20291
- /**
20292
- * 是否为函数
20293
- * @param {*} fn 对象
20294
- * @return {Boolean} 是否函数
20295
- */
20296
- var isFunction$3 = (function (value) {
20297
- return isType$4(value, 'Function');
20298
- });
20299
-
20300
- var isArray$3 = (function (value) {
20301
- return Array.isArray ?
20302
- Array.isArray(value) :
20303
- isType$4(value, 'Array');
20304
- });
20305
-
20306
- var isObject$3 = (function (value) {
20307
- /**
20308
- * isObject({}) => true
20309
- * isObject([1, 2, 3]) => true
20310
- * isObject(Function) => true
20311
- * isObject(null) => false
20312
- */
20313
- var type = typeof value;
20314
- return value !== null && type === 'object' || type === 'function';
20315
- });
20316
-
20317
- function each$3(elements, func) {
20318
- if (!elements) {
20319
- return;
20320
- }
20321
- var rst;
20322
- if (isArray$3(elements)) {
20323
- for (var i = 0, len = elements.length; i < len; i++) {
20324
- rst = func(elements[i], i);
20325
- if (rst === false) {
20326
- break;
20327
- }
20328
- }
20329
- }
20330
- else if (isObject$3(elements)) {
20331
- for (var k in elements) {
20332
- if (elements.hasOwnProperty(k)) {
20333
- rst = func(elements[k], k);
20334
- if (rst === false) {
20335
- break;
20336
- }
20337
- }
20338
- }
20339
- }
20340
- }
20341
-
20342
- var isString$4 = (function (str) {
20343
- return isType$4(str, 'String');
20344
- });
20345
-
20346
- // @ts-ignore
20347
- var values$3 = Object.values ? function (obj) { return Object.values(obj); } : function (obj) {
20348
- var result = [];
20349
- each$3(obj, function (value, key) {
20350
- if (!(isFunction$3(obj) && key === 'prototype')) {
20351
- result.push(value);
20352
- }
20353
- });
20354
- return result;
20355
- };
20356
-
20357
- /**
20358
- * _.memoize(calColor);
20359
- * _.memoize(calColor, (...args) => args[0]);
20360
- * @param f
20361
- * @param resolver
20362
- */
20363
- var memoize$3 = (function (f, resolver) {
20364
- if (!isFunction$3(f)) {
20365
- throw new TypeError('Expected a function');
20366
- }
20367
- var memoized = function () {
20368
- var args = [];
20369
- for (var _i = 0; _i < arguments.length; _i++) {
20370
- args[_i] = arguments[_i];
20371
- }
20372
- // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
20373
- var key = resolver ? resolver.apply(this, args) : args[0];
20374
- var cache = memoized.cache;
20375
- if (cache.has(key)) {
20376
- return cache.get(key);
20377
- }
20378
- var result = f.apply(this, args);
20379
- // 缓存起来
20380
- cache.set(key, result);
20381
- return result;
20382
- };
20383
- memoized.cache = new Map();
20384
- return memoized;
20385
- });
20386
-
20387
- var ctx$3;
20388
- /**
20389
- * 计算文本的宽度
20390
- */
20391
- memoize$3(function (text, font) {
20392
- if (font === void 0) { font = {}; }
20393
- var fontSize = font.fontSize, fontFamily = font.fontFamily, fontWeight = font.fontWeight, fontStyle = font.fontStyle, fontVariant = font.fontVariant;
20394
- if (!ctx$3) {
20395
- ctx$3 = document.createElement('canvas').getContext('2d');
20396
- }
20397
- ctx$3.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
20398
- return ctx$3.measureText(isString$4(text) ? text : '').width;
20399
- }, function (text, font) {
20400
- if (font === void 0) { font = {}; }
20401
- return __spreadArrays([text], values$3(font)).join('');
20402
- });
20403
-
20404
19844
  var WebGPUContextService = /*#__PURE__*/function () {
20405
19845
  function WebGPUContextService(canvasConfig, deviceRendererPlugin) {
20406
19846
  this.canvasConfig = void 0;
@@ -20435,7 +19875,7 @@
20435
19875
  this.canvasConfig.container = this.$container;
20436
19876
  } else if (container) {
20437
19877
  // create container
20438
- this.$container = isString$4(container) ? document.getElementById(container) : container;
19878
+ this.$container = isString(container) ? document.getElementById(container) : container;
20439
19879
 
20440
19880
  if (this.$container) {
20441
19881
  // create canvas