Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
497bd8e
Update sidebar configuration logic in astro.config.ts to refine badge…
Nowely Nov 27, 2025
43d7071
Refactor Storybook configuration and testing setup
Nowely Nov 29, 2025
6a7cbcc
Refactor package names and update scripts in package.json files
Nowely Nov 29, 2025
2424369
Refactor Storybook structure and enhance configuration
Nowely Nov 29, 2025
9170706
Update Storybook configuration and add new components
Nowely Nov 29, 2025
51fec8b
Update Storybook configuration and add new components for enhanced te…
Nowely Nov 29, 2025
400daf8
Refactor Storybook Vite configuration and remove Vitest config file
Nowely Nov 29, 2025
c36e41c
Update dependencies and scripts across multiple packages
Nowely Nov 29, 2025
7f80efb
Update SingleContentEditable story to import Text component from shar…
Nowely Nov 29, 2025
f7511b4
Fix vitest React version conflict by adding dedupe configuration
Nowely Nov 29, 2025
e64b683
Use catalog React version in website package
Nowely Nov 29, 2025
65fb065
Add experimental contentEditable components and stories for Markdown …
Nowely Nov 29, 2025
ea177be
Refactor Storybook tests to use composeStories for better organization
Nowely Nov 29, 2025
34328bd
Refactor Storybook component imports and add new components
Nowely Nov 29, 2025
1947f84
Add MarkdownOptions component for enhanced markdown styling in Storybook
Nowely Nov 29, 2025
60bd29f
Add rc-marked-input integration for enhanced markdown input in app
Nowely Nov 29, 2025
ae930f3
Enhance Storybook with Playwright integration and update dependencies
Nowely Nov 30, 2025
a7eb0d0
Update tests in Base component to use 'it.todo' for unimplemented cases
Nowely Nov 30, 2025
9f34776
Refactor Storybook tests to utilize vitest/browser for user interactions
Nowely Nov 30, 2025
646be18
Remove deprecated @testing-library/jest-dom imports and update test a…
Nowely Nov 30, 2025
f6eb807
Update Nested component tests to use async assertions with vitest/bro…
Nowely Nov 30, 2025
e86e1f9
Update Slots component tests to use async assertions with vitest/brow…
Nowely Nov 30, 2025
f18c4e8
Refactor Storybook tests to utilize vitest-browser-react for renderin…
Nowely Dec 2, 2025
0019520
Refactor Base component tests to improve clarity and compatibility
Nowely Dec 4, 2025
ed3ca2c
Update dependencies across the project for improved compatibility and…
Nowely Dec 4, 2025
dbe5f25
Enhance Storybook configuration and testing setup
Nowely Dec 5, 2025
65fbae9
Update project configuration and documentation for improved clarity a…
Nowely Dec 5, 2025
5fee401
Remove integration test script from Storybook package.json and refact…
Nowely Dec 5, 2025
eeaa913
Update Storybook configuration and tests
Nowely Dec 5, 2025
f445f28
Update MarkedInputHandler documentation to reflect changes in type de…
Nowely Dec 5, 2025
9b5eefe
Update TypeScript configuration and Vite integration
Nowely Dec 5, 2025
c5b7520
Refactor Step3Demo component and update documentation
Nowely Dec 5, 2025
5c0f90b
Add verbatimModuleSyntax to TypeScript configuration
Nowely Dec 5, 2025
a3a62dd
Add type definitions for astro:content and update tsconfig.json
Nowely Dec 6, 2025
2c0ae19
Update tsconfig.json to include custom type definitions for astro:con…
Nowely Dec 6, 2025
b5fa85a
Update TypeScript configuration and clean up test files
Nowely Dec 6, 2025
7735a23
Update TypeScript configuration and clean up website package
Nowely Dec 6, 2025
65627c2
Update package.json and pnpm-lock.yaml for dependency management
Nowely Dec 6, 2025
17c2748
Add Playwright browser installation step to CI workflow
Nowely Dec 6, 2025
f716a39
Update CI workflow to install Playwright Chromium
Nowely Dec 6, 2025
f71d127
Add Playwright dependency and update CI workflow
Nowely Dec 6, 2025
7047c42
Update CI workflow to install Playwright browsers with dependencies
Nowely Dec 6, 2025
627c33a
Update CI workflow to install Playwright Chromium using pnpm
Nowely Dec 6, 2025
1af5c61
Remove Playwright dependency from package.json and pnpm-lock.yaml; up…
Nowely Dec 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- name: Setup Environment
uses: nowely/action-setup-node@v1

