tencil 0.6.1 → 0.7.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/cli.mjs +1 -1
- package/dist/{cloud-CIAGUsk2.d.mts → cloud-jOobzTY9.d.mts} +1 -1
- package/dist/{index-B0phpEz9.d.mts → index-BRcZL2Ov.d.mts} +37 -0
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/overlay.global.js +75 -31
- package/dist/react.d.mts +1 -1
- package/dist/{server-CbF3t-Cx.mjs → server-1L4Fi2wN.mjs} +104 -10
- package/dist/vite.d.mts +1 -1
- package/package.json +5 -5
package/dist/react.d.mts
CHANGED
|
@@ -28,6 +28,39 @@ const Rect = z.object({
|
|
|
28
28
|
width: z.number(),
|
|
29
29
|
height: z.number()
|
|
30
30
|
});
|
|
31
|
+
/** CSS pixels per side, in CSS order: top, right, bottom, left. */
|
|
32
|
+
const Sides = z.tuple([
|
|
33
|
+
z.number(),
|
|
34
|
+
z.number(),
|
|
35
|
+
z.number(),
|
|
36
|
+
z.number()
|
|
37
|
+
]);
|
|
38
|
+
/** The element's computed box model. */
|
|
39
|
+
const BoxModel = z.object({
|
|
40
|
+
margin: Sides,
|
|
41
|
+
padding: Sides,
|
|
42
|
+
border: Sides,
|
|
43
|
+
/** Only on flex and grid containers with a gap. */
|
|
44
|
+
gap: z.object({
|
|
45
|
+
row: z.number(),
|
|
46
|
+
column: z.number()
|
|
47
|
+
}).optional()
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Distances measured from the element to another one (Alt in the overlay):
|
|
51
|
+
* the space on each side of the element, up to the other element's nearest edge.
|
|
52
|
+
*/
|
|
53
|
+
const Spacing = z.object({
|
|
54
|
+
/** Label of the other element (component · tag). */
|
|
55
|
+
to: z.string(),
|
|
56
|
+
selector: z.string().optional(),
|
|
57
|
+
/** The other element is the picked one's parent. */
|
|
58
|
+
parent: z.boolean().optional(),
|
|
59
|
+
top: z.number().optional(),
|
|
60
|
+
right: z.number().optional(),
|
|
61
|
+
bottom: z.number().optional(),
|
|
62
|
+
left: z.number().optional()
|
|
63
|
+
});
|
|
31
64
|
/**
|
|
32
65
|
* Everything the overlay knows about the picked element. Captured once when
|
|
33
66
|
* the pin is placed and forwarded to the agent as context.
|
|
@@ -47,7 +80,9 @@ const ElementContext = z.object({
|
|
|
47
80
|
dpr: z.number()
|
|
48
81
|
}),
|
|
49
82
|
/** Selected text inside the element at pin time, if any. */
|
|
50
|
-
selection: z.string().optional()
|
|
83
|
+
selection: z.string().optional(),
|
|
84
|
+
box: BoxModel.optional(),
|
|
85
|
+
spacing: Spacing.optional()
|
|
51
86
|
});
|
|
52
87
|
/** Where a pin sits: the element plus the click offset inside it (0..1). */
|
|
53
88
|
const Anchor = z.object({
|
|
@@ -152,7 +187,8 @@ const ClientMessage = z.discriminatedUnion("type", [
|
|
|
152
187
|
z.object({
|
|
153
188
|
type: z.literal("settings.update"),
|
|
154
189
|
provider: z.string().min(1).optional(),
|
|
155
|
-
batch: z.boolean().optional()
|
|
190
|
+
batch: z.boolean().optional(),
|
|
191
|
+
ruler: z.boolean().optional()
|
|
156
192
|
}),
|
|
157
193
|
z.object({
|
|
158
194
|
type: z.literal("model.select"),
|
|
@@ -186,7 +222,9 @@ z.object({
|
|
|
186
222
|
/** Model picked for the provider's new threads; unset means the provider's default. */
|
|
187
223
|
model: z.string().optional(),
|
|
188
224
|
/** New comments are queued and sent together. */
|
|
189
|
-
batch: z.boolean()
|
|
225
|
+
batch: z.boolean(),
|
|
226
|
+
/** The toolbar offers the ruler: spacing while picking, distances with Alt. */
|
|
227
|
+
ruler: z.boolean()
|
|
190
228
|
});
|
|
191
229
|
//#endregion
|
|
192
230
|
//#region ../protocol/src/thread.ts
|
|
@@ -388,8 +426,46 @@ function contextLines(pageUrl, context) {
|
|
|
388
426
|
if (context.selection) lines.push(`- Selected text: "${page(truncate(oneLine(context.selection), 300))}"`);
|
|
389
427
|
const { rect, viewport } = context;
|
|
390
428
|
lines.push(`- Layout: ${Math.round(rect.width)}×${Math.round(rect.height)} at (${Math.round(rect.x)}, ${Math.round(rect.y)}) in a ${viewport.width}×${viewport.height} viewport @${viewport.dpr}x`);
|
|
429
|
+
const box = context.box && boxLine(context.box);
|
|
430
|
+
if (box) lines.push(`- Box: ${box}`);
|
|
431
|
+
if (context.spacing) lines.push(spacingLine(context.spacing));
|
|
391
432
|
return lines;
|
|
392
433
|
}
|
|
434
|
+
/** Computed spacing in CSS shorthand, px: `padding 12 16, margin 0 0 24, gap 8`. */
|
|
435
|
+
function boxLine(box) {
|
|
436
|
+
const parts = [];
|
|
437
|
+
for (const kind of [
|
|
438
|
+
"padding",
|
|
439
|
+
"margin",
|
|
440
|
+
"border"
|
|
441
|
+
]) if (box[kind].some((value) => value !== 0)) parts.push(`${kind} ${shorthand(box[kind])}`);
|
|
442
|
+
if (box.gap) {
|
|
443
|
+
const { row, column } = box.gap;
|
|
444
|
+
parts.push(`gap ${row === column ? row : `${row} ${column}`}`);
|
|
445
|
+
}
|
|
446
|
+
return parts.length > 0 ? `${parts.join(", ")} (px)` : void 0;
|
|
447
|
+
}
|
|
448
|
+
function shorthand([top, right, bottom, left]) {
|
|
449
|
+
if (left !== right) return `${top} ${right} ${bottom} ${left}`;
|
|
450
|
+
if (top !== bottom) return `${top} ${right} ${bottom}`;
|
|
451
|
+
return top === right ? `${top}` : `${top} ${right}`;
|
|
452
|
+
}
|
|
453
|
+
const SIDE_WORDS = {
|
|
454
|
+
top: "above",
|
|
455
|
+
right: "right",
|
|
456
|
+
bottom: "below",
|
|
457
|
+
left: "left"
|
|
458
|
+
};
|
|
459
|
+
/** What the user measured with Alt: the space on each side of the element. */
|
|
460
|
+
function spacingLine(spacing) {
|
|
461
|
+
const sides = [
|
|
462
|
+
"top",
|
|
463
|
+
"right",
|
|
464
|
+
"bottom",
|
|
465
|
+
"left"
|
|
466
|
+
].filter((side) => spacing[side] !== void 0).map((side) => `${spacing[side]}px ${SIDE_WORDS[side]}`);
|
|
467
|
+
return `- Measured spacing to ${`${spacing.parent ? "its parent " : ""}\`${page(truncate(spacing.to, 200))}\``}${spacing.selector ? ` (\`${page(truncate(spacing.selector, 500))}\`)` : ""}: ${sides.length > 0 ? sides.join(", ") : "none"}`;
|
|
468
|
+
}
|
|
393
469
|
function stripContext(text) {
|
|
394
470
|
const index = text.indexOf(CONTEXT_OPEN);
|
|
395
471
|
return index === -1 ? text : text.slice(0, index).trimEnd();
|
|
@@ -527,6 +603,7 @@ var Bridge = class {
|
|
|
527
603
|
const { providers } = this.#options;
|
|
528
604
|
if (message.provider) await providers.setDefault(message.provider);
|
|
529
605
|
if (message.batch !== void 0) await providers.setBatch(message.batch);
|
|
606
|
+
if (message.ruler !== void 0) await providers.setRuler(message.ruler);
|
|
530
607
|
return;
|
|
531
608
|
}
|
|
532
609
|
case "provider.models": {
|
|
@@ -893,7 +970,8 @@ var Bridge = class {
|
|
|
893
970
|
provider: providers.defaultId,
|
|
894
971
|
providers: providers.choices,
|
|
895
972
|
...model ? { model } : {},
|
|
896
|
-
batch: providers.batch
|
|
973
|
+
batch: providers.batch,
|
|
974
|
+
ruler: providers.ruler
|
|
897
975
|
};
|
|
898
976
|
}
|
|
899
977
|
#require(threadId) {
|
|
@@ -995,6 +1073,8 @@ var ProjectProviders = class ProjectProviders {
|
|
|
995
1073
|
#models = {};
|
|
996
1074
|
/** On unless the project turns it off. */
|
|
997
1075
|
#batch = true;
|
|
1076
|
+
/** On unless the project turns it off. */
|
|
1077
|
+
#ruler = true;
|
|
998
1078
|
constructor(options) {
|
|
999
1079
|
this.#options = options;
|
|
1000
1080
|
this.choices = options.choices;
|
|
@@ -1025,6 +1105,7 @@ var ProjectProviders = class ProjectProviders {
|
|
|
1025
1105
|
this.#chosen = saved.provider;
|
|
1026
1106
|
this.#models = saved.models ?? {};
|
|
1027
1107
|
this.#batch = saved.batch ?? true;
|
|
1108
|
+
this.#ruler = saved.ruler ?? true;
|
|
1028
1109
|
}
|
|
1029
1110
|
}
|
|
1030
1111
|
get defaultId() {
|
|
@@ -1078,7 +1159,16 @@ var ProjectProviders = class ProjectProviders {
|
|
|
1078
1159
|
await this.#save();
|
|
1079
1160
|
for (const listener of this.#settingsListeners) listener();
|
|
1080
1161
|
}
|
|
1081
|
-
|
|
1162
|
+
get ruler() {
|
|
1163
|
+
return this.#ruler;
|
|
1164
|
+
}
|
|
1165
|
+
async setRuler(on) {
|
|
1166
|
+
if (on === this.#ruler) return;
|
|
1167
|
+
this.#ruler = on;
|
|
1168
|
+
await this.#save();
|
|
1169
|
+
for (const listener of this.#settingsListeners) listener();
|
|
1170
|
+
}
|
|
1171
|
+
/** Fires when a picked model, batching or the ruler changes. */
|
|
1082
1172
|
onSettingsChange(listener) {
|
|
1083
1173
|
this.#settingsListeners.add(listener);
|
|
1084
1174
|
return () => this.#settingsListeners.delete(listener);
|
|
@@ -1095,7 +1185,8 @@ var ProjectProviders = class ProjectProviders {
|
|
|
1095
1185
|
await this.#options.settings?.save({
|
|
1096
1186
|
provider: this.#chosen,
|
|
1097
1187
|
models: this.#models,
|
|
1098
|
-
batch: this.#batch
|
|
1188
|
+
batch: this.#batch,
|
|
1189
|
+
ruler: this.#ruler
|
|
1099
1190
|
});
|
|
1100
1191
|
}
|
|
1101
1192
|
};
|
|
@@ -3166,7 +3257,7 @@ function errorMessage(error) {
|
|
|
3166
3257
|
}
|
|
3167
3258
|
//#endregion
|
|
3168
3259
|
//#region src/version.ts
|
|
3169
|
-
const VERSION = "0.
|
|
3260
|
+
const VERSION = "0.7.0";
|
|
3170
3261
|
//#endregion
|
|
3171
3262
|
//#region src/daemon/thread-store.ts
|
|
3172
3263
|
const StoreFile = z.object({
|
|
@@ -3338,13 +3429,15 @@ const SettingsFile = z.object({
|
|
|
3338
3429
|
/** Model picked per provider for new threads; unset means the provider's default. */
|
|
3339
3430
|
models: z.record(z.string(), z.string()).optional(),
|
|
3340
3431
|
/** Queue new comments and send them together. */
|
|
3341
|
-
batch: z.boolean().optional()
|
|
3432
|
+
batch: z.boolean().optional(),
|
|
3433
|
+
/** Offer the ruler in the overlay's toolbar. */
|
|
3434
|
+
ruler: z.boolean().optional()
|
|
3342
3435
|
});
|
|
3343
3436
|
/** A project's settings live next to its pins: `<slug>-<hash>.settings.json`. */
|
|
3344
3437
|
function projectSettingsPath(projectRoot, dataDir = defaultDataDir()) {
|
|
3345
3438
|
return projectStorePath(projectRoot, dataDir).replace(/\.json$/, ".settings.json");
|
|
3346
3439
|
}
|
|
3347
|
-
/** A project's overlay settings (provider, models, batching) in a JSON file. */
|
|
3440
|
+
/** A project's overlay settings (provider, models, batching, ruler) in a JSON file. */
|
|
3348
3441
|
var FileProjectSettings = class {
|
|
3349
3442
|
path;
|
|
3350
3443
|
constructor(path) {
|
|
@@ -3362,7 +3455,8 @@ var FileProjectSettings = class {
|
|
|
3362
3455
|
version: 1,
|
|
3363
3456
|
provider: settings.provider,
|
|
3364
3457
|
models: settings.models,
|
|
3365
|
-
batch: settings.batch
|
|
3458
|
+
batch: settings.batch,
|
|
3459
|
+
ruler: settings.ruler
|
|
3366
3460
|
}, null, 2)}\n`);
|
|
3367
3461
|
await rename(temp, this.path);
|
|
3368
3462
|
}
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as TencilCloudOptions } from "./cloud-
|
|
1
|
+
import { t as TencilCloudOptions } from "./cloud-jOobzTY9.mjs";
|
|
2
2
|
//#region src/integrations/vite.d.ts
|
|
3
3
|
/** Structural subset of Vite's Plugin type, so `vite` stays an optional peer. */
|
|
4
4
|
interface VitePlugin {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tencil",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Point at any element of your running app and tell your coding agent what to fix.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Pixel Perfect Agency",
|
|
@@ -93,13 +93,13 @@
|
|
|
93
93
|
"@types/ws": "^8.18.2",
|
|
94
94
|
"react": "^19.3.0",
|
|
95
95
|
"tsdown": "^0.23.0",
|
|
96
|
-
"@tencildev/bridge": "0.
|
|
97
|
-
"@tencildev/protocol": "0.2.0",
|
|
96
|
+
"@tencildev/bridge": "0.3.0",
|
|
98
97
|
"@tencildev/overlay": "0.0.0",
|
|
99
98
|
"@tencildev/provider-claude-code": "0.0.0",
|
|
99
|
+
"@tencildev/protocol": "0.3.0",
|
|
100
100
|
"@tencildev/provider-t3code": "0.0.0",
|
|
101
|
-
"@tencildev/
|
|
102
|
-
"@tencildev/
|
|
101
|
+
"@tencildev/tsconfig": "0.0.0",
|
|
102
|
+
"@tencildev/testing": "0.1.2"
|
|
103
103
|
},
|
|
104
104
|
"scripts": {
|
|
105
105
|
"build": "tsdown && node scripts/copy-overlay.mjs",
|