@weasel-js/quantity 1.11.0 → 1.11.1

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.
Files changed (2) hide show
  1. package/README.md +19 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -97,6 +97,25 @@ non-literal part in a `<span data-part>`, which is the whole styling surface.
97
97
  `IMPERIAL_INCHES`, `ANGLE_RADIANS`, `PIXELS`). `qty(tag(12, unit(), 'mm')).to('cm', METRIC_MM)`
98
98
  is `1.2cm`. `parseNumber('5ft 3in', { in: 1, ft: 12 })` is 63.
99
99
 
100
+ A `UnitScope` nests one system in another: a sub-assembly measured in millimeters inside a
101
+ drawing measured in inches, with `scale` saying what one millimeter is worth in inches. A chain
102
+ of scopes runs outermost first, and `resolveScoped` and `formatScoped` convert across it:
103
+
104
+ ```ts
105
+ const INCHES = { system: IMPERIAL_INCHES };
106
+ const MM = { system: METRIC_MM, scale: 1 / 25.4 };
107
+ resolveScoped({ value: 10, unit: 'mm' }, [INCHES, MM]) // 0.3937…, in inches
108
+ formatScoped(1, 'mm', [INCHES, MM]) // '25.4mm'
109
+ ```
110
+
111
+ A scope converts what is shown, typed and snapped to, never what is stored: a value is held in
112
+ the outermost scope's units however deep it sits (ruled 2026-10-20). In weasel a container
113
+ declares one (`ContainerNode.units`), its children's poses stay in world units, and pose
114
+ composition does not scale by it. `sceneUnitScopes` and `sceneSharedUnitScopes` in
115
+ `@weasel-js/core` read a scene's chain; `scopedPrefUnit` and `prefLeafInScopes` in
116
+ `@weasel-js/prefs` make a field's unit from one; `gridSnapSource`'s `scopes` option in
117
+ `@weasel-js/guides` snaps on one.
118
+
100
119
  ## License
101
120
 
102
121
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/quantity",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Numbers with units and a display: fractions, ratios, currency, durations and more, as text, spoken text, HTML and MathML. No React, no DOM.",
5
5
  "license": "MIT",
6
6
  "type": "module",