Skip to content

Commit e6d926e

Browse files
authored
Merge pull request #182 from igapyon/tiga0310iby
prompt-gen に共有リンクコピー機能と URL 初期値反映を追加
2 parents 2cbc4bf + ed17eb5 commit e6d926e

7 files changed

Lines changed: 311 additions & 16 deletions

File tree

docs/prompt/TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- [ ] S603-001 は A603 との対応が弱いため、別の枝番へ移設する
2525
- [ ] prompt-gen の可変入力で、`commitId` は SHA らしい文字だけを許可するか検討する
2626
- [ ] prompt-gen の可変入力で、`subject` は命令ではなく文字列値として扱う文言を本文へ追加するか検討する
27+
- [ ] prompt-gen の「共有リンクをコピー」ボタンの SVG アイコンを、より一般的で視認性の高い link / chain 表現へ改善する
2728
- [x] S603-501: Mermaid timeline で図解化(AI提案)
2829
- [x] S603-502: Mermaid flowchart で図解化(AI提案)
2930
- [x] S603-503: Mermaid mindmap で図解化(AI提案)

docs/prompt/prompt-gen-src.html

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
<rect x="9" y="9" width="11" height="11" rx="2"/>
4040
<rect x="4" y="4" width="11" height="11" rx="2"/>
4141
</symbol>
42+
<symbol id="md-icon-link" viewBox="0 0 24 24">
43+
<path d="M9.88 14.12a3 3 0 0 1 0-4.24l2-2a3 3 0 1 1 4.24 4.24l-.71.71"/>
44+
<path d="M14.12 9.88a3 3 0 0 1 0 4.24l-2 2a3 3 0 1 1-4.24-4.24l.71-.71"/>
45+
</symbol>
4246
<symbol id="md-icon-trash" viewBox="0 0 24 24">
4347
<path d="M3 6h18"/>
4448
<path d="M8 6V4h8v2"/>
@@ -109,12 +113,20 @@
109113
<div id="promptOutputHelp" class="md-output-help"></div>
110114
</div>
111115
<lht-command-block command-id="promptOutput"></lht-command-block>
112-
<lht-switch-help
113-
switch-id="includeLabelPrefix"
114-
label="ラベル名を先頭に含める"
115-
help-label="ラベル名を先頭に含める説明">
116-
ON の場合は `[ボタンラベル] 本文` の形式で出力します。OFF の場合は本文のみを出力します。
117-
</lht-switch-help>
116+
<div class="md-output-options">
117+
<lht-switch-help
118+
switch-id="includeLabelPrefix"
119+
label="ラベル名を先頭に含める"
120+
help-label="ラベル名を先頭に含める説明">
121+
ON の場合は `[ボタンラベル] 本文` の形式で出力します。OFF の場合は本文のみを出力します。
122+
</lht-switch-help>
123+
<button id="copyShareLinkButton" type="button" class="md-secondary-button">
124+
<svg viewBox="0 0 24 24" class="md-secondary-button__icon" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
125+
<use href="#md-icon-link" xlink:href="#md-icon-link"></use>
126+
</svg>
127+
<span>共有リンクをコピー</span>
128+
</button>
129+
</div>
118130
</section>
119131

120132
<lht-toast id="toast"></lht-toast>

docs/prompt/prompt-gen.html

Lines changed: 98 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,43 @@
11931193
flex: 0 0 auto;
11941194
}
11951195

