@momoyu-ink/kit 0.11.0 → 0.11.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.
Files changed (3) hide show
  1. package/dist/lib.cjs +18 -10
  2. package/dist/lib.mjs +18 -10
  3. package/package.json +1 -1
package/dist/lib.cjs CHANGED
@@ -1203,20 +1203,28 @@ function createStackNavigator(options) {
1203
1203
  }
1204
1204
  function createStaticNavigation(navigator) {
1205
1205
  return () => {
1206
- const navState = (0, import_valtio2.useSnapshot)(navigator._state);
1207
- const { pages, overlays } = navigator._descriptors;
1208
- const pageDescriptor = pages[navState.currentPage];
1209
- const Page = pageDescriptor?.component || (() => null);
1210
1206
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1211
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageParamsContext.Provider, { value: navState.pageParams[navState.currentPage], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {}) }),
1212
- navState.overlayStack.map((overlay) => {
1213
- const overlayDescriptor = overlays[overlay.type];
1214
- const OverlayComponent = overlayDescriptor?.component || (() => null);
1215
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverlayParamsContext.Provider, { value: navState.overlayParams[overlay.id], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverlayComponent, {}) }, overlay.id);
1216
- })
1207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CurrentPage, { navigator }),
1208
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverlayStack, { navigator })
1217
1209
  ] });
1218
1210
  };
1219
1211
  }
1212
+ function CurrentPage({ navigator }) {
1213
+ const navState = (0, import_valtio2.useSnapshot)(navigator._state);
1214
+ const { currentPage, pageParams } = navState;
1215
+ const pageDescriptor = navigator._descriptors.pages[currentPage];
1216
+ const Page = pageDescriptor?.component || (() => null);
1217
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageParamsContext.Provider, { value: pageParams[currentPage], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Page, {}) });
1218
+ }
1219
+ function OverlayStack({ navigator }) {
1220
+ const navState = (0, import_valtio2.useSnapshot)(navigator._state);
1221
+ const { overlays } = navigator._descriptors;
1222
+ return navState.overlayStack.map((overlay) => {
1223
+ const overlayDescriptor = overlays[overlay.type];
1224
+ const OverlayComponent = overlayDescriptor?.component || (() => null);
1225
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverlayParamsContext.Provider, { value: navState.overlayParams[overlay.id], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OverlayComponent, {}) }, overlay.id);
1226
+ });
1227
+ }
1220
1228
  function getNavigator() {
1221
1229
  if (!globalNavigator) {
1222
1230
  throw new Error("Navigator not initialized. Call createStackNavigator first.");
package/dist/lib.mjs CHANGED
@@ -1197,20 +1197,28 @@ function createStackNavigator(options) {
1197
1197
  }
1198
1198
  function createStaticNavigation(navigator) {
1199
1199
  return () => {
1200
- const navState = useSnapshot2(navigator._state);
1201
- const { pages, overlays } = navigator._descriptors;
1202
- const pageDescriptor = pages[navState.currentPage];
1203
- const Page = pageDescriptor?.component || (() => null);
1204
1200
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1205
- /* @__PURE__ */ jsx(PageParamsContext.Provider, { value: navState.pageParams[navState.currentPage], children: /* @__PURE__ */ jsx(Page, {}) }),
1206
- navState.overlayStack.map((overlay) => {
1207
- const overlayDescriptor = overlays[overlay.type];
1208
- const OverlayComponent = overlayDescriptor?.component || (() => null);
1209
- return /* @__PURE__ */ jsx(OverlayParamsContext.Provider, { value: navState.overlayParams[overlay.id], children: /* @__PURE__ */ jsx(OverlayComponent, {}) }, overlay.id);
1210
- })
1201
+ /* @__PURE__ */ jsx(CurrentPage, { navigator }),
1202
+ /* @__PURE__ */ jsx(OverlayStack, { navigator })
1211
1203
  ] });
1212
1204
  };
1213
1205
  }
1206
+ function CurrentPage({ navigator }) {
1207
+ const navState = useSnapshot2(navigator._state);
1208
+ const { currentPage, pageParams } = navState;
1209
+ const pageDescriptor = navigator._descriptors.pages[currentPage];
1210
+ const Page = pageDescriptor?.component || (() => null);
1211
+ return /* @__PURE__ */ jsx(PageParamsContext.Provider, { value: pageParams[currentPage], children: /* @__PURE__ */ jsx(Page, {}) });
1212
+ }
1213
+ function OverlayStack({ navigator }) {
1214
+ const navState = useSnapshot2(navigator._state);
1215
+ const { overlays } = navigator._descriptors;
1216
+ return navState.overlayStack.map((overlay) => {
1217
+ const overlayDescriptor = overlays[overlay.type];
1218
+ const OverlayComponent = overlayDescriptor?.component || (() => null);
1219
+ return /* @__PURE__ */ jsx(OverlayParamsContext.Provider, { value: navState.overlayParams[overlay.id], children: /* @__PURE__ */ jsx(OverlayComponent, {}) }, overlay.id);
1220
+ });
1221
+ }
1214
1222
  function getNavigator() {
1215
1223
  if (!globalNavigator) {
1216
1224
  throw new Error("Navigator not initialized. Call createStackNavigator first.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momoyu-ink/kit",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Software Development Kit of Moyu Visual Novel Engine",
5
5
  "main": "dist/lib.cjs",
6
6
  "module": "dist/lib.mjs",