├── .npmrc
├── playground
├── tsconfig.json
├── server
│ ├── tsconfig.json
│ └── api
│ │ └── date.ts
├── nuxt.config.ts
├── app.vue
└── package.json
├── .vscode
└── settings.json
├── src
├── runtime
│ ├── server
│ │ └── tsconfig.json
│ └── formkit-tempo.ts
└── module.ts
├── test
├── fixtures
│ └── basic
│ │ ├── package.json
│ │ ├── app.vue
│ │ └── nuxt.config.ts
└── basic.test.ts
├── assets
└── nuxt-formkit-tempo.png
├── tsconfig.json
├── .editorconfig
├── script
└── generate-runtime-import.ts
├── eslint.config.mjs
├── .github
└── workflows
│ ├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
│ └── ci.yml
├── .gitignore
├── LICENSE
├── package.json
├── CHANGELOG.md
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
└── README.md
/.npmrc:
--------------------------------------------------------------------------------
1 | shamefully-hoist=true
2 | strict-peer-dependencies=false
3 |
--------------------------------------------------------------------------------
/playground/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.nuxt/tsconfig.json"
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "eslint.experimental.useFlatConfig": true
3 | }
4 |
--------------------------------------------------------------------------------
/playground/server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../.nuxt/tsconfig.server.json"
3 | }
4 |
--------------------------------------------------------------------------------
/src/runtime/server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../../.nuxt/tsconfig.server.json"
3 | }
4 |
--------------------------------------------------------------------------------
/test/fixtures/basic/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "basic",
4 | "type": "module"
5 | }
6 |
--------------------------------------------------------------------------------
/assets/nuxt-formkit-tempo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/selemondev/nuxt-formkit-tempo/HEAD/assets/nuxt-formkit-tempo.png
--------------------------------------------------------------------------------
/test/fixtures/basic/app.vue:
--------------------------------------------------------------------------------
1 |
2 | basic
3 |
4 |
5 |
7 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.nuxt/tsconfig.json",
3 | "exclude": ["dist", "node_modules", "playground"]
4 | }
5 |
--------------------------------------------------------------------------------
/playground/server/api/date.ts:
--------------------------------------------------------------------------------
1 | export default defineEventHandler((_event) => {
2 | return useFormat(new Date(), 'YYYY-MM-DD')
3 | })
4 |
--------------------------------------------------------------------------------
/test/fixtures/basic/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | import MyModule from '../../../src/module'
2 |
3 | export default defineNuxtConfig({
4 | modules: [
5 | MyModule,
6 | ],
7 | })
8 |
--------------------------------------------------------------------------------
/playground/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | export default defineNuxtConfig({
2 | modules: ['../src/module'],
3 | devtools: { enabled: true },
4 | tempo: {
5 | prefix: 'use',
6 | },
7 | })
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_size = 2
5 | indent_style = space
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/script/generate-runtime-import.ts:
--------------------------------------------------------------------------------
1 | import * as tempo from '@formkit/tempo'
2 | import fs from 'node:fs'
3 |
4 | const exports = Object.keys(tempo)
5 | .map(name => `export { ${name} } from '@formkit/tempo'`)
6 | .join('\n')
7 |
8 | fs.writeFileSync('src/runtime/formkit-tempo.ts', exports)
9 |
--------------------------------------------------------------------------------
/playground/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ formattedDate }}
4 |
5 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/playground/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "name": "nuxt-formkit-tempo-playground",
4 | "type": "module",
5 | "scripts": {
6 | "dev": "nuxi dev",
7 | "build": "nuxi build",
8 | "generate": "nuxi generate"
9 | },
10 | "dependencies": {
11 | "nuxt": "^3.13.2"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/eslint.config.mjs:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
3 |
4 | // Run `npx @eslint/config-inspector` to inspect the resolved config interactively
5 | export default createConfigForNuxt({
6 | features: {
7 | // Rules for module authors
8 | tooling: true,
9 | // Rules for formatting
10 | stylistic: true,
11 | },
12 | dirs: {
13 | src: [
14 | './playground',
15 | ],
16 | },
17 | })
18 | .append(
19 | // your custom flat config here...
20 | )
21 |
--------------------------------------------------------------------------------
/test/basic.test.ts:
--------------------------------------------------------------------------------
1 | import { fileURLToPath } from 'node:url'
2 | import { describe, it, expect } from 'vitest'
3 | import { setup, $fetch } from '@nuxt/test-utils/e2e'
4 |
5 | describe('ssr', async () => {
6 | await setup({
7 | rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
8 | })
9 |
10 | it('renders the index page', async () => {
11 | // Get response to a server-rendered page with `$fetch`.
12 | const html = await $fetch('/')
13 | expect(html).toContain('
basic
')
14 | })
15 | })
16 |
--------------------------------------------------------------------------------
/.github/workflows/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | node_modules
3 |
4 | # Logs
5 | *.log*
6 |
7 | # Temp directories
8 | .temp
9 | .tmp
10 | .cache
11 |
12 | # Yarn
13 | **/.yarn/cache
14 | **/.yarn/*state*
15 |
16 | # Generated dirs
17 | dist
18 |
19 | # Nuxt
20 | .nuxt
21 | .output
22 | .data
23 | .vercel_build_output
24 | .build-*
25 | .netlify
26 |
27 | # Env
28 | .env
29 |
30 | # Testing
31 | reports
32 | coverage
33 | *.lcov
34 | .nyc_output
35 |
36 | # VSCode
37 | .vscode/*
38 | !.vscode/settings.json
39 | !.vscode/tasks.json
40 | !.vscode/launch.json
41 | !.vscode/extensions.json
42 | !.vscode/*.code-snippets
43 |
44 | # Intellij idea
45 | *.iml
46 | .idea
47 |
48 | # OSX
49 | .DS_Store
50 | .AppleDouble
51 | .LSOverride
52 | .AppleDB
53 | .AppleDesktop
54 | Network Trash Folder
55 | Temporary Items
56 | .apdisk
57 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: ci
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 |
11 | jobs:
12 | lint:
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - uses: actions/checkout@v4
17 | - run: corepack enable
18 | - uses: actions/setup-node@v4
19 | with:
20 | node-version: 20
21 |
22 | - name: Install dependencies
23 | run: npx nypm@latest i
24 |
25 | - name: Lint
26 | run: npm run lint
27 |
28 | test:
29 | runs-on: ubuntu-latest
30 |
31 | steps:
32 | - uses: actions/checkout@v4
33 | - run: corepack enable
34 | - uses: actions/setup-node@v4
35 | with:
36 | node-version: 20
37 |
38 | - name: Install dependencies
39 | run: npx nypm@latest i
40 |
41 | - name: Playground prepare
42 | run: npm run dev:prepare
43 |
44 | - name: Test
45 | run: npm run test
46 |
--------------------------------------------------------------------------------
/.github/workflows/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | MIT License
3 |
4 | Copyright (c) Selemon Brahanu.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
--------------------------------------------------------------------------------
/src/module.ts:
--------------------------------------------------------------------------------
1 | import * as formkitTempo from '@formkit/tempo'
2 | import { addImports, createResolver, defineNuxtModule } from '@nuxt/kit'
3 |
4 | export interface ModuleOptions {
5 | prefix: string
6 | alias: Iterable<[string, string]>
7 | }
8 |
9 | export const firstLetterToUpperCase = (str: string) => {
10 | if (!str) return
11 | return str.charAt(0).toUpperCase() + str.slice(1)
12 | }
13 |
14 | export default defineNuxtModule({
15 | meta: {
16 | name: 'nuxt-formkit-tempo',
17 | configKey: 'tempo',
18 | compatibility: {
19 | nuxt: '>=3.0.0',
20 | },
21 | },
22 | // Default configuration options of the Nuxt module
23 | defaults: {
24 | prefix: '',
25 | alias: [],
26 | },
27 | setup(_options, _nuxt) {
28 | const { resolve } = createResolver(import.meta.url)
29 |
30 | const aliasMap = new Map(_options.alias)
31 | for (const name of Object.keys(formkitTempo)) {
32 | const alias = aliasMap.has(name) ? aliasMap.get(name)! : name
33 | const as = _options.prefix
34 | ? _options.prefix + firstLetterToUpperCase(alias)
35 | : alias
36 | addImports({ name, as, from: resolve('./runtime/formkit-tempo') })
37 |
38 | // Server based imports
39 | _nuxt.hook('nitro:config', (nitroConfig) => {
40 | nitroConfig.imports = nitroConfig.imports || {}
41 | nitroConfig.imports.presets = nitroConfig.imports.presets || []
42 | nitroConfig.imports.presets.push({
43 | from: resolve('./runtime/formkit-tempo'),
44 | imports: [{ name, as }],
45 | })
46 | })
47 | }
48 | },
49 | })
50 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt-formkit-tempo",
3 | "version": "1.2.0",
4 | "description": "The easiest way to work with dates in Nuxt 3. The unofficial Nuxt module port of @formkit/tempo 🕑.",
5 | "repository": "https://github.com/selemondev/nuxt-formkit-tempo",
6 | "author": {
7 | "name": "Selemon Brahanu"
8 | },
9 | "license": "MIT",
10 | "type": "module",
11 | "exports": {
12 | ".": {
13 | "types": "./dist/types.d.mts",
14 | "import": "./dist/module.mjs"
15 | }
16 | },
17 | "main": "./dist/module.mjs",
18 | "files": [
19 | "dist"
20 | ],
21 | "keywords": [
22 | "nuxt3",
23 | "dates",
24 | "javascript-dates",
25 | "time",
26 | "nuxt-module"
27 | ],
28 | "scripts": {
29 | "prepack": "pnpx esno@latest script/generate-runtime-import && nuxt-module-build build",
30 | "dev": "nuxi dev playground",
31 | "dev:build": "nuxi build playground",
32 | "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
33 | "release": "pnpm lint && pnpm test && pnpm prepack && pnpx changelogen@latest --release && npm publish && git push --follow-tags",
34 | "lint": "eslint .",
35 | "test": "vitest run",
36 | "test:watch": "vitest watch",
37 | "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
38 | },
39 | "dependencies": {
40 | "@formkit/tempo": "^0.1.2",
41 | "@nuxt/kit": "^4.2.1"
42 | },
43 | "devDependencies": {
44 | "@nuxt/devtools": "^2.7.0",
45 | "@nuxt/eslint-config": "^1.10.0",
46 | "@nuxt/module-builder": "^1.0.2",
47 | "@nuxt/schema": "^4.2.1",
48 | "@nuxt/test-utils": "^3.20.1",
49 | "@types/node": "latest",
50 | "eslint": "^9.39.1",
51 | "nuxt": "^4.2.1",
52 | "typescript": "~5.9.3",
53 | "vitest": "^3.2.4",
54 | "vue-tsc": "^3.1.4"
55 | },
56 | "packageManager": "pnpm@9.15.9"
57 | }
58 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 |
4 | ## v1.2.0
5 |
6 | [compare changes](https://github.com/selemondev/nuxt-formkit-tempo/compare/v1.1.0...v1.2.0)
7 |
8 | ### 🚀 Enhancements
9 |
10 | - Extend auto-imports to the server directory ([eab0228](https://github.com/selemondev/nuxt-formkit-tempo/commit/eab0228))
11 | - Use named exports for a tree-shakeable bundle ([3c28b0a](https://github.com/selemondev/nuxt-formkit-tempo/commit/3c28b0a))
12 |
13 | ### 🏡 Chore
14 |
15 | - Update dependencies ([aa8b2d8](https://github.com/selemondev/nuxt-formkit-tempo/commit/aa8b2d8))
16 | - **scripts:** Add named exports generation script ([3816589](https://github.com/selemondev/nuxt-formkit-tempo/commit/3816589))
17 | - **playground:** Update examples ([db70337](https://github.com/selemondev/nuxt-formkit-tempo/commit/db70337))
18 | - Use pnpm ([d0b1c12](https://github.com/selemondev/nuxt-formkit-tempo/commit/d0b1c12))
19 |
20 | ### ❤️ Contributors
21 |
22 | - Selemondev
23 |
24 | ## v1.1.0
25 |
26 | [compare changes](https://github.com/selemondev/nuxt-formkit-tempo/compare/v1.0.1...v1.1.0)
27 |
28 | ### 🚀 Enhancements
29 |
30 | - Support nuxt 4 ([db4f530](https://github.com/selemondev/nuxt-formkit-tempo/commit/db4f530))
31 |
32 | ### 📖 Documentation
33 |
34 | - Update README.md file ([5c89e9a](https://github.com/selemondev/nuxt-formkit-tempo/commit/5c89e9a))
35 | - Update README.md ([1a5cac5](https://github.com/selemondev/nuxt-formkit-tempo/commit/1a5cac5))
36 |
37 | ### 🏡 Chore
38 |
39 | - **release:** V1.0.1 ([c6b8137](https://github.com/selemondev/nuxt-formkit-tempo/commit/c6b8137))
40 | - Update dependencies ([91ea71e](https://github.com/selemondev/nuxt-formkit-tempo/commit/91ea71e))
41 | - Remove types field in package.json ([51e5697](https://github.com/selemondev/nuxt-formkit-tempo/commit/51e5697))
42 | - Update exports config in package.json ([fec457c](https://github.com/selemondev/nuxt-formkit-tempo/commit/fec457c))
43 | - Update module extension from cjs to mjs ([31815d3](https://github.com/selemondev/nuxt-formkit-tempo/commit/31815d3))
44 |
45 | ### ❤️ Contributors
46 |
47 | - Selemondev
48 | - Selemon Brahanu ([@selemondev](https://github.com/selemondev))
49 |
50 | ## v1.0.1
51 |
52 |
--------------------------------------------------------------------------------
/src/runtime/formkit-tempo.ts:
--------------------------------------------------------------------------------
1 | export { addDay } from '@formkit/tempo'
2 | export { addHour } from '@formkit/tempo'
3 | export { addMinute } from '@formkit/tempo'
4 | export { addMonth } from '@formkit/tempo'
5 | export { addSecond } from '@formkit/tempo'
6 | export { addYear } from '@formkit/tempo'
7 | export { ap } from '@formkit/tempo'
8 | export { applyOffset } from '@formkit/tempo'
9 | export { date } from '@formkit/tempo'
10 | export { dayEnd } from '@formkit/tempo'
11 | export { dayOfYear } from '@formkit/tempo'
12 | export { dayStart } from '@formkit/tempo'
13 | export { diffDays } from '@formkit/tempo'
14 | export { diffHours } from '@formkit/tempo'
15 | export { diffMilliseconds } from '@formkit/tempo'
16 | export { diffMinutes } from '@formkit/tempo'
17 | export { diffMonths } from '@formkit/tempo'
18 | export { diffSeconds } from '@formkit/tempo'
19 | export { diffWeeks } from '@formkit/tempo'
20 | export { diffYears } from '@formkit/tempo'
21 | export { format } from '@formkit/tempo'
22 | export { formatStr } from '@formkit/tempo'
23 | export { fourDigitYear } from '@formkit/tempo'
24 | export { hourEnd } from '@formkit/tempo'
25 | export { hourStart } from '@formkit/tempo'
26 | export { isAfter } from '@formkit/tempo'
27 | export { isBefore } from '@formkit/tempo'
28 | export { isEqual } from '@formkit/tempo'
29 | export { iso8601 } from '@formkit/tempo'
30 | export { minuteEnd } from '@formkit/tempo'
31 | export { minuteStart } from '@formkit/tempo'
32 | export { monthDays } from '@formkit/tempo'
33 | export { monthEnd } from '@formkit/tempo'
34 | export { monthStart } from '@formkit/tempo'
35 | export { nearestDay } from '@formkit/tempo'
36 | export { offset } from '@formkit/tempo'
37 | export { parse } from '@formkit/tempo'
38 | export { parseParts } from '@formkit/tempo'
39 | export { parts } from '@formkit/tempo'
40 | export { range } from '@formkit/tempo'
41 | export { removeOffset } from '@formkit/tempo'
42 | export { sameDay } from '@formkit/tempo'
43 | export { sameHour } from '@formkit/tempo'
44 | export { sameMinute } from '@formkit/tempo'
45 | export { sameSecond } from '@formkit/tempo'
46 | export { sameYear } from '@formkit/tempo'
47 | export { tzDate } from '@formkit/tempo'
48 | export { weekEnd } from '@formkit/tempo'
49 | export { weekStart } from '@formkit/tempo'
50 | export { yearDays } from '@formkit/tempo'
51 | export { yearEnd } from '@formkit/tempo'
52 | export { yearStart } from '@formkit/tempo'
53 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 | # Contributing
3 |
4 | Thank you for your valuable contribution and dedication to improving this project! We greatly appreciate your involvement. To ensure a smooth and cohesive collaboration, we have provided some guidelines to help you get started. Kindly take a moment to review them before submitting your contributions. Your efforts will undoubtedly make this project even better, and we look forward to working together on its success!.
5 |
6 | ## Code of Conduct
7 |
8 | This project is governed by the [Contributor Covenant Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to adhere to it.
9 |
10 | ## Open Development
11 |
12 | All work happens directly on GitHub. Both core team members and external contributors send pull requests which go through the same code review process.
13 |
14 | ## Semantic Versioning
15 |
16 | This project follows semantic versioning. We release patch versions for bug fixes or other changes that do not change the behavior of the API, minor versions for new features that are backward-compatible, and major versions for any breaking changes.
17 |
18 | Every significant change is documented in the changelog file.
19 |
20 | ## Reporting Issues
21 |
22 | Welcome to nuxt-formkit-tempo! We value your feedback and contributions to make this project better. If you encounter any bugs or have feature requests, please use [Github issues]() issues to submit them.
23 |
24 | Before reporting an issue, we ask you to:
25 | '
26 | 1. **Search for Similar Issues** : Ensure you have searched through our existing issues to see if the problem or feature request has already been addressed or is under discussion.
27 |
28 | 2. **Reproduce the Bug** : If reporting a bug, please provide the minimum code required to reproduce the issue. This will help us understand and resolve the problem more efficiently.
29 |
30 | 3. **Describe Feature Requests** : For feature requests, please describe the desired functionality and any additional context that might be helpful.
31 |
32 | Your participation and attention to these guidelines will help us maintain a more organized and effective development process.
33 |
34 | ## Commit Guidelines
35 |
36 | Commit messages are required to follow the [conventional-changelog standard](https://www.conventionalcommits.org/en/v1.0.0/):
37 |
38 | ```bash
39 | [optional scope]:
40 |
41 | [optional body]
42 |
43 | [optional footer(s)]
44 | ```
45 |
46 |
47 | 👉 [Commit example](https://github.com/unocss/unocss/releases/tag/v0.39.0)
48 |
49 | ### Commit types
50 |
51 | The following is a list of commit types:
52 |
53 | ### Commit Types:
54 |
55 | - 'feat': Adding a new snippet or significant functionality.
56 |
57 | - 'fix': Addressing bugs or issues.
58 |
59 | - 'docs': Commits related to documentation changes.
60 |
61 | - 'style': Commits related to code formatting, styling, or theming.
62 |
63 | - 'refactor': Code changes that enhance the library's structure without introducing new features or fixing bugs.
64 |
65 | - perf: Commits aimed at improving performance.
66 |
67 | - test: Commits related to testing.
68 |
69 | - chore: Other commits not affecting source or test files directly.
70 |
71 | ## License
72 |
73 | By contributing your code to the repository, you agree to license your contribution under the [MIT license](./LICENSE).
74 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 | # Contributor Covenant Code of Conduct
3 |
4 | ## Our Pledge
5 |
6 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, race, body size, disability, ethnicity, sex characteristics, and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
7 |
8 | ## Our Standards
9 |
10 | Examples of behavior that contributes to creating a positive environment include:
11 |
12 | - Using welcoming and inclusive language
13 | - Being respectful of differing viewpoints and experiences
14 | - Gracefully accepting constructive criticism
15 | - Focusing on what is best for the community
16 | - Showing empathy towards other community members
17 |
18 | Examples of unacceptable behavior by participants include:
19 |
20 | - The use of sexualized language or imagery and unwelcome sexual attention or advances
21 | - Trolling, insulting/derogatory comments, and personal or political attacks
22 | - Public or private harassment
23 | - Publishing others' private information, such as a physical or electronic address, without explicit permission
24 | - Other conduct which could reasonably be considered inappropriate in a professional setting
25 |
26 | ## Our Responsibilities
27 |
28 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
29 |
30 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
31 |
32 | ## Scope
33 |
34 | This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
35 |
36 | ## Enforcement
37 |
38 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the owner . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
39 |
40 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
41 |
42 | ## Attribution
43 |
44 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
45 |
46 | For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Nuxt Formkit Tempo
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | ## Demo
21 |
22 | ### Play with it on [Stackblitz](https://stackblitz.com/edit/nuxt-starter-2rrjst?file=app.vue)
23 |
24 | ## Quick Setup
25 |
26 | 1. Install the module in your Nuxt application with one command:
27 |
28 | ```bash
29 | npx nuxi@latest module add nuxt-formkit-tempo
30 | ```
31 |
32 | That's it! You can now use nuxt-formkit-tempo in your Nuxt application ✨.
33 |
34 | ## Configuration
35 |
36 | The `nuxt-formkit-tempo` module allows you to add prefixes and aliases to the utilities and helpers provided by the `@formkit/tempo` package.
37 |
38 | Below is how you can configure and use them in your Nuxt 3 project:
39 |
40 | ```ts
41 | export default defineNuxtConfig({
42 | modules: ['nuxt-formkit-tempo'],
43 | devtools: { enabled: true },
44 | tempo: {
45 | prefix: 'use',
46 | alias: [
47 | ['format', 'formatDate'],
48 | ],
49 | },
50 | })
51 |
52 | ```
53 |
54 | then in your component:
55 |
56 | ### Example 1 with `alias` + `prefix`:
57 |
58 | ```vue
59 |
60 |
61 |
62 | {{ newDate }}
63 |
64 |
65 |
66 |
67 |
72 | ```
73 |
74 |
75 | ### Example 2 with `prefix` only:
76 |
77 | ```ts
78 | export default defineNuxtConfig({
79 | modules: ['nuxt-formkit-tempo'],
80 | devtools: { enabled: true },
81 | tempo: {
82 | prefix: 'use'
83 | },
84 | })
85 |
86 | ```
87 |
88 | then in your component:
89 |
90 | ```vue
91 |
92 |
93 |
94 | {{ newDate }}
95 |
96 |
97 |
98 |
99 |
104 |
105 | ```
106 |
107 |
108 | ### Example 3 without `prefix` nor `alias`:
109 |
110 | ```ts
111 | export default defineNuxtConfig({
112 | modules: ['nuxt-formkit-tempo'],
113 | devtools: { enabled: true },
114 | tempo: {},
115 | })
116 |
117 | ```
118 |
119 | ```vue
120 |
121 |
122 |
123 | {{ newDate }}
124 |
125 |
126 |
127 |
128 |
133 |
134 | ```
135 |
136 | ## Types
137 |
138 | Below are the types of the `tempo` config:
139 |
140 | | Prop | Type | Description | Default |
141 | | ------------------ | ------- | -------------------------------------------------------- | --------- |
142 | | prefix | string | Keyword placed infront of the utilities and helpers. | '' |
143 | | alias | [string, string][] | A unique name assigned to a utility to avoid naming conflicts with other third-party packages and libraries. | [] |
144 |
145 |
146 | ## Contribution
147 |
148 |
149 | Local development
150 |
151 | ```bash
152 | # Install dependencies
153 | npm install
154 |
155 | # Generate type stubs
156 | npm run dev:prepare
157 |
158 | # Develop with the playground
159 | npm run dev
160 |
161 | # Build the playground
162 | npm run dev:build
163 |
164 | # Run ESLint
165 | npm run lint
166 |
167 | # Run Vitest
168 | npm run test
169 | npm run test:watch
170 |
171 | # Release new version
172 | npm run release
173 | ```
174 |
175 |
176 |
177 |
178 | Happy hacking ✨.
179 |
--------------------------------------------------------------------------------