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