From 2f63d2004f88c42edd186e55e217d7717843b72f Mon Sep 17 00:00:00 2001 From: Okiki Date: Tue, 12 Oct 2021 07:10:31 +0000 Subject: [PATCH] refactor: polish up bundle for https://appsco.pe --- README.md | 4 +- gulpfile.js | 16 +-- package.json | 4 +- pnpm-lock.yaml | 56 ++++----- src/assets/_headers | 2 +- src/assets/manifest.json | 2 +- src/css/app.scss | 165 ++++++++++++++------------- src/css/components/_highlightjs.scss | 3 +- src/css/components/_monaco.scss | 125 +++++++++++++++++--- src/css/components/_navbar.scss | 20 +++- src/css/components/_search.scss | 6 +- src/pug/components/footer.pug | 19 +-- src/pug/components/navbar.pug | 25 ++-- src/pug/index.pug | 40 ++++--- src/pug/layouts/layout.pug | 6 +- src/ts/components/SearchResults.tsx | 11 +- src/ts/critical.ts | 112 +++++++++--------- src/ts/index.ts | 50 +++++--- src/ts/modules/accordion.ts | 129 +++++++++++++++++++++ src/ts/modules/monaco.ts | 2 +- src/ts/services/Navbar.ts | 5 +- tailwind.config.cjs | 3 + 22 files changed, 552 insertions(+), 253 deletions(-) create mode 100644 src/ts/modules/accordion.ts diff --git a/README.md b/README.md index c2703fc..1802f81 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ You would add this to the url [bundle.js.org/?q=react,react-dom,vue,@okikio/anim If you only want a couple packages and don't care to treeshake, then all you need is something like this, [bundle.js.org?q=react,react-dom,vue,@okikio/animate](https://bundle.js.org/?q=react,react-dom,vue,@okikio/animate) -There is another way to share a reproduciable bundle, the sharable link. Shareble links look like this [/?share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA](https://bundle.js.org/?share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA) with the string value of the input code editor being compressed into a string and placed into the URL. +There is another way to share a reproduciable bundle, the sharable link. Shareble links look like this [/?share=PTAEGEB...](https://bundle.js.org/?share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA) with the string value of the input code editor being compressed into a string and placed into the URL. In order to create a shareble link, you click the `Share` button, it copies the share url to your clipboard, and from there you can paste where you wish. -> If you would like to bundle your code when the share URL is loaded, add `bundle` to the url, e.g. [/?q=@okikio/animate&bundle](https://bundle.js.org/?q=@okikio/animate&bundle) or [/?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA](https://bundle.js.org/?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA) +> If you would like to bundle your code when the share URL is loaded, add `bundle` to the url, e.g. [/?bundle&q=@okikio/animate](https://bundle.js.org/?q=@okikio/animate&bundle) or [/?bundle&share=PTAEGEBs...](https://bundle.js.org/?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA) ## Badges diff --git a/gulpfile.js b/gulpfile.js index ac3ac4d..b4f95d3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -226,19 +226,19 @@ task("service-worker", async () => { // Define runtime caching rules. runtimeCaching: [ { - // Match any request that ends with .png, .jpg, .jpeg, .svg, etc.... - urlPattern: /workbox\-(.*).js|\.(?:png|jpg|jpeg|svg|webp|woff2|map|wasm|json|ts|css)$/, + // Match any request that starts with https://cdn.polyfill.io + urlPattern: /^https:\/\/(?:cdn\.polyfill\.io)|(?:api\.producthunt\.com)|(?:api\.countapi\.xyz)/, - // Apply a stale-while-revalidate strategy. - handler: "StaleWhileRevalidate", + // Apply a network-first strategy. + handler: "NetworkFirst", method: "GET", }, { - // Match any request that starts with https://cdn.polyfill.io - urlPattern: /^https:\/\/cdn\.polyfill\.io/, + // Match any request that ends with .png, .jpg, .jpeg, .svg, etc.... + urlPattern: /workbox\-(.*).js|\.(?:png|jpg|jpeg|svg|webp|woff2|map|wasm|json|ts|css)$/, - // Apply a network-first strategy. - handler: "NetworkFirst", + // Apply a stale-while-revalidate strategy. + handler: "StaleWhileRevalidate", method: "GET", }, ], diff --git a/package.json b/package.json index 18875d3..235f82c 100644 --- a/package.json +++ b/package.json @@ -49,14 +49,14 @@ "path": "^0.12.7", "prettier": "^2.4.1", "pretty-bytes": "^5.6.0", - "solid-js": "^1.1.5", + "solid-js": "^1.1.6", "stream": "^0.0.2", "typescript": "^4.4.3", "web-animations-js": "^2.3.2", "workbox-window": "^6.3.0" }, "devDependencies": { - "@commitlint/cli": "^13.2.0", + "@commitlint/cli": "^13.2.1", "@commitlint/config-conventional": "^13.2.0", "@csstools/postcss-sass": "^4.0.0", "@types/node": "^16.10.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a05392..adb225b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,7 +2,7 @@ lockfileVersion: 5.3 specifiers: '@amoutonbrady/lz-string': ^0.0.1 - '@commitlint/cli': ^13.2.0 + '@commitlint/cli': ^13.2.1 '@commitlint/config-conventional': ^13.2.0 '@csstools/postcss-sass': ^4.0.0 '@okikio/animate': ^2.4.0 @@ -48,7 +48,7 @@ specifiers: pretty-bytes: ^5.6.0 rollup: ^2.58.0 sass: ^1.42.1 - solid-js: ^1.1.5 + solid-js: ^1.1.6 standard-version: ^9.3.1 stream: ^0.0.2 tailwindcss: ^2.2.16 @@ -76,23 +76,23 @@ dependencies: path: 0.12.7 prettier: 2.4.1 pretty-bytes: 5.6.0 - solid-js: 1.1.5 + solid-js: 1.1.6 stream: 0.0.2 typescript: 4.4.3 web-animations-js: 2.3.2 workbox-window: 6.3.0 devDependencies: - '@commitlint/cli': 13.2.0_typescript@4.4.3 + '@commitlint/cli': 13.2.1 '@commitlint/config-conventional': 13.2.0 '@csstools/postcss-sass': 4.0.0 '@types/node': 16.10.3 autoprefixer: 10.3.7_postcss@8.3.9 browser-sync: 2.27.5 - commitizen: 4.2.4_typescript@4.4.3 + commitizen: 4.2.4 del: 6.0.0 esbuild: 0.13.4 - esbuild-plugin-solid: 0.4.0_esbuild@0.13.4+solid-js@1.1.5 + esbuild-plugin-solid: 0.4.0_esbuild@0.13.4+solid-js@1.1.6 fibers: 5.0.0 gulp: 4.0.2 gulp-changed: 4.0.3_gulp@4.0.2 @@ -1284,22 +1284,20 @@ packages: to-fast-properties: 2.0.0 dev: true - /@commitlint/cli/13.2.0_typescript@4.4.3: - resolution: {integrity: sha512-RqG0cxxiwaL9OgQbA2ZEfZaVIRJmbtsZgnj5G07AjN7///s/40grSN4/kDl8YjUgvAZskPfJRoGGYNvHJ4zHWA==} + /@commitlint/cli/13.2.1: + resolution: {integrity: sha512-JGzYk2ay5JkRS5w+FLQzr0u/Kih52ds4HPpa3vnwVOQN8Q+S1VYr8Nk/6kRm6uNYsAcC1nejtuDxRdLcLh/9TA==} engines: {node: '>=v12'} hasBin: true dependencies: '@commitlint/format': 13.2.0 '@commitlint/lint': 13.2.0 - '@commitlint/load': 13.2.0_typescript@4.4.3 + '@commitlint/load': 13.2.1 '@commitlint/read': 13.2.0 '@commitlint/types': 13.2.0 lodash: 4.17.21 resolve-from: 5.0.0 resolve-global: 1.0.0 yargs: 17.2.1 - transitivePeerDependencies: - - typescript dev: true /@commitlint/config-conventional/13.2.0: @@ -1348,8 +1346,8 @@ packages: '@commitlint/types': 13.2.0 dev: true - /@commitlint/load/13.2.0_typescript@4.4.3: - resolution: {integrity: sha512-Nhkv+hwWCCxWGjmE9jd1U8kfGGCkZVpwzlTtdKxpY+Aj2VCFg3BjY+qA81pMF3oAsIpxchSaZG5llb8kduVjYg==} + /@commitlint/load/13.2.1: + resolution: {integrity: sha512-qlaJkj0hfa9gtWRfCfbgFBTK3GYQRmjZhba4l9mUu4wV9lEZ4ICFlrLtd/8kaLXf/8xbrPhkAPkVFOAqM0YwUQ==} engines: {node: '>=v12'} dependencies: '@commitlint/execute-rule': 13.2.0 @@ -1360,8 +1358,7 @@ packages: cosmiconfig: 7.0.1 lodash: 4.17.21 resolve-from: 5.0.0 - transitivePeerDependencies: - - typescript + typescript: 4.4.3 dev: true /@commitlint/message/13.2.0: @@ -2377,7 +2374,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001265 - electron-to-chromium: 1.3.861 + electron-to-chromium: 1.3.866 escalade: 3.1.1 node-releases: 1.1.77 picocolors: 0.2.1 @@ -2711,13 +2708,13 @@ packages: engines: {node: '>= 6'} dev: true - /commitizen/4.2.4_typescript@4.4.3: + /commitizen/4.2.4: resolution: {integrity: sha512-LlZChbDzg3Ir3O2S7jSo/cgWp5/QwylQVr59K4xayVq8S4/RdKzSyJkghAiZZHfhh5t4pxunUoyeg0ml1q/7aw==} engines: {node: '>= 10'} hasBin: true dependencies: cachedir: 2.2.0 - cz-conventional-changelog: 3.2.0_typescript@4.4.3 + cz-conventional-changelog: 3.2.0 dedent: 0.7.0 detect-indent: 6.0.0 find-node-modules: 2.1.2 @@ -2730,8 +2727,6 @@ packages: minimist: 1.2.5 strip-bom: 4.0.0 strip-json-comments: 3.0.1 - transitivePeerDependencies: - - typescript dev: true /common-tags/1.8.0: @@ -3143,20 +3138,18 @@ packages: css-tree: 1.1.3 dev: true - /cz-conventional-changelog/3.2.0_typescript@4.4.3: + /cz-conventional-changelog/3.2.0: resolution: {integrity: sha512-yAYxeGpVi27hqIilG1nh4A9Bnx4J3Ov+eXy4koL3drrR+IO9GaWPsKjik20ht608Asqi8TQPf0mczhEeyAtMzg==} engines: {node: '>= 10'} dependencies: chalk: 2.4.2 - commitizen: 4.2.4_typescript@4.4.3 + commitizen: 4.2.4 conventional-commit-types: 3.0.0 lodash.map: 4.6.0 longest: 2.0.1 word-wrap: 1.2.3 optionalDependencies: - '@commitlint/load': 13.2.0_typescript@4.4.3 - transitivePeerDependencies: - - typescript + '@commitlint/load': 13.2.1 dev: true /d/1.0.1: @@ -3463,8 +3456,8 @@ packages: requiresBuild: true dev: true - /electron-to-chromium/1.3.861: - resolution: {integrity: sha512-GZyflmpMnZRdZ1e2yAyvuFwz1MPSVQelwHX4TJZyXypB8NcxdPvPNwy5lOTxnlkrK13EiQzyTPugRSnj6cBgKg==} + /electron-to-chromium/1.3.866: + resolution: {integrity: sha512-iYze6TpDXWxk+sfcpUUdTs6Pv/3kG45Pnjer2DxEeFw0N08bZeNLuz97s2lMgy8yObon48o0WHY2Bkg3xuAPOA==} dev: true /elliptic/3.1.0: @@ -3716,7 +3709,7 @@ packages: dev: true optional: true - /esbuild-plugin-solid/0.4.0_esbuild@0.13.4+solid-js@1.1.5: + /esbuild-plugin-solid/0.4.0_esbuild@0.13.4+solid-js@1.1.6: resolution: {integrity: sha512-HSFp04cHuMufxWE/KtDdP9Cnn/7Gm33DKZk5CF/VIDZglj0EDizBigz7gUhxt2qckUyqW5hUIuGjs+d4FdmwuQ==} peerDependencies: esbuild: ^0.11 @@ -3726,7 +3719,7 @@ packages: '@babel/preset-typescript': 7.15.0_@babel+core@7.15.8 babel-preset-solid: 1.1.5_@babel+core@7.15.8 esbuild: 0.13.4 - solid-js: 1.1.5 + solid-js: 1.1.6 transitivePeerDependencies: - supports-color dev: true @@ -7484,8 +7477,8 @@ packages: - utf-8-validate dev: true - /solid-js/1.1.5: - resolution: {integrity: sha512-cwMNe1U/1bqCTMco2za6LDU66jDn/57m5kfrDUhW3ls9YIbaREdktqPFGULrill22qyoFDngEg5hgm6a6vf6wg==} + /solid-js/1.1.6: + resolution: {integrity: sha512-o7Nm654Q9vF+W293P1pxr2uv1dYhTjDM0tsYnmQTcNCvUcGMlW947SE3fx4pvH1Rcrjm549HkNy50Ors3D4+zQ==} dev: false /source-map-js/0.6.2: @@ -8135,7 +8128,6 @@ packages: resolution: {integrity: sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==} engines: {node: '>=4.2.0'} hasBin: true - dev: false /ua-parser-js/0.7.28: resolution: {integrity: sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==} diff --git a/src/assets/_headers b/src/assets/_headers index 1c89e0d..fb201a5 100644 --- a/src/assets/_headers +++ b/src/assets/_headers @@ -5,7 +5,7 @@ Referrer-Policy: strict-origin-when-cross-origin Strict-Transport-Security: max-age=63072000; includeSubDomains; preload Cache-Control: max-age=360, stale-while-revalidate=480, public - Accept-CH: DPR, Viewport-Width, Width + Accept-CH: DPR, Viewport-Width, Widthyo X-UA-Compatible: IE=edge Content-Security-Policy: default-src 'self'; font-src 'self' https://fonts.gstatic.com; style-src 'self' 'unsafe-inline'; img-src 'self' https://res.cloudinary.com https://api.producthunt.com data:; script-src 'self' https://cdn.polyfill.io 'unsafe-eval'; connect-src 'self' https:; block-all-mixed-content; upgrade-insecure-requests; base-uri 'self'; object-src 'none'; worker-src 'self'; manifest-src 'self'; media-src 'self' https://res.cloudinary.com; form-action 'self'; frame-ancestors 'self' https:; Permissions-Policy: geolocation=(), microphone=(), usb=(), sync-xhr=(self), camera=(), interest-cohort=() diff --git a/src/assets/manifest.json b/src/assets/manifest.json index 344d7f6..986d950 100644 --- a/src/assets/manifest.json +++ b/src/assets/manifest.json @@ -7,7 +7,7 @@ "display": "standalone", "theme_color": "#000000", "background_color": "#000000", - "description": "a quick npm package size checker", + "description": "a quick and easy way to bundle your js projects, minify and see their gzipped size, all locally on your device", "icons": [ { "src": "/favicon/android-chrome-192x192.png", diff --git a/src/css/app.scss b/src/css/app.scss index 0413ad3..9832c4a 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -66,10 +66,18 @@ a { @apply dark:text-blue-400 dark:hover:text-blue-200; } +textarea, +form, input, button, +select, a { - -webkit-tap-highlight-color: transparent; + &, + &:focus, + &:hover, + &:active { + -webkit-tap-highlight-color: transparent; + } } button, @@ -106,7 +114,9 @@ main { word-wrap: break-word; @supports (padding-top: env(safe-area-inset-top, 0)) { - padding-right: calc(theme("spacing.5") + env(safe-area-inset-right)); + padding-right: calc( + theme("spacing.5") + env(safe-area-inset-right) + ); padding-left: calc(theme("spacing.5") + env(safe-area-inset-left)); } } @@ -131,6 +141,14 @@ main { #faq { @apply px-5 pt-24; + h4 { + @apply pt-12; + } + + h4:first-of-type { + @apply pt-4; + } + p { @apply text-lg; } @@ -156,6 +174,10 @@ main { #product-hunt { @apply flex mb-6; + a:focus-visible { + @apply rounded-xl; + } + figure { position: relative; width: 250px; @@ -184,13 +206,17 @@ html.dark hr { } footer.footer { - @apply text-gray-600 text-right dark:text-secondary; + @apply text-gray-600 text-left dark:text-secondary; .container { @apply p-5 align-middle sm:max-w-screen-md; } } +#visit-counter { + @apply tabular-nums; +} + #copy-input { position: absolute; top: -50px; @@ -227,7 +253,6 @@ footer.footer { } .btn { - transition: opacity ease 0.25s; @apply px-3 py-2 rounded-md no-underline hover:bg-gray-200; @apply text-blue-600 dark:text-blue-400 dark:hover:bg-quaternary; @@ -241,90 +266,28 @@ footer.footer { } } +.btn, button, #product-hunt a { + transition: opacity ease 0.25s, transform ease-in-out 0.125s, box-shadow ease 0.25s; + @apply transform scale-100; + + &:active { + @apply scale-[0.8]; + } +} + .btn-share { @apply rounded-md ml-2; @apply text-blue-500 bg-gray-100 hover:bg-gray-200; @apply dark:text-blue-400 dark:bg-quaternary; @apply dark:hover:bg-gray-800 dark:active:bg-gray-700; @apply focus-visible:border-blue-600 focus-visible:ring-4 focus:rounded-md; + min-width: 9ch; } .opacity-0 { opacity: 0; } -.offline-icon { - @apply px-3 py-2 rounded-md; - @apply flex items-center justify-center bg-blue-600 text-black; - &.online { - display: none; - } - svg { - vertical-align: middle; - fill: currentColor; - width: 1em; - } -} - -.editor-btns { - transition: opacity ease 0.8s; - @apply absolute bottom-2 right-0 px-5 w-full flex-wrap; - opacity: 0; - pointer-events: none; - @apply flex gap-2; -} - -.editor-btns.delay { - opacity: 1; -} - -.app:hover .editor-btns, -.app:focus-within .editor-btns { - transition: opacity ease-out 0.5s; - opacity: 1; - pointer-events: none; -} - -.editor-btns { - button { - @apply flex items-center justify-center; - @apply bg-gray-100 dark:bg-gray-600 text-blue-400 dark:text-white; - @apply hover:bg-gray-200 dark:hover:bg-gray-700; - @apply px-3 py-2 rounded-md z-10; - @apply flex items-center justify-center; - pointer-events: auto; - - @supports (backdrop-filter: blur(5px)) { - @apply bg-opacity-50 dark:bg-opacity-50 backdrop-filter backdrop-blur-sm; - } - - svg { - @apply text-lg; - vertical-align: middle; - fill: currentColor; - width: 1em; - } - } - - .copy-container { - @apply relative z-10; - } - - .editor-info { - @apply absolute top-0 right-0 z-0; - transform: translateY(100px); - - &, - &:hover { - @apply bg-white dark:bg-gray-800 text-blue-500 dark:text-blue-500; - - @supports (backdrop-filter: blur(5px)) { - @apply bg-opacity-50 dark:bg-opacity-60 backdrop-filter backdrop-blur-sm; - } - } - } -} - .prompt-container { @apply w-full h-full z-10 flex items-end justify-end; @apply fixed top-0 left-0 pointer-events-none; @@ -341,6 +304,7 @@ footer.footer { @apply p-2 bg-gray-200 dark:bg-gray-900 rounded-lg; @apply pointer-events-auto; @apply absolute bottom-0 right-0; + visibility: hidden; transform: translateY(200px); @supports (backdrop-filter: blur(5px)) { @@ -383,8 +347,55 @@ footer.footer { @apply px-2 py-2 rounded-md ml-2; // color-scheme: light; } +details { + .content { + padding-left: 2ch; + @apply py-4; + } + summary::marker { + content: ""; + } + summary { + @apply relative cursor-pointer; + padding-left: 2ch; + &:before { + font-family: 'Material Icons Round'; + font-size: 24px; + font-weight: normal; + font-style: normal; + line-height: 1; + letter-spacing: normal; + text-transform: none; + display: inline-block; + white-space: nowrap; + word-wrap: normal; + direction: ltr; + -webkit-font-smoothing: antialiased; + + content: "► "; + content: "chevron_right"; + @apply absolute top-1/2; + left: 0.25ch; + @apply text-2xl text-gray-800/80 dark:text-gray-200/60; + transform: translate(0, -50%); + } + } + summary:before { + transition: transform 0.2s ease-in-out, color ease 0.2s; + transform: translate(0, -50%) rotateZ(0deg); + } + &[open] > summary { + // @apply text-blue-500; + &:before { + @apply text-gray-600/60 dark:text-gray-400/60; + // content: "▼ "; + // content: "\f2a2"; + transform: translate(0, -50%) rotateZ(90deg); + } + } +} // html.dark .theme-options { // color-scheme: dark; // @apply bg-black; -// } \ No newline at end of file +// } diff --git a/src/css/components/_highlightjs.scss b/src/css/components/_highlightjs.scss index 0accdd9..2941e27 100644 --- a/src/css/components/_highlightjs.scss +++ b/src/css/components/_highlightjs.scss @@ -22,8 +22,9 @@ code { } pre { padding-top: 15px; + } -pre code.hljs { +pre code { display: block; overflow-x: auto; padding: 15px; diff --git a/src/css/components/_monaco.scss b/src/css/components/_monaco.scss index fe1ade7..69950f4 100644 --- a/src/css/components/_monaco.scss +++ b/src/css/components/_monaco.scss @@ -1,4 +1,5 @@ .flex-wrapper { + --cols: 1fr; @apply w-full relative pb-6 mb-8; @apply grid gap-3; // grid-template-columns: auto; @@ -8,6 +9,7 @@ @screen lt-sm { grid-template-rows: auto auto; + grid-template-rows: var(--cols) var(--cols); // grid-flow: rows; // @apply grid-flow-row; @@ -16,6 +18,7 @@ @screen sm { min-height: 350px - 56px; grid-template-columns: auto auto; + grid-template-columns: var(--cols) var(--cols); @apply grid-rows-1; } @@ -23,6 +26,10 @@ @screen md { min-height: 400px - 56px; } + + &.loaded { + --cols: auto; + } } .emulate-monaco { @@ -45,12 +52,6 @@ padding-bottom: 15px; height: 100%; - resize: horizontal; - - @screen lt-sm { - resize: vertical; - } - overflow: hidden; font-family: Consolas, "Courier New", monospace; @@ -61,32 +62,53 @@ letter-spacing: 0px; } +.flex-wrapper.loaded .app { + resize: horizontal; + + @screen lt-sm { + resize: vertical; + } +} + .app#output { resize: none; height: 100%; } -.push-to-side { - @apply flex align-middle justify-end flex-1 gap-2; +.info-pane { + @apply flex w-full lt-sm:flex-col align-middle gap-2 lt-sm:gap-3; flex-wrap: nowrap; + #bundle-time { + @apply w-full; + min-height: theme("spacing.6"); + } + + .action-btns-overflow { + @apply py-1; + overflow-x: auto; + width: 100%; + } + + .action-btns { + @apply flex w-full align-middle gap-2; + position: relative; + } + .btn { margin: 0; } } -.push-to-side-overflow { - overflow-x: auto; - position: relative; - display: flex; -} - .file-size { @apply inline-block px-4 py-2 rounded-md; @apply text-center flex justify-center items-center; @apply bg-gray-200 dark:bg-quaternary; @apply text-gray-500 dark:text-secondary; - min-width: theme("spacing.40"); + // min-width: theme("spacing.24"); + min-width: 18ch; + white-space: nowrap; + min-height: theme("spacing.12"); } @@ -170,3 +192,76 @@ width: calc(100% - 20px); border-radius: 4px; } + +.offline-icon { + @apply px-3 py-2 rounded-md; + @apply flex items-center justify-center bg-blue-600 text-black; + &.online { + display: none; + } + svg { + vertical-align: middle; + fill: currentColor; + width: 1em; + } +} + +.editor-btns { + transition: opacity ease 0.8s; + @apply absolute bottom-2 right-0 px-5 w-full flex-wrap; + opacity: 0; + pointer-events: none; + @apply flex gap-2; +} + +.editor-btns.delay { + opacity: 1; +} + +.app:hover .editor-btns, +.app:focus-within .editor-btns { + transition: opacity ease-out 0.5s; + opacity: 1; + pointer-events: none; +} + +.editor-btns { + button { + @apply flex items-center justify-center; + @apply bg-gray-100 border dark:bg-gray-600 text-blue-400 dark:text-white; + @apply hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:border-gray-500; + @apply px-3 py-2 rounded-md z-10; + @apply flex items-center justify-center; + pointer-events: auto; + + @supports (backdrop-filter: blur(5px)) { + @apply bg-opacity-50 dark:bg-opacity-50 backdrop-filter backdrop-blur-sm; + } + + svg { + @apply text-lg; + vertical-align: middle; + fill: currentColor; + width: 1em; + } + } + + .copy-container { + @apply relative z-[5]; + // z-index: 5; + } + + .editor-info { + @apply absolute top-0 right-0 z-0; + transform: translateY(100px); + + &, + &:hover { + @apply bg-white dark:bg-gray-800 text-blue-500 dark:text-blue-500; + + @supports (backdrop-filter: blur(5px)) { + @apply bg-opacity-50 dark:bg-opacity-60 backdrop-filter backdrop-blur-sm; + } + } + } +} diff --git a/src/css/components/_navbar.scss b/src/css/components/_navbar.scss index bfc1954..3cbeeb9 100644 --- a/src/css/components/_navbar.scss +++ b/src/css/components/_navbar.scss @@ -80,18 +80,22 @@ @screen lt-md { --height: 100vh; - transition: height ease-out 0.35s; + transition: height ease-out 0.35s, transform ease-out 0.35s; @apply flex-grow; flex-basis: 100%; overflow-y: hidden; + @apply transform; + transform-origin: top center; &.show { height: 100%; height: var(--height, 100vh); + @apply scale-100; } &.collapse { height: 0; + @apply scale-[0.8]; } } } @@ -129,11 +133,19 @@ .theme-toggle, .navbar-logo, .navbar-list a { - transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out; + transition: transform ease-in-out 0.15s, border-color 0.2s ease-out, + box-shadow 0.2s ease-out; @screen md { - transition: background-color 0.15s ease-out, color 0.15s ease-out, - border-color 0.2s ease-out, box-shadow 0.2s ease-out; + transition: transform ease-in-out 0.15s, background-color 0.15s ease-out, + color 0.15s ease-out, border-color 0.2s ease-out, + box-shadow 0.2s ease-out; + } + + @apply transform scale-100; + + &:active { + @apply scale-90; } } diff --git a/src/css/components/_search.scss b/src/css/components/_search.scss index c3fa77b..5ede13a 100644 --- a/src/css/components/_search.scss +++ b/src/css/components/_search.scss @@ -1,4 +1,6 @@ .search { + + transition: box-shadow ease 0.25s; // @apply transition duration-300 ease-out; @apply focus-within:ring-4 focus-within:ring-blue-500 focus-within:ring-opacity-50; @apply bg-gray-200 dark:bg-quaternary rounded-lg; @@ -87,14 +89,14 @@ } &.add { - @apply transition transform scale-100 active:scale-90; + // @apply transition transform scale-100 active:scale-90; @apply flex sm:text-center sm:col-span-3; justify-content: end; align-items: center; .btn { @apply w-full relative block m-0; - @apply transition duration-150; + // @apply transition duration-150; @apply bg-gray-200 dark:bg-quaternary; @apply hover:bg-blue-200 dark:hover:bg-gray-600; @apply active:bg-blue-100 dark:active:bg-gray-800; diff --git a/src/pug/components/footer.pug b/src/pug/components/footer.pug index dfc7372..088c419 100644 --- a/src/pug/components/footer.pug +++ b/src/pug/components/footer.pug @@ -1,15 +1,18 @@ mixin footer footer.footer.my-6 - .container.flex.flex-wrap.gap-2 - div.text-left - label(for="pet-select") Change Theme: + .container.flex.flex-wrap.gap-2(class="flex-col sm:flex-row") + .flex.flex-grow + div + label(for="pet-select") Change Theme: - select.theme-options - option(value="system" selected) System - option(value="light") Light - option(value="dark") Dark + select.theme-options + option(value="system" selected) System + option(value="light") Light + option(value="dark") Dark + .flex-grow(class="text-right") + div.px-4.py-2.inline-block (c) 2021 Okiki Ojo .flex-grow - div.text-right + div.flex.flex-wrap.gap-2.justify-end p.bg-gray-200(class="dark:bg-quaternary").inline-block.px-4.py-2.rounded-md span=" Made by " a(href='https://github.com/okikio' target='_blank' rel="noopener") Okiki Ojo diff --git a/src/pug/components/navbar.pug b/src/pug/components/navbar.pug index 5a28d90..ddd71ec 100644 --- a/src/pug/components/navbar.pug +++ b/src/pug/components/navbar.pug @@ -16,19 +16,30 @@ mixin navbar .navbar-frame a.navbar-logo(href='./') bundle .mobile - a.btn.btn-highlight(href="https://github.com/okikio/bundle" target="_blank" rel="noopener") GitHub - //- button.intall-btn(type='button') - span.icon get_app - //- button.theme-toggle(type='button') - span.icon dark_mode - button.navbar-toggle(type='button') - span.icon menu + .flex.gap-1.w-full.space-x-0 + .offline-icon.online(title="You are offline") + //- span.icon wifi_off + svg.icon(viewbox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink') + path(d='M4.28106169,4.22500888 L18.7764524,18.7209962 C19.0693396,19.0138954 19.0693299,19.4887691 18.7764306,19.7816563 C18.4835314,20.0745435 18.0086576,20.0745337 17.7157704,19.7816345 L13.9305541,15.9956947 L6.69263446,15.9958741 C4.65355477,15.9958741 3.00055408,14.3471503 3.00055408,12.3133463 C3.00055408,10.3210486 4.58677382,8.69827375 6.56830717,8.63286782 L3.22037969,5.28564722 C2.9274925,4.99274798 2.92750227,4.51787424 3.22040152,4.22498705 C3.51330076,3.93209986 3.9881745,3.93210963 4.28106169,4.22500888 Z M12,4.00069473 C15.1685311,4.00069473 16.9659849,6.09798511 17.2273993,8.63082111 L17.3073655,8.63081851 C19.3464452,8.63081851 20.9994459,10.2795424 20.9994459,12.3133463 C20.9994459,14.0797322 19.7525621,15.5556461 18.0887965,15.9132336 L16.6735541,14.4976947 L17.2514265,14.4982844 C18.512419,14.4982844 19.5346554,13.4969988 19.5346554,12.2618503 C19.5346554,11.0267018 18.512419,10.0254161 17.2514488,10.0254161 L16.5608724,10.0254381 C16.1956601,10.0254498 15.8767103,9.74495783 15.8767103,9.38750235 C15.8767103,7.10258564 14.0713233,5.49828443 12,5.49828443 C10.8390418,5.49828443 9.76162755,6.01136739 9.03882127,6.85960535 L7.93124025,5.75195301 C8.81517847,4.68600889 10.1815387,4.00069473 12,4.00069473 Z M12.4325541,14.4976947 L7.83792595,9.90370102 C7.72405918,9.98051387 7.58529874,10.0254428 7.43912757,10.0254381 L6.74857351,10.0254161 C5.48758101,10.0254161 4.46534461,11.0267018 4.46534461,12.2618503 C4.46534461,13.4969988 5.48758101,14.4982844 6.74857351,14.4982844 L12.4325541,14.4976947 Z' id='🎨-Color') + + a.btn.btn-highlight(href="https://github.com/okikio/bundle" target="_blank" rel="noopener") GitHub + //- button.intall-btn(type='button') + span.icon get_app + //- button.theme-toggle(type='button') + span.icon dark_mode + button.navbar-toggle(type='button') + span.icon menu .navbar-collapse.collapse.mobile +nav-list .desktop .navbar-collapse +nav-list a.btn.btn-highlight(href="https://github.com/okikio/bundle" target="_blank" rel="noopener") GitHub + .offline-icon.online(title="You are offline") + //- span.icon wifi_off + svg.icon(viewbox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink') + path(d='M4.28106169,4.22500888 L18.7764524,18.7209962 C19.0693396,19.0138954 19.0693299,19.4887691 18.7764306,19.7816563 C18.4835314,20.0745435 18.0086576,20.0745337 17.7157704,19.7816345 L13.9305541,15.9956947 L6.69263446,15.9958741 C4.65355477,15.9958741 3.00055408,14.3471503 3.00055408,12.3133463 C3.00055408,10.3210486 4.58677382,8.69827375 6.56830717,8.63286782 L3.22037969,5.28564722 C2.9274925,4.99274798 2.92750227,4.51787424 3.22040152,4.22498705 C3.51330076,3.93209986 3.9881745,3.93210963 4.28106169,4.22500888 Z M12,4.00069473 C15.1685311,4.00069473 16.9659849,6.09798511 17.2273993,8.63082111 L17.3073655,8.63081851 C19.3464452,8.63081851 20.9994459,10.2795424 20.9994459,12.3133463 C20.9994459,14.0797322 19.7525621,15.5556461 18.0887965,15.9132336 L16.6735541,14.4976947 L17.2514265,14.4982844 C18.512419,14.4982844 19.5346554,13.4969988 19.5346554,12.2618503 C19.5346554,11.0267018 18.512419,10.0254161 17.2514488,10.0254161 L16.5608724,10.0254381 C16.1956601,10.0254498 15.8767103,9.74495783 15.8767103,9.38750235 C15.8767103,7.10258564 14.0713233,5.49828443 12,5.49828443 C10.8390418,5.49828443 9.76162755,6.01136739 9.03882127,6.85960535 L7.93124025,5.75195301 C8.81517847,4.68600889 10.1815387,4.00069473 12,4.00069473 Z M12.4325541,14.4976947 L7.83792595,9.90370102 C7.72405918,9.98051387 7.58529874,10.0254428 7.43912757,10.0254381 L6.74857351,10.0254161 C5.48758101,10.0254161 4.46534461,11.0267018 4.46534461,12.2618503 C4.46534461,13.4969988 5.48758101,14.4982844 6.74857351,14.4982844 L12.4325541,14.4976947 Z' id='🎨-Color') + //- button.intall-btn(type='button') span.icon get_app //- button.theme-toggle(type='button') diff --git a/src/pug/index.pug b/src/pug/index.pug index 84677dd..0dce4f7 100644 --- a/src/pug/index.pug +++ b/src/pug/index.pug @@ -8,7 +8,6 @@ block content h1 bundle p | a quick npm package size checker - strong#visit-counter .search-container .search @@ -19,17 +18,16 @@ block content .search-results-container .flex.w-full.gap-2 - .push-to-side-overflow.flex-1 - .push-to-side - #bundle-time - .flex.flex-1 - button.btn#run(type='button') Run - button.btn.btn-share#share(type='button') Share - .file-size Wait... - .offline-icon.online(title="You are offline") - //- span.icon wifi_off - svg.icon(viewbox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink') - path(d='M4.28106169,4.22500888 L18.7764524,18.7209962 C19.0693396,19.0138954 19.0693299,19.4887691 18.7764306,19.7816563 C18.4835314,20.0745435 18.0086576,20.0745337 17.7157704,19.7816345 L13.9305541,15.9956947 L6.69263446,15.9958741 C4.65355477,15.9958741 3.00055408,14.3471503 3.00055408,12.3133463 C3.00055408,10.3210486 4.58677382,8.69827375 6.56830717,8.63286782 L3.22037969,5.28564722 C2.9274925,4.99274798 2.92750227,4.51787424 3.22040152,4.22498705 C3.51330076,3.93209986 3.9881745,3.93210963 4.28106169,4.22500888 Z M12,4.00069473 C15.1685311,4.00069473 16.9659849,6.09798511 17.2273993,8.63082111 L17.3073655,8.63081851 C19.3464452,8.63081851 20.9994459,10.2795424 20.9994459,12.3133463 C20.9994459,14.0797322 19.7525621,15.5556461 18.0887965,15.9132336 L16.6735541,14.4976947 L17.2514265,14.4982844 C18.512419,14.4982844 19.5346554,13.4969988 19.5346554,12.2618503 C19.5346554,11.0267018 18.512419,10.0254161 17.2514488,10.0254161 L16.5608724,10.0254381 C16.1956601,10.0254498 15.8767103,9.74495783 15.8767103,9.38750235 C15.8767103,7.10258564 14.0713233,5.49828443 12,5.49828443 C10.8390418,5.49828443 9.76162755,6.01136739 9.03882127,6.85960535 L7.93124025,5.75195301 C8.81517847,4.68600889 10.1815387,4.00069473 12,4.00069473 Z M12.4325541,14.4976947 L7.83792595,9.90370102 C7.72405918,9.98051387 7.58529874,10.0254428 7.43912757,10.0254381 L6.74857351,10.0254161 C5.48758101,10.0254161 4.46534461,11.0267018 4.46534461,12.2618503 C4.46534461,13.4969988 5.48758101,14.4982844 6.74857351,14.4982844 L12.4325541,14.4976947 Z' id='🎨-Color') + .info-pane + .flex-grow#bundle-time + .flex-grow + .action-btns-overflow + .action-btns + .flex-grow + button.btn#run(type='button') Run + button.btn.btn-share#share(type='button') Share + .file-size ... + .container(class="!max-w-screen-lg") .flex-wrapper mixin editor-btns @@ -54,7 +52,7 @@ block content path(d='M2.75 5a.75.75 0 0 0 0 1.5h18.5a.75.75 0 0 0 0-1.5H2.75ZM2.75 11.5a.75.75 0 0 0 0 1.5H19a2.5 2.5 0 0 1 0 5h-4.44l.72-.72a.75.75 0 1 0-1.06-1.06l-2 2a.75.75 0 0 0 0 1.06l2 2a.75.75 0 1 0 1.06-1.06l-.72-.72H19a4 4 0 0 0 0-8H2.75Z') path(d='M2 18.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z') - .app + .app#input .center-container .loading #editor @@ -120,17 +118,25 @@ block content | If you only want a couple packages and don't care to treeshake, then all you need is something like this, a(href="/?q=react,react-dom,vue,@okikio/animate" rel="noopener") | ?q=react,react-dom,vue,@okikio/animate - | There is another way to share a reproduciable bundle, the sharable link. Shareble links look like this #[a(href="/?share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA" rel="noopener") /?share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA] with the string value of the input code editor being compressed into a string and placed into the URL. + | . There is another way to share a reproduciable bundle, the sharable link. Shareble links look like this #[a(href="/?share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA" rel="noopener") /?share=PTAEGEBs...] with the string value of the input code editor being compressed into a string and placed into the URL. br br - | In order to create a shareble link, you click the `Share` button, it copies the share url to your clipboard, and from there you can paste where you wish. + | In order to create a shareble link, you click the #[code Share] button, it copies the share url to your clipboard, and from there you can paste where you wish. br br - | If you would like to bundle your code when the share URL is loaded, add `bundle` to the url, e.g. #[a(href="/?q=@okikio/animate&bundle" rel="noopener") /?q=@okikio/animate&bundle] or #[a(href="/?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA" rel="noopener") /?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA] + details.bg-gray-200(class="dark:bg-elevated-2").rounded-md + summary + p.px-4.py-2.font-bold.italic.cursor-pointer.select-none Auto-bundling shared URL's + div.content.px-2 + p If you would like to bundle your code when the share URL is loaded, add #[code bundle] to the url, e.g. #[a(href="/?q=@okikio/animate&bundle" rel="noopener") /?bundle&q=@okikio/animate] or #[a(href="/?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA" rel="noopener") /?bundle&share=PTAEGEBs...] br br + br + .text-center + p.bg-gray-200(class="dark:bg-quaternary").inline-block.px-4.py-2.rounded-md + span#visit-counter.inline-block 👋 00000 visits + br +product-hunt.place-content-center - block script link(rel="stylesheet", href="./js/monaco.min.css") diff --git a/src/pug/layouts/layout.pug b/src/pug/layouts/layout.pug index 6106c34..6dfb905 100644 --- a/src/pug/layouts/layout.pug +++ b/src/pug/layouts/layout.pug @@ -46,7 +46,7 @@ html.dark(lang="en") url: "/", websiteURL: "https://bundle.js.org", title: "bundle - a quick npm package size checker", - description: "bundle is a quick and easy way to bundle your projects, minify and see it's gzip size, it's similar to bundlephobia but does all the work locally on you computer and can treeshake and bundle multiple packages (both commonjs and esm) together.", + description: "bundle is a quick and easy way to bundle your js projects, minify and see their gzip size, it's similar to bundlephobia but does all the work locally on your computer and can treeshake and bundle multiple packages (both commonjs and esm) together.", keywords: "bundle, rollup, esbuild, gzip, minify, es2020, monaco-editor, typescript" }; block pageInfo @@ -105,6 +105,7 @@ html.dark(lang="en") "sameAs":[ "https://www.producthunt.com/posts/bundle-6", "https://bundle.js.org", + "https://bundlesize.com", "https://github.com/okikio/bundle", "https://okikio.github.io/bundle", "https://bestofjs.org/projects/bundle" @@ -153,6 +154,7 @@ html.dark(lang="en") "sameAs":[ "https://www.producthunt.com/posts/bundle-6", "https://bundle.js.org", + "https://bundlesize.com", "https://github.com/okikio/bundle", "https://okikio.github.io/bundle", "https://bestofjs.org/projects/bundle" @@ -160,7 +162,7 @@ html.dark(lang="en") "mainEntityOfPage":{ "@type":"WebPage", "@id":"#{defaults.websiteURL}/index.html#main", - "lastReviewed":"Mon August 09 2021 16:00:00 GMT-0400" + "lastReviewed":"Mon October 11 2021 16:00:00 GMT-0400" }, "about":{ "@id":"#{defaults.websiteURL}/about.html" diff --git a/src/ts/components/SearchResults.tsx b/src/ts/components/SearchResults.tsx index c36643d..15110ca 100644 --- a/src/ts/components/SearchResults.tsx +++ b/src/ts/components/SearchResults.tsx @@ -23,6 +23,7 @@ export const Card = ({ let _packageHref = `https://www.skypack.dev/view/${_package}`; let btnTextEl: HTMLElement; + let btnEl: HTMLButtonElement; return (
@@ -44,9 +45,9 @@ export const Card = ({

-