@apple-pie/slice 0.1.21 → 0.1.22

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 (115) hide show
  1. package/README.md +25 -1
  2. package/dist/cjs/chunks/{Button-DXvjvGtY.js → Button-KGA0e9-0.js} +1 -1
  3. package/dist/cjs/chunks/{ButtonBar-BZ6sme27.js → ButtonBar-RSBwFaU-.js} +1 -1
  4. package/dist/cjs/chunks/{Camera-rVC4KI4v.js → Camera-CLm3aQR8.js} +6 -2
  5. package/dist/cjs/chunks/{CheckBox-DQRLqTAK.js → CheckBox-DDINn56u.js} +1 -1
  6. package/dist/cjs/chunks/{Chip-Pv9-KTnh.js → Chip-DRSg6kLh.js} +1 -1
  7. package/dist/cjs/chunks/{DrggablePanel-CkhCXqKv.js → DrggablePanel-CERavfv3.js} +6 -2
  8. package/dist/cjs/chunks/{DropDown-C3AZ5b_b.js → DropDown-CJH-Y6Z5.js} +1 -1
  9. package/dist/cjs/chunks/{ErrorSummary-BTgAd3sK.js → ErrorSummary-BfVHS893.js} +6 -2
  10. package/dist/cjs/chunks/{FileIcon-CZLe2S2l.js → FileIcon-xoD-xIme.js} +2 -2
  11. package/dist/cjs/chunks/{FileList-BHwBIics.js → FileList-CIRALfrW.js} +1 -1
  12. package/dist/cjs/chunks/{Grouper-D4yyHHkM.js → Grouper-RYRxazG9.js} +1 -1
  13. package/dist/cjs/chunks/{Icon-D1EB8S5r.js → Icon-BB-t50Yt.js} +6 -2
  14. package/dist/cjs/chunks/{IconButton-B07Ttxbr.js → IconButton-BUw3YUsI.js} +1 -1
  15. package/dist/cjs/chunks/{Label-CTzvGcds.js → Label-NzMpkZo2.js} +1 -1
  16. package/dist/cjs/chunks/MdStreamBuffer-DObxjnAm.js +381 -0
  17. package/dist/cjs/chunks/{ProgressIndicator-BGqIwycX.js → ProgressIndicator-DETWiASA.js} +6 -2
  18. package/dist/cjs/chunks/{PromptInput-z6TuhHsG.js → PromptInput-DUxwal3V.js} +2 -2
  19. package/dist/cjs/chunks/{RadioButton-DuIsM4lu.js → RadioButton-Cvqum7dU.js} +1 -1
  20. package/dist/cjs/chunks/{RadioButtonList-bu11ILyw.js → RadioButtonList-CPHTioGa.js} +1 -1
  21. package/dist/cjs/chunks/{TabBar-Bcq_n4Mk.js → TabBar-CnD3E-qa.js} +1 -1
  22. package/dist/cjs/chunks/{TextArea-BSKbDOEt.js → TextArea-mSespe9z.js} +6 -6
  23. package/dist/cjs/chunks/{TextField-BNacOZVx.js → TextField-Cz2lh-fP.js} +20 -22
  24. package/dist/cjs/chunks/{Toast-CZzAWG0S.js → Toast-D2fpwdjF.js} +6 -2
  25. package/dist/cjs/chunks/{UploadArea-CKuE4rtg.js → UploadArea-CtvvqLU7.js} +1 -1
  26. package/dist/cjs/components/Button/index.js +4 -4
  27. package/dist/cjs/components/ButtonBar/index.js +2 -2
  28. package/dist/cjs/components/Camera/index.js +4 -4
  29. package/dist/cjs/components/CheckBox/index.js +2 -2
  30. package/dist/cjs/components/Chip/index.js +2 -2
  31. package/dist/cjs/components/DraggablePanel/index.js +3 -3
  32. package/dist/cjs/components/DropDown/index.js +2 -2
  33. package/dist/cjs/components/ErrorSummary/index.js +2 -2
  34. package/dist/cjs/components/FileIcon/index.js +3 -4
  35. package/dist/cjs/components/FileList/index.js +4 -4
  36. package/dist/cjs/components/Grouper/index.js +2 -2
  37. package/dist/cjs/components/Icon/index.js +3 -3
  38. package/dist/cjs/components/IconButton/index.js +4 -4
  39. package/dist/cjs/components/Label/index.js +1 -1
  40. package/dist/cjs/components/Progress/index.js +5 -5
  41. package/dist/cjs/components/PromptInput/index.js +7 -7
  42. package/dist/cjs/components/RadioButton/index.js +2 -2
  43. package/dist/cjs/components/RadioButtonList/index.js +3 -3
  44. package/dist/cjs/components/TabBar/index.js +3 -3
  45. package/dist/cjs/components/TextArea/index.js +4 -4
  46. package/dist/cjs/components/Textfield/index.js +5 -5
  47. package/dist/cjs/components/Toast/index.js +2 -2
  48. package/dist/cjs/components/UploadArea/index.js +5 -5
  49. package/dist/cjs/hooks/useMdStreamBuffer.js +41 -0
  50. package/dist/cjs/hooks.js +3 -2
  51. package/dist/cjs/index.js +12 -11
  52. package/dist/cjs/utils/index.js +3 -2
  53. package/dist/cjs/utils/objects/index.js +3 -2
  54. package/dist/esm/chunks/{Button-daLv0i7S.mjs → Button-Bp51g5jC.mjs} +2 -2
  55. package/dist/esm/chunks/{ButtonBar-DXK8meQq.mjs → ButtonBar-BK-uB7oe.mjs} +1 -1
  56. package/dist/esm/chunks/{Camera-BqmVsVKy.mjs → Camera-BYi_Aqbl.mjs} +3 -3
  57. package/dist/esm/chunks/{CheckBox-BsaYFNC6.mjs → CheckBox-BB5olQbT.mjs} +1 -1
  58. package/dist/esm/chunks/{Chip-BRZeD1OX.mjs → Chip-CxqFCtT6.mjs} +1 -1
  59. package/dist/esm/chunks/{DropDown-DOJvg96J.mjs → DropDown-CK-sPjsQ.mjs} +1 -1
  60. package/dist/esm/chunks/{FileList-5LElsgoE.mjs → FileList-CyUhkk-m.mjs} +3 -3
  61. package/dist/esm/chunks/{Grouper-DR14qDXP.mjs → Grouper-Daz1o_Ai.mjs} +1 -1
  62. package/dist/esm/chunks/{IconButton-DG69Vlhj.mjs → IconButton-BKZD9jsp.mjs} +1 -1
  63. package/dist/esm/chunks/{Label-CRsE7o3D.mjs → Label-QTsUvGme.mjs} +1 -1
  64. package/dist/esm/chunks/MdStreamBuffer-DNXE4XbN.mjs +381 -0
  65. package/dist/esm/chunks/{ProgressIndicator-D7paCpgY.mjs → ProgressIndicator-Cg7CCrAE.mjs} +3 -3
  66. package/dist/esm/chunks/{PromptInput-CpxUcInZ.mjs → PromptInput-DJInpjRX.mjs} +4 -2
  67. package/dist/esm/chunks/{RadioButton-B5ZF5oJ_.mjs → RadioButton-CYp8RkDK.mjs} +1 -1
  68. package/dist/esm/chunks/{RadioButtonList-D9ZAZgkK.mjs → RadioButtonList-BSzV9Zz-.mjs} +1 -1
  69. package/dist/esm/chunks/{TabBar-BK7OcjPl.mjs → TabBar-Dd5-VZcG.mjs} +2 -2
  70. package/dist/esm/chunks/{TextArea-BmsEj6IA.mjs → TextArea-C_2D7sZV.mjs} +6 -6
  71. package/dist/esm/chunks/{TextField-DWPpevsj.mjs → TextField-RG1AsLTh.mjs} +19 -25
  72. package/dist/esm/chunks/{Toast-DPHLwDES.mjs → Toast-BfuKRAns.mjs} +3 -3
  73. package/dist/esm/chunks/{UploadArea-DPiOaNpc.mjs → UploadArea-ByvnUxhr.mjs} +3 -3
  74. package/dist/esm/components/Button/index.mjs +5 -5
  75. package/dist/esm/components/ButtonBar/index.mjs +2 -2
  76. package/dist/esm/components/Camera/index.mjs +4 -4
  77. package/dist/esm/components/CheckBox/index.mjs +2 -2
  78. package/dist/esm/components/Chip/index.mjs +2 -2
  79. package/dist/esm/components/DraggablePanel/index.mjs +3 -3
  80. package/dist/esm/components/DropDown/index.mjs +2 -2
  81. package/dist/esm/components/ErrorSummary/index.mjs +3 -3
  82. package/dist/esm/components/FileIcon/index.mjs +3 -3
  83. package/dist/esm/components/FileList/index.mjs +4 -4
  84. package/dist/esm/components/Grouper/index.mjs +2 -2
  85. package/dist/esm/components/Icon/index.mjs +3 -3
  86. package/dist/esm/components/IconButton/index.mjs +4 -4
  87. package/dist/esm/components/Label/index.mjs +1 -1
  88. package/dist/esm/components/Progress/index.mjs +4 -4
  89. package/dist/esm/components/PromptInput/index.mjs +8 -8
  90. package/dist/esm/components/RadioButton/index.mjs +2 -2
  91. package/dist/esm/components/RadioButtonList/index.mjs +3 -3
  92. package/dist/esm/components/TabBar/index.mjs +3 -3
  93. package/dist/esm/components/TextArea/index.mjs +6 -6
  94. package/dist/esm/components/Textfield/index.mjs +7 -7
  95. package/dist/esm/components/Toast/index.mjs +4 -4
  96. package/dist/esm/components/UploadArea/index.mjs +5 -5
  97. package/dist/esm/hooks/useMdStreamBuffer.mjs +42 -0
  98. package/dist/esm/hooks.mjs +6 -0
  99. package/dist/esm/index.mjs +27 -23
  100. package/dist/esm/utils/index.mjs +2 -0
  101. package/dist/esm/utils/objects/index.mjs +2 -0
  102. package/dist/types/components/Textfield/_types.d.ts +1 -3
  103. package/dist/types/hooks/index.d.ts +1 -0
  104. package/dist/types/hooks/useMdStreamBuffer/useMdStreamBuffer.d.ts +10 -0
  105. package/dist/types/index.d.ts +1 -1
  106. package/dist/types/utils/index.d.ts +2 -2
  107. package/dist/types/utils/objects/MDStreamBuffer/MdStreamBuffer.d.ts +63 -0
  108. package/dist/types/utils/objects/MDStreamBuffer/_defaults.d.ts +3 -0
  109. package/dist/types/utils/objects/MDStreamBuffer/_types.d.ts +25 -0
  110. package/dist/types/utils/objects/index.d.ts +2 -0
  111. package/package.json +1 -1
  112. package/dist/esm/chunks/{DrggablePanel-Ddi0vPRp.mjs → DrggablePanel-BfBCRXa8.mjs} +2 -2
  113. package/dist/esm/chunks/{ErrorSummary-CHLkvdHk.mjs → ErrorSummary-BNdjCQbn.mjs} +2 -2
  114. package/dist/esm/chunks/{FileIcon-ePouoJpT.mjs → FileIcon-BXKnFJBn.mjs} +2 -2
  115. package/dist/esm/chunks/{Icon-CUSQtytG.mjs → Icon-CbwaBi0l.mjs} +2 -2
