1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 FernTech
//! Tier-3 style protocol for the touch text-selection chrome — the selection
//! handles and the magnifier that `crate::text_touch` raises.
//!
//! One of the few Tier-3 traits that returns **pure-data recipes only**, with
//! no `make_*(cfg, ctx) -> WidgetId` — the others are
//! [`ChartStyle`](crate::styles::ChartStyle) and
//! [`GridViewStyle`](crate::styles::GridViewStyle), and for the same reason:
//! the chrome is single-node batched paint. Here that is a disc on a stem and a
//! framed lens whose interior is a replay of the host's own text layer. A
//! composed subtree would buy nothing, while forcing the affordance widgets —
//! which live in `teksilo-core` — to depend on `teksilo-widgets`.
//!
//! The shipped default, `RecipeTextSelectionStyle`, therefore lives in
//! `teksilo-widgets` (`styles/recipe_text_selection_style.rs`); this crate
//! holds the trait, the recipes and the `Rc<dyn TextSelectionStyle>` slot type.
//!
//! # Density
//!
//! A recipe is built once per density with `for_tokens(&InputTokens)`. The two
//! dimensions are classified differently on purpose:
//!
//! * the **hit extent** is a [`TargetRole::Target`](teksilo_tokens::TargetRole)
//! and routes through [`dp`](crate::styles::density::dp), so it can only grow
//! with density;
//! * the **painted diameter** is a
//! [`Decoration`](teksilo_tokens::TargetRole::Decoration) and is the same at
//! every density. It is chrome already sized to a fingertip, and target
//! conformance is measured on the hit rectangle, not on the paint — the rule
//! `docs/density-and-targets.md` states for any affordance whose hit area is
//! widened rather than its ink.
use Rc;
use crate;
/// Painted geometry and colours of one selection handle.
///
/// `hit_size` is the extent of the handle's own node — a square centred on the
/// anchor point — and `diameter` is the disc drawn inside it. The disc is
/// always centred in the hit square, so a caller that changes one without the
/// other still gets a centred handle.
/// Painted geometry and colours of the magnifier lens.
///
/// The lens interior is not painted by the style: it is a replay of the host's
/// own text layer under a transform and a clip (see
/// [`crate::text_touch::magnifier`]). The style owns only the frame around it.
/// Tier-3 protocol for the touch text-selection chrome. See the module docs.
/// Shared handle type stored in
/// [`ComponentStyleSlots::text_selection`](crate::styles::ComponentStyleSlots).
pub type SharedTextSelectionStyle = ;