@dreamerbird/core 1.3.0 → 1.4.1

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.d.ts CHANGED
@@ -20,7 +20,9 @@ declare namespace coreExports {
20
20
  * We do not use `Map`s or `Set`s, because they add complexity with converting to
21
21
  * `JSON.stringify` + pointer types.
22
22
  */
23
- type StrictRecord$1<Key extends string, V> = {[K in Key]?: V}
23
+ type StrictRecord$1<Key extends string, V> = {
24
+ [K in Key]?: V;
25
+ };
24
26
 
25
27
  /**
26
28
  * Consistent way to maintain an unordered structure which plays well with dataverse pointers and
@@ -30,17 +32,17 @@ type StrictRecord$1<Key extends string, V> = {[K in Key]?: V}
30
32
  * unnecessary re-renders
31
33
  */
32
34
  type PointableSet<Id extends string, V> = {
33
- /**
34
- * Usually accessed through pointers before accessing the actual value, so we can separate
35
- * changes to individual items from changes to the entire list of items.
36
- */
37
- byId: StrictRecord$1<Id, V>
38
- /**
39
- * Separate list of ids allows us to recognize changes to set item memberships, without being triggered changed when
40
- * the contents of its items have changed.
41
- */
42
- allIds: StrictRecord$1<Id, true>
43
- }
35
+ /**
36
+ * Usually accessed through pointers before accessing the actual value, so we can separate
37
+ * changes to individual items from changes to the entire list of items.
38
+ */
39
+ byId: StrictRecord$1<Id, V>;
40
+ /**
41
+ * Separate list of ids allows us to recognize changes to set item memberships, without being triggered changed when
42
+ * the contents of its items have changed.
43
+ */
44
+ allIds: StrictRecord$1<Id, true>;
45
+ };
44
46
 
45
47
  /**
46
48
  * Using a symbol, we can sort of add unique properties to arbitrary other types.
@@ -52,7 +54,6 @@ type PointableSet<Id extends string, V> = {
52
54
  * So, we're opting to keeping the identifier short.
53
55
  */
54
56
  declare const nominal$1: unique symbol;
55
-
56
57
  /**
57
58
  * This creates an "opaque"/"nominal" type.
58
59
  *
@@ -62,34 +63,34 @@ declare const nominal$1: unique symbol;
62
63
  *
63
64
  * See {@link nominal} for more details.
64
65
  */
65
- type Nominal$1<N extends string> = string & {[nominal$1]: N}
66
-
66
+ type Nominal$1<N extends string> = string & {
67
+ [nominal$1]: N;
68
+ };
67
69
  declare global {
68
- // Fix Object.entries and Object.keys definitions for Nominal strict records
69
- interface ObjectConstructor {
70
- /** Nominal: Extension to the Object prototype definition to properly manage {@link Nominal} keyed records */
71
- keys<T extends Record<Nominal$1<string>, any>>(
72
- obj: T,
73
- ): any extends T ? never[] : Extract<keyof T, string>[]
74
- /** Nominal: Extension to the Object prototype definition to properly manage {@link Nominal} keyed records */
75
- entries<T extends Record<Nominal$1<string>, any>>(
76
- obj: T,
77
- ): any extends T
78
- ? [never, never][]
79
- : Array<{[P in keyof T]: [P, T[P]]}[Extract<keyof T, string>]>
80
- }
70
+ interface ObjectConstructor {
71
+ /** Nominal: Extension to the Object prototype definition to properly manage {@link Nominal} keyed records */
72
+ keys<T extends Record<Nominal$1<string>, any>>(obj: T): any extends T ? never[] : Extract<keyof T, string>[];
73
+ /** Nominal: Extension to the Object prototype definition to properly manage {@link Nominal} keyed records */
74
+ entries<T extends Record<Nominal$1<string>, any>>(obj: T): any extends T ? [never, never][] : Array<{
75
+ [P in keyof T]: [P, T[P]];
76
+ }[Extract<keyof T, string>]>;
77
+ }
81
78
  }
