lakelib 0.3.9 → 0.3.10

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
@@ -23,6 +23,8 @@
23
23
  --lake-box-border-color: #d9d9d9;
24
24
  --lake-box-border-focus-color: #1677ff;
25
25
  --lake-box-background-color: #f6f8fa;
26
+ --lake-box-placeholder-text-color: #d9d9d9;
27
+ --lake-box-placeholder-background-color: #fafafa;
26
28
  /* popup */
27
29
  --lake-popup-z-index: 822;
28
30
  --lake-popup-font-size: 14px;
@@ -39,6 +41,7 @@
39
41
  /* text field */
40
42
  --lake-input-border-color: #d9d9d9;
41
43
  --lake-input-border-hover-color: #69b1ff;
44
+ --lake-input-background-color: #fff;
42
45
  --lake-input-outline: 2px solid #69b1ff;
43
46
  }
44
47
 
@@ -62,6 +65,8 @@
62
65
  --lake-box-border-color: #3d444d;
63
66
  --lake-box-border-focus-color: #4493f8;
64
67
  --lake-box-background-color: #3d444d;
68
+ --lake-box-placeholder-text-color: #3d444d;
69
+ --lake-box-placeholder-background-color: #343434;
65
70
  /* popup */
66
71
  --lake-popup-border-color: #3d444d;
67
72
  --lake-popup-background-color: #252525;
@@ -74,6 +79,7 @@
74
79
  /* text field */
75
80
  --lake-input-border-color: #3d444d;
76
81
  --lake-input-border-hover-color: #58a6ff;
82
+ --lake-input-background-color: #252525;
77
83
  --lake-input-outline: 2px solid #58a6ff;
78
84
  }
79
85
 
