@nativedesktop/react 0.1.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.
Files changed (35) hide show
  1. package/dist/generated/rpc.js +13 -0
  2. package/dist/index.js +2089 -0
  3. package/dist/jsx-dev-runtime.js +6 -0
  4. package/dist/jsx-runtime.js +20 -0
  5. package/dist/packages/react/src/css-classes-validate.d.ts +3 -0
  6. package/dist/packages/react/src/dev-react.d.ts +23 -0
  7. package/dist/packages/react/src/dialogs.d.ts +54 -0
  8. package/dist/packages/react/src/errors.d.ts +55 -0
  9. package/dist/packages/react/src/generated/intrinsics.d.ts +1360 -0
  10. package/dist/packages/react/src/generated/protocol.d.ts +140 -0
  11. package/dist/packages/react/src/generated/rpc.d.ts +299 -0
  12. package/dist/packages/react/src/generated/schema-meta.d.ts +29 -0
  13. package/dist/packages/react/src/generated/widget-types.d.ts +2 -0
  14. package/dist/packages/react/src/hmr.d.ts +53 -0
  15. package/dist/packages/react/src/hooks.d.ts +4 -0
  16. package/dist/packages/react/src/host-config.d.ts +72 -0
  17. package/dist/packages/react/src/ids.d.ts +4 -0
  18. package/dist/packages/react/src/index.d.ts +26 -0
  19. package/dist/packages/react/src/jsx-dev-runtime.d.ts +2 -0
  20. package/dist/packages/react/src/jsx-runtime.d.ts +2 -0
  21. package/dist/packages/react/src/metrics.d.ts +12 -0
  22. package/dist/packages/react/src/native-component.d.ts +23 -0
  23. package/dist/packages/react/src/ops.d.ts +20 -0
  24. package/dist/packages/react/src/paths.d.ts +4 -0
  25. package/dist/packages/react/src/platform.d.ts +45 -0
  26. package/dist/packages/react/src/renderer.d.ts +12 -0
  27. package/dist/packages/react/src/shell.d.ts +6 -0
  28. package/dist/packages/react/src/store.d.ts +61 -0
  29. package/dist/packages/react/src/style-validate.d.ts +3 -0
  30. package/dist/packages/react/src/system.d.ts +166 -0
  31. package/dist/packages/react/src/toast.d.ts +19 -0
  32. package/dist/packages/react/src/webview.d.ts +5 -0
  33. package/dist/runtime/ndp-binary.d.ts +42 -0
  34. package/dist/runtime/ndp.d.ts +38 -0
  35. package/package.json +56 -0
