@mikebrucker/brucks 0.0.0-stage → 0.1.1

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.
Files changed (162) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +278 -2
  3. package/dist/blucks/components/homeCard.d.ts +27 -0
  4. package/dist/blucks/components/homeCard.js +53 -0
  5. package/dist/blucks/components/homeCard.js.map +1 -0
  6. package/dist/blucks/components/loader.css +169 -0
  7. package/dist/blucks/components/loader.d.ts +16 -0
  8. package/dist/blucks/components/loader.js +28 -0
  9. package/dist/blucks/components/loader.js.map +1 -0
  10. package/dist/blucks/components/scrollToTopFab.css +9 -0
  11. package/dist/blucks/components/scrollToTopFab.d.ts +17 -0
  12. package/dist/blucks/components/scrollToTopFab.js +188 -0
  13. package/dist/blucks/components/scrollToTopFab.js.map +1 -0
  14. package/dist/blucks/components/settingsPickerModal.d.ts +11 -0
  15. package/dist/blucks/components/settingsPickerModal.js +49 -0
  16. package/dist/blucks/components/settingsPickerModal.js.map +1 -0
  17. package/dist/blucks/components/settingsRow.d.ts +12 -0
  18. package/dist/blucks/components/settingsRow.js +34 -0
  19. package/dist/blucks/components/settingsRow.js.map +1 -0
  20. package/dist/blucks/components/settingsSection.d.ts +8 -0
  21. package/dist/blucks/components/settingsSection.js +19 -0
  22. package/dist/blucks/components/settingsSection.js.map +1 -0
  23. package/dist/blucks/components/settingsSwatchButton.d.ts +10 -0
  24. package/dist/blucks/components/settingsSwatchButton.js +38 -0
  25. package/dist/blucks/components/settingsSwatchButton.js.map +1 -0
  26. package/dist/blucks/hooks/useDisclosure.d.ts +5 -0
  27. package/dist/blucks/hooks/useDisclosure.js +34 -0
  28. package/dist/blucks/hooks/useDisclosure.js.map +1 -0
  29. package/dist/blucks/hooks/useScrollAncestor.d.ts +3 -0
  30. package/dist/blucks/hooks/useScrollAncestor.js +40 -0
  31. package/dist/blucks/hooks/useScrollAncestor.js.map +1 -0
  32. package/dist/blucks/index.d.ts +13 -0
  33. package/dist/blucks/index.js +14 -0
  34. package/dist/blucks/layout/appLayout.d.ts +16 -0
  35. package/dist/blucks/layout/appLayout.js +93 -0
  36. package/dist/blucks/layout/appLayout.js.map +1 -0
  37. package/dist/blucks/layout/footer.d.ts +7 -0
  38. package/dist/blucks/layout/footer.js +18 -0
  39. package/dist/blucks/layout/footer.js.map +1 -0
  40. package/dist/blucks/layout/header.d.ts +22 -0
  41. package/dist/blucks/layout/header.js +121 -0
  42. package/dist/blucks/layout/header.js.map +1 -0
  43. package/dist/blucks/lib/utils.d.ts +6 -0
  44. package/dist/blucks/lib/utils.js +12 -0
  45. package/dist/blucks/lib/utils.js.map +1 -0
  46. package/dist/style/index.d.ts +4 -0
  47. package/dist/style/index.js +5 -0
  48. package/dist/style/settings.d.ts +105 -0
  49. package/dist/style/settings.js +156 -0
  50. package/dist/style/settings.js.map +1 -0
  51. package/dist/style/styles.d.ts +6 -0
  52. package/dist/style/styles.js +10 -0
  53. package/dist/style/styles.js.map +1 -0
  54. package/dist/style/theme.css +1259 -0
  55. package/dist/style/types.d.ts +6 -0
  56. package/dist/style/types.js +9 -0
  57. package/dist/style/types.js.map +1 -0
  58. package/dist/style/utils.d.ts +2 -0
  59. package/dist/style/utils.js +28 -0
  60. package/dist/style/utils.js.map +1 -0
  61. package/dist/ui/components/accordion.d.ts +81 -0
  62. package/dist/ui/components/accordion.js +449 -0
  63. package/dist/ui/components/accordion.js.map +1 -0
  64. package/dist/ui/components/alertDialog.d.ts +17 -0
  65. package/dist/ui/components/alertDialog.js +134 -0
  66. package/dist/ui/components/alertDialog.js.map +1 -0
  67. package/dist/ui/components/button.d.ts +10 -0
  68. package/dist/ui/components/button.js +51 -0
  69. package/dist/ui/components/button.js.map +1 -0
  70. package/dist/ui/components/checkbox.d.ts +3 -0
  71. package/dist/ui/components/checkbox.js +56 -0
  72. package/dist/ui/components/checkbox.js.map +1 -0
  73. package/dist/ui/components/chip.d.ts +13 -0
  74. package/dist/ui/components/chip.js +26 -0
  75. package/dist/ui/components/chip.js.map +1 -0
  76. package/dist/ui/components/collapsible.d.ts +22 -0
  77. package/dist/ui/components/collapsible.js +197 -0
  78. package/dist/ui/components/collapsible.js.map +1 -0
  79. package/dist/ui/components/drawer.d.ts +13 -0
  80. package/dist/ui/components/drawer.js +81 -0
  81. package/dist/ui/components/drawer.js.map +1 -0
  82. package/dist/ui/components/fab.d.ts +12 -0
  83. package/dist/ui/components/fab.js +51 -0
  84. package/dist/ui/components/fab.js.map +1 -0
  85. package/dist/ui/components/form.d.ts +7 -0
  86. package/dist/ui/components/form.js +107 -0
  87. package/dist/ui/components/form.js.map +1 -0
  88. package/dist/ui/components/icon.d.ts +9 -0
  89. package/dist/ui/components/icon.js +28 -0
  90. package/dist/ui/components/icon.js.map +1 -0
  91. package/dist/ui/components/input.d.ts +12 -0
  92. package/dist/ui/components/input.js +44 -0
  93. package/dist/ui/components/input.js.map +1 -0
  94. package/dist/ui/components/modal.d.ts +19 -0
  95. package/dist/ui/components/modal.js +144 -0
  96. package/dist/ui/components/modal.js.map +1 -0
  97. package/dist/ui/components/note.d.ts +6 -0
  98. package/dist/ui/components/note.js +12 -0
  99. package/dist/ui/components/note.js.map +1 -0
  100. package/dist/ui/components/popover.d.ts +15 -0
  101. package/dist/ui/components/popover.js +110 -0
  102. package/dist/ui/components/popover.js.map +1 -0
  103. package/dist/ui/components/progress.d.ts +11 -0
  104. package/dist/ui/components/progress.js +87 -0
  105. package/dist/ui/components/progress.js.map +1 -0
  106. package/dist/ui/components/radioGroup.d.ts +4 -0
  107. package/dist/ui/components/radioGroup.js +82 -0
  108. package/dist/ui/components/radioGroup.js.map +1 -0
  109. package/dist/ui/components/scrollArea.d.ts +29 -0
  110. package/dist/ui/components/scrollArea.js +185 -0
  111. package/dist/ui/components/scrollArea.js.map +1 -0
  112. package/dist/ui/components/select.d.ts +23 -0
  113. package/dist/ui/components/select.js +198 -0
  114. package/dist/ui/components/select.js.map +1 -0
  115. package/dist/ui/components/separator.d.ts +4 -0
  116. package/dist/ui/components/separator.js +48 -0
  117. package/dist/ui/components/separator.js.map +1 -0
  118. package/dist/ui/components/slider.d.ts +26 -0
  119. package/dist/ui/components/slider.js +228 -0
  120. package/dist/ui/components/slider.js.map +1 -0
  121. package/dist/ui/components/sortableList.d.ts +13 -0
  122. package/dist/ui/components/sortableList.js +116 -0
  123. package/dist/ui/components/sortableList.js.map +1 -0
  124. package/dist/ui/components/sortableListRow.d.ts +8 -0
  125. package/dist/ui/components/sortableListRow.js +79 -0
  126. package/dist/ui/components/sortableListRow.js.map +1 -0
  127. package/dist/ui/components/switch.d.ts +3 -0
  128. package/dist/ui/components/switch.js +47 -0
  129. package/dist/ui/components/switch.js.map +1 -0
  130. package/dist/ui/components/tabs.d.ts +7 -0
  131. package/dist/ui/components/tabs.js +106 -0
  132. package/dist/ui/components/tabs.js.map +1 -0
  133. package/dist/ui/components/textarea.d.ts +8 -0
  134. package/dist/ui/components/textarea.js +40 -0
  135. package/dist/ui/components/textarea.js.map +1 -0
  136. package/dist/ui/components/toast.d.ts +13 -0
  137. package/dist/ui/components/toast.js +136 -0
  138. package/dist/ui/components/toast.js.map +1 -0
  139. package/dist/ui/components/toggle-group.d.ts +11 -0
  140. package/dist/ui/components/toggle-group.js +158 -0
  141. package/dist/ui/components/toggle-group.js.map +1 -0
  142. package/dist/ui/components/toggle.d.ts +12 -0
  143. package/dist/ui/components/toggle.js +48 -0
  144. package/dist/ui/components/toggle.js.map +1 -0
  145. package/dist/ui/components/tooltip.d.ts +8 -0
  146. package/dist/ui/components/tooltip.js +59 -0
  147. package/dist/ui/components/tooltip.js.map +1 -0
  148. package/dist/ui/hooks/useCloseOnBack.d.ts +7 -0
  149. package/dist/ui/hooks/useCloseOnBack.js +46 -0
  150. package/dist/ui/hooks/useCloseOnBack.js.map +1 -0
  151. package/dist/ui/hooks/useReturnFocus.d.ts +9 -0
  152. package/dist/ui/hooks/useReturnFocus.js +30 -0
  153. package/dist/ui/hooks/useReturnFocus.js.map +1 -0
  154. package/dist/ui/index.d.ts +32 -0
  155. package/dist/ui/index.js +33 -0
  156. package/dist/ui/lib/defaultLabels.d.ts +31 -0
  157. package/dist/ui/lib/defaultLabels.js +16 -0
  158. package/dist/ui/lib/defaultLabels.js.map +1 -0
  159. package/dist/ui/lib/labels.d.ts +10 -0
  160. package/dist/ui/lib/labels.js +37 -0
  161. package/dist/ui/lib/labels.js.map +1 -0
  162. package/package.json +80 -4
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import { cn } from "../../style/utils.js";
3
+ import { Sides } from "../../style/types.js";
4
+ import { useBrucksLabels } from "../../ui/lib/labels.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/blucks/layout/appLayout.tsx
8
+ /** The page frame, with `main` as the one scroller. The app's menu and other overlays render beside it. */
9
+ function AppLayout(t0) {
10
+ const $ = c(20);
11
+ const { children, header, footer, contentClassName, sidebar, sidebarSide: t1 } = t0;
12
+ const sidebarSide = t1 === void 0 ? Sides.right : t1;
13
+ const labels = useBrucksLabels();
14
+ let t2;
15
+ if ($[0] !== labels.skipToContent) {
16
+ t2 = /* @__PURE__ */ jsx("a", {
17
+ href: "#main",
18
+ className: "sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-skip-link focus:rounded-secondary focus:border focus:border-border focus:bg-card focus:px-3 focus:py-2 focus:text-foreground",
19
+ children: labels.skipToContent
20
+ });
21
+ $[0] = labels.skipToContent;
22
+ $[1] = t2;
23
+ } else t2 = $[1];
24
+ const t3 = header ? "[--inset-top:var(--rounded-primary)]" : "[--inset-top:0px]";
25
+ const t4 = footer ? "[--inset-bottom:var(--rounded-primary)]" : "[--inset-bottom:0px]";
26
+ let t5;
27
+ if ($[2] !== t3 || $[3] !== t4) {
28
+ t5 = cn("flex grow min-h-0 w-full transition-all -mt-(--inset-top) -mb-(--inset-bottom)", t3, t4);
29
+ $[2] = t3;
30
+ $[3] = t4;
31
+ $[4] = t5;
32
+ } else t5 = $[4];
33
+ const t6 = sidebarSide === Sides.left ? sidebar : null;
34
+ let t7;
35
+ if ($[5] !== contentClassName) {
36
+ t7 = cn("flex flex-col grow gap-4 max-w-5xl w-full pt-[calc(1rem+var(--inset-top))] pb-[calc(1rem+var(--inset-bottom))]", contentClassName);
37
+ $[5] = contentClassName;
38
+ $[6] = t7;
39
+ } else t7 = $[6];
40
+ let t8;
41
+ if ($[7] !== children || $[8] !== t7) {
42
+ t8 = /* @__PURE__ */ jsx("main", {
43
+ id: "main",
44
+ tabIndex: -1,
45
+ className: "flex flex-col items-center grow min-w-0 overflow-y-auto",
46
+ children: /* @__PURE__ */ jsx("div", {
47
+ className: t7,
48
+ children
49
+ })
50
+ });
51
+ $[7] = children;
52
+ $[8] = t7;
53
+ $[9] = t8;
54
+ } else t8 = $[9];
55
+ const t9 = sidebarSide === Sides.right ? sidebar : null;
56
+ let t10;
57
+ if ($[10] !== t5 || $[11] !== t6 || $[12] !== t8 || $[13] !== t9) {
58
+ t10 = /* @__PURE__ */ jsxs("div", {
59
+ className: t5,
60
+ children: [
61
+ t6,
62
+ t8,
63
+ t9
64
+ ]
65
+ });
66
+ $[10] = t5;
67
+ $[11] = t6;
68
+ $[12] = t8;
69
+ $[13] = t9;
70
+ $[14] = t10;
71
+ } else t10 = $[14];
72
+ let t11;
73
+ if ($[15] !== footer || $[16] !== header || $[17] !== t10 || $[18] !== t2) {
74
+ t11 = /* @__PURE__ */ jsxs("div", {
75
+ className: "flex flex-col h-dvh items-center font-sans safe-area-y",
76
+ children: [
77
+ t2,
78
+ header,
79
+ t10,
80
+ footer
81
+ ]
82
+ });
83
+ $[15] = footer;
84
+ $[16] = header;
85
+ $[17] = t10;
86
+ $[18] = t2;
87
+ $[19] = t11;
88
+ } else t11 = $[19];
89
+ return t11;
90
+ }
91
+ export { AppLayout };
92
+
93
+ //# sourceMappingURL=appLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appLayout.js","names":["c","_c","ReactNode","Side","Sides","cn","useBrucksLabels","AppLayoutProps","children","header","footer","contentClassName","sidebar","sidebarSide","AppLayout","t0","$","t1","undefined","right","labels","t2","skipToContent","t3","t4","t5","t6","left","t7","t8","t9","t10","t11","_c"],"sources":["../../../src/blucks/layout/appLayout.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { type Side, Sides } from \"~/style/types\";\nimport { cn } from \"~/style/utils\";\nimport { useBrucksLabels } from \"~/ui/lib/labels\";\n\ninterface AppLayoutProps {\n children: ReactNode;\n /** A sticky Header. `main` starts under its rounded corners, so the page scrolls on behind them. */\n header?: ReactNode;\n /** Below `main`, e.g. a sticky Footer. */\n footer?: ReactNode;\n /** The page's column in `main`, e.g. its side padding. */\n contentClassName?: string;\n sidebar?: ReactNode;\n sidebarSide?: Side;\n}\n\n/** The page frame, with `main` as the one scroller. The app's menu and other overlays render beside it. */\nfunction AppLayout({\n children,\n header,\n footer,\n contentClassName,\n sidebar,\n sidebarSide = Sides.right,\n}: AppLayoutProps) {\n const labels = useBrucksLabels();\n\n return (\n <div className=\"flex flex-col h-dvh items-center font-sans safe-area-y\">\n <a\n href=\"#main\"\n className=\"sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-skip-link focus:rounded-secondary focus:border focus:border-border focus:bg-card focus:px-3 focus:py-2 focus:text-foreground\"\n >\n {labels.skipToContent}\n </a>\n {header}\n <div\n className={cn(\n \"flex grow min-h-0 w-full transition-all -mt-(--inset-top) -mb-(--inset-bottom)\",\n header ? \"[--inset-top:var(--rounded-primary)]\" : \"[--inset-top:0px]\",\n footer ? \"[--inset-bottom:var(--rounded-primary)]\" : \"[--inset-bottom:0px]\",\n )}\n >\n {sidebarSide === Sides.left ? sidebar : null}\n <main\n id=\"main\"\n tabIndex={-1}\n className=\"flex flex-col items-center grow min-w-0 overflow-y-auto\"\n >\n <div\n className={cn(\n \"flex flex-col grow gap-4 max-w-5xl w-full pt-[calc(1rem+var(--inset-top))] pb-[calc(1rem+var(--inset-bottom))]\",\n contentClassName,\n )}\n >\n {children}\n </div>\n </main>\n {sidebarSide === Sides.right ? sidebar : null}\n </div>\n {footer}\n </div>\n );\n}\n\nexport { AppLayout };\n"],"mappings":";;;;;;;;AAoBA,SAAAc,UAAAC,IAAA;CAAA,MAAAC,IAAAf,EAAA,EAAA;CAAmB,MAAA,EAAAO,UAAAC,QAAAC,QAAAC,kBAAAC,SAAAC,aAAAI,OAAAF;CAMjB,MAAAF,cAAAI,OAAAC,KAAAA,IAAcd,MAAKe,QAAnBF;CAEA,MAAAG,SAAed,gBAAgB;CAAE,IAAAe;CAAA,IAAAL,EAAA,OAAAI,OAAAE,eAAA;EAI7BD,KAAA,oBAAA,KAAA;GACO,MAAA;GACK,WAAA;GAETD,UAAAA,OAAME;EACL,CAAA;EAAAN,EAAA,KAAAI,OAAAE;EAAAN,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAKA,MAAAO,KAAAd,SAAA,yCAAA;CACA,MAAAe,KAAAd,SAAA,4CAAA;CAA2E,IAAAe;CAAA,IAAAT,EAAA,OAAAO,MAAAP,EAAA,OAAAQ,IAAA;EAHlEC,KAAApB,GACT,kFACAkB,IACAC,EACF;EAACR,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;EAAAR,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAEA,MAAAU,KAAAb,gBAAgBT,MAAKuB,OAArBf,UAAA;CAA2C,IAAAgB;CAAA,IAAAZ,EAAA,OAAAL,kBAAA;EAO7BiB,KAAAvB,GACT,kHACAM,gBACF;EAACK,EAAA,KAAAL;EAAAK,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAR,YAAAQ,EAAA,OAAAY,IAAA;EATLC,KAAA,oBAAA,QAAA;GACK,IAAA;GACO,UAAA;GACA,WAAA;GAEV,UAAA,oBAAA,OAAA;IACa,WAAAD;IAKVpB;GACG,CAAA;EACD,CAAA;EAAAQ,EAAA,KAAAR;EAAAQ,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CACN,MAAAc,KAAAjB,gBAAgBT,MAAKe,QAArBP,UAAA;CAA4C,IAAAmB;CAAA,IAAAf,EAAA,QAAAS,MAAAT,EAAA,QAAAU,MAAAV,EAAA,QAAAa,MAAAb,EAAA,QAAAc,IAAA;EAtB/CC,MAAA,qBAAA,OAAA;GACa,WAAAN;GADb,UAAA;IAOGC;IACDG;IAcCC;GACG;;EAAAd,EAAA,MAAAS;EAAAT,EAAA,MAAAU;EAAAV,EAAA,MAAAa;EAAAb,EAAA,MAAAc;EAAAd,EAAA,MAAAe;CAAA,OAAAA,MAAAf,EAAA;CAAA,IAAAgB;CAAA,IAAAhB,EAAA,QAAAN,UAAAM,EAAA,QAAAP,UAAAO,EAAA,QAAAe,OAAAf,EAAA,QAAAK,IAAA;EA/BRW,MAAA,qBAAA,OAAA;GAAe,WAAA;GAAf,UAAA;IACEX;IAMCZ;IACDsB;IAwBCrB;GACG;;EAAAM,EAAA,MAAAN;EAAAM,EAAA,MAAAP;EAAAO,EAAA,MAAAe;EAAAf,EAAA,MAAAK;EAAAL,EAAA,MAAAgB;CAAA,OAAAA,MAAAhB,EAAA;CAAA,OAjCNgB;AAiCM"}
@@ -0,0 +1,7 @@
1
+ import type * as React from "react";
2
+ interface FooterProps extends React.ComponentProps<"footer"> {
3
+ sticky?: boolean;
4
+ }
5
+ /** The bar at the end of the page. Its text takes the app's display font from `className`. */
6
+ declare function Footer({ className, sticky, children, ...props }: FooterProps): React.JSX.Element;
7
+ export { Footer };
@@ -0,0 +1,18 @@
1
+ import { cn } from "../../style/utils.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ // src/blucks/layout/footer.tsx
4
+ /** The bar at the end of the page. Its text takes the app's display font from `className`. */
5
+ function Footer({ className, sticky = false, children, ...props }) {
6
+ return /* @__PURE__ */ jsx("footer", {
7
+ "data-slot": "footer",
8
+ className: cn("flex w-full items-center justify-around bg-card border-t rounded-t-primary px-4 py-2 shadow-[0_-5px_6px_-1px_rgb(0_0_0/0.25),0_-3px_4px_-2px_rgb(0_0_0/0.15)] dark:shadow-[0_-5px_6px_-1px_rgb(0_0_0/0.35),0_-3px_4px_-2px_rgb(0_0_0/0.22)]", sticky ? "sticky bottom-0 z-sticky" : null, className),
9
+ ...props,
10
+ children: /* @__PURE__ */ jsx("div", {
11
+ className: "flex text-base sm:text-lg tracking-widest text-shadow-md text-shadow-theme-600 dark:text-shadow-theme-400 hc:text-shadow-none transition-all",
12
+ children: /* @__PURE__ */ jsx("span", { children })
13
+ })
14
+ });
15
+ }
16
+ export { Footer };
17
+
18
+ //# sourceMappingURL=footer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footer.js","names":[],"sources":["../../../src/blucks/layout/footer.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { cn } from \"~/style/utils\";\n\ninterface FooterProps extends React.ComponentProps<\"footer\"> {\n sticky?: boolean;\n}\n\n/** The bar at the end of the page. Its text takes the app's display font from `className`. */\nfunction Footer({ className, sticky = false, children, ...props }: FooterProps) {\n return (\n <footer\n data-slot=\"footer\"\n className={cn(\n \"flex w-full items-center justify-around bg-card border-t rounded-t-primary px-4 py-2 shadow-[0_-5px_6px_-1px_rgb(0_0_0/0.25),0_-3px_4px_-2px_rgb(0_0_0/0.15)] dark:shadow-[0_-5px_6px_-1px_rgb(0_0_0/0.35),0_-3px_4px_-2px_rgb(0_0_0/0.22)]\",\n sticky ? \"sticky bottom-0 z-sticky\" : null,\n className,\n )}\n {...props}\n >\n <div className=\"flex text-base sm:text-lg tracking-widest text-shadow-md text-shadow-theme-600 dark:text-shadow-theme-400 hc:text-shadow-none transition-all\">\n <span>{children}</span>\n </div>\n </footer>\n );\n}\n\nexport { Footer };\n"],"mappings":";;;;AAQA,SAAS,OAAO,EAAE,WAAW,SAAS,OAAO,UAAU,GAAG,SAAsB;CAC9E,OACE,oBAAC,UAAD;EACE,aAAU;EACV,WAAW,GACT,+OACA,SAAS,6BAA6B,MACtC,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,QAAD,EAAO,SAAe,CAAA;EACnB,CAAA;CACC,CAAA;AAEZ"}
@@ -0,0 +1,22 @@
1
+ import type * as React from "react";
2
+ import { type Side } from "../../style/types";
3
+ interface HeaderProps extends Omit<React.ComponentProps<"header">, "title"> {
4
+ /** The site's name or the page's, cut short with an ellipsis. Can hold the app's link home. */
5
+ title: React.ReactNode;
6
+ /** Makes the title the page's `h1`, for a header that names the page. */
7
+ heading?: boolean;
8
+ /** For the app's display font. */
9
+ titleClassName?: string;
10
+ /** Before the title, e.g. a back link. */
11
+ leading?: React.ReactNode;
12
+ /** At the end on `actionSide`, e.g. the button that opens the menu. */
13
+ primaryActionButton?: React.ReactNode;
14
+ /** At the end opposite `actionSide`. */
15
+ secondaryActionButton?: React.ReactNode;
16
+ /** Match it to the menu drawer's side. */
17
+ actionSide?: Side;
18
+ sticky?: boolean;
19
+ }
20
+ /** The bar on top of the page. `children` sit at the right end, before a right-side action, e.g. a nav. */
21
+ declare function Header({ className, title, heading, titleClassName, leading, primaryActionButton, secondaryActionButton, actionSide, sticky, children, ...props }: HeaderProps): React.JSX.Element;
22
+ export { Header };
@@ -0,0 +1,121 @@
1
+ "use client";
2
+ import { cn } from "../../style/utils.js";
3
+ import { Sides } from "../../style/types.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/blucks/layout/header.tsx
7
+ /** The bar on top of the page. `children` sit at the right end, before a right-side action, e.g. a nav. */
8
+ function Header(t0) {
9
+ const $ = c(33);
10
+ let children;
11
+ let className;
12
+ let leading;
13
+ let primaryActionButton;
14
+ let props;
15
+ let secondaryActionButton;
16
+ let t1;
17
+ let t2;
18
+ let t3;
19
+ let title;
20
+ let titleClassName;
21
+ if ($[0] !== t0) {
22
+ ({className, title, heading: t1, titleClassName, leading, primaryActionButton, secondaryActionButton, actionSide: t2, sticky: t3, children, ...props} = t0);
23
+ $[0] = t0;
24
+ $[1] = children;
25
+ $[2] = className;
26
+ $[3] = leading;
27
+ $[4] = primaryActionButton;
28
+ $[5] = props;
29
+ $[6] = secondaryActionButton;
30
+ $[7] = t1;
31
+ $[8] = t2;
32
+ $[9] = t3;
33
+ $[10] = title;
34
+ $[11] = titleClassName;
35
+ } else {
36
+ children = $[1];
37
+ className = $[2];
38
+ leading = $[3];
39
+ primaryActionButton = $[4];
40
+ props = $[5];
41
+ secondaryActionButton = $[6];
42
+ t1 = $[7];
43
+ t2 = $[8];
44
+ t3 = $[9];
45
+ title = $[10];
46
+ titleClassName = $[11];
47
+ }
48
+ const heading = t1 === void 0 ? false : t1;
49
+ const actionSide = t2 === void 0 ? Sides.right : t2;
50
+ const sticky = t3 === void 0 ? false : t3;
51
+ const Title = heading ? "h1" : "span";
52
+ const t4 = sticky ? "sticky top-0 z-header" : null;
53
+ let t5;
54
+ if ($[12] !== className || $[13] !== t4) {
55
+ t5 = cn("w-full bg-card px-4 py-3 border-b border-border rounded-b-primary flex items-center justify-between gap-2 shadow-[0_5px_6px_-1px_rgb(0_0_0/0.25),0_3px_4px_-2px_rgb(0_0_0/0.15)] dark:shadow-[0_5px_6px_-1px_rgb(0_0_0/0.35),0_3px_4px_-2px_rgb(0_0_0/0.22)]", t4, className);
56
+ $[12] = className;
57
+ $[13] = t4;
58
+ $[14] = t5;
59
+ } else t5 = $[14];
60
+ const t6 = actionSide === Sides.left ? primaryActionButton : secondaryActionButton;
61
+ let t7;
62
+ if ($[15] !== titleClassName) {
63
+ t7 = cn("block min-w-0 overflow-clip [overflow-clip-margin:12px] text-ellipsis whitespace-nowrap font-semibold text-xl sm:text-3xl md:text-4xl tracking-widest text-shadow-lg text-shadow-theme-600 dark:text-shadow-theme-400 hc:text-shadow-none transition-[font-size] duration-1000", titleClassName);
64
+ $[15] = titleClassName;
65
+ $[16] = t7;
66
+ } else t7 = $[16];
67
+ let t8;
68
+ if ($[17] !== Title || $[18] !== t7 || $[19] !== title) {
69
+ t8 = /* @__PURE__ */ jsx(Title, {
70
+ className: t7,
71
+ children: title
72
+ });
73
+ $[17] = Title;
74
+ $[18] = t7;
75
+ $[19] = title;
76
+ $[20] = t8;
77
+ } else t8 = $[20];
78
+ let t9;
79
+ if ($[21] !== leading || $[22] !== t6 || $[23] !== t8) {
80
+ t9 = /* @__PURE__ */ jsxs("div", {
81
+ className: "flex items-center gap-2 min-w-0",
82
+ children: [
83
+ t6,
84
+ leading,
85
+ t8
86
+ ]
87
+ });
88
+ $[21] = leading;
89
+ $[22] = t6;
90
+ $[23] = t8;
91
+ $[24] = t9;
92
+ } else t9 = $[24];
93
+ const t10 = actionSide === Sides.right ? primaryActionButton : secondaryActionButton;
94
+ let t11;
95
+ if ($[25] !== children || $[26] !== t10) {
96
+ t11 = /* @__PURE__ */ jsxs("div", {
97
+ className: "flex items-center gap-0.5",
98
+ children: [children, t10]
99
+ });
100
+ $[25] = children;
101
+ $[26] = t10;
102
+ $[27] = t11;
103
+ } else t11 = $[27];
104
+ let t12;
105
+ if ($[28] !== props || $[29] !== t11 || $[30] !== t5 || $[31] !== t9) {
106
+ t12 = /* @__PURE__ */ jsxs("header", {
107
+ className: t5,
108
+ ...props,
109
+ children: [t9, t11]
110
+ });
111
+ $[28] = props;
112
+ $[29] = t11;
113
+ $[30] = t5;
114
+ $[31] = t9;
115
+ $[32] = t12;
116
+ } else t12 = $[32];
117
+ return t12;
118
+ }
119
+ export { Header };
120
+
121
+ //# sourceMappingURL=header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.js","names":["c","_c","React","Side","Sides","cn","HeaderProps","Omit","ComponentProps","title","ReactNode","heading","titleClassName","leading","primaryActionButton","secondaryActionButton","actionSide","sticky","Header","t0","$","children","className","props","t1","t2","t3","undefined","right","Title","t4","t5","t6","left","t7","t8","t9","t10","t11","t12","_c"],"sources":["../../../src/blucks/layout/header.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport { type Side, Sides } from \"~/style/types\";\nimport { cn } from \"~/style/utils\";\n\ninterface HeaderProps extends Omit<React.ComponentProps<\"header\">, \"title\"> {\n /** The site's name or the page's, cut short with an ellipsis. Can hold the app's link home. */\n title: React.ReactNode;\n /** Makes the title the page's `h1`, for a header that names the page. */\n heading?: boolean;\n /** For the app's display font. */\n titleClassName?: string;\n /** Before the title, e.g. a back link. */\n leading?: React.ReactNode;\n /** At the end on `actionSide`, e.g. the button that opens the menu. */\n primaryActionButton?: React.ReactNode;\n /** At the end opposite `actionSide`. */\n secondaryActionButton?: React.ReactNode;\n /** Match it to the menu drawer's side. */\n actionSide?: Side;\n sticky?: boolean;\n}\n\n/** The bar on top of the page. `children` sit at the right end, before a right-side action, e.g. a nav. */\nfunction Header({\n className,\n title,\n heading = false,\n titleClassName,\n leading,\n primaryActionButton,\n secondaryActionButton,\n actionSide = Sides.right,\n sticky = false,\n children,\n ...props\n}: HeaderProps) {\n const Title = heading ? \"h1\" : \"span\";\n\n return (\n <header\n className={cn(\n \"w-full bg-card px-4 py-3 border-b border-border rounded-b-primary flex items-center justify-between gap-2 shadow-[0_5px_6px_-1px_rgb(0_0_0/0.25),0_3px_4px_-2px_rgb(0_0_0/0.15)] dark:shadow-[0_5px_6px_-1px_rgb(0_0_0/0.35),0_3px_4px_-2px_rgb(0_0_0/0.22)]\",\n sticky ? \"sticky top-0 z-header\" : null,\n className,\n )}\n {...props}\n >\n <div className=\"flex items-center gap-2 min-w-0\">\n {actionSide === Sides.left ? primaryActionButton : secondaryActionButton}\n {leading}\n <Title\n className={cn(\n // min-w-0: overflow-clip doesn't drop a flex item's automatic minimum width, so it would never shrink to its ellipsis.\n \"block min-w-0 overflow-clip [overflow-clip-margin:12px] text-ellipsis whitespace-nowrap font-semibold text-xl sm:text-3xl md:text-4xl tracking-widest text-shadow-lg text-shadow-theme-600 dark:text-shadow-theme-400 hc:text-shadow-none transition-[font-size] duration-1000\",\n titleClassName,\n )}\n >\n {title}\n </Title>\n </div>\n <div className=\"flex items-center gap-0.5\">\n {children}\n {actionSide === Sides.right ? primaryActionButton : secondaryActionButton}\n </div>\n </header>\n );\n}\n\nexport { Header };\n"],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Narrows an arbitrary string to a key of an option map. Radix `onValueChange`
3
+ * handlers hand back a plain `string`, so this is what turns that back into the
4
+ * component's own literal union without a type assertion.
5
+ */
6
+ export declare function isKeyOf<TValue extends string>(options: Record<TValue, TValue>, value: string): value is TValue;
@@ -0,0 +1,12 @@
1
+ // src/blucks/lib/utils.ts
2
+ /**
3
+ * Narrows an arbitrary string to a key of an option map. Radix `onValueChange`
4
+ * handlers hand back a plain `string`, so this is what turns that back into the
5
+ * component's own literal union without a type assertion.
6
+ */
7
+ function isKeyOf(options, value) {
8
+ return Object.keys(options).includes(value);
9
+ }
10
+ export { isKeyOf };
11
+
12
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../src/blucks/lib/utils.ts"],"sourcesContent":["/**\n * Narrows an arbitrary string to a key of an option map. Radix `onValueChange`\n * handlers hand back a plain `string`, so this is what turns that back into the\n * component's own literal union without a type assertion.\n */\nexport function isKeyOf<TValue extends string>(\n options: Record<TValue, TValue>,\n value: string,\n): value is TValue {\n return Object.keys(options).includes(value);\n}\n"],"mappings":";;;;;;AAKA,SAAgB,QACd,SACA,OACiB;CACjB,OAAO,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK;AAC5C"}
@@ -0,0 +1,4 @@
1
+ export { type Accent, Accents, accents, applyAccent, applyHighContrast, applyMenuSide, applyRounded, applyTheme, applyZoom, darkSchemeQuery, defaultStyle, type ResolvedTheme, type RoundedCorner, RoundedCorners, type RoundedTarget, RoundedTargets, readStoredStyle, roundedCorners, roundedCornerVars, type StyleSettings, type Theme, Themes, Zooms, } from "./settings";
2
+ export { chip, keyboardButton, navSelected, toggleOn } from "./styles";
3
+ export { type Side, Sides, sides } from "./types";
4
+ export { cn } from "./utils";
@@ -0,0 +1,5 @@
1
+ import { cn } from "./utils.js";
2
+ import { chip, keyboardButton, navSelected, toggleOn } from "./styles.js";
3
+ import { Sides, sides } from "./types.js";
4
+ import { Accents, RoundedCorners, RoundedTargets, Themes, Zooms, accents, applyAccent, applyHighContrast, applyMenuSide, applyRounded, applyTheme, applyZoom, darkSchemeQuery, defaultStyle, readStoredStyle, roundedCornerVars, roundedCorners } from "./settings.js";
5
+ export { Accents, RoundedCorners, RoundedTargets, Sides, Themes, Zooms, accents, applyAccent, applyHighContrast, applyMenuSide, applyRounded, applyTheme, applyZoom, chip, cn, darkSchemeQuery, defaultStyle, keyboardButton, navSelected, readStoredStyle, roundedCornerVars, roundedCorners, sides, toggleOn };
@@ -0,0 +1,105 @@
1
+ import { type Side } from "./types";
2
+ /**
3
+ * The style settings the apps share: the options, their defaults, the writers
4
+ * that put a choice on <html> (where theme.css reads it) and the reader for the
5
+ * stored choices. Each setting is stored under its own localStorage key.
6
+ */
7
+ export declare const Themes: {
8
+ readonly light: "light";
9
+ readonly dark: "dark";
10
+ readonly system: "system";
11
+ };
12
+ export type Theme = keyof typeof Themes;
13
+ export type ResolvedTheme = Exclude<Theme, typeof Themes.system>;
14
+ export declare const Accents: {
15
+ readonly red: "red";
16
+ readonly orange: "orange";
17
+ readonly amber: "amber";
18
+ readonly yellow: "yellow";
19
+ readonly lime: "lime";
20
+ readonly green: "green";
21
+ readonly emerald: "emerald";
22
+ readonly teal: "teal";
23
+ readonly cyan: "cyan";
24
+ readonly sky: "sky";
25
+ readonly blue: "blue";
26
+ readonly indigo: "indigo";
27
+ readonly violet: "violet";
28
+ readonly purple: "purple";
29
+ readonly fuchsia: "fuchsia";
30
+ readonly pink: "pink";
31
+ readonly rose: "rose";
32
+ readonly slate: "slate";
33
+ readonly gray: "gray";
34
+ readonly zinc: "zinc";
35
+ readonly neutral: "neutral";
36
+ readonly stone: "stone";
37
+ readonly mauve: "mauve";
38
+ readonly olive: "olive";
39
+ readonly mist: "mist";
40
+ readonly taupe: "taupe";
41
+ readonly eagle: "eagle";
42
+ readonly kelly: "kelly";
43
+ readonly flyer: "flyer";
44
+ readonly phantom: "phantom";
45
+ readonly phillie: "phillie";
46
+ readonly maroon: "maroon";
47
+ readonly sixer: "sixer";
48
+ };
49
+ export type Accent = keyof typeof Accents;
50
+ export declare const accents: Array<Accent>;
51
+ export declare const RoundedTargets: {
52
+ readonly primary: "primary";
53
+ readonly secondary: "secondary";
54
+ };
55
+ export type RoundedTarget = keyof typeof RoundedTargets;
56
+ export declare const RoundedCorners: {
57
+ readonly none: "none";
58
+ readonly xs: "xs";
59
+ readonly sm: "sm";
60
+ readonly md: "md";
61
+ readonly lg: "lg";
62
+ readonly xl: "xl";
63
+ readonly "2xl": "2xl";
64
+ readonly "3xl": "3xl";
65
+ readonly "4xl": "4xl";
66
+ };
67
+ export type RoundedCorner = keyof typeof RoundedCorners;
68
+ export declare const roundedCorners: Array<RoundedCorner>;
69
+ /**
70
+ * Maps a `RoundedCorner` token to the Tailwind radius theme variable it resolves
71
+ * to. `none` has no theme variable: `rounded-none` is a hardcoded zero radius.
72
+ */
73
+ export declare const roundedCornerVars: Record<RoundedCorner, string>;
74
+ /** Root font size in px, written to `--zoom` on <html>. Every rem based size scales with it. */
75
+ export declare const Zooms: {
76
+ readonly min: 12;
77
+ readonly max: 20;
78
+ readonly default: 16;
79
+ };
80
+ /** OS color scheme query, followed while the theme is `Themes.system`. */
81
+ export declare const darkSchemeQuery = "(prefers-color-scheme: dark)";
82
+ export type StyleSettings = {
83
+ theme: Theme;
84
+ accent: Accent;
85
+ roundedPrimary: RoundedCorner;
86
+ roundedSecondary: RoundedCorner;
87
+ menuSide: Side;
88
+ zoom: number;
89
+ highContrast: boolean;
90
+ };
91
+ export declare const defaultStyle: StyleSettings;
92
+ /** Puts `dark` or `light` on <html>, stores the choice and returns what `system` resolved to. */
93
+ export declare function applyTheme(theme: Theme): ResolvedTheme;
94
+ export declare function applyAccent(accent: Accent): void;
95
+ export declare function applyRounded(target: RoundedTarget, corner: RoundedCorner): void;
96
+ /** Clamps to `Zooms` and rounds (a non-number gets the default), writes `--zoom`, stores it and returns the value it applied. */
97
+ export declare function applyZoom(zoom: number): number;
98
+ export declare function applyHighContrast(highContrast: boolean): void;
99
+ /** Only stored: the app's menu reads the side from its own state. */
100
+ export declare function applyMenuSide(menuSide: Side): void;
101
+ /**
102
+ * The stored settings, as the writers above left them. A missing or invalid value
103
+ * falls back to `defaultStyle`; high contrast falls back to the OS preference.
104
+ */
105
+ export declare function readStoredStyle(): StyleSettings;
@@ -0,0 +1,156 @@
1
+ import { Sides, sides } from "./types.js";
2
+ // src/style/settings.ts
3
+ /**
4
+ * The style settings the apps share: the options, their defaults, the writers
5
+ * that put a choice on <html> (where theme.css reads it) and the reader for the
6
+ * stored choices. Each setting is stored under its own localStorage key.
7
+ */
8
+ var Themes = {
9
+ light: "light",
10
+ dark: "dark",
11
+ system: "system"
12
+ };
13
+ var themes = Object.values(Themes);
14
+ var Accents = {
15
+ red: "red",
16
+ orange: "orange",
17
+ amber: "amber",
18
+ yellow: "yellow",
19
+ lime: "lime",
20
+ green: "green",
21
+ emerald: "emerald",
22
+ teal: "teal",
23
+ cyan: "cyan",
24
+ sky: "sky",
25
+ blue: "blue",
26
+ indigo: "indigo",
27
+ violet: "violet",
28
+ purple: "purple",
29
+ fuchsia: "fuchsia",
30
+ pink: "pink",
31
+ rose: "rose",
32
+ slate: "slate",
33
+ gray: "gray",
34
+ zinc: "zinc",
35
+ neutral: "neutral",
36
+ stone: "stone",
37
+ mauve: "mauve",
38
+ olive: "olive",
39
+ mist: "mist",
40
+ taupe: "taupe",
41
+ eagle: "eagle",
42
+ kelly: "kelly",
43
+ flyer: "flyer",
44
+ phantom: "phantom",
45
+ phillie: "phillie",
46
+ maroon: "maroon",
47
+ sixer: "sixer"
48
+ };
49
+ var accents = Object.values(Accents);
50
+ var RoundedTargets = {
51
+ primary: "primary",
52
+ secondary: "secondary"
53
+ };
54
+ var RoundedCorners = {
55
+ none: "none",
56
+ xs: "xs",
57
+ sm: "sm",
58
+ md: "md",
59
+ lg: "lg",
60
+ xl: "xl",
61
+ "2xl": "2xl",
62
+ "3xl": "3xl",
63
+ "4xl": "4xl"
64
+ };
65
+ var roundedCorners = Object.values(RoundedCorners);
66
+ /**
67
+ * Maps a `RoundedCorner` token to the Tailwind radius theme variable it resolves
68
+ * to. `none` has no theme variable: `rounded-none` is a hardcoded zero radius.
69
+ */
70
+ var roundedCornerVars = {
71
+ none: "0",
72
+ xs: "var(--radius-xs)",
73
+ sm: "var(--radius-sm)",
74
+ md: "var(--radius-md)",
75
+ lg: "var(--radius-lg)",
76
+ xl: "var(--radius-xl)",
77
+ "2xl": "var(--radius-2xl)",
78
+ "3xl": "var(--radius-3xl)",
79
+ "4xl": "var(--radius-4xl)"
80
+ };
81
+ /** Root font size in px, written to `--zoom` on <html>. Every rem based size scales with it. */
82
+ var Zooms = {
83
+ min: 12,
84
+ max: 20,
85
+ default: 16
86
+ };
87
+ var clampZoom = (value) => Number.isFinite(value) ? Math.min(Zooms.max, Math.max(Zooms.min, Math.round(value))) : Zooms.default;
88
+ /** OS color scheme query, followed while the theme is `Themes.system`. */
89
+ var darkSchemeQuery = "(prefers-color-scheme: dark)";
90
+ var defaultStyle = {
91
+ theme: Themes.system,
92
+ accent: Accents.emerald,
93
+ roundedPrimary: RoundedCorners.lg,
94
+ roundedSecondary: RoundedCorners.md,
95
+ menuSide: Sides.right,
96
+ zoom: Zooms.default,
97
+ highContrast: false
98
+ };
99
+ /** Puts `dark` or `light` on <html>, stores the choice and returns what `system` resolved to. */
100
+ function applyTheme(theme) {
101
+ let resolved = Themes.light;
102
+ if (theme !== Themes.system) resolved = theme;
103
+ else if (window.matchMedia("(prefers-color-scheme: dark)").matches) resolved = Themes.dark;
104
+ document.documentElement.classList.toggle("dark", resolved === Themes.dark);
105
+ document.documentElement.classList.toggle("light", resolved === Themes.light);
106
+ localStorage.setItem("theme", theme);
107
+ return resolved;
108
+ }
109
+ function applyAccent(accent) {
110
+ document.documentElement.dataset.accent = accent;
111
+ localStorage.setItem("accent", accent);
112
+ }
113
+ function applyRounded(target, corner) {
114
+ document.documentElement.style.setProperty(`--rounded-${target}`, roundedCornerVars[corner]);
115
+ localStorage.setItem(`rounded-${target}`, corner);
116
+ }
117
+ /** Clamps to `Zooms` and rounds (a non-number gets the default), writes `--zoom`, stores it and returns the value it applied. */
118
+ function applyZoom(zoom) {
119
+ const applied = clampZoom(zoom);
120
+ document.documentElement.style.setProperty("--zoom", `${applied}px`);
121
+ localStorage.setItem("zoom", String(applied));
122
+ return applied;
123
+ }
124
+ function applyHighContrast(highContrast) {
125
+ document.documentElement.classList.toggle("high-contrast", highContrast);
126
+ localStorage.setItem("high-contrast", String(highContrast));
127
+ }
128
+ /** Only stored: the app's menu reads the side from its own state. */
129
+ function applyMenuSide(menuSide) {
130
+ localStorage.setItem("menu-side", menuSide);
131
+ }
132
+ var isOneOf = (values, value) => values.some((option) => option === value);
133
+ /**
134
+ * The stored settings, as the writers above left them. A missing or invalid value
135
+ * falls back to `defaultStyle`; high contrast falls back to the OS preference.
136
+ */
137
+ function readStoredStyle() {
138
+ const theme = localStorage.getItem("theme");
139
+ const accent = localStorage.getItem("accent");
140
+ const roundedPrimary = localStorage.getItem("rounded-primary");
141
+ const roundedSecondary = localStorage.getItem("rounded-secondary");
142
+ const menuSide = localStorage.getItem("menu-side");
143
+ const highContrast = localStorage.getItem("high-contrast");
144
+ return {
145
+ theme: isOneOf(themes, theme) ? theme : defaultStyle.theme,
146
+ accent: isOneOf(accents, accent) ? accent : defaultStyle.accent,
147
+ roundedPrimary: isOneOf(roundedCorners, roundedPrimary) ? roundedPrimary : defaultStyle.roundedPrimary,
148
+ roundedSecondary: isOneOf(roundedCorners, roundedSecondary) ? roundedSecondary : defaultStyle.roundedSecondary,
149
+ menuSide: isOneOf(sides, menuSide) ? menuSide : defaultStyle.menuSide,
150
+ zoom: clampZoom(Number(localStorage.getItem("zoom") || Zooms.default)),
151
+ highContrast: highContrast === "true" || highContrast !== "false" && window.matchMedia("(prefers-contrast: more)").matches
152
+ };
153
+ }
154
+ export { Accents, RoundedCorners, RoundedTargets, Themes, Zooms, accents, applyAccent, applyHighContrast, applyMenuSide, applyRounded, applyTheme, applyZoom, darkSchemeQuery, defaultStyle, readStoredStyle, roundedCornerVars, roundedCorners };
155
+
156
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","names":[],"sources":["../../src/style/settings.ts"],"sourcesContent":["import { type Side, Sides, sides } from \"~/style/types\";\n\n/**\n * The style settings the apps share: the options, their defaults, the writers\n * that put a choice on <html> (where theme.css reads it) and the reader for the\n * stored choices. Each setting is stored under its own localStorage key.\n */\n\nexport const Themes = {\n light: \"light\",\n dark: \"dark\",\n system: \"system\",\n} as const;\nexport type Theme = keyof typeof Themes;\nexport type ResolvedTheme = Exclude<Theme, typeof Themes.system>;\nconst themes: Array<Theme> = Object.values(Themes);\n\nexport const Accents = {\n red: \"red\",\n orange: \"orange\",\n amber: \"amber\",\n yellow: \"yellow\",\n lime: \"lime\",\n green: \"green\",\n emerald: \"emerald\",\n teal: \"teal\",\n cyan: \"cyan\",\n sky: \"sky\",\n blue: \"blue\",\n indigo: \"indigo\",\n violet: \"violet\",\n purple: \"purple\",\n fuchsia: \"fuchsia\",\n pink: \"pink\",\n rose: \"rose\",\n slate: \"slate\",\n gray: \"gray\",\n zinc: \"zinc\",\n neutral: \"neutral\",\n stone: \"stone\",\n mauve: \"mauve\",\n olive: \"olive\",\n mist: \"mist\",\n taupe: \"taupe\",\n eagle: \"eagle\",\n kelly: \"kelly\",\n flyer: \"flyer\",\n phantom: \"phantom\",\n phillie: \"phillie\",\n maroon: \"maroon\",\n sixer: \"sixer\",\n} as const;\nexport type Accent = keyof typeof Accents;\nexport const accents: Array<Accent> = Object.values(Accents);\n\nexport const RoundedTargets = {\n primary: \"primary\",\n secondary: \"secondary\",\n} as const;\nexport type RoundedTarget = keyof typeof RoundedTargets;\n\nexport const RoundedCorners = {\n none: \"none\",\n xs: \"xs\",\n sm: \"sm\",\n md: \"md\",\n lg: \"lg\",\n xl: \"xl\",\n \"2xl\": \"2xl\",\n \"3xl\": \"3xl\",\n \"4xl\": \"4xl\",\n} as const;\nexport type RoundedCorner = keyof typeof RoundedCorners;\nexport const roundedCorners: Array<RoundedCorner> = Object.values(RoundedCorners);\n\n/**\n * Maps a `RoundedCorner` token to the Tailwind radius theme variable it resolves\n * to. `none` has no theme variable: `rounded-none` is a hardcoded zero radius.\n */\nexport const roundedCornerVars: Record<RoundedCorner, string> = {\n none: \"0\",\n xs: \"var(--radius-xs)\",\n sm: \"var(--radius-sm)\",\n md: \"var(--radius-md)\",\n lg: \"var(--radius-lg)\",\n xl: \"var(--radius-xl)\",\n \"2xl\": \"var(--radius-2xl)\",\n \"3xl\": \"var(--radius-3xl)\",\n \"4xl\": \"var(--radius-4xl)\",\n};\n\n/** Root font size in px, written to `--zoom` on <html>. Every rem based size scales with it. */\nexport const Zooms = {\n min: 12,\n max: 20,\n default: 16,\n} as const;\n\nconst clampZoom = (value: number) =>\n Number.isFinite(value)\n ? Math.min(Zooms.max, Math.max(Zooms.min, Math.round(value)))\n : Zooms.default;\n\n/** OS color scheme query, followed while the theme is `Themes.system`. */\nexport const darkSchemeQuery = \"(prefers-color-scheme: dark)\";\n\nexport type StyleSettings = {\n theme: Theme;\n accent: Accent;\n roundedPrimary: RoundedCorner;\n roundedSecondary: RoundedCorner;\n menuSide: Side;\n zoom: number;\n highContrast: boolean;\n};\n\nexport const defaultStyle: StyleSettings = {\n theme: Themes.system,\n accent: Accents.emerald,\n roundedPrimary: RoundedCorners.lg,\n roundedSecondary: RoundedCorners.md,\n menuSide: Sides.right,\n zoom: Zooms.default,\n highContrast: false,\n};\n\n/** Puts `dark` or `light` on <html>, stores the choice and returns what `system` resolved to. */\nexport function applyTheme(theme: Theme): ResolvedTheme {\n let resolved: ResolvedTheme = Themes.light;\n if (theme !== Themes.system) resolved = theme;\n else if (window.matchMedia(darkSchemeQuery).matches) resolved = Themes.dark;\n document.documentElement.classList.toggle(\"dark\", resolved === Themes.dark);\n document.documentElement.classList.toggle(\"light\", resolved === Themes.light);\n localStorage.setItem(\"theme\", theme);\n return resolved;\n}\n\nexport function applyAccent(accent: Accent) {\n document.documentElement.dataset.accent = accent;\n localStorage.setItem(\"accent\", accent);\n}\n\nexport function applyRounded(target: RoundedTarget, corner: RoundedCorner) {\n document.documentElement.style.setProperty(`--rounded-${target}`, roundedCornerVars[corner]);\n localStorage.setItem(`rounded-${target}`, corner);\n}\n\n/** Clamps to `Zooms` and rounds (a non-number gets the default), writes `--zoom`, stores it and returns the value it applied. */\nexport function applyZoom(zoom: number): number {\n const applied = clampZoom(zoom);\n document.documentElement.style.setProperty(\"--zoom\", `${applied}px`);\n localStorage.setItem(\"zoom\", String(applied));\n return applied;\n}\n\nexport function applyHighContrast(highContrast: boolean) {\n document.documentElement.classList.toggle(\"high-contrast\", highContrast);\n localStorage.setItem(\"high-contrast\", String(highContrast));\n}\n\n/** Only stored: the app's menu reads the side from its own state. */\nexport function applyMenuSide(menuSide: Side) {\n localStorage.setItem(\"menu-side\", menuSide);\n}\n\nconst isOneOf = <TValue extends string>(\n values: Array<TValue>,\n value: string | null,\n): value is TValue => values.some((option) => option === value);\n\n/**\n * The stored settings, as the writers above left them. A missing or invalid value\n * falls back to `defaultStyle`; high contrast falls back to the OS preference.\n */\nexport function readStoredStyle(): StyleSettings {\n const theme = localStorage.getItem(\"theme\");\n const accent = localStorage.getItem(\"accent\");\n const roundedPrimary = localStorage.getItem(\"rounded-primary\");\n const roundedSecondary = localStorage.getItem(\"rounded-secondary\");\n const menuSide = localStorage.getItem(\"menu-side\");\n const highContrast = localStorage.getItem(\"high-contrast\");\n\n return {\n theme: isOneOf(themes, theme) ? theme : defaultStyle.theme,\n accent: isOneOf(accents, accent) ? accent : defaultStyle.accent,\n roundedPrimary: isOneOf(roundedCorners, roundedPrimary)\n ? roundedPrimary\n : defaultStyle.roundedPrimary,\n roundedSecondary: isOneOf(roundedCorners, roundedSecondary)\n ? roundedSecondary\n : defaultStyle.roundedSecondary,\n menuSide: isOneOf(sides, menuSide) ? menuSide : defaultStyle.menuSide,\n zoom: clampZoom(Number(localStorage.getItem(\"zoom\") || Zooms.default)),\n highContrast:\n highContrast === \"true\" ||\n (highContrast !== \"false\" && window.matchMedia(\"(prefers-contrast: more)\").matches),\n };\n}\n"],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ export declare const chip = "bg-muted rounded-secondary px-1.5 py-0.5 text-sm font-medium inline-flex items-center gap-1.5 hc:border hc:border-border";
2
+ export declare const keyboardButton = "min-h-[44px] min-w-[44px] rounded-[10px] [border-style:outset] border-[var(--keycap-edge)] [border-width:8px_10px_10px_8px] bg-[var(--keycap-face)] text-xs text-[var(--keycap-text)] shadow-[0_5px_10px_2px_rgba(0,0,0,0.45)] transition-[box-shadow,transform,border-width] duration-100 ease-out active:translate-y-[3px] active:brightness-95 active:[border-style:inset] active:[border-width:8px_8px_5px_8px] active:shadow-[inset_0_2px_5px_0_rgba(0,0,0,0.3),0_1px_3px_1px_rgba(0,0,0,0.45)]";
3
+ /** A ToggleGroupItem's pressed state in the theme accent. */
4
+ export declare const toggleOn = "data-[state=on]:text-theme-foreground data-[state=on]:bg-theme-500 data-[state=on]:border-theme-700";
5
+ /** The current page's link in a nav. */
6
+ export declare const navSelected = "bg-theme-400 border-theme-300 hc:bg-foreground hc:border-foreground hc:text-background";
@@ -0,0 +1,10 @@
1
+ // src/style/styles.ts
2
+ var chip = "bg-muted rounded-secondary px-1.5 py-0.5 text-sm font-medium inline-flex items-center gap-1.5 hc:border hc:border-border";
3
+ var keyboardButton = "min-h-[44px] min-w-[44px] rounded-[10px] [border-style:outset] border-[var(--keycap-edge)] [border-width:8px_10px_10px_8px] bg-[var(--keycap-face)] text-xs text-[var(--keycap-text)] shadow-[0_5px_10px_2px_rgba(0,0,0,0.45)] transition-[box-shadow,transform,border-width] duration-100 ease-out active:translate-y-[3px] active:brightness-95 active:[border-style:inset] active:[border-width:8px_8px_5px_8px] active:shadow-[inset_0_2px_5px_0_rgba(0,0,0,0.3),0_1px_3px_1px_rgba(0,0,0,0.45)]";
4
+ /** A ToggleGroupItem's pressed state in the theme accent. */
5
+ var toggleOn = "data-[state=on]:text-theme-foreground data-[state=on]:bg-theme-500 data-[state=on]:border-theme-700";
6
+ /** The current page's link in a nav. */
7
+ var navSelected = "bg-theme-400 border-theme-300 hc:bg-foreground hc:border-foreground hc:text-background";
8
+ export { chip, keyboardButton, navSelected, toggleOn };
9
+
10
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","names":[],"sources":["../../src/style/styles.ts"],"sourcesContent":["export const chip =\n \"bg-muted rounded-secondary px-1.5 py-0.5 text-sm font-medium inline-flex items-center gap-1.5 hc:border hc:border-border\";\n\nexport const keyboardButton =\n \"min-h-[44px] min-w-[44px] rounded-[10px] [border-style:outset] border-[var(--keycap-edge)] [border-width:8px_10px_10px_8px] bg-[var(--keycap-face)] text-xs text-[var(--keycap-text)] shadow-[0_5px_10px_2px_rgba(0,0,0,0.45)] transition-[box-shadow,transform,border-width] duration-100 ease-out active:translate-y-[3px] active:brightness-95 active:[border-style:inset] active:[border-width:8px_8px_5px_8px] active:shadow-[inset_0_2px_5px_0_rgba(0,0,0,0.3),0_1px_3px_1px_rgba(0,0,0,0.45)]\";\n\n/** A ToggleGroupItem's pressed state in the theme accent. */\nexport const toggleOn =\n \"data-[state=on]:text-theme-foreground data-[state=on]:bg-theme-500 data-[state=on]:border-theme-700\";\n\n/** The current page's link in a nav. */\nexport const navSelected =\n \"bg-theme-400 border-theme-300 hc:bg-foreground hc:border-foreground hc:text-background\";\n"],"mappings":";AAAA,IAAa,OACX;AAEF,IAAa,iBACX;;AAGF,IAAa,WACX;;AAGF,IAAa,cACX"}