diff --git a/packages/mindplot/README.md b/packages/mindplot/README.md index 507d5675..debb11a1 100644 --- a/packages/mindplot/README.md +++ b/packages/mindplot/README.md @@ -1,11 +1,43 @@ -# `mindplot` +# `Mindplot` -> TODO: description +The Mindplot is manager all **Wisemapping**. In it is implemented the packages of `core-js` and `web2d`. + +## Quick Start + +1. Clone repository with the next command: + +``` +git clone https://[username]@bitbucket.org/wisemapping/wisemapping-frontend.git +``` + +where the variable _username_ is you username of Bitbucket. + +_Note:The project is configured to use the yarn dependency manager_ + +2. Move to folder mindplot + +``` +cd packages/mindplot +``` + +3. Now you need install all dependence, this is done with command `yarn install` + +4. To start the development enviroment you have to use command `yarn start`. + +## Production + +To build up the package mindplot and use in production, you have to use command `yarn build` + +## Testing + +For the testings of mindplot you need use command `yarn test` for run this enviroment. +once this is done, it will open the explorer where you can see a menu with the tests carried out. ## Usage -``` -const mindplot = require('mindplot'); +To start using mindplot it has to be required as a module and then intanciarce as a function -// TODO: DEMONSTRATE API +``` +const mindplot = require('@wisemapping/mindplot'); +mindplot(); ``` diff --git a/packages/mindplot/lib/components/Messages.js b/packages/mindplot/lib/components/Messages.js index 2c80a3a2..93a16a42 100644 --- a/packages/mindplot/lib/components/Messages.js +++ b/packages/mindplot/lib/components/Messages.js @@ -31,7 +31,7 @@ const Messages = new Class({ }, }); -const $msg = function (key) { +global.$msg = function (key) { if (!Messages.__bundle) { Messages.init('en'); } diff --git a/packages/mindplot/lib/components/index.js b/packages/mindplot/lib/components/index.js index 0bbb5052..099534b8 100644 --- a/packages/mindplot/lib/components/index.js +++ b/packages/mindplot/lib/components/index.js @@ -1,5 +1,3 @@ -import LocalStorageManager from './LocalStorageManager'; - const actionDispatcher = require('./ActionDispatcher').default; const actionIcon = require('./ActionIcon').default; const centralTopic = require('./CentralTopic').default; @@ -32,15 +30,19 @@ const multilineTextEditor = require('./MultilineTextEditor').default; const nodeGraph = require('./NodeGraph').default; const noteIcon = require('./NoteIcon').default; const options = require('./Options').default; + const persistenceManager = require('./PersistenceManager').default; const relationship = require('./Relationship').default; const relationshipPivot = require('./RelationshipPivot').default; const resetPersistenceManager = require('./RestPersistenceManager').default; + const screenManager = require('./ScreenManager').default; const shrinkConnector = require('./ShrinkConnector').default; const standaloneActionDispatcher = require('./StandaloneActionDispatcher').default; const textEditor = require('./TextEditor').default; + const textEditorFactory = require('./TextEditorFactory').default; + const topic = require('./Topic').default; const topicEventDispatcher = require('./TopicEventDispatcher').default; const topicFeature = require('./TopicFeature').default; @@ -49,16 +51,19 @@ const workspace = require('./Workspace').default; export const Components = { ActionDispatcher: actionDispatcher, + ActionIcon: actionIcon, CentralTopic: centralTopic, Command: command, ConnectionLine: connectionLine, ControlPoint: controlPoint, Designer: designer, + DesignerActionRunner: designerActionRunner, DesignerKeyboard: designerKeyboard, DesignerModel: designerModal, DesignerUndoManager: designerUndoManager, + DragConnector: dragConnector, DragManager: dragManager, DragPivot: dragPivot, @@ -66,8 +71,10 @@ export const Components = { EditorOptions: editorOptions, EditorProperties: editorProperties, Events: events, + footer: footer, header: header, + Icon: icon, IconGroup: iconGroup, ImageIcon: imageIcon, @@ -76,11 +83,13 @@ export const Components = { localSorageManager: localSorageManager, MainTopic: mainTopic, + Messages: messages, MultilineTextEditor: multilineTextEditor, NodeGraph: nodeGraph, NoteIcon: noteIcon, Options: options, + PersistenceManager: persistenceManager, Relationship: relationship, RelationshipPivot: relationshipPivot, @@ -90,6 +99,7 @@ export const Components = { StandaloneActionDispatcher: standaloneActionDispatcher, TextEditor: textEditor, TextEditorFactory: textEditorFactory, + Topic: topic, TopicEventDispatcher: topicEventDispatcher, TopicFeature: topicFeature, diff --git a/packages/mindplot/lib/components/widget/ModalDialogNotifier.js b/packages/mindplot/lib/components/widget/ModalDialogNotifier.js index a053b973..659c7aaa 100644 --- a/packages/mindplot/lib/components/widget/ModalDialogNotifier.js +++ b/packages/mindplot/lib/components/widget/ModalDialogNotifier.js @@ -49,7 +49,6 @@ const ModalDialogNotifier = new Class({ var dialogNotifier = new ModalDialogNotifier(); const $notifyModal = dialogNotifier.show.bind(dialogNotifier); -$notifyModal; export { $notifyModal }; export default ModalDialogNotifier; diff --git a/packages/mindplot/lib/mindplot.js b/packages/mindplot/lib/mindplot.js index 4aae2738..8f590380 100644 --- a/packages/mindplot/lib/mindplot.js +++ b/packages/mindplot/lib/mindplot.js @@ -2,6 +2,31 @@ module.exports = mindplot; //eslint-disable-line function mindplot() { + // Jquery for mindplot and bootstrap + global.$ = require('jquery'); + global.jQuery = require('jquery'); + + // Mootools for the classes of Mindplot + require('mootools'); + + // Underscore handling common tasks + global._ = require('underscore'); + + // Core-js packages of Wisemapping + global.core = require('@wismapping/core-js'); + + define(['raphael'], (Raphael) => { + global.Raphael = Raphael; + }); + require('../test/javascript/static/test/raphael-plugins'); + + // Bootsrap for styles + require('./components/libraries/bootstrap/js/bootstrap.min'); + + /* * * * * * * * + * MINDPLOT * + * * * * * * * */ + // Commands const { Commands } = require('./components/commands'); @@ -9,14 +34,12 @@ function mindplot() { const { Layout } = require('./components/layout'); // Model + const { Model } = require('./components/model'); // Persistence const { Persistence } = require('./components/persistence'); - // Utils - const { Utils } = require('./components/util'); - // Widgets const { Widgets } = require('./components/widget'); @@ -25,11 +48,10 @@ function mindplot() { return { commands: Commands, - layouts: Layout, + layout: Layout, models: Model, persistence: Persistence, - utils: Utils, - widgets: Widgets, - components: Components, + widget: Widgets, + component: Components, }; } diff --git a/packages/mindplot/package.json b/packages/mindplot/package.json index 1b904886..6aa393dc 100644 --- a/packages/mindplot/package.json +++ b/packages/mindplot/package.json @@ -20,19 +20,24 @@ "url": "git+https://ezequielVega@bitbucket.org/lilabyus/wisemapping-frontend.git" }, "scripts": { - "build": "yarn mindplot:build && yarn test:build", - "test:build": "webpack --config webpack.test.js", - "mindplot:build": "webpack --config webpack.prod.js", + "build": "yarn build:dev && yarn build:test", + "build:dev": "webpack --config webpack.prod.js", + "test": "webpack serve --config webpack.test.js", "start": "webpack serve --config webpack.dev.js" }, "dependencies": { "@wismapping/core-js": "^0.0.1", - "@wismapping/web2d": "^0.0.1" + "@wismapping/web2d": "^0.0.1", + "jquery": "2.1.0", + "mootools": "1.4.5", + "raphael": "^2.3.0", + "underscore": "^1.13.1" }, "devDependencies": { "@babel/core": "^7.14.6", "babel-loader": "^8.2.2", "clean-webpack-plugin": "^4.0.0-alpha.0", + "html-webpack-plugin": "^5.3.2", "webpack": "^5.44.0", "webpack-cli": "^4.7.2", "webpack-dev-server": "^3.11.2", diff --git a/packages/mindplot/test/javascript/static/index.html b/packages/mindplot/test/javascript/static/index.html new file mode 100644 index 00000000..9102a66b --- /dev/null +++ b/packages/mindplot/test/javascript/static/index.html @@ -0,0 +1,17 @@ + + + + + + Document + + +
+

