| 
									
										
										
										
											2018-02-25 20:45:11 -08:00
										 |  |  | <div class="lite-compose-box {{overLimit ? 'over-char-limit' : ''}}"> | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   <div class="compose-box-current-user"> | 
					
						
							|  |  |  |     <Avatar account="{{verifyCredentials}}" className="compose-box-avatar" size="small"/> | 
					
						
							|  |  |  |     <a class="compose-box-display-name" href="/accounts/{{verifyCredentials.id}}"> | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       {{verifyCredentials.display_name || verifyCredentials.acct}} | 
					
						
							|  |  |  |     </a> | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     <span class="compose-box-handle"> | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       {{'@' + verifyCredentials.acct}} | 
					
						
							|  |  |  |     </span> | 
					
						
							|  |  |  |     <textarea | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |       class="compose-box-input" | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       placeholder="What's on your mind?" | 
					
						
							|  |  |  |       ref:textarea | 
					
						
							|  |  |  |       bind:value=inputText | 
					
						
							|  |  |  |     ></textarea> | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     <ComposeLengthGauge :inputLength /> | 
					
						
							|  |  |  |     <ComposeToolbar /> | 
					
						
							|  |  |  |     <ComposeLengthIndicator :inputLength /> | 
					
						
							|  |  |  |     <button class="primary compose-box-button"> | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       Toot! | 
					
						
							|  |  |  |     </button> | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  |   .lite-compose-box { | 
					
						
							|  |  |  |     display: grid; | 
					
						
							|  |  |  |     flex-direction: row; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   .compose-box-current-user { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     border-radius: 4px; | 
					
						
							|  |  |  |     padding: 20px; | 
					
						
							|  |  |  |     display: grid; | 
					
						
							|  |  |  |     align-items: flex-start; | 
					
						
							|  |  |  |     grid-template-areas: | 
					
						
							| 
									
										
										
										
											2018-02-26 20:55:49 -08:00
										 |  |  |       "avatar display-name handle   handle" | 
					
						
							|  |  |  |       "avatar input        input    input" | 
					
						
							|  |  |  |       "avatar gauge        gauge    gauge" | 
					
						
							|  |  |  |       "avatar toolbar      toolbar  length" | 
					
						
							|  |  |  |       "avatar button       button   button"; | 
					
						
							|  |  |  |     grid-template-columns: min-content minmax(0, max-content) 1fr 1fr; | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     border-bottom: 1px solid var(--main-border); | 
					
						
							|  |  |  |     width: 560px; | 
					
						
							|  |  |  |     max-width: calc(100vw - 40px); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   :global(.compose-box-avatar) { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     grid-area: avatar; | 
					
						
							|  |  |  |     margin-right: 15px; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   .compose-box-display-name { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     color: var(--deemphasized-text-color); | 
					
						
							|  |  |  |     grid-area: display-name; | 
					
						
							|  |  |  |     min-width: 0; | 
					
						
							|  |  |  |     white-space: nowrap; | 
					
						
							|  |  |  |     overflow: hidden; | 
					
						
							|  |  |  |     text-overflow: ellipsis; | 
					
						
							|  |  |  |     font-size: 1.1em; | 
					
						
							|  |  |  |     margin-left: 5px; | 
					
						
							|  |  |  |     font-weight: 600; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   .compose-box-display-name, | 
					
						
							|  |  |  |   .compose-box-display-name:hover, | 
					
						
							|  |  |  |   .compose-box-display-name:visited { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     color: var(--body-text-color); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   :global(.compose-box-handle) { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     grid-area: handle; | 
					
						
							|  |  |  |     color: var(--deemphasized-text-color); | 
					
						
							|  |  |  |     min-width: 0; | 
					
						
							|  |  |  |     white-space: nowrap; | 
					
						
							|  |  |  |     overflow: hidden; | 
					
						
							|  |  |  |     text-overflow: ellipsis; | 
					
						
							|  |  |  |     font-size: 1.1em; | 
					
						
							|  |  |  |     margin-left: 5px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   :global(.compose-box-input) { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     grid-area: input; | 
					
						
							| 
									
										
										
										
											2018-02-26 20:55:49 -08:00
										 |  |  |     margin: 10px 0 0 5px; | 
					
						
							| 
									
										
										
										
											2018-02-26 00:24:28 -08:00
										 |  |  |     padding: 10px; | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     border: 1px solid var(--input-border); | 
					
						
							|  |  |  |     min-height: 75px; | 
					
						
							|  |  |  |     resize: none; | 
					
						
							| 
									
										
										
										
											2018-02-25 17:21:17 -08:00
										 |  |  |     overflow: hidden; | 
					
						
							| 
									
										
										
										
											2018-02-25 22:29:12 -08:00
										 |  |  |     word-wrap: break-word; | 
					
						
							| 
									
										
										
										
											2018-02-25 21:12:22 -08:00
										 |  |  |     /* Text must be at least 16px or else iOS Safari zooms in */ | 
					
						
							|  |  |  |     font-size: 1.2em; | 
					
						
							|  |  |  |     /* Hack to make Edge stretch the element all the way to the right. | 
					
						
							|  |  |  |      * Also desktop Safari makes the gauge stretch too far to the right without it. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2018-02-25 20:45:11 -08:00
										 |  |  |     width: calc(100% - 5px); | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   .compose-box-button { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     grid-area: button; | 
					
						
							|  |  |  |     justify-self: right; | 
					
						
							|  |  |  |     text-transform: uppercase; | 
					
						
							| 
									
										
										
										
											2018-02-25 17:21:17 -08:00
										 |  |  |     margin-top: 10px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |   @media (max-width: 767px) { | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     .compose-box-current-user { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       padding: 10px 10px; | 
					
						
							|  |  |  |       max-width: calc(100vw - 20px); | 
					
						
							|  |  |  |       width: 580px; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     :global(.compose-box-avatar) { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       grid-area: avatar; | 
					
						
							|  |  |  |       margin-right: 5px; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | </style> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  |   import Avatar from '../Avatar.html' | 
					
						
							|  |  |  |   import { store } from '../../_store/store' | 
					
						
							| 
									
										
										
										
											2018-02-25 20:45:11 -08:00
										 |  |  |   import { autosize } from '../../_utils/autosize' | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |   import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' | 
					
						
							|  |  |  |   import debounce from 'lodash/debounce' | 
					
						
							| 
									
										
										
										
											2018-02-25 16:47:45 -08:00
										 |  |  |   import { mark, stop } from '../../_utils/marks' | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   import ComposeToolbar from './ComposeToolbar.html' | 
					
						
							|  |  |  |   import ComposeLengthGauge from './ComposeLengthGauge.html' | 
					
						
							|  |  |  |   import ComposeLengthIndicator from './ComposeLengthIndicator.html' | 
					
						
							| 
									
										
										
										
											2018-02-25 17:21:17 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |   export default { | 
					
						
							|  |  |  |     oncreate() { | 
					
						
							|  |  |  |       this.set({inputText: store.get('currentInputTextInCompose')}) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-25 22:50:50 -08:00
										 |  |  |       requestAnimationFrame(() => { | 
					
						
							|  |  |  |         mark('autosize()') | 
					
						
							|  |  |  |         autosize(this.refs.textarea) | 
					
						
							|  |  |  |         stop('autosize()') | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const saveText = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       this.observe('inputText', inputText => { | 
					
						
							|  |  |  |         let inputTextInCompose = this.store.get('inputTextInCompose') | 
					
						
							|  |  |  |         let currentInstance = this.store.get('currentInstance') | 
					
						
							|  |  |  |         inputTextInCompose[currentInstance] = inputText || '' | 
					
						
							|  |  |  |         this.store.set({inputTextInCompose: inputTextInCompose}) | 
					
						
							|  |  |  |         saveText() | 
					
						
							|  |  |  |       }, {init: false}) | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     ondestroy() { | 
					
						
							| 
									
										
										
										
											2018-02-25 16:47:45 -08:00
										 |  |  |       mark('autosize.destroy()') | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |       autosize.destroy(this.refs.textarea) | 
					
						
							| 
									
										
										
										
											2018-02-25 16:47:45 -08:00
										 |  |  |       stop('autosize.destroy()') | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     data: () => ({ | 
					
						
							|  |  |  |       inputText: '' | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  |     components: { | 
					
						
							| 
									
										
										
										
											2018-02-26 20:55:49 -08:00
										 |  |  |       Avatar, | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |       ComposeToolbar, | 
					
						
							|  |  |  |       ComposeLengthGauge, | 
					
						
							|  |  |  |       ComposeLengthIndicator | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     store: () => store, | 
					
						
							|  |  |  |     computed: { | 
					
						
							| 
									
										
										
										
											2018-02-25 17:21:17 -08:00
										 |  |  |       currentInputTextInCompose: ($currentInputTextInCompose) => $currentInputTextInCompose, | 
					
						
							|  |  |  |       inputLength: (inputText) => inputText ? inputText.length : 0, | 
					
						
							| 
									
										
										
										
											2018-02-25 16:26:43 -08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-02-26 00:24:28 -08:00
										 |  |  | </script> |