@novely/core 0.30.2 → 0.31.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.js CHANGED
@@ -506,7 +506,7 @@ var store = (current, subscribers = /* @__PURE__ */ new Set()) => {
506
506
  return { subscribe, update, set, get };
507
507
  };
508
508
 
509
- // ../../node_modules/.pnpm/@novely+deepmerge@0.0.0/node_modules/@novely/deepmerge/dist/index.js
509
+ // ../deepmerge/dist/index.js
510
510
  var { isArray } = Array;
511
511
  var { hasOwnProperty, propertyIsEnumerable, getOwnPropertySymbols } = Object;
512
512
  var propertyIsOnObject = (object, property) => {
@@ -517,7 +517,9 @@ var propertyIsOnObject = (object, property) => {
517
517
  }
518
518
  };
519
519
  var propertyIsUnsafe = (target, key) => {
520
- return propertyIsOnObject(target, key) && !(hasOwnProperty.call(target, key) && propertyIsEnumerable.call(target, key));
520
+ return propertyIsOnObject(target, key) && // Properties are safe to merge if they don't exist in the target yet,
521
+ !(hasOwnProperty.call(target, key) && // unsafe if they exist up the prototype chain,
522
+ propertyIsEnumerable.call(target, key));
521
523
  };
522
524
  var getEnumerableOwnPropertySymbols = (target) => {
523
525
  if (!getOwnPropertySymbols)
@@ -770,6 +772,9 @@ var novely = ({
770
772
  };
771
773
  const action = new Proxy({}, {
772
774
  get(_, action2) {
775
+ if (action2 in renderer.actions) {
776
+ return renderer.actions[action2];
777
+ }
773
778
  return (...props) => {
774
779
  if (preloadAssets === "blocking") {
775
780
  if (action2 === "showBackground") {
@@ -1017,13 +1022,13 @@ var novely = ({
1017
1022
  }
1018
1023
  return current;
1019
1024
  };
1020
- const exit = (force = false) => {
1025
+ const exit = (force = false, saving = true) => {
1021
1026
  if (interacted > 1 && !force && askBeforeExit) {
1022
1027
  renderer.ui.showExitPrompt();
1023
1028
  return;
1024
1029
  }
1025
1030
  const ctx = renderer.getContext(MAIN_CONTEXT_KEY);
1026
- if (interacted > 0) {
1031
+ if (interacted > 0 && saving) {
1027
1032
  save("auto");
1028
1033
  }
1029
1034
  const stack = useStack(ctx);
@@ -1352,7 +1357,7 @@ var novely = ({
1352
1357
  end({ ctx }) {
1353
1358
  if (ctx.meta.preview)
1354
1359
  return;
1355
- exit(true);
1360
+ exit(true, false);
1356
1361
  },
1357
1362
  input({ ctx, data: data2, forward }, [question, onInput, setup]) {
1358
1363
  ctx.input(
@@ -1519,6 +1524,12 @@ var novely = ({
1519
1524
  });
1520
1525
  return void 0;
1521
1526
  };
1527
+ const typeEssentials = {
1528
+ l: null,
1529
+ s: null,
1530
+ d: null,
1531
+ c: null
1532
+ };
1522
1533
  return {
1523
1534
  /**
1524
1535
  * Function to set game script
@@ -1567,6 +1578,19 @@ var novely = ({
1567
1578
  * ```
1568
1579
  */
1569
1580
  data,
1581
+ /**
1582
+ * Used in combination with type utilities
1583
+ *
1584
+ * @example
1585
+ * ```ts
1586
+ * import type { ConditionParams, StateFunction } from '@novely/core';
1587
+ *
1588
+ * const conditionCheck = (state: StateFunction<ConditionParams<typeof engine.typeEssintials>>) => {
1589
+ * return state.age >= 18;
1590
+ * }
1591
+ * ```
1592
+ */
1593
+ typeEssentials,
1570
1594
  /**
1571
1595
  * @deprecated Renamed into `templateReplace`
1572
1596
  */