chizu 0.4.0 → 0.5.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.
- package/README.md +63 -65
- package/dist/chizu.js +6 -6
- package/dist/chizu.umd.cjs +1 -1
- package/dist/{action → src/library/action}/utils.d.ts +3 -3
- package/dist/src/library/boundary/components/mode/index.d.ts +15 -0
- package/dist/src/library/boundary/components/mode/types.d.ts +7 -0
- package/dist/src/library/boundary/components/mode/utils.d.ts +55 -0
- package/dist/src/library/boundary/components/scope/index.d.ts +40 -0
- package/dist/src/library/boundary/components/scope/types.d.ts +20 -0
- package/dist/{boundary → src/library/boundary}/components/scope/utils.d.ts +3 -6
- package/dist/{boundary → src/library/boundary}/index.d.ts +1 -1
- package/dist/src/library/error/index.d.ts +2 -0
- package/dist/{error → src/library/error}/types.d.ts +1 -18
- package/dist/{hooks → src/library/hooks}/index.d.ts +2 -2
- package/dist/{hooks → src/library/hooks}/types.d.ts +1 -17
- package/dist/{hooks → src/library/hooks}/utils.d.ts +25 -25
- package/dist/{index.d.ts → src/library/index.d.ts} +5 -5
- package/dist/{types → src/library/types}/index.d.ts +55 -306
- package/package.json +5 -2
- package/dist/boundary/components/regulators/index.d.ts +0 -14
- package/dist/boundary/components/regulators/types.d.ts +0 -52
- package/dist/boundary/components/regulators/utils.d.ts +0 -21
- package/dist/boundary/components/scope/index.d.ts +0 -82
- package/dist/boundary/components/scope/types.d.ts +0 -28
- package/dist/error/index.d.ts +0 -2
- /package/dist/{action → src/library/action}/index.d.ts +0 -0
- /package/dist/{annotate → src/library/annotate}/index.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/broadcast/index.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/broadcast/types.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/broadcast/utils.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/consumer/components/partition/index.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/consumer/components/partition/types.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/consumer/index.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/consumer/types.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/consumer/utils.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/tasks/index.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/tasks/types.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/components/tasks/utils.d.ts +0 -0
- /package/dist/{boundary → src/library/boundary}/types.d.ts +0 -0
- /package/dist/{error → src/library/error}/utils.d.ts +0 -0
- /package/dist/{resource → src/library/resource}/index.d.ts +0 -0
- /package/dist/{utils → src/library/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/library/utils}/utils.d.ts +0 -0
- /package/dist/{utils.d.ts → src/library/utils.d.ts} +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Props } from './types.ts';
|
|
2
|
-
import { ComponentType, ReactNode } from 'react';
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
export { useScope, getScope } from './utils.ts';
|
|
5
|
-
export type { ScopeEntry, ScopeContext } from './types.ts';
|
|
6
|
-
/**
|
|
7
|
-
* Creates a named scope boundary for multicast actions.
|
|
8
|
-
*
|
|
9
|
-
* Components within a `<Scope>` can dispatch multicast actions to all other
|
|
10
|
-
* components within the same scope boundary. This is useful for creating
|
|
11
|
-
* isolated groups of components that need to communicate without affecting
|
|
12
|
-
* other parts of the application.
|
|
13
|
-
*
|
|
14
|
-
* Multiple scopes can be nested, and each scope name creates its own
|
|
15
|
-
* communication channel. When dispatching, the nearest ancestor scope
|
|
16
|
-
* with the matching name receives the event.
|
|
17
|
-
*
|
|
18
|
-
* Like Broadcast, multicast caches the most recent dispatched value so that
|
|
19
|
-
* late-mounted components can read it via `context.actions.resolution()`.
|
|
20
|
-
*
|
|
21
|
-
* @param props.of - The scope name. Typically a `static Scope` literal co-located with the feature's multicast actions.
|
|
22
|
-
* @param props.children - Components within the scope boundary.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* class UserListActions {
|
|
27
|
-
* static Scope = "UserList" as const;
|
|
28
|
-
* static FilterChanged = Action<Filter>("FilterChanged", Distribution.Multicast);
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
* <Scope of={UserListActions.Scope}>
|
|
32
|
-
* <UserFilter />
|
|
33
|
-
* <UserTable />
|
|
34
|
-
* </Scope>
|
|
35
|
-
*
|
|
36
|
-
* // Dispatch reaches every component in the UserList scope:
|
|
37
|
-
* actions.dispatch(Actions.Multicast.FilterChanged, filter, { scope: Actions.Multicast.Scope });
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* // Nested scopes - each class carries its own scope name
|
|
43
|
-
* <Scope of={AppActions.Scope}>
|
|
44
|
-
* <Header />
|
|
45
|
-
* <Scope of={SidebarActions.Scope}>
|
|
46
|
-
* <SidebarItem />
|
|
47
|
-
* </Scope>
|
|
48
|
-
* <Scope of={ContentActions.Scope}>
|
|
49
|
-
* <ContentItem />
|
|
50
|
-
* </Scope>
|
|
51
|
-
* </Scope>
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
export declare function Scope({ of: name, children }: Props): React.ReactNode;
|
|
55
|
-
/**
|
|
56
|
-
* Higher-order component that wraps a component in a multicast `<Scope>`.
|
|
57
|
-
*
|
|
58
|
-
* Eliminates the need to manually wrap component output in `<Scope of={...}>`,
|
|
59
|
-
* keeping the component body focused on its own rendering logic.
|
|
60
|
-
*
|
|
61
|
-
* @param scope - The scope name. Typically a `static Scope` literal co-located with the feature's multicast actions.
|
|
62
|
-
* @param Component - The component to wrap.
|
|
63
|
-
* @returns A new component that renders the original within a `<Scope>`.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```tsx
|
|
67
|
-
* class MulticastActions {
|
|
68
|
-
* static Scope = "payment-link" as const;
|
|
69
|
-
* static Update = Action<User>("Update", Distribution.Multicast);
|
|
70
|
-
* }
|
|
71
|
-
*
|
|
72
|
-
* export default withScope(MulticastActions.Scope, function Layout(): ReactElement {
|
|
73
|
-
* return (
|
|
74
|
-
* <div>
|
|
75
|
-
* <Sidebar />
|
|
76
|
-
* <Content />
|
|
77
|
-
* </div>
|
|
78
|
-
* );
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export declare function withScope<P extends object>(scope: string, Component: ComponentType<P>): (props: P) => ReactNode;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BroadcastEmitter } from '../broadcast/utils.ts';
|
|
2
|
-
import type * as React from "react";
|
|
3
|
-
/**
|
|
4
|
-
* Props for the Scope component.
|
|
5
|
-
*/
|
|
6
|
-
export type Props = {
|
|
7
|
-
/** The scope name. Typically a `static Scope` literal co-located with the feature's multicast action declarations. */
|
|
8
|
-
of: string;
|
|
9
|
-
/** Children to render within the scope boundary. */
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Represents a single scope in the ancestor chain.
|
|
14
|
-
* Each scope has its own BroadcastEmitter for multicast events and caching.
|
|
15
|
-
*/
|
|
16
|
-
export type ScopeEntry = {
|
|
17
|
-
/** The name of this scope */
|
|
18
|
-
name: string;
|
|
19
|
-
/** BroadcastEmitter for multicast events within this scope (caches last payload per event) */
|
|
20
|
-
emitter: BroadcastEmitter;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* The scope context is a flattened map of all ancestor scopes by name.
|
|
24
|
-
* Each <Scope> merges its entry with the parent's map, building up a
|
|
25
|
-
* complete lookup table for O(1) retrieval.
|
|
26
|
-
* null indicates no scope ancestor.
|
|
27
|
-
*/
|
|
28
|
-
export type ScopeContext = Map<string, ScopeEntry> | null;
|
package/dist/error/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{boundary → src/library/boundary}/components/consumer/components/partition/index.d.ts
RENAMED
|
File without changes
|
/package/dist/{boundary → src/library/boundary}/components/consumer/components/partition/types.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|