lakelib 0.1.15 → 0.1.17

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 (36) hide show
  1. package/README.md +12 -2
  2. package/dist/lake.css +155 -5
  3. package/dist/lake.min.js +38 -31
  4. package/dist/lake.min.js.map +1 -1
  5. package/lib/lake.css +155 -5
  6. package/lib/lake.js +338 -108
  7. package/lib/lake.js.map +1 -1
  8. package/lib/types/boxes/equation.d.ts +2 -0
  9. package/lib/types/css/index.d.ts +2 -0
  10. package/lib/types/editor.d.ts +4 -5
  11. package/lib/types/i18n/en-US/index.d.ts +5 -0
  12. package/lib/types/i18n/ja/index.d.ts +5 -0
  13. package/lib/types/i18n/ko/index.d.ts +5 -0
  14. package/lib/types/i18n/types.d.ts +28 -0
  15. package/lib/types/i18n/zh-CN/index.d.ts +5 -0
  16. package/lib/types/index.d.ts +1 -1
  17. package/lib/types/models/box.d.ts +1 -2
  18. package/lib/types/models/fragment.d.ts +1 -2
  19. package/lib/types/models/nodes.d.ts +11 -14
  20. package/lib/types/models/range.d.ts +1 -1
  21. package/lib/types/operations/insert-node.d.ts +1 -2
  22. package/lib/types/parsers/html-parser.d.ts +0 -1
  23. package/lib/types/plugins/equation.d.ts +3 -0
  24. package/lib/types/plugins/special-character.d.ts +3 -0
  25. package/lib/types/types/commands.d.ts +20 -0
  26. package/lib/types/types/dropdown.d.ts +2 -1
  27. package/lib/types/types/native.d.ts +0 -23
  28. package/lib/types/ui/commands-popup.d.ts +24 -0
  29. package/lib/types/ui/toolbar.d.ts +1 -2
  30. package/lib/types/utils/from-base64.d.ts +1 -0
  31. package/lib/types/utils/get-box.d.ts +1 -2
  32. package/lib/types/utils/index.d.ts +2 -0
  33. package/lib/types/utils/query.d.ts +1 -2
  34. package/lib/types/utils/to-base64.d.ts +1 -0
  35. package/lib/types/utils/to-node-list.d.ts +1 -2
  36. package/package.json +20 -20
package/README.md CHANGED
@@ -27,8 +27,18 @@ You can now view all the demos by visiting `http://localhost:8080/examples/`.
27
27
 
28
28
  ## Running tests
29
29
 
30
- Lake depends on a lot of browser APIs and ao needs a real browser environment for running the test cases. You can run all tests visibly by visiting `http://localhost:8080/tests/`, or execute `pnpm test` command to run the tests in headless mode.
30
+ Lake depends on a lot of browser APIs and so needs a real browser environment for running the test cases. You can run all tests visibly by visiting `http://localhost:8080/tests/`, or execute the `pnpm test` command to run the tests in headless mode.
31
31
 
32
32
  ## License
33
33
 