@@ -0,0 +1,42 @@
1
+ import { useRef, useState, useEffect, useCallback } from "react";
2
+
3
+ import "../chunks/tslib.es6-c-7TIv71.mjs";
4
+
5
+ import { M as MdBuffer } from "../chunks/MdStreamBuffer-DNXE4XbN.mjs";
6
+
7
+ function useMDStreamBuffer(options) {
8
+ const bufferRef = useRef(null), [healthy, setHealthy] = useState(""), [raw, setRaw] = useState(""), [isComplete, setIsComplete] = useState(!1);
9
+ useEffect(() => (bufferRef.current = new MdBuffer(Object.assign(Object.assign({}, options), {
10
+ onFlush: snapshot => {
11
+ const {healthy: healthy, raw: raw, isComplete: isComplete} = snapshot;
12
+ setHealthy(healthy), setRaw(raw), setIsComplete(isComplete);
13
+ }
14
+ })), () => {
15
+ var _a;
16
+ null === (_a = bufferRef.current) || void 0 === _a || _a.dispose(), bufferRef.current = null;
17
+ }), []);
18
+ return {
19
+ raw: raw,
20
+ healthy: healthy,
21
+ isComplete: isComplete,
22
+ append: useCallback(value => {
23
+ var _a;
24
+ value && (null === (_a = bufferRef.current) || void 0 === _a || _a.append(value));
25
+ }, []),
26
+ flush: useCallback(() => {
27
+ var _a;
28
+ return null === (_a = bufferRef.current) || void 0 === _a ? void 0 : _a.flush();
29
+ }, []),
30
+ complete: useCallback(() => {
31
+ var _a;
32
+ return null === (_a = bufferRef.current) || void 0 === _a ? void 0 : _a.complete();
33
+ }, []),
34
+ reset: useCallback(() => {
35
+ var _a;
36
+ null === (_a = bufferRef.current) || void 0 === _a || _a.reset(), setHealthy(""),
37
+ setRaw("");
38
+ }, [])
39
+ };
40
+ }
41
+
42
+ export { useMDStreamBuffer };
@@ -12,6 +12,8 @@ export { useLastUpdated } from "./hooks/useLastUpdated.mjs";
12
12
 
