@plutocms/utils 0.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +12 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +14 -0
- package/.vscode/settings.json +47 -0
- package/.vscode/vue.code-snippets +16 -0
- package/app/components/NavbarAdminActionButton.vue +70 -0
- package/app/composables/navbar-admin-actions.ts +12 -0
- package/app/composables/sidebar-admin-actions.ts +18 -0
- package/bun.lock +2586 -0
- package/eslint.config.mjs +84 -0
- package/nuxt.config.ts +17 -0
- package/package.json +701 -0
- package/shared/types/navbar.ts +9 -0
- package/shared/utils/currency.ts +43 -0
- package/shared/utils/string.ts +21 -0
- package/tsconfig.json +18 -0
package/.editorconfig
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
"Vue.volar",
|
|
4
|
+
"EditorConfig.EditorConfig",
|
|
5
|
+
"esbenp.prettier-vscode",
|
|
6
|
+
"dbaeumer.vscode-eslint",
|
|
7
|
+
"bradlc.vscode-tailwindcss",
|
|
8
|
+
"antfu.goto-alias",
|
|
9
|
+
"antfu.iconify",
|
|
10
|
+
"streetsidesoftware.code-spell-checker",
|
|
11
|
+
"usernamehw.errorlens"
|
|
12
|
+
],
|
|
13
|
+
"unwantedRecommendations": ["octref.vetur"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"css.lint.unknownAtRules": "ignore",
|
|
3
|
+
"less.lint.unknownAtRules": "ignore",
|
|
4
|
+
"scss.lint.unknownAtRules": "ignore",
|
|
5
|
+
"files.associations": {
|
|
6
|
+
"*.css": "tailwindcss"
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
"editor.codeActionsOnSave": {
|
|
10
|
+
"source.fixAll": "never",
|
|
11
|
+
"source.fixAll.eslint": "explicit"
|
|
12
|
+
},
|
|
13
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
14
|
+
"editor.formatOnSave": true,
|
|
15
|
+
"editor.gotoLocation.multipleDefinitions": "goto",
|
|
16
|
+
"editor.quickSuggestions": {
|
|
17
|
+
"strings": true
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"eslint.useFlatConfig": true,
|
|
21
|
+
"eslint.validate": [
|
|
22
|
+
"javascript",
|
|
23
|
+
"javascriptreact",
|
|
24
|
+
"typescript",
|
|
25
|
+
"typescriptreact",
|
|
26
|
+
"vue",
|
|
27
|
+
"html",
|
|
28
|
+
"markdown",
|
|
29
|
+
"json",
|
|
30
|
+
"jsonc",
|
|
31
|
+
"yaml",
|
|
32
|
+
"toml",
|
|
33
|
+
"xml",
|
|
34
|
+
"gql",
|
|
35
|
+
"graphql",
|
|
36
|
+
"astro",
|
|
37
|
+
"svelte",
|
|
38
|
+
"css",
|
|
39
|
+
"less",
|
|
40
|
+
"scss",
|
|
41
|
+
"pcss",
|
|
42
|
+
"postcss",
|
|
43
|
+
"mjs"
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
"vue.inlayHints.missingProps": true
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Vue Component": {
|
|
3
|
+
"prefix": ["vue", "tem", "template", "setup"],
|
|
4
|
+
"body": [
|
|
5
|
+
"<script setup lang=\"ts\">",
|
|
6
|
+
"$1",
|
|
7
|
+
"</script>",
|
|
8
|
+
"",
|
|
9
|
+
"<template>",
|
|
10
|
+
" <div>$2</div>",
|
|
11
|
+
"</template>",
|
|
12
|
+
"",
|
|
13
|
+
],
|
|
14
|
+
"description": "Vue Component (Script first)",
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NavbarAdminActionButtonProps } from '../../shared/types/navbar'
|
|
3
|
+
|
|
4
|
+
type Props = NavbarAdminActionButtonProps
|
|
5
|
+
|
|
6
|
+
const props = defineProps<Props>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<li v-if="props.show" class="nav-item">
|
|
11
|
+
<NuxtLink
|
|
12
|
+
:to="props.to?.toString()"
|
|
13
|
+
:title="props.title"
|
|
14
|
+
:disabled="props.disabled"
|
|
15
|
+
:target="props.target"
|
|
16
|
+
class="nav-link"
|
|
17
|
+
>
|
|
18
|
+
<span class="nav-content">
|
|
19
|
+
<Icon v-if="props.icon" :name="props.icon" class="link-icon" />
|
|
20
|
+
|
|
21
|
+
<span class="link-label"> {{ props.label }} </span>
|
|
22
|
+
</span>
|
|
23
|
+
</NuxtLink>
|
|
24
|
+
</li>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
.nav-item {
|
|
29
|
+
height: 100%;
|
|
30
|
+
list-style: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.nav-link {
|
|
34
|
+
display: block;
|
|
35
|
+
height: 100%;
|
|
36
|
+
background-color: transparent;
|
|
37
|
+
padding-top: 0.25rem;
|
|
38
|
+
padding-bottom: 0.25rem;
|
|
39
|
+
transition-property: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.nav-content {
|
|
43
|
+
box-sizing: content-box;
|
|
44
|
+
display: flex;
|
|
45
|
+
height: 100%;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: 0.5rem;
|
|
48
|
+
border-radius: 0.125rem;
|
|
49
|
+
padding-left: 0.5rem;
|
|
50
|
+
padding-right: 0.5rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.nav-link:hover .nav-content {
|
|
54
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dark .nav-link:hover .nav-content {
|
|
58
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.link-icon {
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.link-label {
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NavigationMenuItem } from '@nuxt/ui'
|
|
2
|
+
|
|
3
|
+
const actions = ref<NavigationMenuItem[]>([])
|
|
4
|
+
|
|
5
|
+
export function useSidebarAdminActions() {
|
|
6
|
+
const addAction = (action: NavigationMenuItem[]) => {
|
|
7
|
+
// @ts-expect-error - Type instantiation is excessively deep and possibly infinite.
|
|
8
|
+
const existingLabels = new Set(actions.value.map((a) => a.label))
|
|
9
|
+
const newActions = action.filter((a) => !existingLabels.has(a.label))
|
|
10
|
+
|
|
11
|
+
actions.value = [...actions.value, ...newActions]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
actions,
|
|
16
|
+
addAction,
|
|
17
|
+
}
|
|
18
|
+
}
|