@toolpath/dfm 0.0.0-stage → 0.1.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.
@@ -0,0 +1,117 @@
1
+ import * as react from 'react';
2
+ import { FC, KeyboardEvent, Ref } from 'react';
3
+ import { D as DfmRule, a as DfmCheck, b as DfmFeature, F as FeatureSheets, U as Units, R as ReachCurve, c as FeatureProfile } from './reach-CfmYU_yQ.js';
4
+
5
+ /**
6
+ * The rules the list shows, and how to change them. The app owns them —
7
+ * where they are kept, and what they start as — so the list works on any
8
+ * store and ships no rules of its own.
9
+ */
10
+ interface DfmRules {
11
+ rules: readonly DfmRule[];
12
+ /** Adds a rule at the end of the list. */
13
+ add: (rule: DfmRule) => void;
14
+ /** Replaces the rule with the same id. */
15
+ update: (rule: DfmRule) => void;
16
+ remove: (id: string) => void;
17
+ /** Puts an imported set in place of the list. */
18
+ replace: (rules: readonly DfmRule[]) => void;
19
+ }
20
+ /** The feature, or group of holes, the pointer is over in a list; null for none. */
21
+ type Hovered = string | readonly string[] | null;
22
+ interface RuleListProps {
23
+ rules: DfmRules;
24
+ /** The part checked against the rules; null while the analysis runs. */
25
+ check: DfmCheck | null;
26
+ features: readonly DfmFeature[] | null;
27
+ sheets: FeatureSheets | null;
28
+ units: Units;
29
+ /** The feature being inspected, marked in the lists. */
30
+ selected: string | null;
31
+ /** The group of holes being inspected, if one is. */
32
+ selectedGroup: readonly string[] | null;
33
+ onInspect: (tag: string, group?: readonly string[]) => void;
34
+ onHover: (hovered: Hovered) => void;
35
+ }
36
+
37
+ /**
38
+ * The rule list's keys: put them on the whole panel that holds the list, so
39
+ * the arrow keys work from its header and buttons too.
40
+ */
41
+ declare const ruleListKeys: (event: react.KeyboardEvent<HTMLElement>) => void;
42
+ /**
43
+ * The rules, one row each, each written as the sentence it is — "Holes with
44
+ * L/D ≥ 8" — whose words are its fields: change the features, the measure,
45
+ * the comparison or the number in place, with no form to open. The sentence
46
+ * wraps rather than cuts off, so the whole rule always reads.
47
+ *
48
+ * Beside it, the rule's colour and how many required features break it; the
49
+ * count opens to those features, identical holes gathered into one row as
50
+ * the quoting app gathers them. Choosing one inspects it.
51
+ *
52
+ * Up and down walk the rules and the features of any that are open, a
53
+ * feature highlighting as it is reached; right opens a rule (or a group of
54
+ * holes) and left shuts it, or from a feature goes back up. Tab moves
55
+ * through a rule's words.
56
+ *
57
+ * The rules come from the app, which keeps them and decides what they start as.
58
+ */
59
+ declare const RuleList: FC<RuleListProps>;
60
+
61
+ interface SwatchProps {
62
+ color: string;
63
+ label?: string;
64
+ onClick?: () => void;
65
+ onKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;
66
+ /** The list the swatch is a row of, for the arrow keys (see `list-keys.ts`). */
67
+ listItem?: string;
68
+ className?: string;
69
+ ref?: Ref<HTMLButtonElement>;
70
+ }
71
+ /** A rule's colour, as a dot, one that can be clicked where it can be changed. */
72
+ declare const Swatch: FC<SwatchProps>;
73
+
74
+ /**
75
+ * Arrow keys through a list, for every list on the page: the rules, a rule's
76
+ * features, a face's candidate features, the colour swatches.
77
+ *
78
+ * A list's rows are the elements marked `data-list-item` with the list's
79
+ * name, found afresh on each key in the order they are drawn, so rows that
80
+ * are shut or not mounted are passed over. Up and down (left and right, for
81
+ * a row of swatches) move one row, Home and End to either end. A row marked
82
+ * `data-follow` is chosen as it is reached, as a click would — for rows
83
+ * whose choosing only highlights, so walking the list shows each in turn.
84
+ * From outside the rows (a panel's header, its buttons), the first key goes
85
+ * to the chosen row (`aria-pressed`) — or on from it, for a followed row,
86
+ * which is already showing — else to the end it points toward.
87
+ *
88
+ * Keys typed into a field are the field's: a select's own arrows, a number
89
+ * being edited.
90
+ */
91
+ declare const listKeys: (name: string, orientation?: "vertical" | "horizontal") => (event: KeyboardEvent<HTMLElement>) => void;
92
+ /** A control that uses the arrow keys itself. A colour well does not. */
93
+ declare const isField: (target: EventTarget | null) => boolean;
94
+
95
+ interface ReachChartProps {
96
+ /** The feature's reach curve, whole: the chart trims it past full height itself. */
97
+ curve: ReachCurve;
98
+ units: Units;
99
+ /**
100
+ * The feature beside its walls: drawn to its own width where known, though
101
+ * the width is not written on the drawing, because the curve is read out
102
+ * from the wall and the feature across is no part of it. Its depth is
103
+ * marked, being on the same scale as the walls' heights; a through feature
104
+ * has no floor.
105
+ */
106
+ feature: FeatureProfile;
107
+ }
108
+
109
+ /**
110
+ * The section alone, as a panel shows it: dimensioned, as wide as the panel
111
+ * gives it.
112
+ */
113
+ declare const ReachChart: FC<ReachChartProps>;
114
+ /** A larger window's contents: the section, large, with what it is and how to read it. */
115
+ declare const ReachDrawing: FC<ReachChartProps>;
116
+
117
+ export { type DfmRules, type Hovered, ReachChart, type ReachChartProps, ReachDrawing, RuleList, type RuleListProps, Swatch, type SwatchProps, isField, listKeys, ruleListKeys };