@monimesl/dot-renderer-react 0.1.0-alpha.4 → 0.1.0-alpha.40

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 (267) hide show
  1. package/README.md +43 -1
  2. package/dist/LICENSE-PHOSPHOR +21 -0
  3. package/dist/_virtual/_rolldown/runtime.js +14 -0
  4. package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
  5. package/dist/color.js +94 -0
  6. package/dist/components/amount-input.d.ts +6 -0
  7. package/dist/components/amount-input.js +111 -0
  8. package/dist/components/avatar.d.ts +6 -0
  9. package/dist/components/avatar.js +68 -0
  10. package/dist/components/box.js +56 -0
  11. package/dist/components/button.d.ts +6 -0
  12. package/dist/components/button.js +42 -0
  13. package/dist/components/carousel.d.ts +6 -0
  14. package/dist/components/carousel.js +258 -0
  15. package/dist/components/chip.d.ts +6 -0
  16. package/dist/components/chip.js +41 -0
  17. package/dist/components/code-input.d.ts +6 -0
  18. package/dist/components/code-input.js +96 -0
  19. package/dist/components/detail-row.d.ts +6 -0
  20. package/dist/components/detail-row.js +40 -0
  21. package/dist/components/disclosure.d.ts +6 -0
  22. package/dist/components/disclosure.js +76 -0
  23. package/dist/components/divider.d.ts +6 -0
  24. package/dist/components/divider.js +18 -0
  25. package/dist/components/empty-state.d.ts +6 -0
  26. package/dist/components/empty-state.js +64 -0
  27. package/dist/components/feedback.d.ts +8 -0
  28. package/dist/components/feedback.js +101 -0
  29. package/dist/components/field-box.js +44 -0
  30. package/dist/components/field.js +43 -0
  31. package/dist/components/footer.d.ts +6 -0
  32. package/dist/components/footer.js +25 -0
  33. package/dist/components/grid.d.ts +7 -0
  34. package/dist/components/grid.js +97 -0
  35. package/dist/components/https.js +11 -0
  36. package/dist/components/icon-artwork.js +143 -0
  37. package/dist/components/icon-button.js +28 -0
  38. package/dist/components/icon-svg.js +27 -0
  39. package/dist/components/icon.d.ts +6 -0
  40. package/dist/components/icon.js +25 -0
  41. package/dist/components/image.d.ts +6 -0
  42. package/dist/components/image.js +40 -0
  43. package/dist/components/index.d.ts +38 -0
  44. package/dist/components/index.js +92 -0
  45. package/dist/components/input.d.ts +6 -0
  46. package/dist/components/input.js +108 -0
  47. package/dist/components/link.d.ts +6 -0
  48. package/dist/components/link.js +32 -0
  49. package/dist/components/list.d.ts +7 -0
  50. package/dist/components/list.js +143 -0
  51. package/dist/components/numbers.js +9 -0
  52. package/dist/components/option-place.js +9 -0
  53. package/dist/components/option.d.ts +6 -0
  54. package/dist/components/option.js +44 -0
  55. package/dist/components/padding.d.ts +2 -0
  56. package/dist/components/padding.js +38 -0
  57. package/dist/components/pressable.js +17 -0
  58. package/dist/components/prose-context.js +5 -0
  59. package/dist/components/prose.d.ts +9 -0
  60. package/dist/components/prose.js +67 -0
  61. package/dist/components/qr-code.d.ts +6 -0
  62. package/dist/components/qr-code.js +58 -0
  63. package/dist/components/rich-text.d.ts +6 -0
  64. package/dist/components/rich-text.js +73 -0
  65. package/dist/components/scroll.d.ts +6 -0
  66. package/dist/components/scroll.js +57 -0
  67. package/dist/components/select.d.ts +6 -0
  68. package/dist/components/select.js +93 -0
  69. package/dist/components/sheet.d.ts +8 -0
  70. package/dist/components/sheet.js +106 -0
  71. package/dist/components/skeleton.d.ts +6 -0
  72. package/dist/components/skeleton.js +55 -0
  73. package/dist/components/slider.d.ts +6 -0
  74. package/dist/components/slider.js +57 -0
  75. package/dist/components/spinner.d.ts +6 -0
  76. package/dist/components/spinner.js +48 -0
  77. package/dist/components/stack.d.ts +6 -0
  78. package/dist/components/stack.js +25 -0
  79. package/dist/components/stepper.d.ts +6 -0
  80. package/dist/components/stepper.js +92 -0
  81. package/dist/components/steps.d.ts +7 -0
  82. package/dist/components/steps.js +110 -0
  83. package/dist/components/tabs.d.ts +7 -0
  84. package/dist/components/tabs.js +95 -0
  85. package/dist/components/text-area.d.ts +6 -0
  86. package/dist/components/text-area.js +42 -0
  87. package/dist/components/text.d.ts +6 -0
  88. package/dist/components/text.js +107 -0
  89. package/dist/components/toast.d.ts +6 -0
  90. package/dist/components/toast.js +56 -0
  91. package/dist/components/toggles.d.ts +9 -0
  92. package/dist/components/toggles.js +148 -0
  93. package/dist/components/tokens.js +49 -0
  94. package/dist/components/tones.js +30 -0
  95. package/dist/components/typed-text.js +28 -0
  96. package/dist/components/view.d.ts +6 -0
  97. package/dist/components/view.js +61 -0
  98. package/dist/index.d.ts +43 -48
  99. package/dist/index.js +40 -2086
  100. package/dist/markdown.js +255 -0
  101. package/dist/page-root.d.ts +2 -0
  102. package/dist/page-root.js +20 -0
  103. package/dist/portal.js +8 -0
  104. package/dist/pull-to-refresh.js +120 -0
  105. package/dist/react-host/19.3.0/react-dom.js +3 -0
  106. package/dist/react-host/19.3.0/react-host.js +6 -6
  107. package/dist/renderer.d.ts +17 -0
  108. package/dist/renderer.js +33 -0
  109. package/dist/root.d.ts +10 -0
  110. package/dist/root.js +71 -0
  111. package/dist/styles.css +1 -0
  112. package/dist/theme.d.ts +26 -0
  113. package/dist/theme.js +129 -0
  114. package/dist/types.d.ts +7 -0
  115. package/dist/vendor/@base-ui/react/checkbox/indicator/CheckboxIndicator.js +51 -0
  116. package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRoot.js +265 -0
  117. package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootContext.js +13 -0
  118. package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootDataAttributes.js +11 -0
  119. package/dist/vendor/@base-ui/react/checkbox/utils/getCheckboxStateAttributesMapping.js +15 -0
  120. package/dist/vendor/@base-ui/react/checkbox-group/CheckboxGroupContext.js +10 -0
  121. package/dist/vendor/@base-ui/react/dialog/backdrop/DialogBackdrop.js +40 -0
  122. package/dist/vendor/@base-ui/react/dialog/close/DialogClose.js +39 -0
  123. package/dist/vendor/@base-ui/react/dialog/popup/DialogPopup.js +92 -0
  124. package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupCssVars.js +8 -0
  125. package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupDataAttributes.js +7 -0
  126. package/dist/vendor/@base-ui/react/dialog/portal/DialogPortal.js +38 -0
  127. package/dist/vendor/@base-ui/react/dialog/portal/DialogPortalContext.js +13 -0
  128. package/dist/vendor/@base-ui/react/dialog/root/DialogRoot.js +16 -0
  129. package/dist/vendor/@base-ui/react/dialog/root/DialogRootContext.js +13 -0
  130. package/dist/vendor/@base-ui/react/dialog/root/useDialogRoot.js +77 -0
  131. package/dist/vendor/@base-ui/react/dialog/root/useRenderDialogRoot.js +65 -0
  132. package/dist/vendor/@base-ui/react/dialog/store/DialogStore.js +70 -0
  133. package/dist/vendor/@base-ui/react/dialog/title/DialogTitle.js +25 -0
  134. package/dist/vendor/@base-ui/react/dialog/utils/stateAttributesMapping.js +17 -0
  135. package/dist/vendor/@base-ui/react/field/control/FieldControlDataAttributes.js +11 -0
  136. package/dist/vendor/@base-ui/react/field/item/FieldItemContext.js +10 -0
  137. package/dist/vendor/@base-ui/react/field/root/useFieldValidation.js +18 -0
  138. package/dist/vendor/@base-ui/react/fieldset/root/FieldsetRootContext.js +13 -0
  139. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingFocusManager.js +477 -0
  140. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingPortal.js +165 -0
  141. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingRootStore.js +65 -0
  142. package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingTree.js +22 -0
  143. package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useDismiss.js +373 -0
  144. package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.js +58 -0
  145. package/dist/vendor/@base-ui/react/floating-ui-react/utils/composite.js +40 -0
  146. package/dist/vendor/@base-ui/react/floating-ui-react/utils/constants.js +5 -0
  147. package/dist/vendor/@base-ui/react/floating-ui-react/utils/createAttribute.js +6 -0
  148. package/dist/vendor/@base-ui/react/floating-ui-react/utils/createEventEmitter.js +18 -0
  149. package/dist/vendor/@base-ui/react/floating-ui-react/utils/element.js +26 -0
  150. package/dist/vendor/@base-ui/react/floating-ui-react/utils/enqueueFocus.js +25 -0
  151. package/dist/vendor/@base-ui/react/floating-ui-react/utils/event.js +25 -0
  152. package/dist/vendor/@base-ui/react/floating-ui-react/utils/markOthers.js +116 -0
  153. package/dist/vendor/@base-ui/react/floating-ui-react/utils/nodes.js +16 -0
  154. package/dist/vendor/@base-ui/react/floating-ui-react/utils/tabbable.js +135 -0
  155. package/dist/vendor/@base-ui/react/internals/TransitionStatusDataAttributes.js +11 -0
  156. package/dist/vendor/@base-ui/react/internals/composite/composite.js +89 -0
  157. package/dist/vendor/@base-ui/react/internals/composite/constants.js +4 -0
  158. package/dist/vendor/@base-ui/react/internals/composite/item/CompositeItem.js +21 -0
  159. package/dist/vendor/@base-ui/react/internals/composite/item/useCompositeItem.js +31 -0
  160. package/dist/vendor/@base-ui/react/internals/composite/list/CompositeList.js +180 -0
  161. package/dist/vendor/@base-ui/react/internals/composite/list/CompositeListContext.js +15 -0
  162. package/dist/vendor/@base-ui/react/internals/composite/list/useCompositeListItem.js +54 -0
  163. package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRoot.js +62 -0
  164. package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRootContext.js +13 -0
  165. package/dist/vendor/@base-ui/react/internals/composite/root/useCompositeRoot.js +170 -0
  166. package/dist/vendor/@base-ui/react/internals/constants.js +18 -0
  167. package/dist/vendor/@base-ui/react/internals/createBaseUIEventDetails.js +40 -0
  168. package/dist/vendor/@base-ui/react/internals/direction-context/DirectionContext.js +10 -0
  169. package/dist/vendor/@base-ui/react/internals/field-constants/constants.js +33 -0
  170. package/dist/vendor/@base-ui/react/internals/field-register-control/useRegisterFieldControl.js +40 -0
  171. package/dist/vendor/@base-ui/react/internals/field-root-context/FieldRootContext.js +45 -0
  172. package/dist/vendor/@base-ui/react/internals/form-context/FormContext.js +18 -0
  173. package/dist/vendor/@base-ui/react/internals/getStateAttributesProps.js +17 -0
  174. package/dist/vendor/@base-ui/react/internals/labelable-provider/LabelableContext.js +24 -0
  175. package/dist/vendor/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.js +35 -0
  176. package/dist/vendor/@base-ui/react/internals/labelable-provider/useLabelableId.js +57 -0
  177. package/dist/vendor/@base-ui/react/internals/reason-parts.js +14 -0
  178. package/dist/vendor/@base-ui/react/internals/serializeValue.js +12 -0
  179. package/dist/vendor/@base-ui/react/internals/stateAttributesMapping.js +11 -0
  180. package/dist/vendor/@base-ui/react/internals/use-button/useButton.js +137 -0
  181. package/dist/vendor/@base-ui/react/internals/useAnimationsFinished.js +94 -0
  182. package/dist/vendor/@base-ui/react/internals/useBaseUiId.js +13 -0
  183. package/dist/vendor/@base-ui/react/internals/useOpenChangeComplete.js +28 -0
  184. package/dist/vendor/@base-ui/react/internals/useRenderElement.js +109 -0
  185. package/dist/vendor/@base-ui/react/internals/useTransitionStatus.js +70 -0
  186. package/dist/vendor/@base-ui/react/internals/useValueChanged.js +15 -0
  187. package/dist/vendor/@base-ui/react/merge-props/mergeProps.js +153 -0
  188. package/dist/vendor/@base-ui/react/radio/indicator/RadioIndicator.js +46 -0
  189. package/dist/vendor/@base-ui/react/radio/root/RadioRoot.js +179 -0
  190. package/dist/vendor/@base-ui/react/radio/root/RadioRootContext.js +13 -0
  191. package/dist/vendor/@base-ui/react/radio/root/RadioRootDataAttributes.js +11 -0
  192. package/dist/vendor/@base-ui/react/radio/utils/stateAttributesMapping.js +14 -0
  193. package/dist/vendor/@base-ui/react/radio-group/RadioGroup.js +170 -0
  194. package/dist/vendor/@base-ui/react/radio-group/RadioGroupContext.js +10 -0
  195. package/dist/vendor/@base-ui/react/switch/root/SwitchRoot.js +170 -0
  196. package/dist/vendor/@base-ui/react/switch/root/SwitchRootContext.js +13 -0
  197. package/dist/vendor/@base-ui/react/switch/root/SwitchRootDataAttributes.js +11 -0
  198. package/dist/vendor/@base-ui/react/switch/stateAttributesMapping.js +12 -0
  199. package/dist/vendor/@base-ui/react/switch/thumb/SwitchThumb.js +25 -0
  200. package/dist/vendor/@base-ui/react/tabs/list/TabsList.js +98 -0
  201. package/dist/vendor/@base-ui/react/tabs/list/TabsListContext.js +13 -0
  202. package/dist/vendor/@base-ui/react/tabs/root/TabsRoot.js +213 -0
  203. package/dist/vendor/@base-ui/react/tabs/root/TabsRootContext.js +16 -0
  204. package/dist/vendor/@base-ui/react/tabs/root/TabsRootDataAttributes.js +8 -0
  205. package/dist/vendor/@base-ui/react/tabs/root/stateAttributesMapping.js +5 -0
  206. package/dist/vendor/@base-ui/react/tabs/tab/TabsTab.js +137 -0
  207. package/dist/vendor/@base-ui/react/utils/CommonPopupDataAttributes.js +24 -0
  208. package/dist/vendor/@base-ui/react/utils/CommonTriggerDataAttributes.js +11 -0
  209. package/dist/vendor/@base-ui/react/utils/FocusGuard.js +32 -0
  210. package/dist/vendor/@base-ui/react/utils/InternalBackdrop.js +30 -0
  211. package/dist/vendor/@base-ui/react/utils/dispatchClickWithModifiers.js +25 -0
  212. package/dist/vendor/@base-ui/react/utils/popupStateMapping.js +22 -0
  213. package/dist/vendor/@base-ui/react/utils/popups/popupStoreUtils.js +247 -0
  214. package/dist/vendor/@base-ui/react/utils/popups/popupTriggerMap.js +96 -0
  215. package/dist/vendor/@base-ui/react/utils/popups/store.js +94 -0
  216. package/dist/vendor/@base-ui/react/utils/resolveClassName.js +13 -0
  217. package/dist/vendor/@base-ui/react/utils/resolveRef.js +11 -0
  218. package/dist/vendor/@base-ui/react/utils/resolveStyle.js +13 -0
  219. package/dist/vendor/@base-ui/react/utils/useFocusableWhenDisabled.js +30 -0
  220. package/dist/vendor/@base-ui/utils/addEventListener.js +12 -0
  221. package/dist/vendor/@base-ui/utils/createLogOnce.js +20 -0
  222. package/dist/vendor/@base-ui/utils/empty.js +6 -0
  223. package/dist/vendor/@base-ui/utils/error.js +5 -0
  224. package/dist/vendor/@base-ui/utils/fastHooks.js +68 -0
  225. package/dist/vendor/@base-ui/utils/formatErrorMessage.js +27 -0
  226. package/dist/vendor/@base-ui/utils/getDefaultFormSubmitter.js +25 -0
  227. package/dist/vendor/@base-ui/utils/getReactElementRef.js +14 -0
  228. package/dist/vendor/@base-ui/utils/inertValue.js +8 -0
  229. package/dist/vendor/@base-ui/utils/isElementDisabled.js +6 -0
  230. package/dist/vendor/@base-ui/utils/mergeCleanups.js +14 -0
  231. package/dist/vendor/@base-ui/utils/mergeObjects.js +11 -0
  232. package/dist/vendor/@base-ui/utils/owner.js +7 -0
  233. package/dist/vendor/@base-ui/utils/platform/engine.js +8 -0
  234. package/dist/vendor/@base-ui/utils/platform/env.js +6 -0
  235. package/dist/vendor/@base-ui/utils/platform/os.js +15 -0
  236. package/dist/vendor/@base-ui/utils/platform/screen-reader.js +9 -0
  237. package/dist/vendor/@base-ui/utils/platform/shared.js +36 -0
  238. package/dist/vendor/@base-ui/utils/reactVersion.js +8 -0
  239. package/dist/vendor/@base-ui/utils/safeReact.js +13 -0
  240. package/dist/vendor/@base-ui/utils/shadowDom.js +26 -0
  241. package/dist/vendor/@base-ui/utils/store/ReactStore.js +181 -0
  242. package/dist/vendor/@base-ui/utils/store/Store.js +102 -0
  243. package/dist/vendor/@base-ui/utils/store/useStore.js +97 -0
  244. package/dist/vendor/@base-ui/utils/useAnimationFrame.js +87 -0
  245. package/dist/vendor/@base-ui/utils/useControlled.js +52 -0
  246. package/dist/vendor/@base-ui/utils/useId.js +32 -0
  247. package/dist/vendor/@base-ui/utils/useIsoLayoutEffect.js +7 -0
  248. package/dist/vendor/@base-ui/utils/useMergedRefs.js +87 -0
  249. package/dist/vendor/@base-ui/utils/useOnMount.js +12 -0
  250. package/dist/vendor/@base-ui/utils/useRefWithInit.js +18 -0
  251. package/dist/vendor/@base-ui/utils/useScrollLock.js +206 -0
  252. package/dist/vendor/@base-ui/utils/useStableCallback.js +38 -0
  253. package/dist/vendor/@base-ui/utils/useTimeout.js +43 -0
  254. package/dist/vendor/@base-ui/utils/useValueAsRef.js +27 -0
  255. package/dist/vendor/@base-ui/utils/visuallyHidden.js +23 -0
  256. package/dist/vendor/@base-ui/utils/warn.js +5 -0
  257. package/dist/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js +49 -0
  258. package/dist/vendor/uqr/dist/index.js +858 -0
  259. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +74 -0
  260. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +77 -0
  261. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +69 -0
  262. package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +64 -0
  263. package/dist/vendor/use-sync-external-store/shim/index.js +11 -0
  264. package/dist/vendor/use-sync-external-store/shim/with-selector.js +11 -0
  265. package/package.json +14 -9
  266. package/dist/index.d.ts.map +0 -1
  267. package/dist/index.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { FONT_SIZE, SELECTABLE } from "./tokens.js";
