rei-kit 0.3.1 → 0.4.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.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * A message the reader has to take in before carrying on.
3
+ *
4
+ * Roles rather than colours, like everything else here: `info` is neutral,
5
+ * `success` confirms, `warning` is a condition to know about, `danger` is
6
+ * something that went wrong or is about to. A component that took a hex would
7
+ * be a component that ignores the theme, and the theme is the whole reason the
8
+ * kit exists.
9
+ *
10
+ * `assertive` decides how a screen reader treats it: a failed save interrupts,
11
+ * a note about a form field waits its turn. Getting this wrong is invisible on
12
+ * screen and rude in a screen reader, which is why it is a prop and not a
13
+ * guess.
14
+ */
15
+ type __VLS_Props = {
16
+ tone?: 'info' | 'success' | 'warning' | 'danger';
17
+ /** Announce immediately, interrupting. For failures the reader must act on. */
18
+ assertive?: boolean;
19
+ };
20
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
21
+ type __VLS_Slots = {} & {
22
+ mark?: (props: typeof __VLS_1) => any;
23
+ } & {
24
+ title?: (props: typeof __VLS_3) => any;
25
+ } & {
26
+ default?: (props: typeof __VLS_5) => any;
27
+ } & {
28
+ action?: (props: typeof __VLS_7) => any;
29
+ };
30
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
31
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
+ declare const _default: typeof __VLS_export;
33
+ export default _default;
34
+ type __VLS_WithSlots<T, S> = T & {
35
+ new (): {
36
+ $slots: S;
37
+ };
38
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A small standing label: a level, a state, a count.
3
+ *
4
+ * Not a button and never clickable — the moment one of these needs a click it
5
+ * is a chip, which is a different component with focus, a hit area and a way
6
+ * to be removed. Keeping that line drawn is most of the value.
7
+ */
8
+ type __VLS_Props = {
9
+ tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger';
10
+ };
11
+ declare var __VLS_1: {};
12
+ type __VLS_Slots = {} & {
13
+ default?: (props: typeof __VLS_1) => any;
14
+ };
15
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
16
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
19
+ type __VLS_WithSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A surface with a border, and optionally a head and a foot.
3
+ *
4
+ * Every app here had written this div. That is not a crisis on its own — it is
5
+ * four classes — but it is four classes that were slightly different in each,
6
+ * so a card on one screen had a heavier border than a card on the next and
7
+ * nobody could say why.
8
+ *
9
+ * `interactive` is for a card that is a link or a button: it adds the lift and
10
+ * the press, and it is opt-in because a card holding a form should not move
11
+ * when the pointer crosses it.
12
+ */
13
+ type __VLS_Props = {
14
+ interactive?: boolean;
15
+ as?: string;
16
+ };
17
+ declare var __VLS_8: {}, __VLS_10: {}, __VLS_12: {};
18
+ type __VLS_Slots = {} & {
19
+ head?: (props: typeof __VLS_8) => any;
20
+ } & {
21
+ default?: (props: typeof __VLS_10) => any;
22
+ } & {
23
+ foot?: (props: typeof __VLS_12) => any;
24
+ };
25
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
26
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
29
+ type __VLS_WithSlots<T, S> = T & {
30
+ new (): {
31
+ $slots: S;
32
+ };
33
+ };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Keeps one broken screen from taking the whole app down.
3
+ *
4
+ * An error thrown while a component renders unmounts the tree above it, and a
5
+ * single-page app has nothing underneath — the tab goes white and whoever was
6
+ * using it loses what they were in the middle of.
7
+ *
8
+ * What it does *not* do is decide what that looks like. All three apps in this
9
+ * workshop had written this component, and the parts they had in common were
10
+ * the mechanism — catch, report, reset when the route changes — while the
11
+ * parts that differed were the ones that should: an icon, a sentence, a way
12
+ * back. So the fallback is a slot, and the kit stays out of the wording.
13
+ *
14
+ * Only errors thrown while rendering a descendant reach `onErrorCaptured`.
15
+ * Rejected promises and failed queries do not, and should not: those belong to
16
+ * the code that owns the request.
17
+ *
18
+ * @example
19
+ * ```vue
20
+ * <ErrorBoundary :resetKey="route.fullPath" @error="reportError">
21
+ * <template #fallback="{ reset }">
22
+ * <EmptyState :title="t('error.title')">
23
+ * <BaseButton @click="reset">{{ t('error.retry') }}</BaseButton>
24
+ * </EmptyState>
25
+ * </template>
26
+ * <RouterView />
27
+ * </ErrorBoundary>
28
+ * ```
29
+ */
30
+ type __VLS_Props = {
31
+ /**
32
+ * Clears the error whenever it changes — a route path, usually.
33
+ *
34
+ * An error on one screen should not follow somebody to the next one, and
35
+ * without this the boundary stays broken until a full reload.
36
+ */
37
+ resetKey?: string | number | undefined;
38
+ };
39
+ declare function reset(): void;
40
+ declare var __VLS_1: {
41
+ error: {};
42
+ reset: typeof reset;
43
+ }, __VLS_3: {};
44
+ type __VLS_Slots = {} & {
45
+ fallback?: (props: typeof __VLS_1) => any;
46
+ } & {
47
+ default?: (props: typeof __VLS_3) => any;
48
+ };
49
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
50
+ error: (cause: unknown) => any;
51
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
52
+ onError?: (cause: unknown) => any;
53
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
54
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
55
+ declare const _default: typeof __VLS_export;
56
+ export default _default;
57
+ type __VLS_WithSlots<T, S> = T & {
58
+ new (): {
59
+ $slots: S;
60
+ };
61
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * One measure, centred, with the page's gutters.
3
+ *
4
+ * The first thing a desktop app needs and the last thing a kit built for
5
+ * phones thinks to provide — a 430 px shell has no use for a maximum width, so
6
+ * this was missing, and the consuming app wrote `max-w-[1200px] mx-auto px-6`
7
+ * into every layout instead. Written once it costs nothing; written eleven
8
+ * times it is eleven chances for one page to be forty pixels narrower than the
9
+ * rest, which is the kind of thing nobody can name and everybody can see.
10
+ *
11
+ * Two widths rather than one, because a page and a passage are different
12
+ * problems: `wide` is the page, `reading` is a column of prose at the width
13
+ * type wants to be read at.
14
+ */
15
+ type __VLS_Props = {
16
+ /** `wide` for a page, `reading` for prose, `full` to opt out. */
17
+ width?: 'wide' | 'reading' | 'full';
18
+ /** The element to render. `main`, `section` and `article` all belong here. */
19
+ as?: string;
20
+ };
21
+ declare var __VLS_8: {};
22
+ type __VLS_Slots = {} & {
23
+ default?: (props: typeof __VLS_8) => any;
24
+ };
25
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
26
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
29
+ type __VLS_WithSlots<T, S> = T & {
30
+ new (): {
31
+ $slots: S;
32
+ };
33
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * How far through something somebody is.
3
+ *
4
+ * Clamped rather than trusted. A progress bar is always fed a computed number,
5
+ * and computed numbers arrive as 101, as -0, and as NaN when the denominator
6
+ * is zero — which is the ordinary state of a course nobody has started. Any of
7
+ * those renders a bar that runs past its own track, and it is the sort of
8
+ * thing that ships because the happy path was the only one anybody looked at.
9
+ */
10
+ type __VLS_Props = {
11
+ value: number;
12
+ max?: number;
13
+ /** For screen readers. Without it this is a rectangle that means nothing. */
14
+ label?: string | undefined;
15
+ };
16
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Whether a media query matches, kept up to date.
3
+ *
4
+ * Starts false and resolves on mount, which is deliberate: this is the one
5
+ * place a component is tempted to branch on viewport during render, and doing
6
+ * that under prerendering produces HTML built for a screen the server does not
7
+ * have. Hydration then swaps it and the page jumps. False first, correct a
8
+ * frame later, no jump — and a layout that reads badly at `false` is a layout
9
+ * with a mobile-first bug worth knowing about.
10
+ *
11
+ * Guarded for the server for the same reason the rest of the kit is: this
12
+ * package has to be importable in Node, and `matchMedia` does not exist there.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const wide = useMediaQuery('(min-width: 64rem)')
17
+ * ```
18
+ */
19
+ export declare function useMediaQuery(query: string): import('vue').Ref<boolean, boolean>;
package/dist/index.d.ts CHANGED
@@ -8,7 +8,18 @@
8
8
  *
9
9
  * @see https://github.com/ramazandogna/rei-kit
10
10
  */
11
- export declare const VERSION = "0.0.0";
11
+ /**
12
+ * The published version, replaced at build time from `package.json`.
13
+ *
14
+ * It was a literal `'0.0.0'` and nothing ever rewrote it, so every consumer
15
+ * that imported this — and the showcase, which is how it was noticed — was
16
+ * told the kit was at 0.0.0 whatever it actually was. A symbol in a public API
17
+ * that reports something false is worse than one that is missing: nobody
18
+ * checks a value that looks like it works.
19
+ *
20
+ * The fallback keeps `vitest` and `vite dev` honest, where no define runs.
21
+ */
22
+ export declare const VERSION: string;
12
23
  export { addDays, eachDayOfYear, fromDateKey, lastNDays, leadingBlanks, startOfWeek, toDateKey, todayKey, } from './utils/date';
13
24
  export type { WeekStart } from './utils/date';
14
25
  export { formatDate, setFormatLocale } from './utils/format';
@@ -27,13 +38,20 @@ export { useToday } from './composables/use-today';
27
38
  export { useOnline } from './composables/use-online';
28
39
  export { useDebouncedCallback } from './composables/use-debounced-callback';
29
40
  export { useDragScroll } from './composables/use-drag-scroll';
41
+ export { useMediaQuery } from './composables/use-media-query';
30
42
  export { useVisualViewport } from './composables/use-visual-viewport';
31
43
  export type { VisualViewportRect } from './composables/use-visual-viewport';
44
+ export { default as BaseAlert } from './components/BaseAlert.vue';
45
+ export { default as BaseBadge } from './components/BaseBadge.vue';
32
46
  export { default as BaseButton } from './components/BaseButton.vue';
33
47
  export { default as BaseInput } from './components/BaseInput.vue';
34
48
  export { default as BaseSheet } from './components/BaseSheet.vue';
49
+ export { default as BaseCard } from './components/BaseCard.vue';
35
50
  export { default as EmptyState } from './components/EmptyState.vue';
51
+ export { default as ErrorBoundary } from './components/ErrorBoundary.vue';
52
+ export { default as PageContainer } from './components/PageContainer.vue';
36
53
  export { default as PageHeader } from './components/PageHeader.vue';
54
+ export { default as ProgressBar } from './components/ProgressBar.vue';
37
55
  export { default as PriceCard } from './components/PriceCard.vue';
38
56
  export { default as SectionHeading } from './components/SectionHeading.vue';
39
57
  export { default as SegmentedControl } from './components/SegmentedControl.vue';