@@ -0,0 +1,6 @@
1
+ // src/jsx-dev-runtime.ts
2
+ import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
3
+ export {
4
+ jsxDEV,
5
+ Fragment
6
+ };
@@ -0,0 +1,20 @@
1
+ // src/generated/intrinsics.ts
2
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
+ var styleKeySpec = {
4
+ background: null,
5
+ color: null,
6
+ font: ["fontSize", "fontWeight", "fontFamily"],
7
+ padding: null,
8
+ margin: null,
9
+ hexpand: null,
10
+ vexpand: null,
11
+ halign: null,
12
+ valign: null,
13
+ border: ["borderWidth", "borderColor", "borderRadius"]
14
+ };
15
+ var cssClassSpec = ["suggested-action", "destructive-action", "flat", "raised", "circular", "pill", "linked", "toolbar", "spacer", "title-1", "title-2", "title-3", "title-4", "heading", "document", "body", "caption-heading", "caption", "monospace", "numeric", "accent", "success", "warning", "error", "boxed-list", "boxed-list-separate", "card", "activatable", "navigation-sidebar", "nd-native-sidebar", "selection-mode", "osd", "dimmed", "background", "view", "frame", "compact", "menu", "inline", "large-title", "property", "round", "opaque", "devel", "icon-dropshadow", "lowres-icon"];
16
+ export {
17
+ jsxs,
18
+ jsx,
19
+ Fragment
20
+ };
@@ -0,0 +1,3 @@
1
+ export declare class CssClassError extends Error {
2
+ }
3
+ export declare function validateCssClasses(classes: unknown): void;
@@ -0,0 +1,23 @@
1
+ import * as ReactFirstEval from "react";
2
+ declare global {
3
+ var __nd_react: typeof ReactFirstEval | undefined;
4
+ }
5
+ export declare const useState: typeof ReactFirstEval.useState;
6
+ export declare const useEffect: typeof ReactFirstEval.useEffect;
7
+ export declare const useLayoutEffect: typeof ReactFirstEval.useLayoutEffect;
8
+ export declare const useMemo: typeof ReactFirstEval.useMemo;
9
+ export declare const useCallback: typeof ReactFirstEval.useCallback;
10
+ export declare const useRef: typeof ReactFirstEval.useRef;
11
+ export declare const useContext: typeof ReactFirstEval.useContext;
12
+ export declare const useReducer: typeof ReactFirstEval.useReducer;
13
+ export declare const useTransition: typeof ReactFirstEval.useTransition;
14
+ export declare const useDeferredValue: typeof ReactFirstEval.useDeferredValue;
15
+ export declare const useSyncExternalStore: typeof ReactFirstEval.useSyncExternalStore;
16
+ export declare const useId: typeof ReactFirstEval.useId;
17
+ export declare const use: typeof ReactFirstEval.use;
18
+ export declare const startTransition: typeof ReactFirstEval.startTransition;
19
+ export declare const memo: typeof ReactFirstEval.memo;
20
+ export declare const forwardRef: typeof ReactFirstEval.forwardRef;
21
+ export declare const createContext: typeof ReactFirstEval.createContext;
22
+ export declare const Suspense: typeof ReactFirstEval.Suspense;
23
+ export declare const Fragment: typeof ReactFirstEval.Fragment;
@@ -0,0 +1,54 @@
1
+ import type { NdNodeRef } from "./generated/intrinsics.ts";
2
+ import type { FileFilter } from "./system.ts";
3
+ export type { FileFilter };
4
+ export interface DialogButton {
5
+ id: string;
6
+ label: string;
7
+ style?: "default" | "suggested" | "destructive";
8
+ }
9
+ export interface ShowAlertOptions {
10
+ title: string;
11
+ body?: string;
12
+ buttons: DialogButton[];
13
+ }
14
+ export interface AlertResult {
15
+ buttonId: string;
16
+ }
17
+ export interface OpenFileOptions {
18
+ multiple?: boolean;
19
+ directories?: boolean;
20
+ filters?: FileFilter[];
21
+ }
22
+ export interface OpenFileResult {
23
+ canceled: boolean;
24
+ paths: string[];
25
+ }
26
+ export interface SaveFileOptions {
27
+ suggestedName?: string;
28
+ defaultDir?: string;
29
+ filters?: FileFilter[];
30
+ }
31
+ export interface SaveFileResult {
32
+ canceled: boolean;
33
+ path: string | null;
34
+ }
35
+ export interface ShowAboutOptions {
36
+ appName: string;
37
+ version: string;
38
+ developer?: string;
39
+ website?: string;
40
+ }
41
+ export declare function showAlert(node: NdNodeRef<"window">, options: ShowAlertOptions): Promise<AlertResult>;
42
+ export declare function openFile(node: NdNodeRef<"window">, options?: OpenFileOptions): Promise<OpenFileResult>;
43
+ export declare function saveFile(node: NdNodeRef<"window">, options?: SaveFileOptions): Promise<SaveFileResult>;
44
+ export declare function showAbout(node: NdNodeRef<"window">, options: ShowAboutOptions): void;
45
+ export declare function showTabOverview(node: NdNodeRef<"window">): void;
46
+ export declare function onAlertResult(node: NdNodeRef<"window">, e: {
47
+ data: unknown;
48
+ }): void;
49
+ export declare function onOpenFileResult(node: NdNodeRef<"window">, e: {
50
+ data: unknown;
51
+ }): void;
52
+ export declare function onSaveFileResult(node: NdNodeRef<"window">, e: {
53
+ data: unknown;
54
+ }): void;
@@ -0,0 +1,55 @@
1
+ export type NdErrorKind = "unhandledRejection" | "uncaughtException" | "renderUncaught" | "renderCaught" | "renderRecoverable";
2
+ export interface NdErrorContext {
3
+ kind: NdErrorKind;
4
+ /** True when the process will exit after handlers run. */
5
+ fatal: boolean;
6
+ /** Original thrown/rejected value, verbatim (may not be an Error). */
7
+ raw: unknown;
8
+ /** React component stack; present only for the three render-phase kinds. */
9
+ componentStack?: string;
10
+ }
11
+ export type NdErrorHandler = (error: Error, context: NdErrorContext) => void;
12
+ export interface UnhandledErrorPolicy {
13
+ unhandledRejection?: "report" | "fatal";
14
+ uncaughtException?: "report" | "fatal";
15
+ /** false suppresses the framework's own stderr line (app ships its own
16
+ * logger). Subscribers still fire. Default true. */
17
+ log?: boolean;
18
+ }
19
+ interface ErrorsState {
20
+ policy: UnhandledErrorPolicy;
21
+ handlers: Set<NdErrorHandler>;
22
+ /** Timestamps of admitted non-fatal reports inside the rolling window. */
23
+ stamps: number[];
24
+ suppressedLogged: boolean;
25
+ hintShown: boolean;
26
+ /** Errors already reported as renderUncaught: the follow-on
27
+ * uncaughtException (React rethrows the callback's throw in a setTimeout)
28
+ * must exit without a duplicate report. */
29
+ renderFatal: WeakSet<object>;
30
+ }
31
+ declare global {
32
+ var __nd_errors: ErrorsState | undefined;
33
+ var __nd_errors_installed: boolean | undefined;
34
+ }
35
+ /** Pure resolver, exported for tests. Precedence: explicit policy >
36
+ * ND_FATAL_REJECTIONS=1 env > built-in defaults. */
37
+ export declare function decide(kind: NdErrorKind, p: UnhandledErrorPolicy): "report" | "fatal";
38
+ /** Subscribe to every reported error. Returns an unsubscribe fn. Handlers
39
+ * run in registration order; a handler that itself throws is caught and
40
+ * logged, never escalated. Same HMR caveat as system.ts's app.on*: a
41
+ * module-top-level call re-subscribes a fresh closure each hot re-eval, so
42
+ * register from useMountEffect or a module that runs once. */
43
+ export declare function onUnhandledError(handler: NdErrorHandler): () => void;
44
+ /** App-entry policy override. Merges over the current policy. */
45
+ export declare function setUnhandledErrorPolicy(p: UnhandledErrorPolicy): void;
46
+ /** True when a non-fatal report still fits the rolling window; exported for
47
+ * tests only. Logs the suppression notice once per exhaustion. */
48
+ export declare function admitReport(): boolean;
49
+ /** Called by renderer.ts's createContainer callbacks. Not public API. */
50
+ export declare function reportRenderError(raw: unknown, kind: "renderUncaught" | "renderCaught" | "renderRecoverable", componentStack?: string): void;
51
+ /** Installs the process-level handlers once per process; render() calls this
52
+ * before Ndp.connect() (the wire send no-ops until connected). Guarded on a
53
+ * globalThis flag so a `bun --hot` re-eval never accumulates listeners. */
54
+ export declare function installErrorHandlers(): void;
55
+ export {};