@playabl/sdk 1.0.0-beta.0 → 1.1.0-beta.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/README.md CHANGED
@@ -8,14 +8,14 @@ Browser SDK for Playabl games providing parent-platform communication, game stat
8
8
  npm install @playabl/sdk
9
9
  ```
10
10
 
11
- While 1.0.0 is in beta the stable tag still resolves to 0.2.0; the Creator
12
- Tools surface is on the `beta` dist-tag:
11
+ While 1.1.0 is in beta the stable tag still resolves to 1.0.0; `@playabl/sdk/layout` and
12
+ the layout types are on the `beta` dist-tag:
13
13
 
14
14
  ```bash
15
15
  npm install @playabl/sdk@beta
16
16
  ```
17
17
 
18
- The beta's `sdk.game` / `sdk.devtools` require runtime 1.0.0 in the environment the game loads from; the runtime is rolled out dev → staging → prod before the wrapper leaves beta.
18
+ `sdk.game` and `sdk.devtools` need runtime 1.0.0 or newer in the environment the game loads from. That runtime is live on dev, staging and production.
19
19
 
20
20
  ## Usage
21
21
 
@@ -182,6 +182,18 @@ if (sdk.audio.isSupported()) {
182
182
  }
183
183
  ```
184
184
 
185
+ ### Layout keys in Node tools
186
+
187
+ Build tools that read `layout.json` from disk import the runtime's own synthesis from the `@playabl/sdk/layout` subpath. It runs in plain Node and never loads the runtime; games do not import it. It first ships in 1.1.0-beta.0. Pin the exact version: a change to the role table reaches your tool only when you move the pin.
188
+
189
+ ```typescript
190
+ import { DEFAULT_FRAME, synthesiseLayout } from '@playabl/sdk/layout'
191
+
192
+ const { items, entries } = synthesiseLayout(layout, tweaksSchema, {}, DEFAULT_FRAME)
193
+ ```
194
+
195
+ It is an ES module: `import` loads it anywhere, and `require()` on Node 20.19+ or 22.12+. TypeScript finds its types with `moduleResolution` set to `node16`, `nodenext` or `bundler` in an ES module project, and only with `nodenext` (TypeScript 5.8 or newer) in a CommonJS one; `node10` does not read `exports`, so it is not supported. Besides `synthesiseLayout` and `DEFAULT_FRAME`, it exports the role table (`LAYOUT_ROLES`, `LAYOUT_ANCHORS`, `LAYOUT_WEIGHTS`, `LAYOUT_ALIGNS`, `ENTRY_FIELDS`), `layoutKey`, `defaultPrefix` and `roleLimits`; every table is frozen.
196
+
185
197
  ## API Surface
186
198
 
187
199
  - `sdk.ready()` - Connects to the Playabl parent iframe host.
