diff --git a/src/common/markedText.test.ts b/src/common/markedText.test.ts new file mode 100644 index 0000000..5d3c09a --- /dev/null +++ b/src/common/markedText.test.ts @@ -0,0 +1,33 @@ +import { describe, expect, it } from "vitest"; +import { parseMarkedText } from "./markedText"; + +describe("parseMarkedText", () => { + it("cuts a text where it marks names, values and controls", () => { + expect(parseMarkedText("Turn {Start} [ON] and press .")).toEqual([ + { type: "text", text: "Turn " }, + { type: "name", name: "Start" }, + { type: "text", text: " " }, + { type: "value", value: [true], notation: "onOff" }, + { type: "text", text: " and press " }, + { type: "control", control: "check" }, + { type: "text", text: "." }, + ]); + }); + + it("reads a value of 0s and 1s bit by bit", () => { + expect(parseMarkedText("[0011]")).toEqual([ + { + type: "value", + value: [false, false, true, true], + notation: "digits", + }, + ]); + }); + + it.each(["", "[2]", "{Start", "Start}"])( + "refuses a mark it does not know: %s", + (text) => { + expect(() => parseMarkedText(text)).toThrow(); + }, + ); +}); diff --git a/src/tutorial/stageText.ts b/src/common/markedText.ts similarity index 66% rename from src/tutorial/stageText.ts rename to src/common/markedText.ts index 1cd9870..fd3fae2 100644 --- a/src/tutorial/stageText.ts +++ b/src/common/markedText.ts @@ -1,11 +1,13 @@ -import type { BitNotation } from "../common/bitLabel"; import type { SimulationValue } from "../store/simulation"; +import type { BitNotation } from "./bitLabel"; -/** Things on the screen a stage text points at, drawn as they look there */ -export const stageTextControls = [ +/** Things on the screen a text points at, drawn as they look there */ +export const markedTextControls = [ "check", "constApply", "pinApply", + "pinAdd", + "pinRemove", "auto", "play", "edit", @@ -13,20 +15,20 @@ export const stageTextControls = [ "nextStep", "enter", ] as const; -export type StageTextControl = (typeof stageTextControls)[number]; +export type MarkedTextControl = (typeof markedTextControls)[number]; -export type StageTextSegment = +export type MarkedTextSegment = | { type: "text"; text: string } /** a pin or a part, by the name the editor shows */ | { type: "name"; name: string } | { type: "value"; value: SimulationValue; notation: BitNotation } - | { type: "control"; control: StageTextControl }; + | { type: "control"; control: MarkedTextControl }; -function isControl(key: string): key is StageTextControl { - return stageTextControls.some((control) => control === key); +function isControl(key: string): key is MarkedTextControl { + return markedTextControls.some((control) => control === key); } -function parseValue(token: string): StageTextSegment { +function parseValue(token: string): MarkedTextSegment { if (token === "ON" || token === "OFF") { return { type: "value", value: [token === "ON"], notation: "onOff" }; } @@ -43,12 +45,12 @@ function parseValue(token: string): StageTextSegment { const markup = /\{([^{}]+)\}|\[([^[\]]+)\]|<([A-Za-z]+)>/g; /** - * A stage text cut where it marks a name as `{Start}`, a value as `[ON]` or `[0011]`, + * A text cut where it marks a name as `{Start}`, a value as `[ON]` or `[0011]`, * or a control as `` * @throws if a mark is not one of these, so that a typo shows in the tests */ -export function parseStageText(text: string): StageTextSegment[] { - const segments: StageTextSegment[] = []; +export function parseMarkedText(text: string): MarkedTextSegment[] { + const segments: MarkedTextSegment[] = []; let rest = 0; const pushText = (end: number) => { const plain = text.slice(rest, end); @@ -64,7 +66,7 @@ export function parseStageText(text: string): StageTextSegment[] { else if (value !== undefined) segments.push(parseValue(value)); else if (control !== undefined && isControl(control)) { segments.push({ type: "control", control }); - } else throw new Error(`${whole} is not a control a stage text can show`); + } else throw new Error(`${whole} is not a control a text can show`); rest = match.index + whole.length; } pushText(text.length); diff --git a/src/common/markedTextTestUtils.ts b/src/common/markedTextTestUtils.ts new file mode 100644 index 0000000..e9260e3 --- /dev/null +++ b/src/common/markedTextTestUtils.ts @@ -0,0 +1,14 @@ +import { type MarkedTextSegment, parseMarkedText } from "./markedText"; + +/** What a text marks other than names, which a language may translate */ +export function marksOf(text: string) { + return parseMarkedText(text) + .flatMap((segment: MarkedTextSegment) => { + if (segment.type === "value") { + return [segment.value.map((bit) => (bit ? 1 : 0)).join("")]; + } + if (segment.type === "control") return [`<${segment.control}>`]; + return []; + }) + .toSorted(); +} diff --git a/src/pages/tutorial/StageText.tsx b/src/components/MarkedText.tsx similarity index 81% rename from src/pages/tutorial/StageText.tsx rename to src/components/MarkedText.tsx index f935ceb..96dd7e0 100644 --- a/src/pages/tutorial/StageText.tsx +++ b/src/components/MarkedText.tsx @@ -6,21 +6,22 @@ import { } from "@mui/icons-material"; import { Box, Button, type ButtonProps, ToggleButton } from "@mui/material"; import type { ReactNode } from "react"; +import { + type MarkedTextControl, + type MarkedTextSegment, + parseMarkedText, +} from "../common/markedText"; +import { useMessages } from "../i18n"; import { autoToggleButtonLook, checkButtonLook, pinApplyButtonLook, + pinFieldButtonLook, valueApplyButtonLook, withLookSx, -} from "../../components/controlLooks"; -import { ValueView } from "../../components/ValueView"; -import { visuallyHiddenSx } from "../../components/visuallyHidden"; -import { useMessages } from "../../i18n"; -import { - parseStageText, - type StageTextControl, - type StageTextSegment, -} from "../../tutorial/stageText"; +} from "./controlLooks"; +import { ValueView } from "./ValueView"; +import { visuallyHiddenSx } from "./visuallyHidden"; // The real controls with their looks, smaller and not to be pressed. The label is read // out from a hidden copy, as the control itself is hidden from screen readers. @@ -77,7 +78,7 @@ function InlineButton({ look, label }: { look: ButtonProps; label: string }) { ); } -function ControlView({ control }: { control: StageTextControl }) { +function ControlView({ control }: { control: MarkedTextControl }) { const messages = useMessages(); const roundIcon = (icon: ReactNode) => ( ); + case "pinAdd": + return ( + + ); + case "pinRemove": + return ( + + ); case "auto": return ( @@ -171,7 +186,7 @@ function ControlView({ control }: { control: StageTextControl }) { } } -function SegmentView({ segment }: { segment: StageTextSegment }) { +function SegmentView({ segment }: { segment: MarkedTextSegment }) { switch (segment.type) { case "text": return segment.text; @@ -194,9 +209,9 @@ function SegmentView({ segment }: { segment: StageTextSegment }) { } } -/** A stage text with the names, values and controls it marks drawn as on the screen */ -export function StageText({ text }: { text: string }) { - return parseStageText(text).map((segment, index) => ( +/** A text with the names, values and controls it marks drawn as on the screen */ +export function MarkedText({ text }: { text: string }) { + return parseMarkedText(text).map((segment, index) => ( // biome-ignore lint/suspicious/noArrayIndexKey: the segments of a text keep their order )); diff --git a/src/components/PartDescription.test.ts b/src/components/PartDescription.test.ts index 9243bac..6b9ff6c 100644 --- a/src/components/PartDescription.test.ts +++ b/src/components/PartDescription.test.ts @@ -1,34 +1,77 @@ import { describe, expect, it } from "vitest"; -import { messagesByLanguage } from "../i18n/messages"; +import { parseMarkedText } from "../common/markedText"; +import { marksOf } from "../common/markedTextTestUtils"; +import { type Language, languages, messagesByLanguage } from "../i18n/messages"; import { and, - and_n, broadcast, decompose, + definitions, display, } from "../store/intrinsics/definitions"; import { pinNotesOf } from "./PartDescription"; -const { en, ja } = messagesByLanguage; +const allDefinitions = Object.values(definitions); + +/** Each text describing a part, with the part it describes */ +function textsOf(language: Language) { + const messages = messagesByLanguage[language]; + return allDefinitions.flatMap((definition) => + [ + messages.parts.summaries[definition.type], + ...pinNotesOf(messages, definition), + ].map((text) => ({ definition, text })), + ); +} describe("pinNotesOf", () => { - it("tells how to set a pin whose bit width the player chooses", () => { - expect(pinNotesOf(en, broadcast)).toEqual([ - 'The number in the Out pin is its number of bits. To change it, click the pin while editing, change the field and press "Apply".', - ]); - }); + it.each(languages)( + "tells in %s to press Apply after setting a pin's bit width", + (language) => { + expect( + pinNotesOf(messagesByLanguage[language], broadcast).map(marksOf), + ).toEqual([[""]]); + }, + ); - it("tells how to add pins where a pin can be split", () => { - expect(pinNotesOf(en, and_n)).toEqual([ - 'The number in the In pin is its number of bits. To change it, click the pin while editing, change the field and press "Apply". Each field added with "Add" becomes another In pin.', - ]); - expect(pinNotesOf(ja, decompose)).toEqual([ - "Out のピンの中の数字は、そのピンのビット数。編集中にピンをクリックし、出てきた欄で変えて「適用」を押す。「追加」で欄を増やすと、Out のピンも増える。", - ]); - }); + it.each(languages)( + "tells in %s how to add and remove pins where a pin can be split", + (language) => { + expect( + pinNotesOf(messagesByLanguage[language], decompose).map(marksOf), + ).toEqual([["", "", ""]]); + }, + ); it("says nothing of pins whose bit widths follow from elsewhere", () => { + const { en } = messagesByLanguage; expect(pinNotesOf(en, and)).toEqual([]); expect(pinNotesOf(en, display)).toEqual([]); }); }); + +describe("the part descriptions", () => { + it("mark the same values and controls in every language", () => { + const english = textsOf("en"); + const japanese = textsOf("ja"); + expect(japanese).toHaveLength(english.length); + for (const [index, { text }] of english.entries()) { + expect(marksOf(japanese[index]?.text ?? "")).toEqual(marksOf(text)); + } + }); + + it.each(languages)("name only the part and its pins in %s", (language) => { + const strangers = textsOf(language).flatMap(({ definition, text }) => { + const known = new Set([ + definition.name, + ...definition.allPins.map((pin) => pin.name), + ]); + return parseMarkedText(text).flatMap((segment) => + segment.type === "name" && !known.has(segment.name) + ? [`${definition.name}: ${segment.name}`] + : [], + ); + }); + expect(strangers).toEqual([]); + }); +}); diff --git a/src/components/PartDescription.tsx b/src/components/PartDescription.tsx index afe4d5d..f04987d 100644 --- a/src/components/PartDescription.tsx +++ b/src/components/PartDescription.tsx @@ -4,6 +4,7 @@ import type { CCComponent } from "../store/component"; import { IntrinsicComponentDefinition } from "../store/intrinsics/base"; import { definitionByComponentId } from "../store/intrinsics/definitions"; import { type TruthTable, truthTableOf } from "../store/intrinsics/truthTable"; +import { MarkedText } from "./MarkedText"; import { TruthTableView } from "./TruthTableView"; export function partSummary( @@ -62,10 +63,14 @@ export function PartDescriptionView({ > {name} - {summary && {summary}} + {summary && ( + + + + )} {notes.map((note) => ( - {note} + ))} {table && ( diff --git a/src/components/controlLooks.ts b/src/components/controlLooks.ts index 0d44078..8062962 100644 --- a/src/components/controlLooks.ts +++ b/src/components/controlLooks.ts @@ -6,7 +6,7 @@ import type { } from "@mui/material"; import { theme } from "../style"; -// The looks of controls a stage text draws too, so that the two cannot drift apart +// The looks of controls a marked text draws too, so that the two cannot drift apart export const checkButtonLook = { variant: "contained", @@ -24,6 +24,12 @@ export const pinApplyButtonLook = { size: "small", } as const satisfies ButtonProps; +/** The look of "Add" and "Remove" in the pin editor */ +export const pinFieldButtonLook = { + variant: "outlined", + size: "small", +} as const satisfies ButtonProps; + export const autoToggleButtonLook = { size: "small", } as const satisfies Partial; diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 9be7f8e..5c44173 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -94,7 +94,7 @@ const stageTexts: Record = { " turns {Up} [ON] until {Count} reaches [1001], then [OFF] for two time steps to see that {Count} stays at [1001] and {Carry} stays [OFF], and then [ON] again to see that {Count} goes back to [0000].", ], steps: [ - 'The {Const}, {Broadcast} and {And} on the left send [0001] to {B} of "{Adding four digits}" when {Up} is [ON], and [0000] when it is [OFF]. A {Broadcast} spreads a one-bit value over several bits: [1111] for [ON], [0000] for [OFF]. An {And} given values of several bits makes each bit [1] only where both are [1].', + 'The {Const}, {Broadcast} and {And} on the left send [0001] to {B} of "{Adding four digits}" when {Up} is [ON], and [0000] when it is [OFF]. A {Broadcast} spreads a one-bit value over two or more bits: [1111] for [ON], [0000] for [OFF]. An {And} given values of two or more bits makes each bit [1] only where both are [1].', "Make {Carry}. From [0000] to [1001], only [1001] has [1] in both the eights and the ones digit. Join the top pin (eights) and the bottom pin (ones) on the right of the {Decompose} at the bottom with an {And}, join its output and {Up} with another {And}, and connect that to {Carry}.", "Place a {Broadcast} and click the pin on its right. The box that appears is the bit width, the number of bits of the output. Change its 1 to 4 and press , and the output has four bits. Do this before connecting it.", "Go back to [0000] when {Carry} is [ON]. {S} is not connected to the {FlipFlop} yet. Connect the output of the {And} that goes to {Carry} to a {Not} as well to turn it over, spread it to four bits with that {Broadcast}, join it and {S} with an {And}, and connect the {And} to the input of the {FlipFlop}.", @@ -128,32 +128,35 @@ export const en = { }, parts: { summaries: { - AND: "ON only when both inputs are ON.", - OR: "ON when at least one input is ON.", - NOT: "Turns ON into OFF, and OFF into ON.", - XOR: "ON when exactly one input is ON.", - TRUE: "Always ON.", - FALSE: "Always OFF.", + AND: "[ON] only when both inputs are [ON]. Given values of two or more bits, it makes each bit [1] only where both are [1].", + OR: "[ON] when at least one input is [ON]. Given values of two or more bits, it makes each bit [1] where at least one is [1].", + NOT: "Swaps [ON] and [OFF]. Given a value of two or more bits, it swaps [1] and [0] in each bit.", + XOR: "[ON] when exactly one input is [ON]. Given values of two or more bits, it makes each bit [1] where exactly one is [1].", + TRUE: "Always [ON]. If its output has two or more bits, every bit is [1].", + FALSE: + "Always [OFF]. If its output has two or more bits, every bit is [0].", DECOMPOSE: - "Splits a value of several bits, the higher digits to the upper pins.", + "Splits a value of two or more bits, the higher digits to the upper pins.", AGGREGATE: "Joins values into one, the upper pins as the higher digits.", FLIPFLOP: - "Outputs what it received at the time step before (0 at the first time step).", + "Outputs what it received at the time step before. At the first time step, it outputs [OFF], or a value of all [0] bits if its output has two or more bits.", CONST: "Always outputs the value written in it.", - BROADCAST: "Repeats a one-bit value over several bits.", - ANDN: "ON only when every bit of In is 1.", - ORN: "ON when any bit of In is 1.", + BROADCAST: "Repeats a one-bit value over two or more bits.", + ANDN: "[ON] only when every bit of {In} is [1].", + ORN: "[ON] when any bit of {In} is [1].", SEVEN_SEGMENT: - "Turns the 4-bit value of In into the shape of a hexadecimal character, 0 to F. Out is a 28-bit value of a picture 4 pixels wide and 7 high, with 1 for the character. While editing, the gear button sets its pixel order.", + "Turns the 4-bit value of {In} into the shape of a hexadecimal character, 0 to F. {Out} is a 28-bit value of a picture 4 pixels wide and 7 high, with [1] for the character. While editing, the gear button sets its pixel order.", DISPLAY: - "While playing, shows the value of Pixels as a picture, one bit per pixel (1 is black, 0 is white). From the highest digit, the pixels go from the top left row by row in row-major order, or column by column in column-major order. While editing, the gear button sets the resolution and the pixel order.", + "While playing, shows the value of {Pixels} as a picture, one bit per pixel ([1] is black, [0] is white). From the highest digit, the pixels go from the top left row by row in row-major order, or column by column in column-major order. While editing, the gear button sets the resolution and the pixel order.", INPUT: - "Adds an input to the component it is placed in. Where that component is placed as a part, the input is a pin on its left. While playing, its value can be changed on the placed Input.", + "Adds an input to the component it is placed in. Where that component is placed as a part, the input is a pin on its left. While playing, its value can be changed on the placed {Input}.", OUTPUT: "Adds an output to the component it is placed in. Where that component is placed as a part, the output is a pin on its right. While playing, it shows the value it receives.", } satisfies Record, pinBitWidth: (pinName: string, canAddPins: boolean) => - `The number in the ${pinName} pin is its number of bits. To change it, click the pin while editing, change the field and press "Apply".${canAddPins ? ` Each field added with "Add" becomes another ${pinName} pin.` : ""}`, + canAddPins + ? `The number in an {${pinName}} pin is its number of bits. Click an {${pinName}} pin while editing, and a field for each {${pinName}} pin appears, from the top. adds a field at the bottom, and removes the bottom one. Change the numbers in the fields and press , and the {${pinName}} pins follow the fields.` + : `The number in the {${pinName}} pin is its number of bits. To change it, click the pin while editing, change the number in the field and press .`, about: (name: string) => `About ${name}`, ofStage: "Available parts", }, diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 9fe1461..d552668 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -12,30 +12,33 @@ export const ja: Messages = { }, parts: { summaries: { - AND: "両方が ON のときだけ ON。", - OR: "少なくとも一方が ON なら ON。", - NOT: "ON と OFF を逆にする。", - XOR: "片方だけが ON のとき ON。", - TRUE: "いつも ON。", - FALSE: "いつも OFF。", - DECOMPOSE: "何ビットもある値を、上の桁から順に、上のピンへ分ける。", + AND: "両方が [ON] のときだけ [ON]。2ビット以上の値では、ビットごとに、両方が [1] のビットだけ [1] になる。", + OR: "少なくとも一方が [ON] なら [ON]。2ビット以上の値では、ビットごとに、少なくとも一方が [1] のビットが [1] になる。", + NOT: "[ON] と [OFF] を逆にする。2ビット以上の値では、ビットごとに [1] と [0] を逆にする。", + XOR: "片方だけが [ON] のとき [ON]。2ビット以上の値では、ビットごとに、片方だけが [1] のビットが [1] になる。", + TRUE: "いつも [ON]。出力が2ビット以上なら、すべてのビットが [1]。", + FALSE: "いつも [OFF]。出力が2ビット以上なら、すべてのビットが [0]。", + DECOMPOSE: "2ビット以上の値を、上の桁から順に、上のピンへ分ける。", AGGREGATE: "上のピンを上の桁として、値を1つにまとめる。", - FLIPFLOP: "1つ前のステップで受け取った値を出す(最初のステップでは 0)。", + FLIPFLOP: + "1つ前のステップで受け取った値を出す。最初のステップでは [OFF] を、出力が2ビット以上ならすべてのビットが [0] の値を出す。", CONST: "中に書いた値をいつも出す。", - BROADCAST: "1ビットの値を、同じ値が並んだ何ビットもの値に広げる。", - ANDN: "In のビットがすべて 1 のときだけ ON。", - ORN: "In のどれかのビットが 1 なら ON。", + BROADCAST: "1ビットの値を、同じ値が並んだ2ビット以上の値に広げる。", + ANDN: "{In} のビットがすべて [1] のときだけ [ON]。", + ORN: "{In} のどれかのビットが [1] なら [ON]。", SEVEN_SEGMENT: - "In の4ビットの値を、16進数の1文字(0〜F)の形にする。Out は、横4・縦7ピクセルの絵を表す28ビットの値で、文字の部分が 1。ピクセルの並び順は、編集中に歯車のボタンで変えられる。", + "{In} の4ビットの値を、16進数の1文字(0〜F)の形にする。{Out} は、横4・縦7ピクセルの絵を表す28ビットの値で、文字の部分が [1]。ピクセルの並び順は、編集中に歯車のボタンで変えられる。", DISPLAY: - "再生中、Pixels の値を、1ビットを1ピクセルとして絵にする(1 は黒、0 は白)。上の桁から順に、行優先なら左上から横に1行ずつ、列優先なら縦に1列ずつ並ぶ。解像度とピクセルの並び順は、編集中に歯車のボタンで変えられる。", + "再生中、{Pixels} の値を、1ビットを1ピクセルとして絵にする([1] は黒、[0] は白)。上の桁から順に、行優先なら左上から横に1行ずつ、列優先なら縦に1列ずつ並ぶ。解像度とピクセルの並び順は、編集中に歯車のボタンで変えられる。", INPUT: - "置いた先のコンポーネントに、入力を1つ足す。そのコンポーネントを部品として置くと、左側のピンになる。再生中は、置いた Input の上で値を変えられる。", + "置いた先のコンポーネントに、入力を1つ足す。そのコンポーネントを部品として置くと、左側のピンになる。再生中は、置いた {Input} の上で値を変えられる。", OUTPUT: "置いた先のコンポーネントに、出力を1つ足す。そのコンポーネントを部品として置くと、右側のピンになる。再生中は、受け取った値を見せる。", }, pinBitWidth: (pinName, canAddPins) => - `${pinName} のピンの中の数字は、そのピンのビット数。編集中にピンをクリックし、出てきた欄で変えて「適用」を押す。${canAddPins ? `「追加」で欄を増やすと、${pinName} のピンも増える。` : ""}`, + canAddPins + ? `{${pinName}} のピンの中の数字は、そのピンのビット数。編集中にピンをクリックすると、{${pinName}} のピンごとの欄が上から順に並ぶ。でいちばん下に欄を足し、でいちばん下の欄を消せる。欄の数字を書きかえてを押すと、{${pinName}} のピンが欄のとおりになる。` + : `{${pinName}} のピンの中の数字は、そのピンのビット数。編集中にピンをクリックし、出てきた欄の数字を書きかえてを押す。`, about: (name) => `${name} について`, ofStage: "使える部品", }, @@ -235,7 +238,7 @@ export const ja: Messages = { "は、{Up} を [ON] にして {Count} を [1001] まで進めたあと、2ステップだけ {Up} を [OFF] にして、{Count} が [1001] のまま止まり、{Carry} が [OFF] のままかを調べます。そのあと {Up} をまた [ON] にして、[0000] に戻るかを調べます。", ], steps: [ - "左の {Const}・{Broadcast}・{And} は、{Up} が [ON] のときは [0001] を、[OFF] のときは [0000] を「{4桁の足し算}」の {B} に送っています。{Broadcast} は、1ビットの値を、同じ値が並んだ何ビットもの値に広げます([ON] なら [1111]、[OFF] なら [0000])。{And} に何ビットもの値をつなぐと、ビットごとに、両方が [1] のビットだけ [1] になります。", + "左の {Const}・{Broadcast}・{And} は、{Up} が [ON] のときは [0001] を、[OFF] のときは [0000] を「{4桁の足し算}」の {B} に送っています。{Broadcast} は、1ビットの値を、同じ値が並んだ2ビット以上の値に広げます([ON] なら [1111]、[OFF] なら [0000])。{And} に2ビット以上の値をつなぐと、ビットごとに、両方が [1] のビットだけ [1] になります。", "{Carry} を作ります。[0000] から [1001] のうち、8の位と1の位がどちらも [1] なのは [1001] だけです。一番下の {Decompose} の右側の、一番上(8の位)と一番下(1の位)のピンを {And} でまとめ、その出力と {Up} をもう1つの {And} でまとめて、{Carry} につなぎます。", "{Broadcast} を置き、右側のピンをクリックします。出てきた欄はビット幅、つまり出力のビット数です。1 を 4 に書きかえてを押すと、出力が4ビットになります。線をつなぐ前にしておきます。", "{Carry} が [ON] のときに [0000] に戻す部分を作ります。{S} はまだ {FlipFlop} につながっていません。{Carry} につないだ {And} の出力を {Not} にもつないで反対にし、その {Broadcast} で4ビットに広げ、{S} と {And} でまとめて、{FlipFlop} の入力につなぎます。", diff --git a/src/pages/edit/Editor/components/NodePinPropertyEditor.tsx b/src/pages/edit/Editor/components/NodePinPropertyEditor.tsx index 1e43c37..3b8c7f4 100644 --- a/src/pages/edit/Editor/components/NodePinPropertyEditor.tsx +++ b/src/pages/edit/Editor/components/NodePinPropertyEditor.tsx @@ -6,6 +6,7 @@ import invariant from "tiny-invariant"; import { rect } from "../../../../common/rect"; import { pinApplyButtonLook, + pinFieldButtonLook, withLookSx, } from "../../../../components/controlLooks"; import { useMessages } from "../../../../i18n"; @@ -158,9 +159,8 @@ export function CCComponentEditorNodePinPropertyEditor() { componentPinAttributes.bitWidthPolicy.isSplittable && ( <>