@luma.gl/core 9.0.0-beta.9 → 9.0.0

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/dist.dev.js CHANGED
@@ -99,12 +99,10 @@ var __exports__ = (() => {
99
99
 
100
100
  // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
101
101
  function isElectron(mockUserAgent) {
102
- if (typeof window !== "undefined" && typeof window.process === "object" && // @ts-expect-error
103
- window.process.type === "renderer") {
102
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
104
103
  return true;
105
104
  }
106
- if (typeof process !== "undefined" && typeof process.versions === "object" && // eslint-disable-next-line
107
- Boolean(process.versions["electron"])) {
105
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
108
106
  return true;
109
107
  }
110
108
  const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
@@ -117,10 +115,7 @@ var __exports__ = (() => {
117
115
 
118
116
  // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
119
117
  function isBrowser() {
120
- const isNode = (
121
- // @ts-expect-error
122
- typeof process === "object" && String(process) === "[object process]" && !process.browser
123
- );
118
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
124
119
  return !isNode || isElectron();
125
120
  }
126
121
 
@@ -133,7 +128,7 @@ var __exports__ = (() => {
133
128
  var navigator_ = globalThis.navigator || {};
134
129
 
135
130
  // ../../node_modules/@probe.gl/env/dist/utils/globals.js
136
- var VERSION = true ? "4.0.6" : "untranspiled source";
131
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
137
132
  var isBrowser2 = isBrowser();
138
133
 
139
134
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
@@ -149,7 +144,11 @@ var __exports__ = (() => {
149
144
  }
150
145
  }
151
146
  var LocalStorage = class {
152
- constructor(id, defaultConfig, type = "sessionStorage") {
147
+ constructor(id, defaultConfig) {
148
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
149
+ this.storage = void 0;
150
+ this.id = void 0;
151
+ this.config = void 0;
153
152
  this.storage = getStorage(type);
154
153
  this.id = id;
155
154
  this.config = defaultConfig;
@@ -165,7 +164,6 @@ var __exports__ = (() => {
165
164
  this.storage.setItem(this.id, serialized);
166
165
  }
167
166
  }
168
- // Get config from persistent store, if available
169
167
  _loadConfiguration() {
170
168
  let configuration = {};
171
169
  if (this.storage) {
@@ -191,25 +189,20 @@ var __exports__ = (() => {
191
189
  }
192
190
  return formatted;
193
191
  }
194
- function leftPad(string, length = 8) {
192
+ function leftPad(string) {
193
+ let length = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
195
194
  const padLength = Math.max(length - string.length, 0);
196
195
  return `${" ".repeat(padLength)}${string}`;
197
196
  }
198
- function formatImage(image, message, scale, maxWidth = 600) {
197
+ function formatImage(image, message, scale) {
198
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
199
199
  const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
200
200
  if (image.width > maxWidth) {
201
201
  scale = Math.min(scale, maxWidth / image.width);
202
202
  }
203
203
  const width = image.width * scale;
204
204
  const height = image.height * scale;
205
- const style = [
206
- "font-size:1px;",
207
- `padding:${Math.floor(height / 2)}px ${Math.floor(width / 2)}px;`,
208
- `line-height:${height}px;`,
209
- `background:url(${imageUrl});`,
210
- `background-size:${width}px ${height}px;`,
211
- "color:transparent;"
212
- ].join("");
205
+ const style = ["font-size:1px;", `padding:${Math.floor(height / 2)}px ${Math.floor(width / 2)}px;`, `line-height:${height}px;`, `background:url(${imageUrl});`, `background-size:${width}px ${height}px;`, "color:transparent;"].join("");
213
206
  return [`${message} %c+`, style];
214
207
  }
215
208
 
@@ -256,7 +249,8 @@ var __exports__ = (() => {
256
249
  }
257
250
 
258
251
  // ../../node_modules/@probe.gl/log/dist/utils/autobind.js
259
- function autobind(obj, predefined = ["constructor"]) {
252
+ function autobind(obj) {
253
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
260
254
  const proto = Object.getPrototypeOf(obj);
261
255
  const propNames = Object.getOwnPropertyNames(proto);
262
256
  const object = obj;
@@ -281,9 +275,11 @@ var __exports__ = (() => {
281
275
  function getHiResTimestamp() {
282
276
  let timestamp;
283
277
  if (isBrowser() && window_.performance) {
284
- timestamp = window_?.performance?.now?.();
278
+ var _window$performance, _window$performance$n;
279
+ timestamp = window_ === null || window_ === void 0 ? void 0 : (_window$performance = window_.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
285
280
  } else if ("hrtime" in process_) {
286
- const timeParts = process_?.hrtime?.();
281
+ var _process$hrtime;
282
+ const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
287
283
  timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
288
284
  } else {
289
285
  timestamp = Date.now();
@@ -306,12 +302,21 @@ var __exports__ = (() => {
306
302
  function noop() {
307
303
  }
308
304
  var cache = {};
309
- var ONCE = { once: true };
305
+ var ONCE = {
306
+ once: true
307
+ };
310
308
  var Log = class {
311
- constructor({ id } = { id: "" }) {
309
+ constructor() {
310
+ let {
311
+ id
312
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
313
+ id: ""
314
+ };
315
+ this.id = void 0;
312
316
  this.VERSION = VERSION;
313
317
  this._startTs = getHiResTimestamp();
314
318
  this._deltaTs = getHiResTimestamp();
319
+ this._storage = void 0;
315
320
  this.userData = {};
316
321
  this.LOG_THROTTLE_TIMEOUT = 0;
317
322
  this.id = id;
@@ -333,44 +338,42 @@ var __exports__ = (() => {
333
338
  getLevel() {
334
339
  return this._storage.config.level;
335
340
  }
336
- /** @return milliseconds, with fractions */
337
341
  getTotal() {
338
342
  return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
339
343
  }
340
- /** @return milliseconds, with fractions */
341
344
  getDelta() {
342
345
  return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
343
346
  }
344
- /** @deprecated use logLevel */
345
347
  set priority(newPriority) {
346
348
  this.level = newPriority;
347
349
  }
348
- /** @deprecated use logLevel */
349
350
  get priority() {
350
351
  return this.level;
351
352
  }
352
- /** @deprecated use logLevel */
353
353
  getPriority() {
354
354
  return this.level;
355
355
  }
356
- // Configure
357
- enable(enabled = true) {
358
- this._storage.setConfiguration({ enabled });
356
+ enable() {
357
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
358
+ this._storage.setConfiguration({
359
+ enabled
360
+ });
359
361
  return this;
360
362
  }
361
363
  setLevel(level) {
362
- this._storage.setConfiguration({ level });
364
+ this._storage.setConfiguration({
365
+ level
366
+ });
363
367
  return this;
364
368
  }
365
- /** return the current status of the setting */
366
369
  get(setting) {
367
370
  return this._storage.config[setting];
368
371
  }
369
- // update the status of the setting
370
372
  set(setting, value) {
371
- this._storage.setConfiguration({ [setting]: value });
373
+ this._storage.setConfiguration({
374
+ [setting]: value
375
+ });
372
376
  }
373
- /** Logs the current settings as a table */
374
377
  settings() {
375
378
  if (console.table) {
376
379
  console.table(this._storage.config);
@@ -378,7 +381,6 @@ var __exports__ = (() => {
378
381
  console.log(this._storage.config);
379
382
  }
380
383
  }
381
- // Unconditional logging
382
384
  assert(condition, message) {
383
385
  assert(condition, message);
384
386
  }
@@ -388,11 +390,9 @@ var __exports__ = (() => {
388
390
  error(message) {
389
391
  return this._getLogFunction(0, message, originalConsole.error, arguments);
390
392
  }
391
- /** Print a deprecation warning */
392
393
  deprecated(oldUsage, newUsage) {
393
394
  return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
394
395
  }
395
- /** Print a removal warning */
396
396
  removed(oldUsage, newUsage) {
397
397
  return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
398
398
  }
@@ -411,7 +411,6 @@ var __exports__ = (() => {
411
411
  once(logLevel, message) {
412
412
  return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
413
413
  }
414
- /** Logs an object as a table */
415
414
  table(logLevel, table, columns) {
416
415
  if (table) {
417
416
  return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
@@ -420,12 +419,26 @@ var __exports__ = (() => {
420
419
  }
421
420
  return noop;
422
421
  }
423
- /** logs an image under Chrome */
424
- image({ logLevel, priority, image, message = "", scale = 1 }) {
422
+ image(_ref) {
423
+ let {
424
+ logLevel,
425
+ priority,
426
+ image,
427
+ message = "",
428
+ scale = 1
429
+ } = _ref;
425
430
  if (!this._shouldLog(logLevel || priority)) {
426
431
  return noop;
427
432
  }
428
- return isBrowser() ? logImageInBrowser({ image, message, scale }) : logImageInNode({ image, message, scale });
433
+ return isBrowser() ? logImageInBrowser({
434
+ image,
435
+ message,
436
+ scale
437
+ }) : logImageInNode({
438
+ image,
439
+ message,
440
+ scale
441
+ });
429
442
  }
430
443
  time(logLevel, message) {
431
444
  return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
@@ -436,19 +449,30 @@ var __exports__ = (() => {
436
449
  timeStamp(logLevel, message) {
437
450
  return this._getLogFunction(logLevel, message, console.timeStamp || noop);
438
451
  }
439
- group(logLevel, message, opts = { collapsed: false }) {
440
- const options = normalizeArguments({ logLevel, message, opts });
441
- const { collapsed } = opts;
452
+ group(logLevel, message) {
453
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
454
+ collapsed: false
455
+ };
456
+ const options = normalizeArguments({
457
+ logLevel,
458
+ message,
459
+ opts
460
+ });
461
+ const {
462
+ collapsed
463
+ } = opts;
442
464
  options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
443
465
  return this._getLogFunction(options);
444
466
  }
445
- groupCollapsed(logLevel, message, opts = {}) {
446
- return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
467
+ groupCollapsed(logLevel, message) {
468
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
469
+ return this.group(logLevel, message, Object.assign({}, opts, {
470
+ collapsed: true
471
+ }));
447
472
  }
448
473
  groupEnd(logLevel) {
449
474
  return this._getLogFunction(logLevel, "", console.groupEnd || noop);
450
475
  }
451
- // EXPERIMENTAL
452
476
  withGroup(logLevel, message, func) {
453
477
  this.group(logLevel, message)();
454
478
  try {
@@ -462,14 +486,17 @@ var __exports__ = (() => {
462
486
  console.trace();
463
487
  }
464
488
  }
465
- // PRIVATE METHODS
466
- /** Deduces log level from a variety of arguments */
467
489
  _shouldLog(logLevel) {
468
490
  return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
469
491
  }
470
492
  _getLogFunction(logLevel, message, method, args, opts) {
471
493
  if (this._shouldLog(logLevel)) {
472
- opts = normalizeArguments({ logLevel, message, args, opts });
494
+ opts = normalizeArguments({
495
+ logLevel,
496
+ message,
497
+ args,
498
+ opts
499
+ });
473
500
  method = method || opts.method;
474
501
  assert(method);
475
502
  opts.total = this.getTotal();
@@ -509,7 +536,10 @@ var __exports__ = (() => {
509
536
  return resolvedLevel;
510
537
  }
511
538
  function normalizeArguments(opts) {
512
- const { logLevel, message } = opts;
539
+ const {
540
+ logLevel,
541
+ message
542
+ } = opts;
513
543
  opts.logLevel = normalizeLogLevel(logLevel);
514
544
  const args = opts.args ? Array.from(opts.args) : [];
515
545
  while (args.length && args.shift() !== message) {
@@ -532,7 +562,9 @@ var __exports__ = (() => {
532
562
  }
533
563
  const messageType = typeof opts.message;
534
564
  assert(messageType === "string" || messageType === "object");
535
- return Object.assign(opts, { args }, opts.opts);
565
+ return Object.assign(opts, {
566
+ args
567
+ }, opts.opts);
536
568
  }
537
569
  function decorateMessage(id, message, opts) {
538
570
  if (typeof message === "string") {
@@ -542,11 +574,21 @@ var __exports__ = (() => {
542
574
  }
543
575
  return message;
544
576
  }
545
- function logImageInNode({ image, message = "", scale = 1 }) {
577
+ function logImageInNode(_ref2) {
578
+ let {
579
+ image,
580
+ message = "",
581
+ scale = 1
582
+ } = _ref2;
546
583
  console.warn("removed");
547
584
  return noop;
548
585
  }
549
- function logImageInBrowser({ image, message = "", scale = 1 }) {
586
+ function logImageInBrowser(_ref3) {
587
+ let {
588
+ image,
589
+ message = "",
590
+ scale = 1
591
+ } = _ref3;
550
592
  if (typeof image === "string") {
551
593
  const img = new Image();
552
594
  img.onload = () => {
@@ -578,11 +620,10 @@ var __exports__ = (() => {
578
620
  return "empty";
579
621
  }
580
622
 
581
- // ../../node_modules/@probe.gl/log/dist/init.js
582
- globalThis.probe = {};
583
-
584
623
  // ../../node_modules/@probe.gl/log/dist/index.js
585
- var dist_default = new Log({ id: "@probe.gl/log" });
624
+ var dist_default = new Log({
625
+ id: "@probe.gl/log"
626
+ });
586
627
 
587
628
  // src/utils/log.ts
588
629
  var log = new Log({ id: "luma.gl" });
@@ -604,6 +645,8 @@ var __exports__ = (() => {
604
645
  // ../../node_modules/@probe.gl/stats/dist/lib/stat.js
605
646
  var Stat = class {
606
647
  constructor(name2, type) {
648
+ this.name = void 0;
649
+ this.type = void 0;
607
650
  this.sampleSize = 1;
608
651
  this.time = 0;
609
652
  this.count = 0;
@@ -638,31 +681,26 @@ var __exports__ = (() => {
638
681
  this.sampleSize = samples;
639
682
  return this;
640
683
  }
641
- /** Call to increment count (+1) */
642
684
  incrementCount() {
643
685
  this.addCount(1);
644
686
  return this;
645
687
  }
646
- /** Call to decrement count (-1) */
647
688
  decrementCount() {
648
689
  this.subtractCount(1);
649
690
  return this;
650
691
  }
651
- /** Increase count */
652
692
  addCount(value) {
653
693
  this._count += value;
654
694
  this._samples++;
655
695
  this._checkSampling();
656
696
  return this;
657
697
  }
658
- /** Decrease count */
659
698
  subtractCount(value) {
660
699
  this._count -= value;
661
700
  this._samples++;
662
701
  this._checkSampling();
663
702
  return this;
664
703
  }
665
- /** Add an arbitrary timing and bump the count */
666
704
  addTime(time) {
667
705
  this._time += time;
668
706
  this.lastTiming = time;
@@ -670,13 +708,11 @@ var __exports__ = (() => {
670
708
  this._checkSampling();
671
709
  return this;
672
710
  }
673
- /** Start a timer */
674
711
  timeStart() {
675
712
  this._startTime = getHiResTimestamp2();
676
713
  this._timerPending = true;
677
714
  return this;
678
715
  }
679
- /** End a timer. Adds to time and bumps the timing count. */
680
716
  timeEnd() {
681
717
  if (!this._timerPending) {
682
718
  return this;
@@ -689,22 +725,18 @@ var __exports__ = (() => {
689
725
  getSampleAverageCount() {
690
726
  return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
691
727
  }
692
- /** Calculate average time / count for the previous window */
693
728
  getSampleAverageTime() {
694
729
  return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
695
730
  }
696
- /** Calculate counts per second for the previous window */
697
731
  getSampleHz() {
698
732
  return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
699
733
  }
700
734
  getAverageCount() {
701
735
  return this.samples > 0 ? this.count / this.samples : 0;
702
736
  }
703
- /** Calculate average time / count */
704
737
  getAverageTime() {
705
738
  return this.samples > 0 ? this.time / this.samples : 0;
706
739
  }
707
- /** Calculate counts per second */
708
740
  getHz() {
709
741
  return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
710
742
  }
@@ -725,20 +757,23 @@ var __exports__ = (() => {
725
757
  // ../../node_modules/@probe.gl/stats/dist/lib/stats.js
726
758
  var Stats = class {
727
759
  constructor(options) {
760
+ this.id = void 0;
728
761
  this.stats = {};
729
762
  this.id = options.id;
730
763
  this.stats = {};
731
764
  this._initializeStats(options.stats);
732
765
  Object.seal(this);
733
766
  }
734
- /** Acquire a stat. Create if it doesn't exist. */
735
- get(name2, type = "count") {
736
- return this._getOrCreate({ name: name2, type });
767
+ get(name2) {
768
+ let type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "count";
769
+ return this._getOrCreate({
770
+ name: name2,
771
+ type
772
+ });
737
773
  }
738
774
  get size() {
739
775
  return Object.keys(this.stats).length;
740
776
  }
741
- /** Reset all stats */
742
777
  reset() {
743
778
  for (const stat of Object.values(this.stats)) {
744
779
  stat.reset();
@@ -762,11 +797,15 @@ var __exports__ = (() => {
762
797
  });
763
798
  return table;
764
799
  }
765
- _initializeStats(stats = []) {
800
+ _initializeStats() {
801
+ let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
766
802
  stats.forEach((stat) => this._getOrCreate(stat));
767
803
  }
768
804
  _getOrCreate(stat) {
769
- const { name: name2, type } = stat;
805
+ const {
806
+ name: name2,
807
+ type
808
+ } = stat;
770
809
  let result = this.stats[name2];
771
810
  if (!result) {
772
811
  if (stat instanceof Stat) {