plusui-native-core 0.1.90 → 0.1.92

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.
@@ -18,8 +18,6 @@
18
18
  * browser.canGoBack() - Check if back navigation is possible
19
19
  * browser.canGoForward() - Check if forward navigation is possible
20
20
  * browser.isLoading() - Check if a page is currently loading
21
- * browser.emit(name, payload) - Send a message on a browser feature channel
22
- * browser.on(name, cb) - Listen on a browser feature channel
23
21
  *
24
22
  * Events:
25
23
  * browser.onNavigate(cb) - Fires when navigation occurs (URL change)
@@ -1,5 +1,3 @@
1
- import { plusui } from "@plusui";
2
-
3
1
  export interface BrowserState {
4
2
  url: string;
5
3
  title: string;
@@ -37,10 +35,6 @@ const _loadStartCallbacks: LoadCallback[] = [];
37
35
  const _loadEndCallbacks: LoadCallback[] = [];
38
36
  const _loadErrorCallbacks: ErrorCallback[] = [];
39
37
  let _currentState: BrowserState = { url: '', title: '', canGoBack: false, canGoForward: false, isLoading: false };
40
- let _routes: Record<string, string> = {};
41
- let _currentRoute: string = '/';
42
- const browserFeatureEvents = connect.feature('browser');
43
- const routerFeatureEvents = connect.feature('router');
44
38
 
45
39
  // Setup event listeners from native backend
46
40
  if (typeof window !== 'undefined') {
@@ -67,16 +61,6 @@ if (typeof window !== 'undefined') {
67
61
  }
68
62
 
69
63
  export const browser = {
70
- connect: browserFeatureEvents,
71
-
72
- on: <TData = unknown>(name: string, callback: (payload: TData) => void): (() => void) => {
73
- return browserFeatureEvents.on<TData>(name, callback);
74
- },
75
-
76
- emit: <TIn = Record<string, unknown>>(name: string, payload: TIn): void => {
77
- browserFeatureEvents.emit<TIn>(name, payload);
78
- },
79
-
80
64
  async navigate(url: string): Promise<void> {
81
65
  await invoke('browser.navigate', [url]);
82
66
  },
@@ -174,46 +158,4 @@ export const browser = {
174
158
  }
175
159
  };
176
160
 
177
- export const router = {
178
- connect: routerFeatureEvents,
179
-
180
- on: <TData = unknown>(name: string, callback: (payload: TData) => void): (() => void) => {
181
- return routerFeatureEvents.on<TData>(name, callback);
182
- },
183
-
184
- emit: <TIn = Record<string, unknown>>(name: string, payload: TIn): void => {
185
- routerFeatureEvents.emit<TIn>(name, payload);
186
- },
187
-
188
- setRoutes(routes: Record<string, string>): void {
189
- _routes = routes;
190
- },
191
-
192
- getRoutes(): Record<string, string> {
193
- return { ..._routes };
194
- },
195
-
196
- async push(route: string): Promise<void> {
197
- _currentRoute = route;
198
- const url = _routes[route] || route;
199
- await browser.navigate(url);
200
- },
201
-
202
- async replace(route: string): Promise<void> {
203
- _currentRoute = route;
204
- const url = _routes[route] || route;
205
- await browser.navigate(url);
206
- },
207
-
208
- getCurrentRoute(): string {
209
- return _currentRoute;
210
- },
211
-
212
- async setInitialRoute(route: string): Promise<void> {
213
- _currentRoute = route;
214
- const url = _routes[route] || route;
215
- await browser.navigate(url);
216
- }
217
- };
218
-
219
- export default { browser, router };
161
+ export default browser;
@@ -1,4 +1,3 @@
1
- import { connect } from '../Connection/connect';
2
1
  import type { WindowId } from '../Window/window';
3
2
 
4
3
  // ─── Types ───────────────────────────────────────────────────────────────────
@@ -20,8 +19,6 @@ let _routes: RouteMap = {};
20
19
  let _currentRoutes: Record<string, string> = {}; // windowId → current route
21
20
  const _routeChangeCallbacks: RouteChangeCallback[] = [];
22
21
 
23
- const routerFeatureEvents = connect.feature('router');
24
-
25
22
  // ─── Bridge ──────────────────────────────────────────────────────────────────
26
23
 
27
24
  export function setInvokeFn(fn: (method: string, args?: unknown[]) => Promise<unknown>) {
@@ -52,16 +49,6 @@ if (typeof window !== 'undefined') {
52
49
  // ─── Router API ──────────────────────────────────────────────────────────────
53
50
 
54
51
  export const router = {
55
- connect: routerFeatureEvents,
56
-
57
- on: <TData = unknown>(name: string, callback: (payload: TData) => void): (() => void) => {
58
- return routerFeatureEvents.on<TData>(name, callback);
59
- },
60
-
61
- emit: <TIn = Record<string, unknown>>(name: string, payload: TIn): void => {
62
- routerFeatureEvents.emit<TIn>(name, payload);
63
- },
64
-
65
52
  /**
66
53
  * Define route map — maps route paths to frontend URLs.
67
54
  * Works with any frontend router (React Router, TanStack, Solid Router, etc.)
@@ -1,5 +1,3 @@
1
- import { connect } from '../Connection/connect';
2
-
3
1
  export interface WindowSize {
4
2
  width: number;
5
3
  height: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native-core",
3
- "version": "0.1.90",
3
+ "version": "0.1.92",
4
4
  "description": "PlusUI Core framework (frontend + backend implementations)",
5
5
  "type": "module",
6
6
  "main": "./Core/Features/API/index.ts",