spst-sample-data
実サービスへ通信しない見本です。モデルの描画は静止した代替表示です。
元 commit: d204666f04a0ee7b6f18543f8aec414b4128874e · shadcn build 4.23.1
Noto Sans JP · @fontsource/noto-sans-jp 5.3.1 · OFL-1.1
操作を試す
取り込む(公開予定)
以下の URL は公開予定です。公開前は取り込めません。既存ファイルとの差分を確認してから実行し、--overwrite を既定にしないでください。
npx shadcn@latest add https://spritestack.dev/r/spst-sample-data.jsoncomponents.json の registries に追加
{"registries":{"@spritestack":"https://spritestack.dev/r/{name}.json"}}npx shadcn@latest add @spritestack/spst-sample-dataReact 19・Tailwind v4・shadcn の src/ を持つ構成が対象です。src/ の無い構成は未検証です。取り込みはソースのコピーで、自動更新されません。
import "./styles/spritestack/theme.css";
<div className="spst-theme" data-theme="light">
{/* Render components here. */}
</div>Portal の container / portalContainer は .spst-theme 内の要素を渡してください。Noto Sans JP の 400・600・700 は利用先が自己ホストしてください。未導入時は system-ui です。
依存
- spst-account-panel
- spst-acquisition-panel
- spst-breadcrumb
- spst-button
- spst-category-strip
- spst-command-copy
- spst-consent-summary
- spst-contact-fields
- spst-content-outline
- spst-empty-state
- spst-file-dropzone
- spst-key-list
- spst-lineage-card
- spst-member-table
- spst-model-card
- spst-model-details
- spst-model-fields
- spst-model-table
- spst-pagination
- spst-provider-actions
- spst-sheet
- spst-tag-input
- spst-thumbnail-strip
- spst-viewer-controls
- spst-viewer-frame
Props / API
以下は実際のソースを構文解析して生成しています。… の行は継承する React / Radix の公開型です。既定欄の — は、この関数の引数で既定を指定していないことを表します。union の必須条件は型宣言も確認してください。
src/components/spritestack/blocks/sample-data.ts
getSampleData
getSampleData(locale: SampleLocale = "ja", messages?: Partial<SampleMessages>)| Prop | 型 | 必須 | 既定 | イベント |
|---|---|---|---|---|
… | SampleLocale | — | — | — |
型宣言とソースを確認
import { getSampleMessages, type SampleLocale, type SampleMessages } from "./sample-messages";
// 公開用の架空データ。会員・本番のモデルを参照しない。
export function getSampleData(locale: SampleLocale = "ja", messages?: Partial<SampleMessages>) {
const m = getSampleMessages(locale, messages);
const demoModels = [
{
id: "demo-box",
title: m.demoBox,
author: m.demoAuthorA,
license: "CC0",
href: "#demo-box",
category: "items",
visibility: "public" as const,
},
{
id: "demo-tree",
title: m.demoTree,
author: m.demoAuthorB,
license: "CC0",
href: "#demo-tree",
category: "nature",
visibility: "public" as const,
},
{
id: "demo-stone",
title: m.demoStone,
author: m.demoAuthorA,
license: "CC0",
href: "#demo-stone",
category: "nature",
visibility: "private" as const,
},
] as const;
const demoLinks = [
{ href: "#sample-home", label: m.modelCatalog },
{ href: "#sample-open", label: m.openFile },
{ href: "#sample-mypage", label: m.myPage },
];
return { demoModels, demoLinks };
}
// 既存の日本語の取り込みを保つ。
export const { demoModels, demoLinks } = getSampleData();
src/components/spritestack/blocks/sample-messages.ts
getSampleMessages
getSampleMessages(locale: SampleLocale = "ja", overrides?: Partial<SampleMessages>)| Prop | 型 | 必須 | 既定 | イベント |
|---|---|---|---|---|
… | "ja" | — | — | — |
… | "en" | — | — | — |
型宣言とソースを確認
// 見本専用の辞書。業務のデータや言語判定は持たない。
export type SampleLocale = "ja" | "en";
export type SampleMessages = {
toolName: (number: number) => string;
guideDescription: (label: string) => string;
readGuide: (label: string) => string;
loginAction: (provider: string) => string;
editAction: (title: string) => string;
withdrawLabel: (title: string) => string;
withdrawAction: (title: string) => string;
withdrawDescription: (title: string) => string;
rotateAction: (direction: "left" | "right") => string;
staticRotation: (direction: "left" | "right") => string;
staticModel: (title: string) => string;
demoMember: string;
demoCreationTool: string;
demoDate: string;
accountSettingsExample: string;
accountSettings: string;
displayNameSaveRequestedDemo: string;
logoutRequestedDemo: string;
keyMetadataAdded: string;
demoBox: string;
demoMemberA: string;
demoTree: string;
demoMemberB: string;
administrationExample: string;
administrationFictionalData: string;
nameAscending: string;
nameDescending: string;
consentExample: string;
demoPermission: string;
allowRequestedDemo: string;
denyRequestedDemo: string;
contactExample: string;
contactUs: string;
submissionNotice: string;
guide: string;
documentationExample: string;
usingSpritestack: string;
documentationNotice: string;
gallery: string;
findModelsForYourGame: string;
searchModels: string;
all: string;
items: string;
nature: string;
noMatchingModels: string;
selectedModel: string;
rotateLeftRequested: string;
rotateRightRequested: string;
renderingNotice: string;
author: string;
detailsNotice: string;
openDetails: string;
downloadSs: string;
copyLink: string;
usageExample: string;
introduction: string;
exampleSection: string;
conclusion: string;
legalDocumentStructureExample: string;
documentStructureExample: string;
thisIsNotLegalText: string;
exampleText: string;
verificationNotice: string;
loginExample: string;
logInToSpritestack: string;
loginDescription: string;
logIn: string;
signUp: string;
modelDetailsExample: string;
staticRenderingNotice: string;
front: string;
back: string;
selectedExample: string;
demoSize: string;
compositionDescription: string;
demo: string;
lineage: string;
myPageExample: string;
myPage: string;
uploadRequested: string;
uploadModel: string;
anExampleOfYourModels: string;
visibility: string;
public: string;
private: string;
views: string;
downloads: string;
edit: string;
withdraw: string;
withdrawThisModel: string;
returnLabel: string;
notFoundExample: string;
pageNotFound: string;
notFoundDescription: string;
returnToCatalogRequestedDemo: string;
reportRequestedDemo: string;
openFileExample: string;
openFile: string;
noParsingNotice: string;
noModelSelected: string;
fileContentsNotice: string;
filesAreNotPublished: string;
aFictionalModelDescription: string;
uploadExample: string;
upload: string;
noReadingNotice: string;
editModelInformation: string;
readonlyModelInfo: string;
submissionReceived: string;
send: string;
state: string;
exampleState: string;
ready: string;
empty: string;
error: string;
pending: string;
demoModel: string;
aFictionalModel: string;
inputError: string;
actionReceived: string;
untitledModel: string;
demoAuthor: string;
publicModels: string;
privateModels: string;
save: string;
details: string;
revoke: string;
unavailable: string;
modelName: string;
readOnlyId: string;
description: string;
demoCard: string;
aSummaryOfModelInformation: string;
noModels: string;
open: string;
connected: string;
needsAttention: string;
fictionalModelList: string;
loading: string;
modelInformation: string;
waysToAcquire: string;
pleaseCheck: string;
aboutFiles: string;
thisExampleDoesNotPublishFiles: string;
loadingExample: string;
renderingMode: string;
layerGap: string;
layerGapValue: string;
kind: string;
openMenu: string;
menu: string;
chooseDestination: string;
modelCatalog: string;
exampleNavigation: string;
models: string;
usage: string;
home: string;
whatIsTheLayerGap: string;
theDistanceBetweenLayers: string;
confirmRevocation: string;
confirmRevoke: string;
confirmationNotice: string;
staticBoxNotice: string;
side: string;
verificationSlotNotice: string;
demoTool: string;
fictionalPermission: string;
demoConnectionInformation: string;
box: string;
name: string;
publishedOn: string;
exampleBodyText: string;
bodyNotice: string;
cannotDisplay: string;
exampleGuidance: string;
instructionsForUse: string;
readInstructions: string;
themeExample: string;
themeDescription: string;
primaryAction: string;
inputBorder: string;
enterValue: string;
utilsExample: string;
stateNotice: string;
demoBoxImageUnavailable: string;
boxImageLabel: string;
simulateImageFailure: string;
demoAuthorA: string;
demoAuthorB: string;
demoStone: string;
};
const messages: Record<SampleLocale, SampleMessages> = {
ja: {
toolName: (number: number) => `見本の道具 ${number}`,
guideDescription: (label: string) => `${label} の案内の見本です。`,
readGuide: (label: string) => `${label} の説明を読む`,
loginAction: (provider: string) => `${provider} の操作の見本です。認証は実行しません。`,
editAction: (title: string) => `${title}の編集通知を受けました`,
withdrawLabel: (title: string) => `${title}を取り下げる`,
withdrawAction: (title: string) => `${title}の取り下げ通知を受けました`,
withdrawDescription: (title: string) =>
`${title}を非公開にする通知を送ります。見本では公開状態を変更しません。`,
rotateAction: (direction: "left" | "right") =>
`${direction === "left" ? "左" : "右"}回転の通知を受けました`,
staticRotation: (direction: "left" | "right") =>
`${direction} の通知を受けました。静止した表示は回転しません。`,
staticModel: (title: string) => `${title}の静止した見本です。描画は利用先が担当します。`,
demoMember: "見本の会員",
demoCreationTool: "見本の制作道具",
demoDate: "見本の日付",
accountSettingsExample: "アカウント設定の見本",
accountSettings: "アカウント設定",
displayNameSaveRequestedDemo: "表示名の保存操作を受けました(見本)",
logoutRequestedDemo: "ログアウト操作を受けました(見本)",
keyMetadataAdded: "鍵のメタ情報だけを追加しました。秘密は生成していません。",
demoBox: "見本の小箱",
demoMemberA: "見本の会員A",
demoTree: "見本の木",
demoMemberB: "見本の会員B",
administrationExample: "管理の見本",
administrationFictionalData: "管理(架空のデータ)",
nameAscending: "名前の昇順",
nameDescending: "名前の降順",
consentExample: "許可の見本",
demoPermission: "見本の権限(実際の許可ではありません)",
allowRequestedDemo: "許可する操作を受けました(見本)",
denyRequestedDemo: "許可しない操作を受けました(見本)",
contactExample: "お問い合わせの見本",
contactUs: "お問い合わせ",
submissionNotice: "送信操作の見本です。外部へ送信しません。",
guide: "ガイド",
documentationExample: "説明書の見本",
usingSpritestack: "SpriteStack の使い方",
documentationNotice: "説明書の構成を示す見本です。",
gallery: "ギャラリー",
findModelsForYourGame: "ゲームで使うモデルを見つける",
searchModels: "モデルを探す",
all: "すべて",
items: "道具",
nature: "自然",
noMatchingModels: "該当するモデルはありません",
selectedModel: "選択したモデル",
rotateLeftRequested: "左回転の通知を受けました",
rotateRightRequested: "右回転の通知を受けました",
renderingNotice: "— 描画は利用先が担当",
author: "作者:",
detailsNotice: "詳細への移動は利用先が担当します",
openDetails: "詳細ページを開く",
downloadSs: "ダウンロード(.ss)",
copyLink: "リンクをコピー",
usageExample: "使い方の見本",
introduction: "はじめに",
exampleSection: "見本の節",
conclusion: "おわりに",
legalDocumentStructureExample: "規約の構成見本",
documentStructureExample: "文書の構成見本",
thisIsNotLegalText: "規約の文面ではありません。",
exampleText: "見本の本文",
verificationNotice: "外部検証の差し込み位置(見本)。ロボット確認は実行しません。",
loginExample: "ログインの見本",
logInToSpritestack: "SpriteStack にログイン",
loginDescription: "自分のモデルの管理と、AI の道具との連携ができます。",
logIn: "ログイン",
signUp: "新規登録",
modelDetailsExample: "モデル詳細の見本",
staticRenderingNotice: "描画は利用先が担当(静止した見本)",
front: "正面",
back: "背面",
selectedExample: "選択した見本:",
demoSize: "見本のサイズ",
compositionDescription: "部品の組み立てを示す架空のモデルです。",
demo: "見本",
lineage: "系譜",
myPageExample: "マイページの見本",
myPage: "マイページ",
uploadRequested: "モデルを上げる通知を受けました",
uploadModel: "モデルを上げる",
anExampleOfYourModels: "自分のモデルの表示見本です。",
visibility: "公開状態",
public: "公開中",
private: "非公開",
views: "見た数",
downloads: "落とされた数",
edit: "直す",
withdraw: "取り下げる",
withdrawThisModel: "モデルを取り下げますか",
returnLabel: "戻る",
notFoundExample: "見つからない画面の見本",
pageNotFound: "ページが見つかりません",
notFoundDescription:
"お探しのページは、移動または削除された可能性があります。URLをご確認ください。",
returnToCatalogRequestedDemo: "一覧へ戻る操作を受けました(見本)",
reportRequestedDemo: "報告する操作を受けました(見本)",
openFileExample: "ファイルを開く見本",
openFile: "ファイルを開く",
noParsingNotice: "描画は利用先が担当(静止した見本)。ファイルを解析しません。",
noModelSelected: "未選択のモデル",
fileContentsNotice: "ファイルの中身は見本に反映しません。",
filesAreNotPublished: "ファイルは公開されません",
aFictionalModelDescription: "架空のモデルの説明です。",
uploadExample: "アップロードの見本",
upload: "アップロード",
noReadingNotice: "描画は利用先が担当(静止した見本)。選んだファイルは読み込みません。",
editModelInformation: "モデルの情報を編集",
readonlyModelInfo: "作者: 見本の作者 / 使用許諾: 見本の表示",
submissionReceived: "送る操作の見本です。ファイルは送信していません。",
send: "送る",
state: "状態",
exampleState: "見本の状態",
ready: "通常",
empty: "空",
error: "失敗",
pending: "待機中",
demoModel: "見本のモデル",
aFictionalModel: "架空のモデルです。",
inputError: "見本のエラーです。入力を確認してください。",
actionReceived: "操作を受けました(見本)。外部へ送信していません。",
untitledModel: "名前のないモデル",
demoAuthor: "見本の作者",
publicModels: "公開中のモデル",
privateModels: "非公開のモデル",
save: "保存",
details: "詳しく",
revoke: "取り消す",
unavailable: "操作できません",
modelName: "モデル名",
readOnlyId: "変更できない ID",
description: "説明",
demoCard: "見本のカード",
aSummaryOfModelInformation: "モデルの情報をまとめます。",
noModels: "モデルがありません",
open: "開く",
connected: "接続済み",
needsAttention: "確認が必要",
fictionalModelList: "架空のモデルの一覧",
loading: "読み込み中",
modelInformation: "モデルの情報",
waysToAcquire: "取得の方法",
pleaseCheck: "確認してください",
aboutFiles: "ファイルについて",
thisExampleDoesNotPublishFiles: "この見本はファイルを公開しません。",
loadingExample: "読み込み中の見本",
renderingMode: "描画方法",
layerGap: "すき間",
layerGapValue: "すき間の値",
kind: "種類",
openMenu: "メニューを開く",
menu: "メニュー",
chooseDestination: "移動先を選びます。",
modelCatalog: "モデルの一覧",
exampleNavigation: "見本の案内",
models: "モデル",
usage: "使い方",
home: "ホーム",
whatIsTheLayerGap: "すき間とは",
theDistanceBetweenLayers: "層を離す量です。",
confirmRevocation: "取り消しの確認",
confirmRevoke: "取り消しますか",
confirmationNotice: "架空の操作の確認です。",
staticBoxNotice: "見本の小箱 — 静止した表示。描画は利用先が担当します。",
side: "側面",
verificationSlotNotice: "外部検証の差し込み位置です。ロボット確認は実行しません。",
demoTool: "見本の道具",
fictionalPermission: "架空の権限",
demoConnectionInformation: "見本の接続情報",
box: "小箱",
name: "名前",
publishedOn: "公開日",
exampleBodyText: "見本の本文です。",
bodyNotice: "利用先で本文を渡します。",
cannotDisplay: "表示できません",
exampleGuidance: "見本の案内です。",
instructionsForUse: "使い方の説明です。",
readInstructions: "説明を読む",
themeExample: "テーマの見本",
themeDescription: "地・面・文字・主色を比べられます。",
primaryAction: "主操作",
inputBorder: "入力の境界",
enterValue: "入力してください",
utilsExample: 'cn("p-2", "p-4") → "p-4"\n部品の className を結合する補助関数です。',
stateNotice:
"選んだ状態に対応する props がある部品にだけ反映します。状態を持たない部品は通常の表示です。",
demoBoxImageUnavailable: "見本の小箱 — 画像を表示できません",
boxImageLabel: "見本の小箱の静止した図",
simulateImageFailure: "画像の失敗を試す",
demoAuthorA: "見本の作者 A",
demoAuthorB: "見本の作者 B",
demoStone: "見本の石",
},
en: {
toolName: (number: number) => `Demo tool ${number}`,
guideDescription: (label: string) => `Example guidance for ${label}.`,
readGuide: (label: string) => `Read about ${label}`,
loginAction: (provider: string) => `${provider} action (demo). No authentication is performed.`,
editAction: (title: string) => `Edit requested for ${title}`,
withdrawLabel: (title: string) => `Withdraw ${title}`,
withdrawAction: (title: string) => `Withdrawal requested for ${title}`,
withdrawDescription: (title: string) =>
`Request to make ${title} private. This demo does not change visibility.`,
rotateAction: (direction: "left" | "right") => `Rotate ${direction} requested`,
staticRotation: (direction: "left" | "right") =>
`${direction} requested. The static display does not rotate.`,
staticModel: (title: string) =>
`A static example of ${title}. Rendering is handled by the consuming app.`,
demoMember: "Demo member",
demoCreationTool: "Demo creation tool",
demoDate: "Demo date",
accountSettingsExample: "Account settings example",
accountSettings: "Account settings",
displayNameSaveRequestedDemo: "Display name save requested (demo)",
logoutRequestedDemo: "Logout requested (demo)",
keyMetadataAdded: "Only key metadata was added. No secret was generated.",
demoBox: "Demo box",
demoMemberA: "Demo member A",
demoTree: "Demo tree",
demoMemberB: "Demo member B",
administrationExample: "Administration example",
administrationFictionalData: "Administration (fictional data)",
nameAscending: "Name ascending",
nameDescending: "Name descending",
consentExample: "Consent example",
demoPermission: "Demo permission (no real access is granted)",
allowRequestedDemo: "Allow requested (demo)",
denyRequestedDemo: "Deny requested (demo)",
contactExample: "Contact example",
contactUs: "Contact us",
submissionNotice: "This is a submission demo. Nothing is sent externally.",
guide: "Guide",
documentationExample: "Documentation example",
usingSpritestack: "Using SpriteStack",
documentationNotice: "An example of documentation structure.",
gallery: "Gallery",
findModelsForYourGame: "Find models for your game",
searchModels: "Search models",
all: "All",
items: "Items",
nature: "Nature",
noMatchingModels: "No matching models",
selectedModel: "Selected model",
rotateLeftRequested: "Rotate left requested",
rotateRightRequested: "Rotate right requested",
renderingNotice: "— rendering is handled by the consuming app",
author: "Author:",
detailsNotice: "Navigation to details is handled by the consuming app",
openDetails: "Open details",
downloadSs: "Download (.ss)",
copyLink: "Copy link",
usageExample: "Usage example",
introduction: "Introduction",
exampleSection: "Example section",
conclusion: "Conclusion",
legalDocumentStructureExample: "Legal document structure example",
documentStructureExample: "Document structure example",
thisIsNotLegalText: "This is not legal text.",
exampleText: "Example text",
verificationNotice: "External verification slot (demo). No bot verification is performed.",
loginExample: "Login example",
logInToSpritestack: "Log in to SpriteStack",
loginDescription: "Manage your models and connect AI tools.",
logIn: "Log in",
signUp: "Sign up",
modelDetailsExample: "Model details example",
staticRenderingNotice: "Rendering is handled by the consuming app (static example)",
front: "Front",
back: "Back",
selectedExample: "Selected example:",
demoSize: "Demo size",
compositionDescription: "A fictional model showing component composition.",
demo: "Demo",
lineage: "Lineage",
myPageExample: "My page example",
myPage: "My page",
uploadRequested: "Upload requested",
uploadModel: "Upload a model",
anExampleOfYourModels: "An example of your models.",
visibility: "Visibility",
public: "Public",
private: "Private",
views: "Views",
downloads: "Downloads",
edit: "Edit",
withdraw: "Withdraw",
withdrawThisModel: "Withdraw this model?",
returnLabel: "Back",
notFoundExample: "Not found example",
pageNotFound: "Page not found",
notFoundDescription: "The page may have moved or been deleted. Please check the URL.",
returnToCatalogRequestedDemo: "Return to catalog requested (demo)",
reportRequestedDemo: "Report requested (demo)",
openFileExample: "Open file example",
openFile: "Open a file",
noParsingNotice:
"Rendering is handled by the consuming app (static example). Files are not parsed.",
noModelSelected: "No model selected",
fileContentsNotice: "File contents are not shown in this example.",
filesAreNotPublished: "Files are not published",
aFictionalModelDescription: "A fictional model description.",
uploadExample: "Upload example",
upload: "Upload",
noReadingNotice:
"Rendering is handled by the consuming app (static example). Selected files are not read.",
editModelInformation: "Edit model information",
readonlyModelInfo: "Author: Demo author / License: Demo display",
submissionReceived: "Submission requested (demo). The file was not sent.",
send: "Send",
state: "State",
exampleState: "Example state",
ready: "Ready",
empty: "Empty",
error: "Error",
pending: "Pending",
demoModel: "Demo model",
aFictionalModel: "A fictional model.",
inputError: "Example error. Please check your input.",
actionReceived: "Action received (demo). Nothing was sent externally.",
untitledModel: "Untitled model",
demoAuthor: "Demo author",
publicModels: "Public models",
privateModels: "Private models",
save: "Save",
details: "Details",
revoke: "Revoke",
unavailable: "Unavailable",
modelName: "Model name",
readOnlyId: "Read-only ID",
description: "Description",
demoCard: "Demo card",
aSummaryOfModelInformation: "A summary of model information.",
noModels: "No models",
open: "Open",
connected: "Connected",
needsAttention: "Needs attention",
fictionalModelList: "Fictional model list",
loading: "Loading",
modelInformation: "Model information",
waysToAcquire: "Ways to acquire",
pleaseCheck: "Please check",
aboutFiles: "About files",
thisExampleDoesNotPublishFiles: "This example does not publish files.",
loadingExample: "Loading example",
renderingMode: "Rendering mode",
layerGap: "Layer gap",
layerGapValue: "Layer gap value",
kind: "Kind",
openMenu: "Open menu",
menu: "Menu",
chooseDestination: "Choose a destination.",
modelCatalog: "Model catalog",
exampleNavigation: "Example navigation",
models: "Models",
usage: "Usage",
home: "Home",
whatIsTheLayerGap: "What is the layer gap?",
theDistanceBetweenLayers: "The distance between layers.",
confirmRevocation: "Confirm revocation",
confirmRevoke: "Revoke?",
confirmationNotice: "Confirmation of a fictional action.",
staticBoxNotice: "Demo box — static display. Rendering is handled by the consuming app.",
side: "Side",
verificationSlotNotice: "External verification slot. No bot verification is performed.",
demoTool: "Demo tool",
fictionalPermission: "Fictional permission",
demoConnectionInformation: "Demo connection information",
box: "Box",
name: "Name",
publishedOn: "Published on",
exampleBodyText: "Example body text.",
bodyNotice: "The consuming app provides the body text.",
cannotDisplay: "Cannot display",
exampleGuidance: "Example guidance.",
instructionsForUse: "Instructions for use.",
readInstructions: "Read instructions",
themeExample: "Theme example",
themeDescription: "Compare background, surfaces, text and primary colors.",
primaryAction: "Primary action",
inputBorder: "Input border",
enterValue: "Enter a value",
utilsExample: 'cn("p-2", "p-4") → "p-4"\nA helper to combine component className values.',
stateNotice:
"The selected state only affects components with matching props. Stateless components keep their normal display.",
demoBoxImageUnavailable: "Demo box — image unavailable",
boxImageLabel: "Static illustration of a demo box",
simulateImageFailure: "Simulate image failure",
demoAuthorA: "Demo author A",
demoAuthorB: "Demo author B",
demoStone: "Demo stone",
},
};
export type SampleProps = { locale?: SampleLocale; messages?: Partial<SampleMessages> };
export function getSampleMessages(
locale: SampleLocale = "ja",
overrides?: Partial<SampleMessages>,
): SampleMessages {
return { ...messages[locale], ...overrides };
}
src/components/spritestack/blocks/component-messages.ts
getComponentMessages
getComponentMessages(locale: SampleLocale)| Prop | 型 | 必須 | 既定 | イベント |
|---|---|---|---|---|
… | SampleLocale | — | — | — |
型宣言とソースを確認
// 子部品へ渡す英語の見本文言。完全な型で不足を検出する。
import type { BreadcrumbMessages } from "../../ui/breadcrumb";
import type { ButtonMessages } from "../../ui/button";
import type { PaginationMessages } from "../../ui/pagination";
import type { SheetContentMessages } from "../../ui/sheet";
import type { AccountPanelMessages } from "../account-panel";
import type { AcquisitionPanelMessages } from "../acquisition-panel";
import type { CategoryStripMessages } from "../category-strip";
import type { CommandCopyMessages } from "../command-copy";
import type { ConsentSummaryMessages } from "../consent-summary";
import type { ContactFieldsMessages } from "../contact-fields";
import type { ContentOutlineMessages } from "../content-outline";
import type { EmptyStateMessages } from "../empty-state";
import type { FileDropzoneMessages } from "../file-dropzone";
import type { KeyListMessages } from "../key-list";
import type { LineageCardMessages } from "../lineage-card";
import type { MemberTableMessages } from "../member-table";
import type { ModelCardMessages } from "../model-card";
import type { ModelDetailsMessages } from "../model-details";
import type { ModelFieldsMessages } from "../model-fields";
import type { ModelTableMessages } from "../model-table";
import type { ProviderActionsMessages } from "../provider-actions";
import type { TagInputMessages } from "../tag-input";
import type { ThumbnailStripMessages } from "../thumbnail-strip";
import type { ViewerControlsMessages } from "../viewer-controls";
import type { ViewerFrameMessages } from "../viewer-frame";
import type { SampleLocale } from "./sample-messages";
const copy: CommandCopyMessages = {
label: "Copy",
pending: "Copying",
success: "Copied",
error: "Could not copy. Select the text and copy it manually.",
};
const tags: TagInputMessages = {
label: "Tags",
add: "Add",
remove: (tag) => `Remove ${tag}`,
limit: (max) => `Up to ${max} tags`,
help: (count, max) =>
`${count} / ${max} tags. Press Backspace in an empty input to remove the last tag.`,
};
const pagination: PaginationMessages = {
label: "Pagination",
previous: "Previous",
next: "Next",
ellipsis: "More pages",
};
export type SampleComponentMessages = {
AccountPanel: AccountPanelMessages;
AcquisitionPanel: AcquisitionPanelMessages;
CategoryStrip: CategoryStripMessages;
CommandCopy: CommandCopyMessages;
ConsentSummary: ConsentSummaryMessages;
ContactFields: ContactFieldsMessages;
ContentOutline: ContentOutlineMessages;
EmptyState: EmptyStateMessages;
FileDropzone: FileDropzoneMessages;
KeyList: KeyListMessages;
LineageCard: LineageCardMessages;
MemberTable: MemberTableMessages;
ModelCard: ModelCardMessages;
ModelDetails: ModelDetailsMessages;
ModelFields: ModelFieldsMessages;
ModelTable: ModelTableMessages;
ProviderActions: ProviderActionsMessages;
TagInput: TagInputMessages;
ThumbnailStrip: ThumbnailStripMessages;
ViewerControls: ViewerControlsMessages;
ViewerFrame: ViewerFrameMessages;
Button: ButtonMessages;
Breadcrumb: BreadcrumbMessages;
Pagination: PaginationMessages;
SheetContent: SheetContentMessages;
};
const english: SampleComponentMessages = {
AccountPanel: {
title: "Account",
displayName: "Display name",
save: "Save",
connections: "Connected logins",
logout: "Log out",
pending: "Working",
},
AcquisitionPanel: {
copy,
preparing: "Preparing",
download: "Download (.ss)",
copyLink: "Copy link",
command: "Get with a command",
mcp: "Get with MCP",
api: "API documentation",
},
CategoryStrip: { label: "Categories" },
CommandCopy: copy,
ConsentSummary: {
title: "MCP authorization",
toolName: "Tool name",
account: "Account",
permissions: "Permissions",
empty: "No permissions requested",
allow: "Allow",
deny: "Deny",
},
ContactFields: {
kindLabel: (kind) => {
switch (kind) {
case "要望":
return "Request";
case "不具合":
return "Bug";
case "取材":
return "Press";
case "権利の申し立て":
return "Rights claim";
case "個人情報の開示訂正削除":
return "Personal data access, correction or deletion";
case "脆弱性の報告":
return "Vulnerability report";
case "その他":
return "Other";
}
},
kind: "Kind",
placeholder: "Select a kind",
body: "Message",
replyTo: "Reply to",
submit: "Send",
completed: "Submission complete",
pending: "Working",
},
ContentOutline: { label: "Contents" },
EmptyState: { returnLabel: "Back to catalog", report: "Report a problem" },
FileDropzone: {
reject: "Choose one .ss file",
label: "File selection",
drop: "Drag and drop a .ss file here",
fileLabel: ".ss file",
choose: "Choose a file",
empty: "No file selected",
selected: (name, size) => `${name} (${size} bytes) selected`,
},
KeyList: {
title: "AI keys",
issue: "Issue a key",
name: "Name",
createdAt: "Created",
lastUsedAt: "Last used",
revoke: "Revoke",
unused: "Unused",
confirmTitle: "Revoke key?",
cancel: "Back",
confirm: "Revoke",
empty: "No keys",
revokeLabel: (name) => `Revoke: ${name}`,
confirmDescription: (name) => `${name} will no longer work.`,
},
LineageCard: {
source: "Source model",
derived: "Derived models",
noImage: "No image",
unspecified: "Unspecified",
noDescription: "No description",
empty: (label) => `No ${label.toLowerCase()}`,
size: (value) => `Size: ${value}`,
},
MemberTable: {
title: "Members",
search: "Search members",
name: "Name",
status: "Status",
actions: "Actions",
loading: "Loading",
error: "Could not display members",
active: "Active",
suspended: "Suspended",
restore: "Restore",
suspend: "Suspend",
confirmTitle: "Suspend member?",
cancel: "Back",
confirm: "Suspend",
empty: "No members",
restoreLabel: (name) => `Restore ${name}`,
suspendLabel: (name) => `Suspend ${name}`,
confirmDescription: (name) => `Suspend access for ${name}.`,
},
ModelCard: {
public: "Public",
private: "Private",
unspecified: "Unspecified",
noLicense: "No license specified",
preview: "Preview",
open: "Open model page",
loading: "Loading model",
error: "Could not load model",
empty: "No model",
noImage: "No image",
author: (name) => `Author: ${name}`,
},
ModelDetails: {
author: "Author",
license: "License",
id: "ID",
grid: "Grid",
size: "File size",
unspecified: "Unspecified",
description: "Description",
noDescription: "No description",
tags: "Tags",
noTags: "No tags",
},
ModelFields: {
tags,
japaneseName: "Japanese name",
englishName: "English name",
description: "Description",
sourceId: "Source model ID",
readonlyInfo: "Information read from the file (read-only)",
},
ModelTable: {
pagination,
label: "Model list",
title: "Public models",
search: "Search models",
sort: "Sort order",
thumbnail: "Thumbnail",
name: "Model name",
id: "ID",
author: "Author",
publishedAt: "Published",
actions: "Actions",
loading: "Loading",
error: "Could not display models",
noImage: "No image",
makePrivate: "Make private",
confirmTitle: "Make model private?",
cancel: "Back",
empty: "No models",
pageSize: "Page size",
total: (count) => `${count} models`,
count: (count) => `${count} per page`,
privateLabel: (title) => `Make private: ${title}`,
confirmDescription: (title) => `Make ${title} private.`,
},
ProviderActions: {
connected: "Connected",
continueWith: (name) => `Continue with ${name}`,
connect: (name) => `Connect ${name}`,
},
TagInput: tags,
ThumbnailStrip: { previous: "Previous", next: "Next", label: "Images", empty: "No images" },
ViewerControls: {
mode: "Rendering mode",
gap: "Layer gap",
gapValue: "Layer gap value",
gapHelp: "About layer gap",
gapDescription: "The distance between layers",
left: "Rotate left",
right: "Rotate right",
},
ViewerFrame: {
label: "Model preview",
errorMessage: "Could not load model",
loading: "Loading model",
},
Button: { pending: "Working" },
Breadcrumb: { label: "Breadcrumb" },
Pagination: pagination,
SheetContent: { close: "Close" },
};
// 日本語は各部品の既定値を使い、その変更を見本にも反映する。
export function getComponentMessages(locale: SampleLocale): Partial<SampleComponentMessages> {
return locale === "en" ? english : {};
}
アクセシビリティの利用条件
- 入力には Label または読み上げ名を与え、エラーを aria-describedby で関連づけます。色だけで状態を伝えません。
- 画像にはモデル名と代替表示を与えます。単独アイコンのボタンにも名前が必要です。
- Dialog / Sheet に題名と説明を与え、Portal をテーマ内に置きます。Tab・矢印・Escape と閉じた後のフォーカスを利用先でも確認します。
- Slider は名前と有限の min < max、ToggleGroup は空でない single の値が必要です。pending は親が制御します。
対応画像: 01–11 · 暗色とエラーは設計による補完です。