kiss-for-react 2.0.6 → 2.0.7

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/lib/cjs/Evt.js CHANGED
@@ -47,8 +47,7 @@ exports.EvtState = exports.Evt = void 0;
47
47
  * the same as the previous one. Reading `value` doesn't spend the event.
48
48
  *
49
49
  * The event object itself is immutable: the store keeps which events were spent (see
50
- * `store.isEventSpent`). So the state stays immutable, and two stores that share the same
51
- * state (in two tests, for example) each spend the event on their own.
50
+ * `store.isEventSpent`). So consuming an event does not change any object in the state.
52
51
  *
53
52
  * Each event is handled by one component only: the first one whose effect runs. For two
54
53
  * components to react, create two events in the state. Or use `EvtState`, when it's fine to
package/lib/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OptimisticSyncWithPush = exports.OptimisticSync = exports.OptimisticCommand = exports.UserException = exports.TimeoutException = exports.AbortDispatchException = exports.StoreException = exports.useDispatcher = exports.useDispatchWhen = exports.useDispatchSync = exports.useDispatchAndWaitAll = exports.useDispatchAndWait = exports.useDispatchAll = exports.useDispatch = exports.useLayoutEvent = exports.useEvent = exports.EvtState = exports.Evt = exports.useConfiguration = exports.useEnvironment = exports.useIsOnline = exports.useIsFocused = exports.useSuspense = exports.useClearExceptionFor = exports.useExceptionFor = exports.useIsFailed = exports.useIsWaiting = exports.useIsStoreReady = exports.StoreSlice = exports.StoreProvider = exports.useObject = exports.useSelector = exports.useSelect = exports.useAllState = exports.useStoreEffect = exports.useStore = exports.createStore = exports.Store = exports.ActionStatus = exports.UserExceptionAction = exports.MergeServerStateAction = exports.KissAction = exports.ProcessPersistence = exports.ClassPersistor = exports.UpdateStateAction = exports.PersistAction = exports.PersistException = exports.PersistorDummy = exports.PersistorPrinterDecorator = exports.Persistor = void 0;
4
- exports.Pages = exports.LoadPages = exports.Poll = exports.ServerPush = void 0;
3
+ exports.OptimisticSync = exports.OptimisticCommand = exports.UserException = exports.TimeoutException = exports.AbortDispatchException = exports.StoreException = exports.useDispatcher = exports.useDispatchWhen = exports.useDispatchSync = exports.useDispatchAndWaitAll = exports.useDispatchAndWait = exports.useDispatchAll = exports.useDispatch = exports.useLayoutEvent = exports.useEvent = exports.EvtState = exports.Evt = exports.useConfiguration = exports.useEnvironment = exports.useIsOnline = exports.useIsFocused = exports.useSuspense = exports.useClearExceptionFor = exports.useExceptionFor = exports.useIsFailed = exports.useIsWaiting = exports.useIsStoreReady = exports.StoreSlice = exports.StoreProvider = exports.useObject = exports.useSelector = exports.useSelect = exports.useAllState = exports.useStoreEffect = exports.useStore = exports.createStore = exports.Store = exports.ActionStatus = exports.UserExceptionAction = exports.MergeServerStateAction = exports.KissAction = exports.ProcessPersistence = exports.ClassPersistor = exports.UpdateStateAction = exports.PersistAction = exports.PersistException = exports.PersistorDummy = exports.PersistorPrinterDecorator = exports.Persistor = exports.stateClass = void 0;
4
+ exports.Pages = exports.LoadPages = exports.Poll = exports.ServerPush = exports.OptimisticSyncWithPush = void 0;
5
5
  const Persistor_1 = require("./Persistor");
6
6
  Object.defineProperty(exports, "PersistAction", { enumerable: true, get: function () { return Persistor_1.PersistAction; } });
7
7
  Object.defineProperty(exports, "PersistException", { enumerable: true, get: function () { return Persistor_1.PersistException; } });
