@visulima/tui 1.0.8 → 2.0.1
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/CHANGELOG.md +4 -0
- package/LICENSE.md +54 -2444
- package/MIGRATION-GUIDE.md +164 -0
- package/README.md +15 -12
- package/dist/components/box.d.ts +26 -27
- package/dist/components/canvas.d.ts +26 -31
- package/dist/components/canvas.js +1 -1
- package/dist/components/cursor.d.ts +40 -46
- package/dist/components/error-boundary.d.ts +16 -0
- package/dist/components/error-boundary.js +1 -0
- package/dist/components/error-overview.d.ts +6 -0
- package/dist/components/error-overview.js +1 -0
- package/dist/components/newline.d.ts +6 -8
- package/dist/components/spacer.d.ts +4 -4
- package/dist/components/static-render.d.ts +10 -42
- package/dist/components/static.d.ts +13 -14
- package/dist/components/text.d.ts +34 -48
- package/dist/components/transform.d.ts +7 -11
- package/dist/core/index.d.ts +11 -12
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +24 -0
- package/dist/ink/canvas/index.js +1 -0
- package/dist/ink/hooks/use-animation.d.ts +22 -22
- package/dist/ink/hooks/use-app.d.ts +3 -34
- package/dist/ink/hooks/use-app.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +17 -18
- package/dist/ink/hooks/use-clipboard.d.ts +16 -16
- package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
- package/dist/ink/hooks/use-console-capture.d.ts +19 -19
- package/dist/ink/hooks/use-cursor.d.ts +7 -7
- package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
- package/dist/ink/hooks/use-focus.d.ts +14 -18
- package/dist/ink/hooks/use-form.d.ts +32 -32
- package/dist/ink/hooks/use-hotkey.d.ts +17 -17
- package/dist/ink/hooks/use-input.d.ts +92 -92
- package/dist/ink/hooks/use-input.js +2 -2
- package/dist/ink/hooks/use-interval.d.ts +14 -14
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
- package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
- package/dist/ink/hooks/use-key-chord.d.ts +15 -15
- package/dist/ink/hooks/use-paste.d.ts +38 -38
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
- package/dist/ink/hooks/use-persistent-state.js +2 -2
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
- package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
- package/dist/ink/hooks/use-stderr.d.ts +6 -6
- package/dist/ink/hooks/use-stderr.js +1 -1
- package/dist/ink/hooks/use-stdin.d.ts +10 -10
- package/dist/ink/hooks/use-stdin.js +1 -1
- package/dist/ink/hooks/use-stdout.d.ts +6 -6
- package/dist/ink/hooks/use-stdout.js +1 -1
- package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
- package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
- package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
- package/dist/ink/hooks/use-text-selection.d.ts +19 -20
- package/dist/ink/hooks/use-timeout.d.ts +11 -11
- package/dist/ink/hooks/use-timer.d.ts +19 -19
- package/dist/ink/hooks/use-window-size.d.ts +8 -8
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +110 -123
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +7 -8
- package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
- package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
- package/dist/ink/mouse/use-mouse.d.ts +1 -1
- package/dist/ink/mouse/use-on-mouse-click.d.ts +4 -5
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
- package/dist/ink/public/cursor.d.ts +47 -0
- package/dist/ink/public/cursor.js +1 -0
- package/dist/ink/public/dom.d.ts +6 -0
- package/dist/ink/public/dom.js +0 -0
- package/dist/ink/public/highlighter.d.ts +44 -0
- package/dist/ink/public/highlighter.js +1 -0
- package/dist/ink/public/input.d.ts +14 -0
- package/dist/ink/public/input.js +1 -0
- package/dist/ink/public/styles.d.ts +4 -0
- package/dist/ink/public/styles.js +0 -0
- package/dist/ink/public/utils.d.ts +5 -0
- package/dist/ink/public/utils.js +1 -0
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-BxD3PYAN.js} +1 -1
- package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
- package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
- package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
- package/dist/packem_shared/TuiApp-CCVaiKbf.js +1 -0
- package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
- package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/buffer.d-CttIC480.d.ts +67 -0
- package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
- package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
- package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
- package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
- package/dist/packem_shared/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
- package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
- package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-CLGlidfI.d.ts} +140 -154
- package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
- package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
- package/dist/packem_shared/input.d-Bb8pWHvp.d.ts +172 -0
- package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
- package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
- package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
- package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
- package/dist/packem_shared/render-CuCo-R-l.js +24 -0
- package/dist/packem_shared/{render-DFZ8NHlG.js → render-DtQd8qQq.js} +1 -1
- package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
- package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-B1LgWcJe.js} +1 -1
- package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
- package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
- package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
- package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
- package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
- package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
- package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
- package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
- package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
- package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
- package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
- package/dist/react/index.d.ts +160 -179
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +152 -152
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +49 -384
- package/dist/components/accordion.d.ts +0 -59
- package/dist/components/accordion.js +0 -1
- package/dist/components/alert.d.ts +0 -26
- package/dist/components/alert.js +0 -1
- package/dist/components/animate-presence.d.ts +0 -18
- package/dist/components/animate-presence.js +0 -1
- package/dist/components/approval-prompt.d.ts +0 -65
- package/dist/components/approval-prompt.js +0 -1
- package/dist/components/area-chart.d.ts +0 -66
- package/dist/components/area-chart.js +0 -1
- package/dist/components/badge.d.ts +0 -22
- package/dist/components/badge.js +0 -1
- package/dist/components/bar-chart.d.ts +0 -67
- package/dist/components/bar-chart.js +0 -1
- package/dist/components/big-text.d.ts +0 -81
- package/dist/components/big-text.js +0 -1
- package/dist/components/blink-dot.d.ts +0 -36
- package/dist/components/blink-dot.js +0 -1
- package/dist/components/breadcrumb.d.ts +0 -33
- package/dist/components/breadcrumb.js +0 -1
- package/dist/components/button.d.ts +0 -45
- package/dist/components/button.js +0 -1
- package/dist/components/calendar.d.ts +0 -72
- package/dist/components/calendar.js +0 -1
- package/dist/components/card.d.ts +0 -57
- package/dist/components/card.js +0 -1
- package/dist/components/checkbox.d.ts +0 -48
- package/dist/components/checkbox.js +0 -1
- package/dist/components/code.d.ts +0 -48
- package/dist/components/code.js +0 -2
- package/dist/components/collapsible.d.ts +0 -53
- package/dist/components/collapsible.js +0 -1
- package/dist/components/command-block.d.ts +0 -47
- package/dist/components/command-block.js +0 -4
- package/dist/components/command-palette.d.ts +0 -82
- package/dist/components/command-palette.js +0 -1
- package/dist/components/confirm-dialog.d.ts +0 -75
- package/dist/components/confirm-dialog.js +0 -1
- package/dist/components/confirm-input.d.ts +0 -38
- package/dist/components/confirm-input.js +0 -1
- package/dist/components/console-overlay.d.ts +0 -54
- package/dist/components/console-overlay.js +0 -1
- package/dist/components/content-switcher.d.ts +0 -57
- package/dist/components/content-switcher.js +0 -1
- package/dist/components/controlled-scroll-view.d.ts +0 -61
- package/dist/components/controlled-scroll-view.js +0 -1
- package/dist/components/date-picker.d.ts +0 -65
- package/dist/components/date-picker.js +0 -1
- package/dist/components/definition-list.d.ts +0 -44
- package/dist/components/definition-list.js +0 -1
- package/dist/components/dialog.d.ts +0 -117
- package/dist/components/dialog.js +0 -1
- package/dist/components/diff-view.d.ts +0 -85
- package/dist/components/diff-view.js +0 -1
- package/dist/components/divider.d.ts +0 -49
- package/dist/components/divider.js +0 -1
- package/dist/components/file-picker-entry.d.ts +0 -104
- package/dist/components/file-picker-entry.js +0 -1
- package/dist/components/form.d.ts +0 -81
- package/dist/components/form.js +0 -1
- package/dist/components/gauge.d.ts +0 -87
- package/dist/components/gauge.js +0 -1
- package/dist/components/gradient.d.ts +0 -42
- package/dist/components/gradient.js +0 -1
- package/dist/components/heading.d.ts +0 -33
- package/dist/components/heading.js +0 -1
- package/dist/components/heatmap.d.ts +0 -62
- package/dist/components/heatmap.js +0 -1
- package/dist/components/help.d.ts +0 -52
- package/dist/components/help.js +0 -1
- package/dist/components/histogram.d.ts +0 -62
- package/dist/components/histogram.js +0 -1
- package/dist/components/kbd.d.ts +0 -31
- package/dist/components/kbd.js +0 -1
- package/dist/components/line-chart.d.ts +0 -109
- package/dist/components/line-chart.js +0 -1
- package/dist/components/link.d.ts +0 -38
- package/dist/components/link.js +0 -1
- package/dist/components/loading-indicator.d.ts +0 -29
- package/dist/components/loading-indicator.js +0 -1
- package/dist/components/markdown.d.ts +0 -40
- package/dist/components/markdown.js +0 -1
- package/dist/components/masked-input.d.ts +0 -50
- package/dist/components/masked-input.js +0 -1
- package/dist/components/menu.d.ts +0 -78
- package/dist/components/menu.js +0 -1
- package/dist/components/message-bubble.d.ts +0 -43
- package/dist/components/message-bubble.js +0 -1
- package/dist/components/model-badge.d.ts +0 -39
- package/dist/components/model-badge.js +0 -1
- package/dist/components/multi-select.d.ts +0 -65
- package/dist/components/multi-select.js +0 -1
- package/dist/components/operation-tree.d.ts +0 -49
- package/dist/components/operation-tree.js +0 -1
- package/dist/components/option-list.d.ts +0 -47
- package/dist/components/option-list.js +0 -1
- package/dist/components/ordered-list.d.ts +0 -24
- package/dist/components/ordered-list.js +0 -1
- package/dist/components/paginator.d.ts +0 -69
- package/dist/components/paginator.js +0 -1
- package/dist/components/paragraph.d.ts +0 -38
- package/dist/components/paragraph.js +0 -1
- package/dist/components/placeholder.d.ts +0 -55
- package/dist/components/placeholder.js +0 -1
- package/dist/components/progress-bar.d.ts +0 -56
- package/dist/components/progress-bar.js +0 -1
- package/dist/components/radio-group.d.ts +0 -74
- package/dist/components/radio-group.js +0 -1
- package/dist/components/scatter-plot.d.ts +0 -35
- package/dist/components/scatter-plot.js +0 -1
- package/dist/components/scroll-bar-box.d.ts +0 -37
- package/dist/components/scroll-bar-box.js +0 -1
- package/dist/components/scroll-bar.d.ts +0 -25
- package/dist/components/scroll-bar.js +0 -1
- package/dist/components/scroll-list.d.ts +0 -20
- package/dist/components/scroll-list.js +0 -1
- package/dist/components/scroll-view.d.ts +0 -10
- package/dist/components/scroll-view.js +0 -1
- package/dist/components/search-input.d.ts +0 -55
- package/dist/components/search-input.js +0 -1
- package/dist/components/select-input-indicator.d.ts +0 -32
- package/dist/components/select-input-indicator.js +0 -1
- package/dist/components/select-input-item.d.ts +0 -41
- package/dist/components/select-input-item.js +0 -1
- package/dist/components/select-input.d.ts +0 -110
- package/dist/components/select-input.js +0 -1
- package/dist/components/shimmer-text.d.ts +0 -47
- package/dist/components/shimmer-text.js +0 -1
- package/dist/components/slider.d.ts +0 -103
- package/dist/components/slider.js +0 -1
- package/dist/components/sparkline.d.ts +0 -35
- package/dist/components/sparkline.js +0 -1
- package/dist/components/spinner.d.ts +0 -17
- package/dist/components/spinner.js +0 -1
- package/dist/components/status-line.d.ts +0 -37
- package/dist/components/status-line.js +0 -1
- package/dist/components/status-message.d.ts +0 -21
- package/dist/components/status-message.js +0 -1
- package/dist/components/stepper.d.ts +0 -48
- package/dist/components/stepper.js +0 -1
- package/dist/components/stopwatch.d.ts +0 -49
- package/dist/components/stopwatch.js +0 -1
- package/dist/components/streaming-text.d.ts +0 -46
- package/dist/components/streaming-text.js +0 -1
- package/dist/components/switch.d.ts +0 -55
- package/dist/components/switch.js +0 -1
- package/dist/components/tab.d.ts +0 -19
- package/dist/components/tab.js +0 -1
- package/dist/components/table.d.ts +0 -119
- package/dist/components/table.js +0 -1
- package/dist/components/tabs.d.ts +0 -107
- package/dist/components/tabs.js +0 -1
- package/dist/components/tag.d.ts +0 -35
- package/dist/components/tag.js +0 -1
- package/dist/components/text-input.d.ts +0 -48
- package/dist/components/text-input.js +0 -1
- package/dist/components/textarea.d.ts +0 -68
- package/dist/components/textarea.js +0 -2
- package/dist/components/timer.d.ts +0 -59
- package/dist/components/timer.js +0 -1
- package/dist/components/toast.d.ts +0 -49
- package/dist/components/toast.js +0 -1
- package/dist/components/tooltip.d.ts +0 -43
- package/dist/components/tooltip.js +0 -1
- package/dist/components/transition.d.ts +0 -74
- package/dist/components/transition.js +0 -1
- package/dist/components/tree-view-entry.d.ts +0 -357
- package/dist/components/tree-view-entry.js +0 -1
- package/dist/components/unordered-list.d.ts +0 -30
- package/dist/components/unordered-list.js +0 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
- package/dist/ink/hooks/use-linked-scroll.js +0 -1
- package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
- package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
- package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
- package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
- package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
- package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
- package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
- package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
- package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
- package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +0 -39
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
- package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
- package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
- package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
- package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
- package/dist/packem_shared/reconciler-CFyBVf7l.js +0 -1
- package/dist/packem_shared/render-CuQecTAs.js +0 -24
- package/dist/packem_shared/render.d-CBnYBDk2.d.ts +0 -417
- package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
- package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
- package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
- package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
- package/dist/packem_shared/styles.d-cMo36xQz.d.ts +0 -396
- package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
- package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
- package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
- package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
|
@@ -1,43 +1,24 @@
|
|
|
1
1
|
import { Node } from 'yoga-layout';
|
|
2
|
-
import {
|
|
2
|
+
import { CursorShape } from "../ink/public/cursor.js";
|
|
3
3
|
import '@visulima/colorize';
|
|
4
|
-
import
|
|
5
|
-
import { S as Styles } from "./styles.d-cMo36xQz.js";
|
|
6
|
-
|
|
4
|
+
import { S as Styles } from "./styles.d-CKGQFfm4.js";
|
|
7
5
|
/**
|
|
8
|
-
* Columnar data structure for a single line of styled terminal text.
|
|
9
|
-
*
|
|
10
|
-
* Instead of one heap-allocated object per visible character, StyledLine stores:
|
|
11
|
-
*
|
|
12
|
-
* - `text: string` — concatenated raw character values
|
|
13
|
-
* - `charData: number[]` — per-character: 30-bit offset into text | 1-bit full-width flag
|
|
14
|
-
* - `spans: StyleSpan[]` — run-length encoded style information
|
|
15
|
-
*
|
|
16
|
-
* For an 80-column line this reduces allocations from ~80 objects to
|
|
17
|
-
* 1 string + 1 array + typically 1-5 span objects.
|
|
18
|
-
*
|
|
19
|
-
* Ported from jacob314/ink (Google LLC, Apache-2.0).
|
|
20
|
-
* @license Apache-2.0
|
|
21
|
-
* Copyright 2026 Google LLC
|
|
22
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Columnar data structure for a single line of styled terminal text.
|
|
26
|
-
*
|
|
27
|
-
* Instead of one heap-allocated object per visible character, StyledLine stores:
|
|
28
|
-
*
|
|
29
|
-
* - `text: string` — concatenated raw character values
|
|
30
|
-
* - `charData: number[]` — per-character: 30-bit offset into text | 1-bit full-width flag
|
|
31
|
-
* - `spans: StyleSpan[]` — run-length encoded style information
|
|
32
|
-
*
|
|
33
|
-
* For an 80-column line this reduces allocations from ~80 objects to
|
|
34
|
-
* 1 string + 1 array + typically 1-5 span objects.
|
|
35
|
-
*
|
|
36
|
-
* Ported from jacob314/ink (Google LLC, Apache-2.0).
|
|
37
|
-
* @license Apache-2.0
|
|
38
|
-
* Copyright 2026 Google LLC
|
|
39
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
40
|
-
*/
|
|
6
|
+
* Columnar data structure for a single line of styled terminal text.
|
|
7
|
+
*
|
|
8
|
+
* Instead of one heap-allocated object per visible character, StyledLine stores:
|
|
9
|
+
*
|
|
10
|
+
* - `text: string` — concatenated raw character values
|
|
11
|
+
* - `charData: number[]` — per-character: 30-bit offset into text | 1-bit full-width flag
|
|
12
|
+
* - `spans: StyleSpan[]` — run-length encoded style information
|
|
13
|
+
*
|
|
14
|
+
* For an 80-column line this reduces allocations from ~80 objects to
|
|
15
|
+
* 1 string + 1 array + typically 1-5 span objects.
|
|
16
|
+
*
|
|
17
|
+
* Ported from jacob314/ink (Google LLC, Apache-2.0).
|
|
18
|
+
* @license Apache-2.0
|
|
19
|
+
* Copyright 2026 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
21
|
+
*/
|
|
41
22
|
type StyleSpan = {
|
|
42
23
|
bgColor?: string;
|
|
43
24
|
fgColor?: string;
|
|
@@ -55,9 +36,9 @@ declare class StyledLine {
|
|
|
55
36
|
static empty(length: number): StyledLine;
|
|
56
37
|
getValue(index: number): string;
|
|
57
38
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
39
|
+
* Get the raw text for a range of characters as a single string slice.
|
|
40
|
+
* Much faster than calling getValue() per character.
|
|
41
|
+
*/
|
|
61
42
|
getTextRange(start: number, end: number): string;
|
|
62
43
|
getSpan(index: number): StyleSpan | undefined;
|
|
63
44
|
getFullWidth(index: number): boolean;
|
|
@@ -71,20 +52,20 @@ declare class StyledLine {
|
|
|
71
52
|
setForegroundColor(index: number, color: string | undefined): void;
|
|
72
53
|
setChar(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
|
|
73
54
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
* Optimized setChar for same-length single-byte replacement.
|
|
56
|
+
* Skips string rebuild and offset adjustment when old and new values
|
|
57
|
+
* have the same byte length (the common case for ASCII overwrites on empty lines).
|
|
58
|
+
*/
|
|
78
59
|
setCharFast(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
|
|
79
60
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
* Overwrite a range of this line with content from a source StyledLine.
|
|
62
|
+
* More efficient than calling setChar() per character because it does
|
|
63
|
+
* a single span split + rebuild instead of per-character span manipulation.
|
|
64
|
+
* @param destinationStart — start index in this line
|
|
65
|
+
* @param source — the StyledLine to copy from
|
|
66
|
+
* @param srcStart — start index in source (default 0)
|
|
67
|
+
* @param count — number of characters to copy (default: source.length)
|
|
68
|
+
*/
|
|
88
69
|
writeFrom(destinationStart: number, source: StyledLine, srcStart?: number, count?: number): void;
|
|
89
70
|
pushChar(value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
|
|
90
71
|
clone(): StyledLine;
|
|
@@ -106,28 +87,28 @@ declare class StyledLine {
|
|
|
106
87
|
value: string;
|
|
107
88
|
}>;
|
|
108
89
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
90
|
+
* Split the span at `index` into a single-char span, apply the updater,
|
|
91
|
+
* then merge adjacent spans. Shared by setInverted/setBackgroundColor/setForegroundColor.
|
|
92
|
+
*/
|
|
112
93
|
private updateSpanAt;
|
|
113
94
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
* Grow the line to at least `minWidth` columns, filling new cells with
|
|
96
|
+
* empty strings (zero-width placeholders). This matches the behavior of
|
|
97
|
+
* sparse JS arrays in the original ink Output where out-of-bounds writes
|
|
98
|
+
* created gaps that produced no visible output.
|
|
99
|
+
*/
|
|
119
100
|
ensureWidth(minWidth: number): void;
|
|
120
101
|
private ensureInitialized;
|
|
121
102
|
private splitSpansAt;
|
|
122
103
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
104
|
+
* Try to apply a single-char style at `index` by matching or merging
|
|
105
|
+
* with an adjacent span, avoiding splitSpansAt + mergeSpans.
|
|
106
|
+
*
|
|
107
|
+
* Returns true if the style was applied (or was already correct),
|
|
108
|
+
* false if the caller must fall through to the split/update/merge path.
|
|
109
|
+
*
|
|
110
|
+
* Ported from jacob314/ink PR #123 (Google LLC, Apache-2.0).
|
|
111
|
+
*/
|
|
131
112
|
private trySetStyleAtIndex;
|
|
132
113
|
private mergeSpans;
|
|
133
114
|
}
|
|
@@ -135,32 +116,41 @@ type Region = {
|
|
|
135
116
|
backgroundColor?: string;
|
|
136
117
|
borderBottom?: number;
|
|
137
118
|
borderTop?: number;
|
|
138
|
-
cachedStickyHeaders?: StickyHeader$1[];
|
|
119
|
+
cachedStickyHeaders?: StickyHeader$1[];
|
|
120
|
+
/** Child regions (nested content areas) */
|
|
139
121
|
children: Region[];
|
|
140
122
|
/** Cursor position within this region */
|
|
141
123
|
cursorPosition?: {
|
|
142
124
|
col: number;
|
|
143
125
|
row: number;
|
|
144
126
|
};
|
|
145
|
-
height: number;
|
|
127
|
+
height: number;
|
|
128
|
+
/** Unique identifier for this region (used for dirty tracking) */
|
|
146
129
|
id: number | string;
|
|
147
|
-
isHorizontallyScrollable?: boolean;
|
|
130
|
+
isHorizontallyScrollable?: boolean;
|
|
131
|
+
/** Whether this region supports scrolling */
|
|
148
132
|
isScrollable: boolean;
|
|
149
|
-
isVerticallyScrollable?: boolean;
|
|
133
|
+
isVerticallyScrollable?: boolean;
|
|
134
|
+
/** Content buffer — StyledLine per row, relative to (0,0) of this region */
|
|
150
135
|
readonly lines: ReadonlyArray<StyledLine>;
|
|
151
136
|
marginBottom?: number;
|
|
152
|
-
marginRight?: number;
|
|
137
|
+
marginRight?: number;
|
|
138
|
+
/** DOM node reference for debugging/caching */
|
|
153
139
|
nodeId?: number;
|
|
154
|
-
opaque?: boolean;
|
|
140
|
+
opaque?: boolean;
|
|
141
|
+
/** Layout properties */
|
|
155
142
|
overflowToBackbuffer?: boolean;
|
|
156
143
|
scrollbarThumbColor?: string;
|
|
157
144
|
scrollbarVisible?: boolean;
|
|
158
145
|
scrollHeight?: number;
|
|
159
|
-
scrollLeft?: number;
|
|
146
|
+
scrollLeft?: number;
|
|
147
|
+
/** Scroll state */
|
|
160
148
|
scrollTop?: number;
|
|
161
|
-
scrollWidth?: number;
|
|
149
|
+
scrollWidth?: number;
|
|
150
|
+
/** Selectable text spans for text selection */
|
|
162
151
|
selectableSpans: SelectableSpan[];
|
|
163
|
-
selectableText?: string;
|
|
152
|
+
selectableText?: string;
|
|
153
|
+
/** Whether the scrollback position is stable */
|
|
164
154
|
stableScrollback?: boolean;
|
|
165
155
|
/** Sticky headers for this region */
|
|
166
156
|
stickyHeaders: StickyHeader$1[];
|
|
@@ -215,14 +205,10 @@ declare class ResizeObserver {
|
|
|
215
205
|
unobserve(element: DOMElement): void;
|
|
216
206
|
disconnect(): void;
|
|
217
207
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
208
|
+
* Internal method called by the layout engine after computing layout.
|
|
209
|
+
*/
|
|
220
210
|
internalTrigger(entries: ResizeObserverEntry[]): void;
|
|
221
211
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Measure a node and collect resize observer entries for it.
|
|
224
|
-
* Used by both the main render loop and static render processing.
|
|
225
|
-
*/
|
|
226
212
|
type ScrollState = {
|
|
227
213
|
actualScrollHeight: number;
|
|
228
214
|
clientHeight: number;
|
|
@@ -236,14 +222,14 @@ declare const getScrollHeight: (node: DOMElement) => number;
|
|
|
236
222
|
declare const getScrollWidth: (node: DOMElement) => number;
|
|
237
223
|
declare const calculateScroll: (node: DOMElement) => void;
|
|
238
224
|
/**
|
|
239
|
-
* Get the effective scroll top position from the pre-computed scroll state.
|
|
240
|
-
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
241
|
-
*/
|
|
225
|
+
* Get the effective scroll top position from the pre-computed scroll state.
|
|
226
|
+
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
227
|
+
*/
|
|
242
228
|
declare const getScrollTop: (node: DOMElement) => number;
|
|
243
229
|
/**
|
|
244
|
-
* Get the effective scroll left position from the pre-computed scroll state.
|
|
245
|
-
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
246
|
-
*/
|
|
230
|
+
* Get the effective scroll left position from the pre-computed scroll state.
|
|
231
|
+
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
232
|
+
*/
|
|
247
233
|
declare const getScrollLeft: (node: DOMElement) => number;
|
|
248
234
|
type InkNode = {
|
|
249
235
|
internal_static?: boolean;
|
|
@@ -255,9 +241,9 @@ type LayoutListener = () => void;
|
|
|
255
241
|
type TextName = "#text";
|
|
256
242
|
type ElementNames = "ink-root" | "ink-box" | "ink-text" | "ink-cursor" | "ink-virtual-text" | "ink-static-render";
|
|
257
243
|
/**
|
|
258
|
-
* Describes a sticky header that should be composited on top of scrolled content.
|
|
259
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
260
|
-
*/
|
|
244
|
+
* Describes a sticky header that should be composited on top of scrolled content.
|
|
245
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
246
|
+
*/
|
|
261
247
|
type StickyHeader = {
|
|
262
248
|
/** Content-relative end row. */
|
|
263
249
|
endRow: number;
|
|
@@ -300,10 +286,10 @@ type CursorMarker = {
|
|
|
300
286
|
type DOMElement = InkNode & {
|
|
301
287
|
attributes: Record<string, DOMNodeAttribute>;
|
|
302
288
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
289
|
+
* Cached render result (a Region). When set, the entire subtree is
|
|
290
|
+
* skipped during rendering and the cached region is composited directly.
|
|
291
|
+
* Set by setCachedRender(), cleared on unmount by cleanupNodeTree().
|
|
292
|
+
*/
|
|
307
293
|
cachedRender?: Region;
|
|
308
294
|
childNodes: DOMNode[];
|
|
309
295
|
internal_accessibility?: {
|
|
@@ -323,74 +309,74 @@ type DOMElement = InkNode & {
|
|
|
323
309
|
internal_cursor?: CursorMarker;
|
|
324
310
|
internal_hidden?: boolean;
|
|
325
311
|
/**
|
|
326
|
-
|
|
327
|
-
|
|
312
|
+
* Auto-incrementing unique identifier for this node.
|
|
313
|
+
*/
|
|
328
314
|
internal_id: number;
|
|
329
315
|
/**
|
|
330
|
-
|
|
331
|
-
|
|
316
|
+
* Whether this element's scrollback buffer is dirty (needs recalculation).
|
|
317
|
+
*/
|
|
332
318
|
internal_isScrollbackDirty?: boolean;
|
|
333
319
|
/**
|
|
334
|
-
|
|
335
|
-
|
|
320
|
+
* Last measured size for ResizeObserver tracking.
|
|
321
|
+
*/
|
|
336
322
|
internal_lastMeasuredSize?: {
|
|
337
323
|
height: number;
|
|
338
324
|
width: number;
|
|
339
325
|
};
|
|
340
326
|
internal_layoutListeners?: Set<LayoutListener>;
|
|
341
327
|
/**
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
328
|
+
* Highest scrollTop whose scrolled-off lines have already been flushed
|
|
329
|
+
* into the terminal's real scrollback history. Monotonic; used by the
|
|
330
|
+
* `overflowToBackbuffer` emission path so a given line is pushed exactly
|
|
331
|
+
* once and scrolling back up never re-emits.
|
|
332
|
+
*/
|
|
347
333
|
internal_maxPushedScrollTop?: number;
|
|
348
334
|
/**
|
|
349
|
-
|
|
350
|
-
|
|
335
|
+
* Maximum scrollTop ever reached, used with stableScrollback.
|
|
336
|
+
*/
|
|
351
337
|
internal_maxScrollTop?: number;
|
|
352
338
|
/**
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
339
|
+
* Callback invoked after prepareYogaTree() caches the render output for
|
|
340
|
+
* an ink-static-render node. StaticRender uses this to set `isRendered`
|
|
341
|
+
* state, which prevents React from re-reconciling children once cached.
|
|
342
|
+
*/
|
|
357
343
|
internal_onRendered?: () => void;
|
|
358
344
|
/**
|
|
359
|
-
|
|
360
|
-
|
|
345
|
+
* Whether this element is opaque (prevents rendering of covered content beneath it).
|
|
346
|
+
*/
|
|
361
347
|
internal_opaque?: boolean;
|
|
362
348
|
/**
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
349
|
+
* Whether the scrollbar should be rendered for this scrollable element.
|
|
350
|
+
* Defaults to true for elements with overflow: 'scroll'.
|
|
351
|
+
*/
|
|
366
352
|
internal_scrollbar?: boolean;
|
|
367
353
|
/**
|
|
368
|
-
|
|
369
|
-
|
|
354
|
+
* Scroll state computed by calculateScroll() for elements with overflow: 'scroll'.
|
|
355
|
+
*/
|
|
370
356
|
internal_scrollState?: ScrollState;
|
|
371
357
|
/**
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
358
|
+
* Whether this element is sticky (pinned during scroll).
|
|
359
|
+
* - `true` or `'top'`: pinned to the top of the scroll container
|
|
360
|
+
* - `'bottom'`: pinned to the bottom of the scroll container
|
|
361
|
+
*/
|
|
376
362
|
internal_sticky?: boolean | "top" | "bottom";
|
|
377
363
|
/**
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
364
|
+
* Whether this element is the alternate (stuck) version of a sticky header.
|
|
365
|
+
* The stuck version is rendered when the header is pinned.
|
|
366
|
+
*/
|
|
381
367
|
internal_stickyAlternate?: boolean;
|
|
382
368
|
/**
|
|
383
|
-
|
|
384
|
-
|
|
369
|
+
* Whether this element should receive the terminal cursor focus.
|
|
370
|
+
*/
|
|
385
371
|
internal_terminalCursorFocus?: boolean;
|
|
386
372
|
/**
|
|
387
|
-
|
|
388
|
-
|
|
373
|
+
* Terminal cursor position offset within this element.
|
|
374
|
+
*/
|
|
389
375
|
internal_terminalCursorPosition?: number;
|
|
390
376
|
/**
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
377
|
+
* Cached text squash result for this node's subtree.
|
|
378
|
+
* Invalidated by markNodeAsDirty() when children change.
|
|
379
|
+
*/
|
|
394
380
|
internal_textCache?: {
|
|
395
381
|
map: Map<DOMNode, {
|
|
396
382
|
end: number;
|
|
@@ -401,10 +387,10 @@ type DOMElement = InkNode & {
|
|
|
401
387
|
internal_transform?: OutputTransformer;
|
|
402
388
|
isStaticDirty?: boolean;
|
|
403
389
|
/**
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
390
|
+
* Whether the Yoga subtree has been detached (children removed from Yoga layout)
|
|
391
|
+
* because a cachedRender was set. When cachedRender is invalidated,
|
|
392
|
+
* prepareYogaTree() re-attaches the children before the next layout pass.
|
|
393
|
+
*/
|
|
408
394
|
isYogaTreeDetached?: boolean;
|
|
409
395
|
nodeName: ElementNames;
|
|
410
396
|
onComputeLayout?: () => void;
|
|
@@ -412,13 +398,13 @@ type DOMElement = InkNode & {
|
|
|
412
398
|
onRender?: () => void;
|
|
413
399
|
onStaticChange?: () => void;
|
|
414
400
|
/**
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
401
|
+
* Tracks the previous commit's `staticNode` so the reconciler can detect identity changes
|
|
402
|
+
* (first mount, last unmount, key-driven remount) and reset accumulated `fullStaticOutput`.
|
|
403
|
+
*/
|
|
418
404
|
previousStaticNode?: DOMElement;
|
|
419
405
|
/**
|
|
420
|
-
|
|
421
|
-
|
|
406
|
+
* Set of ResizeObservers attached to this element.
|
|
407
|
+
*/
|
|
422
408
|
resizeObservers?: Set<ResizeObserver>;
|
|
423
409
|
staticNode?: DOMElement;
|
|
424
410
|
};
|
|
@@ -433,17 +419,17 @@ type DOMNode<T = {
|
|
|
433
419
|
} ? U extends "#text" ? TextNode : DOMElement : never;
|
|
434
420
|
type DOMNodeAttribute = boolean | string | number;
|
|
435
421
|
/**
|
|
436
|
-
* Get the path from the root to this node (inclusive).
|
|
437
|
-
* Returns an array starting with the root and ending with the node.
|
|
438
|
-
*
|
|
439
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
440
|
-
*/
|
|
422
|
+
* Get the path from the root to this node (inclusive).
|
|
423
|
+
* Returns an array starting with the root and ending with the node.
|
|
424
|
+
*
|
|
425
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
426
|
+
*/
|
|
441
427
|
declare const getPathToRoot: (node: DOMNode) => DOMNode[];
|
|
442
428
|
/**
|
|
443
|
-
* Check if a node is selectable by walking up the tree checking `userSelect` style.
|
|
444
|
-
* Returns true by default unless an ancestor has `userSelect: 'none'`.
|
|
445
|
-
*
|
|
446
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
447
|
-
*/
|
|
429
|
+
* Check if a node is selectable by walking up the tree checking `userSelect` style.
|
|
430
|
+
* Returns true by default unless an ancestor has `userSelect: 'none'`.
|
|
431
|
+
*
|
|
432
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
433
|
+
*/
|
|
448
434
|
declare const isNodeSelectable: (node: DOMElement) => boolean;
|
|
449
|
-
export { DOMElement as D, ResizeObserver as R,
|
|
435
|
+
export { CursorAnchorRef as C, DOMElement as D, ElementNames as E, NodeNames as N, ResizeObserver as R, StickyHeader as S, TextName as T, CursorMarker as a, DOMNode as b, DOMNodeAttribute as c, TextNode as d, StyledLine as e, ResizeObserverCallback as f, ResizeObserverEntry as g, ScrollState as h, calculateScroll as i, getPathToRoot as j, getScrollHeight as k, getScrollLeft as l, getScrollTop as m, getScrollWidth as n, isNodeSelectable as o };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function S(o){const t=Math.max(0,Math.floor(o/1e3)),r=Math.floor(t/3600),a=Math.floor(t%3600/60),n=t%60;return r>0?`${String(r).padStart(2,"0")}:${String(a).padStart(2,"0")}:${String(n).padStart(2,"0")}`:`${String(a).padStart(2,"0")}:${String(n).padStart(2,"0")}`}export{S as formatDuration};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var lib={},types={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,Object.defineProperty(types,"__esModule",{value:!0})),types}var ee={},taskCollection$1={},taskCollection={},utils$1={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$1;hasRequiredUtils$1=1,Object.defineProperty(utils$1,"__esModule",{value:!0}),utils$1._fast_remove_single=void 0;function a(c,l){l!==-1&&(l===0?c.shift():l===c.length-1?c.length=c.length-1:c.splice(l,1))}return utils$1._fast_remove_single=a,utils$1}var bakeCollection={},hasRequiredBakeCollection;function requireBakeCollection(){return hasRequiredBakeCollection||(hasRequiredBakeCollection=1,(function(exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.bakeCollectionVariadic=exports.bakeCollectionAwait=exports.bakeCollection=exports.BAKED_EMPTY_FUNC=void 0,exports.BAKED_EMPTY_FUNC=(function(){});var FORLOOP_FALLBACK=1500;function generateArgsDefCode(a){var c="";if(a===0)return c;for(var l=0;l<a-1;++l)c+="arg"+String(l)+", ";return c+="arg"+String(a-1),c}function generateBodyPartsCode(a,c){for(var l="",u="",r=0;r<c;++r)l+="var f".concat(r," = collection[").concat(r,`];
|
|
2
|
+
`),u+="f".concat(r,"(").concat(a,`)
|
|
3
|
+
`);return{funcDefCode:l,funcCallCode:u}}function generateBodyPartsVariadicCode(a){for(var c="",l="",u=0;u<a;++u)c+="var f".concat(u," = collection[").concat(u,`];
|
|
4
|
+
`),l+="f".concat(u,`.apply(undefined, arguments)
|
|
5
|
+
`);return{funcDefCode:c,funcCallCode:l}}function bakeCollection(collection,fixedArgsNum){if(collection.length===0)return exports.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
6
|
+
`.concat(funcDefCode,`
|
|
7
|
+
collection = undefined;
|
|
8
|
+
return (function(`).concat(argsDefCode,`) {
|
|
9
|
+
`).concat(funcCallCode,`
|
|
10
|
+
});
|
|
11
|
+
})`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);collection.length%10===0?funcFactoryCode=`(function(collection) {
|
|
12
|
+
return (function(`.concat(argsDefCode,`) {
|
|
13
|
+
for (var i = 0; i < collection.length; i += 10) {
|
|
14
|
+
collection[i](`).concat(argsDefCode,`);
|
|
15
|
+
collection[i+1](`).concat(argsDefCode,`);
|
|
16
|
+
collection[i+2](`).concat(argsDefCode,`);
|
|
17
|
+
collection[i+3](`).concat(argsDefCode,`);
|
|
18
|
+
collection[i+4](`).concat(argsDefCode,`);
|
|
19
|
+
collection[i+5](`).concat(argsDefCode,`);
|
|
20
|
+
collection[i+6](`).concat(argsDefCode,`);
|
|
21
|
+
collection[i+7](`).concat(argsDefCode,`);
|
|
22
|
+
collection[i+8](`).concat(argsDefCode,`);
|
|
23
|
+
collection[i+9](`).concat(argsDefCode,`);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
})`):collection.length%4===0?funcFactoryCode=`(function(collection) {
|
|
27
|
+
return (function(`.concat(argsDefCode,`) {
|
|
28
|
+
for (var i = 0; i < collection.length; i += 4) {
|
|
29
|
+
collection[i](`).concat(argsDefCode,`);
|
|
30
|
+
collection[i+1](`).concat(argsDefCode,`);
|
|
31
|
+
collection[i+2](`).concat(argsDefCode,`);
|
|
32
|
+
collection[i+3](`).concat(argsDefCode,`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
})`):collection.length%3===0?funcFactoryCode=`(function(collection) {
|
|
36
|
+
return (function(`.concat(argsDefCode,`) {
|
|
37
|
+
for (var i = 0; i < collection.length; i += 3) {
|
|
38
|
+
collection[i](`).concat(argsDefCode,`);
|
|
39
|
+
collection[i+1](`).concat(argsDefCode,`);
|
|
40
|
+
collection[i+2](`).concat(argsDefCode,`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
})`):funcFactoryCode=`(function(collection) {
|
|
44
|
+
return (function(`.concat(argsDefCode,`) {
|
|
45
|
+
for (var i = 0; i < collection.length; ++i) {
|
|
46
|
+
collection[i](`).concat(argsDefCode,`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
})`)}{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}exports.bakeCollection=bakeCollection;function bakeCollectionAwait(collection,fixedArgsNum){if(collection.length===0)return exports.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var argsDefCode=generateArgsDefCode(fixedArgsNum),_a=generateBodyPartsCode(argsDefCode,collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
50
|
+
`.concat(funcDefCode,`
|
|
51
|
+
collection = undefined;
|
|
52
|
+
return (function(`).concat(argsDefCode,`) {
|
|
53
|
+
return Promise.all([ `).concat(funcCallCode,` ]);
|
|
54
|
+
});
|
|
55
|
+
})`)}else{var argsDefCode=generateArgsDefCode(fixedArgsNum);funcFactoryCode=`(function(collection) {
|
|
56
|
+
return (function(`.concat(argsDefCode,`) {
|
|
57
|
+
var promises = Array(collection.length);
|
|
58
|
+
for (var i = 0; i < collection.length; ++i) {
|
|
59
|
+
promises[i] = collection[i](`).concat(argsDefCode,`);
|
|
60
|
+
}
|
|
61
|
+
return Promise.all(promises);
|
|
62
|
+
});
|
|
63
|
+
})`)}{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}exports.bakeCollectionAwait=bakeCollectionAwait;function bakeCollectionVariadic(collection){if(collection.length===0)return exports.BAKED_EMPTY_FUNC;if(collection.length===1)return collection[0];var funcFactoryCode;if(collection.length<FORLOOP_FALLBACK){var _a=generateBodyPartsVariadicCode(collection.length),funcDefCode=_a.funcDefCode,funcCallCode=_a.funcCallCode;funcFactoryCode=`(function(collection) {
|
|
64
|
+
`.concat(funcDefCode,`
|
|
65
|
+
collection = undefined;
|
|
66
|
+
return (function() {
|
|
67
|
+
`).concat(funcCallCode,`
|
|
68
|
+
});
|
|
69
|
+
})`)}else funcFactoryCode=`(function(collection) {
|
|
70
|
+
return (function() {
|
|
71
|
+
for (var i = 0; i < collection.length; ++i) {
|
|
72
|
+
collection[i].apply(undefined, arguments);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
})`;{var funcFactory=eval(funcFactoryCode);return funcFactory(collection)}}exports.bakeCollectionVariadic=bakeCollectionVariadic})(bakeCollection)),bakeCollection}var hasRequiredTaskCollection$1;function requireTaskCollection$1(){if(hasRequiredTaskCollection$1)return taskCollection;hasRequiredTaskCollection$1=1;var a=taskCollection&&taskCollection.__spreadArray||function(o,g,t){if(t||arguments.length===2)for(var e=0,n=g.length,i;e<n;e++)(i||!(e in g))&&(i||(i=Array.prototype.slice.call(g,0,e)),i[e]=g[e]);return o.concat(i||Array.prototype.slice.call(g))};Object.defineProperty(taskCollection,"__esModule",{value:!0}),taskCollection.TaskCollection=void 0;var c=requireUtils$1(),l=requireBakeCollection();function u(o,g){var t=this.length;if(t>1)if(g){var e;(e=this._tasks).push.apply(e,arguments),this.length+=arguments.length}else this._tasks.push(o),this.length++;else if(g){if(t===1){var n=Array(1+arguments.length);n.push(n),n.push.apply(n,arguments),this._tasks=n}else{var n=Array(arguments.length);n.push.apply(n,arguments),this._tasks=n}this.length+=arguments.length}else t===1?this._tasks=[this._tasks,o]:this._tasks=o,this.length++}function r(o,g){var t=this.length;if(t>1)if(g){var e;(e=this._tasks).push.apply(e,arguments),this.length+=arguments.length}else this._tasks.push(o),this.length++;else if(g){if(t===1){var n=Array(1+arguments.length);n.push(n),n.push.apply(n,arguments),this._tasks=n}else{var n=Array(arguments.length);n.push.apply(n,arguments),this._tasks=n}this.length+=arguments.length}else t===1?this._tasks=[this._tasks,o]:this._tasks=o,this.length++;this.firstEmitBuildStrategy?this.call=m:this.rebuild()}function f(o){this.length!==0&&(this.length===1?this._tasks===o&&(this.length=0):((0,c._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(o)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length))}function s(o){if(this.length!==0){if(this.length===1)if(this._tasks===o&&(this.length=0),this.firstEmitBuildStrategy){this.call=l.BAKED_EMPTY_FUNC;return}else{this.rebuild();return}else(0,c._fast_remove_single)(this._tasks,this._tasks.lastIndexOf(o)),this._tasks.length===1?(this._tasks=this._tasks[0],this.length=1):this.length=this._tasks.length;this.firstEmitBuildStrategy?this.call=m:this.rebuild()}}function p(o){for(var g,t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];this.length===0?(this._tasks=t,this.length=1):this.length===1?(t.unshift(this._tasks),this._tasks=t,this.length=this._tasks.length):((g=this._tasks).splice.apply(g,a([o,0],t,!1)),this.length=this._tasks.length)}function E(o){for(var g,t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];this.length===0?(this._tasks=t,this.length=1):this.length===1?(t.unshift(this._tasks),this._tasks=t,this.length=this._tasks.length):((g=this._tasks).splice.apply(g,a([o,0],t,!1)),this.length=this._tasks.length),this.firstEmitBuildStrategy?this.call=m:this.rebuild()}function A(){this.length===0?this.call=l.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,l.bakeCollection)(this._tasks,this.argsNum)}function O(){this.length===0?this.call=l.BAKED_EMPTY_FUNC:this.length===1?this.call=this._tasks:this.call=(0,l.bakeCollectionAwait)(this._tasks,this.argsNum)}function m(){this.rebuild(),this.call.apply(void 0,arguments)}var C=(function(){function o(g,t,e,n){t===void 0&&(t=!0),e===void 0&&(e=null),n===void 0&&(n=!1),this.awaitTasks=n,this.call=l.BAKED_EMPTY_FUNC,this.argsNum=g,this.firstEmitBuildStrategy=!0,n?this.rebuild=O.bind(this):this.rebuild=A.bind(this),this.setAutoRebuild(t),e?typeof e=="function"?(this._tasks=e,this.length=1):(this._tasks=e,this.length=e.length):(this._tasks=null,this.length=0),t&&this.rebuild()}return o})();taskCollection.TaskCollection=C;function F(){this._tasks=null,this.length=0,this.call=l.BAKED_EMPTY_FUNC}function x(){this._tasks=null,this.length=0,this.call=l.BAKED_EMPTY_FUNC}function q(o){this.argsNum<o&&(this.argsNum=o,this.firstEmitBuildStrategy?this.call=m:this.rebuild())}function B(o){o?(this.push=r.bind(this),this.insert=E.bind(this),this.removeLast=s.bind(this)):(this.push=u.bind(this),this.insert=p.bind(this),this.removeLast=f.bind(this))}function T(){return this.length===0?[]:this.length===1?[this._tasks]:this._tasks}function D(o){o.length===0?(this.length=0,this.call=l.BAKED_EMPTY_FUNC):o.length===1?(this.length=1,this.call=o[0],this._tasks=o[0]):(this.length=o.length,this._tasks=o,this.firstEmitBuildStrategy?this.call=m:this.rebuild())}return C.prototype.fastClear=F,C.prototype.clear=x,C.prototype.growArgsNum=q,C.prototype.setAutoRebuild=B,C.prototype.tasksAsArray=T,C.prototype.setTasks=D,taskCollection}var hasRequiredTaskCollection;function requireTaskCollection(){return hasRequiredTaskCollection||(hasRequiredTaskCollection=1,(function(a){var c=taskCollection$1&&taskCollection$1.__createBinding||(Object.create?(function(u,r,f,s){s===void 0&&(s=f);var p=Object.getOwnPropertyDescriptor(r,f);(!p||("get"in p?!r.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return r[f]}}),Object.defineProperty(u,s,p)}):(function(u,r,f,s){s===void 0&&(s=f),u[s]=r[f]})),l=taskCollection$1&&taskCollection$1.__exportStar||function(u,r){for(var f in u)f!=="default"&&!Object.prototype.hasOwnProperty.call(r,f)&&c(r,u,f)};Object.defineProperty(a,"__esModule",{value:!0}),l(requireTaskCollection$1(),a)})(taskCollection$1)),taskCollection$1}var utils={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1,Object.defineProperty(utils,"__esModule",{value:!0}),utils.nullObj=void 0;function a(){var c={};return c.__proto__=null,c}return utils.nullObj=a,utils}var hasRequiredEe;function requireEe(){if(hasRequiredEe)return ee;hasRequiredEe=1;var a=ee&&ee.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var i=0,d=e.length,y;i<d;i++)(y||!(i in e))&&(y||(y=Array.prototype.slice.call(e,0,i)),y[i]=e[i]);return t.concat(y||Array.prototype.slice.call(e))};Object.defineProperty(ee,"__esModule",{value:!0}),ee.EventEmitter=void 0;var c=requireTaskCollection(),l=requireUtils$1(),u=requireUtils();function r(t,e,n,i,d,y){var _=this.events[t];if(_){if(_.length===0)return!1;if(_.argsNum<6)_.call(e,n,i,d,y);else{for(var v=new Array(_.argsNum),h=0,b=v.length;h<b;++h)v[h]=arguments[h+1];_.call.apply(void 0,v)}return!0}return!1}function f(t,e,n,i,d,y){var _=this.events[t],v;if(_!==void 0){if(_.length===0)return!1;if(_.argsNum<6)_.call(e,n,i,d,y);else{v=new Array(_.argsNum);for(var h=0,b=v.length;h<b;++h)v[h]=arguments[h+1];_.call.apply(void 0,v)}}var k=this.onceEvents[t];if(k){if(typeof k=="function")if(this.onceEvents[t]=void 0,arguments.length<6)k(e,n,i,d,y);else{if(v===void 0){v=new Array(arguments.length-1);for(var h=0,b=v.length;h<b;++h)v[h]=arguments[h+1]}k.apply(void 0,v)}else{var L=k;if(this.onceEvents[t]=void 0,arguments.length<6)for(var h=0;h<L.length;++h)L[h](e,n,i,d,y);else{if(v===void 0){v=new Array(arguments.length-1);for(var h=0,b=v.length;h<b;++h)v[h]=arguments[h+1]}for(var h=0;h<L.length;++h)L[h].apply(void 0,v)}}return!0}return _!==void 0}var s=(function(){function t(){this.events=(0,u.nullObj)(),this.onceEvents=(0,u.nullObj)(),this._symbolKeys=new Set,this.maxListeners=1/0}return Object.defineProperty(t.prototype,"_eventsCount",{get:function(){return this.eventNames().length},enumerable:!1,configurable:!0}),t})();ee.EventEmitter=s;function p(t,e){switch(this.emit===r&&(this.emit=f),typeof this.onceEvents[t]){case"undefined":this.onceEvents[t]=e,typeof t=="symbol"&&this._symbolKeys.add(t);break;case"function":this.onceEvents[t]=[this.onceEvents[t],e];break;case"object":this.onceEvents[t].push(e)}return this}function E(t,e,n){if(n===void 0&&(n=e.length),typeof e!="function")throw new TypeError("The listener must be a function");var i=this.events[t];return i?(i.push(e),i.growArgsNum(n),this.maxListeners!==1/0&&this.maxListeners<=i.length&&console.warn('Maximum event listeners for "'.concat(String(t),'" event!'))):(this.events[t]=new c.TaskCollection(n,!0,e,!1),typeof t=="symbol"&&this._symbolKeys.add(t)),this}function A(t,e){var n=this.events[t];n&&n.removeLast(e);var i=this.onceEvents[t];return i&&(typeof i=="function"?this.onceEvents[t]=void 0:typeof i=="object"&&(i.length===1&&i[0]===e?this.onceEvents[t]=void 0:(0,l._fast_remove_single)(i,i.lastIndexOf(e)))),this}function O(t,e,n,i){n===void 0&&(n=this),i===void 0&&(i=e.length),this.boundFuncs||(this.boundFuncs=new Map);var d=e.bind(n);return this.boundFuncs.set(e,d),this.addListener(t,d,i)}function m(t,e){var n,i,d=(n=this.boundFuncs)===null||n===void 0?void 0:n.get(e);return(i=this.boundFuncs)===null||i===void 0||i.delete(e),this.removeListener(t,d)}function C(t){return this.events[t]&&!!this.events[t].length}function F(t,e,n){if(n===void 0&&(n=e.length),typeof e!="function")throw new TypeError("The listener must be a function");var i=this.events[t];return!i||!(i instanceof c.TaskCollection)?(i=this.events[t]=new c.TaskCollection(n,!0,e,!1),typeof t=="symbol"&&this._symbolKeys.add(t)):(i.insert(0,e),i.growArgsNum(n),this.maxListeners!==1/0&&this.maxListeners<=i.length&&console.warn('Maximum event listeners for "'.concat(String(t),'" event!'))),this}function x(t,e){this.emit===r&&(this.emit=f);var n=this.onceEvents[t];return n?typeof n!="object"?(this.onceEvents[t]=[e,n],typeof t=="symbol"&&this._symbolKeys.add(t)):(n.unshift(e),this.maxListeners!==1/0&&this.maxListeners<=n.length&&console.warn('Maximum event listeners for "'.concat(String(t),'" once event!'))):(this.onceEvents[t]=[e],typeof t=="symbol"&&this._symbolKeys.add(t)),this}function q(t){return t===void 0?(this.events=(0,u.nullObj)(),this.onceEvents=(0,u.nullObj)(),this._symbolKeys=new Set):(this.events[t]=void 0,this.onceEvents[t]=void 0,typeof t=="symbol"&&this._symbolKeys.delete(t)),this}function B(t){return this.maxListeners=t,this}function T(){return this.maxListeners}function D(t){return this.emit===r?this.events[t]?this.events[t].tasksAsArray().slice():[]:this.events[t]&&this.onceEvents[t]?a(a([],this.events[t].tasksAsArray(),!0),typeof this.onceEvents[t]=="function"?[this.onceEvents[t]]:this.onceEvents[t],!0):this.events[t]?this.events[t].tasksAsArray():this.onceEvents[t]?typeof this.onceEvents[t]=="function"?[this.onceEvents[t]]:this.onceEvents[t]:[]}function o(){var t=this;if(this.emit===r){var e=Object.keys(this.events);return a(a([],e,!0),Array.from(this._symbolKeys),!0).filter(function(i){return i in t.events&&t.events[i]&&t.events[i].length})}else{var e=Object.keys(this.events).filter(function(d){return t.events[d]&&t.events[d].length}),n=Object.keys(this.onceEvents).filter(function(d){return t.onceEvents[d]&&t.onceEvents[d].length});return a(a(a([],e,!0),n,!0),Array.from(this._symbolKeys).filter(function(d){return d in t.events&&t.events[d]&&t.events[d].length||d in t.onceEvents&&t.onceEvents[d]&&t.onceEvents[d].length}),!0)}}function g(t){return this.emit===r?this.events[t]&&this.events[t].length||0:(this.events[t]&&this.events[t].length||0)+(this.onceEvents[t]&&this.onceEvents[t].length||0)}return s.prototype.emit=r,s.prototype.on=E,s.prototype.once=p,s.prototype.addListener=E,s.prototype.removeListener=A,s.prototype.addListenerBound=O,s.prototype.removeListenerBound=m,s.prototype.hasListeners=C,s.prototype.prependListener=F,s.prototype.prependOnceListener=x,s.prototype.off=A,s.prototype.removeAllListeners=q,s.prototype.setMaxListeners=B,s.prototype.getMaxListeners=T,s.prototype.listeners=D,s.prototype.eventNames=o,s.prototype.listenerCount=g,ee}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,(function(a){var c=lib&&lib.__createBinding||(Object.create?(function(u,r,f,s){s===void 0&&(s=f);var p=Object.getOwnPropertyDescriptor(r,f);(!p||("get"in p?!r.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return r[f]}}),Object.defineProperty(u,s,p)}):(function(u,r,f,s){s===void 0&&(s=f),u[s]=r[f]})),l=lib&&lib.__exportStar||function(u,r){for(var f in u)f!=="default"&&!Object.prototype.hasOwnProperty.call(r,f)&&c(r,u,f)};Object.defineProperty(a,"__esModule",{value:!0}),l(requireTypes(),a),l(requireEe(),a)})(lib)),lib}var libExports=requireLib();export{libExports as l};
|