13
13
  export { useLocalStore } from "./hooks/useLocalStore.mjs";
14
14
 
15
+ export { useMDStreamBuffer } from "./hooks/useMdStreamBuffer.mjs";
16
+
15
17
  export { FormFactor, useWindow } from "./hooks/useWindow.mjs";
16
18
 
17
19
  export { useObserveResize } from "./hooks/useObserveResize.mjs";
@@ -29,3 +31,7 @@ import "./theme/elevations.mjs";
29
31
  import "./theme/motion.mjs";
30
32
 
31
33
  import "./theme/type.mjs";
34
+
35
+ import "./chunks/tslib.es6-c-7TIv71.mjs";
36
+
37
+ import "./chunks/MdStreamBuffer-DNXE4XbN.mjs";
@@ -22,6 +22,8 @@ export { useLastUpdated } from "./hooks/useLastUpdated.mjs";
22
22
 
23
23
  export { useLocalStore } from "./hooks/useLocalStore.mjs";
24
24
 
25
+ export { useMDStreamBuffer } from "./hooks/useMdStreamBuffer.mjs";
26
+
25
27
  export { useWindow } from "./hooks/useWindow.mjs";
26
28
 
27
29
  export { useObserveResize } from "./hooks/useObserveResize.mjs";
@@ -32,23 +34,23 @@ export { A as AvatarGroup } from "./chunks/AvatarGroup--ELW-bO1.mjs";
32
34
 
