@opencloning/ui 1.1.0 → 1.1.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @opencloning/ui
2
2
 
3
+ ## 1.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#592](https://github.com/manulera/OpenCloning_frontend/pull/592) [`57092ae`](https://github.com/manulera/OpenCloning_frontend/commit/57092ae54d96485e84191d6c20ade9e9a6838a65) Thanks [@manulera](https://github.com/manulera)! - Remove partial overlap option from restriction and ligation overlap, related to https://github.com/manulera/OpenCloning_backend/pull/389
8
+
9
+ - Updated dependencies []:
10
+ - @opencloning/store@1.1.2
11
+ - @opencloning/utils@1.1.2
12
+
13
+ ## 1.1.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#590](https://github.com/manulera/OpenCloning_frontend/pull/590) [`81bcca3`](https://github.com/manulera/OpenCloning_frontend/commit/81bcca3c4a38e32793dab1cc60862f8ae61b3bb9) Thanks [@manulera](https://github.com/manulera)! - Now it exports a standalone OpenCloning component that can be used without manually setting up React providers, Redux store, or ConfigProvider.
18
+
19
+ - Updated dependencies []:
20
+ - @opencloning/store@1.1.1
21
+ - @opencloning/utils@1.1.1
22
+
3
23
  ## 1.1.0
4
24
 
5
25
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencloning/ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -11,7 +11,8 @@
11
11
  ".": "./src/index.js",
12
12
  "./components": "./src/components/index.js",
13
13
  "./providers/ConfigProvider": "./src/providers/index.js",
14
- "./hooks/useConfig": "./src/hooks/useConfig.js"
14
+ "./hooks/useConfig": "./src/hooks/useConfig.js",
15
+ "./standalone": "./src/StandAloneOpenCloning.js"
15
16
  },
16
17
  "repository": {
17
18
  "type": "git",
@@ -23,8 +24,8 @@
23
24
  "@emotion/styled": "^11.14.0",
24
25
  "@mui/icons-material": "^5.15.17",
25
26
  "@mui/material": "^5.15.17",
26
- "@opencloning/store": "1.1.0",
27
- "@opencloning/utils": "1.1.0",
27
+ "@opencloning/store": "1.1.2",
28
+ "@opencloning/utils": "1.1.2",
28
29
  "@teselagen/bio-parsers": "^0.4.32",
29
30
  "@teselagen/ove": "^0.8.18",
30
31
  "@teselagen/range-utils": "^0.3.13",
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { Provider } from 'react-redux';
4
+ import store from '@opencloning/store';
5
+ import { ConfigProvider } from './providers/ConfigProvider';
6
+ import { OpenCloning } from './components';
7
+ // Import styles
8
+ import './index.css';
9
+
10
+ /**
11
+ * StandAloneOpenCloning - Mounts the OpenCloning component into a DOM element
12
+ *
13
+ * This function handles all the setup required for OpenCloning:
14
+ * - Redux Provider with store
15
+ * - ConfigProvider with config
16
+ * - React rendering
17
+ *
18
+ * @param {Object} options - Configuration options
19
+ * @param {Object} options.config - Configuration object for OpenCloning
20
+ * @param {HTMLElement} options.element - DOM element where to mount the component
21
+ * @returns {Function} Cleanup function that unmounts the component
22
+ *
23
+ * @example
24
+ * const container = document.getElementById('opencloning-container');
25
+ * const cleanup = StandAloneOpenCloning({
26
+ * config: { /* config object *\/ },
27
+ * element: container
28
+ * });
29
+ *
30
+ * // Later, to unmount:
31
+ * cleanup();
32
+ */
33
+ export function StandAloneOpenCloning({ config, element }) {
34
+ if (!config) {
35
+ throw new Error('StandAloneOpenCloning requires a config object');
36
+ }
37
+
38
+ if (!element) {
39
+ throw new Error('StandAloneOpenCloning requires an element');
40
+ }
41
+
42
+ if (!(element instanceof HTMLElement)) {
43
+ throw new Error('Element must be an HTMLElement');
44
+ }
45
+
46
+ const container = element;
47
+
48
+ // Create React root
49
+ const root = createRoot(container);
50
+
51
+ // Render the component with all providers
52
+ root.render(
53
+ React.createElement(Provider, { store },
54
+ React.createElement(ConfigProvider, { config },
55
+ React.createElement(OpenCloning)
56
+ )
57
+ )
58
+ );
59
+
60
+ // Return cleanup function
61
+ return () => {
62
+ root.unmount();
63
+ };
64
+ }
65
+
66
+ export default StandAloneOpenCloning;
@@ -80,7 +80,6 @@ function SourceAssembly({ source, requestStatus, sendPostRequest }) {
80
80
  if (enzymes.length === 0) { return; }
81
81
  requestData.source.restriction_enzymes = enzymes;
82
82
  const config = { params: {
83
- allow_partial_overlap: allowPartialOverlap,
84
83
  circular_only: circularOnly,
85
84
  } };
86
85
  sendPostRequest({ endpoint: 'restriction_and_ligation', requestData, config, source });
@@ -176,7 +175,7 @@ function SourceAssembly({ source, requestStatus, sendPostRequest }) {
176
175
  <FormControlLabel control={<Checkbox checked={circularOnly} onChange={() => setCircularOnly(!circularOnly)} />} label="Circular assemblies only" />
177
176
  </FormControl>
178
177
  )}
179
- { ['RestrictionAndLigationSource', 'LigationSource'].includes(assemblyType) && (
178
+ { ['LigationSource'].includes(assemblyType) && (
180
179
  <FormControl fullWidth style={{ textAlign: 'left' }}>
181
180
  <FormControlLabel control={<Checkbox checked={allowPartialOverlap} onChange={flipAllowPartialOverlap} />} label="Allow partial overlaps" />
182
181
  </FormControl>
package/src/index.js CHANGED
@@ -3,6 +3,8 @@ import './index.css';
3
3
 
4
4
  // Re-export components
5
5
  export * from './components/index.js';
6
+ // Export standalone wrapper
7
+ export { StandAloneOpenCloning } from './StandAloneOpenCloning.js';
6
8
  // Export version - replaced at publish time via prepack script
7
9
  export { version } from './version.js';
8
10
 
package/src/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Version placeholder - replaced at publish time via prepack script
2
- export const version = "1.1.0";
2
+ export const version = "1.1.2";