@jini-ai/ui 0.5.5 → 0.5.6

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 (263) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/core/theme/validation.js +40 -38
  3. package/dist/features/a2ui/renderer.js +15 -13
  4. package/dist/features/about/react/components/AboutTab.js +64 -34
  5. package/dist/features/about/rules.d.ts +2 -2
  6. package/dist/features/about/rules.js +156 -129
  7. package/dist/features/admin-widgets/components/ImagePreviewModal.d.ts +4 -3
  8. package/dist/features/admin-widgets/components/ImagePreviewModal.js +6 -10
  9. package/dist/features/admin-widgets/components/InfoTip.d.ts +3 -2
  10. package/dist/features/admin-widgets/components/InfoTip.hooks.js +2 -0
  11. package/dist/features/admin-widgets/components/InfoTip.js +34 -7
  12. package/dist/features/admin-widgets/components/InfoTip.rules.d.ts +13 -0
  13. package/dist/features/admin-widgets/components/InfoTip.rules.js +43 -10
  14. package/dist/features/admin-widgets/components/Lightbox/Lightbox.d.ts +30 -0
  15. package/dist/features/admin-widgets/components/Lightbox/Lightbox.hooks.d.ts +40 -0
  16. package/dist/features/admin-widgets/components/Lightbox/Lightbox.hooks.js +128 -0
  17. package/dist/features/admin-widgets/components/Lightbox/Lightbox.js +18 -0
  18. package/dist/features/admin-widgets/components/MiddleTruncate.d.ts +14 -0
  19. package/dist/features/admin-widgets/components/MiddleTruncate.js +12 -0
  20. package/dist/features/admin-widgets/components/MiddleTruncate.rules.d.ts +20 -0
  21. package/dist/features/admin-widgets/components/MiddleTruncate.rules.js +21 -0
  22. package/dist/features/admin-widgets/components/ScrollJump/ScrollJump.d.ts +18 -0
  23. package/dist/features/admin-widgets/components/ScrollJump/ScrollJump.hooks.d.ts +16 -0
  24. package/dist/features/admin-widgets/components/ScrollJump/ScrollJump.hooks.js +45 -0
  25. package/dist/features/admin-widgets/components/ScrollJump/ScrollJump.js +18 -0
  26. package/dist/features/admin-widgets/components/ScrollJump/ScrollJump.rules.d.ts +32 -0
  27. package/dist/features/admin-widgets/components/ScrollJump/ScrollJump.rules.js +26 -0
  28. package/dist/features/admin-widgets/components/SuggestInput/SuggestInput.hooks.js +29 -14
  29. package/dist/features/admin-widgets/index.d.ts +14 -2
  30. package/dist/features/admin-widgets/index.js +7 -1
  31. package/dist/features/admin-widgets/styles/admin-widgets.css +1 -0
  32. package/dist/features/asset-grid/react/components/AssetCard.js +7 -1
  33. package/dist/features/asset-grid/react/components/AssetGrid.d.ts +1 -1
  34. package/dist/features/asset-grid/react/components/AssetGrid.js +38 -18
  35. package/dist/features/asset-grid/react/components/useAssetGridFilters.d.ts +21 -0
  36. package/dist/features/asset-grid/react/components/useAssetGridFilters.js +19 -0
  37. package/dist/features/asset-grid/react/hooks/useAssetGridKeyboardShortcuts.js +16 -11
  38. package/dist/features/asset-grid/react/hooks/useAssetGridLiveUpdates.d.ts +2 -0
  39. package/dist/features/asset-grid/react/hooks/useAssetGridLiveUpdates.js +35 -11
  40. package/dist/features/asset-tree-browser/react/components/AssetTreeBrowser.d.ts +6 -6
  41. package/dist/features/asset-tree-browser/react/components/AssetTreeBrowser.js +10 -129
  42. package/dist/features/asset-tree-browser/react/components/AssetTreeBrowserParts.d.ts +50 -0
  43. package/dist/features/asset-tree-browser/react/components/AssetTreeBrowserParts.js +95 -0
  44. package/dist/features/asset-tree-browser/react/components/useAssetTreeBrowserController.d.ts +56 -0
  45. package/dist/features/asset-tree-browser/react/components/useAssetTreeBrowserController.js +80 -0
  46. package/dist/features/asset-tree-browser/rules.js +40 -22
  47. package/dist/features/browser-chrome/rules.js +74 -70
  48. package/dist/features/charts/browser.js +11 -5
  49. package/dist/features/charts/react.js +2 -2
  50. package/dist/features/charts/table.js +2 -2
  51. package/dist/features/command-palette/react/hooks/useCommandPalette.js +3 -9
  52. package/dist/features/connectors/ConnectorsBrowser.d.ts +4 -4
  53. package/dist/features/connectors/ConnectorsBrowser.js +26 -14
  54. package/dist/features/connectors/components/ConnectorCard.js +67 -38
  55. package/dist/features/connectors/components/ConnectorDetailDrawer.js +62 -31
  56. package/dist/features/connectors/components/ConnectorGrid.js +11 -6
  57. package/dist/features/connectors/hooks/useConnectorAuthorization.js +6 -0
  58. package/dist/features/connectors/hooks/useConnectorCatalog.d.ts +2 -0
  59. package/dist/features/connectors/hooks/useConnectorCatalog.js +32 -13
  60. package/dist/features/connectors/hooks/useWiredConnectorsBrowser.d.ts +3 -3
  61. package/dist/features/connectors/rules.d.ts +8 -1
  62. package/dist/features/connectors/rules.js +42 -20
  63. package/dist/features/connectors/types.d.ts +11 -0
  64. package/dist/features/execution/constants.d.ts +4 -10
  65. package/dist/features/execution/constants.js +9 -94
  66. package/dist/features/execution/react/components/ByokProviderForm.d.ts +2 -4
  67. package/dist/features/execution/react/components/ByokProviderForm.js +140 -43
  68. package/dist/features/execution/react/components/ExecutionTab.d.ts +1 -2
  69. package/dist/features/execution/react/components/ExecutionTab.js +52 -30
  70. package/dist/features/execution/react/components/LocalCliAgentCard.js +12 -3
  71. package/dist/features/execution/react/components/LocalCliAgentList.js +14 -3
  72. package/dist/features/execution/react/components/LocalCliAgentSettings.js +14 -3
  73. package/dist/features/execution/react/hooks/useLocalCliAgentCard.js +54 -36
  74. package/dist/features/execution/react/hooks/useReasoningControl.js +114 -78
  75. package/dist/features/execution/rules.d.ts +2 -2
  76. package/dist/features/execution/rules.js +31 -15
  77. package/dist/features/execution/types.d.ts +4 -42
  78. package/dist/features/execution/types.js +0 -17
  79. package/dist/features/external-mcp/react/components/ExternalMcpTab.d.ts +6 -2
  80. package/dist/features/external-mcp/react/components/ExternalMcpTab.js +9 -2
  81. package/dist/features/file-dropzone/react/components/FileDropzone.js +24 -25
  82. package/dist/features/file-dropzone/react/components/FileDropzoneLightbox.d.ts +2 -2
  83. package/dist/features/file-dropzone/react/components/FileDropzoneLightbox.js +35 -30
  84. package/dist/features/file-dropzone/react/components/FileDropzoneThumbnailGrid.js +30 -24
  85. package/dist/features/file-dropzone/react/components/FileDropzoneZone.d.ts +14 -0
  86. package/dist/features/file-dropzone/react/components/FileDropzoneZone.js +26 -0
  87. package/dist/features/html-editor/canvas-content-wrapper.js +13 -13
  88. package/dist/features/html-editor/canvas-embed-placeholders.js +46 -37
  89. package/dist/features/html-editor/css.js +76 -69
  90. package/dist/features/html-editor/editor-blocks.js +47 -33
  91. package/dist/features/html-editor/editor-serialization.js +6 -5
  92. package/dist/features/html-editor/protected-elements.js +39 -28
  93. package/dist/features/html-editor/react/hooks/useInteractiveHtmlEditor.js +4 -4
  94. package/dist/features/html-editor/source-splice.js +51 -30
  95. package/dist/features/i18n/dictionaries/settings-dialog.ja.js +1 -0
  96. package/dist/features/i18n/dictionaries/settings-dialog.zh-CN.js +1 -0
  97. package/dist/features/i18n/dictionaries/settings-dialog.zh-TW.js +1 -0
  98. package/dist/features/i18n/locale.js +20 -16
  99. package/dist/features/iframe-pool/react/dom-sync.js +8 -6
  100. package/dist/features/integrations/react/components/CodexInstallToggleButton.js +19 -4
  101. package/dist/features/integrations/react/components/IntegrationsTab.js +60 -14
  102. package/dist/features/interactive-ui/interactive-ui.css +1 -1
  103. package/dist/features/interactive-ui/providers/shadcn/data-table.js +10 -7
  104. package/dist/features/lexical-rich-text-editor/mention-parser.js +60 -57
  105. package/dist/features/lexical-rich-text-editor/react/hooks/useKeyboardCommands.js +33 -38
  106. package/dist/features/lexical-rich-text-editor/rules.js +87 -74
  107. package/dist/features/lexical-rich-text-editor/serialize.js +27 -25
  108. package/dist/features/mcp-ui/secret-card.js +111 -61
  109. package/dist/features/mcp-ui/surfaces/confirmation.js +39 -21
  110. package/dist/features/mcp-ui/surfaces/document.d.ts +1 -1
  111. package/dist/features/mcp-ui/surfaces/document.js +10 -2
  112. package/dist/features/mcp-ui/surfaces/fields.js +30 -50
  113. package/dist/features/mcp-ui/surfaces/form.d.ts +6 -0
  114. package/dist/features/mcp-ui/surfaces/form.js +43 -21
  115. package/dist/features/mcp-ui/surfaces/outcome.js +30 -20
  116. package/dist/features/mcp-ui/surfaces/text-input.js +33 -21
  117. package/dist/features/mcp-ui/surfaces/tokens.d.ts +6 -1
  118. package/dist/features/mcp-ui/surfaces/tokens.js +5 -2
  119. package/dist/features/media-providers/constants.d.ts +1 -0
  120. package/dist/features/media-providers/constants.js +2 -81
  121. package/dist/features/media-providers/index.d.ts +1 -1
  122. package/dist/features/media-providers/ports.d.ts +2 -0
  123. package/dist/features/media-providers/react/components/MediaProviderCard.d.ts +22 -0
  124. package/dist/features/media-providers/react/components/MediaProviderCard.js +50 -0
  125. package/dist/features/media-providers/react/components/MediaProvidersTab.d.ts +5 -6
  126. package/dist/features/media-providers/react/components/MediaProvidersTab.js +40 -72
  127. package/dist/features/media-providers/react/components/media-providers-tab-labels.d.ts +11 -0
  128. package/dist/features/media-providers/react/components/media-providers-tab-labels.js +57 -0
  129. package/dist/features/media-providers/react/hooks/useMediaProvidersTab.d.ts +4 -2
  130. package/dist/features/media-providers/react/hooks/useMediaProvidersTab.js +37 -23
  131. package/dist/features/media-providers/rules.js +17 -10
  132. package/dist/features/media-providers/types.d.ts +4 -22
  133. package/dist/features/media-providers/types.js +3 -8
  134. package/dist/features/memory/formatters.js +127 -92
  135. package/dist/features/memory/react/components/MemoryConnectedPanel.js +92 -36
  136. package/dist/features/memory/react/components/MemoryList.js +37 -18
  137. package/dist/features/memory/react/hooks/useMemoryExtractions.store.js +42 -36
  138. package/dist/features/notifications/react/components/NotificationsTab.js +28 -28
  139. package/dist/features/observability/long-task.d.ts +0 -12
  140. package/dist/features/observability/long-task.js +15 -19
  141. package/dist/features/observability/resource-error.d.ts +0 -10
  142. package/dist/features/observability/resource-error.js +18 -13
  143. package/dist/features/observability/stuck-run.js +10 -6
  144. package/dist/features/observability/telemetry-url.d.ts +6 -0
  145. package/dist/features/observability/telemetry-url.js +16 -0
  146. package/dist/features/observability/white-screen.js +12 -24
  147. package/dist/features/panel-kit/fetch-query/adapter.react.d.ts +2 -2
  148. package/dist/features/panel-kit/fetch-query/adapter.react.js +4 -2
  149. package/dist/features/panel-kit/fetch-query/adapter.tanstack.js +46 -33
  150. package/dist/features/panel-kit/helpers/standing-draft-local-backup.js +3 -1
  151. package/dist/features/panel-kit/hooks/use-settings-slice.hooks.js +3 -1
  152. package/dist/features/privacy/react/components/PrivacyTab.js +24 -13
  153. package/dist/features/progress-card/components/ProgressCard.js +7 -3
  154. package/dist/features/progress-card/reference-adapters.js +59 -54
  155. package/dist/features/project-locations/react/components/ProjectLocationsTab.js +24 -15
  156. package/dist/features/project-locations/react/hooks/useProjectLocationsTab.d.ts +8 -0
  157. package/dist/features/project-locations/react/hooks/useProjectLocationsTab.js +31 -23
  158. package/dist/features/resource-dashboard/react/components/ResourceBoard.js +6 -47
  159. package/dist/features/resource-dashboard/react/components/ResourceBoardView.d.ts +2 -2
  160. package/dist/features/resource-dashboard/react/components/ResourceBoardView.js +3 -6
  161. package/dist/features/resource-dashboard/react/components/ResourceBoardViewParts.d.ts +15 -0
  162. package/dist/features/resource-dashboard/react/components/ResourceBoardViewParts.js +35 -0
  163. package/dist/features/resource-dashboard/react/components/ResourceCard.js +5 -16
  164. package/dist/features/resource-dashboard/react/components/ResourceCardParts.d.ts +34 -0
  165. package/dist/features/resource-dashboard/react/components/ResourceCardParts.js +34 -0
  166. package/dist/features/resource-dashboard/react/components/ResourceRowList.js +3 -1
  167. package/dist/features/resource-dashboard/react/components/ResourceRowListItem.js +2 -2
  168. package/dist/features/resource-dashboard/react/components/ResourceRowListItemParts.d.ts +19 -0
  169. package/dist/features/resource-dashboard/react/components/ResourceRowListItemParts.js +11 -0
  170. package/dist/features/resource-dashboard/react/components/ResourceRowListView.d.ts +1 -1
  171. package/dist/features/resource-dashboard/react/components/ResourceRowListView.js +4 -4
  172. package/dist/features/resource-dashboard/react/components/ResourceRowListViewParts.d.ts +10 -0
  173. package/dist/features/resource-dashboard/react/components/ResourceRowListViewParts.js +20 -0
  174. package/dist/features/resource-dashboard/react/components/resourceBoardProps.d.ts +48 -0
  175. package/dist/features/resource-dashboard/react/components/resourceBoardProps.js +70 -0
  176. package/dist/features/resource-dashboard/react/components/resourceRowListProps.d.ts +19 -0
  177. package/dist/features/resource-dashboard/react/components/resourceRowListProps.js +14 -0
  178. package/dist/features/resource-dashboard/react/components/translatedErrorLabelProps.d.ts +16 -0
  179. package/dist/features/resource-dashboard/react/components/translatedErrorLabelProps.js +13 -0
  180. package/dist/features/resource-dashboard/rules.js +2 -8
  181. package/dist/features/sketch-editor/dom.js +150 -99
  182. package/dist/features/sketch-editor/react/components/SketchEditor.js +26 -15
  183. package/dist/features/skills/react/components/SkillDraftForm.js +13 -19
  184. package/dist/features/skills/react/components/SkillDraftForm.labels.d.ts +31 -0
  185. package/dist/features/skills/react/components/SkillDraftForm.labels.js +54 -0
  186. package/dist/features/skills/react/components/SkillRow.js +38 -18
  187. package/dist/features/skills/react/components/SkillRow.labels.d.ts +7 -0
  188. package/dist/features/skills/react/components/SkillRow.labels.js +18 -0
  189. package/dist/features/skills/react/components/SkillsTab.js +24 -14
  190. package/dist/features/skills/react/components/SkillsTab.labels.d.ts +7 -0
  191. package/dist/features/skills/react/components/SkillsTab.labels.js +11 -0
  192. package/dist/features/skills/rules.js +32 -23
  193. package/dist/features/source-config-list/agent-handles.js +2 -1
  194. package/dist/features/source-config-list/dependencies.js +53 -49
  195. package/dist/features/source-config-list/index.d.ts +3 -3
  196. package/dist/features/source-config-list/react/components/SourceConfigAddForm.d.ts +6 -5
  197. package/dist/features/source-config-list/react/components/SourceConfigAddForm.js +38 -7
  198. package/dist/features/source-config-list/react/components/SourceConfigField.js +69 -25
  199. package/dist/features/source-config-list/react/components/SourceConfigItemCard.d.ts +6 -5
  200. package/dist/features/source-config-list/react/components/SourceConfigItemCard.js +76 -20
  201. package/dist/features/source-config-list/react/components/SourceConfigListView.d.ts +5 -3
  202. package/dist/features/source-config-list/react/components/SourceConfigListView.js +33 -3
  203. package/dist/features/source-config-list/react/components/SourceConfigTestControl.js +17 -1
  204. package/dist/features/source-config-list/react/components/SourceConfigTrustOptions.d.ts +11 -0
  205. package/dist/features/source-config-list/react/components/SourceConfigTrustOptions.js +12 -0
  206. package/dist/features/source-config-list/types.d.ts +14 -0
  207. package/dist/features/tab-launcher-menu/react/components/TabLauncherMenu.js +25 -1
  208. package/dist/features/tab-launcher-menu/react/hooks/useTabLauncherMenu.js +15 -16
  209. package/dist/features/tab-strip/react/components/TabBar.js +8 -1
  210. package/dist/features/tabbed-dialog/react/components/TabbedDialog.js +8 -30
  211. package/dist/features/tabbed-dialog/react/components/TabbedDialogChrome.d.ts +15 -0
  212. package/dist/features/tabbed-dialog/react/components/TabbedDialogChrome.js +8 -0
  213. package/dist/features/tabbed-dialog/react/components/TabbedDialogHeader.d.ts +12 -0
  214. package/dist/features/tabbed-dialog/react/components/TabbedDialogHeader.js +6 -0
  215. package/dist/features/tabbed-dialog/react/components/TabbedDialogSidebar.d.ts +27 -0
  216. package/dist/features/tabbed-dialog/react/components/TabbedDialogSidebar.js +12 -0
  217. package/dist/features/tabbed-dialog/react/components/tabbedDialogView.d.ts +43 -0
  218. package/dist/features/tabbed-dialog/react/components/tabbedDialogView.js +59 -0
  219. package/dist/features/version-manager/dependencies.d.ts +3 -1
  220. package/dist/features/version-manager/dependencies.js +3 -2
  221. package/dist/features/version-manager/react/components/VersionManagerModal.js +10 -6
  222. package/dist/features/version-manager/react/hooks/useVersionManager.js +7 -4
  223. package/dist/features/viewer-shell/react/components/CommentSidePanel.js +103 -50
  224. package/dist/features/viewer-shell/react/components/MarkdownSplitPane.js +28 -8
  225. package/dist/features/viewer-shell/react/hooks/useCommentReorder.js +22 -16
  226. package/dist/features/viewer-shell/rules.js +19 -23
  227. package/dist/react/components/CustomSelect.d.ts +38 -1
  228. package/dist/react/components/CustomSelect.js +94 -38
  229. package/dist/react/components/OnboardingDropdown.js +20 -8
  230. package/dist/react/components/RemixIcon.stylesheet.js +3 -1
  231. package/dist/react/components/Toast.js +13 -2
  232. package/dist/react/components/TooltipLayer.js +5 -14
  233. package/dist/react/components/WorkingDirPicker.js +78 -50
  234. package/dist/react/components/remixicon-font-recovery.js +38 -30
  235. package/dist/react/components/select-popover.d.ts +8 -6
  236. package/dist/react/components/select-popover.js +33 -29
  237. package/dist/react/mcp-ui/McpUiHost.d.ts +1 -1
  238. package/dist/react/mcp-ui/McpUiHost.js +10 -11
  239. package/dist/react/mcp-ui/host-message-source.d.ts +14 -2
  240. package/dist/react/mcp-ui/host-message-source.js +15 -5
  241. package/dist/react/mcp-ui/mcp-ui-host-frame.d.ts +41 -0
  242. package/dist/react/mcp-ui/mcp-ui-host-frame.js +39 -0
  243. package/dist/renderers/annotation-canvas/react/components/AnnotationCanvas.js +97 -69
  244. package/dist/renderers/preview-modal-shell/react/components/PreviewModalShell.js +59 -30
  245. package/dist/renderers/react/components/ArtifactView.js +9 -6
  246. package/dist/renderers/srcdoc/build.d.ts +4 -1
  247. package/dist/renderers/srcdoc/build.js +62 -48
  248. package/dist/styles/admin.css +29 -14
  249. package/dist/styles/lightbox.css +142 -0
  250. package/dist/styles/variables.css +128 -0
  251. package/dist/theme/apply.js +9 -5
  252. package/dist/utils/auto-open-file.d.ts +2 -1
  253. package/dist/utils/auto-open-file.js +69 -85
  254. package/dist/utils/markdown-scroll-sync.js +108 -87
  255. package/dist/utils/polygon-selection.js +25 -26
  256. package/dist/utils/smooth-scroll-to-top.d.ts +1 -1
  257. package/dist/utils/smooth-scroll-to-top.js +2 -32
  258. package/dist/utils/sse.js +26 -26
  259. package/dist/utils/unit-bezier.d.ts +7 -0
  260. package/dist/utils/unit-bezier.js +38 -0
  261. package/package.json +7 -10
  262. package/dist/features/admin-widgets/components/ImagePreviewModal.hooks.d.ts +0 -13
  263. package/dist/features/admin-widgets/components/ImagePreviewModal.hooks.js +0 -46
