draply-dev 1.4.5 → 1.4.6

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 (2) hide show
  1. package/bin/cli.js +9 -3
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -201,12 +201,18 @@ const server = http.createServer((req, res) => {
201
201
  const parts = c.selector.split('.');
202
202
  return parts.length > 1 ? parts.pop() : '';
203
203
  }).filter(Boolean);
204
+ let idsToFind = items.map(c => {
205
+ const parts = c.selector.split('#');
206
+ return parts.length > 1 ? parts.pop() : '';
207
+ }).filter(Boolean);
204
208
 
205
209
  let ctxStart = -1, ctxEnd = -1;
206
210
  for (let i = 0; i < lines.length; i++) {
207
- if (classNamesToFind.some(cls => lines[i].includes(cls)) || (items.length === 1 && items[0].selector && lines[i].includes(items[0].selector.split('#').pop()))) {
208
- const s = Math.max(0, i - 40);
209
- const e = Math.min(lines.length - 1, i + 40);
211
+ const hasClass = classNamesToFind.some(cls => lines[i].includes(cls));
212
+ const hasId = idsToFind.some(id => lines[i].includes(id));
213
+ if (hasClass || hasId) {
214
+ const s = Math.max(0, i - 60);
215
+ const e = Math.min(lines.length - 1, i + 60);
210
216
  if (ctxStart === -1 || s < ctxStart) ctxStart = s;
211
217
  if (ctxEnd === -1 || e > ctxEnd) ctxEnd = e;
212
218
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draply-dev",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "Visual overlay for any frontend project — move, resize, restyle live in the browser, save to CSS",
5
5
  "author": "Arman",
6
6
  "type": "commonjs",