@momoyu-ink/kit 0.8.0 → 0.8.2

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/lib.cjs CHANGED
@@ -1027,13 +1027,19 @@ function createStackNavigator(options) {
1027
1027
  goBack: () => {
1028
1028
  console.warn("goBack() not implemented yet");
1029
1029
  },
1030
- pushOverlay: (overlay, params) => {
1030
+ hasActiveOverlay: (overlay, id) => {
1031
+ if (id) {
1032
+ return navigationState.overlayStack.some((o) => o.type === overlay && o.id === id);
1033
+ }
1034
+ return navigationState.overlayStack.some((o) => o.type === overlay);
1035
+ },
1036
+ pushOverlay: (overlay, params, _id) => {
1031
1037
  if (!normalizedOverlays[overlay]) {
1032
1038
  console.error(`Navigation Error: Overlay "${overlay}" not found in navigator configuration.`);
1033
1039
  return;
1034
1040
  }
1035
1041
  validateParams("overlay", overlay, normalizedOverlays[overlay], params);
1036
- const id = generateOverlayId();
1042
+ const id = _id ?? generateOverlayId();
1037
1043
  const overlayInfo = { type: overlay, id };
1038
1044
  navigationState.overlayStack.push(overlayInfo);
1039
1045
  if (params !== void 0) {
package/dist/lib.d.mts CHANGED
@@ -424,12 +424,19 @@ interface Navigator<PageName extends string = DefaultPageName, OverlayName exten
424
424
  * Go back to the previous page (not implemented yet)
425
425
  */
426
426
  goBack: () => void;
427
+ /**
428
+ * Check whether an overlay has been pushed, optionally by ID
429
+ * @param overlay Overlay name
430
+ * @param id Optional unique ID to check for specific overlay instance
431
+ */
432
+ hasActiveOverlay: (overlay: OverlayName, id?: string) => boolean;
427
433
  /**
428
434
  * Push an overlay to the overlay stack
429
435
  * @param overlay Overlay name
430
436
  * @param params Parameters to pass to the overlay (optional)
437
+ * @param id Unique ID for the overlay (optional)
431
438
  */
432
- pushOverlay: (overlay: OverlayName, params?: Record<string, any>) => void;
439
+ pushOverlay: (overlay: OverlayName, params?: Record<string, any>, id?: string) => void;
433
440
  /**
434
441
  * Pop the top overlay from the stack
435
442
  */
package/dist/lib.d.ts CHANGED
@@ -424,12 +424,19 @@ interface Navigator<PageName extends string = DefaultPageName, OverlayName exten
424
424
  * Go back to the previous page (not implemented yet)
425
425
  */
426
426
  goBack: () => void;
427
+ /**
428
+ * Check whether an overlay has been pushed, optionally by ID
429
+ * @param overlay Overlay name
430
+ * @param id Optional unique ID to check for specific overlay instance
431
+ */
432
+ hasActiveOverlay: (overlay: OverlayName, id?: string) => boolean;
427
433
  /**
428
434
  * Push an overlay to the overlay stack
429
435
  * @param overlay Overlay name
430
436
  * @param params Parameters to pass to the overlay (optional)
437
+ * @param id Unique ID for the overlay (optional)
431
438
  */
432
- pushOverlay: (overlay: OverlayName, params?: Record<string, any>) => void;
439
+ pushOverlay: (overlay: OverlayName, params?: Record<string, any>, id?: string) => void;
433
440
  /**
434
441
  * Pop the top overlay from the stack
435
442
  */
package/dist/lib.mjs CHANGED
@@ -1015,13 +1015,19 @@ function createStackNavigator(options) {
1015
1015
  goBack: () => {
1016
1016
  console.warn("goBack() not implemented yet");
1017
1017
  },
1018
- pushOverlay: (overlay, params) => {
1018
+ hasActiveOverlay: (overlay, id) => {
1019
+ if (id) {
1020
+ return navigationState.overlayStack.some((o) => o.type === overlay && o.id === id);
1021
+ }
1022
+ return navigationState.overlayStack.some((o) => o.type === overlay);
1023
+ },
1024
+ pushOverlay: (overlay, params, _id) => {
1019
1025
  if (!normalizedOverlays[overlay]) {
1020
1026
  console.error(`Navigation Error: Overlay "${overlay}" not found in navigator configuration.`);
1021
1027
  return;
1022
1028
  }
1023
1029
  validateParams("overlay", overlay, normalizedOverlays[overlay], params);
1024
- const id = generateOverlayId();
1030
+ const id = _id ?? generateOverlayId();
1025
1031
  const overlayInfo = { type: overlay, id };
1026
1032
  navigationState.overlayStack.push(overlayInfo);
1027
1033
  if (params !== void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momoyu-ink/kit",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Software Development Kit of Moyu Visual Novel Engine",
5
5
  "main": "dist/lib.cjs",
6
6
  "module": "dist/lib.mjs",