@yaks/native 0.0.0-stage → 0.2.36

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/look.ts ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The native look a host reads through `paint`: the tags' defaults, and the
3
+ * style of each class the kit parts render (`Card`, `Card_Head`,
4
+ * `Button-go`), which each part carries beside its terminal `sheet` in
5
+ * @yaks/ui (`native`).
6
+ *
7
+ * @module
8
+ */
9
+
10
+ import { type Colors, type Composition, composition, native } from '@yaks/ui'
11
+ import type { Look } from './mod.ts'
12
+
13
+ export type { Colors }
14
+
15
+ /** The native look over a theme's colours, of the parts in `at`'s kits as
16
+ * its skin wears them, @yaks/ui's own composition by default. A
17
+ * white-labelled app themes it with data: its colours, and the composition
18
+ * it wears. */
19
+ export let look = (c: Colors, at: Composition = composition): Look => ({
20
+ tags: {
21
+ root: { flex: 1, backgroundColor: c.bg },
22
+ main: { padding: 16, gap: 16 },
23
+ h1: { fontSize: 28, fontWeight: '700', color: c.heading },
24
+ h2: { fontSize: 20, fontWeight: '600', color: c.heading },
25
+ h3: { fontSize: 17, fontWeight: '600', color: c.heading },
26
+ p: { fontSize: 16, color: c.text },
27
+ span: { color: c.text },
28
+ label: { fontSize: 16, color: c.text },
29
+ ul: { gap: 4 },
30
+ li: { fontSize: 16, color: c.text },
31
+ a: { color: c.link },
32
+ b: { fontWeight: '700' },
33
+ strong: { fontWeight: '700' },
34
+ em: { fontStyle: 'italic' },
35
+ code: { fontFamily: 'Menlo', fontSize: 14, color: c.literal },
36
+ pre: { fontFamily: 'Menlo', fontSize: 13, color: c.text },
37
+ details: { gap: 6 },
38
+ summary: { fontSize: 15, color: c.muted },
39
+ dl: { gap: 4 },
40
+ dt: { fontSize: 13, color: c.dim },
41
+ dd: { fontSize: 15, color: c.text, paddingLeft: 8 },
42
+ time: { fontSize: 12, color: c.dim },
43
+ form: { flexDirection: 'row', gap: 8, alignItems: 'center' },
44
+ button: {
45
+ paddingVertical: 10,
46
+ paddingHorizontal: 14,
47
+ borderRadius: 10,
48
+ color: c.accent,
49
+ fontSize: 16,
50
+ fontWeight: '600',
51
+ },
52
+ img: { width: 64, height: 64, borderRadius: 8 },
53
+ hr: { height: 1, backgroundColor: c.border, marginVertical: 8 },
54
+ table: { gap: 2 },
55
+ tr: { flexDirection: 'row', gap: 12 },
56
+ th: { flex: 1, fontSize: 13, fontWeight: '600', color: c.dim },
57
+ td: { flex: 1, fontSize: 15, color: c.text },
58
+ select: {
59
+ fontSize: 16,
60
+ color: c.text,
61
+ backgroundColor: c.surface,
62
+ borderColor: c.border,
63
+ borderWidth: 1,
64
+ borderRadius: 10,
65
+ paddingVertical: 10,
66
+ paddingHorizontal: 12,
67
+ },
68
+ input: {
69
+ flex: 1,
70
+ fontSize: 16,
71
+ color: c.text,
72
+ backgroundColor: c.surface,
73
+ borderColor: c.border,
74
+ borderWidth: 1,
75
+ borderRadius: 10,
76
+ paddingVertical: 10,
77
+ paddingHorizontal: 12,
78
+ },
79
+ },
80
+ classes: native({ ...at, theme: { ...at.theme, colors: c } }),
81
+ })
package/mod.js ADDED
@@ -0,0 +1,375 @@
1
+ /**
2
+ * @yaks/native: the kits' component tree, painted as native views. The host
3
+ * renders into @yaks/dom's in-memory DOM, as it does for a terminal; `paint`
4
+ * reads that tree into plain nodes a native host draws with its own widgets:
5
+ * a box, a run of text, a press, a field, a toggle, a pick, a drawing, an
6
+ * image, and what only a browser draws (`web`). It holds no widget and
7
+ * imports no platform, so it runs and is tested anywhere; the host (the iOS
8
+ * shell's `native/kit.tsx`) maps each node to a React Native view.
9
+ *
10
+ * A node's look is the merge of its tag's defaults and the native style of
11
+ * each class it wears, read from a {@link Look} (look.ts). What a press or a
12
+ * typed character means stays the app's: the node carries the act that
13
+ * delivers it to the element, as a browser's event would.
14
+ *
15
+ * @module
16
+ */ /* @ts-types="npm:@types/react@19.3.0" */ import { Component, createElement as h } from "react";
17
+ import { draw } from "@yaks/react/draw";
18
+ import { dispatch, install, onNavigate, onPaint, TText } from "@yaks/dom";
19
+ // Elements whose words run inline with their neighbours'.
20
+ let INLINE = new Set([
21
+ 'a',
22
+ 'abbr',
23
+ 'b',
24
+ 'br',
25
+ 'code',
26
+ 'em',
27
+ 'i',
28
+ 'kbd',
29
+ 'mark',
30
+ 'small',
31
+ 'span',
32
+ 'strong',
33
+ 'time'
34
+ ]);
35
+ // Elements that are never drawn.
36
+ let UNSEEN = new Set([
37
+ 'head',
38
+ 'link',
39
+ 'meta',
40
+ 'noscript',
41
+ 'script',
42
+ 'style',
43
+ 'template'
44
+ ]);
45
+ // Elements only a browser draws.
46
+ let WEB = new Set([
47
+ 'audio',
48
+ 'canvas',
49
+ 'embed',
50
+ 'iframe',
51
+ 'math',
52
+ 'object',
53
+ 'video'
54
+ ]);
55
+ let keys = new WeakMap();
56
+ let next = 0;
57
+ let keyOf = (n)=>{
58
+ let k = keys.get(n);
59
+ if (k == null) keys.set(n, k = ++next);
60
+ return k;
61
+ };
62
+ let elements = (n)=>n.childNodes.filter((c)=>!(c instanceof TText));
63
+ let styleOf = (el, look)=>Object.assign({}, look.tags[el.localName], ...el.className.split(' ').filter(Boolean).map((c)=>look.classes[c]));
64
+ // The style words take from the boxes around them, as a browser's text
65
+ // inherits its ink and size; a native box passes none on by itself.
66
+ let WORDS = [
67
+ 'color',
68
+ 'fontFamily',
69
+ 'fontSize',
70
+ 'fontStyle',
71
+ 'fontWeight',
72
+ 'letterSpacing',
73
+ 'lineHeight',
74
+ 'textAlign'
75
+ ];
76
+ let worn = (style)=>Object.fromEntries(Object.entries(style).filter(([k])=>WORDS.includes(k)));
77
+ // Whether an element takes a press: a button, a link, a summary (which opens
78
+ // its details), or anything the app listens to clicks on.
79
+ let pressable = (el)=>el.localName == 'button' || el.localName == 'summary' || el.hasAttribute('href') || el.hasAttribute('data-href') || el.handlers.has('click');
80
+ // What a closed `details` shows of what it holds: its summary alone.
81
+ let shut = (el, c)=>el.localName == 'details' && !el.hasAttribute('open') && (c instanceof TText || c.localName != 'summary');
82
+ // A press clicks it, which submits a submit button's form and flips a box,
83
+ // as a browser's click does (@yaks/dom).
84
+ let pressOf = (el)=>pressable(el) && !el.hasAttribute('disabled') ? ()=>el.click() : undefined;
85
+ // Whether everything inside is words: text nodes and inline elements only.
86
+ let worded = (el)=>el.childNodes.every((c)=>c instanceof TText || INLINE.has(c.localName) && worded(c));
87
+ let runs = (el, look)=>el.childNodes.map((c)=>c instanceof TText ? c.data : c.localName == 'br' ? '\n' : text(c, look, {}));
88
+ let text = (el, look, around)=>({
89
+ kind: 'text',
90
+ key: keyOf(el),
91
+ style: {
92
+ ...around,
93
+ ...styleOf(el, look)
94
+ },
95
+ runs: runs(el, look),
96
+ ...pressOf(el) && {
97
+ press: pressOf(el)
98
+ }
99
+ });
100
+ let event = (type, cancelable = false)=>new Event(type, {
101
+ bubbles: true,
102
+ cancelable
103
+ });
104
+ // Whether pressing it submits its form, as a button does unless it says
105
+ // otherwise.
106
+ let submits = (el)=>(el.getAttribute('type') ?? (el.localName == 'button' ? 'submit' : '')) == 'submit';
107
+ // The keyboard each kind of entry brings up, by its `inputmode` or `type`.
108
+ let KEYBOARDS = {
109
+ email: 'email-address',
110
+ numeric: 'numeric',
111
+ number: 'decimal-pad',
112
+ decimal: 'decimal-pad',
113
+ tel: 'phone-pad',
114
+ url: 'url',
115
+ search: 'web-search'
116
+ };
117
+ // The return key each `enterkeyhint` names; `enter` and `previous` have no
118
+ // iOS key of their own.
119
+ let RETURNS = {
120
+ done: 'done',
121
+ go: 'go',
122
+ next: 'next',
123
+ search: 'search',
124
+ send: 'send'
125
+ };
126
+ // Entries a person types exactly, which take no capital and no correction.
127
+ let EXACT = new Set([
128
+ 'email',
129
+ 'url',
130
+ 'password',
131
+ 'tel',
132
+ 'number'
133
+ ]);
134
+ /** How a field's keyboard behaves: what it takes, as its attributes say,
135
+ * and whether submitting keeps it up (a form with a submit button does, so
136
+ * one entry follows another, as a list's "add" field does on iOS). */ export let traits = (el)=>{
137
+ let a = (k)=>el.getAttribute(k) ?? undefined;
138
+ let type = el.localName == 'textarea' ? 'textarea' : a('type') ?? 'text';
139
+ let keyboard = KEYBOARDS[a('inputmode') ?? ''] ?? KEYBOARDS[type];
140
+ let form = el.closest('form');
141
+ let exact = EXACT.has(type) || EXACT.has(a('inputmode') ?? '');
142
+ let caps = a('autocapitalize');
143
+ return {
144
+ ...keyboard && {
145
+ keyboardType: keyboard
146
+ },
147
+ ...type == 'password' && {
148
+ secureTextEntry: true
149
+ },
150
+ returnKeyType: RETURNS[a('enterkeyhint') ?? ''] ?? (type == 'search' ? 'search' : 'done'),
151
+ ...(caps ?? exact) && {
152
+ autoCapitalize: caps ?? 'none'
153
+ },
154
+ ...exact && {
155
+ autoCorrect: false
156
+ },
157
+ ...a('autocomplete') && {
158
+ autoComplete: a('autocomplete')
159
+ },
160
+ ...el.hasAttribute('autofocus') && {
161
+ autoFocus: true
162
+ },
163
+ ...(el.hasAttribute('disabled') || el.hasAttribute('readonly')) && {
164
+ editable: false
165
+ },
166
+ submitBehavior: type == 'textarea' ? 'newline' : form?.querySelectorAll('button,input').some(submits) ? 'submit' : 'blurAndSubmit'
167
+ };
168
+ };
169
+ let field = (el, look)=>({
170
+ kind: 'field',
171
+ key: keyOf(el),
172
+ style: styleOf(el, look),
173
+ value: el.value,
174
+ placeholder: el.getAttribute('placeholder') ?? '',
175
+ lines: el.localName == 'textarea',
176
+ traits: traits(el),
177
+ type: (typed)=>{
178
+ el.value = typed;
179
+ dispatch(el, event('input'));
180
+ },
181
+ submit: ()=>{
182
+ let form = el.closest('form');
183
+ if (form) dispatch(form, event('submit', true));
184
+ else {
185
+ dispatch(el, Object.assign(event('keydown', true), {
186
+ key: 'Enter'
187
+ }));
188
+ }
189
+ }
190
+ });
191
+ let toggle = (el, label, look)=>({
192
+ kind: 'toggle',
193
+ key: keyOf(el),
194
+ style: styleOf(el, look),
195
+ on: el.checked,
196
+ label,
197
+ flip: ()=>el.click()
198
+ });
199
+ let words = (n)=>n instanceof TText ? n.data : n.childNodes.map(words).join('');
200
+ let options = (el)=>elements(el).flatMap((k)=>k.localName == 'optgroup' ? elements(k) : [
201
+ k
202
+ ]).filter((k)=>k.localName == 'option');
203
+ let pick = (el, look)=>{
204
+ let all = options(el).map((o)=>({
205
+ value: o.getAttribute('value') ?? words(o),
206
+ label: words(o).trim(),
207
+ selected: o.hasAttribute('selected')
208
+ }));
209
+ let value = el.getAttribute('value');
210
+ let chosen = all.find((o)=>o.value == value) ?? all.find((o)=>o.selected) ?? all[0];
211
+ return {
212
+ kind: 'pick',
213
+ key: keyOf(el),
214
+ style: styleOf(el, look),
215
+ value: chosen?.value ?? '',
216
+ options: all.map(({ value, label })=>({
217
+ value,
218
+ label
219
+ })),
220
+ disabled: el.hasAttribute('disabled'),
221
+ choose: (v)=>{
222
+ el.value = v;
223
+ dispatch(el, event('input'));
224
+ dispatch(el, event('change'));
225
+ }
226
+ };
227
+ };
228
+ let attrsOf = (el)=>Object.fromEntries(el.getAttributeNames().map((k)=>[
229
+ k,
230
+ el.getAttribute(k) ?? ''
231
+ ]));
232
+ let shape = (el, look)=>({
233
+ tag: el.localName,
234
+ attrs: attrsOf(el),
235
+ style: styleOf(el, look),
236
+ shapes: elements(el).map((c)=>shape(c, look))
237
+ });
238
+ let drawing = (el, look, around)=>({
239
+ kind: 'drawing',
240
+ key: keyOf(el),
241
+ style: {
242
+ ...worn(around),
243
+ ...styleOf(el, look)
244
+ },
245
+ attrs: attrsOf(el),
246
+ shapes: elements(el).map((c)=>shape(c, look))
247
+ });
248
+ let isBox = (el, type)=>el.localName == 'input' && (el.getAttribute('type') ?? 'text') == type;
249
+ /** Paint one element and what it holds as native nodes; a text node beside
250
+ * elements becomes a text of its own, since a native box holds no bare
251
+ * words. */ export let paint = (el, look, around = {})=>{
252
+ // A popover is closed until a press opens it, which a paint never is.
253
+ if (UNSEEN.has(el.localName) || el.hasAttribute('hidden') || el.hasAttribute('popover')) return null;
254
+ if (WEB.has(el.localName)) {
255
+ return {
256
+ kind: 'web',
257
+ key: keyOf(el),
258
+ style: styleOf(el, look),
259
+ tag: el.localName,
260
+ words: el.getAttribute('aria-label') ?? el.getAttribute('title') ?? words(el).trim()
261
+ };
262
+ }
263
+ if (el.localName == 'svg') return drawing(el, look, around);
264
+ if (el.localName == 'img') {
265
+ return {
266
+ kind: 'image',
267
+ key: keyOf(el),
268
+ style: styleOf(el, look),
269
+ uri: el.getAttribute('src') ?? '',
270
+ alt: el.getAttribute('alt') ?? ''
271
+ };
272
+ }
273
+ if (el.localName == 'select') return pick(el, look);
274
+ if (isBox(el, 'checkbox') || isBox(el, 'radio')) return toggle(el, [], look);
275
+ if (el.localName == 'input' || el.localName == 'textarea') {
276
+ return field(el, look);
277
+ }
278
+ // A label around a box and its words is one toggle, its words the label.
279
+ let box = elements(el).find((c)=>isBox(c, 'checkbox') || isBox(c, 'radio'));
280
+ if (el.localName == 'label' && box) {
281
+ let words = el.childNodes.filter((c)=>c != box);
282
+ return {
283
+ ...toggle(box, [], look),
284
+ style: {
285
+ ...around,
286
+ ...styleOf(el, look)
287
+ },
288
+ label: words.map((c)=>c instanceof TText ? c.data : text(c, look, {}))
289
+ };
290
+ }
291
+ if (el.childNodes.length && worded(el)) return text(el, look, around);
292
+ let style = styleOf(el, look);
293
+ let inner = {
294
+ ...around,
295
+ ...worn(style)
296
+ };
297
+ return {
298
+ kind: 'box',
299
+ key: keyOf(el),
300
+ style,
301
+ children: el.childNodes.flatMap((c)=>{
302
+ if (shut(el, c)) return [];
303
+ if (c instanceof TText) {
304
+ return c.data.trim() ? [
305
+ {
306
+ kind: 'text',
307
+ key: keyOf(c),
308
+ style: inner,
309
+ runs: [
310
+ c.data
311
+ ]
312
+ }
313
+ ] : [];
314
+ }
315
+ let n = paint(c, look, inner);
316
+ return n ? [
317
+ n
318
+ ] : [];
319
+ }),
320
+ ...pressOf(el) && {
321
+ press: pressOf(el)
322
+ }
323
+ };
324
+ };
325
+ // What a view that threw paints: a notice that it is on the app's web page,
326
+ // with what went wrong.
327
+ let broken = (e)=>({
328
+ kind: 'web',
329
+ key: 0,
330
+ style: {},
331
+ tag: 'error',
332
+ words: String(e?.message ?? e)
333
+ });
334
+ // Catches what the tree throws while rendering, so a view that breaks shows
335
+ // its notice instead of taking the host down with it.
336
+ class Kept extends Component {
337
+ componentDidCatch(e) {
338
+ this.props.fell(e);
339
+ }
340
+ render() {
341
+ return this.props.children;
342
+ }
343
+ }
344
+ /** Render a tree into the in-memory DOM and hand `drawn` its painted nodes
345
+ * after every change, as a terminal repaints; the answer unmounts it. The
346
+ * DOM is one per process, so one tree is mounted at a time. A tree that
347
+ * throws while it renders paints as a {@link Web} notice saying so, and
348
+ * `fell` hears what it threw; a pressed link no listener took is `follow`ed,
349
+ * as a browser loads it. */ export let mount = (node, look, drawn, { fell = console.error, follow = ()=>{} } = {})=>{
350
+ let { root, free } = install();
351
+ let stop;
352
+ let fault = null;
353
+ let fall = (e)=>{
354
+ fault = broken(e);
355
+ fell(e);
356
+ drawn(fault);
357
+ };
358
+ onPaint(()=>drawn(fault ?? paint(root, look)));
359
+ onNavigate(follow);
360
+ try {
361
+ stop = draw(/*#__PURE__*/ h(Kept, {
362
+ fell: fall
363
+ }, node), root);
364
+ } catch (e) {
365
+ fall(e);
366
+ }
367
+ return ()=>{
368
+ stop?.();
369
+ onPaint(()=>{});
370
+ onNavigate(()=>{});
371
+ free();
372
+ };
373
+ };
374
+ export { look } from "./look.js";
375
+ //# sourceMappingURL=mod.js.map
package/mod.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sources":["./mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,uCAAuC,GAAG,SAAS,SAAS,EAAE,iBAAiB,CAAC,gBAA0C;AAC1H,SAAS,IAAI,gCAAqC;AAClD,SACE,QAAQ,EACR,OAAO,EACP,UAAU,EACV,OAAO,EAGP,KAAK,yBACsB;AAqI7B,0DAA0D;AAC1D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