@rulecad/fixings 0.1.8 → 0.2.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/model.d.mts CHANGED
@@ -3,8 +3,11 @@ export function oneOf(what: any, k: any, v: any, list: any): any;
3
3
  /**
4
4
  * A fixing's name read by the grammar, before any rule set is looked at.
5
5
  * @param {string} name 'M3', 'M3x12 cap', '1/4-20 x 1/2 cap', 'M4 lock nut', 'K30x10 pan torx'
6
- * @returns {{ thread: string, form: 'metric' | 'unified' | 'plastic', length: number | null, unit: 'mm' | 'in' | null, item: 'thread' | 'screw' | 'nut' | 'washer' | 'insert', head: string | null, nut: string | null, extra: string[], printed?: boolean }}
7
- * length: as written, in unit (null: the thread's own, mm or inches); extra: words left for the rule set's variants; printed: the word printed was said
6
+ * @returns {{ thread: string, form: 'metric' | 'unified' | 'plastic', length: number | null, unit: 'mm' | 'in' | null,
7
+ * item: 'thread' | 'screw' | 'nut' | 'washer' | 'insert', head: string | null, nut: string | null, extra: string[],
8
+ * printed?: boolean }}
9
+ * length: as written, in unit (null: the thread's own, mm or inches); extra: words left for the rule set's variants;
10
+ * printed: the word printed was said
8
11
  */
