From b9b234d8b93ed191b26c96cf77ae31683f4cbd5e Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 25 Jul 2025 13:30:57 -0700 Subject: [PATCH] chore: cleanup --- packages/core/globals/index.ts | 13 ++----- packages/core/ui/frame/frame-common.ts | 2 +- packages/core/ui/frame/frame-interfaces.ts | 32 ++++++++++++++++- packages/core/ui/frame/index.android.ts | 3 +- packages/core/ui/frame/index.d.ts | 42 +--------------------- packages/core/ui/frame/index.ios.ts | 3 +- 6 files changed, 39 insertions(+), 56 deletions(-) diff --git a/packages/core/globals/index.ts b/packages/core/globals/index.ts index 4114dd873..008613f43 100644 --- a/packages/core/globals/index.ts +++ b/packages/core/globals/index.ts @@ -12,7 +12,7 @@ import * as subtleCryptoImpl from '../wgc/crypto/SubtleCrypto'; console.log('here in globals/index!'); console.log(`typeof __dirname:`, typeof __dirname); -// commonjs builds will have __dirname defined, but es6 modules will not +// commonjs builds will have __dirname defined, but esm builds will not global.__dirname = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname; console.log('global.__dirname', global.__dirname); @@ -196,16 +196,7 @@ global.System = { import(path) { return new Promise((resolve, reject) => { try { - if (__COMMONJS__ && global.require) { - resolve(global.require(path)); - } else { - // Use dynamic import for ESM - import(path) - .then((module) => { - resolve(module.default || module); - }) - .catch(reject); - } + resolve(global.require(path)); } catch (e) { reject(e); } diff --git a/packages/core/ui/frame/frame-common.ts b/packages/core/ui/frame/frame-common.ts index f5f8ea621..33edd741c 100644 --- a/packages/core/ui/frame/frame-common.ts +++ b/packages/core/ui/frame/frame-common.ts @@ -15,7 +15,7 @@ import { SharedTransition } from '../transition/shared-transition'; import { NavigationData } from '.'; export { NavigationType } from './frame-interfaces'; -export type { AndroidActivityCallbacks, AndroidFragmentCallbacks, AndroidFrame, BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, TransitionState, ViewEntry, iOSFrame } from './frame-interfaces'; +export type { AndroidActivityCallbacks, AndroidFragmentCallbacks, AndroidFrame, BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, TransitionState, ViewEntry, iOSFrame, NavigationData } from './frame-interfaces'; function buildEntryFromArgs(arg: any): NavigationEntry { let entry: NavigationEntry; diff --git a/packages/core/ui/frame/frame-interfaces.ts b/packages/core/ui/frame/frame-interfaces.ts index 1d2f5334f..97c9d00bd 100644 --- a/packages/core/ui/frame/frame-interfaces.ts +++ b/packages/core/ui/frame/frame-interfaces.ts @@ -1,7 +1,7 @@ import type { View } from '../core/view'; import type { Page } from '../page'; import type { Transition } from '../transition'; -import type { Observable } from '../../data/observable'; +import type { Observable, EventData } from '../../data/observable'; export enum NavigationType { back, @@ -50,15 +50,45 @@ export interface NavigationTransition { curve?: any; } +/** + * Represents an entry in the back stack of a Frame object. + */ export interface BackstackEntry { entry: NavigationEntry; resolvedPage: Page; + + //@private + /** + * @private + */ navDepth: number; + /** + * @private + */ fragmentTag: string; + /** + * @private + */ fragment?: any; + /** + * @private + */ viewSavedState?: any; + /** + * @private + */ frameId?: number; + /** + * @private + */ recreated?: boolean; + //@endprivate +} + +export interface NavigationData extends EventData { + entry?: BackstackEntry; + fromEntry?: BackstackEntry; + isBack?: boolean; } export interface AndroidFrame extends Observable { diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts index 623eb3e76..0d86871ea 100644 --- a/packages/core/ui/frame/index.android.ts +++ b/packages/core/ui/frame/index.android.ts @@ -1,4 +1,5 @@ -import type { AndroidActivityCallbacks, AndroidFrame as AndroidFrameDefinition, BackstackEntry, NavigationTransition, AndroidFragmentCallbacks } from '.'; +import type { AndroidActivityCallbacks, AndroidFrame as AndroidFrameDefinition, NavigationTransition, AndroidFragmentCallbacks } from '.'; +import type { BackstackEntry } from './frame-interfaces'; import type { Page } from '../page'; import { TransitionState } from './frame-common'; import { Observable } from '../../data/observable'; diff --git a/packages/core/ui/frame/index.d.ts b/packages/core/ui/frame/index.d.ts index a4ec365bb..4ff6a0f83 100644 --- a/packages/core/ui/frame/index.d.ts +++ b/packages/core/ui/frame/index.d.ts @@ -3,15 +3,10 @@ import type { NavigatedData, Page } from '../page'; import type { Observable, EventData } from '../../data/observable'; import type { Property, View } from '../core/view'; import type { Transition } from '../transition'; +import type { BackstackEntry } from './frame-interfaces'; export * from './frame-interfaces'; -export interface NavigationData extends EventData { - entry?: BackstackEntry; - fromEntry?: BackstackEntry; - isBack?: boolean; -} - /** * Represents the logical View unit that is responsible for navigation within an application. * Nested frames are supported, enabling hierarchical navigation scenarios. @@ -455,41 +450,6 @@ export interface NavigationTransition { curve?: any; } -/** - * Represents an entry in the back stack of a Frame object. - */ -export interface BackstackEntry { - entry: NavigationEntry; - resolvedPage: Page; - - //@private - /** - * @private - */ - navDepth: number; - /** - * @private - */ - fragmentTag: string; - /** - * @private - */ - fragment?: any; - /** - * @private - */ - viewSavedState?: any; - /** - * @private - */ - frameId?: number; - /** - * @private - */ - recreated?: boolean; - //@endprivate -} - /** * Represents the Android-specific Frame object, aggregated within the common Frame one. * In Android there are two types of navigation - using new Activity instances or using Fragments within the main Activity. diff --git a/packages/core/ui/frame/index.ios.ts b/packages/core/ui/frame/index.ios.ts index 7c8d28b5d..4c84452bb 100644 --- a/packages/core/ui/frame/index.ios.ts +++ b/packages/core/ui/frame/index.ios.ts @@ -1,6 +1,7 @@ //Types -import { iOSFrame as iOSFrameDefinition, BackstackEntry, NavigationTransition } from '.'; +import { iOSFrame as iOSFrameDefinition, NavigationTransition } from '.'; import { FrameBase, NavigationType } from './frame-common'; +import type { BackstackEntry } from './frame-interfaces'; import type { Page } from '../page'; import { View } from '../core/view'; import { IOSHelper } from '../core/view/view-helper';