@expressive/react 0.73.1 → 0.74.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.
@@ -1,130 +0,0 @@
1
- import { Pragma, ReactState, ReactState as ReactState$1 } from "./state";
2
- import State$1, { Context, Context as Context$1, Observable, get, ref, set, use } from "@expressive/mvc";
3
- import * as react3 from "react";
4
- import React, { Fragment, FunctionComponent, ReactNode, createElement } from "react";
5
-
6
- //#region src/component.d.ts
7
- type HasProps<T extends ReactState> = { [K in Exclude<keyof T, keyof ReactState>]?: T[K] };
8
- type ComponentProps<T extends ReactState> = HasProps<T> & {
9
- /**
10
- * Callback for newly created instance. Only called once.
11
- * @returns Callback to run when instance is destroyed.
12
- */
13
- is?: (instance: T) => void;
14
- /**
15
- * A fallback react tree to show when suspended.
16
- * If not provided, `fallback` property of the State will be used.
17
- */
18
- fallback?: React.ReactNode;
19
- };
20
- type Props$1<T extends ReactState> = T extends {
21
- render(props: infer P, self: any): any;
22
- } ? ComponentProps<T> & Omit<P, keyof AsComponent$1> : ComponentProps<T> & {
23
- children?: React.ReactNode;
24
- };
25
- /**
26
- * Props which will not conflict with a State's use as a Component.
27
- *
28
- * Built-in properties must be optional, as they will always be omitted.
29
- */
30
- type RenderProps<T extends ReactState> = HasProps<T> & {
31
- is?: never;
32
- get?: never;
33
- set?: never;
34
- };
35
- /** State which is not incompatable as Component in React. */
36
- interface AsComponent$1 extends ReactState {
37
- render?(props: RenderProps<this>, self: this): React.ReactNode;
38
- fallback?: React.ReactNode;
39
- }
40
- interface FC<T extends ReactState, P extends ReactState.Assign<T>> extends FunctionComponent<P & Props$1<T>> {
41
- displayName?: string;
42
- State: ReactState.Extends<T>;
43
- }
44
- declare module './state' {
45
- namespace ReactState {
46
- export { ComponentProps, Props$1 as Props, RenderProps, AsComponent$1 as AsComponent, FC };
47
- }
48
- }
49
- declare class Component extends ReactState {
50
- static contextType: React.Context<Context$1>;
51
- private _props;
52
- get props(): ReactState.ComponentProps<this>;
53
- set props(props: ReactState.ComponentProps<this>);
54
- get context(): Context$1;
55
- set context(context: Context$1);
56
- state: ReactState.Values<this>;
57
- children: ReactNode | ((self: this) => ReactNode);
58
- fallback?: ReactNode;
59
- constructor({
60
- is,
61
- ...props
62
- }: any);
63
- render(): ReactNode;
64
- /** @deprecated This is purely for React JSX compatibility in typescript. */
65
- setState: (state: any, callback?: () => void) => void;
66
- /** @deprecated This is purely for React JSX compatibility in typescript. */
67
- forceUpdate: (callback?: () => void) => void;
68
- }
69
- //#endregion
70
- //#region src/context.d.ts
71
- declare module '@expressive/mvc' {
72
- namespace Context {
73
- function use(create?: true): Context;
74
- function use(create: boolean): Context | null | undefined;
75
- }
76
- }
77
- declare namespace Consumer {
78
- type Props<T extends State$1> = {
79
- /** Type of controller to fetch from context. */for: State$1.Extends<T>;
80
- /**
81
- * Render function, will receive instance of desired controller.
82
- *
83
- * Called every render of parent component.
84
- * Similar to `State.get()`, updates to properties accessed in
85
- * this function will cause a refresh when they change.
86
- */
87
- children: (value: T) => ReactNode | void;
88
- };
89
- }
90
- declare function Consumer<T extends State$1>(props: Consumer.Props<T>): string | number | bigint | boolean | react3.ReactElement<unknown, string | react3.JSXElementConstructor<any>> | Iterable<ReactNode> | react3.ReactPortal | null;
91
- declare namespace Provider {
92
- interface Props<T extends State$1> {
93
- /** State or group of States to provide to descendant Consumers. */
94
- for: Context.Accept<T>;
95
- /**
96
- * Callback to run for each provided State.
97
- */
98
- forEach?: Context.Expect<T>;
99
- /**
100
- * Children to render within this Provider.
101
- */
102
- children?: ReactNode;
103
- /** A fallback tree to show when suspended. */
104
- fallback?: ReactNode;
105
- /**
106
- * A name for this Suspense boundary for instrumentation purposes.
107
- * The name will help identify this boundary in React DevTools.
108
- */
109
- name?: string | undefined;
110
- }
111
- }
112
- declare function Provider<T extends State$1>(props: Provider.Props<T>): ReactNode;
113
- //#endregion
114
- //#region src/index.d.ts
115
- /**
116
- * Augmented State namespace to include ReactState hooks as static methods.
117
- *
118
- * This retroactively adds React support to agnostic State defined
119
- * by component libraries which import `@expressive/mvc` directly.
120
- */
121
- declare module '@expressive/mvc' {
122
- namespace State {
123
- export import as = ReactState.as;
124
- export import get = ReactState.get;
125
- export import use = ReactState.use;
126
- }
127
- }
128
- //#endregion
129
- export { Props$1 as _, ReactState$1 as a, ref as c, Consumer as d, Provider as f, HasProps as g, FC as h, Pragma as i, set as l, Component as m, Fragment as n, createElement as o, AsComponent$1 as p, Observable as r, get as s, Context$1 as t, use as u };
130
- //# sourceMappingURL=index-zVvhW0uD.d.ts.map