Skip to content

Commit

Permalink
Improvements for the @signal decorator:
Browse files Browse the repository at this point in the history
- add the ability to finalize `@signal` fields without a class decorator by defining a `@signal #finalize` field after all fields are defined
- refactor `@signal` on getters/setters to work without a class decorator (add support for `#private` getters/setters, but now requires the `@signal` decorator to be placed on both the getter and the setter, otherwise it won't work and an error will be shown in console)
- add support for public and `#private` auto accessors
  • Loading branch information
trusktr committed Sep 25, 2024
1 parent bfab514 commit 505c0c0
Show file tree
Hide file tree
Showing 17 changed files with 676 additions and 363 deletions.
2 changes: 1 addition & 1 deletion dist/decorators/reactive.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 5 additions & 18 deletions dist/decorators/reactive.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/decorators/reactive.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 3 additions & 19 deletions dist/decorators/signal.d.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
import type { PropKey, PropSpec } from './types.js';
/**
* Provides a key for accessing internal APIs. If any other module tries to get
* this, an error will be thrown, and signal and reactive decorators will not
* work.
*/
export declare function getKey(): symbol;
/**
* This function provides propsToSignalify to only one external module
* (reactive.ts). The purpose of this is to keep the API private for reactive.ts
* only, otherwise an error will be thrown that breaks signal/reactive
* functionality.
*/
export declare function getPropsToSignalify(key: symbol): Map<PropKey, PropSpec>;
/**
* Only the module that first gets the key can call this function (it should be
* reactive.ts)
*/
export declare function resetPropsToSignalify(key: symbol): void;
export declare let __propsToSignalify: Map<PropKey, PropSpec>;
export declare function __resetPropsToSignalify(): void;
/**
* @decorator
* Decorate properties of a class with `@signal` to back them with Solid
Expand Down Expand Up @@ -47,5 +31,5 @@ export declare function resetPropsToSignalify(key: symbol): void;
* })
* ```
*/
export declare function signal(_: unknown, context: ClassFieldDecoratorContext | ClassGetterDecoratorContext | ClassSetterDecoratorContext): any;
export declare function signal(value: unknown, context: ClassFieldDecoratorContext | ClassGetterDecoratorContext | ClassSetterDecoratorContext | ClassAccessorDecoratorContext): any;
//# sourceMappingURL=signal.d.ts.map
2 changes: 1 addition & 1 deletion dist/decorators/signal.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 505c0c0

Please sign in to comment.