@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.
Files changed (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/package.json +46 -4
  4. package/web/dist/blocks.css +1 -0
  5. package/web/dist/blocks.js +10 -0
  6. package/web/dist/blocks.scoped.css +1 -0
  7. package/web/dist/core.js +9749 -0
  8. package/web/dist/import.js +2 -0
  9. package/web/dist/react.js +4073 -0
  10. package/web/dist/scan.js +22 -0
  11. package/web/dist/types/react/src/act.d.ts +71 -0
  12. package/web/dist/types/react/src/arrange.d.ts +10 -0
  13. package/web/dist/types/react/src/block.d.ts +41 -0
  14. package/web/dist/types/react/src/draw.d.ts +34 -0
  15. package/web/dist/types/react/src/fields/_input.d.ts +16 -0
  16. package/web/dist/types/react/src/fields/_view.d.ts +27 -0
  17. package/web/dist/types/react/src/fields/picker.d.ts +3 -0
  18. package/web/dist/types/react/src/fields/scan.d.ts +3 -0
  19. package/web/dist/types/react/src/fields/search.d.ts +14 -0
  20. package/web/dist/types/react/src/fields/secret.d.ts +3 -0
  21. package/web/dist/types/react/src/fields/slider.d.ts +5 -0
  22. package/web/dist/types/react/src/fields/text.d.ts +3 -0
  23. package/web/dist/types/react/src/fields/toggle.d.ts +3 -0
  24. package/web/dist/types/react/src/fields/upload.d.ts +7 -0
  25. package/web/dist/types/react/src/gen/fields.d.ts +2 -0
  26. package/web/dist/types/react/src/gen/views.d.ts +2 -0
  27. package/web/dist/types/react/src/h.d.ts +7 -0
  28. package/web/dist/types/react/src/index.d.ts +3 -0
  29. package/web/dist/types/react/src/island.d.ts +7 -0
  30. package/web/dist/types/react/src/kinds/button.d.ts +5 -0
  31. package/web/dist/types/react/src/kinds/card.d.ts +5 -0
  32. package/web/dist/types/react/src/kinds/chips.d.ts +5 -0
  33. package/web/dist/types/react/src/kinds/choice.d.ts +5 -0
  34. package/web/dist/types/react/src/kinds/composer.d.ts +5 -0
  35. package/web/dist/types/react/src/kinds/config.d.ts +5 -0
  36. package/web/dist/types/react/src/kinds/diagram.d.ts +7 -0
  37. package/web/dist/types/react/src/kinds/diff.d.ts +7 -0
  38. package/web/dist/types/react/src/kinds/editor.d.ts +5 -0
  39. package/web/dist/types/react/src/kinds/form.d.ts +22 -0
  40. package/web/dist/types/react/src/kinds/hero.d.ts +5 -0
  41. package/web/dist/types/react/src/kinds/images.d.ts +5 -0
  42. package/web/dist/types/react/src/kinds/import.d.ts +5 -0
  43. package/web/dist/types/react/src/kinds/list.d.ts +6 -0
  44. package/web/dist/types/react/src/kinds/media.d.ts +6 -0
  45. package/web/dist/types/react/src/kinds/message.d.ts +5 -0
  46. package/web/dist/types/react/src/kinds/modal.d.ts +5 -0
  47. package/web/dist/types/react/src/kinds/nav.d.ts +5 -0
  48. package/web/dist/types/react/src/kinds/pages.d.ts +5 -0
  49. package/web/dist/types/react/src/kinds/prose.d.ts +5 -0
  50. package/web/dist/types/react/src/kinds/row.d.ts +5 -0
  51. package/web/dist/types/react/src/kinds/run.d.ts +5 -0
  52. package/web/dist/types/react/src/kinds/scene.d.ts +5 -0
  53. package/web/dist/types/react/src/kinds/screen.d.ts +5 -0
  54. package/web/dist/types/react/src/kinds/secret.d.ts +5 -0
  55. package/web/dist/types/react/src/kinds/section.d.ts +5 -0
  56. package/web/dist/types/react/src/kinds/sheet.d.ts +1 -0
  57. package/web/dist/types/react/src/kinds/sidebar.d.ts +5 -0
  58. package/web/dist/types/react/src/kinds/stat.d.ts +5 -0
  59. package/web/dist/types/react/src/kinds/steps.d.ts +7 -0
  60. package/web/dist/types/react/src/kinds/table.d.ts +5 -0
  61. package/web/dist/types/react/src/kinds/text.d.ts +5 -0
  62. package/web/dist/types/react/src/kinds/timeline.d.ts +5 -0
  63. package/web/dist/types/react/src/kinds/tool.d.ts +5 -0
  64. package/web/dist/types/react/src/kinds/web.d.ts +5 -0
  65. package/web/dist/types/react/src/view.d.ts +14 -0
  66. package/web/dist/types/src/arrange.d.ts +8 -0
  67. package/web/dist/types/src/behave.d.ts +1 -0
  68. package/web/dist/types/src/core/apply.d.ts +7 -0
  69. package/web/dist/types/src/core/built.d.ts +7 -0
  70. package/web/dist/types/src/core/check.d.ts +5 -0
  71. package/web/dist/types/src/core/code.d.ts +7 -0
  72. package/web/dist/types/src/core/eval.d.ts +25 -0
  73. package/web/dist/types/src/core/field/files.d.ts +53 -0
  74. package/web/dist/types/src/core/field/match.d.ts +15 -0
  75. package/web/dist/types/src/core/field/slider.d.ts +3 -0
  76. package/web/dist/types/src/core/gate.d.ts +7 -0
  77. package/web/dist/types/src/core/gesture.d.ts +53 -0
  78. package/web/dist/types/src/core/index.d.ts +21 -0
  79. package/web/dist/types/src/core/kind/boxplot.d.ts +7 -0
  80. package/web/dist/types/src/core/kind/chart.d.ts +18 -0
  81. package/web/dist/types/src/core/kind/diagram.d.ts +44 -0
  82. package/web/dist/types/src/core/kind/import.d.ts +40 -0
  83. package/web/dist/types/src/core/kind/list.d.ts +3 -0
  84. package/web/dist/types/src/core/kind/media.d.ts +36 -0
  85. package/web/dist/types/src/core/kind/message.d.ts +4 -0
  86. package/web/dist/types/src/core/kind/modal.d.ts +23 -0
  87. package/web/dist/types/src/core/kind/plot.d.ts +22 -0
  88. package/web/dist/types/src/core/kind/prose.d.ts +5 -0
  89. package/web/dist/types/src/core/kind/sidebar.d.ts +7 -0
  90. package/web/dist/types/src/core/kind/table.d.ts +26 -0
  91. package/web/dist/types/src/core/kind/timeline.d.ts +28 -0
  92. package/web/dist/types/src/core/layout.d.ts +9 -0
  93. package/web/dist/types/src/core/look.d.ts +11 -0
  94. package/web/dist/types/src/core/nonce.d.ts +1 -0
  95. package/web/dist/types/src/core/share.d.ts +1 -0
  96. package/web/dist/types/src/core/table.d.ts +6 -0
  97. package/web/dist/types/src/core/text.d.ts +6 -0
  98. package/web/dist/types/src/core/tree.d.ts +12 -0
  99. package/web/dist/types/src/dump.d.ts +2 -0
  100. package/web/dist/types/src/edits.d.ts +18 -0
  101. package/web/dist/types/src/gen/builders.d.ts +64 -0
  102. package/web/dist/types/src/gen/fields.d.ts +2 -0
  103. package/web/dist/types/src/gen/hooks.d.ts +11 -0
  104. package/web/dist/types/src/gen/kinds.d.ts +9 -0
  105. package/web/dist/types/src/gen/layout.d.ts +19 -0
  106. package/web/dist/types/src/gen/schemes.d.ts +73 -0
  107. package/web/dist/types/src/gen/shapes.d.ts +61 -0
  108. package/web/dist/types/src/gen/types.d.ts +1517 -0
  109. package/web/dist/types/src/gen/words-import.d.ts +1 -0
  110. package/web/dist/types/src/gen/words.d.ts +1 -0
  111. package/web/dist/types/src/gesture.d.ts +54 -0
  112. package/web/dist/types/src/island.d.ts +3 -0
  113. package/web/dist/types/src/lazy/import.d.ts +13 -0
  114. package/web/dist/types/src/modal.d.ts +14 -0
  115. package/web/dist/types/src/motion.d.ts +2 -0
  116. package/web/dist/types/src/paging.d.ts +2 -0
  117. package/web/dist/types/src/patch.d.ts +17 -0
  118. package/web/dist/types/src/render/act.d.ts +9 -0
  119. package/web/dist/types/src/render/block.d.ts +5 -0
  120. package/web/dist/types/src/render/ctx.d.ts +34 -0
  121. package/web/dist/types/src/render/dom.d.ts +16 -0
  122. package/web/dist/types/src/render/field/_input.d.ts +3 -0
  123. package/web/dist/types/src/render/field/_view.d.ts +26 -0
  124. package/web/dist/types/src/render/field/picker.d.ts +3 -0
  125. package/web/dist/types/src/render/field/scan.d.ts +3 -0
  126. package/web/dist/types/src/render/field/search.d.ts +5 -0
  127. package/web/dist/types/src/render/field/secret.d.ts +3 -0
  128. package/web/dist/types/src/render/field/slider.d.ts +5 -0
  129. package/web/dist/types/src/render/field/text.d.ts +3 -0
  130. package/web/dist/types/src/render/field/toggle.d.ts +3 -0
  131. package/web/dist/types/src/render/field/upload.d.ts +5 -0
  132. package/web/dist/types/src/render/kind/boxplot.d.ts +3 -0
  133. package/web/dist/types/src/render/kind/button.d.ts +3 -0
  134. package/web/dist/types/src/render/kind/card.d.ts +3 -0
  135. package/web/dist/types/src/render/kind/chart.d.ts +4 -0
  136. package/web/dist/types/src/render/kind/chips.d.ts +3 -0
  137. package/web/dist/types/src/render/kind/choice.d.ts +3 -0
  138. package/web/dist/types/src/render/kind/composer.d.ts +3 -0
  139. package/web/dist/types/src/render/kind/config.d.ts +3 -0
  140. package/web/dist/types/src/render/kind/diagram.d.ts +3 -0
  141. package/web/dist/types/src/render/kind/diff.d.ts +3 -0
  142. package/web/dist/types/src/render/kind/editor.d.ts +3 -0
  143. package/web/dist/types/src/render/kind/form.d.ts +14 -0
  144. package/web/dist/types/src/render/kind/heat.d.ts +3 -0
  145. package/web/dist/types/src/render/kind/hero.d.ts +3 -0
  146. package/web/dist/types/src/render/kind/images.d.ts +3 -0
  147. package/web/dist/types/src/render/kind/import.d.ts +3 -0
  148. package/web/dist/types/src/render/kind/island.d.ts +3 -0
  149. package/web/dist/types/src/render/kind/lines.d.ts +5 -0
  150. package/web/dist/types/src/render/kind/list.d.ts +3 -0
  151. package/web/dist/types/src/render/kind/media.d.ts +4 -0
  152. package/web/dist/types/src/render/kind/message.d.ts +3 -0
  153. package/web/dist/types/src/render/kind/modal.d.ts +9 -0
  154. package/web/dist/types/src/render/kind/nav.d.ts +2 -0
  155. package/web/dist/types/src/render/kind/pages.d.ts +2 -0
  156. package/web/dist/types/src/render/kind/plot.d.ts +3 -0
  157. package/web/dist/types/src/render/kind/prose.d.ts +4 -0
  158. package/web/dist/types/src/render/kind/row.d.ts +3 -0
  159. package/web/dist/types/src/render/kind/run.d.ts +3 -0
  160. package/web/dist/types/src/render/kind/scene.d.ts +3 -0
  161. package/web/dist/types/src/render/kind/screen.d.ts +3 -0
  162. package/web/dist/types/src/render/kind/secret.d.ts +3 -0
  163. package/web/dist/types/src/render/kind/section.d.ts +3 -0
  164. package/web/dist/types/src/render/kind/sheet.d.ts +1 -0
  165. package/web/dist/types/src/render/kind/sidebar.d.ts +3 -0
  166. package/web/dist/types/src/render/kind/stat.d.ts +2 -0
  167. package/web/dist/types/src/render/kind/steps.d.ts +3 -0
  168. package/web/dist/types/src/render/kind/table.d.ts +3 -0
  169. package/web/dist/types/src/render/kind/text.d.ts +3 -0
  170. package/web/dist/types/src/render/kind/timeline.d.ts +3 -0
  171. package/web/dist/types/src/render/kind/toast.d.ts +4 -0
  172. package/web/dist/types/src/render/kind/tool.d.ts +3 -0
  173. package/web/dist/types/src/render/kind/web.d.ts +2 -0
  174. package/web/dist/types/src/render/more.d.ts +11 -0
  175. package/web/dist/types/src/render/text.d.ts +5 -0
  176. package/web/dist/types/src/scan/index.d.ts +26 -0
  177. package/web/dist/types/src/scan/page.d.ts +18 -0
  178. package/web/dist/types/src/shell/adopt.d.ts +8 -0
  179. package/web/dist/types/src/shell/host.d.ts +30 -0
  180. package/web/dist/types/src/shell/layout.d.ts +29 -0
  181. package/web/dist/types/src/shell/local.d.ts +10 -0
  182. package/web/dist/types/src/shell/look.d.ts +15 -0
  183. package/web/dist/types/src/shell/mount.d.ts +34 -0
  184. package/web/dist/types/src/shell/sheet.d.ts +17 -0
  185. package/web/dist/types/src/shell/source.d.ts +12 -0
  186. package/web/dist/types/src/shell/store.d.ts +2 -0
  187. package/web/dist/types/src/shell.d.ts +26 -0
  188. package/web/dist/types/src/sidebar.d.ts +2 -0
  189. package/web/dist/types/src/stream.d.ts +28 -0
  190. package/web/dist/types/src/theme.d.ts +24 -0
  191. 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,3 @@
1
+ import type { Island } from "./gen/types.ts";
2
+ export declare const isTag: (name: string) => boolean;
3
+ export declare function island(b: Island, fallback: Node[], send: (name: string, values: Record<string, unknown>) => void, drop: (name: string) => void): HTMLElement;
@@ -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,2 @@
1
+ export declare function settle(root: HTMLElement): void;
2
+ export declare const enter: (e: Element) => void;
@@ -0,0 +1,2 @@
1
+ import type { Pages } from "./gen/types.ts";
2
+ export declare function paging(s: HTMLElement, b: Pages, had: string | null): 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,3 @@
1
+ import type { TextField } from "../../gen/types.ts";
2
+ import type { FieldCtx, FieldOut } from "./_view.ts";
3
+ export declare function input(x: TextField, c: FieldCtx, password: boolean, placeholder: string): FieldOut;
@@ -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,3 @@
1
+ import type { PickerField } from "../../gen/types.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const picker: FieldView<PickerField>;
@@ -0,0 +1,3 @@
1
+ import type { ScanField } from "../../gen/types.ts";
2
+ import { type FieldView } from "./_view.ts";
3
+ export declare const scan: FieldView<ScanField>;
@@ -0,0 +1,5 @@
1
+ import type { SearchField } from "../../gen/types.ts";
2
+ import { type FieldView } from "./_view.ts";
3
+ export declare const search: FieldView<Omit<SearchField, "value"> & {
4
+ value?: unknown;
5
+ }>;
@@ -0,0 +1,3 @@
1
+ import type { SecretField } from "../../gen/types.ts";
2
+ import { type FieldView } from "./_view.ts";
3
+ export declare const secret: FieldView<Omit<SecretField, "value">>;
@@ -0,0 +1,5 @@
1
+ import type { Field } from "../../gen/types.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const slider: FieldView<Extract<Field, {
4
+ type: "slider";
5
+ }>>;
@@ -0,0 +1,3 @@
1
+ import type { TextField } from "../../gen/types.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const text: FieldView<TextField>;
@@ -0,0 +1,3 @@
1
+ import type { ToggleField } from "../../gen/types.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const toggle: FieldView<ToggleField>;
@@ -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,3 @@
1
+ import type { Boxplot } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function boxplot(b: Boxplot, ctx: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Button } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function button(b: Button, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Card } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function card(b: Card, c: Ctx): HTMLElement;
@@ -0,0 +1,4 @@
1
+ import type { Chart, Tone } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare const colour: (tone: Tone | null | undefined, i: number) => string;
4
+ export declare function chart(b: Chart, ctx: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Chips } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function chips(b: Chips, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Choice } from "../../gen/types.ts";
2
+ import { type Ctx } from "../ctx.ts";
3
+ export declare function choice(b: Choice, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Composer } from "../../gen/types.ts";
2
+ import { type Ctx } from "../ctx.ts";
3
+ export declare function composer(b: Composer, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Form } from "../../gen/types.ts";
2
+ import { type Ctx } from "../ctx.ts";
3
+ export declare function config(b: Form, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Blk } from "../../core/tree.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function diagram(b: Blk, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Diff } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function diff(b: Diff, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Editor } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function editor(b: Editor, c: Ctx): HTMLElement;
@@ -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,3 @@
1
+ import type { Heat } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function heat(b: Heat, ctx: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Hero } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function hero(b: Hero, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Images } from "../../gen/types.ts";
2
+ export declare function images(b: Images): HTMLElement;
3
+ export declare function viewer(list: [string, string][], from: number): void;
@@ -0,0 +1,3 @@
1
+ import type { Import } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function import_(b: Import, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Island } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function island(b: Island, c: Ctx): HTMLElement;
@@ -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,3 @@
1
+ import type { List } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function list(b: List, c: Ctx): HTMLElement;
@@ -0,0 +1,4 @@
1
+ import type { Media } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function figure(m: Media): HTMLElement;
4
+ export declare function media(b: Media, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Message } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function message(b: Message, 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,2 @@
1
+ import type { Nav } from "../../gen/types.ts";
2
+ export declare function nav(b: Nav): HTMLElement;
@@ -0,0 +1,2 @@
1
+ import type { Pages } from "../../gen/types.ts";
2
+ export declare function pages(b: Pages): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Block, Plot } from "../../gen/types.ts";
2
+ export declare function plot(b: Plot): HTMLElement;
3
+ export declare function sync(root: HTMLElement, block: Block): boolean;
@@ -0,0 +1,4 @@
1
+ import type { Append } from "../../core/kind/prose.ts";
2
+ import type { Prose } from "../../gen/types.ts";
3
+ export declare function prose(b: Prose): HTMLElement;
4
+ export declare function grow(el: HTMLElement, op: Append): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Row } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function row(b: Row, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Run } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function run(b: Run, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Scene } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function scene(b: Scene, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Screen } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function screen(b: Screen, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Secret } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function secret(b: Secret, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Section } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function section(b: Section, c: Ctx): HTMLElement;
@@ -0,0 +1 @@
1
+ export { modal as sheet } from "./modal.ts";
@@ -0,0 +1,3 @@
1
+ import type { Sidebar } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function sidebar(b: Sidebar, c: Ctx): HTMLElement;
@@ -0,0 +1,2 @@
1
+ import type { Stat } from "../../gen/types.ts";
2
+ export declare function stat(b: Stat): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Steps } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function steps(b: Steps, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Table } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function table(b: Table, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Text } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function text(b: Text, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Timeline } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function timeline(b: Timeline, c: Ctx): HTMLElement;
@@ -0,0 +1,4 @@
1
+ import type { Toast } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function line(t: Toast, cls: string): HTMLElement;
4
+ export declare function toast(b: Toast, c: Ctx): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import type { Tool } from "../../gen/types.ts";
2
+ import type { Ctx } from "../ctx.ts";
3
+ export declare function tool(b: Tool, c: Ctx): HTMLElement;
@@ -0,0 +1,2 @@
1
+ import type { Web } from "../../gen/types.ts";
2
+ export declare function web(b: Web): HTMLElement;
@@ -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,8 @@
1
+ import { type Store } from "../render/ctx.ts";
2
+ import { type Theme } from "../theme.ts";
3
+ import { type AppBlocks } from "./host.ts";
4
+ export declare function adopt(o?: {
5
+ theme?: Theme;
6
+ store?: Store;
7
+ blocks?: AppBlocks;
8
+ }): boolean;
@@ -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
+ };