- name: Install Playwright Browsers
run: pnpm dlx playwright install --with-deps chromium

- name: Run Tests
run: pnpm test

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dist
coverage
storybook-static
package-lock.json
.pnpm-store/**
.pnpm-store/**
.vitest-attachments/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package.json
# Build outputs
dist/
coverage/
packages/website/.vercel/
packages/website/src/content/docs/

# Dependencies
node_modules/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A React component that lets you combine editable text with any component using annotated text.

**[Documentation](https://markput.vercel.app)** **[Storybook](https://marked-input.vercel.app)**
**[Documentation](https://markput.vercel.app)** **[Storybook](https://marked-input.vercel.app)**

## Feature

Expand Down
27 changes: 12 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
"pnpm": ">=9"
},
"scripts": {
"dev": "pnpm -F app-react dev",
"dev": "pnpm -F @markput/react-app dev",
"build": "pnpm -F rc-marked-input run build",
"build:all": "pnpm -r run build",
"storybook:dev": "pnpm -F sb run dev",
"storybook:build": "pnpm -F sb run build",
"website:dev": "pnpm -F website run dev",
"website:build": "pnpm -F website run build",
"storybook:dev": "pnpm -F @markput/react-storybook run dev",
"website:dev": "pnpm -F @markput/website run dev",
"clean:git": "git clean -xdf",
"clean:git:dry": "git clean -xdn",
"lint": "oxlint .",
Expand All @@ -24,12 +22,11 @@
"test": "pnpm -r run test",
"test:ui": "pnpm -r run test:ui",
"test:watch": "pnpm -r run test:watch",
"test:integration": "pnpm -r run test:integration",
"test:coverage": "pnpm -r run test:coverage",
"test:coverage": "pnpm -r run coverage",
"bench": "pnpm -r run bench",
"typecheck": "tsc --noEmit",
"use:local": "sed -i '' 's/\"rc-marked-input\": \"workspace:\\*\"/\"rc-marked-input\": \"file:..\\/markput\\/dist\"/g' packages/tests/package.json packages/storybook/package.json && pnpm install",
"use:workspace": "sed -i '' 's/\"rc-marked-input\": \"file:..\\\/markput\\\/dist\"/\"rc-marked-input\": \"workspace:*\"/g' packages/tests/package.json packages/storybook/package.json && pnpm install",
"typecheck": "tsc --noEmit && pnpm run -F @markput/website check",
"use:local": "sed -i '' 's/\"rc-marked-input\": \"workspace:\\*\"/\"rc-marked-input\": \"file:..\\/markput\\/dist\"/g' packages/storybook/package.json && pnpm install",
"use:workspace": "sed -i '' 's/\"rc-marked-input\": \"file:..\\/markput\\/dist\"/\"rc-marked-input\": \"workspace:*\"/g' packages/storybook/package.json && pnpm install",
"preinstall": "npx only-allow pnpm",
"publish": "pnpm -F rc-marked-input run publish"
},
Expand All @@ -38,14 +35,14 @@
"react-dom": "catalog:"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.55.1",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@microsoft/api-extractor": "^7.55.0",
"@vitejs/plugin-react-swc": "^4.2.2",
"oxlint": "^1.28.0",
"prettier": "3.6.2",
"typescript": "^5.9.2",
"vite": "^7.2.2",
"oxlint": "^1.31.0",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"vite": "^7.2.6",
"vite-plugin-css-injected-by-js": "^3.5.2"
}
}
7 changes: 4 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "app-react",
"name": "@markput/react-app",
"version": "1.0.0",
"description": "E2E test application for marked-input",
"license": "MIT",
Expand All @@ -10,15 +10,16 @@
"preview": "vite preview"
},
"dependencies": {
"rc-marked-input": "workspace:*",
"react": "catalog:",
"react-dom": "catalog:"
},
"devDependencies": {
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@vitejs/plugin-react-swc": "^4.2.2",
"typescript": "^5.9.2",
"vite": "^7.2.2"
"typescript": "^5.9.3",
"vite": "^7.2.6"
},
"type": "module"
}
88 changes: 85 additions & 3 deletions packages/app/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,92 @@
import React from 'react'
import React, {useState} from 'react'
import ReactDOM from 'react-dom/client'
import './style.css'
import {Story} from '../../storybook/stories'
import {createMarkedInput, denote} from 'rc-marked-input'
import type {MarkToken, Markup} from 'rc-marked-input'

const PrimaryMarkup: Markup = '@[__value__](primary:__meta__)'
const DefaultMarkup: Markup = '@[__value__](default:__meta__)'

const Button = ({label, primary, onClick}: {label: string; primary?: boolean; onClick?: () => void}) => (
<button
type="button"
onClick={onClick}
style={{
backgroundColor: primary ? '#1ea7fd' : 'transparent',
color: primary ? 'white' : '#333',
border: primary ? 'none' : '1px solid #ccc',
borderRadius: '3em',
padding: '0.5em 1em',
cursor: 'pointer',
fontSize: '14px',
}}
>
{label}
</button>
)

const ConfiguredMarkedInput = createMarkedInput({
Mark: Button,
options: [
{
markup: PrimaryMarkup,
slotProps: {
mark: ({value, meta}) => ({label: value || '', primary: true, onClick: () => alert(meta)}),
overlay: {
trigger: '@',
data: ['First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth'],
},
},
},
{
markup: DefaultMarkup,
slotProps: {
mark: ({value}) => ({label: value || ''}),
overlay: {
trigger: '/',
data: ['Seventh', 'Eight', 'Ninth'],
},
},
},
],
})

const App = () => {
const [value, setValue] = useState(
"Enter the '@' for calling @[primary](primary:4) suggestions and '/' for @[default](default:7)!\n" +
'Mark is can be a any component with any logic. In this example it is the @[Button](primary:54): clickable primary or secondary.\n' +
'For found mark used @[annotations](default:123).'
)

const displayText = denote(value, (mark: MarkToken) => mark.value, [PrimaryMarkup, DefaultMarkup])

return (
<>
<ConfiguredMarkedInput
value={value}
onChange={setValue}
slotProps={{
container: {
onClick: () => console.log('onClick'),
onInput: () => console.log('onInput'),
onBlur: () => console.log('onBlur'),
onFocus: () => console.log('onFocus'),
onKeyDown: () => console.log('onKeyDown'),
},
}}
/>

<br />
<b>Plain text:</b>
<pre>{value}</pre>
<b>Display text (denoted):</b>
<pre>{displayText}</pre>
</>
)
}

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<Story.Base.Configured />
<App />
</React.StrictMode>
)
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"test:related": "vitest related",
"test:ui": "vitest --ui",
"test:coverage": "vitest run --coverage",
"coverage": "vitest run --coverage",
"bench": "vitest bench --run"
},
"module": "./index.ts",
Expand Down
76 changes: 38 additions & 38 deletions packages/core/src/features/parsing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ Purpose: Handles parsing of text values into tokens and annotations
### Running Benchmarks

```bash
# Запуск бенчмарков (результаты автоматически сохраняются в JSON)
# Run benchmarks (results are saved to JSON automatically)
pnpm run bench

# Watch режим для разработки
# Watch mode for development
pnpm -F core run test:bench:watch
```

**Примечание:** Бенчмарки используют единый файл `parser.bench.ts`. Результаты автоматически сохраняются в `parser.bench.result.json` после каждого запуска.
**Note:** Benchmarks use the single file `parser.bench.ts`. Results are saved to `parser.bench.result.json` after each run.

### Benchmark Results Format

Результаты бенчмарков сохраняются в `parser.bench.result.json` с расширенными метриками производительности.
Benchmark results are stored in `parser.bench.result.json` with extended performance metrics.

#### Структура JSON
#### JSON structure

```json
{
Expand Down Expand Up @@ -56,63 +56,63 @@ pnpm -F core run test:bench:watch
}
```

#### Метрики
#### Metrics

Каждый тест включает следующие метрики:
Each test includes these metrics:

**Operations (ops)**

- `avg` - среднее количество операций в секунду
- `min` - минимальное значение
- `max` - максимальное значение
- `p95` - 95-й перцентиль
- `p99` - 99-й перцентиль
- `avg` - average operations per second
- `min` - minimum
- `max` - maximum
- `p95` - 95th percentile
- `p99` - 99th percentile

**Latency (latency)**

- Время выполнения одной операции в миллисекундах
- Те же статистики: avg, min, max, p95, p99
- Execution time of one operation in milliseconds
- Same stats: avg, min, max, p95, p99

**Memory (memory)**

- `heapUsed` - используемая heap память в KB
- `external` - внешняя память в KB
- `heapUsed` - heap memory used (KB)
- `external` - external memory (KB)

**Comparison**

- `ratio` - соотношение производительности v1/v2
- `winner` - какой парсер быстрее
- `performanceGap` - разница в процентах
- `latencyDiff` - соотношение latency
- `memoryRatio` - соотношение потребления памяти
- `ratio` - performance ratio v1/v2
- `winner` - which parser is faster
- `performanceGap` - percentage difference
- `latencyDiff` - latency ratio
- `memoryRatio` - memory usage ratio

#### Категории тестов
#### Test categories

**scalability**
Тесты масштабируемости с различным количеством marks (10, 50, 100, 500)
Scalability tests with different counts of marks (10, 50, 100, 500)

**realWorld**
Реальные сценарии использования:
Real-world scenarios:

- social media - посты с упоминаниями и хэштегами
- markdown-like - текст с markdown-подобной разметкой
- code comments - комментарии кода с аннотациями
- social media - posts with mentions and hashtags
- markdown-like - text with markdown-like markup
- code comments - code comments with annotations

#### Trends

Автоматический анализ изменений производительности между запусками:
Automatic analysis of performance changes between runs:

- `changeFromLast` - процентное изменение с последнего запуска
- `regressions` - список тестов с деградацией производительности (>5%)
- `changeFromLast` - percent change since the last run
- `regressions` - list of tests with performance degradation (>5%)

#### Интерпретация результатов
#### How to read results

1. **Высокий ops** - больше операций в секунду = лучше
2. **Низкий latency** - меньше времени на операцию = лучше
3. **Низкий memory** - меньше потребление памяти = лучше
4. **p95/p99** - показывают стабильность производительности
5. **Regressions** - требуют внимания при наличии
1. **High ops** - more operations per second = better
2. **Low latency** - less time per operation = better
3. **Low memory** - lower memory usage = better
4. **p95/p99** - show performance stability
5. **Regressions** - need attention if present

### История результатов
### Results history

Файл `parser.bench.result.json` хранит последние 10 запусков бенчмарков для анализа трендов и выявления регрессий.
The file `parser.bench.result.json` stores the last 10 benchmark runs for trend analysis and regression detection.
4 changes: 2 additions & 2 deletions packages/core/src/features/parsing/parser.profile.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ function createProfilingResult(currentRun: ProfilingRun, comparison?: ProfilingC
const testNames = Object.keys(currentRun.tests)
const totalDuration = testNames.reduce((sum, name) => sum + currentRun.tests[name].duration, 0)

// Расчет performance delta на основе comparison
// Calculate performance delta based on the comparison
let performanceDelta = '0.0%'

if (comparison) {
const avgChange =
comparison.differences.reduce((sum, diff) => sum + diff.durationChangePercent, 0) /
comparison.differences.length
// Инвертируем знак: положительное значение означает улучшение производительности
// Invert the sign: a positive value means performance improved
const performanceValue = -avgChange
performanceDelta = `${performanceValue >= 0 ? '+' : ''}${performanceValue.toFixed(1)}%`
}
Expand Down
5 changes: 3 additions & 2 deletions packages/markput/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ export interface Option<TMarkProps = MarkProps, TOverlayProps = OverlayProps> ex
}
}

export interface ConfiguredMarkedInput<TMarkProps = MarkProps, TOverlayProps = OverlayProps>
extends FunctionComponent<MarkedInputProps<TMarkProps, TOverlayProps>> {}
export interface ConfiguredMarkedInput<TMarkProps = MarkProps, TOverlayProps = OverlayProps> extends FunctionComponent<
MarkedInputProps<TMarkProps, TOverlayProps>
> {}

/**
* Available slots for customizing MarkedInput internal components
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {StorybookConfig} from '@storybook/react-vite'

const config: StorybookConfig = {
stories: ['./stories'],
staticDirs: ['./public'],
stories: ['../src/pages'],
staticDirs: ['../public'],
addons: ['@storybook/addon-links', '@storybook/addon-docs'],
framework: {
name: '@storybook/react-vite',
Expand Down
File renamed without changes.
Loading
Loading