@@ -71,30 +71,35 @@ export function pointInPolygon(point, polygon) {
71
71
  }
72
72
  return inside;
73
73
  }
74
+ /** The rect's 4 corners, clockwise from its top-left. */
75
+ function rectCorners({ rect }) {
76
+ const x2 = rect.x + rect.width;
77
+ const y2 = rect.y + rect.height;
78
+ return [
79
+ { x: rect.x, y: rect.y },
80
+ { x: x2, y: rect.y },
81
+ { x: x2, y: y2 },
82
+ { x: rect.x, y: y2 },
83
+ ];
84
+ }
85
+ /** Is `point` inside `rect`, border included? */
86
+ function rectHoldsPoint({ rect, point }) {
87
+ return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
88
+ }
89
+ /** Does segment `from`→`to` cross any of the 4 edges (top, right, bottom, left) of the rect with these `corners`? */
90
+ function segmentCrossesRectEdges({ from, to, corners }) {
91
+ return corners.some((corner, index) => lineIntersectsLine(from, to, corner, corners[(index + 1) % corners.length]));
92
+ }
74
93
  /** Does the polyline `points` pass through `rect`, either by a point
75
94
  * landing inside it or a segment crossing one of its 4 edges? */
76
95
  export function pathIntersectsRect(points, rect) {
77
- if (points.length === 0)
78
- return false;
79
- const x1 = rect.x;
80
- const y1 = rect.y;
81
- const x2 = rect.x + rect.width;
82
- const y2 = rect.y + rect.height;
83
- for (let index = 0; index < points.length; index += 1) {
84
- const point = points[index];
85
- if (point.x >= x1 && point.x <= x2 && point.y >= y1 && point.y <= y2)
96
+ const corners = rectCorners({ rect });
97
+ return points.some((point, index) => {
98
+ if (rectHoldsPoint({ rect, point }))
86
99
  return true;
87
100
  const next = points[index + 1];
88
- if (!next)
89
- continue;
90
- if (lineIntersectsLine(point, next, { x: x1, y: y1 }, { x: x2, y: y1 }) ||
91
- lineIntersectsLine(point, next, { x: x2, y: y1 }, { x: x2, y: y2 }) ||
92
- lineIntersectsLine(point, next, { x: x2, y: y2 }, { x: x1, y: y2 }) ||
93
- lineIntersectsLine(point, next, { x: x1, y: y2 }, { x: x1, y: y1 })) {
94
- return true;
95
- }
96
- }
97
- return false;
101
+ return next !== undefined && segmentCrossesRectEdges({ from: point, to: next, corners });
102
+ });
98
103
  }
