@tomorrowevening/theatre-core 1.0.2 → 1.0.4

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
@@ -36,13 +36,13 @@ You can find the documentation and video tutorials [here](https://theatrejs.com/
36
36
 
37
37
  Join us on [Discord](https://discord.gg/bm9f8F9Y9N), follow the updates on [twitter](https://twitter.com/AriaMinaei) or write us an [email](mailto:hello@theatrejs.com).
38
38
 
39
- ## `@theatre/core`
39
+ ## `@tomorrowevening/theatre-core`
40
40
 
41
- Theatre.js comes in two packages: `@theatre/core` (the library) and `@theatre/studio` (the editor). This package is the core library.
41
+ Theatre.js comes in two packages: `@tomorrowevening/theatre-core` (the library) and `@tomorrowevening/theatre-studio` (the editor). This package is the core library.
42
42
 
43
43
  ## Bundle size
44
44
 
45
- `@theatre/core` is currently around 20KiB compressed with all its dependencies.
45
+ `@tomorrowevening/theatre-core` is currently around 20KiB compressed with all its dependencies.
46
46
 
47
47
  ## License
48
48
 
package/dist/index.d.ts CHANGED
@@ -1,80 +1,4 @@
1
- import type { IProject, IProjectConfig } from './projects/TheatreProject';
2
- import * as types from './propTypes';
3
- import type { PointerType, Prism } from '@theatre/dataverse';
4
- import type { $IntentionalAny, VoidFn } from '@theatre/shared/utils/types';
5
- import type { IRafDriver } from './rafDrivers';
6
- export { notify } from '@theatre/shared/notify';
7
- export { types };
8
- export { createRafDriver } from './rafDrivers';
9
- export type { IRafDriver } from './rafDrivers';
10
- /**
11
- * Returns a project of the given id, or creates one if it doesn't already exist.
12
- *
13
- * @remarks
14
- * If \@theatre/studio is also loaded, then the state of the project will be managed by the studio.
15
- *
16
- * [Learn more about exporting](https://www.theatrejs.com/docs/latest/manual/projects#state)
17
- *
18
- * @example
19
- * Usage:
20
- * ```ts
21
- * import {getProject} from '@theatre/core'
22
- * const config = {} // the config can be empty when starting a new project
23
- * const project = getProject("a-unique-id", config)
24
- * ```
25
- *
26
- * @example
27
- * Usage with an explicit state:
28
- * ```ts
29
- * import {getProject} from '@theatre/core'
30
- * import state from './saved-state.json'
31
- * const config = {state} // here the config contains our saved state
32
- * const project = getProject("a-unique-id", config)
33
- * ```
34
- */
35
- export declare function getProject(id: string, config?: IProjectConfig): IProject;
36
- /**
37
- * Calls `callback` every time the pointed value of `pointer` changes.
38
- *
39
- * @param pointer - A Pointer (like `object.props.x`)
40
- * @param callback - The callback is called every time the value of pointer changes
41
- * @param rafDriver - (optional) The `rafDriver` to use. Learn how to use `rafDriver`s [from the docs](https://www.theatrejs.com/docs/latest/manual/advanced#rafdrivers).
42
- * @returns An unsubscribe function
43
- *
44
- * @example
45
- * Usage:
46
- * ```ts
47
- * import {getProject, onChange} from '@theatre/core'
48
- *
49
- * const obj = getProject("A project").sheet("Scene").object("Box", {position: {x: 0}})
50
- *
51
- * const usubscribe = onChange(obj.props.position.x, (x) => {
52
- * console.log('position.x changed to:', x)
53
- * })
54
- *
55
- * setTimeout(usubscribe, 10000) // stop listening to changes after 10 seconds
56
- * ```
57
- */
58
- export declare function onChange<P extends PointerType<$IntentionalAny> | Prism<$IntentionalAny>>(pointer: P, callback: (value: P extends PointerType<infer T> ? T : P extends Prism<infer T> ? T : unknown) => void, rafDriver?: IRafDriver): VoidFn;
59
- /**
60
- * Takes a Pointer and returns the value it points to.
61
- *
62
- * @param pointer - A pointer (like `object.props.x`)
63
- * @returns The value the pointer points to
64
- *
65
- * @example
66
- *
67
- * Usage
68
- * ```ts
69
- * import {val, getProject} from '@theatre/core'
70
- *
71
- * const obj = getProject("A project").sheet("Scene").object("Box", {position: {x: 0}})
72
- *
73
- * console.log(val(obj.props.position.x)) // logs the value of obj.props.x
74
- * ```
75
- */
76
- export declare function val<T>(pointer: PointerType<T>): T;
77
- //# sourceMappingURL=coreExports.d.ts.map
1
+ export * from './coreExports';
78
2
  export { IProject, IProjectConfig } from './projects/TheatreProject';
79
3
  export { ISequence } from './sequences/TheatreSequence';
80
4
  export { ISheetObject } from './sheetObjects/TheatreSheetObject';
package/dist/index.js CHANGED
@@ -5491,7 +5491,7 @@ var TheatreSequence = class {
5491
5491
  if (process.env.NODE_ENV !== "production") {
5492
5492
  notify.warning(
5493
5493
  "Sequence can't be played",
5494
- "You seem to have called `sequence.play()` before the project has finished loading.\n\nThis would **not** a problem in production when using `@theatre/core`, since Theatre.js loads instantly in core mode. However, when using `@theatre/studio`, it takes a few milliseconds for it to load your project's state, before which your sequences cannot start playing.\n\nTo fix this, simply defer calling `sequence.play()` until after the project is loaded, like this:\n\n```\nproject.ready.then(() => {\n sequence.play()\n})\n```",
5494
+ "You seem to have called `sequence.play()` before the project has finished loading.\n\nThis would **not** a problem in production when using `@tomorrowevening/theatre-core`, since Theatre.js loads instantly in core mode. However, when using `@tomorrowevening/theatre-studio`, it takes a few milliseconds for it to load your project's state, before which your sequences cannot start playing.\n\nTo fix this, simply defer calling `sequence.play()` until after the project is loaded, like this:\n\n```\nproject.ready.then(() => {\n sequence.play()\n})\n```",
5495
5495
  [
5496
5496
  {
5497
5497
  url: "https://www.theatrejs.com/docs/0.5/api/core#project.ready",
@@ -5542,7 +5542,7 @@ var TheatreSequence = class {
5542
5542
  if (process.env.NODE_ENV !== "production") {
5543
5543
  notify.warning(
5544
5544
  "Sequence can't go to marker",
5545
- "You seem to have called `sequence.goToAndPlay()` before the project has finished loading.\n\nThis would **not** a problem in production when using `@theatre/core`, since Theatre.js loads instantly in core mode. However, it seems that you are using `@theatre/studio`, which takes a few milliseconds to load, because itcontains a lot of code responsible for the editing UI.\n\nTo fix this, wait for `project.ready` to resolve, and only then call `sequence.goToAndPlay()`.\n\nLearn more at https://www.theatrejs.com/docs/latest/manual/projects#state"
5545
+ "You seem to have called `sequence.goToAndPlay()` before the project has finished loading.\n\nThis would **not** a problem in production when using `@tomorrowevening/theatre-core`, since Theatre.js loads instantly in core mode. However, it seems that you are using `@tomorrowevening/theatre-studio`, which takes a few milliseconds to load, because itcontains a lot of code responsible for the editing UI.\n\nTo fix this, wait for `project.ready` to resolve, and only then call `sequence.goToAndPlay()`.\n\nLearn more at https://www.theatrejs.com/docs/latest/manual/projects#state"
5546
5546
  );
5547
5547
  }
5548
5548
  const d2 = defer();
@@ -7476,7 +7476,7 @@ var Project = class {
7476
7476
  setTimeout(() => {
7477
7477
  if (!this._studio) {
7478
7478
  throw new Error(
7479
- 'Argument config.state in Theatre.getProject("'.concat(id, '", config) is empty. This is fine ') + "while you are using @theatre/core along with @theatre/studio. But since @theatre/studio " + 'is not loaded, the state of project "'.concat(id, '" will be empty.\n\n') + "To fix this, you need to add @theatre/studio into the bundle and export the project's state. Learn how to do that at https://www.theatrejs.com/docs/latest/manual/projects#state\n"
7479
+ 'Argument config.state in Theatre.getProject("'.concat(id, '", config) is empty. This is fine ') + "while you are using @tomorrowevening/theatre-core along with @tomorrowevening/theatre-studio. But since @tomorrowevening/theatre-studio " + 'is not loaded, the state of project "'.concat(id, '" will be empty.\n\n') + "To fix this, you need to add @tomorrowevening/theatre-studio into the bundle and export the project's state. Learn how to do that at https://www.theatrejs.com/docs/latest/manual/projects#state\n"
7480
7480
  );
7481
7481
  }
7482
7482
  }, 1e3);
@@ -7709,11 +7709,11 @@ var CoreBundle = class {
7709
7709
  return "Theatre_CoreBundle";
7710
7710
  }
7711
7711
  get version() {
7712
- return "1.0.2";
7712
+ return "1.0.4";
7713
7713
  }
7714
7714
  getBitsForStudio(studio, callback) {
7715
7715
  if (this._studio) {
7716
- throw new Error("@theatre/core is already attached to @theatre/studio");
7716
+ throw new Error("@tomorrowevening/theatre-core is already attached to @tomorrowevening/theatre-studio");
7717
7717
  }
7718
7718
  this._studio = studio;
7719
7719
  const bits = {
@@ -7738,11 +7738,11 @@ function registerCoreBundle() {
7738
7738
  if (typeof existingBundle !== "undefined") {
7739
7739
  if (typeof existingBundle === "object" && existingBundle && typeof existingBundle.version === "string") {
7740
7740
  throw new Error(
7741
- "It seems that the module '@theatre/core' is loaded more than once. This could have two possible causes:\n1. You might have two separate versions of Theatre.js in node_modules.\n2. Or this might be a bundling misconfiguration, in case you're using a bundler like Webpack/ESBuild/Rollup.\n\nNote that it **is okay** to import '@theatre/core' multiple times. But those imports should point to the same module."
7741
+ "It seems that the module '@tomorrowevening/theatre-core' is loaded more than once. This could have two possible causes:\n1. You might have two separate versions of Theatre.js in node_modules.\n2. Or this might be a bundling misconfiguration, in case you're using a bundler like Webpack/ESBuild/Rollup.\n\nNote that it **is okay** to import '@tomorrowevening/theatre-core' multiple times. But those imports should point to the same module."
7742
7742
  );
7743
7743
  } else {
7744
7744
  throw new Error(
7745
- "The variable window.".concat(coreBundle, " seems to be already set by a module other than @theatre/core.")
7745
+ "The variable window.".concat(coreBundle, " seems to be already set by a module other than @tomorrowevening/theatre-core.")
7746
7746
  );
7747
7747
  }
7748
7748
  }