@kombai/cli 0.1.2-beta.3 → 0.1.2-beta.4
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/kombai.mjs +857 -26
- package/package.json +1 -1
package/dist/kombai.mjs
CHANGED
|
@@ -1758,7 +1758,7 @@ var init_version = __esm({
|
|
|
1758
1758
|
"src/lib/version.js"() {
|
|
1759
1759
|
"use strict";
|
|
1760
1760
|
init_define_KOMBAI_TELEMETRY();
|
|
1761
|
-
CLI_VERSION = true ? "0.1.2-beta.
|
|
1761
|
+
CLI_VERSION = true ? "0.1.2-beta.4" : (
|
|
1762
1762
|
/** @type {{ version: string }} */
|
|
1763
1763
|
JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
|
|
1764
1764
|
);
|
|
@@ -6249,25 +6249,812 @@ var init_tailwind_detection = __esm({
|
|
|
6249
6249
|
}
|
|
6250
6250
|
});
|
|
6251
6251
|
|
|
6252
|
+
// ../design-mode/packages/shared/src/convert-viewport-units.ts
|
|
6253
|
+
function convertViewportUnits(html, vw, vh) {
|
|
6254
|
+
if (!html) return html;
|
|
6255
|
+
const min = Math.min(vw, vh);
|
|
6256
|
+
const max = Math.max(vw, vh);
|
|
6257
|
+
return html.replace(UNIT_PATTERN, (_, n, unit) => {
|
|
6258
|
+
const num = parseFloat(n);
|
|
6259
|
+
const u = unit.toLowerCase();
|
|
6260
|
+
let base;
|
|
6261
|
+
if (u.endsWith("vmin")) base = min;
|
|
6262
|
+
else if (u.endsWith("vmax")) base = max;
|
|
6263
|
+
else if (u.endsWith("vw")) base = vw;
|
|
6264
|
+
else base = vh;
|
|
6265
|
+
return `${Math.round(num * base / 100)}px`;
|
|
6266
|
+
});
|
|
6267
|
+
}
|
|
6268
|
+
function buildViewportUnitOverrideCss(vw, vh) {
|
|
6269
|
+
return `
|
|
6270
|
+
.h-screen, .h-dvh, .h-svh, .h-lvh { height: ${vh}px !important; }
|
|
6271
|
+
.min-h-screen, .min-h-dvh, .min-h-svh, .min-h-lvh { min-height: ${vh}px !important; }
|
|
6272
|
+
.max-h-screen, .max-h-dvh, .max-h-svh, .max-h-lvh { max-height: ${vh}px !important; }
|
|
6273
|
+
.w-screen, .w-dvw, .w-svw, .w-lvw { width: ${vw}px !important; }
|
|
6274
|
+
.min-w-screen, .min-w-dvw, .min-w-svw, .min-w-lvw { min-width: ${vw}px !important; }
|
|
6275
|
+
.max-w-screen, .max-w-dvw, .max-w-svw, .max-w-lvw { max-width: ${vw}px !important; }
|
|
6276
|
+
`;
|
|
6277
|
+
}
|
|
6278
|
+
var UNIT_SOURCE, UNIT_PATTERN, HAS_UNIT;
|
|
6279
|
+
var init_convert_viewport_units = __esm({
|
|
6280
|
+
"../design-mode/packages/shared/src/convert-viewport-units.ts"() {
|
|
6281
|
+
"use strict";
|
|
6282
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6283
|
+
UNIT_SOURCE = String.raw`(-?\d*\.?\d+)(dvh|svh|lvh|vh|dvw|svw|lvw|vw|dvmin|svmin|lvmin|vmin|dvmax|svmax|lvmax|vmax)\b`;
|
|
6284
|
+
UNIT_PATTERN = new RegExp(UNIT_SOURCE, "gi");
|
|
6285
|
+
HAS_UNIT = new RegExp(UNIT_SOURCE, "i");
|
|
6286
|
+
}
|
|
6287
|
+
});
|
|
6288
|
+
|
|
6289
|
+
// ../design-mode/packages/shared/src/screenshot-height-metadata.ts
|
|
6290
|
+
var INTRINSIC_VIEWPORT_HEIGHT;
|
|
6291
|
+
var init_screenshot_height_metadata = __esm({
|
|
6292
|
+
"../design-mode/packages/shared/src/screenshot-height-metadata.ts"() {
|
|
6293
|
+
"use strict";
|
|
6294
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6295
|
+
INTRINSIC_VIEWPORT_HEIGHT = 1e3;
|
|
6296
|
+
}
|
|
6297
|
+
});
|
|
6298
|
+
|
|
6299
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/match-media-patch.ts
|
|
6300
|
+
var MATCH_MEDIA_PATCH;
|
|
6301
|
+
var init_match_media_patch = __esm({
|
|
6302
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/match-media-patch.ts"() {
|
|
6303
|
+
"use strict";
|
|
6304
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6305
|
+
MATCH_MEDIA_PATCH = `
|
|
6306
|
+
try {
|
|
6307
|
+
var origMM = window.matchMedia ? window.matchMedia.bind(window) : null;
|
|
6308
|
+
window.matchMedia = function (q) {
|
|
6309
|
+
var base = origMM ? origMM(q) : {
|
|
6310
|
+
media: q, matches: false, onchange: null,
|
|
6311
|
+
addListener: function () {}, removeListener: function () {},
|
|
6312
|
+
addEventListener: function () {}, removeEventListener: function () {},
|
|
6313
|
+
dispatchEvent: function () { return false; }
|
|
6314
|
+
};
|
|
6315
|
+
if (typeof q === 'string' && /prefers-reduced-motion/i.test(q)) {
|
|
6316
|
+
return new Proxy(base, {
|
|
6317
|
+
get: function (t, p) {
|
|
6318
|
+
if (p === 'matches') return true;
|
|
6319
|
+
if (p === 'media') return q;
|
|
6320
|
+
var v = t[p];
|
|
6321
|
+
return typeof v === 'function' ? v.bind(t) : v;
|
|
6322
|
+
}
|
|
6323
|
+
});
|
|
6324
|
+
}
|
|
6325
|
+
return base;
|
|
6326
|
+
};
|
|
6327
|
+
} catch (e) {}
|
|
6328
|
+
`;
|
|
6329
|
+
}
|
|
6330
|
+
});
|
|
6331
|
+
|
|
6332
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/css-freeze.ts
|
|
6333
|
+
var CSS_FREEZE;
|
|
6334
|
+
var init_css_freeze = __esm({
|
|
6335
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/css-freeze.ts"() {
|
|
6336
|
+
"use strict";
|
|
6337
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6338
|
+
CSS_FREEZE = `
|
|
6339
|
+
function installFreezeStyle() {
|
|
6340
|
+
var s = document.createElement('style');
|
|
6341
|
+
s.setAttribute('data-screenshot-freeze', '1');
|
|
6342
|
+
s.textContent = '*, *::before, *::after {' +
|
|
6343
|
+
'animation-duration: 0s !important;' +
|
|
6344
|
+
'animation-delay: 0s !important;' +
|
|
6345
|
+
'transition-duration: 0s !important;' +
|
|
6346
|
+
'transition-delay: 0s !important;' +
|
|
6347
|
+
'caret-color: transparent !important;' +
|
|
6348
|
+
'}';
|
|
6349
|
+
(document.head || document.documentElement).appendChild(s);
|
|
6350
|
+
}
|
|
6351
|
+
if (document.head) {
|
|
6352
|
+
installFreezeStyle();
|
|
6353
|
+
} else {
|
|
6354
|
+
var moHead = new MutationObserver(function (_, obs) {
|
|
6355
|
+
if (document.head) { installFreezeStyle(); obs.disconnect(); }
|
|
6356
|
+
});
|
|
6357
|
+
moHead.observe(document.documentElement, { childList: true, subtree: true });
|
|
6358
|
+
}
|
|
6359
|
+
`;
|
|
6360
|
+
}
|
|
6361
|
+
});
|
|
6362
|
+
|
|
6363
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/detected.ts
|
|
6364
|
+
var DETECT_SNIPPET;
|
|
6365
|
+
var init_detected = __esm({
|
|
6366
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/detected.ts"() {
|
|
6367
|
+
"use strict";
|
|
6368
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6369
|
+
DETECT_SNIPPET = `
|
|
6370
|
+
var __root = document.documentElement;
|
|
6371
|
+
var __hasGsap = typeof window.gsap !== 'undefined';
|
|
6372
|
+
var detected = {
|
|
6373
|
+
lenis: !!(window.lenis || window.__lenis ||
|
|
6374
|
+
__root.classList.contains('lenis') || __root.classList.contains('lenis-smooth')),
|
|
6375
|
+
locomotive: !!(window.locomotive || window.LocomotiveScroll ||
|
|
6376
|
+
__root.classList.contains('has-scroll-smooth') ||
|
|
6377
|
+
!!document.querySelector('[data-scroll-container]')),
|
|
6378
|
+
gsap: __hasGsap,
|
|
6379
|
+
scrolltrigger: !!(window.ScrollTrigger ||
|
|
6380
|
+
(__hasGsap && window.gsap.core && typeof window.gsap.core.getCache === 'function')),
|
|
6381
|
+
anime: typeof window.anime !== 'undefined',
|
|
6382
|
+
animeV4: !!(window.anime && window.anime.engine),
|
|
6383
|
+
motion: typeof window.motion !== 'undefined',
|
|
6384
|
+
waapi_active: document.getAnimations ? document.getAnimations().length : 0
|
|
6385
|
+
};
|
|
6386
|
+
// Read back by the renderer (render.ts) to decide whether the page is worth a live re-measure.
|
|
6387
|
+
window.__kombaiDetected = detected;
|
|
6388
|
+
log('detected', detected);
|
|
6389
|
+
`;
|
|
6390
|
+
}
|
|
6391
|
+
});
|
|
6392
|
+
|
|
6393
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/lenis.ts
|
|
6394
|
+
var LENIS_TEARDOWN;
|
|
6395
|
+
var init_lenis = __esm({
|
|
6396
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/lenis.ts"() {
|
|
6397
|
+
"use strict";
|
|
6398
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6399
|
+
LENIS_TEARDOWN = `
|
|
6400
|
+
var __lenisRoot = document.documentElement;
|
|
6401
|
+
if (
|
|
6402
|
+
window.lenis || window.__lenis ||
|
|
6403
|
+
__lenisRoot.classList.contains('lenis') ||
|
|
6404
|
+
__lenisRoot.classList.contains('lenis-smooth')
|
|
6405
|
+
) {
|
|
6406
|
+
try { window.lenis && window.lenis.destroy && window.lenis.destroy(); } catch (e) {}
|
|
6407
|
+
try { window.__lenis && window.__lenis.destroy && window.__lenis.destroy(); } catch (e) {}
|
|
6408
|
+
__lenisRoot.classList.remove('lenis', 'lenis-smooth', 'lenis-scrolling', 'lenis-stopped');
|
|
6409
|
+
__lenisRoot.style.scrollBehavior = 'auto';
|
|
6410
|
+
var __lenisUnstuck = document.createElement('style');
|
|
6411
|
+
__lenisUnstuck.textContent =
|
|
6412
|
+
'html, body { overflow: auto !important; height: auto !important; }' +
|
|
6413
|
+
'.lenis, .lenis-content, .smooth-wrapper { transform: none !important; }';
|
|
6414
|
+
document.head.appendChild(__lenisUnstuck);
|
|
6415
|
+
}
|
|
6416
|
+
`;
|
|
6417
|
+
}
|
|
6418
|
+
});
|
|
6419
|
+
|
|
6420
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/locomotive.ts
|
|
6421
|
+
var LOCOMOTIVE_TEARDOWN;
|
|
6422
|
+
var init_locomotive = __esm({
|
|
6423
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/locomotive.ts"() {
|
|
6424
|
+
"use strict";
|
|
6425
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6426
|
+
LOCOMOTIVE_TEARDOWN = `
|
|
6427
|
+
var __locoRoot = document.documentElement;
|
|
6428
|
+
if (
|
|
6429
|
+
window.locomotive || window.LocomotiveScroll ||
|
|
6430
|
+
__locoRoot.classList.contains('has-scroll-smooth') ||
|
|
6431
|
+
!!document.querySelector('[data-scroll-container]') ||
|
|
6432
|
+
!!document.querySelector('[data-scroll]')
|
|
6433
|
+
) {
|
|
6434
|
+
try { window.locomotive && window.locomotive.destroy && window.locomotive.destroy(); } catch (e) {}
|
|
6435
|
+
__locoRoot.classList.remove('has-scroll-smooth', 'has-scroll-init');
|
|
6436
|
+
__locoRoot.style.scrollBehavior = 'auto';
|
|
6437
|
+
var __locoUnstuck = document.createElement('style');
|
|
6438
|
+
__locoUnstuck.textContent =
|
|
6439
|
+
'html, body { overflow: auto !important; height: auto !important; }' +
|
|
6440
|
+
'[data-scroll-container] { transform: none !important; }';
|
|
6441
|
+
document.head.appendChild(__locoUnstuck);
|
|
6442
|
+
try {
|
|
6443
|
+
var __locoReveal = document.querySelectorAll('[data-scroll]');
|
|
6444
|
+
for (var __li = 0; __li < __locoReveal.length; __li++) {
|
|
6445
|
+
__locoReveal[__li].classList.add('is-inview', 'is-visible', 'is-revealed');
|
|
6446
|
+
}
|
|
6447
|
+
} catch (e) {}
|
|
6448
|
+
}
|
|
6449
|
+
`;
|
|
6450
|
+
}
|
|
6451
|
+
});
|
|
6452
|
+
|
|
6453
|
+
// src/render/design-mode-shared.js
|
|
6454
|
+
var init_design_mode_shared = __esm({
|
|
6455
|
+
"src/render/design-mode-shared.js"() {
|
|
6456
|
+
"use strict";
|
|
6457
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6458
|
+
init_tailwind_detection();
|
|
6459
|
+
init_tailwind_script();
|
|
6460
|
+
}
|
|
6461
|
+
});
|
|
6462
|
+
|
|
6463
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-ready.ts
|
|
6464
|
+
var TAILWIND_READY_PREDICATE, TAILWIND_WAIT_PREDICATE, TAILWIND_READY_TIMEOUT_MS;
|
|
6465
|
+
var init_tailwind_ready = __esm({
|
|
6466
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-ready.ts"() {
|
|
6467
|
+
"use strict";
|
|
6468
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6469
|
+
init_design_mode_shared();
|
|
6470
|
+
TAILWIND_READY_PREDICATE = `(() => {
|
|
6471
|
+
const probe = document.querySelector('[${TAILWIND_PROBE_ATTR}]');
|
|
6472
|
+
if (probe) return getComputedStyle(probe).display === 'flex';
|
|
6473
|
+
return !document.querySelector(${JSON.stringify(TAILWIND_DOCUMENT_SELECTOR)});
|
|
6474
|
+
})()`;
|
|
6475
|
+
TAILWIND_WAIT_PREDICATE = `(() => {
|
|
6476
|
+
const probe = document.querySelector('[${TAILWIND_PROBE_ATTR}]');
|
|
6477
|
+
if (probe) return getComputedStyle(probe).display === 'flex';
|
|
6478
|
+
if (!document.querySelector(${JSON.stringify(TAILWIND_DOCUMENT_SELECTOR)})) return true;
|
|
6479
|
+
const el = document.querySelector('.overflow-hidden, .overflow-x-hidden');
|
|
6480
|
+
if (el) return getComputedStyle(el).overflow !== 'visible';
|
|
6481
|
+
const flexEl = document.querySelector('.flex');
|
|
6482
|
+
if (flexEl) return getComputedStyle(flexEl).display === 'flex';
|
|
6483
|
+
return true;
|
|
6484
|
+
})()`;
|
|
6485
|
+
TAILWIND_READY_TIMEOUT_MS = 5e3;
|
|
6486
|
+
}
|
|
6487
|
+
});
|
|
6488
|
+
|
|
6489
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-gate.ts
|
|
6490
|
+
var TAILWIND_READY_GATE;
|
|
6491
|
+
var init_tailwind_gate = __esm({
|
|
6492
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-gate.ts"() {
|
|
6493
|
+
"use strict";
|
|
6494
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6495
|
+
init_design_mode_shared();
|
|
6496
|
+
init_tailwind_ready();
|
|
6497
|
+
TAILWIND_READY_GATE = `
|
|
6498
|
+
// A design script can replace <body> wholesale and take the sentinel with it. prepare() runs
|
|
6499
|
+
// on 'load', AFTER those scripts, so this is the first safe point to notice and repair it.
|
|
6500
|
+
// The <script> tag lives in <head> and survives a body wipe, which is how we know the
|
|
6501
|
+
// sentinel was ours to restore rather than one this document never had.
|
|
6502
|
+
//
|
|
6503
|
+
// Re-run on EVERY iteration, not once before the loop: a framework that mounts into <body>
|
|
6504
|
+
// asynchronously can wipe the sentinel at any point during the window, and by construction we
|
|
6505
|
+
// are only still in this loop because Tailwind has not finished compiling \u2014 i.e. on exactly
|
|
6506
|
+
// the heavy, JS-app pages most likely to re-mount. A one-shot restore would leave the
|
|
6507
|
+
// sentinel destroyed for the rest of the window, and render.ts's VERDICT predicate (which
|
|
6508
|
+
// polls concurrently, and now reads a destroyed sentinel as NOT ready) would then refuse a
|
|
6509
|
+
// capture that only needed the sentinel put back.
|
|
6510
|
+
var __twRestoreProbe = function () {
|
|
6511
|
+
try {
|
|
6512
|
+
if (!document.querySelector('[${TAILWIND_PROBE_ATTR}]') &&
|
|
6513
|
+
document.querySelector(${JSON.stringify(TAILWIND_DOCUMENT_SELECTOR)})) {
|
|
6514
|
+
document.body.insertAdjacentHTML('beforeend', ${JSON.stringify(TAILWIND_PROBE_HTML)});
|
|
6515
|
+
}
|
|
6516
|
+
} catch (e) {}
|
|
6517
|
+
};
|
|
6518
|
+
__twRestoreProbe();
|
|
6519
|
+
var __twGateDeadline = performance.now() + ${TAILWIND_READY_TIMEOUT_MS};
|
|
6520
|
+
while (!(${TAILWIND_WAIT_PREDICATE}) && performance.now() < __twGateDeadline) {
|
|
6521
|
+
await raf();
|
|
6522
|
+
__twRestoreProbe();
|
|
6523
|
+
}
|
|
6524
|
+
await raf(); await raf();
|
|
6525
|
+
`;
|
|
6526
|
+
}
|
|
6527
|
+
});
|
|
6528
|
+
|
|
6529
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-asset-watch.ts
|
|
6530
|
+
var TAILWIND_ASSET_FAILED_FLAG, TAILWIND_ASSET_WATCH, TAILWIND_ASSET_FAILED_PREDICATE;
|
|
6531
|
+
var init_tailwind_asset_watch = __esm({
|
|
6532
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/tailwind-asset-watch.ts"() {
|
|
6533
|
+
"use strict";
|
|
6534
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6535
|
+
init_design_mode_shared();
|
|
6536
|
+
TAILWIND_ASSET_FAILED_FLAG = "__kombaiTailwindAssetFailed";
|
|
6537
|
+
TAILWIND_ASSET_WATCH = `
|
|
6538
|
+
window.${TAILWIND_ASSET_FAILED_FLAG} = false;
|
|
6539
|
+
document.addEventListener('error', function (e) {
|
|
6540
|
+
var t = e && e.target;
|
|
6541
|
+
if (!t || t.tagName !== 'SCRIPT') return;
|
|
6542
|
+
if (!t.matches(${JSON.stringify(TAILWIND_RUNTIME_SELECTOR)})) return;
|
|
6543
|
+
window.${TAILWIND_ASSET_FAILED_FLAG} = true;
|
|
6544
|
+
}, true);
|
|
6545
|
+
`;
|
|
6546
|
+
TAILWIND_ASSET_FAILED_PREDICATE = `window.${TAILWIND_ASSET_FAILED_FLAG} === true`;
|
|
6547
|
+
}
|
|
6548
|
+
});
|
|
6549
|
+
|
|
6550
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/scroll-sweep.ts
|
|
6551
|
+
var SCROLL_SWEEP;
|
|
6552
|
+
var init_scroll_sweep = __esm({
|
|
6553
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/scroll-sweep.ts"() {
|
|
6554
|
+
"use strict";
|
|
6555
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6556
|
+
SCROLL_SWEEP = `
|
|
6557
|
+
var __sweepDeadline = performance.now() + 3000;
|
|
6558
|
+
|
|
6559
|
+
// Inner scrollers first. ScrollTrigger.batch({ scroller }) and
|
|
6560
|
+
// IntersectionObserver({ root }) reveals bind to a custom overflow-y panel,
|
|
6561
|
+
// not window \u2014 scrolling window alone never fires them. (When such a panel is
|
|
6562
|
+
// driven by a smooth-scroll lib we couldn't tear down, this sweep is swallowed
|
|
6563
|
+
// and the reveal-catchall pass is the backstop.)
|
|
6564
|
+
try {
|
|
6565
|
+
var __all = document.querySelectorAll('*');
|
|
6566
|
+
var __scrollers = [];
|
|
6567
|
+
for (var __i = 0; __i < __all.length; __i++) {
|
|
6568
|
+
var __el = __all[__i];
|
|
6569
|
+
var __cs = getComputedStyle(__el);
|
|
6570
|
+
var __oy = __cs.overflowY, __o = __cs.overflow;
|
|
6571
|
+
if ((__oy === 'auto' || __oy === 'scroll' || __o === 'auto' || __o === 'scroll') &&
|
|
6572
|
+
__el.scrollHeight > __el.clientHeight + 4) {
|
|
6573
|
+
__scrollers.push(__el);
|
|
6574
|
+
}
|
|
6575
|
+
}
|
|
6576
|
+
for (var __si = 0; __si < __scrollers.length && performance.now() < __sweepDeadline; __si++) {
|
|
6577
|
+
var __sc = __scrollers[__si];
|
|
6578
|
+
var __scStep = Math.max(__sc.clientHeight / 2, 400);
|
|
6579
|
+
for (var __scY = 0; __scY < __sc.scrollHeight && performance.now() < __sweepDeadline; __scY += __scStep) {
|
|
6580
|
+
__sc.scrollTop = __scY;
|
|
6581
|
+
await raf();
|
|
6582
|
+
}
|
|
6583
|
+
__sc.scrollTop = 0;
|
|
6584
|
+
await raf();
|
|
6585
|
+
}
|
|
6586
|
+
} catch (e) {}
|
|
6587
|
+
|
|
6588
|
+
var __sweepStep = Math.max(window.innerHeight / 2, 600);
|
|
6589
|
+
for (var __sweepY = 0; __sweepY < document.body.scrollHeight && performance.now() < __sweepDeadline; __sweepY += __sweepStep) {
|
|
6590
|
+
window.scrollTo(0, __sweepY);
|
|
6591
|
+
await raf();
|
|
6592
|
+
}
|
|
6593
|
+
window.scrollTo(0, 0);
|
|
6594
|
+
await raf();
|
|
6595
|
+
`;
|
|
6596
|
+
}
|
|
6597
|
+
});
|
|
6598
|
+
|
|
6599
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/image-wait.ts
|
|
6600
|
+
var IMAGE_WAIT;
|
|
6601
|
+
var init_image_wait = __esm({
|
|
6602
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/image-wait.ts"() {
|
|
6603
|
+
"use strict";
|
|
6604
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6605
|
+
IMAGE_WAIT = `
|
|
6606
|
+
var __imgs = Array.prototype.slice.call(document.images);
|
|
6607
|
+
__imgs.forEach(function (img) {
|
|
6608
|
+
if (img.loading === 'lazy') img.loading = 'eager';
|
|
6609
|
+
});
|
|
6610
|
+
var __imgAll = Promise.all(__imgs.map(function (img) {
|
|
6611
|
+
var __loaded = img.complete
|
|
6612
|
+
? Promise.resolve()
|
|
6613
|
+
: new Promise(function (resolve) {
|
|
6614
|
+
img.addEventListener('load', resolve, { once: true });
|
|
6615
|
+
img.addEventListener('error', resolve, { once: true });
|
|
6616
|
+
});
|
|
6617
|
+
return __loaded.then(function () {
|
|
6618
|
+
try { return img.decode ? img.decode().catch(function () {}) : undefined; }
|
|
6619
|
+
catch (e) {}
|
|
6620
|
+
});
|
|
6621
|
+
}));
|
|
6622
|
+
await Promise.race([
|
|
6623
|
+
__imgAll,
|
|
6624
|
+
new Promise(function (resolve) { setTimeout(resolve, 6000); })
|
|
6625
|
+
]);
|
|
6626
|
+
`;
|
|
6627
|
+
}
|
|
6628
|
+
});
|
|
6629
|
+
|
|
6630
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/scrolltrigger.ts
|
|
6631
|
+
var SCROLLTRIGGER_FAST_FORWARD;
|
|
6632
|
+
var init_scrolltrigger = __esm({
|
|
6633
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/scrolltrigger.ts"() {
|
|
6634
|
+
"use strict";
|
|
6635
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6636
|
+
SCROLLTRIGGER_FAST_FORWARD = `
|
|
6637
|
+
if (window.ScrollTrigger) {
|
|
6638
|
+
try {
|
|
6639
|
+
var __sts = window.ScrollTrigger.getAll();
|
|
6640
|
+
var __ffTargets = [];
|
|
6641
|
+
__sts.forEach(function (t) {
|
|
6642
|
+
try {
|
|
6643
|
+
if (t.animation && t.animation.targets) {
|
|
6644
|
+
var __ts = t.animation.targets();
|
|
6645
|
+
if (__ts && __ts.length) Array.prototype.push.apply(__ffTargets, __ts);
|
|
6646
|
+
}
|
|
6647
|
+
} catch (e) {}
|
|
6648
|
+
});
|
|
6649
|
+
try {
|
|
6650
|
+
if (__ffTargets.length && window.gsap && typeof window.gsap.set === 'function') {
|
|
6651
|
+
window.gsap.set(__ffTargets, { clearProps: 'all' });
|
|
6652
|
+
}
|
|
6653
|
+
} catch (e) {}
|
|
6654
|
+
__sts.forEach(function (t) {
|
|
6655
|
+
try { if (t.animation && t.animation.invalidate) t.animation.invalidate(); } catch (e) {}
|
|
6656
|
+
});
|
|
6657
|
+
__sts.forEach(function (t) {
|
|
6658
|
+
try {
|
|
6659
|
+
if (t.animation && typeof t.animation.progress === 'function') {
|
|
6660
|
+
t.animation.progress(1, false);
|
|
6661
|
+
}
|
|
6662
|
+
} catch (e) {}
|
|
6663
|
+
try { t.kill(); } catch (e) {}
|
|
6664
|
+
});
|
|
6665
|
+
} catch (e) {}
|
|
6666
|
+
}
|
|
6667
|
+
`;
|
|
6668
|
+
}
|
|
6669
|
+
});
|
|
6670
|
+
|
|
6671
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/gsap.ts
|
|
6672
|
+
var GSAP_FAST_FORWARD;
|
|
6673
|
+
var init_gsap = __esm({
|
|
6674
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/gsap.ts"() {
|
|
6675
|
+
"use strict";
|
|
6676
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6677
|
+
GSAP_FAST_FORWARD = `
|
|
6678
|
+
if (typeof window.gsap !== 'undefined') {
|
|
6679
|
+
try { window.gsap.globalTimeline.progress(1, false); } catch (e) {}
|
|
6680
|
+
}
|
|
6681
|
+
`;
|
|
6682
|
+
}
|
|
6683
|
+
});
|
|
6684
|
+
|
|
6685
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/anime.ts
|
|
6686
|
+
var ANIME_FAST_FORWARD;
|
|
6687
|
+
var init_anime = __esm({
|
|
6688
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/anime.ts"() {
|
|
6689
|
+
"use strict";
|
|
6690
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6691
|
+
ANIME_FAST_FORWARD = `
|
|
6692
|
+
if (typeof window.anime !== 'undefined') {
|
|
6693
|
+
try {
|
|
6694
|
+
window.anime.running && window.anime.running.slice().forEach(function (a) {
|
|
6695
|
+
a.seek(a.duration);
|
|
6696
|
+
a.pause();
|
|
6697
|
+
});
|
|
6698
|
+
} catch (e) {}
|
|
6699
|
+
try {
|
|
6700
|
+
if (window.anime.engine && window.anime.engine.pause) {
|
|
6701
|
+
window.anime.engine.pause();
|
|
6702
|
+
}
|
|
6703
|
+
} catch (e) {}
|
|
6704
|
+
}
|
|
6705
|
+
`;
|
|
6706
|
+
}
|
|
6707
|
+
});
|
|
6708
|
+
|
|
6709
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/reveal-catchall.ts
|
|
6710
|
+
var REVEAL_CATCHALL;
|
|
6711
|
+
var init_reveal_catchall = __esm({
|
|
6712
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/reveal-catchall.ts"() {
|
|
6713
|
+
"use strict";
|
|
6714
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6715
|
+
REVEAL_CATCHALL = `
|
|
6716
|
+
try {
|
|
6717
|
+
if (window.gsap && typeof window.gsap.set === 'function') {
|
|
6718
|
+
var __revAll = document.querySelectorAll('*');
|
|
6719
|
+
var __revHidden = [];
|
|
6720
|
+
for (var __ri = 0; __ri < __revAll.length; __ri++) {
|
|
6721
|
+
var __re = __revAll[__ri];
|
|
6722
|
+
if (!__re._gsap) continue;
|
|
6723
|
+
var __rcs = getComputedStyle(__re);
|
|
6724
|
+
if (__rcs.visibility === 'hidden' || parseFloat(__rcs.opacity) < 0.01) {
|
|
6725
|
+
__revHidden.push(__re);
|
|
6726
|
+
}
|
|
6727
|
+
}
|
|
6728
|
+
if (__revHidden.length) {
|
|
6729
|
+
log('reveal-catchall un-hiding', __revHidden.length, 'element(s)');
|
|
6730
|
+
window.gsap.set(__revHidden, { autoAlpha: 1 });
|
|
6731
|
+
window.gsap.set(__revHidden, { clearProps: 'transform,translate,rotate,scale,x,y' });
|
|
6732
|
+
}
|
|
6733
|
+
}
|
|
6734
|
+
} catch (e) {}
|
|
6735
|
+
`;
|
|
6736
|
+
}
|
|
6737
|
+
});
|
|
6738
|
+
|
|
6739
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/waapi.ts
|
|
6740
|
+
var WAAPI_FREEZE_SNIPPET;
|
|
6741
|
+
var init_waapi = __esm({
|
|
6742
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/waapi.ts"() {
|
|
6743
|
+
"use strict";
|
|
6744
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6745
|
+
WAAPI_FREEZE_SNIPPET = `
|
|
6746
|
+
try {
|
|
6747
|
+
document.getAnimations().forEach(function (a) {
|
|
6748
|
+
try { a.finish(); } catch (e) {}
|
|
6749
|
+
try { a.pause(); } catch (e) {}
|
|
6750
|
+
});
|
|
6751
|
+
} catch (e) {}
|
|
6752
|
+
`;
|
|
6753
|
+
}
|
|
6754
|
+
});
|
|
6755
|
+
|
|
6756
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/fonts-ready.ts
|
|
6757
|
+
var FONTS_READY;
|
|
6758
|
+
var init_fonts_ready = __esm({
|
|
6759
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/fonts-ready.ts"() {
|
|
6760
|
+
"use strict";
|
|
6761
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6762
|
+
FONTS_READY = `
|
|
6763
|
+
try { await document.fonts.ready; } catch (e) {}
|
|
6764
|
+
`;
|
|
6765
|
+
}
|
|
6766
|
+
});
|
|
6767
|
+
|
|
6768
|
+
// ../design-mode/packages/frame-runtime/src/storage-stand-ins.ts
|
|
6769
|
+
function installStorageStandIns(win, doc, capBytes, DomException, defineProperty) {
|
|
6770
|
+
const bytesOf = (key, value) => (key.length + value.length) * 2;
|
|
6771
|
+
const quotaError = (key) => new DomException(`Setting the value of '${key}' exceeded the quota.`, "QuotaExceededError");
|
|
6772
|
+
const throwsOnRead = (read2) => {
|
|
6773
|
+
try {
|
|
6774
|
+
read2();
|
|
6775
|
+
return false;
|
|
6776
|
+
} catch {
|
|
6777
|
+
return true;
|
|
6778
|
+
}
|
|
6779
|
+
};
|
|
6780
|
+
const memoryStorage = () => {
|
|
6781
|
+
const items = /* @__PURE__ */ new Map();
|
|
6782
|
+
let bytes = 0;
|
|
6783
|
+
const api = {
|
|
6784
|
+
get length() {
|
|
6785
|
+
return items.size;
|
|
6786
|
+
},
|
|
6787
|
+
key(index) {
|
|
6788
|
+
return Array.from(items.keys())[Number(index)] ?? null;
|
|
6789
|
+
},
|
|
6790
|
+
getItem(key) {
|
|
6791
|
+
return items.get(String(key)) ?? null;
|
|
6792
|
+
},
|
|
6793
|
+
setItem(key, value) {
|
|
6794
|
+
const k = String(key);
|
|
6795
|
+
const v = String(value);
|
|
6796
|
+
const prev = items.get(k);
|
|
6797
|
+
const next = bytes - (prev === void 0 ? 0 : bytesOf(k, prev)) + bytesOf(k, v);
|
|
6798
|
+
if (next > capBytes) throw quotaError(k);
|
|
6799
|
+
items.set(k, v);
|
|
6800
|
+
bytes = next;
|
|
6801
|
+
},
|
|
6802
|
+
removeItem(key) {
|
|
6803
|
+
const k = String(key);
|
|
6804
|
+
const prev = items.get(k);
|
|
6805
|
+
if (prev === void 0) return;
|
|
6806
|
+
items.delete(k);
|
|
6807
|
+
bytes -= bytesOf(k, prev);
|
|
6808
|
+
},
|
|
6809
|
+
clear() {
|
|
6810
|
+
items.clear();
|
|
6811
|
+
bytes = 0;
|
|
6812
|
+
}
|
|
6813
|
+
};
|
|
6814
|
+
const own = (p) => typeof p === "symbol" || p in api;
|
|
6815
|
+
return new Proxy(api, {
|
|
6816
|
+
get(target, p, receiver) {
|
|
6817
|
+
if (own(p)) return Reflect.get(target, p, receiver);
|
|
6818
|
+
return target.getItem(p) ?? void 0;
|
|
6819
|
+
},
|
|
6820
|
+
set(target, p, value) {
|
|
6821
|
+
if (own(p)) return false;
|
|
6822
|
+
target.setItem(p, value);
|
|
6823
|
+
return true;
|
|
6824
|
+
},
|
|
6825
|
+
has(_target, p) {
|
|
6826
|
+
return own(p) || items.has(p);
|
|
6827
|
+
},
|
|
6828
|
+
deleteProperty(target, p) {
|
|
6829
|
+
if (!own(p)) target.removeItem(p);
|
|
6830
|
+
return true;
|
|
6831
|
+
},
|
|
6832
|
+
ownKeys() {
|
|
6833
|
+
return Array.from(items.keys());
|
|
6834
|
+
},
|
|
6835
|
+
getOwnPropertyDescriptor(target, p) {
|
|
6836
|
+
if (own(p)) return Reflect.getOwnPropertyDescriptor(target, p);
|
|
6837
|
+
const value = items.get(p);
|
|
6838
|
+
return value === void 0 ? void 0 : { value, writable: true, enumerable: true, configurable: true };
|
|
6839
|
+
}
|
|
6840
|
+
});
|
|
6841
|
+
};
|
|
6842
|
+
const cookieJar = () => {
|
|
6843
|
+
const jar = /* @__PURE__ */ new Map();
|
|
6844
|
+
let bytes = 0;
|
|
6845
|
+
return {
|
|
6846
|
+
get: () => Array.from(jar, ([k, v]) => k ? `${k}=${v}` : v).join("; "),
|
|
6847
|
+
set(raw) {
|
|
6848
|
+
const [pair = "", ...attrs] = String(raw).split(";");
|
|
6849
|
+
const eq = pair.indexOf("=");
|
|
6850
|
+
const name = (eq < 0 ? "" : pair.slice(0, eq)).trim();
|
|
6851
|
+
const value = (eq < 0 ? pair : pair.slice(eq + 1)).trim();
|
|
6852
|
+
const expired = attrs.some((a) => {
|
|
6853
|
+
const [k = "", v = ""] = a.split("=").map((s) => s.trim());
|
|
6854
|
+
if (/^max-age$/i.test(k)) return Number(v) <= 0;
|
|
6855
|
+
if (/^expires$/i.test(k)) return Date.parse(v) <= Date.now();
|
|
6856
|
+
return false;
|
|
6857
|
+
});
|
|
6858
|
+
const prev = jar.get(name);
|
|
6859
|
+
const freed = prev === void 0 ? 0 : bytesOf(name, prev);
|
|
6860
|
+
if (expired) {
|
|
6861
|
+
jar.delete(name);
|
|
6862
|
+
bytes -= freed;
|
|
6863
|
+
return;
|
|
6864
|
+
}
|
|
6865
|
+
const next = bytes - freed + bytesOf(name, value);
|
|
6866
|
+
if (next > capBytes) throw quotaError(name);
|
|
6867
|
+
jar.set(name, value);
|
|
6868
|
+
bytes = next;
|
|
6869
|
+
}
|
|
6870
|
+
};
|
|
6871
|
+
};
|
|
6872
|
+
for (const name of ["localStorage", "sessionStorage"]) {
|
|
6873
|
+
if (!throwsOnRead(() => win[name])) continue;
|
|
6874
|
+
defineProperty(win, name, { value: memoryStorage(), configurable: true, enumerable: true });
|
|
6875
|
+
}
|
|
6876
|
+
if (throwsOnRead(() => doc.cookie)) {
|
|
6877
|
+
const jar = cookieJar();
|
|
6878
|
+
defineProperty(doc, "cookie", { get: jar.get, set: jar.set, configurable: true, enumerable: true });
|
|
6879
|
+
}
|
|
6880
|
+
}
|
|
6881
|
+
var STORAGE_CAP_BYTES;
|
|
6882
|
+
var init_storage_stand_ins = __esm({
|
|
6883
|
+
"../design-mode/packages/frame-runtime/src/storage-stand-ins.ts"() {
|
|
6884
|
+
"use strict";
|
|
6885
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6886
|
+
STORAGE_CAP_BYTES = 5 * 1024 * 1024;
|
|
6887
|
+
}
|
|
6888
|
+
});
|
|
6889
|
+
|
|
6890
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/storage-stand-ins.ts
|
|
6891
|
+
var SCRIPT_BODY, STORAGE_STAND_INS_SCRIPT_TAG;
|
|
6892
|
+
var init_storage_stand_ins2 = __esm({
|
|
6893
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/storage-stand-ins.ts"() {
|
|
6894
|
+
"use strict";
|
|
6895
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6896
|
+
init_storage_stand_ins();
|
|
6897
|
+
SCRIPT_BODY = `(function () {
|
|
6898
|
+
try {
|
|
6899
|
+
(${installStorageStandIns.toString()})(window, document, ${STORAGE_CAP_BYTES}, DOMException, Object.defineProperty);
|
|
6900
|
+
} catch (e) {}
|
|
6901
|
+
})();`;
|
|
6902
|
+
STORAGE_STAND_INS_SCRIPT_TAG = `<script data-kombai-storage-stand-ins>${SCRIPT_BODY}</script>`;
|
|
6903
|
+
}
|
|
6904
|
+
});
|
|
6905
|
+
|
|
6906
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/video-pause.ts
|
|
6907
|
+
var VIDEO_PAUSE_SNIPPET;
|
|
6908
|
+
var init_video_pause = __esm({
|
|
6909
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/video-pause.ts"() {
|
|
6910
|
+
"use strict";
|
|
6911
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6912
|
+
VIDEO_PAUSE_SNIPPET = `
|
|
6913
|
+
document.querySelectorAll('video').forEach(function (v) {
|
|
6914
|
+
v.pause();
|
|
6915
|
+
if (!v.poster && v.readyState >= 2 && v.currentTime === 0) {
|
|
6916
|
+
v.currentTime = 0.1;
|
|
6917
|
+
}
|
|
6918
|
+
});
|
|
6919
|
+
`;
|
|
6920
|
+
}
|
|
6921
|
+
});
|
|
6922
|
+
|
|
6923
|
+
// ../design-mode/packages/server/src/plugins/screenshot/prep/index.ts
|
|
6924
|
+
var SCREENSHOT_READY_SELECTOR, SCREENSHOT_BOOTSTRAP_MARKER, SCRIPT_BODY2, SCREENSHOT_PREP_SCRIPT_TAG;
|
|
6925
|
+
var init_prep = __esm({
|
|
6926
|
+
"../design-mode/packages/server/src/plugins/screenshot/prep/index.ts"() {
|
|
6927
|
+
"use strict";
|
|
6928
|
+
init_define_KOMBAI_TELEMETRY();
|
|
6929
|
+
init_match_media_patch();
|
|
6930
|
+
init_css_freeze();
|
|
6931
|
+
init_detected();
|
|
6932
|
+
init_lenis();
|
|
6933
|
+
init_locomotive();
|
|
6934
|
+
init_tailwind_gate();
|
|
6935
|
+
init_tailwind_asset_watch();
|
|
6936
|
+
init_scroll_sweep();
|
|
6937
|
+
init_image_wait();
|
|
6938
|
+
init_scrolltrigger();
|
|
6939
|
+
init_gsap();
|
|
6940
|
+
init_anime();
|
|
6941
|
+
init_reveal_catchall();
|
|
6942
|
+
init_waapi();
|
|
6943
|
+
init_fonts_ready();
|
|
6944
|
+
init_storage_stand_ins2();
|
|
6945
|
+
init_waapi();
|
|
6946
|
+
init_video_pause();
|
|
6947
|
+
init_tailwind_ready();
|
|
6948
|
+
init_tailwind_asset_watch();
|
|
6949
|
+
SCREENSHOT_READY_SELECTOR = "html[data-screenshot-ready]";
|
|
6950
|
+
SCREENSHOT_BOOTSTRAP_MARKER = "data-kombai-screenshot-bootstrap";
|
|
6951
|
+
SCRIPT_BODY2 = `(function () {
|
|
6952
|
+
// 1. matchMedia patch \u2014 must run before any library reads prefers-reduced-motion.
|
|
6953
|
+
${MATCH_MEDIA_PATCH}
|
|
6954
|
+
|
|
6955
|
+
// 2. CSS freeze \u2014 install ASAP so even early CSS animations don't get a head start.
|
|
6956
|
+
${CSS_FREEZE}
|
|
6957
|
+
|
|
6958
|
+
// 3. Watch for a failed load of OUR tailwind runtime. Must be registered before the
|
|
6959
|
+
// <script> tag is parsed, which is why it lives here and not inside prepare().
|
|
6960
|
+
${TAILWIND_ASSET_WATCH}
|
|
6961
|
+
|
|
6962
|
+
var raf = function () { return new Promise(function (r) { requestAnimationFrame(r); }); };
|
|
6963
|
+
var log = function () {
|
|
6964
|
+
try { console.log.apply(console, ['[screenshot-bootstrap]'].concat([].slice.call(arguments))); } catch (e) {}
|
|
6965
|
+
};
|
|
6966
|
+
async function prepare() {
|
|
6967
|
+
try {
|
|
6968
|
+
// Single detection summary so the [screenshot-bootstrap] console line
|
|
6969
|
+
// tells us which animation libraries were active at start.
|
|
6970
|
+
${DETECT_SNIPPET}
|
|
6971
|
+
|
|
6972
|
+
// Smooth-scroll hijackers must die BEFORE scrollTo, or scroll-triggered
|
|
6973
|
+
// reveals never fire.
|
|
6974
|
+
${LENIS_TEARDOWN}
|
|
6975
|
+
${LOCOMOTIVE_TEARDOWN}
|
|
6976
|
+
|
|
6977
|
+
// Wait for Tailwind's async CSS pass before measuring layout \u2014 'load'
|
|
6978
|
+
// fires before it finishes, so utility classes aren't applied yet and an
|
|
6979
|
+
// unsized <svg viewBox> can inflate body.scrollHeight to ~700000px,
|
|
6980
|
+
// making the sweep below run for ~100s and blow past the ready timeout.
|
|
6981
|
+
${TAILWIND_READY_GATE}
|
|
6982
|
+
|
|
6983
|
+
// RAF scroll sweep so ScrollTrigger / IntersectionObserver register positions.
|
|
6984
|
+
${SCROLL_SWEEP}
|
|
6985
|
+
|
|
6986
|
+
// Wait for all images (lazy promoted to eager so distant lazy images load).
|
|
6987
|
+
${IMAGE_WAIT}
|
|
6988
|
+
|
|
6989
|
+
// Fast-forward JS animations to settled end state.
|
|
6990
|
+
${SCROLLTRIGGER_FAST_FORWARD}
|
|
6991
|
+
${GSAP_FAST_FORWARD}
|
|
6992
|
+
${ANIME_FAST_FORWARD}
|
|
6993
|
+
|
|
6994
|
+
// Reveal catch-all \u2014 un-hide GSAP-managed content whose scroll-bound
|
|
6995
|
+
// reveal never fired (custom-scroller ScrollTrigger.batch, smooth-scroll
|
|
6996
|
+
// libs we couldn't tear down). Runs after the fast-forwards so it only
|
|
6997
|
+
// touches elements still genuinely stuck at opacity/visibility hidden.
|
|
6998
|
+
${REVEAL_CATCHALL}
|
|
6999
|
+
|
|
7000
|
+
// WAAPI catch-all \u2014 covers Motion One, framer-motion-vanilla, any Animation object.
|
|
7001
|
+
${WAAPI_FREEZE_SNIPPET}
|
|
7002
|
+
|
|
7003
|
+
// Fonts + 2\xD7 rAF settle so the final frame is committed.
|
|
7004
|
+
${FONTS_READY}
|
|
7005
|
+
await new Promise(function (r) { requestAnimationFrame(function () { requestAnimationFrame(r); }); });
|
|
7006
|
+
} catch (e) {
|
|
7007
|
+
try { window.__screenshotReadyError = String((e && e.message) || e); } catch (_) {}
|
|
7008
|
+
log('error', e);
|
|
7009
|
+
} finally {
|
|
7010
|
+
try { document.documentElement.setAttribute('data-screenshot-ready', '1'); } catch (_) {}
|
|
7011
|
+
window.__screenshotReady = true;
|
|
7012
|
+
log('ready');
|
|
7013
|
+
}
|
|
7014
|
+
}
|
|
7015
|
+
|
|
7016
|
+
if (document.readyState === 'complete') {
|
|
7017
|
+
prepare();
|
|
7018
|
+
} else {
|
|
7019
|
+
window.addEventListener('load', prepare, { once: true });
|
|
7020
|
+
}
|
|
7021
|
+
})();`;
|
|
7022
|
+
SCREENSHOT_PREP_SCRIPT_TAG = `<script ${SCREENSHOT_BOOTSTRAP_MARKER}>${SCRIPT_BODY2}</script>`;
|
|
7023
|
+
}
|
|
7024
|
+
});
|
|
7025
|
+
|
|
6252
7026
|
// src/render/page.js
|
|
6253
|
-
function composePage({ html, overrides, images }) {
|
|
7027
|
+
function composePage({ html, overrides, images, anchorWidth }) {
|
|
6254
7028
|
const rewrite = (text) => rewriteImages(text, images);
|
|
6255
7029
|
const captured = Boolean(overrides);
|
|
6256
7030
|
const htmlAttrs = overrides?.htmlAttrs ? ` ${overrides.htmlAttrs.trimStart()}` : "";
|
|
6257
7031
|
const bodyAttrs = overrides?.bodyAttrs ? ` ${rewrite(overrides.bodyAttrs.trimStart())}` : "";
|
|
6258
7032
|
const tailwind = needsTailwindRuntime(tailwindScanInput(html, overrides ?? void 0)) ? TAILWIND_CDN_SCRIPT_TAG : "";
|
|
6259
|
-
|
|
7033
|
+
const head = captured ? rewrite(overrides?.head ?? "") : tailwind;
|
|
7034
|
+
const loadsTailwind = hasTailwindRuntime(head + html);
|
|
7035
|
+
const page = `<!DOCTYPE html>
|
|
6260
7036
|
<html${htmlAttrs}>
|
|
6261
7037
|
<head>
|
|
6262
7038
|
<meta charset="utf-8">
|
|
6263
|
-
${
|
|
7039
|
+
${loadsTailwind ? '<meta name="kombai-tailwind-runtime">' : ""}
|
|
7040
|
+
${STORAGE_STAND_INS_SCRIPT_TAG}
|
|
7041
|
+
${SCREENSHOT_PREP_SCRIPT_TAG}
|
|
7042
|
+
<style>${SCREENSHOT_CSS}</style>
|
|
7043
|
+
${head}
|
|
6264
7044
|
<style>${captured ? "" : FRAGMENT_RESET_CSS}
|
|
6265
7045
|
${ROOT_CSS}</style>
|
|
6266
7046
|
</head>
|
|
6267
7047
|
<body${bodyAttrs}>
|
|
6268
|
-
<div id="root">${rewrite(html)}</div
|
|
7048
|
+
<div id="root">${rewrite(html)}</div>${loadsTailwind ? TAILWIND_PROBE_HTML : ""}
|
|
6269
7049
|
</body>
|
|
6270
7050
|
</html>`;
|
|
7051
|
+
return anchorWidth ? anchorViewportUnits(page, anchorWidth) : page;
|
|
7052
|
+
}
|
|
7053
|
+
function anchorViewportUnits(page, width) {
|
|
7054
|
+
const converted = convertViewportUnits(page, width, INTRINSIC_VIEWPORT_HEIGHT);
|
|
7055
|
+
const sheet = `<style data-screenshot-vh-anchor>${buildViewportUnitOverrideCss(width, INTRINSIC_VIEWPORT_HEIGHT)}</style>`;
|
|
7056
|
+
const headEnd = converted.indexOf("</head>");
|
|
7057
|
+
return headEnd === -1 ? sheet + converted : converted.slice(0, headEnd) + sheet + converted.slice(headEnd);
|
|
6271
7058
|
}
|
|
6272
7059
|
function rewriteImages(text, images) {
|
|
6273
7060
|
let out = text;
|
|
@@ -6276,14 +7063,20 @@ function rewriteImages(text, images) {
|
|
|
6276
7063
|
}
|
|
6277
7064
|
return out;
|
|
6278
7065
|
}
|
|
6279
|
-
var FRAGMENT_RESET_CSS, ROOT_CSS;
|
|
7066
|
+
var FRAGMENT_RESET_CSS, ROOT_CSS, SCREENSHOT_CSS;
|
|
6280
7067
|
var init_page = __esm({
|
|
6281
7068
|
"src/render/page.js"() {
|
|
6282
7069
|
"use strict";
|
|
6283
7070
|
init_define_KOMBAI_TELEMETRY();
|
|
6284
7071
|
init_tailwind_detection();
|
|
7072
|
+
init_tailwind_script();
|
|
7073
|
+
init_convert_viewport_units();
|
|
7074
|
+
init_screenshot_height_metadata();
|
|
7075
|
+
init_prep();
|
|
6285
7076
|
FRAGMENT_RESET_CSS = "html, body { margin: 0; padding: 0; }";
|
|
6286
7077
|
ROOT_CSS = "#root { display: contents; }";
|
|
7078
|
+
SCREENSHOT_CSS = `* { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
|
|
7079
|
+
svg:not([height]) { max-height: 20000px !important; }`;
|
|
6287
7080
|
}
|
|
6288
7081
|
});
|
|
6289
7082
|
|
|
@@ -6614,7 +7407,14 @@ var init_proxy = __esm({
|
|
|
6614
7407
|
});
|
|
6615
7408
|
|
|
6616
7409
|
// src/render/render.js
|
|
6617
|
-
async function openRender(ctx, {
|
|
7410
|
+
async function openRender(ctx, {
|
|
7411
|
+
browserPath,
|
|
7412
|
+
page,
|
|
7413
|
+
deadline,
|
|
7414
|
+
width = DEFAULT_RENDER_WIDTH,
|
|
7415
|
+
viewportHeight = INTRINSIC_VIEWPORT_HEIGHT,
|
|
7416
|
+
readyMs = READY_MS
|
|
7417
|
+
}) {
|
|
6618
7418
|
const started = Date.now();
|
|
6619
7419
|
const limit = deadline.within(RENDER_MS);
|
|
6620
7420
|
const proxy = await startProxy();
|
|
@@ -6667,6 +7467,7 @@ async function openRender(ctx, { browserPath, page, deadline, width = 1440, view
|
|
|
6667
7467
|
const readyAt = Date.now() + readyMs;
|
|
6668
7468
|
await s("Page.navigate", { url: proxy.serve(page) });
|
|
6669
7469
|
const ready = await waitForReady(s, readyAt, SIGNALS.test(page));
|
|
7470
|
+
await s("Runtime.evaluate", { expression: SETTLE, awaitPromise: true });
|
|
6670
7471
|
await s("Runtime.evaluate", {
|
|
6671
7472
|
expression: `(() => { const st = document.createElement('style');
|
|
6672
7473
|
st.textContent = '*,*::before,*::after{animation-play-state:paused!important;transition:none!important;caret-color:transparent!important}';
|
|
@@ -6749,24 +7550,27 @@ async function waitForReady(send, readyAt, willSignal) {
|
|
|
6749
7550
|
const read2 = await by(reading, readyAt);
|
|
6750
7551
|
if (read2 === LATE) return "timeout";
|
|
6751
7552
|
const state = (
|
|
6752
|
-
/** @type {{ signalled?: boolean, declared?: boolean, settled?: boolean }} */
|
|
7553
|
+
/** @type {{ signalled?: boolean, declared?: boolean, settled?: boolean, prepared?: boolean }} */
|
|
6753
7554
|
read2.result?.value ?? {}
|
|
6754
7555
|
);
|
|
6755
|
-
if (state.signalled) return "kombai_ready";
|
|
6756
|
-
if (state.settled && !state.declared && !willSignal) return "fonts_and_images";
|
|
7556
|
+
if (state.signalled && state.prepared) return "kombai_ready";
|
|
7557
|
+
if (state.settled && state.prepared && !state.declared && !willSignal) return "fonts_and_images";
|
|
6757
7558
|
const left = readyAt - Date.now();
|
|
6758
7559
|
if (left <= 0) return "timeout";
|
|
6759
7560
|
await new Promise((resolve) => setTimeout(resolve, Math.min(READY_POLL_MS, left)));
|
|
6760
7561
|
}
|
|
6761
7562
|
}
|
|
6762
|
-
var RENDER_MS, READY_MS, READY_POLL_MS, MAX_HEIGHT, JPEG_MAX_BYTES, PNG_MAX_BYTES, JPEG_QUALITIES, RenderFailure, READY_WATCH, SIGNALS, READY_STATE, LATE;
|
|
7563
|
+
var DEFAULT_RENDER_WIDTH, RENDER_MS, READY_MS, READY_POLL_MS, MAX_HEIGHT, JPEG_MAX_BYTES, PNG_MAX_BYTES, JPEG_QUALITIES, RenderFailure, READY_WATCH, SIGNALS, READY_STATE, SETTLE, LATE;
|
|
6763
7564
|
var init_render = __esm({
|
|
6764
7565
|
"src/render/render.js"() {
|
|
6765
7566
|
"use strict";
|
|
6766
7567
|
init_define_KOMBAI_TELEMETRY();
|
|
7568
|
+
init_screenshot_height_metadata();
|
|
7569
|
+
init_prep();
|
|
6767
7570
|
init_contract();
|
|
6768
7571
|
init_cdp();
|
|
6769
7572
|
init_proxy();
|
|
7573
|
+
DEFAULT_RENDER_WIDTH = 1440;
|
|
6770
7574
|
RENDER_MS = 3e4;
|
|
6771
7575
|
READY_MS = 2e4;
|
|
6772
7576
|
READY_POLL_MS = 100;
|
|
@@ -6798,11 +7602,20 @@ var init_render = __esm({
|
|
|
6798
7602
|
SIGNALS = /KOMBAI_READY|kombai:ready/;
|
|
6799
7603
|
READY_STATE = `(() => {
|
|
6800
7604
|
const state = window.__kombaiRender;
|
|
7605
|
+
const prepared = document.readyState !== 'complete' || Boolean(document.querySelector(${JSON.stringify(SCREENSHOT_READY_SELECTOR)}));
|
|
6801
7606
|
return {
|
|
6802
7607
|
signalled: document.readyState !== 'loading' && (window.KOMBAI_READY === true || Boolean(state && state.event)),
|
|
6803
7608
|
declared: 'KOMBAI_READY' in window,
|
|
6804
7609
|
settled: Boolean(state && state.settled),
|
|
7610
|
+
prepared,
|
|
6805
7611
|
};
|
|
7612
|
+
})()`;
|
|
7613
|
+
SETTLE = `(async () => {
|
|
7614
|
+
const frame = () => new Promise((resolve) => requestAnimationFrame(resolve));
|
|
7615
|
+
${VIDEO_PAUSE_SNIPPET}
|
|
7616
|
+
await frame(); await frame();
|
|
7617
|
+
${WAAPI_FREEZE_SNIPPET}
|
|
7618
|
+
await frame();
|
|
6806
7619
|
})()`;
|
|
6807
7620
|
LATE = Symbol("late");
|
|
6808
7621
|
}
|
|
@@ -6944,7 +7757,12 @@ async function renderOne(ctx, { api, canvasId, screenshotsDir, target, deadline,
|
|
|
6944
7757
|
try {
|
|
6945
7758
|
render = await openRender(ctx, {
|
|
6946
7759
|
browserPath,
|
|
6947
|
-
page: composePage({
|
|
7760
|
+
page: composePage({
|
|
7761
|
+
html: target.html,
|
|
7762
|
+
overrides: target.overrides,
|
|
7763
|
+
images: target.images,
|
|
7764
|
+
anchorWidth: target.height === void 0 ? target.width ?? DEFAULT_RENDER_WIDTH : void 0
|
|
7765
|
+
}),
|
|
6948
7766
|
deadline,
|
|
6949
7767
|
width: target.width,
|
|
6950
7768
|
viewportHeight: target.height
|
|
@@ -7049,10 +7867,12 @@ function targetOf(nodeId, version2, files, images, node) {
|
|
|
7049
7867
|
html: files.html ? text.decode(files.html) : "",
|
|
7050
7868
|
overrides,
|
|
7051
7869
|
images,
|
|
7052
|
-
// Like the canvas's own capture: a node renders at its width, a mobile one at 390 px. A
|
|
7053
|
-
//
|
|
7870
|
+
// Like the canvas's own capture: a node renders at its width, a mobile one at 390 px. A node the canvas shows at
|
|
7871
|
+
// a height of its own renders in a window that tall: a text node, and a design with a set height, which the
|
|
7872
|
+
// canvas shows as a window onto its page (any rect.h above 0). A content-height design loads in the canvas's
|
|
7873
|
+
// measuring window, INTRINSIC_VIEWPORT_HEIGHT, with its viewport units pinned (renderOne, page.js).
|
|
7054
7874
|
width: sizeOf(node?.rect?.w, MIN_WIDTH),
|
|
7055
|
-
height: node?.type === "text" ?
|
|
7875
|
+
height: sizeOf(node?.rect?.h, node?.type === "text" ? MIN_TEXT_HEIGHT : 1)
|
|
7056
7876
|
};
|
|
7057
7877
|
}
|
|
7058
7878
|
function sizeOf(value, min) {
|
|
@@ -7115,15 +7935,19 @@ function layoutPatch(entry, layout, ifVersion, settled = []) {
|
|
|
7115
7935
|
} else if (field === "rect" && settledRect === "all") {
|
|
7116
7936
|
patch.rect = value;
|
|
7117
7937
|
} else if (field === "rect" && isRecord(value) && isRecord(entry.layout.rect)) {
|
|
7118
|
-
const
|
|
7938
|
+
const was2 = entry.layout.rect;
|
|
7119
7939
|
const sides = Object.entries(value).filter(
|
|
7120
|
-
([side, v]) => v !== void 0 && (settledRect.includes(side) || !sameValue(
|
|
7940
|
+
([side, v]) => v !== void 0 && (settledRect.includes(side) || !sameValue(was2[side], v))
|
|
7121
7941
|
);
|
|
7122
7942
|
patch.rect = sides.length ? Object.fromEntries(sides) : value;
|
|
7123
7943
|
} else {
|
|
7124
7944
|
patch[field] = value;
|
|
7125
7945
|
}
|
|
7126
7946
|
}
|
|
7947
|
+
const rect = patch.rect;
|
|
7948
|
+
const was = entry.layout.rect;
|
|
7949
|
+
if (entry.type === "variant" && !fields.has("viewportAuto") && layout.viewportAuto !== false && isRecord(rect) && rect.h !== void 0 && !(isRecord(was) && sameValue(was.h, rect.h)))
|
|
7950
|
+
patch.viewportAuto = false;
|
|
7127
7951
|
return Object.keys(patch).length > 1 ? patch : null;
|
|
7128
7952
|
}
|
|
7129
7953
|
function isRecord(value) {
|
|
@@ -7154,6 +7978,7 @@ async function recordLanded(ctx, paths, base, working, patches, results, seq, sa
|
|
|
7154
7978
|
if (value === null) delete layout[field];
|
|
7155
7979
|
else if (pushedOver && field === "rect" && isRecord(value) && isRecord(layout.rect))
|
|
7156
7980
|
layout.rect = { ...layout.rect, ...value };
|
|
7981
|
+
else if (field === "viewportAuto") layout[field] = value;
|
|
7157
7982
|
else layout[field] = now[field];
|
|
7158
7983
|
}
|
|
7159
7984
|
const filesBehind = saved[nodeId]?.fields.includes("files");
|
|
@@ -31362,7 +32187,7 @@ function toolDescriptors(resourceUri) {
|
|
|
31362
32187
|
{
|
|
31363
32188
|
name: CANVAS_APP_TOOL,
|
|
31364
32189
|
title: "Kombai",
|
|
31365
|
-
description: "Show a Kombai canvas beside this chat. Pass the canvas id (cnv_\u2026) or its link; node is a design id to focus. With no canvas it shows every canvas the person can open when signed in, the guest home to a guest or to someone who never signed in, and asks someone who signed in before to sign in there. Open a canvas once: every canvas_app call opens another tab. The canvas is the live Kombai page, so it shows every change as it lands. Changes go through the work-with-kombai skill's commands, never through this tool.
|
|
32190
|
+
description: "Show a Kombai canvas beside this chat. Pass the canvas id (cnv_\u2026) or its link; node is a design id to focus. With no canvas it shows every canvas the person can open when signed in, the guest home to a guest or to someone who never signed in, and asks someone who signed in before to sign in there. Open a canvas once: every canvas_app call opens another tab. The canvas is the live Kombai page, so it shows every change as it lands. Changes go through the work-with-kombai skill's commands, never through this tool. While it shows the canvas, put no canvas or design link in your replies: name designs by their labels, and give a link only when the person asks for one. Such a link is a Kombai page, which opens in this client's browser, never a Kombai app link.",
|
|
31366
32191
|
inputSchema: {
|
|
31367
32192
|
type: "object",
|
|
31368
32193
|
properties: {
|
|
@@ -33394,7 +34219,7 @@ var init_actions = __esm({
|
|
|
33394
34219
|
var brief_default;
|
|
33395
34220
|
var init_brief = __esm({
|
|
33396
34221
|
"src/skill/brief.md"() {
|
|
33397
|
-
brief_default = '# Writing a taste brief\n\nTaste reads only the brief: it cannot see the repo, the chat or any file. Write everything it needs into\nthe brief, at most 8,000 characters, in a file outside the repo, then pass it to\n`kombai taste start --brief <file> --variants <1-4>`.\n\nGive ground truth, not design advice. Taste\'s job is to bring the design ideas; ideas you add make it\ncopy yours. For "a joyful, light CRM", write "A joyful light-theme CRM application", not "a light CRM\ndashboard with a soft purple gradient".\n\nA brief says:\n\n- What to design, in plain words that name the kind of UI: a pricing section, sign-in, onboarding, a\n dashboard, a data table, an AI chat, an empty state.\n- The scope: a full page, one section, a screen, a multi-screen flow, or one reusable component. For a\n component taste returns lighter options (arrangements, looks, graphic ideas) and no assets.\n- Every fact the design shows: the product and who uses it, the real copy (names, numbers, plans,\n prices, navigation), the content of each section, and the states that matter.\n- What is already decided, from the repo or the user: brand colors, fonts, logo, an existing design\n system (its tokens, copied from tailwind config, globals.css, theme or token files), and what must stay\n as it is. Copy the values; taste cannot open the files.\n- What is still open, only when the user said so: "explore the layout", "keep our colors".\n\nSkip taste when the work copies or reflows a design instead of making a new one: a clone of a page,\nscreenshot or mock the user gave, a build of the repo\'s existing screens, a version of a design for\nanother device or mode, or an edit to part of a design. Then write the HTML straight from the reference\nor the pulled node.\n\nA taste run takes a few minutes. Tell the user it has started, and create and open the canvas while it\nruns. Run `kombai taste wait <run>` in the foreground, one wait at a time: it returns within 90 seconds,\nso while its status is running, tell the user the run is still going, as expected, and wait again.\n\nAfter `kombai taste wait`, follow directions.md: one direction per variant. In it, <stock-image> tags\ndescribe photos and <icon> tags name icons from the library its <icon-library> tag names: put icons in as\ninline SVG from that library, and photos as images, from a public https URL or saved in the repo. Its\nasset links are real; use them as given and never invent one.\n\ndirections.md is written for
|
|
34222
|
+
brief_default = '# Writing a taste brief\n\nTaste reads only the brief: it cannot see the repo, the chat or any file. Write everything it needs into\nthe brief, at most 8,000 characters, in a file outside the repo, then pass it to\n`kombai taste start --brief <file> --variants <1-4>`.\n\nGive ground truth, not design advice. Taste\'s job is to bring the design ideas; ideas you add make it\ncopy yours. For "a joyful, light CRM", write "A joyful light-theme CRM application", not "a light CRM\ndashboard with a soft purple gradient".\n\nA brief says:\n\n- What to design, in plain words that name the kind of UI: a pricing section, sign-in, onboarding, a\n dashboard, a data table, an AI chat, an empty state.\n- The scope: a full page, one section, a screen, a multi-screen flow, or one reusable component. For a\n component taste returns lighter options (arrangements, looks, graphic ideas) and no assets.\n- Every fact the design shows: the product and who uses it, the real copy (names, numbers, plans,\n prices, navigation), the content of each section, and the states that matter.\n- What is already decided, from the repo or the user: brand colors, fonts, logo, an existing design\n system (its tokens, copied from tailwind config, globals.css, theme or token files), and what must stay\n as it is. Copy the values; taste cannot open the files.\n- What is still open, only when the user said so: "explore the layout", "keep our colors".\n\nSkip taste when the work copies or reflows a design instead of making a new one: a clone of a page,\nscreenshot or mock the user gave, a build of the repo\'s existing screens, a version of a design for\nanother device or mode, or an edit to part of a design. Then write the HTML straight from the reference\nor the pulled node.\n\nA taste run takes a few minutes. Tell the user it has started, and create and open the canvas while it\nruns. Run `kombai taste wait <run>` in the foreground, one wait at a time: it returns within 90 seconds,\nso while its status is running, tell the user the run is still going, as expected, and wait again.\n\nAfter `kombai taste wait`, follow directions.md: one direction per variant. In it, <stock-image> tags\ndescribe photos and <icon> tags name icons from the library its <icon-library> tag names: put icons in as\ninline SVG from that library, and photos as images, from a public https URL or saved in the repo. Its\nasset links are real; use them as given and never invent one.\n\ndirections.md is written for a page on a canvas, as Kombai\'s own Design mode writes it. What it asks for\nruns there: scroll-driven motion (parallax, reveal or count-up on scroll, pinning), smooth scrolling\n(Lenis, Locomotive), sticky or fixed elements, and the Sticky Layout Rule it may add, once the design has a\nheight of its own (`kombai skill html`, Size and position). A\n<stock-image> or <stock-video> with no link has no asset: draw it as SVG or leave it out.\n';
|
|
33398
34223
|
}
|
|
33399
34224
|
});
|
|
33400
34225
|
|
|
@@ -33434,7 +34259,7 @@ var init_faq = __esm({
|
|
|
33434
34259
|
var html_default;
|
|
33435
34260
|
var init_html = __esm({
|
|
33436
34261
|
"src/skill/html.md"() {
|
|
33437
|
-
html_default = '# Writing a design\'s HTML\n\nThe file `kombai node start` prints holds one design. The canvas shows it live in a frame, and\n`kombai screenshot fill` renders the thumbnail most viewers see. Write it so both look the same.\n\n## Build in passes\n\nnode start creates the file, empty. Read it right after node start, before your first write, even though\nit is empty: an editor that writes only files it has read refuses the write otherwise, and the page you\nwrote is lost. Push the first pass within 30 minutes of node start, or the placeholder expires.\n\n1. First pass: every section in order, with its layout, headings and real copy.\n2. Each later pass: one or two sections\' art, motion and interactions.\n\nPush after each pass, and only once its write has succeeded: never in the same batch of tool calls as\nthe write. The canvas shows each push live, so the user watches the page fill in. Check the design once,\nafter its last pass ("Check a finished design" in the overview).\n\n## The file\n\n- Body content only: no `<!DOCTYPE>`, `<html>`, `<head>` or `<body>`. The canvas and the thumbnail\n both wrap it in their own page, inside a `<div id="root">`, so `body > \u2026` selectors match nothing.\n- So the file is a fragment, not a web page: opened on its own it looks broken. Never open, preview or\n serve it, and never link or name its path to the user. To point the user at a design, give the `url`\n node start, node pull and node push print for it: the canvas, with that design in focus. A guest\'s
|
|
34262
|
+
html_default = '# Writing a design\'s HTML\n\nThe file `kombai node start` prints holds one design. The canvas shows it live in a frame, and\n`kombai screenshot fill` renders the thumbnail most viewers see. Write it so both look the same.\n\n## Build in passes\n\nnode start creates the file, empty. Read it right after node start, before your first write, even though\nit is empty: an editor that writes only files it has read refuses the write otherwise, and the page you\nwrote is lost. Push the first pass within 30 minutes of node start, or the placeholder expires.\n\n1. First pass: every section in order, with its layout, headings and real copy.\n2. Each later pass: one or two sections\' art, motion and interactions.\n\nPush after each pass, and only once its write has succeeded: never in the same batch of tool calls as\nthe write. The canvas shows each push live, so the user watches the page fill in. Check the design once,\nafter its last pass ("Check a finished design" in the overview).\n\n## The file\n\n- Body content only: no `<!DOCTYPE>`, `<html>`, `<head>` or `<body>`. The canvas and the thumbnail\n both wrap it in their own page, inside a `<div id="root">`, so `body > \u2026` selectors match nothing.\n- So the file is a fragment, not a web page: opened on its own it looks broken. Never open, preview or\n serve it, and never link or name its path to the user. To point the user at a design, give the `url`\n node start, node pull and node push print for it: the canvas, with that design in focus. Where\n `canvas_app` shows the canvas beside the chat, name the design instead, with no link unless the user\n asks for one. A guest\'s `url` is null: point them at the canvas you showed them.\n- Style with Tailwind v4 classes or with your own CSS in a `<style>`. Put every `<style>`, `<link>` and\n library `<script>` at the top of the body. Load Google Fonts with `@import url(\u2026)` as the first line of a\n `<style>`. Set the font, text color and background on your outermost element.\n- Tailwind: add no Tailwind script; Kombai loads Tailwind v4 when the design uses its classes. The canvas\n builds CSS only from classes written in `class="\u2026"`: no config, `@apply`, `@theme` or\n `<style type="text/tailwindcss">`, and a class only a script adds gets no CSS there; write that styling as\n plain CSS in a `<style>`. Use v4 utilities (`bg-black/50`, not `bg-opacity-50`), and CSS variables as\n `bg-(--brand)` or `bg-[var(--brand)]`, never `bg-[--brand]`. On a page with Tailwind classes, style\n no `*` or bare tags in a `<style>`: CSS there beats every Tailwind class.\n- Your own CSS, with no Tailwind classes: the page owns its defaults. Start its `<style>` with a reset\n (margin, padding and box-sizing on `*`) and style headings, lists, links, buttons and images yourself,\n so the page looks the same whether or not Tailwind is loaded. Don\'t name classes like Tailwind\n utilities (`flex`, `hidden`, `text-center`, `p-4`): the canvas may take the page for Tailwind.\n- Define every `@keyframes` you use.\n- `kombai node push` writes a `data-kid="\u2026"` id onto each element of a changed file before it sends it: the id\n the canvas and the user\'s requests name an element by. Read the file again before your next pass to get them.\n Keep the ids when you edit; give a new element none, the next push numbers it.\n\n## Size and position\n\n- A design is 1280 px wide. `--viewport mobile`, `--viewport tablet` or `--viewport desktop` on\n `kombai node start` makes it 390, 768 or 1280. Design for that width: one design per device, not one\n with breakpoints.\n- A design is content height unless you give it a height: its frame is as tall as its page and never\n scrolls. So:\n - Give heights in px (`h-[720px]`, `min-height: 640px`). `h-screen`, `min-h-screen` and `100vh` come out\n 1000 px tall, on the canvas and in the thumbnail.\n - Do not size anything from `window.innerHeight`: on the canvas it is the whole page\'s height.\n- What needs the page to scroll needs a design with a height of its own: scroll-driven effects (scroll\n listeners, parallax, pinned or scrubbed sections, GSAP ScrollTrigger), `sticky` and `fixed` elements, and\n smooth scrolling (Lenis, Locomotive). At content height nothing scrolls, so none of them run: a pinned\n section\'s runway shows as empty space, a sticky element never sticks, and a fixed bottom bar lands 1000 px\n down, mid-page; selected, the canvas shows a page that pins in a device-height window it cannot scroll.\n So after the first push, set the design\'s `rect.h` in canvas.json to its device height (desktop 800,\n tablet 1024, mobile 812) and run `kombai canvas push --canvas <id>`. Selected, it then scrolls inside that\n window and all of these run as on a real page. A reveal that only waits to come into view\n (IntersectionObserver) needs no height: it runs as the viewer pans to it.\n- The thumbnail scrolls the page through once and settles its animations, so it shows the page as a\n visitor who scrolled to the bottom left it: every reveal shown, pinned sections and parallax layers at\n their end, no runway. It takes scrubbed animations at their end too, so an element that fades or slides\n out as the page scrolls is missing from it: animate things in, not out. A design with a height gets the\n whole page as its thumbnail, seen through its window: a sticky element shows where it starts, and a fixed\n one where it sits on the first screen, so a bar fixed to the bottom shows at that screen\'s foot, mid-page.\n- The thumbnail stops at 16,000 px.\n\n## Scripts\n\n- Load each library from a CDN with its own `<script src>` and a pinned version: Chart.js for charts,\n GSAP or Motion for animation. Only public https hosts load.\n- The thumbnail renders with reduced motion. It scrolls the page through, runs GSAP, ScrollTrigger, anime\n and Web Animations to their end, pauses CSS animations and video, and is taken once fonts and images\n are in. The page must look finished by then:\n - Chart.js: `options: { animation: false }`.\n - CSS entrance animations: behind `motion-safe:` or `@media (prefers-reduced-motion: no-preference)`.\n - A page that fills in late (JS entrance animations, content a script draws) sets\n `window.KOMBAI_READY = false` at the top, and `true` when done (or dispatches a `kombai:ready`\n event on window). The thumbnail waits up to 20 s, then takes the page as it is. A page whose text\n names either is waited for, so name them only if you signal.\n\n## Images and video\n\n- Repo files: `/api/local/images/<path from the repo root>`, in src, srcset, poster or CSS `url()`.\n `kombai node push` uploads each one: png, jpg, jpeg, webp, gif, svg, mp4 or webm, up to 20 MB, at\n most 100 per design. Write each path in full, with spaces as `%20`; a path a script builds is not\n uploaded.\n- A file outside the repo, such as an image you generated: `kombai asset push <file> --canvas <id>`\n prints its url. Use that url.\n- Stock photos: use the links directions.md gives, with size params added. images.unsplash.com:\n `?auto=format&w=<px>&q=80&fit=crop`. images.pexels.com: `?auto=compress&cs=tinysrgb&w=<px>&q=80`.\n The bare link is the full-size original.\n- Icons: inline SVG from the library directions.md names.\n- `<img decoding="async" alt="\u2026">`. `loading="lazy"` is fine: the thumbnail loads every image first.\n- Video: `<video src="\u2026" poster="\u2026" autoplay muted loop playsinline preload="metadata">`. Always set a\n poster: it shows until the video plays. Drop autoplay and loop only for click-to-play, such as a\n walkthrough.\n- Every other URL is absolute and public https: relative paths do not resolve, and the thumbnail\n refuses localhost and private addresses.\n- Never invent an image URL.\n\n## Content\n\n- Real copy from the brief and the repo: real names, numbers and dates. No lorem ipsum. No text for the\n reviewer: no design notes, captions explaining the layout, or "click to see".\n- Plain section headings, as a product\'s UI would have them: "Plans", "Details", "Team", not "What it\n costs", "How it works" or "Who is on site this week".\n- One page or screen per design; a modal or drawer is its own design. For a component, design only\n it, on a plain background.\n- Give each meaningful element a `data-name` saying what it is ("pricing card", "hero headline"): the\n canvas editor shows it.\n- No `dark:` classes or `prefers-color-scheme` queries: they follow the viewer\'s theme, so the canvas and\n the thumbnail can differ. A dark version is its own design.\n\n## Patterns to avoid, unless asked\n\n- Drop shadows on cards; gradient-filled headline text.\n- The stock hero: headline, image, two buttons, badges.\n- Three icon-topped cards in a row; plain pricing, testimonial or two-row stat cards.\n- A footer of only links and a logo; a form or call-out as one big card.\n- Fade-in on appear and lift on hover as the only motion; buttons with the usual radius and hover.\n';
|
|
33438
34263
|
}
|
|
33439
34264
|
});
|
|
33440
34265
|
|
|
@@ -33442,7 +34267,7 @@ var init_html = __esm({
|
|
|
33442
34267
|
var opening_default;
|
|
33443
34268
|
var init_opening = __esm({
|
|
33444
34269
|
"src/skill/opening.md"() {
|
|
33445
|
-
opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is listed** (the Kombai view): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each\n call opens another view. Make changes with the commands, never through the view.\n2. **You have a browser panel of your own**: `kombai canvas url --canvas <id> --in-app` prints a signed-in\n link. Open it in your panel. It works once, within 10 minutes; for a later visit, run it again.\n3. **Otherwise**: `kombai canvas open --canvas <id>` opens the canvas in the user's browser, signed in.\n If it answers opened: false (no browser on this machine), give the user the link it printed instead.\n\nTo point the user at one design, give the `url` node start, node pull or node push printed for it, or\nadd ?node=<node> to the canvas link. Never the design's .html file, and never a link that holds a\n#ticket=; it signs in whoever opens it first.\n\n**A new canvas is private.** When you give the user a link, don't suggest they send it to anyone before sharing it.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it and teammates can edit it.\n";
|
|
34270
|
+
opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is listed** (the Kombai view): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each\n call opens another view. Make changes with the commands, never through the view.\n2. **You have a browser panel of your own**: `kombai canvas url --canvas <id> --in-app` prints a signed-in\n link. Open it in your panel. It works once, within 10 minutes; for a later visit, run it again.\n3. **Otherwise**: `kombai canvas open --canvas <id>` opens the canvas in the user's browser, signed in.\n If it answers opened: false (no browser on this machine), give the user the link it printed instead.\n\nTo point the user at one design, give the `url` node start, node pull or node push printed for it, or\nadd ?node=<node> to the canvas link. Never the design's .html file, and never a link that holds a\n#ticket=; it signs in whoever opens it first.\n\n**Beside the chat, no links.** Once `canvas_app` shows the canvas, the user watches every change there.\nEnd with a short line on what you made or changed, naming designs by their labels. Put no canvas or\ndesign link in your replies, and don't ask the user to open the canvas. Give a link only when the user\nasks for one.\n\n**A new canvas is private.** When you give the user a link, don't suggest they send it to anyone before sharing it.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it and teammates can edit it.\n";
|
|
33446
34271
|
}
|
|
33447
34272
|
});
|
|
33448
34273
|
|
|
@@ -35104,7 +35929,7 @@ var init_commands = __esm({
|
|
|
35104
35929
|
});
|
|
35105
35930
|
|
|
35106
35931
|
// src/lib/app-skills.js
|
|
35107
|
-
import { access, readdir, rm } from "node:fs/promises";
|
|
35932
|
+
import { access, lstat, readdir, rm } from "node:fs/promises";
|
|
35108
35933
|
import path23 from "node:path";
|
|
35109
35934
|
function appSkillDirsOf(home, env) {
|
|
35110
35935
|
const dirs = [
|
|
@@ -35157,10 +35982,16 @@ async function removeIfApps(folder) {
|
|
|
35157
35982
|
} catch (error2) {
|
|
35158
35983
|
return isAbsent(error2);
|
|
35159
35984
|
}
|
|
35160
|
-
|
|
35161
|
-
()
|
|
35162
|
-
|
|
35163
|
-
|
|
35985
|
+
try {
|
|
35986
|
+
if ((await lstat(folder)).isDirectory()) {
|
|
35987
|
+
const names = (await readdir(folder)).filter((name) => name !== APP_MARKER);
|
|
35988
|
+
await Promise.all(names.map((name) => rm(path23.join(folder, name), { recursive: true, force: true })));
|
|
35989
|
+
}
|
|
35990
|
+
await rm(folder, { recursive: true, force: true });
|
|
35991
|
+
return true;
|
|
35992
|
+
} catch {
|
|
35993
|
+
return false;
|
|
35994
|
+
}
|
|
35164
35995
|
}
|
|
35165
35996
|
function isAbsent(error2) {
|
|
35166
35997
|
return isErrno(error2, "ENOENT") || isErrno(error2, "ENOTDIR");
|
package/package.json
CHANGED