99
104
  /**
100
105
  * Does a freehand lasso stroke select `rect`? True if the stroke's path
@@ -112,12 +117,6 @@ export function lassoSelectionHitsRect(input) {
112
117
  const center = { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 };
113
118
  if (pointInPolygon(center, points))
114
119
  return true;
115
- const corners = [
116
- { x: rect.x, y: rect.y },
117
- { x: rect.x + rect.width, y: rect.y },
118
- { x: rect.x + rect.width, y: rect.y + rect.height },
119
- { x: rect.x, y: rect.y + rect.height },
120
- ];
121
- return corners.some((corner) => pointInPolygon(corner, points));
120
+ return rectCorners({ rect }).some((corner) => pointInPolygon(corner, points));
122
121
  }
123
122
  //# sourceMappingURL=polygon-selection.js.map
@@ -16,7 +16,7 @@
16
16
  * - re-invoking on the same container retargets instead of running two
17
17
  * competing tweens.
18
18
  *
19
- * The bezier solver is local math, avoiding a motion-library dependency in this utility and its tests.
19
+ * The bezier solver (`./unit-bezier.ts`) is local math, avoiding a motion-library dependency in this utility and its tests.
20
20
  */
21
21
  /**
22
22
  * Smoothly (or instantly, per reduced-motion) scrolls `container` to the
@@ -16,39 +16,9 @@
16
16
  * - re-invoking on the same container retargets instead of running two
17
17
  * competing tweens.
18
18
  *
19
- * The bezier solver is local math, avoiding a motion-library dependency in this utility and its tests.
19
+ * The bezier solver (`./unit-bezier.ts`) is local math, avoiding a motion-library dependency in this utility and its tests.
20
20
  */
