@qxuken/kui 0.1.0-alpha.40 → 0.1.0-alpha.42

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/index.js CHANGED
@@ -52,8 +52,12 @@ export function withEffects(model, ...effects) {
52
52
 
53
53
  // A frame crosses the boundary one way: JS encodes the tree into one
54
54
  // Float64Array + string table and the addon lowers it zero-copy. One encoder
55
- // serves every context — its buffers are consumed synchronously.
55
+ // serves every context — its buffers are consumed synchronously. Measuring
56
+ // has one of its own: a `<devtoolsTab>`'s function child is called in the
57
+ // middle of an encode, and a `measureText` there reset the frame's buffers
58
+ // under it ("binary frame must start with the root op").
56
59
  const encoder = createEncoder(native.protocol());
60
+ const measurer = createEncoder(native.protocol());
57
61
 
58
62
  // A prop name the schema does not know has no wire id, so it never crosses:
59
63
  // the encoder is the only side that can see it, and it reports what it
@@ -206,7 +210,7 @@ KuiWindow.prototype.setView = function setView(tree, window) {
206
210
  // it draws. A style name the schema does not know is reported like a
207
211
  // view's would be.
208
212
  function measureText(content, style, maxWidth) {
209
- const { stream, strings, unknown, unknownTokens } = encoder.encodeText(content, style, this[TOKENS]);
213
+ const { stream, strings, unknown, unknownTokens } = measurer.encodeText(content, style, this[TOKENS]);
210
214
  const m = this.measureTextBinary(stream, strings, maxWidth);
211
215
  reportUnknown(this, unknown, unknownTokens);
212
216
  return m;
package/jsx-runtime.d.ts CHANGED
@@ -164,7 +164,9 @@ export interface GradientProp {
164
164
  at?: [number, number];
165
165
  /** Two or more colours, each alone or as `[colour, position]` with the
166
166
  * position 0 to 1. Stops without one are spaced evenly between those
167
- * with; two at one position are a hard edge. */
167
+ * with; two at one position are a hard edge. A `$token` that misses
168
+ * is raised as `unknown-token` and its stop left out, so a gradient
169
+ * left with fewer than two draws nothing over the `bg`. */
168
170
  stops: (ColorProp | [ColorProp, number])[];
169
171
  }
170
172
 
@@ -301,7 +303,7 @@ export interface GeneratedSpecProps {
301
303
  focusable?: boolean;
302
304
  /** Space between children along the main axis. */
303
305
  gap?: LengthProp;
304
- /** A gradient painted over the node's `bg` and under its border and its children (`docs/adr/0042-a-gradient-is-an-image-the-core-paints.md`): `{ to: 'bottom', stops: [...] }` towards a side or a corner (`right`, `bottom left`, …; the default is `bottom`), `{ angle: 0.125, stops }` in turns clockwise from east, or `{ radial: true, at: [0.5, 0], stops }` out from a centre (fractions of the box, the middle by default) to its farthest corner. A stop is a colour — a `$token` too — or `[colour, position]` with the position 0 to 1; stops without one are spaced evenly between those with. Two stops at one position are a hard edge. The gradient is defined on the box's unit square and stretched to it, so a side or a corner is CSS's and any other `angle` runs corner to corner at an eighth of a turn whatever the box's aspect, where CSS's pixel-measured `45deg` does not. Stops mix in straight sRGB with the alpha premultiplied, as CSS's do. What it costs is one image quad: the core rasterizes each distinct gradient once into the glyph atlas — a 256-texel strip along an axis, a 128-texel square otherwise, within half an 8-bit level of the gradient computed per pixel for a linear one and 1.2 for a radial — keyed by the gradient and not the box, so a box that resizes and a thousand boxes that share one rasterize nothing, and a host that draws an image draws it; a gradient box costs about 55 ns over a flat one, so ten thousand of them are half a millisecond. A hard edge is as soft as the raster stretched to the box (a 256th of its length along a strip); stripes are boxes. It does not tween — `transition` eases the `bg` under it and `opacity` fades it — and `hoverBg` and the other state backgrounds replace `bg`, not the gradient; one that changes every frame is a raster a frame, and a shimmer is a `fragment`'s. Ignored on a `line`, a `polygon` and a `path`. Fewer than two stops are an error in JSX and Lua, as a malformed `keyframes` is, and draw nothing in Rust and C. */
306
+ /** A gradient painted over the node's `bg` and under its border and its children (`docs/adr/0042-a-gradient-is-an-image-the-core-paints.md`): `{ to: 'bottom', stops: [...] }` towards a side or a corner (`right`, `bottom left`, …; the default is `bottom`), `{ angle: 0.125, stops }` in turns clockwise from east, or `{ radial: true, at: [0.5, 0], stops }` out from a centre (fractions of the box, the middle by default) to its farthest corner. A stop is a colour — a `$token` too — or `[colour, position]` with the position 0 to 1; stops without one are spaced evenly between those with. Two stops at one position are a hard edge. The gradient is defined on the box's unit square and stretched to it, so a side or a corner is CSS's and any other `angle` runs corner to corner at an eighth of a turn whatever the box's aspect, where CSS's pixel-measured `45deg` does not. Stops mix in straight sRGB with the alpha premultiplied, as CSS's do. What it costs is one image quad: the core rasterizes each distinct gradient once into the glyph atlas — a 256-texel strip along an axis, a 128-texel square otherwise, within half an 8-bit level of the gradient computed per pixel for a linear one and 1.2 for a radial — keyed by the gradient and not the box, so a box that resizes and a thousand boxes that share one rasterize nothing, and a host that draws an image draws it; a gradient box costs about 55 ns over a flat one, so ten thousand of them are half a millisecond. A hard edge is as soft as the raster stretched to the box (a 256th of its length along a strip); stripes are boxes. It does not tween — `transition` eases the `bg` under it and `opacity` fades it — and `hoverBg` and the other state backgrounds replace `bg`, not the gradient; one that changes every frame is a raster a frame, and a shimmer is a `fragment`'s. Ignored on a `line`, a `polygon` and a `path`. Fewer than two stops are an error in JSX and Lua, as a malformed `keyframes` is, and draw nothing in Rust and C. A stop whose `$token` misses is not an error: it is raised as `unknown-token` and left out, as a miss leaves any slot unset, and the rest are spaced as if it had not been declared — so a gradient left with fewer than two stops, a two-stop one with a typo, draws nothing over its `bg` (backlog RG118). */
305
307
  gradient?: GradientProp;
306
308
  /** Vertical size: px | "fit" | "grow" | "N%" | a size expression (see `width`). */
307
309
  height?: SizingProp;
@@ -500,8 +502,10 @@ export interface CustomSpecProps {
500
502
  * once, so a later Tab press is not clobbered. `ctx.focus(key)` moves
501
503
  * focus at any time. */
502
504
  keyFocus?: boolean;
503
- /** Hover hint: a tooltip floated below this box while it is hovered
504
- * (implies hoverable). */
505
+ /** Hover hint: a tooltip floated below this node while it is hovered
506
+ * (implies hoverable) — as a box's last child, and beside a leaf that
507
+ * holds no children (`line`, `polygon`, `path`, `cells`, `image`,
508
+ * `edit`), anchored to it, below its box (backlog RG113). */
505
509
  tooltip?: string;
506
510
  /** Stable identity by *data* index rather than by name: the key
507
511
  * auto-keying would have given this node as the `i`th child, given to
@@ -546,6 +550,14 @@ export interface BoxProps extends Keyed, GeneratedSpecProps, CustomSpecProps {
546
550
  * Declare it every frame; the frame that stops gives the Option keys
547
551
  * back to the layout. Nothing elsewhere. */
548
552
  optionAsAlt?: 'none' | 'left' | 'right' | 'both';
553
+ /** Root box only: this window takes the keyboard as keys, with the
554
+ * platform's input method off (backlog F125) — no composition, and on
555
+ * a Mac no dead keys and no press-and-hold, so a held letter repeats
556
+ * instead of opening the accent picker. A key's `text` is still the
557
+ * layout's character. A modal editor's normal mode: declare it every
558
+ * frame the mode wants it; the frame that stops gives the IME, dead
559
+ * keys and accents back. */
560
+ imeOff?: boolean;
549
561
  /** Root box only: which windows exist besides the main one (see
550
562
  * `WindowDecl` in `@qxuken/kui`). `runWindowed` / `createApp` write it
551
563
  * from the loop config's `windows(model)`; a view driving a `Ctx` by
@@ -846,9 +858,11 @@ export declare namespace JSX {
846
858
  * gap]` for a dash-dot, in px **as seen** — every mark is
847
859
  * round-capped, so a mark no longer than the stroke is wide is a
848
860
  * dot (SVG's `stroke-dasharray` measures the centre line; this is
849
- * its `mark − width, gap + width`). The pattern runs along the
850
- * whole stroke, corners and curves included. A pattern with no
851
- * gap, or finer than a pixel, draws solid. */
861
+ * its `mark − width, gap + width`). A gap the dots overlap — a
862
+ * mark and its gap together no longer than the width — closes,
863
+ * and the marks either side of it are one. The pattern runs along
864
+ * the whole stroke, corners and curves included. A pattern with
865
+ * no gap left, or finer than a pixel, draws solid. */
852
866
  dash?: number | [number] | [number, number] | [number, number, number, number];
853
867
  /** How far into the pattern the stroke starts, in px: growing it
854
868
  * moves the marks towards the first point — a marquee's marching
@@ -938,9 +952,11 @@ export declare namespace JSX {
938
952
  * gap]` for a dash-dot, in px **as seen** — every mark is
939
953
  * round-capped, so a mark no longer than the stroke is wide is a
940
954
  * dot (SVG's `stroke-dasharray` measures the centre line; this is
941
- * its `mark − width, gap + width`). The pattern runs along the
942
- * outline, restarting at every subpath as SVG's does. A pattern with no
943
- * gap, or finer than a pixel, draws solid. */
955
+ * its `mark − width, gap + width`). A gap the dots overlap — a
956
+ * mark and its gap together no longer than the width — closes,
957
+ * and the marks either side of it are one. The pattern runs along
958
+ * the outline, restarting at every subpath as SVG's does. A
959
+ * pattern with no gap left, or finer than a pixel, draws solid. */
944
960
  dash?: number | [number] | [number, number] | [number, number, number, number];
945
961
  /** How far into the pattern the stroke starts, in px: growing it
946
962
  * moves the marks towards the first point — a marquee's marching
package/native.cjs CHANGED
@@ -107,10 +107,17 @@ if (native) {
107
107
  'KUI_NODE_LIB at a working library.',
108
108
  );
109
109
  } else {
110
+ // An Intel Mac had a prebuild until alpha.40 (as did an x64 Node under
111
+ // Rosetta on Apple silicon, which reads as the same platform), so it is
112
+ // told that, not left to guess whether the install went wrong.
113
+ const dropped =
114
+ process.platform === 'darwin' && process.arch === 'x64'
115
+ ? ' (Intel Macs, and an x64 Node under Rosetta, had one until 0.1.0-alpha.40 and build it from source since)'
116
+ : '';
110
117
  throw new Error(
111
- `kui native library not found for ${process.platform}-${process.arch} - ` +
112
- 'this package ships prebuilds for linux-x64, linux-arm64, darwin-arm64, ' +
113
- 'darwin-x64 and win32-x64; elsewhere run `cargo build -p kui-node --release` in the kui ' +
118
+ `kui native library not found for ${process.platform}-${process.arch}${dropped} - ` +
119
+ 'this package ships prebuilds for linux-x64, linux-arm64, darwin-arm64 ' +
120
+ 'and win32-x64; elsewhere run `cargo build -p kui-node --release` in the kui ' +
114
121
  'repo or point KUI_NODE_LIB at a built library.\nLooked in:\n ' +
115
122
  looked.join('\n '),
116
123
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qxuken/kui",
3
- "version": "0.1.0-alpha.40",
3
+ "version": "0.1.0-alpha.42",
4
4
  "description": "kui for Node: JSX views lowered into the kui IR, Elm-style messages as data",
5
5
  "license": "MIT",
6
6
  "repository": {
Binary file
Binary file
Binary file