34
- [MIT](https://github.com/lakejs/lake/blob/main/LICENSE)
34
+ Lake is released under the [MIT](https://github.com/lakejs/lake/blob/main/LICENSE) license. The licenses of its dependencies are:
35
+
36
+ | Package | License |
37
+ | ------------- | ------------- |
38
+ | [codemirror](https://github.com/codemirror/dev) | MIT |
39
+ | [debounce](https://github.com/sindresorhus/debounce) | MIT |
40
+ | [eventemitter3](https://github.com/primus/eventemitter3) | MIT |
41
+ | [fast-deep-equal](https://github.com/epoberezkin/fast-deep-equal) | MIT |
42
+ | [is-hotkey](https://github.com/ianstormtaylor/is-hotkey) | MIT |
43
+ | [photoswipe](https://github.com/dimsemenov/Photoswipe) | MIT |
44
+ | [typesafe-i18n](https://github.com/ivanhofer/typesafe-i18n) | MIT |
package/dist/lake.css CHANGED
@@ -60,7 +60,7 @@
60
60
  color: inherit;
61
61
  background: var(--selection-background-color);
62
62
  }
63
- .lake-container.lake-show-placeholder::before {
63
+ .lake-container.lake-placeholder::before {
64
64
  position: absolute;
65
65
  top: 8px;
66
66
  left: 12px;
@@ -231,6 +231,7 @@ button.lake-button {
231
231
  padding: 0;
232
232
  margin: 0 1px;
233
233
  line-height: 0;
234
+ white-space: nowrap;
234
235
  cursor: pointer;
235
236
  user-select: none;
236
237
  }
@@ -310,7 +311,8 @@ button.lake-primary-button.lake-button-hovered {
310
311
  cursor: default;
311
312
  }
312
313
  .lake-dropdown.lake-list-dropdown button.lake-dropdown-title-hovered,
313
- .lake-dropdown.lake-icon-dropdown button.lake-dropdown-title-hovered {
314
+ .lake-dropdown.lake-icon-dropdown button.lake-dropdown-title-hovered,
315
+ .lake-dropdown.lake-character-dropdown button.lake-dropdown-title-hovered {
314
316
  background-color: var(--background-hover-color);
315
317
  }
316
318
  .lake-dropdown button.lake-dropdown-title.lake-dropdown-title-no-down {
@@ -380,6 +382,10 @@ button.lake-primary-button.lake-button-hovered {
380
382
  top: auto;
381
383
  bottom: 30px;
382
384
  }
385
+ .lake-dropdown .lake-dropdown-menu.lake-dropdown-menu-with-scroll {
386
+ overflow-y: scroll;
387
+ scrollbar-width: thin;
388
+ }
383
389
  .lake-dropdown .lake-dropdown-menu li {
384
390
  display: flex;
385
391
  align-items: center;
@@ -446,6 +452,34 @@ button.lake-primary-button.lake-button-hovered {
446
452
  .lake-dropdown .lake-icon-dropdown-menu li .lake-dropdown-menu-text {
447
453
  display: none;
448
454
  }
455
+ /* character type */
456
+ .lake-dropdown .lake-character-dropdown-menu {
457
+ flex-wrap: wrap;
458
+ justify-content: center;
459
+ }
460
+ .lake-dropdown .lake-character-dropdown-menu li {
461
+ padding: 0;
462
+ border-radius: 2px;
463
+ }
464
+ .lake-dropdown .lake-character-dropdown-menu li.lake-dropdown-item-hovered {
465
+ background-color: var(--background-hover-color);
466
+ }
467
+ .lake-dropdown .lake-character-dropdown-menu li.lake-dropdown-item-selected {
468
+ background-color: var(--background-active-color);
469
+ }
470
+ .lake-dropdown .lake-character-dropdown-menu li .lake-dropdown-menu-check {
471
+ display: none;
472
+ }
473
+ .lake-dropdown .lake-character-dropdown-menu li .lake-dropdown-menu-icon {
474
+ display: none;
475
+ }
476
+ .lake-dropdown .lake-character-dropdown-menu li .lake-dropdown-menu-text {
477
+ text-align: center;
478
+ font-size: 24px;
479
+ width: 42px;
480
+ height: 42px;
481
+ line-height: 42px;
482
+ }
449
483
  /* color type */
450
484
  .lake-dropdown .lake-color-dropdown-menu {
451
485
  flex-wrap: wrap;
@@ -939,9 +973,6 @@ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
939
973
  top: 24px;
940
974
  left: auto;
941
975
  right: 0;
942
- overflow-y: scroll;
943
- scrollbar-width: thin;
944
- height: 200px;
945
976
  }
946
977
  .lake-code-block-error {
947
978
  font-size: 14px;
@@ -1121,6 +1152,9 @@ lake-box[name="video"] .lake-box-hovered .lake-resizer {
1121
1152
  cursor: pointer;
1122
1153
  user-select: auto;
1123
1154
  }
1155
+ lake-box[name="file"] .lake-box-strip {
1156
+ align-self: center;
1157
+ }
1124
1158
  .lake-file .lake-file-info {
1125
1159
  display: flex;
1126
1160
  align-items: center;
@@ -1186,6 +1220,69 @@ lake-box[name="emoji"] .lake-box-focused .lake-emoji {
1186
1220
  background-color: var(--selection-background-color);
1187
1221
  }
1188
1222
 
1223
+ .lake-equation {
1224
+ position: relative;
1225
+ font-weight: normal;
1226
+ border: 1px solid transparent;
1227
+ border-radius: 4px;
1228
+ }
1229
+ .lake-container[contenteditable="true"] .lake-equation {
1230
+ user-select: none;
1231
+ }
1232
+ lake-box[name="equation"] .lake-box-strip {
1233
+ align-self: center;
1234
+ }
1235
+ lake-box[name="equation"] .lake-box-selected .lake-equation {
1236
+ background-color: var(--selection-background-color);
1237
+ }
1238
+ lake-box[name="equation"] .lake-box-focused .lake-equation {
1239
+ background-color: var(--selection-background-color);
1240
+ }
1241
+ .lake-equation .lake-equation-view {
1242
+ padding: 0 6px;
1243
+ }
1244
+ .lake-equation .lake-equation-form {
1245
+ position: absolute;
1246
+ top: 28px;
1247
+ left: 0;
1248
+ z-index: 1;
1249
+ box-sizing: content-box;
1250
+ border: 1px solid var(--border-color);
1251
+ border-radius: 5px;
1252
+ padding: 16px;
1253
+ width: fit-content;
1254
+ background-color: #fff;
1255
+ box-shadow: var(--popup-shadow);
1256
+ display: none;
1257
+ }
1258
+ lake-box[name="equation"] .lake-box-focused .lake-equation-form,
1259
+ lake-box[name="equation"] .lake-box-activated .lake-equation-form {
1260
+ display: flex;
1261
+ }
1262
+ .lake-equation .lake-equation-form textarea {
1263
+ border: 0;
1264
+ box-sizing: border-box;
1265
+ font-family: Consolas, Courier, monospace;
1266
+ font-size: 14px;
1267
+ color: var(--text-color);
1268
+ padding: 0;
1269
+ margin-right: 8px;
1270
+ width: 300px;
1271
+ height: 80px;
1272
+ resize: none;
1273
+ scrollbar-width: thin;
1274
+ }
1275
+ .lake-equation .lake-equation-form textarea:focus-visible {
1276
+ outline: 0;
1277
+ }
1278
+ /* error status */
1279
+ .lake-equation-error {
1280
+ padding: 0 6px;
1281
+ font-size: 14px;
1282
+ color: var(--error-color);
1283
+ background-color: var(--box-background-color);
1284
+ }
1285
+
1189
1286
  .lake-toolbar {
1190
1287
  font-family: var(--font-family);
1191
1288
  font-size: 14px;
@@ -1211,6 +1308,59 @@ lake-box[name="emoji"] .lake-box-focused .lake-emoji {
1211
1308
  display: none;
1212
1309
  }
1213
1310
 
1311
+ .lake-commands-popup {
1312
+ position: absolute;
1313
+ top: 0;
1314
+ left: 0;
1315
+ z-index: 1;
1316
+ box-sizing: content-box;
1317
+ border: 1px solid var(--border-color);
1318
+ border-radius: 5px;
1319
+ padding: 4px 8px;
1320
+ width: fit-content;
1321
+ font-family: var(--font-family);
1322
+ font-size: 14px;
1323
+ color: var(--text-color);
1324
+ background-color: #fff;
1325
+ box-shadow: var(--popup-shadow);
1326
+ display: none;
1327
+ height: 380px;
1328
+ overflow-y: scroll;
1329
+ scrollbar-width: thin;
1330
+ }
1331
+ .lake-commands-popup .lake-commands-item {
1332
+ display: flex;
1333
+ cursor: pointer;
1334
+ padding: 4px 8px;
1335
+ border-radius: 5px;
1336
+ }
1337
+ .lake-commands-popup .lake-commands-item-selected {
1338
+ background-color: var(--background-active-color);
1339
+ }
1340
+ .lake-commands-popup .lake-commands-icon {
1341
+ margin-right: 8px;
1342
+ border-radius: 5px;
1343
+ border: 1px solid var(--border-color);
1344
+ background-color: #fff;
1345
+ }
1346
+ .lake-commands-popup .lake-commands-icon svg {
1347
+ width: 32px;
1348
+ height: 32px;
1349
+ margin: 6px;
1350
+ }
1351
+ .lake-commands-popup .lake-commands-text {
1352
+ display: flex;
1353
+ flex-direction: column;
1354
+ justify-content: center;
1355
+ }
1356
+ .lake-commands-popup .lake-commands-title {
1357
+ font-weight: 500;
1358
+ color: var(--text-color);
1359
+ }
1360
+ .lake-commands-popup .lake-commands-description {
1361
+ color: var(--secondary-text-color);
1362
+ }
1363
+
1214
1364
  /*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */
1215
1365
 
1216
1366
  .pswp {