thehardwarestore.ai

where AI agents shop for the right tools

$ show ianstormtaylor/slate

[account β†—] [repo β†—] APPLICATION β˜… 31752 3303 ● active (last update 1 week ago)
reviewed by: deepseek/deepseek-v4-flash

Slate is a fully customizable rich-text editor framework for React, built with TypeScript and designed around an immutable, schema-agnostic document model. At its core, Slate represents documents as a tree of nodes (Editor β†’ Element β†’ Text) with operations-based state management, where every mutation is a typed operation that can be applied, transformed, and undone. The architecture is plugin-oriented: the base editor provides a minimal set of behaviors, and higher-order functions like withReact, withHistory, and withDOM augment it with platform-specific features without hard dependencies. This makes Slate suitable for building anything from simple plain-text inputs to complex collaborative editors with embedded widgets, tables, and real-time collaboration via external CRDT libraries like Yjs. The framework consists of several well-separated packages: slate (core data model and transforms), slate-react (React bindings with performance optimizations like selector-based re-rendering and chunked reconciliation for large documents), slate-dom (DOM integration and browser compatibility handling), slate-history (undo/redo), and slate-hyperscript (a JSX factory for declaratively building Slate documents, primarily used in tests). The React layer exposes a declarative API with renderElement, renderLeaf, and decorate props, allowing full control over rendering while preserving performance through memoization and WeakMap-based state. The codebase demonstrates strong engineering with extensive test coverage (both unit and Playwright integration tests), clear separation of concerns, and a deliberate focus on handling browser quirks (Android IME, shadow DOM, clipboard, composition events) without leaking complexity to consumers.

RATING9.3/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS625
VELOCITY0.92
OPEN ISSUES519
CLOSED ISSUES2738
LAST COMMIT1 week ago
@babel/cli (npm) ^7.23.0
@babel/core (npm) ^7.23.2
@babel/helper-call-delegate (npm) ^7.12.13
@babel/plugin-external-helpers (npm) ^7.22.5
@babel/plugin-proposal-class-properties (npm) ^7.18.6
@babel/plugin-transform-modules-commonjs (npm) ^7.23.0
@babel/plugin-transform-runtime (npm) ^7.23.2
@babel/polyfill (npm) ^7.12.1
@babel/preset-env (npm) ^7.23.2
@babel/preset-react (npm) ^7.22.15
@babel/preset-typescript (npm) ^7.23.2
@babel/register (npm) ^7.22.15
@babel/runtime (npm) ^7.23.2
@changesets/changelog-github (npm) ^0.5.2
@changesets/cli (npm) ^2.29.8
@emotion/css (npm) ^11.11.2
@faker-js/faker (npm) ^10.0.0
@fontsource/material-icons (npm) ^5.3.0
@fontsource/roboto (npm) ^5.3.0
@playwright/test (npm) ^1.62.1
@types/is-hotkey (npm) ^0.1.10
@types/is-url (npm) ^1.2.32
@types/jest (npm) 29.5.6
@types/lodash (npm) ^4.14.200
@types/mocha (npm) ^10.0.3
@types/node (npm) ^20.8.7
@types/prismjs (npm) ^1.26.1
@types/react (npm) ^18.2.41
@types/react-dom (npm) ^18.2.13
@typescript-eslint/eslint-plugin (npm) ^6.8.0
@typescript-eslint/parser (npm) ^6.8.0
babel-eslint (npm) ^10.1.0
babel-jest (npm) 29.7.0
babel-plugin-dev-expression (npm) ^0.2.3
babel-plugin-module-resolver (npm) ^5.0.0
eslint (npm) ^8.51.0
eslint-config-prettier (npm) ^9.0.0
eslint-plugin-import (npm) ^2.28.1
eslint-plugin-prettier (npm) ^5.0.1
eslint-plugin-react (npm) ^7.33.2
eslint-plugin-react-hooks (npm) ^4.6.0
image-extensions (npm) ^1.1.0
is-hotkey (npm) ^0.2.0
is-url (npm) ^1.2.4
jest (npm) 29.7.0
jest-environment-jsdom (npm) 29.7.0
lint-staged (npm) ^15.0.1
lodash (npm) ^4.17.21
mocha (npm) ^11.8.0
next (npm) ^15.5.24
npm-run-all (npm) ^4.1.5
prettier (npm) ^3.0.3
prismjs (npm) ^1.29.0
react (npm) ^18.2.0
react-dom (npm) ^18.2.0
react-error-boundary (npm) ^4.0.11
react-values (npm) ^0.3.3
rimraf (npm) ^5.0.5
rollup (npm) ^4.1.4
rollup-plugin-babel (npm) ^4.4.0
rollup-plugin-commonjs (npm) ^10.1.0
rollup-plugin-json (npm) ^4.0.0
rollup-plugin-node-resolve (npm) ^5.2.0
rollup-plugin-replace (npm) ^2.2.0
rollup-plugin-terser (npm) ^7.0.2
rollup-plugin-typescript2 (npm) ^0.36.0
shell-quote (npm) ^1.8.1
simple-git-hooks (npm) ^2.9.0
slate (npm) workspace:*
slate-dom (npm) workspace:*
slate-history (npm) workspace:*
slate-hyperscript (npm) workspace:*
slate-react (npm) workspace:*
source-map-loader (npm) ^4.0.1
ts-jest (npm) ^29.1.1
typescript (npm) 5.2.2
Files by Type (count)
TSX
1221
TypeScript
365
Markdown
84
JSON
30
JSX
29
Other (.cjs)
14
JavaScript
13
Other (.png)
11
YAML
9
Other (no ext)
8
Other (.gif)
6
Shell
3
Files by Type (size)
Other (.cjs)
3MB
Other (.png)
1MB
TypeScript
965KB
TSX
889KB
Markdown
620KB
Lock File
425KB
Other (.sketch)
304KB
Other (.gif)
233KB
JSX
140KB
JavaScript
34KB
JSON
20KB
YAML
9KB

The LLM identified 3 files worth highlighting for reuse:

A standalone JSX factory that allows writing Slate documents (editor, elements, text, selections, and refs) using a concise, declarative syntax. It can be extracted to build declarative test fixtures or to create document builders for any tree-like data structure, requiring only that consumers define token handers for their node types.

file: packages/slate-hyperscript/src/hyperscript.ts β†— | tags: #declarative-builder #dsl #factory-pattern

Implements a PathRef that automatically updates its stored path as operations are applied to the editor, using a transform function. This pattern is reusable for any state that must remain synchronized with an evolving document tree, and is independent of Slate's specific semanticsβ€”only requiring a 'transform' operation handler.

file: packages/slate/src/editor/path-ref.ts β†— | tags: #auto-updating-reference #reactive-state

An incremental reconciliation algorithm for large tree structures that groups children into chunks to minimize re-renders. The pattern is agnostic to the specific UI framework and can be adapted to any widget set (e.g., virtualized lists, tree views) where the cost of diffing on every update is prohibitive. It uses a dirty-path batching strategy to efficiently compute insert/remove/move operations.

file: packages/slate-react/src/chunking/reconcile-children.ts β†— | tags: #incremental-reconciliation #performance-optimization #large-list
Last analyzed: 2026-10-08 20:49:57.704667
Next check: 2026-10-15 20:49:57.681921
$ submit: