Skip to content

Commit

Permalink
refactor(mmel): Extract libmmel out as a separate package
Browse files Browse the repository at this point in the history
  • Loading branch information
ribose-jeffreylau committed May 19, 2023
1 parent 4c78a12 commit b34b7af
Show file tree
Hide file tree
Showing 158 changed files with 954 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
if: steps.build_cache.outputs.cache-hit != 'true'
shell: bash
run: |
pnpm run -r build-dist
pnpm run -r dist
- name: Save built artefacts to cache
if: steps.build_cache.outputs.cache-hit != 'true'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
/dist
.vs

*.d.ts
*.d.ts.map

.pnpm-store/

# Created by https://www.toptal.com/developers/gitignore/api/osx,vim,linux,emacs,eclipse,windows,textmate,webstorm,sublimetext,intellij+all,visualstudiocode,node,yarn
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "@paneron/smartytrams",
"version": "0.0.1",
"description": "MMEL, SMART, etc.",
"main": "plugin.js",
"repository": "https://github.com/paneron/extension-hls",
"author": {
"name": "Ribose Inc.",
Expand All @@ -13,9 +12,11 @@
"build": "pnpm run -r build",
"clean": "pnpm run -r clean",
"dev": "pnpm run -r dev",
"dist": "pnpm run -r dist",
"fix": "pnpm run -r fix",
"lint": "pnpm run -r lint",
"test": "pnpm run -r test"
"test": "pnpm run -r test",
"typecheck": "pnpm run -r typecheck"
},
"resolutions": {},
"dependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/legacy/.swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
},
"jsc": {
"externalHelpers": false,
"paths": {
"@paneron/*": [
"../*/src"
]
},
"baseUrl": ".",
"parser": {
"syntax": "typescript",
"tsx": true,
Expand Down
13 changes: 4 additions & 9 deletions packages/legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@paneron/extension-hls",
"version": "1.0.0-dev23",
"description": "Paneron extension for SMART model editing",
"main": "plugin.js",
"main": "dist/plugin.js",
"repository": "https://github.com/paneron/extension-hls",
"author": {
"name": "Ribose Inc.",
Expand All @@ -27,7 +27,7 @@
"inject": "run-script-os",
"inject:mac": "mkdirp $HOME/'Library/Application Support'/Paneron/plugins/${npm_package_name}; rsync -a ${npm_package_dist_dir}/ $HOME/'Library/Application Support'/Paneron/plugins/${npm_package_name}/",
"inject:win32": "mkdirp \"%appdata%\\Paneron\\plugins\\@paneron\\extension-hls\" && xcopy /e /y %npm_package_dist_dir% \"%appdata%\\Paneron\\plugins\\@paneron\\extension-hls\" > nul",
"build-dist": "concurrently npm:build npm:build:decl",
"dist": "concurrently npm:build npm:build:decl",
"build-inject": "pnpm run build && pnpm run inject",
"build-typecheck": "concurrently npm:build npm:typecheck",
"clean-build": "pnpm run clean; pnpm run build",
Expand All @@ -50,13 +50,7 @@
"fix": "pnpm run lint --fix"
},
"files": [
"README.adoc",
"*.js",
"*.js.map",
"*.d.ts",
"**/*.js",
"**/*.js.map",
"**/*.d.ts"
"/dist"
],
"resolutions": {
"@types/react": "16.14.34",
Expand All @@ -70,6 +64,7 @@
"@emotion/eslint-plugin": "^11.10.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@paneron/libmmel": "workspace:*",
"@react-three/drei": "^7.27.5",
"@react-three/fiber": "^7.0.29",
"@riboseinc/paneron-extension-glossarist": "^2.0.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/legacy/src/smart/model/FlowContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { XYPosition } from 'react-flow-renderer';
import { MMELEdge } from '../serialize/interface/flowcontrolinterface';
import { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import {
EditorModel,
EditorNode,
Expand All @@ -20,7 +20,7 @@ import {
MMELLink,
MMELRole,
MMELTable,
} from '../serialize/interface/supportinterface';
} from '@paneron/libmmel/interface/supportinterface';
import { SerializedStyles } from '@emotion/react';
import React from 'react';
import { MMELRepo, RepoIndex } from './repo';
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/Measurement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
MMELVariable,
MMELView,
VarType,
} from '../serialize/interface/supportinterface';
} from '@paneron/libmmel/interface/supportinterface';
import { EditorModel } from './editormodel';

export interface MTreeNode {
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/States.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { NodeProps } from 'react-flow-renderer';
import { HistoryItem, PageHistory } from './history';
import { ModelWrapper } from './modelwrapper';
import { DataType } from '../serialize/interface/baseinterface';
import { DataType } from '@paneron/libmmel/interface/baseinterface';
import { DataLinkEdge, NormalEdge, SelfLoopEdge } from '../ui/flowui/edgeUI';
import {
ApprovalComponent,
Expand Down
8 changes: 6 additions & 2 deletions packages/legacy/src/smart/model/ViewFunctionModel.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { SerializedStyles } from '@emotion/react';
import React from 'react';
import { MMELDataAttribute } from '../serialize/interface/datainterface';
import { textToMMEL } from '@paneron/libmmel';
import { MMELDataAttribute } from '@paneron/libmmel/interface/datainterface';
import {
MMELProvision,
MMELReference,
} from '../serialize/interface/supportinterface';
} from '@paneron/libmmel/interface/supportinterface';
import { EditorNode } from './editormodel';
import { LegendInterface } from './States';


console.log(textToMMEL);

/**
* For model viewer. The common interface for different functions.
* Functions like checklist, version tracking etc.
Expand Down
6 changes: 3 additions & 3 deletions packages/legacy/src/smart/model/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* The data model for checklist
*/

import { MMELProvision } from '../serialize/interface/supportinterface';
import { MMELDataAttribute } from '../serialize/interface/datainterface';
import { ModalityType } from '../utils/constants';
import { MMELProvision } from '@paneron/libmmel/interface/supportinterface';
import { MMELDataAttribute } from '@paneron/libmmel/interface/datainterface';
import { ModalityType } from '@/smart/utils/constants';
import {
EditorApproval,
EditorDataClass,
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/commands/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This file centralizes the commands generated related to comment components
*/

import { MMELComment } from '../../../serialize/interface/supportinterface';
import { MMELComment } from '@paneron/libmmel/interface/supportinterface';
import { ModelAction } from '../model';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/commands/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This file centralizes the commands generated related to registry and data class
*/

import { MMELReference } from '../../../serialize/interface/supportinterface';
import { MMELReference } from '@paneron/libmmel/interface/supportinterface';
import { EditorDataClass } from '../../editormodel';
import { RegistryCombined } from '../components/element/registry';
import { ModelAction } from '../model';
Expand Down
4 changes: 2 additions & 2 deletions packages/legacy/src/smart/model/editor/commands/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* This file centralizes the commands related to node elements
*/

import { MMELEdge } from '../../../serialize/interface/flowcontrolinterface';
import { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import {
MMELLink,
MMELNote,
MMELProvision,
MMELReference,
} from '../../../serialize/interface/supportinterface';
} from '@paneron/libmmel/interface/supportinterface';
import {
EditorEGate,
EditorModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This file centralizes the commands related to reference
*/

import { MMELReference } from '../../../serialize/interface/supportinterface';
import { MMELReference } from '@paneron/libmmel/interface/supportinterface';
import { ModelAction } from '../model';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/commands/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This file centralizes the commands related to roles
*/

import { MMELRole } from '../../../serialize/interface/supportinterface';
import { MMELRole } from '@paneron/libmmel/interface/supportinterface';
import { ModelAction } from '../model';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELComment } from '../../../serialize/interface/supportinterface';
import { MMELComment } from '@paneron/libmmel/interface/supportinterface';
import { EditorNode, EditorProcess } from '../../editormodel';
import { UndoReducerInterface } from '../interface';
import { ModelAction } from '../model';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELSubprocess } from '../../../../serialize/interface/flowcontrolinterface';
import { MMELSubprocess } from '@paneron/libmmel/interface/flowcontrolinterface';
import { fillRDCS } from '../../../../utils/ModelFunctions';
import {
EditorDataClass,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DataType } from '../../../../serialize/interface/baseinterface';
import { MMELSubprocess } from '../../../../serialize/interface/flowcontrolinterface';
import { isRegistry } from '../../../../serialize/util/validation';
import { DataType } from '@paneron/libmmel/interface/baseinterface';
import { MMELSubprocess } from '@paneron/libmmel/interface/flowcontrolinterface';
import { isRegistry } from '@paneron/libmmel/util/validation';
import { createRegistry } from '../../../../utils/EditorFactory';
import {
fillRDCS,
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/enums.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELEnum } from '../../../serialize/interface/datainterface';
import { MMELEnum } from '@paneron/libmmel/interface/datainterface';
import { EditorNode, isEditorDataClass } from '../../editormodel';
import { UndoReducerInterface } from '../interface';
import { ModelAction } from '../model';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELFigure } from '../../../serialize/interface/supportinterface';
import { MMELFigure } from '@paneron/libmmel/interface/supportinterface';
import { EditorNode, isEditorProcess } from '../../editormodel';
import { UndoReducerInterface } from '../interface';
import { ModelAction } from '../model';
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/links.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useReducer } from 'react';
import { MMELLink } from '../../../serialize/interface/supportinterface';
import { MMELLink } from '@paneron/libmmel/interface/supportinterface';
import { UndoReducerInterface } from '../interface';

interface RefCascadeAction {
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useReducer } from 'react';
import { MMELMetadata } from '../../../serialize/interface/supportinterface';
import { MMELMetadata } from '@paneron/libmmel/interface/supportinterface';
import { UndoReducerInterface } from '../interface';

interface EditAction {
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/notes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useReducer } from 'react';
import { MMELNote } from '../../../serialize/interface/supportinterface';
import { MMELNote } from '@paneron/libmmel/interface/supportinterface';
import { refNotesReplace } from '../../../utils/handler/cascadeModelHandler';
import { UndoReducerInterface } from '../interface';

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useReducer } from 'react';
import {
MMELEdge,
MMELSubprocess,
} from '../../../serialize/interface/flowcontrolinterface';
} from '@paneron/libmmel/interface/flowcontrolinterface';
import { createSubprocessComponent } from '../../../utils/EditorFactory';
import {
dataPageReplace,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useReducer } from 'react';
import { MMELProvision } from '../../../serialize/interface/supportinterface';
import { MMELProvision } from '@paneron/libmmel/interface/supportinterface';
import { refProvisionReplace } from '../../../utils/handler/cascadeModelHandler';
import { UndoReducerInterface } from '../interface';

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
MMELNote,
MMELProvision,
MMELReference,
} from '../../../serialize/interface/supportinterface';
} from '@paneron/libmmel/interface/supportinterface';
import { EditorNode, isEditorDataClass } from '../../editormodel';
import { UndoReducerInterface } from '../interface';
import { ModelAction } from '../model';
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/roles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELRole } from '../../../serialize/interface/supportinterface';
import { MMELRole } from '@paneron/libmmel/interface/supportinterface';
import { RoleAttribute } from '../../../utils/handler/cascadeModelHandler';
import {
EditorNode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELTextSection } from '../../../serialize/interface/supportinterface';
import { MMELTextSection } from '@paneron/libmmel/interface/supportinterface';
import { UndoReducerInterface } from '../interface';
import { ItemAction, useItems } from './itemTemplate';

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELTable } from '../../../serialize/interface/supportinterface';
import { MMELTable } from '@paneron/libmmel/interface/supportinterface';
import { EditorNode, isEditorProcess } from '../../editormodel';
import { UndoReducerInterface } from '../interface';
import { ModelAction } from '../model';
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/terms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELTerm } from '../../../serialize/interface/supportinterface';
import { MMELTerm } from '@paneron/libmmel/interface/supportinterface';
import { UndoReducerInterface } from '../interface';
import { ItemAction, useItems } from './itemTemplate';

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/vars.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELVariable } from '../../../serialize/interface/supportinterface';
import { MMELVariable } from '@paneron/libmmel/interface/supportinterface';
import { UndoReducerInterface } from '../interface';
import { ModelAction } from '../model';
import { ItemAction, useItems } from './itemTemplate';
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/components/view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELView } from '../../../serialize/interface/supportinterface';
import { MMELView } from '@paneron/libmmel/interface/supportinterface';
import { UndoReducerInterface } from '../interface';
import { ModelAction } from '../model';
import { ItemAction, useItems } from './itemTemplate';
Expand Down
4 changes: 2 additions & 2 deletions packages/legacy/src/smart/model/editor/hybird/distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
* A3. If an undo is needed, execute the 'compiled' actions appended to the undo action
*/

import { MMELEdge } from '../../../serialize/interface/flowcontrolinterface';
import { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import {
MMELLink,
MMELNote,
MMELProvision,
MMELReference,
} from '../../../serialize/interface/supportinterface';
} from '@paneron/libmmel/interface/supportinterface';
import {
EditorDataClass,
EditorEGate,
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/smart/model/editor/hybird/egateedit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MMELEdge } from '../../../serialize/interface/flowcontrolinterface';
import { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import { EditorModel, isEditorEgate } from '../../editormodel';
import { ModelAction } from '../model';
import { HyEditAction } from './distributor';
Expand Down
Loading

0 comments on commit b34b7af

Please sign in to comment.