@llui/components 0.0.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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +143 -0
  3. package/dist/components/accordion.d.ts +115 -0
  4. package/dist/components/accordion.d.ts.map +1 -0
  5. package/dist/components/accordion.js +138 -0
  6. package/dist/components/alert-dialog.d.ts +45 -0
  7. package/dist/components/alert-dialog.d.ts.map +1 -0
  8. package/dist/components/alert-dialog.js +12 -0
  9. package/dist/components/angle-slider.d.ts +121 -0
  10. package/dist/components/angle-slider.d.ts.map +1 -0
  11. package/dist/components/angle-slider.js +145 -0
  12. package/dist/components/async-list.d.ts +104 -0
  13. package/dist/components/async-list.d.ts.map +1 -0
  14. package/dist/components/async-list.js +117 -0
  15. package/dist/components/avatar.d.ts +58 -0
  16. package/dist/components/avatar.d.ts.map +1 -0
  17. package/dist/components/avatar.js +43 -0
  18. package/dist/components/carousel.d.ts +128 -0
  19. package/dist/components/carousel.d.ts.map +1 -0
  20. package/dist/components/carousel.js +131 -0
  21. package/dist/components/cascade-select.d.ts +95 -0
  22. package/dist/components/cascade-select.d.ts.map +1 -0
  23. package/dist/components/cascade-select.js +100 -0
  24. package/dist/components/checkbox.d.ts +74 -0
  25. package/dist/components/checkbox.d.ts.map +1 -0
  26. package/dist/components/checkbox.js +73 -0
  27. package/dist/components/clipboard.d.ts +72 -0
  28. package/dist/components/clipboard.d.ts.map +1 -0
  29. package/dist/components/clipboard.js +73 -0
  30. package/dist/components/collapsible.d.ts +64 -0
  31. package/dist/components/collapsible.d.ts.map +1 -0
  32. package/dist/components/collapsible.js +51 -0
  33. package/dist/components/color-picker.d.ts +125 -0
  34. package/dist/components/color-picker.d.ts.map +1 -0
  35. package/dist/components/color-picker.js +169 -0
  36. package/dist/components/combobox.d.ts +163 -0
  37. package/dist/components/combobox.d.ts.map +1 -0
  38. package/dist/components/combobox.js +345 -0
  39. package/dist/components/context-menu.d.ts +105 -0
  40. package/dist/components/context-menu.d.ts.map +1 -0
  41. package/dist/components/context-menu.js +177 -0
  42. package/dist/components/date-input.d.ts +117 -0
  43. package/dist/components/date-input.d.ts.map +1 -0
  44. package/dist/components/date-input.js +149 -0
  45. package/dist/components/date-picker.d.ts +142 -0
  46. package/dist/components/date-picker.d.ts.map +1 -0
  47. package/dist/components/date-picker.js +294 -0
  48. package/dist/components/dialog.d.ts +152 -0
  49. package/dist/components/dialog.d.ts.map +1 -0
  50. package/dist/components/dialog.js +140 -0
  51. package/dist/components/drawer.d.ts +106 -0
  52. package/dist/components/drawer.d.ts.map +1 -0
  53. package/dist/components/drawer.js +136 -0
  54. package/dist/components/editable.d.ts +92 -0
  55. package/dist/components/editable.d.ts.map +1 -0
  56. package/dist/components/editable.js +112 -0
  57. package/dist/components/file-upload.d.ts +251 -0
  58. package/dist/components/file-upload.d.ts.map +1 -0
  59. package/dist/components/file-upload.js +324 -0
  60. package/dist/components/floating-panel.d.ts +171 -0
  61. package/dist/components/floating-panel.d.ts.map +1 -0
  62. package/dist/components/floating-panel.js +198 -0
  63. package/dist/components/hover-card.d.ts +85 -0
  64. package/dist/components/hover-card.d.ts.map +1 -0
  65. package/dist/components/hover-card.js +128 -0
  66. package/dist/components/image-cropper.d.ts +129 -0
  67. package/dist/components/image-cropper.d.ts.map +1 -0
  68. package/dist/components/image-cropper.js +208 -0
  69. package/dist/components/index.d.ts +109 -0
  70. package/dist/components/index.d.ts.map +1 -0
  71. package/dist/components/index.js +54 -0
  72. package/dist/components/listbox.d.ts +98 -0
  73. package/dist/components/listbox.d.ts.map +1 -0
  74. package/dist/components/listbox.js +174 -0
  75. package/dist/components/marquee.d.ts +84 -0
  76. package/dist/components/marquee.d.ts.map +1 -0
  77. package/dist/components/marquee.js +73 -0
  78. package/dist/components/menu.d.ts +131 -0
  79. package/dist/components/menu.d.ts.map +1 -0
  80. package/dist/components/menu.js +262 -0
  81. package/dist/components/navigation-menu.d.ts +111 -0
  82. package/dist/components/navigation-menu.d.ts.map +1 -0
  83. package/dist/components/navigation-menu.js +102 -0
  84. package/dist/components/number-input.d.ts +106 -0
  85. package/dist/components/number-input.d.ts.map +1 -0
  86. package/dist/components/number-input.js +178 -0
  87. package/dist/components/pagination.d.ts +113 -0
  88. package/dist/components/pagination.d.ts.map +1 -0
  89. package/dist/components/pagination.js +135 -0
  90. package/dist/components/password-input.d.ts +64 -0
  91. package/dist/components/password-input.d.ts.map +1 -0
  92. package/dist/components/password-input.js +52 -0
  93. package/dist/components/pin-input.d.ts +89 -0
  94. package/dist/components/pin-input.d.ts.map +1 -0
  95. package/dist/components/pin-input.js +139 -0
  96. package/dist/components/popover.d.ts +116 -0
  97. package/dist/components/popover.d.ts.map +1 -0
  98. package/dist/components/popover.js +146 -0
  99. package/dist/components/presence.d.ts +71 -0
  100. package/dist/components/presence.d.ts.map +1 -0
  101. package/dist/components/presence.js +57 -0
  102. package/dist/components/progress.d.ts +74 -0
  103. package/dist/components/progress.d.ts.map +1 -0
  104. package/dist/components/progress.js +80 -0
  105. package/dist/components/qr-code.d.ts +114 -0
  106. package/dist/components/qr-code.d.ts.map +1 -0
  107. package/dist/components/qr-code.js +108 -0
  108. package/dist/components/radio-group.d.ts +89 -0
  109. package/dist/components/radio-group.d.ts.map +1 -0
  110. package/dist/components/radio-group.js +161 -0
  111. package/dist/components/rating-group.d.ts +88 -0
  112. package/dist/components/rating-group.d.ts.map +1 -0
  113. package/dist/components/rating-group.js +122 -0
  114. package/dist/components/scroll-area.d.ts +124 -0
  115. package/dist/components/scroll-area.d.ts.map +1 -0
  116. package/dist/components/scroll-area.js +152 -0
  117. package/dist/components/select.d.ts +161 -0
  118. package/dist/components/select.d.ts.map +1 -0
  119. package/dist/components/select.js +333 -0
  120. package/dist/components/signature-pad.d.ts +138 -0
  121. package/dist/components/signature-pad.d.ts.map +1 -0
  122. package/dist/components/signature-pad.js +142 -0
  123. package/dist/components/slider.d.ts +117 -0
  124. package/dist/components/slider.d.ts.map +1 -0
  125. package/dist/components/slider.js +210 -0
  126. package/dist/components/splitter.d.ts +87 -0
  127. package/dist/components/splitter.d.ts.map +1 -0
  128. package/dist/components/splitter.js +119 -0
  129. package/dist/components/steps.d.ts +104 -0
  130. package/dist/components/steps.d.ts.map +1 -0
  131. package/dist/components/steps.js +133 -0
  132. package/dist/components/switch.d.ts +66 -0
  133. package/dist/components/switch.d.ts.map +1 -0
  134. package/dist/components/switch.js +59 -0
  135. package/dist/components/tabs.d.ts +146 -0
  136. package/dist/components/tabs.d.ts.map +1 -0
  137. package/dist/components/tabs.js +244 -0
  138. package/dist/components/tags-input.d.ts +118 -0
  139. package/dist/components/tags-input.d.ts.map +1 -0
  140. package/dist/components/tags-input.js +168 -0
  141. package/dist/components/time-picker.d.ts +121 -0
  142. package/dist/components/time-picker.d.ts.map +1 -0
  143. package/dist/components/time-picker.js +147 -0
  144. package/dist/components/timer.d.ts +131 -0
  145. package/dist/components/timer.d.ts.map +1 -0
  146. package/dist/components/timer.js +117 -0
  147. package/dist/components/toast.d.ts +119 -0
  148. package/dist/components/toast.d.ts.map +1 -0
  149. package/dist/components/toast.js +102 -0
  150. package/dist/components/toc.d.ts +119 -0
  151. package/dist/components/toc.d.ts.map +1 -0
  152. package/dist/components/toc.js +107 -0
  153. package/dist/components/toggle-group.d.ts +80 -0
  154. package/dist/components/toggle-group.d.ts.map +1 -0
  155. package/dist/components/toggle-group.js +93 -0
  156. package/dist/components/toggle.d.ts +47 -0
  157. package/dist/components/toggle.d.ts.map +1 -0
  158. package/dist/components/toggle.js +41 -0
  159. package/dist/components/tooltip.d.ts +92 -0
  160. package/dist/components/tooltip.d.ts.map +1 -0
  161. package/dist/components/tooltip.js +147 -0
  162. package/dist/components/tour.d.ts +145 -0
  163. package/dist/components/tour.d.ts.map +1 -0
  164. package/dist/components/tour.js +133 -0
  165. package/dist/components/tree-view.d.ts +216 -0
  166. package/dist/components/tree-view.d.ts.map +1 -0
  167. package/dist/components/tree-view.js +293 -0
  168. package/dist/index.d.ts +3 -0
  169. package/dist/index.d.ts.map +1 -0
  170. package/dist/index.js +4 -0
  171. package/dist/patterns/confirm-dialog.d.ts +92 -0
  172. package/dist/patterns/confirm-dialog.d.ts.map +1 -0
  173. package/dist/patterns/confirm-dialog.js +92 -0
  174. package/dist/patterns/index.d.ts +3 -0
  175. package/dist/patterns/index.d.ts.map +1 -0
  176. package/dist/patterns/index.js +1 -0
  177. package/dist/utils/anatomy.d.ts +40 -0
  178. package/dist/utils/anatomy.d.ts.map +1 -0
  179. package/dist/utils/anatomy.js +41 -0
  180. package/dist/utils/aria-hidden.d.ts +12 -0
  181. package/dist/utils/aria-hidden.d.ts.map +1 -0
  182. package/dist/utils/aria-hidden.js +72 -0
  183. package/dist/utils/dismissable.d.ts +25 -0
  184. package/dist/utils/dismissable.d.ts.map +1 -0
  185. package/dist/utils/dismissable.js +65 -0
  186. package/dist/utils/dom.d.ts +8 -0
  187. package/dist/utils/dom.d.ts.map +1 -0
  188. package/dist/utils/dom.js +21 -0
  189. package/dist/utils/floating.d.ts +44 -0
  190. package/dist/utils/floating.d.ts.map +1 -0
  191. package/dist/utils/floating.js +44 -0
  192. package/dist/utils/focus-trap.d.ts +18 -0
  193. package/dist/utils/focus-trap.d.ts.map +1 -0
  194. package/dist/utils/focus-trap.js +85 -0
  195. package/dist/utils/focusables.d.ts +6 -0
  196. package/dist/utils/focusables.d.ts.map +1 -0
  197. package/dist/utils/focusables.js +65 -0
  198. package/dist/utils/index.d.ts +18 -0
  199. package/dist/utils/index.d.ts.map +1 -0
  200. package/dist/utils/index.js +10 -0
  201. package/dist/utils/interact-outside.d.ts +26 -0
  202. package/dist/utils/interact-outside.d.ts.map +1 -0
  203. package/dist/utils/interact-outside.js +46 -0
  204. package/dist/utils/remove-scroll.d.ts +8 -0
  205. package/dist/utils/remove-scroll.d.ts.map +1 -0
  206. package/dist/utils/remove-scroll.js +37 -0
  207. package/dist/utils/tree-collection.d.ts +61 -0
  208. package/dist/utils/tree-collection.d.ts.map +1 -0
  209. package/dist/utils/tree-collection.js +137 -0
  210. package/dist/utils/typeahead.d.ts +49 -0
  211. package/dist/utils/typeahead.d.ts.map +1 -0
  212. package/dist/utils/typeahead.js +81 -0
  213. package/package.json +282 -0
