rei-kit 2.1.0 → 2.3.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/README.md +77 -25
- package/dist/format-BEvBK1SJ.js +80 -0
- package/dist/format-BEvBK1SJ.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -53
- package/dist/index.js.map +1 -1
- package/dist/mobile.css +28 -0
- package/dist/motion/BaseMarquee.vue.d.ts +37 -0
- package/dist/motion/BaseReveal.vue.d.ts +34 -0
- package/dist/motion/CountUp.vue.d.ts +28 -0
- package/dist/motion/NumberTicker.vue.d.ts +33 -0
- package/dist/motion/TextRotate.vue.d.ts +24 -0
- package/dist/motion/TypeWriter.vue.d.ts +30 -0
- package/dist/motion/environment.d.ts +21 -0
- package/dist/motion/index.d.ts +15 -0
- package/dist/motion.css +119 -0
- package/dist/motion.js +434 -0
- package/dist/motion.js.map +1 -0
- package/dist/styles.css +162 -8
- package/dist/utils/format.d.ts +16 -0
- package/dist/web.css +28 -0
- package/dist/web.js +3 -3
- package/dist/web.js.map +1 -1
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# rei-kit
|
|
2
2
|
|
|
3
|
-
**One kit. Every look.**
|
|
3
|
+
**One kit. Every look.** 59 accessible components for Vue 3 and Tailwind 4.
|
|
4
4
|
Change the **material** with one attribute and the **palette** with another —
|
|
5
5
|
every component follows, and none of them knows your brand.
|
|
6
6
|
|
|
@@ -34,6 +34,7 @@ That line is the whole redesign. Three axes, each changed on its own:
|
|
|
34
34
|
| **`rei-kit/web`** | Wide-site parts: dialogs, tabs, tooltips, pagination, breadcrumbs |
|
|
35
35
|
| **`rei-kit/app`** | Phone-app parts: the shell, the tab transition, the sign-in form |
|
|
36
36
|
| **`rei-kit/pwa`** | Installing and updating |
|
|
37
|
+
| **`rei-kit/motion`** | Numbers that count and roll, words that rotate and type, content that arrives |
|
|
37
38
|
| **`rei-kit/supabase`** | An optional Supabase entry — auth errors, a remember-me client |
|
|
38
39
|
|
|
39
40
|
Three apps run on it and no two resemble each other. Every component is typed,
|
|
@@ -86,17 +87,17 @@ styles included and Vue left out. Minified, gzip -9:
|
|
|
86
87
|
|
|
87
88
|
| Kit | JS | CSS | Total |
|
|
88
89
|
| -------------------- | ---------: | ----------: | ----------: |
|
|
89
|
-
| **rei-kit 2.
|
|
90
|
+
| **rei-kit 2.3.0** | **3.1 KB** | **15.2 KB** | **18.4 KB** |
|
|
90
91
|
| element-plus 2.14.6 | 27.3 KB | 6.0 KB | 33.3 KB |
|
|
91
92
|
| naive-ui 2.45.3 | 51.2 KB | — | 51.2 KB |
|
|
92
93
|
| primevue 5.0.1 | 53.6 KB | — | 53.6 KB |
|
|
93
94
|
| ant-design-vue 4.2.6 | 70.3 KB | — | 70.3 KB |
|
|
94
95
|
| vuetify 4.2.1 | 44.0 KB | 34.3 KB | 78.4 KB |
|
|
95
96
|
|
|
96
|
-
rei-kit's CSS column is the
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
dependencies. Naive UI, PrimeVue and Ant Design put their styles in the
|
|
97
|
+
rei-kit's CSS column is the whole `mobile.css` preset: the stylesheet for
|
|
98
|
+
**every** component, all four materials and all ten palettes. The JavaScript
|
|
99
|
+
is only what the three need, because each component is its own
|
|
100
|
+
tree-shakeable module and there are no runtime dependencies. Naive UI, PrimeVue and Ant Design put their styles in the
|
|
100
101
|
JavaScript. Run it yourself: `cd bench && npm install && npm run bench`.
|
|
101
102
|
Nuxt UI is left out because it builds through its own Nuxt or Vite module and
|
|
102
103
|
cannot be bundled the same way.
|
|
@@ -111,7 +112,7 @@ Each claim here is enforced by something that fails, not by a promise.
|
|
|
111
112
|
|
|
112
113
|
| Standard | How it is held |
|
|
113
114
|
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
114
|
-
| **Open for extension, closed for edits** | A new look is a token, a material or a palette — never an edit to a component. Materials and palettes restyle all
|
|
115
|
+
| **Open for extension, closed for edits** | A new look is a token, a material or a palette — never an edit to a component. Materials and palettes restyle all 59 without touching one, and a test fails if a component holds a colour. |
|
|
115
116
|
| **Single responsibility** | One part, one job. Label-and-error wiring lives in `FormField`, not in five inputs; taking the page behind a layer out of reach lives in one helper the modal, the sheet and the guide share. |
|
|
116
117
|
| **Depend on roles, not values** | Components read `primary`, `surface`, `--shadow-card` — never a hex or a pixel shadow. An app's brand wins in both modes, tested. |
|
|
117
118
|
| **WAI-ARIA Authoring Practices** | Menus, comboboxes, tabs, sliders, dialogs and accordions follow their APG pattern: arrows move, Tab leaves, Escape closes, focus returns. Behaviour tests drive each with the keyboard. |
|
|
@@ -123,14 +124,14 @@ Each claim here is enforced by something that fails, not by a promise.
|
|
|
123
124
|
|
|
124
125
|
## Status
|
|
125
126
|
|
|
126
|
-
**v2.
|
|
127
|
+
**v2.3.0 — three consumers.**
|
|
127
128
|
|
|
128
129
|
| | |
|
|
129
130
|
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
130
|
-
| Components |
|
|
131
|
+
| Components | 59 (`AuthForm`, `BaseTable`, `BaseCombobox`, `BaseSlider`, `TabShell`, `BaseModal`, `BaseTabs`, `BaseTooltip`, `BasePagination`, `BaseBreadcrumb`, `BaseDisclosure`, `BaseAccordion`, `NavLinks`, `OfflineBanner`, `FabButton`, `BaseButton`, `BaseCard`, `BaseInput`, `BaseSelect`, `BaseTextarea`, `BaseCheckbox`, `BaseSwitch`, `BaseRadioGroup`, `BaseMenu`, `BaseAvatar`, `BaseSpinner`, `BaseAlert`, `BaseBadge`, `BaseSheet`, `ProgressBar`, `PriceCard`, `ToastHost`, `TabBar`, `GoogleButton`, `LocaleLinks`, `LocaleSheet`, `AuthShell`, `TourShell`, `InstallPrompt`, `UpdatePrompt`, `InstallSettings`, `SkeletonList`, `PageContainer`, `ErrorBoundary`, etc.) |
|
|
131
132
|
| Composables | 16 (`useToast`, `useTheme`, `useMaterial`, `usePalette`, `useToday`, `useMediaQuery`, `useInstall`, `watchInstallability`, `createTabTransition`, `useThemeSync`, `useVisualViewport`, etc.) |
|
|
132
133
|
| Utilities | 33 (`applyTheme`, `applyMaterial`, `applyPalette`, `MATERIALS`, `PALETTES`, `formatDate`, `fieldErrors`, `toAuthMessageKey`, `createAuthGuard`, `createQueryDefaults`, `createWriteReport`, `toRedirectPath`, `Supabase error mapper`, i18n runtime, etc.) |
|
|
133
|
-
| Entry Points | `rei-kit`, `rei-kit/app`, `rei-kit/web`, `rei-kit/pwa`, `rei-kit/supabase`, `rei-kit/
|
|
134
|
+
| Entry Points | `rei-kit`, `rei-kit/app`, `rei-kit/web`, `rei-kit/pwa`, `rei-kit/supabase`, `rei-kit/mobile.css`, `rei-kit/web.css`, and each stylesheet on its own |
|
|
134
135
|
|
|
135
136
|
| Consumers | [Hibi](https://github.com/ramazandogna/hibi) · [Kakei](https://github.com/ramazandogna/kakei) · [Kakehashi](https://github.com/ramazandogna/kakehashi-nihongo) |
|
|
136
137
|
|
|
@@ -178,35 +179,53 @@ import { createSupabaseClient } from 'rei-kit/supabase'
|
|
|
178
179
|
|
|
179
180
|
### Wiring the styles
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
materials and palettes:
|
|
182
|
+
Two lines, after Tailwind's own:
|
|
183
183
|
|
|
184
184
|
```css
|
|
185
185
|
/* your app's main.css */
|
|
186
186
|
@import 'tailwindcss';
|
|
187
|
+
@import 'rei-kit/mobile.css'; /* a phone-shaped app — or rei-kit/web.css for a site */
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
That is the whole kit: the colour roles and dark variant, the shell, the four
|
|
191
|
+
materials, the ten palettes and the compiled component styles. The preset
|
|
192
|
+
also tells Tailwind where the components are, which used to be the step
|
|
193
|
+
people got wrong: Tailwind only builds classes it has seen and never looks in
|
|
194
|
+
`node_modules` on its own, and a missing or mis-counted `@source` path failed
|
|
195
|
+
silently — the components mounted and came out unstyled. The preset's
|
|
196
|
+
`@source` sits next to the files it points at, so it is right wherever your
|
|
197
|
+
stylesheet is.
|
|
198
|
+
|
|
199
|
+
Put your brand after it, and you are done:
|
|
200
|
+
|
|
201
|
+
```css
|
|
202
|
+
@theme {
|
|
203
|
+
--color-primary: #6b4de6;
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### The parts, one by one
|
|
208
|
+
|
|
209
|
+
The preset is only these, and an app that wants less can import them itself:
|
|
210
|
+
|
|
211
|
+
```css
|
|
212
|
+
@import 'tailwindcss';
|
|
187
213
|
@import 'rei-kit/tokens.css'; /* colour roles, depth, motion, the dark variant */
|
|
188
214
|
@import 'rei-kit/shell/mobile.css'; /* or shell/web.css — see The shell, below */
|
|
189
215
|
@import 'rei-kit/materials.css'; /* optional: glass, brutal, soft */
|
|
190
216
|
@import 'rei-kit/palettes.css'; /* optional: the ten palettes */
|
|
191
217
|
@import 'rei-kit/styles.css'; /* compiled component styles */
|
|
192
218
|
|
|
193
|
-
/*
|
|
194
|
-
not walk node_modules on its own. Without this the kit's components render
|
|
195
|
-
with every class present in the markup and absent from the stylesheet. */
|
|
219
|
+
/* Relative to this file: adjust the ../ depth to where it sits. */
|
|
196
220
|
@source '../../node_modules/rei-kit/dist';
|
|
197
221
|
```
|
|
198
222
|
|
|
199
|
-
The path is relative to the CSS file, so adjust the `../` depth to where your
|
|
200
|
-
`main.css` sits.
|
|
201
|
-
|
|
202
223
|
**Leaving any of these out fails quietly:** the build succeeds, the
|
|
203
|
-
components mount, and they come out unstyled. Nothing type-checks
|
|
204
|
-
is worth a test
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
invisible once, and separately spent three versions restating `tokens.css`
|
|
209
|
-
locally instead of importing it, which nothing noticed.
|
|
224
|
+
components mount, and they come out unstyled. Nothing type-checks CSS, so an
|
|
225
|
+
app on this path is worth a test that reads its own stylesheet and asserts
|
|
226
|
+
them — Hibi's `kit-styling.spec.ts` does, at unit-test speed. The kit holds
|
|
227
|
+
its presets to the same line: `pnpm size` builds each one with Tailwind's own
|
|
228
|
+
scanning switched off and fails if a component's classes are missing.
|
|
210
229
|
|
|
211
230
|
### Materials
|
|
212
231
|
|
|
@@ -279,6 +298,39 @@ way in; each got the smallest nudge that clears the line.
|
|
|
279
298
|
Palettes are generated from `src/palettes/palettes.source.json` by
|
|
280
299
|
`pnpm palettes`; a test asserts the shipped CSS matches the source.
|
|
281
300
|
|
|
301
|
+
### Motion
|
|
302
|
+
|
|
303
|
+
`rei-kit/motion` is for the parts of a page that move on purpose:
|
|
304
|
+
|
|
305
|
+
```vue
|
|
306
|
+
<script setup lang="ts">
|
|
307
|
+
import { CountUp, NumberTicker, TextRotate } from 'rei-kit/motion'
|
|
308
|
+
</script>
|
|
309
|
+
|
|
310
|
+
<template>
|
|
311
|
+
<NumberTicker :value="balance" :format="{ style: 'currency', currency: 'TRY' }" />
|
|
312
|
+
<CountUp :value="12480" />
|
|
313
|
+
<h1>Build it <TextRotate :words="['glass', 'brutal', 'soft']" /></h1>
|
|
314
|
+
</template>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
| Component | What it does |
|
|
318
|
+
| -------------- | --------------------------------------------------------------- |
|
|
319
|
+
| `NumberTicker` | Rolls each digit into place, like an odometer or a note counter |
|
|
320
|
+
| `CountUp` | Counts through every value once it scrolls into view |
|
|
321
|
+
| `TextRotate` | One word in a sentence that changes on its own |
|
|
322
|
+
| `TypeWriter` | Types a line out, and deletes it for the next |
|
|
323
|
+
| `BaseReveal` | Fades or rises into view on scroll; staggers with `:delay` |
|
|
324
|
+
| `BaseMarquee` | An endless sideways row — logos, testimonials |
|
|
325
|
+
|
|
326
|
+
The presets also bring `animate-float`, `animate-pulse-soft`, `animate-glow`,
|
|
327
|
+
`animate-wiggle`, `animate-pop` and `text-shimmer`.
|
|
328
|
+
|
|
329
|
+
Every one of them renders its finished state on a server and for anyone who
|
|
330
|
+
has asked their system for less motion, reads only the final value to a
|
|
331
|
+
screen reader, and stops while hovered if it moves on its own. Six
|
|
332
|
+
components together add under 2 KB gzip.
|
|
333
|
+
|
|
282
334
|
### Colours
|
|
283
335
|
|
|
284
336
|
`tokens.css` defines all eleven roles, the five `on-*` colours that sit on a
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
//#region src/utils/format.ts
|
|
3
|
+
/**
|
|
4
|
+
* The locale `Intl` formatting uses.
|
|
5
|
+
*
|
|
6
|
+
* Held here rather than imported from an i18n runtime so the utilities have no
|
|
7
|
+
* i18n dependency at all: an app that never installs vue-i18n still gets dates
|
|
8
|
+
* in the right language. `createI18nRuntime` sets this when it is used.
|
|
9
|
+
*/
|
|
10
|
+
var locale = ref(typeof navigator === "undefined" ? "en" : navigator.language ?? "en");
|
|
11
|
+
/**
|
|
12
|
+
* Points every formatter at a new locale.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* setFormatLocale('tr-TR')
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function setFormatLocale(next) {
|
|
20
|
+
locale.value = next;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* `Intl.DateTimeFormat` is expensive to construct, so instances are cached per
|
|
24
|
+
* locale and option set. The key includes the locale, which is what lets the
|
|
25
|
+
* cache survive a language change instead of returning stale formatters.
|
|
26
|
+
*/
|
|
27
|
+
var cache = /* @__PURE__ */ new Map();
|
|
28
|
+
/**
|
|
29
|
+
* Formats a date in the active locale.
|
|
30
|
+
*
|
|
31
|
+
* Reading the locale ref here is deliberate: called from a `computed`, the
|
|
32
|
+
* result re-evaluates when the language changes.
|
|
33
|
+
*
|
|
34
|
+
* @param date - Date to format.
|
|
35
|
+
* @param options - Passed straight to `Intl.DateTimeFormat`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* formatDate(new Date(), { weekday: 'narrow' }) // 'T'
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function formatDate(date, options) {
|
|
43
|
+
const tag = locale.value;
|
|
44
|
+
const key = `${tag}:${JSON.stringify(options)}`;
|
|
45
|
+
let formatter = cache.get(key);
|
|
46
|
+
if (!formatter) {
|
|
47
|
+
formatter = new Intl.DateTimeFormat(tag, options);
|
|
48
|
+
cache.set(key, formatter);
|
|
49
|
+
}
|
|
50
|
+
return formatter.format(date);
|
|
51
|
+
}
|
|
52
|
+
var numberCache = /* @__PURE__ */ new Map();
|
|
53
|
+
/**
|
|
54
|
+
* Formats a number in the active locale, or in `tag` when one is given.
|
|
55
|
+
*
|
|
56
|
+
* The same cache and the same locale as `formatDate`, so a counter and the
|
|
57
|
+
* date beside it change language together.
|
|
58
|
+
*
|
|
59
|
+
* @param value - Number to format.
|
|
60
|
+
* @param options - Passed straight to `Intl.NumberFormat`: currency, percent, decimals.
|
|
61
|
+
* @param tag - A BCP 47 tag that overrides the active locale for this call.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* formatNumber(48200, { style: 'currency', currency: 'JPY' }) // '¥48,200'
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function formatNumber(value, options = {}, tag = locale.value) {
|
|
69
|
+
const key = `${tag}:${JSON.stringify(options)}`;
|
|
70
|
+
let formatter = numberCache.get(key);
|
|
71
|
+
if (!formatter) {
|
|
72
|
+
formatter = new Intl.NumberFormat(tag, options);
|
|
73
|
+
numberCache.set(key, formatter);
|
|
74
|
+
}
|
|
75
|
+
return formatter.format(value);
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { formatNumber as n, setFormatLocale as r, formatDate as t };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=format-BEvBK1SJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-BEvBK1SJ.js","names":[],"sources":["../src/utils/format.ts"],"sourcesContent":["import { ref } from 'vue'\n\n/**\n * The locale `Intl` formatting uses.\n *\n * Held here rather than imported from an i18n runtime so the utilities have no\n * i18n dependency at all: an app that never installs vue-i18n still gets dates\n * in the right language. `createI18nRuntime` sets this when it is used.\n */\nconst locale = ref<string>(typeof navigator === 'undefined' ? 'en' : (navigator.language ?? 'en'))\n\n/**\n * Points every formatter at a new locale.\n *\n * @example\n * ```ts\n * setFormatLocale('tr-TR')\n * ```\n */\nexport function setFormatLocale(next: string): void {\n locale.value = next\n}\n\n/**\n * `Intl.DateTimeFormat` is expensive to construct, so instances are cached per\n * locale and option set. The key includes the locale, which is what lets the\n * cache survive a language change instead of returning stale formatters.\n */\nconst cache = new Map<string, Intl.DateTimeFormat>()\n\n/**\n * Formats a date in the active locale.\n *\n * Reading the locale ref here is deliberate: called from a `computed`, the\n * result re-evaluates when the language changes.\n *\n * @param date - Date to format.\n * @param options - Passed straight to `Intl.DateTimeFormat`.\n *\n * @example\n * ```ts\n * formatDate(new Date(), { weekday: 'narrow' }) // 'T'\n * ```\n */\nexport function formatDate(date: Date, options: Intl.DateTimeFormatOptions): string {\n const tag = locale.value\n const key = `${tag}:${JSON.stringify(options)}`\n\n let formatter = cache.get(key)\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(tag, options)\n cache.set(key, formatter)\n }\n\n return formatter.format(date)\n}\n\nconst numberCache = new Map<string, Intl.NumberFormat>()\n\n/**\n * Formats a number in the active locale, or in `tag` when one is given.\n *\n * The same cache and the same locale as `formatDate`, so a counter and the\n * date beside it change language together.\n *\n * @param value - Number to format.\n * @param options - Passed straight to `Intl.NumberFormat`: currency, percent, decimals.\n * @param tag - A BCP 47 tag that overrides the active locale for this call.\n *\n * @example\n * ```ts\n * formatNumber(48200, { style: 'currency', currency: 'JPY' }) // '¥48,200'\n * ```\n */\nexport function formatNumber(\n value: number,\n options: Intl.NumberFormatOptions = {},\n tag: string = locale.value,\n): string {\n const key = `${tag}:${JSON.stringify(options)}`\n\n let formatter = numberCache.get(key)\n if (!formatter) {\n formatter = new Intl.NumberFormat(tag, options)\n numberCache.set(key, formatter)\n }\n\n return formatter.format(value)\n}\n"],"mappings":";;;;;;;;;AASA,IAAM,SAAS,IAAY,OAAO,cAAc,cAAc,OAAQ,UAAU,YAAY,IAAK;;;;;;;;;AAUjG,SAAgB,gBAAgB,MAAoB;CAClD,OAAO,QAAQ;AACjB;;;;;;AAOA,IAAM,wBAAQ,IAAI,IAAiC;;;;;;;;;;;;;;;AAgBnD,SAAgB,WAAW,MAAY,SAA6C;CAClF,MAAM,MAAM,OAAO;CACnB,MAAM,MAAM,GAAG,IAAI,GAAG,KAAK,UAAU,OAAO;CAE5C,IAAI,YAAY,MAAM,IAAI,GAAG;CAC7B,IAAI,CAAC,WAAW;EACd,YAAY,IAAI,KAAK,eAAe,KAAK,OAAO;EAChD,MAAM,IAAI,KAAK,SAAS;CAC1B;CAEA,OAAO,UAAU,OAAO,IAAI;AAC9B;AAEA,IAAM,8BAAc,IAAI,IAA+B;;;;;;;;;;;;;;;;AAiBvD,SAAgB,aACd,OACA,UAAoC,CAAC,GACrC,MAAc,OAAO,OACb;CACR,MAAM,MAAM,GAAG,IAAI,GAAG,KAAK,UAAU,OAAO;CAE5C,IAAI,YAAY,YAAY,IAAI,GAAG;CACnC,IAAI,CAAC,WAAW;EACd,YAAY,IAAI,KAAK,aAAa,KAAK,OAAO;EAC9C,YAAY,IAAI,KAAK,SAAS;CAChC;CAEA,OAAO,UAAU,OAAO,KAAK;AAC/B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
export declare const VERSION: string;
|
|
23
23
|
export { addDays, eachDayOfYear, fromDateKey, lastNDays, leadingBlanks, startOfWeek, toDateKey, todayKey, } from './utils/date';
|
|
24
24
|
export type { WeekStart } from './utils/date';
|
|
25
|
-
export { formatDate, setFormatLocale } from './utils/format';
|
|
25
|
+
export { formatDate, formatNumber, setFormatLocale } from './utils/format';
|
|
26
26
|
export { relativeDayLabel } from './utils/day-label';
|
|
27
27
|
export type { DayLabels } from './utils/day-label';
|
|
28
28
|
export { downloadJson } from './utils/download';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { a as addDays, c as lastNDays, d as toDateKey, f as todayKey, i as needsIosInstall, l as leadingBlanks, n as isApplePortable, o as eachDayOfYear, r as isInstalled, s as fromDateKey, t as SettingsGroup_default, u as startOfWeek } from "./SettingsGroup-BXkajKGl.js";
|
|
2
|
+
import { n as formatNumber, r as setFormatLocale, t as formatDate } from "./format-BEvBK1SJ.js";
|
|
2
3
|
import { _ as toRedirectPath, a as FormField_default, c as useVisualViewport, d as isThemePreference, f as readStoredTheme, g as safeRedirect, h as tapFeedback, i as BaseInput_default, l as useOnline, m as useTheme, n as BaseCheckbox_default, o as BaseAlert_default, p as setThemeStorageKey, r as BaseSheet_default, s as useToast, t as GoogleButton_default, u as applyTheme, v as SHEET_ROOT_ID, y as ensureSheetRoot } from "./GoogleButton-D82EoXSQ.js";
|
|
3
4
|
import { n as registerErrorMapper, r as toAppError, t as AppError } from "./app-error-DF9cijE0.js";
|
|
4
5
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BOaGB7Aw.js";
|
|
@@ -7,57 +8,6 @@ import { Fragment, Teleport, TransitionGroup, computed, createBlock, createComme
|
|
|
7
8
|
import { ArrowDown, ArrowRight, ArrowUp, CheckCircle2, ChevronDown, Info, TriangleAlert, X, XCircle } from "lucide-vue-next";
|
|
8
9
|
import { RouterLink } from "vue-router";
|
|
9
10
|
import { createI18n } from "vue-i18n";
|
|
10
|
-
//#region src/utils/format.ts
|
|
11
|
-
/**
|
|
12
|
-
* The locale `Intl` formatting uses.
|
|
13
|
-
*
|
|
14
|
-
* Held here rather than imported from an i18n runtime so the utilities have no
|
|
15
|
-
* i18n dependency at all: an app that never installs vue-i18n still gets dates
|
|
16
|
-
* in the right language. `createI18nRuntime` sets this when it is used.
|
|
17
|
-
*/
|
|
18
|
-
var locale = ref(typeof navigator === "undefined" ? "en" : navigator.language ?? "en");
|
|
19
|
-
/**
|
|
20
|
-
* Points every formatter at a new locale.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* setFormatLocale('tr-TR')
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
function setFormatLocale(next) {
|
|
28
|
-
locale.value = next;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* `Intl.DateTimeFormat` is expensive to construct, so instances are cached per
|
|
32
|
-
* locale and option set. The key includes the locale, which is what lets the
|
|
33
|
-
* cache survive a language change instead of returning stale formatters.
|
|
34
|
-
*/
|
|
35
|
-
var cache = /* @__PURE__ */ new Map();
|
|
36
|
-
/**
|
|
37
|
-
* Formats a date in the active locale.
|
|
38
|
-
*
|
|
39
|
-
* Reading the locale ref here is deliberate: called from a `computed`, the
|
|
40
|
-
* result re-evaluates when the language changes.
|
|
41
|
-
*
|
|
42
|
-
* @param date - Date to format.
|
|
43
|
-
* @param options - Passed straight to `Intl.DateTimeFormat`.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* formatDate(new Date(), { weekday: 'narrow' }) // 'T'
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
function formatDate(date, options) {
|
|
51
|
-
const tag = locale.value;
|
|
52
|
-
const key = `${tag}:${JSON.stringify(options)}`;
|
|
53
|
-
let formatter = cache.get(key);
|
|
54
|
-
if (!formatter) {
|
|
55
|
-
formatter = new Intl.DateTimeFormat(tag, options);
|
|
56
|
-
cache.set(key, formatter);
|
|
57
|
-
}
|
|
58
|
-
return formatter.format(date);
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
11
|
//#region src/utils/day-label.ts
|
|
62
12
|
/**
|
|
63
13
|
* A short name for a day, relative to today.
|
|
@@ -2106,8 +2056,8 @@ function createI18nRuntime(options) {
|
|
|
2106
2056
|
*
|
|
2107
2057
|
* The fallback keeps `vitest` and `vite dev` honest, where no define runs.
|
|
2108
2058
|
*/
|
|
2109
|
-
var VERSION = "2.
|
|
2059
|
+
var VERSION = "2.3.0";
|
|
2110
2060
|
//#endregion
|
|
2111
|
-
export { AppError, BaseAlert_default as BaseAlert, BaseAvatar_default as BaseAvatar, BaseBadge_default as BaseBadge, BaseButton_default as BaseButton, BaseCard_default as BaseCard, BaseCheckbox_default as BaseCheckbox, BaseCombobox_default as BaseCombobox, BaseInput_default as BaseInput, BaseMenu_default as BaseMenu, BaseRadioGroup_default as BaseRadioGroup, BaseSelect_default as BaseSelect, BaseSheet_default as BaseSheet, BaseSlider_default as BaseSlider, BaseSpinner_default as BaseSpinner, BaseSwitch_default as BaseSwitch, BaseTable_default as BaseTable, BaseTextarea_default as BaseTextarea, EmptyState_default as EmptyState, ErrorBoundary_default as ErrorBoundary, FormField_default as FormField, GoogleButton_default as GoogleButton, LocaleLinks_default as LocaleLinks, MATERIALS, PALETTES, PageContainer_default as PageContainer, PageHeader_default as PageHeader, PriceCard_default as PriceCard, ProgressBar_default as ProgressBar, SHEET_ROOT_ID, SectionHeading_default as SectionHeading, SegmentedControl_default as SegmentedControl, SettingsGroup_default as SettingsGroup, SettingsRow_default as SettingsRow, SkeletonList_default as SkeletonList, StatCard_default as StatCard, TabBar_default as TabBar, ToastHost_default as ToastHost, ToneDot_default as ToneDot, VERSION, addDays, applyMaterial, applyPalette, applyTheme, createI18nRuntime, downloadJson, eachDayOfYear, ensureSheetRoot, formatDate, fromDateKey, isApplePortable, isInstalled, isMaterial, isPaletteName, isThemePreference, lastNDays, leadingBlanks, needsIosInstall, readStoredTheme, registerErrorMapper, relativeDayLabel, safeRedirect, setFormatLocale, setMaterialStorageKey, setPaletteStorageKey, setThemeStorageKey, startOfWeek, tapFeedback, toAppError, toDateKey, toRedirectPath, todayKey, useDebouncedCallback, useDragScroll, useMaterial, useMediaQuery, useOnline, usePalette, useTheme, useToast, useToday, useVisualViewport };
|
|
2061
|
+
export { AppError, BaseAlert_default as BaseAlert, BaseAvatar_default as BaseAvatar, BaseBadge_default as BaseBadge, BaseButton_default as BaseButton, BaseCard_default as BaseCard, BaseCheckbox_default as BaseCheckbox, BaseCombobox_default as BaseCombobox, BaseInput_default as BaseInput, BaseMenu_default as BaseMenu, BaseRadioGroup_default as BaseRadioGroup, BaseSelect_default as BaseSelect, BaseSheet_default as BaseSheet, BaseSlider_default as BaseSlider, BaseSpinner_default as BaseSpinner, BaseSwitch_default as BaseSwitch, BaseTable_default as BaseTable, BaseTextarea_default as BaseTextarea, EmptyState_default as EmptyState, ErrorBoundary_default as ErrorBoundary, FormField_default as FormField, GoogleButton_default as GoogleButton, LocaleLinks_default as LocaleLinks, MATERIALS, PALETTES, PageContainer_default as PageContainer, PageHeader_default as PageHeader, PriceCard_default as PriceCard, ProgressBar_default as ProgressBar, SHEET_ROOT_ID, SectionHeading_default as SectionHeading, SegmentedControl_default as SegmentedControl, SettingsGroup_default as SettingsGroup, SettingsRow_default as SettingsRow, SkeletonList_default as SkeletonList, StatCard_default as StatCard, TabBar_default as TabBar, ToastHost_default as ToastHost, ToneDot_default as ToneDot, VERSION, addDays, applyMaterial, applyPalette, applyTheme, createI18nRuntime, downloadJson, eachDayOfYear, ensureSheetRoot, formatDate, formatNumber, fromDateKey, isApplePortable, isInstalled, isMaterial, isPaletteName, isThemePreference, lastNDays, leadingBlanks, needsIosInstall, readStoredTheme, registerErrorMapper, relativeDayLabel, safeRedirect, setFormatLocale, setMaterialStorageKey, setPaletteStorageKey, setThemeStorageKey, startOfWeek, tapFeedback, toAppError, toDateKey, toRedirectPath, todayKey, useDebouncedCallback, useDragScroll, useMaterial, useMediaQuery, useOnline, usePalette, useTheme, useToast, useToday, useVisualViewport };
|
|
2112
2062
|
|
|
2113
2063
|
//# sourceMappingURL=index.js.map
|