evikit 2.3.1 → 2.3.2

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.
Files changed (5) hide show
  1. package/html.js +49 -47
  2. package/index.d.ts +134 -132
  3. package/index.js +243 -239
  4. package/package.json +1 -1
  5. package/server.js +487 -485
package/html.js CHANGED
@@ -1,47 +1,49 @@
1
- import { HTMLElement } from "./html-element.js";
2
-
3
- export const a = HTMLElement("a");
4
- export const article = HTMLElement("article");
5
- export const b = HTMLElement("b");
6
- export const blockquote = HTMLElement("blockquote");
7
- export const br = HTMLElement("br");
8
- export const button = HTMLElement("button");
9
- export const circle = HTMLElement("circle");
10
- export const code = HTMLElement("code");
11
- export const dialog = HTMLElement("dialog");
12
- export const div = HTMLElement("div");
13
- export const em = HTMLElement("em");
14
- export const fieldset = HTMLElement("fieldset");
15
- export const figcaption = HTMLElement("figcaption");
16
- export const figure = HTMLElement("figure");
17
- export const footer = HTMLElement("footer");
18
- export const form = HTMLElement("form");
19
- export const header = HTMLElement("header");
20
- export const h1 = HTMLElement("h1");
21
- export const h2 = HTMLElement("h2");
22
- export const h3 = HTMLElement("h3");
23
- export const h4 = HTMLElement("h4");
24
- export const h5 = HTMLElement("h5");
25
- export const h6 = HTMLElement("h6");
26
- export const hr = HTMLElement("hr");
27
- export const i = HTMLElement("i");
28
- export const img = HTMLElement("img");
29
- export const input = HTMLElement("input");
30
- export const label = HTMLElement("label");
31
- export const legend = HTMLElement("legend");
32
- export const li = HTMLElement("li");
33
- export const main = HTMLElement("main");
34
- export const nav = HTMLElement("nav");
35
- export const ol = HTMLElement("ol");
36
- export const option = HTMLElement("option");
37
- export const p = HTMLElement("p");
38
- export const path = HTMLElement("path");
39
- export const pre = HTMLElement("pre");
40
- export const section = HTMLElement("section");
41
- export const select = HTMLElement("select");
42
- export const small = HTMLElement("small");
43
- export const span = HTMLElement("span");
44
- export const strong = HTMLElement("strong");
45
- export const svg = HTMLElement("svg");
46
- export const title = HTMLElement("title");
47
- export const ul = HTMLElement("ul");
1
+ import { HTMLElement } from "./html-element.js";
2
+
3
+ export const a = HTMLElement("a");
4
+ export const article = HTMLElement("article");
5
+ export const b = HTMLElement("b");
6
+ export const blockquote = HTMLElement("blockquote");
7
+ export const br = HTMLElement("br");
8
+ export const button = HTMLElement("button");
9
+ export const circle = HTMLElement("circle");
10
+ export const code = HTMLElement("code");
11
+ export const details = HTMLElement("details");
12
+ export const dialog = HTMLElement("dialog");
13
+ export const div = HTMLElement("div");
14
+ export const em = HTMLElement("em");
15
+ export const fieldset = HTMLElement("fieldset");
16
+ export const figcaption = HTMLElement("figcaption");
17
+ export const figure = HTMLElement("figure");
18
+ export const footer = HTMLElement("footer");
19
+ export const form = HTMLElement("form");
20
+ export const header = HTMLElement("header");
21
+ export const h1 = HTMLElement("h1");
22
+ export const h2 = HTMLElement("h2");
23
+ export const h3 = HTMLElement("h3");
24
+ export const h4 = HTMLElement("h4");
25
+ export const h5 = HTMLElement("h5");
26
+ export const h6 = HTMLElement("h6");
27
+ export const hr = HTMLElement("hr");
28
+ export const i = HTMLElement("i");
29
+ export const img = HTMLElement("img");
30
+ export const input = HTMLElement("input");
31
+ export const label = HTMLElement("label");
32
+ export const legend = HTMLElement("legend");
33
+ export const li = HTMLElement("li");
34
+ export const main = HTMLElement("main");
35
+ export const nav = HTMLElement("nav");
36
+ export const ol = HTMLElement("ol");
37
+ export const option = HTMLElement("option");
38
+ export const p = HTMLElement("p");
39
+ export const path = HTMLElement("path");
40
+ export const pre = HTMLElement("pre");
41
+ export const section = HTMLElement("section");
42
+ export const select = HTMLElement("select");
43
+ export const small = HTMLElement("small");
44
+ export const span = HTMLElement("span");
45
+ export const strong = HTMLElement("strong");
46
+ export const summary = HTMLElement("summary");
47
+ export const svg = HTMLElement("svg");
48
+ export const title = HTMLElement("title");
49
+ export const ul = HTMLElement("ul");
package/index.d.ts CHANGED
@@ -1,132 +1,134 @@
1
- import type { ClassAttributes, ComponentChildren, JSX, VNode } from "preact";
2
-
3
- import i18n from "gettext.js";
4
-
5
- import { flatten, primary, references, relations } from "./db.js";
6
- import { useApi } from "./use-api.js";
7
- import { useEnhance } from "./use-enhance.js";
8
-
9
- export interface DehydratedState {
10
- queries: { queryHash: string; state: QueryState }[];
11
- }
12
-
13
- export interface QueryState {
14
- data: any; // eslint-disable-line @typescript-eslint/no-explicit-any
15
- dataUpdatedAt: number;
16
- error: null | unknown;
17
- isInvalidated: boolean;
18
- status: "error" | "loading" | "success";
19
- }
20
-
21
- type H<T extends keyof JSX.IntrinsicElements> = (
22
- props: (ClassAttributes<HTMLElement> & JSX.IntrinsicElements[T]) | null,
23
- ...children: ComponentChildren[]
24
- ) => VNode<ClassAttributes<HTMLElement> & JSX.IntrinsicElements[T]>;
25
-
26
- export function dehydrate(
27
- queryClient: ReturnType<typeof useQueryClient>,
28
- options: {
29
- shouldRedactErrors: (error: unknown) => boolean;
30
- },
31
- ): DehydratedState;
32
-
33
- export function getI18n(...langs: string[]): Promise<i18n.Gettext>;
34
-
35
- export function hydrate(
36
- App: (props: {
37
- dehydratedState?: DehydratedState | undefined;
38
- i18n: i18n.Gettext;
39
- }) => VNode<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
40
- renderTarget: string,
41
- ): Promise<void>;
42
-
43
- export function Router({
44
- children,
45
- dehydratedState,
46
- i18n,
47
- }: {
48
- children?: ComponentChildren;
49
- dehydratedState?: DehydratedState | undefined;
50
- i18n: i18n.Gettext;
51
- }): VNode<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
52
-
53
- export function ssr(
54
- App: (props: {
55
- dehydratedState?: DehydratedState | undefined;
56
- i18n: i18n.Gettext;
57
- }) => VNode<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
58
- data: { lang?: string; url: string },
59
- ): Promise<{
60
- data: {
61
- dehydratedState: DehydratedState;
62
- lang?: string;
63
- url: string;
64
- };
65
- head: {
66
- elements: Set<{
67
- props: Record<string, string>;
68
- type: string;
69
- }>;
70
- lang: string;
71
- title: string;
72
- };
73
- html: string;
74
- links: Set<string> | undefined;
75
- }>;
76
-
77
- export function useI18n(): i18n.Gettext;
78
-
79
- export function useQueryClient(): {
80
- invalidateQueries(): void;
81
- };
82
-
83
- export function useStatus(error: unknown): string;
84
-
85
- export const a: H<"a">;
86
- export const article: H<"article">;
87
- export const b: H<"b">;
88
- export const blockquote: H<"blockquote">;
89
- export const br: H<"br">;
90
- export const button: H<"button">;
91
- export const circle: H<"circle">;
92
- export const code: H<"code">;
93
- export const dialog: H<"dialog">;
94
- export const div: H<"div">;
95
- export const em: H<"em">;
96
- export const fieldset: H<"fieldset">;
97
- export const figcaption: H<"figcaption">;
98
- export const figure: H<"figure">;
99
- export const footer: H<"footer">;
100
- export const form: H<"form">;
101
- export const h1: H<"h1">;
102
- export const h2: H<"h2">;
103
- export const h3: H<"h3">;
104
- export const h4: H<"h4">;
105
- export const h5: H<"h5">;
106
- export const h6: H<"h6">;
107
- export const header: H<"header">;
108
- export const hr: H<"hr">;
109
- export const i: H<"i">;
110
- export const img: H<"img">;
111
- export const input: H<"input">;
112
- export const label: H<"label">;
113
- export const legend: H<"legend">;
114
- export const li: H<"li">;
115
- export const main: H<"main">;
116
- export const nav: H<"nav">;
117
- export const ol: H<"ol">;
118
- export const option: H<"option">;
119
- export const p: H<"p">;
120
- export const path: H<"path">;
121
- export const pre: H<"pre">;
122
- export const section: H<"section">;
123
- export const select: H<"select">;
124
- export const small: H<"small">;
125
- export const span: H<"span">;
126
- export const strong: H<"strong">;
127
- export const svg: H<"svg">;
128
- export const title: H<"title">;
129
- export const ul: H<"ul">;
130
-
131
- export { flatten, primary, references, relations };
132
- export { useApi, useEnhance };
1
+ import type { ClassAttributes, ComponentChildren, JSX, VNode } from "preact";
2
+
3
+ import i18n from "gettext.js";
4
+
5
+ import { flatten, primary, references, relations } from "./db.js";
6
+ import { useApi } from "./use-api.js";
7
+ import { useEnhance } from "./use-enhance.js";
8
+
9
+ export interface DehydratedState {
10
+ queries: { queryHash: string; state: QueryState }[];
11
+ }
12
+
13
+ export interface QueryState {
14
+ data: any; // eslint-disable-line @typescript-eslint/no-explicit-any
15
+ dataUpdatedAt: number;
16
+ error: null | unknown;
17
+ isInvalidated: boolean;
18
+ status: "error" | "loading" | "success";
19
+ }
20
+
21
+ type H<T extends keyof JSX.IntrinsicElements> = (
22
+ props: (ClassAttributes<HTMLElement> & JSX.IntrinsicElements[T]) | null,
23
+ ...children: ComponentChildren[]
24
+ ) => VNode<ClassAttributes<HTMLElement> & JSX.IntrinsicElements[T]>;
25
+
26
+ export function dehydrate(
27
+ queryClient: ReturnType<typeof useQueryClient>,
28
+ options: {
29
+ shouldRedactErrors: (error: unknown) => boolean;
30
+ },
31
+ ): DehydratedState;
32
+
33
+ export function getI18n(...langs: string[]): Promise<i18n.Gettext>;
34
+
35
+ export function hydrate(
36
+ App: (props: {
37
+ dehydratedState?: DehydratedState | undefined;
38
+ i18n: i18n.Gettext;
39
+ }) => VNode<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
40
+ renderTarget: string,
41
+ ): Promise<void>;
42
+
43
+ export function Router({
44
+ children,
45
+ dehydratedState,
46
+ i18n,
47
+ }: {
48
+ children?: ComponentChildren;
49
+ dehydratedState?: DehydratedState | undefined;
50
+ i18n: i18n.Gettext;
51
+ }): VNode<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
52
+
53
+ export function ssr(
54
+ App: (props: {
55
+ dehydratedState?: DehydratedState | undefined;
56
+ i18n: i18n.Gettext;
57
+ }) => VNode<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
58
+ data: { lang?: string; url: string },
59
+ ): Promise<{
60
+ data: {
61
+ dehydratedState: DehydratedState;
62
+ lang?: string;
63
+ url: string;
64
+ };
65
+ head: {
66
+ elements: Set<{
67
+ props: Record<string, string>;
68
+ type: string;
69
+ }>;
70
+ lang: string;
71
+ title: string;
72
+ };
73
+ html: string;
74
+ links: Set<string> | undefined;
75
+ }>;
76
+
77
+ export function useI18n(): i18n.Gettext;
78
+
79
+ export function useQueryClient(): {
80
+ invalidateQueries(): void;
81
+ };
82
+
83
+ export function useStatus(error: unknown): string;
84
+
85
+ export const a: H<"a">;
86
+ export const article: H<"article">;
87
+ export const b: H<"b">;
88
+ export const blockquote: H<"blockquote">;
89
+ export const br: H<"br">;
90
+ export const button: H<"button">;
91
+ export const circle: H<"circle">;
92
+ export const code: H<"code">;
93
+ export const details: H<"details">;
94
+ export const dialog: H<"dialog">;
95
+ export const div: H<"div">;
96
+ export const em: H<"em">;
97
+ export const fieldset: H<"fieldset">;
98
+ export const figcaption: H<"figcaption">;
99
+ export const figure: H<"figure">;
100
+ export const footer: H<"footer">;
101
+ export const form: H<"form">;
102
+ export const h1: H<"h1">;
103
+ export const h2: H<"h2">;
104
+ export const h3: H<"h3">;
105
+ export const h4: H<"h4">;
106
+ export const h5: H<"h5">;
107
+ export const h6: H<"h6">;
108
+ export const header: H<"header">;
109
+ export const hr: H<"hr">;
110
+ export const i: H<"i">;
111
+ export const img: H<"img">;
112
+ export const input: H<"input">;
113
+ export const label: H<"label">;
114
+ export const legend: H<"legend">;
115
+ export const li: H<"li">;
116
+ export const main: H<"main">;
117
+ export const nav: H<"nav">;
118
+ export const ol: H<"ol">;
119
+ export const option: H<"option">;
120
+ export const p: H<"p">;
121
+ export const path: H<"path">;
122
+ export const pre: H<"pre">;
123
+ export const section: H<"section">;
124
+ export const select: H<"select">;
125
+ export const small: H<"small">;
126
+ export const span: H<"span">;
127
+ export const strong: H<"strong">;
128
+ export const summary: H<"summary">;
129
+ export const svg: H<"svg">;
130
+ export const title: H<"title">;
131
+ export const ul: H<"ul">;
132
+
133
+ export { flatten, primary, references, relations };
134
+ export { useApi, useEnhance };