@jirathip-dev/blocks 0.0.0 → 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 +68 -0
  3. package/package.json +48 -1
  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,5 @@
1
+ import type { Timeline } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function timeline({ b, hooks }: V<Timeline>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import { type Tool } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function tool({ b, hooks }: V<Tool>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Web } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function web({ b, hooks }: V<Web>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from "react";
2
+ import { type Built, type Kind, type Look } from "../../src/core/index.ts";
3
+ import { type KindProps, type Props } from "./act.ts";
4
+ export type AppKinds = Record<string, (p: KindProps) => ReactNode> & {
5
+ [K in Kind]?: never;
6
+ };
7
+ export type BlocksViewProps = Props & {
8
+ screen: Built;
9
+ kinds?: AppKinds;
10
+ look?: Look;
11
+ mode?: "auto" | "light" | "dark";
12
+ };
13
+ export declare const native: readonly Kind[];
14
+ export declare function BlocksView(p: BlocksViewProps): ReactNode;
@@ -0,0 +1,8 @@
1
+ import type { SizeClass } from "./gen/layout.ts";
2
+ import { type Editing, type Placed } from "./edits.ts";
3
+ export type { Editing } from "./edits.ts";
4
+ export declare function editor(o: Editing, root: HTMLElement): {
5
+ tab: HTMLElement;
6
+ sheet: HTMLElement;
7
+ draw(tree: Placed, size: SizeClass): void;
8
+ };
@@ -0,0 +1 @@
1
+ export declare function behave(root: HTMLElement, model: () => unknown): () => void;
@@ -0,0 +1,7 @@
1
+ import type { Block, Op } from "../gen/types.ts";
2
+ export type Rec = {
3
+ [key: string]: unknown;
4
+ };
5
+ export declare const isRec: (v: unknown) => v is Rec;
6
+ export declare function get(root: Rec, id: string): Rec | undefined;
7
+ export declare function apply(screen: Block, ops: Op[]): Block | undefined;
@@ -0,0 +1,7 @@
1
+ import type { Of } from "../gen/builders.ts";
2
+ declare const checked: unique symbol;
3
+ export type Built = Of<"screen"> & {
4
+ readonly [checked]: true;
5
+ };
6
+ export declare function built(screen: Of<"screen">): Built;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ import { type Fault } from "../gen/shapes.ts";
2
+ import type { Built } from "./built.ts";
3
+ export declare const linkable: (url: string) => boolean;
4
+ export declare function check(screen: unknown, app?: readonly string[]): Fault[];
5
+ export declare function actions(screen: Built): string[];
@@ -0,0 +1,7 @@
1
+ import { type Scale } from "../gen/schemes.ts";
2
+ export type Decoded = {
3
+ style: Scale;
4
+ scheme: string | null;
5
+ };
6
+ export declare function encode(style: Scale, scheme?: string | null): string;
7
+ export declare function decode(code: string): Decoded;
@@ -0,0 +1,25 @@
1
+ import type { Lit } from "../gen/types.ts";
2
+ export type State = Record<string, Lit>;
3
+ export type View = {
4
+ hidden: Set<string>;
5
+ disabled: Set<string>;
6
+ says: Record<string, string>;
7
+ acts: Set<string>;
8
+ values: Record<string, string>;
9
+ };
10
+ type Rec = {
11
+ [k: string]: unknown;
12
+ };
13
+ export declare const own: (o: object, k: string) => boolean;
14
+ export declare const rec: (v: unknown) => v is Rec;
15
+ export declare function read(v: unknown): unknown;
16
+ export declare function sound(e: unknown): boolean;
17
+ export declare function ev(e: unknown, s: State): Lit;
18
+ export declare function evaluate(e: unknown, s: State): Lit;
19
+ export declare const list: (v: unknown) => Rec[];
20
+ export declare const actionOf: (a: Rec) => string | undefined;
21
+ export declare const lit: (_field: unknown, held: unknown) => Lit;
22
+ export declare function start(screen: unknown): State;
23
+ export declare function view(screen: unknown, s: State): View;
24
+ export declare const find: (b: Rec, id: string) => Rec | undefined;
25
+ export {};
@@ -0,0 +1,53 @@
1
+ import type { Accept, FileRef, ScanField, UploadField } from "../../gen/types.ts";
2
+ export type Picked = {
3
+ screen: string;
4
+ block?: string | undefined;
5
+ field: string;
6
+ name: string;
7
+ mime: string;
8
+ size: number;
9
+ progress: (part: number) => void;
10
+ signal: AbortSignal;
11
+ };
12
+ export type OnFile = (file: Blob, about: Picked) => Promise<FileRef>;
13
+ export type FileState = "done" | "uploading" | "failed" | "refused";
14
+ export type FileRow = {
15
+ name: string;
16
+ size: number;
17
+ mime: string;
18
+ state: FileState;
19
+ part: number;
20
+ why?: "type" | "size" | undefined;
21
+ id?: string;
22
+ src?: string | undefined;
23
+ blob?: Blob | undefined;
24
+ stop?: AbortController;
25
+ };
26
+ type Word = (key: string) => string;
27
+ export declare const fill: (text: string, v: Record<string, unknown>) => string;
28
+ export declare const accepts: (accept?: Accept[]) => string;
29
+ export declare function refused(x: UploadField, name: string, mime: string, size: number): "type" | "size" | undefined;
30
+ export declare const sized: (n: number) => string;
31
+ export declare function hint(x: UploadField, w: Word, on: boolean): string;
32
+ export declare function pick(x: UploadField, rows: FileRow[], w: Word): string;
33
+ export declare function status(x: UploadField, r: FileRow, w: Word): string;
34
+ export declare const held: (x: UploadField) => FileRow[];
35
+ export declare const ids: (rows: FileRow[]) => string[];
36
+ export declare const waits: (rows: FileRow[]) => {
37
+ up: number;
38
+ failed: number;
39
+ };
40
+ export declare function picked(x: UploadField, rows: FileRow[], files: Blob[], names: string[]): {
41
+ rows: FileRow[];
42
+ send: FileRow[];
43
+ };
44
+ export declare function send(r: FileRow, file: OnFile, about: Omit<Picked, "name" | "mime" | "size" | "progress" | "signal">, again: () => void): void;
45
+ export declare const scanner: () => Promise<typeof import("../../scan/index.ts")>;
46
+ export type ScanRow = FileRow & {
47
+ pages?: number;
48
+ };
49
+ export declare const scanHeld: (x: ScanField) => ScanRow[];
50
+ export declare const scanned: (x: ScanField, pdf: Blob, pages: number, first?: string) => ScanRow;
51
+ export declare function scanLine(r: ScanRow, w: Word): string;
52
+ export declare const scanHint: (x: ScanField, w: Word, on: boolean) => string;
53
+ export {};
@@ -0,0 +1,15 @@
1
+ export declare function hits(text: string, q: string): boolean;
2
+ export declare function typing(send: (q: string) => unknown, busy: (on: boolean) => void): {
3
+ key: (q: string) => void;
4
+ now: (q: string) => void;
5
+ };
6
+ type Blk = Record<string, unknown>;
7
+ export type Seek = {
8
+ name: string;
9
+ q: string;
10
+ n: number;
11
+ m: number;
12
+ };
13
+ export declare function said(r: unknown): string;
14
+ export declare function seeks(screen: unknown, state: Blk): Record<string, Seek>;
15
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { SliderField } from "../../gen/types.ts";
2
+ export declare const reads: (x: SliderField, n: number) => string;
3
+ export declare const along: (x: SliderField, n: number) => number;
@@ -0,0 +1,7 @@
1
+ import type { Scheme } from "../gen/schemes.ts";
2
+ export type Miss = {
3
+ what: string;
4
+ got: number;
5
+ min: number;
6
+ };
7
+ export declare function gate(s: Scheme, fills: "tint" | "outline" | "solid"): Miss[];
@@ -0,0 +1,53 @@
1
+ export declare const WORDS: readonly ["reorder", "move", "stretch", "edit", "draw", "remove"];
2
+ export type Word = (typeof WORDS)[number];
3
+ export type Phase<C> = {
4
+ at: "idle";
5
+ } | {
6
+ at: "pressed";
7
+ } | {
8
+ at: "dragging";
9
+ } | {
10
+ at: "previewing";
11
+ c: C;
12
+ } | {
13
+ at: "sent";
14
+ c: C;
15
+ } | {
16
+ at: "confirmed";
17
+ } | {
18
+ at: "refused";
19
+ why: string;
20
+ };
21
+ export type Event<C> = {
22
+ on: "press";
23
+ } | {
24
+ on: "move";
25
+ c?: C | null;
26
+ } | {
27
+ on: "release";
28
+ } | {
29
+ on: "cancel";
30
+ } | {
31
+ on: "answer";
32
+ ok: boolean;
33
+ why?: string | null;
34
+ } | {
35
+ on: "settled";
36
+ };
37
+ export type Effect<C> = "tap" | {
38
+ send: C;
39
+ };
40
+ export type Nudge = {
41
+ dir: "left" | "right" | "up" | "down";
42
+ big?: boolean;
43
+ };
44
+ export type Rules<B, G, R, C> = {
45
+ word(b: B, g: G): Word | null;
46
+ start(b: B, g: G): C | null;
47
+ candidate(b: B, g: G, r: R): C | null;
48
+ nudge(b: B, g: G, from: C, by: Nudge): C | null;
49
+ steps(b: B, g: G): [string, Nudge][];
50
+ says(b: B, g: G, c: C): string;
51
+ };
52
+ export declare const same: (a: unknown, b: unknown) => boolean;
53
+ export declare function step<C>(p: Phase<C>, e: Event<C>, start: C): [Phase<C>, Effect<C> | null];
@@ -0,0 +1,21 @@
1
+ export type * from "../gen/types.ts";
2
+ export * from "../gen/hooks.ts";
3
+ export * from "../gen/schemes.ts";
4
+ export { actionOf, evaluate, lit, start, view, type State, type View } from "./eval.ts";
5
+ export { figured, value } from "./text.ts";
6
+ export { columns, expect, named, role, tree } from "./tree.ts";
7
+ export { gate, type Miss } from "./gate.ts";
8
+ export { choose, css, gated, tiles, type Look, type Pair, type Scale } from "./look.ts";
9
+ export * as lookCode from "./code.ts";
10
+ export * from "../gen/builders.ts";
11
+ export { apply } from "./apply.ts";
12
+ export { ext, glyph, initial, roleWord } from "./kind/message.ts";
13
+ export { sideCount, sideIcon, sideTitle } from "./kind/sidebar.ts";
14
+ export { built, type Built } from "./built.ts";
15
+ export { share } from "./share.ts";
16
+ export { nonce } from "./nonce.ts";
17
+ export { actions, check, linkable } from "./check.ts";
18
+ export { hits, said, type Seek, seeks, typing } from "./field/match.ts";
19
+ export { along, reads } from "./field/slider.ts";
20
+ export { accepts, fill, held, hint, ids, pick, picked, refused, scanHeld, scanHint, scanLine, scanned, scanner, send, sized, status, waits, type FileRow, type FileState, type OnFile, type Picked, type ScanRow } from "./field/files.ts";
21
+ export type { Fault } from "../gen/shapes.ts";
@@ -0,0 +1,7 @@
1
+ import type { Boxplot, Fallback, PlotBox, Tone } from "../../gen/types.ts";
2
+ export declare const decimals: (v: number) => number;
3
+ export declare const colour: (tone: Tone | null | undefined) => string;
4
+ export declare function places(p: Boxplot): number;
5
+ export declare function axis(p: Boxplot): [number, number, number] | null;
6
+ export declare function says(p: Boxplot, x: PlotBox): string;
7
+ export declare function boxFallback(p: Boxplot): Fallback;
@@ -0,0 +1,18 @@
1
+ import type { Chart, PointMove, Series } from "../../gen/types.ts";
2
+ import type { Rules } from "../gesture.ts";
3
+ export type PointGrab = {
4
+ series: string;
5
+ at: string;
6
+ };
7
+ export type PointReach = {
8
+ steps: number;
9
+ };
10
+ export declare function nice(v: number): number;
11
+ export declare function decimals(x: number): number;
12
+ export declare function fixed(v: number, d: number): string;
13
+ export declare const isLine: (c: Chart, s: Series) => boolean;
14
+ export declare function axis(c: Chart): [number, number];
15
+ export declare function stepOf(c: Chart, s: Series): number;
16
+ export declare const money: (c: Chart) => string;
17
+ export declare function shown(c: Chart, s: Series, v: number): string;
18
+ export declare const chart: Rules<Chart, PointGrab, PointReach, PointMove>;
@@ -0,0 +1,44 @@
1
+ type Blk = Record<string, unknown>;
2
+ type Box = {
3
+ x: number;
4
+ y: number;
5
+ w: number;
6
+ h: number;
7
+ mx: number;
8
+ my: number;
9
+ };
10
+ export type Place = {
11
+ id: string;
12
+ cls: string;
13
+ at: Box;
14
+ name: string;
15
+ title: string;
16
+ aria: string;
17
+ tap: unknown;
18
+ timer: {
19
+ value: string;
20
+ } | null;
21
+ count: {
22
+ n: string;
23
+ note: {
24
+ cls: string;
25
+ text: string;
26
+ } | null;
27
+ } | null;
28
+ };
29
+ export type Plan = {
30
+ cls: string;
31
+ width: number;
32
+ height: number;
33
+ dot: {
34
+ cx: number;
35
+ cy: number;
36
+ } | null;
37
+ paths: {
38
+ d: string;
39
+ cls: string;
40
+ }[];
41
+ places: Place[];
42
+ };
43
+ export declare function diagrams(b: Blk): Plan[];
44
+ export {};
@@ -0,0 +1,40 @@
1
+ import type { Import, ImportColumn, ImportRow, ImportSheet } from "../../gen/types.ts";
2
+ export type Phase = "idle" | "up" | "upfail" | "reading" | "readfail" | "review" | "checking" | "ask" | "sending" | "done";
3
+ export type ImportState = {
4
+ phase: Phase;
5
+ id: string;
6
+ name: string;
7
+ size: number;
8
+ part: number;
9
+ why: string;
10
+ map: Record<string, string> | null;
11
+ sheet: string | null;
12
+ show: "all" | "errors";
13
+ open: boolean;
14
+ seq: number;
15
+ stop?: AbortController | undefined;
16
+ };
17
+ export type ImportView = {
18
+ phase: Phase | "off";
19
+ sheet: ImportSheet | null;
20
+ map: Record<string, string>;
21
+ bad: ImportRow[];
22
+ good: number;
23
+ shown: ImportRow[];
24
+ hidden: number;
25
+ missing: ImportColumn | undefined;
26
+ extra: string[];
27
+ got: number;
28
+ };
29
+ export declare const fresh: (b: Import) => ImportState;
30
+ export declare const say: (lang: string | null | undefined, key: string, v?: Record<string, string | number>) => string;
31
+ export declare const kinds: (b: Import) => string[];
32
+ export declare const over: (b: Import, size: number) => boolean;
33
+ export declare function view(b: Import, st: ImportState, on: boolean): ImportView;
34
+ export declare const sample: (c: ImportColumn, v: ImportView) => string;
35
+ export declare const values: (b: Import, st: ImportState) => {
36
+ file: string;
37
+ sheet: string | null;
38
+ map: Record<string, string>;
39
+ };
40
+ export declare function answered(st: ImportState, b: Import, ok: boolean): void;
@@ -0,0 +1,3 @@
1
+ import type { List } from "../../gen/types.ts";
2
+ import type { Rules } from "../gesture.ts";
3
+ export declare const list: Rules<List, string, number, string[]>;
@@ -0,0 +1,36 @@
1
+ import type { MarkKind, Media } from "../../gen/types.ts";
2
+ import type { Rules } from "../gesture.ts";
3
+ export type Spot = [number, number];
4
+ export type MarkChange = {
5
+ id?: string;
6
+ kind?: MarkKind;
7
+ at?: number[];
8
+ to?: number[];
9
+ text?: string;
10
+ group?: string;
11
+ };
12
+ export type Pen = {
13
+ tool: MarkKind;
14
+ at?: Spot;
15
+ text?: string;
16
+ group?: string;
17
+ };
18
+ export type MarkGrab = {
19
+ body: string;
20
+ } | {
21
+ start: string;
22
+ } | {
23
+ end: string;
24
+ } | {
25
+ remove: string;
26
+ } | {
27
+ draw: Pen;
28
+ };
29
+ export type MarkReach = {
30
+ from: Spot;
31
+ to: Spot;
32
+ };
33
+ export declare const said: (k: MarkKind) => string;
34
+ export declare const ninth: ([x, y]: Spot) => string;
35
+ export declare const named: (b: Media, id: string) => string | null;
36
+ export declare const media: Rules<Media, MarkGrab, MarkReach, MarkChange>;
@@ -0,0 +1,4 @@
1
+ export declare const glyph: (state: string) => string;
2
+ export declare const roleWord: (role: string) => string;
3
+ export declare const ext: (name: string) => [string, string];
4
+ export declare const initial: (name: string) => string;
@@ -0,0 +1,23 @@
1
+ import type { Modal } from "../../gen/types.ts";
2
+ import type { Rules } from "../gesture.ts";
3
+ export type Place = {
4
+ x: number;
5
+ y: number;
6
+ w: number;
7
+ h: number;
8
+ };
9
+ export type ModalGrab = "head" | "corner" | "edge" | "handle";
10
+ export type Framed = {
11
+ b: Modal;
12
+ at: Place;
13
+ vw: number;
14
+ vh: number;
15
+ };
16
+ export type ModalReach = {
17
+ dx: number;
18
+ dy: number;
19
+ };
20
+ export declare const variant: (b: Modal) => "dialog" | "alert" | "tool";
21
+ export declare function clamp(p: Place, vw: number, vh: number): Place;
22
+ export declare const gone: (f: Framed) => number;
23
+ export declare const modal: Rules<Framed, ModalGrab, ModalReach, Place>;
@@ -0,0 +1,22 @@
1
+ import type { Fallback, Op, Plot, Trace } from "../../gen/types.ts";
2
+ export type Points = Extract<Op, {
3
+ op: "points";
4
+ }>;
5
+ type PlotTick = {
6
+ at: number;
7
+ text: string;
8
+ odd: boolean;
9
+ };
10
+ export type PlotDrawn = {
11
+ x: [number, number];
12
+ y: [number, number];
13
+ xTicks: PlotTick[];
14
+ yTicks: PlotTick[];
15
+ lines: number[][];
16
+ last: string[];
17
+ band: string | null;
18
+ };
19
+ export declare function grow(series: Trace[], op: Points): Trace[] | undefined;
20
+ export declare function drawn(p: Plot): PlotDrawn;
21
+ export declare function fallback(p: Plot): Fallback;
22
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Op, Part } from "../../gen/types.ts";
2
+ export type Append = Extract<Op, {
3
+ op: "append";
4
+ }>;
5
+ export declare function grow(parts: Part[], op: Append): Part[] | undefined;
@@ -0,0 +1,7 @@
1
+ import type { SideBadge, Sidebar } from "../../gen/types.ts";
2
+ export declare const sideTitle: (b: Sidebar) => string;
3
+ export declare const sideIcon: (l: {
4
+ label: string;
5
+ icon?: string | null | undefined;
6
+ }) => [string, boolean];
7
+ export declare const sideCount: (b: SideBadge) => [string, string];
@@ -0,0 +1,26 @@
1
+ import type { Cell, Column, SortDir, Table, TableRow } from "../../gen/types.ts";
2
+ import type { Rules } from "../gesture.ts";
3
+ export type GridGrab = {
4
+ row: string;
5
+ column: string;
6
+ } | string;
7
+ export type CellEdit = {
8
+ row: string;
9
+ column: string;
10
+ value: Cell;
11
+ };
12
+ export type GridChange = CellEdit | string[];
13
+ export declare function shown(c: Column, v: Cell | undefined, thai?: boolean): string;
14
+ export declare function parse(c: Column, text: string): Cell | null;
15
+ export declare const editable: (b: Table, c: Column) => boolean;
16
+ export declare const named: (b: Table, r: TableRow) => string;
17
+ export declare function worked(b: Table, r: TableRow): TableRow;
18
+ export declare function chunks(order: string[], isHead: (id: string) => boolean): [string[], string[][]];
19
+ export declare const grid: Rules<Table, GridGrab, string | number, GridChange>;
20
+ export declare const atEnd: (c: Column) => boolean;
21
+ export declare const cellText: (c: Column, v: Cell | undefined, thai: boolean) => string;
22
+ export declare const sparkPoints: (v: number[]) => string;
23
+ export declare function sorted(rows: TableRow[], c?: Column, dir?: SortDir): TableRow[];
24
+ export declare const itemsOf: (rows: TableRow[], i: number) => TableRow[];
25
+ export declare function roles(cols: Column[]): string[];
26
+ export declare const cellRole: (b: Table, x: Column) => "" | "app" | "ed" | "fx";
@@ -0,0 +1,28 @@
1
+ import type { DaySpan, TimeBar, Timeline, TimeRow } from "../../gen/types.ts";
2
+ import type { Rules } from "../gesture.ts";
3
+ export type BarGrab = {
4
+ bar: string;
5
+ part: "body" | "start" | "end";
6
+ } | {
7
+ row: string;
8
+ };
9
+ export type Days = {
10
+ days: number;
11
+ from?: string | null;
12
+ };
13
+ export declare function day(s: string): number | null;
14
+ export declare const iso: (n: number) => string;
15
+ export declare const parts: (n: number) => {
16
+ date: number;
17
+ month: number;
18
+ year: number;
19
+ weekday: number;
20
+ };
21
+ export declare function words(start: string, end: string): string;
22
+ export declare function firstFree(t: Timeline, r: TimeRow): number | null;
23
+ export declare const timeline: Rules<Timeline, BarGrab, Days, DaySpan>;
24
+ export declare function lanes(bars: TimeBar[]): {
25
+ of: Map<string, number>;
26
+ n: number;
27
+ };
28
+ export declare const barName: (x: TimeBar) => string;
@@ -0,0 +1,9 @@
1
+ import type { LayoutEdit } from "../gen/layout.ts";
2
+ export type Tree = {
3
+ type: string;
4
+ id: string;
5
+ slots?: Record<string, Tree[]>;
6
+ };
7
+ export declare function stay(n: Tree, grabbed: string): LayoutEdit | null;
8
+ export declare function places(tree: Tree, slots: Record<string, string[]>, grabbed: string): LayoutEdit[];
9
+ export declare function drops(tree: Tree, slots: Record<string, string[]>, grabbed: string): LayoutEdit[];
@@ -0,0 +1,11 @@
1
+ import { type Mode, type Scale, type Scheme } from "../gen/schemes.ts";
2
+ export type Pair = Record<Mode, Scheme>;
3
+ export type { Scale };
4
+ declare const passed: unique symbol;
5
+ export type Look = Readonly<Pair> & {
6
+ readonly [passed]: true;
7
+ };
8
+ export declare function gated(pair: Pair): Look;
9
+ export declare function css(look: Scheme | Pair, style?: Scale): string;
10
+ export declare const tiles: string;
11
+ export declare const choose: (setting: string | null, dark: boolean, schemes?: Record<string, Scheme>) => Scheme;
@@ -0,0 +1 @@
1
+ export declare const nonce: () => string;
@@ -0,0 +1 @@
1
+ export declare function share<T>(prev: T | undefined, next: T): T;
@@ -0,0 +1,6 @@
1
+ import type { Cell, Column, TableRow } from "../gen/types.ts";
2
+ export declare const SIGN: Record<string, string>;
3
+ export declare const at: (r: TableRow, id: string) => Cell | undefined;
4
+ export declare const unit: (c: Column) => string | null | undefined;
5
+ export declare const number: (c: Column, v: number) => string;
6
+ export declare function total(c: Column, rows: TableRow[]): [string, string] | null;
@@ -0,0 +1,6 @@
1
+ export declare const figured: (s: string) => {
2
+ glyph: string;
3
+ word: string;
4
+ tone: string;
5
+ };
6
+ export declare function value(v: unknown): string;
@@ -0,0 +1,12 @@
1
+ import type { Block, TreeNode } from "../gen/types.ts";
2
+ import { type State } from "./eval.ts";
3
+ export type Blk = {
4
+ [k: string]: unknown;
5
+ };
6
+ export declare const isBlk: (v: unknown) => v is Blk;
7
+ export declare const blks: (v: unknown) => Blk[];
8
+ export declare const named: (b: Blk, t: string) => string;
9
+ export declare function columns(b: Blk): [Blk[], Blk[]] | null;
10
+ export declare function role(b: Blk, kind: string): string;
11
+ export declare function tree(screen: Block, kinds: readonly string[], state?: State): TreeNode;
12
+ export declare function expect(got: TreeNode | undefined, want: TreeNode, at?: string, out?: string[]): string[];
@@ -0,0 +1,2 @@
1
+ import type { TreeNode } from "./gen/types.ts";
2
+ export declare const dump: (root: Element) => TreeNode[];
@@ -0,0 +1,18 @@
1
+ import type { LayoutEdit, LayoutPlace, SizeClass } from "./gen/layout.ts";
2
+ import { type Tree } from "./core/layout.ts";
3
+ export type Editing = {
4
+ slots: Record<string, string[]>;
5
+ save: (e: LayoutEdit) => Promise<boolean | string>;
6
+ };
7
+ export type Placed = Omit<Tree, "slots"> & {
8
+ label?: string;
9
+ place: LayoutPlace;
10
+ slots?: Record<string, Placed[]>;
11
+ };
12
+ export declare const rows: (tree: Placed) => {
13
+ id: string;
14
+ depth: number;
15
+ label: string;
16
+ places: LayoutPlace[];
17
+ }[];
18
+ export declare function wire(list: HTMLElement, tree: Placed, size: SizeClass, o: Editing, refuse: (why: string) => void, done: () => void): () => void;