@patterkit/play-helpers 0.3.0 → 0.3.2

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
@@ -204,6 +204,10 @@ function createDebugLink(opts) {
204
204
  post({ t: "flowClose", flow: flowId });
205
205
  },
206
206
  observe(flowId, sceneId, beatId, type, choiceId) {
207
+ if (!flows.has(flowId)) {
208
+ flows.add(flowId);
209
+ post({ t: "flowOpen", flow: flowId });
210
+ }
207
211
  post({ t: "frame", flow: flowId, sceneId, beatId, type, choiceId });
208
212
  },
209
213
  setBuild(next) {
@@ -352,9 +356,9 @@ function createPropertyInspector(engine, opts = {}) {
352
356
  read = () => {
353
357
  if (!focused(inp)) inp.value = String(engine.getProperty(row2.ref) ?? "");
354
358
  };
355
- } else if (row2.type === "enum") {
359
+ } else if (row2.type === "enum" || row2.type === "quality") {
356
360
  const sel = doc.createElement("select");
357
- for (const v of row2.values ?? []) {
361
+ for (const v of (row2.type === "quality" ? row2.stages : row2.values) ?? []) {
358
362
  const o = doc.createElement("option");
359
363
  o.value = v;
360
364
  o.textContent = v;
package/dist/index.d.cts CHANGED
@@ -213,7 +213,7 @@ interface SequenceOptions {
213
213
  }
214
214
  /** An option's prompt beat (spec §5): a single line | text beat - the choice text. */
215
215
  type PromptBeat = LineBeat | TextBeat;
216
- type PropertyType = "boolean" | "number" | "string" | "flags" | "enum";
216
+ type PropertyType = "boolean" | "number" | "string" | "flags" | "enum" | "quality";
217
217
  interface PropertyDecl {
218
218
  name: string;
219
219
  type: PropertyType;
@@ -237,6 +237,11 @@ interface PropertyDecl {
237
237
  temporary?: boolean;
238
238
  /** For enum / flags. */
239
239
  values?: string[];
240
+ /** For quality: the ORDERED ladder of stage names (the shared engine's quality type, expr 0.4.0).
241
+ * Ordering operators compare by position in this list and `advance()` steps along it, so the order
242
+ * is the meaning - unlike `values`, whose order is presentation only. Default seeds to the first
243
+ * stage when no `default` is declared. */
244
+ stages?: string[];
240
245
  /** Free-text author note documenting what this property is for (authoring only; shown as a hint). */
241
246
  purpose?: string;
242
247
  }
@@ -251,6 +256,8 @@ interface HostScopeDecl {
251
256
  name: string;
252
257
  type: PropertyType;
253
258
  values?: string[];
259
+ /** For quality: the ordered stage ladder (see `PropertyDecl.stages`). */
260
+ stages?: string[];
254
261
  default?: ScalarValue;
255
262
  writable?: boolean;
256
263
  /** Free-text author note documenting the property (authoring only; shown as a hint). */
package/dist/index.d.ts CHANGED
@@ -213,7 +213,7 @@ interface SequenceOptions {
213
213
  }
214
214
  /** An option's prompt beat (spec §5): a single line | text beat - the choice text. */
215
215
  type PromptBeat = LineBeat | TextBeat;
216
- type PropertyType = "boolean" | "number" | "string" | "flags" | "enum";
216
+ type PropertyType = "boolean" | "number" | "string" | "flags" | "enum" | "quality";
217
217
  interface PropertyDecl {
218
218
  name: string;
219
219
  type: PropertyType;
@@ -237,6 +237,11 @@ interface PropertyDecl {
237
237
  temporary?: boolean;
238
238
  /** For enum / flags. */
239
239
  values?: string[];
240
+ /** For quality: the ORDERED ladder of stage names (the shared engine's quality type, expr 0.4.0).
241
+ * Ordering operators compare by position in this list and `advance()` steps along it, so the order
242
+ * is the meaning - unlike `values`, whose order is presentation only. Default seeds to the first
243
+ * stage when no `default` is declared. */
244
+ stages?: string[];
240
245
  /** Free-text author note documenting what this property is for (authoring only; shown as a hint). */
241
246
  purpose?: string;
242
247
  }
@@ -251,6 +256,8 @@ interface HostScopeDecl {
251
256
  name: string;
252
257
  type: PropertyType;
253
258
  values?: string[];
259
+ /** For quality: the ordered stage ladder (see `PropertyDecl.stages`). */
260
+ stages?: string[];
254
261
  default?: ScalarValue;
255
262
  writable?: boolean;
256
263
  /** Free-text author note documenting the property (authoring only; shown as a hint). */
package/dist/index.js CHANGED
@@ -163,6 +163,10 @@ function createDebugLink(opts) {
163
163
  post({ t: "flowClose", flow: flowId });
164
164
  },
165
165
  observe(flowId, sceneId, beatId, type, choiceId) {
166
+ if (!flows.has(flowId)) {
167
+ flows.add(flowId);
168
+ post({ t: "flowOpen", flow: flowId });
169
+ }
166
170
  post({ t: "frame", flow: flowId, sceneId, beatId, type, choiceId });
167
171
  },
168
172
  setBuild(next) {
@@ -311,9 +315,9 @@ function createPropertyInspector(engine, opts = {}) {
311
315
  read = () => {
312
316
  if (!focused(inp)) inp.value = String(engine.getProperty(row2.ref) ?? "");
313
317
  };
314
- } else if (row2.type === "enum") {
318
+ } else if (row2.type === "enum" || row2.type === "quality") {
315
319
  const sel = doc.createElement("select");
316
- for (const v of row2.values ?? []) {
320
+ for (const v of (row2.type === "quality" ? row2.stages : row2.values) ?? []) {
317
321
  const o = doc.createElement("option");
318
322
  o.value = v;
319
323
  o.textContent = v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/play-helpers",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
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.4.3"
37
+ "@patterkit/runtime": "0.7.0"
38
38
  }
39
39
  }