21
- // cubic-bezier(x1, y1, x2, y2) solver (WebKit UnitBezier shape).
22
- function unitBezier(x1, y1, x2, y2) {
23
- const cx = 3 * x1;
24
- const bx = 3 * (x2 - x1) - cx;
25
- const ax = 1 - cx - bx;
26
- const cy = 3 * y1;
27
- const by = 3 * (y2 - y1) - cy;
28
- const ay = 1 - cy - by;
29
- const sampleX = (t) => ((ax * t + bx) * t + cx) * t;
30
- const sampleY = (t) => ((ay * t + by) * t + cy) * t;
31
- const sampleDX = (t) => (3 * ax * t + 2 * bx) * t + cx;
32
- return (x) => {
33
- if (x <= 0)
34
- return 0;
35
- if (x >= 1)
36
- return 1;
37
- let t = x;
38
- for (let i = 0; i < 8; i += 1) {
39
- const err = sampleX(t) - x;
40
- if (Math.abs(err) < 1e-6)
41
- break;
42
- const d = sampleDX(t);
43
- // For the sole fixed curve, sampleDX stays at least about 0.6095 over the clamped [0, 1]
44
- // domain. This guard cannot fire for current inputs; retain it for a future curve change.
45
- if (Math.abs(d) < 1e-6)
46
- break;
47
- t -= err / d;
48
- }
49
- return sampleY(Math.min(1, Math.max(0, t)));
50
- };
51
- }
21
+ import { unitBezier } from './unit-bezier.js';
52
22
  const EASE_OUT = unitBezier(0.23, 1, 0.32, 1);