@@ -191,5 +203,6 @@ if (sdk.audio.isSupported()) {
191
203
  - `sdk.tweaks.init(schema)` - Registers live-tunable values controlled by the host.
192
204
  - `sdk.assets.register(mapping)` - Registers game assets so the host can replace them.
193
205
  - `sdk.audio` - Creates Web Audio contexts with an iOS Safari silent-mode patch.
206
+ - `@playabl/sdk/layout` - `synthesiseLayout` and the layout role table, for Node tools that read `layout.json`.
194
207
 
195
208
 
package/dist/index.d.ts CHANGED
@@ -115,6 +115,13 @@ interface TweakValueRejection {
115
115
  interface TweaksInitOptions {
116
116
  /** The contents of `src/tweaks.values.json`. Missing → `{}`. */
117
117
  values?: TweakValues;
118
+ /**
119
+ * The contents of `src/layout.json`. Each role of each entry becomes an
120
+ * ordinary tweak (`hudScoreFontSize` for `fontSize` of `def:hud-score`),
121
+ * merged before `values` and the host's values apply. A bad entry or role
122
+ * is dropped with a warning; a key `tweaks.json` already has is never replaced.
123
+ */
124
+ layout?: LayoutFile;
118
125
  }
119
126
  interface PlayablTweaks {
120
127
  readonly values: Readonly<Record<string, TweakValue>>;
@@ -122,6 +129,11 @@ interface PlayablTweaks {
122
129
  subscribe(key: string, cb: (value: TweakValue, prev: TweakValue) => void): () => void;
123
130
  onChange(cb: (key: string, value: TweakValue, prev: TweakValue) => void): () => void;
124
131
  snapshot(): Record<string, TweakValue>;
132
+ /**
133
+ * The current value of each role the `layout.json` entry `id` has — for a
134
+ * canvas-drawn element and the `text` role. `undefined` for an id with no entry.
135
+ */
136
+ layout(id: string): LayoutValues | undefined;
125
137
  }
126
138
  type AssetType = 'image' | 'audio' | 'video' | 'unknown';
127
139
  type AssetStatus = 'original' | 'overridden';
@@ -407,6 +419,53 @@ type CatalogCategory = 'characters' | 'hazards' | 'pickups' | 'world' | 'effects
407
419
  type LayoutRole = 'anchor' | 'x' | 'y' | 'w' | 'h' | 'rotation' | 'scale' | 'opacity' | 'z' | 'fontSize' | 'fontWeight' | 'align' | 'font' | 'padding' | 'radius' | 'text' | 'color' | 'background' | 'visible';
408
420
  /** `{ role: tweakKey }` — each role names the tweak that holds that property. */
409
421
  type LayoutRoleMap = Partial<Record<LayoutRole, string>>;
422
+ /**
423
+ * One `src/layout.json` entry: the roles one HUD or screen element has, each
424
+ * with its value. Loose on purpose — a JSON import types `anchor` as `string`,
425
+ * and the runtime checks every value, dropping a bad one with a warning.
426
+ */
427
+ interface LayoutEntry {
428
+ /** 1–40 characters; each synthesised tweak's `name` is `"<label> · <Role>"`. */
429
+ label?: string;
430
+ /**
431
+ * Replaces the key prefix derived from the id (`def:hud-score` → `hudScore`). Must be
432
+ * camelCase: one that is not skips the entry with a warning, with no fallback. Required
433
+ * when the id's first segment starts with a digit (`def:2-player`): the entry is skipped
434
+ * with a warning without it.
435
+ */
436
+ prefix?: string;
437
+ /** The faces the `font` control offers; without it, only the declared `font`. */
438
+ fonts?: string[];
439
+ /**
440
+ * `true` for an element the game draws itself (on a canvas) from
441
+ * `tweaks.layout(id)`: no element will carry its id, so Creator Tools never
442
+ * report it as not wired.
443
+ */
444
+ canvas?: boolean;
445
+ anchor?: string;
446
+ x?: number;
447
+ y?: number;
448
+ w?: number;
449
+ h?: number;
450
+ rotation?: number;
451
+ scale?: number;
452
+ opacity?: number;
453
+ z?: number;
454
+ fontSize?: number;
455
+ fontWeight?: string;
456
+ align?: string;
457
+ font?: string;
458
+ padding?: number;
459
+ radius?: number;
460
+ text?: string;
461
+ color?: string;
462
+ background?: string;
463
+ visible?: boolean;
464
+ }
465
+ /** `src/layout.json`: one entry per element the creator may move, size or restyle, keyed by its `def:` catalog id. */
466
+ type LayoutFile = Record<string, LayoutEntry>;
467
+ /** `tweaks.layout(id)`: each role the entry has, with its current value. */
468
+ type LayoutValues = Partial<Record<LayoutRole, TweakValue>>;
410
469
  type ContentOwner = 'ai' | 'creator';
411
470
  interface ContentGroup {
412
471
  id: string;
@@ -522,10 +581,36 @@ interface CatalogLevel extends CatalogEntryBase {
522
581
  }
523
582
  type CatalogScreen = CatalogEntryBase;
524
583
  interface CatalogDefinition extends CatalogEntryBase {
584
+ /**
585
+ * The frame's `name` inside the sprite sheet `sprite` names (its
586
+ * `<image>.frames.json`). Present exactly when `sprite` is; basename only.
587
+ */
588
+ spriteFrame?: string;
525
589
  category?: CatalogCategory;
526
590
  layout?: LayoutRoleMap;
527
591
  /** Drag/drop into a level writes a durable instance through `content.hooks.placeInLevel`. */
528
592
  placeable?: 'content';
593
+ /**
594
+ * Buttons the Creator shows on this definition's card. On the wire every item
595
+ * is checked and the array is never empty; the value `definition()` returns
596
+ * is the author's array, unchecked.
597
+ */
598
+ actions?: CatalogEntryAction[];
599
+ }
600
+ /**
601
+ * A button the Creator shows on a definition's card that fires a game
602
+ * command. `preview` — an effect's one-shot demo — is the one kind.
603
+ */
604
+ interface CatalogEntryAction {
605
+ kind: 'preview';
606
+ /**
607
+ * A `commands` id. The Creator enables the button only when the catalog
608
+ * advertises it; the runtime does not check.
609
+ */
610
+ command: string;
611
+ label?: string;
612
+ /** Sent as the command's payload. */
613
+ args?: Record<string, string | number | boolean>;
529
614
  }
530
615
  interface SceneRect {
531
616
  x: number;
@@ -564,10 +649,25 @@ interface CatalogLevelOptions extends CatalogEntryOptions {
564
649
  preview?: LevelPreview | undefined;
565
650
  }
566
651
  interface CatalogDefinitionOptions extends CatalogEntryOptions {
652
+ /**
653
+ * The frame this definition uses inside the sheet `sprite` names — a `name`
654
+ * from that sheet's `<image>.frames.json`. Omitted or `""`, it defaults to the
655
+ * definition id without its `def:` prefix (`def:lily` → `"lily"`), so a sheet
656
+ * whose frames are named after the definitions that use them needs nothing
657
+ * here. Ignored without `sprite`; a path (`/` or `\`) is dropped with a warning.
658
+ */
659
+ spriteFrame?: string | undefined;
567
660
  singleton?: boolean;
568
661
  category?: CatalogCategory;
569
662
  layout?: LayoutRoleMap;
570
663
  placeable?: 'content';
664
+ /**
665
+ * Buttons the Creator shows on this definition's card — for an `effects`
666
+ * definition, `[{ kind: 'preview', command: 'preview-splash' }]`. A malformed
667
+ * item is dropped with a warning; the legacy `audition` kind is dropped
668
+ * silently.
669
+ */
670
+ actions?: CatalogEntryAction[] | undefined;
571
671
  }
572
672
  /** The helpers the runtime hands to `catalog(ctx)`. */
573
673
  interface CatalogContext {
@@ -735,4 +835,4 @@ declare const __testing: {
735
835
  setRuntimeLoader(loader: RuntimeLoader): void;
736
836
  };
737
837
 
738
- export { type AssetDescriptor, type AssetEntry, type AssetKind, type AssetOverride, type AssetRecipe, type AssetStatus, type AssetType, type AssetValueEntry, type AssetsMapping, type AssetsRegisterOptions, type AssetsUrlMap, type AssetsValues, type BooleanTweak, type CameraAPI, type CameraOptions, type CameraResult, type CatalogCategory, type CatalogContext, type CatalogDefinition, type CatalogDefinitionOptions, type CatalogEntryBase, type CatalogEntryOptions, type CatalogLevel, type CatalogLevelOptions, type CatalogProgression, type CatalogScreen, type CellGridEntry, type CellGridHooks, type CellGridOptions, type ColorTweak, type ContentDocument, type ContentFieldSpec, type ContentFieldType, type ContentFieldValue, type ContentGroup, type ContentHandle, type ContentHooks, type ContentLevel, type ContentOwner, type ContentVerbType, type DevtoolsCommand, type DevtoolsContent, type DevtoolsHandle, type DevtoolsVocabulary, type EnumTweak, type ErrorCode, type FileSystemAPI, type FileSystemOptions, type FileSystemResult, type GameLoopHooks, type GameMode, type GameRunHandle, type GameRunOptions, type GeolocationAPI, type GeolocationOptions, type GeolocationResult, type HapticsAPI, type LayoutRole, type LayoutRoleMap, type LevelPreview, type LevelPreviewCell, type MicrophoneAPI, type MicrophoneRecordOptions, type MicrophoneResult, type MicrophoneStreamOptions, type MotionAttitude, type MotionData, type MotionRotation, type MotionVector, type NormalizedAssetEntry, type NumberTweak, type OrientationData, type PlayablAssets, type PlayablAudio, type PlayablAudioAutoPauseOptions, type PlayablAudioContext, type PlayablAudioOptions, type PlayablDevice, type PlayablDevtools, PlayablError, type PlayablGame, type PlayablSDK, type PlayablTweaks, type ProgressionNoun, type ProgressionShape, type ReadyResult, type SaveResult, type SceneGrid, type SceneNode, type SceneRect, type SensorsAPI, type StateLevel, type SubmitResult, type TextTweak, type TweakAppliesOn, type TweakSchema, type TweakSchemaItem, type TweakType, type TweakValue, type TweakValueIssue, type TweakValueRejection, type TweakValues, type TweaksInitOptions, __testing, cellGridHooks, configure, sdk as default };
838
+ export { type AssetDescriptor, type AssetEntry, type AssetKind, type AssetOverride, type AssetRecipe, type AssetStatus, type AssetType, type AssetValueEntry, type AssetsMapping, type AssetsRegisterOptions, type AssetsUrlMap, type AssetsValues, type BooleanTweak, type CameraAPI, type CameraOptions, type CameraResult, type CatalogCategory, type CatalogContext, type CatalogDefinition, type CatalogDefinitionOptions, type CatalogEntryAction, type CatalogEntryBase, type CatalogEntryOptions, type CatalogLevel, type CatalogLevelOptions, type CatalogProgression, type CatalogScreen, type CellGridEntry, type CellGridHooks, type CellGridOptions, type ColorTweak, type ContentDocument, type ContentFieldSpec, type ContentFieldType, type ContentFieldValue, type ContentGroup, type ContentHandle, type ContentHooks, type ContentLevel, type ContentOwner, type ContentVerbType, type DevtoolsCommand, type DevtoolsContent, type DevtoolsHandle, type DevtoolsVocabulary, type EnumTweak, type ErrorCode, type FileSystemAPI, type FileSystemOptions, type FileSystemResult, type GameLoopHooks, type GameMode, type GameRunHandle, type GameRunOptions, type GeolocationAPI, type GeolocationOptions, type GeolocationResult, type HapticsAPI, type LayoutEntry, type LayoutFile, type LayoutRole, type LayoutRoleMap, type LayoutValues, type LevelPreview, type LevelPreviewCell, type MicrophoneAPI, type MicrophoneRecordOptions, type MicrophoneResult, type MicrophoneStreamOptions, type MotionAttitude, type MotionData, type MotionRotation, type MotionVector, type NormalizedAssetEntry, type NumberTweak, type OrientationData, type PlayablAssets, type PlayablAudio, type PlayablAudioAutoPauseOptions, type PlayablAudioContext, type PlayablAudioOptions, type PlayablDevice, type PlayablDevtools, PlayablError, type PlayablGame, type PlayablSDK, type PlayablTweaks, type ProgressionNoun, type ProgressionShape, type ReadyResult, type SaveResult, type SceneGrid, type SceneNode, type SceneRect, type SensorsAPI, type StateLevel, type SubmitResult, type TextTweak, type TweakAppliesOn, type TweakSchema, type TweakSchemaItem, type TweakType, type TweakValue, type TweakValueIssue, type TweakValueRejection, type TweakValues, type TweaksInitOptions, __testing, cellGridHooks, configure, sdk as default };
package/dist/index.js CHANGED
@@ -205,6 +205,29 @@ async function getSDK() {
205
205
  function peekSDK() {
206
206
  return loadedSDK;
207
207
  }
208
+ var layoutGuards = /* @__PURE__ */ new WeakMap();
209
+ function withLayoutMethod(tweaks, options) {
210
+ if (typeof tweaks.layout === "function") return tweaks;
211
+ if (options?.layout !== void 0) {
212
+ console.warn(
213
+ "[Playabl] tweaks.init ignored options.layout: this environment serves a Playabl runtime older than 1.2.0, so tweaks.layout(id) throws NOT_SUPPORTED"
214
+ );
215
+ }
216
+ let guarded = layoutGuards.get(tweaks);
217
+ if (!guarded) {
218
+ guarded = {
219
+ ...tweaks,
220
+ layout: () => {
221
+ throw new PlayablError(
222
+ "NOT_SUPPORTED",
223
+ "tweaks.layout needs Playabl runtime 1.2.0 or newer; this environment serves an older runtime"
224
+ );
225
+ }
226
+ };
227
+ layoutGuards.set(tweaks, guarded);
228
+ }
229
+ return guarded;
230
+ }
208
231
  function requireRuntimeMember(runtime, name) {
209
232
  const member = runtime[name];
210
233
  if (!member) {
@@ -226,7 +249,7 @@ var sdk = {
226
249
  clear: async () => (await getSDK()).gameState.clear()
227
250
  },
228
251
  tweaks: {
229
- init: async (schema, options) => (await getSDK()).tweaks.init(schema, options)
252
+ init: async (schema, options) => withLayoutMethod(await (await getSDK()).tweaks.init(schema, options), options)
230
253
  },
231
254
  assets: {
232
255
  register: async (mapping, options) => (await getSDK()).assets.register(mapping, options)
@@ -0,0 +1,113 @@
1
+ /** When a changed value reaches the game. Enforced by the runtime, not the game. */
2
+ type TweakAppliesOn = 'live' | 'restart';
3
+ interface BaseTweak {
4
+ name?: string;
5
+ description?: string;
6
+ group?: string;
7
+ index?: number;
8
+ appliesOn?: TweakAppliesOn;
9
+ /** Creator-only rendering hints. The runtime never reads it. */
10
+ ui?: Record<string, unknown>;
11
+ }
12
+ interface NumberTweak extends BaseTweak {
13
+ type: 'number';
14
+ value: number;
15
+ min?: number;
16
+ max?: number;
17
+ step?: number;
18
+ }
19
+ interface BooleanTweak extends BaseTweak {
20
+ type: 'boolean';
21
+ value: boolean;
22
+ }
23
+ interface TextTweak extends BaseTweak {
24
+ type: 'text';
25
+ value: string;
26
+ }
27
+ interface EnumTweak extends BaseTweak {
28
+ type: 'enum';
29
+ value: string;
30
+ /** Non-empty, unique. The closed set of allowed values. */
31
+ options: string[];
32
+ }
33
+ interface ColorTweak extends BaseTweak {
34
+ type: 'color';
35
+ value: string;
36
+ }
37
+ type TweakSchemaItem = NumberTweak | BooleanTweak | TextTweak | EnumTweak | ColorTweak;
38
+ interface TweakSchema {
39
+ [key: string]: TweakSchemaItem;
40
+ }
41
+ type LayoutRole = 'anchor' | 'x' | 'y' | 'w' | 'h' | 'rotation' | 'scale' | 'opacity' | 'z' | 'fontSize' | 'fontWeight' | 'align' | 'font' | 'padding' | 'radius' | 'text' | 'color' | 'background' | 'visible';
42
+ /** `{ role: tweakKey }` — each role names the tweak that holds that property. */
43
+ type LayoutRoleMap = Partial<Record<LayoutRole, string>>;
44
+
45
+ /**
46
+ * devtools.js — Contract §3a: the closed role set, in the spec's order. The one
47
+ * role table (Layout Roles Review, rule 5): the catalog, the synthesis below
48
+ * and `contract/layout.schema.json` all read these lists. The npm wrapper also
49
+ * bundles this file as `@playabl/sdk/layout` for Node tools, so it must load
50
+ * without a DOM, and a change here reaches those tools only with an npm release.
51
+ */
52
+ declare const LAYOUT_ROLES: ReadonlyArray<LayoutRole>;
53
+ declare const LAYOUT_ANCHORS: ReadonlyArray<string>;
54
+ declare const LAYOUT_WEIGHTS: ReadonlyArray<string>;
55
+ declare const LAYOUT_ALIGNS: ReadonlyArray<string>;
56
+ interface LayoutFrame {
57
+ w: number;
58
+ h: number;
59
+ }
60
+ /** The frame ranges are sized to when the window reports none (a hidden or not-yet-laid-out iframe). */
61
+ declare const DEFAULT_FRAME: Readonly<LayoutFrame>;
62
+ /** `layout.json` fields that are not roles. */
63
+ declare const ENTRY_FIELDS: ReadonlyArray<string>;
64
+ /** The tweak key for one role: `layoutKey('hudScore', 'fontSize')` is `hudScoreFontSize`. */
65
+ declare function layoutKey(prefix: string, role: string): string;
66
+ /**
67
+ * `def:hud-score` → `hudScore`: the id without `def:`, in camelCase (the template's
68
+ * existing key naming, D7). An id whose first segment starts with a digit gives a
69
+ * result that is not a key prefix (`def:2-player` → `2Player`); `readPrefix` handles it.
70
+ */
71
+ declare function defaultPrefix(id: string): string;
72
+ /**
73
+ * The hard limits of a number role — the ones that hold whatever the frame,
74
+ * and that `contract/layout.schema.json` states as `minimum` / `maximum` — or
75
+ * `undefined` for a role that is not a number. x and y have none.
76
+ */
77
+ declare function roleLimits(role: LayoutRole): {
78
+ min?: number;
79
+ max?: number;
80
+ } | undefined;
81
+
82
+ /**
83
+ * `@playabl/sdk/layout`: the runtime's own `layout.json` synthesis, for Node
84
+ * tools that read `tweaks.json` from disk. Games never import it. The CDN
85
+ * runtime and this entry share one source file, so a change to the role table
86
+ * reaches template tools only with an npm release of this package.
87
+ */
88
+
89
+ /** What `synthesiseLayout` returns to a tool; the runtime's own result carries more, for itself. */
90
+ interface LayoutSynthesis {
91
+ /** The tweak items `tweaks.init` adds, per entry in role-table order. It has no prototype: test keys with `Object.hasOwn`. */
92
+ items: TweakSchema;
93
+ /** `def id → { role → tweak key }`, including a role mapped onto a key `tweaks.json` already owns. */
94
+ entries: ReadonlyMap<string, LayoutRoleMap>;
95
+ /** The keys of `items`. */
96
+ synthesised: ReadonlySet<string>;
97
+ /**
98
+ * x/y/w/h keys whose `min`/`max` only size the control: the runtime accepts
99
+ * any value for a `both` key, and any value from `min` up for a `max` key.
100
+ */
101
+ softBounds: ReadonlyMap<string, 'both' | 'max'>;
102
+ /** Rotation keys: the runtime wraps a saved, host or live value into (−180, 180] before checking it. */
103
+ angles: ReadonlySet<string>;
104
+ /**
105
+ * Keys of roles the file declared but the synthesis dropped, and every key of `creatorValues`
106
+ * outside `schema` when the file is not an object; the runtime never reports a saved value
107
+ * for one as orphaned.
108
+ */
109
+ declined: ReadonlySet<string>;
110
+ }
111
+ declare const synthesiseLayout: (layout: unknown, schema: TweakSchema, creatorValues: Record<string, unknown>, frame: LayoutFrame, warn?: (message: string) => void) => LayoutSynthesis;
112
+
113
+ export { DEFAULT_FRAME, ENTRY_FIELDS, LAYOUT_ALIGNS, LAYOUT_ANCHORS, LAYOUT_ROLES, LAYOUT_WEIGHTS, type LayoutFrame, type LayoutRole, type LayoutRoleMap, type LayoutSynthesis, type TweakSchema, type TweakSchemaItem, defaultPrefix, layoutKey, roleLimits, synthesiseLayout };
package/dist/layout.js ADDED
@@ -0,0 +1,648 @@
1
+ // ../sdk-runtime/src/types/index.ts
2
+ var CONTENT_VERB_TYPES = [
3
+ "content-add",
4
+ "content-duplicate",
5
+ "content-delete",
6
+ "content-move",
7
+ "place",
8
+ "content-move-instance",
9
+ "content-remove-instance",
10
+ "content-set-field",
11
+ "content-set-payload",
12
+ "content-undo",
13
+ "content-redo",
14
+ "content-group-add",
15
+ "content-group-rename",
16
+ "content-group-delete"
17
+ ];
18
+ var CREATOR_COMMAND_TYPES = [
19
+ "hello",
20
+ "set-mode",
21
+ "step",
22
+ "set-time-scale",
23
+ "restart",
24
+ "goto-level",
25
+ "goto-screen",
26
+ "set-run-state",
27
+ "select",
28
+ "request-scene",
29
+ ...CONTENT_VERB_TYPES
30
+ ];
31
+ var DEVTOOLS_MESSAGE_TYPES = [
32
+ "devtools-ready",
33
+ "catalog",
34
+ "state",
35
+ "scene",
36
+ "instance",
37
+ "layout-wiring",
38
+ "devtools-error",
39
+ "content",
40
+ "content-refused",
41
+ "command-ack",
42
+ "command-refused"
43
+ ];
44
+ var OUTBOUND_TYPES = [
45
+ "ready",
46
+ "score",
47
+ "tweaks-initialize",
48
+ "tweaks-rejected",
49
+ "assets-register",
50
+ "assets-update-applied",
51
+ "state-save",
52
+ "state-load",
53
+ "state-clear",
54
+ ...DEVTOOLS_MESSAGE_TYPES
55
+ ];
56
+ var INBOUND_TYPES = [
57
+ "ready-ack",
58
+ "score-ack",
59
+ "error",
60
+ "tweaks-initialize-ack",
61
+ "tweaks-update",
62
+ "assets-register-ack",
63
+ "assets-update",
64
+ "assets-reset",
65
+ "assets-reset-all",
66
+ // Optional ack for `assets-update-applied`. The runtime sends the applied
67
+ // notification fire-and-forget — the swap already happened live, with no
68
+ // reload — so the host is not required to respond; this type exists only
69
+ // to satisfy the `requestResponse` contract.
70
+ "assets-update-applied-ack",
71
+ "state-save-ack",
72
+ "state-load-ack",
73
+ "state-clear-ack",
74
+ // Game-defined command ids are dispatched by string and are deliberately
75
+ // not enumerated here.
76
+ ...CREATOR_COMMAND_TYPES
77
+ ];
78
+ var PROTOCOL_MESSAGE_TYPES = /* @__PURE__ */ new Set([
79
+ ...OUTBOUND_TYPES,
80
+ ...INBOUND_TYPES
81
+ ]);
82
+
83
+ // ../sdk-runtime/src/assets/types.ts
84
+ function humanise(id) {
85
+ const words = id.replace(/[:_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().split(/\s+/).filter(Boolean);
86
+ if (words.length === 0) return id;
87
+ return words.map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase()).join(" ");
88
+ }
89
+
90
+ // ../sdk-runtime/src/utils/plain.ts
91
+ var isPlainObject = (v) => {
92
+ if (typeof v !== "object" || v === null) return false;
93
+ const proto = Object.getPrototypeOf(v);
94
+ return proto === Object.prototype || proto === null;
95
+ };
96
+ function describeValue(value) {
97
+ if (value === null) return "null";
98
+ if (value === void 0) return "undefined";
99
+ if (typeof value === "string") return JSON.stringify(value.slice(0, 40));
100
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint")
101
+ return String(value);
102
+ if (Array.isArray(value)) return `an array of ${value.length}`;
103
+ return `a ${typeof value}`;
104
+ }
105
+
106
+ // ../sdk-runtime/src/tweaks/manager.ts
107
+ var HEX_COLOR = /^#[0-9a-fA-F]{6}$/;
108
+ var isFiniteNumber = (v) => typeof v === "number" && Number.isFinite(v);
109
+ function wrapAngle(value) {
110
+ if (!isFiniteNumber(value) || value > -180 && value <= 180) return value;
111
+ const wrapped = ((value + 180) % 360 + 360) % 360 - 180;
112
+ return wrapped === -180 ? 180 : wrapped;
113
+ }
114
+ function isValid(item, v) {
115
+ switch (item.type) {
116
+ case "number":
117
+ return typeof v === "number" && Number.isFinite(v) && (item.min === void 0 || v >= item.min) && (item.max === void 0 || v <= item.max);
118
+ case "boolean":
119
+ return typeof v === "boolean";
120
+ case "text":
121
+ return typeof v === "string";
122
+ case "enum":
123
+ return typeof v === "string" && item.options.includes(v);
124
+ case "color":
125
+ return typeof v === "string" && HEX_COLOR.test(v);
126
+ }
127
+ }
128
+ function describeInvalid(item, v) {
129
+ switch (item.type) {
130
+ case "number": {
131
+ if (typeof v !== "number" || !Number.isFinite(v)) return "expected a finite number";
132
+ if (item.min !== void 0 && item.max !== void 0) {
133
+ return `expected a number between ${item.min} and ${item.max}`;
134
+ }
135
+ if (item.min !== void 0) return `expected a number >= ${item.min}`;
136
+ return `expected a number <= ${item.max}`;
137
+ }
138
+ case "boolean":
139
+ return "expected a boolean";
140
+ case "text":
141
+ return "expected a string";
142
+ case "enum":
143
+ return `expected one of: ${item.options.join(", ")}`;
144
+ case "color":
145
+ return "expected a #RRGGBB colour";
146
+ }
147
+ }
148
+
149
+ // ../sdk-runtime/src/tweaks/layout.ts
150
+ var LAYOUT_ROLES = Object.freeze([
151
+ "anchor",
152
+ "x",
153
+ "y",
154
+ "w",
155
+ "h",
156
+ "rotation",
157
+ "scale",
158
+ "opacity",
159
+ "z",
160
+ "fontSize",
161
+ "fontWeight",
162
+ "align",
163
+ "font",
164
+ "padding",
165
+ "radius",
166
+ "text",
167
+ "color",
168
+ "background",
169
+ "visible"
170
+ ]);
171
+ var LAYOUT_ANCHORS = Object.freeze([
172
+ "top-left",
173
+ "top-center",
174
+ "top-right",
175
+ "center-left",
176
+ "center",
177
+ "center-right",
178
+ "bottom-left",
179
+ "bottom-center",
180
+ "bottom-right"
181
+ ]);
182
+ var LAYOUT_WEIGHTS = Object.freeze(["400", "600", "800"]);
183
+ var LAYOUT_ALIGNS = Object.freeze(["left", "center", "right"]);
184
+ var DEFAULT_FRAME = Object.freeze({ w: 390, h: 844 });
185
+ var ENTRY_FIELDS = Object.freeze([
186
+ "label",
187
+ "prefix",
188
+ "fonts",
189
+ "canvas"
190
+ ]);
191
+ var DEF_ID_RE = /^def:[a-z0-9]+(-[a-z0-9]+)*$/;
192
+ var PREFIX_RE = /^[a-z][A-Za-z0-9]*$/;
193
+ var FONT_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9 ._-]*$/;
194
+ var MAX_LABEL = 40;
195
+ var WHERE = "[Playabl] layout.json";
196
+ var defaultWarn = (message) => {
197
+ console.warn(message);
198
+ };
199
+ function layoutKey(prefix, role) {
200
+ return prefix + role.charAt(0).toUpperCase() + role.slice(1);
201
+ }
202
+ function defaultPrefix(id) {
203
+ const [first = "", ...rest] = id.slice("def:".length).split("-");
204
+ return first + rest.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
205
+ }
206
+ var PX = { control: "stepper", unit: " px" };
207
+ var ROLE_SPECS = {
208
+ anchor: {
209
+ type: "text",
210
+ suffix: "Anchor",
211
+ options: LAYOUT_ANCHORS,
212
+ ui: { control: "anchor", options: [...LAYOUT_ANCHORS] },
213
+ describe: (l) => `Which corner, edge, or the centre of the frame ${l} is pinned to.`
214
+ },
215
+ x: {
216
+ type: "number",
217
+ suffix: "Offset X",
218
+ range: (f) => ({ min: -f.w, max: f.w }),
219
+ step: 1,
220
+ grows: "both",
221
+ ui: PX,
222
+ describe: (l) => `How far ${l} sits sideways from the edge or centre line its anchor pins, in pixels.`
223
+ },
224
+ y: {
225
+ type: "number",
226
+ suffix: "Offset Y",
227
+ range: (f) => ({ min: -f.h, max: f.h }),
228
+ step: 1,
229
+ grows: "both",
230
+ ui: PX,
231
+ describe: (l) => `How far ${l} sits up or down from the edge or centre line its anchor pins, in pixels.`
232
+ },
233
+ w: {
234
+ type: "number",
235
+ suffix: "Width",
236
+ range: (f) => ({ min: 1, max: f.w }),
237
+ step: 1,
238
+ grows: "max",
239
+ ui: PX,
240
+ describe: (l) => `How wide ${l} draws, in pixels.`
241
+ },
242
+ h: {
243
+ type: "number",
244
+ suffix: "Height",
245
+ range: (f) => ({ min: 1, max: f.h }),
246
+ step: 1,
247
+ grows: "max",
248
+ ui: PX,
249
+ describe: (l) => `How tall ${l} draws, in pixels.`
250
+ },
251
+ rotation: {
252
+ type: "number",
253
+ suffix: "Rotation",
254
+ range: () => ({ min: -180, max: 180 }),
255
+ step: 1,
256
+ angle: true,
257
+ ui: { control: "angle", unit: "\xB0" },
258
+ describe: (l) => `How far ${l} turns around its centre, in degrees: positive is clockwise.`
259
+ },
260
+ scale: {
261
+ type: "number",
262
+ suffix: "Scale",
263
+ range: () => ({ min: 0.5, max: 3 }),
264
+ step: 0.05,
265
+ ui: {
266
+ control: "scrubber",
267
+ unit: "\xD7",
268
+ presets: [
269
+ { label: "Small", value: 0.75 },
270
+ { label: "Normal", value: 1 },
271
+ { label: "Large", value: 1.5 }
272
+ ]
273
+ },
274
+ describe: (l) => `How much larger or smaller ${l} draws, around its centre.`
275
+ },
276
+ opacity: {
277
+ type: "number",
278
+ suffix: "Opacity",
279
+ range: () => ({ min: 0, max: 1 }),
280
+ step: 0.05,
281
+ ui: {
282
+ control: "scrubber",
283
+ unit: "%",
284
+ presets: [
285
+ { label: "Faint", value: 0.25 },
286
+ { label: "Half", value: 0.5 },
287
+ { label: "Solid", value: 1 }
288
+ ]
289
+ },
290
+ describe: (l) => `How solid ${l} draws, from clear to fully opaque.`
291
+ },
292
+ z: {
293
+ type: "number",
294
+ suffix: "Layer",
295
+ range: () => ({ min: 0, max: 20 }),
296
+ step: 1,
297
+ ui: { control: "stepper" },
298
+ describe: (l) => `Which elements ${l} draws in front of when they overlap; higher is nearer.`
299
+ },
300
+ fontSize: {
301
+ type: "number",
302
+ suffix: "Text size",
303
+ range: () => ({ min: 8, max: 96 }),
304
+ step: 1,
305
+ ui: {
306
+ control: "stepper",
307
+ unit: " px",
308
+ presets: [
309
+ { label: "Small", value: 12 },
310
+ { label: "Normal", value: 18 },
311
+ { label: "Large", value: 32 }
312
+ ]
313
+ },
314
+ describe: (l) => `How big the text in ${l} is, in pixels.`
315
+ },
316
+ fontWeight: {
317
+ type: "text",
318
+ suffix: "Weight",
319
+ options: LAYOUT_WEIGHTS,
320
+ ui: { control: "segmented", options: [...LAYOUT_WEIGHTS] },
321
+ describe: (l) => `How bold the text in ${l} is.`
322
+ },
323
+ align: {
324
+ type: "text",
325
+ suffix: "Alignment",
326
+ options: LAYOUT_ALIGNS,
327
+ ui: { control: "align", options: [...LAYOUT_ALIGNS] },
328
+ describe: (l) => `Where the text sits inside ${l}'s box: left, centre, or right.`
329
+ },
330
+ font: {
331
+ type: "text",
332
+ suffix: "Font",
333
+ ui: { control: "font" },
334
+ describe: (l) => `The typeface of the text in ${l}.`
335
+ },
336
+ padding: {
337
+ type: "number",
338
+ suffix: "Padding",
339
+ range: () => ({ min: 0, max: 40 }),
340
+ step: 1,
341
+ ui: PX,
342
+ describe: (l) => `The space between the edge of ${l} and its content, in pixels.`
343
+ },
344
+ radius: {
345
+ type: "number",
346
+ suffix: "Corner radius",
347
+ range: () => ({ min: 0, max: 40 }),
348
+ step: 1,
349
+ ui: PX,
350
+ describe: (l) => `How rounded the corners of ${l} are, in pixels.`
351
+ },
352
+ text: {
353
+ type: "text",
354
+ suffix: "Text",
355
+ ui: { control: "text" },
356
+ describe: (l) => `The words ${l} shows; double-click it on the board to edit them.`
357
+ },
358
+ color: {
359
+ type: "color",
360
+ suffix: "Colour",
361
+ ui: { control: "swatches" },
362
+ describe: (l) => `The colour of the text in ${l}.`
363
+ },
364
+ background: {
365
+ type: "color",
366
+ suffix: "Background",
367
+ ui: { control: "swatches" },
368
+ describe: (l) => `The colour that fills ${l}'s box behind its content.`
369
+ },
370
+ visible: {
371
+ type: "boolean",
372
+ suffix: "Visible",
373
+ ui: { control: "toggle" },
374
+ describe: (l) => `Whether ${l} shows at all.`
375
+ }
376
+ };
377
+ function synthesiseLayout(layout, schema, creatorValues, frame, warn = defaultWarn) {
378
+ const items = /* @__PURE__ */ Object.create(null);
379
+ const entries = /* @__PURE__ */ new Map();
380
+ const synthesised = /* @__PURE__ */ new Set();
381
+ const softBounds = /* @__PURE__ */ new Map();
382
+ const angles = /* @__PURE__ */ new Set();
383
+ const allowed = /* @__PURE__ */ new Map();
384
+ const declined = /* @__PURE__ */ new Set();
385
+ const canvas = /* @__PURE__ */ new Set();
386
+ const skipped = /* @__PURE__ */ new Set();
387
+ const result = {
388
+ items,
389
+ entries,
390
+ synthesised,
391
+ softBounds,
392
+ angles,
393
+ allowed,
394
+ declined,
395
+ canvas,
396
+ skipped,
397
+ declared: false
398
+ };
399
+ if (layout === void 0) return result;
400
+ if (!isPlainObject(layout)) {
401
+ warn(`${WHERE} is ignored: expected an object keyed by def: catalog ids`);
402
+ for (const key of Object.keys(creatorValues)) {
403
+ if (!Object.hasOwn(schema, key)) declined.add(key);
404
+ }
405
+ return result;
406
+ }
407
+ result.declared = true;
408
+ const owners = /* @__PURE__ */ new Map();
409
+ for (const [id, raw] of Object.entries(layout)) {
410
+ if (!DEF_ID_RE.test(id)) {
411
+ warn(`${WHERE} "${id}" is ignored: keys are def: catalog ids, such as def:hud-score`);
412
+ const own = isPlainObject(raw) ? raw.prefix : void 0;
413
+ decline(declined, typeof own === "string" && PREFIX_RE.test(own) ? own : prefixFromKey(id));
414
+ continue;
415
+ }
416
+ if (!isPlainObject(raw)) {
417
+ warn(`${WHERE} "${id}" is ignored: expected an object of roles`);
418
+ const derived = defaultPrefix(id);
419
+ if (PREFIX_RE.test(derived)) decline(declined, derived);
420
+ continue;
421
+ }
422
+ const prefix = readPrefix(id, raw, warn);
423
+ if (prefix === null) {
424
+ if (Object.hasOwn(raw, "prefix")) {
425
+ decline(declined, defaultPrefix(id));
426
+ if (typeof raw.prefix === "string") decline(declined, camelCasePrefix(raw.prefix));
427
+ }
428
+ continue;
429
+ }
430
+ for (const field of Object.keys(raw)) {
431
+ if (!ENTRY_FIELDS.includes(field) && !LAYOUT_ROLES.includes(field)) {
432
+ warn(`${WHERE} "${id}".${field} is ignored: not a layout role`);
433
+ }
434
+ }
435
+ const label = readLabel(id, raw, warn);
436
+ const fonts = readFonts(id, raw, warn);
437
+ if (readCanvas(id, raw, warn)) canvas.add(id);
438
+ const map = {};
439
+ let index = highestIndex(schema, id);
440
+ for (const role of LAYOUT_ROLES) {
441
+ if (!Object.hasOwn(raw, role)) continue;
442
+ const spec = ROLE_SPECS[role];
443
+ const key = layoutKey(prefix, role);
444
+ const at = `${WHERE} "${id}".${role}`;
445
+ const declared = raw[role];
446
+ const why = checkValue(spec, role, declared, fonts, frame);
447
+ if (why !== null) {
448
+ warn(`${at} is ignored: ${why}`);
449
+ declined.add(key);
450
+ continue;
451
+ }
452
+ const owner = owners.get(key);
453
+ if (owner !== void 0) {
454
+ warn(`${at} is ignored: "${key}" already belongs to "${owner}"`);
455
+ continue;
456
+ }
457
+ if (Object.hasOwn(schema, key)) {
458
+ const existing = schema[key];
459
+ if (existing.type === spec.type) {
460
+ owners.set(key, id);
461
+ map[role] = key;
462
+ warn(`${at} uses tweaks.json's own "${key}"; its range and default stay the game's`);
463
+ } else if (isTypedSet(existing, spec)) {
464
+ owners.set(key, id);
465
+ map[role] = key;
466
+ } else {
467
+ warn(
468
+ `${at} is ignored: tweaks.json already has "${key}" as ${article(existing.type)} ${existing.type} tweak`
469
+ );
470
+ }
471
+ continue;
472
+ }
473
+ owners.set(key, id);
474
+ index += 1;
475
+ items[key] = buildItem(spec, role, declared, {
476
+ id,
477
+ label,
478
+ fonts,
479
+ index,
480
+ frame,
481
+ saved: creatorValues[key]
482
+ });
483
+ synthesised.add(key);
484
+ if (spec.grows) softBounds.set(key, spec.grows);
485
+ if (spec.angle) angles.add(key);
486
+ if (spec.options) allowed.set(key, spec.options);
487
+ else if (role === "font") allowed.set(key, fonts ?? [declared]);
488
+ map[role] = key;
489
+ }
490
+ entries.set(id, map);
491
+ }
492
+ for (const id of Object.keys(layout)) {
493
+ if (!entries.has(id)) skipped.add(id);
494
+ }
495
+ return result;
496
+ }
497
+ function readCanvas(id, raw, warn) {
498
+ if (!Object.hasOwn(raw, "canvas")) return false;
499
+ if (typeof raw.canvas === "boolean") return raw.canvas;
500
+ warn(`${WHERE} "${id}".canvas is ignored: expected true or false`);
501
+ return false;
502
+ }
503
+ function readLabel(id, raw, warn) {
504
+ const fallback = humanise(id.slice("def:".length));
505
+ if (!Object.hasOwn(raw, "label")) {
506
+ warn(`${WHERE} "${id}".label is missing; using "${fallback}"`);
507
+ return fallback;
508
+ }
509
+ const label = raw.label;
510
+ const length = typeof label === "string" ? [...label].length : 0;
511
+ if (typeof label === "string" && length >= 1 && length <= MAX_LABEL) return label;
512
+ warn(
513
+ `${WHERE} "${id}".label is ignored: expected 1 to ${MAX_LABEL} characters; using "${fallback}"`
514
+ );
515
+ return fallback;
516
+ }
517
+ function readPrefix(id, raw, warn) {
518
+ if (Object.hasOwn(raw, "prefix")) {
519
+ const prefix = raw.prefix;
520
+ if (typeof prefix === "string" && PREFIX_RE.test(prefix)) return prefix;
521
+ warn(
522
+ `${WHERE} "${id}" is ignored: its prefix ${describeValue(prefix)} is not camelCase, such as hudScore`
523
+ );
524
+ return null;
525
+ }
526
+ const derived = defaultPrefix(id);
527
+ if (PREFIX_RE.test(derived)) return derived;
528
+ warn(
529
+ `${WHERE} "${id}" is ignored: its key prefix "${derived}" is not camelCase; set prefix, such as player2`
530
+ );
531
+ return null;
532
+ }
533
+ function decline(declined, prefix) {
534
+ if (prefix === "") return;
535
+ for (const role of LAYOUT_ROLES) declined.add(layoutKey(prefix, role));
536
+ }
537
+ function camelCasePrefix(prefix) {
538
+ const letters = prefix.replace(/[^A-Za-z0-9]/g, "");
539
+ return letters.charAt(0).toLowerCase() + letters.slice(1);
540
+ }
541
+ function prefixFromKey(key) {
542
+ const words = key.replace(/^[^:]*:/, "").split(/[^A-Za-z0-9]+/).filter((word) => word !== "");
543
+ return words.map(
544
+ (word, i) => (i === 0 ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1)
545
+ ).join("");
546
+ }
547
+ function article(word) {
548
+ return /^[aeiou]/.test(word) ? "an" : "a";
549
+ }
550
+ function isTypedSet(existing, spec) {
551
+ const set = spec.options;
552
+ return set !== void 0 && existing.type === "enum" && Array.isArray(existing.options) && existing.options.every((option) => set.includes(option));
553
+ }
554
+ function readFonts(id, raw, warn) {
555
+ if (!Object.hasOwn(raw, "fonts")) return void 0;
556
+ const fonts = raw.fonts;
557
+ if (Array.isArray(fonts) && fonts.length > 0 && fonts.every((f) => typeof f === "string" && FONT_NAME_RE.test(f)) && new Set(fonts).size === fonts.length) {
558
+ return [...fonts];
559
+ }
560
+ warn(`${WHERE} "${id}".fonts is ignored: expected a list of distinct font names`);
561
+ return void 0;
562
+ }
563
+ function highestIndex(schema, id) {
564
+ let top = 0;
565
+ for (const item of Object.values(schema)) {
566
+ if (item.group === id && Number.isInteger(item.index) && item.index > top) {
567
+ top = item.index;
568
+ }
569
+ }
570
+ return top;
571
+ }
572
+ function checkValue(spec, role, value, fonts, frame) {
573
+ const probe = probeItem(spec, frame);
574
+ if (!isValid(probe, value)) return describeInvalid(probe, value);
575
+ if (role === "font") {
576
+ const name = value;
577
+ if (!FONT_NAME_RE.test(name)) return "expected a font name";
578
+ if (fonts && !fonts.includes(name)) return `expected one of fonts: ${fonts.join(", ")}`;
579
+ }
580
+ return null;
581
+ }
582
+ function roleLimits(role) {
583
+ const probe = probeItem(ROLE_SPECS[role], DEFAULT_FRAME);
584
+ if (probe.type !== "number") return void 0;
585
+ const limits = {};
586
+ if (probe.min !== void 0) limits.min = probe.min;
587
+ if (probe.max !== void 0) limits.max = probe.max;
588
+ return limits;
589
+ }
590
+ function probeItem(spec, frame) {
591
+ switch (spec.type) {
592
+ case "number": {
593
+ const { min, max } = spec.range(frame);
594
+ if (spec.grows === "both") return { type: "number", value: 0 };
595
+ if (spec.grows === "max") return { type: "number", value: min, min };
596
+ return { type: "number", value: min, min, max };
597
+ }
598
+ case "text":
599
+ return spec.options ? { type: "enum", value: spec.options[0], options: [...spec.options] } : { type: "text", value: "" };
600
+ case "color":
601
+ return { type: "color", value: "#000000" };
602
+ case "boolean":
603
+ return { type: "boolean", value: false };
604
+ }
605
+ }
606
+ function buildItem(spec, role, value, at) {
607
+ const ui = structuredClone(spec.ui);
608
+ if (role === "font") ui.options = at.fonts ? [...at.fonts] : [value];
609
+ const item = {
610
+ type: spec.type,
611
+ value: spec.angle ? wrapAngle(value) : value
612
+ };
613
+ if (spec.type === "number") {
614
+ let { min, max } = spec.range(at.frame);
615
+ if (spec.grows) {
616
+ const saved = typeof at.saved === "number" && Number.isFinite(at.saved) ? at.saved : void 0;
617
+ const held = [value];
618
+ if (saved !== void 0 && (spec.grows === "both" || saved >= min)) held.push(saved);
619
+ if (spec.grows === "both") min = Math.min(min, ...held);
620
+ max = Math.max(max, ...held);
621
+ }
622
+ item.min = min;
623
+ item.max = max;
624
+ item.step = spec.step;
625
+ }
626
+ item.name = `${at.label} \xB7 ${spec.suffix}`;
627
+ item.description = spec.describe(at.label);
628
+ item.group = at.id;
629
+ item.index = at.index;
630
+ item.ui = ui;
631
+ return item;
632
+ }
633
+
634
+ // src/layout.ts
635
+ var synthesiseLayout2 = synthesiseLayout;
636
+ export {
637
+ DEFAULT_FRAME,
638
+ ENTRY_FIELDS,
639
+ LAYOUT_ALIGNS,
640
+ LAYOUT_ANCHORS,
641
+ LAYOUT_ROLES,
642
+ LAYOUT_WEIGHTS,
643
+ defaultPrefix,
644
+ layoutKey,
645
+ roleLimits,
646
+ synthesiseLayout2 as synthesiseLayout
647
+ };
648
+ //# sourceMappingURL=layout.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playabl/sdk",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.1.0-beta.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -10,13 +10,21 @@
10
10
  "files": [
11
11
  "dist/index.js",
12
12
  "dist/index.d.ts",
13
+ "dist/layout.js",
14
+ "dist/layout.d.ts",
13
15
  "README.md"
14
16
  ],
15
17
  "exports": {
16
18
  ".": {
17
19
  "types": "./dist/index.d.ts",
18
20
  "import": "./dist/index.js"
19
- }
21
+ },
22
+ "./layout": {
23
+ "types": "./dist/layout.d.ts",
24
+ "import": "./dist/layout.js",
25
+ "default": "./dist/layout.js"
26
+ },
27
+ "./package.json": "./package.json"
20
28
  },
21
29
  "sideEffects": [
22
30
  "./dist/index.js"