@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,64 @@
1
+ import type { Block, Boxplot, Button, Card, Chart, Chips, Choice, Composer, Diagram, Diff, Editor, Expr, Form, Glance, Heat, Hero, Images, Import, Island, Kind, Lines, List, Match, Media, Message, Modal, Nav, Pages, Plot, Prose, Row, Run, Scene, Screen, Secret, Section, Sidebar, Stat, Steps, Table, Text, Timeline, Toast, Tool, Web } from "./types.ts";
2
+ export type Of<K extends Kind> = Extract<Block, {
3
+ type: K;
4
+ }>;
5
+ export declare const screen: (fields: Screen) => Of<"screen">;
6
+ export declare const modal: (fields: Modal) => Of<"modal">;
7
+ export declare const sheet: (fields: Modal) => Of<"sheet">;
8
+ export declare const section: (fields: Section) => Of<"section">;
9
+ export declare const list: (fields: List) => Of<"list">;
10
+ export declare const row: (fields: Row) => Of<"row">;
11
+ export declare const card: (fields: Card) => Of<"card">;
12
+ export declare const choice: (fields: Choice) => Of<"choice">;
13
+ export declare const form: (fields: Form) => Of<"form">;
14
+ export declare const config: (fields: Form) => Of<"config">;
15
+ export declare const secret: (fields: Secret) => Of<"secret">;
16
+ export declare const run: (fields: Run) => Of<"run">;
17
+ export declare const button: (fields: Button) => Of<"button">;
18
+ export declare const chips: (fields: Chips) => Of<"chips">;
19
+ export declare const stat: (fields: Stat) => Of<"stat">;
20
+ export declare const text: (fields: Text) => Of<"text">;
21
+ export declare const images: (fields: Images) => Of<"images">;
22
+ export declare const web: (fields: Web) => Of<"web">;
23
+ export declare const diff: (fields: Diff) => Of<"diff">;
24
+ export declare const editor: (fields: Editor) => Of<"editor">;
25
+ export declare const scene: (fields: Scene) => Of<"scene">;
26
+ export declare const diagram: (fields: Diagram) => Of<"diagram">;
27
+ export declare const composer: (fields: Composer) => Of<"composer">;
28
+ export declare const lines: (fields: Lines) => Of<"lines">;
29
+ export declare const prose: (fields: Prose) => Of<"prose">;
30
+ export declare const hero: (fields: Hero) => Of<"hero">;
31
+ export declare const media: (fields: Media) => Of<"media">;
32
+ export declare const nav: (fields: Nav) => Of<"nav">;
33
+ export declare const island: (fields: Island) => Of<"island">;
34
+ export declare const table: (fields: Table) => Of<"table">;
35
+ export declare const steps: (fields: Steps) => Of<"steps">;
36
+ export declare const chart: (fields: Chart) => Of<"chart">;
37
+ export declare const toast: (fields: Toast) => Of<"toast">;
38
+ export declare const pages: (fields: Pages) => Of<"pages">;
39
+ export declare const timeline: (fields: Timeline) => Of<"timeline">;
40
+ export declare const import_: (fields: Import) => Of<"import">;
41
+ export declare const message: (fields: Message) => Of<"message">;
42
+ export declare const tool: (fields: Tool) => Of<"tool">;
43
+ export declare const sidebar: (fields: Sidebar) => Of<"sidebar">;
44
+ export declare const boxplot: (fields: Boxplot) => Of<"boxplot">;
45
+ export declare const heat: (fields: Heat) => Of<"heat">;
46
+ export declare const plot: (fields: Plot) => Of<"plot">;
47
+ export declare const glance: (fields: Glance) => Of<"glance">;
48
+ export declare const expr: {
49
+ get: (v: string) => Expr;
50
+ not: (v: Expr) => Expr;
51
+ all: (...v: Expr[]) => Expr;
52
+ any: (...v: Expr[]) => Expr;
53
+ eq: (...v: Expr[]) => Expr;
54
+ lt: (...v: Expr[]) => Expr;
55
+ len: (v: Expr) => Expr;
56
+ has: (...v: Expr[]) => Expr;
57
+ is: (v: Match) => Expr;
58
+ add: (...v: Expr[]) => Expr;
59
+ sub: (...v: Expr[]) => Expr;
60
+ mul: (...v: Expr[]) => Expr;
61
+ div: (...v: Expr[]) => Expr;
62
+ cat: (...v: Expr[]) => Expr;
63
+ pick: (...v: Expr[]) => Expr;
64
+ };
@@ -0,0 +1,2 @@
1
+ import type { FieldView } from "../render/field/_view.ts";
2
+ export declare const views: Record<string, FieldView | undefined>;
@@ -0,0 +1,11 @@
1
+ import type { Kind } from "./types.ts";
2
+ export type Hook = {
3
+ variant: string | null;
4
+ parts: readonly string[];
5
+ };
6
+ export declare const hooks: Record<Kind, Hook>;
7
+ export declare const roles: Record<string, string>;
8
+ export declare const names: readonly ["label", "title", "header", "question", "alt", "file", "command", "placeholder", "name"];
9
+ export declare const hosts: Record<string, string>;
10
+ export declare const walked: readonly ["blocks", "rows", "buttons", "rounds", "lanes"];
11
+ export declare const finishes: readonly ["surface", "tint", "button", "mark", "kind-label", "header-label", "group-label", "section-label", "title-label", "button-label", "chip-label", "back-label", "said-label", "picked-label", "screen-label"];
@@ -0,0 +1,9 @@
1
+ import type { Block, Kind } from "./types.ts";
2
+ import type { Ctx } from "../render/ctx.ts";
3
+ export type Of<K extends Kind> = Extract<Block, {
4
+ type: K;
5
+ }>;
6
+ export declare const R: {
7
+ [K in Kind]: (b: Of<K>, c: Ctx) => HTMLElement | null;
8
+ };
9
+ export declare const native: readonly Kind[];
@@ -0,0 +1,19 @@
1
+ export type LayoutEdit = {
2
+ edit: "move";
3
+ before?: string | null;
4
+ id: string;
5
+ into: string;
6
+ slot: string;
7
+ } | {
8
+ edit: "swap";
9
+ a: string;
10
+ b: string;
11
+ } | {
12
+ edit: "show";
13
+ id: string;
14
+ place: LayoutPlace;
15
+ size: SizeClass;
16
+ };
17
+ export type LayoutPlace = "push" | "sheet" | "panel" | "column" | "strip" | "cards" | "menu" | "inline" | "hidden";
18
+ export type SizeClass = "compact" | "wide";
19
+ export type LayoutTransition = "push" | "sheet" | "fade" | "none";
@@ -0,0 +1,73 @@
1
+ export type Mode = "dark" | "light";
2
+ export type Token = "--bg" | "--card" | "--edge" | "--line" | "--scrim" | "--fg" | "--mute" | "--l" | "--link" | "--g" | "--a" | "--r" | "--p" | "--c" | "--fk-l" | "--fk-p" | "--fk-c" | "--fk-g" | "--fk-a";
3
+ export type Scheme = {
4
+ label: string;
5
+ "color-scheme": Mode;
6
+ tokens: Record<Token, string>;
7
+ };
8
+ export declare const defaultPair: Record<Mode, Scheme>;
9
+ export declare const defaultStyle: Record<string, string>;
10
+ export declare const rules: {
11
+ type: {
12
+ default: string;
13
+ mono: string;
14
+ serif: string;
15
+ };
16
+ surface: {
17
+ glass: string;
18
+ dashed: string;
19
+ solid: string;
20
+ };
21
+ fills: {
22
+ tint: string;
23
+ outline: string;
24
+ solid: string;
25
+ };
26
+ buttons: {
27
+ plain: string;
28
+ filled: string;
29
+ };
30
+ marks: {
31
+ symbols: string;
32
+ text: string;
33
+ };
34
+ sections: {
35
+ title: string;
36
+ quiet: string;
37
+ };
38
+ };
39
+ export declare const curves: {
40
+ standard: string;
41
+ calm: string;
42
+ bouncy: string;
43
+ };
44
+ export declare const cases: {
45
+ "as-is": string;
46
+ lower: string;
47
+ upper: string;
48
+ };
49
+ export declare const drawn: {
50
+ header: string;
51
+ section: string;
52
+ title: string;
53
+ button: string;
54
+ chip: string;
55
+ picked: string;
56
+ screen: string;
57
+ };
58
+ type Label = {
59
+ prefix?: string;
60
+ suffix?: string;
61
+ case?: keyof typeof cases;
62
+ };
63
+ export type Axes = {
64
+ [K in keyof typeof rules]?: keyof (typeof rules)[K];
65
+ };
66
+ export type Scale = Axes & {
67
+ space?: number;
68
+ motion?: number;
69
+ radius?: number;
70
+ easing?: keyof typeof curves;
71
+ labels?: Record<string, Label>;
72
+ };
73
+ export {};
@@ -0,0 +1,61 @@
1
+ export type Fault = {
2
+ fault: "twice";
3
+ at: string[];
4
+ id: string;
5
+ } | {
6
+ fault: "act-twice";
7
+ action: string;
8
+ at: string[];
9
+ block: string;
10
+ } | {
11
+ fault: "unnamed";
12
+ kind: string;
13
+ } | {
14
+ fault: "unknown";
15
+ kind: string;
16
+ } | {
17
+ fault: "shape";
18
+ kind: string;
19
+ why: string;
20
+ } | {
21
+ fault: "extra";
22
+ field: string;
23
+ kind: string;
24
+ } | {
25
+ fault: "clash";
26
+ kind: string;
27
+ } | {
28
+ fault: "bare";
29
+ id: string;
30
+ kind: string;
31
+ } | {
32
+ fault: "state";
33
+ key: string;
34
+ } | {
35
+ fault: "link";
36
+ at: string;
37
+ url: string;
38
+ } | {
39
+ fault: "aim";
40
+ field: string;
41
+ id: string;
42
+ };
43
+ export type Shape = boolean | {
44
+ type?: string | string[];
45
+ $ref?: string;
46
+ properties?: Record<string, Shape>;
47
+ required?: string[];
48
+ anyOf?: Shape[];
49
+ oneOf?: Shape[];
50
+ items?: Shape;
51
+ additionalProperties?: Shape;
52
+ const?: unknown;
53
+ enum?: unknown[];
54
+ not?: Shape;
55
+ minimum?: number;
56
+ maximum?: number;
57
+ minItems?: number;
58
+ maxItems?: number;
59
+ };
60
+ export declare const kinds: Record<string, string>;
61
+ export declare const defs: Record<string, Shape>;