[
  {
    "path": ".eslintignore",
    "content": "dist\nnode_modules\npublic\n"
  },
  {
    "path": ".eslintrc",
    "content": "{\n  \"extends\": \"@antfu\"\n}\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n.vite-ssg-dist\n.vite-ssg-temp\n*.local\ndist\ndist-ssr\nnode_modules\n.idea/\n*.log\n"
  },
  {
    "path": ".npmrc",
    "content": "shamefully-hoist=true\n"
  },
  {
    "path": ".vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"antfu.vite\",\n    \"antfu.iconify\",\n    \"antfu.unocss\",\n    \"johnsoncodehk.volar\",\n    \"dbaeumer.vscode-eslint\"\n  ]\n}\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  \"cSpell.words\": [\"Vitesse\"],\n  \"prettier.enable\": false,\n  \"typescript.tsdk\": \"node_modules/typescript/lib\",\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": true,\n  },\n  \"files.associations\": {\n    \"*.css\": \"postcss\",\n  },\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2020-PRESENT Anthony Fu\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Vue Minesweeper\n\nCode from live screencasting - A tiny minesweeper clone in Vue 3\n\n> Deploy: https://vuesweeper.netlify.app/\n>\n> Live Stream: https://live.bilibili.com/835461 (it's over)\n>\n> Recording: https://www.bilibili.com/video/BV1ia411b7jY/\n\n🚧 如果可以尽量不要提功能性 PR，留着之后直播完善（欢迎自己 Fork 改），谢谢\n"
  },
  {
    "path": "auto-imports.d.ts",
    "content": "// Generated by 'unplugin-auto-import'\n// We suggest you to commit this file into source control\ndeclare global {\n  const $: typeof import('vue/macros')['$']\n  const $$: typeof import('vue/macros')['$$']\n  const $computed: typeof import('vue/macros')['$computed']\n  const $customRef: typeof import('vue/macros')['$customRef']\n  const $ref: typeof import('vue/macros')['$ref']\n  const $shallowRef: typeof import('vue/macros')['$shallowRef']\n  const $toRef: typeof import('vue/macros')['$toRef']\n  const asyncComputed: typeof import('@vueuse/core')['asyncComputed']\n  const autoResetRef: typeof import('@vueuse/core')['autoResetRef']\n  const computed: typeof import('vue')['computed']\n  const computedAsync: typeof import('@vueuse/core')['computedAsync']\n  const computedEager: typeof import('@vueuse/core')['computedEager']\n  const computedInject: typeof import('@vueuse/core')['computedInject']\n  const computedWithControl: typeof import('@vueuse/core')['computedWithControl']\n  const controlledComputed: typeof import('@vueuse/core')['controlledComputed']\n  const controlledRef: typeof import('@vueuse/core')['controlledRef']\n  const createApp: typeof import('vue')['createApp']\n  const createEventHook: typeof import('@vueuse/core')['createEventHook']\n  const createGlobalState: typeof import('@vueuse/core')['createGlobalState']\n  const createInjectionState: typeof import('@vueuse/core')['createInjectionState']\n  const createReactiveFn: typeof import('@vueuse/core')['createReactiveFn']\n  const createSharedComposable: typeof import('@vueuse/core')['createSharedComposable']\n  const createUnrefFn: typeof import('@vueuse/core')['createUnrefFn']\n  const customRef: typeof import('vue')['customRef']\n  const debouncedRef: typeof import('@vueuse/core')['debouncedRef']\n  const debouncedWatch: typeof import('@vueuse/core')['debouncedWatch']\n  const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']\n  const defineComponent: typeof import('vue')['defineComponent']\n  const eagerComputed: typeof import('@vueuse/core')['eagerComputed']\n  const effectScope: typeof import('vue')['effectScope']\n  const EffectScope: typeof import('vue')['EffectScope']\n  const extendRef: typeof import('@vueuse/core')['extendRef']\n  const getCurrentInstance: typeof import('vue')['getCurrentInstance']\n  const getCurrentScope: typeof import('vue')['getCurrentScope']\n  const h: typeof import('vue')['h']\n  const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']\n  const inject: typeof import('vue')['inject']\n  const isDefined: typeof import('@vueuse/core')['isDefined']\n  const isReadonly: typeof import('vue')['isReadonly']\n  const isRef: typeof import('vue')['isRef']\n  const logicAnd: typeof import('@vueuse/core')['logicAnd']\n  const logicNot: typeof import('@vueuse/core')['logicNot']\n  const logicOr: typeof import('@vueuse/core')['logicOr']\n  const makeDestructurable: typeof import('@vueuse/core')['makeDestructurable']\n  const markRaw: typeof import('vue')['markRaw']\n  const nextTick: typeof import('vue')['nextTick']\n  const onActivated: typeof import('vue')['onActivated']\n  const onBeforeMount: typeof import('vue')['onBeforeMount']\n  const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']\n  const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']\n  const onClickOutside: typeof import('@vueuse/core')['onClickOutside']\n  const onDeactivated: typeof import('vue')['onDeactivated']\n  const onErrorCaptured: typeof import('vue')['onErrorCaptured']\n  const onKeyStroke: typeof import('@vueuse/core')['onKeyStroke']\n  const onLongPress: typeof import('@vueuse/core')['onLongPress']\n  const onMounted: typeof import('vue')['onMounted']\n  const onRenderTracked: typeof import('vue')['onRenderTracked']\n  const onRenderTriggered: typeof import('vue')['onRenderTriggered']\n  const onScopeDispose: typeof import('vue')['onScopeDispose']\n  const onServerPrefetch: typeof import('vue')['onServerPrefetch']\n  const onStartTyping: typeof import('@vueuse/core')['onStartTyping']\n  const onUnmounted: typeof import('vue')['onUnmounted']\n  const onUpdated: typeof import('vue')['onUpdated']\n  const pausableWatch: typeof import('@vueuse/core')['pausableWatch']\n  const provide: typeof import('vue')['provide']\n  const reactify: typeof import('@vueuse/core')['reactify']\n  const reactifyObject: typeof import('@vueuse/core')['reactifyObject']\n  const reactive: typeof import('vue')['reactive']\n  const reactiveComputed: typeof import('@vueuse/core')['reactiveComputed']\n  const reactiveOmit: typeof import('@vueuse/core')['reactiveOmit']\n  const reactivePick: typeof import('@vueuse/core')['reactivePick']\n  const readonly: typeof import('vue')['readonly']\n  const ref: typeof import('vue')['ref']\n  const refAutoReset: typeof import('@vueuse/core')['refAutoReset']\n  const refDebounced: typeof import('@vueuse/core')['refDebounced']\n  const refDefault: typeof import('@vueuse/core')['refDefault']\n  const refThrottled: typeof import('@vueuse/core')['refThrottled']\n  const refWithControl: typeof import('@vueuse/core')['refWithControl']\n  const resolveComponent: typeof import('vue')['resolveComponent']\n  const shallowReactive: typeof import('vue')['shallowReactive']\n  const shallowReadonly: typeof import('vue')['shallowReadonly']\n  const shallowRef: typeof import('vue')['shallowRef']\n  const syncRef: typeof import('@vueuse/core')['syncRef']\n  const syncRefs: typeof import('@vueuse/core')['syncRefs']\n  const templateRef: typeof import('@vueuse/core')['templateRef']\n  const throttledRef: typeof import('@vueuse/core')['throttledRef']\n  const throttledWatch: typeof import('@vueuse/core')['throttledWatch']\n  const toRaw: typeof import('vue')['toRaw']\n  const toReactive: typeof import('@vueuse/core')['toReactive']\n  const toRef: typeof import('vue')['toRef']\n  const toRefs: typeof import('vue')['toRefs']\n  const triggerRef: typeof import('vue')['triggerRef']\n  const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']\n  const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']\n  const tryOnMounted: typeof import('@vueuse/core')['tryOnMounted']\n  const tryOnScopeDispose: typeof import('@vueuse/core')['tryOnScopeDispose']\n  const tryOnUnmounted: typeof import('@vueuse/core')['tryOnUnmounted']\n  const unref: typeof import('vue')['unref']\n  const unrefElement: typeof import('@vueuse/core')['unrefElement']\n  const until: typeof import('@vueuse/core')['until']\n  const useActiveElement: typeof import('@vueuse/core')['useActiveElement']\n  const useAsyncQueue: typeof import('@vueuse/core')['useAsyncQueue']\n  const useAsyncState: typeof import('@vueuse/core')['useAsyncState']\n  const useAttrs: typeof import('vue')['useAttrs']\n  const useBase64: typeof import('@vueuse/core')['useBase64']\n  const useBattery: typeof import('@vueuse/core')['useBattery']\n  const useBreakpoints: typeof import('@vueuse/core')['useBreakpoints']\n  const useBroadcastChannel: typeof import('@vueuse/core')['useBroadcastChannel']\n  const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']\n  const useCached: typeof import('@vueuse/core')['useCached']\n  const useClamp: typeof import('@vueuse/core')['useClamp']\n  const useClipboard: typeof import('@vueuse/core')['useClipboard']\n  const useColorMode: typeof import('@vueuse/core')['useColorMode']\n  const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']\n  const useCounter: typeof import('@vueuse/core')['useCounter']\n  const useCssModule: typeof import('vue')['useCssModule']\n  const useCssVar: typeof import('@vueuse/core')['useCssVar']\n  const useCssVars: typeof import('vue')['useCssVars']\n  const useCycleList: typeof import('@vueuse/core')['useCycleList']\n  const useDark: typeof import('@vueuse/core')['useDark']\n  const useDateFormat: typeof import('@vueuse/core')['useDateFormat']\n  const useDebounce: typeof import('@vueuse/core')['useDebounce']\n  const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']\n  const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']\n  const useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']\n  const useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']\n  const useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']\n  const useDevicesList: typeof import('@vueuse/core')['useDevicesList']\n  const useDisplayMedia: typeof import('@vueuse/core')['useDisplayMedia']\n  const useDocumentVisibility: typeof import('@vueuse/core')['useDocumentVisibility']\n  const useDraggable: typeof import('@vueuse/core')['useDraggable']\n  const useElementBounding: typeof import('@vueuse/core')['useElementBounding']\n  const useElementByPoint: typeof import('@vueuse/core')['useElementByPoint']\n  const useElementHover: typeof import('@vueuse/core')['useElementHover']\n  const useElementSize: typeof import('@vueuse/core')['useElementSize']\n  const useElementVisibility: typeof import('@vueuse/core')['useElementVisibility']\n  const useEventBus: typeof import('@vueuse/core')['useEventBus']\n  const useEventListener: typeof import('@vueuse/core')['useEventListener']\n  const useEventSource: typeof import('@vueuse/core')['useEventSource']\n  const useEyeDropper: typeof import('@vueuse/core')['useEyeDropper']\n  const useFavicon: typeof import('@vueuse/core')['useFavicon']\n  const useFetch: typeof import('@vueuse/core')['useFetch']\n  const useFileSystemAccess: typeof import('@vueuse/core')['useFileSystemAccess']\n  const useFocus: typeof import('@vueuse/core')['useFocus']\n  const useFocusWithin: typeof import('@vueuse/core')['useFocusWithin']\n  const useFps: typeof import('@vueuse/core')['useFps']\n  const useFullscreen: typeof import('@vueuse/core')['useFullscreen']\n  const useGamepad: typeof import('@vueuse/core')['useGamepad']\n  const useGeolocation: typeof import('@vueuse/core')['useGeolocation']\n  const useIdle: typeof import('@vueuse/core')['useIdle']\n  const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']\n  const useIntersectionObserver: typeof import('@vueuse/core')['useIntersectionObserver']\n  const useInterval: typeof import('@vueuse/core')['useInterval']\n  const useIntervalFn: typeof import('@vueuse/core')['useIntervalFn']\n  const useKeyModifier: typeof import('@vueuse/core')['useKeyModifier']\n  const useLastChanged: typeof import('@vueuse/core')['useLastChanged']\n  const useLocalStorage: typeof import('@vueuse/core')['useLocalStorage']\n  const useMagicKeys: typeof import('@vueuse/core')['useMagicKeys']\n  const useManualRefHistory: typeof import('@vueuse/core')['useManualRefHistory']\n  const useMediaControls: typeof import('@vueuse/core')['useMediaControls']\n  const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']\n  const useMemoize: typeof import('@vueuse/core')['useMemoize']\n  const useMemory: typeof import('@vueuse/core')['useMemory']\n  const useMounted: typeof import('@vueuse/core')['useMounted']\n  const useMouse: typeof import('@vueuse/core')['useMouse']\n  const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']\n  const useMousePressed: typeof import('@vueuse/core')['useMousePressed']\n  const useMutationObserver: typeof import('@vueuse/core')['useMutationObserver']\n  const useNavigatorLanguage: typeof import('@vueuse/core')['useNavigatorLanguage']\n  const useNetwork: typeof import('@vueuse/core')['useNetwork']\n  const useNow: typeof import('@vueuse/core')['useNow']\n  const useOffsetPagination: typeof import('@vueuse/core')['useOffsetPagination']\n  const useOnline: typeof import('@vueuse/core')['useOnline']\n  const usePageLeave: typeof import('@vueuse/core')['usePageLeave']\n  const useParallax: typeof import('@vueuse/core')['useParallax']\n  const usePermission: typeof import('@vueuse/core')['usePermission']\n  const usePointer: typeof import('@vueuse/core')['usePointer']\n  const usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']\n  const usePreferredColorScheme: typeof import('@vueuse/core')['usePreferredColorScheme']\n  const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']\n  const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']\n  const useRafFn: typeof import('@vueuse/core')['useRafFn']\n  const useRefHistory: typeof import('@vueuse/core')['useRefHistory']\n  const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']\n  const useRoute: typeof import('vue-router')['useRoute']\n  const useRouter: typeof import('vue-router')['useRouter']\n  const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea']\n  const useScriptTag: typeof import('@vueuse/core')['useScriptTag']\n  const useScroll: typeof import('@vueuse/core')['useScroll']\n  const useScrollLock: typeof import('@vueuse/core')['useScrollLock']\n  const useSessionStorage: typeof import('@vueuse/core')['useSessionStorage']\n  const useShare: typeof import('@vueuse/core')['useShare']\n  const useSlots: typeof import('vue')['useSlots']\n  const useSpeechRecognition: typeof import('@vueuse/core')['useSpeechRecognition']\n  const useSpeechSynthesis: typeof import('@vueuse/core')['useSpeechSynthesis']\n  const useStorage: typeof import('@vueuse/core')['useStorage']\n  const useStorageAsync: typeof import('@vueuse/core')['useStorageAsync']\n  const useStyleTag: typeof import('@vueuse/core')['useStyleTag']\n  const useSwipe: typeof import('@vueuse/core')['useSwipe']\n  const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']\n  const useTextSelection: typeof import('@vueuse/core')['useTextSelection']\n  const useThrottle: typeof import('@vueuse/core')['useThrottle']\n  const useThrottledRefHistory: typeof import('@vueuse/core')['useThrottledRefHistory']\n  const useThrottleFn: typeof import('@vueuse/core')['useThrottleFn']\n  const useTimeAgo: typeof import('@vueuse/core')['useTimeAgo']\n  const useTimeout: typeof import('@vueuse/core')['useTimeout']\n  const useTimeoutFn: typeof import('@vueuse/core')['useTimeoutFn']\n  const useTimeoutPoll: typeof import('@vueuse/core')['useTimeoutPoll']\n  const useTimestamp: typeof import('@vueuse/core')['useTimestamp']\n  const useTitle: typeof import('@vueuse/core')['useTitle']\n  const useToggle: typeof import('@vueuse/core')['useToggle']\n  const useTransition: typeof import('@vueuse/core')['useTransition']\n  const useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams']\n  const useUserMedia: typeof import('@vueuse/core')['useUserMedia']\n  const useVibrate: typeof import('@vueuse/core')['useVibrate']\n  const useVirtualList: typeof import('@vueuse/core')['useVirtualList']\n  const useVModel: typeof import('@vueuse/core')['useVModel']\n  const useVModels: typeof import('@vueuse/core')['useVModels']\n  const useWakeLock: typeof import('@vueuse/core')['useWakeLock']\n  const useWebNotification: typeof import('@vueuse/core')['useWebNotification']\n  const useWebSocket: typeof import('@vueuse/core')['useWebSocket']\n  const useWebWorker: typeof import('@vueuse/core')['useWebWorker']\n  const useWebWorkerFn: typeof import('@vueuse/core')['useWebWorkerFn']\n  const useWindowFocus: typeof import('@vueuse/core')['useWindowFocus']\n  const useWindowScroll: typeof import('@vueuse/core')['useWindowScroll']\n  const useWindowSize: typeof import('@vueuse/core')['useWindowSize']\n  const watch: typeof import('vue')['watch']\n  const watchAtMost: typeof import('@vueuse/core')['watchAtMost']\n  const watchDebounced: typeof import('@vueuse/core')['watchDebounced']\n  const watchEffect: typeof import('vue')['watchEffect']\n  const watchIgnorable: typeof import('@vueuse/core')['watchIgnorable']\n  const watchOnce: typeof import('@vueuse/core')['watchOnce']\n  const watchPausable: typeof import('@vueuse/core')['watchPausable']\n  const watchThrottled: typeof import('@vueuse/core')['watchThrottled']\n  const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']\n  const whenever: typeof import('@vueuse/core')['whenever']\n}\nexport {}\n"
  },
  {
    "path": "components.d.ts",
    "content": "// generated by unplugin-vue-components\n// We suggest you to commit this file into source control\n// Read more: https://github.com/vuejs/vue-next/pull/3399\n\ndeclare module 'vue' {\n  export interface GlobalComponents {\n    Confetti: typeof import('./src/components/Confetti.vue')['default']\n    Footer: typeof import('./src/components/Footer.vue')['default']\n    MineBlock: typeof import('./src/components/MineBlock.vue')['default']\n  }\n}\n\nexport { }\n"
  },
  {
    "path": "index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <link rel=\"icon\" href=\"/favicon.svg\" type=\"image/svg+xml\">\n  <title>Minesweeper</title>\n  <meta name=\"description\" content=\"Opinionated Vite Starter Template\">\n</head>\n<body class=\"font-sans dark:text-white dark:bg-hex-121212\">\n  <div id=\"app\"></div>\n  <script>\n    (function() {\n      const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n      const setting = localStorage.getItem('color-schema') || 'auto'\n      if (setting === 'dark' || (prefersDark && setting !== 'light'))\n        document.documentElement.classList.toggle('dark', true)\n    })()\n  </script>\n  <script type=\"module\" src=\"/src/main.ts\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "netlify.toml",
    "content": "[build.environment]\n  NPM_FLAGS = \"--version\"\n  NODE_VERSION = \"16\"\n\n[build]\n  publish = \"dist\"\n  command = \"npx pnpm i --store=node_modules/.pnpm-store && npx pnpm run build\"\n\n[[redirects]]\n  from = \"/*\"\n  to = \"/index.html\"\n  status = 200\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"vite --port 3333 --open\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"lint\": \"eslint .\",\n    \"test\": \"vitest\"\n  },\n  \"dependencies\": {\n    \"@vueuse/core\": \"^8.0.0\",\n    \"canvas-confetti\": \"^1.5.1\",\n    \"seedrandom\": \"^3.0.5\",\n    \"vue\": \"^3.2.31\",\n    \"vue-router\": \"^4.0.14\"\n  },\n  \"devDependencies\": {\n    \"@antfu/eslint-config\": \"^0.18.8\",\n    \"@iconify-json/carbon\": \"^1.1.1\",\n    \"@iconify-json/mdi\": \"^1.1.1\",\n    \"@types/canvas-confetti\": \"^1.4.2\",\n    \"@types/node\": \"^17.0.21\",\n    \"@types/seedrandom\": \"^3.0.2\",\n    \"@unocss/reset\": \"^0.28.0\",\n    \"@vitejs/plugin-vue\": \"^2.2.4\",\n    \"@vue/test-utils\": \"^2.0.0-rc.18\",\n    \"eslint\": \"^8.11.0\",\n    \"jsdom\": \"^19.0.0\",\n    \"pnpm\": \"^6.32.3\",\n    \"typescript\": \"^4.6.2\",\n    \"unocss\": \"^0.28.0\",\n    \"unplugin-auto-import\": \"^0.6.4\",\n    \"unplugin-vue-components\": \"^0.18.0\",\n    \"vite\": \"^2.8.6\",\n    \"vite-plugin-pages\": \"^0.21.4\",\n    \"vitest\": \"^0.6.0\"\n  }\n}\n"
  },
  {
    "path": "public/robots.txt",
    "content": "User-agent: *\nAllow: /\n"
  },
  {
    "path": "shims.d.ts",
    "content": "declare module '*.vue' {\n  import type { DefineComponent } from 'vue'\n  const component: DefineComponent<{}, {}, any>\n  export default component\n}\n"
  },
  {
    "path": "src/App.vue",
    "content": "<template>\n  <main font-sans p=\"y-10\" text=\"center gray-700 dark:gray-200\">\n    <router-view />\n    <Footer />\n  </main>\n</template>\n"
  },
  {
    "path": "src/components/Confetti.vue",
    "content": "<script setup lang=\"ts\">\nimport confetti from 'canvas-confetti'\n\nconst props = defineProps<{\n  passed: boolean\n}>()\n\nfunction congrats() {\n  const defaults = {\n    colors: [\n      '#5D8C7B',\n      '#F2D091',\n      '#F2A679',\n      '#D9695F',\n      '#8C4646',\n    ],\n    shapes: ['square'],\n    ticks: 500,\n  } as confetti.Options\n  confetti({\n    ...defaults,\n    particleCount: 80,\n    spread: 100,\n    origin: { y: 0 },\n  })\n  setTimeout(() => {\n    confetti({\n      ...defaults,\n      particleCount: 50,\n      angle: 60,\n      spread: 80,\n      origin: { x: 0 },\n    })\n  }, 250)\n  setTimeout(() => {\n    confetti({\n      ...defaults,\n      particleCount: 50,\n      angle: 120,\n      spread: 80,\n      origin: { x: 1 },\n    })\n  }, 400)\n}\n\nwatch(\n  () => props.passed,\n  (v) => {\n    if (v)\n      setTimeout(congrats, 300)\n  },\n  { flush: 'post' },\n)\n</script>\n\n<template>\n  <div />\n</template>\n"
  },
  {
    "path": "src/components/Footer.vue",
    "content": "<script setup lang=\"ts\">\nimport { isDark, toggleDark } from '~/composables'\n</script>\n\n<template>\n  <nav text-xl mt-6 inline-flex gap-2>\n    <button class=\"icon-btn !outline-none\" @click=\"toggleDark()\">\n      <div v-if=\"isDark\" i-carbon-moon />\n      <div v-else i-carbon-sun />\n    </button>\n\n    <a\n      class=\"icon-btn\"\n      i-carbon-logo-github\n      rel=\"noreferrer\"\n      href=\"https://github.com/antfu/vue-minesweeper\"\n      target=\"_blank\"\n      title=\"GitHub\"\n    />\n  </nav>\n</template>\n"
  },
  {
    "path": "src/components/MineBlock.vue",
    "content": "<script setup lang=\"ts\">\nimport type { BlockState } from '~/types'\nimport { isDev } from '~/composables'\n\ndefineProps<{ block: BlockState }>()\n\nconst emit = defineEmits<{\n  (e: 'lrclick', event: MouseEvent): void\n}>()\n\nfunction whichButtons(event: MouseEvent) {\n  if (event.buttons === 3)\n    emit('lrclick', event)\n}\n\nconst numberColors = [\n  'text-transparent',\n  'text-blue-500',\n  'text-green-500',\n  'text-yellow-500',\n  'text-orange-500',\n  'text-red-500',\n  'text-purple-500',\n  'text-pink-500',\n  'text-teal-500',\n]\n\nfunction getBlockClass(block: BlockState) {\n  if (block.flagged)\n    return 'bg-gray-500/10'\n  if (!block.revealed)\n    return 'bg-gray-500/10 hover:bg-gray-500/20'\n\n  return block.mine\n    ? 'bg-red-500/50'\n    : numberColors[block.adjacentMines]\n}\n</script>\n\n<template>\n  <button\n    flex=\"~\"\n    items-center justify-center\n    min-w-8 min-h-8 m=\"1px\"\n    border=\"0.5 gray-400/10\"\n    :class=\"getBlockClass(block)\"\n    @mousedown=\"whichButtons\"\n  >\n    <template v-if=\"block.flagged\">\n      <div i-mdi-flag text-red />\n    </template>\n    <template v-else-if=\"block.revealed || isDev\">\n      <div v-if=\"block.mine\" i-mdi-mine />\n      <div v-else font-600>\n        {{ block.adjacentMines }}\n      </div>\n    </template>\n  </button>\n</template>\n"
  },
  {
    "path": "src/components/README.md",
    "content": "## Components\n\nComponents in this dir will be auto-registered and on-demand, powered by [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components).\n\n### Icons\n\nYou can use icons from almost any icon sets by the power of [Iconify](https://iconify.design/).\n\nIt will only bundle the icons you use. Check out [`unplugin-icons`](https://github.com/antfu/unplugin-icons) for more details.\n"
  },
  {
    "path": "src/composables/dark.ts",
    "content": "export const isDark = useDark()\nexport const toggleDark = useToggle(isDark)\n"
  },
  {
    "path": "src/composables/index.ts",
    "content": "export * from './dark'\nexport * from './storage'\n"
  },
  {
    "path": "src/composables/logic.ts",
    "content": "import type { Ref } from 'vue'\n// import type createSeedrandom from 'seedrandom'\nimport type { BlockState } from '~/types'\n\nconst directions = [\n  [1, 1],\n  [1, 0],\n  [1, -1],\n  [0, -1],\n  [-1, -1],\n  [-1, 0],\n  [-1, 1],\n  [0, 1],\n]\n\ntype GameStatus = 'ready' | 'play' | 'won' | 'lost'\n\ninterface GameState {\n  board: BlockState[][]\n  mineGenerated: boolean\n  status: GameStatus\n  startMS?: number\n  endMS?: number\n}\n\nexport class GamePlay {\n  state = ref() as Ref<GameState>\n  // random: ReturnType<typeof createSeedrandom>\n\n  constructor(\n    public width: number,\n    public height: number,\n    public mines: number,\n  ) {\n    this.reset()\n  }\n\n  get board() {\n    return this.state.value.board\n  }\n\n  get blocks() {\n    return this.state.value.board.flat() as BlockState[]\n  }\n\n  reset(\n    width = this.width,\n    height = this.height,\n    mines = this.mines,\n  ) {\n    this.width = width\n    this.height = height\n    this.mines = mines\n\n    this.state.value = {\n      mineGenerated: false,\n      status: 'ready',\n      board: Array.from({ length: this.height }, (_, y) =>\n        Array.from({ length: this.width },\n          (_, x): BlockState => ({\n            x,\n            y,\n            adjacentMines: 0,\n            revealed: false,\n          }),\n        ),\n      ),\n    }\n  }\n\n  randomRange(min: number, max: number) {\n    return Math.random() * (max - min) + min\n  }\n\n  randomInt(min: number, max: number) {\n    return Math.round(this.randomRange(min, max))\n  }\n\n  generateMines(state: BlockState[][], initial: BlockState) {\n    const placeRandom = () => {\n      const x = this.randomInt(0, this.width - 1)\n      const y = this.randomInt(0, this.height - 1)\n      const block = state[y][x]\n      if (Math.abs(initial.x - block.x) <= 1 && Math.abs(initial.y - block.y) <= 1)\n        return false\n      if (block.mine)\n        return false\n      block.mine = true\n      return true\n    }\n    Array.from({ length: this.mines }, () => null)\n      .forEach(() => {\n        let placed = false\n        while (!placed)\n          placed = placeRandom()\n      })\n    this.updateNumbers()\n  }\n\n  updateNumbers() {\n    this.board.forEach((raw) => {\n      raw.forEach((block) => {\n        if (block.mine)\n          return\n        this.getSiblings(block)\n          .forEach((b) => {\n            if (b.mine)\n              block.adjacentMines += 1\n          })\n      })\n    })\n  }\n\n  expendZero(block: BlockState) {\n    if (block.adjacentMines)\n      return\n\n    this.getSiblings(block)\n      .forEach((s) => {\n        if (!s.revealed) {\n          if (!s.flagged)\n            s.revealed = true\n          this.expendZero(s)\n        }\n      })\n  }\n\n  onRightClick(block: BlockState) {\n    if (this.state.value.status !== 'play')\n      return\n\n    if (block.revealed)\n      return\n    block.flagged = !block.flagged\n  }\n\n  onClick(block: BlockState) {\n    if (this.state.value.status === 'ready') {\n      this.state.value.status = 'play'\n      this.state.value.startMS = +new Date()\n    }\n    if (this.state.value.status !== 'play' || block.flagged)\n      return\n\n    if (!this.state.value.mineGenerated) {\n      this.generateMines(this.board, block)\n      this.state.value.mineGenerated = true\n    }\n\n    block.revealed = true\n    if (block.mine) {\n      this.onGameOver('lost')\n      return\n    }\n\n    this.expendZero(block)\n  }\n\n  getSiblings(block: BlockState) {\n    return directions.map(([dx, dy]) => {\n      const x2 = block.x + dx\n      const y2 = block.y + dy\n      if (x2 < 0 || x2 >= this.width || y2 < 0 || y2 >= this.height)\n        return undefined\n      return this.board[y2][x2]\n    })\n      .filter(Boolean) as BlockState[]\n  }\n\n  showAllMines() {\n    this.board.flat().forEach((i) => {\n      if (i.mine)\n        i.revealed = true\n    })\n  }\n\n  checkGameState() {\n    if (!this.state.value.mineGenerated || this.state.value.status !== 'play')\n      return\n    const blocks = this.board.flat()\n\n    if (!blocks.some(block => !block.mine && !block.revealed))\n      this.onGameOver('won')\n  }\n\n  autoExpand(block: BlockState) {\n    if (this.state.value.status !== 'play' || block.flagged)\n      return\n\n    const siblings = this.getSiblings(block)\n    const flags = siblings.reduce((a, b) => a + (b.flagged ? 1 : 0), 0)\n    const notRevealed = siblings.reduce((a, b) => a + (!b.revealed && !b.flagged ? 1 : 0), 0)\n    if (flags === block.adjacentMines) {\n      siblings.forEach((i) => {\n        if (i.revealed || i.flagged)\n          return\n        i.revealed = true\n        this.expendZero(i)\n        if (i.mine)\n          this.onGameOver('lost')\n      })\n    }\n    const missingFlags = block.adjacentMines - flags\n    if (notRevealed === missingFlags) {\n      siblings.forEach((i) => {\n        if (!i.revealed && !i.flagged)\n          i.flagged = true\n      })\n    }\n  }\n\n  onGameOver(status: GameStatus) {\n    this.state.value.status = status\n    this.state.value.endMS = +Date.now()\n    if (status === 'lost') {\n      this.showAllMines()\n      setTimeout(() => {\n        alert('lost')\n      }, 10)\n    }\n  }\n}\n"
  },
  {
    "path": "src/composables/storage.ts",
    "content": "export const isDev = ref(false)\nexport const toggleDev = useToggle(isDev)\n"
  },
  {
    "path": "src/main.ts",
    "content": "import { createApp } from 'vue'\nimport { createRouter, createWebHistory } from 'vue-router'\nimport routes from 'virtual:generated-pages'\nimport App from './App.vue'\n\nimport '@unocss/reset/tailwind.css'\nimport './styles/main.css'\nimport 'uno.css'\n\nconst app = createApp(App)\nconst router = createRouter({\n  history: createWebHistory(import.meta.env.BASE_URL),\n  routes,\n})\napp.use(router)\napp.mount('#app')\n"
  },
  {
    "path": "src/pages/README.md",
    "content": "## File-based Routing\n\nRoutes will be auto-generated for Vue files in this dir with the same file structure.\nCheck out [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) for more details.\n\n### Path Aliasing\n\n`~/` is aliased to `./src/` folder.\n\nFor example, instead of having\n\n```ts\nimport { isDark } from '../../../../composables'\n```\n\nnow, you can use\n\n```ts\nimport { isDark } from '~/composables'\n```\n"
  },
  {
    "path": "src/pages/index.vue",
    "content": "<script setup lang=\"ts\">\n// import { isDev, toggleDev } from '~/composables'\nimport { GamePlay } from '~/composables/logic'\n\nconst play = new GamePlay(9, 9, 10)\n\nconst now = $(useNow())\nconst timerMS = $computed(() => Math.round(((play.state.value.endMS ?? +now) - (play.state.value.startMS ?? +now)) / 1000))\n\nuseStorage('vuesweeper-state', play.state)\nconst state = $computed(() => play.board)\n\nconst mineRest = $computed(() => {\n  if (!play.state.value.mineGenerated)\n    return play.mines\n  return play.blocks.reduce((a, b) => a - (b.flagged ? 1 : 0), play.mines)\n})\n\nfunction newGame(difficulty: 'easy' | 'medium' | 'hard') {\n  switch (difficulty) {\n    case 'easy':\n      play.reset(9, 9, 10)\n      break\n    case 'medium':\n      play.reset(16, 16, 40)\n      break\n    case 'hard':\n      play.reset(16, 30, 99)\n      break\n  }\n}\n\nwatchEffect(() => {\n  play.checkGameState()\n})\n</script>\n\n<template>\n  <div>\n    Minesweeper\n\n    <div flex=\"~ gap1\" justify-center p4>\n      <button btn @click=\"play.reset()\">\n        New Game\n      </button>\n      <button btn @click=\"newGame('easy')\">\n        Easy\n      </button>\n      <button btn @click=\"newGame('medium')\">\n        Medium\n      </button>\n      <button btn @click=\"newGame('hard')\">\n        Hard\n      </button>\n    </div>\n\n    <div flex=\"~ gap-10\" justify-center>\n      <div font-mono text-2xl flex=\"~ gap-1\" items-center>\n        <div i-carbon-timer />\n        {{ timerMS }}\n      </div>\n      <div font-mono text-2xl flex=\"~ gap-1\" items-center>\n        <div i-mdi-mine />\n        {{ mineRest }}\n      </div>\n    </div>\n\n    <div p5 w-full overflow-auto>\n      <div\n        v-for=\"row, y in state\"\n        :key=\"y\"\n        flex=\"~\"\n        items-center justify-center w-max ma\n      >\n        <MineBlock\n          v-for=\"block, x in row\" :key=\"x\"\n          :block=\"block\"\n          @click=\"play.onClick(block)\"\n          @lrclick=\"play.autoExpand(block)\"\n          @contextmenu.prevent=\"play.onRightClick(block)\"\n        />\n      </div>\n    </div>\n\n    <!-- <div flex=\"~ gap-1\" justify-center>\n      <button btn @click=\"toggleDev()\">\n        {{ isDev ? 'DEV' : 'NORMAL' }}\n      </button>\n    </div> -->\n\n    <Confetti :passed=\"play.state.value.status === 'won'\" />\n  </div>\n</template>\n"
  },
  {
    "path": "src/styles/main.css",
    "content": "html,\nbody,\n#app {\n  height: 100%;\n  margin: 0;\n  padding: 0;\n}\n\nhtml.dark {\n  background: #121212;\n}\n"
  },
  {
    "path": "src/types.ts",
    "content": "export interface BlockState {\n  x: number\n  y: number\n  revealed: boolean\n  mine?: boolean\n  flagged?: boolean\n  adjacentMines: number\n}\n"
  },
  {
    "path": "test/__snapshots__/component.test.ts.snap",
    "content": "// Vitest Snapshot v1\n\nexports[`Counter.vue > should render 1`] = `\"<div>10 <button class=\\\\\"inc\\\\\"> + </button><button class=\\\\\"dec\\\\\"> - </button></div>\"`;\n"
  },
  {
    "path": "test/basic.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\n\ndescribe('Hi', () => {\n  it('should works', () => {\n    expect(1 + 1).toEqual(2)\n  })\n})\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"module\": \"ESNext\",\n    \"target\": \"es2016\",\n    \"lib\": [\"DOM\", \"ESNext\"],\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"incremental\": false,\n    \"skipLibCheck\": true,\n    \"moduleResolution\": \"node\",\n    \"resolveJsonModule\": true,\n    \"noUnusedLocals\": true,\n    \"strictNullChecks\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"types\": [\n      \"vite/client\",\n      \"vite-plugin-pages/client\"\n    ],\n    \"paths\": {\n      \"~/*\": [\"src/*\"]\n    }\n  },\n  \"exclude\": [\"dist\", \"node_modules\"]\n}\n"
  },
  {
    "path": "unocss.config.ts",
    "content": "import {\n  defineConfig,\n  presetAttributify,\n  presetIcons,\n  presetUno,\n  transformerDirectives,\n  transformerVariantGroup,\n} from 'unocss'\n\nexport default defineConfig({\n  shortcuts: [\n    ['btn', 'px-4 py-1 rounded inline-block bg-teal-600 text-white cursor-pointer hover:bg-teal-700 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],\n    ['icon-btn', 'text-[0.9em] inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600'],\n  ],\n  presets: [\n    presetUno(),\n    presetAttributify(),\n    presetIcons({\n      scale: 1.2,\n      warn: true,\n    }),\n  ],\n  transformers: [\n    transformerDirectives(),\n    transformerVariantGroup(),\n  ],\n})\n"
  },
  {
    "path": "vite.config.ts",
    "content": "/// <reference types=\"vitest\" />\n\nimport path from 'path'\nimport { defineConfig } from 'vite'\nimport Vue from '@vitejs/plugin-vue'\nimport Pages from 'vite-plugin-pages'\nimport Components from 'unplugin-vue-components/vite'\nimport AutoImport from 'unplugin-auto-import/vite'\nimport Unocss from 'unocss/vite'\n\nexport default defineConfig({\n  resolve: {\n    alias: {\n      '~/': `${path.resolve(__dirname, 'src')}/`,\n    },\n  },\n  plugins: [\n    Vue({\n      reactivityTransform: true,\n    }),\n\n    // https://github.com/hannoeru/vite-plugin-pages\n    Pages(),\n\n    // https://github.com/antfu/unplugin-auto-import\n    AutoImport({\n      imports: [\n        'vue',\n        'vue/macros',\n        'vue-router',\n        '@vueuse/core',\n      ],\n      dts: true,\n    }),\n\n    // https://github.com/antfu/vite-plugin-components\n    Components({\n      dts: true,\n    }),\n\n    // https://github.com/antfu/unocss\n    // see unocss.config.ts for config\n    Unocss(),\n  ],\n\n  // https://github.com/vitest-dev/vitest\n  test: {\n    environment: 'jsdom',\n  },\n})\n"
  }
]