Skip to content

Commit

Permalink
build: change build-scripts to vite
Browse files Browse the repository at this point in the history
  • Loading branch information
1ncounter committed Mar 27, 2024
1 parent 50465d6 commit 17f736b
Show file tree
Hide file tree
Showing 146 changed files with 2,026 additions and 1,695 deletions.
5 changes: 4 additions & 1 deletion api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"mainEntryPointFilePath": "<projectFolder>/temp/index.d.ts",

"compiler": {
"tsconfigFilePath": "<projectFolder>/tsconfig.declaration.json"
"tsconfigFilePath": "<projectFolder>/tsconfig.declaration.json",
"overrideTsconfig": {
"baseUrl": "<projectFolder>/temp"
}
},

"dtsRollup": {
Expand Down
1 change: 0 additions & 1 deletion packages/designer/babel.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/designer/build.json

This file was deleted.

9 changes: 0 additions & 9 deletions packages/designer/build.test.json

This file was deleted.

54 changes: 0 additions & 54 deletions packages/designer/jest.config.js

This file was deleted.

73 changes: 41 additions & 32 deletions packages/designer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,56 @@
"name": "@alilc/lowcode-designer",
"version": "2.0.0-beta.0",
"description": "Designer for Ali LowCode Engine",
"main": "lib/index.js",
"module": "es/index.js",
"type": "module",
"main": "dist/designer.cjs",
"module": "dist/designer.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/designer.js",
"require": "./dist/designer.cjs",
"types": "./dist/index.d.ts"
}
},
"files": [
"lib",
"es"
"dist",
"src",
"package.json"
],
"scripts": {
"build": "build-scripts build",
"test": "build-scripts test --config build.test.json",
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
"build": "vite build",
"build-dts": "tsc -p tsconfig.declaration.json && node ../../scripts/rollup-dts.mjs",
"test": "vitest",
"test:cov": ""
},
"license": "MIT",
"dependencies": {
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"react": "^16",
"react-dom": "^16.7.0",
"@alilc/lowcode-editor-core": "workspace:*",
"@alilc/lowcode-types": "workspace:*",
"@alilc/lowcode-utils": "workspace:*",
"@alifd/next": "^1.27.8",
"classnames": "^2.5.1",
"lodash-es": "^4.17.20",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ric-shim": "^1.0.1",
"semver": "^7.3.5"
"semver": "^7.6.0",
"events": "^3.3.0"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.29",
"@testing-library/react": "^11.2.2",
"@types/classnames": "^2.2.7",
"@types/enzyme": "^3.10.12",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "^26.0.16",
"@types/lodash": "^4.14.165",
"@types/medium-editor": "^5.0.3",
"@types/node": "^13.7.1",
"@types/react": "^16",
"@types/react-dom": "^16",
"@types/semver": "7.3.9",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"jest": "^26.6.3",
"lodash": "^4.17.20",
"moment": "^2.29.1",
"typescript": "^4.0.3"
"@testing-library/react": "^14.2.2",
"@types/lodash-es": "^4.14.165",
"@types/prop-types": "^15.7.12",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/semver": "7.5.8",
"less": "^4.2.0"
},
"peerDependencies": {
"@alifd/next": "^1.27.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export class BorderDetectingInstance extends PureComponent<{
return (
<div className={className} style={style}>
<Title title={title} className="lc-borders-title" />
{
isLocked ? (<Title title={intl('locked')} className="lc-borders-status" />) : null
}
{isLocked ? <Title title={intl('locked')} className="lc-borders-status" /> : null}
</div>
);
}
Expand Down Expand Up @@ -77,7 +75,10 @@ export class BorderDetecting extends Component<{ host: BuiltinSimulatorHost }> {
const { current } = this;

const canHoverHook = current?.componentMeta.advanced.callbacks?.onHoverHook;
const canHover = (canHoverHook && typeof canHoverHook === 'function') ? canHoverHook(current.internalToShellNode()) : true;
const canHover =
canHoverHook && typeof canHoverHook === 'function'
? canHoverHook(current.internalToShellNode()!)
: true;

if (!canHover || !current || host.viewport.scrolling || host.liveEditing.editing) {
return null;
Expand All @@ -104,7 +105,7 @@ export class BorderDetecting extends Component<{ host: BuiltinSimulatorHost }> {
);
}

const lockedNode = getClosestNode(current, (n) => {
const lockedNode = getClosestNode(current as any, (n) => {
// 假如当前节点就是 locked 状态,要从当前节点的父节点开始查找
return !!(current?.isLocked ? n.parent?.isLocked : n.isLocked);
});
Expand All @@ -118,7 +119,10 @@ export class BorderDetecting extends Component<{ host: BuiltinSimulatorHost }> {
scrollX={this.scrollX}
scrollY={this.scrollY}
// @ts-ignore
rect={host.computeComponentInstanceRect(host.getComponentInstances(lockedNode)[0], lockedNode.componentMeta.rootSelector)}
rect={host.computeComponentInstanceRect(
host.getComponentInstances(lockedNode)![0],
lockedNode.componentMeta.rootSelector,
)}
isLocked={lockedNode?.getId() !== current.getId()}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ export class BoxResizingForNode extends Component<{ host: BuiltinSimulatorHost;
return null;
}
return (
<BoxResizingInstance key={observed.id} dragging={this.dragging} designer={designer} observed={observed} />
<BoxResizingInstance
key={observed.id}
dragging={this.dragging}
designer={designer}
observed={observed}
/>
);
})}
</Fragment>
Expand Down Expand Up @@ -135,41 +140,38 @@ export class BoxResizingInstance extends Component<{
// this.hoveringCapture.setBoundary(this.outline);
this.willBind();

const resize = (e: MouseEvent, direction: string, node: INode, moveX: number, moveY: number) => {
const resize = (
e: MouseEvent,
direction: string,
node: INode,
moveX: number,
moveY: number,
) => {
const { advanced } = node.componentMeta;
if (
advanced.callbacks &&
typeof advanced.callbacks.onResize === 'function'
) {
if (advanced.callbacks && typeof advanced.callbacks.onResize === 'function') {
(e as any).trigger = direction;
(e as any).deltaX = moveX;
(e as any).deltaY = moveY;
const cbNode = node?.isNode ? node.internalToShellNode() : node;
advanced.callbacks.onResize(e, cbNode);
advanced.callbacks.onResize(e as any, cbNode);
}
};

const resizeStart = (e: MouseEvent, direction: string, node: INode) => {
const { advanced } = node.componentMeta;
if (
advanced.callbacks &&
typeof advanced.callbacks.onResizeStart === 'function'
) {
if (advanced.callbacks && typeof advanced.callbacks.onResizeStart === 'function') {
(e as any).trigger = direction;
const cbNode = node?.isNode ? node.internalToShellNode() : node;
advanced.callbacks.onResizeStart(e, cbNode);
advanced.callbacks.onResizeStart(e as any, cbNode);
}
};

const resizeEnd = (e: MouseEvent, direction: string, node: INode) => {
const { advanced } = node.componentMeta;
if (
advanced.callbacks &&
typeof advanced.callbacks.onResizeEnd === 'function'
) {
if (advanced.callbacks && typeof advanced.callbacks.onResizeEnd === 'function') {
(e as any).trigger = direction;
const cbNode = node?.isNode ? node.internalToShellNode() : node;
advanced.callbacks.onResizeEnd(e, cbNode);
advanced.callbacks.onResizeEnd(e as any, cbNode as any);
}

const editor = node.document?.designer.editor;
Expand Down Expand Up @@ -241,14 +243,16 @@ export class BoxResizingInstance extends Component<{
let offsetTop = 0;
let offsetLeft = 0;
if (observed.hasOffset) {
offsetWidth = observed.offsetWidth;
offsetHeight = observed.offsetHeight;
offsetWidth = observed.offsetWidth!;
offsetHeight = observed.offsetHeight!;
offsetTop = observed.offsetTop;
offsetLeft = observed.offsetLeft;
const { node } = observed;
const metadata = node.componentMeta.getMetadata();
if (metadata.configure?.advanced?.getResizingHandlers) {
triggerVisible = metadata.configure.advanced.getResizingHandlers(node.internalToShellNode());
triggerVisible = metadata.configure.advanced.getResizingHandlers(
node.internalToShellNode(),
);
}
}
triggerVisible = normalizeTriggers(triggerVisible);
Expand Down
Loading

0 comments on commit 17f736b

Please sign in to comment.