サンプル
prosemirror-menu 1.3.2
検証済みサンプル — npm prosemirror-menu 1.3.2. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: MenuItem constructor instantiates menu items with run…
sha256:185f7ca4b32546d053e6cc0eacd71b1d9bf43619d381e115fb5fdf4c9ee51d34
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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-15 |
ケース
HOW- ゴール
- verify pkg:npm/prosemirror-menu@1.3.2
- パッケージ
- 作成日
- 2026-09-15T03:07:55Z
コントラクト
- MenuItem constructor instantiates menu items with run command, label, title, and state predicate specs
- MenuItem render throws RangeError when neither icon, label, nor custom render function is configured
- MenuItem render with custom render function returns dom element and updates active, disabled, and display states
- Standard editor icons provide SVG path or text display specifications with positive dimensions
- Built-in command items joinUpItem, liftItem, selectParentNodeItem, undoItem, and redoItem are pre-configured MenuItem instances
- wrapItem creates MenuItem configured with wrapIn command and selection predicate for target NodeType
- blockTypeItem creates MenuItem configured with setBlockType command and active state check for target NodeType
- Dropdown and DropdownSubmenu instantiate collapsible menu elements wrapping item lists
- menuBar returns a ProseMirror Plugin instance configuring editor menu bar view
ファイル
- PROMPT.md
- csx.json
- index.mjs
- 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 pkg:npm/prosemirror-menu@1.3.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/prosemirror-menu@1.3.2
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:9043c81194798630a8439fa0bb902e982c2cd6b78fc4a36a28d380a2cc3cb9da","contract":["MenuItem constructor instantiates menu items with run command, label, title, and state predicate specs","MenuItem render throws RangeError when neither icon, label, nor custom render function is configured","MenuItem render with custom render function returns dom element and updates active, disabled, and display states","Standard editor icons provide SVG path or text display specifications with positive dimensions","Built-in command items joinUpItem, liftItem, selectParentNodeItem, undoItem, and redoItem are pre-configured MenuItem instances","wrapItem creates MenuItem configured with wrapIn command and selection predicate for target NodeType","blockTypeItem creates MenuItem configured with setBlockType command and active state check for target NodeType","Dropdown and DropdownSubmenu instantiate collapsible menu elements wrapping item lists","menuBar returns a ProseMirror Plugin instance configuring editor menu bar view"],"goal":"verify pkg:npm/prosemirror-menu@1.3.2","kind":"HOW","packages":["pkg:npm/prosemirror-menu@1.3.2"],"schemaVersion":1},"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/prosemirror-menu@1.3.2"],"schemaVersion":1,"subject":"pkg:npm/prosemirror-menu@1.3.2","verifierAdapter":"node-typescript@1"}
export {
MenuItem,
Dropdown,
DropdownSubmenu,
menuBar,
icons,
joinUpItem,
liftItem,
selectParentNodeItem,
undoItem,
redoItem,
wrapItem,
blockTypeItem,
renderGrouped
} from 'prosemirror-menu';
{
"name": "sample-prosemirror-menu-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-prosemirror-menu-verify",
"version": "1.0.0",
"dependencies": {
"prosemirror-menu": "1.3.2"
}
},
"node_modules/crelt": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.7.tgz",
"integrity": "sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA==",
"license": "MIT"
},
"node_modules/orderedmap": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz",
"integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==",
"license": "MIT"
},
"node_modules/prosemirror-commands": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.7.2.tgz",
"integrity": "sha512-q6Q6szxqdu9Xd6EcdKsqXghu5nQdZTpB4Q9yd04WRc7/jt763e/rT60Owh0L1GYY+T46o5rD+9lEN36dZS43tw==",
"license": "MIT",
"dependencies": {
"prosemirror-model": "^1.0.0",
"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.10.2"
}
},
"node_modules/prosemirror-history": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.5.0.tgz",
"integrity": "sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==",
"license": "MIT",
"dependencies": {
"prosemirror-state": "^1.2.2",
"prosemirror-transform": "^1.0.0",
"prosemirror-view": "^1.31.0",
"rope-sequence": "^1.3.0"
}
},
"node_modules/prosemirror-menu": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/prosemirror-menu/-/prosemirror-menu-1.3.2.tgz",
"integrity": "sha512-6VgUJTYod0nMBlCaYJGhXGLu7Gt4AvcwcOq0YfJCY/6Uh+3S7UsWhpy6rJFCBFOmonq1hD8KyWOtZhkppd4YPg==",
"license": "MIT",
"dependencies": {
"crelt": "^1.0.0",
"prosemirror-commands": "^1.0.0",
"prosemirror-history": "^1.0.0",
"prosemirror-state": "^1.0.0"
}
},
"node_modules/prosemirror-model": {
"version": "1.25.11",
"resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.11.tgz",
"integrity": "sha512-QWg9RhnpLlogAmp3p96uEFrE5txQpFynd4vhBAELkwgOCWQs/X0yCzB3/hrHqiPwf91RG5KyWq6553zs9JqIOQ==",
"license": "MIT",
"dependencies": {
"orderedmap": "^2.0.0"
}
},
"node_modules/prosemirror-state": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.4.tgz",
"integrity": "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==",
"license": "MIT",
"dependencies": {
"prosemirror-model": "^1.0.0",
"prosemirror-transform": "^1.0.0",
"prosemirror-view": "^1.27.0"
}
},
"node_modules/prosemirror-transform": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.12.1.tgz",
"integrity": "sha512-t4F5615FycnCqsX7ShTUs8+jfnwcf46kuFRvSl/3qFx2QTZ4DjgowesLHQXcFP7G//TjesqZG3WtgL7vdyVJyA==",
"license": "MIT",
"dependencies": {
"prosemirror-model": "^1.21.0"
}
},
"node_modules/prosemirror-view": {
"version": "1.42.3",
"resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.42.3.tgz",
"integrity": "sha512-oTN7EtH+CpwxU9NrwEYWd0UZ4JUx7l048l5A2Xppm4p/60isZYLnth9QVQmC3VRIvdrIWCxwZSd+Uz791G31/w==",
"license": "MIT",
"dependencies": {
"prosemirror-model": "^1.25.8",
"prosemirror-state": "^1.0.0",
"prosemirror-transform": "^1.1.0"
}
},
"node_modules/rope-sequence": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz",
"integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==",
"license": "MIT"
}
}
}
{
"name": "sample-prosemirror-menu-verify",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"prosemirror-menu": "1.3.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/prosemirror-menu@1.3.2",
"kind": "HOW",
"packages": [
"pkg:npm/prosemirror-menu@1.3.2"
]
}
import assert from 'node:assert/strict';
import {
MenuItem,
Dropdown,
DropdownSubmenu,
menuBar,
icons,
joinUpItem,
liftItem,
selectParentNodeItem,
undoItem,
redoItem,
wrapItem,
blockTypeItem,
} from '../index.mjs';
// 1. MenuItem constructor instantiates menu items with run command, label, title, and state predicate specs
{
let executed = false;
const spec = {
label: 'Bold',
title: 'Toggle bold formatting',
class: 'menu-bold-btn',
run(state, dispatch, view) {
executed = true;
},
select(state) {
return true;
},
enable(state) {
return true;
},
active(state) {
return false;
}
};
const item = new MenuItem(spec);
assert.ok(item instanceof MenuItem, 'item should be an instance of MenuItem');
assert.strictEqual(item.spec.label, 'Bold');
assert.strictEqual(item.spec.title, 'Toggle bold formatting');
assert.strictEqual(item.spec.class, 'menu-bold-btn');
assert.strictEqual(typeof item.spec.run, 'function');
assert.strictEqual(typeof item.spec.select, 'function');
assert.strictEqual(typeof item.spec.enable, 'function');
assert.strictEqual(typeof item.spec.active, 'function');
item.spec.run(null, null, null);
assert.strictEqual(executed, true, 'run function should execute when invoked');
}
// 2. MenuItem render throws RangeError when neither icon, label, nor custom render function is configured
{
const item = new MenuItem({
run() {}
});
assert.throws(
() => item.render({}),
{
name: 'RangeError',
message: /MenuItem without icon or label property/
},
'render should throw RangeError when missing display specification'
);
}
// 3. MenuItem render with custom render function returns dom element and updates active, disabled, and display states
{
const attributes = new Map();
const classes = new Set();
const mockDom = {
style: { display: '' },
classList: {
add(cls) { classes.add(cls); },
remove(cls) { classes.delete(cls); },
contains(cls) { return classes.has(cls); }
},
setAttribute(k, v) { attributes.set(k, String(v)); },
getAttribute(k) { return attributes.get(k); },
addEventListener() {}
};
let isSelected = true;
let isEnabled = true;
let isActive = false;
const item = new MenuItem({
run() {},
render(view) {
return mockDom;
},
select(state) {
return isSelected;
},
enable(state) {
return isEnabled;
},
active(state) {
return isActive;
}
});
const rendered = item.render({});
assert.strictEqual(rendered.dom, mockDom, 'rendered.dom should match returned element');
assert.strictEqual(typeof rendered.update, 'function', 'update should be a function');
// Initial state: selected=true, enabled=true, active=false
const res1 = rendered.update({});
assert.strictEqual(res1, true);
assert.strictEqual(mockDom.style.display, '');
assert.strictEqual(classes.has('ProseMirror-menu-disabled'), false);
assert.strictEqual(attributes.get('aria-disabled'), 'false');
assert.strictEqual(classes.has('ProseMirror-menu-active'), false);
assert.strictEqual(attributes.get('aria-pressed'), 'false');
// Update state: active=true
isActive = true;
rendered.update({});
assert.strictEqual(classes.has('ProseMirror-menu-active'), true);
assert.strictEqual(attributes.get('aria-pressed'), 'true');
// Update state: enabled=false
isEnabled = false;
rendered.update({});
assert.strictEqual(classes.has('ProseMirror-menu-disabled'), true);
assert.strictEqual(attributes.get('aria-disabled'), 'true');
assert.strictEqual(classes.has('ProseMirror-menu-active'), false); // active requires enabled
// Update state: selected=false (should hide element and return false)
isSelected = false;
const res2 = rendered.update({});
assert.strictEqual(res2, false);
assert.strictEqual(mockDom.style.display, 'none');
}
// 4. Standard editor icons provide SVG path or text display specifications with positive dimensions
{
const svgIconNames = [
'join', 'lift', 'undo', 'redo',
'strong', 'em', 'code', 'link', 'bulletList', 'orderedList', 'blockquote'
];
assert.ok(icons && typeof icons === 'object', 'icons should be an export object');
for (const name of svgIconNames) {
const icon = icons[name];
assert.ok(icon, `icon "${name}" must be defined`);
assert.strictEqual(typeof icon.path, 'string', `icon "${name}".path must be a string`);
assert.ok(icon.path.length > 0, `icon "${name}".path must not be empty`);
assert.strictEqual(typeof icon.width, 'number', `icon "${name}".width must be a number`);
assert.ok(icon.width > 0, `icon "${name}".width must be positive`);
assert.strictEqual(typeof icon.height, 'number', `icon "${name}".height must be a number`);
assert.ok(icon.height > 0, `icon "${name}".height must be positive`);
}
const selectNodeIcon = icons.selectParentNode;
assert.ok(selectNodeIcon, 'selectParentNode icon must be defined');
assert.strictEqual(typeof selectNodeIcon.text, 'string', 'selectParentNode.text must be string');
assert.ok(selectNodeIcon.text.length > 0, 'selectParentNode.text must not be empty');
assert.strictEqual(typeof selectNodeIcon.css, 'string', 'selectParentNode.css must be string');
}
// 5. Built-in command items joinUpItem, liftItem, selectParentNodeItem, undoItem, and redoItem are pre-configured MenuItem instances
{
const builtins = [
{ item: joinUpItem, title: 'Join with above block', icon: icons.join },
{ item: liftItem, title: 'Lift out of enclosing block', icon: icons.lift },
{ item: selectParentNodeItem, title: 'Select parent node', icon: icons.selectParentNode },
{ item: undoItem, title: 'Undo last change', icon: icons.undo },
{ item: redoItem, title: 'Redo last undone change', icon: icons.redo },
];
for (const { item, title, icon } of builtins) {
assert.ok(item instanceof MenuItem, `${title} should be a MenuItem instance`);
assert.strictEqual(item.spec.title, title);
assert.strictEqual(item.spec.icon, icon);
assert.strictEqual(typeof item.spec.run, 'function');
}
}
// 6. wrapItem creates MenuItem configured with wrapIn command and selection predicate for target NodeType
{
const fakeNodeType = { name: 'blockquote' };
const item = wrapItem(fakeNodeType, {
title: 'Wrap in blockquote',
class: 'wrap-quote'
});
assert.ok(item instanceof MenuItem, 'wrapItem must return a MenuItem instance');
assert.strictEqual(item.spec.title, 'Wrap in blockquote');
assert.strictEqual(item.spec.class, 'wrap-quote');
assert.strictEqual(typeof item.spec.run, 'function');
assert.strictEqual(typeof item.spec.select, 'function');
}
// 7. blockTypeItem creates MenuItem configured with setBlockType command and active state check for target NodeType
{
const fakeNodeType = { name: 'heading' };
const item = blockTypeItem(fakeNodeType, {
title: 'Heading 1',
attrs: { level: 1 }
});
assert.ok(item instanceof MenuItem, 'blockTypeItem must return a MenuItem instance');
assert.strictEqual(item.spec.title, 'Heading 1');
assert.deepStrictEqual(item.spec.attrs, { level: 1 });
assert.strictEqual(typeof item.spec.run, 'function');
assert.strictEqual(typeof item.spec.enable, 'function');
assert.strictEqual(typeof item.spec.active, 'function');
}
// 8. Dropdown and DropdownSubmenu instantiate collapsible menu elements wrapping item lists
{
const subItem = new MenuItem({ label: 'Option A', run() {} });
const submenu = new DropdownSubmenu([subItem], { label: 'More' });
assert.ok(submenu instanceof DropdownSubmenu, 'DropdownSubmenu should instantiate');
assert.strictEqual(submenu.content.length, 1);
assert.strictEqual(submenu.options.label, 'More');
const dropdown = new Dropdown([joinUpItem, liftItem, submenu], {
label: 'Format',
title: 'Formatting options',
class: 'format-menu'
});
assert.ok(dropdown instanceof Dropdown, 'Dropdown should instantiate');
assert.strictEqual(dropdown.content.length, 3);
assert.strictEqual(dropdown.options.label, 'Format');
assert.strictEqual(dropdown.options.title, 'Formatting options');
assert.strictEqual(dropdown.options.class, 'format-menu');
}
// 9. menuBar returns a ProseMirror Plugin instance configuring editor menu bar view
{
const plugin = menuBar({
content: [[joinUpItem, liftItem]],
position: 'before',
floating: true
});
assert.ok(plugin, 'menuBar should return a plugin object');
assert.strictEqual(typeof plugin.spec.view, 'function', 'Plugin should configure a view method');
}
console.log('All prosemirror-menu contract assertions passed.');
オリジンシーダー
匿名