antigravity-rtl-patcher 2.3.0 → 2.3.1

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/bin/cli.js CHANGED
@@ -5,13 +5,13 @@ const chalk = require('chalk');
5
5
  const { patch, restore, status } = require('../src/patcher');
6
6
 
7
7
  const BANNER = `
8
- ${chalk.cyan('Antigravity Smart RTL Patcher')} ${chalk.gray('v2.3.0')}
8
+ ${chalk.cyan('Antigravity Smart RTL Patcher')} ${chalk.gray('v2.3.1')}
9
9
  `;
10
10
 
11
11
  program
12
12
  .name('agy-rtl')
13
13
  .description('RTL patcher for Antigravity')
14
- .version('2.3.0');
14
+ .version('2.3.1');
15
15
 
16
16
  program
17
17
  .command('patch')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-rtl-patcher",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Smart RTL and Persian/Arabic typography patcher for Antigravity",
5
5
  "main": "src/patcher.js",
6
6
  "bin": {
@@ -223,8 +223,8 @@ function _agyRtlRendererMain() {
223
223
  // ─── Helpers ─────────────────────────────────────────────
224
224
 
225
225
  function getStoredState() {
226
- try { var s = localStorage.getItem(STORAGE_KEY); return s === null ? true : s === 'true'; }
227
- catch (e) { return true; }
226
+ try { var s = localStorage.getItem(STORAGE_KEY); return s === null ? false : s === 'true'; }
227
+ catch (e) { return false; }
228
228
  }
229
229
  function setStoredState(v) {
230
230
  try { localStorage.setItem(STORAGE_KEY, v ? 'true' : 'false'); } catch (e) {}
@@ -241,14 +241,18 @@ function _agyRtlRendererMain() {
241
241
  if (el.getAttribute(PROCESSED_ATTR)) return;
242
242
  // Skip the RTL panel/icon itself
243
243
  if (el.closest && (el.closest('#' + PANEL_ID) || el.closest('#' + STATUS_ICON_ID))) return;
244
- var text = el.textContent || '';
245
- if (text.trim().length > 0 && isRTL(text)) {
244
+ var directText = Array.from(el.childNodes)
245
+ .filter(n => n.nodeType === Node.TEXT_NODE)
246
+ .map(n => n.textContent)
247
+ .join(' ');
248
+ if (directText.trim().length > 0 && isRTL(directText)) {
246
249
  el.setAttribute(PROCESSED_ATTR, 'true');
247
250
  }
248
251
  }
249
252
  function removeRTL(el) {
250
253
  if (el.getAttribute(PROCESSED_ATTR)) {
251
254
  el.removeAttribute(PROCESSED_ATTR);
255
+ el.removeAttribute('dir'); // Ensure dir is cleaned up if it was left over from older versions
252
256
  }
253
257
  }
254
258
 
@@ -256,7 +260,7 @@ function _agyRtlRendererMain() {
256
260
  var SELECTORS = [
257
261
  'p', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
258
262
  'blockquote', 'td', 'th', 'span', 'a', 'label',
259
- 'div', 'button',
263
+ 'button',
260
264
  ].join(',');
261
265
 
262
266
  function scanElement(root) {
package/src/patcher.js CHANGED
@@ -75,6 +75,19 @@ async function patchAsar(installation, spinner) {
75
75
  asar.extractAll(asarPath, tmpDir);
76
76
  spinner.succeed('Extracted successfully.');
77
77
 
78
+ // 2.5 Check if it's the IDE
79
+ const pkgJsonPath = path.join(tmpDir, 'package.json');
80
+ if (fs.existsSync(pkgJsonPath)) {
81
+ try {
82
+ const pkg = JSON.parse(await fs.readFile(pkgJsonPath, 'utf-8'));
83
+ if (pkg.name && (pkg.name.toLowerCase().includes('ide') || pkg.name.toLowerCase().includes('antigravity-ide'))) {
84
+ spinner.warn('Antigravity IDE detected. Skipping (this patcher is only for the main app).');
85
+ await fs.remove(tmpDir);
86
+ return;
87
+ }
88
+ } catch (e) {}
89
+ }
90
+
78
91
  // 3. Find preload.js
79
92
  spinner.start('Searching for preload.js...');
80
93
  const preloadPath = findPreloadJs(tmpDir);