@react-fabric/lexical 1.0.0-beta.6 → 1.0.0-beta.61

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 (134) hide show
  1. package/{src/editor/Lexical.module.css → css/_lexical.css} +8 -4
  2. package/css/styles.css +24 -0
  3. package/dist/cjs/{packages/lexical/src/components → components}/StickyComponent.js +3 -4
  4. package/dist/cjs/{packages/lexical/src/editor → editor}/LexicalEditor.js +35 -10
  5. package/dist/cjs/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +154 -145
  6. package/dist/cjs/i18n/ar.json.js +24 -0
  7. package/dist/cjs/i18n/en.json.js +24 -0
  8. package/dist/cjs/i18n/index.js +33 -0
  9. package/dist/cjs/{packages/lexical/src/index.js → index.js} +1 -0
  10. package/dist/cjs/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +5 -5
  11. package/dist/cjs/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +55 -34
  12. package/dist/esm/{packages/lexical/src/components → components}/StickyComponent.js +3 -4
  13. package/dist/esm/{packages/lexical/src/editor → editor}/LexicalEditor.js +34 -9
  14. package/dist/esm/{packages/lexical/src/hooks → hooks}/useFormatWatcher.js +102 -93
  15. package/dist/esm/i18n/ar.json.js +21 -0
  16. package/dist/esm/i18n/en.json.js +21 -0
  17. package/dist/esm/i18n/index.js +33 -0
  18. package/dist/esm/{packages/lexical/src/index.js → index.js} +1 -0
  19. package/dist/esm/{packages/lexical/src/plugins → plugins}/DraggableBlockPlugin.js +2 -2
  20. package/dist/esm/{packages/lexical/src/plugins → plugins}/ToolbarPlugin.js +56 -35
  21. package/dist/types/editor/LexicalEditor.d.ts +25 -0
  22. package/dist/types/hooks/useFormatWatcher.d.ts +3 -2
  23. package/dist/types/i18n/index.d.ts +1 -0
  24. package/dist/types/index.d.ts +1 -0
  25. package/dist/types/nodes/StickyNode.d.ts +0 -1
  26. package/package.json +14 -13
  27. package/src/components/StickyComponent.tsx +4 -5
  28. package/src/editor/LexicalEditor.tsx +57 -26
  29. package/src/hooks/useFormatWatcher.ts +38 -31
  30. package/src/i18n/ar.json +16 -0
  31. package/src/i18n/en.json +16 -0
  32. package/src/i18n/index.ts +28 -0
  33. package/src/index.ts +2 -0
  34. package/src/plugins/ToolbarPlugin.tsx +56 -35
  35. package/dist/cjs/_virtual/prism.js +0 -5
  36. package/dist/cjs/editor/Lexical.module.css +0 -1
  37. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -432
  38. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
  39. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
  40. package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1139
  41. package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
  42. package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -50
  43. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -245
  44. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
  45. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
  46. package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -471
  47. package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
  48. package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -24
  49. package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1275
  50. package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
  51. package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -29
  52. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -789
  53. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
  54. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
  55. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -976
  56. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -35
  57. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -35
  58. package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -2792
  59. package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
  60. package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -55
  61. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -888
  62. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -35
  63. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -66
  64. package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
  65. package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
  66. package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
  67. package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
  68. package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
  69. package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
  70. package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
  71. package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
  72. package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
  73. package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
  74. package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
  75. package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
  76. package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
  77. package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
  78. package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
  79. package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
  80. package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
  81. package/dist/esm/_virtual/prism.js +0 -5
  82. package/dist/esm/editor/Lexical.module.css +0 -1
  83. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -423
  84. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
  85. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
  86. package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1121
  87. package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
  88. package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
  89. package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -244
  90. package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
  91. package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
  92. package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -463
  93. package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
  94. package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
  95. package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1262
  96. package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
  97. package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -16
  98. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -781
  99. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
  100. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
  101. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -957
  102. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -26
  103. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
  104. package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -2754
  105. package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
  106. package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
  107. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -839
  108. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -26
  109. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
  110. package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
  111. package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
  112. package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
  113. package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
  114. package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
  115. package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
  116. package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
  117. package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
  118. package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
  119. package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
  120. package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
  121. package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
  122. package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
  123. package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
  124. package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
  125. package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
  126. package/dist/esm/node_modules/prismjs/prism.js +0 -1951
  127. /package/dist/cjs/{packages/lexical/src/editor → editor}/theme.js +0 -0
  128. /package/dist/cjs/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
  129. /package/dist/cjs/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
  130. /package/dist/cjs/{packages/lexical/src/utils → utils}/index.js +0 -0
  131. /package/dist/esm/{packages/lexical/src/editor → editor}/theme.js +0 -0
  132. /package/dist/esm/{packages/lexical/src/nodes → nodes}/StickyNode.js +0 -0
  133. /package/dist/esm/{packages/lexical/src/plugins → plugins}/StickyPlugin.js +0 -0
  134. /package/dist/esm/{packages/lexical/src/utils → utils}/index.js +0 -0