33
35
  export { B as Badge } from "./chunks/Badge-DyICxZP2.mjs";
34
36
 
35
- export { I as IconButton } from "./chunks/IconButton-DG69Vlhj.mjs";
37
+ export { I as IconButton } from "./chunks/IconButton-BKZD9jsp.mjs";
36
38
 
37
- export { C as Camera } from "./chunks/Camera-BqmVsVKy.mjs";
39
+ export { C as Camera } from "./chunks/Camera-BYi_Aqbl.mjs";
38
40
 
39
- export { C as CheckBox } from "./chunks/CheckBox-BsaYFNC6.mjs";
41
+ export { C as CheckBox } from "./chunks/CheckBox-BB5olQbT.mjs";
40
42
 
41
43
  export { D as DivInput } from "./chunks/DivInput-DeSpC8Wm.mjs";
42
44
 
43
45
  export { D as Dot } from "./chunks/Dot-CLGwQu-i.mjs";
44
46
 
45
- export { D as DraggablePanel } from "./chunks/DrggablePanel-Ddi0vPRp.mjs";
47
+ export { D as DraggablePanel } from "./chunks/DrggablePanel-BfBCRXa8.mjs";
46
48
 
47
- export { D as DropDown } from "./chunks/DropDown-DOJvg96J.mjs";
49
+ export { D as DropDown } from "./chunks/DropDown-CK-sPjsQ.mjs";
48
50
 
49
- export { E as ErrorSummary } from "./chunks/ErrorSummary-CHLkvdHk.mjs";
51
+ export { E as ErrorSummary } from "./chunks/ErrorSummary-BNdjCQbn.mjs";
50
52
 
51
- export { G as Grouper } from "./chunks/Grouper-DR14qDXP.mjs";
53
+ export { G as Grouper } from "./chunks/Grouper-Daz1o_Ai.mjs";
52
54
 
53
55
  export { O as Overlay } from "./chunks/Overlay-TOzZXnwF.mjs";
