Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Test lates version #1710

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
}]
],
"plugins": [
["babel-plugin-import", { "libraryName": "antd" }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-private-methods",
"@babel/plugin-proposal-optional-chaining",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ npm install @heartexlabs/label-studio

```js
import LabelStudio from '@heartexlabs/label-studio';
import 'label-studio/build/static/css/main.css';
import 'label-studio/build/static/css/';
```

**With UNPKG.com**

```xhtml
<!-- Include Label Studio stylesheet -->
<link href="https://unpkg.com/@heartexlabs/label-studio@1.8.0/build/static/css/main.css" rel="stylesheet">
<link href="https://unpkg.com/@heartexlabs/label-studio@1.4.9/build/static/css/" rel="stylesheet">

<!-- Create the Label Studio container -->
<div id="label-studio"></div>

<!-- Include the Label Studio library -->
<script src="https://unpkg.com/@heartexlabs/label-studio@1.8.0/build/static/js/main.js"></script>
<script src="https://unpkg.com/@heartexlabs/label-studio@1.4.9/build/static/js/664.chunk.js"></script>
```

**Initialization**
Expand Down
113 changes: 51 additions & 62 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,73 +1,62 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
'bail': true,
'roots': [
'<rootDir>/src',
],
'preset': 'ts-jest',
'setupFilesAfterEnv': ['./jest.setup.js'],
'testEnvironment': 'jsdom',
'verbose': false,
'collectCoverageFrom': [
'**/*.{js,jsx,ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
'!**/examples/**',
],
'coverageDirectory': 'coverage',
'coverageReporters': ['json'],
'coverageThreshold': {
'global': {
'branches': 1,
'functions': 1,
'lines': 1,
'statements': 1,
bail: true,
roots: ['<rootDir>/src'],
preset: 'ts-jest',
setupFilesAfterEnv: ['./jest.setup.js'],
testEnvironment: 'jsdom',
verbose: false,
collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}', '!**/*.d.ts', '!**/node_modules/**', '!**/examples/**'],
coverageDirectory: 'coverage',
coverageReporters: ['json'],
coverageThreshold: {
global: {
branches: 1,
functions: 1,
lines: 1,
statements: 1,
},
},
'transform': {
'^.+\\.[tj]sx?$': ['babel-jest', {
'presets': [
['@babel/preset-react', {
'runtime': 'automatic',
}],
'@babel/preset-typescript',
['@babel/preset-env', {
'targets': {
'browsers': ['last 2 Chrome versions'],
'node': 'current',
},
}],
],
'plugins': [
['babel-plugin-import', { 'libraryName': 'antd' }],
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
],
}],
transform: {
'^.+\\.[tj]sx?$': [
'babel-jest',
{
presets: [
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
'@babel/preset-typescript',
[
'@babel/preset-env',
{
targets: {
browsers: ['last 2 Chrome versions'],
node: 'current',
},
},
],
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
],
},
],
},
'moduleFileExtensions': [
'js',
'ts',
'jsx',
'tsx',
],
'moduleDirectories': [
'node_modules',
],
'moduleNameMapper': {
moduleFileExtensions: ['js', 'ts', 'jsx', 'tsx'],
moduleDirectories: ['node_modules'],
moduleNameMapper: {
'^konva': 'konva/konva',
'^keymaster': 'identity-obj-proxy',
'^react-konva-utils': 'identity-obj-proxy',
'\\.(s[ac]ss|css|styl|svg|png|jpe?g)$': 'identity-obj-proxy',
},
'testPathIgnorePatterns': [
'/node_modules/',
'/e2e/',
],
'testRegex': '__tests__/.*.test.[tj]sx?',
'transformIgnorePatterns': [
'node_modules/?!(nanoid|konva)',
],
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
testRegex: '__tests__/.*.test.[tj]sx?',
transformIgnorePatterns: ['node_modules/?!(nanoid|konva)'],
};
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "@heartexlabs/label-studio",
"version": "1.4.0",
"name": "@pareto-engineering/label-studio",
"version": "1.4.9",
"description": "Data Labeling Tool that is backend agnostic and can be embedded into your applications",
"homepage": "https://labelstud.io",
"homepage": "https://pareto.ai",
"author": {
"name": "Heartex Labs",
"url": "https://github.com/heartexlabs"
},
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/heartexlabs/label-studio-frontend.git"
"url": "https://github.com/HelloPareto/label-studio-frontend.git"
},
"browser": "build/static/js/main.js",
"main": "build/static/js/main.js",
"files": [
"build/",
"images/",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md"
"CONTRIBUTING.md",
"scripts/"
],
"size-limit": [
{
Expand All @@ -45,8 +46,7 @@
"test:coverage": "yarn test -- --coverage",
"test:watch": "react-scripts test",
"test": "yarn jest src",
"coverage:merge": "npx nyc merge coverage/ coverage/coverage.json && rm -f coverage/*.coverage.json",
"postinstall": "sh scripts/postinstall.sh"
"coverage:merge": "npx nyc merge coverage/ coverage/coverage.json && rm -f coverage/*.coverage.json"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -133,11 +133,10 @@
"@types/strman": "^2.0.0",
"@types/wavesurfer.js": "^6.0.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.4.1",
"antd": "^4.3.3",
"antd": "^5.14.2",
"autoprefixer": "^10.4.2",
"babel-jest": "^29.3.1",
"babel-loader": "^8.2.2",
"babel-plugin-import": "^1.13.5",
"babel-plugin-remove-webpack": "^1.1.0",
"chroma-js": "^2.1.1",
"css-loader": "^6.7.3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/postinstall.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cp ./node_modules/@martel/audio-file-decoder/decode-audio.wasm ./node_modules/@martel/audio-file-decoder/dist/decode-audio.wasm
# cp ../../node_modules/@martel/audio-file-decoder/decode-audio.wasm ../../node_modules/@martel/audio-file-decoder/dist/decode-audio.wasm
2 changes: 1 addition & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ -z $1 ]; then
fi

VERSION=$1
COMPANY="heartexlabs"
COMPANY="pareto-engineering"
REPO="label-studio"

# Colors for colored output
Expand Down
20 changes: 10 additions & 10 deletions src/LabelStudio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { cleanDomAfterReact, findReactKey } from './utils/reactCleaner';
import { isDefined } from './utils/utilities';

declare global {
interface Window { Htx: any }
interface Window {
Htx: any;
}
}

configure({
Expand All @@ -32,12 +34,12 @@ type LSFTask = any;
// because those options will go as initial values for AppStore
// but it's not types yet, so here is some excerpt of its params
type LSFOptions = Record<string, any> & {
interfaces: string[],
keymap: Keymap,
user: LSFUser,
users: LSFUser[],
task: LSFTask,
}
interfaces: string[];
keymap: Keymap;
user: LSFUser;
users: LSFUser[];
task: LSFTask;
};

export class LabelStudio {
static Component = LabelStudioReact;
Expand Down Expand Up @@ -113,9 +115,7 @@ export class LabelStudio {
if (isRendered) {
clearRenderedApp();
}
render((
<App store={this.store} />
), rootElement);
render(<App store={this.store} />, rootElement);
};

const clearRenderedApp = () => {
Expand Down
10 changes: 4 additions & 6 deletions src/assets/styles/global.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
@import "~antd/dist/antd.css";

@import "./variables";
@import "./mixins";
@import "./functions";
@import './variables';
@import './mixins';
@import './functions';

.ant-divider-horizontal.ant-divider-with-text-center::before,
.ant-divider-horizontal.ant-divider-with-text-left::before,
Expand Down Expand Up @@ -66,7 +64,7 @@
}

.htx-yoyo:after {
content: "Yoyo";
content: 'Yoyo';
}

@keyframes fadeInOpacity {
Expand Down
15 changes: 6 additions & 9 deletions src/components/InstructionsModal/InstructionsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ export const InstructionsModal = ({
visible,
onCancel,
}: {
title: string,
children: React.ReactNode,
visible: boolean,
onCancel: () => void,
title: string;
children: React.ReactNode;
visible: boolean;
onCancel: () => void;
}) => {
const contentStyle: Record<string, string> = { padding: '0 24px 24px', whiteSpace: 'pre-wrap' };

return (
<>
<Modal
title=""
visible={visible}
open={visible}
maskClosable
footer={null}
closable={true}
Expand Down Expand Up @@ -49,10 +49,7 @@ export const InstructionsModal = ({
{title}
</h2>
{typeof children === 'string' ? (
<p
style={contentStyle}
dangerouslySetInnerHTML={{ __html: sanitizeHtml(children) }}
/>
<p style={contentStyle} dangerouslySetInnerHTML={{ __html: sanitizeHtml(children) }} />
) : (
<p style={contentStyle}>{children}</p>
)}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Tools/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ export default observer(
max={this.props.max || 50}
min={1}
vertical
tipFormatter={null}
style={{ height: this.props.height || 100 }}
onChange={this.props.onChange}
tooltip={{
formatter: null,
}}
/>
<Tooltip title={this.props.title} placement="left">
<Button
Expand Down
4 changes: 3 additions & 1 deletion src/components/Tools/SliderDropDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export default observer(
value={this.props.value}
min={0}
vertical
tipFormatter={null}
style={{ height: this.props.height || 100 }}
onChange={this.props.onChange}
tooltip={{
formatter: null,
}}
/>
<Button
shape="circle"
Expand Down
Loading
Loading