@novely/core 0.46.3 → 0.47.0
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 +5 -0
- package/dist/index.global.js +19 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -251,6 +251,7 @@ declare const getLanguage: (languages: string[]) => string;
|
|
|
251
251
|
|
|
252
252
|
type NovelyAsset = {
|
|
253
253
|
readonly source: string;
|
|
254
|
+
readonly id: string;
|
|
254
255
|
readonly type: 'audio' | 'image';
|
|
255
256
|
};
|
|
256
257
|
type Thenable<T> = T | Promise<T>;
|
|
@@ -652,6 +653,10 @@ type CustomHandlerFunctionParameters<L extends string, S extends State> = {
|
|
|
652
653
|
* Game language
|
|
653
654
|
*/
|
|
654
655
|
lang: L;
|
|
656
|
+
/**
|
|
657
|
+
* Function to replace template content
|
|
658
|
+
*/
|
|
659
|
+
templateReplace: (content: TextContent<L, State>, values?: State) => string;
|
|
655
660
|
};
|
|
656
661
|
type CustomHandlerFunction<L extends string, S extends State> = (parameters: CustomHandlerFunctionParameters<L, S>) => Thenable<void>;
|
|
657
662
|
type CustomHandlerCalling = {
|
package/dist/index.global.js
CHANGED
|
@@ -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, {
|
|
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) {
|
|
@@ -2651,6 +2661,7 @@ var Novely = (() => {
|
|
|
2651
2661
|
loadImageFormatsSupport();
|
|
2652
2662
|
|
|
2653
2663
|
// src/asset.ts
|
|
2664
|
+
var generateRandomId = () => Math.random().toString(36);
|
|
2654
2665
|
var getType = memoize(
|
|
2655
2666
|
(extensions) => {
|
|
2656
2667
|
if (extensions.every((extension) => HOWLER_SUPPORTED_FILE_FORMATS.has(extension))) {
|
|
@@ -2704,7 +2715,8 @@ var Novely = (() => {
|
|
|
2704
2715
|
},
|
|
2705
2716
|
get type() {
|
|
2706
2717
|
return type;
|
|
2707
|
-
}
|
|
2718
|
+
},
|
|
2719
|
+
id: generateRandomId()
|
|
2708
2720
|
};
|
|
2709
2721
|
},
|
|
2710
2722
|
{
|
|
@@ -2717,13 +2729,15 @@ var Novely = (() => {
|
|
|
2717
2729
|
asset.image = (source) => {
|
|
2718
2730
|
return {
|
|
2719
2731
|
type: "image",
|
|
2720
|
-
source
|
|
2732
|
+
source,
|
|
2733
|
+
id: generateRandomId()
|
|
2721
2734
|
};
|
|
2722
2735
|
};
|
|
2723
2736
|
asset.audio = (source) => {
|
|
2724
2737
|
return {
|
|
2725
2738
|
type: "audio",
|
|
2726
|
-
source
|
|
2739
|
+
source,
|
|
2740
|
+
id: generateRandomId()
|
|
2727
2741
|
};
|
|
2728
2742
|
};
|
|
2729
2743
|
return __toCommonJS(src_exports);
|