54
56
 
@@ -56,13 +58,13 @@ export { F as FlexDiv, S as Size } from "./chunks/_types-CPrEyJX9.mjs";
56
58
 
57
59
  export { P as Pager } from "./chunks/Pager-BYT7_mCb.mjs";
58
60
 
59
- export { P as PromptInput } from "./chunks/PromptInput-CpxUcInZ.mjs";
61
+ export { P as PromptInput } from "./chunks/PromptInput-DJInpjRX.mjs";
60
62
 
61
- export { D as DoneCheck, P as ProgressIndicator } from "./chunks/ProgressIndicator-D7paCpgY.mjs";
63
+ export { D as DoneCheck, P as ProgressIndicator } from "./chunks/ProgressIndicator-Cg7CCrAE.mjs";
62
64
 
63
- export { R as RadioButton } from "./chunks/RadioButton-B5ZF5oJ_.mjs";
65
+ export { R as RadioButton } from "./chunks/RadioButton-CYp8RkDK.mjs";
64
66
 
65
- export { R as RadioButtonList } from "./chunks/RadioButtonList-D9ZAZgkK.mjs";
67
+ export { R as RadioButtonList } from "./chunks/RadioButtonList-BSzV9Zz-.mjs";
66
68
 
67
69
  export { S as Slider } from "./chunks/Slider-DL2iuNlh.mjs";
68
70
 
@@ -70,33 +72,33 @@ export { S as Spacer } from "./chunks/Spacer-BlgEdKEM.mjs";
70
72
 
71
73
  export { S as Switch } from "./chunks/Switch-BhCOo5Lu.mjs";
72
74
 
73
- export { T as TabBar } from "./chunks/TabBar-BK7OcjPl.mjs";
75
+ export { T as TabBar } from "./chunks/TabBar-Dd5-VZcG.mjs";
74
76
 
75
- export { T as TextArea } from "./chunks/TextArea-BmsEj6IA.mjs";
77
+ export { T as TextArea } from "./chunks/TextArea-C_2D7sZV.mjs";
76
78
 
77
- export { T as TextField } from "./chunks/TextField-DWPpevsj.mjs";
79
+ export { T as TextField } from "./chunks/TextField-RG1AsLTh.mjs";
78
80
 
79
81
  export { ThemeProvider } from "./providers/ThemeProvider.mjs";
80
82
 
81
83
  export { T as Tip } from "./chunks/Tip-BnKB9qMi.mjs";
82
84
 
83
- export { T as Toast, a as ToastType } from "./chunks/Toast-DPHLwDES.mjs";
85
+ export { T as Toast, a as ToastType } from "./chunks/Toast-BfuKRAns.mjs";
84
86
 
85
- export { B as Button } from "./chunks/Button-daLv0i7S.mjs";
87
+ export { B as Button } from "./chunks/Button-Bp51g5jC.mjs";
86
88
 
87
- export { C as Chip } from "./chunks/Chip-BRZeD1OX.mjs";
89
+ export { C as Chip } from "./chunks/Chip-CxqFCtT6.mjs";
88
90
 
89
- export { F as FileIcon, a as FileIconNames } from "./chunks/FileIcon-ePouoJpT.mjs";
91
+ export { F as FileIcon, a as FileIconNames } from "./chunks/FileIcon-BXKnFJBn.mjs";
90
92
 
91
- export { I as Icon } from "./chunks/Icon-CUSQtytG.mjs";
93
+ export { I as Icon } from "./chunks/Icon-CbwaBi0l.mjs";
92
94
 
93
95
  export { S as SliceIcons } from "./chunks/_types-C2C2Zwd0.mjs";
94
96
 
95
- export { B as ButtonBar } from "./chunks/ButtonBar-DXK8meQq.mjs";
97
+ export { B as ButtonBar } from "./chunks/ButtonBar-BK-uB7oe.mjs";
96
98
 
97
- export { L as Label, a as LabelBackground } from "./chunks/Label-CRsE7o3D.mjs";
99
+ export { L as Label, a as LabelBackground } from "./chunks/Label-QTsUvGme.mjs";
98
100
 
99
- export { U as UploadArea, a as allTypes, b as audioTypes, d as documentTypes, i as imageTypes, t as textTypes, v as videoTypes } from "./chunks/UploadArea-DPiOaNpc.mjs";
101
+ export { U as UploadArea, a as allTypes, b as audioTypes, d as documentTypes, i as imageTypes, t as textTypes, v as videoTypes } from "./chunks/UploadArea-ByvnUxhr.mjs";
100
102
 
