@patterkit/play-helpers 0.3.3 → 0.4.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/index.cjs CHANGED
@@ -315,8 +315,8 @@ function createPropertyInspector(engine, opts = {}) {
315
315
  r.className = "pp-insp-row";
316
316
  const label = doc.createElement("span");
317
317
  label.className = "pp-insp-ref";
318
- label.textContent = row2.ref;
319
- label.title = row2.ref;
318
+ label.textContent = row2.path;
319
+ label.title = row2.path;
320
320
  const ctl = doc.createElement("div");
321
321
  ctl.className = "pp-insp-ctl";
322
322
  const reset = doc.createElement("button");
@@ -328,15 +328,15 @@ function createPropertyInspector(engine, opts = {}) {
328
328
  list.appendChild(r);
329
329
  let read;
330
330
  const commit = (v) => {
331
- engine.setProperty(row2.ref, v);
331
+ engine.setProperty(row2.path, v);
332
332
  syncReset();
333
333
  };
334
334
  const focused = (node) => doc.activeElement === node;
335
335
  function syncReset() {
336
- reset.disabled = sameValue(engine.getProperty(row2.ref), row2.default);
336
+ reset.disabled = sameValue(engine.getProperty(row2.path), row2.default);
337
337
  }
338
338
  reset.addEventListener("click", () => {
339
- engine.setProperty(row2.ref, row2.default);
339
+ engine.setProperty(row2.path, row2.default);
340
340
  read();
341
341
  syncReset();
342
342
  });
@@ -346,7 +346,7 @@ function createPropertyInspector(engine, opts = {}) {
346
346
  cb.addEventListener("change", () => commit(cb.checked));
347
347
  ctl.appendChild(cb);
348
348
  read = () => {
349
- if (!focused(cb)) cb.checked = engine.getProperty(row2.ref) === true;
349
+ if (!focused(cb)) cb.checked = engine.getProperty(row2.path) === true;
350
350
  };
351
351
  } else if (row2.type === "number") {
352
352
  const inp = doc.createElement("input");
@@ -354,7 +354,7 @@ function createPropertyInspector(engine, opts = {}) {
354
354
  inp.addEventListener("change", () => commit(Number(inp.value)));
355
355
  ctl.appendChild(inp);
356
356
  read = () => {
357
- if (!focused(inp)) inp.value = String(engine.getProperty(row2.ref) ?? "");
357
+ if (!focused(inp)) inp.value = String(engine.getProperty(row2.path) ?? "");
358
358
  };
359
359
  } else if (row2.type === "enum" || row2.type === "quality") {
360
360
  const sel = doc.createElement("select");
@@ -367,7 +367,7 @@ function createPropertyInspector(engine, opts = {}) {
367
367
  sel.addEventListener("change", () => commit(sel.value));
368
368
  ctl.appendChild(sel);
369
369
  read = () => {
370
- if (!focused(sel)) sel.value = String(engine.getProperty(row2.ref) ?? "");
370
+ if (!focused(sel)) sel.value = String(engine.getProperty(row2.path) ?? "");
371
371
  };
372
372
  } else if (row2.type === "flags") {
373
373
  const inp = doc.createElement("input");
@@ -377,7 +377,7 @@ function createPropertyInspector(engine, opts = {}) {
377
377
  ctl.appendChild(inp);
378
378
  read = () => {
379
379
  if (!focused(inp)) {
380
- const v = engine.getProperty(row2.ref);
380
+ const v = engine.getProperty(row2.path);
381
381
  inp.value = Array.isArray(v) ? v.join(", ") : "";
382
382
  }
383
383
  };
@@ -387,7 +387,7 @@ function createPropertyInspector(engine, opts = {}) {
387
387
  inp.addEventListener("change", () => commit(inp.value));
388
388
  ctl.appendChild(inp);
389
389
  read = () => {
390
- if (!focused(inp)) inp.value = String(engine.getProperty(row2.ref) ?? "");
390
+ if (!focused(inp)) inp.value = String(engine.getProperty(row2.path) ?? "");
391
391
  };
392
392
  }
393
393
  read();
package/dist/index.js CHANGED
@@ -274,8 +274,8 @@ function createPropertyInspector(engine, opts = {}) {
274
274
  r.className = "pp-insp-row";
275
275
  const label = doc.createElement("span");
276
276
  label.className = "pp-insp-ref";
277
- label.textContent = row2.ref;
278
- label.title = row2.ref;
277
+ label.textContent = row2.path;
278
+ label.title = row2.path;
279
279
  const ctl = doc.createElement("div");
280
280
  ctl.className = "pp-insp-ctl";
281
281
  const reset = doc.createElement("button");
@@ -287,15 +287,15 @@ function createPropertyInspector(engine, opts = {}) {
287
287
  list.appendChild(r);
288
288
  let read;
289
289
  const commit = (v) => {
290
- engine.setProperty(row2.ref, v);
290
+ engine.setProperty(row2.path, v);
291
291
  syncReset();
292
292
  };
293
293
  const focused = (node) => doc.activeElement === node;
294
294
  function syncReset() {
295
- reset.disabled = sameValue(engine.getProperty(row2.ref), row2.default);
295
+ reset.disabled = sameValue(engine.getProperty(row2.path), row2.default);
296
296
  }
297
297
  reset.addEventListener("click", () => {
298
- engine.setProperty(row2.ref, row2.default);
298
+ engine.setProperty(row2.path, row2.default);
299
299
  read();
300
300
  syncReset();
301
301
  });
@@ -305,7 +305,7 @@ function createPropertyInspector(engine, opts = {}) {
305
305
  cb.addEventListener("change", () => commit(cb.checked));
306
306
  ctl.appendChild(cb);
307
307
  read = () => {
308
- if (!focused(cb)) cb.checked = engine.getProperty(row2.ref) === true;
308
+ if (!focused(cb)) cb.checked = engine.getProperty(row2.path) === true;
309
309
  };
310
310
  } else if (row2.type === "number") {
311
311
  const inp = doc.createElement("input");
@@ -313,7 +313,7 @@ function createPropertyInspector(engine, opts = {}) {
313
313
  inp.addEventListener("change", () => commit(Number(inp.value)));
314
314
  ctl.appendChild(inp);
315
315
  read = () => {
316
- if (!focused(inp)) inp.value = String(engine.getProperty(row2.ref) ?? "");
316
+ if (!focused(inp)) inp.value = String(engine.getProperty(row2.path) ?? "");
317
317
  };
318
318
  } else if (row2.type === "enum" || row2.type === "quality") {
319
319
  const sel = doc.createElement("select");
@@ -326,7 +326,7 @@ function createPropertyInspector(engine, opts = {}) {
326
326
  sel.addEventListener("change", () => commit(sel.value));
327
327
  ctl.appendChild(sel);
328
328
  read = () => {
329
- if (!focused(sel)) sel.value = String(engine.getProperty(row2.ref) ?? "");
329
+ if (!focused(sel)) sel.value = String(engine.getProperty(row2.path) ?? "");
330
330
  };
331
331
  } else if (row2.type === "flags") {
332
332
  const inp = doc.createElement("input");
@@ -336,7 +336,7 @@ function createPropertyInspector(engine, opts = {}) {
336
336
  ctl.appendChild(inp);
337
337
  read = () => {
338
338
  if (!focused(inp)) {
339
- const v = engine.getProperty(row2.ref);
339
+ const v = engine.getProperty(row2.path);
340
340
  inp.value = Array.isArray(v) ? v.join(", ") : "";
341
341
  }
342
342
  };
@@ -346,7 +346,7 @@ function createPropertyInspector(engine, opts = {}) {
346
346
  inp.addEventListener("change", () => commit(inp.value));
347
347
  ctl.appendChild(inp);
348
348
  read = () => {
349
- if (!focused(inp)) inp.value = String(engine.getProperty(row2.ref) ?? "");
349
+ if (!focused(inp)) inp.value = String(engine.getProperty(row2.path) ?? "");
350
350
  };
351
351
  }
352
352
  read();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/play-helpers",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "Thin game-integration helpers around @patterkit/runtime: save/load serialisation, runtime property setters, a state logger, the Patterpad Live Link client + hot reload, a property inspector, and audio resolution. The Patterplay JS companion.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,6 +34,6 @@
34
34
  "build": "tsup src/index.ts --format esm,cjs --dts --clean"
35
35
  },
36
36
  "dependencies": {
37
- "@patterkit/runtime": "0.8.0"
37
+ "@patterkit/runtime": "0.9.0"
38
38
  }
39
39
  }