@umriss-ui/calculation 0.2.0 → 0.2.2
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/CHANGELOG.md +20 -0
- package/dist/calculation.css +1 -1
- package/dist/calculation.js +114 -114
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,26 @@ under a heading "Changed" of its own, no matter which digit rose.
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## 0.2.2 – Core 0.7.0 (Sep. 2026)
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **The worst-verdict glyph and the lost freshness read core's
|
|
19
|
+
`--u-color-danger-text`** - lighter in the dark theme, 4.5:1 on every surface.
|
|
20
|
+
The peer range moves to `@umriss-ui/core` `^0.7.0`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 0.2.1 – Core 0.6.0 (Sep. 2026)
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **The calculation takes `@umriss-ui/core` 0.6.** Nothing in the calculation
|
|
29
|
+
changed; the peer range moves to `^0.6.0`, so that it installs beside
|
|
30
|
+
`@umriss-ui/table` 0.3, which needs core's new wording.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
14
34
|
## 0.2.0 – A chain stands open (Sep. 2026)
|
|
15
35
|
|
|
16
36
|
0.1.0 was committed in the repository but never published; this is the first
|
package/dist/calculation.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer umriss.tokens,umriss.base,umriss.components;@layer umriss.base{._text_1hv7a_23{font-family:var(--u-font-sans);font-size:var(--u-text-md);line-height:var(--u-leading-normal);color:var(--u-color-text);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}._field_1hv7a_34{caret-color:var(--u-color-accent)}._scroll_1hv7a_40{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--u-color-text) 25%,transparent) transparent}._scroll_1hv7a_40::-webkit-scrollbar{width:10px;height:10px}._scroll_1hv7a_40::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--u-color-text) 22%,transparent);border-radius:var(--u-radius-full);border:3px solid transparent;background-clip:content-box}._scroll_1hv7a_40::-webkit-scrollbar-track{background:transparent}}@layer umriss.components{._ring_1hv7a_65:focus-visible{outline:none;box-shadow:var(--u-focus-ring)}@media(pointer:coarse){._field_1hv7a_34._field_1hv7a_34{font-size:16px}}._field_1hv7a_34:-webkit-autofill,._field_1hv7a_34:-webkit-autofill:hover,._field_1hv7a_34:-webkit-autofill:focus{-webkit-box-shadow:inset 0 0 0 1000px var(--u-color-surface),0 0 0 1px var(--u-edge-color-strong);-webkit-text-fill-color:var(--u-color-text);caret-color:var(--u-color-accent)}}@layer umriss.tokens,umriss.base,umriss.components;@layer umriss.components{._frame_1hhx1_21,._frame_1hhx1_21:before,._frame_1hhx1_21:after{box-sizing:border-box}._calculation_1hhx1_39,._calculation_1hhx1_39:before,._calculation_1hhx1_39:after{box-sizing:border-box}._disclosure_1hhx1_53,._disclosure_1hhx1_53:before,._disclosure_1hhx1_53:after{box-sizing:border-box}._list_1hhx1_57,._list_1hhx1_57:before,._list_1hhx1_57:after{box-sizing:border-box}._item_1hhx1_58,._item_1hhx1_58:before,._item_1hhx1_58:after{box-sizing:border-box}._derivation_1hhx1_59,._derivation_1hhx1_59:before,._derivation_1hhx1_59:after{box-sizing:border-box}._line_1hhx1_109,._line_1hhx1_109:before,._line_1hhx1_109:after{box-sizing:border-box}._labelCell_1hhx1_151,._labelCell_1hhx1_151:before,._labelCell_1hhx1_151:after{box-sizing:border-box}._names_1hhx1_152,._names_1hhx1_152:before,._names_1hhx1_152:after{box-sizing:border-box}._operator_1hhx1_153,._operator_1hhx1_153:before,._operator_1hhx1_153:after{box-sizing:border-box}._amount_1hhx1_154,._amount_1hhx1_154:before,._amount_1hhx1_154:after{box-sizing:border-box}._unit_1hhx1_155,._unit_1hhx1_155:before,._unit_1hhx1_155:after{box-sizing:border-box}._assessment_1hhx1_156,._assessment_1hhx1_156:before,._assessment_1hhx1_156:after{box-sizing:border-box}._label_1hhx1_151,._label_1hhx1_151:before,._label_1hhx1_151:after{box-sizing:border-box}._approximate_1hhx1_269,._approximate_1hhx1_269:before,._approximate_1hhx1_269:after{box-sizing:border-box}._target_1hhx1_297,._target_1hhx1_297:before,._target_1hhx1_297:after{box-sizing:border-box}._worst_1hhx1_298,._worst_1hhx1_298:before,._worst_1hhx1_298:after{box-sizing:border-box}._notes_1hhx1_390,._notes_1hhx1_390:before,._notes_1hhx1_390:after{box-sizing:border-box}._freshness_1hhx1_404,._freshness_1hhx1_404:before,._freshness_1hhx1_404:after{box-sizing:border-box}._frame_1hhx1_21{font-size:var(--u-text-sm);border-radius:var(--u-radius-md);corner-shape:squircle;background:var(--u-color-surface);box-shadow:var(--u-edge);overflow:hidden;--disclosure-size: 20px;--disclosure-gap: var(--u-space-2);container-type:inline-size;width:100%}._calculation_1hhx1_39{display:grid;grid-template-columns:fit-content(22rem) minmax(0,1fr) auto auto auto auto;margin:0;padding:0;list-style:none}._frame_1hhx1_21[data-still]{--disclosure-size: 0px;--disclosure-gap: 0px}._frame_1hhx1_21[data-still] ._disclosure_1hhx1_53{display:none}._list_1hhx1_57,._item_1hhx1_58,._derivation_1hhx1_59{display:grid;grid-template-columns:subgrid;grid-column:1 / -1;margin:0;padding:0;list-style:none}._derivation_1hhx1_59[hidden]{display:none}._derivation_1hhx1_59:not([hidden]){animation:_derivationIn_1hhx1_1 var(--u-duration-fast) var(--u-ease-out)}@keyframes _derivationIn_1hhx1_1{0%{opacity:0}}._item_1hhx1_58{--fall: calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5) + var(--disclosure-size) / 2 - 1px)}._derivation_1hhx1_59{position:relative}._derivation_1hhx1_59:before{content:"";position:absolute;top:0;bottom:0;left:var(--fall);z-index:1;width:2px;background:var(--u-color-accent);pointer-events:none}:not(._derivation_1hhx1_59)>._item_1hhx1_58[data-open]>._line_1hhx1_109:not([data-mark]),:not(._derivation_1hhx1_59)>._item_1hhx1_58>._derivation_1hhx1_59{background-color:var(--u-color-surface-sunken)}._derivation_1hhx1_59 ._line_1hhx1_109{border-top-color:transparent}._line_1hhx1_109{position:relative;display:grid;grid-template-columns:subgrid;grid-column:1 / -1;align-items:baseline;border-top:1px solid var(--u-hairline)}._calculation_1hhx1_39>._item_1hhx1_58:first-child>._line_1hhx1_109:first-child,._calculation_1hhx1_39>._item_1hhx1_58:first-child>._list_1hhx1_57>._item_1hhx1_58:first-child>._line_1hhx1_109{border-top-color:transparent}._line_1hhx1_109[data-foldable]{cursor:pointer}._line_1hhx1_109[data-mark]{background:color-mix(in srgb,var(--u-color-accent-subtle) 50%,transparent)}._line_1hhx1_109[data-mark=use]{background:var(--u-color-accent-subtle)}._labelCell_1hhx1_151,._names_1hhx1_152,._operator_1hhx1_153,._amount_1hhx1_154,._unit_1hhx1_155,._assessment_1hhx1_156{grid-row:1;padding-top:var(--u-space-2);padding-bottom:var(--u-space-2)}._labelCell_1hhx1_151{grid-column:1;display:flex;align-items:baseline;gap:var(--disclosure-gap);min-width:0;padding-left:calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5));padding-right:var(--u-space-5)}._label_1hhx1_151{min-width:0;color:var(--u-color-text)}._line_1hhx1_109[data-reference] ._label_1hhx1_151{font-style:italic;color:var(--u-color-text-secondary)}._disclosure_1hhx1_53{flex:none;align-self:center;display:inline-flex;align-items:center;justify-content:center;width:var(--disclosure-size);height:var(--disclosure-size);padding:0;border:none;border-radius:var(--u-radius-xs);corner-shape:squircle;background:none;color:var(--u-color-text-muted)}button._disclosure_1hhx1_53{box-sizing:border-box}button._disclosure_1hhx1_53{cursor:pointer}button._disclosure_1hhx1_53:hover,._line_1hhx1_109[data-foldable]:hover button._disclosure_1hhx1_53{box-sizing:border-box}button._disclosure_1hhx1_53:hover,._line_1hhx1_109[data-foldable]:hover button._disclosure_1hhx1_53{background:var(--u-color-surface-sunken);color:var(--u-color-text)}._item_1hhx1_58[data-open]>._line_1hhx1_109 button._disclosure_1hhx1_53{box-sizing:border-box}._item_1hhx1_58[data-open]>._line_1hhx1_109 button._disclosure_1hhx1_53{color:var(--u-color-accent)}button._disclosure_1hhx1_53:focus-visible{box-sizing:border-box}button._disclosure_1hhx1_53:focus-visible{outline:none;box-shadow:var(--u-focus-ring)}._disclosure_1hhx1_53 svg{box-sizing:border-box}._disclosure_1hhx1_53 svg{transition:transform var(--u-duration-fast) var(--u-ease-out)}._disclosure_1hhx1_53 svg[data-open]{box-sizing:border-box}._disclosure_1hhx1_53 svg[data-open]{transform:rotate(90deg)}._names_1hhx1_152{grid-column:2;min-width:0;overflow:hidden;padding-right:var(--u-space-4);white-space:nowrap;text-overflow:ellipsis;color:var(--u-color-text-secondary)}._operator_1hhx1_153,._amount_1hhx1_154,._unit_1hhx1_155{font-family:var(--u-font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1;white-space:nowrap}._operator_1hhx1_153{grid-column:3;padding-right:var(--u-space-3);text-align:right;color:var(--u-color-text-secondary)}._amount_1hhx1_154{grid-column:4;text-align:right;color:var(--u-color-text)}._amount_1hhx1_154[data-verdict=unknown]{color:var(--u-color-text-secondary)}._approximate_1hhx1_269{display:inline-block;margin-right:var(--u-space-1);color:var(--u-color-text-secondary);cursor:help}._unit_1hhx1_155{grid-column:5;padding-left:var(--u-space-1);padding-right:var(--u-space-3);color:var(--u-color-text-secondary)}._assessment_1hhx1_156{grid-column:6;display:flex;align-items:baseline;justify-content:flex-end;gap:var(--u-space-2);padding-right:var(--u-space-3);white-space:nowrap}._assessment_1hhx1_156:empty{padding-right:0}._target_1hhx1_297,._worst_1hhx1_298{font-size:var(--u-text-xs);color:var(--u-color-text-secondary)}._worst_1hhx1_298:before{content:"● "}._worst_1hhx1_298[data-verdict=unknown]:before{color:var(--u-color-text-muted)}._worst_1hhx1_298[data-verdict=warning]:before{color:var(--u-color-warning)}._worst_1hhx1_298[data-verdict=alarm]:before{color:var(--u-color-danger)}._line_1hhx1_109[data-inner]>._amount_1hhx1_154{color:var(--u-color-text-secondary)}._line_1hhx1_109[data-kind=interim] ._label_1hhx1_151,._line_1hhx1_109[data-kind=interim]>._amount_1hhx1_154{font-weight:var(--u-weight-medium)}._line_1hhx1_109[data-kind=interim]:before{content:"";grid-row:1;grid-column:3 / 6;align-self:start;border-top:1px solid var(--u-color-text-secondary);pointer-events:none}._line_1hhx1_109[data-closing] ._label_1hhx1_151{font-weight:var(--u-weight-medium);color:var(--u-color-text-secondary)}._line_1hhx1_109[data-closing]:before{content:"";grid-row:1;grid-column:3 / 6;align-self:start;border-top:1px solid var(--u-color-text-muted);pointer-events:none}._line_1hhx1_109[data-kind=result]{border-top:1px solid var(--u-edge-color-strong)}._line_1hhx1_109[data-kind=result]:not([data-mark]){background:var(--u-color-surface-sunken)}._line_1hhx1_109[data-kind=result] ._label_1hhx1_151{font-weight:var(--u-weight-semibold)}._line_1hhx1_109[data-kind=result]>._amount_1hhx1_154{font-size:var(--u-text-md);font-weight:var(--u-weight-semibold)}._line_1hhx1_109[data-kind=result]>._amount_1hhx1_154:not([data-verdict=unknown]){text-decoration-line:underline;text-decoration-style:double;text-underline-offset:5px}._notes_1hhx1_390{grid-row:2;grid-column:1 / 3;display:flex;flex-wrap:wrap;align-items:center;column-gap:var(--u-space-3);margin-top:calc(-1 * var(--u-space-1));padding:0 var(--u-space-4) var(--u-space-2) calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5) + var(--disclosure-size) + var(--disclosure-gap));font-size:var(--u-text-xs);color:var(--u-color-text-secondary)}._freshness_1hhx1_404[data-freshness=stale]{color:var(--u-color-warning)}._freshness_1hhx1_404[data-freshness=lost]{color:var(--u-color-danger);font-weight:var(--u-weight-medium)}@container (max-width: 34rem){._calculation_1hhx1_39{grid-template-columns:minmax(0,1fr) 0 auto auto auto 0}._names_1hhx1_152{display:none}._labelCell_1hhx1_151{padding-right:var(--u-space-3)}._assessment_1hhx1_156:not(:empty){grid-area:2 / 1 / 3 / -1;justify-content:flex-start;flex-wrap:wrap;padding:0 var(--u-space-3) var(--u-space-2) calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5) + var(--disclosure-size) + var(--disclosure-gap));white-space:normal}._notes_1hhx1_390{grid-row:3;grid-column:1 / -1}}@media(prefers-reduced-motion:reduce){._disclosure_1hhx1_53 svg{transition:none}._derivation_1hhx1_59:not([hidden]){animation:none}}}
|
|
1
|
+
@layer umriss.tokens,umriss.base,umriss.components;@layer umriss.base{._text_1hv7a_23{font-family:var(--u-font-sans);font-size:var(--u-text-md);line-height:var(--u-leading-normal);color:var(--u-color-text);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}._field_1hv7a_34{caret-color:var(--u-color-accent)}._scroll_1hv7a_40{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--u-color-text) 25%,transparent) transparent}._scroll_1hv7a_40::-webkit-scrollbar{width:10px;height:10px}._scroll_1hv7a_40::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--u-color-text) 22%,transparent);border-radius:var(--u-radius-full);border:3px solid transparent;background-clip:content-box}._scroll_1hv7a_40::-webkit-scrollbar-track{background:transparent}}@layer umriss.components{._ring_1hv7a_65:focus-visible{outline:none;box-shadow:var(--u-focus-ring)}@media(pointer:coarse){._field_1hv7a_34._field_1hv7a_34{font-size:16px}}._field_1hv7a_34:-webkit-autofill,._field_1hv7a_34:-webkit-autofill:hover,._field_1hv7a_34:-webkit-autofill:focus{-webkit-box-shadow:inset 0 0 0 1000px var(--u-color-surface),0 0 0 1px var(--u-edge-color-strong);-webkit-text-fill-color:var(--u-color-text);caret-color:var(--u-color-accent)}}@layer umriss.tokens,umriss.base,umriss.components;@layer umriss.components{._frame_1vssq_21,._frame_1vssq_21:before,._frame_1vssq_21:after{box-sizing:border-box}._calculation_1vssq_39,._calculation_1vssq_39:before,._calculation_1vssq_39:after{box-sizing:border-box}._disclosure_1vssq_53,._disclosure_1vssq_53:before,._disclosure_1vssq_53:after{box-sizing:border-box}._list_1vssq_57,._list_1vssq_57:before,._list_1vssq_57:after{box-sizing:border-box}._item_1vssq_58,._item_1vssq_58:before,._item_1vssq_58:after{box-sizing:border-box}._derivation_1vssq_59,._derivation_1vssq_59:before,._derivation_1vssq_59:after{box-sizing:border-box}._line_1vssq_109,._line_1vssq_109:before,._line_1vssq_109:after{box-sizing:border-box}._labelCell_1vssq_151,._labelCell_1vssq_151:before,._labelCell_1vssq_151:after{box-sizing:border-box}._names_1vssq_152,._names_1vssq_152:before,._names_1vssq_152:after{box-sizing:border-box}._operator_1vssq_153,._operator_1vssq_153:before,._operator_1vssq_153:after{box-sizing:border-box}._amount_1vssq_154,._amount_1vssq_154:before,._amount_1vssq_154:after{box-sizing:border-box}._unit_1vssq_155,._unit_1vssq_155:before,._unit_1vssq_155:after{box-sizing:border-box}._assessment_1vssq_156,._assessment_1vssq_156:before,._assessment_1vssq_156:after{box-sizing:border-box}._label_1vssq_151,._label_1vssq_151:before,._label_1vssq_151:after{box-sizing:border-box}._approximate_1vssq_269,._approximate_1vssq_269:before,._approximate_1vssq_269:after{box-sizing:border-box}._target_1vssq_297,._target_1vssq_297:before,._target_1vssq_297:after{box-sizing:border-box}._worst_1vssq_298,._worst_1vssq_298:before,._worst_1vssq_298:after{box-sizing:border-box}._notes_1vssq_390,._notes_1vssq_390:before,._notes_1vssq_390:after{box-sizing:border-box}._freshness_1vssq_404,._freshness_1vssq_404:before,._freshness_1vssq_404:after{box-sizing:border-box}._frame_1vssq_21{font-size:var(--u-text-sm);border-radius:var(--u-radius-md);corner-shape:squircle;background:var(--u-color-surface);box-shadow:var(--u-edge);overflow:hidden;--disclosure-size: 20px;--disclosure-gap: var(--u-space-2);container-type:inline-size;width:100%}._calculation_1vssq_39{display:grid;grid-template-columns:fit-content(22rem) minmax(0,1fr) auto auto auto auto;margin:0;padding:0;list-style:none}._frame_1vssq_21[data-still]{--disclosure-size: 0px;--disclosure-gap: 0px}._frame_1vssq_21[data-still] ._disclosure_1vssq_53{display:none}._list_1vssq_57,._item_1vssq_58,._derivation_1vssq_59{display:grid;grid-template-columns:subgrid;grid-column:1 / -1;margin:0;padding:0;list-style:none}._derivation_1vssq_59[hidden]{display:none}._derivation_1vssq_59:not([hidden]){animation:_derivationIn_1vssq_1 var(--u-duration-fast) var(--u-ease-out)}@keyframes _derivationIn_1vssq_1{0%{opacity:0}}._item_1vssq_58{--fall: calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5) + var(--disclosure-size) / 2 - 1px)}._derivation_1vssq_59{position:relative}._derivation_1vssq_59:before{content:"";position:absolute;top:0;bottom:0;left:var(--fall);z-index:1;width:2px;background:var(--u-color-accent);pointer-events:none}:not(._derivation_1vssq_59)>._item_1vssq_58[data-open]>._line_1vssq_109:not([data-mark]),:not(._derivation_1vssq_59)>._item_1vssq_58>._derivation_1vssq_59{background-color:var(--u-color-surface-sunken)}._derivation_1vssq_59 ._line_1vssq_109{border-top-color:transparent}._line_1vssq_109{position:relative;display:grid;grid-template-columns:subgrid;grid-column:1 / -1;align-items:baseline;border-top:1px solid var(--u-hairline)}._calculation_1vssq_39>._item_1vssq_58:first-child>._line_1vssq_109:first-child,._calculation_1vssq_39>._item_1vssq_58:first-child>._list_1vssq_57>._item_1vssq_58:first-child>._line_1vssq_109{border-top-color:transparent}._line_1vssq_109[data-foldable]{cursor:pointer}._line_1vssq_109[data-mark]{background:color-mix(in srgb,var(--u-color-accent-subtle) 50%,transparent)}._line_1vssq_109[data-mark=use]{background:var(--u-color-accent-subtle)}._labelCell_1vssq_151,._names_1vssq_152,._operator_1vssq_153,._amount_1vssq_154,._unit_1vssq_155,._assessment_1vssq_156{grid-row:1;padding-top:var(--u-space-2);padding-bottom:var(--u-space-2)}._labelCell_1vssq_151{grid-column:1;display:flex;align-items:baseline;gap:var(--disclosure-gap);min-width:0;padding-left:calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5));padding-right:var(--u-space-5)}._label_1vssq_151{min-width:0;color:var(--u-color-text)}._line_1vssq_109[data-reference] ._label_1vssq_151{font-style:italic;color:var(--u-color-text-secondary)}._disclosure_1vssq_53{flex:none;align-self:center;display:inline-flex;align-items:center;justify-content:center;width:var(--disclosure-size);height:var(--disclosure-size);padding:0;border:none;border-radius:var(--u-radius-xs);corner-shape:squircle;background:none;color:var(--u-color-text-muted)}button._disclosure_1vssq_53{box-sizing:border-box}button._disclosure_1vssq_53{cursor:pointer}button._disclosure_1vssq_53:hover,._line_1vssq_109[data-foldable]:hover button._disclosure_1vssq_53{box-sizing:border-box}button._disclosure_1vssq_53:hover,._line_1vssq_109[data-foldable]:hover button._disclosure_1vssq_53{background:var(--u-color-surface-sunken);color:var(--u-color-text)}._item_1vssq_58[data-open]>._line_1vssq_109 button._disclosure_1vssq_53{box-sizing:border-box}._item_1vssq_58[data-open]>._line_1vssq_109 button._disclosure_1vssq_53{color:var(--u-color-accent)}button._disclosure_1vssq_53:focus-visible{box-sizing:border-box}button._disclosure_1vssq_53:focus-visible{outline:none;box-shadow:var(--u-focus-ring)}._disclosure_1vssq_53 svg{box-sizing:border-box}._disclosure_1vssq_53 svg{transition:transform var(--u-duration-fast) var(--u-ease-out)}._disclosure_1vssq_53 svg[data-open]{box-sizing:border-box}._disclosure_1vssq_53 svg[data-open]{transform:rotate(90deg)}._names_1vssq_152{grid-column:2;min-width:0;overflow:hidden;padding-right:var(--u-space-4);white-space:nowrap;text-overflow:ellipsis;color:var(--u-color-text-secondary)}._operator_1vssq_153,._amount_1vssq_154,._unit_1vssq_155{font-family:var(--u-font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1;white-space:nowrap}._operator_1vssq_153{grid-column:3;padding-right:var(--u-space-3);text-align:right;color:var(--u-color-text-secondary)}._amount_1vssq_154{grid-column:4;text-align:right;color:var(--u-color-text)}._amount_1vssq_154[data-verdict=unknown]{color:var(--u-color-text-secondary)}._approximate_1vssq_269{display:inline-block;margin-right:var(--u-space-1);color:var(--u-color-text-secondary);cursor:help}._unit_1vssq_155{grid-column:5;padding-left:var(--u-space-1);padding-right:var(--u-space-3);color:var(--u-color-text-secondary)}._assessment_1vssq_156{grid-column:6;display:flex;align-items:baseline;justify-content:flex-end;gap:var(--u-space-2);padding-right:var(--u-space-3);white-space:nowrap}._assessment_1vssq_156:empty{padding-right:0}._target_1vssq_297,._worst_1vssq_298{font-size:var(--u-text-xs);color:var(--u-color-text-secondary)}._worst_1vssq_298:before{content:"● "}._worst_1vssq_298[data-verdict=unknown]:before{color:var(--u-color-text-muted)}._worst_1vssq_298[data-verdict=warning]:before{color:var(--u-color-warning)}._worst_1vssq_298[data-verdict=alarm]:before{color:var(--u-color-danger-text)}._line_1vssq_109[data-inner]>._amount_1vssq_154{color:var(--u-color-text-secondary)}._line_1vssq_109[data-kind=interim] ._label_1vssq_151,._line_1vssq_109[data-kind=interim]>._amount_1vssq_154{font-weight:var(--u-weight-medium)}._line_1vssq_109[data-kind=interim]:before{content:"";grid-row:1;grid-column:3 / 6;align-self:start;border-top:1px solid var(--u-color-text-secondary);pointer-events:none}._line_1vssq_109[data-closing] ._label_1vssq_151{font-weight:var(--u-weight-medium);color:var(--u-color-text-secondary)}._line_1vssq_109[data-closing]:before{content:"";grid-row:1;grid-column:3 / 6;align-self:start;border-top:1px solid var(--u-color-text-muted);pointer-events:none}._line_1vssq_109[data-kind=result]{border-top:1px solid var(--u-edge-color-strong)}._line_1vssq_109[data-kind=result]:not([data-mark]){background:var(--u-color-surface-sunken)}._line_1vssq_109[data-kind=result] ._label_1vssq_151{font-weight:var(--u-weight-semibold)}._line_1vssq_109[data-kind=result]>._amount_1vssq_154{font-size:var(--u-text-md);font-weight:var(--u-weight-semibold)}._line_1vssq_109[data-kind=result]>._amount_1vssq_154:not([data-verdict=unknown]){text-decoration-line:underline;text-decoration-style:double;text-underline-offset:5px}._notes_1vssq_390{grid-row:2;grid-column:1 / 3;display:flex;flex-wrap:wrap;align-items:center;column-gap:var(--u-space-3);margin-top:calc(-1 * var(--u-space-1));padding:0 var(--u-space-4) var(--u-space-2) calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5) + var(--disclosure-size) + var(--disclosure-gap));font-size:var(--u-text-xs);color:var(--u-color-text-secondary)}._freshness_1vssq_404[data-freshness=stale]{color:var(--u-color-warning)}._freshness_1vssq_404[data-freshness=lost]{color:var(--u-color-danger-text);font-weight:var(--u-weight-medium)}@container (max-width: 34rem){._calculation_1vssq_39{grid-template-columns:minmax(0,1fr) 0 auto auto auto 0}._names_1vssq_152{display:none}._labelCell_1vssq_151{padding-right:var(--u-space-3)}._assessment_1vssq_156:not(:empty){grid-area:2 / 1 / 3 / -1;justify-content:flex-start;flex-wrap:wrap;padding:0 var(--u-space-3) var(--u-space-2) calc(var(--u-space-3) + var(--depth, 0) * var(--u-space-5) + var(--disclosure-size) + var(--disclosure-gap));white-space:normal}._notes_1vssq_390{grid-row:3;grid-column:1 / -1}}@media(prefers-reduced-motion:reduce){._disclosure_1vssq_53 svg{transition:none}._derivation_1vssq_59:not([hidden]){animation:none}}}
|
package/dist/calculation.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "./calculation.css";
|
|
2
2
|
import { jsx as f, jsxs as k } from "react/jsx-runtime";
|
|
3
3
|
import { Children as ve, isValidElement as j, Fragment as ge, useId as _e, useState as oe } from "react";
|
|
4
|
-
import { assess as be, verdictWeight as K, useFormats as me, useWording as fe, VisuallyHidden as $e, AngleGlyph as
|
|
5
|
-
function
|
|
4
|
+
import { assess as be, verdictWeight as K, useFormats as me, useWording as fe, VisuallyHidden as $e, AngleGlyph as Ne, Tooltip as re, Badge as ie, useFreshness as we } from "@umriss-ui/core";
|
|
5
|
+
function ye(t) {
|
|
6
6
|
return t.decimals !== void 0 ? t.decimals : t.format === "percent" ? 1 : t.given ? void 0 : 2;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function qe(t, n) {
|
|
9
9
|
return n === void 0 ? t : Math.sign(t) * Number(Math.abs(t).toFixed(n));
|
|
10
10
|
}
|
|
11
11
|
function G(t, n) {
|
|
12
|
-
return
|
|
12
|
+
return qe(t.format === "percent" ? n * 100 : n, ye(t));
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const xe = (t, n) => t.format === "percent" ? n / 100 : n;
|
|
15
15
|
function le(t, n, v) {
|
|
16
16
|
const [m, ...i] = n;
|
|
17
17
|
switch (t) {
|
|
@@ -26,40 +26,40 @@ function le(t, n, v) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
const ce = (t, n) => n === void 0 || t !== void 0 && K(t) >= K(n) ? t : n;
|
|
29
|
-
function
|
|
29
|
+
function Oe(t) {
|
|
30
30
|
const n = /* @__PURE__ */ new Map(), v = (m) => {
|
|
31
|
-
var $,
|
|
31
|
+
var $, q, T;
|
|
32
32
|
const i = n.get(m);
|
|
33
33
|
if (i) return i;
|
|
34
34
|
const e = t.quantities.get(m);
|
|
35
|
-
let h = null, o,
|
|
35
|
+
let h = null, o, y = !1, C;
|
|
36
36
|
if (e.given) {
|
|
37
|
-
const
|
|
38
|
-
typeof
|
|
37
|
+
const N = e.given.value;
|
|
38
|
+
typeof N == "number" && Number.isFinite(N) ? h = N : o = { kind: "missing", label: e.label };
|
|
39
39
|
} else {
|
|
40
|
-
const
|
|
41
|
-
for (const { operand:
|
|
42
|
-
const _ =
|
|
40
|
+
const N = e.operands.map((s) => ({ operand: s, ...v(s.key) }));
|
|
41
|
+
for (const { operand: s, verdict: c, worst: r } of N) {
|
|
42
|
+
const _ = s.reference ? c : ce(c, r);
|
|
43
43
|
C = ce(C, _);
|
|
44
44
|
}
|
|
45
|
-
o = ($ =
|
|
46
|
-
const
|
|
47
|
-
if (!o && e.operator === "quotient" &&
|
|
48
|
-
const
|
|
49
|
-
h = le(e.operator,
|
|
45
|
+
o = ($ = N.find((s) => s.absence)) == null ? void 0 : $.absence;
|
|
46
|
+
const x = N[1];
|
|
47
|
+
if (!o && e.operator === "quotient" && x.value === 0 && (o = { kind: "zero", label: t.quantities.get(x.operand.key).label }), !o) {
|
|
48
|
+
const s = e.operands.map((r) => r.negated === !0);
|
|
49
|
+
h = le(e.operator, N.map((r) => r.value), s);
|
|
50
50
|
const c = le(
|
|
51
51
|
e.operator,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
N.map((r) => xe(t.quantities.get(r.operand.key), r.shown)),
|
|
53
|
+
s
|
|
54
54
|
);
|
|
55
|
-
|
|
55
|
+
y = G(e, c) !== G(e, h);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const d = { target: e.target, limits: e.limits }, g = e.target !== void 0 || (((
|
|
58
|
+
const d = { target: e.target, limits: e.limits }, g = e.target !== void 0 || (((q = e.limits) == null ? void 0 : q.length) ?? 0) > 0 ? be(h, d) : void 0, b = (((T = e.limits) == null ? void 0 : T.length) ?? 0) > 0 ? g.verdict : h === null ? "unknown" : void 0, l = {
|
|
59
59
|
value: h,
|
|
60
60
|
absence: o,
|
|
61
61
|
shown: h === null ? null : G(e, h),
|
|
62
|
-
approximate:
|
|
62
|
+
approximate: y,
|
|
63
63
|
assessment: g,
|
|
64
64
|
verdict: b,
|
|
65
65
|
worst: C
|
|
@@ -69,7 +69,7 @@ function Se(t) {
|
|
|
69
69
|
for (const m of t.quantities.keys()) v(m);
|
|
70
70
|
return n;
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const Se = () => null, Te = () => null, ke = () => null, Ce = () => null, Ae = () => null, ue = () => null, Ie = () => null, Me = () => null, Pe = () => null, De = () => null, Ee = () => null, Y = () => null, Be = /* @__PURE__ */ new Map([
|
|
73
73
|
[Te, "sum"],
|
|
74
74
|
[ke, "difference"],
|
|
75
75
|
[Ce, "product"],
|
|
@@ -85,7 +85,7 @@ const qe = () => null, Te = () => null, ke = () => null, Ce = () => null, Ae = (
|
|
|
85
85
|
[De, { name: "Times", operator: "product" }],
|
|
86
86
|
[Ee, { name: "DividedBy", operator: "quotient" }]
|
|
87
87
|
]), X = "<Given>, <Sum>, <Difference>, <Product>, <Quotient> or <Chain>";
|
|
88
|
-
function
|
|
88
|
+
function S(t) {
|
|
89
89
|
throw new Error(`@umriss-ui/calculation: ${t}`);
|
|
90
90
|
}
|
|
91
91
|
function Q(t) {
|
|
@@ -101,12 +101,12 @@ function V(t) {
|
|
|
101
101
|
const ee = (t, n, v) => `${t}/${j(n) && n.key || v}`;
|
|
102
102
|
function je(t) {
|
|
103
103
|
const n = Q(t);
|
|
104
|
-
n.length !== 1 &&
|
|
104
|
+
n.length !== 1 && S(`<Calculation> takes exactly one child, the result; it was given ${n.length}.`);
|
|
105
105
|
const v = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), i = [], e = (d, g, b) => {
|
|
106
106
|
const { id: l, ...$ } = g;
|
|
107
|
-
l !== void 0 && (m.has(l) &&
|
|
108
|
-
const
|
|
109
|
-
return v.set(d,
|
|
107
|
+
l !== void 0 && (m.has(l) && S(`${b}: the id "${l}" is used twice.`), m.set(l, d));
|
|
108
|
+
const q = { ...$, key: d, id: l, operands: [] };
|
|
109
|
+
return v.set(d, q), q;
|
|
110
110
|
}, h = (d, g, b) => {
|
|
111
111
|
if (j(d) && d.type === ue) {
|
|
112
112
|
const l = { key: "", reference: !0 };
|
|
@@ -114,55 +114,55 @@ function je(t) {
|
|
|
114
114
|
}
|
|
115
115
|
return { key: o(d, g, b), reference: !1 };
|
|
116
116
|
}, o = (d, g, b) => {
|
|
117
|
-
if ((!j(d) || d.type === ue || Z.has(d.type) || d.type === Y) &&
|
|
117
|
+
if ((!j(d) || d.type === ue || Z.has(d.type) || d.type === Y) && S(`${b}: ${V(d)} cannot stand here; a quantity must be ${X}.`), d.type === Ie) return y(d.props.children, g, b);
|
|
118
118
|
const l = Be.get(d.type);
|
|
119
|
-
d.type !==
|
|
119
|
+
d.type !== Se && l === void 0 && S(
|
|
120
120
|
`${b}: ${V(d)} is not an element of the calculation. A calculation reads its children's props and cannot look inside a component of your own; write ${X} or <Ref> directly, or return them from .map.`
|
|
121
121
|
);
|
|
122
|
-
const { children: $, value:
|
|
122
|
+
const { children: $, value: q, source: T, asOf: N, ages: x, ...s } = d.props, c = `${b} › ${s.label}`, r = e(g, s, c);
|
|
123
123
|
if (l === void 0)
|
|
124
|
-
return r.given = { value:
|
|
124
|
+
return r.given = { value: q, source: T, asOf: N, ages: x }, g;
|
|
125
125
|
r.operator = l;
|
|
126
|
-
const _ = Q($),
|
|
127
|
-
return (l === "quotient" ?
|
|
128
|
-
`${c}: <${We[l]}> takes ${l === "quotient" ? "exactly two operands" : "two or more operands"}; it was given ${
|
|
129
|
-
), r.operands = _.map((u,
|
|
130
|
-
},
|
|
131
|
-
const l = `${b} › <Chain>`, [$, ...
|
|
132
|
-
($ === void 0 || j($) && (Z.has($.type) || $.type === Y)) &&
|
|
133
|
-
let T = h($, ee(g, $, 0), l),
|
|
134
|
-
return
|
|
126
|
+
const _ = Q($), a = _.length;
|
|
127
|
+
return (l === "quotient" ? a !== 2 : a < 2) && S(
|
|
128
|
+
`${c}: <${We[l]}> takes ${l === "quotient" ? "exactly two operands" : "two or more operands"}; it was given ${a}.`
|
|
129
|
+
), r.operands = _.map((u, w) => h(u, ee(g, u, w), c)), g;
|
|
130
|
+
}, y = (d, g, b) => {
|
|
131
|
+
const l = `${b} › <Chain>`, [$, ...q] = Q(d);
|
|
132
|
+
($ === void 0 || j($) && (Z.has($.type) || $.type === Y)) && S(`${l}: a chain starts with a quantity that has no operator - ${X} or <Ref>.`);
|
|
133
|
+
let T = h($, ee(g, $, 0), l), N = V($), x = [], s;
|
|
134
|
+
return q.forEach((c, r) => {
|
|
135
135
|
const _ = ee(g, c, r + 1);
|
|
136
136
|
if (j(c) && c.type === Y) {
|
|
137
137
|
const M = c.props, D = `${l} › ${M.label}`;
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
138
|
+
x.length === 0 && S(`${D}: an <Interim> needs an operand since the named value before it, ${N}.`);
|
|
139
|
+
const O = e(_, M, D);
|
|
140
|
+
O.interim = !0, O.operator = x[0].line.operator, O.operands = [T, ...x.map((J) => J.operand)], T = { key: _, reference: !1, previous: !0 }, N = `<Interim label="${M.label}">`, x = [], s = _;
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
const u =
|
|
146
|
-
(u &&
|
|
147
|
-
`${l}: <${(
|
|
143
|
+
const a = j(c) ? Z.get(c.type) : void 0;
|
|
144
|
+
a === void 0 && S(`${l}: ${V(c)} needs an operator in a chain - <Plus>, <Minus>, <Times> or <DividedBy> - or is an <Interim>.`);
|
|
145
|
+
const u = a.operator !== "sum", w = x.find((M) => M.line.operator !== "sum");
|
|
146
|
+
(u && x.length > 0 || w) && S(
|
|
147
|
+
`${l}: <${(w ?? { line: a }).line.name}> stands alone between two named values - directly after the first quantity or an <Interim>, and directly before an <Interim>.`
|
|
148
148
|
);
|
|
149
|
-
const { children: B, ...A } = c.props, W = Q(B), I = () =>
|
|
149
|
+
const { children: B, ...A } = c.props, W = Q(B), I = () => S(`${l}: <${a.name}> takes either a label and a value, or exactly one quantity as its child.`);
|
|
150
150
|
if (W.length > 0) {
|
|
151
151
|
(W.length > 1 || Object.values(A).some((D) => D !== void 0)) && I();
|
|
152
152
|
const M = h(W[0], _, l);
|
|
153
|
-
M.negated =
|
|
153
|
+
M.negated = a.negated, x.push({ operand: M, line: a });
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
A.label === void 0 && I();
|
|
157
157
|
const { value: E, source: U, asOf: F, ages: R, ...L } = A, z = e(_, { ...L, label: A.label }, `${l} › ${A.label}`);
|
|
158
|
-
z.given = { value: E, source: U, asOf: F, ages: R },
|
|
159
|
-
}), (
|
|
158
|
+
z.given = { value: E, source: U, asOf: F, ages: R }, x.push({ operand: { key: _, reference: !1, negated: a.negated }, line: a });
|
|
159
|
+
}), (x.length > 0 || s === void 0) && S(`${l}: a chain ends with an <Interim>, which names its value.`), s;
|
|
160
160
|
}, C = o(n[0], "0", "<Calculation>");
|
|
161
161
|
for (const { operand: d, to: g, where: b } of i) {
|
|
162
162
|
const l = m.get(g);
|
|
163
163
|
if (l === void 0) {
|
|
164
|
-
const $ = [...m.keys()].map((
|
|
165
|
-
|
|
164
|
+
const $ = [...m.keys()].map((q) => `"${q}"`).join(", ");
|
|
165
|
+
S(`${b}: <Ref to="${g}"> names no quantity. ${$ ? `The ids that exist: ${$}.` : "No quantity has an id."}`);
|
|
166
166
|
}
|
|
167
167
|
d.key = l;
|
|
168
168
|
}
|
|
@@ -174,7 +174,7 @@ function Re(t) {
|
|
|
174
174
|
const e = v.indexOf(i);
|
|
175
175
|
if (e !== -1) {
|
|
176
176
|
const h = [...v.slice(e), i].map((o) => t.get(o).label);
|
|
177
|
-
|
|
177
|
+
S(`the calculation goes round in a circle through references: ${h.join(" → ")}.`);
|
|
178
178
|
}
|
|
179
179
|
v.push(i);
|
|
180
180
|
for (const h of t.get(i).operands) m(h.key);
|
|
@@ -217,33 +217,33 @@ function pe(t, n, v, m) {
|
|
|
217
217
|
return i ? `${e} ${i}` : e;
|
|
218
218
|
}
|
|
219
219
|
function Le(t, n, v, m, i, e, h) {
|
|
220
|
-
const o = t.quantities.get(v),
|
|
220
|
+
const o = t.quantities.get(v), y = n.get(v), C = (_, a, u) => a.shown === null ? u ? e.verdictUnknown : e.statAbsentValue : pe(_, a.shown, i, u ? e.calculationPercent : "%"), d = (_) => {
|
|
221
221
|
if (m || !o.operator) return {};
|
|
222
222
|
if (!_ && o.operands.length > de)
|
|
223
223
|
return { names: e.calculationOperandCount(o.operands.length) };
|
|
224
|
-
const
|
|
225
|
-
const A = t.quantities.get(
|
|
226
|
-
return B === 0 ? u(A) : `${te({ operator: o.operator, negated:
|
|
224
|
+
const a = (u) => o.operands.map((w, B) => {
|
|
225
|
+
const A = t.quantities.get(w.key);
|
|
226
|
+
return B === 0 ? u(A) : `${te({ operator: o.operator, negated: w.negated === !0 }, _, e)} ${u(A)}`;
|
|
227
227
|
}).join(" ");
|
|
228
228
|
return {
|
|
229
|
-
names:
|
|
230
|
-
numbers:
|
|
229
|
+
names: a((u) => u.label),
|
|
230
|
+
numbers: a((u) => C(u, n.get(u.key), _))
|
|
231
231
|
};
|
|
232
232
|
}, g = (_) => {
|
|
233
|
-
var
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
233
|
+
var w;
|
|
234
|
+
const a = (w = y.assessment) == null ? void 0 : w.deviation;
|
|
235
|
+
if (a === void 0 || o.target === void 0) return;
|
|
236
236
|
const u = pe(o, G(o, o.target), i, _ ? e.calculationPercent : "%");
|
|
237
|
-
return
|
|
238
|
-
}, b = d(!1).names, l = b === void 0 || o.operands.length > de ? b : `= ${b}`, $ = d(!0),
|
|
239
|
-
(h ? `${te(h, !0, e)} ` : "") + o.label + T + [$.names, $.numbers,
|
|
240
|
-
|
|
237
|
+
return a > 0 ? e.calculationAboveTarget(u) : a < 0 ? e.calculationBelowTarget(u) : e.calculationOnTarget(u);
|
|
238
|
+
}, b = d(!1).names, l = b === void 0 || o.operands.length > de ? b : `= ${b}`, $ = d(!0), q = y.absence ? Ue(y.absence, e) : void 0, T = ` ${e.calculationEquals} `, N = y.approximate ? `${e.calculationApproximately} ${C(o, y, !0)}` : C(o, y, !0), s = [
|
|
239
|
+
(h ? `${te(h, !0, e)} ` : "") + o.label + T + [$.names, $.numbers, N].filter(Boolean).join(`,${T}`),
|
|
240
|
+
y.verdict !== void 0 && y.verdict !== "unknown" ? H(y.verdict, e) : void 0,
|
|
241
241
|
g(!0),
|
|
242
|
-
|
|
243
|
-
].filter(Boolean).join(", "), c =
|
|
244
|
-
return { amount:
|
|
242
|
+
q
|
|
243
|
+
].filter(Boolean).join(", "), c = y.shown === null ? void 0 : o.format === "percent" ? "%" : o.unit;
|
|
244
|
+
return { amount: y.shown === null ? e.statAbsentValue : i.number(y.shown, o.decimals), unit: c, names: l, target: g(!1), reason: q, sentence: s };
|
|
245
245
|
}
|
|
246
|
-
const Ve = "
|
|
246
|
+
const Ve = "_frame_1vssq_21 _text_1hv7a_23", Ge = "_calculation_1vssq_39", He = "_disclosure_1vssq_53", Ke = "_list_1vssq_57", ze = "_item_1vssq_58", Je = "_derivation_1vssq_59", Ye = "_line_1vssq_109", Ze = "_labelCell_1vssq_151", Xe = "_names_1vssq_152", et = "_operator_1vssq_153", tt = "_amount_1vssq_154", nt = "_unit_1vssq_155", st = "_assessment_1vssq_156", at = "_label_1vssq_151", ot = "_approximate_1vssq_269", rt = "_target_1vssq_297", it = "_worst_1vssq_298", lt = "_notes_1vssq_390", ct = "_freshness_1vssq_404", p = {
|
|
247
247
|
frame: Ve,
|
|
248
248
|
calculation: Ge,
|
|
249
249
|
disclosure: He,
|
|
@@ -256,8 +256,8 @@ const Ve = "_frame_1hhx1_21 _text_1hv7a_23", Ge = "_calculation_1hhx1_39", He =
|
|
|
256
256
|
operator: et,
|
|
257
257
|
amount: tt,
|
|
258
258
|
unit: nt,
|
|
259
|
-
assessment:
|
|
260
|
-
label:
|
|
259
|
+
assessment: st,
|
|
260
|
+
label: at,
|
|
261
261
|
approximate: ot,
|
|
262
262
|
target: rt,
|
|
263
263
|
worst: it,
|
|
@@ -265,29 +265,29 @@ const Ve = "_frame_1hhx1_21 _text_1hv7a_23", Ge = "_calculation_1hhx1_39", He =
|
|
|
265
265
|
freshness: ct
|
|
266
266
|
}, ut = { ok: "success", unknown: "neutral", warning: "warning", alarm: "danger" }, dt = (...t) => t.filter(Boolean).join(" ");
|
|
267
267
|
function pt({ asOf: t, ages: n }) {
|
|
268
|
-
const v = me(), m = fe(), i =
|
|
268
|
+
const v = me(), m = fe(), i = we(t, n), e = i.freshness === "lost" ? m.freshnessDisconnected : i.freshness === "stale" ? m.freshnessStale : m.freshnessFresh;
|
|
269
269
|
return /* @__PURE__ */ k("span", { className: p.freshness, "data-freshness": i.freshness, children: [
|
|
270
270
|
e,
|
|
271
271
|
i.age !== null && ` · ${v.relative(i.age)}`
|
|
272
272
|
] });
|
|
273
273
|
}
|
|
274
274
|
function vt({ children: t, className: n, style: v, ...m }) {
|
|
275
|
-
const i = me(), e = fe(), h = _e(), o = je(t),
|
|
275
|
+
const i = me(), e = fe(), h = _e(), o = je(t), y = Oe(o), [C, d] = oe(() => /* @__PURE__ */ new Set()), [g, b] = oe(null), l = (s) => d((c) => {
|
|
276
276
|
const r = new Set(c);
|
|
277
|
-
return r.delete(
|
|
278
|
-
}), $ = (
|
|
279
|
-
let
|
|
280
|
-
const T = (
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
const U = `${h}-${
|
|
284
|
-
(P,
|
|
285
|
-
) : [], D = I && !E && u.worst !== void 0 && K(u.worst) > K(u.verdict ?? "ok") ? u.worst : void 0,
|
|
286
|
-
!c &&
|
|
287
|
-
(
|
|
288
|
-
(
|
|
289
|
-
!c &&
|
|
290
|
-
].filter(Boolean), he = A ? "result" :
|
|
277
|
+
return r.delete(s) || r.add(s), r;
|
|
278
|
+
}), $ = (s, c, r) => r === 0 || c.previous ? void 0 : { operator: s.operator, negated: c.negated === !0 };
|
|
279
|
+
let q = !1;
|
|
280
|
+
const T = (s, c) => g === null ? void 0 : s === g ? "use" : c === g ? "operand" : void 0, N = (s, c, r, _) => {
|
|
281
|
+
const a = o.quantities.get(s), u = y.get(s), w = Le(o, y, s, c, i, e, r.position), B = a.operator !== void 0 && !c, A = s === o.result && !c, W = B && (a.interim ? r.flat : A), I = B && !W, E = I && C.has(s);
|
|
282
|
+
q || (q = I);
|
|
283
|
+
const U = `${h}-${s}`, F = { depth: W ? r.depth : r.depth + 1, flat: !1, parent: s }, R = B ? a.operands.find((P) => P.previous) : void 0, L = R && r.flat ? N(R.key, !1, { ...r, parent: s, position: void 0 }, `${_}-c`) : [], z = R && !r.flat ? N(R.key, !1, { ...F, flat: !0 }, `${_}-c`) : [], M = B ? a.operands.map(
|
|
284
|
+
(P, ae) => P.previous ? null : N(P.key, P.reference, { ...F, position: $(a, P, ae) }, `${_}-${ae}`)
|
|
285
|
+
) : [], D = I && !E && u.worst !== void 0 && K(u.worst) > K(u.verdict ?? "ok") ? u.worst : void 0, O = c ? void 0 : a.given, J = r.position ? te(r.position, !1, e) : void 0, ne = [
|
|
286
|
+
!c && a.explanation !== void 0 && /* @__PURE__ */ f("span", { children: a.explanation }, "explanation"),
|
|
287
|
+
(O == null ? void 0 : O.source) !== void 0 && /* @__PURE__ */ f("span", { children: e.calculationSource(O.source) }, "source"),
|
|
288
|
+
(O == null ? void 0 : O.asOf) !== void 0 && (O.ages !== void 0 ? /* @__PURE__ */ f(pt, { asOf: O.asOf, ages: O.ages }, "asOf") : /* @__PURE__ */ f("span", { children: e.asOfAgo(i.dateTime(new Date(O.asOf), !1)) }, "asOf")),
|
|
289
|
+
!c && a.aside !== void 0 && /* @__PURE__ */ f("span", { children: a.aside }, "aside")
|
|
290
|
+
].filter(Boolean), he = A ? "result" : a.interim && !c && r.flat ? "interim" : void 0, se = /* @__PURE__ */ k(
|
|
291
291
|
"div",
|
|
292
292
|
{
|
|
293
293
|
className: p.line,
|
|
@@ -296,18 +296,18 @@ function vt({ children: t, className: n, style: v, ...m }) {
|
|
|
296
296
|
"data-kind": he,
|
|
297
297
|
"data-foldable": I ? "" : void 0,
|
|
298
298
|
"data-reference": c ? "" : void 0,
|
|
299
|
-
"data-mark": T(
|
|
300
|
-
onPointerEnter: () => b(
|
|
299
|
+
"data-mark": T(s, r.parent),
|
|
300
|
+
onPointerEnter: () => b(s),
|
|
301
301
|
onPointerLeave: () => b(null),
|
|
302
|
-
onFocus: () => b(
|
|
302
|
+
onFocus: () => b(s),
|
|
303
303
|
onBlur: () => b(null),
|
|
304
304
|
onClick: I ? () => {
|
|
305
305
|
var P;
|
|
306
|
-
(P = window.getSelection()) != null && P.toString() || l(
|
|
306
|
+
(P = window.getSelection()) != null && P.toString() || l(s);
|
|
307
307
|
} : void 0,
|
|
308
308
|
children: [
|
|
309
309
|
/* @__PURE__ */ f($e, { children: [
|
|
310
|
-
|
|
310
|
+
w.sentence,
|
|
311
311
|
u.approximate && e.calculationApproximateNote,
|
|
312
312
|
D !== void 0 && e.calculationWorstInside(H(D, e))
|
|
313
313
|
].filter(Boolean).join(". ") }),
|
|
@@ -319,22 +319,22 @@ function vt({ children: t, className: n, style: v, ...m }) {
|
|
|
319
319
|
className: p.disclosure,
|
|
320
320
|
"aria-expanded": E,
|
|
321
321
|
"aria-controls": U,
|
|
322
|
-
"aria-label": (E ? e.calculationHideDerivation : e.calculationShowDerivation)(
|
|
323
|
-
children: /* @__PURE__ */ f(
|
|
322
|
+
"aria-label": (E ? e.calculationHideDerivation : e.calculationShowDerivation)(a.label),
|
|
323
|
+
children: /* @__PURE__ */ f(Ne, { "data-open": E ? "" : void 0 })
|
|
324
324
|
}
|
|
325
325
|
) : /* @__PURE__ */ f("span", { className: p.disclosure, "aria-hidden": "true" }),
|
|
326
|
-
/* @__PURE__ */ f("span", { className: p.label, "aria-hidden": "true", children:
|
|
326
|
+
/* @__PURE__ */ f("span", { className: p.label, "aria-hidden": "true", children: a.label })
|
|
327
327
|
] }),
|
|
328
|
-
/* @__PURE__ */ f("span", { className: p.names, "aria-hidden": "true", children: I && !E ?
|
|
328
|
+
/* @__PURE__ */ f("span", { className: p.names, "aria-hidden": "true", children: I && !E ? w.names : void 0 }),
|
|
329
329
|
/* @__PURE__ */ f("span", { className: p.operator, "aria-hidden": "true", children: J }),
|
|
330
330
|
/* @__PURE__ */ k("span", { className: p.amount, "aria-hidden": "true", "data-verdict": u.verdict, children: [
|
|
331
331
|
u.approximate && /* @__PURE__ */ f(re, { content: e.calculationApproximateNote, children: /* @__PURE__ */ f("span", { className: p.approximate, children: "≈" }) }),
|
|
332
|
-
|
|
332
|
+
w.amount
|
|
333
333
|
] }),
|
|
334
|
-
/* @__PURE__ */ f("span", { className: p.unit, "aria-hidden": "true", children:
|
|
334
|
+
/* @__PURE__ */ f("span", { className: p.unit, "aria-hidden": "true", children: w.unit }),
|
|
335
335
|
/* @__PURE__ */ k("span", { className: p.assessment, "aria-hidden": "true", children: [
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
w.reason !== void 0 ? /* @__PURE__ */ f(ie, { children: w.reason }) : u.verdict !== void 0 && /* @__PURE__ */ f(ie, { tone: ut[u.verdict], children: H(u.verdict, e) }),
|
|
337
|
+
w.target !== void 0 && /* @__PURE__ */ f("span", { className: p.target, children: w.target }),
|
|
338
338
|
D !== void 0 && /* @__PURE__ */ f("span", { className: p.worst, "data-verdict": D, children: e.calculationWorstInside(H(D, e)) })
|
|
339
339
|
] }),
|
|
340
340
|
ne.length > 0 && /* A click here - on a link in the aside, on a sparkline - is the
|
|
@@ -347,12 +347,12 @@ function vt({ children: t, className: n, style: v, ...m }) {
|
|
|
347
347
|
...L,
|
|
348
348
|
/* @__PURE__ */ k("li", { className: p.item, children: [
|
|
349
349
|
/* @__PURE__ */ f("ul", { className: p.list, children: M }),
|
|
350
|
-
|
|
350
|
+
se
|
|
351
351
|
] }, _)
|
|
352
352
|
] : [
|
|
353
353
|
...L,
|
|
354
354
|
/* @__PURE__ */ k("li", { className: p.item, "data-open": E ? "" : void 0, style: { "--depth": r.depth }, children: [
|
|
355
|
-
|
|
355
|
+
se,
|
|
356
356
|
I && /* @__PURE__ */ k("ul", { id: U, className: p.derivation, hidden: !E, children: [
|
|
357
357
|
z,
|
|
358
358
|
M,
|
|
@@ -363,33 +363,33 @@ function vt({ children: t, className: n, style: v, ...m }) {
|
|
|
363
363
|
style: { "--depth": F.depth },
|
|
364
364
|
"data-inner": "",
|
|
365
365
|
"data-closing": "",
|
|
366
|
-
"data-mark": g ===
|
|
366
|
+
"data-mark": g === s ? "use" : void 0,
|
|
367
367
|
children: [
|
|
368
368
|
/* @__PURE__ */ k("span", { className: p.labelCell, children: [
|
|
369
369
|
/* @__PURE__ */ f("span", { className: p.disclosure }),
|
|
370
370
|
/* @__PURE__ */ k("span", { className: p.label, children: [
|
|
371
371
|
"= ",
|
|
372
|
-
|
|
372
|
+
a.label
|
|
373
373
|
] })
|
|
374
374
|
] }),
|
|
375
375
|
/* @__PURE__ */ f("span", { className: p.names }),
|
|
376
376
|
/* @__PURE__ */ f("span", { className: p.operator }),
|
|
377
377
|
/* @__PURE__ */ k("span", { className: p.amount, "data-verdict": u.verdict, children: [
|
|
378
378
|
u.approximate && /* @__PURE__ */ f(re, { content: e.calculationApproximateNote, children: /* @__PURE__ */ f("span", { className: p.approximate, children: "≈" }) }),
|
|
379
|
-
|
|
379
|
+
w.amount
|
|
380
380
|
] }),
|
|
381
|
-
/* @__PURE__ */ f("span", { className: p.unit, children:
|
|
381
|
+
/* @__PURE__ */ f("span", { className: p.unit, children: w.unit })
|
|
382
382
|
]
|
|
383
383
|
}
|
|
384
384
|
) })
|
|
385
385
|
] })
|
|
386
386
|
] }, _)
|
|
387
387
|
];
|
|
388
|
-
},
|
|
388
|
+
}, x = N(o.result, !1, { depth: 0, flat: !0, parent: null }, "r");
|
|
389
389
|
return (
|
|
390
390
|
/* The frame is the surface and the container the layout measures itself
|
|
391
391
|
against; the list inside it is the statement. */
|
|
392
|
-
/* @__PURE__ */ f("div", { className: dt(p.frame, n), style: v, "data-still":
|
|
392
|
+
/* @__PURE__ */ f("div", { className: dt(p.frame, n), style: v, "data-still": q ? void 0 : "", children: /* @__PURE__ */ f("ul", { className: p.calculation, ...m, children: x }) })
|
|
393
393
|
);
|
|
394
394
|
}
|
|
395
395
|
export {
|
|
@@ -397,7 +397,7 @@ export {
|
|
|
397
397
|
Ie as Chain,
|
|
398
398
|
ke as Difference,
|
|
399
399
|
Ee as DividedBy,
|
|
400
|
-
|
|
400
|
+
Se as Given,
|
|
401
401
|
Y as Interim,
|
|
402
402
|
Pe as Minus,
|
|
403
403
|
Me as Plus,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umriss-ui/calculation",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "The umriss calculation - a derivation written as it is shown, evaluated by the library, folded and read line by line.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Roman Händler",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=18",
|
|
46
46
|
"react-dom": ">=18",
|
|
47
|
-
"@umriss-ui/core": "^0.
|
|
47
|
+
"@umriss-ui/core": "^0.7.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@fontsource/geist-mono": "^5.3.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"typescript": "^5.6.3",
|
|
59
59
|
"vite": "^6.0.0",
|
|
60
60
|
"vite-plugin-dts": "^4.3.0",
|
|
61
|
-
"@umriss-ui/core": "0.
|
|
61
|
+
"@umriss-ui/core": "0.7.0",
|
|
62
62
|
"@umriss-ui/demo": "0.0.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|