101
103
  import "./theme/corners.mjs";
102
104
 
@@ -106,6 +108,8 @@ import "react";
106
108
 
107
109
  import "./chunks/tslib.es6-c-7TIv71.mjs";
108
110
 
111
+ import "./chunks/MdStreamBuffer-DNXE4XbN.mjs";
112
+
109
113
  import "react/jsx-runtime";
110
114
 
111
115
  import "./chunks/misc-N8KLjOXc.mjs";
@@ -116,6 +120,6 @@ import "motion/react";
116
120
 
117
121
  import "./chunks/colors-FQ0uNQcW.mjs";
118
122
 
119
- import "./chunks/FileList-5LElsgoE.mjs";
123
+ import "./chunks/FileList-CyUhkk-m.mjs";
120
124
 
121
125
  import "./chunks/debounce-Bst1jxMS.mjs";
@@ -6,6 +6,8 @@ export { a as addOpacity, t as tintFromColor } from "../chunks/colors-FQ0uNQcW.m
6
6
 
7
7
  export { I as IndexedDB } from "../chunks/IndexedDB-CJgzPHPB.mjs";
8
8
 
9
+ export { M as MdBuffer } from "../chunks/MdStreamBuffer-DNXE4XbN.mjs";
10
+
9
11
  export { S as SSEConnection } from "../chunks/SSEConnection-DcA3wFsO.mjs";
10
12
 
11
13
  export { W as WSConnection } from "../chunks/WSConnection-D9mpsVdc.mjs";
@@ -1,5 +1,7 @@
1
1
  export { I as IndexedDB } from "../../chunks/IndexedDB-CJgzPHPB.mjs";
2
2
 
3
+ export { M as MdBuffer } from "../../chunks/MdStreamBuffer-DNXE4XbN.mjs";
4
+
3
5
  export { S as SSEConnection } from "../../chunks/SSEConnection-DcA3wFsO.mjs";
4
6
 
5
7
  export { W as WSConnection } from "../../chunks/WSConnection-D9mpsVdc.mjs";
