|
| 1 | +import { createApp, defineComponent, reactive } from 'vue'; |
| 2 | +import { type VueJSXPluginOptions } from '@vue/babel-plugin-jsx'; |
| 3 | + |
| 4 | +export { VueJSXPluginOptions }; |
| 5 | + |
| 6 | +export const compilerOptions: VueJSXPluginOptions = reactive({ |
| 7 | + mergeProps: true, |
| 8 | + optimize: false, |
| 9 | + transformOn: false, |
| 10 | + enableObjectSlots: true, |
| 11 | + resolveType: false, |
| 12 | +}); |
| 13 | + |
| 14 | +const App = defineComponent({ |
| 15 | + setup() { |
| 16 | + return () => [ |
| 17 | + <> |
| 18 | + <h1>Vue 3 JSX Explorer</h1> |
| 19 | + <a |
| 20 | + href="https://app.netlify.com/sites/vue-jsx-explorer/deploys" |
| 21 | + target="_blank" |
| 22 | + > |
| 23 | + History |
| 24 | + </a> |
| 25 | + <div id="options-wrapper"> |
| 26 | + <div id="options-label">Options ↘</div> |
| 27 | + <ul id="options"> |
| 28 | + <li> |
| 29 | + <input |
| 30 | + type="checkbox" |
| 31 | + id="mergeProps" |
| 32 | + name="mergeProps" |
| 33 | + checked={compilerOptions.mergeProps} |
| 34 | + onChange={(e: Event) => { |
| 35 | + compilerOptions.mergeProps = ( |
| 36 | + e.target as HTMLInputElement |
| 37 | + ).checked; |
| 38 | + }} |
| 39 | + /> |
| 40 | + <label for="mergeProps">mergeProps</label> |
| 41 | + </li> |
| 42 | + |
| 43 | + <li> |
| 44 | + <input |
| 45 | + type="checkbox" |
| 46 | + id="optimize" |
| 47 | + name="optimize" |
| 48 | + checked={compilerOptions.optimize} |
| 49 | + onChange={(e: Event) => { |
| 50 | + compilerOptions.optimize = ( |
| 51 | + e.target as HTMLInputElement |
| 52 | + ).checked; |
| 53 | + }} |
| 54 | + /> |
| 55 | + <label for="optimize">optimize</label> |
| 56 | + </li> |
| 57 | + |
| 58 | + <li> |
| 59 | + <input |
| 60 | + type="checkbox" |
| 61 | + id="transformOn" |
| 62 | + name="transformOn" |
| 63 | + checked={compilerOptions.transformOn} |
| 64 | + onChange={(e: Event) => { |
| 65 | + compilerOptions.transformOn = ( |
| 66 | + e.target as HTMLInputElement |
| 67 | + ).checked; |
| 68 | + }} |
| 69 | + /> |
| 70 | + <label for="transformOn">transformOn</label> |
| 71 | + </li> |
| 72 | + |
| 73 | + <li> |
| 74 | + <input |
| 75 | + type="checkbox" |
| 76 | + id="enableObjectSlots" |
| 77 | + name="enableObjectSlots" |
| 78 | + checked={compilerOptions.enableObjectSlots} |
| 79 | + onChange={(e: Event) => { |
| 80 | + compilerOptions.enableObjectSlots = ( |
| 81 | + e.target as HTMLInputElement |
| 82 | + ).checked; |
| 83 | + }} |
| 84 | + /> |
| 85 | + <label for="enableObjectSlots">enableObjectSlots</label> |
| 86 | + </li> |
| 87 | + |
| 88 | + <li> |
| 89 | + <input |
| 90 | + type="checkbox" |
| 91 | + id="resolveType" |
| 92 | + name="resolveType" |
| 93 | + checked={!!compilerOptions.resolveType} |
| 94 | + onChange={(e: Event) => { |
| 95 | + compilerOptions.resolveType = ( |
| 96 | + e.target as HTMLInputElement |
| 97 | + ).checked; |
| 98 | + }} |
| 99 | + /> |
| 100 | + <label for="resolveType">resolveType</label> |
| 101 | + </li> |
| 102 | + </ul> |
| 103 | + </div> |
| 104 | + </>, |
| 105 | + ]; |
| 106 | + }, |
| 107 | +}); |
| 108 | + |
| 109 | +export function initOptions() { |
| 110 | + createApp(App).mount(document.getElementById('header')!); |
| 111 | +} |
0 commit comments