-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 62a2855
Showing
82 changed files
with
13,839 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# dependencies | ||
**/node_modules | ||
|
||
# testing | ||
**/coverage | ||
|
||
# build | ||
**/dist | ||
**/build | ||
|
||
# etc | ||
.DS_Store | ||
.idea | ||
**/.turbo | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import antfu from '@antfu/eslint-config'; | ||
|
||
const baseRules = { | ||
curly: ['error', 'multi-line'], | ||
'no-empty-function': ['error'], | ||
'eol-last': ['error', 'always'], | ||
'import/no-self-import': 'error', | ||
'ts/no-explicit-any': 'warn', | ||
'style/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 1 }], | ||
'style/brace-style': ['warn', '1tbs', { allowSingleLine: true }], | ||
'style/comma-dangle': ['error', { | ||
arrays: 'always-multiline', | ||
objects: 'always-multiline', | ||
imports: 'always-multiline', | ||
exports: 'always-multiline', | ||
enums: 'always-multiline', | ||
functions: 'never', | ||
}], | ||
'no-empty-function': 'off', | ||
'style/arrow-parens': ['error', 'always'], | ||
'ts/no-redeclare': 'off', | ||
'antfu/if-newline': 'off', | ||
'style/spaced-comment': 'off', | ||
'tunicorn/number-literal-case': 'off', | ||
'style/indent-binary-ops': 'off', | ||
'ts/method-signature-style': 'off', | ||
'style/indent': ['error', 4, { | ||
ObjectExpression: 'first', | ||
SwitchCase: 1, | ||
ignoreComments: true, | ||
}], | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
allowSeparatedGroups: false, | ||
// ignoreCase: false, | ||
ignoreCase: true, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], | ||
}, | ||
], | ||
// 'react/no-unstable-context-value': 'warn', | ||
// 'react/no-unstable-default-props': 'warn', | ||
'command/command': 'off', | ||
|
||
// TODO: debatable rules | ||
'test/prefer-lowercase-title': 'off', | ||
'antfu/top-level-function': 'off', | ||
'style/operator-linebreak': 'off', | ||
'unicorn/no-new-array': 'off', | ||
'unicorn/prefer-includes': 'off', | ||
'prefer-arrow-callback': 'off', | ||
'no-restricted-globals': 'off', | ||
'unicorn/prefer-string-starts-ends-with': 'warn', | ||
|
||
// TODO: just for compatibility with old code | ||
'unused-imports/no-unused-vars': 'warn', | ||
'style/jsx-closing-tag-location': 'warn', | ||
'ts/ban-types': 'warn', | ||
'unicorn/prefer-dom-node-text-content': 'warn', | ||
'unicorn/prefer-number-properties': 'warn', | ||
'no-prototype-builtins': 'warn', | ||
'style/no-tabs': 'warn', | ||
'style/quotes': ['warn', 'single', { avoidEscape: true }], | ||
|
||
// 'react/display-name': 'off', | ||
// 'react-hooks/rules-of-hooks': 'off', | ||
'eslint-comments/no-unlimited-disable': 'off', | ||
'ts/prefer-ts-expect-error': 'off', | ||
'ts/ban-ts-comment': 'off', | ||
'ts/no-duplicate-enum-values': 'off', | ||
'no-cond-assign': 'warn', | ||
'antfu/consistent-list-newline': 'off', | ||
'ts/no-use-before-define': 'warn', | ||
'intunicorn/number-literal-case': 'off', | ||
'test/no-identical-title': 'warn', | ||
'ts/no-non-null-asserted-optional-chain': 'warn', | ||
'no-restricted-syntax': 'warn', | ||
'prefer-regex-literals': 'warn', | ||
'ts/no-this-alias': 'warn', | ||
'prefer-promise-reject-errors': 'warn', | ||
'no-new': 'warn', | ||
'unicorn/error-message': 'warn', | ||
'ts/prefer-literal-enum-member': 'warn', | ||
'style/jsx-curly-newline': ['warn', { multiline: 'forbid', singleline: 'forbid' }], | ||
'no-control-regex': 'warn', | ||
'style/jsx-wrap-multilines': 'warn', | ||
'ts/no-import-type-side-effects': 'warn', | ||
'style/quote-props': ['warn', 'as-needed'], | ||
'unicorn/number-literal-case': 'warn', | ||
// 'react/no-direct-mutation-state': 'warn', | ||
'style/jsx-curly-brace-presence': 'warn', | ||
'style/multiline-ternary': 'warn', | ||
'unicorn/prefer-type-error': 'warn', | ||
'accessor-pairs': 'warn', | ||
}; | ||
|
||
const ignores = [ | ||
'submodules/univer-scraper-shared/*', | ||
]; | ||
|
||
export default antfu({ | ||
ignores, | ||
typescript: true, | ||
stylistic: { | ||
indent: 4, | ||
semi: true, | ||
}, | ||
rules: baseRules, | ||
yaml: { | ||
overrides: { | ||
'yaml/indent': ['error', 4, { indicatorValueIndent: 2 }], | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "univer-clipsheet-core", | ||
"type": "module", | ||
"version": "0.0.1", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"description": "", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dream-num/univer-crx.git" | ||
}, | ||
"engines": { | ||
"node": ">=18.12.0" | ||
}, | ||
"scripts": { | ||
"prepare": "simple-git-hooks", | ||
"clean": "rimraf dist && rimraf .turbo && turbo clean", | ||
"build": "rimraf dist && turbo build", | ||
"test": "turbo test", | ||
"type-check": "turbo type-check", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix" | ||
}, | ||
"dependencies": { | ||
"@wendellhu/redi": "0.16.1", | ||
"clsx": "2.1.1", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"rxjs": "7.8.1", | ||
"uuid": "11.0.3" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^2.18.0", | ||
"@types/chrome": "^0.0.268", | ||
"@types/node": "^20.12.12", | ||
"@types/react": "^18.3.2", | ||
"@types/react-dom": "^18.3.0", | ||
"@vitejs/plugin-react-swc": "^3.6.0", | ||
"autoprefixer": "^10.4.19", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.57.0", | ||
"lint-staged": "^15.2.2", | ||
"postcss": "^8.4.38", | ||
"rimraf": "^5.0.7", | ||
"simple-git-hooks": "^2.11.1", | ||
"tailwindcss": "^3.4.3", | ||
"tslib": "^2.6.2", | ||
"turbo": "^1.13.3", | ||
"typescript": "5.4.5", | ||
"vite": "^5.2.11" | ||
}, | ||
"simple-git-hooks": { | ||
"pre-commit": "pnpm lint-staged" | ||
}, | ||
"lint-staged": { | ||
"!(submodules/univer-scraper-shared/**/)*": "eslint --fix" | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { HighlightCover } from './cover'; | ||
|
||
export class CoverService { | ||
private _coverMap: Map<string, HighlightCover> = new Map(); | ||
|
||
addCover(id: string, element: HTMLElement) { | ||
const cover = new HighlightCover(); | ||
cover.attach(element); | ||
this._coverMap.set(id, cover); | ||
} | ||
|
||
updateCover(id: string, element: HTMLElement) { | ||
const cover = this._coverMap.get(id); | ||
cover?.attach(element); | ||
} | ||
|
||
removeCover(id: string) { | ||
const cover = this._coverMap.get(id); | ||
cover?.dispose(); | ||
this._coverMap.delete(id); | ||
} | ||
|
||
removeAllCovers() { | ||
this._coverMap.forEach((cover) => { | ||
cover.dispose(); | ||
}); | ||
this._coverMap.clear(); | ||
} | ||
} |
Oops, something went wrong.