샘플
@xterm/addon-fit 0.10.0: FitAddon.proposeDimensions
검증된 샘플 — npm @xterm/addon-fit 0.10.0: FitAddon.proposeDimensions. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다…
sha256:58d2fde9c7f4e7a0201caacb696fa427fb31853ed3f9d4b9f61d9e598e9d3bce
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-07 |
케이스
HOW- 목표
- verify FitAddon.proposeDimensions in pkg:npm/%40xterm/addon-fit@0.10.0
- 심벌
-
- FitAddon.proposeDimensions
- 생성일
- 2026-08-26T01:13:48Z
컨트랙트
- FitAddon.prototype.proposeDimensions is a function
- proposeDimensions returns undefined when addon is not activated with a terminal
- proposeDimensions returns undefined when terminal element or parentElement is missing
- proposeDimensions returns undefined when renderService cell dimensions are zero
- proposeDimensions calculates cols and rows from parent element dimensions and cell size
- proposeDimensions accounts for terminal element padding and scrollbar width when scrollback is enabled
- proposeDimensions ignores scrollbar width when scrollback is zero
- proposeDimensions enforces minimum bounds of 2 columns and 1 row
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify FitAddon.proposeDimensions in pkg:npm/%40xterm/addon-fit@0.10.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40xterm/addon-fit@0.10.0
Demonstrate these symbols/APIs:
- FitAddon.proposeDimensions
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:42e9b0eddfd2ca8fe0f11bddbde43555487ec19f0f7e2e1ca3de3d062128e481","contract":["FitAddon.prototype.proposeDimensions is a function","proposeDimensions returns undefined when addon is not activated with a terminal","proposeDimensions returns undefined when terminal element or parentElement is missing","proposeDimensions returns undefined when renderService cell dimensions are zero","proposeDimensions calculates cols and rows from parent element dimensions and cell size","proposeDimensions accounts for terminal element padding and scrollbar width when scrollback is enabled","proposeDimensions ignores scrollbar width when scrollback is zero","proposeDimensions enforces minimum bounds of 2 columns and 1 row"],"goal":"verify FitAddon.proposeDimensions in pkg:npm/%40xterm/addon-fit@0.10.0","kind":"HOW","packages":["pkg:npm/%40xterm/addon-fit@0.10.0"],"schemaVersion":1,"symbols":["FitAddon.proposeDimensions"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40xterm/addon-fit@0.10.0"],"schemaVersion":1,"subject":"pkg:npm/%40xterm/addon-fit@0.10.0","symbols":["FitAddon.proposeDimensions"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-addon-fit-propose-dimensions",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-addon-fit-propose-dimensions",
"version": "1.0.0",
"dependencies": {
"@xterm/addon-fit": "0.10.0"
}
},
"node_modules/@xterm/addon-fit": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/@xterm/addon-fit/-/addon-fit-0.10.0.tgz",
"integrity": "sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ==",
"license": "MIT",
"peerDependencies": {
"@xterm/xterm": "^5.0.0"
}
},
"node_modules/@xterm/xterm": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/@xterm/xterm/-/xterm-5.5.0.tgz",
"integrity": "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==",
"license": "MIT",
"peer": true
}
}
}
{
"name": "sample-addon-fit-propose-dimensions",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"@xterm/addon-fit": "0.10.0"
}
}
{
"schemaVersion": 1,
"goal": "verify FitAddon.proposeDimensions in pkg:npm/%40xterm/addon-fit@0.10.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40xterm/addon-fit@0.10.0"
],
"symbols": [
"FitAddon.proposeDimensions"
]
}
import assert from 'node:assert/strict';
// Node.js compatibility: @xterm/addon-fit expects global `self` and `window`
globalThis.self = globalThis;
// Dynamic import ensures globalThis.self is defined before evaluating addon-fit module
const { FitAddon } = await import('@xterm/addon-fit');
// 1. FitAddon.prototype.proposeDimensions is a function
const fitAddon = new FitAddon();
assert.equal(typeof fitAddon.proposeDimensions, 'function');
// 2. proposeDimensions returns undefined when addon is not activated with a terminal
assert.equal(fitAddon.proposeDimensions(), undefined);
// 3. proposeDimensions returns undefined when terminal element or parentElement is missing
const unattachedTerminal = {
element: null,
options: { scrollback: 1000 },
_core: {}
};
fitAddon.activate(unattachedTerminal);
assert.equal(fitAddon.proposeDimensions(), undefined);
const terminalWithoutParent = {
element: {},
options: { scrollback: 1000 },
_core: {}
};
fitAddon.activate(terminalWithoutParent);
assert.equal(fitAddon.proposeDimensions(), undefined);
// 4. proposeDimensions returns undefined when renderService cell dimensions are zero
const parentElement = {};
const terminalElement = { parentElement };
const terminalWithZeroCell = {
element: terminalElement,
options: { scrollback: 1000 },
_core: {
_renderService: {
dimensions: {
css: {
cell: { width: 0, height: 17 }
}
}
},
viewport: { scrollBarWidth: 15 }
}
};
globalThis.window = {
getComputedStyle: () => ({
getPropertyValue: () => '100px'
})
};
fitAddon.activate(terminalWithZeroCell);
assert.equal(fitAddon.proposeDimensions(), undefined);
// 5. proposeDimensions calculates cols and rows from parent element dimensions and cell size
const mockTerminal = {
element: terminalElement,
options: { scrollback: 1000 },
_core: {
_renderService: {
dimensions: {
css: {
cell: { width: 10, height: 20 }
}
}
},
viewport: { scrollBarWidth: 15 }
}
};
globalThis.window = {
getComputedStyle: (el) => {
if (el === parentElement) {
return {
getPropertyValue: (prop) => {
if (prop === 'width') return '815px'; // 815 - 0 padding - 15 scrollbar = 800 -> 800 / 10 = 80 cols
if (prop === 'height') return '500px'; // 500 - 0 padding = 500 -> 500 / 20 = 25 rows
return '0px';
}
};
}
if (el === terminalElement) {
return {
getPropertyValue: () => '0px'
};
}
return { getPropertyValue: () => '0px' };
}
};
fitAddon.activate(mockTerminal);
const dims1 = fitAddon.proposeDimensions();
assert.deepEqual(dims1, { cols: 80, rows: 25 });
// 6. proposeDimensions accounts for terminal element padding and scrollbar width when scrollback is enabled
globalThis.window = {
getComputedStyle: (el) => {
if (el === parentElement) {
return {
getPropertyValue: (prop) => {
if (prop === 'width') return '1000px';
if (prop === 'height') return '600px';
return '0px';
}
};
}
if (el === terminalElement) {
return {
getPropertyValue: (prop) => {
if (prop === 'padding-left') return '10px';
if (prop === 'padding-right') return '15px';
if (prop === 'padding-top') return '20px';
if (prop === 'padding-bottom') return '20px';
return '0px';
}
};
}
return { getPropertyValue: () => '0px' };
}
};
// availableWidth = 1000 - (10 + 15) - 15 = 960 -> 960 / 10 = 96 cols
// availableHeight = 600 - (20 + 20) = 560 -> 560 / 20 = 28 rows
const dims2 = fitAddon.proposeDimensions();
assert.deepEqual(dims2, { cols: 96, rows: 28 });
// 7. proposeDimensions ignores scrollbar width when scrollback is zero
mockTerminal.options.scrollback = 0;
// availableWidth = 1000 - (10 + 15) - 0 = 975 -> 975 / 10 = 97 cols (Math.floor(97.5))
// availableHeight = 600 - 40 = 560 -> 560 / 20 = 28 rows
const dims3 = fitAddon.proposeDimensions();
assert.deepEqual(dims3, { cols: 97, rows: 28 });
// 8. proposeDimensions enforces minimum bounds of 2 columns and 1 row
globalThis.window = {
getComputedStyle: () => ({
getPropertyValue: () => '0px'
})
};
const dimsMin = fitAddon.proposeDimensions();
assert.deepEqual(dimsMin, { cols: 2, rows: 1 });
console.log('All FitAddon.proposeDimensions contract tests passed.');
오리진 시더
익명