diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3efcf87..0679706 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,15 +5,19 @@ on: branches: [main] pull_request: +permissions: + contents: read + jobs: check: runs-on: ubuntu-latest + timeout-minutes: 20 steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version-file: .node-version + - uses: pnpm/action-setup@v4 - run: pnpm install --frozen-lockfile - run: pnpm check - run: pnpm build diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..df6ae33 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +24.21.0 diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000..c36fe91 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,22 @@ +{ + "semi": false, + "singleQuote": true, + "arrowParens": "avoid", + "quoteProps": "consistent", + "singleAttributePerLine": true, + "htmlWhitespaceSensitivity": "strict", + "ignorePatterns": [ + "docs/content/**", + "docs/.nuxt/**", + "docs/.data/**", + "dist/**", + "public/**", + "**/generated/**", + "**/fixtures/**", + ".agents/**", + "docs/plans/**", + "AGENTS.md", + "pnpm-lock.yaml", + "skills-lock.json" + ] +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..f59640b --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,14 @@ +{ + "plugins": ["typescript", "unicorn", "oxc", "vue"], + "categories": { + "correctness": "error" + }, + "ignorePatterns": [ + "docs/content/**", + "docs/.nuxt/**", + "docs/.data/**", + "dist/**", + "**/generated/**", + ".agents/**" + ] +} diff --git a/AGENTS.md b/AGENTS.md index 89df742..58d37a4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -133,7 +133,7 @@ git subtree pull --prefix=vendor/ui https://github.com/0froq/ui.git main --squas 用户定了之后再改代码,让它在库里和项目里都能运行。不要把项目文件原样复制进 `vendor/ui`。指向页面组件、项目 store、路由、项目类名和项目色值的地方,改成 props、slot,或库里已有的函数;样式改读 `--ui-*`。调用处仍由项目传入文案和数据。改完后,原来的页面还要能渲染。外观如果用了 token 契约里没有的颜色或字体,而且不能改写成那十二个变量,停下来告诉用户缺哪一个,不要给这个组件单开一套变量。 -写库里的代码之前,读 `vendor/ui/AGENTS.md` 的「代码规范」,并对照同一层已有文件。规范一节还没有细则时,以同一目录里已有组件为准,并让库的 eslint 通过。不要另起一套写法。 +写库里的代码之前,读 `vendor/ui/AGENTS.md` 的「代码规范」,并对照同一层已有文件。规范一节还没有细则时,以同一目录里已有组件为准,并让库的 `pnpm lint` 通过。不要另起一套写法。 1. 定名字和 props。库里已有同一种控件就沿用现有名字,例如 `Choice`、`Toggle`。新控件不要带项目名。props 只保留交互需要的,例如 `v-model`、`options`、`label`。项目专属参数留在本项目里包一层。 2. 行为。不依赖 DOM 结构的逻辑放进 `vendor/ui/src/core/`,不要引用 Vue。需要 Vue、但不关心样子的逻辑放进 `vendor/ui/src/vue/`,并从 `vendor/ui/src/vue/index.ts` 导出。已有 `useChoice` 或其他函数能用就用,不要复制一份。有动效时用 `vendor/ui/src/core` 里的 `prefersReducedMotion`。 @@ -161,7 +161,7 @@ git subtree pull --prefix=vendor/ui https://github.com/0froq/ui.git main --squas 抽进库的代码要符合这一节。移植前先读这里,再对照同一层已有文件。 -eslint 使用 `@antfu/eslint-config`。Vue 单行和多行都是每个属性单独一行。改完在库仓库里跑 `pnpm lint`,或在项目里对 `vendor/ui` 跑同一套配置。不要为了迁就项目原来的格式去关规则。 +库仓库使用 Oxlint 与 Oxfmt(Vite+ `vp lint` / `vp fmt`)。Vue 单行和多行都是每个属性单独一行。改完在库仓库里跑 `pnpm lint` 与 `pnpm fmt:check`,或在项目里对 `vendor/ui` 跑同一套配置。不要为了迁就项目原来的格式去关规则。 ### 细则 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..023a20c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) froq + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index df44780..2ff7d56 100644 --- a/README.md +++ b/README.md @@ -25,26 +25,26 @@ docs/ Docs site. It depends on this package. Component and docs change Everything below is exported from `@froq/ui`. -| Component | Role | -| --- | --- | -| Button / CopyButton | Native button. Async clipboard, stable width | -| TextInput / TextArea / Select / Checkbox | Native fields. Attributes and events reach the control | -| FormField / NumberInput / DateInput / Slider / FileUpload / RadioGroup | Label, error, native value. Validation stays with the caller | -| Choice / ChoiceCircle / Toggle | Controlled choice and switch. Custom radio does not submit a form value | -| ToggleGroup | Single or multiple. Arrow keys move focus. A selected value can be cleared | -| Combobox | Search and multiple selection. Remote requests stay with the caller | -| Calendar / DatePicker | One month. ISO dates, locale, range, disabled dates | -| Navigation / Sidebar | Flat links and collapsible groups. Routing stays with the caller | -| Breadcrumb / Pagination | Path and page links. No router and no data fetching | -| Collapsible / Accordion / Tabs | Controlled panels. Content stays mounted | -| Skeleton / Progress / Spinner / Alert | Loading, progress, wait, inline notice | -| Banner | Site notice. Actions slot. The caller owns dismissal | -| Toast / ToastRegion | Temporary notice and a shared region. The queue stays with the caller | -| IconButton / EmptyState | Named icon button. Empty content and an actions slot | -| Badge / Avatar / Separator / Card / AspectRatio / Table | Mark, image, rule, surface, ratio, native table | -| Dialog / AlertDialog / Drawer / Popover / Menu / Tooltip | Dialog, confirm, side panel, anchored layer, menu, tip | -| ContextMenu / HoverCard | Context menu and link preview. The preview is not required content | -| Paper | Paper texture | +| Component | Role | +| ---------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| Button / CopyButton | Native button. Async clipboard, stable width | +| TextInput / TextArea / Select / Checkbox | Native fields. Attributes and events reach the control | +| FormField / NumberInput / DateInput / Slider / FileUpload / RadioGroup | Label, error, native value. Validation stays with the caller | +| Choice / ChoiceCircle / Toggle | Controlled choice and switch. Custom radio does not submit a form value | +| ToggleGroup | Single or multiple. Arrow keys move focus. A selected value can be cleared | +| Combobox | Search and multiple selection. Remote requests stay with the caller | +| Calendar / DatePicker | One month. ISO dates, locale, range, disabled dates | +| Navigation / Sidebar | Flat links and collapsible groups. Routing stays with the caller | +| Breadcrumb / Pagination | Path and page links. No router and no data fetching | +| Collapsible / Accordion / Tabs | Controlled panels. Content stays mounted | +| Skeleton / Progress / Spinner / Alert | Loading, progress, wait, inline notice | +| Banner | Site notice. Actions slot. The caller owns dismissal | +| Toast / ToastRegion | Temporary notice and a shared region. The queue stays with the caller | +| IconButton / EmptyState | Named icon button. Empty content and an actions slot | +| Badge / Avatar / Separator / Card / AspectRatio / Table | Mark, image, rule, surface, ratio, native table | +| Dialog / AlertDialog / Drawer / Popover / Menu / Tooltip | Dialog, confirm, side panel, anchored layer, menu, tip | +| ContextMenu / HoverCard | Context menu and link preview. The preview is not required content | +| Paper | Paper texture | Each component has a demo, an English note, and a Chinese note. The docs site discovers them from the source. @@ -64,6 +64,14 @@ Set `data-theme="light"` or `data-theme="dark"` on the scope, or an ancestor, to `@froq/ui/tokens.css` is enough when a project wants the tokens without the components. `pnpm check:tokens` fails if a variable is missing, or if a component reads one outside this list. +## Install + +```bash +pnpm add @froq/ui +``` + +Requires Node `^24.21.0 || >=26.0.0` for development of this repo; consumers may use any Node version their bundler supports. + ## Use ```ts @@ -162,9 +170,13 @@ pnpm dev # docs at http://localhost:3000 pnpm generate # static files in dist/ pnpm deploy # generate, then cf deploy pnpm preview:deploy # generate, then cf previews deploy -pnpm check # lint, types, token contract +pnpm check # oxlint, oxfmt, types, token contract +pnpm lint:fix # oxlint --fix +pnpm fmt # oxfmt ``` +Node **24.21.0** (`.node-version`, `mise.toml`). Lint and format use [Vite+](https://github.com/voidzero-dev/vite-plus) (`vp`) with `.oxlintrc.json` and `.oxfmtrc.json`. + ## Docs site https://ui.froq.me @@ -174,7 +186,7 @@ The static output is `dist/` at the repo root. It deploys to the Cloudflare Worker `ui`. The Worker config is `cloudflare.config.ts`; the assets directory is in `wrangler.config.ts`. -Workers Builds (GitHub connection, no API token in the repo): `NODE_VERSION=22`, build `pnpm generate`, production `pnpm exec cf deploy`, preview `pnpm exec cf previews deploy`. +Workers Builds (GitHub connection, no API token in the repo): `NODE_VERSION=24.21.0`, build `pnpm generate`, production `pnpm exec cf deploy`, preview `pnpm exec cf previews deploy`. The docs live in the `docs/` subpackage, so root `cf deploy` does not run generate on its own. That is why `deploy` is `pnpm generate && cf deploy`. @@ -188,7 +200,7 @@ CI installs from the lockfile. ## License -This package has no root license file. +MIT. See [LICENSE](LICENSE). The handwriting strokes in `src/core/signature/` are SIL OFL 1.1. Copyright 2010 The Allura Project Authors. See `OFL.txt` and `NOTICE.md` beside that data. diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..808a0f3 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,56 @@ +# Release `@froq/ui` + +## 0.1.0 (first npm publish) + +First public release on npm under the `@froq` scope. The package ships TypeScript and Vue source; consumers compile it with Vite or Nuxt (`build.transpile: ['@froq/ui']`). Runtime peer: `vue` ^3.5.0 (optional for `@froq/ui/core` only). + +### After merge: publish to npm + +Maintainer only. Do not publish from CI or cloud agents. + +1. Confirm [main](https://github.com/0froq/ui) is green and `package.json` `version` is **0.1.0**. +2. Use Node **24.21.0** (`.node-version` / `mise.toml`) and pnpm **12.11.2** (`packageManager` in `package.json`). +3. From the repo root: + +```bash +pnpm install --frozen-lockfile +pnpm check +pnpm pack --pack-destination /tmp +tar -tzf /tmp/froq-ui-0.1.0.tgz | head +``` + +4. Log in as the **froq** npm user (org **`@froq`**): + +```bash +npm whoami +# expect: froq +``` + +5. Publish (public scoped package): + +```bash +npm publish --access public +``` + +6. Tag the release in git (optional but recommended): + +```bash +git tag v0.1.0 +git push origin v0.1.0 +``` + +7. Update [ui.froq.me](https://ui.froq.me) changelog if the docs site should mention the npm install path (`pnpm add @froq/ui`). + +### Publish readiness checklist + +| Item | Status | +| ------------------------------------------------ | ------------------------------------------------ | +| `name` is `@froq/ui` | yes | +| `private` is false | yes | +| `publishConfig.access` is `public` | yes | +| `files` includes publishable `src/` | yes | +| `exports` for `.`, `./core`, `./vue`, CSS | yes | +| Runtime deps use registry ranges (no `catalog:`) | yes | +| `engines.node` ^24.21.0 \|\| >=26.0.0 | yes | +| Not yet on npm (first publish) | confirm before publish | +| Root `LICENSE` / license field | MIT; signature assets remain SIL OFL 1.1 in tree | diff --git a/docs/app/app.vue b/docs/app/app.vue index 4494701..3a7e792 100644 --- a/docs/app/app.vue +++ b/docs/app/app.vue @@ -17,9 +17,8 @@ useHead({ htmlAttrs: { lang, }, - titleTemplate: (title) => { - if (!title || title === 'froq/ui') - return 'froq/ui' + titleTemplate: title => { + if (!title || title === 'froq/ui') return 'froq/ui' return `${title} — froq/ui` }, }) diff --git a/docs/app/assets/css/fonts.css b/docs/app/assets/css/fonts.css index ff2f455..3dc7ff3 100644 --- a/docs/app/assets/css/fonts.css +++ b/docs/app/assets/css/fonts.css @@ -6,7 +6,8 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist/files/geist-cyrillic-ext-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist/files/geist-cyrillic-ext-wght-normal.woff2') + format('woff2-variations'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } @@ -16,7 +17,8 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist/files/geist-cyrillic-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist/files/geist-cyrillic-wght-normal.woff2') + format('woff2-variations'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } @@ -26,10 +28,11 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist/files/geist-vietnamese-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist/files/geist-vietnamese-wght-normal.woff2') + format('woff2-variations'); unicode-range: - U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, - U+0323, U+0329, U+1EA0-1EF9, U+20AB; + U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, + U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* geist-latin-ext-wght-normal */ @@ -38,10 +41,12 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist/files/geist-latin-ext-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist/files/geist-latin-ext-wght-normal.woff2') + format('woff2-variations'); unicode-range: - U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, - U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; + U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, + U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, + U+A720-A7FF; } /* geist-latin-wght-normal */ @@ -50,10 +55,11 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist/files/geist-latin-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist/files/geist-latin-wght-normal.woff2') + format('woff2-variations'); unicode-range: - U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, - U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; + U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, + U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* geist-mono-cyrillic-ext-wght-normal */ @@ -62,7 +68,8 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist-mono/files/geist-mono-cyrillic-ext-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist-mono/files/geist-mono-cyrillic-ext-wght-normal.woff2') + format('woff2-variations'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } @@ -72,7 +79,8 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist-mono/files/geist-mono-cyrillic-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist-mono/files/geist-mono-cyrillic-wght-normal.woff2') + format('woff2-variations'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } @@ -82,7 +90,8 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist-mono/files/geist-mono-symbols2-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist-mono/files/geist-mono-symbols2-wght-normal.woff2') + format('woff2-variations'); unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F; } @@ -92,10 +101,11 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist-mono/files/geist-mono-vietnamese-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist-mono/files/geist-mono-vietnamese-wght-normal.woff2') + format('woff2-variations'); unicode-range: - U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, - U+0323, U+0329, U+1EA0-1EF9, U+20AB; + U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, + U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* geist-mono-latin-ext-wght-normal */ @@ -104,10 +114,12 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist-mono/files/geist-mono-latin-ext-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist-mono/files/geist-mono-latin-ext-wght-normal.woff2') + format('woff2-variations'); unicode-range: - U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, - U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; + U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, + U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, + U+A720-A7FF; } /* geist-mono-latin-wght-normal */ @@ -116,10 +128,11 @@ font-style: normal; font-display: optional; font-weight: 100 900; - src: url('@fontsource-variable/geist-mono/files/geist-mono-latin-wght-normal.woff2') format('woff2-variations'); + src: url('@fontsource-variable/geist-mono/files/geist-mono-latin-wght-normal.woff2') + format('woff2-variations'); unicode-range: - U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, - U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; + U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, + U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* instrument-serif-latin-ext-400-normal */ @@ -129,11 +142,14 @@ font-display: optional; font-weight: 400; src: - url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-normal.woff2') format('woff2'), - url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-normal.woff') format('woff'); + url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-normal.woff2') + format('woff2'), + url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-normal.woff') + format('woff'); unicode-range: - U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, - U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; + U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, + U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, + U+A720-A7FF; } /* instrument-serif-latin-400-normal */ @@ -143,11 +159,12 @@ font-display: optional; font-weight: 400; src: - url('@fontsource/instrument-serif/files/instrument-serif-latin-400-normal.woff2') format('woff2'), + url('@fontsource/instrument-serif/files/instrument-serif-latin-400-normal.woff2') + format('woff2'), url('@fontsource/instrument-serif/files/instrument-serif-latin-400-normal.woff') format('woff'); unicode-range: - U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, - U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; + U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, + U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* instrument-serif-latin-ext-400-italic */ @@ -157,11 +174,14 @@ font-display: optional; font-weight: 400; src: - url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-italic.woff2') format('woff2'), - url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-italic.woff') format('woff'); + url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-italic.woff2') + format('woff2'), + url('@fontsource/instrument-serif/files/instrument-serif-latin-ext-400-italic.woff') + format('woff'); unicode-range: - U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, - U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; + U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, + U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, + U+A720-A7FF; } /* instrument-serif-latin-400-italic */ @@ -171,9 +191,10 @@ font-display: optional; font-weight: 400; src: - url('@fontsource/instrument-serif/files/instrument-serif-latin-400-italic.woff2') format('woff2'), + url('@fontsource/instrument-serif/files/instrument-serif-latin-400-italic.woff2') + format('woff2'), url('@fontsource/instrument-serif/files/instrument-serif-latin-400-italic.woff') format('woff'); unicode-range: - U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, - U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; + U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, + U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } diff --git a/docs/app/components/ComponentApi.vue b/docs/app/components/ComponentApi.vue index 6c5dd18..872e091 100644 --- a/docs/app/components/ComponentApi.vue +++ b/docs/app/components/ComponentApi.vue @@ -15,10 +15,14 @@ const { t } = useI18n()
{{ doc.model.type }}{{ doc.model.type }}{{ prop.type }}{{ prop.type }}{{ event.payload }}{{ event.payload }}
-withDefaults(defineProps<{
- /** Open the banner. Closing it collapses the height so the body does not jump. */
- banner?: boolean
-}>(), {
- banner: true,
-})
+withDefaults(
+ defineProps<{
+ /** Open the banner. Closing it collapses the height so the body does not jump. */
+ banner?: boolean
+ }>(),
+ {
+ banner: true,
+ },
+)
diff --git a/docs/app/components/Sidebar.vue b/docs/app/components/Sidebar.vue
index 9edf070..a187c8a 100644
--- a/docs/app/components/Sidebar.vue
+++ b/docs/app/components/Sidebar.vue
@@ -2,13 +2,16 @@
import type { SidebarItem, SidebarLinkProps } from '@froq/ui'
import { Sidebar as UiSidebar } from '@froq/ui'
-const props = withDefaults(defineProps<{
- groups: NavGroup[]
- foldable?: boolean
-}>(), { foldable: false })
+const props = withDefaults(
+ defineProps<{
+ groups: NavGroup[]
+ foldable?: boolean
+ }>(),
+ { foldable: false },
+)
const route = useRoute()
const link = useSiteLink()
-const target = (to: string) => to.startsWith('#') ? to : link(to)
+const target = (to: string) => (to.startsWith('#') ? to : link(to))
function items(entries: NavItem[]): SidebarItem[] {
return entries.map(item => ({
@@ -18,25 +21,25 @@ function items(entries: NavItem[]): SidebarItem[] {
children: item.children ? items(item.children) : undefined,
}))
}
-const groups = computed(() => props.groups.map(group => ({
- label: group.label,
- items: items(group.items),
-})))
+const groups = computed(() =>
+ props.groups.map(group => ({
+ label: group.label,
+ items: items(group.items),
+ })),
+)
function current(entries: NavItem[]): string | undefined {
for (const item of entries) {
if (item.to.startsWith('#') ? route.hash === item.to : route.path === target(item.to))
return item.to
const child = item.children && current(item.children)
- if (child)
- return child
+ if (child) return child
}
}
const active = computed(() => {
for (const group of props.groups) {
const value = current(group.items)
- if (value)
- return value
+ if (value) return value
}
return ''
})
@@ -58,7 +61,9 @@ function routerLinkProps({ href: _href, onClick: _onClick, ...attrs }: SidebarLi