@@ -1,417 +0,0 @@
1
- 'use client';
2
-
3
- (function (Prism) {
4
-
5
- // Allow only one line break
6
- var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
7
-
8
- /**
9
- * This function is intended for the creation of the bold or italic pattern.
10
- *
11
- * This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
12
- *
13
- * _Note:_ Keep in mind that this adds a capturing group.
14
- *
15
- * @param {string} pattern
16
- * @returns {RegExp}
17
- */
18
- function createInline(pattern) {
19
- pattern = pattern.replace(/<inner>/g, function () { return inner; });
20
- return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
21
- }
22
-
23
-
24
- var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
25
- var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function () { return tableCell; });
26
- var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
27
-
28
-
29
- Prism.languages.markdown = Prism.languages.extend('markup', {});
30
- Prism.languages.insertBefore('markdown', 'prolog', {
31
- 'front-matter-block': {
32
- pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
33
- lookbehind: true,
34
- greedy: true,
35
- inside: {
36
- 'punctuation': /^---|---$/,
37
- 'front-matter': {
38
- pattern: /\S+(?:\s+\S+)*/,
39
- alias: ['yaml', 'language-yaml'],
40
- inside: Prism.languages.yaml
41
- }
42
- }
43
- },
44
- 'blockquote': {
45
- // > ...
46
- pattern: /^>(?:[\t ]*>)*/m,
47
- alias: 'punctuation'
48
- },
49
- 'table': {
50
- pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'),
51
- inside: {
52
- 'table-data-rows': {
53
- pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'),
54
- lookbehind: true,
55
- inside: {
56
- 'table-data': {
57
- pattern: RegExp(tableCell),
58
- inside: Prism.languages.markdown
59
- },
60
- 'punctuation': /\|/
61
- }
62
- },
63
- 'table-line': {
64
- pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'),
65
- lookbehind: true,
66
- inside: {
67
- 'punctuation': /\||:?-{3,}:?/
68
- }
69
- },
70
- 'table-header-row': {
71
- pattern: RegExp('^' + tableRow + '$'),
72
- inside: {
73
- 'table-header': {
74
- pattern: RegExp(tableCell),
75
- alias: 'important',
76
- inside: Prism.languages.markdown
77
- },
78
- 'punctuation': /\|/
79
- }
80
- }
81
- }
82
- },
83
- 'code': [
84
- {
85
- // Prefixed by 4 spaces or 1 tab and preceded by an empty line
86
- pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
87
- lookbehind: true,
88
- alias: 'keyword'
89
- },
90
- {
91
- // ```optional language
92
- // code block
93
- // ```
94
- pattern: /^```[\s\S]*?^```$/m,
95
- greedy: true,
96
- inside: {
97
- 'code-block': {
98
- pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
99
- lookbehind: true
100
- },
101
- 'code-language': {
102
- pattern: /^(```).+/,
103
- lookbehind: true
104
- },
105
- 'punctuation': /```/
106
- }
107
- }
108
- ],
109
- 'title': [
110
- {
111
- // title 1
112
- // =======
113
-
114
- // title 2
115
- // -------
116
- pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
117
- alias: 'important',
118
- inside: {
119
- punctuation: /==+$|--+$/
120
- }
121
- },
122
- {
123
- // # title 1
124
- // ###### title 6
125
- pattern: /(^\s*)#.+/m,
126
- lookbehind: true,
127
- alias: 'important',
128
- inside: {
129
- punctuation: /^#+|#+$/
130
- }
131
- }
132
- ],
133
- 'hr': {
134
- // ***
135
- // ---
136
- // * * *
137
- // -----------
138
- pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
139
- lookbehind: true,
140
- alias: 'punctuation'
141
- },
142
- 'list': {
143
- // * item
144
- // + item
145
- // - item
146
- // 1. item
147
- pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
148
- lookbehind: true,
149
- alias: 'punctuation'
150
- },
151
- 'url-reference': {
152
- // [id]: http://example.com "Optional title"
153
- // [id]: http://example.com 'Optional title'
154
- // [id]: http://example.com (Optional title)
155
- // [id]: <http://example.com> "Optional title"
156
- pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
157
- inside: {
158
- 'variable': {
159
- pattern: /^(!?\[)[^\]]+/,
160
- lookbehind: true
161
- },
162
- 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
163
- 'punctuation': /^[\[\]!:]|[<>]/
164
- },
165
- alias: 'url'
166
- },
167
- 'bold': {
168
- // **strong**
169
- // __strong__
170
-
171
- // allow one nested instance of italic text using the same delimiter
172
- pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
173
- lookbehind: true,
174
- greedy: true,
175
- inside: {
176
- 'content': {
177
- pattern: /(^..)[\s\S]+(?=..$)/,
178
- lookbehind: true,
179
- inside: {} // see below
180
- },
181
- 'punctuation': /\*\*|__/
182
- }
183
- },
184
- 'italic': {
185
- // *em*
186
- // _em_
187
-
188
- // allow one nested instance of bold text using the same delimiter
189
- pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
190
- lookbehind: true,
191
- greedy: true,
192
- inside: {
193
- 'content': {
194
- pattern: /(^.)[\s\S]+(?=.$)/,
195
- lookbehind: true,
196
- inside: {} // see below
197
- },
198
- 'punctuation': /[*_]/
199
- }
200
- },
201
- 'strike': {
202
- // ~~strike through~~
203
- // ~strike~
204
- // eslint-disable-next-line regexp/strict
205
- pattern: createInline(/(~~?)(?:(?!~)<inner>)+\2/.source),
206
- lookbehind: true,
207
- greedy: true,
208
- inside: {
209
- 'content': {
210
- pattern: /(^~~?)[\s\S]+(?=\1$)/,
211
- lookbehind: true,
212
- inside: {} // see below
213
- },
214
- 'punctuation': /~~?/
215
- }
216
- },
217
- 'code-snippet': {
218
- // `code`
219
- // ``code``
220
- pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
221
- lookbehind: true,
222
- greedy: true,
223
- alias: ['code', 'keyword']
224
- },
225
- 'url': {
226
- // [example](http://example.com "Optional title")
227
- // [example][id]
228
- // [example] [id]
229
- pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
230
- lookbehind: true,
231
- greedy: true,
232
- inside: {
233
- 'operator': /^!/,
234
- 'content': {
235
- pattern: /(^\[)[^\]]+(?=\])/,
236
- lookbehind: true,
237
- inside: {} // see below
238
- },
239
- 'variable': {
240
- pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
241
- lookbehind: true
242
- },
243
- 'url': {
244
- pattern: /(^\]\()[^\s)]+/,
245
- lookbehind: true
246
- },
247
- 'string': {
248
- pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
249
- lookbehind: true
250
- }
251
- }
252
- }
253
- });
254
-
255
- ['url', 'bold', 'italic', 'strike'].forEach(function (token) {
256
- ['url', 'bold', 'italic', 'strike', 'code-snippet'].forEach(function (inside) {
257
- if (token !== inside) {
258
- Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
259
- }
260
- });
261
- });
262
-
263
- Prism.hooks.add('after-tokenize', function (env) {
264
- if (env.language !== 'markdown' && env.language !== 'md') {
265
- return;
266
- }
267
-
268
- function walkTokens(tokens) {
269
- if (!tokens || typeof tokens === 'string') {
270
- return;
271
- }
272
-
273
- for (var i = 0, l = tokens.length; i < l; i++) {
274
- var token = tokens[i];
275
-
276
- if (token.type !== 'code') {
277
- walkTokens(token.content);
278
- continue;
279
- }
280
-
281
- /*
282
- * Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
283
- * is optional. But the grammar is defined so that there is only one case we have to handle:
284
- *
285
- * token.content = [
286
- * <span class="punctuation">```</span>,
287
- * <span class="code-language">xxxx</span>,
288
- * '\n', // exactly one new lines (\r or \n or \r\n)
289
- * <span class="code-block">...</span>,
290
- * '\n', // exactly one new lines again
291
- * <span class="punctuation">```</span>
292
- * ];
293
- */
294
-
295
- var codeLang = token.content[1];
296
- var codeBlock = token.content[3];
297
-
298
- if (codeLang && codeBlock &&
299
- codeLang.type === 'code-language' && codeBlock.type === 'code-block' &&
300
- typeof codeLang.content === 'string') {
301
-
302
- // this might be a language that Prism does not support
303
-
304
- // do some replacements to support C++, C#, and F#
305
- var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp');
306
- // only use the first word
307
- lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase();
308
- var alias = 'language-' + lang;
309
-
310
- // add alias
311
- if (!codeBlock.alias) {
312
- codeBlock.alias = [alias];
313
- } else if (typeof codeBlock.alias === 'string') {
314
- codeBlock.alias = [codeBlock.alias, alias];
315
- } else {
316
- codeBlock.alias.push(alias);
317
- }
318
- }
319
- }
320
- }
321
-
322
- walkTokens(env.tokens);
323
- });
324
-
325
- Prism.hooks.add('wrap', function (env) {
326
- if (env.type !== 'code-block') {
327
- return;
328
- }
329
-
330
- var codeLang = '';
331
- for (var i = 0, l = env.classes.length; i < l; i++) {
332
- var cls = env.classes[i];
333
- var match = /language-(.+)/.exec(cls);
334
- if (match) {
335
- codeLang = match[1];
336
- break;
337
- }
338
- }
339
-
340
- var grammar = Prism.languages[codeLang];
341
-
342
- if (!grammar) {
343
- if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) {
344
- var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16);
345
- env.attributes['id'] = id;
346
-
347
- Prism.plugins.autoloader.loadLanguages(codeLang, function () {
348
- var ele = document.getElementById(id);
349
- if (ele) {
350
- ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang);
351
- }
352
- });
353
- }
354
- } else {
355
- env.content = Prism.highlight(textContent(env.content), grammar, codeLang);
356
- }
357
- });
358
-
359
- var tagPattern = RegExp(Prism.languages.markup.tag.pattern.source, 'gi');
360
-
361
- /**
362
- * A list of known entity names.
363
- *
364
- * This will always be incomplete to save space. The current list is the one used by lowdash's unescape function.
365
- *
366
- * @see {@link https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/unescape.js#L2}
367
- */
368
- var KNOWN_ENTITY_NAMES = {
369
- 'amp': '&',
370
- 'lt': '<',
371
- 'gt': '>',
372
- 'quot': '"',
373
- };
374
-
375
- // IE 11 doesn't support `String.fromCodePoint`
376
- var fromCodePoint = String.fromCodePoint || String.fromCharCode;
377
-
378
- /**
379
- * Returns the text content of a given HTML source code string.
380
- *
381
- * @param {string} html
382
- * @returns {string}
383
- */
384
- function textContent(html) {
385
- // remove all tags
386
- var text = html.replace(tagPattern, '');
387
-
388
- // decode known entities
389
- text = text.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function (m, code) {
390
- code = code.toLowerCase();
391
-
392
- if (code[0] === '#') {
393
- var value;
394
- if (code[1] === 'x') {
395
- value = parseInt(code.slice(2), 16);
396
- } else {
397
- value = Number(code.slice(1));
398
- }
399
-
400
- return fromCodePoint(value);
401
- } else {
402
- var known = KNOWN_ENTITY_NAMES[code];
403
- if (known) {
404
- return known;
405
- }
406
-
407
- // unable to decode
408
- return m;
409
- }
410
- });
411
-
412
- return text;
413
- }
414
-
415
- Prism.languages.md = Prism.languages.markdown;
416
-
417
- }(Prism));
@@ -1,188 +0,0 @@
1
- 'use client';
2
-
3
- Prism.languages.markup = {
4
- 'comment': {
5
- pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
6
- greedy: true
7
- },
8
- 'prolog': {
9
- pattern: /<\?[\s\S]+?\?>/,
10
- greedy: true
11
- },
12
- 'doctype': {
13
- // https://www.w3.org/TR/xml/#NT-doctypedecl
14
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
15
- greedy: true,
16
- inside: {
17
- 'internal-subset': {
18
- pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
19
- lookbehind: true,
20
- greedy: true,
21
- inside: null // see below
22
- },
23
- 'string': {
24
- pattern: /"[^"]*"|'[^']*'/,
25
- greedy: true
26
- },
27
- 'punctuation': /^<!|>$|[[\]]/,
28
- 'doctype-tag': /^DOCTYPE/i,
29
- 'name': /[^\s<>'"]+/
30
- }
31
- },
32
- 'cdata': {
33
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
34
- greedy: true
35
- },
36
- 'tag': {
37
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
38
- greedy: true,
39
- inside: {
40
- 'tag': {
41
- pattern: /^<\/?[^\s>\/]+/,
42
- inside: {
43
- 'punctuation': /^<\/?/,
44
- 'namespace': /^[^\s>\/:]+:/
45
- }
46
- },
47
- 'special-attr': [],
48
- 'attr-value': {
49
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
50
- inside: {
51
- 'punctuation': [
52
- {
53
- pattern: /^=/,
54
- alias: 'attr-equals'
55
- },
56
- {
57
- pattern: /^(\s*)["']|["']$/,
58
- lookbehind: true
59
- }
60
- ]
61
- }
62
- },
63
- 'punctuation': /\/?>/,
64
- 'attr-name': {
65
- pattern: /[^\s>\/]+/,
66
- inside: {
67
- 'namespace': /^[^\s>\/:]+:/
68
- }
69
- }
70
-
71
- }
72
- },
73
- 'entity': [
74
- {
75
- pattern: /&[\da-z]{1,8};/i,
76
- alias: 'named-entity'
77
- },
78
- /&#x?[\da-f]{1,8};/i
79
- ]
80
- };
81
-
82
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
83
- Prism.languages.markup['entity'];
84
- Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
85
-
86
- // Plugin to make entity title show the real entity, idea by Roman Komarov
87
- Prism.hooks.add('wrap', function (env) {
88
-
89
- if (env.type === 'entity') {
90
- env.attributes['title'] = env.content.replace(/&amp;/, '&');
91
- }
92
- });
93
-
94
- Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
95
- /**
96
- * Adds an inlined language to markup.
97
- *
98
- * An example of an inlined language is CSS with `<style>` tags.
99
- *
100
- * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
101
- * case insensitive.
102
- * @param {string} lang The language key.
103
- * @example
104
- * addInlined('style', 'css');
105
- */
106
- value: function addInlined(tagName, lang) {
107
- var includedCdataInside = {};
108
- includedCdataInside['language-' + lang] = {
109
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
110
- lookbehind: true,
111
- inside: Prism.languages[lang]
112
- };
113
- includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
114
-
115
- var inside = {
116
- 'included-cdata': {
117
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
118
- inside: includedCdataInside
119
- }
120
- };
121
- inside['language-' + lang] = {
122
- pattern: /[\s\S]+/,
123
- inside: Prism.languages[lang]
124
- };
125
-
126
- var def = {};
127
- def[tagName] = {
128
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
129
- lookbehind: true,
130
- greedy: true,
131
- inside: inside
132
- };
133
-
134
- Prism.languages.insertBefore('markup', 'cdata', def);
135
- }
136
- });
137
- Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
138
- /**
139
- * Adds an pattern to highlight languages embedded in HTML attributes.
140
- *
141
- * An example of an inlined language is CSS with `style` attributes.
142
- *
143
- * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
144
- * case insensitive.
145
- * @param {string} lang The language key.
146
- * @example
147
- * addAttribute('style', 'css');
148
- */
149
- value: function (attrName, lang) {
150
- Prism.languages.markup.tag.inside['special-attr'].push({
151
- pattern: RegExp(
152
- /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
153
- 'i'
154
- ),
155
- lookbehind: true,
156
- inside: {
157
- 'attr-name': /^[^\s=]+/,
158
- 'attr-value': {
159
- pattern: /=[\s\S]+/,
160
- inside: {
161
- 'value': {
162
- pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
163
- lookbehind: true,
164
- alias: [lang, 'language-' + lang],
165
- inside: Prism.languages[lang]
166
- },
167
- 'punctuation': [
168
- {
169
- pattern: /^=/,
170
- alias: 'attr-equals'
171
- },
172
- /"|'/
173
- ]
174
- }
175
- }
176
- }
177
- });
178
- }
179
- });
180
-
181
- Prism.languages.html = Prism.languages.markup;
182
- Prism.languages.mathml = Prism.languages.markup;
183
- Prism.languages.svg = Prism.languages.markup;
184
-
185
- Prism.languages.xml = Prism.languages.extend('markup', {});
186
- Prism.languages.ssml = Prism.languages.xml;
187
- Prism.languages.atom = Prism.languages.xml;
188
- Prism.languages.rss = Prism.languages.xml;
@@ -1,14 +0,0 @@
1
- 'use client';
2
-
3
- Prism.languages.objectivec = Prism.languages.extend('c', {
4
- 'string': {
5
- pattern: /@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
6
- greedy: true
7
- },
8
- 'keyword': /\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,
9
- 'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
10
- });
11
-
12
- delete Prism.languages.objectivec['class-name'];
13
-
14
- Prism.languages.objc = Prism.languages.objectivec;
@@ -1,60 +0,0 @@
1
- 'use client';
2
-
3
- (function (Prism) {
4
-
5
- var powershell = Prism.languages.powershell = {
6
- 'comment': [
7
- {
8
- pattern: /(^|[^`])<#[\s\S]*?#>/,
9
- lookbehind: true
10
- },
11
- {
12
- pattern: /(^|[^`])#.*/,
13
- lookbehind: true
14
- }
15
- ],
16
- 'string': [
17
- {
18
- pattern: /"(?:`[\s\S]|[^`"])*"/,
19
- greedy: true,
20
- inside: null // see below
21
- },
22
- {
23
- pattern: /'(?:[^']|'')*'/,
24
- greedy: true
25
- }
26
- ],
27
- // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
28
- // Supports two levels of nested brackets (e.g. `[OutputType([System.Collections.Generic.List[int]])]`)
29
- 'namespace': /\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,
30
- 'boolean': /\$(?:false|true)\b/i,
31
- 'variable': /\$\w+\b/,
32
- // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
33
- // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
34
- // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
35
- 'function': [
36
- /\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,
37
- /\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i
38
- ],
39
- // per http://technet.microsoft.com/en-us/library/hh847744.aspx
40
- 'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
41
- 'operator': {
42
- pattern: /(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
43
- lookbehind: true
44
- },
45
- 'punctuation': /[|{}[\];(),.]/
46
- };
47
-
48
- // Variable interpolation inside strings, and nested expressions
49
- powershell.string[0].inside = {
50
- 'function': {
51
- // Allow for one level of nesting
52
- pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,
53
- lookbehind: true,
54
- inside: powershell
55
- },
56
- 'boolean': powershell.boolean,
57
- 'variable': powershell.variable,
58
- };
59
-
60
- }(Prism));