@layers-app/editor 0.3.11 → 0.4.1-progress.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +215 -1
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.js +6 -6
  5. package/dist/layers.0EGX3HEy.js +1 -0
  6. package/dist/layers.1RmgGsLp.js +1 -0
  7. package/dist/layers.1df9kFxm.js +40 -0
  8. package/dist/layers.2aPuvps8.js +2235 -0
  9. package/dist/layers.3YvcJPBv.js +7 -0
  10. package/dist/layers.52famHy6.js +1 -0
  11. package/dist/layers.5l4Zrk2L.js +1 -0
  12. package/dist/layers.6hpmGhQ7.js +10 -0
  13. package/dist/layers.7JqFgE4-.js +15 -0
  14. package/dist/layers.7RKu5qAq.js +37 -0
  15. package/dist/layers.9QK1wiQj.js +1 -0
  16. package/dist/layers.9pNaFvaX.js +1 -0
  17. package/dist/layers.AmKAZWLq.js +11 -0
  18. package/dist/layers.B0J4f_xf.js +5 -0
  19. package/dist/layers.B19hGmey.js +1 -0
  20. package/dist/layers.B1O1xaS8.js +33 -0
  21. package/dist/layers.B2AGu32C.js +11692 -0
  22. package/dist/layers.B31bUvoU.js +37 -0
  23. package/dist/layers.B3BB_VRY.js +802 -0
  24. package/dist/layers.B3D4g2HH.js +1 -0
  25. package/dist/layers.B3jz2GM9.js +2479 -0
  26. package/dist/layers.B7pMHVvI.js +230 -0
  27. package/dist/layers.B8vyhX3w.js +40 -0
  28. package/dist/{layers.BnjxHNDK.js → layers.B93hVIUg.js} +84 -84
  29. package/dist/layers.B97E5Ket.js +41 -0
  30. package/dist/layers.B9oGbUwj.js +65 -0
  31. package/dist/layers.B9x4sQmU.js +9 -0
  32. package/dist/layers.B9yJUkZR.js +39 -0
  33. package/dist/layers.BArswBu6.js +1 -0
  34. package/dist/layers.BAtv1CM7.js +1 -0
  35. package/dist/layers.BCCZdUAo.js +6 -0
  36. package/dist/layers.BCpU6Rx2.js +207 -0
  37. package/dist/layers.BEWGfzM9.js +790 -0
  38. package/dist/layers.BFGghBqX.js +84 -0
  39. package/dist/layers.BGSQMYfb.js +3 -0
  40. package/dist/layers.BIOgNBCU.js +118 -0
  41. package/dist/layers.BIeVwYKL.js +1 -0
  42. package/dist/layers.BK7LrtsI.js +8 -0
  43. package/dist/layers.BKEU6fbU.js +268 -0
  44. package/dist/layers.BM5aqSQa.js +904 -0
  45. package/dist/layers.BMWTYLoS.js +1580 -0
  46. package/dist/layers.BNiUL2Vg.js +1283 -0
  47. package/dist/layers.BRbDF_Rn.js +40 -0
  48. package/dist/layers.BSJVn_-a.js +4 -0
  49. package/dist/{layers.C125HTat.js → layers.BSQmbaLA.js} +1 -1
  50. package/dist/layers.BSTBZrFn.js +1 -0
  51. package/dist/layers.BSZN_1IW.js +1 -0
  52. package/dist/layers.BU089OsF.js +160 -0
  53. package/dist/layers.BV_nreRT.js +5 -0
  54. package/dist/layers.BVzXy_Es.js +282 -0
  55. package/dist/layers.BX_VhzvH.js +4 -0
  56. package/dist/layers.BXlqVxG4.js +10 -0
  57. package/dist/layers.BY4eBmlK.js +37 -0
  58. package/dist/layers.BbCfEXyj.js +55 -0
  59. package/dist/layers.BcAvrhb2.js +11 -0
  60. package/dist/layers.Be4S2sq-.js +11 -0
  61. package/dist/layers.BejsVBlP.js +8 -0
  62. package/dist/layers.BfFWkiCr.js +8 -0
  63. package/dist/layers.BgOa2ZQq.js +7 -0
  64. package/dist/layers.BiJ8hfRt.js +1510 -0
  65. package/dist/layers.Bm9A8t2O.js +41 -0
  66. package/dist/layers.BmKPR1Q_.js +803 -0
  67. package/dist/layers.BpLN4VBV.js +35 -0
  68. package/dist/layers.Bp_LzOtD.js +6 -0
  69. package/dist/layers.BpilXLfW.js +6 -0
  70. package/dist/layers.BrlarkcH.js +1 -0
  71. package/dist/layers.BrwdJtoi.js +2966 -0
  72. package/dist/layers.BtWb_X9E.js +1088 -0
  73. package/dist/layers.BuQv8-pQ.js +10 -0
  74. package/dist/layers.BvcJQqPP.js +36 -0
  75. package/dist/layers.BwReZ0XC.js +8 -0
  76. package/dist/layers.C0uya3UC.js +257 -0
  77. package/dist/layers.C3Efr78e.js +1 -0
  78. package/dist/layers.C3kfFCwy.js +37 -0
  79. package/dist/layers.C4DnE7f4.js +9 -0
  80. package/dist/layers.C6dIKT7t.js +32 -0
  81. package/dist/layers.C6rE9oi4.js +5 -0
  82. package/dist/layers.C7lIplJU.js +247 -0
  83. package/dist/layers.C8_lu5UH.js +23 -0
  84. package/dist/layers.C9s4Ga9-.js +139 -0
  85. package/dist/layers.CA3xAcdD.js +84 -0
  86. package/dist/layers.CAt0Toqo.js +39 -0
  87. package/dist/layers.CBmWR4JD.js +41 -0
  88. package/dist/layers.CEnd1x3K.js +7 -0
  89. package/dist/layers.CEpgYsO5.js +10 -0
  90. package/dist/layers.CF3SIE-y.js +9 -0
  91. package/dist/layers.CFMVSllB.js +34 -0
  92. package/dist/layers.CGWEiDtE.js +501 -0
  93. package/dist/layers.CHV4TIWj.js +769 -0
  94. package/dist/layers.CHZsXQcr.js +1 -0
  95. package/dist/layers.CHe9Q8ia.js +9 -0
  96. package/dist/layers.CLX5RFJB.js +39 -0
  97. package/dist/layers.CLz5oPPj.js +1 -0
  98. package/dist/layers.CMV5IiUc.js +5 -0
  99. package/dist/layers.CN0RXanE.js +2 -0
  100. package/dist/layers.CNcbY4HA.js +6 -0
  101. package/dist/layers.COAF7f8g.js +1 -0
  102. package/dist/layers.COPB0bHF.js +2 -0
  103. package/dist/layers.CPGH36Hx.js +38 -0
  104. package/dist/layers.CQ_Gb_tr.js +40 -0
  105. package/dist/layers.CRIXCu9y.js +36 -0
  106. package/dist/layers.CRbZFXp0.js +10 -0
  107. package/dist/layers.CTHKUBrY.js +1 -0
  108. package/dist/layers.CTinG4fA.js +1 -0
  109. package/dist/layers.CUBdNh1l.js +139 -0
  110. package/dist/layers.CUKl38op.js +373 -0
  111. package/dist/layers.CUM6WWJc.js +10 -0
  112. package/dist/layers.CVO2cgHn.js +7 -0
  113. package/dist/layers.CVg-xbVM.js +9148 -0
  114. package/dist/layers.CWQb-v3n.js +59 -0
  115. package/dist/layers.CX7R1NFA.js +42 -0
  116. package/dist/layers.CY2dfUZP.js +220 -0
  117. package/dist/layers.C_YVSLx2.js +19 -0
  118. package/dist/layers.C_kJ5c3l.js +1089 -0
  119. package/dist/layers.CaXcZpWP.js +8 -0
  120. package/dist/layers.CacJtvRK.js +42 -0
  121. package/dist/layers.Cb-u0SLP.js +931 -0
  122. package/dist/layers.Cbk6-WFM.js +1 -0
  123. package/dist/layers.CcEJHfTE.js +6 -0
  124. package/dist/layers.CdKuzWdD.js +1 -0
  125. package/dist/layers.CeljVLEY.js +7 -0
  126. package/dist/layers.CjFEU6yv.js +36 -0
  127. package/dist/layers.CltyxC3q.js +39 -0
  128. package/dist/layers.CnZQE2Pi.js +5 -0
  129. package/dist/layers.Cpp1ZEuF.js +9 -0
  130. package/dist/layers.CpvexSFh.js +202 -0
  131. package/dist/layers.CqVTtuYm.js +6 -0
  132. package/dist/layers.Cs24L6er.js +261 -0
  133. package/dist/layers.CsUFpQDp.js +40 -0
  134. package/dist/layers.CutHJDp4.js +7 -0
  135. package/dist/layers.CvCD8PmL.js +39 -0
  136. package/dist/layers.CwE7GdQT.js +8 -0
  137. package/dist/layers.CwL5PiXG.js +8 -0
  138. package/dist/layers.CyPA2u9-.js +8 -0
  139. package/dist/layers.CzRgGVNU.js +41 -0
  140. package/dist/layers.D0zn4_Mx.js +1 -0
  141. package/dist/layers.D2KUO0dY.js +42 -0
  142. package/dist/layers.D2SIBPjl.js +41 -0
  143. package/dist/layers.D2Tzu1xx.js +116 -0
  144. package/dist/layers.D3rmRYuA.js +10 -0
  145. package/dist/layers.D4fGb2cV.js +1272 -0
  146. package/dist/layers.D56h41PX.js +1 -0
  147. package/dist/layers.D5Wk7Brs.js +10 -0
  148. package/dist/layers.D7jGxypv.js +8 -0
  149. package/dist/layers.D8g04PjT.js +9 -0
  150. package/dist/layers.D97nDwEx.js +9 -0
  151. package/dist/layers.D9Df9NSm.js +14 -0
  152. package/dist/layers.DBFfWJxR.js +51 -0
  153. package/dist/layers.DChAJIDE.js +40 -0
  154. package/dist/layers.DGjpnqy8.js +295 -0
  155. package/dist/layers.DKvSkiyS.js +52 -0
  156. package/dist/layers.DL83jGn_.js +61 -0
  157. package/dist/layers.DLwuMfdd.js +84 -0
  158. package/dist/layers.DMkBISW1.js +1 -0
  159. package/dist/layers.DMyyjog4.js +32 -0
  160. package/dist/layers.DN9HoVxI.js +18 -0
  161. package/dist/layers.DO-43L6O.js +423 -0
  162. package/dist/layers.DOrgOHBr.js +1 -0
  163. package/dist/layers.DPRdtwVX.js +10 -0
  164. package/dist/layers.DPkkvYnI.js +96 -0
  165. package/dist/layers.DRLM7uPa.js +1 -0
  166. package/dist/layers.DRk9pZsP.js +1 -0
  167. package/dist/layers.DRrRO-pI.js +39 -0
  168. package/dist/layers.DS6sUpQY.js +70 -0
  169. package/dist/layers.DSNZlSxG.js +40 -0
  170. package/dist/layers.DT14b_tp.js +122 -0
  171. package/dist/layers.DU9bT12-.js +11 -0
  172. package/dist/layers.DVysgz_L.js +9 -0
  173. package/dist/layers.DWyWcSYq.js +425 -0
  174. package/dist/layers.DYgifwCe.js +1265 -0
  175. package/dist/layers.DYrmRjRC.js +1034 -0
  176. package/dist/layers.DZVdzwBS.js +1 -0
  177. package/dist/layers.DbaKVP5e.js +1 -0
  178. package/dist/layers.Dd8k3mGW.js +32 -0
  179. package/dist/layers.Dera5nI8.js +8 -0
  180. package/dist/layers.DfHyYQto.js +1 -0
  181. package/dist/layers.Dg-bFIGZ.js +6 -0
  182. package/dist/layers.Dj2x2a5K.js +7 -0
  183. package/dist/layers.DjRYd6_J.js +6 -0
  184. package/dist/layers.DjUOC4st.js +16 -0
  185. package/dist/layers.Dlx-9qlV.js +4 -0
  186. package/dist/layers.DmXbI_X6.js +32 -0
  187. package/dist/layers.Dn51Gu3w.js +42 -0
  188. package/dist/layers.DnGlTnoF.js +8 -0
  189. package/dist/layers.DnXE-nI2.js +32 -0
  190. package/dist/layers.DneGJ5YW.js +36 -0
  191. package/dist/layers.DnyqZntR.js +1 -0
  192. package/dist/layers.DvXH8BN-.js +4 -0
  193. package/dist/layers.DvbNClAr.js +11 -0
  194. package/dist/layers.DwlMkCL5.js +1 -0
  195. package/dist/layers.DxA6ocdw.js +70 -0
  196. package/dist/layers.Dy1naDTQ.js +14 -0
  197. package/dist/layers.Fwx6Z-E0.js +7 -0
  198. package/dist/layers.GqCRYDXG.js +1619 -0
  199. package/dist/layers.Iok4Hx4P.js +1 -0
  200. package/dist/layers.JWCLFILJ.js +1 -0
  201. package/dist/layers.JWXTGwdn.js +39 -0
  202. package/dist/layers.Lv1hsK8F.js +42 -0
  203. package/dist/layers.MRw7LhZs.js +185 -0
  204. package/dist/layers.MZxHWl05.js +437 -0
  205. package/dist/layers.MfF8Mar4.js +40 -0
  206. package/dist/layers.NZaKqPGi.js +320 -0
  207. package/dist/layers.O16Qu9DR.js +38 -0
  208. package/dist/layers.OJEt97_Q.js +1 -0
  209. package/dist/layers.OkAEP5sK.js +41 -0
  210. package/dist/layers.QKd6brRD.js +1 -0
  211. package/dist/layers.QgpZpst1.js +1 -0
  212. package/dist/layers.RkLEX3Zh.js +7 -0
  213. package/dist/layers.RskRv7xC.js +33 -0
  214. package/dist/layers.Ru0qupSB.js +32 -0
  215. package/dist/layers.W2ukY1Da.js +960 -0
  216. package/dist/layers.XHdBpBIc.js +38 -0
  217. package/dist/layers.Y42vCoBD.js +40 -0
  218. package/dist/layers.ZQ_-z-aL.js +10 -0
  219. package/dist/layers.b0h5ZBmD.js +61 -0
  220. package/dist/layers.b6DSxQLV.js +186 -0
  221. package/dist/layers.erJbqYPP.js +9 -0
  222. package/dist/layers.gBi0hIYC.js +13 -0
  223. package/dist/layers.lCpg7dOn.js +21 -0
  224. package/dist/layers.ms8NfStk.js +41 -0
  225. package/dist/layers.mwnm89da.js +21763 -0
  226. package/dist/layers.nHHM2gEW.js +39 -0
  227. package/dist/layers.nbOz9XY9.js +44 -0
  228. package/dist/layers.p871JVGx.js +1359 -0
  229. package/dist/layers.pmoMn3BH.js +793 -0
  230. package/dist/layers.pw41pFms.js +35 -0
  231. package/dist/layers.rNpo9CKl.js +1126 -0
  232. package/dist/layers.uf8nbAjB.js +39 -0
  233. package/dist/layers.vXYsjfZS.js +9 -0
  234. package/dist/layers.vggOk4T3.js +48146 -0
  235. package/dist/layers.vmEHkEhU.js +21938 -0
  236. package/dist/{layers.YZkXZvVS.js → layers.vrcLKgWz.js} +14947 -13808
  237. package/dist/layers.vsJbLxBG.js +2 -0
  238. package/dist/layers.wmlkGZ6N.js +41 -0
  239. package/dist/layers.xJXWA8H6.js +35 -0
  240. package/dist/layers.zPlc1039.js +40 -0
  241. package/package.json +32 -16
  242. package/dist/layers.Cjs5EBWM.js +0 -343
  243. package/dist/layers.DPccTctI.js +0 -285
  244. package/dist/layers.DZ8DrrVn.js +0 -53491
  245. package/dist/layers.QVaGPbs3.js +0 -161
  246. package/dist/layers.VK3NB7Nd.js +0 -1
