@e280/sly 0.2.0-22 → 0.2.0-24
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/package.json +1 -1
- package/s/view/types.ts +2 -2
- package/s/view/utils/contextualize.ts +6 -6
- package/x/index.html +1 -1
- package/x/view/types.d.ts +1 -1
- package/x/view/utils/contextualize.d.ts +8 -3
package/package.json
CHANGED
package/s/view/types.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import {TemplateResult} from "lit"
|
|
3
|
-
import {Constructor
|
|
3
|
+
import {Constructor} from "@e280/stz"
|
|
4
4
|
import {DirectiveResult} from "lit/directive.js"
|
|
5
5
|
|
|
6
6
|
import {Use} from "../base/use.js"
|
|
7
|
-
import {ViewChain} from "./utils/parts/chain.js"
|
|
8
7
|
import {BaseElement} from "../base/element.js"
|
|
8
|
+
import {ViewChain} from "./utils/parts/chain.js"
|
|
9
9
|
|
|
10
10
|
export type Content = TemplateResult | DirectiveResult | HTMLElement | string | null | undefined | void | Content[]
|
|
11
11
|
export type AttrValue = string | boolean | number | undefined | null | void
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {DropFirst, ob} from "@e280/stz"
|
|
3
3
|
import {ComponentClass, View, ViewProps} from "../types.js"
|
|
4
4
|
|
|
5
|
-
export function contextualizeView<C, V extends View<any
|
|
5
|
+
export function contextualizeView<C, V extends View<any>>(
|
|
6
6
|
context: C,
|
|
7
7
|
view: V,
|
|
8
8
|
): View<DropFirst<ViewProps<V>>> {
|
|
9
9
|
return view.transmute((...p: any[]) => [context, ...p]) as any
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function contextualizeViews<C, Vs extends Record<string, View<any
|
|
12
|
+
export function contextualizeViews<C, Vs extends Record<string, View<any>>>(
|
|
13
13
|
context: C,
|
|
14
14
|
views: Vs,
|
|
15
15
|
): {[K in keyof Vs]: View<DropFirst<ViewProps<Vs[K]>>>} {
|
|
@@ -36,10 +36,10 @@ export function contextualizeComponents<
|
|
|
36
36
|
context = context
|
|
37
37
|
static view = contextualizeView(context, super.view) as any
|
|
38
38
|
}) as any as {
|
|
39
|
-
[K in keyof Cs]:
|
|
40
|
-
Cs[K]
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
[K in keyof Cs]: {
|
|
40
|
+
view: View<DropFirst<ViewProps<Cs[K]["view"]>>>
|
|
41
|
+
new(): InstanceType<{context: C} & Cs[K]>
|
|
42
|
+
} & Cs[K]
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
package/x/index.html
CHANGED
|
@@ -131,7 +131,7 @@ body {
|
|
|
131
131
|
<img class=icon alt="" src="/assets/favicon.png"/>
|
|
132
132
|
<h1>sly testing page</h1>
|
|
133
133
|
<p><a href="https://github.com/e280/sly">github.com/e280/sly</a></p>
|
|
134
|
-
<p class=lil>v0.2.0-
|
|
134
|
+
<p class=lil>v0.2.0-24</p>
|
|
135
135
|
|
|
136
136
|
<fastcount-element></fastcount-element>
|
|
137
137
|
<counter-component start=280 step=2>component</counter-component>
|
package/x/view/types.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { TemplateResult } from "lit";
|
|
|
2
2
|
import { Constructor } from "@e280/stz";
|
|
3
3
|
import { DirectiveResult } from "lit/directive.js";
|
|
4
4
|
import { Use } from "../base/use.js";
|
|
5
|
-
import { ViewChain } from "./utils/parts/chain.js";
|
|
6
5
|
import { BaseElement } from "../base/element.js";
|
|
6
|
+
import { ViewChain } from "./utils/parts/chain.js";
|
|
7
7
|
export type Content = TemplateResult | DirectiveResult | HTMLElement | string | null | undefined | void | Content[];
|
|
8
8
|
export type AttrValue = string | boolean | number | undefined | null | void;
|
|
9
9
|
export type ViewFn<Props extends any[]> = ((use: Use) => (...props: Props) => Content);
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { DropFirst } from "@e280/stz";
|
|
2
2
|
import { ComponentClass, View, ViewProps } from "../types.js";
|
|
3
|
-
export declare function contextualizeView<C, V extends View<any
|
|
4
|
-
export declare function contextualizeViews<C, Vs extends Record<string, View<any
|
|
3
|
+
export declare function contextualizeView<C, V extends View<any>>(context: C, view: V): View<DropFirst<ViewProps<V>>>;
|
|
4
|
+
export declare function contextualizeViews<C, Vs extends Record<string, View<any>>>(context: C, views: Vs): {
|
|
5
5
|
[K in keyof Vs]: View<DropFirst<ViewProps<Vs[K]>>>;
|
|
6
6
|
};
|
|
7
7
|
export declare function getViews<Cs extends Record<string, ComponentClass<any, any>>>(components: Cs): { [K in keyof Cs]: View<DropFirst<ViewProps<Cs[K]["view"]>>>; };
|
|
8
|
-
export declare function contextualizeComponents<C, Cs extends Record<string, ComponentClass<any, any>>>(context: C, originalComponents: Cs): { [K in keyof Cs]:
|
|
8
|
+
export declare function contextualizeComponents<C, Cs extends Record<string, ComponentClass<any, any>>>(context: C, originalComponents: Cs): { [K in keyof Cs]: {
|
|
9
|
+
view: View<DropFirst<ViewProps<Cs[K]["view"]>>>;
|
|
10
|
+
new (): InstanceType<{
|
|
11
|
+
context: C;
|
|
12
|
+
} & Cs[K]>;
|
|
13
|
+
} & Cs[K]; };
|