@@ -17,8 +17,7 @@ type TextFieldBaseProps = {
17
17
  onPaste?: (value: React.ClipboardEvent<HTMLInputElement>) => void;
18
18
  onClear?: () => void;
19
19
  onAction?: () => void;
20
- onValidate?: (state: boolean) => void;
21
- isValid?: boolean;
20
+ error?: boolean;
22
21
  inline?: boolean;
23
22
  maxLength?: number;
24
23
  size?: {
@@ -39,7 +38,6 @@ type TextFieldBaseProps = {
39
38
  textColorPlaceholder?: string;
40
39
  textColorDisabled?: string;
41
40
  labelColor?: string;
42
- validate?: boolean;
43
41
  iconLeft?: {
44
42
  name?: string;
45
43
  size?: number;
@@ -5,5 +5,6 @@ export { useToolTip } from './useToolTip/useToolTip';
5
5
  export { type KeyboardShortcut, type KeyboardShortcuts, useKeyboardShortcuts, } from './useKeyboardShortcuts/useKeyboardShortcuts';
6
6
  export { useLastUpdated } from './useLastUpdated/useLastUpdated';
7
7
  export { useLocalStore } from './useLocalStore/useLocalStore';
8
+ export { useMDStreamBuffer } from './useMdStreamBuffer/useMdStreamBuffer';
8
9
  export { useWindow, FormFactor, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, } from './useWindow/useWindow';
9
10
  export { useObserveResize } from './useObserveResize/useObserveResize';
@@ -0,0 +1,10 @@
1
+ import type { MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot } from '../../utils';
2
+ export declare function useMDStreamBuffer(options?: MarkdownStreamBufferOptions): {
3
+ raw: string;
4
+ healthy: string;
5
+ isComplete: boolean;
6
+ append: (value: string) => void;
7
+ flush: () => MarkdownStreamBufferSnapshot | undefined;
8
+ complete: () => MarkdownStreamBufferSnapshot | undefined;
9
+ reset: () => void;
10
+ };
@@ -2,7 +2,7 @@ export type { ToolTip, ToolTipInfo } from './components/sharedTypes';
2
2
  export { ToolTipType } from './components/sharedTypes';
3
3
  export { light, dark, lightTheme, darkTheme, motion, elevations, Elevation, } from './theme';
4
4
  export type { SliceTheme, Colors, Type, Corners, Elevations, } from './theme';
5
- export { type KeyboardShortcut, type KeyboardShortcuts, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, useKeyboardShortcuts, useTheme, useObserveTheme, useToolTip, useLastUpdated, useLocalStore, useWindow, useDoubleClick, useObserveResize, } from './hooks';
5
+ export { type KeyboardShortcut, type KeyboardShortcuts, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, useKeyboardShortcuts, useTheme, useObserveTheme, useToolTip, useLastUpdated, useLocalStore, useMDStreamBuffer, useWindow, useDoubleClick, useObserveResize, } from './hooks';
6
6
  export { Avatar } from './components/Avatar/index';
7
7
  export type { AvatarProps } from './components/Avatar/index';
8
8
  export { AvatarGroup } from './components/AvatarGroup';
@@ -1,5 +1,5 @@
1
1
  export { copyToClipboard, hexToRgb } from './functions/misc';
2
2
  export { debounce } from './functions/debounce';
3
3
  export * from './functions/colors';
4
- export { IndexedDB, SSEConnection, WSConnection } from './objects';
5
- export type { IndexedDBOptions, SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, UnifiedMessageEvent, WSConnectionOptions, } from './objects';
4
+ export { IndexedDB, MdBuffer, SSEConnection, WSConnection, } from './objects';
5
+ export type { IndexedDBOptions, MarkdownAutoCloseRule, MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot, SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, UnifiedMessageEvent, WSConnectionOptions, } from './objects';
@@ -0,0 +1,63 @@
1
+ import type { MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot } from './_types';
2
+ /**
3
+ * Buffer streamed Markdown and emit parser-safe snapshots on animation frames.
4
+ */
5
+ export declare class MdBuffer {
6
+ private readonly endOfStreamToken?;
7
+ private readonly htmlHandling;
8
+ private readonly includeLinksAndImages;
9
+ private readonly onFlush?;
10
+ private readonly requestFrame;
11
+ private readonly cancelFrame;
12
+ private readonly watchedMarkers;
13
+ private committedRaw;
14
+ private activeRaw;
15
+ private frameHandle;
16
+ private completeSignal;
17
+ constructor(options?: MarkdownStreamBufferOptions);
18
+ /**
19
+ * The raw Markdown accumulated so far.
20
+ */
21
+ get raw(): string;
22
+ /**
23
+ * The current parser-safe preview derived from the raw buffer.
24
+ */
25
+ get healthy(): string;
26
+ /**
27
+ * Append a streamed Markdown token and schedule a frame flush.
28
+ */
29
+ append(chunk: string): MarkdownStreamBufferSnapshot | undefined;
30
+ /**
31
+ * Emit the current snapshot immediately.
32
+ */
33
+ flush(reason?: MarkdownStreamBufferSnapshot['reason']): MarkdownStreamBufferSnapshot;
34
+ /**
35
+ * Mark the stream as complete and flush one final snapshot.
36
+ */
37
+ complete(): MarkdownStreamBufferSnapshot;
38
+ /**
39
+ * Clear the buffered state and cancel any pending frame.
40
+ */
41
+ reset(): void;
42
+ /**
43
+ * Cancel future work and release the retained state.
44
+ */
45
+ dispose(): void;
46
+ private handleEndOfStreamToken;
47
+ private scheduleFlush;
48
+ private commitStableLines;
49
+ private buildHealthyOutput;
50
+ private buildHealthyTail;
51
+ private closeInlineMarkdown;
52
+ private closeLinksAndImages;
53
+ private getPairedRules;
54
+ private closeSymmetricPairedMarkers;
55
+ private closeAsymmetricPairedMarkers;
56
+ private closeLineMarkers;
57
+ private closeTrailingLink;
58
+ private closeTrailingImage;
59
+ private closeTrailingImageSignal;
60
+ private findTrailingLink;
61
+ private findTrailingImage;
62
+ private findTrailingInlineConstruct;
63
+ }
@@ -0,0 +1,3 @@
1
+ import type { MarkdownAutoCloseRule } from './_types';
2
+ export declare const DEFAULT_MAX_DEFERRED_CHARACTERS = 48;
3
+ export declare const DEFAULT_WATCHED_MARKERS: MarkdownAutoCloseRule[];
@@ -0,0 +1,25 @@
1
+ export interface MarkdownStreamBufferSnapshot {
2
+ raw: string;
3
+ healthy: string;
4
+ reason: 'raf' | 'manual' | 'complete';
5
+ isComplete: boolean;
6
+ }
7
+ export interface MarkdownAutoCloseRule {
8
+ name?: string;
9
+ open: string;
10
+ close: string;
11
+ mode?: 'paired' | 'line';
12
+ linePattern?: RegExp;
13
+ partialLinePattern?: RegExp;
14
+ requiresLineStart?: boolean;
15
+ requiresContent?: boolean;
16
+ }
17
+ export interface MarkdownStreamBufferOptions {
18
+ endOfStreamToken?: string;
19
+ htmlHandling?: 'ignore' | 'strip';
20
+ includeLinksAndImages?: boolean;
21
+ onFlush?: (snapshot: MarkdownStreamBufferSnapshot) => void;
22
+ requestFrame?: (callback: FrameRequestCallback) => number;
23
+ cancelFrame?: (handle: number) => void;
24
+ watchedMarkers?: MarkdownAutoCloseRule[];
25
+ }
@@ -1,5 +1,7 @@
1
1
  export { IndexedDB } from './IndexedDB/IndexedDB';
2
2
  export type { IndexedDBOptions } from './IndexedDB/IndexedDB';
3
+ export { MdBuffer } from './MDStreamBuffer/MdStreamBuffer';
4
+ export type { MarkdownAutoCloseRule, MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot, } from './MDStreamBuffer/_types';
3
5
  export { SSEConnection } from './SSEConnection/SSEConnection';
4
6
  export { WSConnection } from './WSConnection/WSConnection';
5
7
  export type { SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, } from './SSEConnection/SSEConnection';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apple-pie/slice",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -8,12 +8,12 @@ import { useTheme } from "../hooks/useTheme.mjs";
8
8
 
9
9
  import "../theme/colors.mjs";
10
10
 
11
+ import { p as pointerPosition } from "./misc-N8KLjOXc.mjs";
12
+
11
13
  import "../hooks/useWindow.mjs";
12
14
 
13
15
  import { useObserveResize } from "../hooks/useObserveResize.mjs";
14
16
 
15
- import { p as pointerPosition } from "./misc-N8KLjOXc.mjs";
16
-
17
17
  import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
18
18
 
19
19
  var css_panel = "DraggablePanel-module_panel__vuq2R flexBox-module_columnStart__C7P44", css_content = "DraggablePanel-module_content__SBL0T flexBox-module_columnStart__C7P44", css_handle = "DraggablePanel-module_handle__LPZw8";
@@ -10,10 +10,10 @@ import { useTheme } from "../hooks/useTheme.mjs";
10
10
 
11
11
  import "../theme/colors.mjs";
12
12
 
13
- import "../hooks/useWindow.mjs";
14
-
15
13
  import { a as addOpacity } from "./colors-FQ0uNQcW.mjs";
16
14
 
15
+ import "../hooks/useWindow.mjs";
16
+
17
17
  import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
18
18
 
19
19
  var css = {
@@ -8,10 +8,10 @@ import { useTheme } from "../hooks/useTheme.mjs";
8
8
 
9
9
  import "../theme/colors.mjs";
10
10
 
11
- import "../hooks/useWindow.mjs";
12
-
13
11
  import { a as accessibleKeyDown } from "./misc-N8KLjOXc.mjs";
14
12
 
13
+ import "../hooks/useWindow.mjs";
14
+
15
15
  var FileIconNames;
16
16
 
17
17
  !function(FileIconNames) {
@@ -8,10 +8,10 @@ import { useTheme } from "../hooks/useTheme.mjs";
8
8
 
9
9
  import "../theme/colors.mjs";
10
10
 
11
- import "../hooks/useWindow.mjs";
12
-
13
11
  import { a as accessibleKeyDown } from "./misc-N8KLjOXc.mjs";
14
12
 
13
+ import "../hooks/useWindow.mjs";
14
+
15
15
  import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
16
16
 
17
17
  var css_icon = "Icon-module_icon__szG-X";