82
79
 
83
80
  /**
84
81
  * This is a simple array representing the path to a prop, without specifying the object.
85
82
  */
86
- type PathToProp$1 = Array<string | number>
87
-
83
+ type PathToProp$1 = Array<string | number>;
88
84
  /**
89
85
  * Just like {@link PathToProp}, but encoded as a string. Since this type is nominal,
90
86
  * it can only be generated using {@link encodePathToProp}.
91
87
  */
92
- type PathToProp_Encoded = Nominal$1<'PathToProp_Encoded'>
88
+ type PathToProp_Encoded = Nominal$1<'PathToProp_Encoded'>;
89
+ /**
90
+ * Encodes a {@link PathToProp} as a string, and caches the result, so as long
91
+ * as the input is the same, the output won't have to be re-generated.
92
+ */
93
+ declare const encodePathToProp: (k: PathToProp$1) => PathToProp_Encoded;
93
94
 
94
95
  interface SheetState_Historic {
95
96
  /**
@@ -317,23 +318,21 @@ declare class SheetTemplate {
317
318
  * A basic cache
318
319
  */
319
320
  declare class SimpleCache {
320
- /**
321
- * NOTE this could also be a Map.
322
- */
323
- protected _values: Record<string, unknown>;
324
- constructor();
325
-
326
- /**
327
- * get the cache item at `key` or produce it using `producer` and cache _that_.
328
- *
329
- * Note that this won't work if you change the producer, like `get(key, producer1); get(key, producer2)`.
330
- */
331
- get<T>(key: string, producer: () => T): T;
332
-
333
- /**
334
- * Returns true if the cache has an item at `key`.
335
- */
336
- has(key: string): boolean;
321
+ /**
322
+ * NOTE this could also be a Map.
323
+ */
324
+ protected _values: Record<string, unknown>;
325
+ constructor();
326
+ /**
327
+ * get the cache item at `key` or produce it using `producer` and cache _that_.
328
+ *
329
+ * Note that this won't work if you change the producer, like `get(key, producer1); get(key, producer2)`.
330
+ */
331
+ get<T>(key: string, producer: () => T): T;
332
+ /**
333
+ * Returns true if the cache has an item at `key`.
334
+ */
335
+ has(key: string): boolean;
337
336
  }
338
337
 
339
338
  /**
@@ -691,6 +690,11 @@ declare function privateAPI<P extends {
691
690
  * Returns the rafDriver that is used by the core internally. Creates a new one if it's not set yet.
692
691
  */
693
692
  declare function getCoreRafDriver(): RafDriverPrivateAPI;
693
+ /**
694
+ *
695
+ * @returns The ticker that is used by the core internally.
696
+ */
697
+ declare function getCoreTicker(): Ticker;
694
698
 
695
699
  type Studio = IStudioInternal;
696
700
  type CoreBits = {
@@ -2696,6 +2700,26 @@ declare function onChange<P extends PointerType<$IntentionalAny> | Prism<$Intent
2696
2700
  */
2697
2701
  declare function val<T>(pointer: PointerType<T>): T;
2698
2702
 
2703
+ interface Deferred<PromiseType> {
2704
+ resolve: (d: PromiseType) => void;
2705
+ reject: (d: unknown) => void;
2706
+ promise: Promise<PromiseType>;
2707
+ status: 'pending' | 'resolved' | 'rejected';
2708
+ currentValue: PromiseType | undefined;
2709
+ }
2710
+
2711
+ /**
2712
+ * Tracks whether (and how) `theatre.init()` was called.
2713
+ *
2714
+ * Kept in its own module (rather than index.ts) so that modules deep in core
2715
+ * (like Project) can read it without a circular import through the package
2716
+ * entry point.
2717
+ */
2718
+ declare const initState: {
2719
+ called: boolean;
2720
+ optsDeferred: Deferred<InitOpts | undefined>;
2721
+ };
2722
+
2699
2723
  /**
2700
2724
  * The library providing the runtime functionality of Theatre.js.
2701
2725
  *
@@ -2716,4 +2740,4 @@ declare const theatre: {
2716
2740
  init: typeof init;
2717
2741
  };
2718
2742
 
2719
- export { type $FixMe, type $IntentionalAny, type $____FixmeStudio, type Asset, type BasicKeyframe, type DeepPartialOfSerializableValue, type File$1 as File, type I18nMessages, type I18nVars, type IAttachAudioArgs, type IBasePropType, type IExtension, type IExtensionI18n, type IPlaybackDirection, type IPlaybackRange, type IProject, type IProjectConfig, type IRafDriver, type IRange, type IScrub, type IScrubApi, type ISequence, type ISheet, type ISheetObject, type IStudio, type IStudioBundle, type IStudioI18nAPI, type IStudioInternal, type IStudioUI, type ITransactionAPI, type IWorkspaceButtonConfig, type InitOpts, type Interpolator, type KeyframeId, type KeyframeType, type Laba, type NumberNudgeFn, type ObjectAddressKey, type OnDiskState, type OutlineMenuItem, type OutlineObjectMenuContribution, type PaneClassDefinition, type PaneInstance, type PaneInstanceId, type PathToProp, type PositionInScreenSpace, type ProjectAddress, type ProjectId, type PropAddress, type PropLabel, type PropTypeConfig, type PropTypeConfig_AllSimples, type PropTypeConfig_Boolean, type PropTypeConfig_Compound, type PropTypeConfig_Enum, type PropTypeConfig_File, type PropTypeConfig_Image, type PropTypeConfig_Number, type PropTypeConfig_Rgba, type PropTypeConfig_String, type PropTypeConfig_StringLiteral, type PropsValue, type Rgba, type SequenceAddress, type SequenceMarkerId, type SequenceTrackId, type SerializableMap, type SerializablePrimitive, type SerializableValue, type SheetAddress, type SheetId, type SheetInstanceId, type SheetInstanceOptional, type SheetObjectAction, type SheetObjectActionsConfig, type SheetObjectAddress, type SheetObjectPropTypeConfig, type ShorthandCompoundPropsToInitialValue, type ShorthandCompoundPropsToLonghandCompoundProps, type ShorthandPropToLonghandProp, type StrictRecord, type StudioLogo, type StudioPanelVisibility, type ToolConfig, type ToolConfigFlyoutMenu, type ToolConfigIcon, type ToolConfigOption, type ToolConfigSwitch, type ToolconfigFlyoutMenuItem, type ToolsetConfig, type UnknownShorthandCompoundProps, type UnknownValidCompoundProps, type VoidFn, type WithoutSheetInstance, __private, createRafDriver, theatre as default, getProject, getStudio, getStudioSync, init, notify, onChange, propTypeSymbol, resolvePropLabel, index_d as types, val };
2743
+ export { type $FixMe, type $IntentionalAny, type $____FixmeStudio, type Asset, type BasicKeyframe, type DeepPartialOfSerializableValue, type File$1 as File, type HistoricPositionalSequence, type I18nMessages, type I18nVars, type IAttachAudioArgs, type IBasePropType, type IExtension, type IExtensionI18n, type IPlaybackDirection, type IPlaybackRange, type IProject, type IProjectConfig, type IRafDriver, type IRange, type IScrub, type IScrubApi, type ISequence, type ISheet, type ISheetObject, type IStudio, type IStudioBundle, type IStudioI18nAPI, type IStudioInternal, type IStudioUI, type ITransactionAPI, type IWorkspaceButtonConfig, type InitOpts, type Interpolator, type KeyframeId, type KeyframeType, type Laba, type NumberNudgeFn, type ObjectAddressKey, type OnDiskState, type OutlineMenuItem, type OutlineObjectMenuContribution, type PaneClassDefinition, type PaneInstance, type PaneInstanceId, type PathToProp, type PositionInScreenSpace, type ProjectAddress, type ProjectId, type PropAddress, type PropLabel, type PropTypeConfig, type PropTypeConfig_AllSimples, type PropTypeConfig_Boolean, type PropTypeConfig_Compound, type PropTypeConfig_Enum, type PropTypeConfig_File, type PropTypeConfig_Image, type PropTypeConfig_Number, type PropTypeConfig_Rgba, type PropTypeConfig_String, type PropTypeConfig_StringLiteral, type PropsValue, type Rgba, type SequenceAddress, type SequenceMarkerId, type SequenceTrackId, type SerializableMap, type SerializablePrimitive, type SerializableValue, type SheetAddress, type SheetId, type SheetInstanceId, type SheetInstanceOptional, type SheetObjectAction, type SheetObjectActionsConfig, type SheetObjectAddress, type SheetObjectPropTypeConfig, type ShorthandCompoundPropsToInitialValue, type ShorthandCompoundPropsToLonghandCompoundProps, type ShorthandPropToLonghandProp, type StrictRecord, type StudioLogo, type StudioPanelVisibility, type ToolConfig, type ToolConfigFlyoutMenu, type ToolConfigIcon, type ToolConfigOption, type ToolConfigSwitch, type ToolconfigFlyoutMenuItem, type ToolsetConfig, type UnknownShorthandCompoundProps, type UnknownValidCompoundProps, type VoidFn, type WithoutSheetInstance, __private, createRafDriver, theatre as default, encodePathToProp, getCoreTicker, getProject, getStudio, getStudioSync, init, initState, notify, onChange, privateAPI, singleton as projectsSingleton, propTypeSymbol, resolvePropLabel, index_d as types, val };
package/dist/index.js CHANGED
@@ -192,13 +192,17 @@ __export(src_exports, {
192
192
  __private: () => __private,
193
193
  createRafDriver: () => createRafDriver,
194
194
  default: () => src_default,
195
+ encodePathToProp: () => encodePathToProp,
196
+ getCoreTicker: () => getCoreTicker,
195
197
  getProject: () => getProject,
196
198
  getStudio: () => getStudio,
197
199
  getStudioSync: () => getStudioSync,
198
200
  init: () => init,
201
+ initState: () => initState,
199
202
  notify: () => notify,
200
203
  onChange: () => onChange,
201
- propTypeSymbol: () => propTypeSymbol,
204
+ privateAPI: () => privateAPI,
205
+ projectsSingleton: () => projectsSingleton_default,
202
206
  resolvePropLabel: () => resolvePropLabel,
203
207
  types: () => propTypes_exports,
204
208
  val: () => val8
@@ -4154,7 +4158,7 @@ function val8(pointer3) {
4154
4158
  // src/env.ts
4155
4159
  var env = {
4156
4160
  BUILT_FOR_PLAYGROUND: "false",
4157
- THEATRE_VERSION: "1.3.0",
4161
+ THEATRE_VERSION: "1.4.1",
4158
4162
  BACKEND_URL: "https://app.theatrejs.com"
4159
4163
  };
4160
4164
 
@@ -4239,6 +4243,25 @@ function registerCoreBundle() {
4239
4243
  );
4240
4244
  possibleExistingStudioBundle && possibleExistingStudioBundle !== null && possibleExistingStudioBundle.type === "Theatre_StudioBundle" && possibleExistingStudioBundle.registerCoreBundle(coreBundle);
4241
4245
  }
4246
+ // Annotate the CommonJS export names for ESM import in node:
4247
+ 0 && (module.exports = {
4248
+ __private,
4249
+ createRafDriver,
4250
+ encodePathToProp,
4251
+ getCoreTicker,
4252
+ getProject,
4253
+ getStudio,
4254
+ getStudioSync,
4255
+ init,
4256
+ initState,
4257
+ notify,
4258
+ onChange,
4259
+ privateAPI,
4260
+ projectsSingleton,
4261
+ resolvePropLabel,
4262
+ types,
4263
+ val
4264
+ });
4242
4265
  /*! Bundled license information:
4243
4266
 
4244
4267
  lodash-es/lodash.js: