diff --git a/.changeset/config.json b/.changeset/config.json index b957df8db0..17bac5f0d0 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,11 +1,15 @@ { "$schema": "https://unpkg.com/@changesets/config@1.5.0/schema.json", - "changelog": [ - "@changesets/changelog-github", - { "repo": "ianstormtaylor/slate" } - ], + "changelog": ["@changesets/changelog-github", { "repo": "deepnote/slate" }], "commit": false, - "linked": [["slate", "slate-history", "slate-hyperscript", "slate-react"]], + "linked": [ + [ + "@deepnote/slate", + "@deepnote/slate-history", + "@deepnote/slate-hyperscript", + "@deepnote/slate-react" + ] + ], "access": "public", "baseBranch": "deepnote", "updateInternalDependencies": "patch", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 344ccd5fe6..149dc1e599 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,9 +23,7 @@ jobs: - name: Setup node uses: actions/setup-node@v2 with: - node-version: 16.x - cache: yarn - key: node16 + node-version: 18.x - name: Run ${{ matrix.command }} run: yarn && yarn build && yarn ${{ matrix.command }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 6200f41afc..296b62d8f0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ main ] + branches: [ deepnote ] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [ deepnote ] schedule: - cron: '16 22 * * 3' diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml index 0fd62aa73e..192e965bfb 100644 --- a/.github/workflows/comment.yml +++ b/.github/workflows/comment.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest if: | github.event.issue.pull_request && - github.event.sender.login == 'ianstormtaylor' && + (github.event.sender.login == 'ianstormtaylor' || github.event.sender.login == 'saltenas') && startsWith(github.event.comment.body, '/release:next') steps: - name: Checkout repo @@ -45,10 +45,8 @@ jobs: - name: Setup node uses: actions/setup-node@v2 with: - node-version: 16.x - cache: yarn + node-version: 18.x registry-url: https://registry.npmjs.org - key: node16 - name: Install dependencies run: yarn @@ -67,11 +65,11 @@ jobs: - name: Get released version id: version - run: echo ::set-output name=version::$(node -p "require('./packages/slate/package.json').version") + run: echo "version=$(node -p \"require('./packages/slate/package.json').version\")" >> $GITHUB_OUTPUT - name: Create comment uses: peter-evans/create-or-update-comment@v1 with: issue-number: ${{ github.event.issue.number }} body: | - A new release has been made for this pull request. You can install it with `yarn add slate@${{ steps.version.outputs.version }}`. + A new release has been made for this pull request. You can install it with `yarn add @deepnote/slate@${{ steps.version.outputs.version }}`. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae1d8e7629..b81e9c8261 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: branches: - - main + - deepnote jobs: release: @@ -25,10 +25,8 @@ jobs: - name: Setup node uses: actions/setup-node@v2 with: - node-version: 16.x - cache: yarn + node-version: 18.x registry-url: https://registry.npmjs.org - key: node16 - name: Install dependencies run: yarn diff --git a/babel.config.js b/babel.config.js index 70b38e199c..efa2809bd8 100644 --- a/babel.config.js +++ b/babel.config.js @@ -6,4 +6,21 @@ module.exports = { ['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-react', ], + plugins: [ + [ + 'module-resolver', + { + alias: { + 'slate': './packages/slate/src', + 'slate-history': './packages/slate-history/src', + 'slate-hyperscript': './packages/slate-hyperscript/src', + 'slate-react': './packages/slate-react/src', + '@deepnote/slate': './packages/slate/src', + '@deepnote/slate-history': './packages/slate-history/src', + '@deepnote/slate-hyperscript': './packages/slate-hyperscript/src', + '@deepnote/slate-react': './packages/slate-react/src', + }, + }, + ], + ], } diff --git a/config/rollup/rollup.config.js b/config/rollup/rollup.config.js index 0e70a4c3ef..ac98db5e22 100644 --- a/config/rollup/rollup.config.js +++ b/config/rollup/rollup.config.js @@ -23,7 +23,9 @@ function configure(pkg, env, target) { const isUmd = target === 'umd' const isModule = target === 'module' const isCommonJs = target === 'cjs' - const input = `packages/${pkg.name}/src/index.ts` + // Strip scope from package name for directory paths (@deepnote/slate -> slate) + const pkgDir = pkg.name.replace(/^@[^/]+\//, '') + const input = `packages/${pkgDir}/src/index.ts` const deps = [] .concat(pkg.dependencies ? Object.keys(pkg.dependencies) : []) .concat(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []) @@ -44,7 +46,7 @@ function configure(pkg, env, target) { typescript({ abortOnError: false, - tsconfig: `./packages/${pkg.name}/tsconfig.json`, + tsconfig: `./packages/${pkgDir}/tsconfig.json`, // COMPAT: Without this flag sometimes the declarations are not updated. // clean: isProd ? true : false, clean: true, @@ -53,7 +55,7 @@ function configure(pkg, env, target) { // Allow Rollup to resolve CommonJS modules, since it only resolves ES2015 // modules by default. commonjs({ - exclude: [`packages/${pkg.name}/src/**`], + exclude: [`packages/${pkgDir}/src/**`], // HACK: Sometimes the CommonJS plugin can't identify named exports, so // we have to manually specify named exports here for them to work. // https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports @@ -78,7 +80,7 @@ function configure(pkg, env, target) { // Use Babel to transpile the result, limiting it to the source code. babel({ runtimeHelpers: true, - include: [`packages/${pkg.name}/src/**`], + include: [`packages/${pkgDir}/src/**`], extensions: ['.js', '.ts', '.tsx'], presets: [ '@babel/preset-typescript', @@ -128,7 +130,7 @@ function configure(pkg, env, target) { onwarn, output: { format: 'umd', - file: `packages/${pkg.name}/${isProd ? pkg.umdMin : pkg.umd}`, + file: `packages/${pkgDir}/${isProd ? pkg.umdMin : pkg.umd}`, exports: 'named', name: startCase(pkg.name).replace(/ /g, ''), globals: pkg.umdGlobals, @@ -144,7 +146,7 @@ function configure(pkg, env, target) { onwarn, output: [ { - file: `packages/${pkg.name}/${pkg.main}`, + file: `packages/${pkgDir}/${pkg.main}`, format: 'cjs', exports: 'named', sourcemap: true, @@ -166,7 +168,7 @@ function configure(pkg, env, target) { onwarn, output: [ { - file: `packages/${pkg.name}/${pkg.module}`, + file: `packages/${pkgDir}/${pkg.module}`, format: 'es', sourcemap: true, }, diff --git a/jest.config.js b/jest.config.js index 365e5c4cd4..1408e2b000 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,6 +7,16 @@ const config = { }, }, testEnvironment: 'jsdom', + moduleNameMapper: { + '^slate$': '/packages/slate/src', + '^slate-history$': '/packages/slate-history/src', + '^slate-hyperscript$': '/packages/slate-hyperscript/src', + '^slate-react$': '/packages/slate-react/src', + '^@deepnote/slate$': '/packages/slate/src', + '^@deepnote/slate-history$': '/packages/slate-history/src', + '^@deepnote/slate-hyperscript$': '/packages/slate-hyperscript/src', + '^@deepnote/slate-react$': '/packages/slate-react/src', + }, } module.exports = config diff --git a/package.json b/package.json index 96f537110a..8b10746c57 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ ], "scripts": { "build": "yarn build:rollup && yarn build:next", - "build:next": "cd ./site && next build && next export", + "build:next": "cd ./site && NODE_OPTIONS=\"$NODE_OPTIONS --openssl-legacy-provider\" next build && NODE_OPTIONS=\"$NODE_OPTIONS --openssl-legacy-provider\" next export", "build:rollup": "rollup --config ./config/rollup/rollup.config.js", "changesetversion": "yarn changeset version && yarn install && git add .", "clean": "rimraf './packages/*/{dist,lib,node_modules}' './site/{.next,out}'", @@ -54,6 +54,10 @@ "@babel/runtime": "^7.7.4", "@changesets/changelog-github": "^0.3.0", "@changesets/cli": "^2.14.1", + "@deepnote/slate": "workspace:*", + "@deepnote/slate-history": "workspace:*", + "@deepnote/slate-hyperscript": "workspace:*", + "@deepnote/slate-react": "workspace:*", "@emotion/css": "^11.7.1", "@testing-library/cypress": "^8.0.0", "@types/jest": "27.0.1", @@ -105,10 +109,6 @@ "rollup-plugin-typescript2": "^0.27.2", "shell-quote": "^1.7.2", "simple-git-hooks": ">=2.0.3", - "slate": "workspace:*", - "slate-history": "workspace:*", - "slate-hyperscript": "workspace:*", - "slate-react": "workspace:*", "source-map-loader": "^0.2.4", "ts-jest": "^27.1.3", "typescript": "3.9.7" diff --git a/packages/slate-history/package.json b/packages/slate-history/package.json index f43d406c12..7625f72ef9 100644 --- a/packages/slate-history/package.json +++ b/packages/slate-history/package.json @@ -1,9 +1,12 @@ { - "name": "slate-history", + "name": "@deepnote/slate-history", "description": "An operation-based history implementation for Slate editors.", "version": "0.66.0", "license": "MIT", - "repository": "git://github.com/ianstormtaylor/slate.git", + "repository": "git://github.com/deepnote/slate.git", + "publishConfig": { + "access": "public" + }, "main": "dist/index.js", "module": "dist/index.es.js", "types": "dist/index.d.ts", @@ -18,13 +21,13 @@ }, "devDependencies": { "@babel/runtime": "^7.7.4", + "@deepnote/slate": "workspace:*", + "@deepnote/slate-hyperscript": "workspace:*", "lodash": "^4.17.21", - "slate": "^0.81.0", - "slate-hyperscript": "^0.77.0", "source-map-loader": "^0.2.4" }, "peerDependencies": { - "slate": ">=0.65.3" + "@deepnote/slate": ">=0.65.3" }, "umdGlobals": { "slate": "Slate" diff --git a/packages/slate-history/src/history-editor.ts b/packages/slate-history/src/history-editor.ts index 6b0bb0a875..a0f42853fd 100644 --- a/packages/slate-history/src/history-editor.ts +++ b/packages/slate-history/src/history-editor.ts @@ -1,4 +1,4 @@ -import { BaseEditor, Editor } from 'slate' +import { BaseEditor, Editor } from '@deepnote/slate' import { History } from './history' /** diff --git a/packages/slate-history/src/history.ts b/packages/slate-history/src/history.ts index b0bc9333e2..63af3b9f8b 100644 --- a/packages/slate-history/src/history.ts +++ b/packages/slate-history/src/history.ts @@ -1,5 +1,5 @@ import { isPlainObject } from 'is-plain-object' -import { Operation } from 'slate' +import { Operation } from '@deepnote/slate' /** * `History` objects hold all of the operations that are applied to a value, so diff --git a/packages/slate-history/src/with-history.ts b/packages/slate-history/src/with-history.ts index 89af48c68e..38d7dfbf99 100644 --- a/packages/slate-history/src/with-history.ts +++ b/packages/slate-history/src/with-history.ts @@ -1,4 +1,4 @@ -import { Editor, Operation, Path } from 'slate' +import { Editor, Operation, Path } from '@deepnote/slate' import { HistoryEditor } from './history-editor' diff --git a/packages/slate-history/test/index.js b/packages/slate-history/test/index.js index 2aab12adbf..5dfedab35e 100644 --- a/packages/slate-history/test/index.js +++ b/packages/slate-history/test/index.js @@ -1,6 +1,6 @@ import assert from 'assert' import { fixtures } from '../../../support/fixtures' -import { createHyperscript } from 'slate-hyperscript' +import { createHyperscript } from '@deepnote/slate-hyperscript' import { withHistory } from '..' describe('slate-history', () => { diff --git a/packages/slate-hyperscript/package.json b/packages/slate-hyperscript/package.json index c3e6083c23..df6dd46836 100644 --- a/packages/slate-hyperscript/package.json +++ b/packages/slate-hyperscript/package.json @@ -1,9 +1,12 @@ { - "name": "slate-hyperscript", + "name": "@deepnote/slate-hyperscript", "description": "A hyperscript helper for creating Slate documents.", "version": "0.77.0", "license": "MIT", - "repository": "git://github.com/ianstormtaylor/slate.git", + "repository": "git://github.com/deepnote/slate.git", + "publishConfig": { + "access": "public" + }, "main": "dist/index.js", "module": "dist/index.es.js", "types": "dist/index.d.ts", @@ -18,11 +21,11 @@ }, "devDependencies": { "@babel/runtime": "^7.7.4", - "slate": "^0.81.0", + "@deepnote/slate": "workspace:*", "source-map-loader": "^0.2.4" }, "peerDependencies": { - "slate": ">=0.65.3" + "@deepnote/slate": ">=0.65.3" }, "umdGlobals": { "slate": "Slate" diff --git a/packages/slate-hyperscript/src/creators.ts b/packages/slate-hyperscript/src/creators.ts index cf7c7dc6b7..5249af24c2 100644 --- a/packages/slate-hyperscript/src/creators.ts +++ b/packages/slate-hyperscript/src/creators.ts @@ -1,4 +1,4 @@ -import { Element, Descendant, Node, Range, Text, Editor } from 'slate' +import { Element, Descendant, Node, Range, Text, Editor } from '@deepnote/slate' import { AnchorToken, FocusToken, diff --git a/packages/slate-hyperscript/src/hyperscript.ts b/packages/slate-hyperscript/src/hyperscript.ts index d521721328..85ca7cbecf 100644 --- a/packages/slate-hyperscript/src/hyperscript.ts +++ b/packages/slate-hyperscript/src/hyperscript.ts @@ -1,5 +1,5 @@ import { isPlainObject } from 'is-plain-object' -import { Element, createEditor as makeEditor } from 'slate' +import { Element, createEditor as makeEditor } from '@deepnote/slate' import { createAnchor, createCursor, diff --git a/packages/slate-hyperscript/src/tokens.ts b/packages/slate-hyperscript/src/tokens.ts index 0c63360ed8..c229db7add 100644 --- a/packages/slate-hyperscript/src/tokens.ts +++ b/packages/slate-hyperscript/src/tokens.ts @@ -1,4 +1,4 @@ -import { Node, Path, Text } from 'slate' +import { Node, Path, Text } from '@deepnote/slate' /** * A weak map to hold anchor tokens. diff --git a/packages/slate-react/package.json b/packages/slate-react/package.json index 108dd6ba6b..264e574fb4 100644 --- a/packages/slate-react/package.json +++ b/packages/slate-react/package.json @@ -1,9 +1,12 @@ { - "name": "slate-react", + "name": "@deepnote/slate-react", "description": "Tools for building completely customizable richtext editors with React.", "version": "0.81.0", "license": "MIT", - "repository": "git://github.com/ianstormtaylor/slate.git", + "repository": "git://github.com/deepnote/slate.git", + "publishConfig": { + "access": "public" + }, "main": "dist/index.js", "module": "dist/index.es.js", "types": "dist/index.d.ts", @@ -25,6 +28,8 @@ }, "devDependencies": { "@babel/runtime": "^7.7.4", + "@deepnote/slate": "workspace:*", + "@deepnote/slate-hyperscript": "workspace:*", "@types/jest": "^27.4.1", "@types/jsdom": "^16.2.14", "@types/react": "^16.9.13", @@ -33,14 +38,12 @@ "react": ">=16.8.0", "react-dom": ">=16.8.0", "react-test-renderer": ">=16.8.0", - "slate": "^0.81.0", - "slate-hyperscript": "^0.77.0", "source-map-loader": "^0.2.4" }, "peerDependencies": { + "@deepnote/slate": ">=0.65.3", "react": ">=16.8.0", - "react-dom": ">=16.8.0", - "slate": ">=0.65.3" + "react-dom": ">=16.8.0" }, "umdGlobals": { "react": "React", diff --git a/packages/slate-react/src/components/android/android-editable.tsx b/packages/slate-react/src/components/android/android-editable.tsx index 936314230f..eeb20cb1f0 100644 --- a/packages/slate-react/src/components/android/android-editable.tsx +++ b/packages/slate-react/src/components/android/android-editable.tsx @@ -1,5 +1,13 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import { Editor, Element, Node, Range, Transforms, Path, Text } from 'slate' +import { + Editor, + Element, + Node, + Range, + Transforms, + Path, + Text, +} from '@deepnote/slate' import throttle from 'lodash/throttle' import debounce from 'lodash/debounce' import scrollIntoView from 'scroll-into-view-if-needed' diff --git a/packages/slate-react/src/components/android/android-input-manager.ts b/packages/slate-react/src/components/android/android-input-manager.ts index 90cd531619..e00d0869a9 100644 --- a/packages/slate-react/src/components/android/android-input-manager.ts +++ b/packages/slate-react/src/components/android/android-input-manager.ts @@ -1,5 +1,5 @@ import { ReactEditor } from '../../plugin/react-editor' -import { Editor, Range, Transforms, Text } from 'slate' +import { Editor, Range, Transforms, Text } from '@deepnote/slate' import { IS_ON_COMPOSITION_END, EDITOR_ON_COMPOSITION_TEXT, diff --git a/packages/slate-react/src/components/android/diff-text.ts b/packages/slate-react/src/components/android/diff-text.ts index a7a9839565..afa76af646 100644 --- a/packages/slate-react/src/components/android/diff-text.ts +++ b/packages/slate-react/src/components/android/diff-text.ts @@ -1,4 +1,4 @@ -import { Editor, Path, Range, Text } from 'slate' +import { Editor, Path, Range, Text } from '@deepnote/slate' import { ReactEditor } from '../../' import { DOMNode } from '../../utils/dom' diff --git a/packages/slate-react/src/components/android/mutation-detection.ts b/packages/slate-react/src/components/android/mutation-detection.ts index bdfd70ae64..61464b8f84 100644 --- a/packages/slate-react/src/components/android/mutation-detection.ts +++ b/packages/slate-react/src/components/android/mutation-detection.ts @@ -1,4 +1,4 @@ -import { Editor, Node, Path, Range } from 'slate' +import { Editor, Node, Path, Range } from '@deepnote/slate' import { DOMNode } from '../../utils/dom' import { ReactEditor } from '../..' diff --git a/packages/slate-react/src/components/android/use-restore-dom.tsx b/packages/slate-react/src/components/android/use-restore-dom.tsx index 386ac94270..36e5968086 100644 --- a/packages/slate-react/src/components/android/use-restore-dom.tsx +++ b/packages/slate-react/src/components/android/use-restore-dom.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect, useRef } from 'react' -import { Node as SlateNode, Path } from 'slate' +import { Node as SlateNode, Path } from '@deepnote/slate' import { ReactEditor, useSlateStatic } from '../..' import { DOMNode, isDOMElement } from '../../utils/dom' import { ELEMENT_TO_NODE, NODE_TO_RESTORE_DOM } from '../../utils/weak-maps' diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index c9f831707b..b616e46dd7 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -9,7 +9,7 @@ import { Transforms, Path, RangeRef, -} from 'slate' +} from '@deepnote/slate' import getDirection from 'direction' import debounce from 'lodash/debounce' import throttle from 'lodash/throttle' diff --git a/packages/slate-react/src/components/element.tsx b/packages/slate-react/src/components/element.tsx index 8fcc6d1451..08f1cf9ead 100644 --- a/packages/slate-react/src/components/element.tsx +++ b/packages/slate-react/src/components/element.tsx @@ -1,6 +1,6 @@ import React, { Fragment, useRef } from 'react' import getDirection from 'direction' -import { Editor, Node, Range, Element as SlateElement } from 'slate' +import { Editor, Node, Range, Element as SlateElement } from '@deepnote/slate' import Text from './text' import useChildren from '../hooks/use-children' diff --git a/packages/slate-react/src/components/leaf.tsx b/packages/slate-react/src/components/leaf.tsx index 704fb2c734..32a886cdac 100644 --- a/packages/slate-react/src/components/leaf.tsx +++ b/packages/slate-react/src/components/leaf.tsx @@ -1,5 +1,5 @@ import React, { useRef, useEffect } from 'react' -import { Element, Text } from 'slate' +import { Element, Text } from '@deepnote/slate' import String from './string' import { PLACEHOLDER_SYMBOL } from '../utils/weak-maps' import { RenderLeafProps, RenderPlaceholderProps } from './editable' diff --git a/packages/slate-react/src/components/slate.tsx b/packages/slate-react/src/components/slate.tsx index 9e21a9d61b..126d3902fa 100644 --- a/packages/slate-react/src/components/slate.tsx +++ b/packages/slate-react/src/components/slate.tsx @@ -1,5 +1,5 @@ import React, { useState, useCallback, useEffect, useRef } from 'react' -import { Editor, Node, Descendant, Scrubber } from 'slate' +import { Editor, Node, Descendant, Scrubber } from '@deepnote/slate' import { ReactEditor } from '../plugin/react-editor' import { FocusedContext } from '../hooks/use-focused' import { EditorContext } from '../hooks/use-slate-static' diff --git a/packages/slate-react/src/components/string.tsx b/packages/slate-react/src/components/string.tsx index 7bd09c9888..890b471f06 100644 --- a/packages/slate-react/src/components/string.tsx +++ b/packages/slate-react/src/components/string.tsx @@ -1,5 +1,5 @@ import React, { useRef } from 'react' -import { Editor, Text, Path, Element, Node } from 'slate' +import { Editor, Text, Path, Element, Node } from '@deepnote/slate' import { ReactEditor, useSlateStatic } from '..' import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect' diff --git a/packages/slate-react/src/components/text.tsx b/packages/slate-react/src/components/text.tsx index 0d4abaae75..02febd3196 100644 --- a/packages/slate-react/src/components/text.tsx +++ b/packages/slate-react/src/components/text.tsx @@ -1,5 +1,5 @@ import React, { useRef } from 'react' -import { Range, Element, Text as SlateText } from 'slate' +import { Range, Element, Text as SlateText } from '@deepnote/slate' import Leaf from './leaf' import { ReactEditor, useSlateStatic } from '..' diff --git a/packages/slate-react/src/custom-types.ts b/packages/slate-react/src/custom-types.ts index 9c91b64c1d..912dfa209a 100644 --- a/packages/slate-react/src/custom-types.ts +++ b/packages/slate-react/src/custom-types.ts @@ -1,7 +1,7 @@ -import { BaseRange, BaseText } from 'slate' +import { BaseRange, BaseText } from '@deepnote/slate' import { ReactEditor } from './plugin/react-editor' -declare module 'slate' { +declare module '@deepnote/slate' { interface CustomTypes { Editor: ReactEditor Text: BaseText & { @@ -9,6 +9,7 @@ declare module 'slate' { } Range: BaseRange & { placeholder?: string + multiBlock?: boolean } } } diff --git a/packages/slate-react/src/hooks/use-children.tsx b/packages/slate-react/src/hooks/use-children.tsx index 4153e71c32..2667c7231b 100644 --- a/packages/slate-react/src/hooks/use-children.tsx +++ b/packages/slate-react/src/hooks/use-children.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Editor, Range, Element, Ancestor, Descendant } from 'slate' +import { Editor, Range, Element, Ancestor, Descendant } from '@deepnote/slate' import ElementComponent from '../components/element' import TextComponent from '../components/text' diff --git a/packages/slate-react/src/hooks/use-content-key.ts b/packages/slate-react/src/hooks/use-content-key.ts index f601947b2e..f0d885a0c2 100644 --- a/packages/slate-react/src/hooks/use-content-key.ts +++ b/packages/slate-react/src/hooks/use-content-key.ts @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from 'react' -import { Node as SlateNode } from 'slate' +import { Node as SlateNode } from '@deepnote/slate' import { NODE_TO_RESTORE_DOM } from '../utils/weak-maps' export function useContentKey(node: SlateNode) { diff --git a/packages/slate-react/src/hooks/use-decorate.ts b/packages/slate-react/src/hooks/use-decorate.ts index e2d112eea2..99650e70f2 100644 --- a/packages/slate-react/src/hooks/use-decorate.ts +++ b/packages/slate-react/src/hooks/use-decorate.ts @@ -1,5 +1,5 @@ import { createContext, useContext } from 'react' -import { Range, NodeEntry } from 'slate' +import { Range, NodeEntry } from '@deepnote/slate' /** * A React context for sharing the `decorate` prop of the editable. diff --git a/packages/slate-react/src/hooks/use-slate-selector.tsx b/packages/slate-react/src/hooks/use-slate-selector.tsx index e39db5ee19..11724af7f1 100644 --- a/packages/slate-react/src/hooks/use-slate-selector.tsx +++ b/packages/slate-react/src/hooks/use-slate-selector.tsx @@ -6,7 +6,7 @@ import { useReducer, useRef, } from 'react' -import { Editor } from 'slate' +import { Editor } from '@deepnote/slate' import { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect' function isError(error: any): error is Error { diff --git a/packages/slate-react/src/hooks/use-slate-static.tsx b/packages/slate-react/src/hooks/use-slate-static.tsx index 6f79151d95..9999444f87 100644 --- a/packages/slate-react/src/hooks/use-slate-static.tsx +++ b/packages/slate-react/src/hooks/use-slate-static.tsx @@ -1,6 +1,6 @@ import { createContext, useContext } from 'react' import { ReactEditor } from '../plugin/react-editor' -import { Editor } from 'slate' +import { Editor } from '@deepnote/slate' /** * A React context for sharing the editor object. diff --git a/packages/slate-react/src/hooks/use-slate.tsx b/packages/slate-react/src/hooks/use-slate.tsx index 8cab910afe..c65cde2882 100644 --- a/packages/slate-react/src/hooks/use-slate.tsx +++ b/packages/slate-react/src/hooks/use-slate.tsx @@ -1,5 +1,5 @@ import { createContext, useContext } from 'react' -import { Editor } from 'slate' +import { Editor } from '@deepnote/slate' import { ReactEditor } from '../plugin/react-editor' /** diff --git a/packages/slate-react/src/plugin/react-editor.ts b/packages/slate-react/src/plugin/react-editor.ts index 0e7111a099..2260bea287 100644 --- a/packages/slate-react/src/plugin/react-editor.ts +++ b/packages/slate-react/src/plugin/react-editor.ts @@ -7,7 +7,7 @@ import { Range, Scrubber, Transforms, -} from 'slate' +} from '@deepnote/slate' import { Key } from '../utils/key' import { diff --git a/packages/slate-react/src/plugin/with-react.ts b/packages/slate-react/src/plugin/with-react.ts index 2a757f3eae..6be1b1b57c 100644 --- a/packages/slate-react/src/plugin/with-react.ts +++ b/packages/slate-react/src/plugin/with-react.ts @@ -1,5 +1,12 @@ import ReactDOM from 'react-dom' -import { Editor, Node, Path, Operation, Transforms, Range } from 'slate' +import { + Editor, + Node, + Path, + Operation, + Transforms, + Range, +} from '@deepnote/slate' import { ReactEditor } from './react-editor' import { Key } from '../utils/key' diff --git a/packages/slate-react/src/utils/lines.ts b/packages/slate-react/src/utils/lines.ts index 960d77a559..8467410bd5 100644 --- a/packages/slate-react/src/utils/lines.ts +++ b/packages/slate-react/src/utils/lines.ts @@ -2,7 +2,7 @@ * Utilities for single-line deletion */ -import { Range, Editor } from 'slate' +import { Range, Editor } from '@deepnote/slate' import { ReactEditor } from '..' const doRectsIntersect = (rect: DOMRect, compareRect: DOMRect) => { diff --git a/packages/slate-react/src/utils/range-list.ts b/packages/slate-react/src/utils/range-list.ts index 71aff06979..bb84b6b693 100644 --- a/packages/slate-react/src/utils/range-list.ts +++ b/packages/slate-react/src/utils/range-list.ts @@ -1,4 +1,4 @@ -import { Range } from 'slate' +import { Range } from '@deepnote/slate' import { PLACEHOLDER_SYMBOL } from './weak-maps' export const shallowCompare = (obj1: {}, obj2: {}) => diff --git a/packages/slate-react/src/utils/weak-maps.ts b/packages/slate-react/src/utils/weak-maps.ts index 5c74d906e1..24e4d10130 100644 --- a/packages/slate-react/src/utils/weak-maps.ts +++ b/packages/slate-react/src/utils/weak-maps.ts @@ -1,4 +1,4 @@ -import { Ancestor, Editor, Node, RangeRef } from 'slate' +import { Ancestor, Editor, Node, RangeRef } from '@deepnote/slate' import { Key } from './key' import { TextInsertion } from '../components/android/diff-text' diff --git a/packages/slate-react/tsconfig.json b/packages/slate-react/tsconfig.json index 8169990f2a..0809e11c6a 100644 --- a/packages/slate-react/tsconfig.json +++ b/packages/slate-react/tsconfig.json @@ -3,7 +3,19 @@ "include": ["src/**/*"], "compilerOptions": { "rootDir": "./src", - "outDir": "./lib" + "outDir": "./lib", + "composite": true, + "baseUrl": ".", + "paths": { + "slate": ["../../packages/slate/src"], + "@deepnote/slate": ["../../packages/slate/src"], + "slate-history": ["../../packages/slate-history/src"], + "@deepnote/slate-history": ["../../packages/slate-history/src"], + "slate-hyperscript": ["../../packages/slate-hyperscript/src"], + "@deepnote/slate-hyperscript": ["../../packages/slate-hyperscript/src"], + "slate-react": ["./src"], + "@deepnote/slate-react": ["./src"] + } }, - "references": [{ "path": "../slate" }] + "references": [] } diff --git a/packages/slate/package.json b/packages/slate/package.json index d86d9e63aa..6c133f9d2c 100644 --- a/packages/slate/package.json +++ b/packages/slate/package.json @@ -1,9 +1,12 @@ { - "name": "slate", + "name": "@deepnote/slate", "description": "A completely customizable framework for building rich text editors.", "version": "0.81.1", "license": "MIT", - "repository": "git://github.com/ianstormtaylor/slate.git", + "repository": "git://github.com/deepnote/slate.git", + "publishConfig": { + "access": "public" + }, "main": "dist/index.js", "module": "dist/index.es.js", "types": "dist/index.d.ts", @@ -20,8 +23,8 @@ }, "devDependencies": { "@babel/runtime": "^7.7.4", + "@deepnote/slate-hyperscript": "workspace:*", "lodash": "^4.17.21", - "slate-hyperscript": "^0.77.0", "source-map-loader": "^0.2.4" }, "keywords": [ diff --git a/packages/slate/src/create-editor.ts b/packages/slate/src/create-editor.ts index 8b80514783..632912b828 100644 --- a/packages/slate/src/create-editor.ts +++ b/packages/slate/src/create-editor.ts @@ -296,7 +296,7 @@ export const createEditor = (): Editor => { } } }, - } + } as unknown as Editor return editor } diff --git a/packages/slate/src/utils/string.ts b/packages/slate/src/utils/string.ts index 83b0f86591..6c0cb4bb50 100644 --- a/packages/slate/src/utils/string.ts +++ b/packages/slate/src/utils/string.ts @@ -219,7 +219,7 @@ enum CodepointType { Any = 1 << 11, } -const reExtend = /^[\p{Gr_Ext}\p{EMod}]$/u +const reExtend = /^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1AC0\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/u const rePrepend = /^[\u0600-\u0605\u06DD\u070F\u0890-\u0891\u08E2\u0D4E\u{110BD}\u{110CD}\u{111C2}-\u{111C3}\u{1193F}\u{11941}\u{11A3A}\u{11A84}-\u{11A89}\u{11D46}]$/u const reSpacingMark = /^[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0982-\u0983\u09BF-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0B02-\u0B03\u0B40\u0B47-\u0B48\u0B4B-\u0B4C\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82-\u0C83\u0CBE\u0CC0-\u0CC1\u0CC3-\u0CC4\u0CC7-\u0CC8\u0CCA-\u0CCB\u0D02-\u0D03\u0D3F-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82-\u0D83\u0DD0-\u0DD1\u0DD8-\u0DDE\u0DF2-\u0DF3\u0E33\u0EB3\u0F3E-\u0F3F\u0F7F\u1031\u103B-\u103C\u1056-\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7-\u17C8\u1923-\u1926\u1929-\u192B\u1930-\u1931\u1933-\u1938\u1A19-\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B82\u1BA1\u1BA6-\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1C24-\u1C2B\u1C34-\u1C35\u1CE1\u1CF7\uA823-\uA824\uA827\uA880-\uA881\uA8B4-\uA8C3\uA952-\uA953\uA983\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BE-\uA9C0\uAA2F-\uAA30\uAA33-\uAA34\uAA4D\uAAEB\uAAEE-\uAAEF\uAAF5\uABE3-\uABE4\uABE6-\uABE7\uABE9-\uABEA\uABEC\u{11000}\u{11002}\u{11082}\u{110B0}-\u{110B2}\u{110B7}-\u{110B8}\u{1112C}\u{11145}-\u{11146}\u{11182}\u{111B3}-\u{111B5}\u{111BF}-\u{111C0}\u{111CE}\u{1122C}-\u{1122E}\u{11232}-\u{11233}\u{11235}\u{112E0}-\u{112E2}\u{11302}-\u{11303}\u{1133F}\u{11341}-\u{11344}\u{11347}-\u{11348}\u{1134B}-\u{1134D}\u{11362}-\u{11363}\u{11435}-\u{11437}\u{11440}-\u{11441}\u{11445}\u{114B1}-\u{114B2}\u{114B9}\u{114BB}-\u{114BC}\u{114BE}\u{114C1}\u{115B0}-\u{115B1}\u{115B8}-\u{115BB}\u{115BE}\u{11630}-\u{11632}\u{1163B}-\u{1163C}\u{1163E}\u{116AC}\u{116AE}-\u{116AF}\u{116B6}\u{11726}\u{1182C}-\u{1182E}\u{11838}\u{11931}-\u{11935}\u{11937}-\u{11938}\u{1193D}\u{11940}\u{11942}\u{119D1}-\u{119D3}\u{119DC}-\u{119DF}\u{119E4}\u{11A39}\u{11A57}-\u{11A58}\u{11A97}\u{11C2F}\u{11C3E}\u{11CA9}\u{11CB1}\u{11CB4}\u{11D8A}-\u{11D8E}\u{11D93}-\u{11D94}\u{11D96}\u{11EF5}-\u{11EF6}\u{16F51}-\u{16F87}\u{16FF0}-\u{16FF1}\u{1D166}\u{1D16D}]$/u const reL = /^[\u1100-\u115F\uA960-\uA97C]$/u @@ -227,7 +227,7 @@ const reV = /^[\u1160-\u11A7\uD7B0-\uD7C6]$/u const reT = /^[\u11A8-\u11FF\uD7CB-\uD7FB]$/u const reLV = /^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/u const reLVT = /^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\uC2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/u -const reExtPict = /^\p{ExtPict}$/u +const reExtPict = /^(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])$/u const getCodepointType = (char: string, code: number): CodepointType => { let type = CodepointType.Any @@ -302,12 +302,12 @@ function isBoundaryPair(left: CodepointType, right: CodepointType) { ) } -const endingEmojiZWJ = /\p{ExtPict}[\p{Gr_Ext}\p{EMod}]*\u200D$/u +const endingEmojiZWJ = new RegExp(`(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1AC0\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$`, 'u') const endsWithEmojiZWJ = (str: string): boolean => { return str.search(endingEmojiZWJ) !== -1 } -const endingRIs = /\p{RI}+$/gu +const endingRIs = /\uD83C[\uDDE6-\uDDFF]+$/gu const endsWithOddNumberOfRIs = (str: string): boolean => { const match = str.match(endingRIs) if (match === null) { diff --git a/site/examples/check-lists.tsx b/site/examples/check-lists.tsx index 5ae76e3e30..d787f66825 100644 --- a/site/examples/check-lists.tsx +++ b/site/examples/check-lists.tsx @@ -6,7 +6,7 @@ import { useSlateStatic, useReadOnly, ReactEditor, -} from 'slate-react' +} from '@deepnote/slate-react' import { Editor, Transforms, @@ -15,9 +15,9 @@ import { createEditor, Descendant, Element as SlateElement, -} from 'slate' +} from '@deepnote/slate' import { css } from '@emotion/css' -import { withHistory } from 'slate-history' +import { withHistory } from '@deepnote/slate-history' const initialValue: Descendant[] = [ { diff --git a/site/examples/code-highlighting.tsx b/site/examples/code-highlighting.tsx index 655eedd6b6..f68c9498d2 100644 --- a/site/examples/code-highlighting.tsx +++ b/site/examples/code-highlighting.tsx @@ -4,9 +4,14 @@ import 'prismjs/components/prism-php' import 'prismjs/components/prism-sql' import 'prismjs/components/prism-java' import React, { useState, useCallback, useMemo } from 'react' -import { Slate, Editable, withReact } from 'slate-react' -import { Text, createEditor, Element as SlateElement, Descendant } from 'slate' -import { withHistory } from 'slate-history' +import { Slate, Editable, withReact } from '@deepnote/slate-react' +import { + Text, + createEditor, + Element as SlateElement, + Descendant, +} from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { css } from '@emotion/css' const CodeHighlightingExample = () => { diff --git a/site/examples/custom-placeholder.tsx b/site/examples/custom-placeholder.tsx index 0a1c022c01..21d623efd4 100644 --- a/site/examples/custom-placeholder.tsx +++ b/site/examples/custom-placeholder.tsx @@ -1,7 +1,7 @@ import React, { useMemo } from 'react' -import { createEditor, Descendant } from 'slate' -import { Slate, Editable, withReact } from 'slate-react' -import { withHistory } from 'slate-history' +import { createEditor, Descendant } from '@deepnote/slate' +import { Slate, Editable, withReact } from '@deepnote/slate-react' +import { withHistory } from '@deepnote/slate-history' const initialValue: Descendant[] = [ { diff --git a/site/examples/custom-types.d.ts b/site/examples/custom-types.d.ts index d7ccb300ff..7536cf0805 100644 --- a/site/examples/custom-types.d.ts +++ b/site/examples/custom-types.d.ts @@ -6,9 +6,9 @@ import { Editor, Descendant, BaseEditor, -} from 'slate' -import { ReactEditor } from 'slate-react' -import { HistoryEditor } from 'slate-history' +} from '@deepnote/slate' +import { ReactEditor } from '@deepnote/slate-react' +import { HistoryEditor } from '@deepnote/slate-history' export type BlockQuoteElement = { type: 'block-quote' @@ -111,7 +111,7 @@ export type EmptyText = { export type CustomEditor = BaseEditor & ReactEditor & HistoryEditor -declare module 'slate' { +declare module '@deepnote/slate' { interface CustomTypes { Editor: CustomEditor Element: CustomElement diff --git a/site/examples/editable-voids.tsx b/site/examples/editable-voids.tsx index a2e1481dde..99415f24fc 100644 --- a/site/examples/editable-voids.tsx +++ b/site/examples/editable-voids.tsx @@ -1,7 +1,12 @@ import React, { useState, useMemo } from 'react' -import { Transforms, createEditor, Descendant } from 'slate' -import { Slate, Editable, useSlateStatic, withReact } from 'slate-react' -import { withHistory } from 'slate-history' +import { Transforms, createEditor, Descendant } from '@deepnote/slate' +import { + Slate, + Editable, + useSlateStatic, + withReact, +} from '@deepnote/slate-react' +import { withHistory } from '@deepnote/slate-history' import { css } from '@emotion/css' import RichTextEditor from './richtext' diff --git a/site/examples/embeds.tsx b/site/examples/embeds.tsx index 4e86ed945e..c55ff21e9e 100644 --- a/site/examples/embeds.tsx +++ b/site/examples/embeds.tsx @@ -4,14 +4,14 @@ import { createEditor, Element as SlateElement, Descendant, -} from 'slate' +} from '@deepnote/slate' import { Slate, Editable, withReact, useSlateStatic, ReactEditor, -} from 'slate-react' +} from '@deepnote/slate-react' const EmbedsExample = () => { const editor = useMemo(() => withEmbeds(withReact(createEditor())), []) diff --git a/site/examples/forced-layout.tsx b/site/examples/forced-layout.tsx index 2ec9bb135c..a359e27463 100644 --- a/site/examples/forced-layout.tsx +++ b/site/examples/forced-layout.tsx @@ -1,13 +1,13 @@ import React, { useCallback, useMemo } from 'react' -import { Slate, Editable, withReact } from 'slate-react' +import { Slate, Editable, withReact } from '@deepnote/slate-react' import { Transforms, createEditor, Node, Element as SlateElement, Descendant, -} from 'slate' -import { withHistory } from 'slate-history' +} from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { ParagraphElement, TitleElement } from './custom-types' const withLayout = editor => { diff --git a/site/examples/hovering-toolbar.tsx b/site/examples/hovering-toolbar.tsx index d8b4e2e29e..2ffa0ebd42 100644 --- a/site/examples/hovering-toolbar.tsx +++ b/site/examples/hovering-toolbar.tsx @@ -1,5 +1,11 @@ import React, { useMemo, useRef, useEffect } from 'react' -import { Slate, Editable, withReact, useSlate, useFocused } from 'slate-react' +import { + Slate, + Editable, + withReact, + useSlate, + useFocused, +} from '@deepnote/slate-react' import { Editor, Transforms, @@ -7,9 +13,9 @@ import { createEditor, Descendant, Range, -} from 'slate' +} from '@deepnote/slate' import { css } from '@emotion/css' -import { withHistory } from 'slate-history' +import { withHistory } from '@deepnote/slate-history' import { Button, Icon, Menu, Portal } from '../components' diff --git a/site/examples/huge-document.tsx b/site/examples/huge-document.tsx index 6d4b91b343..e258da5064 100644 --- a/site/examples/huge-document.tsx +++ b/site/examples/huge-document.tsx @@ -1,7 +1,7 @@ import React, { useMemo, useCallback } from 'react' import faker from 'faker' -import { createEditor, Descendant } from 'slate' -import { Slate, Editable, withReact } from 'slate-react' +import { createEditor, Descendant } from '@deepnote/slate' +import { Slate, Editable, withReact } from '@deepnote/slate-react' const HEADINGS = 100 const PARAGRAPHS = 7 diff --git a/site/examples/iframe.tsx b/site/examples/iframe.tsx index b15247bb67..a19b6e2626 100644 --- a/site/examples/iframe.tsx +++ b/site/examples/iframe.tsx @@ -1,9 +1,15 @@ import React, { useCallback, useMemo, useState } from 'react' import { createPortal } from 'react-dom' import isHotkey from 'is-hotkey' -import { Editable, withReact, useSlate, Slate, ReactEditor } from 'slate-react' -import { Editor, createEditor, Descendant } from 'slate' -import { withHistory } from 'slate-history' +import { + Editable, + withReact, + useSlate, + Slate, + ReactEditor, +} from '@deepnote/slate-react' +import { Editor, createEditor, Descendant } from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { Button, Icon, Toolbar } from '../components' diff --git a/site/examples/images.tsx b/site/examples/images.tsx index 6bdb959ccf..2d233b6b9d 100644 --- a/site/examples/images.tsx +++ b/site/examples/images.tsx @@ -1,7 +1,7 @@ import React, { useMemo } from 'react' import imageExtensions from 'image-extensions' import isUrl from 'is-url' -import { Transforms, createEditor, Descendant } from 'slate' +import { Transforms, createEditor, Descendant } from '@deepnote/slate' import { Slate, Editable, @@ -10,8 +10,8 @@ import { useFocused, withReact, ReactEditor, -} from 'slate-react' -import { withHistory } from 'slate-history' +} from '@deepnote/slate-react' +import { withHistory } from '@deepnote/slate-history' import { css } from '@emotion/css' import { Button, Icon, Toolbar } from '../components' diff --git a/site/examples/inlines.tsx b/site/examples/inlines.tsx index db1d20055a..89f1516632 100644 --- a/site/examples/inlines.tsx +++ b/site/examples/inlines.tsx @@ -2,8 +2,13 @@ import React, { useMemo } from 'react' import isUrl from 'is-url' import { isKeyHotkey } from 'is-hotkey' import { css } from '@emotion/css' -import { Editable, withReact, useSlate, useSelected } from 'slate-react' -import * as SlateReact from 'slate-react' +import { + Editable, + withReact, + useSlate, + useSelected, +} from '@deepnote/slate-react' +import * as SlateReact from '@deepnote/slate-react' import { Transforms, Editor, @@ -11,8 +16,8 @@ import { createEditor, Element as SlateElement, Descendant, -} from 'slate' -import { withHistory } from 'slate-history' +} from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { LinkElement, ButtonElement } from './custom-types' import { Button, Icon, Toolbar } from '../components' diff --git a/site/examples/markdown-preview.tsx b/site/examples/markdown-preview.tsx index 78811540f7..c48c51493e 100644 --- a/site/examples/markdown-preview.tsx +++ b/site/examples/markdown-preview.tsx @@ -1,8 +1,8 @@ import Prism from 'prismjs' import React, { useCallback, useMemo } from 'react' -import { Slate, Editable, withReact } from 'slate-react' -import { Text, createEditor, Descendant } from 'slate' -import { withHistory } from 'slate-history' +import { Slate, Editable, withReact } from '@deepnote/slate-react' +import { Text, createEditor, Descendant } from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { css } from '@emotion/css' // eslint-disable-next-line diff --git a/site/examples/markdown-shortcuts.tsx b/site/examples/markdown-shortcuts.tsx index 80e5f16729..35c2f51e9e 100644 --- a/site/examples/markdown-shortcuts.tsx +++ b/site/examples/markdown-shortcuts.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useMemo } from 'react' -import { Slate, Editable, withReact } from 'slate-react' +import { Slate, Editable, withReact } from '@deepnote/slate-react' import { Editor, Transforms, @@ -8,8 +8,8 @@ import { createEditor, Element as SlateElement, Descendant, -} from 'slate' -import { withHistory } from 'slate-history' +} from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { BulletedListElement } from './custom-types' const SHORTCUTS = { diff --git a/site/examples/mentions.tsx b/site/examples/mentions.tsx index 1839922993..658b9ffd21 100644 --- a/site/examples/mentions.tsx +++ b/site/examples/mentions.tsx @@ -1,6 +1,12 @@ import React, { useMemo, useCallback, useRef, useEffect, useState } from 'react' -import { Editor, Transforms, Range, createEditor, Descendant } from 'slate' -import { withHistory } from 'slate-history' +import { + Editor, + Transforms, + Range, + createEditor, + Descendant, +} from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { Slate, Editable, @@ -8,7 +14,7 @@ import { withReact, useSelected, useFocused, -} from 'slate-react' +} from '@deepnote/slate-react' import { Portal } from '../components' import { MentionElement } from './custom-types' diff --git a/site/examples/paste-html.tsx b/site/examples/paste-html.tsx index a3feceaf53..af80c10c5d 100644 --- a/site/examples/paste-html.tsx +++ b/site/examples/paste-html.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useMemo } from 'react' -import { jsx } from 'slate-hyperscript' -import { Transforms, createEditor, Descendant } from 'slate' -import { withHistory } from 'slate-history' +import { jsx } from '@deepnote/slate-hyperscript' +import { Transforms, createEditor, Descendant } from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { css } from '@emotion/css' import { Slate, @@ -9,7 +9,7 @@ import { withReact, useSelected, useFocused, -} from 'slate-react' +} from '@deepnote/slate-react' const ELEMENT_TAGS = { A: el => ({ type: 'link', url: el.getAttribute('href') }), diff --git a/site/examples/plaintext.tsx b/site/examples/plaintext.tsx index f4be6913e1..235b2ebeae 100644 --- a/site/examples/plaintext.tsx +++ b/site/examples/plaintext.tsx @@ -1,7 +1,7 @@ import React, { useMemo } from 'react' -import { createEditor, Descendant } from 'slate' -import { Slate, Editable, withReact } from 'slate-react' -import { withHistory } from 'slate-history' +import { createEditor, Descendant } from '@deepnote/slate' +import { Slate, Editable, withReact } from '@deepnote/slate-react' +import { withHistory } from '@deepnote/slate-history' const PlainTextExample = () => { const editor = useMemo(() => withHistory(withReact(createEditor())), []) diff --git a/site/examples/read-only.tsx b/site/examples/read-only.tsx index f17060e1b9..e41612cf99 100644 --- a/site/examples/read-only.tsx +++ b/site/examples/read-only.tsx @@ -1,6 +1,6 @@ import React, { useMemo } from 'react' -import { createEditor, Descendant } from 'slate' -import { Slate, Editable, withReact } from 'slate-react' +import { createEditor, Descendant } from '@deepnote/slate' +import { Slate, Editable, withReact } from '@deepnote/slate-react' const ReadOnlyExample = () => { const editor = useMemo(() => withReact(createEditor()), []) diff --git a/site/examples/richtext.tsx b/site/examples/richtext.tsx index 09a90adae9..151a336a20 100644 --- a/site/examples/richtext.tsx +++ b/site/examples/richtext.tsx @@ -1,14 +1,14 @@ import React, { useCallback, useMemo } from 'react' import isHotkey from 'is-hotkey' -import { Editable, withReact, useSlate, Slate } from 'slate-react' +import { Editable, withReact, useSlate, Slate } from '@deepnote/slate-react' import { Editor, Transforms, createEditor, Descendant, Element as SlateElement, -} from 'slate' -import { withHistory } from 'slate-history' +} from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' import { Button, Icon, Toolbar } from '../components' diff --git a/site/examples/scroll-into-view.tsx b/site/examples/scroll-into-view.tsx index 19abb80060..036f23f30e 100644 --- a/site/examples/scroll-into-view.tsx +++ b/site/examples/scroll-into-view.tsx @@ -1,7 +1,7 @@ import React, { useMemo } from 'react' -import { createEditor, Descendant } from 'slate' -import { Slate, Editable, withReact } from 'slate-react' -import { withHistory } from 'slate-history' +import { createEditor, Descendant } from '@deepnote/slate' +import { Slate, Editable, withReact } from '@deepnote/slate-react' +import { withHistory } from '@deepnote/slate-history' import { css } from '@emotion/css' import range from 'lodash/range' diff --git a/site/examples/search-highlighting.tsx b/site/examples/search-highlighting.tsx index 5a0d8ae5de..819c626436 100644 --- a/site/examples/search-highlighting.tsx +++ b/site/examples/search-highlighting.tsx @@ -1,8 +1,8 @@ import React, { useState, useCallback, useMemo } from 'react' -import { Slate, Editable, withReact } from 'slate-react' -import { Text, Descendant, createEditor } from 'slate' +import { Slate, Editable, withReact } from '@deepnote/slate-react' +import { Text, Descendant, createEditor } from '@deepnote/slate' import { css } from '@emotion/css' -import { withHistory } from 'slate-history' +import { withHistory } from '@deepnote/slate-history' import { Icon, Toolbar } from '../components' diff --git a/site/examples/shadow-dom.tsx b/site/examples/shadow-dom.tsx index 4dd47b5d69..cda7421047 100644 --- a/site/examples/shadow-dom.tsx +++ b/site/examples/shadow-dom.tsx @@ -1,8 +1,8 @@ import ReactDOM from 'react-dom' import React, { useMemo, useRef, useEffect } from 'react' -import { createEditor, Descendant } from 'slate' -import { Slate, Editable, withReact } from 'slate-react' -import { withHistory } from 'slate-history' +import { createEditor, Descendant } from '@deepnote/slate' +import { Slate, Editable, withReact } from '@deepnote/slate-react' +import { withHistory } from '@deepnote/slate-history' const ShadowDOM = () => { const container = useRef(null) diff --git a/site/examples/tables.tsx b/site/examples/tables.tsx index 7cc1b800d8..a68a543d98 100644 --- a/site/examples/tables.tsx +++ b/site/examples/tables.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useMemo } from 'react' -import { Slate, Editable, withReact } from 'slate-react' +import { Slate, Editable, withReact } from '@deepnote/slate-react' import { Editor, Range, @@ -7,8 +7,8 @@ import { Descendant, createEditor, Element as SlateElement, -} from 'slate' -import { withHistory } from 'slate-history' +} from '@deepnote/slate' +import { withHistory } from '@deepnote/slate-history' const TablesExample = () => { const renderElement = useCallback(props => , []) diff --git a/yarn.lock b/yarn.lock index 53608aac4c..a3219c6cd6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1784,6 +1784,79 @@ __metadata: languageName: node linkType: hard +"@deepnote/slate-history@workspace:*, @deepnote/slate-history@workspace:packages/slate-history": + version: 0.0.0-use.local + resolution: "@deepnote/slate-history@workspace:packages/slate-history" + dependencies: + "@babel/runtime": "npm:^7.7.4" + "@deepnote/slate": "workspace:*" + "@deepnote/slate-hyperscript": "workspace:*" + is-plain-object: "npm:^5.0.0" + lodash: "npm:^4.17.21" + source-map-loader: "npm:^0.2.4" + peerDependencies: + "@deepnote/slate": ">=0.65.3" + languageName: unknown + linkType: soft + +"@deepnote/slate-hyperscript@workspace:*, @deepnote/slate-hyperscript@workspace:packages/slate-hyperscript": + version: 0.0.0-use.local + resolution: "@deepnote/slate-hyperscript@workspace:packages/slate-hyperscript" + dependencies: + "@babel/runtime": "npm:^7.7.4" + "@deepnote/slate": "workspace:*" + is-plain-object: "npm:^5.0.0" + source-map-loader: "npm:^0.2.4" + peerDependencies: + "@deepnote/slate": ">=0.65.3" + languageName: unknown + linkType: soft + +"@deepnote/slate-react@workspace:*, @deepnote/slate-react@workspace:packages/slate-react": + version: 0.0.0-use.local + resolution: "@deepnote/slate-react@workspace:packages/slate-react" + dependencies: + "@babel/runtime": "npm:^7.7.4" + "@deepnote/slate": "workspace:*" + "@deepnote/slate-hyperscript": "workspace:*" + "@types/is-hotkey": "npm:^0.1.1" + "@types/jest": "npm:^27.4.1" + "@types/jsdom": "npm:^16.2.14" + "@types/lodash": "npm:^4.14.149" + "@types/react": "npm:^16.9.13" + "@types/react-dom": "npm:^16.9.4" + "@types/react-test-renderer": "npm:^16.8.0" + direction: "npm:^1.0.3" + is-hotkey: "npm:^0.1.6" + is-plain-object: "npm:^5.0.0" + lodash: "npm:^4.17.4" + react: "npm:>=16.8.0" + react-dom: "npm:>=16.8.0" + react-test-renderer: "npm:>=16.8.0" + scroll-into-view-if-needed: "npm:^2.2.20" + source-map-loader: "npm:^0.2.4" + tiny-invariant: "npm:1.0.6" + peerDependencies: + "@deepnote/slate": ">=0.65.3" + react: ">=16.8.0" + react-dom: ">=16.8.0" + languageName: unknown + linkType: soft + +"@deepnote/slate@workspace:*, @deepnote/slate@workspace:packages/slate": + version: 0.0.0-use.local + resolution: "@deepnote/slate@workspace:packages/slate" + dependencies: + "@babel/runtime": "npm:^7.7.4" + "@deepnote/slate-hyperscript": "workspace:*" + immer: "npm:^9.0.6" + is-plain-object: "npm:^5.0.0" + lodash: "npm:^4.17.21" + source-map-loader: "npm:^0.2.4" + tiny-warning: "npm:^1.0.3" + languageName: unknown + linkType: soft + "@emotion/babel-plugin@npm:^11.7.1": version: 11.7.2 resolution: "@emotion/babel-plugin@npm:11.7.2" @@ -14526,34 +14599,6 @@ __metadata: languageName: node linkType: hard -"slate-history@workspace:*, slate-history@workspace:packages/slate-history": - version: 0.0.0-use.local - resolution: "slate-history@workspace:packages/slate-history" - dependencies: - "@babel/runtime": "npm:^7.7.4" - is-plain-object: "npm:^5.0.0" - lodash: "npm:^4.17.21" - slate: "npm:^0.81.0" - slate-hyperscript: "npm:^0.77.0" - source-map-loader: "npm:^0.2.4" - peerDependencies: - slate: ">=0.65.3" - languageName: unknown - linkType: soft - -"slate-hyperscript@npm:^0.77.0, slate-hyperscript@workspace:*, slate-hyperscript@workspace:packages/slate-hyperscript": - version: 0.0.0-use.local - resolution: "slate-hyperscript@workspace:packages/slate-hyperscript" - dependencies: - "@babel/runtime": "npm:^7.7.4" - is-plain-object: "npm:^5.0.0" - slate: "npm:^0.81.0" - source-map-loader: "npm:^0.2.4" - peerDependencies: - slate: ">=0.65.3" - languageName: unknown - linkType: soft - "slate-packages@workspace:.": version: 0.0.0-use.local resolution: "slate-packages@workspace:." @@ -14573,6 +14618,10 @@ __metadata: "@babel/runtime": "npm:^7.7.4" "@changesets/changelog-github": "npm:^0.3.0" "@changesets/cli": "npm:^2.14.1" + "@deepnote/slate": "workspace:*" + "@deepnote/slate-history": "workspace:*" + "@deepnote/slate-hyperscript": "workspace:*" + "@deepnote/slate-react": "workspace:*" "@emotion/css": "npm:^11.7.1" "@testing-library/cypress": "npm:^8.0.0" "@types/jest": "npm:27.0.1" @@ -14624,61 +14673,12 @@ __metadata: rollup-plugin-typescript2: "npm:^0.27.2" shell-quote: "npm:^1.7.2" simple-git-hooks: "npm:>=2.0.3" - slate: "workspace:*" - slate-history: "workspace:*" - slate-hyperscript: "workspace:*" - slate-react: "workspace:*" source-map-loader: "npm:^0.2.4" ts-jest: "npm:^27.1.3" typescript: "npm:3.9.7" languageName: unknown linkType: soft -"slate-react@workspace:*, slate-react@workspace:packages/slate-react": - version: 0.0.0-use.local - resolution: "slate-react@workspace:packages/slate-react" - dependencies: - "@babel/runtime": "npm:^7.7.4" - "@types/is-hotkey": "npm:^0.1.1" - "@types/jest": "npm:^27.4.1" - "@types/jsdom": "npm:^16.2.14" - "@types/lodash": "npm:^4.14.149" - "@types/react": "npm:^16.9.13" - "@types/react-dom": "npm:^16.9.4" - "@types/react-test-renderer": "npm:^16.8.0" - direction: "npm:^1.0.3" - is-hotkey: "npm:^0.1.6" - is-plain-object: "npm:^5.0.0" - lodash: "npm:^4.17.4" - react: "npm:>=16.8.0" - react-dom: "npm:>=16.8.0" - react-test-renderer: "npm:>=16.8.0" - scroll-into-view-if-needed: "npm:^2.2.20" - slate: "npm:^0.81.0" - slate-hyperscript: "npm:^0.77.0" - source-map-loader: "npm:^0.2.4" - tiny-invariant: "npm:1.0.6" - peerDependencies: - react: ">=16.8.0" - react-dom: ">=16.8.0" - slate: ">=0.65.3" - languageName: unknown - linkType: soft - -"slate@npm:^0.81.0, slate@workspace:*, slate@workspace:packages/slate": - version: 0.0.0-use.local - resolution: "slate@workspace:packages/slate" - dependencies: - "@babel/runtime": "npm:^7.7.4" - immer: "npm:^9.0.6" - is-plain-object: "npm:^5.0.0" - lodash: "npm:^4.17.21" - slate-hyperscript: "npm:^0.77.0" - source-map-loader: "npm:^0.2.4" - tiny-warning: "npm:^1.0.3" - languageName: unknown - linkType: soft - "slice-ansi@npm:^2.1.0": version: 2.1.0 resolution: "slice-ansi@npm:2.1.0"