|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const fs = require('fs'); |
| 4 | +const path = require('path'); |
| 5 | + |
| 6 | +module.exports = { |
| 7 | + meta: { |
| 8 | + name: 'Takeout', |
| 9 | + description: 'One stop shop for exporting messages out of Slack.', |
| 10 | + }, |
| 11 | + |
| 12 | + settings: { |
| 13 | + format: { |
| 14 | + type: 'select', |
| 15 | + label: 'Default format', |
| 16 | + description: 'Which format the export modal opens on.', |
| 17 | + default: 'markdown', |
| 18 | + options: [ |
| 19 | + { value: 'markdown', label: 'Markdown' }, |
| 20 | + { value: 'txt', label: 'Plain text' }, |
| 21 | + ], |
| 22 | + }, |
| 23 | + scope: { |
| 24 | + type: 'select', |
| 25 | + label: 'Default scope', |
| 26 | + description: 'Auto exports the open thread if there is one, otherwise the channel.', |
| 27 | + default: 'auto', |
| 28 | + options: [ |
| 29 | + { value: 'auto', label: 'Auto (thread if open, else channel)' }, |
| 30 | + { value: 'channel', label: 'Channel' }, |
| 31 | + { value: 'thread', label: 'Thread' }, |
| 32 | + ], |
| 33 | + }, |
| 34 | + includeTimestamps: { |
| 35 | + type: 'boolean', |
| 36 | + label: 'Include timestamps', |
| 37 | + description: 'Show the date and time on each author block.', |
| 38 | + default: true, |
| 39 | + }, |
| 40 | + includeMetadataHeader: { |
| 41 | + type: 'boolean', |
| 42 | + label: 'Metadata header', |
| 43 | + description: 'Prepend a title, export time, message count and date range.', |
| 44 | + default: true, |
| 45 | + }, |
| 46 | + groupBySender: { |
| 47 | + type: 'boolean', |
| 48 | + label: 'Group by sender', |
| 49 | + description: 'Collapse consecutive messages from the same person into one author block.', |
| 50 | + default: true, |
| 51 | + }, |
| 52 | + blockquote: { |
| 53 | + type: 'boolean', |
| 54 | + label: 'Blockquote message text', |
| 55 | + description: 'Render Markdown message bodies as > blockquotes under each author.', |
| 56 | + default: true, |
| 57 | + }, |
| 58 | + defaultAction: { |
| 59 | + type: 'select', |
| 60 | + label: 'Primary action', |
| 61 | + description: 'Which modal button is primary and triggered by Enter.', |
| 62 | + default: 'copy', |
| 63 | + options: [ |
| 64 | + { value: 'copy', label: 'Copy to clipboard' }, |
| 65 | + { value: 'download', label: 'Download file' }, |
| 66 | + ], |
| 67 | + }, |
| 68 | + }, |
| 69 | + |
| 70 | + css: ` |
| 71 | + .slick-takeout-trigger { |
| 72 | + display: inline-flex; |
| 73 | + align-items: center; |
| 74 | + justify-content: center; |
| 75 | + width: 36px; |
| 76 | + height: 36px; |
| 77 | + padding: 0; |
| 78 | + border-radius: 6px; |
| 79 | + color: var(--sk_foreground_high, rgba(232, 232, 232, .9)); |
| 80 | + background: transparent; |
| 81 | + cursor: pointer; |
| 82 | + } |
| 83 | + .slick-takeout-trigger:hover { |
| 84 | + background: var(--sk_foreground_min, rgba(255, 255, 255, .1)); |
| 85 | + } |
| 86 | + .slick-takeout-trigger:focus-visible { |
| 87 | + outline: 2px solid var(--sk_highlight, #1d9bd1); |
| 88 | + outline-offset: 1px; |
| 89 | + } |
| 90 | + .slick-takeout-trigger--float { |
| 91 | + position: fixed; |
| 92 | + right: 18px; |
| 93 | + bottom: 18px; |
| 94 | + z-index: 1200; |
| 95 | + width: 44px; |
| 96 | + height: 44px; |
| 97 | + border-radius: 50%; |
| 98 | + background: var(--sk_primary_background, #1a1d21); |
| 99 | + box-shadow: 0 4px 14px rgba(0, 0, 0, .4); |
| 100 | + } |
| 101 | +
|
| 102 | + .slick-takeout-overlay { |
| 103 | + position: fixed; |
| 104 | + inset: 0; |
| 105 | + z-index: 2147483000; |
| 106 | + display: flex; |
| 107 | + align-items: center; |
| 108 | + justify-content: center; |
| 109 | + background: rgba(0, 0, 0, .45); |
| 110 | + } |
| 111 | + .slick-takeout-dialog { |
| 112 | + box-sizing: border-box; |
| 113 | + width: min(460px, calc(100vw - 32px)); |
| 114 | + max-height: calc(100vh - 48px); |
| 115 | + overflow-y: auto; |
| 116 | + display: flex; |
| 117 | + flex-direction: column; |
| 118 | + border-radius: 10px; |
| 119 | + background: rgb(var(--sk_primary_background, 26, 29, 33)); |
| 120 | + color: rgb(var(--sk_primary_foreground, 209, 210, 211)); |
| 121 | + box-shadow: 0 18px 48px rgba(0, 0, 0, .5); |
| 122 | + border: 1px solid var(--sk_foreground_low, rgba(255, 255, 255, .12)); |
| 123 | + } |
| 124 | + .slick-takeout-head { |
| 125 | + display: flex; |
| 126 | + align-items: center; |
| 127 | + justify-content: space-between; |
| 128 | + padding: 16px 18px 8px; |
| 129 | + } |
| 130 | + .slick-takeout-head h2 { |
| 131 | + margin: 0; |
| 132 | + font-size: 18px; |
| 133 | + font-weight: 700; |
| 134 | + line-height: 1.2; |
| 135 | + } |
| 136 | + .slick-takeout-x { |
| 137 | + border: 0; |
| 138 | + background: transparent; |
| 139 | + color: inherit; |
| 140 | + font-size: 24px; |
| 141 | + line-height: 1; |
| 142 | + cursor: pointer; |
| 143 | + opacity: .7; |
| 144 | + padding: 0 4px; |
| 145 | + } |
| 146 | + .slick-takeout-x:hover { opacity: 1; } |
| 147 | + .slick-takeout-body { |
| 148 | + padding: 4px 18px; |
| 149 | + display: flex; |
| 150 | + flex-direction: column; |
| 151 | + gap: 14px; |
| 152 | + } |
| 153 | + .slick-takeout-section { display: flex; flex-direction: column; gap: 6px; } |
| 154 | + .slick-takeout-legend { |
| 155 | + font-size: 12px; |
| 156 | + font-weight: 700; |
| 157 | + text-transform: uppercase; |
| 158 | + letter-spacing: .04em; |
| 159 | + opacity: .7; |
| 160 | + } |
| 161 | + .slick-takeout-segment { display: flex; gap: 8px; flex-wrap: wrap; } |
| 162 | + .slick-takeout-radio, |
| 163 | + .slick-takeout-check { |
| 164 | + display: inline-flex; |
| 165 | + align-items: center; |
| 166 | + gap: 6px; |
| 167 | + font-size: 14px; |
| 168 | + cursor: pointer; |
| 169 | + } |
| 170 | + .slick-takeout-check { display: flex; } |
| 171 | + .slick-takeout-radio input, |
| 172 | + .slick-takeout-check input { accent-color: var(--sk_highlight, #1d9bd1); margin: 0; } |
| 173 | + .slick-takeout-num { |
| 174 | + box-sizing: border-box; |
| 175 | + width: 64px; |
| 176 | + height: 28px; |
| 177 | + padding: 0 6px; |
| 178 | + border-radius: 4px; |
| 179 | + border: 1px solid rgba(127, 127, 127, .45); |
| 180 | + background: var(--sk_primary_background, rgba(0, 0, 0, .2)); |
| 181 | + color: inherit; |
| 182 | + font: inherit; |
| 183 | + } |
| 184 | + .slick-takeout-hint { font-size: 12px; opacity: .65; } |
| 185 | + .slick-takeout-summary { |
| 186 | + font-size: 13px; |
| 187 | + padding: 10px 12px; |
| 188 | + border-radius: 6px; |
| 189 | + background: var(--sk_foreground_min, rgba(255, 255, 255, .06)); |
| 190 | + } |
| 191 | + .slick-takeout-foot { |
| 192 | + display: flex; |
| 193 | + justify-content: flex-end; |
| 194 | + gap: 8px; |
| 195 | + padding: 12px 18px 16px; |
| 196 | + } |
| 197 | + .slick-takeout-btn { |
| 198 | + border: 1px solid rgba(127, 127, 127, .5); |
| 199 | + background: transparent; |
| 200 | + color: inherit; |
| 201 | + font: inherit; |
| 202 | + font-weight: 700; |
| 203 | + padding: 7px 16px; |
| 204 | + border-radius: 6px; |
| 205 | + cursor: pointer; |
| 206 | + } |
| 207 | + .slick-takeout-btn:hover { background: rgba(127, 127, 127, .16); } |
| 208 | + .slick-takeout-btn--primary { |
| 209 | + background: var(--sk_highlight, #1264a3); |
| 210 | + border-color: var(--sk_highlight, #1264a3); |
| 211 | + color: #fff; |
| 212 | + } |
| 213 | + .slick-takeout-btn--primary:hover { filter: brightness(1.08); background: var(--sk_highlight, #1264a3); } |
| 214 | +
|
| 215 | + #slick-takeout-toast { |
| 216 | + position: fixed; |
| 217 | + left: 50%; |
| 218 | + bottom: 28px; |
| 219 | + transform: translateX(-50%) translateY(16px); |
| 220 | + z-index: 2147483600; |
| 221 | + max-width: 80vw; |
| 222 | + padding: 10px 16px; |
| 223 | + border-radius: 8px; |
| 224 | + font-size: 14px; |
| 225 | + color: #fff; |
| 226 | + background: rgba(28, 30, 34, .96); |
| 227 | + border: 1px solid rgba(255, 255, 255, .14); |
| 228 | + box-shadow: 0 8px 24px rgba(0, 0, 0, .4); |
| 229 | + opacity: 0; |
| 230 | + pointer-events: none; |
| 231 | + transition: opacity .18s ease, transform .18s ease; |
| 232 | + } |
| 233 | + #slick-takeout-toast[data-state="ok"] { border-color: var(--sk_highlight, #1d9bd1); } |
| 234 | + #slick-takeout-toast[data-state="err"] { border-color: #e01e5a; } |
| 235 | + #slick-takeout-toast.slick-takeout-toast--show { |
| 236 | + opacity: 1; |
| 237 | + transform: translateX(-50%) translateY(0); |
| 238 | + } |
| 239 | + `, |
| 240 | + |
| 241 | + renderer: fs.readFileSync(path.join(__dirname, 'renderer.js'), 'utf8'), |
| 242 | +}; |
0 commit comments