9
12
  export function parseName(name: string): {
10
13
  thread: string;
@@ -38,7 +41,8 @@ export function headOf(what: string, m: Fixing, form: string): Head;
38
41
  /**
39
42
  * A nut on a thread, from its figures: refused by name where that size has none.
40
43
  * @param {string} what @param {Fixing} m @param {string} kind hex, square or lock
41
- * @returns {{ kind: string, flats: number, height: number, across: number, figures: string[] }} across: over the corners
44
+ * @returns {{ kind: string, flats: number, height: number, across: number, figures: string[] }} across: over the
45
+ * corners
42
46
  */
43
47
  export function nutOf(what: string, m: Fixing, kind: string): {
44
48
  kind: string;
@@ -57,25 +61,33 @@ export function lengthOf(what: string, m: Fixing, length: number, allow?: boolea
57
61
  sold: boolean | null;
58
62
  };
59
63
  /**
60
- * @typedef {{ value: number | string | number[], unit?: string, kind: string, source: string, rule?: string, checked?: string, from?: 'workspace' | 'kit' }} Figure
61
- * one figure of a thread: its value, how far to trust it (kind: spec, measured, community, estimate, default, derived or given) and where it comes from
62
- * @typedef {{ form: string, diameter: number, height: number, across: number, key?: number, flats?: number, angle?: number, point?: number, drive?: string, figures: string[] }} Head
63
- * a head: its diameter (0 for a hexagon head, which has flats, and for a set screw), its height (0 for a set screw), across: the widest it is; figures: the rules it was read from
64
- * @typedef {{ kind: 'fixing', item: 'thread' | 'screw' | 'nut' | 'washer' | 'insert', name: string, said: string, set: string, thread: string,
65
- * form: 'metric' | 'unified' | 'plastic', major: number, pitch: number, length: number | null, sold: boolean | null, head: Head | null,
66
- * nut: { kind: string, flats: number, height: number, across: number, figures: string[] } | null, variant: string | null,
67
- * made: { heads: string[], nuts: string[], washer: boolean, insert: boolean }, figures: Record<string, Figure> }} Fixing
68
- * name: the name in its one spelling; said: as it was asked for; set: the rule set's name; major, pitch: the thread, mm;
69
- * length: a screw's, from under its head (a countersunk screw's and a set screw's: overall), or an insert's; sold: whether that length
70
- * is in the thread's list (null: it lists none); made: the head forms, nuts, washer and insert this size has figures for
64
+ * @typedef {{ value: number | string | number[], unit?: string, kind: string, source: string, rule?: string,
65
+ * checked?: string, from?: 'workspace' | 'kit' }} Figure
66
+ * one figure of a thread: its value, how far to trust it (kind: spec, measured, community, estimate, default, derived
67
+ * or given) and where it comes from
68
+ * @typedef {{ form: string, diameter: number, height: number, across: number, key?: number, flats?: number,
69
+ * angle?: number, point?: number, drive?: string, figures: string[] }} Head
70
+ * a head: its diameter (0 for a hexagon head, which has flats, and for a set screw), its height (0 for a set screw),
71
+ * across: the widest it is; figures: the rules it was read from
72
+ * @typedef {{ kind: 'fixing', item: 'thread' | 'screw' | 'nut' | 'washer' | 'insert', name: string, said: string,
73
+ * set: string, thread: string,
74
+ * form: 'metric' | 'unified' | 'plastic', major: number, pitch: number, length: number | null, sold: boolean | null,
75
+ * head: Head | null, nut: { kind: string, flats: number, height: number, across: number, figures: string[] } | null,
76
+ * variant: string | null, made: { heads: string[], nuts: string[], washer: boolean, insert: boolean }, figures:
77
+ * Record<string, Figure> }} Fixing name: the name in its one spelling; said: as it was asked for; set: the rule set's
78
+ * name; major, pitch: the thread, mm; length: a screw's, from under its head (a countersunk screw's and a set
79
+ * screw's: overall), or an insert's; sold: whether that length is in the thread's list (null: it lists none); made:
80
+ * the head forms, nuts, washer and insert this size has figures for
71
81
  */
72
82
  /**
73
83
  * A fixing by name, from its thread's rule set: a thread ('M3', '1/4-20'), or a whole screw ('M3x12 cap'), nut
74
84
  * ('M4 lock nut'), washer or insert on it. See GRAMMAR for what a name may say.
75
85
  * @param {string} name
76
- * @param {Record<string, number | string | number[] | Partial<Figure>>} [change] a different or measured figure, by its rule's name:
86
+ * @param {Record<string, number | string | number[] | Partial<Figure>>} [change] a different or measured figure, by its
87
+ * rule's name:
77
88
  * { clearance: 3.3 } or { pilot: { value: 2.8, kind: 'measured', source: 'my coupon, 2026-11-20' } }
78
- * @param {{ sets?: object, anyLength?: boolean, variant?: string }} [opts] sets: the workspace's rule sets, by name or as a
89
+ * @param {{ sets?: object, anyLength?: boolean, variant?: string }} [opts] sets: the workspace's rule sets, by name or
90
+ * as a
79
91
  * list, where a set for this thread is used before the kit's (its figures first, the kit's for what it lacks);
80
92
  * anyLength: take a length the thread's list does not have; variant: a variant of the rule set, by its name
81
93
  * @returns {Fixing}
@@ -87,7 +99,8 @@ export function fixingModel(name: string, change?: Record<string, number | strin
87
99
  }): Fixing;
88
100
  /**
89
101
  * A fixing from what a function was handed: its model as it is, or a name read with the caller's rule sets.
90
- * @param {string} what the function asking, for its refusals @param {Fixing | string} m @param {{ sets?: object, anyLength?: boolean }} [o]
102
+ * @param {string} what the function asking, for its
103
+ * refusals @param {Fixing | string} m @param {{ sets?: object, anyLength?: boolean }} [o]
91
104
  * @returns {Fixing}
92
105
  */
93
106
  export function fixingOf(what: string, m: Fixing | string, o?: {
@@ -95,15 +108,17 @@ export function fixingOf(what: string, m: Fixing | string, o?: {
95
108
  anyLength?: boolean;
96
109
  }): Fixing;
97
110
  /**
98
- * @typedef {{ name: string, figure: (k: string) => (Figure & { name: string, borrowed?: boolean }) | null, n: (k: string) => number, cite: (k: string) => string, rest: (k: string) => object }} Printer
99
- * figure: a rule of the printer's own (never borrowed); n: a basic clearance as a number, the printer's own or, where it
100
- * has none, the X1C's; cite: the name that number is cited by
111
+ * @typedef {{ name: string, figure: (k: string) => (Figure & { name: string, borrowed?: boolean }) | null,
112
+ * n: (k: string) => number, cite: (k: string) => string, rest: (k: string) => object }} Printer
113
+ * figure: a rule of the printer's own (never borrowed); n: a basic clearance as a number, the printer's own or, where
114
+ * it has none, the X1C's; cite: the name that number is cited by
101
115
  */
102
116
  /**
103
117
  * The printer's rules as fixings reads them. Handed nothing, the kit's X1C. Handed a rule set ({ name, rules }), its
104
118
  * figures with their kinds and sources. Handed plain numbers (a design's v.x1c), those, marked as given. A basic
105
- * clearance the printer lacks (hole_comp, fit, layer, line, chamfer, bridge, overhang, slip, press, thread_gap, snap_clearance, pin_press, pin_slip, magnet_press, magnet_glue, magnet_crush, print_gap) is borrowed from the X1C
106
- * and cited as the X1C's; a measured figure (pilot_m3) is never borrowed, since it was measured on that machine.
119
+ * clearance the printer lacks (hole_comp, fit, layer, line, chamfer, bridge, overhang, slip, press, thread_gap,
120
+ * snap_clearance, pin_press, pin_slip, magnet_press, magnet_glue, magnet_crush, print_gap) is borrowed from the X1C and
121
+ * cited as the X1C's; a measured figure (pilot_m3) is never borrowed, since it was measured on that machine.
107
122
  * @param {string} what @param {object} [p] @returns {Printer}
108
123
  */
109
124
  export function printerOf(what: string, p?: object): Printer;
@@ -178,7 +193,8 @@ export const ENGAGEMENT: {
178
193
  export function engagementOf(material: any): "plastic" | "steel" | "aluminium";
179
194
  export function layers(h: any, layer: any): number;
180
195
  /**
181
- * one figure of a thread: its value, how far to trust it (kind: spec, measured, community, estimate, default, derived or given) and where it comes from
196
+ * one figure of a thread: its value, how far to trust it (kind: spec, measured, community, estimate, default, derived
197
+ * or given) and where it comes from
182
198
  */
183
199
  export type Figure = {
184
200
  value: number | string | number[];
@@ -190,7 +206,8 @@ export type Figure = {
190
206
  from?: "workspace" | "kit";
191
207
  };
192
208
  /**
193
- * a head: its diameter (0 for a hexagon head, which has flats, and for a set screw), its height (0 for a set screw), across: the widest it is; figures: the rules it was read from
209
+ * a head: its diameter (0 for a hexagon head, which has flats, and for a set screw), its height (0 for a set screw),
210
+ * across: the widest it is; figures: the rules it was read from
194
211
  */
195
212
  export type Head = {
196
213
  form: string;
@@ -205,9 +222,10 @@ export type Head = {
205
222
  figures: string[];
206
223
  };
207
224
  /**
208
- * name: the name in its one spelling; said: as it was asked for; set: the rule set's name; major, pitch: the thread, mm;
209
- * length: a screw's, from under its head (a countersunk screw's and a set screw's: overall), or an insert's; sold: whether that length
210
- * is in the thread's list (null: it lists none); made: the head forms, nuts, washer and insert this size has figures for
225
+ * name: the name in its one spelling; said: as it was asked for; set: the rule set's
226
+ * name; major, pitch: the thread, mm; length: a screw's, from under its head (a countersunk screw's and a set
227
+ * screw's: overall), or an insert's; sold: whether that length is in the thread's list (null: it lists none); made:
228
+ * the head forms, nuts, washer and insert this size has figures for
211
229
  */
212
230
  export type Fixing = {
213
231
  kind: "fixing";
@@ -239,8 +257,8 @@ export type Fixing = {
239
257
  figures: Record<string, Figure>;
240
258
  };
241
259
  /**
242
- * figure: a rule of the printer's own (never borrowed); n: a basic clearance as a number, the printer's own or, where it
243
- * has none, the X1C's; cite: the name that number is cited by
260
+ * figure: a rule of the printer's own (never borrowed); n: a basic clearance as a number, the printer's own or, where
261
+ * it has none, the X1C's; cite: the name that number is cited by
244
262
  */
245
263
  export type Printer = {
246
264
  name: string;