@@ -215,6 +221,7 @@ lake-box[type="inline"] {
215
221
  lake-box[type="block"] {
216
222
  display: block grid;
217
223
  grid-template-columns: 1px calc(100% - 2px) 1px;
224
+ margin-bottom: 16px;
218
225
  }
219
226
 
220
227
  lake-box .lake-box-strip {
@@ -245,7 +252,9 @@ lake-box .lake-box-activated .lake-corner-toolbar {
245
252
  display: flex;
246
253
  }
247
254
 
248
- lake-box .lake-box-focused .lake-resizer {
255
+ lake-box .lake-box-hovered .lake-resizer,
256
+ lake-box .lake-box-focused .lake-resizer,
257
+ lake-box .lake-box-activated .lake-resizer {
249
258
  display: block;
250
259
  }
251
260
 
@@ -1109,6 +1118,106 @@ button.lake-primary-button.lake-button-hovered {
1109
1118
  user-select: none;
1110
1119
  }
1111
1120
 
1121
+ .lake-iframe {
1122
+ position: relative;
1123
+ font-size: 14px;
1124
+ font-weight: normal;
1125
+ line-height: 0;
1126
+ border: 0;
1127
+ }
1128
+
1129
+ .lake-iframe .lake-iframe-form {
1130
+ padding: 24px 16px;
1131
+ line-height: normal;
1132
+ color: var(--lake-text-color);
1133
+ border: 1px solid var(--lake-box-border-color);
1134
+ background-color: var(--lake-box-background-color);
1135
+ border-radius: 4px;
1136
+ }
1137
+
1138
+ .lake-iframe .lake-description {
1139
+ margin-bottom: 16px;
1140
+ color: var(--lake-secondary-text-color);
1141
+ }
1142
+
1143
+ .lake-iframe input[type="text"] {
1144
+ font-family: var(--lake-font-family);
1145
+ font-size: 14px;
1146
+ color: var(--lake-text-color);
1147
+ border-radius: 5px;
1148
+ border: 1px solid var(--lake-input-border-color);
1149
+ background-color: var(--lake-input-background-color);
1150
+ padding: 4px 10px;
1151
+ width: 100%;
1152
+ }
1153
+
1154
+ .lake-iframe input[type="text"]:hover {
1155
+ border: 1px solid var(--lake-input-border-hover-color);
1156
+ }
1157
+
1158
+ .lake-iframe input[type="text"]:focus-visible {
1159
+ outline: var(--lake-input-outline);
1160
+ outline-offset: -2px;
1161
+ }
1162
+
1163
+ lake-box[type="inline"] .lake-iframe .lake-iframe-form {
1164
+ min-width: 380px;
1165
+ max-width: 480px;
1166
+ }
1167
+
1168
+ lake-box[type="inline"] .lake-iframe .lake-input-label {
1169
+ margin-bottom: 8px;
1170
+ }
1171
+
1172
+ lake-box[type="inline"] .lake-iframe .lake-input-field input[type="text"] {
1173
+ margin-bottom: 16px;
1174
+ }
1175
+
1176
+ lake-box[type="inline"] .lake-iframe .lake-input-field button {
1177
+ width: 100%;
1178
+ }
1179
+
1180
+ lake-box[type="block"] .lake-iframe .lake-input-label {
1181
+ display: none;
1182
+ }
1183
+
1184
+ lake-box[type="block"] .lake-iframe .lake-input-field {
1185
+ display: flex;
1186
+ }
1187
+
1188
+ lake-box[type="block"] .lake-iframe .lake-input-field input[type="text"] {
1189
+ margin-right: 8px;
1190
+ }
1191
+
1192
+ .lake-iframe-placeholder {
1193
+ position: absolute;
1194
+ top: 0;
1195
+ left: 0;
1196
+ display: flex;
1197
+ align-items: center;
1198
+ justify-content: center;
1199
+ border: 1px solid transparent;
1200
+ background-color: var(--lake-box-placeholder-background-color);
1201
+ border-radius: 4px;
1202
+ }
1203
+
1204
+ .lake-iframe-placeholder svg {
1205
+ width: 50%;
1206
+ max-width: 64px;
1207
+ height: 50%;
1208
+ max-height: 64px;
1209
+ fill: var(--lake-box-placeholder-text-color);
1210
+ }
1211
+
1212
+ .lake-iframe-placeholder span {
1213
+ font-size: 24px;
1214
+ color: var(--lake-box-placeholder-text-color);
1215
+ }
1216
+
1217
+ .lake-iframe iframe {
1218
+ border-radius: 5px;
1219
+ }
1220
+
1112
1221
  .lake-container table {
1113
1222
  display: table;
1114
1223
  border-collapse: collapse;
@@ -1270,10 +1379,6 @@ lake-box[name="hr"] .lake-box-focused .lake-hr {
1270
1379
  }
1271
1380
 
1272
1381
  /* code block */
1273
- lake-box[name="codeBlock"] {
1274
- margin-bottom: 16px;
1275
- }
1276
-
1277
1382
  lake-box[name="codeBlock"] .lake-box-focused .lake-code-block,
1278
1383
  lake-box[name="codeBlock"] .lake-box-activated .lake-code-block {
1279
1384
  border-color: var(--lake-box-border-color);
@@ -1329,20 +1434,12 @@ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
1329
1434
  padding: 16px 20px;
1330
1435
  }
1331
1436
 
1332
- :root {
1333
- --lake-image-placeholder-background-color: #fafafa;
1334
- }
1335
-
1336
- .lake-dark {
1337
- --lake-image-placeholder-background-color: #343434;
1338
- }
1339
-
1340
1437
  .lake-image-placeholder {
1341
1438
  display: flex;
1342
1439
  align-items: center;
1343
1440
  justify-content: center;
1344
1441
  border: 1px solid transparent;
1345
- background-color: var(--lake-image-placeholder-background-color);
1442
+ background-color: var(--lake-box-placeholder-background-color);
1346
1443
  border-radius: 4px;
1347
1444
  width: 100%;
1348
1445
  height: 100%;
@@ -1353,7 +1450,7 @@ lake-box[name="codeBlock"] .lake-box-activated .lake-code-block .lake-dropdown {
1353
1450
  max-width: 64px;
1354
1451
  height: 50%;
1355
1452
  max-height: 64px;
1356
- fill: #d9d9d9;
1453
+ fill: var(--lake-box-placeholder-text-color);
1357
1454
  }
1358
1455
 
1359
1456
  .lake-image {
@@ -1479,64 +1576,6 @@ lake-box[name="image"] .lake-box-selected .lake-image-error {
1479
1576
  cursor: pointer;
1480
1577
  }
1481
1578
 
1482
- .lake-video {
1483
- position: relative;
1484
- font-size: 14px;
1485
- font-weight: normal;
1486
- line-height: 0;
1487
- border: 1px solid transparent;
1488
- }
1489
-
1490
- lake-box[name="video"] .lake-box-hovered .lake-resizer {
1491
- display: block;
1492
- }
1493
-
1494
- .lake-video .lake-video-form {
1495
- padding: 16px;
1496
- line-height: normal;
1497
- color: var(--lake-text-color);
1498
- border: 1px solid var(--lake-box-border-color);
1499
- background-color: var(--lake-box-background-color);
1500
- border-radius: 4px;
1501
- }
1502
-
1503
- .lake-video input[type="text"] {
1504
- font-family: var(--lake-font-family);
1505
- font-size: 14px;
1506
- color: var(--lake-text-color);
1507
- border-radius: 5px;
1508
- border: 1px solid var(--lake-input-border-color);
1509
- padding: 4px 10px;
1510
- width: 100%;
1511
- }
1512
-
1513
- .lake-video input[type="text"]:hover {
1514
- border: 1px solid var(--lake-input-border-hover-color);
1515
- }
1516
-
1517
- .lake-video input[type="text"]:focus-visible {
1518
- outline: var(--lake-input-outline);
1519
- outline-offset: -2px;
1520
- }
1521
-
1522
- .lake-video .lake-row {
1523
- padding-bottom: 8px;
1524
- }
1525
-
1526
- .lake-video .lake-desc-row {
1527
- padding-top: 8px;
1528
- padding-bottom: 16px;
1529
- color: var(--lake-secondary-text-color);
1530
- }
1531
-
1532
- .lake-video .lake-button-row {
1533
- padding-top: 16px;
1534
- }
1535
-
1536
- .lake-video .lake-button-row button {
1537
- width: 100%;
1538
- }
1539
-
1540
1579
  .lake-file {
1541
1580
  position: relative;
1542
1581
  font-size: var(--lake-font-size);
package/lib/lake.d.ts CHANGED
@@ -567,6 +567,10 @@ type TranslationFunctions = {
567
567
  * Mathematical formula
568
568
  */
569
569
  equation: () => LocalizedString;
570
+ /**
571
+ * X (Twitter)
572
+ */
573
+ twitter: () => LocalizedString;
570
574
  /**
571
575
  * Remove color
572
576
  */
@@ -733,6 +737,14 @@ type TranslationFunctions = {
733
737
  * Insert a TeX expression
734
738
  */
735
739
  equationDesc: () => LocalizedString;
740
+ /**
741
+ * Twitter
742
+ */
743
+ twitter: () => LocalizedString;
744
+ /**
745
+ * Insert a post from X (Twitter)
746
+ */
747
+ twitterDesc: () => LocalizedString;
736
748
  /**
737
749
  * Image
738
750
  */
@@ -988,6 +1000,28 @@ type TranslationFunctions = {
988
1000
  */
989
1001
  placeholder: () => LocalizedString;
990
1002
  };
1003
+ twitter: {
1004
+ /**
1005
+ * Embed Tweet
1006
+ */
1007
+ embed: () => LocalizedString;
1008
+ /**
1009
+ * Delete
1010
+ */
1011
+ remove: () => LocalizedString;
1012
+ /**
1013
+ * Paste a link to embed a post from X.
1014
+ */
1015
+ description: () => LocalizedString;
1016
+ /**
1017
+ * Link
1018
+ */
1019
+ url: () => LocalizedString;
1020
+ /**
1021
+ * Please enter a valid link.
1022
+ */
1023
+ urlError: () => LocalizedString;
1024
+ };
991
1025
  };
992
1026
 
993
1027
  type NativeRange = Range;
@@ -2025,6 +2059,77 @@ declare function toHex(value: string): string;
2025
2059
  */
2026
2060
  declare function getBox(boxNode: string | Node | Nodes): Box;
2027
2061
 
2062
+ /**
2063
+ * Configuration object that defines the iframe box behavior and appearance.
2064
+ */
2065
+ interface IframeBoxConfig {
2066
+ /**
2067
+ * The type of the box.
2068
+ */
2069
+ type: BoxType;
2070
+ /**
2071
+ * The name of the iframe box component.
2072
+ */
2073
+ name: string;
2074
+ /**
2075
+ * The default width of the iframe.
2076
+ */
2077
+ width: string;
2078
+ /**
2079
+ * The default height of the iframe.
2080
+ */
2081
+ height: string;
2082
+ /**
2083
+ * Description text for the form, which can be localized.
2084
+ */
2085
+ formDescription: string | ((locale: TranslationFunctions) => string);
2086
+ /**
2087
+ * Label for the URL input field, which can be localized.
2088
+ */
2089
+ urlLabel?: string | ((locale: TranslationFunctions) => string);
2090
+ /**
2091
+ * Placeholder text for the URL input field.
2092
+ */
2093
+ urlPlaceholder: string;
2094
+ /**
2095
+ * Text for the embed button, which can be localized.
2096
+ */
2097
+ embedButtonText: string | ((locale: TranslationFunctions) => string);
2098
+ /**
2099
+ * Tooltip text for the delete button, which can be localized.
2100
+ */
2101
+ deleteButtonText: string | ((locale: TranslationFunctions) => string);
2102
+ /**
2103
+ * Function to validate the inputted URL.
2104
+ */
2105
+ validUrl: (url: string) => boolean;
2106
+ /**
2107
+ * Error message shown if URL validation fails.
2108
+ */
2109
+ urlError: string | ((locale: TranslationFunctions) => string);
2110
+ /**
2111
+ * Placeholder text shown while the iframe is loading.
2112
+ */
2113
+ iframePlaceholder?: string;
2114
+ /**
2115
+ * Function to generate attributes for the iframe element.
2116
+ */
2117
+ iframeAttributes: (url: string) => Record<string, string>;
2118
+ /**
2119
+ * Callback executed before the iframe loads.
2120
+ */
2121
+ beforeIframeLoad?: (box: Box) => void;
2122
+ /**
2123
+ * If true, allows resizing of the iframe.
2124
+ */
2125
+ resize?: boolean;
2126
+ }
2127
+ /**
2128
+ * Creates an iframe box component with configurable properties.
2129
+ * This component supports rendering an iframe with customizable attributes, resizing, and toolbar functionalities.
2130
+ */
2131
+ declare function createIframeBox(config: IframeBoxConfig): BoxComponent;
2132
+
2028
2133
  /**
2029
2134
  * The HTMLParser interface provides the ability to parse an HTML string according to specified rules.
2030
2135
  */
@@ -2156,4 +2261,4 @@ declare class Dropdown {
2156
2261
  unmount(): void;
2157
2262
  }
2158
2263
 
2159
- export { type ActiveItem, Box, type BoxComponent, type BoxValue, Button, type CommandItem, type ContentRules, Dropdown, type DropdownItem, type DropdownMenuItem, Editor, Fragment, HTMLParser, type InitializePlugin, type KeyValue, type MentionItem, type NodePath, Nodes, Range$1 as Range, type SelectionState, type SlashButtonItem, type SlashItem, type SlashUploadItem, TextParser, Toolbar, type ToolbarButtonItem, type ToolbarDropdownItem, type ToolbarItem, type ToolbarUploadItem, type UnmountPlugin, addMark, deleteContents, getBox, getContentRules, icons, insertBlock, insertBookmark, insertBox, insertContents, query, removeBox, removeMark, setBlocks, splitBlock, splitMarks, template, toBookmark, toHex };
2264
+ export { type ActiveItem, Box, type BoxComponent, type BoxValue, Button, type CommandItem, type ContentRules, Dropdown, type DropdownItem, type DropdownMenuItem, Editor, Fragment, HTMLParser, type InitializePlugin, type KeyValue, type MentionItem, type NodePath, Nodes, Range$1 as Range, type SelectionState, type SlashButtonItem, type SlashItem, type SlashUploadItem, TextParser, Toolbar, type ToolbarButtonItem, type ToolbarDropdownItem, type ToolbarItem, type ToolbarUploadItem, type UnmountPlugin, addMark, createIframeBox, deleteContents, getBox, getContentRules, icons, insertBlock, insertBookmark, insertBox, insertContents, query, removeBox, removeMark, setBlocks, splitBlock, splitMarks, template, toBookmark, toHex };