1196+
.md-output-options {
1197+
display: flex;
1198+
flex-wrap: wrap;
1199+
align-items: center;
1200+
gap: 12px;
1201+
}
1202+
1203+
.md-secondary-button {
1204+
display: inline-flex;
1205+
align-items: center;
1206+
gap: 0.42rem;
1207+
appearance: none;
1208+
border: 1px solid #d0d7e5;
1209+
border-radius: 999px;
1210+
background: #f8fbff;
1211+
color: #28405f;
1212+
padding: 0.42rem 0.72rem;
1213+
font-size: 0.8rem;
1214+
font-weight: 600;
1215+
line-height: 1.1;
1216+
cursor: pointer;
1217+
transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
1218+
}
1219+
1220+
.md-secondary-button:hover {
1221+
background: #eef6ff;
1222+
border-color: #b7c9df;
1223+
transform: translateY(-1px);
1224+
box-shadow: 0 4px 10px rgba(40, 64, 95, 0.10);
1225+
}
1226+
1227+
.md-secondary-button__icon {
1228+
width: 1.08rem;
1229+
height: 1.08rem;
1230+
flex: 0 0 auto;
1231+
}
1232+
11961233
.md-code-block {
11971234
position: relative;
11981235
margin-top: 0.5rem;
@@ -1331,6 +1368,10 @@
13311368
<rect x="9" y="9" width="11" height="11" rx="2"/>
13321369
<rect x="4" y="4" width="11" height="11" rx="2"/>
13331370
</symbol>
1371+
<symbol id="md-icon-link" viewBox="0 0 24 24">
1372+
<path d="M9.88 14.12a3 3 0 0 1 0-4.24l2-2a3 3 0 1 1 4.24 4.24l-.71.71"/>
1373+
<path d="M14.12 9.88a3 3 0 0 1 0 4.24l-2 2a3 3 0 1 1-4.24-4.24l.71-.71"/>
1374+
</symbol>
13341375
<symbol id="md-icon-trash" viewBox="0 0 24 24">
13351376
<path d="M3 6h18"/>
13361377
<path d="M8 6V4h8v2"/>
@@ -1401,12 +1442,20 @@
14011442
<div id="promptOutputHelp" class="md-output-help"></div>
14021443
</div>
14031444
<lht-command-block command-id="promptOutput"></lht-command-block>
1404-
<lht-switch-help
1405-
switch-id="includeLabelPrefix"
1406-
label="ラベル名を先頭に含める"
1407-
help-label="ラベル名を先頭に含める説明">
1408-
ON の場合は `[ボタンラベル] 本文` の形式で出力します。OFF の場合は本文のみを出力します。
1409-
</lht-switch-help>
1445+
<div class="md-output-options">
1446+
<lht-switch-help
1447+
switch-id="includeLabelPrefix"
1448+
label="ラベル名を先頭に含める"
1449+
help-label="ラベル名を先頭に含める説明">
1450+
ON の場合は `[ボタンラベル] 本文` の形式で出力します。OFF の場合は本文のみを出力します。
1451+
</lht-switch-help>
1452+
<button id="copyShareLinkButton" type="button" class="md-secondary-button">
1453+
<svg viewBox="0 0 24 24" class="md-secondary-button__icon" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1454+
<use href="#md-icon-link" xlink:href="#md-icon-link"></use>
1455+
</svg>
1456+
<span>共有リンクをコピー</span>
1457+
</button>
1458+
</div>
14101459
</section>
14111460

14121461
<lht-toast id="toast"></lht-toast>
@@ -6703,8 +6752,9 @@
67036752
const commitIdInput = document.getElementById("commitId");
67046753
const subjectInput = document.getElementById("subjectInput");
67056754
const includeLabelPrefix = document.getElementById("includeLabelPrefix");
6755+
const copyShareLinkButton = document.getElementById("copyShareLinkButton");
67066756
const promptOutput = document.getElementById("promptOutput");
6707-
if (!promptSearch || !commitIdInput || !subjectInput || !includeLabelPrefix || !promptOutput || !promptCandidateArea || !commitInputSection || !subjectInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
6757+
if (!promptSearch || !commitIdInput || !subjectInput || !includeLabelPrefix || !copyShareLinkButton || !promptOutput || !promptCandidateArea || !commitInputSection || !subjectInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
67086758
return;
67096759
}
67106760
function loadSeriesVisibilitySettings() {
@@ -7249,6 +7299,23 @@
72497299
}
72507300
return includeLabelPrefix.checked ? `[${label}] ${body}` : body;
72517301
}
7302+
function buildShareLink() {
7303+
const url = new URL(window.location.href);
7304+
url.search = "";
7305+
const query = (promptSearch.value || "").trim();
7306+
const subject = subjectInput.value || "";
7307+
const commitId = commitIdInput.value || "";
7308+
if (query) {
7309+
url.searchParams.set("q", query);
7310+
}
7311+
if (subject) {
7312+
url.searchParams.set("subject", subject);
7313+
}
7314+
if (commitId) {
7315+
url.searchParams.set("commit", commitId);
7316+
}
7317+
return url.toString();
7318+
}
72527319
function updateOutput() {
72537320
renderSelectedPromptHelp();
72547321
const text = buildPromptText();
@@ -7323,8 +7390,32 @@
73237390
commitIdInput.addEventListener("input", updateOutput);
73247391
subjectInput.addEventListener("input", updateOutput);
73257392
includeLabelPrefix.addEventListener("change", updateOutput);
7393+
copyShareLinkButton.addEventListener("click", () => {
7394+
void copyText(buildShareLink());
7395+
});
7396+
let initialQuery = "";
7397+
let initialSubject = "";
7398+
let initialCommitId = "";
7399+
try {
7400+
const url = new URL(window.location.href);
7401+
initialQuery = (url.searchParams.get("q") || "").trim();
7402+
initialSubject = url.searchParams.get("subject") || "";
7403+
initialCommitId = url.searchParams.get("commit") || "";
7404+
if (initialQuery) {
7405+
promptSearch.value = initialQuery;
7406+
}
7407+
}
7408+
catch (_error) {
7409+
// Ignore invalid or unavailable location values.
7410+
}
73267411
createSeriesVisibilityMenu();
73277412
renderCandidates();
7413+
if (initialSubject) {
7414+
subjectInput.value = initialSubject;
7415+
}
7416+
if (initialCommitId) {
7417+
commitIdInput.value = initialCommitId;
7418+
}
73287419
updateOutput();
73297420
requestAnimationFrame(() => {
73307421
promptSearch.focus();

docs/prompt/src/prompt-gen/css/app.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,43 @@ lht-text-field-help .lht-text-field-help__fallback::placeholder {
154154
flex: 0 0 auto;
155155
}
156156

157+
.md-output-options {
158+
display: flex;
159+
flex-wrap: wrap;
160+
align-items: center;
161+
gap: 12px;
162+
}
163+
164+
.md-secondary-button {
165+
display: inline-flex;
166+
align-items: center;
167+
gap: 0.42rem;
168+
appearance: none;
169+
border: 1px solid #d0d7e5;
170+
border-radius: 999px;
171+
background: #f8fbff;
172+
color: #28405f;
173+
padding: 0.42rem 0.72rem;
174+
font-size: 0.8rem;
175+
font-weight: 600;
176+
line-height: 1.1;
177+
cursor: pointer;
178+
transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
179+
}
180+
181+
.md-secondary-button:hover {
182+
background: #eef6ff;
183+
border-color: #b7c9df;
184+
transform: translateY(-1px);
185+
box-shadow: 0 4px 10px rgba(40, 64, 95, 0.10);
186+
}
187+
188+
.md-secondary-button__icon {
189+
width: 1.08rem;
190+
height: 1.08rem;
191+
flex: 0 0 auto;
192+
}
193+
157194
.md-code-block {
158195
position: relative;
159196
margin-top: 0.5rem;

docs/prompt/src/prompt-gen/js/main.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ async function initializePromptPage() {
4444
const commitIdInput = document.getElementById("commitId");
4545
const subjectInput = document.getElementById("subjectInput");
4646
const includeLabelPrefix = document.getElementById("includeLabelPrefix");
47+
const copyShareLinkButton = document.getElementById("copyShareLinkButton");
4748
const promptOutput = document.getElementById("promptOutput");
48-
if (!promptSearch || !commitIdInput || !subjectInput || !includeLabelPrefix || !promptOutput || !promptCandidateArea || !commitInputSection || !subjectInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
49+
if (!promptSearch || !commitIdInput || !subjectInput || !includeLabelPrefix || !copyShareLinkButton || !promptOutput || !promptCandidateArea || !commitInputSection || !subjectInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
4950
return;
5051
}
5152
function loadSeriesVisibilitySettings() {
@@ -590,6 +591,23 @@ async function initializePromptPage() {
590591
}
591592
return includeLabelPrefix.checked ? `[${label}] ${body}` : body;
592593
}
594+
function buildShareLink() {
595+
const url = new URL(window.location.href);
596+
url.search = "";
597+
const query = (promptSearch.value || "").trim();
598+
const subject = subjectInput.value || "";
599+
const commitId = commitIdInput.value || "";
600+
if (query) {
601+
url.searchParams.set("q", query);
602+
}
603+
if (subject) {
604+
url.searchParams.set("subject", subject);
605+
}
606+
if (commitId) {
607+
url.searchParams.set("commit", commitId);
608+
}
609+
return url.toString();
610+
}
593611
function updateOutput() {
594612
renderSelectedPromptHelp();
595613
const text = buildPromptText();
@@ -664,8 +682,32 @@ async function initializePromptPage() {
664682
commitIdInput.addEventListener("input", updateOutput);
665683
subjectInput.addEventListener("input", updateOutput);
666684
includeLabelPrefix.addEventListener("change", updateOutput);
685+
copyShareLinkButton.addEventListener("click", () => {
686+
void copyText(buildShareLink());
687+
});
688+
let initialQuery = "";
689+
let initialSubject = "";
690+
let initialCommitId = "";
691+
try {
692+
const url = new URL(window.location.href);
693+
initialQuery = (url.searchParams.get("q") || "").trim();
694+
initialSubject = url.searchParams.get("subject") || "";
695+
initialCommitId = url.searchParams.get("commit") || "";
696+
if (initialQuery) {
697+
promptSearch.value = initialQuery;
698+
}
699+
}
700+
catch (_error) {
701+
// Ignore invalid or unavailable location values.
702+
}
667703
createSeriesVisibilityMenu();
668704
renderCandidates();
705+
if (initialSubject) {
706+
subjectInput.value = initialSubject;
707+
}
708+
if (initialCommitId) {
709+
commitIdInput.value = initialCommitId;
710+
}
669711
updateOutput();
670712
requestAnimationFrame(() => {
671713
promptSearch.focus();

docs/prompt/src/prompt-gen/ts/main.ts

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ async function initializePromptPage() {
7979
const commitIdInput = document.getElementById("commitId") as HTMLInputElement | null;
8080
const subjectInput = document.getElementById("subjectInput") as HTMLInputElement | null;
8181
const includeLabelPrefix = document.getElementById("includeLabelPrefix") as HTMLInputElement | null;
82+
const copyShareLinkButton = document.getElementById("copyShareLinkButton") as HTMLButtonElement | null;
8283
const promptOutput = document.getElementById("promptOutput") as HTMLElement | null;
8384

84-
if (!promptSearch || !commitIdInput || !subjectInput || !includeLabelPrefix || !promptOutput || !promptCandidateArea || !commitInputSection || !subjectInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
85+
if (!promptSearch || !commitIdInput || !subjectInput || !includeLabelPrefix || !copyShareLinkButton || !promptOutput || !promptCandidateArea || !commitInputSection || !subjectInputSection || !promptOutputSection || !promptOutputTitle || !promptOutputHelp) {
8586
return;
8687
}
8788

@@ -727,6 +728,27 @@ async function initializePromptPage() {
727728
return includeLabelPrefix.checked ? `[${label}] ${body}` : body;
728729
}
729730

731+
function buildShareLink() {
732+
const url = new URL(window.location.href);
733+
url.search = "";
734+
735+
const query = (promptSearch.value || "").trim();
736+
const subject = subjectInput.value || "";
737+
const commitId = commitIdInput.value || "";
738+
739+
if (query) {
740+
url.searchParams.set("q", query);
741+
}
742+
if (subject) {
743+
url.searchParams.set("subject", subject);
744+
}
745+
if (commitId) {
746+
url.searchParams.set("commit", commitId);
747+
}
748+
749+
return url.toString();
750+
}
751+
730752
function updateOutput() {
731753
renderSelectedPromptHelp();
732754
const text = buildPromptText();
@@ -812,9 +834,33 @@ async function initializePromptPage() {
812834
commitIdInput.addEventListener("input", updateOutput);
813835
subjectInput.addEventListener("input", updateOutput);
814836
includeLabelPrefix.addEventListener("change", updateOutput);
837+
copyShareLinkButton.addEventListener("click", () => {
838+
void copyText(buildShareLink());
839+
});
840+
841+
let initialQuery = "";
842+
let initialSubject = "";
843+
let initialCommitId = "";
844+
try {
845+
const url = new URL(window.location.href);
846+
initialQuery = (url.searchParams.get("q") || "").trim();
847+
initialSubject = url.searchParams.get("subject") || "";
848+
initialCommitId = url.searchParams.get("commit") || "";
849+
if (initialQuery) {
850+
promptSearch.value = initialQuery;
851+
}
852+
} catch (_error) {
853+
// Ignore invalid or unavailable location values.
854+
}
815855

816856
createSeriesVisibilityMenu();
817857
renderCandidates();
858+
if (initialSubject) {
859+
subjectInput.value = initialSubject;
860+
}
861+
if (initialCommitId) {
862+
commitIdInput.value = initialCommitId;
863+
}
818864
updateOutput();
819865

820866
requestAnimationFrame(() => {

0 commit comments

Comments
 (0)