53
23
  const MIN_DURATION_MS = 260;
54
24
  const MAX_DURATION_MS = 600;
package/dist/utils/sse.js CHANGED
@@ -1,6 +1,25 @@
1
1
  // Generic Server-Sent-Events frame parser. Framework- and transport-free:
2
2
  // callers own how the raw text stream is split into `\n\n`-delimited frames
3
3
  // (e.g. a `ReadableStream` reader) and pass each frame here.
4
+ /** Fold one frame line (any trailing `\r` already stripped) into the accumulated fields. */
5
+ function applySseLine({ fields, line }) {
6
+ if (line.startsWith(':')) {
7
+ fields.comments.push(line.slice(1).trimStart());
8
+ }
9
+ else if (line.startsWith('event: ')) {
10
+ fields.event = line.slice(7).trim();
11
+ }
12
+ else if (line.startsWith('id: ')) {
13
+ fields.id = line.slice(4).trim();
14
+ }
15
+ else if (line.startsWith('data: ')) {
16
+ fields.dataLines.push(line.slice(6));
17
+ }
18
+ }
19
+ /** Build the result for a frame that carried no `data:` lines. */
20
+ function dataLessFrame({ comments }) {
21
+ return comments.length > 0 ? { kind: 'comment', comment: comments.join('\n') } : { kind: 'empty' };
22
+ }
4
23
  /**
5
24
  * Parse one SSE frame (the text between two `\n\n` boundaries) into its
6
25
  * `event` name, JSON-decoded `data`, and optional `id`, per the SSE wire
@@ -15,34 +34,15 @@
15
34
  * @complexity O(n) in the frame's line count — one linear scan.
16
35
  */
