wgsl-edit 0.0.20 → 0.0.22

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/WgslEdit.js CHANGED
@@ -363,12 +363,13 @@ var WgslEdit = class extends HTMLElement {
363
363
  }
364
364
  }
365
365
  dispatchChange() {
366
- const { source, sources, conditions, _rootModuleName: rootModuleName } = this;
366
+ const { source, sources, conditions, _rootModuleName: rootModuleName, libs } = this;
367
367
  const detail = {
368
368
  source,
369
369
  sources,
370
370
  rootModuleName,
371
- conditions
371
+ conditions,
372
+ libs
372
373
  };
373
374
  this.dispatchEvent(new CustomEvent("change", { detail }));
374
375
  }
@@ -495,8 +496,11 @@ var WgslEdit = class extends HTMLElement {
495
496
  const bundles = await fetchPackagesByName(needed);
496
497
  this._libs = [...this._libs, ...bundles];
497
498
  for (const n of needed) this._fetchedPkgs.add(n);
498
- if (bundles.length > 0) this.showSnack(`Loaded ${needed.join(", ")}`, 3e3);
499
- else this.hideSnack();
499
+ if (bundles.length > 0) {
500
+ this.showSnack(`Loaded ${needed.join(", ")}`, 3e3);
501
+ this._externalDiagnostics = [];
502
+ this.dispatchChange();
503
+ } else this.hideSnack();
500
504
  return bundles;
501
505
  } catch (e) {
502
506
  console.warn("wgsl-edit: failed to fetch packages:", needed, e);
package/dist/wgsl-edit.js CHANGED
@@ -28386,12 +28386,13 @@ var WgslEdit = class extends HTMLElement {
28386
28386
  }
28387
28387
  }
28388
28388
  dispatchChange() {
28389
- const { source, sources, conditions, _rootModuleName: rootModuleName } = this;
28389
+ const { source, sources, conditions, _rootModuleName: rootModuleName, libs } = this;
28390
28390
  const detail = {
28391
28391
  source,
28392
28392
  sources,
28393
28393
  rootModuleName,
28394
- conditions
28394
+ conditions,
28395
+ libs
28395
28396
  };
28396
28397
  this.dispatchEvent(new CustomEvent("change", { detail }));
28397
28398
  }
@@ -28518,8 +28519,11 @@ var WgslEdit = class extends HTMLElement {
28518
28519
  const bundles = await fetchPackagesByName(needed);
28519
28520
  this._libs = [...this._libs, ...bundles];
28520
28521
  for (const n of needed) this._fetchedPkgs.add(n);
28521
- if (bundles.length > 0) this.showSnack(`Loaded ${needed.join(", ")}`, 3e3);
28522
- else this.hideSnack();
28522
+ if (bundles.length > 0) {
28523
+ this.showSnack(`Loaded ${needed.join(", ")}`, 3e3);
28524
+ this._externalDiagnostics = [];
28525
+ this.dispatchChange();
28526
+ } else this.hideSnack();
28523
28527
  return bundles;
28524
28528
  } catch (e) {
28525
28529
  console.warn("wgsl-edit: failed to fetch packages:", needed, e);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wgsl-edit",
3
3
  "description": "Web component for editing WGSL/WESL with CodeMirror",
4
- "version": "0.0.20",
4
+ "version": "0.0.22",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
package/src/WgslEdit.ts CHANGED
@@ -498,8 +498,9 @@ export class WgslEdit extends HTMLElement {
498
498
  sources,
499
499
  conditions,
500
500
  _rootModuleName: rootModuleName,
501
+ libs,
501
502
  } = this;
502
- const detail = { source, sources, rootModuleName, conditions };
503
+ const detail = { source, sources, rootModuleName, conditions, libs };
503
504
  this.dispatchEvent(new CustomEvent("change", { detail }));
504
505
  }
505
506
 
@@ -662,9 +663,11 @@ export class WgslEdit extends HTMLElement {
662
663
  const bundles = await fetchPackagesByName(needed);
663
664
  this._libs = [...this._libs, ...bundles];
664
665
  for (const n of needed) this._fetchedPkgs.add(n);
665
- if (bundles.length > 0)
666
+ if (bundles.length > 0) {
666
667
  this.showSnack(`Loaded ${needed.join(", ")}`, 3000);
667
- else this.hideSnack();
668
+ this._externalDiagnostics = []; // stale compile errors from before libs loaded
669
+ this.dispatchChange();
670
+ } else this.hideSnack();
668
671
  return bundles;
669
672
  } catch (e) {
670
673
  console.warn("wgsl-edit: failed to fetch packages:", needed, e);