wgsl-play 0.0.23 → 0.0.26
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/wgsl-play.js +41 -41
- package/package.json +4 -4
- package/vite.config.ts +0 -2
package/dist/wgsl-play.js
CHANGED
|
@@ -325,7 +325,7 @@ function V(e, t) {
|
|
|
325
325
|
case "expression":
|
|
326
326
|
case "type":
|
|
327
327
|
case "switch-clause":
|
|
328
|
-
|
|
328
|
+
oe(e, t);
|
|
329
329
|
return;
|
|
330
330
|
// "stuff" elements (compound statements) need trimming for proper formatting
|
|
331
331
|
// LATER get rid of "stuff" elements
|
|
@@ -373,7 +373,7 @@ function Ir(e, t) {
|
|
|
373
373
|
r.kind === "text" && r.srcModule.src.slice(r.start, r.end).trim() === "" || V(r, t);
|
|
374
374
|
}
|
|
375
375
|
function vr(e, t) {
|
|
376
|
-
e.contents.length > 0 && e.contents[0].kind === "attribute" || z(e.attributes, t),
|
|
376
|
+
e.contents.length > 0 && e.contents[0].kind === "attribute" || z(e.attributes, t), oe(e, t);
|
|
377
377
|
}
|
|
378
378
|
function br(e, t) {
|
|
379
379
|
Fe(t), e.contents.length > 0 && e.contents[0].kind === "attribute" || z(e.attributes, t), $e(e, t);
|
|
@@ -393,7 +393,7 @@ function Dr(e, t) {
|
|
|
393
393
|
const u = U(s, c);
|
|
394
394
|
u.forEach((l, f) => {
|
|
395
395
|
l.contents.length > 0 && l.contents[0].kind === "attribute" || z(l.attributes, t), Je(l, t), f < u.length - 1 && A.appendNext(", ");
|
|
396
|
-
}), A.appendNext(") "), i && (A.appendNext("-> "), z(o, t), Je(i, t), A.appendNext(" ")),
|
|
396
|
+
}), A.appendNext(") "), i && (A.appendNext("-> "), z(o, t), Je(i, t), A.appendNext(" ")), oe(a, t);
|
|
397
397
|
}
|
|
398
398
|
function z(e, t) {
|
|
399
399
|
e?.forEach((n) => {
|
|
@@ -418,7 +418,7 @@ function Kr(e, t) {
|
|
|
418
418
|
const { text: n } = e;
|
|
419
419
|
t.srcBuilder.addSynthetic(n, n, 0, n.length);
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function oe(e, t) {
|
|
422
422
|
const n = U(e.contents, t.conditions);
|
|
423
423
|
for (const r of n) V(r, t);
|
|
424
424
|
}
|
|
@@ -470,7 +470,7 @@ function T(e, t) {
|
|
|
470
470
|
return;
|
|
471
471
|
}
|
|
472
472
|
if (n === "type") {
|
|
473
|
-
|
|
473
|
+
oe(e, t);
|
|
474
474
|
return;
|
|
475
475
|
}
|
|
476
476
|
if (n === "binary-expression") {
|
|
@@ -541,7 +541,7 @@ function Lr(e, t) {
|
|
|
541
541
|
}
|
|
542
542
|
t.srcBuilder.add("@" + e.attribute.name + "(", e.start, n[0].start);
|
|
543
543
|
for (let r = 0; r < n.length; r++)
|
|
544
|
-
|
|
544
|
+
oe(n[r], t), r < n.length - 1 && t.srcBuilder.add(",", n[r].end, n[r + 1].start);
|
|
545
545
|
t.srcBuilder.add(")", n[n.length - 1].end, e.end);
|
|
546
546
|
}
|
|
547
547
|
function Zt(e, t) {
|
|
@@ -1614,8 +1614,8 @@ function ao(e) {
|
|
|
1614
1614
|
function co(e) {
|
|
1615
1615
|
const t = e.matchText("import");
|
|
1616
1616
|
if (!t) return null;
|
|
1617
|
-
const n = Ao(e) ?? [], r = yn(e) ||
|
|
1618
|
-
return r || m(e, "invalid import, expected { or name"), e.matchText(";") || m(e, "invalid import, expected ';'"), { statement: r.kind === "import-statement" ? Dn(n, r) :
|
|
1617
|
+
const n = Ao(e) ?? [], r = yn(e) || ue(e);
|
|
1618
|
+
return r || m(e, "invalid import, expected { or name"), e.matchText(";") || m(e, "invalid import, expected ';'"), { statement: r.kind === "import-statement" ? Dn(n, r) : le(n, r), importPos: t.span[0] };
|
|
1619
1619
|
}
|
|
1620
1620
|
function Ao(e) {
|
|
1621
1621
|
if (e.matchSequence("package", "::")) return [Ue("package")];
|
|
@@ -1626,35 +1626,35 @@ function Ao(e) {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
function yn(e) {
|
|
1628
1628
|
if (!e.matchText("{")) return null;
|
|
1629
|
-
const t = "invalid import collection, expected name", n =
|
|
1629
|
+
const t = "invalid import collection, expected name", n = ue(e);
|
|
1630
1630
|
n || m(e, t);
|
|
1631
1631
|
const r = [n];
|
|
1632
1632
|
for (; e.matchText(",") && e.peek()?.text !== "}"; ) {
|
|
1633
|
-
const s =
|
|
1633
|
+
const s = ue(e);
|
|
1634
1634
|
s || m(e, t + " after ','"), r.push(s);
|
|
1635
1635
|
}
|
|
1636
1636
|
return e.matchText("}") || m(e, "invalid import collection, expected }"), lo(r);
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function ue(e) {
|
|
1639
1639
|
const t = uo(e);
|
|
1640
1640
|
if (!t) return null;
|
|
1641
1641
|
if (e.matchText("::")) {
|
|
1642
1642
|
const n = Ue(t), r = yn(e);
|
|
1643
|
-
if (r) return
|
|
1644
|
-
const s =
|
|
1643
|
+
if (r) return le([n], r);
|
|
1644
|
+
const s = ue(e);
|
|
1645
1645
|
if (s) return Dn([n], s);
|
|
1646
1646
|
m(e, "invalid import, expected '{' or name");
|
|
1647
1647
|
}
|
|
1648
1648
|
if (e.matchText("as")) {
|
|
1649
1649
|
const n = e.matchKind("word");
|
|
1650
|
-
return n || m(e, "invalid alias, expected name"),
|
|
1650
|
+
return n || m(e, "invalid alias, expected name"), le([], Lt(t, n.text));
|
|
1651
1651
|
}
|
|
1652
|
-
return
|
|
1652
|
+
return le([], Lt(t));
|
|
1653
1653
|
}
|
|
1654
1654
|
function Dn(e, t) {
|
|
1655
1655
|
return { ...t, segments: e.concat(t.segments) };
|
|
1656
1656
|
}
|
|
1657
|
-
function
|
|
1657
|
+
function le(e, t) {
|
|
1658
1658
|
return { kind: "import-statement", segments: e, finalSegment: t };
|
|
1659
1659
|
}
|
|
1660
1660
|
function Ue(e) {
|
|
@@ -2565,7 +2565,7 @@ function Bi(e) {
|
|
|
2565
2565
|
return e.slice(0, s);
|
|
2566
2566
|
}
|
|
2567
2567
|
const wi = /^lib\.w[eg]sl$/i;
|
|
2568
|
-
class
|
|
2568
|
+
class fe {
|
|
2569
2569
|
astCache = /* @__PURE__ */ new Map();
|
|
2570
2570
|
sources;
|
|
2571
2571
|
packageName;
|
|
@@ -2609,7 +2609,7 @@ class ue {
|
|
|
2609
2609
|
return this.astCache.entries();
|
|
2610
2610
|
}
|
|
2611
2611
|
}
|
|
2612
|
-
class
|
|
2612
|
+
class de {
|
|
2613
2613
|
resolvers;
|
|
2614
2614
|
constructor(t) {
|
|
2615
2615
|
this.resolvers = t;
|
|
@@ -2814,14 +2814,14 @@ function vi(e) {
|
|
|
2814
2814
|
if (o)
|
|
2815
2815
|
i.push(o);
|
|
2816
2816
|
else if (t)
|
|
2817
|
-
i.push(new
|
|
2817
|
+
i.push(new fe(t, { packageName: r, debugWeslRoot: s }));
|
|
2818
2818
|
else
|
|
2819
2819
|
throw new Error("Either resolver or weslSrc must be provided");
|
|
2820
2820
|
if (n.length > 0) {
|
|
2821
2821
|
const c = bi(n, s);
|
|
2822
2822
|
i.push(...c);
|
|
2823
2823
|
}
|
|
2824
|
-
const a = i.length === 1 ? i[0] : new
|
|
2824
|
+
const a = i.length === 1 ? i[0] : new de(i);
|
|
2825
2825
|
return yi({ ...e, resolver: a });
|
|
2826
2826
|
}
|
|
2827
2827
|
function bi(e, t) {
|
|
@@ -3179,19 +3179,19 @@ var re = (function(e, t, n) {
|
|
|
3179
3179
|
for (a = new X(r), s = 0; s < r; ++s)
|
|
3180
3180
|
e[s] && (a[s] = Ye[i[e[s] - 1]++] >> 15 - e[s]);
|
|
3181
3181
|
return a;
|
|
3182
|
-
}),
|
|
3182
|
+
}), ie = new k(288);
|
|
3183
3183
|
for (var E = 0; E < 144; ++E)
|
|
3184
|
-
|
|
3184
|
+
ie[E] = 8;
|
|
3185
3185
|
for (var E = 144; E < 256; ++E)
|
|
3186
|
-
|
|
3186
|
+
ie[E] = 9;
|
|
3187
3187
|
for (var E = 256; E < 280; ++E)
|
|
3188
|
-
|
|
3188
|
+
ie[E] = 7;
|
|
3189
3189
|
for (var E = 280; E < 288; ++E)
|
|
3190
|
-
|
|
3190
|
+
ie[E] = 8;
|
|
3191
3191
|
var zn = new k(32);
|
|
3192
3192
|
for (var E = 0; E < 32; ++E)
|
|
3193
3193
|
zn[E] = 5;
|
|
3194
|
-
var na = /* @__PURE__ */ re(
|
|
3194
|
+
var na = /* @__PURE__ */ re(ie, 9, 1), ra = /* @__PURE__ */ re(zn, 5, 1), Te = function(e) {
|
|
3195
3195
|
for (var t = e[0], n = 1; n < e.length; ++n)
|
|
3196
3196
|
e[n] > t && (t = e[n]);
|
|
3197
3197
|
return t;
|
|
@@ -3259,8 +3259,8 @@ var na = /* @__PURE__ */ re(oe, 9, 1), ra = /* @__PURE__ */ re(zn, 5, 1), Te = f
|
|
|
3259
3259
|
if (L < 16)
|
|
3260
3260
|
te[v++] = L;
|
|
3261
3261
|
else {
|
|
3262
|
-
var H = 0,
|
|
3263
|
-
for (L == 16 ? (
|
|
3262
|
+
var H = 0, ae = 0;
|
|
3263
|
+
for (L == 16 ? (ae = 3 + D(e, l, 3), l += 2, H = te[v - 1]) : L == 17 ? (ae = 3 + D(e, l, 7), l += 3) : L == 18 && (ae = 11 + D(e, l, 127), l += 7); ae--; )
|
|
3264
3264
|
te[v++] = H;
|
|
3265
3265
|
}
|
|
3266
3266
|
}
|
|
@@ -3690,10 +3690,10 @@ async function Ya(e) {
|
|
|
3690
3690
|
|
|
3691
3691
|
${Ja}`, p = [];
|
|
3692
3692
|
p.push(
|
|
3693
|
-
new
|
|
3694
|
-
), u && p.push(new
|
|
3695
|
-
let g = p.length === 1 ? p[0] : new
|
|
3696
|
-
a && (g = new
|
|
3693
|
+
new fe({ [A]: f }, { packageName: s })
|
|
3694
|
+
), u && p.push(new fe(u, { packageName: s }));
|
|
3695
|
+
let g = p.length === 1 ? p[0] : new de(p);
|
|
3696
|
+
a && (g = new de([g, a]));
|
|
3697
3697
|
const Q = { ..._a(), ...l };
|
|
3698
3698
|
return (await Ii({
|
|
3699
3699
|
resolver: g,
|
|
@@ -3783,9 +3783,9 @@ async function Re(e, t, n) {
|
|
|
3783
3783
|
let A;
|
|
3784
3784
|
if (r || s.length > 0) {
|
|
3785
3785
|
const f = [];
|
|
3786
|
-
r && f.push(new
|
|
3786
|
+
r && f.push(new fe(r, { packageName: a }));
|
|
3787
3787
|
for (const p of s) f.push(new Un(p));
|
|
3788
|
-
A = f.length === 1 ? f[0] : new
|
|
3788
|
+
A = f.length === 1 ? f[0] : new de(f);
|
|
3789
3789
|
}
|
|
3790
3790
|
e.device.pushErrorScope("validation");
|
|
3791
3791
|
const u = await Ga({
|
|
@@ -3835,17 +3835,17 @@ function Wa(e) {
|
|
|
3835
3835
|
const Va = ":host{--error-bg: rgba(220, 102, 18, .8);--error-color: white;--controls-bg: rgba(0, 0, 0, .4);--controls-color: rgba(255, 255, 255, .8);--controls-hover-color: white;--controls-hover-bg: rgba(255, 255, 255, .15);display:block;position:relative;overflow:hidden}:host(.dark){--error-bg: rgba(180, 60, 10, .85);--controls-bg: rgba(0, 0, 0, .5)}canvas{position:absolute;inset:0;width:100%;height:100%;display:block}.controls{background:var(--controls-bg);position:absolute;bottom:8px;right:8px;display:flex;gap:20px;border-radius:6px;padding:2px;opacity:0;transition:opacity .2s;z-index:1}:host(:hover) .controls{opacity:1}.controls button{border:none;background:none;color:var(--controls-color);cursor:pointer;padding:4px;border-radius:4px;display:flex;align-items:center}.controls button:hover{color:var(--controls-hover-color);background:var(--controls-hover-bg)}.error-overlay{position:absolute;inset:0;background:var(--error-bg);color:var(--error-color);padding:1rem;font-family:monospace;font-size:.875rem;white-space:pre-wrap;overflow:auto;display:none}.error-overlay.visible{display:block}", er = {
|
|
3836
3836
|
shaderRoot: "/shaders"
|
|
3837
3837
|
};
|
|
3838
|
-
let
|
|
3838
|
+
let pe = { ...er };
|
|
3839
3839
|
function tc(e) {
|
|
3840
|
-
|
|
3840
|
+
pe = { ...pe, ...e };
|
|
3841
3841
|
}
|
|
3842
3842
|
function nc(e) {
|
|
3843
|
-
return { ...
|
|
3843
|
+
return { ...pe, ...e };
|
|
3844
3844
|
}
|
|
3845
3845
|
function rc() {
|
|
3846
|
-
|
|
3846
|
+
pe = { ...er };
|
|
3847
3847
|
}
|
|
3848
|
-
let
|
|
3848
|
+
let ce = null, Ae = null;
|
|
3849
3849
|
class sc extends HTMLElement {
|
|
3850
3850
|
static observedAttributes = [
|
|
3851
3851
|
"src",
|
|
@@ -4155,10 +4155,10 @@ Try Chrome 113+, Edge 113+, or Safari 18+.`;
|
|
|
4155
4155
|
}
|
|
4156
4156
|
}
|
|
4157
4157
|
function Za() {
|
|
4158
|
-
return
|
|
4158
|
+
return Ae || (Ae = document.createElement("template"), Ae.innerHTML = '<canvas part="canvas"></canvas>'), Ae;
|
|
4159
4159
|
}
|
|
4160
4160
|
function ec() {
|
|
4161
|
-
return
|
|
4161
|
+
return ce || (ce = new CSSStyleSheet(), ce.replaceSync(Va)), ce;
|
|
4162
4162
|
}
|
|
4163
4163
|
function _t(e) {
|
|
4164
4164
|
return tt(e, "package", !1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wgsl-play",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": "github:wgsl-tooling-wg/wesl-js",
|
|
6
6
|
"exports": {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"wesl-gpu": "0.1.
|
|
16
|
-
"wesl": "0.7.
|
|
17
|
-
"wesl-fetch": "0.0.
|
|
15
|
+
"wesl-gpu": "0.1.21",
|
|
16
|
+
"wesl": "0.7.19",
|
|
17
|
+
"wesl-fetch": "0.0.6"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@playwright/test": "^1.53.2",
|
package/vite.config.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { defineConfig } from "vite";
|
|
2
|
-
import { linkBuildExtension, staticBuildExtension } from "wesl-plugin";
|
|
3
2
|
import viteWesl from "wesl-plugin/vite";
|
|
4
3
|
|
|
5
4
|
export default defineConfig({
|
|
6
5
|
plugins: [
|
|
7
6
|
viteWesl({
|
|
8
|
-
extensions: [staticBuildExtension, linkBuildExtension],
|
|
9
7
|
// debug: true,
|
|
10
8
|
weslToml: "./test-page/wesl.toml",
|
|
11
9
|
}),
|