made-refine 0.1.9 → 0.1.11

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/README.md CHANGED
@@ -15,7 +15,7 @@ Visual CSS editor for React. Edit styles in the browser, then copy agent-ready e
15
15
  ## Quick start
16
16
 
17
17
  ```bash
18
- npx made-refine init
18
+ npx made-refine@latest init
19
19
  ```
20
20
 
21
21
  This detects your framework, installs the package, previews file changes, and applies them after your confirmation. No manual wiring needed.
package/dist/cli.cjs CHANGED
@@ -1149,8 +1149,8 @@ var require_command = __commonJS({
1149
1149
  "use strict";
1150
1150
  var EventEmitter = require("events").EventEmitter;
1151
1151
  var childProcess = require("child_process");
1152
- var path2 = require("path");
1153
- var fs2 = require("fs");
1152
+ var path3 = require("path");
1153
+ var fs3 = require("fs");
1154
1154
  var process2 = require("process");
1155
1155
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1156
1156
  var { CommanderError: CommanderError2 } = require_error();
@@ -2131,7 +2131,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2131
2131
  * @param {string} subcommandName
2132
2132
  */
2133
2133
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
2134
- if (fs2.existsSync(executableFile)) return;
2134
+ if (fs3.existsSync(executableFile)) return;
2135
2135
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
2136
2136
  const executableMissing = `'${executableFile}' does not exist
2137
2137
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
@@ -2149,11 +2149,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2149
2149
  let launchWithNode = false;
2150
2150
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2151
2151
  function findFile2(baseDir, baseName) {
2152
- const localBin = path2.resolve(baseDir, baseName);
2153
- if (fs2.existsSync(localBin)) return localBin;
2154
- if (sourceExt.includes(path2.extname(baseName))) return void 0;
2152
+ const localBin = path3.resolve(baseDir, baseName);
2153
+ if (fs3.existsSync(localBin)) return localBin;
2154
+ if (sourceExt.includes(path3.extname(baseName))) return void 0;
2155
2155
  const foundExt = sourceExt.find(
2156
- (ext) => fs2.existsSync(`${localBin}${ext}`)
2156
+ (ext) => fs3.existsSync(`${localBin}${ext}`)
2157
2157
  );
2158
2158
  if (foundExt) return `${localBin}${foundExt}`;
2159
2159
  return void 0;
@@ -2165,21 +2165,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
2165
2165
  if (this._scriptPath) {
2166
2166
  let resolvedScriptPath;
2167
2167
  try {
2168
- resolvedScriptPath = fs2.realpathSync(this._scriptPath);
2168
+ resolvedScriptPath = fs3.realpathSync(this._scriptPath);
2169
2169
  } catch {
2170
2170
  resolvedScriptPath = this._scriptPath;
2171
2171
  }
2172
- executableDir = path2.resolve(
2173
- path2.dirname(resolvedScriptPath),
2172
+ executableDir = path3.resolve(
2173
+ path3.dirname(resolvedScriptPath),
2174
2174
  executableDir
2175
2175
  );
2176
2176
  }
2177
2177
  if (executableDir) {
2178
2178
  let localFile = findFile2(executableDir, executableFile);
2179
2179
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2180
- const legacyName = path2.basename(
2180
+ const legacyName = path3.basename(
2181
2181
  this._scriptPath,
2182
- path2.extname(this._scriptPath)
2182
+ path3.extname(this._scriptPath)
2183
2183
  );
2184
2184
  if (legacyName !== this._name) {
2185
2185
  localFile = findFile2(
@@ -2190,7 +2190,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2190
2190
  }
2191
2191
  executableFile = localFile || executableFile;
2192
2192
  }
2193
- launchWithNode = sourceExt.includes(path2.extname(executableFile));
2193
+ launchWithNode = sourceExt.includes(path3.extname(executableFile));
2194
2194
  let proc;
2195
2195
  if (process2.platform !== "win32") {
2196
2196
  if (launchWithNode) {
@@ -3037,7 +3037,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3037
3037
  * @return {Command}
3038
3038
  */
3039
3039
  nameFromFilename(filename) {
3040
- this._name = path2.basename(filename, path2.extname(filename));
3040
+ this._name = path3.basename(filename, path3.extname(filename));
3041
3041
  return this;
3042
3042
  }
3043
3043
  /**
@@ -3051,9 +3051,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3051
3051
  * @param {string} [path]
3052
3052
  * @return {(string|null|Command)}
3053
3053
  */
3054
- executableDir(path3) {
3055
- if (path3 === void 0) return this._executableDir;
3056
- this._executableDir = path3;
3054
+ executableDir(path4) {
3055
+ if (path4 === void 0) return this._executableDir;
3056
+ this._executableDir = path4;
3057
3057
  return this;
3058
3058
  }
3059
3059
  /**
@@ -8274,13 +8274,70 @@ var {
8274
8274
  // src/cli.ts
8275
8275
  var import_prompts = __toESM(require_prompts3());
8276
8276
  var import_picocolors = __toESM(require_picocolors());
8277
+ var import_fs2 = __toESM(require("fs"));
8278
+ var import_path2 = __toESM(require("path"));
8279
+ var import_child_process = require("child_process");
8280
+
8281
+ // src/cli-package-manager.ts
8277
8282
  var import_fs = __toESM(require("fs"));
8278
8283
  var import_path = __toESM(require("path"));
8279
- var import_child_process = require("child_process");
8284
+ function parsePackageManager(value) {
8285
+ if (typeof value !== "string") return null;
8286
+ const normalized = value.trim().toLowerCase();
8287
+ if (normalized === "bun" || normalized.startsWith("bun@")) return "bun";
8288
+ if (normalized === "pnpm" || normalized.startsWith("pnpm@")) return "pnpm";
8289
+ if (normalized === "yarn" || normalized.startsWith("yarn@")) return "yarn";
8290
+ if (normalized === "npm" || normalized.startsWith("npm@")) return "npm";
8291
+ return null;
8292
+ }
8293
+ function detectFromPackageJson(cwd) {
8294
+ const packageJsonPath = import_path.default.join(cwd, "package.json");
8295
+ if (!import_fs.default.existsSync(packageJsonPath)) return null;
8296
+ try {
8297
+ const pkg = JSON.parse(import_fs.default.readFileSync(packageJsonPath, "utf-8"));
8298
+ return parsePackageManager(pkg.packageManager);
8299
+ } catch {
8300
+ return null;
8301
+ }
8302
+ }
8303
+ function detectFromLockfile(directory) {
8304
+ if (import_fs.default.existsSync(import_path.default.join(directory, "bun.lockb")) || import_fs.default.existsSync(import_path.default.join(directory, "bun.lock"))) return "bun";
8305
+ if (import_fs.default.existsSync(import_path.default.join(directory, "pnpm-lock.yaml"))) return "pnpm";
8306
+ if (import_fs.default.existsSync(import_path.default.join(directory, "yarn.lock"))) return "yarn";
8307
+ if (import_fs.default.existsSync(import_path.default.join(directory, "package-lock.json")) || import_fs.default.existsSync(import_path.default.join(directory, "npm-shrinkwrap.json"))) return "npm";
8308
+ return null;
8309
+ }
8310
+ function detectPackageManager(cwd) {
8311
+ const fromPackageJson = detectFromPackageJson(cwd);
8312
+ if (fromPackageJson) return fromPackageJson;
8313
+ let current = import_path.default.resolve(cwd);
8314
+ while (true) {
8315
+ const fromLockfile = detectFromLockfile(current);
8316
+ if (fromLockfile) return fromLockfile;
8317
+ const parent = import_path.default.dirname(current);
8318
+ if (parent === current) break;
8319
+ current = parent;
8320
+ }
8321
+ return "npm";
8322
+ }
8323
+ function getInstallCommand(pm) {
8324
+ switch (pm) {
8325
+ case "bun":
8326
+ return "bun add -d made-refine@latest";
8327
+ case "pnpm":
8328
+ return "pnpm add -D made-refine@latest";
8329
+ case "yarn":
8330
+ return "yarn add -D made-refine@latest";
8331
+ case "npm":
8332
+ return "npm install --save-dev made-refine@latest";
8333
+ }
8334
+ }
8335
+
8336
+ // src/cli.ts
8280
8337
  function detectFramework(cwd) {
8281
- const pkgPath = import_path.default.join(cwd, "package.json");
8282
- if (!import_fs.default.existsSync(pkgPath)) return null;
8283
- const pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf-8"));
8338
+ const pkgPath = import_path2.default.join(cwd, "package.json");
8339
+ if (!import_fs2.default.existsSync(pkgPath)) return null;
8340
+ const pkg = JSON.parse(import_fs2.default.readFileSync(pkgPath, "utf-8"));
8284
8341
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
8285
8342
  if (deps["@tanstack/start"] || deps["@tanstack/react-start"]) return "tanstack";
8286
8343
  if (deps["next"]) return "next";
@@ -8289,13 +8346,13 @@ function detectFramework(cwd) {
8289
8346
  }
8290
8347
  function findFile(cwd, ...candidates) {
8291
8348
  for (const c of candidates) {
8292
- const full = import_path.default.join(cwd, c);
8293
- if (import_fs.default.existsSync(full)) return full;
8349
+ const full = import_path2.default.join(cwd, c);
8350
+ if (import_fs2.default.existsSync(full)) return full;
8294
8351
  }
8295
8352
  return null;
8296
8353
  }
8297
8354
  function showDiff(filePath, original, modified) {
8298
- const relPath = import_path.default.relative(process.cwd(), filePath);
8355
+ const relPath = import_path2.default.relative(process.cwd(), filePath);
8299
8356
  console.log();
8300
8357
  console.log(import_picocolors.default.bold(` Changes to ${relPath}:`));
8301
8358
  console.log();
@@ -8344,10 +8401,10 @@ function showDiff(filePath, original, modified) {
8344
8401
  console.log();
8345
8402
  }
8346
8403
  async function transformFile(filePath, transform) {
8347
- const original = import_fs.default.readFileSync(filePath, "utf-8");
8404
+ const original = import_fs2.default.readFileSync(filePath, "utf-8");
8348
8405
  const modified = transform(original);
8349
8406
  if (modified === null || modified === original) {
8350
- console.log(import_picocolors.default.dim(` ${import_path.default.relative(process.cwd(), filePath)} \u2014 no changes needed`));
8407
+ console.log(import_picocolors.default.dim(` ${import_path2.default.relative(process.cwd(), filePath)} \u2014 no changes needed`));
8351
8408
  return false;
8352
8409
  }
8353
8410
  showDiff(filePath, original, modified);
@@ -8358,29 +8415,13 @@ async function transformFile(filePath, transform) {
8358
8415
  initial: true
8359
8416
  });
8360
8417
  if (confirm) {
8361
- import_fs.default.writeFileSync(filePath, modified, "utf-8");
8362
- console.log(import_picocolors.default.green(` \u2713 Updated ${import_path.default.relative(process.cwd(), filePath)}`));
8418
+ import_fs2.default.writeFileSync(filePath, modified, "utf-8");
8419
+ console.log(import_picocolors.default.green(` \u2713 Updated ${import_path2.default.relative(process.cwd(), filePath)}`));
8363
8420
  return true;
8364
8421
  }
8365
8422
  console.log(import_picocolors.default.dim(" Skipped"));
8366
8423
  return false;
8367
8424
  }
8368
- function detectPackageManager(cwd) {
8369
- if (import_fs.default.existsSync(import_path.default.join(cwd, "bun.lockb")) || import_fs.default.existsSync(import_path.default.join(cwd, "bun.lock"))) return "bun";
8370
- if (import_fs.default.existsSync(import_path.default.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
8371
- if (import_fs.default.existsSync(import_path.default.join(cwd, "yarn.lock"))) return "yarn";
8372
- return "bun";
8373
- }
8374
- function getInstallCommand(pm) {
8375
- switch (pm) {
8376
- case "bun":
8377
- return "bun add -d made-refine@beta";
8378
- case "pnpm":
8379
- return "pnpm add -D made-refine@beta";
8380
- case "yarn":
8381
- return "yarn add -D made-refine@beta";
8382
- }
8383
- }
8384
8425
  function installPackage(cwd) {
8385
8426
  console.log(import_picocolors.default.bold("\nInstalling made-refine..."));
8386
8427
  const pm = detectPackageManager(cwd);
@@ -8396,9 +8437,9 @@ function installPackage(cwd) {
8396
8437
  }
8397
8438
  async function setupNextJs(cwd) {
8398
8439
  console.log(import_picocolors.default.bold("\nConfiguring for Next.js...\n"));
8399
- const babelrcPath = import_path.default.join(cwd, ".babelrc");
8400
- if (import_fs.default.existsSync(babelrcPath)) {
8401
- const content2 = import_fs.default.readFileSync(babelrcPath, "utf-8");
8440
+ const babelrcPath = import_path2.default.join(cwd, ".babelrc");
8441
+ if (import_fs2.default.existsSync(babelrcPath)) {
8442
+ const content2 = import_fs2.default.readFileSync(babelrcPath, "utf-8");
8402
8443
  if (content2.includes("made-refine")) {
8403
8444
  console.log(import_picocolors.default.dim(" .babelrc \u2014 already configured"));
8404
8445
  } else {
@@ -8418,16 +8459,16 @@ async function setupNextJs(cwd) {
8418
8459
  2
8419
8460
  );
8420
8461
  console.log(import_picocolors.default.green(` \u2713 Created .babelrc`));
8421
- import_fs.default.writeFileSync(babelrcPath, babelrc + "\n", "utf-8");
8462
+ import_fs2.default.writeFileSync(babelrcPath, babelrc + "\n", "utf-8");
8422
8463
  }
8423
- const preloadSrc = import_path.default.join(cwd, "node_modules/made-refine/dist/preload/preload.js");
8424
- const publicDir = import_path.default.join(cwd, "public");
8425
- const preloadDest = import_path.default.join(publicDir, "made-refine-preload.js");
8426
- if (!import_fs.default.existsSync(publicDir)) {
8427
- import_fs.default.mkdirSync(publicDir, { recursive: true });
8464
+ const preloadSrc = import_path2.default.join(cwd, "node_modules/made-refine/dist/preload/preload.js");
8465
+ const publicDir = import_path2.default.join(cwd, "public");
8466
+ const preloadDest = import_path2.default.join(publicDir, "made-refine-preload.js");
8467
+ if (!import_fs2.default.existsSync(publicDir)) {
8468
+ import_fs2.default.mkdirSync(publicDir, { recursive: true });
8428
8469
  }
8429
- if (import_fs.default.existsSync(preloadSrc)) {
8430
- import_fs.default.copyFileSync(preloadSrc, preloadDest);
8470
+ if (import_fs2.default.existsSync(preloadSrc)) {
8471
+ import_fs2.default.copyFileSync(preloadSrc, preloadDest);
8431
8472
  console.log(import_picocolors.default.green(" \u2713 Copied preload script to public/made-refine-preload.js"));
8432
8473
  } else {
8433
8474
  console.log(import_picocolors.default.yellow(" \u26A0 Preload script not found. After install, run:"));
@@ -8439,9 +8480,9 @@ async function setupNextJs(cwd) {
8439
8480
  printNextLayoutInstructions();
8440
8481
  return;
8441
8482
  }
8442
- const content = import_fs.default.readFileSync(layoutFile, "utf-8");
8483
+ const content = import_fs2.default.readFileSync(layoutFile, "utf-8");
8443
8484
  if (content.includes("made-refine")) {
8444
- console.log(import_picocolors.default.dim(` ${import_path.default.relative(cwd, layoutFile)} \u2014 already configured`));
8485
+ console.log(import_picocolors.default.dim(` ${import_path2.default.relative(cwd, layoutFile)} \u2014 already configured`));
8445
8486
  return;
8446
8487
  }
8447
8488
  const transformed = await transformFile(layoutFile, (src) => {
@@ -8532,9 +8573,9 @@ async function setupVite(cwd) {
8532
8573
  printViteConfigInstructions();
8533
8574
  return;
8534
8575
  }
8535
- const viteContent = import_fs.default.readFileSync(viteConfig, "utf-8");
8576
+ const viteContent = import_fs2.default.readFileSync(viteConfig, "utf-8");
8536
8577
  if (viteContent.includes("made-refine")) {
8537
- console.log(import_picocolors.default.dim(` ${import_path.default.relative(cwd, viteConfig)} \u2014 already configured`));
8578
+ console.log(import_picocolors.default.dim(` ${import_path2.default.relative(cwd, viteConfig)} \u2014 already configured`));
8538
8579
  } else {
8539
8580
  await transformFile(viteConfig, (src) => transformViteConfig(src));
8540
8581
  }
@@ -8554,9 +8595,9 @@ async function setupVite(cwd) {
8554
8595
  printViteComponentInstructions();
8555
8596
  return;
8556
8597
  }
8557
- const appContent = import_fs.default.readFileSync(appFile, "utf-8");
8598
+ const appContent = import_fs2.default.readFileSync(appFile, "utf-8");
8558
8599
  if (appContent.includes("made-refine")) {
8559
- console.log(import_picocolors.default.dim(` ${import_path.default.relative(cwd, appFile)} \u2014 already configured`));
8600
+ console.log(import_picocolors.default.dim(` ${import_path2.default.relative(cwd, appFile)} \u2014 already configured`));
8560
8601
  return;
8561
8602
  }
8562
8603
  const transformed = await transformFile(appFile, (src) => {
@@ -8665,9 +8706,9 @@ async function setupTanStack(cwd) {
8665
8706
  console.log(import_picocolors.default.yellow(" Could not find vite.config \u2014 add manually:"));
8666
8707
  printViteConfigInstructions();
8667
8708
  } else {
8668
- const viteContent = import_fs.default.readFileSync(viteConfig, "utf-8");
8709
+ const viteContent = import_fs2.default.readFileSync(viteConfig, "utf-8");
8669
8710
  if (viteContent.includes("made-refine")) {
8670
- console.log(import_picocolors.default.dim(` ${import_path.default.relative(cwd, viteConfig)} \u2014 already configured`));
8711
+ console.log(import_picocolors.default.dim(` ${import_path2.default.relative(cwd, viteConfig)} \u2014 already configured`));
8671
8712
  } else {
8672
8713
  await transformFile(viteConfig, (src) => transformViteConfig(src));
8673
8714
  }
@@ -8684,9 +8725,9 @@ async function setupTanStack(cwd) {
8684
8725
  printTanStackInstructions();
8685
8726
  return;
8686
8727
  }
8687
- const rootContent = import_fs.default.readFileSync(rootFile, "utf-8");
8728
+ const rootContent = import_fs2.default.readFileSync(rootFile, "utf-8");
8688
8729
  if (rootContent.includes("made-refine")) {
8689
- console.log(import_picocolors.default.dim(` ${import_path.default.relative(cwd, rootFile)} \u2014 already configured`));
8730
+ console.log(import_picocolors.default.dim(` ${import_path2.default.relative(cwd, rootFile)} \u2014 already configured`));
8690
8731
  return;
8691
8732
  }
8692
8733
  const transformed = await transformFile(rootFile, (src) => {
@@ -8747,7 +8788,7 @@ function printTanStackInstructions() {
8747
8788
  async function init() {
8748
8789
  const cwd = process.cwd();
8749
8790
  console.log(import_picocolors.default.bold("\nmade-refine init\n"));
8750
- if (!import_fs.default.existsSync(import_path.default.join(cwd, "package.json"))) {
8791
+ if (!import_fs2.default.existsSync(import_path2.default.join(cwd, "package.json"))) {
8751
8792
  console.log(import_picocolors.default.red("No package.json found. Run this command from your project root."));
8752
8793
  process.exit(1);
8753
8794
  }
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { D as DragState, a as DropIndicator, S as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, b as BorderPropertyKey, c as BorderProperties, F as FlexPropertyKey, d as SizingPropertyKey, e as SizingValue, f as ColorPropertyKey, g as ColorValue, T as TypographyPropertyKey, A as ActiveTool, h as Theme, i as BorderStyleControlPreference, j as SessionEdit, k as SessionItem, l as DirectEditState, m as TypographyProperties, M as MeasurementLine, G as Guideline, n as Comment } from './utils-ClbtK5sb.mjs';
4
- export { o as BorderRadiusProperties, p as BorderStyle, q as ColorProperties, r as CommentReply, s as DomSourceLocation, t as DropTarget, E as ElementInfo, u as ElementLocator, v as FlexProperties, w as MeasurementState, R as ReactComponentFrame, x as SizingMode, y as SizingProperties, z as SpacingProperties, U as UndoEditEntry, H as UndoEntry, I as UndoMoveEntry, J as UndoSelectionEntry, K as buildCommentExport, L as buildSessionExport, N as calculateDropPosition, O as calculateElementMeasurements, P as calculateGuidelineMeasurements, Q as calculateParentMeasurements, V as colorToTailwind, W as elementFromPointWithoutOverlays, X as findContainerAtPoint, Y as formatPropertyValue, Z as getComputedBorderStyles, _ as getComputedBoxShadow, $ as getComputedColorStyles, a0 as getComputedStyles, a1 as getDimensionDisplay, a2 as getElementInfo, a3 as getElementLocator, a4 as getFlexDirection, a5 as isFlexContainer, a6 as parseColorValue, a7 as parsePropertyValue, a8 as stylesToTailwind } from './utils-ClbtK5sb.mjs';
3
+ import { D as DragState, a as DropIndicator, S as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, b as BorderPropertyKey, c as BorderProperties, F as FlexPropertyKey, d as SizingPropertyKey, e as SizingValue, f as ColorPropertyKey, g as ColorValue, T as TypographyPropertyKey, A as ActiveTool, h as Theme, i as BorderStyleControlPreference, j as SessionEdit, k as SessionItem, l as DirectEditState, m as TypographyProperties, M as MeasurementLine, G as Guideline, n as Comment } from './utils-DUE0nsRc.mjs';
4
+ export { o as BorderRadiusProperties, p as BorderStyle, q as ColorProperties, r as CommentReply, s as DomSourceLocation, t as DropTarget, E as ElementInfo, u as ElementLocator, v as FlexProperties, w as MeasurementState, R as ReactComponentFrame, x as SizingMode, y as SizingProperties, z as SpacingProperties, U as UndoEditEntry, H as UndoEntry, I as UndoMoveEntry, J as UndoSelectionEntry, K as buildCommentExport, L as buildSessionExport, N as calculateDropPosition, O as calculateElementMeasurements, P as calculateGuidelineMeasurements, Q as calculateParentMeasurements, V as colorToTailwind, W as elementFromPointWithoutOverlays, X as findContainerAtPoint, Y as formatPropertyValue, Z as getComputedBorderStyles, _ as getComputedBoxShadow, $ as getComputedColorStyles, a0 as getComputedStyles, a1 as getDimensionDisplay, a2 as getElementInfo, a3 as getElementLocator, a4 as getFlexDirection, a5 as isFlexContainer, a6 as parseColorValue, a7 as parsePropertyValue, a8 as stylesToTailwind } from './utils-DUE0nsRc.mjs';
5
5
 
6
6
  declare function DirectEdit(): react_jsx_runtime.JSX.Element;
7
7
 
@@ -20,11 +20,14 @@ interface UseMoveDropTarget {
20
20
  insertBefore: HTMLElement | null;
21
21
  flexDirection: 'row' | 'row-reverse' | 'column' | 'column-reverse';
22
22
  }
23
+ interface StartDragOptions {
24
+ constrainToOriginalParent?: boolean;
25
+ }
23
26
  interface UseMoveResult {
24
27
  dragState: DragState;
25
28
  dropTarget: UseMoveDropTarget | null;
26
29
  dropIndicator: DropIndicator | null;
27
- startDrag: (e: React.PointerEvent, element: HTMLElement) => void;
30
+ startDrag: (e: React.PointerEvent, element: HTMLElement, options?: StartDragOptions) => void;
28
31
  }
29
32
  declare function useMove({ onMoveComplete }: UseMoveOptions): UseMoveResult;
30
33
 
@@ -59,6 +62,7 @@ interface DirectEditActionsContextValue {
59
62
  addCommentReply: (id: string, text: string) => void;
60
63
  deleteComment: (id: string) => void;
61
64
  exportComment: (id: string) => Promise<boolean>;
65
+ canSendEditToAgent: () => boolean;
62
66
  sendEditToAgent: () => Promise<boolean>;
63
67
  sendCommentToAgent: (id: string) => Promise<boolean>;
64
68
  setActiveCommentId: (id: string | null) => void;
@@ -147,6 +151,7 @@ interface DirectEditPanelInnerProps {
147
151
  onReset: () => void;
148
152
  onExportEdits: () => Promise<boolean>;
149
153
  onSendToAgent: () => Promise<boolean>;
154
+ canSendToAgent?: boolean;
150
155
  className?: string;
151
156
  style?: React.CSSProperties;
152
157
  panelRef?: React.RefObject<HTMLDivElement>;
@@ -155,7 +160,7 @@ interface DirectEditPanelInnerProps {
155
160
  onHeaderPointerMove?: (e: React.PointerEvent) => void;
156
161
  onHeaderPointerUp?: (e: React.PointerEvent) => void;
157
162
  }
158
- declare function DirectEditPanelInner({ elementInfo, computedSpacing, computedBorderRadius, computedBorder, computedFlex, computedSizing, computedColor, computedBoxShadow, borderStyleControlPreference, computedTypography, pendingStyles, onClose, onSelectParent, onSelectChild, onUpdateSpacing, onUpdateBorderRadius, onUpdateBorder, onBatchUpdateBorder, onSetCSS, onUpdateFlex, onToggleFlex, onUpdateSizing, onUpdateColor, onUpdateTypography, onReset, onExportEdits, onSendToAgent, className, style, panelRef, isDragging, onHeaderPointerDown, onHeaderPointerMove, onHeaderPointerUp, }: DirectEditPanelInnerProps): react_jsx_runtime.JSX.Element;
163
+ declare function DirectEditPanelInner({ elementInfo, computedSpacing, computedBorderRadius, computedBorder, computedFlex, computedSizing, computedColor, computedBoxShadow, borderStyleControlPreference, computedTypography, pendingStyles, onClose, onSelectParent, onSelectChild, onUpdateSpacing, onUpdateBorderRadius, onUpdateBorder, onBatchUpdateBorder, onSetCSS, onUpdateFlex, onToggleFlex, onUpdateSizing, onUpdateColor, onUpdateTypography, onReset, onExportEdits, onSendToAgent, canSendToAgent, className, style, panelRef, isDragging, onHeaderPointerDown, onHeaderPointerMove, onHeaderPointerUp, }: DirectEditPanelInnerProps): react_jsx_runtime.JSX.Element;
159
164
  declare function DirectEditPanel(): react_jsx_runtime.JSX.Element | null;
160
165
 
161
166
  interface DirectEditToolbarInnerProps {
@@ -196,20 +201,25 @@ interface MeasurementOverlayProps {
196
201
  }
197
202
  declare function MeasurementOverlay({ selectedElement, hoveredElement, measurements, }: MeasurementOverlayProps): react_jsx_runtime.JSX.Element;
198
203
 
204
+ interface MoveStartOptions {
205
+ constrainToOriginalParent?: boolean;
206
+ }
199
207
  interface SelectionOverlayProps {
200
208
  selectedElement: HTMLElement;
209
+ draggedElement?: HTMLElement | null;
201
210
  isDragging: boolean;
202
211
  ghostPosition?: {
203
212
  x: number;
204
213
  y: number;
205
214
  };
206
- onMoveStart: (e: React.PointerEvent) => void;
215
+ onMoveStart: (e: React.PointerEvent, targetElement?: HTMLElement, options?: MoveStartOptions) => void;
216
+ showMoveHandle?: boolean;
207
217
  isTextEditing?: boolean;
208
218
  onDoubleClick?: (clientX: number, clientY: number) => void;
209
219
  onHoverElement?: (element: HTMLElement | null) => void;
210
220
  onClickThrough?: (clientX: number, clientY: number) => void;
211
221
  }
212
- declare function SelectionOverlay({ selectedElement, isDragging, ghostPosition, onMoveStart, isTextEditing, onDoubleClick, onHoverElement, onClickThrough, }: SelectionOverlayProps): react_jsx_runtime.JSX.Element;
222
+ declare function SelectionOverlay({ selectedElement, draggedElement, isDragging, ghostPosition, onMoveStart, showMoveHandle, isTextEditing, onDoubleClick, onHoverElement, onClickThrough, }: SelectionOverlayProps): react_jsx_runtime.JSX.Element;
213
223
 
214
224
  interface MoveOverlayProps {
215
225
  dropIndicator: DropIndicator | null;
@@ -246,9 +256,14 @@ interface CommentOverlayProps {
246
256
  onUpdateText: (id: string, text: string) => void;
247
257
  onAddReply: (id: string, text: string) => void;
248
258
  onDelete: (id: string) => void;
259
+ onExport?: (id: string) => Promise<boolean>;
249
260
  onSendToAgent: (id: string) => Promise<boolean>;
261
+ attentionRequest?: {
262
+ commentId: string;
263
+ nonce: number;
264
+ } | null;
250
265
  }
251
- declare function CommentOverlay({ comments, activeCommentId, onSetActiveComment, onUpdateText, onAddReply, onDelete, onSendToAgent, }: CommentOverlayProps): react_jsx_runtime.JSX.Element | null;
266
+ declare function CommentOverlay({ comments, activeCommentId, onSetActiveComment, onUpdateText, onAddReply, onDelete, onExport, onSendToAgent, attentionRequest, }: CommentOverlayProps): react_jsx_runtime.JSX.Element | null;
252
267
 
253
268
  declare function formatColorValue(color: ColorValue): string;
254
269
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { D as DragState, a as DropIndicator, S as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, b as BorderPropertyKey, c as BorderProperties, F as FlexPropertyKey, d as SizingPropertyKey, e as SizingValue, f as ColorPropertyKey, g as ColorValue, T as TypographyPropertyKey, A as ActiveTool, h as Theme, i as BorderStyleControlPreference, j as SessionEdit, k as SessionItem, l as DirectEditState, m as TypographyProperties, M as MeasurementLine, G as Guideline, n as Comment } from './utils-ClbtK5sb.js';
4
- export { o as BorderRadiusProperties, p as BorderStyle, q as ColorProperties, r as CommentReply, s as DomSourceLocation, t as DropTarget, E as ElementInfo, u as ElementLocator, v as FlexProperties, w as MeasurementState, R as ReactComponentFrame, x as SizingMode, y as SizingProperties, z as SpacingProperties, U as UndoEditEntry, H as UndoEntry, I as UndoMoveEntry, J as UndoSelectionEntry, K as buildCommentExport, L as buildSessionExport, N as calculateDropPosition, O as calculateElementMeasurements, P as calculateGuidelineMeasurements, Q as calculateParentMeasurements, V as colorToTailwind, W as elementFromPointWithoutOverlays, X as findContainerAtPoint, Y as formatPropertyValue, Z as getComputedBorderStyles, _ as getComputedBoxShadow, $ as getComputedColorStyles, a0 as getComputedStyles, a1 as getDimensionDisplay, a2 as getElementInfo, a3 as getElementLocator, a4 as getFlexDirection, a5 as isFlexContainer, a6 as parseColorValue, a7 as parsePropertyValue, a8 as stylesToTailwind } from './utils-ClbtK5sb.js';
3
+ import { D as DragState, a as DropIndicator, S as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, b as BorderPropertyKey, c as BorderProperties, F as FlexPropertyKey, d as SizingPropertyKey, e as SizingValue, f as ColorPropertyKey, g as ColorValue, T as TypographyPropertyKey, A as ActiveTool, h as Theme, i as BorderStyleControlPreference, j as SessionEdit, k as SessionItem, l as DirectEditState, m as TypographyProperties, M as MeasurementLine, G as Guideline, n as Comment } from './utils-DUE0nsRc.js';
4
+ export { o as BorderRadiusProperties, p as BorderStyle, q as ColorProperties, r as CommentReply, s as DomSourceLocation, t as DropTarget, E as ElementInfo, u as ElementLocator, v as FlexProperties, w as MeasurementState, R as ReactComponentFrame, x as SizingMode, y as SizingProperties, z as SpacingProperties, U as UndoEditEntry, H as UndoEntry, I as UndoMoveEntry, J as UndoSelectionEntry, K as buildCommentExport, L as buildSessionExport, N as calculateDropPosition, O as calculateElementMeasurements, P as calculateGuidelineMeasurements, Q as calculateParentMeasurements, V as colorToTailwind, W as elementFromPointWithoutOverlays, X as findContainerAtPoint, Y as formatPropertyValue, Z as getComputedBorderStyles, _ as getComputedBoxShadow, $ as getComputedColorStyles, a0 as getComputedStyles, a1 as getDimensionDisplay, a2 as getElementInfo, a3 as getElementLocator, a4 as getFlexDirection, a5 as isFlexContainer, a6 as parseColorValue, a7 as parsePropertyValue, a8 as stylesToTailwind } from './utils-DUE0nsRc.js';
5
5
 
6
6
  declare function DirectEdit(): react_jsx_runtime.JSX.Element;
7
7
 
@@ -20,11 +20,14 @@ interface UseMoveDropTarget {
20
20
  insertBefore: HTMLElement | null;
21
21
  flexDirection: 'row' | 'row-reverse' | 'column' | 'column-reverse';
22
22
  }
23
+ interface StartDragOptions {
24
+ constrainToOriginalParent?: boolean;
25
+ }
23
26
  interface UseMoveResult {
24
27
  dragState: DragState;
25
28
  dropTarget: UseMoveDropTarget | null;
26
29
  dropIndicator: DropIndicator | null;
27
- startDrag: (e: React.PointerEvent, element: HTMLElement) => void;
30
+ startDrag: (e: React.PointerEvent, element: HTMLElement, options?: StartDragOptions) => void;
28
31
  }
29
32
  declare function useMove({ onMoveComplete }: UseMoveOptions): UseMoveResult;
30
33
 
@@ -59,6 +62,7 @@ interface DirectEditActionsContextValue {
59
62
  addCommentReply: (id: string, text: string) => void;
60
63
  deleteComment: (id: string) => void;
61
64
  exportComment: (id: string) => Promise<boolean>;
65
+ canSendEditToAgent: () => boolean;
62
66
  sendEditToAgent: () => Promise<boolean>;
63
67
  sendCommentToAgent: (id: string) => Promise<boolean>;
64
68
  setActiveCommentId: (id: string | null) => void;
@@ -147,6 +151,7 @@ interface DirectEditPanelInnerProps {
147
151
  onReset: () => void;
148
152
  onExportEdits: () => Promise<boolean>;
149
153
  onSendToAgent: () => Promise<boolean>;
154
+ canSendToAgent?: boolean;
150
155
  className?: string;
151
156
  style?: React.CSSProperties;
152
157
  panelRef?: React.RefObject<HTMLDivElement>;
@@ -155,7 +160,7 @@ interface DirectEditPanelInnerProps {
155
160
  onHeaderPointerMove?: (e: React.PointerEvent) => void;
156
161
  onHeaderPointerUp?: (e: React.PointerEvent) => void;
157
162
  }
158
- declare function DirectEditPanelInner({ elementInfo, computedSpacing, computedBorderRadius, computedBorder, computedFlex, computedSizing, computedColor, computedBoxShadow, borderStyleControlPreference, computedTypography, pendingStyles, onClose, onSelectParent, onSelectChild, onUpdateSpacing, onUpdateBorderRadius, onUpdateBorder, onBatchUpdateBorder, onSetCSS, onUpdateFlex, onToggleFlex, onUpdateSizing, onUpdateColor, onUpdateTypography, onReset, onExportEdits, onSendToAgent, className, style, panelRef, isDragging, onHeaderPointerDown, onHeaderPointerMove, onHeaderPointerUp, }: DirectEditPanelInnerProps): react_jsx_runtime.JSX.Element;
163
+ declare function DirectEditPanelInner({ elementInfo, computedSpacing, computedBorderRadius, computedBorder, computedFlex, computedSizing, computedColor, computedBoxShadow, borderStyleControlPreference, computedTypography, pendingStyles, onClose, onSelectParent, onSelectChild, onUpdateSpacing, onUpdateBorderRadius, onUpdateBorder, onBatchUpdateBorder, onSetCSS, onUpdateFlex, onToggleFlex, onUpdateSizing, onUpdateColor, onUpdateTypography, onReset, onExportEdits, onSendToAgent, canSendToAgent, className, style, panelRef, isDragging, onHeaderPointerDown, onHeaderPointerMove, onHeaderPointerUp, }: DirectEditPanelInnerProps): react_jsx_runtime.JSX.Element;
159
164
  declare function DirectEditPanel(): react_jsx_runtime.JSX.Element | null;
160
165
 
161
166
  interface DirectEditToolbarInnerProps {
@@ -196,20 +201,25 @@ interface MeasurementOverlayProps {
196
201
  }
197
202
  declare function MeasurementOverlay({ selectedElement, hoveredElement, measurements, }: MeasurementOverlayProps): react_jsx_runtime.JSX.Element;
198
203
 
204
+ interface MoveStartOptions {
205
+ constrainToOriginalParent?: boolean;
206
+ }
199
207
  interface SelectionOverlayProps {
200
208
  selectedElement: HTMLElement;
209
+ draggedElement?: HTMLElement | null;
201
210
  isDragging: boolean;
202
211
  ghostPosition?: {
203
212
  x: number;
204
213
  y: number;
205
214
  };
206
- onMoveStart: (e: React.PointerEvent) => void;
215
+ onMoveStart: (e: React.PointerEvent, targetElement?: HTMLElement, options?: MoveStartOptions) => void;
216
+ showMoveHandle?: boolean;
207
217
  isTextEditing?: boolean;
208
218
  onDoubleClick?: (clientX: number, clientY: number) => void;
209
219
  onHoverElement?: (element: HTMLElement | null) => void;
210
220
  onClickThrough?: (clientX: number, clientY: number) => void;
211
221
  }
212
- declare function SelectionOverlay({ selectedElement, isDragging, ghostPosition, onMoveStart, isTextEditing, onDoubleClick, onHoverElement, onClickThrough, }: SelectionOverlayProps): react_jsx_runtime.JSX.Element;
222
+ declare function SelectionOverlay({ selectedElement, draggedElement, isDragging, ghostPosition, onMoveStart, showMoveHandle, isTextEditing, onDoubleClick, onHoverElement, onClickThrough, }: SelectionOverlayProps): react_jsx_runtime.JSX.Element;
213
223
 
214
224
  interface MoveOverlayProps {
215
225
  dropIndicator: DropIndicator | null;
@@ -246,9 +256,14 @@ interface CommentOverlayProps {
246
256
  onUpdateText: (id: string, text: string) => void;
247
257
  onAddReply: (id: string, text: string) => void;
248
258
  onDelete: (id: string) => void;
259
+ onExport?: (id: string) => Promise<boolean>;
249
260
  onSendToAgent: (id: string) => Promise<boolean>;
261
+ attentionRequest?: {
262
+ commentId: string;
263
+ nonce: number;
264
+ } | null;
250
265
  }
251
- declare function CommentOverlay({ comments, activeCommentId, onSetActiveComment, onUpdateText, onAddReply, onDelete, onSendToAgent, }: CommentOverlayProps): react_jsx_runtime.JSX.Element | null;
266
+ declare function CommentOverlay({ comments, activeCommentId, onSetActiveComment, onUpdateText, onAddReply, onDelete, onExport, onSendToAgent, attentionRequest, }: CommentOverlayProps): react_jsx_runtime.JSX.Element | null;
252
267
 
253
268
  declare function formatColorValue(color: ColorValue): string;
254
269