@novely/core 0.33.0-beta.0 → 0.33.0-beta.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
@@ -256,6 +256,10 @@ type NovelyScreen = 'mainmenu' | 'game' | 'saves' | 'settings';
256
256
  type DeepPartial<T> = unknown extends T ? T : T extends object ? {
257
257
  [P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>;
258
258
  } : T;
259
+ /**
260
+ *
261
+ */
262
+ type Assign<A extends object, B extends object> = Pick<A, Exclude<keyof A, keyof B>> & B;
259
263
  type NonEmptyRecord<T extends Record<PropertyKey, unknown>> = keyof T extends never ? never : T;
260
264
  type CoreData = {
261
265
  dataLoaded: boolean;
@@ -740,4 +744,19 @@ declare const novely: <$Language extends string, $Characters extends Record<stri
740
744
  getCurrentStorageData: () => StorageData<$Language, $Data> | null;
741
745
  };
742
746
 
743
- export { type ActionInputOnInputMeta, type ActionInputSetup, type ActionProxy, type AllowedContent, type AudioHandle, type BackgroundImage, type BaseTranslationStrings, type Character, type CharacterHandle, type ConditionParams, type Context, type CoreData, type CustomHandler, type CustomHandlerFunctionGetFn, type CustomHandlerFunctionParameters, type CustomHandlerGetResult, type CustomHandlerGetResultDataFunction, type Data, type DeepPartial, type DefaultActionProxy, EN, type Emotions, type FunctionableValue, type GetActionParameters, JP, KK, type Lang, type NovelyInit, type NovelyScreen, type Path, type PluralType, type Pluralization, RU, type Renderer, type RendererInit, type Save, type Stack, type StackHolder, type State, type StateFunction, type Storage, type StorageData, type StorageMeta, type Stored, type Story, type TextContent, type Thenable, type TranslationActions, type TypewriterSpeed, type ValidAction, localStorageStorage, novely };
747
+ /**
748
+ * Extens core action with custom actions
749
+ * @param base Actions object you will extend, `engine.action`
750
+ * @param extension Actions object you will extend with
751
+ * @example
752
+ * ```ts
753
+ * const action = extendAction(engine.action, {
754
+ * particles: (options: Parameters<typeof particles>[0]) => {
755
+ * return ['custom', particles(options)]
756
+ * }
757
+ * })
758
+ * ```
759
+ */
760
+ declare const extendAction: <Part0 extends Record<string, (...args: any[]) => ValidAction>, Part1 extends Record<string, (...args: any[]) => ValidAction>>(base: Part0, extension: Part1) => Readonly<Assign<Part0, Part1>>;
761
+
762
+ export { type ActionInputOnInputMeta, type ActionInputSetup, type ActionProxy, type AllowedContent, type AudioHandle, type BackgroundImage, type BaseTranslationStrings, type Character, type CharacterHandle, type ConditionParams, type Context, type CoreData, type CustomHandler, type CustomHandlerFunctionGetFn, type CustomHandlerFunctionParameters, type CustomHandlerGetResult, type CustomHandlerGetResultDataFunction, type Data, type DeepPartial, type DefaultActionProxy, EN, type Emotions, type FunctionableValue, type GetActionParameters, JP, KK, type Lang, type NovelyInit, type NovelyScreen, type Path, type PluralType, type Pluralization, RU, type Renderer, type RendererInit, type Save, type Stack, type StackHolder, type State, type StateFunction, type Storage, type StorageData, type StorageMeta, type Stored, type Story, type TextContent, type Thenable, type TranslationActions, type TypewriterSpeed, type ValidAction, extendAction, localStorageStorage, novely };
@@ -156,6 +156,7 @@ var Novely = (() => {
156
156
  JP: () => JP,
157
157
  KK: () => KK,
158
158
  RU: () => RU,
159
+ extendAction: () => extendAction,
159
160
  localStorageStorage: () => localStorageStorage,
160
161
  novely: () => novely
161
162
  });
@@ -1857,6 +1858,15 @@ var Novely = (() => {
1857
1858
  };
1858
1859
  };
1859
1860
 
1861
+ // src/extend-actions.ts
1862
+ var extendAction = (base, extension) => {
1863
+ return new Proxy({}, {
1864
+ get(_, key, receiver) {
1865
+ return Reflect.get(key in extension ? extension : base, key, receiver);
1866
+ }
1867
+ });
1868
+ };
1869
+
1860
1870
  // src/translations.ts
1861
1871
  var RU = {
1862
1872
  NewGame: "\u041D\u043E\u0432\u0430\u044F \u0438\u0433\u0440\u0430",