Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Fix CSS import ordering (#993)
sarayourfriend8c0f8903801e
diff --git a/.eslintignore b/.eslintignoreindex 2bf925996..48db7ddbb 100644--- a/.eslintignore+++ b/.eslintignore@@ -2,3 +2,4 @@ dist/# eslint by default ignores hidden folders so we need to "un-ignore" it# https://github.com/eslint/eslint/issues/8429#issuecomment-292789858!.storybook+nuxt-template-overrides/diff --git a/.prettierignore b/.prettierignoreindex b50963707..8882bbe78 100644--- a/.prettierignore+++ b/.prettierignore@@ -5,3 +5,4 @@ test/unit/coverage.nuxt-storybookstorybook-staticpnpm-lock.yaml+nuxt-template-overridesdiff --git a/nuxt-template-overrides/App.js b/nuxt-template-overrides/App.jsnew file mode 100644index 000000000..590201b49--- /dev/null+++ b/nuxt-template-overrides/App.js@@ -0,0 +1,348 @@+import Vue from 'vue'+import { decode, parsePath, withoutBase, withoutTrailingSlash, normalizeURL } from 'ufo'+<% utilsImports = [+ ...(features.asyncData || features.fetch) ? [+ 'getMatchedComponentsInstances',+ 'getChildrenComponentInstancesUsingFetch',+ 'promisify',+ 'globalHandleError',+ 'urlJoin'+ ] : [],+ ...features.layouts ? [+ 'sanitizeComponent'+ ]: []+] %>+<% css.forEach((c) => { %>+import '<%= relativeToBuild(resolvePath(c.src || c, { isStyle: true })) %>'+<% }) %>+<% if (utilsImports.length) { %>import { <%= utilsImports.join(', ') %> } from './utils'<% } %>+import NuxtError from '<%= components.ErrorPage ? components.ErrorPage : "./components/nuxt-error.vue" %>'+<% if (loading) { %>import NuxtLoading from '<%= (typeof loading === "string" ? loading : "./components/nuxt-loading.vue") %>'<% } %>+<% if (buildIndicator) { %>import NuxtBuildIndicator from './components/nuxt-build-indicator'<% } %>+++<% if (features.layouts) { %>+<%= Object.keys(layouts).map((key) => {+ if (splitChunks.layouts) {+ return `const _${hash(key)} = () => import('${layouts[key]}' /* webpackChunkName: "${wChunk('layouts/' + key)}" */).then(m => sanitizeComponent(m.default || m))`+ } else {+ return `import _${hash(key)} from '${layouts[key]}'`+ }+}).join('\n') %>++<% if (splitChunks.layouts) { %>+let resolvedLayouts = {}+const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": _${hash(key)}`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>+<% } else { %>+const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": sanitizeComponent(_${hash(key)})`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>+<% } %>++<% } %>++export default {+ render (h, props) {+ <% if (loading) { %>const loadingEl = h('NuxtLoading', { ref: 'loading' })<% } %>+ <% if (features.layouts) { %>+ const layoutEl = h(this.layout || 'nuxt')+ const templateEl = h('div', {+ domProps: {+ id: '__layout'+ },+ key: this.layoutName+ }, [layoutEl])+ <% } else { %>+ const templateEl = h('nuxt')+ <% } %>++ <% if (features.transitions) { %>+ const transitionEl = h('transition', {+ props: {+ name: '<%= layoutTransition.name %>',+ mode: '<%= layoutTransition.mode %>'+ },+ on: {+ beforeEnter (el) {+ // Ensure to trigger scroll event after calling scrollBehavior+ window.<%= globals.nuxt %>.$nextTick(() => {+ window.<%= globals.nuxt %>.$emit('triggerScroll')+ })+ }+ }+ }, [templateEl])+ <% } %>++ return h('div', {+ domProps: {+ id: '<%= globals.id %>'+ }+ }, [+ <% if (loading) { %>loadingEl, <% } %>+ <% if (buildIndicator) { %>h(NuxtBuildIndicator), <% } %>+ <% if (features.transitions) { %>transitionEl<% } else { %>templateEl<% } %>+ ])+ },+ <% if (features.clientOnline || features.layouts) { %>+ data: () => ({+ <% if (features.clientOnline) { %>+ isOnline: true,+ <% } %>+ <% if (features.layouts) { %>+ layout: null,+ layoutName: '',+ <% } %>+ <% if (features.fetch) { %>+ nbFetching: 0+ <% } %>+ }),+ <% } %>+ beforeCreate () {+ Vue.util.defineReactive(this, 'nuxt', this.$options.nuxt)+ },+ created () {+ // Add this.$nuxt in child instances+ this.$root.$options.<%= globals.nuxt %> = this++ if (process.client) {+ // add to window so we can listen when ready+ window.<%= globals.nuxt %> = <%= (globals.nuxt !== '$nuxt' ? 'window.$nuxt = ' : '') %>this+ <% if (features.clientOnline) { %>+ this.refreshOnlineStatus()+ // Setup the listeners+ window.addEventListener('online', this.refreshOnlineStatus)+ window.addEventListener('offline', this.refreshOnlineStatus)+ <% } %>+ }+ // Add $nuxt.error()+ this.error = this.nuxt.error+ // Add $nuxt.context+ this.context = this.$options.context+ },+ <% if (loading || isFullStatic) { %>+ async mounted () {+ <% if (loading) { %>this.$loading = this.$refs.loading<% } %>+ <% if (isFullStatic) {%>+ if (this.isPreview) {+ if (this.$store && this.$store._actions.nuxtServerInit) {+ <% if (loading) { %>this.$loading.start()<% } %>+ await this.$store.dispatch('nuxtServerInit', this.context)+ }+ await this.refresh()+ <% if (loading) { %>this.$loading.finish()<% } %>+ }+ <% } %>+ },+ <% } %>+ watch: {+ 'nuxt.err': 'errorChanged'+ },+ <% if (features.clientOnline) { %>+ computed: {+ isOffline () {+ return !this.isOnline+ },+ <% if (features.fetch) { %>+ isFetching () {+ return this.nbFetching > 0+ },<% } %>+ <% if (nuxtOptions.target === 'static') { %>+ isPreview () {+ return Boolean(this.$options.previewData)+ },<% } %>+ },+ <% } %>+ methods: {+ <%= isTest ? '/* eslint-disable comma-dangle */' : '' %>+ <% if (features.clientOnline) { %>+ refreshOnlineStatus () {+ if (process.client) {+ if (typeof window.navigator.onLine === 'undefined') {+ // If the browser doesn't support connection status reports+ // assume that we are online because most apps' only react+ // when they now that the connection has been interrupted+ this.isOnline = true+ } else {+ this.isOnline = window.navigator.onLine+ }+ }+ },+ <% } %>+ async refresh () {+ <% if (features.asyncData || features.fetch) { %>+ const pages = getMatchedComponentsInstances(this.$route)++ if (!pages.length) {+ return+ }+ <% if (loading) { %>this.$loading.start()<% } %>++ const promises = pages.map((page) => {+ const p = []++ <% if (features.fetch) { %>+ // Old fetch+ if (page.$options.fetch && page.$options.fetch.length) {+ p.push(promisify(page.$options.fetch, this.context))+ }+ if (page.$fetch) {+ p.push(page.$fetch())+ } else {+ // Get all component instance to call $fetch+ for (const component of getChildrenComponentInstancesUsingFetch(page.$vnode.componentInstance)) {+ p.push(component.$fetch())+ }+ }+ <% } %>+ <% if (features.asyncData) { %>+ if (page.$options.asyncData) {+ p.push(+ promisify(page.$options.asyncData, this.context)+ .then((newData) => {+ for (const key in newData) {+ Vue.set(page.$data, key, newData[key])+ }+ })+ )+ }+ <% } %>+ return Promise.all(p)+ })+ try {+ await Promise.all(promises)+ } catch (error) {+ <% if (loading) { %>this.$loading.fail(error)<% } %>+ globalHandleError(error)+ this.error(error)+ }+ <% if (loading) { %>this.$loading.finish()<% } %>+ <% } %>+ },+ <% if (splitChunks.layouts) { %>async <% } %>errorChanged () {+ if (this.nuxt.err) {+ <% if (loading) { %>+ if (this.$loading) {+ if (this.$loading.fail) {+ this.$loading.fail(this.nuxt.err)+ }+ if (this.$loading.finish) {+ this.$loading.finish()+ }+ }+ <% } %>+ let errorLayout = (NuxtError.options || NuxtError).layout;++ if (typeof errorLayout === 'function') {+ errorLayout = errorLayout(this.context)+ }+ <% if (splitChunks.layouts) { %>+ await this.loadLayout(errorLayout)+ <% } %>+ this.setLayout(errorLayout)+ }+ },+ <% if (features.layouts) { %>+ <% if (splitChunks.layouts) { %>+ setLayout (layout) {+ <% if (debug) { %>+ if(layout && typeof layout !== 'string') {+ throw new Error('[nuxt] Avoid using non-string value as layout property.')+ }+ <% } %>+ if (!layout || !resolvedLayouts['_' + layout]) {+ layout = 'default'+ }+ this.layoutName = layout+ let _layout = '_' + layout+ this.layout = resolvedLayouts[_layout]+ return this.layout+ },+ loadLayout (layout) {+ const undef = !layout+ const nonexistent = !(layouts['_' + layout] || resolvedLayouts['_' + layout])+ let _layout = '_' + ((undef || nonexistent) ? 'default' : layout)+ if (resolvedLayouts[_layout]) {+ return Promise.resolve(resolvedLayouts[_layout])+ }+ return layouts[_layout]()+ .then((Component) => {+ resolvedLayouts[_layout] = Component+ delete layouts[_layout]+ return resolvedLayouts[_layout]+ })+ .catch((e) => {+ if (this.<%= globals.nuxt %>) {+ return this.<%= globals.nuxt %>.error({ statusCode: 500, message: e.message })+ }+ })+ },+ <% } else { %>+ setLayout (layout) {+ <% if (debug) { %>+ if(layout && typeof layout !== 'string') {+ throw new Error('[nuxt] Avoid using non-string value as layout property.')+ }+ <% } %>+ if (!layout || !layouts['_' + layout]) {+ layout = 'default'+ }+ this.layoutName = layout+ this.layout = layouts['_' + layout]+ return this.layout+ },+ loadLayout (layout) {+ if (!layout || !layouts['_' + layout]) {+ layout = 'default'+ }+ return Promise.resolve(layouts['_' + layout])+ },+ <% } /* splitChunks.layouts */ %>+ <% } /* features.layouts */ %>+ <% if (isFullStatic) { %>+ getRouterBase() {+ return withoutTrailingSlash(this.$router.options.base)+ },+ getRoutePath(route = '/') {+ const base = this.getRouterBase()+ return withoutTrailingSlash(withoutBase(parsePath(route).pathname, base))+ },+ getStaticAssetsPath(route = '/') {+ const { staticAssetsBase } = window.<%= globals.context %>++ return urlJoin(staticAssetsBase, this.getRoutePath(route))+ },+ <% if (nuxtOptions.generate.manifest) { %>+ async fetchStaticManifest() {+ return window.__NUXT_IMPORT__('manifest.js', normalizeURL(urlJoin(this.getStaticAssetsPath(), 'manifest.js')))+ },+ <% } %>+ setPagePayload(payload) {+ this._pagePayload = payload+ this._fetchCounters = {}+ },+ async fetchPayload(route, prefetch) {+ const path = decode(this.getRoutePath(route))+ <% if (nuxtOptions.generate.manifest) { %>+ const manifest = await this.fetchStaticManifest()+ if (!manifest.routes.includes(path)) {+ if (!prefetch) { this.setPagePayload(false) }+ throw new Error(`Route ${path} is not pre-rendered`)+ }+ <% } %>+ const src = urlJoin(this.getStaticAssetsPath(route), 'payload.js')+ try {+ const payload = await window.__NUXT_IMPORT__(path, normalizeURL(src))+ if (!prefetch) { this.setPagePayload(payload) }+ return payload+ } catch (err) {+ if (!prefetch) { this.setPagePayload(false) }+ throw err+ }+ }+ <% } %>+ },+ <% if (loading) { %>+ components: {+ NuxtLoading+ }+ <% } %>+ <%= isTest ? '/* eslint-enable comma-dangle */' : '' %>+}diff --git a/nuxt-template-overrides/README.md b/nuxt-template-overrides/README.mdnew file mode 100644index 000000000..c6118be9e--- /dev/null+++ b/nuxt-template-overrides/README.md@@ -0,0 +1,13 @@+# Nuxt vue-app template overrides++Due to a CSS ordering bug that we haven't been able to find any other solutions for, we've had to override the Nuxt templates for the `App.js` and `index.js` files to prevent any Vue components from being imported before the static CSS assets in the `nuxt.config.js`.++## Described changes++There are two basic changes we're making all with a single goal: stop the importing of our custom `error.vue` component coming before our static CSS assets. The generated page apparently depends on this specific ordering of file imports, which is far far from ideal. Alas, there doesn't appear to be another clear solution to this problem at the moment, so we're stuck with this hack.++To update these files, it's probably easiest to just copy `App.js` and `index.js` from `node_modules/@nuxt/vue-app/template` into this directory and then apply the following transformations.++In `index.js`, move the import of `NuxtError` and `Nuxt` below importing `App`. `NuxtError` imports our custom error component and `Nuxt` imports `NuxtError`.++In `App.js`, move the `css.forEach` loop above importing `NuxtError`.diff --git a/nuxt-template-overrides/index.js b/nuxt-template-overrides/index.jsnew file mode 100644index 000000000..7b33c9859--- /dev/null+++ b/nuxt-template-overrides/index.js@@ -0,0 +1,305 @@+import Vue from 'vue'+<% if (store) { %>import Vuex from 'vuex'<% } %>+<% if (features.meta) { %>import Meta from 'vue-meta'<% } %>+<% if (features.componentClientOnly) { %>import ClientOnly from 'vue-client-only'<% } %>+<% if (features.deprecations) { %>import NoSsr from 'vue-no-ssr'<% } %>+import { createRouter } from './router.js'+import NuxtChild from './components/nuxt-child.js'+import App from '<%= appPath %>'+import Nuxt from './components/nuxt.js'+import NuxtError from '<%= components.ErrorPage ? components.ErrorPage : "./components/nuxt-error.vue" %>'+import { setContext, getLocation, getRouteData, normalizeError } from './utils'+<% if (store) { %>import { createStore } from './store.js'<% } %>++/* Plugins */+<%= isTest ? '/* eslint-disable camelcase */' : '' %>+<% plugins.forEach((plugin) => { %>import <%= plugin.name %> from '<%= plugin.name %>' // Source: <%= relativeToBuild(plugin.src) %> (mode: '<%= plugin.mode %>')+<% }) %>+<%= isTest ? '/* eslint-enable camelcase */' : '' %>++<% if (features.componentClientOnly) { %>+// Component: <ClientOnly>+Vue.component(ClientOnly.name, ClientOnly)+<% } %>+<% if (features.deprecations) { %>+// TODO: Remove in Nuxt 3: <NoSsr>+Vue.component(NoSsr.name, {+ ...NoSsr,+ render (h, ctx) {+ if (process.client && !NoSsr._warned) {+ NoSsr._warned = true+ <%= isTest ? '// eslint-disable-next-line no-console' : '' %>+ console.warn('<no-ssr> has been deprecated and will be removed in Nuxt 3, please use <client-only> instead')+ }+ return NoSsr.render(h, ctx)+ }+})+<% } %>+// Component: <NuxtChild>+Vue.component(NuxtChild.name, NuxtChild)+<% if (features.componentAliases) { %>Vue.component('NChild', NuxtChild)<% } %>++// Component NuxtLink is imported in server.js or client.js++// Component: <Nuxt>+Vue.component(Nuxt.name, Nuxt)++Object.defineProperty(Vue.prototype, '<%= globals.nuxt %>', {+ get() {+ const globalNuxt = this.$root.$options.<%= globals.nuxt %>+ if (process.client && !globalNuxt && typeof window !== 'undefined') {+ return window.<%= globals.nuxt %>+ }+ return globalNuxt+ },+ configurable: true+})++<% if (features.meta) {+// vue-meta configuration+const vueMetaOptions = {+ ...nuxtOptions.vueMeta,+ keyName: 'head', // the component option name that vue-meta looks for meta info on.+ attribute: 'data-n-head', // the attribute name vue-meta adds to the tags it observes+ ssrAttribute: 'data-n-head-ssr', // the attribute name that lets vue-meta know that meta info has already been server-rendered+ tagIDKeyName: 'hid' // the property name that vue-meta uses to determine whether to overwrite or append a tag+}+%>+Vue.use(Meta, <%= JSON.stringify(vueMetaOptions) %>)<%= isTest ? '// eslint-disable-line' : '' %>+<% } %>++<% if (features.transitions) { %>+const defaultTransition = <%=+ serialize(pageTransition)+ .replace('beforeEnter(', 'function(').replace('enter(', 'function(').replace('afterEnter(', 'function(')+ .replace('enterCancelled(', 'function(').replace('beforeLeave(', 'function(').replace('leave(', 'function(')+ .replace('afterLeave(', 'function(').replace('leaveCancelled(', 'function(').replace('beforeAppear(', 'function(')+ .replace('appear(', 'function(').replace('afterAppear(', 'function(').replace('appearCancelled(', 'function(')+%><%= isTest ? '// eslint-disable-line' : '' %>+<% } %>++<% if (store) { %>+const originalRegisterModule = Vuex.Store.prototype.registerModule++function registerModule (path, rawModule, options = {}) {+ const preserveState = process.client && (+ Array.isArray(path)+ ? !!path.reduce((namespacedState, path) => namespacedState && namespacedState[path], this.state)+ : path in this.state+ )+ return originalRegisterModule.call(this, path, rawModule, { preserveState, ...options })+}+<% } %>++async function createApp(ssrContext, config = {}) {+ const router = await createRouter(ssrContext, config)++ <% if (store) { %>+ const store = createStore(ssrContext)+ // Add this.$router into store actions/mutations+ store.$router = router+ <% if (mode === 'universal') { %>+ // Fix SSR caveat https://github.com/nuxt/nuxt.js/issues/3757#issuecomment-414689141+ store.registerModule = registerModule+ <% } %>+ <% } %>++ // Create Root instance++ // here we inject the router and store to all child components,+ // making them available everywhere as `this.$router` and `this.$store`.+ const app = {+ <% if (features.meta) { %>+ <%= isTest ? '/* eslint-disable array-bracket-spacing, quotes, quote-props, semi, indent, comma-spacing, key-spacing, object-curly-spacing, space-before-function-paren, object-shorthand */' : '' %>+ head: <%= serializeFunction(head) %>,+ <%= isTest ? '/* eslint-enable array-bracket-spacing, quotes, quote-props, semi, indent, comma-spacing, key-spacing, object-curly-spacing, space-before-function-paren, object-shorthand */' : '' %>+ <% } %>+ <% if (store) { %>store,<% } %>+ router,+ nuxt: {+ <% if (features.transitions) { %>+ defaultTransition,+ transitions: [defaultTransition],+ setTransitions (transitions) {+ if (!Array.isArray(transitions)) {+ transitions = [transitions]+ }+ transitions = transitions.map((transition) => {+ if (!transition) {+ transition = defaultTransition+ } else if (typeof transition === 'string') {+ transition = Object.assign({}, defaultTransition, { name: transition })+ } else {+ transition = Object.assign({}, defaultTransition, transition)+ }+ return transition+ })+ this.$options.nuxt.transitions = transitions+ return transitions+ },+ <% } %>+ err: null,+ dateErr: null,+ error (err) {+ err = err || null+ app.context._errored = Boolean(err)+ err = err ? normalizeError(err) : null+ let nuxt = app.nuxt // to work with @vue/composition-api, see https://github.com/nuxt/nuxt.js/issues/6517#issuecomment-573280207+ if (this) {+ nuxt = this.nuxt || this.$options.nuxt+ }+ nuxt.dateErr = Date.now()+ nuxt.err = err+ // Used in src/server.js+ if (ssrContext) {+ ssrContext.nuxt.error = err+ }+ return err+ }+ },+ ...App+ }+ <% if (store) { %>+ // Make app available into store via this.app+ store.app = app+ <% } %>+ const next = ssrContext ? ssrContext.next : location => app.router.push(location)+ // Resolve route+ let route+ if (ssrContext) {+ route = router.resolve(ssrContext.url).route+ } else {+ const path = getLocation(router.options.base, router.options.mode)+ route = router.resolve(path).route+ }++ // Set context to app.context+ await setContext(app, {+ <% if (store) { %>store,<% } %>+ route,+ next,+ error: app.nuxt.error.bind(app),+ payload: ssrContext ? ssrContext.payload : undefined,+ req: ssrContext ? ssrContext.req : undefined,+ res: ssrContext ? ssrContext.res : undefined,+ beforeRenderFns: ssrContext ? ssrContext.beforeRenderFns : undefined,+ ssrContext+ })++ function inject(key, value) {+ if (!key) {+ throw new Error('inject(key, value) has no key provided')+ }+ if (value === undefined) {+ throw new Error(`inject('${key}', value) has no value provided`)+ }++ key = '$' + key+ // Add into app+ app[key] = value+ // Add into context+ if (!app.context[key]) {+ app.context[key] = value+ }+ <% if (store) { %>+ // Add into store+ store[key] = app[key]+ <% } %>+ // Check if plugin not already installed+ const installKey = '__<%= globals.pluginPrefix %>_' + key + '_installed__'+ if (Vue[installKey]) {+ return+ }+ Vue[installKey] = true+ // Call Vue.use() to install the plugin into vm+ Vue.use(() => {+ if (!Object.prototype.hasOwnProperty.call(Vue.prototype, key)) {+ Object.defineProperty(Vue.prototype, key, {+ get () {+ return this.$root.$options[key]+ }+ })+ }+ })+ }++ // Inject runtime config as $config+ inject('config', config)++ <% if (store) { %>+ if (process.client) {+ // Replace store state before plugins execution+ if (window.<%= globals.context %> && window.<%= globals.context %>.state) {+ store.replaceState(window.<%= globals.context %>.state)+ }+ }+ <% } %>++ // Add enablePreview(previewData = {}) in context for plugins+ if (process.static && process.client) {+ app.context.enablePreview = function (previewData = {}) {+ app.previewData = Object.assign({}, previewData)+ inject('preview', previewData)+ }+ }+ // Plugin execution+ <%= isTest ? '/* eslint-disable camelcase */' : '' %>+ <% plugins.forEach((plugin) => { %>+ <% if (plugin.mode == 'client') { %>+ if (process.client && typeof <%= plugin.name %> === 'function') {+ await <%= plugin.name %>(app.context, inject)+ }+ <% } else if (plugin.mode == 'server') { %>+ if (process.server && typeof <%= plugin.name %> === 'function') {+ await <%= plugin.name %>(app.context, inject)+ }+ <% } else { %>+ if (typeof <%= plugin.name %> === 'function') {+ await <%= plugin.name %>(app.context, inject)+ }+ <% } %>+ <% }) %>+ <%= isTest ? '/* eslint-enable camelcase */' : '' %>+ // Lock enablePreview in context+ if (process.static && process.client) {+ app.context.enablePreview = function () {+ console.warn('You cannot call enablePreview() outside a plugin.')+ }+ }++ // Wait for async component to be resolved first+ await new Promise((resolve, reject) => {+ // Ignore 404s rather than blindly replacing URL in browser+ if (process.client) {+ const { route } = router.resolve(app.context.route.fullPath)+ if (!route.matched.length) {+ return resolve()+ }+ }+ router.replace(app.context.route.fullPath, resolve, (err) => {+ // https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js+ if (!err._isRouter) return reject(err)+ if (err.type !== 2 /* NavigationFailureType.redirected */) return resolve()++ // navigated to a different route in router guard+ const unregister = router.afterEach(async (to, from) => {+ if (process.server && ssrContext && ssrContext.url) {+ ssrContext.url = to.fullPath+ }+ app.context.route = await getRouteData(to)+ app.context.params = to.params || {}+ app.context.query = to.query || {}+ unregister()+ resolve()+ })+ })+ })++ return {+ <% if(store) { %>store,<% } %>+ app,+ router+ }+}++export { createApp, NuxtError }diff --git a/nuxt.config.js b/nuxt.config.jsindex 1e4e04df4..2d8a524d5 100644--- a/nuxt.config.js+++ b/nuxt.config.js@@ -197,6 +197,16 @@ export default {redirect: [{ from: '^/photos/(.*)$', to: '/image/$1', statusCode: 301 }],sentry,build: {+ templates: [+ {+ src: './nuxt-template-overrides/App.js',+ dst: 'App.js',+ },+ {+ src: './nuxt-template-overrides/index.js',+ dst: 'index.js',+ },+ ],friendlyErrors: false,postcss: {plugins: {diff --git a/package.json b/package.jsonindex 61b684448..e314d3d43 100644--- a/package.json+++ b/package.json@@ -27,8 +27,8 @@"e2e:ci": "start-server-and-test run-server http://localhost:8443 test:e2e","generate-e2e-tests": "playwright codegen localhost:8443/","types": "tsc --noEmit",- "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",- "lintfix": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",+ "lint": "eslint --ext .js,.vue --ignore-path .gitignore --ignore-path .eslintignore .",+ "lintfix": "eslint --fix --ext .js,.vue --ignore-path .gitignore --ignore-path .eslintignore .","format": "prettier --write .","format:test": "prettier --check .","vue-i18n-check": "vue-i18n-extract report --vueFiles './src/**/*.?(js|vue)' --languageFiles './src/locales/*.?(json)'",diff --git a/src/components/VButton.vue b/src/components/VButton.vueindex 54ef93c5a..47c5c51bd 100644--- a/src/components/VButton.vue+++ b/src/components/VButton.vue@@ -2,7 +2,7 @@<Component:is="as":type="typeRef"- class="transition-colors flex items-center rounded-sm justify-center transition-shadow duration-100 ease-linear disabled:opacity-70 no-underline appearance-none ring-offset-1 focus:outline-none focus-visible:ring focus-visible:ring-pink"+ class="transition-colors flex items-center rounded-sm justify-center transition-shadow duration-100 ease-linear disabled:opacity-70 no-underline appearance-none ring-offset-1 focus:outline-none":class="[$style.button,$style[variant],@@ -72,10 +72,13 @@ const VButton = defineComponent({/*** The variant of the button.*+ * Plain removes all styles except the focus ring.+ * Plain-dangerous removes _all_ styles including the focus ring.+ ** @default 'primary'*/variant: {- type: /** @type {import('@nuxtjs/composition-api').PropType<'primary' | 'secondary' | 'tertiary' | 'action-menu' | 'action-menu-muted' | 'grouped'>} */ (+ type: /** @type {import('@nuxtjs/composition-api').PropType<'primary' | 'secondary' | 'tertiary' | 'action-menu' | 'action-menu-muted' | 'plain' | 'plain-dangerous'>} */ (String),default: 'primary',@@ -87,7 +90,8 @@ const VButton = defineComponent({'action-menu','action-menu-secondary','action-menu-muted',- 'grouped',+ 'plain',+ 'plain-dangerous',].includes(v),},/**@@ -233,15 +237,15 @@ export default VButton@apply opacity-50;}-.size-small.size-small {+.size-small {@apply py-1 px-2;}-.size-medium.size-medium {+.size-medium {@apply py-2 px-4;}-.size-large.size-large {+.size-large {@apply py-6 px-8;}@@ -249,71 +253,63 @@ a.button {@apply no-underline;}-.primary.primary {+.primary {@apply bg-pink text-white focus-visible:ring focus-visible:ring-pink hover:bg-dark-pink hover:text-white;}-.primary-pressed.primary-pressed {+.primary-pressed {@apply bg-dark-pink;}-.secondary.secondary {+.secondary {@apply bg-dark-charcoal text-white font-bold focus-visible:ring focus-visible:ring-pink hover:bg-dark-charcoal-80 hover:text-white;}-.secondary-pressed.secondary-pressed {+.secondary-pressed {@apply bg-dark-charcoal-80 border border-tx hover:border-tx;}-.tertiary.tertiary {+.tertiary {@apply bg-white text-dark-charcoal border border-dark-charcoal-20 focus-visible:border-tx focus-visible:ring focus-visible:ring-pink ring-offset-0;}-.tertiary-pressed.tertiary-pressed {+.tertiary-pressed {@apply bg-dark-charcoal text-white border-tx;}-.action-menu.action-menu {+.action-menu {@apply bg-white text-dark-charcoal border border-tx hover:border-dark-charcoal-20 focus-visible:ring focus-visible:ring-pink;}-.action-menu-secondary.action-menu-secondary {+.action-menu-secondary {@apply bg-white text-dark-charcoal border border-tx hover:border-dark-charcoal-20 focus-visible:ring focus-visible:ring-pink;}-.action-menu-secondary-pressed.action-menu-secondary-pressed {+.action-menu-secondary-pressed {@apply border-tx bg-dark-charcoal text-white;}-.action-menu-pressed.action-menu-pressed {+.action-menu-pressed {@apply border-tx hover:border-tx bg-dark-charcoal text-white;}-.action-menu-muted.action-menu-muted {+.action-menu-muted {@apply bg-dark-charcoal-10 text-dark-charcoal border border-tx hover:border-dark-charcoal-20 focus-visible:ring focus-visible:ring-pink;}-.action-menu-muted-pressed.action-menu-muted-pressed {+.action-menu-muted-pressed {@apply border border-tx bg-dark-charcoal text-white focus-visible:ring focus-visible:ring-pink;}-.grouped.grouped {- @apply bg-white text-dark-charcoal focus-visible:ring-[0];-}--.grouped-pressed.grouped-pressed {- @apply bg-dark-charcoal-10 ring-offset-dark-charcoal-10;-}--.full.full {+.full {@apply w-full font-semibold bg-dark-charcoal-06 focus-visible:ring focus-visible:ring-pink hover:bg-dark-charcoal-40 hover:text-white;}-.full-pressed.full-pressed {+.full-pressed {@apply w-full font-semibold bg-dark-charcoal-06 text-dark-charcoal;}.plain {- @apply bg-tx focus-visible:ring focus-visible:ring-pink;+ @apply focus-visible:ring focus-visible:ring-pink;}</style>diff --git a/src/components/VHeader/VSearchBar/VSearchBar.vue b/src/components/VHeader/VSearchBar/VSearchBar.vueindex cfddb6619..0d373c529 100644--- a/src/components/VHeader/VSearchBar/VSearchBar.vue+++ b/src/components/VHeader/VSearchBar/VSearchBar.vue@@ -90,9 +90,4 @@ export default VSearchBar.search-field input[type='search']::-webkit-search-results-decoration {-webkit-appearance: none;}--/* Necessary to avoid flickering and just 'border-tx' inline class isn't working here */-.search-field.border-transparent {- border-color: transparent;-}</style>diff --git a/src/components/VHeader/VSearchBar/VSearchButton.vue b/src/components/VHeader/VSearchBar/VSearchButton.vueindex 41623709f..05209c98e 100644--- a/src/components/VHeader/VSearchBar/VSearchButton.vue+++ b/src/components/VHeader/VSearchBar/VSearchButton.vue@@ -6,7 +6,9 @@:variant="isIcon ? 'plain' : 'primary'"class="transition-none inline-block rounded-s-none font-semibold text-2xl hover:text-white group-hover:text-white hover:bg-pink group-hover:bg-pink":class="[- isIcon ? 'search-button p-[0.5px] ps-[1.5px]' : 'py-6 px-10 h-full',+ isIcon+ ? 'search-button focus-visible:bg-pink focus-visible:text-white p-[0.5px] ps-[1.5px]'+ : 'py-6 px-10 h-full',sizeClasses,isHomeRoute? 'bg-pink border-b border-b-pink text-white border-tx'diff --git a/src/components/VItemGroup/VItem.vue b/src/components/VItemGroup/VItem.vueindex 79e13b0a2..5b4eab33b 100644--- a/src/components/VItemGroup/VItem.vue+++ b/src/components/VItemGroup/VItem.vue@@ -14,13 +14,17 @@<VButtondata-item-group-item:as="as"- class="flex justify-between min-w-full group relative hover:bg-dark-charcoal-10 px-2 py-2"+ class="flex justify-between min-w-full group relative hover:bg-dark-charcoal-10 px-2 py-2 focus:z-10":class="[- $style.button,$style[`${contextProps.direction}-button`],- $style[`${contextProps.size}-button`],+ selected && 'bg-dark-charcoal-10 ring-offset-dark-charcoal-10',+ as === 'VLink' && 'text-dark-charcoal',]"- variant="grouped"+ :variant="+ contextProps.size === 'small' && !contextProps.bordered+ ? 'plain-dangerous'+ : 'plain'+ "size="disabled":pressed="selected":role="contextProps.type === 'radiogroup' ? 'radio' : 'menuitemcheckbox'"@@ -35,10 +39,12 @@@click.native="$emit('click')"><div- class="flex-grow whitespace-nowrap my-0 rounded-sm px-2 group-focus-visible:ring group-focus-visible:ring-pink"+ class="flex-grow whitespace-nowrap my-0 rounded-sm px-2":class="[+ contextProps.size === 'small' &&+ !contextProps.bordered &&+ 'group-focus-visible:ring group-focus-visible:ring-pink',$style[`${contextProps.direction}-content`],- $style[`${contextProps.size}-content`],]"><slot name="default" />@@ -115,6 +121,12 @@ export default defineComponent({const isInPopover = inject(VPopoverContentContextKey, false)const contextProps = inject(VItemGroupContextKey)+ if (!contextProps) {+ throw new Error(+ 'Do not use `VItem` outside of a `VItemGroup`. Use `VButton` instead.'+ )+ }+if (isInPopover && contextProps.bordered) {warn('Bordered popover items are not supported')}@@ -161,14 +173,6 @@ export default defineComponent({@apply z-10;}-.medium-button {- @apply focus-visible:ring focus-visible:ring-pink;-}--.small-content {- @apply group-focus-visible:ring group-focus-visible:ring-pink;-}-.vertical {@apply min-w-max;}