@mikebrucker/brucks 0.1.1 → 0.1.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/README.md +13 -25
- package/dist/blucks/components/loader.d.ts +1 -1
- package/dist/blucks/components/loader.js +61 -19
- package/dist/blucks/components/loader.js.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/lib/defaultLabels.d.ts +25 -2
- package/dist/ui/lib/defaultLabels.js +19 -2
- package/dist/ui/lib/defaultLabels.js.map +1 -1
- package/dist/ui/lib/labels.d.ts +5 -3
- package/dist/ui/lib/labels.js +20 -18
- package/dist/ui/lib/labels.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -144,35 +144,23 @@ to `@mikebrucker/brucks/ui/x`. `cn` comes from `@mikebrucker/brucks/style`.
|
|
|
144
144
|
|
|
145
145
|
### Labels
|
|
146
146
|
|
|
147
|
-
The components
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
and `menu` names `Drawer`:
|
|
147
|
+
The components' screen reader labels come in English and German.
|
|
148
|
+
`BrucksProvider` from `@mikebrucker/brucks/ui` sets the language (`"en"` or
|
|
149
|
+
`"de"`) for everything inside it, English if left out. In a Next app, render it
|
|
150
|
+
in the `[lang]` layout, so `loading.tsx` gets it too:
|
|
152
151
|
|
|
153
152
|
```tsx
|
|
154
|
-
<BrucksProvider
|
|
155
|
-
labels={{
|
|
156
|
-
close: t(($) => $.ariaLabels.close),
|
|
157
|
-
dialog: t(($) => $.ariaLabels.dialog),
|
|
158
|
-
menu: t(($) => $.ariaLabels.menu),
|
|
159
|
-
dragToReorder: t(($) => $.ariaLabels.drag_to_reorder),
|
|
160
|
-
reorderAnnouncement: (values) => t(($) => $.ariaLabels.reorder_announcement, values),
|
|
161
|
-
notification: t(($) => $.ariaLabels.notification),
|
|
162
|
-
notifications: t(($) => $.ariaLabels.notifications), // keep "{hotkey}" in the text
|
|
163
|
-
dragInstructions: t(($) => $.ariaLabels.drag_instructions),
|
|
164
|
-
scrollToTop: t(($) => $.ariaLabels.scroll_to_top),
|
|
165
|
-
skipToContent: t(($) => $.ariaLabels.skip_to_content),
|
|
166
|
-
}}
|
|
167
|
-
>
|
|
168
|
-
{children}
|
|
169
|
-
</BrucksProvider>
|
|
153
|
+
<BrucksProvider language={lang}>{children}</BrucksProvider>
|
|
170
154
|
```
|
|
171
155
|
|
|
172
|
-
`
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
156
|
+
`labels` replaces single ones (the keys of `BrucksLabels`), for the app's own
|
|
157
|
+
wording or a language brucks doesn't speak; the rest come from `language`. A
|
|
158
|
+
nested provider starts from its own `language`, not from the provider around it.
|
|
159
|
+
The one provider also names `@mikebrucker/brucks/blucks`'s `ScrollToTopFab`
|
|
160
|
+
(`scrollToTop`), `AppLayout`'s skip link (`skipToContent`) and `Loader`'s status
|
|
161
|
+
(`loading`), and `menu` names `Drawer`. `Drawer` and `Modal` take a `title` for
|
|
162
|
+
their screen reader name, in place of the "menu" and "dialog" labels, and
|
|
163
|
+
`Loader` a `label` in place of "loading".
|
|
176
164
|
|
|
177
165
|
### Android back button
|
|
178
166
|
|
|
@@ -7,7 +7,7 @@ type LoaderProps = {
|
|
|
7
7
|
fullScreen?: boolean;
|
|
8
8
|
/** With fullScreen, skip the dimmed backdrop so the page shows through */
|
|
9
9
|
transparentBg?: boolean;
|
|
10
|
-
/** What screen readers announce
|
|
10
|
+
/** What screen readers announce; the `loading` label if left out */
|
|
11
11
|
label?: string;
|
|
12
12
|
/** Makes the wrapper a keyboard-accessible button you can click */
|
|
13
13
|
onClick?: () => void;
|
|
@@ -1,27 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../../style/utils.js";
|
|
3
|
+
import { useBrucksLabels } from "../../ui/lib/labels.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
2
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
6
|
import "./loader.css";
|
|
4
7
|
// src/blucks/components/loader.tsx
|
|
5
|
-
function Loader(
|
|
8
|
+
function Loader(t0) {
|
|
9
|
+
const $ = c(14);
|
|
10
|
+
const { isOpen, className, fullScreen, transparentBg, label, onClick } = t0;
|
|
11
|
+
const labels = useBrucksLabels();
|
|
6
12
|
if (!isOpen) return null;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
const backdropClassName = !transparentBg ? "bg-black/50" : null;
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[0] !== backdropClassName || $[1] !== fullScreen) {
|
|
16
|
+
t1 = fullScreen ? cn("fixed inset-0 z-loader flex items-center justify-center", backdropClassName) : void 0;
|
|
17
|
+
$[0] = backdropClassName;
|
|
18
|
+
$[1] = fullScreen;
|
|
19
|
+
$[2] = t1;
|
|
20
|
+
} else t1 = $[2];
|
|
21
|
+
const wrapperClassName = t1;
|
|
22
|
+
const t2 = `loader ${className ?? ""}`;
|
|
23
|
+
let t3;
|
|
24
|
+
if ($[3] !== t2) {
|
|
25
|
+
t3 = t2.trim();
|
|
26
|
+
$[3] = t2;
|
|
27
|
+
$[4] = t3;
|
|
28
|
+
} else t3 = $[4];
|
|
29
|
+
let t4;
|
|
30
|
+
if ($[5] !== t3) {
|
|
31
|
+
t4 = /* @__PURE__ */ jsx("span", { className: t3 });
|
|
32
|
+
$[5] = t3;
|
|
33
|
+
$[6] = t4;
|
|
34
|
+
} else t4 = $[6];
|
|
35
|
+
const bars = t4;
|
|
36
|
+
const t5 = label ?? labels.loading;
|
|
37
|
+
let t6;
|
|
38
|
+
if ($[7] !== t5) {
|
|
39
|
+
t6 = /* @__PURE__ */ jsx("span", {
|
|
40
|
+
role: "status",
|
|
41
|
+
"aria-live": "polite",
|
|
42
|
+
className: "sr-only",
|
|
43
|
+
children: t5
|
|
44
|
+
});
|
|
45
|
+
$[7] = t5;
|
|
46
|
+
$[8] = t6;
|
|
47
|
+
} else t6 = $[8];
|
|
48
|
+
const status = t6;
|
|
49
|
+
let t7;
|
|
50
|
+
if ($[9] !== bars || $[10] !== onClick || $[11] !== status || $[12] !== wrapperClassName) {
|
|
51
|
+
t7 = onClick ? /* @__PURE__ */ jsxs("button", {
|
|
52
|
+
type: "button",
|
|
53
|
+
onClick,
|
|
54
|
+
className: wrapperClassName,
|
|
55
|
+
children: [bars, status]
|
|
56
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
57
|
+
className: wrapperClassName,
|
|
58
|
+
children: [bars, status]
|
|
59
|
+
});
|
|
60
|
+
$[9] = bars;
|
|
61
|
+
$[10] = onClick;
|
|
62
|
+
$[11] = status;
|
|
63
|
+
$[12] = wrapperClassName;
|
|
64
|
+
$[13] = t7;
|
|
65
|
+
} else t7 = $[13];
|
|
66
|
+
return t7;
|
|
25
67
|
}
|
|
26
68
|
export { Loader };
|
|
27
69
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","names":[],"sources":["../../../src/blucks/components/loader.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"loader.js","names":["c","_c","cn","useBrucksLabels","LoaderProps","isOpen","className","fullScreen","transparentBg","label","onClick","Loader","t0","$","labels","backdropClassName","t1","undefined","wrapperClassName","t2","t3","trim","t4","bars","t5","loading","t6","status","t7","_c"],"sources":["../../../src/blucks/components/loader.tsx"],"sourcesContent":["\"use client\";\n\nimport \"~/blucks/components/loader.css\";\nimport { cn } from \"~/style/utils\";\nimport { useBrucksLabels } from \"~/ui/lib/labels\";\n\ntype LoaderProps = {\n isOpen: boolean;\n /** Tailwind text color utilities, e.g. \"text-cyan-400\" */\n className?: string;\n /** Center the loader over a full-page overlay */\n fullScreen?: boolean;\n /** With fullScreen, skip the dimmed backdrop so the page shows through */\n transparentBg?: boolean;\n /** What screen readers announce; the `loading` label if left out */\n label?: string;\n /** Makes the wrapper a keyboard-accessible button you can click */\n onClick?: () => void;\n};\n\nfunction Loader({ isOpen, className, fullScreen, transparentBg, label, onClick }: LoaderProps) {\n const labels = useBrucksLabels();\n if (!isOpen) return null;\n\n const backdropClassName = !transparentBg ? \"bg-black/50\" : null;\n const wrapperClassName = fullScreen\n ? cn(\"fixed inset-0 z-loader flex items-center justify-center\", backdropClassName)\n : undefined;\n\n const bars = <span className={`loader ${className ?? \"\"}`.trim()} />;\n\n const status = (\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {label ?? labels.loading}\n </span>\n );\n\n return onClick ? (\n <button type=\"button\" onClick={onClick} className={wrapperClassName}>\n {bars}\n {status}\n </button>\n ) : (\n <div className={wrapperClassName}>\n {bars}\n {status}\n </div>\n );\n}\n\nexport { Loader };\n"],"mappings":";;;;;;;AAoBA,SAAAW,OAAAC,IAAA;CAAA,MAAAC,IAAAZ,EAAA,EAAA;CAAgB,MAAA,EAAAI,QAAAC,WAAAC,YAAAC,eAAAC,OAAAC,YAAAE;CACd,MAAAE,SAAeX,gBAAgB;CAC/B,IAAI,CAACE,QAAM,OAAS;CAEpB,MAAAU,oBAA0B,CAACP,gBAAD,gBAAA;CAAsC,IAAAQ;CAAA,IAAAH,EAAA,OAAAE,qBAAAF,EAAA,OAAAN,YAAA;EACvCS,KAAAT,aACrBL,GAAG,2DAA2Da,iBACtD,IAFaE,KAAAA;EAEZJ,EAAA,KAAAE;EAAAF,EAAA,KAAAN;EAAAM,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAFb,MAAAK,mBAAyBF;CAIK,MAAAG,KAAA,UAAUb,aAAA;CAAiB,IAAAc;CAAA,IAAAP,EAAA,OAAAM,IAAA;EAA3BC,KAAAD,GAA2BE,KAAM;EAACR,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,OAAAO,IAAA;EAAnDE,KAAA,oBAAA,QAAA,EAAiB,WAAAF,GAAkC,CAAA;EAAIP,EAAA,KAAAO;EAAAP,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAApE,MAAAU,OAAaD;CAIR,MAAAE,KAAAf,SAASK,OAAMW;CAAQ,IAAAC;CAAA,IAAAb,EAAA,OAAAW,IAAA;EAD1BE,KAAA,oBAAA,QAAA;GAAW,MAAA;GAAmB,aAAA;GAAmB,WAAA;GAC9CF,UAAAA;EACI,CAAA;EAAAX,EAAA,KAAAW;EAAAX,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAHT,MAAAc,SACED;CAGA,IAAAE;CAAA,IAAAf,EAAA,OAAAU,QAAAV,EAAA,QAAAH,WAAAG,EAAA,QAAAc,UAAAd,EAAA,QAAAK,kBAAA;EAEKU,KAAAlB,UACL,qBAAA,UAAA;GAAa,MAAA;GAAkBA;GAAoBQ,WAAAA;GAAnD,UAAA,CACGK,MACAI,MACM;EAET,CAAA,IAAA,qBAAA,OAAA;GAAgBT,WAAAA;GAAhB,UAAA,CACGK,MACAI,MACG;;EACPd,EAAA,KAAAU;EAAAV,EAAA,MAAAH;EAAAG,EAAA,MAAAc;EAAAd,EAAA,MAAAK;EAAAL,EAAA,MAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAA,OAVMe;AAUN"}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -28,5 +28,5 @@ export { Toggle, toggleVariants } from "./components/toggle";
|
|
|
28
28
|
export { ToggleGroup, ToggleGroupItem } from "./components/toggle-group";
|
|
29
29
|
export { Tooltip } from "./components/tooltip";
|
|
30
30
|
export { closeTopmost, useCloseOnBack } from "./hooks/useCloseOnBack";
|
|
31
|
-
export { type BrucksLabels, defaultLabels } from "./lib/defaultLabels";
|
|
31
|
+
export { type BrucksLabels, type BrucksLanguage, defaultLabels } from "./lib/defaultLabels";
|
|
32
32
|
export { BrucksProvider, useBrucksLabels } from "./lib/labels";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The words the components speak for themselves - screen reader names and
|
|
3
|
-
* announcements.
|
|
4
|
-
*
|
|
3
|
+
* announcements. brucks ships them in English and German: `BrucksProvider` picks
|
|
4
|
+
* the language, and its `labels` replace single ones.
|
|
5
5
|
*
|
|
6
6
|
* Kept out of the "use client" provider module, so a Server Component reading the
|
|
7
7
|
* defaults gets the object rather than a client reference.
|
|
@@ -27,5 +27,28 @@ export type BrucksLabels = {
|
|
|
27
27
|
scrollToTop: string;
|
|
28
28
|
/** AppLayout's skip link to `main`. */
|
|
29
29
|
skipToContent: string;
|
|
30
|
+
/** Loader's status, unless it gets a `label`. */
|
|
31
|
+
loading: string;
|
|
30
32
|
};
|
|
31
33
|
export declare const defaultLabels: BrucksLabels;
|
|
34
|
+
export declare const translations: {
|
|
35
|
+
en: BrucksLabels;
|
|
36
|
+
de: {
|
|
37
|
+
close: string;
|
|
38
|
+
dialog: string;
|
|
39
|
+
menu: string;
|
|
40
|
+
dragToReorder: string;
|
|
41
|
+
reorderAnnouncement: ({ item, position, total }: {
|
|
42
|
+
item: string;
|
|
43
|
+
position: number;
|
|
44
|
+
total: number;
|
|
45
|
+
}) => string;
|
|
46
|
+
notification: string;
|
|
47
|
+
notifications: string;
|
|
48
|
+
dragInstructions: string;
|
|
49
|
+
scrollToTop: string;
|
|
50
|
+
skipToContent: string;
|
|
51
|
+
loading: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type BrucksLanguage = keyof typeof translations;
|
|
@@ -9,8 +9,25 @@ var defaultLabels = {
|
|
|
9
9
|
notifications: "Notifications ({hotkey})",
|
|
10
10
|
dragInstructions: "To pick up an item, press Space or Enter. Move it with the arrow keys, press Space or Enter again to drop it, or Escape to cancel.",
|
|
11
11
|
scrollToTop: "Scroll back to top",
|
|
12
|
-
skipToContent: "Skip to content"
|
|
12
|
+
skipToContent: "Skip to content",
|
|
13
|
+
loading: "Loading"
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
var translations = {
|
|
16
|
+
en: defaultLabels,
|
|
17
|
+
de: {
|
|
18
|
+
close: "Schließen",
|
|
19
|
+
dialog: "Dialog",
|
|
20
|
+
menu: "Menü",
|
|
21
|
+
dragToReorder: "Zum Umsortieren ziehen",
|
|
22
|
+
reorderAnnouncement: ({ item, position, total }) => `${item} auf Position ${position} von ${total} verschoben`,
|
|
23
|
+
notification: "Benachrichtigung",
|
|
24
|
+
notifications: "Benachrichtigungen ({hotkey})",
|
|
25
|
+
dragInstructions: "Drück die Leertaste oder Enter, um ein Element anzuheben. Beweg es mit den Pfeiltasten und drück die Leertaste oder Enter erneut, um es abzulegen, oder Escape, um abzubrechen.",
|
|
26
|
+
scrollToTop: "Zurück nach oben scrollen",
|
|
27
|
+
skipToContent: "Zum Inhalt springen",
|
|
28
|
+
loading: "Wird geladen"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export { defaultLabels, translations };
|
|
15
32
|
|
|
16
33
|
//# sourceMappingURL=defaultLabels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultLabels.js","names":[],"sources":["../../../src/ui/lib/defaultLabels.ts"],"sourcesContent":["/**\n * The words the components speak for themselves - screen reader names and\n * announcements.
|
|
1
|
+
{"version":3,"file":"defaultLabels.js","names":[],"sources":["../../../src/ui/lib/defaultLabels.ts"],"sourcesContent":["/**\n * The words the components speak for themselves - screen reader names and\n * announcements. brucks ships them in English and German: `BrucksProvider` picks\n * the language, and its `labels` replace single ones.\n *\n * Kept out of the \"use client\" provider module, so a Server Component reading the\n * defaults gets the object rather than a client reference.\n */\nexport type BrucksLabels = {\n close: string;\n dialog: string;\n /** Names the Drawer, and Header's action button. */\n menu: string;\n dragToReorder: string;\n reorderAnnouncement: (values: { item: string; position: number; total: number }) => string;\n /** Spoken before a toast's text. */\n notification: string;\n /** Names the toast region; Radix replaces `{hotkey}` with the key that focuses it. */\n notifications: string;\n /** How to sort with the keyboard, read when a drag handle is focused. */\n dragInstructions: string;\n /** Names ScrollToTopFab. */\n scrollToTop: string;\n /** AppLayout's skip link to `main`. */\n skipToContent: string;\n /** Loader's status, unless it gets a `label`. */\n loading: string;\n};\n\nexport const defaultLabels: BrucksLabels = {\n close: \"Close\",\n dialog: \"Dialog\",\n menu: \"Menu\",\n dragToReorder: \"Drag to reorder\",\n reorderAnnouncement: ({ item, position, total }) =>\n `${item} moved to position ${position} of ${total}`,\n notification: \"Notification\",\n notifications: \"Notifications ({hotkey})\",\n dragInstructions:\n \"To pick up an item, press Space or Enter. Move it with the arrow keys, press Space or Enter again to drop it, or Escape to cancel.\",\n scrollToTop: \"Scroll back to top\",\n skipToContent: \"Skip to content\",\n loading: \"Loading\",\n};\n\nexport const translations = {\n en: defaultLabels,\n de: {\n close: \"Schließen\",\n dialog: \"Dialog\",\n menu: \"Menü\",\n dragToReorder: \"Zum Umsortieren ziehen\",\n reorderAnnouncement: ({ item, position, total }) =>\n `${item} auf Position ${position} von ${total} verschoben`,\n notification: \"Benachrichtigung\",\n notifications: \"Benachrichtigungen ({hotkey})\",\n dragInstructions:\n \"Drück die Leertaste oder Enter, um ein Element anzuheben. Beweg es mit den Pfeiltasten und drück die Leertaste oder Enter erneut, um es abzulegen, oder Escape, um abzubrechen.\",\n scrollToTop: \"Zurück nach oben scrollen\",\n skipToContent: \"Zum Inhalt springen\",\n loading: \"Wird geladen\",\n },\n} satisfies Record<string, BrucksLabels>;\n\nexport type BrucksLanguage = keyof typeof translations;\n"],"mappings":";AA6BA,IAAa,gBAA8B;CACzC,OAAO;CACP,QAAQ;CACR,MAAM;CACN,eAAe;CACf,sBAAsB,EAAE,MAAM,UAAU,YACtC,GAAG,KAAK,qBAAqB,SAAS,MAAM;CAC9C,cAAc;CACd,eAAe;CACf,kBACE;CACF,aAAa;CACb,eAAe;CACf,SAAS;AACX;AAEA,IAAa,eAAe;CAC1B,IAAI;CACJ,IAAI;EACF,OAAO;EACP,QAAQ;EACR,MAAM;EACN,eAAe;EACf,sBAAsB,EAAE,MAAM,UAAU,YACtC,GAAG,KAAK,gBAAgB,SAAS,OAAO,MAAM;EAChD,cAAc;EACd,eAAe;EACf,kBACE;EACF,aAAa;EACb,eAAe;EACf,SAAS;CACX;AACF"}
|
package/dist/ui/lib/labels.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type BrucksLabels } from "./defaultLabels";
|
|
2
|
+
import { type BrucksLabels, type BrucksLanguage } from "./defaultLabels";
|
|
3
3
|
type BrucksProviderProps = {
|
|
4
|
-
/**
|
|
4
|
+
/** The language of brucks's own labels; English if left out. */
|
|
5
|
+
language?: BrucksLanguage;
|
|
6
|
+
/** Any label left out comes from `language`. */
|
|
5
7
|
labels?: Partial<BrucksLabels>;
|
|
6
8
|
children: ReactNode;
|
|
7
9
|
};
|
|
8
|
-
export declare function BrucksProvider({ labels, children }: BrucksProviderProps): import("react").JSX.Element;
|
|
10
|
+
export declare function BrucksProvider({ language, labels, children }: BrucksProviderProps): import("react").JSX.Element;
|
|
9
11
|
export declare function useBrucksLabels(): BrucksLabels;
|
|
10
12
|
export {};
|
package/dist/ui/lib/labels.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { defaultLabels } from "./defaultLabels.js";
|
|
2
|
+
import { defaultLabels, translations } from "./defaultLabels.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { createContext, useContext } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
// src/ui/lib/labels.tsx
|
|
7
7
|
var LabelsContext = createContext(defaultLabels);
|
|
8
8
|
function BrucksProvider(t0) {
|
|
9
|
-
const $ = c(
|
|
10
|
-
const { labels, children } = t0;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const $ = c(6);
|
|
10
|
+
const { language: t1, labels, children } = t0;
|
|
11
|
+
const t2 = translations[t1 === void 0 ? "en" : t1];
|
|
12
|
+
let t3;
|
|
13
|
+
if ($[0] !== labels || $[1] !== t2) {
|
|
14
|
+
t3 = {
|
|
15
|
+
...t2,
|
|
15
16
|
...labels
|
|
16
17
|
};
|
|
17
18
|
$[0] = labels;
|
|
18
|
-
$[1] =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
$[1] = t2;
|
|
20
|
+
$[2] = t3;
|
|
21
|
+
} else t3 = $[2];
|
|
22
|
+
let t4;
|
|
23
|
+
if ($[3] !== children || $[4] !== t3) {
|
|
24
|
+
t4 = /* @__PURE__ */ jsx(LabelsContext.Provider, {
|
|
25
|
+
value: t3,
|
|
24
26
|
children
|
|
25
27
|
});
|
|
26
|
-
$[
|
|
27
|
-
$[
|
|
28
|
-
$[
|
|
29
|
-
} else
|
|
30
|
-
return
|
|
28
|
+
$[3] = children;
|
|
29
|
+
$[4] = t3;
|
|
30
|
+
$[5] = t4;
|
|
31
|
+
} else t4 = $[5];
|
|
32
|
+
return t4;
|
|
31
33
|
}
|
|
32
34
|
function useBrucksLabels() {
|
|
33
35
|
return useContext(LabelsContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","names":["c","_c","createContext","ReactNode","useContext","BrucksLabels","defaultLabels","LabelsContext","BrucksProviderProps","labels","Partial","children","BrucksProvider","t0","$","t1","t2","useBrucksLabels","_c"],"sources":["../../../src/ui/lib/labels.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, type ReactNode, useContext } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"labels.js","names":["c","_c","createContext","ReactNode","useContext","BrucksLabels","BrucksLanguage","defaultLabels","translations","LabelsContext","BrucksProviderProps","language","labels","Partial","children","BrucksProvider","t0","$","t1","undefined","t2","t3","t4","useBrucksLabels","_c"],"sources":["../../../src/ui/lib/labels.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, type ReactNode, useContext } from \"react\";\nimport {\n type BrucksLabels,\n type BrucksLanguage,\n defaultLabels,\n translations,\n} from \"~/ui/lib/defaultLabels\";\n\nconst LabelsContext = createContext<BrucksLabels>(defaultLabels);\n\ntype BrucksProviderProps = {\n /** The language of brucks's own labels; English if left out. */\n language?: BrucksLanguage;\n /** Any label left out comes from `language`. */\n labels?: Partial<BrucksLabels>;\n children: ReactNode;\n};\n\nexport function BrucksProvider({ language = \"en\", labels, children }: BrucksProviderProps) {\n return (\n <LabelsContext.Provider value={{ ...translations[language], ...labels }}>\n {children}\n </LabelsContext.Provider>\n );\n}\n\nexport function useBrucksLabels() {\n return useContext(LabelsContext);\n}\n"],"mappings":";;;;;;AAUA,IAAMS,gBAAgBP,cAA4BK,aAAa;AAU/D,SAAOQ,eAAAC,IAAA;CAAA,MAAAC,IAAAhB,EAAA,CAAA;CAAwB,MAAA,EAAAU,UAAAO,IAAAN,QAAAE,aAAAE;CAES,MAAAI,KAAAZ,aAFPU,OAAAC,KAAAA,IAAA,OAAAD;CAE6B,IAAAG;CAAA,IAAAJ,EAAA,OAAAL,UAAAK,EAAA,OAAAG,IAAA;EAA3BC,KAAA;GAAA,GAAKD;GAAsB,GAAKR;EAAO;EAACK,EAAA,KAAAL;EAAAK,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAH,YAAAG,EAAA,OAAAI,IAAA;EAAvEC,KAAA,oBAAA,cAAA,UAAA;GAA+B,OAAAD;GAC5BP;EACH,CAAA;EAAyBG,EAAA,KAAAH;EAAAG,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFzBK;AAEyB;AAI7B,SAAOC,kBAAA;CAAA,OACEnB,WAAWK,aAAa;AAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikebrucker/brucks",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "builds `brucks`'s Brucks with blucks and brui bromponents;",
|
|
5
5
|
"homepage": "https://github.com/mikebrucker/brucks",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|