@@ -10,6 +10,8 @@ Object.defineProperty(exports, "PersistorDummy", { enumerable: true, get: functi
10
10
  Object.defineProperty(exports, "PersistorPrinterDecorator", { enumerable: true, get: function () { return Persistor_1.PersistorPrinterDecorator; } });
11
11
  const ClassPersistor_1 = require("./ClassPersistor");
12
12
  Object.defineProperty(exports, "ClassPersistor", { enumerable: true, get: function () { return ClassPersistor_1.ClassPersistor; } });
13
+ var stateClass_1 = require("./stateClass");
14
+ Object.defineProperty(exports, "stateClass", { enumerable: true, get: function () { return stateClass_1.stateClass; } });
13
15
  const ProcessPersistence_1 = require("./ProcessPersistence");
14
16
  Object.defineProperty(exports, "ProcessPersistence", { enumerable: true, get: function () { return ProcessPersistence_1.ProcessPersistence; } });
15
17
  const KissAction_1 = require("./KissAction");
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stateClass = stateClass;
4
+ /**
5
+ * Optional class decorator that declares that a class belongs to application state.
6
+ *
7
+ * Marking each state class makes its purpose visible to readers, AI agents, and tools
8
+ * without having to find the store that uses it. The Kiss ESLint plugin recognizes
9
+ * annotated classes and checks them even when no store uses them yet. Automatic state
10
+ * class detection remains available without this decorator.
11
+ *
12
+ * The optional `kiss-for-react/missing-state-class` ESLint rule (off by default) requires
13
+ * this decorator on detected state classes, including nested classes. Enable TypeScript
14
+ * type information in ESLint to detect state classes across files.
15
+ *
16
+ * This decorator does not change the class, freeze objects, or add runtime metadata.
17
+ * It supports modern TypeScript class decorators and legacy `experimentalDecorators`.
18
+ * Your application's compiler must support decorator syntax. Applications that do not
19
+ * use this decorator need no decorator configuration.
20
+ * With TypeScript 5 or later, omit `experimentalDecorators` (or use `false`) for modern
21
+ * decorators. For the legacy format, set `compilerOptions.experimentalDecorators: true`
22
+ * in `tsconfig.json`. Babel or SWC must also be configured to accept the chosen decorator
23
+ * format if they compile the application. ESLint's `projectService` is a separate setting.
24
+ * The linter README's "Configuring decorators" section gives a configuration example.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * @stateClass
29
+ * class User {
30
+ * constructor(public readonly name: string) {}
31
+ * }
32
+ * ```
33
+ */
34
+ function stateClass(_target, _context) {
35
+ // A declaration for readers and lint tools; preserve the original class.
36
+ }
@@ -44,8 +44,7 @@
44
44
  * the same as the previous one. Reading `value` doesn't spend the event.
45
45
  *
46
46
  * The event object itself is immutable: the store keeps which events were spent (see
47
- * `store.isEventSpent`). So the state stays immutable, and two stores that share the same
48
- * state (in two tests, for example) each spend the event on their own.
47
+ * `store.isEventSpent`). So consuming an event does not change any object in the state.
49
48
  *
50
49
  * Each event is handled by one component only: the first one whose effect runs. For two
51
50
  * components to react, create two events in the state. Or use `EvtState`, when it's fine to
@@ -1 +1 @@
1
- {"version":3,"file":"Evt.d.ts","sourceRoot":"","sources":["../../../src/Evt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,qBAAa,GAAG,CAAC,CAAC,GAAG,IAAI;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAS9B;;;OAGG;gBACS,KAAK,CAAC,EAAE,CAAC;IAKrB;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IAKhC,QAAQ,IAAI,MAAM;CAGnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,QAAQ,CAAC,CAAC,GAAG,IAAI;IAE5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAS9B,uGAAuG;gBAC3F,KAAK,CAAC,EAAE,CAAC;IAKrB,uFAAuF;IACvF,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC;IAKrC,QAAQ,IAAI,MAAM;CAGnB"}
1
+ {"version":3,"file":"Evt.d.ts","sourceRoot":"","sources":["../../../src/Evt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBAAa,GAAG,CAAC,CAAC,GAAG,IAAI;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAS9B;;;OAGG;gBACS,KAAK,CAAC,EAAE,CAAC;IAKrB;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IAKhC,QAAQ,IAAI,MAAM;CAGnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,QAAQ,CAAC,CAAC,GAAG,IAAI;IAE5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAS9B,uGAAuG;gBAC3F,KAAK,CAAC,EAAE,CAAC;IAKrB,uFAAuF;IACvF,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC;IAKrC,QAAQ,IAAI,MAAM;CAGnB"}
@@ -1,5 +1,6 @@
1
1
  import { PersistAction, PersistException, Persistor, PersistorDummy, PersistorPrinterDecorator } from './Persistor';
2
2
  import { ClassPersistor } from './ClassPersistor';
3
+ export { stateClass } from './stateClass';
3
4
  import { ProcessPersistence } from './ProcessPersistence';
4
5
  import { ActionStatus, AsyncReducer, AsyncReducerResult, OptimisticCommand, OptimisticSync, OptimisticSyncWithPush, PushMetadata, ServerPush, KissAction, MergeServerStateAction, Poll, UserExceptionAction, ReduxReducer, Retry, RetryOptions, UnlimitedRetryCheckInternet, SyncReducer, UpdateStateAction, StatusOptions } from './KissAction';
5
6
  import { LoadPages, PageDirection, Pages, PagesToLoad } from './LoadPages';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,yBAAyB,EAAG,MAAM,aAAa,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,sBAAsB,EACtB,IAAI,EACJ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EAAE,qBAAqB,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EACnQ,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAC1I,cAAc,EAAE,gBAAgB,EAChC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EACvC,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EACvH,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,2BAA2B,EACrI,IAAI,EACJ,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,GAC7C,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Optional class decorator that declares that a class belongs to application state.
3
+ *
4
+ * Marking each state class makes its purpose visible to readers, AI agents, and tools
5
+ * without having to find the store that uses it. The Kiss ESLint plugin recognizes
6
+ * annotated classes and checks them even when no store uses them yet. Automatic state
7
+ * class detection remains available without this decorator.
8
+ *
9
+ * The optional `kiss-for-react/missing-state-class` ESLint rule (off by default) requires
10
+ * this decorator on detected state classes, including nested classes. Enable TypeScript
11
+ * type information in ESLint to detect state classes across files.
12
+ *
13
+ * This decorator does not change the class, freeze objects, or add runtime metadata.
14
+ * It supports modern TypeScript class decorators and legacy `experimentalDecorators`.
15
+ * Your application's compiler must support decorator syntax. Applications that do not
16
+ * use this decorator need no decorator configuration.
17
+ * With TypeScript 5 or later, omit `experimentalDecorators` (or use `false`) for modern
18
+ * decorators. For the legacy format, set `compilerOptions.experimentalDecorators: true`
19
+ * in `tsconfig.json`. Babel or SWC must also be configured to accept the chosen decorator
20
+ * format if they compile the application. ESLint's `projectService` is a separate setting.
21
+ * The linter README's "Configuring decorators" section gives a configuration example.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * @stateClass
26
+ * class User {
27
+ * constructor(public readonly name: string) {}
28
+ * }
29
+ * ```
30
+ */
31
+ export declare function stateClass(_target: abstract new (...args: any[]) => any, _context?: unknown): void;
32
+ //# sourceMappingURL=stateClass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateClass.d.ts","sourceRoot":"","sources":["../../../src/stateClass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAElG"}
package/lib/esm/Evt.mjs CHANGED
@@ -44,8 +44,7 @@
44
44
  * the same as the previous one. Reading `value` doesn't spend the event.
45
45
  *
46
46
  * The event object itself is immutable: the store keeps which events were spent (see
47
- * `store.isEventSpent`). So the state stays immutable, and two stores that share the same
48
- * state (in two tests, for example) each spend the event on their own.
47
+ * `store.isEventSpent`). So consuming an event does not change any object in the state.
49
48
  *
50
49
  * Each event is handled by one component only: the first one whose effect runs. For two
51
50
  * components to react, create two events in the state. Or use `EvtState`, when it's fine to
package/lib/esm/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { PersistAction, PersistException, Persistor, PersistorDummy, PersistorPrinterDecorator, } from './Persistor.mjs';
2
2
  import { ClassPersistor } from './ClassPersistor.mjs';
3
+ export { stateClass } from './stateClass.mjs';
3
4
  import { ProcessPersistence } from './ProcessPersistence.mjs';
4
5
  import { ActionStatus, OptimisticCommand, OptimisticSync, OptimisticSyncWithPush, ServerPush, KissAction, MergeServerStateAction, Poll, UserExceptionAction, UpdateStateAction, } from './KissAction.mjs';
5
6
  import { LoadPages, Pages } from './LoadPages.mjs';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Optional class decorator that declares that a class belongs to application state.
3
+ *
4
+ * Marking each state class makes its purpose visible to readers, AI agents, and tools
5
+ * without having to find the store that uses it. The Kiss ESLint plugin recognizes
6
+ * annotated classes and checks them even when no store uses them yet. Automatic state
7
+ * class detection remains available without this decorator.
8
+ *
9
+ * The optional `kiss-for-react/missing-state-class` ESLint rule (off by default) requires
10
+ * this decorator on detected state classes, including nested classes. Enable TypeScript
11
+ * type information in ESLint to detect state classes across files.
12
+ *
13
+ * This decorator does not change the class, freeze objects, or add runtime metadata.
14
+ * It supports modern TypeScript class decorators and legacy `experimentalDecorators`.
15
+ * Your application's compiler must support decorator syntax. Applications that do not
16
+ * use this decorator need no decorator configuration.
17
+ * With TypeScript 5 or later, omit `experimentalDecorators` (or use `false`) for modern
18
+ * decorators. For the legacy format, set `compilerOptions.experimentalDecorators: true`
19
+ * in `tsconfig.json`. Babel or SWC must also be configured to accept the chosen decorator
20
+ * format if they compile the application. ESLint's `projectService` is a separate setting.
21
+ * The linter README's "Configuring decorators" section gives a configuration example.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * @stateClass
26
+ * class User {
27
+ * constructor(public readonly name: string) {}
28
+ * }
29
+ * ```
30
+ */
31
+ export function stateClass(_target, _context) {
32
+ // A declaration for readers and lint tools; preserve the original class.
33
+ }
@@ -44,8 +44,7 @@
44
44
  * the same as the previous one. Reading `value` doesn't spend the event.
45
45
  *
46
46
  * The event object itself is immutable: the store keeps which events were spent (see
47
- * `store.isEventSpent`). So the state stays immutable, and two stores that share the same
48
- * state (in two tests, for example) each spend the event on their own.
47
+ * `store.isEventSpent`). So consuming an event does not change any object in the state.
49
48
  *
50
49
  * Each event is handled by one component only: the first one whose effect runs. For two
51
50
  * components to react, create two events in the state. Or use `EvtState`, when it's fine to
@@ -1 +1 @@
1
- {"version":3,"file":"Evt.d.ts","sourceRoot":"","sources":["../../../src/Evt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAS9B,uGAAuG;gBAC3F,KAAK,CAAC,EAAE,CAAC;IAKrB,uFAAuF;IACvF,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC;IAKrC,QAAQ,IAAI,MAAM;CAGnB"}
@@ -1,5 +1,6 @@
1
1
  import { PersistAction, PersistException, Persistor, PersistorDummy, PersistorPrinterDecorator } from './Persistor';
2
2
  import { ClassPersistor } from './ClassPersistor';
3
+ export { stateClass } from './stateClass';
3
4
  import { ProcessPersistence } from './ProcessPersistence';
4
5
  import { ActionStatus, AsyncReducer, AsyncReducerResult, OptimisticCommand, OptimisticSync, OptimisticSyncWithPush, PushMetadata, ServerPush, KissAction, MergeServerStateAction, Poll, UserExceptionAction, ReduxReducer, Retry, RetryOptions, UnlimitedRetryCheckInternet, SyncReducer, UpdateStateAction, StatusOptions } from './KissAction';
5
6
  import { LoadPages, PageDirection, Pages, PagesToLoad } from './LoadPages';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,yBAAyB,EAAG,MAAM,aAAa,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,sBAAsB,EACtB,IAAI,EACJ,mBAAmB,EACnB,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,iBAAiB,EACjB,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAA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Q,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAC1I,cAAc,EAAE,gBAAgB,EAChC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EACvC,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EACvH,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,2BAA2B,EACrI,IAAI,EACJ,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,GAC7C,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Optional class decorator that declares that a class belongs to application state.
3
+ *
4
+ * Marking each state class makes its purpose visible to readers, AI agents, and tools
5
+ * without having to find the store that uses it. The Kiss ESLint plugin recognizes
6
+ * annotated classes and checks them even when no store uses them yet. Automatic state
7
+ * class detection remains available without this decorator.
8
+ *
9
+ * The optional `kiss-for-react/missing-state-class` ESLint rule (off by default) requires
10
+ * this decorator on detected state classes, including nested classes. Enable TypeScript
11
+ * type information in ESLint to detect state classes across files.
12
+ *
13
+ * This decorator does not change the class, freeze objects, or add runtime metadata.
14
+ * It supports modern TypeScript class decorators and legacy `experimentalDecorators`.
15
+ * Your application's compiler must support decorator syntax. Applications that do not
16
+ * use this decorator need no decorator configuration.
17
+ * With TypeScript 5 or later, omit `experimentalDecorators` (or use `false`) for modern
18
+ * decorators. For the legacy format, set `compilerOptions.experimentalDecorators: true`
19
+ * in `tsconfig.json`. Babel or SWC must also be configured to accept the chosen decorator
20
+ * format if they compile the application. ESLint's `projectService` is a separate setting.
21
+ * The linter README's "Configuring decorators" section gives a configuration example.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * @stateClass
26
+ * class User {
27
+ * constructor(public readonly name: string) {}
28
+ * }
29
+ * ```
30
+ */
31
+ export declare function stateClass(_target: abstract new (...args: any[]) => any, _context?: unknown): void;
32
+ //# sourceMappingURL=stateClass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateClass.d.ts","sourceRoot":"","sources":["../../../src/stateClass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAElG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiss-for-react",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Kiss state management, launched May 2025. Visit kissforreact.org for detailed docs and plenty of examples.",
5
5
  "exports": {
6
6
  ".": {
@@ -89,7 +89,7 @@
89
89
  "@types/react-dom": "^19.3.0",
90
90
  "@types/react-test-renderer": "^19.3.0",
91
91
  "@types/use-sync-external-store": "^1.7.0",
92
- "easy-bdd-tool-jest": "^1.1.0",
92
+ "easy-bdd-tool-jest": "^1.3.0",
93
93
  "eslint": "^10.13.0",
94
94
  "eslint-plugin-react-hooks": "^7.1.1",
95
95
  "jest": "^30.5.2",