@jirathip-dev/blocks 0.0.0-stage → 2.2.0
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/LICENSE +21 -0
- package/README.md +67 -2
- package/package.json +46 -4
- package/web/dist/blocks.css +1 -0
- package/web/dist/blocks.js +10 -0
- package/web/dist/blocks.scoped.css +1 -0
- package/web/dist/core.js +9749 -0
- package/web/dist/import.js +2 -0
- package/web/dist/react.js +4073 -0
- package/web/dist/scan.js +22 -0
- package/web/dist/types/react/src/act.d.ts +71 -0
- package/web/dist/types/react/src/arrange.d.ts +10 -0
- package/web/dist/types/react/src/block.d.ts +41 -0
- package/web/dist/types/react/src/draw.d.ts +34 -0
- package/web/dist/types/react/src/fields/_input.d.ts +16 -0
- package/web/dist/types/react/src/fields/_view.d.ts +27 -0
- package/web/dist/types/react/src/fields/picker.d.ts +3 -0
- package/web/dist/types/react/src/fields/scan.d.ts +3 -0
- package/web/dist/types/react/src/fields/search.d.ts +14 -0
- package/web/dist/types/react/src/fields/secret.d.ts +3 -0
- package/web/dist/types/react/src/fields/slider.d.ts +5 -0
- package/web/dist/types/react/src/fields/text.d.ts +3 -0
- package/web/dist/types/react/src/fields/toggle.d.ts +3 -0
- package/web/dist/types/react/src/fields/upload.d.ts +7 -0
- package/web/dist/types/react/src/gen/fields.d.ts +2 -0
- package/web/dist/types/react/src/gen/views.d.ts +2 -0
- package/web/dist/types/react/src/h.d.ts +7 -0
- package/web/dist/types/react/src/index.d.ts +3 -0
- package/web/dist/types/react/src/island.d.ts +7 -0
- package/web/dist/types/react/src/kinds/button.d.ts +5 -0
- package/web/dist/types/react/src/kinds/card.d.ts +5 -0
- package/web/dist/types/react/src/kinds/chips.d.ts +5 -0
- package/web/dist/types/react/src/kinds/choice.d.ts +5 -0
- package/web/dist/types/react/src/kinds/composer.d.ts +5 -0
- package/web/dist/types/react/src/kinds/config.d.ts +5 -0
- package/web/dist/types/react/src/kinds/diagram.d.ts +7 -0
- package/web/dist/types/react/src/kinds/diff.d.ts +7 -0
- package/web/dist/types/react/src/kinds/editor.d.ts +5 -0
- package/web/dist/types/react/src/kinds/form.d.ts +22 -0
- package/web/dist/types/react/src/kinds/hero.d.ts +5 -0
- package/web/dist/types/react/src/kinds/images.d.ts +5 -0
- package/web/dist/types/react/src/kinds/import.d.ts +5 -0
- package/web/dist/types/react/src/kinds/list.d.ts +6 -0
- package/web/dist/types/react/src/kinds/media.d.ts +6 -0
- package/web/dist/types/react/src/kinds/message.d.ts +5 -0
- package/web/dist/types/react/src/kinds/modal.d.ts +5 -0
- package/web/dist/types/react/src/kinds/nav.d.ts +5 -0
- package/web/dist/types/react/src/kinds/pages.d.ts +5 -0
- package/web/dist/types/react/src/kinds/prose.d.ts +5 -0
- package/web/dist/types/react/src/kinds/row.d.ts +5 -0
- package/web/dist/types/react/src/kinds/run.d.ts +5 -0
- package/web/dist/types/react/src/kinds/scene.d.ts +5 -0
- package/web/dist/types/react/src/kinds/screen.d.ts +5 -0
- package/web/dist/types/react/src/kinds/secret.d.ts +5 -0
- package/web/dist/types/react/src/kinds/section.d.ts +5 -0
- package/web/dist/types/react/src/kinds/sheet.d.ts +1 -0
- package/web/dist/types/react/src/kinds/sidebar.d.ts +5 -0
- package/web/dist/types/react/src/kinds/stat.d.ts +5 -0
- package/web/dist/types/react/src/kinds/steps.d.ts +7 -0
- package/web/dist/types/react/src/kinds/table.d.ts +5 -0
- package/web/dist/types/react/src/kinds/text.d.ts +5 -0
- package/web/dist/types/react/src/kinds/timeline.d.ts +5 -0
- package/web/dist/types/react/src/kinds/tool.d.ts +5 -0
- package/web/dist/types/react/src/kinds/web.d.ts +5 -0
- package/web/dist/types/react/src/view.d.ts +14 -0
- package/web/dist/types/src/arrange.d.ts +8 -0
- package/web/dist/types/src/behave.d.ts +1 -0
- package/web/dist/types/src/core/apply.d.ts +7 -0
- package/web/dist/types/src/core/built.d.ts +7 -0
- package/web/dist/types/src/core/check.d.ts +5 -0
- package/web/dist/types/src/core/code.d.ts +7 -0
- package/web/dist/types/src/core/eval.d.ts +25 -0
- package/web/dist/types/src/core/field/files.d.ts +53 -0
- package/web/dist/types/src/core/field/match.d.ts +15 -0
- package/web/dist/types/src/core/field/slider.d.ts +3 -0
- package/web/dist/types/src/core/gate.d.ts +7 -0
- package/web/dist/types/src/core/gesture.d.ts +53 -0
- package/web/dist/types/src/core/index.d.ts +21 -0
- package/web/dist/types/src/core/kind/boxplot.d.ts +7 -0
- package/web/dist/types/src/core/kind/chart.d.ts +18 -0
- package/web/dist/types/src/core/kind/diagram.d.ts +44 -0
- package/web/dist/types/src/core/kind/import.d.ts +40 -0
- package/web/dist/types/src/core/kind/list.d.ts +3 -0
- package/web/dist/types/src/core/kind/media.d.ts +36 -0
- package/web/dist/types/src/core/kind/message.d.ts +4 -0
- package/web/dist/types/src/core/kind/modal.d.ts +23 -0
- package/web/dist/types/src/core/kind/plot.d.ts +22 -0
- package/web/dist/types/src/core/kind/prose.d.ts +5 -0
- package/web/dist/types/src/core/kind/sidebar.d.ts +7 -0
- package/web/dist/types/src/core/kind/table.d.ts +26 -0
- package/web/dist/types/src/core/kind/timeline.d.ts +28 -0
- package/web/dist/types/src/core/layout.d.ts +9 -0
- package/web/dist/types/src/core/look.d.ts +11 -0
- package/web/dist/types/src/core/nonce.d.ts +1 -0
- package/web/dist/types/src/core/share.d.ts +1 -0
- package/web/dist/types/src/core/table.d.ts +6 -0
- package/web/dist/types/src/core/text.d.ts +6 -0
- package/web/dist/types/src/core/tree.d.ts +12 -0
- package/web/dist/types/src/dump.d.ts +2 -0
- package/web/dist/types/src/edits.d.ts +18 -0
- package/web/dist/types/src/gen/builders.d.ts +64 -0
- package/web/dist/types/src/gen/fields.d.ts +2 -0
- package/web/dist/types/src/gen/hooks.d.ts +11 -0
- package/web/dist/types/src/gen/kinds.d.ts +9 -0
- package/web/dist/types/src/gen/layout.d.ts +19 -0
- package/web/dist/types/src/gen/schemes.d.ts +73 -0
- package/web/dist/types/src/gen/shapes.d.ts +61 -0
- package/web/dist/types/src/gen/types.d.ts +1517 -0
- package/web/dist/types/src/gen/words-import.d.ts +1 -0
- package/web/dist/types/src/gen/words.d.ts +1 -0
- package/web/dist/types/src/gesture.d.ts +54 -0
- package/web/dist/types/src/island.d.ts +3 -0
- package/web/dist/types/src/lazy/import.d.ts +13 -0
- package/web/dist/types/src/modal.d.ts +14 -0
- package/web/dist/types/src/motion.d.ts +2 -0
- package/web/dist/types/src/paging.d.ts +2 -0
- package/web/dist/types/src/patch.d.ts +17 -0
- package/web/dist/types/src/render/act.d.ts +9 -0
- package/web/dist/types/src/render/block.d.ts +5 -0
- package/web/dist/types/src/render/ctx.d.ts +34 -0
- package/web/dist/types/src/render/dom.d.ts +16 -0
- package/web/dist/types/src/render/field/_input.d.ts +3 -0
- package/web/dist/types/src/render/field/_view.d.ts +26 -0
- package/web/dist/types/src/render/field/picker.d.ts +3 -0
- package/web/dist/types/src/render/field/scan.d.ts +3 -0
- package/web/dist/types/src/render/field/search.d.ts +5 -0
- package/web/dist/types/src/render/field/secret.d.ts +3 -0
- package/web/dist/types/src/render/field/slider.d.ts +5 -0
- package/web/dist/types/src/render/field/text.d.ts +3 -0
- package/web/dist/types/src/render/field/toggle.d.ts +3 -0
- package/web/dist/types/src/render/field/upload.d.ts +5 -0
- package/web/dist/types/src/render/kind/boxplot.d.ts +3 -0
- package/web/dist/types/src/render/kind/button.d.ts +3 -0
- package/web/dist/types/src/render/kind/card.d.ts +3 -0
- package/web/dist/types/src/render/kind/chart.d.ts +4 -0
- package/web/dist/types/src/render/kind/chips.d.ts +3 -0
- package/web/dist/types/src/render/kind/choice.d.ts +3 -0
- package/web/dist/types/src/render/kind/composer.d.ts +3 -0
- package/web/dist/types/src/render/kind/config.d.ts +3 -0
- package/web/dist/types/src/render/kind/diagram.d.ts +3 -0
- package/web/dist/types/src/render/kind/diff.d.ts +3 -0
- package/web/dist/types/src/render/kind/editor.d.ts +3 -0
- package/web/dist/types/src/render/kind/form.d.ts +14 -0
- package/web/dist/types/src/render/kind/heat.d.ts +3 -0
- package/web/dist/types/src/render/kind/hero.d.ts +3 -0
- package/web/dist/types/src/render/kind/images.d.ts +3 -0
- package/web/dist/types/src/render/kind/import.d.ts +3 -0
- package/web/dist/types/src/render/kind/island.d.ts +3 -0
- package/web/dist/types/src/render/kind/lines.d.ts +5 -0
- package/web/dist/types/src/render/kind/list.d.ts +3 -0
- package/web/dist/types/src/render/kind/media.d.ts +4 -0
- package/web/dist/types/src/render/kind/message.d.ts +3 -0
- package/web/dist/types/src/render/kind/modal.d.ts +9 -0
- package/web/dist/types/src/render/kind/nav.d.ts +2 -0
- package/web/dist/types/src/render/kind/pages.d.ts +2 -0
- package/web/dist/types/src/render/kind/plot.d.ts +3 -0
- package/web/dist/types/src/render/kind/prose.d.ts +4 -0
- package/web/dist/types/src/render/kind/row.d.ts +3 -0
- package/web/dist/types/src/render/kind/run.d.ts +3 -0
- package/web/dist/types/src/render/kind/scene.d.ts +3 -0
- package/web/dist/types/src/render/kind/screen.d.ts +3 -0
- package/web/dist/types/src/render/kind/secret.d.ts +3 -0
- package/web/dist/types/src/render/kind/section.d.ts +3 -0
- package/web/dist/types/src/render/kind/sheet.d.ts +1 -0
- package/web/dist/types/src/render/kind/sidebar.d.ts +3 -0
- package/web/dist/types/src/render/kind/stat.d.ts +2 -0
- package/web/dist/types/src/render/kind/steps.d.ts +3 -0
- package/web/dist/types/src/render/kind/table.d.ts +3 -0
- package/web/dist/types/src/render/kind/text.d.ts +3 -0
- package/web/dist/types/src/render/kind/timeline.d.ts +3 -0
- package/web/dist/types/src/render/kind/toast.d.ts +4 -0
- package/web/dist/types/src/render/kind/tool.d.ts +3 -0
- package/web/dist/types/src/render/kind/web.d.ts +2 -0
- package/web/dist/types/src/render/more.d.ts +11 -0
- package/web/dist/types/src/render/text.d.ts +5 -0
- package/web/dist/types/src/scan/index.d.ts +26 -0
- package/web/dist/types/src/scan/page.d.ts +18 -0
- package/web/dist/types/src/shell/adopt.d.ts +8 -0
- package/web/dist/types/src/shell/host.d.ts +30 -0
- package/web/dist/types/src/shell/layout.d.ts +29 -0
- package/web/dist/types/src/shell/local.d.ts +10 -0
- package/web/dist/types/src/shell/look.d.ts +15 -0
- package/web/dist/types/src/shell/mount.d.ts +34 -0
- package/web/dist/types/src/shell/sheet.d.ts +17 -0
- package/web/dist/types/src/shell/source.d.ts +12 -0
- package/web/dist/types/src/shell/store.d.ts +2 -0
- package/web/dist/types/src/shell.d.ts +26 -0
- package/web/dist/types/src/sidebar.d.ts +2 -0
- package/web/dist/types/src/stream.d.ts +28 -0
- package/web/dist/types/src/theme.d.ts +24 -0
- package/web/dist/types/src/toasts.d.ts +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const importWords: Record<string, [en: string, th: string]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const words: Record<string, [en: string, th: string]>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Nudge, type Phase, type Rules } from "./core/gesture.ts";
|
|
2
|
+
import type { Gesture } from "./gen/types.ts";
|
|
3
|
+
export type Held = {
|
|
4
|
+
start: unknown;
|
|
5
|
+
c: unknown;
|
|
6
|
+
back: (ok: boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
export type Grabbed<B, G, R, C> = {
|
|
9
|
+
block: B;
|
|
10
|
+
gesture: Gesture;
|
|
11
|
+
rules: Rules<B, G, R, C>;
|
|
12
|
+
grab: G;
|
|
13
|
+
item: string;
|
|
14
|
+
reach: (dx: number, dy: number, x: number, y: number) => R;
|
|
15
|
+
show: (c: C | null) => void;
|
|
16
|
+
};
|
|
17
|
+
type Block = {
|
|
18
|
+
id?: string | null;
|
|
19
|
+
};
|
|
20
|
+
export type Driven = {
|
|
21
|
+
act: (a: {
|
|
22
|
+
action: string;
|
|
23
|
+
block?: string | null | undefined;
|
|
24
|
+
values: Record<string, unknown>;
|
|
25
|
+
}, el?: HTMLElement) => Promise<boolean>;
|
|
26
|
+
held?: Map<string, Held>;
|
|
27
|
+
};
|
|
28
|
+
export declare function say(text: string): void;
|
|
29
|
+
export declare function held<B extends Block, G, R, C>(c: Driven, o: Pick<Grabbed<B, G, R, C>, "block" | "rules" | "grab" | "item">): unknown;
|
|
30
|
+
export declare function gestured<B extends Block, G, R, C>(el: HTMLElement, c: Driven, o: Grabbed<B, G, R, C>): (n: Nudge) => void;
|
|
31
|
+
export declare function zoomed(el: HTMLElement, keep: Record<string, unknown>, o: {
|
|
32
|
+
min: number;
|
|
33
|
+
max: number;
|
|
34
|
+
apply: (z: number, live: boolean) => void;
|
|
35
|
+
}): void;
|
|
36
|
+
export type Typed<B, G, C> = Omit<Grabbed<B, G, string, C>, "reach" | "show"> & {
|
|
37
|
+
show: (p: Phase<C>["at"], c: C | null) => void;
|
|
38
|
+
left: (key: string) => void;
|
|
39
|
+
};
|
|
40
|
+
export declare function edited<B extends Block, G, C>(input: HTMLInputElement, c: Driven, o: Typed<B, G, C>): void;
|
|
41
|
+
export type Steered<B, G, R, C> = {
|
|
42
|
+
rules: Rules<B, G, R, C>;
|
|
43
|
+
grab: G;
|
|
44
|
+
now: () => B;
|
|
45
|
+
reach: (dx: number, dy: number) => R;
|
|
46
|
+
show: (c: C | null) => void;
|
|
47
|
+
send: (c: C) => boolean;
|
|
48
|
+
tap?: (() => void) | undefined;
|
|
49
|
+
keys?: HTMLElement | null | undefined;
|
|
50
|
+
mark?: HTMLElement;
|
|
51
|
+
skip?: (e: UIEvent) => boolean;
|
|
52
|
+
};
|
|
53
|
+
export declare function steered<B, G, R, C>(el: HTMLElement, o: Steered<B, G, R, C>): void;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type OnFile } from "../core/field/files.ts";
|
|
2
|
+
import type { Import, Locale } from "../gen/types.ts";
|
|
3
|
+
export type Ctx = {
|
|
4
|
+
screen: string;
|
|
5
|
+
locale?: Locale | undefined;
|
|
6
|
+
file?: OnFile | undefined;
|
|
7
|
+
act: (a: {
|
|
8
|
+
action: string;
|
|
9
|
+
block?: string | null | undefined;
|
|
10
|
+
values: Record<string, unknown>;
|
|
11
|
+
}) => Promise<boolean>;
|
|
12
|
+
};
|
|
13
|
+
export declare function draw(box: HTMLElement, b: Import, c: Ctx): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Modal } from "./gen/types.ts";
|
|
2
|
+
export type Kept = {
|
|
3
|
+
get(key: string): string | null;
|
|
4
|
+
put(key: string, value: string | null): void;
|
|
5
|
+
};
|
|
6
|
+
export type Done = (a: {
|
|
7
|
+
action: string;
|
|
8
|
+
block?: string | null | undefined;
|
|
9
|
+
values: Record<string, unknown>;
|
|
10
|
+
}) => Promise<boolean>;
|
|
11
|
+
export declare function framed(d: HTMLDialogElement, b: Modal, o: {
|
|
12
|
+
done: Done;
|
|
13
|
+
store?: Kept | undefined;
|
|
14
|
+
}): () => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Append } from "./core/kind/prose.ts";
|
|
2
|
+
import type { Block, Op } from "./gen/types.ts";
|
|
3
|
+
export type Draw = (block: Block) => HTMLElement | null;
|
|
4
|
+
export type Grow = (el: HTMLElement, op: Append) => boolean;
|
|
5
|
+
export type Sync = (el: HTMLElement, block: Block) => boolean;
|
|
6
|
+
export declare function patcher(o: {
|
|
7
|
+
root: HTMLElement;
|
|
8
|
+
model: () => Block;
|
|
9
|
+
draw: Draw;
|
|
10
|
+
grow?: Grow;
|
|
11
|
+
sync?: Record<string, Sync>;
|
|
12
|
+
saved?: () => void;
|
|
13
|
+
}): {
|
|
14
|
+
queue(next: Op[]): void;
|
|
15
|
+
flush: () => void;
|
|
16
|
+
drop(): void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Act, Tap } from "../gen/types.ts";
|
|
2
|
+
import { linkable } from "../core/check.ts";
|
|
3
|
+
import type { Ctx } from "./ctx.ts";
|
|
4
|
+
export { linkable };
|
|
5
|
+
export declare const urlOf: (t?: Tap | null) => string | undefined;
|
|
6
|
+
export declare const sends: (t?: Tap | null, action?: unknown) => unknown;
|
|
7
|
+
export declare const acts: <E extends HTMLElement>(e: E, action: unknown) => E;
|
|
8
|
+
export declare const offable: <E extends HTMLElement>(e: E, a: Act) => E;
|
|
9
|
+
export declare function toggle(e: HTMLElement, id: unknown, c: Ctx, folds?: boolean): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Blk } from "../core/tree.ts";
|
|
2
|
+
import type { Ctx } from "./ctx.ts";
|
|
3
|
+
export declare function fallback(b: Blk, c: Ctx): HTMLElement;
|
|
4
|
+
export declare function render(b: Blk, c: Ctx): HTMLElement | null;
|
|
5
|
+
export declare function kids(bs: unknown, c: Ctx): HTMLElement[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { OnFile } from "../core/field/files.ts";
|
|
2
|
+
import { type Blk } from "../core/tree.ts";
|
|
3
|
+
import type { Held } from "../gesture.ts";
|
|
4
|
+
import type { Locale } from "../gen/types.ts";
|
|
5
|
+
import type { Theme } from "../theme.ts";
|
|
6
|
+
export type Post = {
|
|
7
|
+
action: unknown;
|
|
8
|
+
block?: unknown;
|
|
9
|
+
values?: unknown;
|
|
10
|
+
confirm?: unknown;
|
|
11
|
+
};
|
|
12
|
+
export type Store = {
|
|
13
|
+
get(key: string): string | null;
|
|
14
|
+
put(key: string, value: string | null): void;
|
|
15
|
+
};
|
|
16
|
+
export type Renderer = (b: Blk, c: Ctx) => HTMLElement | null;
|
|
17
|
+
export type Ctx = {
|
|
18
|
+
screen: string;
|
|
19
|
+
locale?: Locale | undefined;
|
|
20
|
+
act: (a: Post, el?: HTMLElement) => Promise<boolean>;
|
|
21
|
+
tap: (t: unknown) => void;
|
|
22
|
+
open: Set<string>;
|
|
23
|
+
theme: Theme;
|
|
24
|
+
store: Store;
|
|
25
|
+
apps?: Record<string, Renderer> | undefined;
|
|
26
|
+
drop?: (what: string) => void;
|
|
27
|
+
held?: Map<string, Held>;
|
|
28
|
+
view?: Map<string, Record<string, unknown>>;
|
|
29
|
+
file?: OnFile | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare const posted: (screen: string, a: Post) => string;
|
|
32
|
+
export declare const obj: (v: unknown) => Blk;
|
|
33
|
+
export declare const draft: (i: HTMLInputElement, key: string, store: Store) => void;
|
|
34
|
+
export declare const sent: (box: Element, store: Store) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const esc: (s: unknown) => string;
|
|
2
|
+
export declare const nodes: (html: string) => ChildNode[];
|
|
3
|
+
export declare const el: <K extends keyof HTMLElementTagNameMap>(tag: K, cls?: string, html?: string) => HTMLElementTagNameMap[K];
|
|
4
|
+
export declare const h: <K extends keyof HTMLElementTagNameMap>(tag: K, cls: string, ...kids: (Node | string)[]) => HTMLElementTagNameMap[K];
|
|
5
|
+
export declare const href: (a: HTMLAnchorElement, url: string) => HTMLAnchorElement & {
|
|
6
|
+
href: string;
|
|
7
|
+
target: string;
|
|
8
|
+
rel: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const btn: (label: unknown, cls?: string, url?: string, action?: unknown) => (HTMLAnchorElement & {
|
|
11
|
+
href: string;
|
|
12
|
+
target: string;
|
|
13
|
+
rel: string;
|
|
14
|
+
}) | (HTMLButtonElement & {
|
|
15
|
+
type: string;
|
|
16
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OnFile } from "../../core/field/files.ts";
|
|
2
|
+
import type { Field, Locale } from "../../gen/types.ts";
|
|
3
|
+
import type { Store } from "../ctx.ts";
|
|
4
|
+
export type FieldCtx = {
|
|
5
|
+
locale: Locale;
|
|
6
|
+
store: Store;
|
|
7
|
+
key: string;
|
|
8
|
+
screen: string;
|
|
9
|
+
block?: string | undefined;
|
|
10
|
+
file?: OnFile | undefined;
|
|
11
|
+
set?: ((value: unknown) => unknown) | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type FieldOut = {
|
|
14
|
+
el: HTMLElement;
|
|
15
|
+
sent(): unknown;
|
|
16
|
+
busy?(): {
|
|
17
|
+
up: number;
|
|
18
|
+
failed: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type FieldView<F = Field> = {
|
|
22
|
+
row?: string;
|
|
23
|
+
group?: boolean;
|
|
24
|
+
draw(field: F, c: FieldCtx): FieldOut;
|
|
25
|
+
};
|
|
26
|
+
export declare const word: (c: FieldCtx, key: string) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type FileRow } from "../../core/field/files.ts";
|
|
2
|
+
import type { UploadField } from "../../gen/types.ts";
|
|
3
|
+
import { type FieldView } from "./_view.ts";
|
|
4
|
+
export declare function item(line: string, r: FileRow, w: (k: string) => string, drop: (r: FileRow) => void, again: (r: FileRow) => void, more?: HTMLElement[]): HTMLElement;
|
|
5
|
+
export declare const upload: FieldView<UploadField>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Field, Form } from "../../gen/types.ts";
|
|
2
|
+
import { type Ctx } from "../ctx.ts";
|
|
3
|
+
export type Drawn = {
|
|
4
|
+
row: HTMLElement;
|
|
5
|
+
name: string;
|
|
6
|
+
sent(): unknown;
|
|
7
|
+
busy?: (() => {
|
|
8
|
+
up: number;
|
|
9
|
+
failed: number;
|
|
10
|
+
}) | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare function form(b: Form, c: Ctx): HTMLElement;
|
|
13
|
+
export declare function field(x: Field, key: string, c: Ctx, set?: (v: unknown) => unknown, block?: string): Drawn;
|
|
14
|
+
export declare function values(all: Drawn[]): Record<string, unknown>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Lines } from "../../gen/types.ts";
|
|
2
|
+
import type { Ctx } from "../ctx.ts";
|
|
3
|
+
export declare function minor(v: unknown, scale: number): number | null;
|
|
4
|
+
export declare function money(m: number, scale: number): string;
|
|
5
|
+
export declare function lines(b: Lines, c: Ctx): HTMLElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Modal } from "../../gen/types.ts";
|
|
2
|
+
import { type Done, type Kept } from "../../modal.ts";
|
|
3
|
+
import type { Ctx } from "../ctx.ts";
|
|
4
|
+
export declare function box(b: Modal, inner: HTMLElement[], o: {
|
|
5
|
+
done: Done;
|
|
6
|
+
store?: Kept | undefined;
|
|
7
|
+
lead?: HTMLElement | undefined;
|
|
8
|
+
}): HTMLDialogElement;
|
|
9
|
+
export declare function modal(b: Modal, c: Ctx): HTMLElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { modal as sheet } from "./modal.ts";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Page } from "../gen/types.ts";
|
|
2
|
+
import type { Ctx } from "./ctx.ts";
|
|
3
|
+
export type Paged = {
|
|
4
|
+
id: string;
|
|
5
|
+
page?: Page | null | undefined;
|
|
6
|
+
n: number;
|
|
7
|
+
root: HTMLElement;
|
|
8
|
+
held?: () => boolean;
|
|
9
|
+
wrap: (kids: (Node | string)[], no: boolean) => HTMLElement;
|
|
10
|
+
};
|
|
11
|
+
export declare function paged(c: Ctx, o: Paged): HTMLElement | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Label, Toned } from "../gen/types.ts";
|
|
2
|
+
export declare const tone: (v: Toned) => Label;
|
|
3
|
+
export declare function md(s: unknown, refs?: boolean): string;
|
|
4
|
+
export declare const ticked: (v: unknown) => Node | string;
|
|
5
|
+
export declare const tick: (root: ParentNode) => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Quad } from "./page.ts";
|
|
2
|
+
export type Shot = {
|
|
3
|
+
src: Blob;
|
|
4
|
+
photo: ImageBitmap;
|
|
5
|
+
};
|
|
6
|
+
export type Page = Shot & {
|
|
7
|
+
quad: Quad;
|
|
8
|
+
auto: Quad;
|
|
9
|
+
jpeg: Uint8Array<ArrayBuffer>;
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
export type Scanned = {
|
|
13
|
+
pdf: Blob;
|
|
14
|
+
pages: Page[];
|
|
15
|
+
};
|
|
16
|
+
export type Opts = {
|
|
17
|
+
label: string;
|
|
18
|
+
max: number;
|
|
19
|
+
w(key: string): string;
|
|
20
|
+
pages?: Page[] | undefined;
|
|
21
|
+
};
|
|
22
|
+
export declare const quadOf: (src: Blob) => Promise<Shot & {
|
|
23
|
+
quad: Quad;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const pageOf: ({ src, photo }: Shot, quad: Quad, auto: Quad) => Promise<Page>;
|
|
26
|
+
export declare function scan(o: Opts): Promise<Scanned | undefined>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Pt = [x: number, y: number];
|
|
2
|
+
export type Quad = [Pt, Pt, Pt, Pt];
|
|
3
|
+
export type Img = {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
data: Uint8ClampedArray<ArrayBuffer>;
|
|
7
|
+
};
|
|
8
|
+
export type Jpeg = {
|
|
9
|
+
bytes: Uint8Array;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const A4: Pt;
|
|
14
|
+
export declare function corners(img: Img): Quad | undefined;
|
|
15
|
+
export declare function warp(img: Img, q: Quad, [width, height]?: Pt): Img;
|
|
16
|
+
export declare const turn: ([a, b, c, d]: Quad) => Quad;
|
|
17
|
+
export declare const inset: (w: number, h: number) => Quad;
|
|
18
|
+
export declare function pdf(pages: Jpeg[]): Blob;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { OnFile } from "../core/field/files.ts";
|
|
2
|
+
import type { Block, Kind, Locale } from "../gen/types.ts";
|
|
3
|
+
import type { Ctx, Renderer, Store } from "../render/ctx.ts";
|
|
4
|
+
import type { Theme } from "../theme.ts";
|
|
5
|
+
export type AppBlocks = Record<string, Renderer> & {
|
|
6
|
+
[K in Kind]?: never;
|
|
7
|
+
};
|
|
8
|
+
export type Own = {
|
|
9
|
+
theme: Theme;
|
|
10
|
+
store: Store;
|
|
11
|
+
apps?: AppBlocks | undefined;
|
|
12
|
+
file?: OnFile | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type Screen = {
|
|
15
|
+
screen: () => string;
|
|
16
|
+
locale?: () => Locale | undefined;
|
|
17
|
+
act: Ctx["act"];
|
|
18
|
+
tap: Ctx["tap"];
|
|
19
|
+
};
|
|
20
|
+
export type Host = ReturnType<typeof host>;
|
|
21
|
+
export declare function host(own: Own, s: Screen): {
|
|
22
|
+
open: Set<string>;
|
|
23
|
+
ctx: () => Ctx;
|
|
24
|
+
draw: (b: Block) => HTMLElement | null;
|
|
25
|
+
patch: (root: HTMLElement, model: () => Block, saved?: () => void) => {
|
|
26
|
+
queue(next: import("../gen/types.ts").Op[]): void;
|
|
27
|
+
flush: () => void;
|
|
28
|
+
drop(): void;
|
|
29
|
+
};
|
|
30
|
+
};
|