@unseenco/theatre-core 0.1.9 → 0.1.11

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
@@ -40,6 +40,34 @@ Join us on [Discord](https://discord.gg/bm9f8F9Y9N), follow the updates on [twit
40
40
 
41
41
  Theatre.js comes in two packages: `@unseenco/theatre-core` (the library) and `@unseenco/theatre-studio` (the editor). This package is the core library.
42
42
 
43
+ ### Listing and unloading sheets / objects
44
+
45
+ Runtime helpers for tearing down loaded sheets and objects (for example when switching scenes). These drop in-memory instances so Studio stops showing them, but **do not** clear persisted project state. Recreating the same `sheetId` / object `key` restores prior prop overrides and sequence data.
46
+
47
+ ```ts
48
+ import {getProject} from '@unseenco/theatre-core'
49
+
50
+ const project = getProject('My project')
51
+ const sheet = project.sheet('Scene')
52
+ sheet.object('Box', {x: 0, y: 0})
53
+
54
+ // List what is currently loaded
55
+ project.getSheets() // ISheet[]
56
+ sheet.getObjects() // ISheetObject[]
57
+
58
+ // Detach one object (sheet stays loaded)
59
+ sheet.detachObject('Box')
60
+
61
+ // Unload this sheet instance (all of its objects, then the sheet)
62
+ sheet.unload()
63
+
64
+ // Or from the project:
65
+ project.unloadSheet('Scene') // optional second arg: instanceId
66
+ project.unloadSheets() // unload every loaded sheet
67
+ ```
68
+
69
+ Try the interactive demo in the playground: `/shared/unload-sheets/`.
70
+
43
71
  ## Bundle size
44
72
 
45
73
  `@unseenco/theatre-core` is currently around 20KiB compressed with all its dependencies.