vasille-jsx 4.3.0 → 4.3.3
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 +4 -0
- package/lib/components.js +5 -2
- package/lib/internal.js +1 -0
- package/package.json +1 -1
- package/types/components.d.ts +1 -1
- package/types/internal.d.ts +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,10 @@ All of these are supported:
|
|
|
104
104
|
|
|
105
105
|
## Change log
|
|
106
106
|
|
|
107
|
+
### 4.3.0
|
|
108
|
+
|
|
109
|
+
Add new function `safe` which make functions safe, errors are reported automatically.
|
|
110
|
+
|
|
107
111
|
### 4.2.0
|
|
108
112
|
|
|
109
113
|
Add support for inlined conditions in JSX, binary `&&` and ternary `?:` operator.
|
package/lib/components.js
CHANGED
|
@@ -4,8 +4,11 @@ export function Slot({ model, slot, ...options }, ctx, defaultSlot) {
|
|
|
4
4
|
if (model) {
|
|
5
5
|
model(options, ctx);
|
|
6
6
|
}
|
|
7
|
-
else {
|
|
8
|
-
|
|
7
|
+
else if (slot) {
|
|
8
|
+
slot({}, ctx);
|
|
9
|
+
}
|
|
10
|
+
else if (defaultSlot) {
|
|
11
|
+
defaultSlot(ctx);
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
catch (e) {
|
package/lib/internal.js
CHANGED
package/package.json
CHANGED
package/types/components.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface SlotOptions<Node, Element, TagOptions extends object, T extends object
|
|
|
3
3
|
model?: (input: T, ctx: Fragment<Node, Element, TagOptions>) => void;
|
|
4
4
|
slot?: (input: object, ctx: Fragment<Node, Element, TagOptions>) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare function Slot<Node, Element, TagOptions extends object, T extends object = {}>({ model, slot, ...options }: SlotOptions<Node, Element, TagOptions, T> & T, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (
|
|
6
|
+
export declare function Slot<Node, Element, TagOptions extends object, T extends object = {}>({ model, slot, ...options }: SlotOptions<Node, Element, TagOptions, T> & T, ctx: Fragment<Node, Element, TagOptions>, defaultSlot?: (ctx: Fragment<Node, Element, TagOptions>) => void): void;
|
|
7
7
|
interface SwitchOptions<Node, Element, TagOptions extends object> {
|
|
8
8
|
cases: {
|
|
9
9
|
$case: IValue<unknown>;
|
package/types/internal.d.ts
CHANGED
|
@@ -38,4 +38,4 @@ export declare function match(name: string | number | symbol, data?: unknown): a
|
|
|
38
38
|
* 1. `obj.$key = 23` to `set(obj, "$key", 23)`
|
|
39
39
|
* 2. `arr[0] = 23` to `set(arr, 0, 23)`
|
|
40
40
|
*/
|
|
41
|
-
export declare function set(o: object, key: string | symbol | number, value: unknown):
|
|
41
|
+
export declare function set(o: object, key: string | symbol | number, value: unknown): unknown;
|