@nxgt/material 3.51.0 → 3.53.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/CHANGELOG.md +44 -0
- package/README.md +5 -4
- package/dist/{async-slice-BGtmF3K5.js → async-slice-DDSsekfm.js} +2 -2
- package/dist/{button-BWcr2b49.js → button-Ct8DSLVv.js} +1 -1
- package/dist/charts.js +1064 -932
- package/dist/{chip-CmLW6ZrT.js → chip-BzoNsd-W.js} +2 -2
- package/dist/{code-editor-BKMaeIF6.js → code-editor-DsLQeiZc.js} +6 -6
- package/dist/code-editor.js +5 -5
- package/dist/{code-language-items-Cs1Pwd1h.js → code-language-items-4zXlIEZ0.js} +2 -2
- package/dist/components/components.css +1 -5
- package/dist/components/ui/actions/action-card/action-card-tile.css +11 -2
- package/dist/components/ui/collections/data-table/data-table-items-record.css +27 -0
- package/dist/components/ui/collections/data-table/index.css +14 -0
- package/dist/{components-CuwU9Sux.js → components-DZPMvc1w.js} +16110 -15921
- package/dist/components.js +26 -26
- package/dist/{dialog-TdT_5iUc.js → dialog-DwPmwmA3.js} +4 -4
- package/dist/dnd.js +1 -1
- package/dist/draw-animate.js +1 -1
- package/dist/{dropdown-menu-BozV6Ikw.js → dropdown-menu-CDN6Nqx6.js} +1 -1
- package/dist/editor.js +9 -9
- package/dist/{empty-state-gzBPimAo.js → empty-state-Bb9W9did.js} +2 -2
- package/dist/{escape-owner-Bu-aDEEO.js → escape-owner-DI_lg2ID.js} +1 -1
- package/dist/{field-blur-47zmuDkH.js → field-blur-BcJH8H9B.js} +1 -1
- package/dist/{field-blur-context-6McYOnM8.js → field-blur-context-Dg1nwWOV.js} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/{hover-card-zHdZJpBG.js → hover-card-Qse4gnop.js} +2 -2
- package/dist/i18n-provider-DlVPS58N.js +79 -0
- package/dist/i18n.js +5 -5
- package/dist/{icon-badge-CRFGIQPX.js → icon-badge-DVPBQOKe.js} +3 -3
- package/dist/{icon-button-CtG3Snfm.js → icon-button-C3wDxsh6.js} +12 -12
- package/dist/lib/components/ui/actions/action-card/action-card-semantics.d.ts +17 -1
- package/dist/lib/components/ui/actions/action-card/action-card.d.ts +16 -2
- package/dist/lib/components/ui/actions/action-card/partials/action-card-text.d.ts +6 -2
- package/dist/lib/components/ui/actions/action-card/partials/action-card-title-button.d.ts +15 -1
- package/dist/lib/components/ui/actions/action-card/partials/action-card-trail.d.ts +2 -1
- package/dist/lib/components/ui/collections/data-grid/columns/column-codec.d.ts +3 -3
- package/dist/lib/components/ui/collections/data-grid/columns/column-edit.d.ts +5 -5
- package/dist/lib/components/ui/collections/data-grid/columns/row-meta.d.ts +22 -0
- package/dist/lib/components/ui/collections/data-grid/grid-meta.d.ts +10 -3
- package/dist/lib/components/ui/collections/data-table/data-table.d.ts +1 -1
- package/dist/lib/components/ui/collections/data-table/layout-types.d.ts +27 -0
- package/dist/lib/components/ui/collections/data-table/partials/layouts/data-table-item-context.d.ts +2 -0
- package/dist/lib/components/ui/collections/data-table/partials/layouts/data-table-item-row.d.ts +8 -0
- package/dist/lib/components/ui/collections/data-table/types.d.ts +1 -1
- package/dist/lib/components/ui/collections/filter/bar/filter-bar-classes.d.ts +7 -2
- package/dist/lib/components/ui/collections/server-table/partials/filtered-server-table.d.ts +1 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-band-classes.d.ts +5 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-band-view.d.ts +18 -0
- package/dist/lib/components/ui/collections/server-table/partials/use-server-table-list-root.d.ts +10 -0
- package/dist/lib/components/ui/collections/server-table/partials/use-server-table-phone-row.d.ts +3 -2
- package/dist/lib/components/ui/display/change-history/types.d.ts +2 -1
- package/dist/lib/components/ui/display/description/description.d.ts +2 -2
- package/dist/lib/components/ui/display/list-tile/internal.d.ts +1 -0
- package/dist/lib/components/ui/display/list-tile/partials/list-tile-dense-text.d.ts +28 -0
- package/dist/lib/components/ui/feedback/toast/toast-text.d.ts +7 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/fields/verification-code/use-resend-focus.d.ts +4 -1
- package/dist/lib/components/ui/forms/index.d.ts +2 -0
- package/dist/lib/components/ui/forms/use-fast-form.d.ts +25 -0
- package/dist/lib/components/ui/forms/use-focus-on-refusal.d.ts +14 -0
- package/dist/lib/components/ui/layout/app-shell/activity-content-aside.d.ts +3 -1
- package/dist/lib/components/ui/layout/app-shell/activity-content.d.ts +10 -1
- package/dist/lib/components/ui/primitives/tabs/tabs-overflow-classes.d.ts +8 -5
- package/dist/lib/components/ui/primitives/tabs/use-tabs-overflow.d.ts +4 -3
- package/dist/lib/components/ui/selection/switcher/partials/switcher-trigger.d.ts +3 -1
- package/dist/lib/components/ui/selection/switcher/switcher.d.ts +1 -1
- package/dist/lib/components/ui/selection/switcher/types.d.ts +7 -0
- package/dist/lib/components/ui/widgets/native-charts/core/reference-text.d.ts +14 -6
- package/dist/lib/components/ui/widgets/native-charts/core/reference.d.ts +57 -10
- package/dist/lib/components/ui/widgets/native-charts/core/types.d.ts +13 -5
- package/dist/lib/components/ui/widgets/native-charts/hooks/chart-model-types.d.ts +3 -2
- package/dist/lib/components/ui/widgets/native-charts/index.d.ts +1 -1
- package/dist/lib/components/ui/widgets/native-charts/line-chart/line-chart-types.d.ts +6 -1
- package/dist/lib/components/ui/widgets/native-charts/line-chart/partials/reference-marks.d.ts +1 -1
- package/dist/lib/i18n/i18n-provider.d.ts +14 -3
- package/dist/lib/i18n/material-resources-registry.d.ts +21 -0
- package/dist/lib/i18n/resources/en/en.d.ts +4 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +5 -1
- package/dist/lib/i18n/resources/fr/fr.d.ts +4 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +5 -1
- package/dist/lib/i18n/resources/resources.d.ts +8 -0
- package/dist/lib/i18n/translate-material.d.ts +7 -1
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/i18n/types.d.ts +6 -0
- package/dist/lib/i18n/use-material-translation.d.ts +4 -0
- package/dist/lib.js +1 -1
- package/dist/main.js +43 -43
- package/dist/map.js +8 -8
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/print.js +5 -4
- package/dist/{public-CTZ5RK_Y.js → public-BoVE0ffh.js} +9 -9
- package/dist/{rich-code-block-oTgL-s4W.js → rich-code-block-DAUM7Yh_.js} +5 -5
- package/dist/{sortable-provider-CpA5NYgD.js → sortable-provider-BLXsGE_0.js} +2 -2
- package/dist/{spinner-UvqlDsV8.js → spinner-Rg4PnBPH.js} +1 -1
- package/dist/{stored-language-Cb9FMEwk.js → stored-language-B1lJMPbR.js} +10 -2
- package/dist/theme-picker.js +2 -2
- package/dist/{theme-toggle-BZVz6O5q.js → theme-toggle-jVdxF_mc.js} +1 -1
- package/dist/{toolbar-items-C09bJphe.js → toolbar-items-BFY_hns5.js} +4 -4
- package/dist/translate-material-q-JNxP1m.js +20 -0
- package/dist/{translator-BnQXtpSZ.js → translator-BU1o3_l9.js} +1 -1
- package/dist/{use-chat-composer-AZAj4tFJ.js → use-chat-composer-DGbDuIUa.js} +3783 -3719
- package/dist/{use-heading-spy-C9-A2md2.js → use-heading-spy-CP63sAcS.js} +1 -1
- package/dist/use-material-translation-nNF8fUXz.js +14 -0
- package/dist/use-shape-morph-DXdy2X5g.js +35 -0
- package/docs/components/buttons-and-actions.md +30 -1
- package/docs/components/data-display.md +3 -3
- package/docs/components/data-table-filter-and-lists.md +2 -2
- package/docs/components/navigation-and-layout.md +1 -0
- package/docs/components/primitives.md +1 -1
- package/docs/components/rich-widgets.md +2 -1
- package/docs/components/selection-and-choice.md +20 -0
- package/docs/guides/app-shell.md +22 -0
- package/docs/guides/cards-and-tiles.md +40 -4
- package/docs/guides/charts.md +30 -2
- package/docs/guides/data-grid.md +42 -2
- package/docs/guides/forms.md +35 -0
- package/docs/guides/helpers.md +1 -1
- package/docs/guides/i18n.md +34 -8
- package/docs/guides/two-factor.md +2 -1
- package/docs/previews/guides-i18n-i18nprovider.webp +0 -0
- package/docs/previews/guides-i18n-translated-components.webp +0 -0
- package/docs/roadmap.md +84 -684
- package/docs/troubleshooting.md +24 -2
- package/lib/components/components.css +1 -5
- package/lib/components/ui/actions/action-card/action-card-tile.css +11 -2
- package/lib/components/ui/collections/data-table/data-table-items-record.css +27 -0
- package/lib/components/ui/collections/data-table/index.css +14 -0
- package/package.json +1 -1
- package/dist/i18n-provider-Ang2f31m.js +0 -43
- package/dist/translate-material-D6KCK21i.js +0 -12
- package/dist/use-material-translation-pLgSqqLw.js +0 -14
- package/dist/use-shape-morph-BKA_R5P5.js +0 -35
package/docs/troubleshooting.md
CHANGED
|
@@ -273,6 +273,7 @@ words in your error.
|
|
|
273
273
|
- [A `SwitchFormField` shows no validation message](#a-switchformfield-shows-no-validation-message)
|
|
274
274
|
- [A `TimeFormField` shows its error on a desktop but not on a phone](#a-timeformfield-shows-its-error-on-a-desktop-but-not-on-a-phone)
|
|
275
275
|
- [`setError(…, { shouldFocus: true })` or a failed submit does not focus the field](#seterror--shouldfocus-true--or-a-failed-submit-does-not-focus-the-field)
|
|
276
|
+
- [`useFastForm` does not focus the first field](#usefastform-does-not-focus-the-first-field)
|
|
276
277
|
- [`touchedFields` stays empty after leaving a field, or `mode: 'onBlur'` never validates](#touchedfields-stays-empty-after-leaving-a-field-or-mode-onblur-never-validates)
|
|
277
278
|
- ["Required" shows as soon as the calendar opens, or while a date is being picked](#required-shows-as-soon-as-the-calendar-opens-or-while-a-date-is-being-picked)
|
|
278
279
|
- [`TypeError: values.map is not a function` (a `SliderFormField`)](#typeerror-valuesmap-is-not-a-function)
|
|
@@ -3902,8 +3903,9 @@ followed by the list of keys, e.g. `"en": material.command.title. App resources
|
|
|
3902
3903
|
take precedence over the base bundle at these keys.`
|
|
3903
3904
|
**Why:** your resources define leaves under the `material` namespace, which
|
|
3904
3905
|
this package reserves for its own strings. The override reaches your app's
|
|
3905
|
-
own translator only
|
|
3906
|
-
|
|
3906
|
+
own translator only, unless you also give the merged object to
|
|
3907
|
+
`<I18nProvider resources={resources}>`: without it the package's components
|
|
3908
|
+
translate from their own bundle, so their text does **not** change.
|
|
3907
3909
|
**Fix:**
|
|
3908
3910
|
|
|
3909
3911
|
```ts
|
|
@@ -4735,6 +4737,26 @@ open the section before calling `setError`.
|
|
|
4735
4737
|
`PasswordFormField` or `OtpFormField` (Storybook: `Guides/Forms/Focus on
|
|
4736
4738
|
error`, `Set Focus Password` and `Set Focus Otp`).
|
|
4737
4739
|
|
|
4740
|
+
### `useFastForm` does not focus the first field
|
|
4741
|
+
|
|
4742
|
+
**When:** a form on `useFastForm(props, 'email')` opens and the focus stays
|
|
4743
|
+
where it was, or in a dialog it ends on the dialog instead of the field.
|
|
4744
|
+
**Why:** `useFastForm` calls `setFocus(first)`, which needs the field's `ref`:
|
|
4745
|
+
the field must be a `*FormField` of this form (or give `field.ref` to its
|
|
4746
|
+
control), and it must be mounted. The hook asks again each frame for about half
|
|
4747
|
+
a second, then gives up; it also stops at once when the focus moved, the
|
|
4748
|
+
user's own move included. A form whose hook stays mounted while its dialog is
|
|
4749
|
+
closed focuses only when `active` turns true.
|
|
4750
|
+
**Fix:** pass the dialog's `open` as the third argument, and make sure `first`
|
|
4751
|
+
names a mounted field:
|
|
4752
|
+
|
|
4753
|
+
```tsx
|
|
4754
|
+
const form = useFastForm<Values>({ defaultValues }, 'email', open);
|
|
4755
|
+
```
|
|
4756
|
+
|
|
4757
|
+
Storybook: `Guides/Forms/useFastForm`. See
|
|
4758
|
+
[forms](guides/forms.md#a-form-that-is-quick-to-fill).
|
|
4759
|
+
|
|
4738
4760
|
### `touchedFields` stays empty after leaving a field, or `mode: 'onBlur'` never validates
|
|
4739
4761
|
|
|
4740
4762
|
**When:** a `*FormField` keeps `formState.touchedFields` (and
|
|
@@ -58,11 +58,7 @@
|
|
|
58
58
|
@import "./ui/layout/app-shell/activity-backdrop-shapes.css";
|
|
59
59
|
@import "./ui/layout/auth-card/auth-card-backdrop.css";
|
|
60
60
|
/* DataTable cards and tiles: the item shell (hairline, tint, start bar, columns by the list's width). */
|
|
61
|
-
@import "./ui/collections/data-table/
|
|
62
|
-
@import "./ui/collections/data-table/data-table-items-compact.css";
|
|
63
|
-
@import "./ui/collections/data-table/data-table-items-bar.css";
|
|
64
|
-
@import "./ui/collections/data-table/data-table-items-forced.css";
|
|
65
|
-
@import "./ui/collections/data-table/data-table-items-tiles.css";
|
|
61
|
+
@import "./ui/collections/data-table/index.css";
|
|
66
62
|
/* ServerTable's second header row on a phone: select-all, sort, Filters and the actions. */
|
|
67
63
|
@import "./ui/collections/server-table/server-table-phone-row.css";
|
|
68
64
|
/* Checkbox and Radio: the check that draws in, the dot that springs in, the state layer. */
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
* wrapper dissolves so its children take the areas. */
|
|
77
77
|
.nxgt-action-card[data-size="tile"] {
|
|
78
78
|
grid-template-columns: minmax(0, 1fr) auto;
|
|
79
|
-
grid-template-areas: "title act" "status status" "desc desc" "meta meta";
|
|
79
|
+
grid-template-areas: "title act" "status status" "desc desc" "meta meta" "foot foot";
|
|
80
80
|
align-items: start;
|
|
81
81
|
/* A taller neighbour stretches the card: keep the rows at the top. */
|
|
82
82
|
align-content: start;
|
|
@@ -93,7 +93,8 @@
|
|
|
93
93
|
"icon title act"
|
|
94
94
|
". status status"
|
|
95
95
|
". desc desc"
|
|
96
|
-
". meta meta"
|
|
96
|
+
". meta meta"
|
|
97
|
+
". foot foot";
|
|
97
98
|
}
|
|
98
99
|
.nxgt-action-card[data-size="tile"] .nxgt-action-card-icon {
|
|
99
100
|
width: 36px;
|
|
@@ -119,6 +120,14 @@
|
|
|
119
120
|
.nxgt-action-card[data-size="tile"] .nxgt-action-card-meta {
|
|
120
121
|
grid-area: meta;
|
|
121
122
|
}
|
|
123
|
+
/* The footer: secondary links, above the stretched title link or button. */
|
|
124
|
+
.nxgt-action-card-footer {
|
|
125
|
+
grid-area: foot;
|
|
126
|
+
position: relative;
|
|
127
|
+
z-index: 1;
|
|
128
|
+
min-width: 0;
|
|
129
|
+
margin-top: 2px;
|
|
130
|
+
}
|
|
122
131
|
.nxgt-action-card[data-size="tile"][data-has-action]
|
|
123
132
|
.nxgt-action-card-action {
|
|
124
133
|
align-self: start;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* The compact record row of a tile (`item.Row`, data-table-item-row.tsx): the
|
|
2
|
+
* dense row of ListTile inside the tile's shell. Direction "A Refined" for the
|
|
3
|
+
* shell; the row is 36px tall under a fine pointer and 44px under a coarse one
|
|
4
|
+
* (the link's `::after` covers the tile, so the whole tile is the target).
|
|
5
|
+
* The title is 13px medium like ListTile's `size="sm"`; a selected tile's
|
|
6
|
+
* title keeps the primary text of data-table-items.css. */
|
|
7
|
+
@layer components {
|
|
8
|
+
[data-slot="data-table-tiles"]
|
|
9
|
+
> [data-slot="data-table-item"]:has([data-slot="data-table-record"]) {
|
|
10
|
+
min-height: 2.25rem;
|
|
11
|
+
padding-block: 0.375rem;
|
|
12
|
+
}
|
|
13
|
+
@media (pointer: coarse) {
|
|
14
|
+
[data-slot="data-table-tiles"]
|
|
15
|
+
> [data-slot="data-table-item"]:has([data-slot="data-table-record"]) {
|
|
16
|
+
min-height: 2.75rem;
|
|
17
|
+
/* The link's 44px box, centred on the title's first line, stays inside
|
|
18
|
+
* the tile when the subtitle and the chips stack under it. */
|
|
19
|
+
padding-block: 0.75rem;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
[data-slot="data-table-record"] [data-slot="data-table-item-title"] {
|
|
23
|
+
font-size: 0.8125rem;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
line-height: 1.4;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* DataTable cards and tiles, one file per role, in cascade order:
|
|
2
|
+
*
|
|
3
|
+
* data-table-items.css the item shell (hairline, tint, start bar, columns)
|
|
4
|
+
* data-table-items-compact.css compact cards
|
|
5
|
+
* data-table-items-bar.css the list bar
|
|
6
|
+
* data-table-items-forced.css forced colours
|
|
7
|
+
* data-table-items-tiles.css tiles: one column, one surface
|
|
8
|
+
* data-table-items-record.css the compact record row of a tile (item.Row) */
|
|
9
|
+
@import "./data-table-items.css";
|
|
10
|
+
@import "./data-table-items-compact.css";
|
|
11
|
+
@import "./data-table-items-bar.css";
|
|
12
|
+
@import "./data-table-items-forced.css";
|
|
13
|
+
@import "./data-table-items-tiles.css";
|
|
14
|
+
@import "./data-table-items-record.css";
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { i as e, r as t, t as n } from "./stored-language-Cb9FMEwk.js";
|
|
2
|
-
import { createContext as r, useCallback as i, useContext as a, useMemo as o, useState as s } from "react";
|
|
3
|
-
import { jsx as c } from "react/jsx-runtime";
|
|
4
|
-
//#region lib/i18n/i18n-provider.tsx
|
|
5
|
-
var l = r(null);
|
|
6
|
-
function u({ children: r, defaultLanguage: a = "en", storageKey: u = t, supportedLanguages: d = e, onLanguageChange: f, initialLanguage: p }) {
|
|
7
|
-
let [m, h] = s(() => p && d.includes(p) ? p : n(u, a, d)), g = i((e) => {
|
|
8
|
-
if (!d.includes(e)) {
|
|
9
|
-
console.warn(`[@nxgt/material] Unsupported language: "${e}".`);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
if (typeof localStorage < "u") try {
|
|
13
|
-
localStorage.setItem(u, e);
|
|
14
|
-
} catch {}
|
|
15
|
-
h(e), f?.(e);
|
|
16
|
-
}, [
|
|
17
|
-
u,
|
|
18
|
-
d,
|
|
19
|
-
f
|
|
20
|
-
]), _ = o(() => ({
|
|
21
|
-
language: m,
|
|
22
|
-
changeLanguage: g,
|
|
23
|
-
supportedLanguages: d
|
|
24
|
-
}), [
|
|
25
|
-
m,
|
|
26
|
-
g,
|
|
27
|
-
d
|
|
28
|
-
]);
|
|
29
|
-
return /* @__PURE__ */ c(l.Provider, {
|
|
30
|
-
value: _,
|
|
31
|
-
children: r
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function d() {
|
|
35
|
-
let e = a(l);
|
|
36
|
-
if (!e) throw Error("useI18nContext must be used within an I18nProvider");
|
|
37
|
-
return e;
|
|
38
|
-
}
|
|
39
|
-
function f() {
|
|
40
|
-
return a(l);
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
export { d as n, f as r, u as t };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./stored-language-Cb9FMEwk.js";
|
|
2
|
-
import { a as e, r as t } from "./translator-BnQXtpSZ.js";
|
|
3
|
-
//#region lib/i18n/translate-material.ts
|
|
4
|
-
function n(n, r, i, a) {
|
|
5
|
-
if (n) for (let e of /* @__PURE__ */ new Set([n, n.split("-")[0]])) {
|
|
6
|
-
let n = t(r, a, () => e);
|
|
7
|
-
if (n !== r) return n;
|
|
8
|
-
}
|
|
9
|
-
return e(i, n || "en", a);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { n as t };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./i18n-provider-Ang2f31m.js";
|
|
2
|
-
import { t } from "./translate-material-D6KCK21i.js";
|
|
3
|
-
import { useCallback as n } from "react";
|
|
4
|
-
//#region lib/i18n/use-material-translation.ts
|
|
5
|
-
function r() {
|
|
6
|
-
let r = e(), i = r?.language;
|
|
7
|
-
return {
|
|
8
|
-
t: n((e, n, r) => t(i, e, n, r), [i]),
|
|
9
|
-
language: i,
|
|
10
|
-
hasProvider: !!r
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { r as t };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { morph as e, morphAt as t, toSvgPath as n } from "@nxgt/material-core/shapes";
|
|
2
|
-
import { useLayoutEffect as r, useRef as i } from "react";
|
|
3
|
-
//#region lib/components/ui/display/shape/use-shape-morph.ts
|
|
4
|
-
var a = .8, o = 14, s = o * Math.sqrt(1 - a * a);
|
|
5
|
-
function c(e) {
|
|
6
|
-
let t = e / 1e3;
|
|
7
|
-
return 1 - Math.exp(-.8 * o * t) * (Math.cos(s * t) + a * o / s * Math.sin(s * t));
|
|
8
|
-
}
|
|
9
|
-
var l = () => typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10
|
-
function u(a, o, s) {
|
|
11
|
-
let u = i(o);
|
|
12
|
-
r(() => {
|
|
13
|
-
let r = a.current, i = u.current;
|
|
14
|
-
if (!r || i === o || !s || l()) {
|
|
15
|
-
r && i !== o && r.setAttribute("d", n(o)), u.current = o;
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
let d = e(i, o), f = n(o), p = 0, m = performance.now(), h = (e) => {
|
|
19
|
-
let i = e - m;
|
|
20
|
-
if (i >= 520) {
|
|
21
|
-
u.current = o, r.setAttribute("d", f);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
let a = t(d, c(i));
|
|
25
|
-
u.current = a, r.setAttribute("d", n(a)), p = requestAnimationFrame(h);
|
|
26
|
-
};
|
|
27
|
-
return r.setAttribute("d", n(d.from)), p = requestAnimationFrame(h), () => cancelAnimationFrame(p);
|
|
28
|
-
}, [
|
|
29
|
-
a,
|
|
30
|
-
o,
|
|
31
|
-
s
|
|
32
|
-
]);
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { u as n, c as t };
|