@novely/core 0.31.0 → 0.31.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 +4 -7
- package/dist/index.global.js +5 -10
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -276,6 +276,9 @@ type TranslationDescription = {
|
|
|
276
276
|
plural?: Record<string, Pluralization>;
|
|
277
277
|
actions?: TranslationActions;
|
|
278
278
|
};
|
|
279
|
+
type DefaultEmotions<$Characters extends Record<string, Character<Lang>>> = {
|
|
280
|
+
[Character in keyof $Characters]?: (keyof $Characters[Character]['emotions'] & string);
|
|
281
|
+
};
|
|
279
282
|
interface NovelyInit<$Language extends Lang, $Characters extends Record<string, Character<NoInfer<$Language>>>, $State extends State, $Data extends Data, $Actions extends Record<string, (...args: any[]) => ValidAction>> {
|
|
280
283
|
/**
|
|
281
284
|
* An object containing the characters in the game.
|
|
@@ -323,9 +326,7 @@ interface NovelyInit<$Language extends Lang, $Characters extends Record<string,
|
|
|
323
326
|
* })
|
|
324
327
|
* ```
|
|
325
328
|
*/
|
|
326
|
-
defaultEmotions?:
|
|
327
|
-
[Character in keyof NoInfer<$Characters>]?: (keyof NoInfer<$Characters>[Character]['emotions'] & string);
|
|
328
|
-
};
|
|
329
|
+
defaultEmotions?: DefaultEmotions<NoInfer<$Characters>>;
|
|
329
330
|
/**
|
|
330
331
|
* An object that provides access to the game's storage system.
|
|
331
332
|
* @default localStorage // at key `novely-game-storage`
|
|
@@ -699,10 +700,6 @@ declare const novely: <$Language extends string, $Characters extends Record<stri
|
|
|
699
700
|
* ```
|
|
700
701
|
*/
|
|
701
702
|
typeEssentials: TypeEssentials<$Language, $State, $Data, $Characters>;
|
|
702
|
-
/**
|
|
703
|
-
* @deprecated Renamed into `templateReplace`
|
|
704
|
-
*/
|
|
705
|
-
unwrap(content: TextContent<$Language, $Data>): string;
|
|
706
703
|
/**
|
|
707
704
|
* Replaces content inside {{braces}} with using global data
|
|
708
705
|
* @example
|
package/dist/index.global.js
CHANGED
|
@@ -462,7 +462,9 @@ var Novely = (() => {
|
|
|
462
462
|
const next = (i) => queue.slice(i + 1);
|
|
463
463
|
for (const [i, item] of queue.entries()) {
|
|
464
464
|
const [action, ...params] = item;
|
|
465
|
-
|
|
465
|
+
if (isUserRequiredAction(item) && !queue.slice(0, i + 1).some((action2) => isUserRequiredAction(action2))) {
|
|
466
|
+
keep.add(action);
|
|
467
|
+
}
|
|
466
468
|
if (options.skip.has(item) && item !== options.skipPreserve) {
|
|
467
469
|
continue;
|
|
468
470
|
}
|
|
@@ -1149,11 +1151,10 @@ var Novely = (() => {
|
|
|
1149
1151
|
const [path] = stack.value = latest;
|
|
1150
1152
|
renderer.ui.showScreen("game");
|
|
1151
1153
|
const { queue, skip, skipPreserve } = getActionsFromPath(story, path, false);
|
|
1152
|
-
const
|
|
1154
|
+
const { run, keep: { keep, characters: characters2, audio } } = createQueueProcessor(queue, {
|
|
1153
1155
|
skip,
|
|
1154
1156
|
skipPreserve
|
|
1155
1157
|
});
|
|
1156
|
-
const { keep, characters: characters2, audio } = processor.keep;
|
|
1157
1158
|
if (previous) {
|
|
1158
1159
|
const { queue: prevQueue } = getActionsFromPath(story, previous[0], false);
|
|
1159
1160
|
for (let i = prevQueue.length - 1; i > queue.length - 1; i--) {
|
|
@@ -1173,7 +1174,7 @@ var Novely = (() => {
|
|
|
1173
1174
|
});
|
|
1174
1175
|
const lastQueueItem = queue.at(-1) || [];
|
|
1175
1176
|
const lastQueueItemRequiresUserAction = isSkippedDuringRestore(lastQueueItem[0]) || isUserRequiredAction(lastQueueItem);
|
|
1176
|
-
await
|
|
1177
|
+
await run((item) => {
|
|
1177
1178
|
if (!latest)
|
|
1178
1179
|
return;
|
|
1179
1180
|
if (lastQueueItem === item && lastQueueItemRequiresUserAction) {
|
|
@@ -1783,12 +1784,6 @@ var Novely = (() => {
|
|
|
1783
1784
|
* ```
|
|
1784
1785
|
*/
|
|
1785
1786
|
typeEssentials,
|
|
1786
|
-
/**
|
|
1787
|
-
* @deprecated Renamed into `templateReplace`
|
|
1788
|
-
*/
|
|
1789
|
-
unwrap(content) {
|
|
1790
|
-
return templateReplace(content);
|
|
1791
|
-
},
|
|
1792
1787
|
/**
|
|
1793
1788
|
* Replaces content inside {{braces}} with using global data
|
|
1794
1789
|
* @example
|