@bhsd/codemirror-mediawiki 3.4.1 → 3.5.0

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/dist/static.d.ts CHANGED
@@ -4,6 +4,8 @@ export declare const tagModes: {
4
4
  onlyinclude: string;
5
5
  includeonly: string;
6
6
  noinclude: string;
7
+ translate: string;
8
+ tvar: string;
7
9
  pre: string;
8
10
  nowiki: string;
9
11
  indicator: string;
package/dist/static.js CHANGED
@@ -2,6 +2,8 @@ export const tagModes = {
2
2
  onlyinclude: 'mediawiki',
3
3
  includeonly: 'mediawiki',
4
4
  noinclude: 'mediawiki',
5
+ translate: 'mediawiki',
6
+ tvar: 'mediawiki',
5
7
  pre: 'text/pre',
6
8
  nowiki: 'text/nowiki',
7
9
  indicator: 'mediawiki',
package/dist/statusBar.js CHANGED
@@ -166,8 +166,14 @@ export default (cm, fixer) => [
166
166
  display: 'table-cell',
167
167
  },
168
168
  [workerSelector]: {
169
- '-webkitUserSelect': 'none',
169
+ WebkitUserSelect: 'none',
170
170
  userSelect: 'none',
171
+ '--fix-icon': "url('data:image/svg+xml,"
172
+ + '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">'
173
+ // eslint-disable-next-line @stylistic/max-len
174
+ + '<path d="M8 19a1 1 0 001 1h2a1 1 0 001-1v-1H8zm9-12a7 7 0 10-12 4.9S7 14 7 15v1a1 1 0 001 1h4a1 1 0 001-1v-1c0-1 2-3.1 2-3.1A7 7 0 0017 7"/>'
175
+ + '</svg>'
176
+ + "')",
171
177
  },
172
178
  [`${workerSelector}>*`]: {
173
179
  display: 'table-cell',
@@ -189,14 +195,13 @@ export default (cm, fixer) => [
189
195
  height: '1em',
190
196
  },
191
197
  [`${disabledSelector},${enabledSelector}`]: {
192
- maskImage: "url('data:image/svg+xml,"
193
- + '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">'
194
- // eslint-disable-next-line @stylistic/max-len
195
- + '<path d="M8 19a1 1 0 001 1h2a1 1 0 001-1v-1H8zm9-12a7 7 0 10-12 4.9S7 14 7 15v1a1 1 0 001 1h4a1 1 0 001-1v-1c0-1 2-3.1 2-3.1A7 7 0 0017 7"/>'
196
- + '</svg>'
197
- + "')",
198
+ WebkitMaskImage: 'var(--fix-icon)',
199
+ maskImage: 'var(--fix-icon)',
200
+ WebkitMaskSize: '100%',
198
201
  maskSize: '100%',
202
+ WebkitMaskRepeat: 'no-repeat',
199
203
  maskRepeat: 'no-repeat',
204
+ WebkitMaskPosition: 'center',
200
205
  maskPosition: 'center',
201
206
  },
202
207
  [disabledSelector]: {
package/dist/token.js CHANGED
@@ -906,7 +906,7 @@ let MediaWiki = (() => {
906
906
  else if (stream.match(re) || space) {
907
907
  return makeStyle(style, state);
908
908
  }
909
- else if (stream.match(/^<(?!(?:includeonly|noinclude)(?:\/?>|\s|$))[/a-z]/iu, false)
909
+ else if (stream.match(/^<(?!(?:includeonly|noinclude)(?:\/?>|\s|$)|tvar(?:\s|$))[/a-z]/iu, false)
910
910
  && !stream.match(/^<onlyinclude>/u, false)) {
911
911
  lt = stream.pos + 1;
912
912
  }
@@ -1259,6 +1259,10 @@ let MediaWiki = (() => {
1259
1259
  };
1260
1260
  return (stream, state) => {
1261
1261
  if (stream.match('/>')) {
1262
+ if (name === 'tvar') {
1263
+ stream.backUp(1);
1264
+ return makeLocalTagStyle('error', state);
1265
+ }
1262
1266
  state.extMode = false;
1263
1267
  pop(state);
1264
1268
  return makeLocalTagStyle('extTagBracket', state);
@@ -1267,7 +1271,10 @@ let MediaWiki = (() => {
1267
1271
  const { config: { tagModes } } = this;
1268
1272
  state.extName = name;
1269
1273
  state.extMode ||= name in tagModes && (tagModes[name]) in this
1270
- && this[tagModes[name]](state.data.tags.filter(tag => tag !== name));
1274
+ && this[tagModes[name]]([
1275
+ ...state.data.tags.filter(tag => tag !== name),
1276
+ ...name === 'translate' ? ['tvar'] : [],
1277
+ ]);
1271
1278
  if (state.extMode) {
1272
1279
  state.extState = state.extMode.startState(0);
1273
1280
  }
@@ -1531,7 +1538,9 @@ let MediaWiki = (() => {
1531
1538
  return makeLocalTagStyle('comment', state);
1532
1539
  }
1533
1540
  else if (stream.match(/^<\/?onlyinclude>/u)
1534
- || stream.match(/^<(?:(?:includeonly|noinclude)(?:\s[^>]*)?\/?>|\/(?:includeonly|noinclude)\s*>)/iu)) {
1541
+ || stream.match(/^<(?:(?:includeonly|noinclude)(?:\s[^>]*)?\/?>|\/(?:includeonly|noinclude)\s*>)/iu)
1542
+ || state.data.tags.includes('tvar')
1543
+ && stream.match(/^<(?:tvar\s[^>]*>|\/tvar\s*>)/iu)) {
1535
1544
  return makeLocalTagStyle('comment', state);
1536
1545
  }
1537
1546
  else if (stream.eat('|')) {