Repository navigation
Expand file tree
/
Copy pathplayground.html
More file actions
111 lines (111 loc) · 9.48 KB
/
Copy pathplayground.html
File metadata and controls
111 lines (111 loc) · 9.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Convert CSV or spreadsheet clipboard text into CSV, JSON or Markdown tables locally. Preview quoted CSV or TSV, copy the result or download a file.">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src '__SCRIPT_CSP__'; style-src '__STYLE_CSP__'; connect-src 'none'; base-uri 'none'; form-action 'none'; object-src 'none'">
<title>Clipboard Table — local CSV and TSV converter</title>
<style>
:root { color-scheme: light; font: 16px/1.5 system-ui, sans-serif; color: #17243b; background: #edf1f7; }
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1260px; margin: auto; padding: 24px; }
a { color: #1647b8; text-underline-offset: 3px; }
a:hover { color: #092876; }
header, .heading, .actions, .result-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
header { padding-bottom: 22px; border-bottom: 1px solid #c9d3e2; }
.brand { font-size: 18px; font-weight: 750; letter-spacing: -.3px; }
.tag { color: #1647b8; background: #dce7ff; padding: 4px 9px; border-radius: 4px; font-size: 13px; font-weight: 650; }
nav { display: flex; gap: 20px; font-size: 14px; }
h1 { font-size: clamp(25px, 4vw, 34px); letter-spacing: -1px; margin: 26px 0 6px; line-height: 1.2; }
h2 { font-size: 18px; margin: 0; }
p { margin: 8px 0 16px; }
.intro { margin-bottom: 24px; color: #455773; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 20px; }
.panel { min-width: 0; padding: 22px; background: white; border: 1px solid #c9d3e2; border-radius: 10px; }
.hint { font-size: 14px; color: #52617a; }
label { display: block; font-weight: 650; margin-bottom: 8px; }
textarea { width: 100%; resize: vertical; min-height: 270px; border: 1px solid #a5b3c7; border-radius: 5px; padding: 14px; background: #f8faff; color: #17243b; font: 14px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 4; }
:focus-visible { outline: 3px solid #6489f1; outline-offset: 3px; }
.options { display: flex; align-items: center; gap: 9px; margin: 14px 0; font-size: 14px; font-weight: 500; }
select { min-height: 42px; padding: 8px 12px; border: 1px solid #a5b3c7; border-radius: 5px; background: white; color: #17243b; font: inherit; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: #1647b8; }
button { border: 1px solid #a5b3c7; border-radius: 5px; background: white; color: #17243b; font: 600 14px/1.4 system-ui, sans-serif; padding: 10px 14px; cursor: pointer; min-height: 42px; }
button:hover { background: #edf2ff; }
button.primary { color: white; background: #1647b8; border-color: #1647b8; }
button.primary:hover { background: #103991; }
button:disabled { color: #61718b; background: #edf1f7; border-color: #d2dbe7; cursor: default; }
.actions { justify-content: flex-start; gap: 8px; }
#status { min-height: 24px; margin-top: 18px; font-size: 14px; }
#error { color: #8d1b24; background: #fff1f2; border-left: 3px solid #b82534; padding: 12px; margin-top: 14px; font-size: 14px; }
[hidden] { display: none !important; }
.result-heading { margin-bottom: 16px; }
.table-scroll { max-height: 390px; overflow: auto; border: 1px solid #d5ddeb; border-radius: 5px; }
table { border-collapse: collapse; width: 100%; font: 14px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
caption { text-align: left; padding: 10px; color: #52617a; font: 14px/1.5 system-ui, sans-serif; }
th, td { text-align: left; vertical-align: top; border: 1px solid #d5ddeb; padding: 10px; min-width: 100px; max-width: 260px; overflow-wrap: anywhere; white-space: pre-wrap; }
th { background: #edf2ff; font-weight: 650; }
tbody tr:nth-child(even) { background: #f8faff; }
td.empty { color: #697994; font-style: italic; font-family: system-ui, sans-serif; }
.empty-state { color: #61718b; padding: 30px 0; }
details { margin-top: 16px; }
summary { cursor: pointer; font-size: 14px; font-weight: 650; padding: 5px 0; }
#output { min-height: 170px; margin-top: 8px; }
.boundary { margin-top: 20px; font-size: 14px; color: #52617a; }
footer { border-top: 1px solid #c9d3e2; margin-top: 28px; padding-top: 24px; }
footer h2 { font-size: 17px; }
footer p { font-size: 14px; color: #52617a; max-width: 850px; }
.wallets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.wallet { padding: 13px 16px; border: 1px solid #c9d3e2; border-radius: 5px; background: #f8faff; }
.wallet strong { display: block; font-size: 14px; margin-bottom: 5px; }
.wallet code { font-size: 13px; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 800px) { main { padding: 18px; } .workspace, .wallets { grid-template-columns: 1fr; } .panel { padding: 18px; } textarea { min-height: 220px; } }
</style>
</head>
<body>
<main>
<header>
<div class="heading"><span class="brand">Clipboard Table</span><span class="tag">Free · MIT</span></div>
<nav aria-label="Project"><a href="https://github.com/tevinch/data-shape-kit/tree/main/javascript/clipboard-table">Source & guide</a><a href="https://github.com/tevinch/data-shape-kit/issues">Report a case</a></nav>
</header>
<h1>Spreadsheet text → CSV, JSON or Markdown</h1>
<p class="intro">Choose comma-separated CSV or tab-separated TSV. Every cell stays text. Nothing is uploaded.</p>
<div class="workspace">
<section class="panel" aria-labelledby="input-label">
<label id="input-label" for="source">Paste or edit table text</label>
<label class="options" for="input-format">Input <select id="input-format"><option value="tsv">TSV (tabs)</option><option value="csv">CSV (commas)</option></select></label>
<p id="input-help" class="hint">Choose TSV for tab-separated spreadsheet text. Pasting replaces this box and parses it. After editing, choose Parse.</p>
<textarea id="source" aria-describedby="input-help limits" spellcheck="false" autocapitalize="off" autocomplete="off"></textarea>
<label class="options" for="output-format">Output <select id="output-format"><option value="json">JSON</option><option value="markdown">Markdown table</option><option value="csv">CSV (commas)</option></select></label>
<label class="options"><input id="headers" type="checkbox" checked><span id="header-label">Use the first row as JSON keys</span></label>
<div class="actions"><button id="parse" class="primary">Parse</button><button id="example">Load example</button><button id="clear">Clear</button></div>
<p id="status" role="status" aria-live="polite"></p>
<div id="error" role="alert" hidden></div>
<p id="limits" class="hint">JSON: up to 1,000,000 UTF-16 code units, 10,000 rows and 256 columns. Files are saved only when you choose Download.</p>
</section>
<section class="panel" aria-labelledby="preview-heading">
<div class="result-heading"><h2 id="preview-heading">Preview</h2><div class="actions"><button id="copy" disabled>Copy JSON</button><button id="download" disabled>Download JSON</button></div></div>
<p id="empty-state" class="empty-state">Paste a table or load the example to see the result.</p>
<div id="table-scroll" class="table-scroll" tabindex="0" role="region" aria-label="Table preview" hidden><table id="table"></table></div>
<p id="preview-note" class="hint"></p>
<details id="output-details" hidden><summary id="output-summary">View JSON</summary><label id="output-label" for="output" class="hint">Complete JSON output</label><textarea id="output" readonly spellcheck="false"></textarea></details>
<p id="format-note" class="hint" hidden>Markdown escapes punctuation and uses <br> for cell line breaks. Rendered whitespace may differ; HTML line breaks depend on your Markdown renderer.</p>
</section>
</div>
<p class="boundary">Plain text only: no XLSX, HTML tables, merged cells or formatting. Choose the input delimiter explicitly; CSV here uses commas, with double quotes around cells containing commas, line breaks or quotes. Double a quote inside a quoted cell. One final row separator ends the last row; additional blank rows remain. Pasted line endings are kept; editing the box uses the browser’s normalized line endings. Empty cells are marked “empty” in the preview and stay blank in Markdown or empty strings in JSON and CSV. CSV output quotes every cell and keeps each row’s width. Markdown requires rows of equal width.</p>
<footer>
<h2>Buy me a coffee, if this helped</h2>
<p>If this saved you a little time, you're welcome to buy me a coffee. Please don't feel obliged — the tool stays free, and feedback is appreciated too.</p>
<div class="wallets">
<div class="wallet"><strong>USDC / SOL · Solana</strong><code>9tY6D9mwcFaJwwzEHvw2v7nhSpdjqjNBYtuooyBN6rYy</code></div>
<div class="wallet"><strong>USDC / ETH · Base</strong><code>0x568Ab98578d682FB0B0b45619BE73EbFfbf5a6eA</code></div>
<div class="wallet"><strong>USDT · BNB Smart Chain (BEP20)</strong><code>0x568Ab98578d682FB0B0b45619BE73EbFfbf5a6eA</code></div>
</div>
<p>Match the asset and network exactly. Fees depend on your wallet or exchange. Thank you! — Tevinch</p>
</footer>
<noscript><p>This local example needs JavaScript enabled to parse text.</p></noscript>
</main>
<script type="module">__PLAYGROUND_SCRIPT__</script>
</body>
</html>