package/README.md CHANGED
@@ -414,7 +414,7 @@ For uploading a file or audio, you might need the third parameter "data".
414
414
  <summary>
415
415
  📝 Additional options
416
416
  </summary>
417
-
417
+
418
418
  ## Reset editor content
419
419
 
420
420
  ```
@@ -441,6 +441,220 @@ import { CLEAR_EDITOR_COMMAND } from './EditorLexical';
441
441
  ```
442
442
 
443
443
  </details>
444
+
445
+ <details>
446
+ <summary>
447
+ 🧪 Testing
448
+ </summary>
449
+
450
+ ## Testing Overview
451
+
452
+ This project includes comprehensive testing with both **unit tests** (Vitest) and **end-to-end tests** (Playwright). The testing setup ensures reliability across different browsers and environments.
453
+
454
+ ### Prerequisites
455
+
456
+ Before running tests, make sure you have installed all dependencies:
457
+
458
+ ```bash
459
+ npm install
460
+ ```
461
+
462
+ ## Unit Tests (Vitest)
463
+
464
+ Unit tests are written with **Vitest** and **jsdom** for testing individual components and utilities.
465
+
466
+ ### Run Unit Tests
467
+
468
+ ```bash
469
+ # Run all unit tests
470
+ npm run test-unit
471
+
472
+ # Run unit tests in watch mode (auto-rerun on changes)
473
+ npm run test-unit-watch
474
+ ```
475
+
476
+ ### Unit Test Files Location
477
+ - `__tests__/unit/` - Unit test files
478
+ - Test files follow the pattern: `*.test.ts` or `*.test.tsx`
479
+
480
+ ## End-to-End Tests (Playwright)
481
+
482
+ E2E tests use **Playwright** to test the complete application flow in real browsers.
483
+
484
+ ### Run E2E Tests
485
+
486
+ ```bash
487
+ # Run all E2E tests (WebKit only for CI optimization)
488
+ npm run test:e2e
489
+
490
+ # Run E2E tests with UI mode (interactive)
491
+ npm run test:e2e:ui
492
+
493
+ # Run E2E tests in debug mode
494
+ npm run test:e2e:debug
495
+
496
+ # Run E2E tests in headed mode (visible browser)
497
+ npm run test:e2e:headed
498
+ ```
499
+
500
+ ### E2E Test Files Location
501
+ - `__tests__/e2e/` - End-to-end test files
502
+ - `__tests__/regression/` - Regression test files
503
+ - Test files follow the pattern: `*.spec.js`, `*.spec.mjs`, or `*.spec.ts`
504
+
505
+ ### Browser Support
506
+ - **WebKit** (Safari) - Primary browser for CI/CD
507
+ - **Chromium** and **Firefox** - Available for local testing
508
+
509
+ ## Test Server
510
+
511
+ The test server automatically starts when running E2E tests:
512
+
513
+ ```bash
514
+ # Manual test server start (if needed)
515
+ npm run start-test-server
516
+ ```
517
+
518
+ - **URL**: `http://localhost:3000`
519
+ - **Mode**: Full editor mode with all features enabled
520
+ - **Environment**: `VITE_LAYERS=true`
521
+
522
+ ## Test Configuration
523
+
524
+ ### Playwright Configuration
525
+ - **Config file**: `playwright.config.js`
526
+ - **Test directory**: `./__tests__/e2e/`
527
+ - **Browser**: WebKit (optimized for CI)
528
+ - **Base URL**: `http://localhost:3000`
529
+ - **Timeout**: 90 seconds per test
530
+ - **Retries**: 2 retries in CI, 0 locally
531
+
532
+ ### Vitest Configuration
533
+ - **Config file**: `vitest.config.mts`
534
+ - **Environment**: jsdom
535
+ - **Setup file**: `vitest.setup.mts`
536
+ - **Coverage**: V8 provider
537
+
538
+ ## CI/CD Testing
539
+
540
+ Tests run automatically on:
541
+ - **Push** to `main` or `dev` branches
542
+ - **Pull requests** to `main` or `dev` branches
543
+ - **Manual trigger** via GitHub Actions
544
+
545
+ ### GitHub Actions Workflow
546
+ - **File**: `.github/workflows/tests.yml`
547
+ - **Runner**: Ubuntu Latest
548
+ - **Node.js**: Version 20
549
+ - **Browser caching**: Playwright browsers cached for faster runs
550
+ - **Artifacts**: Test reports and traces uploaded on completion
551
+
552
+ ## Test Examples
553
+
554
+ ### Basic E2E Test Structure
555
+
556
+ ```javascript
557
+ // __tests__/e2e/example.spec.mjs
558
+ import { test, expect } from '@playwright/test';
559
+ import { focusEditor } from '../utils/index.mjs';
560
+
561
+ test('Can type text in editor', async ({ page }) => {
562
+ await page.goto('/');
563
+ await focusEditor(page);
564
+
565
+ const editor = page.locator('[contenteditable="true"]').first();
566
+ await editor.type('Hello World');
567
+
568
+ await expect(editor).toContainText('Hello World');
569
+ });
570
+ ```
571
+
572
+ ### Unit Test Structure
573
+
574
+ ```typescript
575
+ // __tests__/unit/example.test.ts
576
+ import { describe, it, expect } from 'vitest';
577
+ import { render } from '@testing-library/react';
578
+ import { Editor } from '../src/Editor';
579
+
580
+ describe('Editor Component', () => {
581
+ it('renders without crashing', () => {
582
+ const { container } = render(<Editor />);
583
+ expect(container).toBeTruthy();
584
+ });
585
+ });
586
+ ```
587
+
588
+ ## Debugging Tests
589
+
590
+ ### Debug E2E Tests
591
+
592
+ ```bash
593
+ # Run with Playwright Inspector
594
+ npm run test:e2e:debug
595
+
596
+ # Run specific test file
597
+ npx playwright test __tests__/e2e/TextEntry.spec.mjs --debug
598
+
599
+ # Run with headed browser
600
+ npm run test:e2e:headed
601
+ ```
602
+
603
+ ### View Test Reports
604
+
605
+ ```bash
606
+ # Open HTML report (after running tests)
607
+ npx playwright show-report
608
+
609
+ # View test traces (for failed tests)
610
+ npx playwright show-trace test-results/[test-name]/trace.zip
611
+ ```
612
+
613
+ ## Test Utilities
614
+
615
+ Common test utilities are available in `__tests__/utils/index.mjs`:
616
+
617
+ - `focusEditor(page)` - Focus the main editor
618
+ - `selectAll(page)` - Select all text in editor
619
+ - `moveLeft(page, count)` - Move cursor left
620
+ - `selectCharacters(page, count)` - Select specific number of characters
621
+ - `waitForSelector(page, selector)` - Wait for element to appear
622
+
623
+ ## Performance
624
+
625
+ ### Test Execution Times
626
+ - **Unit Tests**: ~10-30 seconds
627
+ - **E2E Tests (first run)**: ~3-4 minutes (includes browser installation)
628
+ - **E2E Tests (cached)**: ~1-2 minutes (uses cached browsers)
629
+
630
+ ### Optimization Features
631
+ - **Browser Caching**: Playwright browsers cached in CI
632
+ - **Single Worker**: Prevents race conditions in CI
633
+ - **WebKit Only**: Faster than multi-browser matrix
634
+ - **Smart Retries**: Auto-retry flaky tests
635
+
636
+ ## Troubleshooting
637
+
638
+ ### Common Issues
639
+
640
+ 1. **Port conflicts**: Ensure port 3000 is available
641
+ 2. **Browser installation**: Run `npx playwright install` if needed
642
+ 3. **Test timeouts**: Check if test server is running properly
643
+ 4. **Certificate errors**: Tests use HTTP to avoid HTTPS certificate issues
644
+
645
+ ### Reset Test Environment
646
+
647
+ ```bash
648
+ # Clear Playwright cache
649
+ npx playwright install --force
650
+
651
+ # Reset node_modules
652
+ rm -rf node_modules package-lock.json
653
+ npm install
654
+ ```
655
+
656
+ </details>
657
+
444
658
  <details>
445
659
  <summary>
446
660
  ⚙️ Properties