Testing

+ +
+ + diff --git a/packages/mindplot/test/javascript/static/layout.html b/packages/mindplot/test/javascript/static/layout.html index d4fd7d7e..d298c71d 100644 --- a/packages/mindplot/test/javascript/static/layout.html +++ b/packages/mindplot/test/javascript/static/layout.html @@ -1,174 +1,158 @@ + + + + + - + diff --git a/packages/mindplot/test/javascript/static/palette.html b/packages/mindplot/test/javascript/static/palette.html index c8694035..8b828f34 100644 --- a/packages/mindplot/test/javascript/static/palette.html +++ b/packages/mindplot/test/javascript/static/palette.html @@ -3,27 +3,7 @@ - Document - - - - - - - - + Document diff --git a/packages/mindplot/test/javascript/static/testing.html b/packages/mindplot/test/javascript/static/testing.html deleted file mode 100644 index fef81721..00000000 --- a/packages/mindplot/test/javascript/static/testing.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - Document - - - - - - - - diff --git a/packages/mindplot/webpack.dev.js b/packages/mindplot/webpack.dev.js index d8bc9b87..34d5da02 100644 --- a/packages/mindplot/webpack.dev.js +++ b/packages/mindplot/webpack.dev.js @@ -1,14 +1,18 @@ -const { HotModuleReplacementPlugin } = require("webpack"); -const { merge } = require("webpack-merge"); -const common = require("./webpack.common"); +const { HotModuleReplacementPlugin } = require('webpack'); +const { merge } = require('webpack-merge'); +const common = require('./webpack.common'); /** @type {import('webpack').Configuration} */ const devConfig = { - mode: "development", - target: "web2d", - plugins: [new HotModuleReplacementPlugin()], - devtool: "eval-source-map" + mode: 'development', + devServer: { + historyApiFallback: true, + port: 8080, + open: true, + }, + target: 'web', + plugins: [new HotModuleReplacementPlugin()], + devtool: 'eval-source-map', }; -module.exports = merge(common, devConfig) - +module.exports = merge(common, devConfig); diff --git a/packages/mindplot/webpack.test.js b/packages/mindplot/webpack.test.js index a8321377..00c1dd74 100644 --- a/packages/mindplot/webpack.test.js +++ b/packages/mindplot/webpack.test.js @@ -1,17 +1,19 @@ const path = require('path'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); /** @type {import('webpack').Configuration} */ module.exports = { entry: { - testingLayout: './test/javascript/static/test/testingLayout', - testingPallete: './test/javascript/static/test/testingPalette', + palette: path.resolve(__dirname, './test/javascript/static/test/testPalette'), + layout: path.resolve(__dirname, './test/javascript/static/test/testLayout'), }, output: { - path: path.resolve(__dirname, 'dist', 'tests'), - filename: '[name].js', + path: path.resolve(__dirname, 'dist', 'test'), + filename: '[name].test.js', publicPath: '', }, + mode: 'production', optimization: { splitChunks: { chunks: 'all', @@ -35,5 +37,20 @@ module.exports = { resolve: { extensions: ['.js', '.jsx', '.json'], }, - plugins: [new CleanWebpackPlugin()], + plugins: [ + new CleanWebpackPlugin(), + new HtmlWebpackPlugin({ + template: 'test/javascript/static/index.html', + }), + new HtmlWebpackPlugin({ + chunks: ['palette'], + filename: 'palette', + template: 'test/javascript/static/palette.html', + }), + new HtmlWebpackPlugin({ + chunks: ['layout'], + filename: 'layout', + template: 'test/javascript/static/layout.html', + }), + ], }; diff --git a/yarn.lock b/yarn.lock index 1364abc0..e9a43b94 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5304,6 +5304,11 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +eve-raphael@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/eve-raphael/-/eve-raphael-0.5.0.tgz#17c754b792beef3fa6684d79cf5a47c63c4cda30" + integrity sha1-F8dUt5K+7z+maE15z1pHxjxM2jA= + event-emitter@~0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.2.2.tgz#c81e3724eb55407c5a0d5ee3299411f700f54291" @@ -9717,6 +9722,13 @@ range-parser@~1.0.0: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.0.3.tgz#6872823535c692e2c2a0103826afd82c2e0ff175" integrity sha1-aHKCNTXGkuLCoBA4Jq/YLC4P8XU= +raphael@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/raphael/-/raphael-2.3.0.tgz#eabeb09dba861a1d4cee077eaafb8c53f3131f89" + integrity sha512-w2yIenZAQnp257XUWGni4bLMVxpUpcIl7qgxEgDIXtmSypYtlNxfXWpOBxs7LBTps5sDwhRnrToJrMUrivqNTQ== + dependencies: + eve-raphael "0.5.0" + raw-body@1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-1.1.4.tgz#f0b5624388d031f63da07f870c86cb9ccadcb67d" @@ -11796,6 +11808,11 @@ undefsafe@^2.0.3: dependencies: debug "^2.2.0" +underscore@^1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.1.tgz#0c1c6bd2df54b6b69f2314066d65b6cde6fcf9d1" + integrity sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g== + unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"