3
+ import { paddingStyle } from "./padding.js";
4
+ import { InsideProse } from "./prose-context.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/prose.tsx
7
+ const READING_WIDTH = 680;
8
+ const Prose = ({ children, ...padding }) => /* @__PURE__ */ jsx("div", {
9
+ className: "dot-prose",
10
+ style: {
11
+ display: "flex",
12
+ flexDirection: "column",
13
+ gap: 12,
14
+ width: "100%",
15
+ maxWidth: READING_WIDTH,
16
+ marginInline: "auto",
17
+ ...SELECTABLE,
18
+ ...paddingStyle(padding)
19
+ },
20
+ children: /* @__PURE__ */ jsx(InsideProse.Provider, {
21
+ value: true,
22
+ children
23
+ })
24
+ });
25
+ const Quote = ({ cite, children }) => {
26
+ const { colors } = useTheme();
27
+ return /* @__PURE__ */ jsxs("blockquote", {
28
+ className: "dot-quote",
29
+ style: {
30
+ display: "flex",
31
+ flexDirection: "column",
32
+ gap: 6,
33
+ margin: 0,
34
+ paddingInlineStart: 14,
35
+ borderInlineStart: `3px solid ${colors.subtle}`,
36
+ fontStyle: "italic"
37
+ },
38
+ children: [children, cite && /* @__PURE__ */ jsxs("span", {
39
+ style: {
40
+ fontSize: FONT_SIZE.caption,
41
+ fontStyle: "normal",
42
+ color: colors.subtle
43
+ },
44
+ children: ["— ", cite]
45
+ })]
46
+ });
47
+ };
48
+ const BulletList = ({ ordered, children }) => {
49
+ return /* @__PURE__ */ jsx(ordered ? "ol" : "ul", {
50
+ className: "dot-bullets",
51
+ style: {
52
+ display: "grid",
53
+ gap: 6,
54
+ margin: 0,
55
+ paddingInlineStart: 22,
56
+ listStyleType: ordered ? "decimal" : "disc"
57
+ },
58
+ children
59
+ });
60
+ };
61
+ const Bullet = ({ children }) => /* @__PURE__ */ jsx("li", {
62
+ className: "dot-bullet",
63
+ style: { display: "list-item" },
64
+ children
65
+ });
66
+ //#endregion
67
+ export { Bullet, BulletList, Prose, Quote };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { QRCode } from "@monimesl/dot-core";
3
+ //#region src/components/qr-code.d.ts
4
+ declare const QRCode$1: ReactComponent<typeof QRCode>;
5
+ //#endregion
6
+ export { QRCode$1 as QRCode };
@@ -0,0 +1,58 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { encode } from "../vendor/uqr/dist/index.js";
3
+ import { useMemo } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/components/qr-code.tsx
6
+ const DARK = "#000000";
7
+ const LIGHT = "#ffffff";
8
+ const QUIET_ZONE = 2;
9
+ const QRCode = ({ value, size = 200, label }) => {
10
+ const { radius } = useTheme();
11
+ const drawing = useMemo(() => value ? drawCode(value) : null, [value]);
12
+ return /* @__PURE__ */ jsxs("svg", {
13
+ className: "dot-qr-code",
14
+ role: "img",
15
+ "aria-label": label ?? value,
16
+ width: size,
17
+ height: size,
18
+ viewBox: drawing ? `0 0 ${drawing.size} ${drawing.size}` : "0 0 1 1",
19
+ shapeRendering: "crispEdges",
20
+ style: {
21
+ display: "block",
22
+ flexShrink: 0,
23
+ overflow: "hidden",
24
+ borderRadius: radius
25
+ },
26
+ children: [/* @__PURE__ */ jsx("rect", {
27
+ width: "100%",
28
+ height: "100%",
29
+ fill: LIGHT
30
+ }), drawing ? /* @__PURE__ */ jsx("path", {
31
+ d: drawing.path,
32
+ fill: DARK
33
+ }) : null]
34
+ });
35
+ };
36
+ function drawCode(value) {
37
+ let modules;
38
+ try {
39
+ modules = encode(value, {
40
+ ecc: "M",
41
+ border: QUIET_ZONE
42
+ }).data;
43
+ } catch {
44
+ return null;
45
+ }
46
+ const squares = [];
47
+ modules.forEach((row, y) => {
48
+ row.forEach((dark, x) => {
49
+ if (dark) squares.push(`M${x} ${y}h1v1h-1z`);
50
+ });
51
+ });
52
+ return {
53
+ size: modules.length,
54
+ path: squares.join("")
55
+ };
56
+ }
57
+ //#endregion
58
+ export { QRCode };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { RichText } from "@monimesl/dot-core";
3
+ //#region src/components/rich-text.d.ts
4
+ declare const RichText$1: ReactComponent<typeof RichText>;
5
+ //#endregion
6
+ export { RichText$1 as RichText };
@@ -0,0 +1,73 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { Divider } from "./divider.js";
3
+ import { Image } from "./image.js";
4
+ import { isHttps } from "./https.js";
5
+ import { Link } from "./link.js";
6
+ import { Bullet, BulletList, Prose, Quote } from "./prose.js";
7
+ import { parseMarkdown } from "../markdown.js";
8
+ import { Text } from "./text.js";
9
+ import { useMemo } from "react";
10
+ import { jsx } from "react/jsx-runtime";
11
+ //#region src/components/rich-text.tsx
12
+ const HEADING_TEXT = {
13
+ 1: { variant: "title" },
14
+ 2: { variant: "subtitle" },
15
+ 3: { weight: "bold" }
16
+ };
17
+ const RichText = ({ markdown }) => {
18
+ const blocks = useMemo(() => parseMarkdown(markdown ?? ""), [markdown]);
19
+ return /* @__PURE__ */ jsx(Prose, { children: blocks.map(renderBlock) });
20
+ };
21
+ function renderBlock(block, key) {
22
+ switch (block.kind) {
23
+ case "heading": return /* @__PURE__ */ jsx(Text, {
24
+ ...HEADING_TEXT[block.level],
25
+ children: block.content.map(renderInline)
26
+ }, key);
27
+ case "paragraph": return /* @__PURE__ */ jsx(Text, { children: block.content.map(renderInline) }, key);
28
+ case "list": return /* @__PURE__ */ jsx(BulletList, {
29
+ ordered: block.ordered,
30
+ children: block.items.map((item, itemKey) => /* @__PURE__ */ jsx(Bullet, { children: item.map(renderBlock) }, itemKey))
31
+ }, key);
32
+ case "quote": return /* @__PURE__ */ jsx(Quote, { children: block.blocks.map(renderBlock) }, key);
33
+ case "image": return /* @__PURE__ */ jsx(Image, {
34
+ src: block.src,
35
+ alt: block.alt
36
+ }, key);
37
+ case "rule": return /* @__PURE__ */ jsx(Divider, {}, key);
38
+ }
39
+ }
40
+ function renderInline(inline, key) {
41
+ switch (inline.kind) {
42
+ case "text": return inline.text;
43
+ case "strong": return /* @__PURE__ */ jsx(Text, {
44
+ weight: "bold",
45
+ children: inline.children.map(renderInline)
46
+ }, key);
47
+ case "emphasis": return /* @__PURE__ */ jsx(Text, {
48
+ italic: true,
49
+ children: inline.children.map(renderInline)
50
+ }, key);
51
+ case "code": return /* @__PURE__ */ jsx(Code, { text: inline.text }, key);
52
+ case "link": return isHttps(inline.href) ? /* @__PURE__ */ jsx(Link, {
53
+ href: inline.href,
54
+ children: inline.children.map(renderInline)
55
+ }, key) : inline.children.map(renderInline);
56
+ case "break": return /* @__PURE__ */ jsx("br", {}, key);
57
+ }
58
+ }
59
+ function Code({ text }) {
60
+ const { colors } = useTheme();
61
+ return /* @__PURE__ */ jsx("code", {
62
+ style: {
63
+ padding: "1px 4px",
64
+ borderRadius: 4,
65
+ background: colors.muted,
66
+ fontFamily: "ui-monospace, monospace",
67
+ fontSize: "0.9em"
68
+ },
69
+ children: text
70
+ });
71
+ }
72
+ //#endregion
73
+ export { RichText };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Scroll } from "@monimesl/dot-core";
3
+ //#region src/components/scroll.d.ts
4
+ declare const Scroll$1: ReactComponent<typeof Scroll>;
5
+ //#endregion
6
+ export { Scroll$1 as Scroll };
@@ -0,0 +1,57 @@
1
+ import { SPACE } from "./tokens.js";
2
+ import { paddingStyle } from "./padding.js";
3
+ import { createEvent } from "@monimesl/dot-core";
4
+ import { useEffect, useRef } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/components/scroll.tsx
7
+ const REST_DELAY_MS = 120;
8
+ const Scroll$1 = ({ gap = "medium", snap = "none", index, onChange, children, ...padding }) => {
9
+ const rowRef = useRef(null);
10
+ const reportedIndex = useRef(void 0);
11
+ const restTimer = useRef(void 0);
12
+ const paddingCss = paddingStyle(padding);
13
+ const startPadding = Number(paddingCss.paddingInlineStart);
14
+ useEffect(() => {
15
+ const element = rowRef.current;
16
+ if (index === void 0 || index === reportedIndex.current || !element) return;
17
+ const child = element.children[index];
18
+ if (child) {
19
+ reportedIndex.current = index;
20
+ element.scrollTo?.({
21
+ left: child.offsetLeft - startPadding,
22
+ behavior: "smooth"
23
+ });
24
+ }
25
+ }, [index, startPadding]);
26
+ useEffect(() => {
27
+ return () => clearTimeout(restTimer.current);
28
+ }, []);
29
+ return /* @__PURE__ */ jsx("div", {
30
+ ref: rowRef,
31
+ className: "dot-scroll",
32
+ onScroll: onChange ? () => {
33
+ clearTimeout(restTimer.current);
34
+ restTimer.current = setTimeout(() => {
35
+ const element = rowRef.current;
36
+ if (!element) return;
37
+ const visibleStart = element.scrollLeft + startPadding;
38
+ const firstShownIndex = [...element.children].findIndex((item) => item.offsetLeft + item.offsetWidth / 2 >= visibleStart);
39
+ if (firstShownIndex !== -1 && firstShownIndex !== reportedIndex.current) {
40
+ reportedIndex.current = firstShownIndex;
41
+ onChange(createEvent("change", { index: firstShownIndex }));
42
+ }
43
+ }, REST_DELAY_MS);
44
+ } : void 0,
45
+ style: {
46
+ gap: SPACE[gap],
47
+ ...paddingCss,
48
+ scrollPaddingInlineStart: paddingCss.paddingInlineStart,
49
+ scrollPaddingInlineEnd: paddingCss.paddingInlineEnd,
50
+ scrollSnapType: snap === "none" ? void 0 : "x mandatory",
51
+ "--dot-scroll-snap": snap === "none" ? "none" : snap
52
+ },
53
+ children
54
+ });
55
+ };
56
+ //#endregion
57
+ export { Scroll$1 as Scroll };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Select } from "@monimesl/dot-core";
3
+ //#region src/components/select.d.ts
4
+ declare const Select$1: ReactComponent<typeof Select>;
5
+ //#endregion
6
+ export { Select$1 as Select };
@@ -0,0 +1,93 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { ICON_SIZE, SPACE } from "./tokens.js";
3
+ import { Field } from "./field.js";
4
+ import { useFieldBox, useFieldNote } from "./field-box.js";
5
+ import { CHEVRON_DOWN_ARTWORK } from "./icon-artwork.js";
6
+ import { IconSvg } from "./icon-svg.js";
7
+ import { OptionPlaceContext } from "./option-place.js";
8
+ import { SheetPanel } from "./sheet.js";
9
+ import { createEvent } from "@monimesl/dot-core";
10
+ import { useId, useState } from "react";
11
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
+ //#region src/components/select.tsx
13
+ const Select$1 = ({ value, label, placeholder, hint, error, disabled, onChange, children }) => {
14
+ const { colors } = useTheme();
15
+ const [open, setOpen] = useState(false);
16
+ const box = useFieldBox(error, disabled);
17
+ const { noteId, controlAttributes } = useFieldNote(hint, error);
18
+ const labelId = useId();
19
+ const valueId = useId();
20
+ const choose = (next) => {
21
+ setOpen(false);
22
+ onChange?.(createEvent("change", { value: next }));
23
+ };
24
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, {
25
+ label,
26
+ hint,
27
+ error,
28
+ labelId,
29
+ noteId,
30
+ children: /* @__PURE__ */ jsxs("button", {
31
+ type: "button",
32
+ className: "dot-select",
33
+ disabled,
34
+ "aria-haspopup": "listbox",
35
+ "aria-labelledby": label ? `${labelId} ${valueId}` : valueId,
36
+ ...controlAttributes,
37
+ onClick: () => setOpen(true),
38
+ onFocus: box.onFocus,
39
+ onBlur: box.onBlur,
40
+ style: {
41
+ ...box.style,
42
+ display: "flex",
43
+ alignItems: "center",
44
+ gap: SPACE.medium,
45
+ width: "100%",
46
+ padding: "12px 14px",
47
+ textAlign: "start",
48
+ cursor: disabled ? "default" : "pointer"
49
+ },
50
+ children: [/* @__PURE__ */ jsx("span", {
51
+ id: valueId,
52
+ style: { flexGrow: 1 },
53
+ children: value ? /* @__PURE__ */ jsx(OptionPlaceContext.Provider, {
54
+ value: {
55
+ inField: true,
56
+ value,
57
+ choose: void 0
58
+ },
59
+ children
60
+ }) : /* @__PURE__ */ jsx("span", {
61
+ style: { color: colors.subtle },
62
+ children: placeholder
63
+ })
64
+ }), /* @__PURE__ */ jsx(IconSvg, {
65
+ artwork: CHEVRON_DOWN_ARTWORK,
66
+ size: ICON_SIZE.small,
67
+ color: colors.subtle
68
+ })]
69
+ })
70
+ }), /* @__PURE__ */ jsx(SheetPanel, {
71
+ open,
72
+ title: label,
73
+ onClose: () => setOpen(false),
74
+ children: /* @__PURE__ */ jsx("div", {
75
+ role: "listbox",
76
+ "aria-label": label,
77
+ style: {
78
+ display: "flex",
79
+ flexDirection: "column"
80
+ },
81
+ children: /* @__PURE__ */ jsx(OptionPlaceContext.Provider, {
82
+ value: {
83
+ inField: false,
84
+ value,
85
+ choose
86
+ },
87
+ children
88
+ })
89
+ })
90
+ })] });
91
+ };
92
+ //#endregion
93
+ export { Select$1 as Select };
@@ -0,0 +1,8 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import "./padding.js";
3
+ import { Sheet } from "@monimesl/dot-core";
4
+ import { ReactNode } from "react";
5
+ //#region src/components/sheet.d.ts
6
+ declare const Sheet$1: ReactComponent<typeof Sheet>;
7
+ //#endregion
8
+ export { Sheet$1 as Sheet };
@@ -0,0 +1,106 @@
1
+ import { FONT_FAMILY, useTheme } from "../theme.js";
2
+ import { CARD_RADIUS_SCALE, FONT_SIZE, ICON_SIZE, SPACE, WEIGHTS } from "./tokens.js";
3
+ import { CLOSE_ARTWORK } from "./icon-artwork.js";
4
+ import { IconSvg } from "./icon-svg.js";
5
+ import { pinnedPaddingStyle } from "./padding.js";
6
+ import { DialogBackdrop } from "../vendor/@base-ui/react/dialog/backdrop/DialogBackdrop.js";
7
+ import { DialogClose } from "../vendor/@base-ui/react/dialog/close/DialogClose.js";
8
+ import { DialogPopup } from "../vendor/@base-ui/react/dialog/popup/DialogPopup.js";
9
+ import { DialogPortal } from "../vendor/@base-ui/react/dialog/portal/DialogPortal.js";
10
+ import { DialogRoot } from "../vendor/@base-ui/react/dialog/root/DialogRoot.js";
11
+ import { DialogTitle } from "../vendor/@base-ui/react/dialog/title/DialogTitle.js";
12
+ import { usePortalContainer } from "../portal.js";
13
+ import { createEvent } from "@monimesl/dot-core";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ //#region src/components/sheet.tsx
16
+ const SheetPanel = ({ open, title, showCloseIcon = false, onClose, children, ...padding }) => {
17
+ const { colors, radius } = useTheme();
18
+ const container = usePortalContainer();
19
+ const cornerRadius = radius * CARD_RADIUS_SCALE;
20
+ return /* @__PURE__ */ jsx(DialogRoot, {
21
+ open,
22
+ onOpenChange: (next) => {
23
+ if (!next) onClose();
24
+ },
25
+ children: /* @__PURE__ */ jsxs(DialogPortal, {
26
+ container,
27
+ children: [/* @__PURE__ */ jsx(DialogBackdrop, {
28
+ className: "dot-sheet-backdrop",
29
+ style: {
30
+ position: "fixed",
31
+ inset: 0,
32
+ zIndex: 100,
33
+ background: "rgba(0, 0, 0, 0.4)"
34
+ }
35
+ }), /* @__PURE__ */ jsxs(DialogPopup, {
36
+ className: "dot-sheet",
37
+ "aria-label": title,
38
+ style: {
39
+ position: "fixed",
40
+ insetInline: 0,
41
+ bottom: 0,
42
+ zIndex: 101,
43
+ display: "flex",
44
+ flexDirection: "column",
45
+ gap: SPACE.medium,
46
+ maxHeight: "85vh",
47
+ overflowY: "auto",
48
+ ...pinnedPaddingStyle(padding, {
49
+ top: 16,
50
+ start: 16,
51
+ end: 16,
52
+ bottom: 24
53
+ }),
54
+ borderTopLeftRadius: cornerRadius,
55
+ borderTopRightRadius: cornerRadius,
56
+ background: colors.surface,
57
+ color: colors.text,
58
+ fontFamily: FONT_FAMILY,
59
+ outline: "none"
60
+ },
61
+ children: [
62
+ title ? /* @__PURE__ */ jsx(DialogTitle, {
63
+ style: {
64
+ margin: 0,
65
+ fontSize: FONT_SIZE.body,
66
+ fontWeight: WEIGHTS.bold,
67
+ lineHeight: "normal",
68
+ textAlign: "center"
69
+ },
70
+ children: title
71
+ }) : null,
72
+ showCloseIcon ? /* @__PURE__ */ jsx(DialogClose, {
73
+ "aria-label": "Close",
74
+ style: {
75
+ position: "absolute",
76
+ top: 10,
77
+ insetInlineEnd: 10,
78
+ display: "flex",
79
+ padding: 4,
80
+ border: "none",
81
+ borderRadius: "50%",
82
+ background: "transparent",
83
+ cursor: "pointer"
84
+ },
85
+ children: /* @__PURE__ */ jsx(IconSvg, {
86
+ artwork: CLOSE_ARTWORK,
87
+ size: ICON_SIZE.medium,
88
+ color: colors.subtle
89
+ })
90
+ }) : null,
91
+ children
92
+ ]
93
+ })]
94
+ })
95
+ });
96
+ };
97
+ const Sheet$1 = ({ open = false, title, showCloseIcon = false, onClose, children, ...padding }) => /* @__PURE__ */ jsx(SheetPanel, {
98
+ ...padding,
99
+ open,
100
+ title,
101
+ showCloseIcon,
102
+ onClose: () => onClose?.(createEvent("close")),
103
+ children
104
+ });
105
+ //#endregion
106
+ export { Sheet$1 as Sheet, SheetPanel };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Skeleton } from "@monimesl/dot-core";
3
+ //#region src/components/skeleton.d.ts
4
+ declare const Skeleton$1: ReactComponent<typeof Skeleton>;
5
+ //#endregion
6
+ export { Skeleton$1 as Skeleton };
@@ -0,0 +1,55 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { SPACE } from "./tokens.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/components/skeleton.tsx
5
+ const LINE_HEIGHT = 12;
6
+ function Bar({ style }) {
7
+ const { colors } = useTheme();
8
+ return /* @__PURE__ */ jsx("div", { style: {
9
+ flexShrink: 0,
10
+ background: colors.muted,
11
+ animation: "dot-skeleton-pulse 1.2s linear infinite",
12
+ ...style
13
+ } });
14
+ }
15
+ const Skeleton = ({ shape = "text", lines = 1, height }) => {
16
+ const { radius } = useTheme();
17
+ let content;
18
+ if (shape === "circle") {
19
+ const size = height ?? 40;
20
+ content = /* @__PURE__ */ jsx(Bar, { style: {
21
+ width: size,
22
+ height: size,
23
+ borderRadius: "50%"
24
+ } });
25
+ } else if (shape === "box") content = /* @__PURE__ */ jsx(Bar, { style: {
26
+ width: "100%",
27
+ height: height ?? 80,
28
+ borderRadius: radius
29
+ } });
30
+ else {
31
+ const count = Math.max(1, lines);
32
+ content = Array.from({ length: count }, (_, index) => {
33
+ const last = count > 1 && index === count - 1;
34
+ return /* @__PURE__ */ jsx(Bar, { style: {
35
+ width: last ? "60%" : "100%",
36
+ height: LINE_HEIGHT,
37
+ borderRadius: LINE_HEIGHT / 2
38
+ } }, index);
39
+ });
40
+ }
41
+ return /* @__PURE__ */ jsx("div", {
42
+ className: "dot-skeleton",
43
+ "aria-busy": "true",
44
+ style: {
45
+ display: "flex",
46
+ flexDirection: "column",
47
+ gap: SPACE.medium,
48
+ width: shape === "circle" ? void 0 : "100%",
49
+ flexShrink: shape === "circle" ? 0 : 1
50
+ },
51
+ children: content
52
+ });
53
+ };
54
+ //#endregion
55
+ export { Skeleton };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Slider } from "@monimesl/dot-core";
3
+ //#region src/components/slider.d.ts
4
+ declare const Slider$1: ReactComponent<typeof Slider>;
5
+ //#endregion
6
+ export { Slider$1 as Slider };
@@ -0,0 +1,57 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { DISABLED_OPACITY, FONT_SIZE } from "./tokens.js";
3
+ import { Field, FieldLabel } from "./field.js";
4
+ import { useFieldNote } from "./field-box.js";
5
+ import { useTypedText } from "./typed-text.js";
6
+ import { createEvent } from "@monimesl/dot-core";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/slider.tsx
9
+ const Slider$1 = ({ value, min = 0, max = 100, step = 1, showValue, label, hint, disabled, onChange }) => {
10
+ const { colors } = useTheme();
11
+ const [positionText, showPosition] = useTypedText(value === void 0 ? void 0 : String(value), onChange !== void 0);
12
+ const { noteId, controlAttributes } = useFieldNote(hint, void 0);
13
+ const shownValue = positionText === "" ? String(min) : positionText;
14
+ return /* @__PURE__ */ jsxs(Field, {
15
+ label: void 0,
16
+ hint,
17
+ error: void 0,
18
+ noteId,
19
+ children: [label || showValue ? /* @__PURE__ */ jsxs("span", {
20
+ style: {
21
+ display: "flex",
22
+ justifyContent: "space-between"
23
+ },
24
+ children: [/* @__PURE__ */ jsx(FieldLabel, { children: label }), showValue ? /* @__PURE__ */ jsx("span", {
25
+ style: {
26
+ fontSize: FONT_SIZE.caption,
27
+ color: colors.subtle,
28
+ fontVariantNumeric: "tabular-nums"
29
+ },
30
+ children: shownValue
31
+ }) : null]
32
+ }) : null, /* @__PURE__ */ jsx("input", {
33
+ className: "dot-slider",
34
+ type: "range",
35
+ min,
36
+ max,
37
+ step,
38
+ value: shownValue,
39
+ disabled,
40
+ "aria-label": label,
41
+ ...controlAttributes,
42
+ onChange: (event) => {
43
+ const next = event.currentTarget.value;
44
+ showPosition(next);
45
+ onChange?.(createEvent("change", { value: Number(next) }));
46
+ },
47
+ style: {
48
+ width: "100%",
49
+ margin: 0,
50
+ accentColor: colors.primary,
51
+ opacity: disabled ? DISABLED_OPACITY : 1
52
+ }
53
+ })]
54
+ });
55
+ };
56
+ //#endregion
57
+ export { Slider$1 as Slider };
@@ -0,0 +1,6 @@
1
+ import { ReactComponent } from "../types.js";
2
+ import { Spinner } from "@monimesl/dot-core";
3
+ //#region src/components/spinner.d.ts
4
+ declare const Spinner$1: ReactComponent<typeof Spinner>;
5
+ //#endregion
6
+ export { Spinner$1 as Spinner };
@@ -0,0 +1,48 @@
1
+ import { useTheme } from "../theme.js";
2
+ import { ICON_SIZE } from "./tokens.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/spinner.tsx
5
+ function LoadingIcon({ size }) {
6
+ return /* @__PURE__ */ jsxs("svg", {
7
+ className: "dot-spinner",
8
+ width: size,
9
+ height: size,
10
+ viewBox: "0 0 24 24",
11
+ fill: "none",
12
+ stroke: "currentColor",
13
+ strokeWidth: 3,
14
+ role: "progressbar",
15
+ "aria-label": "Loading",
16
+ style: { flexShrink: 0 },
17
+ children: [/* @__PURE__ */ jsx("circle", {
18
+ cx: "12",
19
+ cy: "12",
20
+ r: "9",
21
+ strokeOpacity: .25
22
+ }), /* @__PURE__ */ jsx("path", {
23
+ d: "M21 12a9 9 0 0 0-9-9",
24
+ strokeLinecap: "round",
25
+ children: /* @__PURE__ */ jsx("animateTransform", {
26
+ attributeName: "transform",
27
+ type: "rotate",
28
+ from: "0 12 12",
29
+ to: "360 12 12",
30
+ dur: "0.8s",
31
+ repeatCount: "indefinite"
32
+ })
33
+ })]
34
+ });
35
+ }
36
+ const Spinner = ({ size = "medium" }) => {
37
+ const { colors } = useTheme();
38
+ return /* @__PURE__ */ jsx("span", {
39
+ style: {
40
+ display: "inline-flex",
41
+ alignSelf: "center",
42
+ color: colors.primary
43
+ },
44
+ children: /* @__PURE__ */ jsx(LoadingIcon, { size: ICON_SIZE[size] })
45
+ });
46
+ };
47
+ //#endregion
48
+ export { LoadingIcon, Spinner };