@vizejs/fresco 0.817.0 → 0.819.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/{app-CDSThgku.mjs → app-ByxmaQXv.mjs} +8 -119
- package/dist/app-ByxmaQXv.mjs.map +1 -0
- package/dist/ascii-font/index.d.mts +15 -0
- package/dist/ascii-font/index.d.mts.map +1 -1
- package/dist/ascii-font/index.mjs +0 -3
- package/dist/ascii-font/index.mjs.map +1 -1
- package/dist/components/index.d.mts +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/{components-CkggYTVQ.mjs → components-0LBWpsQe.mjs} +5 -116
- package/dist/components-0LBWpsQe.mjs.map +1 -0
- package/dist/composables/index.d.mts +3 -3
- package/dist/composables/index.mjs +3 -3
- package/dist/{composables-amARnyjm.mjs → composables-D1oKPS0m.mjs} +3 -15
- package/dist/composables-D1oKPS0m.mjs.map +1 -0
- package/dist/{index-BOV-0YqV.d.mts → index-C7_vgg04.d.mts} +64 -22
- package/dist/index-C7_vgg04.d.mts.map +1 -0
- package/dist/{index-BF-rzRoS.d.mts → index-ORAWju9U.d.mts} +964 -363
- package/dist/index-ORAWju9U.d.mts.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -30
- package/dist/index.mjs.map +1 -1
- package/dist/qr-code/index.d.mts +29 -0
- package/dist/qr-code/index.d.mts.map +1 -1
- package/dist/qr-code/index.mjs +0 -3
- package/dist/qr-code/index.mjs.map +1 -1
- package/dist/testing/index.d.mts +23 -6
- package/dist/testing/index.d.mts.map +1 -1
- package/dist/testing/index.mjs +1 -42
- package/dist/testing/index.mjs.map +1 -1
- package/dist/{useApp-vIRJ5Th3.d.mts → useApp-CZwf8lOA.d.mts} +10 -7
- package/dist/useApp-CZwf8lOA.d.mts.map +1 -0
- package/dist/{useBoxMetrics-9FFVE-tA.mjs → useBoxMetrics-DyBYcQEp.mjs} +2 -22
- package/dist/useBoxMetrics-DyBYcQEp.mjs.map +1 -0
- package/dist/{useVirtualViewport-TxTapifg.d.mts → useVirtualViewport-CCWjx3oS.d.mts} +7 -1
- package/dist/useVirtualViewport-CCWjx3oS.d.mts.map +1 -0
- package/package.json +2 -2
- package/dist/app-CDSThgku.mjs.map +0 -1
- package/dist/components-CkggYTVQ.mjs.map +0 -1
- package/dist/composables-amARnyjm.mjs.map +0 -1
- package/dist/index-BF-rzRoS.d.mts.map +0 -1
- package/dist/index-BOV-0YqV.d.mts.map +0 -1
- package/dist/useApp-vIRJ5Th3.d.mts.map +0 -1
- package/dist/useBoxMetrics-9FFVE-tA.mjs.map +0 -1
- package/dist/useVirtualViewport-TxTapifg.d.mts.map +0 -1
|
@@ -104,7 +104,6 @@ function nonEmptyStringValue(value) {
|
|
|
104
104
|
const string = stringValue$1(value);
|
|
105
105
|
return string ? string : void 0;
|
|
106
106
|
}
|
|
107
|
-
/** Normalize component style input into the canonical native render style. */
|
|
108
107
|
function normalizeFrescoStyle(value) {
|
|
109
108
|
const source = recordValue(value);
|
|
110
109
|
const style = {};
|
|
@@ -187,7 +186,6 @@ function wrappingEnabled(value, mode) {
|
|
|
187
186
|
if (value === void 0 || value === false) return false;
|
|
188
187
|
return !(mode?.startsWith("truncate") ?? false);
|
|
189
188
|
}
|
|
190
|
-
/** Convert one internal Fresco node into its strict public render protocol node. */
|
|
191
189
|
function frescoNodeToRenderNode(node) {
|
|
192
190
|
const common = commonFields(node);
|
|
193
191
|
if (node.type === "root" || node.type === "box") return {
|
|
@@ -241,9 +239,7 @@ function frescoNodeToRenderNode(node) {
|
|
|
241
239
|
}
|
|
242
240
|
//#endregion
|
|
243
241
|
//#region src/accessibility.ts
|
|
244
|
-
/** Injection key exposing whether screen-reader output is active. */
|
|
245
242
|
const SCREEN_READER_KEY = Symbol("fresco-screen-reader");
|
|
246
|
-
/** Read the Ink- and Fresco-compatible screen-reader environment flags. */
|
|
247
243
|
function isScreenReaderEnabledByDefault() {
|
|
248
244
|
return process.env.INK_SCREEN_READER === "true" || process.env.FRESCO_SCREEN_READER === "true";
|
|
249
245
|
}
|
|
@@ -279,7 +275,6 @@ function ariaState(node) {
|
|
|
279
275
|
function isAriaHidden(node) {
|
|
280
276
|
return node.props["aria-hidden"] === true;
|
|
281
277
|
}
|
|
282
|
-
/** Serialize a Fresco tree into deterministic semantic screen-reader text. */
|
|
283
278
|
function treeToScreenReaderString(node, options = {}) {
|
|
284
279
|
if (isAriaHidden(node)) return "";
|
|
285
280
|
let output = "";
|
|
@@ -302,7 +297,6 @@ function treeToScreenReaderString(node, options = {}) {
|
|
|
302
297
|
if (role && role !== options.parentRole) output = `${role}: ${output}`;
|
|
303
298
|
return output;
|
|
304
299
|
}
|
|
305
|
-
/** Convert a Fresco tree into the minimal native nodes used for screen-reader output. */
|
|
306
300
|
function treeToScreenReaderRenderNodes(root) {
|
|
307
301
|
const output = treeToScreenReaderString(root);
|
|
308
302
|
const rootStyle = normalizeFrescoStyle(root.props.style) ?? {};
|
|
@@ -328,13 +322,7 @@ function treeToScreenReaderRenderNodes(root) {
|
|
|
328
322
|
}
|
|
329
323
|
//#endregion
|
|
330
324
|
//#region src/composables/useApp.ts
|
|
331
|
-
/**
|
|
332
|
-
* useApp - App context composable
|
|
333
|
-
*/
|
|
334
325
|
const APP_KEY = Symbol("fresco-app");
|
|
335
|
-
/**
|
|
336
|
-
* Create app context (use at app root)
|
|
337
|
-
*/
|
|
338
326
|
function createAppContext(controls = {}) {
|
|
339
327
|
const width = ref(controls.width ?? 80);
|
|
340
328
|
const height = ref(controls.height ?? 24);
|
|
@@ -371,9 +359,6 @@ function createAppContext(controls = {}) {
|
|
|
371
359
|
waitUntilRenderFlush
|
|
372
360
|
};
|
|
373
361
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Use app context
|
|
376
|
-
*/
|
|
377
362
|
function useApp() {
|
|
378
363
|
const context = inject(APP_KEY);
|
|
379
364
|
if (!context) return {
|
|
@@ -388,18 +373,17 @@ function useApp() {
|
|
|
388
373
|
return context;
|
|
389
374
|
}
|
|
390
375
|
//#endregion
|
|
376
|
+
//#region src/composables/focusId.ts
|
|
377
|
+
function createFocusId(prefix) {
|
|
378
|
+
return `${prefix}-${Math.random().toString(36).slice(2)}`;
|
|
379
|
+
}
|
|
380
|
+
//#endregion
|
|
391
381
|
//#region src/composables/useFocus.ts
|
|
392
|
-
/**
|
|
393
|
-
* useFocus - Focus management composable
|
|
394
|
-
*/
|
|
395
382
|
const FOCUS_KEY = Symbol("fresco-focus");
|
|
396
383
|
const FOCUS_PARENT_KEY = Symbol("fresco-focus-parent");
|
|
397
384
|
function activeFocusables(focusables) {
|
|
398
385
|
return focusables.filter((focusable) => focusable.isActive);
|
|
399
386
|
}
|
|
400
|
-
/**
|
|
401
|
-
* Create a focus manager (use at app root)
|
|
402
|
-
*/
|
|
403
387
|
function createFocusManager() {
|
|
404
388
|
const focusedId = ref(null);
|
|
405
389
|
const activeId = computed(() => focusedId.value ?? void 0);
|
|
@@ -552,16 +536,12 @@ function createFocusManager() {
|
|
|
552
536
|
hasFocusedDescendant
|
|
553
537
|
};
|
|
554
538
|
}
|
|
555
|
-
/** Make an owning focus target the default parent for nested useFocus calls. */
|
|
556
539
|
function provideFocusScope(parentId) {
|
|
557
540
|
provide(FOCUS_PARENT_KEY, parentId);
|
|
558
541
|
}
|
|
559
|
-
/**
|
|
560
|
-
* Use focus management
|
|
561
|
-
*/
|
|
562
542
|
function useFocus(options = {}) {
|
|
563
543
|
const inheritedParentId = inject(FOCUS_PARENT_KEY, null);
|
|
564
|
-
const { autoFocus = false, id =
|
|
544
|
+
const { autoFocus = false, id = createFocusId("focus"), isActive: isActiveOption = true, delegateFocusTo: delegateFocusToOption = null, trapFocus: trapFocusOption = false } = options;
|
|
565
545
|
const parentIdOption = "parentId" in options ? options.parentId ?? null : inheritedParentId;
|
|
566
546
|
const manager = inject(FOCUS_KEY, null);
|
|
567
547
|
const localFocused = ref(autoFocus);
|
|
@@ -621,9 +601,6 @@ function useFocus(options = {}) {
|
|
|
621
601
|
blur
|
|
622
602
|
};
|
|
623
603
|
}
|
|
624
|
-
/**
|
|
625
|
-
* Use global focus manager controls.
|
|
626
|
-
*/
|
|
627
604
|
function useFocusManager() {
|
|
628
605
|
const manager = inject(FOCUS_KEY, null);
|
|
629
606
|
if (!manager) {
|
|
@@ -661,9 +638,6 @@ function useFocusManager() {
|
|
|
661
638
|
}
|
|
662
639
|
//#endregion
|
|
663
640
|
//#region src/composables/useStreams.ts
|
|
664
|
-
/**
|
|
665
|
-
* Stream composables matching Ink's stdin/stdout/stderr helpers.
|
|
666
|
-
*/
|
|
667
641
|
const BRACKETED_PASTE_ENABLE = "\x1B[?2004h";
|
|
668
642
|
const BRACKETED_PASTE_DISABLE = "\x1B[?2004l";
|
|
669
643
|
const STREAMS_KEY = Symbol("fresco-streams");
|
|
@@ -749,9 +723,6 @@ function useStderr() {
|
|
|
749
723
|
}
|
|
750
724
|
//#endregion
|
|
751
725
|
//#region src/composables/useCursor.ts
|
|
752
|
-
/**
|
|
753
|
-
* useCursor - terminal cursor positioning.
|
|
754
|
-
*/
|
|
755
726
|
const CURSOR_KEY = Symbol("fresco-cursor");
|
|
756
727
|
async function loadNative$1() {
|
|
757
728
|
return import("@vizejs/fresco-native");
|
|
@@ -785,7 +756,6 @@ function useCursor() {
|
|
|
785
756
|
}
|
|
786
757
|
//#endregion
|
|
787
758
|
//#region src/focusRouting.ts
|
|
788
|
-
/** Find the live host node registered for one logical focus target. */
|
|
789
759
|
function findHostNodeByFocusId(root, focusId) {
|
|
790
760
|
if (root.props.focusId === focusId) return root;
|
|
791
761
|
for (const child of root.children) {
|
|
@@ -793,17 +763,12 @@ function findHostNodeByFocusId(root, focusId) {
|
|
|
793
763
|
if (match) return match;
|
|
794
764
|
}
|
|
795
765
|
}
|
|
796
|
-
/** Derive the application fallback after focused handlers have had first refusal. */
|
|
797
766
|
function defaultInputAction(input, result, exitOnCtrlC) {
|
|
798
767
|
if (result?.defaultPrevented || input.eventType !== "key") return void 0;
|
|
799
768
|
if (input.key === "tab") return "focus-next";
|
|
800
769
|
if (input.key === "backtab") return "focus-previous";
|
|
801
770
|
if (exitOnCtrlC && input.char === "c" && input.modifiers?.ctrl) return "exit";
|
|
802
771
|
}
|
|
803
|
-
/**
|
|
804
|
-
* Route one normalized terminal packet to the live host node associated with
|
|
805
|
-
* the active logical focus ID.
|
|
806
|
-
*/
|
|
807
772
|
function routeFocusedInput(renderer, root, focusId, input) {
|
|
808
773
|
if (!root || focusId === void 0) return void 0;
|
|
809
774
|
const target = renderer.findNodeByFocusId(root, focusId);
|
|
@@ -812,21 +777,17 @@ function routeFocusedInput(renderer, root, focusId, input) {
|
|
|
812
777
|
//#endregion
|
|
813
778
|
//#region src/layoutMetrics.ts
|
|
814
779
|
let lastRenderLayouts = [];
|
|
815
|
-
/** Replace the layout snapshot exposed by the most recent native render. */
|
|
816
780
|
function updateLastRenderLayouts(layouts) {
|
|
817
781
|
lastRenderLayouts = layouts;
|
|
818
782
|
}
|
|
819
|
-
/** Read the complete layout snapshot produced by the latest native frame. */
|
|
820
783
|
function getLastRenderLayouts() {
|
|
821
784
|
return lastRenderLayouts;
|
|
822
785
|
}
|
|
823
|
-
/** Look up the latest native layout for an element or component public instance. */
|
|
824
786
|
function getLastRenderLayout(node) {
|
|
825
787
|
const id = node?.id ?? node?.$el?.id;
|
|
826
788
|
if (id === void 0) return null;
|
|
827
789
|
return lastRenderLayouts.find((layout) => layout.id === id) ?? null;
|
|
828
790
|
}
|
|
829
|
-
/** Return the latest element dimensions, falling back to zero before layout. */
|
|
830
791
|
function measureElement(node) {
|
|
831
792
|
const layout = getLastRenderLayout(node);
|
|
832
793
|
return {
|
|
@@ -836,7 +797,6 @@ function measureElement(node) {
|
|
|
836
797
|
}
|
|
837
798
|
//#endregion
|
|
838
799
|
//#region src/mouseRouting.ts
|
|
839
|
-
/** Create isolated pointer-routing state for one mounted Fresco application. */
|
|
840
800
|
function createMouseRoutingState() {
|
|
841
801
|
return { hoveredTargetId: void 0 };
|
|
842
802
|
}
|
|
@@ -877,13 +837,11 @@ function routePointerTransitions(renderer, target, event, state, publish) {
|
|
|
877
837
|
}
|
|
878
838
|
}
|
|
879
839
|
}
|
|
880
|
-
/** Hit-test one normalized mouse packet and route it through the host tree. */
|
|
881
840
|
function routeMouseInput(renderer, root, event, layouts, state, publishTransition) {
|
|
882
841
|
const target = renderer.hitTest(root, event.x, event.y, layouts);
|
|
883
842
|
if (state) routePointerTransitions(renderer, target, event, state, publishTransition);
|
|
884
843
|
if (target) renderer.dispatchInput(target.id, event);
|
|
885
844
|
}
|
|
886
|
-
/** Route transitions and the native packet, publishing each even when a handler throws. */
|
|
887
845
|
function routeAndPublishMouseInput(renderer, root, event, layouts, sink, state) {
|
|
888
846
|
try {
|
|
889
847
|
if (root) routeMouseInput(renderer, root, event, layouts, state ?? stateForMountedRoot(root), (transition) => {
|
|
@@ -895,7 +853,6 @@ function routeAndPublishMouseInput(renderer, root, event, layouts, sink, state)
|
|
|
895
853
|
}
|
|
896
854
|
//#endregion
|
|
897
855
|
//#region src/nativeInput.ts
|
|
898
|
-
/** Accept only key event phases supported by the public Fresco protocol. */
|
|
899
856
|
function normalizeKeyEventType(value) {
|
|
900
857
|
switch (value) {
|
|
901
858
|
case "press":
|
|
@@ -904,7 +861,6 @@ function normalizeKeyEventType(value) {
|
|
|
904
861
|
default: return;
|
|
905
862
|
}
|
|
906
863
|
}
|
|
907
|
-
/** Preserve the generated native mouse contract at the public protocol boundary. */
|
|
908
864
|
function normalizeMouseEvent(event) {
|
|
909
865
|
return {
|
|
910
866
|
type: "mouse",
|
|
@@ -924,7 +880,6 @@ function normalizeMouseEvent(event) {
|
|
|
924
880
|
} : void 0
|
|
925
881
|
};
|
|
926
882
|
}
|
|
927
|
-
/** Normalize one native input packet into the public Fresco event protocol. */
|
|
928
883
|
function normalizeInputEvent(event) {
|
|
929
884
|
switch (event.eventType) {
|
|
930
885
|
case "resize": return {
|
|
@@ -970,11 +925,9 @@ function normalizeInputEvent(event) {
|
|
|
970
925
|
}
|
|
971
926
|
//#endregion
|
|
972
927
|
//#region src/staticNodes.ts
|
|
973
|
-
/** Whether a renderer node owns append-only static output. */
|
|
974
928
|
function isStaticNode(node) {
|
|
975
929
|
return node.props.internal_static === true || node.props.internalStatic === true;
|
|
976
930
|
}
|
|
977
|
-
/** Whether a renderer node is one append-only item inside a static owner. */
|
|
978
931
|
function isStaticItemNode(node) {
|
|
979
932
|
return node.props.internal_static_item === true || node.props.internalStaticItem === true;
|
|
980
933
|
}
|
|
@@ -1003,20 +956,14 @@ function treeToString(node, options = {}) {
|
|
|
1003
956
|
const style = node.props.style ?? {};
|
|
1004
957
|
return joinOutput(childOutput, (style.flexDirection ?? style.flex_direction) === "column" ? "\n" : "");
|
|
1005
958
|
}
|
|
1006
|
-
/** Drops one trailing newline, so joined outputs do not gain blank lines. */
|
|
1007
959
|
function normalizeOutput(output) {
|
|
1008
960
|
return output.endsWith("\n") ? output.slice(0, -1) : output;
|
|
1009
961
|
}
|
|
1010
|
-
/** Adds a later render below the earlier text; an empty render leaves it unchanged. */
|
|
1011
962
|
function appendOutput(previous, next) {
|
|
1012
963
|
const normalized = normalizeOutput(next);
|
|
1013
964
|
if (!normalized) return previous;
|
|
1014
965
|
return previous ? `${previous}\n${normalized}` : normalized;
|
|
1015
966
|
}
|
|
1016
|
-
/**
|
|
1017
|
-
* Text of the `<Static>` items not printed yet. `renderedStaticItems` records,
|
|
1018
|
-
* per `<Static>` node, how many items earlier renders already printed.
|
|
1019
|
-
*/
|
|
1020
967
|
function captureStaticOutput(node, renderedStaticItems) {
|
|
1021
968
|
const output = [];
|
|
1022
969
|
function visit(current) {
|
|
@@ -1034,10 +981,6 @@ function captureStaticOutput(node, renderedStaticItems) {
|
|
|
1034
981
|
return joinOutput(output, "\n");
|
|
1035
982
|
}
|
|
1036
983
|
const PLAIN_OUTPUT_CONTROL_CHARACTERS = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/gu;
|
|
1037
|
-
/**
|
|
1038
|
-
* Plain output is written to the stream as is, so displayed text must not be able
|
|
1039
|
-
* to drive the terminal: every control character except tab and newline is dropped.
|
|
1040
|
-
*/
|
|
1041
984
|
function renderPlainOutput(root, staticOutput) {
|
|
1042
985
|
return joinOutput([staticOutput, treeToString(root, { skipStatic: true })], "\n").replaceAll(PLAIN_OUTPUT_CONTROL_CHARACTERS, "");
|
|
1043
986
|
}
|
|
@@ -1060,7 +1003,6 @@ function zIndex(node) {
|
|
|
1060
1003
|
function containsPoint(layout, clip, x, y) {
|
|
1061
1004
|
return x >= layout.x && x < layout.x + layout.width && y >= layout.y && y < layout.y + layout.height && x >= clip.left && x < clip.right && y >= clip.top && y < clip.bottom;
|
|
1062
1005
|
}
|
|
1063
|
-
/** Return the deepest topmost live host node under one native-layout coordinate. */
|
|
1064
1006
|
function hitTest(nodes, root, x, y, layouts) {
|
|
1065
1007
|
if (!Number.isFinite(x) || !Number.isFinite(y)) return void 0;
|
|
1066
1008
|
const byId = new Map(layouts.map((layout) => [layout.id, layout]));
|
|
@@ -1102,15 +1044,10 @@ function hitTest(nodes, root, x, y, layouts) {
|
|
|
1102
1044
|
}
|
|
1103
1045
|
//#endregion
|
|
1104
1046
|
//#region src/renderer.ts
|
|
1105
|
-
/**
|
|
1106
|
-
* Fresco Vue Custom Renderer
|
|
1107
|
-
*/
|
|
1108
1047
|
let nextId = 0;
|
|
1109
|
-
/** Keep only dimension values accepted by the public style contract. */
|
|
1110
1048
|
function dimension(value) {
|
|
1111
1049
|
return typeof value === "string" || typeof value === "number" ? value : void 0;
|
|
1112
1050
|
}
|
|
1113
|
-
/** Read the dimensions declared directly by a host node before native layout. */
|
|
1114
1051
|
function declaredSize(node) {
|
|
1115
1052
|
const style = typeof node.props.style === "object" && node.props.style !== null ? node.props.style : {};
|
|
1116
1053
|
return {
|
|
@@ -1118,11 +1055,9 @@ function declaredSize(node) {
|
|
|
1118
1055
|
height: dimension(style.height ?? node.props.height)
|
|
1119
1056
|
};
|
|
1120
1057
|
}
|
|
1121
|
-
/** Compare declared dimensions without coercing numeric and string values. */
|
|
1122
1058
|
function sameSize(left, right) {
|
|
1123
1059
|
return Object.is(left.width, right.width) && Object.is(left.height, right.height);
|
|
1124
1060
|
}
|
|
1125
|
-
/** Allocate and register one stable host node before exposing it to Vue. */
|
|
1126
1061
|
function createNode(tree, type, text) {
|
|
1127
1062
|
const node = {
|
|
1128
1063
|
id: nextId++,
|
|
@@ -1136,11 +1071,9 @@ function createNode(tree, type, text) {
|
|
|
1136
1071
|
tree.lifecycle.onCreate?.(node);
|
|
1137
1072
|
return node;
|
|
1138
1073
|
}
|
|
1139
|
-
/** Publish a committed host-tree update to the optional lifecycle observer. */
|
|
1140
1074
|
function notifyUpdate(tree, node, kind) {
|
|
1141
1075
|
tree.lifecycle.onUpdate?.(node, kind);
|
|
1142
1076
|
}
|
|
1143
|
-
/** Dispose a registered subtree depth-first, reporting each node once. */
|
|
1144
1077
|
function disposeNode(tree, node) {
|
|
1145
1078
|
if (!tree.nodes.has(node.id)) return false;
|
|
1146
1079
|
for (const child of node.children) disposeNode(tree, child);
|
|
@@ -1150,7 +1083,6 @@ function disposeNode(tree, node) {
|
|
|
1150
1083
|
tree.lifecycle.onRemove?.(node);
|
|
1151
1084
|
return true;
|
|
1152
1085
|
}
|
|
1153
|
-
/** Detach a node only after its parent collection reflects the removal. */
|
|
1154
1086
|
function detachNode(tree, node) {
|
|
1155
1087
|
const parent = node.parent;
|
|
1156
1088
|
if (!parent) return false;
|
|
@@ -1185,9 +1117,6 @@ function dispatchAtNode(node, event, capture, eventName) {
|
|
|
1185
1117
|
handled += callInputHandlers(node.props[`on${eventName}${suffix}`], event);
|
|
1186
1118
|
return handled;
|
|
1187
1119
|
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Renderer options for Fresco
|
|
1190
|
-
*/
|
|
1191
1120
|
function rendererOptions(tree) {
|
|
1192
1121
|
return {
|
|
1193
1122
|
patchProp(el, key, _prevValue, nextValue) {
|
|
@@ -1260,9 +1189,6 @@ function rendererOptions(tree) {
|
|
|
1260
1189
|
}
|
|
1261
1190
|
};
|
|
1262
1191
|
}
|
|
1263
|
-
/**
|
|
1264
|
-
* Map Vue element types to Fresco node types
|
|
1265
|
-
*/
|
|
1266
1192
|
function mapElementType(type) {
|
|
1267
1193
|
switch (type.toLowerCase()) {
|
|
1268
1194
|
case "box":
|
|
@@ -1278,9 +1204,6 @@ function mapElementType(type) {
|
|
|
1278
1204
|
default: return "box";
|
|
1279
1205
|
}
|
|
1280
1206
|
}
|
|
1281
|
-
/**
|
|
1282
|
-
* Create a Fresco renderer with stable host-node lookup and lifecycle control.
|
|
1283
|
-
*/
|
|
1284
1207
|
function createRenderer$1(options = {}) {
|
|
1285
1208
|
const normalized = typeof options === "function" ? { onMutation: options } : options;
|
|
1286
1209
|
const tree = {
|
|
@@ -1290,22 +1213,18 @@ function createRenderer$1(options = {}) {
|
|
|
1290
1213
|
};
|
|
1291
1214
|
const renderer = createRenderer(rendererOptions(tree));
|
|
1292
1215
|
return Object.assign(renderer, {
|
|
1293
|
-
/** Return one live host node by its stable identifier. */
|
|
1294
1216
|
getNode(id) {
|
|
1295
1217
|
return tree.nodes.get(id);
|
|
1296
1218
|
},
|
|
1297
|
-
/** Find one node under the supplied subtree without crossing its boundary. */
|
|
1298
1219
|
findDescendantById(root, id) {
|
|
1299
1220
|
if (root.id === id) return root;
|
|
1300
1221
|
const registered = tree.nodes.get(id);
|
|
1301
1222
|
if (!registered) return void 0;
|
|
1302
1223
|
for (let parent = registered.parent; parent; parent = parent.parent) if (parent === root) return registered;
|
|
1303
1224
|
},
|
|
1304
|
-
/** Find the live host node registered for one logical focus target. */
|
|
1305
1225
|
findNodeByFocusId(root, focusId) {
|
|
1306
1226
|
return findHostNodeByFocusId(root, focusId);
|
|
1307
1227
|
},
|
|
1308
|
-
/** Detach and dispose a registered node and every descendant exactly once. */
|
|
1309
1228
|
destroyRecursively(id) {
|
|
1310
1229
|
const node = tree.nodes.get(id);
|
|
1311
1230
|
if (!node) return false;
|
|
@@ -1314,14 +1233,9 @@ function createRenderer$1(options = {}) {
|
|
|
1314
1233
|
tree.onMutation();
|
|
1315
1234
|
return true;
|
|
1316
1235
|
},
|
|
1317
|
-
/**
|
|
1318
|
-
* Return the deepest topmost node under one native-layout coordinate.
|
|
1319
|
-
* Hidden and scroll overflow constrain descendant targeting on each axis.
|
|
1320
|
-
*/
|
|
1321
1236
|
hitTest(root, x, y, layouts) {
|
|
1322
1237
|
return hitTest(tree.nodes, root, x, y, layouts);
|
|
1323
1238
|
},
|
|
1324
|
-
/** Route normalized input through capture, target, and bubble handlers. */
|
|
1325
1239
|
dispatchInput(targetId, input) {
|
|
1326
1240
|
const target = tree.nodes.get(targetId);
|
|
1327
1241
|
if (!target) return void 0;
|
|
@@ -1374,9 +1288,6 @@ function createRenderer$1(options = {}) {
|
|
|
1374
1288
|
}
|
|
1375
1289
|
});
|
|
1376
1290
|
}
|
|
1377
|
-
/**
|
|
1378
|
-
* Convert Fresco tree to render nodes for native
|
|
1379
|
-
*/
|
|
1380
1291
|
function treeToRenderNodes(root) {
|
|
1381
1292
|
const nodes = [];
|
|
1382
1293
|
function visit(node) {
|
|
@@ -1389,7 +1300,6 @@ function treeToRenderNodes(root) {
|
|
|
1389
1300
|
}
|
|
1390
1301
|
//#endregion
|
|
1391
1302
|
//#region src/renderToStringStreams.ts
|
|
1392
|
-
/** Create a detached writable stream for non-interactive Fresco rendering. */
|
|
1393
1303
|
function createNoopWriteStream(columns, rows) {
|
|
1394
1304
|
const stream = {
|
|
1395
1305
|
isTTY: false,
|
|
@@ -1403,7 +1313,6 @@ function createNoopWriteStream(columns, rows) {
|
|
|
1403
1313
|
};
|
|
1404
1314
|
return stream;
|
|
1405
1315
|
}
|
|
1406
|
-
/** Create a detached readable stream for non-interactive Fresco rendering. */
|
|
1407
1316
|
function createNoopReadStream() {
|
|
1408
1317
|
const stream = {
|
|
1409
1318
|
isTTY: false,
|
|
@@ -1440,11 +1349,9 @@ function isTruthyEnvironmentValue(value) {
|
|
|
1440
1349
|
function isCiEnvironment(env = process.env) {
|
|
1441
1350
|
return CI_ENVIRONMENT_KEYS.some((key) => isTruthyEnvironmentValue(env[key]));
|
|
1442
1351
|
}
|
|
1443
|
-
/** Resolve whether an application can own the interactive terminal lifecycle. */
|
|
1444
1352
|
function detectInteractiveMode(interactive, stdout) {
|
|
1445
1353
|
return interactive ?? (stdout.isTTY === true && !isCiEnvironment());
|
|
1446
1354
|
}
|
|
1447
|
-
/** Initialize the native terminal modes required by an interactive application. */
|
|
1448
1355
|
function initializeTerminal(native, options) {
|
|
1449
1356
|
if (typeof native.initTerminalWithOptions === "function") native.initTerminalWithOptions({
|
|
1450
1357
|
alternateScreen: options.alternateScreen,
|
|
@@ -1460,20 +1367,11 @@ function initializeTerminal(native, options) {
|
|
|
1460
1367
|
}
|
|
1461
1368
|
//#endregion
|
|
1462
1369
|
//#region src/app.ts
|
|
1463
|
-
/**
|
|
1464
|
-
* Fresco App - Application instance management
|
|
1465
|
-
*/
|
|
1466
|
-
/** Latest normalized key event received by the active Fresco application. */
|
|
1467
1370
|
const lastKeyEvent = ref(null);
|
|
1468
|
-
/** Latest bracketed-paste event received by the active Fresco application. */
|
|
1469
1371
|
const lastPasteEvent = ref(null);
|
|
1470
|
-
/** Latest terminal resize event received by the active Fresco application. */
|
|
1471
1372
|
const lastResizeEvent = ref(null);
|
|
1472
|
-
/** Latest normalized mouse event received by the active Fresco application. */
|
|
1473
1373
|
const lastMouseEvent = ref(null);
|
|
1474
|
-
/** Latest terminal focus event received by the active Fresco application. */
|
|
1475
1374
|
const lastFocusEvent = ref(null);
|
|
1476
|
-
/** Latest IME composition event received by the active Fresco application. */
|
|
1477
1375
|
const lastCompositionEvent = ref(null);
|
|
1478
1376
|
let native = null;
|
|
1479
1377
|
const consoleMethods = [
|
|
@@ -1568,9 +1466,6 @@ function updateAppSize(context, width, height) {
|
|
|
1568
1466
|
context.width.value = width;
|
|
1569
1467
|
context.height.value = height;
|
|
1570
1468
|
}
|
|
1571
|
-
/**
|
|
1572
|
-
* Create a Fresco TUI app
|
|
1573
|
-
*/
|
|
1574
1469
|
function createApp(rootComponent, options = {}) {
|
|
1575
1470
|
const { mouse = false, exitOnCtrlC = true, onError } = options;
|
|
1576
1471
|
const interactive = detectInteractiveMode(options.interactive, options.stdout ?? process.stdout);
|
|
@@ -1900,9 +1795,6 @@ function createApp(rootComponent, options = {}) {
|
|
|
1900
1795
|
};
|
|
1901
1796
|
return instance;
|
|
1902
1797
|
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Ink-compatible helper that mounts immediately.
|
|
1905
|
-
*/
|
|
1906
1798
|
function render(root, options = {}) {
|
|
1907
1799
|
const renderOptions = normalizeRenderOptions(options);
|
|
1908
1800
|
const rootRef = shallowRef(root);
|
|
@@ -1928,9 +1820,6 @@ function render(root, options = {}) {
|
|
|
1928
1820
|
clear: () => app.clear()
|
|
1929
1821
|
};
|
|
1930
1822
|
}
|
|
1931
|
-
/**
|
|
1932
|
-
* Render a Fresco component to a plain string without starting a terminal app.
|
|
1933
|
-
*/
|
|
1934
1823
|
function renderToString(root, options = {}) {
|
|
1935
1824
|
const { createApp: createVueApp } = createRenderer$1();
|
|
1936
1825
|
const app = createVueApp(componentFromRoot(root));
|
|
@@ -1961,6 +1850,6 @@ function renderToString(root, options = {}) {
|
|
|
1961
1850
|
return output;
|
|
1962
1851
|
}
|
|
1963
1852
|
//#endregion
|
|
1964
|
-
export { useFocusManager as A, useStdin as C, createFocusManager as D, FOCUS_KEY as E,
|
|
1853
|
+
export { useFocusManager as A, useStdin as C, createFocusManager as D, FOCUS_KEY as E, SCREEN_READER_KEY as F, isScreenReaderEnabledByDefault as I, treeToScreenReaderString as L, APP_KEY as M, createAppContext as N, provideFocusScope as O, useApp as P, useStderr as S, useStreamsContext as T, CURSOR_KEY as _, lastMouseEvent as a, STREAMS_KEY as b, render as c, treeToRenderNodes as d, isStaticItemNode as f, updateLastRenderLayouts as g, measureElement as h, lastKeyEvent as i, createFocusId as j, useFocus as k, renderToString as l, getLastRenderLayout as m, lastCompositionEvent as n, lastPasteEvent as o, isStaticNode as p, lastFocusEvent as r, lastResizeEvent as s, createApp as t, createRenderer$1 as u, createCursorContext as v, useStdout as w, createStreamsContext as x, useCursor as y };
|
|
1965
1854
|
|
|
1966
|
-
//# sourceMappingURL=app-
|
|
1855
|
+
//# sourceMappingURL=app-ByxmaQXv.mjs.map
|