@hot-page/fun 0.0.1
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 +879 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +705 -0
- package/package.json +57 -0
- package/src/index.ts +279 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { html, svg } from 'lit-html';
|
|
2
|
+
import { Signal } from 'signal-polyfill';
|
|
3
|
+
export { html, svg };
|
|
4
|
+
export type RenderFunction = () => ReturnType<typeof html>;
|
|
5
|
+
export type CleanupFunction = () => void;
|
|
6
|
+
export type EffectFunction = () => CleanupFunction | void;
|
|
7
|
+
export type StylePropsFunction = (props: Record<string, string | number | null>) => void;
|
|
8
|
+
type AttributeSignals<Attrs extends string> = {
|
|
9
|
+
[K in Attrs]: Signal.State<string | null>;
|
|
10
|
+
};
|
|
11
|
+
export type ComponentContext<Attrs extends string = never> = AttributeSignals<Attrs> & {
|
|
12
|
+
internals: ElementInternals;
|
|
13
|
+
effect: (fn: EffectFunction) => void;
|
|
14
|
+
styleProps: StylePropsFunction;
|
|
15
|
+
};
|
|
16
|
+
export type FunctionalComponent<Attrs extends string = never> = (context: ComponentContext<Attrs>) => RenderFunction;
|
|
17
|
+
export interface DefineOptions<Attrs extends string = never> {
|
|
18
|
+
setup: FunctionalComponent<Attrs>;
|
|
19
|
+
tagName?: string;
|
|
20
|
+
attributes?: Attrs[];
|
|
21
|
+
useShadow?: boolean;
|
|
22
|
+
formAssociated?: boolean;
|
|
23
|
+
styles?: string;
|
|
24
|
+
}
|
|
25
|
+
declare function lightElement(fn: FunctionalComponent): void;
|
|
26
|
+
declare function lightElement(styles: string, fn: FunctionalComponent): void;
|
|
27
|
+
declare function lightElement<Attrs extends string>(observedAttributes: Attrs[], fn: FunctionalComponent<Attrs>): void;
|
|
28
|
+
declare function lightElement<Attrs extends string>(observedAttributes: Attrs[], styles: string, fn: FunctionalComponent<Attrs>): void;
|
|
29
|
+
declare function shadowElement(fn: FunctionalComponent): void;
|
|
30
|
+
declare function shadowElement(styles: string, fn: FunctionalComponent): void;
|
|
31
|
+
declare function shadowElement<Attrs extends string>(observedAttributes: Attrs[], fn: FunctionalComponent<Attrs>): void;
|
|
32
|
+
declare function shadowElement<Attrs extends string>(observedAttributes: Attrs[], styles: string, fn: FunctionalComponent<Attrs>): void;
|
|
33
|
+
declare const state: <T>(value: T) => Signal.State<T>;
|
|
34
|
+
export { state, lightElement, shadowElement };
|
|
35
|
+
export declare function define<Attrs extends string = never>(options: DefineOptions<Attrs>): void;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAU,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AAEpB,MAAM,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,OAAO,IAAI,CAAC,CAAA;AAC1D,MAAM,MAAM,eAAe,GAAG,MAAM,IAAI,CAAA;AACxC,MAAM,MAAM,cAAc,GAAG,MAAM,eAAe,GAAG,IAAI,CAAA;AACzD,MAAM,MAAM,kBAAkB,GAAG,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,KAC1C,IAAI,CAAA;AAET,KAAK,gBAAgB,CAAC,KAAK,SAAS,MAAM,IAAI;KAC3C,CAAC,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;CAC1C,CAAA;AAED,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,MAAM,GAAG,KAAK,IACvD,gBAAgB,CAAC,KA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