@novely/core 0.46.2 → 0.46.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/dist/index.d.ts CHANGED
@@ -652,6 +652,10 @@ type CustomHandlerFunctionParameters<L extends string, S extends State> = {
652
652
  * Game language
653
653
  */
654
654
  lang: L;
655
+ /**
656
+ * Function to replace template content
657
+ */
658
+ templateReplace: (content: TextContent<L, State>, values?: State) => string;
655
659
  };
656
660
  type CustomHandlerFunction<L extends string, S extends State> = (parameters: CustomHandlerFunctionParameters<L, S>) => Thenable<void>;
657
661
  type CustomHandlerCalling = {
@@ -999,6 +1003,10 @@ declare const extendAction: <Part0 extends Record<string, (...args: any[]) => Va
999
1003
  * }, 100);
1000
1004
  * ```
1001
1005
  */
1002
- declare const asset: (...variants: string[]) => NovelyAsset;
1006
+ declare const asset: {
1007
+ (...variants: string[]): NovelyAsset;
1008
+ image(source: string): NovelyAsset;
1009
+ audio(source: string): NovelyAsset;
1010
+ };
1003
1011
 
1004
1012
  export { type ActionChoiceChoice, type ActionChoiceChoiceObject, type ActionInputOnInputMeta, type ActionInputSetup, type ActionInputSetupCleanup, type ActionProxy, type AllowedContent, type AudioHandle, type BackgroundImage, type BaseTranslationStrings, type Character, type CharacterAssetSizes, type CharacterHandle, type CharactersData, type ChoiceCheckFunction, type ChoiceCheckFunctionProps, type ChoiceOnSelectFunction, type ChoiceOnSelectFunctionProps, type ChoiceParams, type ConditionCheckFunction, type ConditionParams, type Context, type CoreData, type CustomActionHandle, type CustomHandler, type CustomHandlerFunction, type CustomHandlerFunctionGetFn, type CustomHandlerFunctionParameters, type CustomHandlerGetResult, type CustomHandlerGetResultDataFunction, type CustomHandlerInfo, type Data, type DeepPartial, type DefaultActionProxy, EN, type Emotions, type FunctionParams, type FunctionableValue, type GetActionParameters, type InputHandler, JP, KK, type Lang, type NovelyAsset, type NovelyInit, type NovelyScreen, type NovelyStorage, type Path, type PluralType, type Pluralization, RU, type Renderer, type RendererInit, type RendererInitPreviewReturn, type Save, type Stack, type StackHolder, type State, type StateFunction, type StorageData, type StorageMeta, type Stored, type Story, type TextContent, type Thenable, type TranslationActions, type TypeEssentials, type TypewriterSpeed, type ValidAction, asset, extendAction, localStorageStorage, novely };
@@ -1094,7 +1094,15 @@ var Novely = (() => {
1094
1094
  CUSTOM_ACTION_MAP.set(ctx.id + fn.key, holder);
1095
1095
  return holder;
1096
1096
  };
1097
- var handleCustomAction = (ctx, fn, { lang, state, setMountElement, setClear, remove: renderersRemove, getStack: getStack2 }) => {
1097
+ var handleCustomAction = (ctx, fn, {
1098
+ lang,
1099
+ state,
1100
+ setMountElement,
1101
+ setClear,
1102
+ remove: renderersRemove,
1103
+ getStack: getStack2,
1104
+ templateReplace
1105
+ }) => {
1098
1106
  const holder = getCustomActionHolder(ctx, fn);
1099
1107
  const flags = {
1100
1108
  ...ctx.meta
@@ -1143,6 +1151,7 @@ var Novely = (() => {
1143
1151
  lang,
1144
1152
  state,
1145
1153
  data,
1154
+ templateReplace,
1146
1155
  clear,
1147
1156
  remove,
1148
1157
  rendererContext: ctx,
@@ -2154,7 +2163,8 @@ var Novely = (() => {
2154
2163
  ...ctx.custom(fn),
2155
2164
  state,
2156
2165
  lang,
2157
- getStack: useStack
2166
+ getStack: useStack,
2167
+ templateReplace
2158
2168
  });
2159
2169
  const next2 = () => {
2160
2170
  if (fn.requireUserAction && !ctx.meta.preview) {
@@ -2714,6 +2724,18 @@ var Novely = (() => {
2714
2724
  var asset = (...variants) => {
2715
2725
  return assetPrivate(variants);
2716
2726
  };
2727
+ asset.image = (source) => {
2728
+ return {
2729
+ type: "image",
2730
+ source
2731
+ };
2732
+ };
2733
+ asset.audio = (source) => {
2734
+ return {
2735
+ type: "audio",
2736
+ source
2737
+ };
2738
+ };
2717
2739
  return __toCommonJS(src_exports);
2718
2740
  })();
2719
2741
  //# sourceMappingURL=index.global.js.map