17
36
  export function parseSseFrame({ frame }) {
18
- const lines = frame.split('\n');
19
- const comments = [];
20
- let event = 'message';
21
- let id;
22
- const dataLines = [];
23
- for (const rawLine of lines) {
24
- const line = rawLine.endsWith('\r') ? rawLine.slice(0, -1) : rawLine;
25
- if (line.startsWith(':')) {
26
- comments.push(line.slice(1).trimStart());
27
- }
28
- else if (line.startsWith('event: ')) {
29
- event = line.slice(7).trim();
30
- }
31
- else if (line.startsWith('id: ')) {
32
- id = line.slice(4).trim();
33
- }
34
- else if (line.startsWith('data: ')) {
35
- dataLines.push(line.slice(6));
36
- }
37
- }
38
- if (dataLines.length === 0) {
39
- if (comments.length > 0) {
40
- return { kind: 'comment', comment: comments.join('\n') };
41
- }
42
- return { kind: 'empty' };
37
+ const fields = { event: 'message', id: undefined, comments: [], dataLines: [] };
38
+ for (const rawLine of frame.split('\n')) {
39
+ applySseLine({ fields, line: rawLine.endsWith('\r') ? rawLine.slice(0, -1) : rawLine });
43
40
  }
41
+ if (fields.dataLines.length === 0)
42
+ return dataLessFrame({ comments: fields.comments });
43
+ const { event, id } = fields;
44
44
  try {
45
- return { kind: 'event', event, data: JSON.parse(dataLines.join('\n')), ...(id ? { id } : {}) };
45
+ return { kind: 'event', event, data: JSON.parse(fields.dataLines.join('\n')), ...(id ? { id } : {}) };
46
46
  }
47
47
  catch {
48
48
  return null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * cubic-bezier(x1, y1, x2, y2) timing-function solver (WebKit UnitBezier shape): Newton iteration
3
+ * on x(t), then y(t). Pure math, kept local so animation utilities need no motion library.
4
+ */
5
+ /** Returns the easing function for the given control points; inputs are clamped to [0, 1]. */
6
+ export declare function unitBezier(x1: number, y1: number, x2: number, y2: number): (x: number) => number;
7
+ //# sourceMappingURL=unit-bezier.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * cubic-bezier(x1, y1, x2, y2) timing-function solver (WebKit UnitBezier shape): Newton iteration
3
+ * on x(t), then y(t). Pure math, kept local so animation utilities need no motion library.
4
+ */
5
+ /** Returns the easing function for the given control points; inputs are clamped to [0, 1]. */
6
+ export function unitBezier(x1, y1, x2, y2) {
7
+ const cx = 3 * x1;
8
+ const bx = 3 * (x2 - x1) - cx;
9
+ const ax = 1 - cx - bx;
10
+ const cy = 3 * y1;
11
+ const by = 3 * (y2 - y1) - cy;
12
+ const ay = 1 - cy - by;
13
+ const sampleX = (t) => ((ax * t + bx) * t + cx) * t;
14
+ const sampleY = (t) => ((ay * t + by) * t + cy) * t;
15
+ const sampleDX = (t) => (3 * ax * t + 2 * bx) * t + cx;
16
+ return (x) => {
17
+ if (x <= 0)
18
+ return 0;
19
+ if (x >= 1)
20
+ return 1;
21
+ let t = x;
22
+ for (let i = 0; i < 8; i += 1) {
23
+ const err = sampleX(t) - x;
24
+ if (Math.abs(err) < 1e-6)
25
+ break;
26
+ const d = sampleDX(t);
27
+ // A flat x-derivative would make the Newton step divide by ~0. For smooth-scroll-to-top's
28
+ // fixed ease-out curve sampleDX stays at least about 0.6095 over [0, 1], so it never fires
29
+ // there; it does for degenerate control points (e.g. x1 = x2 = 0 near x = 0), where the
30
+ // current estimate is kept rather than stepping to Infinity/NaN.
31
+ if (Math.abs(d) < 1e-6)
32
+ break;
33
+ t -= err / d;
34
+ }
35
+ return sampleY(Math.min(1, Math.max(0, t)));
36
+ };
37
+ }
38
+ //# sourceMappingURL=unit-bezier.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/ui",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Generic, product-neutral React UI primitives and feature domains. Framework-free types, decision rules, catalogs, and host port contracts live behind ./core (no React, no DOM). The Excalidraw and Lexical editors live behind ./sketch-editor and ./lexical-rich-text-editor; the GrapesJS-backed inline HTML editor lives behind ./html-editor.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -243,16 +243,16 @@
243
243
  "shiki": "^1.24.4",
244
244
  "tailwind-merge": "^2.6.0",
245
245
  "zod": "^3.25.76",
246
- "@jini-ai/integrations": "^0.4.2",
247
- "@jini-ai/core": "^0.4.7",
248
- "@jini-ai/agentic": "^0.4.4",
249
- "@jini-ai/platform": "^0.5.9"
246
+ "@jini-ai/agent-runtime": "^0.4.12",
247
+ "@jini-ai/core": "^0.4.9",
248
+ "@jini-ai/platform": "^0.5.10",
249
+ "@jini-ai/integrations": "^0.4.3",
250
+ "@jini-ai/agentic": "^0.4.5"
250
251
  },
251
252
  "dependencies": {
252
- "@jini-ai/core": "^0.4.7"
253
+ "@jini-ai/core": "^0.4.9"
253
254
  },
254
255
  "peerDependencies": {
255
- "@jini-ai/integrations": "^0.4.2",
256
256
  "@tanstack/react-query": "^5.0.0",
257
257
  "@excalidraw/excalidraw": "0.18.1",
258
258
  "@lexical/react": "0.36.2",
@@ -279,9 +279,6 @@
279
279
  "zod": "^3.25.76"
280
280
  },
281
281
  "peerDependenciesMeta": {
282
- "@jini-ai/integrations": {
283
- "optional": true
284
- },
285
282
  "@tanstack/react-query": {
286
283
  "optional": true
287
284
  },
@@ -1,13 +0,0 @@
1
- import { type MouseEvent, type SyntheticEvent } from "react";
2
- export interface ImagePreviewModalController {
3
- dialogRef: React.RefObject<HTMLDialogElement | null>;
4
- /** Prevent native Escape-close and route through onClose; the open prop/effect owns lifecycle. */
5
- handleNativeCancel: (e: SyntheticEvent<HTMLDialogElement>) => void;
6
- /** The dialog box is content-sized: a target on the dialog itself, rather than a child, is backdrop. */
7
- handleBackdropClick: (e: MouseEvent<HTMLDialogElement>) => void;
8
- }
9
- export declare function useImagePreviewModal({ open, onClose }: {
10
- open: boolean;
11
- onClose: () => void;
12
- }): ImagePreviewModalController;
13
- //# sourceMappingURL=ImagePreviewModal.hooks.d.ts.map
@@ -1,46 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- /**
3
- * Isolate native dialog lifecycle in an injectable hook so rendering can use a fake controller.
4
- * showModal/close are synchronous browser APIs: no async port or disposed-after-unmount guard
5
- * is needed. Separate helpers keep each fallback branch shallow rather than nesting in the effect.
6
- */
7
- /** Idempotent native open; the attribute fallback supports DOM environments without showModal. */
8
- function openDialog(dialog) {
9
- if (typeof dialog.showModal === "function") {
10
- if (!dialog.open)
11
- dialog.showModal();
12
- return;
13
- }
14
- dialog.setAttribute("open", "");
15
- }
16
- /** Mirror the attribute fallback where a DOM environment has no native close method. */
17
- function closeDialog(dialog) {
18
- if (typeof dialog.close === "function") {
19
- if (dialog.open)
20
- dialog.close();
21
- return;
22
- }
23
- dialog.removeAttribute("open");
24
- }
25
- export function useImagePreviewModal({ open, onClose }) {
26
- const dialogRef = useRef(null);
27
- useEffect(() => {
28
- const dialog = dialogRef.current;
29
- if (!dialog)
30
- return;
31
- if (open)
32
- openDialog(dialog);
33
- else
34
- closeDialog(dialog);
35
- }, [open]);
36
- function handleNativeCancel(e) {
37
- e.preventDefault();
38
- onClose();
39
- }
40
- function handleBackdropClick(e) {
41
- if (e.target === dialogRef.current)
42
- onClose();
43
- }
44
- return { dialogRef, handleNativeCancel, handleBackdropClick };
45
- }
46
- //# sourceMappingURL=ImagePreviewModal.hooks.js.map