Skip to content

Commit 2ff088e

Browse files
committed
Merge branch 'develop'
2 parents 61ae8b7 + 07bd835 commit 2ff088e

File tree

12 files changed

+363
-325
lines changed

12 files changed

+363
-325
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 bemit UG (haftungsbeschränkt)
3+
Copyright (c) 2025 Michael Becker <[email protected]> (https://bemit.codes)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ CodeMirror v6 integration for React, with MUI widgets for [UI-Schema](https://gi
1212
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
1313
![Typed](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555)
1414

15-
- [CodeMirror](https://codemirror.net/) v6 as plain React integration: `@ui-schema/kit-codemirror` [![npm (scoped)](https://img.shields.io/npm/v/@ui-schema/kit-codemirror?style=flat-square)](https://www.npmjs.com/package/@ui-schema/kit-codemirror) [![Component Documentation](https://img.shields.io/badge/Documentation-green?labelColor=0a6e8a&color=61dafb&logoColor=ffffff&style=flat-square&logo=react)](./docs/kit-codemirror/kit-codemirror.md)
16-
- UI-Schema Widgets for [MUI](https://mui.com): `@ui-schema/material-code` [![npm (scoped)](https://img.shields.io/npm/v/@ui-schema/material-code?style=flat-square)](https://www.npmjs.com/package/@ui-schema/material-code) [![Component Documentation](https://img.shields.io/badge/Documentation-green?labelColor=1a237e&color=0d47a1&logoColor=ffffff&style=flat-square&logo=mui)](./docs/material-code/material-code.md)
15+
- [CodeMirror v6](https://codemirror.net/) for React, with just the necessities:
16+
- `@ui-schema/kit-codemirror` [![npm (scoped)](https://img.shields.io/npm/v/@ui-schema/kit-codemirror?style=flat-square)](https://www.npmjs.com/package/@ui-schema/kit-codemirror)
17+
- [Documentation](./docs/kit-codemirror/kit-codemirror.md)
18+
- UI-Schema Widgets for [MUI](https://mui.com):
19+
- `@ui-schema/material-code` [![npm (scoped)](https://img.shields.io/npm/v/@ui-schema/material-code?style=flat-square)](https://www.npmjs.com/package/@ui-schema/material-code)
20+
- [Documentation](./docs/material-code/material-code.md)
1721

1822
[![Visit Core Project](https://img.shields.io/badge/Visit%20Core%20Project-blue?labelColor=fff&color=107b8c&style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNDYuMjkgMTQ0Ljg3Ij48ZGVmcz48c3R5bGU+LmE0M2YzMmM3LTZiOWUtNDZhZi05Y2RkLWUxNzc1YjJjNzZiMHtmaWxsOiMwMzM5NDQ7fS5lNDNmYmJjMS0xNWM1LTRhZmUtOTdkNS0yYTk3YzY3MGJmZTN7ZmlsbDojMDVhZWNhO308L3N0eWxlPjwvZGVmcz48dGl0bGU+VUktU2NoZW1hPC90aXRsZT48cGF0aCBjbGFzcz0iYTQzZjMyYzctNmI5ZS00NmFmLTljZGQtZTE3NzViMmM3NmIwIiBkPSJNNTMuMjgsM0MzNCwzLDMwLDIsMTguMTIsNS4yMmMtMTAsMi43Mi0xNiwxMi4zMS0xNiwyMi43NC0uMTMsMTctLjI5LDM0LC4wNiw1MC45My41OCwyOC43NSwyMS4zNiw1NS4zOCw1MC4wNyw2NC43OSwzOC42NCwxMi42Niw4MC4yLTguMjUsOTIuNjgtNDYuNjQuMTMtLjM5LjMxLTEuMzYuMzMtMS40Mi0xLjIyLjM4LTEuNCwxLjE2LTEuODMsMS45LTkuNjksMTctMjQuNDIsMjUuNjUtNDMuOTIsMjUuNzdhNDQuNDMsNDQuNDMsMCwwLDEtMjIuODQtNi42M2MtMTMtNy42Ni0yMS0xOC44NC0yMi45LTM0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMS45MyAtMi41MSkiLz48cGF0aCBjbGFzcz0iZTQzZmJiYzEtMTVjNS00YWZlLTk3ZDUtMmE5N2M2NzBiZmUzIiBkPSJNMTI1LjgsMzUuNzhjLTctOC40MS0xMy4xOS0xNy40MS0yMC42MS0yNS40NS02LjEyLDUuMjItOC4zMSwxMi4xOC04LjM4LDE5Ljg2LS4xMywxNC42NC0uMjEsMjkuMjguMDYsNDMuOTIuMjEsMTEuMzItNi40MiwyMC4xOC0xNywyMi41NkM3MC42NCw5OC43NCw2MC43Niw5NS40Nyw1NSw4NC4zNWExMi4yMiwxMi4yMiwwLDAsMC0xLjI2LTEuNzJjMS45MiwxNS4xOSw5LjkxLDI2LjM3LDIyLjksMzRhNDQuNDMsNDQuNDMsMCwwLDAsMjIuODQsNi42M2MxOS41LS4xMiwzNC4yMy04LjczLDQzLjkyLTI1Ljc3LjQzLS43NC42MS0xLjUyLDEuODMtMS45QzE0OSw4NC44LDE0OC4yNCwzMi4xNSwxNDgsMjEiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xLjkzIC0yLjUxKSIvPjxwYXRoIGNsYXNzPSJhNDNmMzJjNy02YjllLTQ2YWYtOWNkZC1lMTc3NWIyYzc2YjAiIGQ9Ik0xNDgsMjFWMy4xN2MtMy0uMTctMjEuMzUtMS44NS0zMS41My44OWEzMS42NSwzMS42NSwwLDAsMC0xMS4yOCw2LjI3YzcuNDIsOCwxMy42NSwxNywyMC42MSwyNS40NSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEuOTMgLTIuNTEpIi8+PC9zdmc+Cg==)](https://github.com/ui-schema/ui-schema)
1923

package-lock.json

Lines changed: 295 additions & 275 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"sloc": "node ./sloc.js",
3434
"release": "lerna publish from-package --contents build --no-git-reset"
3535
},
36-
"author": "Michael Becker, https://i-am-digital.eu",
36+
"author": "Michael Becker <[email protected]> (https://bemit.codes)",
3737
"license": "MIT",
3838
"devDependencies": {
3939
"@jest/types": "^29.6.3",

packages/demo/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.1.0",
55
"description": "",
66
"homepage": "",
7-
"author": "Michael Becker <[email protected]>",
7+
"author": "Michael Becker <[email protected]> (https://bemit.codes)",
88
"license": "MIT",
99
"scripts": {
1010
"tscheck": "tsc --noEmit"
@@ -27,14 +27,14 @@
2727
"@codemirror/lang-sql": "^6.0.0",
2828
"@codemirror/search": "^6.0.0",
2929
"@codemirror/language": "^6.1.0",
30-
"@ui-schema/dictionary": "~0.1.0-alpha.1",
31-
"@ui-schema/ds-material": "~0.5.0-alpha.1",
30+
"@ui-schema/dictionary": "~0.1.0-alpha.2",
31+
"@ui-schema/ds-material": "~0.5.0-alpha.2",
3232
"@ui-schema/kit-codemirror": "^1.0.0-alpha.0",
3333
"@ui-schema/material-code": "~0.5.0-alpha.0",
34-
"@ui-schema/react": "~0.5.0-alpha.1",
35-
"@ui-schema/ui-schema": "~0.5.0-alpha.1",
36-
"@ui-schema/json-schema": "~0.5.0-alpha.1",
37-
"@ui-schema/json-pointer": "~0.5.0-alpha.1",
34+
"@ui-schema/react": "~0.5.0-alpha.2",
35+
"@ui-schema/ui-schema": "~0.5.0-alpha.2",
36+
"@ui-schema/json-schema": "~0.5.0-alpha.2",
37+
"@ui-schema/json-pointer": "~0.5.0-alpha.2",
3838
"immutable": "^5.0.0",
3939
"react": "^19.0",
4040
"react-dom": "^19.0",

packages/demo/src/components/UISchema.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { schemaPluginsAdapterBuilder } from '@ui-schema/react/SchemaPluginsAdapt
55
import { StoreKeyType } from '@ui-schema/ui-schema/ValueStore'
66
import { Map } from 'immutable'
77
import React from 'react'
8-
import { baseComponents, typeWidgets } from '@ui-schema/ds-material/BindingDefault'
9-
import { bindingExtended } from '@ui-schema/ds-material/BindingExtended'
8+
import { bindingComponents } from '@ui-schema/ds-material/Binding/Components'
9+
import { widgetsDefault } from '@ui-schema/ds-material/Binding/WidgetsDefault'
10+
import { widgetsExtended } from '@ui-schema/ds-material/Binding/WidgetsExtended'
1011
import { SchemaGridHandler } from '@ui-schema/ds-material/Grid'
1112
import Button from '@mui/material/Button'
1213
import { json } from '@codemirror/lang-json'
@@ -94,12 +95,12 @@ const CustomWidgetCodeSelectable: React.ComponentType<WidgetProps> = (
9495
}
9596

9697
export const customBinding: MuiBinding = {
97-
...baseComponents,
98+
...bindingComponents,
9899

99100
// Widget mapping by schema type or custom ID.
100101
widgets: {
101-
...typeWidgets,
102-
...bindingExtended,
102+
...widgetsDefault,
103+
...widgetsExtended,
103104

104105
Code: CustomWidgetCode,
105106
CodeSelectable: CustomWidgetCodeSelectable,

packages/demo/src/pages/PageDemoComponent.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { isRemoteChange } from '@ui-schema/kit-codemirror/isRemoteChange'
12
import React from 'react'
23
import Container from '@mui/material/Container'
34
import Box from '@mui/material/Box'
@@ -129,8 +130,8 @@ const DemoComponentReadOnly = () => {
129130
const [readOnly, setReadOnly] = React.useState(false)
130131
const [value, setValue] = React.useState('')
131132

132-
const onChange: CodeMirrorOnChange = React.useCallback((editor, newValue) => {
133-
if(!editor.docChanged || typeof newValue !== 'string') {
133+
const onChange: CodeMirrorOnChange = React.useCallback((update, newValue) => {
134+
if(!update.docChanged || typeof newValue !== 'string' || isRemoteChange(update)) {
134135
return
135136
}
136137
setValue(newValue)

packages/demo/src/pages/PageDemoComponentMui.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Button from '@mui/material/Button'
2-
import { isRemoteChange } from '@ui-schema/kit-codemirror'
2+
import { isRemoteChange } from '@ui-schema/kit-codemirror/isRemoteChange'
33
import React from 'react'
44
import Container from '@mui/material/Container'
55
import Box from '@mui/material/Box'

packages/kit-codemirror/README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,31 @@
33
Thin-wrapper for CodeMirror v6 to use as React Component, with hooks and stuff to build more advanced editors easily.
44

55
- [Documentation](https://github.com/ui-schema/react-codemirror/blob/main/docs/kit-codemirror)
6-
- [Demo](https://github.com/ui-schema/react-codemirror/blob/main/packages/demo/src/pages/PageDemoComponent.tsx)
6+
- [Example Code](https://github.com/ui-schema/react-codemirror/blob/main/packages/demo/src/pages/PageDemoComponent.tsx)
7+
8+
```tsx
9+
import { useState, useCallback } from 'react'
10+
import { CodeMirror } from '@ui-schema/kit-codemirror/CodeMirror'
11+
import { isRemoteChange } from '@ui-schema/kit-codemirror/isRemoteChange'
12+
import type { CodeMirrorOnChange } from '@ui-schema/kit-codemirror/useCodeMirror'
13+
import type { CodeMirrorComponentProps, CodeMirrorProps } from '@ui-schema/kit-codemirror/CodeMirror'
14+
15+
const DemoComponent = () => {
16+
const [value, setValue] = useState('')
17+
18+
const onChange: CodeMirrorOnChange = useCallback((update, newValue) => {
19+
if(!update.docChanged || typeof newValue !== 'string' || isRemoteChange(update)) {
20+
return
21+
}
22+
setValue(newValue)
23+
}, [setValue])
24+
25+
return <CodeMirror
26+
value={value}
27+
onChange={onChange}
28+
/>
29+
}
30+
```
731

832
## License
933

packages/kit-codemirror/package.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
{
22
"name": "@ui-schema/kit-codemirror",
3-
"version": "1.0.0-alpha.2",
3+
"version": "1.0.0-alpha.3",
44
"description": "CodeMirror v6 as React Component, with hooks and stuff - but only the necessities.",
5-
"author": {
6-
"name": "bemit",
7-
"url": "https://bemit.codes"
8-
},
9-
"contributors": [
10-
{
11-
"name": "Michael Becker",
12-
"url": "https://i-am-digital.eu"
13-
}
14-
],
5+
"author": "Michael Becker <[email protected]> (https://bemit.codes)",
156
"license": "MIT",
167
"keywords": [
178
"codemirror",
189
"codemirror6",
1910
"react-component",
2011
"react"
2112
],
13+
"homepage": "https://github.com/ui-schema/react-codemirror/tree/main/packages/kit-codemirror",
2214
"repository": {
2315
"type": "git",
2416
"url": "https://github.com/ui-schema/react-codemirror.git",

0 commit comments

Comments
 (0)