lakelib 0.4.3 → 0.4.5

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.
package/lib/lake.css CHANGED
@@ -449,7 +449,7 @@ button.lake-primary-button.lake-button-hovered {
449
449
  .lake-dropdown-menu {
450
450
  position: absolute;
451
451
  top: 30px;
452
- right: 0;
452
+ right: auto;
453
453
  z-index: var(--lake-popup-z-index);
454
454
  list-style: none;
455
455
  margin: 0;
@@ -1334,131 +1334,6 @@ lake-box[name="hr"] .lake-box-focused .lake-hr {
1334
1334
  border-top: 1px solid var(--lake-border-color);
1335
1335
  }
1336
1336
 
1337
- /* variables */
1338
- :root {
1339
- --lake-code-highlight-keyword: #af00db;
1340
- --lake-code-highlight-name: #444d56;
1341
- --lake-code-highlight-function: #005cc5;
1342
- --lake-code-highlight-constant: #0550ae;
1343
- --lake-code-highlight-definition: #444d56;
1344
- --lake-code-highlight-type: #0550ae;
1345
- --lake-code-highlight-operator: #444d56;
1346
- --lake-code-highlight-comment: #008000;
1347
- --lake-code-highlight-heading: #000080;
1348
- --lake-code-highlight-boolean: #0550ae;
1349
- --lake-code-highlight-string: #a31515;
1350
- --lake-code-highlight-number: #098658;
1351
- --lake-code-highlight-invalid: #cd3131;
1352
- }
1353
-
1354
- .lake-dark {
1355
- --lake-code-highlight-keyword: #b392f0;
1356
- --lake-code-highlight-name: #e1e4e8;
1357
- --lake-code-highlight-function: #61afef;
1358
- --lake-code-highlight-constant: #9ecBff;
1359
- --lake-code-highlight-definition: #e1e4e8;
1360
- --lake-code-highlight-type: #9ecBff;
1361
- --lake-code-highlight-operator: #e1e4e8;
1362
- --lake-code-highlight-comment: #6a9955;
1363
- --lake-code-highlight-heading: #569cd6;
1364
- --lake-code-highlight-boolean: #9ecBff;
1365
- --lake-code-highlight-string: #ce9178;
1366
- --lake-code-highlight-number: #b5cea8;
1367
- --lake-code-highlight-invalid: #f44747;
1368
- }
1369
-
1370
- /* CodeMirror */
1371
- .cm-editor {
1372
- font-size: 14px;
1373
- border-radius: 5px;
1374
- color: var(--lake-text-color);
1375
- background-color: var(--lake-box-background-color);
1376
- }
1377
-
1378
- .cm-editor.cm-focused {
1379
- outline: none;
1380
- }
1381
-
1382
- .cm-editor .cm-content {
1383
- font-family: Consolas, Courier, monospace;
1384
- margin: 16px 20px;
1385
- caret-color: var(--lake-text-color);
1386
- }
1387
-
1388
- /* code block */
1389
- lake-box[name="codeBlock"] .lake-box-focused .lake-code-block,
1390
- lake-box[name="codeBlock"] .lake-box-activated .lake-code-block {
1391
- border-color: var(--lake-box-border-color);
1392
- }
1393
-
1394
- .lake-code-block {
1395
- position: relative;
1396
- border: 1px solid transparent;
1397
- border-radius: 5px;
1398
- }
1399
-
1400
- .lake-code-block .lake-dropdown {
1401
- position: absolute;
1402
- top: 2px;
1403
- inset-inline-end: 2px;
1404
- display: none;
1405
- }
1406
-
1407
- lake-box[name="codeBlock"] .lake-box-focused .lake-code-block .lake-dropdown,
1408
- lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
1409
- display: block;
1410
- }
1411
-
1412
- .lake-code-block .lake-dropdown .lake-dropdown-title {
1413
- margin: 0;
1414
- padding-right: 4px;
1415
- background-color: var(--lake-box-background-color);
1416
- }
1417
-
1418
- .lake-code-block .lake-dropdown.lake-list-dropdown .lake-dropdown-title-hovered {
1419
- background-color: var(--lake-button-background-active-color);
1420
- }
1421
-
1422
- .lake-code-block .lake-dropdown .lake-dropdown-text {
1423
- margin: 3px 6px;
1424
- }
1425
-
1426
- .lake-code-block .lake-dropdown .lake-dropdown-down-icon svg {
1427
- margin: 5px 2px;
1428
- }
1429
-
1430
- .lake-code-block .lake-dropdown .lake-dropdown-menu {
1431
- top: 24px;
1432
- left: auto;
1433
- right: 0;
1434
- }
1435
-
1436
- .lake-code-block-error {
1437
- font-size: 14px;
1438
- color: var(--lake-error-color);
1439
- border-radius: 5px;
1440
- background-color: var(--lake-box-background-color);
1441
- padding: 16px 20px;
1442
- }
1443
-
1444
-
1445
- /* for HTML preview */
1446
- .lake-container pre[class*=lang-] {
1447
- margin: 0;
1448
- font-size: 14px;
1449
- font-family: Consolas, Courier, monospace;
1450
- border-radius: 5px;
1451
- color: var(--lake-text-color);
1452
- background-color: var(--lake-box-background-color);
1453
- margin-bottom: 16px;
1454
- padding: 16px 20px;
1455
- }
1456
-
1457
- .lake-container pre[class*=lang-] code {
1458
- display: block;
1459
- background-color: transparent;
1460
- }
1461
-
1462
1337
  .lake-image-placeholder {
1463
1338
  display: flex;
1464
1339
  align-items: center;
@@ -1601,6 +1476,81 @@ lake-box[name="image"] .lake-box-selected .lake-image-error {
1601
1476
  cursor: pointer;
1602
1477
  }
1603
1478
 
1479
+ .lake-media-placeholder {
1480
+ display: flex;
1481
+ align-items: center;
1482
+ justify-content: center;
1483
+ border: 1px solid transparent;
1484
+ background-color: var(--lake-box-placeholder-background-color);
1485
+ border-radius: 4px;
1486
+ }
1487
+
1488
+ .lake-media-placeholder svg {
1489
+ width: 50%;
1490
+ max-width: 64px;
1491
+ height: 50%;
1492
+ max-height: 64px;
1493
+ fill: var(--lake-box-placeholder-text-color);
1494
+ }
1495
+
1496
+ .lake-media {
1497
+ position: relative;
1498
+ font-size: var(--lake-font-size);
1499
+ font-weight: normal;
1500
+ line-height: 0;
1501
+ border: 1px solid transparent;
1502
+ border-radius: 4px;
1503
+ }
1504
+
1505
+ .lake-media-placeholder,
1506
+ .lake-media video {
1507
+ width: 560px;
1508
+ height: 315px;
1509
+ }
1510
+
1511
+ /* uploading status */
1512
+ .lake-media .lake-progress {
1513
+ position: absolute;
1514
+ bottom: 8px;
1515
+ right: 8px;
1516
+ z-index: 1;
1517
+ border-radius: 4px;
1518
+ background-color: rgba(0, 0, 0, .4);
1519
+ line-height: 0;
1520
+ display: flex;
1521
+ align-items: center;
1522
+ padding: 0 6px;
1523
+ }
1524
+
1525
+ .lake-media .lake-progress svg {
1526
+ fill: #fff;
1527
+ width: 16px;
1528
+ height: 16px;
1529
+ margin: 6px;
1530
+ animation: lakerotate 1s linear 0s infinite normal none;
1531
+ }
1532
+
1533
+ .lake-media .lake-progress .lake-percent {
1534
+ font-size: 14px;
1535
+ color: #fff;
1536
+ margin: 6px;
1537
+ white-space: nowrap;
1538
+ }
1539
+
1540
+ /* error status */
1541
+ .lake-media-error .lake-media-placeholder {
1542
+ border: 1px solid var(--lake-box-border-color);
1543
+ background-color: transparent;
1544
+ }
1545
+
1546
+ lake-box[name="media"] .lake-box-selected .lake-media-placeholder {
1547
+ background-color: var(--lake-selection-background-color);
1548
+ }
1549
+
1550
+ .lake-media-error .lake-media-placeholder svg {
1551
+ fill: var(--lake-error-color);
1552
+ }
1553
+
1604
1554
  .lake-file {
1605
1555
  position: relative;
1606
1556
  font-size: var(--lake-font-size);
@@ -1684,6 +1634,131 @@ lake-box[name="file"] .lake-box-focused .lake-file {
1684
1634
  color: var(--lake-error-color);
1685
1635
  }
1686
1636
 
1637
+ /* variables */
1638
+ :root {
1639
+ --lake-code-highlight-keyword: #af00db;
1640
+ --lake-code-highlight-name: #444d56;
1641
+ --lake-code-highlight-function: #005cc5;
1642
+ --lake-code-highlight-constant: #0550ae;
1643
+ --lake-code-highlight-definition: #444d56;
1644
+ --lake-code-highlight-type: #0550ae;
1645
+ --lake-code-highlight-operator: #444d56;
1646
+ --lake-code-highlight-comment: #008000;
1647
+ --lake-code-highlight-heading: #000080;
1648
+ --lake-code-highlight-boolean: #0550ae;
1649
+ --lake-code-highlight-string: #a31515;
1650
+ --lake-code-highlight-number: #098658;
1651
+ --lake-code-highlight-invalid: #cd3131;
1652
+ }
1653
+
1654
+ .lake-dark {
1655
+ --lake-code-highlight-keyword: #b392f0;
1656
+ --lake-code-highlight-name: #e1e4e8;
1657
+ --lake-code-highlight-function: #61afef;
1658
+ --lake-code-highlight-constant: #9ecBff;
1659
+ --lake-code-highlight-definition: #e1e4e8;
1660
+ --lake-code-highlight-type: #9ecBff;
1661
+ --lake-code-highlight-operator: #e1e4e8;
1662
+ --lake-code-highlight-comment: #6a9955;
1663
+ --lake-code-highlight-heading: #569cd6;
1664
+ --lake-code-highlight-boolean: #9ecBff;
1665
+ --lake-code-highlight-string: #ce9178;
1666
+ --lake-code-highlight-number: #b5cea8;
1667
+ --lake-code-highlight-invalid: #f44747;
1668
+ }
1669
+
1670
+ /* CodeMirror */
1671
+ .cm-editor {
1672
+ font-size: 14px;
1673
+ border-radius: 5px;
1674
+ color: var(--lake-text-color);
1675
+ background-color: var(--lake-box-background-color);
1676
+ }
1677
+
1678
+ .cm-editor.cm-focused {
1679
+ outline: none;
1680
+ }
1681
+
1682
+ .cm-editor .cm-content {
1683
+ font-family: Consolas, Courier, monospace;
1684
+ margin: 16px 20px;
1685
+ caret-color: var(--lake-text-color);
1686
+ }
1687
+
1688
+ /* code block */
1689
+ lake-box[name="codeBlock"] .lake-box-focused .lake-code-block,
1690
+ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block {
1691
+ border-color: var(--lake-box-border-color);
1692
+ }
1693
+
1694
+ .lake-code-block {
1695
+ position: relative;
1696
+ border: 1px solid transparent;
1697
+ border-radius: 5px;
1698
+ }
1699
+
1700
+ .lake-code-block .lake-dropdown {
1701
+ position: absolute;
1702
+ top: 2px;
1703
+ inset-inline-end: 2px;
1704
+ display: none;
1705
+ }
1706
+
1707
+ lake-box[name="codeBlock"] .lake-box-focused .lake-code-block .lake-dropdown,
1708
+ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
1709
+ display: block;
1710
+ }
1711
+
1712
+ .lake-code-block .lake-dropdown .lake-dropdown-title {
1713
+ margin: 0;
1714
+ padding-right: 4px;
1715
+ background-color: var(--lake-box-background-color);
1716
+ }
1717
+
1718
+ .lake-code-block .lake-dropdown.lake-list-dropdown .lake-dropdown-title-hovered {
1719
+ background-color: var(--lake-button-background-active-color);
1720
+ }
1721
+
1722
+ .lake-code-block .lake-dropdown .lake-dropdown-text {
1723
+ margin: 3px 6px;
1724
+ }
1725
+
1726
+ .lake-code-block .lake-dropdown .lake-dropdown-down-icon svg {
1727
+ margin: 5px 2px;
1728
+ }
1729
+
1730
+ .lake-code-block .lake-dropdown .lake-dropdown-menu {
1731
+ top: 24px;
1732
+ left: auto;
1733
+ right: 0;
1734
+ }
1735
+
1736
+ .lake-code-block-error {
1737
+ font-size: 14px;
1738
+ color: var(--lake-error-color);
1739
+ border-radius: 5px;
1740
+ background-color: var(--lake-box-background-color);
1741
+ padding: 16px 20px;
1742
+ }
1743
+
1744
+
1745
+ /* for HTML preview */
1746
+ .lake-container pre[class*=lang-] {
1747
+ margin: 0;
1748
+ font-size: 14px;
1749
+ font-family: Consolas, Courier, monospace;
1750
+ border-radius: 5px;
1751
+ color: var(--lake-text-color);
1752
+ background-color: var(--lake-box-background-color);
1753
+ margin-bottom: 16px;
1754
+ padding: 16px 20px;
1755
+ }
1756
+
1757
+ .lake-container pre[class*=lang-] code {
1758
+ display: block;
1759
+ background-color: transparent;
1760
+ }
1761
+
1687
1762
  .lake-emoji {
1688
1763
  line-height: 0;
1689
1764
  border: 1px solid transparent;
package/lib/lake.d.ts CHANGED
@@ -481,7 +481,7 @@ type RootTranslation = {
481
481
  */
482
482
  hr: string;
483
483
  /**
484
- * Vid​e​o
484
+ * YouT​u​b​e
485
485
  */
486
486
  video: string;
487
487
  /**
@@ -556,6 +556,10 @@ type RootTranslation = {
556
556
  * I​m​a​g​e
557
557
  */
558
558
  image: string;
559
+ /**
560
+ * V​i​d​e​o
561
+ */
562
+ media: string;
559
563
  /**
560
564
  * F​i​l​e
561
565
  */
@@ -569,7 +573,7 @@ type RootTranslation = {
569
573
  */
570
574
  equation: string;
571
575
  /**
572
- * X​ ​(​T​w​it​t​e​r​)
576
+ * X​ ​(​T​w​ee​t​)
573
577
  */
574
578
  twitter: string;
575
579
  /**
@@ -723,11 +727,11 @@ type RootTranslation = {
723
727
  */
724
728
  codeBlockDesc: string;
725
729
  /**
726
- * Vid​e​o
730
+ * YouT​u​b​e
727
731
  */
728
732
  video: string;
729
733
  /**
730
- * I​n​s​e​r​t​ ​a​ ​vi​d​e​o​ from​ ​YouTu​b​e
734
+ * I​n​s​e​r​t​ ​a​ ​Y​o​uTube​ ​video
731
735
  */
732
736
  videoDesc: string;
733
737
  /**
@@ -739,11 +743,11 @@ type RootTranslation = {
739
743
  */
740
744
  equationDesc: string;
741
745
  /**
742
- * T​w​it​t​e​r
746
+ * T​w​ee​t
743
747
  */
744
748
  twitter: string;
745
749
  /**
746
- * I​n​s​e​r​t​ ​a​ p​o​s​t​f​r​o​m​ ​X​ ​(​T​w​it​t​e​r​)
750
+ * I​n​s​e​r​t​ ​a​n​ ​X​ ​(​T​w​ee​t​)
747
751
  */
748
752
  twitterDesc: string;
749
753
  /**
@@ -950,6 +954,16 @@ type RootTranslation = {
950
954
  */
951
955
  captionPlaceholder: string;
952
956
  };
957
+ media: {
958
+ /**
959
+ * D​o​w​n​l​o​a​d
960
+ */
961
+ download: string;
962
+ /**
963
+ * D​e​l​e​t​e
964
+ */
965
+ remove: string;
966
+ };
953
967
  file: {
954
968
  /**
955
969
  * D​o​w​n​l​o​a​d
@@ -970,7 +984,7 @@ type RootTranslation = {
970
984
  */
971
985
  remove: string;
972
986
  /**
973
- * P​a​s​t​e​ ​a lin​k​t​o​ em​b​e​d​a ​v​i​deo​from​ ​Y​o​u​T​u​b​e​.
987
+ * P​a​s​t​e​ ​your​ ​Y​o​uTu​b​e​ ​l​i​nk​ ​bel​o​w​.
974
988
  */
975
989
  description: string;
976
990
  /**
@@ -1012,7 +1026,7 @@ type RootTranslation = {
1012
1026
  */
1013
1027
  remove: string;
1014
1028
  /**
1015
- * P​a​s​t​e​ ​a link​ ​to emb​e​d a​post​ ​fr​o​m​ ​X​.
1029
+ * P​a​s​t​e​ ​your X​ ​(Twitt​e​r)​ ​link​ ​bel​o​w​.
1016
1030
  */
1017
1031
  description: string;
1018
1032
  /**
@@ -1128,7 +1142,7 @@ type TranslationFunctions = {
1128
1142
  */
1129
1143
  hr: () => LocalizedString;
1130
1144
  /**
1131
- * Video
1145
+ * YouTube
1132
1146
  */
1133
1147
  video: () => LocalizedString;
1134
1148
  /**
@@ -1203,6 +1217,10 @@ type TranslationFunctions = {
1203
1217
  * Image
1204
1218
  */
1205
1219
  image: () => LocalizedString;
1220
+ /**
1221
+ * Video
1222
+ */
1223
+ media: () => LocalizedString;
1206
1224
  /**
1207
1225
  * File
1208
1226
  */
@@ -1216,7 +1234,7 @@ type TranslationFunctions = {
1216
1234
  */
1217
1235
  equation: () => LocalizedString;
1218
1236
  /**
1219
- * X (Twitter)
1237
+ * X (Tweet)
1220
1238
  */
1221
1239
  twitter: () => LocalizedString;
1222
1240
  /**
@@ -1370,11 +1388,11 @@ type TranslationFunctions = {
1370
1388
  */
1371
1389
  codeBlockDesc: () => LocalizedString;
1372
1390
  /**
1373
- * Video
1391
+ * YouTube
1374
1392
  */
1375
1393
  video: () => LocalizedString;
1376
1394
  /**
1377
- * Insert a video from YouTube
1395
+ * Insert a YouTube video
1378
1396
  */
1379
1397
  videoDesc: () => LocalizedString;
1380
1398
  /**
@@ -1386,11 +1404,11 @@ type TranslationFunctions = {
1386
1404
  */
1387
1405
  equationDesc: () => LocalizedString;
1388
1406
  /**
1389
- * Twitter
1407
+ * Tweet
1390
1408
  */
1391
1409
  twitter: () => LocalizedString;
1392
1410
  /**
1393
- * Insert a post from X (Twitter)
1411
+ * Insert an X (Tweet)
1394
1412
  */
1395
1413
  twitterDesc: () => LocalizedString;
1396
1414
  /**
@@ -1596,6 +1614,16 @@ type TranslationFunctions = {
1596
1614
  */
1597
1615
  captionPlaceholder: () => LocalizedString;
1598
1616
  };
1617
+ media: {
1618
+ /**
1619
+ * Download
1620
+ */
1621
+ download: () => LocalizedString;
1622
+ /**
1623
+ * Delete
1624
+ */
1625
+ remove: () => LocalizedString;
1626
+ };
1599
1627
  file: {
1600
1628
  /**
1601
1629
  * Download
@@ -1616,7 +1644,7 @@ type TranslationFunctions = {
1616
1644
  */
1617
1645
  remove: () => LocalizedString;
1618
1646
  /**
1619
- * Paste a link to embed a video from YouTube.
1647
+ * Paste your YouTube link below.
1620
1648
  */
1621
1649
  description: () => LocalizedString;
1622
1650
  /**
@@ -1658,7 +1686,7 @@ type TranslationFunctions = {
1658
1686
  */
1659
1687
  remove: () => LocalizedString;
1660
1688
  /**
1661
- * Paste a link to embed a post from X.
1689
+ * Paste your X (Twitter) link below.
1662
1690
  */
1663
1691
  description: () => LocalizedString;
1664
1692
  /**
@@ -2378,7 +2406,7 @@ declare class Toolbar {
2378
2406
  }
2379
2407
 
2380
2408
  type ShowMessage = (type: 'success' | 'error' | 'warning', message: string) => void;
2381
- type DownloadFile = (type: 'image' | 'file', url: string) => void;
2409
+ type DownloadFile = (type: 'image' | 'media' | 'file', url: string) => void;
2382
2410
  interface Config {
2383
2411
  value: string;
2384
2412
  readonly: boolean;
@@ -2682,6 +2710,13 @@ interface BoxComponent {
2682
2710
  html?: RenderBoxHTML;
2683
2711
  }
2684
2712
 
2713
+ interface CornerToolbarItem {
2714
+ name: string;
2715
+ icon?: string;
2716
+ tooltip: string | ((locale: TranslationFunctions) => string);
2717
+ onClick: (event: Event) => void;
2718
+ }
2719
+
2685
2720
  interface MentionItem {
2686
2721
  id: string;
2687
2722
  name: string;
@@ -2941,5 +2976,36 @@ declare class Dropdown {
2941
2976
  unmount(): void;
2942
2977
  }
2943
2978
 
2944
- export { Box, Button, Dropdown, Editor, Fragment, HTMLParser, Nodes, Range$1 as Range, TextParser, Toolbar, addMark, createIframeBox, deleteContents, getBox, getContentRules, icons, insertBlock, insertBookmark, insertBox, insertContents, modifierText, query, removeBox, removeMark, setBlocks, splitBlock, splitMarks, template, toBookmark, toHex };
2945
- export type { ActiveItem, BoxComponent, BoxValue, CommandItem, ContentRules, DropdownItem, DropdownMenuItem, EditorConfig, InitializePlugin, KeyValue, MentionItem, NodePath, SelectionState, SlashButtonItem, SlashItem, SlashUploadItem, ToolbarButtonItem, ToolbarConfig, ToolbarDropdownItem, ToolbarItem, ToolbarUploadItem, Translation, UnmountPlugin };
2979
+ interface CornerToolbarConfig {
2980
+ locale?: TranslationFunctions;
2981
+ root: string | Node | Nodes;
2982
+ items: CornerToolbarItem[];
2983
+ }
2984
+ declare class CornerToolbar {
2985
+ private config;
2986
+ private locale;
2987
+ private root;
2988
+ container: Nodes;
2989
+ constructor(config: CornerToolbarConfig);
2990
+ private appendButton;
2991
+ render(): void;
2992
+ }
2993
+
2994
+ interface ResizerConfig {
2995
+ root: string | Node | Nodes;
2996
+ target: string | Node | Nodes;
2997
+ onResize?: (width: number, height: number) => void;
2998
+ onStop: (width: number, height: number) => void;
2999
+ }
3000
+ declare class Resizer {
3001
+ private config;
3002
+ private root;
3003
+ private target;
3004
+ container: Nodes;
3005
+ constructor(config: ResizerConfig);
3006
+ private bindEvents;
3007
+ render(): void;
3008
+ }
3009
+
3010
+ export { Box, Button, CornerToolbar, Dropdown, Editor, Fragment, HTMLParser, Nodes, Range$1 as Range, Resizer, TextParser, Toolbar, addMark, createIframeBox, deleteContents, getBox, getContentRules, icons, insertBlock, insertBookmark, insertBox, insertContents, modifierText, query, removeBox, removeMark, setBlocks, splitBlock, splitMarks, template, toBookmark, toHex };
3011
+ export type { ActiveItem, BoxComponent, BoxType, BoxValue, CommandItem, ContentRules, CornerToolbarItem, DropdownItem, DropdownMenuItem, EditorConfig, InitializePlugin, KeyValue, MentionItem, NodePath, SelectionState, SlashButtonItem, SlashItem, SlashUploadItem, ToolbarButtonItem, ToolbarConfig, ToolbarDropdownItem, ToolbarItem, ToolbarUploadItem, Translation, TranslationFunctions, UnmountPlugin };