@@ -0,0 +1,129 @@
1
+ import type { Send } from '@llui/dom';
2
+ /**
3
+ * Image cropper — select a rectangular crop region over an image,
4
+ * optionally constrained to an aspect ratio. The machine tracks the
5
+ * image's natural dimensions, the crop rectangle, and in-progress
6
+ * drag/resize state. The view layer wires pointer events on the crop
7
+ * box and its resize handles.
8
+ *
9
+ * Coordinates are in image-native pixels (0..naturalWidth, 0..naturalHeight).
10
+ * The consumer converts to display pixels using the image's rendered size.
11
+ */
12
+ export type ResizeHandle = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
13
+ export interface CropRect {
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ }
19
+ export interface ImageCropperState {
20
+ /** Natural dimensions of the source image. */
21
+ image: {
22
+ width: number;
23
+ height: number;
24
+ };
25
+ crop: CropRect;
26
+ /** Constrain the crop to this aspect ratio (width / height), or null to free-form. */
27
+ aspectRatio: number | null;
28
+ minSize: number;
29
+ dragging: boolean;
30
+ resizing: ResizeHandle | null;
31
+ disabled: boolean;
32
+ }
33
+ export type ImageCropperMsg = {
34
+ type: 'setImage';
35
+ width: number;
36
+ height: number;
37
+ } | {
38
+ type: 'setCrop';
39
+ crop: CropRect;
40
+ } | {
41
+ type: 'setAspectRatio';
42
+ ratio: number | null;
43
+ } | {
44
+ type: 'dragStart';
45
+ } | {
46
+ type: 'dragMove';
47
+ dx: number;
48
+ dy: number;
49
+ } | {
50
+ type: 'dragEnd';
51
+ } | {
52
+ type: 'resizeStart';
53
+ handle: ResizeHandle;
54
+ } | {
55
+ type: 'resizeMove';
56
+ dx: number;
57
+ dy: number;
58
+ } | {
59
+ type: 'resizeEnd';
60
+ } | {
61
+ type: 'reset';
62
+ } | {
63
+ type: 'centerFill';
64
+ };
65
+ export interface ImageCropperInit {
66
+ image?: {
67
+ width: number;
68
+ height: number;
69
+ };
70
+ crop?: CropRect;
71
+ aspectRatio?: number | null;
72
+ minSize?: number;
73
+ disabled?: boolean;
74
+ }
75
+ /**
76
+ * Compute the largest centered crop that fits `image` while respecting the
77
+ * aspect ratio (if any).
78
+ */
79
+ export declare function centerFill(image: {
80
+ width: number;
81
+ height: number;
82
+ }, aspectRatio: number | null): CropRect;
83
+ export declare function init(opts?: ImageCropperInit): ImageCropperState;
84
+ export declare function update(state: ImageCropperState, msg: ImageCropperMsg): [ImageCropperState, never[]];
85
+ export interface ImageCropperParts<S> {
86
+ root: {
87
+ 'data-scope': 'image-cropper';
88
+ 'data-part': 'root';
89
+ 'data-dragging': (s: S) => '' | undefined;
90
+ 'data-resizing': (s: S) => '' | undefined;
91
+ 'data-disabled': (s: S) => '' | undefined;
92
+ };
93
+ image: {
94
+ 'data-scope': 'image-cropper';
95
+ 'data-part': 'image';
96
+ onLoad: (e: Event) => void;
97
+ draggable: false;
98
+ };
99
+ cropBox: {
100
+ 'data-scope': 'image-cropper';
101
+ 'data-part': 'crop-box';
102
+ style: (s: S) => string;
103
+ onPointerDown: (e: PointerEvent) => void;
104
+ };
105
+ resizeHandle: (handle: ResizeHandle) => {
106
+ 'data-scope': 'image-cropper';
107
+ 'data-part': 'resize-handle';
108
+ 'data-handle': ResizeHandle;
109
+ onPointerDown: (e: PointerEvent) => void;
110
+ };
111
+ resetTrigger: {
112
+ type: 'button';
113
+ 'aria-label': string;
114
+ 'data-scope': 'image-cropper';
115
+ 'data-part': 'reset-trigger';
116
+ onClick: (e: MouseEvent) => void;
117
+ };
118
+ }
119
+ export interface ConnectOptions {
120
+ resetLabel?: string;
121
+ }
122
+ export declare function connect<S>(get: (s: S) => ImageCropperState, send: Send<ImageCropperMsg>, opts?: ConnectOptions): ImageCropperParts<S>;
123
+ export declare const imageCropper: {
124
+ init: typeof init;
125
+ update: typeof update;
126
+ connect: typeof connect;
127
+ centerFill: typeof centerFill;
128
+ };
129
+ //# sourceMappingURL=image-cropper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-cropper.d.ts","sourceRoot":"","sources":["../../src/components/image-cropper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;;;;;;;;GASG;AAEH,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE5E,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,IAAI,EAAE,QAAQ,CAAA;IACd,sFAAsF;IACtF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAA;IAC7B,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAC;IA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xB,iBAAiB,CAAC,CAAC,CAAC,CA+CtB;AAED,eAAO,MAAM,YAAY;;;;;CAAwC,CAAA"}
@@ -0,0 +1,208 @@
1
+ function clamp(v, min, max) {
2
+ return Math.max(min, Math.min(max, v));
3
+ }
4
+ function clampCrop(crop, image) {
5
+ const width = clamp(crop.width, 0, image.width);
6
+ const height = clamp(crop.height, 0, image.height);
7
+ const x = clamp(crop.x, 0, image.width - width);
8
+ const y = clamp(crop.y, 0, image.height - height);
9
+ return { x, y, width, height };
10
+ }
11
+ function enforceAspectRatio(crop, ratio) {
12
+ if (ratio === null)
13
+ return crop;
14
+ // Keep width; compute height from ratio.
15
+ const height = crop.width / ratio;
16
+ return { ...crop, height };
17
+ }
18
+ /**
19
+ * Compute the largest centered crop that fits `image` while respecting the
20
+ * aspect ratio (if any).
21
+ */
22
+ export function centerFill(image, aspectRatio) {
23
+ if (aspectRatio === null) {
24
+ return { x: 0, y: 0, width: image.width, height: image.height };
25
+ }
26
+ const imgRatio = image.width / image.height;
27
+ let width, height;
28
+ if (aspectRatio > imgRatio) {
29
+ width = image.width;
30
+ height = width / aspectRatio;
31
+ }
32
+ else {
33
+ height = image.height;
34
+ width = height * aspectRatio;
35
+ }
36
+ return {
37
+ x: (image.width - width) / 2,
38
+ y: (image.height - height) / 2,
39
+ width,
40
+ height,
41
+ };
42
+ }
43
+ export function init(opts = {}) {
44
+ const image = opts.image ?? { width: 0, height: 0 };
45
+ const aspectRatio = opts.aspectRatio ?? null;
46
+ const crop = opts.crop ?? centerFill(image, aspectRatio);
47
+ return {
48
+ image,
49
+ crop: clampCrop(crop, image),
50
+ aspectRatio,
51
+ minSize: opts.minSize ?? 20,
52
+ dragging: false,
53
+ resizing: null,
54
+ disabled: opts.disabled ?? false,
55
+ };
56
+ }
57
+ function applyResize(state, dx, dy, handle) {
58
+ let { x, y, width, height } = state.crop;
59
+ if (handle.includes('e'))
60
+ width += dx;
61
+ if (handle.includes('w')) {
62
+ width -= dx;
63
+ x += dx;
64
+ }
65
+ if (handle.includes('s'))
66
+ height += dy;
67
+ if (handle.includes('n')) {
68
+ height -= dy;
69
+ y += dy;
70
+ }
71
+ // Aspect ratio: if set, let the axis with the bigger delta drive the
72
+ // other, keeping the handle's corner anchored.
73
+ if (state.aspectRatio !== null) {
74
+ const isHoriz = handle === 'e' || handle === 'w';
75
+ const isVert = handle === 'n' || handle === 's';
76
+ if (isHoriz) {
77
+ const newHeight = width / state.aspectRatio;
78
+ // Keep vertical center.
79
+ y = state.crop.y + (state.crop.height - newHeight) / 2;
80
+ height = newHeight;
81
+ }
82
+ else if (isVert) {
83
+ const newWidth = height * state.aspectRatio;
84
+ x = state.crop.x + (state.crop.width - newWidth) / 2;
85
+ width = newWidth;
86
+ }
87
+ else {
88
+ // Corner: use the axis with the larger pointer delta (expressed in
89
+ // width-equivalent units) to drive the other. This keeps the thumb
90
+ // tracking the pointer linearly instead of snapping to whichever
91
+ // current dimension happens to match the aspect ratio closer.
92
+ const dw = width - state.crop.width;
93
+ const dh = height - state.crop.height;
94
+ const dhAsDw = dh * state.aspectRatio;
95
+ if (Math.abs(dw) >= Math.abs(dhAsDw)) {
96
+ // Width leads; derive height, re-anchor top if resizing from north.
97
+ height = width / state.aspectRatio;
98
+ if (handle.includes('n'))
99
+ y = state.crop.y + (state.crop.height - height);
100
+ }
101
+ else {
102
+ // Height leads; derive width, re-anchor left if resizing from west.
103
+ width = height * state.aspectRatio;
104
+ if (handle.includes('w'))
105
+ x = state.crop.x + (state.crop.width - width);
106
+ }
107
+ }
108
+ }
109
+ // Enforce min size + clamp to image.
110
+ if (width < state.minSize)
111
+ width = state.minSize;
112
+ if (height < state.minSize)
113
+ height = state.minSize;
114
+ return { ...state, crop: clampCrop({ x, y, width, height }, state.image) };
115
+ }
116
+ export function update(state, msg) {
117
+ if (state.disabled && msg.type !== 'setImage' && msg.type !== 'reset') {
118
+ return [state, []];
119
+ }
120
+ switch (msg.type) {
121
+ case 'setImage': {
122
+ const image = { width: msg.width, height: msg.height };
123
+ const crop = centerFill(image, state.aspectRatio);
124
+ return [{ ...state, image, crop }, []];
125
+ }
126
+ case 'setCrop':
127
+ return [{ ...state, crop: clampCrop(msg.crop, state.image) }, []];
128
+ case 'setAspectRatio': {
129
+ const next = enforceAspectRatio(state.crop, msg.ratio);
130
+ return [{ ...state, aspectRatio: msg.ratio, crop: clampCrop(next, state.image) }, []];
131
+ }
132
+ case 'dragStart':
133
+ return [{ ...state, dragging: true }, []];
134
+ case 'dragMove': {
135
+ if (!state.dragging)
136
+ return [state, []];
137
+ const crop = {
138
+ ...state.crop,
139
+ x: state.crop.x + msg.dx,
140
+ y: state.crop.y + msg.dy,
141
+ };
142
+ return [{ ...state, crop: clampCrop(crop, state.image) }, []];
143
+ }
144
+ case 'dragEnd':
145
+ return [{ ...state, dragging: false }, []];
146
+ case 'resizeStart':
147
+ return [{ ...state, resizing: msg.handle }, []];
148
+ case 'resizeMove':
149
+ if (state.resizing === null)
150
+ return [state, []];
151
+ return [applyResize(state, msg.dx, msg.dy, state.resizing), []];
152
+ case 'resizeEnd':
153
+ return [{ ...state, resizing: null }, []];
154
+ case 'reset':
155
+ case 'centerFill':
156
+ return [{ ...state, crop: centerFill(state.image, state.aspectRatio) }, []];
157
+ }
158
+ }
159
+ export function connect(get, send, opts = {}) {
160
+ return {
161
+ root: {
162
+ 'data-scope': 'image-cropper',
163
+ 'data-part': 'root',
164
+ 'data-dragging': (s) => (get(s).dragging ? '' : undefined),
165
+ 'data-resizing': (s) => (get(s).resizing !== null ? '' : undefined),
166
+ 'data-disabled': (s) => (get(s).disabled ? '' : undefined),
167
+ },
168
+ image: {
169
+ 'data-scope': 'image-cropper',
170
+ 'data-part': 'image',
171
+ onLoad: (e) => {
172
+ const img = e.target;
173
+ send({ type: 'setImage', width: img.naturalWidth, height: img.naturalHeight });
174
+ },
175
+ draggable: false,
176
+ },
177
+ cropBox: {
178
+ 'data-scope': 'image-cropper',
179
+ 'data-part': 'crop-box',
180
+ style: (s) => {
181
+ const st = get(s);
182
+ if (st.image.width === 0 || st.image.height === 0)
183
+ return 'display:none;';
184
+ // Express as percentages so the crop box scales with the rendered image.
185
+ const xp = (st.crop.x / st.image.width) * 100;
186
+ const yp = (st.crop.y / st.image.height) * 100;
187
+ const wp = (st.crop.width / st.image.width) * 100;
188
+ const hp = (st.crop.height / st.image.height) * 100;
189
+ return `left:${xp}%;top:${yp}%;width:${wp}%;height:${hp}%;`;
190
+ },
191
+ onPointerDown: () => send({ type: 'dragStart' }),
192
+ },
193
+ resizeHandle: (handle) => ({
194
+ 'data-scope': 'image-cropper',
195
+ 'data-part': 'resize-handle',
196
+ 'data-handle': handle,
197
+ onPointerDown: () => send({ type: 'resizeStart', handle }),
198
+ }),
199
+ resetTrigger: {
200
+ type: 'button',
201
+ 'aria-label': opts.resetLabel ?? 'Reset crop',
202
+ 'data-scope': 'image-cropper',
203
+ 'data-part': 'reset-trigger',
204
+ onClick: () => send({ type: 'reset' }),
205
+ },
206
+ };
207
+ }
208
+ export const imageCropper = { init, update, connect, centerFill };
@@ -0,0 +1,109 @@
1
+ export * as toggle from './toggle';
2
+ export * as checkbox from './checkbox';
3
+ export * as accordion from './accordion';
4
+ export * as tabs from './tabs';
5
+ export * as slider from './slider';
6
+ export * as dialog from './dialog';
7
+ export * as popover from './popover';
8
+ export * as tooltip from './tooltip';
9
+ export * as menu from './menu';
10
+ export * as switchMachine from './switch';
11
+ export * as radioGroup from './radio-group';
12
+ export * as collapsible from './collapsible';
13
+ export * as toggleGroup from './toggle-group';
14
+ export * as numberInput from './number-input';
15
+ export * as pinInput from './pin-input';
16
+ export * as progress from './progress';
17
+ export * as ratingGroup from './rating-group';
18
+ export * as pagination from './pagination';
19
+ export * as alertDialog from './alert-dialog';
20
+ export * as drawer from './drawer';
21
+ export * as toast from './toast';
22
+ export * as listbox from './listbox';
23
+ export * as select from './select';
24
+ export * as combobox from './combobox';
25
+ export * as hoverCard from './hover-card';
26
+ export * as avatar from './avatar';
27
+ export * as clipboard from './clipboard';
28
+ export * as editable from './editable';
29
+ export * as tagsInput from './tags-input';
30
+ export * as splitter from './splitter';
31
+ export * as fileUpload from './file-upload';
32
+ export * as treeView from './tree-view';
33
+ export * as contextMenu from './context-menu';
34
+ export * as passwordInput from './password-input';
35
+ export * as steps from './steps';
36
+ export * as timePicker from './time-picker';
37
+ export * as carousel from './carousel';
38
+ export * as datePicker from './date-picker';
39
+ export * as colorPicker from './color-picker';
40
+ export * as timer from './timer';
41
+ export * as angleSlider from './angle-slider';
42
+ export * as marquee from './marquee';
43
+ export * as presence from './presence';
44
+ export * as signaturePad from './signature-pad';
45
+ export * as toc from './toc';
46
+ export * as tour from './tour';
47
+ export * as dateInput from './date-input';
48
+ export * as asyncList from './async-list';
49
+ export * as cascadeSelect from './cascade-select';
50
+ export * as scrollArea from './scroll-area';
51
+ export * as floatingPanel from './floating-panel';
52
+ export * as imageCropper from './image-cropper';
53
+ export * as navigationMenu from './navigation-menu';
54
+ export * as qrCode from './qr-code';
55
+ export type { TimerState, TimerMsg, TimerInit, TimerParts, Direction as TimerDirection, } from './timer';
56
+ export type { AngleSliderState, AngleSliderMsg, AngleSliderInit, AngleSliderParts, } from './angle-slider';
57
+ export type { MarqueeState, MarqueeMsg, MarqueeInit, MarqueeParts, MarqueeDirection, } from './marquee';
58
+ export type { PresenceState, PresenceMsg, PresenceInit, PresenceParts, PresenceStatus, } from './presence';
59
+ export type { SignaturePadState, SignaturePadMsg, SignaturePadInit, SignaturePadParts, Point as SignaturePadPoint, Stroke as SignatureStroke, } from './signature-pad';
60
+ export type { TocState, TocMsg, TocInit, TocParts, TocEntry } from './toc';
61
+ export type { TourState, TourMsg, TourInit, TourParts, TourStep } from './tour';
62
+ export type { DateInputState, DateInputMsg, DateInputInit, DateInputParts, DateError, } from './date-input';
63
+ export type { AsyncListState, AsyncListMsg, AsyncListInit, AsyncListParts, AsyncStatus, } from './async-list';
64
+ export type { CascadeSelectState, CascadeSelectMsg, CascadeSelectInit, CascadeSelectParts, CascadeLevel, CascadeLevelParts, } from './cascade-select';
65
+ export type { ScrollAreaState, ScrollAreaMsg, ScrollAreaInit, ScrollAreaParts, ScrollbarVisibility, ScrollDims, } from './scroll-area';
66
+ export type { FloatingPanelState, FloatingPanelMsg, FloatingPanelInit, FloatingPanelParts, ResizeHandle as FloatingPanelHandle, } from './floating-panel';
67
+ export type { ImageCropperState, ImageCropperMsg, ImageCropperInit, ImageCropperParts, CropRect, } from './image-cropper';
68
+ export type { NavMenuState, NavMenuMsg, NavMenuInit, NavMenuParts, NavItemParts, } from './navigation-menu';
69
+ export type { QrCodeState, QrCodeMsg, QrCodeInit, QrCodeParts, ErrorCorrectionLevel, } from './qr-code';
70
+ export type { ToggleState, ToggleMsg, ToggleInit, ToggleParts } from './toggle';
71
+ export type { CheckboxState, CheckboxMsg, CheckboxInit, CheckboxParts, CheckedState, } from './checkbox';
72
+ export type { AccordionState, AccordionMsg, AccordionInit, AccordionParts, AccordionItemParts, } from './accordion';
73
+ export type { TabsState, TabsMsg, TabsInit, TabsParts, TabsItemParts, Activation } from './tabs';
74
+ export type { SliderState, SliderMsg, SliderInit, SliderParts, SliderThumbParts } from './slider';
75
+ export type { DialogState, DialogMsg, DialogInit, DialogParts, OverlayOptions as DialogOverlayOptions, } from './dialog';
76
+ export type { PopoverState, PopoverMsg, PopoverInit, PopoverParts, OverlayOptions as PopoverOverlayOptions, } from './popover';
77
+ export type { TooltipState, TooltipMsg, TooltipInit, TooltipParts, OverlayOptions as TooltipOverlayOptions, } from './tooltip';
78
+ export type { MenuState, MenuMsg, MenuInit, MenuParts, MenuItemParts, OverlayOptions as MenuOverlayOptions, } from './menu';
79
+ export type { SwitchState, SwitchMsg, SwitchInit, SwitchParts } from './switch';
80
+ export type { RadioGroupState, RadioGroupMsg, RadioGroupInit, RadioGroupParts, RadioItemParts, } from './radio-group';
81
+ export type { CollapsibleState, CollapsibleMsg, CollapsibleInit, CollapsibleParts, } from './collapsible';
82
+ export type { ToggleGroupState, ToggleGroupMsg, ToggleGroupInit, ToggleGroupParts, ToggleGroupItemParts, } from './toggle-group';
83
+ export type { NumberInputState, NumberInputMsg, NumberInputInit, NumberInputParts, } from './number-input';
84
+ export type { PinInputState, PinInputMsg, PinInputInit, PinInputParts, PinType } from './pin-input';
85
+ export type { ProgressState, ProgressMsg, ProgressInit, ProgressParts } from './progress';
86
+ export type { RatingGroupState, RatingGroupMsg, RatingGroupInit, RatingGroupParts, RatingItemParts, ItemFill, } from './rating-group';
87
+ export type { PaginationState, PaginationMsg, PaginationInit, PaginationParts, PageItem, } from './pagination';
88
+ export type { AlertDialogState, AlertDialogMsg, AlertDialogParts, AlertDialogConnectOptions, AlertDialogOverlayOptions, } from './alert-dialog';
89
+ export type { DrawerState, DrawerMsg, DrawerInit, DrawerParts, DrawerSide, OverlayOptions as DrawerOverlayOptions, } from './drawer';
90
+ export type { Toast, ToasterState, ToasterMsg, ToasterInit, ToasterParts, ToastItemParts, ToastType, ToastPlacement, } from './toast';
91
+ export type { ListboxState, ListboxMsg, ListboxInit, ListboxParts, ListboxItemParts, SelectionMode, } from './listbox';
92
+ export type { SelectState, SelectMsg, SelectInit, SelectParts, SelectItemParts, OverlayOptions as SelectOverlayOptions, } from './select';
93
+ export type { ComboboxState, ComboboxMsg, ComboboxInit, ComboboxParts, ComboboxItemParts, OverlayOptions as ComboboxOverlayOptions, } from './combobox';
94
+ export type { HoverCardState, HoverCardMsg, HoverCardInit, HoverCardParts, OverlayOptions as HoverCardOverlayOptions, } from './hover-card';
95
+ export type { AvatarState, AvatarMsg, AvatarInit, AvatarParts, ImageStatus } from './avatar';
96
+ export type { ClipboardState, ClipboardMsg, ClipboardInit, ClipboardParts } from './clipboard';
97
+ export type { EditableState, EditableMsg, EditableInit, EditableParts } from './editable';
98
+ export type { TagsInputState, TagsInputMsg, TagsInputInit, TagsInputParts, TagItemParts, } from './tags-input';
99
+ export type { SplitterState, SplitterMsg, SplitterInit, SplitterParts } from './splitter';
100
+ export type { FileUploadState, FileUploadMsg, FileUploadInit, FileUploadParts, FileUploadItemParts, } from './file-upload';
101
+ export type { TreeViewState, TreeViewMsg, TreeViewInit, TreeViewParts, TreeItemParts, } from './tree-view';
102
+ export type { ContextMenuState, ContextMenuMsg, ContextMenuInit, ContextMenuParts, ContextMenuItemParts, OverlayOptions as ContextMenuOverlayOptions, } from './context-menu';
103
+ export type { PasswordInputState, PasswordInputMsg, PasswordInputInit, PasswordInputParts, } from './password-input';
104
+ export type { StepsState, StepsMsg, StepsInit, StepsParts, StepsItemParts, StepStatus, } from './steps';
105
+ export type { TimePickerState, TimePickerMsg, TimePickerInit, TimePickerParts, TimeValue, TimeFormat, } from './time-picker';
106
+ export type { CarouselState, CarouselMsg, CarouselInit, CarouselParts, CarouselSlideParts, } from './carousel';
107
+ export type { DatePickerState, DatePickerMsg, DatePickerInit, DatePickerParts, DayCellParts, DayCell, } from './date-picker';
108
+ export type { ColorPickerState, ColorPickerMsg, ColorPickerInit, ColorPickerParts, Hsl, } from './color-picker';
109
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAA;AAC9B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAA;AAC9B,OAAO,KAAK,aAAa,MAAM,UAAU,CAAA;AACzC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,WAAW,MAAM,eAAe,C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AAa,EAAE,MAAM,YAAY,CAAA;AACzF,YAAY,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AACzF,YAAY,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,GACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,IAAI,yBAAyB,GAC5C,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAA;AAChB,YAAY,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,OAAO,GACR,MAAM,eAAe,CAAA;AACtB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,GAAG,GACJ,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,54 @@
1
+ export * as toggle from './toggle';
2
+ export * as checkbox from './checkbox';
3
+ export * as accordion from './accordion';
4
+ export * as tabs from './tabs';
5
+ export * as slider from './slider';
6
+ export * as dialog from './dialog';
7
+ export * as popover from './popover';
8
+ export * as tooltip from './tooltip';
9
+ export * as menu from './menu';
10
+ export * as switchMachine from './switch';
11
+ export * as radioGroup from './radio-group';
12
+ export * as collapsible from './collapsible';
13
+ export * as toggleGroup from './toggle-group';
14
+ export * as numberInput from './number-input';
15
+ export * as pinInput from './pin-input';
16
+ export * as progress from './progress';
17
+ export * as ratingGroup from './rating-group';
18
+ export * as pagination from './pagination';
19
+ export * as alertDialog from './alert-dialog';
20
+ export * as drawer from './drawer';
21
+ export * as toast from './toast';
22
+ export * as listbox from './listbox';
23
+ export * as select from './select';
24
+ export * as combobox from './combobox';
25
+ export * as hoverCard from './hover-card';
26
+ export * as avatar from './avatar';
27
+ export * as clipboard from './clipboard';
28
+ export * as editable from './editable';
29
+ export * as tagsInput from './tags-input';
30
+ export * as splitter from './splitter';
31
+ export * as fileUpload from './file-upload';
32
+ export * as treeView from './tree-view';
33
+ export * as contextMenu from './context-menu';
34
+ export * as passwordInput from './password-input';
35
+ export * as steps from './steps';
36
+ export * as timePicker from './time-picker';
37
+ export * as carousel from './carousel';
38
+ export * as datePicker from './date-picker';
39
+ export * as colorPicker from './color-picker';
40
+ export * as timer from './timer';
41
+ export * as angleSlider from './angle-slider';
42
+ export * as marquee from './marquee';
43
+ export * as presence from './presence';
44
+ export * as signaturePad from './signature-pad';
45
+ export * as toc from './toc';
46
+ export * as tour from './tour';
47
+ export * as dateInput from './date-input';
48
+ export * as asyncList from './async-list';
49
+ export * as cascadeSelect from './cascade-select';
50
+ export * as scrollArea from './scroll-area';
51
+ export * as floatingPanel from './floating-panel';
52
+ export * as imageCropper from './image-cropper';
53
+ export * as navigationMenu from './navigation-menu';
54
+ export * as qrCode from './qr-code';
@@ -0,0 +1,98 @@
1
+ import type { Send } from '@llui/dom';
2
+ /**
3
+ * Listbox — a list of selectable options. Supports single and multiple
4
+ * selection, keyboard navigation (arrows, Home, End), typeahead, and
5
+ * disabled items. Renders as `role="listbox"` with `role="option"` items.
6
+ */
7
+ export type SelectionMode = 'single' | 'multiple';
8
+ export interface ListboxState {
9
+ value: string[];
10
+ items: string[];
11
+ disabledItems: string[];
12
+ disabled: boolean;
13
+ selectionMode: SelectionMode;
14
+ highlightedIndex: number | null;
15
+ typeahead: string;
16
+ typeaheadExpiresAt: number;
17
+ }
18
+ export type ListboxMsg = {
19
+ type: 'select';
20
+ value: string;
21
+ } | {
22
+ type: 'setValue';
23
+ value: string[];
24
+ } | {
25
+ type: 'clear';
26
+ } | {
27
+ type: 'highlight';
28
+ index: number | null;
29
+ } | {
30
+ type: 'highlightNext';
31
+ } | {
32
+ type: 'highlightPrev';
33
+ } | {
34
+ type: 'highlightFirst';
35
+ } | {
36
+ type: 'highlightLast';
37
+ } | {
38
+ type: 'selectHighlighted';
39
+ } | {
40
+ type: 'setItems';
41
+ items: string[];
42
+ disabled?: string[];
43
+ } | {
44
+ type: 'typeahead';
45
+ char: string;
46
+ now: number;
47
+ };
48
+ export interface ListboxInit {
49
+ value?: string[];
50
+ items?: string[];
51
+ disabledItems?: string[];
52
+ disabled?: boolean;
53
+ selectionMode?: SelectionMode;
54
+ }
55
+ export declare function init(opts?: ListboxInit): ListboxState;
56
+ export declare function update(state: ListboxState, msg: ListboxMsg): [ListboxState, never[]];
57
+ export interface ListboxItemParts<S> {
58
+ root: {
59
+ role: 'option';
60
+ id: string;
61
+ 'aria-selected': (s: S) => boolean;
62
+ 'aria-disabled': (s: S) => 'true' | undefined;
63
+ 'data-state': (s: S) => 'selected' | undefined;
64
+ 'data-highlighted': (s: S) => '' | undefined;
65
+ 'data-disabled': (s: S) => '' | undefined;
66
+ 'data-scope': 'listbox';
67
+ 'data-part': 'item';
68
+ 'data-value': string;
69
+ 'data-index': string;
70
+ onClick: (e: MouseEvent) => void;
71
+ onPointerMove: (e: PointerEvent) => void;
72
+ };
73
+ }
74
+ export interface ListboxParts<S> {
75
+ root: {
76
+ role: 'listbox';
77
+ 'aria-multiselectable': (s: S) => 'true' | undefined;
78
+ 'aria-disabled': (s: S) => 'true' | undefined;
79
+ 'aria-activedescendant': (s: S) => string | undefined;
80
+ tabIndex: (s: S) => number;
81
+ id: string;
82
+ 'data-scope': 'listbox';
83
+ 'data-part': 'root';
84
+ 'data-disabled': (s: S) => '' | undefined;
85
+ onKeyDown: (e: KeyboardEvent) => void;
86
+ };
87
+ item: (value: string, index: number) => ListboxItemParts<S>;
88
+ }
89
+ export interface ConnectOptions {
90
+ id: string;
91
+ }
92
+ export declare function connect<S>(get: (s: S) => ListboxState, send: Send<ListboxMsg>, opts: ConnectOptions): ListboxParts<S>;
93
+ export declare const listbox: {
94
+ init: typeof init;
95
+ update: typeof update;
96
+ connect: typeof connect;
97
+ };
98
+ //# sourceMappingURL=listbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/components/listbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAQrC;;;;GAIG;AAEH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,CAAA;AAEjD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,aAAa,CAAA;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,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