@react-x11/components 0.10.0 → 0.12.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.
- package/dist/code/index.d.ts.map +1 -1
- package/dist/code/index.js +25 -24
- package/dist/code/index.js.map +1 -1
- package/dist/code-language/index.d.ts +1 -1
- package/dist/code-language/index.d.ts.map +1 -1
- package/dist/code-language/index.js +1 -1
- package/dist/code-language/index.js.map +1 -1
- package/dist/code-language/runs.d.ts +31 -0
- package/dist/code-language/runs.d.ts.map +1 -1
- package/dist/code-language/runs.js +105 -0
- package/dist/code-language/runs.js.map +1 -1
- package/dist/codeblock/index.d.ts +13 -0
- package/dist/codeblock/index.d.ts.map +1 -1
- package/dist/codeblock/index.js +37 -1
- package/dist/codeblock/index.js.map +1 -1
- package/dist/flow/node.d.ts +14 -6
- package/dist/flow/node.d.ts.map +1 -1
- package/dist/flow/node.js +82 -64
- package/dist/flow/node.js.map +1 -1
- package/dist/html/controls.d.ts +26 -7
- package/dist/html/controls.d.ts.map +1 -1
- package/dist/html/controls.js +28 -3
- package/dist/html/controls.js.map +1 -1
- package/dist/html/css/cascade.d.ts +32 -10
- package/dist/html/css/cascade.d.ts.map +1 -1
- package/dist/html/css/cascade.js +89 -31
- package/dist/html/css/cascade.js.map +1 -1
- package/dist/html/css/color.d.ts +19 -0
- package/dist/html/css/color.d.ts.map +1 -1
- package/dist/html/css/color.js +86 -0
- package/dist/html/css/color.js.map +1 -1
- package/dist/html/css/parse.d.ts +11 -0
- package/dist/html/css/parse.d.ts.map +1 -1
- package/dist/html/css/parse.js +114 -4
- package/dist/html/css/parse.js.map +1 -1
- package/dist/html/css/style.d.ts +45 -5
- package/dist/html/css/style.d.ts.map +1 -1
- package/dist/html/css/style.js +363 -14
- package/dist/html/css/style.js.map +1 -1
- package/dist/html/css/ua.js +22 -5
- package/dist/html/css/ua.js.map +1 -1
- package/dist/html/css/values.d.ts +10 -1
- package/dist/html/css/values.d.ts.map +1 -1
- package/dist/html/css/values.js +27 -2
- package/dist/html/css/values.js.map +1 -1
- package/dist/html/css/vars.d.ts +5 -0
- package/dist/html/css/vars.d.ts.map +1 -1
- package/dist/html/css/vars.js +2 -2
- package/dist/html/css/vars.js.map +1 -1
- package/dist/html/dom.d.ts.map +1 -1
- package/dist/html/dom.js +35 -2
- package/dist/html/dom.js.map +1 -1
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +38 -1
- package/dist/html/index.js.map +1 -1
- package/dist/html/layout/block.d.ts +11 -2
- package/dist/html/layout/block.d.ts.map +1 -1
- package/dist/html/layout/block.js +306 -25
- package/dist/html/layout/block.js.map +1 -1
- package/dist/html/layout/boxes.d.ts +61 -6
- package/dist/html/layout/boxes.d.ts.map +1 -1
- package/dist/html/layout/boxes.js +65 -16
- package/dist/html/layout/boxes.js.map +1 -1
- package/dist/html/layout/cache.d.ts +2 -2
- package/dist/html/layout/cache.d.ts.map +1 -1
- package/dist/html/layout/cache.js +8 -3
- package/dist/html/layout/cache.js.map +1 -1
- package/dist/html/layout/floats.d.ts +4 -0
- package/dist/html/layout/floats.d.ts.map +1 -1
- package/dist/html/layout/floats.js +26 -0
- package/dist/html/layout/floats.js.map +1 -1
- package/dist/html/layout/inline.d.ts +29 -2
- package/dist/html/layout/inline.d.ts.map +1 -1
- package/dist/html/layout/inline.js +1454 -125
- package/dist/html/layout/inline.js.map +1 -1
- package/dist/html/node.d.ts +33 -0
- package/dist/html/node.d.ts.map +1 -1
- package/dist/html/node.js +608 -86
- package/dist/html/node.js.map +1 -1
- package/dist/html/paint.d.ts +53 -1
- package/dist/html/paint.d.ts.map +1 -1
- package/dist/html/paint.js +746 -214
- package/dist/html/paint.js.map +1 -1
- package/dist/html/surfaces.d.ts +7 -2
- package/dist/html/surfaces.d.ts.map +1 -1
- package/dist/html/surfaces.js +16 -0
- package/dist/html/surfaces.js.map +1 -1
- package/dist/html/svg.d.ts.map +1 -1
- package/dist/html/svg.js +27 -20
- package/dist/html/svg.js.map +1 -1
- package/dist/internal/codelines.d.ts +42 -0
- package/dist/internal/codelines.d.ts.map +1 -0
- package/dist/internal/codelines.js +170 -0
- package/dist/internal/codelines.js.map +1 -0
- package/dist/internal/window.d.ts +22 -0
- package/dist/internal/window.d.ts.map +1 -1
- package/dist/internal/window.js +35 -8
- package/dist/internal/window.js.map +1 -1
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +98 -26
- package/dist/markdown/index.js.map +1 -1
- package/dist/rich-text-editor/index.d.ts.map +1 -1
- package/dist/rich-text-editor/index.js +3 -8
- package/dist/rich-text-editor/index.js.map +1 -1
- package/dist/rich-text-editor/markdown.d.ts.map +1 -1
- package/dist/rich-text-editor/markdown.js +30 -1
- package/dist/rich-text-editor/markdown.js.map +1 -1
- package/dist/rich-text-editor/replace.d.ts +13 -0
- package/dist/rich-text-editor/replace.d.ts.map +1 -0
- package/dist/rich-text-editor/replace.js +64 -0
- package/dist/rich-text-editor/replace.js.map +1 -0
- package/dist/richtext/node.d.ts +7 -0
- package/dist/richtext/node.d.ts.map +1 -1
- package/dist/richtext/node.js.map +1 -1
- package/dist/terminal-output/index.d.ts.map +1 -1
- package/dist/terminal-output/index.js +100 -25
- package/dist/terminal-output/index.js.map +1 -1
- package/dist/terminal-output/runs.d.ts +4 -1
- package/dist/terminal-output/runs.d.ts.map +1 -1
- package/dist/terminal-output/runs.js +5 -1
- package/dist/terminal-output/runs.js.map +1 -1
- package/package.json +5 -3
- package/src/code/index.ts +34 -32
- package/src/code-language/index.ts +1 -1
- package/src/code-language/runs.ts +111 -1
- package/src/codeblock/index.ts +48 -1
- package/src/flow/node.ts +80 -64
- package/src/html/controls.ts +50 -9
- package/src/html/css/cascade.ts +134 -43
- package/src/html/css/color.ts +87 -0
- package/src/html/css/parse.ts +107 -4
- package/src/html/css/style.ts +386 -23
- package/src/html/css/ua.ts +22 -5
- package/src/html/css/values.ts +31 -3
- package/src/html/css/vars.ts +2 -2
- package/src/html/dom.ts +38 -2
- package/src/html/index.ts +39 -1
- package/src/html/layout/block.ts +360 -22
- package/src/html/layout/boxes.ts +98 -23
- package/src/html/layout/cache.ts +8 -3
- package/src/html/layout/floats.ts +24 -0
- package/src/html/layout/inline.ts +1690 -119
- package/src/html/node.ts +648 -101
- package/src/html/paint.ts +883 -283
- package/src/html/surfaces.ts +21 -1
- package/src/html/svg.ts +30 -19
- package/src/internal/codelines.ts +200 -0
- package/src/internal/window.ts +36 -8
- package/src/markdown/index.ts +145 -26
- package/src/rich-text-editor/index.ts +3 -11
- package/src/rich-text-editor/markdown.ts +36 -1
- package/src/rich-text-editor/replace.ts +85 -0
- package/src/richtext/node.ts +7 -0
- package/src/terminal-output/index.ts +127 -34
- package/src/terminal-output/runs.ts +16 -2
package/dist/flow/node.js
CHANGED
|
@@ -111,14 +111,28 @@ const VISUAL_PROPS = [
|
|
|
111
111
|
/** The clock, through `globalThis`: `src/` compiles with `types: []`. */
|
|
112
112
|
const clock = globalThis;
|
|
113
113
|
/**
|
|
114
|
-
* The pane's time: what a pan is stamped with,
|
|
115
|
-
* reads to decide it has held still
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
114
|
+
* The pane's time and the dashes' timer: what a pan is stamped with, what
|
|
115
|
+
* the dashes' march reads to decide it has held still, and what takes the
|
|
116
|
+
* march's steps. A test holds both (`holdClock` in test/held-clock.ts). On
|
|
117
|
+
* the real clock a runner that spends longer than the dashes' wait over one
|
|
118
|
+
* step of a pan lets them march in the middle of it, as they should, and
|
|
119
|
+
* one that stalls before the pan lets a tick claim the dashes the first step
|
|
120
|
+
* copies, which declines the copy. A test of the pan cannot tell either from
|
|
121
|
+
* a march it should not have made.
|
|
122
|
+
*
|
|
123
|
+
* The shape of the map's `glideClock`. Exported from this module and not
|
|
124
|
+
* from `./index.ts`: this is for the tests.
|
|
119
125
|
*/
|
|
120
126
|
export const flowClock = {
|
|
121
|
-
now
|
|
127
|
+
now() {
|
|
128
|
+
return clock.performance?.now() ?? Date.now();
|
|
129
|
+
},
|
|
130
|
+
arm(step, ms) {
|
|
131
|
+
return timers.setTimeout?.(step, ms) ?? null;
|
|
132
|
+
},
|
|
133
|
+
disarm(handle) {
|
|
134
|
+
timers.clearTimeout?.(handle);
|
|
135
|
+
},
|
|
122
136
|
};
|
|
123
137
|
const now = () => flowClock.now();
|
|
124
138
|
const CONTROL_SIZE = 26;
|
|
@@ -2688,70 +2702,74 @@ export class FlowGraphNode extends Node {
|
|
|
2688
2702
|
_startAnimation() {
|
|
2689
2703
|
if (this._animTimer != null)
|
|
2690
2704
|
return;
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2705
|
+
const tick = () => {
|
|
2706
|
+
// A step at a time rather than an interval, so that a test can hold
|
|
2707
|
+
// the timer (`flowClock`), and armed again before anything else,
|
|
2708
|
+
// which is when an interval would have been.
|
|
2709
|
+
this._animTimer = flowClock.arm(tick, ANIMATION_MS);
|
|
2710
|
+
// A pan that blits copies the pane's pixels, dashes and all, and a
|
|
2711
|
+
// tick claims the dashes inside the band it copies — which declines
|
|
2712
|
+
// the copy: every frame a tick landed in repainted the whole pane,
|
|
2713
|
+
// a sixth of a pan's frames and all of its stutter. So the dashes
|
|
2714
|
+
// sit the pan out, phase and all, and what the pan copies and what
|
|
2715
|
+
// it draws agree; they march again once it has held still.
|
|
2716
|
+
//
|
|
2717
|
+
// And the view moving at all is what they wait out, not a blit that
|
|
2718
|
+
// happened: a tick declines the blit it lands beside, so a pan
|
|
2719
|
+
// whose frames ran past the wait had its ticks back, each one
|
|
2720
|
+
// cancelling the next blit and repainting the pane — over the
|
|
2721
|
+
// stress example's widgets in a large window, 2 frames a second,
|
|
2722
|
+
// ticks and pan steps taking turns. A step since the last tick, or
|
|
2723
|
+
// one within two ticks, holds the dashes still whatever a frame
|
|
2724
|
+
// costs. Under GL a tick is a uniform and blits nothing, and they
|
|
2725
|
+
// march through a pan as before.
|
|
2726
|
+
//
|
|
2727
|
+
// A 2D tick is a repaint of the box the dashes are in, which over a
|
|
2728
|
+
// dense graph in a large window is most of the pane: 75 ms a tick on
|
|
2729
|
+
// XQuartz, against a timer of 60. So the wait scales with what
|
|
2730
|
+
// frames cost: the view held still for two frames' worth, and one
|
|
2731
|
+
// tick every two frames at most — the dashes slow down before the
|
|
2732
|
+
// thread is theirs, and a pan whose frames come slowly still sees
|
|
2733
|
+
// them hold still.
|
|
2734
|
+
const t = now();
|
|
2735
|
+
const lastTick = this._tickAt;
|
|
2736
|
+
this._tickAt = t;
|
|
2737
|
+
if (t - this._blittedPanAt < ANIMATION_MS * 2)
|
|
2738
|
+
return;
|
|
2739
|
+
let steps = 1;
|
|
2740
|
+
if (!this._gl) {
|
|
2741
|
+
const cost = this._tickCost * 2;
|
|
2742
|
+
const still = Math.max(ANIMATION_MS * 2, cost);
|
|
2743
|
+
if (this._viewMovedAt > lastTick || t - this._viewMovedAt < still) {
|
|
2721
2744
|
return;
|
|
2722
|
-
let steps = 1;
|
|
2723
|
-
if (!this._gl) {
|
|
2724
|
-
const cost = this._tickCost * 2;
|
|
2725
|
-
const still = Math.max(ANIMATION_MS * 2, cost);
|
|
2726
|
-
if (this._viewMovedAt > lastTick || t - this._viewMovedAt < still) {
|
|
2727
|
-
return;
|
|
2728
|
-
}
|
|
2729
|
-
// a tick under ANIMATION_MS apart, less a millisecond of timer
|
|
2730
|
-
// slop; further while ticks are dear — and then the dashes cover
|
|
2731
|
-
// the ground the skipped ticks would have, so they slow down in
|
|
2732
|
-
// steps and not in speed
|
|
2733
|
-
const since = t - this._marchedAt;
|
|
2734
|
-
if (since < Math.max(ANIMATION_MS, cost) - 1)
|
|
2735
|
-
return;
|
|
2736
|
-
steps = Math.min(4, Math.max(1, Math.round(since / ANIMATION_MS)));
|
|
2737
2745
|
}
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
// the
|
|
2741
|
-
//
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2746
|
+
// a tick under ANIMATION_MS apart, less a millisecond of timer
|
|
2747
|
+
// slop; further while ticks are dear — and then the dashes cover
|
|
2748
|
+
// the ground the skipped ticks would have, so they slow down in
|
|
2749
|
+
// steps and not in speed
|
|
2750
|
+
const since = t - this._marchedAt;
|
|
2751
|
+
if (since < Math.max(ANIMATION_MS, cost) - 1)
|
|
2752
|
+
return;
|
|
2753
|
+
steps = Math.min(4, Math.max(1, Math.round(since / ANIMATION_MS)));
|
|
2754
|
+
}
|
|
2755
|
+
this._marchedAt = t;
|
|
2756
|
+
this._dashPhase += ANIMATION_SPEED * steps;
|
|
2757
|
+
// the box the last paint saw animated edges in, not the pane: a
|
|
2758
|
+
// marching dash should not cost a full grid repaint per tick. And
|
|
2759
|
+
// only the part of it the pane shows — an edge on its way out of
|
|
2760
|
+
// the pane takes the box past it, and claimed whole, a tick
|
|
2761
|
+
// repainted everything the window has beside the graph.
|
|
2762
|
+
const box = this._animBox ? this._device(this._animBox) : this.abs;
|
|
2763
|
+
const shown = intersectRects(box, this.contentBox());
|
|
2764
|
+
if (shown)
|
|
2765
|
+
this.invalidate(false, shown, 'animation');
|
|
2766
|
+
};
|
|
2767
|
+
this._animTimer = flowClock.arm(tick, ANIMATION_MS);
|
|
2750
2768
|
}
|
|
2751
2769
|
_stopAnimation() {
|
|
2752
2770
|
if (this._animTimer == null)
|
|
2753
2771
|
return;
|
|
2754
|
-
|
|
2772
|
+
flowClock.disarm(this._animTimer);
|
|
2755
2773
|
this._animTimer = null;
|
|
2756
2774
|
}
|
|
2757
2775
|
// --- painting ------------------------------------------------------------
|