@tastic/hud 0.2.0 → 0.3.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/index.d.mts +73 -23
- package/dist/index.d.ts +73 -23
- package/dist/index.js +229 -75
- package/dist/index.mjs +207 -58
- package/package.json +1 -1
- package/src/CornerActionButtons.tsx +39 -0
- package/src/LabeledDropdown.tsx +175 -0
- package/src/SharedActionBand.tsx +61 -0
- package/src/index.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -120,21 +120,21 @@ function TriggerGauge({ segments, litIndices, size, accentColor, mutedColor, das
|
|
|
120
120
|
height: canvasSize,
|
|
121
121
|
width: canvasSize
|
|
122
122
|
};
|
|
123
|
-
return /* @__PURE__ */ (0,
|
|
124
|
-
/* @__PURE__ */ (0,
|
|
125
|
-
/* @__PURE__ */ (0,
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native10.View, { style: [styles7.container, gaugeSizeStyle], pointerEvents: "none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native_skia.Canvas, { style: canvasSizeStyle, children: [
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_skia.Path, { path: unlitPath, style: "stroke", strokeWidth: UNLIT_THICKNESS, strokeCap: "round", color: mutedColor, opacity: 0.35 }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_skia.Path, { path: litPath, style: "stroke", strokeWidth: LIT_THICKNESS, strokeCap: "round", color: accentColor, opacity: 1 })
|
|
126
126
|
] }) });
|
|
127
127
|
}
|
|
128
|
-
var import_react_native_skia, import_core3, import_react3,
|
|
128
|
+
var import_react_native_skia, import_core3, import_react3, import_react_native10, import_react_native_reanimated, import_jsx_runtime8, UNLIT_THICKNESS, LIT_THICKNESS, DASH_GAP_PX, ARC_GAP, DEFAULT_START_DEG, MIN_DASH_ANGLE_DEG, MOUNT_DURATION_MS, MOUNT_STAGGER_MS, SELECTION_TRANSITION_DURATION_MS, styles7;
|
|
129
129
|
var init_TriggerGauge = __esm({
|
|
130
130
|
"src/TriggerGauge.tsx"() {
|
|
131
131
|
"use strict";
|
|
132
132
|
import_react_native_skia = require("@shopify/react-native-skia");
|
|
133
133
|
import_core3 = require("@tastic/core");
|
|
134
134
|
import_react3 = require("react");
|
|
135
|
-
|
|
135
|
+
import_react_native10 = require("react-native");
|
|
136
136
|
import_react_native_reanimated = require("react-native-reanimated");
|
|
137
|
-
|
|
137
|
+
import_jsx_runtime8 = require("react/jsx-runtime");
|
|
138
138
|
UNLIT_THICKNESS = 3;
|
|
139
139
|
LIT_THICKNESS = 7;
|
|
140
140
|
DASH_GAP_PX = 9;
|
|
@@ -144,7 +144,7 @@ var init_TriggerGauge = __esm({
|
|
|
144
144
|
MOUNT_DURATION_MS = 450;
|
|
145
145
|
MOUNT_STAGGER_MS = 40;
|
|
146
146
|
SELECTION_TRANSITION_DURATION_MS = 260;
|
|
147
|
-
|
|
147
|
+
styles7 = import_react_native10.StyleSheet.create({
|
|
148
148
|
container: {
|
|
149
149
|
alignItems: "center",
|
|
150
150
|
justifyContent: "center",
|
|
@@ -158,13 +158,18 @@ var init_TriggerGauge = __esm({
|
|
|
158
158
|
var index_exports = {};
|
|
159
159
|
__export(index_exports, {
|
|
160
160
|
BaseSettingsDialog: () => BaseSettingsDialog,
|
|
161
|
+
CornerActionButtons: () => CornerActionButtons,
|
|
161
162
|
InlineColorPicker: () => InlineColorPicker,
|
|
163
|
+
LABELED_DROPDOWN_POPOVER_WIDTH: () => LABELED_DROPDOWN_POPOVER_WIDTH,
|
|
164
|
+
LabeledDropdown: () => LabeledDropdown,
|
|
162
165
|
MONO_FONT: () => MONO_FONT,
|
|
163
166
|
PopoverBody: () => PopoverBody,
|
|
164
167
|
PressAwayOverlay: () => PressAwayOverlay,
|
|
165
168
|
ReadyButton: () => ReadyButton,
|
|
166
169
|
SectionedDropdown: () => SectionedDropdown,
|
|
170
|
+
SharedActionBand: () => SharedActionBand,
|
|
167
171
|
TriggerGaugeHost: () => TriggerGaugeHost,
|
|
172
|
+
getLabeledDropdownContentHeight: () => getLabeledDropdownContentHeight,
|
|
168
173
|
loadSkiaWeb: () => loadSkiaWeb,
|
|
169
174
|
useAutoAlign: () => useAutoAlign,
|
|
170
175
|
usePopoverHost: () => usePopoverHost
|
|
@@ -373,42 +378,61 @@ var styles = import_react_native.StyleSheet.create({
|
|
|
373
378
|
}
|
|
374
379
|
});
|
|
375
380
|
|
|
376
|
-
// src/
|
|
381
|
+
// src/CornerActionButtons.tsx
|
|
382
|
+
var import_feedback_press2 = require("@rific/feedback-press");
|
|
377
383
|
var import_react_native2 = require("react-native");
|
|
378
|
-
var
|
|
384
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
385
|
+
function CornerActionButtons({ onBack, onSettings, fg, insets }) {
|
|
386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_feedback_press2.IconButton, { icon: "arrow-left", iconColor: fg, size: 24, style: [styles2.back, { top: 8 + insets.top, left: 8 + insets.left }], onPress: onBack, accessibilityLabel: "Back" }),
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_feedback_press2.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles2.topRight, { top: 8 + insets.top, right: 8 + insets.right }], onPress: onSettings, accessibilityLabel: "Settings" })
|
|
389
|
+
] });
|
|
390
|
+
}
|
|
391
|
+
var styles2 = import_react_native2.StyleSheet.create({
|
|
392
|
+
back: {
|
|
393
|
+
position: "absolute"
|
|
394
|
+
},
|
|
395
|
+
topRight: {
|
|
396
|
+
position: "absolute"
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
// src/fonts.ts
|
|
401
|
+
var import_react_native3 = require("react-native");
|
|
402
|
+
var MONO_FONT = import_react_native3.Platform.select({ ios: "Menlo", android: "monospace", default: "monospace" });
|
|
379
403
|
|
|
380
404
|
// src/InlineColorPicker.tsx
|
|
381
405
|
var import_auto_paper2 = require("@rific/auto-paper");
|
|
382
|
-
var
|
|
406
|
+
var import_feedback_press3 = require("@rific/feedback-press");
|
|
383
407
|
var import_core2 = require("@tastic/core");
|
|
384
|
-
var
|
|
408
|
+
var import_react_native6 = require("react-native");
|
|
385
409
|
var import_react_native_paper2 = require("react-native-paper");
|
|
386
410
|
|
|
387
411
|
// src/PopoverBody.tsx
|
|
388
|
-
var
|
|
389
|
-
var
|
|
412
|
+
var import_react_native4 = require("react-native");
|
|
413
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
390
414
|
var CARET_SIZE = 7;
|
|
391
415
|
var CARET_RING_OFFSET = 2;
|
|
392
416
|
var CARET_DIP = 1;
|
|
393
417
|
function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }) {
|
|
394
418
|
if (!visible) return null;
|
|
395
419
|
const above = verticalAlign === "above";
|
|
396
|
-
const alignStyle = align === "left" ?
|
|
397
|
-
const verticalStyle = above ?
|
|
420
|
+
const alignStyle = align === "left" ? styles3.contentLeft : align === "right" ? styles3.contentRight : styles3.contentCenter;
|
|
421
|
+
const verticalStyle = above ? styles3.contentAbove : styles3.contentBelow;
|
|
398
422
|
const ringSize = CARET_SIZE + caretBorderWidth;
|
|
399
423
|
const caretOffset = (halfFootprint) => align === "right" ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint };
|
|
400
424
|
const caretFill = above ? "borderTopColor" : "borderBottomColor";
|
|
401
425
|
const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
|
|
402
426
|
const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
|
|
403
|
-
return /* @__PURE__ */ (0,
|
|
427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native4.View, { style: [styles3.content, alignStyle, verticalStyle], children: [
|
|
404
428
|
children,
|
|
405
|
-
caretColor && /* @__PURE__ */ (0,
|
|
406
|
-
/* @__PURE__ */ (0,
|
|
407
|
-
/* @__PURE__ */ (0,
|
|
429
|
+
caretColor && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native4.View, { style: [styles3.caret, caretOffset(ringSize), caretEdge(ringSize), { [caretFill]: caretBorderColor ?? caretColor, [caretWidthProp]: ringSize, borderLeftWidth: ringSize, borderRightWidth: ringSize }] }),
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native4.View, { style: [styles3.caret, caretOffset(CARET_SIZE), caretEdge(CARET_SIZE - CARET_RING_OFFSET), { [caretFill]: caretColor, [caretWidthProp]: CARET_SIZE, borderLeftWidth: CARET_SIZE, borderRightWidth: CARET_SIZE }] })
|
|
408
432
|
] })
|
|
409
433
|
] });
|
|
410
434
|
}
|
|
411
|
-
var
|
|
435
|
+
var styles3 = import_react_native4.StyleSheet.create({
|
|
412
436
|
caret: {
|
|
413
437
|
borderLeftColor: "transparent",
|
|
414
438
|
borderRightColor: "transparent",
|
|
@@ -452,11 +476,11 @@ var styles2 = import_react_native3.StyleSheet.create({
|
|
|
452
476
|
|
|
453
477
|
// src/useAutoAlign.ts
|
|
454
478
|
var import_react2 = require("react");
|
|
455
|
-
var
|
|
479
|
+
var import_react_native5 = require("react-native");
|
|
456
480
|
var EDGE_MARGIN = 12;
|
|
457
481
|
function useAutoAlign(open, contentWidth, contentHeight) {
|
|
458
482
|
const triggerRef = (0, import_react2.useRef)(null);
|
|
459
|
-
const { width: windowWidth, height: windowHeight } = (0,
|
|
483
|
+
const { width: windowWidth, height: windowHeight } = (0, import_react_native5.useWindowDimensions)();
|
|
460
484
|
const [align, setAlign] = (0, import_react2.useState)("center");
|
|
461
485
|
const [verticalAlign, setVerticalAlign] = (0, import_react2.useState)("below");
|
|
462
486
|
const [maxHeight, setMaxHeight] = (0, import_react2.useState)(contentHeight);
|
|
@@ -489,7 +513,7 @@ function useAutoAlign(open, contentWidth, contentHeight) {
|
|
|
489
513
|
}
|
|
490
514
|
|
|
491
515
|
// src/InlineColorPicker.tsx
|
|
492
|
-
var
|
|
516
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
493
517
|
var EMOJI_PATTERN = /\p{Extended_Pictographic}/u;
|
|
494
518
|
var DEFAULT_SIZE = 48;
|
|
495
519
|
var SWATCH_SIZE = 28;
|
|
@@ -504,7 +528,7 @@ function widthForColumns(columns) {
|
|
|
504
528
|
}
|
|
505
529
|
function InlineColorPicker({ id, host, value, onChange, swatches = import_auto_paper2.defaultColors, takenValue, allowSwapTaken, dark, align: alignOverride, icon = "palette", tag, labelFontFamily = MONO_FONT, autoDismiss = true, columns, size = DEFAULT_SIZE }) {
|
|
506
530
|
const menuBg = dark ? "#000000" : "#FFFFFF";
|
|
507
|
-
const { width: windowWidth } = (0,
|
|
531
|
+
const { width: windowWidth } = (0, import_react_native6.useWindowDimensions)();
|
|
508
532
|
const autoColumns = (0, import_core2.clamp)(Math.floor((windowWidth - 2 * SCREEN_MARGIN + SWATCHES_GAP) / (SWATCH_SIZE + SWATCHES_GAP)), MIN_COLUMNS, MAX_COLUMNS);
|
|
509
533
|
const resolvedColumns = columns ?? autoColumns;
|
|
510
534
|
const swatchesWidth = widthForColumns(resolvedColumns);
|
|
@@ -515,14 +539,14 @@ function InlineColorPicker({ id, host, value, onChange, swatches = import_auto_p
|
|
|
515
539
|
const align = alignOverride ?? autoAlign;
|
|
516
540
|
const contrastColor = (0, import_auto_paper2.getContrastColor)(value);
|
|
517
541
|
const tagFontSize = size * (tag && EMOJI_PATTERN.test(tag) ? 0.6 : 0.4);
|
|
518
|
-
return /* @__PURE__ */ (0,
|
|
519
|
-
/* @__PURE__ */ (0,
|
|
520
|
-
/* @__PURE__ */ (0,
|
|
542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native6.View, { style: [styles4.anchor, open && styles4.anchorOpen], children: [
|
|
543
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_feedback_press3.TouchableRipple, { onPress: () => host.toggle(id), borderless: true, style: [styles4.trigger, { backgroundColor: value, borderRadius: size / 2, height: size, width: size }], children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native6.View, { ref: triggerRef, collapsable: false, style: styles4.triggerMeasure, children: tag ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper2.Text, { style: [styles4.tagLabel, { color: contrastColor, fontFamily: labelFontFamily, fontSize: tagFontSize }], numberOfLines: 1, adjustsFontSizeToFit: true, children: tag }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper2.Icon, { source: icon, size: size * 0.6, color: contrastColor }) }) }),
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PopoverBody, { visible: open && measured, align, verticalAlign, caretColor: menuBg, caretBorderColor: value, caretBorderWidth: SWATCHES_BORDER_WIDTH, triggerSize: size, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native6.ScrollView, { style: [styles4.swatches, { backgroundColor: menuBg, borderColor: value, width: swatchesWidth, maxHeight }], contentContainerStyle: styles4.swatchesContent, showsVerticalScrollIndicator: false, children: swatches.map((swatch) => {
|
|
521
545
|
const selected = swatch.value.toLowerCase() === value.toLowerCase();
|
|
522
546
|
const taken = !selected && !!takenValue && swatch.value.toLowerCase() === takenValue.toLowerCase();
|
|
523
547
|
const swappable = taken && allowSwapTaken;
|
|
524
|
-
return /* @__PURE__ */ (0,
|
|
525
|
-
|
|
548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
549
|
+
import_feedback_press3.TouchableRipple,
|
|
526
550
|
{
|
|
527
551
|
disabled: taken && !swappable,
|
|
528
552
|
onPress: () => {
|
|
@@ -530,15 +554,15 @@ function InlineColorPicker({ id, host, value, onChange, swatches = import_auto_p
|
|
|
530
554
|
if (autoDismiss) host.close();
|
|
531
555
|
},
|
|
532
556
|
borderless: true,
|
|
533
|
-
style: [
|
|
534
|
-
children: selected ? /* @__PURE__ */ (0,
|
|
557
|
+
style: [styles4.swatch, { backgroundColor: swatch.value }, selected && styles4.swatchSelected, taken && !swappable && styles4.swatchTaken],
|
|
558
|
+
children: selected ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper2.Icon, { source: "check", size: 16, color: (0, import_auto_paper2.getContrastColor)(swatch.value) }) : swappable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper2.Icon, { source: "swap-horizontal", size: 16, color: (0, import_auto_paper2.getContrastColor)(swatch.value) }) : taken ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper2.Icon, { source: "close", size: 16, color: (0, import_auto_paper2.getContrastColor)(swatch.value) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native6.View, {})
|
|
535
559
|
},
|
|
536
560
|
swatch.value
|
|
537
561
|
);
|
|
538
562
|
}) }) })
|
|
539
563
|
] });
|
|
540
564
|
}
|
|
541
|
-
var
|
|
565
|
+
var styles4 = import_react_native6.StyleSheet.create({
|
|
542
566
|
anchor: {
|
|
543
567
|
position: "relative"
|
|
544
568
|
},
|
|
@@ -609,31 +633,126 @@ var styles3 = import_react_native5.StyleSheet.create({
|
|
|
609
633
|
}
|
|
610
634
|
});
|
|
611
635
|
|
|
636
|
+
// src/LabeledDropdown.tsx
|
|
637
|
+
var import_auto_paper3 = require("@rific/auto-paper");
|
|
638
|
+
var import_feedback_press4 = require("@rific/feedback-press");
|
|
639
|
+
var import_react_native7 = require("react-native");
|
|
640
|
+
var import_react_native_paper3 = require("react-native-paper");
|
|
641
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
642
|
+
var TRIGGER_HEIGHT = 28;
|
|
643
|
+
var POPOVER_WIDTH = 180;
|
|
644
|
+
var ROW_HEIGHT = 36;
|
|
645
|
+
var LIST_PADDING = 8;
|
|
646
|
+
var LABELED_DROPDOWN_POPOVER_WIDTH = POPOVER_WIDTH;
|
|
647
|
+
function getLabeledDropdownContentHeight(optionCount) {
|
|
648
|
+
return LIST_PADDING * 2 + optionCount * ROW_HEIGHT;
|
|
649
|
+
}
|
|
650
|
+
function LabeledDropdown({ id, host, options, value, onChange, color, dark, align: forcedAlign, alignOverride }) {
|
|
651
|
+
const menuBg = dark ? "#000000" : "#FFFFFF";
|
|
652
|
+
const fg = dark ? "#FFFFFF" : "#000000";
|
|
653
|
+
const open = host.openId === id;
|
|
654
|
+
const selected = options.find((o) => o.value === value) ?? null;
|
|
655
|
+
const contentHeight = LIST_PADDING * 2 + options.length * ROW_HEIGHT;
|
|
656
|
+
const auto = useAutoAlign(open, POPOVER_WIDTH, contentHeight);
|
|
657
|
+
const placement = alignOverride ?? auto;
|
|
658
|
+
const { maxHeight, measured, triggerRef, verticalAlign } = placement;
|
|
659
|
+
const align = forcedAlign ?? placement.align;
|
|
660
|
+
const handleSelect = (option) => {
|
|
661
|
+
onChange(option.value);
|
|
662
|
+
host.close();
|
|
663
|
+
};
|
|
664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native7.View, { style: [styles5.anchor, open && styles5.anchorOpen], children: [
|
|
665
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_feedback_press4.TouchableRipple, { onPress: () => host.toggle(id), style: styles5.trigger, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native7.View, { ref: triggerRef, collapsable: false, style: styles5.triggerInner, children: [
|
|
666
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper3.Text, { style: [styles5.triggerLabel, { color }], numberOfLines: 1, children: (selected?.label ?? "").toUpperCase() }),
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper3.Icon, { source: "menu-down", size: 16, color })
|
|
668
|
+
] }) }),
|
|
669
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PopoverBody, { visible: open && measured, align, verticalAlign, caretColor: menuBg, caretBorderColor: color, caretBorderWidth: 2, triggerSize: TRIGGER_HEIGHT, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native7.ScrollView, { style: [styles5.menu, { backgroundColor: menuBg, borderColor: color, width: POPOVER_WIDTH, maxHeight }], contentContainerStyle: styles5.menuContent, showsVerticalScrollIndicator: false, children: options.map((option) => {
|
|
670
|
+
const isSelected = option.value === value;
|
|
671
|
+
const onColor = (0, import_auto_paper3.getContrastColor)(color);
|
|
672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_feedback_press4.TouchableRipple, { onPress: () => handleSelect(option), style: [styles5.row, isSelected && { backgroundColor: color }], children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native7.View, { style: styles5.rowInner, children: [
|
|
673
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper3.Icon, { source: option.icon, size: 18, color: isSelected ? onColor : fg }),
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper3.Text, { style: [styles5.rowLabel, { color: isSelected ? onColor : fg }], numberOfLines: 1, children: option.label })
|
|
675
|
+
] }) }, option.value);
|
|
676
|
+
}) }) })
|
|
677
|
+
] });
|
|
678
|
+
}
|
|
679
|
+
var styles5 = import_react_native7.StyleSheet.create({
|
|
680
|
+
anchor: {
|
|
681
|
+
position: "relative"
|
|
682
|
+
},
|
|
683
|
+
// React Native Web gives every position:'relative' view its own stacking context, so the
|
|
684
|
+
// elevation has to live on the anchor itself — see PopoverBody's own stacking-context notes.
|
|
685
|
+
anchorOpen: {
|
|
686
|
+
zIndex: 100
|
|
687
|
+
},
|
|
688
|
+
menu: {
|
|
689
|
+
borderRadius: 12,
|
|
690
|
+
borderWidth: 2,
|
|
691
|
+
elevation: 8,
|
|
692
|
+
shadowColor: "#000000",
|
|
693
|
+
shadowOffset: { height: 2, width: 0 },
|
|
694
|
+
shadowOpacity: 0.3,
|
|
695
|
+
shadowRadius: 8
|
|
696
|
+
},
|
|
697
|
+
menuContent: {
|
|
698
|
+
padding: LIST_PADDING
|
|
699
|
+
},
|
|
700
|
+
row: {
|
|
701
|
+
borderRadius: 8,
|
|
702
|
+
height: ROW_HEIGHT
|
|
703
|
+
},
|
|
704
|
+
rowInner: {
|
|
705
|
+
alignItems: "center",
|
|
706
|
+
flexDirection: "row",
|
|
707
|
+
flex: 1,
|
|
708
|
+
gap: 8,
|
|
709
|
+
paddingHorizontal: 12
|
|
710
|
+
},
|
|
711
|
+
rowLabel: {
|
|
712
|
+
flex: 1,
|
|
713
|
+
fontSize: 14
|
|
714
|
+
},
|
|
715
|
+
trigger: {
|
|
716
|
+
alignSelf: "flex-start"
|
|
717
|
+
},
|
|
718
|
+
triggerInner: {
|
|
719
|
+
alignItems: "center",
|
|
720
|
+
flexDirection: "row",
|
|
721
|
+
gap: 2,
|
|
722
|
+
height: TRIGGER_HEIGHT
|
|
723
|
+
},
|
|
724
|
+
triggerLabel: {
|
|
725
|
+
fontSize: 13,
|
|
726
|
+
fontWeight: "700",
|
|
727
|
+
letterSpacing: 1
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
|
|
612
731
|
// src/loadSkiaWeb.ts
|
|
613
732
|
function loadSkiaWeb() {
|
|
614
733
|
return Promise.resolve();
|
|
615
734
|
}
|
|
616
735
|
|
|
617
736
|
// src/PressAwayOverlay.tsx
|
|
618
|
-
var
|
|
619
|
-
var
|
|
737
|
+
var import_react_native8 = require("react-native");
|
|
738
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
620
739
|
function PressAwayOverlay({ active, onPress, style }) {
|
|
621
740
|
if (!active) return null;
|
|
622
|
-
return /* @__PURE__ */ (0,
|
|
741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native8.Pressable, { accessibilityLabel: "Dismiss", accessibilityRole: "button", onPress, style: [import_react_native8.StyleSheet.absoluteFill, style] });
|
|
623
742
|
}
|
|
624
743
|
|
|
625
744
|
// src/ReadyButton.tsx
|
|
626
|
-
var
|
|
627
|
-
var
|
|
628
|
-
var
|
|
629
|
-
var
|
|
745
|
+
var import_feedback_press5 = require("@rific/feedback-press");
|
|
746
|
+
var import_react_native9 = require("react-native");
|
|
747
|
+
var import_react_native_paper4 = require("react-native-paper");
|
|
748
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
630
749
|
function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily = MONO_FONT }) {
|
|
631
|
-
const readyButtonStyle = [
|
|
750
|
+
const readyButtonStyle = [styles6.readyButton, { borderColor: color }, ready && { backgroundColor: color }, style];
|
|
632
751
|
const labelTextStyle = { fontFamily: labelFontFamily, fontWeight: "bold" };
|
|
633
752
|
const labelColorStyle = { color: ready ? "#000000" : color };
|
|
634
|
-
return /* @__PURE__ */ (0,
|
|
753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_feedback_press5.TouchableRipple, { onPress: onToggleReady, borderless: true, style: readyButtonStyle, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper4.Text, { variant: "labelLarge", style: [labelTextStyle, labelColorStyle], children: ready ? "READY \u2713" : "READY?" }) });
|
|
635
754
|
}
|
|
636
|
-
var
|
|
755
|
+
var styles6 = import_react_native9.StyleSheet.create({
|
|
637
756
|
readyButton: {
|
|
638
757
|
alignItems: "center",
|
|
639
758
|
borderRadius: 12,
|
|
@@ -646,21 +765,21 @@ var styles4 = import_react_native7.StyleSheet.create({
|
|
|
646
765
|
});
|
|
647
766
|
|
|
648
767
|
// src/SectionedDropdown.tsx
|
|
649
|
-
var
|
|
650
|
-
var
|
|
651
|
-
var
|
|
652
|
-
var
|
|
768
|
+
var import_auto_paper4 = require("@rific/auto-paper");
|
|
769
|
+
var import_feedback_press6 = require("@rific/feedback-press");
|
|
770
|
+
var import_react_native11 = require("react-native");
|
|
771
|
+
var import_react_native_paper5 = require("react-native-paper");
|
|
653
772
|
|
|
654
773
|
// src/TriggerGaugeHost.tsx
|
|
655
774
|
var import_react4 = require("react");
|
|
656
|
-
var
|
|
775
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
657
776
|
var LazyTriggerGauge = (0, import_react4.lazy)(() => loadSkiaWeb().then(() => Promise.resolve().then(() => (init_TriggerGauge(), TriggerGauge_exports)).then((m) => ({ default: m.TriggerGauge }))));
|
|
658
777
|
function TriggerGaugeHost(props) {
|
|
659
|
-
return /* @__PURE__ */ (0,
|
|
778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react4.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LazyTriggerGauge, { ...props }) });
|
|
660
779
|
}
|
|
661
780
|
|
|
662
781
|
// src/SectionedDropdown.tsx
|
|
663
|
-
var
|
|
782
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
664
783
|
var MENU_BORDER_WIDTH = 1;
|
|
665
784
|
var TRIGGER_SIZE = 44;
|
|
666
785
|
var MENU_MIN_WIDTH = 200;
|
|
@@ -673,8 +792,8 @@ var MENU_DIVIDER_HEIGHT = 9;
|
|
|
673
792
|
var MENU_VERTICAL_PADDING = 12;
|
|
674
793
|
function SectionedDropdown({ id, host, icon, accessibilityLabel, sections, accentColor, mutedColor, onAccentColor, dark, align: alignOverride, autoDismiss = true, labelFontFamily = MONO_FONT, allClearLabels = { all: "All", clear: "Clear" } }) {
|
|
675
794
|
const menuBg = dark ? "#000000" : "#FFFFFF";
|
|
676
|
-
const menuBorderColor = (0,
|
|
677
|
-
const resolvedOnAccentColor = onAccentColor ?? (0,
|
|
795
|
+
const menuBorderColor = (0, import_auto_paper4.getBlendedColor)(mutedColor, menuBg, 0.5);
|
|
796
|
+
const resolvedOnAccentColor = onAccentColor ?? (0, import_auto_paper4.getColorRoles)(accentColor, menuBg).onColor;
|
|
678
797
|
const fg = dark ? "#FFFFFF" : "#000000";
|
|
679
798
|
const open = host.openId === id;
|
|
680
799
|
const estimatedHeight = MENU_VERTICAL_PADDING + sections.reduce((sum, section, sectionIndex) => {
|
|
@@ -706,17 +825,17 @@ function SectionedDropdown({ id, host, icon, accessibilityLabel, sections, accen
|
|
|
706
825
|
}
|
|
707
826
|
gaugeOffset += section.options.length;
|
|
708
827
|
}
|
|
709
|
-
const anchorStyle = [
|
|
828
|
+
const anchorStyle = [styles8.anchor, open && styles8.anchorOpen];
|
|
710
829
|
const menuStyle = { backgroundColor: menuBg, borderColor: menuBorderColor, maxHeight };
|
|
711
830
|
const dividerStyle = { backgroundColor: menuBorderColor };
|
|
712
|
-
return /* @__PURE__ */ (0,
|
|
713
|
-
/* @__PURE__ */ (0,
|
|
714
|
-
/* @__PURE__ */ (0,
|
|
715
|
-
/* @__PURE__ */ (0,
|
|
831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native11.View, { style: anchorStyle, children: [
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native11.View, { ref: triggerRef, collapsable: false, style: styles8.triggerBox, children: [
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TriggerGaugeHost, { segments: gaugeSegments, litIndices: gaugeLitIndices, size: TRIGGER_SIZE, accentColor, mutedColor }),
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_feedback_press6.IconButton, { icon: triggerIcon, iconColor: triggerIconColor, size: triggerIconSize, accessibilityLabel, onPress: () => host.toggle(id) })
|
|
716
835
|
] }),
|
|
717
|
-
/* @__PURE__ */ (0,
|
|
718
|
-
sectionIndex > 0 && /* @__PURE__ */ (0,
|
|
719
|
-
section.kind === "single" ? /* @__PURE__ */ (0,
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverBody, { visible: open && measured, align, verticalAlign, caretColor: menuBg, caretBorderColor: menuBorderColor, caretBorderWidth: MENU_BORDER_WIDTH, triggerSize: TRIGGER_SIZE, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native11.ScrollView, { style: [styles8.menu, menuStyle], contentContainerStyle: styles8.menuContent, showsVerticalScrollIndicator: false, children: sections.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native11.View, { children: [
|
|
837
|
+
sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native11.View, { style: [styles8.divider, dividerStyle] }),
|
|
838
|
+
section.kind === "single" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
720
839
|
SingleSection,
|
|
721
840
|
{
|
|
722
841
|
section,
|
|
@@ -729,7 +848,7 @@ function SectionedDropdown({ id, host, icon, accessibilityLabel, sections, accen
|
|
|
729
848
|
if (autoDismiss) host.close();
|
|
730
849
|
}
|
|
731
850
|
}
|
|
732
|
-
) : /* @__PURE__ */ (0,
|
|
851
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MultiSection, { section, accentColor, onAccentColor: resolvedOnAccentColor, mutedColor, labelFontFamily, allClearLabels })
|
|
733
852
|
] }, section.id)) }) })
|
|
734
853
|
] });
|
|
735
854
|
}
|
|
@@ -741,17 +860,17 @@ function SingleSection({
|
|
|
741
860
|
labelFontFamily,
|
|
742
861
|
onSelect
|
|
743
862
|
}) {
|
|
744
|
-
return /* @__PURE__ */ (0,
|
|
863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: section.options.map((option) => {
|
|
745
864
|
const selected = option.value === section.value;
|
|
746
865
|
const rowColor = selected ? onAccentColor : mutedColor;
|
|
747
|
-
const itemStyle = [
|
|
866
|
+
const itemStyle = [styles8.item, selected && { backgroundColor: accentColor }];
|
|
748
867
|
const labelStyle = { fontFamily: labelFontFamily, color: rowColor, fontWeight: selected ? "bold" : "normal" };
|
|
749
868
|
const descriptionStyle = { fontFamily: labelFontFamily, color: rowColor };
|
|
750
|
-
return /* @__PURE__ */ (0,
|
|
751
|
-
option.icon && /* @__PURE__ */ (0,
|
|
752
|
-
/* @__PURE__ */ (0,
|
|
753
|
-
/* @__PURE__ */ (0,
|
|
754
|
-
option.description && /* @__PURE__ */ (0,
|
|
869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_feedback_press6.TouchableRipple, { onPress: () => onSelect(option.value), style: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native11.View, { style: styles8.itemRow, children: [
|
|
870
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper5.Icon, { source: option.icon, size: MENU_ITEM_ICON_SIZE, color: rowColor }),
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native11.View, { style: styles8.itemLabelColumn, children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper5.Text, { variant: "labelLarge", style: labelStyle, children: option.label }),
|
|
873
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper5.Text, { variant: "labelSmall", style: descriptionStyle, children: option.description })
|
|
755
874
|
] })
|
|
756
875
|
] }) }, option.value);
|
|
757
876
|
}) });
|
|
@@ -765,23 +884,23 @@ function MultiSection({
|
|
|
765
884
|
allClearLabels
|
|
766
885
|
}) {
|
|
767
886
|
const allSelected = section.value.length === section.options.length;
|
|
768
|
-
return /* @__PURE__ */ (0,
|
|
887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
769
888
|
section.options.map((option, i) => {
|
|
770
889
|
const selected = section.value.includes(option.value);
|
|
771
890
|
const rowColor = selected ? onAccentColor : mutedColor;
|
|
772
891
|
const prevSelected = selected && i > 0 && section.value.includes(section.options[i - 1].value);
|
|
773
892
|
const nextSelected = selected && i < section.options.length - 1 && section.value.includes(section.options[i + 1].value);
|
|
774
|
-
const itemStyle = [
|
|
893
|
+
const itemStyle = [styles8.item, selected && { backgroundColor: accentColor }, prevSelected && { borderTopLeftRadius: 0, borderTopRightRadius: 0 }, nextSelected && { borderBottomLeftRadius: 0, borderBottomRightRadius: 0 }];
|
|
775
894
|
const labelStyle = { fontFamily: labelFontFamily, color: rowColor, fontWeight: selected ? "bold" : "normal" };
|
|
776
|
-
return /* @__PURE__ */ (0,
|
|
777
|
-
option.icon && /* @__PURE__ */ (0,
|
|
778
|
-
/* @__PURE__ */ (0,
|
|
895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_feedback_press6.TouchableRipple, { onPress: () => section.onChange(selected ? section.value.filter((v) => v !== option.value) : [...section.value, option.value]), style: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native11.View, { style: styles8.itemRow, children: [
|
|
896
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper5.Icon, { source: option.icon, size: MENU_ITEM_ICON_SIZE, color: rowColor }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper5.Text, { variant: "labelLarge", style: [styles8.itemLabelFlex, labelStyle], children: option.label })
|
|
779
898
|
] }) }, option.value);
|
|
780
899
|
}),
|
|
781
|
-
section.allClear && /* @__PURE__ */ (0,
|
|
900
|
+
section.allClear && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_feedback_press6.TouchableRipple, { onPress: () => section.onChange(allSelected ? [] : section.options.map((o) => o.value)), style: styles8.item, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper5.Text, { variant: "labelLarge", style: [styles8.allClearLabel, { fontFamily: labelFontFamily, color: accentColor }], children: allSelected ? allClearLabels.clear : allClearLabels.all }) })
|
|
782
901
|
] });
|
|
783
902
|
}
|
|
784
|
-
var
|
|
903
|
+
var styles8 = import_react_native11.StyleSheet.create({
|
|
785
904
|
allClearLabel: {
|
|
786
905
|
fontWeight: "bold",
|
|
787
906
|
textAlign: "center"
|
|
@@ -798,7 +917,7 @@ var styles6 = import_react_native9.StyleSheet.create({
|
|
|
798
917
|
zIndex: 100
|
|
799
918
|
},
|
|
800
919
|
divider: {
|
|
801
|
-
height:
|
|
920
|
+
height: import_react_native11.StyleSheet.hairlineWidth,
|
|
802
921
|
marginVertical: 4
|
|
803
922
|
},
|
|
804
923
|
item: {
|
|
@@ -845,6 +964,36 @@ var styles6 = import_react_native9.StyleSheet.create({
|
|
|
845
964
|
}
|
|
846
965
|
});
|
|
847
966
|
|
|
967
|
+
// src/SharedActionBand.tsx
|
|
968
|
+
var import_feedback_press7 = require("@rific/feedback-press");
|
|
969
|
+
var import_react_native12 = require("react-native");
|
|
970
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
971
|
+
function SharedActionBand({ onBack, onSettings, onRandomize, onReset, fg, popoverOpen, children }) {
|
|
972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: [styles9.column, popoverOpen && styles9.columnOpen], children: [
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.actionsRow, children: [
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press7.IconButton, { icon: "arrow-left", iconColor: fg, size: 20, onPress: onBack, accessibilityLabel: "Back" }),
|
|
975
|
+
onRandomize && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press7.IconButton, { icon: "dice-multiple", iconColor: fg, size: 18, onPress: onRandomize, accessibilityLabel: "Randomize match settings" }),
|
|
976
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press7.IconButton, { icon: "restore", iconColor: fg, size: 18, onPress: onReset, accessibilityLabel: "Reset match settings to defaults" }),
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press7.IconButton, { icon: "cog", iconColor: fg, size: 20, onPress: onSettings, accessibilityLabel: "Settings" })
|
|
978
|
+
] }),
|
|
979
|
+
children
|
|
980
|
+
] });
|
|
981
|
+
}
|
|
982
|
+
var styles9 = import_react_native12.StyleSheet.create({
|
|
983
|
+
actionsRow: {
|
|
984
|
+
alignItems: "center",
|
|
985
|
+
flexDirection: "row",
|
|
986
|
+
gap: 16
|
|
987
|
+
},
|
|
988
|
+
column: {
|
|
989
|
+
alignItems: "center",
|
|
990
|
+
gap: 8
|
|
991
|
+
},
|
|
992
|
+
columnOpen: {
|
|
993
|
+
zIndex: 100
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
|
|
848
997
|
// src/usePopoverHost.ts
|
|
849
998
|
var import_react5 = require("react");
|
|
850
999
|
function usePopoverHost() {
|
|
@@ -858,13 +1007,18 @@ function usePopoverHost() {
|
|
|
858
1007
|
// Annotate the CommonJS export names for ESM import in node:
|
|
859
1008
|
0 && (module.exports = {
|
|
860
1009
|
BaseSettingsDialog,
|
|
1010
|
+
CornerActionButtons,
|
|
861
1011
|
InlineColorPicker,
|
|
1012
|
+
LABELED_DROPDOWN_POPOVER_WIDTH,
|
|
1013
|
+
LabeledDropdown,
|
|
862
1014
|
MONO_FONT,
|
|
863
1015
|
PopoverBody,
|
|
864
1016
|
PressAwayOverlay,
|
|
865
1017
|
ReadyButton,
|
|
866
1018
|
SectionedDropdown,
|
|
1019
|
+
SharedActionBand,
|
|
867
1020
|
TriggerGaugeHost,
|
|
1021
|
+
getLabeledDropdownContentHeight,
|
|
868
1022
|
loadSkiaWeb,
|
|
869
1023
|
useAutoAlign,
|
|
870
1024
|
usePopoverHost
|